X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/177fd6fefd2e3d5a0ea6591c71d660cabdb3c1a4..refs/tags/wordpress-2.8-scripts:/wp-includes/compat.php diff --git a/wp-includes/compat.php b/wp-includes/compat.php index 9eb18d4d..00438650 100644 --- a/wp-includes/compat.php +++ b/wp-includes/compat.php @@ -77,13 +77,13 @@ function hash_hmac($algo, $data, $key, $raw_output = false) { } endif; -if ( ! function_exists('mb_strcut') ): - function mb_strcut( $str, $start, $length=null, $encoding=null ) { - return _mb_strcut($str, $start, $length, $encoding); +if ( ! function_exists('mb_substr') ): + function mb_substr( $str, $start, $length=null, $encoding=null ) { + return _mb_substr($str, $start, $length, $encoding); } endif; -function _mb_strcut( $str, $start, $length=null, $encoding=null ) { +function _mb_substr( $str, $start, $length=null, $encoding=null ) { // the solution below, works only for utf-8, so in case of a different // charset, just use built-in substr $charset = get_option( 'blog_charset' ); @@ -96,4 +96,23 @@ function _mb_strcut( $str, $start, $length=null, $encoding=null ) { return implode( '', $chars ); } +if ( !function_exists( 'htmlspecialchars_decode' ) ) { + // Added in PHP 5.1.0 + // Error checks from PEAR::PHP_Compat + function htmlspecialchars_decode( $string, $quote_style = ENT_COMPAT ) + { + if ( !is_scalar( $string ) ) { + trigger_error( 'htmlspecialchars_decode() expects parameter 1 to be string, ' . gettype( $string ) . ' given', E_USER_WARNING ); + return; + } + + if ( !is_int( $quote_style ) && $quote_style !== null ) { + trigger_error( 'htmlspecialchars_decode() expects parameter 2 to be integer, ' . gettype( $quote_style ) . ' given', E_USER_WARNING ); + return; + } + + return wp_specialchars_decode( $string, $quote_style ); + } +} + ?>