r112314 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r112313‎ | r112314 | r112315 >
Date:11:37, 24 February 2012
Author:wikinaut
Status:reverted
Tags:gerritmigration 
Comment:
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 (modified) (history)
  • /trunk/extensions/RSS/RSS.php (modified) (history)
  • /trunk/extensions/RSS/RSSData.php (modified) (history)
  • /trunk/extensions/RSS/RSSParser.php (modified) (history)

Diff [purge]

Index: trunk/extensions/RSS/RELEASE-NOTES
@@ -13,6 +13,10 @@
1414 * bug 30028 "Error parsing XML for RSS" - improve and harden Extension:RSS when
1515 parsing differently flavoured RSS feeds and ATOM feeds
1616
 17+=== Version 2.01 2012-02-24 ===
 18+* "summary" element of ATOM feed items are shown
 19+ which is handled like "description" element of RSS
 20+* handling of basic HTML layout tags <p> <br> <b> <i> <u> <s> in item description
1721 === Version 2.00 2012-02-24 ===
1822 * first version which can parse RSS and at least some ATOM feeds
1923 partial solution of bug 30028 "Error parsing XML for RSS" - improve and harden
Index: trunk/extensions/RSS/RSSData.php
@@ -81,8 +81,8 @@
8282 return 'date';
8383 case 'dc:creator':
8484 return 'author';
85 - case 'title':
86 - return 'title';
 85+ case 'summary':
 86+ return 'description';
8787 case 'content:encoded':
8888 return 'encodedContent';
8989
Index: trunk/extensions/RSS/RSSParser.php
@@ -391,18 +391,46 @@
392392
393393 /**
394394 * Sanitize user input for inclusion as a template parameter.
 395+ *
395396 * Unlike in wfEscapeWikiText() as of r77127, this escapes }} in addition
396397 * to the other kinds of markup, to avoid user input ending a template
397398 * invocation.
 399+ *
 400+ * We change differently flavoured <p> and <br> tags to effective <br> tags,
 401+ * other tags such as <a> will be rendered html-escaped.
 402+ *
398403 */
399404 protected function escapeTemplateParameter( $text ) {
400 - return str_replace(
 405+ $text = str_replace(
401406 array( '[', '|', ']', '\'', 'ISBN ',
402 - 'RFC ', '://', "\n=", '{{', '}}' ),
 407+ 'RFC ', '://', "\n=", '{{', '}}',
 408+ ),
403409 array( '&#91;', '&#124;', '&#93;', '&#39;', 'ISBN&#32;',
404 - 'RFC&#32;', '&#58;//', "\n&#61;", '&#123;&#123;', '&#125;&#125;' ),
405 - htmlspecialchars( $text )
 410+ 'RFC&#32;', '&#58;//', "\n&#61;", '&#123;&#123;', '&#125;&#125;',
 411+ ),
 412+ htmlspecialchars( str_replace( "\n", "", $text ) )
406413 );
 414+
 415+ // keep some basic layout tags
 416+ $text = str_replace(
 417+ array( '&lt;p&gt;', '&lt;/p&gt;',
 418+ '&lt;br/&gt;', '&lt;br&gt;', '&lt;/br&gt;',
 419+ '&lt;b&gt;', '&lt;/b&gt;',
 420+ '&lt;i&gt;', '&lt;/i&gt;',
 421+ '&lt;u&gt;', '&lt;/u&gt;',
 422+ '&lt;s&gt;', '&lt;/s&gt;',
 423+ ),
 424+ array( "", "<br/>",
 425+ "<br/>", "<br/>", "<br/>",
 426+ "'''", "'''",
 427+ "''", "''",
 428+ "<u>", "</u>",
 429+ "<s>", "</s>",
 430+ ),
 431+ $text
 432+ );
 433+
 434+ return $text;
407435 }
408436
409437 /**
Index: trunk/extensions/RSS/RSS.php
@@ -4,7 +4,7 @@
55 *
66 * @file
77 * @ingroup Extensions
8 - * @version 2.00
 8+ * @version 2.01
99 * @author mutante, Daniel Kinzler, Rdb, Mafs, Thomas Gries, Alxndr, Chris Reigrut, K001
1010 * @author Kellan Elliott-McCrea <kellan@protest.net> -- author of MagpieRSS
1111 * @author Jeroen De Dauw
@@ -14,7 +14,7 @@
1515 * @link http://www.mediawiki.org/wiki/Extension:RSS Documentation
1616 */
1717
18 -define( "EXTENSION_RSS_VERSION", "2.00 20120224" );
 18+define( "EXTENSION_RSS_VERSION", "2.01 20120224" );
1919
2020 if ( !defined( 'MEDIAWIKI' ) ) {
2121 die( "This is not a valid entry point.\n" );

Follow-up revisions

RevisionCommit summaryAuthorDate
r114390Revert r111347, r111348, r111350, r111351, r111515, r111816, r112243, r112251......catrope18:40, 21 March 2012

Status & tagging log