You are here

function node_export_dsv_decode_sanitize_value in Node export 7.3

Same name and namespace in other branches
  1. 6.3 modules/node_export_dsv/node_export_dsv.module \node_export_dsv_decode_sanitize_value()

Decode a value.

1 call to node_export_dsv_decode_sanitize_value()
node_export_dsv_decode in formats/dsv.inc
Interpret a DSV string.

File

formats/dsv.inc, line 166
The Node export DSV format handler.

Code

function node_export_dsv_decode_sanitize_value($var) {

  // Allow numeric, bool, and null values to pass right back as is.
  if (is_numeric($var) || is_bool($var) || is_null($var)) {
    return $var;
  }
  elseif (in_array(strtoupper($var), array(
    "'TRUE'",
    "'FALSE'",
    "'NULL'",
  ))) {
    return $var;
  }

  // Assume this is a string.
  return "'" . str_replace("'", "\\'", $var) . "'";
}