Source for file auto_escape.php

Documentation is available at auto_escape.php

  1. <?php
  2.  
  3. /**
  4.  * Overrides the compiler auto-escape setting within the block
  5.  * <pre>
  6.  *  * enabled : if set to "on", "enable", true or 1 then the compiler autoescaping is enabled inside this block. set to "off", "disable", false or 0 to disable it
  7.  * </pre>
  8.  * This software is provided 'as-is', without any express or implied warranty.
  9.  * In no event will the authors be held liable for any damages arising from the use of this software.
  10.  *
  11.  * @author     Jordi Boggiano <j.boggiano@seld.be>
  12.  * @copyright  Copyright (c) 2008, Jordi Boggiano
  13.  * @license    http://dwoo.org/LICENSE   Modified BSD License
  14.  * @link       http://dwoo.org/
  15.  * @version    1.0.0
  16.  * @date       2008-10-23
  17.  * @package    Dwoo
  18.  */
  19. {
  20.     protected static $stack array();
  21.  
  22.     public function init($enabled)
  23.     {
  24.     }
  25.  
  26.     public static function preProcessing(Dwoo_Compiler $compilerarray $params$prepend$append$type)
  27.     {
  28.         $params $compiler->getCompiledParams($params);
  29.         switch(strtolower(trim((string) $params['enabled']'"\''))) {
  30.  
  31.         case 'on':
  32.         case 'true':
  33.         case 'enabled':
  34.         case 'enable':
  35.         case '1':
  36.             $enable true;
  37.             break;
  38.         case 'off':
  39.         case 'false':
  40.         case 'disabled':
  41.         case 'disable':
  42.         case '0':
  43.             $enable false;
  44.             break;
  45.         default:
  46.             throw new Dwoo_Compilation_Exception($compiler'Auto_Escape : Invalid parameter ('.$params['enabled'].'), valid parameters are "enable"/true or "disable"/false');
  47.  
  48.         }
  49.  
  50.         self::$stack[$compiler->getAutoEscape();
  51.         $compiler->setAutoEscape($enable);
  52.         return '';
  53.     }
  54.  
  55.     public static function postProcessing(Dwoo_Compiler $compilerarray $params$prepend$append$content)
  56.     {
  57.         $compiler->setAutoEscape(array_pop(self::$stack));
  58.         return $content;
  59.     
  60. }

Documentation generated on Sun, 07 Feb 2010 17:53:12 +0000 by phpDocumentor 1.4.0