Exemplo n.º 1
0
 public static function preProcessing(Dwoo_Compiler $compiler, array $params, $prepend, $append, $type)
 {
     $with =& $compiler->findBlock('for', true);
     $params['initialized'] = true;
     $compiler->injectBlock($type, $params);
     return '';
 }
Exemplo n.º 2
0
 public static function postProcessing(Dwoo_Compiler $compiler, array $params, $prepend, $append, $content)
 {
     try {
         $compiler->findBlock('dynamic');
         return $content;
     } catch (Dwoo_Compilation_Exception $e) {
     }
     $output = Dwoo_Compiler::PHP_OPEN . 'if($doCache) {' . "\n\t" . 'echo \'<dwoo:dynamic_\'.$dynamicId.\'>' . str_replace('\'', '\\\'', $content) . '</dwoo:dynamic_\'.$dynamicId.\'>\';' . "\n} else {\n\t";
     if (substr($content, 0, strlen(Dwoo_Compiler::PHP_OPEN)) == Dwoo_Compiler::PHP_OPEN) {
         $output .= substr($content, strlen(Dwoo_Compiler::PHP_OPEN));
     } else {
         $output .= Dwoo_Compiler::PHP_CLOSE . $content;
     }
     if (substr($output, -strlen(Dwoo_Compiler::PHP_CLOSE)) == Dwoo_Compiler::PHP_CLOSE) {
         $output = substr($output, 0, -strlen(Dwoo_Compiler::PHP_CLOSE));
     } else {
         $output .= Dwoo_Compiler::PHP_OPEN;
     }
     $output .= "\n}" . Dwoo_Compiler::PHP_CLOSE;
     return $output;
 }