Yaron Koren has submitted this change and it was merged.

Change subject: Added 'noparse' and 'isHTML', apparently necessary for MW 1.21+
......................................................................


Added 'noparse' and 'isHTML', apparently necessary for MW 1.21+

Also added a fix for a preg_replace() call that worked before; I don't
know why it stopped working, at least on my server, although I assume
it's related to some PHP update.

Change-Id: I49479cb42fc06bba96d707c8893c49d9bc35663e
---
M WidgetRenderer.php
1 file changed, 6 insertions(+), 4 deletions(-)

Approvals:
  Yaron Koren: Verified; Looks good to me, approved



diff --git a/WidgetRenderer.php b/WidgetRenderer.php
index dbd86cd..be5ad33 100644
--- a/WidgetRenderer.php
+++ b/WidgetRenderer.php
@@ -132,14 +132,16 @@
 
                // Hide the widget from the parser.
                $output = 'ENCODED_CONTENT ' . self::$mRandomString . 
base64_encode($output) . ' END_ENCODED_CONTENT';
-               return $output;
+               return array( $output, 'noparse' => true, 'isHTML' => true );
        }
 
        public static function processEncodedWidgetOutput( &$out, &$text ) {
                // Find all hidden content and restore to normal
-               $text = preg_replace(
-                       '/ENCODED_CONTENT ' . self::$mRandomString . 
'([0-9a-zA-Z\/+]+=*)* END_ENCODED_CONTENT/esm',
-                       'base64_decode("$1")',
+               $text = preg_replace_callback(
+                       '/ENCODED_CONTENT ' . self::$mRandomString . 
'([0-9a-zA-Z\/+]+=*)* END_ENCODED_CONTENT/',
+                       function( $matches ) {
+                               return base64_decode( $matches[1]);
+                       },
                        $text
                );
 

-- 
To view, visit https://gerrit.wikimedia.org/r/67871
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I49479cb42fc06bba96d707c8893c49d9bc35663e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Widgets
Gerrit-Branch: master
Gerrit-Owner: Yaron Koren <[email protected]>
Gerrit-Reviewer: Yaron Koren <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to