$var) { if ($var === $GLOBALS[$key]) { unset($GLOBALS[$key]); } } } } } } function urlMap() { global $url; if ($url) { $url=(strstr($url,"/"))?$url:$url."/"; $parts = explode("/",$url); $num = count($parts); $route = array_slice($parts,0,2); $vars = array_slice($parts,2); $map['name'] = $route[0]; $map['action'] = ($route[1])?$route[1]:'index'; $map['qString'] = $vars; } return $map; } /** Main Call Function **/ function callHook() { $map = urlMap(); $controllerName = $map['name']; $action = $map['action']; $qString = $map['qString']; //if (!is_dir( __DOCPATH.$controllerName)) { $controller = ucwords($controllerName)."Controller"; $model = ucwords($controllerName); $dispatch = new $controller($model,$controllerName,$action,$qString); if (method_exists($controller, $action)) { @call_user_func_array(array($dispatch,$action),$qString); } else { /* Error Generation Code Here */ } //} } /** Autoload any classes that are required **/ function __autoload($className) { $libraryFile = ROOT . '/library/' . strtolower($className) . '.class.php'; $controlFile = ROOT . '/application/controllers/' . strtolower($className) . '.php'; $modelFile = ROOT . '/application/models/' . strtolower($className) . '.php'; if (file_exists($libraryFile)) { require_once($libraryFile); //echo $libraryFile."
:"; } else if (file_exists($controlFile)) { require_once($controlFile); //echo $controlFile."
+"; } else if (file_exists($modelFile)) { require_once($modelFile); //echo $modelFile."
-"; } else { /* Error Generation Code Here */ } } setReporting(); removeMagicQuotes(); unregisterGlobals(); callHook(); ?>