MediaWiki  1.23.2
CategoryPage.php
Go to the documentation of this file.
1 <?php
28 class CategoryPage extends Article {
29  # Subclasses can change this to override the viewer class.
30  protected $mCategoryViewerClass = 'CategoryViewer';
31 
36  protected function newPage( Title $title ) {
37  // Overload mPage with a category-specific page
38  return new WikiCategoryPage( $title );
39  }
40 
46  public static function newFromID( $id ) {
47  $t = Title::newFromID( $id );
48  # @todo FIXME: Doesn't inherit right
49  return $t == null ? null : new self( $t );
50  # return $t == null ? null : new static( $t ); // PHP 5.3
51  }
52 
53  function view() {
54  $request = $this->getContext()->getRequest();
55  $diff = $request->getVal( 'diff' );
56  $diffOnly = $request->getBool( 'diffonly',
57  $this->getContext()->getUser()->getOption( 'diffonly' ) );
58 
59  if ( $diff !== null && $diffOnly ) {
60  parent::view();
61  return;
62  }
63 
64  if ( !wfRunHooks( 'CategoryPageView', array( &$this ) ) ) {
65  return;
66  }
67 
68  $title = $this->getTitle();
69  if ( NS_CATEGORY == $title->getNamespace() ) {
70  $this->openShowCategory();
71  }
72 
73  parent::view();
74 
75  if ( NS_CATEGORY == $title->getNamespace() ) {
76  $this->closeShowCategory();
77  }
78  }
79 
80  function openShowCategory() {
81  # For overloading
82  }
83 
84  function closeShowCategory() {
85  // Use these as defaults for back compat --catrope
86  $request = $this->getContext()->getRequest();
87  $oldFrom = $request->getVal( 'from' );
88  $oldUntil = $request->getVal( 'until' );
89 
90  $reqArray = $request->getValues();
91 
92  $from = $until = array();
93  foreach ( array( 'page', 'subcat', 'file' ) as $type ) {
94  $from[$type] = $request->getVal( "{$type}from", $oldFrom );
95  $until[$type] = $request->getVal( "{$type}until", $oldUntil );
96 
97  // Do not want old-style from/until propagating in nav links.
98  if ( !isset( $reqArray["{$type}from"] ) && isset( $reqArray["from"] ) ) {
99  $reqArray["{$type}from"] = $reqArray["from"];
100  }
101  if ( !isset( $reqArray["{$type}to"] ) && isset( $reqArray["to"] ) ) {
102  $reqArray["{$type}to"] = $reqArray["to"];
103  }
104  }
105 
106  unset( $reqArray["from"] );
107  unset( $reqArray["to"] );
108 
109  $viewer = new $this->mCategoryViewerClass(
110  $this->getContext()->getTitle(),
111  $this->getContext(),
112  $from,
113  $until,
114  $reqArray
115  );
116  $this->getContext()->getOutput()->addHTML( $viewer->getHTML() );
117  }
118 }
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
CategoryPage\closeShowCategory
closeShowCategory()
Definition: CategoryPage.php:84
view
$article view()
CategoryPage\newFromID
static newFromID( $id)
Constructor from a page id.
Definition: CategoryPage.php:46
CategoryPage
Special handling for category description pages, showing pages, subcategories and file that belong to...
Definition: CategoryPage.php:28
$from
$from
Definition: importImages.php:90
CategoryPage\view
view()
This is the default action of the index.php entry point: just view the page of the given title.
Definition: CategoryPage.php:53
CategoryPage\newPage
newPage(Title $title)
Definition: CategoryPage.php:36
WikiCategoryPage
Special handling for category pages.
Definition: WikiCategoryPage.php:26
Article\getTitle
getTitle()
Get the title object of the article.
Definition: Article.php:194
CategoryPage\$mCategoryViewerClass
$mCategoryViewerClass
Definition: CategoryPage.php:30
wfRunHooks
wfRunHooks( $event, array $args=array(), $deprecatedVersion=null)
Call hook functions defined in $wgHooks.
Definition: GlobalFunctions.php:4001
Article\getContext
getContext()
Gets the context this Article is executed in.
Definition: Article.php:1922
array
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
NS_CATEGORY
const NS_CATEGORY
Definition: Defines.php:93
$title
presenting them properly to the user as errors is done by the caller $title
Definition: hooks.txt:1324
CategoryPage\openShowCategory
openShowCategory()
Definition: CategoryPage.php:80
Title
Represents a title within MediaWiki.
Definition: Title.php:35
as
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
Definition: distributors.txt:9
$t
$t
Definition: testCompression.php:65
Article
Class for viewing MediaWiki article and history.
Definition: Article.php:36
Title\newFromID
static newFromID( $id, $flags=0)
Create a new Title from an article ID.
Definition: Title.php:297
$type
$type
Definition: testCompression.php:46