MaxSem has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/391140 )

Change subject: Replace Sanitizer::armorLinksCallback() with a closure
......................................................................

Replace Sanitizer::armorLinksCallback() with a closure

Used only once, small enough. Perfect candidate to not be exposed
even as a private function.

Change-Id: Ic020a596f709cb4f69c48ffe8138f9023a5c4062
---
M includes/Sanitizer.php
1 file changed, 3 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/40/391140/1

diff --git a/includes/Sanitizer.php b/includes/Sanitizer.php
index 4c99677..889f3d5 100644
--- a/includes/Sanitizer.php
+++ b/includes/Sanitizer.php
@@ -1161,7 +1161,9 @@
                # Stupid hack
                $encValue = preg_replace_callback(
                        '/((?i)' . wfUrlProtocols() . ')/',
-                       [ 'Sanitizer', 'armorLinksCallback' ],
+                       function ( $matches ) {
+                               return str_replace( ':', ':', $matches[1] );
+                       },
                        $encValue );
                return $encValue;
        }
@@ -1404,15 +1406,6 @@
                # don't cause the entire string to disappear.
                $html = htmlspecialchars( $html, ENT_QUOTES | ENT_SUBSTITUTE );
                return $html;
-       }
-
-       /**
-        * Regex replace callback for armoring links against further processing.
-        * @param array $matches
-        * @return string
-        */
-       private static function armorLinksCallback( $matches ) {
-               return str_replace( ':', ':', $matches[1] );
        }
 
        /**

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic020a596f709cb4f69c48ffe8138f9023a5c4062
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: MaxSem <maxsem.w...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to