public function Entry::getContent in Zircon Profile 8.0
Same name in this branch
- 8.0 vendor/zendframework/zend-feed/src/Writer/Entry.php \Zend\Feed\Writer\Entry::getContent()
- 8.0 vendor/zendframework/zend-feed/src/Reader/Extension/Content/Entry.php \Zend\Feed\Reader\Extension\Content\Entry::getContent()
- 8.0 vendor/zendframework/zend-feed/src/Reader/Extension/Atom/Entry.php \Zend\Feed\Reader\Extension\Atom\Entry::getContent()
- 8.0 vendor/zendframework/zend-feed/src/Reader/Extension/DublinCore/Entry.php \Zend\Feed\Reader\Extension\DublinCore\Entry::getContent()
Same name and namespace in other branches
- 8 vendor/zendframework/zend-feed/src/Reader/Extension/Atom/Entry.php \Zend\Feed\Reader\Extension\Atom\Entry::getContent()
Get the entry content
Return value
string
File
- vendor/
zendframework/ zend-feed/ src/ Reader/ Extension/ Atom/ Entry.php, line 87
Class
Namespace
Zend\Feed\Reader\Extension\AtomCode
public function getContent() {
if (array_key_exists('content', $this->data)) {
return $this->data['content'];
}
$content = null;
$el = $this
->getXpath()
->query($this
->getXpathPrefix() . '/atom:content');
if ($el->length > 0) {
$el = $el
->item(0);
$type = $el
->getAttribute('type');
switch ($type) {
case '':
case 'text':
case 'text/plain':
case 'html':
case 'text/html':
$content = $el->nodeValue;
break;
case 'xhtml':
$this
->getXpath()
->registerNamespace('xhtml', 'http://www.w3.org/1999/xhtml');
$xhtml = $this
->getXpath()
->query($this
->getXpathPrefix() . '/atom:content/xhtml:div')
->item(0);
$d = new DOMDocument('1.0', $this
->getEncoding());
$deep = version_compare(PHP_VERSION, '7', 'ge') ? 1 : true;
$xhtmls = $d
->importNode($xhtml, $deep);
$d
->appendChild($xhtmls);
$content = $this
->collectXhtml($d
->saveXML(), $d
->lookupPrefix('http://www.w3.org/1999/xhtml'));
break;
}
}
if (!$content) {
$content = $this
->getDescription();
}
$this->data['content'] = trim($content);
return $this->data['content'];
}