Recent Topics

[2.4.1] Post related plugins getting included in RSS/Atom

Started by on Apr 07, 2008 – Contents updated: Apr 07, 2008

Apr 07, 2008 11:00    

How do I disable the Smilies, Social Bookmarks plugin, and any other plugin for that matter from getting included in the Feeds of b2evo?

The smilies are getting parsed as smilie-icons and the social bookmarks plugin inserted after the posts are also being feed-ed by b2evo, thus causing errors on some sites aggregating the blog, or icons not showing up because I have enabled an anti-hotlink system.

I haven't checked if the "Related Posts" will also get feed-ed, as I haven't posted anything new that will trigger the related posts plugin.

Or is this a bug? Seems like one to me :p
If it isn't, then this is a suggestion then ;)
But, any hotfixes?

Thanks a bunch!!

Apr 12, 2008 02:11

Lol, I was just checking my feeds, looking at the error.
I'll see what I can do.

Apr 12, 2008 02:35

I was too optimistic. The obvious is adding this code:

	function RenderItemAsXml( & $params )
	{
		$this->RenderItemAsHtml( $params );
	}


but that doesn't work for a reason beyond my understanding.

Apr 12, 2008 03:26

does using a hack include in the xml feed too ?.. it shouldnt have i suppose, as its theme related rather than content, maybe you should give it a try..

Jul 01, 2009 11:51

I'm sorry to bring this old post to life again, but I think this is a bug in the plugin system or in the RSS skin and it's still happening in 3.2.

The thing is that neither RenderItemAsXml() nor DisplayItemAsXml() hooks are being called by render() (in inc/plugins/model/_plugin.class.php) because the $format variable is set to "entityencoded" or as the default "htmlbody" in skins/_rss2/index.main.php (I think this also happens for the atom feeds).

And when $format is "entityencoded" or "htmlbody" $Plugins->render() class the "AsHtml" hooks instead of the "AsXml" hooks.

I think I have pinned down the problem. Now I need to come up with a solution :)

Jul 04, 2009 19:56

I was looking at a very related issue for a long time when trying to figure out a good way to put embedded videos into the feed properly. Like, rendering the [video:whatever:whatever] bit into something like "There is an embedded video here" and stumbled upon something I don't have file references for.

Basically "RenderItemAsXML" is never called. More accurately, RenderItemAsHTML is called long before the XML version might be called by a skin. That means you would have to render the rendered bit backwards.

Clearly a bug to my mind but it might be a checkbox ;)

Anyway I gave up on trying to fix it figuring whatever solution I found would have to be re-engineered for the 3.whatever generation.

Oh and videos are rendered into feeds - its just that feed readers won't show the object stuff.

Jul 05, 2009 10:21

I have come up with a solution.

First changes are in /inc/_core/_misc.funcs.php within function format_to_output:

--- blog/inc/_core/_misc.funcs.php      2009-07-01 13:42:26.000000000 +0200
+++ evodev/inc/_core/_misc.funcs.php    2009-07-04 19:39:58.000000000 +0200
@@ -46,7 +46,7 @@
  * @author vegarg: Vegar BERG GULDAL.
  * @author mbruneau: Marc BRUNEAU / PROGIDISTRI
  *
- * @version $Id: _misc.funcs.php,v 1.103 2009/05/31 19:45:14 tblue246 Exp $
+ * @version $Id: _misc.funcs.php,v 1.105 2009/06/28 19:21:49 tblue246 Exp $
  */
 if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );

 
@@ -289,7 +289,6 @@
                        break;
 
                case 'htmlbody':
-    case 'xmlbody':
                        // display in HTML page body: allow full HTML
                        $content = convert_chars($content, 'html');
                        break;
@@ -300,7 +299,6 @@
                        break;
 
                case 'entityencoded':
-    case 'xmlentityencoded':
                        // Special mode for RSS 0.92: apply renders and allow full HTML but escape it
                        $content = convert_chars($content, 'html');
                        $content = htmlspecialchars( $content );

I'm adding jus two $format cases, which will be used when rendering/displaying xml feeds.

Then we have to change skins/_rss2/index.main.php so that get_excerpt(), get_content_teaser() and get_content_extension() use the new $format parameters we have defined above:

diff --exclude=CVS --exclude=cache --exclude='*~' --exclude='*.sw?' -ubr blog/skins/_rss2/index.main.php blogs/skins/_rss2/index.main.php
--- blog/skins/_rss2/index.main.php     2009-07-01 13:45:42.000000000 +0200
+++ blogs/skins/_rss2/index.main.php    2009-05-26 00:27:33.000000000 +0200
@@ -118,7 +118,7 @@
 
                                        ?>
                        <description><?php
-                               $content = $Item->get_excerpt( 'xml' );
+                               $content = $Item->get_excerpt( 'entityencoded' );
 
                                // fp> this is another one of these "oooooh it's just a tiny little change"
                                // and "we only need to make the links absolute in RSS"
@@ -135,7 +135,7 @@
                                        ) );
                        ?></description>
                        <content:encoded><![CDATA[<?php
-                               $content = $Item->get_excerpt( 'xml' );
+                               $content = $Item->get_excerpt( 'htmlbody' );
 
                                // fp> this is another one of these "oooooh it's just a tiny little change"
                                // and "we only need to make the links absolute in RSS"
@@ -164,7 +164,7 @@
                                $Item->url_link( array(
                                                'before'        => '<p>',
                                                'after'         => '</p>',
-                                               'format'        => 'xmlentityencoded',
+                                               'format'        => 'entityencoded',
                                                'podcast'       => false,
                                        ) );
 
@@ -177,9 +177,9 @@
                                                'after_image' =>         '</div>',
                                                'after' =>               '</div>',
                                                'image_size' =>          'fit-320x320'
-                                       ), 'xmlentityencoded' );
+                                       ), 'entityencoded' );
 
-                               $content .= $Item->get_content_teaser( 1, false, 'xmlentityencoded' );
+                               $content .= $Item->get_content_teaser( 1, false, 'entityencoded' );
 
                                if( $feed_content == 'normal' )
                                {       // Teasers only
@@ -187,12 +187,12 @@
                                                        'before'    => '',
                                                        'after'     => '',
                                                        'disppage'  => 1,
-                                                       'format'    => 'xmlentityencoded',
+                                                       'format'    => 'entityencoded',
                                                ) );
                                }
                                else
                                {       // Full contents
-                                       $content .= $Item->get_content_extension( 1, true, 'xmlentityencoded' );
+                                       $content .= $Item->get_content_extension( 1, true, 'entityencoded' );
                                }
 
                                // fp> this is another one of these "oooooh it's just a tiny little change"
@@ -206,7 +206,7 @@
                                                'mode'        => 'xml',
                                                'block_start' => '<div class="item_footer">',
                                                'block_end'   => '</div>',
-                                               'format'      => 'xmlentityencoded',
+                                               'format'      => 'entityencoded',
                                        ) );
                        ?></description>
                        <content:encoded><![CDATA[<?php
@@ -228,7 +228,7 @@
                                                'image_size' =>          'fit-320x320'
                                        ), 'htmlbody' );
 
-                               $content .= $Item->get_content_teaser( 1, false, 'xmlbody' );
+                               $content .= $Item->get_content_teaser( 1, false );
                                if( $feed_content == 'normal' )
                                {       // Teasers only
@@ -240,7 +240,7 @@
                                }
                                else
                                {       // Full contents
-                                       $content .= $Item->get_content_extension( 1, true , 'xmlbody' );
+                                       $content .= $Item->get_content_extension( 1, true );
                                }
 
                                // fp> this is another one of these "oooooh it's just a tiny little change"

I presume the same changes would have to be applied to skins/_atom/index.main.php but since I'm not using atom feeds on my sites, I haven't tested this.

Finally we have to tell $Plugins->render() what to do when $format is "xmlbody" or "xmlentityencoded". Here we just change one line:

diff --exclude=CVS --exclude=cache --exclude='*~' --exclude='*.sw?' -ubr blog/inc/plugins/model/_plugins.class.php blogs/inc/plugins/model/_plugins.class.php
--- blog/inc/plugins/model/_plugins.class.php   2009-07-01 13:43:08.000000000 +0200
+++ blogs/inc/plugins/model/_plugins.class.php  2009-07-03 20:48:15.000000000 +0200
@@ -1271,7 +1280,7 @@
                {
                        $event = $event_prefix.'ItemAsHtml'; // 'RenderItemAsHtml'/'DisplayItemAsHtml'
                }
-               elseif( $format == 'xml' || $format == 'xmlentityencoded' || $format == 'xmlbody' )
+               elseif( $format == 'xml' )
                {
                        $event = $event_prefix.'ItemAsXml'; // 'RenderItemAsXml'/'DisplayItemAsXml'
                }

This makes $Plugins->render() use DisplayItemAsXml() and RenderItemAsXml() when $format is "xmlbody" or "xmlentityencoded" in addition to the original "xml".

I think that's all. Now DisplayItemAsXml() and RenderItemAsXml() are working as they were supposed to do.

Nov 29, 2009 11:02

I don't know id this is the right post but I'm having a similar problem. My gallery plugin is not rendering and causing the entire file to stall. It should be rendered as HTML even if it's supposed to be ItemAsXml because it's a plugin. Don't know a solution to this problem. All I know is that My feeds are basically non-existent because of this little snafu.

Was this problem fixed or is it still an issue?

Dec 05, 2009 17:09

If it should be rendered as XML but it's being rendered as HTML then my proposal should solve the problem. As far as I can see, this bug persists in the 3.x series.

Dec 05, 2009 22:02

It should be rendered as HTML, so I guess that's why you fix doesn't work for me. It's not all plugins either, don't know why that is but I'll try to find a solution for my problem later. I have bigger fish to fry now.

Dec 21, 2009 09:47

maybe you should give it a try..
*crap link removed*


Form is loading...

Build your own website! – This forum is powered by b2evolution CMS, a complete engine for your website.