You are here

function views_json_strip_illegal_chars in Views Datasource 5

Strips illegal JSON characters in identifier string

Parameters

string $input:

Return value

string

2 calls to views_json_strip_illegal_chars()
views_json_exhibit_render in ./views_json.module
views_json_simple_render in ./views_json.module

File

./views_json.module, line 245
views_json.module - provides Views plugin for rendering node content as JSON.

Code

function views_json_strip_illegal_chars($input) {
  $output = str_replace(array(
    '{',
    '}',
    '[',
    ']',
    ':',
    ',',
    '"',
    "'",
    chr(47),
    chr(92),
  ), '', $input);
  $output = preg_replace('/[\\x{80}-\\x{A0}' . '\\x{01}-\\x{1F}' . '\\x{0}]/u', '', $output);
  return $output;
}