/** * Configure the routing in a function * @param array $config */ public function configRouting(array $config) { if (!empty($config['error']) || !empty($config['start'])) { PWEL_ROUTING::$error_controller = $config['error']; PWEL_ROUTING::$start_controller = $config['start']; } else { $this->autoConfigRouting(); } if (!empty($config['autosearch'])) { PWEL_ROUTING::$autoSearch = $config['autosearch']; } if (!empty($config['namespace'])) { PWEL_ROUTING::$namespace = $config['namespace']; } if (!empty($config['namespacerange'])) { PWEL_ROUTING::$namespaceRange = $config['namespacerange']; } self::$configured = true; }
/** * This function correct the namespace value * Example: /html/ -> html/, projectname */ static function correctNamespace() { $namespace = self::$namespace . "/"; $namespace = str_replace("//", "/", $namespace); $namespace = str_replace("./", "", $namespace); $namespace = str_replace(".", "", $namespace); self::$namespace = $namespace; }