From 543399cabd5559ff121fcf294a4c5054fe021b8b Mon Sep 17 00:00:00 2001
From: Jaime Perez Crespo <jaime.perez@uninett.no>
Date: Fri, 5 Feb 2016 16:30:41 +0100
Subject: [PATCH] Stop calling deprecated methods in SimpleSAML_XHTML_Template.

---
 templates/logout.php             |  2 +-
 templates/selectidp-dropdown.php | 13 ++++++++++---
 templates/selectidp-links.php    |  9 ++++++---
 templates/status.php             |  2 +-
 4 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/templates/logout.php b/templates/logout.php
index 885f3a54b..0672ce725 100644
--- a/templates/logout.php
+++ b/templates/logout.php
@@ -9,7 +9,7 @@ $this->includeAtTemplateBase('includes/header.php');
 echo('<h2>' . $this->data['header'] . '</h2>');
 echo('<p>' . $this->t('{logout:logged_out_text}') . '</p>');
 
-if($this->getTag($this->data['text']) !== NULL) {
+if($this->getTranslator()->getTag($this->data['text']) !== NULL) {
 	$this->data['text'] = $this->t($this->data['text']);
 }
 echo('<p>[ <a href="' . htmlspecialchars($this->data['link']) . '">' .
diff --git a/templates/selectidp-dropdown.php b/templates/selectidp-dropdown.php
index 1bb13def6..b9c3b73a7 100644
--- a/templates/selectidp-dropdown.php
+++ b/templates/selectidp-dropdown.php
@@ -9,12 +9,18 @@ $this->includeAtTemplateBase('includes/header.php');
 
 foreach ($this->data['idplist'] as $idpentry) {
     if (!empty($idpentry['name'])) {
-        $this->includeInlineTranslation('idpname_'.$idpentry['entityid'], $idpentry['name']);
+        $this->getTranslator()->includeInlineTranslation(
+            'idpname_'.$idpentry['entityid'],
+            $idpentry['name']
+        );
     } elseif (!empty($idpentry['OrganizationDisplayName'])) {
-        $this->includeInlineTranslation('idpname_'.$idpentry['entityid'], $idpentry['OrganizationDisplayName']);
+        $this->getTranslator()->includeInlineTranslation(
+            'idpname_'.$idpentry['entityid'],
+            $idpentry['OrganizationDisplayName']
+        );
     }
     if (!empty($idpentry['description'])) {
-        $this->includeInlineTranslation('idpdesc_'.$idpentry['entityid'], $idpentry['description']);
+        $this->getTranslator()->includeInlineTranslation('idpdesc_'.$idpentry['entityid'], $idpentry['description']);
     }
 }
 ?>
@@ -28,6 +34,7 @@ foreach ($this->data['idplist'] as $idpentry) {
         <select id="dropdownlist" name="idpentityid">
             <?php
             usort($this->data['idplist'], function ($idpentry1, $idpentry2) {
+                // TODO: this is only compatible with PHP >= 5.4, fix compat with 5.3!
                 return strcmp($this->t('idpname_'.$idpentry1['entityid']), $this->t('idpname_'.$idpentry2['entityid']));
             });
 
diff --git a/templates/selectidp-links.php b/templates/selectidp-links.php
index 079e8be66..b8f2d6e3d 100644
--- a/templates/selectidp-links.php
+++ b/templates/selectidp-links.php
@@ -8,12 +8,15 @@ $this->data['autofocus'] = 'preferredidp';
 $this->includeAtTemplateBase('includes/header.php');
 foreach ($this->data['idplist'] as $idpentry) {
     if (isset($idpentry['name'])) {
-        $this->includeInlineTranslation('idpname_'.$idpentry['entityid'], $idpentry['name']);
+        $this->getTranslator()->includeInlineTranslation('idpname_'.$idpentry['entityid'], $idpentry['name']);
     } elseif (isset($idpentry['OrganizationDisplayName'])) {
-        $this->includeInlineTranslation('idpname_'.$idpentry['entityid'], $idpentry['OrganizationDisplayName']);
+        $this->getTranslator()->includeInlineTranslation(
+            'idpname_'.$idpentry['entityid'],
+            $idpentry['OrganizationDisplayName']
+        );
     }
     if (isset($idpentry['description'])) {
-        $this->includeInlineTranslation('idpdesc_'.$idpentry['entityid'], $idpentry['description']);
+        $this->getTranslator()->includeInlineTranslation('idpdesc_'.$idpentry['entityid'], $idpentry['description']);
     }
 }
 ?>
diff --git a/templates/status.php b/templates/status.php
index 23f887718..25b6e0207 100644
--- a/templates/status.php
+++ b/templates/status.php
@@ -1,6 +1,6 @@
 <?php
 if (array_key_exists('header', $this->data)) {
-    if ($this->getTag($this->data['header']) !== null) {
+    if ($this->getTranslator()->getTag($this->data['header']) !== null) {
         $this->data['header'] = $this->t($this->data['header']);
     }
 }
-- 
GitLab