Extension talk:SimpleFeed

Setting char limits
Hi, I've modified the extension in order to set a limit of chars displayed in the description field. was not found in the path. Please edit the path (beginning of extensions/SimpleFeed.php) or add  to the current path.'; }	// Must have a feed URL and a template to go by outputting items. if (!isset($args['url']) or !isset($input)) {		return 0; }

$feed = new SimplePie; $feed->set_cache_location($simplepie_cache_folder);

$feed->set_feed_url($args['url']);

// Get the feed information! $feed->init;

$feed->handle_content_type;

// Either use default date format (j F Y), or the $date(string) argument. // The date argument should conform to PHP's date function, nicely documented // at http://php.net/date. $date = (isset($args['date'])) ? $args['date'] : 'j F Y'; $limit = (isset($args['limit'])) ? $args['limit'] : '100'; $output = '';

// Use the $entries(int) argument to determine how many entries to show. // Defaults to 5, and 0 is unlimited. if (isset($args['entries'])) {		$max = ($args['entries'] == 0) ? $feed->get_item_quantity : $feed->get_item_quantity($args['entries']); }	else {		$max = $feed->get_item_quantity(5); }	// Loop through each item. for ($i = 0; $i < $max; $i++) {		$item = $feed->get_item($i);

$itemwikitext = $input;

// {PERMALINK} -> Link to the URL of the post. $itemwikitext = str_replace('{PERMALINK}', $item->get_permalink, $itemwikitext); //echo "Link: ".$itemwikitext; // {DATE} -> The posting date of the post, formatted in the aforementioned way. $itemwikitext = str_replace('{DATE}', $item->get_date($date), $itemwikitext);

// {DESCRIPTION} -> The actual post (or post description if there's a tear). $itemwikitext = str_replace('{DESCRIPTION}', substr($item->get_description, 0, $limit).'...', $itemwikitext); // If $type="planet" is used, the author is got from the post title. // e.g. title = "Joe Bloggs: I love Mediawiki" // This will make: {AUTHOR} -> "Joe Bloggs" //                {TITLE} -> "I love Mediawiki" // If this is not set however, the title and author are received the usual way. if ($args['type'] == 'planet') {			$title = preg_replace('/(.*): (.*)/sU', '\\2', $item->get_title); preg_match('/(.+?): (.+)/sU', $item->get_title, $matches); $author = $matches[1]; }		else {			$title = $item->get_title; // Often the author is hard to recieve. Maybe it's not a very important // thing to output into RSS...? $itemauthor = $item->get_author; $author = ($itemauthor != null) ? $itemauthor->get_name : ''; }		// {TITLE} -> Title of the post. $itemwikitext = str_replace('{TITLE}', $title, $itemwikitext); // {AUTHOR} -> Author of the post. $itemwikitext = str_replace('{AUTHOR}', $author, $itemwikitext);

// Add to the overall output the post just done. $output .= $itemwikitext; }

// Parse the text into HTML between the [...] tags, with arguments replaced. $parserObject = $parser->parse($output, $parser->mTitle, $parser->mOptions, false, false); // Output formatted text. return $parserObject->getText; }

?>

The new param is limit, and you should be able to use it by entering  {DESCRIPTION} Use at Wikigender(New Home) --Fladei 18:00, 06 October 2011 (UTC)
 * [{PERMALINK} {TITLE}]

Extension does not work with feeds generated by php-scripts
Hi, I have a problem it seems your extension does not work with feeds generated by php-scripts. It does not show anything, only a blank page. The URL of my RSS feed: http://galdom.portal-werner.de/e107_plugins/rss_menu/rss.php?1.2
 * Ditto. When I paste your BBC example into my page, I just get the same thing as the output. MatthewBurton 20:56, 7 April 2007 (UTC)
 * This extension really does not work for me. Just crashes the page on which I try to include the tags. --128.233.100.42 23:40, 29 June 2007 (UTC)
 * This is a big problem since there are many php generated feeds. Could this be fixed? 20:20, 23 July 2007
 * Try changing $feed->feed_url($args['url']); to $feed->set_feed_url($args['url']); 16:15, 8 October 2007

How to install
I couldn't make it work using the provided instructions either. This worked for me
 * 1) Save   to
 * 2) Save   to
 * 3) Create  . Set correct write permission (chmod). Webserver-user should be allowed to write.
 * 4) Add   to  . Last line works fine.

Note: If you are in a corporate environment, check out any proxy servers or firewalls

SimplePie have their own extension for MediaWiki. I installed that first and the instructions are really good. However, you are not able to modify the layout as much as with SimpleFeed. 13:38, 16 April 2007 (UTC)

Got errors when using

replace it with:

helped. --sandb 15 Oct 2009

Right, same here, use "include" doesn't work. "require_once" does.

MediaWiki 1.10 Support
Anyone get this to work in MediaWiki 1.10? 16:10, 29 June 2007

I get Fatal error: Call to undefined method SimplePie::feed_url in / /SimpleFeed.php on line 71
 * Not Yet

The other SimplePie extension does not work either.

Any help would be appreciated.

Mguentz 01:58, 13 August 2007 (UTC)


 * See Extension:SimpleFeed--Arcy 18:39, 7 November 2007 (UTC) That worked for me.

Cache Directory
When installing, I had to put the cache directory in the root wiki folder, rather than extensions/. Anything else gave me an error. Seems that SimplePie looks there. Cheezerman 19:08, 11 December 2007 (UTC)
 * No error for me, but also nothing in the cache folder. (Le Pubard)
 * I had to change something in simplepie.inc :
 * before : var $cache_location = './cache';
 * after : var $cache_location = 'extensions/cache';
 * 13:18, 6 January 2008

gzinflate
I'm trying to use SimpleFeed with simplepie 1.1.1, php 5.1.1, and mediawiki 1.11

Whenever I load a page with it returns

Anyone had this issue before? 03:13, 30 March 2008

Howto use SimplePie Addons
Hi,

I tried to use one of the SimplePie Addons (i.e. http://simplepie.org/wiki/addons/yahoo_weather)

By adding require_once('simplepie_yahoo_weather.inc'); [...] $itemwikitext = str_replace('{WEATHER_CONDITION}', $weather->get_condition, $itemwikitext); I just get the error Fatal error: Call to a member function get_condition on a non-object in /is/htdocs/wp1064305_TTQI81XDD8/www/wiki/extensions/SimpleFeed.php on line 114

But isn't that definied in simplepie_yahoo_weather.inc? I'm using the file from Ryan 19:22, 7 April 2008

Get rid of PHP Notice errors
To get rid of PHP Notice errors ...

PHP Notice: Undefined index:  type in /var/www/wiki/wk/extensions/SimpleFeed.php on line 117

... replace ...

if ($args['type'] == 'planet')

... in line 117 with ...

if (isset($args['type']) && $args['type'] == 'planet')

Ivan Pepelnjak 14:03, 6 May 2008 (UTC)


 * Hello Jonny Lamb. I was not able to find any resource to contact you. Please include the patch from Ivan above.


 * Thank you --Mark Ziegler 08:28, 29 November 2010 (UTC)

In reverse order
aug 28: I think there's a bug when displaying multiple feed-tags on one page. I made a page with feeds from various sources on a clean install and the Wiki is grinding to a halt after a few refreshes.

Hi,

This extension almost works fine but as for my Hungarian wiki, it publicate the feeds in reverse order. The latest news are below... :( What should I do? Thanks! 89.132.222.148 00:49, 22 August 2008 (UTC) (NetBandita)


 * after some minutes....


 * Hmmm.... I have solved. :D In the simplepie.inc there is in the line of 515 the next 'var': var $order_by_date = false; You should change it from true to false. That's all. :)


 * (sorry for my grammar mistakes if...)89.132.222.148 00:56, 22 August 2008

https feeds
I had trouble using this extension with https-feeds. Turns out that the extension sends "ssl://$host" as the hostname in the Host header.

My ugly fix: $ diff -u simplepie.inc simplepie.fixed.ssl.inc --- simplepie.inc	2008-11-17 16:20:04.000000000 +0100 +++ simplepie.fixed.ssl.inc	2008-11-17 16:20:41.000000000 +0100 @@ -7727,7 +7727,15 @@ 						$get = '/'; } 					$out = "GET $get HTTP/1.0\r\n"; -					$out .= "Host: $url_parts[host]\r\n"; +					if (preg_match("/^ssl:\/\//", $url_parts[host])) +					{ +					 $foo = preg_replace("/^ssl:\/\//", "", $url_parts[host]); +					 $out .= "Host: $foo\r\n"; +					} +					else +					{ +					 $out .= "Host: $url_parts[host]\r\n"; +					} 					$out .= "User-Agent: $useragent\r\n"; if (extension_loaded('zlib')) { 17 November 2008

Firefox CSS issues in Mediawiki 1.14
Is anyone else having issues with this extension and importing common.css, etc for Mediawiki 1.14? With my install it seems to be overriding things that should be content type of type/css and forcing type/html which ends up breaking the css import. Anyone else see this and know how to fix it? 16 April 2009

Outputting HTML tags
I'm noticing that URLs within the {DESCRIPTION} area are being transcluded in full markup: e.g. link text Can this be fixed in any way? Coldmachine 20:39, 20 May 2009 (UTC) I have the same problem. Any solution or advice,please? --Biris 10:53, 29 June 2009 (UTC)

It can be fixed, or at least worked around. I added this line in SimpleFeed.php after

I'm sure someone else can make use of the tags instead of wiping them, but that's the best I can do. RotsiserMho 03:45, 29 January 2010 (UTC)

cURL error 6: Couldn't resolve host 'http:'
If I attempt to paste:



[{PERMALINK} {TITLE}]
{DATE}, by {AUTHOR} {DESCRIPTION}

I get the error: "cURL error 6: Couldn't resolve host 'http:'"

http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/front_page/rss.xml works though.

I have mediawiki 1.7.1. I installed simplepie and simplefeed in March 2008.

i would like to cusomize my feeds, how would I fix this error? Odessaukrain2 16:48, 1 July 2009 (UTC)
 * Maybe try to update your MW. There's a new Simplepie version too, 1.2 released in July. But if other feeds work fine maybe its a defect in the feed you're trying to use. --Kenny5 03:37, 31 July 2009 (UTC)

PHP 5.3 problems
This extension does not work on my PHP 5.3 system. Error message: PHP Warning: Parameter 3 to parseFeed expected to be a reference, value given in /srv/www/htdocs/wiki/includes/parser/Parser.php on line 3243 I had to change the following line function parseFeed($input, $args, &$parser) to function parseFeed($input, $args, $parser) BTW: This error seems to be quite common for PHP applications after upgrade to PHP 5.3.

Display the feed sorted by ascending date
To display the feed sorted by ascending date, replace ...

// Loop through each item. for ($i = 0; $i < $max; $i++) {

(approximately line 104) with ...

$fOffset = 0; $fMult = 1; if (isset($args['sort']) and $args['sort'] == 'asc') { $fOffset = $max - 1; $fMult = -1; } // Loop through each item. for ($i = 0; $i < $max; $i++) {        $item = $feed->get_item($i * $fMult + $fOffset);

After the change, the feed is sorted in descending (default) order unless you add the  attribute in the   tag.

Ivan Pepelnjak 09:25, 15 April 2010 (UTC)

Simple use - didn't work
The 'Simple use'-method didn't work (showed a zero (0)) SimpleFeed requires a url-argument and a 'template' ($input) // because this is used in SimpleFeed.php if (!isset($args['url']) or !isset($input)) { return 0; } Use the more advanced format, or customize SimpleFeed.php

simplepie is not downloadable
http://simplepie.org/ >>> download >>> https://github.com/rmccue/simplepie/downloads

"Sorry, there aren't any downloads for this repository. "

Okip 00:37, 6 June 2011 (UTC)
 * better link: http://simplepie.org/downloads/ Okip 00:40, 6 June 2011 (UTC)

That link from that page to the SimplePie plugin download is also broken 134.219.64.224 14:00, 22 September 2011 (UTC) '''Download the full zip from simplepie.org, and simply use the .inc file from that. It works for me with MW1.18.1''' --Teststudent 23:01, 31 January 2012 (UTC)

UNIQ4e8965ed1d93725b-feed-00000001-QINU
I followed the instruction and after adding I got

http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/front_page/rss.xml

Please help me.


 * Same problem here. I also get this strange string... --80.131.98.30 15:33, 12 January 2012 (UTC)


 * I believe it might be caused by some RSS feeds that do not send you the date of the feed item. You can fix it by removing the [date="h:i:s d/m/y T"] and {DATE} from the feed url line.  Also, as mentioned above, in SimpleFeed.php change   to  .  One or both of those fixed the problem, I think it was the date change but the other change helps things as well.  -- 24.40.138.205 03:28, 16 November 2012 (UTC)

Where can I download it?
The Github link leads nowhere.


 * You need two files to get this extension to work, SimpleFeed.php and simplepie.inc. I've put both of them up on my SkyDrive for anyone who needs at: http://skydrive.live.com/?cid=92373444895FA451&id=92373444895FA451!147
 * Note that I'm not responsible for the content of those files. I just downloaded SimpleFeed.php from a SimpleFeed link a while back and simplepie.inc from simplepie.org.  Although they are working fine for me, download and use them at your own risk.

Git with simlepie.inc
Hi everybody,

we at the TDF (The Document Foundation) do use the SimpleFeed extension. I'm cleaning up the extension. It uses many deprecated functions and because of the problematic situation to get simplepie.inc, I provide our changes at Github with our modifications. Feel free to help us to expand the extension and start pull requests. You can find the repository at https://github.com/dennisroczek/simplefeed.

Regards

Dennisroczek (talk) 09:03, 6 October 2015 (UTC)

MediaWiki 1.34.0 Support
require_once("$IP/extensions/SimpleFeed/SimpleFeed.php");
 * 1) Create directory extensions/SimpleFeed
 * 2) Download SimpleFeed 1.0.23 from https://github.com/jonnylamb/simplefeed, and decompression to extensions/SimpleFeed
 * 3) Delete file simplepie.inc
 * 4) Download simplepie 1.5.4 from https://github.com/simplepie/simplepie, and decompression
 * 5) Copy autoloader.php and library to extensions/SimpleFeed
 * 6) Rename autoloader.php to simplepie.inc
 * 7) Create directory extensions/SimpleFeed/cache, Permissions are usually 755, 775 or 777.
 * 8) Edit file LocalSettings.php


 * -P1ayer (talk) 08:00, 4 March 2020 (UTC)