protected function get_set($key = null, $set_value = null, &$value) { $key = $this->prepare_key($key); if ($set_value === null) { // get return tf_stripslashes_deep_keys($key === null ? $value : tf_akg($key, $value)); } else { // set tf_aks($key, tf_addslashes_deep_keys($set_value), $value); } }
/** * Strip slashes from values, and from keys if magic_quotes_gpc = On */ function tf_stripslashes_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) ? stripslashes($key) : $key] = tf_stripslashes_deep_keys($value); } $value = $new_value; unset($new_value); } else { $value = array_map('tf_stripslashes_deep_keys', $value); } } elseif (is_object($value)) { $vars = get_object_vars($value); foreach ($vars as $key => $data) { $value->{$key} = tf_stripslashes_deep_keys($data); } } elseif (is_string($value)) { $value = stripslashes($value); } return $value; }