/**
  * Generate HTML from item URL
  *
  * @access public
  * @param  Item $item
  * @return bool
  */
 public function generateHtmlFromUrl(Item $item)
 {
     if (preg_match('/youtube\\.com\\/watch\\?v=(.*)/', $item->getUrl(), $matches)) {
         $item->setContent('<iframe width="560" height="315" src="//www.youtube.com/embed/' . $matches[1] . '" frameborder="0"></iframe>');
         return true;
     }
     return false;
 }
 /**
  * Execute Content Generator
  *
  * @access public
  * @param  Item $item
  * @return boolean
  */
 public function execute(Item $item)
 {
     foreach ($this->extensions as $extension) {
         if (substr($item->getUrl(), -strlen($extension)) === $extension) {
             $item->setContent('<a href="' . $item->getUrl() . '" target="_blank">' . $item->getUrl() . '</a>');
             return true;
         }
     }
     return false;
 }
 /**
  * Execute Item Processor
  *
  * @access public
  * @param  Feed $feed
  * @param  Item $item
  * @return bool
  */
 public function execute(Feed $feed, Item $item)
 {
     if ($this->config->getContentFiltering(true)) {
         $filter = Filter::html($item->getContent(), $feed->getSiteUrl());
         $filter->setConfig($this->config);
         $item->setContent($filter->execute());
     } else {
         Logger::setMessage(get_called_class() . ': Content filtering disabled');
     }
 }
Exemple #4
0
 /**
  * Find the item content.
  *
  * @param SimpleXMLElement      $entry Feed item
  * @param \PicoFeed\Parser\Item $item  Item object
  */
 public function findItemContent(SimpleXMLElement $entry, Item $item)
 {
     $content = XmlParser::getXPathResult($entry, 'content:encoded', $this->namespaces);
     if (XmlParser::getValue($content) === '') {
         $content = XmlParser::getXPathResult($entry, 'rss:description', $this->namespaces) ?: XmlParser::getXPathResult($entry, 'description') ?: $entry->description;
     }
     $item->setContent(XmlParser::getValue($content));
 }
Exemple #5
0
 /**
  * Find the item content.
  *
  * @param SimpleXMLElement      $entry Feed item
  * @param \PicoFeed\Parser\Item $item  Item object
  */
 public function findItemContent(SimpleXMLElement $entry, Item $item)
 {
     $item->setContent($this->getContent($entry));
 }