diff options
Diffstat (limited to 'skins/foreground/Foreground.skin.php')
-rwxr-xr-x | skins/foreground/Foreground.skin.php | 255 |
1 files changed, 255 insertions, 0 deletions
diff --git a/skins/foreground/Foreground.skin.php b/skins/foreground/Foreground.skin.php new file mode 100755 index 0000000..bea9f0f --- /dev/null +++ b/skins/foreground/Foreground.skin.php @@ -0,0 +1,255 @@ +<?php + +/** + * Skin file for Foreground + * + * @file + * @ingroup Skins + */ + + +class Skinforeground extends SkinTemplate { + public $skinname = 'foreground', $stylename = 'foreground', $template = 'foregroundTemplate', $useHeadElement = true; + + public function setupSkinUserCss(OutputPage $out) { + parent::setupSkinUserCss($out); + global $wgForegroundFeatures; + $wgForegroundFeaturesDefaults = array( + 'showActionsForAnon' => true, + 'NavWrapperType' => 'divonly', + 'showHelpUnderTools' => true, + 'showRecentChangesUnderTools' => true, + 'wikiName' => &$GLOBALS['wgSitename'], + 'navbarIcon' => false, + 'IeEdgeCode' => 1, + 'showFooterIcons' => 0, + 'addThisFollowPUBID' => '' + ); + foreach ($wgForegroundFeaturesDefaults as $fgOption => $fgOptionValue) { + if ( !isset($wgForegroundFeatures[$fgOption]) ) { + $wgForegroundFeatures[$fgOption] = $fgOptionValue; + } + } + switch ($wgForegroundFeatures['IeEdgeCode']) { + case 1: + $out->addHeadItem('ie-meta', '<meta http-equiv="X-UA-Compatible" content="IE=edge" />'); + break; + case 2: + if (isset($_SERVER['HTTP_USER_AGENT']) && (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false)) + header('X-UA-Compatible: IE=edge'); + break; + } + $out->addModuleStyles('skins.foreground.styles'); + } + + public function initPage( OutputPage $out ) { + global $wgLocalStylePath; + parent::initPage($out); + + $viewport_meta = 'width=device-width, user-scalable=yes, initial-scale=1.0'; + $out->addMeta('viewport', $viewport_meta); + $out->addModules('skins.foreground.js'); + } + +} + +class foregroundTemplate extends BaseTemplate { + public function execute() { + global $wgUser; + global $wgForegroundFeatures; + wfSuppressWarnings(); + $this->html('headelement'); + switch ($wgForegroundFeatures['NavWrapperType']) { + case '0': + break; + case 'divonly': + echo "<div id='navwrapper'>"; + break; + default: + echo "<div id='navwrapper' class='". $wgForegroundFeatures['NavWrapperType']. "'>"; + break; + } + // Set default variables for footer and switch them if 'showFooterIcons' => true + $footerLeftClass = 'small-8 large-centered columns text-center'; + $footerRightClass = 'large-12 small-12 columns'; + $poweredbyType = "nocopyright"; + $poweredbyMakeType = 'withoutImage'; + switch ($wgForegroundFeatures['showFooterIcons']) { + case true: + $footerLeftClass = 'large-8 small-12 columns'; + $footerRightClass = 'large-4 small-12 columns'; + $poweredbyType = "icononly"; + $poweredbyMakeType = 'withImage'; + break; + default: + break; + } +?> +<!-- START FOREGROUNDTEMPLATE --> + <nav class="top-bar"> + <ul class="title-area"> + <li class="name"> + <h1 class="title-name"> + <a href="<?php echo $this->data['nav_urls']['mainpage']['href']; ?>"> + <?php if ($wgForegroundFeatures['navbarIcon'] != '0') { ?> + <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;"> + <?php } ?> + <div class="title-name" style="display: inline-block;"><?php echo $wgForegroundFeatures['wikiName']; ?></div> + </a> + </h1> + </li> + <li class="toggle-topbar menu-icon"> + <a href="#"><span><?php echo wfMessage( 'foreground-menutitle' )->text(); ?></span></a> + </li> + </ul> + + <section class="top-bar-section"> + + <ul id="top-bar-left" class="left"> + <li class="divider"></li> + <?php foreach ( $this->getSidebar() as $boxName => $box ) { if ( ($box['header'] != wfMessage( 'toolbox' )->text()) ) { ?> + <li class="has-dropdown active" id='<?php echo Sanitizer::escapeId( $box['id'] ) ?>'<?php echo Linker::tooltip( $box['id'] ) ?>> + <a href="#"><?php echo htmlspecialchars( $box['header'] ); ?></a> + <?php if ( is_array( $box['content'] ) ) { ?> + <ul class="dropdown"> + <?php foreach ( $box['content'] as $key => $item ) { echo $this->makeListItem( $key, $item ); } ?> + </ul> + <?php } } ?> + <?php } ?> + <?php if ($wgUser->isLoggedIn() || $wgForegroundFeatures['showActionsForAnon']): ?> + <li class="has-dropdown active" id='p-Action'> + <a href="#"> <?php echo wfMessage( 'actions' )->text() ?></a> + <!--RTL --> + <ul class="dropdown"> + <?php foreach( $this->data['content_actions'] as $key => $item ) { echo preg_replace(array('/\sprimary="1"/','/\scontext="[a-z]+"/','/\srel="archives"/'),'',$this->makeListItem($key, $item)); } ?> + <?php wfRunHooks( 'SkinTemplateToolboxEnd', array( &$this, true ) ); ?> + </ul> + <?php endif; ?> + </li> + </ul> + + <ul id="top-bar-right" class="right"> + <li class="divider show-for-small"></li> + <li class="has-form"> + + <li class="has-dropdown active"><a href="#">Toolbox<i class="fa fa-cogs"></i></a> + <ul id="toolbox-dropdown" class="dropdown"> + <?php foreach ( $this->getToolbox() as $key => $item ) { echo $this->makeListItem($key, $item); } ?> + <?php if ($wgForegroundFeatures['showRecentChangesUnderTools']): ?><li id="n-recentchanges"><?php echo Linker::specialLink('Recentchanges') ?></li><?php endif; ?> + <?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; ?> + </ul> + </li> + + <?php if ($wgUser->isLoggedIn()): ?> + <li id="personal-tools-dropdown" class="has-dropdown active"><a href="#">Account<i class="fa fa-user"></i></a> + <ul class="dropdown"> + <?php foreach ( $this->getPersonalTools() as $key => $item ) { echo $this->makeListItem($key, $item); } ?> + </ul> + </li> + + <?php else: ?> + <li> + <?php if (isset($this->data['personal_urls']['anonlogin'])): ?> + <a href="<?php echo $this->data['personal_urls']['anonlogin']['href']; ?>"><?php echo wfMessage( 'login' )->text() ?></a> + <?php elseif (isset($this->data['personal_urls']['login'])): ?> + <a href="<?php echo htmlspecialchars($this->data['personal_urls']['login']['href']); ?>"><?php echo wfMessage( 'login' )->text() ?></a> + <?php else: ?> + <?php echo Linker::link(Title::newFromText('Special:UserLogin'), wfMessage( 'login' )->text()); ?> + <?php endif; ?> + </li> + + <?php endif; ?> + + <li class="has-form"> + <form action="<?php $this->text( 'wgScript' ); ?>" id="searchform" class="mw-search"> + <div class="row"> + <div class="small-12 columns"> + <?php echo $this->makeSearchInput(array('placeholder' => 'Search', 'id' => 'searchInput') ); ?> + <button type="submit" class="button search"><?php echo wfMessage( 'search' )->text() ?></button> + </div> + </div> + </form> + </li> + </ul> + </section> + </nav> + <?php if ($wgForegroundFeatures['NavWrapperType'] != '0') echo "</div>"; ?> + + <div id="page-content"> + <div class="row"> + <div class="large-12 columns"> + <!--[if lt IE 9]> + <div id="siteNotice" class="sitenotice panel radius"><?php echo $this->text('sitename') . ' '. wfMessage( 'foreground-browsermsg' )->text(); ?></div> + <![endif]--> + + <?php if ( $this->data['sitenotice'] ) { ?><div id="siteNotice" class="sitenotice"><?php $this->html( 'sitenotice' ); ?></div><?php } ?> + <?php if ( $this->data['newtalk'] ) { ?><div id="usermessage" class="newtalk panel radius"><?php $this->html( 'newtalk' ); ?></div><?php } ?> + </div> + </div> + + <div id="mw-js-message" style="display:none;"></div> + + <div class="row"> + <div id="p-cactions" class="large-12 columns"> + <?php + $namespace = str_replace('_', ' ', $this->getSkin()->getTitle()->getNsText()); + $displaytitle = $this->data['title']; + ?> + <div id="content"> + <h2 id="firstHeading" class="title"><?php print $displaytitle; ?></h2> + <?php if ( $this->data['isarticle'] ) { ?><h3 id="tagline"><?php $this->msg( 'tagline' ) ?></h3><?php } ?> + <h5 id="siteSub" class="subtitle"><?php $this->html('subtitle') ?></h5> + <div id="contentSub" class="clear_both"></div> + <div id="bodyContent" class="mw-bodytext"> + <?php $this->html('bodytext') ?> + <div class="clear_both"></div> + </div> + <div class="group"><?php $this->html('catlinks'); ?></div> + <?php $this->html('dataAfterContent'); ?> + </div> + </div> + </div> + + <footer class="row"> + <div id="footer"> + <?php if ($wgForegroundFeatures['addThisFollowPUBID'] != '') { ?> + <div class="social-footer large-12 small-12 columns"> + <div class="social-links"> + <!-- Go to www.addthis.com/dashboard to customize your tools --> + <div class="addthis_horizontal_follow_toolbox"></div> + <script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=<?php echo $wgForegroundFeatures['addThisFollowPUBID'];?>"></script> + </div> + </div> + <?php } ?> + <div id="footer-left" class="<?php echo $footerLeftClass;?>"> + <ul id="footer-left"> + <?php foreach ( $this->getFooterLinks( "flat" ) as $key ) { ?> + <li id="footer-<?php echo $key ?>"><?php $this->html( $key ) ?></li> + <?php } ?> + </ul> + </div> + <div id="footer-right-icons" class="<?php echo $footerRightClass;?>"> + <ul id="poweredby"> + <?php foreach ( $this->getFooterIcons( $poweredbyType ) as $blockName => $footerIcons ) { ?> + <li class="<?php echo $blockName ?>"><?php foreach ( $footerIcons as $icon ) { ?> + <?php echo $this->getSkin()->makeFooterIcon( $icon, $poweredbyMakeType ); ?> + <?php } ?> + </li> + <?php } ?> + </ul> + </div> + </div> + </footer> + + </div> + + <?php $this->printTrail(); ?> + + </body> + </html> + +<?php + wfRestoreWarnings(); + } +} +?> |