From: Christian Weiske Date: Thu, 26 Apr 2012 04:51:19 +0000 (+0200) Subject: render files without extension <= 4kiB as text X-Git-Tag: v0.2.0~38 X-Git-Url: https://git.cweiske.de/phorkie.git/commitdiff_plain/d78df0d7b8025365c00c87f545c18a810eecbd5c render files without extension <= 4kiB as text --- diff --git a/src/phorkie/File.php b/src/phorkie/File.php index c86e5e0..331f2e5 100644 --- a/src/phorkie/File.php +++ b/src/phorkie/File.php @@ -148,6 +148,13 @@ class File public function isText() { $ext = $this->getExt(); + if ($ext == '') { + //no file extension? then consider the size + $size = filesize($this->getFullPath()); + //files <= 4kiB are considered to be text + return $size <= 4096; + } + if (!isset($GLOBALS['phorkie']['languages'][$ext]['mime'])) { return false; }