mirror of
https://github.com/friendica/friendica
synced 2025-04-25 15:50:10 +00:00
code style & install-403 fix
This commit is contained in:
parent
d579d9e1d0
commit
58c9566c3d
6 changed files with 138 additions and 133 deletions
|
@ -15,17 +15,17 @@ use Friendica\Render\ITemplateEngine;
|
|||
*/
|
||||
class Renderer extends BaseObject
|
||||
{
|
||||
/**
|
||||
/**
|
||||
* @brief An array of registered template engines ('name'=>'class name')
|
||||
*/
|
||||
public static $template_engines = [];
|
||||
public static $template_engines = [];
|
||||
|
||||
/**
|
||||
/**
|
||||
* @brief An array of instanced template engines ('name'=>'instance')
|
||||
*/
|
||||
public static $template_engine_instance = [];
|
||||
|
||||
/**
|
||||
/**
|
||||
* @brief An array for all theme-controllable parameters
|
||||
*
|
||||
* Mostly unimplemented yet. Only options 'template_engine' and
|
||||
|
@ -39,15 +39,15 @@ class Renderer extends BaseObject
|
|||
'stylesheet' => '',
|
||||
'template_engine' => 'smarty3',
|
||||
];
|
||||
|
||||
private static $ldelim = [
|
||||
|
||||
private static $ldelim = [
|
||||
'internal' => '',
|
||||
'smarty3' => '{{'
|
||||
];
|
||||
private static $rdelim = [
|
||||
'internal' => '',
|
||||
'smarty3' => '}}'
|
||||
];
|
||||
];
|
||||
|
||||
/**
|
||||
* @brief This is our template processor
|
||||
|
@ -59,28 +59,28 @@ class Renderer extends BaseObject
|
|||
* @return string substituted string
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
public static function replaceMacros($s, $vars, $overwriteURL = true)
|
||||
{
|
||||
$stamp1 = microtime(true);
|
||||
$a = self::getApp();
|
||||
public static function replaceMacros($s, $vars, $overwriteURL = true)
|
||||
{
|
||||
$stamp1 = microtime(true);
|
||||
$a = self::getApp();
|
||||
|
||||
// pass $baseurl to all templates
|
||||
// pass $baseurl to all templates
|
||||
if ($overwriteURL) {
|
||||
$vars['$baseurl'] = System::baseUrl();
|
||||
}
|
||||
$t = self::getTemplateEngine();
|
||||
$t = self::getTemplateEngine();
|
||||
|
||||
try {
|
||||
$output = $t->replaceMacros($s, $vars);
|
||||
} catch (Exception $e) {
|
||||
echo "<pre><b>" . __FUNCTION__ . "</b>: " . $e->getMessage() . "</pre>";
|
||||
exit();
|
||||
}
|
||||
try {
|
||||
$output = $t->replaceMacros($s, $vars);
|
||||
} catch (Exception $e) {
|
||||
echo "<pre><b>" . __FUNCTION__ . "</b>: " . $e->getMessage() . "</pre>";
|
||||
exit();
|
||||
}
|
||||
|
||||
$a->getProfiler()->saveTimestamp($stamp1, "rendering", System::callstack());
|
||||
|
||||
return $output;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Load a given template $s
|
||||
|
@ -91,35 +91,35 @@ class Renderer extends BaseObject
|
|||
* @return string template.
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function getMarkupTemplate($s, $root = '')
|
||||
{
|
||||
$stamp1 = microtime(true);
|
||||
$a = self::getApp();
|
||||
$t = self::getTemplateEngine();
|
||||
public static function getMarkupTemplate($s, $root = '')
|
||||
{
|
||||
$stamp1 = microtime(true);
|
||||
$a = self::getApp();
|
||||
$t = self::getTemplateEngine();
|
||||
|
||||
try {
|
||||
$template = $t->getTemplateFile($s, $root);
|
||||
} catch (Exception $e) {
|
||||
echo "<pre><b>" . __FUNCTION__ . "</b>: " . $e->getMessage() . "</pre>";
|
||||
exit();
|
||||
}
|
||||
try {
|
||||
$template = $t->getTemplateFile($s, $root);
|
||||
} catch (Exception $e) {
|
||||
echo "<pre><b>" . __FUNCTION__ . "</b>: " . $e->getMessage() . "</pre>";
|
||||
exit();
|
||||
}
|
||||
|
||||
$a->getProfiler()->saveTimestamp($stamp1, "file", System::callstack());
|
||||
$a->getProfiler()->saveTimestamp($stamp1, "file", System::callstack());
|
||||
|
||||
return $template;
|
||||
}
|
||||
return $template;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* @brief Register template engine class
|
||||
*
|
||||
* @param string $class
|
||||
*/
|
||||
public static function registerTemplateEngine($class)
|
||||
{
|
||||
$v = get_class_vars($class);
|
||||
|
||||
if (!empty($v['name']))
|
||||
{
|
||||
$v = get_class_vars($class);
|
||||
|
||||
if (!empty($v['name']))
|
||||
{
|
||||
$name = $v['name'];
|
||||
self::$template_engines[$name] = $class;
|
||||
} else {
|
||||
|
@ -153,9 +153,9 @@ class Renderer extends BaseObject
|
|||
|
||||
echo "template engine <tt>$template_engine</tt> is not registered!\n";
|
||||
exit();
|
||||
}
|
||||
|
||||
/**
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns the active template engine.
|
||||
*
|
||||
* @return string the active template engine
|
||||
|
@ -175,7 +175,7 @@ class Renderer extends BaseObject
|
|||
self::$theme['template_engine'] = $engine;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Gets the right delimiter for a template engine
|
||||
*
|
||||
* Currently:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue