Various improvements/fixes

- Fix potential missing variable
- Improve replaceMacros doc
- Fix CSS value in smoothly
This commit is contained in:
Hypolite Petovan 2018-12-13 22:30:43 -05:00
parent 2241ba4540
commit 38109665c7
3 changed files with 15 additions and 14 deletions

View file

@ -48,29 +48,29 @@ class Renderer extends BaseObject
'internal' => '',
'smarty3' => '}}'
];
/**
* @brief This is our template processor
*
* @param string|FriendicaSmarty $s The string requiring macro substitution or an instance of FriendicaSmarty
* @param array $r key value pairs (search => replace)
*
* @return string substituted string
*/
public static function replaceMacros($s, $r)
/**
* @brief This is our template processor
*
* @param string|FriendicaSmarty $s The string requiring macro substitution or an instance of FriendicaSmarty
* @param array $vars key value pairs (search => replace)
*
* @return string substituted string
*/
public static function replaceMacros($s, $vars)
{
$stamp1 = microtime(true);
$a = self::getApp();
// pass $baseurl to all templates
$r['$baseurl'] = System::baseUrl();
$vars['$baseurl'] = System::baseUrl();
$t = self::getTemplateEngine();
try {
$output = $t->replaceMacros($s, $r);
$output = $t->replaceMacros($s, $vars);
} catch (Exception $e) {
echo "<pre><b>" . __FUNCTION__ . "</b>: " . $e->getMessage() . "</pre>";
killme();
exit();
}
$a->saveTimestamp($stamp1, "rendering");