HEX
Server: LiteSpeed
System: Linux eko108.isimtescil.net 4.18.0-477.21.1.lve.1.el8.x86_64 #1 SMP Tue Sep 5 23:08:35 UTC 2023 x86_64
User: uyarreklamcomtr (11202)
PHP: 7.4.33
Disabled: opcache_get_status
Upload Files
File: /var/www/vhosts/uyarreklam.com.tr/httpdocs/Events.tar
ActivatedEvents.php000064400000004237151547532160010365 0ustar00<?php
declare( strict_types=1 );

namespace Automattic\WooCommerce\GoogleListingsAndAds\Tracking\Events;

use Automattic\WooCommerce\GoogleListingsAndAds\Infrastructure\Activateable;

/**
 * This class adds actions to track when the extension is activated.
 * *
 *
 * @package Automattic\WooCommerce\GoogleListingsAndAds\Tracking
 */
class ActivatedEvents extends BaseEvent implements Activateable {

	/**
	 * The page where activation with a source can occur.
	 */
	public const ACTIVATION_PAGE = 'plugin-install.php';

	/**
	 * The query parameters used to determine activation source details.
	 */
	public const SOURCE_PARAMS = [
		'utm_source',
		'utm_medium',
		'utm_campaign',
		'utm_term',
		'utm_content',
	];

	/**
	 * @var array The request SERVER variables.
	 */
	private $server_vars;

	/**
	 * ActivatedEvents constructor.
	 *
	 * @param array $server_vars The request SERVER variables.
	 */
	public function __construct( array $server_vars ) {
		$this->server_vars = $server_vars;
	}

	/**
	 * Nothing to register (method invoked manually).
	 */
	public function register(): void {}

	/**
	 * Track when the extension is activated from a source.
	 */
	public function maybe_track_activation_source(): void {
		// Skip WP-CLI activations
		if ( empty( $this->server_vars['HTTP_REFERER'] ) ) {
			return;
		}

		$url_components = wp_parse_url( $this->server_vars['HTTP_REFERER'] );
		// Skip invalid URLs or URLs missing parts
		if ( ! is_array( $url_components ) || empty( $url_components['query'] ) || empty( $url_components['path'] ) ) {
			return;
		}

		// Skip activations from anywhere except the Add Plugins page
		if ( false === strstr( $url_components['path'], self::ACTIVATION_PAGE ) ) {
			return;
		}

		wp_parse_str( $url_components['query'], $query_vars );
		$available_source_params = array_intersect_key( $query_vars, array_flip( self::SOURCE_PARAMS ) );
		// Skip if no source params are present
		if ( empty( $available_source_params ) ) {
			return;
		}

		$this->record_event( 'activated_from_source', $available_source_params );
	}

	/**
	 * Activate the service.
	 *
	 * @return void
	 */
	public function activate(): void {
		$this->maybe_track_activation_source();
	}
}
BaseEvent.php000064400000001564151547532170007151 0ustar00<?php
declare( strict_types=1 );

namespace Automattic\WooCommerce\GoogleListingsAndAds\Tracking\Events;

use Automattic\WooCommerce\GoogleListingsAndAds\PluginHelper;
use Automattic\WooCommerce\GoogleListingsAndAds\Tracking\TracksAwareInterface;
use Automattic\WooCommerce\GoogleListingsAndAds\Tracking\TracksAwareTrait;

/**
 * Class BaseEvent
 *
 * @package Automattic\WooCommerce\GoogleListingsAndAds\Tracking\Events
 */
abstract class BaseEvent implements TracksEventInterface, TracksAwareInterface {

	use TracksAwareTrait;
	use PluginHelper;

	/**
	 * Record an event using the Tracks instance.
	 *
	 * @param string $event_name The event name to record.
	 * @param array  $properties (Optional) Properties to record with the event.
	 */
	protected function record_event( string $event_name, $properties = [] ) {
		$this->tracks->record_event( $event_name, $properties );
	}
}
GenericEvents.php000064400000001637151547532170010037 0ustar00<?php
declare( strict_types=1 );

namespace Automattic\WooCommerce\GoogleListingsAndAds\Tracking\Events;

/**
 * This class adds an action to track a generic event, which can be triggered by:
 * `do_action( 'woocommerce_gla_track_event', 'event_name', $properties )`
 *
 * @since 2.5.16
 *
 * @package Automattic\WooCommerce\GoogleListingsAndAds\Tracking
 */
class GenericEvents extends BaseEvent {

	/**
	 * Register the tracking class.
	 */
	public function register(): void {
		add_action( 'woocommerce_gla_track_event', [ $this, 'track_event' ], 10, 2 );
	}

	/**
	 * Track a generic event providing event name and optional list of properties.
	 *
	 * @param string $event_name Event name to record.
	 * @param array  $properties Optional additional properties to pass with the event.
	 */
	public function track_event( string $event_name, array $properties = [] ) {
		$this->record_event( $event_name, $properties );
	}
}
SiteClaimEvents.php000064400000005725151547532170010337 0ustar00<?php
declare( strict_types=1 );

namespace Automattic\WooCommerce\GoogleListingsAndAds\Tracking\Events;

/**
 * This class adds actions to track for Site Claim actions:
 * - Site claim required
 * - Site claim success
 * - Site claim failure
 * - Merchant Center URL switch
 *
 * @package Automattic\WooCommerce\GoogleListingsAndAds\Tracking
 */
class SiteClaimEvents extends BaseEvent {

	/**
	 * Register the tracking class.
	 */
	public function register(): void {
		add_action( 'woocommerce_gla_site_claim_overwrite_required', [ $this, 'track_site_claim_overwrite_required' ] );
		add_action( 'woocommerce_gla_site_claim_success', [ $this, 'track_site_claim_success' ] );
		add_action( 'woocommerce_gla_site_claim_failure', [ $this, 'track_site_claim_failure' ] );
		add_action( 'woocommerce_gla_url_switch_required', [ $this, 'track_url_switch_required' ] );
		add_action( 'woocommerce_gla_url_switch_success', [ $this, 'track_url_switch_success' ] );
	}

	/**
	 * Track when a site claim needs to be overwritten.
	 *
	 * @param array $properties Optional additional properties to pass with the event.
	 */
	public function track_site_claim_overwrite_required( array $properties = [] ): void {
		$properties['action'] = 'overwrite_required';
		$this->track_site_claim_event( $properties );
	}

	/**
	 * Track when a site is claimed successfully.
	 *
	 * @param array $properties Optional additional properties to pass with the event.
	 */
	public function track_site_claim_success( array $properties = [] ): void {
		$properties['action'] = 'success';
		$this->track_site_claim_event( $properties );
	}

	/**
	 * Track when a site fails to be claimed.
	 *
	 * @param array $properties Optional additional properties to pass with the event.
	 */
	public function track_site_claim_failure( array $properties = [] ): void {
		$properties['action'] = 'failure';
		$this->track_site_claim_event( $properties );
	}

	/**
	 * Track the generic site claim event with the action property.
	 *
	 * @param array $properties
	 */
	protected function track_site_claim_event( array $properties = [] ): void {
		$this->record_event( 'site_claim', $properties );
	}

	/**
	 * Track when a site requires a URL switch
	 *
	 * @param array $properties Optional additional properties to pass with the event.
	 */
	public function track_url_switch_required( array $properties = [] ): void {
		$properties['action'] = 'required';
		$this->track_url_switch_event( $properties );
	}

	/**
	 * Track when a site executes a successful URL switch
	 *
	 * @param array $properties Optional additional properties to pass with the event.
	 */
	public function track_url_switch_success( array $properties = [] ): void {
		$properties['action'] = 'success';
		$this->track_url_switch_event( $properties );
	}

	/**
	 * Track the generic url switch event with the action property.
	 *
	 * @param array $properties
	 */
	protected function track_url_switch_event( array $properties = [] ): void {
		$this->record_event( 'mc_url_switch', $properties );
	}
}
SiteVerificationEvents.php000064400000002202151547532200011711 0ustar00<?php
declare( strict_types=1 );

namespace Automattic\WooCommerce\GoogleListingsAndAds\Tracking\Events;

/**
 * This class adds actions to track when Site Verification is attempted (succeeds/fails).
 *
 * @package Automattic\WooCommerce\GoogleListingsAndAds\Tracking
 */
class SiteVerificationEvents extends BaseEvent {

	/**
	 * Register the tracking class.
	 */
	public function register(): void {
		add_action( 'woocommerce_gla_site_verify_success', [ $this, 'track_site_verify_success' ] );
		add_action( 'woocommerce_gla_site_verify_failure', [ $this, 'track_site_verify_failure' ] );
	}

	/**
	 * Track when a site is verified
	 *
	 * @param array $properties Optional additional properties to pass with the event.
	 */
	public function track_site_verify_success( array $properties = [] ): void {
		$this->record_event( 'site_verify_success', $properties );
	}

	/**
	 * Track when a site fails to be verified.
	 *
	 * @param array $properties Optional additional properties to pass with the event.
	 */
	public function track_site_verify_failure( array $properties = [] ): void {
		$this->record_event( 'site_verify_failure', $properties );
	}
}
TracksEventInterface.php000064400000000553151547532200011336 0ustar00<?php
declare( strict_types=1 );

namespace Automattic\WooCommerce\GoogleListingsAndAds\Tracking\Events;

use Automattic\WooCommerce\GoogleListingsAndAds\Infrastructure\Registerable;

/**
 * Interface describing an event tracker class.
 *
 * @package Automattic\WooCommerce\GoogleListingsAndAds\Tracking
 */
interface TracksEventInterface extends Registerable {}