MediaWiki  1.34.0
SpecialAllMessages.php
Go to the documentation of this file.
1 <?php
24 
32 
33  public function __construct() {
34  parent::__construct( 'Allmessages' );
35  }
36 
40  public function execute( $par ) {
41  $out = $this->getOutput();
42 
43  $this->setHeaders();
44 
45  if ( !$this->getConfig()->get( 'UseDatabaseMessages' ) ) {
46  $out->addWikiMsg( 'allmessages-not-supported-database' );
47 
48  return;
49  }
50 
51  $out->addModuleStyles( 'mediawiki.special' );
52  $this->addHelpLink( 'Help:System message' );
53 
54  $contLang = MediaWikiServices::getInstance()->getContentLanguage()->getCode();
55  $lang = $this->getLanguage();
56 
57  $opts = new FormOptions();
58 
59  $opts->add( 'prefix', '' );
60  $opts->add( 'filter', 'all' );
61  $opts->add( 'lang', $contLang );
62  $opts->add( 'limit', 50 );
63 
64  $opts->fetchValuesFromRequest( $this->getRequest() );
65  $opts->validateIntBounds( 'limit', 0, 5000 );
66 
67  $pager = new AllMessagesTablePager( $this->getContext(), $opts, $this->getLinkRenderer() );
68 
69  $formDescriptor = [
70  'prefix' => [
71  'type' => 'text',
72  'name' => 'prefix',
73  'label-message' => 'allmessages-prefix',
74  ],
75 
76  'filter' => [
77  'type' => 'radio',
78  'name' => 'filter',
79  'label-message' => 'allmessages-filter',
80  'options-messages' => [
81  'allmessages-filter-unmodified' => 'unmodified',
82  'allmessages-filter-all' => 'all',
83  'allmessages-filter-modified' => 'modified',
84  ],
85  'default' => 'all',
86  'flatlist' => true,
87  ],
88 
89  'lang' => [
90  'type' => 'language',
91  'name' => 'lang',
92  'label-message' => 'allmessages-language',
93  'default' => $opts->getValue( 'lang' ),
94  ],
95 
96  'limit' => [
97  'type' => 'limitselect',
98  'name' => 'limit',
99  'label-message' => 'table_pager_limit_label',
100  'options' => [
101  $lang->formatNum( 20 ) => 20,
102  $lang->formatNum( 50 ) => 50,
103  $lang->formatNum( 100 ) => 100,
104  $lang->formatNum( 250 ) => 250,
105  $lang->formatNum( 500 ) => 500,
106  $lang->formatNum( 5000 ) => 5000,
107  ],
108  'default' => $opts->getValue( 'limit' ),
109  ],
110  ];
111 
112  $htmlForm = HTMLForm::factory( 'ooui', $formDescriptor, $this->getContext() );
113  $htmlForm
114  ->setMethod( 'get' )
115  ->setIntro( $this->msg( 'allmessagestext' ) )
116  ->setWrapperLegendMsg( 'allmessages' )
117  ->setSubmitTextMsg( 'allmessages-filter-submit' )
118  ->prepareForm()
119  ->displayForm( false );
120 
121  $out->addParserOutputContent( $pager->getFullOutput() );
122  }
123 
124  protected function getGroupName() {
125  return 'wiki';
126  }
127 }
AllMessagesTablePager
Use TablePager for prettified output.
Definition: AllMessagesTablePager.php:32
SpecialPage\msg
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
Definition: SpecialPage.php:792
SpecialPage\getOutput
getOutput()
Get the OutputPage being used for this instance.
Definition: SpecialPage.php:719
MediaWiki\MediaWikiServices
MediaWikiServices is the service locator for the application scope of MediaWiki.
Definition: MediaWikiServices.php:117
$lang
if(!isset( $args[0])) $lang
Definition: testCompression.php:33
SpecialAllMessages\__construct
__construct()
Definition: SpecialAllMessages.php:33
SpecialPage\getLanguage
getLanguage()
Shortcut to get user's language.
Definition: SpecialPage.php:749
SpecialPage\addHelpLink
addHelpLink( $to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
Definition: SpecialPage.php:828
SpecialPage\getConfig
getConfig()
Shortcut to get main config object.
Definition: SpecialPage.php:758
SpecialPage\setHeaders
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
Definition: SpecialPage.php:537
SpecialAllMessages
Definition: SpecialAllMessages.php:31
SpecialPage\getContext
getContext()
Gets the context this SpecialPage is executed in.
Definition: SpecialPage.php:692
SpecialPage
Parent class for all special pages.
Definition: SpecialPage.php:37
SpecialPage\getRequest
getRequest()
Get the WebRequest being used for this instance.
Definition: SpecialPage.php:709
SpecialPage\getLinkRenderer
getLinkRenderer()
Definition: SpecialPage.php:904
FormOptions
Helper class to keep track of options when mixing links and form elements.
Definition: FormOptions.php:35
SpecialAllMessages\execute
execute( $par)
Definition: SpecialAllMessages.php:40
HTMLForm\factory
static factory( $displayFormat,... $arguments)
Construct a HTMLForm object for given display type.
Definition: HTMLForm.php:303
SpecialAllMessages\getGroupName
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
Definition: SpecialAllMessages.php:124