Automattic\WooCommerce\Admin\Notes
DataStore::get_escaped_arguments_array_by_key
Parses the query arguments passed in as arrays and escapes the values.
Метод класса: DataStore{}
Хуков нет.
Возвращает
array. the escaped array of argument values.
Использование
// private - только в коде основоного (родительского) класса $result = $this->get_escaped_arguments_array_by_key( $args, $key, $allowed_types );
- $args(массив)
- the query arguments.
По умолчанию:array() - $key(строка)
- the key of the specific argument.
По умолчанию:'' - $allowed_types(массив|null)
- optional allowed_types if only a specific set is allowed.
По умолчанию:null
Код DataStore::get_escaped_arguments_array_by_key() DataStore::get escaped arguments array by key WC 11.3.0
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;
}