Esempio n. 1
0
 /**
  * Filter HTML for entry content.
  *
  * @param Feed $feed Feed object
  * @param Item $item Item object
  */
 public function filterItemContent(Feed $feed, Item $item)
 {
     if ($this->isFilteringEnabled()) {
         $filter = Filter::html($item->getContent(), $feed->getSiteUrl());
         $filter->setConfig($this->config);
         $item->content = $filter->execute();
     } else {
         Logger::setMessage(get_called_class() . ': Content filtering disabled');
     }
 }
Esempio n. 2
0
 /**
  * Find the item title.
  *
  * @param SimpleXMLElement $entry Feed item
  * @param Item             $item  Item object
  */
 public function findItemTitle(SimpleXMLElement $entry, Item $item)
 {
     $title = XmlParser::getXPathResult($entry, 'atom:title', $this->namespaces) ?: XmlParser::getXPathResult($entry, 'title');
     $item->title = Filter::stripWhiteSpace((string) current($title)) ?: $item->url;
 }
Esempio n. 3
0
 /**
  * Convert the attribute list to html.
  *
  * @param array $attributes Attributes
  *
  * @return string
  */
 public function toHtml(array $attributes)
 {
     $html = array();
     foreach ($attributes as $attribute => $value) {
         $html[] = sprintf('%s="%s"', $attribute, Filter::escape($value));
     }
     return implode(' ', $html);
 }
Esempio n. 4
0
 /**
  * Normalize encoding and strip head tag.
  */
 public function prepareHtml()
 {
     $html_encoding = XmlParser::getEncodingFromMetaTag($this->html);
     $this->html = Encoding::convert($this->html, $html_encoding ?: $this->encoding);
     $this->html = Filter::stripHeadTags($this->html);
     Logger::setMessage(get_called_class() . ': HTTP Encoding "' . $this->encoding . '" ; HTML Encoding "' . $html_encoding . '"');
 }
Esempio n. 5
0
 /**
  * Parse tag content.
  *
  * @param resource $parser  XML parser
  * @param string   $content Tag content
  */
 public function dataTag($parser, $content)
 {
     // Replace   with normal space
     $content = str_replace(" ", ' ', $content);
     $this->output .= Filter::escape($content);
 }