diff --git a/include/utils/VtlibUtils.php b/include/utils/VtlibUtils.php index 3a198fe2385a2dd5e9225811e1104d9e5695bfa0..9f8ba17d2438ffd50425cb69d18190a35aad40c5 100644 --- a/include/utils/VtlibUtils.php +++ b/include/utils/VtlibUtils.php @@ -839,4 +839,11 @@ if (!function_exists('split')) { } +function php7_compat_ereg($pattern, $str, $ignore_case=false) { + $regex = '/'. preg_replace('/\//', '\\/', $pattern) .'/' . ($ignore_case ? 'i': ''); + return preg_match($regex, $str); +} + +if (!function_exists('ereg')) { function ereg($pattern, $str) { return php7_compat_ereg($pattern, $str); } } +if (!function_exists('eregi')) { function eregi($pattern, $str) { return php7_compat_ereg($pattern, $str, true); } } ?> \ No newline at end of file diff --git a/include/utils/utils.php b/include/utils/utils.php index fc250c377a47f30faf3464479efdc9ba750ccc0b..1ccbf5d6d7f4088c32daee7ab7625e7dbf7ac127 100755 --- a/include/utils/utils.php +++ b/include/utils/utils.php @@ -2322,33 +2322,6 @@ function lower_array(&$string){ $string = strtolower(trim($string)); } -/* PHP 7 support */ -function php7_compat_split($delim, $str, $ignore_case=false) { - $splits = array(); - while ($str) { - $pos = $ignore_case ? stripos($str, $delim) : strpos($str, $delim); - if ($pos !== false) { - $splits[] = substr($str, 0, $pos); - $str = substr($str, $pos + strlen($delim)); - } else { - $splits[] = $str; - $str = false; - } - } - return $splits; -} - -if (!function_exists('split')) { function split($delim, $str) {return php7_compat_split($delim, $str); } } -if (!function_exists('spliti')) { function spliti($delim, $str) {return php7_compat_split($delim, $str, true);}} - -function php7_compat_ereg($pattern, $str, $ignore_case=false) { - $regex = '/'. preg_replace('/\//', '\\/', $pattern) .'/' . ($ignore_case ? 'i': ''); - return preg_match($regex, $str); -} - -if (!function_exists('ereg')) { function ereg($pattern, $str) { return php7_compat_ereg($pattern, $str); } } -if (!function_exists('eregi')) { function eregi($pattern, $str) { return php7_compat_ereg($pattern, $str, true); } } - if (!function_exists('get_magic_quotes_runtime')) { function get_magic_quotes_runtime() { return false; } } if (!function_exists('set_magic_quotes_runtime')) { function set_magic_quotes_runtime($flag) {} }