MediaWiki REL1_33
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( 'allmessagesnotsupportedDB' );
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 );
68
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}
Use TablePager for prettified output.
Helper class to keep track of options when mixing links and form elements.
MediaWikiServices is the service locator for the application scope of MediaWiki.
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
Parent class for all special pages.
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
getOutput()
Get the OutputPage being used for this instance.
getContext()
Gets the context this SpecialPage is executed in.
msg( $key)
Wrapper around wfMessage that sets the current context.
getConfig()
Shortcut to get main config object.
getRequest()
Get the WebRequest being used for this instance.
getLanguage()
Shortcut to get user's language.
addHelpLink( $to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that When $user is not it can be in the form of< username >< more info > e g for bot passwords intended to be added to log contexts Fields it might only if the login was with a bot password it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output $out
Definition hooks.txt:855
either a unescaped string or a HtmlArmor object after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation use $formDescriptor instead & $formDescriptor
Definition hooks.txt:2157
if(!isset( $args[0])) $lang