Compare commits
No commits in common. "24e3101dd063ce299d930cfcf8e140862d592234" and "de0763c5f691980827c473a2cd979dc1ace49810" have entirely different histories.
24e3101dd0
...
de0763c5f6
1 changed files with 1 additions and 41 deletions
42
src/Tpl.php
42
src/Tpl.php
|
@ -432,56 +432,16 @@ class Tpl {
|
||||||
}
|
}
|
||||||
catch (Exception $e) {
|
catch (Exception $e) {
|
||||||
Log :: exception($e, "Smarty - An exception occured displaying template '$template'");
|
Log :: exception($e, "Smarty - An exception occured displaying template '$template'");
|
||||||
Hook :: trigger('after_displaying_template', array('success' => false));
|
|
||||||
$sentry_span->finish();
|
|
||||||
if ($template != 'fatal_error.tpl')
|
if ($template != 'fatal_error.tpl')
|
||||||
Log :: fatal(I18n::_("An error occurred while displaying this page."));
|
Log :: fatal(I18n::_("An error occurred while displaying this page."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
self :: purge_errors();
|
self :: purge_errors();
|
||||||
self :: purge_messages();
|
self :: purge_messages();
|
||||||
Hook :: trigger('after_displaying_template', array('success' => true));
|
Hook :: trigger('after_displaying_template');
|
||||||
$sentry_span->finish();
|
$sentry_span->finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Fetch a template
|
|
||||||
* @param string $template The template to fetch
|
|
||||||
* @param string|null $pagetitle The page title (optional)
|
|
||||||
* @param array $extra_args Extra arguments to use to compute the page title using sprintf
|
|
||||||
* @return string|false
|
|
||||||
*/
|
|
||||||
public static function fetch($template, $pagetitle=null, ...$extra_args) {
|
|
||||||
if (!$template) {
|
|
||||||
Log :: warning("Tpl::fetch(): No template specified.");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$sentry_span = new SentrySpan('smarty.fetch_template', "Fetch Smarty template");
|
|
||||||
|
|
||||||
// If extra arguments passed, format pagetitle using sprintf
|
|
||||||
if ($pagetitle && $extra_args) {
|
|
||||||
$pagetitle = call_user_func_array(
|
|
||||||
'sprintf',
|
|
||||||
array_merge(array($pagetitle), $extra_args)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
$result = false;
|
|
||||||
$success = false;
|
|
||||||
try {
|
|
||||||
Hook :: trigger('before_fetching_template');
|
|
||||||
self :: define_common_variables($pagetitle);
|
|
||||||
$result = self :: $smarty->fetch("Tpl:$template");
|
|
||||||
$success = true;
|
|
||||||
}
|
|
||||||
catch (Exception $e) {
|
|
||||||
Log :: exception($e, "Smarty - An exception occured fetching template '$template'");
|
|
||||||
}
|
|
||||||
Hook :: trigger('after_fetching_template', array('success' => $success));
|
|
||||||
$sentry_span->finish();
|
|
||||||
return $success?$result:false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display AJAX return
|
* Display AJAX return
|
||||||
* @param array|null $data AJAX returned data (optional)
|
* @param array|null $data AJAX returned data (optional)
|
||||||
|
|
Loading…
Reference in a new issue