diff --git a/includes/common.inc b/includes/common.inc index ffe4b0574109d7c0ce4a98f611675f5a0d8a9ed0..21b19f9e54b1845db8dab47dfe6c57e964ee2e4f 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -633,31 +633,25 @@ function t($string, $args = 0) { } else { // Transform arguments before inserting them - array_walk($args, '_t'); + foreach($args as $key => $value) { + switch ($key[0]) { + // Escaped only + case '@': + $args[$key] = check_plain($value); + break; + // Escaped and placeholder + case '%': + default: + $args[$key] = theme('placeholder', $value); + break; + // Pass-through + case '!': + } + } return strtr($string, $args); } } -/** - * Helper function: apply the appropriate transformation to st() and t() - * placeholders. - */ -function _t(&$value, $key) { - switch ($key[0]) { - // Escaped only - case '@': - $value = check_plain($value); - return; - // Escaped and placeholder - case '%': - default: - $value = theme('placeholder', $value); - return; - // Pass-through - case '!': - } -} - /** * @defgroup validation Input validation * @{ diff --git a/includes/install.inc b/includes/install.inc index 7a4dfa24d9d70b41e3b44024fb476e9582160ed1..59d1903a5c1e8c159d5d858f698716092ad4aaf7 100644 --- a/includes/install.inc +++ b/includes/install.inc @@ -579,30 +579,24 @@ function st($string, $args = array()) { require_once './includes/theme.inc'; $GLOBALS['theme'] = 'theme'; // Transform arguments before inserting them - array_walk($args, '_st'); - return strtr((!empty($locale_strings[$string]) ? $locale_strings[$string] : $string), $args); -} - -/** - * Helper function: apply the appropriate transformation to st() and t() placeholders. - */ -function _st(&$value, $key) { - switch ($key[0]) { - // Escaped only - case '@': - $value = check_plain($value); - return; - // Escaped and placeholder - case '%': - default: - $value = '<em>'. check_plain($value) .'</em>'; - return; - // Pass-through - case '!': + foreach($args as $key => $value) { + switch ($key[0]) { + // Escaped only + case '@': + $args[$key] = check_plain($value); + break; + // Escaped and placeholder + case '%': + default: + $args[$key] = '<em>'. check_plain($value) .'</em>'; + break; + // Pass-through + case '!': + } } + return strtr((!empty($locale_strings[$string]) ? $locale_strings[$string] : $string), $args); } - /** * Check a profile's requirements. *