protected static function get_set_key($multikey = null, $set_value = null, &$value) { $multikey = self::prepare_key($multikey); if ($set_value === null) { // get return fw_stripslashes_deep_keys($multikey === null ? $value : fw_akg($multikey, $value)); } else { // set fw_aks($multikey, fw_addslashes_deep_keys($set_value), $value); } }
/** * Add slashes to values, and to keys if magic_quotes_gpc = On */ function fw_addslashes_deep_keys($value) { static $magic_quotes = null; if ($magic_quotes === null) { $magic_quotes = get_magic_quotes_gpc(); } if (is_array($value)) { if ($magic_quotes) { $new_value = array(); foreach ($value as $key => $value) { $new_value[is_string($key) ? addslashes($key) : $key] = fw_addslashes_deep_keys($value); } $value = $new_value; unset($new_value); } else { $value = array_map('fw_addslashes_deep_keys', $value); } } elseif (is_object($value)) { $vars = get_object_vars($value); foreach ($vars as $key => $data) { $value->{$key} = fw_addslashes_deep_keys($data); } } elseif (is_string($value)) { $value = addslashes($value); } return $value; }