X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fskins%2FSkin.php;h=96812ea23fd942be0b5cdf6c0d4636d5debde996;hb=e99e98aa7371bf089dd2af9b33760970236016a3;hp=b60aa10f27c37a45b7c59cea1fa3efa2d29568e0;hpb=bae9c5aca69c62ff8ae32956a082c0787cb06b73;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/skins/Skin.php b/includes/skins/Skin.php index b60aa10f27..96812ea23f 100644 --- a/includes/skins/Skin.php +++ b/includes/skins/Skin.php @@ -217,6 +217,17 @@ abstract class Skin extends ContextSource { } } + // Footer links (used by SkinTemplate::prepareQuickTemplate) + foreach ( [ + $this->footerLinkTitle( 'privacy', 'privacypage' ), + $this->footerLinkTitle( 'aboutsite', 'aboutpage' ), + $this->footerLinkTitle( 'disclaimers', 'disclaimerpage' ), + ] as $title ) { + if ( $title ) { + $titles[] = $title; + } + } + Hooks::run( 'SkinPreloadExistence', [ &$titles, $this ] ); if ( $titles ) { @@ -921,25 +932,34 @@ abstract class Skin extends ContextSource { * @return string HTML anchor */ public function footerLink( $desc, $page ) { - // if the link description has been set to "-" in the default language, - if ( $this->msg( $desc )->inContentLanguage()->isDisabled() ) { - // then it is disabled, for all languages. + $title = $this->footerLinkTitle( $desc, $page ); + if ( !$title ) { return ''; - } else { - // Otherwise, we display the link for the user, described in their - // language (which may or may not be the same as the default language), - // but we make the link target be the one site-wide page. - $title = Title::newFromText( $this->msg( $page )->inContentLanguage()->text() ); + } - if ( !$title ) { - return ''; - } + return Linker::linkKnown( + $title, + $this->msg( $desc )->escaped() + ); + } - return Linker::linkKnown( - $title, - $this->msg( $desc )->escaped() - ); + /** + * @param string $desc + * @param string $page + * @return Title|null + */ + private function footerLinkTitle( $desc, $page ) { + // If the link description has been set to "-" in the default language, + if ( $this->msg( $desc )->inContentLanguage()->isDisabled() ) { + // then it is disabled, for all languages. + return null; } + // Otherwise, we display the link for the user, described in their + // language (which may or may not be the same as the default language), + // but we make the link target be the one site-wide page. + $title = Title::newFromText( $this->msg( $page )->inContentLanguage()->text() ); + + return $title ?: null; } /**