Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

ENHANCEMENT File::get_app_category()

Adding File::get_app_category to be in line with
File::get_file_extension
  • Loading branch information...
commit e2d7352c81edf30aee6ebe0b291db99acbc01e52 1 parent 6dc108a
@mightycoco mightycoco authored
Showing with 11 additions and 3 deletions.
  1. +11 −3 filesystem/File.php
View
14 filesystem/File.php
@@ -393,7 +393,6 @@ function getCMSFields() {
return $fields;
}
-
/**
* Returns a category based on the file extension.
* This can be useful when grouping files by type,
@@ -402,13 +401,22 @@ function getCMSFields() {
*
* @return String
*/
- public function appCategory() {
- $ext = strtolower($this->Extension);
+ public static function get_app_category($ext) {
+ $ext = strtolower($ext);
foreach(self::$app_categories as $category => $exts) {
if(in_array($ext, $exts)) return $category;
}
return false;
}
+
+ /**
+ * Returns a category based on the file extension.
+ *
+ * @return String
+ */
+ public function appCategory() {
+ return self::get_app_category($this->Extension);
+ }
function CMSThumbnail() {
return '<img src="' . $this->Icon() . '" />';
Please sign in to comment.
Something went wrong with that request. Please try again.