Fix incorrect reading time calculation for entries in languages with

non-latin chars subset.
This commit is contained in:
Andrew Kovalyov
2016-11-28 01:15:06 +02:00
parent 625bb56181
commit 5b6888b13f
5 changed files with 54 additions and 1 deletions

View File

@ -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);
}
}