本文整理汇总了PHP中Twig_Node::getValue方法的典型用法代码示例。如果您正苦于以下问题:PHP Twig_Node::getValue方法的具体用法?PHP Twig_Node::getValue怎么用?PHP Twig_Node::getValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Twig_Node
的用法示例。
在下文中一共展示了Twig_Node::getValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: visit
public function visit(Twig_Node $node)
{
// autoescape?
if ($node instanceof Twig_Node_AutoEscape) {
$this->statusStack[] = $node->getValue();
$node = $this->visitDeep($node);
array_pop($this->statusStack);
// remove the node
return $node;
}
if (!$node instanceof Twig_Node_Print) {
return $this->visitDeep($node);
}
if (false === $this->needEscaping()) {
return $node;
}
$expression = $node->getExpression();
// don't escape if escape has already been called
// or if we want the safe string
if ($expression instanceof Twig_Node_Expression_Filter && ($expression->hasFilter('escape') || $expression->hasFilter('safe'))) {
return $node;
}
// escape
if ($expression instanceof Twig_Node_Expression_Filter) {
$expression->appendFilter(array('escape', array()));
return $node;
} else {
return new Twig_Node_Print(new Twig_Node_Expression_Filter($expression, array(array('escape', array())), $node->getLine()), $node->getLine());
}
}
示例2: enterNode
public function enterNode(Twig_Node $node, Twig_Environment $env)
{
if ($node instanceof Twig_Node_AutoEscape) {
$this->statusStack[] = $node->getValue();
} elseif ($node instanceof Twig_Node_Print && true === $this->needEscaping($env)) {
return $this->escapeNode($node, $env);
} elseif ($node instanceof Twig_Node_Block) {
$this->statusStack[] = isset($this->blocks[$node->getName()]) ? $this->blocks[$node->getName()] : $this->needEscaping($env);
}
return $node;
}