From 5f9bff0f71b415dd6e9753b7b7f1ad75db8aa481 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Thu, 8 Aug 2013 21:13:37 +0200 Subject: some urls weren't well parsed --- inc/poche/Tools.class.php | 1 + 1 file changed, 1 insertion(+) (limited to 'inc/poche/Tools.class.php') diff --git a/inc/poche/Tools.class.php b/inc/poche/Tools.class.php index d0e43166..4a72bae3 100644 --- a/inc/poche/Tools.class.php +++ b/inc/poche/Tools.class.php @@ -170,6 +170,7 @@ class Tools preg_match('#charset="?(.*)"#si', $meta[0], $encoding); # if charset is found set it otherwise, set it to utf-8 $html_charset = (!empty($encoding[1])) ? strtolower($encoding[1]) : 'utf-8'; + if (empty($encoding[1])) $encoding[1] = 'utf-8'; } else { $html_charset = 'utf-8'; $encoding[1] = ''; -- cgit v1.2.3 From d91787589bfd7541a99032cc23243165dc1572c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Fri, 9 Aug 2013 08:25:16 +0200 Subject: fix #113 - reading time --- inc/poche/Tools.class.php | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'inc/poche/Tools.class.php') diff --git a/inc/poche/Tools.class.php b/inc/poche/Tools.class.php index 4a72bae3..0eb0d9ea 100644 --- a/inc/poche/Tools.class.php +++ b/inc/poche/Tools.class.php @@ -224,4 +224,13 @@ class Tools return FALSE; } + + public static function getReadingTime($text) { + $word = str_word_count(strip_tags($text)); + $minutes = floor($word / 200); + $seconds = floor($word % 200 / (200 / 60)); + $time = array('minutes' => $minutes, 'seconds' => $seconds); + + return $minutes; + } } \ No newline at end of file -- cgit v1.2.3