diff options
| author | Christian Weiske <cweiske@cweiske.de> | 2012-04-26 06:51:19 +0200 |
|---|---|---|
| committer | Christian Weiske <cweiske@cweiske.de> | 2012-04-26 06:51:19 +0200 |
| commit | d78df0d7b8025365c00c87f545c18a810eecbd5c (patch) | |
| tree | 7f01f0898ca356dd5cb9f690bf0737e0c468308f | |
| parent | 1ef220ba41f37c0e6654277e3d0a4a5e4d451de2 (diff) | |
| download | phorkie-d78df0d7b8025365c00c87f545c18a810eecbd5c.tar.gz phorkie-d78df0d7b8025365c00c87f545c18a810eecbd5c.zip | |
render files without extension <= 4kiB as text
| -rw-r--r-- | src/phorkie/File.php | 7 |
1 files changed, 7 insertions, 0 deletions
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; } |
