* PHP extensions may be included here.
*/
-if ( !function_exists( 'mb_substr' ) ) {
- /**
- * @codeCoverageIgnore
- * @see Fallback::mb_substr
- * @return string
- */
- function mb_substr( $str, $start, $count = 'end' ) {
- return Fallback::mb_substr( $str, $start, $count );
- }
-
- /**
- * @codeCoverageIgnore
- * @see Fallback::mb_substr_split_unicode
- * @return int
- */
- function mb_substr_split_unicode( $str, $splitPos ) {
- return Fallback::mb_substr_split_unicode( $str, $splitPos );
- }
-}
-
-if ( !function_exists( 'mb_strlen' ) ) {
- /**
- * @codeCoverageIgnore
- * @see Fallback::mb_strlen
- * @return int
- */
- function mb_strlen( $str, $enc = '' ) {
- return Fallback::mb_strlen( $str, $enc );
- }
-}
-
-if ( !function_exists( 'mb_strpos' ) ) {
- /**
- * @codeCoverageIgnore
- * @see Fallback::mb_strpos
- * @return int
- */
- function mb_strpos( $haystack, $needle, $offset = 0, $encoding = '' ) {
- return Fallback::mb_strpos( $haystack, $needle, $offset, $encoding );
- }
-}
-
-if ( !function_exists( 'mb_strrpos' ) ) {
- /**
- * @codeCoverageIgnore
- * @see Fallback::mb_strrpos
- * @return int
- */
- function mb_strrpos( $haystack, $needle, $offset = 0, $encoding = '' ) {
- return Fallback::mb_strrpos( $haystack, $needle, $offset, $encoding );
- }
-}
-
// hash_equals function only exists in PHP >= 5.6.0
// http://php.net/hash_equals
if ( !function_exists( 'hash_equals' ) ) {
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 );
$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 );
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 {
$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];
}
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];