Hutchy68 /
pivot
| 1 | <?php |
||
| 2 | |||
| 3 | /** |
||
| 4 | * Skin file for Pivot |
||
| 5 | * |
||
| 6 | * @file |
||
| 7 | * @ingroup Skins |
||
| 8 | */ |
||
| 9 | |||
| 10 | |||
| 11 | class SkinPivot extends SkinTemplate { |
||
| 12 | public $skinname = 'pivot', $stylename = 'pivot', $template = 'pivotTemplate', $useHeadElement = true; |
||
| 13 | |||
| 14 | public function getDefaultModules() { |
||
| 15 | global $wgPivotFeatures; |
||
| 16 | $wgPivotFeaturesDefaults = array( |
||
| 17 | 'showActionsForAnon' => true, |
||
| 18 | 'fixedNavBar' => false, |
||
| 19 | 'usePivotTabs' => false, |
||
| 20 | 'showHelpUnderTools' => true, |
||
| 21 | 'showRecentChangesUnderTools' => true, |
||
| 22 | 'wikiName' => &$GLOBALS['wgSitename'], |
||
| 23 | 'wikiNameDesktop' => &$GLOBALS['wgSitename'], |
||
| 24 | 'navbarIcon' => false, |
||
| 25 | 'preloadFontAwesome' => false, |
||
| 26 | 'showFooterIcons' => false, |
||
| 27 | 'addThisPUBID' => '', |
||
| 28 | 'useAddThisShare' => '', |
||
| 29 | 'useAddThisFollow' => '' |
||
| 30 | ); |
||
| 31 | foreach ($wgPivotFeaturesDefaults as $fgOption => $fgOptionValue) { |
||
| 32 | if ( !isset($wgPivotFeatures[$fgOption]) ) { |
||
| 33 | $wgPivotFeatures[$fgOption] = $fgOptionValue; |
||
| 34 | } |
||
| 35 | } |
||
| 36 | |||
| 37 | if ( $wgPivotFeatures['preloadFontAwesome'] ) { |
||
| 38 | $this->getOutput()->addHeadItem('font', '<link rel="preload" href="'.$wgLocalStylePath.'/pivot/assets/fonts/fontawesome-webfont.woff2?v=4.7.0" as="font" type="font/woff2" crossorigin="anonymous" />'); |
||
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
Loading history...
|
|||
| 39 | } |
||
| 40 | |||
| 41 | $this->getOutput()->addModuleStyles('skins.pivot.styles'); |
||
| 42 | return parent::getDefaultModules(); |
||
| 43 | } |
||
| 44 | |||
| 45 | public function initPage(OutputPage $out) { |
||
| 46 | global $wgLocalStylePath; |
||
| 47 | parent::initPage($out); |
||
| 48 | |||
| 49 | $viewport_meta = 'width=device-width, user-scalable=yes, initial-scale=1.0'; |
||
| 50 | $out->addMeta('viewport', $viewport_meta); |
||
| 51 | $out->addModules('skins.pivot.js'); |
||
| 52 | } |
||
| 53 | |||
| 54 | } |
||
| 55 | |||
| 56 | |||
| 57 | class pivotTemplate extends BaseTemplate { |
||
| 58 | public function execute() { |
||
| 59 | global $wgUser; |
||
| 60 | global $wgPivotFeatures; |
||
| 61 | Wikimedia\suppressWarnings(); |
||
| 62 | $this->html('headelement'); |
||
| 63 | switch ($wgPivotFeatures['usePivotTabs']) { |
||
| 64 | case true: |
||
| 65 | ob_start(); |
||
| 66 | $this->html('bodytext'); |
||
| 67 | $out = ob_get_contents(); |
||
| 68 | ob_end_clean(); |
||
| 69 | $markers = array("<a", "</a", ">"); |
||
| 70 | $tags = array("<a", "</a", ">"); |
||
| 71 | $body = str_replace($markers, $tags, $out); |
||
| 72 | break; |
||
| 73 | default: |
||
| 74 | $body = ''; |
||
| 75 | break; |
||
| 76 | } |
||
| 77 | switch ($wgPivotFeatures['showFooterIcons']) { |
||
| 78 | case true: |
||
| 79 | $poweredbyType = "icononly"; |
||
| 80 | $poweredbyMakeType = 'withImage'; |
||
| 81 | break; |
||
| 82 | default: |
||
| 83 | $poweredbyType = "nocopyright"; |
||
| 84 | $poweredbyMakeType = 'withoutImage'; |
||
| 85 | break; |
||
| 86 | } |
||
| 87 | |||
| 88 | ?> |
||
| 89 | <!-- START PIVOTTEMPLATE --> |
||
| 90 | <div class="off-canvas-wrap docs-wrap" data-offcanvas=""> |
||
| 91 | <div class="inner-wrap"> |
||
| 92 | <?php if ($wgPivotFeatures['fixedNavBar'] != false) echo "<div class='fixed'>"; ?> |
||
| 93 | <nav class="tab-bar hide-for-print"> |
||
| 94 | <section id="left-nav-aside" class="left-small show-for-small"> |
||
| 95 | <a href="#" class="left-off-canvas-toggle"><span id="menu-user"><i class="fa fa-navicon fa-lg"></i></span></a> |
||
| 96 | </section> |
||
| 97 | |||
| 98 | <section id="middle-nav" class="middle tab-bar-section"> |
||
| 99 | <div class="title"><a href="<?php echo $this->data['nav_urls']['mainpage']['href']; ?>"> |
||
| 100 | <span class="show-for-medium-up"><?php echo $wgPivotFeatures['wikiNameDesktop']; ?></span> |
||
| 101 | <span class="show-for-small-only"> |
||
| 102 | <?php if ($wgPivotFeatures['navbarIcon'] != false) { ?> |
||
| 103 | <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;"> |
||
| 104 | <?php } ?> |
||
| 105 | <?php echo $wgPivotFeatures['wikiName']; ?></span></a></div> |
||
| 106 | </section> |
||
| 107 | |||
| 108 | <section id="right-nav-aside" class="right-small"> |
||
| 109 | <a href="#" 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> |
||
| 110 | </section> |
||
| 111 | </nav> |
||
| 112 | <?php if ($wgPivotFeatures['fixedNavBar'] != false) echo "</div>"; ?> |
||
| 113 | <aside class="left-off-canvas-menu"> |
||
| 114 | <ul class="off-canvas-list"> |
||
| 115 | |||
| 116 | <li class="has-form"> |
||
| 117 | <form action="<?php $this->text( 'wgScript' ); ?>" id="searchform-sidebar" class="mw-search"> |
||
| 118 | <div class="row collapse"> |
||
| 119 | <div class="small-12 columns"> |
||
| 120 | <input type="search" name="search" placeholder="<?php echo wfMessage( 'search' )->text() ?>" title="Search [alt-shift-f]" accesskey="f" id="searchInput" autocomplete="off"> |
||
| 121 | </div> |
||
| 122 | </div> |
||
| 123 | </form> |
||
| 124 | </li> |
||
| 125 | |||
| 126 | <?php $this->renderSidebar() ?> |
||
| 127 | </ul> |
||
| 128 | </aside> |
||
| 129 | |||
| 130 | <aside class="right-off-canvas-menu"> |
||
| 131 | <ul class="off-canvas-list"> |
||
| 132 | <?php if ($wgUser->isLoggedIn()): ?> |
||
| 133 | <li id="personal-tools"><label><?php echo wfMessage( 'pivot-personal-tools' )->text() ?></label></li> |
||
| 134 | <?php foreach ($this->getPersonalTools() as $key => $item) { echo $this->makeListItem($key, $item); } ?> |
||
| 135 | <?php else: ?> |
||
| 136 | <?php foreach ($this->getPersonalTools() as $key => $item) { echo $this->makeListItem($key, $item); } ?> |
||
| 137 | <?php endif; ?> |
||
| 138 | </ul> |
||
| 139 | </aside> |
||
| 140 | |||
| 141 | <section id="main-section" class="main-section" <?php if ($wgPivotFeatures['fixedNavBar'] != false) echo "style='margin-top:2.8125em'"; ?>> |
||
| 142 | |||
| 143 | <div id="page-content"> |
||
| 144 | |||
| 145 | <div id="mw-js-message" style="display:none;"></div> |
||
| 146 | |||
| 147 | <div class="row"> |
||
| 148 | |||
| 149 | <div id="sidebar" class="large-2 medium-3 columns hide-for-small hide-for-print"> |
||
| 150 | <ul class="side-nav"> |
||
| 151 | <li class="name logo"> |
||
| 152 | <a href="<?php echo $this->data['nav_urls']['mainpage']['href']; ?>"> |
||
| 153 | <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> |
||
| 154 | </li> |
||
| 155 | <li class="has-form"> |
||
| 156 | <form action="<?php $this->text( 'wgScript' ); ?>" id="searchform-offCanvas" class="mw-search"> |
||
| 157 | <div class="row collapse"> |
||
| 158 | <div class="small-12 columns"> |
||
| 159 | <input type="search" name="search" placeholder="<?php echo wfMessage( 'search' )->text() ?>" title="Search [alt-shift-f]" accesskey="f" class="mw-searchInput" autocomplete="off"> |
||
| 160 | </div> |
||
| 161 | </div> |
||
| 162 | </form> |
||
| 163 | </li> |
||
| 164 | |||
| 165 | <?php $this->renderSidebar() ?> |
||
| 166 | </ul> |
||
| 167 | </div> |
||
| 168 | |||
| 169 | <div id="p-cactions" class="large-10 medium-9 columns"> |
||
| 170 | |||
| 171 | <div class="row"> |
||
| 172 | <div class="large-12 columns"> |
||
| 173 | <!-- Output page indicators --> |
||
| 174 | <?php echo $this->getIndicators(); ?> |
||
| 175 | <!-- If user is logged in output echo location --> |
||
| 176 | <?php if ($wgUser->isLoggedIn()): ?> |
||
| 177 | <div id="echo-notifications"> |
||
| 178 | <div id="echo-notifications-alerts"></div> |
||
| 179 | <div id="echo-notifications-messages"></div> |
||
| 180 | <div id="echo-notifications-notice"></div> |
||
| 181 | </div> |
||
| 182 | <?php endif; ?> |
||
| 183 | <!--[if lt IE 9]> |
||
| 184 | <div id="siteNotice" class="sitenotice"><?php echo $this->text('sitename') . ' '. wfMessage( 'pivot-browsermsg' )->text(); ?></div> |
||
| 185 | <![endif]--> |
||
| 186 | |||
| 187 | <?php if ( $this->data['sitenotice'] ) { ?><div id="siteNotice" class="sitenotice"><?php $this->html( 'sitenotice' ); ?></div><?php } ?> |
||
| 188 | <?php if ( $this->data['newtalk'] ) { ?><div id="usermessage" class="newtalk"><?php $this->html( 'newtalk' ); ?></div><?php } ?> |
||
| 189 | </div> |
||
| 190 | </div> |
||
| 191 | |||
| 192 | <?php if ($wgUser->isLoggedIn() || $wgPivotFeatures['showActionsForAnon']): ?> |
||
| 193 | <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"> <?php echo wfMessage( 'actions' )->text() ?></span></i></a> |
||
| 194 | <ul id="drop1" class="tiny content f-dropdown" data-dropdown-content> |
||
| 195 | <?php foreach($this->data['content_actions'] as $key => $tab) { echo preg_replace(array('/\sprimary="1"/', '/\scontext="[a-z]+"/', '/\srel="archives"/'),'',$this->makeListItem($key, $tab)); } ?> |
||
| 196 | <?php Hooks::run( 'SkinTemplateToolboxEnd', array( &$this, true )); ?> |
||
| 197 | </ul> |
||
| 198 | |||
| 199 | <?php endif; |
||
| 200 | $namespace = str_replace('_', ' ', $this->getSkin()->getTitle()->getNsText()); |
||
| 201 | $displaytitle = $this->data['title']; |
||
| 202 | if (!empty($namespace)) { |
||
| 203 | $pagetitle = $this->getSkin()->getTitle(); |
||
| 204 | $newtitle = str_replace($namespace.':', '', $pagetitle); |
||
| 205 | $displaytitle = str_replace($pagetitle, $newtitle, $displaytitle); |
||
| 206 | ?><h4 class="namespace label"><?php print $namespace; ?></h4><?php } ?> |
||
| 207 | <div id="content"> |
||
| 208 | <h1 class="title"><?php print $displaytitle; ?></h1> |
||
| 209 | <?php if ($wgPivotFeatures['useAddThisShare'] !== '') { ?> |
||
| 210 | <!-- Go to www.addthis.com/dashboard to customize your tools --> |
||
| 211 | <div class="<?php echo $wgPivotFeatures['useAddThisShare']; ?> hide-for-print"></div> |
||
| 212 | <!-- Go to www.addthis.com/dashboard to customize your tools --> |
||
| 213 | <?php } ?> |
||
| 214 | <?php if ( $this->data['isarticle'] ) { ?><h3 id="tagline"><?php $this->msg( 'tagline' ) ?></h3><?php } ?> |
||
| 215 | <?php if ( $this->html('subtitle') ) { ?><h5 id="sitesub" class="subtitle"><?php $this->html('subtitle') ?></h5><?php } ?> |
||
| 216 | <div id="contentSub" class="clear_both"></div> |
||
| 217 | <div id="bodyContent" class="mw-bodytext"> |
||
| 218 | <?php |
||
| 219 | switch ($wgPivotFeatures['usePivotTabs']) { |
||
| 220 | case true: |
||
| 221 | echo $body; |
||
| 222 | break; |
||
| 223 | default: |
||
| 224 | $this->html('bodytext'); |
||
| 225 | break; |
||
| 226 | } |
||
| 227 | ?> |
||
| 228 | <div class="clear_both"></div> |
||
| 229 | </div> |
||
| 230 | </div> |
||
| 231 | <div id="categories" class="row"> |
||
| 232 | <div class="small-12 columns"> |
||
| 233 | <div class="group"><?php $this->html('catlinks'); ?></div> |
||
| 234 | <?php $this->html('dataAfterContent'); ?> |
||
| 235 | </div> |
||
| 236 | </div> |
||
| 237 | |||
| 238 | <footer class="row"> |
||
| 239 | |||
| 240 | <div id="footer"> |
||
| 241 | <div id="div-footer-left" class="small-12 medium-8 large-9 columns"> |
||
| 242 | <ul id="footer-left"> |
||
| 243 | <?php foreach ($this->getFooterLinks("flat") as $key) { ?> |
||
| 244 | <li id="footer-<?php echo $key ?>"><?php $this->html($key) ?></li> |
||
| 245 | <?php } ?> |
||
| 246 | </ul> |
||
| 247 | </div> |
||
| 248 | <div id="footer-right-icons" class="small-12 medium-4 large-3 columns hide-for-print"> |
||
| 249 | <ul id="footer-right"> |
||
| 250 | <li class="social-follow hide-for-print"> |
||
| 251 | <?php if ($wgPivotFeatures['useAddThisFollow'] !== '') { ?> |
||
| 252 | <div class="social-links"> |
||
| 253 | <!-- Go to www.addthis.com/dashboard to customize your tools --> |
||
| 254 | <div class="<?php echo $wgPivotFeatures['useAddThisFollow']; ?> hide-for-print"></div> |
||
| 255 | </div> |
||
| 256 | <?php } ?> |
||
| 257 | </li> |
||
| 258 | <?php foreach ($this->getFooterIcons($poweredbyType) as $blockName => $footerIcons) { ?> |
||
| 259 | <li class="<?php echo $blockName ?>"><?php foreach ($footerIcons as $icon) { ?> |
||
| 260 | <?php echo $this->getSkin()->makeFooterIcon($icon, $poweredbyMakeType); ?> |
||
| 261 | <?php } ?> |
||
| 262 | </li> |
||
| 263 | <?php } ?> |
||
| 264 | </ul> |
||
| 265 | </div> |
||
| 266 | </div> |
||
| 267 | </footer> |
||
| 268 | |||
| 269 | </div> |
||
| 270 | </div> |
||
| 271 | </div> |
||
| 272 | |||
| 273 | </section> |
||
| 274 | |||
| 275 | </div> |
||
| 276 | </div> |
||
| 277 | <div> |
||
| 278 | <a class="exit-off-canvas"></a> |
||
| 279 | </div> |
||
| 280 | |||
| 281 | |||
| 282 | <?php $this->printTrail(); ?> |
||
| 283 | |||
| 284 | <?php if ($this->data['isarticle'] && $wgPivotFeatures['addThisPUBID'] !== '') { ?> |
||
| 285 | <script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=<?php echo $wgPivotFeatures['addThisPUBID']; ?>" async="async"></script> |
||
| 286 | <?php } ?> |
||
| 287 | </body> |
||
| 288 | </html> |
||
| 289 | |||
| 290 | <?php |
||
| 291 | Wikimedia\restoreWarnings(); |
||
| 292 | |||
| 293 | } |
||
| 294 | |||
| 295 | function renderSidebar() { |
||
|
0 ignored issues
–
show
|
|||
| 296 | $sidebar = $this->getSidebar(); |
||
| 297 | foreach ($sidebar as $boxName => $box) { |
||
| 298 | echo '<li><label class="sidebar" id="'.Sanitizer::escapeIdForAttribute( $box['id'] ).'"';echo Linker::tooltip( $box['id'] ).'>'.htmlspecialchars( $box['header'] ).'</label></li>'; |
||
| 299 | if ( is_array( $box['content'] ) ) { |
||
| 300 | foreach ($box['content'] as $key => $item) { echo $this->makeListItem($key, $item); } |
||
| 301 | } |
||
| 302 | } |
||
| 303 | return; } |
||
| 304 | } |
||
| 305 | ?> |
||
| 306 |