CTX Feed – WooCommerce Product Feed Manager Plugin - Version 4.4.53

Version Description

(2022-03-08) = * Updated: Content IDs argument updated for Facebook Pixel. * Fixed: Schema prices has been fixed according to product attribute variant products.

Download this release

Release Info

Developer wahid0003
Plugin Icon 128x128 CTX Feed – WooCommerce Product Feed Manager Plugin
Version 4.4.53
Comparing to
See all releases

Code changes from version 4.4.52 to 4.4.53

README.txt CHANGED
@@ -5,7 +5,7 @@ Tags: WooCommerce Product Feed, WooCommerce, Google Shopping, Google Merchant, F
5
  Requires at least: 4.4
6
  Tested Up To: 5.8.2
7
  Requires PHP: 5.6
8
- Stable tag: 4.4.52
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -590,6 +590,10 @@ Using pro version:
590
 
591
  == Changelog ==
592
 
 
 
 
 
593
  = 4.4.52 (2022-03-01) =
594
  * Fixed: Decimal and Thousand seperator does not work - issue has been fixed.
595
  * Fixed: Category mapping not saving for facebook - issue has been fixed.
5
  Requires at least: 4.4
6
  Tested Up To: 5.8.2
7
  Requires PHP: 5.6
8
+ Stable tag: 4.4.53
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
590
 
591
  == Changelog ==
592
 
593
+ = 4.4.53 (2022-03-08) =
594
+ * Updated: Content IDs argument updated for Facebook Pixel.
595
+ * Fixed: Schema prices has been fixed according to product attribute variant products.
596
+
597
  = 4.4.52 (2022-03-01) =
598
  * Fixed: Decimal and Thousand seperator does not work - issue has been fixed.
599
  * Fixed: Category mapping not saving for facebook - issue has been fixed.
admin/class-woo-feed-admin.php CHANGED
@@ -106,12 +106,12 @@ class Woo_Feed_Admin {
106
 
107
  //dequeue unnecessary scripts from loading
108
  $js_dequeue_handles = woo_feed_get_js_dequeue_handles_list();
109
- if( isset($_GET['page']) ) {
110
- $woo_feed_plugin_pages = woo_feed_get_plugin_pages_slugs();
111
 
112
- if( in_array($_GET['page'], $woo_feed_plugin_pages) ) {
113
- if( isset($js_dequeue_handles) && !empty($js_dequeue_handles) ) {
114
- foreach($js_dequeue_handles as $script_handle) {
115
  wp_dequeue_script($script_handle);
116
  }
117
  }
@@ -151,10 +151,10 @@ class Woo_Feed_Admin {
151
 
152
  //get feed options with which feed is previously generated
153
  $feed_rules = "";
154
- if (isset($_GET['feed'])) {
155
  $filename = str_replace('wf_feed_', '', wp_unslash($_GET['feed']));
156
  $feed_options = maybe_unserialize(get_option('wf_feed_' . $filename));
157
- if( isset($feed_options['feedrules']) ) {
158
  $feed_rules = $feed_options['feedrules'];
159
  }
160
  }
@@ -198,10 +198,10 @@ class Woo_Feed_Admin {
198
  'nonce' => wp_create_nonce( 'wpf_feed_nonce' ),
199
  'error' => esc_html__( 'There was an error processing ajax request.', 'woo-feed' ),
200
  ],
201
- 'woocommerce' => [
202
- 'currency' => get_option( 'woocommerce_currency' ),
203
- 'weight' => get_option('woocommerce_weight_unit'),
204
- 'dimension' => get_option('woocommerce_dimension_unit')
205
  ],
206
  );
207
  // phpcs:ignore WordPress.Security.NonceVerification.Recommended
106
 
107
  //dequeue unnecessary scripts from loading
108
  $js_dequeue_handles = woo_feed_get_js_dequeue_handles_list();
109
+ if ( isset($_GET['page']) ) {
110
+ $woo_feed_plugin_pages = woo_feed_get_plugin_pages_slugs();
111
 
112
+ if ( in_array($_GET['page'], $woo_feed_plugin_pages) ) {
113
+ if ( isset($js_dequeue_handles) && ! empty($js_dequeue_handles) ) {
114
+ foreach ( $js_dequeue_handles as $script_handle ) {
115
  wp_dequeue_script($script_handle);
116
  }
117
  }
151
 
152
  //get feed options with which feed is previously generated
153
  $feed_rules = "";
154
+ if ( isset($_GET['feed']) ) {
155
  $filename = str_replace('wf_feed_', '', wp_unslash($_GET['feed']));
156
  $feed_options = maybe_unserialize(get_option('wf_feed_' . $filename));
157
+ if ( isset($feed_options['feedrules']) ) {
158
  $feed_rules = $feed_options['feedrules'];
159
  }
160
  }
198
  'nonce' => wp_create_nonce( 'wpf_feed_nonce' ),
199
  'error' => esc_html__( 'There was an error processing ajax request.', 'woo-feed' ),
200
  ],
201
+ 'woocommerce' => [
202
+ 'currency' => get_option( 'woocommerce_currency' ),
203
+ 'weight' => get_option('woocommerce_weight_unit'),
204
+ 'dimension' => get_option('woocommerce_dimension_unit'),
205
  ],
206
  );
207
  // phpcs:ignore WordPress.Security.NonceVerification.Recommended
admin/class-woo-feed-manage-list.php CHANGED
@@ -102,7 +102,6 @@ class Woo_Feed_Manage_list extends Woo_Feed_List_Table {
102
  case 'last_updated':
103
  return $itemInfo[ $column_name ];
104
  case 'view':
105
-
106
  $export_url = wp_nonce_url( admin_url( 'admin-post.php?action=wf_export_feed&feed=' . $getItem ), 'wpf-export' );
107
  $log_download_url = wp_nonce_url( admin_url( 'admin-post.php?action=wf_download_feed_log&feed=' . $getItem ), 'wpf-log-download' );
108
 
@@ -159,7 +158,7 @@ class Woo_Feed_Manage_list extends Woo_Feed_List_Table {
159
 
160
  // $title = '<strong>' . $item['option_name'] . '</strong>';
161
  $actions = array(
162
- 'edit' => sprintf(
163
  '<a href="?page=%s&action=%s&feed=%s&_wpnonce=%s">' . __( 'Edit', 'woo-feed' ) . '</a>',
164
  esc_attr( $plugin_page ),
165
  'edit-feed',
@@ -173,7 +172,7 @@ class Woo_Feed_Manage_list extends Woo_Feed_List_Table {
173
  $item['option_name'],
174
  $duplicate_nonce
175
  ),
176
- 'delete' => sprintf(
177
  '<a val="?page=%s&action=%s&feed=%s&_wpnonce=%s" class="single-feed-delete" style="cursor: pointer;">' . __( 'Delete', 'woo-feed' ) . '</a>',
178
  esc_attr( $plugin_page ),
179
  'delete-feed',
@@ -267,7 +266,7 @@ class Woo_Feed_Manage_list extends Woo_Feed_List_Table {
267
 
268
  $title = '<strong>' . $item['option_name'] . '</strong>';
269
  $actions = array(
270
- 'edit' => sprintf(
271
  '<a href="?page=%s&action=%s&feed=%s&_wpnonce=%s">' . __( 'Edit', 'woo-feed' ) . '</a>',
272
  esc_attr( $plugin_page ),
273
  'edit-feed',
@@ -281,7 +280,7 @@ class Woo_Feed_Manage_list extends Woo_Feed_List_Table {
281
  $item['option_name'],
282
  $duplicate_nonce
283
  ),
284
- 'delete' => sprintf(
285
  '<a val="?page=%s&action=%s&feed=%s&_wpnonce=%s" class="single-feed-delete" style="cursor: pointer;">' . __( 'Delete', 'woo-feed' ) . '</a>',
286
  esc_attr( $plugin_page ),
287
  'delete-feed',
102
  case 'last_updated':
103
  return $itemInfo[ $column_name ];
104
  case 'view':
 
105
  $export_url = wp_nonce_url( admin_url( 'admin-post.php?action=wf_export_feed&feed=' . $getItem ), 'wpf-export' );
106
  $log_download_url = wp_nonce_url( admin_url( 'admin-post.php?action=wf_download_feed_log&feed=' . $getItem ), 'wpf-log-download' );
107
 
158
 
159
  // $title = '<strong>' . $item['option_name'] . '</strong>';
160
  $actions = array(
161
+ 'edit' => sprintf(
162
  '<a href="?page=%s&action=%s&feed=%s&_wpnonce=%s">' . __( 'Edit', 'woo-feed' ) . '</a>',
163
  esc_attr( $plugin_page ),
164
  'edit-feed',
172
  $item['option_name'],
173
  $duplicate_nonce
174
  ),
175
+ 'delete' => sprintf(
176
  '<a val="?page=%s&action=%s&feed=%s&_wpnonce=%s" class="single-feed-delete" style="cursor: pointer;">' . __( 'Delete', 'woo-feed' ) . '</a>',
177
  esc_attr( $plugin_page ),
178
  'delete-feed',
266
 
267
  $title = '<strong>' . $item['option_name'] . '</strong>';
268
  $actions = array(
269
+ 'edit' => sprintf(
270
  '<a href="?page=%s&action=%s&feed=%s&_wpnonce=%s">' . __( 'Edit', 'woo-feed' ) . '</a>',
271
  esc_attr( $plugin_page ),
272
  'edit-feed',
280
  $item['option_name'],
281
  $duplicate_nonce
282
  ),
283
+ 'delete' => sprintf(
284
  '<a val="?page=%s&action=%s&feed=%s&_wpnonce=%s" class="single-feed-delete" style="cursor: pointer;">' . __( 'Delete', 'woo-feed' ) . '</a>',
285
  esc_attr( $plugin_page ),
286
  'delete-feed',
admin/partials/woo-feed-content-settings.php CHANGED
@@ -75,10 +75,10 @@ global $feedRules, $wooFeedDropDown, $merchant;
75
  </tr>
76
  <?php
77
  $isItemWrapperHide = 'table-row';
78
- if( isset($feedRules['provider']) && 'custom' !== $feedRules['provider'] ) {
79
  $isItemWrapperHide = 'none';
80
- } elseif(isset($feedRules['feedType']) && 'xml' !== $feedRules['feedType']) {
81
- if(isset($feedRules['provider']) && 'custom' === $feedRules['provider'] ) {
82
  $isItemWrapperHide = 'none';
83
  }
84
  }
75
  </tr>
76
  <?php
77
  $isItemWrapperHide = 'table-row';
78
+ if ( isset($feedRules['provider']) && 'custom' !== $feedRules['provider'] ) {
79
  $isItemWrapperHide = 'none';
80
+ } elseif ( isset($feedRules['feedType']) && 'xml' !== $feedRules['feedType'] ) {
81
+ if ( isset($feedRules['provider']) && 'custom' === $feedRules['provider'] ) {
82
  $isItemWrapperHide = 'none';
83
  }
84
  }
admin/partials/woo-feed-edit-config.php CHANGED
@@ -65,7 +65,7 @@ if ( ! defined( 'ABSPATH' ) ) {
65
  <span <?php echo ( 'pattern' == $attr_type[ $k ] ) ? '' : 'style=" display: none;" '; ?>class="wf_default wf_attributes">
66
  <select name="default[<?php echo esc_attr( $k ); ?>]" class="selectize" data-placeholder="<?php esc_attr_e( 'Select A Category', 'woo-feed' ); ?>">
67
  <?php
68
- if( "fb_product_category" === $mAttribute ) {
69
  // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
70
  echo $wooFeedDropDown->facebookTaxonomy( esc_attr( $default[ $k ] ) );
71
  }else {
@@ -77,7 +77,7 @@ if ( ! defined( 'ABSPATH' ) ) {
77
  </span>
78
  <span style="font-size:x-small;"><a style="color: red" href="https://webappick.com/docs/ctx-feed/configuration/how-to-map-store-category-with-merchant-category/" target="_blank">Learn More..</a></span>
79
  <?php } else { ?>
80
- <input <?php echo ( 'pattern' == $attr_type[$k] ) ? '' : 'style=" display: none;"'; ?>autocomplete="off" class="wf_default wf_attributes " type="text" name="default[<?php echo esc_attr( $k ); ?>]" value="<?php echo isset($default[ $k ]) ? esc_attr( $default[ $k ] ) : ""; ?>"/>
81
  <?php } ?>
82
  </td>
83
  <td>
65
  <span <?php echo ( 'pattern' == $attr_type[ $k ] ) ? '' : 'style=" display: none;" '; ?>class="wf_default wf_attributes">
66
  <select name="default[<?php echo esc_attr( $k ); ?>]" class="selectize" data-placeholder="<?php esc_attr_e( 'Select A Category', 'woo-feed' ); ?>">
67
  <?php
68
+ if ( "fb_product_category" === $mAttribute ) {
69
  // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
70
  echo $wooFeedDropDown->facebookTaxonomy( esc_attr( $default[ $k ] ) );
71
  }else {
77
  </span>
78
  <span style="font-size:x-small;"><a style="color: red" href="https://webappick.com/docs/ctx-feed/configuration/how-to-map-store-category-with-merchant-category/" target="_blank">Learn More..</a></span>
79
  <?php } else { ?>
80
+ <input <?php echo ( 'pattern' == $attr_type[ $k ] ) ? '' : 'style=" display: none;"'; ?>autocomplete="off" class="wf_default wf_attributes " type="text" name="default[<?php echo esc_attr( $k ); ?>]" value="<?php echo isset($default[ $k ]) ? esc_attr( $default[ $k ] ) : ""; ?>"/>
81
  <?php } ?>
82
  </td>
83
  <td>
admin/partials/woo-feed-settings.php CHANGED
@@ -27,7 +27,7 @@ $settings = woo_feed_get_options( 'all' );
27
  <span style="float: right;">
28
  <?php
29
  esc_html_e( 'Version ', 'woo-feed' );
30
- $version = defined('WOO_FEED_PRO_VERSION')?WOO_FEED_PRO_VERSION:WOO_FEED_FREE_VERSION;
31
  echo esc_html( $version );
32
  ?>
33
  </span>
27
  <span style="float: right;">
28
  <?php
29
  esc_html_e( 'Version ', 'woo-feed' );
30
+ $version = defined('WOO_FEED_PRO_VERSION') ? WOO_FEED_PRO_VERSION : WOO_FEED_FREE_VERSION;
31
  echo esc_html( $version );
32
  ?>
33
  </span>
admin/partials/woo-feed-status.php CHANGED
@@ -73,7 +73,7 @@
73
  $status_text = "`\n";
74
 
75
  foreach ( $system_data->get_woo_feed_status() as $key => $woo_feed_status ) {
76
- if( isset($woo_feed_status['label']) && $woo_feed_status['status'] && $woo_feed_status['message'] ) {
77
  $label = $woo_feed_status['label'];
78
  $status_icon = $woo_feed_status['status'];
79
  $message = $woo_feed_status['message'];
73
  $status_text = "`\n";
74
 
75
  foreach ( $system_data->get_woo_feed_status() as $key => $woo_feed_status ) {
76
+ if ( isset($woo_feed_status['label']) && $woo_feed_status['status'] && $woo_feed_status['message'] ) {
77
  $label = $woo_feed_status['label'];
78
  $status_icon = $woo_feed_status['status'];
79
  $message = $woo_feed_status['message'];
includes/Tracker/Base.php CHANGED
@@ -41,7 +41,7 @@ abstract Class Base{
41
  // Loading settings
42
  $this->settings = woo_feed_get_options( 'all' );
43
 
44
- if( $this->is_active() ){
45
 
46
  add_action( 'wp_enqueue_scripts', [ &$this, 'frontend_script' ] );
47
 
@@ -59,18 +59,18 @@ abstract Class Base{
59
 
60
  $event = 'page_view';
61
 
62
- if( is_product() ){
63
  $event = 'product_view';
64
- if( isset( $_POST[ 'add-to-cart' ] ) ){
65
  $event = 'add_to_cart';
66
  }
67
- } else if( is_wc_endpoint_url('order-received') ){
68
  $event = 'order_received';
69
- } else if( is_checkout() ){
70
  $event = 'initiate_checkout';
71
  }
72
 
73
- if( method_exists( get_class($this), $event ) ){
74
  $this->$event();
75
  }
76
 
41
  // Loading settings
42
  $this->settings = woo_feed_get_options( 'all' );
43
 
44
+ if ( $this->is_active() ) {
45
 
46
  add_action( 'wp_enqueue_scripts', [ &$this, 'frontend_script' ] );
47
 
59
 
60
  $event = 'page_view';
61
 
62
+ if ( is_product() ) {
63
  $event = 'product_view';
64
+ if ( isset( $_POST['add-to-cart'] ) ) {
65
  $event = 'add_to_cart';
66
  }
67
+ } elseif ( is_wc_endpoint_url('order-received') ) {
68
  $event = 'order_received';
69
+ } elseif ( is_checkout() ) {
70
  $event = 'initiate_checkout';
71
  }
72
 
73
+ if ( method_exists( get_class($this), $event ) ) {
74
  $this->$event();
75
  }
76
 
includes/Tracker/Facebook/Pixel.php CHANGED
@@ -5,6 +5,7 @@
5
  * @since 4.4.27
6
  */
7
  namespace WebAppick\Feed\Tracker\Facebook;
 
8
  use \WebAppick\Feed\Tracker\Base as Base;
9
 
10
  /*
@@ -24,7 +25,7 @@ class Pixel extends Base{
24
 
25
  parent::__construct();
26
 
27
- if( $this->is_active() ){
28
 
29
  add_action( 'wp_head', [ &$this, 'add_pixel_script' ] );
30
  add_action( 'woo_feed_after_pixel_init', [ &$this, 'trigger_event' ], 11 );
@@ -59,7 +60,7 @@ class Pixel extends Base{
59
  */
60
  public function frontend_script(){
61
 
62
- wp_enqueue_script( 'woo-feed-facebook-pixel,', WOO_FEED_PLUGIN_URL . 'admin/js/woo-feed-facebook-pixel.min.js', ['jquery', 'wp-util'], '1.0.0', true );
63
 
64
  }
65
 
@@ -125,12 +126,21 @@ class Pixel extends Base{
125
  protected function product_view(){
126
  global $post;
127
  $_product = wc_get_product( (int) $post->ID );
 
 
 
 
 
 
 
 
 
128
  $data = [
129
- 'content_id' => $_product->get_ID(),
130
  'content_name' => esc_attr( $_product->get_title() ),
131
  'content_type' => 'product',
132
- 'value' => $_product->get_price(),
133
- 'currency' => get_option('woocommerce_currency'),
134
 
135
  ];
136
  ?>
@@ -146,16 +156,16 @@ class Pixel extends Base{
146
  */
147
  public function product_add_to_cart_data(){
148
  $data = [];
149
- if( isset($_POST['product_id']) ) {
150
  $product_id = intval( esc_attr( $_POST['product_id'] ) );
151
  $_product = wc_get_product( $product_id );
152
 
153
  $data = [
154
- 'content_id' => $_product->get_ID(),
155
  'content_name' => esc_attr( $_product->get_title() ),
156
  'content_type' => 'product',
157
- 'value' => $_product->get_price(),
158
- 'currency' => get_option('woocommerce_currency'),
159
 
160
  ];
161
 
@@ -173,15 +183,15 @@ class Pixel extends Base{
173
  protected function add_to_cart(){
174
 
175
  $product_id = intval( esc_attr( $_POST['add-to-cart'] ) );
176
- if( $product_id ){
177
  $_product = wc_get_product( $product_id );
178
 
179
  $data = [
180
- 'content_id' => $_product->get_ID(),
181
  'content_name' => esc_attr( $_product->get_title() ),
182
  'content_type' => 'product',
183
- 'value' => $_product->get_price(),
184
- 'currency' => get_option('woocommerce_currency'),
185
 
186
  ];
187
  }
@@ -213,8 +223,8 @@ class Pixel extends Base{
213
  global $wp_query;
214
  $order = wc_get_order( $wp_query->query_vars['order-received'] );
215
  $data = [
216
- 'value' => $order->get_total(),
217
- 'currency' => $order->get_currency()
218
  ];
219
  ?>
220
  fbq( 'track', 'Purchase', <?php echo json_encode( $data ); ?> );
5
  * @since 4.4.27
6
  */
7
  namespace WebAppick\Feed\Tracker\Facebook;
8
+
9
  use \WebAppick\Feed\Tracker\Base as Base;
10
 
11
  /*
25
 
26
  parent::__construct();
27
 
28
+ if ( $this->is_active() ) {
29
 
30
  add_action( 'wp_head', [ &$this, 'add_pixel_script' ] );
31
  add_action( 'woo_feed_after_pixel_init', [ &$this, 'trigger_event' ], 11 );
60
  */
61
  public function frontend_script(){
62
 
63
+ wp_enqueue_script( 'woo-feed-facebook-pixel,', WOO_FEED_PLUGIN_URL . 'admin/js/woo-feed-facebook-pixel.min.js', [ 'jquery', 'wp-util' ], '1.0.0', true );
64
 
65
  }
66
 
126
  protected function product_view(){
127
  global $post;
128
  $_product = wc_get_product( (int) $post->ID );
129
+
130
+ $id = $_product->get_ID();
131
+ $ids = [$id];
132
+
133
+ if( "variable" === $_product->get_type() ) {
134
+ $children_ids = $_product->get_children();
135
+ $ids = array_merge($ids, $children_ids);
136
+ }
137
+
138
  $data = [
139
+ 'content_ids' => $ids,
140
  'content_name' => esc_attr( $_product->get_title() ),
141
  'content_type' => 'product',
142
+ 'value' => $_product->get_price(),
143
+ 'currency' => get_option('woocommerce_currency'),
144
 
145
  ];
146
  ?>
156
  */
157
  public function product_add_to_cart_data(){
158
  $data = [];
159
+ if ( isset($_POST['product_id']) ) {
160
  $product_id = intval( esc_attr( $_POST['product_id'] ) );
161
  $_product = wc_get_product( $product_id );
162
 
163
  $data = [
164
+ 'content_id' => $_product->get_ID(),
165
  'content_name' => esc_attr( $_product->get_title() ),
166
  'content_type' => 'product',
167
+ 'value' => $_product->get_price(),
168
+ 'currency' => get_option('woocommerce_currency'),
169
 
170
  ];
171
 
183
  protected function add_to_cart(){
184
 
185
  $product_id = intval( esc_attr( $_POST['add-to-cart'] ) );
186
+ if ( $product_id ) {
187
  $_product = wc_get_product( $product_id );
188
 
189
  $data = [
190
+ 'content_id' => $_product->get_ID(),
191
  'content_name' => esc_attr( $_product->get_title() ),
192
  'content_type' => 'product',
193
+ 'value' => $_product->get_price(),
194
+ 'currency' => get_option('woocommerce_currency'),
195
 
196
  ];
197
  }
223
  global $wp_query;
224
  $order = wc_get_order( $wp_query->query_vars['order-received'] );
225
  $data = [
226
+ 'value' => $order->get_total(),
227
+ 'currency' => $order->get_currency(),
228
  ];
229
  ?>
230
  fbq( 'track', 'Purchase', <?php echo json_encode( $data ); ?> );
includes/Tracker/Google/Remarketing.php CHANGED
@@ -6,6 +6,7 @@
6
  */
7
 
8
  namespace WebAppick\Feed\Tracker\Google;
 
9
  use \WebAppick\Feed\Tracker\Base as Base;
10
 
11
  /*
@@ -32,7 +33,7 @@ class Remarketing extends Base{
32
  public function __construct(){
33
  parent::__construct();
34
 
35
- if( $this->is_active() ){
36
 
37
  add_action( 'wp_head', [ &$this, 'add_remarketing_script' ] );
38
  add_action( 'woo_feed_after_remarketing_init', [ &$this, 'trigger_event' ], 11 );
@@ -55,7 +56,7 @@ class Remarketing extends Base{
55
 
56
  $this->id = $this->settings['remarketing_id'];
57
  $this->send_to = $this->settings['remarketing_label'];
58
- $this->active = $this->settings['disable_remarketing'] == 'enable' && ! empty( $this->id ) && !empty( $this->send_to );
59
 
60
  return $this->active;
61
 
@@ -101,7 +102,7 @@ class Remarketing extends Base{
101
  */
102
  public function frontend_script(){
103
 
104
- wp_enqueue_script( 'woo-feed-google-remarketing,', WOO_FEED_PLUGIN_URL . 'admin/js/woo-feed-google-remarketing.min.js', ['jquery', 'wp-util'], '1.0.0', true );
105
 
106
  }
107
 
@@ -116,12 +117,12 @@ class Remarketing extends Base{
116
  $_product = wc_get_product( (int) $post->ID );
117
  $data = [
118
  'send_to' => $this->send_to,
119
- 'value' => $_product->get_price(),
120
- 'items' => [
121
  [
122
- 'id' => $_product->get_ID()
123
  ],
124
- ]
125
  ];
126
  ?>
127
  gtag( 'event', 'view_item', <?php echo json_encode( $data ); ?> );
@@ -137,17 +138,17 @@ class Remarketing extends Base{
137
  protected function add_to_cart(){
138
 
139
  $product_id = intval( esc_attr( $_POST['add-to-cart'] ) );
140
- if( $product_id ){
141
  $_product = wc_get_product( $product_id );
142
 
143
  $data = [
144
  'send_to' => $this->send_to,
145
- 'value' => $_product->get_price(),
146
- 'items' => [
147
  [
148
- 'id' => $_product->get_ID()
149
  ],
150
- ]
151
  ];
152
  }
153
  ?>
@@ -169,11 +170,11 @@ class Remarketing extends Base{
169
 
170
  $data = [
171
  'send_to' => $this->send_to,
172
- 'value' => $_product->get_price(),
173
- 'items' => [
174
  [
175
- 'id' => $_product->get_ID()
176
- ]
177
  ],
178
  ];
179
 
@@ -192,14 +193,14 @@ class Remarketing extends Base{
192
 
193
  $product_ids = [];
194
  $items = $order->get_items();
195
- foreach( $items as $item ){
196
  $product_ids[] = [ 'id' => $item->get_product_id() ];
197
  }
198
 
199
  $data = [
200
  'send_to' => $this->send_to,
201
- 'value' => $order->get_total(),
202
- 'items' => $product_ids
203
  ];
204
  ?>
205
  gtag( 'event', 'purchase', <?php echo json_encode( $data ); ?> );
6
  */
7
 
8
  namespace WebAppick\Feed\Tracker\Google;
9
+
10
  use \WebAppick\Feed\Tracker\Base as Base;
11
 
12
  /*
33
  public function __construct(){
34
  parent::__construct();
35
 
36
+ if ( $this->is_active() ) {
37
 
38
  add_action( 'wp_head', [ &$this, 'add_remarketing_script' ] );
39
  add_action( 'woo_feed_after_remarketing_init', [ &$this, 'trigger_event' ], 11 );
56
 
57
  $this->id = $this->settings['remarketing_id'];
58
  $this->send_to = $this->settings['remarketing_label'];
59
+ $this->active = $this->settings['disable_remarketing'] == 'enable' && ! empty( $this->id ) && ! empty( $this->send_to );
60
 
61
  return $this->active;
62
 
102
  */
103
  public function frontend_script(){
104
 
105
+ wp_enqueue_script( 'woo-feed-google-remarketing,', WOO_FEED_PLUGIN_URL . 'admin/js/woo-feed-google-remarketing.min.js', [ 'jquery', 'wp-util' ], '1.0.0', true );
106
 
107
  }
108
 
117
  $_product = wc_get_product( (int) $post->ID );
118
  $data = [
119
  'send_to' => $this->send_to,
120
+ 'value' => $_product->get_price(),
121
+ 'items' => [
122
  [
123
+ 'id' => $_product->get_ID(),
124
  ],
125
+ ],
126
  ];
127
  ?>
128
  gtag( 'event', 'view_item', <?php echo json_encode( $data ); ?> );
138
  protected function add_to_cart(){
139
 
140
  $product_id = intval( esc_attr( $_POST['add-to-cart'] ) );
141
+ if ( $product_id ) {
142
  $_product = wc_get_product( $product_id );
143
 
144
  $data = [
145
  'send_to' => $this->send_to,
146
+ 'value' => $_product->get_price(),
147
+ 'items' => [
148
  [
149
+ 'id' => $_product->get_ID(),
150
  ],
151
+ ],
152
  ];
153
  }
154
  ?>
170
 
171
  $data = [
172
  'send_to' => $this->send_to,
173
+ 'value' => $_product->get_price(),
174
+ 'items' => [
175
  [
176
+ 'id' => $_product->get_ID(),
177
+ ],
178
  ],
179
  ];
180
 
193
 
194
  $product_ids = [];
195
  $items = $order->get_items();
196
+ foreach ( $items as $item ) {
197
  $product_ids[] = [ 'id' => $item->get_product_id() ];
198
  }
199
 
200
  $data = [
201
  'send_to' => $this->send_to,
202
+ 'value' => $order->get_total(),
203
+ 'items' => $product_ids,
204
  ];
205
  ?>
206
  gtag( 'event', 'purchase', <?php echo json_encode( $data ); ?> );
includes/class-woo-feed-status.php CHANGED
@@ -310,12 +310,12 @@ class Woo_Feed_Status {
310
  private function product_query_type( ) {
311
  $status = $this->success;
312
  $message = woo_feed_get_options('product_query_type');
313
- if('wc'==$message){
314
- $message="WC_Product_Query";
315
- }elseif ('wp'==$message){
316
- $message="WP_Query";
317
- }else{
318
- $message="Both";
319
  }
320
  return [
321
  'label' => 'Product Query Type',
@@ -332,70 +332,70 @@ class Woo_Feed_Status {
332
  $environment = $report['environment'];
333
  $theme = $report['theme'];
334
  $active_plugins = $report['active_plugins'];
335
- $info=array();
336
- $info[] =[
337
  'label' => '',
338
- 'status' =>'',
339
  'message' => "<h3>Server Info</h3>",
340
  ];
341
- if(!empty($environment)){
342
- foreach ($environment as $key=>$value){
343
 
344
- if(true===$value){
345
- $value='Yes';
346
- }elseif (false===$value){
347
- $value='No';
348
  }
349
 
350
- if(in_array($key,['wp_memory_limit','php_post_max_size','php_max_input_vars','max_upload_size'])){
351
  $value = $this->formatBytes($value,2);
352
  }
353
 
354
- $info[] =[
355
- 'label' => ucwords(str_replace(['_','wp'],[' ','WP'],$key)),
356
  'status' => $this->success,
357
  'message' => $value,
358
  ];
359
  }
360
  }
361
 
362
- $info[] =[
363
  'label' => '',
364
- 'status' =>'',
365
  'message' => "<h3>Installed Theme</h3>",
366
  ];
367
 
368
- if(!empty($theme)){
369
- $new_version="";
370
- $status=$this->success;
371
- if(version_compare($theme['version'],$theme['version_latest'])){
372
- $new_version=' (Latest:'.$theme['version_latest'].')';
373
- $status=$this->warning;
374
  }
375
 
376
- $info[] =[
377
  'label' => $theme['name'],
378
  'status' => $status,
379
  'message' => $theme['version'].$new_version,
380
  ];
381
  }
382
 
383
- $info[] =[
384
  'label' => '',
385
- 'status' =>'',
386
  'message' => "<h3>Installed Plugins</h3>",
387
  ];
388
 
389
- if(!empty($active_plugins)){
390
- foreach ($active_plugins as $key=>$plugin){
391
- $new_version="";
392
- $status=$this->success;
393
- if(version_compare($plugin['version'],$plugin['version_latest'])){
394
- $new_version=' (Latest:'.$plugin['version_latest'].')';
395
- $status=$this->warning;
396
  }
397
 
398
- $info[] =[
399
  'label' => $plugin['name']. ' ('.$plugin['author_name'].')',
400
  'status' => $status,
401
  'message' => $plugin['version'].$new_version,
@@ -408,8 +408,8 @@ class Woo_Feed_Status {
408
  return $info;
409
  }
410
 
411
- public function formatBytes($bytes, $precision = 2) {
412
- $units = array('B', 'KB', 'MB', 'GB', 'TB');
413
 
414
  $bytes = max($bytes, 0);
415
  $pow = floor(($bytes ? log($bytes) : 0) / log(1024));
@@ -419,7 +419,7 @@ class Woo_Feed_Status {
419
  $bytes /= pow(1024, $pow);
420
  // $bytes /= (1 << (10 * $pow));
421
 
422
- return round($bytes, $precision) . ' ' . $units[$pow];
423
  }
424
 
425
  /**
@@ -427,18 +427,18 @@ class Woo_Feed_Status {
427
  */
428
  private function default_customer_location( ) {
429
  $status = $this->success;
430
- $customer_location=get_option('woocommerce_default_customer_address');
431
 
432
  $message = "<b>Default Customer Location</b><br/>";
433
 
434
- if('base'==$customer_location){
435
- $message .="Shop Base Address<br/>";
436
- }elseif('geolocation'==$customer_location){
437
- $message .="Geolocate<br/>";
438
- }elseif('geolocation_ajax'==$customer_location){
439
- $message .="Geolocate (with page caching support)<br/>";
440
- }else{
441
- $message .="$customer_location<br/>";
442
  }
443
 
444
 
@@ -657,11 +657,11 @@ class Woo_Feed_Status {
657
  * Get available woocommerce product types
658
  */
659
  private function get_available_product_types(){
660
- $types=wc_get_product_types();
661
  $status = $this->success;
662
- $message='';
663
- if(!empty($types)){
664
- foreach ($types as $key=>$type){
665
  $message .= "☞ ". ucwords($type)." [".$key."]<br/>";
666
  }
667
  }
310
  private function product_query_type( ) {
311
  $status = $this->success;
312
  $message = woo_feed_get_options('product_query_type');
313
+ if ( 'wc' == $message ) {
314
+ $message = "WC_Product_Query";
315
+ }elseif ( 'wp' == $message ) {
316
+ $message = "WP_Query";
317
+ }else {
318
+ $message = "Both";
319
  }
320
  return [
321
  'label' => 'Product Query Type',
332
  $environment = $report['environment'];
333
  $theme = $report['theme'];
334
  $active_plugins = $report['active_plugins'];
335
+ $info = array();
336
+ $info[] = [
337
  'label' => '',
338
+ 'status' => '',
339
  'message' => "<h3>Server Info</h3>",
340
  ];
341
+ if ( ! empty($environment) ) {
342
+ foreach ( $environment as $key => $value ) {
343
 
344
+ if ( true === $value ) {
345
+ $value = 'Yes';
346
+ }elseif ( false === $value ) {
347
+ $value = 'No';
348
  }
349
 
350
+ if ( in_array($key,[ 'wp_memory_limit', 'php_post_max_size', 'php_max_input_vars', 'max_upload_size' ]) ) {
351
  $value = $this->formatBytes($value,2);
352
  }
353
 
354
+ $info[] = [
355
+ 'label' => ucwords(str_replace([ '_', 'wp' ],[ ' ', 'WP' ],$key)),
356
  'status' => $this->success,
357
  'message' => $value,
358
  ];
359
  }
360
  }
361
 
362
+ $info[] = [
363
  'label' => '',
364
+ 'status' => '',
365
  'message' => "<h3>Installed Theme</h3>",
366
  ];
367
 
368
+ if ( ! empty($theme) ) {
369
+ $new_version = "";
370
+ $status = $this->success;
371
+ if ( version_compare($theme['version'],$theme['version_latest']) ) {
372
+ $new_version = ' (Latest:'.$theme['version_latest'].')';
373
+ $status = $this->warning;
374
  }
375
 
376
+ $info[] = [
377
  'label' => $theme['name'],
378
  'status' => $status,
379
  'message' => $theme['version'].$new_version,
380
  ];
381
  }
382
 
383
+ $info[] = [
384
  'label' => '',
385
+ 'status' => '',
386
  'message' => "<h3>Installed Plugins</h3>",
387
  ];
388
 
389
+ if ( ! empty($active_plugins) ) {
390
+ foreach ( $active_plugins as $key => $plugin ) {
391
+ $new_version = "";
392
+ $status = $this->success;
393
+ if ( version_compare($plugin['version'],$plugin['version_latest']) ) {
394
+ $new_version = ' (Latest:'.$plugin['version_latest'].')';
395
+ $status = $this->warning;
396
  }
397
 
398
+ $info[] = [
399
  'label' => $plugin['name']. ' ('.$plugin['author_name'].')',
400
  'status' => $status,
401
  'message' => $plugin['version'].$new_version,
408
  return $info;
409
  }
410
 
411
+ public function formatBytes( $bytes, $precision = 2 ) {
412
+ $units = array( 'B', 'KB', 'MB', 'GB', 'TB' );
413
 
414
  $bytes = max($bytes, 0);
415
  $pow = floor(($bytes ? log($bytes) : 0) / log(1024));
419
  $bytes /= pow(1024, $pow);
420
  // $bytes /= (1 << (10 * $pow));
421
 
422
+ return round($bytes, $precision) . ' ' . $units[ $pow ];
423
  }
424
 
425
  /**
427
  */
428
  private function default_customer_location( ) {
429
  $status = $this->success;
430
+ $customer_location = get_option('woocommerce_default_customer_address');
431
 
432
  $message = "<b>Default Customer Location</b><br/>";
433
 
434
+ if ( 'base' == $customer_location ) {
435
+ $message .= "Shop Base Address<br/>";
436
+ }elseif ( 'geolocation' == $customer_location ) {
437
+ $message .= "Geolocate<br/>";
438
+ }elseif ( 'geolocation_ajax' == $customer_location ) {
439
+ $message .= "Geolocate (with page caching support)<br/>";
440
+ }else {
441
+ $message .= "$customer_location<br/>";
442
  }
443
 
444
 
657
  * Get available woocommerce product types
658
  */
659
  private function get_available_product_types(){
660
+ $types = wc_get_product_types();
661
  $status = $this->success;
662
+ $message = '';
663
+ if ( ! empty($types) ) {
664
+ foreach ( $types as $key => $type ) {
665
  $message .= "☞ ". ucwords($type)." [".$key."]<br/>";
666
  }
667
  }
includes/classes/class-woo-feed-admin-message.php CHANGED
@@ -92,14 +92,14 @@ final class Woo_Feed_Message {
92
  * @return void
93
  */
94
  private function display_support_links() {
95
- if(defined('WOO_FEED_PRO_VERSION')){
96
  $utm_links = array(
97
- 'utm_source' => 'proPlugin',
98
- 'utm_medium' => 'pro_plugin_doc',
99
  'utm_campaign' => 'pro',
100
- 'utm_term' => 'wooFeed',
101
  );
102
- }else{
103
  $utm_links = array(
104
  'utm_source' => 'freePlugin',
105
  'utm_medium' => 'free_plugin_doc',
@@ -115,12 +115,12 @@ final class Woo_Feed_Message {
115
  <tr>
116
  <th>
117
  <div class="woo-feed-top-header">
118
- <?php if(defined('WOO_FEED_PRO_VERSION')){ ?>
119
  <div class="woo-feed-logo-wrapper">
120
  <img src="<?php echo WOO_FEED_PRO_ADMIN_URL; ?>images/woo-feed-icon.svg" alt="Woo Feed Pro">
121
  <h1 class="woo-feed-logo-label"><?php esc_html_e('CTX Feed', 'woo-feed'); ?></h1>
122
  </div>
123
- <?php }else{?>
124
  <a class="get-woo-feed-pro" href="https://webappick.com/plugin/woocommerce-product-feed-pro/?utm_source=freePlugin&utm_medium=go_premium&utm_campaign=free_to_pro&utm_term=wooFeed" target="_blank" aria-label="<?php esc_attr_e( 'Get CTX Feed Pro', 'woo-feed' ); ?>">
125
  <img src="<?php echo esc_url( WOO_FEED_PLUGIN_URL ); ?>admin/images/get-woo-feed-pro.svg" alt="<?php esc_attr_e( 'Get CTX Feed Pro', 'woo-feed' ); ?>">
126
  </a>
92
  * @return void
93
  */
94
  private function display_support_links() {
95
+ if ( defined('WOO_FEED_PRO_VERSION') ) {
96
  $utm_links = array(
97
+ 'utm_source' => 'proPlugin',
98
+ 'utm_medium' => 'pro_plugin_doc',
99
  'utm_campaign' => 'pro',
100
+ 'utm_term' => 'wooFeed',
101
  );
102
+ }else {
103
  $utm_links = array(
104
  'utm_source' => 'freePlugin',
105
  'utm_medium' => 'free_plugin_doc',
115
  <tr>
116
  <th>
117
  <div class="woo-feed-top-header">
118
+ <?php if ( defined('WOO_FEED_PRO_VERSION') ) { ?>
119
  <div class="woo-feed-logo-wrapper">
120
  <img src="<?php echo WOO_FEED_PRO_ADMIN_URL; ?>images/woo-feed-icon.svg" alt="Woo Feed Pro">
121
  <h1 class="woo-feed-logo-label"><?php esc_html_e('CTX Feed', 'woo-feed'); ?></h1>
122
  </div>
123
+ <?php }else { ?>
124
  <a class="get-woo-feed-pro" href="https://webappick.com/plugin/woocommerce-product-feed-pro/?utm_source=freePlugin&utm_medium=go_premium&utm_campaign=free_to_pro&utm_term=wooFeed" target="_blank" aria-label="<?php esc_attr_e( 'Get CTX Feed Pro', 'woo-feed' ); ?>">
125
  <img src="<?php echo esc_url( WOO_FEED_PLUGIN_URL ); ?>admin/images/get-woo-feed-pro.svg" alt="<?php esc_attr_e( 'Get CTX Feed Pro', 'woo-feed' ); ?>">
126
  </a>
includes/classes/class-woo-feed-constants.php CHANGED
@@ -12,7 +12,7 @@ class Woo_Feed_Constants {
12
  }
13
 
14
  static function defined_constants() {
15
- if( defined( 'WOO_FEED_FREE_VERSION' ) )
16
  return;
17
 
18
  if ( ! defined( 'WOO_FEED_FREE_VERSION' ) ) {
@@ -22,7 +22,7 @@ class Woo_Feed_Constants {
22
  * @var string
23
  * @since 3.1.6
24
  */
25
- define( 'WOO_FEED_FREE_VERSION', '4.4.52' );
26
  }
27
 
28
  if ( ! defined( 'WOO_FEED_FREE_PATH' ) ) {
12
  }
13
 
14
  static function defined_constants() {
15
+ if ( defined( 'WOO_FEED_FREE_VERSION' ) )
16
  return;
17
 
18
  if ( ! defined( 'WOO_FEED_FREE_VERSION' ) ) {
22
  * @var string
23
  * @since 3.1.6
24
  */
25
+ define( 'WOO_FEED_FREE_VERSION', '4.4.53' );
26
  }
27
 
28
  if ( ! defined( 'WOO_FEED_FREE_PATH' ) ) {
includes/classes/class-woo-feed-default-attributes.php CHANGED
@@ -273,153 +273,153 @@ class Woo_Feed_Default_Attributes {
273
  );
274
  public $facebookXMLAttribute
275
  = array(
276
- 'id' => array( 'g:id', false ),
277
- 'title' => array( 'g:title', true ),
278
- 'description' => array( 'g:description', true ),
279
- 'link' => array( 'g:link', true ),
280
- 'mobile_link' => array( 'g:mobile_link', true ),
281
- 'product_type' => array( 'g:product_type', true ),
282
- 'current_category' => array( 'g:google_product_category', true ),
283
- 'image' => array( 'g:image_link', true ),
284
- 'images' => array( 'g:additional_image_link', false ),
285
- 'images_1' => array( 'g:additional_image_link', true ),
286
- 'images_2' => array( 'g:additional_image_link', true ),
287
- 'images_3' => array( 'g:additional_image_link', true ),
288
- 'images_4' => array( 'g:additional_image_link', true ),
289
- 'images_5' => array( 'g:additional_image_link', true ),
290
- 'images_6' => array( 'g:additional_image_link', true ),
291
- 'images_7' => array( 'g:additional_image_link', true ),
292
- 'images_8' => array( 'g:additional_image_link', true ),
293
- 'images_9' => array( 'g:additional_image_link', true ),
294
- 'images_10' => array( 'g:additional_image_link', true ),
295
- 'condition' => array( 'g:condition', false ),
296
- 'availability' => array( 'g:availability', false ),
297
- 'inventory' => array( 'g:inventory', false ),
298
- 'override' => array( 'g:override', false ),
299
- 'price' => array( 'g:price', true ),
300
- 'sale_price' => array( 'g:sale_price', true ),
301
- 'sale_price_effective_date' => array( 'g:sale_price_effective_date', true ),
302
- 'brand' => array( 'g:brand', true ),
303
- 'sku' => array( 'g:mpn', true ),
304
- 'upc' => array( 'g:gtin', true ),
305
- 'identifier_exists' => array( 'g:identifier_exists', true ),
306
- 'item_group_id' => array( 'g:item_group_id', false ),
307
- 'color' => array( 'g:color', true ),
308
- 'gender' => array( 'g:gender', true ),
309
- 'age_group' => array( 'g:age_group', true ),
310
- 'material' => array( 'g:material', true ),
311
- 'pattern' => array( 'g:pattern', true ),
312
- 'size' => array( 'g:size', true ),
313
- 'size_type' => array( 'g:size_type', true ),
314
- 'size_system' => array( 'g:size_system', true ),
315
- 'tax' => array( 'tax', true ),
316
- 'weight' => array( 'g:shipping_weight', false ),
317
- 'length' => array( 'g:shipping_length', false ),
318
- 'width' => array( 'g:shipping_width', false ),
319
- 'height' => array( 'g:shipping_height', false ),
320
- 'ships_from_country' => array( 'g:ships_from_country', false ),
321
- 'shipping_label' => array( 'g:shipping_label', false ),
322
- 'shipping_country' => array( 'g:shipping_country', false ),
323
- 'shipping_service' => array( 'g:shipping_service', false ),
324
- 'shipping_price' => array( 'g:shipping_price', false ),
325
- 'shipping_region' => array( 'g:shipping_region', false ),
326
- 'multipack' => array( 'g:multipack', true ),
327
- 'is_bundle' => array( 'g:is_bundle', true ),
328
- 'adult' => array( 'g:adult', true ),
329
- 'adwords_redirect' => array( 'g:adwords_redirect', true ),
330
- 'custom_label_0' => array( 'g:custom_label_0', true ),
331
- 'custom_label_1' => array( 'g:custom_label_1', true ),
332
- 'custom_label_2' => array( 'g:custom_label_2', true ),
333
- 'custom_label_3' => array( 'g:custom_label_3', true ),
334
- 'custom_label_4' => array( 'g:custom_label_4', true ),
335
- 'excluded_destination' => array( 'g:excluded_destination', true ),
336
- 'expiration_date' => array( 'g:expiration_date', true ),
337
- 'unit_pricing_measure' => array( 'g:unit_pricing_measure', true ),
338
- 'unit_pricing_base_measure' => array( 'g:unit_pricing_base_measure', true ),
339
- 'energy_efficiency_class' => array( 'g:energy_efficiency_class', true ),
340
- 'loyalty_points' => array( 'g:loyalty_points', true ),
341
- 'installment' => array( 'g:installment', true ),
342
- 'promotion_id' => array( 'g:promotion_id', true ),
343
- 'cost_of_goods_sold' => array( 'g:cost_of_goods_sold', true ),
344
- 'availability_date' => array( 'g:availability_date', true ),
345
- 'tax_category' => array( 'g:tax_category', true ),
346
- 'included_destination' => array( 'g:included_destination', true ),
347
- 'quantity_to_sell_on_facebook' => array( 'g:quantity_to_sell_on_facebook', true ),
348
  );
349
  public $facebookCSVTXTAttribute
350
  = array(
351
- 'id' => array( 'id', false ),
352
- 'title' => array( 'title', true ),
353
- 'description' => array( 'description', true ),
354
- 'link' => array( 'link', true ),
355
- 'mobile_link' => array( 'mobile_link', true ),
356
- 'product_type' => array( 'product type', true ),
357
- 'current_category' => array( 'google product category', true ),
358
- 'image' => array( 'image link', true ),
359
- 'images' => array( 'additional image link', true ),
360
- 'images_1' => array( 'additional image link', true ),
361
- 'images_2' => array( 'additional image link', true ),
362
- 'images_3' => array( 'additional image link', true ),
363
- 'images_4' => array( 'additional image link', true ),
364
- 'images_5' => array( 'additional image link', true ),
365
- 'images_6' => array( 'additional image link', true ),
366
- 'images_7' => array( 'additional image link', true ),
367
- 'images_8' => array( 'additional image link', true ),
368
- 'images_9' => array( 'additional image link', true ),
369
- 'images_10' => array( 'additional image link', true ),
370
- 'condition' => array( 'condition', false ),
371
- 'availability' => array( 'availability', false ),
372
- 'inventory' => array( 'inventory', false ),
373
- 'override' => array( 'override', false ),
374
- 'price' => array( 'price', true ),
375
- 'sale_price' => array( 'sale price', true ),
376
- 'sale_price_effective_date' => array( 'sale price effective date', true ),
377
- 'brand' => array( 'brand', true ),
378
- 'sku' => array( 'mpn', true ),
379
- 'upc' => array( 'gtin', true ),
380
- 'identifier_exists' => array( 'identifier exists', true ),
381
- 'item_group_id' => array( 'item group id', false ),
382
- 'color' => array( 'color', true ),
383
- 'gender' => array( 'gender', true ),
384
- 'age_group' => array( 'age group', true ),
385
- 'material' => array( 'material', true ),
386
- 'pattern' => array( 'pattern', true ),
387
- 'size' => array( 'size', true ),
388
- 'size_type' => array( 'size type', true ),
389
- 'size_system' => array( 'size system', true ),
390
- 'tax' => array( 'tax', true ),
391
- 'weight' => array( 'shipping weight', false ),
392
- 'length' => array( 'shipping length', false ),
393
- 'width' => array( 'shipping width', false ),
394
- 'height' => array( 'shipping height', false ),
395
- 'ships_from_country' => array( 'ships from country', false ),
396
- 'shipping_label' => array( 'shipping label', false ),
397
- 'shipping_country' => array( 'shipping country', false ),
398
- 'shipping_service' => array( 'shipping service', false ),
399
- 'shipping_price' => array( 'shipping price', false ),
400
- 'shipping_region' => array( 'shipping region', false ),
401
- 'multipack' => array( 'multipack', true ),
402
- 'is_bundle' => array( 'is bundle', true ),
403
- 'adult' => array( 'adult', true ),
404
- 'adwords_redirect' => array( 'adwords redirect', true ),
405
- 'custom_label_0' => array( 'custom label 0', true ),
406
- 'custom_label_1' => array( 'custom label 1', true ),
407
- 'custom_label_2' => array( 'custom label 2', true ),
408
- 'custom_label_3' => array( 'custom label 3', true ),
409
- 'custom_label_4' => array( 'custom label 4', true ),
410
- 'excluded_destination' => array( 'excluded destination', true ),
411
- 'expiration_date' => array( 'expiration date', true ),
412
- 'unit_pricing_measure' => array( 'unit pricing measure', true ),
413
- 'unit_pricing_base_measure' => array( 'unit pricing base measure', true ),
414
- 'energy_efficiency_class' => array( 'energy efficiency class', true ),
415
- 'loyalty_points' => array( 'loyalty points', true ),
416
- 'installment' => array( 'installment', true ),
417
- 'promotion_id' => array( 'promotion id', true ),
418
- 'cost_of_goods_sold' => array( 'cost of goods sold', true ),
419
- 'availability_date' => array( 'availability date', true ),
420
- 'tax_category' => array( 'tax category', true ),
421
- 'included_destination' => array( 'included destination', true ),
422
- 'quantity_to_sell_on_facebook' => array( 'quantity_to_sell_on_facebook', true ),
423
  );
424
  public $pinterestXMLAttribute
425
  = array(
@@ -604,17 +604,17 @@ class Woo_Feed_Default_Attributes {
604
  'color' => array( 'color', false ),
605
  'size' => array( 'size', false ),
606
  'weight' => array( 'weight', false ),
607
- 'quantity' => array( 'quantity', false ),
608
  );
609
 
610
  public $gLocalAttributes
611
  = array(
612
- 'description' => array( 'description', true ),
613
  );
614
 
615
  public $gActionAttributes
616
  = array(
617
- 'description' => array( 'description', true ),
618
  );
619
 
620
  public function __construct() {
@@ -812,91 +812,91 @@ class Woo_Feed_Default_Attributes {
812
  */
813
  public function facebookAttributes() {
814
  return array(
815
- '--1' => 'Basic Information',
816
- 'id' => 'Product Id[id]',
817
- 'title' => 'Product Title[title]',
818
- 'description' => 'Product Description[description]',
819
- 'link' => 'Product URL[link]',
820
- 'mobile_link' => 'Product URL[mobile_link]',
821
- 'product_type' => 'Product Categories[product_type] ',
822
- 'fb_product_category' => 'Facebook Product Category[fb_product_category]',
823
- 'current_category' => 'Google Product Category[google_product_category]',
824
- 'image' => 'Main Image[image_link]',
825
- 'images' => 'Additional Images [additional_image_link]',
826
- 'images_1' => 'Additional Image 1 [additional_image_link]',
827
- 'images_2' => 'Additional Image 2 [additional_image_link]',
828
- 'images_3' => 'Additional Image 3 [additional_image_link]',
829
- 'images_4' => 'Additional Image 4 [additional_image_link]',
830
- 'images_5' => 'Additional Image 5 [additional_image_link]',
831
- 'images_6' => 'Additional Image 6 [additional_image_link]',
832
- 'images_7' => 'Additional Image 7 [additional_image_link]',
833
- 'images_8' => 'Additional Image 8 [additional_image_link]',
834
- 'images_9' => 'Additional Image 9 [additional_image_link]',
835
- 'images_10' => 'Additional Image 10 [additional_image_link]',
836
- 'condition' => 'Condition[condition]',
837
- '---1' => '',
838
- '--2' => 'Availability & Price',
839
- 'availability' => 'Stock Status[availability]',
840
- 'availability_date' => 'Availability Date[availability_date]',
841
- 'price' => 'Regular Price[price]',
842
- 'sale_price' => 'Sale Price[sale_price]',
843
- 'sale_price_effective_date' => 'Sale Price Effective Date[sale_price_effective_date]',
844
- '---2' => '',
845
- '--3' => 'Unique Product Identifiers',
846
- 'brand' => 'Manufacturer[brand]',
847
- 'gtin' => 'GTIN[gtin]',
848
- 'mpn' => 'MPN[mpn]',
849
- 'identifier_exists' => 'Identifier Exist[identifier_exists]',
850
- '---3' => '',
851
- '--4' => 'Detailed Product Attributes',
852
- 'item_group_id' => 'Item Group Id[item_group_id]',
853
- 'color' => 'Color[color]',
854
- 'gender' => 'Gender[gender]',
855
- 'age_group' => 'Age Group[age_group]',
856
- 'material' => 'Material[material]',
857
- 'pattern' => 'Pattern[pattern]',
858
- 'size' => 'Size of the item[size]',
859
- '---4' => '',
860
- '--5' => 'Tax & Shipping',
861
- 'tax' => 'Tax[tax]',
862
- 'tax_country' => 'Tax Country[tax_country]',
863
- 'tax_region' => 'Tax Region[tax_region]',
864
- 'tax_rate' => 'Tax Rate[tax_rate]',
865
- 'tax_ship' => 'Tax Ship[tax_ship]',
866
- 'tax_category' => 'Tax[tax_category]',
867
- 'shipping' => 'Shipping',
868
- 'shipping_weight' => 'Shipping Weight[shipping_weight]',
869
- '---5' => '',
870
- '--6' => 'Custom Label Attributes',
871
- 'custom_label_0' => 'Custom label 0 [custom_label_0]',
872
- 'custom_label_1' => 'Custom label 1 [custom_label_1]',
873
- 'custom_label_2' => 'Custom label 2 [custom_label_2]',
874
- 'custom_label_3' => 'Custom label 3 [custom_label_3]',
875
- 'custom_label_4' => 'Custom label 4 [custom_label_4]',
876
- '---6' => '',
877
- '--7' => 'Additional Attributes',
878
- 'inventory' => 'Facebook Inventory[inventory]',
879
- 'override' => 'Facebook Override[override]',
880
- 'status' => 'Status [status]',
881
- 'video' => 'Video [video]',
882
- 'unit_price_value' => 'Unit Price > Value [unit_price_value]',
883
- 'unit_price_currency' => 'Unit Price > Currency [unit_price_currency]',
884
- 'unit_price_unit' => 'Unit Price > Unit [unit_price_unit]',
885
- 'quantity_to_sell_on_facebook' => 'Quantity to Sell on Facebook [quantity_to_sell_on_facebook]',
886
- 'commerce_tax_category' => 'Commerce Tax Category [commerce_tax_category]',
887
- 'expiration_date' => 'Expiration Date[expiration_date]',
888
- 'marked_for_product_launch' => 'Marked for Product Launce [marked_for_product_launch]',
889
- 'rich_text_description' => 'Rich Text Description [rich_text_description]',
890
- 'visibility' => 'Visibility [visibility]',
891
- 'additional_variant_label' => 'Additional Variant Attribute > Label [Variant Label]',
892
- 'additional_variant_value' => 'Additional Variant Attribute > Value [Variant Value]',
893
- 'applink' => 'Applink [applink]',
894
- 'origin_country' => 'Origin Country [origin_country]',
895
- 'importer_name' => 'Importer Name [importer_name]',
896
- 'importer_address' => 'Importer Address [importer_address]',
897
- 'manufacturer_info' => 'Manufacturer Info [manufacturer_info]',
898
- 'return_policy_info' => 'Return Policy Info [return_policy_info]',
899
- '---7' => '',
900
  );
901
  }
902
 
@@ -1007,7 +1007,7 @@ class Woo_Feed_Default_Attributes {
1007
  'link' => 'Product URL[link]',
1008
  'image' => 'Main Image[image]',
1009
  'pubDate' => 'Publish Date[pubDate]',
1010
- 'guid' => 'GUID[guid]',
1011
  '---1' => '',
1012
 
1013
  );
@@ -1061,52 +1061,52 @@ class Woo_Feed_Default_Attributes {
1061
  */
1062
  public function tiktokAttributes() {
1063
  return array(
1064
- '--1' => 'Basic Information',
1065
- 'sku_id' => 'SKU ID[id]',
1066
- 'title' => 'Product Title[title]',
1067
- 'description' => 'Product description[description]',
1068
- 'availability' => 'Availability[availability]',
1069
- 'condition' => 'Condition[condition]',
1070
- 'price' => 'Price[price]',
1071
- 'sale_price' => 'Sale Price[sale_price]',
1072
- 'shipping' => 'Shipping[shipping]',
1073
- 'tax ' => 'Tax[tax]',
1074
- 'shipping_weight' => 'Shipping Weight[shipping_weight]',
1075
- 'link' => 'Product URL[link]',
1076
- 'image_link' => 'Product Image[image_link]',
1077
- 'additional_image_link' => 'Additional Image [additional_image_link]',
1078
- 'item_group_id' => 'Parent ID[item_group_id]',
1079
- 'brand' => 'Product Brand[brand]',
1080
- 'gtin' => 'Gtin[gtin]',
1081
- 'mpn' => 'MPN[mpn]',
1082
  'google_product_category' => 'Google Product Category[google_product_category]',
1083
- 'video_link' => 'Video Link[video_link]',
1084
- 'age_group' => 'Age Group[age_group]',
1085
- 'color' => 'Color[color]',
1086
- 'size' => 'Size[size]',
1087
- 'gender' => 'Gender[gender]',
1088
- 'material' => 'Material[material]',
1089
- 'pattern' => 'Pattern[pattern]',
1090
- 'product_type' => 'Product Type[product_type]',
1091
- 'ios_url' => 'IOS URL[ios_url]',
1092
- 'ios_app_store_id' => 'IOS App Store ID[ios_app_store_id]',
1093
- 'ios_app_name' => 'IOS App Name[ios_app_name]',
1094
- 'iPhone_url' => 'iPhone URL[iPhone_url]',
1095
- 'iPhone_app_store_id' => 'iPhone App Store ID[iPhone_app_store_id]',
1096
- 'iPhone_app_name' => 'iPhone App Name[iPhone_app_name]',
1097
- 'iPad_url' => 'iPad URL[iPad_url]',
1098
- 'iPad_app_store_id' => 'iPad App Store ID[iPad_app_store_id]',
1099
- 'iPad_app_name' => 'iPad App Name[iPad_app_name]',
1100
- 'android_url' => 'Android URL[android_url]',
1101
- 'android_package' => 'Android Package[android_package]',
1102
- 'android_app_name' => 'Android App Name[android_app_name]',
1103
- 'custom_label_0' => 'custom_label_0[custom_label_0]',
1104
- 'custom_label_1' => 'custom_label_1[custom_label_1]',
1105
- 'custom_label_2' => 'custom_label_2[custom_label_2]',
1106
- 'custom_label_3' => 'custom_label_3[custom_label_3]',
1107
- 'custom_label_4' => 'custom_label_4[custom_label_4]',
1108
- 'merchant_brand' => 'Merchant Brand[merchant_brand]',
1109
- 'productHisEval' => 'Purchase Count:FeedBack[productHisEval]',
1110
  'sale_price_effective_date' => 'Sale Price Effective Date[sale_price_effective_date]',
1111
  );
1112
  }
273
  );
274
  public $facebookXMLAttribute
275
  = array(
276
+ 'id' => array( 'g:id', false ),
277
+ 'title' => array( 'g:title', true ),
278
+ 'description' => array( 'g:description', true ),
279
+ 'link' => array( 'g:link', true ),
280
+ 'mobile_link' => array( 'g:mobile_link', true ),
281
+ 'product_type' => array( 'g:product_type', true ),
282
+ 'current_category' => array( 'g:google_product_category', true ),
283
+ 'image' => array( 'g:image_link', true ),
284
+ 'images' => array( 'g:additional_image_link', false ),
285
+ 'images_1' => array( 'g:additional_image_link', true ),
286
+ 'images_2' => array( 'g:additional_image_link', true ),
287
+ 'images_3' => array( 'g:additional_image_link', true ),
288
+ 'images_4' => array( 'g:additional_image_link', true ),
289
+ 'images_5' => array( 'g:additional_image_link', true ),
290
+ 'images_6' => array( 'g:additional_image_link', true ),
291
+ 'images_7' => array( 'g:additional_image_link', true ),
292
+ 'images_8' => array( 'g:additional_image_link', true ),
293
+ 'images_9' => array( 'g:additional_image_link', true ),
294
+ 'images_10' => array( 'g:additional_image_link', true ),
295
+ 'condition' => array( 'g:condition', false ),
296
+ 'availability' => array( 'g:availability', false ),
297
+ 'inventory' => array( 'g:inventory', false ),
298
+ 'override' => array( 'g:override', false ),
299
+ 'price' => array( 'g:price', true ),
300
+ 'sale_price' => array( 'g:sale_price', true ),
301
+ 'sale_price_effective_date' => array( 'g:sale_price_effective_date', true ),
302
+ 'brand' => array( 'g:brand', true ),
303
+ 'sku' => array( 'g:mpn', true ),
304
+ 'upc' => array( 'g:gtin', true ),
305
+ 'identifier_exists' => array( 'g:identifier_exists', true ),
306
+ 'item_group_id' => array( 'g:item_group_id', false ),
307
+ 'color' => array( 'g:color', true ),
308
+ 'gender' => array( 'g:gender', true ),
309
+ 'age_group' => array( 'g:age_group', true ),
310
+ 'material' => array( 'g:material', true ),
311
+ 'pattern' => array( 'g:pattern', true ),
312
+ 'size' => array( 'g:size', true ),
313
+ 'size_type' => array( 'g:size_type', true ),
314
+ 'size_system' => array( 'g:size_system', true ),
315
+ 'tax' => array( 'tax', true ),
316
+ 'weight' => array( 'g:shipping_weight', false ),
317
+ 'length' => array( 'g:shipping_length', false ),
318
+ 'width' => array( 'g:shipping_width', false ),
319
+ 'height' => array( 'g:shipping_height', false ),
320
+ 'ships_from_country' => array( 'g:ships_from_country', false ),
321
+ 'shipping_label' => array( 'g:shipping_label', false ),
322
+ 'shipping_country' => array( 'g:shipping_country', false ),
323
+ 'shipping_service' => array( 'g:shipping_service', false ),
324
+ 'shipping_price' => array( 'g:shipping_price', false ),
325
+ 'shipping_region' => array( 'g:shipping_region', false ),
326
+ 'multipack' => array( 'g:multipack', true ),
327
+ 'is_bundle' => array( 'g:is_bundle', true ),
328
+ 'adult' => array( 'g:adult', true ),
329
+ 'adwords_redirect' => array( 'g:adwords_redirect', true ),
330
+ 'custom_label_0' => array( 'g:custom_label_0', true ),
331
+ 'custom_label_1' => array( 'g:custom_label_1', true ),
332
+ 'custom_label_2' => array( 'g:custom_label_2', true ),
333
+ 'custom_label_3' => array( 'g:custom_label_3', true ),
334
+ 'custom_label_4' => array( 'g:custom_label_4', true ),
335
+ 'excluded_destination' => array( 'g:excluded_destination', true ),
336
+ 'expiration_date' => array( 'g:expiration_date', true ),
337
+ 'unit_pricing_measure' => array( 'g:unit_pricing_measure', true ),
338
+ 'unit_pricing_base_measure' => array( 'g:unit_pricing_base_measure', true ),
339
+ 'energy_efficiency_class' => array( 'g:energy_efficiency_class', true ),
340
+ 'loyalty_points' => array( 'g:loyalty_points', true ),
341
+ 'installment' => array( 'g:installment', true ),
342
+ 'promotion_id' => array( 'g:promotion_id', true ),
343
+ 'cost_of_goods_sold' => array( 'g:cost_of_goods_sold', true ),
344
+ 'availability_date' => array( 'g:availability_date', true ),
345
+ 'tax_category' => array( 'g:tax_category', true ),
346
+ 'included_destination' => array( 'g:included_destination', true ),
347
+ 'quantity_to_sell_on_facebook' => array( 'g:quantity_to_sell_on_facebook', true ),
348
  );
349
  public $facebookCSVTXTAttribute
350
  = array(
351
+ 'id' => array( 'id', false ),
352
+ 'title' => array( 'title', true ),
353
+ 'description' => array( 'description', true ),
354
+ 'link' => array( 'link', true ),
355
+ 'mobile_link' => array( 'mobile_link', true ),
356
+ 'product_type' => array( 'product type', true ),
357
+ 'current_category' => array( 'google product category', true ),
358
+ 'image' => array( 'image link', true ),
359
+ 'images' => array( 'additional image link', true ),
360
+ 'images_1' => array( 'additional image link', true ),
361
+ 'images_2' => array( 'additional image link', true ),
362
+ 'images_3' => array( 'additional image link', true ),
363
+ 'images_4' => array( 'additional image link', true ),
364
+ 'images_5' => array( 'additional image link', true ),
365
+ 'images_6' => array( 'additional image link', true ),
366
+ 'images_7' => array( 'additional image link', true ),
367
+ 'images_8' => array( 'additional image link', true ),
368
+ 'images_9' => array( 'additional image link', true ),
369
+ 'images_10' => array( 'additional image link', true ),
370
+ 'condition' => array( 'condition', false ),
371
+ 'availability' => array( 'availability', false ),
372
+ 'inventory' => array( 'inventory', false ),
373
+ 'override' => array( 'override', false ),
374
+ 'price' => array( 'price', true ),
375
+ 'sale_price' => array( 'sale price', true ),
376
+ 'sale_price_effective_date' => array( 'sale price effective date', true ),
377
+ 'brand' => array( 'brand', true ),
378
+ 'sku' => array( 'mpn', true ),
379
+ 'upc' => array( 'gtin', true ),
380
+ 'identifier_exists' => array( 'identifier exists', true ),
381
+ 'item_group_id' => array( 'item group id', false ),
382
+ 'color' => array( 'color', true ),
383
+ 'gender' => array( 'gender', true ),
384
+ 'age_group' => array( 'age group', true ),
385
+ 'material' => array( 'material', true ),
386
+ 'pattern' => array( 'pattern', true ),
387
+ 'size' => array( 'size', true ),
388
+ 'size_type' => array( 'size type', true ),
389
+ 'size_system' => array( 'size system', true ),
390
+ 'tax' => array( 'tax', true ),
391
+ 'weight' => array( 'shipping weight', false ),
392
+ 'length' => array( 'shipping length', false ),
393
+ 'width' => array( 'shipping width', false ),
394
+ 'height' => array( 'shipping height', false ),
395
+ 'ships_from_country' => array( 'ships from country', false ),
396
+ 'shipping_label' => array( 'shipping label', false ),
397
+ 'shipping_country' => array( 'shipping country', false ),
398
+ 'shipping_service' => array( 'shipping service', false ),
399
+ 'shipping_price' => array( 'shipping price', false ),
400
+ 'shipping_region' => array( 'shipping region', false ),
401
+ 'multipack' => array( 'multipack', true ),
402
+ 'is_bundle' => array( 'is bundle', true ),
403
+ 'adult' => array( 'adult', true ),
404
+ 'adwords_redirect' => array( 'adwords redirect', true ),
405
+ 'custom_label_0' => array( 'custom label 0', true ),
406
+ 'custom_label_1' => array( 'custom label 1', true ),
407
+ 'custom_label_2' => array( 'custom label 2', true ),
408
+ 'custom_label_3' => array( 'custom label 3', true ),
409
+ 'custom_label_4' => array( 'custom label 4', true ),
410
+ 'excluded_destination' => array( 'excluded destination', true ),
411
+ 'expiration_date' => array( 'expiration date', true ),
412
+ 'unit_pricing_measure' => array( 'unit pricing measure', true ),
413
+ 'unit_pricing_base_measure' => array( 'unit pricing base measure', true ),
414
+ 'energy_efficiency_class' => array( 'energy efficiency class', true ),
415
+ 'loyalty_points' => array( 'loyalty points', true ),
416
+ 'installment' => array( 'installment', true ),
417
+ 'promotion_id' => array( 'promotion id', true ),
418
+ 'cost_of_goods_sold' => array( 'cost of goods sold', true ),
419
+ 'availability_date' => array( 'availability date', true ),
420
+ 'tax_category' => array( 'tax category', true ),
421
+ 'included_destination' => array( 'included destination', true ),
422
+ 'quantity_to_sell_on_facebook' => array( 'quantity_to_sell_on_facebook', true ),
423
  );
424
  public $pinterestXMLAttribute
425
  = array(
604
  'color' => array( 'color', false ),
605
  'size' => array( 'size', false ),
606
  'weight' => array( 'weight', false ),
607
+ 'quantity' => array( 'quantity', false ),
608
  );
609
 
610
  public $gLocalAttributes
611
  = array(
612
+ 'description' => array( 'description', true ),
613
  );
614
 
615
  public $gActionAttributes
616
  = array(
617
+ 'description' => array( 'description', true ),
618
  );
619
 
620
  public function __construct() {
812
  */
813
  public function facebookAttributes() {
814
  return array(
815
+ '--1' => 'Basic Information',
816
+ 'id' => 'Product Id[id]',
817
+ 'title' => 'Product Title[title]',
818
+ 'description' => 'Product Description[description]',
819
+ 'link' => 'Product URL[link]',
820
+ 'mobile_link' => 'Product URL[mobile_link]',
821
+ 'product_type' => 'Product Categories[product_type] ',
822
+ 'fb_product_category' => 'Facebook Product Category[fb_product_category]',
823
+ 'current_category' => 'Google Product Category[google_product_category]',
824
+ 'image' => 'Main Image[image_link]',
825
+ 'images' => 'Additional Images [additional_image_link]',
826
+ 'images_1' => 'Additional Image 1 [additional_image_link]',
827
+ 'images_2' => 'Additional Image 2 [additional_image_link]',
828
+ 'images_3' => 'Additional Image 3 [additional_image_link]',
829
+ 'images_4' => 'Additional Image 4 [additional_image_link]',
830
+ 'images_5' => 'Additional Image 5 [additional_image_link]',
831
+ 'images_6' => 'Additional Image 6 [additional_image_link]',
832
+ 'images_7' => 'Additional Image 7 [additional_image_link]',
833
+ 'images_8' => 'Additional Image 8 [additional_image_link]',
834
+ 'images_9' => 'Additional Image 9 [additional_image_link]',
835
+ 'images_10' => 'Additional Image 10 [additional_image_link]',
836
+ 'condition' => 'Condition[condition]',
837
+ '---1' => '',
838
+ '--2' => 'Availability & Price',
839
+ 'availability' => 'Stock Status[availability]',
840
+ 'availability_date' => 'Availability Date[availability_date]',
841
+ 'price' => 'Regular Price[price]',
842
+ 'sale_price' => 'Sale Price[sale_price]',
843
+ 'sale_price_effective_date' => 'Sale Price Effective Date[sale_price_effective_date]',
844
+ '---2' => '',
845
+ '--3' => 'Unique Product Identifiers',
846
+ 'brand' => 'Manufacturer[brand]',
847
+ 'gtin' => 'GTIN[gtin]',
848
+ 'mpn' => 'MPN[mpn]',
849
+ 'identifier_exists' => 'Identifier Exist[identifier_exists]',
850
+ '---3' => '',
851
+ '--4' => 'Detailed Product Attributes',
852
+ 'item_group_id' => 'Item Group Id[item_group_id]',
853
+ 'color' => 'Color[color]',
854
+ 'gender' => 'Gender[gender]',
855
+ 'age_group' => 'Age Group[age_group]',
856
+ 'material' => 'Material[material]',
857
+ 'pattern' => 'Pattern[pattern]',
858
+ 'size' => 'Size of the item[size]',
859
+ '---4' => '',
860
+ '--5' => 'Tax & Shipping',
861
+ 'tax' => 'Tax[tax]',
862
+ 'tax_country' => 'Tax Country[tax_country]',
863
+ 'tax_region' => 'Tax Region[tax_region]',
864
+ 'tax_rate' => 'Tax Rate[tax_rate]',
865
+ 'tax_ship' => 'Tax Ship[tax_ship]',
866
+ 'tax_category' => 'Tax[tax_category]',
867
+ 'shipping' => 'Shipping',
868
+ 'shipping_weight' => 'Shipping Weight[shipping_weight]',
869
+ '---5' => '',
870
+ '--6' => 'Custom Label Attributes',
871
+ 'custom_label_0' => 'Custom label 0 [custom_label_0]',
872
+ 'custom_label_1' => 'Custom label 1 [custom_label_1]',
873
+ 'custom_label_2' => 'Custom label 2 [custom_label_2]',
874
+ 'custom_label_3' => 'Custom label 3 [custom_label_3]',
875
+ 'custom_label_4' => 'Custom label 4 [custom_label_4]',
876
+ '---6' => '',
877
+ '--7' => 'Additional Attributes',
878
+ 'inventory' => 'Facebook Inventory[inventory]',
879
+ 'override' => 'Facebook Override[override]',
880
+ 'status' => 'Status [status]',
881
+ 'video' => 'Video [video]',
882
+ 'unit_price_value' => 'Unit Price > Value [unit_price_value]',
883
+ 'unit_price_currency' => 'Unit Price > Currency [unit_price_currency]',
884
+ 'unit_price_unit' => 'Unit Price > Unit [unit_price_unit]',
885
+ 'quantity_to_sell_on_facebook' => 'Quantity to Sell on Facebook [quantity_to_sell_on_facebook]',
886
+ 'commerce_tax_category' => 'Commerce Tax Category [commerce_tax_category]',
887
+ 'expiration_date' => 'Expiration Date[expiration_date]',
888
+ 'marked_for_product_launch' => 'Marked for Product Launce [marked_for_product_launch]',
889
+ 'rich_text_description' => 'Rich Text Description [rich_text_description]',
890
+ 'visibility' => 'Visibility [visibility]',
891
+ 'additional_variant_label' => 'Additional Variant Attribute > Label [Variant Label]',
892
+ 'additional_variant_value' => 'Additional Variant Attribute > Value [Variant Value]',
893
+ 'applink' => 'Applink [applink]',
894
+ 'origin_country' => 'Origin Country [origin_country]',
895
+ 'importer_name' => 'Importer Name [importer_name]',
896
+ 'importer_address' => 'Importer Address [importer_address]',
897
+ 'manufacturer_info' => 'Manufacturer Info [manufacturer_info]',
898
+ 'return_policy_info' => 'Return Policy Info [return_policy_info]',
899
+ '---7' => '',
900
  );
901
  }
902
 
1007
  'link' => 'Product URL[link]',
1008
  'image' => 'Main Image[image]',
1009
  'pubDate' => 'Publish Date[pubDate]',
1010
+ 'guid' => 'GUID[guid]',
1011
  '---1' => '',
1012
 
1013
  );
1061
  */
1062
  public function tiktokAttributes() {
1063
  return array(
1064
+ '--1' => 'Basic Information',
1065
+ 'sku_id' => 'SKU ID[id]',
1066
+ 'title' => 'Product Title[title]',
1067
+ 'description' => 'Product description[description]',
1068
+ 'availability' => 'Availability[availability]',
1069
+ 'condition' => 'Condition[condition]',
1070
+ 'price' => 'Price[price]',
1071
+ 'sale_price' => 'Sale Price[sale_price]',
1072
+ 'shipping' => 'Shipping[shipping]',
1073
+ 'tax ' => 'Tax[tax]',
1074
+ 'shipping_weight' => 'Shipping Weight[shipping_weight]',
1075
+ 'link' => 'Product URL[link]',
1076
+ 'image_link' => 'Product Image[image_link]',
1077
+ 'additional_image_link' => 'Additional Image [additional_image_link]',
1078
+ 'item_group_id' => 'Parent ID[item_group_id]',
1079
+ 'brand' => 'Product Brand[brand]',
1080
+ 'gtin' => 'Gtin[gtin]',
1081
+ 'mpn' => 'MPN[mpn]',
1082
  'google_product_category' => 'Google Product Category[google_product_category]',
1083
+ 'video_link' => 'Video Link[video_link]',
1084
+ 'age_group' => 'Age Group[age_group]',
1085
+ 'color' => 'Color[color]',
1086
+ 'size' => 'Size[size]',
1087
+ 'gender' => 'Gender[gender]',
1088
+ 'material' => 'Material[material]',
1089
+ 'pattern' => 'Pattern[pattern]',
1090
+ 'product_type' => 'Product Type[product_type]',
1091
+ 'ios_url' => 'IOS URL[ios_url]',
1092
+ 'ios_app_store_id' => 'IOS App Store ID[ios_app_store_id]',
1093
+ 'ios_app_name' => 'IOS App Name[ios_app_name]',
1094
+ 'iPhone_url' => 'iPhone URL[iPhone_url]',
1095
+ 'iPhone_app_store_id' => 'iPhone App Store ID[iPhone_app_store_id]',
1096
+ 'iPhone_app_name' => 'iPhone App Name[iPhone_app_name]',
1097
+ 'iPad_url' => 'iPad URL[iPad_url]',
1098
+ 'iPad_app_store_id' => 'iPad App Store ID[iPad_app_store_id]',
1099
+ 'iPad_app_name' => 'iPad App Name[iPad_app_name]',
1100
+ 'android_url' => 'Android URL[android_url]',
1101
+ 'android_package' => 'Android Package[android_package]',
1102
+ 'android_app_name' => 'Android App Name[android_app_name]',
1103
+ 'custom_label_0' => 'custom_label_0[custom_label_0]',
1104
+ 'custom_label_1' => 'custom_label_1[custom_label_1]',
1105
+ 'custom_label_2' => 'custom_label_2[custom_label_2]',
1106
+ 'custom_label_3' => 'custom_label_3[custom_label_3]',
1107
+ 'custom_label_4' => 'custom_label_4[custom_label_4]',
1108
+ 'merchant_brand' => 'Merchant Brand[merchant_brand]',
1109
+ 'productHisEval' => 'Purchase Count:FeedBack[productHisEval]',
1110
  'sale_price_effective_date' => 'Sale Price Effective Date[sale_price_effective_date]',
1111
  );
1112
  }
includes/classes/class-woo-feed-dropdown.php CHANGED
@@ -473,7 +473,7 @@ class Woo_Feed_Dropdown {
473
  $attributes = array_merge( $attributes,$unit_price_attributes);
474
  $attributes += array(
475
  'wc_germanized_gtin' => 'GTIN',
476
- 'wc_germanized_mpn' => 'MPN',
477
  );
478
  $attributes['---4'] = '';
479
  }else {
473
  $attributes = array_merge( $attributes,$unit_price_attributes);
474
  $attributes += array(
475
  'wc_germanized_gtin' => 'GTIN',
476
+ 'wc_germanized_mpn' => 'MPN',
477
  );
478
  $attributes['---4'] = '';
479
  }else {
includes/classes/class-woo-feed-products-v3.php CHANGED
@@ -9,7 +9,7 @@
9
 
10
  use RankMath\Helper;
11
 
12
- if (!defined('ABSPATH')) {
13
  die();
14
  }
15
 
@@ -198,7 +198,7 @@ class Woo_Feed_Products_v3
198
  * @var array
199
  */
200
  protected $skipped_merchant_attributes = array(
201
- 'google' => array(
202
  'shipping_country',
203
  'shipping_region',
204
  'shipping_postal_code',
@@ -221,7 +221,7 @@ class Woo_Feed_Products_v3
221
  'attribute_name',
222
  'attribute_value',
223
  ),
224
- 'facebook' => array(
225
  'shipping_country',
226
  'shipping_region',
227
  'shipping_service',
@@ -244,7 +244,7 @@ class Woo_Feed_Products_v3
244
  'additional_variant_label',
245
  'additional_variant_value',
246
  ),
247
- 'bing' => array(
248
  'shipping_country',
249
  'shipping_service',
250
  'shipping_price',
@@ -322,8 +322,7 @@ class Woo_Feed_Products_v3
322
  * @param $config
323
  * @return void
324
  */
325
- public function __construct($config)
326
- {
327
  $this->config = woo_feed_parse_feed_rules($config);
328
  $this->queryType = woo_feed_get_options('product_query_type');
329
  $this->process_xml_wrapper();
@@ -335,53 +334,51 @@ class Woo_Feed_Products_v3
335
  * @param string $type
336
  * @return array
337
  */
338
- protected function get_query_args($type = 'wc')
339
- {
340
  $args = [];
341
 
342
  // Include Product Variations with db query if configured
343
  $variation_query = woo_feed_get_options('variation_query_type');
344
 
345
- if ('wc' === $type) {
346
  $product_types = $this->product_types;
347
- if ('variable' === $variation_query)
348
- {
349
  $variation = array_search('variation', $product_types, true);
350
- if($variation){
351
- unset($product_types[$variation]);
352
  }
353
  }
354
 
355
  $args = array(
356
  'limit' => -1, // phpcs:ignore
357
- 'status' => $this->post_status,
358
- 'type' => $product_types,
359
- 'orderby' => 'date',
360
- 'order' => 'DESC',
361
- 'return' => 'ids',
362
  'suppress_filters' => false,
363
  );
364
  }
365
 
366
- if ('wp' === $type) {
367
 
368
  $post_type = 'product';
369
  // Include Product Variations with db query if configured
370
  $variation_query = woo_feed_get_options('variation_query_type');
371
- if ('individual' === $variation_query) {
372
- $post_type = ['product', 'product_variation'];
373
  }
374
 
375
  $args = array(
376
  'posts_per_page' => -1, // phpcs:ignore
377
- 'post_type' => $post_type,
378
- 'post_status' => 'publish',
379
- 'order' => 'DESC',
380
- 'fields' => 'ids',
381
- 'cache_results' => false,
382
  'update_post_meta_cache' => false,
383
  'update_post_term_cache' => false,
384
- 'suppress_filters' => false,
385
  );
386
  }
387
  return $args;
@@ -392,15 +389,14 @@ class Woo_Feed_Products_v3
392
  *
393
  * @return array
394
  */
395
- public function get_wc_query_products()
396
- {
397
  $args = $this->get_query_args('wc');
398
- if (woo_feed_is_debugging_enabled()) {
399
  woo_feed_log_feed_process($this->config['filename'], 'WC_Product_Query Args::' . PHP_EOL . print_r($args, true)); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_print_r
400
  woo_feed_log($this->config['filename'], 'WC_Product_Query Args::' . PHP_EOL . print_r($args, true), 'info'); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_print_r
401
  }
402
  $query = new WC_Product_Query($args);
403
- if (woo_feed_is_debugging_enabled()) {
404
  woo_feed_log_feed_process($this->config['filename'], sprintf('WC_Product_Query Args ::' . PHP_EOL . '%s', print_r($args, true))); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_print_r
405
  }
406
  return $query->get_products();
@@ -411,11 +407,10 @@ class Woo_Feed_Products_v3
411
  *
412
  * return array
413
  */
414
- public function get_wp_query_products()
415
- {
416
  $args = $this->get_query_args('wp');
417
  $query = new WP_Query($args);
418
- if (!is_wp_error($query) && woo_feed_is_debugging_enabled()) {
419
  woo_feed_log_feed_process($this->config['filename'], 'WC_Product_Query Args::' . PHP_EOL . print_r($args, true)); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_print_r
420
  woo_feed_log_feed_process($this->config['filename'], sprintf('WP_Query Request ::' . PHP_EOL . '%s', $query->request));
421
  woo_feed_log($this->config['filename'], 'WC_Product_Query Args::' . PHP_EOL . print_r($args, true), 'info'); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_print_r
@@ -429,14 +424,13 @@ class Woo_Feed_Products_v3
429
  *
430
  * @return array
431
  */
432
- public function query_products()
433
- {
434
  $products = [];
435
- if ('wc' == $this->queryType) {
436
  $products = $this->get_wc_query_products();
437
- } elseif ('wp' == $this->queryType) {
438
  $products = $this->get_wp_query_products();
439
- } elseif ('both' == $this->queryType) {
440
  $wc = $this->get_wc_query_products();
441
  $wp = $this->get_wp_query_products();
442
  $products = array_unique(array_merge($wc, $wp));
@@ -452,25 +446,24 @@ class Woo_Feed_Products_v3
452
  * Organize Feed Attribute config
453
  * @return array|bool
454
  */
455
- public function get_attribute_config()
456
- {
457
- if (empty($this->config)) {
458
  return false;
459
  }
460
 
461
  $attributeConfig = array();
462
  $merchantAttributes = $this->config['mattributes'];
463
- if (!empty($merchantAttributes)) {
464
  $i = 0;
465
- foreach ($merchantAttributes as $key => $value) {
466
- $attributeConfig[$i]['mattributes'] = $value;
467
- $attributeConfig[$i]['prefix'] = $this->config['prefix'][$key];
468
- $attributeConfig[$i]['type'] = $this->config['type'][$key];
469
- $attributeConfig[$i]['attributes'] = $this->config['attributes'][$key];
470
- $attributeConfig[$i]['default'] = $this->config['default'][$key];
471
- $attributeConfig[$i]['suffix'] = $this->config['suffix'][$key];
472
- $attributeConfig[$i]['output_type'] = $this->config['output_type'][$key];
473
- $attributeConfig[$i]['limit'] = $this->config['limit'][$key];
474
  $i++;
475
  }
476
  }
@@ -487,10 +480,9 @@ class Woo_Feed_Products_v3
487
  * @since 3.2.0
488
  *
489
  */
490
- public function get_products($productIds)
491
- {
492
 
493
- if (empty($productIds)) {
494
  return [];
495
  }
496
 
@@ -507,19 +499,19 @@ class Woo_Feed_Products_v3
507
  */
508
  do_action('woo_feed_before_product_loop', $productIds, $this->config);
509
 
510
- foreach ($productIds as $key => $pid) {
511
  woo_feed_log_feed_process($this->config['filename'], sprintf('Loading Product Data For %d.', $pid));
512
  $product = wc_get_product($pid);
513
 
514
- if ($this->exclude_from_loop($product)) {
515
  continue;
516
  }
517
 
518
- if ($this->process_variation($product)) {
519
  continue;
520
  }
521
 
522
- if (!$this->filter_product($product)) {
523
  woo_feed_log_feed_process($this->config['filename'], 'Skipping Product :: Matched with filter conditions');
524
  continue;
525
  }
@@ -527,7 +519,7 @@ class Woo_Feed_Products_v3
527
  woo_feed_log_feed_process($this->config['filename'], 'Formatting Feed Data...');
528
 
529
  // Add Single item wrapper before product info loop start
530
- if ('xml' == $this->config['feedType']) {
531
  $this->feedBody .= "\n";
532
  $this->feedBody .= '<' . $this->config['itemWrapper'] . '>';
533
  $this->feedBody .= "\n";
@@ -543,14 +535,14 @@ class Woo_Feed_Products_v3
543
  woo_feed_log_feed_process($this->config['filename'], 'Processing Merchant Specific Fields');
544
  // Process feed data for uncommon merchant feed like Google,Facebook,Pinterest
545
  $this->process_for_merchant($product, $this->pi);
546
- } catch (Exception $e) {
547
  $message = 'Error Processing Merchant Specific Fields.' . PHP_EOL . 'Caught Exception :: ' . $e->getMessage();
548
  woo_feed_log($this->config['filename'], $message, 'critical', $e, true);
549
  woo_feed_log_fatal_error($message, $e);
550
  }
551
 
552
- if ('xml' == $this->config['feedType']) {
553
- if (empty($this->feedHeader)) {
554
  $this->feedHeader = $this->process_xml_feed_header();
555
  $this->feedFooter = $this->process_xml_feed_footer();
556
 
@@ -559,17 +551,17 @@ class Woo_Feed_Products_v3
559
  $this->feedBody .= '</' . $this->config['itemWrapper'] . '>';
560
 
561
 
562
- } elseif ('txt' == $this->config['feedType']) {
563
- if (empty($this->feedHeader)) {
564
  $this->process_txt_feed_header();
565
  }
566
  $this->process_txt_feed_body();
567
- } elseif ('csv' == $this->config['feedType']) {
568
- if (empty($this->feedHeader)) {
569
  $this->process_csv_feed_header();
570
  }
571
  $this->process_csv_feed_body();
572
- }elseif ('json' == $this->config['feedType']){
573
  $this->process_json_feed_body();
574
  }
575
  woo_feed_log_feed_process($this->config['filename'], 'Done Formatting...');
@@ -596,17 +588,16 @@ class Woo_Feed_Products_v3
596
  * @return bool
597
  * @since 3.3.9
598
  */
599
- protected function process_variation($product)
600
- {
601
  // Apply variable and variation settings
602
- if ($product->is_type('variable') && $product->has_child()) {
603
  $this->pi++;
604
 
605
  $variation_query = woo_feed_get_options('variation_query_type');
606
- if ('variable' === $variation_query) {
607
  $variations = $product->get_visible_children();
608
- if (is_array($variations) && (sizeof($variations) > 0)) {
609
- if (woo_feed_is_debugging_enabled()) {
610
  woo_feed_log_feed_process($this->config['filename'], sprintf('Getting Variation Product(s) :: %s', implode(', ', $variations)));
611
  }
612
  $this->get_products($variations);
@@ -626,44 +617,43 @@ class Woo_Feed_Products_v3
626
  * @return void
627
  * @since 3.3.9
628
  */
629
- protected function process_attributes($product)
630
- {
631
  // Get Product Attribute values by type and assign to product array
632
- foreach ($this->config['attributes'] as $attr_key => $attribute) {
633
 
634
- $merchant_attribute = isset($this->config['mattributes'][$attr_key]) ? $this->config['mattributes'][$attr_key] : '';
635
 
636
- if ($this->exclude_current_attribute($product, $merchant_attribute, $attribute)) {
637
  continue;
638
  }
639
 
640
  // Add Prefix and Suffix into Output
641
- $prefix = $this->config['prefix'][$attr_key];
642
- $suffix = $this->config['suffix'][$attr_key];
643
  $merchant = $this->config['provider'];
644
  $feedType = $this->config['feedType'];
645
 
646
- if ('pattern' == $this->config['type'][$attr_key]) {
647
- $attributeValue = $this->config['default'][$attr_key];
648
  } else { // Get Pattern value
649
  $attributeValue = $this->getAttributeValueByType($product, $attribute, $merchant_attribute);
650
  }
651
 
652
  // Format Output according to Output Type config.
653
- if (isset($this->config['output_type'][$attr_key])) {
654
- $outputType = $this->config['output_type'][$attr_key];
655
- $attributeValue = $this->format_output($attributeValue, $this->config['output_type'][$attr_key], $product, $attribute, $merchant_attribute);
656
  }
657
 
658
  // Limit Output.
659
- if (isset($this->config['limit'][$attr_key])) {
660
- $attributeValue = $this->crop_string($attributeValue, 0, $this->config['limit'][$attr_key]);
661
  }
662
 
663
  // Process prefix and suffix.
664
  $attributeValue = $this->process_prefix_suffix($attributeValue, $prefix, $suffix, $attribute);
665
 
666
- if ('xml' == $feedType) {
667
 
668
  // Replace XML Nodes according to merchant requirement.
669
  $getReplacedAttribute = woo_feed_replace_to_merchant_attribute($merchant_attribute, $merchant, $feedType);
@@ -672,16 +662,16 @@ class Woo_Feed_Products_v3
672
  $getReplacedAttribute = str_replace(' ', '_', $getReplacedAttribute);
673
 
674
  // Trim XML Element text & Encode for UTF-8.
675
- if (!empty($attributeValue)) {
676
  $attributeValue = trim($attributeValue);
677
 
678
- if ('custom' === $this->config['provider'] && strpos($attributeValue, '<![CDATA[') === false ) {
679
  $attributeValue = htmlentities($attributeValue, ENT_XML1 | ENT_QUOTES, 'UTF-8');
680
  }
681
  }
682
 
683
  // Add closing XML node if value is empty
684
- if ('' !== $attributeValue) {
685
  // Add CDATA wrapper for XML feed to prevent XML error.
686
  $attributeValue = woo_feed_add_cdata($merchant_attribute, $attributeValue, $merchant, $this->config['feedType']);
687
 
@@ -693,40 +683,40 @@ class Woo_Feed_Products_v3
693
  $this->feedBody .= '<' . $getReplacedAttribute . '/>';
694
  $this->feedBody .= "\n";
695
  }
696
- } elseif (in_array($feedType, ['csv', 'tsv', 'xls'], true)) {
697
  $merchant_attribute = woo_feed_replace_to_merchant_attribute($merchant_attribute, $merchant, $feedType);
698
  $merchant_attribute = $this->processStringForCSV($merchant_attribute);
699
 
700
- if ("shipping" === $merchant_attribute && 'bing' == $this->config['provider']) {
701
  $merchant_attribute = 'shipping(country:service:price)';
702
- } elseif ("shipping" === $merchant_attribute) {
703
  $merchant_attribute = 'shipping(country:region:service:price)';
704
  }
705
 
706
- if ("tax" === $merchant_attribute) {
707
  $merchant_attribute = 'tax(country:region:rate:tax_ship)';
708
  }
709
 
710
  $attributeValue = $this->processStringForCSV($attributeValue);
711
 
712
- } elseif ('txt' == $feedType) {
713
  $merchant_attribute = woo_feed_replace_to_merchant_attribute($merchant_attribute, $merchant, $feedType);
714
  $merchant_attribute = $this->processStringForTXT($merchant_attribute);
715
 
716
- if ("shipping" === $merchant_attribute && 'bing' == $this->config['provider']) {
717
  $merchant_attribute = 'shipping(country:service:price)';
718
- } elseif ("shipping" === $merchant_attribute) {
719
  $merchant_attribute = 'shipping(country:region:service:price)';
720
  }
721
 
722
- if ("tax" === $merchant_attribute) {
723
  $merchant_attribute = 'tax(country:region:rate:tax_ship)';
724
  }
725
 
726
  $attributeValue = $this->processStringForTXT($attributeValue);
727
  }
728
 
729
- $this->products[$this->pi][$merchant_attribute] = $attributeValue;
730
  }
731
  }
732
 
@@ -737,12 +727,11 @@ class Woo_Feed_Products_v3
737
  * @since 4.0.5
738
  *
739
  */
740
- protected function feed_nested_attributes()
741
- {
742
  return [
743
- 'reviewer' => ['reviewer', 'name'],
744
- 'ratings' => ['ratings', 'overall'],
745
- 'product_url' => ['products', 'product', 'product_url'],
746
  ];
747
  }
748
 
@@ -757,28 +746,27 @@ class Woo_Feed_Products_v3
757
  *
758
  */
759
 
760
- protected function nested_attributes_element($attribute, $content)
761
- {
762
  $starter = '';
763
  $finisher = '';
764
  $element = '';
765
 
766
- if (empty($attribute)) {
767
  return $attribute;
768
  }
769
 
770
  $attr_names = $this->feed_nested_attributes();
771
 
772
- foreach ($attr_names as $key => $value) {
773
- if ($key === $attribute) {
774
  //starter tags element
775
- foreach ($value as $item_value) {
776
  $starter .= '<' . strval($item_value) . '>';
777
  }
778
 
779
  //finishing tags element
780
  $rev_value = array_reverse($value);
781
- foreach ($rev_value as $item_value) {
782
  $finisher .= '</' . strval($item_value) . '>';
783
  }
784
  }
@@ -799,28 +787,27 @@ class Woo_Feed_Products_v3
799
  * @since 3.3.9
800
  *
801
  */
802
- protected function exclude_from_loop($product)
803
- {
804
  // Skip for invalid products
805
- if (!is_object($product)) {
806
  woo_feed_log_feed_process($this->config['filename'], 'Skipping Product :: Product data is not a valid WC_Product object.');
807
  return true;
808
  }
809
 
810
  // For WP_Query check available product types
811
- if ('wp' == $this->queryType && !in_array($product->get_type(), $this->product_types, true)) {
812
  woo_feed_log_feed_process($this->config['filename'], sprintf('Skipping Product :: Invalid Post/Product Type : %s.', $product->get_type()));
813
  return true;
814
  }
815
 
816
  // Skip orphaned variation
817
- if ($product->is_type('variation') && !$product->get_parent_id()) {
818
  woo_feed_log_feed_process($this->config['filename'], sprintf('Skipping Product :: Orphaned variation product [id: %s] skipped.', $product->get_id()));
819
  return true;
820
  }
821
 
822
  // Skip for invisible products
823
- if (!$product->is_visible()) {
824
  woo_feed_log_feed_process($this->config['filename'], 'Skipping Product :: Product is not visible.');
825
  return true;
826
  }
@@ -841,22 +828,21 @@ class Woo_Feed_Products_v3
841
  * @since 3.3.9
842
  *
843
  */
844
- protected function exclude_current_attribute($product, $merchant_attribute, $product_attribute, $feedType = 'xml')
845
- {
846
 
847
- if (empty($merchant_attribute)) {
848
  return true;
849
  }
850
 
851
  if (
852
  in_array($this->config['provider'], array_keys($this->skipped_merchant_attributes)) &&
853
- in_array($merchant_attribute, $this->skipped_merchant_attributes[$this->config['provider']])
854
 
855
  ) {
856
  return true;
857
  }
858
 
859
- if ('shopping_ads_excluded_country' !== $merchant_attribute && in_array($merchant_attribute, $this->processed_merchant_attributes)) {
860
  return true;
861
  }
862
 
@@ -876,13 +862,12 @@ class Woo_Feed_Products_v3
876
  * @see substr
877
  *
878
  */
879
- protected function crop_string($string, $start = 0, $limit = null)
880
- {
881
  $limit = absint($limit);
882
- if ($limit > 0) {
883
  $start = absint($start);
884
- if (strpos($string, '<![CDATA[') !== false) {
885
- $string = str_replace(array('<![CDATA[', ']]>'), array('', ''), $string);
886
  $string = substr($string, $start, $limit);
887
  $string = '<![CDATA[' . $string . ']]>';
888
  } else {
@@ -900,9 +885,8 @@ class Woo_Feed_Products_v3
900
  *
901
  * @since 3.2.0
902
  */
903
- protected function process_for_merchant($productObj, $index)
904
- {
905
- $product = $this->products[$index];
906
  $merchantAttributes = $this->config['mattributes'];
907
  $s = 0; // Shipping Index
908
  $i = 0; // Installment Index
@@ -923,117 +907,117 @@ class Woo_Feed_Products_v3
923
 
924
  // Format Shipping and Tax data for CSV and TXT feed only for google and facebook
925
 
926
- if ('xml' != $this->config['feedType'] && in_array($this->config['provider'], array('google', 'facebook', 'bing', 'snapchat', 'pinterest'))) {
927
- foreach ($merchantAttributes as $key => $value) {
928
 
929
- if (!in_array($value, $this->google_shipping_tax, true)) {
930
  continue;
931
  }
932
 
933
  # Get value by attribute type with prefix & suffix
934
  $output = $this->process_for_merchant_get_value($productObj, $key);
935
 
936
- if ('shipping_country' == $value) {
937
  $s++;
938
  $shipping .= $output;
939
  }
940
- if ('shipping_region' == $value) {
941
  $shipping .= ':' . $output;
942
- } elseif ('shipping_postal_code' == $value) {
943
  $shipping .= ':' . $output;
944
  }
945
- if ('shipping_service' == $value) {
946
  $shipping .= ':' . $output;
947
  }
948
- if ('shipping_price' == $value) {
949
  $shipping .= ':' . $output;
950
  }
951
 
952
- if ('section_name' == $value) {
953
  $pd++;
954
  $product_detail .= $output;
955
  }
956
- if ('attribute_name' == $value) {
957
  $product_detail .= ':' . $output;
958
  }
959
- if ('attribute_value' == $value) {
960
  $product_detail .= ':' . $output;
961
  }
962
 
963
  //facebook nested attributes
964
- if( isset($this->config['provider']) && "facebook" === $this->config['provider'] ) {
965
- if ('unit_price_value' == $value) {
966
  $up++;
967
  $unit_price .= $output;
968
  }
969
- if ('unit_price_currency' == $value) {
970
  $unit_price .= ':' . $output;
971
  }
972
- if ('unit_price_unit' == $value) {
973
  $unit_price .= ':' . $output;
974
  }
975
 
976
- if ('additional_variant_label' == $value) {
977
  $av++;
978
  $additional_variant_attribute .= $output;
979
  }
980
- if ('additional_variant_value' == $value) {
981
  $additional_variant_attribute .= ':' . $output;
982
  }
983
 
984
- if (0 < $up) {
985
- $this->products[$this->pi]["unit_price"] = $unit_price;
986
  }
987
 
988
- if (0 < $av) {
989
- $this->products[$this->pi]["additional_variant_attribute"] = $additional_variant_attribute;
990
  }
991
  }
992
 
993
 
994
- if ('installment_months' == $value) {
995
  $ins++;
996
  $installment .= $output;
997
  }
998
- if ('installment_amount' == $value) {
999
  $installment .= ':' . $output;
1000
  }
1001
 
1002
- if ('subscription_period' == $value) {
1003
  $sub++;
1004
  $subscription .= $output;
1005
  }
1006
- if ('subscription_period_length' == $value) {
1007
  $subscription .= ':' . $output;
1008
  }
1009
- if ('subscription_amount' == $value) {
1010
  $subscription .= ':' . $output;
1011
  }
1012
  }
1013
 
1014
- if (0 < $pd) {
1015
- $this->products[$this->pi]["product detail"] = $product_detail;
1016
  }
1017
 
1018
- if (0 < $sub) {
1019
- $this->products[$this->pi]["subscription cost"] = $subscription;
1020
 
1021
  }
1022
 
1023
- if (0 < $ins) {
1024
- $this->products[$this->pi]["installment"] = $installment;
1025
  }
1026
  }
1027
 
1028
 
1029
- if (in_array($this->config['provider'], array('google', 'facebook', 'snapchat', 'bing', 'pinterest'))) {
1030
 
1031
 
1032
  // Reformat Shipping attributes for google, facebook
1033
- if ('xml' == $this->config['feedType']) {
1034
- foreach ($merchantAttributes as $key => $value) {
1035
 
1036
- if (!in_array($value, $this->google_shipping_tax)) {
1037
  continue;
1038
  }
1039
 
@@ -1042,16 +1026,16 @@ class Woo_Feed_Products_v3
1042
  $output = $this->process_for_merchant_get_value($productObj, $key);
1043
 
1044
 
1045
- if ('shipping_country' == $value) {
1046
- if (0 == $s) {
1047
  $shipping .= '<g:shipping>';
1048
  $s = 1;
1049
  } else {
1050
  $shipping .= '</g:shipping>' . "\n";
1051
  $shipping .= '<g:shipping>';
1052
  }
1053
- } elseif (!in_array('shipping_country', $merchantAttributes) && 'shipping_price' == $value) {
1054
- if (0 == $s) {
1055
  $shipping .= '<g:shipping>';
1056
  $s = 1;
1057
  } else {
@@ -1060,20 +1044,20 @@ class Woo_Feed_Products_v3
1060
  }
1061
  }
1062
 
1063
- if ('shipping_country' == $value) {
1064
  $shipping .= '<g:country>' . $output . '</g:country>' . "\n";
1065
- } elseif ('shipping_region' == $value) {
1066
  $shipping .= '<g:region>' . $output . '</g:region>' . "\n";
1067
- } elseif ('shipping_region' == $value) {
1068
  $shipping .= '<g:region>' . $output . '</g:region>' . "\n";
1069
- } elseif ('shipping_service' == $value) {
1070
  $shipping .= '<g:service>' . $output . '</g:service>' . "\n";
1071
- } elseif ('shipping_postal_code' == $value) {
1072
  $shipping .= '<g:postal_code>' . $output . '</g:postal_code>' . "\n";
1073
- } elseif ('shipping_price' == $value) {
1074
  $shipping .= '<g:price>' . $output . '</g:price>' . "\n";
1075
- } elseif ('tax_country' == $value) {
1076
- if (0 == $t) {
1077
  $tax .= '<g:tax>';
1078
  $t = 1;
1079
  } else {
@@ -1081,14 +1065,14 @@ class Woo_Feed_Products_v3
1081
  $tax .= '<g:tax>';
1082
  }
1083
  $tax .= '<g:country>' . $output . '</g:country>' . "\n";
1084
- } elseif ('tax_region' == $value) {
1085
  $tax .= '<g:region>' . $output . '</g:region>' . "\n";
1086
- } elseif ('tax_rate' == $value) {
1087
  $tax .= '<g:rate>' . $output . '</g:rate>' . "\n";
1088
- } elseif ('tax_ship' == $value) {
1089
  $tax .= '<g:tax_ship>' . $output . '</g:tax_ship>' . "\n";
1090
- } elseif ('subscription_period' == $value) {
1091
- if (0 == $sub) {
1092
  $subscription .= '<g:subscription_cost>';
1093
  $sub = 1;
1094
  } else {
@@ -1096,22 +1080,22 @@ class Woo_Feed_Products_v3
1096
  $subscription .= '<g:subscription_cost>';
1097
  }
1098
  $subscription .= '<g:period>' . $output . '</g:period>' . "\n";
1099
- } elseif ('subscription_period_length' == $value) {
1100
  $subscription .= '<g:period_length>' . $output . '</g:period_length>' . "\n";
1101
- } elseif ('subscription_amount' == $value) {
1102
  $subscription .= '<g:amount>' . $output . '</g:amount>' . "\n";
1103
  }
1104
 
1105
- if ('section_name' == $value) {
1106
- if (0 == $pd) {
1107
  $product_detail .= '<g:product_detail>';
1108
  $pd = 1;
1109
  } else {
1110
  $product_detail .= '</g:product_detail>' . "\n";
1111
  $product_detail .= '<g:product_detail>';
1112
  }
1113
- } elseif (!in_array('section_name', $merchantAttributes) && 'attribute_name' == $value) {
1114
- if (0 == $pd) {
1115
  $product_detail .= '<g:product_detail>';
1116
  $pd = 1;
1117
  } else {
@@ -1120,27 +1104,27 @@ class Woo_Feed_Products_v3
1120
  }
1121
  }
1122
 
1123
- if ('section_name' == $value) {
1124
  $product_detail .= '<g:section_name>' . $output . '</g:section_name>' . "\n";
1125
- } elseif ('attribute_name' == $value) {
1126
  $product_detail .= '<g:attribute_name>' . $output . '</g:attribute_name>' . "\n";
1127
- } elseif ('attribute_value' == $value) {
1128
  $product_detail .= '<g:attribute_value>' . $output . '</g:attribute_value>' . "\n";
1129
  }
1130
 
1131
- if( isset($this->config['provider']) && "facebook" === $this->config['provider'] ) {
1132
 
1133
  // unit_price configure
1134
- if ('unit_price_value' == $value) {
1135
- if (0 == $up) {
1136
  $unit_price .= '<unit_price>';
1137
  $up = 1;
1138
  } else {
1139
  $unit_price .= '</unit_price>' . "\n";
1140
  $unit_price .= '<unit_price>';
1141
  }
1142
- } elseif (!in_array('unit_price_value', $merchantAttributes) && 'unit_price_currency' == $value) {
1143
- if (0 == $up) {
1144
  $unit_price .= '<unit_price>';
1145
  $up = 1;
1146
  } else {
@@ -1149,25 +1133,25 @@ class Woo_Feed_Products_v3
1149
  }
1150
  }
1151
 
1152
- if ('unit_price_value' == $value) {
1153
  $unit_price .= '<value>' . $output . '</value>' . "\n";
1154
- } elseif ('unit_price_currency' == $value) {
1155
  $unit_price .= '<currency>' . $output . '</currency>' . "\n";
1156
- } elseif ('unit_price_unit' == $value) {
1157
  $unit_price .= '<unit>' . $output . '</unit>' . "\n";
1158
  }
1159
 
1160
  // additional_variant_attribute configure
1161
- if ('additional_variant_label' == $value) {
1162
- if (0 == $av) {
1163
  $additional_variant_attribute .= '<additional_variant_attribute>';
1164
  $av = 1;
1165
  } else {
1166
  $additional_variant_attribute .= '</additional_variant_attribute>' . "\n";
1167
  $additional_variant_attribute .= '<additional_variant_attribute>';
1168
  }
1169
- } elseif (!in_array('additional_variant_label', $merchantAttributes) && 'additional_variant_value' == $value) {
1170
- if (0 == $av) {
1171
  $additional_variant_attribute .= '<additional_variant_attribute>';
1172
  $av = 1;
1173
  } else {
@@ -1176,17 +1160,16 @@ class Woo_Feed_Products_v3
1176
  }
1177
  }
1178
 
1179
- if ('additional_variant_label' == $value) {
1180
  $additional_variant_attribute .= '<label>' . $output . '</label>' . "\n";
1181
- } elseif ('additional_variant_value' == $value) {
1182
  $additional_variant_attribute .= '<value>' . $output . '</value>' . "\n";
1183
- }
1184
-
1185
- }
1186
 
1187
 
1188
- if ('installment_months' === $value) {
1189
- if (0 == $ins) {
1190
  $installment .= '<g:installment>';
1191
  $ins = 1;
1192
  } else {
@@ -1194,21 +1177,21 @@ class Woo_Feed_Products_v3
1194
  $installment .= '<g:installment>';
1195
  }
1196
  $installment .= '<g:months>' . $output . '</g:months>' . "\n";
1197
- } elseif ('installment_amount' == $value) {
1198
  $installment .= '<g:amount>' . $output . '</g:amount>' . "\n";
1199
  }
1200
  }
1201
 
1202
- if (1 == $pd) {
1203
  $product_detail .= '</g:product_detail>';
1204
  }
1205
 
1206
- if( isset($this->config['provider']) && "facebook" === $this->config['provider'] ) {
1207
- if (1 == $up) {
1208
  $unit_price .= '</unit_price>';
1209
  }
1210
 
1211
- if (1 == $av) {
1212
  $additional_variant_attribute .= '</additional_variant_attribute>';
1213
  }
1214
 
@@ -1216,18 +1199,18 @@ class Woo_Feed_Products_v3
1216
  $this->feedBody .= $additional_variant_attribute;
1217
  }
1218
 
1219
- if (1 == $s) {
1220
  $shipping .= '</g:shipping>';
1221
  }
1222
- if (1 == $t) {
1223
  $tax .= '</g:tax>';
1224
  }
1225
 
1226
- if (1 == $sub) {
1227
  $subscription .= '</g:subscription_cost>';
1228
  }
1229
 
1230
- if (1 == $ins) {
1231
  $installment .= '</g:installment>';
1232
  }
1233
 
@@ -1236,67 +1219,66 @@ class Woo_Feed_Products_v3
1236
  $this->feedBody .= $product_detail;
1237
  $this->feedBody .= $installment;
1238
 
1239
- if ($productObj->is_type('subscription') ||
1240
  $productObj->is_type('variable-subscription') ||
1241
- $productObj->is_type('subscription_variation')) {
1242
  $this->feedBody .= $subscription;
1243
  }
1244
  }
1245
  // ADD g:identifier_exists
1246
- $identifier = array('brand', 'upc', 'sku', 'mpn', 'gtin');
1247
  $countIdentifier = 0;
1248
- if (!in_array('identifier_exists', $merchantAttributes)) {
1249
- if (count(array_intersect_key(array_flip($identifier), $product)) >= 2) {
1250
  // Any 2 required keys exist!
1251
  // @TODO Refactor with OR
1252
- if (array_key_exists('brand', $product) && !empty($product['brand'])) {
1253
  $countIdentifier++;
1254
  }
1255
- if (array_key_exists('upc', $product) && !empty($product['upc'])) {
1256
  $countIdentifier++;
1257
  }
1258
- if (array_key_exists('sku', $product) && !empty($product['sku'])) {
1259
  $countIdentifier++;
1260
  }
1261
- if (array_key_exists('mpn', $product) && !empty($product['mpn'])) {
1262
  $countIdentifier++;
1263
  }
1264
- if (array_key_exists('gtin', $product) && !empty($product['gtin'])) {
1265
  $countIdentifier++;
1266
  }
1267
  }
1268
 
1269
- if ('xml' == $this->config['feedType']) {
1270
- if ($countIdentifier >= 2) {
1271
  $this->feedBody .= '<g:identifier_exists>yes</g:identifier_exists>';
1272
  } else {
1273
  $this->feedBody .= '<g:identifier_exists>no</g:identifier_exists>';
1274
  }
1275
  } else {
1276
  $identifier_exists = 'identifier exists';
1277
- if (in_array($this->config['provider'], array('bing', 'pinterest'))) {
1278
  $identifier_exists = 'identifier_exists';
1279
  }
1280
 
1281
- if ($countIdentifier >= 2) {
1282
- $this->products[$this->pi][$identifier_exists] = 'yes';
1283
  } else {
1284
- $this->products[$this->pi][$identifier_exists] = 'no';
1285
  }
1286
  }
1287
  }
1288
  }
1289
  }
1290
 
1291
- private function process_for_merchant_get_value($productObj, $key)
1292
- {
1293
- $prefix = $this->config['prefix'][$key];
1294
- $suffix = $this->config['suffix'][$key];
1295
- $attribute = $this->config['attributes'][$key];
1296
- $merchant_attribute = $this->config['mattributes'][$key];
1297
 
1298
- if ('pattern' == $this->config['type'][$key]) {// Get Pattern value.
1299
- $output = $this->config['default'][$key];
1300
  $output = $this->apply_filters_to_attribute_value($output, $productObj, $attribute, $merchant_attribute);
1301
  } else {
1302
  $output = $this->getAttributeValueByType($productObj, $attribute, $merchant_attribute);
@@ -1313,13 +1295,11 @@ class Woo_Feed_Products_v3
1313
  * Get Query Type Settings
1314
  * @return string
1315
  */
1316
- public function get_query_type()
1317
- {
1318
  return $this->queryType;
1319
  }
1320
 
1321
- public function get_product_types()
1322
- {
1323
  return $this->product_types;
1324
  }
1325
 
@@ -1330,21 +1310,20 @@ class Woo_Feed_Products_v3
1330
  * @since 3.2.0
1331
  *
1332
  */
1333
- protected function process_txt_feed_header()
1334
- {
1335
  // Set Delimiter
1336
- if ('tab' == $this->config['delimiter']) {
1337
  $this->delimiter = "\t";
1338
  } else {
1339
  $this->delimiter = $this->config['delimiter'];
1340
  }
1341
 
1342
  // Set Enclosure
1343
- if (!empty($this->config['enclosure'])) {
1344
  $this->enclosure = $this->config['enclosure'];
1345
- if ('double' == $this->enclosure) {
1346
  $this->enclosure = '"';
1347
- } elseif ('single' == $this->enclosure) {
1348
  $this->enclosure = "'";
1349
  } else {
1350
  $this->enclosure = '';
@@ -1354,17 +1333,17 @@ class Woo_Feed_Products_v3
1354
  }
1355
 
1356
  $eol = PHP_EOL;
1357
- if ('trovaprezzi' === $this->config['provider']) {
1358
  $eol = '<endrecord>' . PHP_EOL;
1359
  }
1360
 
1361
- $product = $this->products[$this->pi];
1362
 
1363
  $headers = array_keys($product);
1364
 
1365
  $this->feedHeader .= $this->enclosure . implode("$this->enclosure$this->delimiter$this->enclosure", $headers) . $this->enclosure . $eol;
1366
 
1367
- if ('google' === $this->config['provider']) {
1368
  $this->feedHeader = str_replace($this->google_product_highlights, 'product highlight', $this->feedHeader);
1369
  $this->feedHeader = str_replace($this->google_additional_image, 'additional image link', $this->feedHeader);
1370
  }
@@ -1379,11 +1358,10 @@ class Woo_Feed_Products_v3
1379
  * @since 3.2.0
1380
  *
1381
  */
1382
- protected function process_txt_feed_body()
1383
- {
1384
- $productInfo = array_values($this->products[$this->pi]);
1385
  $eol = PHP_EOL;
1386
- if ('trovaprezzi' === $this->config['provider']) {
1387
  $eol = '<endrecord>' . PHP_EOL;
1388
  }
1389
  $this->feedBody .= $this->enclosure . implode("$this->enclosure$this->delimiter$this->enclosure", $productInfo) . $this->enclosure . $eol;
@@ -1398,21 +1376,20 @@ class Woo_Feed_Products_v3
1398
  * @since 3.2.0
1399
  *
1400
  */
1401
- protected function process_csv_feed_header()
1402
- {
1403
  // Set Delimiter
1404
- if ('tab' == $this->config['delimiter']) {
1405
  $this->delimiter = "\t";
1406
  } else {
1407
  $this->delimiter = $this->config['delimiter'];
1408
  }
1409
 
1410
  // Set Enclosure
1411
- if (!empty($this->config['enclosure'])) {
1412
  $this->enclosure = $this->config['enclosure'];
1413
- if ('double' == $this->enclosure) {
1414
  $this->enclosure = '"';
1415
- } elseif ('single' == $this->enclosure) {
1416
  $this->enclosure = "'";
1417
  } else {
1418
  $this->enclosure = '';
@@ -1421,11 +1398,11 @@ class Woo_Feed_Products_v3
1421
  $this->enclosure = '';
1422
  }
1423
 
1424
- $product = $this->products[$this->pi];
1425
 
1426
  $this->feedHeader = array_keys($product);
1427
 
1428
- if ('google' === $this->config['provider']) {
1429
  $this->feedHeader = str_replace($this->google_product_highlights, 'product highlight', $this->feedHeader);
1430
  $this->feedHeader = str_replace($this->google_additional_image, 'additional image link', $this->feedHeader);
1431
  }
@@ -1438,23 +1415,21 @@ class Woo_Feed_Products_v3
1438
  * @return array
1439
  * @since 3.2.0
1440
  */
1441
- protected function process_csv_feed_body()
1442
- {
1443
- $product = $this->products[$this->pi];
1444
  $this->feedBody[] = array_values($product);
1445
 
1446
  return $this->feedBody;
1447
  }
1448
 
1449
  protected function process_json_feed_body(){
1450
- $product = $this->products[$this->pi];
1451
  $this->feedBody[] = $product;
1452
 
1453
  return $this->feedBody;
1454
  }
1455
 
1456
- protected function process_xml_wrapper()
1457
- {
1458
  $itemsWrapperClose = explode(' ', $this->config['itemsWrapper']);
1459
  $itemsWrapperClose = $itemsWrapperClose[0];
1460
  $this->xml_wrapper = [
@@ -1464,23 +1439,23 @@ class Woo_Feed_Products_v3
1464
  $this->config['itemWrapper'] = str_replace(' ', '_', $this->config['itemWrapper']);
1465
  $this->config['itemsWrapper'] = str_replace(' ', '_', $this->config['itemsWrapper']);
1466
 
1467
- if (file_exists(WOO_FEED_FREE_ADMIN_PATH . 'partials/templates/' . $this->config['provider'] . '.txt')) {
1468
  $txt = file_get_contents(WOO_FEED_FREE_ADMIN_PATH . 'partials/templates/' . $this->config['provider'] . '.txt');
1469
  $txt = trim($txt);
1470
  $txt = explode('{separator}', $txt);
1471
- if (2 === count($txt)) {
1472
  $this->xml_wrapper['header'] = trim($txt[0]);
1473
  $this->xml_wrapper['footer'] = "\n".trim($txt[1]);
1474
  }
1475
  }
1476
 
1477
- if (!empty($this->config['extraHeader'])) {
1478
  $this->xml_wrapper['header'] .= PHP_EOL . $this->config['extraHeader'];
1479
  }
1480
 
1481
  // replace template variables.
1482
  $datetime_now = date('Y-m-d H:i:s', strtotime(current_time('mysql'))); // {DateTimeNow}
1483
- if('pinterest_rss'===$this->config['provider']){ // DATE_RFC822 date format for pinterest rss feed
1484
  $datetime_now = date('r', strtotime(current_time('mysql'))); // {DateTimeNow}
1485
  }
1486
  $blog_name = get_bloginfo('name'); // {BlogName}
@@ -1490,8 +1465,8 @@ class Woo_Feed_Products_v3
1490
  $blog_email = get_bloginfo('admin_email'); // {BlogEmail}
1491
 
1492
  $this->xml_wrapper['header'] = str_replace(
1493
- ['{DateTimeNow}', '{BlogName}', '{BlogURL}', '{BlogDescription}', '{BlogEmail}'],
1494
- [$datetime_now, $blog_name, $blog_url, $blog_desc, $blog_email],
1495
  $this->xml_wrapper['header']
1496
  );
1497
  }
@@ -1501,8 +1476,7 @@ class Woo_Feed_Products_v3
1501
  * @return string
1502
  * @since 3.2.0
1503
  */
1504
- protected function process_xml_feed_header()
1505
- {
1506
  return $this->xml_wrapper['header'];
1507
  }
1508
 
@@ -1511,8 +1485,7 @@ class Woo_Feed_Products_v3
1511
  * @return string
1512
  * @since 3.2.0
1513
  */
1514
- protected function process_xml_feed_footer()
1515
- {
1516
  return $this->xml_wrapper['footer'];
1517
  }
1518
 
@@ -1525,12 +1498,11 @@ class Woo_Feed_Products_v3
1525
  * @since 3.2.0
1526
  *
1527
  */
1528
- protected function processStringForTXT($string)
1529
- {
1530
- if (!empty($string)) {
1531
  $string = html_entity_decode($string, ENT_HTML401 | ENT_QUOTES); // Convert any HTML entities
1532
 
1533
- if (stristr($string, '"')) {
1534
  $string = str_replace('"', '""', $string);
1535
  }
1536
  $string = str_replace("\n", ' ', $string);
@@ -1540,7 +1512,7 @@ class Woo_Feed_Products_v3
1540
  $string = stripslashes($string);
1541
 
1542
  return $string;
1543
- } elseif ('0' == $string) {
1544
  return '0';
1545
  } else {
1546
  return '';
@@ -1556,16 +1528,15 @@ class Woo_Feed_Products_v3
1556
  * @since 3.2.0
1557
  *
1558
  */
1559
- protected function processStringForCSV($string)
1560
- {
1561
- if (!empty($string)) {
1562
  $string = str_replace("\n", ' ', $string);
1563
  $string = str_replace("\r", ' ', $string);
1564
  $string = trim($string);
1565
  $string = stripslashes($string);
1566
 
1567
  return $string;
1568
- } elseif ('0' == $string) {
1569
  return '0';
1570
  } else {
1571
  return '';
@@ -1582,42 +1553,41 @@ class Woo_Feed_Products_v3
1582
  * @since 3.2.0
1583
  *
1584
  */
1585
- public function getAttributeValueByType($product, $attribute, $merchant_attribute = '')
1586
- {
1587
 
1588
- if (method_exists($this, $attribute)) {
1589
  $output = $this->$attribute($product);
1590
- } elseif (false !== strpos($attribute, self::PRODUCT_CUSTOM_IDENTIFIER) || woo_feed_strpos_array(array('_identifier_gtin', '_identifier_ean', '_identifier_mpn'), $attribute)) {
1591
  $output = $this->getCustomField($product, $attribute);
1592
- } elseif (false !== strpos($attribute, self::PRODUCT_ATTRIBUTE_PREFIX)) {
1593
  $attribute = str_replace(self::PRODUCT_ATTRIBUTE_PREFIX, '', $attribute);
1594
  $output = $this->getProductAttribute($product, $attribute);
1595
- } elseif (false !== strpos($attribute, self::POST_META_PREFIX)) {
1596
  $attribute = str_replace(self::POST_META_PREFIX, '', $attribute);
1597
  $output = $this->getProductMeta($product, $attribute);
1598
- } elseif (false !== strpos($attribute, self::PRODUCT_TAXONOMY_PREFIX)) {
1599
  $attribute = str_replace(self::PRODUCT_TAXONOMY_PREFIX, '', $attribute);
1600
  $output = $this->getProductTaxonomy($product, $attribute);
1601
- } elseif (false !== strpos($attribute, self::PRODUCT_CATEGORY_MAPPING_PREFIX)) {
1602
  $id = $product->is_type('variation') ? $product->get_parent_id() : $product->get_id();
1603
  $output = woo_feed_get_category_mapping_value($attribute, $id);
1604
- } elseif (false !== strpos($attribute, self::WP_OPTION_PREFIX)) {
1605
  $optionName = str_replace(self::WP_OPTION_PREFIX, '', $attribute);
1606
  $output = get_option($optionName);
1607
- } elseif ('image_' == substr($attribute, 0, 6)) {
1608
  // For additional image method images() will be used with extra parameter - image number
1609
  $imageKey = explode('_', $attribute);
1610
- if (!isset($imageKey[1]) || (isset($imageKey[1]) && (empty($imageKey[1]) || !is_numeric($imageKey[1])))) {
1611
  $imageKey[1] = '';
1612
  }
1613
- $output = call_user_func_array(array($this, 'images'), array($product, $imageKey[1]));
1614
  } else {
1615
  // return the attribute so multiple attribute can be join with separator to make custom attribute.
1616
  $output = $attribute;
1617
  }
1618
 
1619
  // Json encode if value is an array
1620
- if (is_array($output)) {
1621
  $output = wp_json_encode($output);
1622
  }
1623
 
@@ -1636,8 +1606,7 @@ class Woo_Feed_Products_v3
1636
  *
1637
  * @return mixed|void
1638
  */
1639
- protected function apply_filters_to_attribute_value($output, $product, $attribute, $merchant_attribute)
1640
- {
1641
  /**
1642
  * Filter attribute value
1643
  *
@@ -1686,8 +1655,7 @@ class Woo_Feed_Products_v3
1686
  * @return mixed
1687
  * @since 3.2.0
1688
  */
1689
- protected function id($product)
1690
- {
1691
  $id = $product->get_id();
1692
 
1693
  return apply_filters('woo_feed_filter_product_id', $id, $product, $this->config);
@@ -1702,24 +1670,23 @@ class Woo_Feed_Products_v3
1702
  * @since 3.2.0
1703
  *
1704
  */
1705
- protected function title($product)
1706
- {
1707
  $title = woo_feed_strip_all_tags($this->remove_short_codes($product->get_name()));
1708
 
1709
  // Add all available variation attributes to variation title.
1710
- if ($product->is_type('variation') && !empty($product->get_attributes())) {
1711
  $title = $this->parent_title($product);
1712
  $attributes = [];
1713
- foreach ($product->get_attributes() as $slug => $value) {
1714
  $attribute = $product->get_attribute($slug);
1715
- if (empty($attribute)) {
1716
  continue;
1717
  }
1718
- $attributes[$slug] = $attribute;
1719
  }
1720
 
1721
  // set variation attributes with separator
1722
- if( isset($this->config['provider']) && 'google' === $this->config['provider'] ) {
1723
  $variation_attributes = implode(' - ', $attributes);
1724
  } else {
1725
  $variation_attributes = implode(', ', $attributes);
@@ -1728,7 +1695,7 @@ class Woo_Feed_Products_v3
1728
  //get product title with variation attribute
1729
  $get_with_var_attributes = apply_filters("woo_feed_get_product_title_with_variation_attribute", true, $product, $this->config);
1730
 
1731
- if( $get_with_var_attributes ) {
1732
  $title .= " - " . $variation_attributes;
1733
  }
1734
  }
@@ -1745,9 +1712,8 @@ class Woo_Feed_Products_v3
1745
  * @author Nazrul Islam Nayan
1746
  * @since 5.1.8
1747
  */
1748
- protected function parent_title($product)
1749
- {
1750
- if ($product->is_type('variation')) {
1751
  $product = wc_get_product($product->get_parent_id());
1752
  $title = woo_feed_strip_all_tags($this->remove_short_codes($product->get_name()));
1753
  } else {
@@ -1765,10 +1731,9 @@ class Woo_Feed_Products_v3
1765
  * @return mixed
1766
  * @since 4.4.12
1767
  */
1768
- protected function _aioseop_canonical_url($product)
1769
- {
1770
  $aioseop_canonical_url = '';
1771
- if (is_plugin_active('all-in-one-seo-pack/all_in_one_seo_pack.php') && class_exists('AIOSEO\Plugin\Common\Models\Post')) {
1772
  $post = AIOSEO\Plugin\Common\Models\Post::getPost($product->get_id());
1773
  $aioseop_canonical_url = $post->canonical_url;
1774
  }
@@ -1785,20 +1750,19 @@ class Woo_Feed_Products_v3
1785
  * @since 3.2.0
1786
  *
1787
  */
1788
- protected function yoast_wpseo_title($product)
1789
- {
1790
  $product_id = woo_feed_parent_product_id($product);
1791
  $yoast_title = get_post_meta($product_id, '_yoast_wpseo_title', true);
1792
- if (strpos($yoast_title, '%%') !== false) {
1793
  $title = strstr($yoast_title, '%%', true);
1794
- if (empty($title)) {
1795
  $title = get_the_title($product_id);
1796
  }
1797
  $wpseo_titles = get_option('wpseo_titles');
1798
 
1799
  $sep_options = WPSEO_Option_Titles::get_instance()->get_separator_options();
1800
- if (isset($wpseo_titles['separator']) && isset($sep_options[$wpseo_titles['separator']])) {
1801
- $sep = $sep_options[$wpseo_titles['separator']];
1802
  } else {
1803
  $sep = '-'; //setting default separator if Admin didn't set it from backed
1804
  }
@@ -1807,10 +1771,10 @@ class Woo_Feed_Products_v3
1807
 
1808
  $meta_title = $title . ' ' . $sep . ' ' . $site_title;
1809
 
1810
- if (!empty($meta_title)) {
1811
  $title = $meta_title;
1812
  }
1813
- } elseif (!empty($yoast_title)) {
1814
  $title = $yoast_title;
1815
  } else {
1816
  $title = $this->title($product);
@@ -1827,8 +1791,7 @@ class Woo_Feed_Products_v3
1827
  * @return mixed
1828
  * @since 4.3.77
1829
  */
1830
- protected function yoast_canonical_url($product)
1831
- {
1832
  $product_id = woo_feed_parent_product_id($product);
1833
  $yoast_canonical_url = get_post_meta($product_id, '_yoast_wpseo_canonical', true);
1834
 
@@ -1843,16 +1806,15 @@ class Woo_Feed_Products_v3
1843
  * @return mixed
1844
  * @since 5.1.3
1845
  */
1846
- protected function rank_math_title($product)
1847
- {
1848
  $rank_title = '';
1849
  $post_title = '';
1850
  $page = '';
1851
  $sep = '';
1852
  $sitemap = '';
1853
- if (class_exists('RankMath')) {
1854
  $title = get_post_meta($product->get_id(), 'rank_math_title', true);
1855
- if (empty($title)) {
1856
  $title_format = Helper::get_settings("titles.pt_product_title");
1857
  $title_format = $title_format ? $title_format : '%title%';
1858
  $sep = Helper::get_settings('titles.title_separator');
@@ -1877,26 +1839,25 @@ class Woo_Feed_Products_v3
1877
  * @return mixed
1878
  * @since 5.1.3
1879
  */
1880
- protected function rank_math_description($product)
1881
- {
1882
  $description = '';
1883
- if (class_exists('RankMath')) {
1884
  $description = get_post_meta($product->get_id(), 'rank_math_description');
1885
  $desc_format = Helper::get_settings("titles.pt_post_description");
1886
 
1887
- if (empty($description)) {
1888
- if (!empty($desc_format) && strpos((string)$desc_format, 'excerpt') !== false) {
1889
  $description = str_replace('%excerpt%', get_the_excerpt($product->get_id()), $desc_format);
1890
  }
1891
 
1892
  // Get Variation Description
1893
- if ($product->is_type('variation') && empty($description)) {
1894
  $parent = wc_get_product($product->get_parent_id());
1895
  $description = $parent->get_description();
1896
  }
1897
  }
1898
 
1899
- if (is_array($description)) {
1900
  $description = reset($description);
1901
  }
1902
 
@@ -1905,7 +1866,7 @@ class Woo_Feed_Products_v3
1905
  //strip tags and spacial characters
1906
  $strip_description = woo_feed_strip_all_tags(wp_specialchars_decode($description));
1907
 
1908
- $description = !empty(strlen($strip_description)) && 0 < strlen($strip_description) ? $strip_description : $description;
1909
  }
1910
 
1911
  return apply_filters('woo_feed_filter_product_rank_math_description', $description, $product, $this->config);
@@ -1919,20 +1880,19 @@ class Woo_Feed_Products_v3
1919
  * @return mixed
1920
  * @since 5.1.6
1921
  */
1922
- protected function rank_math_canonical_url($product)
1923
- {
1924
  $canonical_url = '';
1925
 
1926
- if (class_exists('RankMath')) {
1927
  $post_canonical_url = get_post_meta($product->get_id(), 'rank_math_canonical_url');
1928
 
1929
- if (empty($post_canonical_url)) {
1930
  $canonical_url = get_the_permalink($product->get_id());
1931
  } else {
1932
  $canonical_url = $post_canonical_url;
1933
  }
1934
 
1935
- if (is_array($canonical_url)) {
1936
  $canonical_url = reset($canonical_url);
1937
  }
1938
  }
@@ -1950,16 +1910,15 @@ class Woo_Feed_Products_v3
1950
  * @since 3.2.0
1951
  *
1952
  */
1953
- protected function _aioseop_title($product)
1954
- {
1955
  $title = '';
1956
- if (is_plugin_active('all-in-one-seo-pack/all_in_one_seo_pack.php') && class_exists('AIOSEO\Plugin\Common\Models\Post')) {
1957
 
1958
  $post = AIOSEO\Plugin\Common\Models\Post::getPost($product->get_id());
1959
- $title = !empty($post->title) ? $post->title : aioseo()->meta->title->getPostTypeTitle('product');
1960
  }
1961
 
1962
- $title = !empty($title) ? $title : $this->title($product);
1963
 
1964
  return apply_filters('woo_feed_filter_product_aioseop_title', $title, $product, $this->config);
1965
  }
@@ -1973,15 +1932,14 @@ class Woo_Feed_Products_v3
1973
  * @since 3.2.0
1974
  *
1975
  */
1976
- protected function description($product)
1977
- {
1978
  $description = $product->get_description();
1979
 
1980
  // Get Variation Description
1981
- if ($product->is_type('variation') && empty($description)) {
1982
  $parent = wc_get_product($product->get_parent_id());
1983
 
1984
- if( is_object($parent) ) {
1985
  $description = $parent->get_description();
1986
  } else {
1987
  $description = '';
@@ -1990,9 +1948,9 @@ class Woo_Feed_Products_v3
1990
  $description = $this->remove_short_codes($description);
1991
 
1992
  // Add variations attributes after description to prevent Facebook error
1993
- if ('facebook' == $this->config['provider'] && $product->is_type('variation')) {
1994
  $variationInfo = explode('-', $product->get_name());
1995
- if (isset($variationInfo[1])) {
1996
  $extension = $variationInfo[1];
1997
  } else {
1998
  $extension = $product->get_id();
@@ -2003,7 +1961,7 @@ class Woo_Feed_Products_v3
2003
  //strip tags and spacial characters
2004
  $strip_description = woo_feed_strip_all_tags(wp_specialchars_decode($description));
2005
 
2006
- $description = !empty(strlen($strip_description)) && 0 < strlen($strip_description) ? $strip_description : $description;
2007
 
2008
  return apply_filters('woo_feed_filter_product_description', $description, $product, $this->config);
2009
  }
@@ -2016,21 +1974,20 @@ class Woo_Feed_Products_v3
2016
  * @return mixed|string
2017
  * @since 5.2.41
2018
  */
2019
- protected function description_with_html($product)
2020
- {
2021
  $description = $product->get_description();
2022
 
2023
  // Get Variation Description
2024
- if ($product->is_type('variation') && empty($description)) {
2025
  $parent = wc_get_product($product->get_parent_id());
2026
  $description = $parent->get_description();
2027
  }
2028
  $description = $this->remove_short_codes($description);
2029
 
2030
  // Add variations attributes after description to prevent Facebook error
2031
- if ('facebook' === $this->config['provider'] && $product->is_type('variation')) {
2032
  $variationInfo = explode('-', $product->get_name());
2033
- if (isset($variationInfo[1])) {
2034
  $extension = $variationInfo[1];
2035
  } else {
2036
  $extension = $product->get_id();
@@ -2053,18 +2010,17 @@ class Woo_Feed_Products_v3
2053
  * @since 3.2.0
2054
  *
2055
  */
2056
- protected function yoast_wpseo_metadesc($product)
2057
- {
2058
  $product_id = woo_feed_parent_product_id($product);
2059
  $description = '';
2060
- if (class_exists('WPSEO_Frontend')) {
2061
  $description = wpseo_replace_vars(WPSEO_Meta::get_value('metadesc', $product_id),
2062
  get_post($product->get_id()));
2063
  } else {
2064
  $description = YoastSEO()->meta->for_post($product_id)->description;
2065
  }
2066
 
2067
- if (empty($description)) {
2068
  $description = $this->description($product);
2069
  }
2070
 
@@ -2080,17 +2036,16 @@ class Woo_Feed_Products_v3
2080
  * @since 3.2.0
2081
  *
2082
  */
2083
- protected function _aioseop_description($product)
2084
- {
2085
  $description = '';
2086
 
2087
- if (is_plugin_active('all-in-one-seo-pack/all_in_one_seo_pack.php') && class_exists('AIOSEO\Plugin\Common\Models\Post')) {
2088
 
2089
  $post = AIOSEO\Plugin\Common\Models\Post::getPost($product->get_id());
2090
- $description = !empty($post->description) ? $post->description : aioseo()->meta->description->getPostTypeDescription('product');
2091
  }
2092
 
2093
- if (empty($description)) {
2094
  $description = $this->description($product);
2095
  }
2096
 
@@ -2106,12 +2061,11 @@ class Woo_Feed_Products_v3
2106
  * @since 3.2.0
2107
  *
2108
  */
2109
- protected function short_description($product)
2110
- {
2111
  $short_description = $product->get_short_description();
2112
 
2113
  // Get Variation Short Description
2114
- if ($product->is_type('variation') && empty($short_description)) {
2115
  $parent = wc_get_product($product->get_parent_id());
2116
  $short_description = $parent->get_short_description();
2117
  }
@@ -2135,9 +2089,8 @@ class Woo_Feed_Products_v3
2135
  * @since 3.2.0
2136
  *
2137
  */
2138
- protected function remove_short_codes( $content )
2139
- {
2140
- if ($content == '') {
2141
  return '';
2142
  }
2143
 
@@ -2161,15 +2114,14 @@ class Woo_Feed_Products_v3
2161
  * @return WP_Term
2162
  * @since 4.4.19
2163
  * */
2164
- protected function product_parent_category_object( $product )
2165
- {
2166
  global $parent_category_memo;
2167
- if( empty( $parent_category_memo ) ){
2168
  $parent_category_memo = [];
2169
  }
2170
 
2171
  $id = $product->get_id();
2172
- if ($product->is_type('variation')) {
2173
  $id = $product->get_parent_id();
2174
  }
2175
 
@@ -2180,10 +2132,10 @@ class Woo_Feed_Products_v3
2180
  $parent_category = '';
2181
 
2182
  // Memoization for faster parent retrieval
2183
- if(
2184
  isset( $parent_category_memo[ $child_category->term_id ] )
2185
- && !empty( $parent_category_memo[ $child_category->term_id ] )
2186
- ){
2187
  $parent_category = get_term_by( 'term_id', $parent_category_memo[ $child_category->term_id ], $taxonomy );
2188
  } else {
2189
  $parent_category = woo_feed_parent_category( $child_category, $taxonomy );
@@ -2191,10 +2143,10 @@ class Woo_Feed_Products_v3
2191
  }
2192
 
2193
  // Yoast SEO primary term fetching
2194
- if( class_exists( 'WPSEO_Primary_Term' ) ){
2195
  $wpseo_primary_term = new WPSEO_Primary_Term( $taxonomy, $id );
2196
  $parent_category_id = $wpseo_primary_term->get_primary_term();
2197
- if( ! empty( $parent_category_id ) ){
2198
  $parent_category = get_term_by( 'term_id', $parent_category_id, $taxonomy );
2199
  }
2200
  }
@@ -2210,12 +2162,11 @@ class Woo_Feed_Products_v3
2210
  * @return string
2211
  *
2212
  */
2213
- protected function primary_category( $product )
2214
- {
2215
- $parent_category="";
2216
  $separator = apply_filters('woo_feed_product_type_separator', ' > ', $this->config, $product);
2217
  $full_category = $this->product_type( $product );
2218
- if(!empty($full_category)){
2219
  $full_category_array = explode($separator,$full_category);
2220
  $parent_category = $full_category_array[0];
2221
  }
@@ -2231,15 +2182,14 @@ class Woo_Feed_Products_v3
2231
  * @return string
2232
  *
2233
  */
2234
- protected function primary_category_id( $product )
2235
- {
2236
- $parent_category_id="";
2237
  $separator = apply_filters('woo_feed_product_type_separator', ' > ', $this->config, $product);
2238
  $full_category = $this->product_type( $product );
2239
- if(!empty($full_category)){
2240
  $full_category_array = explode($separator,$full_category);
2241
- $parent_category_obj = get_term_by( 'name', $full_category_array[0], 'product_cat' );
2242
- $parent_category_id = isset($parent_category_obj->term_id)?$parent_category_obj->term_id:"";
2243
  }
2244
 
2245
  return apply_filters('woo_feed_filter_product_primary_category_id', $parent_category_id, $product, $this->config);
@@ -2252,12 +2202,11 @@ class Woo_Feed_Products_v3
2252
  *
2253
  * @return string
2254
  */
2255
- protected function child_category( $product )
2256
- {
2257
- $child_category="";
2258
  $separator = apply_filters('woo_feed_product_type_separator', ' > ', $this->config, $product);
2259
  $full_category = $this->product_type( $product );
2260
- if(!empty($full_category)){
2261
  $full_category_array = explode($separator,$full_category);
2262
  $child_category = end($full_category_array);
2263
  }
@@ -2272,15 +2221,14 @@ class Woo_Feed_Products_v3
2272
  *
2273
  * @return string
2274
  */
2275
- protected function child_category_id( $product )
2276
- {
2277
- $child_category_id="";
2278
  $separator = apply_filters('woo_feed_product_type_separator', ' > ', $this->config, $product);
2279
  $full_category = $this->product_type( $product );
2280
- if(!empty($full_category)){
2281
  $full_category_array = explode($separator,$full_category);
2282
- $child_category_obj = get_term_by( 'name', end($full_category_array), 'product_cat' );
2283
- $child_category_id = isset($child_category_obj->term_id)?$child_category_obj->term_id:"";
2284
  }
2285
 
2286
  return apply_filters('woo_feed_filter_product_child_category_id', $child_category_id, $product, $this->config);
@@ -2295,10 +2243,9 @@ class Woo_Feed_Products_v3
2295
  * @since 3.2.0
2296
  *
2297
  */
2298
- protected function product_type($product)
2299
- {
2300
  $id = $product->get_id();
2301
- if ($product->is_type('variation')) {
2302
  $id = $product->get_parent_id();
2303
  }
2304
 
@@ -2309,7 +2256,7 @@ class Woo_Feed_Products_v3
2309
  $product_categories = '';
2310
  $term_list = get_the_terms( $id, 'product_cat' );
2311
 
2312
- if( is_array($term_list) ) {
2313
  $col = array_column( $term_list, "term_id" );
2314
  array_multisort( $col, SORT_ASC, $term_list );
2315
  $term_list = array_column( $term_list, "name" );
@@ -2328,8 +2275,7 @@ class Woo_Feed_Products_v3
2328
  * @return string
2329
  * @since 4.3.47
2330
  */
2331
- protected function product_full_cat($product)
2332
- {
2333
  // $id = $product->get_id();
2334
  // if ($product->is_type('variation')) {
2335
  // $id = $product->get_parent_id();
@@ -2353,8 +2299,7 @@ class Woo_Feed_Products_v3
2353
  * @since 3.2.0
2354
  *
2355
  */
2356
- protected function link($product)
2357
- {
2358
 
2359
  $link = $product->get_permalink();
2360
 
@@ -2370,18 +2315,18 @@ class Woo_Feed_Products_v3
2370
  * @return string $url
2371
  * @since 4.4.26
2372
  */
2373
- protected function add_utm_tracker( $url ){
2374
 
2375
- $utm = $this->config[ 'campaign_parameters' ];
2376
 
2377
- if( !empty( $utm['utm_source'] ) && !empty( $utm['utm_medium'] ) && !empty( $utm['utm_campaign'] ) ){
2378
 
2379
  $utm = [
2380
- 'utm_source' => str_replace(' ', '+', $utm['utm_source'] ),
2381
- 'utm_medium' => str_replace(' ', '+', $utm['utm_medium'] ),
2382
  'utm_campaign' => str_replace(' ', '+', $utm['utm_campaign'] ),
2383
- 'utm_term' => str_replace(' ', '+', $utm['utm_term'] ),
2384
- 'utm_content' => str_replace(' ', '+', $utm['utm_content'] ),
2385
  ];
2386
 
2387
  $url = add_query_arg( array_filter( $utm ), $url );
@@ -2400,9 +2345,8 @@ class Woo_Feed_Products_v3
2400
  * @author Nazrul Islam Nayan
2401
  * @since 5.1.8
2402
  */
2403
- protected function parent_link($product)
2404
- {
2405
- if ($product->is_type('variation')) {
2406
  $product = wc_get_product($product->get_parent_id());
2407
  $link = $this->link($product);
2408
  } else {
@@ -2417,9 +2361,8 @@ class Woo_Feed_Products_v3
2417
  * @param WC_Product $product
2418
  * @return mixed
2419
  */
2420
- protected function canonical_link($product)
2421
- {
2422
- if ($product->is_type('variation')) {
2423
  $product = wc_get_product($product->get_parent_id());
2424
  $canonical_link = $product->get_permalink();
2425
  } else {
@@ -2438,16 +2381,16 @@ class Woo_Feed_Products_v3
2438
  * @since 3.2.0
2439
  *
2440
  */
2441
- protected function ex_link($product) {
2442
- if ($product->is_type('external')) {
2443
  $utm = $this->config['campaign_parameters'];
2444
- if (!empty($utm['utm_source']) && !empty($utm['utm_medium']) && !empty($utm['utm_campaign'])) {
2445
  $utm = [
2446
- 'utm_source' => str_replace(' ', '+', $utm['utm_source'] ),
2447
- 'utm_medium' => str_replace(' ', '+', $utm['utm_medium'] ),
2448
  'utm_campaign' => str_replace(' ', '+', $utm['utm_campaign'] ),
2449
- 'utm_term' => str_replace(' ', '+', $utm['utm_term'] ),
2450
- 'utm_content' => str_replace(' ', '+', $utm['utm_content'] ),
2451
  ];
2452
 
2453
  return add_query_arg(array_filter($utm), $product->get_product_url());
@@ -2470,19 +2413,18 @@ class Woo_Feed_Products_v3
2470
  * @since 3.2.0
2471
  *
2472
  */
2473
- protected function image($product)
2474
- {
2475
  $image = '';
2476
- if ($product->is_type('variation')) {
2477
  // Variation product type
2478
- if (has_post_thumbnail( $product->get_id() ) ) {
2479
  $getImage = wp_get_attachment_image_src( get_post_thumbnail_id( $product->get_id() ), 'single-post-thumbnail' );
2480
  $image = woo_feed_get_formatted_url($getImage[0]);
2481
  } elseif ( has_post_thumbnail( $product->get_parent_id() ) ) {
2482
  $getImage = wp_get_attachment_image_src(get_post_thumbnail_id($product->get_parent_id()), 'single-post-thumbnail');
2483
  $image = woo_feed_get_formatted_url($getImage[0]);
2484
  }
2485
- } else if ( has_post_thumbnail( $product->get_id() ) ) { // All product type except variation
2486
  $getImage = wp_get_attachment_image_src( get_post_thumbnail_id( $product->get_id() ), 'single-post-thumbnail' );
2487
  $image = isset( $getImage[0] ) ? woo_feed_get_formatted_url( $getImage[0] ) : '';
2488
  }
@@ -2499,12 +2441,11 @@ class Woo_Feed_Products_v3
2499
  * @since 3.2.0
2500
  *
2501
  */
2502
- protected function feature_image($product)
2503
- {
2504
- if($product->is_type('variation')){
2505
- $id=$product->get_parent_id();
2506
- }else{
2507
- $id=$product->get_id();
2508
  }
2509
 
2510
  $getImage = wp_get_attachment_image_src( get_post_thumbnail_id( $id ), 'single-post-thumbnail' );
@@ -2523,14 +2464,13 @@ class Woo_Feed_Products_v3
2523
  * @since 3.2.0
2524
  *
2525
  */
2526
- protected function images($product, $additionalImg = '')
2527
- {
2528
  $imgUrls = $this->get_product_gallery($product);
2529
 
2530
  // Return Specific Additional Image URL
2531
- if ('' !== $additionalImg) {
2532
- if (array_key_exists($additionalImg, $imgUrls)) {
2533
- $images = $imgUrls[$additionalImg];
2534
  } else {
2535
  $images = '';
2536
  }
@@ -2550,20 +2490,19 @@ class Woo_Feed_Products_v3
2550
  * @return string[]
2551
  * @since 3.2.6
2552
  */
2553
- protected function get_product_gallery($product)
2554
- {
2555
  $imgUrls = [];
2556
  $attachmentIds = [];
2557
 
2558
- if($product->is_type('variation')){
2559
- if(class_exists('Woo_Variation_Gallery')){
2560
  /**
2561
  * Get Variation Additional Images for "Additional Variation Images Gallery for WooCommerce"
2562
  * @plugin Additional Variation Images Gallery for WooCommerce
2563
  * @link https://wordpress.org/plugins/woo-variation-gallery/
2564
  */
2565
  $attachmentIds = get_post_meta($product->get_id(), 'woo_variation_gallery_images', true);
2566
- } elseif(class_exists('WooProductVariationGallery')){
2567
  /**
2568
  * Get Variation Additional Images for "Variation Images Gallery for WooCommerce"
2569
  * @plugin Variation Images Gallery for WooCommerce
@@ -2571,14 +2510,14 @@ class Woo_Feed_Products_v3
2571
  */
2572
  $attachmentIds = get_post_meta($product->get_id(), 'rtwpvg_images', true);
2573
  }
2574
- elseif(class_exists('WC_Additional_Variation_Images')){
2575
  /**
2576
  * Get Variation Additional Images for "WooCommerce Additional Variation Images"
2577
  * @plugin WooCommerce Additional Variation Images
2578
  * @link https://woocommerce.com/products/woocommerce-additional-variation-images/
2579
  */
2580
  $attachmentIds = explode(',',get_post_meta($product->get_id(), '_wc_additional_variation_images', true));
2581
- }elseif( class_exists('WOODMART_Theme') ) {
2582
  /**
2583
  * Get Variation Additional Images for "WOODMART Theme -> Variation Gallery Images Feature"
2584
  * @theme WOODMART
@@ -2588,13 +2527,12 @@ class Woo_Feed_Products_v3
2588
  $parent_id = $product->get_parent_id();
2589
 
2590
  $variation_obj = get_post_meta($parent_id, 'woodmart_variation_gallery_data', true);
2591
- if( isset($variation_obj) && isset($variation_obj[$var_id]) ) {
2592
- $attachmentIds = explode(',', $variation_obj[$var_id]);
2593
  }else {
2594
  $attachmentIds = explode(',',get_post_meta($var_id, 'wd_additional_variation_images_data', true));
2595
- }
2596
-
2597
- }else{
2598
  /**
2599
  * If any Variation Gallery Image plugin not installed then get Variable Product Additional Image Ids .
2600
  */
@@ -2606,14 +2544,14 @@ class Woo_Feed_Products_v3
2606
  * Get Variable Product Gallery Image ids if Product is not a variation
2607
  * or variation does not have any gallery images
2608
  */
2609
- if(empty($attachmentIds)){
2610
  $attachmentIds = $product->get_gallery_image_ids();
2611
  }
2612
 
2613
- if ($attachmentIds && is_array($attachmentIds)) {
2614
  $mKey = 1;
2615
- foreach ($attachmentIds as $attachmentId) {
2616
- $imgUrls[$mKey] = woo_feed_get_formatted_url(wp_get_attachment_url($attachmentId));
2617
  $mKey++;
2618
  }
2619
  }
@@ -2630,8 +2568,7 @@ class Woo_Feed_Products_v3
2630
  * @since 3.2.0
2631
  *
2632
  */
2633
- protected function condition($product)
2634
- {
2635
  return apply_filters('woo_feed_product_condition', 'new', $product);
2636
  }
2637
 
@@ -2644,8 +2581,7 @@ class Woo_Feed_Products_v3
2644
  * @since 3.2.0
2645
  *
2646
  */
2647
- protected function type($product)
2648
- {
2649
  return apply_filters('woo_feed_filter_product_type', $product->get_type(), $product, $this->config);
2650
  }
2651
 
@@ -2658,9 +2594,8 @@ class Woo_Feed_Products_v3
2658
  * @since 3.2.0
2659
  *
2660
  */
2661
- protected function is_bundle($product)
2662
- {
2663
- if ($product->is_type('bundle') || $product->is_type('yith_bundle')) {
2664
  $is_bundle = 'yes';
2665
  } else {
2666
  $is_bundle = 'no';
@@ -2678,11 +2613,10 @@ class Woo_Feed_Products_v3
2678
  * @since 3.2.0
2679
  *
2680
  */
2681
- protected function multipack($product)
2682
- {
2683
  $multi_pack = '';
2684
- if ($product->is_type('grouped')) {
2685
- $multi_pack = (!empty($product->get_children())) ? count($product->get_children()) : '';
2686
  }
2687
 
2688
  return $multi_pack;
@@ -2697,8 +2631,7 @@ class Woo_Feed_Products_v3
2697
  * @since 3.2.0
2698
  *
2699
  */
2700
- protected function visibility($product)
2701
- {
2702
  return apply_filters('woo_feed_filter_product_visibility', $product->get_catalog_visibility(), $product, $this->config);
2703
  }
2704
 
@@ -2711,8 +2644,7 @@ class Woo_Feed_Products_v3
2711
  * @since 3.2.0
2712
  *
2713
  */
2714
- protected function rating_total($product)
2715
- {
2716
  return apply_filters('woo_feed_filter_product_rating_total', $product->get_rating_count(), $product, $this->config);
2717
  }
2718
 
@@ -2725,8 +2657,7 @@ class Woo_Feed_Products_v3
2725
  * @since 3.2.0
2726
  *
2727
  */
2728
- protected function rating_average($product)
2729
- {
2730
  return apply_filters('woo_feed_filter_product_rating_average', $product->get_average_rating(), $product, $this->config);
2731
  }
2732
 
@@ -2739,10 +2670,9 @@ class Woo_Feed_Products_v3
2739
  * @since 3.2.0
2740
  *
2741
  */
2742
- protected function tags($product)
2743
- {
2744
  $id = $product->get_id();
2745
- if ($product->is_type('variation')) {
2746
  $id = $product->get_parent_id();
2747
  }
2748
 
@@ -2769,10 +2699,9 @@ class Woo_Feed_Products_v3
2769
  * @since 3.2.0
2770
  *
2771
  */
2772
- protected function item_group_id($product)
2773
- {
2774
  $id = $product->get_id();
2775
- if ($product->is_type('variation')) {
2776
  $id = $product->get_parent_id();
2777
  }
2778
 
@@ -2788,8 +2717,7 @@ class Woo_Feed_Products_v3
2788
  * @since 3.2.0
2789
  *
2790
  */
2791
- protected function sku($product)
2792
- {
2793
  return apply_filters('woo_feed_filter_product_sku', $product->get_sku(), $product, $this->config);
2794
  }
2795
 
@@ -2802,9 +2730,8 @@ class Woo_Feed_Products_v3
2802
  * @author Nazrul Islam Nayan
2803
  * @since 4.3.13
2804
  */
2805
- protected function sku_id($product)
2806
- {
2807
- $sku = !empty($product->get_sku()) ? $product->get_sku() . '_' : '';
2808
  $sku_id = $sku . $product->get_id();
2809
 
2810
  return apply_filters('woo_feed_filter_product_sku_id', $sku_id, $product, $this->config);
@@ -2819,9 +2746,8 @@ class Woo_Feed_Products_v3
2819
  * @since 3.2.0
2820
  *
2821
  */
2822
- protected function parent_sku($product)
2823
- {
2824
- if ($product->is_type('variation')) {
2825
  $id = $product->get_parent_id();
2826
  $parent = wc_get_product($id);
2827
 
@@ -2842,19 +2768,18 @@ class Woo_Feed_Products_v3
2842
  * @since 3.2.0
2843
  *
2844
  */
2845
- protected function availability($product)
2846
- {
2847
  $status = $product->get_stock_status();
2848
- if ('instock' == $status) {
2849
  $status = 'in stock';
2850
- } elseif ('outofstock' == $status) {
2851
  $status = 'out of stock';
2852
- } elseif ('onbackorder' == $status) {
2853
  $status = 'on backorder';
2854
  }
2855
 
2856
  // set (_) as separator for google merchant
2857
- if( isset($this->config['provider']) && 'google' === $this->config['provider'] ) {
2858
  $status = explode(' ', $status);
2859
  $status = implode('_', $status);
2860
  }
@@ -2872,8 +2797,7 @@ class Woo_Feed_Products_v3
2872
  * @since 3.2.0
2873
  *
2874
  */
2875
- protected function availability_date($product)
2876
- {
2877
 
2878
  $feed_settings = get_option( 'woo_feed_settings' );
2879
 
@@ -2881,25 +2805,25 @@ class Woo_Feed_Products_v3
2881
  ? $feed_settings['woo_feed_identifier']['availability_date']
2882
  : 'enable' ;
2883
 
2884
- if ($product->get_stock_status() !== 'onbackorder' || $availability_date_settings === 'disable' ) {
2885
  return '';
2886
  }
2887
 
2888
  $meta_field_name = 'woo_feed_availability_date';
2889
 
2890
- if( $product->is_type( 'variation' ) ){
2891
  $meta_field_name .= '_var';
2892
  }
2893
 
2894
  $availability_date = get_post_meta($product->get_id(), $meta_field_name, true);
2895
 
2896
- if ('' !== $availability_date && in_array($this->config['provider'], [
2897
- 'google',
2898
- 'facebook',
2899
- 'pinterest',
2900
- 'bing',
2901
- 'snapchat',
2902
- ], true)) {
2903
  $availability_date = gmdate('c', strtotime($availability_date));
2904
  }
2905
 
@@ -2915,8 +2839,7 @@ class Woo_Feed_Products_v3
2915
  * @author Nazrul Islam Nayan
2916
  * @since 5.1.8
2917
  */
2918
- protected function add_to_cart_link($product)
2919
- {
2920
  $url = $this->link($product);
2921
  $suffix = 'add-to-cart=' . $product->get_id();
2922
 
@@ -2934,34 +2857,33 @@ class Woo_Feed_Products_v3
2934
  * @since 3.2.0
2935
  *
2936
  */
2937
- protected function quantity($product)
2938
- {
2939
  $quantity = $product->get_stock_quantity();
2940
  $status = $product->get_stock_status();
2941
 
2942
  //when product is outofstock and it's quantity is empty, set quantity to 0
2943
- if ('outofstock' == $status && empty($quantity)) {
2944
  $quantity = 0;
2945
  }
2946
 
2947
- if ($product->is_type('variable') && $product->has_child()) {
2948
  $visible_children = $product->get_visible_children();
2949
  $qty = array();
2950
- foreach ($visible_children as $key => $child) {
2951
  $childQty = get_post_meta($child, '_stock', true);
2952
  $qty[] = (int)$childQty + 0;
2953
  }
2954
 
2955
- if (isset($this->config['variable_quantity'])) {
2956
  $vaQty = $this->config['variable_quantity'];
2957
- if ('max' == $vaQty) {
2958
  $quantity = max($qty);
2959
- } elseif ('min' == $vaQty) {
2960
  $quantity = min($qty);
2961
- } elseif ('sum' == $vaQty) {
2962
  $quantity = array_sum($qty);
2963
- } elseif ('first' == $vaQty) {
2964
- $quantity = ((int)$qty[0]);
2965
  }
2966
 
2967
  $quantity = array_sum($qty);
@@ -2980,8 +2902,7 @@ class Woo_Feed_Products_v3
2980
  * @since 4.4.39
2981
  *
2982
  */
2983
- protected function currency($product)
2984
- {
2985
  $quantity = get_option( 'woocommerce_currency' );
2986
 
2987
  return apply_filters('woo_feed_filter_product_currency', $quantity, $product, $this->config);
@@ -2995,8 +2916,7 @@ class Woo_Feed_Products_v3
2995
  * @since 3.2.0
2996
  *
2997
  */
2998
- protected function store_currency($product)
2999
- {
3000
  return get_woocommerce_currency();
3001
  }
3002
 
@@ -3009,10 +2929,9 @@ class Woo_Feed_Products_v3
3009
  * @since 3.2.0
3010
  *
3011
  */
3012
- protected function sale_price_sdate($product)
3013
- {
3014
  $startDate = $product->get_date_on_sale_from();
3015
- if (is_object($startDate)) {
3016
  $sale_price_sdate = $startDate->date_i18n();
3017
  } else {
3018
  $sale_price_sdate = '';
@@ -3030,10 +2949,9 @@ class Woo_Feed_Products_v3
3030
  * @since 3.2.0
3031
  *
3032
  */
3033
- protected function sale_price_edate($product)
3034
- {
3035
  $endDate = $product->get_date_on_sale_to();
3036
- if (is_object($endDate)) {
3037
  $sale_price_edate = $endDate->date_i18n();
3038
  } else {
3039
  $sale_price_edate = "";
@@ -3047,10 +2965,9 @@ class Woo_Feed_Products_v3
3047
  *
3048
  * @return mixed|string
3049
  */
3050
- protected function get_feed_currency()
3051
- {
3052
  $currency = get_woocommerce_currency();
3053
- if (isset($this->config['feedCurrency'])) {
3054
  $currency = $this->config['feedCurrency'];
3055
  }
3056
 
@@ -3069,12 +2986,11 @@ class Woo_Feed_Products_v3
3069
  *
3070
  * @return float|mixed|string|void
3071
  */
3072
- protected function get_price_by_price_type($product, $price_type, $tax)
3073
- {
3074
 
3075
- if ('regular_price' === $price_type) {
3076
  $price = $product->get_regular_price();
3077
- } elseif ('price' === $price_type) {
3078
  $price = $product->get_price();
3079
  } else {
3080
  $price = $product->get_sale_price();
@@ -3086,7 +3002,7 @@ class Woo_Feed_Products_v3
3086
  );
3087
 
3088
  // Get Price with tax
3089
- if (true === $tax) {
3090
  $price = woo_feed_get_price_with_tax($price, $product);
3091
  }
3092
 
@@ -3105,19 +3021,18 @@ class Woo_Feed_Products_v3
3105
  *
3106
  * @return float|int|mixed|string
3107
  */
3108
- protected function get_price_by_product_type($product, $price_type, $tax = false)
3109
- {
3110
- if ($product->is_type('variable')) {
3111
  $price = $this->getVariableProductPrice($product, $price_type, $tax);
3112
- } elseif ($product->is_type('grouped')) {
3113
  $price = $this->getGroupProductPrice($product, $price_type, $tax);
3114
- } elseif ($product->is_type('bundle')) {
3115
  //TODO Diff taxation
3116
  $price = $this->getBundleProductPrice($product, $price_type, $tax);
3117
- } elseif ($product->is_type('composite')) {
3118
  //TODO Diff taxation
3119
  $price = $this->getCompositeProductPrice($product, $price_type, $tax);
3120
- } elseif ($product->is_type('bundled')) {
3121
  // iconic woocommerce product bundled plugin
3122
  $price = $this->iconic_bundle_product_price($product, $price_type, $tax);
3123
  } else {
@@ -3136,8 +3051,7 @@ class Woo_Feed_Products_v3
3136
  * @since 3.2.0
3137
  *
3138
  */
3139
- protected function price($product)
3140
- {
3141
 
3142
  $regular_price = $this->get_price_by_product_type($product, 'regular_price');
3143
 
@@ -3153,8 +3067,7 @@ class Woo_Feed_Products_v3
3153
  * @since 3.2.0
3154
  *
3155
  */
3156
- protected function current_price($product)
3157
- {
3158
 
3159
  $price = $this->get_price_by_product_type($product, 'price');
3160
 
@@ -3170,8 +3083,7 @@ class Woo_Feed_Products_v3
3170
  * @since 3.2.0
3171
  *
3172
  */
3173
- protected function sale_price($product)
3174
- {
3175
 
3176
  $sale_price = $this->get_price_by_product_type($product, 'sale_price');
3177
 
@@ -3187,8 +3099,7 @@ class Woo_Feed_Products_v3
3187
  * @since 3.2.0
3188
  *
3189
  */
3190
- protected function price_with_tax($product)
3191
- {
3192
 
3193
  $regular_price_with_tax = $this->get_price_by_product_type($product, 'regular_price', true);
3194
 
@@ -3204,8 +3115,7 @@ class Woo_Feed_Products_v3
3204
  * @since 3.2.0
3205
  *
3206
  */
3207
- protected function current_price_with_tax($product)
3208
- {
3209
 
3210
  $price_with_tax = $this->get_price_by_product_type($product, 'price', true);
3211
 
@@ -3221,8 +3131,7 @@ class Woo_Feed_Products_v3
3221
  * @since 3.2.0
3222
  *
3223
  */
3224
- protected function sale_price_with_tax($product)
3225
- {
3226
 
3227
  $sale_price_with_tax = $this->get_price_by_product_type($product, 'sale_price', true);
3228
 
@@ -3239,12 +3148,11 @@ class Woo_Feed_Products_v3
3239
  * @return int|float|double
3240
  * @since 3.2.6
3241
  */
3242
- protected function getCompositeProductPrice($product, $type, $tax = false)
3243
- {
3244
- if (class_exists('WC_Product_Composite') && class_exists('WPCleverWooco')) {
3245
  // WPC Composite Product
3246
  return $this->get_wpc_composite_price($product, $type, $tax);
3247
- } else if (class_exists('WC_Composite_Products')) {
3248
  // WooCommerce Composite Product
3249
  return $this->get_wc_composite_product_price($product, $type, $tax);
3250
  } else {
@@ -3264,15 +3172,14 @@ class Woo_Feed_Products_v3
3264
  * @param bool $tax Add tax with price (true|false)
3265
  * @return float|int|mixed|string|void
3266
  */
3267
- protected function get_wc_composite_product_price($product, $type, $tax)
3268
- {
3269
  $price = 0;
3270
  // Parent Component Price
3271
  $base_price = $this->get_price_by_price_type($product, $type, $tax);
3272
- if (isset($this->config['composite_price']) && 'all_product_price' == $this->config['composite_price']) {
3273
  $composite = new WC_Product_Composite($product);
3274
 
3275
- if ('price' === $type || 'sale_price' === $type) {
3276
  $price = $composite->get_composite_price();
3277
  } else {
3278
  $price = $composite->get_composite_regular_price();
@@ -3284,7 +3191,7 @@ class Woo_Feed_Products_v3
3284
  );
3285
 
3286
  // Get Price with tax
3287
- if (true === $tax) {
3288
  $price = woo_feed_get_price_with_tax($price, $composite);
3289
  }
3290
  } else {
@@ -3304,25 +3211,24 @@ class Woo_Feed_Products_v3
3304
  * @param bool $tax Add tax with price (true|false)
3305
  * @return float|int|mixed|string|void
3306
  */
3307
- protected function get_wpc_composite_price($product, $type, $tax)
3308
- {
3309
  $price = 0;
3310
  // Parent Component Price
3311
  $base_price = $this->get_price_by_price_type($product, $type, $tax);
3312
- if (isset($this->config['composite_price']) && 'all_product_price' == $this->config['composite_price']) {
3313
  $components_price = 0;
3314
  $components = $product->get_components();
3315
- if (!empty($components) && is_array($components)) {
3316
- foreach ($components as $component) {
3317
  $products = explode(',', $component['products']);
3318
- foreach ($products as $key => $product_id) {
3319
  $default_product = wc_get_product($product_id);
3320
- if (is_object($default_product) && $default_product->is_in_stock()) {
3321
  $quantity = (isset($component['qty']) && $component['qty'] > 0) ? $component['qty'] : 1;
3322
- if ('products' == $component['type'] && empty($component['price'])) {
3323
  $components_price += $this->get_price_by_price_type($default_product, 'price', $tax);
3324
  $components_price *= $quantity;
3325
- } elseif ('products' == $component['type'] && !empty($component['price'])) {
3326
  $clever = new WPCleverWooco();
3327
  $old_price = $this->get_price_by_price_type($default_product, 'price', $tax);
3328
  $new_price = $component['price'];
@@ -3336,16 +3242,16 @@ class Woo_Feed_Products_v3
3336
 
3337
  // Apply discount to components price.
3338
  $discount = $product->get_discount();
3339
- if ($discount > 0) {
3340
  $components_price -= (($discount / 100) * $components_price);
3341
  }
3342
  }
3343
 
3344
- if ('exclude' === $product->get_pricing()) {
3345
  $price = $components_price;
3346
- } elseif ('include' === $product->get_pricing()) {
3347
  $price = $components_price + $base_price;
3348
- } elseif ('only' === $product->get_pricing()) {
3349
  $price = $base_price;
3350
  }
3351
  } else {
@@ -3366,19 +3272,18 @@ class Woo_Feed_Products_v3
3366
  * @since 3.2.0
3367
  *
3368
  */
3369
- protected function getGroupProductPrice($grouped, $type, $tax = false)
3370
- {
3371
  $groupProductIds = $grouped->get_children();
3372
  $price = 0;
3373
- if (!empty($groupProductIds)) {
3374
- foreach ($groupProductIds as $id) {
3375
  $product = wc_get_product($id);
3376
- if (!is_object($product)) {
3377
  continue; // make sure that the product exists..
3378
  }
3379
 
3380
  $get_price = $this->get_price_by_product_type($product, $type, $tax);
3381
- if (!empty($get_price)) {
3382
  $price += $get_price;
3383
  }
3384
  }
@@ -3398,24 +3303,23 @@ class Woo_Feed_Products_v3
3398
  * @since 3.2.0
3399
  *
3400
  */
3401
- protected function getVariableProductPrice($variable, $type, $tax = false)
3402
- {
3403
  $min_max_first_default = apply_filters('woo_feed_variable_product_price_range', 'min');
3404
- if (isset($this->config['variable_price'])) {
3405
  $min_max_first_default = $this->config['variable_price'];
3406
  }
3407
 
3408
  $price = 0;
3409
- if ('first' == $min_max_first_default) {
3410
  $children = $variable->get_visible_children();
3411
- if (isset($children[0]) && !empty($children[0])) {
3412
  $variation = wc_get_product($children[0]);
3413
  $price = $this->get_price_by_product_type($variation, $type, $tax);
3414
  }
3415
  } else {
3416
- if ('regular_price' == $type) {
3417
  $price = $variable->get_variation_regular_price($min_max_first_default);
3418
- } elseif ('sale_price' == $type) {
3419
  $price = $variable->get_variation_sale_price($min_max_first_default);
3420
  } else {
3421
  $price = $variable->get_variation_price($min_max_first_default);
@@ -3427,7 +3331,7 @@ class Woo_Feed_Products_v3
3427
  );
3428
 
3429
  // Get Price with tax
3430
- if (true === $tax) {
3431
  $price = woo_feed_get_price_with_tax($price, $variable);
3432
  }
3433
  }
@@ -3445,11 +3349,10 @@ class Woo_Feed_Products_v3
3445
  * @return int|float|string
3446
  * @since 4.3.24
3447
  */
3448
- protected function getBundleProductPrice($product, $type, $tax = false)
3449
- {
3450
- if (class_exists('WC_Product_Bundle')) {//WC_Product_Bundle
3451
  $bundle = new WC_Product_Bundle($product);
3452
- if ('price' === $type || 'sale_price' === $type) {
3453
  $price = $bundle->get_bundle_price();
3454
  } else {
3455
  $price = $bundle->get_bundle_regular_price();
@@ -3461,11 +3364,10 @@ class Woo_Feed_Products_v3
3461
  );
3462
 
3463
  // Get Price with tax
3464
- if (true === $tax) {
3465
  $price = woo_feed_get_price_with_tax($price, $bundle);
3466
- }
3467
-
3468
- } else {
3469
  // Get Default price for others bundle products.
3470
  $price = $this->get_price_by_price_type($product, $type, $tax);
3471
  }
@@ -3482,20 +3384,19 @@ class Woo_Feed_Products_v3
3482
  *
3483
  * @return mixed $bundle_price
3484
  */
3485
- protected function iconic_bundle_product_price($product, $type, $tax = false)
3486
- {
3487
- if (!class_exists('WC_Product_Bundled')) {
3488
  return $product->get_price();
3489
  }
3490
 
3491
  $is_discounted = false;
3492
  $price = $product->get_price();
3493
  $bundle = new WC_Product_Bundled($product->get_id());
3494
- $iconic_bundle_product_type = (!is_null($bundle->options['price_display'])) ? $bundle->options['price_display'] : '';
3495
  $product_ids = $bundle->options['product_ids'];
3496
 
3497
  //set discount
3498
- if (!empty($bundle->options['fixed_discount'])) {
3499
  $is_discounted = true;
3500
  $discount = $bundle->options['fixed_discount'];
3501
  } else {
@@ -3504,15 +3405,15 @@ class Woo_Feed_Products_v3
3504
  }
3505
 
3506
  // Get price
3507
- if (is_array($product_ids)) {
3508
- $product_prices = array_map(function ($id) use ($tax, $type, $is_discounted, $discount) {
3509
  $product = wc_get_product($id);
3510
 
3511
  return $this->get_price_by_price_type($product, $type, $tax);
3512
 
3513
  }, $product_ids);
3514
 
3515
- if ('range' === $iconic_bundle_product_type) {
3516
  $price = min($product_prices);
3517
  } else {
3518
  $price = array_sum($product_prices);
@@ -3520,7 +3421,7 @@ class Woo_Feed_Products_v3
3520
  }
3521
 
3522
  // Get sale price if discount enabled
3523
- if ($is_discounted && ('sale_price' === $type || 'price' === $type)) {
3524
  $price -= $discount;
3525
  }
3526
 
@@ -3530,7 +3431,7 @@ class Woo_Feed_Products_v3
3530
  );
3531
 
3532
  // Get Price with tax
3533
- if (true === $tax) {
3534
  $price = woo_feed_get_price_with_tax($price, $bundle);
3535
  }
3536
 
@@ -3546,8 +3447,7 @@ class Woo_Feed_Products_v3
3546
  * @since 3.2.0
3547
  *
3548
  */
3549
- protected function weight($product)
3550
- {
3551
  return apply_filters('woo_feed_filter_product_weight', $product->get_weight(), $product, $this->config);
3552
  }
3553
 
@@ -3560,8 +3460,7 @@ class Woo_Feed_Products_v3
3560
  * @since 5.2.7
3561
  *
3562
  */
3563
- protected function weight_unit($product)
3564
- {
3565
  return apply_filters('woo_feed_filter_product_weight_unit', get_option('woocommerce_weight_unit'), $product, $this->config);
3566
  }
3567
 
@@ -3574,8 +3473,7 @@ class Woo_Feed_Products_v3
3574
  * @since 3.2.0
3575
  *
3576
  */
3577
- protected function width($product)
3578
- {
3579
  return apply_filters('woo_feed_filter_product_width', $product->get_width(), $product, $this->config);
3580
  }
3581
 
@@ -3588,8 +3486,7 @@ class Woo_Feed_Products_v3
3588
  * @since 3.2.0
3589
  *
3590
  */
3591
- protected function height($product)
3592
- {
3593
  return apply_filters('woo_feed_filter_product_height', $product->get_height(), $product, $this->config);
3594
  }
3595
 
@@ -3602,8 +3499,7 @@ class Woo_Feed_Products_v3
3602
  * @since 3.2.0
3603
  *
3604
  */
3605
- protected function length($product)
3606
- {
3607
  return apply_filters('woo_feed_filter_product_length', $product->get_length(), $product, $this->config);
3608
  }
3609
 
@@ -3616,15 +3512,14 @@ class Woo_Feed_Products_v3
3616
  * @since 4.3.16
3617
  * @author Nazrul Islam Nayan
3618
  */
3619
- protected function shipping($product)
3620
- {
3621
  $feedBody = '';
3622
  $data = $this->data;
3623
 
3624
- if( isset($data['shipping_zones']) && !empty($data['shipping_zones']) ) {
3625
  $zones = $data['shipping_zones'];
3626
 
3627
- if (in_array($this->config['provider'], ['google', 'facebook', 'pinterest', 'bing', 'snapchat'])) {
3628
  $get_shipping = new Woo_Feed_Shipping($this->config);
3629
  $feedBody .= $get_shipping->set_product($product)->set_shipping_zone($zones)->get_google_shipping();
3630
  }
@@ -3643,8 +3538,7 @@ class Woo_Feed_Products_v3
3643
  * @since 5.1.20
3644
  * @author Nazrul Islam Nayan
3645
  */
3646
- protected function shipping_cost($product)
3647
- {
3648
  $shipping_obj = new Woo_Feed_Shipping($this->config);
3649
  $shipping_obj = $shipping_obj->set_product($product);
3650
 
@@ -3660,8 +3554,7 @@ class Woo_Feed_Products_v3
3660
  * @since 3.2.0
3661
  *
3662
  */
3663
- protected function shipping_class($product)
3664
- {
3665
  return apply_filters('woo_feed_filter_product_shipping_class', $product->get_shipping_class(), $product, $this->config);
3666
  }
3667
 
@@ -3674,8 +3567,7 @@ class Woo_Feed_Products_v3
3674
  * @since 3.2.0
3675
  *
3676
  */
3677
- protected function author_name($product)
3678
- {
3679
  $post = get_post($product->get_id());
3680
 
3681
  return get_the_author_meta('user_login', $post->post_author);
@@ -3690,8 +3582,7 @@ class Woo_Feed_Products_v3
3690
  * @since 3.2.0
3691
  *
3692
  */
3693
- protected function author_email($product)
3694
- {
3695
  $post = get_post($product->get_id());
3696
 
3697
  return get_the_author_meta('user_email', $post->post_author);
@@ -3706,8 +3597,7 @@ class Woo_Feed_Products_v3
3706
  * @since 3.2.0
3707
  *
3708
  */
3709
- protected function date_created($product)
3710
- {
3711
  $date_created = gmdate('Y-m-d', strtotime($product->get_date_created()));
3712
 
3713
  return apply_filters('woo_feed_filter_product_date_created', $date_created, $product, $this->config);
@@ -3722,8 +3612,7 @@ class Woo_Feed_Products_v3
3722
  * @since 3.2.0
3723
  *
3724
  */
3725
- protected function date_updated($product)
3726
- {
3727
  $date_updated = gmdate('Y-m-d', strtotime($product->get_date_modified()));
3728
 
3729
  return apply_filters('woo_feed_filter_product_date_updated', $date_updated, $product, $this->config);
@@ -3737,10 +3626,9 @@ class Woo_Feed_Products_v3
3737
  * @since 5.1.20
3738
  * @author Nazrul Islam Nayan
3739
  */
3740
- protected function tax($product)
3741
- {
3742
  $feedBody = '';
3743
- if (in_array($this->config['provider'], ['google', 'facebook', 'pinterest', 'bing', 'snapchat'])) {
3744
  $shipping_obj = new Woo_Feed_Shipping($this->config);
3745
  $shipping_obj = $shipping_obj->set_product($product);
3746
  $feedBody .= $shipping_obj->get_google_tax();
@@ -3754,8 +3642,7 @@ class Woo_Feed_Products_v3
3754
  * @param WC_Product $product Product object.
3755
  * @return string
3756
  */
3757
- protected function tax_class($product)
3758
- {
3759
  return apply_filters('woo_feed_filter_product_tax_class', $product->get_tax_class(), $product, $this->config);
3760
  }
3761
 
@@ -3764,8 +3651,7 @@ class Woo_Feed_Products_v3
3764
  * @param WC_Product $product Product object.
3765
  * @return string
3766
  */
3767
- protected function tax_status($product)
3768
- {
3769
  return apply_filters('woo_feed_filter_product_tax_status', $product->get_tax_status(), $product, $this->config);
3770
  }
3771
 
@@ -3776,11 +3662,10 @@ class Woo_Feed_Products_v3
3776
  * @param string $field custom field name.
3777
  * @return string
3778
  */
3779
- protected function getCustomField($product, $field)
3780
- {
3781
  $id = $product->get_id();
3782
  $meta = $field;
3783
- if ($product->is_type('variation')) {
3784
  $meta = $field . '_var';
3785
  }
3786
 
@@ -3789,7 +3674,7 @@ class Woo_Feed_Products_v3
3789
  $new_meta_key = '';
3790
  $old_meta_key = '';
3791
 
3792
- if( strpos( $meta, '_identifier' ) !== false ){
3793
  $old_meta_key = $meta;
3794
  $new_meta_key = str_replace( '_identifier', '', $meta );
3795
  } else {
@@ -3800,7 +3685,7 @@ class Woo_Feed_Products_v3
3800
  $new_meta_value = $this->getProductMeta( $product, $new_meta_key );
3801
  $old_meta_value = $this->getProductMeta( $product, $old_meta_key );
3802
 
3803
- if( empty( $new_meta_value ) ){
3804
  return $old_meta_value;
3805
  } else {
3806
  return $new_meta_value;
@@ -3817,12 +3702,11 @@ class Woo_Feed_Products_v3
3817
  * @since 3.2.0
3818
  *
3819
  */
3820
- protected function sale_price_effective_date($product)
3821
- {
3822
  $effective_date = '';
3823
  $from = $this->sale_price_sdate($product);
3824
  $to = $this->sale_price_edate($product);
3825
- if (!empty($from) && !empty($to)) {
3826
  $from = gmdate('c', strtotime($from));
3827
  $to = gmdate('c', strtotime($to));
3828
 
@@ -3842,25 +3726,24 @@ class Woo_Feed_Products_v3
3842
  * @since 2.2.3
3843
  *
3844
  */
3845
- protected function getProductAttribute($product, $attr)
3846
- {
3847
  $id = $product->get_id();
3848
 
3849
- if (woo_feed_wc_version_check(3.2)) {
3850
- if (woo_feed_wc_version_check(3.6)) {
3851
  $attr = str_replace('pa_', '', $attr);
3852
  }
3853
  $value = $product->get_attribute($attr);
3854
 
3855
  // if empty get attribute of parent post
3856
- if ('' === $value && $product->is_type('variation')) {
3857
  $product = wc_get_product($product->get_parent_id());
3858
  $value = $product->get_attribute($attr);
3859
  }
3860
 
3861
  $getproductattribute = $value;
3862
  } else {
3863
- $getproductattribute = implode(',', wc_get_product_terms($id, $attr, array('fields' => 'names')));
3864
  }
3865
 
3866
  return apply_filters('woo_feed_filter_product_attribute', $getproductattribute, $product, $attr, $this->config);
@@ -3876,11 +3759,10 @@ class Woo_Feed_Products_v3
3876
  * @since 2.2.3
3877
  *
3878
  */
3879
- protected function getProductMeta($product, $meta)
3880
- {
3881
  $value = get_post_meta($product->get_id(), $meta, true);
3882
  // if empty get meta value of parent post
3883
- if ('' === $value && $product->is_type('variation')) {
3884
  $value = get_post_meta($product->get_parent_id(), $meta, true);
3885
  }
3886
 
@@ -3896,8 +3778,7 @@ class Woo_Feed_Products_v3
3896
  * @since 3.2.0
3897
  *
3898
  */
3899
- public function filter_product($product)
3900
- {
3901
  return true;
3902
  }
3903
 
@@ -3911,10 +3792,9 @@ class Woo_Feed_Products_v3
3911
  * @since 2.2.3
3912
  *
3913
  */
3914
- protected function getProductTaxonomy($product, $taxonomy)
3915
- {
3916
  $id = $product->get_id();
3917
- if ($product->is_type('variation')) {
3918
  $id = $product->get_parent_id();
3919
  }
3920
 
@@ -3922,7 +3802,7 @@ class Woo_Feed_Products_v3
3922
 
3923
  $term_list = get_the_term_list($id, $taxonomy, '', $separator, '');
3924
 
3925
- if (is_object($term_list) && get_class($term_list) === 'WP_Error') {
3926
  $term_list = '';
3927
  }
3928
 
@@ -3942,33 +3822,32 @@ class Woo_Feed_Products_v3
3942
  * @since 3.2.0
3943
  *
3944
  */
3945
- protected function price_format($name, $conditionName, $result)
3946
- {
3947
  $plus = '+';
3948
  $minus = '-';
3949
  $percent = '%';
3950
 
3951
- if (strpos($name, 'price') !== false) {
3952
- if (strpos($result, $plus) !== false && strpos($result, $percent) !== false) {
3953
  $result = str_replace('+', '', $result);
3954
  $result = str_replace('%', '', $result);
3955
- if (is_numeric($result)) {
3956
  $result = $conditionName + (($conditionName * $result) / 100);
3957
  }
3958
- } elseif (strpos($result, $minus) !== false && strpos($result, $percent) !== false) {
3959
  $result = str_replace('-', '', $result);
3960
  $result = str_replace('%', '', $result);
3961
- if (is_numeric($result)) {
3962
  $result = $conditionName - (($conditionName * $result) / 100);
3963
  }
3964
- } elseif (strpos($result, $plus) !== false) {
3965
  $result = str_replace('+', '', $result);
3966
- if (is_numeric($result)) {
3967
  $result = ($conditionName + $result);
3968
  }
3969
- } elseif (strpos($result, $minus) !== false) {
3970
  $result = str_replace('-', '', $result);
3971
- if (is_numeric($result)) {
3972
  $result = $conditionName - $result;
3973
  }
3974
  }
@@ -3989,29 +3868,28 @@ class Woo_Feed_Products_v3
3989
  * @since 3.2.0
3990
  *
3991
  */
3992
- protected function format_output($output, $outputTypes, $product, $productAttribute, $merchant_attribute)
3993
- {
3994
- if (!empty($outputTypes) && is_array($outputTypes)) {
3995
 
3996
  // Format Output According to output type
3997
- if (in_array(2, $outputTypes)) { // Strip Tags
3998
  $output = woo_feed_strip_all_tags(html_entity_decode($output));
3999
  }
4000
 
4001
- if (in_array(3, $outputTypes)) { // UTF-8 Encode
4002
  $output = utf8_encode($output);
4003
  }
4004
 
4005
- if (in_array(4, $outputTypes)) { // htmlentities
4006
  $output = htmlentities($output, ENT_QUOTES, 'UTF-8');
4007
  }
4008
 
4009
- if (in_array(5, $outputTypes)) { // Integer
4010
  $output = intval($output);
4011
  }
4012
 
4013
- if (in_array(6, $outputTypes)) { // Format Price
4014
- if (!empty($output) && $output > 0) {
4015
  $decimals = wc_get_price_decimals();
4016
  $decimal_separator = wc_get_price_decimal_separator();
4017
  $thousand_separator = wc_get_price_thousand_separator();
@@ -4020,79 +3898,79 @@ class Woo_Feed_Products_v3
4020
  }
4021
  }
4022
 
4023
- if (in_array(7, $outputTypes)) { // Rounded Price
4024
- if (!empty($output) && $output > 0) {
4025
  $output = round($output);
4026
  $output = number_format($output, 2, '.', '');
4027
  }
4028
  }
4029
 
4030
- if (in_array(8, $outputTypes)) { // Delete Space
4031
  $output = htmlentities($output, null, 'utf-8');
4032
  $output = str_replace("&nbsp;", " ", $output);
4033
  $output = html_entity_decode($output);
4034
  $output = preg_replace("/\\s+/", ' ', $output);
4035
  }
4036
 
4037
- if (in_array(10, $outputTypes)) { // Remove Invalid Character
4038
  $output = woo_feed_stripInvalidXml($output);
4039
  }
4040
 
4041
- if (in_array(11, $outputTypes)) { // Remove ShortCodes
4042
  $output = $this->remove_short_codes($output);
4043
  }
4044
 
4045
- if (in_array(12, $outputTypes)) {
4046
  $output = ucwords(strtolower($output));
4047
  }
4048
 
4049
- if (in_array(13, $outputTypes)) {
4050
  $output = ucfirst(strtolower($output));
4051
  }
4052
 
4053
- if (in_array(14, $outputTypes)) {
4054
  $output = strtoupper(strtolower($output));
4055
  }
4056
 
4057
- if (in_array(15, $outputTypes)) {
4058
  $output = strtolower($output);
4059
  }
4060
 
4061
- if (in_array(16, $outputTypes)) {
4062
- if ('http' == substr($output, 0, 4)) {
4063
  $output = str_replace('http://', 'https://', $output);
4064
  }
4065
  }
4066
 
4067
- if (in_array(17, $outputTypes)) {
4068
- if ('http' == substr($output, 0, 4)) {
4069
  $output = str_replace('https://', 'http://', $output);
4070
  }
4071
  }
4072
 
4073
- if (in_array(18, $outputTypes)) { // only parent
4074
- if ($product->is_type('variation')) {
4075
  $id = $product->get_parent_id();
4076
  $parentProduct = wc_get_product($id);
4077
  $output = $this->getAttributeValueByType($parentProduct, $productAttribute, $merchant_attribute);
4078
  }
4079
  }
4080
 
4081
- if (in_array(19, $outputTypes)) { // child if parent empty
4082
- if ($product->is_type('variation')) {
4083
  $id = $product->get_parent_id();
4084
  $parentProduct = wc_get_product($id);
4085
  $output = $this->getAttributeValueByType($parentProduct, $productAttribute, $merchant_attribute);
4086
- if (empty($output)) {
4087
  $output = $this->getAttributeValueByType($product, $productAttribute, $merchant_attribute);
4088
  }
4089
  }
4090
  }
4091
 
4092
- if (in_array(20, $outputTypes)) { // parent if child empty
4093
- if ($product->is_type('variation')) {
4094
  $output = $this->getAttributeValueByType($product, $productAttribute, $merchant_attribute);
4095
- if (empty($output)) {
4096
  $id = $product->get_parent_id();
4097
  $parentProduct = wc_get_product($id);
4098
  $output = $this->getAttributeValueByType($parentProduct, $productAttribute, $merchant_attribute);
@@ -4100,7 +3978,7 @@ class Woo_Feed_Products_v3
4100
  }
4101
  }
4102
 
4103
- if (in_array(9, $outputTypes) && !empty($output) && 'xml' === $this->config['feedType']) { // Add CDATA
4104
  $output = '<![CDATA[' . $output . ']]>';
4105
  }
4106
  }
@@ -4120,29 +3998,28 @@ class Woo_Feed_Products_v3
4120
  * @since 3.2.0
4121
  *
4122
  */
4123
- public function process_prefix_suffix($output, $prefix, $suffix, $attribute = '')
4124
- {
4125
 
4126
  $cdata = false;
4127
- if ('' === $output) {
4128
  return $output;
4129
  }
4130
 
4131
- if (strpos($output, '<![CDATA[') !== false) {
4132
  $cdata = true;
4133
- $output = str_replace(array('<![CDATA[', ']]>'), array('', ''), $output);
4134
  }
4135
 
4136
  // Add Prefix before Output
4137
- if ('' !== $prefix) {
4138
  $output = "$prefix" . $output;
4139
  }
4140
 
4141
  // Add Suffix after Output
4142
- if ('' !== $suffix) {
4143
- if (array_key_exists(trim($suffix), get_woocommerce_currencies())) { // Add space before suffix if attribute contain price.
4144
  $output .= ' ' . $suffix;
4145
- } elseif (substr($output, 0, 4) === 'http') {
4146
  // Parse URL Parameters if available into suffix field
4147
  $output = woo_feed_make_url_with_parameter($output, $suffix);
4148
 
@@ -4151,7 +4028,7 @@ class Woo_Feed_Products_v3
4151
  }
4152
  }
4153
 
4154
- if ($cdata) {
4155
  $output = '<![CDATA[' . $output . ']]>';
4156
  }
4157
 
@@ -4167,9 +4044,8 @@ class Woo_Feed_Products_v3
4167
  * @since 3.6.3
4168
  *
4169
  */
4170
- protected function subscription_period($product)
4171
- {
4172
- if (class_exists('WC_Subscriptions')) {
4173
  return $this->getProductMeta($product, '_subscription_period');
4174
  }
4175
  return '';
@@ -4184,9 +4060,8 @@ class Woo_Feed_Products_v3
4184
  * @since 3.6.3
4185
  *
4186
  */
4187
- protected function subscription_period_interval($product)
4188
- {
4189
- if (class_exists('WC_Subscriptions')) {
4190
  return $this->getProductMeta($product, '_subscription_period_interval');
4191
  }
4192
  return '';
@@ -4201,8 +4076,7 @@ class Woo_Feed_Products_v3
4201
  * @since 3.6.3
4202
  *
4203
  */
4204
- protected function subscription_amount($product)
4205
- {
4206
  return $this->price($product);
4207
  }
4208
 
@@ -4214,8 +4088,7 @@ class Woo_Feed_Products_v3
4214
  * @return mixed
4215
  * @since 4.3.101
4216
  */
4217
- protected function installment_amount($product)
4218
- {
4219
  return $this->price($product);
4220
  }
4221
 
@@ -4227,9 +4100,8 @@ class Woo_Feed_Products_v3
4227
  * @return mixed
4228
  * @since 4.3.101
4229
  */
4230
- protected function installment_months($product)
4231
- {
4232
- if (class_exists('WC_Subscriptions')) {
4233
  return $this->getProductMeta($product, '_subscription_length');
4234
  }
4235
  return '';
@@ -4247,11 +4119,10 @@ class Woo_Feed_Products_v3
4247
  * @return mixed
4248
  * @since 3.6.3
4249
  */
4250
- protected function unit_price_measure($product)
4251
- {
4252
  $unit_price_measure = '';
4253
  $identifiers = woo_feed_get_options('woo_feed_identifier');
4254
- if ('enable' === $identifiers['unit_pricing_base_measure']
4255
  && 'enable' === $identifiers['unit_pricing_measure']
4256
  && 'enable' === $identifiers['unit']
4257
  ) {
@@ -4261,7 +4132,7 @@ class Woo_Feed_Products_v3
4261
  $unit_price_measure .= " " . $unit;
4262
  }
4263
 
4264
- if (empty($unit_price_measure) && class_exists('WooCommerce_Germanized')) { // For WooCommerce Germanized Plugin
4265
  $unit = $this->getProductMeta($product, '_unit');
4266
  $unit_price_measure = $this->getProductMeta($product, '_unit_product');
4267
 
@@ -4282,11 +4153,10 @@ class Woo_Feed_Products_v3
4282
  * @return mixed
4283
  * @since 3.6.3
4284
  */
4285
- protected function unit_price_base_measure($product)
4286
- {
4287
  $unit_price_base_measure = '';
4288
  $identifiers = woo_feed_get_options('woo_feed_identifier');
4289
- if ('enable' === $identifiers['unit_pricing_base_measure']
4290
  && 'enable' === $identifiers['unit_pricing_measure']
4291
  && 'enable' === $identifiers['unit']
4292
  ) {
@@ -4296,7 +4166,7 @@ class Woo_Feed_Products_v3
4296
  $unit_price_base_measure .= " " . $unit;
4297
  }
4298
 
4299
- if (empty($unit_price_base_measure) && class_exists('WooCommerce_Germanized')) { // For WooCommerce Germanized Plugin
4300
  $unit = $this->getProductMeta($product, '_unit');
4301
  $unit_price_base_measure = $this->getProductMeta($product, '_unit_base');
4302
 
@@ -4314,10 +4184,9 @@ class Woo_Feed_Products_v3
4314
  * @return mixed
4315
  * @since 3.6.3
4316
  */
4317
- protected function wc_germanized_gtin($product)
4318
- {
4319
  $wc_germanized_gtin = '';
4320
- if (class_exists('WooCommerce_Germanized')) { // For WooCommerce Germanized Plugin
4321
  $wc_germanized_gtin = $this->getProductMeta($product, '_ts_gtin');
4322
  }
4323
 
@@ -4332,10 +4201,9 @@ class Woo_Feed_Products_v3
4332
  * @return mixed
4333
  * @since 3.6.3
4334
  */
4335
- protected function wc_germanized_mpn($product)
4336
- {
4337
  $wc_germanized_mpn = '';
4338
- if (class_exists('WooCommerce_Germanized')) { // For WooCommerce Germanized Plugin
4339
  $wc_germanized_mpn = $this->getProductMeta($product, '_ts_mpn');
4340
  }
4341
 
@@ -4351,8 +4219,7 @@ class Woo_Feed_Products_v3
4351
  * @return mixed
4352
  * @since 4.4.4
4353
  */
4354
- protected function yoast_gtin8($product)
4355
- {
4356
  $yoast_gtin8_value = woo_feed_get_yoast_identifiers_value('gtin8', $product);
4357
 
4358
  return apply_filters('yoast_gtin8_attribute_value', $yoast_gtin8_value, $product);
@@ -4366,8 +4233,7 @@ class Woo_Feed_Products_v3
4366
  * @return mixed
4367
  * @since 4.4.4
4368
  */
4369
- protected function yoast_gtin12($product)
4370
- {
4371
  $yoast_gtin12_value = woo_feed_get_yoast_identifiers_value('gtin12', $product);
4372
 
4373
  return apply_filters('yoast_gtin12_attribute_value', $yoast_gtin12_value, $product);
@@ -4381,8 +4247,7 @@ class Woo_Feed_Products_v3
4381
  * @return mixed
4382
  * @since 4.4.4
4383
  */
4384
- protected function yoast_gtin13($product)
4385
- {
4386
  $yoast_gtin13_value = woo_feed_get_yoast_identifiers_value('gtin13', $product);
4387
 
4388
  return apply_filters('yoast_gtin13_attribute_value', $yoast_gtin13_value, $product);
@@ -4396,8 +4261,7 @@ class Woo_Feed_Products_v3
4396
  * @return mixed
4397
  * @since 4.4.4
4398
  */
4399
- protected function yoast_gtin14($product)
4400
- {
4401
  $yoast_gtin14_value = woo_feed_get_yoast_identifiers_value('gtin14', $product);
4402
 
4403
  return apply_filters('yoast_gtin14_attribute_value', $yoast_gtin14_value, $product);
@@ -4411,8 +4275,7 @@ class Woo_Feed_Products_v3
4411
  * @return mixed
4412
  * @since 4.4.4
4413
  */
4414
- protected function yoast_isbn($product)
4415
- {
4416
  $yoast_isbn_value = woo_feed_get_yoast_identifiers_value('isbn', $product);
4417
 
4418
  return apply_filters('yoast_isbn_attribute_value', $yoast_isbn_value, $product);
@@ -4426,8 +4289,7 @@ class Woo_Feed_Products_v3
4426
  * @return mixed
4427
  * @since 4.4.4
4428
  */
4429
- protected function yoast_mpn($product)
4430
- {
4431
  $yoast_mpn_value = woo_feed_get_yoast_identifiers_value('mpn', $product);
4432
 
4433
  return apply_filters('yoast_mpn_attribute_value', $yoast_mpn_value, $product);
@@ -4441,11 +4303,10 @@ class Woo_Feed_Products_v3
4441
  * @return mixed
4442
  * @since 5.2.66
4443
  */
4444
- protected function rank_math_gtin($product)
4445
- {
4446
  $product_id = woo_feed_parent_product_id($product);
4447
  $rankmath_gtin_value = get_post_meta($product_id, '_rank_math_gtin_code');
4448
- $rankmath_gtin_value = !empty($rankmath_gtin_value) && is_array($rankmath_gtin_value) ? $rankmath_gtin_value[0] : '';
4449
 
4450
  return apply_filters('rankmath_gtin_attribute_value', $rankmath_gtin_value, $product);
4451
  }
9
 
10
  use RankMath\Helper;
11
 
12
+ if ( ! defined('ABSPATH') ) {
13
  die();
14
  }
15
 
198
  * @var array
199
  */
200
  protected $skipped_merchant_attributes = array(
201
+ 'google' => array(
202
  'shipping_country',
203
  'shipping_region',
204
  'shipping_postal_code',
221
  'attribute_name',
222
  'attribute_value',
223
  ),
224
+ 'facebook' => array(
225
  'shipping_country',
226
  'shipping_region',
227
  'shipping_service',
244
  'additional_variant_label',
245
  'additional_variant_value',
246
  ),
247
+ 'bing' => array(
248
  'shipping_country',
249
  'shipping_service',
250
  'shipping_price',
322
  * @param $config
323
  * @return void
324
  */
325
+ public function __construct( $config ) {
 
326
  $this->config = woo_feed_parse_feed_rules($config);
327
  $this->queryType = woo_feed_get_options('product_query_type');
328
  $this->process_xml_wrapper();
334
  * @param string $type
335
  * @return array
336
  */
337
+ protected function get_query_args( $type = 'wc' ) {
 
338
  $args = [];
339
 
340
  // Include Product Variations with db query if configured
341
  $variation_query = woo_feed_get_options('variation_query_type');
342
 
343
+ if ( 'wc' === $type ) {
344
  $product_types = $this->product_types;
345
+ if ( 'variable' === $variation_query ) {
 
346
  $variation = array_search('variation', $product_types, true);
347
+ if ( $variation ) {
348
+ unset($product_types[ $variation ]);
349
  }
350
  }
351
 
352
  $args = array(
353
  'limit' => -1, // phpcs:ignore
354
+ 'status' => $this->post_status,
355
+ 'type' => $product_types,
356
+ 'orderby' => 'date',
357
+ 'order' => 'DESC',
358
+ 'return' => 'ids',
359
  'suppress_filters' => false,
360
  );
361
  }
362
 
363
+ if ( 'wp' === $type ) {
364
 
365
  $post_type = 'product';
366
  // Include Product Variations with db query if configured
367
  $variation_query = woo_feed_get_options('variation_query_type');
368
+ if ( 'individual' === $variation_query ) {
369
+ $post_type = [ 'product', 'product_variation' ];
370
  }
371
 
372
  $args = array(
373
  'posts_per_page' => -1, // phpcs:ignore
374
+ 'post_type' => $post_type,
375
+ 'post_status' => 'publish',
376
+ 'order' => 'DESC',
377
+ 'fields' => 'ids',
378
+ 'cache_results' => false,
379
  'update_post_meta_cache' => false,
380
  'update_post_term_cache' => false,
381
+ 'suppress_filters' => false,
382
  );
383
  }
384
  return $args;
389
  *
390
  * @return array
391
  */
392
+ public function get_wc_query_products() {
 
393
  $args = $this->get_query_args('wc');
394
+ if ( woo_feed_is_debugging_enabled() ) {
395
  woo_feed_log_feed_process($this->config['filename'], 'WC_Product_Query Args::' . PHP_EOL . print_r($args, true)); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_print_r
396
  woo_feed_log($this->config['filename'], 'WC_Product_Query Args::' . PHP_EOL . print_r($args, true), 'info'); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_print_r
397
  }
398
  $query = new WC_Product_Query($args);
399
+ if ( woo_feed_is_debugging_enabled() ) {
400
  woo_feed_log_feed_process($this->config['filename'], sprintf('WC_Product_Query Args ::' . PHP_EOL . '%s', print_r($args, true))); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_print_r
401
  }
402
  return $query->get_products();
407
  *
408
  * return array
409
  */
410
+ public function get_wp_query_products() {
 
411
  $args = $this->get_query_args('wp');
412
  $query = new WP_Query($args);
413
+ if ( ! is_wp_error($query) && woo_feed_is_debugging_enabled() ) {
414
  woo_feed_log_feed_process($this->config['filename'], 'WC_Product_Query Args::' . PHP_EOL . print_r($args, true)); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_print_r
415
  woo_feed_log_feed_process($this->config['filename'], sprintf('WP_Query Request ::' . PHP_EOL . '%s', $query->request));
416
  woo_feed_log($this->config['filename'], 'WC_Product_Query Args::' . PHP_EOL . print_r($args, true), 'info'); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_print_r
424
  *
425
  * @return array
426
  */
427
+ public function query_products() {
 
428
  $products = [];
429
+ if ( 'wc' == $this->queryType ) {
430
  $products = $this->get_wc_query_products();
431
+ } elseif ( 'wp' == $this->queryType ) {
432
  $products = $this->get_wp_query_products();
433
+ } elseif ( 'both' == $this->queryType ) {
434
  $wc = $this->get_wc_query_products();
435
  $wp = $this->get_wp_query_products();
436
  $products = array_unique(array_merge($wc, $wp));
446
  * Organize Feed Attribute config
447
  * @return array|bool
448
  */
449
+ public function get_attribute_config() {
450
+ if ( empty($this->config) ) {
 
451
  return false;
452
  }
453
 
454
  $attributeConfig = array();
455
  $merchantAttributes = $this->config['mattributes'];
456
+ if ( ! empty($merchantAttributes) ) {
457
  $i = 0;
458
+ foreach ( $merchantAttributes as $key => $value ) {
459
+ $attributeConfig[ $i ]['mattributes'] = $value;
460
+ $attributeConfig[ $i ]['prefix'] = $this->config['prefix'][ $key ];
461
+ $attributeConfig[ $i ]['type'] = $this->config['type'][ $key ];
462
+ $attributeConfig[ $i ]['attributes'] = $this->config['attributes'][ $key ];
463
+ $attributeConfig[ $i ]['default'] = $this->config['default'][ $key ];
464
+ $attributeConfig[ $i ]['suffix'] = $this->config['suffix'][ $key ];
465
+ $attributeConfig[ $i ]['output_type'] = $this->config['output_type'][ $key ];
466
+ $attributeConfig[ $i ]['limit'] = $this->config['limit'][ $key ];
467
  $i++;
468
  }
469
  }
480
  * @since 3.2.0
481
  *
482
  */
483
+ public function get_products( $productIds ) {
 
484
 
485
+ if ( empty($productIds) ) {
486
  return [];
487
  }
488
 
499
  */
500
  do_action('woo_feed_before_product_loop', $productIds, $this->config);
501
 
502
+ foreach ( $productIds as $key => $pid ) {
503
  woo_feed_log_feed_process($this->config['filename'], sprintf('Loading Product Data For %d.', $pid));
504
  $product = wc_get_product($pid);
505
 
506
+ if ( $this->exclude_from_loop($product) ) {
507
  continue;
508
  }
509
 
510
+ if ( $this->process_variation($product) ) {
511
  continue;
512
  }
513
 
514
+ if ( ! $this->filter_product($product) ) {
515
  woo_feed_log_feed_process($this->config['filename'], 'Skipping Product :: Matched with filter conditions');
516
  continue;
517
  }
519
  woo_feed_log_feed_process($this->config['filename'], 'Formatting Feed Data...');
520
 
521
  // Add Single item wrapper before product info loop start
522
+ if ( 'xml' == $this->config['feedType'] ) {
523
  $this->feedBody .= "\n";
524
  $this->feedBody .= '<' . $this->config['itemWrapper'] . '>';
525
  $this->feedBody .= "\n";
535
  woo_feed_log_feed_process($this->config['filename'], 'Processing Merchant Specific Fields');
536
  // Process feed data for uncommon merchant feed like Google,Facebook,Pinterest
537
  $this->process_for_merchant($product, $this->pi);
538
+ } catch ( Exception $e ) {
539
  $message = 'Error Processing Merchant Specific Fields.' . PHP_EOL . 'Caught Exception :: ' . $e->getMessage();
540
  woo_feed_log($this->config['filename'], $message, 'critical', $e, true);
541
  woo_feed_log_fatal_error($message, $e);
542
  }
543
 
544
+ if ( 'xml' == $this->config['feedType'] ) {
545
+ if ( empty($this->feedHeader) ) {
546
  $this->feedHeader = $this->process_xml_feed_header();
547
  $this->feedFooter = $this->process_xml_feed_footer();
548
 
551
  $this->feedBody .= '</' . $this->config['itemWrapper'] . '>';
552
 
553
 
554
+ } elseif ( 'txt' == $this->config['feedType'] ) {
555
+ if ( empty($this->feedHeader) ) {
556
  $this->process_txt_feed_header();
557
  }
558
  $this->process_txt_feed_body();
559
+ } elseif ( 'csv' == $this->config['feedType'] ) {
560
+ if ( empty($this->feedHeader) ) {
561
  $this->process_csv_feed_header();
562
  }
563
  $this->process_csv_feed_body();
564
+ }elseif ( 'json' == $this->config['feedType'] ) {
565
  $this->process_json_feed_body();
566
  }
567
  woo_feed_log_feed_process($this->config['filename'], 'Done Formatting...');
588
  * @return bool
589
  * @since 3.3.9
590
  */
591
+ protected function process_variation( $product ) {
 
592
  // Apply variable and variation settings
593
+ if ( $product->is_type('variable') && $product->has_child() ) {
594
  $this->pi++;
595
 
596
  $variation_query = woo_feed_get_options('variation_query_type');
597
+ if ( 'variable' === $variation_query ) {
598
  $variations = $product->get_visible_children();
599
+ if ( is_array($variations) && (sizeof($variations) > 0) ) {
600
+ if ( woo_feed_is_debugging_enabled() ) {
601
  woo_feed_log_feed_process($this->config['filename'], sprintf('Getting Variation Product(s) :: %s', implode(', ', $variations)));
602
  }
603
  $this->get_products($variations);
617
  * @return void
618
  * @since 3.3.9
619
  */
620
+ protected function process_attributes( $product ) {
 
621
  // Get Product Attribute values by type and assign to product array
622
+ foreach ( $this->config['attributes'] as $attr_key => $attribute ) {
623
 
624
+ $merchant_attribute = isset($this->config['mattributes'][ $attr_key ]) ? $this->config['mattributes'][ $attr_key ] : '';
625
 
626
+ if ( $this->exclude_current_attribute($product, $merchant_attribute, $attribute) ) {
627
  continue;
628
  }
629
 
630
  // Add Prefix and Suffix into Output
631
+ $prefix = $this->config['prefix'][ $attr_key ];
632
+ $suffix = $this->config['suffix'][ $attr_key ];
633
  $merchant = $this->config['provider'];
634
  $feedType = $this->config['feedType'];
635
 
636
+ if ( 'pattern' == $this->config['type'][ $attr_key ] ) {
637
+ $attributeValue = $this->config['default'][ $attr_key ];
638
  } else { // Get Pattern value
639
  $attributeValue = $this->getAttributeValueByType($product, $attribute, $merchant_attribute);
640
  }
641
 
642
  // Format Output according to Output Type config.
643
+ if ( isset($this->config['output_type'][ $attr_key ]) ) {
644
+ $outputType = $this->config['output_type'][ $attr_key ];
645
+ $attributeValue = $this->format_output($attributeValue, $this->config['output_type'][ $attr_key ], $product, $attribute, $merchant_attribute);
646
  }
647
 
648
  // Limit Output.
649
+ if ( isset($this->config['limit'][ $attr_key ]) ) {
650
+ $attributeValue = $this->crop_string($attributeValue, 0, $this->config['limit'][ $attr_key ]);
651
  }
652
 
653
  // Process prefix and suffix.
654
  $attributeValue = $this->process_prefix_suffix($attributeValue, $prefix, $suffix, $attribute);
655
 
656
+ if ( 'xml' == $feedType ) {
657
 
658
  // Replace XML Nodes according to merchant requirement.
659
  $getReplacedAttribute = woo_feed_replace_to_merchant_attribute($merchant_attribute, $merchant, $feedType);
662
  $getReplacedAttribute = str_replace(' ', '_', $getReplacedAttribute);
663
 
664
  // Trim XML Element text & Encode for UTF-8.
665
+ if ( ! empty($attributeValue) ) {
666
  $attributeValue = trim($attributeValue);
667
 
668
+ if ( 'custom' === $this->config['provider'] && strpos($attributeValue, '<![CDATA[') === false ) {
669
  $attributeValue = htmlentities($attributeValue, ENT_XML1 | ENT_QUOTES, 'UTF-8');
670
  }
671
  }
672
 
673
  // Add closing XML node if value is empty
674
+ if ( '' !== $attributeValue ) {
675
  // Add CDATA wrapper for XML feed to prevent XML error.
676
  $attributeValue = woo_feed_add_cdata($merchant_attribute, $attributeValue, $merchant, $this->config['feedType']);
677
 
683
  $this->feedBody .= '<' . $getReplacedAttribute . '/>';
684
  $this->feedBody .= "\n";
685
  }
686
+ } elseif ( in_array($feedType, [ 'csv', 'tsv', 'xls' ], true) ) {
687
  $merchant_attribute = woo_feed_replace_to_merchant_attribute($merchant_attribute, $merchant, $feedType);
688
  $merchant_attribute = $this->processStringForCSV($merchant_attribute);
689
 
690
+ if ( "shipping" === $merchant_attribute && 'bing' == $this->config['provider'] ) {
691
  $merchant_attribute = 'shipping(country:service:price)';
692
+ } elseif ( "shipping" === $merchant_attribute ) {
693
  $merchant_attribute = 'shipping(country:region:service:price)';
694
  }
695
 
696
+ if ( "tax" === $merchant_attribute ) {
697
  $merchant_attribute = 'tax(country:region:rate:tax_ship)';
698
  }
699
 
700
  $attributeValue = $this->processStringForCSV($attributeValue);
701
 
702
+ } elseif ( 'txt' == $feedType ) {
703
  $merchant_attribute = woo_feed_replace_to_merchant_attribute($merchant_attribute, $merchant, $feedType);
704
  $merchant_attribute = $this->processStringForTXT($merchant_attribute);
705
 
706
+ if ( "shipping" === $merchant_attribute && 'bing' == $this->config['provider'] ) {
707
  $merchant_attribute = 'shipping(country:service:price)';
708
+ } elseif ( "shipping" === $merchant_attribute ) {
709
  $merchant_attribute = 'shipping(country:region:service:price)';
710
  }
711
 
712
+ if ( "tax" === $merchant_attribute ) {
713
  $merchant_attribute = 'tax(country:region:rate:tax_ship)';
714
  }
715
 
716
  $attributeValue = $this->processStringForTXT($attributeValue);
717
  }
718
 
719
+ $this->products[ $this->pi ][ $merchant_attribute ] = $attributeValue;
720
  }
721
  }
722
 
727
  * @since 4.0.5
728
  *
729
  */
730
+ protected function feed_nested_attributes() {
 
731
  return [
732
+ 'reviewer' => [ 'reviewer', 'name' ],
733
+ 'ratings' => [ 'ratings', 'overall' ],
734
+ 'product_url' => [ 'products', 'product', 'product_url' ],
735
  ];
736
  }
737
 
746
  *
747
  */
748
 
749
+ protected function nested_attributes_element( $attribute, $content ) {
 
750
  $starter = '';
751
  $finisher = '';
752
  $element = '';
753
 
754
+ if ( empty($attribute) ) {
755
  return $attribute;
756
  }
757
 
758
  $attr_names = $this->feed_nested_attributes();
759
 
760
+ foreach ( $attr_names as $key => $value ) {
761
+ if ( $key === $attribute ) {
762
  //starter tags element
763
+ foreach ( $value as $item_value ) {
764
  $starter .= '<' . strval($item_value) . '>';
765
  }
766
 
767
  //finishing tags element
768
  $rev_value = array_reverse($value);
769
+ foreach ( $rev_value as $item_value ) {
770
  $finisher .= '</' . strval($item_value) . '>';
771
  }
772
  }
787
  * @since 3.3.9
788
  *
789
  */
790
+ protected function exclude_from_loop( $product ) {
 
791
  // Skip for invalid products
792
+ if ( ! is_object($product) ) {
793
  woo_feed_log_feed_process($this->config['filename'], 'Skipping Product :: Product data is not a valid WC_Product object.');
794
  return true;
795
  }
796
 
797
  // For WP_Query check available product types
798
+ if ( 'wp' == $this->queryType && ! in_array($product->get_type(), $this->product_types, true) ) {
799
  woo_feed_log_feed_process($this->config['filename'], sprintf('Skipping Product :: Invalid Post/Product Type : %s.', $product->get_type()));
800
  return true;
801
  }
802
 
803
  // Skip orphaned variation
804
+ if ( $product->is_type('variation') && ! $product->get_parent_id() ) {
805
  woo_feed_log_feed_process($this->config['filename'], sprintf('Skipping Product :: Orphaned variation product [id: %s] skipped.', $product->get_id()));
806
  return true;
807
  }
808
 
809
  // Skip for invisible products
810
+ if ( ! $product->is_visible() ) {
811
  woo_feed_log_feed_process($this->config['filename'], 'Skipping Product :: Product is not visible.');
812
  return true;
813
  }
828
  * @since 3.3.9
829
  *
830
  */
831
+ protected function exclude_current_attribute( $product, $merchant_attribute, $product_attribute, $feedType = 'xml' ) {
 
832
 
833
+ if ( empty($merchant_attribute) ) {
834
  return true;
835
  }
836
 
837
  if (
838
  in_array($this->config['provider'], array_keys($this->skipped_merchant_attributes)) &&
839
+ in_array($merchant_attribute, $this->skipped_merchant_attributes[ $this->config['provider'] ])
840
 
841
  ) {
842
  return true;
843
  }
844
 
845
+ if ( 'shopping_ads_excluded_country' !== $merchant_attribute && in_array($merchant_attribute, $this->processed_merchant_attributes) ) {
846
  return true;
847
  }
848
 
862
  * @see substr
863
  *
864
  */
865
+ protected function crop_string( $string, $start = 0, $limit = null ) {
 
866
  $limit = absint($limit);
867
+ if ( $limit > 0 ) {
868
  $start = absint($start);
869
+ if ( strpos($string, '<![CDATA[') !== false ) {
870
+ $string = str_replace(array( '<![CDATA[', ']]>' ), array( '', '' ), $string);
871
  $string = substr($string, $start, $limit);
872
  $string = '<![CDATA[' . $string . ']]>';
873
  } else {
885
  *
886
  * @since 3.2.0
887
  */
888
+ protected function process_for_merchant( $productObj, $index ) {
889
+ $product = $this->products[ $index ];
 
890
  $merchantAttributes = $this->config['mattributes'];
891
  $s = 0; // Shipping Index
892
  $i = 0; // Installment Index
907
 
908
  // Format Shipping and Tax data for CSV and TXT feed only for google and facebook
909
 
910
+ if ( 'xml' != $this->config['feedType'] && in_array($this->config['provider'], array( 'google', 'facebook', 'bing', 'snapchat', 'pinterest' )) ) {
911
+ foreach ( $merchantAttributes as $key => $value ) {
912
 
913
+ if ( ! in_array($value, $this->google_shipping_tax, true) ) {
914
  continue;
915
  }
916
 
917
  # Get value by attribute type with prefix & suffix
918
  $output = $this->process_for_merchant_get_value($productObj, $key);
919
 
920
+ if ( 'shipping_country' == $value ) {
921
  $s++;
922
  $shipping .= $output;
923
  }
924
+ if ( 'shipping_region' == $value ) {
925
  $shipping .= ':' . $output;
926
+ } elseif ( 'shipping_postal_code' == $value ) {
927
  $shipping .= ':' . $output;
928
  }
929
+ if ( 'shipping_service' == $value ) {
930
  $shipping .= ':' . $output;
931
  }
932
+ if ( 'shipping_price' == $value ) {
933
  $shipping .= ':' . $output;
934
  }
935
 
936
+ if ( 'section_name' == $value ) {
937
  $pd++;
938
  $product_detail .= $output;
939
  }
940
+ if ( 'attribute_name' == $value ) {
941
  $product_detail .= ':' . $output;
942
  }
943
+ if ( 'attribute_value' == $value ) {
944
  $product_detail .= ':' . $output;
945
  }
946
 
947
  //facebook nested attributes
948
+ if ( isset($this->config['provider']) && "facebook" === $this->config['provider'] ) {
949
+ if ( 'unit_price_value' == $value ) {
950
  $up++;
951
  $unit_price .= $output;
952
  }
953
+ if ( 'unit_price_currency' == $value ) {
954
  $unit_price .= ':' . $output;
955
  }
956
+ if ( 'unit_price_unit' == $value ) {
957
  $unit_price .= ':' . $output;
958
  }
959
 
960
+ if ( 'additional_variant_label' == $value ) {
961
  $av++;
962
  $additional_variant_attribute .= $output;
963
  }
964
+ if ( 'additional_variant_value' == $value ) {
965
  $additional_variant_attribute .= ':' . $output;
966
  }
967
 
968
+ if ( 0 < $up ) {
969
+ $this->products[ $this->pi ]["unit_price"] = $unit_price;
970
  }
971
 
972
+ if ( 0 < $av ) {
973
+ $this->products[ $this->pi ]["additional_variant_attribute"] = $additional_variant_attribute;
974
  }
975
  }
976
 
977
 
978
+ if ( 'installment_months' == $value ) {
979
  $ins++;
980
  $installment .= $output;
981
  }
982
+ if ( 'installment_amount' == $value ) {
983
  $installment .= ':' . $output;
984
  }
985
 
986
+ if ( 'subscription_period' == $value ) {
987
  $sub++;
988
  $subscription .= $output;
989
  }
990
+ if ( 'subscription_period_length' == $value ) {
991
  $subscription .= ':' . $output;
992
  }
993
+ if ( 'subscription_amount' == $value ) {
994
  $subscription .= ':' . $output;
995
  }
996
  }
997
 
998
+ if ( 0 < $pd ) {
999
+ $this->products[ $this->pi ]["product detail"] = $product_detail;
1000
  }
1001
 
1002
+ if ( 0 < $sub ) {
1003
+ $this->products[ $this->pi ]["subscription cost"] = $subscription;
1004
 
1005
  }
1006
 
1007
+ if ( 0 < $ins ) {
1008
+ $this->products[ $this->pi ]["installment"] = $installment;
1009
  }
1010
  }
1011
 
1012
 
1013
+ if ( in_array($this->config['provider'], array( 'google', 'facebook', 'snapchat', 'bing', 'pinterest' )) ) {
1014
 
1015
 
1016
  // Reformat Shipping attributes for google, facebook
1017
+ if ( 'xml' == $this->config['feedType'] ) {
1018
+ foreach ( $merchantAttributes as $key => $value ) {
1019
 
1020
+ if ( ! in_array($value, $this->google_shipping_tax) ) {
1021
  continue;
1022
  }
1023
 
1026
  $output = $this->process_for_merchant_get_value($productObj, $key);
1027
 
1028
 
1029
+ if ( 'shipping_country' == $value ) {
1030
+ if ( 0 == $s ) {
1031
  $shipping .= '<g:shipping>';
1032
  $s = 1;
1033
  } else {
1034
  $shipping .= '</g:shipping>' . "\n";
1035
  $shipping .= '<g:shipping>';
1036
  }
1037
+ } elseif ( ! in_array('shipping_country', $merchantAttributes) && 'shipping_price' == $value ) {
1038
+ if ( 0 == $s ) {
1039
  $shipping .= '<g:shipping>';
1040
  $s = 1;
1041
  } else {
1044
  }
1045
  }
1046
 
1047
+ if ( 'shipping_country' == $value ) {
1048
  $shipping .= '<g:country>' . $output . '</g:country>' . "\n";
1049
+ } elseif ( 'shipping_region' == $value ) {
1050
  $shipping .= '<g:region>' . $output . '</g:region>' . "\n";
1051
+ } elseif ( 'shipping_region' == $value ) {
1052
  $shipping .= '<g:region>' . $output . '</g:region>' . "\n";
1053
+ } elseif ( 'shipping_service' == $value ) {
1054
  $shipping .= '<g:service>' . $output . '</g:service>' . "\n";
1055
+ } elseif ( 'shipping_postal_code' == $value ) {
1056
  $shipping .= '<g:postal_code>' . $output . '</g:postal_code>' . "\n";
1057
+ } elseif ( 'shipping_price' == $value ) {
1058
  $shipping .= '<g:price>' . $output . '</g:price>' . "\n";
1059
+ } elseif ( 'tax_country' == $value ) {
1060
+ if ( 0 == $t ) {
1061
  $tax .= '<g:tax>';
1062
  $t = 1;
1063
  } else {
1065
  $tax .= '<g:tax>';
1066
  }
1067
  $tax .= '<g:country>' . $output . '</g:country>' . "\n";
1068
+ } elseif ( 'tax_region' == $value ) {
1069
  $tax .= '<g:region>' . $output . '</g:region>' . "\n";
1070
+ } elseif ( 'tax_rate' == $value ) {
1071
  $tax .= '<g:rate>' . $output . '</g:rate>' . "\n";
1072
+ } elseif ( 'tax_ship' == $value ) {
1073
  $tax .= '<g:tax_ship>' . $output . '</g:tax_ship>' . "\n";
1074
+ } elseif ( 'subscription_period' == $value ) {
1075
+ if ( 0 == $sub ) {
1076
  $subscription .= '<g:subscription_cost>';
1077
  $sub = 1;
1078
  } else {
1080
  $subscription .= '<g:subscription_cost>';
1081
  }
1082
  $subscription .= '<g:period>' . $output . '</g:period>' . "\n";
1083
+ } elseif ( 'subscription_period_length' == $value ) {
1084
  $subscription .= '<g:period_length>' . $output . '</g:period_length>' . "\n";
1085
+ } elseif ( 'subscription_amount' == $value ) {
1086
  $subscription .= '<g:amount>' . $output . '</g:amount>' . "\n";
1087
  }
1088
 
1089
+ if ( 'section_name' == $value ) {
1090
+ if ( 0 == $pd ) {
1091
  $product_detail .= '<g:product_detail>';
1092
  $pd = 1;
1093
  } else {
1094
  $product_detail .= '</g:product_detail>' . "\n";
1095
  $product_detail .= '<g:product_detail>';
1096
  }
1097
+ } elseif ( ! in_array('section_name', $merchantAttributes) && 'attribute_name' == $value ) {
1098
+ if ( 0 == $pd ) {
1099
  $product_detail .= '<g:product_detail>';
1100
  $pd = 1;
1101
  } else {
1104
  }
1105
  }
1106
 
1107
+ if ( 'section_name' == $value ) {
1108
  $product_detail .= '<g:section_name>' . $output . '</g:section_name>' . "\n";
1109
+ } elseif ( 'attribute_name' == $value ) {
1110
  $product_detail .= '<g:attribute_name>' . $output . '</g:attribute_name>' . "\n";
1111
+ } elseif ( 'attribute_value' == $value ) {
1112
  $product_detail .= '<g:attribute_value>' . $output . '</g:attribute_value>' . "\n";
1113
  }
1114
 
1115
+ if ( isset($this->config['provider']) && "facebook" === $this->config['provider'] ) {
1116
 
1117
  // unit_price configure
1118
+ if ( 'unit_price_value' == $value ) {
1119
+ if ( 0 == $up ) {
1120
  $unit_price .= '<unit_price>';
1121
  $up = 1;
1122
  } else {
1123
  $unit_price .= '</unit_price>' . "\n";
1124
  $unit_price .= '<unit_price>';
1125
  }
1126
+ } elseif ( ! in_array('unit_price_value', $merchantAttributes) && 'unit_price_currency' == $value ) {
1127
+ if ( 0 == $up ) {
1128
  $unit_price .= '<unit_price>';
1129
  $up = 1;
1130
  } else {
1133
  }
1134
  }
1135
 
1136
+ if ( 'unit_price_value' == $value ) {
1137
  $unit_price .= '<value>' . $output . '</value>' . "\n";
1138
+ } elseif ( 'unit_price_currency' == $value ) {
1139
  $unit_price .= '<currency>' . $output . '</currency>' . "\n";
1140
+ } elseif ( 'unit_price_unit' == $value ) {
1141
  $unit_price .= '<unit>' . $output . '</unit>' . "\n";
1142
  }
1143
 
1144
  // additional_variant_attribute configure
1145
+ if ( 'additional_variant_label' == $value ) {
1146
+ if ( 0 == $av ) {
1147
  $additional_variant_attribute .= '<additional_variant_attribute>';
1148
  $av = 1;
1149
  } else {
1150
  $additional_variant_attribute .= '</additional_variant_attribute>' . "\n";
1151
  $additional_variant_attribute .= '<additional_variant_attribute>';
1152
  }
1153
+ } elseif ( ! in_array('additional_variant_label', $merchantAttributes) && 'additional_variant_value' == $value ) {
1154
+ if ( 0 == $av ) {
1155
  $additional_variant_attribute .= '<additional_variant_attribute>';
1156
  $av = 1;
1157
  } else {
1160
  }
1161
  }
1162
 
1163
+ if ( 'additional_variant_label' == $value ) {
1164
  $additional_variant_attribute .= '<label>' . $output . '</label>' . "\n";
1165
+ } elseif ( 'additional_variant_value' == $value ) {
1166
  $additional_variant_attribute .= '<value>' . $output . '</value>' . "\n";
1167
+ }
1168
+ }
 
1169
 
1170
 
1171
+ if ( 'installment_months' === $value ) {
1172
+ if ( 0 == $ins ) {
1173
  $installment .= '<g:installment>';
1174
  $ins = 1;
1175
  } else {
1177
  $installment .= '<g:installment>';
1178
  }
1179
  $installment .= '<g:months>' . $output . '</g:months>' . "\n";
1180
+ } elseif ( 'installment_amount' == $value ) {
1181
  $installment .= '<g:amount>' . $output . '</g:amount>' . "\n";
1182
  }
1183
  }
1184
 
1185
+ if ( 1 == $pd ) {
1186
  $product_detail .= '</g:product_detail>';
1187
  }
1188
 
1189
+ if ( isset($this->config['provider']) && "facebook" === $this->config['provider'] ) {
1190
+ if ( 1 == $up ) {
1191
  $unit_price .= '</unit_price>';
1192
  }
1193
 
1194
+ if ( 1 == $av ) {
1195
  $additional_variant_attribute .= '</additional_variant_attribute>';
1196
  }
1197
 
1199
  $this->feedBody .= $additional_variant_attribute;
1200
  }
1201
 
1202
+ if ( 1 == $s ) {
1203
  $shipping .= '</g:shipping>';
1204
  }
1205
+ if ( 1 == $t ) {
1206
  $tax .= '</g:tax>';
1207
  }
1208
 
1209
+ if ( 1 == $sub ) {
1210
  $subscription .= '</g:subscription_cost>';
1211
  }
1212
 
1213
+ if ( 1 == $ins ) {
1214
  $installment .= '</g:installment>';
1215
  }
1216
 
1219
  $this->feedBody .= $product_detail;
1220
  $this->feedBody .= $installment;
1221
 
1222
+ if ( $productObj->is_type('subscription') ||
1223
  $productObj->is_type('variable-subscription') ||
1224
+ $productObj->is_type('subscription_variation') ) {
1225
  $this->feedBody .= $subscription;
1226
  }
1227
  }
1228
  // ADD g:identifier_exists
1229
+ $identifier = array( 'brand', 'upc', 'sku', 'mpn', 'gtin' );
1230
  $countIdentifier = 0;
1231
+ if ( ! in_array('identifier_exists', $merchantAttributes) ) {
1232
+ if ( count(array_intersect_key(array_flip($identifier), $product)) >= 2 ) {
1233
  // Any 2 required keys exist!
1234
  // @TODO Refactor with OR
1235
+ if ( array_key_exists('brand', $product) && ! empty($product['brand']) ) {
1236
  $countIdentifier++;
1237
  }
1238
+ if ( array_key_exists('upc', $product) && ! empty($product['upc']) ) {
1239
  $countIdentifier++;
1240
  }
1241
+ if ( array_key_exists('sku', $product) && ! empty($product['sku']) ) {
1242
  $countIdentifier++;
1243
  }
1244
+ if ( array_key_exists('mpn', $product) && ! empty($product['mpn']) ) {
1245
  $countIdentifier++;
1246
  }
1247
+ if ( array_key_exists('gtin', $product) && ! empty($product['gtin']) ) {
1248
  $countIdentifier++;
1249
  }
1250
  }
1251
 
1252
+ if ( 'xml' == $this->config['feedType'] ) {
1253
+ if ( $countIdentifier >= 2 ) {
1254
  $this->feedBody .= '<g:identifier_exists>yes</g:identifier_exists>';
1255
  } else {
1256
  $this->feedBody .= '<g:identifier_exists>no</g:identifier_exists>';
1257
  }
1258
  } else {
1259
  $identifier_exists = 'identifier exists';
1260
+ if ( in_array($this->config['provider'], array( 'bing', 'pinterest' )) ) {
1261
  $identifier_exists = 'identifier_exists';
1262
  }
1263
 
1264
+ if ( $countIdentifier >= 2 ) {
1265
+ $this->products[ $this->pi ][ $identifier_exists ] = 'yes';
1266
  } else {
1267
+ $this->products[ $this->pi ][ $identifier_exists ] = 'no';
1268
  }
1269
  }
1270
  }
1271
  }
1272
  }
1273
 
1274
+ private function process_for_merchant_get_value( $productObj, $key ) {
1275
+ $prefix = $this->config['prefix'][ $key ];
1276
+ $suffix = $this->config['suffix'][ $key ];
1277
+ $attribute = $this->config['attributes'][ $key ];
1278
+ $merchant_attribute = $this->config['mattributes'][ $key ];
 
1279
 
1280
+ if ( 'pattern' == $this->config['type'][ $key ] ) {// Get Pattern value.
1281
+ $output = $this->config['default'][ $key ];
1282
  $output = $this->apply_filters_to_attribute_value($output, $productObj, $attribute, $merchant_attribute);
1283
  } else {
1284
  $output = $this->getAttributeValueByType($productObj, $attribute, $merchant_attribute);
1295
  * Get Query Type Settings
1296
  * @return string
1297
  */
1298
+ public function get_query_type() {
 
1299
  return $this->queryType;
1300
  }
1301
 
1302
+ public function get_product_types() {
 
1303
  return $this->product_types;
1304
  }
1305
 
1310
  * @since 3.2.0
1311
  *
1312
  */
1313
+ protected function process_txt_feed_header() {
 
1314
  // Set Delimiter
1315
+ if ( 'tab' == $this->config['delimiter'] ) {
1316
  $this->delimiter = "\t";
1317
  } else {
1318
  $this->delimiter = $this->config['delimiter'];
1319
  }
1320
 
1321
  // Set Enclosure
1322
+ if ( ! empty($this->config['enclosure']) ) {
1323
  $this->enclosure = $this->config['enclosure'];
1324
+ if ( 'double' == $this->enclosure ) {
1325
  $this->enclosure = '"';
1326
+ } elseif ( 'single' == $this->enclosure ) {
1327
  $this->enclosure = "'";
1328
  } else {
1329
  $this->enclosure = '';
1333
  }
1334
 
1335
  $eol = PHP_EOL;
1336
+ if ( 'trovaprezzi' === $this->config['provider'] ) {
1337
  $eol = '<endrecord>' . PHP_EOL;
1338
  }
1339
 
1340
+ $product = $this->products[ $this->pi ];
1341
 
1342
  $headers = array_keys($product);
1343
 
1344
  $this->feedHeader .= $this->enclosure . implode("$this->enclosure$this->delimiter$this->enclosure", $headers) . $this->enclosure . $eol;
1345
 
1346
+ if ( 'google' === $this->config['provider'] ) {
1347
  $this->feedHeader = str_replace($this->google_product_highlights, 'product highlight', $this->feedHeader);
1348
  $this->feedHeader = str_replace($this->google_additional_image, 'additional image link', $this->feedHeader);
1349
  }
1358
  * @since 3.2.0
1359
  *
1360
  */
1361
+ protected function process_txt_feed_body() {
1362
+ $productInfo = array_values($this->products[ $this->pi ]);
 
1363
  $eol = PHP_EOL;
1364
+ if ( 'trovaprezzi' === $this->config['provider'] ) {
1365
  $eol = '<endrecord>' . PHP_EOL;
1366
  }
1367
  $this->feedBody .= $this->enclosure . implode("$this->enclosure$this->delimiter$this->enclosure", $productInfo) . $this->enclosure . $eol;
1376
  * @since 3.2.0
1377
  *
1378
  */
1379
+ protected function process_csv_feed_header() {
 
1380
  // Set Delimiter
1381
+ if ( 'tab' == $this->config['delimiter'] ) {
1382
  $this->delimiter = "\t";
1383
  } else {
1384
  $this->delimiter = $this->config['delimiter'];
1385
  }
1386
 
1387
  // Set Enclosure
1388
+ if ( ! empty($this->config['enclosure']) ) {
1389
  $this->enclosure = $this->config['enclosure'];
1390
+ if ( 'double' == $this->enclosure ) {
1391
  $this->enclosure = '"';
1392
+ } elseif ( 'single' == $this->enclosure ) {
1393
  $this->enclosure = "'";
1394
  } else {
1395
  $this->enclosure = '';
1398
  $this->enclosure = '';
1399
  }
1400
 
1401
+ $product = $this->products[ $this->pi ];
1402
 
1403
  $this->feedHeader = array_keys($product);
1404
 
1405
+ if ( 'google' === $this->config['provider'] ) {
1406
  $this->feedHeader = str_replace($this->google_product_highlights, 'product highlight', $this->feedHeader);
1407
  $this->feedHeader = str_replace($this->google_additional_image, 'additional image link', $this->feedHeader);
1408
  }
1415
  * @return array
1416
  * @since 3.2.0
1417
  */
1418
+ protected function process_csv_feed_body() {
1419
+ $product = $this->products[ $this->pi ];
 
1420
  $this->feedBody[] = array_values($product);
1421
 
1422
  return $this->feedBody;
1423
  }
1424
 
1425
  protected function process_json_feed_body(){
1426
+ $product = $this->products[ $this->pi ];
1427
  $this->feedBody[] = $product;
1428
 
1429
  return $this->feedBody;
1430
  }
1431
 
1432
+ protected function process_xml_wrapper() {
 
1433
  $itemsWrapperClose = explode(' ', $this->config['itemsWrapper']);
1434
  $itemsWrapperClose = $itemsWrapperClose[0];
1435
  $this->xml_wrapper = [
1439
  $this->config['itemWrapper'] = str_replace(' ', '_', $this->config['itemWrapper']);
1440
  $this->config['itemsWrapper'] = str_replace(' ', '_', $this->config['itemsWrapper']);
1441
 
1442
+ if ( file_exists(WOO_FEED_FREE_ADMIN_PATH . 'partials/templates/' . $this->config['provider'] . '.txt') ) {
1443
  $txt = file_get_contents(WOO_FEED_FREE_ADMIN_PATH . 'partials/templates/' . $this->config['provider'] . '.txt');
1444
  $txt = trim($txt);
1445
  $txt = explode('{separator}', $txt);
1446
+ if ( 2 === count($txt) ) {
1447
  $this->xml_wrapper['header'] = trim($txt[0]);
1448
  $this->xml_wrapper['footer'] = "\n".trim($txt[1]);
1449
  }
1450
  }
1451
 
1452
+ if ( ! empty($this->config['extraHeader']) ) {
1453
  $this->xml_wrapper['header'] .= PHP_EOL . $this->config['extraHeader'];
1454
  }
1455
 
1456
  // replace template variables.
1457
  $datetime_now = date('Y-m-d H:i:s', strtotime(current_time('mysql'))); // {DateTimeNow}
1458
+ if ( 'pinterest_rss' === $this->config['provider'] ) { // DATE_RFC822 date format for pinterest rss feed
1459
  $datetime_now = date('r', strtotime(current_time('mysql'))); // {DateTimeNow}
1460
  }
1461
  $blog_name = get_bloginfo('name'); // {BlogName}
1465
  $blog_email = get_bloginfo('admin_email'); // {BlogEmail}
1466
 
1467
  $this->xml_wrapper['header'] = str_replace(
1468
+ [ '{DateTimeNow}', '{BlogName}', '{BlogURL}', '{BlogDescription}', '{BlogEmail}' ],
1469
+ [ $datetime_now, $blog_name, $blog_url, $blog_desc, $blog_email ],
1470
  $this->xml_wrapper['header']
1471
  );
1472
  }
1476
  * @return string
1477
  * @since 3.2.0
1478
  */
1479
+ protected function process_xml_feed_header() {
 
1480
  return $this->xml_wrapper['header'];
1481
  }
1482
 
1485
  * @return string
1486
  * @since 3.2.0
1487
  */
1488
+ protected function process_xml_feed_footer() {
 
1489
  return $this->xml_wrapper['footer'];
1490
  }
1491
 
1498
  * @since 3.2.0
1499
  *
1500
  */
1501
+ protected function processStringForTXT( $string ) {
1502
+ if ( ! empty($string) ) {
 
1503
  $string = html_entity_decode($string, ENT_HTML401 | ENT_QUOTES); // Convert any HTML entities
1504
 
1505
+ if ( stristr($string, '"') ) {
1506
  $string = str_replace('"', '""', $string);
1507
  }
1508
  $string = str_replace("\n", ' ', $string);
1512
  $string = stripslashes($string);
1513
 
1514
  return $string;
1515
+ } elseif ( '0' == $string ) {
1516
  return '0';
1517
  } else {
1518
  return '';
1528
  * @since 3.2.0
1529
  *
1530
  */
1531
+ protected function processStringForCSV( $string ) {
1532
+ if ( ! empty($string) ) {
 
1533
  $string = str_replace("\n", ' ', $string);
1534
  $string = str_replace("\r", ' ', $string);
1535
  $string = trim($string);
1536
  $string = stripslashes($string);
1537
 
1538
  return $string;
1539
+ } elseif ( '0' == $string ) {
1540
  return '0';
1541
  } else {
1542
  return '';
1553
  * @since 3.2.0
1554
  *
1555
  */
1556
+ public function getAttributeValueByType( $product, $attribute, $merchant_attribute = '' ) {
 
1557
 
1558
+ if ( method_exists($this, $attribute) ) {
1559
  $output = $this->$attribute($product);
1560
+ } elseif ( false !== strpos($attribute, self::PRODUCT_CUSTOM_IDENTIFIER) || woo_feed_strpos_array(array( '_identifier_gtin', '_identifier_ean', '_identifier_mpn' ), $attribute) ) {
1561
  $output = $this->getCustomField($product, $attribute);
1562
+ } elseif ( false !== strpos($attribute, self::PRODUCT_ATTRIBUTE_PREFIX) ) {
1563
  $attribute = str_replace(self::PRODUCT_ATTRIBUTE_PREFIX, '', $attribute);
1564
  $output = $this->getProductAttribute($product, $attribute);
1565
+ } elseif ( false !== strpos($attribute, self::POST_META_PREFIX) ) {
1566
  $attribute = str_replace(self::POST_META_PREFIX, '', $attribute);
1567
  $output = $this->getProductMeta($product, $attribute);
1568
+ } elseif ( false !== strpos($attribute, self::PRODUCT_TAXONOMY_PREFIX) ) {
1569
  $attribute = str_replace(self::PRODUCT_TAXONOMY_PREFIX, '', $attribute);
1570
  $output = $this->getProductTaxonomy($product, $attribute);
1571
+ } elseif ( false !== strpos($attribute, self::PRODUCT_CATEGORY_MAPPING_PREFIX) ) {
1572
  $id = $product->is_type('variation') ? $product->get_parent_id() : $product->get_id();
1573
  $output = woo_feed_get_category_mapping_value($attribute, $id);
1574
+ } elseif ( false !== strpos($attribute, self::WP_OPTION_PREFIX) ) {
1575
  $optionName = str_replace(self::WP_OPTION_PREFIX, '', $attribute);
1576
  $output = get_option($optionName);
1577
+ } elseif ( 'image_' == substr($attribute, 0, 6) ) {
1578
  // For additional image method images() will be used with extra parameter - image number
1579
  $imageKey = explode('_', $attribute);
1580
+ if ( ! isset($imageKey[1]) || (isset($imageKey[1]) && (empty($imageKey[1]) || ! is_numeric($imageKey[1]))) ) {
1581
  $imageKey[1] = '';
1582
  }
1583
+ $output = call_user_func_array(array( $this, 'images' ), array( $product, $imageKey[1] ));
1584
  } else {
1585
  // return the attribute so multiple attribute can be join with separator to make custom attribute.
1586
  $output = $attribute;
1587
  }
1588
 
1589
  // Json encode if value is an array
1590
+ if ( is_array($output) ) {
1591
  $output = wp_json_encode($output);
1592
  }
1593
 
1606
  *
1607
  * @return mixed|void
1608
  */
1609
+ protected function apply_filters_to_attribute_value( $output, $product, $attribute, $merchant_attribute ) {
 
1610
  /**
1611
  * Filter attribute value
1612
  *
1655
  * @return mixed
1656
  * @since 3.2.0
1657
  */
1658
+ protected function id( $product ) {
 
1659
  $id = $product->get_id();
1660
 
1661
  return apply_filters('woo_feed_filter_product_id', $id, $product, $this->config);
1670
  * @since 3.2.0
1671
  *
1672
  */
1673
+ protected function title( $product ) {
 
1674
  $title = woo_feed_strip_all_tags($this->remove_short_codes($product->get_name()));
1675
 
1676
  // Add all available variation attributes to variation title.
1677
+ if ( $product->is_type('variation') && ! empty($product->get_attributes()) ) {
1678
  $title = $this->parent_title($product);
1679
  $attributes = [];
1680
+ foreach ( $product->get_attributes() as $slug => $value ) {
1681
  $attribute = $product->get_attribute($slug);
1682
+ if ( empty($attribute) ) {
1683
  continue;
1684
  }
1685
+ $attributes[ $slug ] = $attribute;
1686
  }
1687
 
1688
  // set variation attributes with separator
1689
+ if ( isset($this->config['provider']) && 'google' === $this->config['provider'] ) {
1690
  $variation_attributes = implode(' - ', $attributes);
1691
  } else {
1692
  $variation_attributes = implode(', ', $attributes);
1695
  //get product title with variation attribute
1696
  $get_with_var_attributes = apply_filters("woo_feed_get_product_title_with_variation_attribute", true, $product, $this->config);
1697
 
1698
+ if ( $get_with_var_attributes ) {
1699
  $title .= " - " . $variation_attributes;
1700
  }
1701
  }
1712
  * @author Nazrul Islam Nayan
1713
  * @since 5.1.8
1714
  */
1715
+ protected function parent_title( $product ) {
1716
+ if ( $product->is_type('variation') ) {
 
1717
  $product = wc_get_product($product->get_parent_id());
1718
  $title = woo_feed_strip_all_tags($this->remove_short_codes($product->get_name()));
1719
  } else {
1731
  * @return mixed
1732
  * @since 4.4.12
1733
  */
1734
+ protected function _aioseop_canonical_url( $product ) {
 
1735
  $aioseop_canonical_url = '';
1736
+ if ( is_plugin_active('all-in-one-seo-pack/all_in_one_seo_pack.php') && class_exists('AIOSEO\Plugin\Common\Models\Post') ) {
1737
  $post = AIOSEO\Plugin\Common\Models\Post::getPost($product->get_id());
1738
  $aioseop_canonical_url = $post->canonical_url;
1739
  }
1750
  * @since 3.2.0
1751
  *
1752
  */
1753
+ protected function yoast_wpseo_title( $product ) {
 
1754
  $product_id = woo_feed_parent_product_id($product);
1755
  $yoast_title = get_post_meta($product_id, '_yoast_wpseo_title', true);
1756
+ if ( strpos($yoast_title, '%%') !== false ) {
1757
  $title = strstr($yoast_title, '%%', true);
1758
+ if ( empty($title) ) {
1759
  $title = get_the_title($product_id);
1760
  }
1761
  $wpseo_titles = get_option('wpseo_titles');
1762
 
1763
  $sep_options = WPSEO_Option_Titles::get_instance()->get_separator_options();
1764
+ if ( isset($wpseo_titles['separator']) && isset($sep_options[ $wpseo_titles['separator'] ]) ) {
1765
+ $sep = $sep_options[ $wpseo_titles['separator'] ];
1766
  } else {
1767
  $sep = '-'; //setting default separator if Admin didn't set it from backed
1768
  }
1771
 
1772
  $meta_title = $title . ' ' . $sep . ' ' . $site_title;
1773
 
1774
+ if ( ! empty($meta_title) ) {
1775
  $title = $meta_title;
1776
  }
1777
+ } elseif ( ! empty($yoast_title) ) {
1778
  $title = $yoast_title;
1779
  } else {
1780
  $title = $this->title($product);
1791
  * @return mixed
1792
  * @since 4.3.77
1793
  */
1794
+ protected function yoast_canonical_url( $product ) {
 
1795
  $product_id = woo_feed_parent_product_id($product);
1796
  $yoast_canonical_url = get_post_meta($product_id, '_yoast_wpseo_canonical', true);
1797
 
1806
  * @return mixed
1807
  * @since 5.1.3
1808
  */
1809
+ protected function rank_math_title( $product ) {
 
1810
  $rank_title = '';
1811
  $post_title = '';
1812
  $page = '';
1813
  $sep = '';
1814
  $sitemap = '';
1815
+ if ( class_exists('RankMath') ) {
1816
  $title = get_post_meta($product->get_id(), 'rank_math_title', true);
1817
+ if ( empty($title) ) {
1818
  $title_format = Helper::get_settings("titles.pt_product_title");
1819
  $title_format = $title_format ? $title_format : '%title%';
1820
  $sep = Helper::get_settings('titles.title_separator');
1839
  * @return mixed
1840
  * @since 5.1.3
1841
  */
1842
+ protected function rank_math_description( $product ) {
 
1843
  $description = '';
1844
+ if ( class_exists('RankMath') ) {
1845
  $description = get_post_meta($product->get_id(), 'rank_math_description');
1846
  $desc_format = Helper::get_settings("titles.pt_post_description");
1847
 
1848
+ if ( empty($description) ) {
1849
+ if ( ! empty($desc_format) && strpos( (string)$desc_format, 'excerpt') !== false ) {
1850
  $description = str_replace('%excerpt%', get_the_excerpt($product->get_id()), $desc_format);
1851
  }
1852
 
1853
  // Get Variation Description
1854
+ if ( $product->is_type('variation') && empty($description) ) {
1855
  $parent = wc_get_product($product->get_parent_id());
1856
  $description = $parent->get_description();
1857
  }
1858
  }
1859
 
1860
+ if ( is_array($description) ) {
1861
  $description = reset($description);
1862
  }
1863
 
1866
  //strip tags and spacial characters
1867
  $strip_description = woo_feed_strip_all_tags(wp_specialchars_decode($description));
1868
 
1869
+ $description = ! empty(strlen($strip_description)) && 0 < strlen($strip_description) ? $strip_description : $description;
1870
  }
1871
 
1872
  return apply_filters('woo_feed_filter_product_rank_math_description', $description, $product, $this->config);
1880
  * @return mixed
1881
  * @since 5.1.6
1882
  */
1883
+ protected function rank_math_canonical_url( $product ) {
 
1884
  $canonical_url = '';
1885
 
1886
+ if ( class_exists('RankMath') ) {
1887
  $post_canonical_url = get_post_meta($product->get_id(), 'rank_math_canonical_url');
1888
 
1889
+ if ( empty($post_canonical_url) ) {
1890
  $canonical_url = get_the_permalink($product->get_id());
1891
  } else {
1892
  $canonical_url = $post_canonical_url;
1893
  }
1894
 
1895
+ if ( is_array($canonical_url) ) {
1896
  $canonical_url = reset($canonical_url);
1897
  }
1898
  }
1910
  * @since 3.2.0
1911
  *
1912
  */
1913
+ protected function _aioseop_title( $product ) {
 
1914
  $title = '';
1915
+ if ( is_plugin_active('all-in-one-seo-pack/all_in_one_seo_pack.php') && class_exists('AIOSEO\Plugin\Common\Models\Post') ) {
1916
 
1917
  $post = AIOSEO\Plugin\Common\Models\Post::getPost($product->get_id());
1918
+ $title = ! empty($post->title) ? $post->title : aioseo()->meta->title->getPostTypeTitle('product');
1919
  }
1920
 
1921
+ $title = ! empty($title) ? $title : $this->title($product);
1922
 
1923
  return apply_filters('woo_feed_filter_product_aioseop_title', $title, $product, $this->config);
1924
  }
1932
  * @since 3.2.0
1933
  *
1934
  */
1935
+ protected function description( $product ) {
 
1936
  $description = $product->get_description();
1937
 
1938
  // Get Variation Description
1939
+ if ( $product->is_type('variation') && empty($description) ) {
1940
  $parent = wc_get_product($product->get_parent_id());
1941
 
1942
+ if ( is_object($parent) ) {
1943
  $description = $parent->get_description();
1944
  } else {
1945
  $description = '';
1948
  $description = $this->remove_short_codes($description);
1949
 
1950
  // Add variations attributes after description to prevent Facebook error
1951
+ if ( 'facebook' == $this->config['provider'] && $product->is_type('variation') ) {
1952
  $variationInfo = explode('-', $product->get_name());
1953
+ if ( isset($variationInfo[1]) ) {
1954
  $extension = $variationInfo[1];
1955
  } else {
1956
  $extension = $product->get_id();
1961
  //strip tags and spacial characters
1962
  $strip_description = woo_feed_strip_all_tags(wp_specialchars_decode($description));
1963
 
1964
+ $description = ! empty(strlen($strip_description)) && 0 < strlen($strip_description) ? $strip_description : $description;
1965
 
1966
  return apply_filters('woo_feed_filter_product_description', $description, $product, $this->config);
1967
  }
1974
  * @return mixed|string
1975
  * @since 5.2.41
1976
  */
1977
+ protected function description_with_html( $product ) {
 
1978
  $description = $product->get_description();
1979
 
1980
  // Get Variation Description
1981
+ if ( $product->is_type('variation') && empty($description) ) {
1982
  $parent = wc_get_product($product->get_parent_id());
1983
  $description = $parent->get_description();
1984
  }
1985
  $description = $this->remove_short_codes($description);
1986
 
1987
  // Add variations attributes after description to prevent Facebook error
1988
+ if ( 'facebook' === $this->config['provider'] && $product->is_type('variation') ) {
1989
  $variationInfo = explode('-', $product->get_name());
1990
+ if ( isset($variationInfo[1]) ) {
1991
  $extension = $variationInfo[1];
1992
  } else {
1993
  $extension = $product->get_id();
2010
  * @since 3.2.0
2011
  *
2012
  */
2013
+ protected function yoast_wpseo_metadesc( $product ) {
 
2014
  $product_id = woo_feed_parent_product_id($product);
2015
  $description = '';
2016
+ if ( class_exists('WPSEO_Frontend') ) {
2017
  $description = wpseo_replace_vars(WPSEO_Meta::get_value('metadesc', $product_id),
2018
  get_post($product->get_id()));
2019
  } else {
2020
  $description = YoastSEO()->meta->for_post($product_id)->description;
2021
  }
2022
 
2023
+ if ( empty($description) ) {
2024
  $description = $this->description($product);
2025
  }
2026
 
2036
  * @since 3.2.0
2037
  *
2038
  */
2039
+ protected function _aioseop_description( $product ) {
 
2040
  $description = '';
2041
 
2042
+ if ( is_plugin_active('all-in-one-seo-pack/all_in_one_seo_pack.php') && class_exists('AIOSEO\Plugin\Common\Models\Post') ) {
2043
 
2044
  $post = AIOSEO\Plugin\Common\Models\Post::getPost($product->get_id());
2045
+ $description = ! empty($post->description) ? $post->description : aioseo()->meta->description->getPostTypeDescription('product');
2046
  }
2047
 
2048
+ if ( empty($description) ) {
2049
  $description = $this->description($product);
2050
  }
2051
 
2061
  * @since 3.2.0
2062
  *
2063
  */
2064
+ protected function short_description( $product ) {
 
2065
  $short_description = $product->get_short_description();
2066
 
2067
  // Get Variation Short Description
2068
+ if ( $product->is_type('variation') && empty($short_description) ) {
2069
  $parent = wc_get_product($product->get_parent_id());
2070
  $short_description = $parent->get_short_description();
2071
  }
2089
  * @since 3.2.0
2090
  *
2091
  */
2092
+ protected function remove_short_codes( $content ) {
2093
+ if ( $content == '' ) {
 
2094
  return '';
2095
  }
2096
 
2114
  * @return WP_Term
2115
  * @since 4.4.19
2116
  * */
2117
+ protected function product_parent_category_object( $product ) {
 
2118
  global $parent_category_memo;
2119
+ if ( empty( $parent_category_memo ) ) {
2120
  $parent_category_memo = [];
2121
  }
2122
 
2123
  $id = $product->get_id();
2124
+ if ( $product->is_type('variation') ) {
2125
  $id = $product->get_parent_id();
2126
  }
2127
 
2132
  $parent_category = '';
2133
 
2134
  // Memoization for faster parent retrieval
2135
+ if (
2136
  isset( $parent_category_memo[ $child_category->term_id ] )
2137
+ && ! empty( $parent_category_memo[ $child_category->term_id ] )
2138
+ ) {
2139
  $parent_category = get_term_by( 'term_id', $parent_category_memo[ $child_category->term_id ], $taxonomy );
2140
  } else {
2141
  $parent_category = woo_feed_parent_category( $child_category, $taxonomy );
2143
  }
2144
 
2145
  // Yoast SEO primary term fetching
2146
+ if ( class_exists( 'WPSEO_Primary_Term' ) ) {
2147
  $wpseo_primary_term = new WPSEO_Primary_Term( $taxonomy, $id );
2148
  $parent_category_id = $wpseo_primary_term->get_primary_term();
2149
+ if ( ! empty( $parent_category_id ) ) {
2150
  $parent_category = get_term_by( 'term_id', $parent_category_id, $taxonomy );
2151
  }
2152
  }
2162
  * @return string
2163
  *
2164
  */
2165
+ protected function primary_category( $product ) {
2166
+ $parent_category = "";
 
2167
  $separator = apply_filters('woo_feed_product_type_separator', ' > ', $this->config, $product);
2168
  $full_category = $this->product_type( $product );
2169
+ if ( ! empty($full_category) ) {
2170
  $full_category_array = explode($separator,$full_category);
2171
  $parent_category = $full_category_array[0];
2172
  }
2182
  * @return string
2183
  *
2184
  */
2185
+ protected function primary_category_id( $product ) {
2186
+ $parent_category_id = "";
 
2187
  $separator = apply_filters('woo_feed_product_type_separator', ' > ', $this->config, $product);
2188
  $full_category = $this->product_type( $product );
2189
+ if ( ! empty($full_category) ) {
2190
  $full_category_array = explode($separator,$full_category);
2191
+ $parent_category_obj = get_term_by( 'name', $full_category_array[0], 'product_cat' );
2192
+ $parent_category_id = isset($parent_category_obj->term_id) ? $parent_category_obj->term_id : "";
2193
  }
2194
 
2195
  return apply_filters('woo_feed_filter_product_primary_category_id', $parent_category_id, $product, $this->config);
2202
  *
2203
  * @return string
2204
  */
2205
+ protected function child_category( $product ) {
2206
+ $child_category = "";
 
2207
  $separator = apply_filters('woo_feed_product_type_separator', ' > ', $this->config, $product);
2208
  $full_category = $this->product_type( $product );
2209
+ if ( ! empty($full_category) ) {
2210
  $full_category_array = explode($separator,$full_category);
2211
  $child_category = end($full_category_array);
2212
  }
2221
  *
2222
  * @return string
2223
  */
2224
+ protected function child_category_id( $product ) {
2225
+ $child_category_id = "";
 
2226
  $separator = apply_filters('woo_feed_product_type_separator', ' > ', $this->config, $product);
2227
  $full_category = $this->product_type( $product );
2228
+ if ( ! empty($full_category) ) {
2229
  $full_category_array = explode($separator,$full_category);
2230
+ $child_category_obj = get_term_by( 'name', end($full_category_array), 'product_cat' );
2231
+ $child_category_id = isset($child_category_obj->term_id) ? $child_category_obj->term_id : "";
2232
  }
2233
 
2234
  return apply_filters('woo_feed_filter_product_child_category_id', $child_category_id, $product, $this->config);
2243
  * @since 3.2.0
2244
  *
2245
  */
2246
+ protected function product_type( $product ) {
 
2247
  $id = $product->get_id();
2248
+ if ( $product->is_type('variation') ) {
2249
  $id = $product->get_parent_id();
2250
  }
2251
 
2256
  $product_categories = '';
2257
  $term_list = get_the_terms( $id, 'product_cat' );
2258
 
2259
+ if ( is_array($term_list) ) {
2260
  $col = array_column( $term_list, "term_id" );
2261
  array_multisort( $col, SORT_ASC, $term_list );
2262
  $term_list = array_column( $term_list, "name" );
2275
  * @return string
2276
  * @since 4.3.47
2277
  */
2278
+ protected function product_full_cat( $product ) {
 
2279
  // $id = $product->get_id();
2280
  // if ($product->is_type('variation')) {
2281
  // $id = $product->get_parent_id();
2299
  * @since 3.2.0
2300
  *
2301
  */
2302
+ protected function link( $product ) {
 
2303
 
2304
  $link = $product->get_permalink();
2305
 
2315
  * @return string $url
2316
  * @since 4.4.26
2317
  */
2318
+ protected function add_utm_tracker( $url ) {
2319
 
2320
+ $utm = $this->config['campaign_parameters'];
2321
 
2322
+ if ( ! empty( $utm['utm_source'] ) && ! empty( $utm['utm_medium'] ) && ! empty( $utm['utm_campaign'] ) ) {
2323
 
2324
  $utm = [
2325
+ 'utm_source' => str_replace(' ', '+', $utm['utm_source'] ),
2326
+ 'utm_medium' => str_replace(' ', '+', $utm['utm_medium'] ),
2327
  'utm_campaign' => str_replace(' ', '+', $utm['utm_campaign'] ),
2328
+ 'utm_term' => str_replace(' ', '+', $utm['utm_term'] ),
2329
+ 'utm_content' => str_replace(' ', '+', $utm['utm_content'] ),
2330
  ];
2331
 
2332
  $url = add_query_arg( array_filter( $utm ), $url );
2345
  * @author Nazrul Islam Nayan
2346
  * @since 5.1.8
2347
  */
2348
+ protected function parent_link( $product ) {
2349
+ if ( $product->is_type('variation') ) {
 
2350
  $product = wc_get_product($product->get_parent_id());
2351
  $link = $this->link($product);
2352
  } else {
2361
  * @param WC_Product $product
2362
  * @return mixed
2363
  */
2364
+ protected function canonical_link( $product ) {
2365
+ if ( $product->is_type('variation') ) {
 
2366
  $product = wc_get_product($product->get_parent_id());
2367
  $canonical_link = $product->get_permalink();
2368
  } else {
2381
  * @since 3.2.0
2382
  *
2383
  */
2384
+ protected function ex_link( $product ) {
2385
+ if ( $product->is_type('external') ) {
2386
  $utm = $this->config['campaign_parameters'];
2387
+ if ( ! empty($utm['utm_source']) && ! empty($utm['utm_medium']) && ! empty($utm['utm_campaign']) ) {
2388
  $utm = [
2389
+ 'utm_source' => str_replace(' ', '+', $utm['utm_source'] ),
2390
+ 'utm_medium' => str_replace(' ', '+', $utm['utm_medium'] ),
2391
  'utm_campaign' => str_replace(' ', '+', $utm['utm_campaign'] ),
2392
+ 'utm_term' => str_replace(' ', '+', $utm['utm_term'] ),
2393
+ 'utm_content' => str_replace(' ', '+', $utm['utm_content'] ),
2394
  ];
2395
 
2396
  return add_query_arg(array_filter($utm), $product->get_product_url());
2413
  * @since 3.2.0
2414
  *
2415
  */
2416
+ protected function image( $product ) {
 
2417
  $image = '';
2418
+ if ( $product->is_type('variation') ) {
2419
  // Variation product type
2420
+ if ( has_post_thumbnail( $product->get_id() ) ) {
2421
  $getImage = wp_get_attachment_image_src( get_post_thumbnail_id( $product->get_id() ), 'single-post-thumbnail' );
2422
  $image = woo_feed_get_formatted_url($getImage[0]);
2423
  } elseif ( has_post_thumbnail( $product->get_parent_id() ) ) {
2424
  $getImage = wp_get_attachment_image_src(get_post_thumbnail_id($product->get_parent_id()), 'single-post-thumbnail');
2425
  $image = woo_feed_get_formatted_url($getImage[0]);
2426
  }
2427
+ } elseif ( has_post_thumbnail( $product->get_id() ) ) { // All product type except variation
2428
  $getImage = wp_get_attachment_image_src( get_post_thumbnail_id( $product->get_id() ), 'single-post-thumbnail' );
2429
  $image = isset( $getImage[0] ) ? woo_feed_get_formatted_url( $getImage[0] ) : '';
2430
  }
2441
  * @since 3.2.0
2442
  *
2443
  */
2444
+ protected function feature_image( $product ) {
2445
+ if ( $product->is_type('variation') ) {
2446
+ $id = $product->get_parent_id();
2447
+ }else {
2448
+ $id = $product->get_id();
 
2449
  }
2450
 
2451
  $getImage = wp_get_attachment_image_src( get_post_thumbnail_id( $id ), 'single-post-thumbnail' );
2464
  * @since 3.2.0
2465
  *
2466
  */
2467
+ protected function images( $product, $additionalImg = '' ) {
 
2468
  $imgUrls = $this->get_product_gallery($product);
2469
 
2470
  // Return Specific Additional Image URL
2471
+ if ( '' !== $additionalImg ) {
2472
+ if ( array_key_exists($additionalImg, $imgUrls) ) {
2473
+ $images = $imgUrls[ $additionalImg ];
2474
  } else {
2475
  $images = '';
2476
  }
2490
  * @return string[]
2491
  * @since 3.2.6
2492
  */
2493
+ protected function get_product_gallery( $product ) {
 
2494
  $imgUrls = [];
2495
  $attachmentIds = [];
2496
 
2497
+ if ( $product->is_type('variation') ) {
2498
+ if ( class_exists('Woo_Variation_Gallery') ) {
2499
  /**
2500
  * Get Variation Additional Images for "Additional Variation Images Gallery for WooCommerce"
2501
  * @plugin Additional Variation Images Gallery for WooCommerce
2502
  * @link https://wordpress.org/plugins/woo-variation-gallery/
2503
  */
2504
  $attachmentIds = get_post_meta($product->get_id(), 'woo_variation_gallery_images', true);
2505
+ } elseif ( class_exists('WooProductVariationGallery') ) {
2506
  /**
2507
  * Get Variation Additional Images for "Variation Images Gallery for WooCommerce"
2508
  * @plugin Variation Images Gallery for WooCommerce
2510
  */
2511
  $attachmentIds = get_post_meta($product->get_id(), 'rtwpvg_images', true);
2512
  }
2513
+ elseif ( class_exists('WC_Additional_Variation_Images') ) {
2514
  /**
2515
  * Get Variation Additional Images for "WooCommerce Additional Variation Images"
2516
  * @plugin WooCommerce Additional Variation Images
2517
  * @link https://woocommerce.com/products/woocommerce-additional-variation-images/
2518
  */
2519
  $attachmentIds = explode(',',get_post_meta($product->get_id(), '_wc_additional_variation_images', true));
2520
+ }elseif ( class_exists('WOODMART_Theme') ) {
2521
  /**
2522
  * Get Variation Additional Images for "WOODMART Theme -> Variation Gallery Images Feature"
2523
  * @theme WOODMART
2527
  $parent_id = $product->get_parent_id();
2528
 
2529
  $variation_obj = get_post_meta($parent_id, 'woodmart_variation_gallery_data', true);
2530
+ if ( isset($variation_obj) && isset($variation_obj[ $var_id ]) ) {
2531
+ $attachmentIds = explode(',', $variation_obj[ $var_id ]);
2532
  }else {
2533
  $attachmentIds = explode(',',get_post_meta($var_id, 'wd_additional_variation_images_data', true));
2534
+ }
2535
+ }else {
 
2536
  /**
2537
  * If any Variation Gallery Image plugin not installed then get Variable Product Additional Image Ids .
2538
  */
2544
  * Get Variable Product Gallery Image ids if Product is not a variation
2545
  * or variation does not have any gallery images
2546
  */
2547
+ if ( empty($attachmentIds) ) {
2548
  $attachmentIds = $product->get_gallery_image_ids();
2549
  }
2550
 
2551
+ if ( $attachmentIds && is_array($attachmentIds) ) {
2552
  $mKey = 1;
2553
+ foreach ( $attachmentIds as $attachmentId ) {
2554
+ $imgUrls[ $mKey ] = woo_feed_get_formatted_url(wp_get_attachment_url($attachmentId));
2555
  $mKey++;
2556
  }
2557
  }
2568
  * @since 3.2.0
2569
  *
2570
  */
2571
+ protected function condition( $product ) {
 
2572
  return apply_filters('woo_feed_product_condition', 'new', $product);
2573
  }
2574
 
2581
  * @since 3.2.0
2582
  *
2583
  */
2584
+ protected function type( $product ) {
 
2585
  return apply_filters('woo_feed_filter_product_type', $product->get_type(), $product, $this->config);
2586
  }
2587
 
2594
  * @since 3.2.0
2595
  *
2596
  */
2597
+ protected function is_bundle( $product ) {
2598
+ if ( $product->is_type('bundle') || $product->is_type('yith_bundle') ) {
 
2599
  $is_bundle = 'yes';
2600
  } else {
2601
  $is_bundle = 'no';
2613
  * @since 3.2.0
2614
  *
2615
  */
2616
+ protected function multipack( $product ) {
 
2617
  $multi_pack = '';
2618
+ if ( $product->is_type('grouped') ) {
2619
+ $multi_pack = ( ! empty($product->get_children())) ? count($product->get_children()) : '';
2620
  }
2621
 
2622
  return $multi_pack;
2631
  * @since 3.2.0
2632
  *
2633
  */
2634
+ protected function visibility( $product ) {
 
2635
  return apply_filters('woo_feed_filter_product_visibility', $product->get_catalog_visibility(), $product, $this->config);
2636
  }
2637
 
2644
  * @since 3.2.0
2645
  *
2646
  */
2647
+ protected function rating_total( $product ) {
 
2648
  return apply_filters('woo_feed_filter_product_rating_total', $product->get_rating_count(), $product, $this->config);
2649
  }
2650
 
2657
  * @since 3.2.0
2658
  *
2659
  */
2660
+ protected function rating_average( $product ) {
 
2661
  return apply_filters('woo_feed_filter_product_rating_average', $product->get_average_rating(), $product, $this->config);
2662
  }
2663
 
2670
  * @since 3.2.0
2671
  *
2672
  */
2673
+ protected function tags( $product ) {
 
2674
  $id = $product->get_id();
2675
+ if ( $product->is_type('variation') ) {
2676
  $id = $product->get_parent_id();
2677
  }
2678
 
2699
  * @since 3.2.0
2700
  *
2701
  */
2702
+ protected function item_group_id( $product ) {
 
2703
  $id = $product->get_id();
2704
+ if ( $product->is_type('variation') ) {
2705
  $id = $product->get_parent_id();
2706
  }
2707
 
2717
  * @since 3.2.0
2718
  *
2719
  */
2720
+ protected function sku( $product ) {
 
2721
  return apply_filters('woo_feed_filter_product_sku', $product->get_sku(), $product, $this->config);
2722
  }
2723
 
2730
  * @author Nazrul Islam Nayan
2731
  * @since 4.3.13
2732
  */
2733
+ protected function sku_id( $product ) {
2734
+ $sku = ! empty($product->get_sku()) ? $product->get_sku() . '_' : '';
 
2735
  $sku_id = $sku . $product->get_id();
2736
 
2737
  return apply_filters('woo_feed_filter_product_sku_id', $sku_id, $product, $this->config);
2746
  * @since 3.2.0
2747
  *
2748
  */
2749
+ protected function parent_sku( $product ) {
2750
+ if ( $product->is_type('variation') ) {
 
2751
  $id = $product->get_parent_id();
2752
  $parent = wc_get_product($id);
2753
 
2768
  * @since 3.2.0
2769
  *
2770
  */
2771
+ protected function availability( $product ) {
 
2772
  $status = $product->get_stock_status();
2773
+ if ( 'instock' == $status ) {
2774
  $status = 'in stock';
2775
+ } elseif ( 'outofstock' == $status ) {
2776
  $status = 'out of stock';
2777
+ } elseif ( 'onbackorder' == $status ) {
2778
  $status = 'on backorder';
2779
  }
2780
 
2781
  // set (_) as separator for google merchant
2782
+ if ( isset($this->config['provider']) && 'google' === $this->config['provider'] ) {
2783
  $status = explode(' ', $status);
2784
  $status = implode('_', $status);
2785
  }
2797
  * @since 3.2.0
2798
  *
2799
  */
2800
+ protected function availability_date( $product ) {
 
2801
 
2802
  $feed_settings = get_option( 'woo_feed_settings' );
2803
 
2805
  ? $feed_settings['woo_feed_identifier']['availability_date']
2806
  : 'enable' ;
2807
 
2808
+ if ( $product->get_stock_status() !== 'onbackorder' || $availability_date_settings === 'disable' ) {
2809
  return '';
2810
  }
2811
 
2812
  $meta_field_name = 'woo_feed_availability_date';
2813
 
2814
+ if ( $product->is_type( 'variation' ) ) {
2815
  $meta_field_name .= '_var';
2816
  }
2817
 
2818
  $availability_date = get_post_meta($product->get_id(), $meta_field_name, true);
2819
 
2820
+ if ( '' !== $availability_date && in_array($this->config['provider'], [
2821
+ 'google',
2822
+ 'facebook',
2823
+ 'pinterest',
2824
+ 'bing',
2825
+ 'snapchat',
2826
+ ], true) ) {
2827
  $availability_date = gmdate('c', strtotime($availability_date));
2828
  }
2829
 
2839
  * @author Nazrul Islam Nayan
2840
  * @since 5.1.8
2841
  */
2842
+ protected function add_to_cart_link( $product ) {
 
2843
  $url = $this->link($product);
2844
  $suffix = 'add-to-cart=' . $product->get_id();
2845
 
2857
  * @since 3.2.0
2858
  *
2859
  */
2860
+ protected function quantity( $product ) {
 
2861
  $quantity = $product->get_stock_quantity();
2862
  $status = $product->get_stock_status();
2863
 
2864
  //when product is outofstock and it's quantity is empty, set quantity to 0
2865
+ if ( 'outofstock' == $status && empty($quantity) ) {
2866
  $quantity = 0;
2867
  }
2868
 
2869
+ if ( $product->is_type('variable') && $product->has_child() ) {
2870
  $visible_children = $product->get_visible_children();
2871
  $qty = array();
2872
+ foreach ( $visible_children as $key => $child ) {
2873
  $childQty = get_post_meta($child, '_stock', true);
2874
  $qty[] = (int)$childQty + 0;
2875
  }
2876
 
2877
+ if ( isset($this->config['variable_quantity']) ) {
2878
  $vaQty = $this->config['variable_quantity'];
2879
+ if ( 'max' == $vaQty ) {
2880
  $quantity = max($qty);
2881
+ } elseif ( 'min' == $vaQty ) {
2882
  $quantity = min($qty);
2883
+ } elseif ( 'sum' == $vaQty ) {
2884
  $quantity = array_sum($qty);
2885
+ } elseif ( 'first' == $vaQty ) {
2886
+ $quantity = ( (int)$qty[0]);
2887
  }
2888
 
2889
  $quantity = array_sum($qty);
2902
  * @since 4.4.39
2903
  *
2904
  */
2905
+ protected function currency( $product ) {
 
2906
  $quantity = get_option( 'woocommerce_currency' );
2907
 
2908
  return apply_filters('woo_feed_filter_product_currency', $quantity, $product, $this->config);
2916
  * @since 3.2.0
2917
  *
2918
  */
2919
+ protected function store_currency( $product ) {
 
2920
  return get_woocommerce_currency();
2921
  }
2922
 
2929
  * @since 3.2.0
2930
  *
2931
  */
2932
+ protected function sale_price_sdate( $product ) {
 
2933
  $startDate = $product->get_date_on_sale_from();
2934
+ if ( is_object($startDate) ) {
2935
  $sale_price_sdate = $startDate->date_i18n();
2936
  } else {
2937
  $sale_price_sdate = '';
2949
  * @since 3.2.0
2950
  *
2951
  */
2952
+ protected function sale_price_edate( $product ) {
 
2953
  $endDate = $product->get_date_on_sale_to();
2954
+ if ( is_object($endDate) ) {
2955
  $sale_price_edate = $endDate->date_i18n();
2956
  } else {
2957
  $sale_price_edate = "";
2965
  *
2966
  * @return mixed|string
2967
  */
2968
+ protected function get_feed_currency() {
 
2969
  $currency = get_woocommerce_currency();
2970
+ if ( isset($this->config['feedCurrency']) ) {
2971
  $currency = $this->config['feedCurrency'];
2972
  }
2973
 
2986
  *
2987
  * @return float|mixed|string|void
2988
  */
2989
+ protected function get_price_by_price_type( $product, $price_type, $tax ) {
 
2990
 
2991
+ if ( 'regular_price' === $price_type ) {
2992
  $price = $product->get_regular_price();
2993
+ } elseif ( 'price' === $price_type ) {
2994
  $price = $product->get_price();
2995
  } else {
2996
  $price = $product->get_sale_price();
3002
  );
3003
 
3004
  // Get Price with tax
3005
+ if ( true === $tax ) {
3006
  $price = woo_feed_get_price_with_tax($price, $product);
3007
  }
3008
 
3021
  *
3022
  * @return float|int|mixed|string
3023
  */
3024
+ protected function get_price_by_product_type( $product, $price_type, $tax = false ) {
3025
+ if ( $product->is_type('variable') ) {
 
3026
  $price = $this->getVariableProductPrice($product, $price_type, $tax);
3027
+ } elseif ( $product->is_type('grouped') ) {
3028
  $price = $this->getGroupProductPrice($product, $price_type, $tax);
3029
+ } elseif ( $product->is_type('bundle') ) {
3030
  //TODO Diff taxation
3031
  $price = $this->getBundleProductPrice($product, $price_type, $tax);
3032
+ } elseif ( $product->is_type('composite') ) {
3033
  //TODO Diff taxation
3034
  $price = $this->getCompositeProductPrice($product, $price_type, $tax);
3035
+ } elseif ( $product->is_type('bundled') ) {
3036
  // iconic woocommerce product bundled plugin
3037
  $price = $this->iconic_bundle_product_price($product, $price_type, $tax);
3038
  } else {
3051
  * @since 3.2.0
3052
  *
3053
  */
3054
+ protected function price( $product ) {
 
3055
 
3056
  $regular_price = $this->get_price_by_product_type($product, 'regular_price');
3057
 
3067
  * @since 3.2.0
3068
  *
3069
  */
3070
+ protected function current_price( $product ) {
 
3071
 
3072
  $price = $this->get_price_by_product_type($product, 'price');
3073
 
3083
  * @since 3.2.0
3084
  *
3085
  */
3086
+ protected function sale_price( $product ) {
 
3087
 
3088
  $sale_price = $this->get_price_by_product_type($product, 'sale_price');
3089
 
3099
  * @since 3.2.0
3100
  *
3101
  */
3102
+ protected function price_with_tax( $product ) {
 
3103
 
3104
  $regular_price_with_tax = $this->get_price_by_product_type($product, 'regular_price', true);
3105
 
3115
  * @since 3.2.0
3116
  *
3117
  */
3118
+ protected function current_price_with_tax( $product ) {
 
3119
 
3120
  $price_with_tax = $this->get_price_by_product_type($product, 'price', true);
3121
 
3131
  * @since 3.2.0
3132
  *
3133
  */
3134
+ protected function sale_price_with_tax( $product ) {
 
3135
 
3136
  $sale_price_with_tax = $this->get_price_by_product_type($product, 'sale_price', true);
3137
 
3148
  * @return int|float|double
3149
  * @since 3.2.6
3150
  */
3151
+ protected function getCompositeProductPrice( $product, $type, $tax = false ) {
3152
+ if ( class_exists('WC_Product_Composite') && class_exists('WPCleverWooco') ) {
 
3153
  // WPC Composite Product
3154
  return $this->get_wpc_composite_price($product, $type, $tax);
3155
+ } elseif ( class_exists('WC_Composite_Products') ) {
3156
  // WooCommerce Composite Product
3157
  return $this->get_wc_composite_product_price($product, $type, $tax);
3158
  } else {
3172
  * @param bool $tax Add tax with price (true|false)
3173
  * @return float|int|mixed|string|void
3174
  */
3175
+ protected function get_wc_composite_product_price( $product, $type, $tax ) {
 
3176
  $price = 0;
3177
  // Parent Component Price
3178
  $base_price = $this->get_price_by_price_type($product, $type, $tax);
3179
+ if ( isset($this->config['composite_price']) && 'all_product_price' == $this->config['composite_price'] ) {
3180
  $composite = new WC_Product_Composite($product);
3181
 
3182
+ if ( 'price' === $type || 'sale_price' === $type ) {
3183
  $price = $composite->get_composite_price();
3184
  } else {
3185
  $price = $composite->get_composite_regular_price();
3191
  );
3192
 
3193
  // Get Price with tax
3194
+ if ( true === $tax ) {
3195
  $price = woo_feed_get_price_with_tax($price, $composite);
3196
  }
3197
  } else {
3211
  * @param bool $tax Add tax with price (true|false)
3212
  * @return float|int|mixed|string|void
3213
  */
3214
+ protected function get_wpc_composite_price( $product, $type, $tax ) {
 
3215
  $price = 0;
3216
  // Parent Component Price
3217
  $base_price = $this->get_price_by_price_type($product, $type, $tax);
3218
+ if ( isset($this->config['composite_price']) && 'all_product_price' == $this->config['composite_price'] ) {
3219
  $components_price = 0;
3220
  $components = $product->get_components();
3221
+ if ( ! empty($components) && is_array($components) ) {
3222
+ foreach ( $components as $component ) {
3223
  $products = explode(',', $component['products']);
3224
+ foreach ( $products as $key => $product_id ) {
3225
  $default_product = wc_get_product($product_id);
3226
+ if ( is_object($default_product) && $default_product->is_in_stock() ) {
3227
  $quantity = (isset($component['qty']) && $component['qty'] > 0) ? $component['qty'] : 1;
3228
+ if ( 'products' == $component['type'] && empty($component['price']) ) {
3229
  $components_price += $this->get_price_by_price_type($default_product, 'price', $tax);
3230
  $components_price *= $quantity;
3231
+ } elseif ( 'products' == $component['type'] && ! empty($component['price']) ) {
3232
  $clever = new WPCleverWooco();
3233
  $old_price = $this->get_price_by_price_type($default_product, 'price', $tax);
3234
  $new_price = $component['price'];
3242
 
3243
  // Apply discount to components price.
3244
  $discount = $product->get_discount();
3245
+ if ( $discount > 0 ) {
3246
  $components_price -= (($discount / 100) * $components_price);
3247
  }
3248
  }
3249
 
3250
+ if ( 'exclude' === $product->get_pricing() ) {
3251
  $price = $components_price;
3252
+ } elseif ( 'include' === $product->get_pricing() ) {
3253
  $price = $components_price + $base_price;
3254
+ } elseif ( 'only' === $product->get_pricing() ) {
3255
  $price = $base_price;
3256
  }
3257
  } else {
3272
  * @since 3.2.0
3273
  *
3274
  */
3275
+ protected function getGroupProductPrice( $grouped, $type, $tax = false ) {
 
3276
  $groupProductIds = $grouped->get_children();
3277
  $price = 0;
3278
+ if ( ! empty($groupProductIds) ) {
3279
+ foreach ( $groupProductIds as $id ) {
3280
  $product = wc_get_product($id);
3281
+ if ( ! is_object($product) ) {
3282
  continue; // make sure that the product exists..
3283
  }
3284
 
3285
  $get_price = $this->get_price_by_product_type($product, $type, $tax);
3286
+ if ( ! empty($get_price) ) {
3287
  $price += $get_price;
3288
  }
3289
  }
3303
  * @since 3.2.0
3304
  *
3305
  */
3306
+ protected function getVariableProductPrice( $variable, $type, $tax = false ) {
 
3307
  $min_max_first_default = apply_filters('woo_feed_variable_product_price_range', 'min');
3308
+ if ( isset($this->config['variable_price']) ) {
3309
  $min_max_first_default = $this->config['variable_price'];
3310
  }
3311
 
3312
  $price = 0;
3313
+ if ( 'first' == $min_max_first_default ) {
3314
  $children = $variable->get_visible_children();
3315
+ if ( isset($children[0]) && ! empty($children[0]) ) {
3316
  $variation = wc_get_product($children[0]);
3317
  $price = $this->get_price_by_product_type($variation, $type, $tax);
3318
  }
3319
  } else {
3320
+ if ( 'regular_price' == $type ) {
3321
  $price = $variable->get_variation_regular_price($min_max_first_default);
3322
+ } elseif ( 'sale_price' == $type ) {
3323
  $price = $variable->get_variation_sale_price($min_max_first_default);
3324
  } else {
3325
  $price = $variable->get_variation_price($min_max_first_default);
3331
  );
3332
 
3333
  // Get Price with tax
3334
+ if ( true === $tax ) {
3335
  $price = woo_feed_get_price_with_tax($price, $variable);
3336
  }
3337
  }
3349
  * @return int|float|string
3350
  * @since 4.3.24
3351
  */
3352
+ protected function getBundleProductPrice( $product, $type, $tax = false ) {
3353
+ if ( class_exists('WC_Product_Bundle') ) {//WC_Product_Bundle
 
3354
  $bundle = new WC_Product_Bundle($product);
3355
+ if ( 'price' === $type || 'sale_price' === $type ) {
3356
  $price = $bundle->get_bundle_price();
3357
  } else {
3358
  $price = $bundle->get_bundle_regular_price();
3364
  );
3365
 
3366
  // Get Price with tax
3367
+ if ( true === $tax ) {
3368
  $price = woo_feed_get_price_with_tax($price, $bundle);
3369
+ }
3370
+ } else {
 
3371
  // Get Default price for others bundle products.
3372
  $price = $this->get_price_by_price_type($product, $type, $tax);
3373
  }
3384
  *
3385
  * @return mixed $bundle_price
3386
  */
3387
+ protected function iconic_bundle_product_price( $product, $type, $tax = false ) {
3388
+ if ( ! class_exists('WC_Product_Bundled') ) {
 
3389
  return $product->get_price();
3390
  }
3391
 
3392
  $is_discounted = false;
3393
  $price = $product->get_price();
3394
  $bundle = new WC_Product_Bundled($product->get_id());
3395
+ $iconic_bundle_product_type = ( ! is_null($bundle->options['price_display'])) ? $bundle->options['price_display'] : '';
3396
  $product_ids = $bundle->options['product_ids'];
3397
 
3398
  //set discount
3399
+ if ( ! empty($bundle->options['fixed_discount']) ) {
3400
  $is_discounted = true;
3401
  $discount = $bundle->options['fixed_discount'];
3402
  } else {
3405
  }
3406
 
3407
  // Get price
3408
+ if ( is_array($product_ids) ) {
3409
+ $product_prices = array_map(function ( $id ) use ( $tax, $type, $is_discounted, $discount ) {
3410
  $product = wc_get_product($id);
3411
 
3412
  return $this->get_price_by_price_type($product, $type, $tax);
3413
 
3414
  }, $product_ids);
3415
 
3416
+ if ( 'range' === $iconic_bundle_product_type ) {
3417
  $price = min($product_prices);
3418
  } else {
3419
  $price = array_sum($product_prices);
3421
  }
3422
 
3423
  // Get sale price if discount enabled
3424
+ if ( $is_discounted && ('sale_price' === $type || 'price' === $type) ) {
3425
  $price -= $discount;
3426
  }
3427
 
3431
  );
3432
 
3433
  // Get Price with tax
3434
+ if ( true === $tax ) {
3435
  $price = woo_feed_get_price_with_tax($price, $bundle);
3436
  }
3437
 
3447
  * @since 3.2.0
3448
  *
3449
  */
3450
+ protected function weight( $product ) {
 
3451
  return apply_filters('woo_feed_filter_product_weight', $product->get_weight(), $product, $this->config);
3452
  }
3453
 
3460
  * @since 5.2.7
3461
  *
3462
  */
3463
+ protected function weight_unit( $product ) {
 
3464
  return apply_filters('woo_feed_filter_product_weight_unit', get_option('woocommerce_weight_unit'), $product, $this->config);
3465
  }
3466
 
3473
  * @since 3.2.0
3474
  *
3475
  */
3476
+ protected function width( $product ) {
 
3477
  return apply_filters('woo_feed_filter_product_width', $product->get_width(), $product, $this->config);
3478
  }
3479
 
3486
  * @since 3.2.0
3487
  *
3488
  */
3489
+ protected function height( $product ) {
 
3490
  return apply_filters('woo_feed_filter_product_height', $product->get_height(), $product, $this->config);
3491
  }
3492
 
3499
  * @since 3.2.0
3500
  *
3501
  */
3502
+ protected function length( $product ) {
 
3503
  return apply_filters('woo_feed_filter_product_length', $product->get_length(), $product, $this->config);
3504
  }
3505
 
3512
  * @since 4.3.16
3513
  * @author Nazrul Islam Nayan
3514
  */
3515
+ protected function shipping( $product ) {
 
3516
  $feedBody = '';
3517
  $data = $this->data;
3518
 
3519
+ if ( isset($data['shipping_zones']) && ! empty($data['shipping_zones']) ) {
3520
  $zones = $data['shipping_zones'];
3521
 
3522
+ if ( in_array($this->config['provider'], [ 'google', 'facebook', 'pinterest', 'bing', 'snapchat' ]) ) {
3523
  $get_shipping = new Woo_Feed_Shipping($this->config);
3524
  $feedBody .= $get_shipping->set_product($product)->set_shipping_zone($zones)->get_google_shipping();
3525
  }
3538
  * @since 5.1.20
3539
  * @author Nazrul Islam Nayan
3540
  */
3541
+ protected function shipping_cost( $product ) {
 
3542
  $shipping_obj = new Woo_Feed_Shipping($this->config);
3543
  $shipping_obj = $shipping_obj->set_product($product);
3544
 
3554
  * @since 3.2.0
3555
  *
3556
  */
3557
+ protected function shipping_class( $product ) {
 
3558
  return apply_filters('woo_feed_filter_product_shipping_class', $product->get_shipping_class(), $product, $this->config);
3559
  }
3560
 
3567
  * @since 3.2.0
3568
  *
3569
  */
3570
+ protected function author_name( $product ) {
 
3571
  $post = get_post($product->get_id());
3572
 
3573
  return get_the_author_meta('user_login', $post->post_author);
3582
  * @since 3.2.0
3583
  *
3584
  */
3585
+ protected function author_email( $product ) {
 
3586
  $post = get_post($product->get_id());
3587
 
3588
  return get_the_author_meta('user_email', $post->post_author);
3597
  * @since 3.2.0
3598
  *
3599
  */
3600
+ protected function date_created( $product ) {
 
3601
  $date_created = gmdate('Y-m-d', strtotime($product->get_date_created()));
3602
 
3603
  return apply_filters('woo_feed_filter_product_date_created', $date_created, $product, $this->config);
3612
  * @since 3.2.0
3613
  *
3614
  */
3615
+ protected function date_updated( $product ) {
 
3616
  $date_updated = gmdate('Y-m-d', strtotime($product->get_date_modified()));
3617
 
3618
  return apply_filters('woo_feed_filter_product_date_updated', $date_updated, $product, $this->config);
3626
  * @since 5.1.20
3627
  * @author Nazrul Islam Nayan
3628
  */
3629
+ protected function tax( $product ) {
 
3630
  $feedBody = '';
3631
+ if ( in_array($this->config['provider'], [ 'google', 'facebook', 'pinterest', 'bing', 'snapchat' ]) ) {
3632
  $shipping_obj = new Woo_Feed_Shipping($this->config);
3633
  $shipping_obj = $shipping_obj->set_product($product);
3634
  $feedBody .= $shipping_obj->get_google_tax();
3642
  * @param WC_Product $product Product object.
3643
  * @return string
3644
  */
3645
+ protected function tax_class( $product ) {
 
3646
  return apply_filters('woo_feed_filter_product_tax_class', $product->get_tax_class(), $product, $this->config);
3647
  }
3648
 
3651
  * @param WC_Product $product Product object.
3652
  * @return string
3653
  */
3654
+ protected function tax_status( $product ) {
 
3655
  return apply_filters('woo_feed_filter_product_tax_status', $product->get_tax_status(), $product, $this->config);
3656
  }
3657
 
3662
  * @param string $field custom field name.
3663
  * @return string
3664
  */
3665
+ protected function getCustomField( $product, $field ) {
 
3666
  $id = $product->get_id();
3667
  $meta = $field;
3668
+ if ( $product->is_type('variation') ) {
3669
  $meta = $field . '_var';
3670
  }
3671
 
3674
  $new_meta_key = '';
3675
  $old_meta_key = '';
3676
 
3677
+ if ( strpos( $meta, '_identifier' ) !== false ) {
3678
  $old_meta_key = $meta;
3679
  $new_meta_key = str_replace( '_identifier', '', $meta );
3680
  } else {
3685
  $new_meta_value = $this->getProductMeta( $product, $new_meta_key );
3686
  $old_meta_value = $this->getProductMeta( $product, $old_meta_key );
3687
 
3688
+ if ( empty( $new_meta_value ) ) {
3689
  return $old_meta_value;
3690
  } else {
3691
  return $new_meta_value;
3702
  * @since 3.2.0
3703
  *
3704
  */
3705
+ protected function sale_price_effective_date( $product ) {
 
3706
  $effective_date = '';
3707
  $from = $this->sale_price_sdate($product);
3708
  $to = $this->sale_price_edate($product);
3709
+ if ( ! empty($from) && ! empty($to) ) {
3710
  $from = gmdate('c', strtotime($from));
3711
  $to = gmdate('c', strtotime($to));
3712
 
3726
  * @since 2.2.3
3727
  *
3728
  */
3729
+ protected function getProductAttribute( $product, $attr ) {
 
3730
  $id = $product->get_id();
3731
 
3732
+ if ( woo_feed_wc_version_check(3.2) ) {
3733
+ if ( woo_feed_wc_version_check(3.6) ) {
3734
  $attr = str_replace('pa_', '', $attr);
3735
  }
3736
  $value = $product->get_attribute($attr);
3737
 
3738
  // if empty get attribute of parent post
3739
+ if ( '' === $value && $product->is_type('variation') ) {
3740
  $product = wc_get_product($product->get_parent_id());
3741
  $value = $product->get_attribute($attr);
3742
  }
3743
 
3744
  $getproductattribute = $value;
3745
  } else {
3746
+ $getproductattribute = implode(',', wc_get_product_terms($id, $attr, array( 'fields' => 'names' )));
3747
  }
3748
 
3749
  return apply_filters('woo_feed_filter_product_attribute', $getproductattribute, $product, $attr, $this->config);
3759
  * @since 2.2.3
3760
  *
3761
  */
3762
+ protected function getProductMeta( $product, $meta ) {
 
3763
  $value = get_post_meta($product->get_id(), $meta, true);
3764
  // if empty get meta value of parent post
3765
+ if ( '' === $value && $product->is_type('variation') ) {
3766
  $value = get_post_meta($product->get_parent_id(), $meta, true);
3767
  }
3768
 
3778
  * @since 3.2.0
3779
  *
3780
  */
3781
+ public function filter_product( $product ) {
 
3782
  return true;
3783
  }
3784
 
3792
  * @since 2.2.3
3793
  *
3794
  */
3795
+ protected function getProductTaxonomy( $product, $taxonomy ) {
 
3796
  $id = $product->get_id();
3797
+ if ( $product->is_type('variation') ) {
3798
  $id = $product->get_parent_id();
3799
  }
3800
 
3802
 
3803
  $term_list = get_the_term_list($id, $taxonomy, '', $separator, '');
3804
 
3805
+ if ( is_object($term_list) && get_class($term_list) === 'WP_Error' ) {
3806
  $term_list = '';
3807
  }
3808
 
3822
  * @since 3.2.0
3823
  *
3824
  */
3825
+ protected function price_format( $name, $conditionName, $result ) {
 
3826
  $plus = '+';
3827
  $minus = '-';
3828
  $percent = '%';
3829
 
3830
+ if ( strpos($name, 'price') !== false ) {
3831
+ if ( strpos($result, $plus) !== false && strpos($result, $percent) !== false ) {
3832
  $result = str_replace('+', '', $result);
3833
  $result = str_replace('%', '', $result);
3834
+ if ( is_numeric($result) ) {
3835
  $result = $conditionName + (($conditionName * $result) / 100);
3836
  }
3837
+ } elseif ( strpos($result, $minus) !== false && strpos($result, $percent) !== false ) {
3838
  $result = str_replace('-', '', $result);
3839
  $result = str_replace('%', '', $result);
3840
+ if ( is_numeric($result) ) {
3841
  $result = $conditionName - (($conditionName * $result) / 100);
3842
  }
3843
+ } elseif ( strpos($result, $plus) !== false ) {
3844
  $result = str_replace('+', '', $result);
3845
+ if ( is_numeric($result) ) {
3846
  $result = ($conditionName + $result);
3847
  }
3848
+ } elseif ( strpos($result, $minus) !== false ) {
3849
  $result = str_replace('-', '', $result);
3850
+ if ( is_numeric($result) ) {
3851
  $result = $conditionName - $result;
3852
  }
3853
  }
3868
  * @since 3.2.0
3869
  *
3870
  */
3871
+ protected function format_output( $output, $outputTypes, $product, $productAttribute, $merchant_attribute ) {
3872
+ if ( ! empty($outputTypes) && is_array($outputTypes) ) {
 
3873
 
3874
  // Format Output According to output type
3875
+ if ( in_array(2, $outputTypes) ) { // Strip Tags
3876
  $output = woo_feed_strip_all_tags(html_entity_decode($output));
3877
  }
3878
 
3879
+ if ( in_array(3, $outputTypes) ) { // UTF-8 Encode
3880
  $output = utf8_encode($output);
3881
  }
3882
 
3883
+ if ( in_array(4, $outputTypes) ) { // htmlentities
3884
  $output = htmlentities($output, ENT_QUOTES, 'UTF-8');
3885
  }
3886
 
3887
+ if ( in_array(5, $outputTypes) ) { // Integer
3888
  $output = intval($output);
3889
  }
3890
 
3891
+ if ( in_array(6, $outputTypes) ) { // Format Price
3892
+ if ( ! empty($output) && $output > 0 ) {
3893
  $decimals = wc_get_price_decimals();
3894
  $decimal_separator = wc_get_price_decimal_separator();
3895
  $thousand_separator = wc_get_price_thousand_separator();
3898
  }
3899
  }
3900
 
3901
+ if ( in_array(7, $outputTypes) ) { // Rounded Price
3902
+ if ( ! empty($output) && $output > 0 ) {
3903
  $output = round($output);
3904
  $output = number_format($output, 2, '.', '');
3905
  }
3906
  }
3907
 
3908
+ if ( in_array(8, $outputTypes) ) { // Delete Space
3909
  $output = htmlentities($output, null, 'utf-8');
3910
  $output = str_replace("&nbsp;", " ", $output);
3911
  $output = html_entity_decode($output);
3912
  $output = preg_replace("/\\s+/", ' ', $output);
3913
  }
3914
 
3915
+ if ( in_array(10, $outputTypes) ) { // Remove Invalid Character
3916
  $output = woo_feed_stripInvalidXml($output);
3917
  }
3918
 
3919
+ if ( in_array(11, $outputTypes) ) { // Remove ShortCodes
3920
  $output = $this->remove_short_codes($output);
3921
  }
3922
 
3923
+ if ( in_array(12, $outputTypes) ) {
3924
  $output = ucwords(strtolower($output));
3925
  }
3926
 
3927
+ if ( in_array(13, $outputTypes) ) {
3928
  $output = ucfirst(strtolower($output));
3929
  }
3930
 
3931
+ if ( in_array(14, $outputTypes) ) {
3932
  $output = strtoupper(strtolower($output));
3933
  }
3934
 
3935
+ if ( in_array(15, $outputTypes) ) {
3936
  $output = strtolower($output);
3937
  }
3938
 
3939
+ if ( in_array(16, $outputTypes) ) {
3940
+ if ( 'http' == substr($output, 0, 4) ) {
3941
  $output = str_replace('http://', 'https://', $output);
3942
  }
3943
  }
3944
 
3945
+ if ( in_array(17, $outputTypes) ) {
3946
+ if ( 'http' == substr($output, 0, 4) ) {
3947
  $output = str_replace('https://', 'http://', $output);
3948
  }
3949
  }
3950
 
3951
+ if ( in_array(18, $outputTypes) ) { // only parent
3952
+ if ( $product->is_type('variation') ) {
3953
  $id = $product->get_parent_id();
3954
  $parentProduct = wc_get_product($id);
3955
  $output = $this->getAttributeValueByType($parentProduct, $productAttribute, $merchant_attribute);
3956
  }
3957
  }
3958
 
3959
+ if ( in_array(19, $outputTypes) ) { // child if parent empty
3960
+ if ( $product->is_type('variation') ) {
3961
  $id = $product->get_parent_id();
3962
  $parentProduct = wc_get_product($id);
3963
  $output = $this->getAttributeValueByType($parentProduct, $productAttribute, $merchant_attribute);
3964
+ if ( empty($output) ) {
3965
  $output = $this->getAttributeValueByType($product, $productAttribute, $merchant_attribute);
3966
  }
3967
  }
3968
  }
3969
 
3970
+ if ( in_array(20, $outputTypes) ) { // parent if child empty
3971
+ if ( $product->is_type('variation') ) {
3972
  $output = $this->getAttributeValueByType($product, $productAttribute, $merchant_attribute);
3973
+ if ( empty($output) ) {
3974
  $id = $product->get_parent_id();
3975
  $parentProduct = wc_get_product($id);
3976
  $output = $this->getAttributeValueByType($parentProduct, $productAttribute, $merchant_attribute);
3978
  }
3979
  }
3980
 
3981
+ if ( in_array(9, $outputTypes) && ! empty($output) && 'xml' === $this->config['feedType'] ) { // Add CDATA
3982
  $output = '<![CDATA[' . $output . ']]>';
3983
  }
3984
  }
3998
  * @since 3.2.0
3999
  *
4000
  */
4001
+ public function process_prefix_suffix( $output, $prefix, $suffix, $attribute = '' ) {
 
4002
 
4003
  $cdata = false;
4004
+ if ( '' === $output ) {
4005
  return $output;
4006
  }
4007
 
4008
+ if ( strpos($output, '<![CDATA[') !== false ) {
4009
  $cdata = true;
4010
+ $output = str_replace(array( '<![CDATA[', ']]>' ), array( '', '' ), $output);
4011
  }
4012
 
4013
  // Add Prefix before Output
4014
+ if ( '' !== $prefix ) {
4015
  $output = "$prefix" . $output;
4016
  }
4017
 
4018
  // Add Suffix after Output
4019
+ if ( '' !== $suffix ) {
4020
+ if ( array_key_exists(trim($suffix), get_woocommerce_currencies()) ) { // Add space before suffix if attribute contain price.
4021
  $output .= ' ' . $suffix;
4022
+ } elseif ( substr($output, 0, 4) === 'http' ) {
4023
  // Parse URL Parameters if available into suffix field
4024
  $output = woo_feed_make_url_with_parameter($output, $suffix);
4025
 
4028
  }
4029
  }
4030
 
4031
+ if ( $cdata ) {
4032
  $output = '<![CDATA[' . $output . ']]>';
4033
  }
4034
 
4044
  * @since 3.6.3
4045
  *
4046
  */
4047
+ protected function subscription_period( $product ) {
4048
+ if ( class_exists('WC_Subscriptions') ) {
 
4049
  return $this->getProductMeta($product, '_subscription_period');
4050
  }
4051
  return '';
4060
  * @since 3.6.3
4061
  *
4062
  */
4063
+ protected function subscription_period_interval( $product ) {
4064
+ if ( class_exists('WC_Subscriptions') ) {
 
4065
  return $this->getProductMeta($product, '_subscription_period_interval');
4066
  }
4067
  return '';
4076
  * @since 3.6.3
4077
  *
4078
  */
4079
+ protected function subscription_amount( $product ) {
 
4080
  return $this->price($product);
4081
  }
4082
 
4088
  * @return mixed
4089
  * @since 4.3.101
4090
  */
4091
+ protected function installment_amount( $product ) {
 
4092
  return $this->price($product);
4093
  }
4094
 
4100
  * @return mixed
4101
  * @since 4.3.101
4102
  */
4103
+ protected function installment_months( $product ) {
4104
+ if ( class_exists('WC_Subscriptions') ) {
 
4105
  return $this->getProductMeta($product, '_subscription_length');
4106
  }
4107
  return '';
4119
  * @return mixed
4120
  * @since 3.6.3
4121
  */
4122
+ protected function unit_price_measure( $product ) {
 
4123
  $unit_price_measure = '';
4124
  $identifiers = woo_feed_get_options('woo_feed_identifier');
4125
+ if ( 'enable' === $identifiers['unit_pricing_base_measure']
4126
  && 'enable' === $identifiers['unit_pricing_measure']
4127
  && 'enable' === $identifiers['unit']
4128
  ) {
4132
  $unit_price_measure .= " " . $unit;
4133
  }
4134
 
4135
+ if ( empty($unit_price_measure) && class_exists('WooCommerce_Germanized') ) { // For WooCommerce Germanized Plugin
4136
  $unit = $this->getProductMeta($product, '_unit');
4137
  $unit_price_measure = $this->getProductMeta($product, '_unit_product');
4138
 
4153
  * @return mixed
4154
  * @since 3.6.3
4155
  */
4156
+ protected function unit_price_base_measure( $product ) {
 
4157
  $unit_price_base_measure = '';
4158
  $identifiers = woo_feed_get_options('woo_feed_identifier');
4159
+ if ( 'enable' === $identifiers['unit_pricing_base_measure']
4160
  && 'enable' === $identifiers['unit_pricing_measure']
4161
  && 'enable' === $identifiers['unit']
4162
  ) {
4166
  $unit_price_base_measure .= " " . $unit;
4167
  }
4168
 
4169
+ if ( empty($unit_price_base_measure) && class_exists('WooCommerce_Germanized') ) { // For WooCommerce Germanized Plugin
4170
  $unit = $this->getProductMeta($product, '_unit');
4171
  $unit_price_base_measure = $this->getProductMeta($product, '_unit_base');
4172
 
4184
  * @return mixed
4185
  * @since 3.6.3
4186
  */
4187
+ protected function wc_germanized_gtin( $product ) {
 
4188
  $wc_germanized_gtin = '';
4189
+ if ( class_exists('WooCommerce_Germanized') ) { // For WooCommerce Germanized Plugin
4190
  $wc_germanized_gtin = $this->getProductMeta($product, '_ts_gtin');
4191
  }
4192
 
4201
  * @return mixed
4202
  * @since 3.6.3
4203
  */
4204
+ protected function wc_germanized_mpn( $product ) {
 
4205
  $wc_germanized_mpn = '';
4206
+ if ( class_exists('WooCommerce_Germanized') ) { // For WooCommerce Germanized Plugin
4207
  $wc_germanized_mpn = $this->getProductMeta($product, '_ts_mpn');
4208
  }
4209
 
4219
  * @return mixed
4220
  * @since 4.4.4
4221
  */
4222
+ protected function yoast_gtin8( $product ) {
 
4223
  $yoast_gtin8_value = woo_feed_get_yoast_identifiers_value('gtin8', $product);
4224
 
4225
  return apply_filters('yoast_gtin8_attribute_value', $yoast_gtin8_value, $product);
4233
  * @return mixed
4234
  * @since 4.4.4
4235
  */
4236
+ protected function yoast_gtin12( $product ) {
 
4237
  $yoast_gtin12_value = woo_feed_get_yoast_identifiers_value('gtin12', $product);
4238
 
4239
  return apply_filters('yoast_gtin12_attribute_value', $yoast_gtin12_value, $product);
4247
  * @return mixed
4248
  * @since 4.4.4
4249
  */
4250
+ protected function yoast_gtin13( $product ) {
 
4251
  $yoast_gtin13_value = woo_feed_get_yoast_identifiers_value('gtin13', $product);
4252
 
4253
  return apply_filters('yoast_gtin13_attribute_value', $yoast_gtin13_value, $product);
4261
  * @return mixed
4262
  * @since 4.4.4
4263
  */
4264
+ protected function yoast_gtin14( $product ) {
 
4265
  $yoast_gtin14_value = woo_feed_get_yoast_identifiers_value('gtin14', $product);
4266
 
4267
  return apply_filters('yoast_gtin14_attribute_value', $yoast_gtin14_value, $product);
4275
  * @return mixed
4276
  * @since 4.4.4
4277
  */
4278
+ protected function yoast_isbn( $product ) {
 
4279
  $yoast_isbn_value = woo_feed_get_yoast_identifiers_value('isbn', $product);
4280
 
4281
  return apply_filters('yoast_isbn_attribute_value', $yoast_isbn_value, $product);
4289
  * @return mixed
4290
  * @since 4.4.4
4291
  */
4292
+ protected function yoast_mpn( $product ) {
 
4293
  $yoast_mpn_value = woo_feed_get_yoast_identifiers_value('mpn', $product);
4294
 
4295
  return apply_filters('yoast_mpn_attribute_value', $yoast_mpn_value, $product);
4303
  * @return mixed
4304
  * @since 5.2.66
4305
  */
4306
+ protected function rank_math_gtin( $product ) {
 
4307
  $product_id = woo_feed_parent_product_id($product);
4308
  $rankmath_gtin_value = get_post_meta($product_id, '_rank_math_gtin_code');
4309
+ $rankmath_gtin_value = ! empty($rankmath_gtin_value) && is_array($rankmath_gtin_value) ? $rankmath_gtin_value[0] : '';
4310
 
4311
  return apply_filters('rankmath_gtin_attribute_value', $rankmath_gtin_value, $product);
4312
  }
includes/classes/class-woo-feed-savefile.php CHANGED
@@ -61,7 +61,7 @@ class Woo_Feed_Savefile {
61
  }elseif ( 'json' === $type ) {
62
  $fp = fopen( $file, 'w' ); // phpcs:ignore
63
 
64
- if( isset($info['provider']) && 'adform' === $info['provider'] ) {
65
  $json_content['products']['product'] = $content;
66
  }else {
67
  $json_content = $content;
61
  }elseif ( 'json' === $type ) {
62
  $fp = fopen( $file, 'w' ); // phpcs:ignore
63
 
64
+ if ( isset($info['provider']) && 'adform' === $info['provider'] ) {
65
  $json_content['products']['product'] = $content;
66
  }else {
67
  $json_content = $content;
includes/classes/class-woo-feed-shipping.php CHANGED
@@ -48,7 +48,7 @@ class Woo_Feed_Shipping {
48
  $this->obj_v3 = apply_filters("woo_feed_filter_object_v3", $obj_v3);
49
  }
50
 
51
- public function set_product($product) {
52
  $this->product = $product;
53
 
54
  return $this;
@@ -98,7 +98,7 @@ class Woo_Feed_Shipping {
98
  return $class_cost_id;
99
  }
100
 
101
- public function set_shipping_zone($shipping_zones) {
102
  $this->shipping_zones = $shipping_zones;
103
 
104
  return $this;
@@ -209,21 +209,21 @@ class Woo_Feed_Shipping {
209
  $shipping_method['id'] = $method->id;
210
  $shipping_method['instance_id'] = $method->instance_id;
211
 
212
- if( isset($shipping_method['id']) && $shipping_method['instance_id'] && 'table_rate' === $shipping_method['id'] ) {
213
  // When Woocommerce Table Rate plugin by Woocommerce is active
214
- if( is_plugin_active('woocommerce-table-rate-shipping/woocommerce-table-rate-shipping.php') ) {
215
  $wc_table_rate = new WC_Shipping_Table_Rate($shipping_method['instance_id']);
216
  $matching_rates = $wc_table_rate->query_rates( array(
217
- 'price' => $this->product->get_price(),
218
- 'weight' => (float) $this->product->get_weight(),
219
- 'count' => 1,
220
- 'count_in_class' => 1,
221
- 'shipping_class_id' => $this->product->get_shipping_class_id()
222
  ) );
223
  $table_rate_ids = wp_list_pluck($matching_rates, 'rate_id');
224
 
225
- if( isset($table_rate_ids) && is_array($table_rate_ids) ) {
226
- foreach ($table_rate_ids as $id) {
227
  $shipping_method['table_rate_id'] = $id;
228
  $shipping_cost = $this->get_shipping_cost($shipping, $shipping_method);
229
  $shipping['price'] = $shipping_cost;
@@ -235,9 +235,8 @@ class Woo_Feed_Shipping {
235
  continue;
236
  }
237
  }
238
- }
239
-
240
- } else {
241
 
242
  //when only_local_pickup_shipping is disabled then skip the local pickup method
243
  if ( "local_pickup" === $method->id ) {
@@ -255,7 +254,7 @@ class Woo_Feed_Shipping {
255
  }
256
 
257
 
258
- if( isset($shipping) && !empty($shipping) ) {
259
  $shipping_cost = $this->get_shipping_cost($shipping, $shipping_method);
260
  $shipping['price'] = $shipping_cost;
261
  }
@@ -266,12 +265,11 @@ class Woo_Feed_Shipping {
266
  continue 3;
267
  }
268
 
269
- if( isset($shipping) ) {
270
  $shipping_info[] = $shipping;
271
  }
272
- }
273
-
274
- }
275
  }
276
 
277
  return $shipping_info;
@@ -314,19 +312,19 @@ class Woo_Feed_Shipping {
314
  }
315
 
316
  // set shipping method in the cart
317
- if( isset($method['id'] ) && $method['instance_id'] ) {
318
  $chosen_ship_method_id = $method['id'] . ':' . $method['instance_id'];
319
  $chosen_ship_method_id = apply_filters('woo_feed_filter_chosen_method_id', $chosen_ship_method_id, $shipping, $method);
320
  WC()->session->set('chosen_shipping_methods', array( $chosen_ship_method_id ) );
321
  }
322
 
323
  // get product id
324
- if( "variation" === $this->product->get_type() ) {
325
  $id = $this->product->get_parent_id();
326
- } elseif( "grouped" === $this->product->get_type() ) {
327
  $id = $this->product->get_children();
328
  $id = reset($id);
329
- } else{
330
  $id = $this->product->get_id();
331
  }
332
 
@@ -340,7 +338,7 @@ class Woo_Feed_Shipping {
340
  }
341
 
342
  // reset chosen shipping methods in the cart
343
- if( isset($method['id'] ) && $method['instance_id'] ) {
344
  WC()->session->set('chosen_shipping_methods', array( '' ) );
345
  }
346
 
@@ -436,12 +434,12 @@ class Woo_Feed_Shipping {
436
  if ( in_array($shipping_item_attr,$merchant_attributes,true) ) {
437
  $m_key = array_search($shipping_item_attr, $merchant_attributes,true);
438
 
439
- if( isset($this->config['type'][$m_key]) && $this->config['attributes'][$m_key] && $this->config['mattributes'][$m_key] ) {
440
- if ('pattern' == $this->config['type'][$m_key]) {
441
- $attributeValue = $this->config['default'][$m_key];
442
  } else { // Get Attribute value
443
- $attributeValue = $this->obj_v3->getAttributeValueByType($this->product, $this->config['attributes'][$m_key], $this->config['mattributes'][$m_key]);
444
- $attributeValue = apply_filters("woo_feed_get_attribute_value_for_shipping", $attributeValue, $this->product, $this->config['attributes'][$m_key], $this->config['mattributes'][$m_key]);
445
  }
446
  } else {
447
  $attributeValue = isset($this->config['default'][ $m_key ]) ? $this->config['default'][ $m_key ] : "";
@@ -472,7 +470,7 @@ class Woo_Feed_Shipping {
472
  foreach ( $shipping_arr as $k => $shipping_item ) {
473
  $shipping_child = '';
474
  foreach ( $shipping_item as $shipping_item_attr => $shipping_value ) {
475
- if ('bing'===$this->config['provider'] && "region" === $shipping_item_attr ) {
476
  continue;
477
  }
478
 
48
  $this->obj_v3 = apply_filters("woo_feed_filter_object_v3", $obj_v3);
49
  }
50
 
51
+ public function set_product( $product ) {
52
  $this->product = $product;
53
 
54
  return $this;
98
  return $class_cost_id;
99
  }
100
 
101
+ public function set_shipping_zone( $shipping_zones ) {
102
  $this->shipping_zones = $shipping_zones;
103
 
104
  return $this;
209
  $shipping_method['id'] = $method->id;
210
  $shipping_method['instance_id'] = $method->instance_id;
211
 
212
+ if ( isset($shipping_method['id']) && $shipping_method['instance_id'] && 'table_rate' === $shipping_method['id'] ) {
213
  // When Woocommerce Table Rate plugin by Woocommerce is active
214
+ if ( is_plugin_active('woocommerce-table-rate-shipping/woocommerce-table-rate-shipping.php') ) {
215
  $wc_table_rate = new WC_Shipping_Table_Rate($shipping_method['instance_id']);
216
  $matching_rates = $wc_table_rate->query_rates( array(
217
+ 'price' => $this->product->get_price(),
218
+ 'weight' => (float) $this->product->get_weight(),
219
+ 'count' => 1,
220
+ 'count_in_class' => 1,
221
+ 'shipping_class_id' => $this->product->get_shipping_class_id(),
222
  ) );
223
  $table_rate_ids = wp_list_pluck($matching_rates, 'rate_id');
224
 
225
+ if ( isset($table_rate_ids) && is_array($table_rate_ids) ) {
226
+ foreach ( $table_rate_ids as $id ) {
227
  $shipping_method['table_rate_id'] = $id;
228
  $shipping_cost = $this->get_shipping_cost($shipping, $shipping_method);
229
  $shipping['price'] = $shipping_cost;
235
  continue;
236
  }
237
  }
238
+ }
239
+ } else {
 
240
 
241
  //when only_local_pickup_shipping is disabled then skip the local pickup method
242
  if ( "local_pickup" === $method->id ) {
254
  }
255
 
256
 
257
+ if ( isset($shipping) && ! empty($shipping) ) {
258
  $shipping_cost = $this->get_shipping_cost($shipping, $shipping_method);
259
  $shipping['price'] = $shipping_cost;
260
  }
265
  continue 3;
266
  }
267
 
268
+ if ( isset($shipping) ) {
269
  $shipping_info[] = $shipping;
270
  }
271
+ }
272
+ }
 
273
  }
274
 
275
  return $shipping_info;
312
  }
313
 
314
  // set shipping method in the cart
315
+ if ( isset($method['id'] ) && $method['instance_id'] ) {
316
  $chosen_ship_method_id = $method['id'] . ':' . $method['instance_id'];
317
  $chosen_ship_method_id = apply_filters('woo_feed_filter_chosen_method_id', $chosen_ship_method_id, $shipping, $method);
318
  WC()->session->set('chosen_shipping_methods', array( $chosen_ship_method_id ) );
319
  }
320
 
321
  // get product id
322
+ if ( "variation" === $this->product->get_type() ) {
323
  $id = $this->product->get_parent_id();
324
+ } elseif ( "grouped" === $this->product->get_type() ) {
325
  $id = $this->product->get_children();
326
  $id = reset($id);
327
+ } else {
328
  $id = $this->product->get_id();
329
  }
330
 
338
  }
339
 
340
  // reset chosen shipping methods in the cart
341
+ if ( isset($method['id'] ) && $method['instance_id'] ) {
342
  WC()->session->set('chosen_shipping_methods', array( '' ) );
343
  }
344
 
434
  if ( in_array($shipping_item_attr,$merchant_attributes,true) ) {
435
  $m_key = array_search($shipping_item_attr, $merchant_attributes,true);
436
 
437
+ if ( isset($this->config['type'][ $m_key ]) && $this->config['attributes'][ $m_key ] && $this->config['mattributes'][ $m_key ] ) {
438
+ if ( 'pattern' == $this->config['type'][ $m_key ] ) {
439
+ $attributeValue = $this->config['default'][ $m_key ];
440
  } else { // Get Attribute value
441
+ $attributeValue = $this->obj_v3->getAttributeValueByType($this->product, $this->config['attributes'][ $m_key ], $this->config['mattributes'][ $m_key ]);
442
+ $attributeValue = apply_filters("woo_feed_get_attribute_value_for_shipping", $attributeValue, $this->product, $this->config['attributes'][ $m_key ], $this->config['mattributes'][ $m_key ]);
443
  }
444
  } else {
445
  $attributeValue = isset($this->config['default'][ $m_key ]) ? $this->config['default'][ $m_key ] : "";
470
  foreach ( $shipping_arr as $k => $shipping_item ) {
471
  $shipping_child = '';
472
  foreach ( $shipping_item as $shipping_item_attr => $shipping_value ) {
473
+ if ( 'bing' === $this->config['provider'] && "region" === $shipping_item_attr ) {
474
  continue;
475
  }
476
 
includes/classes/class-woo-feed-webappick-api.php CHANGED
@@ -85,7 +85,7 @@ if ( ! class_exists( 'WooFeedWebAppickAPI' ) ) {
85
  add_action( 'admin_menu', [ $this, 'premium_features' ], 999 );
86
 
87
  //show admin notices when woocommerce is activated
88
- if( is_plugin_active('woocommerce/woocommerce.php') ) {
89
  add_action( 'admin_notices', [ $this, 'woo_feed_review_notice' ] );
90
  add_action('wp_ajax_woo_feed_save_review_notice', [ $this, 'woo_feed_save_review_notice' ] );
91
  add_action('wp_ajax_woo_feed_hide_notice', [ $this, 'woo_feed_hide_notice' ] );
@@ -110,9 +110,9 @@ if ( ! class_exists( 'WooFeedWebAppickAPI' ) ) {
110
  $result = $wpdb->get_results( $wpdb->prepare("SELECT * FROM $wpdb->options WHERE option_name LIKE %s;", "wf_feed_%"), 'ARRAY_A' ); // phpcs:ignore
111
  if ( ! is_array( $result ) ) $result = [];
112
  $catCount = wp_count_terms( array(
113
- 'taxonomy' => 'product_cat',
114
- 'hide_empty' => false,
115
- 'parent' => 0,
116
  ));
117
  if ( is_wp_error( $catCount ) ) $catCount = 0;
118
  /**
@@ -392,29 +392,29 @@ if ( ! class_exists( 'WooFeedWebAppickAPI' ) ) {
392
  $user_id = get_current_user_id();
393
 
394
  //submit review notice dismissal
395
- if( isset($_POST['woo_feed_review_notice_submit']) ) {
396
  add_user_meta( $user_id, 'woo_feed_review_notice_dismissed', true, true );
397
  update_option( 'woo_feed_review_notice_next_show_time', time() + ( DAY_IN_SECONDS * 30 ) );
398
  }
399
 
400
  //submit review notice form data
401
- if( isset( $_POST['woo_feed_review_notice_btn_given'] ) ) {
402
  wp_redirect('https://wordpress.org/support/plugin/webappick-product-feed-for-woocommerce/reviews/?rate=5#new-post');
403
  exit();
404
- } elseif( isset( $_POST['woo_feed_review_notice_btn_never'] ) || isset( $_POST['woo_feed_review_notice_btn_done'] ) ) {
405
- if( isset( $_POST['woo_feed_review_notice_btn_never'] ) ) {
406
  $notice = $_POST['woo_feed_review_notice_btn_never'];
407
  }else {
408
  $notice = $_POST['woo_feed_review_notice_btn_done'];
409
  }
410
 
411
  add_user_meta( $user_id, 'woo_feed_review_notice_dismissed', true, true );
412
- } elseif( isset( $_POST['woo_feed_review_notice_btn_later'] ) ) {
413
  $notice = $_POST['woo_feed_review_notice_btn_later'];
414
  update_option( 'woo_feed_review_notice_next_show_time', time() + ( DAY_IN_SECONDS * 30 ) );
415
  }
416
 
417
- if( !empty($notice) ) {
418
  $value = [
419
  'review_notice' => sanitize_text_field($notice), //phpcs:ignore
420
  'updated_at' => time(),
85
  add_action( 'admin_menu', [ $this, 'premium_features' ], 999 );
86
 
87
  //show admin notices when woocommerce is activated
88
+ if ( is_plugin_active('woocommerce/woocommerce.php') ) {
89
  add_action( 'admin_notices', [ $this, 'woo_feed_review_notice' ] );
90
  add_action('wp_ajax_woo_feed_save_review_notice', [ $this, 'woo_feed_save_review_notice' ] );
91
  add_action('wp_ajax_woo_feed_hide_notice', [ $this, 'woo_feed_hide_notice' ] );
110
  $result = $wpdb->get_results( $wpdb->prepare("SELECT * FROM $wpdb->options WHERE option_name LIKE %s;", "wf_feed_%"), 'ARRAY_A' ); // phpcs:ignore
111
  if ( ! is_array( $result ) ) $result = [];
112
  $catCount = wp_count_terms( array(
113
+ 'taxonomy' => 'product_cat',
114
+ 'hide_empty' => false,
115
+ 'parent' => 0,
116
  ));
117
  if ( is_wp_error( $catCount ) ) $catCount = 0;
118
  /**
392
  $user_id = get_current_user_id();
393
 
394
  //submit review notice dismissal
395
+ if ( isset($_POST['woo_feed_review_notice_submit']) ) {
396
  add_user_meta( $user_id, 'woo_feed_review_notice_dismissed', true, true );
397
  update_option( 'woo_feed_review_notice_next_show_time', time() + ( DAY_IN_SECONDS * 30 ) );
398
  }
399
 
400
  //submit review notice form data
401
+ if ( isset( $_POST['woo_feed_review_notice_btn_given'] ) ) {
402
  wp_redirect('https://wordpress.org/support/plugin/webappick-product-feed-for-woocommerce/reviews/?rate=5#new-post');
403
  exit();
404
+ } elseif ( isset( $_POST['woo_feed_review_notice_btn_never'] ) || isset( $_POST['woo_feed_review_notice_btn_done'] ) ) {
405
+ if ( isset( $_POST['woo_feed_review_notice_btn_never'] ) ) {
406
  $notice = $_POST['woo_feed_review_notice_btn_never'];
407
  }else {
408
  $notice = $_POST['woo_feed_review_notice_btn_done'];
409
  }
410
 
411
  add_user_meta( $user_id, 'woo_feed_review_notice_dismissed', true, true );
412
+ } elseif ( isset( $_POST['woo_feed_review_notice_btn_later'] ) ) {
413
  $notice = $_POST['woo_feed_review_notice_btn_later'];
414
  update_option( 'woo_feed_review_notice_next_show_time', time() + ( DAY_IN_SECONDS * 30 ) );
415
  }
416
 
417
+ if ( ! empty($notice) ) {
418
  $value = [
419
  'review_notice' => sanitize_text_field($notice), //phpcs:ignore
420
  'updated_at' => time(),
includes/feeds/class-woo-feed-review.php CHANGED
@@ -240,7 +240,7 @@ class Woo_Feed_Review {
240
  array(
241
  'post_id' => $id,
242
  'post_type' => 'product',
243
- 'parent' => 0
244
  )
245
  );
246
 
@@ -251,13 +251,13 @@ class Woo_Feed_Review {
251
  $review_content = $single_review->comment_content;
252
  $rating = get_comment_meta( $single_review->comment_ID, 'rating', true);
253
  $review_content = woo_feed_strip_all_tags(wp_specialchars_decode($review_content));
254
- $review_content = preg_replace('/[^A-Za-z0-9-]/', ' ', $review_content);;
255
- $review_content = !empty($review_content) ? "<![CDATA[" . woo_feed_strip_all_tags(wp_specialchars_decode($review_content)) . "]]>" : "";
256
- $review_product_url = !empty($product->get_permalink()) ? "<![CDATA[" . $product->get_permalink() . "]]>" : "";
257
- $review_id = !empty($single_review->comment_ID) ? "<![CDATA[" . $single_review->comment_ID . "]]>" : "";
258
- $review_author = !empty($single_review->comment_author) ? "<![CDATA[" . $single_review->comment_author . "]]>" : "";
259
- $review_user_id = !empty($single_review->user_id) ? "<![CDATA[" . $single_review->user_id . "]]>" : "";
260
- $review_time = !empty($single_review->comment_date_gmt) ? "<![CDATA[" . $single_review->comment_date_gmt . "]]>" : "";
261
 
262
  $review['review']['review_id'] = $review_id;
263
  $review['review']['reviewer']['name'] = $review_author;
@@ -287,7 +287,7 @@ class Woo_Feed_Review {
287
 
288
  //add prefix - suffix to attribute value
289
  $attributeValue = $prefix . $attributeValue . $suffix;
290
- $attributeValue = !empty($attributeValue) ? "<![CDATA[" . $attributeValue . "]]>" : "";
291
 
292
  if ( "review_temp_gtin" === $merchant_attribute ) {
293
  $review['review']['products']['product']['product_ids']['gtins']['gtin'] = $attributeValue;
240
  array(
241
  'post_id' => $id,
242
  'post_type' => 'product',
243
+ 'parent' => 0,
244
  )
245
  );
246
 
251
  $review_content = $single_review->comment_content;
252
  $rating = get_comment_meta( $single_review->comment_ID, 'rating', true);
253
  $review_content = woo_feed_strip_all_tags(wp_specialchars_decode($review_content));
254
+ $review_content = preg_replace('/[^A-Za-z0-9-]/', ' ', $review_content);
255
+ $review_content = ! empty($review_content) ? "<![CDATA[" . woo_feed_strip_all_tags(wp_specialchars_decode($review_content)) . "]]>" : "";
256
+ $review_product_url = ! empty($product->get_permalink()) ? "<![CDATA[" . $product->get_permalink() . "]]>" : "";
257
+ $review_id = ! empty($single_review->comment_ID) ? "<![CDATA[" . $single_review->comment_ID . "]]>" : "";
258
+ $review_author = ! empty($single_review->comment_author) ? "<![CDATA[" . $single_review->comment_author . "]]>" : "";
259
+ $review_user_id = ! empty($single_review->user_id) ? "<![CDATA[" . $single_review->user_id . "]]>" : "";
260
+ $review_time = ! empty($single_review->comment_date_gmt) ? "<![CDATA[" . $single_review->comment_date_gmt . "]]>" : "";
261
 
262
  $review['review']['review_id'] = $review_id;
263
  $review['review']['reviewer']['name'] = $review_author;
287
 
288
  //add prefix - suffix to attribute value
289
  $attributeValue = $prefix . $attributeValue . $suffix;
290
+ $attributeValue = ! empty($attributeValue) ? "<![CDATA[" . $attributeValue . "]]>" : "";
291
 
292
  if ( "review_temp_gtin" === $merchant_attribute ) {
293
  $review['review']['products']['product']['product_ids']['gtins']['gtin'] = $attributeValue;
includes/helper.php CHANGED
@@ -9,11 +9,11 @@
9
  * @copyright WebAppick
10
  */
11
 
12
- if (!defined('ABSPATH')) {
13
  die(); // Silence...
14
  }
15
 
16
- if (!function_exists('woo_feed_maybe_define_constant')) {
17
  /**
18
  * Define a constant if it is not already defined.
19
  *
@@ -23,8 +23,7 @@ if (!function_exists('woo_feed_maybe_define_constant')) {
23
  * @return void
24
  * @since 3.2.1
25
  */
26
- function woo_feed_maybe_define_constant($name, $value)
27
- {
28
  // phpcs:disable
29
  if (!defined($name)) {
30
  define($name, $value);
@@ -32,7 +31,7 @@ if (!function_exists('woo_feed_maybe_define_constant')) {
32
  // phpcs:enable
33
  }
34
  }
35
- if (!function_exists('woo_feed_doing_it_wrong')) {
36
  /**
37
  * Wrapper for _doing_it_wrong.
38
  *
@@ -44,8 +43,7 @@ if (!function_exists('woo_feed_doing_it_wrong')) {
44
  * @since 3.2.1
45
  *
46
  */
47
- function woo_feed_doing_it_wrong($function, $message, $version)
48
- {
49
  // phpcs:disable
50
  $message .= ' Backtrace: ' . wp_debug_backtrace_summary();
51
 
@@ -58,19 +56,18 @@ if (!function_exists('woo_feed_doing_it_wrong')) {
58
  // phpcs:enable
59
  }
60
  }
61
- if (!function_exists('is_ajax')) {
62
 
63
  /**
64
  * Is_ajax - Returns true when the page is loaded via ajax.
65
  *
66
  * @return bool
67
  */
68
- function is_ajax()
69
- {
70
  return function_exists('wp_doing_ajax') ? wp_doing_ajax() : defined('DOING_AJAX');
71
  }
72
  }
73
- if (!function_exists('woo_feed_is_plugin_active')) {
74
  /**
75
  * Determines whether a plugin is active.
76
  *
@@ -81,16 +78,15 @@ if (!function_exists('woo_feed_is_plugin_active')) {
81
  * @see is_plugin_active()
82
  *
83
  */
84
- function woo_feed_is_plugin_active($plugin)
85
- {
86
- if (!function_exists('is_plugin_active')) {
87
  include_once ABSPATH . 'wp-admin/includes/plugin.php';
88
  }
89
 
90
  return is_plugin_active($plugin);
91
  }
92
  }
93
- if (!function_exists('wooFeed_is_plugin_inactive')) {
94
  /**
95
  * Determines whether the plugin is inactive.
96
  *
@@ -101,12 +97,11 @@ if (!function_exists('wooFeed_is_plugin_inactive')) {
101
  * @see wooFeed_is_plugin_inactive()
102
  *
103
  */
104
- function wooFeed_is_plugin_inactive($plugin)
105
- {
106
- return !woo_feed_is_plugin_active($plugin);
107
  }
108
  }
109
- if (!function_exists('wooFeed_deactivate_plugins')) {
110
  /**
111
  * Deactivate a single plugin or multiple plugins.
112
  * Wrapper for core deactivate_plugins() function
@@ -119,40 +114,36 @@ if (!function_exists('wooFeed_deactivate_plugins')) {
119
  * @see deactivate_plugins()
120
  *
121
  */
122
- function wooFeed_Deactivate_plugins($plugins, $silent = false, $network_wide = null)
123
- {
124
- if (!function_exists('deactivate_plugins')) {
125
  require_once(ABSPATH . 'wp-admin/includes/plugin.php');
126
  }
127
  deactivate_plugins($plugins, $silent, $network_wide);
128
  }
129
  }
130
- if (!function_exists('wooFeed_is_supported_php')) {
131
  /**
132
  * Check if server php version meet minimum requirement
133
  * @return bool
134
  * @since 3.1.41
135
  */
136
- function wooFeed_is_supported_php()
137
- {
138
  // PHP version need to be => WOO_FEED_MIN_PHP_VERSION
139
- return !version_compare(PHP_VERSION, WOO_FEED_MIN_PHP_VERSION, '<');
140
  }
141
  }
142
- if (!function_exists('wooFeed_check_WC')) {
143
- function wooFeed_check_WC()
144
- {
145
  return class_exists('WooCommerce', false);
146
  }
147
  }
148
- if (!function_exists('wooFeed_is_WC_supported')) {
149
- function wooFeed_is_WC_supported()
150
- {
151
  // Ensure WC is loaded before checking version
152
  return (defined('WC_VERSION') && version_compare(WC_VERSION, WOO_FEED_MIN_WC_VERSION, '>='));
153
  }
154
  }
155
- if (!function_exists('woo_feed_wc_version_check')) {
156
  /**
157
  * Check WooCommerce Version
158
  *
@@ -160,15 +151,14 @@ if (!function_exists('woo_feed_wc_version_check')) {
160
  *
161
  * @return bool
162
  */
163
- function woo_feed_wc_version_check($version = '3.0')
164
- {
165
- if (!function_exists('get_plugins')) {
166
  require_once ABSPATH . 'wp-admin/includes/plugin.php';
167
  }
168
  $plugins = get_plugins();
169
- if (array_key_exists('woocommerce/woocommerce.php', $plugins)) {
170
  $currentVersion = $plugins['woocommerce/woocommerce.php']['Version'];
171
- if (version_compare($currentVersion, $version, '>=')) {
172
  return true;
173
  }
174
  }
@@ -176,7 +166,7 @@ if (!function_exists('woo_feed_wc_version_check')) {
176
  return false;
177
  }
178
  }
179
- if (!function_exists('woo_feed_wpml_version_check')) {
180
  /**
181
  * Check WooCommerce Version
182
  *
@@ -184,11 +174,10 @@ if (!function_exists('woo_feed_wpml_version_check')) {
184
  *
185
  * @return bool
186
  */
187
- function woo_feed_wpml_version_check($version = '3.2')
188
- {
189
  // calling this function too early (before wc loaded) will not give correct output
190
- if (defined('ICL_SITEPRESS_VERSION')) {
191
- if (version_compare(ICL_SITEPRESS_VERSION, $version, '>=')) {
192
  return true;
193
  }
194
  }
@@ -196,18 +185,17 @@ if (!function_exists('woo_feed_wpml_version_check')) {
196
  return false;
197
  }
198
  }
199
- if (!function_exists('wooFeed_Admin_Notices')) {
200
  /**
201
  * Display Admin Messages
202
  * @hooked admin_notices
203
  * @return void
204
  * @since 3.1.41
205
  */
206
- function wooFeed_Admin_Notices()
207
- {
208
  // @TODO Refactor this function with admin message class
209
  // WC Missing Notice..
210
- if (!wooFeed_check_WC()) {
211
  $plugin_url = self_admin_url('plugin-install.php?s=woocommerce&tab=search&type=term');
212
  /**
213
  * @noinspection HtmlUnknownTarget
@@ -224,7 +212,7 @@ if (!function_exists('wooFeed_Admin_Notices')) {
224
  );
225
  printf('<div class="error"><p><strong>%1$s</strong></p></div>', $message); // phpcs:ignore
226
  }
227
- if (wooFeed_check_WC() && !wooFeed_is_WC_supported()) {
228
  $plugin_url = self_admin_url('plugin-install.php?s=woocommerce&tab=search&type=term');
229
  $wcVersion = defined('WC_VERSION') ? '<code>' . WC_VERSION . '</code>' : '<code>UNKNOWN</code>';
230
  $minVersion = '<code>' . WOO_FEED_MIN_WC_VERSION . '</code>';
@@ -247,17 +235,16 @@ if (!function_exists('wooFeed_Admin_Notices')) {
247
  }
248
  }
249
  }
250
- if (!function_exists('woo_feed_black_friday_notice')) {
251
  /**
252
  * CTX Feed Black Friday Notice
253
  *
254
  * @since 4.4.35
255
  * @author Nazrul Islam Nayan
256
  */
257
- function woo_feed_black_friday_notice()
258
- {
259
  $user_id = get_current_user_id();
260
- if (!get_user_meta($user_id, 'woo_feed_black_friday_notice_2021_dismissed')) {
261
  ob_start();
262
  ?>
263
  <script type="text/javascript">
@@ -288,14 +275,13 @@ if (!function_exists('woo_feed_black_friday_notice')) {
288
  }
289
  }
290
  }
291
- if (!function_exists('woo_feed_progress_bar')) {
292
  /**
293
  * Feed Progress Bar
294
  *
295
  * @since 4.1.1
296
  */
297
- function woo_feed_progress_bar()
298
- {
299
  $progress_bar = '';
300
  ob_start();
301
  ?>
@@ -337,29 +323,27 @@ if (!function_exists('woo_feed_progress_bar')) {
337
  }
338
  }
339
 
340
- if (!function_exists('checkFTP_connection')) {
341
  /**
342
  * Verify if ftp module enabled
343
  * @TODO improve module detection
344
  * @return bool
345
  */
346
- function checkFTP_connection()
347
- {
348
  return (extension_loaded('ftp') || function_exists('ftp_connect'));
349
  }
350
  }
351
- if (!function_exists('checkSFTP_connection')) {
352
  /**
353
  * Verify if ssh/sftp module enabled
354
  * @TODO improve module detection
355
  * @return bool
356
  */
357
- function checkSFTP_connection()
358
- {
359
  return (extension_loaded('ssh2') || function_exists('ssh2_connect'));
360
  }
361
  }
362
- if (!function_exists('array_splice_assoc')) {
363
  /**
364
  * Array Splice Associative Array
365
  * @see https://www.php.net/manual/en/function.array-splice.php#111204
@@ -371,15 +355,14 @@ if (!function_exists('array_splice_assoc')) {
371
  *
372
  * @return array
373
  */
374
- function array_splice_assoc($input, $offset, $length, $replacement)
375
- {
376
  $replacement = (array)$replacement;
377
  $key_indices = array_flip(array_keys($input));
378
- if (isset($input[$offset]) && is_string($offset)) {
379
- $offset = $key_indices[$offset] + 1;
380
  }
381
- if (isset($input[$length]) && is_string($length)) {
382
- $length = $key_indices[$length] - $offset;
383
  }
384
 
385
  $input = array_slice($input, 0, $offset, true) + $replacement + array_slice($input, $offset + $length, null, true);
@@ -387,7 +370,7 @@ if (!function_exists('array_splice_assoc')) {
387
  return $input;
388
  }
389
  }
390
- if (!function_exists('woo_feed_get_query_type_options')) {
391
  /**
392
  * Get Query available Types
393
  *
@@ -395,77 +378,73 @@ if (!function_exists('woo_feed_get_query_type_options')) {
395
  * @return array
396
  * @since 3.3.11
397
  */
398
- function woo_feed_get_query_type_options($type='')
399
- {
400
- if('variation' === $type){
401
  return [
402
  'individual' => __('Individual', 'woo-feed'),
403
- 'variable' => __('Variable Dependable', 'woo-feed'),
404
  ];
405
- }else{
406
  return [
407
- 'wc' => __('WC_Product_Query', 'woo-feed'),
408
- 'wp' => __('WP_Query', 'woo-feed'),
409
  'both' => __('Both', 'woo-feed'),
410
  ];
411
  }
412
  }
413
  }
414
- if (!function_exists('woo_feed_get_cache_ttl_options')) {
415
  /**
416
  * Cache Expiration Options
417
  * @return array
418
  */
419
- function woo_feed_get_cache_ttl_options()
420
- {
421
  return apply_filters(
422
  'woo_feed_cache_ttl_options',
423
  [
424
- 0 => esc_html__('No Expiration ', 'woo-feed'),
425
- MONTH_IN_SECONDS => esc_html__('1 Month', 'woo-feed'),
426
- WEEK_IN_SECONDS => esc_html__('1 Week', 'woo-feed'),
427
- DAY_IN_SECONDS => esc_html__('24 Hours', 'woo-feed'),
428
  12 * HOUR_IN_SECONDS => esc_html__('12 Hours', 'woo-feed'),
429
- 6 * HOUR_IN_SECONDS => esc_html__('6 Hours', 'woo-feed'),
430
- HOUR_IN_SECONDS => esc_html__('1 Hours', 'woo-feed'),
431
  ]
432
  );
433
  }
434
  }
435
- if (!function_exists('woo_feed_get_custom2_merchant')) {
436
  /**
437
  * Get Merchant list that are allowed on Custom2 Template
438
  * @return array
439
  */
440
- function woo_feed_get_custom2_merchant()
441
- {
442
- return array('custom2', 'admarkt', 'yandex_xml', 'glami');
443
  }
444
  }
445
- if (!function_exists('woo_feed_get_merchant_class')) {
446
  /**
447
  * @param string $provider
448
  *
449
  * @return string
450
  */
451
- function woo_feed_get_merchant_class($provider)
452
- {
453
- if (in_array($provider, ['google', 'google_shopping_action', 'google_local', 'google_local_inventory', 'adroll', 'smartly.io'], true)) {
454
  return 'Woo_Feed_Google';
455
- } elseif (in_array($provider, array('pinterest', 'pinterest_rss'))) {
456
  return 'Woo_Feed_Pinterest';
457
- } elseif ('facebook' === $provider) {
458
  return 'Woo_Feed_Facebook';
459
- } elseif (strpos($provider, 'amazon') !== false) {
460
  return 'Woo_Feed_Amazon';
461
- } elseif (in_array($provider, woo_feed_get_custom2_merchant(), true)) {
462
  return 'Woo_Feed_Custom_XML';
463
  } else {
464
  return 'Woo_Feed_Custom';
465
  }
466
  }
467
  }
468
- if (!function_exists('woo_feed_handle_file_transfer')) {
469
  /**
470
  * Transfer file as per ftp config
471
  *
@@ -475,10 +454,9 @@ if (!function_exists('woo_feed_handle_file_transfer')) {
475
  *
476
  * @return bool
477
  */
478
- function woo_feed_handle_file_transfer($fileFrom, $fileTo, $info)
479
- {
480
- if (1 === (int)$info['ftpenabled']) {
481
- if (!file_exists($fileFrom)) {
482
  woo_feed_log_feed_process($info['filename'], 'Unable to process file transfer request. File does not exists.');
483
  return false;
484
  }
@@ -487,12 +465,12 @@ if (!function_exists('woo_feed_handle_file_transfer')) {
487
  $ftp_password = sanitize_text_field($info['ftppassword']);
488
  $ftpPath = trailingslashit(untrailingslashit(sanitize_text_field($info['ftppath'])));
489
  $ftp_passive_mode = (isset($info['ftpmode']) && sanitize_text_field($info['ftpmode']) === 'passive') ? true : false;
490
- if (isset($info['ftporsftp']) & 'ftp' === $info['ftporsftp']) {
491
  $ftporsftp = 'ftp';
492
  } else {
493
  $ftporsftp = 'sftp';
494
  }
495
- if (isset($info['ftpport']) && !empty($info['ftpport'])) {
496
  $ftp_port = absint($info['ftpport']);
497
  } else {
498
  $ftp_port = false;
@@ -505,14 +483,13 @@ if (!function_exists('woo_feed_handle_file_transfer')) {
505
  woo_feed_log_feed_process($info['filename'], sprintf('Uploading Feed file via %s.', $ftporsftp));
506
 
507
  try {
508
- if ('ftp' === $ftporsftp) {
509
 
510
  $ftp = new WebAppick\FTP\FTPConnection();
511
- if ($ftp->connect($ftpHost, $ftp_user, $ftp_password, $ftp_passive_mode, $ftp_port)) {
512
  return $ftp->upload_file($fileFrom, $ftpPath . $fileTo);
513
- }
514
-
515
- } elseif ('sftp' === $ftporsftp) {
516
 
517
  $sftp = new WebAppick\FTP\SFTPConnection($ftpHost, $ftp_port);
518
  $sftp->login($ftp_user, $ftp_password);
@@ -520,7 +497,7 @@ if (!function_exists('woo_feed_handle_file_transfer')) {
520
  return $sftp->upload_file($fileFrom, $fileTo, $ftpPath);
521
 
522
  }
523
- } catch (Exception $e) {
524
  $message = 'Error Uploading Feed Via ' . $ftporsftp . PHP_EOL . 'Caught Exception :: ' . $e->getMessage();
525
  woo_feed_log($info['filename'], $message, 'critical', $e, true);
526
  woo_feed_log_fatal_error($message, $e);
@@ -530,39 +507,37 @@ if (!function_exists('woo_feed_handle_file_transfer')) {
530
  return false;
531
  }
532
  }
533
- if (!function_exists('woo_feed_get_file_types')) {
534
- function woo_feed_get_file_types()
535
- {
536
  return array(
537
- 'xml' => 'XML',
538
- 'csv' => 'CSV',
539
- 'tsv' => 'TSV',
540
- 'xls' => 'XLS',
541
- 'txt' => 'TXT',
542
  'json' => 'JSON',
543
  );
544
  }
545
  }
546
- if (!function_exists('woo_feed_get_default_brand')) {
547
  /**
548
  * Guess Brand name from Site URL
549
  *
550
  * @return string
551
  */
552
- function woo_feed_get_default_brand()
553
- {
554
  $brand = apply_filters('woo_feed_pre_get_default_brand_name', null);
555
- if (!is_null($brand)) {
556
  return $brand;
557
  }
558
  $brand = '';
559
  $url = filter_var(site_url(), FILTER_SANITIZE_URL);
560
- if (false !== $url) {
561
  $url = wp_parse_url($url);
562
- if (array_key_exists('host', $url)) {
563
- if (strpos($url['host'], ".") !== false) {
564
  $arr = explode('.', $url['host']);
565
- $brand = $arr[count($arr) - 2];
566
  $brand = ucfirst($brand);
567
  } else {
568
  $brand = $url['host'];
@@ -574,7 +549,7 @@ if (!function_exists('woo_feed_get_default_brand')) {
574
  return apply_filters('woo_feed_get_default_brand_name', $brand);
575
  }
576
  }
577
- if (!function_exists('woo_feed_merchant_require_google_category')) {
578
  /**
579
  * Check if current merchant supports google taxonomy for current attribute.
580
  * @param string $merchant
@@ -582,10 +557,9 @@ if (!function_exists('woo_feed_merchant_require_google_category')) {
582
  *
583
  * @return array|bool
584
  */
585
- function woo_feed_merchant_require_google_category($merchant = null, $attribute = null)
586
- {
587
  $list = [
588
- 'current_category' => [
589
  'google',
590
  'google_shopping_action',
591
  'google_local',
@@ -596,19 +570,18 @@ if (!function_exists('woo_feed_merchant_require_google_category')) {
596
  'pinterest',
597
  'rakuten.de',
598
  ],
599
- 'fb_product_category' => ['facebook'],
600
- 'google_product_category' => ['rakuten.de'],
601
- 'google_category_id' => ['daisycon', 'daisycon_automotive', 'daisycon_books', 'daisycon_cosmetics', 'daisycon_daily_offers', 'daisycon_electronics', 'daisycon_food_drinks', 'daisycon_home_garden', 'daisycon_housing', 'daisycon_fashion', 'daisycon_studies_trainings', 'daisycon_telecom_accessories', 'daisycon_telecom_all_in_one', 'daisycon_telecom_gsm_subscription', 'daisycon_telecom_gsm', 'daisycon_telecom_sim', 'daisycon_magazines', 'daisycon_holidays_accommodations', 'daisycon_holidays_accommodations_and_transport', 'daisycon_holidays_trips', 'daisycon_work_jobs'],
602
  ];
603
- if (null !== $merchant && null !== $attribute) {
604
- return (isset($list[$attribute]) && in_array($merchant, $list[$attribute], true));
605
  }
606
  return $list;
607
  }
608
  }
609
- if (!function_exists('woo_feed_get_item_wrapper_hidden_merchant')) {
610
- function woo_feed_get_item_wrapper_hidden_merchant()
611
- {
612
  return apply_filters(
613
  'woo_feed_item_wrapper_hidden_merchant',
614
  [
@@ -658,7 +631,7 @@ if (!function_exists('woo_feed_get_item_wrapper_hidden_merchant')) {
658
  }
659
 
660
  // The Editor.
661
- if (!function_exists('woo_feed_parse_feed_rules')) {
662
  /**
663
  * Parse Feed Config/Rules to make sure that necessary array keys are exists
664
  * this will reduce the uses of isset() checking
@@ -672,78 +645,77 @@ if (!function_exists('woo_feed_parse_feed_rules')) {
672
  * @uses wp_parse_args
673
  *
674
  */
675
- function woo_feed_parse_feed_rules($rules = [], $context = 'view')
676
- {
677
 
678
- if (empty($rules)) {
679
  $rules = [];
680
  }
681
  $defaults = [
682
- 'provider' => '',
683
- 'filename' => '',
684
- 'feedType' => '',
685
- 'feed_country' => '',
686
- 'ftpenabled' => 0,
687
- 'ftporsftp' => 'ftp',
688
- 'ftphost' => '',
689
- 'ftpport' => '21',
690
- 'ftpuser' => '',
691
- 'ftppassword' => '',
692
- 'ftppath' => '',
693
- 'ftpmode' => 'active',
694
- 'is_variations' => 'y',
695
- 'variable_price' => 'first',
696
- 'variable_quantity' => 'first',
697
- 'feedLanguage' => apply_filters('wpml_current_language', null),
698
- 'feedCurrency' => get_woocommerce_currency(),
699
- 'itemsWrapper' => 'products',
700
- 'itemWrapper' => 'product',
701
- 'delimiter' => ',',
702
- 'enclosure' => 'double',
703
- 'extraHeader' => '',
704
- 'vendors' => [],
705
  // Feed Config
706
- 'mattributes' => [], // merchant attributes
707
- 'prefix' => [], // prefixes
708
- 'type' => [], // value (attribute) types
709
- 'attributes' => [], // product attribute mappings
710
- 'default' => [], // default values (patterns) if value type set to pattern
711
- 'suffix' => [], // suffixes
712
- 'output_type' => [], // output type (output filter)
713
- 'limit' => [], // limit or command
714
  // filters tab
715
- 'composite_price' => '',
716
- 'product_ids' => '',
717
- 'categories' => [],
718
- 'post_status' => ['publish'],
719
- 'filter_mode' => [],
720
  'campaign_parameters' => [],
721
 
722
- 'ptitle_show' => '',
723
- 'decimal_separator' => wc_get_price_decimal_separator(),
724
- 'thousand_separator' => wc_get_price_thousand_separator(),
725
- 'decimals' => wc_get_price_decimals(),
726
  ];
727
  $rules = wp_parse_args($rules, $defaults);
728
  $rules['filter_mode'] = wp_parse_args($rules['filter_mode'],
729
  [
730
  'product_ids' => 'include',
731
- 'categories' => 'include',
732
  'post_status' => 'include',
733
  ]);
734
 
735
  $rules['campaign_parameters'] = wp_parse_args(
736
  $rules['campaign_parameters'],
737
  [
738
- 'utm_source' => '',
739
- 'utm_medium' => '',
740
  'utm_campaign' => '',
741
- 'utm_term' => '',
742
- 'utm_content' => '',
743
  ]
744
  );
745
 
746
- if (!empty($rules['provider']) && is_string($rules['provider'])) {
747
  /**
748
  * filter parsed rules for provider
749
  *
@@ -768,7 +740,7 @@ if (!function_exists('woo_feed_parse_feed_rules')) {
768
  return apply_filters('woo_feed_parsed_rules', $rules, $context);
769
  }
770
  }
771
- if (!function_exists('woo_feed_register_and_do_woo_feed_meta_boxes')) {
772
  /**
773
  * Registers the default Feed Editor MetaBoxes, and runs the `do_meta_boxes` actions.
774
  *
@@ -784,15 +756,14 @@ if (!function_exists('woo_feed_register_and_do_woo_feed_meta_boxes')) {
784
  * @since 3.2.6
785
  *
786
  */
787
- function woo_feed_register_and_do_woo_feed_meta_boxes($screen, $feedRules = array())
788
- {
789
- if (empty($screen)) {
790
  $screen = get_current_screen();
791
- } elseif (is_string($screen)) {
792
  $screen = convert_to_screen($screen);
793
  }
794
  // edit page MetaBoxes
795
- if ('ctx-feed_page_webappick-new-feed' === $screen->id || 'toplevel_page_webappick-manage-feeds' === $screen->id) {
796
  add_meta_box('feed_merchant_info', 'Feed Merchant Info', 'woo_feed_merchant_info_metabox', null, 'side', 'default');
797
  }
798
  /**
@@ -806,46 +777,45 @@ if (!function_exists('woo_feed_register_and_do_woo_feed_meta_boxes')) {
806
  do_action('do_meta_boxes', $screen->id, 'side', $feedRules);
807
  }
808
  }
809
- if (!function_exists('woo_feed_ajax_merchant_info')) {
810
  add_action('wp_ajax_woo_feed_get_merchant_info', 'woo_feed_ajax_merchant_info');
811
- function woo_feed_ajax_merchant_info()
812
- {
813
- if (isset($_REQUEST['nonce']) && wp_verify_nonce(sanitize_text_field(wp_unslash($_REQUEST['nonce'])),
814
- 'wpf_feed_nonce')) {
815
- $provider = (isset($_REQUEST['provider']) && !empty($_REQUEST['provider'])) ? sanitize_text_field(wp_unslash($_REQUEST['provider'])) : '';
816
  $merchantInfo = new Woo_Feed_Merchant($provider);
817
  $data = [];
818
  $na = esc_html__('N/A', 'woo-feed');
819
- foreach ($merchantInfo->get_info() as $k => $v) {
820
- if ('link' === $k) {
821
  /** @noinspection HtmlUnknownTarget */
822
- $data[$k] = empty($v) ? $na : sprintf('<a href="%s" target="_blank">%s</a>',
823
  esc_url($v),
824
  esc_html__('Read Article', 'woo-feed'));
825
- } elseif ('video' === $k) {
826
  /** @noinspection HtmlUnknownTarget */
827
- $data[$k] = empty($v) ? $na : sprintf('<a href="%s" target="_blank">%s</a>',
828
  esc_url($v),
829
  esc_html__('Watch Now', 'woo-feed'));
830
- } elseif ('feed_file_type' === $k) {
831
- if (!empty($v)) {
832
- $v = array_map(function ($type) {
833
  return strtoupper($type);
834
  },
835
  (array)$v);
836
- $data[$k] = esc_html(implode(', ', $v));
837
  } else {
838
- $data[$k] = $na;
839
  }
840
- } elseif ('doc' === $k) {
841
  $links = '';
842
- foreach ($v as $label => $link) {
843
  /** @noinspection HtmlUnknownTarget */
844
  $links .= sprintf('<li><a href="%s" target="_blank">%s</a></li>',
845
  esc_url($link),
846
  esc_html($label));
847
  }
848
- $data[$k] = empty($links) ? $na : $links;
849
  }
850
  }
851
  wp_send_json_success($data);
@@ -855,7 +825,7 @@ if (!function_exists('woo_feed_ajax_merchant_info')) {
855
  die();
856
  }
857
  }
858
- if (!function_exists('woo_feed_merchant_info_metabox')) {
859
  /**
860
  * Render Merchant Info Metabox
861
  *
@@ -863,22 +833,21 @@ if (!function_exists('woo_feed_merchant_info_metabox')) {
863
  *
864
  * @return void
865
  */
866
- function woo_feed_merchant_info_metabox($feedConfig)
867
- {
868
- $provider = (isset($feedConfig['provider']) && !empty($feedConfig['provider'])) ? $feedConfig['provider'] : '';
869
  $merchantInfo = new Woo_Feed_Merchant($provider);
870
 
871
  //get feed options
872
- if (isset($_GET['feed'])) {
873
  $filename = str_replace('wf_feed_', '', wp_unslash($_GET['feed']));
874
  $feed_options = maybe_unserialize(get_option('wf_feed_' . $filename));
875
  }
876
  ?>
877
  <span class="spinner"></span>
878
  <div class="merchant-infos">
879
- <?php foreach ($merchantInfo->get_info() as $k => $v) { ?>
880
  <div class="merchant-info-section <?php echo esc_attr($k); ?>">
881
- <?php if ('link' === $k) { ?>
882
  <span class="dashicons dashicons-media-document" style="color: #82878c;"
883
  aria-hidden="true"></span>
884
  <span><?php esc_html_e('Feed Specification:', 'woo-feed'); ?></span>
@@ -891,7 +860,7 @@ if (!function_exists('woo_feed_merchant_info_metabox')) {
891
  esc_html__('Read Article', 'woo-feed'));
892
  ?>
893
  </strong>
894
- <?php } elseif ('video' === $k) { ?>
895
  <span class="dashicons dashicons-video-alt3" style="color: #82878c;" aria-hidden="true"></span>
896
  <span><?php esc_html_e('Video Documentation:', 'woo-feed'); ?></span>
897
  <strong class="data">
@@ -903,16 +872,16 @@ if (!function_exists('woo_feed_merchant_info_metabox')) {
903
  esc_html__('Watch now', 'woo-feed'));
904
  ?>
905
  </strong>
906
- <?php } elseif ('feed_file_type' === $k) { ?>
907
  <span class="dashicons dashicons-media-text" style="color: #82878c;"
908
  aria-hidden="true"></span> <?php esc_html_e('Supported File Types:', 'woo-feed'); ?>
909
  <strong class="data" style="display: block;padding-left: 24px;margin-top: 5px;">
910
  <?php
911
- if (empty($v)) {
912
  esc_html_e('N/A', 'woo-feed');
913
  } else {
914
  $v = implode(', ',
915
- array_map(function ($type) {
916
  return esc_html(strtoupper($type));
917
  },
918
  (array)$v));
@@ -921,16 +890,16 @@ if (!function_exists('woo_feed_merchant_info_metabox')) {
921
  ?>
922
  </strong>
923
  <?php
924
- } elseif ('doc' === $k) {
925
  ?>
926
  <span class="dashicons dashicons-editor-help" style="color: #82878c;" aria-hidden="true"></span>
927
  <span><?php esc_html_e('Support Docs:', 'woo-feed'); ?></span>
928
  <ul class="data">
929
  <?php
930
- if (empty($v)) {
931
  esc_html_e('N/A', 'woo-feed');
932
  } else {
933
- foreach ($v as $label => $link) {
934
  /** @noinspection HtmlUnknownTarget */
935
  printf('<li><a href="%s" target="_blank">%s</a></li>',
936
  esc_url($link),
@@ -946,7 +915,7 @@ if (!function_exists('woo_feed_merchant_info_metabox')) {
946
  <?php } ?>
947
  <div class="merchant-info-section woo-feed-open-file">
948
  <?php
949
- if (isset($feed_options['url']) && !empty($feed_options['url'])) {
950
  echo sprintf(
951
  '<a href="%1$s" title="%2$s" aria-label="%2$s" target="_blank"><span class="dashicons dashicons-external" aria-hidden="true"></span> %3$s</a>',
952
  $feed_options['url'],
@@ -960,85 +929,79 @@ if (!function_exists('woo_feed_merchant_info_metabox')) {
960
  <?php
961
  }
962
  }
963
- if (!function_exists('woo_feed_get_csv_delimiters')) {
964
  /**
965
  * Get CSV/TXT/TSV Delimiters
966
  * @return array
967
  */
968
- function woo_feed_get_csv_delimiters()
969
- {
970
  return [
971
- ',' => 'Comma',
972
- ':' => 'Colon',
973
- ' ' => 'Space',
974
- '|' => 'Pipe',
975
- ';' => 'Semi Colon',
976
  "\t" => 'TAB',
977
  ];
978
  }
979
  }
980
- if (!function_exists('woo_feed_get_csv_enclosure')) {
981
  /**
982
  * Get CSV/TXT/TSV Enclosure for multiple words
983
  * @return array
984
  */
985
- function woo_feed_get_csv_enclosure()
986
- {
987
  return [
988
  'double' => '"',
989
  'single' => '\'',
990
- ' ' => 'None',
991
  ];
992
  }
993
  }
994
 
995
  // Editor Tabs.
996
- if (!function_exists('render_feed_config')) {
997
  /**
998
  * @param string $tabId
999
  * @param array $feedRules
1000
  * @param bool $idEdit
1001
  */
1002
- function render_feed_config($tabId, $feedRules, $idEdit)
1003
- {
1004
  global $provider, $wooFeedDropDown, $merchant;
1005
  include WOO_FEED_FREE_ADMIN_PATH . 'partials/woo-feed-edit-config.php';
1006
  }
1007
  }
1008
- if (!function_exists('render_filter_config')) {
1009
  /**
1010
  * @param string $tabId
1011
  * @param array $feedRules
1012
  * @param bool $idEdit
1013
  */
1014
- function render_filter_config($tabId, $feedRules, $idEdit)
1015
- {
1016
  global $provider, $wooFeedDropDown, $merchant;
1017
  include WOO_FEED_FREE_ADMIN_PATH . 'partials/woo-feed-edit-filter.php';
1018
  }
1019
  }
1020
- if (!function_exists('render_ftp_config')) {
1021
  /**
1022
  * @param string $tabId
1023
  * @param array $feedRules
1024
  * @param bool $idEdit
1025
  */
1026
- function render_ftp_config($tabId, $feedRules, $idEdit)
1027
- {
1028
  global $provider, $wooFeedDropDown, $merchant;
1029
  include WOO_FEED_FREE_ADMIN_PATH . 'partials/woo-feed-edit-ftp.php';
1030
  }
1031
  }
1032
 
1033
  // Sanitization.
1034
- if (!function_exists('woo_feed_check_google_category')) {
1035
  /**
1036
  * @param array $feedInfo
1037
  *
1038
  * @return string
1039
  */
1040
- function woo_feed_check_google_category($feedInfo)
1041
- {
1042
  // Check Google Product Category for Google & Facebook Template and show message.
1043
  $list = woo_feed_merchant_require_google_category();
1044
  $cat_keys = array_keys($list);
@@ -1047,16 +1010,16 @@ if (!function_exists('woo_feed_check_google_category')) {
1047
  $checkCategoryType = isset($feedInfo['feedrules']['type']) ? $feedInfo['feedrules']['type'] : [];
1048
  $merchant = isset($feedInfo['feedrules']['provider']) ? $feedInfo['feedrules']['provider'] : [];
1049
  $cat = 'yes';
1050
- foreach ($list as $attribute => $merchants) {
1051
- if (in_array($merchant, $merchants, true) && in_array($attribute, $checkCategory, true)) {
1052
  $catKey = array_search($attribute, $checkCategory, true);
1053
- if ('pattern' === $checkCategoryType[$catKey]) {
1054
  $checkCategoryValue = $feedInfo['feedrules']['default'];
1055
  } else {
1056
  $checkCategoryValue = $feedInfo['feedrules']['attributes'];
1057
  }
1058
 
1059
- if (empty($checkCategoryValue[$catKey])) {
1060
  $cat = 'no';
1061
  }
1062
  break;
@@ -1066,7 +1029,7 @@ if (!function_exists('woo_feed_check_google_category')) {
1066
  return $cat;
1067
  }
1068
  }
1069
- if (!function_exists('woo_feed_array_sanitize')) {
1070
  /**
1071
  * Sanitize array post
1072
  *
@@ -1074,23 +1037,22 @@ if (!function_exists('woo_feed_array_sanitize')) {
1074
  *
1075
  * @return array
1076
  */
1077
- function woo_feed_array_sanitize($array)
1078
- {
1079
  $newArray = array();
1080
- if (count($array)) {
1081
- foreach ($array as $key => $value) {
1082
- if (is_array($value)) {
1083
- foreach ($value as $key2 => $value2) {
1084
- if (is_array($value2)) {
1085
- foreach ($value2 as $key3 => $value3) {
1086
- $newArray[$key][$key2][$key3] = sanitize_text_field($value3);
1087
  }
1088
  } else {
1089
- $newArray[$key][$key2] = sanitize_text_field($value2);
1090
  }
1091
  }
1092
  } else {
1093
- $newArray[$key] = sanitize_text_field($value);
1094
  }
1095
  }
1096
  }
@@ -1098,7 +1060,7 @@ if (!function_exists('woo_feed_array_sanitize')) {
1098
  return $newArray;
1099
  }
1100
  }
1101
- if (!function_exists('woo_feed_sanitize_form_fields')) {
1102
  /**
1103
  * Sanitize Form Fields ($_POST Array)
1104
  *
@@ -1106,23 +1068,22 @@ if (!function_exists('woo_feed_sanitize_form_fields')) {
1106
  *
1107
  * @return array
1108
  */
1109
- function woo_feed_sanitize_form_fields($data)
1110
- {
1111
- foreach ($data as $k => $v) {
1112
- if (true === apply_filters('woo_feed_sanitize_form_fields', true, $k, $v, $data)) {
1113
- if (is_array($v)) {
1114
  $v = woo_feed_sanitize_form_fields($v);
1115
  } else {
1116
  // $v = sanitize_text_field( $v ); #TODO should not trim Prefix and Suffix field
1117
  }
1118
  }
1119
- $data[$k] = apply_filters('woo_feed_sanitize_form_field', $v, $k);
1120
  }
1121
 
1122
  return $data;
1123
  }
1124
  }
1125
- if (!function_exists('woo_feed_unique_feed_slug')) {
1126
  /**
1127
  * Generate Unique slug for feed.
1128
  * This function only check database for existing feed for generating unique slug.
@@ -1136,12 +1097,11 @@ if (!function_exists('woo_feed_unique_feed_slug')) {
1136
  * @see wp_unique_post_slug()
1137
  *
1138
  */
1139
- function woo_feed_unique_feed_slug($slug, $prefix = '', $option_id = null)
1140
- {
1141
  global $wpdb;
1142
  /** @noinspection SpellCheckingInspection */
1143
- $disallowed = array('siteurl', 'home', 'blogname', 'blogdescription', 'users_can_register', 'admin_email');
1144
- if ($option_id && $option_id > 0) {
1145
  $checkSql = "SELECT option_name FROM $wpdb->options WHERE option_name = %s AND option_id != %d LIMIT 1";
1146
  $nameCheck = $wpdb->get_var($wpdb->prepare($checkSql, $prefix . $slug, $option_id)); // phpcs:ignore
1147
  } else {
@@ -1149,24 +1109,24 @@ if (!function_exists('woo_feed_unique_feed_slug')) {
1149
  $nameCheck = $wpdb->get_var($wpdb->prepare($checkSql, $prefix . $slug)); // phpcs:ignore
1150
  }
1151
  // slug found or slug in disallowed list
1152
- if ($nameCheck || in_array($slug, $disallowed, true)) {
1153
  $suffix = 2;
1154
  do {
1155
  $altName = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1156
- if ($option_id && $option_id > 0) {
1157
  $nameCheck = $wpdb->get_var($wpdb->prepare($checkSql, $prefix . $altName, $option_id)); // phpcs:ignore
1158
  } else {
1159
  $nameCheck = $wpdb->get_var($wpdb->prepare($checkSql, $prefix . $altName)); // phpcs:ignore
1160
  }
1161
  $suffix++;
1162
- } while ($nameCheck);
1163
  $slug = $altName;
1164
  }
1165
 
1166
  return $slug;
1167
  }
1168
  }
1169
- if (!function_exists('woo_feed_unique_option_name')) {
1170
  /**
1171
  * Alias of woo_feed_unique_feed_slug
1172
  *
@@ -1180,12 +1140,11 @@ if (!function_exists('woo_feed_unique_option_name')) {
1180
  * @since 3.3.8
1181
  *
1182
  */
1183
- function woo_feed_unique_option_name($slug, $prefix = '', $option_id = null)
1184
- {
1185
  return woo_feed_unique_feed_slug($slug, $prefix, $option_id);
1186
  }
1187
  }
1188
- if (!function_exists('generate_unique_feed_file_name')) {
1189
  /**
1190
  * Generate Unique file Name.
1191
  * This will insure unique slug and file name for a single feed.
@@ -1196,8 +1155,7 @@ if (!function_exists('generate_unique_feed_file_name')) {
1196
  *
1197
  * @return string|string[]
1198
  */
1199
- function generate_unique_feed_file_name($filename, $type, $provider)
1200
- {
1201
 
1202
  $feedDir = woo_feed_get_file_dir($provider, $type);
1203
  $raw_filename = sanitize_title($filename, '', 'save');
@@ -1212,7 +1170,7 @@ if (!function_exists('generate_unique_feed_file_name')) {
1212
  }
1213
 
1214
  // File process.
1215
- if (!function_exists('woo_feed_check_valid_extension')) {
1216
  /**
1217
  * Check Feed File Extension Validity
1218
  *
@@ -1220,12 +1178,11 @@ if (!function_exists('woo_feed_check_valid_extension')) {
1220
  *
1221
  * @return bool
1222
  */
1223
- function woo_feed_check_valid_extension($extension)
1224
- {
1225
  return in_array($extension, array_keys(woo_feed_get_file_types()), true);
1226
  }
1227
  }
1228
- if (!function_exists('woo_feed_save_feed_config_data')) {
1229
  /**
1230
  * Sanitize And Save Feed config data (array) to db (option table)
1231
  *
@@ -1235,26 +1192,25 @@ if (!function_exists('woo_feed_save_feed_config_data')) {
1235
  *
1236
  * @return bool|string return false if failed to update. return filename if success
1237
  */
1238
- function woo_feed_save_feed_config_data($data, $feed_option_name = null, $configOnly = true)
1239
- {
1240
- if (!is_array($data)) {
1241
  return false;
1242
  }
1243
- if (!isset($data['filename'], $data['feedType'], $data['provider'])) {
1244
  return false;
1245
  }
1246
  // unnecessary form fields to remove
1247
- $removables = ['closedpostboxesnonce', '_wpnonce', '_wp_http_referer', 'save_feed_config', 'edit-feed'];
1248
- foreach ($removables as $removable) {
1249
- if (isset($data[$removable])) {
1250
- unset($data[$removable]);
1251
  }
1252
  }
1253
  // parse rules
1254
  $data = woo_feed_parse_feed_rules($data);
1255
  // Sanitize Fields
1256
  $data = woo_feed_sanitize_form_fields($data);
1257
- if (empty($feed_option_name)) {
1258
  $feed_option_name = generate_unique_feed_file_name(
1259
  $data['filename'],
1260
  $data['feedType'],
@@ -1267,7 +1223,7 @@ if (!function_exists('woo_feed_save_feed_config_data')) {
1267
  $old_data = get_option('wf_config' . $feed_option_name, array());
1268
  $update = false;
1269
  $updated = false;
1270
- if (is_array($old_data) && !empty($old_data)) {
1271
  $update = true;
1272
  }
1273
 
@@ -1283,7 +1239,7 @@ if (!function_exists('woo_feed_save_feed_config_data')) {
1283
  */
1284
  $data = apply_filters('woo_feed_insert_feed_data', $data, $old_data, 'wf_config' . $feed_option_name);
1285
 
1286
- if ($update) {
1287
  /**
1288
  * Before Updating Config to db
1289
  *
@@ -1301,25 +1257,25 @@ if (!function_exists('woo_feed_save_feed_config_data')) {
1301
  do_action('woo_feed_before_insert_config', $data, 'wf_config' . $feed_option_name);
1302
  }
1303
  $updated = ($data === $old_data);
1304
- if (false === $updated) {
1305
  // Store Config.
1306
  $updated = update_option('wf_config' . $feed_option_name, $data, false);
1307
  }
1308
  // update wf_feed if wp_config update ok...
1309
- if ($updated && false === $configOnly) {
1310
  $old_feed = maybe_unserialize(get_option('wf_feed_' . $feed_option_name));
1311
  $feed_data = array(
1312
- 'feedrules' => $data,
1313
- 'url' => woo_feed_get_file_url($feed_option_name, $data['provider'], $data['feedType']),
1314
  'last_updated' => date('Y-m-d H:i:s', strtotime(current_time('mysql'))),
1315
- 'status' => isset($old_feed['status']) && 1 === (int)$old_feed['status'] ? 1 : 0,
1316
  // set old status or disable auto update.
1317
  );
1318
 
1319
  $saved2 = update_option('wf_feed_' . $feed_option_name, maybe_serialize($feed_data), false);
1320
  }
1321
 
1322
- if ($update) {
1323
  /**
1324
  * After Updating Config to db
1325
  *
@@ -1341,7 +1297,7 @@ if (!function_exists('woo_feed_save_feed_config_data')) {
1341
  return $updated ? $feed_option_name : $updated;
1342
  }
1343
  }
1344
- if (!function_exists('woo_feed_extract_feed_option_name')) {
1345
  /**
1346
  * Remove Feed Option Name Prefix and return the slug
1347
  *
@@ -1349,12 +1305,11 @@ if (!function_exists('woo_feed_extract_feed_option_name')) {
1349
  *
1350
  * @return string
1351
  */
1352
- function woo_feed_extract_feed_option_name($feed_option_name)
1353
- {
1354
- return str_replace(['wf_feed_', 'wf_config'], '', $feed_option_name);
1355
  }
1356
  }
1357
- if (!function_exists('woo_feed_get_file_path')) {
1358
  /**
1359
  * Get File Path for feed or the file upload path for the plugin to use.
1360
  *
@@ -1363,14 +1318,13 @@ if (!function_exists('woo_feed_get_file_path')) {
1363
  *
1364
  * @return string
1365
  */
1366
- function woo_feed_get_file_path($provider = '', $type = '')
1367
- {
1368
  $upload_dir = wp_get_upload_dir();
1369
 
1370
  return sprintf('%s/woo-feed/%s/%s/', $upload_dir['basedir'], $provider, $type);
1371
  }
1372
  }
1373
- if (!function_exists('woo_feed_get_file')) {
1374
  /**
1375
  * Get Feed File URL
1376
  *
@@ -1380,15 +1334,14 @@ if (!function_exists('woo_feed_get_file')) {
1380
  *
1381
  * @return string
1382
  */
1383
- function woo_feed_get_file($fileName, $provider, $type)
1384
- {
1385
  $fileName = woo_feed_extract_feed_option_name($fileName);
1386
  $path = woo_feed_get_file_path($provider, $type);
1387
 
1388
  return sprintf('%s/%s.%s', untrailingslashit($path), $fileName, $type);
1389
  }
1390
  }
1391
- if (!function_exists('woo_feed_get_file_url')) {
1392
  /**
1393
  * Get Feed File URL
1394
  *
@@ -1398,8 +1351,7 @@ if (!function_exists('woo_feed_get_file_url')) {
1398
  *
1399
  * @return string
1400
  */
1401
- function woo_feed_get_file_url($fileName, $provider, $type)
1402
- {
1403
  $fileName = woo_feed_extract_feed_option_name($fileName);
1404
  $upload_dir = wp_get_upload_dir();
1405
 
@@ -1411,7 +1363,7 @@ if (!function_exists('woo_feed_get_file_url')) {
1411
  $type));
1412
  }
1413
  }
1414
- if (!function_exists('woo_feed_check_feed_file')) {
1415
  /**
1416
  * Check if feed file exists
1417
  *
@@ -1421,8 +1373,7 @@ if (!function_exists('woo_feed_check_feed_file')) {
1421
  *
1422
  * @return bool
1423
  */
1424
- function woo_feed_check_feed_file($fileName, $provider, $type)
1425
- {
1426
  $upload_dir = wp_get_upload_dir();
1427
 
1428
  return file_exists(sprintf('%s/woo-feed/%s/%s/%s.%s',
@@ -1433,7 +1384,7 @@ if (!function_exists('woo_feed_check_feed_file')) {
1433
  $type));
1434
  }
1435
  }
1436
- if (!function_exists('woo_feed_get_file_dir')) {
1437
  /**
1438
  * Get Feed Directory
1439
  *
@@ -1442,14 +1393,13 @@ if (!function_exists('woo_feed_get_file_dir')) {
1442
  *
1443
  * @return string
1444
  */
1445
- function woo_feed_get_file_dir($provider, $feedType)
1446
- {
1447
  $upload_dir = wp_get_upload_dir();
1448
 
1449
  return sprintf('%s/woo-feed/%s/%s', $upload_dir['basedir'], $provider, $feedType);
1450
  }
1451
  }
1452
- if (!function_exists('woo_feed_save_batch_feed_info')) {
1453
  /**
1454
  * Save Feed Batch Chunk
1455
  *
@@ -1461,10 +1411,9 @@ if (!function_exists('woo_feed_save_batch_feed_info')) {
1461
  *
1462
  * @return bool
1463
  */
1464
- function woo_feed_save_batch_feed_info($feedService, $type, $string, $fileName, $info)
1465
- {
1466
  $ext = $type;
1467
- if ('csv' === $type || 'tsv' === $type || 'xls' === $type || 'json' === $type) {
1468
  $string = wp_json_encode($string);
1469
  $ext = 'json';
1470
  }
@@ -1473,8 +1422,8 @@ if (!function_exists('woo_feed_save_batch_feed_info')) {
1473
  $file = $path . '/' . $fileName . '.' . $ext;
1474
  $save = new Woo_Feed_Savefile();
1475
  $status = $save->saveFile($path, $file, $string);
1476
- if (woo_feed_is_debugging_enabled()) {
1477
- if ($status) {
1478
  $message = sprintf('Batch chunk file (%s) saved.', $fileName);
1479
  } else {
1480
  $message = sprintf('Unable to save batch chunk file %s.', $fileName);
@@ -1485,7 +1434,7 @@ if (!function_exists('woo_feed_save_batch_feed_info')) {
1485
  return $status;
1486
  }
1487
  }
1488
- if (!function_exists('woo_feed_get_batch_feed_info')) {
1489
  /**
1490
  * @param string $feedService
1491
  * @param string $type
@@ -1493,29 +1442,28 @@ if (!function_exists('woo_feed_get_batch_feed_info')) {
1493
  *
1494
  * @return bool|array|string
1495
  */
1496
- function woo_feed_get_batch_feed_info($feedService, $type, $fileName)
1497
- {
1498
  $ext = $type;
1499
- if ('csv' === $type || 'tsv' === $type || 'xls' === $type || 'json' === $type) {
1500
  $ext = 'json';
1501
  }
1502
  // Save File
1503
  $path = woo_feed_get_file_dir($feedService, $type);
1504
  $file = $path . '/' . $fileName . '.' . $ext;
1505
- if (!file_exists($file)) {
1506
  return false;
1507
  }
1508
 
1509
  $data = file_get_contents($file); // phpcs:ignore
1510
 
1511
- if ('csv' === $type || 'tsv' === $type || 'xls' === $type || 'json' === $type) {
1512
  $data = ($data) ? json_decode($data, true) : false;
1513
  }
1514
 
1515
  return $data;
1516
  }
1517
  }
1518
- if (!function_exists('woo_feed_unlink_tempFiles')) {
1519
  /**
1520
  * Remove temporary feed files
1521
  *
@@ -1524,30 +1472,29 @@ if (!function_exists('woo_feed_unlink_tempFiles')) {
1524
  *
1525
  * @return void
1526
  */
1527
- function woo_feed_unlink_tempFiles($config, $fileName)
1528
- {
1529
  $type = $config['feedType'];
1530
  $ext = $type;
1531
  $path = woo_feed_get_file_dir($config['provider'], $type);
1532
 
1533
- if ('csv' === $type || 'tsv' === $type || 'xls' === $type) {
1534
  $ext = 'json';
1535
  }
1536
  $files = [
1537
  'headerFile' => $path . '/' . 'wf_store_feed_header_info_' . $fileName . '.' . $ext,
1538
- 'bodyFile' => $path . '/' . 'wf_store_feed_body_info_' . $fileName . '.' . $ext,
1539
  'footerFile' => $path . '/' . 'wf_store_feed_footer_info_' . $fileName . '.' . $ext,
1540
  ];
1541
 
1542
  woo_feed_log_feed_process($config['filename'], sprintf('Deleting Temporary Files (%s).', implode(', ', array_values($files))));
1543
- foreach ($files as $key => $file) {
1544
- if (file_exists($file)) {
1545
  unlink($file); // phpcs:ignore
1546
  }
1547
  }
1548
  }
1549
  }
1550
- if (!function_exists('woo_feed_delete_feed')) {
1551
  /**
1552
  * Delete feed option and the file from uploads directory
1553
  *
@@ -1555,10 +1502,9 @@ if (!function_exists('woo_feed_delete_feed')) {
1555
  *
1556
  * @return bool
1557
  */
1558
- function woo_feed_delete_feed($feed_id)
1559
- {
1560
  global $wpdb;
1561
- if (!is_numeric($feed_id)) {
1562
  $feed_name = woo_feed_extract_feed_option_name($feed_id);
1563
  } else {
1564
  $feed_data = $wpdb->get_row($wpdb->prepare("SELECT option_name FROM $wpdb->options WHERE option_id = %d", $feed_id)); // phpcs:ignore
@@ -1566,7 +1512,7 @@ if (!function_exists('woo_feed_delete_feed')) {
1566
  $feed_name = woo_feed_extract_feed_option_name($feed_data->option_name);
1567
  }
1568
  $feedInfo = maybe_unserialize(get_option('wf_feed_' . $feed_name));
1569
- if (false !== $feedInfo) {
1570
  $feedInfo = $feedInfo['feedrules'];
1571
  } else {
1572
  $feedInfo = maybe_unserialize(get_option('wf_config' . $feed_name));
@@ -1575,7 +1521,7 @@ if (!function_exists('woo_feed_delete_feed')) {
1575
  $file = woo_feed_get_file($feed_name, $feedInfo['provider'], $feedInfo['feedType']);
1576
  // delete any leftover
1577
  woo_feed_unlink_tempFiles($feedInfo, $feed_name);
1578
- if (file_exists($file)) {
1579
  // file exists in upload directory
1580
  if (unlink($file)) { // phpcs:ignore
1581
  delete_option('wf_feed_' . $feed_name);
@@ -1590,14 +1536,14 @@ if (!function_exists('woo_feed_delete_feed')) {
1590
 
1591
  // Delete cron schedule.
1592
  $feed_cron_param = 'wf_config' . $feed_name;
1593
- wp_clear_scheduled_hook('woo_feed_update_single_feed', [$feed_cron_param]);
1594
 
1595
  return $deleted;
1596
  }
1597
  }
1598
 
1599
  // Mics..
1600
- if (!function_exists('woo_feed_remove_query_args')) {
1601
  /**
1602
  * Add more items to the removable query args array...
1603
  *
@@ -1605,10 +1551,9 @@ if (!function_exists('woo_feed_remove_query_args')) {
1605
  *
1606
  * @return array
1607
  */
1608
- function woo_feed_remove_query_args($removable_query_args)
1609
- {
1610
  global $plugin_page;
1611
- if (strpos($plugin_page, 'webappick') !== false) {
1612
  $removable_query_args[] = 'feed_created';
1613
  $removable_query_args[] = 'feed_updated';
1614
  $removable_query_args[] = 'feed_imported';
@@ -1628,7 +1573,7 @@ if (!function_exists('woo_feed_remove_query_args')) {
1628
 
1629
  add_filter('removable_query_args', 'woo_feed_remove_query_args', 10, 1);
1630
  }
1631
- if (!function_exists('woo_feed_usort_reorder')) {
1632
  /**
1633
  * This checks for sorting input and sorts the data in our array accordingly.
1634
  *
@@ -1643,18 +1588,17 @@ if (!function_exists('woo_feed_usort_reorder')) {
1643
  *
1644
  * @return bool
1645
  */
1646
- function woo_feed_usort_reorder($a, $b)
1647
- {
1648
  // If no sort, default to title
1649
- $orderby = (!empty($_REQUEST['orderby'])) ? sanitize_text_field(wp_unslash($_REQUEST['orderby'])) : 'option_name'; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
1650
  // If no order, default to asc
1651
- $order = (!empty($_REQUEST['order'])) ? sanitize_text_field(wp_unslash($_REQUEST['order'])) : 'asc'; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
1652
- $result = strcmp($a[$orderby], $b[$orderby]); // Determine sort order
1653
 
1654
  return ('asc' === $order) ? $result : -$result; // Send final sort direction to usort
1655
  }
1656
  }
1657
- if (!function_exists('str_replace_trim')) {
1658
  /**
1659
  * str_replace() wrapper with trim()
1660
  *
@@ -1671,12 +1615,11 @@ if (!function_exists('str_replace_trim')) {
1671
  *
1672
  * @return array|string
1673
  */
1674
- function str_replace_trim($search, $replace, $subject, $charlist = " \t\n\r\0\x0B")
1675
- {
1676
  $replaced = str_replace($search, $replace, $subject);
1677
- if (is_array($replaced)) {
1678
  return array_map(
1679
- function ($item) use ($charlist) {
1680
  return trim($item, $charlist);
1681
  },
1682
  $replaced
@@ -1687,7 +1630,7 @@ if (!function_exists('str_replace_trim')) {
1687
  }
1688
  }
1689
 
1690
- if( ! function_exists( 'woo_feed_strip_all_tags' ) ){
1691
 
1692
  /*
1693
  * Extends wp_strip_all_tags to fix WP_Error object passing issue
@@ -1697,37 +1640,34 @@ if( ! function_exists( 'woo_feed_strip_all_tags' ) ){
1697
  * @return string
1698
  * @since 4.4.19
1699
  * */
1700
- function woo_feed_strip_all_tags( $string )
1701
- {
1702
 
1703
- if( $string instanceof WP_Error ){
1704
  return '';
1705
  }
1706
 
1707
  return wp_strip_all_tags( $string );
1708
 
1709
  }
1710
-
1711
  }
1712
 
1713
- if (!function_exists('woo_feed_export_config')) {
1714
  /**
1715
  * Handle config export request
1716
  *
1717
  * @return void
1718
  * @since 3.3.10
1719
  */
1720
- function woo_feed_export_config()
1721
- {
1722
- if (isset($_REQUEST['feed'], $_REQUEST['_wpnonce']) && wp_verify_nonce(sanitize_text_field(wp_unslash($_REQUEST['_wpnonce'])), 'wpf-export')) {
1723
  $feed = sanitize_text_field(wp_unslash($_REQUEST['feed']));
1724
  $feed = woo_feed_extract_feed_option_name($feed);
1725
- if (!empty($feed)) {
1726
  $feed = maybe_unserialize(get_option('wf_feed_' . $feed));
1727
  $feed = (isset($feed['feedrules']) && is_array($feed['feedrules'])) ? $feed['feedrules'] : [];
1728
  }
1729
- if (!is_array($feed)) {
1730
- wp_die(esc_html__('Invalid Request', 'woo-feed'), esc_html__('Invalid Request', 'woo-feed'), ['back_link' => true]);
1731
  }
1732
  $file_name = sprintf(
1733
  '%s-%s-%s.wpf',
@@ -1737,14 +1677,14 @@ if (!function_exists('woo_feed_export_config')) {
1737
  );
1738
  $feed = wp_json_encode($feed);
1739
  $meta = wp_json_encode([
1740
- 'version' => WOO_FEED_FREE_VERSION,
1741
  'file_name' => $file_name,
1742
- 'hash' => md5($feed),
1743
  ]);
1744
  $bin = pack('VA*VA*', strlen($meta), $meta, strlen($feed), $feed);
1745
  $feed = gzdeflate($bin, 9);
1746
  // Let set the header...
1747
- if (!headers_sent()) {
1748
  status_header(200);
1749
  header('Content-Type: application/octet-stream;');
1750
  header('Content-disposition: attachment; filename=' . $file_name);
@@ -1758,20 +1698,19 @@ if (!function_exists('woo_feed_export_config')) {
1758
  wp_die(
1759
  esc_html__('Invalid Request', 'woo-feed'),
1760
  esc_html__('Invalid Request', 'woo-feed'),
1761
- ['back_link' => true]
1762
  );
1763
  }
1764
  }
1765
  }
1766
- if (!function_exists('woo_feed_import_config')) {
1767
  /**
1768
  * Handle config import request
1769
  *
1770
  * @return void
1771
  * @since 3.3.10
1772
  */
1773
- function woo_feed_import_config()
1774
- {
1775
  check_admin_referer('wpf_import');
1776
 
1777
  if (
@@ -1785,46 +1724,46 @@ if (!function_exists('woo_feed_import_config')) {
1785
  ) {
1786
  $file_name = sanitize_text_field(wp_unslash($_FILES['wpf_import_file']['name']));
1787
  $data = file_get_contents(sanitize_text_field(wp_unslash($_FILES['wpf_import_file']['tmp_name'])));
1788
- if (empty($data)) {
1789
  wp_die(
1790
  esc_html__('Empty File Uploaded. Try again.', 'woo-feed'),
1791
  esc_html__('Empty File', 'woo-feed'),
1792
  [
1793
- 'link_url' => esc_url(admin_url('admin.php?page=webappick-manage-feeds')),
1794
  'link_text' => esc_html__('&laquo; Back', 'woo-feed'),
1795
  ]
1796
  );
1797
  }
1798
  $feed = gzinflate($data);
1799
- if (false === $feed) {
1800
  wp_die(
1801
  esc_html__('Unable to read file content', 'woo-feed'),
1802
  esc_html__('Invalid File', 'woo-feed'),
1803
  [
1804
- 'link_url' => esc_url(admin_url('admin.php?page=webappick-manage-feeds')),
1805
  'link_text' => esc_html__('&laquo; Back', 'woo-feed'),
1806
  ]
1807
  );
1808
  }
1809
  // unpack meta data.
1810
  $meta_length = unpack('V', $feed);
1811
- if (false === $meta_length) {
1812
  wp_die(
1813
  esc_html__('Unable to read data from file.', 'woo-feed'),
1814
  esc_html__('Invalid File', 'woo-feed'),
1815
  [
1816
- 'link_url' => esc_url(admin_url('admin.php?page=webappick-manage-feeds')),
1817
  'link_text' => esc_html__('&laquo; Back', 'woo-feed'),
1818
  ]
1819
  );
1820
  }
1821
  $meta = unpack('A*', substr($feed, 4, $meta_length[1]))[1];
1822
- if (false === $meta || 0 !== strpos($meta, '{')) {
1823
  wp_die(
1824
  esc_html__('Unable to read file info.', 'woo-feed'),
1825
  esc_html__('Invalid File', 'woo-feed'),
1826
  [
1827
- 'link_url' => esc_url(admin_url('admin.php?page=webappick-manage-feeds')),
1828
  'link_text' => esc_html__('&laquo; Back', 'woo-feed'),
1829
  ]
1830
  );
@@ -1833,34 +1772,34 @@ if (!function_exists('woo_feed_import_config')) {
1833
  // unpack feed data.
1834
  $feed = substr($feed, $meta_length[1] + 8); // 4 bytes for each V (length data)
1835
  $feed = unpack('A*', $feed)[1];
1836
- if (false === $feed || 0 !== strpos($feed, '{')) {
1837
  wp_die(
1838
  esc_html__('Unable to read feed data from file.', 'woo-feed'),
1839
  esc_html__('Invalid File', 'woo-feed'),
1840
  [
1841
- 'link_url' => esc_url(admin_url('admin.php?page=webappick-manage-feeds')),
1842
  'link_text' => esc_html__('&laquo; Back', 'woo-feed'),
1843
  ]
1844
  );
1845
  }
1846
- if (md5($feed) !== $meta['hash']) {
1847
  wp_die(
1848
  esc_html__('Unable to verify the file.', 'woo-feed'),
1849
  esc_html__('Invalid File', 'woo-feed'),
1850
  [
1851
- 'link_url' => esc_url(admin_url('admin.php?page=webappick-manage-feeds')),
1852
  'link_text' => esc_html__('&laquo; Back', 'woo-feed'),
1853
  ]
1854
  );
1855
  }
1856
 
1857
  $feed = json_decode($feed, true);
1858
- if (!is_array($feed)) {
1859
  wp_die(
1860
  esc_html__('Invalid or corrupted config file.', 'woo-feed'),
1861
  esc_html__('Invalid File', 'woo-feed'),
1862
  [
1863
- 'link_url' => esc_url(admin_url('admin.php?page=webappick-manage-feeds')),
1864
  'link_text' => esc_html__('&laquo; Back', 'woo-feed'),
1865
  ]
1866
  );
@@ -1869,12 +1808,12 @@ if (!function_exists('woo_feed_import_config')) {
1869
  $feed = woo_feed_parse_feed_rules($feed);
1870
  $new_name = sanitize_text_field(wp_unslash($_POST['wpf_import_feed_name']));
1871
  $new_name = trim($new_name);
1872
- if (!empty($new_name)) {
1873
  $opt_name = $new_name;
1874
  $feed['filename'] = $new_name;
1875
  } else {
1876
  $opt_name = $feed['filename'];
1877
- $feed['filename'] = str_replace_trim(['-', '_'], ' ', $feed['filename']);
1878
  $feed['filename'] = sprintf(
1879
  '%s: %s',
1880
  esc_html__(' Imported', 'woo-feed'),
@@ -1891,9 +1830,9 @@ if (!function_exists('woo_feed_import_config')) {
1891
  wp_safe_redirect(
1892
  add_query_arg(
1893
  [
1894
- 'feed_imported' => (int)false !== $fileName,
1895
  'feed_regenerate' => 1,
1896
- 'feed_name' => $fileName ? $fileName : '',
1897
  ],
1898
  esc_url(admin_url('admin.php?page=webappick-manage-feeds'))
1899
  )
@@ -1904,14 +1843,14 @@ if (!function_exists('woo_feed_import_config')) {
1904
  esc_html__('Invalid Request.', 'woo-feed'),
1905
  esc_html__('Invalid Request', 'woo-feed'),
1906
  [
1907
- 'link_url' => esc_url(admin_url('admin.php?page=webappick-manage-feeds')),
1908
  'link_text' => esc_html__('&laquo; Back', 'woo-feed'),
1909
  ]
1910
  );
1911
  }
1912
  }
1913
 
1914
- if (!function_exists('woo_feed_download_feed_log')) {
1915
 
1916
  /**
1917
  * Handle latest log download request
@@ -1919,8 +1858,7 @@ if (!function_exists('woo_feed_download_feed_log')) {
1919
  * @return void
1920
  * @since 4.4.15
1921
  */
1922
- function woo_feed_download_feed_log()
1923
- {
1924
  if (
1925
  isset( $_REQUEST['feed'], $_REQUEST['_wpnonce'] )
1926
  && wp_verify_nonce( sanitize_text_field( wp_unslash( $_REQUEST['_wpnonce'] ) ), 'wpf-log-download')
@@ -1929,19 +1867,19 @@ if (!function_exists('woo_feed_download_feed_log')) {
1929
  $feed_name = str_replace( 'wf_feed_', '', $feed_name );
1930
  $log_file_path = Woo_Feed_Log_Handler_File::get_log_file_path( $feed_name );
1931
 
1932
- if( $log_file_path && file_exists( $log_file_path ) ){
1933
  $log_data = file_get_contents( $log_file_path );
1934
  } else {
1935
  $log_data = 'No log is generated.';
1936
  }
1937
 
1938
- if (!empty($feed_name)) {
1939
  $feed_details = maybe_unserialize(get_option('wf_feed_' . $feed_name));
1940
  $feed_details = (isset($feed['feedrules']) && is_array($feed['feedrules'])) ? $feed['feedrules'] : [];
1941
  }
1942
 
1943
- if (!is_array($feed_details)) {
1944
- wp_die(esc_html__('Invalid Request', 'woo-feed'), esc_html__('Invalid Request', 'woo-feed'), ['back_link' => true]);
1945
  }
1946
 
1947
  $file_name = sprintf(
@@ -1952,7 +1890,7 @@ if (!function_exists('woo_feed_download_feed_log')) {
1952
  );
1953
 
1954
  // Let set the header...
1955
- if (!headers_sent()) {
1956
  status_header(200);
1957
  header('Content-Type: application/octet-stream;');
1958
  header('Content-disposition: attachment; filename=' . $file_name);
@@ -1967,14 +1905,14 @@ if (!function_exists('woo_feed_download_feed_log')) {
1967
  wp_die(
1968
  esc_html__('Invalid Request', 'woo-feed'),
1969
  esc_html__('Invalid Request', 'woo-feed'),
1970
- ['back_link' => true]
1971
  );
1972
  }
1973
  }
1974
  }
1975
 
1976
  // Feed Functions.
1977
- if (!function_exists('woo_feed_generate_feed')) {
1978
  /**
1979
  * Update Feed Information
1980
  *
@@ -1983,29 +1921,28 @@ if (!function_exists('woo_feed_generate_feed')) {
1983
  *
1984
  * @return string|bool
1985
  */
1986
- function woo_feed_generate_feed($info, $feed_option_name)
1987
- {
1988
- if (false === $info || empty($info)) {
1989
  return false;
1990
  }
1991
  // parse rules.
1992
  $info = woo_feed_parse_feed_rules(isset($info['feedrules']) ? $info['feedrules'] : $info);
1993
  $feed_option_name = woo_feed_extract_feed_option_name($feed_option_name);
1994
- if (!empty($info['provider'])) {
1995
  do_action('before_woo_feed_generate_feed', $info);
1996
 
1997
  // Generate Feed Data
1998
  $products = new Woo_Generate_Feed($info['provider'], $info);
1999
  $getString = $products->getProducts();
2000
- if ('csv' == $info['feedType'] || 'tsv' == $info['feedType'] || 'xls' == $info['feedType']) {
2001
  $csvHead[0] = $getString['header'];
2002
- if (!empty($csvHead) && !empty($getString['body'])) {
2003
  $string = array_merge($csvHead, $getString['body']);
2004
  } else {
2005
  $string = array();
2006
  }
2007
  } else {
2008
- if( 'json' == $info['feedType'] ) {
2009
  $string = array();
2010
  } else {
2011
  $string = $getString['header'] . $getString['body'] . $getString['footer'];
@@ -2014,33 +1951,33 @@ if (!function_exists('woo_feed_generate_feed')) {
2014
 
2015
  $saveFile = false;
2016
  // Check If any products founds
2017
- if ($string && !empty($string)) {
2018
  // Save File
2019
  $path = woo_feed_get_file_path($info['provider'], $info['feedType']);
2020
  $file = woo_feed_get_file($feed_option_name, $info['provider'], $info['feedType']);
2021
  $save = new Woo_Feed_Savefile();
2022
- if ('csv' == $info['feedType'] || 'tsv' == $info['feedType'] || 'xls' == $info['feedType'] || 'json' == $info['feedType']) {
2023
  $saveFile = $save->saveValueFile($path, $file, $string, $info, $info['feedType']);
2024
  } else {
2025
  $saveFile = $save->saveFile($path, $file, $string);
2026
  }
2027
 
2028
  // Upload file to ftp server
2029
- if (1 == (int)$info['ftpenabled']) {
2030
  woo_feed_handle_file_transfer($file, $feed_option_name . '.' . $info['feedType'], $info);
2031
  }
2032
  }
2033
  $feed_URL = woo_feed_get_file_url($feed_option_name, $info['provider'], $info['feedType']);
2034
  // Save Info into database
2035
  $feedInfo = array(
2036
- 'feedrules' => $info,
2037
- 'url' => $feed_URL,
2038
  'last_updated' => date('Y-m-d H:i:s', strtotime(current_time('mysql'))),
2039
- 'status' => 1,
2040
  );
2041
  update_option('wf_feed_' . $feed_option_name, serialize($feedInfo), false); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.serialize_serialize
2042
  do_action('after_woo_feed_generate_feed', $info);
2043
- if ($saveFile) {
2044
  return $feed_URL;
2045
  } else {
2046
  return false;
@@ -2051,37 +1988,35 @@ if (!function_exists('woo_feed_generate_feed')) {
2051
  }
2052
  }
2053
 
2054
- if (!function_exists('woo_feed_get_schedule_interval_options')) {
2055
  /**
2056
  * Get Schedule Intervals
2057
  * @return mixed
2058
  */
2059
- function woo_feed_get_schedule_interval_options()
2060
- {
2061
  return apply_filters(
2062
  'woo_feed_schedule_interval_options',
2063
  [
2064
- WEEK_IN_SECONDS => esc_html__('1 Week', 'woo-feed'),
2065
- DAY_IN_SECONDS => esc_html__('24 Hours', 'woo-feed'),
2066
  12 * HOUR_IN_SECONDS => esc_html__('12 Hours', 'woo-feed'),
2067
- 6 * HOUR_IN_SECONDS => esc_html__('6 Hours', 'woo-feed'),
2068
- HOUR_IN_SECONDS => esc_html__('1 Hours', 'woo-feed'),
2069
  ]
2070
  );
2071
  }
2072
  }
2073
- if (!function_exists('woo_feed_get_minimum_interval_option')) {
2074
- function woo_feed_get_minimum_interval_option()
2075
- {
2076
  $intervals = array_keys(woo_feed_get_schedule_interval_options());
2077
- if (!empty($intervals)) {
2078
  return end($intervals);
2079
  }
2080
 
2081
  return 15 * MINUTE_IN_SECONDS;
2082
  }
2083
  }
2084
- if (!function_exists('woo_feed_stripInvalidXml')) {
2085
  /**
2086
  * Remove non supported xml character
2087
  *
@@ -2089,16 +2024,15 @@ if (!function_exists('woo_feed_stripInvalidXml')) {
2089
  *
2090
  * @return string
2091
  */
2092
- function woo_feed_stripInvalidXml($value)
2093
- {
2094
  $ret = '';
2095
- if (empty($value)) {
2096
  return $ret;
2097
  }
2098
  $length = strlen($value);
2099
- for ($i = 0; $i < $length; $i++) {
2100
- $current = ord($value[$i]);
2101
- if ((0x9 == $current) || (0xA == $current) || (0xD == $current) || (($current >= 0x20) && ($current <= 0xD7FF)) || (($current >= 0xE000) && ($current <= 0xFFFD)) || (($current >= 0x10000) && ($current <= 0x10FFFF))) {
2102
  $ret .= chr($current);
2103
  } else {
2104
  $ret .= '';
@@ -2108,7 +2042,7 @@ if (!function_exists('woo_feed_stripInvalidXml')) {
2108
  return $ret;
2109
  }
2110
  }
2111
- if (!function_exists('woo_feed_get_formatted_url')) {
2112
  /**
2113
  * Get Formatted URL
2114
  *
@@ -2116,12 +2050,11 @@ if (!function_exists('woo_feed_get_formatted_url')) {
2116
  *
2117
  * @return string
2118
  */
2119
- function woo_feed_get_formatted_url($url = '')
2120
- {
2121
- if (!empty($url)) {
2122
- if (substr(trim($url), 0, 4) === 'http' || substr(trim($url),
2123
  0,
2124
- 3) === 'ftp' || substr(trim($url), 0, 4) === 'sftp') {
2125
  return rtrim($url, '/');
2126
  } else {
2127
  $base = get_site_url();
@@ -2134,7 +2067,7 @@ if (!function_exists('woo_feed_get_formatted_url')) {
2134
  return '';
2135
  }
2136
  }
2137
- if (!function_exists('array_value_first')) {
2138
  /**
2139
  * Get First Value of an array
2140
  *
@@ -2143,16 +2076,15 @@ if (!function_exists('array_value_first')) {
2143
  * @return mixed|null
2144
  * @since 3.0.0
2145
  */
2146
- function array_value_first(array $arr)
2147
- {
2148
- foreach ($arr as $key => $unused) {
2149
  return $unused;
2150
  }
2151
 
2152
  return null;
2153
  }
2154
  }
2155
- if (!function_exists('woo_feed_make_url_with_parameter')) {
2156
  /**
2157
  * Make proper URL using parameters
2158
  *
@@ -2161,26 +2093,25 @@ if (!function_exists('woo_feed_make_url_with_parameter')) {
2161
  *
2162
  * @return string
2163
  */
2164
- function woo_feed_make_url_with_parameter($output = '', $suffix = '')
2165
- {
2166
- if (empty($output) || empty($suffix)) {
2167
  return $output;
2168
  }
2169
 
2170
  $getParam = explode('?', $output);
2171
  $URLParam = array();
2172
- if (isset($getParam[1])) {
2173
  $URLParam = woo_feed_parse_string($getParam[1]);
2174
  }
2175
 
2176
  $EXTRAParam = array();
2177
- if (!empty($suffix)) {
2178
  $suffix = str_replace('?', '', $suffix);
2179
  $EXTRAParam = woo_feed_parse_string($suffix);
2180
  }
2181
 
2182
  $params = array_merge($URLParam, $EXTRAParam);
2183
- if (!empty($params) && '' != $output) {
2184
  $params = http_build_query($params);
2185
  $baseURL = isset($getParam) ? $getParam[0] : $output;
2186
  $output = $baseURL . '?' . $params;
@@ -2189,7 +2120,7 @@ if (!function_exists('woo_feed_make_url_with_parameter')) {
2189
  return $output;
2190
  }
2191
  }
2192
- if (!function_exists('woo_feed_parse_string')) {
2193
  /**
2194
  * Parse URL parameter
2195
  *
@@ -2197,49 +2128,48 @@ if (!function_exists('woo_feed_parse_string')) {
2197
  *
2198
  * @return array
2199
  */
2200
- function woo_feed_parse_string($str = '')
2201
- {
2202
 
2203
  // result array
2204
  $arr = array();
2205
 
2206
- if (empty($str)) {
2207
  return $arr;
2208
  }
2209
 
2210
  // split on outer delimiter
2211
  $pairs = explode('&', $str);
2212
 
2213
- if (!empty($pairs) && is_array($pairs)) {
2214
 
2215
  // loop through each pair
2216
- foreach ($pairs as $i) {
2217
  // split into name and value
2218
  list($name, $value) = explode('=', $i, 2);
2219
 
2220
  // if name already exists
2221
- if (isset($arr[$name])) {
2222
  // stick multiple values into an array
2223
- if (is_array($arr[$name])) {
2224
- $arr[$name][] = $value;
2225
  } else {
2226
- $arr[$name] = array($arr[$name], $value);
2227
  }
2228
  } // otherwise, simply stick it in a scalar
2229
  else {
2230
- $arr[$name] = $value;
2231
  }
2232
  }
2233
- } elseif (!empty($str)) {
2234
  list($name, $value) = explode('=', $str, 2);
2235
- $arr[$name] = $value;
2236
  }
2237
 
2238
  // return result array
2239
  return $arr;
2240
  }
2241
  }
2242
- if (!function_exists('woo_feed_replace_to_merchant_attribute')) {
2243
  /**
2244
  * Parse URL parameter
2245
  *
@@ -2249,51 +2179,50 @@ if (!function_exists('woo_feed_replace_to_merchant_attribute')) {
2249
  *
2250
  * @return string
2251
  */
2252
- function woo_feed_replace_to_merchant_attribute($pluginAttribute, $merchant, $feedType)
2253
- {
2254
  $attributeClass = new Woo_Feed_Default_Attributes();
2255
  $merchantAttributes = '';
2256
- if ('google' === $merchant
2257
  || 'google_shopping_action' === $merchant
2258
  || 'google_local' === $merchant
2259
  || 'google_local_inventory' === $merchant
2260
  || 'adroll' == $merchant
2261
- || 'smartly.io' == $merchant) {
2262
- if ('xml' === $feedType) {
2263
  $g_attributes = $attributeClass->googleXMLAttribute;
2264
- if ('google_local' === $merchant) {
2265
  unset($g_attributes['description']);
2266
  }
2267
  $merchantAttributes = $g_attributes;
2268
- } elseif ('csv' == $feedType || 'txt' == $feedType) {
2269
  $merchantAttributes = $attributeClass->googleCSVTXTAttribute;
2270
  }
2271
- } elseif ('facebook' == $merchant) {
2272
- if ('xml' == $feedType) {
2273
  $merchantAttributes = $attributeClass->facebookXMLAttribute;
2274
- } elseif ('csv' == $feedType || 'txt' == $feedType) {
2275
  $merchantAttributes = $attributeClass->facebookCSVTXTAttribute;
2276
  }
2277
- } elseif ('pinterest' == $merchant) {
2278
- if ('xml' == $feedType) {
2279
  $merchantAttributes = $attributeClass->pinterestXMLAttribute;
2280
- } elseif ('csv' == $feedType || 'txt' == $feedType) {
2281
  $merchantAttributes = $attributeClass->pinterestCSVTXTAttribute;
2282
  }
2283
- } elseif ('skroutz' == $merchant) {
2284
- if ('xml' == $feedType) {
2285
  $merchantAttributes = $attributeClass->skroutzXMLAttributes;
2286
  }
2287
  }
2288
 
2289
- if (!empty($merchantAttributes) && array_key_exists($pluginAttribute, $merchantAttributes)) {
2290
- return $merchantAttributes[$pluginAttribute][0];
2291
  }
2292
 
2293
  return $pluginAttribute;
2294
  }
2295
  }
2296
- if (!function_exists('woo_feed_add_cdata')) {
2297
  /**
2298
  * Parse URL parameter
2299
  *
@@ -2304,45 +2233,44 @@ if (!function_exists('woo_feed_add_cdata')) {
2304
  *
2305
  * @return string
2306
  */
2307
- function woo_feed_add_cdata($pluginAttribute, $attributeValue, $merchant, $feed_type)
2308
- {
2309
- if ("xml" !== $feed_type) {
2310
  return "$attributeValue";
2311
  }
2312
 
2313
- if ('custom' === $merchant) {
2314
  return "$attributeValue";
2315
  }
2316
 
2317
- if ("shipping" === $pluginAttribute || "tax" === $pluginAttribute) {
2318
  return "$attributeValue";
2319
  }
2320
 
2321
- if (strpos($attributeValue, '<![CDATA[') !== false) {
2322
  return "$attributeValue";
2323
  }
2324
 
2325
  $attributeClass = new Woo_Feed_Default_Attributes();
2326
  $merchantAttributes = '';
2327
- if ('google' == $merchant) {
2328
  $merchantAttributes = $attributeClass->googleXMLAttribute;
2329
- } elseif ('facebook' == $merchant) {
2330
  $merchantAttributes = $attributeClass->facebookXMLAttribute;
2331
- } elseif ('pinterest' == $merchant) {
2332
  $merchantAttributes = $attributeClass->pinterestXMLAttribute;
2333
- } elseif ('skroutz' == $merchant) {
2334
  $merchantAttributes = $attributeClass->skroutzXMLAttributes;
2335
  }
2336
 
2337
- if (!empty($merchantAttributes) && array_key_exists($pluginAttribute, $merchantAttributes)) {
2338
- if ('true' == $merchantAttributes[$pluginAttribute][1]) {
2339
  return "<![CDATA[$attributeValue]]>";
2340
  } else {
2341
  return "$attributeValue";
2342
  }
2343
- } elseif (false !== strpos($attributeValue, '&') || 'http' == substr(trim($attributeValue), 0, 4)) {
2344
- if ('catch.com.au' === $merchant) {
2345
- if (false !== strpos($pluginAttribute, 'image')) {
2346
  return "$attributeValue";
2347
  }
2348
  } else {
@@ -2355,7 +2283,7 @@ if (!function_exists('woo_feed_add_cdata')) {
2355
  }
2356
 
2357
  // WooFeed Settings API
2358
- if (!function_exists('woo_feed_get_options')) {
2359
  /**
2360
  * Get saved settings.
2361
  *
@@ -2367,47 +2295,46 @@ if (!function_exists('woo_feed_get_options')) {
2367
  * @return array|bool|string|mixed
2368
  * @since 3.3.11
2369
  */
2370
- function woo_feed_get_options($key, $default = false)
2371
- {
2372
  $defaults = [
2373
- 'per_batch' => 200,
2374
- 'product_query_type' => 'wc',
2375
- 'variation_query_type' => 'individual',
2376
- 'enable_error_debugging' => 'off',
2377
- 'cache_ttl' => 6 * HOUR_IN_SECONDS,
2378
  'overridden_structured_data' => 'off',
2379
- 'disable_mpn' => 'enable',
2380
- 'disable_brand' => 'enable',
2381
- 'disable_pixel' => 'enable',
2382
- 'pixel_id' => '',
2383
- 'disable_remarketing' => 'disable',
2384
- 'remarketing_id' => '',
2385
- 'remarketing_label' => '',
2386
- 'allow_all_shipping' => 'no',
2387
- 'only_free_shipping' => 'yes',
2388
  'only_local_pickup_shipping' => 'no',
2389
- 'enable_ftp_upload' => 'no',
2390
- 'woo_feed_taxonomy' => array(
2391
- 'brand' => 'disable'
2392
  ),
2393
- 'woo_feed_identifier' => array(
2394
- 'gtin' => 'disable',
2395
- 'ean' => 'disable',
2396
- 'mpn' => 'disable',
2397
- 'isbn' => 'disable',
2398
- 'age_group' => 'disable',
2399
- 'material' => 'disable',
2400
- 'gender' => 'disable',
2401
- 'cost_of_good_sold' => 'disable',
2402
- 'availability_date' => 'enable',
2403
- 'unit' => 'disable',
2404
- 'unit_pricing_measure' => 'disable',
2405
  'unit_pricing_base_measure' => 'disable',
2406
- 'custom_field_0' => 'disable',
2407
- 'custom_field_1' => 'disable',
2408
- 'custom_field_2' => 'disable',
2409
- 'custom_field_3' => 'disable',
2410
- 'custom_field_4' => 'disable',
2411
  ),
2412
  ];
2413
 
@@ -2420,24 +2347,24 @@ if (!function_exists('woo_feed_get_options')) {
2420
  */
2421
  $defaults = wp_parse_args(apply_filters('woo_feed_settings_extra_defaults', []), $defaults);
2422
 
2423
- if ('defaults' === $key) {
2424
  return $defaults;
2425
  }
2426
 
2427
  $settings = wp_parse_args(get_option('woo_feed_settings', []), $defaults);
2428
 
2429
- if ('all' === $key) {
2430
  return $settings;
2431
  }
2432
 
2433
- if (array_key_exists($key, $settings)) {
2434
- return $settings[$key];
2435
  }
2436
 
2437
  return $default;
2438
  }
2439
  }
2440
- if (!function_exists('woo_feed_save_options')) {
2441
  /**
2442
  * Save Settings.
2443
  *
@@ -2446,63 +2373,62 @@ if (!function_exists('woo_feed_save_options')) {
2446
  * @return bool
2447
  * @since 3.3.11
2448
  */
2449
- function woo_feed_save_options($args)
2450
- {
2451
  $data = woo_feed_get_options('all');
2452
  $defaults = woo_feed_get_options('defaults');
2453
  $_data = $data;
2454
 
2455
- if (array_key_exists('per_batch', $args)) {
2456
  $data['per_batch'] = absint($args['per_batch']);
2457
- if ($data['per_batch'] <= 0) {
2458
  $data['per_batch'] = $_data['per_batch'] > 0 ? $_data['per_batch'] : $defaults['per_batch'];
2459
  }
2460
  unset($args['unset']);
2461
  }
2462
- if (array_key_exists('product_query_type', $args)) {
2463
  $data['product_query_type'] = strtolower($args['product_query_type']);
2464
  $query_types = array_keys(woo_feed_get_query_type_options());
2465
- if (!in_array($data['product_query_type'], $query_types)) {
2466
  $data['product_query_type'] = in_array($_data['product_query_type'], $query_types) ? $_data['product_query_type'] : $defaults['product_query_type'];
2467
  }
2468
  unset($args['product_query_type']);
2469
  }
2470
- if (array_key_exists('variation_query_type', $args)) {
2471
  $data['variation_query_type'] = strtolower($args['variation_query_type']);
2472
  $query_types = array_keys(woo_feed_get_query_type_options('variation'));
2473
- if (!in_array($data['variation_query_type'], $query_types, true)) {
2474
  $data['variation_query_type'] = in_array($_data['variation_query_type'], $query_types, true) ? $_data['variation_query_type'] : $defaults['variation_query_type'];
2475
  }
2476
  unset($args['variation_query_type']);
2477
  }
2478
- if (array_key_exists('enable_error_debugging', $args)) {
2479
  $data['enable_error_debugging'] = strtolower($args['enable_error_debugging']);
2480
- if (!in_array($data['enable_error_debugging'], ['on', 'off'])) {
2481
- $data['enable_error_debugging'] = in_array($_data['enable_error_debugging'], ['on', 'off']) ? $_data['enable_error_debugging'] : $defaults['enable_error_debugging'];
2482
  }
2483
  unset($args['enable_error_debugging']);
2484
  }
2485
- if (array_key_exists('cache_ttl', $args)) {
2486
  $data['cache_ttl'] = absint($args['cache_ttl']); // cache ttl can be zero.
2487
  unset($args['cache_ttl']);
2488
  }
2489
- if (array_key_exists('overridden_structured_data', $args)) {
2490
  $data['overridden_structured_data'] = strtolower($args['overridden_structured_data']);
2491
- if (!in_array($data['overridden_structured_data'], array('on', 'off'))) {
2492
- $data['overridden_structured_data'] = in_array($_data['overridden_structured_data'], array('on', 'off')) ? $_data['overridden_structured_data'] : $defaults['overridden_structured_data'];
2493
  }
2494
  unset($args['overridden_structured_data']);
2495
  }
2496
 
2497
- if (array_key_exists('disable_pixel', $args)) {
2498
  $data['disable_pixel'] = strtolower($args['disable_pixel']);
2499
- if (!in_array($data['disable_pixel'], array('enable', 'disable'))) {
2500
- $data['disable_pixel'] = in_array($_data['disable_pixel'], array('enable', 'disable')) ? $_data['disable_pixel'] : $defaults['disable_pixel'];
2501
  }
2502
  unset($args['disable_pixel']);
2503
  }
2504
- if (array_key_exists('pixel_id', $args)) {
2505
- if (isset($args['pixel_id']) && !empty($args['pixel_id'])) {
2506
  $data['pixel_id'] = absint($args['pixel_id']);
2507
  } else {
2508
  $data['pixel_id'] = $defaults['pixel_id'];
@@ -2510,23 +2436,23 @@ if (!function_exists('woo_feed_save_options')) {
2510
  unset($args['pixel_id']);
2511
  }
2512
 
2513
- if (array_key_exists('disable_remarketing', $args)) {
2514
  $data['disable_remarketing'] = strtolower($args['disable_remarketing']);
2515
- if (!in_array($data['disable_remarketing'], array('enable', 'disable'))) {
2516
- $data['disable_remarketing'] = in_array($_data['disable_remarketing'], array('enable', 'disable')) ? $_data['disable_remarketing'] : $defaults['disable_remarketing'];
2517
  }
2518
  unset($args['disable_remarketing']);
2519
  }
2520
- if (array_key_exists('remarketing_id', $args)) {
2521
- if (isset($args['remarketing_id']) && !empty($args['remarketing_id'])) {
2522
  $data['remarketing_id'] = $args['remarketing_id'];
2523
  } else {
2524
  $data['remarketing_id'] = $defaults['remarketing_id'];
2525
  }
2526
  unset($args['remarketing_id']);
2527
  }
2528
- if (array_key_exists('remarketing_label', $args)) {
2529
- if (isset($args['remarketing_label']) && !empty($args['remarketing_label'])) {
2530
  $data['remarketing_label'] = $args['remarketing_label'];
2531
  } else {
2532
  $data['remarketing_label'] = $defaults['remarketing_label'];
@@ -2534,43 +2460,43 @@ if (!function_exists('woo_feed_save_options')) {
2534
  unset($args['remarketing_label']);
2535
  }
2536
 
2537
- if (array_key_exists('allow_all_shipping', $args)) {
2538
  $data['allow_all_shipping'] = strtolower($args['allow_all_shipping']);
2539
- if (!in_array($data['allow_all_shipping'], array('yes', 'no'))) {
2540
- $data['allow_all_shipping'] = in_array($_data['allow_all_shipping'], array('yes', 'no')) ? $_data['allow_all_shipping'] : $defaults['allow_all_shipping'];
2541
  }
2542
  unset($args['allow_all_shipping']);
2543
  }
2544
 
2545
- if (array_key_exists('only_free_shipping', $args)) {
2546
  $data['only_free_shipping'] = strtolower($args['only_free_shipping']);
2547
- if (!in_array($data['only_free_shipping'], array('yes', 'no'))) {
2548
- $data['only_free_shipping'] = in_array($_data['only_free_shipping'], array('yes', 'no')) ? $_data['only_free_shipping'] : $defaults['only_free_shipping'];
2549
  }
2550
  unset($args['only_free_shipping']);
2551
  }
2552
 
2553
- if (array_key_exists('only_local_pickup_shipping', $args)) {
2554
  $data['only_local_pickup_shipping'] = strtolower($args['only_local_pickup_shipping']);
2555
- if (!in_array($data['only_local_pickup_shipping'], array('yes', 'no'))) {
2556
- $data['only_local_pickup_shipping'] = in_array($_data['only_local_pickup_shipping'], array('yes', 'no')) ? $_data['only_local_pickup_shipping'] : $defaults['only_local_pickup_shipping'];
2557
  }
2558
  unset($args['only_local_pickup_shipping']);
2559
  }
2560
 
2561
 
2562
- if (array_key_exists('enable_ftp_upload', $args)) {
2563
  $data['enable_ftp_upload'] = strtolower($args['enable_ftp_upload']);
2564
- if (!in_array($data['enable_ftp_upload'], array('yes', 'no'))) {
2565
- $data['enable_ftp_upload'] = in_array($_data['enable_ftp_upload'], array('yes', 'no')) ? $_data['enable_ftp_upload'] : $defaults['enable_ftp_upload'];
2566
  }
2567
  unset($args['enable_ftp_upload']);
2568
  }
2569
 
2570
- if (!empty($args)) {
2571
- foreach ($args as $key => $value) {
2572
- if (has_filter("woo_feed_save_{$key}_option")) {
2573
- $data[$key] = apply_filters("woo_feed_save_{$key}_option", sanitize_text_field($value));
2574
  }
2575
  }
2576
  }
@@ -2578,21 +2504,20 @@ if (!function_exists('woo_feed_save_options')) {
2578
  return update_option('woo_feed_settings', $data, false);
2579
  }
2580
  }
2581
- if (!function_exists('woo_feed_reset_options')) {
2582
  /**
2583
  * Restore the default settings.
2584
  *
2585
  * @return bool
2586
  * @since 3.3.11
2587
  */
2588
- function woo_feed_reset_options()
2589
- {
2590
  return update_option('woo_feed_settings', woo_feed_get_options('defaults'), false);
2591
  }
2592
  }
2593
 
2594
  // Caching. Wrapper for Transient API.
2595
- if (!function_exists('woo_feed_get_cached_data')) {
2596
  /**
2597
  * Get Cached Data
2598
  *
@@ -2601,16 +2526,15 @@ if (!function_exists('woo_feed_get_cached_data')) {
2601
  * @return mixed|false false if cache not found.
2602
  * @since 3.3.10
2603
  */
2604
- function woo_feed_get_cached_data($key)
2605
- {
2606
- if (empty($key)) {
2607
  return false;
2608
  }
2609
 
2610
  return get_transient('__woo_feed_cache_' . $key);
2611
  }
2612
  }
2613
- if (!function_exists('woo_feed_set_cache_data')) {
2614
  /**
2615
  *
2616
  * @param string $key Cache name. Expected to not be SQL-escaped. Must be
@@ -2621,10 +2545,9 @@ if (!function_exists('woo_feed_set_cache_data')) {
2621
  *
2622
  * @return bool
2623
  */
2624
- function woo_feed_set_cache_data($key, $data, $expiration = false)
2625
- {
2626
 
2627
- if (empty($key)) {
2628
  return false;
2629
  }
2630
 
@@ -2633,30 +2556,28 @@ if (!function_exists('woo_feed_set_cache_data')) {
2633
  return set_transient('__woo_feed_cache_' . $key, $data, (int)$expiration);
2634
  }
2635
  }
2636
- if (!function_exists('woo_feed_delete_cache_data')) {
2637
  /**
2638
  * Delete Cached Data
2639
  * @param string $key cache name.
2640
  *
2641
  * @return bool
2642
  */
2643
- function woo_feed_delete_cache_data($key)
2644
- {
2645
- if (empty($key)) {
2646
  return false;
2647
  }
2648
 
2649
  return delete_transient('__woo_feed_cache_' . $key);
2650
  }
2651
  }
2652
- if (!function_exists('woo_feed_flush_cache_data')) {
2653
  /**
2654
  * Delete All Cached Data
2655
  *
2656
  * @return void
2657
  */
2658
- function woo_feed_flush_cache_data()
2659
- {
2660
  global $wpdb;
2661
  // $wpdb->query( "DELETE FROM $wpdb->options WHERE {$wpdb->options}.option_name LIKE '_transient___woo_feed_cache_%' " ); // phpcs:ignore
2662
  // $wpdb->query( "DELETE FROM $wpdb->options WHERE {$wpdb->options}.option_name LIKE '_transient_timeout___woo_feed_cache_%'" ); // phpcs:ignore
@@ -2665,7 +2586,7 @@ if (!function_exists('woo_feed_flush_cache_data')) {
2665
  }
2666
 
2667
  // Price And Tax.
2668
- if (!function_exists('woo_feed_apply_tax_location_data')) {
2669
  /**
2670
  * Filter and Change Location data for tax calculation
2671
  *
@@ -2675,8 +2596,7 @@ if (!function_exists('woo_feed_apply_tax_location_data')) {
2675
  *
2676
  * @return array
2677
  */
2678
- function woo_feed_apply_tax_location_data($location, $tax_class, $customer)
2679
- {
2680
  // @TODO use filter. add tab in feed editor so user can set custom settings.
2681
  // @TODO tab should not list all country and cities. it only list available tax settings and user can just select one.
2682
  // @TODO then it will extract the location data from it to use here.
@@ -2694,7 +2614,7 @@ if (!function_exists('woo_feed_apply_tax_location_data')) {
2694
  * @since 3.3.0
2695
  */
2696
  $tax_location = apply_filters('woo_feed_tax_location_data', $wc_tax_location);
2697
- if (!is_array($tax_location) || (is_array($tax_location) && 4 !== count($tax_location))) {
2698
  $tax_location = $wc_tax_location;
2699
  }
2700
 
@@ -2703,15 +2623,14 @@ if (!function_exists('woo_feed_apply_tax_location_data')) {
2703
  }
2704
 
2705
  // Hook feed generating process...
2706
- if (!function_exists('woo_feed_apply_hooks_before_product_loop')) {
2707
  /**
2708
  * Apply Hooks Before Looping through ProductIds
2709
  *
2710
  * @param int[] $productIds product id array.
2711
  * @param array $feedConfig feed config array.
2712
  */
2713
- function woo_feed_apply_hooks_before_product_loop($productIds, $feedConfig)
2714
- {
2715
  add_filter('woocommerce_get_tax_location', 'woo_feed_apply_tax_location_data', 10, 3);
2716
 
2717
  // RightPress dynamic pricing support.
@@ -2721,7 +2640,7 @@ if (!function_exists('woo_feed_apply_hooks_before_product_loop')) {
2721
  }
2722
  }
2723
 
2724
- if (!function_exists('woo_feed_remove_hooks_after_product_loop')) {
2725
  /**
2726
  * Remove Applied Hooks Looping through ProductIds
2727
  *
@@ -2730,8 +2649,7 @@ if (!function_exists('woo_feed_remove_hooks_after_product_loop')) {
2730
  *
2731
  * @see woo_feed_apply_hooks_before_product_loop
2732
  */
2733
- function woo_feed_remove_hooks_after_product_loop($productIds, $feedConfig)
2734
- {
2735
  remove_filter('woocommerce_get_tax_location', 'woo_feed_apply_tax_location_data', 10);
2736
 
2737
  // RightPress dynamic pricing support.
@@ -2740,7 +2658,7 @@ if (!function_exists('woo_feed_remove_hooks_after_product_loop')) {
2740
 
2741
  }
2742
  }
2743
- if (!function_exists('woo_feed_remove_hooks_before_product_loop')) {
2744
  /**
2745
  * Remove Applied Hooks Looping through ProductIds
2746
  *
@@ -2749,13 +2667,12 @@ if (!function_exists('woo_feed_remove_hooks_before_product_loop')) {
2749
  *
2750
  * @see woo_feed_apply_hooks_before_product_loop
2751
  */
2752
- function woo_feed_remove_hooks_before_product_loop($productIds, $feedConfig)
2753
- {
2754
  remove_filter('woocommerce_get_tax_location', 'woo_feed_apply_tax_location_data', 10);
2755
  }
2756
  }
2757
 
2758
- if (!function_exists('woo_feed_product_taxonomy_term_separator')) {
2759
  /**
2760
  * Filter Product local category (type) separator
2761
  *
@@ -2764,20 +2681,19 @@ if (!function_exists('woo_feed_product_taxonomy_term_separator')) {
2764
  *
2765
  * @return string
2766
  */
2767
- function woo_feed_product_taxonomy_term_separator($separator, $config)
2768
- {
2769
- if ('trovaprezzi' === $config['provider']) {
2770
  $separator = ',';
2771
  }
2772
 
2773
- if (false !== strpos($config['provider'], 'daisycon')) {
2774
  $separator = '|';
2775
  }
2776
 
2777
  return $separator;
2778
  }
2779
  }
2780
- if (!function_exists('woo_feed_get_availability_attribute_filter')) {
2781
  /**
2782
  * Filter Product Availability Attribute Output For Template
2783
  *
@@ -2787,32 +2703,31 @@ if (!function_exists('woo_feed_get_availability_attribute_filter')) {
2787
  *
2788
  * @return int
2789
  */
2790
- function woo_feed_get_availability_attribute_filter($output, $product, $config)
2791
- {
2792
  $status = $product->get_stock_status();
2793
  $provider = $config['provider'];
2794
 
2795
- if ('trovaprezzi' === $provider) {
2796
  $output = 2;
2797
- if ($status) {
2798
- if ('instock' == $status) {
2799
  $output = 2;
2800
- } elseif ('outofstock' == $status) {
2801
  $output = 0;
2802
- } elseif ('onbackorder' == $status) {
2803
  $output = 1;
2804
  }
2805
  }
2806
  }
2807
 
2808
- if (false !== strpos($provider, 'daisycon')) {
2809
  $output = 'true';
2810
- if ($status) {
2811
- if ('instock' == $status) {
2812
  $output = 'true';
2813
- } elseif ('outofstock' == $status) {
2814
  $output = 'false';
2815
- } elseif ('onbackorder' == $status) {
2816
  $output = 'false';
2817
  }
2818
  }
@@ -2823,7 +2738,7 @@ if (!function_exists('woo_feed_get_availability_attribute_filter')) {
2823
  }
2824
 
2825
  // Parse feed rules.
2826
- if (!function_exists('woo_feed_filter_parsed_rules')) {
2827
  /**
2828
  * Filter Feed parsed rules
2829
  *
@@ -2833,24 +2748,23 @@ if (!function_exists('woo_feed_filter_parsed_rules')) {
2833
  * @return array
2834
  * @since 3.3.7
2835
  */
2836
- function woo_feed_filter_parsed_rules($rules, $context)
2837
- {
2838
  $provider = $rules['provider'];
2839
 
2840
- if ('create' === $context) {
2841
- if ('criteo' === $provider) {
2842
  $rules['itemsWrapper'] = 'channel';
2843
  $rules['itemWrapper'] = 'item';
2844
  }
2845
 
2846
- if ('wine_searcher' === $provider) {
2847
  $rules['itemsWrapper'] = 'product-list';
2848
  $rules['itemWrapper'] = 'row';
2849
  $rules['delimiter'] = '|';
2850
  $rules['enclosure'] = ' ';
2851
  }
2852
 
2853
- if ('trovaprezzi' === $provider) {
2854
  $rules['decimal_separator'] = ',';
2855
  $rules['thousand_separator'] = '';
2856
  $rules['decimals'] = 2;
@@ -2860,17 +2774,17 @@ if (!function_exists('woo_feed_filter_parsed_rules')) {
2860
  $rules['enclosure'] = ' ';
2861
  }
2862
 
2863
- if (false !== strpos($provider, 'daisycon')) {
2864
  $rules['itemsWrapper'] = 'channel';
2865
  $rules['itemWrapper'] = 'item';
2866
  }
2867
 
2868
- if (false !== strpos($provider, 'zbozi.cz')) {
2869
  $rules['itemsWrapper'] = 'SHOP xmlns="http://www.zbozi.cz/ns/offer/1.0"';
2870
  $rules['itemWrapper'] = 'SHOPITEM';
2871
  }
2872
 
2873
- if (false !== strpos($provider, 'heureka.sk')) {
2874
  $rules['itemWrapper'] = 'SHOPITEM';
2875
  }
2876
  }
@@ -2879,14 +2793,13 @@ if (!function_exists('woo_feed_filter_parsed_rules')) {
2879
  }
2880
  }
2881
 
2882
- if (!function_exists('array_splice_preserve_keys')) {
2883
  /**
2884
  * Function to splice an array keeping key
2885
  */
2886
- function array_splice_preserve_keys(&$input, $offset, $length = null, $replacement = array())
2887
- {
2888
 
2889
- if (empty($replacement)) {
2890
  return array_splice($input, $offset, $length);
2891
  }
2892
 
@@ -2900,9 +2813,8 @@ if (!function_exists('array_splice_preserve_keys')) {
2900
  }
2901
  }
2902
 
2903
- if (!function_exists('woo_feed_product_custom_fields')) {
2904
- function woo_feed_product_custom_fields()
2905
- {
2906
  /**
2907
  * Here array of a field contain 3 elements
2908
  * 1. Name
@@ -2910,40 +2822,39 @@ if (!function_exists('woo_feed_product_custom_fields')) {
2910
  * 3. Is this fields is a custom taxonomy
2911
  */
2912
  $custom_fields = array(
2913
- 'brand' => array(__('Brand', 'woo-feed'), true, true),
2914
- 'gtin' => array(__('GTIN', 'woo-feed'), true),
2915
- 'mpn' => array(__('MPN', 'woo-feed'), true),
2916
- 'ean' => array(__('EAN', 'woo-feed'), true),
2917
- 'isbn' => array(__('ISBN', 'woo-feed'), true),
2918
- 'age_group' => array(__('Age group', 'woo-feed'), true),
2919
- 'gender' => array(__('Gender', 'woo-feed'), true),
2920
- 'material' => array(__('Material', 'woo-feed'), true),
2921
- 'cost_of_good_sold' => array(__('Cost of good sold', 'woo-feed'), true),
2922
- 'availability_date' => array(__('Availability Date', 'woo-feed'), true, false, false),
2923
- 'unit' => array(__('Unit', 'woo-feed'), true),
2924
- 'unit_pricing_measure' => array(__('Unit Price Measure', 'woo-feed'), true),
2925
- 'unit_pricing_base_measure' => array(__('Unit Price Base Measure', 'woo-feed'), true),
2926
- 'custom_field_0' => array(__('Custom field 0', 'woo-feed'), true),
2927
- 'custom_field_1' => array(__('Custom field 1', 'woo-feed'), true),
2928
- 'custom_field_2' => array(__('Custom field 2', 'woo-feed'), true),
2929
- 'custom_field_3' => array(__('Custom field 3', 'woo-feed'), true),
2930
- 'custom_field_4' => array(__('Custom field 4', 'woo-feed'), true),
2931
  );
2932
  return apply_filters('woo_feed_product_custom_fields', $custom_fields);
2933
  }
2934
  }
2935
 
2936
- if (!function_exists('woo_feed_product_attribute_cache_remove_cb')) {
2937
 
2938
  add_action('wp_ajax_woo_feed_product_attribute_cache_remove', 'woo_feed_product_attribute_cache_remove_cb');
2939
  /**
2940
  * This function is called when product attribute swicher click.
2941
  */
2942
- function woo_feed_product_attribute_cache_remove_cb()
2943
- {
2944
  $is_nonce_valid = isset($_POST['nonce']) && wp_verify_nonce(sanitize_text_field($_POST['nonce']), 'wpf_feed_nonce');
2945
 
2946
- if ($is_nonce_valid) {
2947
  delete_transient('__woo_feed_cache_woo_feed_dropdown_product_attributes');
2948
  } else {
2949
  wp_send_json_error(esc_html__('Invalid Request.', 'woo-feed'));
@@ -2953,25 +2864,24 @@ if (!function_exists('woo_feed_product_attribute_cache_remove_cb')) {
2953
  }
2954
  }
2955
 
2956
- if (!function_exists('woo_feed_custom_fields_status_change_cb')) {
2957
  add_action('wp_ajax_woo_feed_custom_fields_status_change', 'woo_feed_custom_fields_status_change_cb');
2958
  /**
2959
  * This AJAX callback function is called when custom fields on/off switched
2960
  */
2961
- function woo_feed_custom_fields_status_change_cb()
2962
- {
2963
  $is_nonce_valid = isset($_POST['nonce']) && wp_verify_nonce(sanitize_text_field(wp_unslash($_POST['nonce'])), 'wpf_feed_nonce');
2964
 
2965
- if ($is_nonce_valid && isset($_POST['field'], $_POST['status'],
2966
- $_POST['isTaxonomy'])) {
2967
  $field = sanitize_text_field(wp_unslash($_POST['field']));
2968
  $is_taxonomy = sanitize_text_field(wp_unslash($_POST['isTaxonomy']));
2969
  $status = sanitize_text_field(wp_unslash($_POST['status']));
2970
  $data = woo_feed_get_options('all');
2971
- if ('true' === $is_taxonomy) {
2972
- $data['woo_feed_taxonomy'][$field] = ('true' === $status) ? 'enable' : 'disable';
2973
  } else {
2974
- $data['woo_feed_identifier'][$field] = ('true' === $status) ? 'enable' : 'disable';
2975
  }
2976
  update_option('woo_feed_settings', $data, false);
2977
  } else {
@@ -2982,22 +2892,21 @@ if (!function_exists('woo_feed_custom_fields_status_change_cb')) {
2982
  }
2983
  }
2984
 
2985
- if (!function_exists('woo_feed_add_custom_identifier')) {
2986
  /**
2987
  * Add Custom fields into product inventory tab for Unique Identifier (GTIN,MPN,EAN)
2988
  *
2989
  * @since 3.7.8
2990
  */
2991
- function woo_feed_add_custom_identifier()
2992
- {
2993
  $custom_fields = woo_feed_product_custom_fields();
2994
  $custom_identifier_filter = new Woo_Feed_Custom_Identifier_Filter($custom_fields);
2995
  $custom_identifier = iterator_to_array($custom_identifier_filter);
2996
 
2997
  echo '<div class="options_group">';
2998
- if (!empty($custom_identifier)) {
2999
  echo sprintf('<h4 class="%s" style="padding-left: 10px;color: black;">%s</h4>', esc_attr('woo-feed-option-title'), esc_html__('CUSTOM FIELDS by CTX Feed', 'woo-feed'));
3000
- foreach ($custom_identifier as $key => $value) {
3001
 
3002
  //identifier meta value for old and new version users
3003
  $custom_field_key_previous = sprintf('woo_feed_identifier_%s', strtolower($key));
@@ -3006,21 +2915,21 @@ if (!function_exists('woo_feed_add_custom_identifier')) {
3006
  $custom_field_key = sprintf('woo_feed_%s', strtolower($key));
3007
  $custom_field_value = get_post_meta( get_the_ID(), $custom_field_key, true );
3008
 
3009
- if( empty( $custom_field_value ) && !empty( $custom_field_value_previous ) ){
3010
  $custom_field_key = $custom_field_key_previous;
3011
  $custom_field_value = $custom_field_value_previous;
3012
  }
3013
 
3014
  $custom_field_id = esc_attr(wp_unslash("woo_feed_{$key}"));
3015
- $custom_field_label = esc_attr(wp_unslash($custom_fields[$key][0]));
3016
  $custom_field_description = __('Set product ', 'woo-feed') . esc_html($custom_field_label) . __(' here.', 'woo-feed');
3017
  woocommerce_wp_text_input(
3018
  array(
3019
- 'id' => $custom_field_id,
3020
- 'value' => esc_attr( wp_unslash( $custom_field_value ) ),
3021
  'placeholder' => $custom_field_label,
3022
- 'label' => $custom_field_label,
3023
- 'desc_tip' => true,
3024
  'description' => $custom_field_description,
3025
  )
3026
  );
@@ -3034,7 +2943,7 @@ if (!function_exists('woo_feed_add_custom_identifier')) {
3034
  add_action('woocommerce_product_options_inventory_product_data', 'woo_feed_add_custom_identifier');
3035
  }
3036
 
3037
- if (!function_exists('woo_feed_save_custom_identifier')) {
3038
 
3039
  /**
3040
  * Updating custom fields data. (Unique Identifier (GTIN,MPN,EAN))
@@ -3043,17 +2952,16 @@ if (!function_exists('woo_feed_save_custom_identifier')) {
3043
  * @param WP_Post $post Wp Post Object.
3044
  * @since 3.7.8
3045
  */
3046
- function woo_feed_save_custom_identifier($product_id, $product)
3047
- {
3048
  $custom_fields = woo_feed_product_custom_fields();
3049
  $custom_identifier_filter = new Woo_Feed_Custom_Identifier_Filter($custom_fields);
3050
  $custom_identifier = iterator_to_array($custom_identifier_filter);
3051
 
3052
- if (!empty($custom_identifier)) {
3053
- foreach ($custom_identifier as $key => $name) {
3054
  $product_meta_key = "woo_feed_{$key}";
3055
- $product_meta_value = isset($_POST[$product_meta_key]) ? sanitize_text_field($_POST[$product_meta_key]) : (isset($_POST["woo_feed_identifier_{$key}"]) ? sanitize_text_field($_POST["woo_feed_identifier_{$key}"]) : '');
3056
- if (isset($product_meta_value) && !empty($product_meta_value)) {
3057
  update_post_meta($product_id, $product_meta_key, $product_meta_value);
3058
  } else {
3059
  delete_post_meta($product_id, $product_meta_key);
@@ -3066,7 +2974,7 @@ if (!function_exists('woo_feed_save_custom_identifier')) {
3066
  add_action('save_post_product', 'woo_feed_save_custom_identifier', 10, 2);
3067
  }
3068
 
3069
- if (!function_exists('woo_feed_add_custom_identifier_for_variation')) {
3070
 
3071
  /**
3072
  * Custom options in variation tab, here we are putting gtin, mpn, ean input fields in product variation tab
@@ -3077,27 +2985,26 @@ if (!function_exists('woo_feed_add_custom_identifier_for_variation')) {
3077
  *
3078
  * @since 3.7.8
3079
  */
3080
- function woo_feed_add_custom_identifier_for_variation($loop, $variation_data, $variation)
3081
- {
3082
  $settings = woo_feed_get_options('all');
3083
- if (isset($settings['disable_mpn']) && "enable" === $settings['disable_mpn']) {
3084
  echo '<div class="woo-feed-variation-options">';
3085
  $custom_fields = woo_feed_product_custom_fields();
3086
  $custom_identifier_filter = new Woo_Feed_Custom_Identifier_Filter($custom_fields);
3087
  $custom_identifier = iterator_to_array($custom_identifier_filter);
3088
 
3089
- if (!empty($custom_identifier)) {
3090
  echo '<div class="woo-feed-variation-options">';
3091
  echo sprintf('<h4 class="%s">%s</h4>', esc_attr('woo-feed-variation-option-title'), esc_html__('CUSTOM FIELDS by CTX Feed', 'woo-feed'));
3092
  echo '<div class="woo-feed-variation-items">';
3093
 
3094
- foreach ($custom_identifier as $key => $value) {
3095
  $custom_field_id = sprintf('woo_feed_%s_var[%d]', strtolower($key), $variation->ID);
3096
  $custom_field_label = isset($value[0]) ? $value[0] : '';
3097
  $custom_field_description = sprintf('Set product %s here.', $custom_field_label);
3098
 
3099
  //identifier meta value for old and new version users
3100
- if (metadata_exists('post', $variation->ID, 'woo_feed_' . strtolower($key) . '_var')) {
3101
  $custom_field_key = sprintf('woo_feed_%s_var', strtolower($key));
3102
  } else {
3103
  $custom_field_key = sprintf('woo_feed_identifier_%s_var', strtolower($key));
@@ -3105,12 +3012,12 @@ if (!function_exists('woo_feed_add_custom_identifier_for_variation')) {
3105
 
3106
  woocommerce_wp_text_input(
3107
  array(
3108
- 'id' => $custom_field_id,
3109
- 'value' => esc_attr(get_post_meta($variation->ID, $custom_field_key, true)),
3110
- 'placeholder' => esc_html($custom_field_label),
3111
- 'label' => esc_html($custom_field_label),
3112
- 'desc_tip' => true,
3113
- 'description' => esc_html($custom_field_description),
3114
  'wrapper_class' => 'form-row form-row-full',
3115
  )
3116
  );
@@ -3124,7 +3031,7 @@ if (!function_exists('woo_feed_add_custom_identifier_for_variation')) {
3124
  add_action('woocommerce_product_after_variable_attributes', 'woo_feed_add_custom_identifier_for_variation', 10, 3);
3125
  }
3126
 
3127
- if (!function_exists('woo_feed_save_custom_identifier_for_variation')) {
3128
 
3129
  /**
3130
  * Saving variation custom fields.
@@ -3134,16 +3041,15 @@ if (!function_exists('woo_feed_save_custom_identifier_for_variation')) {
3134
  *
3135
  * @since 3.7.8
3136
  */
3137
- function woo_feed_save_custom_identifier_for_variation($variation_id, $i)
3138
- {
3139
  $custom_fields = woo_feed_product_custom_fields();
3140
  $custom_identifier_filter = new Woo_Feed_Custom_Identifier_Filter($custom_fields);
3141
  $custom_identifier = iterator_to_array($custom_identifier_filter);
3142
 
3143
- if (!empty($custom_identifier)) {
3144
- foreach ($custom_identifier as $key => $value) {
3145
- $custom_field_value = isset($_POST["woo_feed_{$key}_var"][$variation_id]) ? sanitize_text_field($_POST["woo_feed_{$key}_var"][$variation_id]) : (isset($_POST["woo_feed_identifier_{$key}_var"][$variation_id]) ? sanitize_text_field($_POST["woo_feed_identifier_{$key}_var"]) : '');
3146
- if (isset($custom_field_value)) {
3147
  update_post_meta($variation_id, "woo_feed_{$key}_var", $custom_field_value);
3148
  }
3149
  }
@@ -3154,15 +3060,14 @@ if (!function_exists('woo_feed_save_custom_identifier_for_variation')) {
3154
  add_action('woocommerce_save_product_variation', 'woo_feed_save_custom_identifier_for_variation', 10, 2);
3155
  }
3156
 
3157
- if (!function_exists('woo_feed_category_mapping')) {
3158
  /**
3159
  * Category Mapping
3160
  */
3161
- function woo_feed_category_mapping()
3162
- {
3163
  // Manage action for category mapping.
3164
- if (isset($_GET['action'], $_GET['cmapping']) && 'edit-mapping' == $_GET['action']) {
3165
- if (count($_POST) && isset($_POST['mappingname']) && isset($_POST['edit-mapping'])) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
3166
  check_admin_referer('category-mapping');
3167
 
3168
  $mappingOption = sanitize_text_field(wp_unslash($_POST['mappingname']));
@@ -3173,13 +3078,13 @@ if (!function_exists('woo_feed_category_mapping')) {
3173
  # Delete product attribute drop-down cache
3174
  delete_transient('__woo_feed_cache_woo_feed_dropdown_product_attributes');
3175
 
3176
- if ($oldMapping === $mappingData) {
3177
  update_option('wpf_message', esc_html__('Mapping Not Changed', 'woo-feed'), false);
3178
  wp_safe_redirect(admin_url('admin.php?page=webappick-feed-category-mapping&wpf_message=warning'));
3179
  die();
3180
  }
3181
 
3182
- if (update_option($mappingOption, serialize($mappingData), false)) { // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.serialize_serialize
3183
  update_option('wpf_message', esc_html__('Mapping Updated Successfully', 'woo-feed'), false);
3184
  wp_safe_redirect(admin_url('admin.php?page=webappick-feed-category-mapping&wpf_message=success'));
3185
  die();
@@ -3190,8 +3095,8 @@ if (!function_exists('woo_feed_category_mapping')) {
3190
  }
3191
  }
3192
  require WOO_FEED_FREE_ADMIN_PATH . 'partials/woo-feed-category-mapping.php';
3193
- } elseif (isset($_GET['action']) && 'add-mapping' == $_GET['action']) {
3194
- if (count($_POST) && isset($_POST['mappingname']) && isset($_POST['add-mapping'])) {
3195
  check_admin_referer('category-mapping');
3196
 
3197
  $mappingOption = 'wf_cmapping_' . sanitize_text_field(wp_unslash($_POST['mappingname']));
@@ -3199,12 +3104,12 @@ if (!function_exists('woo_feed_category_mapping')) {
3199
  # Delete product attribute drop-down cache
3200
  delete_transient('__woo_feed_cache_woo_feed_dropdown_product_attributes');
3201
 
3202
- if (false !== get_option($mappingOption, false)) {
3203
  update_option('wpf_message', esc_html__('Another category mapping exists with the same name.', 'woo-feed'), false);
3204
  wp_safe_redirect(admin_url('admin.php?page=webappick-feed-category-mapping&wpf_message=warning'));
3205
  die();
3206
  }
3207
- if (update_option($mappingOption, serialize(woo_feed_array_sanitize($_POST)), false)) { // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.serialize_serialize
3208
  update_option('wpf_message', esc_html__('Mapping Added Successfully', 'woo-feed'), false);
3209
  wp_safe_redirect(admin_url('admin.php?page=webappick-feed-category-mapping&wpf_message=success'));
3210
  die();
@@ -3222,7 +3127,7 @@ if (!function_exists('woo_feed_category_mapping')) {
3222
  }
3223
 
3224
  // Category mapping.
3225
- if (!function_exists('woo_feed_render_categories')) {
3226
  /**
3227
  * Get Product Categories
3228
  *
@@ -3232,24 +3137,23 @@ if (!function_exists('woo_feed_render_categories')) {
3232
  *
3233
  * @return void
3234
  */
3235
- function woo_feed_render_categories($parent = 0, $par = '', $value = '' )
3236
- {
3237
  $categoryArgs = [
3238
- 'taxonomy' => 'product_cat',
3239
- 'parent' => $parent,
3240
- 'orderby' => 'term_group',
3241
- 'show_count' => 1,
3242
- 'pad_counts' => 1,
3243
  'hierarchical' => 1,
3244
- 'title_li' => '',
3245
- 'hide_empty' => 0,
3246
  ];
3247
  $categories = get_categories($categoryArgs);
3248
- if (!empty($categories)) {
3249
- if (!empty($par)) {
3250
  $par = $par . ' > ';
3251
  }
3252
- foreach ($categories as $cat) {
3253
  $class = $parent ? "treegrid-parent-{$parent} category-mapping" : 'treegrid-parent category-mapping';
3254
  ?>
3255
  <tr class="treegrid-1 ">
@@ -3265,9 +3169,9 @@ if (!function_exists('woo_feed_render_categories')) {
3265
  array( 'google', 'facebook', 'pinterest', 'bing', 'bing_local_inventory', 'snapchat' )
3266
  );
3267
 
3268
- $previous_mapping_value = is_array($value) && isset($value['cmapping'][$cat->term_id]) ? esc_attr($value['cmapping'][$cat->term_id]) : '';
3269
- $previous_listing_mapping_value = is_array($value) && isset($value['gcl-cmapping'][$cat->term_id]) && !empty( $value['gcl-cmapping'][$cat->term_id] )
3270
- ? esc_attr($value['gcl-cmapping'][$cat->term_id])
3271
  : $previous_mapping_value;
3272
 
3273
  ?>
@@ -3300,7 +3204,7 @@ if (!function_exists('woo_feed_render_categories')) {
3300
  <td class="<?php echo $termchildren ? 'group-' . $woo_map_term_id : ''; ?>" >
3301
  <?php
3302
  $childrencat = ! empty( get_term_children( $cat->term_id, 'product_cat' ) );
3303
- if( $childrencat ) {
3304
  $title = __( 'Copy this category to subcategories', 'woo-feed' );
3305
  echo '<span class="dashicons dashicons-arrow-down-alt" title=" ' . $title . '" id="cat-map-'.$cat->term_id.'"></span>';
3306
  }
@@ -3315,15 +3219,14 @@ if (!function_exists('woo_feed_render_categories')) {
3315
  }
3316
  }
3317
 
3318
- if (!function_exists('woo_feed_clear_cache_button')) {
3319
  /**
3320
  * Clear cache button.
3321
  *
3322
  * @return void
3323
  * @since 4.1.2
3324
  */
3325
- function woo_feed_clear_cache_button()
3326
- {
3327
  ?>
3328
  <div class="wf_clean_cache_wrapper">
3329
  <img class="woo-feed-cache-loader"
@@ -3338,7 +3241,7 @@ if (!function_exists('woo_feed_clear_cache_button')) {
3338
  }
3339
  }
3340
 
3341
- if (!function_exists('woo_feed_clear_cache_data')) {
3342
  /**
3343
  * Clear cache data.
3344
  *
@@ -3346,11 +3249,10 @@ if (!function_exists('woo_feed_clear_cache_data')) {
3346
  *
3347
  * @since 4.1.2
3348
  */
3349
- function woo_feed_clear_cache_data()
3350
- {
3351
- if (isset($_REQUEST['_ajax_clean_nonce'])) {
3352
 
3353
- if (wp_verify_nonce(sanitize_text_field(wp_unslash($_REQUEST['_ajax_clean_nonce'])), 'clean_cache_nonce')) {
3354
  $data = [];
3355
 
3356
  global $wpdb;
@@ -3358,7 +3260,7 @@ if (!function_exists('woo_feed_clear_cache_data')) {
3358
  $wpdb->query("DELETE FROM $wpdb->options WHERE ({$wpdb->options}.option_name LIKE '_transient_timeout___woo_feed_cache_%') OR ({$wpdb->options}.option_name LIKE '_transient___woo_feed_cache_%')"); // phpcs:ignore
3359
 
3360
 
3361
- $data = ['success' => true];
3362
 
3363
  wp_send_json_success($data);
3364
  }
@@ -3370,14 +3272,13 @@ if (!function_exists('woo_feed_clear_cache_data')) {
3370
  }
3371
  add_action('wp_ajax_clear_cache_data', 'woo_feed_clear_cache_data');
3372
 
3373
- if (!function_exists('woo_feed_get_current_timestamp')) {
3374
  /**
3375
  * Current local timestamp UTC.
3376
  *
3377
  * @since 4.2.0
3378
  */
3379
- function woo_feed_get_current_timestamp()
3380
- {
3381
 
3382
  $interval = get_option('wf_schedule');
3383
 
@@ -3387,7 +3288,7 @@ if (!function_exists('woo_feed_get_current_timestamp')) {
3387
  }
3388
  }
3389
 
3390
- if (!function_exists('woo_feed_deep_term')) {
3391
 
3392
  /**
3393
  * Get product terms list by hierarchical order.
@@ -3396,10 +3297,9 @@ if (!function_exists('woo_feed_deep_term')) {
3396
  * @return string
3397
  * @since 4.3.88+
3398
  */
3399
- function woo_feed_deep_term($term, $taxonomy)
3400
- {
3401
 
3402
- if ($term->parent === 0){
3403
  return $term->name;
3404
  }
3405
 
@@ -3409,7 +3309,7 @@ if (!function_exists('woo_feed_deep_term')) {
3409
  }
3410
  }
3411
 
3412
- if (!function_exists('woo_feed_parent_category')) {
3413
 
3414
  /**
3415
  * Get product terms list by hierarchical order.
@@ -3419,10 +3319,9 @@ if (!function_exists('woo_feed_parent_category')) {
3419
  * @return WP_Term $term product parent term object
3420
  * @since 4.4.19
3421
  */
3422
- function woo_feed_parent_category($term, $taxonomy)
3423
- {
3424
 
3425
- if ($term->parent === 0) {
3426
  return $term;
3427
  }
3428
 
@@ -3432,7 +3331,7 @@ if (!function_exists('woo_feed_parent_category')) {
3432
  }
3433
  }
3434
 
3435
- if (!function_exists('woo_feed_get_terms_list_hierarchical_order')) {
3436
  /**
3437
  * Get product terms list by hierarchical order.
3438
  *
@@ -3444,17 +3343,16 @@ if (!function_exists('woo_feed_get_terms_list_hierarchical_order')) {
3444
  * @since 4.2.1
3445
  *
3446
  */
3447
- function woo_feed_get_terms_list_hierarchical_order($id, $full_path = true, $taxonomy = 'product_cat')
3448
- {
3449
 
3450
  $terms = get_the_terms($id, $taxonomy);
3451
 
3452
- if (count($terms)) {
3453
 
3454
- if ($full_path) {
3455
- return woo_feed_deep_term($terms[count($terms) - 1], $taxonomy);
3456
  } else {
3457
- return $terms[count($terms) - 1]->name;
3458
  }
3459
  }
3460
 
@@ -3462,52 +3360,50 @@ if (!function_exists('woo_feed_get_terms_list_hierarchical_order')) {
3462
  }
3463
  }
3464
 
3465
- if (!function_exists('woo_feed_get_products_ids_of_reviews')) {
3466
  /**
3467
  * Get reviews product ids .
3468
  *
3469
  * @return array $review_products_ids // review products ids
3470
  * @since 4.0.5
3471
  */
3472
- function woo_feed_get_products_ids_of_reviews()
3473
- {
3474
- $args = array('post_type' => 'product');
3475
  $reviews = get_comments($args);
3476
  $review_products_ids = wp_list_pluck($reviews, 'comment_post_ID');
3477
 
3478
 
3479
- return !empty($review_products_ids) && is_array($review_products_ids) ? array_unique($review_products_ids) : array();
3480
 
3481
  }
3482
  }
3483
 
3484
- if (!function_exists('woo_feed_get_approved_reviews_data')) {
3485
  /**
3486
  * Get approved review's data.
3487
  *
3488
  * @return mixed
3489
  * @since 4.3.0
3490
  */
3491
- function woo_feed_get_approved_reviews_data()
3492
- {
3493
  $approved_reviews = [];
3494
  $product_ids = woo_feed_get_products_ids_of_reviews();
3495
 
3496
- if (!empty($product_ids) && is_array($product_ids)) {
3497
 
3498
- foreach ($product_ids as $product_id) {
3499
  $reviews = get_comments(array(
3500
- 'post_id' => $product_id,
3501
- 'comment_type' => 'review',
3502
  'comment_approved' => 1,
3503
- 'parent' => 0,
3504
  ));
3505
 
3506
  $product_name = get_the_title($product_id);
3507
  $product_link = get_the_permalink($product_id);
3508
 
3509
- if (is_array($reviews) && sizeof($reviews) > 0) {
3510
- foreach ($reviews as $item) {
3511
  $review = array();
3512
  $review['review_ratings'] = get_comment_meta($item->comment_ID, 'rating', true);
3513
  $review['review_id'] = $item->comment_ID;
@@ -3538,7 +3434,7 @@ if (!function_exists('woo_feed_get_approved_reviews_data')) {
3538
  }
3539
  }
3540
 
3541
- if (!function_exists('woo_feed_save_black_friday_notice_2021_notice')) {
3542
  /**
3543
  * Update user meta to work ctx startup notice once.
3544
  *
@@ -3547,14 +3443,13 @@ if (!function_exists('woo_feed_save_black_friday_notice_2021_notice')) {
3547
  * @since 4.3.31
3548
  * @author Nazrul Islam Nayan
3549
  */
3550
- function woo_feed_save_black_friday_notice_2021_notice()
3551
- {
3552
  if (isset($_REQUEST['_wp_ajax_nonce']) && wp_verify_nonce(wp_unslash($_REQUEST['_wp_ajax_nonce']), 'woo-feed-to-ctx-feed-notice')) { //phpcs:ignore
3553
  $user_id = get_current_user_id();
3554
- if (isset($_REQUEST['clicked'])) {
3555
  $updated_user_meta = add_user_meta($user_id, 'woo_feed_black_friday_notice_2021_dismissed', 'true', true);
3556
 
3557
- if ($updated_user_meta) {
3558
  wp_send_json_success(esc_html__('User meta updated successfully.', 'woo-feed'));
3559
  } else {
3560
  wp_send_json_error(esc_html__('Something is wrong.', 'woo-feed'));
@@ -3568,7 +3463,7 @@ if (!function_exists('woo_feed_save_black_friday_notice_2021_notice')) {
3568
  }
3569
  add_action('wp_ajax_woo_feed_save_black_friday_notice_2021_notice', 'woo_feed_save_black_friday_notice_2021_notice');
3570
 
3571
- if (!function_exists('woo_feed_hide_promotion')) {
3572
  /**
3573
  * Update option to hide promotion.
3574
  *
@@ -3576,14 +3471,13 @@ if (!function_exists('woo_feed_hide_promotion')) {
3576
  *
3577
  * @since 5.1.7
3578
  */
3579
- function woo_feed_hide_promotion()
3580
- {
3581
- if (isset($_REQUEST['_ajax_nonce'])) {
3582
  $hide_promotion = update_option('woo_feed_hide_promotion', 1);
3583
  $data = array(
3584
  'msg' => 'Hide promotion updated successfully.',
3585
  );
3586
- if ($hide_promotion) {
3587
  wp_send_json_success($data);
3588
  } else {
3589
  wp_send_json_error(esc_html__('Something is wrong.', 'woo-feed'));
@@ -3596,7 +3490,7 @@ if (!function_exists('woo_feed_hide_promotion')) {
3596
  }
3597
  add_action('wp_ajax_woo_feed_hide_promotion', 'woo_feed_hide_promotion');
3598
 
3599
- if (!function_exists('array_key_first')) {
3600
  /**
3601
  * Array first key.
3602
  *
@@ -3605,18 +3499,16 @@ if (!function_exists('array_key_first')) {
3605
  * @return mixed
3606
  * @since 4.3.0
3607
  */
3608
- function array_key_first(array $arr)
3609
- {
3610
- foreach ($arr as $k => $unused) {
3611
  return $k;
3612
  }
3613
  return NULL;
3614
  }
3615
  }
3616
 
3617
- if (!function_exists('woo_feed_custom_taxonomy')) {
3618
- function woo_feed_custom_taxonomy()
3619
- {
3620
  $custom_fields = woo_feed_product_custom_fields();
3621
  $custom_taxonomies_filter = new Woo_Feed_Custom_Taxonomy_Filter($custom_fields);
3622
  $custom_taxonomies = iterator_to_array($custom_taxonomies_filter);
@@ -3629,35 +3521,35 @@ if (!function_exists('woo_feed_custom_taxonomy')) {
3629
  }
3630
 
3631
  if ( isset($custom_attributes['brand']) && 'enable' === $custom_attributes['brand'] ) {
3632
- if (!empty($custom_taxonomies)) {
3633
- foreach ($custom_taxonomies as $key => $value) {
3634
  $taxonomy_name = esc_html($value[0]);
3635
 
3636
  $labels = array(
3637
- 'name' => $taxonomy_name . ' ' . __('by CTX Feed', 'woo-feed'),
3638
- 'singular_name' => $taxonomy_name,
3639
- 'menu_name' => $taxonomy_name . 's ' . __('by CTX Feed', 'woo-feed'),
3640
- 'all_items' => __('All', 'woo-feed') . ' ' . $taxonomy_name . 's',
3641
- 'parent_item' => __('Parent', 'woo-feed') . $taxonomy_name,
3642
- 'parent_item_colon' => __('Parent:', 'woo-feed') . $taxonomy_name . ':',
3643
- 'new_item_name' => __('New', 'woo-feed') . ' ' . $taxonomy_name . ' ' . __('Name', 'woo-feed'),
3644
- 'add_new_item' => __('Add New', 'woo-feed') . ' ' . $taxonomy_name,
3645
- 'edit_item' => __('Edit', 'woo-feed') . ' ' . $taxonomy_name,
3646
- 'update_item' => __('Update', 'woo-feed') . ' ' . $taxonomy_name,
3647
  'separate_items_with_commas' => __('Separate', 'woo-feed') . ' ' . $taxonomy_name . ' ' . __('with commas', 'woo-feed'),
3648
- 'search_items' => __('Search', 'woo-feed') . ' ' . $taxonomy_name,
3649
- 'add_or_remove_items' => __('Add or remove', 'woo-feed') . ' ' . $taxonomy_name,
3650
- 'choose_from_most_used' => __('Choose from the most used', 'woo-feed') . ' ' . $taxonomy_name . 's',
3651
  );
3652
  $args = array(
3653
- 'labels' => $labels,
3654
- 'hierarchical' => true,
3655
- 'public' => true,
3656
- 'show_ui' => true,
3657
  'show_admin_column' => false,
3658
- 'show_in_rest' => true,
3659
  'show_in_nav_menus' => true,
3660
- 'show_tagcloud' => true,
3661
  );
3662
  $taxonomy_key = sprintf('woo-feed-%s', strtolower($key));
3663
 
@@ -3671,7 +3563,7 @@ if (!function_exists('woo_feed_custom_taxonomy')) {
3671
  add_action('init', 'woo_feed_custom_taxonomy');
3672
  }
3673
 
3674
- if (!function_exists('woo_feed_brand_term_radio_checklist')) {
3675
 
3676
  /**
3677
  * Use radio inputs product brand taxonomies
@@ -3679,11 +3571,10 @@ if (!function_exists('woo_feed_brand_term_radio_checklist')) {
3679
  * @param $args
3680
  * @return mixed
3681
  */
3682
- function woo_feed_brand_term_radio_checklist($args)
3683
- {
3684
- if (!empty($args['taxonomy']) && 'woo-feed-brand' === $args['taxonomy']) {
3685
- if (empty($args['walker']) || is_a($args['walker'], 'Walker')) {
3686
- if (!class_exists('Woo_Feed_Brand_Walker_Category_Radio_Checklist')) {
3687
  /**
3688
  * Custom walker for switching checkbox inputs to radio.
3689
  *
@@ -3691,12 +3582,11 @@ if (!function_exists('woo_feed_brand_term_radio_checklist')) {
3691
  */
3692
  class Woo_Feed_Brand_Walker_Category_Radio_Checklist extends Walker_Category_Checklist
3693
  {
3694
- function walk($elements, $max_depth, ...$args)
3695
- {
3696
  $output = parent::walk($elements, $max_depth, ...$args);
3697
  $output = str_replace(
3698
- array('type="checkbox"', "type='checkbox'"),
3699
- array('type="radio"', "type='radio'"),
3700
  $output
3701
  );
3702
 
@@ -3713,13 +3603,13 @@ if (!function_exists('woo_feed_brand_term_radio_checklist')) {
3713
  add_filter('wp_terms_checklist_args', 'woo_feed_brand_term_radio_checklist');
3714
  }
3715
 
3716
- if (!function_exists('woo_feed_filter_woocommerce_structured_data_product')) {
3717
 
3718
  $settings = woo_feed_get_options('all');
3719
  $overridden_structured_data = $settings['overridden_structured_data'];
3720
 
3721
 
3722
- if ("on" === $overridden_structured_data) {
3723
 
3724
  /**
3725
  * Removed woocommerce default schema structure
@@ -3730,8 +3620,7 @@ if (!function_exists('woo_feed_filter_woocommerce_structured_data_product')) {
3730
  * @return array $markup
3731
  * @since 4.3.6
3732
  */
3733
- function woo_feed_filter_woocommerce_structured_data_product($markup, $product)
3734
- {
3735
  $settings = woo_feed_get_options('all');
3736
  $disable_mpn = $settings['disable_mpn'];
3737
  $disable_brand = $settings['disable_brand'];
@@ -3739,10 +3628,10 @@ if (!function_exists('woo_feed_filter_woocommerce_structured_data_product')) {
3739
  $description = apply_filters('woo_feed_schema_description', wp_strip_all_tags($product->get_short_description() ? $product->get_short_description() : $product->get_description()), $product);
3740
  $markup["description"] = $description;
3741
 
3742
- if ('enable' === $disable_brand) {
3743
- $brand_term = wp_get_post_terms($product->get_id(), 'woo-feed-brand', array('fields' => 'names'));
3744
 
3745
- if (!is_wp_error($brand_term)) {
3746
  if ( isset($brand_term[0]) ) {
3747
  $markup['brand']["name"] = $brand_term[0];
3748
  }
@@ -3762,7 +3651,7 @@ if (!function_exists('woo_feed_filter_woocommerce_structured_data_product')) {
3762
  $markup['offers'][0]['priceCurrency'] = $currency;
3763
 
3764
  // Check if we have mpn data.
3765
- if ('enable' === $disable_mpn && !empty($mpn)) {
3766
  $mpn = $product->get_meta('woo_feed_mpn');
3767
  $markup['mpn'] = $mpn;
3768
  }
@@ -3777,20 +3666,20 @@ if (!function_exists('woo_feed_filter_woocommerce_structured_data_product')) {
3777
  }
3778
  }
3779
 
3780
- if (!function_exists('woo_feed_trim_attribute')) {
3781
  /**
3782
  * Trim attribute by specific sign
3783
  *
3784
  * @param $attribute string feed attribute
3785
  * @return mixed
3786
  */
3787
- function woo_feed_trim_attribute($attribute) {
3788
  return str_replace('_', ' ', $attribute);
3789
  }
3790
  }
3791
 
3792
  // Facebook pixel integration
3793
- if( !function_exists( 'woo_feed_facebook_pixel_init' ) ){
3794
 
3795
  function woo_feed_facebook_pixel_init() {
3796
  new WebAppick\Feed\Tracker\Facebook\Pixel();
@@ -3801,7 +3690,7 @@ if( !function_exists( 'woo_feed_facebook_pixel_init' ) ){
3801
  }
3802
 
3803
  // Google Remarketing integration
3804
- if( !function_exists( 'woo_feed_google_remarketing_init' ) ){
3805
 
3806
  function woo_feed_google_remarketing_init() {
3807
  new WebAppick\Feed\Tracker\Google\Remarketing();
@@ -3811,7 +3700,7 @@ if( !function_exists( 'woo_feed_google_remarketing_init' ) ){
3811
 
3812
  }
3813
 
3814
- if (!function_exists('woo_feed_filter_dropdown_attributes')) {
3815
  /**
3816
  * Woo Feed Filter Dropdown Attributes
3817
  *
@@ -3825,7 +3714,7 @@ if (!function_exists('woo_feed_filter_dropdown_attributes')) {
3825
  *
3826
  * @since 4.3.11
3827
  */
3828
- function woo_feed_filter_dropdown_attributes($default_attr, $merchants) {
3829
  $filtered_attributes = $default_attr;
3830
  $snapchat_additional_attr = array();
3831
  $snapchat_additional_attr['--18'] = 'Snapchat Additional Attributes';
@@ -3840,11 +3729,11 @@ if (!function_exists('woo_feed_filter_dropdown_attributes')) {
3840
  $snapchat_additional_attr['---18'] = '';
3841
 
3842
  //filtering attributes for pinterest merchant
3843
- if (in_array('pinterest', $merchants)) {
3844
- if (isset($default_attr['ads_redirect'])) {
3845
- if (array_key_exists('ads_redirect', $default_attr)) {
3846
  $keys = array_keys($default_attr);
3847
- $keys[array_search('ads_redirect', $keys)] = 'ads_link';
3848
  $filtered_attributes = array_combine($keys, $default_attr);
3849
  $filtered_attributes['ads_link'] = 'Ads Link[ads_link]';
3850
  }
@@ -3852,13 +3741,13 @@ if (!function_exists('woo_feed_filter_dropdown_attributes')) {
3852
  }
3853
 
3854
  //filtering attributes for snapchat merchant
3855
- if (in_array('snapchat', $merchants)) {
3856
  $filtered_attributes = array_merge($filtered_attributes, $snapchat_additional_attr);
3857
  }
3858
 
3859
  //filtering attributes for facebook merchant
3860
- if (in_array('facebook', $merchants)) {
3861
- if (isset($filtered_attributes['excluded_destination'])) {
3862
  $facebook_attributes = array();
3863
  $facebook_attributes['quantity_to_sell_on_facebook'] = 'Quantity to sell on facebook [quantity_to_sell_on_facebook]';
3864
  $filtered_attributes = woo_feed_array_insert_after($filtered_attributes, 'excluded_destination', $facebook_attributes);
@@ -3872,7 +3761,7 @@ if (!function_exists('woo_feed_filter_dropdown_attributes')) {
3872
  }
3873
 
3874
 
3875
- if (!function_exists('woo_feed_countries')) {
3876
  /**
3877
  * Woo Feed Country List
3878
  *
@@ -4138,7 +4027,7 @@ if (!function_exists('woo_feed_countries')) {
4138
  }
4139
 
4140
 
4141
- if (!function_exists('woo_feed_positioning_attribute_value')) {
4142
  /**
4143
  * Positioning new associative array in attribute's dropdown list
4144
  *
@@ -4152,8 +4041,7 @@ if (!function_exists('woo_feed_positioning_attribute_value')) {
4152
  * @updated 12-01-2021
4153
  *
4154
  */
4155
- function woo_feed_positioning_attribute_value($array, $key, $input_array)
4156
- {
4157
  $keys = array_keys($array);
4158
  $index = array_search($key, $keys, true);
4159
  $pos = false === $index ? count($array) : $index + 1;
@@ -4163,14 +4051,13 @@ if (!function_exists('woo_feed_positioning_attribute_value')) {
4163
  }
4164
  }
4165
 
4166
- if (!function_exists('woo_feed_get_feed_file_list')) {
4167
- function woo_feed_get_feed_file_list()
4168
- {
4169
  global $wpdb;
4170
  $feed_data = $wpdb->get_results($wpdb->prepare("SELECT option_name FROM $wpdb->options WHERE option_name like %s", 'wf_feed_%'), ARRAY_A); // phpcs:ignore
4171
  $feed_urls = [];
4172
- if (!empty($feed_data) and is_array($feed_data)) {
4173
- foreach ($feed_data as $key => $data) {
4174
  $feed_info = maybe_unserialize(get_option($data['option_name']));
4175
  $feed_urls[] = $feed_info['url'];
4176
  }
@@ -4180,7 +4067,7 @@ if (!function_exists('woo_feed_get_feed_file_list')) {
4180
  }
4181
  }
4182
 
4183
- if (!function_exists('woo_feed_exclude_feed_from_wp_rocket_cache')) {
4184
  /**
4185
  * Exclude Feed file URL form WP Rocket caching
4186
  *
@@ -4188,8 +4075,7 @@ if (!function_exists('woo_feed_exclude_feed_from_wp_rocket_cache')) {
4188
  *
4189
  * @return array
4190
  */
4191
- function woo_feed_exclude_feed_from_wp_rocket_cache($files)
4192
- {
4193
  return array_merge(
4194
  $files,
4195
  [
@@ -4199,23 +4085,22 @@ if (!function_exists('woo_feed_exclude_feed_from_wp_rocket_cache')) {
4199
  }
4200
  }
4201
 
4202
- if (!function_exists('woo_feed_exclude_feed_from_litespeed_cache')) {
4203
  /**
4204
  * Exclude Feed file URL form LiteSpeed caching
4205
  *
4206
  * @return array|false
4207
  */
4208
- function woo_feed_exclude_feed_from_litespeed_cache()
4209
- {
4210
- if (!class_exists('LiteSpeed\Core') || !defined('LSCWP_DIR')) {
4211
  return false;
4212
  }
4213
 
4214
  $litespeed_ex_paths = maybe_unserialize(get_option('litespeed.conf.cdn-exc'));
4215
- if ($litespeed_ex_paths && is_array($litespeed_ex_paths) && !in_array('/wp-content/uploads/woo-feed', $litespeed_ex_paths)) {
4216
  $litespeed_ex_paths = array_merge(
4217
  $litespeed_ex_paths,
4218
- ['/wp-content/uploads/woo-feed']
4219
  );
4220
  update_option('litespeed.conf.cdn-exc', $litespeed_ex_paths);
4221
  }
@@ -4223,31 +4108,30 @@ if (!function_exists('woo_feed_exclude_feed_from_litespeed_cache')) {
4223
  }
4224
  }
4225
 
4226
- if (!function_exists('woo_feed_exclude_feed_from_wp_fastest_cache')) {
4227
  /**
4228
  * Exclude Feed file URL form WP Fastest caching
4229
  *
4230
  * @return array|false
4231
  */
4232
- function woo_feed_exclude_feed_from_wp_fastest_cache()
4233
- {
4234
 
4235
- if (!class_exists('WpFastestCache')) {
4236
  return false;
4237
  }
4238
 
4239
  $wp_fastest_cache_ex_paths = json_decode(get_option('WpFastestCacheExclude'));
4240
- if ($wp_fastest_cache_ex_paths && is_array($wp_fastest_cache_ex_paths)) {
4241
 
4242
  $feed_path_exist = false;
4243
- foreach ($wp_fastest_cache_ex_paths as $key => $path) {
4244
- if ('woo-feed' === $path->content) {
4245
  $feed_path_exist = true;
4246
  break;
4247
  }
4248
  }
4249
 
4250
- if (!$feed_path_exist) {
4251
  $new_rule = new stdClass();
4252
  $new_rule->prefix = "contain";
4253
  $new_rule->content = 'woo-feed';
@@ -4255,12 +4139,12 @@ if (!function_exists('woo_feed_exclude_feed_from_wp_fastest_cache')) {
4255
 
4256
  $wp_fastest_cache_ex_paths = array_merge(
4257
  $wp_fastest_cache_ex_paths,
4258
- [$new_rule]
4259
  );
4260
 
4261
  update_option('WpFastestCacheExclude', wp_json_encode($wp_fastest_cache_ex_paths));
4262
  }
4263
- } elseif (empty($wp_fastest_cache_ex_paths)) {
4264
  $wp_fastest_cache_ex_paths = [];
4265
  $new_rule = new stdClass();
4266
  $new_rule->prefix = "contain";
@@ -4269,7 +4153,7 @@ if (!function_exists('woo_feed_exclude_feed_from_wp_fastest_cache')) {
4269
 
4270
  $wp_fastest_cache_ex_paths = array_merge(
4271
  $wp_fastest_cache_ex_paths,
4272
- [$new_rule]
4273
  );
4274
 
4275
  update_option('WpFastestCacheExclude', wp_json_encode($wp_fastest_cache_ex_paths));
@@ -4278,23 +4162,22 @@ if (!function_exists('woo_feed_exclude_feed_from_wp_fastest_cache')) {
4278
  }
4279
  }
4280
 
4281
- if (!function_exists('woo_feed_exclude_feed_from_wp_super_cache')) {
4282
  /**
4283
  * Exclude Feed file URL form WP Super caching
4284
  *
4285
  * @return array|false
4286
  */
4287
- function woo_feed_exclude_feed_from_wp_super_cache()
4288
- {
4289
 
4290
- if (!function_exists('wpsc_init')) {
4291
  return false;
4292
  }
4293
 
4294
  $wp_super_ex_paths = get_option('ossdl_off_exclude');
4295
- if ($wp_super_ex_paths && strpos($wp_super_ex_paths, 'woo-feed') === false) {
4296
  $wp_super_ex_paths = explode(',', $wp_super_ex_paths);
4297
- $wp_super_ex_paths = array_merge($wp_super_ex_paths, ['woo-feed']);
4298
  update_option('ossdl_off_exclude', implode(',', $wp_super_ex_paths));
4299
  }
4300
 
@@ -4302,22 +4185,21 @@ if (!function_exists('woo_feed_exclude_feed_from_wp_super_cache')) {
4302
  }
4303
  }
4304
 
4305
- if (!function_exists('woo_feed_exclude_feed_from_breeze_cache')) {
4306
  /**
4307
  * Exclude Feed file URL form BREEZE caching
4308
  *
4309
  * @return array|false
4310
  */
4311
- function woo_feed_exclude_feed_from_breeze_cache()
4312
- {
4313
 
4314
- if (!class_exists('Breeze_Admin')) {
4315
  return false;
4316
  }
4317
 
4318
  $breeze_settings = maybe_unserialize(get_option('breeze_cdn_integration'));
4319
- if (is_array($breeze_settings)) {
4320
- $woo_feed_files = ['.xml', '.csv', '.tsv', '.txt', '.xls'];
4321
  $woo_feed_files = array_unique(array_merge($woo_feed_files, $breeze_settings['cdn-exclude-content']));
4322
  $breeze_settings['cdn-exclude-content'] = $woo_feed_files;
4323
  update_option('breeze_cdn_integration', $breeze_settings);
@@ -4326,23 +4208,22 @@ if (!function_exists('woo_feed_exclude_feed_from_breeze_cache')) {
4326
  }
4327
  }
4328
 
4329
- if (!function_exists('woo_feed_exclude_feed_from_wp_optimize_cache')) {
4330
  /**
4331
  * Exclude Feed file URL form WP Optimize caching
4332
  *
4333
  * @return array|false
4334
  */
4335
- function woo_feed_exclude_feed_from_wp_optimize_cache()
4336
- {
4337
 
4338
- if (!class_exists('WP_Optimize')) {
4339
  return false;
4340
  }
4341
 
4342
  $wp_optimize_ex_paths = maybe_unserialize(get_option('wpo_cache_config'));
4343
- if (isset($wp_optimize_ex_paths['enable_page_caching']) && $wp_optimize_ex_paths['enable_page_caching']) { // If page Caching enabled
4344
- if (is_array($wp_optimize_ex_paths) && !in_array('/wp-content/uploads/woo-feed', $wp_optimize_ex_paths['cache_exception_urls'])) {
4345
- $woo_feed_ex_path['cache_exception_urls'] = ['/wp-content/uploads/woo-feed'];
4346
  $wp_optimize_ex_paths = array_merge_recursive(
4347
  $wp_optimize_ex_paths,
4348
  $woo_feed_ex_path
@@ -4355,21 +4236,20 @@ if (!function_exists('woo_feed_exclude_feed_from_wp_optimize_cache')) {
4355
  }
4356
  }
4357
 
4358
- if (!function_exists('woo_feed_exclude_feed_from_cache_enabler_cache')) {
4359
  /**
4360
  * Exclude Feed file URL form Cache Enabler caching
4361
  *
4362
  * @return array|false
4363
  */
4364
- function woo_feed_exclude_feed_from_cache_enabler_cache()
4365
- {
4366
 
4367
- if (!class_exists('Cache_Enabler')) {
4368
  return false;
4369
  }
4370
 
4371
  $cache_enabler_ex_paths = maybe_unserialize(get_option('cache_enabler'));
4372
- if (isset($cache_enabler_ex_paths['excluded_page_paths']) && empty($cache_enabler_ex_paths['excluded_page_paths'])) {
4373
  $cache_enabler_ex_paths['excluded_page_paths'] = '/wp-content/uploads/woo-feed/';
4374
  update_option('cache_enabler', $cache_enabler_ex_paths);
4375
  }
@@ -4378,35 +4258,34 @@ if (!function_exists('woo_feed_exclude_feed_from_cache_enabler_cache')) {
4378
  }
4379
  }
4380
 
4381
- if (!function_exists('woo_feed_exclude_feed_from_swift_performance_cache')) {
4382
  /**
4383
  * Exclude Feed file URL form Swift Performance caching
4384
  *
4385
  * @return array|false
4386
  */
4387
- function woo_feed_exclude_feed_from_swift_performance_cache()
4388
- {
4389
 
4390
- if (!class_exists('Swift_Performance_Lite')) {
4391
  return false;
4392
  }
4393
 
4394
  $swift_perform_ex_paths = maybe_unserialize(get_option('swift_performance_options'));
4395
 
4396
- if ($swift_perform_ex_paths && isset($swift_perform_ex_paths['exclude-strings'])) {
4397
  $exclude_strings = $swift_perform_ex_paths['exclude-strings'];
4398
- if (is_array($exclude_strings) && !in_array('/wp-content/uploads/woo-feed', $exclude_strings)) {
4399
- $woo_feed_ex_path['exclude-strings'] = ['/wp-content/uploads/woo-feed'];
4400
  $swift_perform_ex_paths = array_merge_recursive(
4401
  $swift_perform_ex_paths,
4402
  $woo_feed_ex_path
4403
  );
4404
  } else {
4405
- $swift_perform_ex_paths['exclude-strings'] = ['/wp-content/uploads/woo-feed'];
4406
  }
4407
  update_option('swift_performance_options', $swift_perform_ex_paths);
4408
- } elseif (empty($swift_perform_ex_paths)) {
4409
- $swift_perform_ex_paths['exclude-strings'] = ['/wp-content/uploads/woo-feed'];
4410
  update_option('swift_performance_options', $swift_perform_ex_paths);
4411
  }
4412
 
@@ -4414,35 +4293,34 @@ if (!function_exists('woo_feed_exclude_feed_from_swift_performance_cache')) {
4414
  }
4415
  }
4416
 
4417
- if (!function_exists('woo_feed_exclude_feed_from_speed_booster_cache')) {
4418
  /**
4419
  * Exclude Feed file URL form Speed Booster Pack caching
4420
  *
4421
  * @return array|false
4422
  */
4423
- function woo_feed_exclude_feed_from_speed_booster_cache()
4424
- {
4425
 
4426
- if (!class_exists('Speed_Booster_Pack')) {
4427
  return false;
4428
  }
4429
 
4430
  $feed_files = [];
4431
  $speed_booster_settings = maybe_unserialize(get_option('sbp_options'));
4432
- if (isset($speed_booster_settings['caching_exclude_urls'])) {
4433
  $feed_files = woo_feed_get_feed_file_list();
4434
  $caching_exclude_urls = $speed_booster_settings['caching_exclude_urls'];
4435
- if (!empty($caching_exclude_urls)) {
4436
- if (!empty($feed_files)) {
4437
- foreach ($feed_files as $key => $file) {
4438
- $file = str_replace(array('http://', 'https://'), '', $file);
4439
- if (!in_array($file, explode("\n", $caching_exclude_urls))) {
4440
  $caching_exclude_urls .= "\n" . $file;
4441
  }
4442
  }
4443
  }
4444
  } else {
4445
- $caching_exclude_urls = str_replace(array('http://', 'https://'), '', implode("\n", $feed_files));
4446
  }
4447
  $speed_booster_settings['caching_exclude_urls'] = $caching_exclude_urls;
4448
  update_option('sbp_options', $speed_booster_settings);
@@ -4452,23 +4330,22 @@ if (!function_exists('woo_feed_exclude_feed_from_speed_booster_cache')) {
4452
  }
4453
  }
4454
 
4455
- if (!function_exists('woo_feed_exclude_feed_from_comet_cache')) {
4456
  /**
4457
  * Exclude Feed file URL form Comet Cache caching
4458
  *
4459
  * @return array|false
4460
  */
4461
- function woo_feed_exclude_feed_from_comet_cache()
4462
- {
4463
- if (!is_plugin_active('comet-cache/comet-cache.php')) {
4464
  return false;
4465
  }
4466
 
4467
  $comet_cache_settings = maybe_unserialize(get_option('comet_cache_options'));
4468
 
4469
- if ($comet_cache_settings && isset($comet_cache_settings['exclude_uris'])) {
4470
  $exclude_uris = $comet_cache_settings['exclude_uris'];
4471
- if (strpos($exclude_uris, '/wp-content/uploads/woo-feed') === false) {
4472
  $exclude_uris .= "\n/wp-content/uploads/woo-feed";
4473
  $comet_cache_settings['exclude_uris'] = $exclude_uris;
4474
  update_option('comet_cache_options', $comet_cache_settings);
@@ -4479,24 +4356,23 @@ if (!function_exists('woo_feed_exclude_feed_from_comet_cache')) {
4479
  }
4480
  }
4481
 
4482
- if (!function_exists('woo_feed_exclude_feed_from_hyper_cache')) {
4483
  /**
4484
  * Exclude Feed file URL form Swift Performance caching
4485
  *
4486
  * @return array|false
4487
  */
4488
- function woo_feed_exclude_feed_from_hyper_cache()
4489
- {
4490
 
4491
- if (!class_exists('HyperCache')) {
4492
  return false;
4493
  }
4494
 
4495
  $hyper_cache_settings = maybe_unserialize(get_option('hyper-cache'));
4496
- if ($hyper_cache_settings && isset($hyper_cache_settings['reject_uris'])) {
4497
  $exclude_strings = $hyper_cache_settings['reject_uris'];
4498
- if (is_array($exclude_strings) && !in_array('/wp-content/uploads/woo-feed', $exclude_strings)) {
4499
- $woo_feed_ex_path['reject_uris'] = ['/wp-content/uploads/woo-feed'];
4500
  $woo_feed_ex_path['reject_uris_enabled'] = 1;
4501
  $hyper_cache_settings = array_merge_recursive(
4502
  $hyper_cache_settings,
@@ -4510,23 +4386,22 @@ if (!function_exists('woo_feed_exclude_feed_from_hyper_cache')) {
4510
  }
4511
  }
4512
 
4513
- if (!function_exists('woo_feed_wp_options')) {
4514
- function woo_feed_wp_options()
4515
- {
4516
- if (isset($_GET['action']) && 'add-option' == $_GET['action']) {
4517
- if (count($_POST) && isset($_POST['wpfp_option'])) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
4518
  check_admin_referer('woo-feed-add-option');
4519
 
4520
  $options = get_option('wpfp_option', array());
4521
  $newOption = sanitize_text_field($_POST['wpfp_option']);
4522
  $id = explode('-', $newOption);
4523
- if (false !== array_search($id[0], array_column($options, 'option_id'))) { // found
4524
  update_option('wpf_message', esc_html__('Option Already Added.', 'woo-feed'), false);
4525
  wp_safe_redirect(admin_url('admin.php?page=webappick-wp-options&wpf_message=error'));
4526
  die();
4527
  } else {
4528
- $options[$id[0]] = array(
4529
- 'option_id' => $id[0],
4530
  'option_name' => 'wf_option_' . str_replace($id[0] . '-', '', $newOption),
4531
  );
4532
  update_option('wpfp_option', $options, false);
@@ -4542,7 +4417,7 @@ if (!function_exists('woo_feed_wp_options')) {
4542
  }
4543
  }
4544
 
4545
- if (!function_exists('woo_feed_get_price_with_tax')) {
4546
 
4547
 
4548
  /**
@@ -4553,21 +4428,19 @@ if (!function_exists('woo_feed_get_price_with_tax')) {
4553
  *
4554
  * @return float|mixed|string|void
4555
  */
4556
- function woo_feed_get_price_with_tax($price, $product)
4557
- {
4558
 
4559
- if (woo_feed_wc_version_check(3.0)) {
4560
- return wc_get_price_including_tax($product, array('price' => $price));
4561
  } else {
4562
  return $product->get_price_including_tax(1, $price);
4563
  }
4564
 
4565
  return apply_filters('woo_feed_price_with_tax', $price, $product);
4566
  }
4567
-
4568
  }
4569
 
4570
- if (!function_exists('woo_feed_get_dynamic_discounted_product_price')) {
4571
 
4572
  /**
4573
  * Get price with dynamic discount
@@ -4578,8 +4451,7 @@ if (!function_exists('woo_feed_get_dynamic_discounted_product_price')) {
4578
  * @param bool $tax product taxable or not
4579
  * @return mixed $price
4580
  */
4581
- function woo_feed_get_dynamic_discounted_product_price($price, $product, $config, $tax)
4582
- {
4583
  $base_price = $price;
4584
  $discount_plugin_activate = false;
4585
 
@@ -4588,13 +4460,13 @@ if (!function_exists('woo_feed_get_dynamic_discounted_product_price')) {
4588
  * PLUGIN: Discount Rules for WooCommerce
4589
  * URL: https://wordpress.org/plugins/woo-discount-rules/
4590
  */
4591
- if (is_plugin_active('woo-discount-rules/woo-discount-rules.php')) {
4592
  $discount_plugin_activate = true;
4593
- if (class_exists('Wdr\App\Controllers\Configuration')) {
4594
  $config = Wdr\App\Controllers\Configuration::getInstance()->getConfig('calculate_discount_from', 'sale_price');
4595
 
4596
- if (isset($config) && !empty($config)) {
4597
- if ('regular_price' === $config) {
4598
  $price = $product->get_regular_price();
4599
  } else {
4600
  $price = $product->get_price();
@@ -4603,23 +4475,23 @@ if (!function_exists('woo_feed_get_dynamic_discounted_product_price')) {
4603
  $price = $product->get_price();
4604
  }
4605
 
4606
- if($product->is_type('variable')){
4607
  $min = $product->get_variation_price('min', false);
4608
  $max = $product->get_variation_price('max', false);
4609
 
4610
  $price = $min;
4611
- if($max === $base_price){
4612
  $price = $max;
4613
  }
4614
  }
4615
 
4616
  $price = apply_filters('advanced_woo_discount_rules_get_product_discount_price_from_custom_price', false, $product, 1, $price, 'discounted_price', true, true);
4617
 
4618
- if( empty($price) ) {
4619
  $price = $base_price;
4620
  }
4621
 
4622
- if( !isset( $feedConfig['feedCurrency'] ) ){
4623
  $feedConfig['feedCurrency'] = get_woocommerce_currency();
4624
  }
4625
 
@@ -4677,20 +4549,20 @@ if (!function_exists('woo_feed_get_dynamic_discounted_product_price')) {
4677
  * PLUGIN: Pricing Deals for WooCommerce
4678
  * URL: https://wordpress.org/plugins/pricing-deals-for-woocommerce/
4679
  */
4680
- if (is_plugin_active('pricing-deals-for-woocommerce/vt-pricing-deals.php')) {
4681
  $discount_plugin_activate = true;
4682
- if (class_exists('VTPRD_Controller')) {
4683
  global $vtprd_rules_set;
4684
  $vtprd_rules_set = get_option('vtprd_rules_set');
4685
- if (!empty($vtprd_rules_set) && is_array($vtprd_rules_set)) {
4686
- foreach ($vtprd_rules_set as $vtprd_rule_set) {
4687
  $status = $vtprd_rule_set->rule_on_off_sw_select;
4688
- if ('on' === $status || 'onForever' === $status) {
4689
  $discount_type = $vtprd_rule_set->rule_deal_info[0]['discount_amt_type'];
4690
  $discount = $vtprd_rule_set->rule_deal_info[0]['discount_amt_count'];
4691
- if ('currency' === $discount_type || 'fixedPrice' === $discount_type) {
4692
  $price = $product->get_price() - $discount;
4693
- } elseif ('percent' === $discount_type) {
4694
  $price = $product->get_price() - (($product->get_price() * $discount) / 100);
4695
  }
4696
  }
@@ -4727,7 +4599,7 @@ if (!function_exists('woo_feed_get_dynamic_discounted_product_price')) {
4727
 
4728
 
4729
  // Get Price with tax
4730
- if ($discount_plugin_activate && $tax) {
4731
  $price = woo_feed_get_price_with_tax($price, $product);
4732
  }
4733
 
@@ -4740,18 +4612,16 @@ if (!function_exists('woo_feed_get_dynamic_discounted_product_price')) {
4740
  *
4741
  * @since 4.3.93
4742
  */
4743
- if (!class_exists('Woo_Feed_Custom_Taxonomy_Filter')) {
4744
  class Woo_Feed_Custom_Taxonomy_Filter extends FilterIterator
4745
  {
4746
 
4747
- public function __construct(array $items)
4748
- {
4749
  $object = new ArrayObject($items);
4750
  parent::__construct($object->getIterator());
4751
  }
4752
 
4753
- public function accept()
4754
- {
4755
  return array_key_exists(2, parent::current()) ? parent::current()[2] : false;
4756
  }
4757
  }
@@ -4762,19 +4632,17 @@ if (!class_exists('Woo_Feed_Custom_Taxonomy_Filter')) {
4762
  *
4763
  * @since 4.3.93
4764
  */
4765
- if (!class_exists('Woo_Feed_Custom_Identifier_Filter')) {
4766
  class Woo_Feed_Custom_Identifier_Filter extends FilterIterator
4767
  {
4768
 
4769
- public function __construct(array $items)
4770
- {
4771
  $object = new ArrayObject($items);
4772
  parent::__construct($object->getIterator());
4773
  }
4774
 
4775
- public function accept()
4776
- {
4777
- if( ! isset( parent::current()[3] ) || (isset(parent::current()[3]) && parent::current()[3] ) ) {
4778
  $is_identifier = ! array_key_exists( 2, parent::current() ) ? true : ! parent::current()[2];
4779
  if ( $is_identifier ) {
4780
  $get_settings = woo_feed_get_options( 'all' );
@@ -4795,10 +4663,9 @@ if (!class_exists('Woo_Feed_Custom_Identifier_Filter')) {
4795
  }
4796
  }
4797
 
4798
- if (!function_exists('woo_feed_array_splice_preserve_keys')) {
4799
- function woo_feed_array_splice_preserve_keys(&$input, $offset, $length = null, $replacement = array())
4800
- {
4801
- if (empty($replacement)) {
4802
  return array_splice($input, $offset, $length);
4803
  }
4804
 
@@ -4812,7 +4679,7 @@ if (!function_exists('woo_feed_array_splice_preserve_keys')) {
4812
  }
4813
  }
4814
 
4815
- if (!function_exists('woo_feed_filter_count_cb')) {
4816
  /**
4817
  * Add AJAX action when client click filter tab.
4818
  */
@@ -4827,18 +4694,17 @@ if (!function_exists('woo_feed_filter_count_cb')) {
4827
  *
4828
  * @return mixed array | error
4829
  */
4830
- function woo_feed_filter_count_cb()
4831
- {
4832
  $is_nonce_valid = isset($_GET['nonce']) && wp_verify_nonce(sanitize_text_field(wp_unslash($_GET['nonce'])), 'wpf_feed_nonce');
4833
 
4834
- if ($is_nonce_valid) {
4835
  $results = array(
4836
- 'hidden' => woo_feed_hidden_products_count(),
4837
- 'noPrice' => woo_feed_no_price_products_count(),
4838
- 'noImg' => woo_feed_no_image_products_count(),
4839
- 'noDesc' => woo_feed_no_description_products_count(),
4840
  'outOfStock' => woo_feed_out_of_stock_products_count(),
4841
- 'backorder' => woo_feed_backorder_products_count(),
4842
  );
4843
  wp_send_json_success($results);
4844
  } else {
@@ -4847,23 +4713,22 @@ if (!function_exists('woo_feed_filter_count_cb')) {
4847
  wp_die();
4848
  }
4849
  }
4850
- if (!function_exists('woo_feed_hidden_products_count')) {
4851
  /**
4852
  * This function give the hidden products count.
4853
  *
4854
  * @return integer
4855
  */
4856
- function woo_feed_hidden_products_count()
4857
- {
4858
  $args = array(
4859
- 'post_type' => 'product',
4860
  'posts_per_page' => -1,
4861
- 'fields' => 'ids',
4862
- 'tax_query' => array(
4863
  array(
4864
  'taxonomy' => 'product_visibility',
4865
- 'field' => 'name',
4866
- 'terms' => 'exclude-from-catalog',
4867
  'operator' => 'IN',
4868
  ),
4869
  ),
@@ -4872,26 +4737,25 @@ if (!function_exists('woo_feed_hidden_products_count')) {
4872
  return count($products->posts);
4873
  }
4874
  }
4875
- if (!function_exists('woo_feed_no_image_products_count')) {
4876
  /**
4877
  * This function give the products count which have no thumbnail image or gallery image
4878
  *
4879
  * @return integer
4880
  */
4881
- function woo_feed_no_image_products_count()
4882
- {
4883
  $args = array(
4884
- 'post_type' => 'product',
4885
  'posts_per_page' => -1,
4886
- 'fields' => 'ids',
4887
- 'meta_query' => array(
4888
  'relation' => 'AND',
4889
  array(
4890
- 'key' => '_thumbnail_id',
4891
  'compare' => 'NOT EXISTS',
4892
  ),
4893
  array(
4894
- 'key' => '_product_image_gallery',
4895
  'compare' => 'NOT EXISTS',
4896
  ),
4897
  ),
@@ -4900,55 +4764,52 @@ if (!function_exists('woo_feed_no_image_products_count')) {
4900
  return count($products->posts);
4901
  }
4902
  }
4903
- if (!function_exists('woo_feed_no_description_products_count')) {
4904
  /**
4905
  * This function give the products count which have no description/short description.
4906
  *
4907
  * @return integer
4908
  */
4909
- function woo_feed_no_description_products_count()
4910
- {
4911
  add_filter('posts_where', 'woo_feed_filter_where_product_with_no_description');
4912
  $args = array(
4913
- 'post_type' => 'product',
4914
  'posts_per_page' => -1,
4915
- 'fields' => 'ids',
4916
  );
4917
  $products = new WP_Query($args);
4918
  remove_filter('posts_where', 'woo_feed_filter_where_product_with_no_description');
4919
  return count($products->posts);
4920
  }
4921
  }
4922
- if (!function_exists('woo_feed_filter_where_product_with_no_description')) {
4923
  /**
4924
  * This function changes the wp query to get out of products without description.
4925
  *
4926
  * @param string $where
4927
  */
4928
- function woo_feed_filter_where_product_with_no_description($where = '')
4929
- {
4930
  $where .= "
4931
  AND trim( coalesce( post_content, '' ) ) = ''
4932
  ";
4933
  return $where;
4934
  }
4935
  }
4936
- if (!function_exists('woo_feed_out_of_stock_products_count')) {
4937
  /**
4938
  * This function gives the `out of stock products` count.
4939
  *
4940
  * @return integer
4941
  */
4942
- function woo_feed_out_of_stock_products_count()
4943
- {
4944
  $args = array(
4945
- 'post_type' => 'product',
4946
  'posts_per_page' => -1,
4947
- 'fields' => 'ids',
4948
- 'meta_query' => array(
4949
  array(
4950
- 'key' => '_stock_status',
4951
- 'value' => 'outofstock',
4952
  'compare' => '==',
4953
  ),
4954
  ),
@@ -4957,22 +4818,21 @@ if (!function_exists('woo_feed_out_of_stock_products_count')) {
4957
  return count($products->posts);
4958
  }
4959
  }
4960
- if (!function_exists('woo_feed_backorder_products_count')) {
4961
  /**
4962
  * This function gives the `backorder` products count.
4963
  *
4964
  * @return integer
4965
  */
4966
- function woo_feed_backorder_products_count()
4967
- {
4968
  $args = array(
4969
- 'post_type' => 'product',
4970
  'posts_per_page' => -1,
4971
- 'fields' => 'ids',
4972
- 'meta_query' => array(
4973
  array(
4974
- 'key' => '_stock_status',
4975
- 'value' => 'onbackorder',
4976
  'compare' => '==',
4977
  ),
4978
  ),
@@ -4981,22 +4841,21 @@ if (!function_exists('woo_feed_backorder_products_count')) {
4981
  return count($products->posts);
4982
  }
4983
  }
4984
- if (!function_exists('woo_feed_no_price_products_count')) {
4985
  /**
4986
  * This function give the products count which have no prices.
4987
  *
4988
  * @return integer
4989
  */
4990
- function woo_feed_no_price_products_count()
4991
- {
4992
  $args = array(
4993
- 'post_type' => 'product',
4994
  'posts_per_page' => -1,
4995
- 'fields' => 'ids',
4996
- 'meta_query' => array(
4997
  array(
4998
- 'key' => '_price',
4999
- 'value' => '',
5000
  'compare' => '==',
5001
  ),
5002
  ),
@@ -5006,7 +4865,7 @@ if (!function_exists('woo_feed_no_price_products_count')) {
5006
  }
5007
  }
5008
 
5009
- if (!function_exists('woo_feed_custom_field_meta_filter')) {
5010
  /**
5011
  * Identifier meta value filter for old and new version users
5012
  *
@@ -5017,15 +4876,14 @@ if (!function_exists('woo_feed_custom_field_meta_filter')) {
5017
  * @since 4.3.99
5018
  *
5019
  */
5020
- function woo_feed_custom_field_meta_filter($meta, $product, $field)
5021
- {
5022
  $id = $product->get_id();
5023
 
5024
  //identifier meta value for old and new version users
5025
- if (false !== strpos($meta, 'woo_feed_identifier_')) {
5026
 
5027
  $identifier = str_replace('woo_feed_identifier_', '', $meta);
5028
- if (metadata_exists('post', $id, 'woo_feed_' . $identifier)) {
5029
  $meta = 'woo_feed_' . $identifier;
5030
  } else {
5031
  $meta = 'woo_feed_identifier_' . $identifier;
@@ -5038,7 +4896,7 @@ if (!function_exists('woo_feed_custom_field_meta_filter')) {
5038
  add_filter('woo_feed_custom_field_meta', 'woo_feed_custom_field_meta_filter', 3, 10);
5039
  }
5040
 
5041
- if (!function_exists('woo_feed_strpos_array')) {
5042
 
5043
  /**
5044
  * Extension of php `strpos` function
@@ -5050,15 +4908,14 @@ if (!function_exists('woo_feed_strpos_array')) {
5050
  * @since 4.3.100
5051
  *
5052
  */
5053
- function woo_feed_strpos_array($niddles, $haystack)
5054
- {
5055
 
5056
- if (empty($haystack)) {
5057
  return;
5058
  }
5059
 
5060
- foreach ($niddles as $niddle) {
5061
- if (strpos($haystack, $niddle) !== false) {
5062
  return true;
5063
  }
5064
  }
@@ -5068,7 +4925,7 @@ if (!function_exists('woo_feed_strpos_array')) {
5068
  }
5069
  }
5070
 
5071
- if (!function_exists('woo_feed_schema_description_filter')) {
5072
  /**
5073
  * Filter schema description
5074
  *
@@ -5079,8 +4936,7 @@ if (!function_exists('woo_feed_schema_description_filter')) {
5079
  * @since 4.3.101
5080
  *
5081
  */
5082
- function woo_feed_schema_description_filter($description, $product)
5083
- {
5084
 
5085
  $description = do_shortcode($description);
5086
  $description = woo_feed_stripInvalidXml($description);
@@ -5091,7 +4947,7 @@ if (!function_exists('woo_feed_schema_description_filter')) {
5091
  //strip tags and spacial characters
5092
  $strip_description = wp_strip_all_tags(wp_specialchars_decode($description));
5093
 
5094
- $description = !empty(strlen($strip_description)) && 0 < strlen($strip_description) ? $strip_description : $description;
5095
 
5096
  return $description;
5097
  }
@@ -5100,7 +4956,7 @@ if (!function_exists('woo_feed_schema_description_filter')) {
5100
  }
5101
 
5102
 
5103
- if (!function_exists('woo_feed_get_yoast_identifiers_value')) {
5104
  /**
5105
  * Get Yoast identifiers value
5106
  *
@@ -5111,18 +4967,17 @@ if (!function_exists('woo_feed_get_yoast_identifiers_value')) {
5111
  *
5112
  * @author Nazrul Islam Nayan
5113
  */
5114
- function woo_feed_get_yoast_identifiers_value($attribute_key, $product)
5115
- {
5116
  $identifier = '';
5117
- if (class_exists('Yoast_WooCommerce_SEO')) {
5118
  $wpseo_identifier = get_post_meta($product->get_id(), 'wpseo_global_identifier_values');
5119
  $wpseo_identifier = reset($wpseo_identifier);
5120
 
5121
- if (isset($wpseo_identifier[$attribute_key])) {
5122
- $identifier = $wpseo_identifier[$attribute_key];
5123
  }
5124
 
5125
- if (empty($identifier) && $product->is_type('variation')) {
5126
  $parent = wc_get_product($product->get_parent_id());
5127
  $identifier = woo_feed_get_yoast_identifiers_value($attribute_key, $parent);
5128
  }
@@ -5131,7 +4986,7 @@ if (!function_exists('woo_feed_get_yoast_identifiers_value')) {
5131
  return $identifier;
5132
  }
5133
 
5134
- if (!function_exists('woo_feed_parent_product_id')) {
5135
  /**
5136
  * Return variable product id for variation else main product id.
5137
  *
@@ -5139,9 +4994,8 @@ if (!function_exists('woo_feed_get_yoast_identifiers_value')) {
5139
  *
5140
  * @return int
5141
  */
5142
- function woo_feed_parent_product_id($product)
5143
- {
5144
- if ($product->is_type('variation')) {
5145
  return $product->get_parent_id();
5146
  }
5147
  return $product->get_id();
@@ -5150,7 +5004,7 @@ if (!function_exists('woo_feed_get_yoast_identifiers_value')) {
5150
  }
5151
 
5152
  #==== MERCHANT TEMPLATE OVERRIDE START ==============#
5153
- if (!function_exists('woo_feed_modify_google_color_attribute_value')) {
5154
  /**
5155
  * Replace comma (,) with slash (/) for Google Shopping template color attribute value
5156
  *
@@ -5160,24 +5014,23 @@ if (!function_exists('woo_feed_modify_google_color_attribute_value')) {
5160
  *
5161
  * @return string
5162
  */
5163
- function woo_feed_modify_google_color_attribute_value($attribute_value, $product, $feed_config, $merchant_attribute)
5164
- {
5165
  // Replace Google Color attribute value according to requirements
5166
- if (('g:color' === $merchant_attribute || 'color' === $merchant_attribute)
5167
  && in_array($feed_config['provider'], [
5168
  'google',
5169
  'facebook',
5170
  'pinterest',
5171
  'bing',
5172
  'snapchat',
5173
- ], true)) {
5174
  return str_replace(', ', '/', $attribute_value);
5175
  }
5176
  return $attribute_value;
5177
  }
5178
  }
5179
 
5180
- if (!function_exists('woo_feed_modify_weight_attribute_value')) {
5181
  /**
5182
  * Add wight unit as suffix for Google Shopping template shipping_weight attribute.
5183
  *
@@ -5187,22 +5040,21 @@ if (!function_exists('woo_feed_modify_weight_attribute_value')) {
5187
  *
5188
  * @return string
5189
  */
5190
- function woo_feed_modify_weight_attribute_value($attribute_value, $product, $feed_config)
5191
- {
5192
- if (isset($feed_config['attributes'])
5193
  && in_array($feed_config['provider'], [
5194
  'google',
5195
  'facebook',
5196
  'pinterest',
5197
  'bing',
5198
  'snapchat',
5199
- ])) {
5200
  $attributes = $feed_config['attributes'];
5201
  $key = array_search('weight', $attributes, true);
5202
- if (isset($feed_config['suffix']) && !empty($key) && array_key_exists($key, $feed_config['suffix'])) {
5203
- $weight_suffix_unit = $feed_config['suffix'][$key];
5204
 
5205
- if (empty($weight_suffix_unit) && !empty($attribute_value)) {
5206
  $attribute_value .= ' ' . get_option('woocommerce_weight_unit');
5207
  }
5208
  }
@@ -5210,10 +5062,9 @@ if (!function_exists('woo_feed_modify_weight_attribute_value')) {
5210
 
5211
  return $attribute_value;
5212
  }
5213
-
5214
  }
5215
 
5216
- if (!function_exists('woo_feed_get_bestprice_categoryPath_attribute_value_modify')) {
5217
  /**
5218
  * Replace BestPrice categoryPath value from > to ,
5219
  *
@@ -5223,15 +5074,14 @@ if (!function_exists('woo_feed_get_bestprice_categoryPath_attribute_value_modify
5223
  *
5224
  * @return string
5225
  */
5226
- function woo_feed_get_bestprice_categoryPath_attribute_value_modify($attribute_value, $product, $feed_config)
5227
- {
5228
  $attribute_value = str_replace('>', ', ', $attribute_value);
5229
 
5230
  return $attribute_value;
5231
  }
5232
  }
5233
 
5234
- if (!function_exists('woo_feed_availability_attribute_value_modify')) {
5235
  /**
5236
  * Modify Availability attribute value based on channel.
5237
  *
@@ -5241,10 +5091,9 @@ if (!function_exists('woo_feed_availability_attribute_value_modify')) {
5241
  *
5242
  * @return string
5243
  */
5244
- function woo_feed_availability_attribute_value_modify($attribute_value, $product, $feed_config)
5245
- {
5246
- if ('bestprice' === $feed_config['provider']) {
5247
- if ('in stock' === $attribute_value) {
5248
  return "Y";
5249
  }
5250
 
@@ -5253,7 +5102,7 @@ if (!function_exists('woo_feed_availability_attribute_value_modify')) {
5253
 
5254
  if ( 'skroutz' === $feed_config['provider'] ) {
5255
 
5256
- if ('in stock' === $attribute_value) {
5257
  $in_stock_string = __('Delivery 1 to 3 days', 'woo-feed' );
5258
  } else {
5259
  $in_stock_string = __('Delivery up to 30 days', 'woo-feed' );
@@ -5262,32 +5111,32 @@ if (!function_exists('woo_feed_availability_attribute_value_modify')) {
5262
  return $in_stock_string;
5263
  }
5264
 
5265
- if ('pricerunner' === $feed_config['provider']) {
5266
- if ('in stock' === $attribute_value) {
5267
  return "Yes";
5268
  }
5269
 
5270
  return "No";
5271
  }
5272
 
5273
- if ('google' === $feed_config['provider'] || 'pinterest' === $feed_config['provider']) {
5274
- if ('on backorder' === $attribute_value || 'on_backorder' === $attribute_value) {
5275
  return 'preorder';
5276
  }
5277
 
5278
- if( 'google' === $feed_config['provider'] ) {
5279
- if( ! in_array( $attribute_value, [ 'in_stock', 'out_of_stock', 'on_backorder' ] ) ) {
5280
  return 'in_stock';
5281
  }
5282
- } else if( ! in_array( $attribute_value, [ 'in stock', 'out of stock', 'on backorder' ] ) ) {
5283
  return 'in stock';
5284
  }
5285
  }
5286
 
5287
- if ('facebook' === $feed_config['provider'] ) {
5288
- if( 'on backorder' === $attribute_value ){
5289
  return 'available for order';
5290
- }else if( ! in_array( $attribute_value, [ 'in stock', 'out of stock', 'on backorder' ] ) ) {
5291
  return 'in stock';
5292
  }
5293
  }
@@ -5296,7 +5145,7 @@ if (!function_exists('woo_feed_availability_attribute_value_modify')) {
5296
  }
5297
  }
5298
 
5299
- if (!function_exists('woo_feed_spartoo_attribute_value_modify')) {
5300
  /**
5301
  * Modify Spartoo feed Parent/Child attribute value.
5302
  *
@@ -5306,10 +5155,9 @@ if (!function_exists('woo_feed_spartoo_attribute_value_modify')) {
5306
  *
5307
  * @return string
5308
  */
5309
- function woo_feed_spartoo_attribute_value_modify($attribute_value, $product, $feed_config)
5310
- {
5311
- if ('spartoo.fi' === $feed_config['provider']) {
5312
- if ('variation' === $attribute_value) {
5313
  return "child";
5314
  }
5315
 
@@ -5320,7 +5168,7 @@ if (!function_exists('woo_feed_spartoo_attribute_value_modify')) {
5320
  }
5321
  }
5322
 
5323
- if (!function_exists('woo_feed_get_pinterest_rss_date_attribute_callback')) {
5324
  /**
5325
  * Convert date format to DATERFC822 for pinterest RSS Feed.
5326
  *
@@ -5330,9 +5178,8 @@ if (!function_exists('woo_feed_get_pinterest_rss_date_attribute_callback')) {
5330
  *
5331
  * @return string
5332
  */
5333
- function woo_feed_get_pinterest_rss_date_attribute_callback($attribute_value, $product, $feed_config)
5334
- {
5335
- if(!empty($attribute_value)){
5336
  return date('r', strtotime($attribute_value));
5337
  }
5338
  return $attribute_value;
@@ -5392,7 +5239,7 @@ if ( ! function_exists( 'woo_feed_duplicate_feed' ) ) {
5392
  }
5393
  }
5394
 
5395
- if( ! function_exists('woo_feed_is_google_group_merchant') ) {
5396
  /**
5397
  * Check if the given merchant is a google group merchant (google, facebook, pinterest, bing)
5398
  *
@@ -5402,12 +5249,12 @@ if( ! function_exists('woo_feed_is_google_group_merchant') ) {
5402
  * @since 4.4.22
5403
  * @return boolean
5404
  */
5405
- function woo_feed_is_google_group_merchant($provider) {
5406
- return in_array($provider, ['google', 'facebook', 'pinterest', 'bing']);
5407
  }
5408
  }
5409
 
5410
- if( ! function_exists('woo_feed_filter_product_description_callback') ) {
5411
  /**
5412
  * @param string $description Product Description
5413
  * @param WC_Product $product Product Object
@@ -5416,13 +5263,13 @@ if( ! function_exists('woo_feed_filter_product_description_callback') ) {
5416
  * @return mixed
5417
  */
5418
  function woo_feed_filter_product_description_callback( $description, $product, $config ) {
5419
- if( empty($description) ) {
5420
  return $description;
5421
  }
5422
 
5423
- if( isset($config['provider']) && woo_feed_is_google_group_merchant($config['provider']) ) {
5424
- if( strlen($description) > 5000 ) {
5425
- for( $I = 4999; $description[$I] != ' ' ; $I-- );
5426
  $description = substr($description, 0, $I);
5427
  }
5428
  }
@@ -5431,7 +5278,7 @@ if( ! function_exists('woo_feed_filter_product_description_callback') ) {
5431
  }
5432
  }
5433
 
5434
- if( ! function_exists( 'woo_feed_filter_product_title' ) ) {
5435
  /**
5436
  * @param string $title Product Title
5437
  * @param WC_Product $product
@@ -5439,15 +5286,15 @@ if( ! function_exists( 'woo_feed_filter_product_title' ) ) {
5439
  *
5440
  * @return string
5441
  */
5442
- function woo_feed_filter_product_title($title, $product, $config) {
5443
 
5444
- if( ! is_string( $title ) ) {
5445
  return '';
5446
  }
5447
 
5448
- if( isset($config['provider']) && in_array($config['provider'], ['google', 'facebook', 'pinterest', 'bing']) ) {
5449
- if( strlen($title) > 150 ) {
5450
- for( $I = 149; $title[$I] != ' ' ; $I-- );
5451
  $title = substr($title, 0, $I);
5452
  }
5453
  }
@@ -5456,7 +5303,7 @@ if( ! function_exists( 'woo_feed_filter_product_title' ) ) {
5456
  }
5457
  }
5458
 
5459
- if( ! function_exists( 'woo_feed_array_insert_after' ) ) {
5460
  /**
5461
  * Insert a value or key/value pair after a specific key in an array. If key doesn't exist, value is appended
5462
  * to the end of the array.
@@ -5474,10 +5321,9 @@ if( ! function_exists( 'woo_feed_array_insert_after' ) ) {
5474
 
5475
  return array_merge( array_slice( $array, 0, $pos ), $new, array_slice( $array, $pos ) );
5476
  }
5477
-
5478
  }
5479
 
5480
- if( ! function_exists( 'woo_feed_get_js_dequeue_handles_list' ) ) {
5481
  /**
5482
  * JS files handles list to dequeue from loading
5483
  *
@@ -5486,14 +5332,13 @@ if( ! function_exists( 'woo_feed_get_js_dequeue_handles_list' ) ) {
5486
  * @return array
5487
  */
5488
  function woo_feed_get_js_dequeue_handles_list() {
5489
- $js_files_handles = ['common_aramex', 'jquery_chained', 'validate_aramex']; //aramex shipping plugin handles
5490
 
5491
  return apply_filters("woo_feed_filter_js_dequeue_handles", $js_files_handles);
5492
  }
5493
-
5494
  }
5495
 
5496
- if( ! function_exists( 'woo_feed_get_plugin_pages_slugs' ) ) {
5497
  /**
5498
  * Get Woo Feed Plugin Pages Slugs
5499
  *
@@ -5502,7 +5347,7 @@ if( ! function_exists( 'woo_feed_get_plugin_pages_slugs' ) ) {
5502
  * @return array
5503
  */
5504
  function woo_feed_get_plugin_pages_slugs() {
5505
- $woo_feed_plugin_pages = [
5506
  'webappick-manage-feeds',
5507
  'webappick-new-feed',
5508
  'webappick-wp-options',
@@ -5511,19 +5356,18 @@ if( ! function_exists( 'woo_feed_get_plugin_pages_slugs' ) ) {
5511
  'webappick-feed-pro-vs-free',
5512
  'webappick-wp-status',
5513
  'webappick-feed-category-mapping',
5514
- 'webappick-wp-options'
5515
  ];
5516
 
5517
  return apply_filters('woo_feed_plugin_pages_slugs', $woo_feed_plugin_pages);
5518
  }
5519
-
5520
  }
5521
 
5522
- if( ! function_exists('woo_feed_make_feed_big_data') ) {
5523
- function woo_feed_make_feed_big_data($data, $ids, $config) {
5524
 
5525
  //setup feed shipping data @TODO: need to make a class when another data setup will be added
5526
- if( isset($config['attributes']) && in_array("shipping", $config["attributes"]) ) {
5527
  if ( class_exists( 'WC_Shipping_Zones' ) ) {
5528
  $data['shipping_zones'] = WC_Shipping_Zones::get_zones();
5529
  }
@@ -5535,6 +5379,69 @@ if( ! function_exists('woo_feed_make_feed_big_data') ) {
5535
  add_filter('woo_feed_feed_big_data', 'woo_feed_make_feed_big_data', 10, 3);
5536
  }
5537
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5538
  #==== MERCHANT TEMPLATE OVERRIDE END ================#
5539
 
5540
  // Including pluggable functions file
9
  * @copyright WebAppick
10
  */
11
 
12
+ if ( ! defined('ABSPATH') ) {
13
  die(); // Silence...
14
  }
15
 
16
+ if ( ! function_exists('woo_feed_maybe_define_constant') ) {
17
  /**
18
  * Define a constant if it is not already defined.
19
  *
23
  * @return void
24
  * @since 3.2.1
25
  */
26
+ function woo_feed_maybe_define_constant( $name, $value ) {
 
27
  // phpcs:disable
28
  if (!defined($name)) {
29
  define($name, $value);
31
  // phpcs:enable
32
  }
33
  }
34
+ if ( ! function_exists('woo_feed_doing_it_wrong') ) {
35
  /**
36
  * Wrapper for _doing_it_wrong.
37
  *
43
  * @since 3.2.1
44
  *
45
  */
46
+ function woo_feed_doing_it_wrong( $function, $message, $version ) {
 
47
  // phpcs:disable
48
  $message .= ' Backtrace: ' . wp_debug_backtrace_summary();
49
 
56
  // phpcs:enable
57
  }
58
  }
59
+ if ( ! function_exists('is_ajax') ) {
60
 
61
  /**
62
  * Is_ajax - Returns true when the page is loaded via ajax.
63
  *
64
  * @return bool
65
  */
66
+ function is_ajax() {
 
67
  return function_exists('wp_doing_ajax') ? wp_doing_ajax() : defined('DOING_AJAX');
68
  }
69
  }
70
+ if ( ! function_exists('woo_feed_is_plugin_active') ) {
71
  /**
72
  * Determines whether a plugin is active.
73
  *
78
  * @see is_plugin_active()
79
  *
80
  */
81
+ function woo_feed_is_plugin_active( $plugin ) {
82
+ if ( ! function_exists('is_plugin_active') ) {
 
83
  include_once ABSPATH . 'wp-admin/includes/plugin.php';
84
  }
85
 
86
  return is_plugin_active($plugin);
87
  }
88
  }
89
+ if ( ! function_exists('wooFeed_is_plugin_inactive') ) {
90
  /**
91
  * Determines whether the plugin is inactive.
92
  *
97
  * @see wooFeed_is_plugin_inactive()
98
  *
99
  */
100
+ function wooFeed_is_plugin_inactive( $plugin ) {
101
+ return ! woo_feed_is_plugin_active($plugin);
 
102
  }
103
  }
104
+ if ( ! function_exists('wooFeed_deactivate_plugins') ) {
105
  /**
106
  * Deactivate a single plugin or multiple plugins.
107
  * Wrapper for core deactivate_plugins() function
114
  * @see deactivate_plugins()
115
  *
116
  */
117
+ function wooFeed_Deactivate_plugins( $plugins, $silent = false, $network_wide = null ) {
118
+ if ( ! function_exists('deactivate_plugins') ) {
 
119
  require_once(ABSPATH . 'wp-admin/includes/plugin.php');
120
  }
121
  deactivate_plugins($plugins, $silent, $network_wide);
122
  }
123
  }
124
+ if ( ! function_exists('wooFeed_is_supported_php') ) {
125
  /**
126
  * Check if server php version meet minimum requirement
127
  * @return bool
128
  * @since 3.1.41
129
  */
130
+ function wooFeed_is_supported_php() {
 
131
  // PHP version need to be => WOO_FEED_MIN_PHP_VERSION
132
+ return ! version_compare(PHP_VERSION, WOO_FEED_MIN_PHP_VERSION, '<');
133
  }
134
  }
135
+ if ( ! function_exists('wooFeed_check_WC') ) {
136
+ function wooFeed_check_WC() {
 
137
  return class_exists('WooCommerce', false);
138
  }
139
  }
140
+ if ( ! function_exists('wooFeed_is_WC_supported') ) {
141
+ function wooFeed_is_WC_supported() {
 
142
  // Ensure WC is loaded before checking version
143
  return (defined('WC_VERSION') && version_compare(WC_VERSION, WOO_FEED_MIN_WC_VERSION, '>='));
144
  }
145
  }
146
+ if ( ! function_exists('woo_feed_wc_version_check') ) {
147
  /**
148
  * Check WooCommerce Version
149
  *
151
  *
152
  * @return bool
153
  */
154
+ function woo_feed_wc_version_check( $version = '3.0' ) {
155
+ if ( ! function_exists('get_plugins') ) {
 
156
  require_once ABSPATH . 'wp-admin/includes/plugin.php';
157
  }
158
  $plugins = get_plugins();
159
+ if ( array_key_exists('woocommerce/woocommerce.php', $plugins) ) {
160
  $currentVersion = $plugins['woocommerce/woocommerce.php']['Version'];
161
+ if ( version_compare($currentVersion, $version, '>=') ) {
162
  return true;
163
  }
164
  }
166
  return false;
167
  }
168
  }
169
+ if ( ! function_exists('woo_feed_wpml_version_check') ) {
170
  /**
171
  * Check WooCommerce Version
172
  *
174
  *
175
  * @return bool
176
  */
177
+ function woo_feed_wpml_version_check( $version = '3.2' ) {
 
178
  // calling this function too early (before wc loaded) will not give correct output
179
+ if ( defined('ICL_SITEPRESS_VERSION') ) {
180
+ if ( version_compare(ICL_SITEPRESS_VERSION, $version, '>=') ) {
181
  return true;
182
  }
183
  }
185
  return false;
186
  }
187
  }
188
+ if ( ! function_exists('wooFeed_Admin_Notices') ) {
189
  /**
190
  * Display Admin Messages
191
  * @hooked admin_notices
192
  * @return void
193
  * @since 3.1.41
194
  */
195
+ function wooFeed_Admin_Notices() {
 
196
  // @TODO Refactor this function with admin message class
197
  // WC Missing Notice..
198
+ if ( ! wooFeed_check_WC() ) {
199
  $plugin_url = self_admin_url('plugin-install.php?s=woocommerce&tab=search&type=term');
200
  /**
201
  * @noinspection HtmlUnknownTarget
212
  );
213
  printf('<div class="error"><p><strong>%1$s</strong></p></div>', $message); // phpcs:ignore
214
  }
215
+ if ( wooFeed_check_WC() && ! wooFeed_is_WC_supported() ) {
216
  $plugin_url = self_admin_url('plugin-install.php?s=woocommerce&tab=search&type=term');
217
  $wcVersion = defined('WC_VERSION') ? '<code>' . WC_VERSION . '</code>' : '<code>UNKNOWN</code>';
218
  $minVersion = '<code>' . WOO_FEED_MIN_WC_VERSION . '</code>';
235
  }
236
  }
237
  }
238
+ if ( ! function_exists('woo_feed_black_friday_notice') ) {
239
  /**
240
  * CTX Feed Black Friday Notice
241
  *
242
  * @since 4.4.35
243
  * @author Nazrul Islam Nayan
244
  */
245
+ function woo_feed_black_friday_notice() {
 
246
  $user_id = get_current_user_id();
247
+ if ( ! get_user_meta($user_id, 'woo_feed_black_friday_notice_2021_dismissed') ) {
248
  ob_start();
249
  ?>
250
  <script type="text/javascript">
275
  }
276
  }
277
  }
278
+ if ( ! function_exists('woo_feed_progress_bar') ) {
279
  /**
280
  * Feed Progress Bar
281
  *
282
  * @since 4.1.1
283
  */
284
+ function woo_feed_progress_bar() {
 
285
  $progress_bar = '';
286
  ob_start();
287
  ?>
323
  }
324
  }
325
 
326
+ if ( ! function_exists('checkFTP_connection') ) {
327
  /**
328
  * Verify if ftp module enabled
329
  * @TODO improve module detection
330
  * @return bool
331
  */
332
+ function checkFTP_connection() {
 
333
  return (extension_loaded('ftp') || function_exists('ftp_connect'));
334
  }
335
  }
336
+ if ( ! function_exists('checkSFTP_connection') ) {
337
  /**
338
  * Verify if ssh/sftp module enabled
339
  * @TODO improve module detection
340
  * @return bool
341
  */
342
+ function checkSFTP_connection() {
 
343
  return (extension_loaded('ssh2') || function_exists('ssh2_connect'));
344
  }
345
  }
346
+ if ( ! function_exists('array_splice_assoc') ) {
347
  /**
348
  * Array Splice Associative Array
349
  * @see https://www.php.net/manual/en/function.array-splice.php#111204
355
  *
356
  * @return array
357
  */
358
+ function array_splice_assoc( $input, $offset, $length, $replacement ) {
 
359
  $replacement = (array)$replacement;
360
  $key_indices = array_flip(array_keys($input));
361
+ if ( isset($input[ $offset ]) && is_string($offset) ) {
362
+ $offset = $key_indices[ $offset ] + 1;
363
  }
364
+ if ( isset($input[ $length ]) && is_string($length) ) {
365
+ $length = $key_indices[ $length ] - $offset;
366
  }
367
 
368
  $input = array_slice($input, 0, $offset, true) + $replacement + array_slice($input, $offset + $length, null, true);
370
  return $input;
371
  }
372
  }
373
+ if ( ! function_exists('woo_feed_get_query_type_options') ) {
374
  /**
375
  * Get Query available Types
376
  *
378
  * @return array
379
  * @since 3.3.11
380
  */
381
+ function woo_feed_get_query_type_options( $type='' ) {
382
+ if ( 'variation' === $type ) {
 
383
  return [
384
  'individual' => __('Individual', 'woo-feed'),
385
+ 'variable' => __('Variable Dependable', 'woo-feed'),
386
  ];
387
+ }else {
388
  return [
389
+ 'wc' => __('WC_Product_Query', 'woo-feed'),
390
+ 'wp' => __('WP_Query', 'woo-feed'),
391
  'both' => __('Both', 'woo-feed'),
392
  ];
393
  }
394
  }
395
  }
396
+ if ( ! function_exists('woo_feed_get_cache_ttl_options') ) {
397
  /**
398
  * Cache Expiration Options
399
  * @return array
400
  */
401
+ function woo_feed_get_cache_ttl_options() {
 
402
  return apply_filters(
403
  'woo_feed_cache_ttl_options',
404
  [
405
+ 0 => esc_html__('No Expiration ', 'woo-feed'),
406
+ MONTH_IN_SECONDS => esc_html__('1 Month', 'woo-feed'),
407
+ WEEK_IN_SECONDS => esc_html__('1 Week', 'woo-feed'),
408
+ DAY_IN_SECONDS => esc_html__('24 Hours', 'woo-feed'),
409
  12 * HOUR_IN_SECONDS => esc_html__('12 Hours', 'woo-feed'),
410
+ 6 * HOUR_IN_SECONDS => esc_html__('6 Hours', 'woo-feed'),
411
+ HOUR_IN_SECONDS => esc_html__('1 Hours', 'woo-feed'),
412
  ]
413
  );
414
  }
415
  }
416
+ if ( ! function_exists('woo_feed_get_custom2_merchant') ) {
417
  /**
418
  * Get Merchant list that are allowed on Custom2 Template
419
  * @return array
420
  */
421
+ function woo_feed_get_custom2_merchant() {
422
+ return array( 'custom2', 'admarkt', 'yandex_xml', 'glami' );
 
423
  }
424
  }
425
+ if ( ! function_exists('woo_feed_get_merchant_class') ) {
426
  /**
427
  * @param string $provider
428
  *
429
  * @return string
430
  */
431
+ function woo_feed_get_merchant_class( $provider ) {
432
+ if ( in_array($provider, [ 'google', 'google_shopping_action', 'google_local', 'google_local_inventory', 'adroll', 'smartly.io' ], true) ) {
 
433
  return 'Woo_Feed_Google';
434
+ } elseif ( in_array($provider, array( 'pinterest', 'pinterest_rss' )) ) {
435
  return 'Woo_Feed_Pinterest';
436
+ } elseif ( 'facebook' === $provider ) {
437
  return 'Woo_Feed_Facebook';
438
+ } elseif ( strpos($provider, 'amazon') !== false ) {
439
  return 'Woo_Feed_Amazon';
440
+ } elseif ( in_array($provider, woo_feed_get_custom2_merchant(), true) ) {
441
  return 'Woo_Feed_Custom_XML';
442
  } else {
443
  return 'Woo_Feed_Custom';
444
  }
445
  }
446
  }
447
+ if ( ! function_exists('woo_feed_handle_file_transfer') ) {
448
  /**
449
  * Transfer file as per ftp config
450
  *
454
  *
455
  * @return bool
456
  */
457
+ function woo_feed_handle_file_transfer( $fileFrom, $fileTo, $info ) {
458
+ if ( 1 === (int)$info['ftpenabled'] ) {
459
+ if ( ! file_exists($fileFrom) ) {
 
460
  woo_feed_log_feed_process($info['filename'], 'Unable to process file transfer request. File does not exists.');
461
  return false;
462
  }
465
  $ftp_password = sanitize_text_field($info['ftppassword']);
466
  $ftpPath = trailingslashit(untrailingslashit(sanitize_text_field($info['ftppath'])));
467
  $ftp_passive_mode = (isset($info['ftpmode']) && sanitize_text_field($info['ftpmode']) === 'passive') ? true : false;
468
+ if ( isset($info['ftporsftp']) & 'ftp' === $info['ftporsftp'] ) {
469
  $ftporsftp = 'ftp';
470
  } else {
471
  $ftporsftp = 'sftp';
472
  }
473
+ if ( isset($info['ftpport']) && ! empty($info['ftpport']) ) {
474
  $ftp_port = absint($info['ftpport']);
475
  } else {
476
  $ftp_port = false;
483
  woo_feed_log_feed_process($info['filename'], sprintf('Uploading Feed file via %s.', $ftporsftp));
484
 
485
  try {
486
+ if ( 'ftp' === $ftporsftp ) {
487
 
488
  $ftp = new WebAppick\FTP\FTPConnection();
489
+ if ( $ftp->connect($ftpHost, $ftp_user, $ftp_password, $ftp_passive_mode, $ftp_port) ) {
490
  return $ftp->upload_file($fileFrom, $ftpPath . $fileTo);
491
+ }
492
+ } elseif ( 'sftp' === $ftporsftp ) {
 
493
 
494
  $sftp = new WebAppick\FTP\SFTPConnection($ftpHost, $ftp_port);
495
  $sftp->login($ftp_user, $ftp_password);
497
  return $sftp->upload_file($fileFrom, $fileTo, $ftpPath);
498
 
499
  }
500
+ } catch ( Exception $e ) {
501
  $message = 'Error Uploading Feed Via ' . $ftporsftp . PHP_EOL . 'Caught Exception :: ' . $e->getMessage();
502
  woo_feed_log($info['filename'], $message, 'critical', $e, true);
503
  woo_feed_log_fatal_error($message, $e);
507
  return false;
508
  }
509
  }
510
+ if ( ! function_exists('woo_feed_get_file_types') ) {
511
+ function woo_feed_get_file_types() {
 
512
  return array(
513
+ 'xml' => 'XML',
514
+ 'csv' => 'CSV',
515
+ 'tsv' => 'TSV',
516
+ 'xls' => 'XLS',
517
+ 'txt' => 'TXT',
518
  'json' => 'JSON',
519
  );
520
  }
521
  }
522
+ if ( ! function_exists('woo_feed_get_default_brand') ) {
523
  /**
524
  * Guess Brand name from Site URL
525
  *
526
  * @return string
527
  */
528
+ function woo_feed_get_default_brand() {
 
529
  $brand = apply_filters('woo_feed_pre_get_default_brand_name', null);
530
+ if ( ! is_null($brand) ) {
531
  return $brand;
532
  }
533
  $brand = '';
534
  $url = filter_var(site_url(), FILTER_SANITIZE_URL);
535
+ if ( false !== $url ) {
536
  $url = wp_parse_url($url);
537
+ if ( array_key_exists('host', $url) ) {
538
+ if ( strpos($url['host'], ".") !== false ) {
539
  $arr = explode('.', $url['host']);
540
+ $brand = $arr[ count($arr) - 2 ];
541
  $brand = ucfirst($brand);
542
  } else {
543
  $brand = $url['host'];
549
  return apply_filters('woo_feed_get_default_brand_name', $brand);
550
  }
551
  }
552
+ if ( ! function_exists('woo_feed_merchant_require_google_category') ) {
553
  /**
554
  * Check if current merchant supports google taxonomy for current attribute.
555
  * @param string $merchant
557
  *
558
  * @return array|bool
559
  */
560
+ function woo_feed_merchant_require_google_category( $merchant = null, $attribute = null ) {
 
561
  $list = [
562
+ 'current_category' => [
563
  'google',
564
  'google_shopping_action',
565
  'google_local',
570
  'pinterest',
571
  'rakuten.de',
572
  ],
573
+ 'fb_product_category' => [ 'facebook' ],
574
+ 'google_product_category' => [ 'rakuten.de' ],
575
+ 'google_category_id' => [ 'daisycon', 'daisycon_automotive', 'daisycon_books', 'daisycon_cosmetics', 'daisycon_daily_offers', 'daisycon_electronics', 'daisycon_food_drinks', 'daisycon_home_garden', 'daisycon_housing', 'daisycon_fashion', 'daisycon_studies_trainings', 'daisycon_telecom_accessories', 'daisycon_telecom_all_in_one', 'daisycon_telecom_gsm_subscription', 'daisycon_telecom_gsm', 'daisycon_telecom_sim', 'daisycon_magazines', 'daisycon_holidays_accommodations', 'daisycon_holidays_accommodations_and_transport', 'daisycon_holidays_trips', 'daisycon_work_jobs' ],
576
  ];
577
+ if ( null !== $merchant && null !== $attribute ) {
578
+ return (isset($list[ $attribute ]) && in_array($merchant, $list[ $attribute ], true));
579
  }
580
  return $list;
581
  }
582
  }
583
+ if ( ! function_exists('woo_feed_get_item_wrapper_hidden_merchant') ) {
584
+ function woo_feed_get_item_wrapper_hidden_merchant() {
 
585
  return apply_filters(
586
  'woo_feed_item_wrapper_hidden_merchant',
587
  [
631
  }
632
 
633
  // The Editor.
634
+ if ( ! function_exists('woo_feed_parse_feed_rules') ) {
635
  /**
636
  * Parse Feed Config/Rules to make sure that necessary array keys are exists
637
  * this will reduce the uses of isset() checking
645
  * @uses wp_parse_args
646
  *
647
  */
648
+ function woo_feed_parse_feed_rules( $rules = [], $context = 'view' ) {
 
649
 
650
+ if ( empty($rules) ) {
651
  $rules = [];
652
  }
653
  $defaults = [
654
+ 'provider' => '',
655
+ 'filename' => '',
656
+ 'feedType' => '',
657
+ 'feed_country' => '',
658
+ 'ftpenabled' => 0,
659
+ 'ftporsftp' => 'ftp',
660
+ 'ftphost' => '',
661
+ 'ftpport' => '21',
662
+ 'ftpuser' => '',
663
+ 'ftppassword' => '',
664
+ 'ftppath' => '',
665
+ 'ftpmode' => 'active',
666
+ 'is_variations' => 'y',
667
+ 'variable_price' => 'first',
668
+ 'variable_quantity' => 'first',
669
+ 'feedLanguage' => apply_filters('wpml_current_language', null),
670
+ 'feedCurrency' => get_woocommerce_currency(),
671
+ 'itemsWrapper' => 'products',
672
+ 'itemWrapper' => 'product',
673
+ 'delimiter' => ',',
674
+ 'enclosure' => 'double',
675
+ 'extraHeader' => '',
676
+ 'vendors' => [],
677
  // Feed Config
678
+ 'mattributes' => [], // merchant attributes
679
+ 'prefix' => [], // prefixes
680
+ 'type' => [], // value (attribute) types
681
+ 'attributes' => [], // product attribute mappings
682
+ 'default' => [], // default values (patterns) if value type set to pattern
683
+ 'suffix' => [], // suffixes
684
+ 'output_type' => [], // output type (output filter)
685
+ 'limit' => [], // limit or command
686
  // filters tab
687
+ 'composite_price' => '',
688
+ 'product_ids' => '',
689
+ 'categories' => [],
690
+ 'post_status' => [ 'publish' ],
691
+ 'filter_mode' => [],
692
  'campaign_parameters' => [],
693
 
694
+ 'ptitle_show' => '',
695
+ 'decimal_separator' => wc_get_price_decimal_separator(),
696
+ 'thousand_separator' => wc_get_price_thousand_separator(),
697
+ 'decimals' => wc_get_price_decimals(),
698
  ];
699
  $rules = wp_parse_args($rules, $defaults);
700
  $rules['filter_mode'] = wp_parse_args($rules['filter_mode'],
701
  [
702
  'product_ids' => 'include',
703
+ 'categories' => 'include',
704
  'post_status' => 'include',
705
  ]);
706
 
707
  $rules['campaign_parameters'] = wp_parse_args(
708
  $rules['campaign_parameters'],
709
  [
710
+ 'utm_source' => '',
711
+ 'utm_medium' => '',
712
  'utm_campaign' => '',
713
+ 'utm_term' => '',
714
+ 'utm_content' => '',
715
  ]
716
  );
717
 
718
+ if ( ! empty($rules['provider']) && is_string($rules['provider']) ) {
719
  /**
720
  * filter parsed rules for provider
721
  *
740
  return apply_filters('woo_feed_parsed_rules', $rules, $context);
741
  }
742
  }
743
+ if ( ! function_exists('woo_feed_register_and_do_woo_feed_meta_boxes') ) {
744
  /**
745
  * Registers the default Feed Editor MetaBoxes, and runs the `do_meta_boxes` actions.
746
  *
756
  * @since 3.2.6
757
  *
758
  */
759
+ function woo_feed_register_and_do_woo_feed_meta_boxes( $screen, $feedRules = array() ) {
760
+ if ( empty($screen) ) {
 
761
  $screen = get_current_screen();
762
+ } elseif ( is_string($screen) ) {
763
  $screen = convert_to_screen($screen);
764
  }
765
  // edit page MetaBoxes
766
+ if ( 'ctx-feed_page_webappick-new-feed' === $screen->id || 'toplevel_page_webappick-manage-feeds' === $screen->id ) {
767
  add_meta_box('feed_merchant_info', 'Feed Merchant Info', 'woo_feed_merchant_info_metabox', null, 'side', 'default');
768
  }
769
  /**
777
  do_action('do_meta_boxes', $screen->id, 'side', $feedRules);
778
  }
779
  }
780
+ if ( ! function_exists('woo_feed_ajax_merchant_info') ) {
781
  add_action('wp_ajax_woo_feed_get_merchant_info', 'woo_feed_ajax_merchant_info');
782
+ function woo_feed_ajax_merchant_info() {
783
+ if ( isset($_REQUEST['nonce']) && wp_verify_nonce(sanitize_text_field(wp_unslash($_REQUEST['nonce'])),
784
+ 'wpf_feed_nonce') ) {
785
+ $provider = (isset($_REQUEST['provider']) && ! empty($_REQUEST['provider'])) ? sanitize_text_field(wp_unslash($_REQUEST['provider'])) : '';
 
786
  $merchantInfo = new Woo_Feed_Merchant($provider);
787
  $data = [];
788
  $na = esc_html__('N/A', 'woo-feed');
789
+ foreach ( $merchantInfo->get_info() as $k => $v ) {
790
+ if ( 'link' === $k ) {
791
  /** @noinspection HtmlUnknownTarget */
792
+ $data[ $k ] = empty($v) ? $na : sprintf('<a href="%s" target="_blank">%s</a>',
793
  esc_url($v),
794
  esc_html__('Read Article', 'woo-feed'));
795
+ } elseif ( 'video' === $k ) {
796
  /** @noinspection HtmlUnknownTarget */
797
+ $data[ $k ] = empty($v) ? $na : sprintf('<a href="%s" target="_blank">%s</a>',
798
  esc_url($v),
799
  esc_html__('Watch Now', 'woo-feed'));
800
+ } elseif ( 'feed_file_type' === $k ) {
801
+ if ( ! empty($v) ) {
802
+ $v = array_map(function ( $type ) {
803
  return strtoupper($type);
804
  },
805
  (array)$v);
806
+ $data[ $k ] = esc_html(implode(', ', $v));
807
  } else {
808
+ $data[ $k ] = $na;
809
  }
810
+ } elseif ( 'doc' === $k ) {
811
  $links = '';
812
+ foreach ( $v as $label => $link ) {
813
  /** @noinspection HtmlUnknownTarget */
814
  $links .= sprintf('<li><a href="%s" target="_blank">%s</a></li>',
815
  esc_url($link),
816
  esc_html($label));
817
  }
818
+ $data[ $k ] = empty($links) ? $na : $links;
819
  }
820
  }
821
  wp_send_json_success($data);
825
  die();
826
  }
827
  }
828
+ if ( ! function_exists('woo_feed_merchant_info_metabox') ) {
829
  /**
830
  * Render Merchant Info Metabox
831
  *
833
  *
834
  * @return void
835
  */
836
+ function woo_feed_merchant_info_metabox( $feedConfig ) {
837
+ $provider = (isset($feedConfig['provider']) && ! empty($feedConfig['provider'])) ? $feedConfig['provider'] : '';
 
838
  $merchantInfo = new Woo_Feed_Merchant($provider);
839
 
840
  //get feed options
841
+ if ( isset($_GET['feed']) ) {
842
  $filename = str_replace('wf_feed_', '', wp_unslash($_GET['feed']));
843
  $feed_options = maybe_unserialize(get_option('wf_feed_' . $filename));
844
  }
845
  ?>
846
  <span class="spinner"></span>
847
  <div class="merchant-infos">
848
+ <?php foreach ( $merchantInfo->get_info() as $k => $v ) { ?>
849
  <div class="merchant-info-section <?php echo esc_attr($k); ?>">
850
+ <?php if ( 'link' === $k ) { ?>
851
  <span class="dashicons dashicons-media-document" style="color: #82878c;"
852
  aria-hidden="true"></span>
853
  <span><?php esc_html_e('Feed Specification:', 'woo-feed'); ?></span>
860
  esc_html__('Read Article', 'woo-feed'));
861
  ?>
862
  </strong>
863
+ <?php } elseif ( 'video' === $k ) { ?>
864
  <span class="dashicons dashicons-video-alt3" style="color: #82878c;" aria-hidden="true"></span>
865
  <span><?php esc_html_e('Video Documentation:', 'woo-feed'); ?></span>
866
  <strong class="data">
872
  esc_html__('Watch now', 'woo-feed'));
873
  ?>
874
  </strong>
875
+ <?php } elseif ( 'feed_file_type' === $k ) { ?>
876
  <span class="dashicons dashicons-media-text" style="color: #82878c;"
877
  aria-hidden="true"></span> <?php esc_html_e('Supported File Types:', 'woo-feed'); ?>
878
  <strong class="data" style="display: block;padding-left: 24px;margin-top: 5px;">
879
  <?php
880
+ if ( empty($v) ) {
881
  esc_html_e('N/A', 'woo-feed');
882
  } else {
883
  $v = implode(', ',
884
+ array_map(function ( $type ) {
885
  return esc_html(strtoupper($type));
886
  },
887
  (array)$v));
890
  ?>
891
  </strong>
892
  <?php
893
+ } elseif ( 'doc' === $k ) {
894
  ?>
895
  <span class="dashicons dashicons-editor-help" style="color: #82878c;" aria-hidden="true"></span>
896
  <span><?php esc_html_e('Support Docs:', 'woo-feed'); ?></span>
897
  <ul class="data">
898
  <?php
899
+ if ( empty($v) ) {
900
  esc_html_e('N/A', 'woo-feed');
901
  } else {
902
+ foreach ( $v as $label => $link ) {
903
  /** @noinspection HtmlUnknownTarget */
904
  printf('<li><a href="%s" target="_blank">%s</a></li>',
905
  esc_url($link),
915
  <?php } ?>
916
  <div class="merchant-info-section woo-feed-open-file">
917
  <?php
918
+ if ( isset($feed_options['url']) && ! empty($feed_options['url']) ) {
919
  echo sprintf(
920
  '<a href="%1$s" title="%2$s" aria-label="%2$s" target="_blank"><span class="dashicons dashicons-external" aria-hidden="true"></span> %3$s</a>',
921
  $feed_options['url'],
929
  <?php
930
  }
931
  }
932
+ if ( ! function_exists('woo_feed_get_csv_delimiters') ) {
933
  /**
934
  * Get CSV/TXT/TSV Delimiters
935
  * @return array
936
  */
937
+ function woo_feed_get_csv_delimiters() {
 
938
  return [
939
+ ',' => 'Comma',
940
+ ':' => 'Colon',
941
+ ' ' => 'Space',
942
+ '|' => 'Pipe',
943
+ ';' => 'Semi Colon',
944
  "\t" => 'TAB',
945
  ];
946
  }
947
  }
948
+ if ( ! function_exists('woo_feed_get_csv_enclosure') ) {
949
  /**
950
  * Get CSV/TXT/TSV Enclosure for multiple words
951
  * @return array
952
  */
953
+ function woo_feed_get_csv_enclosure() {
 
954
  return [
955
  'double' => '"',
956
  'single' => '\'',
957
+ ' ' => 'None',
958
  ];
959
  }
960
  }
961
 
962
  // Editor Tabs.
963
+ if ( ! function_exists('render_feed_config') ) {
964
  /**
965
  * @param string $tabId
966
  * @param array $feedRules
967
  * @param bool $idEdit
968
  */
969
+ function render_feed_config( $tabId, $feedRules, $idEdit ) {
 
970
  global $provider, $wooFeedDropDown, $merchant;
971
  include WOO_FEED_FREE_ADMIN_PATH . 'partials/woo-feed-edit-config.php';
972
  }
973
  }
974
+ if ( ! function_exists('render_filter_config') ) {
975
  /**
976
  * @param string $tabId
977
  * @param array $feedRules
978
  * @param bool $idEdit
979
  */
980
+ function render_filter_config( $tabId, $feedRules, $idEdit ) {
 
981
  global $provider, $wooFeedDropDown, $merchant;
982
  include WOO_FEED_FREE_ADMIN_PATH . 'partials/woo-feed-edit-filter.php';
983
  }
984
  }
985
+ if ( ! function_exists('render_ftp_config') ) {
986
  /**
987
  * @param string $tabId
988
  * @param array $feedRules
989
  * @param bool $idEdit
990
  */
991
+ function render_ftp_config( $tabId, $feedRules, $idEdit ) {
 
992
  global $provider, $wooFeedDropDown, $merchant;
993
  include WOO_FEED_FREE_ADMIN_PATH . 'partials/woo-feed-edit-ftp.php';
994
  }
995
  }
996
 
997
  // Sanitization.
998
+ if ( ! function_exists('woo_feed_check_google_category') ) {
999
  /**
1000
  * @param array $feedInfo
1001
  *
1002
  * @return string
1003
  */
1004
+ function woo_feed_check_google_category( $feedInfo ) {
 
1005
  // Check Google Product Category for Google & Facebook Template and show message.
1006
  $list = woo_feed_merchant_require_google_category();
1007
  $cat_keys = array_keys($list);
1010
  $checkCategoryType = isset($feedInfo['feedrules']['type']) ? $feedInfo['feedrules']['type'] : [];
1011
  $merchant = isset($feedInfo['feedrules']['provider']) ? $feedInfo['feedrules']['provider'] : [];
1012
  $cat = 'yes';
1013
+ foreach ( $list as $attribute => $merchants ) {
1014
+ if ( in_array($merchant, $merchants, true) && in_array($attribute, $checkCategory, true) ) {
1015
  $catKey = array_search($attribute, $checkCategory, true);
1016
+ if ( 'pattern' === $checkCategoryType[ $catKey ] ) {
1017
  $checkCategoryValue = $feedInfo['feedrules']['default'];
1018
  } else {
1019
  $checkCategoryValue = $feedInfo['feedrules']['attributes'];
1020
  }
1021
 
1022
+ if ( empty($checkCategoryValue[ $catKey ]) ) {
1023
  $cat = 'no';
1024
  }
1025
  break;
1029
  return $cat;
1030
  }
1031
  }
1032
+ if ( ! function_exists('woo_feed_array_sanitize') ) {
1033
  /**
1034
  * Sanitize array post
1035
  *
1037
  *
1038
  * @return array
1039
  */
1040
+ function woo_feed_array_sanitize( $array ) {
 
1041
  $newArray = array();
1042
+ if ( count($array) ) {
1043
+ foreach ( $array as $key => $value ) {
1044
+ if ( is_array($value) ) {
1045
+ foreach ( $value as $key2 => $value2 ) {
1046
+ if ( is_array($value2) ) {
1047
+ foreach ( $value2 as $key3 => $value3 ) {
1048
+ $newArray[ $key ][ $key2 ][ $key3 ] = sanitize_text_field($value3);
1049
  }
1050
  } else {
1051
+ $newArray[ $key ][ $key2 ] = sanitize_text_field($value2);
1052
  }
1053
  }
1054
  } else {
1055
+ $newArray[ $key ] = sanitize_text_field($value);
1056
  }
1057
  }
1058
  }
1060
  return $newArray;
1061
  }
1062
  }
1063
+ if ( ! function_exists('woo_feed_sanitize_form_fields') ) {
1064
  /**
1065
  * Sanitize Form Fields ($_POST Array)
1066
  *
1068
  *
1069
  * @return array
1070
  */
1071
+ function woo_feed_sanitize_form_fields( $data ) {
1072
+ foreach ( $data as $k => $v ) {
1073
+ if ( true === apply_filters('woo_feed_sanitize_form_fields', true, $k, $v, $data) ) {
1074
+ if ( is_array($v) ) {
 
1075
  $v = woo_feed_sanitize_form_fields($v);
1076
  } else {
1077
  // $v = sanitize_text_field( $v ); #TODO should not trim Prefix and Suffix field
1078
  }
1079
  }
1080
+ $data[ $k ] = apply_filters('woo_feed_sanitize_form_field', $v, $k);
1081
  }
1082
 
1083
  return $data;
1084
  }
1085
  }
1086
+ if ( ! function_exists('woo_feed_unique_feed_slug') ) {
1087
  /**
1088
  * Generate Unique slug for feed.
1089
  * This function only check database for existing feed for generating unique slug.
1097
  * @see wp_unique_post_slug()
1098
  *
1099
  */
1100
+ function woo_feed_unique_feed_slug( $slug, $prefix = '', $option_id = null ) {
 
1101
  global $wpdb;
1102
  /** @noinspection SpellCheckingInspection */
1103
+ $disallowed = array( 'siteurl', 'home', 'blogname', 'blogdescription', 'users_can_register', 'admin_email' );
1104
+ if ( $option_id && $option_id > 0 ) {
1105
  $checkSql = "SELECT option_name FROM $wpdb->options WHERE option_name = %s AND option_id != %d LIMIT 1";
1106
  $nameCheck = $wpdb->get_var($wpdb->prepare($checkSql, $prefix . $slug, $option_id)); // phpcs:ignore
1107
  } else {
1109
  $nameCheck = $wpdb->get_var($wpdb->prepare($checkSql, $prefix . $slug)); // phpcs:ignore
1110
  }
1111
  // slug found or slug in disallowed list
1112
+ if ( $nameCheck || in_array($slug, $disallowed, true) ) {
1113
  $suffix = 2;
1114
  do {
1115
  $altName = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1116
+ if ( $option_id && $option_id > 0 ) {
1117
  $nameCheck = $wpdb->get_var($wpdb->prepare($checkSql, $prefix . $altName, $option_id)); // phpcs:ignore
1118
  } else {
1119
  $nameCheck = $wpdb->get_var($wpdb->prepare($checkSql, $prefix . $altName)); // phpcs:ignore
1120
  }
1121
  $suffix++;
1122
+ } while ( $nameCheck );
1123
  $slug = $altName;
1124
  }
1125
 
1126
  return $slug;
1127
  }
1128
  }
1129
+ if ( ! function_exists('woo_feed_unique_option_name') ) {
1130
  /**
1131
  * Alias of woo_feed_unique_feed_slug
1132
  *
1140
  * @since 3.3.8
1141
  *
1142
  */
1143
+ function woo_feed_unique_option_name( $slug, $prefix = '', $option_id = null ) {
 
1144
  return woo_feed_unique_feed_slug($slug, $prefix, $option_id);
1145
  }
1146
  }
1147
+ if ( ! function_exists('generate_unique_feed_file_name') ) {
1148
  /**
1149
  * Generate Unique file Name.
1150
  * This will insure unique slug and file name for a single feed.
1155
  *
1156
  * @return string|string[]
1157
  */
1158
+ function generate_unique_feed_file_name( $filename, $type, $provider ) {
 
1159
 
1160
  $feedDir = woo_feed_get_file_dir($provider, $type);
1161
  $raw_filename = sanitize_title($filename, '', 'save');
1170
  }
1171
 
1172
  // File process.
1173
+ if ( ! function_exists('woo_feed_check_valid_extension') ) {
1174
  /**
1175
  * Check Feed File Extension Validity
1176
  *
1178
  *
1179
  * @return bool
1180
  */
1181
+ function woo_feed_check_valid_extension( $extension ) {
 
1182
  return in_array($extension, array_keys(woo_feed_get_file_types()), true);
1183
  }
1184
  }
1185
+ if ( ! function_exists('woo_feed_save_feed_config_data') ) {
1186
  /**
1187
  * Sanitize And Save Feed config data (array) to db (option table)
1188
  *
1192
  *
1193
  * @return bool|string return false if failed to update. return filename if success
1194
  */
1195
+ function woo_feed_save_feed_config_data( $data, $feed_option_name = null, $configOnly = true ) {
1196
+ if ( ! is_array($data) ) {
 
1197
  return false;
1198
  }
1199
+ if ( ! isset($data['filename'], $data['feedType'], $data['provider']) ) {
1200
  return false;
1201
  }
1202
  // unnecessary form fields to remove
1203
+ $removables = [ 'closedpostboxesnonce', '_wpnonce', '_wp_http_referer', 'save_feed_config', 'edit-feed' ];
1204
+ foreach ( $removables as $removable ) {
1205
+ if ( isset($data[ $removable ]) ) {
1206
+ unset($data[ $removable ]);
1207
  }
1208
  }
1209
  // parse rules
1210
  $data = woo_feed_parse_feed_rules($data);
1211
  // Sanitize Fields
1212
  $data = woo_feed_sanitize_form_fields($data);
1213
+ if ( empty($feed_option_name) ) {
1214
  $feed_option_name = generate_unique_feed_file_name(
1215
  $data['filename'],
1216
  $data['feedType'],
1223
  $old_data = get_option('wf_config' . $feed_option_name, array());
1224
  $update = false;
1225
  $updated = false;
1226
+ if ( is_array($old_data) && ! empty($old_data) ) {
1227
  $update = true;
1228
  }
1229
 
1239
  */
1240
  $data = apply_filters('woo_feed_insert_feed_data', $data, $old_data, 'wf_config' . $feed_option_name);
1241
 
1242
+ if ( $update ) {
1243
  /**
1244
  * Before Updating Config to db
1245
  *
1257
  do_action('woo_feed_before_insert_config', $data, 'wf_config' . $feed_option_name);
1258
  }
1259
  $updated = ($data === $old_data);
1260
+ if ( false === $updated ) {
1261
  // Store Config.
1262
  $updated = update_option('wf_config' . $feed_option_name, $data, false);
1263
  }
1264
  // update wf_feed if wp_config update ok...
1265
+ if ( $updated && false === $configOnly ) {
1266
  $old_feed = maybe_unserialize(get_option('wf_feed_' . $feed_option_name));
1267
  $feed_data = array(
1268
+ 'feedrules' => $data,
1269
+ 'url' => woo_feed_get_file_url($feed_option_name, $data['provider'], $data['feedType']),
1270
  'last_updated' => date('Y-m-d H:i:s', strtotime(current_time('mysql'))),
1271
+ 'status' => isset($old_feed['status']) && 1 === (int)$old_feed['status'] ? 1 : 0,
1272
  // set old status or disable auto update.
1273
  );
1274
 
1275
  $saved2 = update_option('wf_feed_' . $feed_option_name, maybe_serialize($feed_data), false);
1276
  }
1277
 
1278
+ if ( $update ) {
1279
  /**
1280
  * After Updating Config to db
1281
  *
1297
  return $updated ? $feed_option_name : $updated;
1298
  }
1299
  }
1300
+ if ( ! function_exists('woo_feed_extract_feed_option_name') ) {
1301
  /**
1302
  * Remove Feed Option Name Prefix and return the slug
1303
  *
1305
  *
1306
  * @return string
1307
  */
1308
+ function woo_feed_extract_feed_option_name( $feed_option_name ) {
1309
+ return str_replace([ 'wf_feed_', 'wf_config' ], '', $feed_option_name);
 
1310
  }
1311
  }
1312
+ if ( ! function_exists('woo_feed_get_file_path') ) {
1313
  /**
1314
  * Get File Path for feed or the file upload path for the plugin to use.
1315
  *
1318
  *
1319
  * @return string
1320
  */
1321
+ function woo_feed_get_file_path( $provider = '', $type = '' ) {
 
1322
  $upload_dir = wp_get_upload_dir();
1323
 
1324
  return sprintf('%s/woo-feed/%s/%s/', $upload_dir['basedir'], $provider, $type);
1325
  }
1326
  }
1327
+ if ( ! function_exists('woo_feed_get_file') ) {
1328
  /**
1329
  * Get Feed File URL
1330
  *
1334
  *
1335
  * @return string
1336
  */
1337
+ function woo_feed_get_file( $fileName, $provider, $type ) {
 
1338
  $fileName = woo_feed_extract_feed_option_name($fileName);
1339
  $path = woo_feed_get_file_path($provider, $type);
1340
 
1341
  return sprintf('%s/%s.%s', untrailingslashit($path), $fileName, $type);
1342
  }
1343
  }
1344
+ if ( ! function_exists('woo_feed_get_file_url') ) {
1345
  /**
1346
  * Get Feed File URL
1347
  *
1351
  *
1352
  * @return string
1353
  */
1354
+ function woo_feed_get_file_url( $fileName, $provider, $type ) {
 
1355
  $fileName = woo_feed_extract_feed_option_name($fileName);
1356
  $upload_dir = wp_get_upload_dir();
1357
 
1363
  $type));
1364
  }
1365
  }
1366
+ if ( ! function_exists('woo_feed_check_feed_file') ) {
1367
  /**
1368
  * Check if feed file exists
1369
  *
1373
  *
1374
  * @return bool
1375
  */
1376
+ function woo_feed_check_feed_file( $fileName, $provider, $type ) {
 
1377
  $upload_dir = wp_get_upload_dir();
1378
 
1379
  return file_exists(sprintf('%s/woo-feed/%s/%s/%s.%s',
1384
  $type));
1385
  }
1386
  }
1387
+ if ( ! function_exists('woo_feed_get_file_dir') ) {
1388
  /**
1389
  * Get Feed Directory
1390
  *
1393
  *
1394
  * @return string
1395
  */
1396
+ function woo_feed_get_file_dir( $provider, $feedType ) {
 
1397
  $upload_dir = wp_get_upload_dir();
1398
 
1399
  return sprintf('%s/woo-feed/%s/%s', $upload_dir['basedir'], $provider, $feedType);
1400
  }
1401
  }
1402
+ if ( ! function_exists('woo_feed_save_batch_feed_info') ) {
1403
  /**
1404
  * Save Feed Batch Chunk
1405
  *
1411
  *
1412
  * @return bool
1413
  */
1414
+ function woo_feed_save_batch_feed_info( $feedService, $type, $string, $fileName, $info ) {
 
1415
  $ext = $type;
1416
+ if ( 'csv' === $type || 'tsv' === $type || 'xls' === $type || 'json' === $type ) {
1417
  $string = wp_json_encode($string);
1418
  $ext = 'json';
1419
  }
1422
  $file = $path . '/' . $fileName . '.' . $ext;
1423
  $save = new Woo_Feed_Savefile();
1424
  $status = $save->saveFile($path, $file, $string);
1425
+ if ( woo_feed_is_debugging_enabled() ) {
1426
+ if ( $status ) {
1427
  $message = sprintf('Batch chunk file (%s) saved.', $fileName);
1428
  } else {
1429
  $message = sprintf('Unable to save batch chunk file %s.', $fileName);
1434
  return $status;
1435
  }
1436
  }
1437
+ if ( ! function_exists('woo_feed_get_batch_feed_info') ) {
1438
  /**
1439
  * @param string $feedService
1440
  * @param string $type
1442
  *
1443
  * @return bool|array|string
1444
  */
1445
+ function woo_feed_get_batch_feed_info( $feedService, $type, $fileName ) {
 
1446
  $ext = $type;
1447
+ if ( 'csv' === $type || 'tsv' === $type || 'xls' === $type || 'json' === $type ) {
1448
  $ext = 'json';
1449
  }
1450
  // Save File
1451
  $path = woo_feed_get_file_dir($feedService, $type);
1452
  $file = $path . '/' . $fileName . '.' . $ext;
1453
+ if ( ! file_exists($file) ) {
1454
  return false;
1455
  }
1456
 
1457
  $data = file_get_contents($file); // phpcs:ignore
1458
 
1459
+ if ( 'csv' === $type || 'tsv' === $type || 'xls' === $type || 'json' === $type ) {
1460
  $data = ($data) ? json_decode($data, true) : false;
1461
  }
1462
 
1463
  return $data;
1464
  }
1465
  }
1466
+ if ( ! function_exists('woo_feed_unlink_tempFiles') ) {
1467
  /**
1468
  * Remove temporary feed files
1469
  *
1472
  *
1473
  * @return void
1474
  */
1475
+ function woo_feed_unlink_tempFiles( $config, $fileName ) {
 
1476
  $type = $config['feedType'];
1477
  $ext = $type;
1478
  $path = woo_feed_get_file_dir($config['provider'], $type);
1479
 
1480
+ if ( 'csv' === $type || 'tsv' === $type || 'xls' === $type ) {
1481
  $ext = 'json';
1482
  }
1483
  $files = [
1484
  'headerFile' => $path . '/' . 'wf_store_feed_header_info_' . $fileName . '.' . $ext,
1485
+ 'bodyFile' => $path . '/' . 'wf_store_feed_body_info_' . $fileName . '.' . $ext,
1486
  'footerFile' => $path . '/' . 'wf_store_feed_footer_info_' . $fileName . '.' . $ext,
1487
  ];
1488
 
1489
  woo_feed_log_feed_process($config['filename'], sprintf('Deleting Temporary Files (%s).', implode(', ', array_values($files))));
1490
+ foreach ( $files as $key => $file ) {
1491
+ if ( file_exists($file) ) {
1492
  unlink($file); // phpcs:ignore
1493
  }
1494
  }
1495
  }
1496
  }
1497
+ if ( ! function_exists('woo_feed_delete_feed') ) {
1498
  /**
1499
  * Delete feed option and the file from uploads directory
1500
  *
1502
  *
1503
  * @return bool
1504
  */
1505
+ function woo_feed_delete_feed( $feed_id ) {
 
1506
  global $wpdb;
1507
+ if ( ! is_numeric($feed_id) ) {
1508
  $feed_name = woo_feed_extract_feed_option_name($feed_id);
1509
  } else {
1510
  $feed_data = $wpdb->get_row($wpdb->prepare("SELECT option_name FROM $wpdb->options WHERE option_id = %d", $feed_id)); // phpcs:ignore
1512
  $feed_name = woo_feed_extract_feed_option_name($feed_data->option_name);
1513
  }
1514
  $feedInfo = maybe_unserialize(get_option('wf_feed_' . $feed_name));
1515
+ if ( false !== $feedInfo ) {
1516
  $feedInfo = $feedInfo['feedrules'];
1517
  } else {
1518
  $feedInfo = maybe_unserialize(get_option('wf_config' . $feed_name));
1521
  $file = woo_feed_get_file($feed_name, $feedInfo['provider'], $feedInfo['feedType']);
1522
  // delete any leftover
1523
  woo_feed_unlink_tempFiles($feedInfo, $feed_name);
1524
+ if ( file_exists($file) ) {
1525
  // file exists in upload directory
1526
  if (unlink($file)) { // phpcs:ignore
1527
  delete_option('wf_feed_' . $feed_name);
1536
 
1537
  // Delete cron schedule.
1538
  $feed_cron_param = 'wf_config' . $feed_name;
1539
+ wp_clear_scheduled_hook('woo_feed_update_single_feed', [ $feed_cron_param ]);
1540
 
1541
  return $deleted;
1542
  }
1543
  }
1544
 
1545
  // Mics..
1546
+ if ( ! function_exists('woo_feed_remove_query_args') ) {
1547
  /**
1548
  * Add more items to the removable query args array...
1549
  *
1551
  *
1552
  * @return array
1553
  */
1554
+ function woo_feed_remove_query_args( $removable_query_args ) {
 
1555
  global $plugin_page;
1556
+ if ( strpos($plugin_page, 'webappick') !== false ) {
1557
  $removable_query_args[] = 'feed_created';
1558
  $removable_query_args[] = 'feed_updated';
1559
  $removable_query_args[] = 'feed_imported';
1573
 
1574
  add_filter('removable_query_args', 'woo_feed_remove_query_args', 10, 1);
1575
  }
1576
+ if ( ! function_exists('woo_feed_usort_reorder') ) {
1577
  /**
1578
  * This checks for sorting input and sorts the data in our array accordingly.
1579
  *
1588
  *
1589
  * @return bool
1590
  */
1591
+ function woo_feed_usort_reorder( $a, $b ) {
 
1592
  // If no sort, default to title
1593
+ $orderby = ( ! empty($_REQUEST['orderby'])) ? sanitize_text_field(wp_unslash($_REQUEST['orderby'])) : 'option_name'; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
1594
  // If no order, default to asc
1595
+ $order = ( ! empty($_REQUEST['order'])) ? sanitize_text_field(wp_unslash($_REQUEST['order'])) : 'asc'; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
1596
+ $result = strcmp($a[ $orderby ], $b[ $orderby ]); // Determine sort order
1597
 
1598
  return ('asc' === $order) ? $result : -$result; // Send final sort direction to usort
1599
  }
1600
  }
1601
+ if ( ! function_exists('str_replace_trim') ) {
1602
  /**
1603
  * str_replace() wrapper with trim()
1604
  *
1615
  *
1616
  * @return array|string
1617
  */
1618
+ function str_replace_trim( $search, $replace, $subject, $charlist = " \t\n\r\0\x0B" ) {
 
1619
  $replaced = str_replace($search, $replace, $subject);
1620
+ if ( is_array($replaced) ) {
1621
  return array_map(
1622
+ function ( $item ) use ( $charlist ) {
1623
  return trim($item, $charlist);
1624
  },
1625
  $replaced
1630
  }
1631
  }
1632
 
1633
+ if ( ! function_exists( 'woo_feed_strip_all_tags' ) ) {
1634
 
1635
  /*
1636
  * Extends wp_strip_all_tags to fix WP_Error object passing issue
1640
  * @return string
1641
  * @since 4.4.19
1642
  * */
1643
+ function woo_feed_strip_all_tags( $string ) {
 
1644
 
1645
+ if ( $string instanceof WP_Error ) {
1646
  return '';
1647
  }
1648
 
1649
  return wp_strip_all_tags( $string );
1650
 
1651
  }
 
1652
  }
1653
 
1654
+ if ( ! function_exists('woo_feed_export_config') ) {
1655
  /**
1656
  * Handle config export request
1657
  *
1658
  * @return void
1659
  * @since 3.3.10
1660
  */
1661
+ function woo_feed_export_config() {
1662
+ if ( isset($_REQUEST['feed'], $_REQUEST['_wpnonce']) && wp_verify_nonce(sanitize_text_field(wp_unslash($_REQUEST['_wpnonce'])), 'wpf-export') ) {
 
1663
  $feed = sanitize_text_field(wp_unslash($_REQUEST['feed']));
1664
  $feed = woo_feed_extract_feed_option_name($feed);
1665
+ if ( ! empty($feed) ) {
1666
  $feed = maybe_unserialize(get_option('wf_feed_' . $feed));
1667
  $feed = (isset($feed['feedrules']) && is_array($feed['feedrules'])) ? $feed['feedrules'] : [];
1668
  }
1669
+ if ( ! is_array($feed) ) {
1670
+ wp_die(esc_html__('Invalid Request', 'woo-feed'), esc_html__('Invalid Request', 'woo-feed'), [ 'back_link' => true ]);
1671
  }
1672
  $file_name = sprintf(
1673
  '%s-%s-%s.wpf',
1677
  );
1678
  $feed = wp_json_encode($feed);
1679
  $meta = wp_json_encode([
1680
+ 'version' => WOO_FEED_FREE_VERSION,
1681
  'file_name' => $file_name,
1682
+ 'hash' => md5($feed),
1683
  ]);
1684
  $bin = pack('VA*VA*', strlen($meta), $meta, strlen($feed), $feed);
1685
  $feed = gzdeflate($bin, 9);
1686
  // Let set the header...
1687
+ if ( ! headers_sent() ) {
1688
  status_header(200);
1689
  header('Content-Type: application/octet-stream;');
1690
  header('Content-disposition: attachment; filename=' . $file_name);
1698
  wp_die(
1699
  esc_html__('Invalid Request', 'woo-feed'),
1700
  esc_html__('Invalid Request', 'woo-feed'),
1701
+ [ 'back_link' => true ]
1702
  );
1703
  }
1704
  }
1705
  }
1706
+ if ( ! function_exists('woo_feed_import_config') ) {
1707
  /**
1708
  * Handle config import request
1709
  *
1710
  * @return void
1711
  * @since 3.3.10
1712
  */
1713
+ function woo_feed_import_config() {
 
1714
  check_admin_referer('wpf_import');
1715
 
1716
  if (
1724
  ) {
1725
  $file_name = sanitize_text_field(wp_unslash($_FILES['wpf_import_file']['name']));
1726
  $data = file_get_contents(sanitize_text_field(wp_unslash($_FILES['wpf_import_file']['tmp_name'])));
1727
+ if ( empty($data) ) {
1728
  wp_die(
1729
  esc_html__('Empty File Uploaded. Try again.', 'woo-feed'),
1730
  esc_html__('Empty File', 'woo-feed'),
1731
  [
1732
+ 'link_url' => esc_url(admin_url('admin.php?page=webappick-manage-feeds')),
1733
  'link_text' => esc_html__('&laquo; Back', 'woo-feed'),
1734
  ]
1735
  );
1736
  }
1737
  $feed = gzinflate($data);
1738
+ if ( false === $feed ) {
1739
  wp_die(
1740
  esc_html__('Unable to read file content', 'woo-feed'),
1741
  esc_html__('Invalid File', 'woo-feed'),
1742
  [
1743
+ 'link_url' => esc_url(admin_url('admin.php?page=webappick-manage-feeds')),
1744
  'link_text' => esc_html__('&laquo; Back', 'woo-feed'),
1745
  ]
1746
  );
1747
  }
1748
  // unpack meta data.
1749
  $meta_length = unpack('V', $feed);
1750
+ if ( false === $meta_length ) {
1751
  wp_die(
1752
  esc_html__('Unable to read data from file.', 'woo-feed'),
1753
  esc_html__('Invalid File', 'woo-feed'),
1754
  [
1755
+ 'link_url' => esc_url(admin_url('admin.php?page=webappick-manage-feeds')),
1756
  'link_text' => esc_html__('&laquo; Back', 'woo-feed'),
1757
  ]
1758
  );
1759
  }
1760
  $meta = unpack('A*', substr($feed, 4, $meta_length[1]))[1];
1761
+ if ( false === $meta || 0 !== strpos($meta, '{') ) {
1762
  wp_die(
1763
  esc_html__('Unable to read file info.', 'woo-feed'),
1764
  esc_html__('Invalid File', 'woo-feed'),
1765
  [
1766
+ 'link_url' => esc_url(admin_url('admin.php?page=webappick-manage-feeds')),
1767
  'link_text' => esc_html__('&laquo; Back', 'woo-feed'),
1768
  ]
1769
  );
1772
  // unpack feed data.
1773
  $feed = substr($feed, $meta_length[1] + 8); // 4 bytes for each V (length data)
1774
  $feed = unpack('A*', $feed)[1];
1775
+ if ( false === $feed || 0 !== strpos($feed, '{') ) {
1776
  wp_die(
1777
  esc_html__('Unable to read feed data from file.', 'woo-feed'),
1778
  esc_html__('Invalid File', 'woo-feed'),
1779
  [
1780
+ 'link_url' => esc_url(admin_url('admin.php?page=webappick-manage-feeds')),
1781
  'link_text' => esc_html__('&laquo; Back', 'woo-feed'),
1782
  ]
1783
  );
1784
  }
1785
+ if ( md5($feed) !== $meta['hash'] ) {
1786
  wp_die(
1787
  esc_html__('Unable to verify the file.', 'woo-feed'),
1788
  esc_html__('Invalid File', 'woo-feed'),
1789
  [
1790
+ 'link_url' => esc_url(admin_url('admin.php?page=webappick-manage-feeds')),
1791
  'link_text' => esc_html__('&laquo; Back', 'woo-feed'),
1792
  ]
1793
  );
1794
  }
1795
 
1796
  $feed = json_decode($feed, true);
1797
+ if ( ! is_array($feed) ) {
1798
  wp_die(
1799
  esc_html__('Invalid or corrupted config file.', 'woo-feed'),
1800
  esc_html__('Invalid File', 'woo-feed'),
1801
  [
1802
+ 'link_url' => esc_url(admin_url('admin.php?page=webappick-manage-feeds')),
1803
  'link_text' => esc_html__('&laquo; Back', 'woo-feed'),
1804
  ]
1805
  );
1808
  $feed = woo_feed_parse_feed_rules($feed);
1809
  $new_name = sanitize_text_field(wp_unslash($_POST['wpf_import_feed_name']));
1810
  $new_name = trim($new_name);
1811
+ if ( ! empty($new_name) ) {
1812
  $opt_name = $new_name;
1813
  $feed['filename'] = $new_name;
1814
  } else {
1815
  $opt_name = $feed['filename'];
1816
+ $feed['filename'] = str_replace_trim([ '-', '_' ], ' ', $feed['filename']);
1817
  $feed['filename'] = sprintf(
1818
  '%s: %s',
1819
  esc_html__(' Imported', 'woo-feed'),
1830
  wp_safe_redirect(
1831
  add_query_arg(
1832
  [
1833
+ 'feed_imported' => (int)false !== $fileName,
1834
  'feed_regenerate' => 1,
1835
+ 'feed_name' => $fileName ? $fileName : '',
1836
  ],
1837
  esc_url(admin_url('admin.php?page=webappick-manage-feeds'))
1838
  )
1843
  esc_html__('Invalid Request.', 'woo-feed'),
1844
  esc_html__('Invalid Request', 'woo-feed'),
1845
  [
1846
+ 'link_url' => esc_url(admin_url('admin.php?page=webappick-manage-feeds')),
1847
  'link_text' => esc_html__('&laquo; Back', 'woo-feed'),
1848
  ]
1849
  );
1850
  }
1851
  }
1852
 
1853
+ if ( ! function_exists('woo_feed_download_feed_log') ) {
1854
 
1855
  /**
1856
  * Handle latest log download request
1858
  * @return void
1859
  * @since 4.4.15
1860
  */
1861
+ function woo_feed_download_feed_log() {
 
1862
  if (
1863
  isset( $_REQUEST['feed'], $_REQUEST['_wpnonce'] )
1864
  && wp_verify_nonce( sanitize_text_field( wp_unslash( $_REQUEST['_wpnonce'] ) ), 'wpf-log-download')
1867
  $feed_name = str_replace( 'wf_feed_', '', $feed_name );
1868
  $log_file_path = Woo_Feed_Log_Handler_File::get_log_file_path( $feed_name );
1869
 
1870
+ if ( $log_file_path && file_exists( $log_file_path ) ) {
1871
  $log_data = file_get_contents( $log_file_path );
1872
  } else {
1873
  $log_data = 'No log is generated.';
1874
  }
1875
 
1876
+ if ( ! empty($feed_name) ) {
1877
  $feed_details = maybe_unserialize(get_option('wf_feed_' . $feed_name));
1878
  $feed_details = (isset($feed['feedrules']) && is_array($feed['feedrules'])) ? $feed['feedrules'] : [];
1879
  }
1880
 
1881
+ if ( ! is_array($feed_details) ) {
1882
+ wp_die(esc_html__('Invalid Request', 'woo-feed'), esc_html__('Invalid Request', 'woo-feed'), [ 'back_link' => true ]);
1883
  }
1884
 
1885
  $file_name = sprintf(
1890
  );
1891
 
1892
  // Let set the header...
1893
+ if ( ! headers_sent() ) {
1894
  status_header(200);
1895
  header('Content-Type: application/octet-stream;');
1896
  header('Content-disposition: attachment; filename=' . $file_name);
1905
  wp_die(
1906
  esc_html__('Invalid Request', 'woo-feed'),
1907
  esc_html__('Invalid Request', 'woo-feed'),
1908
+ [ 'back_link' => true ]
1909
  );
1910
  }
1911
  }
1912
  }
1913
 
1914
  // Feed Functions.
1915
+ if ( ! function_exists('woo_feed_generate_feed') ) {
1916
  /**
1917
  * Update Feed Information
1918
  *
1921
  *
1922
  * @return string|bool
1923
  */
1924
+ function woo_feed_generate_feed( $info, $feed_option_name ) {
1925
+ if ( false === $info || empty($info) ) {
 
1926
  return false;
1927
  }
1928
  // parse rules.
1929
  $info = woo_feed_parse_feed_rules(isset($info['feedrules']) ? $info['feedrules'] : $info);
1930
  $feed_option_name = woo_feed_extract_feed_option_name($feed_option_name);
1931
+ if ( ! empty($info['provider']) ) {
1932
  do_action('before_woo_feed_generate_feed', $info);
1933
 
1934
  // Generate Feed Data
1935
  $products = new Woo_Generate_Feed($info['provider'], $info);
1936
  $getString = $products->getProducts();
1937
+ if ( 'csv' == $info['feedType'] || 'tsv' == $info['feedType'] || 'xls' == $info['feedType'] ) {
1938
  $csvHead[0] = $getString['header'];
1939
+ if ( ! empty($csvHead) && ! empty($getString['body']) ) {
1940
  $string = array_merge($csvHead, $getString['body']);
1941
  } else {
1942
  $string = array();
1943
  }
1944
  } else {
1945
+ if ( 'json' == $info['feedType'] ) {
1946
  $string = array();
1947
  } else {
1948
  $string = $getString['header'] . $getString['body'] . $getString['footer'];
1951
 
1952
  $saveFile = false;
1953
  // Check If any products founds
1954
+ if ( $string && ! empty($string) ) {
1955
  // Save File
1956
  $path = woo_feed_get_file_path($info['provider'], $info['feedType']);
1957
  $file = woo_feed_get_file($feed_option_name, $info['provider'], $info['feedType']);
1958
  $save = new Woo_Feed_Savefile();
1959
+ if ( 'csv' == $info['feedType'] || 'tsv' == $info['feedType'] || 'xls' == $info['feedType'] || 'json' == $info['feedType'] ) {
1960
  $saveFile = $save->saveValueFile($path, $file, $string, $info, $info['feedType']);
1961
  } else {
1962
  $saveFile = $save->saveFile($path, $file, $string);
1963
  }
1964
 
1965
  // Upload file to ftp server
1966
+ if ( 1 == (int)$info['ftpenabled'] ) {
1967
  woo_feed_handle_file_transfer($file, $feed_option_name . '.' . $info['feedType'], $info);
1968
  }
1969
  }
1970
  $feed_URL = woo_feed_get_file_url($feed_option_name, $info['provider'], $info['feedType']);
1971
  // Save Info into database
1972
  $feedInfo = array(
1973
+ 'feedrules' => $info,
1974
+ 'url' => $feed_URL,
1975
  'last_updated' => date('Y-m-d H:i:s', strtotime(current_time('mysql'))),
1976
+ 'status' => 1,
1977
  );
1978
  update_option('wf_feed_' . $feed_option_name, serialize($feedInfo), false); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.serialize_serialize
1979
  do_action('after_woo_feed_generate_feed', $info);
1980
+ if ( $saveFile ) {
1981
  return $feed_URL;
1982
  } else {
1983
  return false;
1988
  }
1989
  }
1990
 
1991
+ if ( ! function_exists('woo_feed_get_schedule_interval_options') ) {
1992
  /**
1993
  * Get Schedule Intervals
1994
  * @return mixed
1995
  */
1996
+ function woo_feed_get_schedule_interval_options() {
 
1997
  return apply_filters(
1998
  'woo_feed_schedule_interval_options',
1999
  [
2000
+ WEEK_IN_SECONDS => esc_html__('1 Week', 'woo-feed'),
2001
+ DAY_IN_SECONDS => esc_html__('24 Hours', 'woo-feed'),
2002
  12 * HOUR_IN_SECONDS => esc_html__('12 Hours', 'woo-feed'),
2003
+ 6 * HOUR_IN_SECONDS => esc_html__('6 Hours', 'woo-feed'),
2004
+ HOUR_IN_SECONDS => esc_html__('1 Hours', 'woo-feed'),
2005
  ]
2006
  );
2007
  }
2008
  }
2009
+ if ( ! function_exists('woo_feed_get_minimum_interval_option') ) {
2010
+ function woo_feed_get_minimum_interval_option() {
 
2011
  $intervals = array_keys(woo_feed_get_schedule_interval_options());
2012
+ if ( ! empty($intervals) ) {
2013
  return end($intervals);
2014
  }
2015
 
2016
  return 15 * MINUTE_IN_SECONDS;
2017
  }
2018
  }
2019
+ if ( ! function_exists('woo_feed_stripInvalidXml') ) {
2020
  /**
2021
  * Remove non supported xml character
2022
  *
2024
  *
2025
  * @return string
2026
  */
2027
+ function woo_feed_stripInvalidXml( $value ) {
 
2028
  $ret = '';
2029
+ if ( empty($value) ) {
2030
  return $ret;
2031
  }
2032
  $length = strlen($value);
2033
+ for ( $i = 0; $i < $length; $i++ ) {
2034
+ $current = ord($value[ $i ]);
2035
+ if ( (0x9 == $current) || (0xA == $current) || (0xD == $current) || (($current >= 0x20) && ($current <= 0xD7FF)) || (($current >= 0xE000) && ($current <= 0xFFFD)) || (($current >= 0x10000) && ($current <= 0x10FFFF)) ) {
2036
  $ret .= chr($current);
2037
  } else {
2038
  $ret .= '';
2042
  return $ret;
2043
  }
2044
  }
2045
+ if ( ! function_exists('woo_feed_get_formatted_url') ) {
2046
  /**
2047
  * Get Formatted URL
2048
  *
2050
  *
2051
  * @return string
2052
  */
2053
+ function woo_feed_get_formatted_url( $url = '' ) {
2054
+ if ( ! empty($url) ) {
2055
+ if ( substr(trim($url), 0, 4) === 'http' || substr(trim($url),
 
2056
  0,
2057
+ 3) === 'ftp' || substr(trim($url), 0, 4) === 'sftp' ) {
2058
  return rtrim($url, '/');
2059
  } else {
2060
  $base = get_site_url();
2067
  return '';
2068
  }
2069
  }
2070
+ if ( ! function_exists('array_value_first') ) {
2071
  /**
2072
  * Get First Value of an array
2073
  *
2076
  * @return mixed|null
2077
  * @since 3.0.0
2078
  */
2079
+ function array_value_first( array $arr ) {
2080
+ foreach ( $arr as $key => $unused ) {
 
2081
  return $unused;
2082
  }
2083
 
2084
  return null;
2085
  }
2086
  }
2087
+ if ( ! function_exists('woo_feed_make_url_with_parameter') ) {
2088
  /**
2089
  * Make proper URL using parameters
2090
  *
2093
  *
2094
  * @return string
2095
  */
2096
+ function woo_feed_make_url_with_parameter( $output = '', $suffix = '' ) {
2097
+ if ( empty($output) || empty($suffix) ) {
 
2098
  return $output;
2099
  }
2100
 
2101
  $getParam = explode('?', $output);
2102
  $URLParam = array();
2103
+ if ( isset($getParam[1]) ) {
2104
  $URLParam = woo_feed_parse_string($getParam[1]);
2105
  }
2106
 
2107
  $EXTRAParam = array();
2108
+ if ( ! empty($suffix) ) {
2109
  $suffix = str_replace('?', '', $suffix);
2110
  $EXTRAParam = woo_feed_parse_string($suffix);
2111
  }
2112
 
2113
  $params = array_merge($URLParam, $EXTRAParam);
2114
+ if ( ! empty($params) && '' != $output ) {
2115
  $params = http_build_query($params);
2116
  $baseURL = isset($getParam) ? $getParam[0] : $output;
2117
  $output = $baseURL . '?' . $params;
2120
  return $output;
2121
  }
2122
  }
2123
+ if ( ! function_exists('woo_feed_parse_string') ) {
2124
  /**
2125
  * Parse URL parameter
2126
  *
2128
  *
2129
  * @return array
2130
  */
2131
+ function woo_feed_parse_string( $str = '' ) {
 
2132
 
2133
  // result array
2134
  $arr = array();
2135
 
2136
+ if ( empty($str) ) {
2137
  return $arr;
2138
  }
2139
 
2140
  // split on outer delimiter
2141
  $pairs = explode('&', $str);
2142
 
2143
+ if ( ! empty($pairs) && is_array($pairs) ) {
2144
 
2145
  // loop through each pair
2146
+ foreach ( $pairs as $i ) {
2147
  // split into name and value
2148
  list($name, $value) = explode('=', $i, 2);
2149
 
2150
  // if name already exists
2151
+ if ( isset($arr[ $name ]) ) {
2152
  // stick multiple values into an array
2153
+ if ( is_array($arr[ $name ]) ) {
2154
+ $arr[ $name ][] = $value;
2155
  } else {
2156
+ $arr[ $name ] = array( $arr[ $name ], $value );
2157
  }
2158
  } // otherwise, simply stick it in a scalar
2159
  else {
2160
+ $arr[ $name ] = $value;
2161
  }
2162
  }
2163
+ } elseif ( ! empty($str) ) {
2164
  list($name, $value) = explode('=', $str, 2);
2165
+ $arr[ $name ] = $value;
2166
  }
2167
 
2168
  // return result array
2169
  return $arr;
2170
  }
2171
  }
2172
+ if ( ! function_exists('woo_feed_replace_to_merchant_attribute') ) {
2173
  /**
2174
  * Parse URL parameter
2175
  *
2179
  *
2180
  * @return string
2181
  */
2182
+ function woo_feed_replace_to_merchant_attribute( $pluginAttribute, $merchant, $feedType ) {
 
2183
  $attributeClass = new Woo_Feed_Default_Attributes();
2184
  $merchantAttributes = '';
2185
+ if ( 'google' === $merchant
2186
  || 'google_shopping_action' === $merchant
2187
  || 'google_local' === $merchant
2188
  || 'google_local_inventory' === $merchant
2189
  || 'adroll' == $merchant
2190
+ || 'smartly.io' == $merchant ) {
2191
+ if ( 'xml' === $feedType ) {
2192
  $g_attributes = $attributeClass->googleXMLAttribute;
2193
+ if ( 'google_local' === $merchant ) {
2194
  unset($g_attributes['description']);
2195
  }
2196
  $merchantAttributes = $g_attributes;
2197
+ } elseif ( 'csv' == $feedType || 'txt' == $feedType ) {
2198
  $merchantAttributes = $attributeClass->googleCSVTXTAttribute;
2199
  }
2200
+ } elseif ( 'facebook' == $merchant ) {
2201
+ if ( 'xml' == $feedType ) {
2202
  $merchantAttributes = $attributeClass->facebookXMLAttribute;
2203
+ } elseif ( 'csv' == $feedType || 'txt' == $feedType ) {
2204
  $merchantAttributes = $attributeClass->facebookCSVTXTAttribute;
2205
  }
2206
+ } elseif ( 'pinterest' == $merchant ) {
2207
+ if ( 'xml' == $feedType ) {
2208
  $merchantAttributes = $attributeClass->pinterestXMLAttribute;
2209
+ } elseif ( 'csv' == $feedType || 'txt' == $feedType ) {
2210
  $merchantAttributes = $attributeClass->pinterestCSVTXTAttribute;
2211
  }
2212
+ } elseif ( 'skroutz' == $merchant ) {
2213
+ if ( 'xml' == $feedType ) {
2214
  $merchantAttributes = $attributeClass->skroutzXMLAttributes;
2215
  }
2216
  }
2217
 
2218
+ if ( ! empty($merchantAttributes) && array_key_exists($pluginAttribute, $merchantAttributes) ) {
2219
+ return $merchantAttributes[ $pluginAttribute ][0];
2220
  }
2221
 
2222
  return $pluginAttribute;
2223
  }
2224
  }
2225
+ if ( ! function_exists('woo_feed_add_cdata') ) {
2226
  /**
2227
  * Parse URL parameter
2228
  *
2233
  *
2234
  * @return string
2235
  */
2236
+ function woo_feed_add_cdata( $pluginAttribute, $attributeValue, $merchant, $feed_type ) {
2237
+ if ( "xml" !== $feed_type ) {
 
2238
  return "$attributeValue";
2239
  }
2240
 
2241
+ if ( 'custom' === $merchant ) {
2242
  return "$attributeValue";
2243
  }
2244
 
2245
+ if ( "shipping" === $pluginAttribute || "tax" === $pluginAttribute ) {
2246
  return "$attributeValue";
2247
  }
2248
 
2249
+ if ( strpos($attributeValue, '<![CDATA[') !== false ) {
2250
  return "$attributeValue";
2251
  }
2252
 
2253
  $attributeClass = new Woo_Feed_Default_Attributes();
2254
  $merchantAttributes = '';
2255
+ if ( 'google' == $merchant ) {
2256
  $merchantAttributes = $attributeClass->googleXMLAttribute;
2257
+ } elseif ( 'facebook' == $merchant ) {
2258
  $merchantAttributes = $attributeClass->facebookXMLAttribute;
2259
+ } elseif ( 'pinterest' == $merchant ) {
2260
  $merchantAttributes = $attributeClass->pinterestXMLAttribute;
2261
+ } elseif ( 'skroutz' == $merchant ) {
2262
  $merchantAttributes = $attributeClass->skroutzXMLAttributes;
2263
  }
2264
 
2265
+ if ( ! empty($merchantAttributes) && array_key_exists($pluginAttribute, $merchantAttributes) ) {
2266
+ if ( 'true' == $merchantAttributes[ $pluginAttribute ][1] ) {
2267
  return "<![CDATA[$attributeValue]]>";
2268
  } else {
2269
  return "$attributeValue";
2270
  }
2271
+ } elseif ( false !== strpos($attributeValue, '&') || 'http' == substr(trim($attributeValue), 0, 4) ) {
2272
+ if ( 'catch.com.au' === $merchant ) {
2273
+ if ( false !== strpos($pluginAttribute, 'image') ) {
2274
  return "$attributeValue";
2275
  }
2276
  } else {
2283
  }
2284
 
2285
  // WooFeed Settings API
2286
+ if ( ! function_exists('woo_feed_get_options') ) {
2287
  /**
2288
  * Get saved settings.
2289
  *
2295
  * @return array|bool|string|mixed
2296
  * @since 3.3.11
2297
  */
2298
+ function woo_feed_get_options( $key, $default = false ) {
 
2299
  $defaults = [
2300
+ 'per_batch' => 200,
2301
+ 'product_query_type' => 'wc',
2302
+ 'variation_query_type' => 'individual',
2303
+ 'enable_error_debugging' => 'off',
2304
+ 'cache_ttl' => 6 * HOUR_IN_SECONDS,
2305
  'overridden_structured_data' => 'off',
2306
+ 'disable_mpn' => 'enable',
2307
+ 'disable_brand' => 'enable',
2308
+ 'disable_pixel' => 'enable',
2309
+ 'pixel_id' => '',
2310
+ 'disable_remarketing' => 'disable',
2311
+ 'remarketing_id' => '',
2312
+ 'remarketing_label' => '',
2313
+ 'allow_all_shipping' => 'no',
2314
+ 'only_free_shipping' => 'yes',
2315
  'only_local_pickup_shipping' => 'no',
2316
+ 'enable_ftp_upload' => 'no',
2317
+ 'woo_feed_taxonomy' => array(
2318
+ 'brand' => 'disable',
2319
  ),
2320
+ 'woo_feed_identifier' => array(
2321
+ 'gtin' => 'disable',
2322
+ 'ean' => 'disable',
2323
+ 'mpn' => 'disable',
2324
+ 'isbn' => 'disable',
2325
+ 'age_group' => 'disable',
2326
+ 'material' => 'disable',
2327
+ 'gender' => 'disable',
2328
+ 'cost_of_good_sold' => 'disable',
2329
+ 'availability_date' => 'enable',
2330
+ 'unit' => 'disable',
2331
+ 'unit_pricing_measure' => 'disable',
2332
  'unit_pricing_base_measure' => 'disable',
2333
+ 'custom_field_0' => 'disable',
2334
+ 'custom_field_1' => 'disable',
2335
+ 'custom_field_2' => 'disable',
2336
+ 'custom_field_3' => 'disable',
2337
+ 'custom_field_4' => 'disable',
2338
  ),
2339
  ];
2340
 
2347
  */
2348
  $defaults = wp_parse_args(apply_filters('woo_feed_settings_extra_defaults', []), $defaults);
2349
 
2350
+ if ( 'defaults' === $key ) {
2351
  return $defaults;
2352
  }
2353
 
2354
  $settings = wp_parse_args(get_option('woo_feed_settings', []), $defaults);
2355
 
2356
+ if ( 'all' === $key ) {
2357
  return $settings;
2358
  }
2359
 
2360
+ if ( array_key_exists($key, $settings) ) {
2361
+ return $settings[ $key ];
2362
  }
2363
 
2364
  return $default;
2365
  }
2366
  }
2367
+ if ( ! function_exists('woo_feed_save_options') ) {
2368
  /**
2369
  * Save Settings.
2370
  *
2373
  * @return bool
2374
  * @since 3.3.11
2375
  */
2376
+ function woo_feed_save_options( $args ) {
 
2377
  $data = woo_feed_get_options('all');
2378
  $defaults = woo_feed_get_options('defaults');
2379
  $_data = $data;
2380
 
2381
+ if ( array_key_exists('per_batch', $args) ) {
2382
  $data['per_batch'] = absint($args['per_batch']);
2383
+ if ( $data['per_batch'] <= 0 ) {
2384
  $data['per_batch'] = $_data['per_batch'] > 0 ? $_data['per_batch'] : $defaults['per_batch'];
2385
  }
2386
  unset($args['unset']);
2387
  }
2388
+ if ( array_key_exists('product_query_type', $args) ) {
2389
  $data['product_query_type'] = strtolower($args['product_query_type']);
2390
  $query_types = array_keys(woo_feed_get_query_type_options());
2391
+ if ( ! in_array($data['product_query_type'], $query_types) ) {
2392
  $data['product_query_type'] = in_array($_data['product_query_type'], $query_types) ? $_data['product_query_type'] : $defaults['product_query_type'];
2393
  }
2394
  unset($args['product_query_type']);
2395
  }
2396
+ if ( array_key_exists('variation_query_type', $args) ) {
2397
  $data['variation_query_type'] = strtolower($args['variation_query_type']);
2398
  $query_types = array_keys(woo_feed_get_query_type_options('variation'));
2399
+ if ( ! in_array($data['variation_query_type'], $query_types, true) ) {
2400
  $data['variation_query_type'] = in_array($_data['variation_query_type'], $query_types, true) ? $_data['variation_query_type'] : $defaults['variation_query_type'];
2401
  }
2402
  unset($args['variation_query_type']);
2403
  }
2404
+ if ( array_key_exists('enable_error_debugging', $args) ) {
2405
  $data['enable_error_debugging'] = strtolower($args['enable_error_debugging']);
2406
+ if ( ! in_array($data['enable_error_debugging'], [ 'on', 'off' ]) ) {
2407
+ $data['enable_error_debugging'] = in_array($_data['enable_error_debugging'], [ 'on', 'off' ]) ? $_data['enable_error_debugging'] : $defaults['enable_error_debugging'];
2408
  }
2409
  unset($args['enable_error_debugging']);
2410
  }
2411
+ if ( array_key_exists('cache_ttl', $args) ) {
2412
  $data['cache_ttl'] = absint($args['cache_ttl']); // cache ttl can be zero.
2413
  unset($args['cache_ttl']);
2414
  }
2415
+ if ( array_key_exists('overridden_structured_data', $args) ) {
2416
  $data['overridden_structured_data'] = strtolower($args['overridden_structured_data']);
2417
+ if ( ! in_array($data['overridden_structured_data'], array( 'on', 'off' )) ) {
2418
+ $data['overridden_structured_data'] = in_array($_data['overridden_structured_data'], array( 'on', 'off' )) ? $_data['overridden_structured_data'] : $defaults['overridden_structured_data'];
2419
  }
2420
  unset($args['overridden_structured_data']);
2421
  }
2422
 
2423
+ if ( array_key_exists('disable_pixel', $args) ) {
2424
  $data['disable_pixel'] = strtolower($args['disable_pixel']);
2425
+ if ( ! in_array($data['disable_pixel'], array( 'enable', 'disable' )) ) {
2426
+ $data['disable_pixel'] = in_array($_data['disable_pixel'], array( 'enable', 'disable' )) ? $_data['disable_pixel'] : $defaults['disable_pixel'];
2427
  }
2428
  unset($args['disable_pixel']);
2429
  }
2430
+ if ( array_key_exists('pixel_id', $args) ) {
2431
+ if ( isset($args['pixel_id']) && ! empty($args['pixel_id']) ) {
2432
  $data['pixel_id'] = absint($args['pixel_id']);
2433
  } else {
2434
  $data['pixel_id'] = $defaults['pixel_id'];
2436
  unset($args['pixel_id']);
2437
  }
2438
 
2439
+ if ( array_key_exists('disable_remarketing', $args) ) {
2440
  $data['disable_remarketing'] = strtolower($args['disable_remarketing']);
2441
+ if ( ! in_array($data['disable_remarketing'], array( 'enable', 'disable' )) ) {
2442
+ $data['disable_remarketing'] = in_array($_data['disable_remarketing'], array( 'enable', 'disable' )) ? $_data['disable_remarketing'] : $defaults['disable_remarketing'];
2443
  }
2444
  unset($args['disable_remarketing']);
2445
  }
2446
+ if ( array_key_exists('remarketing_id', $args) ) {
2447
+ if ( isset($args['remarketing_id']) && ! empty($args['remarketing_id']) ) {
2448
  $data['remarketing_id'] = $args['remarketing_id'];
2449
  } else {
2450
  $data['remarketing_id'] = $defaults['remarketing_id'];
2451
  }
2452
  unset($args['remarketing_id']);
2453
  }
2454
+ if ( array_key_exists('remarketing_label', $args) ) {
2455
+ if ( isset($args['remarketing_label']) && ! empty($args['remarketing_label']) ) {
2456
  $data['remarketing_label'] = $args['remarketing_label'];
2457
  } else {
2458
  $data['remarketing_label'] = $defaults['remarketing_label'];
2460
  unset($args['remarketing_label']);
2461
  }
2462
 
2463
+ if ( array_key_exists('allow_all_shipping', $args) ) {
2464
  $data['allow_all_shipping'] = strtolower($args['allow_all_shipping']);
2465
+ if ( ! in_array($data['allow_all_shipping'], array( 'yes', 'no' )) ) {
2466
+ $data['allow_all_shipping'] = in_array($_data['allow_all_shipping'], array( 'yes', 'no' )) ? $_data['allow_all_shipping'] : $defaults['allow_all_shipping'];
2467
  }
2468
  unset($args['allow_all_shipping']);
2469
  }
2470
 
2471
+ if ( array_key_exists('only_free_shipping', $args) ) {
2472
  $data['only_free_shipping'] = strtolower($args['only_free_shipping']);
2473
+ if ( ! in_array($data['only_free_shipping'], array( 'yes', 'no' )) ) {
2474
+ $data['only_free_shipping'] = in_array($_data['only_free_shipping'], array( 'yes', 'no' )) ? $_data['only_free_shipping'] : $defaults['only_free_shipping'];
2475
  }
2476
  unset($args['only_free_shipping']);
2477
  }
2478
 
2479
+ if ( array_key_exists('only_local_pickup_shipping', $args) ) {
2480
  $data['only_local_pickup_shipping'] = strtolower($args['only_local_pickup_shipping']);
2481
+ if ( ! in_array($data['only_local_pickup_shipping'], array( 'yes', 'no' )) ) {
2482
+ $data['only_local_pickup_shipping'] = in_array($_data['only_local_pickup_shipping'], array( 'yes', 'no' )) ? $_data['only_local_pickup_shipping'] : $defaults['only_local_pickup_shipping'];
2483
  }
2484
  unset($args['only_local_pickup_shipping']);
2485
  }
2486
 
2487
 
2488
+ if ( array_key_exists('enable_ftp_upload', $args) ) {
2489
  $data['enable_ftp_upload'] = strtolower($args['enable_ftp_upload']);
2490
+ if ( ! in_array($data['enable_ftp_upload'], array( 'yes', 'no' )) ) {
2491
+ $data['enable_ftp_upload'] = in_array($_data['enable_ftp_upload'], array( 'yes', 'no' )) ? $_data['enable_ftp_upload'] : $defaults['enable_ftp_upload'];
2492
  }
2493
  unset($args['enable_ftp_upload']);
2494
  }
2495
 
2496
+ if ( ! empty($args) ) {
2497
+ foreach ( $args as $key => $value ) {
2498
+ if ( has_filter("woo_feed_save_{$key}_option") ) {
2499
+ $data[ $key ] = apply_filters("woo_feed_save_{$key}_option", sanitize_text_field($value));
2500
  }
2501
  }
2502
  }
2504
  return update_option('woo_feed_settings', $data, false);
2505
  }
2506
  }
2507
+ if ( ! function_exists('woo_feed_reset_options') ) {
2508
  /**
2509
  * Restore the default settings.
2510
  *
2511
  * @return bool
2512
  * @since 3.3.11
2513
  */
2514
+ function woo_feed_reset_options() {
 
2515
  return update_option('woo_feed_settings', woo_feed_get_options('defaults'), false);
2516
  }
2517
  }
2518
 
2519
  // Caching. Wrapper for Transient API.
2520
+ if ( ! function_exists('woo_feed_get_cached_data') ) {
2521
  /**
2522
  * Get Cached Data
2523
  *
2526
  * @return mixed|false false if cache not found.
2527
  * @since 3.3.10
2528
  */
2529
+ function woo_feed_get_cached_data( $key ) {
2530
+ if ( empty($key) ) {
 
2531
  return false;
2532
  }
2533
 
2534
  return get_transient('__woo_feed_cache_' . $key);
2535
  }
2536
  }
2537
+ if ( ! function_exists('woo_feed_set_cache_data') ) {
2538
  /**
2539
  *
2540
  * @param string $key Cache name. Expected to not be SQL-escaped. Must be
2545
  *
2546
  * @return bool
2547
  */
2548
+ function woo_feed_set_cache_data( $key, $data, $expiration = false ) {
 
2549
 
2550
+ if ( empty($key) ) {
2551
  return false;
2552
  }
2553
 
2556
  return set_transient('__woo_feed_cache_' . $key, $data, (int)$expiration);
2557
  }
2558
  }
2559
+ if ( ! function_exists('woo_feed_delete_cache_data') ) {
2560
  /**
2561
  * Delete Cached Data
2562
  * @param string $key cache name.
2563
  *
2564
  * @return bool
2565
  */
2566
+ function woo_feed_delete_cache_data( $key ) {
2567
+ if ( empty($key) ) {
 
2568
  return false;
2569
  }
2570
 
2571
  return delete_transient('__woo_feed_cache_' . $key);
2572
  }
2573
  }
2574
+ if ( ! function_exists('woo_feed_flush_cache_data') ) {
2575
  /**
2576
  * Delete All Cached Data
2577
  *
2578
  * @return void
2579
  */
2580
+ function woo_feed_flush_cache_data() {
 
2581
  global $wpdb;
2582
  // $wpdb->query( "DELETE FROM $wpdb->options WHERE {$wpdb->options}.option_name LIKE '_transient___woo_feed_cache_%' " ); // phpcs:ignore
2583
  // $wpdb->query( "DELETE FROM $wpdb->options WHERE {$wpdb->options}.option_name LIKE '_transient_timeout___woo_feed_cache_%'" ); // phpcs:ignore
2586
  }
2587
 
2588
  // Price And Tax.
2589
+ if ( ! function_exists('woo_feed_apply_tax_location_data') ) {
2590
  /**
2591
  * Filter and Change Location data for tax calculation
2592
  *
2596
  *
2597
  * @return array
2598
  */
2599
+ function woo_feed_apply_tax_location_data( $location, $tax_class, $customer ) {
 
2600
  // @TODO use filter. add tab in feed editor so user can set custom settings.
2601
  // @TODO tab should not list all country and cities. it only list available tax settings and user can just select one.
2602
  // @TODO then it will extract the location data from it to use here.
2614
  * @since 3.3.0
2615
  */
2616
  $tax_location = apply_filters('woo_feed_tax_location_data', $wc_tax_location);
2617
+ if ( ! is_array($tax_location) || (is_array($tax_location) && 4 !== count($tax_location)) ) {
2618
  $tax_location = $wc_tax_location;
2619
  }
2620
 
2623
  }
2624
 
2625
  // Hook feed generating process...
2626
+ if ( ! function_exists('woo_feed_apply_hooks_before_product_loop') ) {
2627
  /**
2628
  * Apply Hooks Before Looping through ProductIds
2629
  *
2630
  * @param int[] $productIds product id array.
2631
  * @param array $feedConfig feed config array.
2632
  */
2633
+ function woo_feed_apply_hooks_before_product_loop( $productIds, $feedConfig ) {
 
2634
  add_filter('woocommerce_get_tax_location', 'woo_feed_apply_tax_location_data', 10, 3);
2635
 
2636
  // RightPress dynamic pricing support.
2640
  }
2641
  }
2642
 
2643
+ if ( ! function_exists('woo_feed_remove_hooks_after_product_loop') ) {
2644
  /**
2645
  * Remove Applied Hooks Looping through ProductIds
2646
  *
2649
  *
2650
  * @see woo_feed_apply_hooks_before_product_loop
2651
  */
2652
+ function woo_feed_remove_hooks_after_product_loop( $productIds, $feedConfig ) {
 
2653
  remove_filter('woocommerce_get_tax_location', 'woo_feed_apply_tax_location_data', 10);
2654
 
2655
  // RightPress dynamic pricing support.
2658
 
2659
  }
2660
  }
2661
+ if ( ! function_exists('woo_feed_remove_hooks_before_product_loop') ) {
2662
  /**
2663
  * Remove Applied Hooks Looping through ProductIds
2664
  *
2667
  *
2668
  * @see woo_feed_apply_hooks_before_product_loop
2669
  */
2670
+ function woo_feed_remove_hooks_before_product_loop( $productIds, $feedConfig ) {
 
2671
  remove_filter('woocommerce_get_tax_location', 'woo_feed_apply_tax_location_data', 10);
2672
  }
2673
  }
2674
 
2675
+ if ( ! function_exists('woo_feed_product_taxonomy_term_separator') ) {
2676
  /**
2677
  * Filter Product local category (type) separator
2678
  *
2681
  *
2682
  * @return string
2683
  */
2684
+ function woo_feed_product_taxonomy_term_separator( $separator, $config ) {
2685
+ if ( 'trovaprezzi' === $config['provider'] ) {
 
2686
  $separator = ',';
2687
  }
2688
 
2689
+ if ( false !== strpos($config['provider'], 'daisycon') ) {
2690
  $separator = '|';
2691
  }
2692
 
2693
  return $separator;
2694
  }
2695
  }
2696
+ if ( ! function_exists('woo_feed_get_availability_attribute_filter') ) {
2697
  /**
2698
  * Filter Product Availability Attribute Output For Template
2699
  *
2703
  *
2704
  * @return int
2705
  */
2706
+ function woo_feed_get_availability_attribute_filter( $output, $product, $config ) {
 
2707
  $status = $product->get_stock_status();
2708
  $provider = $config['provider'];
2709
 
2710
+ if ( 'trovaprezzi' === $provider ) {
2711
  $output = 2;
2712
+ if ( $status ) {
2713
+ if ( 'instock' == $status ) {
2714
  $output = 2;
2715
+ } elseif ( 'outofstock' == $status ) {
2716
  $output = 0;
2717
+ } elseif ( 'onbackorder' == $status ) {
2718
  $output = 1;
2719
  }
2720
  }
2721
  }
2722
 
2723
+ if ( false !== strpos($provider, 'daisycon') ) {
2724
  $output = 'true';
2725
+ if ( $status ) {
2726
+ if ( 'instock' == $status ) {
2727
  $output = 'true';
2728
+ } elseif ( 'outofstock' == $status ) {
2729
  $output = 'false';
2730
+ } elseif ( 'onbackorder' == $status ) {
2731
  $output = 'false';
2732
  }
2733
  }
2738
  }
2739
 
2740
  // Parse feed rules.
2741
+ if ( ! function_exists('woo_feed_filter_parsed_rules') ) {
2742
  /**
2743
  * Filter Feed parsed rules
2744
  *
2748
  * @return array
2749
  * @since 3.3.7
2750
  */
2751
+ function woo_feed_filter_parsed_rules( $rules, $context ) {
 
2752
  $provider = $rules['provider'];
2753
 
2754
+ if ( 'create' === $context ) {
2755
+ if ( 'criteo' === $provider ) {
2756
  $rules['itemsWrapper'] = 'channel';
2757
  $rules['itemWrapper'] = 'item';
2758
  }
2759
 
2760
+ if ( 'wine_searcher' === $provider ) {
2761
  $rules['itemsWrapper'] = 'product-list';
2762
  $rules['itemWrapper'] = 'row';
2763
  $rules['delimiter'] = '|';
2764
  $rules['enclosure'] = ' ';
2765
  }
2766
 
2767
+ if ( 'trovaprezzi' === $provider ) {
2768
  $rules['decimal_separator'] = ',';
2769
  $rules['thousand_separator'] = '';
2770
  $rules['decimals'] = 2;
2774
  $rules['enclosure'] = ' ';
2775
  }
2776
 
2777
+ if ( false !== strpos($provider, 'daisycon') ) {
2778
  $rules['itemsWrapper'] = 'channel';
2779
  $rules['itemWrapper'] = 'item';
2780
  }
2781
 
2782
+ if ( false !== strpos($provider, 'zbozi.cz') ) {
2783
  $rules['itemsWrapper'] = 'SHOP xmlns="http://www.zbozi.cz/ns/offer/1.0"';
2784
  $rules['itemWrapper'] = 'SHOPITEM';
2785
  }
2786
 
2787
+ if ( false !== strpos($provider, 'heureka.sk') ) {
2788
  $rules['itemWrapper'] = 'SHOPITEM';
2789
  }
2790
  }
2793
  }
2794
  }
2795
 
2796
+ if ( ! function_exists('array_splice_preserve_keys') ) {
2797
  /**
2798
  * Function to splice an array keeping key
2799
  */
2800
+ function array_splice_preserve_keys( &$input, $offset, $length = null, $replacement = array() ) {
 
2801
 
2802
+ if ( empty($replacement) ) {
2803
  return array_splice($input, $offset, $length);
2804
  }
2805
 
2813
  }
2814
  }
2815
 
2816
+ if ( ! function_exists('woo_feed_product_custom_fields') ) {
2817
+ function woo_feed_product_custom_fields() {
 
2818
  /**
2819
  * Here array of a field contain 3 elements
2820
  * 1. Name
2822
  * 3. Is this fields is a custom taxonomy
2823
  */
2824
  $custom_fields = array(
2825
+ 'brand' => array( __('Brand', 'woo-feed'), true, true ),
2826
+ 'gtin' => array( __('GTIN', 'woo-feed'), true ),
2827
+ 'mpn' => array( __('MPN', 'woo-feed'), true ),
2828
+ 'ean' => array( __('EAN', 'woo-feed'), true ),
2829
+ 'isbn' => array( __('ISBN', 'woo-feed'), true ),
2830
+ 'age_group' => array( __('Age group', 'woo-feed'), true ),
2831
+ 'gender' => array( __('Gender', 'woo-feed'), true ),
2832
+ 'material' => array( __('Material', 'woo-feed'), true ),
2833
+ 'cost_of_good_sold' => array( __('Cost of good sold', 'woo-feed'), true ),
2834
+ 'availability_date' => array( __('Availability Date', 'woo-feed'), true, false, false ),
2835
+ 'unit' => array( __('Unit', 'woo-feed'), true ),
2836
+ 'unit_pricing_measure' => array( __('Unit Price Measure', 'woo-feed'), true ),
2837
+ 'unit_pricing_base_measure' => array( __('Unit Price Base Measure', 'woo-feed'), true ),
2838
+ 'custom_field_0' => array( __('Custom field 0', 'woo-feed'), true ),
2839
+ 'custom_field_1' => array( __('Custom field 1', 'woo-feed'), true ),
2840
+ 'custom_field_2' => array( __('Custom field 2', 'woo-feed'), true ),
2841
+ 'custom_field_3' => array( __('Custom field 3', 'woo-feed'), true ),
2842
+ 'custom_field_4' => array( __('Custom field 4', 'woo-feed'), true ),
2843
  );
2844
  return apply_filters('woo_feed_product_custom_fields', $custom_fields);
2845
  }
2846
  }
2847
 
2848
+ if ( ! function_exists('woo_feed_product_attribute_cache_remove_cb') ) {
2849
 
2850
  add_action('wp_ajax_woo_feed_product_attribute_cache_remove', 'woo_feed_product_attribute_cache_remove_cb');
2851
  /**
2852
  * This function is called when product attribute swicher click.
2853
  */
2854
+ function woo_feed_product_attribute_cache_remove_cb() {
 
2855
  $is_nonce_valid = isset($_POST['nonce']) && wp_verify_nonce(sanitize_text_field($_POST['nonce']), 'wpf_feed_nonce');
2856
 
2857
+ if ( $is_nonce_valid ) {
2858
  delete_transient('__woo_feed_cache_woo_feed_dropdown_product_attributes');
2859
  } else {
2860
  wp_send_json_error(esc_html__('Invalid Request.', 'woo-feed'));
2864
  }
2865
  }
2866
 
2867
+ if ( ! function_exists('woo_feed_custom_fields_status_change_cb') ) {
2868
  add_action('wp_ajax_woo_feed_custom_fields_status_change', 'woo_feed_custom_fields_status_change_cb');
2869
  /**
2870
  * This AJAX callback function is called when custom fields on/off switched
2871
  */
2872
+ function woo_feed_custom_fields_status_change_cb() {
 
2873
  $is_nonce_valid = isset($_POST['nonce']) && wp_verify_nonce(sanitize_text_field(wp_unslash($_POST['nonce'])), 'wpf_feed_nonce');
2874
 
2875
+ if ( $is_nonce_valid && isset($_POST['field'], $_POST['status'],
2876
+ $_POST['isTaxonomy']) ) {
2877
  $field = sanitize_text_field(wp_unslash($_POST['field']));
2878
  $is_taxonomy = sanitize_text_field(wp_unslash($_POST['isTaxonomy']));
2879
  $status = sanitize_text_field(wp_unslash($_POST['status']));
2880
  $data = woo_feed_get_options('all');
2881
+ if ( 'true' === $is_taxonomy ) {
2882
+ $data['woo_feed_taxonomy'][ $field ] = ('true' === $status) ? 'enable' : 'disable';
2883
  } else {
2884
+ $data['woo_feed_identifier'][ $field ] = ('true' === $status) ? 'enable' : 'disable';
2885
  }
2886
  update_option('woo_feed_settings', $data, false);
2887
  } else {
2892
  }
2893
  }
2894
 
2895
+ if ( ! function_exists('woo_feed_add_custom_identifier') ) {
2896
  /**
2897
  * Add Custom fields into product inventory tab for Unique Identifier (GTIN,MPN,EAN)
2898
  *
2899
  * @since 3.7.8
2900
  */
2901
+ function woo_feed_add_custom_identifier() {
 
2902
  $custom_fields = woo_feed_product_custom_fields();
2903
  $custom_identifier_filter = new Woo_Feed_Custom_Identifier_Filter($custom_fields);
2904
  $custom_identifier = iterator_to_array($custom_identifier_filter);
2905
 
2906
  echo '<div class="options_group">';
2907
+ if ( ! empty($custom_identifier) ) {
2908
  echo sprintf('<h4 class="%s" style="padding-left: 10px;color: black;">%s</h4>', esc_attr('woo-feed-option-title'), esc_html__('CUSTOM FIELDS by CTX Feed', 'woo-feed'));
2909
+ foreach ( $custom_identifier as $key => $value ) {
2910
 
2911
  //identifier meta value for old and new version users
2912
  $custom_field_key_previous = sprintf('woo_feed_identifier_%s', strtolower($key));
2915
  $custom_field_key = sprintf('woo_feed_%s', strtolower($key));
2916
  $custom_field_value = get_post_meta( get_the_ID(), $custom_field_key, true );
2917
 
2918
+ if ( empty( $custom_field_value ) && ! empty( $custom_field_value_previous ) ) {
2919
  $custom_field_key = $custom_field_key_previous;
2920
  $custom_field_value = $custom_field_value_previous;
2921
  }
2922
 
2923
  $custom_field_id = esc_attr(wp_unslash("woo_feed_{$key}"));
2924
+ $custom_field_label = esc_attr(wp_unslash($custom_fields[ $key ][0]));
2925
  $custom_field_description = __('Set product ', 'woo-feed') . esc_html($custom_field_label) . __(' here.', 'woo-feed');
2926
  woocommerce_wp_text_input(
2927
  array(
2928
+ 'id' => $custom_field_id,
2929
+ 'value' => esc_attr( wp_unslash( $custom_field_value ) ),
2930
  'placeholder' => $custom_field_label,
2931
+ 'label' => $custom_field_label,
2932
+ 'desc_tip' => true,
2933
  'description' => $custom_field_description,
2934
  )
2935
  );
2943
  add_action('woocommerce_product_options_inventory_product_data', 'woo_feed_add_custom_identifier');
2944
  }
2945
 
2946
+ if ( ! function_exists('woo_feed_save_custom_identifier') ) {
2947
 
2948
  /**
2949
  * Updating custom fields data. (Unique Identifier (GTIN,MPN,EAN))
2952
  * @param WP_Post $post Wp Post Object.
2953
  * @since 3.7.8
2954
  */
2955
+ function woo_feed_save_custom_identifier( $product_id, $product ) {
 
2956
  $custom_fields = woo_feed_product_custom_fields();
2957
  $custom_identifier_filter = new Woo_Feed_Custom_Identifier_Filter($custom_fields);
2958
  $custom_identifier = iterator_to_array($custom_identifier_filter);
2959
 
2960
+ if ( ! empty($custom_identifier) ) {
2961
+ foreach ( $custom_identifier as $key => $name ) {
2962
  $product_meta_key = "woo_feed_{$key}";
2963
+ $product_meta_value = isset($_POST[ $product_meta_key ]) ? sanitize_text_field($_POST[ $product_meta_key ]) : (isset($_POST[ "woo_feed_identifier_{$key}" ]) ? sanitize_text_field($_POST[ "woo_feed_identifier_{$key}" ]) : '');
2964
+ if ( isset($product_meta_value) && ! empty($product_meta_value) ) {
2965
  update_post_meta($product_id, $product_meta_key, $product_meta_value);
2966
  } else {
2967
  delete_post_meta($product_id, $product_meta_key);
2974
  add_action('save_post_product', 'woo_feed_save_custom_identifier', 10, 2);
2975
  }
2976
 
2977
+ if ( ! function_exists('woo_feed_add_custom_identifier_for_variation') ) {
2978
 
2979
  /**
2980
  * Custom options in variation tab, here we are putting gtin, mpn, ean input fields in product variation tab
2985
  *
2986
  * @since 3.7.8
2987
  */
2988
+ function woo_feed_add_custom_identifier_for_variation( $loop, $variation_data, $variation ) {
 
2989
  $settings = woo_feed_get_options('all');
2990
+ if ( isset($settings['disable_mpn']) && "enable" === $settings['disable_mpn'] ) {
2991
  echo '<div class="woo-feed-variation-options">';
2992
  $custom_fields = woo_feed_product_custom_fields();
2993
  $custom_identifier_filter = new Woo_Feed_Custom_Identifier_Filter($custom_fields);
2994
  $custom_identifier = iterator_to_array($custom_identifier_filter);
2995
 
2996
+ if ( ! empty($custom_identifier) ) {
2997
  echo '<div class="woo-feed-variation-options">';
2998
  echo sprintf('<h4 class="%s">%s</h4>', esc_attr('woo-feed-variation-option-title'), esc_html__('CUSTOM FIELDS by CTX Feed', 'woo-feed'));
2999
  echo '<div class="woo-feed-variation-items">';
3000
 
3001
+ foreach ( $custom_identifier as $key => $value ) {
3002
  $custom_field_id = sprintf('woo_feed_%s_var[%d]', strtolower($key), $variation->ID);
3003
  $custom_field_label = isset($value[0]) ? $value[0] : '';
3004
  $custom_field_description = sprintf('Set product %s here.', $custom_field_label);
3005
 
3006
  //identifier meta value for old and new version users
3007
+ if ( metadata_exists('post', $variation->ID, 'woo_feed_' . strtolower($key) . '_var') ) {
3008
  $custom_field_key = sprintf('woo_feed_%s_var', strtolower($key));
3009
  } else {
3010
  $custom_field_key = sprintf('woo_feed_identifier_%s_var', strtolower($key));
3012
 
3013
  woocommerce_wp_text_input(
3014
  array(
3015
+ 'id' => $custom_field_id,
3016
+ 'value' => esc_attr(get_post_meta($variation->ID, $custom_field_key, true)),
3017
+ 'placeholder' => esc_html($custom_field_label),
3018
+ 'label' => esc_html($custom_field_label),
3019
+ 'desc_tip' => true,
3020
+ 'description' => esc_html($custom_field_description),
3021
  'wrapper_class' => 'form-row form-row-full',
3022
  )
3023
  );
3031
  add_action('woocommerce_product_after_variable_attributes', 'woo_feed_add_custom_identifier_for_variation', 10, 3);
3032
  }
3033
 
3034
+ if ( ! function_exists('woo_feed_save_custom_identifier_for_variation') ) {
3035
 
3036
  /**
3037
  * Saving variation custom fields.
3041
  *
3042
  * @since 3.7.8
3043
  */
3044
+ function woo_feed_save_custom_identifier_for_variation( $variation_id, $i ) {
 
3045
  $custom_fields = woo_feed_product_custom_fields();
3046
  $custom_identifier_filter = new Woo_Feed_Custom_Identifier_Filter($custom_fields);
3047
  $custom_identifier = iterator_to_array($custom_identifier_filter);
3048
 
3049
+ if ( ! empty($custom_identifier) ) {
3050
+ foreach ( $custom_identifier as $key => $value ) {
3051
+ $custom_field_value = isset($_POST[ "woo_feed_{$key}_var" ][ $variation_id ]) ? sanitize_text_field($_POST[ "woo_feed_{$key}_var" ][ $variation_id ]) : (isset($_POST[ "woo_feed_identifier_{$key}_var" ][ $variation_id ]) ? sanitize_text_field($_POST[ "woo_feed_identifier_{$key}_var" ]) : '');
3052
+ if ( isset($custom_field_value) ) {
3053
  update_post_meta($variation_id, "woo_feed_{$key}_var", $custom_field_value);
3054
  }
3055
  }
3060
  add_action('woocommerce_save_product_variation', 'woo_feed_save_custom_identifier_for_variation', 10, 2);
3061
  }
3062
 
3063
+ if ( ! function_exists('woo_feed_category_mapping') ) {
3064
  /**
3065
  * Category Mapping
3066
  */
3067
+ function woo_feed_category_mapping() {
 
3068
  // Manage action for category mapping.
3069
+ if ( isset($_GET['action'], $_GET['cmapping']) && 'edit-mapping' == $_GET['action'] ) {
3070
+ if ( count($_POST) && isset($_POST['mappingname']) && isset($_POST['edit-mapping']) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
3071
  check_admin_referer('category-mapping');
3072
 
3073
  $mappingOption = sanitize_text_field(wp_unslash($_POST['mappingname']));
3078
  # Delete product attribute drop-down cache
3079
  delete_transient('__woo_feed_cache_woo_feed_dropdown_product_attributes');
3080
 
3081
+ if ( $oldMapping === $mappingData ) {
3082
  update_option('wpf_message', esc_html__('Mapping Not Changed', 'woo-feed'), false);
3083
  wp_safe_redirect(admin_url('admin.php?page=webappick-feed-category-mapping&wpf_message=warning'));
3084
  die();
3085
  }
3086
 
3087
+ if ( update_option($mappingOption, serialize($mappingData), false) ) { // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.serialize_serialize
3088
  update_option('wpf_message', esc_html__('Mapping Updated Successfully', 'woo-feed'), false);
3089
  wp_safe_redirect(admin_url('admin.php?page=webappick-feed-category-mapping&wpf_message=success'));
3090
  die();
3095
  }
3096
  }
3097
  require WOO_FEED_FREE_ADMIN_PATH . 'partials/woo-feed-category-mapping.php';
3098
+ } elseif ( isset($_GET['action']) && 'add-mapping' == $_GET['action'] ) {
3099
+ if ( count($_POST) && isset($_POST['mappingname']) && isset($_POST['add-mapping']) ) {
3100
  check_admin_referer('category-mapping');
3101
 
3102
  $mappingOption = 'wf_cmapping_' . sanitize_text_field(wp_unslash($_POST['mappingname']));
3104
  # Delete product attribute drop-down cache
3105
  delete_transient('__woo_feed_cache_woo_feed_dropdown_product_attributes');
3106
 
3107
+ if ( false !== get_option($mappingOption, false) ) {
3108
  update_option('wpf_message', esc_html__('Another category mapping exists with the same name.', 'woo-feed'), false);
3109
  wp_safe_redirect(admin_url('admin.php?page=webappick-feed-category-mapping&wpf_message=warning'));
3110
  die();
3111
  }
3112
+ if ( update_option($mappingOption, serialize(woo_feed_array_sanitize($_POST)), false) ) { // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.serialize_serialize
3113
  update_option('wpf_message', esc_html__('Mapping Added Successfully', 'woo-feed'), false);
3114
  wp_safe_redirect(admin_url('admin.php?page=webappick-feed-category-mapping&wpf_message=success'));
3115
  die();
3127
  }
3128
 
3129
  // Category mapping.
3130
+ if ( ! function_exists('woo_feed_render_categories') ) {
3131
  /**
3132
  * Get Product Categories
3133
  *
3137
  *
3138
  * @return void
3139
  */
3140
+ function woo_feed_render_categories( $parent = 0, $par = '', $value = '' ) {
 
3141
  $categoryArgs = [
3142
+ 'taxonomy' => 'product_cat',
3143
+ 'parent' => $parent,
3144
+ 'orderby' => 'term_group',
3145
+ 'show_count' => 1,
3146
+ 'pad_counts' => 1,
3147
  'hierarchical' => 1,
3148
+ 'title_li' => '',
3149
+ 'hide_empty' => 0,
3150
  ];
3151
  $categories = get_categories($categoryArgs);
3152
+ if ( ! empty($categories) ) {
3153
+ if ( ! empty($par) ) {
3154
  $par = $par . ' > ';
3155
  }
3156
+ foreach ( $categories as $cat ) {
3157
  $class = $parent ? "treegrid-parent-{$parent} category-mapping" : 'treegrid-parent category-mapping';
3158
  ?>
3159
  <tr class="treegrid-1 ">
3169
  array( 'google', 'facebook', 'pinterest', 'bing', 'bing_local_inventory', 'snapchat' )
3170
  );
3171
 
3172
+ $previous_mapping_value = is_array($value) && isset($value['cmapping'][ $cat->term_id ]) ? esc_attr($value['cmapping'][ $cat->term_id ]) : '';
3173
+ $previous_listing_mapping_value = is_array($value) && isset($value['gcl-cmapping'][ $cat->term_id ]) && ! empty( $value['gcl-cmapping'][ $cat->term_id ] )
3174
+ ? esc_attr($value['gcl-cmapping'][ $cat->term_id ])
3175
  : $previous_mapping_value;
3176
 
3177
  ?>
3204
  <td class="<?php echo $termchildren ? 'group-' . $woo_map_term_id : ''; ?>" >
3205
  <?php
3206
  $childrencat = ! empty( get_term_children( $cat->term_id, 'product_cat' ) );
3207
+ if ( $childrencat ) {
3208
  $title = __( 'Copy this category to subcategories', 'woo-feed' );
3209
  echo '<span class="dashicons dashicons-arrow-down-alt" title=" ' . $title . '" id="cat-map-'.$cat->term_id.'"></span>';
3210
  }
3219
  }
3220
  }
3221
 
3222
+ if ( ! function_exists('woo_feed_clear_cache_button') ) {
3223
  /**
3224
  * Clear cache button.
3225
  *
3226
  * @return void
3227
  * @since 4.1.2
3228
  */
3229
+ function woo_feed_clear_cache_button() {
 
3230
  ?>
3231
  <div class="wf_clean_cache_wrapper">
3232
  <img class="woo-feed-cache-loader"
3241
  }
3242
  }
3243
 
3244
+ if ( ! function_exists('woo_feed_clear_cache_data') ) {
3245
  /**
3246
  * Clear cache data.
3247
  *
3249
  *
3250
  * @since 4.1.2
3251
  */
3252
+ function woo_feed_clear_cache_data() {
3253
+ if ( isset($_REQUEST['_ajax_clean_nonce']) ) {
 
3254
 
3255
+ if ( wp_verify_nonce(sanitize_text_field(wp_unslash($_REQUEST['_ajax_clean_nonce'])), 'clean_cache_nonce') ) {
3256
  $data = [];
3257
 
3258
  global $wpdb;
3260
  $wpdb->query("DELETE FROM $wpdb->options WHERE ({$wpdb->options}.option_name LIKE '_transient_timeout___woo_feed_cache_%') OR ({$wpdb->options}.option_name LIKE '_transient___woo_feed_cache_%')"); // phpcs:ignore
3261
 
3262
 
3263
+ $data = [ 'success' => true ];
3264
 
3265
  wp_send_json_success($data);
3266
  }
3272
  }
3273
  add_action('wp_ajax_clear_cache_data', 'woo_feed_clear_cache_data');
3274
 
3275
+ if ( ! function_exists('woo_feed_get_current_timestamp') ) {
3276
  /**
3277
  * Current local timestamp UTC.
3278
  *
3279
  * @since 4.2.0
3280
  */
3281
+ function woo_feed_get_current_timestamp() {
 
3282
 
3283
  $interval = get_option('wf_schedule');
3284
 
3288
  }
3289
  }
3290
 
3291
+ if ( ! function_exists('woo_feed_deep_term') ) {
3292
 
3293
  /**
3294
  * Get product terms list by hierarchical order.
3297
  * @return string
3298
  * @since 4.3.88+
3299
  */
3300
+ function woo_feed_deep_term( $term, $taxonomy ) {
 
3301
 
3302
+ if ( $term->parent === 0 ) {
3303
  return $term->name;
3304
  }
3305
 
3309
  }
3310
  }
3311
 
3312
+ if ( ! function_exists('woo_feed_parent_category') ) {
3313
 
3314
  /**
3315
  * Get product terms list by hierarchical order.
3319
  * @return WP_Term $term product parent term object
3320
  * @since 4.4.19
3321
  */
3322
+ function woo_feed_parent_category( $term, $taxonomy ) {
 
3323
 
3324
+ if ( $term->parent === 0 ) {
3325
  return $term;
3326
  }
3327
 
3331
  }
3332
  }
3333
 
3334
+ if ( ! function_exists('woo_feed_get_terms_list_hierarchical_order') ) {
3335
  /**
3336
  * Get product terms list by hierarchical order.
3337
  *
3343
  * @since 4.2.1
3344
  *
3345
  */
3346
+ function woo_feed_get_terms_list_hierarchical_order( $id, $full_path = true, $taxonomy = 'product_cat' ) {
 
3347
 
3348
  $terms = get_the_terms($id, $taxonomy);
3349
 
3350
+ if ( count($terms) ) {
3351
 
3352
+ if ( $full_path ) {
3353
+ return woo_feed_deep_term($terms[ count($terms) - 1 ], $taxonomy);
3354
  } else {
3355
+ return $terms[ count($terms) - 1 ]->name;
3356
  }
3357
  }
3358
 
3360
  }
3361
  }
3362
 
3363
+ if ( ! function_exists('woo_feed_get_products_ids_of_reviews') ) {
3364
  /**
3365
  * Get reviews product ids .
3366
  *
3367
  * @return array $review_products_ids // review products ids
3368
  * @since 4.0.5
3369
  */
3370
+ function woo_feed_get_products_ids_of_reviews() {
3371
+ $args = array( 'post_type' => 'product' );
 
3372
  $reviews = get_comments($args);
3373
  $review_products_ids = wp_list_pluck($reviews, 'comment_post_ID');
3374
 
3375
 
3376
+ return ! empty($review_products_ids) && is_array($review_products_ids) ? array_unique($review_products_ids) : array();
3377
 
3378
  }
3379
  }
3380
 
3381
+ if ( ! function_exists('woo_feed_get_approved_reviews_data') ) {
3382
  /**
3383
  * Get approved review's data.
3384
  *
3385
  * @return mixed
3386
  * @since 4.3.0
3387
  */
3388
+ function woo_feed_get_approved_reviews_data() {
 
3389
  $approved_reviews = [];
3390
  $product_ids = woo_feed_get_products_ids_of_reviews();
3391
 
3392
+ if ( ! empty($product_ids) && is_array($product_ids) ) {
3393
 
3394
+ foreach ( $product_ids as $product_id ) {
3395
  $reviews = get_comments(array(
3396
+ 'post_id' => $product_id,
3397
+ 'comment_type' => 'review',
3398
  'comment_approved' => 1,
3399
+ 'parent' => 0,
3400
  ));
3401
 
3402
  $product_name = get_the_title($product_id);
3403
  $product_link = get_the_permalink($product_id);
3404
 
3405
+ if ( is_array($reviews) && sizeof($reviews) > 0 ) {
3406
+ foreach ( $reviews as $item ) {
3407
  $review = array();
3408
  $review['review_ratings'] = get_comment_meta($item->comment_ID, 'rating', true);
3409
  $review['review_id'] = $item->comment_ID;
3434
  }
3435
  }
3436
 
3437
+ if ( ! function_exists('woo_feed_save_black_friday_notice_2021_notice') ) {
3438
  /**
3439
  * Update user meta to work ctx startup notice once.
3440
  *
3443
  * @since 4.3.31
3444
  * @author Nazrul Islam Nayan
3445
  */
3446
+ function woo_feed_save_black_friday_notice_2021_notice() {
 
3447
  if (isset($_REQUEST['_wp_ajax_nonce']) && wp_verify_nonce(wp_unslash($_REQUEST['_wp_ajax_nonce']), 'woo-feed-to-ctx-feed-notice')) { //phpcs:ignore
3448
  $user_id = get_current_user_id();
3449
+ if ( isset($_REQUEST['clicked']) ) {
3450
  $updated_user_meta = add_user_meta($user_id, 'woo_feed_black_friday_notice_2021_dismissed', 'true', true);
3451
 
3452
+ if ( $updated_user_meta ) {
3453
  wp_send_json_success(esc_html__('User meta updated successfully.', 'woo-feed'));
3454
  } else {
3455
  wp_send_json_error(esc_html__('Something is wrong.', 'woo-feed'));
3463
  }
3464
  add_action('wp_ajax_woo_feed_save_black_friday_notice_2021_notice', 'woo_feed_save_black_friday_notice_2021_notice');
3465
 
3466
+ if ( ! function_exists('woo_feed_hide_promotion') ) {
3467
  /**
3468
  * Update option to hide promotion.
3469
  *
3471
  *
3472
  * @since 5.1.7
3473
  */
3474
+ function woo_feed_hide_promotion() {
3475
+ if ( isset($_REQUEST['_ajax_nonce']) ) {
 
3476
  $hide_promotion = update_option('woo_feed_hide_promotion', 1);
3477
  $data = array(
3478
  'msg' => 'Hide promotion updated successfully.',
3479
  );
3480
+ if ( $hide_promotion ) {
3481
  wp_send_json_success($data);
3482
  } else {
3483
  wp_send_json_error(esc_html__('Something is wrong.', 'woo-feed'));
3490
  }
3491
  add_action('wp_ajax_woo_feed_hide_promotion', 'woo_feed_hide_promotion');
3492
 
3493
+ if ( ! function_exists('array_key_first') ) {
3494
  /**
3495
  * Array first key.
3496
  *
3499
  * @return mixed
3500
  * @since 4.3.0
3501
  */
3502
+ function array_key_first( array $arr ) {
3503
+ foreach ( $arr as $k => $unused ) {
 
3504
  return $k;
3505
  }
3506
  return NULL;
3507
  }
3508
  }
3509
 
3510
+ if ( ! function_exists('woo_feed_custom_taxonomy') ) {
3511
+ function woo_feed_custom_taxonomy() {
 
3512
  $custom_fields = woo_feed_product_custom_fields();
3513
  $custom_taxonomies_filter = new Woo_Feed_Custom_Taxonomy_Filter($custom_fields);
3514
  $custom_taxonomies = iterator_to_array($custom_taxonomies_filter);
3521
  }
3522
 
3523
  if ( isset($custom_attributes['brand']) && 'enable' === $custom_attributes['brand'] ) {
3524
+ if ( ! empty($custom_taxonomies) ) {
3525
+ foreach ( $custom_taxonomies as $key => $value ) {
3526
  $taxonomy_name = esc_html($value[0]);
3527
 
3528
  $labels = array(
3529
+ 'name' => $taxonomy_name . ' ' . __('by CTX Feed', 'woo-feed'),
3530
+ 'singular_name' => $taxonomy_name,
3531
+ 'menu_name' => $taxonomy_name . 's ' . __('by CTX Feed', 'woo-feed'),
3532
+ 'all_items' => __('All', 'woo-feed') . ' ' . $taxonomy_name . 's',
3533
+ 'parent_item' => __('Parent', 'woo-feed') . $taxonomy_name,
3534
+ 'parent_item_colon' => __('Parent:', 'woo-feed') . $taxonomy_name . ':',
3535
+ 'new_item_name' => __('New', 'woo-feed') . ' ' . $taxonomy_name . ' ' . __('Name', 'woo-feed'),
3536
+ 'add_new_item' => __('Add New', 'woo-feed') . ' ' . $taxonomy_name,
3537
+ 'edit_item' => __('Edit', 'woo-feed') . ' ' . $taxonomy_name,
3538
+ 'update_item' => __('Update', 'woo-feed') . ' ' . $taxonomy_name,
3539
  'separate_items_with_commas' => __('Separate', 'woo-feed') . ' ' . $taxonomy_name . ' ' . __('with commas', 'woo-feed'),
3540
+ 'search_items' => __('Search', 'woo-feed') . ' ' . $taxonomy_name,
3541
+ 'add_or_remove_items' => __('Add or remove', 'woo-feed') . ' ' . $taxonomy_name,
3542
+ 'choose_from_most_used' => __('Choose from the most used', 'woo-feed') . ' ' . $taxonomy_name . 's',
3543
  );
3544
  $args = array(
3545
+ 'labels' => $labels,
3546
+ 'hierarchical' => true,
3547
+ 'public' => true,
3548
+ 'show_ui' => true,
3549
  'show_admin_column' => false,
3550
+ 'show_in_rest' => true,
3551
  'show_in_nav_menus' => true,
3552
+ 'show_tagcloud' => true,
3553
  );
3554
  $taxonomy_key = sprintf('woo-feed-%s', strtolower($key));
3555
 
3563
  add_action('init', 'woo_feed_custom_taxonomy');
3564
  }
3565
 
3566
+ if ( ! function_exists('woo_feed_brand_term_radio_checklist') ) {
3567
 
3568
  /**
3569
  * Use radio inputs product brand taxonomies
3571
  * @param $args
3572
  * @return mixed
3573
  */
3574
+ function woo_feed_brand_term_radio_checklist( $args ) {
3575
+ if ( ! empty($args['taxonomy']) && 'woo-feed-brand' === $args['taxonomy'] ) {
3576
+ if ( empty($args['walker']) || is_a($args['walker'], 'Walker') ) {
3577
+ if ( ! class_exists('Woo_Feed_Brand_Walker_Category_Radio_Checklist') ) {
 
3578
  /**
3579
  * Custom walker for switching checkbox inputs to radio.
3580
  *
3582
  */
3583
  class Woo_Feed_Brand_Walker_Category_Radio_Checklist extends Walker_Category_Checklist
3584
  {
3585
+ function walk( $elements, $max_depth, ...$args ) {
 
3586
  $output = parent::walk($elements, $max_depth, ...$args);
3587
  $output = str_replace(
3588
+ array( 'type="checkbox"', "type='checkbox'" ),
3589
+ array( 'type="radio"', "type='radio'" ),
3590
  $output
3591
  );
3592
 
3603
  add_filter('wp_terms_checklist_args', 'woo_feed_brand_term_radio_checklist');
3604
  }
3605
 
3606
+ if ( ! function_exists('woo_feed_filter_woocommerce_structured_data_product') ) {
3607
 
3608
  $settings = woo_feed_get_options('all');
3609
  $overridden_structured_data = $settings['overridden_structured_data'];
3610
 
3611
 
3612
+ if ( "on" === $overridden_structured_data ) {
3613
 
3614
  /**
3615
  * Removed woocommerce default schema structure
3620
  * @return array $markup
3621
  * @since 4.3.6
3622
  */
3623
+ function woo_feed_filter_woocommerce_structured_data_product( $markup, $product ) {
 
3624
  $settings = woo_feed_get_options('all');
3625
  $disable_mpn = $settings['disable_mpn'];
3626
  $disable_brand = $settings['disable_brand'];
3628
  $description = apply_filters('woo_feed_schema_description', wp_strip_all_tags($product->get_short_description() ? $product->get_short_description() : $product->get_description()), $product);
3629
  $markup["description"] = $description;
3630
 
3631
+ if ( 'enable' === $disable_brand ) {
3632
+ $brand_term = wp_get_post_terms($product->get_id(), 'woo-feed-brand', array( 'fields' => 'names' ));
3633
 
3634
+ if ( ! is_wp_error($brand_term) ) {
3635
  if ( isset($brand_term[0]) ) {
3636
  $markup['brand']["name"] = $brand_term[0];
3637
  }
3651
  $markup['offers'][0]['priceCurrency'] = $currency;
3652
 
3653
  // Check if we have mpn data.
3654
+ if ( 'enable' === $disable_mpn && ! empty($mpn) ) {
3655
  $mpn = $product->get_meta('woo_feed_mpn');
3656
  $markup['mpn'] = $mpn;
3657
  }
3666
  }
3667
  }
3668
 
3669
+ if ( ! function_exists('woo_feed_trim_attribute') ) {
3670
  /**
3671
  * Trim attribute by specific sign
3672
  *
3673
  * @param $attribute string feed attribute
3674
  * @return mixed
3675
  */
3676
+ function woo_feed_trim_attribute( $attribute ) {
3677
  return str_replace('_', ' ', $attribute);
3678
  }
3679
  }
3680
 
3681
  // Facebook pixel integration
3682
+ if ( ! function_exists( 'woo_feed_facebook_pixel_init' ) ) {
3683
 
3684
  function woo_feed_facebook_pixel_init() {
3685
  new WebAppick\Feed\Tracker\Facebook\Pixel();
3690
  }
3691
 
3692
  // Google Remarketing integration
3693
+ if ( ! function_exists( 'woo_feed_google_remarketing_init' ) ) {
3694
 
3695
  function woo_feed_google_remarketing_init() {
3696
  new WebAppick\Feed\Tracker\Google\Remarketing();
3700
 
3701
  }
3702
 
3703
+ if ( ! function_exists('woo_feed_filter_dropdown_attributes') ) {
3704
  /**
3705
  * Woo Feed Filter Dropdown Attributes
3706
  *
3714
  *
3715
  * @since 4.3.11
3716
  */
3717
+ function woo_feed_filter_dropdown_attributes( $default_attr, $merchants ) {
3718
  $filtered_attributes = $default_attr;
3719
  $snapchat_additional_attr = array();
3720
  $snapchat_additional_attr['--18'] = 'Snapchat Additional Attributes';
3729
  $snapchat_additional_attr['---18'] = '';
3730
 
3731
  //filtering attributes for pinterest merchant
3732
+ if ( in_array('pinterest', $merchants) ) {
3733
+ if ( isset($default_attr['ads_redirect']) ) {
3734
+ if ( array_key_exists('ads_redirect', $default_attr) ) {
3735
  $keys = array_keys($default_attr);
3736
+ $keys[ array_search('ads_redirect', $keys) ] = 'ads_link';
3737
  $filtered_attributes = array_combine($keys, $default_attr);
3738
  $filtered_attributes['ads_link'] = 'Ads Link[ads_link]';
3739
  }
3741
  }
3742
 
3743
  //filtering attributes for snapchat merchant
3744
+ if ( in_array('snapchat', $merchants) ) {
3745
  $filtered_attributes = array_merge($filtered_attributes, $snapchat_additional_attr);
3746
  }
3747
 
3748
  //filtering attributes for facebook merchant
3749
+ if ( in_array('facebook', $merchants) ) {
3750
+ if ( isset($filtered_attributes['excluded_destination']) ) {
3751
  $facebook_attributes = array();
3752
  $facebook_attributes['quantity_to_sell_on_facebook'] = 'Quantity to sell on facebook [quantity_to_sell_on_facebook]';
3753
  $filtered_attributes = woo_feed_array_insert_after($filtered_attributes, 'excluded_destination', $facebook_attributes);
3761
  }
3762
 
3763
 
3764
+ if ( ! function_exists('woo_feed_countries') ) {
3765
  /**
3766
  * Woo Feed Country List
3767
  *
4027
  }
4028
 
4029
 
4030
+ if ( ! function_exists('woo_feed_positioning_attribute_value') ) {
4031
  /**
4032
  * Positioning new associative array in attribute's dropdown list
4033
  *
4041
  * @updated 12-01-2021
4042
  *
4043
  */
4044
+ function woo_feed_positioning_attribute_value( $array, $key, $input_array ) {
 
4045
  $keys = array_keys($array);
4046
  $index = array_search($key, $keys, true);
4047
  $pos = false === $index ? count($array) : $index + 1;
4051
  }
4052
  }
4053
 
4054
+ if ( ! function_exists('woo_feed_get_feed_file_list') ) {
4055
+ function woo_feed_get_feed_file_list() {
 
4056
  global $wpdb;
4057
  $feed_data = $wpdb->get_results($wpdb->prepare("SELECT option_name FROM $wpdb->options WHERE option_name like %s", 'wf_feed_%'), ARRAY_A); // phpcs:ignore
4058
  $feed_urls = [];
4059
+ if ( ! empty($feed_data) and is_array($feed_data) ) {
4060
+ foreach ( $feed_data as $key => $data ) {
4061
  $feed_info = maybe_unserialize(get_option($data['option_name']));
4062
  $feed_urls[] = $feed_info['url'];
4063
  }
4067
  }
4068
  }
4069
 
4070
+ if ( ! function_exists('woo_feed_exclude_feed_from_wp_rocket_cache') ) {
4071
  /**
4072
  * Exclude Feed file URL form WP Rocket caching
4073
  *
4075
  *
4076
  * @return array
4077
  */
4078
+ function woo_feed_exclude_feed_from_wp_rocket_cache( $files ) {
 
4079
  return array_merge(
4080
  $files,
4081
  [
4085
  }
4086
  }
4087
 
4088
+ if ( ! function_exists('woo_feed_exclude_feed_from_litespeed_cache') ) {
4089
  /**
4090
  * Exclude Feed file URL form LiteSpeed caching
4091
  *
4092
  * @return array|false
4093
  */
4094
+ function woo_feed_exclude_feed_from_litespeed_cache() {
4095
+ if ( ! class_exists('LiteSpeed\Core') || ! defined('LSCWP_DIR') ) {
 
4096
  return false;
4097
  }
4098
 
4099
  $litespeed_ex_paths = maybe_unserialize(get_option('litespeed.conf.cdn-exc'));
4100
+ if ( $litespeed_ex_paths && is_array($litespeed_ex_paths) && ! in_array('/wp-content/uploads/woo-feed', $litespeed_ex_paths) ) {
4101
  $litespeed_ex_paths = array_merge(
4102
  $litespeed_ex_paths,
4103
+ [ '/wp-content/uploads/woo-feed' ]
4104
  );
4105
  update_option('litespeed.conf.cdn-exc', $litespeed_ex_paths);
4106
  }
4108
  }
4109
  }
4110
 
4111
+ if ( ! function_exists('woo_feed_exclude_feed_from_wp_fastest_cache') ) {
4112
  /**
4113
  * Exclude Feed file URL form WP Fastest caching
4114
  *
4115
  * @return array|false
4116
  */
4117
+ function woo_feed_exclude_feed_from_wp_fastest_cache() {
 
4118
 
4119
+ if ( ! class_exists('WpFastestCache') ) {
4120
  return false;
4121
  }
4122
 
4123
  $wp_fastest_cache_ex_paths = json_decode(get_option('WpFastestCacheExclude'));
4124
+ if ( $wp_fastest_cache_ex_paths && is_array($wp_fastest_cache_ex_paths) ) {
4125
 
4126
  $feed_path_exist = false;
4127
+ foreach ( $wp_fastest_cache_ex_paths as $key => $path ) {
4128
+ if ( 'woo-feed' === $path->content ) {
4129
  $feed_path_exist = true;
4130
  break;
4131
  }
4132
  }
4133
 
4134
+ if ( ! $feed_path_exist ) {
4135
  $new_rule = new stdClass();
4136
  $new_rule->prefix = "contain";
4137
  $new_rule->content = 'woo-feed';
4139
 
4140
  $wp_fastest_cache_ex_paths = array_merge(
4141
  $wp_fastest_cache_ex_paths,
4142
+ [ $new_rule ]
4143
  );
4144
 
4145
  update_option('WpFastestCacheExclude', wp_json_encode($wp_fastest_cache_ex_paths));
4146
  }
4147
+ } elseif ( empty($wp_fastest_cache_ex_paths) ) {
4148
  $wp_fastest_cache_ex_paths = [];
4149
  $new_rule = new stdClass();
4150
  $new_rule->prefix = "contain";
4153
 
4154
  $wp_fastest_cache_ex_paths = array_merge(
4155
  $wp_fastest_cache_ex_paths,
4156
+ [ $new_rule ]
4157
  );
4158
 
4159
  update_option('WpFastestCacheExclude', wp_json_encode($wp_fastest_cache_ex_paths));
4162
  }
4163
  }
4164
 
4165
+ if ( ! function_exists('woo_feed_exclude_feed_from_wp_super_cache') ) {
4166
  /**
4167
  * Exclude Feed file URL form WP Super caching
4168
  *
4169
  * @return array|false
4170
  */
4171
+ function woo_feed_exclude_feed_from_wp_super_cache() {
 
4172
 
4173
+ if ( ! function_exists('wpsc_init') ) {
4174
  return false;
4175
  }
4176
 
4177
  $wp_super_ex_paths = get_option('ossdl_off_exclude');
4178
+ if ( $wp_super_ex_paths && strpos($wp_super_ex_paths, 'woo-feed') === false ) {
4179
  $wp_super_ex_paths = explode(',', $wp_super_ex_paths);
4180
+ $wp_super_ex_paths = array_merge($wp_super_ex_paths, [ 'woo-feed' ]);
4181
  update_option('ossdl_off_exclude', implode(',', $wp_super_ex_paths));
4182
  }
4183
 
4185
  }
4186
  }
4187
 
4188
+ if ( ! function_exists('woo_feed_exclude_feed_from_breeze_cache') ) {
4189
  /**
4190
  * Exclude Feed file URL form BREEZE caching
4191
  *
4192
  * @return array|false
4193
  */
4194
+ function woo_feed_exclude_feed_from_breeze_cache() {
 
4195
 
4196
+ if ( ! class_exists('Breeze_Admin') ) {
4197
  return false;
4198
  }
4199
 
4200
  $breeze_settings = maybe_unserialize(get_option('breeze_cdn_integration'));
4201
+ if ( is_array($breeze_settings) ) {
4202
+ $woo_feed_files = [ '.xml', '.csv', '.tsv', '.txt', '.xls' ];
4203
  $woo_feed_files = array_unique(array_merge($woo_feed_files, $breeze_settings['cdn-exclude-content']));
4204
  $breeze_settings['cdn-exclude-content'] = $woo_feed_files;
4205
  update_option('breeze_cdn_integration', $breeze_settings);
4208
  }
4209
  }
4210
 
4211
+ if ( ! function_exists('woo_feed_exclude_feed_from_wp_optimize_cache') ) {
4212
  /**
4213
  * Exclude Feed file URL form WP Optimize caching
4214
  *
4215
  * @return array|false
4216
  */
4217
+ function woo_feed_exclude_feed_from_wp_optimize_cache() {
 
4218
 
4219
+ if ( ! class_exists('WP_Optimize') ) {
4220
  return false;
4221
  }
4222
 
4223
  $wp_optimize_ex_paths = maybe_unserialize(get_option('wpo_cache_config'));
4224
+ if ( isset($wp_optimize_ex_paths['enable_page_caching']) && $wp_optimize_ex_paths['enable_page_caching'] ) { // If page Caching enabled
4225
+ if ( is_array($wp_optimize_ex_paths) && ! in_array('/wp-content/uploads/woo-feed', $wp_optimize_ex_paths['cache_exception_urls']) ) {
4226
+ $woo_feed_ex_path['cache_exception_urls'] = [ '/wp-content/uploads/woo-feed' ];
4227
  $wp_optimize_ex_paths = array_merge_recursive(
4228
  $wp_optimize_ex_paths,
4229
  $woo_feed_ex_path
4236
  }
4237
  }
4238
 
4239
+ if ( ! function_exists('woo_feed_exclude_feed_from_cache_enabler_cache') ) {
4240
  /**
4241
  * Exclude Feed file URL form Cache Enabler caching
4242
  *
4243
  * @return array|false
4244
  */
4245
+ function woo_feed_exclude_feed_from_cache_enabler_cache() {
 
4246
 
4247
+ if ( ! class_exists('Cache_Enabler') ) {
4248
  return false;
4249
  }
4250
 
4251
  $cache_enabler_ex_paths = maybe_unserialize(get_option('cache_enabler'));
4252
+ if ( isset($cache_enabler_ex_paths['excluded_page_paths']) && empty($cache_enabler_ex_paths['excluded_page_paths']) ) {
4253
  $cache_enabler_ex_paths['excluded_page_paths'] = '/wp-content/uploads/woo-feed/';
4254
  update_option('cache_enabler', $cache_enabler_ex_paths);
4255
  }
4258
  }
4259
  }
4260
 
4261
+ if ( ! function_exists('woo_feed_exclude_feed_from_swift_performance_cache') ) {
4262
  /**
4263
  * Exclude Feed file URL form Swift Performance caching
4264
  *
4265
  * @return array|false
4266
  */
4267
+ function woo_feed_exclude_feed_from_swift_performance_cache() {
 
4268
 
4269
+ if ( ! class_exists('Swift_Performance_Lite') ) {
4270
  return false;
4271
  }
4272
 
4273
  $swift_perform_ex_paths = maybe_unserialize(get_option('swift_performance_options'));
4274
 
4275
+ if ( $swift_perform_ex_paths && isset($swift_perform_ex_paths['exclude-strings']) ) {
4276
  $exclude_strings = $swift_perform_ex_paths['exclude-strings'];
4277
+ if ( is_array($exclude_strings) && ! in_array('/wp-content/uploads/woo-feed', $exclude_strings) ) {
4278
+ $woo_feed_ex_path['exclude-strings'] = [ '/wp-content/uploads/woo-feed' ];
4279
  $swift_perform_ex_paths = array_merge_recursive(
4280
  $swift_perform_ex_paths,
4281
  $woo_feed_ex_path
4282
  );
4283
  } else {
4284
+ $swift_perform_ex_paths['exclude-strings'] = [ '/wp-content/uploads/woo-feed' ];
4285
  }
4286
  update_option('swift_performance_options', $swift_perform_ex_paths);
4287
+ } elseif ( empty($swift_perform_ex_paths) ) {
4288
+ $swift_perform_ex_paths['exclude-strings'] = [ '/wp-content/uploads/woo-feed' ];
4289
  update_option('swift_performance_options', $swift_perform_ex_paths);
4290
  }
4291
 
4293
  }
4294
  }
4295
 
4296
+ if ( ! function_exists('woo_feed_exclude_feed_from_speed_booster_cache') ) {
4297
  /**
4298
  * Exclude Feed file URL form Speed Booster Pack caching
4299
  *
4300
  * @return array|false
4301
  */
4302
+ function woo_feed_exclude_feed_from_speed_booster_cache() {
 
4303
 
4304
+ if ( ! class_exists('Speed_Booster_Pack') ) {
4305
  return false;
4306
  }
4307
 
4308
  $feed_files = [];
4309
  $speed_booster_settings = maybe_unserialize(get_option('sbp_options'));
4310
+ if ( isset($speed_booster_settings['caching_exclude_urls']) ) {
4311
  $feed_files = woo_feed_get_feed_file_list();
4312
  $caching_exclude_urls = $speed_booster_settings['caching_exclude_urls'];
4313
+ if ( ! empty($caching_exclude_urls) ) {
4314
+ if ( ! empty($feed_files) ) {
4315
+ foreach ( $feed_files as $key => $file ) {
4316
+ $file = str_replace(array( 'http://', 'https://' ), '', $file);
4317
+ if ( ! in_array($file, explode("\n", $caching_exclude_urls)) ) {
4318
  $caching_exclude_urls .= "\n" . $file;
4319
  }
4320
  }
4321
  }
4322
  } else {
4323
+ $caching_exclude_urls = str_replace(array( 'http://', 'https://' ), '', implode("\n", $feed_files));
4324
  }
4325
  $speed_booster_settings['caching_exclude_urls'] = $caching_exclude_urls;
4326
  update_option('sbp_options', $speed_booster_settings);
4330
  }
4331
  }
4332
 
4333
+ if ( ! function_exists('woo_feed_exclude_feed_from_comet_cache') ) {
4334
  /**
4335
  * Exclude Feed file URL form Comet Cache caching
4336
  *
4337
  * @return array|false
4338
  */
4339
+ function woo_feed_exclude_feed_from_comet_cache() {
4340
+ if ( ! is_plugin_active('comet-cache/comet-cache.php') ) {
 
4341
  return false;
4342
  }
4343
 
4344
  $comet_cache_settings = maybe_unserialize(get_option('comet_cache_options'));
4345
 
4346
+ if ( $comet_cache_settings && isset($comet_cache_settings['exclude_uris']) ) {
4347
  $exclude_uris = $comet_cache_settings['exclude_uris'];
4348
+ if ( strpos($exclude_uris, '/wp-content/uploads/woo-feed') === false ) {
4349
  $exclude_uris .= "\n/wp-content/uploads/woo-feed";
4350
  $comet_cache_settings['exclude_uris'] = $exclude_uris;
4351
  update_option('comet_cache_options', $comet_cache_settings);
4356
  }
4357
  }
4358
 
4359
+ if ( ! function_exists('woo_feed_exclude_feed_from_hyper_cache') ) {
4360
  /**
4361
  * Exclude Feed file URL form Swift Performance caching
4362
  *
4363
  * @return array|false
4364
  */
4365
+ function woo_feed_exclude_feed_from_hyper_cache() {
 
4366
 
4367
+ if ( ! class_exists('HyperCache') ) {
4368
  return false;
4369
  }
4370
 
4371
  $hyper_cache_settings = maybe_unserialize(get_option('hyper-cache'));
4372
+ if ( $hyper_cache_settings && isset($hyper_cache_settings['reject_uris']) ) {
4373
  $exclude_strings = $hyper_cache_settings['reject_uris'];
4374
+ if ( is_array($exclude_strings) && ! in_array('/wp-content/uploads/woo-feed', $exclude_strings) ) {
4375
+ $woo_feed_ex_path['reject_uris'] = [ '/wp-content/uploads/woo-feed' ];
4376
  $woo_feed_ex_path['reject_uris_enabled'] = 1;
4377
  $hyper_cache_settings = array_merge_recursive(
4378
  $hyper_cache_settings,
4386
  }
4387
  }
4388
 
4389
+ if ( ! function_exists('woo_feed_wp_options') ) {
4390
+ function woo_feed_wp_options() {
4391
+ if ( isset($_GET['action']) && 'add-option' == $_GET['action'] ) {
4392
+ if ( count($_POST) && isset($_POST['wpfp_option']) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
 
4393
  check_admin_referer('woo-feed-add-option');
4394
 
4395
  $options = get_option('wpfp_option', array());
4396
  $newOption = sanitize_text_field($_POST['wpfp_option']);
4397
  $id = explode('-', $newOption);
4398
+ if ( false !== array_search($id[0], array_column($options, 'option_id')) ) { // found
4399
  update_option('wpf_message', esc_html__('Option Already Added.', 'woo-feed'), false);
4400
  wp_safe_redirect(admin_url('admin.php?page=webappick-wp-options&wpf_message=error'));
4401
  die();
4402
  } else {
4403
+ $options[ $id[0] ] = array(
4404
+ 'option_id' => $id[0],
4405
  'option_name' => 'wf_option_' . str_replace($id[0] . '-', '', $newOption),
4406
  );
4407
  update_option('wpfp_option', $options, false);
4417
  }
4418
  }
4419
 
4420
+ if ( ! function_exists('woo_feed_get_price_with_tax') ) {
4421
 
4422
 
4423
  /**
4428
  *
4429
  * @return float|mixed|string|void
4430
  */
4431
+ function woo_feed_get_price_with_tax( $price, $product ) {
 
4432
 
4433
+ if ( woo_feed_wc_version_check(3.0) ) {
4434
+ return wc_get_price_including_tax($product, array( 'price' => $price ));
4435
  } else {
4436
  return $product->get_price_including_tax(1, $price);
4437
  }
4438
 
4439
  return apply_filters('woo_feed_price_with_tax', $price, $product);
4440
  }
 
4441
  }
4442
 
4443
+ if ( ! function_exists('woo_feed_get_dynamic_discounted_product_price') ) {
4444
 
4445
  /**
4446
  * Get price with dynamic discount
4451
  * @param bool $tax product taxable or not
4452
  * @return mixed $price
4453
  */
4454
+ function woo_feed_get_dynamic_discounted_product_price( $price, $product, $config, $tax ) {
 
4455
  $base_price = $price;
4456
  $discount_plugin_activate = false;
4457
 
4460
  * PLUGIN: Discount Rules for WooCommerce
4461
  * URL: https://wordpress.org/plugins/woo-discount-rules/
4462
  */
4463
+ if ( is_plugin_active('woo-discount-rules/woo-discount-rules.php') ) {
4464
  $discount_plugin_activate = true;
4465
+ if ( class_exists('Wdr\App\Controllers\Configuration') ) {
4466
  $config = Wdr\App\Controllers\Configuration::getInstance()->getConfig('calculate_discount_from', 'sale_price');
4467
 
4468
+ if ( isset($config) && ! empty($config) ) {
4469
+ if ( 'regular_price' === $config ) {
4470
  $price = $product->get_regular_price();
4471
  } else {
4472
  $price = $product->get_price();
4475
  $price = $product->get_price();
4476
  }
4477
 
4478
+ if ( $product->is_type('variable') ) {
4479
  $min = $product->get_variation_price('min', false);
4480
  $max = $product->get_variation_price('max', false);
4481
 
4482
  $price = $min;
4483
+ if ( $max === $base_price ) {
4484
  $price = $max;
4485
  }
4486
  }
4487
 
4488
  $price = apply_filters('advanced_woo_discount_rules_get_product_discount_price_from_custom_price', false, $product, 1, $price, 'discounted_price', true, true);
4489
 
4490
+ if ( empty($price) ) {
4491
  $price = $base_price;
4492
  }
4493
 
4494
+ if ( ! isset( $feedConfig['feedCurrency'] ) ) {
4495
  $feedConfig['feedCurrency'] = get_woocommerce_currency();
4496
  }
4497
 
4549
  * PLUGIN: Pricing Deals for WooCommerce
4550
  * URL: https://wordpress.org/plugins/pricing-deals-for-woocommerce/
4551
  */
4552
+ if ( is_plugin_active('pricing-deals-for-woocommerce/vt-pricing-deals.php') ) {
4553
  $discount_plugin_activate = true;
4554
+ if ( class_exists('VTPRD_Controller') ) {
4555
  global $vtprd_rules_set;
4556
  $vtprd_rules_set = get_option('vtprd_rules_set');
4557
+ if ( ! empty($vtprd_rules_set) && is_array($vtprd_rules_set) ) {
4558
+ foreach ( $vtprd_rules_set as $vtprd_rule_set ) {
4559
  $status = $vtprd_rule_set->rule_on_off_sw_select;
4560
+ if ( 'on' === $status || 'onForever' === $status ) {
4561
  $discount_type = $vtprd_rule_set->rule_deal_info[0]['discount_amt_type'];
4562
  $discount = $vtprd_rule_set->rule_deal_info[0]['discount_amt_count'];
4563
+ if ( 'currency' === $discount_type || 'fixedPrice' === $discount_type ) {
4564
  $price = $product->get_price() - $discount;
4565
+ } elseif ( 'percent' === $discount_type ) {
4566
  $price = $product->get_price() - (($product->get_price() * $discount) / 100);
4567
  }
4568
  }
4599
 
4600
 
4601
  // Get Price with tax
4602
+ if ( $discount_plugin_activate && $tax ) {
4603
  $price = woo_feed_get_price_with_tax($price, $product);
4604
  }
4605
 
4612
  *
4613
  * @since 4.3.93
4614
  */
4615
+ if ( ! class_exists('Woo_Feed_Custom_Taxonomy_Filter') ) {
4616
  class Woo_Feed_Custom_Taxonomy_Filter extends FilterIterator
4617
  {
4618
 
4619
+ public function __construct( array $items ) {
 
4620
  $object = new ArrayObject($items);
4621
  parent::__construct($object->getIterator());
4622
  }
4623
 
4624
+ public function accept() {
 
4625
  return array_key_exists(2, parent::current()) ? parent::current()[2] : false;
4626
  }
4627
  }
4632
  *
4633
  * @since 4.3.93
4634
  */
4635
+ if ( ! class_exists('Woo_Feed_Custom_Identifier_Filter') ) {
4636
  class Woo_Feed_Custom_Identifier_Filter extends FilterIterator
4637
  {
4638
 
4639
+ public function __construct( array $items ) {
 
4640
  $object = new ArrayObject($items);
4641
  parent::__construct($object->getIterator());
4642
  }
4643
 
4644
+ public function accept() {
4645
+ if ( ! isset( parent::current()[3] ) || (isset(parent::current()[3]) && parent::current()[3] ) ) {
 
4646
  $is_identifier = ! array_key_exists( 2, parent::current() ) ? true : ! parent::current()[2];
4647
  if ( $is_identifier ) {
4648
  $get_settings = woo_feed_get_options( 'all' );
4663
  }
4664
  }
4665
 
4666
+ if ( ! function_exists('woo_feed_array_splice_preserve_keys') ) {
4667
+ function woo_feed_array_splice_preserve_keys( &$input, $offset, $length = null, $replacement = array() ) {
4668
+ if ( empty($replacement) ) {
 
4669
  return array_splice($input, $offset, $length);
4670
  }
4671
 
4679
  }
4680
  }
4681
 
4682
+ if ( ! function_exists('woo_feed_filter_count_cb') ) {
4683
  /**
4684
  * Add AJAX action when client click filter tab.
4685
  */
4694
  *
4695
  * @return mixed array | error
4696
  */
4697
+ function woo_feed_filter_count_cb() {
 
4698
  $is_nonce_valid = isset($_GET['nonce']) && wp_verify_nonce(sanitize_text_field(wp_unslash($_GET['nonce'])), 'wpf_feed_nonce');
4699
 
4700
+ if ( $is_nonce_valid ) {
4701
  $results = array(
4702
+ 'hidden' => woo_feed_hidden_products_count(),
4703
+ 'noPrice' => woo_feed_no_price_products_count(),
4704
+ 'noImg' => woo_feed_no_image_products_count(),
4705
+ 'noDesc' => woo_feed_no_description_products_count(),
4706
  'outOfStock' => woo_feed_out_of_stock_products_count(),
4707
+ 'backorder' => woo_feed_backorder_products_count(),
4708
  );
4709
  wp_send_json_success($results);
4710
  } else {
4713
  wp_die();
4714
  }
4715
  }
4716
+ if ( ! function_exists('woo_feed_hidden_products_count') ) {
4717
  /**
4718
  * This function give the hidden products count.
4719
  *
4720
  * @return integer
4721
  */
4722
+ function woo_feed_hidden_products_count() {
 
4723
  $args = array(
4724
+ 'post_type' => 'product',
4725
  'posts_per_page' => -1,
4726
+ 'fields' => 'ids',
4727
+ 'tax_query' => array(
4728
  array(
4729
  'taxonomy' => 'product_visibility',
4730
+ 'field' => 'name',
4731
+ 'terms' => 'exclude-from-catalog',
4732
  'operator' => 'IN',
4733
  ),
4734
  ),
4737
  return count($products->posts);
4738
  }
4739
  }
4740
+ if ( ! function_exists('woo_feed_no_image_products_count') ) {
4741
  /**
4742
  * This function give the products count which have no thumbnail image or gallery image
4743
  *
4744
  * @return integer
4745
  */
4746
+ function woo_feed_no_image_products_count() {
 
4747
  $args = array(
4748
+ 'post_type' => 'product',
4749
  'posts_per_page' => -1,
4750
+ 'fields' => 'ids',
4751
+ 'meta_query' => array(
4752
  'relation' => 'AND',
4753
  array(
4754
+ 'key' => '_thumbnail_id',
4755
  'compare' => 'NOT EXISTS',
4756
  ),
4757
  array(
4758
+ 'key' => '_product_image_gallery',
4759
  'compare' => 'NOT EXISTS',
4760
  ),
4761
  ),
4764
  return count($products->posts);
4765
  }
4766
  }
4767
+ if ( ! function_exists('woo_feed_no_description_products_count') ) {
4768
  /**
4769
  * This function give the products count which have no description/short description.
4770
  *
4771
  * @return integer
4772
  */
4773
+ function woo_feed_no_description_products_count() {
 
4774
  add_filter('posts_where', 'woo_feed_filter_where_product_with_no_description');
4775
  $args = array(
4776
+ 'post_type' => 'product',
4777
  'posts_per_page' => -1,
4778
+ 'fields' => 'ids',
4779
  );
4780
  $products = new WP_Query($args);
4781
  remove_filter('posts_where', 'woo_feed_filter_where_product_with_no_description');
4782
  return count($products->posts);
4783
  }
4784
  }
4785
+ if ( ! function_exists('woo_feed_filter_where_product_with_no_description') ) {
4786
  /**
4787
  * This function changes the wp query to get out of products without description.
4788
  *
4789
  * @param string $where
4790
  */
4791
+ function woo_feed_filter_where_product_with_no_description( $where = '' ) {
 
4792
  $where .= "
4793
  AND trim( coalesce( post_content, '' ) ) = ''
4794
  ";
4795
  return $where;
4796
  }
4797
  }
4798
+ if ( ! function_exists('woo_feed_out_of_stock_products_count') ) {
4799
  /**
4800
  * This function gives the `out of stock products` count.
4801
  *
4802
  * @return integer
4803
  */
4804
+ function woo_feed_out_of_stock_products_count() {
 
4805
  $args = array(
4806
+ 'post_type' => 'product',
4807
  'posts_per_page' => -1,
4808
+ 'fields' => 'ids',
4809
+ 'meta_query' => array(
4810
  array(
4811
+ 'key' => '_stock_status',
4812
+ 'value' => 'outofstock',
4813
  'compare' => '==',
4814
  ),
4815
  ),
4818
  return count($products->posts);
4819
  }
4820
  }
4821
+ if ( ! function_exists('woo_feed_backorder_products_count') ) {
4822
  /**
4823
  * This function gives the `backorder` products count.
4824
  *
4825
  * @return integer
4826
  */
4827
+ function woo_feed_backorder_products_count() {
 
4828
  $args = array(
4829
+ 'post_type' => 'product',
4830
  'posts_per_page' => -1,
4831
+ 'fields' => 'ids',
4832
+ 'meta_query' => array(
4833
  array(
4834
+ 'key' => '_stock_status',
4835
+ 'value' => 'onbackorder',
4836
  'compare' => '==',
4837
  ),
4838
  ),
4841
  return count($products->posts);
4842
  }
4843
  }
4844
+ if ( ! function_exists('woo_feed_no_price_products_count') ) {
4845
  /**
4846
  * This function give the products count which have no prices.
4847
  *
4848
  * @return integer
4849
  */
4850
+ function woo_feed_no_price_products_count() {
 
4851
  $args = array(
4852
+ 'post_type' => 'product',
4853
  'posts_per_page' => -1,
4854
+ 'fields' => 'ids',
4855
+ 'meta_query' => array(
4856
  array(
4857
+ 'key' => '_price',
4858
+ 'value' => '',
4859
  'compare' => '==',
4860
  ),
4861
  ),
4865
  }
4866
  }
4867
 
4868
+ if ( ! function_exists('woo_feed_custom_field_meta_filter') ) {
4869
  /**
4870
  * Identifier meta value filter for old and new version users
4871
  *
4876
  * @since 4.3.99
4877
  *
4878
  */
4879
+ function woo_feed_custom_field_meta_filter( $meta, $product, $field ) {
 
4880
  $id = $product->get_id();
4881
 
4882
  //identifier meta value for old and new version users
4883
+ if ( false !== strpos($meta, 'woo_feed_identifier_') ) {
4884
 
4885
  $identifier = str_replace('woo_feed_identifier_', '', $meta);
4886
+ if ( metadata_exists('post', $id, 'woo_feed_' . $identifier) ) {
4887
  $meta = 'woo_feed_' . $identifier;
4888
  } else {
4889
  $meta = 'woo_feed_identifier_' . $identifier;
4896
  add_filter('woo_feed_custom_field_meta', 'woo_feed_custom_field_meta_filter', 3, 10);
4897
  }
4898
 
4899
+ if ( ! function_exists('woo_feed_strpos_array') ) {
4900
 
4901
  /**
4902
  * Extension of php `strpos` function
4908
  * @since 4.3.100
4909
  *
4910
  */
4911
+ function woo_feed_strpos_array( $niddles, $haystack ) {
 
4912
 
4913
+ if ( empty($haystack) ) {
4914
  return;
4915
  }
4916
 
4917
+ foreach ( $niddles as $niddle ) {
4918
+ if ( strpos($haystack, $niddle) !== false ) {
4919
  return true;
4920
  }
4921
  }
4925
  }
4926
  }
4927
 
4928
+ if ( ! function_exists('woo_feed_schema_description_filter') ) {
4929
  /**
4930
  * Filter schema description
4931
  *
4936
  * @since 4.3.101
4937
  *
4938
  */
4939
+ function woo_feed_schema_description_filter( $description, $product ) {
 
4940
 
4941
  $description = do_shortcode($description);
4942
  $description = woo_feed_stripInvalidXml($description);
4947
  //strip tags and spacial characters
4948
  $strip_description = wp_strip_all_tags(wp_specialchars_decode($description));
4949
 
4950
+ $description = ! empty(strlen($strip_description)) && 0 < strlen($strip_description) ? $strip_description : $description;
4951
 
4952
  return $description;
4953
  }
4956
  }
4957
 
4958
 
4959
+ if ( ! function_exists('woo_feed_get_yoast_identifiers_value') ) {
4960
  /**
4961
  * Get Yoast identifiers value
4962
  *
4967
  *
4968
  * @author Nazrul Islam Nayan
4969
  */
4970
+ function woo_feed_get_yoast_identifiers_value( $attribute_key, $product ) {
 
4971
  $identifier = '';
4972
+ if ( class_exists('Yoast_WooCommerce_SEO') ) {
4973
  $wpseo_identifier = get_post_meta($product->get_id(), 'wpseo_global_identifier_values');
4974
  $wpseo_identifier = reset($wpseo_identifier);
4975
 
4976
+ if ( isset($wpseo_identifier[ $attribute_key ]) ) {
4977
+ $identifier = $wpseo_identifier[ $attribute_key ];
4978
  }
4979
 
4980
+ if ( empty($identifier) && $product->is_type('variation') ) {
4981
  $parent = wc_get_product($product->get_parent_id());
4982
  $identifier = woo_feed_get_yoast_identifiers_value($attribute_key, $parent);
4983
  }
4986
  return $identifier;
4987
  }
4988
 
4989
+ if ( ! function_exists('woo_feed_parent_product_id') ) {
4990
  /**
4991
  * Return variable product id for variation else main product id.
4992
  *
4994
  *
4995
  * @return int
4996
  */
4997
+ function woo_feed_parent_product_id( $product ) {
4998
+ if ( $product->is_type('variation') ) {
 
4999
  return $product->get_parent_id();
5000
  }
5001
  return $product->get_id();
5004
  }
5005
 
5006
  #==== MERCHANT TEMPLATE OVERRIDE START ==============#
5007
+ if ( ! function_exists('woo_feed_modify_google_color_attribute_value') ) {
5008
  /**
5009
  * Replace comma (,) with slash (/) for Google Shopping template color attribute value
5010
  *
5014
  *
5015
  * @return string
5016
  */
5017
+ function woo_feed_modify_google_color_attribute_value( $attribute_value, $product, $feed_config, $merchant_attribute ) {
 
5018
  // Replace Google Color attribute value according to requirements
5019
+ if ( ('g:color' === $merchant_attribute || 'color' === $merchant_attribute)
5020
  && in_array($feed_config['provider'], [
5021
  'google',
5022
  'facebook',
5023
  'pinterest',
5024
  'bing',
5025
  'snapchat',
5026
+ ], true) ) {
5027
  return str_replace(', ', '/', $attribute_value);
5028
  }
5029
  return $attribute_value;
5030
  }
5031
  }
5032
 
5033
+ if ( ! function_exists('woo_feed_modify_weight_attribute_value') ) {
5034
  /**
5035
  * Add wight unit as suffix for Google Shopping template shipping_weight attribute.
5036
  *
5040
  *
5041
  * @return string
5042
  */
5043
+ function woo_feed_modify_weight_attribute_value( $attribute_value, $product, $feed_config ) {
5044
+ if ( isset($feed_config['attributes'])
 
5045
  && in_array($feed_config['provider'], [
5046
  'google',
5047
  'facebook',
5048
  'pinterest',
5049
  'bing',
5050
  'snapchat',
5051
+ ]) ) {
5052
  $attributes = $feed_config['attributes'];
5053
  $key = array_search('weight', $attributes, true);
5054
+ if ( isset($feed_config['suffix']) && ! empty($key) && array_key_exists($key, $feed_config['suffix']) ) {
5055
+ $weight_suffix_unit = $feed_config['suffix'][ $key ];
5056
 
5057
+ if ( empty($weight_suffix_unit) && ! empty($attribute_value) ) {
5058
  $attribute_value .= ' ' . get_option('woocommerce_weight_unit');
5059
  }
5060
  }
5062
 
5063
  return $attribute_value;
5064
  }
 
5065
  }
5066
 
5067
+ if ( ! function_exists('woo_feed_get_bestprice_categoryPath_attribute_value_modify') ) {
5068
  /**
5069
  * Replace BestPrice categoryPath value from > to ,
5070
  *
5074
  *
5075
  * @return string
5076
  */
5077
+ function woo_feed_get_bestprice_categoryPath_attribute_value_modify( $attribute_value, $product, $feed_config ) {
 
5078
  $attribute_value = str_replace('>', ', ', $attribute_value);
5079
 
5080
  return $attribute_value;
5081
  }
5082
  }
5083
 
5084
+ if ( ! function_exists('woo_feed_availability_attribute_value_modify') ) {
5085
  /**
5086
  * Modify Availability attribute value based on channel.
5087
  *
5091
  *
5092
  * @return string
5093
  */
5094
+ function woo_feed_availability_attribute_value_modify( $attribute_value, $product, $feed_config ) {
5095
+ if ( 'bestprice' === $feed_config['provider'] ) {
5096
+ if ( 'in stock' === $attribute_value ) {
 
5097
  return "Y";
5098
  }
5099
 
5102
 
5103
  if ( 'skroutz' === $feed_config['provider'] ) {
5104
 
5105
+ if ( 'in stock' === $attribute_value ) {
5106
  $in_stock_string = __('Delivery 1 to 3 days', 'woo-feed' );
5107
  } else {
5108
  $in_stock_string = __('Delivery up to 30 days', 'woo-feed' );
5111
  return $in_stock_string;
5112
  }
5113
 
5114
+ if ( 'pricerunner' === $feed_config['provider'] ) {
5115
+ if ( 'in stock' === $attribute_value ) {
5116
  return "Yes";
5117
  }
5118
 
5119
  return "No";
5120
  }
5121
 
5122
+ if ( 'google' === $feed_config['provider'] || 'pinterest' === $feed_config['provider'] ) {
5123
+ if ( 'on backorder' === $attribute_value || 'on_backorder' === $attribute_value ) {
5124
  return 'preorder';
5125
  }
5126
 
5127
+ if ( 'google' === $feed_config['provider'] ) {
5128
+ if ( ! in_array( $attribute_value, [ 'in_stock', 'out_of_stock', 'on_backorder' ] ) ) {
5129
  return 'in_stock';
5130
  }
5131
+ } elseif ( ! in_array( $attribute_value, [ 'in stock', 'out of stock', 'on backorder' ] ) ) {
5132
  return 'in stock';
5133
  }
5134
  }
5135
 
5136
+ if ( 'facebook' === $feed_config['provider'] ) {
5137
+ if ( 'on backorder' === $attribute_value ) {
5138
  return 'available for order';
5139
+ }elseif ( ! in_array( $attribute_value, [ 'in stock', 'out of stock', 'on backorder' ] ) ) {
5140
  return 'in stock';
5141
  }
5142
  }
5145
  }
5146
  }
5147
 
5148
+ if ( ! function_exists('woo_feed_spartoo_attribute_value_modify') ) {
5149
  /**
5150
  * Modify Spartoo feed Parent/Child attribute value.
5151
  *
5155
  *
5156
  * @return string
5157
  */
5158
+ function woo_feed_spartoo_attribute_value_modify( $attribute_value, $product, $feed_config ) {
5159
+ if ( 'spartoo.fi' === $feed_config['provider'] ) {
5160
+ if ( 'variation' === $attribute_value ) {
 
5161
  return "child";
5162
  }
5163
 
5168
  }
5169
  }
5170
 
5171
+ if ( ! function_exists('woo_feed_get_pinterest_rss_date_attribute_callback') ) {
5172
  /**
5173
  * Convert date format to DATERFC822 for pinterest RSS Feed.
5174
  *
5178
  *
5179
  * @return string
5180
  */
5181
+ function woo_feed_get_pinterest_rss_date_attribute_callback( $attribute_value, $product, $feed_config ) {
5182
+ if ( ! empty($attribute_value) ) {
 
5183
  return date('r', strtotime($attribute_value));
5184
  }
5185
  return $attribute_value;
5239
  }
5240
  }
5241
 
5242
+ if ( ! function_exists('woo_feed_is_google_group_merchant') ) {
5243
  /**
5244
  * Check if the given merchant is a google group merchant (google, facebook, pinterest, bing)
5245
  *
5249
  * @since 4.4.22
5250
  * @return boolean
5251
  */
5252
+ function woo_feed_is_google_group_merchant( $provider ) {
5253
+ return in_array($provider, [ 'google', 'facebook', 'pinterest', 'bing' ]);
5254
  }
5255
  }
5256
 
5257
+ if ( ! function_exists('woo_feed_filter_product_description_callback') ) {
5258
  /**
5259
  * @param string $description Product Description
5260
  * @param WC_Product $product Product Object
5263
  * @return mixed
5264
  */
5265
  function woo_feed_filter_product_description_callback( $description, $product, $config ) {
5266
+ if ( empty($description) ) {
5267
  return $description;
5268
  }
5269
 
5270
+ if ( isset($config['provider']) && woo_feed_is_google_group_merchant($config['provider']) ) {
5271
+ if ( strlen($description) > 5000 ) {
5272
+ for ( $I = 4999; $description[ $I ] != ' ' ; $I-- );
5273
  $description = substr($description, 0, $I);
5274
  }
5275
  }
5278
  }
5279
  }
5280
 
5281
+ if ( ! function_exists( 'woo_feed_filter_product_title' ) ) {
5282
  /**
5283
  * @param string $title Product Title
5284
  * @param WC_Product $product
5286
  *
5287
  * @return string
5288
  */
5289
+ function woo_feed_filter_product_title( $title, $product, $config ) {
5290
 
5291
+ if ( ! is_string( $title ) ) {
5292
  return '';
5293
  }
5294
 
5295
+ if ( isset($config['provider']) && in_array($config['provider'], [ 'google', 'facebook', 'pinterest', 'bing' ]) ) {
5296
+ if ( strlen($title) > 150 ) {
5297
+ for ( $I = 149; $title[ $I ] != ' ' ; $I-- );
5298
  $title = substr($title, 0, $I);
5299
  }
5300
  }
5303
  }
5304
  }
5305
 
5306
+ if ( ! function_exists( 'woo_feed_array_insert_after' ) ) {
5307
  /**
5308
  * Insert a value or key/value pair after a specific key in an array. If key doesn't exist, value is appended
5309
  * to the end of the array.
5321
 
5322
  return array_merge( array_slice( $array, 0, $pos ), $new, array_slice( $array, $pos ) );
5323
  }
 
5324
  }
5325
 
5326
+ if ( ! function_exists( 'woo_feed_get_js_dequeue_handles_list' ) ) {
5327
  /**
5328
  * JS files handles list to dequeue from loading
5329
  *
5332
  * @return array
5333
  */
5334
  function woo_feed_get_js_dequeue_handles_list() {
5335
+ $js_files_handles = [ 'common_aramex', 'jquery_chained', 'validate_aramex' ]; //aramex shipping plugin handles
5336
 
5337
  return apply_filters("woo_feed_filter_js_dequeue_handles", $js_files_handles);
5338
  }
 
5339
  }
5340
 
5341
+ if ( ! function_exists( 'woo_feed_get_plugin_pages_slugs' ) ) {
5342
  /**
5343
  * Get Woo Feed Plugin Pages Slugs
5344
  *
5347
  * @return array
5348
  */
5349
  function woo_feed_get_plugin_pages_slugs() {
5350
+ $woo_feed_plugin_pages = [
5351
  'webappick-manage-feeds',
5352
  'webappick-new-feed',
5353
  'webappick-wp-options',
5356
  'webappick-feed-pro-vs-free',
5357
  'webappick-wp-status',
5358
  'webappick-feed-category-mapping',
5359
+ 'webappick-wp-options',
5360
  ];
5361
 
5362
  return apply_filters('woo_feed_plugin_pages_slugs', $woo_feed_plugin_pages);
5363
  }
 
5364
  }
5365
 
5366
+ if ( ! function_exists('woo_feed_make_feed_big_data') ) {
5367
+ function woo_feed_make_feed_big_data( $data, $ids, $config ) {
5368
 
5369
  //setup feed shipping data @TODO: need to make a class when another data setup will be added
5370
+ if ( isset($config['attributes']) && in_array("shipping", $config["attributes"]) ) {
5371
  if ( class_exists( 'WC_Shipping_Zones' ) ) {
5372
  $data['shipping_zones'] = WC_Shipping_Zones::get_zones();
5373
  }
5379
  add_filter('woo_feed_feed_big_data', 'woo_feed_make_feed_big_data', 10, 3);
5380
  }
5381
 
5382
+
5383
+ if( ! function_exists('woo_feed_after_wc_product_structured_data') ) {
5384
+ function woo_feed_after_wc_product_structured_data($markup, $product) {
5385
+
5386
+
5387
+ if( isset($_SERVER['REQUEST_URI']) && strpos($_SERVER['REQUEST_URI'], 'attribute_') ) {
5388
+ $url = $_SERVER['REQUEST_URI'];
5389
+ $url_components = parse_url($url);
5390
+ $currency = get_option('woocommerce_currency');
5391
+
5392
+ if( isset($url_components['query']) && !empty($url_components['query']) ) {
5393
+ parse_str($url_components['query'], $params);
5394
+
5395
+ $attributes = $product->get_attributes();
5396
+ $attribute_names = array_keys($attributes);
5397
+
5398
+ if( isset($attribute_names) && is_array($attribute_names) ) {
5399
+ $meta_query_items = [];
5400
+ $meta_query_items['relation'] = 'AND';
5401
+
5402
+ foreach($attribute_names as $attr_name) {
5403
+ $attribute_name = 'attribute_'. $attr_name;
5404
+
5405
+ if( isset($params[$attribute_name]) ) {
5406
+ $new_query_item = [];
5407
+ $new_query_item['key'] = $attribute_name;
5408
+ $new_query_item['value'] = $params[$attribute_name];
5409
+ $new_query_item['compare'] = 'LIKE';
5410
+
5411
+ array_push($meta_query_items, $new_query_item);
5412
+ }
5413
+ }
5414
+
5415
+ $variation_id = get_posts(
5416
+ array(
5417
+ 'post_type' => 'product_variation',
5418
+ 'numberposts' => 1,
5419
+ 'post_status' => 'publish',
5420
+ 'fields' => 'ids',
5421
+ 'post_parent' => $product->get_id(),
5422
+ 'meta_query' => $meta_query_items,
5423
+ )
5424
+ );
5425
+
5426
+ $variation_product = wc_get_product($variation_id[0]);
5427
+ $variation_price = $variation_product->get_price();
5428
+
5429
+ $markup['offers'][0]['@type'] = "Offer";
5430
+ $markup['offers'][0]['price'] = $variation_price;
5431
+ $markup['offers'][0]['priceSpecification']['price'] = $variation_price;
5432
+ $markup['offers'][0]['priceSpecification']['priceCurrency'] = $currency;
5433
+ $markup['offers'][0]['priceCurrency'] = $currency;
5434
+ }
5435
+ }
5436
+
5437
+ }
5438
+
5439
+ return $markup;
5440
+
5441
+ }
5442
+ add_filter('woo_feed_after_wc_product_structured_data', 'woo_feed_after_wc_product_structured_data', 10, 2);
5443
+ }
5444
+
5445
  #==== MERCHANT TEMPLATE OVERRIDE END ================#
5446
 
5447
  // Including pluggable functions file
includes/pluggable.php CHANGED
@@ -30,7 +30,7 @@ if ( ! function_exists( 'woo_feed_get_category_mapping_value' ) ) {
30
  $categories = array_reverse( get_the_terms( $product_id, 'product_cat' ) );
31
 
32
  //get cmapping value
33
- if( in_array( $getValue['mappingprovider'], $suggestive_category_list_merchants ) && isset( $getValue['gcl-cmapping'] ) ) {
34
  $cmapping = is_array( $getValue['gcl-cmapping'] ) ? array_reverse( $getValue['gcl-cmapping'], true ) : $getValue['gcl-cmapping'];
35
  } else {
36
  $cmapping = is_array( $getValue['cmapping'] ) ? array_reverse( $getValue['cmapping'], true ) : $getValue['cmapping'];
30
  $categories = array_reverse( get_the_terms( $product_id, 'product_cat' ) );
31
 
32
  //get cmapping value
33
+ if ( in_array( $getValue['mappingprovider'], $suggestive_category_list_merchants ) && isset( $getValue['gcl-cmapping'] ) ) {
34
  $cmapping = is_array( $getValue['gcl-cmapping'] ) ? array_reverse( $getValue['gcl-cmapping'], true ) : $getValue['gcl-cmapping'];
35
  } else {
36
  $cmapping = is_array( $getValue['cmapping'] ) ? array_reverse( $getValue['cmapping'], true ) : $getValue['cmapping'];
includes/template-configs.php CHANGED
@@ -50,34 +50,34 @@ return array(
50
  'limit' => array( '', '', '', '', '', '', '', '' ),
51
  ),
52
  'google' => array(
53
- 'mattributes' => array('id','title','description','item_group_id','link','product_type','current_category','image','condition','availability','price','sale_price','sku','brand','canonical_link','images_1','images_2','images_3','images_4','images_5',),
54
- 'prefix' => array('','','','','','','','','','','','','','','','','','','','',),
55
- 'type' => array('attribute','attribute','attribute','attribute','attribute','attribute','pattern','attribute','pattern','attribute','attribute','attribute','attribute','pattern','attribute','attribute','attribute','attribute','attribute','attribute',),
56
- 'attributes' => array('id','title','description','item_group_id','link','product_type','','image','','availability','price','current_price','sku','','canonical_link','image_1','image_2','image_3','image_4','image_5',),
57
- 'default' => array('','','','','','','','','new','','','','',$this->brand_pattern,'','','','','','',),
58
- 'suffix' => array('','','','','','','','','','',' ' . $this->currency,' ' . $this->currency,'','','','','','','','',),
59
- 'output_type' => array('1','1','11','1','1','1','1','1','1','1','6','6','1','1','1','1','1','1','1','1',),
60
- 'limit' => array('','','','','','','','','','','','','','','','','','','','',),
61
  ),
62
  'facebook' => array(
63
- 'mattributes' => array('id','title','description','item_group_id','link','product_type','fb_product_category','image','condition','availability','price','sale_price','brand','images_1','images_2','images_3','images_4','images_5',),
64
- 'prefix' => array('','','','','','','','','','','','','','','','','','',),
65
- 'type' => array('attribute','attribute','attribute','attribute','attribute','attribute','pattern','attribute','pattern','attribute','attribute','attribute','pattern','attribute','attribute','attribute','attribute','attribute',),
66
- 'attributes' => array('id','title','description','item_group_id','link','product_type','','image','','availability','price','current_price','','image_1','image_2','image_3','image_4','image_5',),
67
- 'default' => array('','','','','','','','','new','','','',$this->brand_pattern,'','','','','',),
68
- 'suffix' => array('','','','','','','','','','',' ' . $this->currency,' ' . $this->currency,'','','','','','',),
69
- 'output_type' => array('1','1','11','1','1','1','1','1','1','1','6','6','1','1','1','1','1','1',),
70
- 'limit' => array('','','','','','','','','','','','','','','','','','',),
71
  ),
72
  'pinterest_rss' => array(
73
- 'mattributes' => array('title','description','link','image','pubDate','guid',),
74
- 'prefix' => array('','','','','','',),
75
- 'type' => array('attribute','attribute','attribute','attribute','attribute','attribute',),
76
- 'attributes' => array('title','description','link','image','date_created','link',),
77
- 'default' => array('','','','','','',),
78
- 'suffix' => array('','','','','','',),
79
- 'output_type' => array('1','11','1','1','1','1',),
80
- 'limit' => array('','','','','','',),
81
  ),
82
  'bol' => array(
83
  'mattributes' => array(
@@ -2614,84 +2614,84 @@ return array(
2614
  'limit' => array( '', '', '', '', '', '', '', '', '' ),
2615
  ),
2616
  'adwords' => array(
2617
- 'mattributes' => array('ID','ID2','Item title','Final URL','Image URL','Item subtitle','Item description','Item category','Price','Sale price','Contextual keywords','Item address',),
2618
- 'prefix' => array('','','','','','','','','','','','',),
2619
- 'type' => array('attribute','attribute','attribute','attribute','attribute','attribute','attribute','attribute','attribute','attribute','pattern','pattern',),
2620
- 'attributes' => array('id','id','title','link','image','short_description','description','product_type','price','sale_price','','',),
2621
- 'default' => array('','','','','','','','','','','','',),
2622
- 'suffix' => array('','','','','','','','',' '.$this->currency,' '.$this->currency,'','',),
2623
- 'output_type' => array('1','1','1','1','1','1','11','1','6','6','1','1',),
2624
- 'limit' => array('','','','','','','','','','','','',),
2625
  ),
2626
- 'adwords_local_product' => array(
2627
- 'mattributes' => array('Rank','Product Item Id','Title','Description','Item URL','Image URL','Price','Store code',),
2628
- 'prefix' => array('','','','','','','','',),
2629
- 'type' => array('attribute','attribute','attribute','attribute','attribute','attribute','attribute','pattern',),
2630
- 'attributes' => array('id','id','title','description','link','image','current_price','',),
2631
- 'default' => array('','','','','','','','',),
2632
- 'suffix' => array('','','','','','',' '.$this->currency,'',),
2633
- 'output_type' => array('1','1','1','11','1','1','6','1',),
2634
- 'limit' => array('','','','','','','','',),
2635
  ),
2636
  'bing' => array(
2637
- 'mattributes' => array('id','title','link','price','sale_price','description','image_link','mpn','brand','product_type','availability','item_group_id','shipping',),
2638
- 'prefix' => array('','','','','','','','','','','','','',),
2639
- 'type' => array('attribute','attribute','attribute','attribute','attribute','attribute','attribute','attribute','pattern','attribute','attribute','attribute','attribute',),
2640
- 'attributes' => array('id','title','link','price','current_price','description','image','sku','','product_type','availability','item_group_id','shipping',),
2641
- 'default' => array('','','','','','','','',$this->brand_pattern,'','','','',),
2642
- 'suffix' => array('','','',' '.$this->currency,' '.$this->currency,'','','','','','','','',),
2643
- 'output_type' => array('1','1','1','6','6','11','1','1','1','1','1','1','1',),
2644
- 'limit' => array('','','','','','','','','','','','','',),
2645
  ),
2646
  'bing_local_inventory' => array(
2647
- 'mattributes' => array('store_code','itemid','quantity','weeks_of_supply','pick_up_method','pick_up_sla',),
2648
- 'prefix' => array('','','','','','',),
2649
- 'type' => array('pattern','attribute','attribute','pattern','pattern','pattern',),
2650
- 'attributes' => array('','id','quantity','','','',),
2651
- 'default' => array('','','','','','',),
2652
- 'suffix' => array('','','','','','',),
2653
- 'output_type' => array('1','1','1','1','1','1',),
2654
- 'limit' => array('','','','','','',),
2655
  ),
2656
  'google_local_inventory' => array(
2657
- 'mattributes' => array('store_code','id','quantity','price','sale_price','sale_price_effective_date','availability','pickup_method','pickup_sla',),
2658
- 'prefix' => array('','','','','','','','','',),
2659
- 'type' => array('pattern','attribute','attribute','attribute','attribute','attribute','attribute','pattern','pattern',),
2660
- 'attributes' => array('','id','quantity','price','sale_price','sale_price_effective_date','availability','','',),
2661
- 'default' => array(' ','','','','','','','','',),
2662
- 'suffix' => array('','','',' '.$this->currency,' '.$this->currency,'','','','',),
2663
- 'output_type' => array('1','1','1','6','6','1','1','1','1',),
2664
- 'limit' => array('','','','','','','','','',),
2665
  ),
2666
  'google_local' => array(
2667
- 'mattributes' => array('store_code','id','title','description','image','upc','brand','condition','price','sale_price','sale_price_effective_date','energy_efficiency_class','min_energy_efficiency_class','max_energy_efficiency_class',),
2668
- 'prefix' => array('','','','','','','','','','','','','','',),
2669
- 'type' => array('pattern','attribute','attribute','attribute','attribute','attribute','pattern','pattern','attribute','attribute','attribute','pattern','pattern','pattern',),
2670
- 'attributes' => array('','id','title','description','image','sku','','','price','sale_price','sale_price_effective_date','','','',),
2671
- 'default' => array('','','','','','',$this->brand_pattern,'new','','','','','','',),
2672
- 'suffix' => array('','','','','','','','',' '.$this->currency,' '.$this->currency,'','','','',),
2673
- 'output_type' => array('1','1','1','11','1','1','1','1','6','6','1','1','1','1',),
2674
- 'limit' => array('','','','','','','','','','','','','','',),
2675
  ),
2676
  'google_promotions' => array(
2677
- 'mattributes' => array('promotion_id','product_applicability','offer_type','long_title','promotion_effective_dates','redemption_channel','promotion_destination','money_off_amount',),
2678
- 'prefix' => array('','','','','','','','',),
2679
- 'type' => array('pattern','pattern','pattern','pattern','pattern','pattern','pattern','pattern',),
2680
- 'attributes' => array('','','','','','','','',),
2681
- 'default' => array('','','','','','','','',),
2682
- 'suffix' => array('','','','','','','','',),
2683
- 'output_type' => array('1','1','1','1','1','1','1','1',),
2684
- 'limit' => array('','','','','','','','',),
2685
  ),
2686
  'google_dynamic_ads' => array(
2687
- 'mattributes' => array('Page URL','Custom Label',),
2688
- 'prefix' => array('','',),
2689
- 'type' => array('attribute','pattern',),
2690
- 'attributes' => array('link','',),
2691
- 'default' => array('','',),
2692
- 'suffix' => array('','',),
2693
- 'output_type' => array('1','1',),
2694
- 'limit' => array('','',),
2695
  ),
2696
  'snapchat' => array(
2697
  'mattributes' => array( 'id', 'title', 'description', 'item_group_id', 'link', 'product_type', 'current_category', 'image', 'condition', 'availability', 'price', 'sale_price', 'sku', 'brand', 'canonical_link' ),
@@ -2704,14 +2704,14 @@ return array(
2704
  'limit' => array( '', '', '', '', '', '', '', '', '', '', '', '', '', '', '' ),
2705
  ),
2706
  'idealo' => array(
2707
- 'mattributes' => array('sku','title','description','price','imageUrls','deliveryTime','categoryPath','url','brand','checkout','eans','fulfillmentType','checkoutLimitPerPeriod','size','colour',),
2708
- 'prefix' => array('','','','','','','','','','','','','','','',),
2709
- 'type' => array('attribute','attribute','attribute','attribute','attribute','pattern','attribute','attribute','pattern','pattern','pattern','pattern','pattern','attribute','attribute',),
2710
- 'attributes' => array('sku','title','description','current_price','images','','product_type','link','','','','','','wf_attr_pa_size','wf_attr_pa_color',),
2711
- 'default' => array('','','','','','1-3 working days','','','','','','','','','',),
2712
- 'suffix' => array('','','',' USD','','','','','','','','','','','',),
2713
- 'output_type' => array('1','1','11','6','1','1','1','1','1','1','1','1','1','1','1',),
2714
- 'limit' => array('','','','','','','','','','','','','','','',),
2715
  ),
2716
  'pricespy' => array(
2717
  'mattributes' => array(
@@ -2873,15 +2873,15 @@ return array(
2873
  ),
2874
  'limit' => array( '', '', '', '', '', '', '', '', '', '', '', '', '' ),
2875
  ),
2876
- 'miinto.de' => array(
2877
- 'mattributes' => array('title','description','gtin','item_group_id','image_link','product_type','availability','color','season_tag','brand','material','washing','style_id','retail_price_PLN','retail_price_DKK','retail_price_EUR',),
2878
- 'prefix' => array('','','','','','','','','','','','','','','','',),
2879
- 'type' => array('attribute','attribute','attribute','attribute','attribute','attribute','attribute','attribute','pattern','pattern','pattern','pattern','pattern','attribute','attribute','attribute',),
2880
- 'attributes' => array('title','description','id','item_group_id','image','product_type','availability','wf_attr_pa_color','','','','','','price','price','price',),
2881
- 'default' => array('','','','','','','','','','','','','','','','','','',),
2882
- 'suffix' => array('','','','','','','','','','','','','',' USD',' USD',' USD',),
2883
- 'output_type' => array('1','1','1','1','1','1','1','1','1','1','1','1','1','6','6','6',),
2884
- 'limit' => array('','','','','','','','','','','','','','','','',),
2885
  ),
2886
  'miinto.nl' => array(
2887
  'mattributes' => array(
@@ -3113,15 +3113,15 @@ return array(
3113
  'output_type' => array( '1', '1', '8, 11', '1', '1', '1', '1', '6', '1', '1', '1', '1' ),
3114
  'limit' => array( '', '', '', '', '', '', '', '', '', '', '', '' ),
3115
  ),
3116
- 'googlereview' => array(
3117
- 'mattributes' => array('product_name','product_url','review_temp_gtin','review_temp_mpn','review_temp_sku','review_temp_brand',),
3118
- 'prefix' => array('','','','','','',),
3119
- 'type' => array('attribute','attribute','pattern','pattern','pattern','pattern',),
3120
- 'attributes' => array('title','link','','','','',),
3121
- 'default' => array('','','','','','',),
3122
- 'suffix' => array('','','','','','',),
3123
- 'output_type' => array('1','1','1','1','1','1',),
3124
- 'limit' => array('','','','','','',),
3125
  ),
3126
  'google_shopping_action' => array(
3127
  'mattributes' => array(
@@ -7234,14 +7234,14 @@ return array(
7234
  'limit' => array( '', '', '', '', '', '', '', '', '', 'test' ),
7235
  ),
7236
  'profit_share' => array(
7237
- 'mattributes' => array('Cod categorie','Categorie','Categorie parinte','Producator','Cod producator','Model','Cod produs','Nume ','Descriere','Link produs','Imagine produs','Pret fara TVA','Pret cu TVA','Pret cu discount fara TVA','Moneda','Disponibilitate','Livrare gratuita','Cadou inclus','Status','ID categorie parinte',),
7238
- 'prefix' => array('','','','','','','','','','','','','','','','','','','','',),
7239
- 'type' => array('attribute','attribute','attribute','attribute','pattern','attribute','attribute','attribute','attribute','attribute','attribute','attribute','attribute','attribute','attribute','attribute','pattern','pattern','pattern','attribute',),
7240
- 'attributes' => array('child_category','child_category_id','primary_category','','','sku','id','title','description','link','image','current_price','current_price_with_tax','sale_price','store_currency','availability','','','','primary_category_id',),
7241
- 'default' => array('','','','','','','','Develop-pro','','','','','','','','','1','0','1','',),
7242
- 'suffix' => array('','','','','','','','','','','','','','','','','','','','',),
7243
- 'output_type' => array('1','1','1','1','1','1','1','1','11','1','1','6','6','6','1','1','1','1','1','1',),
7244
- 'limit' => array('','','','','','','','','','','','','','','','','','','','',),
7245
  ),
7246
  'trendyol' => array(
7247
  'mattributes' => array( 'Barkod', 'Model Kodu', 'Marka', 'Kategori', 'Para Birimi', 'Ürün Adı', 'Ürün Açıklaması', 'Piyasa Satış Fiyatı (KDV Dahil)', 'Trendyol\'da Satılacak Fiyat (KDV Dahil)', 'Ürün Stok Adedi', 'Stok Kodu', 'KDV Oranı', 'Desi', 'Görsel Linki', 'Sevkiyat Süresi', 'Beden', 'Kol Tipi', 'Desen', 'Boy / Ölçü', 'Materyal', 'Yaş Grubu', 'Cinsiyet', 'Yaka', 'Renk' ),
@@ -7264,94 +7264,94 @@ return array(
7264
  'limit' => array( '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '' ),
7265
  ),
7266
  'heureka.sk' => array(
7267
- 'mattributes' => array('ITEM_ID','PRODUCTNAME','PRODUCT','DESCRIPTION','URL','IMGURL','PRICE_VAT','CATEGORYTEXT','EAN',),
7268
- 'prefix' => array('','','','','','','','','',),
7269
- 'type' => array('attribute','attribute','attribute','attribute','attribute','attribute','attribute','attribute','attribute',),
7270
- 'attributes' => array('id','title','title','description','link','image','current_price_with_tax','product_type','woo_feed_ean',),
7271
- 'default' => array('','','','','','','','','Develop-pro',),
7272
- 'suffix' => array('','','','','','','','','',),
7273
- 'output_type' => array('1','1','1','11','1','1','6','1','1',),
7274
- 'limit' => array('','','','','','','','','',),
7275
  ),
7276
  'moebel.de' => array(
7277
- 'mattributes' => array('art_nr','art_name','art_beschreibung','art_url','art_img_url','art_price','art_kategorie','art_verfuegbarkeit',),
7278
- 'prefix' => array('','','','','','','','',),
7279
- 'type' => array('attribute','attribute','attribute','attribute','attribute','attribute','attribute','attribute',),
7280
- 'attributes' => array('id','title','description','link','image','price','product_type','availability',),
7281
- 'default' => array('','','','','','','','',),
7282
- 'suffix' => array('','','','','','','','',),
7283
- 'output_type' => array('1','1','11','1','1','1','1','1',),
7284
- 'limit' => array('','','','','','','','',),
7285
  ),
7286
  'zbozi.cz' => array(
7287
- 'mattributes' => array('ITEM_ID','PRODUCTNAME','DESCRIPTION','URL','IMGURL','CATEGORYTEXT','VISIBILITY','PRICE_VAT','DELIVERY_DATE',),
7288
- 'prefix' => array('','','','','','','','','',),
7289
- 'type' => array('attribute','attribute','attribute','attribute','attribute','attribute','attribute','attribute','pattern',),
7290
- 'attributes' => array('id','title','description','link','image','product_type','visibility','current_price_with_tax','',),
7291
- 'default' => array('','','','','','','Develop-free','','0',),
7292
- 'suffix' => array('','','','','','','','','',),
7293
- 'output_type' => array('1','1','11','1','1','1','1','6','1',),
7294
- 'limit' => array('','','','','','','','','',),
7295
  ),
7296
  'catch.com.au' => array(
7297
- 'mattributes' => array('product-id','title','product-description','image-1','price','state',),
7298
- 'prefix' => array('','','','','','',),
7299
- 'type' => array('attribute','attribute','attribute','attribute','attribute','pattern',),
7300
- 'attributes' => array('id','title','description','image','price','',),
7301
- 'default' => array('','','','','','new',),
7302
- 'suffix' => array('','','','','','',),
7303
- 'output_type' => array('1','1','11','1','6','1',),
7304
- 'limit' => array('','','','','','',),
7305
  ),
7306
  'fashionchick' => array(
7307
- 'mattributes' => array ('Product ID', 'Titel', 'Omschrijving', 'Url', 'Image', 'Prijs', 'Category', 'Geslacht', 'Merk',),
7308
- 'prefix' => array ('', '', '', '', '', '', '', '', '',),
7309
- 'type' => array ('attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'pattern', 'pattern',),
7310
- 'attributes' => array ('id', 'title', 'description', 'link', 'image', 'price', 'product_type', '', '',),
7311
- 'default' => array ('', '', '', '', '', '', '', 'male', '',),
7312
- 'suffix' => array ('', '', '', '', '', '', '', '', '',),
7313
- 'output_type' => array ('1', '1', '2, 11', '1', '1', '6', '1', '1', '1',),
7314
- 'limit' => array ('', '', '', '', '', '', '', '', '',),
7315
  ),
7316
  'wine_searcher' => array(
7317
- 'mattributes' => array('name','description','vintage','unit-size','price','url','min-order','tax','offer-type','delivery-time','stock-level',),
7318
- 'prefix' => array('','','','','','','','','','','',),
7319
- 'type' => array('attribute','attribute','pattern','pattern','attribute','attribute','pattern','pattern','pattern','pattern','attribute',),
7320
- 'attributes' => array('title','description','','','price','link','','','','','quantity',),
7321
- 'default' => array('','','','','','Develop-free','','','','','',),
7322
- 'suffix' => array('','','','','','','','','','','',),
7323
- 'output_type' => array('1','11','1','1','6','1','1','1','1','1','1',),
7324
- 'limit' => array('','','','','','','','','','','',),
7325
  ),
7326
- 'modalova' => array(
7327
- 'mattributes' => array('id','title','description','link','sku','main_image','images','price','sale_price','availability','category','condition','child_category',),
7328
- 'prefix' => array('','','','','','','','','','','','','',),
7329
- 'type' => array('attribute','attribute','attribute','attribute','attribute','attribute','attribute','attribute','attribute','attribute','attribute','attribute','attribute',),
7330
- 'attributes' => array('id','title','description','link','sku','image','images','price','current_price','availability','primary_category','condition','child_category',),
7331
- 'default' => array('','','','','','','','',$this->brand_pattern,'','','','',),
7332
- 'suffix' => array('','','','','','','','','','','','','',),
7333
- 'output_type' => array('1','1','11','1','1','1','1','6','6','1','1','1','1',),
7334
- 'limit' => array('','','','','','','','','','','','','',),
7335
  ),
7336
- 'ecommerceit' => array(
7337
- 'mattributes' => array('sku','qty','name','brand','category','picture_url','price','product_url','mpn','shipping_cost','max_delivery_days','delivery_label',),
7338
- 'prefix' => array('','','','','','','','','','','','',),
7339
- 'type' => array('attribute','attribute','attribute','pattern','attribute','attribute','attribute','attribute','pattern','attribute','pattern','pattern',),
7340
- 'attributes' => array('sku','quantity','title','','primary_category','image','price','link','','shipping_cost','','',),
7341
- 'default' => array('','','',$this->brand_pattern,'','','','','','','3','1-5 days',),
7342
- 'suffix' => array('','','','','','','','','','','','',),
7343
- 'output_type' => array('1','1','1','1','1','1','6','1','1','6','1','1',),
7344
- 'limit' => array('','','','','','','','','','','','',),
7345
  ),
7346
- 'tiktok' => array(
7347
- 'mattributes' => array('sku_id','title','description','availability','link','image_link','price','brand','condition',),
7348
- 'prefix' => array('','','','','','','','','',),
7349
- 'type' => array('attribute','attribute','attribute','attribute','attribute','attribute','attribute','pattern','pattern',),
7350
- 'attributes' => array('sku_id','title','description','availability','link','image','price','','',),
7351
- 'default' => array('','','','','','','','','',),
7352
- 'suffix' => array('','','','','','','','','',),
7353
- 'output_type' => array('1','1','1','1','1','1','6','1','1',),
7354
- 'limit' => array('','','','','','','','','',),
7355
  ),
7356
  );
7357
  // End of file merchant_templates.php
50
  'limit' => array( '', '', '', '', '', '', '', '' ),
51
  ),
52
  'google' => array(
53
+ 'mattributes' => array( 'id', 'title', 'description', 'item_group_id', 'link', 'product_type', 'current_category', 'image', 'condition', 'availability', 'price', 'sale_price', 'sku', 'brand', 'canonical_link', 'images_1', 'images_2', 'images_3', 'images_4', 'images_5' ),
54
+ 'prefix' => array( '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '' ),
55
+ 'type' => array( 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'pattern', 'attribute', 'pattern', 'attribute', 'attribute', 'attribute', 'attribute', 'pattern', 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'attribute' ),
56
+ 'attributes' => array( 'id', 'title', 'description', 'item_group_id', 'link', 'product_type', '', 'image', '', 'availability', 'price', 'current_price', 'sku', '', 'canonical_link', 'image_1', 'image_2', 'image_3', 'image_4', 'image_5' ),
57
+ 'default' => array( '', '', '', '', '', '', '', '', 'new', '', '', '', '', $this->brand_pattern, '', '', '', '', '', '' ),
58
+ 'suffix' => array( '', '', '', '', '', '', '', '', '', '', ' ' . $this->currency, ' ' . $this->currency, '', '', '', '', '', '', '', '' ),
59
+ 'output_type' => array( '1', '1', '11', '1', '1', '1', '1', '1', '1', '1', '6', '6', '1', '1', '1', '1', '1', '1', '1', '1' ),
60
+ 'limit' => array( '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '' ),
61
  ),
62
  'facebook' => array(
63
+ 'mattributes' => array( 'id', 'title', 'description', 'item_group_id', 'link', 'product_type', 'fb_product_category', 'image', 'condition', 'availability', 'price', 'sale_price', 'brand', 'images_1', 'images_2', 'images_3', 'images_4', 'images_5' ),
64
+ 'prefix' => array( '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '' ),
65
+ 'type' => array( 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'pattern', 'attribute', 'pattern', 'attribute', 'attribute', 'attribute', 'pattern', 'attribute', 'attribute', 'attribute', 'attribute', 'attribute' ),
66
+ 'attributes' => array( 'id', 'title', 'description', 'item_group_id', 'link', 'product_type', '', 'image', '', 'availability', 'price', 'current_price', '', 'image_1', 'image_2', 'image_3', 'image_4', 'image_5' ),
67
+ 'default' => array( '', '', '', '', '', '', '', '', 'new', '', '', '', $this->brand_pattern, '', '', '', '', '' ),
68
+ 'suffix' => array( '', '', '', '', '', '', '', '', '', '', ' ' . $this->currency, ' ' . $this->currency, '', '', '', '', '', '' ),
69
+ 'output_type' => array( '1', '1', '11', '1', '1', '1', '1', '1', '1', '1', '6', '6', '1', '1', '1', '1', '1', '1' ),
70
+ 'limit' => array( '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '' ),
71
  ),
72
  'pinterest_rss' => array(
73
+ 'mattributes' => array( 'title', 'description', 'link', 'image', 'pubDate', 'guid' ),
74
+ 'prefix' => array( '', '', '', '', '', '' ),
75
+ 'type' => array( 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'attribute' ),
76
+ 'attributes' => array( 'title', 'description', 'link', 'image', 'date_created', 'link' ),
77
+ 'default' => array( '', '', '', '', '', '' ),
78
+ 'suffix' => array( '', '', '', '', '', '' ),
79
+ 'output_type' => array( '1', '11', '1', '1', '1', '1' ),
80
+ 'limit' => array( '', '', '', '', '', '' ),
81
  ),
82
  'bol' => array(
83
  'mattributes' => array(
2614
  'limit' => array( '', '', '', '', '', '', '', '', '' ),
2615
  ),
2616
  'adwords' => array(
2617
+ 'mattributes' => array( 'ID', 'ID2', 'Item title', 'Final URL', 'Image URL', 'Item subtitle', 'Item description', 'Item category', 'Price', 'Sale price', 'Contextual keywords', 'Item address' ),
2618
+ 'prefix' => array( '', '', '', '', '', '', '', '', '', '', '', '' ),
2619
+ 'type' => array( 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'pattern', 'pattern' ),
2620
+ 'attributes' => array( 'id', 'id', 'title', 'link', 'image', 'short_description', 'description', 'product_type', 'price', 'sale_price', '', '' ),
2621
+ 'default' => array( '', '', '', '', '', '', '', '', '', '', '', '' ),
2622
+ 'suffix' => array( '', '', '', '', '', '', '', '', ' '.$this->currency, ' '.$this->currency, '', '' ),
2623
+ 'output_type' => array( '1', '1', '1', '1', '1', '1', '11', '1', '6', '6', '1', '1' ),
2624
+ 'limit' => array( '', '', '', '', '', '', '', '', '', '', '', '' ),
2625
  ),
2626
+ 'adwords_local_product' => array(
2627
+ 'mattributes' => array( 'Rank', 'Product Item Id', 'Title', 'Description', 'Item URL', 'Image URL', 'Price', 'Store code' ),
2628
+ 'prefix' => array( '', '', '', '', '', '', '', '' ),
2629
+ 'type' => array( 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'pattern' ),
2630
+ 'attributes' => array( 'id', 'id', 'title', 'description', 'link', 'image', 'current_price', '' ),
2631
+ 'default' => array( '', '', '', '', '', '', '', '' ),
2632
+ 'suffix' => array( '', '', '', '', '', '', ' '.$this->currency, '' ),
2633
+ 'output_type' => array( '1', '1', '1', '11', '1', '1', '6', '1' ),
2634
+ 'limit' => array( '', '', '', '', '', '', '', '' ),
2635
  ),
2636
  'bing' => array(
2637
+ 'mattributes' => array( 'id', 'title', 'link', 'price', 'sale_price', 'description', 'image_link', 'mpn', 'brand', 'product_type', 'availability', 'item_group_id', 'shipping' ),
2638
+ 'prefix' => array( '', '', '', '', '', '', '', '', '', '', '', '', '' ),
2639
+ 'type' => array( 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'pattern', 'attribute', 'attribute', 'attribute', 'attribute' ),
2640
+ 'attributes' => array( 'id', 'title', 'link', 'price', 'current_price', 'description', 'image', 'sku', '', 'product_type', 'availability', 'item_group_id', 'shipping' ),
2641
+ 'default' => array( '', '', '', '', '', '', '', '', $this->brand_pattern, '', '', '', '' ),
2642
+ 'suffix' => array( '', '', '', ' '.$this->currency, ' '.$this->currency, '', '', '', '', '', '', '', '' ),
2643
+ 'output_type' => array( '1', '1', '1', '6', '6', '11', '1', '1', '1', '1', '1', '1', '1' ),
2644
+ 'limit' => array( '', '', '', '', '', '', '', '', '', '', '', '', '' ),
2645
  ),
2646
  'bing_local_inventory' => array(
2647
+ 'mattributes' => array( 'store_code', 'itemid', 'quantity', 'weeks_of_supply', 'pick_up_method', 'pick_up_sla' ),
2648
+ 'prefix' => array( '', '', '', '', '', '' ),
2649
+ 'type' => array( 'pattern', 'attribute', 'attribute', 'pattern', 'pattern', 'pattern' ),
2650
+ 'attributes' => array( '', 'id', 'quantity', '', '', '' ),
2651
+ 'default' => array( '', '', '', '', '', '' ),
2652
+ 'suffix' => array( '', '', '', '', '', '' ),
2653
+ 'output_type' => array( '1', '1', '1', '1', '1', '1' ),
2654
+ 'limit' => array( '', '', '', '', '', '' ),
2655
  ),
2656
  'google_local_inventory' => array(
2657
+ 'mattributes' => array( 'store_code', 'id', 'quantity', 'price', 'sale_price', 'sale_price_effective_date', 'availability', 'pickup_method', 'pickup_sla' ),
2658
+ 'prefix' => array( '', '', '', '', '', '', '', '', '' ),
2659
+ 'type' => array( 'pattern', 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'pattern', 'pattern' ),
2660
+ 'attributes' => array( '', 'id', 'quantity', 'price', 'sale_price', 'sale_price_effective_date', 'availability', '', '' ),
2661
+ 'default' => array( ' ', '', '', '', '', '', '', '', '' ),
2662
+ 'suffix' => array( '', '', '', ' '.$this->currency, ' '.$this->currency, '', '', '', '' ),
2663
+ 'output_type' => array( '1', '1', '1', '6', '6', '1', '1', '1', '1' ),
2664
+ 'limit' => array( '', '', '', '', '', '', '', '', '' ),
2665
  ),
2666
  'google_local' => array(
2667
+ 'mattributes' => array( 'store_code', 'id', 'title', 'description', 'image', 'upc', 'brand', 'condition', 'price', 'sale_price', 'sale_price_effective_date', 'energy_efficiency_class', 'min_energy_efficiency_class', 'max_energy_efficiency_class' ),
2668
+ 'prefix' => array( '', '', '', '', '', '', '', '', '', '', '', '', '', '' ),
2669
+ 'type' => array( 'pattern', 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'pattern', 'pattern', 'attribute', 'attribute', 'attribute', 'pattern', 'pattern', 'pattern' ),
2670
+ 'attributes' => array( '', 'id', 'title', 'description', 'image', 'sku', '', '', 'price', 'sale_price', 'sale_price_effective_date', '', '', '' ),
2671
+ 'default' => array( '', '', '', '', '', '', $this->brand_pattern, 'new', '', '', '', '', '', '' ),
2672
+ 'suffix' => array( '', '', '', '', '', '', '', '', ' '.$this->currency, ' '.$this->currency, '', '', '', '' ),
2673
+ 'output_type' => array( '1', '1', '1', '11', '1', '1', '1', '1', '6', '6', '1', '1', '1', '1' ),
2674
+ 'limit' => array( '', '', '', '', '', '', '', '', '', '', '', '', '', '' ),
2675
  ),
2676
  'google_promotions' => array(
2677
+ 'mattributes' => array( 'promotion_id', 'product_applicability', 'offer_type', 'long_title', 'promotion_effective_dates', 'redemption_channel', 'promotion_destination', 'money_off_amount' ),
2678
+ 'prefix' => array( '', '', '', '', '', '', '', '' ),
2679
+ 'type' => array( 'pattern', 'pattern', 'pattern', 'pattern', 'pattern', 'pattern', 'pattern', 'pattern' ),
2680
+ 'attributes' => array( '', '', '', '', '', '', '', '' ),
2681
+ 'default' => array( '', '', '', '', '', '', '', '' ),
2682
+ 'suffix' => array( '', '', '', '', '', '', '', '' ),
2683
+ 'output_type' => array( '1', '1', '1', '1', '1', '1', '1', '1' ),
2684
+ 'limit' => array( '', '', '', '', '', '', '', '' ),
2685
  ),
2686
  'google_dynamic_ads' => array(
2687
+ 'mattributes' => array( 'Page URL', 'Custom Label' ),
2688
+ 'prefix' => array( '', '' ),
2689
+ 'type' => array( 'attribute', 'pattern' ),
2690
+ 'attributes' => array( 'link', '' ),
2691
+ 'default' => array( '', '' ),
2692
+ 'suffix' => array( '', '' ),
2693
+ 'output_type' => array( '1', '1' ),
2694
+ 'limit' => array( '', '' ),
2695
  ),
2696
  'snapchat' => array(
2697
  'mattributes' => array( 'id', 'title', 'description', 'item_group_id', 'link', 'product_type', 'current_category', 'image', 'condition', 'availability', 'price', 'sale_price', 'sku', 'brand', 'canonical_link' ),
2704
  'limit' => array( '', '', '', '', '', '', '', '', '', '', '', '', '', '', '' ),
2705
  ),
2706
  'idealo' => array(
2707
+ 'mattributes' => array( 'sku', 'title', 'description', 'price', 'imageUrls', 'deliveryTime', 'categoryPath', 'url', 'brand', 'checkout', 'eans', 'fulfillmentType', 'checkoutLimitPerPeriod', 'size', 'colour' ),
2708
+ 'prefix' => array( '', '', '', '', '', '', '', '', '', '', '', '', '', '', '' ),
2709
+ 'type' => array( 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'pattern', 'attribute', 'attribute', 'pattern', 'pattern', 'pattern', 'pattern', 'pattern', 'attribute', 'attribute' ),
2710
+ 'attributes' => array( 'sku', 'title', 'description', 'current_price', 'images', '', 'product_type', 'link', '', '', '', '', '', 'wf_attr_pa_size', 'wf_attr_pa_color' ),
2711
+ 'default' => array( '', '', '', '', '', '1-3 working days', '', '', '', '', '', '', '', '', '' ),
2712
+ 'suffix' => array( '', '', '', ' USD', '', '', '', '', '', '', '', '', '', '', '' ),
2713
+ 'output_type' => array( '1', '1', '11', '6', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1' ),
2714
+ 'limit' => array( '', '', '', '', '', '', '', '', '', '', '', '', '', '', '' ),
2715
  ),
2716
  'pricespy' => array(
2717
  'mattributes' => array(
2873
  ),
2874
  'limit' => array( '', '', '', '', '', '', '', '', '', '', '', '', '' ),
2875
  ),
2876
+ 'miinto.de' => array(
2877
+ 'mattributes' => array( 'title', 'description', 'gtin', 'item_group_id', 'image_link', 'product_type', 'availability', 'color', 'season_tag', 'brand', 'material', 'washing', 'style_id', 'retail_price_PLN', 'retail_price_DKK', 'retail_price_EUR' ),
2878
+ 'prefix' => array( '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '' ),
2879
+ 'type' => array( 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'pattern', 'pattern', 'pattern', 'pattern', 'pattern', 'attribute', 'attribute', 'attribute' ),
2880
+ 'attributes' => array( 'title', 'description', 'id', 'item_group_id', 'image', 'product_type', 'availability', 'wf_attr_pa_color', '', '', '', '', '', 'price', 'price', 'price' ),
2881
+ 'default' => array( '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '' ),
2882
+ 'suffix' => array( '', '', '', '', '', '', '', '', '', '', '', '', '', ' USD', ' USD', ' USD' ),
2883
+ 'output_type' => array( '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '6', '6', '6' ),
2884
+ 'limit' => array( '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '' ),
2885
  ),
2886
  'miinto.nl' => array(
2887
  'mattributes' => array(
3113
  'output_type' => array( '1', '1', '8, 11', '1', '1', '1', '1', '6', '1', '1', '1', '1' ),
3114
  'limit' => array( '', '', '', '', '', '', '', '', '', '', '', '' ),
3115
  ),
3116
+ 'googlereview' => array(
3117
+ 'mattributes' => array( 'product_name', 'product_url', 'review_temp_gtin', 'review_temp_mpn', 'review_temp_sku', 'review_temp_brand' ),
3118
+ 'prefix' => array( '', '', '', '', '', '' ),
3119
+ 'type' => array( 'attribute', 'attribute', 'pattern', 'pattern', 'pattern', 'pattern' ),
3120
+ 'attributes' => array( 'title', 'link', '', '', '', '' ),
3121
+ 'default' => array( '', '', '', '', '', '' ),
3122
+ 'suffix' => array( '', '', '', '', '', '' ),
3123
+ 'output_type' => array( '1', '1', '1', '1', '1', '1' ),
3124
+ 'limit' => array( '', '', '', '', '', '' ),
3125
  ),
3126
  'google_shopping_action' => array(
3127
  'mattributes' => array(
7234
  'limit' => array( '', '', '', '', '', '', '', '', '', 'test' ),
7235
  ),
7236
  'profit_share' => array(
7237
+ 'mattributes' => array( 'Cod categorie', 'Categorie', 'Categorie parinte', 'Producator', 'Cod producator', 'Model', 'Cod produs', 'Nume ', 'Descriere', 'Link produs', 'Imagine produs', 'Pret fara TVA', 'Pret cu TVA', 'Pret cu discount fara TVA', 'Moneda', 'Disponibilitate', 'Livrare gratuita', 'Cadou inclus', 'Status', 'ID categorie parinte' ),
7238
+ 'prefix' => array( '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '' ),
7239
+ 'type' => array( 'attribute', 'attribute', 'attribute', 'attribute', 'pattern', 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'pattern', 'pattern', 'pattern', 'attribute' ),
7240
+ 'attributes' => array( 'child_category', 'child_category_id', 'primary_category', '', '', 'sku', 'id', 'title', 'description', 'link', 'image', 'current_price', 'current_price_with_tax', 'sale_price', 'store_currency', 'availability', '', '', '', 'primary_category_id' ),
7241
+ 'default' => array( '', '', '', '', '', '', '', 'Develop-pro', '', '', '', '', '', '', '', '', '1', '0', '1', '' ),
7242
+ 'suffix' => array( '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '' ),
7243
+ 'output_type' => array( '1', '1', '1', '1', '1', '1', '1', '1', '11', '1', '1', '6', '6', '6', '1', '1', '1', '1', '1', '1' ),
7244
+ 'limit' => array( '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '' ),
7245
  ),
7246
  'trendyol' => array(
7247
  'mattributes' => array( 'Barkod', 'Model Kodu', 'Marka', 'Kategori', 'Para Birimi', 'Ürün Adı', 'Ürün Açıklaması', 'Piyasa Satış Fiyatı (KDV Dahil)', 'Trendyol\'da Satılacak Fiyat (KDV Dahil)', 'Ürün Stok Adedi', 'Stok Kodu', 'KDV Oranı', 'Desi', 'Görsel Linki', 'Sevkiyat Süresi', 'Beden', 'Kol Tipi', 'Desen', 'Boy / Ölçü', 'Materyal', 'Yaş Grubu', 'Cinsiyet', 'Yaka', 'Renk' ),
7264
  'limit' => array( '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '' ),
7265
  ),
7266
  'heureka.sk' => array(
7267
+ 'mattributes' => array( 'ITEM_ID', 'PRODUCTNAME', 'PRODUCT', 'DESCRIPTION', 'URL', 'IMGURL', 'PRICE_VAT', 'CATEGORYTEXT', 'EAN' ),
7268
+ 'prefix' => array( '', '', '', '', '', '', '', '', '' ),
7269
+ 'type' => array( 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'attribute' ),
7270
+ 'attributes' => array( 'id', 'title', 'title', 'description', 'link', 'image', 'current_price_with_tax', 'product_type', 'woo_feed_ean' ),
7271
+ 'default' => array( '', '', '', '', '', '', '', '', 'Develop-pro' ),
7272
+ 'suffix' => array( '', '', '', '', '', '', '', '', '' ),
7273
+ 'output_type' => array( '1', '1', '1', '11', '1', '1', '6', '1', '1' ),
7274
+ 'limit' => array( '', '', '', '', '', '', '', '', '' ),
7275
  ),
7276
  'moebel.de' => array(
7277
+ 'mattributes' => array( 'art_nr', 'art_name', 'art_beschreibung', 'art_url', 'art_img_url', 'art_price', 'art_kategorie', 'art_verfuegbarkeit' ),
7278
+ 'prefix' => array( '', '', '', '', '', '', '', '' ),
7279
+ 'type' => array( 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'attribute' ),
7280
+ 'attributes' => array( 'id', 'title', 'description', 'link', 'image', 'price', 'product_type', 'availability' ),
7281
+ 'default' => array( '', '', '', '', '', '', '', '' ),
7282
+ 'suffix' => array( '', '', '', '', '', '', '', '' ),
7283
+ 'output_type' => array( '1', '1', '11', '1', '1', '1', '1', '1' ),
7284
+ 'limit' => array( '', '', '', '', '', '', '', '' ),
7285
  ),
7286
  'zbozi.cz' => array(
7287
+ 'mattributes' => array( 'ITEM_ID', 'PRODUCTNAME', 'DESCRIPTION', 'URL', 'IMGURL', 'CATEGORYTEXT', 'VISIBILITY', 'PRICE_VAT', 'DELIVERY_DATE' ),
7288
+ 'prefix' => array( '', '', '', '', '', '', '', '', '' ),
7289
+ 'type' => array( 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'pattern' ),
7290
+ 'attributes' => array( 'id', 'title', 'description', 'link', 'image', 'product_type', 'visibility', 'current_price_with_tax', '' ),
7291
+ 'default' => array( '', '', '', '', '', '', 'Develop-free', '', '0' ),
7292
+ 'suffix' => array( '', '', '', '', '', '', '', '', '' ),
7293
+ 'output_type' => array( '1', '1', '11', '1', '1', '1', '1', '6', '1' ),
7294
+ 'limit' => array( '', '', '', '', '', '', '', '', '' ),
7295
  ),
7296
  'catch.com.au' => array(
7297
+ 'mattributes' => array( 'product-id', 'title', 'product-description', 'image-1', 'price', 'state' ),
7298
+ 'prefix' => array( '', '', '', '', '', '' ),
7299
+ 'type' => array( 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'pattern' ),
7300
+ 'attributes' => array( 'id', 'title', 'description', 'image', 'price', '' ),
7301
+ 'default' => array( '', '', '', '', '', 'new' ),
7302
+ 'suffix' => array( '', '', '', '', '', '' ),
7303
+ 'output_type' => array( '1', '1', '11', '1', '6', '1' ),
7304
+ 'limit' => array( '', '', '', '', '', '' ),
7305
  ),
7306
  'fashionchick' => array(
7307
+ 'mattributes' => array( 'Product ID', 'Titel', 'Omschrijving', 'Url', 'Image', 'Prijs', 'Category', 'Geslacht', 'Merk' ),
7308
+ 'prefix' => array( '', '', '', '', '', '', '', '', '' ),
7309
+ 'type' => array( 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'pattern', 'pattern' ),
7310
+ 'attributes' => array( 'id', 'title', 'description', 'link', 'image', 'price', 'product_type', '', '' ),
7311
+ 'default' => array( '', '', '', '', '', '', '', 'male', '' ),
7312
+ 'suffix' => array( '', '', '', '', '', '', '', '', '' ),
7313
+ 'output_type' => array( '1', '1', '2, 11', '1', '1', '6', '1', '1', '1' ),
7314
+ 'limit' => array( '', '', '', '', '', '', '', '', '' ),
7315
  ),
7316
  'wine_searcher' => array(
7317
+ 'mattributes' => array( 'name', 'description', 'vintage', 'unit-size', 'price', 'url', 'min-order', 'tax', 'offer-type', 'delivery-time', 'stock-level' ),
7318
+ 'prefix' => array( '', '', '', '', '', '', '', '', '', '', '' ),
7319
+ 'type' => array( 'attribute', 'attribute', 'pattern', 'pattern', 'attribute', 'attribute', 'pattern', 'pattern', 'pattern', 'pattern', 'attribute' ),
7320
+ 'attributes' => array( 'title', 'description', '', '', 'price', 'link', '', '', '', '', 'quantity' ),
7321
+ 'default' => array( '', '', '', '', '', 'Develop-free', '', '', '', '', '' ),
7322
+ 'suffix' => array( '', '', '', '', '', '', '', '', '', '', '' ),
7323
+ 'output_type' => array( '1', '11', '1', '1', '6', '1', '1', '1', '1', '1', '1' ),
7324
+ 'limit' => array( '', '', '', '', '', '', '', '', '', '', '' ),
7325
  ),
7326
+ 'modalova' => array(
7327
+ 'mattributes' => array( 'id', 'title', 'description', 'link', 'sku', 'main_image', 'images', 'price', 'sale_price', 'availability', 'category', 'condition', 'child_category' ),
7328
+ 'prefix' => array( '', '', '', '', '', '', '', '', '', '', '', '', '' ),
7329
+ 'type' => array( 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'attribute' ),
7330
+ 'attributes' => array( 'id', 'title', 'description', 'link', 'sku', 'image', 'images', 'price', 'current_price', 'availability', 'primary_category', 'condition', 'child_category' ),
7331
+ 'default' => array( '', '', '', '', '', '', '', '', $this->brand_pattern, '', '', '', '' ),
7332
+ 'suffix' => array( '', '', '', '', '', '', '', '', '', '', '', '', '' ),
7333
+ 'output_type' => array( '1', '1', '11', '1', '1', '1', '1', '6', '6', '1', '1', '1', '1' ),
7334
+ 'limit' => array( '', '', '', '', '', '', '', '', '', '', '', '', '' ),
7335
  ),
7336
+ 'ecommerceit' => array(
7337
+ 'mattributes' => array( 'sku', 'qty', 'name', 'brand', 'category', 'picture_url', 'price', 'product_url', 'mpn', 'shipping_cost', 'max_delivery_days', 'delivery_label' ),
7338
+ 'prefix' => array( '', '', '', '', '', '', '', '', '', '', '', '' ),
7339
+ 'type' => array( 'attribute', 'attribute', 'attribute', 'pattern', 'attribute', 'attribute', 'attribute', 'attribute', 'pattern', 'attribute', 'pattern', 'pattern' ),
7340
+ 'attributes' => array( 'sku', 'quantity', 'title', '', 'primary_category', 'image', 'price', 'link', '', 'shipping_cost', '', '' ),
7341
+ 'default' => array( '', '', '', $this->brand_pattern, '', '', '', '', '', '', '3', '1-5 days' ),
7342
+ 'suffix' => array( '', '', '', '', '', '', '', '', '', '', '', '' ),
7343
+ 'output_type' => array( '1', '1', '1', '1', '1', '1', '6', '1', '1', '6', '1', '1' ),
7344
+ 'limit' => array( '', '', '', '', '', '', '', '', '', '', '', '' ),
7345
  ),
7346
+ 'tiktok' => array(
7347
+ 'mattributes' => array( 'sku_id', 'title', 'description', 'availability', 'link', 'image_link', 'price', 'brand', 'condition' ),
7348
+ 'prefix' => array( '', '', '', '', '', '', '', '', '' ),
7349
+ 'type' => array( 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'attribute', 'pattern', 'pattern' ),
7350
+ 'attributes' => array( 'sku_id', 'title', 'description', 'availability', 'link', 'image', 'price', '', '' ),
7351
+ 'default' => array( '', '', '', '', '', '', '', '', '' ),
7352
+ 'suffix' => array( '', '', '', '', '', '', '', '', '' ),
7353
+ 'output_type' => array( '1', '1', '1', '1', '1', '1', '6', '1', '1' ),
7354
+ 'limit' => array( '', '', '', '', '', '', '', '', '' ),
7355
  ),
7356
  );
7357
  // End of file merchant_templates.php
includes/template-infos.php CHANGED
@@ -12,13 +12,13 @@ if ( ! defined( 'ABSPATH' ) ) {
12
  die(); // silent
13
  }
14
  return array(
15
- 'default' => array(
16
  'feed_file_type' => array( 'XML', 'CSV', 'TSV', 'XLS', 'TXT' ),
17
  ),
18
- 'custom' => array(
19
  'feed_file_type' => array( 'XML', 'CSV', 'TSV', 'XLS', 'TXT', 'JSON' ),
20
  ),
21
- 'google' => array(
22
  'link' => 'https://support.google.com/merchants/answer/7052112?hl=en',
23
  'video' => 'https://youtu.be/PTUYgF7DwEo',
24
  'feed_file_type' => array( 'XML', 'CSV', 'TXT' ),
@@ -29,147 +29,147 @@ return array(
29
  esc_html__( 'How to configure google product categories?', 'woo-feed' ) => 'https://webappick.com/docs/woo-feed/feed-configuration/how-to-map-store-category-with-merchant-category/',
30
  ),
31
  ), // Google.
32
- 'google_local' => array(
33
  'link' => 'https://support.google.com/merchants/answer/3061198?hl=en',
34
  'feed_file_type' => array( 'XML', 'CSV', 'TXT' ),
35
  ),
36
- 'google_local_inventory' => array(
37
  'link' => 'https://support.google.com/merchants/answer/3061342?hl=en',
38
- 'feed_file_type' => array( 'XML', 'CSV','TXT' ),
39
  ),
40
- 'googlereview' => array(
41
  'link' => 'https://developers.google.com/product-review-feeds/sample',
42
  'feed_file_type' => array( 'XML' ),
43
  ),
44
- 'google_dynamic_ads' => array(
45
  'link' => '',
46
  'feed_file_type' => array( 'CSV' ),
47
  ),
48
- 'adwords' => array(
49
  'link' => 'https://support.google.com/google-ads/answer/6053288?hl=en',
50
  'feed_file_type' => array( 'CSV' ),
51
  ),
52
- 'adwords_local_product' => array(
53
  'link' => 'https://support.google.com/google-ads/answer/9580085?hl=en',
54
  'feed_file_type' => array( 'CSV' ),
55
  ),
56
- 'facebook' => array(
57
  'link' => 'https://www.facebook.com/business/help/120325381656392?id=725943027795860',
58
  'video' => 'https://youtu.be/Wo3V_nf_eUU',
59
- 'feed_file_type' => array( 'XML', 'CSV','TXT' ),
60
  ), // Facebook.
61
- 'pinterest' => array(
62
  'link' => 'https://help.pinterest.com/en/business/article/before-you-get-started-with-catalogs',
63
- 'feed_file_type' => array( 'XML', 'CSV','TXT' ),
64
  'doc' => array(
65
  esc_html__( 'How to configure google product categories?', 'woo-feed' ) => 'https://webappick.com/docs/woo-feed/feed-configuration/how-to-map-store-category-with-merchant-category/',
66
  ),
67
  ), // Pinterest.
68
- 'pinterest_rss' => array(
69
  'link' => 'https://help.pinterest.com/en/business/article/before-you-get-started-with-catalogs',
70
  'feed_file_type' => array( 'XML' ),
71
  ), // Pinterest.
72
- 'bing' => array(
73
  'link' => 'https://help.ads.microsoft.com/apex/index/3/en/51084',
74
- 'feed_file_type' => array( 'CSV', 'TSV', 'XLS', 'TXT'),
75
  ), // Bing.
76
- 'pricespy' => array(
77
  'link' => 'https://pricespy.co.nz/info/register-and-feature-your-shop--i10',
78
  'feed_file_type' => array( 'TXT' ),
79
  ), // PriceSpy.
80
- 'prisjakt' => array(
81
  'link' => 'https://www.prisjakt.nu/info/registrera-och-profilera-din-butik--i10',
82
  'feed_file_type' => array( 'TXT' ),
83
  ), // Prisjakt.
84
- 'idealo' => array(
85
  'link' => 'https://connect.idealo.de/import/en/csv/#_attributes_documentation',
86
  'feed_file_type' => array( 'CSV', 'TXT' ),
87
  ), // Idealo.
88
- 'yandex_csv' => array(
89
  'link' => 'https://yandex.com/support/partnermarket/export/recommendation.html#csv',
90
  'feed_file_type' => array( 'CSV', 'TXT' ),
91
  ), // Yandex (CSV).
92
- 'adroll' => array(
93
  'link' => 'https://help.adroll.com/hc/en-us/articles/216673657-Set-Up-Your-Product-Feed',
94
  'feed_file_type' => array( 'XML', 'CSV' ),
95
  ), // adroll
96
- 'adform' => array(
97
  'link' => 'https://www.adformhelp.com/s/topic/0TO3W0000008PC5WAM/good-to-know',
98
  'feed_file_type' => array( 'XML', 'CSV', 'JSON' ),
99
  ), // adform
100
- 'kelkoo' => array(
101
  'link' => 'https://developers.kelkoogroup.com/app/documentation/navigate/_publisher/feedServicePublic/_/_/MerchantFeeds#data-structure',
102
  'feed_file_type' => array( 'XML', 'CSV' ),
103
  ), // Kelkoo.
104
- 'shopmania' => array(
105
  'link' => 'https://partner.shopmania.com/cp.help/datafeed-specifications',
106
  'feed_file_type' => array( 'XML', 'CSV' ),
107
  ), // Shop Mania.
108
- 'connexity' => array(
109
  'link' => 'https://www.operationroi.com/wp-content/downloads/Connexity-Feed-Specs-09-2015.pdf',
110
  'feed_file_type' => array( 'TXT' ),
111
  ), // Connexity.
112
- 'twenga' => array(
113
  'link' => 'https://support.twenga-solutions.com/hc/en-gb/articles/115014901088-Create-a-feed-to-import-your-catalog',
114
  'feed_file_type' => array( 'XML', 'TXT' ),
115
  ), // Twenga.
116
- 'fruugo' => array(
117
  'link' => 'https://fruugo.atlassian.net/wiki/spaces/RR/pages/67608211/Field+Specification',
118
  'feed_file_type' => array( 'XML', 'CSV' ),
119
  ), // Fruugo.
120
- 'fruugo.au' => array(
121
  'link' => 'https://fruugo.atlassian.net/wiki/spaces/RR/pages/67608211/Field+Specification',
122
  'feed_file_type' => array( 'XML', 'CSV' ),
123
  ), // Fruugo Australia.
124
- 'goedgeplaatst' => array(
125
  'feed_file_type' => array( 'CSV' ),
126
  ), // GoedGeplaatst.nl.
127
- 'pricerunner' => array(
128
  'link' => 'https://www.pricerunner.com/info/getting-started',
129
  'feed_file_type' => array( 'XML', 'CSV', 'TXT' ),
130
  ), // Price Runner.
131
- 'bonanza' => array(
132
  'link' => 'https://support.bonanza.com/hc/en-us/articles/360000656491',
133
  'feed_file_type' => array( 'CSV' ),
134
  ), // Bonanza
135
- 'bol' => array(
136
  'link' => 'https://partnerblog.bol.com/app/files/2018/02/Kolomnamen_productfeeds-2.2.pdf',
137
  'feed_file_type' => array( 'XML', 'CSV' ),
138
  ), // Bol.
139
- 'wish' => array(
140
  'link' => 'https://merchantfaq.wish.com/hc/en-us/articles/204530468',
141
  'feed_file_type' => array( 'CSV' ),
142
  ), // Wish.com.
143
- 'myshopping.com.au' => array(
144
  'link' => 'https://merchant.myshopping.com.au/doc/Product_Feed_Specification.pdf',
145
  'feed_file_type' => array( 'XML', 'CSV', 'TXT' ),
146
  ), // Myshopping.com.au.
147
- 'skinflint.co.uk' => array(
148
  'feed_file_type' => array( 'CSV' ),
149
  ), // SkinFlint.co.uk.
150
- 'yahoo_nfa' => array(
151
  'feed_file_type' => array( 'XML', 'CSV', 'TXT' ),
152
  ), // Yahoo NFA.
153
- 'comparer.be' => array(
154
  'link' => 'https://sc.vergelijk.nl/data/fr_FR/ignore/folders/annexe_3-directives_fichier.pdf',
155
  'feed_file_type' => array( 'XML', 'CSV' ),
156
  ), // Comparer.be.
157
- 'rakuten.de' => array(
158
  'link' => 'https://rakutenadvertising.com/product-feed-specification/',
159
  'feed_file_type' => array( 'CSV', 'TXT' ),
160
  ), // rakuten.
161
- 'avantlink' => array(
162
  'link' => 'https://support.avantlink.com/hc/en-us/articles/203883345-All-About-Datafeeds',
163
  'feed_file_type' => array( 'XML', 'CSV', 'TXT' ),
164
  ), // Avantlink
165
- 'shareasale' => array(
166
  'link' => 'https://blog.shareasale.com/2013/07/18/how-to-create-a-product-datafeed/',
167
  'feed_file_type' => array( 'XML', 'CSV', 'TXT' ),
168
  ), // ShareASale.
169
- 'trovaprezzi' => array(
170
  'feed_file_type' => array( 'XML', 'CSV', 'TXT' ),
171
  ), // trovaprezzi.it.
172
- 'skroutz' => array(
173
  'link' => 'https://developer.skroutz.gr/feedspec/',
174
  'video' => '',
175
  'doc' => array(
@@ -177,11 +177,11 @@ return array(
177
  ),
178
  'feed_file_type' => array( 'XML' ),
179
  ),
180
- 'bestprice' => array(
181
  'link' => 'https://merchants.bestprice.gr/assets/bestprice-xml-specification.pdf',
182
  'feed_file_type' => array( 'XML' ),
183
  ),
184
- 'google_shopping_action' => array(
185
  'link' => 'https://support.google.com/merchants/answer/9111285',
186
  'video' => '',
187
  'doc' => array(
@@ -190,7 +190,7 @@ return array(
190
  ),
191
  'feed_file_type' => array( 'XML', 'CSV' ),
192
  ), // Google Shopping Action
193
- 'daisycon' => array(
194
  'link' => 'https://faq-advertiser.daisycon.com/hc/en-us/articles/115000721785--As-an-advertiser-how-do-I-submit-a-product-feed-',
195
  'video' => '',
196
  'doc' => array(
@@ -199,7 +199,7 @@ return array(
199
  ),
200
  'feed_file_type' => array( 'XML', 'CSV' ),
201
  ), // Daisycon Advertiser: General
202
- 'daisycon_automotive' => array(
203
  'link' => 'https://faq-advertiser.daisycon.com/hc/en-us/articles/115000721785--As-an-advertiser-how-do-I-submit-a-product-feed-',
204
  'video' => '',
205
  'doc' => array(
@@ -208,7 +208,7 @@ return array(
208
  ),
209
  'feed_file_type' => array( 'XML', 'CSV' ),
210
  ), // Daisycon Advertiser: Automotive
211
- 'daisycon_books' => array(
212
  'link' => 'https://faq-advertiser.daisycon.com/hc/en-us/articles/115000721785--As-an-advertiser-how-do-I-submit-a-product-feed-',
213
  'video' => '',
214
  'doc' => array(
@@ -217,7 +217,7 @@ return array(
217
  ),
218
  'feed_file_type' => array( 'XML', 'CSV' ),
219
  ), // Daisycon Advertiser: Books
220
- 'daisycon_cosmetics' => array(
221
  'link' => 'https://faq-advertiser.daisycon.com/hc/en-us/articles/115000721785--As-an-advertiser-how-do-I-submit-a-product-feed-',
222
  'video' => '',
223
  'doc' => array(
@@ -226,7 +226,7 @@ return array(
226
  ),
227
  'feed_file_type' => array( 'XML', 'CSV' ),
228
  ), // Daisycon Advertiser: Cosmetics
229
- 'daisycon_daily_offers' => array(
230
  'link' => 'https://faq-advertiser.daisycon.com/hc/en-us/articles/115000721785--As-an-advertiser-how-do-I-submit-a-product-feed-',
231
  'video' => '',
232
  'doc' => array(
@@ -235,7 +235,7 @@ return array(
235
  ),
236
  'feed_file_type' => array( 'XML', 'CSV' ),
237
  ), // Daisycon Advertiser: Daily Offers
238
- 'daisycon_electronics' => array(
239
  'link' => 'https://faq-advertiser.daisycon.com/hc/en-us/articles/115000721785--As-an-advertiser-how-do-I-submit-a-product-feed-',
240
  'video' => '',
241
  'doc' => array(
@@ -244,7 +244,7 @@ return array(
244
  ),
245
  'feed_file_type' => array( 'XML', 'CSV' ),
246
  ), // Daisycon Advertiser: Electronics
247
- 'daisycon_food_drinks' => array(
248
  'link' => 'https://faq-advertiser.daisycon.com/hc/en-us/articles/115000721785--As-an-advertiser-how-do-I-submit-a-product-feed-',
249
  'video' => '',
250
  'doc' => array(
@@ -253,7 +253,7 @@ return array(
253
  ),
254
  'feed_file_type' => array( 'XML', 'CSV' ),
255
  ), // Daisycon Advertiser: Food & Drinks
256
- 'daisycon_home_garden' => array(
257
  'link' => 'https://faq-advertiser.daisycon.com/hc/en-us/articles/115000721785--As-an-advertiser-how-do-I-submit-a-product-feed-',
258
  'video' => '',
259
  'doc' => array(
@@ -262,7 +262,7 @@ return array(
262
  ),
263
  'feed_file_type' => array( 'XML' ),
264
  ), // Daisycon Advertiser: Home & Garden
265
- 'daisycon_housing' => array(
266
  'link' => 'https://faq-advertiser.daisycon.com/hc/en-us/articles/115000721785--As-an-advertiser-how-do-I-submit-a-product-feed-',
267
  'video' => '',
268
  'doc' => array(
@@ -271,7 +271,7 @@ return array(
271
  ),
272
  'feed_file_type' => array( 'XML', 'CSV' ),
273
  ), // Daisycon Advertiser: Housing
274
- 'daisycon_fashion' => array(
275
  'link' => 'https://faq-advertiser.daisycon.com/hc/en-us/articles/115000721785--As-an-advertiser-how-do-I-submit-a-product-feed-',
276
  'video' => '',
277
  'doc' => array(
@@ -280,7 +280,7 @@ return array(
280
  ),
281
  'feed_file_type' => array( 'XML', 'CSV' ),
282
  ), // Daisycon Advertiser: Fashion
283
- 'daisycon_studies_trainings' => array(
284
  'link' => 'https://faq-advertiser.daisycon.com/hc/en-us/articles/115000721785--As-an-advertiser-how-do-I-submit-a-product-feed-',
285
  'video' => '',
286
  'doc' => array(
@@ -289,7 +289,7 @@ return array(
289
  ),
290
  'feed_file_type' => array( 'XML', 'CSV' ),
291
  ), // Daisycon Advertiser: Studies & Trainings
292
- 'daisycon_telecom_accessories' => array(
293
  'link' => 'https://faq-advertiser.daisycon.com/hc/en-us/articles/115000721785--As-an-advertiser-how-do-I-submit-a-product-feed-',
294
  'video' => '',
295
  'doc' => array(
@@ -298,7 +298,7 @@ return array(
298
  ),
299
  'feed_file_type' => array( 'XML', 'CSV' ),
300
  ), // Daisycon Advertiser: Telecom: Accessories
301
- 'daisycon_telecom_all_in_one' => array(
302
  'link' => 'https://faq-advertiser.daisycon.com/hc/en-us/articles/115000721785--As-an-advertiser-how-do-I-submit-a-product-feed-',
303
  'video' => '',
304
  'doc' => array(
@@ -307,7 +307,7 @@ return array(
307
  ),
308
  'feed_file_type' => array( 'XML', 'CSV' ),
309
  ), // Daisycon Advertiser: Telecom: All-in-one
310
- 'daisycon_telecom_gsm_subscription' => array(
311
  'link' => 'https://faq-advertiser.daisycon.com/hc/en-us/articles/115000721785--As-an-advertiser-how-do-I-submit-a-product-feed-',
312
  'video' => '',
313
  'doc' => array(
@@ -316,7 +316,7 @@ return array(
316
  ),
317
  'feed_file_type' => array( 'XML', 'CSV' ),
318
  ), // Daisycon Advertiser: Telecom: GSM + Subscription
319
- 'daisycon_telecom_gsm' => array(
320
  'link' => 'https://faq-advertiser.daisycon.com/hc/en-us/articles/115000721785--As-an-advertiser-how-do-I-submit-a-product-feed-',
321
  'video' => '',
322
  'doc' => array(
@@ -325,7 +325,7 @@ return array(
325
  ),
326
  'feed_file_type' => array( 'XML', 'CSV' ),
327
  ), // Daisycon Advertiser: Telecom: GSM only
328
- 'daisycon_telecom_sim' => array(
329
  'link' => 'https://faq-advertiser.daisycon.com/hc/en-us/articles/115000721785--As-an-advertiser-how-do-I-submit-a-product-feed-',
330
  'video' => '',
331
  'doc' => array(
@@ -334,7 +334,7 @@ return array(
334
  ),
335
  'feed_file_type' => array( 'XML', 'CSV' ),
336
  ), // Daisycon Advertiser: Telecom: Sim only
337
- 'daisycon_magazines' => array(
338
  'link' => 'https://faq-advertiser.daisycon.com/hc/en-us/articles/115000721785--As-an-advertiser-how-do-I-submit-a-product-feed-',
339
  'video' => '',
340
  'doc' => array(
@@ -343,7 +343,7 @@ return array(
343
  ),
344
  'feed_file_type' => array( 'XML', 'CSV' ),
345
  ), // Daisycon Advertiser: Magazines
346
- 'daisycon_holidays_accommodations' => array(
347
  'link' => 'https://faq-advertiser.daisycon.com/hc/en-us/articles/115000721785--As-an-advertiser-how-do-I-submit-a-product-feed-',
348
  'video' => '',
349
  'doc' => array(
@@ -361,7 +361,7 @@ return array(
361
  ),
362
  'feed_file_type' => array( 'XML', 'CSV' ),
363
  ), // Daisycon Advertiser: Holidays: Accommodations and transport
364
- 'daisycon_holidays_trips' => array(
365
  'link' => 'https://faq-advertiser.daisycon.com/hc/en-us/articles/115000721785--As-an-advertiser-how-do-I-submit-a-product-feed-',
366
  'video' => '',
367
  'doc' => array(
@@ -370,7 +370,7 @@ return array(
370
  ),
371
  'feed_file_type' => array( 'XML', 'CSV' ),
372
  ), // Daisycon Advertiser: Holidays: Trips
373
- 'daisycon_work_jobs' => array(
374
  'link' => 'https://faq-advertiser.daisycon.com/hc/en-us/articles/115000721785--As-an-advertiser-how-do-I-submit-a-product-feed-',
375
  'video' => '',
376
  'doc' => array(
@@ -379,60 +379,60 @@ return array(
379
  ),
380
  'feed_file_type' => array( 'XML', 'CSV' ),
381
  ), // Daisycon Advertiser: Work & Jobs
382
- 'spartoo.fi' => array(
383
  'feed_file_type' => array( 'CSV' ),
384
  ),
385
- 'shopee' => array(
386
  'feed_file_type' => array( 'CSV' ),
387
  ),
388
- 'zalando' => array(
389
  'link' => 'https://docs.partner-solutions.zalan.do/de/fci/getting-started.html#format',
390
  'feed_file_type' => array( 'CSV' ),
391
  ),
392
- 'etsy' => array(
393
  'feed_file_type' => array( 'CSV' ),
394
  ),
395
- 'tweaker_xml' => array(
396
  'link' => 'https://webappick.com/wp-content/uploads/2020/08/Specificaties-productfeed-Tweakers-Pricewatch.pdf',
397
  'feed_file_type' => array( 'XML' ),
398
  ),
399
- 'tweaker_csv' => array(
400
  'link' => 'https://webappick.com/wp-content/uploads/2020/08/Specificaties-productfeed-Tweakers-Pricewatch.pdf',
401
  'feed_file_type' => array( 'CSV' ),
402
  ),
403
- 'profit_share' => array(
404
  'link' => 'https://support.profitshare.ro/hc/ro/articles/211436229-Importul-produselor-prin-CSV',
405
  'feed_file_type' => array( 'CSV' ),
406
  ),
407
- 'heureka.sk' => array(
408
  'link' => 'https://sluzby.heureka.sk/napoveda/xml-feed/',
409
  'feed_file_type' => array( 'XML' ),
410
  ),
411
- 'moebel.de' => array(
412
  'link' => 'https://feedonomics.com/supported-channels/moebel-de-feed-specifications/',
413
  'feed_file_type' => array( 'XML', 'CSV', 'TXT' ),
414
  ),
415
- 'zbozi.cz' => array(
416
  'link' => 'https://napoveda.sklik.cz/wp-content/uploads/offer_feed_en.pdf',
417
  'feed_file_type' => array( 'XML' ),
418
  ),
419
- 'catchdotcom' => array(
420
  'feed_file_type' => array( 'XML' ),
421
  ),
422
- 'fashionchick' => array(
423
  'feed_file_type' => array( 'CSV', 'TXT' ),
424
  ),
425
- 'wine_searcher' => array(
426
  'feed_file_type' => array( 'XML', 'TXT' ),
427
  ),
428
- 'modalova' => array(
429
  'feed_file_type' => array( 'XML' ),
430
  ),
431
- 'ecommerceit' => array(
432
  'link' => 'https://media.ecommerce.eu/merchant/templates/catalog.csv',
433
  'feed_file_type' => array( 'CSV' ),
434
  ),
435
- 'tiktok' => array(
436
  'link' => 'https://ads.tiktok.com/help/article?aid=10001006',
437
  'feed_file_type' => array( 'XML', 'CSV' ),
438
  ),
12
  die(); // silent
13
  }
14
  return array(
15
+ 'default' => array(
16
  'feed_file_type' => array( 'XML', 'CSV', 'TSV', 'XLS', 'TXT' ),
17
  ),
18
+ 'custom' => array(
19
  'feed_file_type' => array( 'XML', 'CSV', 'TSV', 'XLS', 'TXT', 'JSON' ),
20
  ),
21
+ 'google' => array(
22
  'link' => 'https://support.google.com/merchants/answer/7052112?hl=en',
23
  'video' => 'https://youtu.be/PTUYgF7DwEo',
24
  'feed_file_type' => array( 'XML', 'CSV', 'TXT' ),
29
  esc_html__( 'How to configure google product categories?', 'woo-feed' ) => 'https://webappick.com/docs/woo-feed/feed-configuration/how-to-map-store-category-with-merchant-category/',
30
  ),
31
  ), // Google.
32
+ 'google_local' => array(
33
  'link' => 'https://support.google.com/merchants/answer/3061198?hl=en',
34
  'feed_file_type' => array( 'XML', 'CSV', 'TXT' ),
35
  ),
36
+ 'google_local_inventory' => array(
37
  'link' => 'https://support.google.com/merchants/answer/3061342?hl=en',
38
+ 'feed_file_type' => array( 'XML', 'CSV', 'TXT' ),
39
  ),
40
+ 'googlereview' => array(
41
  'link' => 'https://developers.google.com/product-review-feeds/sample',
42
  'feed_file_type' => array( 'XML' ),
43
  ),
44
+ 'google_dynamic_ads' => array(
45
  'link' => '',
46
  'feed_file_type' => array( 'CSV' ),
47
  ),
48
+ 'adwords' => array(
49
  'link' => 'https://support.google.com/google-ads/answer/6053288?hl=en',
50
  'feed_file_type' => array( 'CSV' ),
51
  ),
52
+ 'adwords_local_product' => array(
53
  'link' => 'https://support.google.com/google-ads/answer/9580085?hl=en',
54
  'feed_file_type' => array( 'CSV' ),
55
  ),
56
+ 'facebook' => array(
57
  'link' => 'https://www.facebook.com/business/help/120325381656392?id=725943027795860',
58
  'video' => 'https://youtu.be/Wo3V_nf_eUU',
59
+ 'feed_file_type' => array( 'XML', 'CSV', 'TXT' ),
60
  ), // Facebook.
61
+ 'pinterest' => array(
62
  'link' => 'https://help.pinterest.com/en/business/article/before-you-get-started-with-catalogs',
63
+ 'feed_file_type' => array( 'XML', 'CSV', 'TXT' ),
64
  'doc' => array(
65
  esc_html__( 'How to configure google product categories?', 'woo-feed' ) => 'https://webappick.com/docs/woo-feed/feed-configuration/how-to-map-store-category-with-merchant-category/',
66
  ),
67
  ), // Pinterest.
68
+ 'pinterest_rss' => array(
69
  'link' => 'https://help.pinterest.com/en/business/article/before-you-get-started-with-catalogs',
70
  'feed_file_type' => array( 'XML' ),
71
  ), // Pinterest.
72
+ 'bing' => array(
73
  'link' => 'https://help.ads.microsoft.com/apex/index/3/en/51084',
74
+ 'feed_file_type' => array( 'CSV', 'TSV', 'XLS', 'TXT' ),
75
  ), // Bing.
76
+ 'pricespy' => array(
77
  'link' => 'https://pricespy.co.nz/info/register-and-feature-your-shop--i10',
78
  'feed_file_type' => array( 'TXT' ),
79
  ), // PriceSpy.
80
+ 'prisjakt' => array(
81
  'link' => 'https://www.prisjakt.nu/info/registrera-och-profilera-din-butik--i10',
82
  'feed_file_type' => array( 'TXT' ),
83
  ), // Prisjakt.
84
+ 'idealo' => array(
85
  'link' => 'https://connect.idealo.de/import/en/csv/#_attributes_documentation',
86
  'feed_file_type' => array( 'CSV', 'TXT' ),
87
  ), // Idealo.
88
+ 'yandex_csv' => array(
89
  'link' => 'https://yandex.com/support/partnermarket/export/recommendation.html#csv',
90
  'feed_file_type' => array( 'CSV', 'TXT' ),
91
  ), // Yandex (CSV).
92
+ 'adroll' => array(
93
  'link' => 'https://help.adroll.com/hc/en-us/articles/216673657-Set-Up-Your-Product-Feed',
94
  'feed_file_type' => array( 'XML', 'CSV' ),
95
  ), // adroll
96
+ 'adform' => array(
97
  'link' => 'https://www.adformhelp.com/s/topic/0TO3W0000008PC5WAM/good-to-know',
98
  'feed_file_type' => array( 'XML', 'CSV', 'JSON' ),
99
  ), // adform
100
+ 'kelkoo' => array(
101
  'link' => 'https://developers.kelkoogroup.com/app/documentation/navigate/_publisher/feedServicePublic/_/_/MerchantFeeds#data-structure',
102
  'feed_file_type' => array( 'XML', 'CSV' ),
103
  ), // Kelkoo.
104
+ 'shopmania' => array(
105
  'link' => 'https://partner.shopmania.com/cp.help/datafeed-specifications',
106
  'feed_file_type' => array( 'XML', 'CSV' ),
107
  ), // Shop Mania.
108
+ 'connexity' => array(
109
  'link' => 'https://www.operationroi.com/wp-content/downloads/Connexity-Feed-Specs-09-2015.pdf',
110
  'feed_file_type' => array( 'TXT' ),
111
  ), // Connexity.
112
+ 'twenga' => array(
113
  'link' => 'https://support.twenga-solutions.com/hc/en-gb/articles/115014901088-Create-a-feed-to-import-your-catalog',
114
  'feed_file_type' => array( 'XML', 'TXT' ),
115
  ), // Twenga.
116
+ 'fruugo' => array(
117
  'link' => 'https://fruugo.atlassian.net/wiki/spaces/RR/pages/67608211/Field+Specification',
118
  'feed_file_type' => array( 'XML', 'CSV' ),
119
  ), // Fruugo.
120
+ 'fruugo.au' => array(
121
  'link' => 'https://fruugo.atlassian.net/wiki/spaces/RR/pages/67608211/Field+Specification',
122
  'feed_file_type' => array( 'XML', 'CSV' ),
123
  ), // Fruugo Australia.
124
+ 'goedgeplaatst' => array(
125
  'feed_file_type' => array( 'CSV' ),
126
  ), // GoedGeplaatst.nl.
127
+ 'pricerunner' => array(
128
  'link' => 'https://www.pricerunner.com/info/getting-started',
129
  'feed_file_type' => array( 'XML', 'CSV', 'TXT' ),
130
  ), // Price Runner.
131
+ 'bonanza' => array(
132
  'link' => 'https://support.bonanza.com/hc/en-us/articles/360000656491',
133
  'feed_file_type' => array( 'CSV' ),
134
  ), // Bonanza
135
+ 'bol' => array(
136
  'link' => 'https://partnerblog.bol.com/app/files/2018/02/Kolomnamen_productfeeds-2.2.pdf',
137
  'feed_file_type' => array( 'XML', 'CSV' ),
138
  ), // Bol.
139
+ 'wish' => array(
140
  'link' => 'https://merchantfaq.wish.com/hc/en-us/articles/204530468',
141
  'feed_file_type' => array( 'CSV' ),
142
  ), // Wish.com.
143
+ 'myshopping.com.au' => array(
144
  'link' => 'https://merchant.myshopping.com.au/doc/Product_Feed_Specification.pdf',
145
  'feed_file_type' => array( 'XML', 'CSV', 'TXT' ),
146
  ), // Myshopping.com.au.
147
+ 'skinflint.co.uk' => array(
148
  'feed_file_type' => array( 'CSV' ),
149
  ), // SkinFlint.co.uk.
150
+ 'yahoo_nfa' => array(
151
  'feed_file_type' => array( 'XML', 'CSV', 'TXT' ),
152
  ), // Yahoo NFA.
153
+ 'comparer.be' => array(
154
  'link' => 'https://sc.vergelijk.nl/data/fr_FR/ignore/folders/annexe_3-directives_fichier.pdf',
155
  'feed_file_type' => array( 'XML', 'CSV' ),
156
  ), // Comparer.be.
157
+ 'rakuten.de' => array(
158
  'link' => 'https://rakutenadvertising.com/product-feed-specification/',
159
  'feed_file_type' => array( 'CSV', 'TXT' ),
160
  ), // rakuten.
161
+ 'avantlink' => array(
162
  'link' => 'https://support.avantlink.com/hc/en-us/articles/203883345-All-About-Datafeeds',
163
  'feed_file_type' => array( 'XML', 'CSV', 'TXT' ),
164
  ), // Avantlink
165
+ 'shareasale' => array(
166
  'link' => 'https://blog.shareasale.com/2013/07/18/how-to-create-a-product-datafeed/',
167
  'feed_file_type' => array( 'XML', 'CSV', 'TXT' ),
168
  ), // ShareASale.
169
+ 'trovaprezzi' => array(
170
  'feed_file_type' => array( 'XML', 'CSV', 'TXT' ),
171
  ), // trovaprezzi.it.
172
+ 'skroutz' => array(
173
  'link' => 'https://developer.skroutz.gr/feedspec/',
174
  'video' => '',
175
  'doc' => array(
177
  ),
178
  'feed_file_type' => array( 'XML' ),
179
  ),
180
+ 'bestprice' => array(
181
  'link' => 'https://merchants.bestprice.gr/assets/bestprice-xml-specification.pdf',
182
  'feed_file_type' => array( 'XML' ),
183
  ),
184
+ 'google_shopping_action' => array(
185
  'link' => 'https://support.google.com/merchants/answer/9111285',
186
  'video' => '',
187
  'doc' => array(
190
  ),
191
  'feed_file_type' => array( 'XML', 'CSV' ),
192
  ), // Google Shopping Action
193
+ 'daisycon' => array(
194
  'link' => 'https://faq-advertiser.daisycon.com/hc/en-us/articles/115000721785--As-an-advertiser-how-do-I-submit-a-product-feed-',
195
  'video' => '',
196
  'doc' => array(
199
  ),
200
  'feed_file_type' => array( 'XML', 'CSV' ),
201
  ), // Daisycon Advertiser: General
202
+ 'daisycon_automotive' => array(
203
  'link' => 'https://faq-advertiser.daisycon.com/hc/en-us/articles/115000721785--As-an-advertiser-how-do-I-submit-a-product-feed-',
204
  'video' => '',
205
  'doc' => array(
208
  ),
209
  'feed_file_type' => array( 'XML', 'CSV' ),
210
  ), // Daisycon Advertiser: Automotive
211
+ 'daisycon_books' => array(
212
  'link' => 'https://faq-advertiser.daisycon.com/hc/en-us/articles/115000721785--As-an-advertiser-how-do-I-submit-a-product-feed-',
213
  'video' => '',
214
  'doc' => array(
217
  ),
218
  'feed_file_type' => array( 'XML', 'CSV' ),
219
  ), // Daisycon Advertiser: Books
220
+ 'daisycon_cosmetics' => array(
221
  'link' => 'https://faq-advertiser.daisycon.com/hc/en-us/articles/115000721785--As-an-advertiser-how-do-I-submit-a-product-feed-',
222
  'video' => '',
223
  'doc' => array(
226
  ),
227
  'feed_file_type' => array( 'XML', 'CSV' ),
228
  ), // Daisycon Advertiser: Cosmetics
229
+ 'daisycon_daily_offers' => array(
230
  'link' => 'https://faq-advertiser.daisycon.com/hc/en-us/articles/115000721785--As-an-advertiser-how-do-I-submit-a-product-feed-',
231
  'video' => '',
232
  'doc' => array(
235
  ),
236
  'feed_file_type' => array( 'XML', 'CSV' ),
237
  ), // Daisycon Advertiser: Daily Offers
238
+ 'daisycon_electronics' => array(
239
  'link' => 'https://faq-advertiser.daisycon.com/hc/en-us/articles/115000721785--As-an-advertiser-how-do-I-submit-a-product-feed-',
240
  'video' => '',
241
  'doc' => array(
244
  ),
245
  'feed_file_type' => array( 'XML', 'CSV' ),
246
  ), // Daisycon Advertiser: Electronics
247
+ 'daisycon_food_drinks' => array(
248
  'link' => 'https://faq-advertiser.daisycon.com/hc/en-us/articles/115000721785--As-an-advertiser-how-do-I-submit-a-product-feed-',
249
  'video' => '',
250
  'doc' => array(
253
  ),
254
  'feed_file_type' => array( 'XML', 'CSV' ),
255
  ), // Daisycon Advertiser: Food & Drinks
256
+ 'daisycon_home_garden' => array(
257
  'link' => 'https://faq-advertiser.daisycon.com/hc/en-us/articles/115000721785--As-an-advertiser-how-do-I-submit-a-product-feed-',
258
  'video' => '',
259
  'doc' => array(
262
  ),
263
  'feed_file_type' => array( 'XML' ),
264
  ), // Daisycon Advertiser: Home & Garden
265
+ 'daisycon_housing' => array(
266
  'link' => 'https://faq-advertiser.daisycon.com/hc/en-us/articles/115000721785--As-an-advertiser-how-do-I-submit-a-product-feed-',
267
  'video' => '',
268
  'doc' => array(
271
  ),
272
  'feed_file_type' => array( 'XML', 'CSV' ),
273
  ), // Daisycon Advertiser: Housing
274
+ 'daisycon_fashion' => array(
275
  'link' => 'https://faq-advertiser.daisycon.com/hc/en-us/articles/115000721785--As-an-advertiser-how-do-I-submit-a-product-feed-',
276
  'video' => '',
277
  'doc' => array(
280
  ),
281
  'feed_file_type' => array( 'XML', 'CSV' ),
282
  ), // Daisycon Advertiser: Fashion
283
+ 'daisycon_studies_trainings' => array(
284
  'link' => 'https://faq-advertiser.daisycon.com/hc/en-us/articles/115000721785--As-an-advertiser-how-do-I-submit-a-product-feed-',
285
  'video' => '',
286
  'doc' => array(
289
  ),
290
  'feed_file_type' => array( 'XML', 'CSV' ),
291
  ), // Daisycon Advertiser: Studies & Trainings
292
+ 'daisycon_telecom_accessories' => array(
293
  'link' => 'https://faq-advertiser.daisycon.com/hc/en-us/articles/115000721785--As-an-advertiser-how-do-I-submit-a-product-feed-',
294
  'video' => '',
295
  'doc' => array(
298
  ),
299
  'feed_file_type' => array( 'XML', 'CSV' ),
300
  ), // Daisycon Advertiser: Telecom: Accessories
301
+ 'daisycon_telecom_all_in_one' => array(
302
  'link' => 'https://faq-advertiser.daisycon.com/hc/en-us/articles/115000721785--As-an-advertiser-how-do-I-submit-a-product-feed-',
303
  'video' => '',
304
  'doc' => array(
307
  ),
308
  'feed_file_type' => array( 'XML', 'CSV' ),
309
  ), // Daisycon Advertiser: Telecom: All-in-one
310
+ 'daisycon_telecom_gsm_subscription' => array(
311
  'link' => 'https://faq-advertiser.daisycon.com/hc/en-us/articles/115000721785--As-an-advertiser-how-do-I-submit-a-product-feed-',
312
  'video' => '',
313
  'doc' => array(
316
  ),
317
  'feed_file_type' => array( 'XML', 'CSV' ),
318
  ), // Daisycon Advertiser: Telecom: GSM + Subscription
319
+ 'daisycon_telecom_gsm' => array(
320
  'link' => 'https://faq-advertiser.daisycon.com/hc/en-us/articles/115000721785--As-an-advertiser-how-do-I-submit-a-product-feed-',
321
  'video' => '',
322
  'doc' => array(
325
  ),
326
  'feed_file_type' => array( 'XML', 'CSV' ),
327
  ), // Daisycon Advertiser: Telecom: GSM only
328
+ 'daisycon_telecom_sim' => array(
329
  'link' => 'https://faq-advertiser.daisycon.com/hc/en-us/articles/115000721785--As-an-advertiser-how-do-I-submit-a-product-feed-',
330
  'video' => '',
331
  'doc' => array(
334
  ),
335
  'feed_file_type' => array( 'XML', 'CSV' ),
336
  ), // Daisycon Advertiser: Telecom: Sim only
337
+ 'daisycon_magazines' => array(
338
  'link' => 'https://faq-advertiser.daisycon.com/hc/en-us/articles/115000721785--As-an-advertiser-how-do-I-submit-a-product-feed-',
339
  'video' => '',
340
  'doc' => array(
343
  ),
344
  'feed_file_type' => array( 'XML', 'CSV' ),
345
  ), // Daisycon Advertiser: Magazines
346
+ 'daisycon_holidays_accommodations' => array(
347
  'link' => 'https://faq-advertiser.daisycon.com/hc/en-us/articles/115000721785--As-an-advertiser-how-do-I-submit-a-product-feed-',
348
  'video' => '',
349
  'doc' => array(
361
  ),
362
  'feed_file_type' => array( 'XML', 'CSV' ),
363
  ), // Daisycon Advertiser: Holidays: Accommodations and transport
364
+ 'daisycon_holidays_trips' => array(
365
  'link' => 'https://faq-advertiser.daisycon.com/hc/en-us/articles/115000721785--As-an-advertiser-how-do-I-submit-a-product-feed-',
366
  'video' => '',
367
  'doc' => array(
370
  ),
371
  'feed_file_type' => array( 'XML', 'CSV' ),
372
  ), // Daisycon Advertiser: Holidays: Trips
373
+ 'daisycon_work_jobs' => array(
374
  'link' => 'https://faq-advertiser.daisycon.com/hc/en-us/articles/115000721785--As-an-advertiser-how-do-I-submit-a-product-feed-',
375
  'video' => '',
376
  'doc' => array(
379
  ),
380
  'feed_file_type' => array( 'XML', 'CSV' ),
381
  ), // Daisycon Advertiser: Work & Jobs
382
+ 'spartoo.fi' => array(
383
  'feed_file_type' => array( 'CSV' ),
384
  ),
385
+ 'shopee' => array(
386
  'feed_file_type' => array( 'CSV' ),
387
  ),
388
+ 'zalando' => array(
389
  'link' => 'https://docs.partner-solutions.zalan.do/de/fci/getting-started.html#format',
390
  'feed_file_type' => array( 'CSV' ),
391
  ),
392
+ 'etsy' => array(
393
  'feed_file_type' => array( 'CSV' ),
394
  ),
395
+ 'tweaker_xml' => array(
396
  'link' => 'https://webappick.com/wp-content/uploads/2020/08/Specificaties-productfeed-Tweakers-Pricewatch.pdf',
397
  'feed_file_type' => array( 'XML' ),
398
  ),
399
+ 'tweaker_csv' => array(
400
  'link' => 'https://webappick.com/wp-content/uploads/2020/08/Specificaties-productfeed-Tweakers-Pricewatch.pdf',
401
  'feed_file_type' => array( 'CSV' ),
402
  ),
403
+ 'profit_share' => array(
404
  'link' => 'https://support.profitshare.ro/hc/ro/articles/211436229-Importul-produselor-prin-CSV',
405
  'feed_file_type' => array( 'CSV' ),
406
  ),
407
+ 'heureka.sk' => array(
408
  'link' => 'https://sluzby.heureka.sk/napoveda/xml-feed/',
409
  'feed_file_type' => array( 'XML' ),
410
  ),
411
+ 'moebel.de' => array(
412
  'link' => 'https://feedonomics.com/supported-channels/moebel-de-feed-specifications/',
413
  'feed_file_type' => array( 'XML', 'CSV', 'TXT' ),
414
  ),
415
+ 'zbozi.cz' => array(
416
  'link' => 'https://napoveda.sklik.cz/wp-content/uploads/offer_feed_en.pdf',
417
  'feed_file_type' => array( 'XML' ),
418
  ),
419
+ 'catchdotcom' => array(
420
  'feed_file_type' => array( 'XML' ),
421
  ),
422
+ 'fashionchick' => array(
423
  'feed_file_type' => array( 'CSV', 'TXT' ),
424
  ),
425
+ 'wine_searcher' => array(
426
  'feed_file_type' => array( 'XML', 'TXT' ),
427
  ),
428
+ 'modalova' => array(
429
  'feed_file_type' => array( 'XML' ),
430
  ),
431
+ 'ecommerceit' => array(
432
  'link' => 'https://media.ecommerce.eu/merchant/templates/catalog.csv',
433
  'feed_file_type' => array( 'CSV' ),
434
  ),
435
+ 'tiktok' => array(
436
  'link' => 'https://ads.tiktok.com/help/article?aid=10001006',
437
  'feed_file_type' => array( 'XML', 'CSV' ),
438
  ),
languages/woo-feed.pot CHANGED
@@ -16,7 +16,7 @@ msgstr ""
16
  msgid "Unauthorized Action."
17
  msgstr ""
18
 
19
- #: woo-feed.php:141, woo-feed.php:260, includes/helper.php:853, includes/helper.php:1904, includes/helper.php:2949, includes/helper.php:2978, includes/helper.php:3366, includes/helper.php:3564, includes/helper.php:3592, includes/helper.php:4845, includes/helper.php:5354
20
  msgid "Invalid Request."
21
  msgstr ""
22
 
@@ -64,7 +64,7 @@ msgstr ""
64
  msgid "Invalid Merchant"
65
  msgstr ""
66
 
67
- #: admin/class-woo-feed-admin.php:174, includes/helper.php:818, includes/helper.php:931, includes/helper.php:912, includes/helper.php:900, includes/helper.php:888
68
  msgid "N/A"
69
  msgstr ""
70
 
@@ -76,7 +76,7 @@ msgstr ""
76
  msgid "Learn More.."
77
  msgstr ""
78
 
79
- #: admin/class-woo-feed-admin.php:178, includes/helper.php:3284, admin/partials/woo-feed-edit-config.php:66
80
  msgid "Select A Category"
81
  msgstr ""
82
 
@@ -168,11 +168,11 @@ msgstr ""
168
  msgid "mappings"
169
  msgstr ""
170
 
171
- #: admin/class-woo-feed-category-list.php:81, admin/class-woo-feed-category-list.php:122, admin/class-woo-feed-category-list.php:217, admin/class-woo-feed-manage-list.php:163, admin/class-woo-feed-manage-list.php:271, includes/helper.php:3645
172
  msgid "Edit"
173
  msgstr ""
174
 
175
- #: admin/class-woo-feed-category-list.php:88, admin/class-woo-feed-category-list.php:128, admin/class-woo-feed-category-list.php:222, admin/class-woo-feed-category-list.php:296, admin/class-woo-feed-manage-list.php:177, admin/class-woo-feed-manage-list.php:285, admin/class-woo-feed-manage-list.php:364, admin/class-woo-feed-option-list.php:90, admin/class-woo-feed-option-list.php:128, admin/class-woo-feed-option-list.php:216, admin/class-woo-feed-option-list.php:295
176
  msgid "Delete"
177
  msgstr ""
178
 
@@ -188,7 +188,7 @@ msgstr ""
188
  msgid "Template"
189
  msgstr ""
190
 
191
- #: admin/class-woo-feed-category-list.php:250, admin/class-woo-feed-manage-list.php:318, admin/class-woo-feed-option-list.php:248, admin/partials/woo-feed-settings.php:239
192
  msgid "Action"
193
  msgstr ""
194
 
@@ -204,7 +204,7 @@ msgstr ""
204
  msgid "Failed To Delete Mapping. You do not have sufficient permission to delete."
205
  msgstr ""
206
 
207
- #: admin/class-woo-feed-category-list.php:335, admin/class-woo-feed-manage-list.php:425, admin/class-woo-feed-manage-list.php:434, admin/class-woo-feed-option-list.php:336
208
  msgid "You do not have sufficient permission to delete!"
209
  msgstr ""
210
 
@@ -227,80 +227,80 @@ msgstr ""
227
  msgid "Copy To Clipboard"
228
  msgstr ""
229
 
230
- #: admin/class-woo-feed-manage-list.php:117, includes/helper.php:953
231
  msgid "View"
232
  msgstr ""
233
 
234
- #: admin/class-woo-feed-manage-list.php:119
235
  msgid "Regenerate"
236
  msgstr ""
237
 
238
- #: admin/class-woo-feed-manage-list.php:120, admin/partials/woo-feed-status.php:46
239
  msgid "Download"
240
  msgstr ""
241
 
242
- #: admin/class-woo-feed-manage-list.php:123
243
  msgid "Export Feed Config"
244
  msgstr ""
245
 
246
- #: admin/class-woo-feed-manage-list.php:126
247
  msgid "Download Feed Log"
248
  msgstr ""
249
 
250
- #: admin/class-woo-feed-manage-list.php:170, admin/class-woo-feed-manage-list.php:278
251
  msgid "Duplicate"
252
  msgstr ""
253
 
254
- #: admin/class-woo-feed-manage-list.php:237
255
  msgid "No feed available."
256
  msgstr ""
257
 
258
- #: admin/class-woo-feed-manage-list.php:312
259
  msgid "Auto Update"
260
  msgstr ""
261
 
262
- #: admin/class-woo-feed-manage-list.php:313
263
  msgid "Feed Name"
264
  msgstr ""
265
 
266
- #: admin/class-woo-feed-manage-list.php:314
267
  msgid "Provider"
268
  msgstr ""
269
 
270
- #: admin/class-woo-feed-manage-list.php:315, admin/partials/woo-feed-edit-config.php:12
271
  msgid "Type"
272
  msgstr ""
273
 
274
- #: admin/class-woo-feed-manage-list.php:316
275
  msgid "Feed URL"
276
  msgstr ""
277
 
278
- #: admin/class-woo-feed-manage-list.php:317
279
  msgid "Last Updated"
280
  msgstr ""
281
 
282
- #: admin/class-woo-feed-manage-list.php:393
283
  msgid "Failed To Delete Feed"
284
  msgstr ""
285
 
286
- #: admin/class-woo-feed-manage-list.php:389
287
  msgid "Feed Deleted Successfully"
288
  msgstr ""
289
 
290
- #: admin/class-woo-feed-manage-list.php:384
291
  msgid "Failed To Delete Feed. You do not have sufficient permission to delete."
292
  msgstr ""
293
 
294
- #: admin/class-woo-feed-manage-list.php:413
295
  msgid "Feed Successfully Duplicated."
296
  msgstr ""
297
 
298
- #: admin/class-woo-feed-manage-list.php:403
299
  msgid "Failed To Duplicate Feed. You do not have sufficient permission to duplicate."
300
  msgstr ""
301
 
302
  #. translators: %d: number of item deleted.
303
- #: admin/class-woo-feed-manage-list.php:447
304
  msgid "%d Feed Successfully Deleted."
305
  msgid_plural "%d Feeds Successfully Deleted."
306
  msgstr[0] ""
@@ -383,357 +383,357 @@ msgstr ""
383
  msgid "Please deactivate the <b>WooCommerce Product Feed Pro</b> version to activate free version again."
384
  msgstr ""
385
 
386
- #: includes/helper.php:215, includes/helper.php:217, includes/helper.php:234, includes/helper.php:236
387
  msgid "WooCommerce"
388
  msgstr ""
389
 
390
- #: includes/helper.php:216, includes/helper.php:235
391
  msgid "WooCommerce Product Feed"
392
  msgstr ""
393
 
394
  #. translators: 1: this plugin name, 2: required plugin name, 3: required plugin name and installation url
395
- #: includes/helper.php:220
396
  msgid "%1$s requires %2$s to be installed and active. You can installed/activate %3$s here."
397
  msgstr ""
398
 
399
  #. translators: 1: this plugin name, 2: required plugin name, 3: required plugin required version, 4: required plugin current version, 5: required plugin update url and name
400
- #: includes/helper.php:239
401
  msgid "%1$s requires %2$s version %3$s or above and %4$s found. Please upgrade %2$s to the latest version here %5$s"
402
  msgstr ""
403
 
404
- #: includes/helper.php:306
405
  msgid "Generating Product Feed"
406
  msgstr ""
407
 
408
- #: includes/helper.php:407
409
  msgid "WC_Product_Query"
410
  msgstr ""
411
 
412
- #: includes/helper.php:408
413
  msgid "WP_Query"
414
  msgstr ""
415
 
416
- #: includes/helper.php:409
417
  msgid "Both"
418
  msgstr ""
419
 
420
- #: includes/helper.php:402
421
  msgid "Individual"
422
  msgstr ""
423
 
424
- #: includes/helper.php:403
425
  msgid "Variable Dependable"
426
  msgstr ""
427
 
428
- #: includes/helper.php:424
429
  msgid "No Expiration "
430
  msgstr ""
431
 
432
- #: includes/helper.php:425
433
  msgid "1 Month"
434
  msgstr ""
435
 
436
- #: includes/helper.php:426, includes/helper.php:2064
437
  msgid "1 Week"
438
  msgstr ""
439
 
440
- #: includes/helper.php:427, includes/helper.php:2065
441
  msgid "24 Hours"
442
  msgstr ""
443
 
444
- #: includes/helper.php:428, includes/helper.php:2066
445
  msgid "12 Hours"
446
  msgstr ""
447
 
448
- #: includes/helper.php:429, includes/helper.php:2067
449
  msgid "6 Hours"
450
  msgstr ""
451
 
452
- #: includes/helper.php:430, includes/helper.php:2068
453
  msgid "1 Hours"
454
  msgstr ""
455
 
456
- #: includes/helper.php:829
457
  msgid "Watch Now"
458
  msgstr ""
459
 
460
- #: includes/helper.php:824, includes/helper.php:891
461
  msgid "Read Article"
462
  msgstr ""
463
 
464
- #: includes/helper.php:927
465
  msgid "Support Docs:"
466
  msgstr ""
467
 
468
- #: includes/helper.php:908
469
  msgid "Supported File Types:"
470
  msgstr ""
471
 
472
- #: includes/helper.php:896
473
  msgid "Video Documentation:"
474
  msgstr ""
475
 
476
- #: includes/helper.php:903
477
  msgid "Watch now"
478
  msgstr ""
479
 
480
- #: includes/helper.php:884
481
  msgid "Feed Specification:"
482
  msgstr ""
483
 
484
- #: includes/helper.php:954
485
  msgid "Open Feed File"
486
  msgstr ""
487
 
488
- #: includes/helper.php:1759, includes/helper.php:1760, includes/helper.php:1730, includes/helper.php:1730, includes/helper.php:1905, includes/helper.php:1968, includes/helper.php:1969, includes/helper.php:1944, includes/helper.php:1944, libs/WebAppick/AppServices/Insights.php:813, libs/WebAppick/AppServices/Promotions.php:362
489
  msgid "Invalid Request"
490
  msgstr ""
491
 
492
- #: includes/helper.php:1790
493
  msgid "Empty File Uploaded. Try again."
494
  msgstr ""
495
 
496
- #: includes/helper.php:1791
497
  msgid "Empty File"
498
  msgstr ""
499
 
500
- #: includes/helper.php:1794, includes/helper.php:1805, includes/helper.php:1817, includes/helper.php:1828, includes/helper.php:1842, includes/helper.php:1852, includes/helper.php:1864, includes/helper.php:1908
501
  msgid "&laquo; Back"
502
  msgstr ""
503
 
504
- #: includes/helper.php:1801
505
  msgid "Unable to read file content"
506
  msgstr ""
507
 
508
- #: includes/helper.php:1802, includes/helper.php:1814, includes/helper.php:1825, includes/helper.php:1839, includes/helper.php:1849, includes/helper.php:1861
509
  msgid "Invalid File"
510
  msgstr ""
511
 
512
- #: includes/helper.php:1813
513
  msgid "Unable to read data from file."
514
  msgstr ""
515
 
516
- #: includes/helper.php:1824
517
  msgid "Unable to read file info."
518
  msgstr ""
519
 
520
- #: includes/helper.php:1838
521
  msgid "Unable to read feed data from file."
522
  msgstr ""
523
 
524
- #: includes/helper.php:1848
525
  msgid "Unable to verify the file."
526
  msgstr ""
527
 
528
- #: includes/helper.php:1860
529
  msgid "Invalid or corrupted config file."
530
  msgstr ""
531
 
532
- #: includes/helper.php:1880
533
  msgid " Imported"
534
  msgstr ""
535
 
536
- #: includes/helper.php:2913
537
  msgid "Brand"
538
  msgstr ""
539
 
540
- #: includes/helper.php:2914
541
  msgid "GTIN"
542
  msgstr ""
543
 
544
- #: includes/helper.php:2915
545
  msgid "MPN"
546
  msgstr ""
547
 
548
- #: includes/helper.php:2916
549
  msgid "EAN"
550
  msgstr ""
551
 
552
- #: includes/helper.php:2917
553
  msgid "ISBN"
554
  msgstr ""
555
 
556
- #: includes/helper.php:2918
557
  msgid "Age group"
558
  msgstr ""
559
 
560
- #: includes/helper.php:2919
561
  msgid "Gender"
562
  msgstr ""
563
 
564
- #: includes/helper.php:2920
565
  msgid "Material"
566
  msgstr ""
567
 
568
- #: includes/helper.php:2921
569
  msgid "Cost of good sold"
570
  msgstr ""
571
 
572
- #: includes/helper.php:2922, includes/classes/class-woo-feed-dropdown.php:396, libs/WebAppick/Attributes/AvailabilityDate.php:47, libs/WebAppick/Attributes/AvailabilityDate.php:77
573
  msgid "Availability Date"
574
  msgstr ""
575
 
576
- #: includes/helper.php:2923
577
  msgid "Unit"
578
  msgstr ""
579
 
580
- #: includes/helper.php:2924, includes/classes/class-woo-feed-dropdown.php:467
581
  msgid "Unit Price Measure"
582
  msgstr ""
583
 
584
- #: includes/helper.php:2925, includes/classes/class-woo-feed-dropdown.php:468
585
  msgid "Unit Price Base Measure"
586
  msgstr ""
587
 
588
- #: includes/helper.php:2926
589
  msgid "Custom field 0"
590
  msgstr ""
591
 
592
- #: includes/helper.php:2927
593
  msgid "Custom field 1"
594
  msgstr ""
595
 
596
- #: includes/helper.php:2928
597
  msgid "Custom field 2"
598
  msgstr ""
599
 
600
- #: includes/helper.php:2929
601
  msgid "Custom field 3"
602
  msgstr ""
603
 
604
- #: includes/helper.php:2930
605
  msgid "Custom field 4"
606
  msgstr ""
607
 
608
- #: includes/helper.php:2999, includes/helper.php:3091
609
  msgid "CUSTOM FIELDS by CTX Feed"
610
  msgstr ""
611
 
612
- #: includes/helper.php:3016
613
  msgid "Set product "
614
  msgstr ""
615
 
616
- #: includes/helper.php:3016
617
  msgid " here."
618
  msgstr ""
619
 
620
- #: includes/helper.php:3203
621
  msgid "Another category mapping exists with the same name."
622
  msgstr ""
623
 
624
- #: includes/helper.php:3212
625
  msgid "Failed To Add Mapping"
626
  msgstr ""
627
 
628
- #: includes/helper.php:3208
629
  msgid "Mapping Added Successfully"
630
  msgstr ""
631
 
632
- #: includes/helper.php:3177
633
  msgid "Mapping Not Changed"
634
  msgstr ""
635
 
636
- #: includes/helper.php:3187
637
  msgid "Failed To Updated Mapping"
638
  msgstr ""
639
 
640
- #: includes/helper.php:3183
641
  msgid "Mapping Updated Successfully"
642
  msgstr ""
643
 
644
- #: includes/helper.php:3304
645
  msgid "Copy this category to subcategories"
646
  msgstr ""
647
 
648
- #: includes/helper.php:3335
649
  msgid "Clear Cache"
650
  msgstr ""
651
 
652
- #: includes/helper.php:3560, includes/helper.php:3589
653
  msgid "Something is wrong."
654
  msgstr ""
655
 
656
- #: includes/helper.php:3558
657
  msgid "User meta updated successfully."
658
  msgstr ""
659
 
660
- #: includes/helper.php:3637, includes/helper.php:3639
661
  msgid "by CTX Feed"
662
  msgstr ""
663
 
664
- #: includes/helper.php:3640
665
  msgid "All"
666
  msgstr ""
667
 
668
- #: includes/helper.php:3641
669
  msgid "Parent"
670
  msgstr ""
671
 
672
- #: includes/helper.php:3642
673
  msgid "Parent:"
674
  msgstr ""
675
 
676
- #: includes/helper.php:3643
677
  msgid "New"
678
  msgstr ""
679
 
680
- #: includes/helper.php:3643, libs/WebAppick/AppServices/Insights.php:977
681
  msgid "Name"
682
  msgstr ""
683
 
684
- #: includes/helper.php:3644
685
  msgid "Add New"
686
  msgstr ""
687
 
688
- #: includes/helper.php:3646
689
  msgid "Update"
690
  msgstr ""
691
 
692
- #: includes/helper.php:3647
693
  msgid "Separate"
694
  msgstr ""
695
 
696
- #: includes/helper.php:3647
697
  msgid "with commas"
698
  msgstr ""
699
 
700
- #: includes/helper.php:3648
701
  msgid "Search"
702
  msgstr ""
703
 
704
- #: includes/helper.php:3649
705
  msgid "Add or remove"
706
  msgstr ""
707
 
708
- #: includes/helper.php:3650
709
  msgid "Choose from the most used"
710
  msgstr ""
711
 
712
- #: includes/helper.php:4533
713
  msgid "Option Successfully Added."
714
  msgstr ""
715
 
716
- #: includes/helper.php:4524
717
  msgid "Option Already Added."
718
  msgstr ""
719
 
720
- #: includes/helper.php:5259
721
  msgid "Delivery up to 30 days"
722
  msgstr ""
723
 
724
- #: includes/helper.php:5257
725
  msgid "Delivery 1 to 3 days"
726
  msgstr ""
727
 
728
- #: includes/helper.php:5362
729
  msgid "Feed data is empty. Can't duplicate feed."
730
  msgstr ""
731
 
732
- #: includes/helper.php:5378
733
  msgid "Unable to save the duplicate feed data."
734
  msgstr ""
735
 
736
- #: includes/helper.php:5388
737
  msgid "Feed Successfully Duplicated, but unable to generate the data file. Please click the \"Regenerate Button\""
738
  msgstr ""
739
 
16
  msgid "Unauthorized Action."
17
  msgstr ""
18
 
19
+ #: woo-feed.php:141, woo-feed.php:260, includes/helper.php:823, includes/helper.php:1843, includes/helper.php:2860, includes/helper.php:2888, includes/helper.php:3268, includes/helper.php:3459, includes/helper.php:3486, includes/helper.php:4711, includes/helper.php:5201
20
  msgid "Invalid Request."
21
  msgstr ""
22
 
64
  msgid "Invalid Merchant"
65
  msgstr ""
66
 
67
+ #: admin/class-woo-feed-admin.php:174, includes/helper.php:788, includes/helper.php:900, includes/helper.php:881, includes/helper.php:869, includes/helper.php:857
68
  msgid "N/A"
69
  msgstr ""
70
 
76
  msgid "Learn More.."
77
  msgstr ""
78
 
79
+ #: admin/class-woo-feed-admin.php:178, includes/helper.php:3188, admin/partials/woo-feed-edit-config.php:66
80
  msgid "Select A Category"
81
  msgstr ""
82
 
168
  msgid "mappings"
169
  msgstr ""
170
 
171
+ #: admin/class-woo-feed-category-list.php:81, admin/class-woo-feed-category-list.php:122, admin/class-woo-feed-category-list.php:217, admin/class-woo-feed-manage-list.php:162, admin/class-woo-feed-manage-list.php:270, includes/helper.php:3537
172
  msgid "Edit"
173
  msgstr ""
174
 
175
+ #: admin/class-woo-feed-category-list.php:88, admin/class-woo-feed-category-list.php:128, admin/class-woo-feed-category-list.php:222, admin/class-woo-feed-category-list.php:296, admin/class-woo-feed-manage-list.php:176, admin/class-woo-feed-manage-list.php:284, admin/class-woo-feed-manage-list.php:363, admin/class-woo-feed-option-list.php:90, admin/class-woo-feed-option-list.php:128, admin/class-woo-feed-option-list.php:216, admin/class-woo-feed-option-list.php:295
176
  msgid "Delete"
177
  msgstr ""
178
 
188
  msgid "Template"
189
  msgstr ""
190
 
191
+ #: admin/class-woo-feed-category-list.php:250, admin/class-woo-feed-manage-list.php:317, admin/class-woo-feed-option-list.php:248, admin/partials/woo-feed-settings.php:239
192
  msgid "Action"
193
  msgstr ""
194
 
204
  msgid "Failed To Delete Mapping. You do not have sufficient permission to delete."
205
  msgstr ""
206
 
207
+ #: admin/class-woo-feed-category-list.php:335, admin/class-woo-feed-manage-list.php:424, admin/class-woo-feed-manage-list.php:433, admin/class-woo-feed-option-list.php:336
208
  msgid "You do not have sufficient permission to delete!"
209
  msgstr ""
210
 
227
  msgid "Copy To Clipboard"
228
  msgstr ""
229
 
230
+ #: admin/class-woo-feed-manage-list.php:116, includes/helper.php:922
231
  msgid "View"
232
  msgstr ""
233
 
234
+ #: admin/class-woo-feed-manage-list.php:118
235
  msgid "Regenerate"
236
  msgstr ""
237
 
238
+ #: admin/class-woo-feed-manage-list.php:119, admin/partials/woo-feed-status.php:46
239
  msgid "Download"
240
  msgstr ""
241
 
242
+ #: admin/class-woo-feed-manage-list.php:122
243
  msgid "Export Feed Config"
244
  msgstr ""
245
 
246
+ #: admin/class-woo-feed-manage-list.php:125
247
  msgid "Download Feed Log"
248
  msgstr ""
249
 
250
+ #: admin/class-woo-feed-manage-list.php:169, admin/class-woo-feed-manage-list.php:277
251
  msgid "Duplicate"
252
  msgstr ""
253
 
254
+ #: admin/class-woo-feed-manage-list.php:236
255
  msgid "No feed available."
256
  msgstr ""
257
 
258
+ #: admin/class-woo-feed-manage-list.php:311
259
  msgid "Auto Update"
260
  msgstr ""
261
 
262
+ #: admin/class-woo-feed-manage-list.php:312
263
  msgid "Feed Name"
264
  msgstr ""
265
 
266
+ #: admin/class-woo-feed-manage-list.php:313
267
  msgid "Provider"
268
  msgstr ""
269
 
270
+ #: admin/class-woo-feed-manage-list.php:314, admin/partials/woo-feed-edit-config.php:12
271
  msgid "Type"
272
  msgstr ""
273
 
274
+ #: admin/class-woo-feed-manage-list.php:315
275
  msgid "Feed URL"
276
  msgstr ""
277
 
278
+ #: admin/class-woo-feed-manage-list.php:316
279
  msgid "Last Updated"
280
  msgstr ""
281
 
282
+ #: admin/class-woo-feed-manage-list.php:392
283
  msgid "Failed To Delete Feed"
284
  msgstr ""
285
 
286
+ #: admin/class-woo-feed-manage-list.php:388
287
  msgid "Feed Deleted Successfully"
288
  msgstr ""
289
 
290
+ #: admin/class-woo-feed-manage-list.php:383
291
  msgid "Failed To Delete Feed. You do not have sufficient permission to delete."
292
  msgstr ""
293
 
294
+ #: admin/class-woo-feed-manage-list.php:412
295
  msgid "Feed Successfully Duplicated."
296
  msgstr ""
297
 
298
+ #: admin/class-woo-feed-manage-list.php:402
299
  msgid "Failed To Duplicate Feed. You do not have sufficient permission to duplicate."
300
  msgstr ""
301
 
302
  #. translators: %d: number of item deleted.
303
+ #: admin/class-woo-feed-manage-list.php:446
304
  msgid "%d Feed Successfully Deleted."
305
  msgid_plural "%d Feeds Successfully Deleted."
306
  msgstr[0] ""
383
  msgid "Please deactivate the <b>WooCommerce Product Feed Pro</b> version to activate free version again."
384
  msgstr ""
385
 
386
+ #: includes/helper.php:203, includes/helper.php:205, includes/helper.php:222, includes/helper.php:224
387
  msgid "WooCommerce"
388
  msgstr ""
389
 
390
+ #: includes/helper.php:204, includes/helper.php:223
391
  msgid "WooCommerce Product Feed"
392
  msgstr ""
393
 
394
  #. translators: 1: this plugin name, 2: required plugin name, 3: required plugin name and installation url
395
+ #: includes/helper.php:208
396
  msgid "%1$s requires %2$s to be installed and active. You can installed/activate %3$s here."
397
  msgstr ""
398
 
399
  #. translators: 1: this plugin name, 2: required plugin name, 3: required plugin required version, 4: required plugin current version, 5: required plugin update url and name
400
+ #: includes/helper.php:227
401
  msgid "%1$s requires %2$s version %3$s or above and %4$s found. Please upgrade %2$s to the latest version here %5$s"
402
  msgstr ""
403
 
404
+ #: includes/helper.php:292
405
  msgid "Generating Product Feed"
406
  msgstr ""
407
 
408
+ #: includes/helper.php:389
409
  msgid "WC_Product_Query"
410
  msgstr ""
411
 
412
+ #: includes/helper.php:390
413
  msgid "WP_Query"
414
  msgstr ""
415
 
416
+ #: includes/helper.php:391
417
  msgid "Both"
418
  msgstr ""
419
 
420
+ #: includes/helper.php:384
421
  msgid "Individual"
422
  msgstr ""
423
 
424
+ #: includes/helper.php:385
425
  msgid "Variable Dependable"
426
  msgstr ""
427
 
428
+ #: includes/helper.php:405
429
  msgid "No Expiration "
430
  msgstr ""
431
 
432
+ #: includes/helper.php:406
433
  msgid "1 Month"
434
  msgstr ""
435
 
436
+ #: includes/helper.php:407, includes/helper.php:2000
437
  msgid "1 Week"
438
  msgstr ""
439
 
440
+ #: includes/helper.php:408, includes/helper.php:2001
441
  msgid "24 Hours"
442
  msgstr ""
443
 
444
+ #: includes/helper.php:409, includes/helper.php:2002
445
  msgid "12 Hours"
446
  msgstr ""
447
 
448
+ #: includes/helper.php:410, includes/helper.php:2003
449
  msgid "6 Hours"
450
  msgstr ""
451
 
452
+ #: includes/helper.php:411, includes/helper.php:2004
453
  msgid "1 Hours"
454
  msgstr ""
455
 
456
+ #: includes/helper.php:799
457
  msgid "Watch Now"
458
  msgstr ""
459
 
460
+ #: includes/helper.php:794, includes/helper.php:860
461
  msgid "Read Article"
462
  msgstr ""
463
 
464
+ #: includes/helper.php:896
465
  msgid "Support Docs:"
466
  msgstr ""
467
 
468
+ #: includes/helper.php:877
469
  msgid "Supported File Types:"
470
  msgstr ""
471
 
472
+ #: includes/helper.php:865
473
  msgid "Video Documentation:"
474
  msgstr ""
475
 
476
+ #: includes/helper.php:872
477
  msgid "Watch now"
478
  msgstr ""
479
 
480
+ #: includes/helper.php:853
481
  msgid "Feed Specification:"
482
  msgstr ""
483
 
484
+ #: includes/helper.php:923
485
  msgid "Open Feed File"
486
  msgstr ""
487
 
488
+ #: includes/helper.php:1699, includes/helper.php:1700, includes/helper.php:1670, includes/helper.php:1670, includes/helper.php:1844, includes/helper.php:1906, includes/helper.php:1907, includes/helper.php:1882, includes/helper.php:1882, libs/WebAppick/AppServices/Insights.php:813, libs/WebAppick/AppServices/Promotions.php:362
489
  msgid "Invalid Request"
490
  msgstr ""
491
 
492
+ #: includes/helper.php:1729
493
  msgid "Empty File Uploaded. Try again."
494
  msgstr ""
495
 
496
+ #: includes/helper.php:1730
497
  msgid "Empty File"
498
  msgstr ""
499
 
500
+ #: includes/helper.php:1733, includes/helper.php:1744, includes/helper.php:1756, includes/helper.php:1767, includes/helper.php:1781, includes/helper.php:1791, includes/helper.php:1803, includes/helper.php:1847
501
  msgid "&laquo; Back"
502
  msgstr ""
503
 
504
+ #: includes/helper.php:1740
505
  msgid "Unable to read file content"
506
  msgstr ""
507
 
508
+ #: includes/helper.php:1741, includes/helper.php:1753, includes/helper.php:1764, includes/helper.php:1778, includes/helper.php:1788, includes/helper.php:1800
509
  msgid "Invalid File"
510
  msgstr ""
511
 
512
+ #: includes/helper.php:1752
513
  msgid "Unable to read data from file."
514
  msgstr ""
515
 
516
+ #: includes/helper.php:1763
517
  msgid "Unable to read file info."
518
  msgstr ""
519
 
520
+ #: includes/helper.php:1777
521
  msgid "Unable to read feed data from file."
522
  msgstr ""
523
 
524
+ #: includes/helper.php:1787
525
  msgid "Unable to verify the file."
526
  msgstr ""
527
 
528
+ #: includes/helper.php:1799
529
  msgid "Invalid or corrupted config file."
530
  msgstr ""
531
 
532
+ #: includes/helper.php:1819
533
  msgid " Imported"
534
  msgstr ""
535
 
536
+ #: includes/helper.php:2825
537
  msgid "Brand"
538
  msgstr ""
539
 
540
+ #: includes/helper.php:2826
541
  msgid "GTIN"
542
  msgstr ""
543
 
544
+ #: includes/helper.php:2827
545
  msgid "MPN"
546
  msgstr ""
547
 
548
+ #: includes/helper.php:2828
549
  msgid "EAN"
550
  msgstr ""
551
 
552
+ #: includes/helper.php:2829
553
  msgid "ISBN"
554
  msgstr ""
555
 
556
+ #: includes/helper.php:2830
557
  msgid "Age group"
558
  msgstr ""
559
 
560
+ #: includes/helper.php:2831
561
  msgid "Gender"
562
  msgstr ""
563
 
564
+ #: includes/helper.php:2832
565
  msgid "Material"
566
  msgstr ""
567
 
568
+ #: includes/helper.php:2833
569
  msgid "Cost of good sold"
570
  msgstr ""
571
 
572
+ #: includes/helper.php:2834, includes/classes/class-woo-feed-dropdown.php:396, libs/WebAppick/Attributes/AvailabilityDate.php:47, libs/WebAppick/Attributes/AvailabilityDate.php:77
573
  msgid "Availability Date"
574
  msgstr ""
575
 
576
+ #: includes/helper.php:2835
577
  msgid "Unit"
578
  msgstr ""
579
 
580
+ #: includes/helper.php:2836, includes/classes/class-woo-feed-dropdown.php:467
581
  msgid "Unit Price Measure"
582
  msgstr ""
583
 
584
+ #: includes/helper.php:2837, includes/classes/class-woo-feed-dropdown.php:468
585
  msgid "Unit Price Base Measure"
586
  msgstr ""
587
 
588
+ #: includes/helper.php:2838
589
  msgid "Custom field 0"
590
  msgstr ""
591
 
592
+ #: includes/helper.php:2839
593
  msgid "Custom field 1"
594
  msgstr ""
595
 
596
+ #: includes/helper.php:2840
597
  msgid "Custom field 2"
598
  msgstr ""
599
 
600
+ #: includes/helper.php:2841
601
  msgid "Custom field 3"
602
  msgstr ""
603
 
604
+ #: includes/helper.php:2842
605
  msgid "Custom field 4"
606
  msgstr ""
607
 
608
+ #: includes/helper.php:2908, includes/helper.php:2998
609
  msgid "CUSTOM FIELDS by CTX Feed"
610
  msgstr ""
611
 
612
+ #: includes/helper.php:2925
613
  msgid "Set product "
614
  msgstr ""
615
 
616
+ #: includes/helper.php:2925
617
  msgid " here."
618
  msgstr ""
619
 
620
+ #: includes/helper.php:3108
621
  msgid "Another category mapping exists with the same name."
622
  msgstr ""
623
 
624
+ #: includes/helper.php:3117
625
  msgid "Failed To Add Mapping"
626
  msgstr ""
627
 
628
+ #: includes/helper.php:3113
629
  msgid "Mapping Added Successfully"
630
  msgstr ""
631
 
632
+ #: includes/helper.php:3082
633
  msgid "Mapping Not Changed"
634
  msgstr ""
635
 
636
+ #: includes/helper.php:3092
637
  msgid "Failed To Updated Mapping"
638
  msgstr ""
639
 
640
+ #: includes/helper.php:3088
641
  msgid "Mapping Updated Successfully"
642
  msgstr ""
643
 
644
+ #: includes/helper.php:3208
645
  msgid "Copy this category to subcategories"
646
  msgstr ""
647
 
648
+ #: includes/helper.php:3238
649
  msgid "Clear Cache"
650
  msgstr ""
651
 
652
+ #: includes/helper.php:3455, includes/helper.php:3483
653
  msgid "Something is wrong."
654
  msgstr ""
655
 
656
+ #: includes/helper.php:3453
657
  msgid "User meta updated successfully."
658
  msgstr ""
659
 
660
+ #: includes/helper.php:3529, includes/helper.php:3531
661
  msgid "by CTX Feed"
662
  msgstr ""
663
 
664
+ #: includes/helper.php:3532
665
  msgid "All"
666
  msgstr ""
667
 
668
+ #: includes/helper.php:3533
669
  msgid "Parent"
670
  msgstr ""
671
 
672
+ #: includes/helper.php:3534
673
  msgid "Parent:"
674
  msgstr ""
675
 
676
+ #: includes/helper.php:3535
677
  msgid "New"
678
  msgstr ""
679
 
680
+ #: includes/helper.php:3535, libs/WebAppick/AppServices/Insights.php:977
681
  msgid "Name"
682
  msgstr ""
683
 
684
+ #: includes/helper.php:3536
685
  msgid "Add New"
686
  msgstr ""
687
 
688
+ #: includes/helper.php:3538
689
  msgid "Update"
690
  msgstr ""
691
 
692
+ #: includes/helper.php:3539
693
  msgid "Separate"
694
  msgstr ""
695
 
696
+ #: includes/helper.php:3539
697
  msgid "with commas"
698
  msgstr ""
699
 
700
+ #: includes/helper.php:3540
701
  msgid "Search"
702
  msgstr ""
703
 
704
+ #: includes/helper.php:3541
705
  msgid "Add or remove"
706
  msgstr ""
707
 
708
+ #: includes/helper.php:3542
709
  msgid "Choose from the most used"
710
  msgstr ""
711
 
712
+ #: includes/helper.php:4408
713
  msgid "Option Successfully Added."
714
  msgstr ""
715
 
716
+ #: includes/helper.php:4399
717
  msgid "Option Already Added."
718
  msgstr ""
719
 
720
+ #: includes/helper.php:5108
721
  msgid "Delivery up to 30 days"
722
  msgstr ""
723
 
724
+ #: includes/helper.php:5106
725
  msgid "Delivery 1 to 3 days"
726
  msgstr ""
727
 
728
+ #: includes/helper.php:5209
729
  msgid "Feed data is empty. Can't duplicate feed."
730
  msgstr ""
731
 
732
+ #: includes/helper.php:5225
733
  msgid "Unable to save the duplicate feed data."
734
  msgstr ""
735
 
736
+ #: includes/helper.php:5235
737
  msgid "Feed Successfully Duplicated, but unable to generate the data file. Please click the \"Regenerate Button\""
738
  msgstr ""
739
 
libs/autoload.php CHANGED
@@ -10,22 +10,21 @@ defined( 'ABSPATH' ) || die();
10
 
11
  spl_autoload_register( 'woo_feed_autoloader' );
12
 
13
- function woo_feed_autoloader($class){
14
 
15
- if( strpos( $class, 'WebAppick' ) !== false ){
16
 
17
  $file_path = dirname( __FILE__ ) . DIRECTORY_SEPARATOR
18
  . str_replace( '\\', DIRECTORY_SEPARATOR, $class ) . '.php';
19
 
20
  $file_secondary_path = dirname( __FILE__ ) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'includes' .
21
- DIRECTORY_SEPARATOR . str_replace( ['WebAppick\Feed', '\\'], [ '', DIRECTORY_SEPARATOR], $class ) . '.php';
22
 
23
- if( file_exists( $file_path ) ) {
24
  require_once $file_path;
25
- } else if( file_exists( $file_secondary_path ) ){
26
  require_once( $file_secondary_path );
27
- }
28
-
29
- }
30
 
31
  }
10
 
11
  spl_autoload_register( 'woo_feed_autoloader' );
12
 
13
+ function woo_feed_autoloader( $class ) {
14
 
15
+ if ( strpos( $class, 'WebAppick' ) !== false ) {
16
 
17
  $file_path = dirname( __FILE__ ) . DIRECTORY_SEPARATOR
18
  . str_replace( '\\', DIRECTORY_SEPARATOR, $class ) . '.php';
19
 
20
  $file_secondary_path = dirname( __FILE__ ) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'includes' .
21
+ DIRECTORY_SEPARATOR . str_replace( [ 'WebAppick\Feed', '\\' ], [ '', DIRECTORY_SEPARATOR ], $class ) . '.php';
22
 
23
+ if ( file_exists( $file_path ) ) {
24
  require_once $file_path;
25
+ } elseif ( file_exists( $file_secondary_path ) ) {
26
  require_once( $file_secondary_path );
27
+ }
28
+ }
 
29
 
30
  }
woo-feed.php CHANGED
@@ -10,7 +10,7 @@
10
  * Plugin Name: CTX Feed
11
  * Plugin URI: https://webappick.com/
12
  * Description: Easily generate woocommerce product feed for any marketing channel like Google Shopping(Merchant), Facebook Remarketing, Bing, eBay & more. Support 100+ Merchants.
13
- * Version: 4.4.52
14
  * Author: WebAppick
15
  * Author URI: https://webappick.com/
16
  * License: GPL v2
@@ -20,12 +20,12 @@
20
  *
21
  * WP Requirement & Test
22
  * Requires at least: 4.4
23
- * Tested up to: 5.8.2
24
  * Requires PHP: 5.6
25
  *
26
  * WC Requirement & Test
27
  * WC requires at least: 3.2
28
- * WC tested up to: 5.9.0
29
  */
30
 
31
  if ( ! defined( 'ABSPATH' ) ) {
@@ -367,14 +367,14 @@ if ( ! function_exists( 'woo_feed_save_feed_file' ) ) {
367
  $feedBody = $reviewObj->make_review_xml_feed();
368
  $string = $feedBody;
369
 
370
- } else if ( 'csv' === $type || 'tsv' === $type || 'xls' === $type) {
371
  $csvHead[0] = $feedHeader;
372
  if ( ! empty( $csvHead ) && ! empty( $feedBody ) ) {
373
  $string = array_merge( $csvHead, $feedBody );
374
  } else {
375
  $string = array();
376
  }
377
- } else if ('json' === $type){
378
  $string = $feedBody;
379
  } else {
380
  $string = $feedHeader . $feedBody . $feedFooter;
10
  * Plugin Name: CTX Feed
11
  * Plugin URI: https://webappick.com/
12
  * Description: Easily generate woocommerce product feed for any marketing channel like Google Shopping(Merchant), Facebook Remarketing, Bing, eBay & more. Support 100+ Merchants.
13
+ * Version: 4.4.53
14
  * Author: WebAppick
15
  * Author URI: https://webappick.com/
16
  * License: GPL v2
20
  *
21
  * WP Requirement & Test
22
  * Requires at least: 4.4
23
+ * Tested up to: 5.9.1
24
  * Requires PHP: 5.6
25
  *
26
  * WC Requirement & Test
27
  * WC requires at least: 3.2
28
+ * WC tested up to: 6.2.1
29
  */
30
 
31
  if ( ! defined( 'ABSPATH' ) ) {
367
  $feedBody = $reviewObj->make_review_xml_feed();
368
  $string = $feedBody;
369
 
370
+ } elseif ( 'csv' === $type || 'tsv' === $type || 'xls' === $type ) {
371
  $csvHead[0] = $feedHeader;
372
  if ( ! empty( $csvHead ) && ! empty( $feedBody ) ) {
373
  $string = array_merge( $csvHead, $feedBody );
374
  } else {
375
  $string = array();
376
  }
377
+ } elseif ( 'json' === $type ) {
378
  $string = $feedBody;
379
  } else {
380
  $string = $feedHeader . $feedBody . $feedFooter;