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


PHP Session::language方法代码示例

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


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

示例1: filterByDisplayLanguage

 public function filterByDisplayLanguage($sLanguageId = null)
 {
     if ($sLanguageId === null) {
         $sLanguageId = Session::language();
     }
     return $this->filterByLanguageId(null, Criteria::ISNULL)->_or()->filterByLanguageId(Session::language());
 }
开发者ID:rapila,项目名称:cms-base,代码行数:7,代码来源:DocumentQuery.php

示例2: renderFrontend

 public function renderFrontend()
 {
     $aData = unserialize($this->getData());
     $oTemplate = new Template($aData['template']);
     $oItemTemplatePrototype = new Template($aData['template'] . '_item');
     $bItemFound = false;
     // FIXME: Keep track of output $oCorrespondingItems and refuse output if already done
     foreach ($aData['tags'] as $iTagID) {
         $oTag = TagQuery::create()->findPk($iTagID);
         if ($oTag === null) {
             continue;
         }
         $aCorrespondingItems = $oTag->getAllCorrespondingDataEntries($aData['types']);
         foreach ($aCorrespondingItems as $i => $oCorrespondingItem) {
             if (!method_exists($oCorrespondingItem, 'renderListItem')) {
                 return;
             }
             if (!$oCorrespondingItem->shouldBeIncludedInList(Session::language(), FrontendManager::$CURRENT_PAGE)) {
                 continue;
             }
             $bItemFound = true;
             $oItemTemplate = clone $oItemTemplatePrototype;
             $oItemTemplate->replaceIdentifier('model', get_class($oCorrespondingItem));
             $oItemTemplate->replaceIdentifier('counter', $i + 1);
             $oCorrespondingItem->renderListItem($oItemTemplate);
             $oTemplate->replaceIdentifierMultiple("items", $oItemTemplate);
         }
     }
     if (!$bItemFound) {
         return null;
     }
     return $oTemplate;
 }
开发者ID:rapila,项目名称:cms-base,代码行数:33,代码来源:TagFrontendModule.php

示例3: filterApprovedForLanguage

 public function filterApprovedForLanguage($sLanguageId = null)
 {
     $sLanguageId = $sLanguageId === null ? Session::language() : $sLanguageId;
     $this->condition('language_null', 'Newsletter.LanguageId is null');
     $this->condition('language_' . $sLanguageId, 'Newsletter.LanguageId = ?', $sLanguageId);
     return $this->filterByIsApproved(true)->where(array('language_null', 'language_' . $sLanguageId), Criteria::LOGICAL_OR);
 }
开发者ID:rapila,项目名称:plugin-newsletter,代码行数:7,代码来源:NewsletterQuery.php

示例4: __construct

 public function __construct($sSessionKey = null, $sModuleContents = null, $mModuleSettings = null)
 {
     parent::__construct($sSessionKey);
     $this->sModuleContents = $sModuleContents;
     if ($mModuleSettings === null || is_string($mModuleSettings)) {
         $this->aModuleSettings = Settings::getSetting('text_module', null, array());
         if ($mModuleSettings !== null) {
             $this->aModuleSettings = array_merge($this->aModuleSettings, Settings::getSetting($mModuleSettings, 'text_module', array()));
         }
     } else {
         $this->aModuleSettings = $mModuleSettings;
     }
     $this->cleanupCss();
     $this->cleanupStyles();
     $this->cleanupFormatTags();
     $this->cleanupInsertableParts();
     $this->cleanupToolbar();
     foreach ($this->aModuleSettings as $sKey => $mSetting) {
         $this->setSetting($sKey, $mSetting);
     }
     // let CKEDITOR find plugins
     $aPlugins = array();
     foreach (ResourceFinder::create()->addPath(DIRNAME_WEB, ResourceIncluder::RESOURCE_TYPE_JS, 'widget', 'ckeditor-plugins')->addDirPath()->addRecursion()->addPath('plugin.js')->returnObjects()->find() as $oPluginPath) {
         $oPluginPath = $oPluginPath->parent();
         $aPlugins[$oPluginPath->getFileName()] = $oPluginPath->getFrontendPath() . '/';
     }
     if (count($aPlugins) === 0) {
         $aPlugins = null;
     }
     $this->setSetting('additional_plugin_paths', $aPlugins);
     $this->setSetting('language', Session::language());
 }
开发者ID:rapila,项目名称:cms-base,代码行数:32,代码来源:RichTextWidgetModule.php

示例5: getCreatedAtLocalized

 public function getCreatedAtLocalized($sFormat = ' %e. %B %Y')
 {
     if (Session::language() === 'en') {
         $sFormat = ' %e %B %Y';
     }
     return LocaleUtil::localizeDate($this->created_at, null, $sFormat);
 }
开发者ID:rapila,项目名称:plugin-journal,代码行数:7,代码来源:JournalComment.php

示例6: renderFile

 public function renderFile()
 {
     $oDocument = new DOMDocument();
     $oRoot = $oDocument->createElement("rss");
     $oRoot->setAttribute('version', "2.0");
     $oDocument->appendChild($oRoot);
     $oChannel = $oDocument->createElement("channel");
     /**
      * @todo parametrize the argument
      */
     $oQuery = FrontendJournalEntryQuery::create()->mostRecentFirst()->limit(10);
     if ($this->aJournalIds) {
         $oQuery->filterByJournalId($this->aJournalIds);
     }
     self::addSimpleAttribute($oDocument, $oChannel, 'title', $this->oJournalPage->getPageTitle());
     self::addSimpleAttribute($oDocument, $oChannel, 'description', $this->oJournalPage->getDescription());
     self::addSimpleAttribute($oDocument, $oChannel, 'link', LinkUtil::absoluteLink(LinkUtil::link($this->oJournalPage->getFullPathArray(), 'FrontendManager'), null, LinkUtil::isSSL()));
     self::addSimpleAttribute($oDocument, $oChannel, 'language', Session::language());
     self::addSimpleAttribute($oDocument, $oChannel, 'ttl', "15");
     $oRoot->appendChild($oChannel);
     $aJournalEntries = $oQuery->find();
     foreach ($aJournalEntries as $oJournalEntry) {
         $oItem = $oDocument->createElement('item');
         foreach ($oJournalEntry->getRssAttributes($this->aJournalIds ? $this->oJournalPage : null) as $sAttributeName => $mAttributeValue) {
             self::attributeToNode($oDocument, $oItem, $sAttributeName, $mAttributeValue);
         }
         $oChannel->appendChild($oItem);
     }
     print $oDocument->saveXML();
 }
开发者ID:rapila,项目名称:plugin-journal,代码行数:30,代码来源:JournalFileModule.php

示例7: __construct

 public function __construct($sSetting = null, $bPrintDoctype = true, $sClassName = null, $sLanguage = null)
 {
     $this->sContentType = "text/html";
     if ($sLanguage === null) {
         $sLanguage = Session::language();
     }
     $this->sLanguage = $sLanguage;
     $this->sCharset = Settings::getSetting("encoding", "browser", "utf-8");
     $this->sSetting = $sSetting;
     $this->bPrintDoctype = $bPrintDoctype;
     $this->sClassName = $sClassName;
     if ($this->sSetting === null) {
         $this->sSetting = Settings::getSetting('frontend', 'doctype', 'none');
     }
     if ($this->sSetting === self::SETTING_NONE || $this->sSetting === self::SETTING_HTML_4_STRICT || $this->sSetting === self::SETTING_HTML_4_TRANSITIONAL || $this->sSetting === self::SETTING_HTML_5) {
         return;
     }
     if (@stristr(@$_SERVER["HTTP_ACCEPT"], "application/xhtml+xml")) {
         if (preg_match("/application\\/xhtml\\+xml;q=([01]|0\\.\\d{1,3}|1\\.0)/i", $_SERVER["HTTP_ACCEPT"], $matches)) {
             $xhtml_q = $matches[1];
             if (preg_match("/text\\/html;q=([01]|0\\.\\d{1,3}|1\\.0)/i", $_SERVER["HTTP_ACCEPT"], $matches)) {
                 $html_q = $matches[1];
                 if ((double) $xhtml_q >= (double) $html_q) {
                     $this->sContentType = "application/xhtml+xml";
                 }
             }
         } else {
             $this->sContentType = "application/xhtml+xml";
         }
     }
 }
开发者ID:rapila,项目名称:cms-base,代码行数:31,代码来源:XHTMLOutput.php

示例8: getConsolidatedKeywords

 public function getConsolidatedKeywords($sLanguageId = null, $bReturnArray = false)
 {
     if ($sLanguageId == null) {
         $sLanguageId = Session::language();
     }
     $aKeywords = array();
     $aKeywords[] = TranslationPeer::getString('meta.keywords', null, '');
     $aTags = TagPeer::tagInstancesForObject($this);
     foreach ($aTags as $iKey => $oTag) {
         $aTags[$iKey] = $oTag->getTag()->getName();
     }
     $aKeywords[] = $aTags;
     $aKeywords[] = Settings::getSetting('frontend', 'keywords', '');
     $aKeywords[] = $this->getActivePageString()->getMetaKeywords();
     $aResult = array();
     foreach ($aKeywords as $iKey => $mKeywords) {
         if (!is_array($mKeywords)) {
             $mKeywords = explode(',', $mKeywords);
         }
         foreach ($mKeywords as $sKeyword) {
             $sKeyword = trim($sKeyword);
             if (!isset($aResult[$sKeyword]) && $sKeyword !== '') {
                 $aResult[$sKeyword] = true;
             }
         }
     }
     if ($bReturnArray) {
         return array_keys($aResult);
     }
     return implode(', ', array_keys($aResult));
 }
开发者ID:rapila,项目名称:cms-base,代码行数:31,代码来源:Page.php

示例9: deleteRow

 public function deleteRow($aRowData, $oCriteria)
 {
     $oLanguage = LanguagePeer::doSelectOne($oCriteria);
     if ($oLanguage->getIsDefault()) {
         throw new LocalizedException('wns.language.delete_default.denied');
     }
     if ($oLanguage->getIsDefaultEdit()) {
         throw new LocalizedException('wns.language.delete_default.denied');
     }
     if (LanguagePeer::doCount(new Criteria()) < 2) {
         throw new LocalizedException('wns.language.delete_last.denied');
     }
     $sLanguageId = $oLanguage->getId();
     foreach (LanguageObjectQuery::create()->filterByLanguageId($sLanguageId)->find() as $oLanguageObject) {
         $oHistory = $oLanguageObject->newHistory();
         $oHistory->save();
         $oLanguageObject->delete();
     }
     $iResult = $oLanguage->delete();
     $oReplacementLanguage = LanguageQuery::create()->findOne();
     if (AdminManager::getContentLanguage() === $sLanguageId) {
         AdminManager::setContentLanguage(Settings::getSetting("session_default", AdminManager::CONTENT_LANGUAGE_SESSION_KEY, $oReplacementLanguage->getId()));
     }
     if (Session::language() === $sLanguageId) {
         Session::getSession()->setLanguage(Settings::getSetting("session_default", Session::SESSION_LANGUAGE_KEY, $oReplacementLanguage->getId()));
     }
 }
开发者ID:rapila,项目名称:cms-base,代码行数:27,代码来源:LanguageListWidgetModule.php

示例10: renderFile

 public function renderFile()
 {
     header("Content-Type: application/json;charset=utf-8");
     $aRequest = array();
     $sContentType = 'application/x-www-form-urlencoded';
     if (isset($_SERVER['CONTENT_TYPE'])) {
         $sContentType = $_SERVER['CONTENT_TYPE'];
     }
     if (isset($_SERVER['HTTP_CONTENT_TYPE'])) {
         $sContentType = $_SERVER['HTTP_CONTENT_TYPE'];
     }
     if (StringUtil::startsWith($sContentType, 'application/json')) {
         $aRequest = json_decode(file_get_contents('php://input'), true);
     } else {
         foreach ($_REQUEST as $sKey => $sValue) {
             $aRequest[$sKey] = json_decode($sValue, true);
         }
     }
     $oSession = Session::getSession();
     if (!isset($aRequest['session_language']) && $oSession->isAuthenticated()) {
         $aRequest['session_language'] = $oSession->getUser()->getLanguageId();
     }
     $sPrevSessionLanguage = null;
     $sSetSessionLanguage = null;
     if (isset($aRequest['session_language'])) {
         $sPrevSessionLanguage = Session::language();
         $sSetSessionLanguage = $aRequest['session_language'];
         $oSession->setLanguage($sSetSessionLanguage);
     }
     try {
         try {
             $mJSONData = $this->getJSON($aRequest);
             $sResult = json_encode($mJSONData);
             $iError = json_last_error();
             if ($iError !== JSON_ERROR_NONE) {
                 throw new LocalizedException('wns.error.json', array('json_error' => $iError, 'json_error_message' => self::$JSON_ERRORS[$iError]));
             }
             print $sResult;
         } catch (Exception $e) {
             //Handle the gift, not the wrapping…
             if ($e->getPrevious()) {
                 throw $e->getPrevious();
             } else {
                 throw $e;
             }
         }
     } catch (LocalizedException $ex) {
         LinkUtil::sendHTTPStatusCode(500, 'Server Error');
         print json_encode(array('exception' => array('message' => $ex->getLocalizedMessage(), 'code' => $ex->getCode(), 'file' => $ex->getFile(), 'line' => $ex->getLine(), 'trace' => $ex->getTrace(), 'parameters' => $ex->getMessageParameters(), 'exception_type' => $ex->getExceptionType())));
     } catch (Exception $ex) {
         LinkUtil::sendHTTPStatusCode(500, 'Server Error');
         ErrorHandler::handleException($ex, true);
         print json_encode(array('exception' => array('message' => "Exception when trying to execute the last action {$ex->getMessage()}", 'code' => $ex->getCode(), 'file' => $ex->getFile(), 'line' => $ex->getLine(), 'trace' => $ex->getTrace(), 'exception_type' => get_class($ex))));
     }
     //If we changed the session language and no widget willfully changed it as well, reset it to the previous state
     if ($sPrevSessionLanguage !== null && Session::language() === $sSetSessionLanguage) {
         $oSession->setLanguage($sPrevSessionLanguage);
     }
 }
开发者ID:rapila,项目名称:cms-base,代码行数:59,代码来源:WidgetJsonFileModule.php

示例11: display

 public function display(Template $oTemplate, $bIsPreview = false)
 {
     $sTemplateName = $this->oPage->getTemplateNameUsed();
     $sLanguageId = Session::language();
     $oListTemplate = null;
     $oItemTemplatePrototype = null;
     try {
         $oListTemplate = new Template("search_results/{$sTemplateName}");
         $oItemTemplatePrototype = new Template("search_results/{$sTemplateName}_item");
     } catch (Exception $e) {
         $oListTemplate = new Template("search_results/default");
         $oItemTemplatePrototype = new Template("search_results/default_item");
     }
     $aResults = array();
     $sWords = isset($_REQUEST['q']) ? $_REQUEST['q'] : '';
     if ($sWords) {
         $aWords = StringUtil::getWords($sWords, false, '%');
         $oSearchWordQuery = SearchIndexWordQuery::create();
         foreach ($aWords as $sWord) {
             $sWord = Synonyms::rootFor($sWord);
             $sComparison = Criteria::EQUAL;
             if (strpos($sWord, '%') !== false) {
                 $sComparison = Criteria::LIKE;
             }
             $oSearchWordQuery->addOr(SearchIndexWordPeer::WORD, $sWord, $sComparison);
         }
         $oSearchWordQuery->joinSearchIndex()->useQuery('SearchIndex')->joinPage()->useQuery('Page')->active(true)->filterByIsProtected(false)->endUse()->endUse();
         foreach ($oSearchWordQuery->find() as $oSearchIndexWord) {
             $iId = $oSearchIndexWord->getSearchIndexId();
             if (isset($aResults[$iId])) {
                 $aResults[$iId] += $oSearchIndexWord->getCount();
             } else {
                 $aResults[$iId] = $oSearchIndexWord->getCount();
             }
         }
         arsort($aResults);
     }
     $oListTemplate->replaceIdentifier('count', count($aResults));
     $oListTemplate->replaceIdentifier('search_string', $sWords);
     if (count($aResults) === 0) {
         $oListTemplate->replaceIdentifier('no_results', TranslationPeer::getString('wns.search.no_results', null, null, array('search_string' => $sWords)));
     }
     foreach ($aResults as $iIndexId => $iCount) {
         $oIndex = SearchIndexQuery::create()->findPk(array($iIndexId, $sLanguageId));
         if (!$oIndex || !$oIndex->getPage()) {
             continue;
         }
         $oItemTemplate = clone $oItemTemplatePrototype;
         $oIndex->renderListItem($oItemTemplate);
         $oItemTemplate->replaceIdentifier('count', $iCount);
         $oListTemplate->replaceIdentifierMultiple('items', $oItemTemplate);
     }
     $oTemplate->replaceIdentifier('search_results', $oListTemplate);
 }
开发者ID:rapila,项目名称:plugin-full_text_search,代码行数:54,代码来源:SearchResultPageTypeModule.php

示例12: array

 private static function &rootWords($sLanguageId = null)
 {
     self::init();
     if ($sLanguageId === null) {
         $sLanguageId = Session::language();
     }
     if (!isset(self::$ROOT_WORDS[$sLanguageId])) {
         self::$ROOT_WORDS[$sLanguageId] = array();
     }
     return self::$ROOT_WORDS[$sLanguageId];
 }
开发者ID:rapila,项目名称:plugin-full_text_search,代码行数:11,代码来源:Synonyms.php

示例13: getLanguageObject

 public function getLanguageObject($sLanguageId = null)
 {
     if ($sLanguageId === null) {
         $sLanguageId = Session::language();
     }
     $oResult = $this->getLanguageObjectsByLanguage($sLanguageId);
     if (count($oResult) === 0) {
         return null;
     }
     return $oResult[0];
 }
开发者ID:rapila,项目名称:cms-base,代码行数:11,代码来源:ContentObject.php

示例14: partFor

 public function partFor($sDocumentationPartKey)
 {
     $oResult = new stdClass();
     $aData = DocumentationProviderTypeModule::dataForPart($sDocumentationPartKey, Session::language());
     if (!$aData) {
         throw new LocalizedException("wns.documentation.unknown", array('key' => $sDocumentationPartKey, 'language' => Session::language()));
     }
     $oResult->title = $aData['title'];
     $oResult->content = $aData['content'];
     $oResult->url = $aData['url'];
     return $oResult;
 }
开发者ID:rapila,项目名称:cms-base,代码行数:12,代码来源:DocumentationDisplayWidgetModule.php

示例15: display

 public function display(Template $oTemplate, $bIsPreview = false)
 {
     $this->bIsPreview = $bIsPreview;
     if ($this->bIsPreview) {
         ResourceIncluder::defaultIncluder()->addResource('preview/jquery.ba-resize.min.js');
     }
     if ($this->sLanguageId === null) {
         $this->sLanguageId = $this->bIsPreview ? AdminManager::getContentLanguage() : Session::language();
     }
     $this->oFrontendTemplate = $oTemplate;
     $this->iModuleId = 1;
     $this->oFrontendTemplate->replaceIdentifierCallback("container", $this, "fillContainer", Template::NO_HTML_ESCAPE);
 }
开发者ID:rapila,项目名称:cms-base,代码行数:13,代码来源:DefaultPageTypeModule.php


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