MediaWiki  1.30.0
MonoBookTemplate.php
Go to the documentation of this file.
1 <?php
31 
38  public function execute() {
39  $this->html( 'headelement' );
40  ?><div id="globalWrapper">
41  <div id="column-content">
42  <div id="content" class="mw-body" role="main">
43  <a id="top"></a>
44  <?php
45  if ( $this->data['sitenotice'] ) {
46  ?>
47  <div id="siteNotice" class="mw-body-content"><?php
48  $this->html( 'sitenotice' )
49  ?></div><?php
50  }
51  ?>
52 
53  <?php
54  echo $this->getIndicators();
55  // Loose comparison with '!=' is intentional, to catch null and false too, but not '0'
56  if ( $this->data['title'] != '' ) {
57  ?>
58  <h1 id="firstHeading" class="firstHeading" lang="<?php
59  $this->data['pageLanguage'] =
60  $this->getSkin()->getTitle()->getPageViewLanguage()->getHtmlCode();
61  $this->text( 'pageLanguage' );
62  ?>"><?php $this->html( 'title' ) ?></h1>
63  <?php
64  }
65  ?>
66 
67  <div id="bodyContent" class="mw-body-content">
68  <div id="siteSub"><?php $this->msg( 'tagline' ) ?></div>
69  <div id="contentSub"<?php
70  $this->html( 'userlangattributes' ) ?>><?php $this->html( 'subtitle' )
71  ?></div>
72  <?php if ( $this->data['undelete'] ) { ?>
73  <div id="contentSub2"><?php $this->html( 'undelete' ) ?></div>
74  <?php
75  }
76  ?><?php
77  if ( $this->data['newtalk'] ) {
78  ?>
79  <div class="usermessage"><?php $this->html( 'newtalk' ) ?></div>
80  <?php
81  }
82  ?>
83  <div id="jump-to-nav" class="mw-jump"><?php
84  $this->msg( 'jumpto' )
85  ?> <a href="#column-one"><?php
86  $this->msg( 'jumptonavigation' )
87  ?></a><?php
88  $this->msg( 'comma-separator' )
89  ?><a href="#searchInput"><?php
90  $this->msg( 'jumptosearch' )
91  ?></a></div>
92 
93  <!-- start content -->
94  <?php $this->html( 'bodytext' ) ?>
95  <?php
96  if ( $this->data['catlinks'] ) {
97  $this->html( 'catlinks' );
98  }
99  ?>
100  <!-- end content -->
101  <?php
102  if ( $this->data['dataAfterContent'] ) {
103  $this->html( 'dataAfterContent' );
104  }
105  ?>
106  <div class="visualClear"></div>
107  </div>
108  </div>
109  <?php Hooks::run( 'MonoBookAfterContent' ); ?>
110  </div>
111  <div id="column-one"<?php $this->html( 'userlangattributes' ) ?>>
112  <h2><?php $this->msg( 'navigation-heading' ) ?></h2>
113  <?php $this->cactions(); ?>
114  <div class="portlet" id="p-personal" role="navigation">
115  <h3><?php $this->msg( 'personaltools' ) ?></h3>
116 
117  <div class="pBody">
118  <ul<?php $this->html( 'userlangattributes' ) ?>>
119  <?php
121 
122  if ( array_key_exists( 'uls', $personalTools ) ) {
123  echo $this->makeListItem( 'uls', $personalTools['uls'] );
124  unset( $personalTools['uls'] );
125  }
126 
127  if ( !$this->getSkin()->getUser()->isLoggedIn() &&
128  User::groupHasPermission( '*', 'edit' )
129  ) {
130  echo Html::rawElement( 'li', [
131  'id' => 'pt-anonuserpage'
132  ], $this->getMsg( 'notloggedin' )->escaped() );
133  }
134 
135  foreach ( $personalTools as $key => $item ) { ?>
136  <?php echo $this->makeListItem( $key, $item ); ?>
137 
138  <?php
139  }
140  ?>
141  </ul>
142  </div>
143  </div>
144  <div class="portlet" id="p-logo" role="banner">
145  <?php
146  echo Html::element( 'a', [
147  'href' => $this->data['nav_urls']['mainpage']['href'],
148  'class' => 'mw-wiki-logo',
149  ]
151  ); ?>
152 
153  </div>
154  <?php
155  $this->renderPortals( $this->data['sidebar'] );
156  ?>
157  </div><!-- end of the left (by default at least) column -->
158  <div class="visualClear"></div>
159  <?php
160  $validFooterIcons = $this->getFooterIcons( 'icononly' );
161  // Additional footer links
162  $validFooterLinks = $this->getFooterLinks( 'flat' );
163 
164  if ( count( $validFooterIcons ) + count( $validFooterLinks ) > 0 ) {
165  ?>
166  <div id="footer" role="contentinfo"<?php $this->html( 'userlangattributes' ) ?>>
167  <?php
168  $footerEnd = '</div>';
169  } else {
170  $footerEnd = '';
171  }
172 
173  foreach ( $validFooterIcons as $blockName => $footerIcons ) {
174  ?>
175  <div id="f-<?php echo htmlspecialchars( $blockName ); ?>ico">
176  <?php foreach ( $footerIcons as $icon ) { ?>
177  <?php echo $this->getSkin()->makeFooterIcon( $icon ); ?>
178 
179  <?php
180  }
181  ?>
182  </div>
183  <?php
184  }
185 
186  if ( count( $validFooterLinks ) > 0 ) {
187  ?>
188  <ul id="f-list">
189  <?php
190  foreach ( $validFooterLinks as $aLink ) {
191  ?>
192  <li id="<?php echo $aLink ?>"><?php $this->html( $aLink ) ?></li>
193  <?php
194  }
195  ?>
196  </ul>
197  <?php
198  }
199 
200  echo $footerEnd;
201  ?>
202 
203  </div>
204  <?php
205  $this->printTrail();
206  echo Html::closeElement( 'body' );
207  echo Html::closeElement( 'html' );
208  echo "\n";
209  }
210 
214  protected function renderPortals( $sidebar ) {
215  if ( !isset( $sidebar['SEARCH'] ) ) {
216  $sidebar['SEARCH'] = true;
217  }
218  if ( !isset( $sidebar['TOOLBOX'] ) ) {
219  $sidebar['TOOLBOX'] = true;
220  }
221  if ( !isset( $sidebar['LANGUAGES'] ) ) {
222  $sidebar['LANGUAGES'] = true;
223  }
224 
225  foreach ( $sidebar as $boxName => $content ) {
226  if ( $content === false ) {
227  continue;
228  }
229 
230  // Numeric strings gets an integer when set as key, cast back - T73639
231  $boxName = (string)$boxName;
232 
233  if ( $boxName == 'SEARCH' ) {
234  $this->searchBox();
235  } elseif ( $boxName == 'TOOLBOX' ) {
236  $this->toolbox();
237  } elseif ( $boxName == 'LANGUAGES' ) {
238  $this->languageBox();
239  } else {
240  $this->customBox( $boxName, $content );
241  }
242  }
243  }
244 
245  function searchBox() {
246  ?>
247  <div id="p-search" class="portlet" role="search">
248  <h3><label for="searchInput"><?php $this->msg( 'search' ) ?></label></h3>
249 
250  <div id="searchBody" class="pBody">
251  <form action="<?php $this->text( 'wgScript' ) ?>" id="searchform">
252  <input type="hidden" name="title" value="<?php $this->text( 'searchtitle' ) ?>"/>
253  <?php echo $this->makeSearchInput( [ 'id' => 'searchInput' ] ); ?>
254 
255  <?php
256  echo $this->makeSearchButton(
257  'go',
258  [ 'id' => 'searchGoButton', 'class' => 'searchButton' ]
259  );
260 
261  if ( $this->config->get( 'UseTwoButtonsSearchForm' ) ) {
262  ?>&#160;
263  <?php echo $this->makeSearchButton(
264  'fulltext',
265  [ 'id' => 'mw-searchButton', 'class' => 'searchButton' ]
266  );
267  } else {
268  ?>
269 
270  <div><a href="<?php
271  $this->text( 'searchaction' )
272  ?>" rel="search"><?php $this->msg( 'powersearch-legend' ) ?></a></div><?php
273  } ?>
274 
275  </form>
276 
277  <?php $this->renderAfterPortlet( 'search' ); ?>
278  </div>
279  </div>
280  <?php
281  }
282 
287  function cactions() {
288  ?>
289  <div id="p-cactions" class="portlet" role="navigation">
290  <h3><?php $this->msg( 'views' ) ?></h3>
291 
292  <div class="pBody">
293  <ul><?php
294  foreach ( $this->data['content_actions'] as $key => $tab ) {
295  echo '
296  ' . $this->makeListItem( $key, $tab );
297  } ?>
298 
299  </ul>
300  <?php $this->renderAfterPortlet( 'cactions' ); ?>
301  </div>
302  </div>
303  <?php
304  }
305 
306  function toolbox() {
307  ?>
308  <div class="portlet" id="p-tb" role="navigation">
309  <h3><?php $this->msg( 'toolbox' ) ?></h3>
310 
311  <div class="pBody">
312  <ul>
313  <?php
314  foreach ( $this->getToolbox() as $key => $tbitem ) {
315  ?>
316  <?php echo $this->makeListItem( $key, $tbitem ); ?>
317 
318  <?php
319  }
320  // Avoid PHP 7.1 warnings
321  $skin = $this;
322  Hooks::run( 'MonoBookTemplateToolboxEnd', [ &$skin ] );
323  Hooks::run( 'SkinTemplateToolboxEnd', [ &$skin, true ] );
324  ?>
325  </ul>
326  <?php $this->renderAfterPortlet( 'tb' ); ?>
327  </div>
328  </div>
329  <?php
330  Hooks::run( 'MonoBookAfterToolbox' );
331  }
332 
333  function languageBox() {
334  if ( $this->data['language_urls'] !== false ) {
335  ?>
336  <div id="p-lang" class="portlet" role="navigation">
337  <h3<?php $this->html( 'userlangattributes' ) ?>><?php $this->msg( 'otherlanguages' ) ?></h3>
338 
339  <div class="pBody">
340  <ul>
341  <?php foreach ( $this->data['language_urls'] as $key => $langLink ) { ?>
342  <?php echo $this->makeListItem( $key, $langLink ); ?>
343 
344  <?php
345  }
346  ?>
347  </ul>
348 
349  <?php $this->renderAfterPortlet( 'lang' ); ?>
350  </div>
351  </div>
352  <?php
353  }
354  }
355 
360  function customBox( $bar, $cont ) {
361  $portletAttribs = [
362  'class' => 'generated-sidebar portlet',
363  'id' => Sanitizer::escapeId( "p-$bar" ),
364  'role' => 'navigation'
365  ];
366 
367  $tooltip = Linker::titleAttrib( "p-$bar" );
368  if ( $tooltip !== false ) {
369  $portletAttribs['title'] = $tooltip;
370  }
371  echo ' ' . Html::openElement( 'div', $portletAttribs );
372  $msgObj = wfMessage( $bar );
373  ?>
374 
375  <h3><?php echo htmlspecialchars( $msgObj->exists() ? $msgObj->text() : $bar ); ?></h3>
376  <div class="pBody">
377  <?php
378  if ( is_array( $cont ) ) {
379  ?>
380  <ul>
381  <?php
382  foreach ( $cont as $key => $val ) {
383  ?>
384  <?php echo $this->makeListItem( $key, $val ); ?>
385 
386  <?php
387  }
388  ?>
389  </ul>
390  <?php
391  } else {
392  # allow raw HTML block to be defined by extensions
393  print $cont;
394  }
395 
396  $this->renderAfterPortlet( $bar );
397  ?>
398  </div>
399  </div>
400  <?php
401  }
402 }
BaseTemplate\getPersonalTools
getPersonalTools()
Create an array of personal tools items from the data in the quicktemplate stored by SkinTemplate.
Definition: BaseTemplate.php:131
BaseTemplate\getFooterLinks
getFooterLinks( $option=null)
Returns an array of footerlinks trimmed down to only those footer links that are valid.
Definition: BaseTemplate.php:584
BaseTemplate\msg
msg( $str)
Definition: BaseTemplate.php:39
type
This document describes the state of Postgres support in and is fairly well maintained The main code is very well while extensions are very hit and miss it is probably the most supported database after MySQL Much of the work in making MediaWiki database agnostic came about through the work of creating Postgres as and are nearing end of but without copying over all the usage comments General notes on the but these can almost always be programmed around *Although Postgres has a true BOOLEAN type
Definition: postgres.txt:22
content
per default it will return the text for text based content
Definition: contenthandler.txt:104
BaseTemplate\makeSearchButton
makeSearchButton( $mode, $attrs=[])
Definition: BaseTemplate.php:531
MonoBookTemplate\execute
execute()
Template filter callback for MonoBook skin.
Definition: MonoBookTemplate.php:38
captcha-old.count
count
Definition: captcha-old.py:249
User\groupHasPermission
static groupHasPermission( $group, $role)
Check, if the given group has the given permission.
Definition: User.php:4791
QuickTemplate\getSkin
getSkin()
Get the Skin object related to this object.
Definition: QuickTemplate.php:183
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
MonoBookTemplate\toolbox
toolbox()
Definition: MonoBookTemplate.php:306
Html\closeElement
static closeElement( $element)
Returns "</$element>".
Definition: Html.php:309
MonoBookTemplate\customBox
customBox( $bar, $cont)
Definition: MonoBookTemplate.php:360
a
</source > ! result< div class="mw-highlight mw-content-ltr" dir="ltr">< pre >< span ></span >< span class="kd"> var</span >< span class="nx"> a</span >< span class="p"></span ></pre ></div > ! end ! test Multiline< source/> in lists !input *< source > a b</source > *foo< source > a b</source > ! html< ul >< li >< div class="mw-highlight mw-content-ltr" dir="ltr">< pre > a b</pre ></div ></li ></ul >< ul >< li > foo< div class="mw-highlight mw-content-ltr" dir="ltr">< pre > a b</pre ></div ></li ></ul > ! html tidy< ul >< li >< div class="mw-highlight mw-content-ltr" dir="ltr">< pre > a b</pre ></div ></li ></ul >< ul >< li > foo< div class="mw-highlight mw-content-ltr" dir="ltr">< pre > a b</pre ></div ></li ></ul > ! end ! test Custom attributes !input< source lang="javascript" id="foo" class="bar" dir="rtl" style="font-size: larger;"> var a
Definition: parserTests.txt:89
MonoBookTemplate\renderPortals
renderPortals( $sidebar)
Definition: MonoBookTemplate.php:214
value
$status value
Definition: SyntaxHighlight.class.php:315
BaseTemplate\printTrail
printTrail()
Output getTrail.
Definition: BaseTemplate.php:750
BaseTemplate\makeListItem
makeListItem( $key, $item, $options=[])
Generates a list item for a navigation, portlet, portal, sidebar...
Definition: BaseTemplate.php:474
form
null means default in associative array form
Definition: hooks.txt:1965
BaseTemplate\getIndicators
getIndicators()
Get the suggested HTML for page status indicators: icons (or short text snippets) usually displayed i...
Definition: BaseTemplate.php:731
by
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for and distribution as defined by Sections through of this document Licensor shall mean the copyright owner or entity authorized by the copyright owner that is granting the License Legal Entity shall mean the union of the acting entity and all other entities that control are controlled by or are under common control with that entity For the purposes of this definition control direct or to cause the direction or management of such whether by contract or including but not limited to software source documentation and configuration files Object form shall mean any form resulting from mechanical transformation or translation of a Source including but not limited to compiled object generated and conversions to other media types Work shall mean the work of whether in Source or Object made available under the as indicated by a copyright notice that is included in or attached to the whether in Source or Object that is based or other modifications as a an original work of authorship For the purposes of this Derivative Works shall not include works that remain separable or merely the Work and Derivative Works thereof Contribution shall mean any work of including the original version of the Work and any modifications or additions to that Work or Derivative Works that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner For the purposes of this submitted means any form of or written communication sent to the Licensor or its including but not limited to communication on electronic mailing source code control and issue tracking systems that are managed by
Definition: APACHE-LICENSE-2.0.txt:49
string
This code would result in ircNotify being run twice when an article is and once for brion Hooks can return three possible true was required This is the default since MediaWiki *some string
Definition: hooks.txt:175
captcha-old.action
action
Definition: captcha-old.py:212
BaseTemplate\renderAfterPortlet
renderAfterPortlet( $name)
Definition: BaseTemplate.php:289
MonoBookTemplate\$personalTools
$this msg('personaltools') $this html('userlangattributes') $personalTools
Definition: MonoBookTemplate.php:120
BaseTemplate\getMsg
getMsg( $name)
Get a Message object with its context set.
Definition: BaseTemplate.php:35
Linker\tooltipAndAccesskeyAttribs
static tooltipAndAccesskeyAttribs( $name, array $msgParams=[])
Returns the attributes for the tooltip and access key.
Definition: Linker.php:2111
BaseTemplate\makeSearchInput
makeSearchInput( $attrs=[])
Definition: BaseTemplate.php:521
MonoBookTemplate\html
foreach( $validFooterIcons as $blockName=> $footerIcons) foreach( $footerIcons as $icon) if(count( $validFooterLinks) > 0) $this html( $aLink)
Definition: MonoBookTemplate.php:192
MonoBookTemplate
Definition: MonoBookTemplate.php:30
MonoBookTemplate\searchBox
searchBox()
Definition: MonoBookTemplate.php:245
MonoBookTemplate\cactions
cactions()
Prints the content actions (cactions) bar.
Definition: MonoBookTemplate.php:287
Linker\titleAttrib
static titleAttrib( $name, $options=null, array $msgParams=[])
Given the id of an interface element, constructs the appropriate title attribute from the system mess...
Definition: Linker.php:1951
MonoBookTemplate\languageBox
languageBox()
Definition: MonoBookTemplate.php:333
MonoBookTemplate\$validFooterIcons
$validFooterIcons
Definition: MonoBookTemplate.php:160
BaseTemplate\getToolbox
getToolbox()
Create an array of common toolbox items from the data in the quicktemplate stored by SkinTemplate.
Definition: BaseTemplate.php:58
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
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
Html\rawElement
static rawElement( $element, $attribs=[], $contents='')
Returns an HTML element in a string.
Definition: Html.php:209
$skin
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned $skin
Definition: hooks.txt:1965
of
globals txt Globals are evil The original MediaWiki code relied on globals for processing context far too often MediaWiki development since then has been a story of slowly moving context out of global variables and into objects Storing processing context in object member variables allows those objects to be reused in a much more flexible way Consider the elegance of
Definition: globals.txt:10
wfMessage
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 default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message additional optional elements are parameters for the key that are processed with wfMessage() -> params() ->parseAsBlock() - offset Set to overwrite offset parameter in $wgRequest set to '' to unset offset - wrap String Wrap the message in html(usually something like "&lt
name
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at name
Definition: design.txt:12
Html\element
static element( $element, $attribs=[], $contents='')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
Definition: Html.php:231
BaseTemplate\getFooterIcons
getFooterIcons( $option=null)
Returns an array of footer icons filtered down by options relevant to how the skin wishes to display ...
Definition: BaseTemplate.php:624
Hooks\run
static run( $event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
Definition: Hooks.php:203
href
shown</td >< td > a href
Definition: All_system_messages.txt:2667
BaseTemplate
New base template for a skin's template extended from QuickTemplate this class features helper method...
Definition: BaseTemplate.php:26
data
and how to run hooks for an and one after Each event has a preferably in CamelCase For ArticleDelete hook A clump of code and data that should be run when an event happens This can be either a function and a chunk of data
Definition: hooks.txt:6
MonoBookTemplate\$validFooterLinks
$validFooterLinks
Definition: MonoBookTemplate.php:162