All fields available in the RSS
Not just link & title but all available fields
This commit is contained in:
1 parent
cf9d20f83b
commit
9dfeb1d528
1 file changed
+18
-4
@@ -32,6 +32,9 @@ include_once(_PS_PEAR_XML_PARSER_PATH_.'Parser.php');
|
|||||||
|
|
||||||
class Blockrss extends Module
|
class Blockrss extends Module
|
||||||
{
|
{
|
||||||
|
|
||||||
|
private static $xmlFields = array('title', 'guid', 'description', 'author', 'comments', 'pubDate', 'source', 'link', 'content');
|
||||||
|
|
||||||
function __construct()
|
function __construct()
|
||||||
{
|
{
|
||||||
$this->name = 'blockrss';
|
$this->name = 'blockrss';
|
||||||
@@ -154,10 +157,21 @@ class Blockrss extends Module
|
|||||||
if ($url && ($contents = Tools::file_get_contents($url)))
|
if ($url && ($contents = Tools::file_get_contents($url)))
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (@$src = new XML_Feed_Parser($contents))
|
if (@$src = new XML_Feed_Parser($contents)) {
|
||||||
for ($i = 0; $i < ($nb ? $nb : 5); $i++)
|
for ($i = 0; $i < ($nb ? $nb : 5); $i++) {
|
||||||
if (@$item = $src->getEntryByOffset($i))
|
if (@$item = $src->getEntryByOffset($i)) {
|
||||||
$rss_links[] = array('title' => $item->title, 'url' => $item->link);
|
|
||||||
|
$xmlValues = array();
|
||||||
|
foreach(self::$xmlFields as $xmlField) {
|
||||||
|
$xmlValues[$xmlField] = $item->__get($xmlField);
|
||||||
|
}
|
||||||
|
$xmlValues['enclosure'] = $item->getEnclosure();
|
||||||
|
# Compatibility
|
||||||
|
$xmlValues['url'] = $xmlValues['link'];
|
||||||
|
$rss_links[] = $xmlValues;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (XML_Feed_Parser_Exception $e)
|
catch (XML_Feed_Parser_Exception $e)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in new issue
Block a user