I also change the loop in the parse_variables for this other (sorry, I don´t find how "shortcode" the code):
foreach ($matches[0] as $match) {
$varname = strreplace('[', '', $match);
$varname = strreplace(']', '', $varname);
$langvalue = lang($varname); // get value from lang file
if ($langvalue)
$text = strreplace($match, $langvalue, $text);
}
A reason for this change is that if someone is using a javascripty array and make something like: myarray[0], or inside a loop like myarray[index], the original code would change [0] for 0 and [x] for x, and the result would be myarray0 and myarrayx and it throw an error.
I also change the loop in the parse_variables for this other (sorry, I don´t find how "shortcode" the code):
foreach ($matches[0] as $match) {
$varname = strreplace('[', '', $match);
$varname = strreplace(']', '', $varname);
$langvalue = lang($varname); // get value from lang file
if ($langvalue)
$text = strreplace($match, $langvalue, $text);
}
A reason for this change is that if someone is using a javascripty array and make something like: myarray[0], or inside a loop like myarray[index], the original code would change [0] for 0 and [x] for x, and the result would be myarray0 and myarrayx and it throw an error.
Thanks for this solution.