In a Xenforo project, we are importing podcasts from an RSS feed in Feedburner.
The Feedburner RSS XML contains an <itunes:summary> tag that describes the podcast. We would like to show that summary text to the members so they can decide whether they would like to listen to the podcast.
Xenforo is using \Laminas\Feed\Rss\Entry::getContent() to populate a template variable, but there is no corresponding content in the RSS XML, therefore the {content} template variable is resulting as empty.
I have found that I can patch the \Laminas\Feed\Rss\Entry::getContent() method to use the Podcast extension’s getSummary() to populate the empty $content variable before returning it. That gives us what we want:
// file: /src/vendor/laminas/laminas-feed/src/Reader/Entry/Rss.php
// line: 136 at 20201005
/**
* Get the entry content
*
* @return string
*/
public function getContent()
{
if (array_key_exists('content', $this->data)) {
return $this->data['content'];
}
$content = $this->getExtension('Content')->getContent();
if (! $content) {
$content = $this->getDescription();
}
if (empty($content)) {
$content = $this->getExtension('Atom')->getContent();
}
// begin antz 20201005 - implement iTunes podcast in RSS feed importer
if (empty($content)) {
$content = nl2br($this->getExtension('Podcast')->getSummary());
}
// end antz 20201005 - implement iTunes podcast in RSS feed importer
$this->data['content'] = $content;
return $this->data['content'];
}
Now, the only thing is that we don’t want to be hacking and patching the Laminas files because the changes are likely to be overwritten with future upgrades, and also Xenforo performs periodic file integrity checks and it is generating a big error message that all staff are seeing in the Administration Control Panel, and that message can’t be dismissed.
I am requesting advice how to best implement this feature. It seems to me that Laminas Rss should have a method getSummary() in order to access the Podcast Extension’s getSummary() method, and then Xenforo could use that to populate a {summary} variable for our template.