PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3-a.7
Jetpack – WP Security, Backup, Speed, & Growth v16.3-a.7
16.3-a.5 16.3-a.7 16.3-a.3 16.3-a.1 16.2 16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 13.7.2 13.8.3 All 506 releases
← All changes | modules/woocommerce-analytics/classes/class-jetpack-woocommerce-analytics-trait.php +9 -40 13.3.3 → 16.3-a.7 View file →
@@ -11,9 +11,9 @@
11 11 /**
12 12 * Bail if accessed directly
13 13 */
14 14 if ( ! defined( 'ABSPATH' ) ) {
15 - exit;
15 + exit( 0 );
16 16 }
17 17
18 18 /**
19 19 * Jetpack_WooCommerce_Analytics_Trait
@@ -88,9 +88,9 @@
88 88 }
89 89 $products[] = $data;
90 90 }
91 91
92 - return wp_json_encode( $products );
92 + return wp_json_encode( $products, JSON_UNESCAPED_SLASHES );
93 93 }
94 94
95 95 /**
96 96 * Get Cart/Checkout page view shared data
@@ -213,21 +213,8 @@
213 213 $cart_template = get_block_template( 'woocommerce/woocommerce//cart' );
214 214 }
215 215 }
216 216
217 - if ( function_exists( 'gutenberg_get_block_template' ) ) {
218 - $checkout_template = gutenberg_get_block_template( 'woocommerce/woocommerce//page-checkout' );
219 - $cart_template = gutenberg_get_block_template( 'woocommerce/woocommerce//page-cart' );
220 -
221 - if ( ! $checkout_template ) {
222 - $checkout_template = gutenberg_get_block_template( 'woocommerce/woocommerce//checkout' );
223 - }
224 -
225 - if ( ! $cart_template ) {
226 - $cart_template = gutenberg_get_block_template( 'woocommerce/woocommerce//cart' );
227 - }
228 - }
229 -
230 217 if ( ! empty( $checkout_template->content ) ) {
231 218 // Checkout template is in use, but we need to see if the page-content-wrapper is in use, or if the template is being used directly.
232 219 $this->checkout_content_source = $checkout_template->content;
233 220 $is_using_page_content = str_contains( $checkout_template->content, '<!-- wp:woocommerce/page-content-wrapper {"page":"checkout"}' );
@@ -290,28 +277,8 @@
290 277 $cart_checkout_info = $this->get_cart_checkout_info();
291 278 return array_merge( $site_info, $cart_checkout_info );
292 279 }
293 280
294 - /**
295 - * Render tracks event properties as string of JavaScript object props.
296 - *
297 - * @deprecated 13.3
298 - *
299 - * @param array $properties Array of key/value pairs.
300 - * @return string String of the form "key1: value1, key2: value2, " (etc).
301 - */
302 - private function render_properties_as_js( $properties ) {
303 - $js_args_string = '';
304 - foreach ( $properties as $key => $value ) {
305 - if ( is_array( $value ) ) {
306 - $js_args_string = $js_args_string . "'$key': " . wp_json_encode( $value ) . ',';
307 - } else {
308 - $js_args_string = $js_args_string . "'$key': '" . esc_js( $value ) . "', ";
309 - }
310 - }
311 - return $js_args_string;
312 - }
313 -
314 281 /**
315 282 * Record an event with optional product and custom properties.
316 283 *
317 284 * @deprecated 13.3
@@ -413,17 +380,19 @@
413 380 $properties
414 381 )
415 382 );
416 383
417 - $js = "{'_en': '" . esc_js( $event_name ) . "'";
418 -
419 384 if ( isset( $product_details ) ) {
420 385 $all_props = array_merge( $all_props, $product_details );
421 386 }
422 387
423 - $js .= ',' . $this->render_properties_as_js( $all_props ) . '}';
424 -
425 - return $js;
388 + return wp_json_encode(
389 + array_merge(
390 + array( '_en' => $event_name ),
391 + $all_props
392 + ),
393 + JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP
394 + );
426 395 }
427 396
428 397 /**
429 398 * Get the current user id