From 24a7e8b9f9817f6d5bb4488c59c0dce148bc0051 Mon Sep 17 00:00:00 2001 From: alistair3149 Date: Wed, 13 Nov 2024 03:09:05 -0500 Subject: [PATCH] Add early exit for footer hook --- config/LocalSettings.php | 103 ++++++++++++++++++++------------------- 1 file changed, 52 insertions(+), 51 deletions(-) diff --git a/config/LocalSettings.php b/config/LocalSettings.php index cb069ef..d79bf7a 100644 --- a/config/LocalSettings.php +++ b/config/LocalSettings.php @@ -1304,58 +1304,59 @@ * @see https://www.mediawiki.org/wiki/Manual:Hooks/SkinAddFooterLinks */ $wgHooks['SkinAddFooterLinks'][] = function( $sk, $key, &$footerlinks ) { - $rel = 'nofollow noreferrer noopener'; - - if ( $key === 'places' ) { - $footerlinks[ 'cookiestatement' ] = Html::rawElement( 'a', - [ - 'href' => Title::newFromText( - $sk->msg('cookiestatementpage')->inContentLanguage()->text() - )->getFullURL() - ], - $sk->msg('cookiestatement')->escaped() - ); - //$footerlinks['analytics'] = Html::rawElement( - // 'a', - // [ - // 'href' => 'https://analytics.starcitizen.tools/starcitizen.tools', - // 'rel' => $rel - // ], - // $sk->msg( 'footer-analytics' )->escaped() - //); - $footerlinks['statuspage'] = Html::rawElement( - 'a', - [ - 'href' => 'https://status.starcitizen.tools', - 'rel' => $rel - ], - $sk->msg('footer-statuspage')->escaped() - ); - $footerlinks['github'] = Html::rawElement( - 'a', - [ - 'href' => 'https://github.com/StarCitizenTools', - 'rel' => $rel - ], - $sk->msg('footer-github')->escaped() - ); - $footerlinks['patreon'] = Html::rawElement( - 'a', - [ - 'href' => 'https://www.patreon.com/starcitizentools', - 'rel' => $rel - ], - $sk->msg('footer-patreon')->escaped() - ); - $footerlinks['kofi'] = Html::rawElement( - 'a', - [ - 'href' => 'https://ko-fi.com/starcitizentools', - 'rel' => $rel - ], - $sk->msg('footer-kofi')->escaped() - ); + // Early edit + if ( $key !== 'places' ) { + return; } + $rel = 'nofollow noreferrer noopener'; + $footerlinks[ 'cookiestatement' ] = Html::rawElement( 'a', + [ + 'href' => Title::newFromText( + $sk->msg('cookiestatementpage')->inContentLanguage()->text() + )->getFullURL() + ], + $sk->msg('cookiestatement')->escaped() + ); + //$footerlinks['analytics'] = Html::rawElement( + // 'a', + // [ + // 'href' => 'https://analytics.starcitizen.tools/starcitizen.tools', + // 'rel' => $rel + // ], + // $sk->msg( 'footer-analytics' )->escaped() + //); + $footerlinks['statuspage'] = Html::rawElement( + 'a', + [ + 'href' => 'https://status.starcitizen.tools', + 'rel' => $rel + ], + $sk->msg('footer-statuspage')->escaped() + ); + $footerlinks['github'] = Html::rawElement( + 'a', + [ + 'href' => 'https://github.com/StarCitizenTools', + 'rel' => $rel + ], + $sk->msg('footer-github')->escaped() + ); + $footerlinks['patreon'] = Html::rawElement( + 'a', + [ + 'href' => 'https://www.patreon.com/starcitizentools', + 'rel' => $rel + ], + $sk->msg('footer-patreon')->escaped() + ); + $footerlinks['kofi'] = Html::rawElement( + 'a', + [ + 'href' => 'https://ko-fi.com/starcitizentools', + 'rel' => $rel + ], + $sk->msg('footer-kofi')->escaped() + ); }; /**