= 0; $depth--) { if (!isset($path[$depth+1]) || count($path[$depth+1]) == 0) { unset($path[$depth][$keys[$depth]]); } else { break; } } } /** * Returns sanitized language string, taking into account our special codes * for formatting. Takes variable number of arguments. * Based on PMA_sanitize from sanitize.lib.php. * * @param string $lang_key key in $GLOBALS WITHOUT 'strSetup' prefix * @param mixed $args arguments for sprintf * @return string */ function PMA_lang($lang_key) { static $search, $replace; // some quick cache'ing if ($search === null) { $replace_pairs = array( '<' => '<', '>' => '>', '[em]' => '', '[/em]' => '', '[strong]' => '', '[/strong]' => '', '[code]' => '', '[/code]' => '', '[kbd]' => '', '[/kbd]' => '', '[br]' => '
', '[sup]' => '', '[/sup]' => ''); if (defined('PMA_SETUP')) { $replace_pairs['[a@Documentation.html'] = '[a@../Documentation.html'; } $search = array_keys($replace_pairs); $replace = array_values($replace_pairs); } $message = isset($GLOBALS["strSetup$lang_key"]) ? $GLOBALS["strSetup$lang_key"] : $lang_key; $message = str_replace($search, $replace, $message); // replace [a@"$1"]$2[/a] with $2 $message = preg_replace('#\[a@("?)([^\]]+)\1\]([^\[]+)\[/a\]#e', "PMA_lang_link_replace('$2', '$3')", $message); if (func_num_args() == 1) { return $message; } else { $args = func_get_args(); array_shift($args); return vsprintf($message, $args); } } /** * Returns translated field name * * @param string $canonical_path * @return string */ function PMA_lang_name($canonical_path) { $lang_key = str_replace( array('Servers/1/', '/'), array('Servers/', '_'), $canonical_path) . '_name'; return isset($GLOBALS["strSetup$lang_key"]) ? $GLOBALS["strSetup$lang_key"] : $lang_key; } /** * Returns translated field description * * @param string $canonical_path * @return string */ function PMA_lang_desc($canonical_path) { $lang_key = str_replace( array('Servers/1/', '/'), array('Servers/', '_'), $canonical_path) . '_desc'; return isset($GLOBALS["strSetup$lang_key"]) ? PMA_lang($lang_key) : ''; } /** * Wraps link in <a> tags and replaces argument separator in internal links * to the one returned by PMA_get_arg_separator() * * @param string $link * @param string $text * @return string */ function PMA_lang_link_replace($link, $text) { static $separator; if (!isset($separator)) { $separator = PMA_get_arg_separator('html'); } if (!preg_match('#^http://#', $link)) { $link = str_replace('&', $separator, $link); } return '' . $text . ''; } /** * Reads user preferences field names * * @param array|null $forms * @return array */ function PMA_read_userprefs_fieldnames(array $forms = null) { static $names; // return cached results if ($names !== null) { return $names; } if (is_null($forms)) { $forms = array(); include 'libraries/config/user_preferences.forms.php'; } $names = array(); foreach ($forms as $formset) { foreach ($formset as $form) { foreach ($form as $k => $v) { $names[] = is_int($k) ? $v : $k; } } } return $names; } ?>