Passed
Pull Request — master (#90)
by None
01:10
created

Pivot.skin.php (2 issues)

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
		
39
		if ( $wgPivotFeatures['preloadFontAwesome'] ) {
40
			$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" />');
41
		}
42
		
43
		$out->addModuleStyles('skins.pivot.styles');
44
45
	}
46
	
47
	public function initPage(OutputPage $out) {
48
		global $wgLocalStylePath;
49
		parent::initPage($out);
50
51
		$viewport_meta = 'width=device-width, user-scalable=yes, initial-scale=1.0';
52
		$out->addMeta('viewport', $viewport_meta);
53
		$out->addModules('skins.pivot.js');
54
	}
55
56
}
57
58
59
class pivotTemplate extends BaseTemplate {
60
	public function execute() {
61
		global $wgUser;
62
		global $wgPivotFeatures;
63
		Wikimedia\AtEase\AtEase::suppressWarnings();
0 ignored issues
show
The type Wikimedia\AtEase\AtEase was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
64
		$this->html('headelement');
65
		switch ($wgPivotFeatures['usePivotTabs']) {
66
			case true:
67
			    ob_start();
68
				$this->html('bodytext');
69
				$out = ob_get_contents();
70
				ob_end_clean();
71
				$markers = array("&lt;a", "&lt;/a", "&gt;");
72
				$tags = array("<a", "</a", ">");
73
				$body = str_replace($markers, $tags, $out);
74
				break;	
75
			default:
76
				$body = '';
77
				break;
78
		}
79
		switch ($wgPivotFeatures['showFooterIcons']) {
80
			case true:
81
				$poweredbyType = "icononly";
82
				$poweredbyMakeType = 'withImage';
83
				break;
84
			default:
85
				$poweredbyType = "nocopyright";
86
				$poweredbyMakeType = 'withoutImage';
87
				break;	
88
		}
89
90
?>
91
<!-- START PIVOTTEMPLATE -->
92
		<div class="off-canvas-wrap docs-wrap" data-offcanvas="">
93
			<div class="inner-wrap">
94
				<?php if ($wgPivotFeatures['fixedNavBar'] != false) echo "<div class='fixed'>"; ?>
95
				<nav class="tab-bar hide-for-print">
96
					<section id="left-nav-aside" class="left-small show-for-small">
97
						<a href="#" class="left-off-canvas-toggle"><span id="menu-user"><i class="fa fa-navicon fa-lg"></i></span></a>
98
					</section>
99
					
100
					<section id="middle-nav" class="middle tab-bar-section">
101
						<div class="title"><a href="<?php echo $this->data['nav_urls']['mainpage']['href']; ?>">
102
					<span class="show-for-medium-up"><?php echo $wgPivotFeatures['wikiNameDesktop']; ?></span>
103
						<span class="show-for-small-only">
104
						<?php if ($wgPivotFeatures['navbarIcon'] != false) { ?>
105
							<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;">
106
								<?php } ?>
107
						<?php echo $wgPivotFeatures['wikiName']; ?></span></a></div>
108
					</section>
109
					
110
					<section id="right-nav-aside" class="right-small">
111
					<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>
112
					</section>
113
				</nav>
114
				<?php if ($wgPivotFeatures['fixedNavBar'] != false) echo "</div>"; ?>
115
				    <aside class="left-off-canvas-menu">
116
      					<ul class="off-canvas-list">
117
						
118
								<li class="has-form">
119
									<form action="<?php $this->text( 'wgScript' ); ?>" id="searchform" class="mw-search">
120
										<div class="row collapse">
121
											<div class="small-12 columns">
122
												<input type="search" name="search" placeholder="<?php echo wfMessage( 'search' )->text() ?>" title="Search [alt-shift-f]" accesskey="f" id="searchInput-offcanvas" autocomplete="off">
123
											</div>
124
										</div>
125
									</form>
126
								</li>
127
								
128
							<?php $this->renderSidebar() ?>
129
						</ul>
130
					</aside>
131
					
132
					<aside class="right-off-canvas-menu">
133
					  <ul class="off-canvas-list">
134
					<?php if ($wgUser->isLoggedIn()): ?>
135
						<li id="personal-tools"><label>Personal</label></li>
136
						<?php foreach ($this->getPersonalTools() as $key => $item) { echo $this->makeListItem($key, $item); } ?>
137
							<?php else: ?>
138
								<?php if (isset($this->data['personal_urls']['anonlogin'])): ?>
139
									<li><a href="<?php echo $this->data['personal_urls']['anonlogin']['href']; ?>"><?php echo wfMessage( 'login' )->text() ?></a></li>
140
								<?php elseif (isset($this->data['personal_urls']['login'])): ?>
141
									<li><a href="<?php echo htmlspecialchars($this->data['personal_urls']['login']['href']); ?>"><?php echo wfMessage( 'login' )->text() ?></a></li>
142
										<?php else: ?>
143
											<li><?php echo Linker::link(Title::newFromText('Special:UserLogin'), wfMessage( 'login' )->text()); ?></li>
144
								<?php endif; ?>
145
							<?php endif; ?>
146
					  </ul>
147
					</aside>
148
149
					<section id="main-section" class="main-section" <?php if ($wgPivotFeatures['fixedNavBar'] != false) echo "style='margin-top:2.8125em'"; ?>>
150
					
151
						<div id="page-content">
152
							
153
							<div id="mw-js-message" style="display:none;"></div>
154
155
							<div class="row">
156
								
157
								<div id="sidebar" class="large-2 medium-3 columns hide-for-small hide-for-print">
158
										<ul class="side-nav">
159
											<li class="name logo">
160
											<a href="<?php echo $this->data['nav_urls']['mainpage']['href']; ?>">
161
												<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>		
162
											</li>
163
											<li class="has-form">
164
												<form action="<?php $this->text( 'wgScript' ); ?>" id="searchform" class="mw-search">
165
													<div class="row collapse">
166
														<div class="small-12 columns">
167
															<input type="search" name="search" placeholder="<?php echo wfMessage( 'search' )->text() ?>" title="Search [alt-shift-f]" accesskey="f" id="searchInput" autocomplete="off">
168
														</div>
169
													</div>
170
												</form>
171
											</li>
172
								
173
											<?php $this->renderSidebar() ?>
174
										</ul>
175
								</div>
176
								
177
								<div id="p-cactions" class="large-10 medium-9 columns">
178
								
179
									<div class="row">
180
										<div class="large-12 columns">
181
												<!-- Output page indicators -->
182
												<?php echo $this->getIndicators(); ?>
183
												<!-- If user is logged in output echo location -->
184
												<?php if ($wgUser->isLoggedIn()): ?>
185
												<div id="echo-notifications">
186
												<div id="echo-notifications-alerts"></div>
187
												<div id="echo-notifications-messages"></div>
188
												<div id="echo-notifications-notice"></div>
189
												</div>
190
												<?php endif; ?>
191
												<!--[if lt IE 9]>
192
												<div id="siteNotice" class="sitenotice"><?php echo $this->text('sitename') . ' '. wfMessage( 'pivot-browsermsg' )->text(); ?></div>
193
												<![endif]-->
194
195
												<?php if ( $this->data['sitenotice'] ) { ?><div id="siteNotice" class="sitenotice"><?php $this->html( 'sitenotice' ); ?></div><?php } ?>
196
												<?php if ( $this->data['newtalk'] ) { ?><div id="usermessage" class="newtalk"><?php $this->html( 'newtalk' ); ?></div><?php } ?>
197
										</div>
198
									</div>
199
								
200
									<?php if ($wgUser->isLoggedIn() || $wgPivotFeatures['showActionsForAnon']): ?>
201
										<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>
202
										<ul id="drop1" class="tiny content f-dropdown" data-dropdown-content>
203
											<?php foreach($this->data['content_actions'] as $key => $tab) { echo preg_replace(array('/\sprimary="1"/', '/\scontext="[a-z]+"/', '/\srel="archives"/'),'',$this->makeListItem($key, $tab)); } ?>
204
											<?php Hooks::run( 'SkinTemplateToolboxEnd', array( &$this, true ));  ?>
205
										</ul>
206
207
									<?php endif;
208
									$namespace = str_replace('_', ' ', $this->getSkin()->getTitle()->getNsText());
209
									$displaytitle = $this->data['title'];
210
									if (!empty($namespace)) {
211
										$pagetitle = $this->getSkin()->getTitle();
212
										$newtitle = str_replace($namespace.':', '', $pagetitle);
213
										$displaytitle = str_replace($pagetitle, $newtitle, $displaytitle);
214
									?><h4 class="namespace label"><?php print $namespace; ?></h4><?php } ?>
215
									<div id="content">
216
									<h1 class="title"><?php print $displaytitle; ?></h1>
217
											<?php if ($wgPivotFeatures['useAddThisShare'] !== '') { ?>
218
											<!-- Go to www.addthis.com/dashboard to customize your tools -->
219
											<div class="<?php echo $wgPivotFeatures['useAddThisShare']; ?> hide-for-print"></div>
220
											<!-- Go to www.addthis.com/dashboard to customize your tools -->
221
											<?php } ?>
222
									<?php if ( $this->data['isarticle'] ) { ?><h3 id="tagline"><?php $this->msg( 'tagline' ) ?></h3><?php } ?>
223
									<?php if ( $this->html('subtitle') ) { ?><h5 id="sitesub" class="subtitle"><?php $this->html('subtitle') ?></h5><?php } ?>
224
									<div id="contentSub" class="clear_both"></div>
225
									<div id="bodyContent" class="mw-bodytext">
226
									<?php 
227
									switch ($wgPivotFeatures['usePivotTabs']) {
228
										case true:
229
											echo $body;
230
											break;
231
										default:
232
										$this->html('bodytext');
233
											break;
234
											}
235
									?>
236
									<div class="clear_both"></div>
237
									</div>
238
									</div>
239
									<div id="categories" class="row">
240
										<div class="small-12 columns">
241
											<div class="group"><?php $this->html('catlinks'); ?></div>
242
											<?php $this->html('dataAfterContent'); ?>
243
										</div>
244
									</div>	
245
													
246
									<footer class="row">
247
248
										<div id="footer">
249
											<div id="div-footer-left" class="small-12 medium-8 large-9 columns">
250
											<ul id="footer-left">
251
												<?php foreach ($this->getFooterLinks("flat") as $key) { ?>
252
													<li id="footer-<?php echo $key ?>"><?php $this->html($key) ?></li>
253
												<?php } ?>									
254
											</ul>
255
											</div>	
256
											<div id="footer-right-icons" class="small-12 medium-4 large-3 columns hide-for-print">
257
											<ul id="footer-right">
258
												<li class="social-follow hide-for-print">
259
													<?php if ($wgPivotFeatures['useAddThisFollow'] !== '') { ?>
260
														<div class="social-links">
261
															<!-- Go to www.addthis.com/dashboard to customize your tools -->
262
															<div class="<?php echo $wgPivotFeatures['useAddThisFollow']; ?> hide-for-print"></div>
263
														</div>
264
													<?php } ?>
265
												</li>
266
												<?php foreach ($this->getFooterIcons($poweredbyType) as $blockName => $footerIcons) { ?>
267
													<li class="<?php echo $blockName ?>"><?php foreach ($footerIcons as $icon) { ?>
268
														<?php echo $this->getSkin()->makeFooterIcon($icon, $poweredbyMakeType); ?>
269
														<?php } ?>
270
													</li>
271
												<?php } ?>
272
											</ul>
273
											</div>		
274
										</div>			
275
									</footer>
276
								
277
								</div>
278
						</div>
279
					</div>
280
						
281
				</section>
282
				
283
			</div>
284
		</div>
285
		<div>
286
			<a class="exit-off-canvas"></a>	
287
		</div>
288
		
289
		
290
		<?php $this->printTrail(); ?>
291
292
			<?php if ($this->data['isarticle'] && $wgPivotFeatures['addThisPUBID'] !== '') { ?>
293
				<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=<?php echo $wgPivotFeatures['addThisPUBID']; ?>" async="async"></script>
294
			<?php } ?>	
295
		</body>
296
		</html>
297
298
<?php
299
		Wikimedia\AtEase\AtEase::suppressWarnings( true );
300
		
301
	}
302
	
303
	function renderSidebar() { 
0 ignored issues
show
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
304
		$sidebar = $this->getSidebar();
305
		foreach ($sidebar as $boxName => $box) { 
306
			echo '<li><label class="sidebar" id="'.Sanitizer::escapeId( $box['id'] ).'"';echo Linker::tooltip( $box['id'] ).'>'.htmlspecialchars( $box['header'] ).'</label></li>';
307
					if ( is_array( $box['content'] ) ) {
308
							foreach ($box['content'] as $key => $item) { echo $this->makeListItem($key, $item); }
309
								} 
310
							}
311
		return;	}	
312
}
313
?>
314