+
+ /**
+ * Tells if the file contains textual content and is editable.
+ *
+ * @return boolean
+ */
+ 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;
+ }
+
+ $type = $GLOBALS['phorkie']['languages'][$ext]['mime'];
+ return substr($type, 0, 5) === 'text/'
+ || $type == 'application/javascript';
+ }