remote forking: use the original http/https url in description
[phorkie.git] / src / phorkie / File.php
index c86e5e0cb29045c66b087fcb42094b622fbdda38..7f5b5b407df44747c9d67f6f34f6f1eff7b025e9 100644 (file)
@@ -118,6 +118,9 @@ class File
         throw new Exception('Unknown type');
     }
 
+    /**
+     * @return string Mime type of file
+     */
     public function getMimeType()
     {
         $ext = $this->getExt();
@@ -148,6 +151,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;
         }
@@ -158,4 +168,4 @@ class File
     }
 }
 
-?>
\ No newline at end of file
+?>