Add tests for parser tag hooks.
[lhc/web/wiklou.git] / includes / GlobalFunctions.php
index 6ca9e39..015c6e8 100644 (file)
@@ -23,37 +23,37 @@ require_once dirname( __FILE__ ) . '/normal/UtfNormalUtil.php';
 
 if( !function_exists( 'iconv' ) ) {
        function iconv( $from, $to, $string ) {
-               return Fallback::fallback_iconv( $from, $to, $string );
+               return Fallback::iconv( $from, $to, $string );
        }
 }
 
 if ( !function_exists( 'mb_substr' ) ) {
        function mb_substr( $str, $start, $count='end' ) {
-               return Fallback::fallback_mb_substr( $str, $start, $count );
+               return Fallback::mb_substr( $str, $start, $count );
        }
 
        function mb_substr_split_unicode( $str, $splitPos ) {
-               return Fallback::fallback_mb_substr_split_unicode( $str, $splitPos );
+               return Fallback::mb_substr_split_unicode( $str, $splitPos );
        }
 }
 
 if ( !function_exists( 'mb_strlen' ) ) {
        function mb_strlen( $str, $enc = '' ) {
-               return Fallback::fallback_mb_strlen( $str, $enc );
+               return Fallback::mb_strlen( $str, $enc );
        }
 }
 
 if( !function_exists( 'mb_strpos' ) ) {
        
        function mb_strpos( $haystack, $needle, $offset = 0, $encoding = '' ) {
-               return Fallback::fallback_mb_strpos( $haystack, $needle, $offset, $encoding );
+               return Fallback::mb_strpos( $haystack, $needle, $offset, $encoding );
        }
        
 }
 
 if( !function_exists( 'mb_strrpos' ) ) {
        function mb_strrpos( $haystack, $needle, $offset = 0, $encoding = '' ) {
-               return Fallback::fallback_mb_strrpos( $haystack, $needle, $offset, $encoding );
+               return Fallback::mb_strrpos( $haystack, $needle, $offset, $encoding );
        }
 }
 
@@ -756,12 +756,15 @@ function wfMsgExt( $key, $options ) {
        if( in_array( 'content', $options, true ) ) {
                $forContent = true;
                $langCode = true;
+               $langCodeObj = null;
        } elseif( array_key_exists( 'language', $options ) ) {
                $forContent = false;
                $langCode = wfGetLangObj( $options['language'] );
+               $langCodeObj = $langCode;
        } else {
                $forContent = false;
                $langCode = false;
+               $langCodeObj = null;
        }
 
        $string = wfMsgGetKey( $key, /*DB*/true, $langCode, /*Transform*/false );
@@ -771,9 +774,9 @@ function wfMsgExt( $key, $options ) {
        }
 
        if( in_array( 'parse', $options, true ) ) {
-               $string = $wgOut->parse( $string, true, !$forContent );
+               $string = $wgOut->parse( $string, true, !$forContent, $langCodeObj );
        } elseif ( in_array( 'parseinline', $options, true ) ) {
-               $string = $wgOut->parse( $string, true, !$forContent );
+               $string = $wgOut->parse( $string, true, !$forContent, $langCodeObj );
                $m = array();
                if( preg_match( '/^<p>(.*)\n?<\/p>\n?$/sU', $string, $m ) ) {
                        $string = $m[1];
@@ -782,8 +785,7 @@ function wfMsgExt( $key, $options ) {
                global $wgMessageCache;
                if ( isset( $wgMessageCache ) ) {
                        $string = $wgMessageCache->transform( $string,
-                               !$forContent,
-                               is_object( $langCode ) ? $langCode : null );
+                               !$forContent, $langCodeObj );
                }
        }