Add new directory structure. Tags will contain current and past releases, and stable will contain any bug fixes to the current stable release so users won't have to get the potentially broken trunk build to fix a screwup in stable.
Trunk updated to 0.9 git-svn-id: http://kusabax.cultnet.net/svn/repo/stable@176 73d99b7e-4f53-4972-b7b7-2ecd3c4d89ee
This commit is contained in:
commit
88bacfad9c
316 files changed
+79806
No files matched your search
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Marks the contents of the block as dynamic. Which means that it will not be cached.
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied warranty.
|
||||
* In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
*
|
||||
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||
* @copyright Copyright (c) 2008, Jordi Boggiano
|
||||
* @license http://dwoo.org/LICENSE Modified BSD License
|
||||
* @link http://dwoo.org/
|
||||
* @version 1.0.0
|
||||
* @date 2008-10-23
|
||||
* @package Dwoo
|
||||
*/
|
||||
class Dwoo_Plugin_dynamic extends Dwoo_Block_Plugin implements Dwoo_ICompilable_Block
|
||||
{
|
||||
public function init()
|
||||
{
|
||||
}
|
||||
|
||||
public static function preProcessing(Dwoo_Compiler $compiler, array $params, $prepend, $append, $type)
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public static function postProcessing(Dwoo_Compiler $compiler, array $params, $prepend, $append, $content)
|
||||
{
|
||||
$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;
|
||||
}
|
||||
|
||||
public static function unescape($output, $dynamicId)
|
||||
{
|
||||
return preg_replace_callback('/<dwoo:dynamic_('.$dynamicId.')>(.+?)<\/dwoo:dynamic_'.$dynamicId.'>/', array('self', 'unescapePhp'), $output);
|
||||
}
|
||||
|
||||
public static function unescapePhp($match)
|
||||
{
|
||||
return preg_replace('{<\?php /\*'.$match[1].'\*/ echo \'(.+?)\'; \?>}', '$1', $match[2]);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user