MediaWiki  REL1_24
PageQueryPage.php
Go to the documentation of this file.
00001 <?php
00029 abstract class PageQueryPage extends QueryPage {
00038     public function preprocessResults( $db, $res ) {
00039         if ( !$res->numRows() ) {
00040             return;
00041         }
00042 
00043         $batch = new LinkBatch();
00044         foreach ( $res as $row ) {
00045             $batch->add( $row->namespace, $row->title );
00046         }
00047         $batch->execute();
00048 
00049         $res->seek( 0 );
00050     }
00051 
00059     public function formatResult( $skin, $row ) {
00060         global $wgContLang;
00061 
00062         $title = Title::makeTitleSafe( $row->namespace, $row->title );
00063 
00064         if ( $title instanceof Title ) {
00065             $text = $wgContLang->convert( $title->getPrefixedText() );
00066             return Linker::link( $title, htmlspecialchars( $text ) );
00067         } else {
00068             return Html::element( 'span', array( 'class' => 'mw-invalidtitle' ),
00069                 Linker::getInvalidTitleDescription( $this->getContext(), $row->namespace, $row->title ) );
00070         }
00071     }
00072 }