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


PHP language\LanguageFactory类代码示例

本文整理汇总了PHP中wcf\system\language\LanguageFactory的典型用法代码示例。如果您正苦于以下问题:PHP LanguageFactory类的具体用法?PHP LanguageFactory怎么用?PHP LanguageFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: __construct

 public function __construct()
 {
     parent::__construct();
     // accessible news categories
     $accessibleCategoryIDs = NewsCategory::getAccessibleCategoryIDs();
     if (!empty($accessibleCategoryIDs)) {
         $this->getConditionBuilder()->add('news.newsID IN (SELECT newsID FROM cms' . WCF_N . '_news_to_category WHERE categoryID IN (?))', array($accessibleCategoryIDs));
     } else {
         $this->getConditionBuilder()->add('1=0');
     }
     //get default settings
     if (!WCF::getSession()->getPermission('mod.cms.news.canModerateNews')) {
         $this->getConditionBuilder()->add('news.isDisabled = 0');
     }
     if (!WCF::getSession()->getPermission('mod.cms.news.canModerateNews')) {
         $this->getConditionBuilder()->add('news.isDeleted = 0');
     }
     //can view delayed news
     if (!WCF::getSession()->getPermission('user.cms.news.canViewDelayedNews')) {
         $this->getConditionBuilder()->add('news.isDisabled = ?', array(0));
     }
     // language Filter
     if (LanguageFactory::getInstance()->multilingualismEnabled() && count(WCF::getUser()->getLanguageIDs())) {
         $this->getConditionBuilder()->add('(news.languageID IN (?) OR news.languageID IS NULL)', array(WCF::getUser()->getLanguageIDs()));
     }
 }
开发者ID:jacboy,项目名称:Fireball_News,代码行数:26,代码来源:AccessibleNewsList.class.php

示例2: __construct

 /**
  * Creates the AccessibleNewsList object.
  */
 public function __construct()
 {
     parent::__construct();
     // accessible news categories
     $accessibleCategoryIDs = NewsCategory::getAccessibleCategoryIDs();
     if (!empty($accessibleCategoryIDs)) {
         $this->getConditionBuilder()->add('news.newsID IN (SELECT newsID FROM news' . WCF_N . '_news_to_category WHERE categoryID IN (?))', array($accessibleCategoryIDs));
     } else {
         $this->getConditionBuilder()->add('1=0');
     }
     // default conditions
     if (!WCF::getSession()->getPermission('mod.news.canReadDeactivatedNews')) {
         $this->getConditionBuilder()->add('news.isActive = 1');
     }
     if (!WCF::getSession()->getPermission('mod.news.canReadDeletedNews')) {
         $this->getConditionBuilder()->add('news.isDeleted = 0');
     }
     if (!WCF::getSession()->getPermission('mod.news.canReadFutureNews')) {
         if (WCF::getUser()->userID) {
             $this->getConditionBuilder()->add('(news.isPublished = 1 OR news.userID = ?)', array(WCF::getUser()->userID));
         } else {
             $this->getConditionBuilder()->add('news.isPublished = 1');
         }
     }
     // apply language filter
     if (LanguageFactory::getInstance()->multilingualismEnabled() && count(WCF::getUser()->getLanguageIDs())) {
         $this->getConditionBuilder()->add('(news.languageID IN (?) OR news.languageID IS NULL)', array(WCF::getUser()->getLanguageIDs()));
     }
 }
开发者ID:joshuaruesweg,项目名称:de.voolia.news,代码行数:32,代码来源:AccessibleNewsList.class.php

示例3: loadLanguage

 /**
  * Loads the compiled language file.
  * Compiles the language file before if necessary.
  */
 public function loadLanguage()
 {
     $filename = TMP_DIR . 'setup/lang/cache/' . $this->languageCode . '_wcf.setup.php';
     if (!file_exists($filename)) {
         $xml = new XML();
         $xml->load(TMP_DIR . 'setup/lang/setup_' . $this->languageCode . '.xml');
         // get language items
         $categoriesToCache = array();
         $items = $xml->xpath()->query('/ns:language/ns:category/ns:item');
         foreach ($items as $item) {
             $categoriesToCache[] = array('name' => $item->getAttribute('name'), 'cdata' => $item->nodeValue);
         }
         // update language files here
         if (count($categoriesToCache) > 0) {
             $file = new File($filename);
             $file->write("<?php\n/**\n* WoltLab Community Framework\n* language: " . $this->languageCode . "\n* encoding: UTF-8\n* category: WCF Setup\n* generated at " . gmdate("r") . "\n* \n* DO NOT EDIT THIS FILE\n*/\n");
             foreach ($categoriesToCache as $name) {
                 $file->write("\$this->items['" . $name['name'] . "'] = '" . str_replace("'", "\\'", $name['cdata']) . "';\n");
                 // compile dynamic language variables
                 if (strpos($name['cdata'], '{') !== false) {
                     $compiledString = LanguageFactory::getInstance()->getScriptingCompiler()->compileString($name['name'], $name['cdata']);
                     $file->write("\$this->dynamicItems['" . $name['name'] . "'] = '" . str_replace("'", "\\'", $compiledString['template']) . "';\n");
                 }
             }
             $file->write("?>");
             $file->close();
         }
     }
     include_once $filename;
     $this->setLocale();
 }
开发者ID:ZerGabriel,项目名称:WCF,代码行数:35,代码来源:SetupLanguage.class.php

示例4: update

 /**
  * {@inheritdoc}
  */
 public function update()
 {
     //get classes
     $baseClass = $this->className;
     $articleClass = $baseClass::getBaseClass();
     //count attachments
     if (isset($this->parameters['attachmentHandler']) && $this->parameters['attachementHandler'] !== null) {
         $data['attachments'] = count($this->parameters['attachmentHandler']);
     }
     parent::update();
     foreach ($this->objects as $article) {
         $this->objectIDs[] = $article->{$baseClass::getDatabaseTableIndexName()};
     }
     foreach ($this->objects as $news) {
         if (isset($this->parameters['categoryIDs'])) {
             $news->updateCategoryIDs($this->parameters['categoryIDs']);
         }
         // update tags
         $tags = array();
         if (isset($this->parameters['tags'])) {
             $tags = $this->parameters['tags'];
             unset($this->parameters['tags']);
         }
         if (!empty($tags)) {
             $languageID = !isset($this->parameters['data']['languageID']) || $this->parameters['data']['languageID'] === null ? LanguageFactory::getInstance()->getDefaultLanguageID() : $this->parameters['data']['languageID'];
             TagEngine::getInstance()->addObjectTags($articleClass::$objectType, $article->{$baseClass::getDatabaseTableIndexName()}, $tags, $languageID);
         }
     }
 }
开发者ID:CaribeSoy,项目名称:article-core,代码行数:32,代码来源:AbstractArticleDatabaseObjectAction.class.php

示例5: __construct

 /**
  * Creates a new ViewableUserActivityEventList object.
  */
 public function __construct()
 {
     parent::__construct();
     if (LanguageFactory::getInstance()->multilingualismEnabled() && count(WCF::getUser()->getLanguageIDs())) {
         $this->getConditionBuilder()->add('(user_activity_event.languageID IN (?) OR user_activity_event.languageID IS NULL)', array(WCF::getUser()->getLanguageIDs()));
     }
 }
开发者ID:nick-strohm,项目名称:WCF,代码行数:10,代码来源:ViewableUserActivityEventList.class.php

示例6: __construct

 /**
  * Creates a new NewsCategoryList object.
  * 
  * @param	array<integer>		$categoryIDs
  */
 public function __construct(array $categoryIDs)
 {
     ViewableEntryList::__construct();
     // accessible news categories
     if (!empty($categoryIDs)) {
         $this->getConditionBuilder()->add('news_entry_to_category.categoryID IN (?)', array($categoryIDs));
         $this->getConditionBuilder()->add('news_entry.entryID = news_entry_to_category.entryID');
     } else {
         $this->getConditionBuilder()->add('1=0');
     }
     // default conditions
     if (!WCF::getSession()->getPermission('mod.news.canModerateEntry')) {
         $this->getConditionBuilder()->add('news_entry.isDisabled = 0');
     }
     if (!WCF::getSession()->getPermission('mod.news.canViewDeletedEntry')) {
         $this->getConditionBuilder()->add('news_entry.isDeleted = 0');
     }
     if (WCF::getUser()->userID) {
         $this->getConditionBuilder()->add('(news_entry.isPublished = 1 OR news_entry.userID = ?)', array(WCF::getUser()->userID));
     } else {
         $this->getConditionBuilder()->add('news_entry.isPublished = 1');
     }
     // apply language filter
     if (LanguageFactory::getInstance()->multilingualismEnabled() && count(WCF::getUser()->getLanguageIDs())) {
         $this->getConditionBuilder()->add('(news_entry.languageID IN (?) OR news_entry.languageID IS NULL)', array(WCF::getUser()->getLanguageIDs()));
     }
 }
开发者ID:Griborim,项目名称:de.incendium.cms.news,代码行数:32,代码来源:CategoryEntryList.class.php

示例7: import

 /**
  * @see	\wcf\system\importer\IImporter::import()
  */
 public function import($oldID, array $data, array $additionalData = array())
 {
     $data['packageID'] = 1;
     // set temporary option name
     $data['optionName'] = StringUtil::getRandomID();
     if ($data['optionType'] == 'boolean' || $data['optionType'] == 'integer') {
         if (isset($data['defaultValue'])) {
             $data['defaultValue'] = intval($data['defaultValue']);
         }
     }
     // create category
     $this->createCategory($data['categoryName']);
     // save option
     $action = new UserOptionAction(array(), 'create', array('data' => $data));
     $returnValues = $action->executeAction();
     $userOption = $returnValues['returnValues'];
     // update generic option name
     $editor = new UserOptionEditor($userOption);
     $editor->update(array('optionName' => 'option' . $userOption->optionID));
     // save name
     $sql = "INSERT IGNORE INTO\twcf" . WCF_N . "_language_item\n\t\t\t\t\t\t(languageID, languageItem, languageItemValue, languageItemOriginIsSystem, languageCategoryID, packageID)\n\t\t\tVALUES\t\t\t(?, ?, ?, ?, ?, ?)";
     $statement = WCF::getDB()->prepareStatement($sql);
     $statement->execute(array(LanguageFactory::getInstance()->getDefaultLanguageID(), 'wcf.user.option.option' . $userOption->optionID, $additionalData['name'], 0, $this->languageCategoryID, 1));
     ImportHandler::getInstance()->saveNewID('com.woltlab.wcf.user.option', $oldID, $userOption->optionID);
     return $userOption->optionID;
 }
开发者ID:nick-strohm,项目名称:WCF,代码行数:29,代码来源:UserOptionImporter.class.php

示例8: create

 /**
  * @see	\wcf\data\IEditableObject::create()
  */
 public static function create(array $parameters = array())
 {
     $descriptions = array();
     if (isset($parameters['description']) && is_array($parameters['description'])) {
         if (count($parameters['description']) > 1) {
             $descriptions = $parameters['description'];
             $parameters['description'] = '';
         } else {
             $parameters['description'] = reset($parameters['description']);
         }
     }
     $cronjob = parent::create($parameters);
     // save cronjob description
     if (!empty($descriptions)) {
         // set default value
         if (isset($descriptions[''])) {
             $defaultValue = $descriptions[''];
         } else {
             if (isset($descriptions['en'])) {
                 // fallback to English
                 $defaultValue = $descriptions['en'];
             } else {
                 if (isset($descriptions[WCF::getLanguage()->getFixedLanguageCode()])) {
                     // fallback to the language of the current user
                     $defaultValue = $descriptions[WCF::getLanguage()->getFixedLanguageCode()];
                 } else {
                     // fallback to first description
                     $defaultValue = reset($descriptions);
                 }
             }
         }
         // fetch data directly from database during framework installation
         if (!PACKAGE_ID) {
             $sql = "SELECT\t*\n\t\t\t\t\tFROM\twcf" . WCF_N . "_language_category\n\t\t\t\t\tWHERE\tlanguageCategory = ?";
             $statement = WCF::getDB()->prepareStatement($sql);
             $statement->execute(array('wcf.acp.cronjob'));
             $languageCategory = $statement->fetchObject('wcf\\data\\language\\category\\LanguageCategory');
             $languages = new LanguageList();
             $languages->readObjects();
         } else {
             $languages = LanguageFactory::getInstance()->getLanguages();
             $languageCategory = LanguageFactory::getInstance()->getCategory('wcf.acp.cronjob');
         }
         $sql = "INSERT INTO\twcf" . WCF_N . "_language_item\n\t\t\t\t\t\t(languageID, languageItem, languageItemValue, languageCategoryID, packageID)\n\t\t\t\tVALUES\t\t(?, ?, ?, ?, ?)\n\t\t\t\tON DUPLICATE KEY UPDATE languageItemValue = VALUES(languageItemValue)";
         $statement = WCF::getDB()->prepareStatement($sql);
         foreach ($languages as $language) {
             $value = $defaultValue;
             if (isset($descriptions[$language->languageCode])) {
                 $value = $descriptions[$language->languageCode];
             }
             $statement->execute(array($language->languageID, 'wcf.acp.cronjob.description.cronjob' . $cronjob->cronjobID, $value, $languageCategory->languageCategoryID, $cronjob->packageID));
         }
         // update cronjob
         $cronjobEditor = new CronjobEditor($cronjob);
         $cronjobEditor->update(array('description' => 'wcf.acp.cronjob.description.cronjob' . $cronjob->cronjobID));
     }
     return $cronjob;
 }
开发者ID:nick-strohm,项目名称:WCF,代码行数:61,代码来源:CronjobEditor.class.php

示例9: __construct

 /**
  * Contructs a new TagCloud object.
  * 
  * @param	array<integer>	$languageIDs
  */
 public function __construct(array $languageIDs = array())
 {
     $this->languageIDs = $languageIDs;
     if (empty($this->languageIDs)) {
         $this->languageIDs = array_keys(LanguageFactory::getInstance()->getLanguages());
     }
     // init cache
     $this->loadCache();
 }
开发者ID:nick-strohm,项目名称:WCF,代码行数:14,代码来源:TagCloud.class.php

示例10: readData

 /**
  * @see	\wcf\page\IPage::assignVariables()
  */
 public function readData()
 {
     parent::readData();
     foreach (static::$providerLocales as $locale) {
         $languageCode = substr($locale, 0, 2);
         if (\wcf\system\language\LanguageFactory::getInstance()->getLanguageByCode($languageCode)) {
             $this->availableLocales[$locale] = \wcf\system\WCF::getLanguage()->get('wcf.acp.faker.locale.' . $locale);
         }
     }
 }
开发者ID:CaribeSoy,项目名称:be.bastelstu.wcf.faker,代码行数:13,代码来源:AbstractFakerPage.class.php

示例11: save

 /**
  * @see	\wcf\form\IForm::save()
  */
 public function save()
 {
     AbstractForm::save();
     $editor = new LanguageEditor($this->language);
     $editor->update(array('countryCode' => mb_strtolower($this->countryCode), 'languageName' => $this->languageName, 'languageCode' => mb_strtolower($this->languageCode)));
     LanguageFactory::getInstance()->clearCache();
     $this->saved();
     // show success message
     WCF::getTPL()->assign('success', true);
 }
开发者ID:nick-strohm,项目名称:WCF,代码行数:13,代码来源:LanguageEditForm.class.php

示例12: getSearchableData

 /**
  * @see	\cms\system\content\type\ISearchableContentType::getSearchableData()
  */
 public function getSearchableData(Content $content)
 {
     foreach (LanguageFactory::getInstance()->getLanguages() as $language) {
         $this->searchIndexData[$language->languageID] = array();
         foreach ($this->searchableFields as $field) {
             $this->searchIndexData[$language->languageID][] = $language->get($content->{$field});
         }
         $this->searchIndexData[$language->languageID] = implode("\n", $this->searchIndexData[$language->languageID]);
     }
     return $this->searchIndexData;
 }
开发者ID:knzo,项目名称:Fireball,代码行数:14,代码来源:AbstractSearchableContentType.class.php

示例13: init

 /**
  * @see	\wcf\system\dashboard\box\IDashboardBox::init()
  */
 public function init(DashboardBox $box, IPage $page)
 {
     parent::init($box, $page);
     if (MODULE_TAGGING && WCF::getSession()->getPermission('user.tag.canViewTag') && WCF::getSession()->getPermission('user.news.canReadEntry')) {
         $languageIDs = array();
         if (LanguageFactory::getInstance()->multilingualismEnabled()) {
             $languageIDs = WCF::getUser()->getLanguageIDs();
         }
         $this->tagCloud = new TypedTagCloud('de.incendium.cms.news.entry', $languageIDs);
     }
     $this->fetched();
 }
开发者ID:Griborim,项目名称:de.incendium.cms.news,代码行数:15,代码来源:NewsTagCloudDashboardSidebarBox.class.php

示例14: init

 /**
  * @see	\wcf\system\dashboard\box\IDashboardBox::init()
  */
 public function init(DashboardBox $box, IPage $page)
 {
     parent::init($box, $page);
     if (MODULE_TAGGING) {
         $languageIDs = array();
         if (LanguageFactory::getInstance()->multilingualismEnabled()) {
             $languageIDs = WCF::getUser()->getLanguageIDs();
         }
         // get tag cloud for news entries
         $this->tagCloud = new TypedTagCloud('de.voolia.news.entry', $languageIDs);
     }
     $this->fetched();
 }
开发者ID:joshuaruesweg,项目名称:de.voolia.news,代码行数:16,代码来源:NewsTagCloudDashboardSidebarBox.class.php

示例15: loadContent

 /**
  * @inheritDoc
  */
 protected function loadContent()
 {
     if (MODULE_TAGGING && WCF::getSession()->getPermission('user.tag.canViewTag') && WCF::getSession()->getPermission('user.filebase.canViewEntry')) {
         $languageIDs = [];
         if (LanguageFactory::getInstance()->multilingualismEnabled()) {
             $languageIDs = WCF::getUser()->getLanguageIDs();
         }
         $tagCloud = new TypedTagCloud('de.incendium.filebase.entry', $languageIDs);
         $tags = $tagCloud->getTags();
         if (!empty($tags)) {
             $this->content = WCF::getTPL()->fetch('tagCloudBox', 'wcf', ['tags' => $tags, 'taggableObjectType' => 'de.incendium.filebase.entry']);
         }
     }
 }
开发者ID:Griborim,项目名称:de.incendium.cms.filebase,代码行数:17,代码来源:EntryTagCloudBoxController.class.php


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