Repository navigation
Expand file tree
/
Copy paththemechange.php
More file actions
150 lines (114 loc) · 4.5 KB
/
Copy paththemechange.php
File metadata and controls
150 lines (114 loc) · 4.5 KB
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
<?php if (!defined('PmWiki')) exit();
/* Copyright 2013 Michael Paulukonis
This file is themechange.php; part of the bootstrap skin for pmwiki 2
you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
by the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
*/
# set configs via actions....
/* TODO: say, it would be interesting (if not downright useful for my own website)
to be able to have a single-page theme markup
as in -- use on THIS PAGE ONLY
hrm.....
*/
global $Now, $CookiePrefix, $BootstrapThemeCookie, $BootstrapCoreCookie, $BootstrapNavbarCookie,
$BootstrapTheme, $BootstrapCore, $BootstrapNav;
# set cookie expire time (default 1 year)
SDV($BootstrapCookieExpires,$Now+60*60*24*365);
$prefix = $CookiePrefix.$SkinName.'_';
SDV($SkinCookie, $prefix.'settheme');
# bootstrap cookie routine
# settheme changes the skin "permanently" (until cookie expires)
# theme temporarily changes the theme, but will revert to the cookie-settings next time
# setcore/core permanently/temporarily changes the core Bootstrapp
SDV($BootstrapThemeCookie, $prefix.'settheme');
SDV($BootstrapCoreCookie, $prefix.'setcore');
if (isset($_GET['clearbootcookies'])) {
$expired = time()-3600;
setcookie($BootstrapThemeCookie, '', $expired);
setcookie($BootstrapCoreCookie, '',$expired);
setcookie($BootstrapNavbarCookie, '', $expired);
$ignorecookies = true;
}
if (!$ignorecookies && isset($_COOKIE[$BootstrapThemeCookie])) {
$theme = $_COOKIE[$BootstrapThemeCookie];
}
if (isset($_GET['settheme'])) {
$theme = $_GET['settheme'];
setcookie($BootstrapThemeCookie, $theme, $BootstrapCookieExpires, '/');
}
if (isset($_GET['theme'])) {
$theme = $_GET['theme'];
}
if (! isset($theme)) {
$theme = $BootstrapTheme;
}
if (!$ignorecookies && isset($_COOKIE[$BootstrapCoreCookie])) {
$core = $_COOKIE[$BootstrapCoreCookie];
}
if (isset($_GET['setcore'])) {
$core = $_GET['setcore'];
setcookie($BootstrapCoreCookie, $core, $BootstrapCookieExpires, '/');
}
if (isset($_GET['core'])) {
$core = $_GET['core'];
}
if (! isset($core)) {
$core = $BootstrapCore;
}
# presence of navbar cookie will over-ride any defaults that may be set per theme
# ie, darkstrap and default bootstrap use inverse. because I think it looks better
if (!$ignorecookies && isset($_COOKIE[$BootstrapNavbarCookie])) {
$navbar = $_COOKIE[$BootstrapNavbarCookie];
}
if (isset($_GET['setnavbar'])) {
$navbar = $_GET['setnavbar'];
setcookie($BootstrapNavbarCookie, $navbar, $BootstrapCookieExpires, '/');
}
if (isset($_GET['navbar'])) {
$navbar = $_GET['navbar'];
$navbar = ($navbar == 'inverse' ? 'navbar-inverse' : '');
}
if (! isset($navbar)) {
$navbar = $BootstrapNavbar;
$navbar = ($navbar == 'inverse' ? 'navbar-inverse' : '');
}
### end cookies
if ($core == 'compass') {
$HTMLHeaderFmt['core-css'] =
"<link href='$SkinDirUrl/css/screen.css' rel='stylesheet'>";
} else {
$HTMLHeaderFmt['core-css'] =
"<link href='$SkinDirUrl/css/bootstrap.css' rel='stylesheet'>
<link href='$SkinDirUrl/css/bootstrap-responsive.css' rel='stylesheet'>";
}
if ($theme == 'flatui') {
$HTMLHeaderFmt['option-css'] =
"<link href='$SkinDirUrl/css/flat-ui.css' rel='stylesheet'>";
if (! isset($navbar)) $navbar = 'navbar-inverse';
} else if ($theme =='bootstrap') {
$HTMLHeaderFmt['option-css'] = "";
if (! isset($navbar)) $navbar = '';
} else {
## check for existence of file $theme.cs and pmwiki.$theme.css
## use if the first one exists
## otherwise use the default bootstrap
if (file_exists("$SkinDir/css/$theme.css")) {
$HTMLHeaderFmt['option-css'] =
"<link href='$SkinDirUrl/css/$theme.css' rel='stylesheet'>";
} else {
$HTMLHeaderFmt['option-css'] = "";
}
if (file_exists("$SkinDir/css/pmwiki.$theme.css")) {
$HTMLHeaderFmt['option-css2'] =
"<link href='$SkinDirUrl/css/pmwiki.$theme.css' rel='stylesheet'>";
} else {
$HTMLHeaderFmt['option-css2'] = "";
}
if (! isset($navbar)) $navbar = '';
}
$PageNavStyle =
"<div id='wikihead' class='navbar $navbar navbar-fixed-top'>";
$HTMLHeaderFmt['end-css'] =
"<link href='$SkinDirUrl/css/pmwiki.css' rel='stylesheet' />";