MediaWiki  1.23.6
MonoBook.php
Go to the documentation of this file.
1 <?php
28 if ( !defined( 'MEDIAWIKI' ) ) {
29  die( -1 );
30 }
31 
37 class SkinMonoBook extends SkinTemplate {
39  var $skinname = 'monobook', $stylename = 'monobook',
40  $template = 'MonoBookTemplate', $useHeadElement = true;
41 
46  parent::setupSkinUserCss( $out );
47 
48  $out->addModuleStyles( array( 'mediawiki.skinning.interface', 'skins.monobook.styles' ) );
49 
50  // TODO: Migrate all of these
51  $out->addStyle( 'monobook/IE60Fixes.css', 'screen', 'IE 6' );
52  $out->addStyle( 'monobook/IE70Fixes.css', 'screen', 'IE 7' );
53 
54  }
55 }
56 
62 
71  function execute() {
72  // Suppress warnings to prevent notices about missing indexes in $this->data
74 
75  $this->html( 'headelement' );
76 ?><div id="globalWrapper">
77 <div id="column-content"><div id="content" class="mw-body-primary" role="main">
78  <a id="top"></a>
79  <?php if ( $this->data['sitenotice'] ) { ?><div id="siteNotice"><?php $this->html( 'sitenotice' ) ?></div><?php } ?>
80 
81  <h1 id="firstHeading" class="firstHeading" lang="<?php
82  $this->data['pageLanguage'] = $this->getSkin()->getTitle()->getPageViewLanguage()->getHtmlCode();
83  $this->text( 'pageLanguage' );
84  ?>"><span dir="auto"><?php $this->html( 'title' ) ?></span></h1>
85  <div id="bodyContent" class="mw-body">
86  <div id="siteSub"><?php $this->msg( 'tagline' ) ?></div>
87  <div id="contentSub"<?php $this->html( 'userlangattributes' ) ?>><?php $this->html( 'subtitle' ) ?></div>
88 <?php if ( $this->data['undelete'] ) { ?>
89  <div id="contentSub2"><?php $this->html( 'undelete' ) ?></div>
90 <?php } ?><?php if ( $this->data['newtalk'] ) { ?>
91  <div class="usermessage"><?php $this->html( 'newtalk' ) ?></div>
92 <?php } ?>
93  <div id="jump-to-nav" class="mw-jump"><?php $this->msg( 'jumpto' ) ?> <a href="#column-one"><?php $this->msg( 'jumptonavigation' ) ?></a><?php $this->msg( 'comma-separator' ) ?><a href="#searchInput"><?php $this->msg( 'jumptosearch' ) ?></a></div>
94 
95  <!-- start content -->
96 <?php $this->html( 'bodytext' ) ?>
97  <?php if ( $this->data['catlinks'] ) { $this->html( 'catlinks' ); } ?>
98  <!-- end content -->
99  <?php if ( $this->data['dataAfterContent'] ) { $this->html( 'dataAfterContent' ); } ?>
100  <div class="visualClear"></div>
101  </div>
102 </div></div>
103 <div id="column-one"<?php $this->html( 'userlangattributes' ) ?>>
104  <h2><?php $this->msg( 'navigation-heading' ) ?></h2>
105 <?php $this->cactions(); ?>
106  <div class="portlet" id="p-personal" role="navigation">
107  <h3><?php $this->msg( 'personaltools' ) ?></h3>
108  <div class="pBody">
109  <ul<?php $this->html( 'userlangattributes' ) ?>>
110 <?php foreach ( $this->getPersonalTools() as $key => $item ) { ?>
111  <?php echo $this->makeListItem( $key, $item ); ?>
112 
113 <?php } ?>
114  </ul>
115  </div>
116  </div>
117  <div class="portlet" id="p-logo" role="banner">
118 <?php
119  echo Html::element( 'a', array(
120  'href' => $this->data['nav_urls']['mainpage']['href'],
121  'style' => "background-image: url({$this->data['logopath']});" )
122  + Linker::tooltipAndAccesskeyAttribs( 'p-logo' ) ); ?>
123 
124  </div>
125 <?php
126  $this->renderPortals( $this->data['sidebar'] );
127 ?>
128 </div><!-- end of the left (by default at least) column -->
129 <div class="visualClear"></div>
130 <?php
131  $validFooterIcons = $this->getFooterIcons( "icononly" );
132  $validFooterLinks = $this->getFooterLinks( "flat" ); // Additional footer links
133 
134  if ( count( $validFooterIcons ) + count( $validFooterLinks ) > 0 ) { ?>
135 <div id="footer" role="contentinfo"<?php $this->html( 'userlangattributes' ) ?>>
136 <?php
137  $footerEnd = '</div>';
138  } else {
139  $footerEnd = '';
140  }
141  foreach ( $validFooterIcons as $blockName => $footerIcons ) { ?>
142  <div id="f-<?php echo htmlspecialchars( $blockName ); ?>ico">
143 <?php foreach ( $footerIcons as $icon ) { ?>
144  <?php echo $this->getSkin()->makeFooterIcon( $icon ); ?>
145 
146 <?php }
147 ?>
148  </div>
149 <?php }
150 
151  if ( count( $validFooterLinks ) > 0 ) {
152 ?> <ul id="f-list">
153 <?php
154  foreach ( $validFooterLinks as $aLink ) { ?>
155  <li id="<?php echo $aLink ?>"><?php $this->html( $aLink ) ?></li>
156 <?php
157  }
158 ?>
159  </ul>
160 <?php }
161 echo $footerEnd;
162 ?>
163 
164 </div>
165 <?php
166  $this->printTrail();
167  echo Html::closeElement( 'body' );
168  echo Html::closeElement( 'html' );
170  } // end of execute() method
171 
172  /*************************************************************************************************/
173 
177  protected function renderPortals( $sidebar ) {
178  if ( !isset( $sidebar['SEARCH'] ) ) {
179  $sidebar['SEARCH'] = true;
180  }
181  if ( !isset( $sidebar['TOOLBOX'] ) ) {
182  $sidebar['TOOLBOX'] = true;
183  }
184  if ( !isset( $sidebar['LANGUAGES'] ) ) {
185  $sidebar['LANGUAGES'] = true;
186  }
187 
188  foreach ( $sidebar as $boxName => $content ) {
189  if ( $content === false ) {
190  continue;
191  }
192 
193  if ( $boxName == 'SEARCH' ) {
194  $this->searchBox();
195  } elseif ( $boxName == 'TOOLBOX' ) {
196  $this->toolbox();
197  } elseif ( $boxName == 'LANGUAGES' ) {
198  $this->languageBox();
199  } else {
200  $this->customBox( $boxName, $content );
201  }
202  }
203  }
204 
205  function searchBox() {
206  global $wgUseTwoButtonsSearchForm;
207 ?>
208  <div id="p-search" class="portlet" role="search">
209  <h3><label for="searchInput"><?php $this->msg( 'search' ) ?></label></h3>
210  <div id="searchBody" class="pBody">
211  <form action="<?php $this->text( 'wgScript' ) ?>" id="searchform">
212  <input type='hidden' name="title" value="<?php $this->text( 'searchtitle' ) ?>"/>
213  <?php echo $this->makeSearchInput( array( "id" => "searchInput" ) ); ?>
214 
215  <?php echo $this->makeSearchButton( "go", array( "id" => "searchGoButton", "class" => "searchButton" ) );
216  if ( $wgUseTwoButtonsSearchForm ) { ?>&#160;
217  <?php echo $this->makeSearchButton( "fulltext", array( "id" => "mw-searchButton", "class" => "searchButton" ) );
218  } else { ?>
219 
220  <div><a href="<?php $this->text( 'searchaction' ) ?>" rel="search"><?php $this->msg( 'powersearch-legend' ) ?></a></div><?php
221  } ?>
222 
223  </form>
224 
225  <?php $this->renderAfterPortlet( 'search' ); ?>
226  </div>
227  </div>
228 <?php
229  }
230 
235  function cactions() {
236 ?>
237  <div id="p-cactions" class="portlet" role="navigation">
238  <h3><?php $this->msg( 'views' ) ?></h3>
239  <div class="pBody">
240  <ul><?php
241  foreach ( $this->data['content_actions'] as $key => $tab ) {
242  echo '
243  ' . $this->makeListItem( $key, $tab );
244  } ?>
245 
246  </ul>
247 <?php $this->renderAfterPortlet( 'cactions' ); ?>
248  </div>
249  </div>
250 <?php
251  }
252  /*************************************************************************************************/
253  function toolbox() {
254 ?>
255  <div class="portlet" id="p-tb" role="navigation">
256  <h3><?php $this->msg( 'toolbox' ) ?></h3>
257  <div class="pBody">
258  <ul>
259 <?php
260  foreach ( $this->getToolbox() as $key => $tbitem ) { ?>
261  <?php echo $this->makeListItem( $key, $tbitem ); ?>
262 
263 <?php
264  }
265  wfRunHooks( 'MonoBookTemplateToolboxEnd', array( &$this ) );
266  wfRunHooks( 'SkinTemplateToolboxEnd', array( &$this, true ) );
267 ?>
268  </ul>
269 <?php $this->renderAfterPortlet( 'tb' ); ?>
270  </div>
271  </div>
272 <?php
273  }
274 
275  /*************************************************************************************************/
276  function languageBox() {
277  if ( $this->data['language_urls'] !== false ) {
278 ?>
279  <div id="p-lang" class="portlet" role="navigation">
280  <h3<?php $this->html( 'userlangattributes' ) ?>><?php $this->msg( 'otherlanguages' ) ?></h3>
281  <div class="pBody">
282  <ul>
283 <?php foreach ( $this->data['language_urls'] as $key => $langlink ) { ?>
284  <?php echo $this->makeListItem( $key, $langlink ); ?>
285 
286 <?php } ?>
287  </ul>
288 
289 <?php $this->renderAfterPortlet( 'lang' ); ?>
290  </div>
291  </div>
292 <?php
293  }
294  }
295 
296  /*************************************************************************************************/
301  function customBox( $bar, $cont ) {
302  $portletAttribs = array( 'class' => 'generated-sidebar portlet', 'id' => Sanitizer::escapeId( "p-$bar" ), 'role' => 'navigation' );
303  $tooltip = Linker::titleAttrib( "p-$bar" );
304  if ( $tooltip !== false ) {
305  $portletAttribs['title'] = $tooltip;
306  }
307  echo ' ' . Html::openElement( 'div', $portletAttribs );
308  $msgObj = wfMessage( $bar );
309 ?>
310 
311  <h3><?php echo htmlspecialchars( $msgObj->exists() ? $msgObj->text() : $bar ); ?></h3>
312  <div class='pBody'>
313 <?php if ( is_array( $cont ) ) { ?>
314  <ul>
315 <?php foreach ( $cont as $key => $val ) { ?>
316  <?php echo $this->makeListItem( $key, $val ); ?>
317 
318 <?php } ?>
319  </ul>
320 <?php } else {
321  # allow raw HTML block to be defined by extensions
322  print $cont;
323  }
324 
325  $this->renderAfterPortlet( $bar );
326 ?>
327  </div>
328  </div>
329 <?php
330  }
331 
332 } // end of class
BaseTemplate\getPersonalTools
getPersonalTools()
Create an array of personal tools items from the data in the quicktemplate stored by SkinTemplate.
Definition: SkinTemplate.php:1610
BaseTemplate\getFooterLinks
getFooterLinks( $option=null)
Returns an array of footerlinks trimmed down to only those footer links that are valid.
Definition: SkinTemplate.php:2009
BaseTemplate\makeSearchInput
makeSearchInput( $attrs=array())
Definition: SkinTemplate.php:1946
BaseTemplate\msg
msg( $str)
Definition: SkinTemplate.php:1524
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
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
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
BaseTemplate\makeListItem
makeListItem( $key, $item, $options=array())
Generates a list item for a navigation, portlet, portal, sidebar...
Definition: SkinTemplate.php:1905
content
per default it will return the text for text based content
Definition: contenthandler.txt:107
SkinMonoBook
Inherit main code from SkinTemplate, set the CSS and template filter.
Definition: MonoBook.php:37
MonoBookTemplate\execute
execute()
Template filter callback for MonoBook skin.
Definition: MonoBook.php:71
SkinMonoBook\$template
$template
Definition: MonoBook.php:40
wfSuppressWarnings
wfSuppressWarnings( $end=false)
Reference-counted warning suppression.
Definition: GlobalFunctions.php:2387
QuickTemplate\getSkin
getSkin()
Get the Skin object related to this object.
Definition: SkinTemplate.php:1488
MonoBookTemplate\toolbox
toolbox()
Definition: MonoBook.php:253
SkinMonoBook\$skinname
$skinname
Using monobook.
Definition: MonoBook.php:39
Html\closeElement
static closeElement( $element)
Returns "</$element>", except if $wgWellFormedXml is off, in which case it returns the empty string w...
Definition: Html.php:235
Linker\tooltipAndAccesskeyAttribs
static tooltipAndAccesskeyAttribs( $name)
Returns the attributes for the tooltip and access key.
Definition: Linker.php:2298
Html\openElement
static openElement( $element, $attribs=array())
Identical to rawElement(), but has no third parameter and omits the end tag (and the self-closing '/'...
Definition: Html.php:166
MonoBookTemplate\customBox
customBox( $bar, $cont)
Definition: MonoBook.php:301
$out
$out
Definition: UtfNormalGenerate.php:167
wfRestoreWarnings
wfRestoreWarnings()
Restore error level to previous value.
Definition: GlobalFunctions.php:2417
Html\element
static element( $element, $attribs=array(), $contents='')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
Definition: Html.php:148
MonoBookTemplate\renderPortals
renderPortals( $sidebar)
Definition: MonoBook.php:177
wfMessage
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 and may include noclasses after processing after in associative array form externallinks including delete and has completed for all link tables 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
BaseTemplate\printTrail
printTrail()
Output the basic end-page trail including bottomscripts, reporttime, and debug stuff.
Definition: SkinTemplate.php:2082
wfRunHooks
wfRunHooks( $event, array $args=array(), $deprecatedVersion=null)
Call hook functions defined in $wgHooks.
Definition: GlobalFunctions.php:4010
array
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
global
when a variable name is used in a it is silently declared as a new masking the global
Definition: design.txt:93
form
null means default in associative array form
Definition: hooks.txt:1530
SkinMonoBook\setupSkinUserCss
setupSkinUserCss(OutputPage $out)
Definition: MonoBook.php:45
OutputPage
This class should be covered by a general architecture document which does not exist as of January 20...
Definition: OutputPage.php:38
Sanitizer\escapeId
static escapeId( $id, $options=array())
Given a value, escape it so that it can be used in an id attribute and return it.
Definition: Sanitizer.php:1099
BaseTemplate\renderAfterPortlet
renderAfterPortlet( $name)
Definition: SkinTemplate.php:1766
action
action
Definition: parserTests.txt:378
SkinMonoBook\$useHeadElement
$useHeadElement
Definition: MonoBook.php:40
MonoBookTemplate\html
foreach( $validFooterIcons as $blockName=> $footerIcons) foreach( $footerIcons as $icon) if(count( $validFooterLinks) > 0) $this html( $aLink)
Definition: MonoBook.php:155
BaseTemplate\makeSearchButton
makeSearchButton( $mode, $attrs=array())
Definition: SkinTemplate.php:1957
MonoBookTemplate
Definition: MonoBook.php:61
MonoBookTemplate\searchBox
searchBox()
Definition: MonoBook.php:205
MonoBookTemplate\cactions
cactions()
Prints the cactions bar.
Definition: MonoBook.php:235
start
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to start
Definition: skin.txt:62
MonoBookTemplate\languageBox
languageBox()
Definition: MonoBook.php:276
MonoBookTemplate\$validFooterIcons
$validFooterIcons
Definition: MonoBook.php:131
BaseTemplate\getToolbox
getToolbox()
Create an array of common toolbox items from the data in the quicktemplate stored by SkinTemplate.
Definition: SkinTemplate.php:1543
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
Linker\titleAttrib
static titleAttrib( $name, $options=null)
Given the id of an interface element, constructs the appropriate title attribute from the system mess...
Definition: Linker.php:2072
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
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
BaseTemplate\getFooterIcons
getFooterIcons( $option=null)
Returns an array of footer icons filtered down by options relevant to how the skin wishes to display ...
Definition: SkinTemplate.php:2048
SkinMonoBook\$stylename
$stylename
Definition: MonoBook.php:39
href
shown</td >< td > a href
Definition: All_system_messages.txt:2674
BaseTemplate
New base template for a skin's template extended from QuickTemplate this class features helper method...
Definition: SkinTemplate.php:1512
SkinTemplate
Template-filler skin base class Formerly generic PHPTal (http://phptal.sourceforge....
Definition: SkinTemplate.php:70
MonoBookTemplate\$validFooterLinks
$validFooterLinks
Definition: MonoBook.php:132