Topic on Extension talk:RSS

2003:63:2F1B:A712:76D4:35FF:FEF7:1C46 (talkcontribs)

Using this extension with Google Feeds returns HTML code of intended thumbnails instead of descriptions, which can be removed by a template excluding descriptions altogether, e.g.: Template:Google-feed:

[{{{link}}} {{{title}}}]
{{{author}}} {{{date}}}

<rss template="Google-feed">http://news.google.com/news?pz=1&cf=all&ned=fr&hl=fr&q=iphone&output=rss</rss>

Or does anyone have better a solution to include descriptions without Google's HTML markup appearing in the output?

Yellowdog (talkcontribs)

Having tested various settings with images and HTML I can conclude including descriptions with Google feeds does not work. Only link, title and date works.

CayceP (talkcontribs)

I was able to fix this on my local XAMPP installation like this for Mediawiki 1.27.0 and RSS Version 2.25.0 (2014-03-28):PHP 5.6.23 (apache2handler), MySQL 5.5.39

in RSSParser.php remove the following if condition in line 403

if ( isset( $wgRSSAllowImageTag ) && $wgRSSAllowImageTag ) {

$extraInclude[] = "img";

} else {

$extraExclude[] = "img";

}

This way the images were displayed for my Google Feed.

So the block from line 394 should look like this:

protected function escapeTemplateParameter( $text ) { global $wgRSSAllowLinkTag, $wgRSSAllowImageTag; $extraInclude = array(); $extraExclude = array( "iframe" ); if ( isset( $wgRSSAllowLinkTag ) && $wgRSSAllowLinkTag ) { $extraInclude[] = "a"; } else { $extraExclude[] = "a"; }if ( ( isset( $wgRSSAllowLinkTag ) && $wgRSSAllowLinkTag ) || ( isset( $wgRSSAllowImageTag ) && $wgRSSAllowImageTag ) ) { $ret = Sanitizer::removeHTMLtags( $text, null, array(), $extraInclude, $extraExclude ); } else { // use the old escape method for a while $text = str_replace( array( '[', '|', ']', '\, 'ISBN ', 'RFC ', '://', "\n=", 'Template:', '', ), array( '[', '|', ']', ''', 'ISBN ', 'RFC ', '://', "\n=", '{{', '}}', ), htmlspecialchars( str_replace( "\n", "", $text ) ) );

// keep some basic layout tags

also change your LocalSettings.php to something like this:

#RSS

require_once( "$IP/extensions/RSS/RSS.php" );

$wgRSSUrlWhitelist = array ("your Feed urls here" ,"etc");

$wgRSSAllowLinkTag = true;

$wgRSSItemMaxLength = 5000; //if the length is too short, the parsed URL will be trunctuated and result in HTML tags

$wgRSSDateDefaultFormat = "d-m-Y H:i";

$wgRSSCacheAge = 21600;

$wgAllowImageTag = true;

Yellowdog (talkcontribs)

Thanks I tested it and could get images to show up as well but for some reason the title was displayed twice and the image float was not properly aligned. Additionally, there were some html tags displayed in the output <nobr>more...</nobr> after the description. I'll use the more simplified output with the headings and the date after all and will give the use of images a miss until maybe there's an updated version of an RSS feeder.

CayceP (talkcontribs)

If your title is displayed twice, maybe it's the Rss-item template that calls the title twice?

I'm using two different templates since I use one feed for a news template via a google feed from a Google+ Community and one different feed with a different layout.Since Google+, to my knowledge still offer no RSS feed function for Google communities updates (only for personal profiles), my feed is generated by a Thirdparty page (gplusrss.com).

Maybe that's why it works for my feed and not for yours. Although, for security reasons I would prefer If I could get a rendered RSS feed without images or the image html tags from Google.My template looks like this for google feeds:

{{{date}}} [{{{link}}} {{{title}}}]

{{{description}}}

If you don't have a specified a special template, maybe check your MediaWiki:RSS-item article page if the duplicate title is called there because the If conditions now has changed.

2A04:2413:8301:200:B89C:7C8B:B7D6:5772 (talkcontribs)

Hi. Does anyone know how to strip html tags from description? I couldn't find the place in RSSParser.php, where to use the strip_tags() function.

CayceP (talkcontribs)

Look for Sanitizer::removeHTMLtags that where the regEx replac of the html tags happens in RSSparser.php

Reply to "Google Feeds"