diff options
author | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2009-04-15 19:51:13 +0000 |
---|---|---|
committer | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2009-04-15 19:51:13 +0000 |
commit | 9efb09230050c6756a8acdecfa135a13244b1d2d (patch) | |
tree | 063b917ef53c07b8fa2a43192cf2c781158ebf9e | |
parent | daaa8560a34a262c21db4e8a33b4e8c042042860 (diff) | |
download | elgg-9efb09230050c6756a8acdecfa135a13244b1d2d.tar.gz elgg-9efb09230050c6756a8acdecfa135a13244b1d2d.tar.bz2 |
Centralised mimetype function
git-svn-id: https://code.elgg.org/elgg/trunk@3212 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r-- | engine/lib/filestore.php | 38 | ||||
-rw-r--r-- | version.php | 2 |
2 files changed, 39 insertions, 1 deletions
diff --git a/engine/lib/filestore.php b/engine/lib/filestore.php index e33730021..67330c4e5 100644 --- a/engine/lib/filestore.php +++ b/engine/lib/filestore.php @@ -1247,6 +1247,44 @@ } } + /** + * Returns an overall file type from the mimetype + * + * @param string $mimetype The MIME type + * @return string The overall type + */ + function get_general_file_type($mimetype) { + + switch($mimetype) { + + case "application/msword": + return "document"; + break; + case "application/pdf": + return "document"; + break; + + } + + if (substr_count($mimetype,'text/')) + return "document"; + + if (substr_count($mimetype,'audio/')) + return "audio"; + + if (substr_count($mimetype,'image/')) + return "image"; + + if (substr_count($mimetype,'video/')) + return "video"; + + if (substr_count($mimetype,'opendocument')) + return "document"; + + return "general"; + + } + /// Variable holding the default datastore $DEFAULT_FILE_STORE = NULL; diff --git a/version.php b/version.php index cf2b3859d..7c172bca4 100644 --- a/version.php +++ b/version.php @@ -13,7 +13,7 @@ * @link http://elgg.org/
*/
- $version = 2009041501; // YYYYMMDD = Elgg Date + $version = 2009041502; // YYYYMMDD = Elgg Date // XX = Interim incrementer
$release = '1.5'; // Human-friendly version name
|