本文整理汇总了PHP中Ibos::createComponent方法的典型用法代码示例。如果您正苦于以下问题:PHP Ibos::createComponent方法的具体用法?PHP Ibos::createComponent怎么用?PHP Ibos::createComponent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ibos
的用法示例。
在下文中一共展示了Ibos::createComponent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createController
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;
}
}
示例2: createComponent
protected function createComponent($class, $properties = array())
{
return Ibos::createComponent(array_merge(array("class" => $class), $properties));
}