Automattic\WooCommerce\Admin\Notes
DataStore::get_escaped_arguments_array_by_key()
Parses the query arguments passed in as arrays and escapes the values.
Method of the class: DataStore{}
No Hooks.
Return
Array
. the escaped array of argument values.
Usage
// private - for code of main (parent) class only $result = $this->get_escaped_arguments_array_by_key( $args, $key, $allowed_types );
- $args(array)
- the query arguments.
Default: array() - $key(string)
- the key of the specific argument.
Default: '' - $allowed_types(array|null)
- optional allowed_types if only a specific set is allowed.
Default: null
DataStore::get_escaped_arguments_array_by_key() DataStore::get escaped arguments array by key code WC 9.7.1
private function get_escaped_arguments_array_by_key( $args = array(), $key = '', $allowed_types = null ) { $arg_array = array(); if ( isset( $args[ $key ] ) ) { foreach ( $args[ $key ] as $args_type ) { $args_type = trim( $args_type ); $allowed = is_null( $allowed_types ) || in_array( $args_type, $allowed_types, true ); if ( $allowed ) { $arg_array[] = sprintf( "'%s'", esc_sql( $args_type ) ); } } } return $arg_array; }