*/
class Fallback {
- public static function fallback_iconv( $from, $to, $string ) {
+ public static function iconv( $from, $to, $string ) {
if ( substr( $to, -8 ) == '//IGNORE' ) {
$to = substr( $to, 0, strlen( $to ) - 8 );
}
* can be up to 100x slower than native if the text is heavily
* multibyte and we have to slog through a few hundred kb.
*/
- public static function fallback_mb_substr( $str, $start, $count='end' ) {
+ public static function mb_substr( $str, $start, $count='end' ) {
if( $start != 0 ) {
- $split = self::fallback_mb_substr_split_unicode( $str, intval( $start ) );
+ $split = self::mb_substr_split_unicode( $str, intval( $start ) );
$str = substr( $str, $split );
}
if( $count !== 'end' ) {
- $split = self::fallback_mb_substr_split_unicode( $str, intval( $count ) );
+ $split = self::mb_substr_split_unicode( $str, intval( $count ) );
$str = substr( $str, 0, $split );
}
return $str;
}
- public static function fallback_mb_substr_split_unicode( $str, $splitPos ) {
+ public static function mb_substr_split_unicode( $str, $splitPos ) {
if( $splitPos == 0 ) {
return 0;
}
* @param string $enc optional encoding; ignored
* @return int
*/
- public static function fallback_mb_strlen( $str, $enc = '' ) {
+ public static function mb_strlen( $str, $enc = '' ) {
$counts = count_chars( $str );
$total = 0;
* @param $encoding String: optional encoding; ignored
* @return int
*/
- public static function fallback_mb_strpos( $haystack, $needle, $offset = 0, $encoding = '' ) {
+ public static function mb_strpos( $haystack, $needle, $offset = 0, $encoding = '' ) {
$needle = preg_quote( $needle, '/' );
$ar = array();
* @param $encoding String: optional encoding; ignored
* @return int
*/
- public static function fallback_mb_strrpos( $haystack, $needle, $offset = 0, $encoding = '' ) {
+ public static function mb_strrpos( $haystack, $needle, $offset = 0, $encoding = '' ) {
$needle = preg_quote( $needle, '/' );
$ar = array();
if( !function_exists( 'iconv' ) ) {
function iconv( $from, $to, $string ) {
- return Fallback::fallback_iconv( $from, $to, $string );
+ return Fallback::iconv( $from, $to, $string );
}
}
if ( !function_exists( 'mb_substr' ) ) {
function mb_substr( $str, $start, $count='end' ) {
- return Fallback::fallback_mb_substr( $str, $start, $count );
+ return Fallback::mb_substr( $str, $start, $count );
}
function mb_substr_split_unicode( $str, $splitPos ) {
- return Fallback::fallback_mb_substr_split_unicode( $str, $splitPos );
+ return Fallback::mb_substr_split_unicode( $str, $splitPos );
}
}
if ( !function_exists( 'mb_strlen' ) ) {
function mb_strlen( $str, $enc = '' ) {
- return Fallback::fallback_mb_strlen( $str, $enc );
+ return Fallback::mb_strlen( $str, $enc );
}
}
if( !function_exists( 'mb_strpos' ) ) {
function mb_strpos( $haystack, $needle, $offset = 0, $encoding = '' ) {
- return Fallback::fallback_mb_strpos( $haystack, $needle, $offset, $encoding );
+ return Fallback::mb_strpos( $haystack, $needle, $offset, $encoding );
}
}
if( !function_exists( 'mb_strrpos' ) ) {
function mb_strrpos( $haystack, $needle, $offset = 0, $encoding = '' ) {
- return Fallback::fallback_mb_strrpos( $haystack, $needle, $offset, $encoding );
+ return Fallback::mb_strrpos( $haystack, $needle, $offset, $encoding );
}
}
$this->assertEquals(
call_user_func_array( 'mb_substr', $param_set ),
- call_user_func_array( array( 'Fallback', 'fallback_mb_substr' ), $param_set ),
+ call_user_func_array( array( 'Fallback', 'mb_substr' ), $param_set ),
'Fallback mb_substr with params ' . implode( ', ', $old_param_set )
);
}
//mb_strlen
$this->assertEquals(
mb_strlen( $sampleUTF ),
- Fallback::fallback_mb_strlen( $sampleUTF ),
+ Fallback::mb_strlen( $sampleUTF ),
'Fallback mb_strlen'
);
$this->assertEquals(
call_user_func_array( 'mb_strpos', $param_set ),
- call_user_func_array( array( 'Fallback', 'fallback_mb_strpos' ), $param_set ),
+ call_user_func_array( array( 'Fallback', 'mb_strpos' ), $param_set ),
'Fallback mb_strpos with params ' . implode( ', ', $old_param_set )
);
$this->assertEquals(
call_user_func_array( 'mb_strrpos', $param_set ),
- call_user_func_array( array( 'Fallback', 'fallback_mb_strrpos' ), $param_set ),
+ call_user_func_array( array( 'Fallback', 'mb_strrpos' ), $param_set ),
'Fallback mb_strrpos with params ' . implode( ', ', $old_param_set )
);
}