@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | /** |
33 | 33 | * Sets the endianness of the file. |
34 | 34 | * |
35 | - * @param $endian string 'big' or 'little' |
|
35 | + * @param string $endian string 'big' or 'little' |
|
36 | 36 | */ |
37 | 37 | function setEndian($endian) { |
38 | 38 | $this->endian = $endian; |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | /** |
42 | 42 | * Reads a 32bit Integer from the Stream |
43 | 43 | * |
44 | - * @return mixed The integer, corresponding to the next 32 bits from |
|
44 | + * @return integer The integer, corresponding to the next 32 bits from |
|
45 | 45 | * the stream of false if there are not enough bytes or on error |
46 | 46 | */ |
47 | 47 | function readint32() { |
@@ -119,14 +119,14 @@ discard block |
||
119 | 119 | } |
120 | 120 | |
121 | 121 | /** |
122 | - * @return true |
|
122 | + * @return boolean |
|
123 | 123 | */ |
124 | 124 | function is_resource() { |
125 | 125 | return true; |
126 | 126 | } |
127 | 127 | |
128 | 128 | /** |
129 | - * @return true |
|
129 | + * @return boolean |
|
130 | 130 | */ |
131 | 131 | function close() { |
132 | 132 | return true; |
@@ -46,8 +46,9 @@ discard block |
||
46 | 46 | */ |
47 | 47 | function readint32() { |
48 | 48 | $bytes = $this->read(4); |
49 | - if (4 != $this->strlen($bytes)) |
|
50 | - return false; |
|
49 | + if (4 != $this->strlen($bytes)) { |
|
50 | + return false; |
|
51 | + } |
|
51 | 52 | $endian_letter = ('big' == $this->endian)? 'N' : 'V'; |
52 | 53 | $int = unpack($endian_letter, $bytes); |
53 | 54 | return reset( $int ); |
@@ -62,8 +63,9 @@ discard block |
||
62 | 63 | */ |
63 | 64 | function readint32array($count) { |
64 | 65 | $bytes = $this->read(4 * $count); |
65 | - if (4*$count != $this->strlen($bytes)) |
|
66 | - return false; |
|
66 | + if (4*$count != $this->strlen($bytes)) { |
|
67 | + return false; |
|
68 | + } |
|
67 | 69 | $endian_letter = ('big' == $this->endian)? 'N' : 'V'; |
68 | 70 | return unpack($endian_letter.$count, $bytes); |
69 | 71 | } |
@@ -103,8 +105,9 @@ discard block |
||
103 | 105 | if (!function_exists('str_split')) { |
104 | 106 | $length = $this->strlen($string); |
105 | 107 | $out = array(); |
106 | - for ($i = 0; $i < $length; $i += $chunk_size) |
|
107 | - $out[] = $this->substr($string, $i, $chunk_size); |
|
108 | + for ($i = 0; $i < $length; $i += $chunk_size) { |
|
109 | + $out[] = $this->substr($string, $i, $chunk_size); |
|
110 | + } |
|
108 | 111 | return $out; |
109 | 112 | } else { |
110 | 113 | return str_split( $string, $chunk_size ); |
@@ -197,8 +200,9 @@ discard block |
||
197 | 200 | */ |
198 | 201 | function read_all() { |
199 | 202 | $all = ''; |
200 | - while ( !$this->feof() ) |
|
201 | - $all .= $this->read(4096); |
|
203 | + while ( !$this->feof() ) { |
|
204 | + $all .= $this->read(4096); |
|
205 | + } |
|
202 | 206 | return $all; |
203 | 207 | } |
204 | 208 | } |
@@ -236,7 +240,9 @@ discard block |
||
236 | 240 | function read($bytes) { |
237 | 241 | $data = $this->substr($this->_str, $this->_pos, $bytes); |
238 | 242 | $this->_pos += $bytes; |
239 | - if ($this->strlen($this->_str) < $this->_pos) $this->_pos = $this->strlen($this->_str); |
|
243 | + if ($this->strlen($this->_str) < $this->_pos) { |
|
244 | + $this->_pos = $this->strlen($this->_str); |
|
245 | + } |
|
240 | 246 | return $data; |
241 | 247 | } |
242 | 248 | |
@@ -246,7 +252,9 @@ discard block |
||
246 | 252 | */ |
247 | 253 | function seekto($pos) { |
248 | 254 | $this->_pos = $pos; |
249 | - if ($this->strlen($this->_str) < $this->_pos) $this->_pos = $this->strlen($this->_str); |
|
255 | + if ($this->strlen($this->_str) < $this->_pos) { |
|
256 | + $this->_pos = $this->strlen($this->_str); |
|
257 | + } |
|
250 | 258 | return $this->_pos; |
251 | 259 | } |
252 | 260 | |
@@ -278,8 +286,9 @@ discard block |
||
278 | 286 | function __construct( $filename ) { |
279 | 287 | parent::POMO_StringReader(); |
280 | 288 | $this->_str = file_get_contents($filename); |
281 | - if (false === $this->_str) |
|
282 | - return false; |
|
289 | + if (false === $this->_str) { |
|
290 | + return false; |
|
291 | + } |
|
283 | 292 | $this->_pos = 0; |
284 | 293 | } |
285 | 294 |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * @subpackage streams |
9 | 9 | */ |
10 | 10 | |
11 | -if ( ! class_exists( 'POMO_Reader', false ) ): |
|
11 | +if ( ! class_exists('POMO_Reader', false)): |
|
12 | 12 | class POMO_Reader { |
13 | 13 | |
14 | 14 | var $endian = 'little'; |
@@ -48,9 +48,9 @@ discard block |
||
48 | 48 | $bytes = $this->read(4); |
49 | 49 | if (4 != $this->strlen($bytes)) |
50 | 50 | return false; |
51 | - $endian_letter = ('big' == $this->endian)? 'N' : 'V'; |
|
51 | + $endian_letter = ('big' == $this->endian) ? 'N' : 'V'; |
|
52 | 52 | $int = unpack($endian_letter, $bytes); |
53 | - return reset( $int ); |
|
53 | + return reset($int); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
@@ -62,9 +62,9 @@ discard block |
||
62 | 62 | */ |
63 | 63 | function readint32array($count) { |
64 | 64 | $bytes = $this->read(4 * $count); |
65 | - if (4*$count != $this->strlen($bytes)) |
|
65 | + if (4 * $count != $this->strlen($bytes)) |
|
66 | 66 | return false; |
67 | - $endian_letter = ('big' == $this->endian)? 'N' : 'V'; |
|
67 | + $endian_letter = ('big' == $this->endian) ? 'N' : 'V'; |
|
68 | 68 | return unpack($endian_letter.$count, $bytes); |
69 | 69 | } |
70 | 70 | |
@@ -100,14 +100,14 @@ discard block |
||
100 | 100 | * @return array |
101 | 101 | */ |
102 | 102 | function str_split($string, $chunk_size) { |
103 | - if (!function_exists('str_split')) { |
|
103 | + if ( ! function_exists('str_split')) { |
|
104 | 104 | $length = $this->strlen($string); |
105 | 105 | $out = array(); |
106 | 106 | for ($i = 0; $i < $length; $i += $chunk_size) |
107 | 107 | $out[] = $this->substr($string, $i, $chunk_size); |
108 | 108 | return $out; |
109 | 109 | } else { |
110 | - return str_split( $string, $chunk_size ); |
|
110 | + return str_split($string, $chunk_size); |
|
111 | 111 | } |
112 | 112 | } |
113 | 113 | |
@@ -134,13 +134,13 @@ discard block |
||
134 | 134 | } |
135 | 135 | endif; |
136 | 136 | |
137 | -if ( ! class_exists( 'POMO_FileReader', false ) ): |
|
137 | +if ( ! class_exists('POMO_FileReader', false)): |
|
138 | 138 | class POMO_FileReader extends POMO_Reader { |
139 | 139 | |
140 | 140 | /** |
141 | 141 | * @param string $filename |
142 | 142 | */ |
143 | - function __construct( $filename ) { |
|
143 | + function __construct($filename) { |
|
144 | 144 | parent::POMO_Reader(); |
145 | 145 | $this->_f = fopen($filename, 'rb'); |
146 | 146 | } |
@@ -148,8 +148,8 @@ discard block |
||
148 | 148 | /** |
149 | 149 | * PHP4 constructor. |
150 | 150 | */ |
151 | - public function POMO_FileReader( $filename ) { |
|
152 | - self::__construct( $filename ); |
|
151 | + public function POMO_FileReader($filename) { |
|
152 | + self::__construct($filename); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | /** |
@@ -197,14 +197,14 @@ discard block |
||
197 | 197 | */ |
198 | 198 | function read_all() { |
199 | 199 | $all = ''; |
200 | - while ( !$this->feof() ) |
|
200 | + while ( ! $this->feof()) |
|
201 | 201 | $all .= $this->read(4096); |
202 | 202 | return $all; |
203 | 203 | } |
204 | 204 | } |
205 | 205 | endif; |
206 | 206 | |
207 | -if ( ! class_exists( 'POMO_StringReader', false ) ): |
|
207 | +if ( ! class_exists('POMO_StringReader', false)): |
|
208 | 208 | /** |
209 | 209 | * Provides file-like methods for manipulating a string instead |
210 | 210 | * of a physical file. |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | /** |
217 | 217 | * PHP5 constructor. |
218 | 218 | */ |
219 | - function __construct( $str = '' ) { |
|
219 | + function __construct($str = '') { |
|
220 | 220 | parent::POMO_Reader(); |
221 | 221 | $this->_str = $str; |
222 | 222 | $this->_pos = 0; |
@@ -225,8 +225,8 @@ discard block |
||
225 | 225 | /** |
226 | 226 | * PHP4 constructor. |
227 | 227 | */ |
228 | - public function POMO_StringReader( $str = '' ) { |
|
229 | - self::__construct( $str ); |
|
228 | + public function POMO_StringReader($str = '') { |
|
229 | + self::__construct($str); |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | /** |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | } |
268 | 268 | endif; |
269 | 269 | |
270 | -if ( ! class_exists( 'POMO_CachedFileReader', false ) ): |
|
270 | +if ( ! class_exists('POMO_CachedFileReader', false)): |
|
271 | 271 | /** |
272 | 272 | * Reads the contents of the file in the beginning. |
273 | 273 | */ |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | /** |
276 | 276 | * PHP5 constructor. |
277 | 277 | */ |
278 | - function __construct( $filename ) { |
|
278 | + function __construct($filename) { |
|
279 | 279 | parent::POMO_StringReader(); |
280 | 280 | $this->_str = file_get_contents($filename); |
281 | 281 | if (false === $this->_str) |
@@ -286,13 +286,13 @@ discard block |
||
286 | 286 | /** |
287 | 287 | * PHP4 constructor. |
288 | 288 | */ |
289 | - public function POMO_CachedFileReader( $filename ) { |
|
290 | - self::__construct( $filename ); |
|
289 | + public function POMO_CachedFileReader($filename) { |
|
290 | + self::__construct($filename); |
|
291 | 291 | } |
292 | 292 | } |
293 | 293 | endif; |
294 | 294 | |
295 | -if ( ! class_exists( 'POMO_CachedIntFileReader', false ) ): |
|
295 | +if ( ! class_exists('POMO_CachedIntFileReader', false)): |
|
296 | 296 | /** |
297 | 297 | * Reads the contents of the file in the beginning. |
298 | 298 | */ |
@@ -300,15 +300,15 @@ discard block |
||
300 | 300 | /** |
301 | 301 | * PHP5 constructor. |
302 | 302 | */ |
303 | - public function __construct( $filename ) { |
|
303 | + public function __construct($filename) { |
|
304 | 304 | parent::POMO_CachedFileReader($filename); |
305 | 305 | } |
306 | 306 | |
307 | 307 | /** |
308 | 308 | * PHP4 constructor. |
309 | 309 | */ |
310 | - function POMO_CachedIntFileReader( $filename ) { |
|
311 | - self::__construct( $filename ); |
|
310 | + function POMO_CachedIntFileReader($filename) { |
|
311 | + self::__construct($filename); |
|
312 | 312 | } |
313 | 313 | } |
314 | 314 | endif; |
@@ -18,6 +18,7 @@ discard block |
||
18 | 18 | * Add entry to the PO structure |
19 | 19 | * |
20 | 20 | * @param array|Translation_Entry &$entry |
21 | + * @param Translation_Entry $entry |
|
21 | 22 | * @return bool true on success, false if the entry doesn't have a key |
22 | 23 | */ |
23 | 24 | function add_entry($entry) { |
@@ -72,6 +73,7 @@ discard block |
||
72 | 73 | |
73 | 74 | /** |
74 | 75 | * @param string $header |
76 | + * @return string |
|
75 | 77 | */ |
76 | 78 | function get_header($header) { |
77 | 79 | return isset($this->headers[$header])? $this->headers[$header] : false; |
@@ -150,7 +152,7 @@ discard block |
||
150 | 152 | } |
151 | 153 | |
152 | 154 | /** |
153 | - * @param object $other |
|
155 | + * @param Translations $other |
|
154 | 156 | */ |
155 | 157 | function merge_originals_with(&$other) { |
156 | 158 | foreach( $other->entries as $entry ) { |
@@ -326,7 +328,7 @@ discard block |
||
326 | 328 | /** |
327 | 329 | * |
328 | 330 | * @param int $count |
329 | - * @return bool |
|
331 | + * @return integer |
|
330 | 332 | */ |
331 | 333 | function select_plural_form($count) { |
332 | 334 | return 1 == $count? 0 : 1; |
@@ -25,7 +25,9 @@ discard block |
||
25 | 25 | $entry = new Translation_Entry($entry); |
26 | 26 | } |
27 | 27 | $key = $entry->key(); |
28 | - if (false === $key) return false; |
|
28 | + if (false === $key) { |
|
29 | + return false; |
|
30 | + } |
|
29 | 31 | $this->entries[$key] = &$entry; |
30 | 32 | return true; |
31 | 33 | } |
@@ -39,11 +41,14 @@ discard block |
||
39 | 41 | $entry = new Translation_Entry($entry); |
40 | 42 | } |
41 | 43 | $key = $entry->key(); |
42 | - if (false === $key) return false; |
|
43 | - if (isset($this->entries[$key])) |
|
44 | - $this->entries[$key]->merge_with($entry); |
|
45 | - else |
|
46 | - $this->entries[$key] = &$entry; |
|
44 | + if (false === $key) { |
|
45 | + return false; |
|
46 | + } |
|
47 | + if (isset($this->entries[$key])) { |
|
48 | + $this->entries[$key]->merge_with($entry); |
|
49 | + } else { |
|
50 | + $this->entries[$key] = &$entry; |
|
51 | + } |
|
47 | 52 | return true; |
48 | 53 | } |
49 | 54 | |
@@ -131,10 +136,11 @@ discard block |
||
131 | 136 | $total_plural_forms = $this->get_plural_forms_count(); |
132 | 137 | if ($translated && 0 <= $index && $index < $total_plural_forms && |
133 | 138 | is_array($translated->translations) && |
134 | - isset($translated->translations[$index])) |
|
135 | - return $translated->translations[$index]; |
|
136 | - else |
|
137 | - return 1 == $count? $singular : $plural; |
|
139 | + isset($translated->translations[$index])) { |
|
140 | + return $translated->translations[$index]; |
|
141 | + } else { |
|
142 | + return 1 == $count? $singular : $plural; |
|
143 | + } |
|
138 | 144 | } |
139 | 145 | |
140 | 146 | /** |
@@ -154,10 +160,11 @@ discard block |
||
154 | 160 | */ |
155 | 161 | function merge_originals_with(&$other) { |
156 | 162 | foreach( $other->entries as $entry ) { |
157 | - if ( !isset( $this->entries[$entry->key()] ) ) |
|
158 | - $this->entries[$entry->key()] = $entry; |
|
159 | - else |
|
160 | - $this->entries[$entry->key()]->merge_with($entry); |
|
163 | + if ( !isset( $this->entries[$entry->key()] ) ) { |
|
164 | + $this->entries[$entry->key()] = $entry; |
|
165 | + } else { |
|
166 | + $this->entries[$entry->key()]->merge_with($entry); |
|
167 | + } |
|
161 | 168 | } |
162 | 169 | } |
163 | 170 | } |
@@ -251,7 +258,9 @@ discard block |
||
251 | 258 | $lines = explode("\n", $translation); |
252 | 259 | foreach($lines as $line) { |
253 | 260 | $parts = explode(':', $line, 2); |
254 | - if (!isset($parts[1])) continue; |
|
261 | + if (!isset($parts[1])) { |
|
262 | + continue; |
|
263 | + } |
|
255 | 264 | $headers[trim($parts[0])] = trim($parts[1]); |
256 | 265 | } |
257 | 266 | return $headers; |
@@ -7,9 +7,9 @@ discard block |
||
7 | 7 | * @subpackage translations |
8 | 8 | */ |
9 | 9 | |
10 | -require_once dirname(__FILE__) . '/entry.php'; |
|
10 | +require_once dirname(__FILE__).'/entry.php'; |
|
11 | 11 | |
12 | -if ( ! class_exists( 'Translations', false ) ): |
|
12 | +if ( ! class_exists('Translations', false)): |
|
13 | 13 | class Translations { |
14 | 14 | var $entries = array(); |
15 | 15 | var $headers = array(); |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | * @param array $headers |
66 | 66 | */ |
67 | 67 | function set_headers($headers) { |
68 | - foreach($headers as $header => $value) { |
|
68 | + foreach ($headers as $header => $value) { |
|
69 | 69 | $this->set_header($header, $value); |
70 | 70 | } |
71 | 71 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * @param string $header |
75 | 75 | */ |
76 | 76 | function get_header($header) { |
77 | - return isset($this->headers[$header])? $this->headers[$header] : false; |
|
77 | + return isset($this->headers[$header]) ? $this->headers[$header] : false; |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | /** |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | */ |
83 | 83 | function translate_entry(&$entry) { |
84 | 84 | $key = $entry->key(); |
85 | - return isset($this->entries[$key])? $this->entries[$key] : false; |
|
85 | + return isset($this->entries[$key]) ? $this->entries[$key] : false; |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | /** |
@@ -90,10 +90,10 @@ discard block |
||
90 | 90 | * @param string $context |
91 | 91 | * @return string |
92 | 92 | */ |
93 | - function translate($singular, $context=null) { |
|
93 | + function translate($singular, $context = null) { |
|
94 | 94 | $entry = new Translation_Entry(array('singular' => $singular, 'context' => $context)); |
95 | 95 | $translated = $this->translate_entry($entry); |
96 | - return ($translated && !empty($translated->translations))? $translated->translations[0] : $singular; |
|
96 | + return ($translated && ! empty($translated->translations)) ? $translated->translations[0] : $singular; |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | /** |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | * @param integer $count number of items |
109 | 109 | */ |
110 | 110 | function select_plural_form($count) { |
111 | - return 1 == $count? 0 : 1; |
|
111 | + return 1 == $count ? 0 : 1; |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | /** |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | isset($translated->translations[$index])) |
135 | 135 | return $translated->translations[$index]; |
136 | 136 | else |
137 | - return 1 == $count? $singular : $plural; |
|
137 | + return 1 == $count ? $singular : $plural; |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | /** |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | * @return void |
145 | 145 | **/ |
146 | 146 | function merge_with(&$other) { |
147 | - foreach( $other->entries as $entry ) { |
|
147 | + foreach ($other->entries as $entry) { |
|
148 | 148 | $this->entries[$entry->key()] = $entry; |
149 | 149 | } |
150 | 150 | } |
@@ -153,8 +153,8 @@ discard block |
||
153 | 153 | * @param object $other |
154 | 154 | */ |
155 | 155 | function merge_originals_with(&$other) { |
156 | - foreach( $other->entries as $entry ) { |
|
157 | - if ( !isset( $this->entries[$entry->key()] ) ) |
|
156 | + foreach ($other->entries as $entry) { |
|
157 | + if ( ! isset($this->entries[$entry->key()])) |
|
158 | 158 | $this->entries[$entry->key()] = $entry; |
159 | 159 | else |
160 | 160 | $this->entries[$entry->key()]->merge_with($entry); |
@@ -172,8 +172,8 @@ discard block |
||
172 | 172 | * @param int $count |
173 | 173 | */ |
174 | 174 | function gettext_select_plural_form($count) { |
175 | - if (!isset($this->_gettext_select_plural_form) || is_null($this->_gettext_select_plural_form)) { |
|
176 | - list( $nplurals, $expression ) = $this->nplurals_and_expression_from_header($this->get_header('Plural-Forms')); |
|
175 | + if ( ! isset($this->_gettext_select_plural_form) || is_null($this->_gettext_select_plural_form)) { |
|
176 | + list($nplurals, $expression) = $this->nplurals_and_expression_from_header($this->get_header('Plural-Forms')); |
|
177 | 177 | $this->_nplurals = $nplurals; |
178 | 178 | $this->_gettext_select_plural_form = $this->make_plural_form_function($nplurals, $expression); |
179 | 179 | } |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | */ |
187 | 187 | function nplurals_and_expression_from_header($header) { |
188 | 188 | if (preg_match('/^\s*nplurals\s*=\s*(\d+)\s*;\s+plural\s*=\s*(.+)$/', $header, $matches)) { |
189 | - $nplurals = (int)$matches[1]; |
|
189 | + $nplurals = (int) $matches[1]; |
|
190 | 190 | $expression = trim($this->parenthesize_plural_exression($matches[2])); |
191 | 191 | return array($nplurals, $expression); |
192 | 192 | } else { |
@@ -230,8 +230,8 @@ discard block |
||
230 | 230 | $res .= ') : ('; |
231 | 231 | break; |
232 | 232 | case ';': |
233 | - $res .= str_repeat(')', $depth) . ';'; |
|
234 | - $depth= 0; |
|
233 | + $res .= str_repeat(')', $depth).';'; |
|
234 | + $depth = 0; |
|
235 | 235 | break; |
236 | 236 | default: |
237 | 237 | $res .= $char; |
@@ -249,9 +249,9 @@ discard block |
||
249 | 249 | // sometimes \ns are used instead of real new lines |
250 | 250 | $translation = str_replace('\n', "\n", $translation); |
251 | 251 | $lines = explode("\n", $translation); |
252 | - foreach($lines as $line) { |
|
252 | + foreach ($lines as $line) { |
|
253 | 253 | $parts = explode(':', $line, 2); |
254 | - if (!isset($parts[1])) continue; |
|
254 | + if ( ! isset($parts[1])) continue; |
|
255 | 255 | $headers[trim($parts[0])] = trim($parts[1]); |
256 | 256 | } |
257 | 257 | return $headers; |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | function set_header($header, $value) { |
265 | 265 | parent::set_header($header, $value); |
266 | 266 | if ('Plural-Forms' == $header) { |
267 | - list( $nplurals, $expression ) = $this->nplurals_and_expression_from_header($this->get_header('Plural-Forms')); |
|
267 | + list($nplurals, $expression) = $this->nplurals_and_expression_from_header($this->get_header('Plural-Forms')); |
|
268 | 268 | $this->_nplurals = $nplurals; |
269 | 269 | $this->_gettext_select_plural_form = $this->make_plural_form_function($nplurals, $expression); |
270 | 270 | } |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | } |
273 | 273 | endif; |
274 | 274 | |
275 | -if ( ! class_exists( 'NOOP_Translations', false ) ): |
|
275 | +if ( ! class_exists('NOOP_Translations', false)): |
|
276 | 276 | /** |
277 | 277 | * Provides the same interface as Translations, but doesn't do anything |
278 | 278 | */ |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | * @param string $singular |
320 | 320 | * @param string $context |
321 | 321 | */ |
322 | - function translate($singular, $context=null) { |
|
322 | + function translate($singular, $context = null) { |
|
323 | 323 | return $singular; |
324 | 324 | } |
325 | 325 | |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | * @return bool |
330 | 330 | */ |
331 | 331 | function select_plural_form($count) { |
332 | - return 1 == $count? 0 : 1; |
|
332 | + return 1 == $count ? 0 : 1; |
|
333 | 333 | } |
334 | 334 | |
335 | 335 | /** |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | * @param string $context |
347 | 347 | */ |
348 | 348 | function translate_plural($singular, $plural, $count, $context = null) { |
349 | - return 1 == $count? $singular : $plural; |
|
349 | + return 1 == $count ? $singular : $plural; |
|
350 | 350 | } |
351 | 351 | |
352 | 352 | /** |
@@ -135,7 +135,7 @@ |
||
135 | 135 | * @since 3.1.0 |
136 | 136 | * |
137 | 137 | * @param string $format The post format slug. |
138 | - * @return string|WP_Error|false The post format term link. |
|
138 | + * @return string The post format term link. |
|
139 | 139 | */ |
140 | 140 | function get_post_format_link( $format ) { |
141 | 141 | $term = get_term_by('slug', 'post-format-' . $format, 'post_format' ); |
@@ -15,16 +15,19 @@ discard block |
||
15 | 15 | * @return string|false The format if successful. False otherwise. |
16 | 16 | */ |
17 | 17 | function get_post_format( $post = null ) { |
18 | - if ( ! $post = get_post( $post ) ) |
|
19 | - return false; |
|
18 | + if ( ! $post = get_post( $post ) ) { |
|
19 | + return false; |
|
20 | + } |
|
20 | 21 | |
21 | - if ( ! post_type_supports( $post->post_type, 'post-formats' ) ) |
|
22 | - return false; |
|
22 | + if ( ! post_type_supports( $post->post_type, 'post-formats' ) ) { |
|
23 | + return false; |
|
24 | + } |
|
23 | 25 | |
24 | 26 | $_format = get_the_terms( $post->ID, 'post_format' ); |
25 | 27 | |
26 | - if ( empty( $_format ) ) |
|
27 | - return false; |
|
28 | + if ( empty( $_format ) ) { |
|
29 | + return false; |
|
30 | + } |
|
28 | 31 | |
29 | 32 | $format = reset( $_format ); |
30 | 33 | |
@@ -64,15 +67,17 @@ discard block |
||
64 | 67 | function set_post_format( $post, $format ) { |
65 | 68 | $post = get_post( $post ); |
66 | 69 | |
67 | - if ( empty( $post ) ) |
|
68 | - return new WP_Error( 'invalid_post', __( 'Invalid post.' ) ); |
|
70 | + if ( empty( $post ) ) { |
|
71 | + return new WP_Error( 'invalid_post', __( 'Invalid post.' ) ); |
|
72 | + } |
|
69 | 73 | |
70 | 74 | if ( ! empty( $format ) ) { |
71 | 75 | $format = sanitize_key( $format ); |
72 | - if ( 'standard' === $format || ! in_array( $format, get_post_format_slugs() ) ) |
|
73 | - $format = ''; |
|
74 | - else |
|
75 | - $format = 'post-format-' . $format; |
|
76 | + if ( 'standard' === $format || ! in_array( $format, get_post_format_slugs() ) ) { |
|
77 | + $format = ''; |
|
78 | + } else { |
|
79 | + $format = 'post-format-' . $format; |
|
80 | + } |
|
76 | 81 | } |
77 | 82 | |
78 | 83 | return wp_set_post_terms( $post->ID, $format, 'post_format' ); |
@@ -123,11 +128,12 @@ discard block |
||
123 | 128 | */ |
124 | 129 | function get_post_format_string( $slug ) { |
125 | 130 | $strings = get_post_format_strings(); |
126 | - if ( !$slug ) |
|
127 | - return $strings['standard']; |
|
128 | - else |
|
129 | - return ( isset( $strings[$slug] ) ) ? $strings[$slug] : ''; |
|
130 | -} |
|
131 | + if ( !$slug ) { |
|
132 | + return $strings['standard']; |
|
133 | + } else { |
|
134 | + return ( isset( $strings[$slug] ) ) ? $strings[$slug] : ''; |
|
135 | + } |
|
136 | + } |
|
131 | 137 | |
132 | 138 | /** |
133 | 139 | * Returns a link to a post format index. |
@@ -139,8 +145,9 @@ discard block |
||
139 | 145 | */ |
140 | 146 | function get_post_format_link( $format ) { |
141 | 147 | $term = get_term_by('slug', 'post-format-' . $format, 'post_format' ); |
142 | - if ( ! $term || is_wp_error( $term ) ) |
|
143 | - return false; |
|
148 | + if ( ! $term || is_wp_error( $term ) ) { |
|
149 | + return false; |
|
150 | + } |
|
144 | 151 | return get_term_link( $term ); |
145 | 152 | } |
146 | 153 | |
@@ -154,14 +161,17 @@ discard block |
||
154 | 161 | * @return array |
155 | 162 | */ |
156 | 163 | function _post_format_request( $qvs ) { |
157 | - if ( ! isset( $qvs['post_format'] ) ) |
|
158 | - return $qvs; |
|
164 | + if ( ! isset( $qvs['post_format'] ) ) { |
|
165 | + return $qvs; |
|
166 | + } |
|
159 | 167 | $slugs = get_post_format_slugs(); |
160 | - if ( isset( $slugs[ $qvs['post_format'] ] ) ) |
|
161 | - $qvs['post_format'] = 'post-format-' . $slugs[ $qvs['post_format'] ]; |
|
168 | + if ( isset( $slugs[ $qvs['post_format'] ] ) ) { |
|
169 | + $qvs['post_format'] = 'post-format-' . $slugs[ $qvs['post_format'] ]; |
|
170 | + } |
|
162 | 171 | $tax = get_taxonomy( 'post_format' ); |
163 | - if ( ! is_admin() ) |
|
164 | - $qvs['post_type'] = $tax->object_type; |
|
172 | + if ( ! is_admin() ) { |
|
173 | + $qvs['post_type'] = $tax->object_type; |
|
174 | + } |
|
165 | 175 | return $qvs; |
166 | 176 | } |
167 | 177 |
@@ -14,21 +14,21 @@ discard block |
||
14 | 14 | * @param int|object|null $post Post ID or post object. Optional, default is the current post from the loop. |
15 | 15 | * @return string|false The format if successful. False otherwise. |
16 | 16 | */ |
17 | -function get_post_format( $post = null ) { |
|
18 | - if ( ! $post = get_post( $post ) ) |
|
17 | +function get_post_format($post = null) { |
|
18 | + if ( ! $post = get_post($post)) |
|
19 | 19 | return false; |
20 | 20 | |
21 | - if ( ! post_type_supports( $post->post_type, 'post-formats' ) ) |
|
21 | + if ( ! post_type_supports($post->post_type, 'post-formats')) |
|
22 | 22 | return false; |
23 | 23 | |
24 | - $_format = get_the_terms( $post->ID, 'post_format' ); |
|
24 | + $_format = get_the_terms($post->ID, 'post_format'); |
|
25 | 25 | |
26 | - if ( empty( $_format ) ) |
|
26 | + if (empty($_format)) |
|
27 | 27 | return false; |
28 | 28 | |
29 | - $format = reset( $_format ); |
|
29 | + $format = reset($_format); |
|
30 | 30 | |
31 | - return str_replace('post-format-', '', $format->slug ); |
|
31 | + return str_replace('post-format-', '', $format->slug); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | /** |
@@ -40,16 +40,16 @@ discard block |
||
40 | 40 | * @param object|int|null $post Optional. The post to check. If not supplied, defaults to the current post if used in the loop. |
41 | 41 | * @return bool True if the post has any of the given formats (or any format, if no format specified), false otherwise. |
42 | 42 | */ |
43 | -function has_post_format( $format = array(), $post = null ) { |
|
43 | +function has_post_format($format = array(), $post = null) { |
|
44 | 44 | $prefixed = array(); |
45 | 45 | |
46 | - if ( $format ) { |
|
47 | - foreach ( (array) $format as $single ) { |
|
48 | - $prefixed[] = 'post-format-' . sanitize_key( $single ); |
|
46 | + if ($format) { |
|
47 | + foreach ((array) $format as $single) { |
|
48 | + $prefixed[] = 'post-format-'.sanitize_key($single); |
|
49 | 49 | } |
50 | 50 | } |
51 | 51 | |
52 | - return has_term( $prefixed, 'post_format', $post ); |
|
52 | + return has_term($prefixed, 'post_format', $post); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
@@ -61,21 +61,21 @@ discard block |
||
61 | 61 | * @param string $format A format to assign. Use an empty string or array to remove all formats from the post. |
62 | 62 | * @return array|WP_Error|false WP_Error on error. Array of affected term IDs on success. |
63 | 63 | */ |
64 | -function set_post_format( $post, $format ) { |
|
65 | - $post = get_post( $post ); |
|
64 | +function set_post_format($post, $format) { |
|
65 | + $post = get_post($post); |
|
66 | 66 | |
67 | - if ( empty( $post ) ) |
|
68 | - return new WP_Error( 'invalid_post', __( 'Invalid post.' ) ); |
|
67 | + if (empty($post)) |
|
68 | + return new WP_Error('invalid_post', __('Invalid post.')); |
|
69 | 69 | |
70 | - if ( ! empty( $format ) ) { |
|
71 | - $format = sanitize_key( $format ); |
|
72 | - if ( 'standard' === $format || ! in_array( $format, get_post_format_slugs() ) ) |
|
70 | + if ( ! empty($format)) { |
|
71 | + $format = sanitize_key($format); |
|
72 | + if ('standard' === $format || ! in_array($format, get_post_format_slugs())) |
|
73 | 73 | $format = ''; |
74 | 74 | else |
75 | - $format = 'post-format-' . $format; |
|
75 | + $format = 'post-format-'.$format; |
|
76 | 76 | } |
77 | 77 | |
78 | - return wp_set_post_terms( $post->ID, $format, 'post_format' ); |
|
78 | + return wp_set_post_terms($post->ID, $format, 'post_format'); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
@@ -87,16 +87,16 @@ discard block |
||
87 | 87 | */ |
88 | 88 | function get_post_format_strings() { |
89 | 89 | $strings = array( |
90 | - 'standard' => _x( 'Standard', 'Post format' ), // Special case. any value that evals to false will be considered standard |
|
91 | - 'aside' => _x( 'Aside', 'Post format' ), |
|
92 | - 'chat' => _x( 'Chat', 'Post format' ), |
|
93 | - 'gallery' => _x( 'Gallery', 'Post format' ), |
|
94 | - 'link' => _x( 'Link', 'Post format' ), |
|
95 | - 'image' => _x( 'Image', 'Post format' ), |
|
96 | - 'quote' => _x( 'Quote', 'Post format' ), |
|
97 | - 'status' => _x( 'Status', 'Post format' ), |
|
98 | - 'video' => _x( 'Video', 'Post format' ), |
|
99 | - 'audio' => _x( 'Audio', 'Post format' ), |
|
90 | + 'standard' => _x('Standard', 'Post format'), // Special case. any value that evals to false will be considered standard |
|
91 | + 'aside' => _x('Aside', 'Post format'), |
|
92 | + 'chat' => _x('Chat', 'Post format'), |
|
93 | + 'gallery' => _x('Gallery', 'Post format'), |
|
94 | + 'link' => _x('Link', 'Post format'), |
|
95 | + 'image' => _x('Image', 'Post format'), |
|
96 | + 'quote' => _x('Quote', 'Post format'), |
|
97 | + 'status' => _x('Status', 'Post format'), |
|
98 | + 'video' => _x('Video', 'Post format'), |
|
99 | + 'audio' => _x('Audio', 'Post format'), |
|
100 | 100 | ); |
101 | 101 | return $strings; |
102 | 102 | } |
@@ -109,8 +109,8 @@ discard block |
||
109 | 109 | * @return array The array of post format slugs. |
110 | 110 | */ |
111 | 111 | function get_post_format_slugs() { |
112 | - $slugs = array_keys( get_post_format_strings() ); |
|
113 | - return array_combine( $slugs, $slugs ); |
|
112 | + $slugs = array_keys(get_post_format_strings()); |
|
113 | + return array_combine($slugs, $slugs); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | /** |
@@ -121,12 +121,12 @@ discard block |
||
121 | 121 | * @param string $slug A post format slug. |
122 | 122 | * @return string The translated post format name. |
123 | 123 | */ |
124 | -function get_post_format_string( $slug ) { |
|
124 | +function get_post_format_string($slug) { |
|
125 | 125 | $strings = get_post_format_strings(); |
126 | - if ( !$slug ) |
|
126 | + if ( ! $slug) |
|
127 | 127 | return $strings['standard']; |
128 | 128 | else |
129 | - return ( isset( $strings[$slug] ) ) ? $strings[$slug] : ''; |
|
129 | + return (isset($strings[$slug])) ? $strings[$slug] : ''; |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | /** |
@@ -137,11 +137,11 @@ discard block |
||
137 | 137 | * @param string $format The post format slug. |
138 | 138 | * @return string|WP_Error|false The post format term link. |
139 | 139 | */ |
140 | -function get_post_format_link( $format ) { |
|
141 | - $term = get_term_by('slug', 'post-format-' . $format, 'post_format' ); |
|
142 | - if ( ! $term || is_wp_error( $term ) ) |
|
140 | +function get_post_format_link($format) { |
|
141 | + $term = get_term_by('slug', 'post-format-'.$format, 'post_format'); |
|
142 | + if ( ! $term || is_wp_error($term)) |
|
143 | 143 | return false; |
144 | - return get_term_link( $term ); |
|
144 | + return get_term_link($term); |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | /** |
@@ -153,14 +153,14 @@ discard block |
||
153 | 153 | * @param array $qvs |
154 | 154 | * @return array |
155 | 155 | */ |
156 | -function _post_format_request( $qvs ) { |
|
157 | - if ( ! isset( $qvs['post_format'] ) ) |
|
156 | +function _post_format_request($qvs) { |
|
157 | + if ( ! isset($qvs['post_format'])) |
|
158 | 158 | return $qvs; |
159 | 159 | $slugs = get_post_format_slugs(); |
160 | - if ( isset( $slugs[ $qvs['post_format'] ] ) ) |
|
161 | - $qvs['post_format'] = 'post-format-' . $slugs[ $qvs['post_format'] ]; |
|
162 | - $tax = get_taxonomy( 'post_format' ); |
|
163 | - if ( ! is_admin() ) |
|
160 | + if (isset($slugs[$qvs['post_format']])) |
|
161 | + $qvs['post_format'] = 'post-format-'.$slugs[$qvs['post_format']]; |
|
162 | + $tax = get_taxonomy('post_format'); |
|
163 | + if ( ! is_admin()) |
|
164 | 164 | $qvs['post_type'] = $tax->object_type; |
165 | 165 | return $qvs; |
166 | 166 | } |
@@ -178,16 +178,16 @@ discard block |
||
178 | 178 | * @param string $taxonomy |
179 | 179 | * @return string |
180 | 180 | */ |
181 | -function _post_format_link( $link, $term, $taxonomy ) { |
|
181 | +function _post_format_link($link, $term, $taxonomy) { |
|
182 | 182 | global $wp_rewrite; |
183 | - if ( 'post_format' != $taxonomy ) { |
|
183 | + if ('post_format' != $taxonomy) { |
|
184 | 184 | return $link; |
185 | 185 | } |
186 | - if ( $wp_rewrite->get_extra_permastruct( $taxonomy ) ) { |
|
187 | - return str_replace( "/{$term->slug}", '/' . str_replace( 'post-format-', '', $term->slug ), $link ); |
|
186 | + if ($wp_rewrite->get_extra_permastruct($taxonomy)) { |
|
187 | + return str_replace("/{$term->slug}", '/'.str_replace('post-format-', '', $term->slug), $link); |
|
188 | 188 | } else { |
189 | - $link = remove_query_arg( 'post_format', $link ); |
|
190 | - return add_query_arg( 'post_format', str_replace( 'post-format-', '', $term->slug ), $link ); |
|
189 | + $link = remove_query_arg('post_format', $link); |
|
190 | + return add_query_arg('post_format', str_replace('post-format-', '', $term->slug), $link); |
|
191 | 191 | } |
192 | 192 | } |
193 | 193 | |
@@ -200,9 +200,9 @@ discard block |
||
200 | 200 | * @param object $term |
201 | 201 | * @return object |
202 | 202 | */ |
203 | -function _post_format_get_term( $term ) { |
|
204 | - if ( isset( $term->slug ) ) { |
|
205 | - $term->name = get_post_format_string( str_replace( 'post-format-', '', $term->slug ) ); |
|
203 | +function _post_format_get_term($term) { |
|
204 | + if (isset($term->slug)) { |
|
205 | + $term->name = get_post_format_string(str_replace('post-format-', '', $term->slug)); |
|
206 | 206 | } |
207 | 207 | return $term; |
208 | 208 | } |
@@ -218,16 +218,16 @@ discard block |
||
218 | 218 | * @param array $args |
219 | 219 | * @return array |
220 | 220 | */ |
221 | -function _post_format_get_terms( $terms, $taxonomies, $args ) { |
|
222 | - if ( in_array( 'post_format', (array) $taxonomies ) ) { |
|
223 | - if ( isset( $args['fields'] ) && 'names' == $args['fields'] ) { |
|
224 | - foreach ( $terms as $order => $name ) { |
|
225 | - $terms[$order] = get_post_format_string( str_replace( 'post-format-', '', $name ) ); |
|
221 | +function _post_format_get_terms($terms, $taxonomies, $args) { |
|
222 | + if (in_array('post_format', (array) $taxonomies)) { |
|
223 | + if (isset($args['fields']) && 'names' == $args['fields']) { |
|
224 | + foreach ($terms as $order => $name) { |
|
225 | + $terms[$order] = get_post_format_string(str_replace('post-format-', '', $name)); |
|
226 | 226 | } |
227 | 227 | } else { |
228 | - foreach ( (array) $terms as $order => $term ) { |
|
229 | - if ( isset( $term->taxonomy ) && 'post_format' == $term->taxonomy ) { |
|
230 | - $terms[$order]->name = get_post_format_string( str_replace( 'post-format-', '', $term->slug ) ); |
|
228 | + foreach ((array) $terms as $order => $term) { |
|
229 | + if (isset($term->taxonomy) && 'post_format' == $term->taxonomy) { |
|
230 | + $terms[$order]->name = get_post_format_string(str_replace('post-format-', '', $term->slug)); |
|
231 | 231 | } |
232 | 232 | } |
233 | 233 | } |
@@ -244,10 +244,10 @@ discard block |
||
244 | 244 | * @param array $terms |
245 | 245 | * @return array |
246 | 246 | */ |
247 | -function _post_format_wp_get_object_terms( $terms ) { |
|
248 | - foreach ( (array) $terms as $order => $term ) { |
|
249 | - if ( isset( $term->taxonomy ) && 'post_format' == $term->taxonomy ) { |
|
250 | - $terms[$order]->name = get_post_format_string( str_replace( 'post-format-', '', $term->slug ) ); |
|
247 | +function _post_format_wp_get_object_terms($terms) { |
|
248 | + foreach ((array) $terms as $order => $term) { |
|
249 | + if (isset($term->taxonomy) && 'post_format' == $term->taxonomy) { |
|
250 | + $terms[$order]->name = get_post_format_string(str_replace('post-format-', '', $term->slug)); |
|
251 | 251 | } |
252 | 252 | } |
253 | 253 | return $terms; |
@@ -409,7 +409,7 @@ discard block |
||
409 | 409 | * @subpackage MagpieRSS |
410 | 410 | * |
411 | 411 | * @param string $url URL to retrieve feed |
412 | - * @return bool|MagpieRSS false on failure or MagpieRSS object on success. |
|
412 | + * @return integer|null false on failure or MagpieRSS object on success. |
|
413 | 413 | */ |
414 | 414 | function fetch_rss ($url) { |
415 | 415 | // initialize constants |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | * |
548 | 548 | * @param string $url URL to retrieve |
549 | 549 | * @param array $headers Optional. Headers to send to the URL. |
550 | - * @return Snoopy style response |
|
550 | + * @return stdClass style response |
|
551 | 551 | */ |
552 | 552 | function _fetch_remote_file($url, $headers = "" ) { |
553 | 553 | $resp = wp_safe_remote_request( $url, array( 'headers' => $headers, 'timeout' => MAGPIE_FETCH_TIME_OUT ) ); |
@@ -589,7 +589,7 @@ discard block |
||
589 | 589 | * @package External |
590 | 590 | * @subpackage MagpieRSS |
591 | 591 | * |
592 | - * @param array $resp |
|
592 | + * @param stdClass $resp |
|
593 | 593 | * @return MagpieRSS|bool |
594 | 594 | */ |
595 | 595 | function _response_to_rss ($resp) { |
@@ -746,6 +746,9 @@ discard block |
||
746 | 746 | Input: url from wich the rss file was fetched |
747 | 747 | Output: true on success |
748 | 748 | \*=======================================================================*/ |
749 | + /** |
|
750 | + * @param string $url |
|
751 | + */ |
|
749 | 752 | function set ($url, $rss) { |
750 | 753 | $cache_option = 'rss_' . $this->file_name( $url ); |
751 | 754 | |
@@ -760,6 +763,9 @@ discard block |
||
760 | 763 | Input: url from wich the rss file was fetched |
761 | 764 | Output: cached object on HIT, false on MISS |
762 | 765 | \*=======================================================================*/ |
766 | + /** |
|
767 | + * @param string $url |
|
768 | + */ |
|
763 | 769 | function get ($url) { |
764 | 770 | $this->ERROR = ""; |
765 | 771 | $cache_option = 'rss_' . $this->file_name( $url ); |
@@ -781,6 +787,9 @@ discard block |
||
781 | 787 | Input: url from wich the rss file was fetched |
782 | 788 | Output: cached object on HIT, false on MISS |
783 | 789 | \*=======================================================================*/ |
790 | + /** |
|
791 | + * @param string $url |
|
792 | + */ |
|
784 | 793 | function check_cache ( $url ) { |
785 | 794 | $this->ERROR = ""; |
786 | 795 | $cache_option = 'rss_' . $this->file_name( $url ); |
@@ -936,7 +945,7 @@ discard block |
||
936 | 945 | * |
937 | 946 | * @param string $url URL of feed to display. Will not auto sense feed URL. |
938 | 947 | * @param int $num_items Optional. Number of items to display, default is all. |
939 | - * @return bool False on failure. |
|
948 | + * @return null|false False on failure. |
|
940 | 949 | */ |
941 | 950 | function get_rss ($url, $num_items = 5) { // Like get posts, but for RSS |
942 | 951 | $rss = fetch_rss($url); |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | /** |
17 | 17 | * Deprecated. Use SimplePie (class-simplepie.php) instead. |
18 | 18 | */ |
19 | -_deprecated_file( basename( __FILE__ ), '3.0.0', WPINC . '/class-simplepie.php' ); |
|
19 | +_deprecated_file(basename(__FILE__), '3.0.0', WPINC.'/class-simplepie.php'); |
|
20 | 20 | |
21 | 21 | /** |
22 | 22 | * Fires before MagpieRSS is loaded, to optionally replace it. |
@@ -24,32 +24,32 @@ discard block |
||
24 | 24 | * @since 2.3.0 |
25 | 25 | * @deprecated 3.0.0 |
26 | 26 | */ |
27 | -do_action( 'load_feed_engine' ); |
|
27 | +do_action('load_feed_engine'); |
|
28 | 28 | |
29 | 29 | /** RSS feed constant. */ |
30 | 30 | define('RSS', 'RSS'); |
31 | 31 | define('ATOM', 'Atom'); |
32 | -define('MAGPIE_USER_AGENT', 'WordPress/' . $GLOBALS['wp_version']); |
|
32 | +define('MAGPIE_USER_AGENT', 'WordPress/'.$GLOBALS['wp_version']); |
|
33 | 33 | |
34 | 34 | class MagpieRSS { |
35 | 35 | var $parser; |
36 | - var $current_item = array(); // item currently being parsed |
|
37 | - var $items = array(); // collection of parsed items |
|
38 | - var $channel = array(); // hash of channel fields |
|
39 | - var $textinput = array(); |
|
36 | + var $current_item = array(); // item currently being parsed |
|
37 | + var $items = array(); // collection of parsed items |
|
38 | + var $channel = array(); // hash of channel fields |
|
39 | + var $textinput = array(); |
|
40 | 40 | var $image = array(); |
41 | 41 | var $feed_type; |
42 | 42 | var $feed_version; |
43 | 43 | |
44 | 44 | // parser variables |
45 | - var $stack = array(); // parser stack |
|
45 | + var $stack = array(); // parser stack |
|
46 | 46 | var $inchannel = false; |
47 | - var $initem = false; |
|
47 | + var $initem = false; |
|
48 | 48 | var $incontent = false; // if in Atom <content mode="xml"> field |
49 | - var $intextinput = false; |
|
50 | - var $inimage = false; |
|
51 | - var $current_field = ''; |
|
52 | - var $current_namespace = false; |
|
49 | + var $intextinput = false; |
|
50 | + var $inimage = false; |
|
51 | + var $current_field = ''; |
|
52 | + var $current_namespace = false; |
|
53 | 53 | |
54 | 54 | //var $ERROR = ""; |
55 | 55 | |
@@ -58,12 +58,12 @@ discard block |
||
58 | 58 | /** |
59 | 59 | * PHP5 constructor. |
60 | 60 | */ |
61 | - function __construct( $source ) { |
|
61 | + function __construct($source) { |
|
62 | 62 | |
63 | 63 | # Check if PHP xml isn't compiled |
64 | 64 | # |
65 | - if ( ! function_exists('xml_parser_create') ) { |
|
66 | - return trigger_error( "PHP's XML extension is not available. Please contact your hosting provider to enable PHP's XML extension." ); |
|
65 | + if ( ! function_exists('xml_parser_create')) { |
|
66 | + return trigger_error("PHP's XML extension is not available. Please contact your hosting provider to enable PHP's XML extension."); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | $parser = xml_parser_create(); |
@@ -73,27 +73,27 @@ discard block |
||
73 | 73 | # pass in parser, and a reference to this object |
74 | 74 | # set up handlers |
75 | 75 | # |
76 | - xml_set_object( $this->parser, $this ); |
|
76 | + xml_set_object($this->parser, $this); |
|
77 | 77 | xml_set_element_handler($this->parser, |
78 | - 'feed_start_element', 'feed_end_element' ); |
|
78 | + 'feed_start_element', 'feed_end_element'); |
|
79 | 79 | |
80 | - xml_set_character_data_handler( $this->parser, 'feed_cdata' ); |
|
80 | + xml_set_character_data_handler($this->parser, 'feed_cdata'); |
|
81 | 81 | |
82 | - $status = xml_parse( $this->parser, $source ); |
|
82 | + $status = xml_parse($this->parser, $source); |
|
83 | 83 | |
84 | - if (! $status ) { |
|
85 | - $errorcode = xml_get_error_code( $this->parser ); |
|
86 | - if ( $errorcode != XML_ERROR_NONE ) { |
|
87 | - $xml_error = xml_error_string( $errorcode ); |
|
84 | + if ( ! $status) { |
|
85 | + $errorcode = xml_get_error_code($this->parser); |
|
86 | + if ($errorcode != XML_ERROR_NONE) { |
|
87 | + $xml_error = xml_error_string($errorcode); |
|
88 | 88 | $error_line = xml_get_current_line_number($this->parser); |
89 | 89 | $error_col = xml_get_current_column_number($this->parser); |
90 | 90 | $errormsg = "$xml_error at line $error_line, column $error_col"; |
91 | 91 | |
92 | - $this->error( $errormsg ); |
|
92 | + $this->error($errormsg); |
|
93 | 93 | } |
94 | 94 | } |
95 | 95 | |
96 | - xml_parser_free( $this->parser ); |
|
96 | + xml_parser_free($this->parser); |
|
97 | 97 | |
98 | 98 | $this->normalize(); |
99 | 99 | } |
@@ -101,8 +101,8 @@ discard block |
||
101 | 101 | /** |
102 | 102 | * PHP4 constructor. |
103 | 103 | */ |
104 | - public function MagpieRSS( $source ) { |
|
105 | - self::__construct( $source ); |
|
104 | + public function MagpieRSS($source) { |
|
105 | + self::__construct($source); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | function feed_start_element($p, $element, &$attrs) { |
@@ -110,27 +110,27 @@ discard block |
||
110 | 110 | $attrs = array_change_key_case($attrs, CASE_LOWER); |
111 | 111 | |
112 | 112 | // check for a namespace, and split if found |
113 | - $ns = false; |
|
114 | - if ( strpos( $element, ':' ) ) { |
|
115 | - list($ns, $el) = explode( ':', $element, 2); |
|
113 | + $ns = false; |
|
114 | + if (strpos($element, ':')) { |
|
115 | + list($ns, $el) = explode(':', $element, 2); |
|
116 | 116 | } |
117 | - if ( $ns and $ns != 'rdf' ) { |
|
117 | + if ($ns and $ns != 'rdf') { |
|
118 | 118 | $this->current_namespace = $ns; |
119 | 119 | } |
120 | 120 | |
121 | 121 | # if feed type isn't set, then this is first element of feed |
122 | 122 | # identify feed from root element |
123 | 123 | # |
124 | - if (!isset($this->feed_type) ) { |
|
125 | - if ( $el == 'rdf' ) { |
|
124 | + if ( ! isset($this->feed_type)) { |
|
125 | + if ($el == 'rdf') { |
|
126 | 126 | $this->feed_type = RSS; |
127 | 127 | $this->feed_version = '1.0'; |
128 | 128 | } |
129 | - elseif ( $el == 'rss' ) { |
|
129 | + elseif ($el == 'rss') { |
|
130 | 130 | $this->feed_type = RSS; |
131 | 131 | $this->feed_version = $attrs['version']; |
132 | 132 | } |
133 | - elseif ( $el == 'feed' ) { |
|
133 | + elseif ($el == 'feed') { |
|
134 | 134 | $this->feed_type = ATOM; |
135 | 135 | $this->feed_version = $attrs['version']; |
136 | 136 | $this->inchannel = true; |
@@ -138,14 +138,14 @@ discard block |
||
138 | 138 | return; |
139 | 139 | } |
140 | 140 | |
141 | - if ( $el == 'channel' ) |
|
141 | + if ($el == 'channel') |
|
142 | 142 | { |
143 | 143 | $this->inchannel = true; |
144 | 144 | } |
145 | - elseif ($el == 'item' or $el == 'entry' ) |
|
145 | + elseif ($el == 'item' or $el == 'entry') |
|
146 | 146 | { |
147 | 147 | $this->initem = true; |
148 | - if ( isset($attrs['rdf:about']) ) { |
|
148 | + if (isset($attrs['rdf:about'])) { |
|
149 | 149 | $this->current_item['about'] = $attrs['rdf:about']; |
150 | 150 | } |
151 | 151 | } |
@@ -169,10 +169,10 @@ discard block |
||
169 | 169 | } |
170 | 170 | |
171 | 171 | # handle atom content constructs |
172 | - elseif ( $this->feed_type == ATOM and in_array($el, $this->_CONTENT_CONSTRUCTS) ) |
|
172 | + elseif ($this->feed_type == ATOM and in_array($el, $this->_CONTENT_CONSTRUCTS)) |
|
173 | 173 | { |
174 | 174 | // avoid clashing w/ RSS mod_content |
175 | - if ($el == 'content' ) { |
|
175 | + if ($el == 'content') { |
|
176 | 176 | $el = 'atom_content'; |
177 | 177 | } |
178 | 178 | |
@@ -181,31 +181,31 @@ discard block |
||
181 | 181 | } |
182 | 182 | |
183 | 183 | // if inside an Atom content construct (e.g. content or summary) field treat tags as text |
184 | - elseif ($this->feed_type == ATOM and $this->incontent ) |
|
184 | + elseif ($this->feed_type == ATOM and $this->incontent) |
|
185 | 185 | { |
186 | 186 | // if tags are inlined, then flatten |
187 | 187 | $attrs_str = join(' ', |
188 | 188 | array_map(array('MagpieRSS', 'map_attrs'), |
189 | 189 | array_keys($attrs), |
190 | - array_values($attrs) ) ); |
|
190 | + array_values($attrs))); |
|
191 | 191 | |
192 | - $this->append_content( "<$element $attrs_str>" ); |
|
192 | + $this->append_content("<$element $attrs_str>"); |
|
193 | 193 | |
194 | - array_unshift( $this->stack, $el ); |
|
194 | + array_unshift($this->stack, $el); |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | // Atom support many links per containging element. |
198 | 198 | // Magpie treats link elements of type rel='alternate' |
199 | 199 | // as being equivalent to RSS's simple link element. |
200 | 200 | // |
201 | - elseif ($this->feed_type == ATOM and $el == 'link' ) |
|
201 | + elseif ($this->feed_type == ATOM and $el == 'link') |
|
202 | 202 | { |
203 | - if ( isset($attrs['rel']) and $attrs['rel'] == 'alternate' ) |
|
203 | + if (isset($attrs['rel']) and $attrs['rel'] == 'alternate') |
|
204 | 204 | { |
205 | 205 | $link_el = 'link'; |
206 | 206 | } |
207 | 207 | else { |
208 | - $link_el = 'link_' . $attrs['rel']; |
|
208 | + $link_el = 'link_'.$attrs['rel']; |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | $this->append($link_el, $attrs['href']); |
@@ -216,11 +216,11 @@ discard block |
||
216 | 216 | } |
217 | 217 | } |
218 | 218 | |
219 | - function feed_cdata ($p, $text) { |
|
219 | + function feed_cdata($p, $text) { |
|
220 | 220 | |
221 | 221 | if ($this->feed_type == ATOM and $this->incontent) |
222 | 222 | { |
223 | - $this->append_content( $text ); |
|
223 | + $this->append_content($text); |
|
224 | 224 | } |
225 | 225 | else { |
226 | 226 | $current_el = join('_', array_reverse($this->stack)); |
@@ -228,35 +228,35 @@ discard block |
||
228 | 228 | } |
229 | 229 | } |
230 | 230 | |
231 | - function feed_end_element ($p, $el) { |
|
231 | + function feed_end_element($p, $el) { |
|
232 | 232 | $el = strtolower($el); |
233 | 233 | |
234 | - if ( $el == 'item' or $el == 'entry' ) |
|
234 | + if ($el == 'item' or $el == 'entry') |
|
235 | 235 | { |
236 | 236 | $this->items[] = $this->current_item; |
237 | 237 | $this->current_item = array(); |
238 | 238 | $this->initem = false; |
239 | 239 | } |
240 | - elseif ($this->feed_type == RSS and $this->current_namespace == '' and $el == 'textinput' ) |
|
240 | + elseif ($this->feed_type == RSS and $this->current_namespace == '' and $el == 'textinput') |
|
241 | 241 | { |
242 | 242 | $this->intextinput = false; |
243 | 243 | } |
244 | - elseif ($this->feed_type == RSS and $this->current_namespace == '' and $el == 'image' ) |
|
244 | + elseif ($this->feed_type == RSS and $this->current_namespace == '' and $el == 'image') |
|
245 | 245 | { |
246 | 246 | $this->inimage = false; |
247 | 247 | } |
248 | - elseif ($this->feed_type == ATOM and in_array($el, $this->_CONTENT_CONSTRUCTS) ) |
|
248 | + elseif ($this->feed_type == ATOM and in_array($el, $this->_CONTENT_CONSTRUCTS)) |
|
249 | 249 | { |
250 | 250 | $this->incontent = false; |
251 | 251 | } |
252 | - elseif ($el == 'channel' or $el == 'feed' ) |
|
252 | + elseif ($el == 'channel' or $el == 'feed') |
|
253 | 253 | { |
254 | 254 | $this->inchannel = false; |
255 | 255 | } |
256 | - elseif ($this->feed_type == ATOM and $this->incontent ) { |
|
256 | + elseif ($this->feed_type == ATOM and $this->incontent) { |
|
257 | 257 | // balance tags properly |
258 | 258 | // note: This may not actually be necessary |
259 | - if ( $this->stack[0] == $el ) |
|
259 | + if ($this->stack[0] == $el) |
|
260 | 260 | { |
261 | 261 | $this->append_content("</$el>"); |
262 | 262 | } |
@@ -264,97 +264,97 @@ discard block |
||
264 | 264 | $this->append_content("<$el />"); |
265 | 265 | } |
266 | 266 | |
267 | - array_shift( $this->stack ); |
|
267 | + array_shift($this->stack); |
|
268 | 268 | } |
269 | 269 | else { |
270 | - array_shift( $this->stack ); |
|
270 | + array_shift($this->stack); |
|
271 | 271 | } |
272 | 272 | |
273 | 273 | $this->current_namespace = false; |
274 | 274 | } |
275 | 275 | |
276 | - function concat (&$str1, $str2="") { |
|
277 | - if (!isset($str1) ) { |
|
278 | - $str1=""; |
|
276 | + function concat(&$str1, $str2 = "") { |
|
277 | + if ( ! isset($str1)) { |
|
278 | + $str1 = ""; |
|
279 | 279 | } |
280 | 280 | $str1 .= $str2; |
281 | 281 | } |
282 | 282 | |
283 | 283 | function append_content($text) { |
284 | - if ( $this->initem ) { |
|
285 | - $this->concat( $this->current_item[ $this->incontent ], $text ); |
|
284 | + if ($this->initem) { |
|
285 | + $this->concat($this->current_item[$this->incontent], $text); |
|
286 | 286 | } |
287 | - elseif ( $this->inchannel ) { |
|
288 | - $this->concat( $this->channel[ $this->incontent ], $text ); |
|
287 | + elseif ($this->inchannel) { |
|
288 | + $this->concat($this->channel[$this->incontent], $text); |
|
289 | 289 | } |
290 | 290 | } |
291 | 291 | |
292 | 292 | // smart append - field and namespace aware |
293 | 293 | function append($el, $text) { |
294 | - if (!$el) { |
|
294 | + if ( ! $el) { |
|
295 | 295 | return; |
296 | 296 | } |
297 | - if ( $this->current_namespace ) |
|
297 | + if ($this->current_namespace) |
|
298 | 298 | { |
299 | - if ( $this->initem ) { |
|
299 | + if ($this->initem) { |
|
300 | 300 | $this->concat( |
301 | - $this->current_item[ $this->current_namespace ][ $el ], $text); |
|
301 | + $this->current_item[$this->current_namespace][$el], $text); |
|
302 | 302 | } |
303 | 303 | elseif ($this->inchannel) { |
304 | 304 | $this->concat( |
305 | - $this->channel[ $this->current_namespace][ $el ], $text ); |
|
305 | + $this->channel[$this->current_namespace][$el], $text ); |
|
306 | 306 | } |
307 | 307 | elseif ($this->intextinput) { |
308 | 308 | $this->concat( |
309 | - $this->textinput[ $this->current_namespace][ $el ], $text ); |
|
309 | + $this->textinput[$this->current_namespace][$el], $text ); |
|
310 | 310 | } |
311 | 311 | elseif ($this->inimage) { |
312 | 312 | $this->concat( |
313 | - $this->image[ $this->current_namespace ][ $el ], $text ); |
|
313 | + $this->image[$this->current_namespace][$el], $text ); |
|
314 | 314 | } |
315 | 315 | } |
316 | 316 | else { |
317 | - if ( $this->initem ) { |
|
317 | + if ($this->initem) { |
|
318 | 318 | $this->concat( |
319 | - $this->current_item[ $el ], $text); |
|
319 | + $this->current_item[$el], $text); |
|
320 | 320 | } |
321 | 321 | elseif ($this->intextinput) { |
322 | 322 | $this->concat( |
323 | - $this->textinput[ $el ], $text ); |
|
323 | + $this->textinput[$el], $text ); |
|
324 | 324 | } |
325 | 325 | elseif ($this->inimage) { |
326 | 326 | $this->concat( |
327 | - $this->image[ $el ], $text ); |
|
327 | + $this->image[$el], $text ); |
|
328 | 328 | } |
329 | 329 | elseif ($this->inchannel) { |
330 | 330 | $this->concat( |
331 | - $this->channel[ $el ], $text ); |
|
331 | + $this->channel[$el], $text ); |
|
332 | 332 | } |
333 | 333 | |
334 | 334 | } |
335 | 335 | } |
336 | 336 | |
337 | - function normalize () { |
|
337 | + function normalize() { |
|
338 | 338 | // if atom populate rss fields |
339 | - if ( $this->is_atom() ) { |
|
339 | + if ($this->is_atom()) { |
|
340 | 340 | $this->channel['descripton'] = $this->channel['tagline']; |
341 | - for ( $i = 0; $i < count($this->items); $i++) { |
|
341 | + for ($i = 0; $i < count($this->items); $i++) { |
|
342 | 342 | $item = $this->items[$i]; |
343 | - if ( isset($item['summary']) ) |
|
343 | + if (isset($item['summary'])) |
|
344 | 344 | $item['description'] = $item['summary']; |
345 | - if ( isset($item['atom_content'])) |
|
345 | + if (isset($item['atom_content'])) |
|
346 | 346 | $item['content']['encoded'] = $item['atom_content']; |
347 | 347 | |
348 | 348 | $this->items[$i] = $item; |
349 | 349 | } |
350 | 350 | } |
351 | - elseif ( $this->is_rss() ) { |
|
351 | + elseif ($this->is_rss()) { |
|
352 | 352 | $this->channel['tagline'] = $this->channel['description']; |
353 | - for ( $i = 0; $i < count($this->items); $i++) { |
|
353 | + for ($i = 0; $i < count($this->items); $i++) { |
|
354 | 354 | $item = $this->items[$i]; |
355 | - if ( isset($item['description'])) |
|
355 | + if (isset($item['description'])) |
|
356 | 356 | $item['summary'] = $item['description']; |
357 | - if ( isset($item['content']['encoded'] ) ) |
|
357 | + if (isset($item['content']['encoded'])) |
|
358 | 358 | $item['atom_content'] = $item['content']['encoded']; |
359 | 359 | |
360 | 360 | $this->items[$i] = $item; |
@@ -362,8 +362,8 @@ discard block |
||
362 | 362 | } |
363 | 363 | } |
364 | 364 | |
365 | - function is_rss () { |
|
366 | - if ( $this->feed_type == RSS ) { |
|
365 | + function is_rss() { |
|
366 | + if ($this->feed_type == RSS) { |
|
367 | 367 | return $this->feed_version; |
368 | 368 | } |
369 | 369 | else { |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | } |
373 | 373 | |
374 | 374 | function is_atom() { |
375 | - if ( $this->feed_type == ATOM ) { |
|
375 | + if ($this->feed_type == ATOM) { |
|
376 | 376 | return $this->feed_version; |
377 | 377 | } |
378 | 378 | else { |
@@ -384,21 +384,21 @@ discard block |
||
384 | 384 | return "$k=\"$v\""; |
385 | 385 | } |
386 | 386 | |
387 | - function error( $errormsg, $lvl = E_USER_WARNING ) { |
|
387 | + function error($errormsg, $lvl = E_USER_WARNING) { |
|
388 | 388 | // append PHP's error message if track_errors enabled |
389 | - if ( isset($php_errormsg) ) { |
|
389 | + if (isset($php_errormsg)) { |
|
390 | 390 | $errormsg .= " ($php_errormsg)"; |
391 | 391 | } |
392 | - if ( MAGPIE_DEBUG ) { |
|
393 | - trigger_error( $errormsg, $lvl); |
|
392 | + if (MAGPIE_DEBUG) { |
|
393 | + trigger_error($errormsg, $lvl); |
|
394 | 394 | } else { |
395 | - error_log( $errormsg, 0); |
|
395 | + error_log($errormsg, 0); |
|
396 | 396 | } |
397 | 397 | } |
398 | 398 | |
399 | 399 | } |
400 | 400 | |
401 | -if ( !function_exists('fetch_rss') ) : |
|
401 | +if ( ! function_exists('fetch_rss')) : |
|
402 | 402 | /** |
403 | 403 | * Build Magpie object based on RSS from URL. |
404 | 404 | * |
@@ -409,21 +409,21 @@ discard block |
||
409 | 409 | * @param string $url URL to retrieve feed |
410 | 410 | * @return bool|MagpieRSS false on failure or MagpieRSS object on success. |
411 | 411 | */ |
412 | -function fetch_rss ($url) { |
|
412 | +function fetch_rss($url) { |
|
413 | 413 | // initialize constants |
414 | 414 | init(); |
415 | 415 | |
416 | - if ( !isset($url) ) { |
|
416 | + if ( ! isset($url)) { |
|
417 | 417 | // error("fetch_rss called without a url"); |
418 | 418 | return false; |
419 | 419 | } |
420 | 420 | |
421 | 421 | // if cache is disabled |
422 | - if ( !MAGPIE_CACHE_ON ) { |
|
422 | + if ( ! MAGPIE_CACHE_ON) { |
|
423 | 423 | // fetch file, and parse it |
424 | - $resp = _fetch_remote_file( $url ); |
|
425 | - if ( is_success( $resp->status ) ) { |
|
426 | - return _response_to_rss( $resp ); |
|
424 | + $resp = _fetch_remote_file($url); |
|
425 | + if (is_success($resp->status)) { |
|
426 | + return _response_to_rss($resp); |
|
427 | 427 | } |
428 | 428 | else { |
429 | 429 | // error("Failed to fetch $url and cache is off"); |
@@ -438,28 +438,28 @@ discard block |
||
438 | 438 | // 3. if cached obj fails freshness check, fetch remote |
439 | 439 | // 4. if remote fails, return stale object, or error |
440 | 440 | |
441 | - $cache = new RSSCache( MAGPIE_CACHE_DIR, MAGPIE_CACHE_AGE ); |
|
441 | + $cache = new RSSCache(MAGPIE_CACHE_DIR, MAGPIE_CACHE_AGE); |
|
442 | 442 | |
443 | 443 | if (MAGPIE_DEBUG and $cache->ERROR) { |
444 | 444 | debug($cache->ERROR, E_USER_WARNING); |
445 | 445 | } |
446 | 446 | |
447 | - $cache_status = 0; // response of check_cache |
|
447 | + $cache_status = 0; // response of check_cache |
|
448 | 448 | $request_headers = array(); // HTTP headers to send with fetch |
449 | - $rss = 0; // parsed RSS object |
|
450 | - $errormsg = 0; // errors, if any |
|
449 | + $rss = 0; // parsed RSS object |
|
450 | + $errormsg = 0; // errors, if any |
|
451 | 451 | |
452 | - if (!$cache->ERROR) { |
|
452 | + if ( ! $cache->ERROR) { |
|
453 | 453 | // return cache HIT, MISS, or STALE |
454 | - $cache_status = $cache->check_cache( $url ); |
|
454 | + $cache_status = $cache->check_cache($url); |
|
455 | 455 | } |
456 | 456 | |
457 | 457 | // if object cached, and cache is fresh, return cached obj |
458 | - if ( $cache_status == 'HIT' ) { |
|
459 | - $rss = $cache->get( $url ); |
|
460 | - if ( isset($rss) and $rss ) { |
|
458 | + if ($cache_status == 'HIT') { |
|
459 | + $rss = $cache->get($url); |
|
460 | + if (isset($rss) and $rss) { |
|
461 | 461 | $rss->from_cache = 1; |
462 | - if ( MAGPIE_DEBUG > 1) { |
|
462 | + if (MAGPIE_DEBUG > 1) { |
|
463 | 463 | debug("MagpieRSS: Cache HIT", E_USER_NOTICE); |
464 | 464 | } |
465 | 465 | return $rss; |
@@ -469,47 +469,47 @@ discard block |
||
469 | 469 | // else attempt a conditional get |
470 | 470 | |
471 | 471 | // set up headers |
472 | - if ( $cache_status == 'STALE' ) { |
|
473 | - $rss = $cache->get( $url ); |
|
474 | - if ( isset($rss->etag) and $rss->last_modified ) { |
|
472 | + if ($cache_status == 'STALE') { |
|
473 | + $rss = $cache->get($url); |
|
474 | + if (isset($rss->etag) and $rss->last_modified) { |
|
475 | 475 | $request_headers['If-None-Match'] = $rss->etag; |
476 | 476 | $request_headers['If-Last-Modified'] = $rss->last_modified; |
477 | 477 | } |
478 | 478 | } |
479 | 479 | |
480 | - $resp = _fetch_remote_file( $url, $request_headers ); |
|
480 | + $resp = _fetch_remote_file($url, $request_headers); |
|
481 | 481 | |
482 | 482 | if (isset($resp) and $resp) { |
483 | - if ($resp->status == '304' ) { |
|
483 | + if ($resp->status == '304') { |
|
484 | 484 | // we have the most current copy |
485 | - if ( MAGPIE_DEBUG > 1) { |
|
485 | + if (MAGPIE_DEBUG > 1) { |
|
486 | 486 | debug("Got 304 for $url"); |
487 | 487 | } |
488 | 488 | // reset cache on 304 (at minutillo insistent prodding) |
489 | 489 | $cache->set($url, $rss); |
490 | 490 | return $rss; |
491 | 491 | } |
492 | - elseif ( is_success( $resp->status ) ) { |
|
493 | - $rss = _response_to_rss( $resp ); |
|
494 | - if ( $rss ) { |
|
492 | + elseif (is_success($resp->status)) { |
|
493 | + $rss = _response_to_rss($resp); |
|
494 | + if ($rss) { |
|
495 | 495 | if (MAGPIE_DEBUG > 1) { |
496 | 496 | debug("Fetch successful"); |
497 | 497 | } |
498 | 498 | // add object to cache |
499 | - $cache->set( $url, $rss ); |
|
499 | + $cache->set($url, $rss); |
|
500 | 500 | return $rss; |
501 | 501 | } |
502 | 502 | } |
503 | 503 | else { |
504 | 504 | $errormsg = "Failed to fetch $url. "; |
505 | - if ( $resp->error ) { |
|
505 | + if ($resp->error) { |
|
506 | 506 | # compensate for Snoopy's annoying habbit to tacking |
507 | 507 | # on '\n' |
508 | 508 | $http_error = substr($resp->error, 0, -2); |
509 | 509 | $errormsg .= "(HTTP Error: $http_error)"; |
510 | 510 | } |
511 | 511 | else { |
512 | - $errormsg .= "(HTTP Response: " . $resp->response_code .')'; |
|
512 | + $errormsg .= "(HTTP Response: ".$resp->response_code.')'; |
|
513 | 513 | } |
514 | 514 | } |
515 | 515 | } |
@@ -521,7 +521,7 @@ discard block |
||
521 | 521 | |
522 | 522 | // attempt to return cached object |
523 | 523 | if ($rss) { |
524 | - if ( MAGPIE_DEBUG ) { |
|
524 | + if (MAGPIE_DEBUG) { |
|
525 | 525 | debug("Returning STALE object for $url"); |
526 | 526 | } |
527 | 527 | return $rss; |
@@ -547,35 +547,35 @@ discard block |
||
547 | 547 | * @param array $headers Optional. Headers to send to the URL. |
548 | 548 | * @return Snoopy style response |
549 | 549 | */ |
550 | -function _fetch_remote_file($url, $headers = "" ) { |
|
551 | - $resp = wp_safe_remote_request( $url, array( 'headers' => $headers, 'timeout' => MAGPIE_FETCH_TIME_OUT ) ); |
|
552 | - if ( is_wp_error($resp) ) { |
|
550 | +function _fetch_remote_file($url, $headers = "") { |
|
551 | + $resp = wp_safe_remote_request($url, array('headers' => $headers, 'timeout' => MAGPIE_FETCH_TIME_OUT)); |
|
552 | + if (is_wp_error($resp)) { |
|
553 | 553 | $error = array_shift($resp->errors); |
554 | 554 | |
555 | 555 | $resp = new stdClass; |
556 | 556 | $resp->status = 500; |
557 | 557 | $resp->response_code = 500; |
558 | - $resp->error = $error[0] . "\n"; //\n = Snoopy compatibility |
|
558 | + $resp->error = $error[0]."\n"; //\n = Snoopy compatibility |
|
559 | 559 | return $resp; |
560 | 560 | } |
561 | 561 | |
562 | 562 | // Snoopy returns headers unprocessed. |
563 | 563 | // Also note, WP_HTTP lowercases all keys, Snoopy did not. |
564 | 564 | $return_headers = array(); |
565 | - foreach ( wp_remote_retrieve_headers( $resp ) as $key => $value ) { |
|
566 | - if ( !is_array($value) ) { |
|
565 | + foreach (wp_remote_retrieve_headers($resp) as $key => $value) { |
|
566 | + if ( ! is_array($value)) { |
|
567 | 567 | $return_headers[] = "$key: $value"; |
568 | 568 | } else { |
569 | - foreach ( $value as $v ) |
|
569 | + foreach ($value as $v) |
|
570 | 570 | $return_headers[] = "$key: $v"; |
571 | 571 | } |
572 | 572 | } |
573 | 573 | |
574 | 574 | $response = new stdClass; |
575 | - $response->status = wp_remote_retrieve_response_code( $resp ); |
|
576 | - $response->response_code = wp_remote_retrieve_response_code( $resp ); |
|
575 | + $response->status = wp_remote_retrieve_response_code($resp); |
|
576 | + $response->response_code = wp_remote_retrieve_response_code($resp); |
|
577 | 577 | $response->headers = $return_headers; |
578 | - $response->results = wp_remote_retrieve_body( $resp ); |
|
578 | + $response->results = wp_remote_retrieve_body($resp); |
|
579 | 579 | |
580 | 580 | return $response; |
581 | 581 | } |
@@ -590,14 +590,14 @@ discard block |
||
590 | 590 | * @param array $resp |
591 | 591 | * @return MagpieRSS|bool |
592 | 592 | */ |
593 | -function _response_to_rss ($resp) { |
|
594 | - $rss = new MagpieRSS( $resp->results ); |
|
593 | +function _response_to_rss($resp) { |
|
594 | + $rss = new MagpieRSS($resp->results); |
|
595 | 595 | |
596 | 596 | // if RSS parsed successfully |
597 | - if ( $rss && (!isset($rss->ERROR) || !$rss->ERROR) ) { |
|
597 | + if ($rss && ( ! isset($rss->ERROR) || ! $rss->ERROR)) { |
|
598 | 598 | |
599 | 599 | // find Etag, and Last-Modified |
600 | - foreach ( (array) $resp->headers as $h) { |
|
600 | + foreach ((array) $resp->headers as $h) { |
|
601 | 601 | // 2003-03-02 - Nicola Asuni (www.tecnick.com) - fixed bug "Undefined offset: 1" |
602 | 602 | if (strpos($h, ": ")) { |
603 | 603 | list($field, $val) = explode(": ", $h, 2); |
@@ -607,11 +607,11 @@ discard block |
||
607 | 607 | $val = ""; |
608 | 608 | } |
609 | 609 | |
610 | - if ( $field == 'etag' ) { |
|
610 | + if ($field == 'etag') { |
|
611 | 611 | $rss->etag = $val; |
612 | 612 | } |
613 | 613 | |
614 | - if ( $field == 'last-modified' ) { |
|
614 | + if ($field == 'last-modified') { |
|
615 | 615 | $rss->last_modified = $val; |
616 | 616 | } |
617 | 617 | } |
@@ -622,7 +622,7 @@ discard block |
||
622 | 622 | $errormsg = "Failed to parse RSS file."; |
623 | 623 | |
624 | 624 | if ($rss) { |
625 | - $errormsg .= " (" . $rss->ERROR . ")"; |
|
625 | + $errormsg .= " (".$rss->ERROR.")"; |
|
626 | 626 | } |
627 | 627 | // error($errormsg); |
628 | 628 | |
@@ -637,95 +637,95 @@ discard block |
||
637 | 637 | * @package External |
638 | 638 | * @subpackage MagpieRSS |
639 | 639 | */ |
640 | -function init () { |
|
641 | - if ( defined('MAGPIE_INITALIZED') ) { |
|
640 | +function init() { |
|
641 | + if (defined('MAGPIE_INITALIZED')) { |
|
642 | 642 | return; |
643 | 643 | } |
644 | 644 | else { |
645 | 645 | define('MAGPIE_INITALIZED', 1); |
646 | 646 | } |
647 | 647 | |
648 | - if ( !defined('MAGPIE_CACHE_ON') ) { |
|
648 | + if ( ! defined('MAGPIE_CACHE_ON')) { |
|
649 | 649 | define('MAGPIE_CACHE_ON', 1); |
650 | 650 | } |
651 | 651 | |
652 | - if ( !defined('MAGPIE_CACHE_DIR') ) { |
|
652 | + if ( ! defined('MAGPIE_CACHE_DIR')) { |
|
653 | 653 | define('MAGPIE_CACHE_DIR', './cache'); |
654 | 654 | } |
655 | 655 | |
656 | - if ( !defined('MAGPIE_CACHE_AGE') ) { |
|
657 | - define('MAGPIE_CACHE_AGE', 60*60); // one hour |
|
656 | + if ( ! defined('MAGPIE_CACHE_AGE')) { |
|
657 | + define('MAGPIE_CACHE_AGE', 60 * 60); // one hour |
|
658 | 658 | } |
659 | 659 | |
660 | - if ( !defined('MAGPIE_CACHE_FRESH_ONLY') ) { |
|
660 | + if ( ! defined('MAGPIE_CACHE_FRESH_ONLY')) { |
|
661 | 661 | define('MAGPIE_CACHE_FRESH_ONLY', 0); |
662 | 662 | } |
663 | 663 | |
664 | - if ( !defined('MAGPIE_DEBUG') ) { |
|
664 | + if ( ! defined('MAGPIE_DEBUG')) { |
|
665 | 665 | define('MAGPIE_DEBUG', 0); |
666 | 666 | } |
667 | 667 | |
668 | - if ( !defined('MAGPIE_USER_AGENT') ) { |
|
669 | - $ua = 'WordPress/' . $GLOBALS['wp_version']; |
|
668 | + if ( ! defined('MAGPIE_USER_AGENT')) { |
|
669 | + $ua = 'WordPress/'.$GLOBALS['wp_version']; |
|
670 | 670 | |
671 | - if ( MAGPIE_CACHE_ON ) { |
|
672 | - $ua = $ua . ')'; |
|
671 | + if (MAGPIE_CACHE_ON) { |
|
672 | + $ua = $ua.')'; |
|
673 | 673 | } |
674 | 674 | else { |
675 | - $ua = $ua . '; No cache)'; |
|
675 | + $ua = $ua.'; No cache)'; |
|
676 | 676 | } |
677 | 677 | |
678 | 678 | define('MAGPIE_USER_AGENT', $ua); |
679 | 679 | } |
680 | 680 | |
681 | - if ( !defined('MAGPIE_FETCH_TIME_OUT') ) { |
|
682 | - define('MAGPIE_FETCH_TIME_OUT', 2); // 2 second timeout |
|
681 | + if ( ! defined('MAGPIE_FETCH_TIME_OUT')) { |
|
682 | + define('MAGPIE_FETCH_TIME_OUT', 2); // 2 second timeout |
|
683 | 683 | } |
684 | 684 | |
685 | 685 | // use gzip encoding to fetch rss files if supported? |
686 | - if ( !defined('MAGPIE_USE_GZIP') ) { |
|
686 | + if ( ! defined('MAGPIE_USE_GZIP')) { |
|
687 | 687 | define('MAGPIE_USE_GZIP', true); |
688 | 688 | } |
689 | 689 | } |
690 | 690 | |
691 | -function is_info ($sc) { |
|
691 | +function is_info($sc) { |
|
692 | 692 | return $sc >= 100 && $sc < 200; |
693 | 693 | } |
694 | 694 | |
695 | -function is_success ($sc) { |
|
695 | +function is_success($sc) { |
|
696 | 696 | return $sc >= 200 && $sc < 300; |
697 | 697 | } |
698 | 698 | |
699 | -function is_redirect ($sc) { |
|
699 | +function is_redirect($sc) { |
|
700 | 700 | return $sc >= 300 && $sc < 400; |
701 | 701 | } |
702 | 702 | |
703 | -function is_error ($sc) { |
|
703 | +function is_error($sc) { |
|
704 | 704 | return $sc >= 400 && $sc < 600; |
705 | 705 | } |
706 | 706 | |
707 | -function is_client_error ($sc) { |
|
707 | +function is_client_error($sc) { |
|
708 | 708 | return $sc >= 400 && $sc < 500; |
709 | 709 | } |
710 | 710 | |
711 | -function is_server_error ($sc) { |
|
711 | +function is_server_error($sc) { |
|
712 | 712 | return $sc >= 500 && $sc < 600; |
713 | 713 | } |
714 | 714 | |
715 | 715 | class RSSCache { |
716 | - var $BASE_CACHE; // where the cache files are stored |
|
717 | - var $MAX_AGE = 43200; // when are files stale, default twelve hours |
|
718 | - var $ERROR = ''; // accumulate error messages |
|
716 | + var $BASE_CACHE; // where the cache files are stored |
|
717 | + var $MAX_AGE = 43200; // when are files stale, default twelve hours |
|
718 | + var $ERROR = ''; // accumulate error messages |
|
719 | 719 | |
720 | 720 | /** |
721 | 721 | * PHP5 constructor. |
722 | 722 | */ |
723 | - function __construct( $base = '', $age = '' ) { |
|
724 | - $this->BASE_CACHE = WP_CONTENT_DIR . '/cache'; |
|
725 | - if ( $base ) { |
|
723 | + function __construct($base = '', $age = '') { |
|
724 | + $this->BASE_CACHE = WP_CONTENT_DIR.'/cache'; |
|
725 | + if ($base) { |
|
726 | 726 | $this->BASE_CACHE = $base; |
727 | 727 | } |
728 | - if ( $age ) { |
|
728 | + if ($age) { |
|
729 | 729 | $this->MAX_AGE = $age; |
730 | 730 | } |
731 | 731 | |
@@ -734,8 +734,8 @@ discard block |
||
734 | 734 | /** |
735 | 735 | * PHP4 constructor. |
736 | 736 | */ |
737 | - public function RSSCache( $base = '', $age = '' ) { |
|
738 | - self::__construct( $base, $age ); |
|
737 | + public function RSSCache($base = '', $age = '') { |
|
738 | + self::__construct($base, $age); |
|
739 | 739 | } |
740 | 740 | |
741 | 741 | /*=======================================================================*\ |
@@ -744,8 +744,8 @@ discard block |
||
744 | 744 | Input: url from which the rss file was fetched |
745 | 745 | Output: true on success |
746 | 746 | \*=======================================================================*/ |
747 | - function set ($url, $rss) { |
|
748 | - $cache_option = 'rss_' . $this->file_name( $url ); |
|
747 | + function set($url, $rss) { |
|
748 | + $cache_option = 'rss_'.$this->file_name($url); |
|
749 | 749 | |
750 | 750 | set_transient($cache_option, $rss, $this->MAX_AGE); |
751 | 751 | |
@@ -758,11 +758,11 @@ discard block |
||
758 | 758 | Input: url from which the rss file was fetched |
759 | 759 | Output: cached object on HIT, false on MISS |
760 | 760 | \*=======================================================================*/ |
761 | - function get ($url) { |
|
761 | + function get($url) { |
|
762 | 762 | $this->ERROR = ""; |
763 | - $cache_option = 'rss_' . $this->file_name( $url ); |
|
763 | + $cache_option = 'rss_'.$this->file_name($url); |
|
764 | 764 | |
765 | - if ( ! $rss = get_transient( $cache_option ) ) { |
|
765 | + if ( ! $rss = get_transient($cache_option)) { |
|
766 | 766 | $this->debug( |
767 | 767 | "Cache doesn't contain: $url (cache option: $cache_option)" |
768 | 768 | ); |
@@ -779,11 +779,11 @@ discard block |
||
779 | 779 | Input: url from which the rss file was fetched |
780 | 780 | Output: cached object on HIT, false on MISS |
781 | 781 | \*=======================================================================*/ |
782 | - function check_cache ( $url ) { |
|
782 | + function check_cache($url) { |
|
783 | 783 | $this->ERROR = ""; |
784 | - $cache_option = 'rss_' . $this->file_name( $url ); |
|
784 | + $cache_option = 'rss_'.$this->file_name($url); |
|
785 | 785 | |
786 | - if ( get_transient($cache_option) ) { |
|
786 | + if (get_transient($cache_option)) { |
|
787 | 787 | // object exists and is current |
788 | 788 | return 'HIT'; |
789 | 789 | } else { |
@@ -795,15 +795,15 @@ discard block |
||
795 | 795 | /*=======================================================================*\ |
796 | 796 | Function: serialize |
797 | 797 | \*=======================================================================*/ |
798 | - function serialize ( $rss ) { |
|
799 | - return serialize( $rss ); |
|
798 | + function serialize($rss) { |
|
799 | + return serialize($rss); |
|
800 | 800 | } |
801 | 801 | |
802 | 802 | /*=======================================================================*\ |
803 | 803 | Function: unserialize |
804 | 804 | \*=======================================================================*/ |
805 | - function unserialize ( $data ) { |
|
806 | - return unserialize( $data ); |
|
805 | + function unserialize($data) { |
|
806 | + return unserialize($data); |
|
807 | 807 | } |
808 | 808 | |
809 | 809 | /*=======================================================================*\ |
@@ -812,64 +812,64 @@ discard block |
||
812 | 812 | Input: url from which the rss file was fetched |
813 | 813 | Output: a file name |
814 | 814 | \*=======================================================================*/ |
815 | - function file_name ($url) { |
|
816 | - return md5( $url ); |
|
815 | + function file_name($url) { |
|
816 | + return md5($url); |
|
817 | 817 | } |
818 | 818 | |
819 | 819 | /*=======================================================================*\ |
820 | 820 | Function: error |
821 | 821 | Purpose: register error |
822 | 822 | \*=======================================================================*/ |
823 | - function error ($errormsg, $lvl=E_USER_WARNING) { |
|
823 | + function error($errormsg, $lvl = E_USER_WARNING) { |
|
824 | 824 | // append PHP's error message if track_errors enabled |
825 | - if ( isset($php_errormsg) ) { |
|
825 | + if (isset($php_errormsg)) { |
|
826 | 826 | $errormsg .= " ($php_errormsg)"; |
827 | 827 | } |
828 | 828 | $this->ERROR = $errormsg; |
829 | - if ( MAGPIE_DEBUG ) { |
|
830 | - trigger_error( $errormsg, $lvl); |
|
829 | + if (MAGPIE_DEBUG) { |
|
830 | + trigger_error($errormsg, $lvl); |
|
831 | 831 | } |
832 | 832 | else { |
833 | - error_log( $errormsg, 0); |
|
833 | + error_log($errormsg, 0); |
|
834 | 834 | } |
835 | 835 | } |
836 | - function debug ($debugmsg, $lvl=E_USER_NOTICE) { |
|
837 | - if ( MAGPIE_DEBUG ) { |
|
836 | + function debug($debugmsg, $lvl = E_USER_NOTICE) { |
|
837 | + if (MAGPIE_DEBUG) { |
|
838 | 838 | $this->error("MagpieRSS [debug] $debugmsg", $lvl); |
839 | 839 | } |
840 | 840 | } |
841 | 841 | } |
842 | 842 | |
843 | -if ( !function_exists('parse_w3cdtf') ) : |
|
844 | -function parse_w3cdtf ( $date_str ) { |
|
843 | +if ( ! function_exists('parse_w3cdtf')) : |
|
844 | +function parse_w3cdtf($date_str) { |
|
845 | 845 | |
846 | 846 | # regex to match wc3dtf |
847 | 847 | $pat = "/(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(:(\d{2}))?(?:([-+])(\d{2}):?(\d{2})|(Z))?/"; |
848 | 848 | |
849 | - if ( preg_match( $pat, $date_str, $match ) ) { |
|
850 | - list( $year, $month, $day, $hours, $minutes, $seconds) = |
|
851 | - array( $match[1], $match[2], $match[3], $match[4], $match[5], $match[7]); |
|
849 | + if (preg_match($pat, $date_str, $match)) { |
|
850 | + list($year, $month, $day, $hours, $minutes, $seconds) = |
|
851 | + array($match[1], $match[2], $match[3], $match[4], $match[5], $match[7]); |
|
852 | 852 | |
853 | 853 | # calc epoch for current date assuming GMT |
854 | - $epoch = gmmktime( $hours, $minutes, $seconds, $month, $day, $year); |
|
854 | + $epoch = gmmktime($hours, $minutes, $seconds, $month, $day, $year); |
|
855 | 855 | |
856 | 856 | $offset = 0; |
857 | - if ( $match[11] == 'Z' ) { |
|
857 | + if ($match[11] == 'Z') { |
|
858 | 858 | # zulu time, aka GMT |
859 | 859 | } |
860 | 860 | else { |
861 | - list( $tz_mod, $tz_hour, $tz_min ) = |
|
862 | - array( $match[8], $match[9], $match[10]); |
|
861 | + list($tz_mod, $tz_hour, $tz_min) = |
|
862 | + array($match[8], $match[9], $match[10]); |
|
863 | 863 | |
864 | 864 | # zero out the variables |
865 | - if ( ! $tz_hour ) { $tz_hour = 0; } |
|
866 | - if ( ! $tz_min ) { $tz_min = 0; } |
|
865 | + if ( ! $tz_hour) { $tz_hour = 0; } |
|
866 | + if ( ! $tz_min) { $tz_min = 0; } |
|
867 | 867 | |
868 | - $offset_secs = (($tz_hour*60)+$tz_min)*60; |
|
868 | + $offset_secs = (($tz_hour * 60) + $tz_min) * 60; |
|
869 | 869 | |
870 | 870 | # is timezone ahead of GMT? then subtract offset |
871 | 871 | # |
872 | - if ( $tz_mod == '+' ) { |
|
872 | + if ($tz_mod == '+') { |
|
873 | 873 | $offset_secs = $offset_secs * -1; |
874 | 874 | } |
875 | 875 | |
@@ -884,7 +884,7 @@ discard block |
||
884 | 884 | } |
885 | 885 | endif; |
886 | 886 | |
887 | -if ( !function_exists('wp_rss') ) : |
|
887 | +if ( ! function_exists('wp_rss')) : |
|
888 | 888 | /** |
889 | 889 | * Display all RSS items in a HTML ordered list. |
890 | 890 | * |
@@ -895,31 +895,31 @@ discard block |
||
895 | 895 | * @param string $url URL of feed to display. Will not auto sense feed URL. |
896 | 896 | * @param int $num_items Optional. Number of items to display, default is all. |
897 | 897 | */ |
898 | -function wp_rss( $url, $num_items = -1 ) { |
|
899 | - if ( $rss = fetch_rss( $url ) ) { |
|
898 | +function wp_rss($url, $num_items = -1) { |
|
899 | + if ($rss = fetch_rss($url)) { |
|
900 | 900 | echo '<ul>'; |
901 | 901 | |
902 | - if ( $num_items !== -1 ) { |
|
903 | - $rss->items = array_slice( $rss->items, 0, $num_items ); |
|
902 | + if ($num_items !== -1) { |
|
903 | + $rss->items = array_slice($rss->items, 0, $num_items); |
|
904 | 904 | } |
905 | 905 | |
906 | - foreach ( (array) $rss->items as $item ) { |
|
906 | + foreach ((array) $rss->items as $item) { |
|
907 | 907 | printf( |
908 | 908 | '<li><a href="%1$s" title="%2$s">%3$s</a></li>', |
909 | - esc_url( $item['link'] ), |
|
910 | - esc_attr( strip_tags( $item['description'] ) ), |
|
911 | - esc_html( $item['title'] ) |
|
909 | + esc_url($item['link']), |
|
910 | + esc_attr(strip_tags($item['description'])), |
|
911 | + esc_html($item['title']) |
|
912 | 912 | ); |
913 | 913 | } |
914 | 914 | |
915 | 915 | echo '</ul>'; |
916 | 916 | } else { |
917 | - _e( 'An error has occurred, which probably means the feed is down. Try again later.' ); |
|
917 | + _e('An error has occurred, which probably means the feed is down. Try again later.'); |
|
918 | 918 | } |
919 | 919 | } |
920 | 920 | endif; |
921 | 921 | |
922 | -if ( !function_exists('get_rss') ) : |
|
922 | +if ( ! function_exists('get_rss')) : |
|
923 | 923 | /** |
924 | 924 | * Display RSS items in HTML list items. |
925 | 925 | * |
@@ -936,11 +936,11 @@ discard block |
||
936 | 936 | * @param int $num_items Optional. Number of items to display, default is all. |
937 | 937 | * @return bool False on failure. |
938 | 938 | */ |
939 | -function get_rss ($url, $num_items = 5) { // Like get posts, but for RSS |
|
939 | +function get_rss($url, $num_items = 5) { // Like get posts, but for RSS |
|
940 | 940 | $rss = fetch_rss($url); |
941 | - if ( $rss ) { |
|
941 | + if ($rss) { |
|
942 | 942 | $rss->items = array_slice($rss->items, 0, $num_items); |
943 | - foreach ( (array) $rss->items as $item ) { |
|
943 | + foreach ((array) $rss->items as $item) { |
|
944 | 944 | echo "<li>\n"; |
945 | 945 | echo "<a href='$item[link]' title='$item[description]'>"; |
946 | 946 | echo esc_html($item['title']); |
@@ -125,12 +125,10 @@ discard block |
||
125 | 125 | if ( $el == 'rdf' ) { |
126 | 126 | $this->feed_type = RSS; |
127 | 127 | $this->feed_version = '1.0'; |
128 | - } |
|
129 | - elseif ( $el == 'rss' ) { |
|
128 | + } elseif ( $el == 'rss' ) { |
|
130 | 129 | $this->feed_type = RSS; |
131 | 130 | $this->feed_version = $attrs['version']; |
132 | - } |
|
133 | - elseif ( $el == 'feed' ) { |
|
131 | + } elseif ( $el == 'feed' ) { |
|
134 | 132 | $this->feed_type = ATOM; |
135 | 133 | $this->feed_version = $attrs['version']; |
136 | 134 | $this->inchannel = true; |
@@ -141,8 +139,7 @@ discard block |
||
141 | 139 | if ( $el == 'channel' ) |
142 | 140 | { |
143 | 141 | $this->inchannel = true; |
144 | - } |
|
145 | - elseif ($el == 'item' or $el == 'entry' ) |
|
142 | + } elseif ($el == 'item' or $el == 'entry' ) |
|
146 | 143 | { |
147 | 144 | $this->initem = true; |
148 | 145 | if ( isset($attrs['rdf:about']) ) { |
@@ -158,9 +155,7 @@ discard block |
||
158 | 155 | $el == 'textinput' ) |
159 | 156 | { |
160 | 157 | $this->intextinput = true; |
161 | - } |
|
162 | - |
|
163 | - elseif ( |
|
158 | + } elseif ( |
|
164 | 159 | $this->feed_type == RSS and |
165 | 160 | $this->current_namespace == '' and |
166 | 161 | $el == 'image' ) |
@@ -203,8 +198,7 @@ discard block |
||
203 | 198 | if ( isset($attrs['rel']) and $attrs['rel'] == 'alternate' ) |
204 | 199 | { |
205 | 200 | $link_el = 'link'; |
206 | - } |
|
207 | - else { |
|
201 | + } else { |
|
208 | 202 | $link_el = 'link_' . $attrs['rel']; |
209 | 203 | } |
210 | 204 | |
@@ -221,8 +215,7 @@ discard block |
||
221 | 215 | if ($this->feed_type == ATOM and $this->incontent) |
222 | 216 | { |
223 | 217 | $this->append_content( $text ); |
224 | - } |
|
225 | - else { |
|
218 | + } else { |
|
226 | 219 | $current_el = join('_', array_reverse($this->stack)); |
227 | 220 | $this->append($current_el, $text); |
228 | 221 | } |
@@ -236,37 +229,30 @@ discard block |
||
236 | 229 | $this->items[] = $this->current_item; |
237 | 230 | $this->current_item = array(); |
238 | 231 | $this->initem = false; |
239 | - } |
|
240 | - elseif ($this->feed_type == RSS and $this->current_namespace == '' and $el == 'textinput' ) |
|
232 | + } elseif ($this->feed_type == RSS and $this->current_namespace == '' and $el == 'textinput' ) |
|
241 | 233 | { |
242 | 234 | $this->intextinput = false; |
243 | - } |
|
244 | - elseif ($this->feed_type == RSS and $this->current_namespace == '' and $el == 'image' ) |
|
235 | + } elseif ($this->feed_type == RSS and $this->current_namespace == '' and $el == 'image' ) |
|
245 | 236 | { |
246 | 237 | $this->inimage = false; |
247 | - } |
|
248 | - elseif ($this->feed_type == ATOM and in_array($el, $this->_CONTENT_CONSTRUCTS) ) |
|
238 | + } elseif ($this->feed_type == ATOM and in_array($el, $this->_CONTENT_CONSTRUCTS) ) |
|
249 | 239 | { |
250 | 240 | $this->incontent = false; |
251 | - } |
|
252 | - elseif ($el == 'channel' or $el == 'feed' ) |
|
241 | + } elseif ($el == 'channel' or $el == 'feed' ) |
|
253 | 242 | { |
254 | 243 | $this->inchannel = false; |
255 | - } |
|
256 | - elseif ($this->feed_type == ATOM and $this->incontent ) { |
|
244 | + } elseif ($this->feed_type == ATOM and $this->incontent ) { |
|
257 | 245 | // balance tags properly |
258 | 246 | // note: This may not actually be necessary |
259 | 247 | if ( $this->stack[0] == $el ) |
260 | 248 | { |
261 | 249 | $this->append_content("</$el>"); |
262 | - } |
|
263 | - else { |
|
250 | + } else { |
|
264 | 251 | $this->append_content("<$el />"); |
265 | 252 | } |
266 | 253 | |
267 | 254 | array_shift( $this->stack ); |
268 | - } |
|
269 | - else { |
|
255 | + } else { |
|
270 | 256 | array_shift( $this->stack ); |
271 | 257 | } |
272 | 258 | |
@@ -283,8 +269,7 @@ discard block |
||
283 | 269 | function append_content($text) { |
284 | 270 | if ( $this->initem ) { |
285 | 271 | $this->concat( $this->current_item[ $this->incontent ], $text ); |
286 | - } |
|
287 | - elseif ( $this->inchannel ) { |
|
272 | + } elseif ( $this->inchannel ) { |
|
288 | 273 | $this->concat( $this->channel[ $this->incontent ], $text ); |
289 | 274 | } |
290 | 275 | } |
@@ -299,34 +284,27 @@ discard block |
||
299 | 284 | if ( $this->initem ) { |
300 | 285 | $this->concat( |
301 | 286 | $this->current_item[ $this->current_namespace ][ $el ], $text); |
302 | - } |
|
303 | - elseif ($this->inchannel) { |
|
287 | + } elseif ($this->inchannel) { |
|
304 | 288 | $this->concat( |
305 | 289 | $this->channel[ $this->current_namespace][ $el ], $text ); |
306 | - } |
|
307 | - elseif ($this->intextinput) { |
|
290 | + } elseif ($this->intextinput) { |
|
308 | 291 | $this->concat( |
309 | 292 | $this->textinput[ $this->current_namespace][ $el ], $text ); |
310 | - } |
|
311 | - elseif ($this->inimage) { |
|
293 | + } elseif ($this->inimage) { |
|
312 | 294 | $this->concat( |
313 | 295 | $this->image[ $this->current_namespace ][ $el ], $text ); |
314 | 296 | } |
315 | - } |
|
316 | - else { |
|
297 | + } else { |
|
317 | 298 | if ( $this->initem ) { |
318 | 299 | $this->concat( |
319 | 300 | $this->current_item[ $el ], $text); |
320 | - } |
|
321 | - elseif ($this->intextinput) { |
|
301 | + } elseif ($this->intextinput) { |
|
322 | 302 | $this->concat( |
323 | 303 | $this->textinput[ $el ], $text ); |
324 | - } |
|
325 | - elseif ($this->inimage) { |
|
304 | + } elseif ($this->inimage) { |
|
326 | 305 | $this->concat( |
327 | 306 | $this->image[ $el ], $text ); |
328 | - } |
|
329 | - elseif ($this->inchannel) { |
|
307 | + } elseif ($this->inchannel) { |
|
330 | 308 | $this->concat( |
331 | 309 | $this->channel[ $el ], $text ); |
332 | 310 | } |
@@ -340,22 +318,25 @@ discard block |
||
340 | 318 | $this->channel['descripton'] = $this->channel['tagline']; |
341 | 319 | for ( $i = 0; $i < count($this->items); $i++) { |
342 | 320 | $item = $this->items[$i]; |
343 | - if ( isset($item['summary']) ) |
|
344 | - $item['description'] = $item['summary']; |
|
345 | - if ( isset($item['atom_content'])) |
|
346 | - $item['content']['encoded'] = $item['atom_content']; |
|
321 | + if ( isset($item['summary']) ) { |
|
322 | + $item['description'] = $item['summary']; |
|
323 | + } |
|
324 | + if ( isset($item['atom_content'])) { |
|
325 | + $item['content']['encoded'] = $item['atom_content']; |
|
326 | + } |
|
347 | 327 | |
348 | 328 | $this->items[$i] = $item; |
349 | 329 | } |
350 | - } |
|
351 | - elseif ( $this->is_rss() ) { |
|
330 | + } elseif ( $this->is_rss() ) { |
|
352 | 331 | $this->channel['tagline'] = $this->channel['description']; |
353 | 332 | for ( $i = 0; $i < count($this->items); $i++) { |
354 | 333 | $item = $this->items[$i]; |
355 | - if ( isset($item['description'])) |
|
356 | - $item['summary'] = $item['description']; |
|
357 | - if ( isset($item['content']['encoded'] ) ) |
|
358 | - $item['atom_content'] = $item['content']['encoded']; |
|
334 | + if ( isset($item['description'])) { |
|
335 | + $item['summary'] = $item['description']; |
|
336 | + } |
|
337 | + if ( isset($item['content']['encoded'] ) ) { |
|
338 | + $item['atom_content'] = $item['content']['encoded']; |
|
339 | + } |
|
359 | 340 | |
360 | 341 | $this->items[$i] = $item; |
361 | 342 | } |
@@ -365,8 +346,7 @@ discard block |
||
365 | 346 | function is_rss () { |
366 | 347 | if ( $this->feed_type == RSS ) { |
367 | 348 | return $this->feed_version; |
368 | - } |
|
369 | - else { |
|
349 | + } else { |
|
370 | 350 | return false; |
371 | 351 | } |
372 | 352 | } |
@@ -374,8 +354,7 @@ discard block |
||
374 | 354 | function is_atom() { |
375 | 355 | if ( $this->feed_type == ATOM ) { |
376 | 356 | return $this->feed_version; |
377 | - } |
|
378 | - else { |
|
357 | + } else { |
|
379 | 358 | return false; |
380 | 359 | } |
381 | 360 | } |
@@ -424,8 +403,7 @@ discard block |
||
424 | 403 | $resp = _fetch_remote_file( $url ); |
425 | 404 | if ( is_success( $resp->status ) ) { |
426 | 405 | return _response_to_rss( $resp ); |
427 | - } |
|
428 | - else { |
|
406 | + } else { |
|
429 | 407 | // error("Failed to fetch $url and cache is off"); |
430 | 408 | return false; |
431 | 409 | } |
@@ -488,8 +466,7 @@ discard block |
||
488 | 466 | // reset cache on 304 (at minutillo insistent prodding) |
489 | 467 | $cache->set($url, $rss); |
490 | 468 | return $rss; |
491 | - } |
|
492 | - elseif ( is_success( $resp->status ) ) { |
|
469 | + } elseif ( is_success( $resp->status ) ) { |
|
493 | 470 | $rss = _response_to_rss( $resp ); |
494 | 471 | if ( $rss ) { |
495 | 472 | if (MAGPIE_DEBUG > 1) { |
@@ -499,21 +476,18 @@ discard block |
||
499 | 476 | $cache->set( $url, $rss ); |
500 | 477 | return $rss; |
501 | 478 | } |
502 | - } |
|
503 | - else { |
|
479 | + } else { |
|
504 | 480 | $errormsg = "Failed to fetch $url. "; |
505 | 481 | if ( $resp->error ) { |
506 | 482 | # compensate for Snoopy's annoying habbit to tacking |
507 | 483 | # on '\n' |
508 | 484 | $http_error = substr($resp->error, 0, -2); |
509 | 485 | $errormsg .= "(HTTP Error: $http_error)"; |
510 | - } |
|
511 | - else { |
|
486 | + } else { |
|
512 | 487 | $errormsg .= "(HTTP Response: " . $resp->response_code .')'; |
513 | 488 | } |
514 | 489 | } |
515 | - } |
|
516 | - else { |
|
490 | + } else { |
|
517 | 491 | $errormsg = "Unable to retrieve RSS file for unknown reasons."; |
518 | 492 | } |
519 | 493 | |
@@ -566,8 +540,9 @@ discard block |
||
566 | 540 | if ( !is_array($value) ) { |
567 | 541 | $return_headers[] = "$key: $value"; |
568 | 542 | } else { |
569 | - foreach ( $value as $v ) |
|
570 | - $return_headers[] = "$key: $v"; |
|
543 | + foreach ( $value as $v ) { |
|
544 | + $return_headers[] = "$key: $v"; |
|
545 | + } |
|
571 | 546 | } |
572 | 547 | } |
573 | 548 | |
@@ -601,8 +576,7 @@ discard block |
||
601 | 576 | // 2003-03-02 - Nicola Asuni (www.tecnick.com) - fixed bug "Undefined offset: 1" |
602 | 577 | if (strpos($h, ": ")) { |
603 | 578 | list($field, $val) = explode(": ", $h, 2); |
604 | - } |
|
605 | - else { |
|
579 | + } else { |
|
606 | 580 | $field = $h; |
607 | 581 | $val = ""; |
608 | 582 | } |
@@ -640,8 +614,7 @@ discard block |
||
640 | 614 | function init () { |
641 | 615 | if ( defined('MAGPIE_INITALIZED') ) { |
642 | 616 | return; |
643 | - } |
|
644 | - else { |
|
617 | + } else { |
|
645 | 618 | define('MAGPIE_INITALIZED', 1); |
646 | 619 | } |
647 | 620 | |
@@ -670,8 +643,7 @@ discard block |
||
670 | 643 | |
671 | 644 | if ( MAGPIE_CACHE_ON ) { |
672 | 645 | $ua = $ua . ')'; |
673 | - } |
|
674 | - else { |
|
646 | + } else { |
|
675 | 647 | $ua = $ua . '; No cache)'; |
676 | 648 | } |
677 | 649 | |
@@ -828,8 +800,7 @@ discard block |
||
828 | 800 | $this->ERROR = $errormsg; |
829 | 801 | if ( MAGPIE_DEBUG ) { |
830 | 802 | trigger_error( $errormsg, $lvl); |
831 | - } |
|
832 | - else { |
|
803 | + } else { |
|
833 | 804 | error_log( $errormsg, 0); |
834 | 805 | } |
835 | 806 | } |
@@ -856,8 +827,7 @@ discard block |
||
856 | 827 | $offset = 0; |
857 | 828 | if ( $match[11] == 'Z' ) { |
858 | 829 | # zulu time, aka GMT |
859 | - } |
|
860 | - else { |
|
830 | + } else { |
|
861 | 831 | list( $tz_mod, $tz_hour, $tz_min ) = |
862 | 832 | array( $match[8], $match[9], $match[10]); |
863 | 833 | |
@@ -877,8 +847,7 @@ discard block |
||
877 | 847 | } |
878 | 848 | $epoch = $epoch + $offset; |
879 | 849 | return $epoch; |
880 | - } |
|
881 | - else { |
|
850 | + } else { |
|
882 | 851 | return -1; |
883 | 852 | } |
884 | 853 | } |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | * Consume the next byte |
110 | 110 | * |
111 | 111 | * @access private |
112 | - * @return mixed The next byte, or false, if there is no more data |
|
112 | + * @return string|false The next byte, or false, if there is no more data |
|
113 | 113 | */ |
114 | 114 | public function consume() |
115 | 115 | { |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | * |
130 | 130 | * @access private |
131 | 131 | * @param string $chars Characters to consume |
132 | - * @return mixed A series of characters that match the range, or false |
|
132 | + * @return string|false A series of characters that match the range, or false |
|
133 | 133 | */ |
134 | 134 | public function consume_range($chars) |
135 | 135 | { |
@@ -215,7 +215,7 @@ |
||
215 | 215 | $replacement = SimplePie_Misc::codepoint_to_utf8($codepoint); |
216 | 216 | } |
217 | 217 | |
218 | - if (!in_array($this->consume(), array(';', false), true)) |
|
218 | + if ( ! in_array($this->consume(), array(';', false), true)) |
|
219 | 219 | { |
220 | 220 | $this->unconsume(); |
221 | 221 | } |
@@ -117,8 +117,7 @@ discard block |
||
117 | 117 | { |
118 | 118 | $this->consumed .= $this->data[$this->position]; |
119 | 119 | return $this->data[$this->position++]; |
120 | - } |
|
121 | - else |
|
120 | + } else |
|
122 | 121 | { |
123 | 122 | return false; |
124 | 123 | } |
@@ -139,8 +138,7 @@ discard block |
||
139 | 138 | $this->consumed .= $data; |
140 | 139 | $this->position += $len; |
141 | 140 | return $data; |
142 | - } |
|
143 | - else |
|
141 | + } else |
|
144 | 142 | { |
145 | 143 | return false; |
146 | 144 | } |
@@ -200,8 +198,7 @@ discard block |
||
200 | 198 | if ($hex) |
201 | 199 | { |
202 | 200 | $codepoint = hexdec($codepoint); |
203 | - } |
|
204 | - else |
|
201 | + } else |
|
205 | 202 | { |
206 | 203 | $codepoint = intval($codepoint); |
207 | 204 | } |
@@ -209,8 +206,7 @@ discard block |
||
209 | 206 | if (isset($windows_1252_specials[$codepoint])) |
210 | 207 | { |
211 | 208 | $replacement = $windows_1252_specials[$codepoint]; |
212 | - } |
|
213 | - else |
|
209 | + } else |
|
214 | 210 | { |
215 | 211 | $replacement = SimplePie_Misc::codepoint_to_utf8($codepoint); |
216 | 212 | } |
@@ -647,7 +647,7 @@ |
||
647 | 647 | /** |
648 | 648 | * Get length |
649 | 649 | * |
650 | - * @return float Length in bytes |
|
650 | + * @return string|null Length in bytes |
|
651 | 651 | */ |
652 | 652 | public function get_length() |
653 | 653 | { |
@@ -813,7 +813,7 @@ discard block |
||
813 | 813 | $length = $this->get_length(); |
814 | 814 | if ($length !== null) |
815 | 815 | { |
816 | - return round($length/1048576, 2); |
|
816 | + return round($length / 1048576, 2); |
|
817 | 817 | } |
818 | 818 | else |
819 | 819 | { |
@@ -917,7 +917,7 @@ discard block |
||
917 | 917 | * @param array|string $options See first paramter to {@see embed} |
918 | 918 | * @return string HTML string to output |
919 | 919 | */ |
920 | - public function native_embed($options='') |
|
920 | + public function native_embed($options = '') |
|
921 | 921 | { |
922 | 922 | return $this->embed($options, true); |
923 | 923 | } |
@@ -991,7 +991,7 @@ discard block |
||
991 | 991 | else |
992 | 992 | { |
993 | 993 | $options = explode(',', $options); |
994 | - foreach($options as $option) |
|
994 | + foreach ($options as $option) |
|
995 | 995 | { |
996 | 996 | $opt = explode(':', $option, 2); |
997 | 997 | if (isset($opt[0], $opt[1])) |
@@ -1058,11 +1058,11 @@ discard block |
||
1058 | 1058 | } |
1059 | 1059 | elseif ($widescreen) |
1060 | 1060 | { |
1061 | - $width = round((intval($height)/9)*16); |
|
1061 | + $width = round((intval($height) / 9) * 16); |
|
1062 | 1062 | } |
1063 | 1063 | else |
1064 | 1064 | { |
1065 | - $width = round((intval($height)/3)*4); |
|
1065 | + $width = round((intval($height) / 3) * 4); |
|
1066 | 1066 | } |
1067 | 1067 | } |
1068 | 1068 | else |
@@ -1092,11 +1092,11 @@ discard block |
||
1092 | 1092 | } |
1093 | 1093 | elseif ($widescreen) |
1094 | 1094 | { |
1095 | - $height = round((intval($width)/16)*9); |
|
1095 | + $height = round((intval($width) / 16) * 9); |
|
1096 | 1096 | } |
1097 | 1097 | else |
1098 | 1098 | { |
1099 | - $height = round((intval($width)/4)*3); |
|
1099 | + $height = round((intval($width) / 4) * 3); |
|
1100 | 1100 | } |
1101 | 1101 | } |
1102 | 1102 | else |
@@ -1126,11 +1126,11 @@ discard block |
||
1126 | 1126 | { |
1127 | 1127 | if ($native) |
1128 | 1128 | { |
1129 | - $embed .= "<embed src=\"" . $this->get_link() . "\" pluginspage=\"http://adobe.com/go/getflashplayer\" type=\"$type\" quality=\"high\" width=\"$width\" height=\"$height\" bgcolor=\"$bgcolor\" loop=\"$loop\"></embed>"; |
|
1129 | + $embed .= "<embed src=\"".$this->get_link()."\" pluginspage=\"http://adobe.com/go/getflashplayer\" type=\"$type\" quality=\"high\" width=\"$width\" height=\"$height\" bgcolor=\"$bgcolor\" loop=\"$loop\"></embed>"; |
|
1130 | 1130 | } |
1131 | 1131 | else |
1132 | 1132 | { |
1133 | - $embed .= "<script type='text/javascript'>embed_flash('$bgcolor', '$width', '$height', '" . $this->get_link() . "', '$loop', '$type');</script>"; |
|
1133 | + $embed .= "<script type='text/javascript'>embed_flash('$bgcolor', '$width', '$height', '".$this->get_link()."', '$loop', '$type');</script>"; |
|
1134 | 1134 | } |
1135 | 1135 | } |
1136 | 1136 | |
@@ -1141,11 +1141,11 @@ discard block |
||
1141 | 1141 | $height += 20; |
1142 | 1142 | if ($native) |
1143 | 1143 | { |
1144 | - $embed .= "<embed src=\"$mediaplayer\" pluginspage=\"http://adobe.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" quality=\"high\" width=\"$width\" height=\"$height\" wmode=\"transparent\" flashvars=\"file=" . rawurlencode($this->get_link().'?file_extension=.'.$this->get_extension()) . "&autostart=false&repeat=$loop&showdigits=true&showfsbutton=false\"></embed>"; |
|
1144 | + $embed .= "<embed src=\"$mediaplayer\" pluginspage=\"http://adobe.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" quality=\"high\" width=\"$width\" height=\"$height\" wmode=\"transparent\" flashvars=\"file=".rawurlencode($this->get_link().'?file_extension=.'.$this->get_extension())."&autostart=false&repeat=$loop&showdigits=true&showfsbutton=false\"></embed>"; |
|
1145 | 1145 | } |
1146 | 1146 | else |
1147 | 1147 | { |
1148 | - $embed .= "<script type='text/javascript'>embed_flv('$width', '$height', '" . rawurlencode($this->get_link().'?file_extension=.'.$this->get_extension()) . "', '$placeholder', '$loop', '$mediaplayer');</script>"; |
|
1148 | + $embed .= "<script type='text/javascript'>embed_flv('$width', '$height', '".rawurlencode($this->get_link().'?file_extension=.'.$this->get_extension())."', '$placeholder', '$loop', '$mediaplayer');</script>"; |
|
1149 | 1149 | } |
1150 | 1150 | } |
1151 | 1151 | |
@@ -1158,16 +1158,16 @@ discard block |
||
1158 | 1158 | { |
1159 | 1159 | if ($placeholder !== '') |
1160 | 1160 | { |
1161 | - $embed .= "<embed type=\"$type\" style=\"cursor:hand; cursor:pointer;\" href=\"" . $this->get_link() . "\" src=\"$placeholder\" width=\"$width\" height=\"$height\" autoplay=\"false\" target=\"myself\" controller=\"false\" loop=\"$loop\" scale=\"aspect\" bgcolor=\"$bgcolor\" pluginspage=\"http://apple.com/quicktime/download/\"></embed>"; |
|
1161 | + $embed .= "<embed type=\"$type\" style=\"cursor:hand; cursor:pointer;\" href=\"".$this->get_link()."\" src=\"$placeholder\" width=\"$width\" height=\"$height\" autoplay=\"false\" target=\"myself\" controller=\"false\" loop=\"$loop\" scale=\"aspect\" bgcolor=\"$bgcolor\" pluginspage=\"http://apple.com/quicktime/download/\"></embed>"; |
|
1162 | 1162 | } |
1163 | 1163 | else |
1164 | 1164 | { |
1165 | - $embed .= "<embed type=\"$type\" style=\"cursor:hand; cursor:pointer;\" src=\"" . $this->get_link() . "\" width=\"$width\" height=\"$height\" autoplay=\"false\" target=\"myself\" controller=\"true\" loop=\"$loop\" scale=\"aspect\" bgcolor=\"$bgcolor\" pluginspage=\"http://apple.com/quicktime/download/\"></embed>"; |
|
1165 | + $embed .= "<embed type=\"$type\" style=\"cursor:hand; cursor:pointer;\" src=\"".$this->get_link()."\" width=\"$width\" height=\"$height\" autoplay=\"false\" target=\"myself\" controller=\"true\" loop=\"$loop\" scale=\"aspect\" bgcolor=\"$bgcolor\" pluginspage=\"http://apple.com/quicktime/download/\"></embed>"; |
|
1166 | 1166 | } |
1167 | 1167 | } |
1168 | 1168 | else |
1169 | 1169 | { |
1170 | - $embed .= "<script type='text/javascript'>embed_quicktime('$type', '$bgcolor', '$width', '$height', '" . $this->get_link() . "', '$placeholder', '$loop');</script>"; |
|
1170 | + $embed .= "<script type='text/javascript'>embed_quicktime('$type', '$bgcolor', '$width', '$height', '".$this->get_link()."', '$placeholder', '$loop');</script>"; |
|
1171 | 1171 | } |
1172 | 1172 | } |
1173 | 1173 | |
@@ -1177,16 +1177,16 @@ discard block |
||
1177 | 1177 | $height += 45; |
1178 | 1178 | if ($native) |
1179 | 1179 | { |
1180 | - $embed .= "<embed type=\"application/x-mplayer2\" src=\"" . $this->get_link() . "\" autosize=\"1\" width=\"$width\" height=\"$height\" showcontrols=\"1\" showstatusbar=\"0\" showdisplay=\"0\" autostart=\"0\"></embed>"; |
|
1180 | + $embed .= "<embed type=\"application/x-mplayer2\" src=\"".$this->get_link()."\" autosize=\"1\" width=\"$width\" height=\"$height\" showcontrols=\"1\" showstatusbar=\"0\" showdisplay=\"0\" autostart=\"0\"></embed>"; |
|
1181 | 1181 | } |
1182 | 1182 | else |
1183 | 1183 | { |
1184 | - $embed .= "<script type='text/javascript'>embed_wmedia('$width', '$height', '" . $this->get_link() . "');</script>"; |
|
1184 | + $embed .= "<script type='text/javascript'>embed_wmedia('$width', '$height', '".$this->get_link()."');</script>"; |
|
1185 | 1185 | } |
1186 | 1186 | } |
1187 | 1187 | |
1188 | 1188 | // Everything else |
1189 | - else $embed .= '<a href="' . $this->get_link() . '" class="' . $altclass . '">' . $alt . '</a>'; |
|
1189 | + else $embed .= '<a href="'.$this->get_link().'" class="'.$altclass.'">'.$alt.'</a>'; |
|
1190 | 1190 | |
1191 | 1191 | return $embed; |
1192 | 1192 | } |
@@ -1206,7 +1206,7 @@ discard block |
||
1206 | 1206 | { |
1207 | 1207 | // Mime-types by handler. |
1208 | 1208 | $types_flash = array('application/x-shockwave-flash', 'application/futuresplash'); // Flash |
1209 | - $types_fmedia = array('video/flv', 'video/x-flv','flv-application/octet-stream'); // Flash Media Player |
|
1209 | + $types_fmedia = array('video/flv', 'video/x-flv', 'flv-application/octet-stream'); // Flash Media Player |
|
1210 | 1210 | $types_quicktime = array('audio/3gpp', 'audio/3gpp2', 'audio/aac', 'audio/x-aac', 'audio/aiff', 'audio/x-aiff', 'audio/mid', 'audio/midi', 'audio/x-midi', 'audio/mp4', 'audio/m4a', 'audio/x-m4a', 'audio/wav', 'audio/x-wav', 'video/3gpp', 'video/3gpp2', 'video/m4v', 'video/x-m4v', 'video/mp4', 'video/mpeg', 'video/x-mpeg', 'video/quicktime', 'video/sd-video'); // QuickTime |
1211 | 1211 | $types_wmedia = array('application/asx', 'application/x-mplayer2', 'audio/x-ms-wma', 'audio/x-ms-wax', 'video/x-ms-asf-plugin', 'video/x-ms-asf', 'video/x-ms-wm', 'video/x-ms-wmv', 'video/x-ms-wvx'); // Windows Media |
1212 | 1212 | $types_mp3 = array('audio/mp3', 'audio/x-mp3', 'audio/mpeg', 'audio/x-mpeg'); // MP3 |
@@ -1221,7 +1221,7 @@ discard block |
||
1221 | 1221 | } |
1222 | 1222 | |
1223 | 1223 | // If we encounter an unsupported mime-type, check the file extension and guess intelligently. |
1224 | - if (!in_array($type, array_merge($types_flash, $types_fmedia, $types_quicktime, $types_wmedia, $types_mp3))) |
|
1224 | + if ( ! in_array($type, array_merge($types_flash, $types_fmedia, $types_quicktime, $types_wmedia, $types_mp3))) |
|
1225 | 1225 | { |
1226 | 1226 | switch (strtolower($this->get_extension())) |
1227 | 1227 | { |
@@ -282,8 +282,7 @@ discard block |
||
282 | 282 | if ($this->bitrate !== null) |
283 | 283 | { |
284 | 284 | return $this->bitrate; |
285 | - } |
|
286 | - else |
|
285 | + } else |
|
287 | 286 | { |
288 | 287 | return null; |
289 | 288 | } |
@@ -301,8 +300,7 @@ discard block |
||
301 | 300 | if (isset($captions[$key])) |
302 | 301 | { |
303 | 302 | return $captions[$key]; |
304 | - } |
|
305 | - else |
|
303 | + } else |
|
306 | 304 | { |
307 | 305 | return null; |
308 | 306 | } |
@@ -318,8 +316,7 @@ discard block |
||
318 | 316 | if ($this->captions !== null) |
319 | 317 | { |
320 | 318 | return $this->captions; |
321 | - } |
|
322 | - else |
|
319 | + } else |
|
323 | 320 | { |
324 | 321 | return null; |
325 | 322 | } |
@@ -337,8 +334,7 @@ discard block |
||
337 | 334 | if (isset($categories[$key])) |
338 | 335 | { |
339 | 336 | return $categories[$key]; |
340 | - } |
|
341 | - else |
|
337 | + } else |
|
342 | 338 | { |
343 | 339 | return null; |
344 | 340 | } |
@@ -354,8 +350,7 @@ discard block |
||
354 | 350 | if ($this->categories !== null) |
355 | 351 | { |
356 | 352 | return $this->categories; |
357 | - } |
|
358 | - else |
|
353 | + } else |
|
359 | 354 | { |
360 | 355 | return null; |
361 | 356 | } |
@@ -371,8 +366,7 @@ discard block |
||
371 | 366 | if ($this->channels !== null) |
372 | 367 | { |
373 | 368 | return $this->channels; |
374 | - } |
|
375 | - else |
|
369 | + } else |
|
376 | 370 | { |
377 | 371 | return null; |
378 | 372 | } |
@@ -388,8 +382,7 @@ discard block |
||
388 | 382 | if ($this->copyright !== null) |
389 | 383 | { |
390 | 384 | return $this->copyright; |
391 | - } |
|
392 | - else |
|
385 | + } else |
|
393 | 386 | { |
394 | 387 | return null; |
395 | 388 | } |
@@ -407,8 +400,7 @@ discard block |
||
407 | 400 | if (isset($credits[$key])) |
408 | 401 | { |
409 | 402 | return $credits[$key]; |
410 | - } |
|
411 | - else |
|
403 | + } else |
|
412 | 404 | { |
413 | 405 | return null; |
414 | 406 | } |
@@ -424,8 +416,7 @@ discard block |
||
424 | 416 | if ($this->credits !== null) |
425 | 417 | { |
426 | 418 | return $this->credits; |
427 | - } |
|
428 | - else |
|
419 | + } else |
|
429 | 420 | { |
430 | 421 | return null; |
431 | 422 | } |
@@ -441,8 +432,7 @@ discard block |
||
441 | 432 | if ($this->description !== null) |
442 | 433 | { |
443 | 434 | return $this->description; |
444 | - } |
|
445 | - else |
|
435 | + } else |
|
446 | 436 | { |
447 | 437 | return null; |
448 | 438 | } |
@@ -462,13 +452,11 @@ discard block |
||
462 | 452 | { |
463 | 453 | $time = SimplePie_Misc::time_hms($this->duration); |
464 | 454 | return $time; |
465 | - } |
|
466 | - else |
|
455 | + } else |
|
467 | 456 | { |
468 | 457 | return $this->duration; |
469 | 458 | } |
470 | - } |
|
471 | - else |
|
459 | + } else |
|
472 | 460 | { |
473 | 461 | return null; |
474 | 462 | } |
@@ -484,8 +472,7 @@ discard block |
||
484 | 472 | if ($this->expression !== null) |
485 | 473 | { |
486 | 474 | return $this->expression; |
487 | - } |
|
488 | - else |
|
475 | + } else |
|
489 | 476 | { |
490 | 477 | return 'full'; |
491 | 478 | } |
@@ -519,8 +506,7 @@ discard block |
||
519 | 506 | if ($this->framerate !== null) |
520 | 507 | { |
521 | 508 | return $this->framerate; |
522 | - } |
|
523 | - else |
|
509 | + } else |
|
524 | 510 | { |
525 | 511 | return null; |
526 | 512 | } |
@@ -549,8 +535,7 @@ discard block |
||
549 | 535 | if (isset($hashes[$key])) |
550 | 536 | { |
551 | 537 | return $hashes[$key]; |
552 | - } |
|
553 | - else |
|
538 | + } else |
|
554 | 539 | { |
555 | 540 | return null; |
556 | 541 | } |
@@ -566,8 +551,7 @@ discard block |
||
566 | 551 | if ($this->hashes !== null) |
567 | 552 | { |
568 | 553 | return $this->hashes; |
569 | - } |
|
570 | - else |
|
554 | + } else |
|
571 | 555 | { |
572 | 556 | return null; |
573 | 557 | } |
@@ -583,8 +567,7 @@ discard block |
||
583 | 567 | if ($this->height !== null) |
584 | 568 | { |
585 | 569 | return $this->height; |
586 | - } |
|
587 | - else |
|
570 | + } else |
|
588 | 571 | { |
589 | 572 | return null; |
590 | 573 | } |
@@ -601,8 +584,7 @@ discard block |
||
601 | 584 | if ($this->lang !== null) |
602 | 585 | { |
603 | 586 | return $this->lang; |
604 | - } |
|
605 | - else |
|
587 | + } else |
|
606 | 588 | { |
607 | 589 | return null; |
608 | 590 | } |
@@ -620,8 +602,7 @@ discard block |
||
620 | 602 | if (isset($keywords[$key])) |
621 | 603 | { |
622 | 604 | return $keywords[$key]; |
623 | - } |
|
624 | - else |
|
605 | + } else |
|
625 | 606 | { |
626 | 607 | return null; |
627 | 608 | } |
@@ -637,8 +618,7 @@ discard block |
||
637 | 618 | if ($this->keywords !== null) |
638 | 619 | { |
639 | 620 | return $this->keywords; |
640 | - } |
|
641 | - else |
|
621 | + } else |
|
642 | 622 | { |
643 | 623 | return null; |
644 | 624 | } |
@@ -654,8 +634,7 @@ discard block |
||
654 | 634 | if ($this->length !== null) |
655 | 635 | { |
656 | 636 | return $this->length; |
657 | - } |
|
658 | - else |
|
637 | + } else |
|
659 | 638 | { |
660 | 639 | return null; |
661 | 640 | } |
@@ -671,8 +650,7 @@ discard block |
||
671 | 650 | if ($this->link !== null) |
672 | 651 | { |
673 | 652 | return urldecode($this->link); |
674 | - } |
|
675 | - else |
|
653 | + } else |
|
676 | 654 | { |
677 | 655 | return null; |
678 | 656 | } |
@@ -689,8 +667,7 @@ discard block |
||
689 | 667 | if ($this->medium !== null) |
690 | 668 | { |
691 | 669 | return $this->medium; |
692 | - } |
|
693 | - else |
|
670 | + } else |
|
694 | 671 | { |
695 | 672 | return null; |
696 | 673 | } |
@@ -707,8 +684,7 @@ discard block |
||
707 | 684 | if ($this->player !== null) |
708 | 685 | { |
709 | 686 | return $this->player; |
710 | - } |
|
711 | - else |
|
687 | + } else |
|
712 | 688 | { |
713 | 689 | return null; |
714 | 690 | } |
@@ -726,8 +702,7 @@ discard block |
||
726 | 702 | if (isset($ratings[$key])) |
727 | 703 | { |
728 | 704 | return $ratings[$key]; |
729 | - } |
|
730 | - else |
|
705 | + } else |
|
731 | 706 | { |
732 | 707 | return null; |
733 | 708 | } |
@@ -743,8 +718,7 @@ discard block |
||
743 | 718 | if ($this->ratings !== null) |
744 | 719 | { |
745 | 720 | return $this->ratings; |
746 | - } |
|
747 | - else |
|
721 | + } else |
|
748 | 722 | { |
749 | 723 | return null; |
750 | 724 | } |
@@ -762,8 +736,7 @@ discard block |
||
762 | 736 | if (isset($restrictions[$key])) |
763 | 737 | { |
764 | 738 | return $restrictions[$key]; |
765 | - } |
|
766 | - else |
|
739 | + } else |
|
767 | 740 | { |
768 | 741 | return null; |
769 | 742 | } |
@@ -779,8 +752,7 @@ discard block |
||
779 | 752 | if ($this->restrictions !== null) |
780 | 753 | { |
781 | 754 | return $this->restrictions; |
782 | - } |
|
783 | - else |
|
755 | + } else |
|
784 | 756 | { |
785 | 757 | return null; |
786 | 758 | } |
@@ -796,8 +768,7 @@ discard block |
||
796 | 768 | if ($this->samplingrate !== null) |
797 | 769 | { |
798 | 770 | return $this->samplingrate; |
799 | - } |
|
800 | - else |
|
771 | + } else |
|
801 | 772 | { |
802 | 773 | return null; |
803 | 774 | } |
@@ -814,8 +785,7 @@ discard block |
||
814 | 785 | if ($length !== null) |
815 | 786 | { |
816 | 787 | return round($length/1048576, 2); |
817 | - } |
|
818 | - else |
|
788 | + } else |
|
819 | 789 | { |
820 | 790 | return null; |
821 | 791 | } |
@@ -833,8 +803,7 @@ discard block |
||
833 | 803 | if (isset($thumbnails[$key])) |
834 | 804 | { |
835 | 805 | return $thumbnails[$key]; |
836 | - } |
|
837 | - else |
|
806 | + } else |
|
838 | 807 | { |
839 | 808 | return null; |
840 | 809 | } |
@@ -850,8 +819,7 @@ discard block |
||
850 | 819 | if ($this->thumbnails !== null) |
851 | 820 | { |
852 | 821 | return $this->thumbnails; |
853 | - } |
|
854 | - else |
|
822 | + } else |
|
855 | 823 | { |
856 | 824 | return null; |
857 | 825 | } |
@@ -867,8 +835,7 @@ discard block |
||
867 | 835 | if ($this->title !== null) |
868 | 836 | { |
869 | 837 | return $this->title; |
870 | - } |
|
871 | - else |
|
838 | + } else |
|
872 | 839 | { |
873 | 840 | return null; |
874 | 841 | } |
@@ -885,8 +852,7 @@ discard block |
||
885 | 852 | if ($this->type !== null) |
886 | 853 | { |
887 | 854 | return $this->type; |
888 | - } |
|
889 | - else |
|
855 | + } else |
|
890 | 856 | { |
891 | 857 | return null; |
892 | 858 | } |
@@ -902,8 +868,7 @@ discard block |
||
902 | 868 | if ($this->width !== null) |
903 | 869 | { |
904 | 870 | return $this->width; |
905 | - } |
|
906 | - else |
|
871 | + } else |
|
907 | 872 | { |
908 | 873 | return null; |
909 | 874 | } |
@@ -987,8 +952,7 @@ discard block |
||
987 | 952 | if (is_array($options)) |
988 | 953 | { |
989 | 954 | extract($options); |
990 | - } |
|
991 | - else |
|
955 | + } else |
|
992 | 956 | { |
993 | 957 | $options = explode(',', $options); |
994 | 958 | foreach($options as $option) |
@@ -1055,17 +1019,14 @@ discard block |
||
1055 | 1019 | if ($height === 'auto') |
1056 | 1020 | { |
1057 | 1021 | $width = 480; |
1058 | - } |
|
1059 | - elseif ($widescreen) |
|
1022 | + } elseif ($widescreen) |
|
1060 | 1023 | { |
1061 | 1024 | $width = round((intval($height)/9)*16); |
1062 | - } |
|
1063 | - else |
|
1025 | + } else |
|
1064 | 1026 | { |
1065 | 1027 | $width = round((intval($height)/3)*4); |
1066 | 1028 | } |
1067 | - } |
|
1068 | - else |
|
1029 | + } else |
|
1069 | 1030 | { |
1070 | 1031 | $width = '100%'; |
1071 | 1032 | } |
@@ -1076,35 +1037,29 @@ discard block |
||
1076 | 1037 | if ($mime === 'audio') |
1077 | 1038 | { |
1078 | 1039 | $height = 0; |
1079 | - } |
|
1080 | - elseif ($mime === 'video') |
|
1040 | + } elseif ($mime === 'video') |
|
1081 | 1041 | { |
1082 | 1042 | if ($width === 'auto') |
1083 | 1043 | { |
1084 | 1044 | if ($widescreen) |
1085 | 1045 | { |
1086 | 1046 | $height = 270; |
1087 | - } |
|
1088 | - else |
|
1047 | + } else |
|
1089 | 1048 | { |
1090 | 1049 | $height = 360; |
1091 | 1050 | } |
1092 | - } |
|
1093 | - elseif ($widescreen) |
|
1051 | + } elseif ($widescreen) |
|
1094 | 1052 | { |
1095 | 1053 | $height = round((intval($width)/16)*9); |
1096 | - } |
|
1097 | - else |
|
1054 | + } else |
|
1098 | 1055 | { |
1099 | 1056 | $height = round((intval($width)/4)*3); |
1100 | 1057 | } |
1101 | - } |
|
1102 | - else |
|
1058 | + } else |
|
1103 | 1059 | { |
1104 | 1060 | $height = 376; |
1105 | 1061 | } |
1106 | - } |
|
1107 | - elseif ($mime === 'audio') |
|
1062 | + } elseif ($mime === 'audio') |
|
1108 | 1063 | { |
1109 | 1064 | $height = 0; |
1110 | 1065 | } |
@@ -1113,8 +1068,7 @@ discard block |
||
1113 | 1068 | if ($mime === 'audio') |
1114 | 1069 | { |
1115 | 1070 | $placeholder = $audio; |
1116 | - } |
|
1117 | - elseif ($mime === 'video') |
|
1071 | + } elseif ($mime === 'video') |
|
1118 | 1072 | { |
1119 | 1073 | $placeholder = $video; |
1120 | 1074 | } |
@@ -1127,8 +1081,7 @@ discard block |
||
1127 | 1081 | if ($native) |
1128 | 1082 | { |
1129 | 1083 | $embed .= "<embed src=\"" . $this->get_link() . "\" pluginspage=\"http://adobe.com/go/getflashplayer\" type=\"$type\" quality=\"high\" width=\"$width\" height=\"$height\" bgcolor=\"$bgcolor\" loop=\"$loop\"></embed>"; |
1130 | - } |
|
1131 | - else |
|
1084 | + } else |
|
1132 | 1085 | { |
1133 | 1086 | $embed .= "<script type='text/javascript'>embed_flash('$bgcolor', '$width', '$height', '" . $this->get_link() . "', '$loop', '$type');</script>"; |
1134 | 1087 | } |
@@ -1142,8 +1095,7 @@ discard block |
||
1142 | 1095 | if ($native) |
1143 | 1096 | { |
1144 | 1097 | $embed .= "<embed src=\"$mediaplayer\" pluginspage=\"http://adobe.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" quality=\"high\" width=\"$width\" height=\"$height\" wmode=\"transparent\" flashvars=\"file=" . rawurlencode($this->get_link().'?file_extension=.'.$this->get_extension()) . "&autostart=false&repeat=$loop&showdigits=true&showfsbutton=false\"></embed>"; |
1145 | - } |
|
1146 | - else |
|
1098 | + } else |
|
1147 | 1099 | { |
1148 | 1100 | $embed .= "<script type='text/javascript'>embed_flv('$width', '$height', '" . rawurlencode($this->get_link().'?file_extension=.'.$this->get_extension()) . "', '$placeholder', '$loop', '$mediaplayer');</script>"; |
1149 | 1101 | } |
@@ -1159,13 +1111,11 @@ discard block |
||
1159 | 1111 | if ($placeholder !== '') |
1160 | 1112 | { |
1161 | 1113 | $embed .= "<embed type=\"$type\" style=\"cursor:hand; cursor:pointer;\" href=\"" . $this->get_link() . "\" src=\"$placeholder\" width=\"$width\" height=\"$height\" autoplay=\"false\" target=\"myself\" controller=\"false\" loop=\"$loop\" scale=\"aspect\" bgcolor=\"$bgcolor\" pluginspage=\"http://apple.com/quicktime/download/\"></embed>"; |
1162 | - } |
|
1163 | - else |
|
1114 | + } else |
|
1164 | 1115 | { |
1165 | 1116 | $embed .= "<embed type=\"$type\" style=\"cursor:hand; cursor:pointer;\" src=\"" . $this->get_link() . "\" width=\"$width\" height=\"$height\" autoplay=\"false\" target=\"myself\" controller=\"true\" loop=\"$loop\" scale=\"aspect\" bgcolor=\"$bgcolor\" pluginspage=\"http://apple.com/quicktime/download/\"></embed>"; |
1166 | 1117 | } |
1167 | - } |
|
1168 | - else |
|
1118 | + } else |
|
1169 | 1119 | { |
1170 | 1120 | $embed .= "<script type='text/javascript'>embed_quicktime('$type', '$bgcolor', '$width', '$height', '" . $this->get_link() . "', '$placeholder', '$loop');</script>"; |
1171 | 1121 | } |
@@ -1178,15 +1128,16 @@ discard block |
||
1178 | 1128 | if ($native) |
1179 | 1129 | { |
1180 | 1130 | $embed .= "<embed type=\"application/x-mplayer2\" src=\"" . $this->get_link() . "\" autosize=\"1\" width=\"$width\" height=\"$height\" showcontrols=\"1\" showstatusbar=\"0\" showdisplay=\"0\" autostart=\"0\"></embed>"; |
1181 | - } |
|
1182 | - else |
|
1131 | + } else |
|
1183 | 1132 | { |
1184 | 1133 | $embed .= "<script type='text/javascript'>embed_wmedia('$width', '$height', '" . $this->get_link() . "');</script>"; |
1185 | 1134 | } |
1186 | 1135 | } |
1187 | 1136 | |
1188 | 1137 | // Everything else |
1189 | - else $embed .= '<a href="' . $this->get_link() . '" class="' . $altclass . '">' . $alt . '</a>'; |
|
1138 | + else { |
|
1139 | + $embed .= '<a href="' . $this->get_link() . '" class="' . $altclass . '">' . $alt . '</a>'; |
|
1140 | + } |
|
1190 | 1141 | |
1191 | 1142 | return $embed; |
1192 | 1143 | } |
@@ -1214,8 +1165,7 @@ discard block |
||
1214 | 1165 | if ($this->get_type() !== null) |
1215 | 1166 | { |
1216 | 1167 | $type = strtolower($this->type); |
1217 | - } |
|
1218 | - else |
|
1168 | + } else |
|
1219 | 1169 | { |
1220 | 1170 | $type = null; |
1221 | 1171 | } |
@@ -1349,29 +1299,23 @@ discard block |
||
1349 | 1299 | if (in_array($type, $types_flash)) |
1350 | 1300 | { |
1351 | 1301 | return 'flash'; |
1352 | - } |
|
1353 | - elseif (in_array($type, $types_fmedia)) |
|
1302 | + } elseif (in_array($type, $types_fmedia)) |
|
1354 | 1303 | { |
1355 | 1304 | return 'fmedia'; |
1356 | - } |
|
1357 | - elseif (in_array($type, $types_quicktime)) |
|
1305 | + } elseif (in_array($type, $types_quicktime)) |
|
1358 | 1306 | { |
1359 | 1307 | return 'quicktime'; |
1360 | - } |
|
1361 | - elseif (in_array($type, $types_wmedia)) |
|
1308 | + } elseif (in_array($type, $types_wmedia)) |
|
1362 | 1309 | { |
1363 | 1310 | return 'wmedia'; |
1364 | - } |
|
1365 | - elseif (in_array($type, $types_mp3)) |
|
1311 | + } elseif (in_array($type, $types_mp3)) |
|
1366 | 1312 | { |
1367 | 1313 | return 'mp3'; |
1368 | - } |
|
1369 | - else |
|
1314 | + } else |
|
1370 | 1315 | { |
1371 | 1316 | return null; |
1372 | 1317 | } |
1373 | - } |
|
1374 | - else |
|
1318 | + } else |
|
1375 | 1319 | { |
1376 | 1320 | return $type; |
1377 | 1321 | } |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | * |
265 | 265 | * Returns false if $base is not absolute, otherwise an IRI. |
266 | 266 | * |
267 | - * @param IRI|string $base (Absolute) Base IRI |
|
267 | + * @param SimplePie_IRI $base (Absolute) Base IRI |
|
268 | 268 | * @param IRI|string $relative Relative IRI |
269 | 269 | * @return IRI|false |
270 | 270 | */ |
@@ -1119,6 +1119,7 @@ discard block |
||
1119 | 1119 | /** |
1120 | 1120 | * Convert an IRI to a URI (or parts thereof) |
1121 | 1121 | * |
1122 | + * @param false|string $string |
|
1122 | 1123 | * @return string |
1123 | 1124 | */ |
1124 | 1125 | public function to_uri($string) |
@@ -148,9 +148,9 @@ discard block |
||
148 | 148 | */ |
149 | 149 | public function __set($name, $value) |
150 | 150 | { |
151 | - if (method_exists($this, 'set_' . $name)) |
|
151 | + if (method_exists($this, 'set_'.$name)) |
|
152 | 152 | { |
153 | - call_user_func(array($this, 'set_' . $name), $value); |
|
153 | + call_user_func(array($this, 'set_'.$name), $value); |
|
154 | 154 | } |
155 | 155 | elseif ( |
156 | 156 | $name === 'iauthority' |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | || $name === 'ifragment' |
162 | 162 | ) |
163 | 163 | { |
164 | - call_user_func(array($this, 'set_' . substr($name, 1)), $value); |
|
164 | + call_user_func(array($this, 'set_'.substr($name, 1)), $value); |
|
165 | 165 | } |
166 | 166 | } |
167 | 167 | |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | $return = $this->$name; |
192 | 192 | } |
193 | 193 | // host -> ihost |
194 | - elseif (($prop = 'i' . $name) && array_key_exists($prop, $props)) |
|
194 | + elseif (($prop = 'i'.$name) && array_key_exists($prop, $props)) |
|
195 | 195 | { |
196 | 196 | $name = $prop; |
197 | 197 | $return = $this->$prop; |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | } |
205 | 205 | else |
206 | 206 | { |
207 | - trigger_error('Undefined property: ' . get_class($this) . '::' . $name, E_USER_NOTICE); |
|
207 | + trigger_error('Undefined property: '.get_class($this).'::'.$name, E_USER_NOTICE); |
|
208 | 208 | $return = null; |
209 | 209 | } |
210 | 210 | |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | */ |
227 | 227 | public function __isset($name) |
228 | 228 | { |
229 | - if (method_exists($this, 'get_' . $name) || isset($this->$name)) |
|
229 | + if (method_exists($this, 'get_'.$name) || isset($this->$name)) |
|
230 | 230 | { |
231 | 231 | return true; |
232 | 232 | } |
@@ -243,9 +243,9 @@ discard block |
||
243 | 243 | */ |
244 | 244 | public function __unset($name) |
245 | 245 | { |
246 | - if (method_exists($this, 'set_' . $name)) |
|
246 | + if (method_exists($this, 'set_'.$name)) |
|
247 | 247 | { |
248 | - call_user_func(array($this, 'set_' . $name), ''); |
|
248 | + call_user_func(array($this, 'set_'.$name), ''); |
|
249 | 249 | } |
250 | 250 | } |
251 | 251 | |
@@ -270,11 +270,11 @@ discard block |
||
270 | 270 | */ |
271 | 271 | public static function absolutize($base, $relative) |
272 | 272 | { |
273 | - if (!($relative instanceof SimplePie_IRI)) |
|
273 | + if ( ! ($relative instanceof SimplePie_IRI)) |
|
274 | 274 | { |
275 | 275 | $relative = new SimplePie_IRI($relative); |
276 | 276 | } |
277 | - if (!$relative->is_valid()) |
|
277 | + if ( ! $relative->is_valid()) |
|
278 | 278 | { |
279 | 279 | return false; |
280 | 280 | } |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | } |
285 | 285 | else |
286 | 286 | { |
287 | - if (!($base instanceof SimplePie_IRI)) |
|
287 | + if ( ! ($base instanceof SimplePie_IRI)) |
|
288 | 288 | { |
289 | 289 | $base = new SimplePie_IRI($base); |
290 | 290 | } |
@@ -312,11 +312,11 @@ discard block |
||
312 | 312 | } |
313 | 313 | elseif (($base->iuserinfo !== null || $base->ihost !== null || $base->port !== null) && $base->ipath === '') |
314 | 314 | { |
315 | - $target->ipath = '/' . $relative->ipath; |
|
315 | + $target->ipath = '/'.$relative->ipath; |
|
316 | 316 | } |
317 | 317 | elseif (($last_segment = strrpos($base->ipath, '/')) !== false) |
318 | 318 | { |
319 | - $target->ipath = substr($base->ipath, 0, $last_segment + 1) . $relative->ipath; |
|
319 | + $target->ipath = substr($base->ipath, 0, $last_segment + 1).$relative->ipath; |
|
320 | 320 | } |
321 | 321 | else |
322 | 322 | { |
@@ -370,19 +370,19 @@ discard block |
||
370 | 370 | { |
371 | 371 | $match['scheme'] = null; |
372 | 372 | } |
373 | - if (!isset($match[3]) || $match[3] === '') |
|
373 | + if ( ! isset($match[3]) || $match[3] === '') |
|
374 | 374 | { |
375 | 375 | $match['authority'] = null; |
376 | 376 | } |
377 | - if (!isset($match[5])) |
|
377 | + if ( ! isset($match[5])) |
|
378 | 378 | { |
379 | 379 | $match['path'] = ''; |
380 | 380 | } |
381 | - if (!isset($match[6]) || $match[6] === '') |
|
381 | + if ( ! isset($match[6]) || $match[6] === '') |
|
382 | 382 | { |
383 | 383 | $match['query'] = null; |
384 | 384 | } |
385 | - if (!isset($match[8]) || $match[8] === '') |
|
385 | + if ( ! isset($match[8]) || $match[8] === '') |
|
386 | 386 | { |
387 | 387 | $match['fragment'] = null; |
388 | 388 | } |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | $input = ''; |
453 | 453 | } |
454 | 454 | } |
455 | - return $output . $input; |
|
455 | + return $output.$input; |
|
456 | 456 | } |
457 | 457 | |
458 | 458 | /** |
@@ -551,7 +551,7 @@ discard block |
||
551 | 551 | // Percent encode anything invalid or not in ucschar |
552 | 552 | if ( |
553 | 553 | // Invalid sequences |
554 | - !$valid |
|
554 | + ! $valid |
|
555 | 555 | // Non-shortest form sequences are invalid |
556 | 556 | || $length > 1 && $character <= 0x7F |
557 | 557 | || $length > 2 && $character <= 0x7FF |
@@ -568,7 +568,7 @@ discard block |
||
568 | 568 | ) |
569 | 569 | && ( |
570 | 570 | // Everything not in iprivate, if it applies |
571 | - !$iprivate |
|
571 | + ! $iprivate |
|
572 | 572 | || $character < 0xE000 |
573 | 573 | || $character > 0x10FFFD |
574 | 574 | ) |
@@ -618,7 +618,7 @@ discard block |
||
618 | 618 | $value = hexdec($bytes[$i]); |
619 | 619 | |
620 | 620 | // If we're the first byte of sequence: |
621 | - if (!$remaining) |
|
621 | + if ( ! $remaining) |
|
622 | 622 | { |
623 | 623 | // Start position |
624 | 624 | $start = $i; |
@@ -679,12 +679,12 @@ discard block |
||
679 | 679 | } |
680 | 680 | |
681 | 681 | // If we've reached the end of the current byte sequence, append it to Unicode::$data |
682 | - if (!$remaining) |
|
682 | + if ( ! $remaining) |
|
683 | 683 | { |
684 | 684 | // Percent encode anything invalid or not in iunreserved |
685 | 685 | if ( |
686 | 686 | // Invalid sequences |
687 | - !$valid |
|
687 | + ! $valid |
|
688 | 688 | // Non-shortest form sequences are invalid |
689 | 689 | || $length > 1 && $character <= 0x7F |
690 | 690 | || $length > 2 && $character <= 0x7FF |
@@ -706,7 +706,7 @@ discard block |
||
706 | 706 | { |
707 | 707 | for ($j = $start; $j <= $i; $j++) |
708 | 708 | { |
709 | - $string .= '%' . strtoupper($bytes[$j]); |
|
709 | + $string .= '%'.strtoupper($bytes[$j]); |
|
710 | 710 | } |
711 | 711 | } |
712 | 712 | else |
@@ -725,7 +725,7 @@ discard block |
||
725 | 725 | { |
726 | 726 | for ($j = $start; $j < $len; $j++) |
727 | 727 | { |
728 | - $string .= '%' . strtoupper($bytes[$j]); |
|
728 | + $string .= '%'.strtoupper($bytes[$j]); |
|
729 | 729 | } |
730 | 730 | } |
731 | 731 | |
@@ -777,7 +777,7 @@ discard block |
||
777 | 777 | ) || |
778 | 778 | ( |
779 | 779 | $this->scheme === null && |
780 | - !$isauthority && |
|
780 | + ! $isauthority && |
|
781 | 781 | strpos($this->ipath, ':') !== false && |
782 | 782 | (strpos($this->ipath, '/') === false ? true : strpos($this->ipath, ':') < strpos($this->ipath, '/')) |
783 | 783 | ) |
@@ -800,7 +800,7 @@ discard block |
||
800 | 800 | public function set_iri($iri) |
801 | 801 | { |
802 | 802 | static $cache; |
803 | - if (!$cache) |
|
803 | + if ( ! $cache) |
|
804 | 804 | { |
805 | 805 | $cache = array(); |
806 | 806 | } |
@@ -824,7 +824,7 @@ discard block |
||
824 | 824 | else |
825 | 825 | { |
826 | 826 | $parsed = $this->parse_iri((string) $iri); |
827 | - if (!$parsed) |
|
827 | + if ( ! $parsed) |
|
828 | 828 | { |
829 | 829 | return false; |
830 | 830 | } |
@@ -860,7 +860,7 @@ discard block |
||
860 | 860 | { |
861 | 861 | $this->scheme = null; |
862 | 862 | } |
863 | - elseif (!preg_match('/^[A-Za-z][0-9A-Za-z+\-.]*$/', $scheme)) |
|
863 | + elseif ( ! preg_match('/^[A-Za-z][0-9A-Za-z+\-.]*$/', $scheme)) |
|
864 | 864 | { |
865 | 865 | $this->scheme = null; |
866 | 866 | return false; |
@@ -882,7 +882,7 @@ discard block |
||
882 | 882 | public function set_authority($authority) |
883 | 883 | { |
884 | 884 | static $cache; |
885 | - if (!$cache) |
|
885 | + if ( ! $cache) |
|
886 | 886 | $cache = array(); |
887 | 887 | |
888 | 888 | if ($authority === null) |
@@ -978,7 +978,7 @@ discard block |
||
978 | 978 | { |
979 | 979 | if (SimplePie_Net_IPv6::check_ipv6(substr($ihost, 1, -1))) |
980 | 980 | { |
981 | - $this->ihost = '[' . SimplePie_Net_IPv6::compress(substr($ihost, 1, -1)) . ']'; |
|
981 | + $this->ihost = '['.SimplePie_Net_IPv6::compress(substr($ihost, 1, -1)).']'; |
|
982 | 982 | } |
983 | 983 | else |
984 | 984 | { |
@@ -1052,7 +1052,7 @@ discard block |
||
1052 | 1052 | public function set_path($ipath) |
1053 | 1053 | { |
1054 | 1054 | static $cache; |
1055 | - if (!$cache) |
|
1055 | + if ( ! $cache) |
|
1056 | 1056 | { |
1057 | 1057 | $cache = array(); |
1058 | 1058 | } |
@@ -1069,7 +1069,7 @@ discard block |
||
1069 | 1069 | $removed = $this->remove_dot_segments($valid); |
1070 | 1070 | |
1071 | 1071 | $cache[$ipath] = array($valid, $removed); |
1072 | - $this->ipath = ($this->scheme !== null) ? $removed : $valid; |
|
1072 | + $this->ipath = ($this->scheme !== null) ? $removed : $valid; |
|
1073 | 1073 | } |
1074 | 1074 | |
1075 | 1075 | $this->scheme_normalization(); |
@@ -1124,7 +1124,7 @@ discard block |
||
1124 | 1124 | public function to_uri($string) |
1125 | 1125 | { |
1126 | 1126 | static $non_ascii; |
1127 | - if (!$non_ascii) |
|
1127 | + if ( ! $non_ascii) |
|
1128 | 1128 | { |
1129 | 1129 | $non_ascii = implode('', range("\x80", "\xFF")); |
1130 | 1130 | } |
@@ -1148,7 +1148,7 @@ discard block |
||
1148 | 1148 | */ |
1149 | 1149 | public function get_iri() |
1150 | 1150 | { |
1151 | - if (!$this->is_valid()) |
|
1151 | + if ( ! $this->is_valid()) |
|
1152 | 1152 | { |
1153 | 1153 | return false; |
1154 | 1154 | } |
@@ -1156,27 +1156,27 @@ discard block |
||
1156 | 1156 | $iri = ''; |
1157 | 1157 | if ($this->scheme !== null) |
1158 | 1158 | { |
1159 | - $iri .= $this->scheme . ':'; |
|
1159 | + $iri .= $this->scheme.':'; |
|
1160 | 1160 | } |
1161 | 1161 | if (($iauthority = $this->get_iauthority()) !== null) |
1162 | 1162 | { |
1163 | - $iri .= '//' . $iauthority; |
|
1163 | + $iri .= '//'.$iauthority; |
|
1164 | 1164 | } |
1165 | 1165 | if ($this->ipath !== '') |
1166 | 1166 | { |
1167 | 1167 | $iri .= $this->ipath; |
1168 | 1168 | } |
1169 | - elseif (!empty($this->normalization[$this->scheme]['ipath']) && $iauthority !== null && $iauthority !== '') |
|
1169 | + elseif ( ! empty($this->normalization[$this->scheme]['ipath']) && $iauthority !== null && $iauthority !== '') |
|
1170 | 1170 | { |
1171 | 1171 | $iri .= $this->normalization[$this->scheme]['ipath']; |
1172 | 1172 | } |
1173 | 1173 | if ($this->iquery !== null) |
1174 | 1174 | { |
1175 | - $iri .= '?' . $this->iquery; |
|
1175 | + $iri .= '?'.$this->iquery; |
|
1176 | 1176 | } |
1177 | 1177 | if ($this->ifragment !== null) |
1178 | 1178 | { |
1179 | - $iri .= '#' . $this->ifragment; |
|
1179 | + $iri .= '#'.$this->ifragment; |
|
1180 | 1180 | } |
1181 | 1181 | |
1182 | 1182 | return $iri; |
@@ -1204,7 +1204,7 @@ discard block |
||
1204 | 1204 | $iauthority = ''; |
1205 | 1205 | if ($this->iuserinfo !== null) |
1206 | 1206 | { |
1207 | - $iauthority .= $this->iuserinfo . '@'; |
|
1207 | + $iauthority .= $this->iuserinfo.'@'; |
|
1208 | 1208 | } |
1209 | 1209 | if ($this->ihost !== null) |
1210 | 1210 | { |
@@ -1212,7 +1212,7 @@ discard block |
||
1212 | 1212 | } |
1213 | 1213 | if ($this->port !== null) |
1214 | 1214 | { |
1215 | - $iauthority .= ':' . $this->port; |
|
1215 | + $iauthority .= ':'.$this->port; |
|
1216 | 1216 | } |
1217 | 1217 | return $iauthority; |
1218 | 1218 | } |
@@ -151,8 +151,7 @@ discard block |
||
151 | 151 | if (method_exists($this, 'set_' . $name)) |
152 | 152 | { |
153 | 153 | call_user_func(array($this, 'set_' . $name), $value); |
154 | - } |
|
155 | - elseif ( |
|
154 | + } elseif ( |
|
156 | 155 | $name === 'iauthority' |
157 | 156 | || $name === 'iuserinfo' |
158 | 157 | || $name === 'ihost' |
@@ -185,8 +184,7 @@ discard block |
||
185 | 184 | ) |
186 | 185 | { |
187 | 186 | $return = $this->{"get_$name"}(); |
188 | - } |
|
189 | - elseif (array_key_exists($name, $props)) |
|
187 | + } elseif (array_key_exists($name, $props)) |
|
190 | 188 | { |
191 | 189 | $return = $this->$name; |
192 | 190 | } |
@@ -201,8 +199,7 @@ discard block |
||
201 | 199 | { |
202 | 200 | $name = $prop; |
203 | 201 | $return = $this->$prop; |
204 | - } |
|
205 | - else |
|
202 | + } else |
|
206 | 203 | { |
207 | 204 | trigger_error('Undefined property: ' . get_class($this) . '::' . $name, E_USER_NOTICE); |
208 | 205 | $return = null; |
@@ -211,8 +208,7 @@ discard block |
||
211 | 208 | if ($return === null && isset($this->normalization[$this->scheme][$name])) |
212 | 209 | { |
213 | 210 | return $this->normalization[$this->scheme][$name]; |
214 | - } |
|
215 | - else |
|
211 | + } else |
|
216 | 212 | { |
217 | 213 | return $return; |
218 | 214 | } |
@@ -229,8 +225,7 @@ discard block |
||
229 | 225 | if (method_exists($this, 'get_' . $name) || isset($this->$name)) |
230 | 226 | { |
231 | 227 | return true; |
232 | - } |
|
233 | - else |
|
228 | + } else |
|
234 | 229 | { |
235 | 230 | return false; |
236 | 231 | } |
@@ -277,12 +272,10 @@ discard block |
||
277 | 272 | if (!$relative->is_valid()) |
278 | 273 | { |
279 | 274 | return false; |
280 | - } |
|
281 | - elseif ($relative->scheme !== null) |
|
275 | + } elseif ($relative->scheme !== null) |
|
282 | 276 | { |
283 | 277 | return clone $relative; |
284 | - } |
|
285 | - else |
|
278 | + } else |
|
286 | 279 | { |
287 | 280 | if (!($base instanceof SimplePie_IRI)) |
288 | 281 | { |
@@ -296,8 +289,7 @@ discard block |
||
296 | 289 | { |
297 | 290 | $target = clone $relative; |
298 | 291 | $target->scheme = $base->scheme; |
299 | - } |
|
300 | - else |
|
292 | + } else |
|
301 | 293 | { |
302 | 294 | $target = new SimplePie_IRI; |
303 | 295 | $target->scheme = $base->scheme; |
@@ -309,46 +301,39 @@ discard block |
||
309 | 301 | if ($relative->ipath[0] === '/') |
310 | 302 | { |
311 | 303 | $target->ipath = $relative->ipath; |
312 | - } |
|
313 | - elseif (($base->iuserinfo !== null || $base->ihost !== null || $base->port !== null) && $base->ipath === '') |
|
304 | + } elseif (($base->iuserinfo !== null || $base->ihost !== null || $base->port !== null) && $base->ipath === '') |
|
314 | 305 | { |
315 | 306 | $target->ipath = '/' . $relative->ipath; |
316 | - } |
|
317 | - elseif (($last_segment = strrpos($base->ipath, '/')) !== false) |
|
307 | + } elseif (($last_segment = strrpos($base->ipath, '/')) !== false) |
|
318 | 308 | { |
319 | 309 | $target->ipath = substr($base->ipath, 0, $last_segment + 1) . $relative->ipath; |
320 | - } |
|
321 | - else |
|
310 | + } else |
|
322 | 311 | { |
323 | 312 | $target->ipath = $relative->ipath; |
324 | 313 | } |
325 | 314 | $target->ipath = $target->remove_dot_segments($target->ipath); |
326 | 315 | $target->iquery = $relative->iquery; |
327 | - } |
|
328 | - else |
|
316 | + } else |
|
329 | 317 | { |
330 | 318 | $target->ipath = $base->ipath; |
331 | 319 | if ($relative->iquery !== null) |
332 | 320 | { |
333 | 321 | $target->iquery = $relative->iquery; |
334 | - } |
|
335 | - elseif ($base->iquery !== null) |
|
322 | + } elseif ($base->iquery !== null) |
|
336 | 323 | { |
337 | 324 | $target->iquery = $base->iquery; |
338 | 325 | } |
339 | 326 | } |
340 | 327 | $target->ifragment = $relative->ifragment; |
341 | 328 | } |
342 | - } |
|
343 | - else |
|
329 | + } else |
|
344 | 330 | { |
345 | 331 | $target = clone $base; |
346 | 332 | $target->ifragment = null; |
347 | 333 | } |
348 | 334 | $target->scheme_normalization(); |
349 | 335 | return $target; |
350 | - } |
|
351 | - else |
|
336 | + } else |
|
352 | 337 | { |
353 | 338 | return false; |
354 | 339 | } |
@@ -387,8 +372,7 @@ discard block |
||
387 | 372 | $match['fragment'] = null; |
388 | 373 | } |
389 | 374 | return $match; |
390 | - } |
|
391 | - else |
|
375 | + } else |
|
392 | 376 | { |
393 | 377 | // This can occur when a paragraph is accidentally parsed as a URI |
394 | 378 | return false; |
@@ -410,8 +394,7 @@ discard block |
||
410 | 394 | if (strpos($input, '../') === 0) |
411 | 395 | { |
412 | 396 | $input = substr($input, 3); |
413 | - } |
|
414 | - elseif (strpos($input, './') === 0) |
|
397 | + } elseif (strpos($input, './') === 0) |
|
415 | 398 | { |
416 | 399 | $input = substr($input, 2); |
417 | 400 | } |
@@ -419,8 +402,7 @@ discard block |
||
419 | 402 | elseif (strpos($input, '/./') === 0) |
420 | 403 | { |
421 | 404 | $input = substr($input, 2); |
422 | - } |
|
423 | - elseif ($input === '/.') |
|
405 | + } elseif ($input === '/.') |
|
424 | 406 | { |
425 | 407 | $input = '/'; |
426 | 408 | } |
@@ -429,8 +411,7 @@ discard block |
||
429 | 411 | { |
430 | 412 | $input = substr($input, 3); |
431 | 413 | $output = substr_replace($output, '', strrpos($output, '/')); |
432 | - } |
|
433 | - elseif ($input === '/..') |
|
414 | + } elseif ($input === '/..') |
|
434 | 415 | { |
435 | 416 | $input = '/'; |
436 | 417 | $output = substr_replace($output, '', strrpos($output, '/')); |
@@ -445,8 +426,7 @@ discard block |
||
445 | 426 | { |
446 | 427 | $output .= substr($input, 0, $pos); |
447 | 428 | $input = substr_replace($input, '', 0, $pos); |
448 | - } |
|
449 | - else |
|
429 | + } else |
|
450 | 430 | { |
451 | 431 | $output .= $input; |
452 | 432 | $input = ''; |
@@ -540,8 +520,7 @@ discard block |
||
540 | 520 | break; |
541 | 521 | } |
542 | 522 | } |
543 | - } |
|
544 | - else |
|
523 | + } else |
|
545 | 524 | { |
546 | 525 | $position = $strlen - 1; |
547 | 526 | $valid = false; |
@@ -575,8 +554,9 @@ discard block |
||
575 | 554 | ) |
576 | 555 | { |
577 | 556 | // If we were a character, pretend we weren't, but rather an error. |
578 | - if ($valid) |
|
579 | - $position--; |
|
557 | + if ($valid) { |
|
558 | + $position--; |
|
559 | + } |
|
580 | 560 | |
581 | 561 | for ($j = $start; $j <= $position; $j++) |
582 | 562 | { |
@@ -708,8 +688,7 @@ discard block |
||
708 | 688 | { |
709 | 689 | $string .= '%' . strtoupper($bytes[$j]); |
710 | 690 | } |
711 | - } |
|
712 | - else |
|
691 | + } else |
|
713 | 692 | { |
714 | 693 | for ($j = $start; $j <= $i; $j++) |
715 | 694 | { |
@@ -808,8 +787,7 @@ discard block |
||
808 | 787 | if ($iri === null) |
809 | 788 | { |
810 | 789 | return true; |
811 | - } |
|
812 | - elseif (isset($cache[$iri])) |
|
790 | + } elseif (isset($cache[$iri])) |
|
813 | 791 | { |
814 | 792 | list($this->scheme, |
815 | 793 | $this->iuserinfo, |
@@ -820,8 +798,7 @@ discard block |
||
820 | 798 | $this->ifragment, |
821 | 799 | $return) = $cache[$iri]; |
822 | 800 | return $return; |
823 | - } |
|
824 | - else |
|
801 | + } else |
|
825 | 802 | { |
826 | 803 | $parsed = $this->parse_iri((string) $iri); |
827 | 804 | if (!$parsed) |
@@ -859,13 +836,11 @@ discard block |
||
859 | 836 | if ($scheme === null) |
860 | 837 | { |
861 | 838 | $this->scheme = null; |
862 | - } |
|
863 | - elseif (!preg_match('/^[A-Za-z][0-9A-Za-z+\-.]*$/', $scheme)) |
|
839 | + } elseif (!preg_match('/^[A-Za-z][0-9A-Za-z+\-.]*$/', $scheme)) |
|
864 | 840 | { |
865 | 841 | $this->scheme = null; |
866 | 842 | return false; |
867 | - } |
|
868 | - else |
|
843 | + } else |
|
869 | 844 | { |
870 | 845 | $this->scheme = strtolower($scheme); |
871 | 846 | } |
@@ -882,8 +857,9 @@ discard block |
||
882 | 857 | public function set_authority($authority) |
883 | 858 | { |
884 | 859 | static $cache; |
885 | - if (!$cache) |
|
886 | - $cache = array(); |
|
860 | + if (!$cache) { |
|
861 | + $cache = array(); |
|
862 | + } |
|
887 | 863 | |
888 | 864 | if ($authority === null) |
889 | 865 | { |
@@ -891,8 +867,7 @@ discard block |
||
891 | 867 | $this->ihost = null; |
892 | 868 | $this->port = null; |
893 | 869 | return true; |
894 | - } |
|
895 | - elseif (isset($cache[$authority])) |
|
870 | + } elseif (isset($cache[$authority])) |
|
896 | 871 | { |
897 | 872 | list($this->iuserinfo, |
898 | 873 | $this->ihost, |
@@ -900,16 +875,14 @@ discard block |
||
900 | 875 | $return) = $cache[$authority]; |
901 | 876 | |
902 | 877 | return $return; |
903 | - } |
|
904 | - else |
|
878 | + } else |
|
905 | 879 | { |
906 | 880 | $remaining = $authority; |
907 | 881 | if (($iuserinfo_end = strrpos($remaining, '@')) !== false) |
908 | 882 | { |
909 | 883 | $iuserinfo = substr($remaining, 0, $iuserinfo_end); |
910 | 884 | $remaining = substr($remaining, $iuserinfo_end + 1); |
911 | - } |
|
912 | - else |
|
885 | + } else |
|
913 | 886 | { |
914 | 887 | $iuserinfo = null; |
915 | 888 | } |
@@ -920,8 +893,7 @@ discard block |
||
920 | 893 | $port = null; |
921 | 894 | } |
922 | 895 | $remaining = substr($remaining, 0, $port_start); |
923 | - } |
|
924 | - else |
|
896 | + } else |
|
925 | 897 | { |
926 | 898 | $port = null; |
927 | 899 | } |
@@ -950,8 +922,7 @@ discard block |
||
950 | 922 | if ($iuserinfo === null) |
951 | 923 | { |
952 | 924 | $this->iuserinfo = null; |
953 | - } |
|
954 | - else |
|
925 | + } else |
|
955 | 926 | { |
956 | 927 | $this->iuserinfo = $this->replace_invalid_with_pct_encoding($iuserinfo, '!$&\'()*+,;=:'); |
957 | 928 | $this->scheme_normalization(); |
@@ -973,20 +944,17 @@ discard block |
||
973 | 944 | { |
974 | 945 | $this->ihost = null; |
975 | 946 | return true; |
976 | - } |
|
977 | - elseif (substr($ihost, 0, 1) === '[' && substr($ihost, -1) === ']') |
|
947 | + } elseif (substr($ihost, 0, 1) === '[' && substr($ihost, -1) === ']') |
|
978 | 948 | { |
979 | 949 | if (SimplePie_Net_IPv6::check_ipv6(substr($ihost, 1, -1))) |
980 | 950 | { |
981 | 951 | $this->ihost = '[' . SimplePie_Net_IPv6::compress(substr($ihost, 1, -1)) . ']'; |
982 | - } |
|
983 | - else |
|
952 | + } else |
|
984 | 953 | { |
985 | 954 | $this->ihost = null; |
986 | 955 | return false; |
987 | 956 | } |
988 | - } |
|
989 | - else |
|
957 | + } else |
|
990 | 958 | { |
991 | 959 | $ihost = $this->replace_invalid_with_pct_encoding($ihost, '!$&\'()*+,;='); |
992 | 960 | |
@@ -1000,8 +968,7 @@ discard block |
||
1000 | 968 | if ($ihost[$position] === '%') |
1001 | 969 | { |
1002 | 970 | $position += 3; |
1003 | - } |
|
1004 | - else |
|
971 | + } else |
|
1005 | 972 | { |
1006 | 973 | $ihost[$position] = strtolower($ihost[$position]); |
1007 | 974 | $position++; |
@@ -1029,14 +996,12 @@ discard block |
||
1029 | 996 | { |
1030 | 997 | $this->port = null; |
1031 | 998 | return true; |
1032 | - } |
|
1033 | - elseif (strspn($port, '0123456789') === strlen($port)) |
|
999 | + } elseif (strspn($port, '0123456789') === strlen($port)) |
|
1034 | 1000 | { |
1035 | 1001 | $this->port = (int) $port; |
1036 | 1002 | $this->scheme_normalization(); |
1037 | 1003 | return true; |
1038 | - } |
|
1039 | - else |
|
1004 | + } else |
|
1040 | 1005 | { |
1041 | 1006 | $this->port = null; |
1042 | 1007 | return false; |
@@ -1062,8 +1027,7 @@ discard block |
||
1062 | 1027 | if (isset($cache[$ipath])) |
1063 | 1028 | { |
1064 | 1029 | $this->ipath = $cache[$ipath][(int) ($this->scheme !== null)]; |
1065 | - } |
|
1066 | - else |
|
1030 | + } else |
|
1067 | 1031 | { |
1068 | 1032 | $valid = $this->replace_invalid_with_pct_encoding($ipath, '!$&\'()*+,;=@:/'); |
1069 | 1033 | $removed = $this->remove_dot_segments($valid); |
@@ -1087,8 +1051,7 @@ discard block |
||
1087 | 1051 | if ($iquery === null) |
1088 | 1052 | { |
1089 | 1053 | $this->iquery = null; |
1090 | - } |
|
1091 | - else |
|
1054 | + } else |
|
1092 | 1055 | { |
1093 | 1056 | $this->iquery = $this->replace_invalid_with_pct_encoding($iquery, '!$&\'()*+,;=:@/?', true); |
1094 | 1057 | $this->scheme_normalization(); |
@@ -1107,8 +1070,7 @@ discard block |
||
1107 | 1070 | if ($ifragment === null) |
1108 | 1071 | { |
1109 | 1072 | $this->ifragment = null; |
1110 | - } |
|
1111 | - else |
|
1073 | + } else |
|
1112 | 1074 | { |
1113 | 1075 | $this->ifragment = $this->replace_invalid_with_pct_encoding($ifragment, '!$&\'()*+,;=:@/?'); |
1114 | 1076 | $this->scheme_normalization(); |
@@ -1165,8 +1127,7 @@ discard block |
||
1165 | 1127 | if ($this->ipath !== '') |
1166 | 1128 | { |
1167 | 1129 | $iri .= $this->ipath; |
1168 | - } |
|
1169 | - elseif (!empty($this->normalization[$this->scheme]['ipath']) && $iauthority !== null && $iauthority !== '') |
|
1130 | + } elseif (!empty($this->normalization[$this->scheme]['ipath']) && $iauthority !== null && $iauthority !== '') |
|
1170 | 1131 | { |
1171 | 1132 | $iri .= $this->normalization[$this->scheme]['ipath']; |
1172 | 1133 | } |
@@ -1215,8 +1176,7 @@ discard block |
||
1215 | 1176 | $iauthority .= ':' . $this->port; |
1216 | 1177 | } |
1217 | 1178 | return $iauthority; |
1218 | - } |
|
1219 | - else |
|
1179 | + } else |
|
1220 | 1180 | { |
1221 | 1181 | return null; |
1222 | 1182 | } |
@@ -1230,9 +1190,10 @@ discard block |
||
1230 | 1190 | protected function get_authority() |
1231 | 1191 | { |
1232 | 1192 | $iauthority = $this->get_iauthority(); |
1233 | - if (is_string($iauthority)) |
|
1234 | - return $this->to_uri($iauthority); |
|
1235 | - else |
|
1236 | - return $iauthority; |
|
1193 | + if (is_string($iauthority)) { |
|
1194 | + return $this->to_uri($iauthority); |
|
1195 | + } else { |
|
1196 | + return $iauthority; |
|
1197 | + } |
|
1237 | 1198 | } |
1238 | 1199 | } |
@@ -860,7 +860,7 @@ discard block |
||
860 | 860 | * @since 1.0 |
861 | 861 | * |
862 | 862 | * @param string $date_format Supports any PHP date format from {@see http://php.net/strftime} (empty for the raw data) |
863 | - * @return int|string|null |
|
863 | + * @return string|null |
|
864 | 864 | */ |
865 | 865 | public function get_local_date($date_format = '%c') |
866 | 866 | { |
@@ -883,7 +883,7 @@ discard block |
||
883 | 883 | * |
884 | 884 | * @see get_date |
885 | 885 | * @param string $date_format Supports any PHP date format from {@see http://php.net/date} |
886 | - * @return int|string|null |
|
886 | + * @return null|string |
|
887 | 887 | */ |
888 | 888 | public function get_gmdate($date_format = 'j F Y, g:i a') |
889 | 889 | { |
@@ -901,7 +901,7 @@ discard block |
||
901 | 901 | * |
902 | 902 | * @see get_updated_date |
903 | 903 | * @param string $date_format Supports any PHP date format from {@see http://php.net/date} |
904 | - * @return int|string|null |
|
904 | + * @return null|string |
|
905 | 905 | */ |
906 | 906 | public function get_updated_gmdate($date_format = 'j F Y, g:i a') |
907 | 907 | { |
@@ -2893,7 +2893,7 @@ discard block |
||
2893 | 2893 | * @since 1.0 |
2894 | 2894 | * @link http://www.w3.org/2003/01/geo/ W3C WGS84 Basic Geo |
2895 | 2895 | * @link http://www.georss.org/ GeoRSS |
2896 | - * @return string|null |
|
2896 | + * @return double|null |
|
2897 | 2897 | */ |
2898 | 2898 | public function get_latitude() |
2899 | 2899 | { |
@@ -2921,7 +2921,7 @@ discard block |
||
2921 | 2921 | * @since 1.0 |
2922 | 2922 | * @link http://www.w3.org/2003/01/geo/ W3C WGS84 Basic Geo |
2923 | 2923 | * @link http://www.georss.org/ GeoRSS |
2924 | - * @return string|null |
|
2924 | + * @return double|null |
|
2925 | 2925 | */ |
2926 | 2926 | public function get_longitude() |
2927 | 2927 | { |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | */ |
123 | 123 | public function __destruct() |
124 | 124 | { |
125 | - if ((version_compare(PHP_VERSION, '5.3', '<') || !gc_enabled()) && !ini_get('zend.ze1_compatibility_mode')) |
|
125 | + if ((version_compare(PHP_VERSION, '5.3', '<') || ! gc_enabled()) && ! ini_get('zend.ze1_compatibility_mode')) |
|
126 | 126 | { |
127 | 127 | unset($this->feed); |
128 | 128 | } |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | */ |
213 | 213 | public function get_id($hash = false) |
214 | 214 | { |
215 | - if (!$hash) |
|
215 | + if ( ! $hash) |
|
216 | 216 | { |
217 | 217 | if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'id')) |
218 | 218 | { |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | } |
250 | 250 | if ($this->get_permalink() !== null || $this->get_title() !== null) |
251 | 251 | { |
252 | - return md5($this->get_permalink() . $this->get_title()); |
|
252 | + return md5($this->get_permalink().$this->get_title()); |
|
253 | 253 | } |
254 | 254 | else |
255 | 255 | { |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | */ |
268 | 268 | public function get_title() |
269 | 269 | { |
270 | - if (!isset($this->data['title'])) |
|
270 | + if ( ! isset($this->data['title'])) |
|
271 | 271 | { |
272 | 272 | if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'title')) |
273 | 273 | { |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML); |
360 | 360 | } |
361 | 361 | |
362 | - elseif (!$description_only) |
|
362 | + elseif ( ! $description_only) |
|
363 | 363 | { |
364 | 364 | return $this->get_content(true); |
365 | 365 | } |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | { |
398 | 398 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0])); |
399 | 399 | } |
400 | - elseif (!$content_only) |
|
400 | + elseif ( ! $content_only) |
|
401 | 401 | { |
402 | 402 | return $this->get_description(true); |
403 | 403 | } |
@@ -482,7 +482,7 @@ discard block |
||
482 | 482 | $categories[] = $this->registry->create('Category', array($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null)); |
483 | 483 | } |
484 | 484 | |
485 | - if (!empty($categories)) |
|
485 | + if ( ! empty($categories)) |
|
486 | 486 | { |
487 | 487 | return array_unique($categories); |
488 | 488 | } |
@@ -588,7 +588,7 @@ discard block |
||
588 | 588 | } |
589 | 589 | } |
590 | 590 | |
591 | - if (!empty($contributors)) |
|
591 | + if ( ! empty($contributors)) |
|
592 | 592 | { |
593 | 593 | return array_unique($contributors); |
594 | 594 | } |
@@ -670,7 +670,7 @@ discard block |
||
670 | 670 | $authors[] = $this->registry->create('Author', array($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null)); |
671 | 671 | } |
672 | 672 | |
673 | - if (!empty($authors)) |
|
673 | + if ( ! empty($authors)) |
|
674 | 674 | { |
675 | 675 | return array_unique($authors); |
676 | 676 | } |
@@ -732,7 +732,7 @@ discard block |
||
732 | 732 | */ |
733 | 733 | public function get_date($date_format = 'j F Y, g:i a') |
734 | 734 | { |
735 | - if (!isset($this->data['date'])) |
|
735 | + if ( ! isset($this->data['date'])) |
|
736 | 736 | { |
737 | 737 | if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'published')) |
738 | 738 | { |
@@ -767,7 +767,7 @@ discard block |
||
767 | 767 | $this->data['date']['raw'] = $return[0]['data']; |
768 | 768 | } |
769 | 769 | |
770 | - if (!empty($this->data['date']['raw'])) |
|
770 | + if ( ! empty($this->data['date']['raw'])) |
|
771 | 771 | { |
772 | 772 | $parser = $this->registry->call('Parse_Date', 'get'); |
773 | 773 | $this->data['date']['parsed'] = $parser->parse($this->data['date']['raw']); |
@@ -811,14 +811,14 @@ discard block |
||
811 | 811 | */ |
812 | 812 | public function get_updated_date($date_format = 'j F Y, g:i a') |
813 | 813 | { |
814 | - if (!isset($this->data['updated'])) |
|
814 | + if ( ! isset($this->data['updated'])) |
|
815 | 815 | { |
816 | 816 | if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'updated')) |
817 | 817 | { |
818 | 818 | $this->data['updated']['raw'] = $return[0]['data']; |
819 | 819 | } |
820 | 820 | |
821 | - if (!empty($this->data['updated']['raw'])) |
|
821 | + if ( ! empty($this->data['updated']['raw'])) |
|
822 | 822 | { |
823 | 823 | $parser = $this->registry->call('Parse_Date', 'get'); |
824 | 824 | $this->data['updated']['parsed'] = $parser->parse($this->data['date']['raw']); |
@@ -864,7 +864,7 @@ discard block |
||
864 | 864 | */ |
865 | 865 | public function get_local_date($date_format = '%c') |
866 | 866 | { |
867 | - if (!$date_format) |
|
867 | + if ( ! $date_format) |
|
868 | 868 | { |
869 | 869 | return $this->sanitize($this->get_date(''), SIMPLEPIE_CONSTRUCT_TEXT); |
870 | 870 | } |
@@ -974,7 +974,7 @@ discard block |
||
974 | 974 | */ |
975 | 975 | public function get_links($rel = 'alternate') |
976 | 976 | { |
977 | - if (!isset($this->data['links'])) |
|
977 | + if ( ! isset($this->data['links'])) |
|
978 | 978 | { |
979 | 979 | $this->data['links'] = array(); |
980 | 980 | foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'link') as $link) |
@@ -1008,7 +1008,7 @@ discard block |
||
1008 | 1008 | } |
1009 | 1009 | if ($links = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'guid')) |
1010 | 1010 | { |
1011 | - if (!isset($links[0]['attribs']['']['isPermaLink']) || strtolower(trim($links[0]['attribs']['']['isPermaLink'])) === 'true') |
|
1011 | + if ( ! isset($links[0]['attribs']['']['isPermaLink']) || strtolower(trim($links[0]['attribs']['']['isPermaLink'])) === 'true') |
|
1012 | 1012 | { |
1013 | 1013 | $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0])); |
1014 | 1014 | } |
@@ -1019,19 +1019,19 @@ discard block |
||
1019 | 1019 | { |
1020 | 1020 | if ($this->registry->call('Misc', 'is_isegment_nz_nc', array($key))) |
1021 | 1021 | { |
1022 | - if (isset($this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key])) |
|
1022 | + if (isset($this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY.$key])) |
|
1023 | 1023 | { |
1024 | - $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] = array_merge($this->data['links'][$key], $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]); |
|
1025 | - $this->data['links'][$key] =& $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]; |
|
1024 | + $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY.$key] = array_merge($this->data['links'][$key], $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY.$key]); |
|
1025 | + $this->data['links'][$key] = & $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY.$key]; |
|
1026 | 1026 | } |
1027 | 1027 | else |
1028 | 1028 | { |
1029 | - $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] =& $this->data['links'][$key]; |
|
1029 | + $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY.$key] = & $this->data['links'][$key]; |
|
1030 | 1030 | } |
1031 | 1031 | } |
1032 | 1032 | elseif (substr($key, 0, 41) === SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY) |
1033 | 1033 | { |
1034 | - $this->data['links'][substr($key, 41)] =& $this->data['links'][$key]; |
|
1034 | + $this->data['links'][substr($key, 41)] = & $this->data['links'][$key]; |
|
1035 | 1035 | } |
1036 | 1036 | $this->data['links'][$key] = array_unique($this->data['links'][$key]); |
1037 | 1037 | } |
@@ -1085,7 +1085,7 @@ discard block |
||
1085 | 1085 | */ |
1086 | 1086 | public function get_enclosures() |
1087 | 1087 | { |
1088 | - if (!isset($this->data['enclosures'])) |
|
1088 | + if ( ! isset($this->data['enclosures'])) |
|
1089 | 1089 | { |
1090 | 1090 | $this->data['enclosures'] = array(); |
1091 | 1091 | |
@@ -1732,7 +1732,7 @@ discard block |
||
1732 | 1732 | // If we have media:group tags, loop through them. |
1733 | 1733 | foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'group') as $group) |
1734 | 1734 | { |
1735 | - if(isset($group['child']) && isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['content'])) |
|
1735 | + if (isset($group['child']) && isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['content'])) |
|
1736 | 1736 | { |
1737 | 1737 | // If we have media:content tags, loop through them. |
1738 | 1738 | foreach ((array) $group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['content'] as $content) |
@@ -2762,7 +2762,7 @@ discard block |
||
2762 | 2762 | |
2763 | 2763 | foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'link') as $link) |
2764 | 2764 | { |
2765 | - if (isset($link['attribs']['']['href']) && !empty($link['attribs']['']['rel']) && $link['attribs']['']['rel'] === 'enclosure') |
|
2765 | + if (isset($link['attribs']['']['href']) && ! empty($link['attribs']['']['rel']) && $link['attribs']['']['rel'] === 'enclosure') |
|
2766 | 2766 | { |
2767 | 2767 | // Attributes |
2768 | 2768 | $bitrate = null; |
@@ -2797,7 +2797,7 @@ discard block |
||
2797 | 2797 | |
2798 | 2798 | foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'link') as $link) |
2799 | 2799 | { |
2800 | - if (isset($link['attribs']['']['href']) && !empty($link['attribs']['']['rel']) && $link['attribs']['']['rel'] === 'enclosure') |
|
2800 | + if (isset($link['attribs']['']['href']) && ! empty($link['attribs']['']['rel']) && $link['attribs']['']['rel'] === 'enclosure') |
|
2801 | 2801 | { |
2802 | 2802 | // Attributes |
2803 | 2803 | $bitrate = null; |
@@ -2873,7 +2873,7 @@ discard block |
||
2873 | 2873 | |
2874 | 2874 | $this->data['enclosures'] = array_values(array_unique($this->data['enclosures'])); |
2875 | 2875 | } |
2876 | - if (!empty($this->data['enclosures'])) |
|
2876 | + if ( ! empty($this->data['enclosures'])) |
|
2877 | 2877 | { |
2878 | 2878 | return $this->data['enclosures']; |
2879 | 2879 | } |
@@ -147,8 +147,7 @@ discard block |
||
147 | 147 | if (isset($this->data['child'][$namespace][$tag])) |
148 | 148 | { |
149 | 149 | return $this->data['child'][$namespace][$tag]; |
150 | - } |
|
151 | - else |
|
150 | + } else |
|
152 | 151 | { |
153 | 152 | return null; |
154 | 153 | } |
@@ -217,32 +216,25 @@ discard block |
||
217 | 216 | if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'id')) |
218 | 217 | { |
219 | 218 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
220 | - } |
|
221 | - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'id')) |
|
219 | + } elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'id')) |
|
222 | 220 | { |
223 | 221 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
224 | - } |
|
225 | - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'guid')) |
|
222 | + } elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'guid')) |
|
226 | 223 | { |
227 | 224 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
228 | - } |
|
229 | - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'identifier')) |
|
225 | + } elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'identifier')) |
|
230 | 226 | { |
231 | 227 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
232 | - } |
|
233 | - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'identifier')) |
|
228 | + } elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'identifier')) |
|
234 | 229 | { |
235 | 230 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
236 | - } |
|
237 | - elseif (isset($this->data['attribs'][SIMPLEPIE_NAMESPACE_RDF]['about'])) |
|
231 | + } elseif (isset($this->data['attribs'][SIMPLEPIE_NAMESPACE_RDF]['about'])) |
|
238 | 232 | { |
239 | 233 | return $this->sanitize($this->data['attribs'][SIMPLEPIE_NAMESPACE_RDF]['about'], SIMPLEPIE_CONSTRUCT_TEXT); |
240 | - } |
|
241 | - elseif (($return = $this->get_permalink()) !== null) |
|
234 | + } elseif (($return = $this->get_permalink()) !== null) |
|
242 | 235 | { |
243 | 236 | return $return; |
244 | - } |
|
245 | - elseif (($return = $this->get_title()) !== null) |
|
237 | + } elseif (($return = $this->get_title()) !== null) |
|
246 | 238 | { |
247 | 239 | return $return; |
248 | 240 | } |
@@ -250,8 +242,7 @@ discard block |
||
250 | 242 | if ($this->get_permalink() !== null || $this->get_title() !== null) |
251 | 243 | { |
252 | 244 | return md5($this->get_permalink() . $this->get_title()); |
253 | - } |
|
254 | - else |
|
245 | + } else |
|
255 | 246 | { |
256 | 247 | return md5(serialize($this->data)); |
257 | 248 | } |
@@ -272,32 +263,25 @@ discard block |
||
272 | 263 | if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'title')) |
273 | 264 | { |
274 | 265 | $this->data['title'] = $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($return[0])); |
275 | - } |
|
276 | - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'title')) |
|
266 | + } elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'title')) |
|
277 | 267 | { |
278 | 268 | $this->data['title'] = $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($return[0]['attribs'])), $this->get_base($return[0])); |
279 | - } |
|
280 | - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'title')) |
|
269 | + } elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'title')) |
|
281 | 270 | { |
282 | 271 | $this->data['title'] = $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); |
283 | - } |
|
284 | - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title')) |
|
272 | + } elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title')) |
|
285 | 273 | { |
286 | 274 | $this->data['title'] = $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); |
287 | - } |
|
288 | - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title')) |
|
275 | + } elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title')) |
|
289 | 276 | { |
290 | 277 | $this->data['title'] = $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); |
291 | - } |
|
292 | - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title')) |
|
278 | + } elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title')) |
|
293 | 279 | { |
294 | 280 | $this->data['title'] = $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
295 | - } |
|
296 | - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'title')) |
|
281 | + } elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'title')) |
|
297 | 282 | { |
298 | 283 | $this->data['title'] = $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
299 | - } |
|
300 | - else |
|
284 | + } else |
|
301 | 285 | { |
302 | 286 | $this->data['title'] = null; |
303 | 287 | } |
@@ -325,45 +309,34 @@ discard block |
||
325 | 309 | if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'summary')) |
326 | 310 | { |
327 | 311 | return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($return[0])); |
328 | - } |
|
329 | - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'summary')) |
|
312 | + } elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'summary')) |
|
330 | 313 | { |
331 | 314 | return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($return[0]['attribs'])), $this->get_base($return[0])); |
332 | - } |
|
333 | - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'description')) |
|
315 | + } elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'description')) |
|
334 | 316 | { |
335 | 317 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0])); |
336 | - } |
|
337 | - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'description')) |
|
318 | + } elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'description')) |
|
338 | 319 | { |
339 | 320 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0])); |
340 | - } |
|
341 | - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'description')) |
|
321 | + } elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'description')) |
|
342 | 322 | { |
343 | 323 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
344 | - } |
|
345 | - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'description')) |
|
324 | + } elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'description')) |
|
346 | 325 | { |
347 | 326 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
348 | - } |
|
349 | - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'summary')) |
|
327 | + } elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'summary')) |
|
350 | 328 | { |
351 | 329 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0])); |
352 | - } |
|
353 | - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'subtitle')) |
|
330 | + } elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'subtitle')) |
|
354 | 331 | { |
355 | 332 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
356 | - } |
|
357 | - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'description')) |
|
333 | + } elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'description')) |
|
358 | 334 | { |
359 | 335 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML); |
360 | - } |
|
361 | - |
|
362 | - elseif (!$description_only) |
|
336 | + } elseif (!$description_only) |
|
363 | 337 | { |
364 | 338 | return $this->get_content(true); |
365 | - } |
|
366 | - else |
|
339 | + } else |
|
367 | 340 | { |
368 | 341 | return null; |
369 | 342 | } |
@@ -388,20 +361,16 @@ discard block |
||
388 | 361 | if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'content')) |
389 | 362 | { |
390 | 363 | return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_content_construct_type', array($return[0]['attribs'])), $this->get_base($return[0])); |
391 | - } |
|
392 | - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'content')) |
|
364 | + } elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'content')) |
|
393 | 365 | { |
394 | 366 | return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($return[0]['attribs'])), $this->get_base($return[0])); |
395 | - } |
|
396 | - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10_MODULES_CONTENT, 'encoded')) |
|
367 | + } elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10_MODULES_CONTENT, 'encoded')) |
|
397 | 368 | { |
398 | 369 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0])); |
399 | - } |
|
400 | - elseif (!$content_only) |
|
370 | + } elseif (!$content_only) |
|
401 | 371 | { |
402 | 372 | return $this->get_description(true); |
403 | - } |
|
404 | - else |
|
373 | + } else |
|
405 | 374 | { |
406 | 375 | return null; |
407 | 376 | } |
@@ -420,8 +389,7 @@ discard block |
||
420 | 389 | if (isset($categories[$key])) |
421 | 390 | { |
422 | 391 | return $categories[$key]; |
423 | - } |
|
424 | - else |
|
392 | + } else |
|
425 | 393 | { |
426 | 394 | return null; |
427 | 395 | } |
@@ -466,8 +434,7 @@ discard block |
||
466 | 434 | if (isset($category['attribs']['']['domain'])) |
467 | 435 | { |
468 | 436 | $scheme = $this->sanitize($category['attribs']['']['domain'], SIMPLEPIE_CONSTRUCT_TEXT); |
469 | - } |
|
470 | - else |
|
437 | + } else |
|
471 | 438 | { |
472 | 439 | $scheme = null; |
473 | 440 | } |
@@ -485,8 +452,7 @@ discard block |
||
485 | 452 | if (!empty($categories)) |
486 | 453 | { |
487 | 454 | return array_unique($categories); |
488 | - } |
|
489 | - else |
|
455 | + } else |
|
490 | 456 | { |
491 | 457 | return null; |
492 | 458 | } |
@@ -505,8 +471,7 @@ discard block |
||
505 | 471 | if (isset($authors[$key])) |
506 | 472 | { |
507 | 473 | return $authors[$key]; |
508 | - } |
|
509 | - else |
|
474 | + } else |
|
510 | 475 | { |
511 | 476 | return null; |
512 | 477 | } |
@@ -525,8 +490,7 @@ discard block |
||
525 | 490 | if (isset($contributors[$key])) |
526 | 491 | { |
527 | 492 | return $contributors[$key]; |
528 | - } |
|
529 | - else |
|
493 | + } else |
|
530 | 494 | { |
531 | 495 | return null; |
532 | 496 | } |
@@ -591,8 +555,7 @@ discard block |
||
591 | 555 | if (!empty($contributors)) |
592 | 556 | { |
593 | 557 | return array_unique($contributors); |
594 | - } |
|
595 | - else |
|
558 | + } else |
|
596 | 559 | { |
597 | 560 | return null; |
598 | 561 | } |
@@ -673,16 +636,13 @@ discard block |
||
673 | 636 | if (!empty($authors)) |
674 | 637 | { |
675 | 638 | return array_unique($authors); |
676 | - } |
|
677 | - elseif (($source = $this->get_source()) && ($authors = $source->get_authors())) |
|
639 | + } elseif (($source = $this->get_source()) && ($authors = $source->get_authors())) |
|
678 | 640 | { |
679 | 641 | return $authors; |
680 | - } |
|
681 | - elseif ($authors = $this->feed->get_authors()) |
|
642 | + } elseif ($authors = $this->feed->get_authors()) |
|
682 | 643 | { |
683 | 644 | return $authors; |
684 | - } |
|
685 | - else |
|
645 | + } else |
|
686 | 646 | { |
687 | 647 | return null; |
688 | 648 | } |
@@ -701,16 +661,13 @@ discard block |
||
701 | 661 | if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'rights')) |
702 | 662 | { |
703 | 663 | return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($return[0])); |
704 | - } |
|
705 | - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'rights')) |
|
664 | + } elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'rights')) |
|
706 | 665 | { |
707 | 666 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
708 | - } |
|
709 | - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'rights')) |
|
667 | + } elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'rights')) |
|
710 | 668 | { |
711 | 669 | return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
712 | - } |
|
713 | - else |
|
670 | + } else |
|
714 | 671 | { |
715 | 672 | return null; |
716 | 673 | } |
@@ -737,32 +694,25 @@ discard block |
||
737 | 694 | if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'published')) |
738 | 695 | { |
739 | 696 | $this->data['date']['raw'] = $return[0]['data']; |
740 | - } |
|
741 | - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'updated')) |
|
697 | + } elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'updated')) |
|
742 | 698 | { |
743 | 699 | $this->data['date']['raw'] = $return[0]['data']; |
744 | - } |
|
745 | - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'issued')) |
|
700 | + } elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'issued')) |
|
746 | 701 | { |
747 | 702 | $this->data['date']['raw'] = $return[0]['data']; |
748 | - } |
|
749 | - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'created')) |
|
703 | + } elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'created')) |
|
750 | 704 | { |
751 | 705 | $this->data['date']['raw'] = $return[0]['data']; |
752 | - } |
|
753 | - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'modified')) |
|
706 | + } elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'modified')) |
|
754 | 707 | { |
755 | 708 | $this->data['date']['raw'] = $return[0]['data']; |
756 | - } |
|
757 | - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'pubDate')) |
|
709 | + } elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'pubDate')) |
|
758 | 710 | { |
759 | 711 | $this->data['date']['raw'] = $return[0]['data']; |
760 | - } |
|
761 | - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'date')) |
|
712 | + } elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'date')) |
|
762 | 713 | { |
763 | 714 | $this->data['date']['raw'] = $return[0]['data']; |
764 | - } |
|
765 | - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'date')) |
|
715 | + } elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'date')) |
|
766 | 716 | { |
767 | 717 | $this->data['date']['raw'] = $return[0]['data']; |
768 | 718 | } |
@@ -771,8 +721,7 @@ discard block |
||
771 | 721 | { |
772 | 722 | $parser = $this->registry->call('Parse_Date', 'get'); |
773 | 723 | $this->data['date']['parsed'] = $parser->parse($this->data['date']['raw']); |
774 | - } |
|
775 | - else |
|
724 | + } else |
|
776 | 725 | { |
777 | 726 | $this->data['date'] = null; |
778 | 727 | } |
@@ -791,8 +740,7 @@ discard block |
||
791 | 740 | default: |
792 | 741 | return date($date_format, $this->data['date']['parsed']); |
793 | 742 | } |
794 | - } |
|
795 | - else |
|
743 | + } else |
|
796 | 744 | { |
797 | 745 | return null; |
798 | 746 | } |
@@ -822,8 +770,7 @@ discard block |
||
822 | 770 | { |
823 | 771 | $parser = $this->registry->call('Parse_Date', 'get'); |
824 | 772 | $this->data['updated']['parsed'] = $parser->parse($this->data['date']['raw']); |
825 | - } |
|
826 | - else |
|
773 | + } else |
|
827 | 774 | { |
828 | 775 | $this->data['updated'] = null; |
829 | 776 | } |
@@ -842,8 +789,7 @@ discard block |
||
842 | 789 | default: |
843 | 790 | return date($date_format, $this->data['updated']['parsed']); |
844 | 791 | } |
845 | - } |
|
846 | - else |
|
792 | + } else |
|
847 | 793 | { |
848 | 794 | return null; |
849 | 795 | } |
@@ -867,12 +813,10 @@ discard block |
||
867 | 813 | if (!$date_format) |
868 | 814 | { |
869 | 815 | return $this->sanitize($this->get_date(''), SIMPLEPIE_CONSTRUCT_TEXT); |
870 | - } |
|
871 | - elseif (($date = $this->get_date('U')) !== null && $date !== false) |
|
816 | + } elseif (($date = $this->get_date('U')) !== null && $date !== false) |
|
872 | 817 | { |
873 | 818 | return strftime($date_format, $date); |
874 | - } |
|
875 | - else |
|
819 | + } else |
|
876 | 820 | { |
877 | 821 | return null; |
878 | 822 | } |
@@ -931,12 +875,10 @@ discard block |
||
931 | 875 | if ($link !== null) |
932 | 876 | { |
933 | 877 | return $link; |
934 | - } |
|
935 | - elseif ($enclosure !== null) |
|
878 | + } elseif ($enclosure !== null) |
|
936 | 879 | { |
937 | 880 | return $enclosure->get_link(); |
938 | - } |
|
939 | - else |
|
881 | + } else |
|
940 | 882 | { |
941 | 883 | return null; |
942 | 884 | } |
@@ -956,8 +898,7 @@ discard block |
||
956 | 898 | if ($links[$key] !== null) |
957 | 899 | { |
958 | 900 | return $links[$key]; |
959 | - } |
|
960 | - else |
|
901 | + } else |
|
961 | 902 | { |
962 | 903 | return null; |
963 | 904 | } |
@@ -1023,13 +964,11 @@ discard block |
||
1023 | 964 | { |
1024 | 965 | $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] = array_merge($this->data['links'][$key], $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]); |
1025 | 966 | $this->data['links'][$key] =& $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]; |
1026 | - } |
|
1027 | - else |
|
967 | + } else |
|
1028 | 968 | { |
1029 | 969 | $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] =& $this->data['links'][$key]; |
1030 | 970 | } |
1031 | - } |
|
1032 | - elseif (substr($key, 0, 41) === SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY) |
|
971 | + } elseif (substr($key, 0, 41) === SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY) |
|
1033 | 972 | { |
1034 | 973 | $this->data['links'][substr($key, 41)] =& $this->data['links'][$key]; |
1035 | 974 | } |
@@ -1039,8 +978,7 @@ discard block |
||
1039 | 978 | if (isset($this->data['links'][$rel])) |
1040 | 979 | { |
1041 | 980 | return $this->data['links'][$rel]; |
1042 | - } |
|
1043 | - else |
|
981 | + } else |
|
1044 | 982 | { |
1045 | 983 | return null; |
1046 | 984 | } |
@@ -1062,8 +1000,7 @@ discard block |
||
1062 | 1000 | if (isset($enclosures[$key])) |
1063 | 1001 | { |
1064 | 1002 | return $enclosures[$key]; |
1065 | - } |
|
1066 | - else |
|
1003 | + } else |
|
1067 | 1004 | { |
1068 | 1005 | return null; |
1069 | 1006 | } |
@@ -1139,8 +1076,7 @@ discard block |
||
1139 | 1076 | } |
1140 | 1077 | $captions_parent[] = $this->registry->create('Caption', array($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text)); |
1141 | 1078 | } |
1142 | - } |
|
1143 | - elseif ($captions = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'text')) |
|
1079 | + } elseif ($captions = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'text')) |
|
1144 | 1080 | { |
1145 | 1081 | foreach ($captions as $caption) |
1146 | 1082 | { |
@@ -1190,8 +1126,7 @@ discard block |
||
1190 | 1126 | if (isset($category['attribs']['']['scheme'])) |
1191 | 1127 | { |
1192 | 1128 | $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); |
1193 | - } |
|
1194 | - else |
|
1129 | + } else |
|
1195 | 1130 | { |
1196 | 1131 | $scheme = 'http://search.yahoo.com/mrss/category_schema'; |
1197 | 1132 | } |
@@ -1213,8 +1148,7 @@ discard block |
||
1213 | 1148 | if (isset($category['attribs']['']['scheme'])) |
1214 | 1149 | { |
1215 | 1150 | $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); |
1216 | - } |
|
1217 | - else |
|
1151 | + } else |
|
1218 | 1152 | { |
1219 | 1153 | $scheme = 'http://search.yahoo.com/mrss/category_schema'; |
1220 | 1154 | } |
@@ -1266,8 +1200,7 @@ discard block |
||
1266 | 1200 | $copyright_label = $this->sanitize($copyright[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
1267 | 1201 | } |
1268 | 1202 | $copyrights_parent = $this->registry->create('Copyright', array($copyright_url, $copyright_label)); |
1269 | - } |
|
1270 | - elseif ($copyright = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'copyright')) |
|
1203 | + } elseif ($copyright = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'copyright')) |
|
1271 | 1204 | { |
1272 | 1205 | $copyright_url = null; |
1273 | 1206 | $copyright_label = null; |
@@ -1297,8 +1230,7 @@ discard block |
||
1297 | 1230 | if (isset($credit['attribs']['']['scheme'])) |
1298 | 1231 | { |
1299 | 1232 | $credit_scheme = $this->sanitize($credit['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); |
1300 | - } |
|
1301 | - else |
|
1233 | + } else |
|
1302 | 1234 | { |
1303 | 1235 | $credit_scheme = 'urn:ebu'; |
1304 | 1236 | } |
@@ -1308,8 +1240,7 @@ discard block |
||
1308 | 1240 | } |
1309 | 1241 | $credits_parent[] = $this->registry->create('Credit', array($credit_role, $credit_scheme, $credit_name)); |
1310 | 1242 | } |
1311 | - } |
|
1312 | - elseif ($credits = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'credit')) |
|
1243 | + } elseif ($credits = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'credit')) |
|
1313 | 1244 | { |
1314 | 1245 | foreach ($credits as $credit) |
1315 | 1246 | { |
@@ -1323,8 +1254,7 @@ discard block |
||
1323 | 1254 | if (isset($credit['attribs']['']['scheme'])) |
1324 | 1255 | { |
1325 | 1256 | $credit_scheme = $this->sanitize($credit['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); |
1326 | - } |
|
1327 | - else |
|
1257 | + } else |
|
1328 | 1258 | { |
1329 | 1259 | $credit_scheme = 'urn:ebu'; |
1330 | 1260 | } |
@@ -1347,8 +1277,7 @@ discard block |
||
1347 | 1277 | { |
1348 | 1278 | $description_parent = $this->sanitize($description_parent[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
1349 | 1279 | } |
1350 | - } |
|
1351 | - elseif ($description_parent = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'description')) |
|
1280 | + } elseif ($description_parent = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'description')) |
|
1352 | 1281 | { |
1353 | 1282 | if (isset($description_parent[0]['data'])) |
1354 | 1283 | { |
@@ -1398,15 +1327,13 @@ discard block |
||
1398 | 1327 | if (isset($hash['attribs']['']['algo'])) |
1399 | 1328 | { |
1400 | 1329 | $algo = $this->sanitize($hash['attribs']['']['algo'], SIMPLEPIE_CONSTRUCT_TEXT); |
1401 | - } |
|
1402 | - else |
|
1330 | + } else |
|
1403 | 1331 | { |
1404 | 1332 | $algo = 'md5'; |
1405 | 1333 | } |
1406 | 1334 | $hashes_parent[] = $algo.':'.$value; |
1407 | 1335 | } |
1408 | - } |
|
1409 | - elseif ($hashes_iterator = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'hash')) |
|
1336 | + } elseif ($hashes_iterator = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'hash')) |
|
1410 | 1337 | { |
1411 | 1338 | foreach ($hashes_iterator as $hash) |
1412 | 1339 | { |
@@ -1419,8 +1346,7 @@ discard block |
||
1419 | 1346 | if (isset($hash['attribs']['']['algo'])) |
1420 | 1347 | { |
1421 | 1348 | $algo = $this->sanitize($hash['attribs']['']['algo'], SIMPLEPIE_CONSTRUCT_TEXT); |
1422 | - } |
|
1423 | - else |
|
1349 | + } else |
|
1424 | 1350 | { |
1425 | 1351 | $algo = 'md5'; |
1426 | 1352 | } |
@@ -1444,8 +1370,7 @@ discard block |
||
1444 | 1370 | } |
1445 | 1371 | } |
1446 | 1372 | unset($temp); |
1447 | - } |
|
1448 | - elseif ($keywords = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'keywords')) |
|
1373 | + } elseif ($keywords = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'keywords')) |
|
1449 | 1374 | { |
1450 | 1375 | if (isset($keywords[0]['data'])) |
1451 | 1376 | { |
@@ -1456,8 +1381,7 @@ discard block |
||
1456 | 1381 | } |
1457 | 1382 | } |
1458 | 1383 | unset($temp); |
1459 | - } |
|
1460 | - elseif ($keywords = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'keywords')) |
|
1384 | + } elseif ($keywords = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'keywords')) |
|
1461 | 1385 | { |
1462 | 1386 | if (isset($keywords[0]['data'])) |
1463 | 1387 | { |
@@ -1468,8 +1392,7 @@ discard block |
||
1468 | 1392 | } |
1469 | 1393 | } |
1470 | 1394 | unset($temp); |
1471 | - } |
|
1472 | - elseif ($keywords = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'keywords')) |
|
1395 | + } elseif ($keywords = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'keywords')) |
|
1473 | 1396 | { |
1474 | 1397 | if (isset($keywords[0]['data'])) |
1475 | 1398 | { |
@@ -1493,8 +1416,7 @@ discard block |
||
1493 | 1416 | { |
1494 | 1417 | $player_parent = $this->sanitize($player_parent[0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI); |
1495 | 1418 | } |
1496 | - } |
|
1497 | - elseif ($player_parent = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'player')) |
|
1419 | + } elseif ($player_parent = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'player')) |
|
1498 | 1420 | { |
1499 | 1421 | if (isset($player_parent[0]['attribs']['']['url'])) |
1500 | 1422 | { |
@@ -1512,8 +1434,7 @@ discard block |
||
1512 | 1434 | if (isset($rating['attribs']['']['scheme'])) |
1513 | 1435 | { |
1514 | 1436 | $rating_scheme = $this->sanitize($rating['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); |
1515 | - } |
|
1516 | - else |
|
1437 | + } else |
|
1517 | 1438 | { |
1518 | 1439 | $rating_scheme = 'urn:simple'; |
1519 | 1440 | } |
@@ -1523,8 +1444,7 @@ discard block |
||
1523 | 1444 | } |
1524 | 1445 | $ratings_parent[] = $this->registry->create('Rating', array($rating_scheme, $rating_value)); |
1525 | 1446 | } |
1526 | - } |
|
1527 | - elseif ($ratings = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'explicit')) |
|
1447 | + } elseif ($ratings = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'explicit')) |
|
1528 | 1448 | { |
1529 | 1449 | foreach ($ratings as $rating) |
1530 | 1450 | { |
@@ -1536,8 +1456,7 @@ discard block |
||
1536 | 1456 | } |
1537 | 1457 | $ratings_parent[] = $this->registry->create('Rating', array($rating_scheme, $rating_value)); |
1538 | 1458 | } |
1539 | - } |
|
1540 | - elseif ($ratings = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'rating')) |
|
1459 | + } elseif ($ratings = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'rating')) |
|
1541 | 1460 | { |
1542 | 1461 | foreach ($ratings as $rating) |
1543 | 1462 | { |
@@ -1546,8 +1465,7 @@ discard block |
||
1546 | 1465 | if (isset($rating['attribs']['']['scheme'])) |
1547 | 1466 | { |
1548 | 1467 | $rating_scheme = $this->sanitize($rating['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); |
1549 | - } |
|
1550 | - else |
|
1468 | + } else |
|
1551 | 1469 | { |
1552 | 1470 | $rating_scheme = 'urn:simple'; |
1553 | 1471 | } |
@@ -1557,8 +1475,7 @@ discard block |
||
1557 | 1475 | } |
1558 | 1476 | $ratings_parent[] = $this->registry->create('Rating', array($rating_scheme, $rating_value)); |
1559 | 1477 | } |
1560 | - } |
|
1561 | - elseif ($ratings = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'explicit')) |
|
1478 | + } elseif ($ratings = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'explicit')) |
|
1562 | 1479 | { |
1563 | 1480 | foreach ($ratings as $rating) |
1564 | 1481 | { |
@@ -1598,8 +1515,7 @@ discard block |
||
1598 | 1515 | } |
1599 | 1516 | $restrictions_parent[] = $this->registry->create('Restriction', array($restriction_relationship, $restriction_type, $restriction_value)); |
1600 | 1517 | } |
1601 | - } |
|
1602 | - elseif ($restrictions = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'block')) |
|
1518 | + } elseif ($restrictions = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'block')) |
|
1603 | 1519 | { |
1604 | 1520 | foreach ($restrictions as $restriction) |
1605 | 1521 | { |
@@ -1612,8 +1528,7 @@ discard block |
||
1612 | 1528 | } |
1613 | 1529 | $restrictions_parent[] = $this->registry->create('Restriction', array($restriction_relationship, $restriction_type, $restriction_value)); |
1614 | 1530 | } |
1615 | - } |
|
1616 | - elseif ($restrictions = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'restriction')) |
|
1531 | + } elseif ($restrictions = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'restriction')) |
|
1617 | 1532 | { |
1618 | 1533 | foreach ($restrictions as $restriction) |
1619 | 1534 | { |
@@ -1634,8 +1549,7 @@ discard block |
||
1634 | 1549 | } |
1635 | 1550 | $restrictions_parent[] = $this->registry->create('Restriction', array($restriction_relationship, $restriction_type, $restriction_value)); |
1636 | 1551 | } |
1637 | - } |
|
1638 | - elseif ($restrictions = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'block')) |
|
1552 | + } elseif ($restrictions = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'block')) |
|
1639 | 1553 | { |
1640 | 1554 | foreach ($restrictions as $restriction) |
1641 | 1555 | { |
@@ -1652,8 +1566,7 @@ discard block |
||
1652 | 1566 | if (is_array($restrictions_parent)) |
1653 | 1567 | { |
1654 | 1568 | $restrictions_parent = array_values(array_unique($restrictions_parent)); |
1655 | - } |
|
1656 | - else |
|
1569 | + } else |
|
1657 | 1570 | { |
1658 | 1571 | $restrictions_parent = array(new SimplePie_Restriction('allow', null, 'default')); |
1659 | 1572 | } |
@@ -1668,8 +1581,7 @@ discard block |
||
1668 | 1581 | $thumbnails_parent[] = $this->sanitize($thumbnail['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI); |
1669 | 1582 | } |
1670 | 1583 | } |
1671 | - } |
|
1672 | - elseif ($thumbnails = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'thumbnail')) |
|
1584 | + } elseif ($thumbnails = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'thumbnail')) |
|
1673 | 1585 | { |
1674 | 1586 | foreach ($thumbnails as $thumbnail) |
1675 | 1587 | { |
@@ -1687,8 +1599,7 @@ discard block |
||
1687 | 1599 | { |
1688 | 1600 | $title_parent = $this->sanitize($title_parent[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
1689 | 1601 | } |
1690 | - } |
|
1691 | - elseif ($title_parent = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'title')) |
|
1602 | + } elseif ($title_parent = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'title')) |
|
1692 | 1603 | { |
1693 | 1604 | if (isset($title_parent[0]['data'])) |
1694 | 1605 | { |
@@ -1781,8 +1692,7 @@ discard block |
||
1781 | 1692 | if (isset($content['attribs']['']['duration'])) |
1782 | 1693 | { |
1783 | 1694 | $duration = $this->sanitize($content['attribs']['']['duration'], SIMPLEPIE_CONSTRUCT_TEXT); |
1784 | - } |
|
1785 | - else |
|
1695 | + } else |
|
1786 | 1696 | { |
1787 | 1697 | $duration = $duration_parent; |
1788 | 1698 | } |
@@ -1862,8 +1772,7 @@ discard block |
||
1862 | 1772 | { |
1863 | 1773 | $captions = array_values(array_unique($captions)); |
1864 | 1774 | } |
1865 | - } |
|
1866 | - elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text'])) |
|
1775 | + } elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text'])) |
|
1867 | 1776 | { |
1868 | 1777 | foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text'] as $caption) |
1869 | 1778 | { |
@@ -1898,8 +1807,7 @@ discard block |
||
1898 | 1807 | { |
1899 | 1808 | $captions = array_values(array_unique($captions)); |
1900 | 1809 | } |
1901 | - } |
|
1902 | - else |
|
1810 | + } else |
|
1903 | 1811 | { |
1904 | 1812 | $captions = $captions_parent; |
1905 | 1813 | } |
@@ -1919,8 +1827,7 @@ discard block |
||
1919 | 1827 | if (isset($category['attribs']['']['scheme'])) |
1920 | 1828 | { |
1921 | 1829 | $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); |
1922 | - } |
|
1923 | - else |
|
1830 | + } else |
|
1924 | 1831 | { |
1925 | 1832 | $scheme = 'http://search.yahoo.com/mrss/category_schema'; |
1926 | 1833 | } |
@@ -1945,8 +1852,7 @@ discard block |
||
1945 | 1852 | if (isset($category['attribs']['']['scheme'])) |
1946 | 1853 | { |
1947 | 1854 | $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); |
1948 | - } |
|
1949 | - else |
|
1855 | + } else |
|
1950 | 1856 | { |
1951 | 1857 | $scheme = 'http://search.yahoo.com/mrss/category_schema'; |
1952 | 1858 | } |
@@ -1960,12 +1866,10 @@ discard block |
||
1960 | 1866 | if (is_array($categories) && is_array($categories_parent)) |
1961 | 1867 | { |
1962 | 1868 | $categories = array_values(array_unique(array_merge($categories, $categories_parent))); |
1963 | - } |
|
1964 | - elseif (is_array($categories)) |
|
1869 | + } elseif (is_array($categories)) |
|
1965 | 1870 | { |
1966 | 1871 | $categories = array_values(array_unique($categories)); |
1967 | - } |
|
1968 | - elseif (is_array($categories_parent)) |
|
1872 | + } elseif (is_array($categories_parent)) |
|
1969 | 1873 | { |
1970 | 1874 | $categories = array_values(array_unique($categories_parent)); |
1971 | 1875 | } |
@@ -1984,8 +1888,7 @@ discard block |
||
1984 | 1888 | $copyright_label = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
1985 | 1889 | } |
1986 | 1890 | $copyrights = $this->registry->create('Copyright', array($copyright_url, $copyright_label)); |
1987 | - } |
|
1988 | - elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'])) |
|
1891 | + } elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'])) |
|
1989 | 1892 | { |
1990 | 1893 | $copyright_url = null; |
1991 | 1894 | $copyright_label = null; |
@@ -1998,8 +1901,7 @@ discard block |
||
1998 | 1901 | $copyright_label = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
1999 | 1902 | } |
2000 | 1903 | $copyrights = $this->registry->create('Copyright', array($copyright_url, $copyright_label)); |
2001 | - } |
|
2002 | - else |
|
1904 | + } else |
|
2003 | 1905 | { |
2004 | 1906 | $copyrights = $copyrights_parent; |
2005 | 1907 | } |
@@ -2019,8 +1921,7 @@ discard block |
||
2019 | 1921 | if (isset($credit['attribs']['']['scheme'])) |
2020 | 1922 | { |
2021 | 1923 | $credit_scheme = $this->sanitize($credit['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); |
2022 | - } |
|
2023 | - else |
|
1924 | + } else |
|
2024 | 1925 | { |
2025 | 1926 | $credit_scheme = 'urn:ebu'; |
2026 | 1927 | } |
@@ -2034,8 +1935,7 @@ discard block |
||
2034 | 1935 | { |
2035 | 1936 | $credits = array_values(array_unique($credits)); |
2036 | 1937 | } |
2037 | - } |
|
2038 | - elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit'])) |
|
1938 | + } elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit'])) |
|
2039 | 1939 | { |
2040 | 1940 | foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit'] as $credit) |
2041 | 1941 | { |
@@ -2049,8 +1949,7 @@ discard block |
||
2049 | 1949 | if (isset($credit['attribs']['']['scheme'])) |
2050 | 1950 | { |
2051 | 1951 | $credit_scheme = $this->sanitize($credit['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); |
2052 | - } |
|
2053 | - else |
|
1952 | + } else |
|
2054 | 1953 | { |
2055 | 1954 | $credit_scheme = 'urn:ebu'; |
2056 | 1955 | } |
@@ -2064,8 +1963,7 @@ discard block |
||
2064 | 1963 | { |
2065 | 1964 | $credits = array_values(array_unique($credits)); |
2066 | 1965 | } |
2067 | - } |
|
2068 | - else |
|
1966 | + } else |
|
2069 | 1967 | { |
2070 | 1968 | $credits = $credits_parent; |
2071 | 1969 | } |
@@ -2074,12 +1972,10 @@ discard block |
||
2074 | 1972 | if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description'])) |
2075 | 1973 | { |
2076 | 1974 | $description = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
2077 | - } |
|
2078 | - elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description'])) |
|
1975 | + } elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description'])) |
|
2079 | 1976 | { |
2080 | 1977 | $description = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
2081 | - } |
|
2082 | - else |
|
1978 | + } else |
|
2083 | 1979 | { |
2084 | 1980 | $description = $description_parent; |
2085 | 1981 | } |
@@ -2098,8 +1994,7 @@ discard block |
||
2098 | 1994 | if (isset($hash['attribs']['']['algo'])) |
2099 | 1995 | { |
2100 | 1996 | $algo = $this->sanitize($hash['attribs']['']['algo'], SIMPLEPIE_CONSTRUCT_TEXT); |
2101 | - } |
|
2102 | - else |
|
1997 | + } else |
|
2103 | 1998 | { |
2104 | 1999 | $algo = 'md5'; |
2105 | 2000 | } |
@@ -2109,8 +2004,7 @@ discard block |
||
2109 | 2004 | { |
2110 | 2005 | $hashes = array_values(array_unique($hashes)); |
2111 | 2006 | } |
2112 | - } |
|
2113 | - elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash'])) |
|
2007 | + } elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash'])) |
|
2114 | 2008 | { |
2115 | 2009 | foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash'] as $hash) |
2116 | 2010 | { |
@@ -2123,8 +2017,7 @@ discard block |
||
2123 | 2017 | if (isset($hash['attribs']['']['algo'])) |
2124 | 2018 | { |
2125 | 2019 | $algo = $this->sanitize($hash['attribs']['']['algo'], SIMPLEPIE_CONSTRUCT_TEXT); |
2126 | - } |
|
2127 | - else |
|
2020 | + } else |
|
2128 | 2021 | { |
2129 | 2022 | $algo = 'md5'; |
2130 | 2023 | } |
@@ -2134,8 +2027,7 @@ discard block |
||
2134 | 2027 | { |
2135 | 2028 | $hashes = array_values(array_unique($hashes)); |
2136 | 2029 | } |
2137 | - } |
|
2138 | - else |
|
2030 | + } else |
|
2139 | 2031 | { |
2140 | 2032 | $hashes = $hashes_parent; |
2141 | 2033 | } |
@@ -2156,8 +2048,7 @@ discard block |
||
2156 | 2048 | { |
2157 | 2049 | $keywords = array_values(array_unique($keywords)); |
2158 | 2050 | } |
2159 | - } |
|
2160 | - elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'])) |
|
2051 | + } elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'])) |
|
2161 | 2052 | { |
2162 | 2053 | if (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'][0]['data'])) |
2163 | 2054 | { |
@@ -2172,8 +2063,7 @@ discard block |
||
2172 | 2063 | { |
2173 | 2064 | $keywords = array_values(array_unique($keywords)); |
2174 | 2065 | } |
2175 | - } |
|
2176 | - else |
|
2066 | + } else |
|
2177 | 2067 | { |
2178 | 2068 | $keywords = $keywords_parent; |
2179 | 2069 | } |
@@ -2182,12 +2072,10 @@ discard block |
||
2182 | 2072 | if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player'])) |
2183 | 2073 | { |
2184 | 2074 | $player = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player'][0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI); |
2185 | - } |
|
2186 | - elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player'])) |
|
2075 | + } elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player'])) |
|
2187 | 2076 | { |
2188 | 2077 | $player = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player'][0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI); |
2189 | - } |
|
2190 | - else |
|
2078 | + } else |
|
2191 | 2079 | { |
2192 | 2080 | $player = $player_parent; |
2193 | 2081 | } |
@@ -2202,8 +2090,7 @@ discard block |
||
2202 | 2090 | if (isset($rating['attribs']['']['scheme'])) |
2203 | 2091 | { |
2204 | 2092 | $rating_scheme = $this->sanitize($rating['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); |
2205 | - } |
|
2206 | - else |
|
2093 | + } else |
|
2207 | 2094 | { |
2208 | 2095 | $rating_scheme = 'urn:simple'; |
2209 | 2096 | } |
@@ -2217,8 +2104,7 @@ discard block |
||
2217 | 2104 | { |
2218 | 2105 | $ratings = array_values(array_unique($ratings)); |
2219 | 2106 | } |
2220 | - } |
|
2221 | - elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating'])) |
|
2107 | + } elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating'])) |
|
2222 | 2108 | { |
2223 | 2109 | foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating'] as $rating) |
2224 | 2110 | { |
@@ -2227,8 +2113,7 @@ discard block |
||
2227 | 2113 | if (isset($rating['attribs']['']['scheme'])) |
2228 | 2114 | { |
2229 | 2115 | $rating_scheme = $this->sanitize($rating['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); |
2230 | - } |
|
2231 | - else |
|
2116 | + } else |
|
2232 | 2117 | { |
2233 | 2118 | $rating_scheme = 'urn:simple'; |
2234 | 2119 | } |
@@ -2242,8 +2127,7 @@ discard block |
||
2242 | 2127 | { |
2243 | 2128 | $ratings = array_values(array_unique($ratings)); |
2244 | 2129 | } |
2245 | - } |
|
2246 | - else |
|
2130 | + } else |
|
2247 | 2131 | { |
2248 | 2132 | $ratings = $ratings_parent; |
2249 | 2133 | } |
@@ -2274,8 +2158,7 @@ discard block |
||
2274 | 2158 | { |
2275 | 2159 | $restrictions = array_values(array_unique($restrictions)); |
2276 | 2160 | } |
2277 | - } |
|
2278 | - elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction'])) |
|
2161 | + } elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction'])) |
|
2279 | 2162 | { |
2280 | 2163 | foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction'] as $restriction) |
2281 | 2164 | { |
@@ -2300,8 +2183,7 @@ discard block |
||
2300 | 2183 | { |
2301 | 2184 | $restrictions = array_values(array_unique($restrictions)); |
2302 | 2185 | } |
2303 | - } |
|
2304 | - else |
|
2186 | + } else |
|
2305 | 2187 | { |
2306 | 2188 | $restrictions = $restrictions_parent; |
2307 | 2189 | } |
@@ -2317,8 +2199,7 @@ discard block |
||
2317 | 2199 | { |
2318 | 2200 | $thumbnails = array_values(array_unique($thumbnails)); |
2319 | 2201 | } |
2320 | - } |
|
2321 | - elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail'])) |
|
2202 | + } elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail'])) |
|
2322 | 2203 | { |
2323 | 2204 | foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail'] as $thumbnail) |
2324 | 2205 | { |
@@ -2328,8 +2209,7 @@ discard block |
||
2328 | 2209 | { |
2329 | 2210 | $thumbnails = array_values(array_unique($thumbnails)); |
2330 | 2211 | } |
2331 | - } |
|
2332 | - else |
|
2212 | + } else |
|
2333 | 2213 | { |
2334 | 2214 | $thumbnails = $thumbnails_parent; |
2335 | 2215 | } |
@@ -2338,12 +2218,10 @@ discard block |
||
2338 | 2218 | if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title'])) |
2339 | 2219 | { |
2340 | 2220 | $title = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
2341 | - } |
|
2342 | - elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title'])) |
|
2221 | + } elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title'])) |
|
2343 | 2222 | { |
2344 | 2223 | $title = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
2345 | - } |
|
2346 | - else |
|
2224 | + } else |
|
2347 | 2225 | { |
2348 | 2226 | $title = $title_parent; |
2349 | 2227 | } |
@@ -2403,8 +2281,7 @@ discard block |
||
2403 | 2281 | if (isset($content['attribs']['']['duration'])) |
2404 | 2282 | { |
2405 | 2283 | $duration = $this->sanitize($content['attribs']['']['duration'], SIMPLEPIE_CONSTRUCT_TEXT); |
2406 | - } |
|
2407 | - else |
|
2284 | + } else |
|
2408 | 2285 | { |
2409 | 2286 | $duration = $duration_parent; |
2410 | 2287 | } |
@@ -2486,8 +2363,7 @@ discard block |
||
2486 | 2363 | { |
2487 | 2364 | $captions = array_values(array_unique($captions)); |
2488 | 2365 | } |
2489 | - } |
|
2490 | - else |
|
2366 | + } else |
|
2491 | 2367 | { |
2492 | 2368 | $captions = $captions_parent; |
2493 | 2369 | } |
@@ -2507,8 +2383,7 @@ discard block |
||
2507 | 2383 | if (isset($category['attribs']['']['scheme'])) |
2508 | 2384 | { |
2509 | 2385 | $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); |
2510 | - } |
|
2511 | - else |
|
2386 | + } else |
|
2512 | 2387 | { |
2513 | 2388 | $scheme = 'http://search.yahoo.com/mrss/category_schema'; |
2514 | 2389 | } |
@@ -2522,16 +2397,13 @@ discard block |
||
2522 | 2397 | if (is_array($categories) && is_array($categories_parent)) |
2523 | 2398 | { |
2524 | 2399 | $categories = array_values(array_unique(array_merge($categories, $categories_parent))); |
2525 | - } |
|
2526 | - elseif (is_array($categories)) |
|
2400 | + } elseif (is_array($categories)) |
|
2527 | 2401 | { |
2528 | 2402 | $categories = array_values(array_unique($categories)); |
2529 | - } |
|
2530 | - elseif (is_array($categories_parent)) |
|
2403 | + } elseif (is_array($categories_parent)) |
|
2531 | 2404 | { |
2532 | 2405 | $categories = array_values(array_unique($categories_parent)); |
2533 | - } |
|
2534 | - else |
|
2406 | + } else |
|
2535 | 2407 | { |
2536 | 2408 | $categories = null; |
2537 | 2409 | } |
@@ -2550,8 +2422,7 @@ discard block |
||
2550 | 2422 | $copyright_label = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
2551 | 2423 | } |
2552 | 2424 | $copyrights = $this->registry->create('Copyright', array($copyright_url, $copyright_label)); |
2553 | - } |
|
2554 | - else |
|
2425 | + } else |
|
2555 | 2426 | { |
2556 | 2427 | $copyrights = $copyrights_parent; |
2557 | 2428 | } |
@@ -2571,8 +2442,7 @@ discard block |
||
2571 | 2442 | if (isset($credit['attribs']['']['scheme'])) |
2572 | 2443 | { |
2573 | 2444 | $credit_scheme = $this->sanitize($credit['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); |
2574 | - } |
|
2575 | - else |
|
2445 | + } else |
|
2576 | 2446 | { |
2577 | 2447 | $credit_scheme = 'urn:ebu'; |
2578 | 2448 | } |
@@ -2586,8 +2456,7 @@ discard block |
||
2586 | 2456 | { |
2587 | 2457 | $credits = array_values(array_unique($credits)); |
2588 | 2458 | } |
2589 | - } |
|
2590 | - else |
|
2459 | + } else |
|
2591 | 2460 | { |
2592 | 2461 | $credits = $credits_parent; |
2593 | 2462 | } |
@@ -2596,8 +2465,7 @@ discard block |
||
2596 | 2465 | if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description'])) |
2597 | 2466 | { |
2598 | 2467 | $description = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
2599 | - } |
|
2600 | - else |
|
2468 | + } else |
|
2601 | 2469 | { |
2602 | 2470 | $description = $description_parent; |
2603 | 2471 | } |
@@ -2616,8 +2484,7 @@ discard block |
||
2616 | 2484 | if (isset($hash['attribs']['']['algo'])) |
2617 | 2485 | { |
2618 | 2486 | $algo = $this->sanitize($hash['attribs']['']['algo'], SIMPLEPIE_CONSTRUCT_TEXT); |
2619 | - } |
|
2620 | - else |
|
2487 | + } else |
|
2621 | 2488 | { |
2622 | 2489 | $algo = 'md5'; |
2623 | 2490 | } |
@@ -2627,8 +2494,7 @@ discard block |
||
2627 | 2494 | { |
2628 | 2495 | $hashes = array_values(array_unique($hashes)); |
2629 | 2496 | } |
2630 | - } |
|
2631 | - else |
|
2497 | + } else |
|
2632 | 2498 | { |
2633 | 2499 | $hashes = $hashes_parent; |
2634 | 2500 | } |
@@ -2649,8 +2515,7 @@ discard block |
||
2649 | 2515 | { |
2650 | 2516 | $keywords = array_values(array_unique($keywords)); |
2651 | 2517 | } |
2652 | - } |
|
2653 | - else |
|
2518 | + } else |
|
2654 | 2519 | { |
2655 | 2520 | $keywords = $keywords_parent; |
2656 | 2521 | } |
@@ -2659,8 +2524,7 @@ discard block |
||
2659 | 2524 | if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player'])) |
2660 | 2525 | { |
2661 | 2526 | $player = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player'][0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI); |
2662 | - } |
|
2663 | - else |
|
2527 | + } else |
|
2664 | 2528 | { |
2665 | 2529 | $player = $player_parent; |
2666 | 2530 | } |
@@ -2675,8 +2539,7 @@ discard block |
||
2675 | 2539 | if (isset($rating['attribs']['']['scheme'])) |
2676 | 2540 | { |
2677 | 2541 | $rating_scheme = $this->sanitize($rating['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); |
2678 | - } |
|
2679 | - else |
|
2542 | + } else |
|
2680 | 2543 | { |
2681 | 2544 | $rating_scheme = 'urn:simple'; |
2682 | 2545 | } |
@@ -2690,8 +2553,7 @@ discard block |
||
2690 | 2553 | { |
2691 | 2554 | $ratings = array_values(array_unique($ratings)); |
2692 | 2555 | } |
2693 | - } |
|
2694 | - else |
|
2556 | + } else |
|
2695 | 2557 | { |
2696 | 2558 | $ratings = $ratings_parent; |
2697 | 2559 | } |
@@ -2722,8 +2584,7 @@ discard block |
||
2722 | 2584 | { |
2723 | 2585 | $restrictions = array_values(array_unique($restrictions)); |
2724 | 2586 | } |
2725 | - } |
|
2726 | - else |
|
2587 | + } else |
|
2727 | 2588 | { |
2728 | 2589 | $restrictions = $restrictions_parent; |
2729 | 2590 | } |
@@ -2739,8 +2600,7 @@ discard block |
||
2739 | 2600 | { |
2740 | 2601 | $thumbnails = array_values(array_unique($thumbnails)); |
2741 | 2602 | } |
2742 | - } |
|
2743 | - else |
|
2603 | + } else |
|
2744 | 2604 | { |
2745 | 2605 | $thumbnails = $thumbnails_parent; |
2746 | 2606 | } |
@@ -2749,8 +2609,7 @@ discard block |
||
2749 | 2609 | if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title'])) |
2750 | 2610 | { |
2751 | 2611 | $title = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
2752 | - } |
|
2753 | - else |
|
2612 | + } else |
|
2754 | 2613 | { |
2755 | 2614 | $title = $title_parent; |
2756 | 2615 | } |
@@ -2876,8 +2735,7 @@ discard block |
||
2876 | 2735 | if (!empty($this->data['enclosures'])) |
2877 | 2736 | { |
2878 | 2737 | return $this->data['enclosures']; |
2879 | - } |
|
2880 | - else |
|
2738 | + } else |
|
2881 | 2739 | { |
2882 | 2740 | return null; |
2883 | 2741 | } |
@@ -2900,12 +2758,10 @@ discard block |
||
2900 | 2758 | if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lat')) |
2901 | 2759 | { |
2902 | 2760 | return (float) $return[0]['data']; |
2903 | - } |
|
2904 | - elseif (($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', trim($return[0]['data']), $match)) |
|
2761 | + } elseif (($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', trim($return[0]['data']), $match)) |
|
2905 | 2762 | { |
2906 | 2763 | return (float) $match[1]; |
2907 | - } |
|
2908 | - else |
|
2764 | + } else |
|
2909 | 2765 | { |
2910 | 2766 | return null; |
2911 | 2767 | } |
@@ -2928,16 +2784,13 @@ discard block |
||
2928 | 2784 | if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'long')) |
2929 | 2785 | { |
2930 | 2786 | return (float) $return[0]['data']; |
2931 | - } |
|
2932 | - elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lon')) |
|
2787 | + } elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lon')) |
|
2933 | 2788 | { |
2934 | 2789 | return (float) $return[0]['data']; |
2935 | - } |
|
2936 | - elseif (($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', trim($return[0]['data']), $match)) |
|
2790 | + } elseif (($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', trim($return[0]['data']), $match)) |
|
2937 | 2791 | { |
2938 | 2792 | return (float) $match[2]; |
2939 | - } |
|
2940 | - else |
|
2793 | + } else |
|
2941 | 2794 | { |
2942 | 2795 | return null; |
2943 | 2796 | } |
@@ -2954,8 +2807,7 @@ discard block |
||
2954 | 2807 | if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'source')) |
2955 | 2808 | { |
2956 | 2809 | return $this->registry->create('Source', array($this, $return[0])); |
2957 | - } |
|
2958 | - else |
|
2810 | + } else |
|
2959 | 2811 | { |
2960 | 2812 | return null; |
2961 | 2813 | } |
@@ -210,6 +210,9 @@ |
||
210 | 210 | } |
211 | 211 | } |
212 | 212 | |
213 | + /** |
|
214 | + * @param string $name |
|
215 | + */ |
|
213 | 216 | protected function search_elements_by_tag($name, &$done, $feeds) |
214 | 217 | { |
215 | 218 | if ($this->dom === null) |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | $feeds = array_merge($feeds, $this->search_elements_by_tag('a', $done, $feeds)); |
201 | 201 | $feeds = array_merge($feeds, $this->search_elements_by_tag('area', $done, $feeds)); |
202 | 202 | |
203 | - if (!empty($feeds)) |
|
203 | + if ( ! empty($feeds)) |
|
204 | 204 | { |
205 | 205 | return array_values($feeds); |
206 | 206 | } |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | continue; |
243 | 243 | } |
244 | 244 | |
245 | - if (!in_array($href, $done) && in_array('feed', $rel) || (in_array('alternate', $rel) && !in_array('stylesheet', $rel) && $link->hasAttribute('type') && in_array(strtolower($this->registry->call('Misc', 'parse_mime', array($link->getAttribute('type')))), array('application/rss+xml', 'application/atom+xml'))) && !isset($feeds[$href])) |
|
245 | + if ( ! in_array($href, $done) && in_array('feed', $rel) || (in_array('alternate', $rel) && ! in_array('stylesheet', $rel) && $link->hasAttribute('type') && in_array(strtolower($this->registry->call('Misc', 'parse_mime', array($link->getAttribute('type')))), array('application/rss+xml', 'application/atom+xml'))) && ! isset($feeds[$href])) |
|
246 | 246 | { |
247 | 247 | $this->checked_feeds++; |
248 | 248 | $headers = array( |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | } |
306 | 306 | $this->local = array_unique($this->local); |
307 | 307 | $this->elsewhere = array_unique($this->elsewhere); |
308 | - if (!empty($this->local) || !empty($this->elsewhere)) |
|
308 | + if ( ! empty($this->local) || ! empty($this->elsewhere)) |
|
309 | 309 | { |
310 | 310 | return true; |
311 | 311 | } |
@@ -79,8 +79,7 @@ discard block |
||
79 | 79 | set_error_handler(array('SimplePie_Misc', 'silence_errors')); |
80 | 80 | $this->dom->loadHTML($this->file->body); |
81 | 81 | restore_error_handler(); |
82 | - } |
|
83 | - else |
|
82 | + } else |
|
84 | 83 | { |
85 | 84 | $this->dom = null; |
86 | 85 | } |
@@ -151,17 +150,14 @@ discard block |
||
151 | 150 | if (in_array($sniffed, array('application/rss+xml', 'application/rdf+xml', 'text/rdf', 'application/atom+xml', 'text/xml', 'application/xml'))) |
152 | 151 | { |
153 | 152 | return true; |
154 | - } |
|
155 | - else |
|
153 | + } else |
|
156 | 154 | { |
157 | 155 | return false; |
158 | 156 | } |
159 | - } |
|
160 | - elseif ($file->method & SIMPLEPIE_FILE_SOURCE_LOCAL) |
|
157 | + } elseif ($file->method & SIMPLEPIE_FILE_SOURCE_LOCAL) |
|
161 | 158 | { |
162 | 159 | return true; |
163 | - } |
|
164 | - else |
|
160 | + } else |
|
165 | 161 | { |
166 | 162 | return false; |
167 | 163 | } |
@@ -203,8 +199,7 @@ discard block |
||
203 | 199 | if (!empty($feeds)) |
204 | 200 | { |
205 | 201 | return array_values($feeds); |
206 | - } |
|
207 | - else |
|
202 | + } else |
|
208 | 203 | { |
209 | 204 | return null; |
210 | 205 | } |
@@ -232,8 +227,7 @@ discard block |
||
232 | 227 | if ($this->base_location < $line) |
233 | 228 | { |
234 | 229 | $href = $this->registry->call('Misc', 'absolutize_url', array(trim($link->getAttribute('href')), $this->base)); |
235 | - } |
|
236 | - else |
|
230 | + } else |
|
237 | 231 | { |
238 | 232 | $href = $this->registry->call('Misc', 'absolutize_url', array(trim($link->getAttribute('href')), $this->http_base)); |
239 | 233 | } |
@@ -280,8 +274,7 @@ discard block |
||
280 | 274 | if (method_exists($link, 'getLineNo') && $this->base_location < $link->getLineNo()) |
281 | 275 | { |
282 | 276 | $href = $this->registry->call('Misc', 'absolutize_url', array(trim($link->getAttribute('href')), $this->base)); |
283 | - } |
|
284 | - else |
|
277 | + } else |
|
285 | 278 | { |
286 | 279 | $href = $this->registry->call('Misc', 'absolutize_url', array(trim($link->getAttribute('href')), $this->http_base)); |
287 | 280 | } |
@@ -295,8 +288,7 @@ discard block |
||
295 | 288 | if ($parsed['authority'] === '' || $parsed['authority'] === $current['authority']) |
296 | 289 | { |
297 | 290 | $this->local[] = $href; |
298 | - } |
|
299 | - else |
|
291 | + } else |
|
300 | 292 | { |
301 | 293 | $this->elsewhere[] = $href; |
302 | 294 | } |
@@ -331,8 +323,7 @@ discard block |
||
331 | 323 | if ($feed->success && ($feed->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($feed->status_code === 200 || $feed->status_code > 206 && $feed->status_code < 300)) && $this->is_feed($feed)) |
332 | 324 | { |
333 | 325 | return $feed; |
334 | - } |
|
335 | - else |
|
326 | + } else |
|
336 | 327 | { |
337 | 328 | unset($array[$key]); |
338 | 329 | } |
@@ -359,8 +350,7 @@ discard block |
||
359 | 350 | if ($feed->success && ($feed->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($feed->status_code === 200 || $feed->status_code > 206 && $feed->status_code < 300)) && $this->is_feed($feed)) |
360 | 351 | { |
361 | 352 | return $feed; |
362 | - } |
|
363 | - else |
|
353 | + } else |
|
364 | 354 | { |
365 | 355 | unset($array[$key]); |
366 | 356 | } |