Add flag to HTMLTextField to not persist submitted data
[lhc/web/wiklou.git] / includes / GlobalFunctions.php
index 7a41f11..3fa91fa 100644 (file)
@@ -1557,7 +1557,7 @@ function wfDebugBacktrace( $limit = 0 ) {
                return [];
        }
 
-       if ( $limit && version_compare( PHP_VERSION, '5.4.0', '>=' ) ) {
+       if ( $limit ) {
                return array_slice( debug_backtrace( DEBUG_BACKTRACE_PROVIDE_OBJECT, $limit + 1 ), 1 );
        } else {
                return array_slice( debug_backtrace(), 1 );
@@ -1738,7 +1738,7 @@ function wfEscapeWikiText( $text ) {
                                $repl2[] = preg_quote( substr( $prot, 0, -1 ), '/' );
                        }
                }
-               $repl2 = $repl2 ? '/\b(' . join( '|', $repl2 ) . '):/i' : '/^(?!)/';
+               $repl2 = $repl2 ? '/\b(' . implode( '|', $repl2 ) . '):/i' : '/^(?!)/';
        }
        $text = substr( strtr( "\n$text", $repl ), 1 );
        $text = preg_replace( $repl2, '$1:', $text );
@@ -1949,9 +1949,9 @@ function mimeTypeMatch( $type, $avail ) {
        if ( array_key_exists( $type, $avail ) ) {
                return $type;
        } else {
-               $parts = explode( '/', $type );
-               if ( array_key_exists( $parts[0] . '/*', $avail ) ) {
-                       return $parts[0] . '/*';
+               $mainType = explode( '/', $type )[0];
+               if ( array_key_exists( "$mainType/*", $avail ) ) {
+                       return "$mainType/*";
                } elseif ( array_key_exists( '*/*', $avail ) ) {
                        return '*/*';
                } else {
@@ -1977,8 +1977,8 @@ function wfNegotiateType( $cprefs, $sprefs ) {
        $combine = [];
 
        foreach ( array_keys( $sprefs ) as $type ) {
-               $parts = explode( '/', $type );
-               if ( $parts[1] != '*' ) {
+               $subType = explode( '/', $type )[1];
+               if ( $subType != '*' ) {
                        $ckey = mimeTypeMatch( $type, $cprefs );
                        if ( $ckey ) {
                                $combine[$type] = $sprefs[$type] * $cprefs[$ckey];
@@ -1987,8 +1987,8 @@ function wfNegotiateType( $cprefs, $sprefs ) {
        }
 
        foreach ( array_keys( $cprefs ) as $type ) {
-               $parts = explode( '/', $type );
-               if ( $parts[1] != '*' && !array_key_exists( $type, $sprefs ) ) {
+               $subType = explode( '/', $type )[1];
+               if ( $subType != '*' && !array_key_exists( $type, $sprefs ) ) {
                        $skey = mimeTypeMatch( $type, $sprefs );
                        if ( $skey ) {
                                $combine[$type] = $sprefs[$skey] * $cprefs[$type];
@@ -2988,22 +2988,6 @@ function wfBaseConvert( $input, $sourceBase, $destBase, $pad = 1,
        return Wikimedia\base_convert( $input, $sourceBase, $destBase, $pad, $lowercase, $engine );
 }
 
-/**
- * Check if there is sufficient entropy in php's built-in session generation
- *
- * @deprecated since 1.27, PHP's session generation isn't used with
- *  MediaWiki\\Session\\SessionManager
- * @return bool True = there is sufficient entropy
- */
-function wfCheckEntropy() {
-       wfDeprecated( __FUNCTION__, '1.27' );
-       return (
-                       ( wfIsWindows() && version_compare( PHP_VERSION, '5.3.3', '>=' ) )
-                       || ini_get( 'session.entropy_file' )
-               )
-               && intval( ini_get( 'session.entropy_length' ) ) >= 32;
-}
-
 /**
  * @deprecated since 1.27, PHP's session generation isn't used with
  *  MediaWiki\\Session\\SessionManager