@@ -55,11 +55,11 @@ |
||
55 | 55 | $this->entryArray = array (); |
56 | 56 | |
57 | 57 | $ignoredBaseArray = array (PageQueryResult::SCOPE_AUTHOR, |
58 | - PageQueryResult::SCOPE_TAG, |
|
59 | - PageQueryResult::SCOPE_SERIES, |
|
60 | - PageQueryResult::SCOPE_PUBLISHER, |
|
61 | - PageQueryResult::SCOPE_RATING, |
|
62 | - "language"); |
|
58 | + PageQueryResult::SCOPE_TAG, |
|
59 | + PageQueryResult::SCOPE_SERIES, |
|
60 | + PageQueryResult::SCOPE_PUBLISHER, |
|
61 | + PageQueryResult::SCOPE_RATING, |
|
62 | + "language"); |
|
63 | 63 | |
64 | 64 | $content = ""; |
65 | 65 | if (!preg_match("/(Kobo|Kindle\/3.0|EBRD1101)/", $_SERVER['HTTP_USER_AGENT'])) { |
@@ -8,10 +8,10 @@ discard block |
||
8 | 8 | |
9 | 9 | class PageCustomize extends Page |
10 | 10 | { |
11 | - private function isChecked ($key, $testedValue = 1) { |
|
12 | - $value = getCurrentOption ($key); |
|
13 | - if (is_array ($value)) { |
|
14 | - if (in_array ($testedValue, $value)) { |
|
11 | + private function isChecked($key, $testedValue = 1) { |
|
12 | + $value = getCurrentOption($key); |
|
13 | + if (is_array($value)) { |
|
14 | + if (in_array($testedValue, $value)) { |
|
15 | 15 | return "checked='checked'"; |
16 | 16 | } |
17 | 17 | } else { |
@@ -22,39 +22,39 @@ discard block |
||
22 | 22 | return ""; |
23 | 23 | } |
24 | 24 | |
25 | - private function isSelected ($key, $value) { |
|
26 | - if (getCurrentOption ($key) == $value) { |
|
25 | + private function isSelected($key, $value) { |
|
26 | + if (getCurrentOption($key) == $value) { |
|
27 | 27 | return "selected='selected'"; |
28 | 28 | } |
29 | 29 | return ""; |
30 | 30 | } |
31 | 31 | |
32 | - private function getTemplateList () { |
|
33 | - $result = array (); |
|
34 | - foreach (glob ("templates/*") as $filename) { |
|
35 | - if (preg_match ('/templates\/(.*)/', $filename, $m)) { |
|
36 | - array_push ($result, $m [1]); |
|
32 | + private function getTemplateList() { |
|
33 | + $result = array(); |
|
34 | + foreach (glob("templates/*") as $filename) { |
|
35 | + if (preg_match('/templates\/(.*)/', $filename, $m)) { |
|
36 | + array_push($result, $m [1]); |
|
37 | 37 | } |
38 | 38 | } |
39 | 39 | return $result; |
40 | 40 | } |
41 | 41 | |
42 | - private function getStyleList () { |
|
43 | - $result = array (); |
|
44 | - foreach (glob ("templates/" . getCurrentTemplate () . "/styles/style-*.css") as $filename) { |
|
45 | - if (preg_match ('/styles\/style-(.*?)\.css/', $filename, $m)) { |
|
46 | - array_push ($result, $m [1]); |
|
42 | + private function getStyleList() { |
|
43 | + $result = array(); |
|
44 | + foreach (glob("templates/" . getCurrentTemplate() . "/styles/style-*.css") as $filename) { |
|
45 | + if (preg_match('/styles\/style-(.*?)\.css/', $filename, $m)) { |
|
46 | + array_push($result, $m [1]); |
|
47 | 47 | } |
48 | 48 | } |
49 | 49 | return $result; |
50 | 50 | } |
51 | 51 | |
52 | - public function InitializeContent () |
|
52 | + public function InitializeContent() |
|
53 | 53 | { |
54 | - $this->title = localize ("customize.title"); |
|
55 | - $this->entryArray = array (); |
|
54 | + $this->title = localize("customize.title"); |
|
55 | + $this->entryArray = array(); |
|
56 | 56 | |
57 | - $ignoredBaseArray = array (PageQueryResult::SCOPE_AUTHOR, |
|
57 | + $ignoredBaseArray = array(PageQueryResult::SCOPE_AUTHOR, |
|
58 | 58 | PageQueryResult::SCOPE_TAG, |
59 | 59 | PageQueryResult::SCOPE_SERIES, |
60 | 60 | PageQueryResult::SCOPE_PUBLISHER, |
@@ -65,60 +65,60 @@ discard block |
||
65 | 65 | if (!preg_match("/(Kobo|Kindle\/3.0|EBRD1101)/", $_SERVER['HTTP_USER_AGENT'])) { |
66 | 66 | $content .= "<select id='template' onchange='updateCookie (this); window.location=$(\".headleft\").attr(\"href\");'>"; |
67 | 67 | |
68 | - foreach ($this-> getTemplateList () as $filename) { |
|
69 | - $content .= "<option value='{$filename}' " . $this->isSelected ("template", $filename) . ">{$filename}</option>"; |
|
68 | + foreach ($this-> getTemplateList() as $filename) { |
|
69 | + $content .= "<option value='{$filename}' " . $this->isSelected("template", $filename) . ">{$filename}</option>"; |
|
70 | 70 | } |
71 | 71 | $content .= '</select>'; |
72 | 72 | } else { |
73 | - foreach ($this-> getTemplateList () as $filename) { |
|
74 | - $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>"; |
|
73 | + foreach ($this-> getTemplateList() as $filename) { |
|
74 | + $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>"; |
|
75 | 75 | } |
76 | 76 | } |
77 | - array_push ($this->entryArray, new Entry ("Template", "", |
|
77 | + array_push($this->entryArray, new Entry("Template", "", |
|
78 | 78 | $content, "text", |
79 | - array ())); |
|
79 | + array())); |
|
80 | 80 | |
81 | 81 | $content = ""; |
82 | 82 | if (!preg_match("/(Kobo|Kindle\/3.0|EBRD1101)/", $_SERVER['HTTP_USER_AGENT'])) { |
83 | 83 | $content .= '<select id="style" onchange="updateCookie (this);">'; |
84 | - foreach ($this-> getStyleList () as $filename) { |
|
85 | - $content .= "<option value='{$filename}' " . $this->isSelected ("style", $filename) . ">{$filename}</option>"; |
|
84 | + foreach ($this-> getStyleList() as $filename) { |
|
85 | + $content .= "<option value='{$filename}' " . $this->isSelected("style", $filename) . ">{$filename}</option>"; |
|
86 | 86 | } |
87 | 87 | $content .= '</select>'; |
88 | 88 | } else { |
89 | - foreach ($this-> getStyleList () as $filename) { |
|
90 | - $content .= "<input type='radio' onchange='updateCookieFromCheckbox (this);' id='style-{$filename}' name='style' value='{$filename}' " . $this->isChecked ("style", $filename) . " /><label for='style-{$filename}'> {$filename} </label>"; |
|
89 | + foreach ($this-> getStyleList() as $filename) { |
|
90 | + $content .= "<input type='radio' onchange='updateCookieFromCheckbox (this);' id='style-{$filename}' name='style' value='{$filename}' " . $this->isChecked("style", $filename) . " /><label for='style-{$filename}'> {$filename} </label>"; |
|
91 | 91 | } |
92 | 92 | } |
93 | - array_push ($this->entryArray, new Entry (localize ("customize.style"), "", |
|
93 | + array_push($this->entryArray, new Entry(localize("customize.style"), "", |
|
94 | 94 | $content, "text", |
95 | - array ())); |
|
96 | - if (!useServerSideRendering ()) { |
|
97 | - $content = '<input type="checkbox" onchange="updateCookieFromCheckbox (this);" id="use_fancyapps" ' . $this->isChecked ("use_fancyapps") . ' />'; |
|
98 | - array_push ($this->entryArray, new Entry (localize ("customize.fancybox"), "", |
|
95 | + array())); |
|
96 | + if (!useServerSideRendering()) { |
|
97 | + $content = '<input type="checkbox" onchange="updateCookieFromCheckbox (this);" id="use_fancyapps" ' . $this->isChecked("use_fancyapps") . ' />'; |
|
98 | + array_push($this->entryArray, new Entry(localize("customize.fancybox"), "", |
|
99 | 99 | $content, "text", |
100 | - array ())); |
|
100 | + array())); |
|
101 | 101 | } |
102 | - $content = '<input type="number" onchange="updateCookie (this);" id="max_item_per_page" value="' . getCurrentOption ("max_item_per_page") . '" min="-1" max="1200" pattern="^[-+]?[0-9]+$" />'; |
|
103 | - array_push ($this->entryArray, new Entry (localize ("customize.paging"), "", |
|
102 | + $content = '<input type="number" onchange="updateCookie (this);" id="max_item_per_page" value="' . getCurrentOption("max_item_per_page") . '" min="-1" max="1200" pattern="^[-+]?[0-9]+$" />'; |
|
103 | + array_push($this->entryArray, new Entry(localize("customize.paging"), "", |
|
104 | 104 | $content, "text", |
105 | - array ())); |
|
106 | - $content = '<input type="text" onchange="updateCookie (this);" id="email" value="' . getCurrentOption ("email") . '" />'; |
|
107 | - array_push ($this->entryArray, new Entry (localize ("customize.email"), "", |
|
105 | + array())); |
|
106 | + $content = '<input type="text" onchange="updateCookie (this);" id="email" value="' . getCurrentOption("email") . '" />'; |
|
107 | + array_push($this->entryArray, new Entry(localize("customize.email"), "", |
|
108 | 108 | $content, "text", |
109 | - array ())); |
|
110 | - $content = '<input type="checkbox" onchange="updateCookieFromCheckbox (this);" id="html_tag_filter" ' . $this->isChecked ("html_tag_filter") . ' />'; |
|
111 | - array_push ($this->entryArray, new Entry (localize ("customize.filter"), "", |
|
109 | + array())); |
|
110 | + $content = '<input type="checkbox" onchange="updateCookieFromCheckbox (this);" id="html_tag_filter" ' . $this->isChecked("html_tag_filter") . ' />'; |
|
111 | + array_push($this->entryArray, new Entry(localize("customize.filter"), "", |
|
112 | 112 | $content, "text", |
113 | - array ())); |
|
113 | + array())); |
|
114 | 114 | $content = ""; |
115 | 115 | foreach ($ignoredBaseArray as $key) { |
116 | - $keyPlural = preg_replace ('/(ss)$/', 's', $key . "s"); |
|
117 | - $content .= '<input type="checkbox" name="ignored_categories[]" onchange="updateCookieFromCheckboxGroup (this);" id="ignored_categories_' . $key . '" ' . $this->isChecked ("ignored_categories", $key) . ' > ' . localize ("{$keyPlural}.title") . '</input> '; |
|
116 | + $keyPlural = preg_replace('/(ss)$/', 's', $key . "s"); |
|
117 | + $content .= '<input type="checkbox" name="ignored_categories[]" onchange="updateCookieFromCheckboxGroup (this);" id="ignored_categories_' . $key . '" ' . $this->isChecked("ignored_categories", $key) . ' > ' . localize("{$keyPlural}.title") . '</input> '; |
|
118 | 118 | } |
119 | 119 | |
120 | - array_push ($this->entryArray, new Entry (localize ("customize.ignored"), "", |
|
120 | + array_push($this->entryArray, new Entry(localize("customize.ignored"), "", |
|
121 | 121 | $content, "text", |
122 | - array ())); |
|
122 | + array())); |
|
123 | 123 | } |
124 | 124 | } |
@@ -8,7 +8,8 @@ discard block |
||
8 | 8 | |
9 | 9 | class PageCustomize extends Page |
10 | 10 | { |
11 | - private function isChecked ($key, $testedValue = 1) { |
|
11 | + private function isChecked ($key, $testedValue = 1) |
|
12 | + { |
|
12 | 13 | $value = getCurrentOption ($key); |
13 | 14 | if (is_array ($value)) { |
14 | 15 | if (in_array ($testedValue, $value)) { |
@@ -22,14 +23,16 @@ discard block |
||
22 | 23 | return ""; |
23 | 24 | } |
24 | 25 | |
25 | - private function isSelected ($key, $value) { |
|
26 | + private function isSelected ($key, $value) |
|
27 | + { |
|
26 | 28 | if (getCurrentOption ($key) == $value) { |
27 | 29 | return "selected='selected'"; |
28 | 30 | } |
29 | 31 | return ""; |
30 | 32 | } |
31 | 33 | |
32 | - private function getTemplateList () { |
|
34 | + private function getTemplateList () |
|
35 | + { |
|
33 | 36 | $result = array (); |
34 | 37 | foreach (glob ("templates/*") as $filename) { |
35 | 38 | if (preg_match ('/templates\/(.*)/', $filename, $m)) { |
@@ -39,7 +42,8 @@ discard block |
||
39 | 42 | return $result; |
40 | 43 | } |
41 | 44 | |
42 | - private function getStyleList () { |
|
45 | + private function getStyleList () |
|
46 | + { |
|
43 | 47 | $result = array (); |
44 | 48 | foreach (glob ("templates/" . getCurrentTemplate () . "/styles/style-*.css") as $filename) { |
45 | 49 | if (preg_match ('/styles\/style-(.*?)\.css/', $filename, $m)) { |