-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathBlueLL.skin.php
executable file
·225 lines (207 loc) · 10.3 KB
/
BlueLL.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
<?php
/**
* Skin file for BlueLL
*
* @file
* @ingroup Skins
*/
class BlueLLTemplate extends BaseTemplate {
/**
* https://phabricator.wikimedia.org/T278266
*/
private function getIcons() {
$footericons = $this->get('footericons');
foreach ( $footericons as $footerIconsKey => &$footerIconsBlock ) {
foreach ( $footerIconsBlock as $footerIconKey => $footerIcon ) {
if ( !isset( $footerIcon['src'] ) ) {
unset( $footerIconsBlock[$footerIconKey] );
}
}
}
return $footericons;
}
public function execute() {
$skin = $this->getSkin();
$user = $skin->getUser();
?>
<!-- START BLUELL TEMPLATE -->
<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( 'bluell-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 -->
<?php if ( class_exists( 'SpecialRecordWizard' ) ) {?>
<li id="p-record">
<?php $recordwizardTitle = Title::newFromText( "Special:RecordWizard" ); ?>
<?php echo $this->makeLink( "RecordWizard", [ "msg" => "bluell-record", "href" => $recordwizardTitle->getFullURL(), "accesskey" => "r" ] ); ?></a>
</li>
<?php }?>
<!-- If user is logged in output echo location -->
<?php if ($user->isRegistered()): ?>
<div id="echo-notifications-alerts"></div>
<div id="echo-notifications-notice"></div>
<?php endif; ?>
<!-- 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 htmlspecialchars( Sanitizer::escapeIdForAttribute( $box['id'] ), ENT_QUOTES ) ?>"<?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 } ?>
<!-- Edit button -->
<?php if ( isset( $this->data['content_actions']['edit'] ) ) { ?>
<?php echo preg_replace(array('/\sprimary="1"/','/\scontext="[a-z]+"/','/\srel="archives"/'),'',$this->makeListItem('edit', $this->data['content_actions']['edit'], ['tag' => 'span'])); ?>
<?php } ?>
<?php if ( isset( $this->data['content_actions']['viewsource'] ) ) { ?>
<?php $this->data['content_actions']['viewsource']['text'] = wfMessage( 'edit' ); ?>
<?php echo preg_replace(array('/\sprimary="1"/','/\scontext="[a-z]+"/','/\srel="archives"/'),'',$this->makeListItem('edit', $this->data['content_actions']['viewsource'], ['tag' => 'span'])); ?>
<?php } ?>
<!-- Action menu -->
<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 ) { if ( $key === 'edit' || $key === 'viewsource' ) { continue; } echo preg_replace(array('/\sprimary="1"/','/\scontext="[a-z]+"/','/\srel="archives"/'),'',$this->makeListItem($key, $item)); } ?>
</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( 'bluell-menutitle' )->text() ?></label>
<ul id="hamburger" class="mobile-menu-content">
<!-- Hamburger search form -->
<li id="m-searchitem">
<form action="<?php $this->text( 'wgScript' ); ?>" id="m-searchform" class="mw-search" role="search">
<?php echo $this->makeSearchInput(array('placeholder' => wfMessage('Linksearch-ok')->text(), 'id' => 'm-searchInput') ); ?>
<button type="submit" title="<?php echo wfMessage( 'search' )->text() ?>"></button>
</form>
</li>
<!-- Hamburger navigation -->
<?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 } ?>
<!-- Hamburger Actions -->
<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)); } ?>
</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="max-width: none;"> <!-- TODO: move style to its own class? -->
<?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 ) { if( substr( $key, 0, 7 ) !== 'social-' ) { ?>
<li id="footer-<?php echo $key ?>"><?php $this->html( $key ) ?></li>
<?php } else { ?>
<li id="footer-<?php echo $key; ?>"><a href="<?php echo wfMessage( $key . '-url' )->text(); ?>"><img src="/skins/BlueLL/assets/stylesheets/icons/<?php echo substr( $key, 7 ); ?>-blue.svg"/></a></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">
<!-- https://phabricator.wikimedia.org/T279390 -->
<?php foreach ( $this->data['sidebar']['TOOLBOX'] 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->getIcons() 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
}
}
?>