aboutsummaryrefslogtreecommitdiff
path: root/src/Phorkie/File.php
diff options
context:
space:
mode:
authorChristian Weiske <cweiske@cweiske.de>2012-03-28 06:37:06 +0200
committerChristian Weiske <cweiske@cweiske.de>2012-03-28 06:37:06 +0200
commite8d13647a1fba053a2b6c7d6ae18a3bd4d0193a0 (patch)
treed59be9e3d392974a3fa8c2f7e685a5c56bc59d67 /src/Phorkie/File.php
parent83dee594452004d482547d7e6ab2e2169dc0fb4e (diff)
downloadphorkie-e8d13647a1fba053a2b6c7d6ae18a3bd4d0193a0.tar.gz
phorkie-e8d13647a1fba053a2b6c7d6ae18a3bd4d0193a0.zip
highlighting for htm/html files
Diffstat (limited to 'src/Phorkie/File.php')
-rw-r--r--src/Phorkie/File.php24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/Phorkie/File.php b/src/Phorkie/File.php
index 729cbd6..84f7eb5 100644
--- a/src/Phorkie/File.php
+++ b/src/Phorkie/File.php
@@ -17,6 +17,11 @@ class File
*/
public $repo;
+ /**
+ * Maps file extensions to MIME Types
+ *
+ * @var array
+ */
public static $arMimeTypeMap = array(
'css' => 'text/css',
'htm' => 'text/html',
@@ -27,6 +32,16 @@ class File
'xml' => 'text/xml',
);
+ /**
+ * Maps file extensions to geshi types
+ *
+ * @var array
+ */
+ public static $arTypeMap = array(
+ 'htm' => 'xml',
+ 'html' => 'xml',
+ );
+
public function __construct($path, Repository $repo)
{
$this->path = $path;
@@ -44,13 +59,18 @@ class File
}
/**
- * Returns the type of the file, as used internally by Phorkie
+ * Returns the type of the file, as used by Geshi
*
* @return string
*/
public function getType()
{
- return substr($this->path, strrpos($this->path, '.') + 1);
+ $ext = substr($this->path, strrpos($this->path, '.') + 1);
+ if (isset(static::$arTypeMap[$ext])) {
+ $ext = static::$arTypeMap[$ext];
+ }
+
+ return $ext;
}
public function getContent()