From 53b6519f5531c3cb603542ae28a17c619097e905 Mon Sep 17 00:00:00 2001 From: Cameron Date: Tue, 16 Feb 2016 13:08:15 -0800 Subject: [PATCH] Fix for CDATA in XML feeds. e107 blog feed now working with SSL enabled. --- e107_admin/boot.php | 39 +++++++++++++++++++++++++++++++ e107_admin/includes/infopanel.php | 11 ++++----- e107_handlers/xml_class.php | 2 +- 3 files changed, 44 insertions(+), 8 deletions(-) diff --git a/e107_admin/boot.php b/e107_admin/boot.php index 7f538ec02..768f68dfe 100644 --- a/e107_admin/boot.php +++ b/e107_admin/boot.php @@ -20,6 +20,10 @@ if (!defined('e107_INIT')) header('Content-type: text/html; charset=utf-8', TRUE); +define('ADMINFEED', 'http://e107.org/adminfeed'); + + + if(!empty($_GET['iframe'])) // global iframe support. { define('e_IFRAME', true); @@ -33,6 +37,41 @@ if(ADMIN && defset('e_ADMIN_UI') && varset($_POST['mode']) == 'sef' && !empty($_ exit; } +if(ADMIN && e_AJAX_REQUEST && varset($_GET['mode']) == 'core' && ($_GET['type'] == 'feed')) +{ + + $limit = 3; + + if($data = e107::getXml()->getRemoteFile(ADMINFEED,3)) + { + // print_a($data); + $rows = e107::getXml()->parseXml($data, 'advanced'); + $defaultImg = $rows['channel']['image']['url']; + + $text = '
'; + $count = 1; + foreach($rows['channel']['item'] as $row) + { + if($count > $limit){ break; } + + $description = $tp->toText($row['description']); + $text .= ' +
+
+

'.$row['title'].' — '.$row['pubDate'].'

+ '.$tp->text_truncate($description,150).' +
'; + $count++; + } + $text .= '
'; + echo $text; + + } + exit; +} + + + if(ADMIN && e_AJAX_REQUEST && varset($_GET['mode']) == 'addons' ) { $type = ($_GET['type'] == 'plugin') ? 'plugin' : 'theme'; diff --git a/e107_admin/includes/infopanel.php b/e107_admin/includes/infopanel.php index ec883d8ad..f49747948 100644 --- a/e107_admin/includes/infopanel.php +++ b/e107_admin/includes/infopanel.php @@ -17,7 +17,7 @@ if (!defined('e107_INIT')) exit; } -define('ADMINFEED', 'http://e107.org/adminfeed'); + define('ADMINFEEDMORE', 'http://e107.org/blog'); @@ -31,17 +31,14 @@ class adminstyle_infopanel function __construct() { - e107::js('core','zrssfeed/jquery.zrssfeed.min.js'); // http://www.zazar.net/developers/jquery/zrssfeed/ + // e107::js('core','zrssfeed/jquery.zrssfeed.min.js'); // http://www.zazar.net/developers/jquery/zrssfeed/ $code = " jQuery(function($){ - $('#e-adminfeed').rssfeed('".ADMINFEED."', { - limit: 3, - header: false, - linktarget: '_blank' - }); + + $('#e-adminfeed').load('".e_ADMIN."admin.php?mode=core&type=feed'); $('#e-adminfeed-plugin').load('".e_ADMIN."admin.php?mode=addons&type=plugin'); diff --git a/e107_handlers/xml_class.php b/e107_handlers/xml_class.php index dbc1bdc38..4384bc612 100644 --- a/e107_handlers/xml_class.php +++ b/e107_handlers/xml_class.php @@ -589,7 +589,7 @@ class xmlClass $xmlData = str_replace(array_keys($extendedTypes), array_values($extendedTypes), $xmlData); - if(!$xml = simplexml_load_string($xmlData)) + if(!$xml = simplexml_load_string($xmlData, 'SimpleXMLElement', LIBXML_NOCDATA)) { $this->errors = $this->getErrors($xmlData); return FALSE;