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
Branches
Tags
No related merge requests found
...@@ -54,13 +54,27 @@ class SimpleSAML_XHTML_Template ...@@ -54,13 +54,27 @@ class SimpleSAML_XHTML_Template
$this->useTwig = $this->setupTwig(); $this->useTwig = $this->setupTwig();
} }
private function setupTwigTemplatepaths() /*
* Normalize template-name
* *param $templateName Template
*/
private function normalizeTemplateName($templateName)
{ {
$filename = $this->template; if (strripos($templateName, '.twig.html')) { return $templateName; }
// normalize template name $phppos = strripos($templateName, '.php');
if (strripos($filename, '.php', 0)) { if ($phppos) {
$filename = basename(basename($filename, '.tpl.php'), '.php').'.twig.html'; $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 // get namespace if any
$namespace = ''; $namespace = '';
$split = explode(':', $filename, 2); $split = explode(':', $filename, 2);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment