wiki.techinc.nl/includes/PageQueryPage.php
Roan Kattouw 56b5aa18ed Merge querypage-work2 branch from trunk. The most relevant changes are:
* QueryPage now uses array-based query building instead of raw SQL
* Converted all QueryPage-based special pages that were using old-style wfSpecialFoo functions to new-style SpecialPage subclasses; this is possible because QueryPage is changed to extend SpecialPage
* Backward compatibility for extensions is partly preserved: getSQL() is fallen back on for QueryPage subclasses that don't implement getQueryInfo(), but getOrder() will be ignored (implement getOrderFields() instead). This also means that dual compatibility (1.18 compat and b/c with pre-1.18) is trivial

Extension changes will be merged after this commit.

These changes make it easier to write an API module for QueryPages (bug 14869); this wasn't done in the branch but will be done in trunk soon.
2010-12-22 14:16:25 +00:00

26 lines
680 B
PHP

<?php
/**
* Variant of QueryPage which formats the result as a simple link to the page
*
* @ingroup SpecialPage
*/
abstract class PageQueryPage extends QueryPage {
/**
* Format the result as a simple link to the page
*
* @param $skin Skin
* @param $row Object: result row
* @return string
*/
public function formatResult( $skin, $row ) {
global $wgContLang;
$title = Title::makeTitleSafe( $row->namespace, $row->title );
$text = $row->title;
if ( $title instanceof Title ) {
$text = $wgContLang->convert( $title->getPrefixedText() );
}
return $skin->link( $title, htmlspecialchars( $text ), array(), array(), array('known', 'noclasses') );
}
}