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.  * This file is released under the LGPL
  12.  * "GNU Lesser General Public License"
  13.  * More information can be found here:
  14.  * {@link http://www.gnu.org/copyleft/lesser.html}
  15.  *
  16.  * @author     Jordi Boggiano <[email protected]>
  17.  * @copyright  Copyright (c) 2008, Jordi Boggiano
  18.  * @license    http://www.gnu.org/copyleft/lesser.html  GNU Lesser General Public License
  19.  * @link       http://dwoo.org/
  20.  * @version    0.9.1
  21.  * @date       2008-05-30
  22.  * @package    Dwoo
  23.  */
  24. {
  25.     protected static $stack array();
  26.  
  27.     public function init($enabled)
  28.     {
  29.     }
  30.  
  31.     public static function preProcessing(Dwoo_Compiler $compilerarray $params$prepend$append$type)
  32.     {
  33.         $params $compiler->getCompiledParams($params);
  34.         switch(strtolower(trim((string) $params['enabled']'"\''))) {
  35.  
  36.         case 'on':
  37.         case 'true':
  38.         case 'enabled':
  39.         case 'enable':
  40.         case '1':
  41.             $enable true;
  42.             break;
  43.         case 'off':
  44.         case 'false':
  45.         case 'disabled':
  46.         case 'disable':
  47.         case '0':
  48.             $enable false;
  49.             break;
  50.         default:
  51.             throw new Dwoo_Compilation_Exception($compiler'Auto_Escape : Invalid parameter ('.$params['enabled'].'), valid parameters are "enable"/true or "disable"/false');
  52.  
  53.         }
  54.  
  55.         self::$stack[$compiler->getAutoEscape();
  56.         $compiler->setAutoEscape($enable);
  57.         return '';
  58.     }
  59.  
  60.     public static function postProcessing(Dwoo_Compiler $compilerarray $params$prepend$append$content)
  61.     {
  62.         $compiler->setAutoEscape(array_pop(self::$stack));
  63.         return $content;
  64.     
  65. }

Documentation generated on Sun, 03 Aug 2008 15:12:18 +0200 by phpDocumentor 1.4.0