$path) { $module_file_name = $path . '/libraries/Theme/Model/' . $match[1] . '.php'; if (file_exists ($module_file_name)) { $file = $module_file_name; break; } } if (! isset ($file)) { $file = LIBPATH . 'Theme/Model/' . $match[1] . '.php'; } } elseif (preg_match ('/^Theme_(.*)$/', $classname, $match)) { $file = get_std_class_path ($classname); } elseif (preg_match ('/^Test_.*$/', $classname, $match)) { $file = get_std_class_path ($classname, 'libraries', TESTPATH); } elseif (preg_match ('/(.*)_Model$/', $classname, $match)) { $file = APPPATH . 'models/' . strtolower ($match[1]) . '.php'; } elseif (preg_match ('/_/', $classname) or preg_match ('/^(Tester|String)$/', $classname)) { $file = get_std_class_path ($classname); } if (isset ($file)) { if (file_exists ($file)) { require_once $file; } } } function includeApplicationConfig ($file) { $dir = DATADIR . '/config/'; $prefix = (defined ('CONFIG_PREFIX') ? CONFIG_PREFIX : 'tmp') . '.'; $pathnames = array ("{$dir}{$prefix}{$file}", "{$dir}{$file}"); foreach ($pathnames as $pathname) { if (file_exists ($pathname)) { require $pathname; return $config; } } throw new Exception("File $file does not exist."); } spl_autoload_register ('my_autoloader'); set_include_path (APPPATH . PATH_SEPARATOR . LIBPATH . PATH_SEPARATOR . get_include_path () );