Source for file dynamic.php

Documentation is available at dynamic.php

  1. <?php
  2.  
  3. /**
  4.  * Marks the contents of the block as dynamic. Which means that it will not be cached.
  5.  *
  6.  * This software is provided 'as-is', without any express or implied warranty.
  7.  * In no event will the authors be held liable for any damages arising from the use of this software.
  8.  *
  9.  * This file is released under the LGPL
  10.  * "GNU Lesser General Public License"
  11.  * More information can be found here:
  12.  * {@link http://www.gnu.org/copyleft/lesser.html}
  13.  *
  14.  * @author     Jordi Boggiano <[email protected]>
  15.  * @copyright  Copyright (c) 2008, Jordi Boggiano
  16.  * @license    http://www.gnu.org/copyleft/lesser.html  GNU Lesser General Public License
  17.  * @link       http://dwoo.org/
  18.  * @version    0.9.1
  19.  * @date       2008-05-30
  20.  * @package    Dwoo
  21.  */
  22. {
  23.     public function init()
  24.     {
  25.     }
  26.  
  27.     public static function preProcessing(Dwoo_Compiler $compilerarray $params$prepend$append$type)
  28.     {
  29.         return '';
  30.     }
  31.  
  32.     public static function postProcessing(Dwoo_Compiler $compilerarray $params$prepend$append$content)
  33.     {
  34.         $output Dwoo_Compiler::PHP_OPEN 
  35.             'if($doCache) {'."\n\t".
  36.                 'echo \'<dwoo:dynamic_\'.$dynamicId.\'>'
  37.                 str_replace('\'''\\\''$content.
  38.                 '</dwoo:dynamic_\'.$dynamicId.\'>\';'.
  39.             "\n} else {\n\t";
  40.                 if(substr($content0strlen(Dwoo_Compiler::PHP_OPEN)) == Dwoo_Compiler::PHP_OPEN{
  41.                     $output .= substr($contentstrlen(Dwoo_Compiler::PHP_OPEN));
  42.                 else {
  43.                     $output .= Dwoo_Compiler::PHP_CLOSE $content;
  44.                 }
  45.                 if(substr($output-strlen(Dwoo_Compiler::PHP_CLOSE)) == Dwoo_Compiler::PHP_CLOSE{
  46.                     $output substr($output0-strlen(Dwoo_Compiler::PHP_CLOSE));
  47.                 else {
  48.                     $output .= Dwoo_Compiler::PHP_OPEN;
  49.                 }                
  50.             $output .= "\n}"Dwoo_Compiler::PHP_CLOSE;
  51.  
  52.         return $output;
  53.     }
  54.     
  55.     public static function unescape($output$dynamicId)
  56.     {
  57.         return preg_replace_callback('/<dwoo:dynamic_('.$dynamicId.')>(.+?)<\/dwoo:dynamic_'.$dynamicId.'>/'array('self''unescapePhp')$output);
  58.     }
  59.     
  60.     public static function unescapePhp($match)
  61.     {
  62.         return preg_replace('{<\?php /\*'.$match[1].'\*/ echo \'(.+?)\'; \?>}''$1'$match[2]);
  63.     }
  64. }

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