本文整理汇总了PHP中Twig_Node::getFilters方法的典型用法代码示例。如果您正苦于以下问题:PHP Twig_Node::getFilters方法的具体用法?PHP Twig_Node::getFilters怎么用?PHP Twig_Node::getFilters使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Twig_Node
的用法示例。
在下文中一共展示了Twig_Node::getFilters方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: visit
public function visit(Twig_Node $node)
{
// filter?
if ($node instanceof Twig_Node_Filter) {
$this->statusStack[] = $node->getFilters();
$node = $this->visitDeep($node);
array_pop($this->statusStack);
return $node;
}
if (!$node instanceof Twig_Node_Print && !$node instanceof Twig_Node_Text) {
return $this->visitDeep($node);
}
if (false === ($filters = $this->getCurrentFilters())) {
return $node;
}
if ($node instanceof Twig_Node_Text) {
$expression = new Twig_Node_Expression_Constant($node->getData(), $node->getLine());
} else {
$expression = $node->getExpression();
}
// filters
if ($expression instanceof Twig_Node_Expression_Filter) {
$expression->appendFilters($filters);
return $node;
} else {
return new Twig_Node_Print(new Twig_Node_Expression_Filter($expression, $filters, $node->getLine()), $node->getLine());
}
}
示例2: enterNode
public function enterNode(Twig_Node $node, Twig_Environment $env)
{
if ($node instanceof Twig_Node_Filter) {
$this->statusStack[] = $node->getFilters();
} elseif ($node instanceof Twig_Node_Print || $node instanceof Twig_Node_Text) {
return $this->applyFilters($node);
}
return $node;
}
示例3: enterNode
public function enterNode(Twig_Node $node, Twig_Environment $env)
{
if ($node instanceof Twig_Node_Module) {
$this->inAModule = true;
$this->tags = array();
$this->filters = array();
return $node;
} elseif ($this->inAModule) {
// look for tags
if ($node->getTag()) {
$this->tags[$node->getTag()] = true;
}
// look for filters
if ($node instanceof Twig_Node_Expression_Filter) {
foreach ($node->getFilters() as $filter) {
$this->filters[$filter[0]] = true;
}
}
}
return $node;
}