mirror of
https://github.com/fenom-template/fenom.git
synced 2023-08-10 21:13:07 +03:00
Fix escaping
This commit is contained in:
@@ -875,21 +875,24 @@ class Compiler {
|
||||
* @return string
|
||||
*/
|
||||
public static function tagRaw(Tokenizer $tokens, Template $tpl) {
|
||||
$escape = $tpl->escape;
|
||||
$tpl->escape = false;
|
||||
if($tokens->is(':')) {
|
||||
$func = $tokens->getNext(Tokenizer::MACRO_STRING);
|
||||
$tag = $tpl->getStorage()->getFunction($func);
|
||||
if($tag["type"] == \Fenom::INLINE_FUNCTION) {
|
||||
return $tpl->parseAct($tokens);
|
||||
$code = $tpl->parseAct($tokens);
|
||||
} elseif ($tag["type"] == \Fenom::BLOCK_FUNCTION) {
|
||||
$code = $tpl->parseAct($tokens);
|
||||
$tpl->getLastScope()->escape = false;
|
||||
return $code;
|
||||
} else {
|
||||
throw new InvalidUsageException("Raw mode allow for expressions or functions");
|
||||
}
|
||||
throw new InvalidUsageException("Raw mode allow for expressions or functions");
|
||||
} else {
|
||||
return $tpl->out($tpl->parseExp($tokens, true));
|
||||
$code = $tpl->out($tpl->parseExp($tokens, true), false);
|
||||
}
|
||||
$tpl->escape = $escape;
|
||||
return $code;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -29,7 +29,7 @@ class Scope extends \ArrayObject {
|
||||
private $_action;
|
||||
private $_body;
|
||||
private $_offset;
|
||||
private $_global_escape = false;
|
||||
public $_global_escape = false;
|
||||
|
||||
/**
|
||||
* Creating cope
|
||||
|
@@ -452,7 +452,6 @@ class Template extends Render {
|
||||
* @throws TokenizeException
|
||||
*/
|
||||
private function _end(Tokenizer $tokens) {
|
||||
//return "end";
|
||||
$name = $tokens->getNext(Tokenizer::MACRO_STRING);
|
||||
$tokens->next();
|
||||
if(!$this->_stack) {
|
||||
@@ -466,8 +465,9 @@ class Template extends Render {
|
||||
if($scope->is_compiler) {
|
||||
return $scope->close($tokens);
|
||||
} else {
|
||||
$code = $this->out($scope->close($tokens));
|
||||
$scope->tpl->escape = $scope->escape;
|
||||
return $this->out($scope->close($tokens));
|
||||
return $code;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user