X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2Fskins%2FSkin.php;h=a7740a093d66d644a0b73a88c99342f33e37c998;hb=ac2b8b9e716d708c48ed382545035d4804068be0;hp=b60aa10f27c37a45b7c59cea1fa3efa2d29568e0;hpb=61898ad28ed69c5b391eb43e0db9386279b9612c;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/skins/Skin.php b/includes/skins/Skin.php index b60aa10f27..a7740a093d 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 ) { @@ -370,7 +381,7 @@ abstract class Skin extends ContextSource { if ( $title->isSpecialPage() ) { $type = 'ns-special'; - // bug 23315: provide a class based on the canonical special page name without subpages + // T25315: provide a class based on the canonical special page name without subpages list( $canonicalName ) = SpecialPageFactory::resolveAlias( $title->getDBkey() ); if ( $canonicalName ) { $type .= ' ' . Sanitizer::escapeClass( "mw-special-$canonicalName" ); @@ -895,7 +906,10 @@ abstract class Skin extends ContextSource { $html = htmlspecialchars( $icon["alt"] ); } if ( $url ) { - $html = Html::rawElement( 'a', [ "href" => $url ], $html ); + global $wgExternalLinkTarget; + $html = Html::rawElement( 'a', + [ "href" => $url, "target" => $wgExternalLinkTarget ], + $html ); } } return $html; @@ -921,25 +935,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; } /** @@ -1263,7 +1286,7 @@ abstract class Skin extends ContextSource { $line = array_map( 'trim', explode( '|', $line, 2 ) ); if ( count( $line ) !== 2 ) { // Second sanity check, could be hit by people doing - // funky stuff with parserfuncs... (bug 33321) + // funky stuff with parserfuncs... (T35321) continue; } @@ -1518,7 +1541,7 @@ abstract class Skin extends ContextSource { $attribs = []; if ( !is_null( $tooltip ) ) { - # Bug 25462: undo double-escaping. + # T27462: undo double-escaping. $tooltip = Sanitizer::decodeCharReferences( $tooltip ); $attribs['title'] = wfMessage( 'editsectionhint' )->rawParams( $tooltip ) ->inLanguage( $lang )->text();