From: Alexandre Emsenhuber Date: Sun, 11 Sep 2011 08:43:30 +0000 (+0000) Subject: * Use local context instead of global variables X-Git-Tag: 1.31.0-rc.0~27733 X-Git-Url: http://git.cyclocoop.org/%28?a=commitdiff_plain;h=14b76260d450c010453676a1f2865d5dbaa67331;p=lhc%2Fweb%2Fwiklou.git * Use local context instead of global variables * Call Linker methods statically * Added missing call to outputHeader() --- diff --git a/includes/specials/SpecialLinkSearch.php b/includes/specials/SpecialLinkSearch.php index 7ecad851d8..a37bdecd7e 100644 --- a/includes/specials/SpecialLinkSearch.php +++ b/includes/specials/SpecialLinkSearch.php @@ -43,12 +43,17 @@ class LinkSearchPage extends QueryPage { } function execute( $par ) { - global $wgOut, $wgRequest, $wgUrlProtocols, $wgMiserMode, $wgLang; + global $wgUrlProtocols, $wgMiserMode; + $this->setHeaders(); - $wgOut->allowClickjacking(); + $this->outputHeader(); + + $out = $this->getOutput(); + $out->allowClickjacking(); - $target = $wgRequest->getVal( 'target', $par ); - $namespace = $wgRequest->getIntorNull( 'namespace', null ); + $request = $this->getRequest(); + $target = $request->getVal( 'target', $par ); + $namespace = $request->getIntorNull( 'namespace', null ); $protocols_list[] = ''; foreach( $wgUrlProtocols as $prot ) { @@ -77,11 +82,9 @@ class LinkSearchPage extends QueryPage { $protocol = ''; } - $self = $this->getTitle(); - - $wgOut->addWikiMsg( 'linksearch-text', '' . $wgLang->commaList( $wgUrlProtocols ) . '' ); + $out->addWikiMsg( 'linksearch-text', '' . $this->getLang()->commaList( $wgUrlProtocols ) . '' ); $s = Xml::openElement( 'form', array( 'id' => 'mw-linksearch-form', 'method' => 'get', 'action' => $GLOBALS['wgScript'] ) ) . - Html::hidden( 'title', $self->getPrefixedDbKey() ) . + Html::hidden( 'title', $this->getTitle()->getPrefixedDbKey() ) . '
' . Xml::element( 'legend', array(), wfMsg( 'linksearch' ) ) . Xml::inputLabel( wfMsg( 'linksearch-pat' ), 'target', 'target', 50, $target ) . ' '; @@ -92,7 +95,7 @@ class LinkSearchPage extends QueryPage { $s .= Xml::submitButton( wfMsg( 'linksearch-ok' ) ) . '
' . Xml::closeElement( 'form' ); - $wgOut->addHTML( $s ); + $out->addHTML( $s ); if( $target != '' ) { $this->setParams( array( @@ -101,7 +104,7 @@ class LinkSearchPage extends QueryPage { 'protocol' => $protocol ) ); parent::execute( $par ); if( $this->mMungedQuery === false ) - $wgOut->addWikiMsg( 'linksearch-error' ); + $out->addWikiMsg( 'linksearch-error' ); } } @@ -172,8 +175,8 @@ class LinkSearchPage extends QueryPage { function formatResult( $skin, $result ) { $title = Title::makeTitle( $result->namespace, $result->title ); $url = $result->url; - $pageLink = $skin->linkKnown( $title ); - $urlLink = $skin->makeExternalLink( $url, $url ); + $pageLink = Linker::linkKnown( $title ); + $urlLink = Linker::makeExternalLink( $url, $url ); return wfMsgHtml( 'linksearch-line', $urlLink, $pageLink ); } @@ -182,14 +185,13 @@ class LinkSearchPage extends QueryPage { * Override to check query validity. */ function doQuery( $offset = false, $limit = false ) { - global $wgOut; list( $this->mMungedQuery, ) = LinkSearchPage::mungeQuery( $this->mQuery, $this->mProt ); if( $this->mMungedQuery === false ) { - $wgOut->addWikiMsg( 'linksearch-error' ); + $this->getOutput()->addWikiMsg( 'linksearch-error' ); } else { // For debugging // Generates invalid xhtml with patterns that contain -- - //$wgOut->addHTML( "\n\n" ); + //$this->getOutput()->addHTML( "\n\n" ); parent::doQuery( $offset, $limit ); } }