| @@ -19,42 +19,40 @@ | ||
| 19 | 19 | var $image = array(); |
| 20 | 20 | |
| 21 | 21 | var $feed_type; |
| 22 | 22 | var $feed_version; |
| 23 | - /** @var string MIME ncoding (was missing). */ | |
| 24 | - var $encoding; | |
| 25 | 23 | |
| 26 | 24 | var $_XMLNS_FAMILIAR = array ( |
| 27 | 25 | 'http://www.w3.org/2005/Atom' => 'atom' /* 1.0 */, |
| 28 | - 'http://purl.org/atom/ns#' => 'atom' /* pre-1.0 */, | |
| 29 | - 'http://purl.org/rss/1.0/' => 'rss' /* 1.0 */, | |
| 30 | - 'http://backend.userland.com/RSS2' => 'rss' /* 2.0 */, | |
| 31 | - 'http://www.w3.org/1999/02/22-rdf-syntax-ns#' => 'rdf', | |
| 32 | - 'http://www.w3.org/1999/xhtml' => 'xhtml', | |
| 33 | - 'http://purl.org/dc/elements/1.1/' => 'dc', | |
| 34 | - 'http://purl.org/dc/terms/' => 'dcterms', | |
| 35 | - 'http://purl.org/rss/1.0/modules/content/' => 'content', | |
| 36 | - 'http://purl.org/rss/1.0/modules/syndication/' => 'sy', | |
| 37 | - 'http://purl.org/rss/1.0/modules/taxonomy/' => 'taxo', | |
| 38 | - 'http://purl.org/rss/1.0/modules/dc/' => 'dc', | |
| 39 | - 'http://wellformedweb.org/CommentAPI/' => 'wfw', | |
| 40 | - 'http://webns.net/mvcb/' => 'admin', | |
| 41 | - 'http://purl.org/rss/1.0/modules/annotate/' => 'annotate', | |
| 42 | - 'http://xmlns.com/foaf/0.1/' => 'foaf', | |
| 43 | - 'http://madskills.com/public/xml/rss/module/trackback/' => 'trackback', | |
| 44 | - 'http://web.resource.org/cc/' => 'cc', | |
| 45 | - 'http://search.yahoo.com/mrss' => 'media', | |
| 46 | - 'http://search.yahoo.com/mrss/' => 'media', | |
| 47 | - 'http://video.search.yahoo.com/mrss' => 'media', | |
| 48 | - 'http://video.search.yahoo.com/mrss/' => 'media', | |
| 49 | - 'http://purl.org/syndication/thread/1.0' => 'thr', | |
| 50 | - 'http://purl.org/syndication/thread/1.0/' => 'thr', | |
| 51 | - 'http://www.w3.org/XML/1998/namespace' => 'xml', | |
| 52 | - 'http://www.itunes.com/dtds/podcast-1.0.dtd' => 'itunes', | |
| 53 | - 'http://a9.com/-/spec/opensearchrss/1.0/' => 'openSearch', | |
| 54 | - 'http://purl.org/rss/1.0/modules/slash/' => 'slash', | |
| 55 | - 'http://www.google.com/schemas/reader/atom/' => 'gr', | |
| 56 | - 'urn:atom-extension:indexing' => 'indexing', | |
| 26 | + 'http://purl.org/atom/ns#' => 'atom' /* pre-1.0 */, | |
| 27 | + 'http://purl.org/rss/1.0/' => 'rss' /* 1.0 */, | |
| 28 | + 'http://backend.userland.com/RSS2' => 'rss' /* 2.0 */, | |
| 29 | + 'http://www.w3.org/1999/02/22-rdf-syntax-ns#' => 'rdf', | |
| 30 | + 'http://www.w3.org/1999/xhtml' => 'xhtml', | |
| 31 | + 'http://purl.org/dc/elements/1.1/' => 'dc', | |
| 32 | + 'http://purl.org/dc/terms/' => 'dcterms', | |
| 33 | + 'http://purl.org/rss/1.0/modules/content/' => 'content', | |
| 34 | + 'http://purl.org/rss/1.0/modules/syndication/' => 'sy', | |
| 35 | + 'http://purl.org/rss/1.0/modules/taxonomy/' => 'taxo', | |
| 36 | + 'http://purl.org/rss/1.0/modules/dc/' => 'dc', | |
| 37 | + 'http://wellformedweb.org/CommentAPI/' => 'wfw', | |
| 38 | + 'http://webns.net/mvcb/' => 'admin', | |
| 39 | + 'http://purl.org/rss/1.0/modules/annotate/' => 'annotate', | |
| 40 | + 'http://xmlns.com/foaf/0.1/' => 'foaf', | |
| 41 | + 'http://madskills.com/public/xml/rss/module/trackback/' => 'trackback', | |
| 42 | + 'http://web.resource.org/cc/' => 'cc', | |
| 43 | + 'http://search.yahoo.com/mrss' => 'media', | |
| 44 | + 'http://search.yahoo.com/mrss/' => 'media', | |
| 45 | + 'http://video.search.yahoo.com/mrss' => 'media', | |
| 46 | + 'http://video.search.yahoo.com/mrss/' => 'media', | |
| 47 | + 'http://purl.org/syndication/thread/1.0' => 'thr', | |
| 48 | + 'http://purl.org/syndication/thread/1.0/' => 'thr', | |
| 49 | + 'http://www.w3.org/XML/1998/namespace' => 'xml', | |
| 50 | + 'http://www.itunes.com/dtds/podcast-1.0.dtd' => 'itunes', | |
| 51 | + 'http://a9.com/-/spec/opensearchrss/1.0/' => 'openSearch', | |
| 52 | + 'http://purl.org/rss/1.0/modules/slash/' => 'slash', | |
| 53 | + 'http://www.google.com/schemas/reader/atom/' => 'gr', | |
| 54 | + 'urn:atom-extension:indexing' => 'indexing', | |
| 57 | 55 | ); |
| 58 | 56 | |
| 59 | 57 | /** |
| 60 | 58 | * MagpieFromSimplePie constructor |
| @@ -64,9 +62,9 @@ | ||
| 64 | 62 | * |
| 65 | 63 | * @uses SimplePie::get_items |
| 66 | 64 | * @uses MagpieFromSimplePie::processFeedData |
| 67 | 65 | * @uses MagpieFromSimplePie::processItemData |
| 68 | - * @uses MagpieFromSimplePie::normalize | |
| 66 | + * @uses MagpieFromSimplePie::normalize | |
| 69 | 67 | * @uses MagpieFromSimplePie::is_atom |
| 70 | 68 | */ |
| 71 | 69 | function __construct( $pie, $item = true ) { |
| 72 | 70 | $this->pie = $pie; |
| @@ -71,9 +69,9 @@ | ||
| 71 | 69 | function __construct( $pie, $item = true ) { |
| 72 | 70 | $this->pie = $pie; |
| 73 | 71 | |
| 74 | 72 | // item in {NULL, true} = process channel data |
| 75 | - if ( !is_a($item, 'SimplePie_Item')) : | |
| 73 | + if (!is_a($item, 'SimplePie_Item')) : | |
| 76 | 74 | $this->originals = $this->pie->get_items(); |
| 77 | 75 | |
| 78 | 76 | $this->channel = $this->processFeedData($this->pie->data); |
| 79 | 77 | else : |
| @@ -81,9 +79,9 @@ | ||
| 81 | 79 | $this->channel = NULL; |
| 82 | 80 | endif; |
| 83 | 81 | |
| 84 | 82 | // item in {true, SimplePie_Item} = process item data |
| 85 | - if ( !is_null($item)) : | |
| 83 | + if (!is_null($item)) : | |
| 86 | 84 | foreach ($this->originals as $key => $item) : |
| 87 | 85 | $this->items[$key] = $this->processItemData($item->data); |
| 88 | 86 | endforeach; |
| 89 | 87 | else : |
| @@ -90,9 +88,9 @@ | ||
| 90 | 88 | $this->items = NULL; |
| 91 | 89 | endif; |
| 92 | 90 | |
| 93 | 91 | $this->normalize(); |
| 94 | - | |
| 92 | + | |
| 95 | 93 | // In case anyone goes poking around our private members (uh...) |
| 96 | 94 | $this->feed_type = ($this->is_atom() ? 'Atom' : 'RSS'); |
| 97 | 95 | $this->feed_version = $this->feed_version(); |
| 98 | 96 | $this->encoding = $pie->get_encoding(); |
| @@ -100,20 +98,20 @@ | ||
| 100 | 98 | |
| 101 | 99 | function MagpieFromSimplePie( $pie, $item = true ) { |
| 102 | 100 | self::__construct( $pie, $item ); |
| 103 | 101 | } |
| 104 | - | |
| 102 | + | |
| 105 | 103 | /** |
| 106 | 104 | * MagpieFromSimplePie::get_items: returns an array of MagpieRSS format arrays |
| 107 | 105 | * equivalent to the SimplePie_Item objects in the SimplePie object from which this |
| 108 | 106 | * object was constructed. |
| 109 | - * | |
| 107 | + * | |
| 110 | 108 | * @return array An array of MagpieRSS-format arrays representing the items on this feed |
| 111 | 109 | */ |
| 112 | 110 | function get_items () { |
| 113 | 111 | return $this->items; |
| 114 | 112 | } /* MagpieFromSimplePie::get_items () */ |
| 115 | - | |
| 113 | + | |
| 116 | 114 | /** |
| 117 | 115 | * MagpieFromSimplePie::get_item: returns a single MagpieRSS format array equivalent |
| 118 | 116 | * to a SimplePie_Item object from which this object was constructed. |
| 119 | 117 | * |
| @@ -151,9 +149,9 @@ | ||
| 151 | 149 | ) as $ns) : |
| 152 | 150 | if (isset($element['child'][$ns]['entry'])) : unset($element['child'][$ns]['entry']); endif; |
| 153 | 151 | if (isset($element['child'][$ns]['item'])) : unset($element['child'][$ns]['item']); endif; |
| 154 | 152 | endforeach; |
| 155 | - | |
| 153 | + | |
| 156 | 154 | $ret = $this->processChannelData($element) + $ret; |
| 157 | 155 | elseif (in_array(strtolower($name), array('rss', 'rdf'))) : |
| 158 | 156 | // Drop down to get to <channel> element |
| 159 | 157 | $ret = $this->processFeedData($element) + $ret; |
| @@ -160,9 +158,9 @@ | ||
| 160 | 158 | endif; |
| 161 | 159 | endforeach; |
| 162 | 160 | endforeach; |
| 163 | 161 | endforeach; endif; |
| 164 | - | |
| 162 | + | |
| 165 | 163 | return apply_filters('feedwordpress_magpiefromsimplepie_processfeeddata', $ret, $data, $this); |
| 166 | 164 | } /* MagpieFromSimplePie::processFeedData() */ |
| 167 | 165 | |
| 168 | 166 | /** |
| @@ -177,9 +175,9 @@ | ||
| 177 | 175 | */ |
| 178 | 176 | function processChannelData ($data, $path = array()) { |
| 179 | 177 | $ret = array(); |
| 180 | 178 | $tagPath = strtolower(implode('_', $path)); |
| 181 | - | |
| 179 | + | |
| 182 | 180 | // Only process at the right level |
| 183 | 181 | if (strlen($tagPath) > 0 |
| 184 | 182 | and isset($data['data']) |
| 185 | 183 | and strlen($data['data']) > 0) : |
| @@ -184,9 +182,9 @@ | ||
| 184 | 182 | and isset($data['data']) |
| 185 | 183 | and strlen($data['data']) > 0) : |
| 186 | 184 | $ret[$tagPath] = $data['data']; |
| 187 | 185 | endif; |
| 188 | - | |
| 186 | + | |
| 189 | 187 | $ret = $this->handleAttributes($data, $path) |
| 190 | 188 | + $this->handleChildren($data, $path, 'processChannelData') |
| 191 | 189 | + $ret; |
| 192 | 190 | |
| @@ -205,18 +203,18 @@ | ||
| 205 | 203 | */ |
| 206 | 204 | function processItemData ($data, $path = array()) { |
| 207 | 205 | $ret = array(); |
| 208 | 206 | $tagPath = strtolower(implode('_', $path)); |
| 209 | - | |
| 207 | + | |
| 210 | 208 | if (strlen($tagPath) > 0 and isset($data['data']) and strlen($data['data']) > 0) : |
| 211 | 209 | $ret[$tagPath] = $data['data']; |
| 212 | 210 | endif; |
| 213 | - | |
| 211 | + | |
| 214 | 212 | // Set up xml:base to be recorded in array |
| 215 | 213 | if (isset($data['xml_base_explicit']) and $data['xml_base_explicit']) : |
| 216 | 214 | $data['attribs']['']['xml:base'] = $data['xml_base']; |
| 217 | 215 | endif; |
| 218 | - | |
| 216 | + | |
| 219 | 217 | $ret = $this->handleAttributes($data, $path) |
| 220 | 218 | + $this->handleChildren($data, $path, 'processItemData') |
| 221 | 219 | + $ret; |
| 222 | 220 | |
| @@ -259,9 +257,9 @@ | ||
| 259 | 257 | endforeach; endif; |
| 260 | 258 | |
| 261 | 259 | return apply_filters('feedwordpress_magpiefromsimplepie_handleattributes', $ret, $data, $path, $this); |
| 262 | 260 | } /* MagpieFromSimplePie::handleAttributes() */ |
| 263 | - | |
| 261 | + | |
| 264 | 262 | var $inImage = false; |
| 265 | 263 | var $inTextInput = false; |
| 266 | 264 | |
| 267 | 265 | /** |
| @@ -276,9 +274,9 @@ | ||
| 276 | 274 | * @uses MagpieFromSimplePie::increment_element |
| 277 | 275 | * @uses MagpieFromSimplePie::processItemData |
| 278 | 276 | */ |
| 279 | 277 | function handleChildren ($data, $path = array(), $method = 'processItemData') { |
| 280 | - $tagPath = strtolower(implode('_', $path)); // what is this for? It's never used... (gwyneth 20230918) | |
| 278 | + $tagPath = strtolower(implode('_', $path)); | |
| 281 | 279 | $ret = array(); |
| 282 | 280 | if (isset($data['child'])) : foreach ($data['child'] as $ns => $elements) : |
| 283 | 281 | if (isset($this->_XMLNS_FAMILIAR[$ns])) : |
| 284 | 282 | $ns = $this->_XMLNS_FAMILIAR[$ns]; |
| @@ -317,13 +315,13 @@ | ||
| 317 | 315 | ); |
| 318 | 316 | elseif ('content'==$tag and 'atom'==$ns) : |
| 319 | 317 | $childTag = 'atom_'.$tag; |
| 320 | 318 | endif; |
| 321 | - | |
| 319 | + | |
| 322 | 320 | $childTag = $this->increment_element($ret, $childTag, $ns, $path); |
| 323 | - $childPath = $path; $childPath[] = strtolower($childTag); | |
| 321 | + $childPath = $path; $childPath[] = strtolower($childTag); | |
| 324 | 322 | |
| 325 | - if ( !is_null($copyOver)) : | |
| 323 | + if (!is_null($copyOver)) : | |
| 326 | 324 | $co = array(); |
| 327 | 325 | $co[implode('_', $childPath)] = $copyOver; |
| 328 | 326 | else : |
| 329 | 327 | $co = NULL; |
| @@ -333,27 +331,27 @@ | ||
| 333 | 331 | $arr = $this->{$method}($element, $childPath); |
| 334 | 332 | if ($co) : |
| 335 | 333 | $arr = $co + $arr; // Left-hand overwrites right-hand |
| 336 | 334 | endif; |
| 337 | - | |
| 335 | + | |
| 338 | 336 | if ($this->inImage) : |
| 339 | 337 | $this->image = $arr + $this->image; |
| 340 | - | |
| 338 | + | |
| 341 | 339 | // Close tag |
| 342 | 340 | if ('image'==$tag and 'rss'==$ns) : $this->inImage = false; endif; |
| 343 | 341 | elseif ($this->inTextInput) : |
| 344 | 342 | $this->textinput = $arr + $this->textinput; |
| 345 | - | |
| 343 | + | |
| 346 | 344 | // Close tag |
| 347 | 345 | if ('textinput'==$tag and 'rss'==$ns) : $this->inTextInput = false; endif; |
| 348 | 346 | elseif ($this->is_namespaced($ns)) : |
| 349 | - if ( !isset($ret[$ns])) : $ret[$ns] = array(); endif; | |
| 347 | + if (!isset($ret[$ns])) : $ret[$ns] = array(); endif; | |
| 350 | 348 | $ret[$ns] = $arr + $ret[$ns]; |
| 351 | 349 | else : |
| 352 | 350 | $ret = $arr + $ret; |
| 353 | 351 | endif; |
| 354 | 352 | endforeach; endforeach; |
| 355 | - | |
| 353 | + | |
| 356 | 354 | endforeach; endif; |
| 357 | 355 | |
| 358 | 356 | return apply_filters('feedwordpress_magpiefromsimplepie_handlechildren', $ret, $data, $path, $method, $this); |
| 359 | 357 | } /* MagpieFromSimplePie::handleChildren() */ |
| @@ -396,9 +394,9 @@ | ||
| 396 | 394 | */ |
| 397 | 395 | function normalize () { |
| 398 | 396 | do_action('feedwordpress_magpiefromsimplepie_normalize_pre', $this); |
| 399 | 397 | |
| 400 | - if ( !is_null($this->channel)) : | |
| 398 | + if (!is_null($this->channel)) : | |
| 401 | 399 | // Normalize channel data |
| 402 | 400 | if ( $this->is_atom() ) : |
| 403 | 401 | // Atom 1.0 elements <=> Atom 0.3 elements (Thanks, o brilliant wordsmiths of the Atom 1.0 standard!) |
| 404 | 402 | if ($this->feed_version() < 1.0) : |
| @@ -411,12 +409,12 @@ | ||
| 411 | 409 | $this->normalize_element($this->channel, 'updated', $this->channel, 'modified'); |
| 412 | 410 | endif; |
| 413 | 411 | $this->normalize_element($this->channel, 'author', $this->channel['dc'], 'creator', 'normalize_atom_person'); |
| 414 | 412 | $this->normalize_element($this->channel, 'contributor', $this->channel['dc'], 'contributor', 'normalize_atom_person'); |
| 415 | - | |
| 413 | + | |
| 416 | 414 | // Atom elements to RSS elements |
| 417 | 415 | $this->normalize_element($this->channel, 'subtitle', $this->channel, 'description'); |
| 418 | - | |
| 416 | + | |
| 419 | 417 | if ( isset($this->channel['logo']) ) : |
| 420 | 418 | $this->normalize_element($this->channel, 'logo', $this->image, 'url'); |
| 421 | 419 | $this->normalize_element($this->channel, 'link', $this->image, 'link'); |
| 422 | 420 | $this->normalize_element($this->channel, 'title', $this->image, 'title'); |
| @@ -432,9 +430,9 @@ | ||
| 432 | 430 | //$this->normalize_element($this->channel, 'textinput_title', $this->textinput, 'title'); |
| 433 | 431 | //$this->normalize_element($this->channel, 'textinput_link', $this->textinput, 'link'); |
| 434 | 432 | //$this->normalize_element($this->channel, 'textinput_name', $this->textinput, 'name'); |
| 435 | 433 | //$this->normalize_element($this->channel, 'textinput_description', $this->textinput, 'description'); |
| 436 | - | |
| 434 | + | |
| 437 | 435 | // RSS elements to Atom elements |
| 438 | 436 | $this->normalize_element($this->channel, 'description', $this->channel, 'tagline'); // Atom 0.3 |
| 439 | 437 | $this->normalize_element($this->channel, 'description', $this->channel, 'subtitle'); // Atom 1.0 (yay wordsmithing!) |
| 440 | 438 | $this->normalize_element($this->image, 'url', $this->channel, 'logo'); |
| @@ -440,13 +438,13 @@ | ||
| 440 | 438 | $this->normalize_element($this->image, 'url', $this->channel, 'logo'); |
| 441 | 439 | endif; |
| 442 | 440 | endif; |
| 443 | 441 | |
| 444 | - if ( !is_null($this->items)) : | |
| 442 | + if (!is_null($this->items)) : | |
| 445 | 443 | // Now loop through and normalize item data |
| 446 | 444 | for ( $i = 0; $i < count($this->items); $i++) : |
| 447 | 445 | $item = $this->items[$i]; |
| 448 | - | |
| 446 | + | |
| 449 | 447 | // if atom populate rss fields and normalize 0.3 and 1.0 feeds |
| 450 | 448 | if ( $this->is_atom() ) : |
| 451 | 449 | // Atom 1.0 elements <=> Atom 0.3 elements |
| 452 | 450 | if ($this->feed_version() < 1.0) : |
| @@ -457,9 +455,9 @@ | ||
| 457 | 455 | $this->normalize_element($item, 'published', $item, 'issued'); |
| 458 | 456 | endif; |
| 459 | 457 | |
| 460 | 458 | $this->normalize_author_inheritance($item, $this->originals[$i]); |
| 461 | - | |
| 459 | + | |
| 462 | 460 | // Atom elements to RSS elements |
| 463 | 461 | $this->normalize_element($item, 'author', $item['dc'], 'creator', 'normalize_atom_person'); |
| 464 | 462 | $this->normalize_element($item, 'contributor', $item['dc'], 'contributor', 'normalize_atom_person'); |
| 465 | 463 | $this->normalize_element($item, 'summary', $item, 'description'); |
| @@ -478,9 +476,9 @@ | ||
| 478 | 476 | elseif ( $this->is_rss() ) : |
| 479 | 477 | // RSS elements to Atom elements |
| 480 | 478 | $this->normalize_element($item, 'description', $item, 'summary'); |
| 481 | 479 | $this->normalize_element($item, 'enclosure', $item, 'link_enclosure', 'normalize_enclosure'); |
| 482 | - | |
| 480 | + | |
| 483 | 481 | // Categories |
| 484 | 482 | if ( isset($item['category#']) ) : // RSS 2.0 categories to dc:subject and Atom 1.0 categories |
| 485 | 483 | $this->normalize_element($item, 'category', $item['dc'], 'subject', 'normalize_category'); |
| 486 | 484 | elseif ( isset($item['dc']['subject#']) ) : // dc:subject to Atom 1.0 and RSS 2.0 categories |
| @@ -485,9 +483,9 @@ | ||
| 485 | 483 | $this->normalize_element($item, 'category', $item['dc'], 'subject', 'normalize_category'); |
| 486 | 484 | elseif ( isset($item['dc']['subject#']) ) : // dc:subject to Atom 1.0 and RSS 2.0 categories |
| 487 | 485 | $this->normalize_element($item['dc'], 'subject', $item, 'category', 'normalize_dc_subject'); |
| 488 | 486 | endif; |
| 489 | - | |
| 487 | + | |
| 490 | 488 | // Normalized item timestamp |
| 491 | 489 | if (isset($item['pubdate'])) : |
| 492 | 490 | $item_date = $item['pubdate']; |
| 493 | 491 | elseif (isset($item['dc']['date'])) : |
| @@ -498,10 +496,10 @@ | ||
| 498 | 496 | endif; |
| 499 | 497 | |
| 500 | 498 | if ( $item_date ) : |
| 501 | 499 | $date_timestamp = new FeedTime($item_date); |
| 502 | - | |
| 503 | - if ( ! $date_timestamp->failed()) : | |
| 500 | + | |
| 501 | + if (!$date_timestamp->failed()) : | |
| 504 | 502 | $item['date_timestamp'] = $date_timestamp->timestamp(); |
| 505 | 503 | endif; |
| 506 | 504 | endif; |
| 507 | 505 | |
| @@ -507,9 +505,9 @@ | ||
| 507 | 505 | |
| 508 | 506 | $this->items[$i] = $item; |
| 509 | 507 | endfor; |
| 510 | 508 | endif; |
| 511 | - | |
| 509 | + | |
| 512 | 510 | do_action('feedwordpress_magpiefromsimplepie_normalize_post', $this); |
| 513 | 511 | } /* MagpieFromSimplePie::normalize() */ |
| 514 | 512 | |
| 515 | 513 | /** |
| @@ -531,9 +529,9 @@ | ||
| 531 | 529 | // elements of the containing atom:feed element are |
| 532 | 530 | // considered to apply to the entry if there are no |
| 533 | 531 | // atom:author elements in the locations described |
| 534 | 532 | // above." <http://atompub.org/2005/08/17/draft-ietf-atompub-format-11.html#rfc.section.4.2.1> |
| 535 | - if ( !isset($item["author#"])) : | |
| 533 | + if (!isset($item["author#"])) : | |
| 536 | 534 | $authors = $original->get_authors(); |
| 537 | 535 | foreach ($authors as $author) : |
| 538 | 536 | $tag = $this->increment_element($item, 'author', 'atom', array()); |
| 539 | 537 | $item[$tag] = $item["{$tag}_name"] = $author->get_name(); |
| @@ -541,11 +539,11 @@ | ||
| 541 | 539 | if ($author->get_email()) : $item["{$tag}_email"] = $author->get_email(); endif; |
| 542 | 540 | endforeach; |
| 543 | 541 | endif; |
| 544 | 542 | } /* MagpieFromSimplePie::normalize_author_inheritance() */ |
| 545 | - | |
| 543 | + | |
| 546 | 544 | /** |
| 547 | - * MagpieFromSimplePie::normalize_element | |
| 545 | + * MagpieFromSimplePie::normalize_element | |
| 548 | 546 | * Simplify the logic for normalize(). Makes sure that count of elements |
| 549 | 547 | * and each of multiple elements is normalized properly. If you need to |
| 550 | 548 | * mess with things like attributes or change formats or the like, pass |
| 551 | 549 | * it a callback to handle each element. |
| @@ -570,9 +568,9 @@ | ||
| 570 | 568 | $this->{$via}($source, $from, $dest, $to, $i); |
| 571 | 569 | else : // just make it the same |
| 572 | 570 | $from_id = $this->element_id($from, $i); |
| 573 | 571 | $to_id = $this->element_id($to, $i); |
| 574 | - | |
| 572 | + | |
| 575 | 573 | if (isset($source[$from_id])) : // Avoid PHP notice nastygrams |
| 576 | 574 | $dest[$to_id] = $source[$from_id]; |
| 577 | 575 | endif; |
| 578 | 576 | endif; |
| @@ -683,9 +681,9 @@ | ||
| 683 | 681 | |
| 684 | 682 | // Now put the identifier into dc:subject |
| 685 | 683 | $dest[$dc_id] = $source[$cat_id]; |
| 686 | 684 | } /* MagpieFromSimplePie::normalize_category */ |
| 687 | - | |
| 685 | + | |
| 688 | 686 | /** |
| 689 | 687 | * MagpieFromSimplePie::normalize_dc_subject: Normalize Dublin Core |
| 690 | 688 | * "subject" elements to Atom 1.0 and RSS 2.0 categories. |
| 691 | 689 | * |
| @@ -728,18 +726,18 @@ | ||
| 728 | 726 | */ |
| 729 | 727 | function increment_element (&$data, $childTag, $ns, $path) { |
| 730 | 728 | $counterIndex = strtolower(implode('_', array_merge($path, array($childTag.'#')))); |
| 731 | 729 | if ($this->is_namespaced($ns)) : |
| 732 | - if ( !isset($data[$ns])) : $data[$ns] = array(); endif; | |
| 733 | - if ( !isset($data[$ns][$counterIndex])) : $data[$ns][$counterIndex] = 0; endif; | |
| 730 | + if (!isset($data[$ns])) : $data[$ns] = array(); endif; | |
| 731 | + if (!isset($data[$ns][$counterIndex])) : $data[$ns][$counterIndex] = 0; endif; | |
| 734 | 732 | $data[$ns][$counterIndex] += 1; |
| 735 | 733 | $N = $data[$ns][$counterIndex]; |
| 736 | 734 | else : |
| 737 | - if ( !isset($data[$counterIndex])) : $data[$counterIndex] = 0; endif; | |
| 735 | + if (!isset($data[$counterIndex])) : $data[$counterIndex] = 0; endif; | |
| 738 | 736 | $data[$counterIndex] += 1; |
| 739 | 737 | $N = $data[$counterIndex]; |
| 740 | 738 | endif; |
| 741 | - | |
| 739 | + | |
| 742 | 740 | if ($N > 1) : |
| 743 | 741 | $childTag .= '#'.$N; |
| 744 | 742 | endif; |
| 745 | 743 | return $childTag; |
| @@ -758,11 +756,11 @@ | ||
| 758 | 756 | // Atom vs. RSS |
| 759 | 757 | if ($this->is_atom()) : $root = array('', 'atom'); |
| 760 | 758 | else : $root = array('', 'rss'); |
| 761 | 759 | endif; |
| 762 | - | |
| 760 | + | |
| 763 | 761 | // RDF formats; namespaced in attribs but not in elements |
| 764 | - if ( ! $attribute and $this->is_rdf()) : | |
| 762 | + if (!$attribute and $this->is_rdf()) : | |
| 765 | 763 | $root[] = 'rdf'; |
| 766 | 764 | endif; |
| 767 | 765 | |
| 768 | 766 | return !in_array(strtolower($ns), $root); |
| @@ -775,9 +773,9 @@ | ||
| 775 | 773 | */ |
| 776 | 774 | function is_atom () { |
| 777 | 775 | return $this->pie->get_type() & SIMPLEPIE_TYPE_ATOM_ALL; |
| 778 | 776 | } /* MagpieFromSimplePie::increment_element */ |
| 779 | - | |
| 777 | + | |
| 780 | 778 | /** |
| 781 | 779 | * MagpieFromSimplePie::is_rss |
| 782 | 780 | * |
| 783 | 781 | * @return bool |
| @@ -784,9 +782,9 @@ | ||
| 784 | 782 | */ |
| 785 | 783 | function is_rss () { |
| 786 | 784 | return $this->pie->get_type() & SIMPLEPIE_TYPE_RSS_ALL; |
| 787 | 785 | } /* MagpieFromSimplePie::is_rss */ |
| 788 | - | |
| 786 | + | |
| 789 | 787 | /** |
| 790 | 788 | * MagpieFromSimplePie::is_rdf |
| 791 | 789 | * |
| 792 | 790 | * @return bool |