summaryrefslogtreecommitdiffstats
path: root/lib/SimpleSAML
diff options
context:
space:
mode:
Diffstat (limited to 'lib/SimpleSAML')
-rw-r--r--lib/SimpleSAML/XHTML/Template.php24
1 files changed, 19 insertions, 5 deletions
diff --git a/lib/SimpleSAML/XHTML/Template.php b/lib/SimpleSAML/XHTML/Template.php
index 6956e1f..747c9b5 100644
--- a/lib/SimpleSAML/XHTML/Template.php
+++ b/lib/SimpleSAML/XHTML/Template.php
@@ -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);