X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FCoreBundle%2FTools%2FUtils.php;h=c14d2aa073859b4c44edd5f76ff6bd9460e728c4;hb=35983eb9bbbf78041ff9f6679ca345850f41c5f1;hp=eba21c025d71cb86c79874f4c2ca26b978ffac66;hpb=20da238413d1c6cc360d58a13df33eb199fa5f05;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/CoreBundle/Tools/Utils.php b/src/Wallabag/CoreBundle/Tools/Utils.php index eba21c02..c14d2aa0 100644 --- a/src/Wallabag/CoreBundle/Tools/Utils.php +++ b/src/Wallabag/CoreBundle/Tools/Utils.php @@ -20,15 +20,14 @@ class Utils } /** - * For a given text, we calculate reading time for an article - * based on 200 words per minute. + * For a given text, we calculate reading time for an article based on 200 words per minute. * - * @param $text + * @param string $text * * @return float */ public static function getReadingTime($text) { - return floor(count(preg_split('~[^\p{L}\p{N}\']+~u', strip_tags($text))) / 200); + return floor(\count(preg_split('~([^\p{L}\p{N}\']+|\p{Han}|\p{Hiragana}|\p{Katakana}|\p{Hangul})~u', strip_tags($text))) / 200); } }