summaryrefslogtreecommitdiff
path: root/inc/utils.php
diff options
context:
space:
mode:
authorandi <andi@splitbrain.org>2005-04-15 14:14:16 +0200
committerandi <andi@splitbrain.org>2005-04-15 14:14:16 +0200
commit4826ab45befb9eb1c664b5d8c8a0f03a7b750b8b (patch)
treec3041cb122b01e963e5911ae68bbb0f761873f8b /inc/utils.php
parentf6c6dfdc9f2865c735c19221b9ffad57f39a7d04 (diff)
downloadrpg-4826ab45befb9eb1c664b5d8c8a0f03a7b750b8b.tar.gz
rpg-4826ab45befb9eb1c664b5d8c8a0f03a7b750b8b.tar.bz2
new parser: images, added flash support #154
darcs-hash:20050415121416-9977f-583ee34659f70017fec4f8b8a4de327c5b1631e4.gz
Diffstat (limited to 'inc/utils.php')
-rw-r--r--inc/utils.php21
1 files changed, 12 insertions, 9 deletions
diff --git a/inc/utils.php b/inc/utils.php
index 6610c217a..114fa3024 100644
--- a/inc/utils.php
+++ b/inc/utils.php
@@ -9,21 +9,24 @@
if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/');
/**
- * Returns the (known) extension of a given filename
- *
- * returns false if not a known extension
+ * Returns the (known) extension and mimetype of a given filename
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
-function media_extension($file){
- $exts = join('|',array_keys(getMimeTypes()));
+function mimetype($file){
+ $ret = array(false,false); // return array
+ $mtypes = getMimeTypes(); // known mimetypes
+ $exts = join('|',array_keys($mtypes)); // known extensions (regexp)
if(preg_match('#\.('.$exts.')$#i',$file,$matches)){
- return strtolower($matches[1]);
+ $ext = strtolower($matches[1]);
}
-
- return false;
-}
+ if($ext && $mtypes[$ext]){
+ $ret = array($ext, $mtypes[$ext]);
+ }
+
+ return $ret;
+}
/**
* returns a hash of mimetypes