예제 #1
0
파일: Opml.php 프로젝트: slowmotion/Readr
 /**
  * @param SimpleXMLElement $xml
  * @param Feeds $feeds
  * @param Tags $tags
  * @return void
  */
 public function process(SimpleXMLElement $xml, Feeds $feeds, Tags $tags)
 {
     $title = (string) $xml->attributes()->text;
     foreach ($xml->outline as $outline) {
         $type = (string) $outline->attributes()->type;
         if ($type == 'rss') {
             $result = $feeds->insert((string) $outline->attributes()->text, (string) $outline->attributes()->xmlUrl, (string) $outline->attributes()->htmlUrl);
             if ($result && $title) {
                 $tags->insert($title, $feeds->lastInsertId());
             }
         } else {
             $this->process($outline, $feeds, $tags);
         }
     }
 }