This repository has been archived by the owner on Jul 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
/
Pivot.skin.php
305 lines (266 loc) · 12.1 KB
/
Pivot.skin.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
<?php
/**
* Skin file for Pivot
*
* @file
* @ingroup Skins
*/
class SkinPivot extends SkinTemplate {
public $skinname = 'pivot', $stylename = 'pivot', $template = 'pivotTemplate', $useHeadElement = true;
public function getDefaultModules() {
global $wgPivotFeatures;
$wgPivotFeaturesDefaults = array(
'showActionsForAnon' => true,
'fixedNavBar' => false,
'usePivotTabs' => false,
'showHelpUnderTools' => true,
'showRecentChangesUnderTools' => true,
'wikiName' => &$GLOBALS['wgSitename'],
'wikiNameDesktop' => &$GLOBALS['wgSitename'],
'navbarIcon' => false,
'preloadFontAwesome' => false,
'showFooterIcons' => false,
'addThisPUBID' => '',
'useAddThisShare' => '',
'useAddThisFollow' => ''
);
foreach ($wgPivotFeaturesDefaults as $fgOption => $fgOptionValue) {
if ( !isset($wgPivotFeatures[$fgOption]) ) {
$wgPivotFeatures[$fgOption] = $fgOptionValue;
}
}
if ( $wgPivotFeatures['preloadFontAwesome'] ) {
$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" />');
}
$this->getOutput()->addModuleStyles('skins.pivot.styles');
return parent::getDefaultModules();
}
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.pivot.js');
}
}
class pivotTemplate extends BaseTemplate {
public function execute() {
global $wgUser;
global $wgPivotFeatures;
Wikimedia\suppressWarnings();
$this->html('headelement');
switch ($wgPivotFeatures['usePivotTabs']) {
case true:
ob_start();
$this->html('bodytext');
$out = ob_get_contents();
ob_end_clean();
$markers = array("<a", "</a", ">");
$tags = array("<a", "</a", ">");
$body = str_replace($markers, $tags, $out);
break;
default:
$body = '';
break;
}
switch ($wgPivotFeatures['showFooterIcons']) {
case true:
$poweredbyType = "icononly";
$poweredbyMakeType = 'withImage';
break;
default:
$poweredbyType = "nocopyright";
$poweredbyMakeType = 'withoutImage';
break;
}
?>
<!-- START PIVOTTEMPLATE -->
<div class="off-canvas-wrap docs-wrap" data-offcanvas="">
<div class="inner-wrap">
<?php if ($wgPivotFeatures['fixedNavBar'] != false) echo "<div class='fixed'>"; ?>
<nav class="tab-bar hide-for-print">
<section id="left-nav-aside" class="left-small show-for-small">
<a href="#" class="left-off-canvas-toggle"><span id="menu-user"><i class="fa fa-navicon fa-lg"></i></span></a>
</section>
<section id="middle-nav" class="middle tab-bar-section">
<div 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></div>
</section>
<section id="right-nav-aside" class="right-small">
<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>
</section>
</nav>
<?php if ($wgPivotFeatures['fixedNavBar'] != false) echo "</div>"; ?>
<aside class="left-off-canvas-menu">
<ul class="off-canvas-list">
<li class="has-form">
<form action="<?php $this->text( 'wgScript' ); ?>" id="searchform-sidebar" class="mw-search">
<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">
</div>
</div>
</form>
</li>
<?php $this->renderSidebar() ?>
</ul>
</aside>
<aside class="right-off-canvas-menu">
<ul class="off-canvas-list">
<?php if ($wgUser->isLoggedIn()): ?>
<li id="personal-tools"><label><?php echo wfMessage( 'pivot-personal-tools' )->text() ?></label></li>
<?php foreach ($this->getPersonalTools() as $key => $item) { echo $this->makeListItem($key, $item); } ?>
<?php else: ?>
<?php foreach ($this->getPersonalTools() as $key => $item) { echo $this->makeListItem($key, $item); } ?>
<?php endif; ?>
</ul>
</aside>
<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>
<div class="row">
<div id="sidebar" class="large-2 medium-3 columns hide-for-small hide-for-print">
<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>
</li>
<li class="has-form">
<form action="<?php $this->text( 'wgScript' ); ?>" id="searchform-offCanvas" class="mw-search">
<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" class="mw-searchInput" autocomplete="off">
</div>
</div>
</form>
</li>
<?php $this->renderSidebar() ?>
</ul>
</div>
<div id="p-cactions" class="large-10 medium-9 columns">
<div class="row">
<div class="large-12 columns">
<!-- 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; ?>
<!--[if lt IE 9]>
<div id="siteNotice" class="sitenotice"><?php echo $this->text('sitename') . ' '. wfMessage( 'pivot-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"><?php $this->html( 'newtalk' ); ?></div><?php } ?>
</div>
</div>
<?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"> <?php echo wfMessage( 'actions' )->text() ?></span></i></a>
<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 Hooks::run( 'SkinTemplateToolboxEnd', array( &$this, true )); ?>
</ul>
<?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 } ?>
<div id="content">
<h1 class="title"><?php print $displaytitle; ?></h1>
<?php if ($wgPivotFeatures['useAddThisShare'] !== '') { ?>
<!-- Go to www.addthis.com/dashboard to customize your tools -->
<div class="<?php echo $wgPivotFeatures['useAddThisShare']; ?> hide-for-print"></div>
<!-- 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 } ?>
<?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">
<?php
switch ($wgPivotFeatures['usePivotTabs']) {
case true:
echo $body;
break;
default:
$this->html('bodytext');
break;
}
?>
<div class="clear_both"></div>
</div>
</div>
<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">
<div id="footer">
<div id="div-footer-left" class="small-12 medium-8 large-9 columns">
<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="small-12 medium-4 large-3 columns hide-for-print">
<ul id="footer-right">
<li class="social-follow hide-for-print">
<?php if ($wgPivotFeatures['useAddThisFollow'] !== '') { ?>
<div class="social-links">
<!-- Go to www.addthis.com/dashboard to customize your tools -->
<div class="<?php echo $wgPivotFeatures['useAddThisFollow']; ?> hide-for-print"></div>
</div>
<?php } ?>
</li>
<?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>
</div>
</div>
</section>
</div>
</div>
<div>
<a class="exit-off-canvas"></a>
</div>
<?php $this->printTrail(); ?>
<?php if ($this->data['isarticle'] && $wgPivotFeatures['addThisPUBID'] !== '') { ?>
<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=<?php echo $wgPivotFeatures['addThisPUBID']; ?>" async="async"></script>
<?php } ?>
</body>
</html>
<?php
Wikimedia\restoreWarnings();
}
function renderSidebar() {
$sidebar = $this->getSidebar();
foreach ($sidebar as $boxName => $box) {
echo '<li><label class="sidebar" id="'.Sanitizer::escapeIdForAttribute( $box['id'] ).'"';echo Linker::tooltip( $box['id'] ).'>'.htmlspecialchars( $box['header'] ).'</label></li>';
if ( is_array( $box['content'] ) ) {
foreach ($box['content'] as $key => $item) { echo $this->makeListItem($key, $item); }
}
}
return; }
}
?>