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 (parent:
83dee59
)
highlighting for htm/html files
author
Christian Weiske
<cweiske@cweiske.de>
Wed, 28 Mar 2012 04:37:06 +0000
(06:37 +0200)
committer
Christian Weiske
<cweiske@cweiske.de>
Wed, 28 Mar 2012 04:37:06 +0000
(06:37 +0200)
src/Phorkie/File.php
patch
|
blob
|
history
diff --git
a/src/Phorkie/File.php
b/src/Phorkie/File.php
index 729cbd6aaaf6293bf3e65cc309717915a8df6c29..84f7eb5301b448f72a8ce322a04d1ce5926367a9 100644
(file)
--- a/
src/Phorkie/File.php
+++ b/
src/Phorkie/File.php
@@
-17,6
+17,11
@@
class File
*/
public $repo;
*/
public $repo;
+ /**
+ * Maps file extensions to MIME Types
+ *
+ * @var array
+ */
public static $arMimeTypeMap = array(
'css' => 'text/css',
'htm' => 'text/html',
public static $arMimeTypeMap = array(
'css' => 'text/css',
'htm' => 'text/html',
@@
-27,6
+32,16
@@
class File
'xml' => 'text/xml',
);
'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;
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 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()
}
public function getContent()