Foreground.skin.php 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  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">
  113. <div class="small-12 columns">
  114. <?php echo $this->makeSearchInput(array('placeholder' => wfMessage('searchsuggest-search')->text(), 'id' => 'searchInput') ); ?>
  115. <button type="submit" class="button search"><?php echo wfMessage( 'search' )->text() ?></button>
  116. </div>
  117. </div>
  118. </form>
  119. </li>
  120. <li class="divider show-for-small"></li>
  121. <li class="has-form">
  122. <li class="has-dropdown active"><a href="#"><i class="fa fa-cogs"></i></a>
  123. <ul id="toolbox-dropdown" class="dropdown">
  124. <?php foreach ( $this->getToolbox() as $key => $item ) { echo $this->makeListItem($key, $item); } ?>
  125. <?php if ($wgForegroundFeatures['showRecentChangesUnderTools']): ?><li id="n-recentchanges"><?php echo Linker::specialLink('Recentchanges') ?></li><?php endif; ?>
  126. <?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; ?>
  127. </ul>
  128. </li>
  129. <?php if ($wgUser->isLoggedIn()): ?>
  130. <li id="personal-tools-dropdown" class="has-dropdown active"><a href="#"><i class="fa fa-user"></i></a>
  131. <ul class="dropdown">
  132. <?php foreach ( $this->getPersonalTools() as $key => $item ) { echo $this->makeListItem($key, $item); } ?>
  133. </ul>
  134. </li>
  135. <?php else: ?>
  136. <li>
  137. <?php if (isset($this->data['personal_urls']['anonlogin'])): ?>
  138. <a href="<?php echo $this->data['personal_urls']['anonlogin']['href']; ?>"><?php echo wfMessage( 'login' )->text() ?></a>
  139. <?php elseif (isset($this->data['personal_urls']['login'])): ?>
  140. <a href="<?php echo htmlspecialchars($this->data['personal_urls']['login']['href']); ?>"><?php echo wfMessage( 'login' )->text() ?></a>
  141. <?php else: ?>
  142. <?php echo Linker::link(Title::newFromText('Special:UserLogin'), wfMessage( 'login' )->text()); ?>
  143. <?php endif; ?>
  144. </li>
  145. <?php endif; ?>
  146. </ul>
  147. </section>
  148. </nav>
  149. <?php if ($wgForegroundFeatures['NavWrapperType'] != '0') echo "</div>"; ?>
  150. <div id="page-content">
  151. <div class="row">
  152. <div class="large-12 columns">
  153. <!--[if lt IE 9]>
  154. <div id="siteNotice" class="sitenotice panel radius"><?php echo $this->text('sitename') . ' '. wfMessage( 'foreground-browsermsg' )->text(); ?></div>
  155. <![endif]-->
  156. <?php if ( $this->data['sitenotice'] ) { ?><div id="siteNotice" class="sitenotice panel radius"><?php $this->html( 'sitenotice' ); ?></div><?php } ?>
  157. <?php if ( $this->data['newtalk'] ) { ?><div id="usermessage" class="newtalk panel radius"><?php $this->html( 'newtalk' ); ?></div><?php } ?>
  158. </div>
  159. </div>
  160. <div id="mw-js-message" style="display:none;"></div>
  161. <div class="row">
  162. <div id="p-cactions" class="large-12 columns">
  163. <?php if ($wgUser->isLoggedIn() || $wgForegroundFeatures['showActionsForAnon']): ?>
  164. <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>
  165. <ul id="drop1" class="views large-12 columns f-dropdown">
  166. <?php foreach( $this->data['content_actions'] as $key => $item ) { echo preg_replace(array('/\sprimary="1"/','/\scontext="[a-z]+"/','/\srel="archives"/'),'',$this->makeListItem($key, $item)); } ?>
  167. <?php wfRunHooks( SkinTemplateToolboxEnd, array( &$this, true ) ); ?>
  168. </ul>
  169. <?php if ($wgUser->isLoggedIn()): ?>
  170. <div id="echo-notifications"></div>
  171. <?php endif; ?>
  172. <?php endif;
  173. $namespace = str_replace('_', ' ', $this->getSkin()->getTitle()->getNsText());
  174. $displaytitle = $this->data['title'];
  175. if (!empty($namespace)) {
  176. $pagetitle = $this->getSkin()->getTitle();
  177. $newtitle = str_replace($namespace.':', '', $pagetitle);
  178. $displaytitle = str_replace($pagetitle, $newtitle, $displaytitle);
  179. ?><h4 class="namespace label"><?php print $namespace; ?></h4><?php } ?>
  180. <h2 class="title"><?php print $displaytitle; ?></h2>
  181. <?php if ( $this->data['isarticle'] ) { ?><h3 id="tagline"><?php $this->msg( 'tagline' ) ?></h3><?php } ?>
  182. <h5 class="subtitle"><?php $this->html('subtitle') ?></h5>
  183. <div class="clear_both"></div>
  184. <div class="mw-bodytext">
  185. <?php $this->html('bodytext') ?>
  186. <div class="clear_both"></div>
  187. </div>
  188. <div class="group"><?php $this->html('catlinks'); ?></div>
  189. <?php $this->html('dataAfterContent'); ?>
  190. </div>
  191. </div>
  192. <footer class="row">
  193. <div id="footer">
  194. <?php if ($wgForegroundFeatures['addThisFollowPUBID'] != '') { ?>
  195. <div class="social-footer large-12 small-12 columns">
  196. <div class="social-links">
  197. <!-- Go to www.addthis.com/dashboard to customize your tools -->
  198. <div class="addthis_horizontal_follow_toolbox"></div>
  199. <script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=<?php echo $wgForegroundFeatures['addThisFollowPUBID'];?>"></script>
  200. </div>
  201. </div>
  202. <?php } ?>
  203. <div id="footer-left" class="<?php echo $footerLeftClass;?>">
  204. <ul id="footer-left">
  205. <?php foreach ( $this->getFooterLinks( "flat" ) as $key ) { ?>
  206. <li id="footer-<?php echo $key ?>"><?php $this->html( $key ) ?></li>
  207. <?php } ?>
  208. </ul>
  209. </div>
  210. <div id="footer-right-icons" class="<?php echo $footerRightClass;?>">
  211. <ul id="poweredby">
  212. <?php foreach ( $this->getFooterIcons( $poweredbyType ) as $blockName => $footerIcons ) { ?>
  213. <li class="<?php echo $blockName ?>"><?php foreach ( $footerIcons as $icon ) { ?>
  214. <?php echo $this->getSkin()->makeFooterIcon( $icon, $poweredbyMakeType ); ?>
  215. <?php } ?>
  216. </li>
  217. <?php } ?>
  218. </ul>
  219. </div>
  220. </div>
  221. </footer>
  222. </div>
  223. <?php $this->printTrail(); ?>
  224. </body>
  225. </html>
  226. <?php
  227. wfRestoreWarnings();
  228. }
  229. }
  230. ?>