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.  * @author     Jordi Boggiano <j.boggiano@seld.be>
  10.  * @copyright  Copyright (c) 2008, Jordi Boggiano
  11.  * @license    http://dwoo.org/LICENSE   Modified BSD License
  12.  * @link       http://dwoo.org/
  13.  * @version    1.0.0
  14.  * @date       2008-10-23
  15.  * @package    Dwoo
  16.  */
  17. {
  18.     public function init()
  19.     {
  20.     }
  21.  
  22.     public static function preProcessing(Dwoo_Compiler $compilerarray $params$prepend$append$type)
  23.     {
  24.         return '';
  25.     }
  26.  
  27.     public static function postProcessing(Dwoo_Compiler $compilerarray $params$prepend$append$content)
  28.     {
  29.         $output Dwoo_Compiler::PHP_OPEN 
  30.             'if($doCache) {'."\n\t".
  31.                 'echo \'<dwoo:dynamic_\'.$dynamicId.\'>'
  32.                 str_replace('\'''\\\''$content.
  33.                 '</dwoo:dynamic_\'.$dynamicId.\'>\';'.
  34.             "\n} else {\n\t";
  35.                 if(substr($content0strlen(Dwoo_Compiler::PHP_OPEN)) == Dwoo_Compiler::PHP_OPEN{
  36.                     $output .= substr($contentstrlen(Dwoo_Compiler::PHP_OPEN));
  37.                 else {
  38.                     $output .= Dwoo_Compiler::PHP_CLOSE $content;
  39.                 }
  40.                 if(substr($output-strlen(Dwoo_Compiler::PHP_CLOSE)) == Dwoo_Compiler::PHP_CLOSE{
  41.                     $output substr($output0-strlen(Dwoo_Compiler::PHP_CLOSE));
  42.                 else {
  43.                     $output .= Dwoo_Compiler::PHP_OPEN;
  44.                 }                
  45.             $output .= "\n}"Dwoo_Compiler::PHP_CLOSE;
  46.  
  47.         return $output;
  48.     }
  49.     
  50.     public static function unescape($output$dynamicId)
  51.     {
  52.         return preg_replace_callback('/<dwoo:dynamic_('.$dynamicId.')>(.+?)<\/dwoo:dynamic_'.$dynamicId.'>/'array('self''unescapePhp')$output);
  53.     }
  54.     
  55.     public static function unescapePhp($match)
  56.     {
  57.         return preg_replace('{<\?php /\*'.$match[1].'\*/ echo \'(.+?)\'; \?>}''$1'$match[2]);
  58.     }
  59. }

Documentation generated on Sat, 18 Jul 2009 21:04:56 +0200 by phpDocumentor 1.4.0