-
+ 9F83B034D0DD019719D7F11CAF014E0C1182BAA1C0CA88C00B13B94958A939D9F88FD5E69878E76129E15E538429AB4F0E1EDE301E6096A4B6A6F320062D5240
mp-wp/wp-includes/compat.php
(0 . 0)(1 . 99)
86549 <?php
86550 /**
86551 * WordPress implementation for PHP functions missing from older PHP versions.
86552 *
86553 * @package PHP
86554 * @access private
86555 */
86556
86557 // Added in PHP 5.0
86558
86559 if (!function_exists('http_build_query')) {
86560 function http_build_query($data, $prefix=null, $sep=null) {
86561 return _http_build_query($data, $prefix, $sep);
86562 }
86563 }
86564
86565 // from php.net (modified by Mark Jaquith to behave like the native PHP5 function)
86566 function _http_build_query($data, $prefix=null, $sep=null, $key='', $urlencode=true) {
86567 $ret = array();
86568
86569 foreach ( (array) $data as $k => $v ) {
86570 if ( $urlencode)
86571 $k = urlencode($k);
86572 if ( is_int($k) && $prefix != null )
86573 $k = $prefix.$k;
86574 if ( !empty($key) )
86575 $k = $key . '%5B' . $k . '%5D';
86576 if ( $v === NULL )
86577 continue;
86578 elseif ( $v === FALSE )
86579 $v = '0';
86580
86581 if ( is_array($v) || is_object($v) )
86582 array_push($ret,_http_build_query($v, '', $sep, $k, $urlencode));
86583 elseif ( $urlencode )
86584 array_push($ret, $k.'='.urlencode($v));
86585 else
86586 array_push($ret, $k.'='.$v);
86587 }
86588
86589 if ( NULL === $sep )
86590 $sep = ini_get('arg_separator.output');
86591
86592 return implode($sep, $ret);
86593 }
86594
86595 if ( !function_exists('_') ) {
86596 function _($string) {
86597 return $string;
86598 }
86599 }
86600
86601 if (!function_exists('stripos')) {
86602 function stripos($haystack, $needle, $offset = 0) {
86603 return strpos(strtolower($haystack), strtolower($needle), $offset);
86604 }
86605 }
86606
86607 if ( ! function_exists('hash_hmac') ):
86608 function hash_hmac($algo, $data, $key, $raw_output = false) {
86609 $packs = array('md5' => 'H32', 'sha1' => 'H40');
86610
86611 if ( !isset($packs[$algo]) )
86612 return false;
86613
86614 $pack = $packs[$algo];
86615
86616 if (strlen($key) > 64)
86617 $key = pack($pack, $algo($key));
86618 else if (strlen($key) < 64)
86619 $key = str_pad($key, 64, chr(0));
86620
86621 $ipad = (substr($key, 0, 64) ^ str_repeat(chr(0x36), 64));
86622 $opad = (substr($key, 0, 64) ^ str_repeat(chr(0x5C), 64));
86623
86624 return $algo($opad . pack($pack, $algo($ipad . $data)));
86625 }
86626 endif;
86627
86628 if ( ! function_exists('mb_strcut') ):
86629 function mb_strcut( $str, $start, $length=null, $encoding=null ) {
86630 return _mb_strcut($str, $start, $length, $encoding);
86631 }
86632 endif;
86633
86634 function _mb_strcut( $str, $start, $length=null, $encoding=null ) {
86635 // the solution below, works only for utf-8, so in case of a different
86636 // charset, just use built-in substr
86637 $charset = get_option( 'blog_charset' );
86638 if ( !in_array( $charset, array('utf8', 'utf-8', 'UTF8', 'UTF-8') ) ) {
86639 return is_null( $length )? substr( $str, $start ) : substr( $str, $start, $length);
86640 }
86641 // use the regex unicode support to separate the UTF-8 characters into an array
86642 preg_match_all( '/./us', $str, $match );
86643 $chars = is_null( $length )? array_slice( $match[0], $start ) : array_slice( $match[0], $start, $length );
86644 return implode( '', $chars );
86645 }
86646
86647 ?>