forked from wallabag/wallabag
store estimated reading time / filters on reading time
This commit is contained in:
@ -7,7 +7,6 @@ class WallabagExtension extends \Twig_Extension
|
||||
public function getFilters()
|
||||
{
|
||||
return array(
|
||||
new \Twig_SimpleFilter('readingTime', array($this, 'getReadingTime')),
|
||||
new \Twig_SimpleFilter('domainName', array($this, 'getDomainName')),
|
||||
);
|
||||
}
|
||||
@ -24,18 +23,6 @@ class WallabagExtension extends \Twig_Extension
|
||||
return parse_url($url, PHP_URL_HOST);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return 'wallabag_extension';
|
||||
|
||||
Reference in New Issue
Block a user