Skip to content
Snippets Groups Projects
Commit 768ed01a authored by Andreas Åkre Solberg's avatar Andreas Åkre Solberg
Browse files

Allow numeric replacements in template class

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1277 44740490-163a-0410-bde0-09ae8108e29a
parent 0fe5315a
No related branches found
No related tags found
No related merge requests found
...@@ -328,7 +328,6 @@ class SimpleSAML_XHTML_Template { ...@@ -328,7 +328,6 @@ class SimpleSAML_XHTML_Template {
* @return string The translated tag, or a placeholder value if the tag wasn't found. * @return string The translated tag, or a placeholder value if the tag wasn't found.
*/ */
public function t($tag, $replacements = array(), $fallbackdefault = true, $oldreplacements = array(), $striptags = false) { public function t($tag, $replacements = array(), $fallbackdefault = true, $oldreplacements = array(), $striptags = false) {
if(!is_array($replacements)) { if(!is_array($replacements)) {
/* Old style call to t(...). Print warning to log. */ /* Old style call to t(...). Print warning to log. */
...@@ -360,9 +359,10 @@ class SimpleSAML_XHTML_Template { ...@@ -360,9 +359,10 @@ class SimpleSAML_XHTML_Template {
$translated = $this->getTranslation($tagData); $translated = $this->getTranslation($tagData);
# if (!empty($replacements)){ echo('<pre> [' . $tag . ']'); print_r($replacements); exit; }
foreach ($replacements as $k => $v) { foreach ($replacements as $k => $v) {
/* try to translate if no replacement is given */ /* try to translate if no replacement is given */
if (!$v) $v = $this->t($k); if ($v == NULL) $v = $this->t($k);
$translated = str_replace($k, $v, $translated); $translated = str_replace($k, $v, $translated);
} }
return $translated; return $translated;
......
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