plugin updates

This commit is contained in:
Tony Volpe
2024-09-05 11:04:01 -04:00
parent ed6b060261
commit 50cd64dd3d
925 changed files with 16918 additions and 13003 deletions

View File

@@ -209,6 +209,7 @@ class WC_Site_Tracking {
include_once WC_ABSPATH . 'includes/tracks/events/class-wc-order-tracking.php';
include_once WC_ABSPATH . 'includes/tracks/events/class-wc-coupon-tracking.php';
include_once WC_ABSPATH . 'includes/tracks/events/class-wc-theme-tracking.php';
include_once WC_ABSPATH . 'includes/tracks/events/class-wc-product-collection-block-tracking.php';
$tracking_classes = array(
'WC_Extensions_Tracking',
@@ -221,6 +222,7 @@ class WC_Site_Tracking {
'WC_Order_Tracking',
'WC_Coupon_Tracking',
'WC_Theme_Tracking',
'WC_Product_Collection_Block_Tracking',
);
foreach ( $tracking_classes as $tracking_class ) {
@@ -233,5 +235,26 @@ class WC_Site_Tracking {
}
}
/**
* Sets a cookie for tracking purposes, but only if tracking is enabled/allowed.
*
* @internal
* @since 9.2.0
*
* @param string $cookie_key The key of the cookie.
* @param string $cookie_value The value of the cookie.
* @param int $expire Expiry of the cookie.
* @param bool $secure Whether the cookie should be served only over https.
* @param bool $http_only Whether the cookie is only accessible over HTTP.
*
* @return bool If setting the cookie was attempted (will be false if tracking is not allowed).
*/
public static function set_tracking_cookie( string $cookie_key, string $cookie_value, int $expire = 0, bool $secure = false, bool $http_only = false ): bool {
if ( self::is_tracking_enabled() ) {
wc_setcookie( $cookie_key, $cookie_value, $expire, $secure, $http_only );
return true;
}
return false;
}
}