当前位置: 首页>>代码示例>>PHP>>正文


PHP Kurogo::defaultModule方法代码示例

本文整理汇总了PHP中Kurogo::defaultModule方法的典型用法代码示例。如果您正苦于以下问题:PHP Kurogo::defaultModule方法的具体用法?PHP Kurogo::defaultModule怎么用?PHP Kurogo::defaultModule使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Kurogo的用法示例。


在下文中一共展示了Kurogo::defaultModule方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: initializeForCommand

 public function initializeForCommand()
 {
     switch ($this->command) {
         case 'hello':
             $allmodules = $this->getAllModules();
             $homeModuleData = $this->getModuleNavigationData();
             $homeModules = array('primary' => isset($homeModuleData['primary']) ? array_keys($homeModuleData['primary']) : array(), 'secondary' => isset($homeModuleData['secondary']) ? array_keys($homeModuleData['secondary']) : array());
             foreach ($allmodules as $moduleID => $module) {
                 if ($module->isEnabled()) {
                     $home = false;
                     if (($key = array_search($moduleID, $homeModules['primary'])) !== FALSE) {
                         $home = array('type' => 'primary', 'order' => $key, 'title' => $homeModuleData['primary'][$moduleID]);
                     } elseif (($key = array_search($moduleID, $homeModules['secondary'])) !== FALSE) {
                         $home = array('type' => 'secondary', 'order' => $key);
                     }
                     $modules[] = array('id' => $module->getID(), 'tag' => $module->getConfigModule(), 'title' => $module->getModuleVar('title', 'module'), 'access' => $module->getAccess(AccessControlList::RULE_TYPE_ACCESS), 'payload' => $module->getPayload(), 'vmin' => $module->getVmin(), 'vmax' => $module->getVmax(), 'home' => $home);
                 }
             }
             $response = array('timezone' => Kurogo::getSiteVar('LOCAL_TIMEZONE'), 'version' => KUROGO_VERSION, 'modules' => $modules, 'default' => Kurogo::defaultModule());
             $this->setResponse($response);
             $this->setResponseVersion(2);
             break;
         case 'classify':
             $userAgent = $this->getArg('useragent');
             if (!$userAgent) {
                 throw new KurogoException("useragent parameter not specified");
             }
             $response = Kurogo::deviceClassifier()->classifyUserAgent($userAgent);
             $this->setResponse($response);
             $this->setResponseVersion(1);
             break;
         default:
             $this->invalidCommand();
             break;
     }
 }
开发者ID:nncsang,项目名称:Kurogo,代码行数:36,代码来源:CoreAPIModule.php

示例2: initializeForCommand

 public function initializeForCommand()
 {
     switch ($this->command) {
         case 'hello':
             $allmodules = $this->getAllModules();
             if ($this->requestedVersion >= 3) {
                 $version = 3;
             } else {
                 $version = 2;
                 $homeModuleData = $this->getAllModuleNavigationData();
                 $homeModules = array('primary' => array_keys($homeModuleData['primary']), 'secondary' => array_keys($homeModuleData['secondary']));
             }
             $platform = $this->clientPlatform;
             if ($this->clientPagetype == 'tablet') {
                 $platform .= '-tablet';
             }
             foreach ($allmodules as $moduleID => $module) {
                 if ($module->isEnabled()) {
                     //home is deprecated in lieu of using the "modules" command of the home module
                     $home = false;
                     if ($version < 3) {
                         if (($key = array_search($moduleID, $homeModules['primary'])) !== FALSE) {
                             if (Kurogo::arrayVal($homeModuleData['primary'][$moduleID], 'visible', true)) {
                                 $title = Kurogo::arrayVal($homeModuleData['primary'][$moduleID], 'title', $module->getModuleVar('title'));
                                 $home = array('type' => 'primary', 'order' => $key, 'title' => $title);
                             }
                         } elseif (($key = array_search($moduleID, $homeModules['secondary'])) !== FALSE) {
                             if (Kurogo::arrayVal($homeModuleData['secondary'][$moduleID], 'visible', true)) {
                                 $title = Kurogo::arrayVal($homeModuleData['secondary'][$moduleID], 'title', $module->getModuleVar('title'));
                                 $home = array('type' => 'secondary', 'order' => $key, 'title' => $title);
                             }
                         }
                     }
                     $moduleResponse = array('id' => $module->getID(), 'tag' => $module->getConfigModule(), 'icon' => $module->getOptionalModuleVar('icon', $module->getConfigModule(), 'module'), 'title' => $module->getModuleVar('title', 'module'), 'access' => $module->getAccess(AccessControlList::RULE_TYPE_ACCESS), 'payload' => $module->getPayload(), 'bridge' => $module->getWebBridgeConfig($platform), 'vmin' => $module->getVmin(), 'vmax' => $module->getVmax());
                     if ($version < 3) {
                         $moduleResponse['home'] = $home;
                     }
                     $modules[] = $moduleResponse;
                 }
             }
             $contexts = array();
             foreach (Kurogo::sharedInstance()->getContexts() as $context) {
                 if ($context->isManual()) {
                     $contexts[] = array('id' => $context->getID(), 'title' => $context->getTitle(), 'description' => $context->getDescription());
                 }
             }
             $response = array('timezone' => Kurogo::getSiteVar('LOCAL_TIMEZONE'), 'site' => Kurogo::getSiteString('SITE_NAME'), 'organization' => Kurogo::getSiteString('ORGANIZATION_NAME'), 'version' => KUROGO_VERSION, 'modules' => $modules, 'default' => Kurogo::defaultModule(), 'home' => $this->getHomeModuleID(), 'contexts' => $contexts, 'contextsDisplay' => array('home' => Kurogo::getSiteVar('USER_CONTEXT_LIST_STYLE_NATIVE', 'contexts'), 'customize' => Kurogo::getSiteVar('USER_CONTEXT_LIST_STYLE_CUSTOMIZE', 'contexts')));
             if ($appData = Kurogo::getAppData($this->clientPlatform)) {
                 if ($version = Kurogo::arrayVal($appData, 'version')) {
                     if (version_compare($this->clientVersion, $version) < 0) {
                         $response['appdata'] = array('url' => Kurogo::arrayVal($appData, 'url'), 'version' => Kurogo::arrayVal($appData, 'version'));
                     }
                 }
             }
             $this->setResponse($response);
             $this->setResponseVersion($version);
             break;
         case 'setcontext':
             $context = $this->getArg('context');
             $response = Kurogo::sharedInstance()->setUserContext($context);
             $this->setResponse($response);
             $this->setResponseVersion(1);
             break;
         case 'classify':
             $userAgent = $this->getArg('useragent');
             if (!$userAgent) {
                 throw new KurogoException("useragent parameter not specified");
             }
             $response = Kurogo::deviceClassifier()->classifyUserAgent($userAgent);
             $this->setResponse($response);
             $this->setResponseVersion(1);
             break;
         default:
             $this->invalidCommand();
             break;
     }
 }
开发者ID:sponto,项目名称:msbm-mobile,代码行数:77,代码来源:KurogoAPIModule.php

示例3: deepStripSlashes

// undo magic_quotes_gpc if set. It really shouldn't be. Stop using it.
if (get_magic_quotes_gpc()) {
    function deepStripSlashes($v)
    {
        return is_array($v) ? array_map('deepStripSlashes', $v) : stripslashes($v);
    }
    $args = deepStripslashes($args);
}
/* if the path is "empty" route to the default page. Will search the config file in order:
 * DEFAULT-PAGETYPE-PLATFORM
 * DEFAULT-PAGETYPE
 * DEFAULT
 * home is the default
 */
if (!strlen($path) || $path == '/') {
    $url = Kurogo::defaultModule();
    if (!preg_match("/^http/", $url)) {
        $url = URL_PREFIX . $url . "/";
    }
    Kurogo::redirectToURL($url, Kurogo::REDIRECT_PERMANENT);
}
$parts = explode('/', ltrim($path, '/'), 2);
if ($parts[0] == API_URL_PREFIX) {
    if (Kurogo::getSiteVar('PRODUCTION_ERROR_HANDLER_ENABLED')) {
        set_exception_handler("exceptionHandlerForProductionAPI");
    } else {
        set_exception_handler("exceptionHandlerForAPI");
    }
    $parts = explode('/', ltrim($path, '/'));
    switch (count($parts)) {
        case 1:
开发者ID:nncsang,项目名称:Kurogo,代码行数:31,代码来源:index.php


注:本文中的Kurogo::defaultModule方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。