*/ class PageCustomize extends Page { private function isChecked ($key, $testedValue = 1) { $value = getCurrentOption ($key); if (is_array ($value)) { if (in_array ($testedValue, $value)) { return "checked='checked'"; } } else { if ($value == $testedValue) { return "checked='checked'"; } } return ""; } private function isSelected ($key, $value) { if (getCurrentOption ($key) == $value) { return "selected='selected'"; } return ""; } private function getStyleList () { $result = array (); foreach (glob ("templates/" . getCurrentTemplate () . "/styles/style-*.css") as $filename) { if (preg_match ('/styles\/style-(.*?)\.css/', $filename, $m)) { array_push ($result, $m [1]); } } return $result; } public function InitializeContent () { $this->title = localize ("customize.title"); $this->entryArray = array (); $ignoredBaseArray = array (PageQueryResult::SCOPE_AUTHOR, PageQueryResult::SCOPE_TAG, PageQueryResult::SCOPE_SERIES, PageQueryResult::SCOPE_PUBLISHER, PageQueryResult::SCOPE_RATING, "language"); $content = ""; array_push ($this->entryArray, new Entry ("Template", "", "Click to switch to Bootstrap", "text", array ())); if (!preg_match("/(Kobo|Kindle\/3.0|EBRD1101)/", $_SERVER['HTTP_USER_AGENT'])) { $content .= ''; } else { foreach ($this-> getStyleList () as $filename) { $content .= "isChecked ("style", $filename) . " />"; } } array_push ($this->entryArray, new Entry (localize ("customize.style"), "", $content, "text", array ())); if (!useServerSideRendering ()) { $content = 'isChecked ("use_fancyapps") . ' />'; array_push ($this->entryArray, new Entry (localize ("customize.fancybox"), "", $content, "text", array ())); } $content = ''; array_push ($this->entryArray, new Entry (localize ("customize.paging"), "", $content, "text", array ())); $content = ''; array_push ($this->entryArray, new Entry (localize ("customize.email"), "", $content, "text", array ())); $content = 'isChecked ("html_tag_filter") . ' />'; array_push ($this->entryArray, new Entry (localize ("customize.filter"), "", $content, "text", array ())); $content = ""; foreach ($ignoredBaseArray as $key) { $keyPlural = preg_replace ('/(ss)$/', 's', $key . "s"); $content .= 'isChecked ("ignored_categories", $key) . ' > ' . localize ("{$keyPlural}.title") . ' '; } array_push ($this->entryArray, new Entry (localize ("customize.ignored"), "", $content, "text", array ())); } }