https://www.mediawiki.org/wiki/Special:Code/MediaWiki/112314
Revision: 112314
Author: wikinaut
Date: 2012-02-24 11:37:35 +0000 (Fri, 24 Feb 2012)
Log Message:
-----------
v2.01 fixed ATOM summary element was forgotten to be parsed. Added handling of
basic HTML layout tags (p br b u i s) in feed descriptions, they are preserved
in the wiki output after sanitizing.
Modified Paths:
--------------
trunk/extensions/RSS/RELEASE-NOTES
trunk/extensions/RSS/RSS.php
trunk/extensions/RSS/RSSData.php
trunk/extensions/RSS/RSSParser.php
Modified: trunk/extensions/RSS/RELEASE-NOTES
===================================================================
--- trunk/extensions/RSS/RELEASE-NOTES 2012-02-24 11:31:36 UTC (rev 112313)
+++ trunk/extensions/RSS/RELEASE-NOTES 2012-02-24 11:37:35 UTC (rev 112314)
@@ -13,6 +13,10 @@
* bug 30028 "Error parsing XML for RSS" - improve and harden Extension:RSS when
parsing differently flavoured RSS feeds and ATOM feeds
+=== Version 2.01 2012-02-24 ===
+* "summary" element of ATOM feed items are shown
+ which is handled like "description" element of RSS
+* handling of basic HTML layout tags <p> <br> <b> <i> <u> <s> in item
description
=== Version 2.00 2012-02-24 ===
* first version which can parse RSS and at least some ATOM feeds
partial solution of bug 30028 "Error parsing XML for RSS" - improve and
harden
Modified: trunk/extensions/RSS/RSS.php
===================================================================
--- trunk/extensions/RSS/RSS.php 2012-02-24 11:31:36 UTC (rev 112313)
+++ trunk/extensions/RSS/RSS.php 2012-02-24 11:37:35 UTC (rev 112314)
@@ -4,7 +4,7 @@
*
* @file
* @ingroup Extensions
- * @version 2.00
+ * @version 2.01
* @author mutante, Daniel Kinzler, Rdb, Mafs, Thomas Gries, Alxndr, Chris
Reigrut, K001
* @author Kellan Elliott-McCrea <[email protected]> -- author of MagpieRSS
* @author Jeroen De Dauw
@@ -14,7 +14,7 @@
* @link http://www.mediawiki.org/wiki/Extension:RSS Documentation
*/
-define( "EXTENSION_RSS_VERSION", "2.00 20120224" );
+define( "EXTENSION_RSS_VERSION", "2.01 20120224" );
if ( !defined( 'MEDIAWIKI' ) ) {
die( "This is not a valid entry point.\n" );
Modified: trunk/extensions/RSS/RSSData.php
===================================================================
--- trunk/extensions/RSS/RSSData.php 2012-02-24 11:31:36 UTC (rev 112313)
+++ trunk/extensions/RSS/RSSData.php 2012-02-24 11:37:35 UTC (rev 112314)
@@ -81,8 +81,8 @@
return 'date';
case 'dc:creator':
return 'author';
- case 'title':
- return 'title';
+ case 'summary':
+ return 'description';
case 'content:encoded':
return 'encodedContent';
Modified: trunk/extensions/RSS/RSSParser.php
===================================================================
--- trunk/extensions/RSS/RSSParser.php 2012-02-24 11:31:36 UTC (rev 112313)
+++ trunk/extensions/RSS/RSSParser.php 2012-02-24 11:37:35 UTC (rev 112314)
@@ -391,18 +391,46 @@
/**
* Sanitize user input for inclusion as a template parameter.
+ *
* Unlike in wfEscapeWikiText() as of r77127, this escapes }} in
addition
* to the other kinds of markup, to avoid user input ending a template
* invocation.
+ *
+ * We change differently flavoured <p> and <br> tags to effective <br>
tags,
+ * other tags such as <a> will be rendered html-escaped.
+ *
*/
protected function escapeTemplateParameter( $text ) {
- return str_replace(
+ $text = str_replace(
array( '[', '|', ']', '\'', 'ISBN ',
- 'RFC ', '://', "\n=", '{{',
'}}' ),
+ 'RFC ', '://', "\n=", '{{',
'}}',
+ ),
array( '[', '|', ']', ''',
'ISBN ',
- 'RFC ', '://', "\n=",
'{{', '}}' ),
- htmlspecialchars( $text )
+ 'RFC ', '://', "\n=",
'{{', '}}',
+ ),
+ htmlspecialchars( str_replace( "\n", "", $text ) )
);
+
+ // keep some basic layout tags
+ $text = str_replace(
+ array( '<p>', '</p>',
+ '<br/>', '<br>', '</br>',
+ '<b>', '</b>',
+ '<i>', '</i>',
+ '<u>', '</u>',
+ '<s>', '</s>',
+ ),
+ array( "", "<br/>",
+ "<br/>", "<br/>", "<br/>",
+ "'''", "'''",
+ "''", "''",
+ "<u>", "</u>",
+ "<s>", "</s>",
+ ),
+ $text
+ );
+
+ return $text;
}
/**
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs