Un motore di ricerca WordPress per sviluppatori e autori di temi



wp_slash ›

Da3.6.0
Deprecaton/a
wp_slash ( $value )
Parametri:
  • (string|array) $value String or array of strings to slash.
    Richiesto:
Ritorna:
  • (string|array) Slashed $value
Definito a:
Codex:

Add slashes to a string or array of strings.

This should be used when preparing data for core API that expects slashed data. This should not be used to escape data going directly into an SQL query.



Funzioni correlate: wp_unslash, wp_hash, wp_styles, wp_rss, wp_salt

Sorgenti

function wp_slash( $value ) {
	if ( is_array( $value ) ) {
		foreach ( $value as $k => $v ) {
			if ( is_array( $v ) ) {
				$value[ $k ] = wp_slash( $v );
			} else {
				$value[ $k ] = addslashes( $v );
			}
		}
	} else {
		$value = addslashes( $value );
	}

	return $value;
}