public function createTemplateCodeFrame($content = '')
{
$plugins_string = '';
// include code for plugins
if (!empty($this->required_plugins['compiled'])) {
foreach ($this->required_plugins['compiled'] as $tmp) {
foreach ($tmp as $data) {
$file = addslashes($data['file']);
if (is_Array($data['function'])) {
$func = $data['function'];
$plugins_string .= "if (!is_callable(array('{$func[0]}', '{$func[1]}'))) ";
$plugins_string .= "include '{$file}';\n";
} else {
$plugins_string .= "if (!is_callable('{$data['function']}')) include '{$file}';\n";
}
}
}
}
// build property code
$output = '';
$this->properties['version'] = Brainy::SMARTY_VERSION;
if (!isset($this->properties['unifunc'])) {
$this->properties['unifunc'] = 'content_' . str_replace(array('.', ','), '_', uniqid('', true));
}
if (!$this->source->recompiled) {
$decode = "\$_smarty_tpl->decodeProperties(" . var_export($this->properties, true) . ')';
$output .= 'if (' . $decode . ' && !is_callable(\'' . $this->properties['unifunc'] . "')) {\n";
// Output a proper PHPDoc for Augmented Types users.
$output .= <<<'PHPDOC'
/**
* @param \Box\Brainy\Templates\TemplateBase $_smarty_tpl The smarty template instance
* @return void
*/
PHPDOC;
$output .= 'function ' . $this->properties['unifunc'] . "(\$_smarty_tpl) {\n";
}
$output .= $plugins_string;
$output .= $content;
if (!$this->source->recompiled) {
$output .= "\n}\n}\n";
}
return $output;
}