$diff = $wgRequest->getVal( 'diff' );
$diffOnly = $wgRequest->getBool( 'diffonly', $wgUser->getOption( 'diffonly' ) );
- if ( isset( $diff ) && $diffOnly )
+ if ( isset( $diff ) && $diffOnly ) {
return parent::view();
+ }
- if ( !wfRunHooks( 'CategoryPageView', array( &$this ) ) )
+ if ( !wfRunHooks( 'CategoryPageView', array( &$this ) ) ) {
return;
+ }
if ( NS_CATEGORY == $this->mTitle->getNamespace() ) {
$this->openShowCategory();
* Format the category data list.
*
* @return string HTML output
- * @private
*/
- function getHTML() {
+ public function getHTML() {
global $wgOut, $wgCategoryMagicGallery, $wgContLang;
wfProfileIn( __METHOD__ );
/**
* Add a subcategory to the internal lists, using a Category object
*/
- function addSubcategoryObject( $cat, $sortkey, $pageLength ) {
- $title = $cat->getTitle();
- $this->addSubcategory( $title, $sortkey, $pageLength );
- }
-
- /**
- * Add a subcategory to the internal lists, using a title object
- * @deprecated kept for compatibility, please use addSubcategoryObject instead
- */
- function addSubcategory( $title, $sortkey, $pageLength ) {
+ function addSubcategoryObject( Category $cat, $sortkey, $pageLength ) {
// Subcategory; strip the 'Category' namespace from the link text.
$this->children[] = $this->getSkin()->link(
- $title,
+ $cat->getTitle(),
null,
array(),
array(),
array( 'known', 'noclasses' )
);
- $this->children_start_char[] = $this->getSubcategorySortChar( $title, $sortkey );
+ $this->children_start_char[] =
+ $this->getSubcategorySortChar( $cat->getTitle(), $sortkey );
+ }
+
+ /**
+ * Add a subcategory to the internal lists, using a title object
+ * @deprecated kept for compatibility, please use addSubcategoryObject instead
+ */
+ function addSubcategory( Title $title, $sortkey, $pageLength ) {
+ $this->addSubcategoryObject( Category::newFromTitle( $title ), $sortkey, $pageLength );
}
/**
*/
function formatList( $articles, $articles_start_char, $cutoff = 6 ) {
if ( count ( $articles ) > $cutoff ) {
- return $this->columnList( $articles, $articles_start_char );
+ return self::columnList( $articles, $articles_start_char );
} elseif ( count( $articles ) > 0 ) {
// for short lists of articles in categories.
- return $this->shortList( $articles, $articles_start_char );
+ return self::shortList( $articles, $articles_start_char );
}
return '';
}
* @return String
* @private
*/
- function columnList( $articles, $articles_start_char ) {
+ static function columnList( $articles, $articles_start_char ) {
$columns = array_combine( $articles, $articles_start_char );
# Split into three columns
$columns = array_chunk( $columns, ceil( count( $columns ) / 3 ), true /* preserve keys */ );
* @return String
* @private
*/
- function shortList( $articles, $articles_start_char ) {
+ static function shortList( $articles, $articles_start_char ) {
$r = '<h3>' . htmlspecialchars( $articles_start_char[0] ) . "</h3>\n";
$r .= '<ul><li>' . $articles[0] . '</li>';
for ( $index = 1; $index < count( $articles ); $index++ )
# Check if there's a "from" or "until" for anything
$fromOrUntil = false;
- foreach ( array( 'page', 'subcat', 'file' ) as $type ) {
- if ( $this->from[$type] !== null || $this->until[$type] !== null ) {
+ foreach ( array( 'page', 'subcat', 'file' ) as $t ) {
+ if ( $this->from[$t] !== null || $this->until[$t] !== null ) {
$fromOrUntil = true;
break;
}