File: /var/www/vhosts/uyarreklam.com.tr/httpdocs/Tracks.php.tar
vhosts/uyarreklam.com.tr/httpdocs/wp-content/plugins/google-listings-and-ads/src/Tracking/Tracks.php0000644 00000003363 15154671015 0031331 0 ustar 00 var/www <?php
declare( strict_types=1 );
namespace Automattic\WooCommerce\GoogleListingsAndAds\Tracking;
use Automattic\WooCommerce\GoogleListingsAndAds\Options\OptionsAwareInterface;
use Automattic\WooCommerce\GoogleListingsAndAds\Options\OptionsAwareTrait;
use Automattic\WooCommerce\GoogleListingsAndAds\PluginHelper;
use Automattic\WooCommerce\GoogleListingsAndAds\Proxies\Tracks as TracksProxy;
/**
* Tracks implementation for Google for WooCommerce.
*
* @package Automattic\WooCommerce\GoogleListingsAndAds\Tracking
*/
class Tracks implements TracksInterface, OptionsAwareInterface {
use OptionsAwareTrait;
use PluginHelper;
/**
* @var TracksProxy
*/
protected $tracks;
/**
* Tracks constructor.
*
* @param TracksProxy $tracks The proxy tracks object.
*/
public function __construct( TracksProxy $tracks ) {
$this->tracks = $tracks;
}
/**
* Record an event in Tracks - this is the preferred way to record events from PHP.
*
* @param string $event_name The name of the event.
* @param array $properties Custom properties to send with the event.
*/
public function record_event( $event_name, $properties = [] ) {
// Include base properties.
$base_properties = [
"{$this->get_slug()}_version" => $this->get_version(),
];
// Include connected accounts (if connected).
if ( $this->options->get_ads_id() ) {
$base_properties[ "{$this->get_slug()}_ads_id" ] = $this->options->get_ads_id();
}
if ( $this->options->get_merchant_id() ) {
$base_properties[ "{$this->get_slug()}_mc_id" ] = $this->options->get_merchant_id();
}
$properties = array_merge( $base_properties, $properties );
$full_event_name = "{$this->get_slug()}_{$event_name}";
$this->tracks->record_event( $full_event_name, $properties );
}
}
httpdocs/wp-content/plugins/woocommerce/src/Admin/Features/ProductBlockEditor/Tracks.php 0000644 00000002263 15154772511 0034044 0 ustar 00 var/www/vhosts/uyarreklam.com.tr <?php
/**
* WooCommerce Product Block Editor
*/
namespace Automattic\WooCommerce\Admin\Features\ProductBlockEditor;
/**
* Add tracks for the product block editor.
*/
class Tracks {
/**
* Initialize the tracks.
*/
public function init() {
add_filter( 'woocommerce_product_source', array( $this, 'add_product_source' ) );
}
/**
* Check if a URL is a product editor page.
*
* @param string $url Url to check.
* @return boolean
*/
protected function is_product_editor_page( $url ) {
$query_string = wp_parse_url( wp_get_referer(), PHP_URL_QUERY );
parse_str( $query_string, $query );
if ( ! isset( $query['page'] ) || 'wc-admin' !== $query['page'] || ! isset( $query['path'] ) ) {
return false;
}
$path_pieces = explode( '/', $query['path'] );
$route = $path_pieces[1];
return 'add-product' === $route || 'product' === $route;
}
/**
* Update the product source if we're on the product editor page.
*
* @param string $source Source of product.
* @return string
*/
public function add_product_source( $source ) {
if ( $this->is_product_editor_page( wp_get_referer() ) ) {
return 'product-block-editor-v1';
}
return $source;
}
}
vhosts/uyarreklam.com.tr/httpdocs/wp-content/plugins/google-listings-and-ads/src/Proxies/Tracks.php 0000644 00000001272 15155144114 0031211 0 ustar 00 var/www <?php
declare( strict_types=1 );
namespace Automattic\WooCommerce\GoogleListingsAndAds\Proxies;
use WC_Tracks;
/**
* Class Tracks
*
* @package Automattic\WooCommerce\GoogleListingsAndAds\Proxies
*/
class Tracks {
/**
* Record a tracks event.
*
* @param string $name The event name to record.
* @param array $properties Array of properties to include with the event.
*/
public function record_event( string $name, array $properties = [] ): void {
if ( class_exists( WC_Tracks::class ) ) {
WC_Tracks::record_event( $name, $properties );
} elseif ( function_exists( 'wc_admin_record_tracks_event' ) ) {
wc_admin_record_tracks_event( $name, $properties );
}
}
}