implement Smarty3

This commit is contained in:
Zach Prezkuta
2013-01-06 14:42:51 -07:00
parent 61b8ea9e1a
commit a0d19ffb72
250 changed files with 6959 additions and 282 deletions

View File

@@ -13,15 +13,32 @@ require_once("include/template_processor.php");
if(! function_exists('replace_macros')) {
function replace_macros($s,$r) {
global $t;
//$ts = microtime();
$r = $t->replace($s,$r);
//$tt = microtime() - $ts;
//$a = get_app();
//$a->page['debug'] .= "$tt <br>\n";
return template_unescape($r);
// $ts = microtime();
$a = get_app();
if($a->get_template_engine() === 'smarty3') {
$template = '';
if(gettype($s) === 'string') {
$template = $s;
$s = new FriendicaSmarty();
}
foreach($r as $key=>$value) {
if($key[0] === '$') {
$key = substr($key, 1);
}
$s->assign($key, $value);
}
$output = $s->parsed($template);
}
else {
$r = $t->replace($s,$r);
$output = template_unescape($r);
}
// $tt = microtime() - $ts;
// $a->page['debug'] .= "$tt <br>\n";
return $output;
}}