public function createController($route, $owner = null) { if ($owner === null) { $owner = $this; } if (($route = trim($route, "/")) === "") { $route = $owner->defaultController; } $caseSensitive = parent::getUrlManager()->caseSensitive; $route .= "/"; while (($pos = strpos($route, "/")) !== false) { $id = substr($route, 0, $pos); if (!preg_match("/^\\w+\$/", $id)) { return null; } if (!$caseSensitive) { $id = strtolower($id); } $route = (string) substr($route, $pos + 1); if (!isset($basePath)) { if (isset($owner->controllerMap[$id])) { return array(Ibos::createComponent($owner->controllerMap[$id], $id, $this->resolveWhatToPassAsParameterForOwner($owner)), parent::parseActionParams($route)); } if (($module = $owner->getModule($id)) !== null) { if (parent::hasEventHandler("onInitModule")) { $this->onInitModule(new CEvent($this)); } return $this->createController($route, $module); } $basePath = $owner->getControllerPath(); $controllerID = ""; } else { $controllerID .= "/"; } $baseClassName = ucfirst($id) . "Controller"; if ($this->isOwnerTheController($owner)) { $className = $baseClassName; } else { $className = $owner::getPluralCamelCasedName() . $baseClassName; } $classFile = $basePath . DIRECTORY_SEPARATOR . $baseClassName . ".php"; if (is_file($classFile)) { if (!class_exists($className, false)) { require $classFile; } if (class_exists($className, false) && is_subclass_of($className, "CController")) { $id[0] = strtolower($id[0]); return array(new $className($controllerID . $id, $this->resolveWhatToPassAsParameterForOwner($owner)), parent::parseActionParams($route)); } return null; } $controllerID .= $id; $basePath .= DIRECTORY_SEPARATOR . $id; } }