ensuring consistent use of php side encoding, testing all encoding cases, correctly report the language in the <html> tag

This commit is contained in:
El RIDO 2020-02-01 09:15:14 +01:00
parent cc0920fc09
commit 1b206e8495
No known key found for this signature in database
GPG key ID: 0F5C940A6BD81F92
4 changed files with 29 additions and 12 deletions

View file

@ -130,13 +130,26 @@ class I18n
if ($argsCount > 1) {
for ($i = 0; $i < $argsCount; ++$i) {
if (($i > 0 && !is_int($args[$i])) || strpos($args[0], '<a') === false) {
$args[$i] = htmlentities($args[$i], ENT_QUOTES | ENT_XHTML | ENT_DISALLOWED, 'UTF-8');
$args[$i] = self::encode($args[$i]);
}
}
}
return call_user_func_array('sprintf', $args);
}
/**
* encode HTML entities for output into an HTML5 document
*
* @access public
* @static
* @param string $string
* @return string
*/
public static function encode($string)
{
return htmlspecialchars($string, ENT_QUOTES | ENT_HTML5 | ENT_DISALLOWED, 'UTF-8', false);
}
/**
* loads translations
*