wp/wp-includes/compat.php
changeset 18 be944660c56a
parent 16 a86126ab1dd4
child 19 3d72ae0968f4
equal deleted inserted replaced
17:34716fd837a4 18:be944660c56a
   125 		$chars = array_merge( $chars, $pieces );
   125 		$chars = array_merge( $chars, $pieces );
   126 
   126 
   127 		// If there's anything left over, repeat the loop.
   127 		// If there's anything left over, repeat the loop.
   128 	} while ( count( $pieces ) > 1 && $str = array_pop( $pieces ) );
   128 	} while ( count( $pieces ) > 1 && $str = array_pop( $pieces ) );
   129 
   129 
   130 	return join( '', array_slice( $chars, $start, $length ) );
   130 	return implode( '', array_slice( $chars, $start, $length ) );
   131 }
   131 }
   132 
   132 
   133 if ( ! function_exists( 'mb_strlen' ) ) :
   133 if ( ! function_exists( 'mb_strlen' ) ) :
   134 	/**
   134 	/**
   135 	 * Compat function to mimic mb_strlen().
   135 	 * Compat function to mimic mb_strlen().
   368 	 */
   368 	 */
   369 	function is_iterable( $var ) {
   369 	function is_iterable( $var ) {
   370 		return ( is_array( $var ) || $var instanceof Traversable );
   370 		return ( is_array( $var ) || $var instanceof Traversable );
   371 	}
   371 	}
   372 }
   372 }
       
   373 
       
   374 // IMAGETYPE_WEBP constant is only defined in PHP 7.1 or later.
       
   375 if ( ! defined( 'IMAGETYPE_WEBP' ) ) {
       
   376 	define( 'IMAGETYPE_WEBP', 18 );
       
   377 }
       
   378 
       
   379 // IMG_WEBP constant is only defined in PHP 7.0.10 or later.
       
   380 if ( ! defined( 'IMG_WEBP' ) ) {
       
   381 	define( 'IMG_WEBP', IMAGETYPE_WEBP ); // phpcs:ignore PHPCompatibility.Constants.NewConstants.imagetype_webpFound
       
   382 }