You are here

function _views_json_check_label in Views Datasource 7

Same name and namespace in other branches
  1. 6 views_json.module \_views_json_check_label()

Strips illegal characters for an identifier from a JSON string.

Parameters

$input: Identifier string to process.

Return value

Identifier string with illegal characters stripped away.

File

./views_json.module, line 324

Code

function _views_json_check_label($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 check_plain(strip_tags($output));
}