A simpler MagpieRSS feed reader method possible?

Creating and modifying plugins.
Post Reply
atomboy
Regular
Posts: 5
Joined: Tue Jul 04, 2006 10:07 pm

A simpler MagpieRSS feed reader method possible?

Post by atomboy »

Hello

Firstly thank you to all involved with Serendipity. Have been looking at it for a few hours and it seems brilliant and ideal for what I want.

However, I wonder if there is an easier way to use MagpieRSS for several reasons.

1. The current plugin seems to generate a 'feed from the incoming feed' in RSS, which I think some feeds do not allow and it seems you can only disable this through each individual feed item, rather than as a group.

2. I have tried to disable the feeds from the front page and only allow them from their own category as per instructions on another post, but this has not worked for me and if there is an error in the incoming feed, this then causes errors for the main page feeds themselves.

3. I imagine that using a lot of feeds needing cron updates will use a lot of bandwidth(?)

Please do not think this is criticism. I think that Serendipity looks brilliant and only wish I was clever enough to properly understand it.

I was just hoping someone might point me towards a method of using MagpieRSS with its own cache and refreshing on user page loading, as I have used elsewhere.

I hope this makes some kind of sense and wish everyone well with this excellent project.

Many thanks.
John
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: A simpler MagpieRSS feed reader method possible?

Post by garvinhicking »

Hi!

I figure you are talking about the Aggregator plugin, is that right?
1. The current plugin seems to generate a 'feed from the incoming feed' in RSS, which I think some feeds do not allow and it seems you can only disable this through each individual feed item, rather than as a group.
That is true, since the concept of aggreagted s9y items is that they serve as usual entries, which means that s9y also can feed them.

Disallowing that seems odd to me; all Planets I know offer RSS feeds of their Feeds. And I honstely thing that the feeds that disallow this might not allow already teh aggregated display you already do of them.

But, of course the plugin could be enhanced to make this possible, by inserting the "No RSS" property to the entries made to specific groups. A checkbox would have to be added for those feeds, and the code to do it. If anyone wants to implement it and has questions, I'll be sure willing to help!
2. I have tried to disable the feeds from the front page and only allow them from their own category as per instructions on another post, but this has not worked for me and if there is an error in the incoming feed, this then causes errors for the main page feeds themselves.
How exactly did you try it?
3. I imagine that using a lot of feeds needing cron updates will use a lot of bandwidth(?)
Absolutely, yes.
I was just hoping someone might point me towards a method of using MagpieRSS with its own cache and refreshing on user page loading, as I have used elsewhere.
Could you explain that more in depth? MagieRSS is only the tool we use to import RSS feeds...

You must understand though that the primary goal of serendipity is a CMS/blog page. The aggregator plugin really is a plugin to add some Planet-functionality to Serendipity, but it thus needs to fit within the usual concept of s9y.

Of course a system that is aimed at only providing aggregator facilities can do this much more specifically; maybe if you are only looking for these features you might want to search for MagpieRSS-based planets?

I definitely would like to see our plugin improved there as well, but we need help on this from developers who can work with that plugin. :-)

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
atomboy
Regular
Posts: 5
Joined: Tue Jul 04, 2006 10:07 pm

Many thanks

Post by atomboy »

Hello Garvin
Many thanks for your reply.
I used this to move things off the front page, taken from:-

http://www.s9y.org/forums/viewtopic.php?t=5483&start=15
Hi!

You can auto-insert this property by patching the aggregator plugin. Edit the method 'insertProperties'.

Add this line to the repeating block of inserts:

Code:

$sql = "INSERT INTO {$serendipity['dbPrefix']}entryproperties
(entryid, property, value)
VALUES ('$entryid', 'ep_no_frontpage', 'true')";
serendipity_db_query($sql);


HTH,
Garvin
Although I am not sure what the concept of Planets is within RSS feeds, I do see what you mean that this plugin is created for use within the overall Serendipity concept and therefore performs its tasks with that in mind.

I suppose I was hoping to be able to create effectively static pages within Serendipity which use MagpieRSS to parse the incoming feed, but which were not put into the database and then processed through cron. The reason for this is a) To try to keep everything within Serendipity overall from a user's point of view and b) to use MagpieRSS which I have used before and am happy with, but without the bandwidth knock-on.

I'm sorry if this is badly explained and more to the point I understand that this idea wanders away from the point of having things functionally integrated, so sorry for that as well.

Anyway, many thanks for the reply and best wishes with all your endeavours.
Regards
John
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Many thanks

Post by garvinhicking »

Hi!

Can you tell me how you modified the code there exactly? Then I could tell you what went wrong. Basically this would be the right way to insert the "hide from RSS" property.

For hiding it from RSS you would though not need "ep_no_frontpage" but instead "ep_hiderss".

About your general endeavour: I'm quite sorry, but as it stands with the current Serendipity plugin this wouldn't be possible. Of course it could be coded and created, with not terribly much work. So this just takes a developer that could implement it. Maybe you'd have some fun having a try at this? I would really like to have that, it would be quite nice -- it's just that I also only have limited time and try to focus it on the more general serendipity approach instead of getting too specific...

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
atomboy
Regular
Posts: 5
Joined: Tue Jul 04, 2006 10:07 pm

I will have a try

Post by atomboy »

Hello Garvin

My heart sinks when someone says things like:-
Of course it could be coded and created, with not terribly much work. So this just takes a developer that could implement it

:roll:

as I know that the task will be beyond me before I start!

However, I am impressed with Serendipity itself and with the way you apply an inclusive policy to new people like me without much ability, so, yes, I will have a look and see what I am able to do.

All I ask is that if anyone sees this and has ideas or pointers, please put them here to guide someone like me who has very little idea.

Again, many thanks and best wishes.
John
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: I will have a try

Post by garvinhicking »

Hi!
However, I am impressed with Serendipity itself and with the way you apply an inclusive policy to new people like me without much ability, so, yes, I will have a look and see what I am able to do.
That sounds great! Just have a look around, and of course I'm always here to try to answer any questions you might have regarding the code. :-)

You might even have some fun doing and customizing stuff. :-)

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
atomboy
Regular
Posts: 5
Joined: Tue Jul 04, 2006 10:07 pm

Quick follow up

Post by atomboy »

Hello
Just to leave a couple of thoughts on this.
From my own point of view, I may keep the feeds separate from the main Serendipity installation and I think that to create a plugin myself may take some time as I really have to learn a lot before I can do this.
However, the following might be of interest to someone. These are not open source code, but have been made available for Wordpress users. I do not know the degree to which they might spark off ideas or how usable and adaptable they may be within the Serendipity environment. They do seem to work OK for a dummy Wordpress installation I made.

The following link goes to a plugin, which creates a small directory:-

http://www.nosq.com/blog/2006/01/runphp ... wordpress/

The following code seems to do much the same:-

Code: Select all

<?php
/*
Plugin Name: Exec-PHP
Plugin URI: http://www.soeren-weber.net/post/2005/08/18/50/
Description: Allows <?PHP ?> or [?php ?] tags inside of your posts to execute PHP code. For WP 2.0 you can restrict PHP execution by assigning the role exec_php which is assigned by default to the administrators and editors role.
Version: 2.0
Author: Sören Weber
Author URI: http://soeren-weber.net
*/

/* Remarks:
In WP 2.0 post authors can do the following related to their assigned capabilities:

cap                 write/edit PHP with   write/edit PHP with   execute PHP
                    [?php ?] tags         <?php ?> tags
=================   ===================   ===================   ===========
exec_php                                                             X
unfiltered_html             X                      X
<none from above>           X
*/

define('EXECPHP_VERSION', '2.0');
define('EXECPHP_CAP', 'exec_php');

function execphp_fix_tag($match)
{
	// replacing WPs strange PHP tag handling with a functioning tag pair
	$output = '<?php'. $match[2]. '?>';
	return $output;
}

function execphp_eval_php($content)
{
	// for debugging also group unimportant components with ()
	// to check them with a print_r($matches)
	$pattern = '/'.
		'(?:(?:<)|(\[))[\s]*\?php'. // the opening of the <?php or [?php tag
		'(((([\'\"])([^\\\5]|\\.)*?\5)|(.*?))*)'. // ignore content of PHP quoted strings
		'\?(?(1)\]|>)'. // the closing ? > or ?] tag
		'/is';
	$content = preg_replace_callback($pattern, 'execphp_fix_tag', $content);
	// to be compatible with older PHP4 installations
	// don't use fancy ob_XXX shortcut functions
	ob_start();
	eval(" ?> $content <?php ");
	$output = ob_get_contents();
	ob_end_clean();
	return $output;
}

function execphp_restricted_eval_php($content)
{
	global $post;
	if (!isset($post) || !isset($post->post_author))
		return $content;
	$poster = new WP_User($post->post_author);
	if (!$poster->has_cap(EXECPHP_CAP))
		return $content;
	return execphp_eval_php($content);
}

// --------------------------------------------------------------------------
// activating and installing the plugin
// --------------------------------------------------------------------------

function execphp_install_cap()
{
	global $wp_roles;

	// if there is at least one role with the EXECPHP_CAP capability, then
	// the plugin was previously been installed and we must not do
	// anything; don't rely that the cap is attachted to the same roles
	// as during installation because this could already be changed
	// by the administrator

	foreach($wp_roles->role_objects as $role)
	{
		if ($role->has_cap(EXECPHP_CAP))
			return;
	}

	$role = get_role('administrator');
	if ($role !== NULL)
		$role->add_cap(EXECPHP_CAP);
	$role = get_role('editor');
	if ($role !== NULL)
		$role->add_cap(EXECPHP_CAP);
}

function execphp_activate_1_x()
{
	add_filter('the_content', 'execphp_eval_php', 1);
}

function execphp_activate()
{
	add_action('admin_menu', 'execphp_install_cap');
	add_filter('the_content', 'execphp_restricted_eval_php', 1);
}

function execphp_init()
{
	global $wp_version;
	if (substr($wp_version, 0, 2) == "1.")
		execphp_activate_1_x();
	else
		execphp_activate();
}
add_filter('init', 'execphp_init');
?>
I hope this helps in some way.

Best wishes
John
Post Reply