Drop support for XHTML 1.0
[lhc/web/wiklou.git] / includes / GlobalFunctions.php
index 50287b3..78fcb8b 100644 (file)
@@ -93,26 +93,6 @@ if ( !function_exists( 'mb_strrpos' ) ) {
                return Fallback::mb_strrpos( $haystack, $needle, $offset, $encoding );
        }
 }
-
-// Support for Wietse Venema's taint feature
-if ( !function_exists( 'istainted' ) ) {
-       /**
-        * @codeCoverageIgnore
-        * @return int
-        */
-       function istainted( $var ) {
-               return 0;
-       }
-       /** @codeCoverageIgnore */
-       function taint( $var, $level = 0 ) {}
-       /** @codeCoverageIgnore */
-       function untaint( $var, $level = 0 ) {}
-       define( 'TC_HTML', 1 );
-       define( 'TC_SHELL', 1 );
-       define( 'TC_MYSQL', 1 );
-       define( 'TC_PCRE', 1 );
-       define( 'TC_SELF', 1 );
-}
 /// @endcond
 
 /**
@@ -276,24 +256,6 @@ function wfObjectToArray( $objOrArray, $recursive = true ) {
        return $array;
 }
 
-/**
- * Wrapper around array_map() which also taints variables
- *
- * @param  $function Callback
- * @param  $input Array
- * @return Array
- */
-function wfArrayMap( $function, $input ) {
-       $ret = array_map( $function, $input );
-       foreach ( $ret as $key => $value ) {
-               $taint = istainted( $input[$key] );
-               if ( $taint ) {
-                       taint( $ret[$key], $taint );
-               }
-       }
-       return $ret;
-}
-
 /**
  * Get a random decimal value between 0 and 1, in a way
  * not likely to give duplicate values for any realistic
@@ -322,8 +284,8 @@ function wfRandom() {
  */
 function wfRandomString( $length = 32 ) {
        $str = '';
-       while ( strlen( $str ) < $length ) {
-               $str .= dechex( mt_rand() );
+       for ( $n = 0; $n < $length; $n += 7 ) {
+               $str .= sprintf( '%07x', mt_rand() & 0xfffffff );
        }
        return substr( $str, 0, $length );
 }
@@ -1712,7 +1674,7 @@ function wfMsgExt( $key, $options ) {
 
 /**
  * Since wfMsg() and co suck, they don't return false if the message key they
- * looked up didn't exist but a XHTML string, this function checks for the
+ * looked up didn't exist but instead the key wrapped in <>'s, this function checks for the
  * nonexistence of messages by checking the MessageCache::get() result directly.
  *
  * @deprecated since 1.18. Use Message::isDisabled().
@@ -3868,7 +3830,7 @@ function wfGetLangConverterCacheStorage() {
  * @param array $args parameters passed to hook functions
  * @return Boolean True if no handler aborted the hook
  */
-function wfRunHooks( $event, $args = array() ) {
+function wfRunHooks( $event, array $args = array() ) {
        return Hooks::run( $event, $args );
 }