WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

WC_Tracks_Event::validate_and_sanitize() public WC 1.0

Annotate the event with all relevant info.

Это метод класса: WC_Tracks_Event{}

Хуков нет.

Возвращает

true/false/WP_Error. True on success, WP_Error on failure.

Использование

$result = WC_Tracks_Event::validate_and_sanitize( $event );
$event(массив) (обязательный)
Event arguments.

Код WC_Tracks_Event::validate_and_sanitize() WC 4.5.2

woocommerce/includes/tracks/class-wc-tracks-event.php
<?php
public static function validate_and_sanitize( $event ) {
	$event = (object) $event;

	// Required.
	if ( ! $event->_en ) {
		return new WP_Error( 'invalid_event', 'A valid event must be specified via `_en`', 400 );
	}

	// Delete non-routable addresses otherwise geoip will discard the record entirely.
	if ( property_exists( $event, '_via_ip' ) && preg_match( '/^192\.168|^10\./', $event->_via_ip ) ) {
		unset( $event->_via_ip );
	}

	$validated = array(
		'browser_type' => WC_Tracks_Client::BROWSER_TYPE,
	);

	$_event = (object) array_merge( (array) $event, $validated );

	// If you want to blacklist property names, do it here.
	// Make sure we have an event timestamp.
	if ( ! isset( $_event->_ts ) ) {
		$_event->_ts = WC_Tracks_Client::build_timestamp();
	}

	return $_event;
}