This repository has been archived by the owner on Jul 20, 2022. It is now read-only.
forked from jthingelstad/foreground
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathForeground.skin.php
executable file
·222 lines (196 loc) · 9.2 KB
/
Foreground.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
<?php
/**
* Skin file for Foreground
*
* @file
* @ingroup Skins
*/
class Skinforeground extends SkinTemplate {
public $skinname = 'foreground', $stylename = 'foreground', $template = 'foregroundTemplate', $useHeadElement = true;
public function setupSkinUserCss(OutputPage $out) {
parent::setupSkinUserCss($out);
$out->addHeadItem('ie-meta', '<meta http-equiv="X-UA-Compatible" content="IE=edge" />');
$out->addModuleStyles('skins.foreground.styles');
}
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.foreground.js');
}
}
class foregroundTemplate extends BaseTemplate {
public function execute() {
global $wgUser;
wfSuppressWarnings();
$this->html('headelement');
$body = '';
?>
<!-- START FOREGROUNDTEMPLATE -->
<header id="navwrapper">
<nav role="navigation" id="menu">
<ul class="title-area" role="banner">
<li>
<div class="title-name">
<a href="<?php echo $this->data['nav_urls']['mainpage']['href']; ?>">
<img alt="<?php echo $this->text('sitename'); ?>" class="top-bar-logo" src="<?php echo $this->text('logopath') ?>">
<h1 class="title-name"><?php echo $GLOBALS['wgSitename']; ?></h1>
</a>
</div>
</li>
<li class="toggle-topbar menu-icon">
<a href="#"><span><?php echo wfMessage( 'foreground-menutitle' )->text(); ?></span></a>
</li>
</ul>
<section id="top-bar-sections">
<ul id="top-bar-top-menu">
<!-- Search form -->
<li>
<form action="<?php $this->text( 'wgScript' ); ?>" id="searchform" class="mw-search" role="search">
<?php echo $this->makeSearchInput(array('placeholder' => wfMessage('Linksearch-ok')->text(), 'id' => 'searchInput') ); ?>
<button type="submit" title="<?php echo wfMessage( 'search' )->text() ?>"></button>
</form>
</li>
<!-- Language selector -->
<li>
<?php foreach ( $this->getPersonalTools() as $key => $item ) { if ($key == "uls") { echo $this->makeListItem($key, $item); break; } } ?>
</li>
<!-- Record call-to-action -->
<li id="p-record">
<?php $recordwizardTitle = Title::newFromText( "Special:RecordWizard" ); ?>
<?php echo $this->makeLink( "RecordWizard", [ "msg" => "Record", "href" => $recordwizardTitle->getFullURL(), "accesskey" => "r" ] ); ?></a>
</li>
<!-- Personal menu dropdown -->
<li id="personal-menu" class="dropdown mobile-menu">
<input id="personal-input" type="checkbox" role="button" aria-labelledby="personal-button" autocomplete="off" class="dropdown-input mobile-menu-input">
<label id="personal-button" for="personal-input" class="dropdown-label mobile-menu-label"></label>
<ul id="personal" class="dropdown-content mobile-menu-content">
<?php foreach ( $this->getPersonalTools() as $key => $item ) { if ($key != "uls") { echo $this->makeListItem($key, $item); } } ?>
</ul>
<label id="personal-mask" for="personal-input" class="mobile-menu-mask"></label>
</li>
</ul>
<div id="top-bar-bottom-menu">
<?php foreach ( $this->getSidebar() as $boxName => $box ) { if ( $box['header'] != wfMessage( 'toolbox' )->text() && $box['id'] != 'p-lang' ) { ?>
<ul id="<?php echo Sanitizer::escapeId( $box['id'] ) ?>"<?php echo Linker::tooltip( $box['id'] ) ?>>
<?php if ( is_array( $box['content'] ) ) { ?>
<?php foreach ( $box['content'] as $key => $item ) { echo $this->makeListItem( $key, $item ); } ?>
<?php } } ?>
</ul>
<?php } ?>
<div id="actions-menu" class="dropdown">
<input id="actions-input" type="checkbox" role="button" aria-labelledby="actions-button" autocomplete="off" class="dropdown-input">
<label id="actions-button" for="actions-input" class="dropdown-label"><?php echo wfMessage( 'actions' )->text() ?></label>
<ul id="actions" class="dropdown-content">
<?php foreach( $this->data['content_actions'] as $key => $item ) { echo preg_replace(array('/\sprimary="1"/','/\scontext="[a-z]+"/','/\srel="archives"/'),'',$this->makeListItem($key, $item)); } ?>
<?php wfRunHooks( 'SkinTemplateToolboxEnd', array( &$this, true ) ); ?>
</ul>
</div>
<aside id="hamburger-menu" class="mobile-menu">
<input id="hamburger-input" type="checkbox" role="button" aria-labelledby="hamburger-label" autocomplete="off" class="mobile-menu-input">
<label id="hamburger-button" for="hamburger-input" class="mobile-menu-label"><?php echo wfMessage( 'foreground-menutitle' )->text() ?></label>
<ul id="hamburger" class="mobile-menu-content">
<?php foreach ( $this->getSidebar() as $boxName => $box ) { if ( $box['header'] != wfMessage( 'toolbox' )->text() && $box['id'] != 'p-lang' ) { ?>
<?php if ( is_array( $box['content'] ) ) { ?>
<?php foreach ( $box['content'] as $key => $item ) { $item[ 'id' ] = "m" . $item[ 'id' ]; echo $this->makeListItem( $key, $item ); } ?>
<?php break; /* Display only the main menu in the hamburger menu */ ?>
<?php } } ?>
<?php } ?>
<li id="m-action-menu">
<a href="#"><?php echo wfMessage( 'actions' )->text() ?></a>
<ul>
<?php foreach( $this->data['content_actions'] as $key => $item ) { $item[ 'id' ] = "m" . $item[ 'id' ]; echo preg_replace(array('/\sprimary="1"/','/\scontext="[a-z]+"/','/\srel="archives"/'),'',$this->makeListItem($key, $item)); } ?>
<?php wfRunHooks( 'SkinTemplateToolboxEnd', array( &$this, true ) ); ?>
</ul>
</li>
</ul>
<label id="hamburger-mask" for="hamburger-input" class="mobile-menu-mask"></label>
</aside>
</div>
</section>
</nav>
</header>
<section id="page-content">
<aside style="display: none;"> <!-- TODO: temporary hidden, how should it be styled ?
<!-- 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; ?>
<?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 id="mw-js-message" style="display:none;"></div>
</aside>
<article id="content" role="main">
<header id="contentHeading">
<hgroup>
<?php
$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"><?php print $namespace; ?></h4>
<?php } ?>
<h1 id="firstHeading" class="title"><?php print $displaytitle; ?></h1>
<h2 id="contentSub"><?php $this->html('subtitle') ?></h2>
<?php echo $this->getIndicators(); ?>
</hgroup>
</header>
<div id="bodyContent" class="mw-bodytext">
<?php $this->html('bodytext'); ?>
<div class="clear_both"></div>
</div>
<footer>
<?php $this->html('catlinks'); ?>
<?php $this->html('dataAfterContent'); ?>
</footer>
</article>
</section>
<footer id="footer">
<div id="footer-left">
<?php $footerLinks = $this->getFooterLinks(); ?>
<ul id="footer-left-top">
<?php foreach ( $footerLinks["info"] as $key ) { ?>
<li id="footer-<?php echo $key ?>"><?php $this->html( $key ) ?></li>
<?php } ?>
</ul>
<ul id="footer-left-bottom">
<?php foreach ( $footerLinks["places"] as $key ) { ?>
<li id="footer-<?php echo $key ?>"><?php $this->html( $key ) ?></li>
<?php } ?>
</ul>
</div>
<ul id="footer-right-icons">
<li id="toolbox-menu" class="dropdown mobile-menu">
<input id="toolbox-input" type="checkbox" role="button" aria-labelledby="toolbox-button" autocomplete="off" class="dropdown-input mobile-menu-input">
<label id="toolbox-button" for="toolbox-input" class="dropdown-label mobile-menu-label"><?php echo wfMessage( 'toolbox' )->text() ?></label>
<ul id="toolbox" class="dropdown-content mobile-menu-content">
<?php foreach ( $this->getToolbox() as $key => $item ) { echo $this->makeListItem($key, $item); } ?>
<li id="n-recentchanges"><?php echo Linker::specialLink('Recentchanges') ?></li>
</ul>
<label id="toolbox-mask" for="toolbox-input" class="mobile-menu-mask"></label>
</li>
<?php foreach ( $this->getFooterIcons( "icononly" ) as $blockName => $footerIcons ) { ?>
<li class="<?php echo $blockName ?>">
<?php foreach ( $footerIcons as $icon ) { ?>
<?php echo $this->getSkin()->makeFooterIcon( $icon, "withImage" ); ?>
<?php } ?>
</li>
<?php } ?>
</ul>
</footer>
<?php $this->printTrail(); ?>
</body>
</html>
<?php
wfRestoreWarnings();
}
}
?>