[ Index ] |
|
Code source de Serendipity 1.2 |
1 <?php # $Id: lang.inc.php 1571 2007-01-14 12:55:58Z garvinhicking $ 2 # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team) 3 # All rights reserved. See LICENSE file for licensing details 4 5 if (IN_serendipity !== true) { 6 die ("Don't hack!"); 7 } 8 9 if (!defined('serendipity_LANG_LOADED') || serendipity_LANG_LOADED !== true) { 10 $charset = serendipity_getCharset(); 11 12 // The following variable can be set in serendipity_config_local.inc.php to force your templates being able to use language override includes 13 if ($serendipity['useTemplateLanguage']) { 14 @include (S9Y_INCLUDE_PATH . 'templates/' . $serendipity['template'] . '/' . $charset . 'lang_' . $serendipity['lang'] . '.inc.php'); 15 @include (S9Y_INCLUDE_PATH . 'templates/' . $serendipity['template'] . '/lang_en.inc.php'); 16 } 17 18 // Try and include preferred language from the configurated setting 19 if (@include(S9Y_INCLUDE_PATH . 'lang/' . $charset . 'serendipity_lang_'. $serendipity['lang'] .'.inc.php') ) { 20 // Only here can we truely say the language is loaded 21 define('serendipity_LANG_LOADED', true); 22 if (function_exists('serendipity_db_reconnect')) { 23 serendipity_db_reconnect(); 24 } 25 } elseif (IS_installed === false || (defined('IS_up2date') && IS_up2date === false)) { /* -- Auto-Guess -- */ 26 // If no config file is loaded, language includes are not available. 27 // Now include one. Try to auto-guess the language by looking up the HTTP_ACCEPT_LANGUAGE. 28 serendipity_detectLang(true); 29 } //endif 30 31 // Do fallback to english 32 if (IS_installed === false || (defined('IS_up2date') && IS_up2date === false)) { 33 @include(S9Y_INCLUDE_PATH . 'lang/' . $charset . 'serendipity_lang_en.inc.php'); 34 } 35 } 36 37 if (!defined('serendipity_MB_LOADED') && defined('serendipity_LANG_LOADED')) { 38 // Needs to be included here because we need access to constant LANG_CHARSET definied in languages (not available for compat.inc.php) 39 40 if (function_exists('mb_language')) { 41 @mb_language($serendipity['lang']); 42 } 43 44 if (function_exists('mb_internal_encoding')) { 45 @mb_internal_encoding(LANG_CHARSET); 46 } 47 48 /** 49 * Wrapper for multibyte string operations 50 * 51 * Multibyte string functions wrapper: 52 * strlen(), strpos(), strrpos(), strtolower(), strtoupper(), substr(), ucfirst() 53 * 54 * @access public 55 * @param mixed Any input array, dynamically evaluated for best emulation 56 * @return mixed 57 */ 58 function serendipity_mb() { 59 static $mbstring = null; 60 61 if (is_null($mbstring)) { 62 $mbstring = (extension_loaded('mbstring') && @mb_internal_encoding(LANG_CHARSET) ? 1 : 0); 63 if ($mbstring === 1) { 64 if (function_exists('mb_strtoupper')) { 65 $mbstring = 2; 66 } 67 } 68 } 69 70 $args = func_get_args(); 71 $func = $args[0]; 72 unset($args[0]); 73 74 switch($func) { 75 case 'ucfirst': 76 // there's no mb_ucfirst, so emulate it 77 if ($mbstring === 2) { 78 $enc = LANG_CHARSET; 79 return mb_strtoupper(mb_substr($args[1], 0, 1, $enc), $enc) . mb_substr($args[1], 1, mb_strlen($args[1], $enc), $enc); 80 } else { 81 return ucfirst($args[1]); 82 } 83 84 case 'strtolower': 85 case 'strtoupper': 86 if ($mbstring === 2) { 87 return call_user_func_array('mb_' . $func, $args); 88 } else { 89 return call_user_func_array($func, $args); 90 } 91 92 default: 93 if ($mbstring) { 94 return call_user_func_array('mb_' . $func, $args); 95 } else { 96 return call_user_func_array($func, $args); 97 } 98 } 99 } 100 101 define('serendipity_MB_LOADED', true); 102 } 103 104 /* vim: set sts=4 ts=4 expandtab : */
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sat Nov 24 09:00:37 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |