@@ -498,7 +498,7 @@ class Mustache_Compiler
|
|||||||
}
|
}
|
||||||
|
|
||||||
const VARIABLE = '
|
const VARIABLE = '
|
||||||
$value = $this->resolveValue($context->%s(%s), $context, $indent);%s
|
$value = $this->resolveValue($context->%s(%s), $context);%s
|
||||||
$buffer .= %s%s;
|
$buffer .= %s%s;
|
||||||
';
|
';
|
||||||
|
|
||||||
|
|||||||
@@ -164,16 +164,15 @@ abstract class Mustache_Template
|
|||||||
*
|
*
|
||||||
* @param mixed $value
|
* @param mixed $value
|
||||||
* @param Mustache_Context $context
|
* @param Mustache_Context $context
|
||||||
* @param string $indent
|
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function resolveValue($value, Mustache_Context $context, $indent = '')
|
protected function resolveValue($value, Mustache_Context $context)
|
||||||
{
|
{
|
||||||
if (($this->strictCallables ? is_object($value) : !is_string($value)) && is_callable($value)) {
|
if (($this->strictCallables ? is_object($value) : !is_string($value)) && is_callable($value)) {
|
||||||
return $this->mustache
|
return $this->mustache
|
||||||
->loadLambda((string) call_user_func($value))
|
->loadLambda((string) call_user_func($value))
|
||||||
->renderInternal($context, $indent);
|
->renderInternal($context);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $value;
|
return $value;
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ class Mustache_Test_CompilerTest extends PHPUnit_Framework_TestCase
|
|||||||
'ISO-8859-1',
|
'ISO-8859-1',
|
||||||
array(
|
array(
|
||||||
"\nclass Monkey extends Mustache_Template",
|
"\nclass Monkey extends Mustache_Template",
|
||||||
'$value = $this->resolveValue($context->find(\'name\'), $context, $indent);',
|
'$value = $this->resolveValue($context->find(\'name\'), $context);',
|
||||||
'$buffer .= $indent . call_user_func($this->mustache->getEscape(), $value);',
|
'$buffer .= $indent . call_user_func($this->mustache->getEscape(), $value);',
|
||||||
'return $buffer;',
|
'return $buffer;',
|
||||||
),
|
),
|
||||||
@@ -75,7 +75,7 @@ class Mustache_Test_CompilerTest extends PHPUnit_Framework_TestCase
|
|||||||
'ISO-8859-1',
|
'ISO-8859-1',
|
||||||
array(
|
array(
|
||||||
"\nclass Monkey extends Mustache_Template",
|
"\nclass Monkey extends Mustache_Template",
|
||||||
'$value = $this->resolveValue($context->find(\'name\'), $context, $indent);',
|
'$value = $this->resolveValue($context->find(\'name\'), $context);',
|
||||||
'$buffer .= $indent . htmlspecialchars($value, ' . ENT_COMPAT . ', \'ISO-8859-1\');',
|
'$buffer .= $indent . htmlspecialchars($value, ' . ENT_COMPAT . ', \'ISO-8859-1\');',
|
||||||
'return $buffer;',
|
'return $buffer;',
|
||||||
),
|
),
|
||||||
@@ -95,7 +95,7 @@ class Mustache_Test_CompilerTest extends PHPUnit_Framework_TestCase
|
|||||||
'ISO-8859-1',
|
'ISO-8859-1',
|
||||||
array(
|
array(
|
||||||
"\nclass Monkey extends Mustache_Template",
|
"\nclass Monkey extends Mustache_Template",
|
||||||
'$value = $this->resolveValue($context->find(\'name\'), $context, $indent);',
|
'$value = $this->resolveValue($context->find(\'name\'), $context);',
|
||||||
'$buffer .= $indent . htmlspecialchars($value, ' . ENT_QUOTES . ', \'ISO-8859-1\');',
|
'$buffer .= $indent . htmlspecialchars($value, ' . ENT_QUOTES . ', \'ISO-8859-1\');',
|
||||||
'return $buffer;',
|
'return $buffer;',
|
||||||
),
|
),
|
||||||
@@ -122,9 +122,9 @@ class Mustache_Test_CompilerTest extends PHPUnit_Framework_TestCase
|
|||||||
array(
|
array(
|
||||||
"\nclass Monkey extends Mustache_Template",
|
"\nclass Monkey extends Mustache_Template",
|
||||||
"\$buffer .= \$indent . 'foo\n';",
|
"\$buffer .= \$indent . 'foo\n';",
|
||||||
'$value = $this->resolveValue($context->find(\'name\'), $context, $indent);',
|
'$value = $this->resolveValue($context->find(\'name\'), $context);',
|
||||||
'$buffer .= htmlspecialchars($value, ' . ENT_COMPAT . ', \'UTF-8\');',
|
'$buffer .= htmlspecialchars($value, ' . ENT_COMPAT . ', \'UTF-8\');',
|
||||||
'$value = $this->resolveValue($context->last(), $context, $indent);',
|
'$value = $this->resolveValue($context->last(), $context);',
|
||||||
'$buffer .= \'\\\'bar\\\'\';',
|
'$buffer .= \'\\\'bar\\\'\';',
|
||||||
'return $buffer;',
|
'return $buffer;',
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user