MediaWiki  master
SpecialCategories.php
Go to the documentation of this file.
1 <?php
28 
29  public function __construct() {
30  parent::__construct( 'Categories' );
31 
32  // Since we don't control the constructor parameters, we can't inject services that way.
33  // Instead, we initialize services in the execute() method, and allow them to be overridden
34  // using the initServices() method.
35  }
36 
37  public function execute( $par ) {
38  $this->setHeaders();
39  $this->outputHeader();
40  $this->addHelpLink( 'Help:Categories' );
41  $this->getOutput()->allowClickjacking();
42 
43  $from = $this->getRequest()->getText( 'from', $par );
44 
45  $cap = new CategoryPager(
46  $this->getContext(),
47  $from,
48  $this->getLinkRenderer()
49  );
50  $cap->doQuery();
51 
52  $this->getOutput()->addHTML(
53  Html::openElement( 'div', [ 'class' => 'mw-spcontent' ] ) .
54  $this->msg( 'categoriespagetext', $cap->getNumRows() )->parseAsBlock() .
55  $cap->getStartForm( $from ) .
56  $cap->getNavigationBar() .
57  '<ul>' . $cap->getBody() . '</ul>' .
58  $cap->getNavigationBar() .
59  Html::closeElement( 'div' )
60  );
61  }
62 
63  protected function getGroupName() {
64  return 'pages';
65  }
66 }
getContext()
Gets the context this SpecialPage is executed in.
static openElement( $element, $attribs=[])
Identical to rawElement(), but has no third parameter and omits the end tag (and the self-closing &#39;/&#39;...
Definition: Html.php:251
addHelpLink( $to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
getOutput()
Get the OutputPage being used for this instance.
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
static closeElement( $element)
Returns "</$element>".
Definition: Html.php:315
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes! ...
getRequest()
Get the WebRequest being used for this instance.
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...