@@ -1,46 +1,46 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * SimplePie |
|
4 | - * |
|
5 | - * A PHP-Based RSS and Atom Feed Framework. |
|
6 | - * Takes the hard work out of managing a complete RSS/Atom solution. |
|
7 | - * |
|
8 | - * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors |
|
9 | - * All rights reserved. |
|
10 | - * |
|
11 | - * Redistribution and use in source and binary forms, with or without modification, are |
|
12 | - * permitted provided that the following conditions are met: |
|
13 | - * |
|
14 | - * * Redistributions of source code must retain the above copyright notice, this list of |
|
15 | - * conditions and the following disclaimer. |
|
16 | - * |
|
17 | - * * Redistributions in binary form must reproduce the above copyright notice, this list |
|
18 | - * of conditions and the following disclaimer in the documentation and/or other materials |
|
19 | - * provided with the distribution. |
|
20 | - * |
|
21 | - * * Neither the name of the SimplePie Team nor the names of its contributors may be used |
|
22 | - * to endorse or promote products derived from this software without specific prior |
|
23 | - * written permission. |
|
24 | - * |
|
25 | - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS |
|
26 | - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY |
|
27 | - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS |
|
28 | - * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
|
29 | - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
|
30 | - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
|
31 | - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
|
32 | - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
33 | - * POSSIBILITY OF SUCH DAMAGE. |
|
34 | - * |
|
35 | - * @package SimplePie |
|
36 | - * @version 1.3.1 |
|
37 | - * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue |
|
38 | - * @author Ryan Parman |
|
39 | - * @author Geoffrey Sneddon |
|
40 | - * @author Ryan McCue |
|
41 | - * @link http://simplepie.org/ SimplePie |
|
42 | - * @license http://www.opensource.org/licenses/bsd-license.php BSD License |
|
43 | - */ |
|
3 | + * SimplePie |
|
4 | + * |
|
5 | + * A PHP-Based RSS and Atom Feed Framework. |
|
6 | + * Takes the hard work out of managing a complete RSS/Atom solution. |
|
7 | + * |
|
8 | + * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors |
|
9 | + * All rights reserved. |
|
10 | + * |
|
11 | + * Redistribution and use in source and binary forms, with or without modification, are |
|
12 | + * permitted provided that the following conditions are met: |
|
13 | + * |
|
14 | + * * Redistributions of source code must retain the above copyright notice, this list of |
|
15 | + * conditions and the following disclaimer. |
|
16 | + * |
|
17 | + * * Redistributions in binary form must reproduce the above copyright notice, this list |
|
18 | + * of conditions and the following disclaimer in the documentation and/or other materials |
|
19 | + * provided with the distribution. |
|
20 | + * |
|
21 | + * * Neither the name of the SimplePie Team nor the names of its contributors may be used |
|
22 | + * to endorse or promote products derived from this software without specific prior |
|
23 | + * written permission. |
|
24 | + * |
|
25 | + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS |
|
26 | + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY |
|
27 | + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS |
|
28 | + * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
|
29 | + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
|
30 | + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
|
31 | + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
|
32 | + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
33 | + * POSSIBILITY OF SUCH DAMAGE. |
|
34 | + * |
|
35 | + * @package SimplePie |
|
36 | + * @version 1.3.1 |
|
37 | + * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue |
|
38 | + * @author Ryan Parman |
|
39 | + * @author Geoffrey Sneddon |
|
40 | + * @author Ryan McCue |
|
41 | + * @link http://simplepie.org/ SimplePie |
|
42 | + * @license http://www.opensource.org/licenses/bsd-license.php BSD License |
|
43 | + */ |
|
44 | 44 | |
45 | 45 | /** |
46 | 46 | * Caches data to memcache |
@@ -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']); |
@@ -1,46 +1,46 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * SimplePie |
|
4 | - * |
|
5 | - * A PHP-Based RSS and Atom Feed Framework. |
|
6 | - * Takes the hard work out of managing a complete RSS/Atom solution. |
|
7 | - * |
|
8 | - * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors |
|
9 | - * All rights reserved. |
|
10 | - * |
|
11 | - * Redistribution and use in source and binary forms, with or without modification, are |
|
12 | - * permitted provided that the following conditions are met: |
|
13 | - * |
|
14 | - * * Redistributions of source code must retain the above copyright notice, this list of |
|
15 | - * conditions and the following disclaimer. |
|
16 | - * |
|
17 | - * * Redistributions in binary form must reproduce the above copyright notice, this list |
|
18 | - * of conditions and the following disclaimer in the documentation and/or other materials |
|
19 | - * provided with the distribution. |
|
20 | - * |
|
21 | - * * Neither the name of the SimplePie Team nor the names of its contributors may be used |
|
22 | - * to endorse or promote products derived from this software without specific prior |
|
23 | - * written permission. |
|
24 | - * |
|
25 | - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS |
|
26 | - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY |
|
27 | - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS |
|
28 | - * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
|
29 | - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
|
30 | - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
|
31 | - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
|
32 | - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
33 | - * POSSIBILITY OF SUCH DAMAGE. |
|
34 | - * |
|
35 | - * @package SimplePie |
|
36 | - * @version 1.3.1 |
|
37 | - * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue |
|
38 | - * @author Ryan Parman |
|
39 | - * @author Geoffrey Sneddon |
|
40 | - * @author Ryan McCue |
|
41 | - * @link http://simplepie.org/ SimplePie |
|
42 | - * @license http://www.opensource.org/licenses/bsd-license.php BSD License |
|
43 | - */ |
|
3 | + * SimplePie |
|
4 | + * |
|
5 | + * A PHP-Based RSS and Atom Feed Framework. |
|
6 | + * Takes the hard work out of managing a complete RSS/Atom solution. |
|
7 | + * |
|
8 | + * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors |
|
9 | + * All rights reserved. |
|
10 | + * |
|
11 | + * Redistribution and use in source and binary forms, with or without modification, are |
|
12 | + * permitted provided that the following conditions are met: |
|
13 | + * |
|
14 | + * * Redistributions of source code must retain the above copyright notice, this list of |
|
15 | + * conditions and the following disclaimer. |
|
16 | + * |
|
17 | + * * Redistributions in binary form must reproduce the above copyright notice, this list |
|
18 | + * of conditions and the following disclaimer in the documentation and/or other materials |
|
19 | + * provided with the distribution. |
|
20 | + * |
|
21 | + * * Neither the name of the SimplePie Team nor the names of its contributors may be used |
|
22 | + * to endorse or promote products derived from this software without specific prior |
|
23 | + * written permission. |
|
24 | + * |
|
25 | + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS |
|
26 | + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY |
|
27 | + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS |
|
28 | + * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
|
29 | + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
|
30 | + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
|
31 | + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
|
32 | + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
33 | + * POSSIBILITY OF SUCH DAMAGE. |
|
34 | + * |
|
35 | + * @package SimplePie |
|
36 | + * @version 1.3.1 |
|
37 | + * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue |
|
38 | + * @author Ryan Parman |
|
39 | + * @author Geoffrey Sneddon |
|
40 | + * @author Ryan McCue |
|
41 | + * @link http://simplepie.org/ SimplePie |
|
42 | + * @license http://www.opensource.org/licenses/bsd-license.php BSD License |
|
43 | + */ |
|
44 | 44 | |
45 | 45 | /** |
46 | 46 | * Caches data to a MySQL database |
@@ -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 | } |
@@ -1,46 +1,46 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * SimplePie |
|
4 | - * |
|
5 | - * A PHP-Based RSS and Atom Feed Framework. |
|
6 | - * Takes the hard work out of managing a complete RSS/Atom solution. |
|
7 | - * |
|
8 | - * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors |
|
9 | - * All rights reserved. |
|
10 | - * |
|
11 | - * Redistribution and use in source and binary forms, with or without modification, are |
|
12 | - * permitted provided that the following conditions are met: |
|
13 | - * |
|
14 | - * * Redistributions of source code must retain the above copyright notice, this list of |
|
15 | - * conditions and the following disclaimer. |
|
16 | - * |
|
17 | - * * Redistributions in binary form must reproduce the above copyright notice, this list |
|
18 | - * of conditions and the following disclaimer in the documentation and/or other materials |
|
19 | - * provided with the distribution. |
|
20 | - * |
|
21 | - * * Neither the name of the SimplePie Team nor the names of its contributors may be used |
|
22 | - * to endorse or promote products derived from this software without specific prior |
|
23 | - * written permission. |
|
24 | - * |
|
25 | - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS |
|
26 | - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY |
|
27 | - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS |
|
28 | - * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
|
29 | - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
|
30 | - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
|
31 | - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
|
32 | - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
33 | - * POSSIBILITY OF SUCH DAMAGE. |
|
34 | - * |
|
35 | - * @package SimplePie |
|
36 | - * @version 1.3.1 |
|
37 | - * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue |
|
38 | - * @author Ryan Parman |
|
39 | - * @author Geoffrey Sneddon |
|
40 | - * @author Ryan McCue |
|
41 | - * @link http://simplepie.org/ SimplePie |
|
42 | - * @license http://www.opensource.org/licenses/bsd-license.php BSD License |
|
43 | - */ |
|
3 | + * SimplePie |
|
4 | + * |
|
5 | + * A PHP-Based RSS and Atom Feed Framework. |
|
6 | + * Takes the hard work out of managing a complete RSS/Atom solution. |
|
7 | + * |
|
8 | + * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors |
|
9 | + * All rights reserved. |
|
10 | + * |
|
11 | + * Redistribution and use in source and binary forms, with or without modification, are |
|
12 | + * permitted provided that the following conditions are met: |
|
13 | + * |
|
14 | + * * Redistributions of source code must retain the above copyright notice, this list of |
|
15 | + * conditions and the following disclaimer. |
|
16 | + * |
|
17 | + * * Redistributions in binary form must reproduce the above copyright notice, this list |
|
18 | + * of conditions and the following disclaimer in the documentation and/or other materials |
|
19 | + * provided with the distribution. |
|
20 | + * |
|
21 | + * * Neither the name of the SimplePie Team nor the names of its contributors may be used |
|
22 | + * to endorse or promote products derived from this software without specific prior |
|
23 | + * written permission. |
|
24 | + * |
|
25 | + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS |
|
26 | + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY |
|
27 | + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS |
|
28 | + * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
|
29 | + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
|
30 | + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
|
31 | + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
|
32 | + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
33 | + * POSSIBILITY OF SUCH DAMAGE. |
|
34 | + * |
|
35 | + * @package SimplePie |
|
36 | + * @version 1.3.1 |
|
37 | + * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue |
|
38 | + * @author Ryan Parman |
|
39 | + * @author Geoffrey Sneddon |
|
40 | + * @author Ryan McCue |
|
41 | + * @link http://simplepie.org/ SimplePie |
|
42 | + * @license http://www.opensource.org/licenses/bsd-license.php BSD License |
|
43 | + */ |
|
44 | 44 | |
45 | 45 | /** |
46 | 46 | * Caches data to the filesystem |
@@ -1,46 +1,46 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * SimplePie |
|
4 | - * |
|
5 | - * A PHP-Based RSS and Atom Feed Framework. |
|
6 | - * Takes the hard work out of managing a complete RSS/Atom solution. |
|
7 | - * |
|
8 | - * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors |
|
9 | - * All rights reserved. |
|
10 | - * |
|
11 | - * Redistribution and use in source and binary forms, with or without modification, are |
|
12 | - * permitted provided that the following conditions are met: |
|
13 | - * |
|
14 | - * * Redistributions of source code must retain the above copyright notice, this list of |
|
15 | - * conditions and the following disclaimer. |
|
16 | - * |
|
17 | - * * Redistributions in binary form must reproduce the above copyright notice, this list |
|
18 | - * of conditions and the following disclaimer in the documentation and/or other materials |
|
19 | - * provided with the distribution. |
|
20 | - * |
|
21 | - * * Neither the name of the SimplePie Team nor the names of its contributors may be used |
|
22 | - * to endorse or promote products derived from this software without specific prior |
|
23 | - * written permission. |
|
24 | - * |
|
25 | - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS |
|
26 | - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY |
|
27 | - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS |
|
28 | - * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
|
29 | - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
|
30 | - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
|
31 | - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
|
32 | - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
33 | - * POSSIBILITY OF SUCH DAMAGE. |
|
34 | - * |
|
35 | - * @package SimplePie |
|
36 | - * @version 1.3.1 |
|
37 | - * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue |
|
38 | - * @author Ryan Parman |
|
39 | - * @author Geoffrey Sneddon |
|
40 | - * @author Ryan McCue |
|
41 | - * @link http://simplepie.org/ SimplePie |
|
42 | - * @license http://www.opensource.org/licenses/bsd-license.php BSD License |
|
43 | - */ |
|
3 | + * SimplePie |
|
4 | + * |
|
5 | + * A PHP-Based RSS and Atom Feed Framework. |
|
6 | + * Takes the hard work out of managing a complete RSS/Atom solution. |
|
7 | + * |
|
8 | + * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors |
|
9 | + * All rights reserved. |
|
10 | + * |
|
11 | + * Redistribution and use in source and binary forms, with or without modification, are |
|
12 | + * permitted provided that the following conditions are met: |
|
13 | + * |
|
14 | + * * Redistributions of source code must retain the above copyright notice, this list of |
|
15 | + * conditions and the following disclaimer. |
|
16 | + * |
|
17 | + * * Redistributions in binary form must reproduce the above copyright notice, this list |
|
18 | + * of conditions and the following disclaimer in the documentation and/or other materials |
|
19 | + * provided with the distribution. |
|
20 | + * |
|
21 | + * * Neither the name of the SimplePie Team nor the names of its contributors may be used |
|
22 | + * to endorse or promote products derived from this software without specific prior |
|
23 | + * written permission. |
|
24 | + * |
|
25 | + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS |
|
26 | + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY |
|
27 | + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS |
|
28 | + * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
|
29 | + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
|
30 | + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
|
31 | + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
|
32 | + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
33 | + * POSSIBILITY OF SUCH DAMAGE. |
|
34 | + * |
|
35 | + * @package SimplePie |
|
36 | + * @version 1.3.1 |
|
37 | + * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue |
|
38 | + * @author Ryan Parman |
|
39 | + * @author Geoffrey Sneddon |
|
40 | + * @author Ryan McCue |
|
41 | + * @link http://simplepie.org/ SimplePie |
|
42 | + * @license http://www.opensource.org/licenses/bsd-license.php BSD License |
|
43 | + */ |
|
44 | 44 | |
45 | 45 | /** |
46 | 46 | * Base for cache objects |
@@ -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 | } |
@@ -1,46 +1,46 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * SimplePie |
|
4 | - * |
|
5 | - * A PHP-Based RSS and Atom Feed Framework. |
|
6 | - * Takes the hard work out of managing a complete RSS/Atom solution. |
|
7 | - * |
|
8 | - * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors |
|
9 | - * All rights reserved. |
|
10 | - * |
|
11 | - * Redistribution and use in source and binary forms, with or without modification, are |
|
12 | - * permitted provided that the following conditions are met: |
|
13 | - * |
|
14 | - * * Redistributions of source code must retain the above copyright notice, this list of |
|
15 | - * conditions and the following disclaimer. |
|
16 | - * |
|
17 | - * * Redistributions in binary form must reproduce the above copyright notice, this list |
|
18 | - * of conditions and the following disclaimer in the documentation and/or other materials |
|
19 | - * provided with the distribution. |
|
20 | - * |
|
21 | - * * Neither the name of the SimplePie Team nor the names of its contributors may be used |
|
22 | - * to endorse or promote products derived from this software without specific prior |
|
23 | - * written permission. |
|
24 | - * |
|
25 | - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS |
|
26 | - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY |
|
27 | - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS |
|
28 | - * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
|
29 | - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
|
30 | - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
|
31 | - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
|
32 | - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
33 | - * POSSIBILITY OF SUCH DAMAGE. |
|
34 | - * |
|
35 | - * @package SimplePie |
|
36 | - * @version 1.3.1 |
|
37 | - * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue |
|
38 | - * @author Ryan Parman |
|
39 | - * @author Geoffrey Sneddon |
|
40 | - * @author Ryan McCue |
|
41 | - * @link http://simplepie.org/ SimplePie |
|
42 | - * @license http://www.opensource.org/licenses/bsd-license.php BSD License |
|
43 | - */ |
|
3 | + * SimplePie |
|
4 | + * |
|
5 | + * A PHP-Based RSS and Atom Feed Framework. |
|
6 | + * Takes the hard work out of managing a complete RSS/Atom solution. |
|
7 | + * |
|
8 | + * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors |
|
9 | + * All rights reserved. |
|
10 | + * |
|
11 | + * Redistribution and use in source and binary forms, with or without modification, are |
|
12 | + * permitted provided that the following conditions are met: |
|
13 | + * |
|
14 | + * * Redistributions of source code must retain the above copyright notice, this list of |
|
15 | + * conditions and the following disclaimer. |
|
16 | + * |
|
17 | + * * Redistributions in binary form must reproduce the above copyright notice, this list |
|
18 | + * of conditions and the following disclaimer in the documentation and/or other materials |
|
19 | + * provided with the distribution. |
|
20 | + * |
|
21 | + * * Neither the name of the SimplePie Team nor the names of its contributors may be used |
|
22 | + * to endorse or promote products derived from this software without specific prior |
|
23 | + * written permission. |
|
24 | + * |
|
25 | + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS |
|
26 | + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY |
|
27 | + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS |
|
28 | + * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
|
29 | + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
|
30 | + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
|
31 | + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
|
32 | + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
33 | + * POSSIBILITY OF SUCH DAMAGE. |
|
34 | + * |
|
35 | + * @package SimplePie |
|
36 | + * @version 1.3.1 |
|
37 | + * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue |
|
38 | + * @author Ryan Parman |
|
39 | + * @author Geoffrey Sneddon |
|
40 | + * @author Ryan McCue |
|
41 | + * @link http://simplepie.org/ SimplePie |
|
42 | + * @license http://www.opensource.org/licenses/bsd-license.php BSD License |
|
43 | + */ |
|
44 | 44 | |
45 | 45 | /** |
46 | 46 | * Manages all category-related data |
@@ -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 | } |
@@ -1,46 +1,46 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * SimplePie |
|
4 | - * |
|
5 | - * A PHP-Based RSS and Atom Feed Framework. |
|
6 | - * Takes the hard work out of managing a complete RSS/Atom solution. |
|
7 | - * |
|
8 | - * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors |
|
9 | - * All rights reserved. |
|
10 | - * |
|
11 | - * Redistribution and use in source and binary forms, with or without modification, are |
|
12 | - * permitted provided that the following conditions are met: |
|
13 | - * |
|
14 | - * * Redistributions of source code must retain the above copyright notice, this list of |
|
15 | - * conditions and the following disclaimer. |
|
16 | - * |
|
17 | - * * Redistributions in binary form must reproduce the above copyright notice, this list |
|
18 | - * of conditions and the following disclaimer in the documentation and/or other materials |
|
19 | - * provided with the distribution. |
|
20 | - * |
|
21 | - * * Neither the name of the SimplePie Team nor the names of its contributors may be used |
|
22 | - * to endorse or promote products derived from this software without specific prior |
|
23 | - * written permission. |
|
24 | - * |
|
25 | - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS |
|
26 | - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY |
|
27 | - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS |
|
28 | - * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
|
29 | - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
|
30 | - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
|
31 | - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
|
32 | - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
33 | - * POSSIBILITY OF SUCH DAMAGE. |
|
34 | - * |
|
35 | - * @package SimplePie |
|
36 | - * @version 1.3.1 |
|
37 | - * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue |
|
38 | - * @author Ryan Parman |
|
39 | - * @author Geoffrey Sneddon |
|
40 | - * @author Ryan McCue |
|
41 | - * @link http://simplepie.org/ SimplePie |
|
42 | - * @license http://www.opensource.org/licenses/bsd-license.php BSD License |
|
43 | - */ |
|
3 | + * SimplePie |
|
4 | + * |
|
5 | + * A PHP-Based RSS and Atom Feed Framework. |
|
6 | + * Takes the hard work out of managing a complete RSS/Atom solution. |
|
7 | + * |
|
8 | + * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors |
|
9 | + * All rights reserved. |
|
10 | + * |
|
11 | + * Redistribution and use in source and binary forms, with or without modification, are |
|
12 | + * permitted provided that the following conditions are met: |
|
13 | + * |
|
14 | + * * Redistributions of source code must retain the above copyright notice, this list of |
|
15 | + * conditions and the following disclaimer. |
|
16 | + * |
|
17 | + * * Redistributions in binary form must reproduce the above copyright notice, this list |
|
18 | + * of conditions and the following disclaimer in the documentation and/or other materials |
|
19 | + * provided with the distribution. |
|
20 | + * |
|
21 | + * * Neither the name of the SimplePie Team nor the names of its contributors may be used |
|
22 | + * to endorse or promote products derived from this software without specific prior |
|
23 | + * written permission. |
|
24 | + * |
|
25 | + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS |
|
26 | + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY |
|
27 | + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS |
|
28 | + * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
|
29 | + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
|
30 | + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
|
31 | + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
|
32 | + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
33 | + * POSSIBILITY OF SUCH DAMAGE. |
|
34 | + * |
|
35 | + * @package SimplePie |
|
36 | + * @version 1.3.1 |
|
37 | + * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue |
|
38 | + * @author Ryan Parman |
|
39 | + * @author Geoffrey Sneddon |
|
40 | + * @author Ryan McCue |
|
41 | + * @link http://simplepie.org/ SimplePie |
|
42 | + * @license http://www.opensource.org/licenses/bsd-license.php BSD License |
|
43 | + */ |
|
44 | 44 | |
45 | 45 | /** |
46 | 46 | * Manages all author-related data |
@@ -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); |
@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * API for easily embedding rich media such as videos and images into content. |
|
4 | - * |
|
5 | - * @package WordPress |
|
6 | - * @subpackage Embed |
|
7 | - * @since 2.9.0 |
|
8 | - */ |
|
3 | + * API for easily embedding rich media such as videos and images into content. |
|
4 | + * |
|
5 | + * @package WordPress |
|
6 | + * @subpackage Embed |
|
7 | + * @since 2.9.0 |
|
8 | + */ |
|
9 | 9 | class WP_Embed { |
10 | 10 | public $handlers = array(); |
11 | 11 | public $post_ID; |
@@ -25,17 +25,17 @@ discard block |
||
25 | 25 | */ |
26 | 26 | public function __construct() { |
27 | 27 | // Hack to get the [embed] shortcode to run before wpautop() |
28 | - add_filter( 'the_content', array( $this, 'run_shortcode' ), 8 ); |
|
28 | + add_filter('the_content', array($this, 'run_shortcode'), 8); |
|
29 | 29 | |
30 | 30 | // Shortcode placeholder for strip_shortcodes() |
31 | - add_shortcode( 'embed', '__return_false' ); |
|
31 | + add_shortcode('embed', '__return_false'); |
|
32 | 32 | |
33 | 33 | // Attempts to embed all URLs in a post |
34 | - add_filter( 'the_content', array( $this, 'autoembed' ), 8 ); |
|
34 | + add_filter('the_content', array($this, 'autoembed'), 8); |
|
35 | 35 | |
36 | 36 | // After a post is saved, cache oEmbed items via AJAX |
37 | - add_action( 'edit_form_advanced', array( $this, 'maybe_run_ajax_cache' ) ); |
|
38 | - add_action( 'edit_page_form', array( $this, 'maybe_run_ajax_cache' ) ); |
|
37 | + add_action('edit_form_advanced', array($this, 'maybe_run_ajax_cache')); |
|
38 | + add_action('edit_page_form', array($this, 'maybe_run_ajax_cache')); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
@@ -50,17 +50,17 @@ discard block |
||
50 | 50 | * @param string $content Content to parse |
51 | 51 | * @return string Content with shortcode parsed |
52 | 52 | */ |
53 | - public function run_shortcode( $content ) { |
|
53 | + public function run_shortcode($content) { |
|
54 | 54 | global $shortcode_tags; |
55 | 55 | |
56 | 56 | // Back up current registered shortcodes and clear them all out |
57 | 57 | $orig_shortcode_tags = $shortcode_tags; |
58 | 58 | remove_all_shortcodes(); |
59 | 59 | |
60 | - add_shortcode( 'embed', array( $this, 'shortcode' ) ); |
|
60 | + add_shortcode('embed', array($this, 'shortcode')); |
|
61 | 61 | |
62 | 62 | // Do the shortcode (only the [embed] one is registered) |
63 | - $content = do_shortcode( $content, true ); |
|
63 | + $content = do_shortcode($content, true); |
|
64 | 64 | |
65 | 65 | // Put the original shortcodes back |
66 | 66 | $shortcode_tags = $orig_shortcode_tags; |
@@ -75,13 +75,13 @@ discard block |
||
75 | 75 | public function maybe_run_ajax_cache() { |
76 | 76 | $post = get_post(); |
77 | 77 | |
78 | - if ( ! $post || empty( $_GET['message'] ) ) |
|
78 | + if ( ! $post || empty($_GET['message'])) |
|
79 | 79 | return; |
80 | 80 | |
81 | 81 | ?> |
82 | 82 | <script type="text/javascript"> |
83 | 83 | jQuery(document).ready(function($){ |
84 | - $.get("<?php echo admin_url( 'admin-ajax.php?action=oembed-cache&post=' . $post->ID, 'relative' ); ?>"); |
|
84 | + $.get("<?php echo admin_url('admin-ajax.php?action=oembed-cache&post='.$post->ID, 'relative'); ?>"); |
|
85 | 85 | }); |
86 | 86 | </script> |
87 | 87 | <?php |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | * @param callable $callback The callback function that will be called if the regex is matched. |
97 | 97 | * @param int $priority Optional. Used to specify the order in which the registered handlers will be tested (default: 10). Lower numbers correspond with earlier testing, and handlers with the same priority are tested in the order in which they were added to the action. |
98 | 98 | */ |
99 | - public function register_handler( $id, $regex, $callback, $priority = 10 ) { |
|
99 | + public function register_handler($id, $regex, $callback, $priority = 10) { |
|
100 | 100 | $this->handlers[$priority][$id] = array( |
101 | 101 | 'regex' => $regex, |
102 | 102 | 'callback' => $callback, |
@@ -109,8 +109,8 @@ discard block |
||
109 | 109 | * @param string $id The handler ID that should be removed. |
110 | 110 | * @param int $priority Optional. The priority of the handler to be removed (default: 10). |
111 | 111 | */ |
112 | - public function unregister_handler( $id, $priority = 10 ) { |
|
113 | - unset( $this->handlers[ $priority ][ $id ] ); |
|
112 | + public function unregister_handler($id, $priority = 10) { |
|
113 | + unset($this->handlers[$priority][$id]); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | /** |
@@ -129,35 +129,35 @@ discard block |
||
129 | 129 | * @return string|false The embed HTML on success, otherwise the original URL. |
130 | 130 | * `->maybe_make_link()` can return false on failure. |
131 | 131 | */ |
132 | - public function shortcode( $attr, $url = '' ) { |
|
132 | + public function shortcode($attr, $url = '') { |
|
133 | 133 | $post = get_post(); |
134 | 134 | |
135 | - if ( empty( $url ) && ! empty( $attr['src'] ) ) { |
|
135 | + if (empty($url) && ! empty($attr['src'])) { |
|
136 | 136 | $url = $attr['src']; |
137 | 137 | } |
138 | 138 | |
139 | 139 | $this->last_url = $url; |
140 | 140 | |
141 | - if ( empty( $url ) ) { |
|
141 | + if (empty($url)) { |
|
142 | 142 | $this->last_attr = $attr; |
143 | 143 | return ''; |
144 | 144 | } |
145 | 145 | |
146 | 146 | $rawattr = $attr; |
147 | - $attr = wp_parse_args( $attr, wp_embed_defaults( $url ) ); |
|
147 | + $attr = wp_parse_args($attr, wp_embed_defaults($url)); |
|
148 | 148 | |
149 | 149 | $this->last_attr = $attr; |
150 | 150 | |
151 | 151 | // kses converts & into & and we need to undo this |
152 | 152 | // See https://core.trac.wordpress.org/ticket/11311 |
153 | - $url = str_replace( '&', '&', $url ); |
|
153 | + $url = str_replace('&', '&', $url); |
|
154 | 154 | |
155 | 155 | // Look for known internal handlers |
156 | - ksort( $this->handlers ); |
|
157 | - foreach ( $this->handlers as $priority => $handlers ) { |
|
158 | - foreach ( $handlers as $id => $handler ) { |
|
159 | - if ( preg_match( $handler['regex'], $url, $matches ) && is_callable( $handler['callback'] ) ) { |
|
160 | - if ( false !== $return = call_user_func( $handler['callback'], $matches, $attr, $url, $rawattr ) ) |
|
156 | + ksort($this->handlers); |
|
157 | + foreach ($this->handlers as $priority => $handlers) { |
|
158 | + foreach ($handlers as $id => $handler) { |
|
159 | + if (preg_match($handler['regex'], $url, $matches) && is_callable($handler['callback'])) { |
|
160 | + if (false !== $return = call_user_func($handler['callback'], $matches, $attr, $url, $rawattr)) |
|
161 | 161 | /** |
162 | 162 | * Filter the returned embed handler. |
163 | 163 | * |
@@ -169,22 +169,22 @@ discard block |
||
169 | 169 | * @param string $url The attempted embed URL. |
170 | 170 | * @param array $attr An array of shortcode attributes. |
171 | 171 | */ |
172 | - return apply_filters( 'embed_handler_html', $return, $url, $attr ); |
|
172 | + return apply_filters('embed_handler_html', $return, $url, $attr); |
|
173 | 173 | } |
174 | 174 | } |
175 | 175 | } |
176 | 176 | |
177 | - $post_ID = ( ! empty( $post->ID ) ) ? $post->ID : null; |
|
178 | - if ( ! empty( $this->post_ID ) ) // Potentially set by WP_Embed::cache_oembed() |
|
177 | + $post_ID = ( ! empty($post->ID)) ? $post->ID : null; |
|
178 | + if ( ! empty($this->post_ID)) // Potentially set by WP_Embed::cache_oembed() |
|
179 | 179 | $post_ID = $this->post_ID; |
180 | 180 | |
181 | 181 | // Unknown URL format. Let oEmbed have a go. |
182 | - if ( $post_ID ) { |
|
182 | + if ($post_ID) { |
|
183 | 183 | |
184 | 184 | // Check for a cached result (stored in the post meta) |
185 | - $key_suffix = md5( $url . serialize( $attr ) ); |
|
186 | - $cachekey = '_oembed_' . $key_suffix; |
|
187 | - $cachekey_time = '_oembed_time_' . $key_suffix; |
|
185 | + $key_suffix = md5($url.serialize($attr)); |
|
186 | + $cachekey = '_oembed_'.$key_suffix; |
|
187 | + $cachekey_time = '_oembed_time_'.$key_suffix; |
|
188 | 188 | |
189 | 189 | /** |
190 | 190 | * Filter the oEmbed TTL value (time to live). |
@@ -196,23 +196,23 @@ discard block |
||
196 | 196 | * @param array $attr An array of shortcode attributes. |
197 | 197 | * @param int $post_ID Post ID. |
198 | 198 | */ |
199 | - $ttl = apply_filters( 'oembed_ttl', DAY_IN_SECONDS, $url, $attr, $post_ID ); |
|
199 | + $ttl = apply_filters('oembed_ttl', DAY_IN_SECONDS, $url, $attr, $post_ID); |
|
200 | 200 | |
201 | - $cache = get_post_meta( $post_ID, $cachekey, true ); |
|
202 | - $cache_time = get_post_meta( $post_ID, $cachekey_time, true ); |
|
201 | + $cache = get_post_meta($post_ID, $cachekey, true); |
|
202 | + $cache_time = get_post_meta($post_ID, $cachekey_time, true); |
|
203 | 203 | |
204 | - if ( ! $cache_time ) { |
|
204 | + if ( ! $cache_time) { |
|
205 | 205 | $cache_time = 0; |
206 | 206 | } |
207 | 207 | |
208 | - $cached_recently = ( time() - $cache_time ) < $ttl; |
|
208 | + $cached_recently = (time() - $cache_time) < $ttl; |
|
209 | 209 | |
210 | - if ( $this->usecache || $cached_recently ) { |
|
210 | + if ($this->usecache || $cached_recently) { |
|
211 | 211 | // Failures are cached. Serve one if we're using the cache. |
212 | - if ( '{{unknown}}' === $cache ) |
|
213 | - return $this->maybe_make_link( $url ); |
|
212 | + if ('{{unknown}}' === $cache) |
|
213 | + return $this->maybe_make_link($url); |
|
214 | 214 | |
215 | - if ( ! empty( $cache ) ) { |
|
215 | + if ( ! empty($cache)) { |
|
216 | 216 | /** |
217 | 217 | * Filter the cached oEmbed HTML. |
218 | 218 | * |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | * @param array $attr An array of shortcode attributes. |
226 | 226 | * @param int $post_ID Post ID. |
227 | 227 | */ |
228 | - return apply_filters( 'embed_oembed_html', $cache, $url, $attr, $post_ID ); |
|
228 | + return apply_filters('embed_oembed_html', $cache, $url, $attr, $post_ID); |
|
229 | 229 | } |
230 | 230 | } |
231 | 231 | |
@@ -238,28 +238,28 @@ discard block |
||
238 | 238 | * |
239 | 239 | * @param bool $enable Whether to enable `<link>` tag discovery. Default false. |
240 | 240 | */ |
241 | - $attr['discover'] = ( apply_filters( 'embed_oembed_discover', false ) && author_can( $post_ID, 'unfiltered_html' ) ); |
|
241 | + $attr['discover'] = (apply_filters('embed_oembed_discover', false) && author_can($post_ID, 'unfiltered_html')); |
|
242 | 242 | |
243 | 243 | // Use oEmbed to get the HTML |
244 | - $html = wp_oembed_get( $url, $attr ); |
|
244 | + $html = wp_oembed_get($url, $attr); |
|
245 | 245 | |
246 | 246 | // Maybe cache the result |
247 | - if ( $html ) { |
|
248 | - update_post_meta( $post_ID, $cachekey, $html ); |
|
249 | - update_post_meta( $post_ID, $cachekey_time, time() ); |
|
250 | - } elseif ( ! $cache ) { |
|
251 | - update_post_meta( $post_ID, $cachekey, '{{unknown}}' ); |
|
247 | + if ($html) { |
|
248 | + update_post_meta($post_ID, $cachekey, $html); |
|
249 | + update_post_meta($post_ID, $cachekey_time, time()); |
|
250 | + } elseif ( ! $cache) { |
|
251 | + update_post_meta($post_ID, $cachekey, '{{unknown}}'); |
|
252 | 252 | } |
253 | 253 | |
254 | 254 | // If there was a result, return it |
255 | - if ( $html ) { |
|
255 | + if ($html) { |
|
256 | 256 | /** This filter is documented in wp-includes/class-wp-embed.php */ |
257 | - return apply_filters( 'embed_oembed_html', $html, $url, $attr, $post_ID ); |
|
257 | + return apply_filters('embed_oembed_html', $html, $url, $attr, $post_ID); |
|
258 | 258 | } |
259 | 259 | } |
260 | 260 | |
261 | 261 | // Still unknown |
262 | - return $this->maybe_make_link( $url ); |
|
262 | + return $this->maybe_make_link($url); |
|
263 | 263 | } |
264 | 264 | |
265 | 265 | /** |
@@ -267,14 +267,14 @@ discard block |
||
267 | 267 | * |
268 | 268 | * @param int $post_ID Post ID to delete the caches for. |
269 | 269 | */ |
270 | - public function delete_oembed_caches( $post_ID ) { |
|
271 | - $post_metas = get_post_custom_keys( $post_ID ); |
|
272 | - if ( empty($post_metas) ) |
|
270 | + public function delete_oembed_caches($post_ID) { |
|
271 | + $post_metas = get_post_custom_keys($post_ID); |
|
272 | + if (empty($post_metas)) |
|
273 | 273 | return; |
274 | 274 | |
275 | - foreach( $post_metas as $post_meta_key ) { |
|
276 | - if ( '_oembed_' == substr( $post_meta_key, 0, 8 ) ) |
|
277 | - delete_post_meta( $post_ID, $post_meta_key ); |
|
275 | + foreach ($post_metas as $post_meta_key) { |
|
276 | + if ('_oembed_' == substr($post_meta_key, 0, 8)) |
|
277 | + delete_post_meta($post_ID, $post_meta_key); |
|
278 | 278 | } |
279 | 279 | } |
280 | 280 | |
@@ -283,10 +283,10 @@ discard block |
||
283 | 283 | * |
284 | 284 | * @param int $post_ID Post ID to do the caching for. |
285 | 285 | */ |
286 | - public function cache_oembed( $post_ID ) { |
|
287 | - $post = get_post( $post_ID ); |
|
286 | + public function cache_oembed($post_ID) { |
|
287 | + $post = get_post($post_ID); |
|
288 | 288 | |
289 | - $post_types = get_post_types( array( 'show_ui' => true ) ); |
|
289 | + $post_types = get_post_types(array('show_ui' => true)); |
|
290 | 290 | /** |
291 | 291 | * Filter the array of post types to cache oEmbed results for. |
292 | 292 | * |
@@ -294,17 +294,17 @@ discard block |
||
294 | 294 | * |
295 | 295 | * @param array $post_types Array of post types to cache oEmbed results for. Defaults to post types with `show_ui` set to true. |
296 | 296 | */ |
297 | - if ( empty( $post->ID ) || ! in_array( $post->post_type, apply_filters( 'embed_cache_oembed_types', $post_types ) ) ){ |
|
297 | + if (empty($post->ID) || ! in_array($post->post_type, apply_filters('embed_cache_oembed_types', $post_types))) { |
|
298 | 298 | return; |
299 | 299 | } |
300 | 300 | |
301 | 301 | // Trigger a caching |
302 | - if ( ! empty( $post->post_content ) ) { |
|
302 | + if ( ! empty($post->post_content)) { |
|
303 | 303 | $this->post_ID = $post->ID; |
304 | 304 | $this->usecache = false; |
305 | 305 | |
306 | - $content = $this->run_shortcode( $post->post_content ); |
|
307 | - $this->autoembed( $content ); |
|
306 | + $content = $this->run_shortcode($post->post_content); |
|
307 | + $this->autoembed($content); |
|
308 | 308 | |
309 | 309 | $this->usecache = true; |
310 | 310 | } |
@@ -318,15 +318,15 @@ discard block |
||
318 | 318 | * @param string $content The content to be searched. |
319 | 319 | * @return string Potentially modified $content. |
320 | 320 | */ |
321 | - public function autoembed( $content ) { |
|
321 | + public function autoembed($content) { |
|
322 | 322 | // Replace line breaks from all HTML elements with placeholders. |
323 | - $content = wp_replace_in_html_tags( $content, array( "\n" => '<!-- wp-line-break -->' ) ); |
|
323 | + $content = wp_replace_in_html_tags($content, array("\n" => '<!-- wp-line-break -->')); |
|
324 | 324 | |
325 | 325 | // Find URLs that are on their own line. |
326 | - $content = preg_replace_callback( '|^(\s*)(https?://[^\s"]+)(\s*)$|im', array( $this, 'autoembed_callback' ), $content ); |
|
326 | + $content = preg_replace_callback('|^(\s*)(https?://[^\s"]+)(\s*)$|im', array($this, 'autoembed_callback'), $content); |
|
327 | 327 | |
328 | 328 | // Put the line breaks back. |
329 | - return str_replace( '<!-- wp-line-break -->', "\n", $content ); |
|
329 | + return str_replace('<!-- wp-line-break -->', "\n", $content); |
|
330 | 330 | } |
331 | 331 | |
332 | 332 | /** |
@@ -335,13 +335,13 @@ discard block |
||
335 | 335 | * @param array $match A regex match array. |
336 | 336 | * @return string The embed HTML on success, otherwise the original URL. |
337 | 337 | */ |
338 | - public function autoembed_callback( $match ) { |
|
338 | + public function autoembed_callback($match) { |
|
339 | 339 | $oldval = $this->linkifunknown; |
340 | 340 | $this->linkifunknown = false; |
341 | - $return = $this->shortcode( array(), $match[2] ); |
|
341 | + $return = $this->shortcode(array(), $match[2]); |
|
342 | 342 | $this->linkifunknown = $oldval; |
343 | 343 | |
344 | - return $match[1] . $return . $match[3]; |
|
344 | + return $match[1].$return.$match[3]; |
|
345 | 345 | } |
346 | 346 | |
347 | 347 | /** |
@@ -350,12 +350,12 @@ discard block |
||
350 | 350 | * @param string $url URL to potentially be linked. |
351 | 351 | * @return false|string Linked URL or the original URL. False if 'return_false_on_fail' is true. |
352 | 352 | */ |
353 | - public function maybe_make_link( $url ) { |
|
354 | - if ( $this->return_false_on_fail ) { |
|
353 | + public function maybe_make_link($url) { |
|
354 | + if ($this->return_false_on_fail) { |
|
355 | 355 | return false; |
356 | 356 | } |
357 | 357 | |
358 | - $output = ( $this->linkifunknown ) ? '<a href="' . esc_url($url) . '">' . esc_html($url) . '</a>' : $url; |
|
358 | + $output = ($this->linkifunknown) ? '<a href="'.esc_url($url).'">'.esc_html($url).'</a>' : $url; |
|
359 | 359 | |
360 | 360 | /** |
361 | 361 | * Filter the returned, maybe-linked embed URL. |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | * @param string $output The linked or original URL. |
366 | 366 | * @param string $url The original URL. |
367 | 367 | */ |
368 | - return apply_filters( 'embed_maybe_make_link', $output, $url ); |
|
368 | + return apply_filters('embed_maybe_make_link', $output, $url); |
|
369 | 369 | } |
370 | 370 | } |
371 | 371 | $GLOBALS['wp_embed'] = new WP_Embed(); |
@@ -75,8 +75,9 @@ discard block |
||
75 | 75 | public function maybe_run_ajax_cache() { |
76 | 76 | $post = get_post(); |
77 | 77 | |
78 | - if ( ! $post || empty( $_GET['message'] ) ) |
|
79 | - return; |
|
78 | + if ( ! $post || empty( $_GET['message'] ) ) { |
|
79 | + return; |
|
80 | + } |
|
80 | 81 | |
81 | 82 | ?> |
82 | 83 | <script type="text/javascript"> |
@@ -157,8 +158,8 @@ discard block |
||
157 | 158 | foreach ( $this->handlers as $priority => $handlers ) { |
158 | 159 | foreach ( $handlers as $id => $handler ) { |
159 | 160 | if ( preg_match( $handler['regex'], $url, $matches ) && is_callable( $handler['callback'] ) ) { |
160 | - if ( false !== $return = call_user_func( $handler['callback'], $matches, $attr, $url, $rawattr ) ) |
|
161 | - /** |
|
161 | + if ( false !== $return = call_user_func( $handler['callback'], $matches, $attr, $url, $rawattr ) ) { |
|
162 | + /** |
|
162 | 163 | * Filter the returned embed handler. |
163 | 164 | * |
164 | 165 | * @since 2.9.0 |
@@ -170,13 +171,16 @@ discard block |
||
170 | 171 | * @param array $attr An array of shortcode attributes. |
171 | 172 | */ |
172 | 173 | return apply_filters( 'embed_handler_html', $return, $url, $attr ); |
174 | + } |
|
173 | 175 | } |
174 | 176 | } |
175 | 177 | } |
176 | 178 | |
177 | 179 | $post_ID = ( ! empty( $post->ID ) ) ? $post->ID : null; |
178 | - if ( ! empty( $this->post_ID ) ) // Potentially set by WP_Embed::cache_oembed() |
|
180 | + if ( ! empty( $this->post_ID ) ) { |
|
181 | + // Potentially set by WP_Embed::cache_oembed() |
|
179 | 182 | $post_ID = $this->post_ID; |
183 | + } |
|
180 | 184 | |
181 | 185 | // Unknown URL format. Let oEmbed have a go. |
182 | 186 | if ( $post_ID ) { |
@@ -209,8 +213,9 @@ discard block |
||
209 | 213 | |
210 | 214 | if ( $this->usecache || $cached_recently ) { |
211 | 215 | // Failures are cached. Serve one if we're using the cache. |
212 | - if ( '{{unknown}}' === $cache ) |
|
213 | - return $this->maybe_make_link( $url ); |
|
216 | + if ( '{{unknown}}' === $cache ) { |
|
217 | + return $this->maybe_make_link( $url ); |
|
218 | + } |
|
214 | 219 | |
215 | 220 | if ( ! empty( $cache ) ) { |
216 | 221 | /** |
@@ -269,12 +274,14 @@ discard block |
||
269 | 274 | */ |
270 | 275 | public function delete_oembed_caches( $post_ID ) { |
271 | 276 | $post_metas = get_post_custom_keys( $post_ID ); |
272 | - if ( empty($post_metas) ) |
|
273 | - return; |
|
277 | + if ( empty($post_metas) ) { |
|
278 | + return; |
|
279 | + } |
|
274 | 280 | |
275 | 281 | foreach( $post_metas as $post_meta_key ) { |
276 | - if ( '_oembed_' == substr( $post_meta_key, 0, 8 ) ) |
|
277 | - delete_post_meta( $post_ID, $post_meta_key ); |
|
282 | + if ( '_oembed_' == substr( $post_meta_key, 0, 8 ) ) { |
|
283 | + delete_post_meta( $post_ID, $post_meta_key ); |
|
284 | + } |
|
278 | 285 | } |
279 | 286 | } |
280 | 287 |