Skip to content
This repository
Browse code

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 authored

Showing 1 changed file with 11 additions and 3 deletions. Show diff stats Hide diff stats

  1. 14  filesystem/File.php
14  filesystem/File.php
@@ -393,7 +393,6 @@ function getCMSFields() {
393 393
 		return $fields;
394 394
 	}
395 395
 
396  
-	
397 396
 	/**
398 397
 	 * Returns a category based on the file extension.
399 398
 	 * This can be useful when grouping files by type,
@@ -402,13 +401,22 @@ function getCMSFields() {
402 401
 	 * 
403 402
 	 * @return String
404 403
 	 */
405  
-	public function appCategory() {
406  
-		$ext = strtolower($this->Extension);
  404
+	public static function get_app_category($ext) {
  405
+		$ext = strtolower($ext);
407 406
 		foreach(self::$app_categories as $category => $exts) {
408 407
 			if(in_array($ext, $exts)) return $category;
409 408
 		}
410 409
 		return false;
411 410
 	}
  411
+	
  412
+	/**
  413
+	 * Returns a category based on the file extension.
  414
+	 * 
  415
+	 * @return String
  416
+	 */
  417
+	public function appCategory() {
  418
+		return self::get_app_category($this->Extension);
  419
+	}
412 420
 
413 421
 	function CMSThumbnail() {
414 422
 		return '<img src="' . $this->Icon() . '" />';

0 notes on commit e2d7352

Please sign in to comment.
Something went wrong with that request. Please try again.