Add color override option to URL (#6)
This commit is contained in:
parent
8827803bb3
commit
54dd701bee
@ -71,11 +71,15 @@ function get_page_url($echo = true, $slug = null) {
|
|||||||
if (isset($_GET['template'])) {
|
if (isset($_GET['template'])) {
|
||||||
$template = "&template=" . preg_replace("/[^A-Za-z0-9]/", '', $_GET['template']);
|
$template = "&template=" . preg_replace("/[^A-Za-z0-9]/", '', $_GET['template']);
|
||||||
}
|
}
|
||||||
|
$color = "";
|
||||||
|
if (isset($_GET['color'])) {
|
||||||
|
$color = "&color=" . preg_replace("/[^A-Za-z0-9]/", '', $_GET['color']);
|
||||||
|
}
|
||||||
$siteid = "";
|
$siteid = "";
|
||||||
if (isset($_GET['siteid'])) {
|
if (isset($_GET['siteid'])) {
|
||||||
$siteid = "&siteid=" . preg_replace("/[^0-9]/", '', $_GET['siteid']);
|
$siteid = "&siteid=" . preg_replace("/[^0-9]/", '', $_GET['siteid']);
|
||||||
}
|
}
|
||||||
$url = get_site_url(false) . "index.php?id=$slug$edit$theme$template$siteid";
|
$url = get_site_url(false) . "index.php?id=$slug$edit$theme$template$color$siteid";
|
||||||
if ($echo) {
|
if ($echo) {
|
||||||
echo $url;
|
echo $url;
|
||||||
} else {
|
} else {
|
||||||
@ -187,6 +191,9 @@ function get_theme_color_url($echo = true) {
|
|||||||
if ($site["color"] == null) {
|
if ($site["color"] == null) {
|
||||||
$site["color"] = "default";
|
$site["color"] = "default";
|
||||||
}
|
}
|
||||||
|
if (isset($_GET['color'])) {
|
||||||
|
$site['color'] = preg_replace("/[^A-Za-z0-9]/", '', $_GET['color']);
|
||||||
|
}
|
||||||
if (!file_exists(__DIR__ . "/../public/themes/" . SITE_THEME . "/colors/" . $site['color'])) {
|
if (!file_exists(__DIR__ . "/../public/themes/" . SITE_THEME . "/colors/" . $site['color'])) {
|
||||||
$site['color'] = "default";
|
$site['color'] = "default";
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user