GlobalFunctions: use a closure instead of polluting global namespace
authorMax Semenik <maxsem.wiki@gmail.com>
Fri, 20 Jul 2018 06:54:49 +0000 (23:54 -0700)
committerMax Semenik <maxsem.wiki@gmail.com>
Fri, 20 Jul 2018 06:54:49 +0000 (23:54 -0700)
Change-Id: Ia587008de75a8bde90ad45d4932284f0b6401845

includes/GlobalFunctions.php

index afad5c4..eec4216 100644 (file)
@@ -866,20 +866,13 @@ function wfParseUrl( $url ) {
 function wfExpandIRI( $url ) {
        return preg_replace_callback(
                '/((?:%[89A-F][0-9A-F])+)/i',
-               'wfExpandIRI_callback',
+               function ( array $matches ) {
+                       return urldecode( $matches[1] );
+               },
                wfExpandUrl( $url )
        );
 }
 
-/**
- * Private callback for wfExpandIRI
- * @param array $matches
- * @return string
- */
-function wfExpandIRI_callback( $matches ) {
-       return urldecode( $matches[1] );
-}
-
 /**
  * Make URL indexes, appropriate for the el_index field of externallinks.
  *