aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Weiske <cweiske@cweiske.de>2012-03-28 06:39:25 +0200
committerChristian Weiske <cweiske@cweiske.de>2012-03-28 06:39:25 +0200
commit3f18e7e8ce995bb209f8409cd8d00d8267dfa04f (patch)
tree918da6044c2f62441416e63e6c210211c56ee547 /src
parente8d13647a1fba053a2b6c7d6ae18a3bd4d0193a0 (diff)
downloadphorkie-3f18e7e8ce995bb209f8409cd8d00d8267dfa04f.tar.gz
phorkie-3f18e7e8ce995bb209f8409cd8d00d8267dfa04f.zip
determine mime type by file extension, not by geshi type
Diffstat (limited to 'src')
-rw-r--r--src/Phorkie/File.php18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/Phorkie/File.php b/src/Phorkie/File.php
index 84f7eb5..bf2eb60 100644
--- a/src/Phorkie/File.php
+++ b/src/Phorkie/File.php
@@ -59,13 +59,23 @@ class File
}
/**
+ * Get file extension without dot
+ *
+ * @return string
+ */
+ public function getExt()
+ {
+ return substr($this->path, strrpos($this->path, '.') + 1);
+ }
+
+ /**
* Returns the type of the file, as used by Geshi
*
* @return string
*/
public function getType()
{
- $ext = substr($this->path, strrpos($this->path, '.') + 1);
+ $ext = $this->getExt();
if (isset(static::$arTypeMap[$ext])) {
$ext = static::$arTypeMap[$ext];
}
@@ -93,11 +103,11 @@ class File
public function getMimeType()
{
- $type = $this->getType();
- if (!isset(static::$arMimeTypeMap[$type])) {
+ $ext = $this->getExt();
+ if (!isset(static::$arMimeTypeMap[$ext])) {
return null;
}
- return static::$arMimeTypeMap[$type];
+ return static::$arMimeTypeMap[$ext];
}
/**