@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * |
45 | 45 | * {@link XoopsObject} |
46 | 46 | **/ |
47 | -if(!class_exists("Barticle")): |
|
47 | +if (!class_exists("Barticle")): |
|
48 | 48 | |
49 | 49 | class Barticle extends ArtObject |
50 | 50 | { |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | function getTime($format = "c") |
101 | 101 | { |
102 | 102 | $time = $this->getVar("art_time"); |
103 | - if(empty($time)) $time = time(); |
|
103 | + if (empty($time)) $time = time(); |
|
104 | 104 | $time = planet_formatTimestamp($time, $format); |
105 | 105 | return $time; |
106 | 106 | } |
@@ -116,10 +116,10 @@ discard block |
||
116 | 116 | { |
117 | 117 | $content = $this->getVar("art_content"); |
118 | 118 | $summary = planet_html2text($content); |
119 | - if(empty($length)){ |
|
119 | + if (empty($length)) { |
|
120 | 120 | $length = $GLOBALS["xoopsModuleConfig"]["display_summary"]; |
121 | 121 | } |
122 | - if(!empty($length)){ |
|
122 | + if (!empty($length)) { |
|
123 | 123 | $summary = xoops_substr($summary, 0, $length); |
124 | 124 | } |
125 | 125 | return $summary; |
@@ -134,9 +134,9 @@ discard block |
||
134 | 134 | */ |
135 | 135 | function getRatingAverage($decimals = 1) |
136 | 136 | { |
137 | - $ave=3; |
|
138 | - if($this->getVar("art_rates")){ |
|
139 | - $ave = number_format($this->getVar("art_rating")/$this->getVar("art_rates"),$decimals); |
|
137 | + $ave = 3; |
|
138 | + if ($this->getVar("art_rates")) { |
|
139 | + $ave = number_format($this->getVar("art_rating")/$this->getVar("art_rates"), $decimals); |
|
140 | 140 | } |
141 | 141 | return $ave; |
142 | 142 | } |
@@ -34,16 +34,16 @@ discard block |
||
34 | 34 | class MagpieRSS { |
35 | 35 | var $parser; |
36 | 36 | |
37 | - var $current_item = array(); // item currently being parsed |
|
38 | - var $items = array(); // collection of parsed items |
|
39 | - var $channel = array(); // hash of channel fields |
|
37 | + var $current_item = array(); // item currently being parsed |
|
38 | + var $items = array(); // collection of parsed items |
|
39 | + var $channel = array(); // hash of channel fields |
|
40 | 40 | var $textinput = array(); |
41 | 41 | var $image = array(); |
42 | 42 | var $feed_type; |
43 | 43 | var $feed_version; |
44 | - var $encoding = ''; // output encoding of parsed rss |
|
44 | + var $encoding = ''; // output encoding of parsed rss |
|
45 | 45 | |
46 | - var $_source_encoding = ''; // only set if we have to parse xml prolog |
|
46 | + var $_source_encoding = ''; // only set if we have to parse xml prolog |
|
47 | 47 | |
48 | 48 | var $ERROR = ""; |
49 | 49 | var $WARNING = ""; |
@@ -92,15 +92,15 @@ discard block |
||
92 | 92 | * source encoding. (caveat emptor) |
93 | 93 | * |
94 | 94 | */ |
95 | - function MagpieRSS ($source, $output_encoding='ISO-8859-1', |
|
96 | - $input_encoding=null, $detect_encoding=true) |
|
95 | + function MagpieRSS($source, $output_encoding = 'ISO-8859-1', |
|
96 | + $input_encoding = null, $detect_encoding = true) |
|
97 | 97 | { |
98 | 98 | # if PHP xml isn't compiled in, die |
99 | 99 | # |
100 | 100 | if (!function_exists('xml_parser_create')) { |
101 | - $this->error( "Failed to load PHP's XML Extension. " . |
|
101 | + $this->error("Failed to load PHP's XML Extension. ". |
|
102 | 102 | "http://www.php.net/manual/en/ref.xml.php", |
103 | - E_USER_ERROR ); |
|
103 | + E_USER_ERROR); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | list($parser, $source) = $this->create_parser($source, |
@@ -108,9 +108,9 @@ discard block |
||
108 | 108 | |
109 | 109 | |
110 | 110 | if (!is_resource($parser)) { |
111 | - $this->error( "Failed to create an instance of PHP's XML parser. " . |
|
111 | + $this->error("Failed to create an instance of PHP's XML parser. ". |
|
112 | 112 | "http://www.php.net/manual/en/ref.xml.php", |
113 | - E_USER_ERROR ); |
|
113 | + E_USER_ERROR); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | |
@@ -119,27 +119,27 @@ discard block |
||
119 | 119 | # pass in parser, and a reference to this object |
120 | 120 | # setup handlers |
121 | 121 | # |
122 | - xml_set_object( $this->parser, $this ); |
|
122 | + xml_set_object($this->parser, $this); |
|
123 | 123 | xml_set_element_handler($this->parser, |
124 | - 'feed_start_element', 'feed_end_element' ); |
|
124 | + 'feed_start_element', 'feed_end_element'); |
|
125 | 125 | |
126 | - xml_set_character_data_handler( $this->parser, 'feed_cdata' ); |
|
126 | + xml_set_character_data_handler($this->parser, 'feed_cdata'); |
|
127 | 127 | |
128 | - $status = @xml_parse( $this->parser, $source ); |
|
128 | + $status = @xml_parse($this->parser, $source); |
|
129 | 129 | |
130 | - if (! $status ) { |
|
131 | - $errorcode = xml_get_error_code( $this->parser ); |
|
132 | - if ( $errorcode != XML_ERROR_NONE ) { |
|
133 | - $xml_error = xml_error_string( $errorcode ); |
|
130 | + if (!$status) { |
|
131 | + $errorcode = xml_get_error_code($this->parser); |
|
132 | + if ($errorcode != XML_ERROR_NONE) { |
|
133 | + $xml_error = xml_error_string($errorcode); |
|
134 | 134 | $error_line = xml_get_current_line_number($this->parser); |
135 | 135 | $error_col = xml_get_current_column_number($this->parser); |
136 | 136 | $errormsg = "$xml_error at line $error_line, column $error_col"; |
137 | 137 | |
138 | - $this->error( $errormsg ); |
|
138 | + $this->error($errormsg); |
|
139 | 139 | } |
140 | 140 | } |
141 | 141 | |
142 | - xml_parser_free( $this->parser ); |
|
142 | + xml_parser_free($this->parser); |
|
143 | 143 | |
144 | 144 | $this->normalize(); |
145 | 145 | |
@@ -151,26 +151,26 @@ discard block |
||
151 | 151 | |
152 | 152 | // check for a namespace, and split if found |
153 | 153 | $ns = false; |
154 | - if ( strpos( $element, ':' ) ) { |
|
155 | - list($ns, $el) = split( ':', $element, 2); |
|
154 | + if (strpos($element, ':')) { |
|
155 | + list($ns, $el) = split(':', $element, 2); |
|
156 | 156 | } |
157 | - if ( $ns and $ns != 'rdf' ) { |
|
157 | + if ($ns and $ns != 'rdf') { |
|
158 | 158 | $this->current_namespace = $ns; |
159 | 159 | } |
160 | 160 | |
161 | 161 | # if feed type isn't set, then this is first element of feed |
162 | 162 | # identify feed from root element |
163 | 163 | # |
164 | - if (!isset($this->feed_type) ) { |
|
165 | - if ( $el == 'rdf' ) { |
|
164 | + if (!isset($this->feed_type)) { |
|
165 | + if ($el == 'rdf') { |
|
166 | 166 | $this->feed_type = RSS; |
167 | 167 | $this->feed_version = '1.0'; |
168 | 168 | } |
169 | - elseif ( $el == 'rss' ) { |
|
169 | + elseif ($el == 'rss') { |
|
170 | 170 | $this->feed_type = RSS; |
171 | 171 | $this->feed_version = $attrs['version']; |
172 | 172 | } |
173 | - elseif ( $el == 'feed' ) { |
|
173 | + elseif ($el == 'feed') { |
|
174 | 174 | $this->feed_type = ATOM; |
175 | 175 | $this->feed_version = $attrs['version']; |
176 | 176 | $this->inchannel = true; |
@@ -178,14 +178,14 @@ discard block |
||
178 | 178 | return; |
179 | 179 | } |
180 | 180 | |
181 | - if ( $el == 'channel' ) |
|
181 | + if ($el == 'channel') |
|
182 | 182 | { |
183 | 183 | $this->inchannel = true; |
184 | 184 | } |
185 | - elseif ($el == 'item' or $el == 'entry' ) |
|
185 | + elseif ($el == 'item' or $el == 'entry') |
|
186 | 186 | { |
187 | 187 | $this->initem = true; |
188 | - if ( isset($attrs['rdf:about']) ) { |
|
188 | + if (isset($attrs['rdf:about'])) { |
|
189 | 189 | $this->current_item['about'] = $attrs['rdf:about']; |
190 | 190 | } |
191 | 191 | } |
@@ -209,10 +209,10 @@ discard block |
||
209 | 209 | } |
210 | 210 | |
211 | 211 | # handle atom content constructs |
212 | - elseif ( $this->feed_type == ATOM and in_array($el, $this->_CONTENT_CONSTRUCTS) ) |
|
212 | + elseif ($this->feed_type == ATOM and in_array($el, $this->_CONTENT_CONSTRUCTS)) |
|
213 | 213 | { |
214 | 214 | // avoid clashing w/ RSS mod_content |
215 | - if ($el == 'content' ) { |
|
215 | + if ($el == 'content') { |
|
216 | 216 | $el = 'atom_content'; |
217 | 217 | } |
218 | 218 | |
@@ -222,31 +222,31 @@ discard block |
||
222 | 222 | } |
223 | 223 | |
224 | 224 | // if inside an Atom content construct (e.g. content or summary) field treat tags as text |
225 | - elseif ($this->feed_type == ATOM and $this->incontent ) |
|
225 | + elseif ($this->feed_type == ATOM and $this->incontent) |
|
226 | 226 | { |
227 | 227 | // if tags are inlined, then flatten |
228 | 228 | $attrs_str = join(' ', |
229 | 229 | array_map('map_attrs', |
230 | 230 | array_keys($attrs), |
231 | - array_values($attrs) ) ); |
|
231 | + array_values($attrs))); |
|
232 | 232 | |
233 | - $this->append_content( "<$element $attrs_str>" ); |
|
233 | + $this->append_content("<$element $attrs_str>"); |
|
234 | 234 | |
235 | - array_unshift( $this->stack, $el ); |
|
235 | + array_unshift($this->stack, $el); |
|
236 | 236 | } |
237 | 237 | |
238 | 238 | // Atom support many links per containging element. |
239 | 239 | // Magpie treats link elements of type rel='alternate' |
240 | 240 | // as being equivalent to RSS's simple link element. |
241 | 241 | // |
242 | - elseif ($this->feed_type == ATOM and $el == 'link' ) |
|
242 | + elseif ($this->feed_type == ATOM and $el == 'link') |
|
243 | 243 | { |
244 | - if ( isset($attrs['rel']) and $attrs['rel'] == 'alternate' ) |
|
244 | + if (isset($attrs['rel']) and $attrs['rel'] == 'alternate') |
|
245 | 245 | { |
246 | 246 | $link_el = 'link'; |
247 | 247 | } |
248 | 248 | else { |
249 | - $link_el = 'link_' . $attrs['rel']; |
|
249 | + $link_el = 'link_'.$attrs['rel']; |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | $this->append($link_el, $attrs['href']); |
@@ -259,11 +259,11 @@ discard block |
||
259 | 259 | |
260 | 260 | |
261 | 261 | |
262 | - function feed_cdata ($p, $text) { |
|
262 | + function feed_cdata($p, $text) { |
|
263 | 263 | |
264 | 264 | if ($this->feed_type == ATOM and $this->incontent) |
265 | 265 | { |
266 | - $this->append_content( $text ); |
|
266 | + $this->append_content($text); |
|
267 | 267 | } |
268 | 268 | else { |
269 | 269 | $current_el = join('_', array_reverse($this->stack)); |
@@ -271,35 +271,35 @@ discard block |
||
271 | 271 | } |
272 | 272 | } |
273 | 273 | |
274 | - function feed_end_element ($p, $el) { |
|
274 | + function feed_end_element($p, $el) { |
|
275 | 275 | $el = strtolower($el); |
276 | 276 | |
277 | - if ( $el == 'item' or $el == 'entry' ) |
|
277 | + if ($el == 'item' or $el == 'entry') |
|
278 | 278 | { |
279 | 279 | $this->items[] = $this->current_item; |
280 | 280 | $this->current_item = array(); |
281 | 281 | $this->initem = false; |
282 | 282 | } |
283 | - elseif ($this->feed_type == RSS and $this->current_namespace == '' and $el == 'textinput' ) |
|
283 | + elseif ($this->feed_type == RSS and $this->current_namespace == '' and $el == 'textinput') |
|
284 | 284 | { |
285 | 285 | $this->intextinput = false; |
286 | 286 | } |
287 | - elseif ($this->feed_type == RSS and $this->current_namespace == '' and $el == 'image' ) |
|
287 | + elseif ($this->feed_type == RSS and $this->current_namespace == '' and $el == 'image') |
|
288 | 288 | { |
289 | 289 | $this->inimage = false; |
290 | 290 | } |
291 | - elseif ($this->feed_type == ATOM and in_array($el, $this->_CONTENT_CONSTRUCTS) ) |
|
291 | + elseif ($this->feed_type == ATOM and in_array($el, $this->_CONTENT_CONSTRUCTS)) |
|
292 | 292 | { |
293 | 293 | $this->incontent = false; |
294 | 294 | } |
295 | - elseif ($el == 'channel' or $el == 'feed' ) |
|
295 | + elseif ($el == 'channel' or $el == 'feed') |
|
296 | 296 | { |
297 | 297 | $this->inchannel = false; |
298 | 298 | } |
299 | - elseif ($this->feed_type == ATOM and $this->incontent ) { |
|
299 | + elseif ($this->feed_type == ATOM and $this->incontent) { |
|
300 | 300 | // balance tags properly |
301 | 301 | // note: i don't think this is actually neccessary |
302 | - if ( $this->stack[0] == $el ) |
|
302 | + if ($this->stack[0] == $el) |
|
303 | 303 | { |
304 | 304 | $this->append_content("</$el>"); |
305 | 305 | } |
@@ -307,18 +307,18 @@ discard block |
||
307 | 307 | $this->append_content("<$el />"); |
308 | 308 | } |
309 | 309 | |
310 | - array_shift( $this->stack ); |
|
310 | + array_shift($this->stack); |
|
311 | 311 | } |
312 | 312 | else { |
313 | - array_shift( $this->stack ); |
|
313 | + array_shift($this->stack); |
|
314 | 314 | } |
315 | 315 | |
316 | 316 | $this->current_namespace = false; |
317 | 317 | } |
318 | 318 | |
319 | - function concat (&$str1, $str2="") { |
|
320 | - if (!isset($str1) ) { |
|
321 | - $str1=""; |
|
319 | + function concat(&$str1, $str2 = "") { |
|
320 | + if (!isset($str1)) { |
|
321 | + $str1 = ""; |
|
322 | 322 | } |
323 | 323 | $str1 .= $str2; |
324 | 324 | } |
@@ -326,11 +326,11 @@ discard block |
||
326 | 326 | |
327 | 327 | |
328 | 328 | function append_content($text) { |
329 | - if ( $this->initem ) { |
|
330 | - $this->concat( $this->current_item[ $this->incontent ], $text ); |
|
329 | + if ($this->initem) { |
|
330 | + $this->concat($this->current_item[$this->incontent], $text); |
|
331 | 331 | } |
332 | - elseif ( $this->inchannel ) { |
|
333 | - $this->concat( $this->channel[ $this->incontent ], $text ); |
|
332 | + elseif ($this->inchannel) { |
|
333 | + $this->concat($this->channel[$this->incontent], $text); |
|
334 | 334 | } |
335 | 335 | } |
336 | 336 | |
@@ -339,61 +339,61 @@ discard block |
||
339 | 339 | if (!$el) { |
340 | 340 | return; |
341 | 341 | } |
342 | - if ( $this->current_namespace ) |
|
342 | + if ($this->current_namespace) |
|
343 | 343 | { |
344 | - if ( $this->initem ) { |
|
344 | + if ($this->initem) { |
|
345 | 345 | $this->concat( |
346 | - $this->current_item[ $this->current_namespace ][ $el ], $text); |
|
346 | + $this->current_item[$this->current_namespace][$el], $text); |
|
347 | 347 | } |
348 | 348 | elseif ($this->inchannel) { |
349 | 349 | $this->concat( |
350 | - $this->channel[ $this->current_namespace][ $el ], $text ); |
|
350 | + $this->channel[$this->current_namespace][$el], $text ); |
|
351 | 351 | } |
352 | 352 | elseif ($this->intextinput) { |
353 | 353 | $this->concat( |
354 | - $this->textinput[ $this->current_namespace][ $el ], $text ); |
|
354 | + $this->textinput[$this->current_namespace][$el], $text ); |
|
355 | 355 | } |
356 | 356 | elseif ($this->inimage) { |
357 | 357 | $this->concat( |
358 | - $this->image[ $this->current_namespace ][ $el ], $text ); |
|
358 | + $this->image[$this->current_namespace][$el], $text ); |
|
359 | 359 | } |
360 | 360 | } |
361 | 361 | else { |
362 | - if ( $this->initem ) { |
|
362 | + if ($this->initem) { |
|
363 | 363 | $this->concat( |
364 | - $this->current_item[ $el ], $text); |
|
364 | + $this->current_item[$el], $text); |
|
365 | 365 | } |
366 | 366 | elseif ($this->intextinput) { |
367 | 367 | $this->concat( |
368 | - $this->textinput[ $el ], $text ); |
|
368 | + $this->textinput[$el], $text ); |
|
369 | 369 | } |
370 | 370 | elseif ($this->inimage) { |
371 | 371 | $this->concat( |
372 | - $this->image[ $el ], $text ); |
|
372 | + $this->image[$el], $text ); |
|
373 | 373 | } |
374 | 374 | elseif ($this->inchannel) { |
375 | 375 | $this->concat( |
376 | - $this->channel[ $el ], $text ); |
|
376 | + $this->channel[$el], $text ); |
|
377 | 377 | } |
378 | 378 | |
379 | 379 | } |
380 | 380 | } |
381 | 381 | |
382 | - function normalize () { |
|
382 | + function normalize() { |
|
383 | 383 | // if atom populate rss fields |
384 | - if ( $this->is_atom() ) { |
|
384 | + if ($this->is_atom()) { |
|
385 | 385 | $this->channel['description'] = $this->channel['tagline']; |
386 | - for ( $i = 0; $i < count($this->items); $i++) { |
|
386 | + for ($i = 0; $i<count($this->items); $i++) { |
|
387 | 387 | $item = $this->items[$i]; |
388 | - if ( isset($item['summary']) ) |
|
388 | + if (isset($item['summary'])) |
|
389 | 389 | $item['description'] = $item['summary']; |
390 | - if ( isset($item['atom_content'])) |
|
390 | + if (isset($item['atom_content'])) |
|
391 | 391 | $item['content']['encoded'] = $item['atom_content']; |
392 | 392 | |
393 | - $atom_date = (isset($item['issued']) ) ? $item['issued'] : @$item['modified']; |
|
394 | - if ( $atom_date ) { |
|
393 | + $atom_date = (isset($item['issued'])) ? $item['issued'] : @$item['modified']; |
|
394 | + if ($atom_date) { |
|
395 | 395 | $epoch = @parse_w3cdtf($atom_date); |
396 | - if ($epoch and $epoch > 0) { |
|
396 | + if ($epoch and $epoch>0) { |
|
397 | 397 | $item['date_timestamp'] = $epoch; |
398 | 398 | } |
399 | 399 | } |
@@ -401,24 +401,24 @@ discard block |
||
401 | 401 | $this->items[$i] = $item; |
402 | 402 | } |
403 | 403 | } |
404 | - elseif ( $this->is_rss() ) { |
|
404 | + elseif ($this->is_rss()) { |
|
405 | 405 | $this->channel['tagline'] = $this->channel['description']; |
406 | - for ( $i = 0; $i < count($this->items); $i++) { |
|
406 | + for ($i = 0; $i<count($this->items); $i++) { |
|
407 | 407 | $item = $this->items[$i]; |
408 | - if ( isset($item['description'])) |
|
408 | + if (isset($item['description'])) |
|
409 | 409 | $item['summary'] = $item['description']; |
410 | - if ( isset($item['content']['encoded'] ) ) |
|
410 | + if (isset($item['content']['encoded'])) |
|
411 | 411 | $item['atom_content'] = $item['content']['encoded']; |
412 | 412 | |
413 | - if ( $this->is_rss() == '1.0' and isset($item['dc']['date']) ) { |
|
413 | + if ($this->is_rss() == '1.0' and isset($item['dc']['date'])) { |
|
414 | 414 | $epoch = @parse_w3cdtf($item['dc']['date']); |
415 | - if ($epoch and $epoch > 0) { |
|
415 | + if ($epoch and $epoch>0) { |
|
416 | 416 | $item['date_timestamp'] = $epoch; |
417 | 417 | } |
418 | 418 | } |
419 | - elseif ( isset($item['pubdate']) ) { |
|
419 | + elseif (isset($item['pubdate'])) { |
|
420 | 420 | $epoch = @strtotime($item['pubdate']); |
421 | - if ($epoch > 0) { |
|
421 | + if ($epoch>0) { |
|
422 | 422 | $item['date_timestamp'] = $epoch; |
423 | 423 | } |
424 | 424 | } |
@@ -429,8 +429,8 @@ discard block |
||
429 | 429 | } |
430 | 430 | |
431 | 431 | |
432 | - function is_rss () { |
|
433 | - if ( $this->feed_type == RSS ) { |
|
432 | + function is_rss() { |
|
433 | + if ($this->feed_type == RSS) { |
|
434 | 434 | return $this->feed_version; |
435 | 435 | } |
436 | 436 | else { |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | } |
440 | 440 | |
441 | 441 | function is_atom() { |
442 | - if ( $this->feed_type == ATOM ) { |
|
442 | + if ($this->feed_type == ATOM) { |
|
443 | 443 | return $this->feed_version; |
444 | 444 | } |
445 | 445 | else { |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | * |
453 | 453 | */ |
454 | 454 | function create_parser($source, $out_enc, $in_enc, $detect) { |
455 | - if ( substr(phpversion(),0,1) == 5) { |
|
455 | + if (substr(phpversion(), 0, 1) == 5) { |
|
456 | 456 | $parser = $this->php5_create_parser($in_enc, $detect); |
457 | 457 | } |
458 | 458 | else { |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | */ |
478 | 478 | function php5_create_parser($in_enc, $detect) { |
479 | 479 | // by default php5 does a fine job of detecting input encodings |
480 | - if(!$detect && $in_enc) { |
|
480 | + if (!$detect && $in_enc) { |
|
481 | 481 | return xml_parser_create($in_enc); |
482 | 482 | } |
483 | 483 | else { |
@@ -501,7 +501,7 @@ discard block |
||
501 | 501 | * |
502 | 502 | */ |
503 | 503 | function php4_create_parser($source, $in_enc, $detect) { |
504 | - if ( !$detect ) { |
|
504 | + if (!$detect) { |
|
505 | 505 | return array(xml_parser_create($in_enc), $source); |
506 | 506 | } |
507 | 507 | |
@@ -553,7 +553,7 @@ discard block |
||
553 | 553 | |
554 | 554 | function known_encoding($enc) { |
555 | 555 | $enc = strtoupper($enc); |
556 | - if ( in_array($enc, $this->_KNOWN_ENCODINGS) ) { |
|
556 | + if (in_array($enc, $this->_KNOWN_ENCODINGS)) { |
|
557 | 557 | return $enc; |
558 | 558 | } |
559 | 559 | else { |
@@ -561,22 +561,22 @@ discard block |
||
561 | 561 | } |
562 | 562 | } |
563 | 563 | |
564 | - function error ($errormsg, $lvl=E_USER_WARNING) { |
|
564 | + function error($errormsg, $lvl = E_USER_WARNING) { |
|
565 | 565 | // append PHP's error message if track_errors enabled |
566 | - if ( !empty($php_errormsg) ) { |
|
566 | + if (!empty($php_errormsg)) { |
|
567 | 567 | $errormsg .= " ($php_errormsg)"; |
568 | 568 | } |
569 | - if ( MAGPIE_DEBUG ) { |
|
570 | - trigger_error( $errormsg, $lvl); |
|
569 | + if (MAGPIE_DEBUG) { |
|
570 | + trigger_error($errormsg, $lvl); |
|
571 | 571 | } |
572 | 572 | else { |
573 | - error_log( $errormsg, 0); |
|
573 | + error_log($errormsg, 0); |
|
574 | 574 | } |
575 | 575 | |
576 | - $notices = E_USER_NOTICE|E_NOTICE; |
|
577 | - if ( $lvl&$notices ) { |
|
576 | + $notices = E_USER_NOTICE | E_NOTICE; |
|
577 | + if ($lvl & $notices) { |
|
578 | 578 | $this->WARNING = $errormsg; |
579 | - } else { |
|
579 | + }else { |
|
580 | 580 | $this->ERROR = $errormsg; |
581 | 581 | } |
582 | 582 | } |
@@ -589,41 +589,41 @@ discard block |
||
589 | 589 | } |
590 | 590 | |
591 | 591 | |
592 | -function parse_w3cdtf ( $date_str ) { |
|
592 | +function parse_w3cdtf($date_str) { |
|
593 | 593 | |
594 | 594 | # regex to match wc3dtf |
595 | 595 | $pat = "/(\d{4})-(\d{2})-(\d{2})[T]?(\d{2})?[:]?(\d{2})?(:(\d{2}))?(?:([-+])(\d{2}):?(\d{2})|(Z))?/"; |
596 | 596 | |
597 | - if ( preg_match( $pat, $date_str, $match ) ) { |
|
598 | - list( $year, $month, $day, $hours, $minutes, $seconds) = |
|
599 | - array( $match[1], $match[2], $match[3], $match[4], $match[5], $match[6]); |
|
597 | + if (preg_match($pat, $date_str, $match)) { |
|
598 | + list($year, $month, $day, $hours, $minutes, $seconds) = |
|
599 | + array($match[1], $match[2], $match[3], $match[4], $match[5], $match[6]); |
|
600 | 600 | |
601 | 601 | # calc epoch for current date assuming GMT |
602 | - $epoch = gmmktime( intval($hours), intval($minutes), intval($seconds), intval($month), intval($day), intval($year)); |
|
602 | + $epoch = gmmktime(intval($hours), intval($minutes), intval($seconds), intval($month), intval($day), intval($year)); |
|
603 | 603 | |
604 | 604 | $offset = 0; |
605 | - if ( $match[10] == 'Z' ) { |
|
605 | + if ($match[10] == 'Z') { |
|
606 | 606 | # zulu time, aka GMT |
607 | 607 | } |
608 | 608 | else { |
609 | - list( $tz_mod, $tz_hour, $tz_min ) = |
|
610 | - array( $match[8], $match[9], $match[10]); |
|
609 | + list($tz_mod, $tz_hour, $tz_min) = |
|
610 | + array($match[8], $match[9], $match[10]); |
|
611 | 611 | |
612 | 612 | # zero out the variables |
613 | - if ( ! $tz_hour ) { $tz_hour = 0; } |
|
614 | - if ( ! $tz_min ) { $tz_min = 0; } |
|
613 | + if (!$tz_hour) { $tz_hour = 0; } |
|
614 | + if (!$tz_min) { $tz_min = 0; } |
|
615 | 615 | |
616 | 616 | $offset_secs = (($tz_hour*60)+$tz_min)*60; |
617 | 617 | |
618 | 618 | # is timezone ahead of GMT? then subtract offset |
619 | 619 | # |
620 | - if ( $tz_mod == '+' ) { |
|
621 | - $offset_secs = $offset_secs * -1; |
|
620 | + if ($tz_mod == '+') { |
|
621 | + $offset_secs = $offset_secs*-1; |
|
622 | 622 | } |
623 | 623 | |
624 | 624 | $offset = $offset_secs; |
625 | 625 | } |
626 | - $epoch = $epoch + $offset; |
|
626 | + $epoch = $epoch+$offset; |
|
627 | 627 | return $epoch; |
628 | 628 | } |
629 | 629 | else { |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * |
45 | 45 | * {@link XoopsObject} |
46 | 46 | **/ |
47 | -if(!class_exists("Bblog")): |
|
47 | +if (!class_exists("Bblog")): |
|
48 | 48 | |
49 | 49 | class Bblog extends ArtObject |
50 | 50 | { |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | * @param string $format format of time |
104 | 104 | * @return string |
105 | 105 | */ |
106 | - function getTime($format ="") |
|
106 | + function getTime($format = "") |
|
107 | 107 | { |
108 | 108 | $time = planet_formatTimestamp($this->getVar("blog_time"), $format); |
109 | 109 | return $time; |
@@ -128,9 +128,9 @@ discard block |
||
128 | 128 | */ |
129 | 129 | function getRatingAverage($decimals = 1) |
130 | 130 | { |
131 | - $ave=3; |
|
132 | - if($this->getVar("blog_rates")){ |
|
133 | - $ave = number_format($this->getVar("blog_rating")/$this->getVar("blog_rates"),$decimals); |
|
131 | + $ave = 3; |
|
132 | + if ($this->getVar("blog_rates")) { |
|
133 | + $ave = number_format($this->getVar("blog_rating")/$this->getVar("blog_rates"), $decimals); |
|
134 | 134 | } |
135 | 135 | return $ave; |
136 | 136 | } |
@@ -31,7 +31,7 @@ |
||
31 | 31 | include_once dirname(dirname(__FILE__))."/include/vars.php"; |
32 | 32 | mod_loadFunctions("", $GLOBALS["moddirname"]); |
33 | 33 | |
34 | -if(!class_exists("Brate")): |
|
34 | +if (!class_exists("Brate")): |
|
35 | 35 | class Brate extends ArtObject |
36 | 36 | { |
37 | 37 | function Brate($id = null) |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | // Project: Article Project // |
26 | 26 | // ------------------------------------------------------------------------ // |
27 | 27 | |
28 | -if (!defined('XOOPS_ROOT_PATH')){ exit(); } |
|
28 | +if (!defined('XOOPS_ROOT_PATH')) { exit(); } |
|
29 | 29 | include_once dirname(dirname(__FILE__))."/include/vars.php"; |
30 | 30 | mod_loadFunctions("", $GLOBALS["moddirname"]); |
31 | 31 | |
@@ -66,8 +66,8 @@ discard block |
||
66 | 66 | |
67 | 67 | // your local timezone, set to "" to disable or for GMT |
68 | 68 | $server_TZ = abs(intval($GLOBALS['xoopsConfig']['server_TZ']*3600.0)); |
69 | -$prefix = ($GLOBALS['xoopsConfig']['server_TZ']<0)?"-":"+"; |
|
70 | -$TIME_ZONE = $prefix.date("H:i",$server_TZ); |
|
69 | +$prefix = ($GLOBALS['xoopsConfig']['server_TZ']<0) ? "-" : "+"; |
|
70 | +$TIME_ZONE = $prefix.date("H:i", $server_TZ); |
|
71 | 71 | define("TIME_ZONE", $TIME_ZONE); |
72 | 72 | // Version string. |
73 | 73 | define("FEEDCREATOR_VERSION", "ARTICLE @ XOOPS powered by FeedCreator"); |
@@ -81,31 +81,31 @@ discard block |
||
81 | 81 | * @return type description |
82 | 82 | * @link |
83 | 83 | */ |
84 | -if(!class_exists("Xmlfeed")){ |
|
84 | +if (!class_exists("Xmlfeed")) { |
|
85 | 85 | class Bxmlfeed extends UniversalFeedCreator |
86 | 86 | { |
87 | 87 | var $version; |
88 | - var $filename= ""; |
|
88 | + var $filename = ""; |
|
89 | 89 | |
90 | 90 | function Bxmlfeed($version) |
91 | 91 | { |
92 | - $this->filename= XOOPS_CACHE_PATH."/feed.xml"; |
|
92 | + $this->filename = XOOPS_CACHE_PATH."/feed.xml"; |
|
93 | 93 | $this->version = $version; |
94 | 94 | } |
95 | 95 | |
96 | 96 | function setVar($var, $val, $encoding = false) |
97 | 97 | { |
98 | - if(!empty($encoding)) $val = $this->convert_encoding($val); |
|
98 | + if (!empty($encoding)) $val = $this->convert_encoding($val); |
|
99 | 99 | $this->$var = $val; |
100 | 100 | } |
101 | 101 | |
102 | 102 | function convert_encoding($val) |
103 | 103 | { |
104 | - if(is_array($val)){ |
|
105 | - foreach(array_keys($val) as $key){ |
|
104 | + if (is_array($val)) { |
|
105 | + foreach (array_keys($val) as $key) { |
|
106 | 106 | $val[$key] = $this->convert_encoding($val[$key]); |
107 | 107 | } |
108 | - }else{ |
|
108 | + }else { |
|
109 | 109 | $val = XoopsLocal::convert_encoding($val, $this->encoding, _CHARSET); |
110 | 110 | } |
111 | 111 | return $val; |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | function setImage(&$img) |
120 | 120 | { |
121 | 121 | $image = new FeedImage(); |
122 | - foreach($img as $key=>$val){ |
|
122 | + foreach ($img as $key=>$val) { |
|
123 | 123 | $image->$key = $this->convert_encoding($val); |
124 | 124 | } |
125 | 125 | $this->setVar("image", $image); |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | function _addItem(&$itm) |
129 | 129 | { |
130 | 130 | $item = new FeedItem(); |
131 | - foreach($itm as $key=>$val){ |
|
131 | + foreach ($itm as $key=>$val) { |
|
132 | 132 | $item->$key = $this->convert_encoding($val); |
133 | 133 | } |
134 | 134 | $this->addItem($item); |
@@ -136,8 +136,8 @@ discard block |
||
136 | 136 | |
137 | 137 | function addItems(&$items) |
138 | 138 | { |
139 | - if(!is_array($items) || count($items)==0) return; |
|
140 | - foreach($items as $item){ |
|
139 | + if (!is_array($items) || count($items) == 0) return; |
|
140 | + foreach ($items as $item) { |
|
141 | 141 | $this->_addItem($item); |
142 | 142 | } |
143 | 143 | } |
@@ -44,7 +44,7 @@ |
||
44 | 44 | * |
45 | 45 | * {@link XoopsObject} |
46 | 46 | **/ |
47 | -if(!class_exists("Bcategory")): |
|
47 | +if (!class_exists("Bcategory")): |
|
48 | 48 | |
49 | 49 | class Bcategory extends ArtObject |
50 | 50 | { |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | class IXR_Value { |
14 | 14 | var $data; |
15 | 15 | var $type; |
16 | - function IXR_Value ($data, $type = false) { |
|
16 | + function IXR_Value($data, $type = false) { |
|
17 | 17 | $this->data = $data; |
18 | 18 | if (!$type) { |
19 | 19 | $type = $this->calculateType(); |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | } |
27 | 27 | } |
28 | 28 | if ($type == 'array') { |
29 | - for ($i = 0, $j = count($this->data); $i < $j; $i++) { |
|
29 | + for ($i = 0, $j = count($this->data); $i<$j; $i++) { |
|
30 | 30 | $this->data[$i] = new IXR_Value($this->data[$i]); |
31 | 31 | } |
32 | 32 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | /* We have an array - is it an array or a struct ? */ |
61 | 61 | if ($this->isStruct($this->data)) { |
62 | 62 | return 'struct'; |
63 | - } else { |
|
63 | + }else { |
|
64 | 64 | return 'array'; |
65 | 65 | } |
66 | 66 | } |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | /* Nasty function to check if an array is a struct or not */ |
108 | 108 | $expected = 0; |
109 | 109 | foreach ($array as $key => $value) { |
110 | - if ((string)$key != (string)$expected) { |
|
110 | + if ((string) $key != (string) $expected) { |
|
111 | 111 | return true; |
112 | 112 | } |
113 | 113 | $expected++; |
@@ -119,22 +119,22 @@ discard block |
||
119 | 119 | |
120 | 120 | class IXR_Message { |
121 | 121 | var $message; |
122 | - var $messageType; // methodCall / methodResponse / fault |
|
122 | + var $messageType; // methodCall / methodResponse / fault |
|
123 | 123 | var $faultCode; |
124 | 124 | var $faultString; |
125 | 125 | var $methodName; |
126 | 126 | var $params; |
127 | 127 | // Current variable stacks |
128 | - var $_arraystructs = array(); // The stack used to keep track of the current array/struct |
|
128 | + var $_arraystructs = array(); // The stack used to keep track of the current array/struct |
|
129 | 129 | var $_arraystructstypes = array(); // Stack keeping track of if things are structs or array |
130 | - var $_currentStructName = array(); // A stack as well |
|
130 | + var $_currentStructName = array(); // A stack as well |
|
131 | 131 | var $_param; |
132 | 132 | var $_value; |
133 | 133 | var $_currentTag; |
134 | 134 | var $_currentTagContents; |
135 | 135 | // The XML parser |
136 | 136 | var $_parser; |
137 | - function IXR_Message ($message) { |
|
137 | + function IXR_Message($message) { |
|
138 | 138 | $this->message = $message; |
139 | 139 | } |
140 | 140 | function parse() { |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | } |
167 | 167 | function tag_open($parser, $tag, $attr) { |
168 | 168 | $this->currentTag = $tag; |
169 | - switch($tag) { |
|
169 | + switch ($tag) { |
|
170 | 170 | case 'methodCall': |
171 | 171 | case 'methodResponse': |
172 | 172 | case 'fault': |
@@ -188,20 +188,20 @@ discard block |
||
188 | 188 | } |
189 | 189 | function tag_close($parser, $tag) { |
190 | 190 | $valueFlag = false; |
191 | - switch($tag) { |
|
191 | + switch ($tag) { |
|
192 | 192 | case 'int': |
193 | 193 | case 'i4': |
194 | - $value = (int)trim($this->_currentTagContents); |
|
194 | + $value = (int) trim($this->_currentTagContents); |
|
195 | 195 | $this->_currentTagContents = ''; |
196 | 196 | $valueFlag = true; |
197 | 197 | break; |
198 | 198 | case 'double': |
199 | - $value = (double)trim($this->_currentTagContents); |
|
199 | + $value = (double) trim($this->_currentTagContents); |
|
200 | 200 | $this->_currentTagContents = ''; |
201 | 201 | $valueFlag = true; |
202 | 202 | break; |
203 | 203 | case 'string': |
204 | - $value = (string)trim($this->_currentTagContents); |
|
204 | + $value = (string) trim($this->_currentTagContents); |
|
205 | 205 | $this->_currentTagContents = ''; |
206 | 206 | $valueFlag = true; |
207 | 207 | break; |
@@ -214,18 +214,18 @@ discard block |
||
214 | 214 | case 'value': |
215 | 215 | // "If no type is indicated, the type is string." |
216 | 216 | if (trim($this->_currentTagContents) != '') { |
217 | - $value = (string)$this->_currentTagContents; |
|
217 | + $value = (string) $this->_currentTagContents; |
|
218 | 218 | $this->_currentTagContents = ''; |
219 | 219 | $valueFlag = true; |
220 | 220 | } |
221 | 221 | break; |
222 | 222 | case 'boolean': |
223 | - $value = (boolean)trim($this->_currentTagContents); |
|
223 | + $value = (boolean) trim($this->_currentTagContents); |
|
224 | 224 | $this->_currentTagContents = ''; |
225 | 225 | $valueFlag = true; |
226 | 226 | break; |
227 | 227 | case 'base64': |
228 | - $value = base64_decode( trim($this->_currentTagContents) ); |
|
228 | + $value = base64_decode(trim($this->_currentTagContents)); |
|
229 | 229 | $this->_currentTagContents = ''; |
230 | 230 | $valueFlag = true; |
231 | 231 | break; |
@@ -254,16 +254,16 @@ discard block |
||
254 | 254 | $value = trim($value); |
255 | 255 | } |
256 | 256 | */ |
257 | - if (count($this->_arraystructs) > 0) { |
|
257 | + if (count($this->_arraystructs)>0) { |
|
258 | 258 | // Add value to struct or array |
259 | 259 | if ($this->_arraystructstypes[count($this->_arraystructstypes)-1] == 'struct') { |
260 | 260 | // Add to struct |
261 | 261 | $this->_arraystructs[count($this->_arraystructs)-1][$this->_currentStructName[count($this->_currentStructName)-1]] = $value; |
262 | - } else { |
|
262 | + }else { |
|
263 | 263 | // Add to array |
264 | 264 | $this->_arraystructs[count($this->_arraystructs)-1][] = $value; |
265 | 265 | } |
266 | - } else { |
|
266 | + }else { |
|
267 | 267 | // Just add as a paramater |
268 | 268 | $this->params[] = $value; |
269 | 269 | } |
@@ -343,13 +343,13 @@ discard block |
||
343 | 343 | } |
344 | 344 | // Call the method |
345 | 345 | $result = $this->$method($args); |
346 | - } else { |
|
346 | + }else { |
|
347 | 347 | // It's a function - does it exist? |
348 | 348 | if (is_array($method)) { |
349 | 349 | if (!method_exists($method[0], $method[1])) { |
350 | 350 | return new IXR_Error(-32601, 'server error. requested object method "'.$method[1].'" does not exist.'); |
351 | 351 | } |
352 | - } else if (!function_exists($method)) { |
|
352 | + }else if (!function_exists($method)) { |
|
353 | 353 | return new IXR_Error(-32601, 'server error. requested function "'.$method.'" does not exist.'); |
354 | 354 | } |
355 | 355 | // Call the function |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | $params = $call['params']; |
417 | 417 | if ($method == 'system.multicall') { |
418 | 418 | $result = new IXR_Error(-32600, 'Recursive calls to system.multicall are forbidden'); |
419 | - } else { |
|
419 | + }else { |
|
420 | 420 | $result = $this->call($method, $params); |
421 | 421 | } |
422 | 422 | if (is_a($result, 'IXR_Error')) { |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | 'faultCode' => $result->code, |
425 | 425 | 'faultString' => $result->message |
426 | 426 | ); |
427 | - } else { |
|
427 | + }else { |
|
428 | 428 | $return[] = array($result); |
429 | 429 | } |
430 | 430 | } |
@@ -486,7 +486,7 @@ discard block |
||
486 | 486 | if (!$this->path) { |
487 | 487 | $this->path = '/'; |
488 | 488 | } |
489 | - } else { |
|
489 | + }else { |
|
490 | 490 | $this->server = $server; |
491 | 491 | $this->path = $path; |
492 | 492 | $this->port = $port; |
@@ -615,7 +615,7 @@ discard block |
||
615 | 615 | // $time can be a PHP timestamp or an ISO one |
616 | 616 | if (is_numeric($time)) { |
617 | 617 | $this->parseTimestamp($time); |
618 | - } else { |
|
618 | + }else { |
|
619 | 619 | $this->parseIso($time); |
620 | 620 | } |
621 | 621 | } |
@@ -719,7 +719,7 @@ discard block |
||
719 | 719 | // Check the argument types |
720 | 720 | $ok = true; |
721 | 721 | $argsbackup = $args; |
722 | - for ($i = 0, $j = count($args); $i < $j; $i++) { |
|
722 | + for ($i = 0, $j = count($args); $i<$j; $i++) { |
|
723 | 723 | $arg = array_shift($args); |
724 | 724 | $type = array_shift($signature); |
725 | 725 | switch ($type) { |
@@ -62,9 +62,9 @@ discard block |
||
62 | 62 | * out. |
63 | 63 | * |
64 | 64 | */ |
65 | - function XmlParser ($content, $input_charset, $output_charset = _CHARSET, $tags = array()) |
|
65 | + function XmlParser($content, $input_charset, $output_charset = _CHARSET, $tags = array()) |
|
66 | 66 | { |
67 | - if(!in_array(strtoupper($input_charset), array("UTF-8", "US-ASCII", "ISO-8859-1"))) { |
|
67 | + if (!in_array(strtoupper($input_charset), array("UTF-8", "US-ASCII", "ISO-8859-1"))) { |
|
68 | 68 | $content = XoopsLocal::convert_encoding($content, "UTF-8", $input_charset); |
69 | 69 | $content = preg_replace('/(<\?xml.*encoding=[\'"])(.*?)([\'"].*\?>)/m', '$1UTF-8$3', $content); |
70 | 70 | $input_charset = "UTF-8"; |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | $this->charset_out = $output_charset; |
75 | 75 | |
76 | 76 | /* TODO: parse specified tags only */ |
77 | - $this->MagpieRSS( $content, $input_charset, $input_charset, false ); |
|
77 | + $this->MagpieRSS($content, $input_charset, $input_charset, false); |
|
78 | 78 | |
79 | 79 | //xoops_message($this); |
80 | 80 | unset($this->content); |
@@ -82,8 +82,8 @@ discard block |
||
82 | 82 | } |
83 | 83 | |
84 | 84 | function is_atom() { |
85 | - if ( $this->feed_type == ATOM ) { |
|
86 | - $this->feed_version = empty($this->feed_version)?"0.3":$this->feed_version; |
|
85 | + if ($this->feed_type == ATOM) { |
|
86 | + $this->feed_version = empty($this->feed_version) ? "0.3" : $this->feed_version; |
|
87 | 87 | return $this->feed_version; |
88 | 88 | } |
89 | 89 | else { |
@@ -91,94 +91,94 @@ discard block |
||
91 | 91 | } |
92 | 92 | } |
93 | 93 | |
94 | - function normalize () { |
|
95 | - if ( $this->is_atom() ): |
|
96 | - if(empty($this->channel["tagline"])){ |
|
94 | + function normalize() { |
|
95 | + if ($this->is_atom()): |
|
96 | + if (empty($this->channel["tagline"])) { |
|
97 | 97 | /* ATOM */ |
98 | 98 | $this->channel["tagline"] = @$this->channel["subtitle"]; |
99 | 99 | unset($this->channel["subtitle"]); |
100 | 100 | } |
101 | - for ( $i = 0; $i < count($this->items); $i++) { |
|
101 | + for ($i = 0; $i<count($this->items); $i++) { |
|
102 | 102 | // ATOM time |
103 | - if($date = @$this->items[$i]['modified']) continue; |
|
104 | - if(empty($date)){ |
|
103 | + if ($date = @$this->items[$i]['modified']) continue; |
|
104 | + if (empty($date)) { |
|
105 | 105 | $date = @$this->items[$i]['updated']; |
106 | 106 | } |
107 | - if(empty($date)){ |
|
107 | + if (empty($date)) { |
|
108 | 108 | $date = @$this->items[$i]['issued']; |
109 | 109 | } |
110 | - if(empty($date)){ |
|
110 | + if (empty($date)) { |
|
111 | 111 | $date = @$this->items[$i]['created']; |
112 | 112 | } |
113 | - if(empty($date)){ |
|
113 | + if (empty($date)) { |
|
114 | 114 | $date = @$this->items[$i]['created']; |
115 | 115 | } |
116 | 116 | $this->items[$i]['modified'] = $date; |
117 | 117 | } |
118 | - elseif($this->is_rss() != '1.0'): |
|
119 | - for ( $i = 0; $i < count($this->items); $i++) { |
|
120 | - if($date = @$this->items[$i]['pubdate']) continue; |
|
118 | + elseif ($this->is_rss() != '1.0'): |
|
119 | + for ($i = 0; $i<count($this->items); $i++) { |
|
120 | + if ($date = @$this->items[$i]['pubdate']) continue; |
|
121 | 121 | $this->items[$i]['pubdate'] = @$this->items[$i]['dc']['date']; |
122 | 122 | } |
123 | 123 | endif; |
124 | 124 | parent::normalize(); |
125 | 125 | /* ATOM */ |
126 | - if(empty($this->channel["language"]) && !empty($this->channel["dc"]["language"]) ) { |
|
126 | + if (empty($this->channel["language"]) && !empty($this->channel["dc"]["language"])) { |
|
127 | 127 | $this->channel["language"] = $this->channel["dc"]["language"]; |
128 | 128 | unset($this->channel["dc"]["language"]); |
129 | 129 | } |
130 | - if(empty($this->channel["language"]) && preg_match('/<link.*hreflang=[\'"](.*?)[\'"].*?>/m', $this->content, $match) ) { |
|
130 | + if (empty($this->channel["language"]) && preg_match('/<link.*hreflang=[\'"](.*?)[\'"].*?>/m', $this->content, $match)) { |
|
131 | 131 | $this->channel["language"] = $match[1]; |
132 | 132 | } |
133 | - if(empty($this->channel["language"]) && preg_match('/<feed.*xml:lang=[\'"](.*?)[\'"].*?>/m', $this->content, $match) ) { |
|
133 | + if (empty($this->channel["language"]) && preg_match('/<feed.*xml:lang=[\'"](.*?)[\'"].*?>/m', $this->content, $match)) { |
|
134 | 134 | $this->channel["language"] = $match[1]; |
135 | 135 | } |
136 | 136 | /* remove to avoid redundant encoding conversion */ |
137 | - if(!empty($this->channel["tagline"])){ |
|
137 | + if (!empty($this->channel["tagline"])) { |
|
138 | 138 | unset($this->channel["tagline"]); |
139 | 139 | } |
140 | 140 | |
141 | - for ( $i = 0; $i < count($this->items); $i++) { |
|
142 | - if($date_timestamp = @$this->items[$i]['date_timestamp']) continue; |
|
143 | - if($date_timestamp = @$this->items[$i]['pubdate']){ |
|
141 | + for ($i = 0; $i<count($this->items); $i++) { |
|
142 | + if ($date_timestamp = @$this->items[$i]['date_timestamp']) continue; |
|
143 | + if ($date_timestamp = @$this->items[$i]['pubdate']) { |
|
144 | 144 | $this->items[$i]['date_timestamp'] = $date_timestamp; |
145 | - }elseif($date_timestamp = @$this->items[$i]['dc']['date']){ |
|
145 | + }elseif ($date_timestamp = @$this->items[$i]['dc']['date']) { |
|
146 | 146 | $this->items[$i]['date_timestamp'] = $date_timestamp; |
147 | - }else{ |
|
147 | + }else { |
|
148 | 148 | $this->items[$i]['date_timestamp'] = time(); |
149 | 149 | } |
150 | - if(!is_numeric($this->items[$i]['date_timestamp'])){ |
|
151 | - if($date = parse_w3cdtf($this->items[$i]['date_timestamp'])) { |
|
150 | + if (!is_numeric($this->items[$i]['date_timestamp'])) { |
|
151 | + if ($date = parse_w3cdtf($this->items[$i]['date_timestamp'])) { |
|
152 | 152 | $this->items[$i]['date_timestamp'] = $date; |
153 | - }elseif($date = strtotime($this->items[$i]['date_timestamp'])) { |
|
153 | + }elseif ($date = strtotime($this->items[$i]['date_timestamp'])) { |
|
154 | 154 | $this->items[$i]['date_timestamp'] = $date; |
155 | 155 | } |
156 | 156 | } |
157 | 157 | |
158 | 158 | /* remove to avoid redundant encoding conversion */ |
159 | - if ( isset($this->items[$i]['summary']) ) |
|
159 | + if (isset($this->items[$i]['summary'])) |
|
160 | 160 | unset($this->items[$i]['summary']); |
161 | - if ( isset($this->items[$i]['atom_content'])) |
|
161 | + if (isset($this->items[$i]['atom_content'])) |
|
162 | 162 | unset($this->items[$i]['atom_content']); |
163 | 163 | } |
164 | 164 | return; |
165 | 165 | } |
166 | 166 | |
167 | - function encoding_convert($tags = array()){ |
|
168 | - if(empty($tags) || in_array("channel", $tags)){ |
|
167 | + function encoding_convert($tags = array()) { |
|
168 | + if (empty($tags) || in_array("channel", $tags)) { |
|
169 | 169 | $this->channel = $this->_encoding($this->channel); |
170 | 170 | } |
171 | - if(empty($tags) || in_array("items", $tags)){ |
|
171 | + if (empty($tags) || in_array("items", $tags)) { |
|
172 | 172 | $this->items = $this->_encoding($this->items); |
173 | 173 | } |
174 | 174 | } |
175 | 175 | |
176 | - function _encoding($val){ |
|
177 | - if(is_array($val)){ |
|
178 | - foreach(array_keys($val) as $key){ |
|
176 | + function _encoding($val) { |
|
177 | + if (is_array($val)) { |
|
178 | + foreach (array_keys($val) as $key) { |
|
179 | 179 | $val[$key] = $this->_encoding($val[$key]); |
180 | 180 | } |
181 | - }else{ |
|
181 | + }else { |
|
182 | 182 | $val = XoopsLocal::convert_encoding($val, $this->charset_out, $this->charset_in); |
183 | 183 | } |
184 | 184 | return $val; |
@@ -25,11 +25,11 @@ discard block |
||
25 | 25 | // Project: Article Project // |
26 | 26 | // ------------------------------------------------------------------------ // |
27 | 27 | |
28 | -if (!defined('XOOPS_ROOT_PATH')){ exit(); } |
|
28 | +if (!defined('XOOPS_ROOT_PATH')) { exit(); } |
|
29 | 29 | include_once dirname(dirname(__FILE__))."/include/vars.php"; |
30 | 30 | mod_loadFunctions("", $GLOBALS["moddirname"]); |
31 | 31 | |
32 | -if(!class_exists("Xmlrpc_client")){ |
|
32 | +if (!class_exists("Xmlrpc_client")) { |
|
33 | 33 | class Xmlrpc_client |
34 | 34 | { |
35 | 35 | function Xmlrpc_client() |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | } |
55 | 55 | |
56 | 56 | |
57 | -if(!class_exists("Xmlrpc_server")){ |
|
57 | +if (!class_exists("Xmlrpc_server")) { |
|
58 | 58 | class Xmlrpc_server |
59 | 59 | { |
60 | 60 |