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


PHP PMA_langSet函数代码示例

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


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

示例1: testGettext

 /**
  * Test for setting and parsing locales
  *
  * @param string $locale locale name
  *
  * @return void
  *
  * @group large
  * @dataProvider listLocales
  */
 public function testGettext($locale)
 {
     /* We should be able to set the language */
     $this->assertTrue(PMA_langSet($locale));
     /* Bind locales */
     _setlocale(LC_MESSAGES, $GLOBALS['lang']);
     _bind_textdomain_codeset('phpmyadmin', 'UTF-8');
     _textdomain('phpmyadmin');
     /* Grab some texts */
     $this->assertContains('%s', _ngettext('%s table', '%s tables', 10));
     $this->assertContains('%s', _ngettext('%s table', '%s tables', 1));
 }
开发者ID:itgsod-philip-skalander,项目名称:phpmyadmin,代码行数:22,代码来源:locale_gettext_test.php

示例2: PMA_langDetect

/**
 * Analyzes some PHP environment variables to find the most probable language
 * that should be used
 *
 * @param string  $str     string to analyze
 * @param integer $envType type of the PHP environment variable which value is $str
 *
 * @return bool    true on success, otherwise false
 *
 * @access  private
 */
function PMA_langDetect($str, $envType)
{
    if (empty($str)) {
        return false;
    }
    if (empty($GLOBALS['available_languages'])) {
        return false;
    }
    foreach ($GLOBALS['available_languages'] as $lang => $value) {
        // $envType =  1 for the 'HTTP_ACCEPT_LANGUAGE' environment variable,
        //             2 for the 'HTTP_USER_AGENT' one
        $expr = $value[0];
        if (strpos($expr, '[-_]') === false) {
            $expr = str_replace('|', '([-_][[:alpha:]]{2,3})?|', $expr);
        }
        if ($envType == 1 && preg_match('/^(' . addcslashes($expr, '/') . ')(;q=[0-9]\\.[0-9])?$/i', $str) || $envType == 2 && preg_match('/(\\(|\\[|;[[:space:]])(' . addcslashes($expr, '/') . ')(;|\\]|\\))/i', $str)) {
            if (PMA_langSet($lang)) {
                return true;
            }
        }
    }
    return false;
}
开发者ID:yszar,项目名称:linuxwp,代码行数:34,代码来源:select_lang.lib.php

示例3: loadUserPreferences

 /**
  * Loads user preferences and merges them with current config
  * must be called after control connection has been estabilished
  *
  * @return boolean
  */
 function loadUserPreferences()
 {
     // index.php should load these settings, so that phpmyadmin.css.php
     // will have everything avaiable in session cache
     $server = isset($GLOBALS['server']) ? $GLOBALS['server'] : (!empty($GLOBALS['cfg']['ServerDefault']) ? $GLOBALS['cfg']['ServerDefault'] : 0);
     $cache_key = 'server_' . $server;
     if ($server > 0 && !defined('PMA_MINIMUM_COMMON')) {
         $config_mtime = max($this->default_source_mtime, $this->source_mtime);
         // cache user preferences, use database only when needed
         if (!isset($_SESSION['cache'][$cache_key]['userprefs']) || $_SESSION['cache'][$cache_key]['config_mtime'] < $config_mtime) {
             // load required libraries
             include_once './libraries/user_preferences.lib.php';
             $prefs = PMA_loadUserprefs();
             $_SESSION['cache'][$cache_key]['userprefs'] = PMA_applyUserprefs($prefs['config_data']);
             $_SESSION['cache'][$cache_key]['userprefs_mtime'] = $prefs['mtime'];
             $_SESSION['cache'][$cache_key]['userprefs_type'] = $prefs['type'];
             $_SESSION['cache'][$cache_key]['config_mtime'] = $config_mtime;
         }
     } elseif ($server == 0 || !isset($_SESSION['cache'][$cache_key]['userprefs'])) {
         $this->set('user_preferences', false);
         return;
     }
     $config_data = $_SESSION['cache'][$cache_key]['userprefs'];
     // type is 'db' or 'session'
     $this->set('user_preferences', $_SESSION['cache'][$cache_key]['userprefs_type']);
     $this->set('user_preferences_mtime', $_SESSION['cache'][$cache_key]['userprefs_mtime']);
     // backup some settings
     $org_fontsize = '';
     if (isset($this->settings['fontsize'])) {
         $org_fontsize = $this->settings['fontsize'];
     }
     // load config array
     $this->settings = PMA_arrayMergeRecursive($this->settings, $config_data);
     $GLOBALS['cfg'] = PMA_arrayMergeRecursive($GLOBALS['cfg'], $config_data);
     if (defined('PMA_MINIMUM_COMMON')) {
         return;
     }
     // settings below start really working on next page load, but
     // changes are made only in index.php so everything is set when
     // in frames
     // save theme
     $tmanager = $_SESSION['PMA_Theme_Manager'];
     if ($tmanager->getThemeCookie() || isset($_REQUEST['set_theme'])) {
         if (!isset($config_data['ThemeDefault']) && $tmanager->theme->getId() != 'original' || isset($config_data['ThemeDefault']) && $config_data['ThemeDefault'] != $tmanager->theme->getId()) {
             // new theme was set in common.inc.php
             $this->setUserValue(null, 'ThemeDefault', $tmanager->theme->getId(), 'original');
         }
     } else {
         // no cookie - read default from settings
         if ($this->settings['ThemeDefault'] != $tmanager->theme->getId() && $tmanager->checkTheme($this->settings['ThemeDefault'])) {
             $tmanager->setActiveTheme($this->settings['ThemeDefault']);
             $tmanager->setThemeCookie();
         }
     }
     // save font size
     if (!isset($config_data['fontsize']) && $org_fontsize != '82%' || isset($config_data['fontsize']) && $org_fontsize != $config_data['fontsize']) {
         $this->setUserValue(null, 'fontsize', $org_fontsize, '82%');
     }
     // save language
     if (isset($_COOKIE['pma_lang']) || isset($_POST['lang'])) {
         if (!isset($config_data['lang']) && $GLOBALS['lang'] != 'en' || isset($config_data['lang']) && $GLOBALS['lang'] != $config_data['lang']) {
             $this->setUserValue(null, 'lang', $GLOBALS['lang'], 'en');
         }
     } else {
         // read language from settings
         if (isset($config_data['lang']) && PMA_langSet($config_data['lang'])) {
             $this->setCookie('pma_lang', $GLOBALS['lang']);
         }
     }
     // save connection collation
     if (isset($_COOKIE['pma_collation_connection']) || isset($_POST['collation_connection'])) {
         if (!isset($config_data['collation_connection']) && $GLOBALS['collation_connection'] != 'utf8_general_ci' || isset($config_data['collation_connection']) && $GLOBALS['collation_connection'] != $config_data['collation_connection']) {
             $this->setUserValue(null, 'collation_connection', $GLOBALS['collation_connection'], 'utf8_general_ci');
         }
     } else {
         // read collation from settings
         if (isset($config_data['collation_connection'])) {
             $GLOBALS['collation_connection'] = $config_data['collation_connection'];
             $this->setCookie('pma_collation_connection', $GLOBALS['collation_connection']);
         }
     }
 }
开发者ID:nvq247,项目名称:joomla15test,代码行数:88,代码来源:Config.class.php

示例4: unset

        $GLOBALS['available_languages'] = $new_lang;
    }
    unset($key, $val, $new_lang);
}
/**
 * @global array MySQL charsets map
 */
$GLOBALS['mysql_charset_map'] = array('big5' => 'big5', 'cp-866' => 'cp866', 'euc-jp' => 'ujis', 'euc-kr' => 'euckr', 'gb2312' => 'gb2312', 'gbk' => 'gbk', 'iso-8859-1' => 'latin1', 'iso-8859-2' => 'latin2', 'iso-8859-7' => 'greek', 'iso-8859-8' => 'hebrew', 'iso-8859-8-i' => 'hebrew', 'iso-8859-9' => 'latin5', 'iso-8859-13' => 'latin7', 'iso-8859-15' => 'latin1', 'koi8-r' => 'koi8r', 'shift_jis' => 'sjis', 'tis-620' => 'tis620', 'utf-8' => 'utf8', 'windows-1250' => 'cp1250', 'windows-1251' => 'cp1251', 'windows-1252' => 'latin1', 'windows-1256' => 'cp1256', 'windows-1257' => 'cp1257');
/*
 * Do the work!
 */
if (!PMA_langCheck()) {
    // fallback language
    $fall_back_lang = 'en';
    $line = __LINE__;
    if (!PMA_langSet($fall_back_lang)) {
        trigger_error('phpMyAdmin-ERROR: invalid lang code: ' . __FILE__ . '#' . $line . ', check hard coded fall back language.', E_USER_WARNING);
        // stop execution
        // and tell the user that his chosen language is invalid
        PMA_fatalError('Could not load any language, ' . 'please check your language settings and folder.');
    }
}
// Set locale
_setlocale(LC_MESSAGES, $GLOBALS['lang']);
_bindtextdomain('phpmyadmin', $GLOBALS['lang_path']);
_bind_textdomain_codeset('phpmyadmin', 'UTF-8');
_textdomain('phpmyadmin');
/**
 * Messages for phpMyAdmin.
 *
 * These messages are here for easy transition to Gettext.
开发者ID:itgsod-philip-skalander,项目名称:phpmyadmin,代码行数:31,代码来源:select_lang.inc.php


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