@@ -15,9 +15,9 @@ |
||
15 | 15 | // 3. plugin classes are loaded by PluginHandler from plugins.local/ and plugins/ (TODO: use generic autoloader?) |
16 | 16 | |
17 | 17 | if ($namespace && $class_name) { |
18 | - $class_file = "$root_dir/vendor/$namespace/" . str_replace('\\', '/', $class_name) . ".php"; |
|
18 | + $class_file = "$root_dir/vendor/$namespace/".str_replace('\\', '/', $class_name).".php"; |
|
19 | 19 | } else { |
20 | - $class_file = "$root_dir/classes/" . str_replace("_", "/", strtolower($class)) . ".php"; |
|
20 | + $class_file = "$root_dir/classes/".str_replace("_", "/", strtolower($class)).".php"; |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | if (file_exists($class_file)) |
@@ -5,8 +5,9 @@ discard block |
||
5 | 5 | $namespace = ''; |
6 | 6 | $class_name = $class; |
7 | 7 | |
8 | - if (strpos($class, '\\') !== FALSE) |
|
9 | - list ($namespace, $class_name) = explode('\\', $class, 2); |
|
8 | + if (strpos($class, '\\') !== FALSE) { |
|
9 | + list ($namespace, $class_name) = explode('\\', $class, 2); |
|
10 | + } |
|
10 | 11 | |
11 | 12 | $root_dir = dirname(__DIR__); // we're in tt-rss/include |
12 | 13 | |
@@ -20,7 +21,8 @@ discard block |
||
20 | 21 | $class_file = "$root_dir/classes/" . str_replace("_", "/", strtolower($class)) . ".php"; |
21 | 22 | } |
22 | 23 | |
23 | - if (file_exists($class_file)) |
|
24 | - include $class_file; |
|
24 | + if (file_exists($class_file)) { |
|
25 | + include $class_file; |
|
26 | + } |
|
25 | 27 | |
26 | 28 | }); |
@@ -1,3 +1,3 @@ |
||
1 | 1 | <?php # This file has been generated at: Thu Nov 22 22:14:43 MSK 2018 |
2 | 2 | define('GENERATED_CONFIG_CHECK', 26); |
3 | -$required_defines = array( 'DB_TYPE', 'DB_HOST', 'DB_USER', 'DB_NAME', 'DB_PASS', 'MYSQL_CHARSET', 'SELF_URL_PATH', 'SINGLE_USER_MODE', 'SIMPLE_UPDATE_MODE', 'PHP_EXECUTABLE', 'LOCK_DIRECTORY', 'CACHE_DIR', 'ICONS_DIR', 'ICONS_URL', 'AUTH_AUTO_CREATE', 'AUTH_AUTO_LOGIN', 'FORCE_ARTICLE_PURGE', 'SPHINX_SERVER', 'SPHINX_INDEX', 'ENABLE_REGISTRATION', 'REG_NOTIFY_ADDRESS', 'REG_MAX_USERS', 'SESSION_COOKIE_LIFETIME', 'SMTP_FROM_NAME', 'SMTP_FROM_ADDRESS', 'DIGEST_SUBJECT', 'CHECK_FOR_UPDATES', 'ENABLE_GZIP_OUTPUT', 'PLUGINS', 'LOG_DESTINATION', 'CONFIG_VERSION'); ?> |
|
3 | +$required_defines = array('DB_TYPE', 'DB_HOST', 'DB_USER', 'DB_NAME', 'DB_PASS', 'MYSQL_CHARSET', 'SELF_URL_PATH', 'SINGLE_USER_MODE', 'SIMPLE_UPDATE_MODE', 'PHP_EXECUTABLE', 'LOCK_DIRECTORY', 'CACHE_DIR', 'ICONS_DIR', 'ICONS_URL', 'AUTH_AUTO_CREATE', 'AUTH_AUTO_LOGIN', 'FORCE_ARTICLE_PURGE', 'SPHINX_SERVER', 'SPHINX_INDEX', 'ENABLE_REGISTRATION', 'REG_NOTIFY_ADDRESS', 'REG_MAX_USERS', 'SESSION_COOKIE_LIFETIME', 'SMTP_FROM_NAME', 'SMTP_FROM_ADDRESS', 'DIGEST_SUBJECT', 'CHECK_FOR_UPDATES', 'ENABLE_GZIP_OUTPUT', 'PLUGINS', 'LOG_DESTINATION', 'CONFIG_VERSION'); ?> |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | |
77 | 77 | $pdo = DB::pdo(); |
78 | 78 | |
79 | - print_r(in_array("CAT:6",$default_ids)); |
|
79 | + print_r(in_array("CAT:6", $default_ids)); |
|
80 | 80 | |
81 | 81 | if (!$root_id) { |
82 | 82 | print "<select multiple=\true\" id=\"$id\" name=\"$id\" $attributes>"; |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | while ($line = $sth->fetch()) { |
103 | 103 | |
104 | 104 | for ($i = 0; $i < $nest_level; $i++) |
105 | - $line["title"] = " - " . $line["title"]; |
|
105 | + $line["title"] = " - ".$line["title"]; |
|
106 | 106 | |
107 | 107 | $is_selected = in_array("CAT:".$line["id"], $default_ids) ? "selected=\"1\"" : ""; |
108 | 108 | |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | |
112 | 112 | if ($line["num_children"] > 0) |
113 | 113 | print_feed_multi_select($id, $default_ids, $attributes, |
114 | - $include_all_feeds, $line["id"], $nest_level+1); |
|
114 | + $include_all_feeds, $line["id"], $nest_level + 1); |
|
115 | 115 | |
116 | 116 | $f_sth = $pdo->prepare("SELECT id,title FROM ttrss_feeds |
117 | 117 | WHERE cat_id = ? AND owner_uid = ? ORDER BY title"); |
@@ -121,10 +121,10 @@ discard block |
||
121 | 121 | while ($fline = $f_sth->fetch()) { |
122 | 122 | $is_selected = (in_array($fline["id"], $default_ids)) ? "selected=\"1\"" : ""; |
123 | 123 | |
124 | - $fline["title"] = " + " . $fline["title"]; |
|
124 | + $fline["title"] = " + ".$fline["title"]; |
|
125 | 125 | |
126 | 126 | for ($i = 0; $i < $nest_level; $i++) |
127 | - $fline["title"] = " - " . $fline["title"]; |
|
127 | + $fline["title"] = " - ".$fline["title"]; |
|
128 | 128 | |
129 | 129 | printf("<option $is_selected value='%d'>%s</option>", |
130 | 130 | $fline["id"], htmlspecialchars($fline["title"])); |
@@ -144,10 +144,10 @@ discard block |
||
144 | 144 | while ($fline = $f_sth->fetch()) { |
145 | 145 | $is_selected = in_array($fline["id"], $default_ids) ? "selected=\"1\"" : ""; |
146 | 146 | |
147 | - $fline["title"] = " + " . $fline["title"]; |
|
147 | + $fline["title"] = " + ".$fline["title"]; |
|
148 | 148 | |
149 | 149 | for ($i = 0; $i < $nest_level; $i++) |
150 | - $fline["title"] = " - " . $fline["title"]; |
|
150 | + $fline["title"] = " - ".$fline["title"]; |
|
151 | 151 | |
152 | 152 | printf("<option $is_selected value='%d'>%s</option>", |
153 | 153 | $fline["id"], htmlspecialchars($fline["title"])); |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | } |
205 | 205 | |
206 | 206 | for ($i = 0; $i < $nest_level; $i++) |
207 | - $line["title"] = " - " . $line["title"]; |
|
207 | + $line["title"] = " - ".$line["title"]; |
|
208 | 208 | |
209 | 209 | if ($line["title"]) |
210 | 210 | printf("<option $is_selected value='%d'>%s</option>", |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | |
213 | 213 | if ($line["num_children"] > 0) |
214 | 214 | print_feed_cat_select($id, $default_id, $attributes, |
215 | - $include_all_cats, $line["id"], $nest_level+1); |
|
215 | + $include_all_cats, $line["id"], $nest_level + 1); |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | if (!$root_id) { |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | $query = ""; |
246 | 246 | |
247 | 247 | if (!(strpos($filename, "?") === FALSE)) { |
248 | - $query = substr($filename, strpos($filename, "?")+1); |
|
248 | + $query = substr($filename, strpos($filename, "?") + 1); |
|
249 | 249 | $filename = substr($filename, 0, strpos($filename, "?")); |
250 | 250 | } |
251 | 251 | |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | } |
301 | 301 | |
302 | 302 | if ($entry) $entry .= "<a target=\"_blank\" rel=\"noopener noreferrer\" |
303 | - href=\"$url\">" . basename($url) . "</a>"; |
|
303 | + href=\"$url\">".basename($url)."</a>"; |
|
304 | 304 | |
305 | 305 | $entry .= "</div>"; |
306 | 306 | |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | WHERE owner_uid = ? ORDER BY caption"); |
320 | 320 | $sth->execute([$_SESSION['uid']]); |
321 | 321 | |
322 | - print "<select default=\"$value\" name=\"" . htmlspecialchars($name) . |
|
322 | + print "<select default=\"$value\" name=\"".htmlspecialchars($name). |
|
323 | 323 | "\" $attributes>"; |
324 | 324 | |
325 | 325 | while ($line = $sth->fetch()) { |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | $issel = ($line["caption"] == $value) ? "selected=\"1\"" : ""; |
328 | 328 | |
329 | 329 | print "<option value=\"".htmlspecialchars($line["caption"])."\" |
330 | - $issel>" . htmlspecialchars($line["caption"]) . "</option>"; |
|
330 | + $issel>".htmlspecialchars($line["caption"])."</option>"; |
|
331 | 331 | |
332 | 332 | } |
333 | 333 |
@@ -1,14 +1,17 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | function print_select($id, $default, $values, $attributes = "", $name = "") { |
4 | - if (!$name) $name = $id; |
|
4 | + if (!$name) { |
|
5 | + $name = $id; |
|
6 | + } |
|
5 | 7 | |
6 | 8 | print "<select name=\"$name\" id=\"$id\" $attributes>"; |
7 | 9 | foreach ($values as $v) { |
8 | - if ($v == $default) |
|
9 | - $sel = "selected=\"1\""; |
|
10 | - else |
|
11 | - $sel = ""; |
|
10 | + if ($v == $default) { |
|
11 | + $sel = "selected=\"1\""; |
|
12 | + } else { |
|
13 | + $sel = ""; |
|
14 | + } |
|
12 | 15 | |
13 | 16 | $v = trim($v); |
14 | 17 | |
@@ -18,14 +21,17 @@ discard block |
||
18 | 21 | } |
19 | 22 | |
20 | 23 | function print_select_hash($id, $default, $values, $attributes = "", $name = "") { |
21 | - if (!$name) $name = $id; |
|
24 | + if (!$name) { |
|
25 | + $name = $id; |
|
26 | + } |
|
22 | 27 | |
23 | 28 | print "<select name=\"$name\" id='$id' $attributes>"; |
24 | 29 | foreach (array_keys($values) as $v) { |
25 | - if ($v == $default) |
|
26 | - $sel = 'selected="selected"'; |
|
27 | - else |
|
28 | - $sel = ""; |
|
30 | + if ($v == $default) { |
|
31 | + $sel = 'selected="selected"'; |
|
32 | + } else { |
|
33 | + $sel = ""; |
|
34 | + } |
|
29 | 35 | |
30 | 36 | $v = trim($v); |
31 | 37 | |
@@ -53,10 +59,11 @@ discard block |
||
53 | 59 | function print_radio($id, $default, $true_is, $values, $attributes = "") { |
54 | 60 | foreach ($values as $v) { |
55 | 61 | |
56 | - if ($v == $default) |
|
57 | - $sel = "checked"; |
|
58 | - else |
|
59 | - $sel = ""; |
|
62 | + if ($v == $default) { |
|
63 | + $sel = "checked"; |
|
64 | + } else { |
|
65 | + $sel = ""; |
|
66 | + } |
|
60 | 67 | |
61 | 68 | if ($v == $true_is) { |
62 | 69 | $sel .= " value=\"1\""; |
@@ -88,7 +95,9 @@ discard block |
||
88 | 95 | |
89 | 96 | if (get_pref('ENABLE_FEED_CATS')) { |
90 | 97 | |
91 | - if (!$root_id) $root_id = null; |
|
98 | + if (!$root_id) { |
|
99 | + $root_id = null; |
|
100 | + } |
|
92 | 101 | |
93 | 102 | $sth = $pdo->prepare("SELECT id,title, |
94 | 103 | (SELECT COUNT(id) FROM ttrss_feed_categories AS c2 WHERE |
@@ -101,17 +110,19 @@ discard block |
||
101 | 110 | |
102 | 111 | while ($line = $sth->fetch()) { |
103 | 112 | |
104 | - for ($i = 0; $i < $nest_level; $i++) |
|
105 | - $line["title"] = " - " . $line["title"]; |
|
113 | + for ($i = 0; $i < $nest_level; $i++) { |
|
114 | + $line["title"] = " - " . $line["title"]; |
|
115 | + } |
|
106 | 116 | |
107 | 117 | $is_selected = in_array("CAT:".$line["id"], $default_ids) ? "selected=\"1\"" : ""; |
108 | 118 | |
109 | 119 | printf("<option $is_selected value='CAT:%d'>%s</option>", |
110 | 120 | $line["id"], htmlspecialchars($line["title"])); |
111 | 121 | |
112 | - if ($line["num_children"] > 0) |
|
113 | - print_feed_multi_select($id, $default_ids, $attributes, |
|
122 | + if ($line["num_children"] > 0) { |
|
123 | + print_feed_multi_select($id, $default_ids, $attributes, |
|
114 | 124 | $include_all_feeds, $line["id"], $nest_level+1); |
125 | + } |
|
115 | 126 | |
116 | 127 | $f_sth = $pdo->prepare("SELECT id,title FROM ttrss_feeds |
117 | 128 | WHERE cat_id = ? AND owner_uid = ? ORDER BY title"); |
@@ -123,8 +134,9 @@ discard block |
||
123 | 134 | |
124 | 135 | $fline["title"] = " + " . $fline["title"]; |
125 | 136 | |
126 | - for ($i = 0; $i < $nest_level; $i++) |
|
127 | - $fline["title"] = " - " . $fline["title"]; |
|
137 | + for ($i = 0; $i < $nest_level; $i++) { |
|
138 | + $fline["title"] = " - " . $fline["title"]; |
|
139 | + } |
|
128 | 140 | |
129 | 141 | printf("<option $is_selected value='%d'>%s</option>", |
130 | 142 | $fline["id"], htmlspecialchars($fline["title"])); |
@@ -146,8 +158,9 @@ discard block |
||
146 | 158 | |
147 | 159 | $fline["title"] = " + " . $fline["title"]; |
148 | 160 | |
149 | - for ($i = 0; $i < $nest_level; $i++) |
|
150 | - $fline["title"] = " - " . $fline["title"]; |
|
161 | + for ($i = 0; $i < $nest_level; $i++) { |
|
162 | + $fline["title"] = " - " . $fline["title"]; |
|
163 | + } |
|
151 | 164 | |
152 | 165 | printf("<option $is_selected value='%d'>%s</option>", |
153 | 166 | $fline["id"], htmlspecialchars($fline["title"])); |
@@ -182,7 +195,9 @@ discard block |
||
182 | 195 | |
183 | 196 | $pdo = DB::pdo(); |
184 | 197 | |
185 | - if (!$root_id) $root_id = null; |
|
198 | + if (!$root_id) { |
|
199 | + $root_id = null; |
|
200 | + } |
|
186 | 201 | |
187 | 202 | $sth = $pdo->prepare("SELECT id,title, |
188 | 203 | (SELECT COUNT(id) FROM ttrss_feed_categories AS c2 WHERE |
@@ -203,16 +218,19 @@ discard block |
||
203 | 218 | $is_selected = ""; |
204 | 219 | } |
205 | 220 | |
206 | - for ($i = 0; $i < $nest_level; $i++) |
|
207 | - $line["title"] = " - " . $line["title"]; |
|
221 | + for ($i = 0; $i < $nest_level; $i++) { |
|
222 | + $line["title"] = " - " . $line["title"]; |
|
223 | + } |
|
208 | 224 | |
209 | - if ($line["title"]) |
|
210 | - printf("<option $is_selected value='%d'>%s</option>", |
|
225 | + if ($line["title"]) { |
|
226 | + printf("<option $is_selected value='%d'>%s</option>", |
|
211 | 227 | $line["id"], htmlspecialchars($line["title"])); |
228 | + } |
|
212 | 229 | |
213 | - if ($line["num_children"] > 0) |
|
214 | - print_feed_cat_select($id, $default_id, $attributes, |
|
230 | + if ($line["num_children"] > 0) { |
|
231 | + print_feed_cat_select($id, $default_id, $attributes, |
|
215 | 232 | $include_all_cats, $line["id"], $nest_level+1); |
233 | + } |
|
216 | 234 | } |
217 | 235 | |
218 | 236 | if (!$root_id) { |
@@ -251,7 +269,9 @@ discard block |
||
251 | 269 | |
252 | 270 | $timestamp = filemtime($filename); |
253 | 271 | |
254 | - if ($query) $timestamp .= "&$query"; |
|
272 | + if ($query) { |
|
273 | + $timestamp .= "&$query"; |
|
274 | + } |
|
255 | 275 | |
256 | 276 | return "<script type=\"text/javascript\" charset=\"utf-8\" src=\"$filename?$timestamp\"></script>\n"; |
257 | 277 | } |
@@ -299,8 +319,10 @@ discard block |
||
299 | 319 | |
300 | 320 | } |
301 | 321 | |
302 | - if ($entry) $entry .= "<a target=\"_blank\" rel=\"noopener noreferrer\" |
|
322 | + if ($entry) { |
|
323 | + $entry .= "<a target=\"_blank\" rel=\"noopener noreferrer\" |
|
303 | 324 | href=\"$url\">" . basename($url) . "</a>"; |
325 | + } |
|
304 | 326 | |
305 | 327 | $entry .= "</div>"; |
306 | 328 |
@@ -13,12 +13,12 @@ discard block |
||
13 | 13 | if (!is_object($a)) { |
14 | 14 | array_push($fmt_args, $a); |
15 | 15 | } else { |
16 | - array_push($fmt_args, "[" . get_class($a) . "]"); |
|
16 | + array_push($fmt_args, "[".get_class($a)."]"); |
|
17 | 17 | } |
18 | 18 | } |
19 | 19 | } |
20 | 20 | |
21 | - $filename = str_replace(dirname(__DIR__) . "/", "", $e["file"]); |
|
21 | + $filename = str_replace(dirname(__DIR__)."/", "", $e["file"]); |
|
22 | 22 | |
23 | 23 | $rv .= sprintf("%d. %s(%s): %s(%s)\n", |
24 | 24 | $idx, $filename, $e["line"], $e["function"], implode(", ", $fmt_args)); |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | $errno = $error["type"]; |
53 | 53 | $file = $error["file"]; |
54 | 54 | $line = $error["line"]; |
55 | - $errstr = $error["message"]; |
|
55 | + $errstr = $error["message"]; |
|
56 | 56 | |
57 | 57 | if (!$errno) return false; |
58 | 58 |
@@ -32,16 +32,19 @@ discard block |
||
32 | 32 | } |
33 | 33 | |
34 | 34 | function ttrss_error_handler($errno, $errstr, $file, $line, $context) { |
35 | - if (error_reporting() == 0 || !$errno) return false; |
|
35 | + if (error_reporting() == 0 || !$errno) { |
|
36 | + return false; |
|
37 | + } |
|
36 | 38 | |
37 | 39 | $file = substr(str_replace(dirname(dirname(__FILE__)), "", $file), 1); |
38 | 40 | |
39 | 41 | $context = format_backtrace(debug_backtrace()); |
40 | 42 | $errstr = truncate_middle($errstr, 16384, " (...) "); |
41 | 43 | |
42 | - if (class_exists("Logger")) |
|
43 | - return Logger::get()->log_error($errno, $errstr, $file, $line, $context); |
|
44 | -} |
|
44 | + if (class_exists("Logger")) { |
|
45 | + return Logger::get()->log_error($errno, $errstr, $file, $line, $context); |
|
46 | + } |
|
47 | + } |
|
45 | 48 | |
46 | 49 | function ttrss_fatal_handler() { |
47 | 50 | global $last_query; |
@@ -54,16 +57,21 @@ discard block |
||
54 | 57 | $line = $error["line"]; |
55 | 58 | $errstr = $error["message"]; |
56 | 59 | |
57 | - if (!$errno) return false; |
|
60 | + if (!$errno) { |
|
61 | + return false; |
|
62 | + } |
|
58 | 63 | |
59 | 64 | $context = format_backtrace(debug_backtrace()); |
60 | 65 | |
61 | 66 | $file = substr(str_replace(dirname(dirname(__FILE__)), "", $file), 1); |
62 | 67 | |
63 | - if ($last_query) $errstr .= " [Last query: $last_query]"; |
|
68 | + if ($last_query) { |
|
69 | + $errstr .= " [Last query: $last_query]"; |
|
70 | + } |
|
64 | 71 | |
65 | - if (class_exists("Logger")) |
|
66 | - return Logger::get()->log_error($errno, $errstr, $file, $line, $context); |
|
72 | + if (class_exists("Logger")) { |
|
73 | + return Logger::get()->log_error($errno, $errstr, $file, $line, $context); |
|
74 | + } |
|
67 | 75 | } |
68 | 76 | |
69 | 77 | return false; |
@@ -153,9 +153,9 @@ |
||
153 | 153 | title="<i class='material-icons'>info_outline</i> <?php echo __('System') ?>"></div> |
154 | 154 | <?php } ?> |
155 | 155 | <?php |
156 | - PluginHost::getInstance()->run_hooks(PluginHost::HOOK_PREFS_TABS, |
|
157 | - "hook_prefs_tabs", false); |
|
158 | - ?> |
|
156 | + PluginHost::getInstance()->run_hooks(PluginHost::HOOK_PREFS_TABS, |
|
157 | + "hook_prefs_tabs", false); |
|
158 | + ?> |
|
159 | 159 | </div> |
160 | 160 | <div id="footer" dojoType="dijit.layout.ContentPane" region="bottom"> |
161 | 161 | <a class="text-muted" target="_blank" href="http://tt-rss.org/"> |
@@ -3,7 +3,7 @@ |
||
3 | 3 | header("Location: install/"); |
4 | 4 | } |
5 | 5 | |
6 | - set_include_path(dirname(__FILE__) ."/include" . PATH_SEPARATOR . |
|
6 | + set_include_path(dirname(__FILE__)."/include".PATH_SEPARATOR. |
|
7 | 7 | get_include_path()); |
8 | 8 | |
9 | 9 | if (!file_exists("config.php")) { |
@@ -19,7 +19,9 @@ |
||
19 | 19 | require_once "config.php"; |
20 | 20 | require_once "db-prefs.php"; |
21 | 21 | |
22 | - if (!init_plugins()) return; |
|
22 | + if (!init_plugins()) { |
|
23 | + return; |
|
24 | + } |
|
23 | 25 | |
24 | 26 | login_sequence(); |
25 | 27 |
@@ -19,7 +19,7 @@ |
||
19 | 19 | } |
20 | 20 | |
21 | 21 | function get_js() { |
22 | - return file_get_contents(dirname(__FILE__) . "/init.js"); |
|
22 | + return file_get_contents(dirname(__FILE__)."/init.js"); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | function hook_render_article($article) { |
@@ -47,7 +47,9 @@ |
||
47 | 47 | } |
48 | 48 | |
49 | 49 | function hook_prefs_tab($args) { |
50 | - if ($args != "prefPrefs") return; |
|
50 | + if ($args != "prefPrefs") { |
|
51 | + return; |
|
52 | + } |
|
51 | 53 | |
52 | 54 | print "<div dojoType=\"dijit.layout.AccordionPane\" |
53 | 55 | title=\"<i class='material-icons'>extension</i> ".__("NSFW Plugin")."\">"; |
@@ -69,7 +69,7 @@ |
||
69 | 69 | |
70 | 70 | $real_url = preg_replace("/\?$/", "", $real_url); |
71 | 71 | |
72 | - $article["plugin_data"] = "unburn,$owner_uid:" . $article["plugin_data"]; |
|
72 | + $article["plugin_data"] = "unburn,$owner_uid:".$article["plugin_data"]; |
|
73 | 73 | $article["link"] = $real_url; |
74 | 74 | } |
75 | 75 | } |
@@ -21,8 +21,9 @@ discard block |
||
21 | 21 | function hook_article_filter($article) { |
22 | 22 | $owner_uid = $article["owner_uid"]; |
23 | 23 | |
24 | - if (defined('NO_CURL') || !function_exists("curl_init") || ini_get("open_basedir")) |
|
25 | - return $article; |
|
24 | + if (defined('NO_CURL') || !function_exists("curl_init") || ini_get("open_basedir")) { |
|
25 | + return $article; |
|
26 | + } |
|
26 | 27 | |
27 | 28 | if ((strpos($article["link"], "feedproxy.google.com") !== FALSE || |
28 | 29 | strpos($article["link"], "/~r/") !== FALSE || |
@@ -57,7 +58,9 @@ discard block |
||
57 | 58 | parse_str($query, $args); |
58 | 59 | |
59 | 60 | foreach (array("utm_source", "utm_medium", "utm_campaign") as $param) { |
60 | - if (isset($args[$param])) unset($args[$param]); |
|
61 | + if (isset($args[$param])) { |
|
62 | + unset($args[$param]); |
|
63 | + } |
|
61 | 64 | } |
62 | 65 | |
63 | 66 | $new_query = http_build_query($args); |
@@ -3,21 +3,21 @@ |
||
3 | 3 | private $host; |
4 | 4 | |
5 | 5 | function about() { |
6 | - return array(1.0, |
|
6 | + return array(1.0, |
|
7 | 7 | "Easy feed subscription and web page sharing using bookmarklets", |
8 | 8 | "fox", |
9 | - false, |
|
9 | + false, |
|
10 | 10 | "https://git.tt-rss.org/fox/tt-rss/wiki/ShareAnything"); |
11 | 11 | } |
12 | 12 | |
13 | 13 | function init($host) { |
14 | - $this->host = $host; |
|
14 | + $this->host = $host; |
|
15 | 15 | |
16 | - $host->add_hook($host::HOOK_PREFS_TAB, $this); |
|
16 | + $host->add_hook($host::HOOK_PREFS_TAB, $this); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | function hook_prefs_tab($args) { |
20 | - if ($args == "prefFeeds") { |
|
20 | + if ($args == "prefFeeds") { |
|
21 | 21 | |
22 | 22 | print "<div dojoType=\"dijit.layout.AccordionPane\" |
23 | 23 | title=\"<i class='material-icons'>bookmark</i> ".__('Bookmarklets')."\">"; |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | print "<div dojoType=\"dijit.layout.AccordionPane\" |
23 | 23 | title=\"<i class='material-icons'>bookmark</i> ".__('Bookmarklets')."\">"; |
24 | 24 | |
25 | - print "<h3>" . __("Drag the link below to your browser toolbar, open the feed you're interested in in your browser and click on the link to subscribe to it.") . "</h3>"; |
|
25 | + print "<h3>".__("Drag the link below to your browser toolbar, open the feed you're interested in in your browser and click on the link to subscribe to it.")."</h3>"; |
|
26 | 26 | |
27 | 27 | $bm_subscribe_url = str_replace('%s', '', Pref_Feeds::subscribe_to_feed_url()); |
28 | 28 | |
@@ -31,14 +31,14 @@ discard block |
||
31 | 31 | $bm_url = htmlspecialchars("javascript:{if(confirm('$confirm_str'.replace('%s',window.location.href)))window.location.href='$bm_subscribe_url'+window.location.href}"); |
32 | 32 | |
33 | 33 | print "<p><label class='dijitButton'>"; |
34 | - print "<a href=\"$bm_url\">" . __('Subscribe in Tiny Tiny RSS'). "</a>"; |
|
34 | + print "<a href=\"$bm_url\">".__('Subscribe in Tiny Tiny RSS')."</a>"; |
|
35 | 35 | print "</label></p>"; |
36 | 36 | |
37 | - print "<h3>" . __("Use this bookmarklet to publish arbitrary pages using Tiny Tiny RSS") . "</h3>"; |
|
37 | + print "<h3>".__("Use this bookmarklet to publish arbitrary pages using Tiny Tiny RSS")."</h3>"; |
|
38 | 38 | |
39 | 39 | print "<label class='dijitButton'>"; |
40 | 40 | $bm_url = htmlspecialchars("javascript:(function(){var d=document,w=window,e=w.getSelection,k=d.getSelection,x=d.selection,s=(e?e():(k)?k():(x?x.createRange().text:0)),f='".get_self_url_prefix()."/public.php?op=sharepopup',l=d.location,e=encodeURIComponent,g=f+'&title='+((e(s))?e(s):e(document.title))+'&url='+e(l.href);function a(){if(!w.open(g,'t','toolbar=0,resizable=0,scrollbars=1,status=1,width=500,height=250')){l.href=g;}}a();})()"); |
41 | - print "<a href=\"$bm_url\">" . __('Share with Tiny Tiny RSS'). "</a>"; |
|
41 | + print "<a href=\"$bm_url\">".__('Share with Tiny Tiny RSS')."</a>"; |
|
42 | 42 | print "</label>"; |
43 | 43 | |
44 | 44 | print "<button dojoType='dijit.form.Button' class='alt-info' onclick='window.open(\"https://tt-rss.org/wiki/ShareAnything\")'> |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | } |
42 | 42 | |
43 | 43 | function get_js() { |
44 | - return file_get_contents(__DIR__ . "/init.js"); |
|
44 | + return file_get_contents(__DIR__."/init.js"); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | function showrelated() { |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | |
99 | 99 | print "</div>"; |
100 | 100 | |
101 | - print "<div style='text-align : right' class='text-muted'>" . smart_date_time(strtotime($line["updated"])) . "</div>"; |
|
101 | + print "<div style='text-align : right' class='text-muted'>".smart_date_time(strtotime($line["updated"]))."</div>"; |
|
102 | 102 | |
103 | 103 | print "</li>"; |
104 | 104 | } |
@@ -163,24 +163,24 @@ discard block |
||
163 | 163 | print_hidden("method", "save"); |
164 | 164 | print_hidden("plugin", "af_psql_trgm"); |
165 | 165 | |
166 | - print "<h2>" . __("Global settings") . "</h2>"; |
|
166 | + print "<h2>".__("Global settings")."</h2>"; |
|
167 | 167 | |
168 | 168 | print_notice("Enable for specific feeds in the feed editor."); |
169 | 169 | |
170 | 170 | print "<fieldset>"; |
171 | 171 | |
172 | - print "<label>" . __("Minimum similarity:") . "</label> "; |
|
172 | + print "<label>".__("Minimum similarity:")."</label> "; |
|
173 | 173 | print "<input dojoType=\"dijit.form.NumberSpinner\" |
174 | 174 | placeholder=\"0.75\" id='psql_trgm_similarity' |
175 | 175 | required=\"1\" name=\"similarity\" value=\"$similarity\">"; |
176 | 176 | |
177 | - print "<div dojoType='dijit.Tooltip' connectId='psql_trgm_similarity' position='below'>" . |
|
178 | - __("PostgreSQL trigram extension returns string similarity as a floating point number (0-1). Setting it too low might produce false positives, zero disables checking.") . |
|
177 | + print "<div dojoType='dijit.Tooltip' connectId='psql_trgm_similarity' position='below'>". |
|
178 | + __("PostgreSQL trigram extension returns string similarity as a floating point number (0-1). Setting it too low might produce false positives, zero disables checking."). |
|
179 | 179 | "</div>"; |
180 | 180 | |
181 | 181 | print "</fieldset><fieldset>"; |
182 | 182 | |
183 | - print "<label>" . __("Minimum title length:") . "</label> "; |
|
183 | + print "<label>".__("Minimum title length:")."</label> "; |
|
184 | 184 | print "<input dojoType=\"dijit.form.NumberSpinner\" |
185 | 185 | placeholder=\"32\" |
186 | 186 | required=\"1\" name=\"min_title_length\" value=\"$min_title_length\">"; |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | |
190 | 190 | print "<label class='checkbox'>"; |
191 | 191 | print_checkbox("enable_globally", $enable_globally); |
192 | - print " " . __("Enable for all feeds:"); |
|
192 | + print " ".__("Enable for all feeds:"); |
|
193 | 193 | print "</label>"; |
194 | 194 | |
195 | 195 | print "</fieldset>"; |
@@ -204,14 +204,14 @@ discard block |
||
204 | 204 | $this->host->set($this, "enabled_feeds", $enabled_feeds); |
205 | 205 | |
206 | 206 | if (count($enabled_feeds) > 0) { |
207 | - print "<h3>" . __("Currently enabled for (click to edit):") . "</h3>"; |
|
207 | + print "<h3>".__("Currently enabled for (click to edit):")."</h3>"; |
|
208 | 208 | |
209 | 209 | print "<ul class=\"panel panel-scrollable list list-unstyled\">"; |
210 | 210 | foreach ($enabled_feeds as $f) { |
211 | - print "<li>" . |
|
211 | + print "<li>". |
|
212 | 212 | "<i class='material-icons'>rss_feed</i> <a href='#' |
213 | - onclick='CommonDialogs.editFeed($f)'>" . |
|
214 | - Feeds::getFeedTitle($f) . "</a></li>"; |
|
213 | + onclick='CommonDialogs.editFeed($f)'>". |
|
214 | + Feeds::getFeedTitle($f)."</a></li>"; |
|
215 | 215 | } |
216 | 216 | print "</ul>"; |
217 | 217 | } |
@@ -15,10 +15,16 @@ discard block |
||
15 | 15 | $min_title_length = (int) $_POST["min_title_length"]; |
16 | 16 | $enable_globally = checkbox_to_sql_bool($_POST["enable_globally"]); |
17 | 17 | |
18 | - if ($similarity < 0) $similarity = 0; |
|
19 | - if ($similarity > 1) $similarity = 1; |
|
18 | + if ($similarity < 0) { |
|
19 | + $similarity = 0; |
|
20 | + } |
|
21 | + if ($similarity > 1) { |
|
22 | + $similarity = 1; |
|
23 | + } |
|
20 | 24 | |
21 | - if ($min_title_length < 0) $min_title_length = 0; |
|
25 | + if ($min_title_length < 0) { |
|
26 | + $min_title_length = 0; |
|
27 | + } |
|
22 | 28 | |
23 | 29 | $similarity = sprintf("%.2f", $similarity); |
24 | 30 | |
@@ -121,7 +127,9 @@ discard block |
||
121 | 127 | } |
122 | 128 | |
123 | 129 | function hook_prefs_tab($args) { |
124 | - if ($args != "prefFeeds") return; |
|
130 | + if ($args != "prefFeeds") { |
|
131 | + return; |
|
132 | + } |
|
125 | 133 | |
126 | 134 | print "<div dojoType=\"dijit.layout.AccordionPane\" |
127 | 135 | title=\"<i class='material-icons'>extension</i> ".__('Mark similar articles as read')."\">"; |
@@ -140,8 +148,12 @@ discard block |
||
140 | 148 | $min_title_length = $this->host->get($this, "min_title_length"); |
141 | 149 | $enable_globally = $this->host->get($this, "enable_globally"); |
142 | 150 | |
143 | - if (!$similarity) $similarity = '0.75'; |
|
144 | - if (!$min_title_length) $min_title_length = '32'; |
|
151 | + if (!$similarity) { |
|
152 | + $similarity = '0.75'; |
|
153 | + } |
|
154 | + if (!$min_title_length) { |
|
155 | + $min_title_length = '32'; |
|
156 | + } |
|
145 | 157 | |
146 | 158 | print "<form dojoType=\"dijit.form.Form\">"; |
147 | 159 | |
@@ -198,7 +210,9 @@ discard block |
||
198 | 210 | print "</form>"; |
199 | 211 | |
200 | 212 | $enabled_feeds = $this->host->get($this, "enabled_feeds"); |
201 | - if (!array($enabled_feeds)) $enabled_feeds = array(); |
|
213 | + if (!array($enabled_feeds)) { |
|
214 | + $enabled_feeds = array(); |
|
215 | + } |
|
202 | 216 | |
203 | 217 | $enabled_feeds = $this->filter_unknown_feeds($enabled_feeds); |
204 | 218 | $this->host->set($this, "enabled_feeds", $enabled_feeds); |
@@ -225,7 +239,9 @@ discard block |
||
225 | 239 | print "<section>"; |
226 | 240 | |
227 | 241 | $enabled_feeds = $this->host->get($this, "enabled_feeds"); |
228 | - if (!array($enabled_feeds)) $enabled_feeds = array(); |
|
242 | + if (!array($enabled_feeds)) { |
|
243 | + $enabled_feeds = array(); |
|
244 | + } |
|
229 | 245 | |
230 | 246 | $key = array_search($feed_id, $enabled_feeds); |
231 | 247 | $checked = $key !== FALSE ? "checked" : ""; |
@@ -242,7 +258,9 @@ discard block |
||
242 | 258 | |
243 | 259 | function hook_prefs_save_feed($feed_id) { |
244 | 260 | $enabled_feeds = $this->host->get($this, "enabled_feeds"); |
245 | - if (!is_array($enabled_feeds)) $enabled_feeds = array(); |
|
261 | + if (!is_array($enabled_feeds)) { |
|
262 | + $enabled_feeds = array(); |
|
263 | + } |
|
246 | 264 | |
247 | 265 | $enable = checkbox_to_sql_bool($_POST["trgm_similarity_enabled"]); |
248 | 266 | $key = array_search($feed_id, $enabled_feeds); |
@@ -262,24 +280,34 @@ discard block |
||
262 | 280 | |
263 | 281 | function hook_article_filter($article) { |
264 | 282 | |
265 | - if (DB_TYPE != "pgsql") return $article; |
|
283 | + if (DB_TYPE != "pgsql") { |
|
284 | + return $article; |
|
285 | + } |
|
266 | 286 | |
267 | 287 | $res = $this->pdo->query("select 'similarity'::regproc"); |
268 | - if (!$res->fetch()) return $article; |
|
288 | + if (!$res->fetch()) { |
|
289 | + return $article; |
|
290 | + } |
|
269 | 291 | |
270 | 292 | $enable_globally = $this->host->get($this, "enable_globally"); |
271 | 293 | |
272 | 294 | if (!$enable_globally) { |
273 | 295 | $enabled_feeds = $this->host->get($this, "enabled_feeds"); |
274 | 296 | $key = array_search($article["feed"]["id"], $enabled_feeds); |
275 | - if ($key === FALSE) return $article; |
|
297 | + if ($key === FALSE) { |
|
298 | + return $article; |
|
299 | + } |
|
276 | 300 | } |
277 | 301 | |
278 | 302 | $similarity = (float) $this->host->get($this, "similarity"); |
279 | - if ($similarity < 0.01) return $article; |
|
303 | + if ($similarity < 0.01) { |
|
304 | + return $article; |
|
305 | + } |
|
280 | 306 | |
281 | 307 | $min_title_length = (int) $this->host->get($this, "min_title_length"); |
282 | - if (mb_strlen($article["title"]) < $min_title_length) return $article; |
|
308 | + if (mb_strlen($article["title"]) < $min_title_length) { |
|
309 | + return $article; |
|
310 | + } |
|
283 | 311 | |
284 | 312 | $owner_uid = $article["owner_uid"]; |
285 | 313 | $entry_guid = $article["guid_hashed"]; |