diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2015-08-07 22:20:30 +0200 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2015-08-12 09:01:29 +0200 |
commit | 2686457448372543fdf4f1fc54c4fd20f0f02c2c (patch) | |
tree | 485eeecc3bd3db3613d47de25662d5c9163e4afe /src/Wallabag/CoreBundle/Helper | |
parent | fedaf005377e6d62ff0986f7f54afef3287a6451 (diff) | |
download | wallabag-2686457448372543fdf4f1fc54c4fd20f0f02c2c.tar.gz wallabag-2686457448372543fdf4f1fc54c4fd20f0f02c2c.tar.zst wallabag-2686457448372543fdf4f1fc54c4fd20f0f02c2c.zip |
store estimated reading time / filters on reading time
Diffstat (limited to 'src/Wallabag/CoreBundle/Helper')
-rwxr-xr-x | src/Wallabag/CoreBundle/Helper/Tools.php | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/Wallabag/CoreBundle/Helper/Tools.php b/src/Wallabag/CoreBundle/Helper/Tools.php index be29ab99..d368ee71 100755 --- a/src/Wallabag/CoreBundle/Helper/Tools.php +++ b/src/Wallabag/CoreBundle/Helper/Tools.php | |||
@@ -118,4 +118,16 @@ final class Tools | |||
118 | 118 | ||
119 | return str_replace('+', '', $token); | 119 | return str_replace('+', '', $token); |
120 | } | 120 | } |
121 | |||
122 | /** | ||
123 | * For a given text, we calculate reading time for an article. | ||
124 | * | ||
125 | * @param $text | ||
126 | * | ||
127 | * @return float | ||
128 | */ | ||
129 | public static function getReadingTime($text) | ||
130 | { | ||
131 | return floor(str_word_count(strip_tags($text)) / 200); | ||
132 | } | ||
121 | } | 133 | } |