22
33namespace SimpleSAML \Module \discopower ;
44
5+ use SimpleSAML \Configuration ;
6+ use SimpleSAML \Locale \Translate ;
7+ use SimpleSAML \Logger ;
8+ use SimpleSAML \Session ;
9+ use SimpleSAML \Utils \HTTP ;
10+ use SimpleSAML \XHTML \Template ;
511use Webmozart \Assert \Assert ;
612
713/**
@@ -52,7 +58,7 @@ public function __construct(array $metadataSets, $instance)
5258 {
5359 parent ::__construct ($ metadataSets , $ instance );
5460
55- $ this ->discoconfig = \ SimpleSAML \ Configuration::getConfig ('module_discopower.php ' );
61+ $ this ->discoconfig = Configuration::getConfig ('module_discopower.php ' );
5662
5763 $ this ->cdcDomain = $ this ->discoconfig ->getString ('cdc.domain ' , null );
5864 if ($ this ->cdcDomain !== null && $ this ->cdcDomain [0 ] !== '. ' ) {
@@ -74,7 +80,7 @@ public function __construct(array $metadataSets, $instance)
7480 */
7581 protected function log ($ message )
7682 {
77- \ SimpleSAML \ Logger::info ('PowerIdPDisco. ' .$ this ->instance .': ' .$ message );
83+ Logger::info ('PowerIdPDisco. ' .$ this ->instance .': ' .$ message );
7884 }
7985
8086
@@ -137,7 +143,7 @@ protected function idplistStructured($list)
137143 }
138144
139145 foreach ($ slist as $ tab => $ tbslist ) {
140- uasort ($ slist [$ tab ], [' \SimpleSAML\Module\discopower\PowerIdPDisco ' , 'mcmp ' ]);
146+ uasort ($ slist [$ tab ], [self ::class , 'mcmp ' ]);
141147 }
142148
143149 return $ slist ;
@@ -249,7 +255,8 @@ public function handleRequest()
249255 $ idpList = $ this ->idplistStructured ($ this ->filterList ($ idpList ));
250256 $ preferredIdP = $ this ->getRecommendedIdP ();
251257
252- $ t = new \SimpleSAML \XHTML \Template ($ this ->config , 'discopower:disco.tpl.php ' , 'disco ' );
258+ $ t = new Template ($ this ->config , 'discopower:disco.tpl.php ' , 'disco ' );
259+ $ translator = $ t ->getTranslator ();
253260
254261 $ t ->data ['return ' ] = $ this ->returnURL ;
255262 $ t ->data ['returnIDParam ' ] = $ this ->returnIdParam ;
@@ -271,22 +278,22 @@ public function handleRequest()
271278 }
272279
273280 /* store the tab list in the session */
274- $ session = \ SimpleSAML \ Session::getSessionFromRequest ();
281+ $ session = Session::getSessionFromRequest ();
275282 $ session ->setData ('discopower:tabList ' , 'faventry ' , $ this ->data ['faventry ' ]);
276283 $ session ->setData ('discopower:tabList ' , 'tabs ' , array_keys ($ idpList ));
277284 $ session ->setData ('discopower:tabList ' , 'defaulttab ' , $ t ->data ['defaulttab ' ]);
278285
279286 $ t ->data ['score ' ] = $ this ->discoconfig ->getValue ('score ' , 'quicksilver ' );
280287 $ t ->data ['preferredidp ' ] = $ preferredIdP ;
281- $ t ->data ['urlpattern ' ] = htmlspecialchars (\ SimpleSAML \ Utils \ HTTP ::getSelfURLNoQuery ());
288+ $ t ->data ['urlpattern ' ] = htmlspecialchars (HTTP ::getSelfURLNoQuery ());
282289 $ t ->data ['rememberenabled ' ] = $ this ->config ->getBoolean ('idpdisco.enableremember ' , false );
283290 $ t ->data ['rememberchecked ' ] = $ this ->config ->getBoolean ('idpdisco.rememberchecked ' , false );
284291 $ t ->data ['jquery ' ] = ['core ' => true , 'ui ' => true ];
285292 foreach (array_keys ($ idpList ) as $ tab ) {
286- if ($ t ->getTag ('{discopower:tabs: ' .$ tab .'} ' ) === null ) {
287- $ t ->includeInlineTranslation ('{discopower:tabs: ' .$ tab .'} ' , $ tab );
293+ if ($ translator ->getTag ('{discopower:tabs: ' .$ tab .'} ' ) === null ) {
294+ $ translator ->includeInlineTranslation ('{discopower:tabs: ' .$ tab .'} ' , $ tab );
288295 }
289- $ t ->data ['tabNames ' ][$ tab ] = \ SimpleSAML \ Locale \Translate ::noop ('{discopower:tabs: ' .$ tab .'} ' );
296+ $ t ->data ['tabNames ' ][$ tab ] = $ translator ::noop ('{discopower:tabs: ' .$ tab .'} ' );
290297 }
291298 $ t ->show ();
292299 }
@@ -344,7 +351,7 @@ private function processMetadata($t, $metadata, $favourite)
344351 }
345352 $ html .= $ entity ['translated ' ];
346353 if (array_key_exists ('icon ' , $ entity ) && $ entity ['icon ' ] !== null ) {
347- $ iconUrl = \ SimpleSAML \ Utils \ HTTP ::resolveURL ($ entity ['icon ' ]);
354+ $ iconUrl = HTTP ::resolveURL ($ entity ['icon ' ]);
348355 $ html .= '<img alt="Icon for identity provider" class="entryicon" src=" ' .
349356 htmlspecialchars ($ iconUrl ).'" /> ' ;
350357 }
@@ -429,7 +436,7 @@ protected function setPreviousIdP($idp)
429436 'secure ' => true ,
430437 'httponly ' => false ,
431438 ];
432- \ SimpleSAML \ Utils \ HTTP ::setCookie ('_saml_idp ' , $ newCookie , $ params , false );
439+ HTTP ::setCookie ('_saml_idp ' , $ newCookie , $ params , false );
433440 }
434441
435442
0 commit comments