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