本文整理汇总了PHP中Navigation::setLanguageId方法的典型用法代码示例。如果您正苦于以下问题:PHP Navigation::setLanguageId方法的具体用法?PHP Navigation::setLanguageId怎么用?PHP Navigation::setLanguageId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Navigation
的用法示例。
在下文中一共展示了Navigation::setLanguageId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: indexAction
/**
* indexAction
* @author Cornelius Hansjakob <cha@massiveart.com>
* @version 1.0
*/
public function indexAction()
{
$this->view->addFilter('PageReplacer');
/**
* get domain
*/
$strDomain = $_SERVER['SERVER_NAME'];
/**
* get uri
*/
$strUrl = $_SERVER['REQUEST_URI'];
if (preg_match('/^\\/[a-zA-Z]{2}\\//', $strUrl)) {
preg_match('/^\\/[a-zA-Z]{2}\\//', $strUrl, $arrMatches);
$this->strLanguageCode = trim($arrMatches[0], '/');
foreach ($this->core->webConfig->languages->language->toArray() as $arrLanguage) {
if (array_key_exists('code', $arrLanguage) && $arrLanguage['code'] == strtolower($this->strLanguageCode)) {
$this->intLanguageId = $arrLanguage['id'];
break;
}
}
if ($this->intLanguageId == null) {
$this->intLanguageId = $this->core->sysConfig->languages->default->id;
$this->strLanguageCode = $this->core->sysConfig->languages->default->code;
}
$strUrl = preg_replace('/^\\/[a-zA-Z]{2}\\//', '', $strUrl);
} else {
$strUrl = preg_replace('/^\\//', '', $strUrl);
$this->intLanguageId = $this->core->sysConfig->languages->default->id;
$this->strLanguageCode = $this->core->sysConfig->languages->default->code;
}
$this->getModelUrls();
$this->getModelFolders();
$objTheme = $this->objModelFolders->getThemeByDomain($strDomain)->current();
$this->objUrlsData = $this->objModelUrls->loadByUrl($objTheme->idRootLevels, parse_url($strUrl, PHP_URL_PATH) === null ? '' : parse_url($strUrl, PHP_URL_PATH));
if (count($this->objUrlsData) > 0) {
$objUrlData = $this->objUrlsData->current();
switch ($objUrlData->idUrlTypes) {
// UrlType: Widget
case $this->core->sysConfig->url_types->widget:
$objWidget = new Widget();
$this->getModelWidgets();
$objWidgetInstance = $this->objModelWidgets->loadWidgetByInstanceId($objUrlData->relationId);
$objWidget->setWidgetInstanceId($objUrlData->relationId);
$this->_getParam('do') == null ? $objWidget->setAction('index') : $objWidget->setAction($this->_getParam('do'));
$objWidget->setWidgetName($objWidgetInstance->name);
$objWidget->setNavigationUrl(parse_url($strUrl, PHP_URL_PATH) === null ? '' : parse_url($strUrl, PHP_URL_PATH));
$objWidget->setWidgetTitle($objWidgetInstance->title);
$objWidget->setRootLevelTitle($objTheme->title);
$objWidget->setRootLevelId($objTheme->idRootLevels);
$objWidget->setWidgetVersion($objUrlData->version);
$objWidget->setLanguageId($objUrlData->idLanguages);
$objWidget->setLanguageCode($this->strLanguageCode);
$objWidget->setUrlParentId($objUrlData->idParent);
Zend_Registry::set('Widget', $objWidget);
$this->_forward($objWidget->getAction(), 'index', $objWidgetInstance->name);
break;
// UrlType: SubWidget
// UrlType: SubWidget
case $this->core->sysConfig->url_types->subwidget:
$objWidget = new Widget();
$this->getModelWidgets();
$objWidgetInstance = $this->objModelWidgets->loadSubWidgetByInstanceId($objUrlData->relationId);
$objWidget->setWidgetInstanceId($objUrlData->relationId);
$this->_getParam('do') == null ? $objWidget->setAction('view') : $objWidget->setAction($this->_getParam('do'));
$objWidget->setGenericFormTypesId($objWidgetInstance->idGenericFormTypes);
$objWidget->setGenericFormId($objWidgetInstance->genericFormId);
$objWidget->setGenericFormVersion($objWidgetInstance->version);
$objWidget->setWidgetName($objWidgetInstance->name);
$objWidget->setNavigationUrl(parse_url($strUrl, PHP_URL_PATH) === null ? '' : parse_url($strUrl, PHP_URL_PATH));
$objWidget->setWidgetTitle($objWidgetInstance->title);
$objWidget->setRootLevelTitle($objTheme->title);
$objWidget->setRootLevelId($objTheme->idRootLevels);
$objWidget->setWidgetVersion($objUrlData->version);
$objWidget->setLanguageId($objUrlData->idLanguages);
$objWidget->setLanguageCode($this->strLanguageCode);
Zend_Registry::set('Widget', $objWidget);
$this->_forward($objWidget->getAction(), 'index', $objWidgetInstance->name);
break;
// Url Type: page
// Url Type: page
case $this->core->sysConfig->url_types->page:
$arrFrontendOptions = array('lifetime' => 604800, 'automatic_serialization' => true);
$arrBackendOptions = array('cache_dir' => GLOBAL_ROOT_PATH . 'tmp/cache/pages/');
// getting a Zend_Cache_Core object
$this->objCache = Zend_Cache::factory('Output', 'File', $arrFrontendOptions, $arrBackendOptions);
$strCacheId = 'page_' . $this->strLanguageCode . '_' . preg_replace('/[^a-zA-Z0-9_]/', '_', $strUrl);
if ($this->core->sysConfig->cache->page == 'false' || $this->core->sysConfig->cache->page == 'true' && $this->objCache->test($strCacheId) == false || $this->core->sysConfig->cache->page == 'true' && isset($_SESSION['sesTestMode'])) {
$objNavigation = new Navigation();
$objNavigation->setRootLevelId($objTheme->idRootLevels);
$objNavigation->setLanguageId($this->intLanguageId);
require_once dirname(__FILE__) . '/../helpers/navigation.inc.php';
Zend_Registry::set('Navigation', $objNavigation);
$this->getModelPages();
$this->objUrlsData = $this->objModelPages->loadByUrl($objTheme->idRootLevels, $strUrl);
foreach ($this->objUrlsData as $objPageData) {
//.........这里部分代码省略.........
示例2: generate
/**
* generate
* @return void
*/
public function generate()
{
$this->core->logger->debug('massiveart->website->sitemap->generate()');
$objRootLevels = $this->getModelFolders()->loadAllRootLevels($this->core->sysConfig->modules->cms);
if (count($objRootLevels) > 0) {
foreach ($objRootLevels as $objRootLevel) {
$objRootLevelLanguages = $this->getModelFolders()->loadRootLevelLanguages($objRootLevel->id);
$strUrl = $this->getModelFolders()->getRootLevelMainUrl($objRootLevel->id, $this->core->sysConfig->environments->production);
if ($strUrl != '') {
$arrUrlParts = explode('.', $strUrl);
if (count($arrUrlParts) == 2) {
$strUrl = str_replace('http://', 'http://www.', $strUrl);
}
// init sitempa xml
$this->initXml($strUrl);
foreach ($objRootLevelLanguages as $objRootLevelLanguage) {
$objNavigation = new Navigation();
$objNavigation->setRootLevelId($objRootLevel->id);
$objNavigation->setLanguageId($objRootLevelLanguage->id);
$this->addXmlUrlsetChilds($objNavigation->loadSitemap(), $strUrl, strtolower($objRootLevelLanguage->languageCode));
}
// svae xml now
$this->saveXml();
}
}
}
}
示例3: postDispatch
/**
* Post-dispatch routines. Called _before_ widget action method
* and is used to set widget specific information. This method also
* reset the ScriptPath with current theme path.
*
* @return void
* @author Florian Mathis <flo@massiveart.com>
* @version 1.0
*/
public function postDispatch()
{
//FIXME: Front- and Backend-Options? Cache?
$objNavigation = new Navigation();
$objNavigation->setRootLevelId($this->objTheme->idRootLevels);
$objNavigation->setLanguageId($this->intLanguageId);
require_once GLOBAL_ROOT_PATH . $this->core->sysConfig->path->zoolu_website . 'default/helpers/navigation.inc.php';
Zend_Registry::set('Navigation', $objNavigation);
$this->objWidget->setTemplateFile($this->strTemplateFile);
/**
* set values for replacers
*/
Zend_Registry::set('WidgetCss', $this->getThemeCssFiles());
Zend_Registry::set('WidgetJs', $this->getThemeJsFiles());
Zend_Registry::set('WidgetLink', $this->getThemeLinks());
Zend_Registry::set('Widget', $this->objWidget);
require_once GLOBAL_ROOT_PATH . $this->core->sysConfig->path->zoolu_website . 'default/helpers/widget.inc.php';
$this->loadWidgetHelpers();
$this->view->setScriptPath(GLOBAL_ROOT_PATH . 'public/website/themes/' . $this->objTheme->path . '/');
if ($this->blnRenderMaster) {
$this->renderScript('master.php');
} else {
$this->renderScript('empty.php');
}
}
示例4: indexAction
/**
* indexAction
* @author Cornelius Hansjakob <cha@massiveart.com>
* @version 1.0
*/
public function indexAction()
{
$this->view->addFilter('PageReplacer');
/**
* get uri
*/
$strUrl = $_SERVER['REQUEST_URI'];
if (preg_match('/^\\/[a-zA-Z\\-]{2,5}\\//', $strUrl)) {
$strUrl = preg_replace('/^\\/[a-zA-Z\\-]{2,5}\\//', '', $strUrl);
} else {
$strUrl = preg_replace('/^\\//', '', $strUrl);
}
// load theme
$this->loadTheme();
// check portal security
$this->checkPortalSecuirty();
// validate language
$this->validateLanguage();
// set translate
$this->setTranslate();
// init page cache
$this->initPageCache($strUrl);
/**
* check if "q" param is in the url for the search
*/
if (strpos($strUrl, '?q=') !== false) {
$this->blnSearch = true;
$strUrl = '';
}
// check, if cached page exists
if ($this->core->sysConfig->cache->page == 'false' || $this->core->sysConfig->cache->page == 'true' && $this->objCache->test($this->strCacheId) == false || $this->core->sysConfig->cache->page == 'true' && isset($_SESSION['sesTestMode'])) {
$this->getModelUrls();
$this->getModelPages();
if (file_exists(GLOBAL_ROOT_PATH . 'client/website/navigation.class.php')) {
require_once GLOBAL_ROOT_PATH . 'client/website/navigation.class.php';
$objNavigation = new Client_Navigation();
} else {
$objNavigation = new Navigation();
}
$objNavigation->setRootLevelId($this->objTheme->idRootLevels);
$objNavigation->setLanguageId($this->intLanguageId);
if (file_exists(GLOBAL_ROOT_PATH . 'public/website/themes/' . $this->objTheme->path . '/helpers/NavigationHelper.php')) {
require_once GLOBAL_ROOT_PATH . 'public/website/themes/' . $this->objTheme->path . '/helpers/NavigationHelper.php';
$strNavigationHelper = ucfirst($this->objTheme->path) . '_NavigationHelper';
$objNavigationHelper = new $strNavigationHelper();
} else {
require_once dirname(__FILE__) . '/../helpers/NavigationHelper.php';
$objNavigationHelper = new NavigationHelper();
}
$objNavigationHelper->setNavigation($objNavigation);
$objNavigationHelper->setTranslate($this->translate);
Zend_Registry::set('NavigationHelper', $objNavigationHelper);
$objUrl = $this->objModelUrls->loadByUrl($this->objTheme->idRootLevels, parse_url($strUrl, PHP_URL_PATH) === null ? '' : parse_url($strUrl, PHP_URL_PATH));
if (isset($objUrl->url) && count($objUrl->url) > 0) {
$objUrlData = $objUrl->url->current();
// check if url is main
if (!$objUrlData->isMain) {
$objMainUrl = $this->objModelUrls->loadUrl($objUrlData->relationId, $objUrlData->version, $objUrlData->idUrlTypes);
if (count($objMainUrl) > 0) {
$objMainUrl = $objMainUrl->current();
$this->getResponse()->setHeader('HTTP/1.1', '301 Moved Permanently');
$this->getResponse()->setHeader('Status', '301 Moved Permanently');
$this->getResponse()->setHttpResponseCode(301);
$this->_redirect('/' . strtolower($objMainUrl->languageCode) . '/' . $objMainUrl->url);
}
}
if ($this->core->sysConfig->cache->page == 'true' && !isset($_SESSION['sesTestMode']) && $this->blnSearch == false && (!isset($_POST) || count($_POST) == 0)) {
$this->objCache->start($this->strCacheId);
$this->blnCachingStart = true;
}
if (file_exists(GLOBAL_ROOT_PATH . 'client/website/page.class.php')) {
require_once GLOBAL_ROOT_PATH . 'client/website/page.class.php';
$this->objPage = new Client_Page();
} else {
$this->objPage = new Page();
}
$this->objPage->setRootLevelId($this->objTheme->idRootLevels);
$this->objPage->setRootLevelTitle($this->core->blnIsDefaultLanguage === true ? $this->objTheme->defaultTitle : $this->objTheme->title);
$this->objPage->setRootLevelGroupId($this->objTheme->idRootLevelGroups);
$this->objPage->setPageId($objUrlData->relationId);
$this->objPage->setPageVersion($objUrlData->version);
$this->objPage->setLanguageId($objUrlData->idLanguages);
switch ($objUrlData->idUrlTypes) {
case $this->core->sysConfig->url_types->page:
$this->objPage->setType('page');
$this->objPage->setModelSubPath('cms/models/');
break;
case $this->core->sysConfig->url_types->global:
$this->objPage->setType('global');
$this->objPage->setModelSubPath('global/models/');
$this->objPage->setElementLinkId($objUrlData->idLink);
$this->objPage->setNavParentId($objUrlData->idLinkParent);
$this->objPage->setPageLinkId($objUrlData->linkId);
break;
}
//.........这里部分代码省略.........