AutoEscape.php 974B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. /*
  3. * This file is part of Twig.
  4. *
  5. * (c) 2009 Fabien Potencier
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. /**
  11. * Represents an autoescape node.
  12. *
  13. * The value is the escaping strategy (can be html, js, ...)
  14. *
  15. * The true value is equivalent to html.
  16. *
  17. * If autoescaping is disabled, then the value is false.
  18. *
  19. * @package twig
  20. * @author Fabien Potencier <fabien@symfony.com>
  21. */
  22. class Twig_Node_AutoEscape extends Twig_Node
  23. {
  24. public function __construct($value, Twig_NodeInterface $body, $lineno, $tag = 'autoescape')
  25. {
  26. parent::__construct(array('body' => $body), array('value' => $value), $lineno, $tag);
  27. }
  28. /**
  29. * Compiles the node to PHP.
  30. *
  31. * @param Twig_Compiler A Twig_Compiler instance
  32. */
  33. public function compile(Twig_Compiler $compiler)
  34. {
  35. $compiler->subcompile($this->getNode('body'));
  36. }
  37. }