Automattic\WooCommerce\Admin\API\Reports\Downloads

DataStore::get_filtered_ip_addresses()protectedWC 1.0

Returns filtered comma separated ids, based on query arguments from the user.

{} It's a method of the class: DataStore{}

Hooks from the method

Return

String.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_filtered_ip_addresses( $query_args, $field );
$query_args(array) (required)
Parameters supplied by the user.
$field(string) (required)
Query field to filter.

Code of DataStore::get_filtered_ip_addresses() WC 6.6.1

protected function get_filtered_ip_addresses( $query_args, $field ) {
	if ( isset( $query_args[ $field ] ) && is_array( $query_args[ $field ] ) && count( $query_args[ $field ] ) > 0 ) {
		$ip_addresses = array_map( 'esc_sql', $query_args[ $field ] );

		/**
		 * Filter the IDs before retrieving report data.
		 *
		 * Allows filtering of the objects included or excluded from reports.
		 *
		 * @param array  $ids        List of object Ids.
		 * @param array  $query_args The original arguments for the request.
		 * @param string $field      The object type.
		 * @param string $context    The data store context.
		 */
		$ip_addresses = apply_filters( 'woocommerce_analytics_' . $field, $ip_addresses, $query_args, $field, $this->context );

		return implode( "','", $ip_addresses );
	}
	return '';
}