diff --git a/modules/consent/www/getconsent.php b/modules/consent/www/getconsent.php index b4cb0fda5e28ae40a350cc0e2f00d8337407b36c..c113e10e36b1878491fcf147b8017be1464a8fc1 100644 --- a/modules/consent/www/getconsent.php +++ b/modules/consent/www/getconsent.php @@ -21,7 +21,7 @@ session_cache_limiter('nocache'); $globalConfig = \SimpleSAML\Configuration::getInstance(); -SimpleSAML\Logger::info('Consent - getconsent: Accessing consent interface'); +\SimpleSAML\Logger::info('Consent - getconsent: Accessing consent interface'); if (!array_key_exists('StateId', $_REQUEST)) { throw new \SimpleSAML\Error\BadRequest( @@ -44,9 +44,9 @@ if (array_key_exists('core:SP', $state)) { // The user has pressed the yes-button if (array_key_exists('yes', $_REQUEST)) { if (array_key_exists('saveconsent', $_REQUEST)) { - SimpleSAML\Logger::stats('consentResponse remember'); + \SimpleSAML\Logger::stats('consentResponse remember'); } else { - SimpleSAML\Logger::stats('consentResponse rememberNot'); + \SimpleSAML\Logger::stats('consentResponse rememberNot'); } $statsInfo = array( @@ -73,8 +73,8 @@ if (array_key_exists('yes', $_REQUEST)) { ); try { $store->saveConsent($userId, $targetedId, $attributeSet); - } catch (Exception $e) { - SimpleSAML\Logger::error('Consent: Error writing to storage: ' . $e->getMessage()); + } catch (\Exception $e) { + \SimpleSAML\Logger::error('Consent: Error writing to storage: ' . $e->getMessage()); } } @@ -96,7 +96,7 @@ $para = array( ); // Reorder attributes according to attributepresentation hooks -SimpleSAML\Module::callHooks('attributepresentation', $para); +\SimpleSAML\Module::callHooks('attributepresentation', $para); // Parse parameters if (array_key_exists('name', $state['Source'])) { @@ -117,6 +117,7 @@ if (array_key_exists('name', $state['Destination'])) { // Make, populate and layout consent form $t = new \SimpleSAML\XHTML\Template($globalConfig, 'consent:consentform.php'); +$translator = $t->getTranslator(); $t->data['srcMetadata'] = $state['Source']; $t->data['dstMetadata'] = $state['Destination']; $t->data['yesTarget'] = \SimpleSAML\Module::getModuleURL('consent/getconsent.php'); @@ -126,26 +127,26 @@ $t->data['noData'] = array('StateId' => $id); $t->data['attributes'] = $attributes; $t->data['checked'] = $state['consent:checked']; -$srcName = htmlspecialchars(is_array($srcName) ? \SimpleSAML\Locale\Translate::t($srcName) : $srcName); -$dstName = htmlspecialchars(is_array($dstName) ? \SimpleSAML\Locale\Translate::t($dstName) : $dstName); +$srcName = htmlspecialchars(is_array($srcName) ? $translator->t($srcName) : $srcName); +$dstName = htmlspecialchars(is_array($dstName) ? $translator->t($dstName) : $dstName); -$t->data['consent_attributes_header'] = \SimpleSAML\Locale\Translate::t( +$t->data['consent_attributes_header'] = $translator->t( '{consent:consent:consent_attributes_header}', array('SPNAME' => $dstName, 'IDPNAME' => $srcName) ); -$t->data['consent_accept'] = \SimpleSAML\Locale\Translate::t( +$t->data['consent_accept'] = $translator->t( '{consent:consent:consent_accept}', array('SPNAME' => $dstName, 'IDPNAME' => $srcName) ); if (array_key_exists('descr_purpose', $state['Destination'])) { - $t->data['consent_purpose'] = \SimpleSAML\Locale\Translate::t( + $t->data['consent_purpose'] = $translator->t( '{consent:consent:consent_purpose}', array( 'SPNAME' => $dstName, - 'SPDESC' => $t->getTranslator()->getPreferredTranslation( - SimpleSAML\Utils\Arrays::arrayize( + 'SPDESC' => $translator->getPreferredTranslation( + \SimpleSAML\Utils\Arrays::arrayize( $state['Destination']['descr_purpose'], 'en' ) @@ -215,7 +216,7 @@ function present_attributes($t, $attributes, $nameParent) $alternate = array('odd', 'even'); $i = 0; - $summary = 'summary="' . \SimpleSAML\Locale\Translate::t('{consent:consent:table_summary}') . '"'; + $summary = 'summary="' . $translator->t('{consent:consent:table_summary}') . '"'; if (strlen($nameParent) > 0) { $parentStr = strtolower($nameParent) . '_'; @@ -223,7 +224,7 @@ function present_attributes($t, $attributes, $nameParent) } else { $parentStr = ''; $str = '<table id="table_with_attributes" class="attributes" '. $summary .'>'; - $str .= "\n" . '<caption>' . \SimpleSAML\Locale\Translate::t('{consent:consent:table_caption}') . + $str .= "\n" . '<caption>' . $translator->t('{consent:consent:table_caption}') . '</caption>'; } @@ -246,7 +247,7 @@ function present_attributes($t, $attributes, $nameParent) $isHidden = in_array($nameraw, $t->data['hiddenAttributes'], true); if ($isHidden) { - $hiddenId = SimpleSAML\Utils\Random::generateID(); + $hiddenId = \SimpleSAML\Utils\Random::generateID(); $str .= '<div class="attrvalue hidden" id="hidden_' . $hiddenId . '">'; } else { @@ -283,7 +284,7 @@ function present_attributes($t, $attributes, $nameParent) $str .= '... '; $str .= '<a class="consent_showattributelink" href="javascript:SimpleSAML_show(\'hidden_' . $hiddenId; $str .= '\'); SimpleSAML_hide(\'visible_' . $hiddenId . '\');">'; - $str .= \SimpleSAML\Locale\Translate::t('{consent:consent:show_attribute}'); + $str .= $translator->t('{consent:consent:show_attribute}'); $str .= '</a>'; $str .= '</div>'; } diff --git a/modules/consent/www/noconsent.php b/modules/consent/www/noconsent.php index 998a67d69f24151edc4f8623b90dea0a64c1acd9..0c48fb0b0c5b10857973dc271b460ce2897b55a5 100644 --- a/modules/consent/www/noconsent.php +++ b/modules/consent/www/noconsent.php @@ -49,14 +49,15 @@ if (array_key_exists('name', $state['Destination'])) { $globalConfig = \SimpleSAML\Configuration::getInstance(); $t = new \SimpleSAML\XHTML\Template($globalConfig, 'consent:noconsent.php'); +$translator = $t->getTranslator(); $t->data['dstMetadata'] = $state['Destination']; $t->data['resumeFrom'] = $resumeFrom; $t->data['aboutService'] = $aboutService; $t->data['logoutLink'] = $logoutLink; -$dstName = htmlspecialchars(is_array($dstName) ? \SimpleSAML\Locale\Translate::t($dstName) : $dstName); +$dstName = htmlspecialchars(is_array($dstName) ? $translator->t($dstName) : $dstName); -$t->data['noconsent_text'] = \SimpleSAML\Locale\Translate::t('{consent:consent:noconsent_text}', array('SPNAME' => $dstName)); -$t->data['noconsent_abort'] = \SimpleSAML\Locale\Translate::t('{consent:consent:abort}', array('SPNAME' => $dstName)); +$t->data['noconsent_text'] = $translator->t('{consent:consent:noconsent_text}', array('SPNAME' => $dstName)); +$t->data['noconsent_abort'] = $translator->t('{consent:consent:abort}', array('SPNAME' => $dstName)); $t->show(); diff --git a/modules/core/www/frontpage_auth.php b/modules/core/www/frontpage_auth.php index 3d45dfc5015c0633667a3068e9d6d0667b1aa454..fd61b0b8c0fd2fd0605b309f19ceffbcf7d2256c 100644 --- a/modules/core/www/frontpage_auth.php +++ b/modules/core/www/frontpage_auth.php @@ -36,7 +36,7 @@ $t->data['pageid'] = 'frontpage_auth'; $t->data['isadmin'] = $isadmin; $t->data['loginurl'] = $loginurl; -$t->data['header'] = \SimpleSAML\Locale\Translate::t('{core:frontpage:page_title}'); +$t->data['header'] = $t->getTranslator()->t('{core:frontpage:page_title}'); $t->data['links'] = $links; $t->data['links_welcome'] = $links_welcome; $t->data['links_config'] = $links_config; diff --git a/modules/core/www/frontpage_config.php b/modules/core/www/frontpage_config.php index fd0561b7bc8e804f3657e4f44e1025105bb3c60e..69e6a4cba47aecdd18805efc53b1934198f440cb 100644 --- a/modules/core/www/frontpage_config.php +++ b/modules/core/www/frontpage_config.php @@ -160,7 +160,7 @@ $funcmatrix[] = array( $t = new \SimpleSAML\XHTML\Template($config, 'core:frontpage_config.tpl.php'); $t->data['pageid'] = 'frontpage_config'; -$t->data['header'] = \SimpleSAML\Locale\Translate::t('{core:frontpage:page_title}'); +$t->data['header'] = $t->getTranslator()->t('{core:frontpage:page_title}'); $t->data['isadmin'] = $isadmin; $t->data['loginurl'] = $loginurl; $t->data['warnings'] = $warnings; diff --git a/modules/core/www/frontpage_federation.php b/modules/core/www/frontpage_federation.php index 2e96ebce205672d2c3717f99d1081be8a5f50aac..be0bcb3e65489a0a1a0ae68610b774ac55d50c10 100644 --- a/modules/core/www/frontpage_federation.php +++ b/modules/core/www/frontpage_federation.php @@ -156,7 +156,7 @@ $t->data['links_welcome'] = $links_welcome; $t->data['links_config'] = $links_config; $t->data['links_auth'] = $links_auth; $t->data['links_federation'] = $links_federation; -$t->data['header'] = \SimpleSAML\Locale\Translate::t('{core:frontpage:page_title}'); +$t->data['header'] = $t->getTranslator()->t('{core:frontpage:page_title}'); $t->data['metadata_url'] = \SimpleSAML\Module::getModuleURL('core/show_metadata.php'); $t->data['metaentries'] = $metaentries; diff --git a/modules/core/www/frontpage_welcome.php b/modules/core/www/frontpage_welcome.php index fb472afba1c0abbacf3c4b7707819e0c76891424..60b9ef9565cc0b24061718a604e201f8d62e2337 100644 --- a/modules/core/www/frontpage_welcome.php +++ b/modules/core/www/frontpage_welcome.php @@ -42,7 +42,7 @@ $t->data['links_welcome'] = $links_welcome; $t->data['links_config'] = $links_config; $t->data['links_auth'] = $links_auth; $t->data['links_federation'] = $links_federation; -$t->data['header'] = \SimpleSAML\Locale\Translate::t('{core:frontpage:page_title}'); +$t->data['header'] = $t->getTranslator()->t('{core:frontpage:page_title}'); diff --git a/modules/core/www/idp/logout-iframe.php b/modules/core/www/idp/logout-iframe.php index b8f85a363964e39d23bb2f692b5b9299e58f0f1b..547d86a1048c2a91dd5fbbfd008cbe11f44bf57a 100644 --- a/modules/core/www/idp/logout-iframe.php +++ b/modules/core/www/idp/logout-iframe.php @@ -122,7 +122,7 @@ if ($type === 'nojs') { $t = new \SimpleSAML\XHTML\Template($globalConfig, $template_id); $t->data['auth_state'] = $id; -$t->data['header'] = \SimpleSAML\Locale\Translate::t('{logout:progress}'); +$t->data['header'] = $t->getTranslator()->t('{logout:progress}'); /** * @deprecated The "id" variable will be removed. Please use "auth_state" instead. diff --git a/modules/core/www/no_cookie.php b/modules/core/www/no_cookie.php index b6b3533f5ab4961a8b01493e7928e069b452eac5..3575d85f6b4b3cc3e623baa4c457c7dff2cd7de7 100644 --- a/modules/core/www/no_cookie.php +++ b/modules/core/www/no_cookie.php @@ -9,9 +9,10 @@ if (isset($_REQUEST['retryURL'])) { $globalConfig = \SimpleSAML\Configuration::getInstance(); $t = new \SimpleSAML\XHTML\Template($globalConfig, 'core:no_cookie.tpl.php'); +$translator = $t->getTranslator(); -$t->data['header'] = htmlspecialchars(\SimpleSAML\Locale\Translate::t('{core:no_cookie:header}')); -$t->data['description'] = htmlspecialchars(\SimpleSAML\Locale\Translate::t('{core:no_cookie:description}')); -$t->data['retry'] = htmlspecialchars(\SimpleSAML\Locale\Translate::t('{core:no_cookie:retry}')); +$t->data['header'] = htmlspecialchars($translator->t('{core:no_cookie:header}')); +$t->data['description'] = htmlspecialchars($translator->t('{core:no_cookie:description}')); +$t->data['retry'] = htmlspecialchars($translator->t('{core:no_cookie:retry}')); $t->data['retryURL'] = $retryURL; $t->show();