r65145 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r65144‎ | r65145 | r65146 >
Date:22:31, 16 April 2010
Author:sergeychernyshev
Status:deferred
Tags:
Comment:
Fixed a problem with flagged revs where no stable revision exists.
Fixed a problem with wrong stripped escaping.
Modified paths:
  • /trunk/extensions/Widgets/Widgets.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Widgets/Widgets.php
@@ -187,14 +187,14 @@
188188 }
189189
190190 // Hide the widget from the parser
191 - $output = '<!-- ENCODED_CONTENT '.base64_encode($output).' -->';
 191+ $output = 'ENCODED_CONTENT '.base64_encode($output).' END_ENCODED_CONTENT';
192192 return $parser->insertStripItem( $output, $parser->mStripState );
193193 }
194194
195195 function processEncodedWidgetOutput( &$out, &$text ) {
196196 // Find all hidden content and restore to normal
197197 $text = preg_replace(
198 - '/<!-- ENCODED_CONTENT ([0-9a-zA-Z\/+]+=*)* -->/esm',
 198+ '/ENCODED_CONTENT ([0-9a-zA-Z\/+]+=*)* END_ENCODED_CONTENT/esm',
199199 'base64_decode("$1")',
200200 $text
201201 );
@@ -226,7 +226,14 @@
227227 {
228228 $flaggedWidgetArticle = FlaggedArticle::getTitleInstance( $widgetTitle );
229229 $flaggedWidgetArticleRevision = $flaggedWidgetArticle->getStableRev();
230 - $widgetCode = $flaggedWidgetArticleRevision->getRevText();
 230+ if ($flaggedWidgetArticleRevision)
 231+ {
 232+ $widgetCode = $flaggedWidgetArticleRevision->getRevText();
 233+ }
 234+ else
 235+ {
 236+ $widgetCode = '';
 237+ }
231238 }
232239 else
233240 {

Status & tagging log