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:
>>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/**.


Revision [19196]

Edited on 2008-01-28 00:14:43 by SamuelDr [Modified links pointing to docs server]

No Differences

Revision [16972]

Edited on 2007-05-31 23:27:32 by SamuelDr [Reverted]
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
Deletions:
if ((!$rss_path)


Revision [16771]

Edited on 2007-05-31 10:46:04 by DsdTe5 [Reverted]
Additions:
if ((!$rss_path)
Deletions:
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


Revision [14214]

Edited on 2006-05-14 18:28:26 by SamuelDr [typo]
Additions:
**Demos:** --Demo off--
Deletions:
**Demos:**--Demow off--


Revision [14213]

Edited on 2006-05-14 18:28:11 by SamuelDr [typo]
Additions:
**Demos:**--Demow off--
Deletions:
**Demos:**
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


Revision [13480]

Edited on 2006-03-15 12:26:36 by PietroSperoni [typo]
Additions:
::c::


Revision [13478]

Edited on 2006-03-15 11:01:52 by DarTar [adding links]
Additions:
~-[[RSSHandler]]
Deletions:
~-RSSHandler


Revision [13477]

Edited on 2006-03-15 11:01:39 by DarTar [adding links]
Additions:
>>**See also**
~-RSSHandler
~-JwRssTest
**Demos:**
You can see this action working with the ATOM feed there :
Deletions:
>>You can see it working with the ATOM feed there :


Revision [13472]

Edited on 2006-03-15 08:44:38 by PietroSperoni [link to magpie on the web]
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:
>>For this action to work, you'll have to first download Magpie RSS and put it in the **./3rdparty/plugins/magpierss/**.


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:
echo "<span class='error'><em>Error: Invalid RSS syntax. <br /> Proper usage: {{rss http://domain.com/feed.xml}} or {{rss url=\"http://domain.com/feed.xml\" maxitems=\"5\"}}</em></span>";


Revision [12427]

Edited on 2005-12-26 10:26:15 by DarTar [adding category link]
Additions:
----
CategoryDevelopmentSyndication


Revision [10488]

Edited on 2005-08-06 23:34:11 by JasonHuebel [adding category link]
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.


Revision [10487]

Edited on 2005-08-06 23:24:05 by JasonHuebel [adding category link]
Additions:
%%(shell) patch -Np1 <magpierss_proxy_support.patch %%
Deletions:
##patch -Np1 <magpierss_proxy_support.patch##


Revision [10486]

Edited on 2005-08-06 23:19:55 by JasonHuebel [adding category link]

No Differences

Revision [10485]

Edited on 2005-08-06 23:18:49 by JasonHuebel [adding category link]
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.
Deletions:
~&**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
~~~&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


Revision [10484]

Edited on 2005-08-06 22:35:55 by JasonHuebel [adding category link]
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:
~~~&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.


Revision [10483]

Edited on 2005-08-06 22:35:20 by JasonHuebel [adding category link]
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.


Revision [10462]

Edited on 2005-08-06 01:02:47 by JavaWoman [comment about proxy support]
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
Deletions:
**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


Revision [10457]

Edited on 2005-08-05 23:32:03 by JasonHuebel [comment about proxy support]
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
Deletions:
$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.";


Revision [9242]

Edited on 2005-06-15 21:34:15 by SamuelDr [Added Feed's url.]
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.";
Deletions:
# $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>";
$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:
// set this to the maximum items the RSS action should ever display
$maxitems = 15;
$rss_cache_file = ""; // initial value, no need to ever change


Revision [9223]

Edited on 2005-06-15 01:05:57 by SamuelDr [Added Error handling]
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.";
Deletions:
$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);


Revision [9208]

Edited on 2005-06-13 23:57:16 by SamuelDr [Added Error handling]
Additions:
And, at last, please comment, so I'll know that people are seeing it. Thank you !


Revision [9206]

The oldest known version of this page was created on 2005-06-13 23:47:47 by SamuelDr [Added Error handling]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki