diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2014-07-10 13:17:04 +0200 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2014-07-10 13:17:04 +0200 |
commit | 6400371ff93782d25cdbd50aa224c70145b3890a (patch) | |
tree | 93e09a9851eb04d55b6b77d209ea8c0331b88950 /inc/poche/Tools.class.php | |
parent | c710f977b2659e866aba0e6a436485649834f2c4 (diff) | |
download | wallabag-6400371ff93782d25cdbd50aa224c70145b3890a.tar.gz wallabag-6400371ff93782d25cdbd50aa224c70145b3890a.tar.zst wallabag-6400371ff93782d25cdbd50aa224c70145b3890a.zip |
I removed my previous commit. We have to create a new branch for that.
Diffstat (limited to 'inc/poche/Tools.class.php')
-rwxr-xr-x | inc/poche/Tools.class.php | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/inc/poche/Tools.class.php b/inc/poche/Tools.class.php index 13f48903..cc01f403 100755 --- a/inc/poche/Tools.class.php +++ b/inc/poche/Tools.class.php | |||
@@ -214,6 +214,20 @@ class Tools | |||
214 | return ((isset ($_REQUEST["$var"])) ? htmlentities($_REQUEST["$var"]) : $default); | 214 | return ((isset ($_REQUEST["$var"])) ? htmlentities($_REQUEST["$var"]) : $default); |
215 | } | 215 | } |
216 | 216 | ||
217 | public static function getDomain($url) | ||
218 | { | ||
219 | return parse_url($url, PHP_URL_HOST); | ||
220 | } | ||
221 | |||
222 | public static function getReadingTime($text) { | ||
223 | $word = str_word_count(strip_tags($text)); | ||
224 | $minutes = floor($word / 200); | ||
225 | $seconds = floor($word % 200 / (200 / 60)); | ||
226 | $time = array('minutes' => $minutes, 'seconds' => $seconds); | ||
227 | |||
228 | return $minutes; | ||
229 | } | ||
230 | |||
217 | public static function getDocLanguage($userlanguage) { | 231 | public static function getDocLanguage($userlanguage) { |
218 | $lang = explode('.', $userlanguage); | 232 | $lang = explode('.', $userlanguage); |
219 | return str_replace('_', '-', $lang[0]); | 233 | return str_replace('_', '-', $lang[0]); |