Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion lib/PageCustomize.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@ private function isSelected ($key, $value) {
return "";
}

private function getTemplateList () {
$result = array ();
foreach (glob ("templates/*") as $filename) {
if (preg_match ('/templates\/(.*)/', $filename, $m)) {
array_push ($result, $m [1]);
}
}
return $result;
}

private function getStyleList () {
$result = array ();
foreach (glob ("templates/" . getCurrentTemplate () . "/styles/style-*.css") as $filename) {
Expand All @@ -52,9 +62,23 @@ public function InitializeContent ()
"language");

$content = "";
if (!preg_match("/(Kobo|Kindle\/3.0|EBRD1101)/", $_SERVER['HTTP_USER_AGENT'])) {
$content .= "<select id='template' onchange='updateCookie (this); window.location=$(\".headleft\").attr(\"href\");'>";

foreach ($this-> getTemplateList () as $filename) {
$content .= "<option value='{$filename}' " . $this->isSelected ("template", $filename) . ">{$filename}</option>";
}
$content .= '</select>';
} else {
foreach ($this-> getTemplateList () as $filename) {
$content .= "<input type='radio' onchange='updateCookieFromCheckbox (this); window.location=$(\".headleft\").attr(\"href\");' id='template' name='template' value='{$filename}' " . $this->isChecked ("template", $filename) . " /><label for='template-{$filename}'> {$filename} </label>";
}
}
array_push ($this->entryArray, new Entry ("Template", "",
"<span style='cursor: pointer;' onclick='$.cookie(\"template\", \"bootstrap\", { expires: 365 });window.location=$(\".headleft\").attr(\"href\");'>Click to switch to Bootstrap</span>", "text",
$content, "text",
array ()));

$content = "";
if (!preg_match("/(Kobo|Kindle\/3.0|EBRD1101)/", $_SERVER['HTTP_USER_AGENT'])) {
$content .= '<select id="style" onchange="updateCookie (this);">';
foreach ($this-> getStyleList () as $filename) {
Expand Down