autocomplete: back to custom json encoding (for compat with older PHP implementations, fixed the double quotes

This commit is contained in:
Jörn Zaefferer 2010-01-28 13:27:32 +00:00
parent 961238a50b
commit de8ed36df1

View File

@ -588,13 +588,13 @@ function array_to_json( $array ){
if( is_numeric($key) ){ if( is_numeric($key) ){
$key = "key_$key"; $key = "key_$key";
} }
$key = "'".addslashes($key)."'"; $key = "\"".addslashes($key)."\"";
// Format the value: // Format the value:
if( is_array( $value )){ if( is_array( $value )){
$value = array_to_json( $value ); $value = array_to_json( $value );
} else if( !is_numeric( $value ) || is_string( $value ) ){ } else if( !is_numeric( $value ) || is_string( $value ) ){
$value = "'".addslashes($value)."'"; $value = "\"".addslashes($value)."\"";
} }
// Add to staging array: // Add to staging array: