1
0
mirror of https://github.com/Hutchy68/pivot.git synced 2024-11-14 14:39:03 +01:00
pivot/Pivot.skin.php

314 lines
13 KiB
PHP
Raw Permalink Normal View History

2015-10-01 16:00:26 +02:00
<?php
/**
2015-11-04 03:22:00 +01:00
* Skin file for Pivot
2015-10-01 16:00:26 +02:00
*
* @file
* @ingroup Skins
*/
class SkinPivot extends SkinTemplate {
2015-10-01 16:00:26 +02:00
public $skinname = 'pivot', $stylename = 'pivot', $template = 'pivotTemplate', $useHeadElement = true;
public function initPage(OutputPage $out) {
parent::initPage($out);
global $wgLocalStylePath;
$viewport_meta = 'width=device-width, user-scalable=yes, initial-scale=1.0';
$out->addMeta('viewport', $viewport_meta);
$out->addModuleScripts('skins.pivot.js');
}
2015-10-01 16:00:26 +02:00
public function setupSkinUserCss(OutputPage $out) {
parent::setupSkinUserCss($out);
2018-02-08 21:27:01 +01:00
global $wgLocalStylePath;
2015-10-01 16:00:26 +02:00
global $wgPivotFeatures;
$wgPivotFeaturesDefaults = array(
'showActionsForAnon' => true,
'fixedNavBar' => false,
'usePivotTabs' => false,
2015-10-01 16:00:26 +02:00
'showHelpUnderTools' => true,
'showRecentChangesUnderTools' => true,
'wikiName' => &$GLOBALS['wgSitename'],
'wikiNameDesktop' => &$GLOBALS['wgSitename'],
2015-10-04 01:49:50 +02:00
'navbarIcon' => false,
'preloadFontAwesome' => false,
'showFooterIcons' => false,
'addThisPUBID' => '',
'useAddThisShare' => '',
'useAddThisFollow' => ''
2015-10-01 16:00:26 +02:00
);
foreach ($wgPivotFeaturesDefaults as $fgOption => $fgOptionValue) {
if ( !isset($wgPivotFeatures[$fgOption]) ) {
$wgPivotFeatures[$fgOption] = $fgOptionValue;
}
}
$out->addModuleStyles('skins.pivot.styles');
if ( $wgPivotFeatures['preloadFontAwesome'] ) {
$out->addHeadItem('font', '<link rel="preload" href="'.$wgLocalStylePath.'/pivot/assets/fonts/fontawesome-webfont.woff2?v=4.7.0" as="font" type="font/woff2" crossorigin="anonymous" />');
}
2015-10-01 16:00:26 +02:00
}
}
class pivotTemplate extends BaseTemplate {
public function execute() {
global $wgUser;
global $wgPivotFeatures;
wfSuppressWarnings();
2015-10-01 16:00:26 +02:00
$this->html('headelement');
switch ($wgPivotFeatures['usePivotTabs']) {
2015-11-04 03:40:45 +01:00
case true:
2015-10-01 16:00:26 +02:00
ob_start();
$this->html('bodytext');
2015-10-01 16:00:26 +02:00
$out = ob_get_contents();
ob_end_clean();
2015-11-04 15:53:51 +01:00
$markers = array("&lt;a", "&lt;/a", "&gt;");
$tags = array("<a", "</a", ">");
2015-10-01 16:00:26 +02:00
$body = str_replace($markers, $tags, $out);
break;
default:
$body = '';
2015-10-01 16:00:26 +02:00
break;
}
switch ($wgPivotFeatures['showFooterIcons']) {
case true:
$poweredbyType = "icononly";
$poweredbyMakeType = 'withImage';
break;
default:
$poweredbyType = "nocopyright";
$poweredbyMakeType = 'withoutImage';
break;
}
2015-10-01 16:00:26 +02:00
?>
2015-11-04 04:04:49 +01:00
<!-- START PIVOTTEMPLATE -->
2015-10-01 16:00:26 +02:00
<div class="off-canvas-wrap docs-wrap" data-offcanvas="">
<div class="inner-wrap">
2015-11-04 15:53:51 +01:00
<?php if ($wgPivotFeatures['fixedNavBar'] != false) echo "<div class='fixed'>"; ?>
<nav class="tab-bar hide-for-print">
2015-11-04 03:22:00 +01:00
<section id="left-nav-aside" class="left-small show-for-small">
2015-10-01 16:00:26 +02:00
<a class="left-off-canvas-toggle"><span id="menu-user"><i class="fa fa-navicon fa-lg"></i></span></a>
</section>
2015-11-04 03:22:00 +01:00
<section id="middle-nav" class="middle tab-bar-section">
<h1 class="title"><a href="<?php echo $this->data['nav_urls']['mainpage']['href']; ?>">
<span class="show-for-medium-up"><?php echo $wgPivotFeatures['wikiNameDesktop']; ?></span>
<span class="show-for-small-only">
<?php if ($wgPivotFeatures['navbarIcon'] != false) { ?>
<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 } ?>
<?php echo $wgPivotFeatures['wikiName']; ?></span></a></h1>
2015-10-01 16:00:26 +02:00
</section>
2015-11-04 03:22:00 +01:00
<section id="right-nav-aside" class="right-small">
<a class="right-off-canvas-toggle"><span id="menu-user"><i class="fa <?php if ($wgUser->isLoggedIn()): ?>fa-user<?php else: ?>fa-navicon<?php endif; ?> fa-lg"></i></span></a>
2015-10-01 16:00:26 +02:00
</section>
</nav>
2015-11-04 15:53:51 +01:00
<?php if ($wgPivotFeatures['fixedNavBar'] != false) echo "</div>"; ?>
2015-10-01 16:00:26 +02:00
<aside class="left-off-canvas-menu">
<ul class="off-canvas-list">
<li class="has-form">
<form action="<?php $this->text( 'wgScript' ); ?>" id="searchform" class="mw-search">
2015-10-01 16:00:26 +02:00
<div class="row collapse">
<div class="small-12 columns">
<input type="search" name="search" placeholder="<?php echo wfMessage( 'search' )->text() ?>" title="Search [alt-shift-f]" accesskey="f" id="searchInput-offcanvas" autocomplete="off">
2015-10-01 16:00:26 +02:00
</div>
</div>
</form>
</li>
2015-11-04 13:50:24 +01:00
2018-02-15 18:45:46 +01:00
<?php $this->renderSidebar() ?>
2015-11-04 03:22:00 +01:00
</ul>
2015-10-01 16:00:26 +02:00
</aside>
2015-11-04 03:22:00 +01:00
<aside class="right-off-canvas-menu">
<ul class="off-canvas-list">
<?php if ($wgUser->isLoggedIn()): ?>
<li id="personal-tools"><label>Personal</label></li>
2015-11-04 15:53:51 +01:00
<?php foreach ($this->getPersonalTools() as $key => $item) { echo $this->makeListItem($key, $item); } ?>
2015-11-04 03:22:00 +01:00
<?php else: ?>
<?php if (isset($this->data['personal_urls']['anonlogin'])): ?>
<li><a href="<?php echo $this->data['personal_urls']['anonlogin']['href']; ?>"><?php echo wfMessage( 'login' )->text() ?></a></li>
<?php elseif (isset($this->data['personal_urls']['login'])): ?>
<li><a href="<?php echo htmlspecialchars($this->data['personal_urls']['login']['href']); ?>"><?php echo wfMessage( 'login' )->text() ?></a></li>
<?php else: ?>
<li><?php echo Linker::link(Title::newFromText('Special:UserLogin'), wfMessage( 'login' )->text()); ?></li>
<?php endif; ?>
<?php endif; ?>
</ul>
</aside>
2015-10-01 16:00:26 +02:00
2015-11-04 03:22:00 +01:00
<section id="main-section" class="main-section" <?php if ($wgPivotFeatures['fixedNavBar'] != false) echo "style='margin-top:2.8125em'"; ?>>
<div id="page-content">
<div id="mw-js-message" style="display:none;"></div>
2015-10-01 16:00:26 +02:00
2015-11-04 03:22:00 +01:00
<div class="row">
<div id="sidebar" class="large-2 medium-3 columns hide-for-small hide-for-print">
2015-11-04 03:22:00 +01:00
<ul class="side-nav">
<li class="name logo">
<a href="<?php echo $this->data['nav_urls']['mainpage']['href']; ?>">
<img alt="<?php echo $this->text('sitename'); ?>" src="<?php echo $this->text('logopath') ?>" style="max-width: 100%;height: auto;display: inline-block; vertical-align: middle;"></a>
2015-11-04 03:22:00 +01:00
</li>
<li class="has-form">
<form action="<?php $this->text( 'wgScript' ); ?>" id="searchform" class="mw-search">
2015-11-04 03:22:00 +01:00
<div class="row collapse">
<div class="small-12 columns">
<input type="search" name="search" placeholder="<?php echo wfMessage( 'search' )->text() ?>" title="Search [alt-shift-f]" accesskey="f" id="searchInput" autocomplete="off">
2015-11-04 03:22:00 +01:00
</div>
</div>
</form>
</li>
2018-02-15 18:45:46 +01:00
<?php $this->renderSidebar() ?>
2015-11-04 03:22:00 +01:00
</ul>
</div>
<div id="p-cactions" class="large-10 medium-9 columns">
<div class="row">
<div class="large-12 columns">
2017-04-18 15:24:36 +02:00
<!-- Output page indicators -->
<?php echo $this->getIndicators(); ?>
<!-- If user is logged in output echo location -->
<?php if ($wgUser->isLoggedIn()): ?>
<div id="echo-notifications">
<div id="echo-notifications-alerts"></div>
<div id="echo-notifications-messages"></div>
<div id="echo-notifications-notice"></div>
</div>
<?php endif; ?>
2015-11-04 03:22:00 +01:00
<!--[if lt IE 9]>
<div id="siteNotice" class="sitenotice"><?php echo $this->text('sitename') . ' '. wfMessage( 'pivot-browsermsg' )->text(); ?></div>
2015-11-04 03:22:00 +01:00
<![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"><?php $this->html( 'newtalk' ); ?></div><?php } ?>
2015-10-01 16:00:26 +02:00
</div>
</div>
2015-11-04 03:22:00 +01:00
<?php if ($wgUser->isLoggedIn() || $wgPivotFeatures['showActionsForAnon']): ?>
<a href="#" data-options="align:left" data-dropdown="drop1" class="button secondary small radius pull-right hide-for-print" id="drop"><i class="fa fa-navicon fa-lg"><span id="page-actions" class="show-for-medium-up">&nbsp;<?php echo wfMessage( 'actions' )->text() ?></span></i></a>
2015-11-04 03:22:00 +01:00
<ul id="drop1" class="tiny content f-dropdown" data-dropdown-content>
<?php foreach($this->data['content_actions'] as $key => $tab) { echo preg_replace(array('/\sprimary="1"/', '/\scontext="[a-z]+"/', '/\srel="archives"/'),'',$this->makeListItem($key, $tab)); } ?>
<?php wfRunHooks( 'SkinTemplateToolboxEnd', array( &$this, true )); ?>
2015-11-04 03:22:00 +01:00
</ul>
2015-11-04 03:22:00 +01:00
<?php endif;
$namespace = str_replace('_', ' ', $this->getSkin()->getTitle()->getNsText());
$displaytitle = $this->data['title'];
if (!empty($namespace)) {
$pagetitle = $this->getSkin()->getTitle();
$newtitle = str_replace($namespace.':', '', $pagetitle);
$displaytitle = str_replace($pagetitle, $newtitle, $displaytitle);
?><h4 class="namespace label"><?php print $namespace; ?></h4><?php } ?>
2017-03-29 17:39:45 +02:00
<div id="content">
2015-11-04 03:22:00 +01:00
<h2 class="title"><?php print $displaytitle; ?></h2>
<?php if ($wgPivotFeatures['useAddThisShare'] !== '') { ?>
2015-11-04 03:22:00 +01:00
<!-- Go to www.addthis.com/dashboard to customize your tools -->
<div class="<?php echo $wgPivotFeatures['useAddThisShare']; ?> hide-for-print"></div>
2015-11-04 03:22:00 +01:00
<!-- Go to www.addthis.com/dashboard to customize your tools -->
<?php } ?>
<?php if ( $this->data['isarticle'] ) { ?><h3 id="tagline"><?php $this->msg( 'tagline' ) ?></h3><?php } ?>
2018-02-15 16:03:22 +01:00
<?php if ( $this->html('subtitle') ) { ?><h5 id="sitesub" class="subtitle"><?php $this->html('subtitle') ?></h5><?php } ?>
<div id="contentSub" class="clear_both"></div>
<div id="bodyContent" class="mw-bodytext">
2015-11-04 03:22:00 +01:00
<?php
switch ($wgPivotFeatures['usePivotTabs']) {
case true:
2015-11-04 03:22:00 +01:00
echo $body;
break;
default:
$this->html('bodytext');
2015-11-04 03:22:00 +01:00
break;
}
?>
<div class="clear_both"></div>
</div>
2017-03-29 17:39:45 +02:00
</div>
2015-11-04 03:22:00 +01:00
<div id="categories" class="row">
<div class="small-12 columns">
<div class="group"><?php $this->html('catlinks'); ?></div>
<?php $this->html('dataAfterContent'); ?>
</div>
</div>
<footer class="row">
2015-10-01 16:00:26 +02:00
2015-11-04 03:22:00 +01:00
<div id="footer">
2018-02-15 16:21:07 +01:00
<div id="div-footer-left" class="small-12 medium-8 large-9 columns">
2015-11-04 03:22:00 +01:00
<ul id="footer-left">
2015-11-04 15:53:51 +01:00
<?php foreach ($this->getFooterLinks("flat") as $key) { ?>
<li id="footer-<?php echo $key ?>"><?php $this->html($key) ?></li>
2015-11-04 03:22:00 +01:00
<?php } ?>
</ul>
</div>
<div id="footer-right-icons" class="small-12 medium-4 large-3 columns hide-for-print">
2015-11-04 03:22:00 +01:00
<ul id="footer-right">
<li class="social-follow hide-for-print">
<?php if ($wgPivotFeatures['useAddThisFollow'] !== '') { ?>
2015-11-04 03:22:00 +01:00
<div class="social-links">
<!-- Go to www.addthis.com/dashboard to customize your tools -->
<div class="<?php echo $wgPivotFeatures['useAddThisFollow']; ?> hide-for-print"></div>
2015-11-04 03:22:00 +01:00
</div>
<?php } ?>
</li>
2015-11-04 15:53:51 +01:00
<?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); ?>
2015-11-04 03:22:00 +01:00
<?php } ?>
</li>
<?php } ?>
</ul>
</div>
</div>
</footer>
</div>
2015-10-01 16:00:26 +02:00
</div>
</div>
2015-11-04 03:22:00 +01:00
</section>
2015-10-01 16:00:26 +02:00
2015-11-04 03:22:00 +01:00
</div>
2018-02-15 16:03:22 +01:00
</div>
<div>
2015-11-04 03:22:00 +01:00
<a class="exit-off-canvas"></a>
2015-10-01 16:00:26 +02:00
</div>
2018-02-15 16:03:22 +01:00
2015-10-01 16:00:26 +02:00
<?php $this->printTrail(); ?>
<?php if ($this->data['isarticle'] && $wgPivotFeatures['addThisPUBID'] !== '') { ?>
2018-02-15 16:21:07 +01:00
<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=<?php echo $wgPivotFeatures['addThisPUBID']; ?>" async="async"></script>
<?php } ?>
2015-10-01 16:00:26 +02:00
</body>
</html>
<?php
wfRestoreWarnings();
2015-10-01 16:00:26 +02:00
}
function renderSidebar() {
$sidebar = $this->getSidebar();
foreach ($sidebar as $boxName => $box) {
2018-03-28 23:43:26 +02:00
echo '<ul class="portal" role="navigation">';
echo '<li><label class="sidebar active" id="'.Sanitizer::escapeId( $box['id'] ).'"';echo Linker::tooltip( $box['id'] ).'>'.htmlspecialchars( $box['header'] ).'</label>';
if ( is_array( $box['content'] ) ) {
2018-03-28 23:43:26 +02:00
echo '<ul class="portal-content">';
foreach ($box['content'] as $key => $item) { echo $this->makeListItem($key, $item); }
2018-03-28 23:43:26 +02:00
echo '</ul>';
}
echo '</li></ul>';
}
return; }
2015-10-01 16:00:26 +02:00
}
2018-02-08 21:01:57 +01:00
?>