X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=inc%2Fpoche%2FTools.class.php;h=52d0f2d5c7cfb90f19eba95f1c995d5b184b3967;hb=0269cd821311500acffed61edb1bc168d3fb5ec8;hp=d0e431663dcf5f9dc07aa1e904edf78bfe789cb7;hpb=9a8b4ff4edf84d7df60de1b6fd1e493b59f88273;p=github%2Fwallabag%2Fwallabag.git diff --git a/inc/poche/Tools.class.php b/inc/poche/Tools.class.php old mode 100644 new mode 100755 index d0e43166..52d0f2d5 --- 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] = ''; @@ -223,4 +224,34 @@ 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; + } + + + public static function createMyConfig() + { + $myconfig_file = './inc/poche/myconfig.inc.php'; + + if (!is_writable('./inc/poche/')) { + self::logm('you don\'t have write access to create ./inc/poche/myconfig.inc.php'); + die('You don\'t have write access to create ./inc/poche/myconfig.inc.php.'); + } + + if (!file_exists($myconfig_file)) + { + $fp = fopen($myconfig_file, 'w'); + fwrite($fp, '