3 * Template Lite compile custom block - template internal module
6 * Name: compile_custom_block
9 function compile_compile_custom_block($function, $modifiers, $arguments, &$_result, &$object)
11 if ($function{0} == '/')
14 $function = substr($function, 1);
21 if ($function = $object->_plugin_exists($function, "block"))
25 $_args = $object->_parse_arguments($arguments);
26 foreach($_args as $key => $value)
30 $value = $value ?
'true' : 'false';
32 elseif (is_null($value))
36 elseif ($value[0] != '$')
38 $value = '"'.addslashes($value).'"';
41 $_args[$key] = "'$key' => $value";
43 $_result = "<?php \$this->_tag_stack[] = array('$function', array(".implode(',', (array)$_args).")); ";
44 $_result .= $function . '(array(' . implode(',', (array)$_args) .'), null, $this); ';
45 $_result .= 'ob_start(); ?>';
49 $_result .= '<?php $this->_block_content = ob_get_contents(); ob_end_clean(); ';
50 $_result .= '$this->_block_content = ' . $function . '($this->_tag_stack[count($this->_tag_stack) - 1][1], $this->_block_content, $this); ';
51 if (!empty($modifiers))
53 $_result .= '$this->_block_content = ' . $object->_parse_modifier('$this->_block_content', $modifiers) . '; ';
55 $_result .= 'echo $this->_block_content; array_pop($this->_tag_stack); ?>';