Skip to content
Snippets Groups Projects
Commit 9273cd32 authored by Hanne Moa's avatar Hanne Moa
Browse files

Handle paths in template names

Now works for:
new SimpleSAML_XHTML_Template($globalConfig, 'saml:sp/wrong_authncontextclassref.tpl.php');
parent 708fd424
No related branches found
No related tags found
No related merge requests found
......@@ -54,13 +54,27 @@ class SimpleSAML_XHTML_Template
$this->useTwig = $this->setupTwig();
}
private function setupTwigTemplatepaths()
/*
* Normalize template-name
* *param $templateName Template
*/
private function normalizeTemplateName($templateName)
{
$filename = $this->template;
// normalize template name
if (strripos($filename, '.php', 0)) {
$filename = basename(basename($filename, '.tpl.php'), '.php').'.twig.html';
if (strripos($templateName, '.twig.html')) { return $templateName; }
$phppos = strripos($templateName, '.php');
if ($phppos) {
$templateName = substr($templateName, 0, $phppos);
}
$tplpos = strripos($templateName, '.tpl');
if ($tplpos) {
$templateName = substr($templateName, 0, $tplpos);
}
return $templateName.'.twig.html';
}
private function setupTwigTemplatepaths()
{
$filename = $this->normalizeTemplateName($this->template);
// get namespace if any
$namespace = '';
$split = explode(':', $filename, 2);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment