Exemplo n.º 1
0
 /**
  * Parse elements from Yahoo RSS Media extension
  *
  * @param SimpleXMLElement $xmlElement
  * @param ItemInInterface $item with Media added
  */
 protected function handleMediaExtension(SimpleXMLElement $xmlElement, ItemInInterface $item)
 {
     foreach ($xmlElement->children('http://search.yahoo.com/mrss/') as $xmlMedia) {
         $media = new Media();
         $media->setUrl($this->getAttributeValue($xmlMedia, 'url'))->setType($this->searchAttributeValue($xmlMedia, array('type', 'medium')))->setLength($this->getAttributeValue($xmlMedia, 'fileSize'));
         $item->addMedia($media);
     }
 }
 /**
  * Handles enclosures if any.
  *
  * @param SimpleXMLElement $element
  * @param ItemInInterface  $item
  *
  * @return $this
  */
 protected function handleEnclosure(SimpleXMLElement $element, ItemInInterface $item)
 {
     if (isset($element->enclosure)) {
         $media = $this->createMedia($element->enclosure);
         $item->addMedia($media);
     }
     return $this;
 }
Exemplo n.º 3
0
 /**
  * Handles enclosures if any.
  *
  * @param SimpleXMLElement $element
  * @param ItemInInterface  $item
  *
  * @return $this
  */
 protected function handleEnclosure(SimpleXMLElement $element, ItemInInterface $item)
 {
     foreach ($element->link as $link) {
         if (strcasecmp($this->getAttributeValue($link, 'rel'), 'enclosure') === 0) {
             $media = $this->createMedia($link);
             $item->addMedia($media);
         }
     }
     return $this;
 }