MediaWiki  1.30.0
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->getOutput()->allowClickjacking();
41 
42  $from = $this->getRequest()->getText( 'from', $par );
43 
44  $cap = new CategoryPager(
45  $this->getContext(),
46  $from,
47  $this->getLinkRenderer()
48  );
49  $cap->doQuery();
50 
51  $this->getOutput()->addHTML(
52  Html::openElement( 'div', [ 'class' => 'mw-spcontent' ] ) .
53  $this->msg( 'categoriespagetext', $cap->getNumRows() )->parseAsBlock() .
54  $cap->getStartForm( $from ) .
55  $cap->getNavigationBar() .
56  '<ul>' . $cap->getBody() . '</ul>' .
57  $cap->getNavigationBar() .
58  Html::closeElement( 'div' )
59  );
60  }
61 
62  protected function getGroupName() {
63  return 'pages';
64  }
65 }
SpecialPage\msg
msg( $key)
Wrapper around wfMessage that sets the current context.
Definition: SpecialPage.php:746
SpecialPage\getOutput
getOutput()
Get the OutputPage being used for this instance.
Definition: SpecialPage.php:675
SpecialCategories\execute
execute( $par)
Default execute method Checks user permissions.
Definition: SpecialCategories.php:37
php
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition: injection.txt:35
SpecialCategories
Definition: SpecialCategories.php:27
Html\closeElement
static closeElement( $element)
Returns "</$element>".
Definition: Html.php:309
SpecialCategories\getGroupName
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
Definition: SpecialCategories.php:62
SpecialCategories\__construct
__construct()
Definition: SpecialCategories.php:29
SpecialPage\setHeaders
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
Definition: SpecialPage.php:484
SpecialPage\getContext
getContext()
Gets the context this SpecialPage is executed in.
Definition: SpecialPage.php:648
CategoryPager
Definition: CategoryPager.php:26
SpecialPage
Parent class for all special pages.
Definition: SpecialPage.php:36
SpecialPage\getRequest
getRequest()
Get the WebRequest being used for this instance.
Definition: SpecialPage.php:665
SpecialPage\getLinkRenderer
getLinkRenderer()
Definition: SpecialPage.php:860
Html\openElement
static openElement( $element, $attribs=[])
Identical to rawElement(), but has no third parameter and omits the end tag (and the self-closing '/'...
Definition: Html.php:251
SpecialPage\outputHeader
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
Definition: SpecialPage.php:583