From: Bartosz Dziewoński Date: Fri, 5 Sep 2014 14:12:04 +0000 (+0200) Subject: Article: Don't hardcode tags on redirect page X-Git-Tag: 1.31.0-rc.0~14125^2 X-Git-Url: http://git.cyclocoop.org/%22.%24image2.%22?a=commitdiff_plain;h=7dc4b586;p=lhc%2Fweb%2Fwiklou.git Article: Don't hardcode tags on redirect page * Created a ResourceLoader module for redirect page styling. * Fixed a couple of bugs in Article code. Keeping two of the old files for a while because they might still be referenced by something (bug 69277 comment 11). Bug: 69277 Change-Id: I8fa565833545e41d0232101566da8c5ffa850e36 --- diff --git a/includes/content/WikitextContent.php b/includes/content/WikitextContent.php index d23f925d80..3ab6a6dbea 100644 --- a/includes/content/WikitextContent.php +++ b/includes/content/WikitextContent.php @@ -336,6 +336,7 @@ class WikitextContent extends TextContent { Article::getRedirectHeaderHtml( $title->getPageLanguage(), $chain, false ) . $output->getText() ); + $output->addModuleStyles( 'mediawiki.action.view.redirectPage' ); } } } diff --git a/includes/page/Article.php b/includes/page/Article.php index 71350ac783..9772d4f3f6 100644 --- a/includes/page/Article.php +++ b/includes/page/Article.php @@ -1466,10 +1466,11 @@ class Article implements Page { */ public function viewRedirect( $target, $appendSubtitle = true, $forceKnown = false ) { $lang = $this->getTitle()->getPageLanguage(); + $out = $this->getContext()->getOutput(); if ( $appendSubtitle ) { - $out = $this->getContext()->getOutput(); $out->addSubtitle( wfMessage( 'redirectpagesub' )->parse() ); } + $out->addModuleStyles( 'mediawiki.action.view.redirectPage' ); return static::getRedirectHeaderHtml( $lang, $target, $forceKnown ); } @@ -1486,57 +1487,30 @@ class Article implements Page { * @return string Containing HTML with redirect link */ public static function getRedirectHeaderHtml( Language $lang, $target, $forceKnown = false ) { - global $wgStylePath; - if ( !is_array( $target ) ) { $target = array( $target ); } - $imageDir = $lang->getDir(); - - // the loop prepends the arrow image before the link, so the first case needs to be outside - - /** @var $title Title */ - $title = array_shift( $target ); - - if ( $forceKnown ) { - $link = Linker::linkKnown( $title, htmlspecialchars( $title->getFullText() ) ); - } else { - $link = Linker::link( $title, htmlspecialchars( $title->getFullText() ) ); - } - - $nextRedirect = $wgStylePath . '/common/images/nextredirect' . $imageDir . '.png'; - $alt = $lang->isRTL() ? '←' : '→'; - - // Automatically append redirect=no to each link, since most of them are - // redirect pages themselves. - /** @var Title $rt */ - foreach ( $target as $rt ) { - $link .= Html::element( 'img', array( 'src' => $nextRedirect, 'alt' => $alt ) ); - if ( $forceKnown ) { - $link .= Linker::linkKnown( - $rt, - htmlspecialchars( $rt->getFullText(), - array(), - array( 'redirect' => 'no' ) - ) - ); - } else { - $link .= Linker::link( - $rt, - htmlspecialchars( $rt->getFullText() ), - array(), - array( 'redirect' => 'no' ) - ); - } + $html = '