$value) { $json .= '"' . $key . '" : '; if (is_array($value)) { $json .= arrayToJSON($value); } else { // Make sure to strip backslashes and convert things to // entities in our output $json .= '"' . scrub_out(str_replace('\\', '', $value)) . '"'; } $json .= ' , '; } $json = rtrim($json, ', '); return $json . ' }'; } Header('content-type: application/x-javascript'); $search = new Search(null, $_REQUEST['type']); echo 'var types = '; echo arrayToJSON($search->types) . ";\n"; echo 'var basetypes = '; echo arrayToJSON($search->basetypes) . ";\n"; echo 'removeIcon = \'' . UI::get_icon('disable', T_('Remove')) . '\';';