本文整理汇总了PHP中Kurogo::getOptionalSiteString方法的典型用法代码示例。如果您正苦于以下问题:PHP Kurogo::getOptionalSiteString方法的具体用法?PHP Kurogo::getOptionalSiteString怎么用?PHP Kurogo::getOptionalSiteString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kurogo
的用法示例。
在下文中一共展示了Kurogo::getOptionalSiteString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAdminData
private function getAdminData($type, $section, $subsection = null)
{
if ($type == 'site') {
$configData = $this->getSiteAdminConfig();
$module = $this;
} elseif ($type instanceof Module) {
$configData = $type->getModuleAdminConfig();
$module = $type;
} else {
throw new KurogoConfigurationException("Invalid type {$type}");
}
if (!isset($configData[$section])) {
throw new KurogoConfigurationException("Invalid section {$section}");
}
$sectionData = $configData[$section];
if ($subsection) {
if (!isset($configData[$section]['sections'][$subsection])) {
throw new KurogoConfigurationException("Invalid subsection {$subsection} for section {$section}");
}
$sectionData = $configData[$section]['sections'][$subsection];
}
$sectionData['section'] = $section;
if (isset($sectionData['titleKey'])) {
$sectionData['title'] = $module->getLocalizedString($sectionData['titleKey']);
unset($sectionData['titleKey']);
}
if (isset($sectionData['descriptionKey'])) {
$sectionData['description'] = $module->getLocalizedString($sectionData['descriptionKey']);
unset($sectionData['descriptionKey']);
}
if (isset($sectionData['fieldgroups'])) {
foreach ($sectionData['fieldgroups'] as $fieldgroup => &$fieldgroupData) {
if (isset($fieldgroupData['labelKey'])) {
$fieldgroupData['label'] = $module->getLocalizedString($fieldgroupData['labelKey']);
unset($fieldgroupData['labelKey']);
}
if (isset($fieldgroupData['descriptionKey'])) {
$fieldgroupData['description'] = $module->getLocalizedString($fieldgroupData['descriptionKey']);
unset($fieldgroupData['descriptionKey']);
}
}
}
switch ($sectionData['sectiontype']) {
case 'fields':
foreach ($sectionData['fields'] as $key => &$field) {
if (isset($field['labelKey'])) {
$field['label'] = $module->getLocalizedString($field['labelKey']);
unset($field['labelKey']);
}
if (isset($field['descriptionKey'])) {
$field['description'] = $module->getLocalizedString($field['descriptionKey']);
unset($field['descriptionKey']);
}
if (isset($field['valueMethod'])) {
$field['value'] = call_user_func(array($module, $field['valueMethod']));
unset($field['valueMethod']);
} elseif (isset($field['valueKey'])) {
$field['value'] = $module->getLocalizedString($field['valueKey']);
unset($field['valueKey']);
} elseif ($type == 'site') {
if (isset($field['config'])) {
switch ($field['config']) {
case 'site':
$field['value'] = Kurogo::getOptionalSiteVar($key, '', $field['section']);
break;
case 'strings':
$field['value'] = Kurogo::getOptionalSiteString($key);
break;
default:
throw new KurogoConfigurationException("Unknown config " . $field['config']);
break;
}
}
} elseif (isset($field['config'], $field['section'])) {
$field['value'] = $module->getOptionalModuleVar($key, isset($field['default']) ? $field['default'] : '', $field['section'], $field['config']);
}
switch ($field['type']) {
case 'paragraph':
if (is_array($field['value'])) {
$field['value'] = implode("\n\n", $field['value']);
}
break;
case 'select':
if (isset($field['optionsMethod'])) {
if (is_array($field['optionsMethod'])) {
$field['options'] = call_user_func($field['optionsMethod']);
} else {
$field['options'] = $module->{$field}['optionsMethod']();
}
unset($field['optionsMethod']);
}
if (isset($field['optionsFirst'])) {
$field['options'] = array_merge(array('' => $field['optionsFirst']), $field['options']);
unset($field['optionsFirst']);
}
}
if (isset($field['value'])) {
$value = $this->getUnconstantedValue($field['value'], $constant);
if ($constant) {
$field['value'] = $value;
//.........这里部分代码省略.........
示例2: assignLocalizedStrings
private function assignLocalizedStrings()
{
$this->assign('footerKurogo', $this->getLocalizedString('FOOTER_KUROGO'));
$this->assign('footerBackToTop', $this->getLocalizedString('FOOTER_BACK_TO_TOP'));
$this->assign('homeLinkText', $this->getLocalizedString('HOME_LINK', Kurogo::getOptionalSiteString('SITE_NAME')));
$this->assign('moduleHomeLinkText', $this->getLocalizedString('HOME_LINK', $this->getModuleName()));
}
示例3: getAdminData
private function getAdminData($type, $section, $subsection = null)
{
if (in_array($type, array('site'))) {
$configData = $this->getSiteAdminConfig($type);
$module = $this;
if (is_null($section)) {
$section = key($configData);
}
} elseif ($type instanceof Module) {
$configData = $type->getModuleAdminConfig();
$module = $type;
} else {
throw new KurogoConfigurationException(__LINE__ . ": Invalid type {$type}");
}
if (!isset($configData[$section])) {
throw new KurogoConfigurationException(__LINE__ . ": Invalid section {$section}");
}
$sectionData = $configData[$section];
if ($subsection) {
if (!isset($configData[$section]['sections'][$subsection])) {
throw new KurogoConfigurationException(__LINE__ . ": Invalid subsection {$subsection} for section {$section}");
}
$sectionData = $configData[$section]['sections'][$subsection];
}
$sectionData['section'] = $section;
if (isset($sectionData['titleKey'])) {
$sectionData['title'] = $module->getLocalizedString($sectionData['titleKey']);
unset($sectionData['titleKey']);
}
if (isset($sectionData['descriptionKey'])) {
$sectionData['description'] = $module->getLocalizedString($sectionData['descriptionKey']);
unset($sectionData['descriptionKey']);
}
if (isset($sectionData['fieldgroups'])) {
foreach ($sectionData['fieldgroups'] as $fieldgroup => &$fieldgroupData) {
if (isset($fieldgroupData['labelKey'])) {
$fieldgroupData['label'] = $module->getLocalizedString($fieldgroupData['labelKey']);
unset($fieldgroupData['labelKey']);
}
if (isset($fieldgroupData['descriptionKey'])) {
$fieldgroupData['description'] = $module->getLocalizedString($fieldgroupData['descriptionKey']);
unset($fieldgroupData['descriptionKey']);
}
}
}
switch ($sectionData['sectiontype']) {
case 'fields':
foreach ($sectionData['fields'] as $key => &$field) {
$_key = isset($field['key']) ? $field['key'] : $key;
if (isset($field['labelKey'])) {
$field['label'] = $module->getLocalizedString($field['labelKey']);
unset($field['labelKey']);
}
if (isset($field['descriptionKey'])) {
$field['description'] = $module->getLocalizedString($field['descriptionKey']);
unset($field['descriptionKey']);
}
if (isset($field['value'])) {
// value is set. used typically for hidden fields
} elseif (isset($field['valueMethod'])) {
if (is_array($field['valueMethod'])) {
$method = array_shift($field['valueMethod']);
$field['value'] = call_user_func_array(array($module, $method), $field['valueMethod']);
} else {
$field['value'] = call_user_func(array($module, $field['valueMethod']));
}
if (is_null($field['value']) && isset($field['default'])) {
$field['value'] = $field['default'];
}
unset($field['valueMethod']);
} elseif (isset($field['valueKey'])) {
$field['value'] = $module->getLocalizedString($field['valueKey']);
unset($field['valueKey']);
} elseif (in_array($type, array('site'))) {
if (isset($field['config'])) {
switch ($field['config']) {
case 'site':
case 'kurogo':
$field['value'] = Kurogo::getOptionalSiteVar($_key, '', $field['section']);
break;
case 'strings':
$field['value'] = Kurogo::getOptionalSiteString($_key);
break;
default:
throw new KurogoConfigurationException(__LINE__ . ": Unknown config " . $field['config']);
break;
}
}
} elseif (isset($field['config'], $field['section'])) {
$field['value'] = $module->getOptionalModuleVar($_key, isset($field['default']) ? $field['default'] : '', $field['section'], $field['config']);
}
switch ($field['type']) {
case 'paragraph':
if (is_array($field['value'])) {
$field['value'] = implode("\n\n", $field['value']);
}
break;
case 'select':
if (isset($field['optionsMethod'])) {
if (is_array($field['optionsMethod'])) {
//.........这里部分代码省略.........
示例4: initializeForPage
protected function initializeForPage()
{
switch ($this->page) {
case 'help':
break;
case 'index':
$this->setPageTitle($this->getOptionalModuleVar('pageTitle', Kurogo::getOptionalSiteString('SITE_NAME'), 'index', 'pages'));
if ($this->pagetype == 'tablet') {
$modulePanes = $this->getTabletModulePanes();
$this->assign('modulePanes', $modulePanes);
$this->addInlineJavascript('var homePortlets = {};');
$this->addOnLoad('loadModulePages(' . json_encode($modulePanes) . ');');
$this->addOnOrientationChange('moduleHandleWindowResize();');
} else {
$this->assign('modules', $this->getAllModuleNavigationData(self::EXCLUDE_HIDDEN_MODULES));
$this->assign('hideImages', $this->getOptionalModuleVar('HIDE_IMAGES', false));
}
if ($this->getOptionalModuleVar('BANNER_ALERT', false, 'notice')) {
$noticeData = $this->getOptionalModuleSection('notice');
if ($noticeData) {
$bannerNotice = null;
// notice can either take a module or data model class or retriever class. The section is passed on. It must implement the HomeAlertInterface interface
if (isset($noticeData['BANNER_ALERT_MODULE'])) {
$moduleID = $noticeData['BANNER_ALERT_MODULE'];
$controller = WebModule::factory($moduleID);
$string = "Module {$moduleID}";
} elseif (isset($noticeData['BANNER_ALERT_MODEL_CLASS'])) {
$controller = DataModel::factory($noticeData['BANNER_ALERT_MODEL_CLASS'], $noticeData);
$string = $noticeData['BANNER_ALERT_MODEL_CLASS'];
} elseif (isset($noticeData['BANNER_ALERT_RETRIEVER_CLASS'])) {
$controller = DataRetriever::factory($noticeData['BANNER_ALERT_RETRIEVER_CLASS'], $noticeData);
$string = $noticeData['BANNER_ALERT_RETRIEVER_CLASS'];
} else {
throw new KurogoConfigurationException("Banner alert not properly configured");
}
if (!$controller instanceof HomeAlertInterface) {
throw new KurogoConfigurationException("{$string} does not implement HomeAlertModule interface");
}
$bannerNotice = $controller->getHomeScreenAlert();
if ($bannerNotice) {
$this->assign('bannerNotice', $bannerNotice);
// is this necessary?
$bannerModule = $this->getOptionalModuleVar('BANNER_ALERT_MODULE_LINK', false, 'notice');
if ($bannerModule) {
$this->assign('bannerURL', $this->buildURLForModule($moduleID, 'index'));
}
}
}
}
if ($this->getOptionalModuleVar('SHOW_FEDERATED_SEARCH', true)) {
$this->assign('showFederatedSearch', true);
$this->assign('placeholder', $this->getLocalizedString("SEARCH_PLACEHOLDER", Kurogo::getOptionalSiteString('SITE_NAME')));
}
if ($this->getPlatform() == 'iphone' && $this->getOptionalModuleVar('ADD_TO_HOME', false)) {
$this->addInternalJavascript('/common/javascript/lib/add2homeConfig.js');
$this->addInternalJavascript('/common/javascript/lib/add2home.js');
$this->addInternalCSS('/common/css/add2home.css');
}
$this->assignUserContexts($this->getOptionalModuleVar('ALLOW_CUSTOMIZE', true));
$this->assignSites();
$this->assign('SHOW_DOWNLOAD_TEXT', Kurogo::getOptionalSiteVar('downloadText', '', $this->platform, 'apps'));
$homeModuleID = $this->getHomeModuleID();
if ($iconSet = $this->getOptionalThemeVar('navigation_icon_set')) {
$iconSetSize = $this->getOptionalThemeVar('navigation_icon_size');
$downloadImgPrefix = "/common/images/iconsets/{$iconSet}/{$iconSetSize}/download";
} else {
$downloadImgPrefix = "/modules/{$homeModuleID}/images/download";
}
$this->assign('downloadImgPrefix', $downloadImgPrefix);
$this->assign('displayType', $this->getModuleVar('display_type'));
$this->addOnLoad('addFormNotEmptyValidator()');
break;
case 'search':
$searchTerms = $this->getArg('filter');
//return home if a blank search was provided.
//client side form validation is in place, but this will work
//for basic devices, as well as those which have javascript disabled.
if (trim($searchTerms) == "") {
$this->redirectTo('index', array());
return;
}
$useAjax = $this->pagetype != 'basic';
$searchModules = array();
if ($this->getOptionalModuleVar('SHOW_FEDERATED_SEARCH', true)) {
$this->assign('showFederatedSearch', true);
foreach ($this->getAllModuleNavigationData(self::EXCLUDE_HIDDEN_MODULES) as $type => $modules) {
foreach ($modules as $id => $info) {
if ($id == 'customize') {
continue;
}
$module = self::factory($id);
if ($module->getOptionalModuleVar('search', false, 'module')) {
$searchModule = array('id' => $id, 'elementId' => 'federatedSearchModule_' . $id, 'title' => $info['title']);
if ($useAjax) {
$searchModule['ajaxURL'] = FULL_URL_PREFIX . ltrim($this->buildURL('searchResult', array('id' => $id, 'filter' => $searchTerms)), '/');
} else {
$searchModule['results'] = $this->runFederatedSearchForModule($module, $searchTerms);
}
$searchModules[] = $searchModule;
}
//.........这里部分代码省略.........