File

modules/taxonomy.module, line 788
Enables the organization of content into categories.

Code

function _taxonomy_prepare_insert($data, $stage) {
  if ($stage == 1) {
    $result = implode(', ', array_keys($data));
  }
  else {
    foreach (array_values($data) as $value) {

      //Escape strings, but not integers
      if (is_int($value)) {
        $q[] = $value;
      }
      else {
        $q[] = "'" . str_replace('%', '%%', db_escape_string($value)) . "'";
      }
    }
    $result = implode(', ', $q);
  }
  return "({$result})";
}