Go to the documentation of this file.00001 <?php
00010 final class lib {
00011
00017 private static $libFiles = array();
00018
00022 private function __construct() {}
00023
00031 public static function exists($name) {
00032 return !(self::initFile($name) === false);
00033 }
00034
00041 public static function isLoaded($name) {
00042 return in_array(str_replace(array('/', '\\'), array(DS, DS), self::initFile($name)), get_included_files());
00043 }
00044
00051 public static function load($name) {
00052 if (self::isLoaded($name))
00053 return true;
00054
00055 if ($file = self::initFile($name))
00056 return require($file);
00057
00058 return false;
00059 }
00060
00068 public static function initFile($name) {
00069 if (!array_key_exists($name, self::$libFiles)) {
00070 self::$libFiles[$name] = file::nyroExists(array(
00071 'name'=>'lib_'.$name.'_init',
00072 'type'=>'lib'
00073 ));
00074 }
00075 return self::$libFiles[$name];
00076 }
00077
00078 }