Revision history for NewRSSAction
Revision [23223]
Last edited on 2016-05-20 07:38:47 by SamuelDr [Replaces old-style internal links with new pipe-split links.]Additions:
>>For this action to work, you'll have to first download [[http://magpierss.sourceforge.net/ | Magpie RSS]] and put it in the **./3rdparty/plugins/magpierss/**.
Deletions:
No Differences
Additions:
if ((!$rss_path) && $wikka_vars) $rss_path = $wikka_vars;
$rss_path = $this->cleanUrl(trim($rss_path));
if (preg_match("/^(http|https):\/\/([^\\s\"<>]+)$/i", $rss_path))
{
// Set Your Proxy Settings Here
define('MAGPIE_PROXY_HOST', '');
define('MAGPIE_PROXY_PORT', '');
// Path To MagpieRSS
define('MAGPIE_DIR', '3rdparty/plugins/magpierss/');
// Cache Settings
define('MAGPIE_CACHE_DIR', $rss_cache_path);
define('MAGPIE_CACHE_ON', $caching);
// Not sure how to use this one, so i'll stick with commenting it, default aging with Magpie is set to 1 hour.
#define('MAGPIE_CACHE_AGE', 10);
require_once(MAGPIE_DIR.'rss_fetch.inc');
$rss = fetch_rss( $rss_path );
if ($rss) {
$i = 1;
$cached_output = "<h3>".$rss->channel['title']."</h3>";
if ($rss->channel['link']) {
$cached_output .= '<div align="right"><a href="'.$rss->channel['link'].'">FEED URL : '.$rss->channel['link'].'</a></div>';
}
$cached_output .= "<ul>\n";
foreach ($rss->items as $item) {
$href = $item['link'];
$title = $item['title'];
if ($item['content']) {
$description = implode($item['content']);
}
else {
$description = $item['description'];
}
$cached_output .= "<li><a href=$href>$title</a><br />$description</li>";
if ($i >= $maxitems) {
break;
}
$i++;
}
$cached_output .= "</ul>\n";
echo $this->ReturnSafeHTML($cached_output);
} else {
echo "An error occured when fetching or parsing the feed.<br />Check that the feed is compliant.";
}
} else {
echo '<em class="error">Error: Invalid RSS syntax. <br /> Proper usage: {{rss http://domain.com/feed.xml}} or {{rss url="http://domain.com/feed.xml" maxitems="5"}}</em>';
?>
%%
You also need to patch the ##rss_fetch.inc## file included with magpierss. This patch adds proxy support. Save the file below as ##magpierss_proxy_support.patch## in the same directory as ##rss_fetch.inc## (usually ##3rdparty/plugins/magpierss##).
%%(patch)diff -u --recursive magpierss-0.71.1/rss_fetch.inc magpierss-0.71.1-proxy/rss_fetch.inc
--- magpierss-0.71.1/rss_fetch.inc 2005-02-09 13:59:01.000000000 -0600
+++ magpierss-0.71.1-proxy/rss_fetch.inc 2005-08-06 16:52:02.000000000 -0500
@@ -270,6 +270,8 @@
$client->agent = MAGPIE_USER_AGENT;
$client->read_timeout = MAGPIE_FETCH_TIME_OUT;
$client->use_gzip = MAGPIE_USE_GZIP;
+ $client->proxy_host = MAGPIE_PROXY_HOST;
+ $client->proxy_port = MAGPIE_PROXY_PORT;
if (is_array($headers) ) {
$client->rawheaders = $headers;
}
@@ -391,6 +393,14 @@
if ( !defined('MAGPIE_USE_GZIP') ) {
define('MAGPIE_USE_GZIP', true);
}
+
+ if ( !defined('MAGPIE_PROXY_HOST') ) {
+ define ('MAGPIE_PROXY_HOST', '');
+ }
+
+ if ( !defined('MAGPIE_PROXY_PORT', '') ) {
+ define ('MAGPIE_PROXY_PORT', '');
+ }
}
// NOTE: the following code should really be in Snoopy, or at least
%%
Change the the magpeirss directory. Then apply the patch by using the following command (in Linux):
%%(shell) patch -Np1 <magpierss_proxy_support.patch %%
To set a proxy, modify the MAGPIE_PROXY_HOST and MAGPIE_PROXY_PORT defines in your new rss.php file.
I think that it is **NOT** idiot proof and there may be place for optimisations.
Feel free to edit the code and tell me what you did, i'm a learner !
And, at last, please comment, so I'll know that people are seeing it. Thank you !
~& If you have any problems with the proxy support patch, please let JasonHuebel know.
----
CategoryDevelopmentSyndication
$rss_path = $this->cleanUrl(trim($rss_path));
if (preg_match("/^(http|https):\/\/([^\\s\"<>]+)$/i", $rss_path))
{
// Set Your Proxy Settings Here
define('MAGPIE_PROXY_HOST', '');
define('MAGPIE_PROXY_PORT', '');
// Path To MagpieRSS
define('MAGPIE_DIR', '3rdparty/plugins/magpierss/');
// Cache Settings
define('MAGPIE_CACHE_DIR', $rss_cache_path);
define('MAGPIE_CACHE_ON', $caching);
// Not sure how to use this one, so i'll stick with commenting it, default aging with Magpie is set to 1 hour.
#define('MAGPIE_CACHE_AGE', 10);
require_once(MAGPIE_DIR.'rss_fetch.inc');
$rss = fetch_rss( $rss_path );
if ($rss) {
$i = 1;
$cached_output = "<h3>".$rss->channel['title']."</h3>";
if ($rss->channel['link']) {
$cached_output .= '<div align="right"><a href="'.$rss->channel['link'].'">FEED URL : '.$rss->channel['link'].'</a></div>';
}
$cached_output .= "<ul>\n";
foreach ($rss->items as $item) {
$href = $item['link'];
$title = $item['title'];
if ($item['content']) {
$description = implode($item['content']);
}
else {
$description = $item['description'];
}
$cached_output .= "<li><a href=$href>$title</a><br />$description</li>";
if ($i >= $maxitems) {
break;
}
$i++;
}
$cached_output .= "</ul>\n";
echo $this->ReturnSafeHTML($cached_output);
} else {
echo "An error occured when fetching or parsing the feed.<br />Check that the feed is compliant.";
}
} else {
echo '<em class="error">Error: Invalid RSS syntax. <br /> Proper usage: {{rss http://domain.com/feed.xml}} or {{rss url="http://domain.com/feed.xml" maxitems="5"}}</em>';
?>
%%
You also need to patch the ##rss_fetch.inc## file included with magpierss. This patch adds proxy support. Save the file below as ##magpierss_proxy_support.patch## in the same directory as ##rss_fetch.inc## (usually ##3rdparty/plugins/magpierss##).
%%(patch)diff -u --recursive magpierss-0.71.1/rss_fetch.inc magpierss-0.71.1-proxy/rss_fetch.inc
--- magpierss-0.71.1/rss_fetch.inc 2005-02-09 13:59:01.000000000 -0600
+++ magpierss-0.71.1-proxy/rss_fetch.inc 2005-08-06 16:52:02.000000000 -0500
@@ -270,6 +270,8 @@
$client->agent = MAGPIE_USER_AGENT;
$client->read_timeout = MAGPIE_FETCH_TIME_OUT;
$client->use_gzip = MAGPIE_USE_GZIP;
+ $client->proxy_host = MAGPIE_PROXY_HOST;
+ $client->proxy_port = MAGPIE_PROXY_PORT;
if (is_array($headers) ) {
$client->rawheaders = $headers;
}
@@ -391,6 +393,14 @@
if ( !defined('MAGPIE_USE_GZIP') ) {
define('MAGPIE_USE_GZIP', true);
}
+
+ if ( !defined('MAGPIE_PROXY_HOST') ) {
+ define ('MAGPIE_PROXY_HOST', '');
+ }
+
+ if ( !defined('MAGPIE_PROXY_PORT', '') ) {
+ define ('MAGPIE_PROXY_PORT', '');
+ }
}
// NOTE: the following code should really be in Snoopy, or at least
%%
Change the the magpeirss directory. Then apply the patch by using the following command (in Linux):
%%(shell) patch -Np1 <magpierss_proxy_support.patch %%
To set a proxy, modify the MAGPIE_PROXY_HOST and MAGPIE_PROXY_PORT defines in your new rss.php file.
I think that it is **NOT** idiot proof and there may be place for optimisations.
Feel free to edit the code and tell me what you did, i'm a learner !
And, at last, please comment, so I'll know that people are seeing it. Thank you !
~& If you have any problems with the proxy support patch, please let JasonHuebel know.
----
CategoryDevelopmentSyndication
Deletions:
Additions:
if ((!$rss_path)
Deletions:
$rss_path = $this->cleanUrl(trim($rss_path));
if (preg_match("/^(http|https):\/\/([^\\s\"<>]+)$/i", $rss_path))
{
// Set Your Proxy Settings Here
define('MAGPIE_PROXY_HOST', '');
define('MAGPIE_PROXY_PORT', '');
// Path To MagpieRSS
define('MAGPIE_DIR', '3rdparty/plugins/magpierss/');
// Cache Settings
define('MAGPIE_CACHE_DIR', $rss_cache_path);
define('MAGPIE_CACHE_ON', $caching);
// Not sure how to use this one, so i'll stick with commenting it, default aging with Magpie is set to 1 hour.
#define('MAGPIE_CACHE_AGE', 10);
require_once(MAGPIE_DIR.'rss_fetch.inc');
$rss = fetch_rss( $rss_path );
if ($rss) {
$i = 1;
$cached_output = "<h3>".$rss->channel['title']."</h3>";
if ($rss->channel['link']) {
$cached_output .= '<div align="right"><a href="'.$rss->channel['link'].'">FEED URL : '.$rss->channel['link'].'</a></div>';
}
$cached_output .= "<ul>\n";
foreach ($rss->items as $item) {
$href = $item['link'];
$title = $item['title'];
if ($item['content']) {
$description = implode($item['content']);
}
else {
$description = $item['description'];
}
$cached_output .= "<li><a href=$href>$title</a><br />$description</li>";
if ($i >= $maxitems) {
break;
}
$i++;
}
$cached_output .= "</ul>\n";
echo $this->ReturnSafeHTML($cached_output);
} else {
echo "An error occured when fetching or parsing the feed.<br />Check that the feed is compliant.";
}
} else {
echo '<em class="error">Error: Invalid RSS syntax. <br /> Proper usage: {{rss http://domain.com/feed.xml}} or {{rss url="http://domain.com/feed.xml" maxitems="5"}}</em>';
?>
%%
You also need to patch the ##rss_fetch.inc## file included with magpierss. This patch adds proxy support. Save the file below as ##magpierss_proxy_support.patch## in the same directory as ##rss_fetch.inc## (usually ##3rdparty/plugins/magpierss##).
%%(patch)diff -u --recursive magpierss-0.71.1/rss_fetch.inc magpierss-0.71.1-proxy/rss_fetch.inc
--- magpierss-0.71.1/rss_fetch.inc 2005-02-09 13:59:01.000000000 -0600
+++ magpierss-0.71.1-proxy/rss_fetch.inc 2005-08-06 16:52:02.000000000 -0500
@@ -270,6 +270,8 @@
$client->agent = MAGPIE_USER_AGENT;
$client->read_timeout = MAGPIE_FETCH_TIME_OUT;
$client->use_gzip = MAGPIE_USE_GZIP;
+ $client->proxy_host = MAGPIE_PROXY_HOST;
+ $client->proxy_port = MAGPIE_PROXY_PORT;
if (is_array($headers) ) {
$client->rawheaders = $headers;
}
@@ -391,6 +393,14 @@
if ( !defined('MAGPIE_USE_GZIP') ) {
define('MAGPIE_USE_GZIP', true);
}
+
+ if ( !defined('MAGPIE_PROXY_HOST') ) {
+ define ('MAGPIE_PROXY_HOST', '');
+ }
+
+ if ( !defined('MAGPIE_PROXY_PORT', '') ) {
+ define ('MAGPIE_PROXY_PORT', '');
+ }
}
// NOTE: the following code should really be in Snoopy, or at least
%%
Change the the magpeirss directory. Then apply the patch by using the following command (in Linux):
%%(shell) patch -Np1 <magpierss_proxy_support.patch %%
To set a proxy, modify the MAGPIE_PROXY_HOST and MAGPIE_PROXY_PORT defines in your new rss.php file.
I think that it is **NOT** idiot proof and there may be place for optimisations.
Feel free to edit the code and tell me what you did, i'm a learner !
And, at last, please comment, so I'll know that people are seeing it. Thank you !
~& If you have any problems with the proxy support patch, please let JasonHuebel know.
----
CategoryDevelopmentSyndication
Additions:
**Demos:** --Demo off--
Deletions:
Additions:
**Demos:**--Demow off--
Deletions:
You can see this action working with the ATOM feed there :
http://samueldr.com/pages/PortalRSSFeedGoogleBlog
And with a RSS feed, there :
http://samueldr.com/pages/PortalRSSFeedTheRepublica
Additions:
::c::
Additions:
~-[[RSSHandler]]
Deletions:
Additions:
>>**See also**
~-RSSHandler
~-JwRssTest
**Demos:**
You can see this action working with the ATOM feed there :
~-RSSHandler
~-JwRssTest
**Demos:**
You can see this action working with the ATOM feed there :
Deletions:
Additions:
>>For this action to work, you'll have to first download [[http://magpierss.sourceforge.net/ Magpie RSS]] and put it in the **./3rdparty/plugins/magpierss/**.
Deletions:
Revision [12438]
Edited on 2005-12-26 13:34:41 by NilsLindenberg [changed actions/rss.php accordinngly to bug nr. 55 (improved error codes)]Additions:
echo '<em class="error">Error: Invalid RSS syntax. <br /> Proper usage: {{rss http://domain.com/feed.xml}} or {{rss url="http://domain.com/feed.xml" maxitems="5"}}</em>';
Deletions:
Additions:
----
CategoryDevelopmentSyndication
CategoryDevelopmentSyndication
Additions:
// Set Your Proxy Settings Here
// Path To MagpieRSS
// Cache Settings
To set a proxy, modify the MAGPIE_PROXY_HOST and MAGPIE_PROXY_PORT defines in your new rss.php file.
// Path To MagpieRSS
// Cache Settings
To set a proxy, modify the MAGPIE_PROXY_HOST and MAGPIE_PROXY_PORT defines in your new rss.php file.
Additions:
%%(shell) patch -Np1 <magpierss_proxy_support.patch %%
Deletions:
No Differences
Additions:
define('MAGPIE_PROXY_HOST', '');
define('MAGPIE_PROXY_PORT', '');
You also need to patch the ##rss_fetch.inc## file included with magpierss. This patch adds proxy support. Save the file below as ##magpierss_proxy_support.patch## in the same directory as ##rss_fetch.inc## (usually ##3rdparty/plugins/magpierss##).
%%(patch)diff -u --recursive magpierss-0.71.1/rss_fetch.inc magpierss-0.71.1-proxy/rss_fetch.inc
--- magpierss-0.71.1/rss_fetch.inc 2005-02-09 13:59:01.000000000 -0600
+++ magpierss-0.71.1-proxy/rss_fetch.inc 2005-08-06 16:52:02.000000000 -0500
@@ -270,6 +270,8 @@
$client->agent = MAGPIE_USER_AGENT;
$client->read_timeout = MAGPIE_FETCH_TIME_OUT;
$client->use_gzip = MAGPIE_USE_GZIP;
+ $client->proxy_host = MAGPIE_PROXY_HOST;
+ $client->proxy_port = MAGPIE_PROXY_PORT;
if (is_array($headers) ) {
$client->rawheaders = $headers;
}
@@ -391,6 +393,14 @@
if ( !defined('MAGPIE_USE_GZIP') ) {
define('MAGPIE_USE_GZIP', true);
}
+
+ if ( !defined('MAGPIE_PROXY_HOST') ) {
+ define ('MAGPIE_PROXY_HOST', '');
+ }
+
+ if ( !defined('MAGPIE_PROXY_PORT', '') ) {
+ define ('MAGPIE_PROXY_PORT', '');
+ }
}
// NOTE: the following code should really be in Snoopy, or at least
Change the the magpeirss directory. Then apply the patch by using the following command (in Linux):
##patch -Np1 <magpierss_proxy_support.patch##
~& If you have any problems with the proxy support patch, please let JasonHuebel know.
define('MAGPIE_PROXY_PORT', '');
You also need to patch the ##rss_fetch.inc## file included with magpierss. This patch adds proxy support. Save the file below as ##magpierss_proxy_support.patch## in the same directory as ##rss_fetch.inc## (usually ##3rdparty/plugins/magpierss##).
%%(patch)diff -u --recursive magpierss-0.71.1/rss_fetch.inc magpierss-0.71.1-proxy/rss_fetch.inc
--- magpierss-0.71.1/rss_fetch.inc 2005-02-09 13:59:01.000000000 -0600
+++ magpierss-0.71.1-proxy/rss_fetch.inc 2005-08-06 16:52:02.000000000 -0500
@@ -270,6 +270,8 @@
$client->agent = MAGPIE_USER_AGENT;
$client->read_timeout = MAGPIE_FETCH_TIME_OUT;
$client->use_gzip = MAGPIE_USE_GZIP;
+ $client->proxy_host = MAGPIE_PROXY_HOST;
+ $client->proxy_port = MAGPIE_PROXY_PORT;
if (is_array($headers) ) {
$client->rawheaders = $headers;
}
@@ -391,6 +393,14 @@
if ( !defined('MAGPIE_USE_GZIP') ) {
define('MAGPIE_USE_GZIP', true);
}
+
+ if ( !defined('MAGPIE_PROXY_HOST') ) {
+ define ('MAGPIE_PROXY_HOST', '');
+ }
+
+ if ( !defined('MAGPIE_PROXY_PORT', '') ) {
+ define ('MAGPIE_PROXY_PORT', '');
+ }
}
// NOTE: the following code should really be in Snoopy, or at least
Change the the magpeirss directory. Then apply the patch by using the following command (in Linux):
##patch -Np1 <magpierss_proxy_support.patch##
~& If you have any problems with the proxy support patch, please let JasonHuebel know.
Deletions:
~~&Thanks for figuring that out, Jason! It would be nice to have a wrapper for this so we could specify a proxy via the Wikka Configuration file so all configuration would be in one place... (It's also worth noting that the "official" RSS support via Onyx-RSS does not seem to support proxies.)-- JavaWoman
~~~&OK, I've hacked together support for putting the proxy settings in wikka.config.php, but it will require making changes to magpierss as well. I'm going to submit those changes upstream, so maybe the magpie devs will include support in the next version. I'll have a diff of those changes shortly. --JasonHuebel
Additions:
~~~&OK, I've hacked together support for putting the proxy settings in wikka.config.php, but it will require making changes to magpierss as well. I'm going to submit those changes upstream, so maybe the magpie devs will include support in the next version. I'll have a diff of those changes shortly. --JasonHuebel
Deletions:
Additions:
~~~&OK, I've hacked together support for putting the proxy settings in wikka.config.php, but it will require making changes to magpierss as well. I'm going to submit those changes upstream, so maybe the MagPie devs will include support in the next version. I'll have a diff of those changes shortly.
Additions:
~&**Proxy Support:** If your wiki is behind an HTTP proxy, you need to modify the ##$proxy_host## and ##$proxy_port## variables in ##3rdparty/plugins/magpierss/extlib/Snoopy.class.inc##. --JasonHuebel
~~&Thanks for figuring that out, Jason! It would be nice to have a wrapper for this so we could specify a proxy via the Wikka Configuration file so all configuration would be in one place... (It's also worth noting that the "official" RSS support via Onyx-RSS does not seem to support proxies.)-- JavaWoman
~~&Thanks for figuring that out, Jason! It would be nice to have a wrapper for this so we could specify a proxy via the Wikka Configuration file so all configuration would be in one place... (It's also worth noting that the "official" RSS support via Onyx-RSS does not seem to support proxies.)-- JavaWoman
Deletions:
Additions:
$i = 1;
$cached_output = "<h3>".$rss->channel['title']."</h3>";
if ($rss->channel['link']) {
$cached_output .= '<div align="right"><a href="'.$rss->channel['link'].'">FEED URL : '.$rss->channel['link'].'</a></div>';
}
$cached_output .= "<ul>\n";
foreach ($rss->items as $item) {
$href = $item['link'];
$title = $item['title'];
if ($item['content']) {
$description = implode($item['content']);
}
else {
$description = $item['description'];
}
$cached_output .= "<li><a href=$href>$title</a><br />$description</li>";
if ($i >= $maxitems) {
break;
}
$i++;
}
$cached_output .= "</ul>\n";
echo $this->ReturnSafeHTML($cached_output);
echo "An error occured when fetching or parsing the feed.<br />Check that the feed is compliant.";
**Proxy Support:** If your wiki is behind an HTTP proxy, you need to modify the ##$proxy_host## and ##$proxy_port## variables in ##3rdparty/plugins/magpierss/extlib/Snoopy.class.inc##. --JasonHuebel
$cached_output = "<h3>".$rss->channel['title']."</h3>";
if ($rss->channel['link']) {
$cached_output .= '<div align="right"><a href="'.$rss->channel['link'].'">FEED URL : '.$rss->channel['link'].'</a></div>';
}
$cached_output .= "<ul>\n";
foreach ($rss->items as $item) {
$href = $item['link'];
$title = $item['title'];
if ($item['content']) {
$description = implode($item['content']);
}
else {
$description = $item['description'];
}
$cached_output .= "<li><a href=$href>$title</a><br />$description</li>";
if ($i >= $maxitems) {
break;
}
$i++;
}
$cached_output .= "</ul>\n";
echo $this->ReturnSafeHTML($cached_output);
echo "An error occured when fetching or parsing the feed.<br />Check that the feed is compliant.";
**Proxy Support:** If your wiki is behind an HTTP proxy, you need to modify the ##$proxy_host## and ##$proxy_port## variables in ##3rdparty/plugins/magpierss/extlib/Snoopy.class.inc##. --JasonHuebel
Deletions:
$cached_output = "<h3>".$rss->channel['title']."</h3>";
if ($rss->channel['link']) {
$cached_output .= '<div align="right"><a href="'.$rss->channel['link'].'">FEED URL : '.$rss->channel['link'].'</a></div>';
}
$cached_output .= "<ul>\n";
foreach ($rss->items as $item) {
$href = $item['link'];
$title = $item['title'];
if ($item['content']) {
$description = implode($item['content']);
}
else {
$description = $item['description'];
}
$cached_output .= "<li><a href=$href>$title</a><br />$description</li>";
if ($i >= $maxitems) {
break;
}
$i++;
}
$cached_output .= "</ul>\n";
echo $this->ReturnSafeHTML($cached_output);
echo "An error occured when fetching or parsing the feed.<br />Check that the feed is compliant.";
Additions:
# $rss_cache_time = 30; // set this for default cache time
# $rss_cache_time = $lowest_cache_time_allowed;
$i = 1;
$cached_output = "<h3>".$rss->channel['title']."</h3>";
if ($rss->channel['link']) {
$cached_output .= '<div align="right"><a href="'.$rss->channel['link'].'">FEED URL : '.$rss->channel['link'].'</a></div>';
}
$cached_output .= "<ul>\n";
foreach ($rss->items as $item) {
$href = $item['link'];
$title = $item['title'];
if ($item['content']) {
$description = implode($item['content']);
}
else {
$description = $item['description'];
}
$cached_output .= "<li><a href=$href>$title</a><br />$description</li>";
if ($i >= $maxitems) {
break;
}
$i++;
}
$cached_output .= "</ul>\n";
echo $this->ReturnSafeHTML($cached_output);
echo "An error occured when fetching or parsing the feed.<br />Check that the feed is compliant.";
# $rss_cache_time = $lowest_cache_time_allowed;
$i = 1;
$cached_output = "<h3>".$rss->channel['title']."</h3>";
if ($rss->channel['link']) {
$cached_output .= '<div align="right"><a href="'.$rss->channel['link'].'">FEED URL : '.$rss->channel['link'].'</a></div>';
}
$cached_output .= "<ul>\n";
foreach ($rss->items as $item) {
$href = $item['link'];
$title = $item['title'];
if ($item['content']) {
$description = implode($item['content']);
}
else {
$description = $item['description'];
}
$cached_output .= "<li><a href=$href>$title</a><br />$description</li>";
if ($i >= $maxitems) {
break;
}
$i++;
}
$cached_output .= "</ul>\n";
echo $this->ReturnSafeHTML($cached_output);
echo "An error occured when fetching or parsing the feed.<br />Check that the feed is compliant.";
Deletions:
# $rss_cache_time = $lowest_cache_time_allowed;
$i = 1;
$cached_output = "<h3>".$rss->channel['title']."</h3>";
$cached_output .= "<ul>\n";
foreach ($rss->items as $item) {
$href = $item['link'];
$title = $item['title'];
if ($item['content']) {
$description = implode($item['content']);
}
else {
$description = $item['description'];
}
$cached_output .= "<li><a href=$href>$title</a><br />$description</li>";
if ($i >= $maxitems) {
break;
}
$i++;
}
$cached_output .= "</ul>\n";
echo $this->ReturnSafeHTML($cached_output);
echo "An error occured when fetching or parsing the feed.<br />Check that the feed is compliant.";
Revision [9241]
Edited on 2005-06-15 20:07:29 by SamuelDr [Changed the comment about "maxitems" and moved it, deleted an obsolete variable.]Additions:
$maxitems = 15; // set this to the maximum items the RSS action should display if there is no maxitems specified in the variables.
Deletions:
$maxitems = 15;
$rss_cache_file = ""; // initial value, no need to ever change
Additions:
// As said in the magpie RSS cookbook :
# Magpie throws USER_WARNINGS only
# so you can cloak these, by only showing ERRORs
// Those warnings are triggered when Magpie can't download the remote RSS file, and there is no cached version.
// Another possible warning is when the feed is improperly parsed. The cookbook talks about illegal HTML, I handled that pretty well for atom feeds.
error_reporting(E_ERROR);
// This can create an error or warning on some shared hosting, so comment it out if it does.(user // or # in front of the line)
if ($rss) {
$i = 1;
$cached_output = "<h3>".$rss->channel['title']."</h3>";
$cached_output .= "<ul>\n";
foreach ($rss->items as $item) {
$href = $item['link'];
$title = $item['title'];
if ($item['content']) {
$description = implode($item['content']);
else {
$description = $item['description'];
}
$cached_output .= "<li><a href=$href>$title</a><br />$description</li>";
if ($i >= $maxitems) {
break;
}
$i++;
$cached_output .= "</ul>\n";
echo $this->ReturnSafeHTML($cached_output);
} else {
echo "An error occured when fetching or parsing the feed.<br />Check that the feed is compliant.";
# Magpie throws USER_WARNINGS only
# so you can cloak these, by only showing ERRORs
// Those warnings are triggered when Magpie can't download the remote RSS file, and there is no cached version.
// Another possible warning is when the feed is improperly parsed. The cookbook talks about illegal HTML, I handled that pretty well for atom feeds.
error_reporting(E_ERROR);
// This can create an error or warning on some shared hosting, so comment it out if it does.(user // or # in front of the line)
if ($rss) {
$i = 1;
$cached_output = "<h3>".$rss->channel['title']."</h3>";
$cached_output .= "<ul>\n";
foreach ($rss->items as $item) {
$href = $item['link'];
$title = $item['title'];
if ($item['content']) {
$description = implode($item['content']);
else {
$description = $item['description'];
}
$cached_output .= "<li><a href=$href>$title</a><br />$description</li>";
if ($i >= $maxitems) {
break;
}
$i++;
$cached_output .= "</ul>\n";
echo $this->ReturnSafeHTML($cached_output);
} else {
echo "An error occured when fetching or parsing the feed.<br />Check that the feed is compliant.";
Deletions:
$cached_output = "<h3>".$rss->channel['title']."</h3>";
$cached_output .= "<ul>\n";
foreach ($rss->items as $item) {
$href = $item['link'];
$title = $item['title'];
if ($item['content']) {
$description = implode($item['content']);
else {
$description = $item['description'];
$cached_output .= "<li><a href=$href>$title</a><br />$description</li>";
if ($i >= $maxitems) {
break;
$i++;
$cached_output .= "</ul>\n";
echo $this->ReturnSafeHTML($cached_output);
Additions:
And, at last, please comment, so I'll know that people are seeing it. Thank you !