Skip to content

Commit

Permalink
Adding encode method parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
zombor committed May 25, 2010
1 parent 4f93d21 commit a22cfbe
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion classes/kohana/view.php
Expand Up @@ -27,6 +27,11 @@ class Kohana_View {
*/
protected $_raw_output_char = '!';

/**
* The encoding method to use on view output. Only use the method name, leave out parenthesis.
*/
protected $_encode_method = 'html::chars';

/**
* Returns a new View object. If you do not define the "file" parameter,
* you must call [View::set_filename].
Expand Down Expand Up @@ -97,7 +102,7 @@ protected function capture($kohana_view_filename, array $kohana_view_data)
protected function _escape_val($matches)
{
if (substr(trim($matches[2]), 0, 1) != $this->_raw_output_char)
return '<?php echo html::chars('.$matches[2].'); ?>';
return '<?php echo '.$this->_encode_method.'('.$matches[2].'); ?>';
else // Remove the "turn off escape" character
return '<?php echo '.substr(trim($matches[2]), strlen($this->$_raw_output_char), strlen($matches[2])-1).'; ?>';
}
Expand Down

0 comments on commit a22cfbe

Please sign in to comment.