[ Index ] |
PHP Cross Reference of MediaWiki-1.24.0 |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * MonoBook nouveau. 4 * 5 * Translated from gwicke's previous TAL template version to remove 6 * dependency on PHPTAL. 7 * 8 * This program is free software; you can redistribute it and/or modify 9 * it under the terms of the GNU General Public License as published by 10 * the Free Software Foundation; either version 2 of the License, or 11 * (at your option) any later version. 12 * 13 * This program is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 * 18 * You should have received a copy of the GNU General Public License along 19 * with this program; if not, write to the Free Software Foundation, Inc., 20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 21 * http://www.gnu.org/copyleft/gpl.html 22 * 23 * @file 24 * @ingroup Skins 25 */ 26 27 /** 28 * @ingroup Skins 29 */ 30 class MonoBookTemplate extends BaseTemplate { 31 32 /** 33 * Template filter callback for MonoBook skin. 34 * Takes an associative array of data set from a SkinTemplate-based 35 * class, and a wrapper for MediaWiki's localization database, and 36 * outputs a formatted page. 37 * 38 * @access private 39 */ 40 function execute() { 41 // Suppress warnings to prevent notices about missing indexes in $this->data 42 wfSuppressWarnings(); 43 44 $this->html( 'headelement' ); 45 ?><div id="globalWrapper"> 46 <div id="column-content"> 47 <div id="content" class="mw-body" role="main"> 48 <a id="top"></a> 49 <?php 50 if ( $this->data['sitenotice'] ) { 51 ?> 52 <div id="siteNotice"><?php 53 $this->html( 'sitenotice' ) 54 ?></div><?php 55 } 56 ?> 57 58 <h1 id="firstHeading" class="firstHeading" lang="<?php 59 $this->data['pageLanguage'] = 60 $this->getSkin()->getTitle()->getPageViewLanguage()->getHtmlCode(); 61 $this->text( 'pageLanguage' ); 62 ?>"><span dir="auto"><?php $this->html( 'title' ) ?></span></h1> 63 64 <div id="bodyContent" class="mw-body-content"> 65 <div id="siteSub"><?php $this->msg( 'tagline' ) ?></div> 66 <div id="contentSub"<?php 67 $this->html( 'userlangattributes' ) ?>><?php $this->html( 'subtitle' ) 68 ?></div> 69 <?php if ( $this->data['undelete'] ) { ?> 70 <div id="contentSub2"><?php $this->html( 'undelete' ) ?></div> 71 <?php 72 } 73 ?><?php 74 if ( $this->data['newtalk'] ) { 75 ?> 76 <div class="usermessage"><?php $this->html( 'newtalk' ) ?></div> 77 <?php 78 } 79 ?> 80 <div id="jump-to-nav" class="mw-jump"><?php 81 $this->msg( 'jumpto' ) 82 ?> <a href="#column-one"><?php 83 $this->msg( 'jumptonavigation' ) 84 ?></a><?php 85 $this->msg( 'comma-separator' ) 86 ?><a href="#searchInput"><?php 87 $this->msg( 'jumptosearch' ) 88 ?></a></div> 89 90 <!-- start content --> 91 <?php $this->html( 'bodytext' ) ?> 92 <?php 93 if ( $this->data['catlinks'] ) { 94 $this->html( 'catlinks' ); 95 } 96 ?> 97 <!-- end content --> 98 <?php 99 if ( $this->data['dataAfterContent'] ) { 100 $this->html( 'dataAfterContent' 101 ); 102 } 103 ?> 104 <div class="visualClear"></div> 105 </div> 106 </div> 107 </div> 108 <div id="column-one"<?php $this->html( 'userlangattributes' ) ?>> 109 <h2><?php $this->msg( 'navigation-heading' ) ?></h2> 110 <?php $this->cactions(); ?> 111 <div class="portlet" id="p-personal" role="navigation"> 112 <h3><?php $this->msg( 'personaltools' ) ?></h3> 113 114 <div class="pBody"> 115 <ul<?php $this->html( 'userlangattributes' ) ?>> 116 <?php foreach ( $this->getPersonalTools() as $key => $item ) { ?> 117 <?php echo $this->makeListItem( $key, $item ); ?> 118 119 <?php 120 } 121 ?> 122 </ul> 123 </div> 124 </div> 125 <div class="portlet" id="p-logo" role="banner"> 126 <?php 127 echo Html::element( 'a', array( 128 'href' => $this->data['nav_urls']['mainpage']['href'], 129 'style' => "background-image: url({$this->data['logopath']});" ) 130 + Linker::tooltipAndAccesskeyAttribs( 'p-logo' ) ); ?> 131 132 </div> 133 <?php 134 $this->renderPortals( $this->data['sidebar'] ); 135 ?> 136 </div><!-- end of the left (by default at least) column --> 137 <div class="visualClear"></div> 138 <?php 139 $validFooterIcons = $this->getFooterIcons( "icononly" ); 140 $validFooterLinks = $this->getFooterLinks( "flat" ); // Additional footer links 141 142 if ( count( $validFooterIcons ) + count( $validFooterLinks ) > 0 ) { 143 ?> 144 <div id="footer" role="contentinfo"<?php $this->html( 'userlangattributes' ) ?>> 145 <?php 146 $footerEnd = '</div>'; 147 } else { 148 $footerEnd = ''; 149 } 150 151 foreach ( $validFooterIcons as $blockName => $footerIcons ) { 152 ?> 153 <div id="f-<?php echo htmlspecialchars( $blockName ); ?>ico"> 154 <?php foreach ( $footerIcons as $icon ) { ?> 155 <?php echo $this->getSkin()->makeFooterIcon( $icon ); ?> 156 157 <?php 158 } 159 ?> 160 </div> 161 <?php 162 } 163 164 if ( count( $validFooterLinks ) > 0 ) { 165 ?> 166 <ul id="f-list"> 167 <?php 168 foreach ( $validFooterLinks as $aLink ) { 169 ?> 170 <li id="<?php echo $aLink ?>"><?php $this->html( $aLink ) ?></li> 171 <?php 172 } 173 ?> 174 </ul> 175 <?php 176 } 177 178 echo $footerEnd; 179 ?> 180 181 </div> 182 <?php 183 $this->printTrail(); 184 echo Html::closeElement( 'body' ); 185 echo Html::closeElement( 'html' ); 186 wfRestoreWarnings(); 187 } // end of execute() method 188 189 /*************************************************************************************************/ 190 191 /** 192 * @param array $sidebar 193 */ 194 protected function renderPortals( $sidebar ) { 195 if ( !isset( $sidebar['SEARCH'] ) ) { 196 $sidebar['SEARCH'] = true; 197 } 198 if ( !isset( $sidebar['TOOLBOX'] ) ) { 199 $sidebar['TOOLBOX'] = true; 200 } 201 if ( !isset( $sidebar['LANGUAGES'] ) ) { 202 $sidebar['LANGUAGES'] = true; 203 } 204 205 foreach ( $sidebar as $boxName => $content ) { 206 if ( $content === false ) { 207 continue; 208 } 209 210 if ( $boxName == 'SEARCH' ) { 211 $this->searchBox(); 212 } elseif ( $boxName == 'TOOLBOX' ) { 213 $this->toolbox(); 214 } elseif ( $boxName == 'LANGUAGES' ) { 215 $this->languageBox(); 216 } else { 217 $this->customBox( $boxName, $content ); 218 } 219 } 220 } 221 222 function searchBox() { 223 ?> 224 <div id="p-search" class="portlet" role="search"> 225 <h3><label for="searchInput"><?php $this->msg( 'search' ) ?></label></h3> 226 227 <div id="searchBody" class="pBody"> 228 <form action="<?php $this->text( 'wgScript' ) ?>" id="searchform"> 229 <input type='hidden' name="title" value="<?php $this->text( 'searchtitle' ) ?>"/> 230 <?php echo $this->makeSearchInput( array( "id" => "searchInput" ) ); ?> 231 232 <?php 233 echo $this->makeSearchButton( 234 "go", 235 array( "id" => "searchGoButton", "class" => "searchButton" ) 236 ); 237 238 if ( $this->config->get( 'UseTwoButtonsSearchForm' ) ) { 239 ?>  240 <?php echo $this->makeSearchButton( 241 "fulltext", 242 array( "id" => "mw-searchButton", "class" => "searchButton" ) 243 ); 244 } else { 245 ?> 246 247 <div><a href="<?php 248 $this->text( 'searchaction' ) 249 ?>" rel="search"><?php $this->msg( 'powersearch-legend' ) ?></a></div><?php 250 } ?> 251 252 </form> 253 254 <?php $this->renderAfterPortlet( 'search' ); ?> 255 </div> 256 </div> 257 <?php 258 } 259 260 /** 261 * Prints the cactions bar. 262 * Shared between MonoBook and Modern 263 */ 264 function cactions() { 265 ?> 266 <div id="p-cactions" class="portlet" role="navigation"> 267 <h3><?php $this->msg( 'views' ) ?></h3> 268 269 <div class="pBody"> 270 <ul><?php 271 foreach ( $this->data['content_actions'] as $key => $tab ) { 272 echo ' 273 ' . $this->makeListItem( $key, $tab ); 274 } ?> 275 276 </ul> 277 <?php $this->renderAfterPortlet( 'cactions' ); ?> 278 </div> 279 </div> 280 <?php 281 } 282 283 /*************************************************************************************************/ 284 function toolbox() { 285 ?> 286 <div class="portlet" id="p-tb" role="navigation"> 287 <h3><?php $this->msg( 'toolbox' ) ?></h3> 288 289 <div class="pBody"> 290 <ul> 291 <?php 292 foreach ( $this->getToolbox() as $key => $tbitem ) { 293 ?> 294 <?php echo $this->makeListItem( $key, $tbitem ); ?> 295 296 <?php 297 } 298 wfRunHooks( 'MonoBookTemplateToolboxEnd', array( &$this ) ); 299 wfRunHooks( 'SkinTemplateToolboxEnd', array( &$this, true ) ); 300 ?> 301 </ul> 302 <?php $this->renderAfterPortlet( 'tb' ); ?> 303 </div> 304 </div> 305 <?php 306 } 307 308 /*************************************************************************************************/ 309 function languageBox() { 310 if ( $this->data['language_urls'] !== false ) { 311 ?> 312 <div id="p-lang" class="portlet" role="navigation"> 313 <h3<?php $this->html( 'userlangattributes' ) ?>><?php $this->msg( 'otherlanguages' ) ?></h3> 314 315 <div class="pBody"> 316 <ul> 317 <?php foreach ( $this->data['language_urls'] as $key => $langlink ) { ?> 318 <?php echo $this->makeListItem( $key, $langlink ); ?> 319 320 <?php 321 } 322 ?> 323 </ul> 324 325 <?php $this->renderAfterPortlet( 'lang' ); ?> 326 </div> 327 </div> 328 <?php 329 } 330 } 331 332 /*************************************************************************************************/ 333 /** 334 * @param string $bar 335 * @param array|string $cont 336 */ 337 function customBox( $bar, $cont ) { 338 $portletAttribs = array( 339 'class' => 'generated-sidebar portlet', 340 'id' => Sanitizer::escapeId( "p-$bar" ), 341 'role' => 'navigation' 342 ); 343 344 $tooltip = Linker::titleAttrib( "p-$bar" ); 345 if ( $tooltip !== false ) { 346 $portletAttribs['title'] = $tooltip; 347 } 348 echo ' ' . Html::openElement( 'div', $portletAttribs ); 349 $msgObj = wfMessage( $bar ); 350 ?> 351 352 <h3><?php echo htmlspecialchars( $msgObj->exists() ? $msgObj->text() : $bar ); ?></h3> 353 <div class='pBody'> 354 <?php 355 if ( is_array( $cont ) ) { 356 ?> 357 <ul> 358 <?php 359 foreach ( $cont as $key => $val ) { 360 ?> 361 <?php echo $this->makeListItem( $key, $val ); ?> 362 363 <?php 364 } 365 ?> 366 </ul> 367 <?php 368 } else { 369 # allow raw HTML block to be defined by extensions 370 print $cont; 371 } 372 373 $this->renderAfterPortlet( $bar ); 374 ?> 375 </div> 376 </div> 377 <?php 378 } 379 } // end of class
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 14:03:12 2014 | Cross-referenced by PHPXref 0.7.1 |