MediaWiki  1.29.1
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  <div id="bodyContent" class="mw-body-content">
66  <div id="siteSub"><?php $this->msg( 'tagline' ) ?></div>
67  <div id="contentSub"<?php
68  $this->html( 'userlangattributes' ) ?>><?php $this->html( 'subtitle' )
69  ?></div>
70  <?php if ( $this->data['undelete'] ) { ?>
71  <div id="contentSub2"><?php $this->html( 'undelete' ) ?></div>
72  <?php
73 }
74  ?><?php
75  if ( $this->data['newtalk'] ) {
76  ?>
77  <div class="usermessage"><?php $this->html( 'newtalk' ) ?></div>
78  <?php
79  }
80  ?>
81  <div id="jump-to-nav" class="mw-jump"><?php
82  $this->msg( 'jumpto' )
83  ?> <a href="#column-one"><?php
84  $this->msg( 'jumptonavigation' )
85  ?></a><?php
86  $this->msg( 'comma-separator' )
87  ?><a href="#searchInput"><?php
88  $this->msg( 'jumptosearch' )
89  ?></a></div>
90 
91  <!-- start content -->
92  <?php $this->html( 'bodytext' ) ?>
93  <?php
94  if ( $this->data['catlinks'] ) {
95  $this->html( 'catlinks' );
96  }
97  ?>
98  <!-- end content -->
99  <?php
100  if ( $this->data['dataAfterContent'] ) {
101  $this->html( 'dataAfterContent' );
102  }
103  ?>
104  <div class="visualClear"></div>
105  </div>
106  </div>
107  <?php Hooks::run( 'MonoBookAfterContent' ); ?>
108  </div>
109  <div id="column-one"<?php $this->html( 'userlangattributes' ) ?>>
110  <h2><?php $this->msg( 'navigation-heading' ) ?></h2>
111  <?php $this->cactions(); ?>
112  <div class="portlet" id="p-personal" role="navigation">
113  <h3><?php $this->msg( 'personaltools' ) ?></h3>
114 
115  <div class="pBody">
116  <ul<?php $this->html( 'userlangattributes' ) ?>>
117  <?php
118 
120 
121  if ( array_key_exists( 'uls', $personalTools ) ) {
122  echo $this->makeListItem( 'uls', $personalTools['uls'] );
123  unset( $personalTools['uls'] );
124  }
125 
126  if ( !$this->getSkin()->getUser()->isLoggedIn() &&
127  User::groupHasPermission( '*', 'edit' ) ) {
128 
129  echo Html::rawElement( 'li', array(
130  'id' => 'pt-anonuserpage'
131  ), $this->getMsg( 'notloggedin' )->escaped() );
132  }
133 
134  foreach ( $personalTools as $key => $item ) { ?>
135  <?php echo $this->makeListItem( $key, $item ); ?>
136 
137  <?php
138 }
139  ?>
140  </ul>
141  </div>
142  </div>
143  <div class="portlet" id="p-logo" role="banner">
144  <?php
145  echo Html::element( 'a', array(
146  'href' => $this->data['nav_urls']['mainpage']['href'],
147  'class' => 'mw-wiki-logo',
148  )
150  ); ?>
151 
152  </div>
153  <?php
154  $this->renderPortals( $this->data['sidebar'] );
155  ?>
156  </div><!-- end of the left (by default at least) column -->
157  <div class="visualClear"></div>
158  <?php
159  $validFooterIcons = $this->getFooterIcons( 'icononly' );
160  $validFooterLinks = $this->getFooterLinks( 'flat' ); // Additional footer links
161 
162  if ( count( $validFooterIcons ) + count( $validFooterLinks ) > 0 ) {
163  ?>
164  <div id="footer" role="contentinfo"<?php $this->html( 'userlangattributes' ) ?>>
165  <?php
166  $footerEnd = '</div>';
167  } else {
168  $footerEnd = '';
169  }
170 
171  foreach ( $validFooterIcons as $blockName => $footerIcons ) {
172  ?>
173  <div id="f-<?php echo htmlspecialchars( $blockName ); ?>ico">
174  <?php foreach ( $footerIcons as $icon ) { ?>
175  <?php echo $this->getSkin()->makeFooterIcon( $icon ); ?>
176 
177  <?php
178 }
179  ?>
180  </div>
181  <?php
182  }
183 
184  if ( count( $validFooterLinks ) > 0 ) {
185  ?>
186  <ul id="f-list">
187  <?php
188  foreach ( $validFooterLinks as $aLink ) {
189  ?>
190  <li id="<?php echo $aLink ?>"><?php $this->html( $aLink ) ?></li>
191  <?php
192  }
193  ?>
194  </ul>
195  <?php
196  }
197 
198  echo $footerEnd;
199  ?>
200 
201  </div>
202  <?php
203  $this->printTrail();
204  echo Html::closeElement( 'body' );
205  echo Html::closeElement( 'html' );
206  echo "\n";
207  } // end of execute() method
208 
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( array( 'id' => 'searchInput' ) ); ?>
254 
255  <?php
256  echo $this->makeSearchButton(
257  'go',
258  array( 'id' => 'searchGoButton', 'class' => 'searchButton' )
259  );
260 
261  if ( $this->config->get( 'UseTwoButtonsSearchForm' ) ) {
262  ?>&#160;
263  <?php echo $this->makeSearchButton(
264  'fulltext',
265  array( '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  /*************************************************************************************************/
307  function toolbox() {
308  ?>
309  <div class="portlet" id="p-tb" role="navigation">
310  <h3><?php $this->msg( 'toolbox' ) ?></h3>
311 
312  <div class="pBody">
313  <ul>
314  <?php
315  foreach ( $this->getToolbox() as $key => $tbitem ) {
316  ?>
317  <?php echo $this->makeListItem( $key, $tbitem ); ?>
318 
319  <?php
320  }
321  Hooks::run( 'MonoBookTemplateToolboxEnd', array( &$this ) );
322  Hooks::run( 'SkinTemplateToolboxEnd', array( &$this, true ) );
323  ?>
324  </ul>
325  <?php $this->renderAfterPortlet( 'tb' ); ?>
326  </div>
327  </div>
328  <?php
329  Hooks::run( 'MonoBookAfterToolbox' );
330  }
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 
356  /*************************************************************************************************/
361  function customBox( $bar, $cont ) {
362  $portletAttribs = array(
363  'class' => 'generated-sidebar portlet',
364  'id' => Sanitizer::escapeId( "p-$bar" ),
365  'role' => 'navigation'
366  );
367 
368  $tooltip = Linker::titleAttrib( "p-$bar" );
369  if ( $tooltip !== false ) {
370  $portletAttribs['title'] = $tooltip;
371  }
372  echo ' ' . Html::openElement( 'div', $portletAttribs );
373  $msgObj = wfMessage( $bar );
374  ?>
375 
376  <h3><?php echo htmlspecialchars( $msgObj->exists() ? $msgObj->text() : $bar ); ?></h3>
377  <div class="pBody">
378  <?php
379  if ( is_array( $cont ) ) {
380  ?>
381  <ul>
382  <?php
383  foreach ( $cont as $key => $val ) {
384  ?>
385  <?php echo $this->makeListItem( $key, $val ); ?>
386 
387  <?php
388  }
389  ?>
390  </ul>
391  <?php
392  } else {
393  # allow raw HTML block to be defined by extensions
394  print $cont;
395  }
396 
397  $this->renderAfterPortlet( $bar );
398  ?>
399  </div>
400  </div>
401  <?php
402  }
403 } // end of class
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:585
BaseTemplate\msg
msg( $str)
Definition: BaseTemplate.php:39
content
per default it will return the text for text based content
Definition: contenthandler.txt:104
BaseTemplate\makeSearchButton
makeSearchButton( $mode, $attrs=[])
Definition: BaseTemplate.php:532
MonoBookTemplate\execute
execute()
Template filter callback for MonoBook skin.
Definition: MonoBookTemplate.php:38
captcha-old.count
count
Definition: captcha-old.py:225
User\groupHasPermission
static groupHasPermission( $group, $role)
Check, if the given group has the given permission.
Definition: User.php:4766
QuickTemplate\getSkin
getSkin()
Get the Skin object related to this object.
Definition: QuickTemplate.php:173
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:307
Html\closeElement
static closeElement( $element)
Returns "</$element>".
Definition: Html.php:309
MonoBookTemplate\customBox
customBox( $bar, $cont)
Definition: MonoBookTemplate.php:361
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
$content
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure use sub classes of those in conjunction with the ChangesListSpecialPageStructuredFilters hook This hook can be used to implement filters that do not implement that or custom behavior that is not an individual filter e g Watchlist and Watchlist you will want to construct new ChangesListBooleanFilter or ChangesListStringOptionsFilter objects When constructing you specify which group they belong to You can reuse existing or create your you must register them with $special registerFilterGroup removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content $content
Definition: hooks.txt:1049
BaseTemplate\printTrail
printTrail()
Output getTrail.
Definition: BaseTemplate.php:751
BaseTemplate\makeListItem
makeListItem( $key, $item, $options=[])
Generates a list item for a navigation, portlet, portal, sidebar...
Definition: BaseTemplate.php:474
div
div
Definition: parserTests.txt:6533
form
null means default in associative array form
Definition: hooks.txt:1956
BaseTemplate\getIndicators
getIndicators()
Get the suggested HTML for page status indicators: icons (or short text snippets) usually displayed i...
Definition: BaseTemplate.php:732
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:177
captcha-old.action
action
Definition: captcha-old.py:189
BaseTemplate\renderAfterPortlet
renderAfterPortlet( $name)
Definition: BaseTemplate.php:289
MonoBookTemplate\$personalTools
$this msg('personaltools') $this html('userlangattributes') $personalTools
Definition: MonoBookTemplate.php:119
value
$status value
Definition: SyntaxHighlight_GeSHi.class.php:309
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:2096
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:190
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:1936
MonoBookTemplate\languageBox
languageBox()
Definition: MonoBookTemplate.php:333
MonoBookTemplate\$validFooterIcons
$validFooterIcons
Definition: MonoBookTemplate.php:159
BaseTemplate\getToolbox
getToolbox()
Create an array of common toolbox items from the data in the quicktemplate stored by SkinTemplate.
Definition: BaseTemplate.php:58
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
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
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:625
Hooks\run
static run( $event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
Definition: Hooks.php:131
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
array
the array() calling protocol came about after MediaWiki 1.4rc1.
MonoBookTemplate\$validFooterLinks
$validFooterLinks
Definition: MonoBookTemplate.php:160