本文整理汇总了PHP中wcf\system\WCF::getApplicationObject方法的典型用法代码示例。如果您正苦于以下问题:PHP WCF::getApplicationObject方法的具体用法?PHP WCF::getApplicationObject怎么用?PHP WCF::getApplicationObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wcf\system\WCF
的用法示例。
在下文中一共展示了WCF::getApplicationObject方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handleDefaultController
/**
* Checks page access for possible mandatory redirects.
*
* @param string $application
* @param array $routeData
*/
protected function handleDefaultController($application, array &$routeData)
{
if (!RouteHandler::getInstance()->isDefaultController()) {
return;
}
$landingPage = PageMenu::getInstance()->getLandingPage();
if ($landingPage === null) {
return;
}
if (empty($routeData['controller'])) {
$routeData['isImplicitController'] = true;
}
// resolve implicit application abbreviation for landing page controller
$landingPageApplication = $landingPage->getApplication();
$primaryApplication = ApplicationHandler::getInstance()->getPrimaryApplication();
$primaryApplicationAbbr = ApplicationHandler::getInstance()->getAbbreviation($primaryApplication->packageID);
if ($landingPageApplication == 'wcf') {
$landingPageApplication = $primaryApplicationAbbr;
}
// check if currently invoked application matches the landing page
if ($landingPageApplication == $application) {
$routeData['controller'] = $landingPage->getController();
if (!URL_LEGACY_MODE) {
$routeData['controller'] = self::getTokenizedController($routeData['controller']);
}
// use alias if defined to prevent incorrect recognition
$alias = $this->getAliasByController($routeData['controller']);
if ($alias !== null) {
$routeData['controller'] = $alias;
}
return;
}
// redirect if this is the primary application
if ($application === $primaryApplicationAbbr) {
HeaderUtil::redirect($landingPage->getLink());
exit;
}
// set default controller
$applicationObj = WCF::getApplicationObject(ApplicationHandler::getInstance()->getApplication($application));
$routeData['controller'] = preg_replace('~^.*?\\\\([^\\\\]+)(?:Action|Form|Page)$~', '\\1', $applicationObj->getPrimaryController());
if (!URL_LEGACY_MODE) {
$routeData['controller'] = self::getTokenizedController($routeData['controller']);
}
}
示例2: loadDefaultControllers
/**
* Loads the default controllers for each active application.
*/
protected function loadDefaultControllers()
{
if ($this->defaultControllers === null) {
$this->defaultControllers = array();
foreach (ApplicationHandler::getInstance()->getApplications() as $application) {
$app = WCF::getApplicationObject($application);
if (!$app) {
continue;
}
$controller = $app->getPrimaryController();
if (!$controller) {
continue;
}
$controller = explode('\\', $controller);
$controllerName = preg_replace('~(Action|Form|Page)$~', '', array_pop($controller));
$this->defaultControllers[$controller[0]] = $controllerName;
}
}
}