TemplateEngineInfo.class.php (1015B)
1 <?php 2 3 namespace template_engine; 4 5 class TemplateEngineInfo 6 { 7 8 public static function getComponentList() 9 { 10 $components = parse_ini_file(__DIR__.'/components/components.ini'); 11 12 return array_keys($components); 13 } 14 15 16 public static function getLESSFiles() 17 { 18 return self::getComponentFilesByExtension('.less'); 19 } 20 21 public static function getJSFiles() 22 { 23 return self::getComponentFilesByExtension('.js'); 24 } 25 26 27 /** 28 * Gets all files with the specified extension. 29 * 30 * @param $extension string Extension 31 * @return array 32 */ 33 private static function getComponentFilesByExtension($extension ) 34 { 35 36 $files = array(); 37 if ($handle = opendir(__DIR__.'/components/html')) { 38 39 while (false !== ($entry = readdir($handle))) { 40 if ( substr($entry,-strlen($extension)) == $extension ) 41 $files[] = $entry; 42 } 43 44 closedir($handle); 45 } 46 return $files; 47 } 48 49 }