Automattic\WooCommerce\Internal\Abilities

AbilitiesTracking::open_frame │ private │ WC 1.0

Start tracking an invocation.

Метод класса: AbilitiesTracking{}

Хуков нет.

Возвращает

null. Ничего (null).

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

// private - только в коде основоного (родительского) класса
$result = $this->open_frame( $ability_name, $executing ): void;
$ability_name(строка) (обязательный)
The ability name.
$executing(true|false) (обязательный)
Whether execution already started (WordPress 7.0 path).

Код AbilitiesTracking::open_frame() WC 11.3.0

private function open_frame( string $ability_name, bool $executing ): void {
	// Consent is per site, and the site can change mid-request with switch_to_blog().
	if ( ! self::is_tracking_allowed() ) {
		return;
	}

	// Only agent entry points. Direct PHP and cron calls are plugin internals and could add a pixel to every page view.
	if ( ! in_array( $this->get_channel(), self::TRACKED_CHANNELS, true ) ) {
		return;
	}

	// Calls that fail without a closing hook keep their frame until shutdown. Recording the oldest one as an
	// unknown failure keeps the stack bounded and lets later closing hooks still find their own frame.
	if ( count( $this->frames ) >= self::MAX_EVENTS_PER_REQUEST ) {
		$oldest = $this->frames[0];
		array_shift( $this->frames );
		$this->add_event( $oldest, null, false );
	}

	$this->frames[] = $this->create_frame( $ability_name, $executing );
	++$this->frames_opened;
}