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


PHP i18n::get_existing_content_languages方法代码示例

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


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

示例1: __construct

 /**
  * Create a new LanguageDropdownField
  * @param string $name
  * @param string $title
  * @param array $dontInclude list of languages that won't be included
  * @param string $translatingClass Name of the class with translated instances where to look for used languages
  * @param string $list Indicates the source language list. Can be either Common-English, Common-Native  Locale
  */
 function __construct($name, $title, $dontInclude = array(), $translatingClass = 'SiteTree', $list = 'Common-English')
 {
     $usedlangs = array_diff(i18n::get_existing_content_languages($translatingClass), $dontInclude);
     // we accept in dontInclude both language codes and names, so another diff is required
     $usedlangs = array_diff($usedlangs, array_flip($dontInclude));
     if (isset($usedlangs[Translatable::default_lang()])) {
         unset($usedlangs[Translatable::default_lang()]);
     }
     if ('Common-English' == $list) {
         $languageList = i18n::get_common_languages();
     } else {
         if ('Common-Native' == $list) {
             $languageList = i18n::get_common_languages(true);
         } else {
             $languageList = i18n::get_locale_list();
         }
     }
     $alllangs = array_diff($languageList, (array) $usedlangs, $dontInclude);
     $alllangs = array_flip(array_diff(array_flip($alllangs), $dontInclude));
     if (isset($alllangs[Translatable::default_lang()])) {
         unset($alllangs[Translatable::default_lang()]);
     }
     asort($alllangs);
     if (count($usedlangs)) {
         asort($usedlangs);
         $labelAvail = _t('Form.LANGAVAIL', "Available languages");
         $labelOther = _t('Form.LANGAOTHER', "Other languages");
         parent::__construct($name, $title, array($labelAvail => $usedlangs, $labelOther => $alllangs), reset($usedlangs));
     } else {
         parent::__construct($name, $title, $alllangs);
     }
 }
开发者ID:ramziammar,项目名称:websites,代码行数:40,代码来源:LanguageDropdownField.php

示例2: MultipleLanguages

 /**
  * Determine if there are more than one languages in our site tree
  */
 function MultipleLanguages()
 {
     $langs = i18n::get_existing_content_languages('SiteTree');
     return count($langs) > 1;
 }
开发者ID:ramziammar,项目名称:websites,代码行数:8,代码来源:CMSMain.php

示例3: init

 function init()
 {
     Director::set_site_mode('cms');
     // set language
     $member = Member::currentUser();
     if (!empty($member->Locale)) {
         i18n::set_locale($member->Locale);
     }
     // set reading lang
     if (Translatable::is_enabled() && !Director::is_ajax()) {
         Translatable::choose_site_lang(array_keys(i18n::get_existing_content_languages('SiteTree')));
     }
     parent::init();
     // Allow customisation of the access check by a decorator
     if ($this->hasMethod('alternateAccessCheck')) {
         $isAllowed = $this->alternateAccessCheck();
         // Default security check for LeftAndMain sub-class permissions
     } else {
         $isAllowed = Permission::check("CMS_ACCESS_{$this->class}");
         if (!$isAllowed && $this->class == 'CMSMain') {
             // When access /admin/, we should try a redirect to another part of the admin rather than be locked out
             $menu = $this->MainMenu();
             if (($first = $menu->First()) && $first->Link) {
                 Director::redirect($first->Link);
             }
         }
     }
     // Don't continue if there's already been a redirection request.
     if (Director::redirected_to()) {
         return;
     }
     // Access failure!
     if (!$isAllowed) {
         $messageSet = array('default' => _t('LeftAndMain.PERMDEFAULT', "Please choose an authentication method and enter your credentials to access the CMS."), 'alreadyLoggedIn' => _t('LeftAndMain.PERMALREADY', "I'm sorry, but you can't access that part of the CMS.  If you want to log in as someone else, do so below"), 'logInAgain' => _t('LeftAndMain.PERMAGAIN', "You have been logged out of the CMS.  If you would like to log in again, enter a username and password below."));
         Security::permissionFailure($this, $messageSet);
         return;
     }
     Requirements::javascript('jsparty/prototype.js');
     Requirements::javascript('jsparty/behaviour.js');
     Requirements::javascript('jsparty/prototype_improvements.js');
     Requirements::javascript('jsparty/loader.js');
     Requirements::javascript('jsparty/hover.js');
     Requirements::javascript('jsparty/layout_helpers.js');
     Requirements::javascript(MCE_ROOT . 'tiny_mce_src.js');
     Requirements::javascript('cms/javascript/ImageEditor/Activator.js');
     Requirements::javascript('jsparty/tiny_mce_improvements.js');
     Requirements::javascript('jsparty/scriptaculous/effects.js');
     Requirements::javascript('jsparty/scriptaculous/dragdrop.js');
     Requirements::javascript('jsparty/scriptaculous/controls.js');
     Requirements::css('jsparty/greybox/greybox.css');
     Requirements::javascript('jsparty/greybox/AmiJS.js');
     Requirements::javascript('jsparty/greybox/greybox.js');
     Requirements::javascript('jsparty/tree/tree.js');
     Requirements::css('jsparty/tree/tree.css');
     Requirements::javascript('jsparty/tabstrip/tabstrip.js');
     Requirements::css('jsparty/tabstrip/tabstrip.css');
     Requirements::css('cms/css/TinyMCEImageEnhancement.css');
     Requirements::javascript('cms/javascript/TinyMCEImageEnhancement.js');
     Requirements::javascript('cms/javascript/LeftAndMain.js');
     Requirements::javascript('cms/javascript/LeftAndMain_left.js');
     Requirements::javascript('cms/javascript/LeftAndMain_right.js');
     Requirements::css('sapphire/css/Form.css');
     // Requirements::javascript('cms/javascript/MemberList.js');
     Requirements::javascript('cms/javascript/ForumAdmin.js');
     Requirements::javascript('cms/javascript/SideTabs.js');
     Requirements::javascript('cms/javascript/TaskList.js');
     Requirements::javascript('cms/javascript/CommentList.js');
     Requirements::javascript('cms/javascript/SideReports.js');
     Requirements::javascript('cms/javascript/LangSelector.js');
     Requirements::javascript('cms/javascript/TranslationTab.js');
     Requirements::javascript('sapphire/javascript/Validator.js');
     Requirements::javascript('sapphire/javascript/UniqueFields.js');
     Requirements::javascript('sapphire/javascript/RedirectorPage.js');
     Requirements::javascript('sapphire/javascript/DataReport.js');
     Requirements::javascript('sapphire/javascript/ToggleCompositeField.js');
     Requirements::css('sapphire/css/SubmittedFormReportField.css');
     Requirements::javascript('sapphire/javascript/FieldEditor.js');
     Requirements::css('sapphire/css/FieldEditor.css');
     Requirements::css('sapphire/css/TableListField.css');
     Requirements::css('sapphire/css/ComplexTableField.css');
     Requirements::javascript('sapphire/javascript/TableListField.js');
     Requirements::javascript('sapphire/javascript/TableField.js');
     Requirements::javascript('sapphire/javascript/ComplexTableField.js');
     Requirements::javascript('sapphire/javascript/RelationComplexTableField.js');
     Requirements::css('sapphire/css/TreeDropdownField.css');
     Requirements::css('sapphire/css/CheckboxSetField.css');
     Requirements::javascript('jsparty/calendar/calendar.js');
     Requirements::javascript('jsparty/calendar/lang/calendar-en.js');
     Requirements::javascript('jsparty/calendar/calendar-setup.js');
     Requirements::css('sapphire/css/CalendarDateField.css');
     Requirements::css('jsparty/calendar/calendar-win2k-1.css');
     Requirements::javascript('sapphire/javascript/DropdownTimeField.js');
     Requirements::css('sapphire/css/DropdownTimeField.css');
     Requirements::css('sapphire/css/PopupDateTimeField.css');
     Requirements::javascript('sapphire/javascript/SelectionGroup.js');
     Requirements::css('sapphire/css/SelectionGroup.css');
     Requirements::javascript('jsparty/SWFUpload/SWFUpload.js');
     Requirements::javascript('cms/javascript/Upload.js');
     Requirements::javascript('sapphire/javascript/HasManyFileField.js');
     Requirements::css('sapphire/css/HasManyFileField.css');
//.........这里部分代码省略.........
开发者ID:ramziammar,项目名称:websites,代码行数:101,代码来源:LeftAndMain.php


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