Automattic\WooCommerce\Internal\Abilities
AbilitiesTracking::handle_init
Attach the tracking hooks when the store allows usage tracking, or on multisite.
Consent is per site and a request can switch sites, so on multisite the hooks are always attached and consent is checked for each call instead.
Метод класса: AbilitiesTracking{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$AbilitiesTracking = new AbilitiesTracking(); $AbilitiesTracking->handle_init(): void;
Код AbilitiesTracking::handle_init() AbilitiesTracking::handle init WC 11.3.0
public function handle_init(): void {
if ( ! is_multisite() && ! self::is_tracking_allowed() ) {
return;
}
add_action( 'wp_ability_invoked', array( $this, 'handle_wp_ability_invoked' ) );
add_filter( 'wp_ability_normalize_input', array( $this, 'handle_wp_ability_normalize_input' ), PHP_INT_MAX, 2 );
add_filter( 'wp_pre_execute_ability', array( $this, 'handle_wp_pre_execute_ability' ), PHP_INT_MAX, 2 );
add_filter( 'wp_ability_validate_input', array( $this, 'handle_wp_ability_validate_input' ), PHP_INT_MAX, 3 );
add_filter( 'wp_ability_permission_result', array( $this, 'handle_wp_ability_permission_result' ), PHP_INT_MAX, 2 );
add_action( 'wp_before_execute_ability', array( $this, 'handle_wp_before_execute_ability' ) );
add_filter( 'wp_ability_execute_result', array( $this, 'handle_wp_ability_execute_result' ), PHP_INT_MAX, 2 );
add_filter( 'wp_ability_validate_output', array( $this, 'handle_wp_ability_validate_output' ), PHP_INT_MAX, 3 );
add_action( 'wp_after_execute_ability', array( $this, 'handle_wp_after_execute_ability' ), 10, 2 );
add_filter( 'mcp_adapter_pre_tool_call', array( $this, 'handle_mcp_adapter_pre_tool_call' ) );
add_filter( 'rest_request_before_callbacks', array( $this, 'handle_rest_request_before_callbacks' ), 10, 3 );
add_filter( 'rest_request_after_callbacks', array( $this, 'handle_rest_request_after_callbacks' ), 10, 3 );
// Last, so ability calls made by other shutdown handlers are recorded too.
add_action( 'shutdown', array( $this, 'handle_shutdown' ), PHP_INT_MAX );
}