/** * 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'); } }
/** * 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; }
/** * 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); }
/** * 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 . '"'); }
/** * 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); }