Forums

Unfortunately no one can be told what FluxBB is - you have to see it for yourself.

You are not logged in.

#1 2015-03-06 18:10:31

eric235u
Member
From: free software land
Registered: 2008-05-10
Posts: 132
Website

PunRSS 1.2 - a simple RSS reader

Here's a new version of an RSS modification for FluxBB I'm using my site.  It allows the site admin to add RSS feeds from other websites.  Based on SimplePie so it's pretty flexible.  Note that i did compile their code into a single file (the way it used to be when the project started) and I removed a couple of functions that were causing errors.  Most functionality remains.  Hope it's useful to others.

Example:
http://torrent.buzz/punrss.php

Download PunRSS version 1.2 here:
http://torrent.buzz/CUSTOM_downloads/punrss1.2.zip
or here:
https://fluxbb.org/resources/mods/punrss/releases/1.2/

Offline

#2 2015-07-01 18:42:55

tosca
Member
Registered: 2008-11-05
Posts: 7
Website

Re: PunRSS 1.2 - a simple RSS reader

I just installed this mod and it works fine: http://pataugeoire.ovh/forum/punrss.php

However, I would like to modify a couple of things:
- there is no page title in the navigator window, how can I add one?
- beside each item title, I would like to add the channel name it comes from. Is there an easy way to do that?

Thanks for helping.


Two FluxBB forums at the moment:
- http://pataugeoire.ovh/forum/ (currently public, but will be soon converted to private)
- http://www.marie-noelle-augendre.com/forum/

Offline

#3 2015-07-01 23:11:03

eric235u
Member
From: free software land
Registered: 2008-05-10
Posts: 132
Website

Re: PunRSS 1.2 - a simple RSS reader

tosca wrote:

there is no page title in the navigator window, how can I add one?

Above the header.php row set the $page_title variable to whatever you want.  Good question.  I'll add it to the code.

// Set page title
$page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), pun_htmlspecialchars('RSS News'));

require PUN_ROOT.'header.php'; 

Offline

#4 2015-07-01 23:34:29

eric235u
Member
From: free software land
Registered: 2008-05-10
Posts: 132
Website

Re: PunRSS 1.2 - a simple RSS reader

For the feed author this might help:  http://simplepie.org/wiki/reference/sim … get_author

You could put this in the foreach statement:

                if ($author = $item->get_author())
                {
                    echo $author->get_name();
                }

Last edited by eric235u (2015-07-01 23:40:27)

Offline

#5 2015-07-02 00:02:19

eric235u
Member
From: free software land
Registered: 2008-05-10
Posts: 132
Website

Re: PunRSS 1.2 - a simple RSS reader

I like your two ideas so much I'll update the modification and release it.  Thanks!

Offline

#6 2015-07-02 04:21:14

tosca
Member
Registered: 2008-11-05
Posts: 7
Website

Re: PunRSS 1.2 - a simple RSS reader

Thanks a lot for making the modifications.

I have a question too: will the feeds be paginated when there are enough of them? Is it possible to set up some parameter for this (number of items, for example).
Or is it only the n last items that will be displayed?


Two FluxBB forums at the moment:
- http://pataugeoire.ovh/forum/ (currently public, but will be soon converted to private)
- http://www.marie-noelle-augendre.com/forum/

Offline

#7 2015-07-02 13:45:38

eric235u
Member
From: free software land
Registered: 2008-05-10
Posts: 132
Website

Re: PunRSS 1.2 - a simple RSS reader

Currently it merely displays all of the feeds on a single page.  The amount of items to display per feed can be changed in $feed->set_item_limit(5);  Your idea is a good one.  If I get some free time I'll add that option too.  Thanks.

Offline

#8 2015-07-02 15:44:23

eric235u
Member
From: free software land
Registered: 2008-05-10
Posts: 132
Website

Re: PunRSS 1.2 - a simple RSS reader

Offline

#9 2015-07-03 04:07:31

tosca
Member
Registered: 2008-11-05
Posts: 7
Website

Re: PunRSS 1.2 - a simple RSS reader

Thanks a lot for this new version.


Two FluxBB forums at the moment:
- http://pataugeoire.ovh/forum/ (currently public, but will be soon converted to private)
- http://www.marie-noelle-augendre.com/forum/

Offline

#10 2015-07-03 15:50:19

eric235u
Member
From: free software land
Registered: 2008-05-10
Posts: 132
Website

Re: PunRSS 1.2 - a simple RSS reader

I noticed that when I have a lot of feeds my site gets slow.  I think it is because a couple of the feeds are down or loading slowly and not in cache.  To not wait for them I added this on row 81.

$feed->set_timeout(5); 

Offline

#11 2015-07-03 15:53:22

eric235u
Member
From: free software land
Registered: 2008-05-10
Posts: 132
Website

Re: PunRSS 1.2 - a simple RSS reader

I should get off my lazy ass, make a proper plugin with all the simple pie variables available in the admin screen.

Offline

#12 2016-01-22 17:25:59

TigerAero
Member
From: WI, USA
Registered: 2009-02-01
Posts: 458
Website

Re: PunRSS 1.2 - a simple RSS reader

I have been able to get this modification to work under PHP7 now. It requires

preg_replace_callback

function and /e is deprecated as of php 5.5.

function fa_cleanup( $str, $enc_from, $enc_to ) {
		//$str = iconv( $enc_from, $enc_to, $str );
	$str = str_replace(
		array( "</p>\n\n", "</p>\n", "<br>\n", "<br>", "<br />\n", "<br />" ),
		array( "\n\n", "\n\n", "\n", "\n", "\n", "\n" ),
		$str
	);
	$str = preg_replace_callback
		(
		'#<img.*?src="([^"]+)"[^>]*>#i',
		function ($matches)
		{
			return ($matches[1].$matches[2]);
		}, $str
	);
	
	$str = preg_replace_callback
		(
		'#<img.*?src="([^"]+)"[^>]*>#i',
		function ($matches)
		{
			return ("[img]$1[/img]");
		}, $str
	);
	
	$str = preg_replace_callback
		(
		'#<a.*?href="([^"]+)"[^>]*>([^<]+?)</a>#i', 
		function ($matches)
		{
			return ("[url=$1]$2[/url]'");
		}, $str
	);
	
	$str = html_entity_decode( $str, ENT_QUOTES, $enc_to );
	$str = strip_tags( $str );
	return $str;
}

Enjoy! tongue

^Note the code above is for PHP 7 and it's got some tweaks based on my own server. You may need to edit it slightly if your host is PHP7.

Last edited by TigerAero (2016-05-17 21:42:57)

Offline

Board footer

Powered by FluxBB