Foreground.skin.php 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. <?php
  2. /**
  3. * Skin file for skin WikiWonders' Foreground
  4. *
  5. * @file
  6. * @ingroup Skins
  7. */
  8. class Skinforeground extends SkinTemplate {
  9. public $skinname = 'foreground', $stylename = 'foreground', $template = 'foregroundTemplate', $useHeadElement = true;
  10. public function setupSkinUserCss(OutputPage $out) {
  11. parent::setupSkinUserCss($out);
  12. $out->addHeadItem('ie-meta', '<meta http-equiv="X-UA-Compatible" content="IE=edge" />');
  13. $out->addModuleStyles('skins.foreground');
  14. }
  15. public function initPage( OutputPage $out ) {
  16. global $wgLocalStylePath;
  17. parent::initPage($out);
  18. $viewport_meta = 'width=device-width, user-scalable=yes, initial-scale=1.0';
  19. $out->addMeta('viewport', $viewport_meta);
  20. $out->addModuleScripts('skins.foreground');
  21. }
  22. }
  23. class foregroundTemplate extends BaseTemplate {
  24. public function execute() {
  25. global $wgUser;
  26. global $wgForegroundFeatures;
  27. wfSuppressWarnings();
  28. $this->html('headelement');
  29. $wgForegroundFeaturesDefaults = array(
  30. 'showActionsForAnon' => true,
  31. 'makeNavFixed' => false,
  32. );
  33. foreach ($wgForegroundFeaturesDefaults as $fgOption => $fgOptionValue) {
  34. if ( !isset($wgForegroundFeatures[$fgOption]) ) {
  35. $wgForegroundFeatures[$fgOption] = $fgOptionValue;
  36. }
  37. }
  38. if ($wgForegroundFeatures['makeNavFixed']) echo "<div class='fixed'>";
  39. ?>
  40. <!-- START FOREGROUNDTEMPLATE -->
  41. <nav class="top-bar">
  42. <ul class="title-area">
  43. <li class="name"><h1><a href="<?php echo $this->data['nav_urls']['mainpage']['href']; ?>"><?php echo $this->text('sitename'); ?></a></h1></li>
  44. <li class="toggle-topbar menu-icon"><a href="#"><span>Menu</span></a></li>
  45. </ul>
  46. <section class="top-bar-section">
  47. <ul id="top-bar-left" class="left">
  48. <li class="divider"></li>
  49. <?php foreach ( $this->getSidebar() as $boxName => $box ) { if ( ($box['header'] != wfMessage( 'toolbox' )->text()) ) { ?>
  50. <li class="has-dropdown active" id='<?php echo Sanitizer::escapeId( $box['id'] ) ?>'<?php echo Linker::tooltip( $box['id'] ) ?>>
  51. <a href="#"><?php echo htmlspecialchars( $box['header'] ); ?></a>
  52. <?php if ( is_array( $box['content'] ) ) { ?>
  53. <ul class="dropdown">
  54. <?php foreach ( $box['content'] as $key => $item ) { echo $this->makeListItem( $key, $item ); } ?>
  55. </ul>
  56. <?php } } ?>
  57. </li>
  58. <?php } ?>
  59. </ul>
  60. <ul id="top-bar-right" class="right">
  61. <li class="has-form">
  62. <form action="<?php $this->text( 'wgScript' ); ?>" id="searchform" class="mw-search">
  63. <div class="row collapse">
  64. <div class="small-8 columns">
  65. <?php echo $this->makeSearchInput(array('placeholder' => 'Search...', 'id' => 'searchInput') ); ?>
  66. </div>
  67. <div class="small-4 columns">
  68. <button type="submit" class="button search"><?php echo wfMessage( 'search' )->text() ?></button>
  69. </div>
  70. </div>
  71. </form>
  72. </li>
  73. <li class="divider show-for-small"></li>
  74. <li class="has-form">
  75. <li class="has-dropdown active"><a href="#"><i class="icon-cogs"></i></a>
  76. <ul class="dropdown">
  77. <?php foreach ( $this->getToolbox() as $key => $item ) { echo $this->makeListItem($key, $item); } ?>
  78. <li id="n-recentchanges"><?php echo Linker::specialLink('Recentchanges') ?></li>
  79. <li id="n-help" <?php echo Linker::tooltip('help') ?>><a href="/wiki/Help:Contents"><?php echo wfMessage( 'help' )->text() ?></a></li>
  80. </ul>
  81. </li>
  82. <?php if ($wgUser->isLoggedIn()): ?>
  83. <li id="personal-tools-dropdown" class="has-dropdown active"><a href="#"><i class="icon-user"></i></a>
  84. <ul class="dropdown">
  85. <?php foreach ( $this->getPersonalTools() as $key => $item ) { echo $this->makeListItem($key, $item); } ?>
  86. </ul>
  87. </li>
  88. <?php else: ?>
  89. <li>
  90. <?php if (isset($this->data['personal_urls']['anonlogin'])): ?>
  91. <a href="<?php echo $this->data['personal_urls']['anonlogin']['href']; ?>">Sign In</a>
  92. <?php elseif (isset($this->data['personal_urls']['login'])): ?>
  93. <a href="<?php echo htmlspecialchars($this->data['personal_urls']['login']['href']); ?>"><?php echo wfMessage( 'login' )->text() ?></a>
  94. <?php else: ?>
  95. <?php echo Linker::link(Title::newFromText('Special:UserLogin'), 'Sign In'); ?>
  96. <?php endif; ?>
  97. </li>
  98. <?php endif; ?>
  99. </ul>
  100. </section>
  101. </nav>
  102. <?php if ($wgForegroundFeatures['makeNavFixed']) echo "</div>"; ?>
  103. <div class="row">
  104. <div class="large-12 columns">
  105. <!--[if lt IE 9]>
  106. <div id="siteNotice" class="sitenotice panel radius"><?php echo $this->text('sitename'); ?> may not look as expected in this version of Internet Explorer. We recommend you upgrade to a newer version of Internet Explorer or switch to a browser like Firefox or Chrome.</div>
  107. <![endif]-->
  108. <?php if ( $this->data['sitenotice'] ) { ?><div id="siteNotice" class="sitenotice panel radius"><?php $this->html( 'sitenotice' ); ?></div><?php } ?>
  109. <?php if ( $this->data['newtalk'] ) { ?><div id="usermessage" class="newtalk panel radius"><?php $this->html( 'newtalk' ); ?></div><?php } ?>
  110. </div>
  111. </div>
  112. <div id="mw-js-message" style="display:none;"></div>
  113. <div class="row">
  114. <div id="p-cactions" class="large-12 columns">
  115. <?php if ($wgUser->isLoggedIn() || $wgForegroundFeatures['showActionsForAnon']): ?>
  116. <a href="#" data-dropdown="drop1" class="button dropdown small secondary radius"><i class="icon-cog"><span class="show-for-medium-up">&nbsp;<?php echo wfMessage( 'actions' )->text() ?></span></i></a>
  117. <ul id="drop1" class="views large-12 columns f-dropdown">
  118. <?php foreach( $this->data['content_actions'] as $key => $item ) { echo $this->makeListItem($key, $item); } ?>
  119. <?php wfRunHooks( SkinTemplateToolboxEnd, array( &$this, true ) ); ?>
  120. </ul>
  121. <?php endif;
  122. $namespace = str_replace('_', ' ', $this->getSkin()->getTitle()->getNsText());
  123. $displaytitle = $this->data['title'];
  124. if (!empty($namespace)) {
  125. $pagetitle = $this->getSkin()->getTitle();
  126. $newtitle = str_replace($namespace.':', '', $pagetitle);
  127. $displaytitle = str_replace($pagetitle, $newtitle, $displaytitle);
  128. ?><h4 class="namespace label"><?php print $namespace; ?></h4><?php } ?>
  129. <h2 class="title"><?php print $displaytitle; ?></h2>
  130. <?php if ( $this->data['isarticle'] ) { ?><h3 id="tagline"><?php $this->msg( 'tagline' ) ?></h3><?php } ?>
  131. <h5 class="subtitle"><?php $this->html('subtitle') ?></h5>
  132. <div class="clear_both"></div>
  133. <?php $this->html('bodytext') ?>
  134. <div class="group"><?php $this->html('catlinks'); ?></div>
  135. <?php $this->html('dataAfterContent'); ?>
  136. </div>
  137. </div>
  138. <footer class="row">
  139. <ul class="large-12 columns">
  140. <?php foreach ( $this->getFooterLinks( "flat" ) as $key ) { ?>
  141. <li id="footer-<?php echo $key ?>"><?php $this->html( $key ) ?></li>
  142. <?php } ?>
  143. </ul>
  144. <ul> <?php foreach ( $this->getFooterIcons( "nocopyright" ) as $blockName => $footerIcons ) { ?>
  145. <li class="<?php echo $blockName ?>"><?php foreach ( $footerIcons as $icon ) { ?>
  146. <?php echo $this->getSkin()->makeFooterIcon( $icon, 'withoutImage' ); ?>
  147. <?php } ?>
  148. </li>
  149. <?php } ?>
  150. </ul>
  151. </footer>
  152. <?php $this->printTrail(); ?>
  153. </body>
  154. </html>
  155. <?php
  156. wfRestoreWarnings();
  157. }
  158. }
  159. ?>