Foreground.skin.php 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. <?php
  2. /**
  3. * Skin file for 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. global $wgForegroundFeatures;
  13. $wgForegroundFeaturesDefaults = array(
  14. 'showActionsForAnon' => true,
  15. 'NavWrapperType' => 'divonly',
  16. 'showHelpUnderTools' => true,
  17. 'showRecentChangesUnderTools' => true,
  18. 'wikiName' => &$GLOBALS['wgSitename'],
  19. 'navbarIcon' => false,
  20. 'IeEdgeCode' => 1,
  21. 'showFooterIcons' => 0,
  22. 'addThisFollowPUBID' => ''
  23. );
  24. foreach ($wgForegroundFeaturesDefaults as $fgOption => $fgOptionValue) {
  25. if ( !isset($wgForegroundFeatures[$fgOption]) ) {
  26. $wgForegroundFeatures[$fgOption] = $fgOptionValue;
  27. }
  28. }
  29. switch ($wgForegroundFeatures['IeEdgeCode']) {
  30. case 1:
  31. $out->addHeadItem('ie-meta', '<meta http-equiv="X-UA-Compatible" content="IE=edge" />');
  32. break;
  33. case 2:
  34. if (isset($_SERVER['HTTP_USER_AGENT']) && (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false))
  35. header('X-UA-Compatible: IE=edge');
  36. break;
  37. }
  38. $out->addModuleStyles('skins.foreground');
  39. }
  40. public function initPage( OutputPage $out ) {
  41. global $wgLocalStylePath;
  42. parent::initPage($out);
  43. $viewport_meta = 'width=device-width, user-scalable=yes, initial-scale=1.0';
  44. $out->addMeta('viewport', $viewport_meta);
  45. $out->addModuleScripts('skins.foreground');
  46. }
  47. }
  48. class foregroundTemplate extends BaseTemplate {
  49. public function execute() {
  50. global $wgUser;
  51. global $wgForegroundFeatures;
  52. wfSuppressWarnings();
  53. $this->html('headelement');
  54. switch ($wgForegroundFeatures['NavWrapperType']) {
  55. case '0':
  56. break;
  57. case 'divonly':
  58. echo "<div id='navwrapper'>";
  59. break;
  60. default:
  61. echo "<div id='navwrapper' class='". $wgForegroundFeatures['NavWrapperType']. "'>";
  62. break;
  63. }
  64. switch ($wgForegroundFeatures['showFooterIcons']) {
  65. case '0':
  66. $footerLeftClass = 'small-8 large-centered columns text-center';
  67. $footerRightClass = 'large-12 small-12 columns';
  68. $poweredbyType = "nocopyright";
  69. $poweredbyMakeType = 'withoutImage';
  70. break;
  71. case '1':
  72. $footerLeftClass = 'large-8 small-12 columns';
  73. $footerRightClass = 'large-4 small-12 columns';
  74. $poweredbyType = "icononly";
  75. $poweredbyMakeType = 'withImage';
  76. break;
  77. }
  78. ?>
  79. <!-- START FOREGROUNDTEMPLATE -->
  80. <nav class="top-bar">
  81. <ul class="title-area">
  82. <li class="name">
  83. <h1 class="title-name">
  84. <a href="<?php echo $this->data['nav_urls']['mainpage']['href']; ?>">
  85. <?php if ($wgForegroundFeatures['navbarIcon'] != '0') { ?>
  86. <img alt="<?php echo $this->text('sitename'); ?>" src="<?php echo $this->text('logopath') ?>" style="max-width: 64px;height:auto; max-height:36px; display: inline-block; vertical-align:middle;">
  87. <?php } ?>
  88. <div class="title-name" style="display: inline-block;"><?php echo $wgForegroundFeatures['wikiName']; ?></div>
  89. </a>
  90. </h1>
  91. </li>
  92. <li class="toggle-topbar menu-icon">
  93. <a href="#"><span><?php echo wfMessage( 'foreground-menutitle' )->text(); ?></span></a>
  94. </li>
  95. </ul>
  96. <section class="top-bar-section">
  97. <ul id="top-bar-left" class="left">
  98. <li class="divider"></li>
  99. <?php foreach ( $this->getSidebar() as $boxName => $box ) { if ( ($box['header'] != wfMessage( 'toolbox' )->text()) ) { ?>
  100. <li class="has-dropdown active" id='<?php echo Sanitizer::escapeId( $box['id'] ) ?>'<?php echo Linker::tooltip( $box['id'] ) ?>>
  101. <a href="#"><?php echo htmlspecialchars( $box['header'] ); ?></a>
  102. <?php if ( is_array( $box['content'] ) ) { ?>
  103. <ul class="dropdown">
  104. <?php foreach ( $box['content'] as $key => $item ) { echo $this->makeListItem( $key, $item ); } ?>
  105. </ul>
  106. <?php } } ?>
  107. <?php } ?>
  108. </ul>
  109. <ul id="top-bar-right" class="right">
  110. <li class="has-form">
  111. <form action="<?php $this->text( 'wgScript' ); ?>" id="searchform" class="mw-search">
  112. <div class="row collapse">
  113. <div class="small-8 columns">
  114. <?php echo $this->makeSearchInput(array('placeholder' => wfMessage('searchsuggest-search')->text(), 'id' => 'searchInput') ); ?>
  115. </div>
  116. <div class="small-4 columns">
  117. <button type="submit" class="button search"><?php echo wfMessage( 'search' )->text() ?></button>
  118. </div>
  119. </div>
  120. </form>
  121. </li>
  122. <li class="divider show-for-small"></li>
  123. <li class="has-form">
  124. <li class="has-dropdown active"><a href="#"><i class="fa fa-cogs"></i></a>
  125. <ul id="toolbox-dropdown" class="dropdown">
  126. <?php foreach ( $this->getToolbox() as $key => $item ) { echo $this->makeListItem($key, $item); } ?>
  127. <?php if ($wgForegroundFeatures['showRecentChangesUnderTools']): ?><li id="n-recentchanges"><?php echo Linker::specialLink('Recentchanges') ?></li><?php endif; ?>
  128. <?php if ($wgForegroundFeatures['showHelpUnderTools']): ?><li id="n-help" <?php echo Linker::tooltip('help') ?>><a href="/wiki/Help:Contents"><?php echo wfMessage( 'help' )->text() ?></a></li><?php endif; ?>
  129. </ul>
  130. </li>
  131. <?php if ($wgUser->isLoggedIn()): ?>
  132. <li id="personal-tools-dropdown" class="has-dropdown active"><a href="#"><i class="fa fa-user"></i></a>
  133. <ul class="dropdown">
  134. <?php foreach ( $this->getPersonalTools() as $key => $item ) { echo $this->makeListItem($key, $item); } ?>
  135. </ul>
  136. </li>
  137. <?php else: ?>
  138. <li>
  139. <?php if (isset($this->data['personal_urls']['anonlogin'])): ?>
  140. <a href="<?php echo $this->data['personal_urls']['anonlogin']['href']; ?>"><?php echo wfMessage( 'login' )->text() ?></a>
  141. <?php elseif (isset($this->data['personal_urls']['login'])): ?>
  142. <a href="<?php echo htmlspecialchars($this->data['personal_urls']['login']['href']); ?>"><?php echo wfMessage( 'login' )->text() ?></a>
  143. <?php else: ?>
  144. <?php echo Linker::link(Title::newFromText('Special:UserLogin'), wfMessage( 'login' )->text()); ?>
  145. <?php endif; ?>
  146. </li>
  147. <?php endif; ?>
  148. </ul>
  149. </section>
  150. </nav>
  151. <?php if ($wgForegroundFeatures['NavWrapperType'] != '0') echo "</div>"; ?>
  152. <div id="page-content">
  153. <div class="row">
  154. <div class="large-12 columns">
  155. <!--[if lt IE 9]>
  156. <div id="siteNotice" class="sitenotice panel radius"><?php echo $this->text('sitename') . ' '. wfMessage( 'foreground-browsermsg' )->text(); ?></div>
  157. <![endif]-->
  158. <?php if ( $this->data['sitenotice'] ) { ?><div id="siteNotice" class="sitenotice panel radius"><?php $this->html( 'sitenotice' ); ?></div><?php } ?>
  159. <?php if ( $this->data['newtalk'] ) { ?><div id="usermessage" class="newtalk panel radius"><?php $this->html( 'newtalk' ); ?></div><?php } ?>
  160. </div>
  161. </div>
  162. <div id="mw-js-message" style="display:none;"></div>
  163. <div class="row">
  164. <div id="p-cactions" class="large-12 columns">
  165. <?php if ($wgUser->isLoggedIn() || $wgForegroundFeatures['showActionsForAnon']): ?>
  166. <a href="#" data-dropdown="drop1" class="button dropdown small secondary radius"><i class="fa fa-cog"><span class="show-for-medium-up">&nbsp;<?php echo wfMessage( 'actions' )->text() ?></span></i></a>
  167. <ul id="drop1" class="views large-12 columns f-dropdown">
  168. <?php foreach( $this->data['content_actions'] as $key => $item ) { echo preg_replace(array('/\sprimary="1"/','/\scontext="[a-z]+"/','/\srel="archives"/'),'',$this->makeListItem($key, $item)); } ?>
  169. <?php wfRunHooks( SkinTemplateToolboxEnd, array( &$this, true ) ); ?>
  170. </ul>
  171. <?php if ($wgUser->isLoggedIn()): ?>
  172. <div id="echo-notifications"></div>
  173. <?php endif; ?>
  174. <?php endif;
  175. $namespace = str_replace('_', ' ', $this->getSkin()->getTitle()->getNsText());
  176. $displaytitle = $this->data['title'];
  177. if (!empty($namespace)) {
  178. $pagetitle = $this->getSkin()->getTitle();
  179. $newtitle = str_replace($namespace.':', '', $pagetitle);
  180. $displaytitle = str_replace($pagetitle, $newtitle, $displaytitle);
  181. ?><h4 class="namespace label"><?php print $namespace; ?></h4><?php } ?>
  182. <h2 class="title"><?php print $displaytitle; ?></h2>
  183. <?php if ( $this->data['isarticle'] ) { ?><h3 id="tagline"><?php $this->msg( 'tagline' ) ?></h3><?php } ?>
  184. <h5 class="subtitle"><?php $this->html('subtitle') ?></h5>
  185. <div class="clear_both"></div>
  186. <div class="mw-bodytext">
  187. <?php $this->html('bodytext') ?>
  188. <div class="clear_both"></div>
  189. </div>
  190. <div class="group"><?php $this->html('catlinks'); ?></div>
  191. <?php $this->html('dataAfterContent'); ?>
  192. </div>
  193. </div>
  194. <footer class="row">
  195. <div id="footer">
  196. <?php if ($wgForegroundFeatures['addThisFollowPUBID'] != '') { ?>
  197. <div class="social-footer large-12 small-12 columns">
  198. <div class="social-links">
  199. <!-- Go to www.addthis.com/dashboard to customize your tools -->
  200. <div class="addthis_horizontal_follow_toolbox"></div>
  201. <script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=<?php echo $wgForegroundFeatures['addThisFollowPUBID'];?>"></script>
  202. </div>
  203. </div>
  204. <?php } ?>
  205. <div id="footer-left" class="<?php echo $footerLeftClass;?>">
  206. <ul id="footer-left">
  207. <?php foreach ( $this->getFooterLinks( "flat" ) as $key ) { ?>
  208. <li id="footer-<?php echo $key ?>"><?php $this->html( $key ) ?></li>
  209. <?php } ?>
  210. </ul>
  211. </div>
  212. <div id="footer-right-icons" class="<?php echo $footerRightClass;?>">
  213. <ul id="poweredby">
  214. <?php foreach ( $this->getFooterIcons( $poweredbyType ) as $blockName => $footerIcons ) { ?>
  215. <li class="<?php echo $blockName ?>"><?php foreach ( $footerIcons as $icon ) { ?>
  216. <?php echo $this->getSkin()->makeFooterIcon( $icon, $poweredbyMakeType ); ?>
  217. <?php } ?>
  218. </li>
  219. <?php } ?>
  220. </ul>
  221. </div>
  222. </div>
  223. </footer>
  224. </div>
  225. <?php $this->printTrail(); ?>
  226. </body>
  227. </html>
  228. <?php
  229. wfRestoreWarnings();
  230. }
  231. }
  232. ?>