Support for localised texts in defaults.

This commit is contained in:
Michal Čihař
2006-04-26 16:28:38 +00:00
parent df23439b13
commit 29977afa0e
2 changed files with 14 additions and 1 deletions

View File

@@ -13,6 +13,7 @@ $Source$
- Add support for groupping options. - Add support for groupping options.
- Support for forcing one of two bool/bgroups. - Support for forcing one of two bool/bgroups.
- Add documentation. - Add documentation.
- Support for localised texts in defaults.
* css/phpmyadmin.css.php, themes/darkblue_orange/css/theme_right.css.php, * css/phpmyadmin.css.php, themes/darkblue_orange/css/theme_right.css.php,
themes/original/css/theme_right.css.php: New style for non table forms themes/original/css/theme_right.css.php: New style for non table forms
used in plugins. used in plugins.

View File

@@ -91,8 +91,20 @@ function PMA_pluginGetDefault($section, $opt)
if (isset($GLOBALS['timeout_passed']) && $GLOBALS['timeout_passed'] && isset($_REQUEST[$opt])) { if (isset($GLOBALS['timeout_passed']) && $GLOBALS['timeout_passed'] && isset($_REQUEST[$opt])) {
return htmlspecialchars($_REQUEST[$opt]); return htmlspecialchars($_REQUEST[$opt]);
} elseif (isset($GLOBALS['cfg'][$section][$opt])) { } elseif (isset($GLOBALS['cfg'][$section][$opt])) {
$matches = array();
/* Possibly replace localised texts */
if (preg_match_all('/(str[A-Z][A-Za-z0-9]*)/', $GLOBALS['cfg'][$section][$opt], $matches)) {
$val = $GLOBALS['cfg'][$section][$opt];
foreach($matches[0] as $match) {
if (isset($GLOBALS[$match])) {
$val = str_replace($match, $GLOBALS[$match], $val);
}
}
return htmlspecialchars($val);
} else {
return htmlspecialchars($GLOBALS['cfg'][$section][$opt]); return htmlspecialchars($GLOBALS['cfg'][$section][$opt]);
} }
}
return ''; return '';
} }