store estimated reading time / filters on reading time

This commit is contained in:
Nicolas Lœuillet
2015-08-07 22:20:30 +02:00
parent fedaf00537
commit 2686457448
20 changed files with 433 additions and 279 deletions

View File

@ -118,4 +118,16 @@ final class Tools
return str_replace('+', '', $token);
}
/**
* For a given text, we calculate reading time for an article.
*
* @param $text
*
* @return float
*/
public static function getReadingTime($text)
{
return floor(str_word_count(strip_tags($text)) / 200);
}
}