@@ -85,7 +85,7 @@ |
||
85 | 85 | { |
86 | 86 | if (isset($this->file->headers['content-type'])) |
87 | 87 | { |
88 | - if (!isset($this->file->headers['content-encoding']) |
|
88 | + if ( ! isset($this->file->headers['content-encoding']) |
|
89 | 89 | && ($this->file->headers['content-type'] === 'text/plain' |
90 | 90 | || $this->file->headers['content-type'] === 'text/plain; charset=ISO-8859-1' |
91 | 91 | || $this->file->headers['content-type'] === 'text/plain; charset=iso-8859-1' |
@@ -97,8 +97,7 @@ discard block |
||
97 | 97 | if (($pos = strpos($this->file->headers['content-type'], ';')) !== false) |
98 | 98 | { |
99 | 99 | $official = substr($this->file->headers['content-type'], 0, $pos); |
100 | - } |
|
101 | - else |
|
100 | + } else |
|
102 | 101 | { |
103 | 102 | $official = $this->file->headers['content-type']; |
104 | 103 | } |
@@ -108,34 +107,28 @@ discard block |
||
108 | 107 | || $official === 'application/unknown') |
109 | 108 | { |
110 | 109 | return $this->unknown(); |
111 | - } |
|
112 | - elseif (substr($official, -4) === '+xml' |
|
110 | + } elseif (substr($official, -4) === '+xml' |
|
113 | 111 | || $official === 'text/xml' |
114 | 112 | || $official === 'application/xml') |
115 | 113 | { |
116 | 114 | return $official; |
117 | - } |
|
118 | - elseif (substr($official, 0, 6) === 'image/') |
|
115 | + } elseif (substr($official, 0, 6) === 'image/') |
|
119 | 116 | { |
120 | 117 | if ($return = $this->image()) |
121 | 118 | { |
122 | 119 | return $return; |
123 | - } |
|
124 | - else |
|
120 | + } else |
|
125 | 121 | { |
126 | 122 | return $official; |
127 | 123 | } |
128 | - } |
|
129 | - elseif ($official === 'text/html') |
|
124 | + } elseif ($official === 'text/html') |
|
130 | 125 | { |
131 | 126 | return $this->feed_or_html(); |
132 | - } |
|
133 | - else |
|
127 | + } else |
|
134 | 128 | { |
135 | 129 | return $official; |
136 | 130 | } |
137 | - } |
|
138 | - else |
|
131 | + } else |
|
139 | 132 | { |
140 | 133 | return $this->unknown(); |
141 | 134 | } |
@@ -154,12 +147,10 @@ discard block |
||
154 | 147 | || substr($this->file->body, 0, 3) === "\xEF\xBB\xBF") |
155 | 148 | { |
156 | 149 | return 'text/plain'; |
157 | - } |
|
158 | - elseif (preg_match('/[\x00-\x08\x0E-\x1A\x1C-\x1F]/', $this->file->body)) |
|
150 | + } elseif (preg_match('/[\x00-\x08\x0E-\x1A\x1C-\x1F]/', $this->file->body)) |
|
159 | 151 | { |
160 | 152 | return 'application/octect-stream'; |
161 | - } |
|
162 | - else |
|
153 | + } else |
|
163 | 154 | { |
164 | 155 | return 'text/plain'; |
165 | 156 | } |
@@ -178,37 +169,29 @@ discard block |
||
178 | 169 | || strtolower(substr($this->file->body, $ws, 7)) === '<script') |
179 | 170 | { |
180 | 171 | return 'text/html'; |
181 | - } |
|
182 | - elseif (substr($this->file->body, 0, 5) === '%PDF-') |
|
172 | + } elseif (substr($this->file->body, 0, 5) === '%PDF-') |
|
183 | 173 | { |
184 | 174 | return 'application/pdf'; |
185 | - } |
|
186 | - elseif (substr($this->file->body, 0, 11) === '%!PS-Adobe-') |
|
175 | + } elseif (substr($this->file->body, 0, 11) === '%!PS-Adobe-') |
|
187 | 176 | { |
188 | 177 | return 'application/postscript'; |
189 | - } |
|
190 | - elseif (substr($this->file->body, 0, 6) === 'GIF87a' |
|
178 | + } elseif (substr($this->file->body, 0, 6) === 'GIF87a' |
|
191 | 179 | || substr($this->file->body, 0, 6) === 'GIF89a') |
192 | 180 | { |
193 | 181 | return 'image/gif'; |
194 | - } |
|
195 | - elseif (substr($this->file->body, 0, 8) === "\x89\x50\x4E\x47\x0D\x0A\x1A\x0A") |
|
182 | + } elseif (substr($this->file->body, 0, 8) === "\x89\x50\x4E\x47\x0D\x0A\x1A\x0A") |
|
196 | 183 | { |
197 | 184 | return 'image/png'; |
198 | - } |
|
199 | - elseif (substr($this->file->body, 0, 3) === "\xFF\xD8\xFF") |
|
185 | + } elseif (substr($this->file->body, 0, 3) === "\xFF\xD8\xFF") |
|
200 | 186 | { |
201 | 187 | return 'image/jpeg'; |
202 | - } |
|
203 | - elseif (substr($this->file->body, 0, 2) === "\x42\x4D") |
|
188 | + } elseif (substr($this->file->body, 0, 2) === "\x42\x4D") |
|
204 | 189 | { |
205 | 190 | return 'image/bmp'; |
206 | - } |
|
207 | - elseif (substr($this->file->body, 0, 4) === "\x00\x00\x01\x00") |
|
191 | + } elseif (substr($this->file->body, 0, 4) === "\x00\x00\x01\x00") |
|
208 | 192 | { |
209 | 193 | return 'image/vnd.microsoft.icon'; |
210 | - } |
|
211 | - else |
|
194 | + } else |
|
212 | 195 | { |
213 | 196 | return $this->text_or_binary(); |
214 | 197 | } |
@@ -225,24 +208,19 @@ discard block |
||
225 | 208 | || substr($this->file->body, 0, 6) === 'GIF89a') |
226 | 209 | { |
227 | 210 | return 'image/gif'; |
228 | - } |
|
229 | - elseif (substr($this->file->body, 0, 8) === "\x89\x50\x4E\x47\x0D\x0A\x1A\x0A") |
|
211 | + } elseif (substr($this->file->body, 0, 8) === "\x89\x50\x4E\x47\x0D\x0A\x1A\x0A") |
|
230 | 212 | { |
231 | 213 | return 'image/png'; |
232 | - } |
|
233 | - elseif (substr($this->file->body, 0, 3) === "\xFF\xD8\xFF") |
|
214 | + } elseif (substr($this->file->body, 0, 3) === "\xFF\xD8\xFF") |
|
234 | 215 | { |
235 | 216 | return 'image/jpeg'; |
236 | - } |
|
237 | - elseif (substr($this->file->body, 0, 2) === "\x42\x4D") |
|
217 | + } elseif (substr($this->file->body, 0, 2) === "\x42\x4D") |
|
238 | 218 | { |
239 | 219 | return 'image/bmp'; |
240 | - } |
|
241 | - elseif (substr($this->file->body, 0, 4) === "\x00\x00\x01\x00") |
|
220 | + } elseif (substr($this->file->body, 0, 4) === "\x00\x00\x01\x00") |
|
242 | 221 | { |
243 | 222 | return 'image/vnd.microsoft.icon'; |
244 | - } |
|
245 | - else |
|
223 | + } else |
|
246 | 224 | { |
247 | 225 | return false; |
248 | 226 | } |
@@ -283,44 +261,36 @@ discard block |
||
283 | 261 | if ($pos < $len && ($pos = strpos($this->file->body, '-->', $pos)) !== false) |
284 | 262 | { |
285 | 263 | $pos += 3; |
286 | - } |
|
287 | - else |
|
264 | + } else |
|
288 | 265 | { |
289 | 266 | return 'text/html'; |
290 | 267 | } |
291 | - } |
|
292 | - elseif (substr($this->file->body, $pos, 1) === '!') |
|
268 | + } elseif (substr($this->file->body, $pos, 1) === '!') |
|
293 | 269 | { |
294 | 270 | if ($pos < $len && ($pos = strpos($this->file->body, '>', $pos)) !== false) |
295 | 271 | { |
296 | 272 | $pos++; |
297 | - } |
|
298 | - else |
|
273 | + } else |
|
299 | 274 | { |
300 | 275 | return 'text/html'; |
301 | 276 | } |
302 | - } |
|
303 | - elseif (substr($this->file->body, $pos, 1) === '?') |
|
277 | + } elseif (substr($this->file->body, $pos, 1) === '?') |
|
304 | 278 | { |
305 | 279 | if ($pos < $len && ($pos = strpos($this->file->body, '?>', $pos)) !== false) |
306 | 280 | { |
307 | 281 | $pos += 2; |
308 | - } |
|
309 | - else |
|
282 | + } else |
|
310 | 283 | { |
311 | 284 | return 'text/html'; |
312 | 285 | } |
313 | - } |
|
314 | - elseif (substr($this->file->body, $pos, 3) === 'rss' |
|
286 | + } elseif (substr($this->file->body, $pos, 3) === 'rss' |
|
315 | 287 | || substr($this->file->body, $pos, 7) === 'rdf:RDF') |
316 | 288 | { |
317 | 289 | return 'application/rss+xml'; |
318 | - } |
|
319 | - elseif (substr($this->file->body, $pos, 4) === 'feed') |
|
290 | + } elseif (substr($this->file->body, $pos, 4) === 'feed') |
|
320 | 291 | { |
321 | 292 | return 'application/atom+xml'; |
322 | - } |
|
323 | - else |
|
293 | + } else |
|
324 | 294 | { |
325 | 295 | return 'text/html'; |
326 | 296 | } |
@@ -136,8 +136,7 @@ discard block |
||
136 | 136 | if ($this->state === 'emit') |
137 | 137 | { |
138 | 138 | return true; |
139 | - } |
|
140 | - else |
|
139 | + } else |
|
141 | 140 | { |
142 | 141 | $this->version = ''; |
143 | 142 | $this->encoding = ''; |
@@ -194,8 +193,7 @@ discard block |
||
194 | 193 | if ($this->skip_whitespace()) |
195 | 194 | { |
196 | 195 | $this->state = 'version_name'; |
197 | - } |
|
198 | - else |
|
196 | + } else |
|
199 | 197 | { |
200 | 198 | $this->state = false; |
201 | 199 | } |
@@ -208,8 +206,7 @@ discard block |
||
208 | 206 | $this->position += 7; |
209 | 207 | $this->skip_whitespace(); |
210 | 208 | $this->state = 'version_equals'; |
211 | - } |
|
212 | - else |
|
209 | + } else |
|
213 | 210 | { |
214 | 211 | $this->state = false; |
215 | 212 | } |
@@ -222,8 +219,7 @@ discard block |
||
222 | 219 | $this->position++; |
223 | 220 | $this->skip_whitespace(); |
224 | 221 | $this->state = 'version_value'; |
225 | - } |
|
226 | - else |
|
222 | + } else |
|
227 | 223 | { |
228 | 224 | $this->state = false; |
229 | 225 | } |
@@ -237,13 +233,11 @@ discard block |
||
237 | 233 | if ($this->has_data()) |
238 | 234 | { |
239 | 235 | $this->state = 'encoding_name'; |
240 | - } |
|
241 | - else |
|
236 | + } else |
|
242 | 237 | { |
243 | 238 | $this->state = 'emit'; |
244 | 239 | } |
245 | - } |
|
246 | - else |
|
240 | + } else |
|
247 | 241 | { |
248 | 242 | $this->state = false; |
249 | 243 | } |
@@ -256,8 +250,7 @@ discard block |
||
256 | 250 | $this->position += 8; |
257 | 251 | $this->skip_whitespace(); |
258 | 252 | $this->state = 'encoding_equals'; |
259 | - } |
|
260 | - else |
|
253 | + } else |
|
261 | 254 | { |
262 | 255 | $this->state = 'standalone_name'; |
263 | 256 | } |
@@ -270,8 +263,7 @@ discard block |
||
270 | 263 | $this->position++; |
271 | 264 | $this->skip_whitespace(); |
272 | 265 | $this->state = 'encoding_value'; |
273 | - } |
|
274 | - else |
|
266 | + } else |
|
275 | 267 | { |
276 | 268 | $this->state = false; |
277 | 269 | } |
@@ -285,13 +277,11 @@ discard block |
||
285 | 277 | if ($this->has_data()) |
286 | 278 | { |
287 | 279 | $this->state = 'standalone_name'; |
288 | - } |
|
289 | - else |
|
280 | + } else |
|
290 | 281 | { |
291 | 282 | $this->state = 'emit'; |
292 | 283 | } |
293 | - } |
|
294 | - else |
|
284 | + } else |
|
295 | 285 | { |
296 | 286 | $this->state = false; |
297 | 287 | } |
@@ -304,8 +294,7 @@ discard block |
||
304 | 294 | $this->position += 10; |
305 | 295 | $this->skip_whitespace(); |
306 | 296 | $this->state = 'standalone_equals'; |
307 | - } |
|
308 | - else |
|
297 | + } else |
|
309 | 298 | { |
310 | 299 | $this->state = false; |
311 | 300 | } |
@@ -318,8 +307,7 @@ discard block |
||
318 | 307 | $this->position++; |
319 | 308 | $this->skip_whitespace(); |
320 | 309 | $this->state = 'standalone_value'; |
321 | - } |
|
322 | - else |
|
310 | + } else |
|
323 | 311 | { |
324 | 312 | $this->state = false; |
325 | 313 | } |
@@ -348,13 +336,11 @@ discard block |
||
348 | 336 | if ($this->has_data()) |
349 | 337 | { |
350 | 338 | $this->state = false; |
351 | - } |
|
352 | - else |
|
339 | + } else |
|
353 | 340 | { |
354 | 341 | $this->state = 'emit'; |
355 | 342 | } |
356 | - } |
|
357 | - else |
|
343 | + } else |
|
358 | 344 | { |
359 | 345 | $this->state = false; |
360 | 346 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $items = $data->get_items(); |
64 | 64 | $items_by_id = array(); |
65 | 65 | |
66 | - if (!empty($items)) |
|
66 | + if ( ! empty($items)) |
|
67 | 67 | { |
68 | 68 | foreach ($items as $item) |
69 | 69 | { |
@@ -81,19 +81,19 @@ discard block |
||
81 | 81 | |
82 | 82 | if (isset($data->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0])) |
83 | 83 | { |
84 | - $channel =& $data->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]; |
|
84 | + $channel = & $data->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]; |
|
85 | 85 | } |
86 | 86 | elseif (isset($data->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0])) |
87 | 87 | { |
88 | - $channel =& $data->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]; |
|
88 | + $channel = & $data->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]; |
|
89 | 89 | } |
90 | 90 | elseif (isset($data->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0])) |
91 | 91 | { |
92 | - $channel =& $data->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]; |
|
92 | + $channel = & $data->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]; |
|
93 | 93 | } |
94 | 94 | elseif (isset($data->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['channel'][0])) |
95 | 95 | { |
96 | - $channel =& $data->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['channel'][0]; |
|
96 | + $channel = & $data->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['channel'][0]; |
|
97 | 97 | } |
98 | 98 | else |
99 | 99 | { |
@@ -82,20 +82,16 @@ |
||
82 | 82 | if (isset($data->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0])) |
83 | 83 | { |
84 | 84 | $channel =& $data->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]; |
85 | - } |
|
86 | - elseif (isset($data->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0])) |
|
85 | + } elseif (isset($data->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0])) |
|
87 | 86 | { |
88 | 87 | $channel =& $data->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]; |
89 | - } |
|
90 | - elseif (isset($data->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0])) |
|
88 | + } elseif (isset($data->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0])) |
|
91 | 89 | { |
92 | 90 | $channel =& $data->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]; |
93 | - } |
|
94 | - elseif (isset($data->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['channel'][0])) |
|
91 | + } elseif (isset($data->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['channel'][0])) |
|
95 | 92 | { |
96 | 93 | $channel =& $data->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['channel'][0]; |
97 | - } |
|
98 | - else |
|
94 | + } else |
|
99 | 95 | { |
100 | 96 | $channel = null; |
101 | 97 | } |
@@ -99,7 +99,7 @@ |
||
99 | 99 | $this->options['host'] = empty($parsed['host']) ? $this->options['host'] : $parsed['host']; |
100 | 100 | $this->options['port'] = empty($parsed['port']) ? $this->options['port'] : $parsed['port']; |
101 | 101 | $this->options['extras'] = array_merge($this->options['extras'], $parsed['extras']); |
102 | - $this->name = $this->options['extras']['prefix'] . md5("$name:$type"); |
|
102 | + $this->name = $this->options['extras']['prefix'].md5("$name:$type"); |
|
103 | 103 | |
104 | 104 | $this->cache = new Memcache(); |
105 | 105 | $this->cache->addServer($this->options['host'], (int) $this->options['port']); |
@@ -111,9 +111,9 @@ discard block |
||
111 | 111 | return; |
112 | 112 | } |
113 | 113 | |
114 | - $this->id = $name . $type; |
|
114 | + $this->id = $name.$type; |
|
115 | 115 | |
116 | - if (!$query = $this->mysql->query('SHOW TABLES')) |
|
116 | + if ( ! $query = $this->mysql->query('SHOW TABLES')) |
|
117 | 117 | { |
118 | 118 | $this->mysql = null; |
119 | 119 | return; |
@@ -125,18 +125,18 @@ discard block |
||
125 | 125 | $db[] = $row; |
126 | 126 | } |
127 | 127 | |
128 | - if (!in_array($this->options['extras']['prefix'] . 'cache_data', $db)) |
|
128 | + if ( ! in_array($this->options['extras']['prefix'].'cache_data', $db)) |
|
129 | 129 | { |
130 | - $query = $this->mysql->exec('CREATE TABLE `' . $this->options['extras']['prefix'] . 'cache_data` (`id` TEXT CHARACTER SET utf8 NOT NULL, `items` SMALLINT NOT NULL DEFAULT 0, `data` BLOB NOT NULL, `mtime` INT UNSIGNED NOT NULL, UNIQUE (`id`(125)))'); |
|
130 | + $query = $this->mysql->exec('CREATE TABLE `'.$this->options['extras']['prefix'].'cache_data` (`id` TEXT CHARACTER SET utf8 NOT NULL, `items` SMALLINT NOT NULL DEFAULT 0, `data` BLOB NOT NULL, `mtime` INT UNSIGNED NOT NULL, UNIQUE (`id`(125)))'); |
|
131 | 131 | if ($query === false) |
132 | 132 | { |
133 | 133 | $this->mysql = null; |
134 | 134 | } |
135 | 135 | } |
136 | 136 | |
137 | - if (!in_array($this->options['extras']['prefix'] . 'items', $db)) |
|
137 | + if ( ! in_array($this->options['extras']['prefix'].'items', $db)) |
|
138 | 138 | { |
139 | - $query = $this->mysql->exec('CREATE TABLE `' . $this->options['extras']['prefix'] . 'items` (`feed_id` TEXT CHARACTER SET utf8 NOT NULL, `id` TEXT CHARACTER SET utf8 NOT NULL, `data` TEXT CHARACTER SET utf8 NOT NULL, `posted` INT UNSIGNED NOT NULL, INDEX `feed_id` (`feed_id`(125)))'); |
|
139 | + $query = $this->mysql->exec('CREATE TABLE `'.$this->options['extras']['prefix'].'items` (`feed_id` TEXT CHARACTER SET utf8 NOT NULL, `id` TEXT CHARACTER SET utf8 NOT NULL, `data` TEXT CHARACTER SET utf8 NOT NULL, `posted` INT UNSIGNED NOT NULL, INDEX `feed_id` (`feed_id`(125)))'); |
|
140 | 140 | if ($query === false) |
141 | 141 | { |
142 | 142 | $this->mysql = null; |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | |
164 | 164 | $prepared = self::prepare_simplepie_object_for_cache($data); |
165 | 165 | |
166 | - $query = $this->mysql->prepare('SELECT COUNT(*) FROM `' . $this->options['extras']['prefix'] . 'cache_data` WHERE `id` = :feed'); |
|
166 | + $query = $this->mysql->prepare('SELECT COUNT(*) FROM `'.$this->options['extras']['prefix'].'cache_data` WHERE `id` = :feed'); |
|
167 | 167 | $query->bindValue(':feed', $this->id); |
168 | 168 | if ($query->execute()) |
169 | 169 | { |
@@ -172,46 +172,46 @@ discard block |
||
172 | 172 | $items = count($prepared[1]); |
173 | 173 | if ($items) |
174 | 174 | { |
175 | - $sql = 'UPDATE `' . $this->options['extras']['prefix'] . 'cache_data` SET `items` = :items, `data` = :data, `mtime` = :time WHERE `id` = :feed'; |
|
175 | + $sql = 'UPDATE `'.$this->options['extras']['prefix'].'cache_data` SET `items` = :items, `data` = :data, `mtime` = :time WHERE `id` = :feed'; |
|
176 | 176 | $query = $this->mysql->prepare($sql); |
177 | 177 | $query->bindValue(':items', $items); |
178 | 178 | } |
179 | 179 | else |
180 | 180 | { |
181 | - $sql = 'UPDATE `' . $this->options['extras']['prefix'] . 'cache_data` SET `data` = :data, `mtime` = :time WHERE `id` = :feed'; |
|
181 | + $sql = 'UPDATE `'.$this->options['extras']['prefix'].'cache_data` SET `data` = :data, `mtime` = :time WHERE `id` = :feed'; |
|
182 | 182 | $query = $this->mysql->prepare($sql); |
183 | 183 | } |
184 | 184 | |
185 | 185 | $query->bindValue(':data', $prepared[0]); |
186 | 186 | $query->bindValue(':time', time()); |
187 | 187 | $query->bindValue(':feed', $this->id); |
188 | - if (!$query->execute()) |
|
188 | + if ( ! $query->execute()) |
|
189 | 189 | { |
190 | 190 | return false; |
191 | 191 | } |
192 | 192 | } |
193 | 193 | else |
194 | 194 | { |
195 | - $query = $this->mysql->prepare('INSERT INTO `' . $this->options['extras']['prefix'] . 'cache_data` (`id`, `items`, `data`, `mtime`) VALUES(:feed, :count, :data, :time)'); |
|
195 | + $query = $this->mysql->prepare('INSERT INTO `'.$this->options['extras']['prefix'].'cache_data` (`id`, `items`, `data`, `mtime`) VALUES(:feed, :count, :data, :time)'); |
|
196 | 196 | $query->bindValue(':feed', $this->id); |
197 | 197 | $query->bindValue(':count', count($prepared[1])); |
198 | 198 | $query->bindValue(':data', $prepared[0]); |
199 | 199 | $query->bindValue(':time', time()); |
200 | - if (!$query->execute()) |
|
200 | + if ( ! $query->execute()) |
|
201 | 201 | { |
202 | 202 | return false; |
203 | 203 | } |
204 | 204 | } |
205 | 205 | |
206 | 206 | $ids = array_keys($prepared[1]); |
207 | - if (!empty($ids)) |
|
207 | + if ( ! empty($ids)) |
|
208 | 208 | { |
209 | 209 | foreach ($ids as $id) |
210 | 210 | { |
211 | 211 | $database_ids[] = $this->mysql->quote($id); |
212 | 212 | } |
213 | 213 | |
214 | - $query = $this->mysql->prepare('SELECT `id` FROM `' . $this->options['extras']['prefix'] . 'items` WHERE `id` = ' . implode(' OR `id` = ', $database_ids) . ' AND `feed_id` = :feed'); |
|
214 | + $query = $this->mysql->prepare('SELECT `id` FROM `'.$this->options['extras']['prefix'].'items` WHERE `id` = '.implode(' OR `id` = ', $database_ids).' AND `feed_id` = :feed'); |
|
215 | 215 | $query->bindValue(':feed', $this->id); |
216 | 216 | |
217 | 217 | if ($query->execute()) |
@@ -226,17 +226,17 @@ discard block |
||
226 | 226 | |
227 | 227 | foreach ($new_ids as $new_id) |
228 | 228 | { |
229 | - if (!($date = $prepared[1][$new_id]->get_date('U'))) |
|
229 | + if ( ! ($date = $prepared[1][$new_id]->get_date('U'))) |
|
230 | 230 | { |
231 | 231 | $date = time(); |
232 | 232 | } |
233 | 233 | |
234 | - $query = $this->mysql->prepare('INSERT INTO `' . $this->options['extras']['prefix'] . 'items` (`feed_id`, `id`, `data`, `posted`) VALUES(:feed, :id, :data, :date)'); |
|
234 | + $query = $this->mysql->prepare('INSERT INTO `'.$this->options['extras']['prefix'].'items` (`feed_id`, `id`, `data`, `posted`) VALUES(:feed, :id, :data, :date)'); |
|
235 | 235 | $query->bindValue(':feed', $this->id); |
236 | 236 | $query->bindValue(':id', $new_id); |
237 | 237 | $query->bindValue(':data', serialize($prepared[1][$new_id]->data)); |
238 | 238 | $query->bindValue(':date', $date); |
239 | - if (!$query->execute()) |
|
239 | + if ( ! $query->execute()) |
|
240 | 240 | { |
241 | 241 | return false; |
242 | 242 | } |
@@ -252,13 +252,13 @@ discard block |
||
252 | 252 | } |
253 | 253 | else |
254 | 254 | { |
255 | - $query = $this->mysql->prepare('SELECT `id` FROM `' . $this->options['extras']['prefix'] . 'cache_data` WHERE `id` = :feed'); |
|
255 | + $query = $this->mysql->prepare('SELECT `id` FROM `'.$this->options['extras']['prefix'].'cache_data` WHERE `id` = :feed'); |
|
256 | 256 | $query->bindValue(':feed', $this->id); |
257 | 257 | if ($query->execute()) |
258 | 258 | { |
259 | 259 | if ($query->rowCount() > 0) |
260 | 260 | { |
261 | - $query = $this->mysql->prepare('UPDATE `' . $this->options['extras']['prefix'] . 'cache_data` SET `items` = 0, `data` = :data, `mtime` = :time WHERE `id` = :feed'); |
|
261 | + $query = $this->mysql->prepare('UPDATE `'.$this->options['extras']['prefix'].'cache_data` SET `items` = 0, `data` = :data, `mtime` = :time WHERE `id` = :feed'); |
|
262 | 262 | $query->bindValue(':data', serialize($data)); |
263 | 263 | $query->bindValue(':time', time()); |
264 | 264 | $query->bindValue(':feed', $this->id); |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | } |
270 | 270 | else |
271 | 271 | { |
272 | - $query = $this->mysql->prepare('INSERT INTO `' . $this->options['extras']['prefix'] . 'cache_data` (`id`, `items`, `data`, `mtime`) VALUES(:id, 0, :data, :time)'); |
|
272 | + $query = $this->mysql->prepare('INSERT INTO `'.$this->options['extras']['prefix'].'cache_data` (`id`, `items`, `data`, `mtime`) VALUES(:id, 0, :data, :time)'); |
|
273 | 273 | $query->bindValue(':id', $this->id); |
274 | 274 | $query->bindValue(':data', serialize($data)); |
275 | 275 | $query->bindValue(':time', time()); |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | return false; |
296 | 296 | } |
297 | 297 | |
298 | - $query = $this->mysql->prepare('SELECT `items`, `data` FROM `' . $this->options['extras']['prefix'] . 'cache_data` WHERE `id` = :id'); |
|
298 | + $query = $this->mysql->prepare('SELECT `items`, `data` FROM `'.$this->options['extras']['prefix'].'cache_data` WHERE `id` = :id'); |
|
299 | 299 | $query->bindValue(':id', $this->id); |
300 | 300 | if ($query->execute() && ($row = $query->fetch())) |
301 | 301 | { |
@@ -314,19 +314,19 @@ discard block |
||
314 | 314 | { |
315 | 315 | if (isset($data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0])) |
316 | 316 | { |
317 | - $feed =& $data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]; |
|
317 | + $feed = & $data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]; |
|
318 | 318 | } |
319 | 319 | elseif (isset($data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0])) |
320 | 320 | { |
321 | - $feed =& $data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]; |
|
321 | + $feed = & $data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]; |
|
322 | 322 | } |
323 | 323 | elseif (isset($data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0])) |
324 | 324 | { |
325 | - $feed =& $data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]; |
|
325 | + $feed = & $data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]; |
|
326 | 326 | } |
327 | 327 | elseif (isset($data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0])) |
328 | 328 | { |
329 | - $feed =& $data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]; |
|
329 | + $feed = & $data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]; |
|
330 | 330 | } |
331 | 331 | else |
332 | 332 | { |
@@ -335,10 +335,10 @@ discard block |
||
335 | 335 | |
336 | 336 | if ($feed !== null) |
337 | 337 | { |
338 | - $sql = 'SELECT `data` FROM `' . $this->options['extras']['prefix'] . 'items` WHERE `feed_id` = :feed ORDER BY `posted` DESC'; |
|
338 | + $sql = 'SELECT `data` FROM `'.$this->options['extras']['prefix'].'items` WHERE `feed_id` = :feed ORDER BY `posted` DESC'; |
|
339 | 339 | if ($items > 0) |
340 | 340 | { |
341 | - $sql .= ' LIMIT ' . $items; |
|
341 | + $sql .= ' LIMIT '.$items; |
|
342 | 342 | } |
343 | 343 | |
344 | 344 | $query = $this->mysql->prepare($sql); |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | return false; |
374 | 374 | } |
375 | 375 | |
376 | - $query = $this->mysql->prepare('SELECT `mtime` FROM `' . $this->options['extras']['prefix'] . 'cache_data` WHERE `id` = :id'); |
|
376 | + $query = $this->mysql->prepare('SELECT `mtime` FROM `'.$this->options['extras']['prefix'].'cache_data` WHERE `id` = :id'); |
|
377 | 377 | $query->bindValue(':id', $this->id); |
378 | 378 | if ($query->execute() && ($time = $query->fetchColumn())) |
379 | 379 | { |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | return false; |
398 | 398 | } |
399 | 399 | |
400 | - $query = $this->mysql->prepare('UPDATE `' . $this->options['extras']['prefix'] . 'cache_data` SET `mtime` = :time WHERE `id` = :id'); |
|
400 | + $query = $this->mysql->prepare('UPDATE `'.$this->options['extras']['prefix'].'cache_data` SET `mtime` = :time WHERE `id` = :id'); |
|
401 | 401 | $query->bindValue(':time', time()); |
402 | 402 | $query->bindValue(':id', $this->id); |
403 | 403 | if ($query->execute() && $query->rowCount() > 0) |
@@ -422,9 +422,9 @@ discard block |
||
422 | 422 | return false; |
423 | 423 | } |
424 | 424 | |
425 | - $query = $this->mysql->prepare('DELETE FROM `' . $this->options['extras']['prefix'] . 'cache_data` WHERE `id` = :id'); |
|
425 | + $query = $this->mysql->prepare('DELETE FROM `'.$this->options['extras']['prefix'].'cache_data` WHERE `id` = :id'); |
|
426 | 426 | $query->bindValue(':id', $this->id); |
427 | - $query2 = $this->mysql->prepare('DELETE FROM `' . $this->options['extras']['prefix'] . 'items` WHERE `feed_id` = :id'); |
|
427 | + $query2 = $this->mysql->prepare('DELETE FROM `'.$this->options['extras']['prefix'].'items` WHERE `feed_id` = :id'); |
|
428 | 428 | $query2->bindValue(':id', $this->id); |
429 | 429 | if ($query->execute() && $query2->execute()) |
430 | 430 | { |
@@ -104,8 +104,7 @@ discard block |
||
104 | 104 | try |
105 | 105 | { |
106 | 106 | $this->mysql = new PDO("mysql:dbname={$this->options['dbname']};host={$this->options['host']};port={$this->options['port']}", $this->options['user'], $this->options['pass'], array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8')); |
107 | - } |
|
108 | - catch (PDOException $e) |
|
107 | + } catch (PDOException $e) |
|
109 | 108 | { |
110 | 109 | $this->mysql = null; |
111 | 110 | return; |
@@ -175,8 +174,7 @@ discard block |
||
175 | 174 | $sql = 'UPDATE `' . $this->options['extras']['prefix'] . 'cache_data` SET `items` = :items, `data` = :data, `mtime` = :time WHERE `id` = :feed'; |
176 | 175 | $query = $this->mysql->prepare($sql); |
177 | 176 | $query->bindValue(':items', $items); |
178 | - } |
|
179 | - else |
|
177 | + } else |
|
180 | 178 | { |
181 | 179 | $sql = 'UPDATE `' . $this->options['extras']['prefix'] . 'cache_data` SET `data` = :data, `mtime` = :time WHERE `id` = :feed'; |
182 | 180 | $query = $this->mysql->prepare($sql); |
@@ -189,8 +187,7 @@ discard block |
||
189 | 187 | { |
190 | 188 | return false; |
191 | 189 | } |
192 | - } |
|
193 | - else |
|
190 | + } else |
|
194 | 191 | { |
195 | 192 | $query = $this->mysql->prepare('INSERT INTO `' . $this->options['extras']['prefix'] . 'cache_data` (`id`, `items`, `data`, `mtime`) VALUES(:feed, :count, :data, :time)'); |
196 | 193 | $query->bindValue(':feed', $this->id); |
@@ -243,14 +240,12 @@ discard block |
||
243 | 240 | } |
244 | 241 | return true; |
245 | 242 | } |
246 | - } |
|
247 | - else |
|
243 | + } else |
|
248 | 244 | { |
249 | 245 | return true; |
250 | 246 | } |
251 | 247 | } |
252 | - } |
|
253 | - else |
|
248 | + } else |
|
254 | 249 | { |
255 | 250 | $query = $this->mysql->prepare('SELECT `id` FROM `' . $this->options['extras']['prefix'] . 'cache_data` WHERE `id` = :feed'); |
256 | 251 | $query->bindValue(':feed', $this->id); |
@@ -266,8 +261,7 @@ discard block |
||
266 | 261 | { |
267 | 262 | return true; |
268 | 263 | } |
269 | - } |
|
270 | - else |
|
264 | + } else |
|
271 | 265 | { |
272 | 266 | $query = $this->mysql->prepare('INSERT INTO `' . $this->options['extras']['prefix'] . 'cache_data` (`id`, `items`, `data`, `mtime`) VALUES(:id, 0, :data, :time)'); |
273 | 267 | $query->bindValue(':id', $this->id); |
@@ -304,8 +298,7 @@ discard block |
||
304 | 298 | if (isset($this->options['items'][0])) |
305 | 299 | { |
306 | 300 | $items = (int) $this->options['items'][0]; |
307 | - } |
|
308 | - else |
|
301 | + } else |
|
309 | 302 | { |
310 | 303 | $items = (int) $row[0]; |
311 | 304 | } |
@@ -315,20 +308,16 @@ discard block |
||
315 | 308 | if (isset($data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0])) |
316 | 309 | { |
317 | 310 | $feed =& $data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]; |
318 | - } |
|
319 | - elseif (isset($data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0])) |
|
311 | + } elseif (isset($data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0])) |
|
320 | 312 | { |
321 | 313 | $feed =& $data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]; |
322 | - } |
|
323 | - elseif (isset($data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0])) |
|
314 | + } elseif (isset($data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0])) |
|
324 | 315 | { |
325 | 316 | $feed =& $data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]; |
326 | - } |
|
327 | - elseif (isset($data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0])) |
|
317 | + } elseif (isset($data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0])) |
|
328 | 318 | { |
329 | 319 | $feed =& $data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]; |
330 | - } |
|
331 | - else |
|
320 | + } else |
|
332 | 321 | { |
333 | 322 | $feed = null; |
334 | 323 | } |
@@ -349,8 +338,7 @@ discard block |
||
349 | 338 | { |
350 | 339 | $feed['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['entry'][] = unserialize($row); |
351 | 340 | } |
352 | - } |
|
353 | - else |
|
341 | + } else |
|
354 | 342 | { |
355 | 343 | return false; |
356 | 344 | } |
@@ -378,8 +366,7 @@ discard block |
||
378 | 366 | if ($query->execute() && ($time = $query->fetchColumn())) |
379 | 367 | { |
380 | 368 | return $time; |
381 | - } |
|
382 | - else |
|
369 | + } else |
|
383 | 370 | { |
384 | 371 | return false; |
385 | 372 | } |
@@ -403,8 +390,7 @@ discard block |
||
403 | 390 | if ($query->execute() && $query->rowCount() > 0) |
404 | 391 | { |
405 | 392 | return true; |
406 | - } |
|
407 | - else |
|
393 | + } else |
|
408 | 394 | { |
409 | 395 | return false; |
410 | 396 | } |
@@ -429,8 +415,7 @@ discard block |
||
429 | 415 | if ($query->execute() && $query2->execute()) |
430 | 416 | { |
431 | 417 | return true; |
432 | - } |
|
433 | - else |
|
418 | + } else |
|
434 | 419 | { |
435 | 420 | return false; |
436 | 421 | } |
@@ -112,8 +112,7 @@ discard block |
||
112 | 112 | if ($this->relationship !== null) |
113 | 113 | { |
114 | 114 | return $this->relationship; |
115 | - } |
|
116 | - else |
|
115 | + } else |
|
117 | 116 | { |
118 | 117 | return null; |
119 | 118 | } |
@@ -129,8 +128,7 @@ discard block |
||
129 | 128 | if ($this->type !== null) |
130 | 129 | { |
131 | 130 | return $this->type; |
132 | - } |
|
133 | - else |
|
131 | + } else |
|
134 | 132 | { |
135 | 133 | return null; |
136 | 134 | } |
@@ -146,8 +144,7 @@ discard block |
||
146 | 144 | if ($this->value !== null) |
147 | 145 | { |
148 | 146 | return $this->value; |
149 | - } |
|
150 | - else |
|
147 | + } else |
|
151 | 148 | { |
152 | 149 | return null; |
153 | 150 | } |
@@ -113,8 +113,7 @@ discard block |
||
113 | 113 | if ($this->term !== null) |
114 | 114 | { |
115 | 115 | return $this->term; |
116 | - } |
|
117 | - else |
|
116 | + } else |
|
118 | 117 | { |
119 | 118 | return null; |
120 | 119 | } |
@@ -130,8 +129,7 @@ discard block |
||
130 | 129 | if ($this->scheme !== null) |
131 | 130 | { |
132 | 131 | return $this->scheme; |
133 | - } |
|
134 | - else |
|
132 | + } else |
|
135 | 133 | { |
136 | 134 | return null; |
137 | 135 | } |
@@ -147,8 +145,7 @@ discard block |
||
147 | 145 | if ($this->label !== null) |
148 | 146 | { |
149 | 147 | return $this->label; |
150 | - } |
|
151 | - else |
|
148 | + } else |
|
152 | 149 | { |
153 | 150 | return $this->get_term(); |
154 | 151 | } |
@@ -113,8 +113,7 @@ discard block |
||
113 | 113 | if ($this->name !== null) |
114 | 114 | { |
115 | 115 | return $this->name; |
116 | - } |
|
117 | - else |
|
116 | + } else |
|
118 | 117 | { |
119 | 118 | return null; |
120 | 119 | } |
@@ -130,8 +129,7 @@ discard block |
||
130 | 129 | if ($this->link !== null) |
131 | 130 | { |
132 | 131 | return $this->link; |
133 | - } |
|
134 | - else |
|
132 | + } else |
|
135 | 133 | { |
136 | 134 | return null; |
137 | 135 | } |
@@ -147,8 +145,7 @@ discard block |
||
147 | 145 | if ($this->email !== null) |
148 | 146 | { |
149 | 147 | return $this->email; |
150 | - } |
|
151 | - else |
|
148 | + } else |
|
152 | 149 | { |
153 | 150 | return null; |
154 | 151 | } |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | */ |
114 | 114 | public function register($type, $class, $legacy = false) |
115 | 115 | { |
116 | - if (!is_subclass_of($class, $this->default[$type])) |
|
116 | + if ( ! is_subclass_of($class, $this->default[$type])) |
|
117 | 117 | { |
118 | 118 | return false; |
119 | 119 | } |
@@ -138,11 +138,11 @@ discard block |
||
138 | 138 | */ |
139 | 139 | public function get_class($type) |
140 | 140 | { |
141 | - if (!empty($this->classes[$type])) |
|
141 | + if ( ! empty($this->classes[$type])) |
|
142 | 142 | { |
143 | 143 | return $this->classes[$type]; |
144 | 144 | } |
145 | - if (!empty($this->default[$type])) |
|
145 | + if ( ! empty($this->default[$type])) |
|
146 | 146 | { |
147 | 147 | return $this->default[$type]; |
148 | 148 | } |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | } |
175 | 175 | } |
176 | 176 | |
177 | - if (!method_exists($class, '__construct')) |
|
177 | + if ( ! method_exists($class, '__construct')) |
|
178 | 178 | { |
179 | 179 | $instance = new $class; |
180 | 180 | } |
@@ -177,8 +177,7 @@ |
||
177 | 177 | if (!method_exists($class, '__construct')) |
178 | 178 | { |
179 | 179 | $instance = new $class; |
180 | - } |
|
181 | - else |
|
180 | + } else |
|
182 | 181 | { |
183 | 182 | $reflector = new ReflectionClass($class); |
184 | 183 | $instance = $reflector->newInstanceArgs($parameters); |