wp_xmlrpc_server::escape()publicWP 1.5.2

Escapes string or array of strings for database.

Method of the class: wp_xmlrpc_server{}

No Hooks.

Return

String|null. Returns with string is passed, alters by-reference when array is passed.

Usage

$wp_xmlrpc_server = new wp_xmlrpc_server();
$wp_xmlrpc_server->escape( $data );
$data(string|array) (required) (passed by reference — &)
Escape single string or array of strings.

Changelog

Since 1.5.2 Introduced.

wp_xmlrpc_server::escape() code WP 6.5.2

public function escape( &$data ) {
	if ( ! is_array( $data ) ) {
		return wp_slash( $data );
	}

	foreach ( $data as &$v ) {
		if ( is_array( $v ) ) {
			$this->escape( $v );
		} elseif ( ! is_object( $v ) ) {
			$v = wp_slash( $v );
		}
	}
}