r107901 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r107900‎ | r107901 | r107902 >
Date:17:13, 3 January 2012
Author:reedy
Status:ok
Tags:
Comment:
MFT r96774
Modified paths:
  • /branches/REL1_18/phase3 (modified) (history)
  • /branches/REL1_18/phase3/includes/specials/SpecialLinkSearch.php (modified) (history)

Diff [purge]

Index: branches/REL1_18/phase3/includes/specials/SpecialLinkSearch.php
@@ -43,14 +43,20 @@
4444 }
4545
4646 function execute( $par ) {
47 - global $wgOut, $wgRequest, $wgUrlProtocols, $wgMiserMode, $wgLang;
 47+ global $wgUrlProtocols, $wgMiserMode;
 48+
4849 $this->setHeaders();
49 - $wgOut->allowClickjacking();
 50+ $this->outputHeader();
5051
51 - $target = $wgRequest->getVal( 'target', $par );
52 - $namespace = $wgRequest->getIntorNull( 'namespace', null );
 52+ $out = $this->getOutput();
 53+ $out->allowClickjacking();
5354
 55+ $request = $this->getRequest();
 56+ $target = $request->getVal( 'target', $par );
 57+ $namespace = $request->getIntorNull( 'namespace', null );
 58+
5459 $protocols_list = array();
 60+
5561 foreach( $wgUrlProtocols as $prot ) {
5662 if ( $prot !== '//' ) {
5763 $protocols_list[] = $prot;
@@ -79,9 +85,10 @@
8086 $protocol = '';
8187 }
8288
83 - $out->addWikiMsg( 'linksearch-text', '<nowiki>' . $this->getLanguage()->commaList( $protocols_list ) . '</nowiki>' );
 89+ $out->addWikiMsg( 'linksearch-text', '<nowiki>' . $this->getLang()->commaList( $wgUrlProtocols ) . '</nowiki>' );
 90+
8491 $s = Xml::openElement( 'form', array( 'id' => 'mw-linksearch-form', 'method' => 'get', 'action' => $GLOBALS['wgScript'] ) ) .
85 - Html::hidden( 'title', $self->getPrefixedDbKey() ) .
 92+ Html::hidden( 'title', $this->getTitle()->getPrefixedDbKey() ) .
8693 '<fieldset>' .
8794 Xml::element( 'legend', array(), wfMsg( 'linksearch' ) ) .
8895 Xml::inputLabel( wfMsg( 'linksearch-pat' ), 'target', 'target', 50, $target ) . ' ';
@@ -92,7 +99,7 @@
93100 $s .= Xml::submitButton( wfMsg( 'linksearch-ok' ) ) .
94101 '</fieldset>' .
95102 Xml::closeElement( 'form' );
96 - $wgOut->addHTML( $s );
 103+ $out->addHTML( $s );
97104
98105 if( $target != '' ) {
99106 $this->setParams( array(
@@ -101,7 +108,7 @@
102109 'protocol' => $protocol ) );
103110 parent::execute( $par );
104111 if( $this->mMungedQuery === false )
105 - $wgOut->addWikiMsg( 'linksearch-error' );
 112+ $out->addWikiMsg( 'linksearch-error' );
106113 }
107114 }
108115
@@ -172,8 +179,8 @@
173180 function formatResult( $skin, $result ) {
174181 $title = Title::makeTitle( $result->namespace, $result->title );
175182 $url = $result->url;
176 - $pageLink = $skin->linkKnown( $title );
177 - $urlLink = $skin->makeExternalLink( $url, $url );
 183+ $pageLink = Linker::linkKnown( $title );
 184+ $urlLink = Linker::makeExternalLink( $url, $url );
178185
179186 return wfMsgHtml( 'linksearch-line', $urlLink, $pageLink );
180187 }
@@ -182,14 +189,13 @@
183190 * Override to check query validity.
184191 */
185192 function doQuery( $offset = false, $limit = false ) {
186 - global $wgOut;
187193 list( $this->mMungedQuery, ) = LinkSearchPage::mungeQuery( $this->mQuery, $this->mProt );
188194 if( $this->mMungedQuery === false ) {
189 - $wgOut->addWikiMsg( 'linksearch-error' );
 195+ $this->getOutput()->addWikiMsg( 'linksearch-error' );
190196 } else {
191197 // For debugging
192198 // Generates invalid xhtml with patterns that contain --
193 - //$wgOut->addHTML( "\n<!-- " . htmlspecialchars( $this->mMungedQuery ) . " -->\n" );
 199+ //$this->getOutput()->addHTML( "\n<!-- " . htmlspecialchars( $this->mMungedQuery ) . " -->\n" );
194200 parent::doQuery( $offset, $limit );
195201 }
196202 }
Property changes on: branches/REL1_18/phase3
___________________________________________________________________
Modified: svn:mergeinfo
197203 Merged /trunk/phase3:r96774

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r96774* Use local context instead of global variables...ialex08:43, 11 September 2011

Status & tagging log