Commit 496c2502 authored by Robert Lyon's avatar Robert Lyon Committed by Gerrit Code Review

Merge "Allow repeated use of get_string_ajax with arguments (Bug #1499583)"

parents 2a824503 897b987a
......@@ -41,9 +41,10 @@ function get_string_ajax(str, section) {
// If string already exists in strings object
if (typeof(strings[str]) !== 'undefined') {
// need to pass all the arguments except 'str'
// need to pass all the arguments except 'section'
// in case there are other %s variables
return get_string.apply(this, arguments);
var args = [].slice.call(arguments, 2);
return get_string.apply(this, [str].concat(args));
}
var rnd = randString(10);
......@@ -74,7 +75,7 @@ function get_string_ajax_call(str, section) {
// Try fetching the string and adding it to the strings object
return jQuery.ajax({
url: config.wwwroot + 'lang/get_string.php',
data: {'string': str, 'section': section, 'args': [].slice.call(arguments, 2)},
data: {'string': str, 'section': section},
type: 'GET',
success: function(data) {
// on success
......
......@@ -17,14 +17,7 @@ require(dirname(dirname(__FILE__)) . '/init.php');
$rawstring = param_alphanumext('string');
$section = param_alphanumext('section');
$args = param_variable('args', null);
if (!empty($args) && is_array($args)) {
array_unshift($args, $rawstring, $section);
$string = call_user_func_array('get_string' , $args);
}
else {
$string = get_string($rawstring, $section);
}
$string = get_raw_string($rawstring, $section);
json_reply(false, array(
'message' => null,
'data' => array(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment