r99765 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r99764‎ | r99765 | r99766 >
Date:14:20, 14 October 2011
Author:ialex
Status:ok
Tags:
Comment:
In WantedQueryPage:
* Call Linker methods statically
* Use $this->msg() to simplify parameter formatting and escaping
* Link to Special:Whatlinkshere/Page instead of Special:Whatlinkshere?target=Page for consistency
Modified paths:
  • /trunk/phase3/includes/QueryPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/QueryPage.php
@@ -760,8 +760,8 @@
761761 if ( $title instanceof Title ) {
762762 if ( $this->isCached() || $this->forceExistenceCheck() ) {
763763 $pageLink = $title->isKnown()
764 - ? '<del>' . $skin->link( $title ) . '</del>'
765 - : $skin->link(
 764+ ? '<del>' . Linker::link( $title ) . '</del>'
 765+ : Linker::link(
766766 $title,
767767 null,
768768 array(),
@@ -769,7 +769,7 @@
770770 array( 'broken' )
771771 );
772772 } else {
773 - $pageLink = $skin->link(
 773+ $pageLink = Linker::link(
774774 $title,
775775 null,
776776 array(),
@@ -777,10 +777,9 @@
778778 array( 'broken' )
779779 );
780780 }
781 - return $this->getLang()->specialList( $pageLink, $this->makeWlhLink( $title, $skin, $result ) );
 781+ return $this->getLang()->specialList( $pageLink, $this->makeWlhLink( $title, $result ) );
782782 } else {
783 - $tsafe = htmlspecialchars( $result->title );
784 - return wfMsgHtml( 'wantedpages-badtitle', $tsafe );
 783+ return $this->msg( 'wantedpages-badtitle', $result->title )->escaped();
785784 }
786785 }
787786
@@ -788,14 +787,12 @@
789788 * Make a "what links here" link for a given title
790789 *
791790 * @param $title Title to make the link for
792 - * @param $skin Skin object to use
793791 * @param $result Object: result row
794792 * @return string
795793 */
796 - private function makeWlhLink( $title, $skin, $result ) {
797 - $wlh = SpecialPage::getTitleFor( 'Whatlinkshere' );
798 - $label = wfMsgExt( 'nlinks', array( 'parsemag', 'escape' ),
799 - $this->getLang()->formatNum( $result->value ) );
800 - return $skin->link( $wlh, $label, array(), array( 'target' => $title->getPrefixedText() ) );
 794+ private function makeWlhLink( $title, $result ) {
 795+ $wlh = SpecialPage::getTitleFor( 'Whatlinkshere', $title->getPrefixedText() );
 796+ $label = $this->msg( 'nlinks' )->numParams( $result->value )->escaped();
 797+ return Linker::link( $wlh, $label );
801798 }
802799 }

Status & tagging log