aboutsummaryrefslogtreecommitdiffhomepage
path: root/inc/poche/Tools.class.php
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas.loeuillet@gmail.com>2013-08-12 05:14:04 -0700
committerNicolas LÅ“uillet <nicolas.loeuillet@gmail.com>2013-08-12 05:14:04 -0700
commit667009727a38890eb651815843c1bc02869a4119 (patch)
treefc3cdb9f2c7659c2d6a1bfe04a34d2430629612c /inc/poche/Tools.class.php
parent82757801b9e9cdc8806c0005c290f05124f91ba6 (diff)
parent15493df62db830a0834a74c240bbb9d8889ae1de (diff)
downloadwallabag-667009727a38890eb651815843c1bc02869a4119.tar.gz
wallabag-667009727a38890eb651815843c1bc02869a4119.tar.zst
wallabag-667009727a38890eb651815843c1bc02869a4119.zip
Merge pull request #132 from inthepoche/dev
merge with beta2
Diffstat (limited to 'inc/poche/Tools.class.php')
-rw-r--r--inc/poche/Tools.class.php10
1 files changed, 10 insertions, 0 deletions
diff --git a/inc/poche/Tools.class.php b/inc/poche/Tools.class.php
index d0e43166..0eb0d9ea 100644
--- a/inc/poche/Tools.class.php
+++ b/inc/poche/Tools.class.php
@@ -170,6 +170,7 @@ class Tools
170 preg_match('#charset="?(.*)"#si', $meta[0], $encoding); 170 preg_match('#charset="?(.*)"#si', $meta[0], $encoding);
171 # if charset is found set it otherwise, set it to utf-8 171 # if charset is found set it otherwise, set it to utf-8
172 $html_charset = (!empty($encoding[1])) ? strtolower($encoding[1]) : 'utf-8'; 172 $html_charset = (!empty($encoding[1])) ? strtolower($encoding[1]) : 'utf-8';
173 if (empty($encoding[1])) $encoding[1] = 'utf-8';
173 } else { 174 } else {
174 $html_charset = 'utf-8'; 175 $html_charset = 'utf-8';
175 $encoding[1] = ''; 176 $encoding[1] = '';
@@ -223,4 +224,13 @@ class Tools
223 224
224 return FALSE; 225 return FALSE;
225 } 226 }
227
228 public static function getReadingTime($text) {
229 $word = str_word_count(strip_tags($text));
230 $minutes = floor($word / 200);
231 $seconds = floor($word % 200 / (200 / 60));
232 $time = array('minutes' => $minutes, 'seconds' => $seconds);
233
234 return $minutes;
235 }
226} \ No newline at end of file 236} \ No newline at end of file