本文整理汇总了PHP中Dwoo_Compiler::setAutoEscape方法的典型用法代码示例。如果您正苦于以下问题:PHP Dwoo_Compiler::setAutoEscape方法的具体用法?PHP Dwoo_Compiler::setAutoEscape怎么用?PHP Dwoo_Compiler::setAutoEscape使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dwoo_Compiler
的用法示例。
在下文中一共展示了Dwoo_Compiler::setAutoEscape方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testAutoEscape
public function testAutoEscape()
{
$cmp = new Dwoo_Compiler();
$cmp->setAutoEscape(true);
$tpl = new Dwoo_Template_String('{$foo}{auto_escape off}{$foo}{/}');
$tpl->forceCompilation();
$this->assertEquals("a<b>ca<b>c", $this->dwoo->get($tpl, array('foo' => 'a<b>c'), $cmp));
$tpl = new Dwoo_Template_String('{$foo}{auto_escape true}{$foo}{/}');
$tpl->forceCompilation();
$this->assertEquals("a<b>ca<b>c", $this->dwoo->get($tpl, array('foo' => 'a<b>c')));
// fixes the init call not being called (which is normal)
$fixCall = new Dwoo_Plugin_auto_escape($this->dwoo);
$fixCall->init('');
}
示例2: postProcessing
public static function postProcessing(Dwoo_Compiler $compiler, array $params, $prepend, $append, $content)
{
$compiler->setAutoEscape(array_pop(self::$stack));
return $content;
}
示例3: testAutoEscapeWithFunctionCall
public function testAutoEscapeWithFunctionCall()
{
$cmp = new Dwoo_Compiler();
$cmp->setAutoEscape(true);
$this->assertEquals(true, $cmp->getAutoEscape());
$tpl = new Dwoo_Template_String('{upper $foo}{upper $foo|safe}');
$tpl->forceCompilation();
$this->assertEquals("A<B>CA<B>C", $this->dwoo->get($tpl, array('foo' => 'a<b>c'), $cmp));
}
示例4: testDoubleEscapingOnAssignments
public function testDoubleEscapingOnAssignments()
{
$tpl = new Dwoo_Template_String('{$bar = $foo}{$foo}{$bar}');
$tpl->forceCompilation();
$cmp = new Dwoo_Compiler();
$cmp->setAutoEscape(true);
$this->assertEquals('a'ba'b', $this->dwoo->get($tpl, array('foo' => "a'b"), $cmp));
}