X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FCoreBundle%2FTools%2FUtils.php;h=eba21c025d71cb86c79874f4c2ca26b978ffac66;hb=68cb89a5161351dd730871fc834bf147204a2a07;hp=0c78311021535da7b50ce104aeb894402568ef95;hpb=6c32aaae95caf6fcd6740fa1a78f8af31bb6370f;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/CoreBundle/Tools/Utils.php b/src/Wallabag/CoreBundle/Tools/Utils.php index 0c783110..eba21c02 100644 --- a/src/Wallabag/CoreBundle/Tools/Utils.php +++ b/src/Wallabag/CoreBundle/Tools/Utils.php @@ -16,7 +16,7 @@ class Utils $token = substr(base64_encode(random_bytes($length)), 0, $length); // remove character which can broken the url - return str_replace(array('+', '/'), '', $token); + return str_replace(['+', '/'], '', $token); } /** @@ -29,6 +29,6 @@ class Utils */ public static function getReadingTime($text) { - return floor(str_word_count(strip_tags($text)) / 200); + return floor(count(preg_split('~[^\p{L}\p{N}\']+~u', strip_tags($text))) / 200); } }