Upgraded phpmyadmin to 4.0.4 (All Languages) - No modifications yet
[openemr.git] / phpmyadmin / libraries / config / config_functions.lib.php
blob44a2624249f2d58d46864578c7f8bd684ed21978
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Common config manipulation functions
6 * @package PhpMyAdmin
7 */
9 /**
10 * Returns sanitized language string, taking into account our special codes
11 * for formatting. Takes variable number of arguments.
12 * Based on PMA_sanitize from sanitize.lib.php.
14 * @param string $lang_key key in $GLOBALS WITHOUT 'strSetup' prefix
15 * @param mixed $args,... arguments for sprintf
17 * @return string
19 function PMA_lang($lang_key, $args = null)
21 $message = isset($GLOBALS["strConfig$lang_key"])
22 ? $GLOBALS["strConfig$lang_key"] : $lang_key;
24 $message = PMA_sanitize($message);
26 if (func_num_args() == 1) {
27 return $message;
28 } else {
29 $args = func_get_args();
30 array_shift($args);
31 return vsprintf($message, $args);
35 /**
36 * Returns translated field name/description or comment
38 * @param string $canonical_path
39 * @param string $type 'name', 'desc' or 'cmt'
40 * @param mixed $default
42 * @return string
44 function PMA_lang_name($canonical_path, $type = 'name', $default = 'key')
46 $lang_key = str_replace(
47 array('Servers/1/', '/'),
48 array('Servers/', '_'),
49 $canonical_path
50 ) . '_' . $type;
51 return isset($GLOBALS["strConfig$lang_key"])
52 ? ($type == 'desc' ? PMA_lang($lang_key) : $GLOBALS["strConfig$lang_key"])
53 : ($default == 'key' ? $lang_key : $default);