コード例 #1
0
ファイル: feeder.php プロジェクト: kenirwin/SubjectsPlus
<?php

////////////////////////////////////////////////////////////////////////////////
//                         feeder.php
//        Selects which feed reader to use, and displays results
//        Includes either control/lastRSS.php or control/PGFeed.php
////////////////////////////////////////////////////////////////////////////////
if ($pgparser == 1) {
    // Uses PGFeed
    require "PGFeed.php";
    // Create PGFeed object -- look in PGFeed file for deets on usage
    // Note that the default is now 2 hours for caching
    $rss = new PGFeed();
    $source = $feed;
    $rss->setOptions(1, 3, 0, 7200);
    $rss->parse($source);
    $items = $rss->getItems();
    $channel = $rss->getChannel();
    // gets data about the feed as a whole
    // Show last published articles (title, link, description)
    $web_feed .= "<ul class=\"smaller\">\n";
    foreach ($items as $item) {
        $web_feed .= "\t<li><a href=\"{$item['link']}\">" . $item['title'] . "</a><br />" . $item['description'] . "</li>\n";
    }
    $web_feed .= "</ul>\n<p class=\"smaller\">Source: <a href=\"{$channel['link']}\" class=\"smaller\">{$channel['title']}</a>\n";
    //print $items[0][source];
} else {
    // Uses LastRss
    require "lastRSS.php";
    // Create lastRSS object
    $rss = new lastRSS();
コード例 #2
0
ファイル: PGFeed.php プロジェクト: kenirwin/SubjectsPlus
 public function parse($source)
 {
     if (preg_match('/flickr/', $source)) {
         $isFlickr = 1;
     }
     if (!$this->report) {
         error_reporting(0);
     }
     if ($this->returns) {
         $returns = $this->returns;
     } else {
         $returns = 5;
     }
     $feedLinks = -1;
     $feedCategories = -1;
     $feedAuthorsCount = -1;
     $itemLinks = -1;
     $itemCategories = -1;
     $reader = new \XMLReader();
     $cachedCopy = "pgcache/" . urlencode($source);
     if (file_exists($cachedCopy)) {
         $cacheTime = filemtime($cachedCopy);
         $now = time();
         $age = $now - $cacheTime;
     }
     if (file_exists($cachedCopy) && $this->cache && $age > $this->cache || !file_exists($cachedCopy)) {
         try {
             PGFeed::checkSource($source);
         } catch (Exception $e) {
             if ($this->report) {
                 echo 'Message: ' . $e->getMessage();
             }
             die;
         }
         if ($this->cache) {
             PGFeed::cacheFeed($source);
         }
         $reader->open($source);
     } else {
         $cachedContents = file_get_contents($cachedCopy);
         $reader->XML($cachedContents);
     }
     while ($reader->read()) {
         $name = $reader->name;
         if ($name == "feed" && $reader->nodeType == 1) {
             $isAtom = 1;
         } else {
             if (in_array("{$name}", $this->channelElements) && $reader->nodeType == 1 && !$isInItem && !$isInImage && !$isAtom) {
                 $reader->read();
                 $this->channel["{$name}"] = $reader->value;
             } else {
                 if ($name == "cloud" && $reader->nodeType == 1 && !$isAtom) {
                     foreach ($this->cloudAttributes as $att) {
                         if ($reader->moveToAttribute("{$att}")) {
                             $this->channel["cloud"]["{$att}"] = $reader->value;
                         }
                     }
                 } else {
                     if ($name == "image" && $reader->nodeType == 1 && !$isAtom) {
                         $isInImage = 1;
                     } else {
                         if ($name == "image" && $reader->nodeType == 15 && !$isAtom) {
                             $isInImage = 0;
                         } else {
                             if (in_array("{$name}", $this->imageElements) && $reader->nodeType == 1 && $isInImage && !$isAtom) {
                                 $reader->read();
                                 $this->channel["image"]["{$name}"] = $reader->value;
                             } else {
                                 if ($name == "textInput" && $reader->nodeType == 1 && !$isAtom) {
                                     $isInTextInput = 1;
                                 } else {
                                     if ($name == "textInput" && $reader->nodeType == 15 && !$isAtom) {
                                         $isInTextInput = 0;
                                     } else {
                                         if (in_array("{$name}", $this->textInputElements) && $reader->nodeType == 1 && $isInTextInput && !$isAtom) {
                                             $reader->read();
                                             $this->channel["textInput"]["{$name}"] = $reader->value;
                                         } else {
                                             if ($name == "item" && $reader->nodeType == 1 && !$isAtom) {
                                                 $isInItem = 1;
                                                 $itemNumber++;
                                                 $item = array();
                                             } else {
                                                 if (in_array("{$name}", $this->itemElements) && $reader->nodeType == 1 && $isInItem && !$isAtom) {
                                                     $reader->read();
                                                     $item["{$name}"] = $reader->value;
                                                 } else {
                                                     if ($name == "description" && $reader->nodeType == 1 && $isInItem && !$isAtom) {
                                                         $isInDescription = 1;
                                                         $reader->read();
                                                         $description = $reader->value;
                                                         if ($this->strip) {
                                                             $newDescription = preg_replace("/<.+?>/", "", $description);
                                                         } else {
                                                             $newDescription = $description;
                                                         }
                                                         $item["description"] = $newDescription;
                                                     } else {
                                                         if ($name == "description" && $reader->nodeType == 15) {
                                                             $isInDescription = 0;
                                                         } else {
                                                             if ($name == "enclosure" && $reader->nodeType == 1 && $isInItem && !$isAtom) {
                                                                 foreach ($this->enclosureAttributes as $enatt) {
                                                                     if ($reader->moveToAttribute("{$enatt}")) {
                                                                         $item["enclosure"]["{$enatt}"] = $reader->value;
                                                                     }
                                                                 }
                                                             } else {
                                                                 if ($name == "item" && $reader->nodeType == 15 && !$isAtom) {
                                                                     $isInItem = 0;
                                                                     if ($itemNumber <= $returns) {
                                                                         array_push($this->items, $item);
                                                                     }
                                                                 } else {
                                                                     if ($name == "media:content" && $reader->nodeType == 1 && !$isAtom) {
                                                                         $isInMediaContent = 1;
                                                                         // URL of full-size image
                                                                         $reader->moveToAttribute("url");
                                                                         $item["mediaContentURL"] = $reader->value;
                                                                         $item["fullImageURL"] = $item["mediaContentURL"];
                                                                         // Type (e.g., image/jpeg)
                                                                         $reader->moveToAttribute("type");
                                                                         $item["mediaContentType"] = $reader->value;
                                                                         // Height of full-size image
                                                                         $reader->moveToAttribute("height");
                                                                         $item["mediaContentHeight"] = $reader->value;
                                                                         $item["fullImageHeight"] = $item["mediaContentHeight"];
                                                                         // Width of full-size image
                                                                         $reader->moveToAttribute("width");
                                                                         $item["mediaContentWidth"] = $reader->value;
                                                                         $item["fullImageWidth"] = $item["mediaContentWidth"];
                                                                     } else {
                                                                         if ($name == "media:content" && $reader->nodeType == 15 && !$isAtom) {
                                                                             $isInMediaContent = 0;
                                                                         } else {
                                                                             if ($name == "media:title" && $reader->nodeType == 1 && !$isAtom) {
                                                                                 $isInMediaTitle = 1;
                                                                                 $reader->read();
                                                                                 $item["mediaTitle"] = $reader->value;
                                                                             } else {
                                                                                 if ($name == "media:title" && $reader->nodeType == 15 && !$isAtom) {
                                                                                     $isInMediaTitle = 0;
                                                                                 } else {
                                                                                     if ($name == "media:description" && $reader->nodeType == 1 && !$isAtom) {
                                                                                         $isInMediaDescription = 1;
                                                                                         $reader->read();
                                                                                         $item["mediaDescription"] = $reader->value;
                                                                                         $item["caption"] = $item["mediaDescription"];
                                                                                     } else {
                                                                                         if ($name == "media:description" && $reader->nodeType == 15 && !$isAtom) {
                                                                                             $isInMediaDescription = 0;
                                                                                         } else {
                                                                                             if ($name == "media:thumbnail" && $reader->nodeType == 1 && !$isAtom) {
                                                                                                 $isInMediaThumbnail = 1;
                                                                                                 // URL of square thumbnail
                                                                                                 $reader->moveToAttribute("url");
                                                                                                 $item["mediaThumbnailURL"] = $reader->value;
                                                                                                 $item["squareThumbnailURL"] = $item["mediaThumbnailURL"];
                                                                                                 // Dimensions of square thumbnail
                                                                                                 $reader->moveToAttribute("height");
                                                                                                 $item["mediaThumbnailHeight"] = $reader->value;
                                                                                                 $item["squareThumbnailHeight"] = $item["mediaThumbnailHeight"];
                                                                                                 $item["mediaThumbnailWidth"] = $item["mediaThumbnailHeight"];
                                                                                                 $item["squareThumbnailWidth"] = $item["mediaThumbnailHeight"];
                                                                                                 // URL of regular thumbnail
                                                                                                 $item["thumbnailURL"] = preg_replace('/_s\\.(png|jpg|gif)/', '_t.$1', $item['mediaThumbnailURL']);
                                                                                                 // Dimensions of regular thumbnail
                                                                                                 if ($item["fullImageHeight"] > $item["fullImageWidth"]) {
                                                                                                     $item["thumbnailHeight"] = 100;
                                                                                                     $item["thumbnailWidth"] = round(100 * $item["fullImageWidth"] / $item["fullImageHeight"]);
                                                                                                 } else {
                                                                                                     if ($item["fullImageHeight"] < $item["fullImageWidth"]) {
                                                                                                         $item["thumbnailWidth"] = 100;
                                                                                                         $item["thumbnailHeight"] = round(100 * $item["fullImageHeight"] / $item["fullImageWidth"]);
                                                                                                     } else {
                                                                                                         $item["thumbnailWidth"] = 100;
                                                                                                         $item["thumbnailHeight"] = 100;
                                                                                                     }
                                                                                                 }
                                                                                             } else {
                                                                                                 if ($name == "media:thumbnail" && $reader->nodeType == 15 && !$isAtom) {
                                                                                                     $isInMediaThumbnail = 0;
                                                                                                 } else {
                                                                                                     if ($name == "media:credit" && $reader->nodeType == 1 && !$isAtom) {
                                                                                                         $isInMediaCredit = 1;
                                                                                                         $reader->read();
                                                                                                         $item["mediaCredit"] = $reader->value;
                                                                                                     } else {
                                                                                                         if ($name == "media:credit" && $reader->nodeType == 15 && !$isAtom) {
                                                                                                             $isInMediaCredit = 0;
                                                                                                         } else {
                                                                                                             if (in_array("{$name}", $this->feedElements) && $reader->nodeType == 1 && !$isInItem && $isAtom) {
                                                                                                                 $reader->read();
                                                                                                                 $this->channel["{$name}"] = $reader->value;
                                                                                                             } else {
                                                                                                                 if ($name == "title" && $reader->nodeType == 1 && !$isInSource && $isAtom) {
                                                                                                                     if ($reader->moveToAttribute("type")) {
                                                                                                                         if ($isInItem) {
                                                                                                                             $item["titleAttributes"]["type"] = $reader->value;
                                                                                                                         } else {
                                                                                                                             $this->channel["titleAttributes"]["type"] = $reader->value;
                                                                                                                         }
                                                                                                                     }
                                                                                                                     $reader->read();
                                                                                                                     if ($isInItem) {
                                                                                                                         $item["title"] = $reader->value;
                                                                                                                     } else {
                                                                                                                         $this->channel["title"] = $reader->value;
                                                                                                                     }
                                                                                                                 } else {
                                                                                                                     if ($name == "link" && $reader->nodeType == 1 && !$isInItem && $isAtom) {
                                                                                                                         $feedLinks++;
                                                                                                                         foreach ($this->linkAttributes as $latt) {
                                                                                                                             if ($reader->moveToAttribute("{$latt}")) {
                                                                                                                                 $this->channel["links"]["{$feedLinks}"]["{$latt}"] = $reader->value;
                                                                                                                             }
                                                                                                                         }
                                                                                                                     } else {
                                                                                                                         if ($name == "generator" && $reader->nodeType == 1 && $isAtom) {
                                                                                                                             $reader->moveToAttribute("uri");
                                                                                                                             $this->channel["generatorURI"] = $reader->value;
                                                                                                                             $this->channel["link"] = $reader->value;
                                                                                                                             $reader->read();
                                                                                                                             $this->channel["{$name}"] = $reader->value;
                                                                                                                         } else {
                                                                                                                             if ($name == "author" && $reader->nodeType == 1 && $isAtom) {
                                                                                                                                 $isInAuthor = 1;
                                                                                                                                 $author = array();
                                                                                                                             } else {
                                                                                                                                 if (in_array($name, $this->authorElements) && $reader->nodeType == 1 && $isInAuthor && $isAtom) {
                                                                                                                                     $reader->read();
                                                                                                                                     $author["{$name}"] = $reader->value;
                                                                                                                                 } else {
                                                                                                                                     if ($name == "author" && $reader->nodeType == 15 && $isAtom) {
                                                                                                                                         $isInAuthor = 0;
                                                                                                                                         if ($isInItem) {
                                                                                                                                             array_push($this->authors, $author);
                                                                                                                                             $item["authors"] = $this->authors;
                                                                                                                                             $this->authors = array();
                                                                                                                                         } else {
                                                                                                                                             array_push($this->feedAuthors, $author);
                                                                                                                                             $this->channel["authors"] = $this->feedAuthors;
                                                                                                                                         }
                                                                                                                                     } else {
                                                                                                                                         if ($name == "category" && $reader->nodeType == 1 && !$isInItem && $isAtom) {
                                                                                                                                             $feedCategories++;
                                                                                                                                             foreach ($this->categoryAttributes as $cat) {
                                                                                                                                                 if ($reader->moveToAttribute("{$cat}")) {
                                                                                                                                                     $this->channel["categories"]["{$feedCategories}"]["{$cat}"] = $reader->value;
                                                                                                                                                 }
                                                                                                                                             }
                                                                                                                                         } else {
                                                                                                                                             if ($name == "rights" && $reader->nodeType == 1 && !$isInItem && $isAtom) {
                                                                                                                                                 if ($reader->moveToAttribute("src")) {
                                                                                                                                                     $this->channel["rights"]["src"] = $reader->value;
                                                                                                                                                 }
                                                                                                                                                 if ($reader->moveToAttribute("type")) {
                                                                                                                                                     $this->channel["rights"]["type"] = $reader->value;
                                                                                                                                                 }
                                                                                                                                                 $reader->read();
                                                                                                                                                 $this->channel["rights"]["rights"] = $reader->value;
                                                                                                                                             } else {
                                                                                                                                                 if ($name == "entry" && $reader->nodeType == 1 && $isAtom) {
                                                                                                                                                     $isInItem = 1;
                                                                                                                                                     $item = array();
                                                                                                                                                     $itemNumber++;
                                                                                                                                                     $itemLinks = -1;
                                                                                                                                                     $itemCategories = -1;
                                                                                                                                                 } else {
                                                                                                                                                     if ($name == "entry" && $reader->nodeType == 15 && $isAtom) {
                                                                                                                                                         $isInItem = 0;
                                                                                                                                                         if ($itemNumber <= $returns) {
                                                                                                                                                             array_push($this->items, $item);
                                                                                                                                                         }
                                                                                                                                                         $authors = array();
                                                                                                                                                     } else {
                                                                                                                                                         if (in_array("{$name}", $this->entryElements) && $reader->nodeType == 1 && $isInItem && $isAtom) {
                                                                                                                                                             $reader->read();
                                                                                                                                                             $item["{$name}"] = $reader->value;
                                                                                                                                                         } else {
                                                                                                                                                             if ($name == "rights" && $reader->nodeType == 1 && $isInItem && $isAtom) {
                                                                                                                                                                 if ($reader->moveToAttribute("src")) {
                                                                                                                                                                     $item["rights"]["src"] = $reader->value;
                                                                                                                                                                 }
                                                                                                                                                                 if ($reader->moveToAttribute("type")) {
                                                                                                                                                                     $item["rights"]["type"] = $reader->value;
                                                                                                                                                                 }
                                                                                                                                                                 $reader->read();
                                                                                                                                                                 $item["rights"]["rights"] = $reader->value;
                                                                                                                                                             } else {
                                                                                                                                                                 if ($name == "link" && $reader->nodeType == 1 && $isInItem && $isAtom) {
                                                                                                                                                                     $itemLinks++;
                                                                                                                                                                     foreach ($this->linkAttributes as $latt2) {
                                                                                                                                                                         if ($reader->moveToAttribute("{$latt2}")) {
                                                                                                                                                                             $item["links"]["{$itemLinks}"]["{$latt2}"] = $reader->value;
                                                                                                                                                                             $item["link"] = $item["links"][0]["href"];
                                                                                                                                                                         }
                                                                                                                                                                     }
                                                                                                                                                                 } else {
                                                                                                                                                                     if ($name == "category" && $reader->nodeType == 1 && $isInItem && $isAtom) {
                                                                                                                                                                         $itemCategories++;
                                                                                                                                                                         foreach ($this->categoryAttributes as $catt) {
                                                                                                                                                                             if ($reader->moveToAttribute("{$catt}")) {
                                                                                                                                                                                 $item["categories"]["{$itemCategories}"]["{$catt}"] = $reader->value;
                                                                                                                                                                             }
                                                                                                                                                                         }
                                                                                                                                                                     } else {
                                                                                                                                                                         if ($name == "contributor" && $reader->nodeType == 1 && $isInItem && $isAtom) {
                                                                                                                                                                             $isInContributor = 1;
                                                                                                                                                                             $contributor = array();
                                                                                                                                                                         } else {
                                                                                                                                                                             if (in_array($name, $this->authorElements) && $reader->nodeType == 1 && $isInContributor && $isAtom) {
                                                                                                                                                                                 $reader->read();
                                                                                                                                                                                 $contributor["{$name}"] = $reader->value;
                                                                                                                                                                             } else {
                                                                                                                                                                                 if ($name == "contributor" && $reader->nodeType == 15 && $isAtom) {
                                                                                                                                                                                     $isInContributor = 0;
                                                                                                                                                                                     array_push($this->contributors, $contributor);
                                                                                                                                                                                     $item["contributors"] = $this->contributors;
                                                                                                                                                                                 } else {
                                                                                                                                                                                     if ($name == "source" && $reader->nodeType == 1 && $isAtom) {
                                                                                                                                                                                         $isInSource = 1;
                                                                                                                                                                                     } else {
                                                                                                                                                                                         if ($name == "source" && $reader->nodeType == 15 && $isAtom) {
                                                                                                                                                                                             $isInSource = 0;
                                                                                                                                                                                         } else {
                                                                                                                                                                                             if ($name == "summary" && $reader->nodeType == 1 && $isInItem && $isAtom) {
                                                                                                                                                                                                 if ($reader->moveToAttribute("src")) {
                                                                                                                                                                                                     $item["sourceAttributes"]["src"] = $reader->value;
                                                                                                                                                                                                 }
                                                                                                                                                                                                 if ($reader->moveToAttribute("type")) {
                                                                                                                                                                                                     $item["sourceAttributes"]["type"] = $reader->value;
                                                                                                                                                                                                 }
                                                                                                                                                                                                 $reader->read();
                                                                                                                                                                                                 $summary = $reader->value;
                                                                                                                                                                                                 if ($this->strip) {
                                                                                                                                                                                                     $newSummary = preg_replace("/<.+?>/", "", $summary);
                                                                                                                                                                                                 } else {
                                                                                                                                                                                                     $newSummary = $summary;
                                                                                                                                                                                                 }
                                                                                                                                                                                                 $item["source"] = $newSummary;
                                                                                                                                                                                             } else {
                                                                                                                                                                                                 if ($name == "content" && $reader->nodeType == 1 && $isInItem && $isAtom) {
                                                                                                                                                                                                     $isInDescription = 1;
                                                                                                                                                                                                     if ($reader->moveToAttribute("src")) {
                                                                                                                                                                                                         $item["contentAttributes"]["src"] = $reader->value;
                                                                                                                                                                                                     }
                                                                                                                                                                                                     if ($reader->moveToAttribute("type")) {
                                                                                                                                                                                                         $item["contentAttributes"]["type"] = $reader->value;
                                                                                                                                                                                                     }
                                                                                                                                                                                                     $reader->read();
                                                                                                                                                                                                     $content = $reader->value;
                                                                                                                                                                                                     if ($this->strip) {
                                                                                                                                                                                                         $newContent = preg_replace("/<.+?>/", "", $content);
                                                                                                                                                                                                     } else {
                                                                                                                                                                                                         $newContent = $content;
                                                                                                                                                                                                     }
                                                                                                                                                                                                     $item["content"] = $newContent;
                                                                                                                                                                                                     $item["description"] = $newContent;
                                                                                                                                                                                                 } else {
                                                                                                                                                                                                     if ($name == "content" && $reader->nodeType == 15 && $isInItem && $isAtom) {
                                                                                                                                                                                                         $isInDescription = 0;
                                                                                                                                                                                                     } else {
                                                                                                                                                                                                         if ($reader->nodeType == 4 && $isInDescription) {
                                                                                                                                                                                                             $cdata = $reader->value;
                                                                                                                                                                                                             if ($this->strip) {
                                                                                                                                                                                                                 $cdata = preg_replace("/<.+?>/", "", $cdata);
                                                                                                                                                                                                             }
                                                                                                                                                                                                             $item["content"] = $cdata;
                                                                                                                                                                                                             $item["description"] = $item["content"];
                                                                                                                                                                                                         }
                                                                                                                                                                                                     }
                                                                                                                                                                                                 }
                                                                                                                                                                                             }
                                                                                                                                                                                         }
                                                                                                                                                                                     }
                                                                                                                                                                                 }
                                                                                                                                                                             }
                                                                                                                                                                         }
                                                                                                                                                                     }
                                                                                                                                                                 }
                                                                                                                                                             }
                                                                                                                                                         }
                                                                                                                                                     }
                                                                                                                                                 }
                                                                                                                                             }
                                                                                                                                         }
                                                                                                                                     }
                                                                                                                                 }
                                                                                                                             }
                                                                                                                         }
                                                                                                                     }
                                                                                                                 }
                                                                                                             }
                                                                                                         }
                                                                                                     }
                                                                                                 }
                                                                                             }
                                                                                         }
                                                                                     }
                                                                                 }
                                                                             }
                                                                         }
                                                                     }
                                                                 }
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
         $reader->close;
     }
 }
コード例 #3
0
ファイル: PGFeed.php プロジェクト: kenirwin/SubjectsPlus
 function parse($source)
 {
     if (!$this->report) {
         error_reporting(0);
     }
     if (!is_null($this->returns)) {
         $returns = $this->returns;
     } else {
         $returns = 12;
     }
     $feedLinks = -1;
     $feedCategories = -1;
     $feedAuthorsCount = -1;
     $itemLinks = -1;
     $itemCategories = -1;
     $reader = new XMLReader();
     $cachedCopy = "pgcache/" . urlencode($source);
     if (file_exists($cachedCopy)) {
         $cacheTime = filemtime($cachedCopy);
         $now = time();
         $age = $now - $cacheTime;
     }
     if (file_exists($cachedCopy) && $this->cache && $age > $this->cache || !file_exists($cachedCopy)) {
         try {
             PGFeed::checkSource($source);
         } catch (Exception $e) {
             if ($this->report) {
                 echo 'Message: ' . $e->getMessage();
             }
             die;
         }
         if ($this->cache) {
             PGFeed::cacheFeed($source);
         }
         $reader->open($source);
     } else {
         $cachedContents = file_get_contents($cachedCopy);
         $reader->XML($cachedContents);
     }
     while ($reader->read()) {
         $name = $reader->name;
         if ($name == "feed" && $reader->nodeType == 1) {
             $isAtom = 1;
         } else {
             if (in_array("{$name}", $this->channelElements) && $reader->nodeType == 1 && !$isInItem && !$isInImage && !$isAtom) {
                 $reader->read();
                 $this->channel["{$name}"] = $reader->value;
             } else {
                 if ($name == "cloud" && $reader->nodeType == 1 && !$isAtom) {
                     foreach ($this->cloudAttributes as $att) {
                         if ($reader->moveToAttribute("{$att}")) {
                             $this->channel["cloud"]["{$att}"] = $reader->value;
                         }
                     }
                 } else {
                     if ($name == "image" && $reader->nodeType == 1 && !$isAtom) {
                         $isInImage = 1;
                     } else {
                         if ($name == "image" && $reader->nodeType == 15 && !$isAtom) {
                             $isInImage = 0;
                         } else {
                             if (in_array("{$name}", $this->imageElements) && $reader->nodeType == 1 && $isInImage && !$isAtom) {
                                 $reader->read();
                                 $this->channel["image"]["{$name}"] = $reader->value;
                             } else {
                                 if ($name == "textInput" && $reader->nodeType == 1 && !$isAtom) {
                                     $isInTextInput = 1;
                                 } else {
                                     if ($name == "textInput" && $reader->nodeType == 15 && !$isAtom) {
                                         $isInTextInput = 0;
                                     } else {
                                         if (in_array("{$name}", $this->textInputElements) && $reader->nodeType == 1 && $isInTextInput && !$isAtom) {
                                             $reader->read();
                                             $this->channel["textInput"]["{$name}"] = $reader->value;
                                         } else {
                                             if ($name == "item" && $reader->nodeType == 1 && !$isAtom) {
                                                 $isInItem = 1;
                                                 $itemNumber++;
                                                 $item = array();
                                             } else {
                                                 if (in_array("{$name}", $this->itemElements) && $reader->nodeType == 1 && $isInItem && !$isAtom) {
                                                     $reader->read();
                                                     $item["{$name}"] = $reader->value;
                                                 } else {
                                                     if ($name == "description" && $reader->nodeType == 1 && $isInItem && !$isAtom) {
                                                         $isInDescription = 1;
                                                         $reader->read();
                                                         $description = $reader->value;
                                                         if ($this->strip) {
                                                             $newDescription = preg_replace("/<.+?>/", "", $description);
                                                         } else {
                                                             $newDescription = $description;
                                                         }
                                                         $item["description"] = $newDescription;
                                                     } else {
                                                         if ($name == "description" && $reader->nodeType == 15) {
                                                             $isInDescription = 0;
                                                         } else {
                                                             if ($name == "enclosure" && $reader->nodeType == 1 && $isInItem && !$isAtom) {
                                                                 foreach ($this->enclosureAttributes as $enatt) {
                                                                     if ($reader->moveToAttribute("{$enatt}")) {
                                                                         $item["enclosure"]["{$enatt}"] = $reader->value;
                                                                     }
                                                                 }
                                                             } else {
                                                                 if ($name == "item" && $reader->nodeType == 15 && !$isAtom) {
                                                                     $isInItem = 0;
                                                                     if ($itemNumber <= $returns) {
                                                                         array_push($this->items, $item);
                                                                     }
                                                                 } else {
                                                                     if (in_array("{$name}", $this->feedElements) && $reader->nodeType == 1 && !$isInItem && $isAtom) {
                                                                         $reader->read();
                                                                         $this->channel["{$name}"] = $reader->value;
                                                                     } else {
                                                                         if ($name == "title" && $reader->nodeType == 1 && !$isInSource && $isAtom) {
                                                                             if ($reader->moveToAttribute("type")) {
                                                                                 if ($isInItem) {
                                                                                     $item["titleAttributes"]["type"] = $reader->value;
                                                                                 } else {
                                                                                     $this->channel["titleAttributes"]["type"] = $reader->value;
                                                                                 }
                                                                             }
                                                                             $reader->read();
                                                                             if ($isInItem) {
                                                                                 $item["title"] = $reader->value;
                                                                             } else {
                                                                                 $this->channel["title"] = $reader->value;
                                                                             }
                                                                         } else {
                                                                             if ($name == "link" && $reader->nodeType == 1 && !$isInItem && $isAtom) {
                                                                                 $feedLinks++;
                                                                                 foreach ($this->linkAttributes as $latt) {
                                                                                     if ($reader->moveToAttribute("{$latt}")) {
                                                                                         $this->channel["links"]["{$feedLinks}"]["{$latt}"] = $reader->value;
                                                                                     }
                                                                                 }
                                                                             } else {
                                                                                 if ($name == "generator" && $reader->nodeType == 1 && $isAtom) {
                                                                                     $reader->moveToAttribute("uri");
                                                                                     $this->channel["generatorURI"] = $reader->value;
                                                                                     $this->channel["link"] = $reader->value;
                                                                                     $reader->read();
                                                                                     $this->channel["{$name}"] = $reader->value;
                                                                                 } else {
                                                                                     if ($name == "author" && $reader->nodeType == 1 && $isAtom) {
                                                                                         $isInAuthor = 1;
                                                                                         $author = array();
                                                                                     } else {
                                                                                         if (in_array($name, $this->authorElements) && $reader->nodeType == 1 && $isInAuthor && $isAtom) {
                                                                                             $reader->read();
                                                                                             $author["{$name}"] = $reader->value;
                                                                                         } else {
                                                                                             if ($name == "author" && $reader->nodeType == 15 && $isAtom) {
                                                                                                 $isInAuthor = 0;
                                                                                                 if ($isInItem) {
                                                                                                     array_push($this->authors, $author);
                                                                                                     $item["authors"] = $this->authors;
                                                                                                     $this->authors = array();
                                                                                                 } else {
                                                                                                     array_push($this->feedAuthors, $author);
                                                                                                     $this->channel["authors"] = $this->feedAuthors;
                                                                                                 }
                                                                                             } else {
                                                                                                 if ($name == "category" && $reader->nodeType == 1 && !$isInItem && $isAtom) {
                                                                                                     $feedCategories++;
                                                                                                     foreach ($this->categoryAttributes as $cat) {
                                                                                                         if ($reader->moveToAttribute("{$cat}")) {
                                                                                                             $this->channel["categories"]["{$feedCategories}"]["{$cat}"] = $reader->value;
                                                                                                         }
                                                                                                     }
                                                                                                 } else {
                                                                                                     if ($name == "rights" && $reader->nodeType == 1 && !$isInItem && $isAtom) {
                                                                                                         if ($reader->moveToAttribute("src")) {
                                                                                                             $this->channel["rights"]["src"] = $reader->value;
                                                                                                         }
                                                                                                         if ($reader->moveToAttribute("type")) {
                                                                                                             $this->channel["rights"]["type"] = $reader->value;
                                                                                                         }
                                                                                                         $reader->read();
                                                                                                         $this->channel["rights"]["rights"] = $reader->value;
                                                                                                     } else {
                                                                                                         if ($name == "entry" && $reader->nodeType == 1 && $isAtom) {
                                                                                                             $isInItem = 1;
                                                                                                             $item = array();
                                                                                                             $itemNumber++;
                                                                                                             $itemLinks = -1;
                                                                                                             $itemCategories = -1;
                                                                                                         } else {
                                                                                                             if ($name == "entry" && $reader->nodeType == 15 && $isAtom) {
                                                                                                                 $isInItem = 0;
                                                                                                                 if ($itemNumber <= $returns) {
                                                                                                                     array_push($this->items, $item);
                                                                                                                 }
                                                                                                                 $authors = array();
                                                                                                             } else {
                                                                                                                 if (in_array("{$name}", $this->entryElements) && $reader->nodeType == 1 && $isInItem && $isAtom) {
                                                                                                                     $reader->read();
                                                                                                                     $item["{$name}"] = $reader->value;
                                                                                                                 } else {
                                                                                                                     if ($name == "rights" && $reader->nodeType == 1 && $isInItem && $isAtom) {
                                                                                                                         if ($reader->moveToAttribute("src")) {
                                                                                                                             $item["rights"]["src"] = $reader->value;
                                                                                                                         }
                                                                                                                         if ($reader->moveToAttribute("type")) {
                                                                                                                             $item["rights"]["type"] = $reader->value;
                                                                                                                         }
                                                                                                                         $reader->read();
                                                                                                                         $item["rights"]["rights"] = $reader->value;
                                                                                                                     } else {
                                                                                                                         if ($name == "link" && $reader->nodeType == 1 && $isInItem && $isAtom) {
                                                                                                                             $itemLinks++;
                                                                                                                             foreach ($this->linkAttributes as $latt2) {
                                                                                                                                 if ($reader->moveToAttribute("{$latt2}")) {
                                                                                                                                     $item["links"]["{$itemLinks}"]["{$latt2}"] = $reader->value;
                                                                                                                                     $item["link"] = $item["links"][0]["href"];
                                                                                                                                 }
                                                                                                                             }
                                                                                                                         } else {
                                                                                                                             if ($name == "category" && $reader->nodeType == 1 && $isInItem && $isAtom) {
                                                                                                                                 $itemCategories++;
                                                                                                                                 foreach ($this->categoryAttributes as $catt) {
                                                                                                                                     if ($reader->moveToAttribute("{$catt}")) {
                                                                                                                                         $item["categories"]["{$itemCategories}"]["{$catt}"] = $reader->value;
                                                                                                                                     }
                                                                                                                                 }
                                                                                                                             } else {
                                                                                                                                 if ($name == "contributor" && $reader->nodeType == 1 && $isInItem && $isAtom) {
                                                                                                                                     $isInContributor = 1;
                                                                                                                                     $contributor = array();
                                                                                                                                 } else {
                                                                                                                                     if (in_array($name, $this->authorElements) && $reader->nodeType == 1 && $isInContributor && $isAtom) {
                                                                                                                                         $reader->read();
                                                                                                                                         $contributor["{$name}"] = $reader->value;
                                                                                                                                     } else {
                                                                                                                                         if ($name == "contributor" && $reader->nodeType == 15 && $isAtom) {
                                                                                                                                             $isInContributor = 0;
                                                                                                                                             array_push($this->contributors, $contributor);
                                                                                                                                             $item["contributors"] = $this->contributors;
                                                                                                                                         } else {
                                                                                                                                             if ($name == "source" && $reader->nodeType == 1 && $isAtom) {
                                                                                                                                                 $isInSource = 1;
                                                                                                                                             } else {
                                                                                                                                                 if ($name == "source" && $reader->nodeType == 15 && $isAtom) {
                                                                                                                                                     $isInSource = 0;
                                                                                                                                                 } else {
                                                                                                                                                     if ($name == "summary" && $reader->nodeType == 1 && $isInItem && $isAtom) {
                                                                                                                                                         if ($reader->moveToAttribute("src")) {
                                                                                                                                                             $item["sourceAttributes"]["src"] = $reader->value;
                                                                                                                                                         }
                                                                                                                                                         if ($reader->moveToAttribute("type")) {
                                                                                                                                                             $item["sourceAttributes"]["type"] = $reader->value;
                                                                                                                                                         }
                                                                                                                                                         $reader->read();
                                                                                                                                                         $summary = $reader->value;
                                                                                                                                                         if ($this->strip) {
                                                                                                                                                             $newSummary = preg_replace("/<.+?>/", "", $summary);
                                                                                                                                                         } else {
                                                                                                                                                             $newSummary = $summary;
                                                                                                                                                         }
                                                                                                                                                         $item["source"] = $newSummary;
                                                                                                                                                     } else {
                                                                                                                                                         if ($name == "content" && $reader->nodeType == 1 && $isInItem && $isAtom) {
                                                                                                                                                             $isInDescription = 1;
                                                                                                                                                             if ($reader->moveToAttribute("src")) {
                                                                                                                                                                 $item["contentAttributes"]["src"] = $reader->value;
                                                                                                                                                             }
                                                                                                                                                             if ($reader->moveToAttribute("type")) {
                                                                                                                                                                 $item["contentAttributes"]["type"] = $reader->value;
                                                                                                                                                             }
                                                                                                                                                             $reader->read();
                                                                                                                                                             $content = $reader->value;
                                                                                                                                                             if ($this->strip) {
                                                                                                                                                                 $newContent = preg_replace("/<.+?>/", "", $content);
                                                                                                                                                             } else {
                                                                                                                                                                 $newContent = $content;
                                                                                                                                                             }
                                                                                                                                                             $item["content"] = $newContent;
                                                                                                                                                             $item["description"] = $newContent;
                                                                                                                                                         } else {
                                                                                                                                                             if ($name == "content" && $reader->nodeType == 15 && $isInItem && $isAtom) {
                                                                                                                                                                 $isInDescription = 0;
                                                                                                                                                             } else {
                                                                                                                                                                 if ($reader->nodeType == 4 && $isInDescription) {
                                                                                                                                                                     $cdata = $reader->value;
                                                                                                                                                                     if ($this->strip) {
                                                                                                                                                                         $cdata = preg_replace("/<.+?>/", "", $cdata);
                                                                                                                                                                     }
                                                                                                                                                                     $item["content"] = $cdata;
                                                                                                                                                                     $item["description"] = $item["content"];
                                                                                                                                                                 }
                                                                                                                                                             }
                                                                                                                                                         }
                                                                                                                                                     }
                                                                                                                                                 }
                                                                                                                                             }
                                                                                                                                         }
                                                                                                                                     }
                                                                                                                                 }
                                                                                                                             }
                                                                                                                         }
                                                                                                                     }
                                                                                                                 }
                                                                                                             }
                                                                                                         }
                                                                                                     }
                                                                                                 }
                                                                                             }
                                                                                         }
                                                                                     }
                                                                                 }
                                                                             }
                                                                         }
                                                                     }
                                                                 }
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
         $reader->close;
     }
 }