function views_json_encode_special_chars in Views Datasource 5
Encodes special JSON characters in string
Parameters
string $input:
Return value
string
2 calls to views_json_encode_special_chars()
File
- ./
views_json.module, line 262 - views_json.module - provides Views plugin for rendering node content as JSON.
Code
function views_json_encode_special_chars($input) {
$output = str_replace(chr(92), '\\', $input);
$output = str_replace(chr(47), '\\/', $output);
$output = str_replace('"', '\\"', $output);
$output = str_replace(chr(8), '\\b', $output);
$output = str_replace(chr(12), '\\f', $output);
$output = str_replace(chr(13) . chr(10), '\\n', $output);
$output = str_replace(chr(10), '\\n', $output);
$output = str_replace(chr(13), '\\r', $output);
$output = str_replace(chr(9), '\\t', $output);
return check_plain(strip_tags($output));
}