本文整理汇总了PHP中Kurogo::getAppData方法的典型用法代码示例。如果您正苦于以下问题:PHP Kurogo::getAppData方法的具体用法?PHP Kurogo::getAppData怎么用?PHP Kurogo::getAppData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kurogo
的用法示例。
在下文中一共展示了Kurogo::getAppData方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getStaticNotificationContexts
public function getStaticNotificationContexts()
{
$contexts = array();
$appData = Kurogo::getAppData();
foreach ($appData as $platform => $data) {
$version = $data['version'];
$contexts[] = $platform . ':' . $version;
}
return $contexts;
}
示例2: initializeForPage
protected function initializeForPage()
{
//get links from module.ini [links]
$links = $this->getOptionalModuleSection('links');
$this->assign('links', $links);
//get app Data
$appData = Kurogo::getAppData();
$this->assign('appData', $appData);
//get module data from modules.ini
$modulesData = $this->getOptionalModuleSections('modules');
foreach ($modulesData as $moduleID => &$moduleData) {
$moduleData['icon'] = Kurogo::getOptionalModuleVar('icon', $moduleID, $moduleID, 'module', 'module');
}
$this->assign('modulesData', $modulesData);
$args = array();
if (Kurogo::getSiteVar('COMPUTER_TABLET_ENABLED', 'themes')) {
$args['setdevice'] = 'compliant';
}
$previewURL = $this->buildURLForModule($this->getHomeModuleID(), 'index', $args);
$this->assign('previewURL', $previewURL);
}
示例3: 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;
}
}
示例4: executeCommand
/**
* Execute the command. Will call initializeForCommand() which should set the version, error and response
* values appropriately
*/
public function executeCommand()
{
if (empty($this->command)) {
throw new KurogoException("Command not specified");
}
$this->loadResponseIfNeeded();
if ($this->clientBrowser == 'native') {
if ($appData = Kurogo::getAppData($this->clientPlatform)) {
if ($minversion = Kurogo::arrayVal($appData, 'minversion')) {
if (version_compare($this->clientVersion, $minversion) < 0) {
$data = array('url' => Kurogo::arrayVal($appData, 'url'), 'version' => Kurogo::arrayVal($appData, 'version'));
$error = new KurogoError(7, 'Upgrade Required', 'You must upgrade your application');
$error->setData($data);
$this->throwError($error);
}
}
}
}
$this->initializeForCommand();
$json = $this->response->getJSONOutput();
$size = strlen($json);
if ($this->logView) {
$this->logCommand($size);
}
header("Content-Length: " . $size);
header("Content-Type: application/json; charset=utf-8");
echo $json;
exit;
}