-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathalladmin.php
139 lines (116 loc) · 5.63 KB
/
alladmin.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
<?php
/*
* Textpattern Content Management System
* https://textpattern.com/
*
* Copyright (C) 2021 The Textpattern Development Team
*
* This file is part of Textpattern.
*
* Textpattern is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, version 2.
*
* Textpattern is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Textpattern. If not, see <https://www.gnu.org/licenses/>.
*/
if (!defined('txpinterface')) {
die('txpinterface is undefined.');
}
class alladmin_theme extends \Textpattern\Admin\Theme
{
function html_head()
{
$out[] = '<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">';
$out[] = '<link rel="stylesheet" href="'.$this->url.'assets/css/alladmin.css">';
$out[] = '<link rel="icon" href="'.$this->url.'assets/img/favicon.ico">';
$out[] = '<meta name="color-scheme" content="dark light">';
$out[] = '<meta name="generator" content="Textpattern CMS">';
$out[] = '<script defer src="'.$this->url.'assets/js/main.js"></script>'.n;
$out[] = '<script defer src="'.$this->url.'assets/js/alladmin-min.js"></script>'.n;
if (!defined('no_autosize')) {
$out[] = '<script defer src="'.$this->url.'assets/js/autosize.js"></script>'.n;
}
return join(n, $out);
}
function header()
{
$out[] = '<script src="'.$this->url.'assets/js/darkmode.js"></script>'.n;
global $txp_user;
$default_event = get_pref('default_event');
$homelink = span('Textpattern');
if (!empty($default_event) && has_privs($default_event)) {
$homelink = href($homelink, array('event' => $default_event));
}
$out[] = hed($homelink, 1);
if ($txp_user) {
$out[] = '<button class="txp-nav-toggle collapsed" type="button" data-toggle="collapse" data-target="#txp-nav" aria-expanded="false" aria-controls="txp-nav"><span class="txp-accessibility">'.gTxt('navigation').'</span></button>';
$out[] = '<nav class="txp-nav" id="txp-nav" aria-label="'.gTxt('navigation').'">';
$out[] = '<ul class="data-dropdown">';
$txpnavdrop = 0;
foreach ($this->menu as $tab) {
$txpnavdrop++;
$class = ($tab['active']) ? ' selected' : '';
$out[] = '<li class="dropdown'.$class.'">'.
n.href($tab['label'], '#',
' class="dropdown-toggle" id="txp-nav-drop'.$txpnavdrop.'" role="button" aria-controls="txp-nav-drop'.$txpnavdrop.'-menu" data-toggle="dropdown"');
if (!empty($tab['items'])) {
$out[] = '<ul class="dropdown-menu" id="txp-nav-drop'.$txpnavdrop.'-menu" role="menu" aria-labelledby="txp-nav-drop'.$txpnavdrop.'">';
foreach ($tab['items'] as $item) {
$class = ($item['active']) ? ' class="selected"' : '';
$ariacurrent = ($item['active']) ? ' aria-current="page"' : '';
$out[] = '<li'.$class.' role="presentation">'.
href($item['label'], array('event' => $item['event']), ' role="menuitem"'.$ariacurrent.' tabindex="-1"').
'</li>';
}
$out[] = '</ul>';
}
$out[] = '</li>';
}
$out[] = '</ul>';
$out[] = '</nav>';
if (get_pref('sitename')) {
$out[] = graf(
span(href(htmlspecialchars(get_pref('sitename')), hu, array(
'rel' => 'noopener',
'target' => '_blank',
'title' => gTxt('tab_view_site'),
'aria-label' => gTxt('tab_view_site'),
)), array('class' => 'txp-view-site-name'))
, array('class' => 'txp-view-site'));
} else {
$out[] = graf(
span(href(gTxt('tab_view_site'), hu, array(
'rel' => 'noopener',
'target' => '_blank',
)), array('class' => 'txp-view-site-name'))
, array('class' => 'txp-view-site'));
}
$out[] = graf(
href(span(gTxt('lightswitch'), array('class' => 'ui-icon ui-icon-lightbulb')), '#', array(
'id' => 'lightswitch',
'title' => gTxt('lightswitch'),
'aria-label' => gTxt('lightswitch'),
)), array('class' => 'txp-lightswitch'));
$out[] = graf(
href(gTxt('logout'), 'index.php?logout=1', ' onclick="return verify(\''.gTxt('are_you_sure').'\')"'), array('class' => 'txp-logout'));
}
return join(n, $out);
}
function footer()
{
$out[] = graf(
href('Textpattern CMS'.sp.span(gTxt('opens_external_link'), array('class' => 'ui-icon ui-icon-extlink')), 'https://textpattern.com/', array(
'rel' => 'external noopener',
'target' => '_blank',
)).
' (v'.txp_version.')', array('class' => 'mothership'));
$out[] = graf(href(gTxt('back_to_top'), '#'), array('class' => 'pagejump'));
return join(n, $out);
}
}