diff --git a/src/includes/traits/Shared/CachePathUtils.php b/src/includes/traits/Shared/CachePathUtils.php index 7973ba0b..f040004a 100644 --- a/src/includes/traits/Shared/CachePathUtils.php +++ b/src/includes/traits/Shared/CachePathUtils.php @@ -133,7 +133,7 @@ public function buildCachePath($url, $with_user_token = '', $with_version_salt = $url_parts['path'] = '/lp-'.sha1($url_parts['path']).'/'; } } // Now add the path and check for a possible root `index/` suffix. - if (!empty($url_parts['path']) && strlen($url_parts['path'] = trim($url_parts['path'], '\\/'." \t\n\r\0\x0B"))) { + if (!empty($url_parts['path']) && mb_strlen($url_parts['path'] = trim($url_parts['path'], '\\/'." \t\n\r\0\x0B"))) { $cache_path .= $url_parts['path'].'/'; // Add the path as it exists. if (!($flags & $this::CACHE_PATH_NO_PATH_INDEX) && $is_multisite && $is_a_multisite_base_dir_root) { diff --git a/src/includes/traits/Shared/HookUtils.php b/src/includes/traits/Shared/HookUtils.php index a406fc99..779c8f97 100644 --- a/src/includes/traits/Shared/HookUtils.php +++ b/src/includes/traits/Shared/HookUtils.php @@ -61,7 +61,7 @@ public function addHook($hook, $function, $priority = 10, $accepted_args = 1) { $hook = (string) $hook; if (mb_stripos($hook, 'zencache') === 0) { - $hook = GLOBAL_NS.mb_substr($hook, strlen('zencache')); + $hook = GLOBAL_NS.mb_substr($hook, mb_strlen('zencache')); } $priority = (integer) $priority; $accepted_args = max(0, (integer) $accepted_args); @@ -129,7 +129,7 @@ public function removeHook($hook, $function, $priority = 10) { $hook = (string) $hook; if (mb_stripos($hook, 'zencache') === 0) { - $hook = GLOBAL_NS.mb_substr($hook, strlen('zencache')); + $hook = GLOBAL_NS.mb_substr($hook, mb_strlen('zencache')); } $priority = (integer) $priority; $hook_id = $this->hookId($function); @@ -245,7 +245,7 @@ public function doWpAction($hook) call_user_func_array('do_action', $args); if (mb_stripos($hook, GLOBAL_NS) === 0) { - $zencache_filter = 'zencache'.mb_substr($hook, strlen(GLOBAL_NS)); + $zencache_filter = 'zencache'.mb_substr($hook, mb_strlen(GLOBAL_NS)); $zencache_args = $args; // Use a copy of the args. $zencache_args[0] = $zencache_filter; call_user_func_array('do_action', $zencache_args); @@ -268,7 +268,7 @@ public function applyWpFilters($hook) $value = call_user_func_array('apply_filters', $args); if (mb_stripos($hook, GLOBAL_NS) === 0) { - $zencache_hook = 'zencache'.mb_substr($hook, strlen(GLOBAL_NS)); + $zencache_hook = 'zencache'.mb_substr($hook, mb_strlen(GLOBAL_NS)); $zencache_args = $args; // Use a copy of the args. $zencache_args[0] = $zencache_hook; $zencache_args[1] = $value; // Filtered value. diff --git a/src/includes/traits/Shared/ReplaceUtils.php b/src/includes/traits/Shared/ReplaceUtils.php index c6a7b689..0f320a4d 100644 --- a/src/includes/traits/Shared/ReplaceUtils.php +++ b/src/includes/traits/Shared/ReplaceUtils.php @@ -28,7 +28,7 @@ public function strReplaceOnce($needle, $replace, $haystack, $caSe_insensitive = if (($needle_strpos = $caSe_mb_strpos($haystack, $needle)) === false) { return $haystack; // Nothing to replace. } - return (string) substr_replace($haystack, $replace, $needle_strpos, strlen($needle)); + return (string) substr_replace($haystack, $replace, $needle_strpos, mb_strlen($needle)); } /** diff --git a/src/includes/traits/Shared/StringUtils.php b/src/includes/traits/Shared/StringUtils.php index fdd6df17..d676ca13 100644 --- a/src/includes/traits/Shared/StringUtils.php +++ b/src/includes/traits/Shared/StringUtils.php @@ -35,9 +35,9 @@ public function clip($value, $max_length = 80, $force_ellipsis = false) $string = preg_replace('/\s+/u', ' ', strip_tags($string)); $string = trim($string); // Trim it up now. - if (strlen($string) > $max_length) { + if (mb_strlen($string) > $max_length) { $string = (string) mb_substr($string, 0, $max_length - 3).'...'; - } elseif ($force_ellipsis && strlen($string) + 3 > $max_length) { + } elseif ($force_ellipsis && mb_strlen($string) + 3 > $max_length) { $string = (string) mb_substr($string, 0, $max_length - 3).'...'; } else { $string .= $force_ellipsis ? '...' : ''; @@ -74,7 +74,7 @@ public function midClip($value, $max_length = 80) $string = preg_replace('/\s+/u', ' ', strip_tags($string)); $string = trim($string); // Trim it up now. - if (strlen($string) <= $max_length) { + if (mb_strlen($string) <= $max_length) { return $string; // Nothing to do. } $full_string = $string; @@ -85,7 +85,7 @@ public function midClip($value, $max_length = 80) ? mb_substr($full_string, 0, $first_clip).'...' : '...'; // Ellipsis only. - $second_clip = strlen($full_string) - ($max_length - strlen($string)); + $second_clip = mb_strlen($full_string) - ($max_length - mb_strlen($string)); $string .= $second_clip >= 0 && $second_clip >= $first_clip ? mb_substr($full_string, $second_clip) : '';