mirror of
https://github.com/fenom-template/fenom.git
synced 2023-08-10 21:13:07 +03:00
Translate modifier's docs
This commit is contained in:
@@ -51,15 +51,18 @@ class Modifier
|
||||
*
|
||||
* @param string $text
|
||||
* @param string $type
|
||||
* @param string $charset
|
||||
* @return string
|
||||
*/
|
||||
public static function escape($text, $type = 'html')
|
||||
public static function escape($text, $type = 'html', $charset = 'UTF-8')
|
||||
{
|
||||
switch (strtolower($type)) {
|
||||
case "url":
|
||||
return urlencode($text);
|
||||
case "html";
|
||||
return htmlspecialchars($text, ENT_COMPAT, 'UTF-8');
|
||||
return htmlspecialchars($text, ENT_COMPAT, $charset);
|
||||
case "js":
|
||||
return json_encode($text, 64 | 256); // JSON_UNESCAPED_SLASHES = 64, JSON_UNESCAPED_UNICODE = 256
|
||||
default:
|
||||
return $text;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user