diff --git a/templates/selectidp-dropdown.php b/templates/selectidp-dropdown.php index b9c3b73a7a682b4c2348e13503e7a93fdea0ffb0..ebe7646b481781968c42b7953c1aa0e25819d195 100644 --- a/templates/selectidp-dropdown.php +++ b/templates/selectidp-dropdown.php @@ -33,10 +33,21 @@ foreach ($this->data['idplist'] as $idpentry) { value="<?php echo htmlspecialchars($this->data['returnIDParam']); ?>"/> <select id="dropdownlist" name="idpentityid"> <?php + /* + * TODO: change this to use $this instead when PHP 5.4 is the minimum requirement. + * + * This is a dirty hack because PHP 5.3 does not allow the use of $this inside closures. Therefore, the + * translation function must be passed somehow inside the closure. PHP 5.4 allows using $this, so we can + * then go back to the previous behaviour. + */ + $GLOBALS['__t'] = $this; 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'])); + return strcmp( + $GLOBALS['__t']->t('idpname_'.$idpentry1['entityid']), + $GLOBALS['__t']->t('idpname_'.$idpentry2['entityid']) + ); }); + unset($GLOBALS['__t']); foreach ($this->data['idplist'] as $idpentry) { echo '<option value="'.htmlspecialchars($idpentry['entityid']).'"';