public function get_controller() { if (SITE_AVAILABLE) { $controllers_array = Gbl::get('controllers_array'); if (!empty($this->up[0]) && Cleaner::sanitized(CTYPE_ARRAY, $this->up[0], array_keys($controllers_array))) { $controller_name = $controllers_array[$this->up[0]]; } else { # we are running from the default page of the site, so pass the default back $controller_name = Gbl::get('default_controller'); } } else { $controller_name = 'MaintenanceController'; } # do we have to include the code for the controller? if (!is_object($controller_name)) { require_once CONTROLLERS_PATH . '/' . $controller_name . '.lib.php'; } return new $controller_name(); }