PluginProbe
NotificationX – FOMO, Live Sales Notification, WooCommerce Sales Popup, GDPR, Social Proof, Announcement Banner & Floating Notification Bar / 3.3.3
NotificationX – FOMO, Live Sales Notification, WooCommerce Sales Popup, GDPR, Social Proof, Announcement Banner & Floating Notification Bar v3.3.3
3.3.3 3.3.2 3.3.1 3.3.0 3.2.14 3.2.13 3.2.12 3.2.11 3.2.10 3.2.9 3.2.8 3.2.7 trunk 0.2.5.5 0.2.5.6 0.2.5.7 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 All 158 releases
← All changes | includes/Extensions/WooCommerce/WooCommerce.php +46 -5 3.2.7 → 3.3.3 View file →
@@ -353,9 +353,9 @@
353 353 if ( isset($product) && $product->get_type() === 'variation' ) {
354 354 $new_order['var_product_id'] = $item->get_variation_id();
355 355 }
356 356 $new_order['product_id'] = $item->get_product_id();
357 - $new_order['title'] = strip_tags($product_data['title']);
357 + $new_order['title'] = wp_strip_all_tags($product_data['title']);
358 358 $new_order['link'] = $product_data['link'];
359 359 }
360 360 if($date && method_exists($date, 'getTimestamp')){
361 361 $new_order['timestamp'] = $date->getTimestamp();
@@ -428,9 +428,9 @@
428 428 public function get_orders($data = array()) {
429 429 if (empty($data) || !function_exists('wc_get_orders')) return null;
430 430 $orders = [];
431 431 $time = Helper::generate_time_string($data);
432 - $from = strtotime(date('Y-m-d h:i', $time));
432 + $from = strtotime(gmdate('Y-m-d h:i', $time));
433 433 $status = !empty($data['order_status']) ? $data['order_status'] : ['wc-completed', 'wc-processing'];
434 434 $wc_orders = \wc_get_orders([
435 435 'status' => $status,
436 436 'date_created' => '>' . $from,
@@ -467,8 +467,9 @@
467 467
468 468
469 469 public function wpml_translate($entry, $settings) {
470 470 if(!empty($entry['product_id'])){
471 + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context.
471 472 $product_id = apply_filters( 'wpml_object_id', $entry['product_id'], 'product', false);
472 473 $product = wc_get_product($product_id);
473 474 if($product){
474 475 // $current_lang = apply_filters( 'wpml_current_language', NULL );
@@ -489,8 +490,9 @@
489 490 return $link;
490 491 }
491 492
492 493 public function multiorder_combine($data, $settings) {
494 + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context.
493 495 $should_combine = apply_filters('nx_should_combine', true, $data, $settings);
494 496 if (!$should_combine || empty($settings['combine_multiorder']) || intval($settings['combine_multiorder']) != 1 ) {
495 497 return $data;
496 498 }
@@ -495,8 +497,9 @@
495 497 return $data;
496 498 }
497 499 $items = [];
498 500 $item_counts = [];
501 + $item_titles = [];
499 502 foreach ($data as $key => $item) {
500 503 $order_id = isset( $item['order_id'] ) ? $item['order_id'] : ( isset( $item['id'] ) ? $item['id'] : null );
501 504 if( $order_id === null ) {
502 505 continue;
@@ -504,15 +507,52 @@
504 507 if (!isset($items[$order_id])) {
505 508 $items[$order_id] = $item;
506 509 } else {
507 510 $item_counts[$order_id] = isset($item_counts[$order_id]) ? ++$item_counts[$order_id] : 1;
511 + if ( isset( $item['title'] ) ) {
512 + $item_titles[$order_id][] = $item['title'];
513 + }
508 514 }
509 515 }
510 516
511 - $products_more_title = isset($settings['combine_multiorder_text']) && !empty($settings['combine_multiorder_text']) ? __($settings['combine_multiorder_text'], 'notificationx') : __('more products', 'notificationx');
517 + $display = !empty($settings['combine_multiorder_display'])
518 + ? $settings['combine_multiorder_display']
519 + : 'count';
520 +
512 521 foreach ($item_counts as $key => $item) {
513 - // translators: %1$s: title, %2$s: number of product, %3$s: Combine Multi Order Text.
514 - $items[$key]['title'] = sprintf(__('%1$s & %2$s %3$s', 'notificationx'), $items[$key]['title'], $item, $products_more_title);
522 +
523 + if ( $display === 'list' && ! empty( $item_titles[$key] ) ) {
524 + // List the actual product names, e.g. "Product A & Product B".
525 + $products_more_title = implode(
526 + __(' & ', 'notificationx'),
527 + $item_titles[$key]
528 + );
529 + } else {
530 + $singular = !empty($settings['combine_multiorder_text'])
531 + ? $settings['combine_multiorder_text']
532 + : __('more product', 'notificationx');
533 +
534 + $plural = !empty($settings['combine_multiorder_text_plural'])
535 + ? $settings['combine_multiorder_text_plural']
536 + : __('more products', 'notificationx');
537 +
538 + // Both forms are already resolved here - either a user-entered
539 + // override or an already-translated default - so they are never
540 + // catalogue msgids. _n() would find no entry and fall back to
541 + // exactly this choice, so make it explicit.
542 + $more_product_text = sprintf(
543 + 1 == $item ? $singular : $plural,
544 + $item
545 + );
546 + $products_more_title = sprintf('%d %s', $item, $more_product_text);
547 + }
548 +
549 + $items[$key]['title'] = sprintf(
550 + /* translators: %1$s: product title, %2$s: combined "and N more products" text */
551 + __('%1$s & %2$s', 'notificationx'),
552 + $items[$key]['title'],
553 + $products_more_title
554 + );
515 555 }
516 556
517 557 // @todo maybe sort
518 558 return $items;
@@ -567,8 +607,9 @@
567 607 return $data;
568 608 }
569 609
570 610 public function doc(){
611 + /* translators: %1$s: WooCommerce installed & activated link URL, %2$s: documentation link URL, %3$s: Watch video tutorial link URL, %4$s: Best FOMO and Social Proof Plugin link URL, %5$s: boost WooCommerce Sales link URL */
571 612 return sprintf(__('<p>Make sure that you have <a target="_blank" href="%1$s">WooCommerce installed & activated</a> to use this campaign. For further assistance, check out our step by step <a target="_blank" href="%2$s">documentation</a>.</p>
572 613 <p>🎦 <a href="%3$s" target="_blank">Watch video tutorial</a> to learn quickly</p>
573 614 <p>⭐ NotificationX Integration with WooCommerce</p>
574 615 <p><strong>Recommended Blog:</strong></p>