git.cweiske.de
/
phorkie.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(from parent 1:
1ef220b
)
render files without extension <= 4kiB as text
author
Christian Weiske
<cweiske@cweiske.de>
Thu, 26 Apr 2012 04:51:19 +0000
(06:51 +0200)
committer
Christian Weiske
<cweiske@cweiske.de>
Thu, 26 Apr 2012 04:51:19 +0000
(06:51 +0200)
src/phorkie/File.php
patch
|
blob
|
history
diff --git
a/src/phorkie/File.php
b/src/phorkie/File.php
index c86e5e0cb29045c66b087fcb42094b622fbdda38..331f2e546be5b72b96c9d96960ca8b7c4f6526e6 100644
(file)
--- 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;
}