1 | <?php |
---|
2 | |
---|
3 | /** |
---|
4 | * Smarty compatibility layer for block plugins, this is used internally and you should not call it |
---|
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 | class Dwoo_Plugin_smartyinterface extends Dwoo_Block_Plugin implements Dwoo_ICompilable_Block |
---|
18 | { |
---|
19 | public function init($__funcname, $__functype, array $rest=array()) {} |
---|
20 | |
---|
21 | public static function preProcessing(Dwoo_Compiler $compiler, array $params, $prepend, $append, $type) |
---|
22 | { |
---|
23 | $params = $compiler->getCompiledParams($params); |
---|
24 | $func = $params['__funcname']; |
---|
25 | $pluginType = $params['__functype']; |
---|
26 | $params = $params['*']; |
---|
27 | |
---|
28 | if ($pluginType & Dwoo_Core::CUSTOM_PLUGIN) { |
---|
29 | $customPlugins = $compiler->getDwoo()->getCustomPlugins(); |
---|
30 | $callback = $customPlugins[$func]['callback']; |
---|
31 | if (is_array($callback)) { |
---|
32 | if (is_object($callback[0])) { |
---|
33 | $callback = '$this->customPlugins[\''.$func.'\'][0]->'.$callback[1].'('; |
---|
34 | } else { |
---|
35 | $callback = ''.$callback[0].'::'.$callback[1].'('; |
---|
36 | } |
---|
37 | } else { |
---|
38 | $callback = $callback.'('; |
---|
39 | } |
---|
40 | } else { |
---|
41 | $callback = 'smarty_block_'.$func.'('; |
---|
42 | } |
---|
43 | |
---|
44 | $paramsOut = ''; |
---|
45 | foreach ($params as $i=>$p) { |
---|
46 | $paramsOut .= var_export($i, true).' => '.$p.','; |
---|
47 | } |
---|
48 | |
---|
49 | $curBlock =& $compiler->getCurrentBlock(); |
---|
50 | $curBlock['params']['postOut'] = Dwoo_Compiler::PHP_OPEN.' $_block_content = ob_get_clean(); $_block_repeat=false; echo '.$callback.'$_tag_stack[count($_tag_stack)-1], $_block_content, $this, $_block_repeat); } array_pop($_tag_stack);'.Dwoo_Compiler::PHP_CLOSE; |
---|
51 | |
---|
52 | return Dwoo_Compiler::PHP_OPEN.$prepend.' if (!isset($_tag_stack)){ $_tag_stack = array(); } $_tag_stack[] = array('.$paramsOut.'); $_block_repeat=true; '.$callback.'$_tag_stack[count($_tag_stack)-1], null, $this, $_block_repeat); while ($_block_repeat) { ob_start();'.Dwoo_Compiler::PHP_CLOSE; |
---|
53 | } |
---|
54 | |
---|
55 | public static function postProcessing(Dwoo_Compiler $compiler, array $params, $prepend, $append, $content) |
---|
56 | { |
---|
57 | return $content . $params['postOut']; |
---|
58 | } |
---|
59 | } |
---|