@@ -2,72 +2,72 @@ |
||
2 | 2 | |
3 | 3 | class Logger { |
4 | 4 | |
5 | - /** |
|
6 | - * @var Logger |
|
7 | - */ |
|
8 | - private static $instance; |
|
5 | + /** |
|
6 | + * @var Logger |
|
7 | + */ |
|
8 | + private static $instance; |
|
9 | 9 | |
10 | - /** |
|
11 | - * @var bool|Logger_SQL|Logger_Syslog |
|
12 | - */ |
|
13 | - private $adapter; |
|
10 | + /** |
|
11 | + * @var bool|Logger_SQL|Logger_Syslog |
|
12 | + */ |
|
13 | + private $adapter; |
|
14 | 14 | |
15 | - public static $errornames = array( |
|
16 | - 1 => 'E_ERROR', |
|
17 | - 2 => 'E_WARNING', |
|
18 | - 4 => 'E_PARSE', |
|
19 | - 8 => 'E_NOTICE', |
|
20 | - 16 => 'E_CORE_ERROR', |
|
21 | - 32 => 'E_CORE_WARNING', |
|
22 | - 64 => 'E_COMPILE_ERROR', |
|
23 | - 128 => 'E_COMPILE_WARNING', |
|
24 | - 256 => 'E_USER_ERROR', |
|
25 | - 512 => 'E_USER_WARNING', |
|
26 | - 1024 => 'E_USER_NOTICE', |
|
27 | - 2048 => 'E_STRICT', |
|
28 | - 4096 => 'E_RECOVERABLE_ERROR', |
|
29 | - 8192 => 'E_DEPRECATED', |
|
30 | - 16384 => 'E_USER_DEPRECATED', |
|
31 | - 32767 => 'E_ALL'); |
|
15 | + public static $errornames = array( |
|
16 | + 1 => 'E_ERROR', |
|
17 | + 2 => 'E_WARNING', |
|
18 | + 4 => 'E_PARSE', |
|
19 | + 8 => 'E_NOTICE', |
|
20 | + 16 => 'E_CORE_ERROR', |
|
21 | + 32 => 'E_CORE_WARNING', |
|
22 | + 64 => 'E_COMPILE_ERROR', |
|
23 | + 128 => 'E_COMPILE_WARNING', |
|
24 | + 256 => 'E_USER_ERROR', |
|
25 | + 512 => 'E_USER_WARNING', |
|
26 | + 1024 => 'E_USER_NOTICE', |
|
27 | + 2048 => 'E_STRICT', |
|
28 | + 4096 => 'E_RECOVERABLE_ERROR', |
|
29 | + 8192 => 'E_DEPRECATED', |
|
30 | + 16384 => 'E_USER_DEPRECATED', |
|
31 | + 32767 => 'E_ALL'); |
|
32 | 32 | |
33 | - public function log_error($errno, $errstr, $file, $line, $context) { |
|
34 | - if ($errno === E_NOTICE) { |
|
35 | - return false; |
|
36 | - } |
|
33 | + public function log_error($errno, $errstr, $file, $line, $context) { |
|
34 | + if ($errno === E_NOTICE) { |
|
35 | + return false; |
|
36 | + } |
|
37 | 37 | |
38 | - if ($this->adapter) { |
|
39 | - return $this->adapter->log_error($errno, $errstr, $file, $line, $context); |
|
40 | - } |
|
38 | + if ($this->adapter) { |
|
39 | + return $this->adapter->log_error($errno, $errstr, $file, $line, $context); |
|
40 | + } |
|
41 | 41 | |
42 | - return false; |
|
43 | - } |
|
42 | + return false; |
|
43 | + } |
|
44 | 44 | |
45 | - public function log($string, $context = "") { |
|
46 | - if ($this->adapter) { |
|
47 | - return $this->adapter->log_error(E_USER_NOTICE, $string, '', 0, $context); |
|
48 | - } |
|
45 | + public function log($string, $context = "") { |
|
46 | + if ($this->adapter) { |
|
47 | + return $this->adapter->log_error(E_USER_NOTICE, $string, '', 0, $context); |
|
48 | + } |
|
49 | 49 | |
50 | - return false; |
|
51 | - } |
|
50 | + return false; |
|
51 | + } |
|
52 | 52 | |
53 | - public function __construct() { |
|
54 | - switch (LOG_DESTINATION) { |
|
55 | - case "sql": |
|
56 | - $this->adapter = new Logger_SQL(); |
|
57 | - break; |
|
58 | - case "syslog": |
|
59 | - $this->adapter = new Logger_Syslog(); |
|
60 | - break; |
|
61 | - default: |
|
62 | - $this->adapter = false; |
|
63 | - } |
|
64 | - } |
|
53 | + public function __construct() { |
|
54 | + switch (LOG_DESTINATION) { |
|
55 | + case "sql": |
|
56 | + $this->adapter = new Logger_SQL(); |
|
57 | + break; |
|
58 | + case "syslog": |
|
59 | + $this->adapter = new Logger_Syslog(); |
|
60 | + break; |
|
61 | + default: |
|
62 | + $this->adapter = false; |
|
63 | + } |
|
64 | + } |
|
65 | 65 | |
66 | - public static function get(): Logger { |
|
67 | - if (self::$instance == null) { |
|
68 | - self::$instance = new self(); |
|
69 | - } |
|
70 | - return self::$instance; |
|
71 | - } |
|
66 | + public static function get(): Logger { |
|
67 | + if (self::$instance == null) { |
|
68 | + self::$instance = new self(); |
|
69 | + } |
|
70 | + return self::$instance; |
|
71 | + } |
|
72 | 72 | |
73 | 73 | } |
@@ -52,14 +52,14 @@ |
||
52 | 52 | |
53 | 53 | public function __construct() { |
54 | 54 | switch (LOG_DESTINATION) { |
55 | - case "sql": |
|
56 | - $this->adapter = new Logger_SQL(); |
|
57 | - break; |
|
58 | - case "syslog": |
|
59 | - $this->adapter = new Logger_Syslog(); |
|
60 | - break; |
|
61 | - default: |
|
62 | - $this->adapter = false; |
|
55 | + case "sql": |
|
56 | + $this->adapter = new Logger_SQL(); |
|
57 | + break; |
|
58 | + case "syslog": |
|
59 | + $this->adapter = new Logger_Syslog(); |
|
60 | + break; |
|
61 | + default: |
|
62 | + $this->adapter = false; |
|
63 | 63 | } |
64 | 64 | } |
65 | 65 |
@@ -1,9 +1,9 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | class Dlg extends Handler_Protected { |
3 | 3 | private $param; |
4 | - private $params; |
|
4 | + private $params; |
|
5 | 5 | |
6 | - function before($method) { |
|
6 | + function before($method) { |
|
7 | 7 | if (parent::before($method)) { |
8 | 8 | header("Content-Type: text/html"); # required for iframe |
9 | 9 | |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | $tags[$line["tag_name"]] = $line["count"]; |
109 | 109 | } |
110 | 110 | |
111 | - if(count($tags) == 0 ){ return; } |
|
111 | + if(count($tags) == 0 ){ return; } |
|
112 | 112 | |
113 | 113 | ksort($tags); |
114 | 114 | |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | |
194 | 194 | public function defaultPasswordWarning() { |
195 | 195 | |
196 | - print_warning(__("You are using default tt-rss password. Please change it in the Preferences (Personal data / Authentication).")); |
|
196 | + print_warning(__("You are using default tt-rss password. Please change it in the Preferences (Personal data / Authentication).")); |
|
197 | 197 | |
198 | 198 | print "<footer class='text-center'>"; |
199 | 199 | print "<button dojoType='dijit.form.Button' onclick=\"document.location.href = 'prefs.php'\">". |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | public function pubOPMLUrl() { |
39 | 39 | $url_path = Opml::opml_publish_url(); |
40 | 40 | |
41 | - print "<header>" . __("Your Public OPML URL is:") . "</header>"; |
|
41 | + print "<header>".__("Your Public OPML URL is:")."</header>"; |
|
42 | 42 | |
43 | 43 | print "<section>"; |
44 | 44 | |
@@ -67,18 +67,18 @@ discard block |
||
67 | 67 | if ($this->param == 1) { |
68 | 68 | print __("Update daemon is enabled in configuration, but daemon process is not running, which prevents all feeds from updating. Please start the daemon process or contact instance owner."); |
69 | 69 | |
70 | - $stamp = (int) file_get_contents(LOCK_DIRECTORY . "/update_daemon.stamp"); |
|
70 | + $stamp = (int) file_get_contents(LOCK_DIRECTORY."/update_daemon.stamp"); |
|
71 | 71 | |
72 | - print "<p>" . __("Last update:") . " " . date("Y.m.d, G:i", $stamp); |
|
72 | + print "<p>".__("Last update:")." ".date("Y.m.d, G:i", $stamp); |
|
73 | 73 | |
74 | 74 | } |
75 | 75 | |
76 | 76 | if ($this->param == 3) { |
77 | 77 | print __("Update daemon is taking too long to perform a feed update. This could indicate a problem like crash or a hang. Please check the daemon process or contact instance owner."); |
78 | 78 | |
79 | - $stamp = (int) file_get_contents(LOCK_DIRECTORY . "/update_daemon.stamp"); |
|
79 | + $stamp = (int) file_get_contents(LOCK_DIRECTORY."/update_daemon.stamp"); |
|
80 | 80 | |
81 | - print "<p>" . __("Last update:") . " " . date("Y.m.d, G:i", $stamp); |
|
81 | + print "<p>".__("Last update:")." ".date("Y.m.d, G:i", $stamp); |
|
82 | 82 | |
83 | 83 | } |
84 | 84 | |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | $tags[$line["tag_name"]] = $line["count"]; |
109 | 109 | } |
110 | 110 | |
111 | - if(count($tags) == 0 ){ return; } |
|
111 | + if (count($tags) == 0) { return; } |
|
112 | 112 | |
113 | 113 | ksort($tags); |
114 | 114 | |
@@ -138,9 +138,9 @@ discard block |
||
138 | 138 | |
139 | 139 | $key_escaped = str_replace("'", "\\'", $key); |
140 | 140 | |
141 | - echo "<a href=\"#\" onclick=\"Feeds.open({feed:'$key_escaped'}) \" style=\"font-size: " . |
|
142 | - $size . "px\" title=\"$value articles tagged with " . |
|
143 | - $key . '">' . $key . '</a> '; |
|
141 | + echo "<a href=\"#\" onclick=\"Feeds.open({feed:'$key_escaped'}) \" style=\"font-size: ". |
|
142 | + $size."px\" title=\"$value articles tagged with ". |
|
143 | + $key.'">'.$key.'</a> '; |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | |
164 | 164 | $key = Feeds::get_feed_access_key($feed_id, $is_cat); |
165 | 165 | |
166 | - $url_path = htmlspecialchars($this->params[2]) . "&key=" . $key; |
|
166 | + $url_path = htmlspecialchars($this->params[2])."&key=".$key; |
|
167 | 167 | |
168 | 168 | $feed_title = Feeds::getFeedTitle($feed_id, $is_cat); |
169 | 169 |
@@ -6,7 +6,9 @@ discard block |
||
6 | 6 | public function log_error($errno, $errstr, $file, $line, $context) { |
7 | 7 | |
8 | 8 | // separate PDO connection object is used for logging |
9 | - if (!$this->pdo) $this->pdo = Db::instance()->pdo_connect(); |
|
9 | + if (!$this->pdo) { |
|
10 | + $this->pdo = Db::instance()->pdo_connect(); |
|
11 | + } |
|
10 | 12 | |
11 | 13 | if ($this->pdo && get_schema_version() > 117) { |
12 | 14 | |
@@ -22,8 +24,9 @@ discard block |
||
22 | 24 | ]; |
23 | 25 | |
24 | 26 | foreach ($server_params as $n => $p) { |
25 | - if (isset($_SERVER[$p])) |
|
26 | - $context .= "\n$n: " . $_SERVER[$p]; |
|
27 | + if (isset($_SERVER[$p])) { |
|
28 | + $context .= "\n$n: " . $_SERVER[$p]; |
|
29 | + } |
|
27 | 30 | } |
28 | 31 | |
29 | 32 | // passed error message may contain invalid unicode characters, failing to insert an error here |
@@ -8,12 +8,15 @@ discard block |
||
8 | 8 | $this->pdo = Db::pdo(); |
9 | 9 | $this->cache = array(); |
10 | 10 | |
11 | - if ($_SESSION["uid"]) $this->cache(); |
|
11 | + if ($_SESSION["uid"]) { |
|
12 | + $this->cache(); |
|
13 | + } |
|
12 | 14 | } |
13 | 15 | |
14 | 16 | public static function get() { |
15 | - if (self::$instance == null) |
|
16 | - self::$instance = new self(); |
|
17 | + if (self::$instance == null) { |
|
18 | + self::$instance = new self(); |
|
19 | + } |
|
17 | 20 | |
18 | 21 | return self::$instance; |
19 | 22 | } |
@@ -22,7 +25,9 @@ discard block |
||
22 | 25 | $user_id = $_SESSION["uid"]; |
23 | 26 | @$profile = $_SESSION["profile"]; |
24 | 27 | |
25 | - if (!is_numeric($profile) || !$profile || get_schema_version() < 63) $profile = null; |
|
28 | + if (!is_numeric($profile) || !$profile || get_schema_version() < 63) { |
|
29 | + $profile = null; |
|
30 | + } |
|
26 | 31 | |
27 | 32 | $sth = $this->pdo->prepare("SELECT |
28 | 33 | value,ttrss_prefs_types.type_name as type_name,ttrss_prefs.pref_name AS pref_name |
@@ -61,7 +66,9 @@ discard block |
||
61 | 66 | return $this->convert($tuple["value"], $tuple["type"]); |
62 | 67 | } |
63 | 68 | |
64 | - if (!is_numeric($profile) || !$profile || get_schema_version() < 63) $profile = null; |
|
69 | + if (!is_numeric($profile) || !$profile || get_schema_version() < 63) { |
|
70 | + $profile = null; |
|
71 | + } |
|
65 | 72 | |
66 | 73 | $sth = $this->pdo->prepare("SELECT |
67 | 74 | value,ttrss_prefs_types.type_name as type_name |
@@ -105,7 +112,9 @@ discard block |
||
105 | 112 | } |
106 | 113 | |
107 | 114 | public function write($pref_name, $value, $user_id = false, $strip_tags = true) { |
108 | - if ($strip_tags) $value = strip_tags($value); |
|
115 | + if ($strip_tags) { |
|
116 | + $value = strip_tags($value); |
|
117 | + } |
|
109 | 118 | |
110 | 119 | if (!$user_id) { |
111 | 120 | $user_id = $_SESSION["uid"]; |
@@ -114,7 +123,9 @@ discard block |
||
114 | 123 | $profile = null; |
115 | 124 | } |
116 | 125 | |
117 | - if (!is_numeric($profile) || !$profile || get_schema_version() < 63) $profile = null; |
|
126 | + if (!is_numeric($profile) || !$profile || get_schema_version() < 63) { |
|
127 | + $profile = null; |
|
128 | + } |
|
118 | 129 | |
119 | 130 | $type_name = ""; |
120 | 131 | $current_value = ""; |
@@ -130,8 +141,9 @@ discard block |
||
130 | 141 | WHERE pref_name = ? AND type_id = ttrss_prefs_types.id"); |
131 | 142 | $sth->execute([$pref_name]); |
132 | 143 | |
133 | - if ($row = $sth->fetch()) |
|
134 | - $type_name = $row["type_name"]; |
|
144 | + if ($row = $sth->fetch()) { |
|
145 | + $type_name = $row["type_name"]; |
|
146 | + } |
|
135 | 147 | |
136 | 148 | } else if ($current_value == $value) { |
137 | 149 | return; |
@@ -31,7 +31,9 @@ |
||
31 | 31 | } |
32 | 32 | |
33 | 33 | public function escape_string($s, $strip_tags = true) { |
34 | - if ($strip_tags) $s = strip_tags($s); |
|
34 | + if ($strip_tags) { |
|
35 | + $s = strip_tags($s); |
|
36 | + } |
|
35 | 37 | |
36 | 38 | return pg_escape_string($s); |
37 | 39 | } |
@@ -4,10 +4,11 @@ discard block |
||
4 | 4 | private $last_error; |
5 | 5 | |
6 | 6 | public function connect($host, $user, $pass, $db, $port) { |
7 | - if ($port) |
|
8 | - $this->link = mysqli_connect($host, $user, $pass, $db, $port); |
|
9 | - else |
|
10 | - $this->link = mysqli_connect($host, $user, $pass, $db); |
|
7 | + if ($port) { |
|
8 | + $this->link = mysqli_connect($host, $user, $pass, $db, $port); |
|
9 | + } else { |
|
10 | + $this->link = mysqli_connect($host, $user, $pass, $db); |
|
11 | + } |
|
11 | 12 | |
12 | 13 | if ($this->link) { |
13 | 14 | $this->init(); |
@@ -20,7 +21,9 @@ discard block |
||
20 | 21 | } |
21 | 22 | |
22 | 23 | public function escape_string($s, $strip_tags = true) { |
23 | - if ($strip_tags) $s = strip_tags($s); |
|
24 | + if ($strip_tags) { |
|
25 | + $s = strip_tags($s); |
|
26 | + } |
|
24 | 27 | |
25 | 28 | return mysqli_real_escape_string($this->link, $s); |
26 | 29 | } |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | class Backend extends Handler { |
3 | 3 | public function loading() { |
4 | 4 | header("Content-type: text/html"); |
5 | - print __("Loading, please wait...") . " " . |
|
5 | + print __("Loading, please wait...")." ". |
|
6 | 6 | "<img src='images/indicator_tiny.gif'>"; |
7 | 7 | } |
8 | 8 | |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | foreach ($info as $section => $hotkeys) { |
42 | 42 | |
43 | 43 | if ($cur_section) print "<li> </li>"; |
44 | - print "<li><h3>" . $section . "</h3></li>"; |
|
44 | + print "<li><h3>".$section."</h3></li>"; |
|
45 | 45 | $cur_section = $section; |
46 | 46 | |
47 | 47 | foreach ($hotkeys as $action => $description) { |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | foreach ($omap[$action] as $sequence) { |
51 | 51 | if (strpos($sequence, "|") !== FALSE) { |
52 | 52 | $sequence = substr($sequence, |
53 | - strpos($sequence, "|")+1, |
|
53 | + strpos($sequence, "|") + 1, |
|
54 | 54 | strlen($sequence)); |
55 | 55 | } else { |
56 | 56 | $keys = explode(" ", $sequence); |
@@ -61,10 +61,10 @@ discard block |
||
61 | 61 | foreach (str_split($keys[$i]) as $c) { |
62 | 62 | switch ($c) { |
63 | 63 | case '*': |
64 | - $tmp .= __('Shift') . '+'; |
|
64 | + $tmp .= __('Shift').'+'; |
|
65 | 65 | break; |
66 | 66 | case '^': |
67 | - $tmp .= __('Ctrl') . '+'; |
|
67 | + $tmp .= __('Ctrl').'+'; |
|
68 | 68 | break; |
69 | 69 | default: |
70 | 70 | $tmp .= $c; |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | } |
38 | 38 | } |
39 | 39 | |
40 | - public static function get_all_labels($owner_uid) { |
|
40 | + public static function get_all_labels($owner_uid) { |
|
41 | 41 | $rv = array(); |
42 | 42 | |
43 | 43 | $pdo = Db::pdo(); |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | |
71 | 71 | } |
72 | 72 | |
73 | - public static function clear_cache($id) { |
|
73 | + public static function clear_cache($id) { |
|
74 | 74 | |
75 | 75 | $pdo = Db::pdo(); |
76 | 76 | |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | Labels::clear_cache($id); |
99 | 99 | } |
100 | 100 | |
101 | - public static function add_article($id, $label, $owner_uid) { |
|
101 | + public static function add_article($id, $label, $owner_uid) { |
|
102 | 102 | |
103 | 103 | $label_id = Labels::find_id($label, $owner_uid); |
104 | 104 | |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | if (!$tr_in_progress) $pdo->commit(); |
172 | 172 | } |
173 | 173 | |
174 | - public static function create($caption, $fg_color = '', $bg_color = '', $owner_uid = false) { |
|
174 | + public static function create($caption, $fg_color = '', $bg_color = '', $owner_uid = false) { |
|
175 | 175 | |
176 | 176 | if (!$owner_uid) $owner_uid = $_SESSION['uid']; |
177 | 177 |
@@ -56,11 +56,13 @@ discard block |
||
56 | 56 | public static function update_cache($owner_uid, $id, $labels = false, $force = false) { |
57 | 57 | $pdo = Db::pdo(); |
58 | 58 | |
59 | - if ($force) |
|
60 | - Labels::clear_cache($id); |
|
59 | + if ($force) { |
|
60 | + Labels::clear_cache($id); |
|
61 | + } |
|
61 | 62 | |
62 | - if (!$labels) |
|
63 | - $labels = Article::get_article_labels($id); |
|
63 | + if (!$labels) { |
|
64 | + $labels = Article::get_article_labels($id); |
|
65 | + } |
|
64 | 66 | |
65 | 67 | $labels = json_encode($labels); |
66 | 68 | |
@@ -84,7 +86,9 @@ discard block |
||
84 | 86 | |
85 | 87 | $label_id = Labels::find_id($label, $owner_uid); |
86 | 88 | |
87 | - if (!$label_id) return; |
|
89 | + if (!$label_id) { |
|
90 | + return; |
|
91 | + } |
|
88 | 92 | |
89 | 93 | $pdo = Db::pdo(); |
90 | 94 | |
@@ -102,7 +106,9 @@ discard block |
||
102 | 106 | |
103 | 107 | $label_id = Labels::find_id($label, $owner_uid); |
104 | 108 | |
105 | - if (!$label_id) return; |
|
109 | + if (!$label_id) { |
|
110 | + return; |
|
111 | + } |
|
106 | 112 | |
107 | 113 | $pdo = Db::pdo(); |
108 | 114 | |
@@ -128,7 +134,9 @@ discard block |
||
128 | 134 | } |
129 | 135 | |
130 | 136 | public static function remove($id, $owner_uid) { |
131 | - if (!$owner_uid) $owner_uid = $_SESSION["uid"]; |
|
137 | + if (!$owner_uid) { |
|
138 | + $owner_uid = $_SESSION["uid"]; |
|
139 | + } |
|
132 | 140 | |
133 | 141 | $pdo = Db::pdo(); |
134 | 142 | $tr_in_progress = false; |
@@ -168,12 +176,16 @@ discard block |
||
168 | 176 | |
169 | 177 | } |
170 | 178 | |
171 | - if (!$tr_in_progress) $pdo->commit(); |
|
179 | + if (!$tr_in_progress) { |
|
180 | + $pdo->commit(); |
|
181 | + } |
|
172 | 182 | } |
173 | 183 | |
174 | 184 | public static function create($caption, $fg_color = '', $bg_color = '', $owner_uid = false) { |
175 | 185 | |
176 | - if (!$owner_uid) $owner_uid = $_SESSION['uid']; |
|
186 | + if (!$owner_uid) { |
|
187 | + $owner_uid = $_SESSION['uid']; |
|
188 | + } |
|
177 | 189 | |
178 | 190 | $pdo = Db::pdo(); |
179 | 191 | |
@@ -198,7 +210,9 @@ discard block |
||
198 | 210 | $result = $sth->rowCount(); |
199 | 211 | } |
200 | 212 | |
201 | - if (!$tr_in_progress) $pdo->commit(); |
|
213 | + if (!$tr_in_progress) { |
|
214 | + $pdo->commit(); |
|
215 | + } |
|
202 | 216 | |
203 | 217 | return $result; |
204 | 218 | } |
@@ -14,8 +14,9 @@ discard block |
||
14 | 14 | $source = $elem->getElementsByTagName("source")->item(0); |
15 | 15 | |
16 | 16 | // we don't need <source> element |
17 | - if ($source) |
|
18 | - $elem->removeChild($source); |
|
17 | + if ($source) { |
|
18 | + $elem->removeChild($source); |
|
19 | + } |
|
19 | 20 | } catch (DOMException $e) { |
20 | 21 | // |
21 | 22 | } |
@@ -31,14 +32,19 @@ discard block |
||
31 | 32 | if ($author) { |
32 | 33 | $name = $author->getElementsByTagName("name")->item(0); |
33 | 34 | |
34 | - if ($name) return clean($name->nodeValue); |
|
35 | + if ($name) { |
|
36 | + return clean($name->nodeValue); |
|
37 | + } |
|
35 | 38 | |
36 | 39 | $email = $author->getElementsByTagName("email")->item(0); |
37 | 40 | |
38 | - if ($email) return clean($email->nodeValue); |
|
41 | + if ($email) { |
|
42 | + return clean($email->nodeValue); |
|
43 | + } |
|
39 | 44 | |
40 | - if ($author->nodeValue) |
|
41 | - return clean($author->nodeValue); |
|
45 | + if ($author->nodeValue) { |
|
46 | + return clean($author->nodeValue); |
|
47 | + } |
|
42 | 48 | } |
43 | 49 | |
44 | 50 | $author_elems = $this->xpath->query("dc:creator", $this->elem); |
@@ -56,15 +62,17 @@ discard block |
||
56 | 62 | //might give a wrong result if a default namespace was declared (possible with XPath 2.0) |
57 | 63 | $com_url = $this->xpath->query("comments", $this->elem)->item(0); |
58 | 64 | |
59 | - if ($com_url) |
|
60 | - return clean($com_url->nodeValue); |
|
65 | + if ($com_url) { |
|
66 | + return clean($com_url->nodeValue); |
|
67 | + } |
|
61 | 68 | |
62 | 69 | //Atom Threading Extension (RFC 4685) stuff. Could be used in RSS feeds, so it's in common. |
63 | 70 | //'text/html' for type is too restrictive? |
64 | 71 | $com_url = $this->xpath->query("atom:link[@rel='replies' and contains(@type,'text/html')]/@href", $this->elem)->item(0); |
65 | 72 | |
66 | - if ($com_url) |
|
67 | - return clean($com_url->nodeValue); |
|
73 | + if ($com_url) { |
|
74 | + return clean($com_url->nodeValue); |
|
75 | + } |
|
68 | 76 | } |
69 | 77 | |
70 | 78 | public function get_comments_count() { |
@@ -98,7 +106,9 @@ discard block |
||
98 | 106 | } |
99 | 107 | |
100 | 108 | $desc = $this->xpath->query("media:description", $enclosure)->item(0); |
101 | - if ($desc) $enc->title = clean($desc->nodeValue); |
|
109 | + if ($desc) { |
|
110 | + $enc->title = clean($desc->nodeValue); |
|
111 | + } |
|
102 | 112 | |
103 | 113 | array_push($encs, $enc); |
104 | 114 | } |
@@ -127,7 +137,9 @@ discard block |
||
127 | 137 | $enc->title = clean($desc->nodeValue); |
128 | 138 | } else { |
129 | 139 | $desc = $this->xpath->query("media:description", $enclosure)->item(0); |
130 | - if ($desc) $enc->title = clean($desc->nodeValue); |
|
140 | + if ($desc) { |
|
141 | + $enc->title = clean($desc->nodeValue); |
|
142 | + } |
|
131 | 143 | } |
132 | 144 | |
133 | 145 | array_push($encs, $enc); |
@@ -174,8 +186,9 @@ discard block |
||
174 | 186 | $cat = clean(trim(mb_strtolower($srccat))); |
175 | 187 | |
176 | 188 | // we don't support numeric tags |
177 | - if (is_numeric($cat)) |
|
178 | - $cat = 't:' . $cat; |
|
189 | + if (is_numeric($cat)) { |
|
190 | + $cat = 't:' . $cat; |
|
191 | + } |
|
179 | 192 | |
180 | 193 | $cat = preg_replace('/[,\'\"]/', "", $cat); |
181 | 194 | |
@@ -183,8 +196,9 @@ discard block |
||
183 | 196 | $cat = preg_replace('/[\x{10000}-\x{10FFFF}]/u', "\xEF\xBF\xBD", $cat); |
184 | 197 | } |
185 | 198 | |
186 | - if (mb_strlen($cat) > 250) |
|
187 | - $cat = mb_substr($cat, 0, 250); |
|
199 | + if (mb_strlen($cat) > 250) { |
|
200 | + $cat = mb_substr($cat, 0, 250); |
|
201 | + } |
|
188 | 202 | |
189 | 203 | return $cat; |
190 | 204 | }, $tmp); |