| 1 |
<?php |
| 2 |
/** |
| 3 |
* @version $ Id; ?FILE_NAME ?DATE ?TIME ?AUTHOR $ |
| 4 |
*/ |
| 5 |
|
| 6 |
// Disallow direct access. |
| 7 |
defined('ABSPATH') or die("Access denied"); |
| 8 |
|
| 9 |
/** |
| 10 |
* |
| 11 |
*/ |
| 12 |
abstract class CJTTemplates { |
| 13 |
|
| 14 |
/** |
| 15 |
* Get templates types mapped by extensions of the type file. |
| 16 |
* |
| 17 |
* @return array |
| 18 |
*/ |
| 19 |
public static function getExtensionTypeMap() { |
| 20 |
// Initialize! |
| 21 |
static $map = null; |
| 22 |
if (!$map) { |
| 23 |
// Us extension as key and type-name as value. |
| 24 |
foreach (cssJSToolbox::$config->templates->types as $type => $data) { |
| 25 |
$map[$data->extension] = $type; |
| 26 |
} |
| 27 |
} |
| 28 |
return $map; |
| 29 |
} |
| 30 |
|
| 31 |
/** |
| 32 |
* Get template type extension name. |
| 33 |
* |
| 34 |
* @param mixed $typeName |
| 35 |
*/ |
| 36 |
public static function getExtensionType($extension) { |
| 37 |
// Get extensions->types map. |
| 38 |
$map = self::getExtensionTypeMap(); |
| 39 |
// Return Type if Extension exists or FALSE otherwise. |
| 40 |
return isset($map[$extension]) ? $map[$extension] : FALSE; |
| 41 |
} |
| 42 |
|
| 43 |
} // End class. |