예제 #1
0
 /**
  * @param Item $item
  */
 public function processItem($item)
 {
     $data = $item->getData();
     $replaced = [];
     $replaced[$this->attribute] = str_replace($this->search, $this->replace, $data[$this->attribute]);
     $item->setData($replaced);
 }
예제 #2
0
파일: Rss.php 프로젝트: urmaul/rss-pipes
 public function parseBody($body, $feed)
 {
     $xml = new \SimpleXMLElement($body);
     foreach ($xml->attributes() as $key => $val) {
         $feed->attributes += [$key => $val];
     }
     $feed->namespaces += $xml->getDocNamespaces();
     $metadata = $this->parseChildrenValues($xml->channel);
     unset($metadata['item']);
     $feed->metadata += $metadata;
     foreach ($xml->channel->item as $key => $element) {
         $item = new Item();
         $item->setData($this->parseChildrenValues($element));
         $item->attributes += $this->parseAllAttributes($element);
         $feed->items[] = $item;
     }
 }
예제 #3
0
파일: Atom.php 프로젝트: urmaul/rss-pipes
 public function parseBody($body, $feed)
 {
     $xml = new \SimpleXMLElement($body);
     foreach ($xml->attributes() as $key => $val) {
         $feed->attributes += [$key => $val];
     }
     $feed->namespaces += $xml->getDocNamespaces();
     $metadata = $this->parseChildrenValues($xml);
     unset($metadata['entry']);
     $feed->metadata += $metadata;
     foreach ($xml->entry as $key => $element) {
         $item = new Item();
         $item->guid = (string) $element->id;
         $item->description = (string) $element->content;
         $item->setData($this->parseChildrenValues($element));
         $item->attributes += $this->parseAllAttributes($element);
         $feed->items[] = $item;
     }
 }