CTX Feed – WooCommerce Product Feed Manager Plugin - Version 4.3.9

Version Description

(2020-12-20) = * Added: Google Dynamic Search Ads Template. * Added: Pinterest RSS board feed template. * Fixed: Product list table breaking issue * Fixed: Complete registration missing parameters for facebook pixel.

Download this release

Release Info

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

Code changes from version 4.3.8 to 4.3.9

README.txt CHANGED
@@ -8,7 +8,7 @@ Google Product Review feed, product variations, rakuteen, shopping, skroutz, TSV
8
  Requires at least: 3.6
9
  Tested Up To: 5.6
10
  Requires PHP: 5.6
11
- Stable tag: 4.3.8
12
  License: GPLv2 or later
13
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
14
 
@@ -308,6 +308,12 @@ Using pro version:
308
 
309
  == Changelog ==
310
 
 
 
 
 
 
 
311
  = 4.3.8 (2020-12-19) =
312
  * Added : Google Promotions Template.
313
  * Added : Bing Local Inventory Template.
8
  Requires at least: 3.6
9
  Tested Up To: 5.6
10
  Requires PHP: 5.6
11
+ Stable tag: 4.3.9
12
  License: GPLv2 or later
13
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
14
 
308
 
309
  == Changelog ==
310
 
311
+ = 4.3.9 (2020-12-20) =
312
+ * Added: Google Dynamic Search Ads Template.
313
+ * Added: Pinterest RSS board feed template.
314
+ * Fixed: Product list table breaking issue
315
+ * Fixed: Complete registration missing parameters for facebook pixel.
316
+
317
  = 4.3.8 (2020-12-19) =
318
  * Added : Google Promotions Template.
319
  * Added : Bing Local Inventory Template.
admin/partials/woo-feed-status.php CHANGED
@@ -27,11 +27,11 @@
27
  <tbody>
28
  <?php
29
  $system_datas = woo_feed_get_system_status();
30
- foreach($system_datas as $key => $value) {
31
  $system_name = array_key_first($value);
32
 
33
  //for debug mode rename the value
34
- if( "wp_debug_mode" === $key ) {
35
  $value = $value ? 'On' : 'Off';
36
  }
37
 
27
  <tbody>
28
  <?php
29
  $system_datas = woo_feed_get_system_status();
30
+ foreach ( $system_datas as $key => $value ) {
31
  $system_name = array_key_first($value);
32
 
33
  //for debug mode rename the value
34
+ if ( "wp_debug_mode" === $key ) {
35
  $value = $value ? 'On' : 'Off';
36
  }
37
 
includes/classes/class-woo-feed-admin-message.php CHANGED
@@ -94,7 +94,7 @@ final class Woo_Feed_Message {
94
  private function display_support_links() {
95
  $hide_promotion = (int) get_option('woo_feed_hide_promotion');
96
  ?>
97
- <?php if( 1 !== $hide_promotion && empty($hide_promotion) ) { ?>
98
  <div class="woo-feed-promotion">
99
  <a href="https://webappick.com/plugin/woocommerce-product-feed-pro/">
100
  <img src="<?php echo WOO_FEED_PLUGIN_URL; ?>admin/images/woo-feed-black-friday.svg" alt="Woo Feed Pro Black Friday">
94
  private function display_support_links() {
95
  $hide_promotion = (int) get_option('woo_feed_hide_promotion');
96
  ?>
97
+ <?php if ( 1 !== $hide_promotion && empty($hide_promotion) ) { ?>
98
  <div class="woo-feed-promotion">
99
  <a href="https://webappick.com/plugin/woocommerce-product-feed-pro/">
100
  <img src="<?php echo WOO_FEED_PLUGIN_URL; ?>admin/images/woo-feed-black-friday.svg" alt="Woo Feed Pro Black Friday">
includes/classes/class-woo-feed-default-attributes.php CHANGED
@@ -755,6 +755,22 @@ class Woo_Feed_Default_Attributes {
755
  );
756
  }
757
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
758
  /**
759
  * Bing Attribute List
760
  *
@@ -829,6 +845,24 @@ class Woo_Feed_Default_Attributes {
829
  );
830
  }
831
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
832
  /**
833
  * Google Product Review Attribute List
834
  *
@@ -879,7 +913,7 @@ class Woo_Feed_Default_Attributes {
879
  'discount-price' => 'Discount Price[discount-price]',
880
  'leadtime-to-ship' => 'Lead Time to Ship[leadtime-to-ship]',
881
  'club-catch-eligible' => 'Club Catch eligible[club-catch-eligible]',
882
- 'tax-au' => 'GST %[tax-au]'
883
  );
884
  }
885
 
755
  );
756
  }
757
 
758
+ /**
759
+ * Google Dynamic Ads Attribute List
760
+ *
761
+ * @return array
762
+ */
763
+ public function google_dynamic_adsAttributes() {
764
+
765
+ return array(
766
+ '--1' => 'Basic Information',
767
+ 'Page URL' => 'Page URL[Page URL]',
768
+ 'Custom Label' => 'Custom Label [Custom Label]',
769
+ '---1' => '',
770
+
771
+ );
772
+ }
773
+
774
  /**
775
  * Bing Attribute List
776
  *
845
  );
846
  }
847
 
848
+ /**
849
+ * Pinterest RSS Board Attribute List
850
+ *
851
+ * @return array
852
+ */
853
+ public function pinterest_rssAttributes() {
854
+
855
+ return array(
856
+ '--1' => 'Basic Information',
857
+ 'title' => 'Product Title[title]',
858
+ 'description' => 'Product Description[description]',
859
+ 'link' => 'Product URL[link]',
860
+ 'image' => 'Main Image[image]',
861
+ '---1' => '',
862
+
863
+ );
864
+ }
865
+
866
  /**
867
  * Google Product Review Attribute List
868
  *
913
  'discount-price' => 'Discount Price[discount-price]',
914
  'leadtime-to-ship' => 'Lead Time to Ship[leadtime-to-ship]',
915
  'club-catch-eligible' => 'Club Catch eligible[club-catch-eligible]',
916
+ 'tax-au' => 'GST %[tax-au]',
917
  );
918
  }
919
 
includes/classes/class-woo-feed-dropdown.php CHANGED
@@ -563,6 +563,24 @@ class Woo_Feed_Dropdown {
563
  public function google_shopping_actionAttributesDropdown( $selected = '' ) {
564
  return $this->googleAttributesDropdown( $selected );
565
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
566
 
567
  /**
568
  * Facebook Attribute list
@@ -587,6 +605,24 @@ class Woo_Feed_Dropdown {
587
  public function pinterestAttributesDropdown( $selected = '' ) {
588
  return $this->googleAttributesDropdown( $selected );
589
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
590
 
591
  /**
592
  * AdRoll Attribute list
563
  public function google_shopping_actionAttributesDropdown( $selected = '' ) {
564
  return $this->googleAttributesDropdown( $selected );
565
  }
566
+
567
+
568
+ /**
569
+ * Google Dynamic Ads Attribute list
570
+ *
571
+ * @param string $selected
572
+ *
573
+ * @return string
574
+ */
575
+ public function google_dynamic_adsAttributesDropdown( $selected = '' ) {
576
+ $options = $this->get_cached_dropdown( 'google_dynamic_adsAttributesDropdown', $selected );
577
+
578
+ if ( false === $options ) {
579
+ $attributes = new Woo_Feed_Default_Attributes();
580
+ return $this->cache_dropdown( 'google_dynamic_adsAttributesDropdown', $attributes->google_dynamic_adsAttributes(), $selected );
581
+ }
582
+ return $options;
583
+ }
584
 
585
  /**
586
  * Facebook Attribute list
605
  public function pinterestAttributesDropdown( $selected = '' ) {
606
  return $this->googleAttributesDropdown( $selected );
607
  }
608
+
609
+ /**
610
+ * Pinterest Catelog Attribute list
611
+ * Alias of google attribute dropdown for pinterest catelog
612
+ *
613
+ * @param string $selected
614
+ *
615
+ * @return string
616
+ */
617
+ public function pinterest_rssAttributesDropdown( $selected = '' ) {
618
+ $options = $this->get_cached_dropdown( 'pinterest_rssAttributesDropdown', $selected );
619
+
620
+ if ( false === $options ) {
621
+ $attributes = new Woo_Feed_Default_Attributes();
622
+ return $this->cache_dropdown( 'pinterest_rssAttributesDropdown', $attributes->pinterest_rssAttributes(), $selected );
623
+ }
624
+ return $options;
625
+ }
626
 
627
  /**
628
  * AdRoll Attribute list
includes/classes/class-woo-feed-merchant.php CHANGED
@@ -326,9 +326,11 @@ class Woo_Feed_Merchant {
326
  'google_local_inventory' => esc_html__( 'Google Local Product Inventory', 'woo-feed' ),
327
  'google_shopping_action' => esc_html__( 'Google Shopping Action', 'woo-feed' ),
328
  'google_promotions' => esc_html__( 'Google Promotions', 'woo-feed' ),
329
- 'adwords' => esc_html__( 'Google Adwords', 'woo-feed' ),
 
330
  'facebook' => esc_html__( 'Facebook Catalog / Instagram', 'woo-feed' ),
331
- 'pinterest' => esc_html__( 'Pinterest', 'woo-feed' ),
 
332
  'bing' => esc_html__( 'Bing Shopping', 'woo-feed' ),
333
  'bing_local_inventory' => esc_html__( 'Bing Local Inventory', 'woo-feed' ),
334
  'idealo' => esc_html__( 'Idealo', 'woo-feed' ),
326
  'google_local_inventory' => esc_html__( 'Google Local Product Inventory', 'woo-feed' ),
327
  'google_shopping_action' => esc_html__( 'Google Shopping Action', 'woo-feed' ),
328
  'google_promotions' => esc_html__( 'Google Promotions', 'woo-feed' ),
329
+ 'google_dynamic_ads' => esc_html__( 'Google Dynamic Search Ads', 'woo-feed' ),
330
+ 'adwords' => esc_html__( 'Google Ads', 'woo-feed' ),
331
  'facebook' => esc_html__( 'Facebook Catalog / Instagram', 'woo-feed' ),
332
+ 'pinterest' => esc_html__( 'Pinterest Catalog', 'woo-feed' ),
333
+ 'pinterest_rss' => esc_html__( 'Pinterest RSS Board', 'woo-feed' ),
334
  'bing' => esc_html__( 'Bing Shopping', 'woo-feed' ),
335
  'bing_local_inventory' => esc_html__( 'Bing Local Inventory', 'woo-feed' ),
336
  'idealo' => esc_html__( 'Idealo', 'woo-feed' ),
includes/classes/class-woo-feed-products-v3.php CHANGED
@@ -827,7 +827,7 @@ class Woo_Feed_Products_v3
827
  $sub = 0; // Subscription Index
828
  $subscription = '';
829
  $ins = 0; // Installment Index
830
- $installment="";
831
  $product_detail = '';
832
  $pd = 0;
833
 
@@ -846,14 +846,14 @@ class Woo_Feed_Products_v3
846
 
847
  if ( 'pattern' == $this->config['type'][ $key ] ) {
848
  $output = $this->config['default'][ $key ];
849
- $output=$this->apply_filters_to_attribute_value($output,$productObj,$attribute,$merchant_attribute);
850
  } else { // Get Pattern value.
851
  $output = $this->getAttributeValueByType($productObj, $attribute, $merchant_attribute);
852
  }
853
 
854
- $output=$this->format_output($output,$this->config['output_type'],$productObj,$attribute,$merchant_attribute);
855
 
856
- $output=$this->process_prefix_suffix( $output, $prefix, $suffix, $attribute = '' );
857
 
858
  if ( 'shipping_country' == $value ) {
859
  if ( 0 == $s ) {
@@ -1068,7 +1068,7 @@ class Woo_Feed_Products_v3
1068
  }
1069
 
1070
  $product = $this->products[ $this->pi ];
1071
- if( 'bing' === $this->config['provider'] ) {
1072
  $headers = array_map('woo_feed_trim_attribute', array_keys( $product ));
1073
  }else {
1074
  $headers = array_keys( $product );
@@ -1131,7 +1131,7 @@ class Woo_Feed_Products_v3
1131
  }
1132
 
1133
  $product = $this->products[ $this->pi ];
1134
- if( 'bing' === $this->config['provider'] ) {
1135
  $this->feedHeader = array_map('woo_feed_trim_attribute', array_keys( $product ));
1136
  }else {
1137
  $this->feedHeader = array_keys( $product );
@@ -1277,7 +1277,7 @@ class Woo_Feed_Products_v3
1277
  * @since 3.2.0
1278
  *
1279
  */
1280
- protected function getAttributeValueByType( $product, $attribute, $merchant_attribute='') {
1281
 
1282
  if ( method_exists($this, $attribute) ) {
1283
  $output = call_user_func_array(array( $this, $attribute ), array( $product ));
@@ -1310,7 +1310,7 @@ class Woo_Feed_Products_v3
1310
  $output = wp_json_encode($output);
1311
  }
1312
 
1313
- $output=$this->apply_filters_to_attribute_value($output, $product, $attribute, $merchant_attribute);
1314
 
1315
  return $output;
1316
  }
@@ -1325,7 +1325,7 @@ class Woo_Feed_Products_v3
1325
  *
1326
  * @return mixed|void
1327
  */
1328
- protected function apply_filters_to_attribute_value($output, $product, $attribute, $merchant_attribute){
1329
  /**
1330
  * Filter attribute value
1331
  *
@@ -1448,15 +1448,15 @@ class Woo_Feed_Products_v3
1448
  * @return mixed
1449
  * @since 5.1.3
1450
  */
1451
- protected function rank_math_title($product) {
1452
  $rank_title = '';
1453
  $post_title = '';
1454
  $page = '';
1455
  $sep = '';
1456
  $sitemap = '';
1457
- if( class_exists('RankMath') ) {
1458
  $title = get_post_meta( $product->get_id(), 'rank_math_title', true );
1459
- if( empty($title) ) {
1460
  $title_format = Helper::get_settings( "titles.pt_product_title" );
1461
  $title_format = $title_format ? $title_format : '%title%';
1462
  $sep = Helper::get_settings( 'titles.title_separator' );
@@ -1481,14 +1481,14 @@ class Woo_Feed_Products_v3
1481
  * @return mixed
1482
  * @since 5.1.3
1483
  */
1484
- protected function rank_math_description($product) {
1485
  $description = '';
1486
- if( class_exists('RankMath') ) {
1487
  $description = get_post_meta($product->get_id(), 'rank_math_description');
1488
  $desc_format = Helper::get_settings( "titles.pt_post_description" );
1489
 
1490
- if( empty($description) ) {
1491
- if( !empty($desc_format) && strpos( (string) $desc_format, 'excerpt') !== false ) {
1492
  $description = str_replace('%excerpt%', get_the_excerpt( $product->get_id() ), $desc_format);
1493
  }
1494
 
@@ -1496,11 +1496,10 @@ class Woo_Feed_Products_v3
1496
  if ( $product->is_type( 'variation' ) && empty( $description ) ) {
1497
  $parent = wc_get_product( $product->get_parent_id() );
1498
  $description = $parent->get_description();
1499
- }
1500
-
1501
- }
1502
 
1503
- if(is_array($description)) {
1504
  $description = reset($description);
1505
  }
1506
 
@@ -1509,7 +1508,7 @@ class Woo_Feed_Products_v3
1509
  //strip tags and spacial characters
1510
  $strip_description = wp_strip_all_tags(wp_specialchars_decode($description));
1511
 
1512
- return !empty(strlen($strip_description)) && 0 < strlen($strip_description) ? $strip_description : $description;
1513
  }
1514
 
1515
  return $description;
@@ -1523,19 +1522,19 @@ class Woo_Feed_Products_v3
1523
  * @return mixed
1524
  * @since 5.1.6
1525
  */
1526
- protected function rank_math_canonical_url($product) {
1527
  $canonical_url = '';
1528
 
1529
- if( class_exists('RankMath') ) {
1530
  $post_canonical_url = get_post_meta($product->get_id(), 'rank_math_canonical_url');
1531
 
1532
- if( empty($post_canonical_url) ) {
1533
  $canonical_url = get_the_permalink($product->get_id());
1534
  }else {
1535
  $canonical_url = $post_canonical_url;
1536
  }
1537
 
1538
- if( is_array($canonical_url) ) {
1539
  $canonical_url = reset($canonical_url);
1540
  }
1541
  }
@@ -2725,7 +2724,7 @@ class Woo_Feed_Products_v3
2725
  $value = $product->get_attribute($attr);
2726
 
2727
  // if empty get attribute of parent post
2728
- if( '' === $value && $product->is_type('variation') ) {
2729
  $product = wc_get_product( $product->get_parent_id() );
2730
  $value = $product->get_attribute( $attr );
2731
  }
@@ -2980,7 +2979,7 @@ class Woo_Feed_Products_v3
2980
 
2981
  // Add Suffix after Output
2982
  if ( '' !== $suffix ) {
2983
- if (array_key_exists(trim($suffix),get_woocommerce_currencies())) { // Add space before suffix if attribute contain price.
2984
  $output = $output . ' ' . $suffix;
2985
  } elseif ( substr($output, 0, 4) === 'http' ) {
2986
  // Parse URL Parameters if available into suffix field
827
  $sub = 0; // Subscription Index
828
  $subscription = '';
829
  $ins = 0; // Installment Index
830
+ $installment = "";
831
  $product_detail = '';
832
  $pd = 0;
833
 
846
 
847
  if ( 'pattern' == $this->config['type'][ $key ] ) {
848
  $output = $this->config['default'][ $key ];
849
+ $output = $this->apply_filters_to_attribute_value($output,$productObj,$attribute,$merchant_attribute);
850
  } else { // Get Pattern value.
851
  $output = $this->getAttributeValueByType($productObj, $attribute, $merchant_attribute);
852
  }
853
 
854
+ $output = $this->format_output($output,$this->config['output_type'],$productObj,$attribute,$merchant_attribute);
855
 
856
+ $output = $this->process_prefix_suffix( $output, $prefix, $suffix, $attribute = '' );
857
 
858
  if ( 'shipping_country' == $value ) {
859
  if ( 0 == $s ) {
1068
  }
1069
 
1070
  $product = $this->products[ $this->pi ];
1071
+ if ( 'bing' === $this->config['provider'] ) {
1072
  $headers = array_map('woo_feed_trim_attribute', array_keys( $product ));
1073
  }else {
1074
  $headers = array_keys( $product );
1131
  }
1132
 
1133
  $product = $this->products[ $this->pi ];
1134
+ if ( 'bing' === $this->config['provider'] ) {
1135
  $this->feedHeader = array_map('woo_feed_trim_attribute', array_keys( $product ));
1136
  }else {
1137
  $this->feedHeader = array_keys( $product );
1277
  * @since 3.2.0
1278
  *
1279
  */
1280
+ protected function getAttributeValueByType( $product, $attribute, $merchant_attribute='' ) {
1281
 
1282
  if ( method_exists($this, $attribute) ) {
1283
  $output = call_user_func_array(array( $this, $attribute ), array( $product ));
1310
  $output = wp_json_encode($output);
1311
  }
1312
 
1313
+ $output = $this->apply_filters_to_attribute_value($output, $product, $attribute, $merchant_attribute);
1314
 
1315
  return $output;
1316
  }
1325
  *
1326
  * @return mixed|void
1327
  */
1328
+ protected function apply_filters_to_attribute_value( $output, $product, $attribute, $merchant_attribute ) {
1329
  /**
1330
  * Filter attribute value
1331
  *
1448
  * @return mixed
1449
  * @since 5.1.3
1450
  */
1451
+ protected function rank_math_title( $product ) {
1452
  $rank_title = '';
1453
  $post_title = '';
1454
  $page = '';
1455
  $sep = '';
1456
  $sitemap = '';
1457
+ if ( class_exists('RankMath') ) {
1458
  $title = get_post_meta( $product->get_id(), 'rank_math_title', true );
1459
+ if ( empty($title) ) {
1460
  $title_format = Helper::get_settings( "titles.pt_product_title" );
1461
  $title_format = $title_format ? $title_format : '%title%';
1462
  $sep = Helper::get_settings( 'titles.title_separator' );
1481
  * @return mixed
1482
  * @since 5.1.3
1483
  */
1484
+ protected function rank_math_description( $product ) {
1485
  $description = '';
1486
+ if ( class_exists('RankMath') ) {
1487
  $description = get_post_meta($product->get_id(), 'rank_math_description');
1488
  $desc_format = Helper::get_settings( "titles.pt_post_description" );
1489
 
1490
+ if ( empty($description) ) {
1491
+ if ( ! empty($desc_format) && strpos( (string) $desc_format, 'excerpt') !== false ) {
1492
  $description = str_replace('%excerpt%', get_the_excerpt( $product->get_id() ), $desc_format);
1493
  }
1494
 
1496
  if ( $product->is_type( 'variation' ) && empty( $description ) ) {
1497
  $parent = wc_get_product( $product->get_parent_id() );
1498
  $description = $parent->get_description();
1499
+ }
1500
+ }
 
1501
 
1502
+ if ( is_array($description) ) {
1503
  $description = reset($description);
1504
  }
1505
 
1508
  //strip tags and spacial characters
1509
  $strip_description = wp_strip_all_tags(wp_specialchars_decode($description));
1510
 
1511
+ return ! empty(strlen($strip_description)) && 0 < strlen($strip_description) ? $strip_description : $description;
1512
  }
1513
 
1514
  return $description;
1522
  * @return mixed
1523
  * @since 5.1.6
1524
  */
1525
+ protected function rank_math_canonical_url( $product ) {
1526
  $canonical_url = '';
1527
 
1528
+ if ( class_exists('RankMath') ) {
1529
  $post_canonical_url = get_post_meta($product->get_id(), 'rank_math_canonical_url');
1530
 
1531
+ if ( empty($post_canonical_url) ) {
1532
  $canonical_url = get_the_permalink($product->get_id());
1533
  }else {
1534
  $canonical_url = $post_canonical_url;
1535
  }
1536
 
1537
+ if ( is_array($canonical_url) ) {
1538
  $canonical_url = reset($canonical_url);
1539
  }
1540
  }
2724
  $value = $product->get_attribute($attr);
2725
 
2726
  // if empty get attribute of parent post
2727
+ if ( '' === $value && $product->is_type('variation') ) {
2728
  $product = wc_get_product( $product->get_parent_id() );
2729
  $value = $product->get_attribute( $attr );
2730
  }
2979
 
2980
  // Add Suffix after Output
2981
  if ( '' !== $suffix ) {
2982
+ if ( array_key_exists(trim($suffix),get_woocommerce_currencies()) ) { // Add space before suffix if attribute contain price.
2983
  $output = $output . ' ' . $suffix;
2984
  } elseif ( substr($output, 0, 4) === 'http' ) {
2985
  // Parse URL Parameters if available into suffix field
includes/feeds/class-woo-feed-pinterest.php CHANGED
@@ -537,18 +537,27 @@ class Woo_Feed_Pinterest {
537
 
538
  return "$space<$attribute>$value</$attribute>";
539
  }
540
-
541
-
542
- public function get_xml_feed_header() {
543
- $output = '<?xml version="1.0" encoding="UTF-8" ?>
544
- <rss version="2.0" xmlns:g="http://base.google.com/ns/1.0" xmlns:c="http://base.google.com/cns/1.0">
545
- <channel>
 
 
 
 
 
 
 
 
 
546
  <title><![CDATA[' . html_entity_decode( get_option( 'blogname' ) ) . ']]></title>
547
  <link><![CDATA[' . site_url() . ']]></link>
548
- <description><![CDATA[' . html_entity_decode( get_option( 'blogdescription' ) ) . ']]></description>';
549
-
550
- return $output;
551
- }
552
 
553
  public function get_xml_feed( $items ) {
554
  $feed = '';
537
 
538
  return "$space<$attribute>$value</$attribute>";
539
  }
540
+
541
+
542
+ public function get_xml_feed_header() {
543
+ $last_update_date = date( 'Y-m-d H:i:s', current_time( 'timestamp', 0 ) );
544
+
545
+ if ( 'pinterest_rss' === $this->rules['provider'] ) {
546
+ $header_line = '<rss content="http://purl.org/rss/1.0/modules/content/" wfw="http://wellformedweb.org/CommentAPI/" dc="http://purl.org/dc/elements/1.1/" sy="http://purl.org/rss/1.0/modules/syndication/" slash="http://purl.org/rss/1.0/modules/slash/" version="2.0">';
547
+ $extra_lines = '<lastBuildDate>'. $last_update_date .'</lastBuildDate><generator>WooCommerce Product Feed by Webappick</generator>';
548
+ }else {
549
+ $header_line = '<rss version="2.0" xmlns:g="http://base.google.com/ns/1.0" xmlns:c="http://base.google.com/cns/1.0">';
550
+ $extra_lines = '';
551
+ }
552
+
553
+ $output = '<?xml version="1.0" encoding="UTF-8" ?>' . $header_line . '
554
+ <channel>
555
  <title><![CDATA[' . html_entity_decode( get_option( 'blogname' ) ) . ']]></title>
556
  <link><![CDATA[' . site_url() . ']]></link>
557
+ <description><![CDATA[' . html_entity_decode( get_option( 'blogdescription' ) ) . ']]></description>' . $extra_lines;
558
+
559
+ return $output;
560
+ }
561
 
562
  public function get_xml_feed( $items ) {
563
  $feed = '';
includes/feeds/class-woo-feed-review.php CHANGED
@@ -1,376 +1,376 @@
1
- <?php /** @noinspection PhpUnusedPrivateMethodInspection, PhpUndefinedMethodInspection, PhpUnused, PhpUnusedPrivateFieldInspection, PhpUnusedLocalVariableInspection, DuplicatedCode, PhpUnusedParameterInspection, PhpForeachNestedOuterKeyValueVariablesConflictInspection, RegExpRedundantEscape */
2
-
3
- /**
4
- * Class Google Product Review
5
- *
6
- * Responsible for processing and generating feed for Google.com
7
- *
8
- * @since 1.0.0
9
- * @package Google
10
- *
11
- */
12
- class Woo_Feed_Review {
13
-
14
- /**
15
- * This variable is responsible for holding all product attributes and their values
16
- *
17
- * @since 1.0.0
18
- * @var array $products Contains all the product attributes to generate feed
19
- * @access public
20
- */
21
- public $products;
22
-
23
- /**
24
- * This variable is responsible for holding feed configuration form values
25
- *
26
- * @since 1.0.0
27
- * @var array $rules Contains feed configuration form values
28
- * @access public
29
- */
30
- public $rules;
31
-
32
- /**
33
- * This variable is responsible for mapping store attributes to merchant attribute
34
- *
35
- * @since 1.0.0
36
- * @var array $mapping Map store attributes to merchant attribute
37
- * @access public
38
- */
39
- public $mapping;
40
-
41
- /**
42
- * This variable is responsible for generate error logs
43
- *
44
- * @since 1.0.0
45
- * @var array $errorLog Generate error logs
46
- * @access public
47
- */
48
- public $errorLog;
49
-
50
- /**
51
- * This variable is responsible for making error number
52
- *
53
- * @since 1.0.0
54
- * @var int $errorCounter Generate error number
55
- * @access public
56
- */
57
- public $errorCounter;
58
-
59
- /**
60
- * Feed Wrapper text for enclosing each product information
61
- *
62
- * @since 1.0.0
63
- * @var string $feedWrapper Feed Wrapper text
64
- * @access public
65
- */
66
- public $feedWrapper = 'review';
67
-
68
- /**
69
- * Store product information
70
- *
71
- * @since 1.0.0
72
- * @var array $storeProducts
73
- * @access public
74
- */
75
- private $storeProducts;
76
-
77
- /**
78
- * Define the core functionality to generate feed.
79
- *
80
- * Set the feed rules. Map products according to the rules and Check required attributes
81
- * and their values according to merchant specification.
82
- * @var Woo_Generate_Feed $feedRule Contain Feed Configuration
83
- * @since 1.0.0
84
- */
85
- public function __construct( $feedRule ) {
86
- $feedRule['itemWrapper'] = $this->feedWrapper;
87
- $this->products = new Woo_Feed_Products_v3( $feedRule );
88
- // When update via cron job then set productIds.
89
- if ( ! isset( $feedRule['productIds'] ) ) {
90
- $feedRule['productIds'] = $this->products->query_products();
91
- }
92
- $this->products->get_products( $feedRule['productIds'] );
93
- $this->rules = $feedRule;
94
- }
95
-
96
-
97
- /**
98
- * Return Feed
99
- *
100
- * @return array|bool|string
101
- */
102
- public function returnFinalProduct() {
103
- if ( ! empty( $this->products ) ) {
104
-
105
- if ( 'xml' == $this->rules['feedType'] ) {
106
- // return $this->get_feed($this->products);
107
- $feed = array(
108
- 'header' => $this->get_xml_feed_header(),
109
- 'body' => $this->get_xml_feed_body(),
110
- 'footer' => $this->get_xml_feed_footer(),
111
- );
112
-
113
- return $feed;
114
- }
115
- }
116
-
117
- $feed = array(
118
- 'body' => '',
119
- 'header' => '',
120
- 'footer' => '',
121
- );
122
-
123
- return $feed;
124
- }
125
-
126
-
127
-
128
- /**
129
- * Make xml node
130
- *
131
- * @param string $attribute Attribute Name
132
- * @param string $value Attribute Value
133
- * @param bool $cdata
134
- * @param string $space
135
- *
136
- * @return string
137
- */
138
- function formatXMLLine( $attribute, $value, $cdata, $space = '' ) {
139
- // Make single XML node
140
- if ( ! empty( $value ) ) {
141
- $value = trim( $value );
142
- }
143
- if ( gettype( $value ) == 'array' ) {
144
- $value = wp_json_encode( $value );
145
- }
146
- if ( false === strpos( $value, '<![CDATA[' ) && 'http' === substr( trim( $value ), 0, 4 ) ) {
147
- $value = "<![CDATA[$value]]>";
148
- } elseif ( false === strpos( $value, '<![CDATA[' ) && true === $cdata && ! empty( $value ) ) {
149
- $value = "<![CDATA[$value]]>";
150
- } elseif ( $cdata ) {
151
- if ( ! empty( $value ) ) {
152
- $value = "<![CDATA[$value]]>";
153
- }
154
- }
155
-
156
- if ( 'g:additional_image_link' == substr( $attribute, 0, 23 ) ) {
157
- $attribute = 'g:additional_image_link';
158
- }
159
-
160
- return "$space<$attribute>$value</$attribute>";
161
- }
162
-
163
-
164
- /**
165
- * Make XML Feed Header
166
- * @return string
167
- */
168
- public function get_xml_feed_header() {
169
- $output = '<?xml version="1.0" encoding="UTF-8" ?>
170
- <feed xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.google.com/shopping/reviews/schema/product/2.3/product_reviews.xsd">
171
- <publisher><name>' . html_entity_decode( get_option( 'blogname' ) ) . '</name></publisher>
172
- <reviews>';
173
-
174
- return $output;
175
- }
176
-
177
- /**
178
- * Make XML Feed
179
- * @param array $items items.
180
- * @return string
181
- */
182
- public function get_xml_feed_body() {
183
- $review_data = woo_feed_get_approved_reviews_data();
184
-
185
- $feed = $this->create_xml_lines($review_data);
186
-
187
- //$feed = '<reviewer_data></reviewer_data>';
188
- //if ( $review_data ) {
189
- //$this->create_xml_lines($review_data);
190
-
191
- return $feed;
192
- //}
193
-
194
- }
195
-
196
- /**
197
- * Make XML Feed Footer
198
- * @return string
199
- */
200
- public function get_xml_feed_footer() {
201
- $footer = ' </reviews>
202
- </feed>';
203
-
204
- return $footer;
205
- }
206
-
207
- /**
208
- * Make XML Feed Body
209
- * @param array $data review product array
210
- *
211
- * @return string
212
- */
213
- public function create_xml_lines($data) {
214
- $output = '';
215
-
216
- if( !empty($data) && is_array($data) ) {
217
- foreach($data as $data_item_key => $data_item) {
218
- $chunk_data = array_chunk($data_item, 1, true);
219
- $output .= '<review>';
220
- foreach($chunk_data as $key => $value) {
221
- foreach( $value as $item_key => $item_value ) {
222
- if( is_array($item_value) ) {
223
- if( is_int($item_key) ) {
224
- $output .= '</'. key($value) .'>';
225
- $output .= '<'. key($value) .'>';
226
- }else {
227
- $output .= '<'. $item_key .'>';
228
- }
229
- }else {
230
- $output .= '<'. $item_key .'>';
231
- }
232
- if( is_array($item_value) ) {
233
- foreach( $item_value as $item_value2_key => $item_value2 ) {
234
- if( is_array($item_value2) ) {
235
- if( is_int($item_value2_key) ) {
236
- $output .= '</'. key($item_value) .'>';
237
- $output .= '<'. key($item_value) .'>';
238
- }else {
239
- $output .= '<'. $item_value2_key .'>';
240
- }
241
- }else {
242
- $output .= '<'. $item_value2_key .'>';
243
- }
244
- if( is_array($item_value2) ) {
245
-
246
- foreach( $item_value2 as $item_value3_key => $item_value3_value ) {
247
- if( is_array($item_value3_value) ) {
248
- if( is_int($item_value3_key) ) {
249
- $output .= '</'. key($item_value2) .'>';
250
- $output .= '<'. key($item_value2) .'>';
251
- }else {
252
- $output .= '<'. $item_value3_key .'>';
253
- }
254
- }else {
255
- $output .= '<'. $item_value3_key .'>';
256
- }
257
- if( is_array($item_value3_value) ) {
258
- foreach( $item_value3_value as $item_value4_key => $item_value4_value ) {
259
- if( is_array($item_value4_value) ) {
260
- if( is_int($item_value4_key) ) {
261
- $output .= '</'. key($item_value2) .'>';
262
- $output .= '<'. key($item_value2) .'>';
263
- }else {
264
- $output .= '<'. $item_value4_key .'>';
265
- }
266
- }else {
267
- $output .= '<'. $item_value4_key .'>';
268
- }
269
-
270
- if( is_array($item_value4_value) ) {
271
- foreach( $item_value4_value as $item_value5_key => $item_value5_value ) {
272
- if( is_array($item_value5_value) ) {
273
- if( is_int($item_value5_key) ) {
274
- $output .= '</'. key($item_value3_value) .'>';
275
- $output .= '<'. key($item_value3_value) .'>';
276
- }else {
277
- $output .= '<'. $item_value5_key .'>';
278
- }
279
- }else {
280
- $output .= '<'. $item_value5_key .'>';
281
- }
282
-
283
- //test end
284
- if( is_array($item_value5_value) ) {
285
- if( is_int($item_value5_key) ) {
286
- $output .= '</'. key($item_value3_value) .'>';
287
- }else {
288
- $output .= '</'. $item_value5_key .'>';
289
- }
290
- }else {
291
- $output .= '</'. $item_value5_key .'>';
292
- }
293
- }
294
- }else {
295
- $output .= $item_value4_value;
296
- }
297
-
298
- if( is_array($item_value4_value) ) {
299
- if( is_int($item_value4_key) ) {
300
- $output .= '</'. key($item_value2) .'>';
301
- }else {
302
- $output .= '</'. $item_value4_key .'>';
303
- }
304
- }else {
305
- $output .= '</'. $item_value4_key .'>';
306
- }
307
- }
308
- }else {
309
- $output .= $item_value3_value;
310
- }
311
- if( is_array($item_value3_value) ) {
312
- if( is_int($item_value3_key) ) {
313
- $output .= '</'. key($item_value2) .'>';
314
- }else {
315
- $output .= '</'. $item_value3_key .'>';
316
- }
317
- }else {
318
- $output .= '</'. $item_value3_key .'>';
319
- }
320
- }
321
- }else {
322
- $output .= $item_value2;
323
- }
324
- if( is_array($item_value2) ) {
325
- if( is_int($item_value2_key) ) {
326
- $output .= '</'. key($item_value) .'>';
327
- }else {
328
- $output .= '</'. $item_value2_key .'>';
329
- }
330
- }else {
331
- $output .= '</'. $item_value2_key .'>';
332
- }
333
- }
334
- }else {
335
- $output .= $item_value;
336
- }
337
- if( is_array($item_value) ) {
338
- if( is_int($item_key) ) {
339
- $output .= '</'. key($value) .'>';
340
- }else {
341
- $output .= '</'. $item_key .'>';
342
- }
343
- }else {
344
- $output .= '</'. $item_key .'>';
345
- }
346
- }
347
- }
348
- $output .= '</review>';
349
- }
350
- }
351
-
352
- return $output;
353
- }
354
-
355
- /**
356
- * Short Products
357
- * @return array
358
- */
359
- public function short_products() {
360
- if ( $this->products ) {
361
- update_option( 'wpf_progress', esc_html__('Shorting Products', 'woo-feed' ), false );
362
- sleep( 1 );
363
- $array = array();
364
- $ij = 0;
365
- foreach ( $this->products as $key => $item ) {
366
- $array[ $ij ] = $item;
367
- unset( $this->products[ $key ] );
368
- $ij ++;
369
- }
370
-
371
- return $this->products = $array;
372
- }
373
-
374
- return $this->products;
375
- }
376
- }
1
+ <?php /** @noinspection PhpUnusedPrivateMethodInspection, PhpUndefinedMethodInspection, PhpUnused, PhpUnusedPrivateFieldInspection, PhpUnusedLocalVariableInspection, DuplicatedCode, PhpUnusedParameterInspection, PhpForeachNestedOuterKeyValueVariablesConflictInspection, RegExpRedundantEscape */
2
+
3
+ /**
4
+ * Class Google Product Review
5
+ *
6
+ * Responsible for processing and generating feed for Google.com
7
+ *
8
+ * @since 1.0.0
9
+ * @package Google
10
+ *
11
+ */
12
+ class Woo_Feed_Review {
13
+
14
+ /**
15
+ * This variable is responsible for holding all product attributes and their values
16
+ *
17
+ * @since 1.0.0
18
+ * @var array $products Contains all the product attributes to generate feed
19
+ * @access public
20
+ */
21
+ public $products;
22
+
23
+ /**
24
+ * This variable is responsible for holding feed configuration form values
25
+ *
26
+ * @since 1.0.0
27
+ * @var array $rules Contains feed configuration form values
28
+ * @access public
29
+ */
30
+ public $rules;
31
+
32
+ /**
33
+ * This variable is responsible for mapping store attributes to merchant attribute
34
+ *
35
+ * @since 1.0.0
36
+ * @var array $mapping Map store attributes to merchant attribute
37
+ * @access public
38
+ */
39
+ public $mapping;
40
+
41
+ /**
42
+ * This variable is responsible for generate error logs
43
+ *
44
+ * @since 1.0.0
45
+ * @var array $errorLog Generate error logs
46
+ * @access public
47
+ */
48
+ public $errorLog;
49
+
50
+ /**
51
+ * This variable is responsible for making error number
52
+ *
53
+ * @since 1.0.0
54
+ * @var int $errorCounter Generate error number
55
+ * @access public
56
+ */
57
+ public $errorCounter;
58
+
59
+ /**
60
+ * Feed Wrapper text for enclosing each product information
61
+ *
62
+ * @since 1.0.0
63
+ * @var string $feedWrapper Feed Wrapper text
64
+ * @access public
65
+ */
66
+ public $feedWrapper = 'review';
67
+
68
+ /**
69
+ * Store product information
70
+ *
71
+ * @since 1.0.0
72
+ * @var array $storeProducts
73
+ * @access public
74
+ */
75
+ private $storeProducts;
76
+
77
+ /**
78
+ * Define the core functionality to generate feed.
79
+ *
80
+ * Set the feed rules. Map products according to the rules and Check required attributes
81
+ * and their values according to merchant specification.
82
+ * @var Woo_Generate_Feed $feedRule Contain Feed Configuration
83
+ * @since 1.0.0
84
+ */
85
+ public function __construct( $feedRule ) {
86
+ $feedRule['itemWrapper'] = $this->feedWrapper;
87
+ $this->products = new Woo_Feed_Products_v3( $feedRule );
88
+ // When update via cron job then set productIds.
89
+ if ( ! isset( $feedRule['productIds'] ) ) {
90
+ $feedRule['productIds'] = $this->products->query_products();
91
+ }
92
+ $this->products->get_products( $feedRule['productIds'] );
93
+ $this->rules = $feedRule;
94
+ }
95
+
96
+
97
+ /**
98
+ * Return Feed
99
+ *
100
+ * @return array|bool|string
101
+ */
102
+ public function returnFinalProduct() {
103
+ if ( ! empty( $this->products ) ) {
104
+
105
+ if ( 'xml' == $this->rules['feedType'] ) {
106
+ // return $this->get_feed($this->products);
107
+ $feed = array(
108
+ 'header' => $this->get_xml_feed_header(),
109
+ 'body' => $this->get_xml_feed_body(),
110
+ 'footer' => $this->get_xml_feed_footer(),
111
+ );
112
+
113
+ return $feed;
114
+ }
115
+ }
116
+
117
+ $feed = array(
118
+ 'body' => '',
119
+ 'header' => '',
120
+ 'footer' => '',
121
+ );
122
+
123
+ return $feed;
124
+ }
125
+
126
+
127
+
128
+ /**
129
+ * Make xml node
130
+ *
131
+ * @param string $attribute Attribute Name
132
+ * @param string $value Attribute Value
133
+ * @param bool $cdata
134
+ * @param string $space
135
+ *
136
+ * @return string
137
+ */
138
+ function formatXMLLine( $attribute, $value, $cdata, $space = '' ) {
139
+ // Make single XML node
140
+ if ( ! empty( $value ) ) {
141
+ $value = trim( $value );
142
+ }
143
+ if ( gettype( $value ) == 'array' ) {
144
+ $value = wp_json_encode( $value );
145
+ }
146
+ if ( false === strpos( $value, '<![CDATA[' ) && 'http' === substr( trim( $value ), 0, 4 ) ) {
147
+ $value = "<![CDATA[$value]]>";
148
+ } elseif ( false === strpos( $value, '<![CDATA[' ) && true === $cdata && ! empty( $value ) ) {
149
+ $value = "<![CDATA[$value]]>";
150
+ } elseif ( $cdata ) {
151
+ if ( ! empty( $value ) ) {
152
+ $value = "<![CDATA[$value]]>";
153
+ }
154
+ }
155
+
156
+ if ( 'g:additional_image_link' == substr( $attribute, 0, 23 ) ) {
157
+ $attribute = 'g:additional_image_link';
158
+ }
159
+
160
+ return "$space<$attribute>$value</$attribute>";
161
+ }
162
+
163
+
164
+ /**
165
+ * Make XML Feed Header
166
+ * @return string
167
+ */
168
+ public function get_xml_feed_header() {
169
+ $output = '<?xml version="1.0" encoding="UTF-8" ?>
170
+ <feed xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.google.com/shopping/reviews/schema/product/2.3/product_reviews.xsd">
171
+ <publisher><name>' . html_entity_decode( get_option( 'blogname' ) ) . '</name></publisher>
172
+ <reviews>';
173
+
174
+ return $output;
175
+ }
176
+
177
+ /**
178
+ * Make XML Feed
179
+ * @param array $items items.
180
+ * @return string
181
+ */
182
+ public function get_xml_feed_body() {
183
+ $review_data = woo_feed_get_approved_reviews_data();
184
+
185
+ $feed = $this->create_xml_lines($review_data);
186
+
187
+ //$feed = '<reviewer_data></reviewer_data>';
188
+ //if ( $review_data ) {
189
+ //$this->create_xml_lines($review_data);
190
+
191
+ return $feed;
192
+ //}
193
+
194
+ }
195
+
196
+ /**
197
+ * Make XML Feed Footer
198
+ * @return string
199
+ */
200
+ public function get_xml_feed_footer() {
201
+ $footer = ' </reviews>
202
+ </feed>';
203
+
204
+ return $footer;
205
+ }
206
+
207
+ /**
208
+ * Make XML Feed Body
209
+ * @param array $data review product array
210
+ *
211
+ * @return string
212
+ */
213
+ public function create_xml_lines( $data ) {
214
+ $output = '';
215
+
216
+ if ( ! empty($data) && is_array($data) ) {
217
+ foreach ( $data as $data_item_key => $data_item ) {
218
+ $chunk_data = array_chunk($data_item, 1, true);
219
+ $output .= '<review>';
220
+ foreach ( $chunk_data as $key => $value ) {
221
+ foreach ( $value as $item_key => $item_value ) {
222
+ if ( is_array($item_value) ) {
223
+ if ( is_int($item_key) ) {
224
+ $output .= '</'. key($value) .'>';
225
+ $output .= '<'. key($value) .'>';
226
+ }else {
227
+ $output .= '<'. $item_key .'>';
228
+ }
229
+ }else {
230
+ $output .= '<'. $item_key .'>';
231
+ }
232
+ if ( is_array($item_value) ) {
233
+ foreach ( $item_value as $item_value2_key => $item_value2 ) {
234
+ if ( is_array($item_value2) ) {
235
+ if ( is_int($item_value2_key) ) {
236
+ $output .= '</'. key($item_value) .'>';
237
+ $output .= '<'. key($item_value) .'>';
238
+ }else {
239
+ $output .= '<'. $item_value2_key .'>';
240
+ }
241
+ }else {
242
+ $output .= '<'. $item_value2_key .'>';
243
+ }
244
+ if ( is_array($item_value2) ) {
245
+
246
+ foreach ( $item_value2 as $item_value3_key => $item_value3_value ) {
247
+ if ( is_array($item_value3_value) ) {
248
+ if ( is_int($item_value3_key) ) {
249
+ $output .= '</'. key($item_value2) .'>';
250
+ $output .= '<'. key($item_value2) .'>';
251
+ }else {
252
+ $output .= '<'. $item_value3_key .'>';
253
+ }
254
+ }else {
255
+ $output .= '<'. $item_value3_key .'>';
256
+ }
257
+ if ( is_array($item_value3_value) ) {
258
+ foreach ( $item_value3_value as $item_value4_key => $item_value4_value ) {
259
+ if ( is_array($item_value4_value) ) {
260
+ if ( is_int($item_value4_key) ) {
261
+ $output .= '</'. key($item_value2) .'>';
262
+ $output .= '<'. key($item_value2) .'>';
263
+ }else {
264
+ $output .= '<'. $item_value4_key .'>';
265
+ }
266
+ }else {
267
+ $output .= '<'. $item_value4_key .'>';
268
+ }
269
+
270
+ if ( is_array($item_value4_value) ) {
271
+ foreach ( $item_value4_value as $item_value5_key => $item_value5_value ) {
272
+ if ( is_array($item_value5_value) ) {
273
+ if ( is_int($item_value5_key) ) {
274
+ $output .= '</'. key($item_value3_value) .'>';
275
+ $output .= '<'. key($item_value3_value) .'>';
276
+ }else {
277
+ $output .= '<'. $item_value5_key .'>';
278
+ }
279
+ }else {
280
+ $output .= '<'. $item_value5_key .'>';
281
+ }
282
+
283
+ //test end
284
+ if ( is_array($item_value5_value) ) {
285
+ if ( is_int($item_value5_key) ) {
286
+ $output .= '</'. key($item_value3_value) .'>';
287
+ }else {
288
+ $output .= '</'. $item_value5_key .'>';
289
+ }
290
+ }else {
291
+ $output .= '</'. $item_value5_key .'>';
292
+ }
293
+ }
294
+ }else {
295
+ $output .= $item_value4_value;
296
+ }
297
+
298
+ if ( is_array($item_value4_value) ) {
299
+ if ( is_int($item_value4_key) ) {
300
+ $output .= '</'. key($item_value2) .'>';
301
+ }else {
302
+ $output .= '</'. $item_value4_key .'>';
303
+ }
304
+ }else {
305
+ $output .= '</'. $item_value4_key .'>';
306
+ }
307
+ }
308
+ }else {
309
+ $output .= $item_value3_value;
310
+ }
311
+ if ( is_array($item_value3_value) ) {
312
+ if ( is_int($item_value3_key) ) {
313
+ $output .= '</'. key($item_value2) .'>';
314
+ }else {
315
+ $output .= '</'. $item_value3_key .'>';
316
+ }
317
+ }else {
318
+ $output .= '</'. $item_value3_key .'>';
319
+ }
320
+ }
321
+ }else {
322
+ $output .= $item_value2;
323
+ }
324
+ if ( is_array($item_value2) ) {
325
+ if ( is_int($item_value2_key) ) {
326
+ $output .= '</'. key($item_value) .'>';
327
+ }else {
328
+ $output .= '</'. $item_value2_key .'>';
329
+ }
330
+ }else {
331
+ $output .= '</'. $item_value2_key .'>';
332
+ }
333
+ }
334
+ }else {
335
+ $output .= $item_value;
336
+ }
337
+ if ( is_array($item_value) ) {
338
+ if ( is_int($item_key) ) {
339
+ $output .= '</'. key($value) .'>';
340
+ }else {
341
+ $output .= '</'. $item_key .'>';
342
+ }
343
+ }else {
344
+ $output .= '</'. $item_key .'>';
345
+ }
346
+ }
347
+ }
348
+ $output .= '</review>';
349
+ }
350
+ }
351
+
352
+ return $output;
353
+ }
354
+
355
+ /**
356
+ * Short Products
357
+ * @return array
358
+ */
359
+ public function short_products() {
360
+ if ( $this->products ) {
361
+ update_option( 'wpf_progress', esc_html__('Shorting Products', 'woo-feed' ), false );
362
+ sleep( 1 );
363
+ $array = array();
364
+ $ij = 0;
365
+ foreach ( $this->products as $key => $item ) {
366
+ $array[ $ij ] = $item;
367
+ unset( $this->products[ $key ] );
368
+ $ij ++;
369
+ }
370
+
371
+ return $this->products = $array;
372
+ }
373
+
374
+ return $this->products;
375
+ }
376
+ }
includes/feeds/merchant_infos.php CHANGED
@@ -29,35 +29,43 @@ return array(
29
  ), // Google.
30
  'google_local' => array(
31
  'link' => 'https://support.google.com/merchants/answer/3061198?hl=en',
32
- 'feed_file_type' => array( 'XML', 'CSV', 'TSV', 'XLS', 'TXT' ),
33
  ),
34
  'google_local_inventory' => array(
35
  'link' => 'https://support.google.com/merchants/answer/3061342?hl=en',
36
- 'feed_file_type' => array( 'XML', 'CSV', 'TSV', 'XLS', 'TXT' ),
37
  ),
38
  'googlereview' => array(
39
  'link' => 'https://developers.google.com/product-review-feeds/sample',
40
  'feed_file_type' => array( 'XML' ),
41
  ),
42
- 'adwords' => '',
 
 
 
 
 
 
 
43
  'facebook' => array(
44
  'link' => 'http://bit.ly/2P5cA1V',
45
  'video' => 'https://youtu.be/Wo3V_nf_eUU',
46
- 'feed_file_type' => array( 'XML', 'CSV', 'TSV', 'XLS', 'TXT' ),
47
- 'doc' => array(
48
- esc_html__( 'How to configure google product categories?', 'woo-feed' ) => 'http://bit.ly/2RFWRrP',
49
- ),
50
  ), // Facebook.
51
  'pinterest' => array(
52
  'link' => 'http://bit.ly/35h6YXG',
53
- 'feed_file_type' => array( 'XML', 'CSV', 'TSV', 'XLS', 'TXT' ),
54
  'doc' => array(
55
  esc_html__( 'How to configure google product categories?', 'woo-feed' ) => 'http://bit.ly/2RFWRrP',
56
  ),
57
  ), // Pinterest.
 
 
 
 
58
  'bing' => array(
59
  'link' => 'http://bit.ly/33ZeuVS',
60
- 'feed_file_type' => array( 'TXT', 'CSV' ),
61
  ), // Bing.
62
  'pricespy' => array(
63
  'link' => 'http://bit.ly/2t0rEFm',
29
  ), // Google.
30
  'google_local' => array(
31
  'link' => 'https://support.google.com/merchants/answer/3061198?hl=en',
32
+ 'feed_file_type' => array( 'XML', 'CSV', 'TXT' ),
33
  ),
34
  'google_local_inventory' => array(
35
  'link' => 'https://support.google.com/merchants/answer/3061342?hl=en',
36
+ 'feed_file_type' => array( 'XML', 'CSV','TXT' ),
37
  ),
38
  'googlereview' => array(
39
  'link' => 'https://developers.google.com/product-review-feeds/sample',
40
  'feed_file_type' => array( 'XML' ),
41
  ),
42
+ 'google_dynamic_ads' => array(
43
+ 'link' => '',
44
+ 'feed_file_type' => array( 'CSV' ),
45
+ ),
46
+ 'adwords' => array(
47
+ 'link' => 'https://support.google.com/google-ads/answer/6053288?hl=en',
48
+ 'feed_file_type' => array( 'CSV' ),
49
+ ),
50
  'facebook' => array(
51
  'link' => 'http://bit.ly/2P5cA1V',
52
  'video' => 'https://youtu.be/Wo3V_nf_eUU',
53
+ 'feed_file_type' => array( 'XML', 'CSV','TXT' ),
 
 
 
54
  ), // Facebook.
55
  'pinterest' => array(
56
  'link' => 'http://bit.ly/35h6YXG',
57
+ 'feed_file_type' => array( 'XML', 'CSV','TXT' ),
58
  'doc' => array(
59
  esc_html__( 'How to configure google product categories?', 'woo-feed' ) => 'http://bit.ly/2RFWRrP',
60
  ),
61
  ), // Pinterest.
62
+ 'pinterest_rss' => array(
63
+ 'link' => 'http://bit.ly/35h6YXG',
64
+ 'feed_file_type' => array( 'XML' ),
65
+ ), // Pinterest.
66
  'bing' => array(
67
  'link' => 'http://bit.ly/33ZeuVS',
68
+ 'feed_file_type' => array( 'CSV', 'TSV', 'XLS', 'TXT'),
69
  ), // Bing.
70
  'pricespy' => array(
71
  'link' => 'http://bit.ly/2t0rEFm',
includes/feeds/merchant_templates.php CHANGED
@@ -68,6 +68,16 @@ return array(
68
  'suffix' => array( '', '', '', '', '', '', '', '', '', '', ' ' . $this->currency, ' ' . $this->currency , '', '', ''),
69
  'output_type' => array( '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '6', '6', '1', '1', '1' ),
70
  'limit' => array( '', '', '', '', '', '', '', '', '', '', '', '', '', '' , '' ),
 
 
 
 
 
 
 
 
 
 
71
  ),
72
  'bol' => array(
73
  'mattributes' => array(
@@ -2956,6 +2966,16 @@ return array(
2956
  'suffix' => array('','','','','','','','',),
2957
  'output_type' => array('1','1','1','1','1','1','1','1',),
2958
  'limit' => array('','','','','','','','',),
 
 
 
 
 
 
 
 
 
 
2959
  ),
2960
  'idealo' => array(
2961
  'mattributes' => array(
68
  'suffix' => array( '', '', '', '', '', '', '', '', '', '', ' ' . $this->currency, ' ' . $this->currency , '', '', ''),
69
  'output_type' => array( '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '6', '6', '1', '1', '1' ),
70
  'limit' => array( '', '', '', '', '', '', '', '', '', '', '', '', '', '' , '' ),
71
+ ),
72
+ 'pinterest_rss' => array(
73
+ 'mattributes' => array('title','description','link','image',),
74
+ 'prefix' => array('','','','',),
75
+ 'type' => array('attribute','attribute','attribute','attribute',),
76
+ 'attributes' => array('title','description','link','image',),
77
+ 'default' => array('','','','',),
78
+ 'suffix' => array('','','','',),
79
+ 'output_type' => array('1','1','1','1',),
80
+ 'limit' => array('','','','',),
81
  ),
82
  'bol' => array(
83
  'mattributes' => array(
2966
  'suffix' => array('','','','','','','','',),
2967
  'output_type' => array('1','1','1','1','1','1','1','1',),
2968
  'limit' => array('','','','','','','','',),
2969
+ ),
2970
+ 'google_dynamic_ads' => array(
2971
+ 'mattributes' => array('Page URL','Custom Label',),
2972
+ 'prefix' => array('','',),
2973
+ 'type' => array('attribute','pattern',),
2974
+ 'attributes' => array('link','',),
2975
+ 'default' => array('','',),
2976
+ 'suffix' => array('','',),
2977
+ 'output_type' => array('1','1',),
2978
+ 'limit' => array('','',),
2979
  ),
2980
  'idealo' => array(
2981
  'mattributes' => array(
includes/helper.php CHANGED
@@ -381,7 +381,7 @@ if ( ! function_exists( 'woo_feed_get_merchant_class' ) ) {
381
  return 'Woo_Feed_Google';
382
  } elseif ( 'googlereview' === $provider ) {
383
  return 'Woo_Feed_Review';
384
- } elseif ( 'pinterest' === $provider ) {
385
  return 'Woo_Feed_Pinterest';
386
  } elseif ( 'facebook' === $provider ) {
387
  return 'Woo_Feed_Facebook';
@@ -2081,8 +2081,8 @@ if ( ! function_exists( 'woo_feed_add_cdata' ) ) {
2081
  return "$attributeValue";
2082
  }
2083
  } elseif ( false !== strpos( $attributeValue, '&' ) || 'http' == substr( trim( $attributeValue ), 0, 4 ) ) {
2084
- if( 'catch.com.au' === $merchant ) {
2085
- if( false !== strpos($pluginAttribute, 'image') ) {
2086
  return "$attributeValue";
2087
  }
2088
  }else {
@@ -2901,7 +2901,7 @@ if ( ! function_exists('woo_feed_get_terms_list_hierarchical_order') ) {
2901
  }
2902
  }
2903
 
2904
- if( ! function_exists( 'woo_feed_get_products_ids_of_reviews' ) ) {
2905
  /**
2906
  * Get reviews product ids .
2907
  *
@@ -2909,12 +2909,12 @@ if( ! function_exists( 'woo_feed_get_products_ids_of_reviews' ) ) {
2909
  * @since 4.0.5
2910
  */
2911
  function woo_feed_get_products_ids_of_reviews() {
2912
- $args = array('post_type' => 'product');
2913
  $reviews = get_comments($args);
2914
  $review_products_ids = wp_list_pluck($reviews, 'comment_post_ID');
2915
 
2916
 
2917
- return !empty($review_products_ids) && is_array($review_products_ids) ? array_unique($review_products_ids) : array();
2918
 
2919
  }
2920
  }
@@ -2930,21 +2930,21 @@ if ( ! function_exists( 'woo_feed_get_approved_reviews_data' ) ) {
2930
  $approved_reviews = [];
2931
  $product_ids = woo_feed_get_products_ids_of_reviews();
2932
 
2933
- if( !empty($product_ids) && is_array($product_ids) ) {
2934
 
2935
- foreach( $product_ids as $product_id ) {
2936
  $reviews = get_comments(array(
2937
  'post_id' => $product_id,
2938
  'comment_type' => 'review',
2939
  'comment_approved' => 1,
2940
- 'parent' => 0,
2941
  ));
2942
 
2943
  $product_name = get_the_title( $product_id );
2944
  $product_link = get_the_permalink( $product_id );
2945
 
2946
- if( is_array($reviews) && sizeof($reviews) > 0 ) {
2947
- foreach($reviews as $item) {
2948
  $review = array();
2949
  $review['review_ratings'] = get_comment_meta( $item->comment_ID, 'rating', true);
2950
  $review['review_id'] = $item->comment_ID;
@@ -2965,12 +2965,10 @@ if ( ! function_exists( 'woo_feed_get_approved_reviews_data' ) ) {
2965
  $review['products']['product']['product_name'] = $product_name;
2966
  $review['products']['product']['product_url'] = $product_link;
2967
  array_push($approved_reviews, $review);
2968
- }
2969
-
2970
- }
2971
- }
2972
-
2973
- }
2974
 
2975
  return $approved_reviews;
2976
 
@@ -2978,7 +2976,7 @@ if ( ! function_exists( 'woo_feed_get_approved_reviews_data' ) ) {
2978
  }
2979
 
2980
 
2981
- if( ! function_exists('woo_feed_get_system_status') ) {
2982
  /**
2983
  * Get configuration system status.
2984
  *
@@ -2991,14 +2989,14 @@ if( ! function_exists('woo_feed_get_system_status') ) {
2991
  $php_time_limit = ini_get('max_execution_time');
2992
  $wp_memory_limit = ini_get('memory_limit');
2993
 
2994
- if( class_exists('WooCommerce') ) {
2995
  $wc_version = WooCommerce::instance()->version;
2996
 
2997
  //get total products
2998
  $args = array(
2999
  'post_type' => 'product',
3000
  'post_status' => 'publish',
3001
- 'posts_per_page' => -1
3002
  );
3003
 
3004
  $products = get_posts( $args );
@@ -3007,22 +3005,22 @@ if( ! function_exists('woo_feed_get_system_status') ) {
3007
  //get variations products
3008
  $args = array(
3009
  'post_type' => 'product_variation',
3010
- 'post_status' => array('publish'),
3011
  );
3012
 
3013
  $variations = get_posts( $args );
3014
  $total_variations = count($variations);
3015
 
3016
  $system_data = array(
3017
- 'wp_version' => array('Wordpress Version' => $wp_version),
3018
- 'woocommerce_version' => array('WooCommerce Version' => $wc_version),
3019
- 'php_version' => array('PHP Version' => phpversion()),
3020
- 'wp_memory_limit' => array('Wordpress Memory Limit' => $wp_memory_limit),
3021
- 'php_time_limit' => array('PHP Time Limit' => $php_time_limit),
3022
- 'wp_debug_mode' => array('Wordpress Debug Mode' => WP_DEBUG),
3023
- 'plugin_version' => array('WooFeed Version' => WOO_FEED_FREE_VERSION),
3024
- 'total_product' => array('Total Product' => $total_product),
3025
- 'total_variation_product' => array('Total Variation Product' => $total_variations),
3026
  );
3027
  }
3028
 
@@ -3031,7 +3029,7 @@ if( ! function_exists('woo_feed_get_system_status') ) {
3031
  }
3032
  }
3033
 
3034
- if( ! function_exists( 'woo_feed_hide_promotion' ) ) {
3035
  /**
3036
  * Update option to hide promotion.
3037
  *
@@ -3043,9 +3041,9 @@ if( ! function_exists( 'woo_feed_hide_promotion' ) ) {
3043
  if ( isset( $_REQUEST['_ajax_nonce'] ) ) {
3044
  $hide_promotion = update_option('woo_feed_hide_promotion', 1);
3045
  $data = array(
3046
- 'msg' => 'Hide promotion updated successfully.'
3047
  );
3048
- if($hide_promotion) {
3049
  wp_send_json_success( $data );
3050
  }else {
3051
  wp_send_json_error( esc_html__( 'Something is wrong.', 'woo-feed' ) );
@@ -3068,13 +3066,13 @@ if ( ! function_exists( 'array_key_first' ) ) {
3068
  * @return mixed
3069
  */
3070
  function array_key_first( array $arr ) {
3071
- foreach( $arr as $k => $unused ) {
3072
  return $k ;
3073
  }
3074
  return NULL ;
3075
  }
3076
  }
3077
- if ( ! function_exists( 'woo_feed_brand_taxonomy' )) {
3078
  /**
3079
  * Custom Taxonomy for WooCommerce Product.
3080
  *
@@ -3102,7 +3100,7 @@ if ( ! function_exists( 'woo_feed_brand_taxonomy' )) {
3102
  'hierarchical' => true,
3103
  'public' => true,
3104
  'show_ui' => true,
3105
- 'show_admin_column' => true,
3106
  'show_in_rest' => true,
3107
  'show_in_nav_menus' => true,
3108
  'show_tagcloud' => true,
@@ -3112,7 +3110,7 @@ if ( ! function_exists( 'woo_feed_brand_taxonomy' )) {
3112
  add_action( 'init', 'woo_feed_brand_taxonomy', 0 );
3113
  }
3114
 
3115
- if (! function_exists( 'woo_feed_brand_term_radio_checklist' )) {
3116
 
3117
  /**
3118
  * Use radio inputs product brand taxonomies
@@ -3142,7 +3140,7 @@ if (! function_exists( 'woo_feed_brand_term_radio_checklist' )) {
3142
  }
3143
  }
3144
  }
3145
- $args['walker'] = new Woo_Feed_Brand_Walker_Category_Radio_Checklist;
3146
  }
3147
  }
3148
  return $args;
@@ -3150,7 +3148,7 @@ if (! function_exists( 'woo_feed_brand_term_radio_checklist' )) {
3150
  add_filter( 'wp_terms_checklist_args', 'woo_feed_brand_term_radio_checklist' );
3151
  }
3152
 
3153
- if ( ! function_exists( 'woo_feed_product_structured_data' )) {
3154
 
3155
  $settings = woo_feed_get_options( 'all' );
3156
  $overridden_structured_data = $settings['overridden_structured_data'];
@@ -3322,12 +3320,12 @@ if ( ! function_exists( 'woo_feed_product_structured_data' )) {
3322
  }
3323
 
3324
  // Check if we have mpn data.
3325
- if ($disable_mpn == 'enable' && ! empty( $mpn ) ) {
3326
  $markup['mpn'] = $mpn;
3327
  }
3328
 
3329
  // Check if we have brand data.
3330
- if ( $disable_brand == 'enable' && ! empty( $brand_term )) {
3331
  $markup['brand'] = $brand_term[0];
3332
  }
3333
 
@@ -3339,20 +3337,20 @@ if ( ! function_exists( 'woo_feed_product_structured_data' )) {
3339
  }
3340
  }
3341
 
3342
- if( ! function_exists( 'woo_feed_trim_attribute' ) ) {
3343
  /**
3344
  * Trim attribute by specific sign
3345
  *
3346
  * @param $attribute string feed attribute
3347
  * @return mixed
3348
  */
3349
- function woo_feed_trim_attribute($attribute) {
3350
  return str_replace('_', ' ', $attribute);
3351
  }
3352
  }
3353
 
3354
 
3355
- if ( ! function_exists( 'woo_feed_pixel_script' )) {
3356
  /**
3357
  * Woo Feed Pixel Support
3358
  */
@@ -3370,7 +3368,7 @@ if ( ! function_exists( 'woo_feed_pixel_script' )) {
3370
  $view_type = "fbq('track', 'PageView');";
3371
 
3372
  // Product Tracking
3373
- if ( is_product() ){
3374
 
3375
  $view_type .= "fbq('track', 'ViewContent', {
3376
  content_name: '$post->post_title',
@@ -3386,10 +3384,10 @@ if ( ! function_exists( 'woo_feed_pixel_script' )) {
3386
 
3387
  $product_skus = '';
3388
  global $wp_query;
3389
- if( !empty( $wp_query->query_vars[ 'order-received' ] ) ) {
3390
  $order = wc_get_order( $wp_query->query_vars['order-received'] );
3391
  $items = $order->get_items();
3392
- foreach ($order->get_items() as $item_id => $item ) {
3393
  $order_id = $item->get_order_id();
3394
  }
3395
  $order = new WC_Order($order_id);
@@ -3399,8 +3397,10 @@ if ( ! function_exists( 'woo_feed_pixel_script' )) {
3399
  value: $price,
3400
  currency: '".get_option('woocommerce_currency')."'
3401
  });";
3402
- $view_type .= "fbq('track', 'CompleteRegistration')";
3403
-
 
 
3404
  }
3405
 
3406
  if ( $disable_pixel == 'enable' ) {
@@ -3425,7 +3425,7 @@ if ( ! function_exists( 'woo_feed_pixel_script' )) {
3425
  add_action('wp_head', 'woo_feed_pixel_script');
3426
  }
3427
 
3428
- if ( ! function_exists('woo_feed_addtocart' )) {
3429
  /**
3430
  * Woo Feed Add to Cart
3431
  */
381
  return 'Woo_Feed_Google';
382
  } elseif ( 'googlereview' === $provider ) {
383
  return 'Woo_Feed_Review';
384
+ } elseif ( in_array( $provider, array( 'pinterest', 'pinterest_rss' ) ) ) {
385
  return 'Woo_Feed_Pinterest';
386
  } elseif ( 'facebook' === $provider ) {
387
  return 'Woo_Feed_Facebook';
2081
  return "$attributeValue";
2082
  }
2083
  } elseif ( false !== strpos( $attributeValue, '&' ) || 'http' == substr( trim( $attributeValue ), 0, 4 ) ) {
2084
+ if ( 'catch.com.au' === $merchant ) {
2085
+ if ( false !== strpos($pluginAttribute, 'image') ) {
2086
  return "$attributeValue";
2087
  }
2088
  }else {
2901
  }
2902
  }
2903
 
2904
+ if ( ! function_exists( 'woo_feed_get_products_ids_of_reviews' ) ) {
2905
  /**
2906
  * Get reviews product ids .
2907
  *
2909
  * @since 4.0.5
2910
  */
2911
  function woo_feed_get_products_ids_of_reviews() {
2912
+ $args = array( 'post_type' => 'product' );
2913
  $reviews = get_comments($args);
2914
  $review_products_ids = wp_list_pluck($reviews, 'comment_post_ID');
2915
 
2916
 
2917
+ return ! empty($review_products_ids) && is_array($review_products_ids) ? array_unique($review_products_ids) : array();
2918
 
2919
  }
2920
  }
2930
  $approved_reviews = [];
2931
  $product_ids = woo_feed_get_products_ids_of_reviews();
2932
 
2933
+ if ( ! empty($product_ids) && is_array($product_ids) ) {
2934
 
2935
+ foreach ( $product_ids as $product_id ) {
2936
  $reviews = get_comments(array(
2937
  'post_id' => $product_id,
2938
  'comment_type' => 'review',
2939
  'comment_approved' => 1,
2940
+ 'parent' => 0,
2941
  ));
2942
 
2943
  $product_name = get_the_title( $product_id );
2944
  $product_link = get_the_permalink( $product_id );
2945
 
2946
+ if ( is_array($reviews) && sizeof($reviews) > 0 ) {
2947
+ foreach ( $reviews as $item ) {
2948
  $review = array();
2949
  $review['review_ratings'] = get_comment_meta( $item->comment_ID, 'rating', true);
2950
  $review['review_id'] = $item->comment_ID;
2965
  $review['products']['product']['product_name'] = $product_name;
2966
  $review['products']['product']['product_url'] = $product_link;
2967
  array_push($approved_reviews, $review);
2968
+ }
2969
+ }
2970
+ }
2971
+ }
 
 
2972
 
2973
  return $approved_reviews;
2974
 
2976
  }
2977
 
2978
 
2979
+ if ( ! function_exists('woo_feed_get_system_status') ) {
2980
  /**
2981
  * Get configuration system status.
2982
  *
2989
  $php_time_limit = ini_get('max_execution_time');
2990
  $wp_memory_limit = ini_get('memory_limit');
2991
 
2992
+ if ( class_exists('WooCommerce') ) {
2993
  $wc_version = WooCommerce::instance()->version;
2994
 
2995
  //get total products
2996
  $args = array(
2997
  'post_type' => 'product',
2998
  'post_status' => 'publish',
2999
+ 'posts_per_page' => -1,
3000
  );
3001
 
3002
  $products = get_posts( $args );
3005
  //get variations products
3006
  $args = array(
3007
  'post_type' => 'product_variation',
3008
+ 'post_status' => array( 'publish' ),
3009
  );
3010
 
3011
  $variations = get_posts( $args );
3012
  $total_variations = count($variations);
3013
 
3014
  $system_data = array(
3015
+ 'wp_version' => array( 'Wordpress Version' => $wp_version ),
3016
+ 'woocommerce_version' => array( 'WooCommerce Version' => $wc_version ),
3017
+ 'php_version' => array( 'PHP Version' => phpversion() ),
3018
+ 'wp_memory_limit' => array( 'Wordpress Memory Limit' => $wp_memory_limit ),
3019
+ 'php_time_limit' => array( 'PHP Time Limit' => $php_time_limit ),
3020
+ 'wp_debug_mode' => array( 'Wordpress Debug Mode' => WP_DEBUG ),
3021
+ 'plugin_version' => array( 'WooFeed Version' => WOO_FEED_FREE_VERSION ),
3022
+ 'total_product' => array( 'Total Product' => $total_product ),
3023
+ 'total_variation_product' => array( 'Total Variation Product' => $total_variations ),
3024
  );
3025
  }
3026
 
3029
  }
3030
  }
3031
 
3032
+ if ( ! function_exists( 'woo_feed_hide_promotion' ) ) {
3033
  /**
3034
  * Update option to hide promotion.
3035
  *
3041
  if ( isset( $_REQUEST['_ajax_nonce'] ) ) {
3042
  $hide_promotion = update_option('woo_feed_hide_promotion', 1);
3043
  $data = array(
3044
+ 'msg' => 'Hide promotion updated successfully.',
3045
  );
3046
+ if ( $hide_promotion ) {
3047
  wp_send_json_success( $data );
3048
  }else {
3049
  wp_send_json_error( esc_html__( 'Something is wrong.', 'woo-feed' ) );
3066
  * @return mixed
3067
  */
3068
  function array_key_first( array $arr ) {
3069
+ foreach ( $arr as $k => $unused ) {
3070
  return $k ;
3071
  }
3072
  return NULL ;
3073
  }
3074
  }
3075
+ if ( ! function_exists( 'woo_feed_brand_taxonomy' ) ) {
3076
  /**
3077
  * Custom Taxonomy for WooCommerce Product.
3078
  *
3100
  'hierarchical' => true,
3101
  'public' => true,
3102
  'show_ui' => true,
3103
+ 'show_admin_column' => false,
3104
  'show_in_rest' => true,
3105
  'show_in_nav_menus' => true,
3106
  'show_tagcloud' => true,
3110
  add_action( 'init', 'woo_feed_brand_taxonomy', 0 );
3111
  }
3112
 
3113
+ if ( ! function_exists( 'woo_feed_brand_term_radio_checklist' ) ) {
3114
 
3115
  /**
3116
  * Use radio inputs product brand taxonomies
3140
  }
3141
  }
3142
  }
3143
+ $args['walker'] = new Woo_Feed_Brand_Walker_Category_Radio_Checklist();
3144
  }
3145
  }
3146
  return $args;
3148
  add_filter( 'wp_terms_checklist_args', 'woo_feed_brand_term_radio_checklist' );
3149
  }
3150
 
3151
+ if ( ! function_exists( 'woo_feed_product_structured_data' ) ) {
3152
 
3153
  $settings = woo_feed_get_options( 'all' );
3154
  $overridden_structured_data = $settings['overridden_structured_data'];
3320
  }
3321
 
3322
  // Check if we have mpn data.
3323
+ if ( $disable_mpn == 'enable' && ! empty( $mpn ) ) {
3324
  $markup['mpn'] = $mpn;
3325
  }
3326
 
3327
  // Check if we have brand data.
3328
+ if ( $disable_brand == 'enable' && ! empty( $brand_term ) ) {
3329
  $markup['brand'] = $brand_term[0];
3330
  }
3331
 
3337
  }
3338
  }
3339
 
3340
+ if ( ! function_exists( 'woo_feed_trim_attribute' ) ) {
3341
  /**
3342
  * Trim attribute by specific sign
3343
  *
3344
  * @param $attribute string feed attribute
3345
  * @return mixed
3346
  */
3347
+ function woo_feed_trim_attribute( $attribute ) {
3348
  return str_replace('_', ' ', $attribute);
3349
  }
3350
  }
3351
 
3352
 
3353
+ if ( ! function_exists( 'woo_feed_pixel_script' ) ) {
3354
  /**
3355
  * Woo Feed Pixel Support
3356
  */
3368
  $view_type = "fbq('track', 'PageView');";
3369
 
3370
  // Product Tracking
3371
+ if ( is_product() ) {
3372
 
3373
  $view_type .= "fbq('track', 'ViewContent', {
3374
  content_name: '$post->post_title',
3384
 
3385
  $product_skus = '';
3386
  global $wp_query;
3387
+ if ( ! empty( $wp_query->query_vars['order-received'] ) ) {
3388
  $order = wc_get_order( $wp_query->query_vars['order-received'] );
3389
  $items = $order->get_items();
3390
+ foreach ( $order->get_items() as $item_id => $item ) {
3391
  $order_id = $item->get_order_id();
3392
  }
3393
  $order = new WC_Order($order_id);
3397
  value: $price,
3398
  currency: '".get_option('woocommerce_currency')."'
3399
  });";
3400
+ $view_type .= "fbq('track', 'CompleteRegistration', {
3401
+ value: $price,
3402
+ currency: '".get_option('woocommerce_currency')."'
3403
+ })";
3404
  }
3405
 
3406
  if ( $disable_pixel == 'enable' ) {
3425
  add_action('wp_head', 'woo_feed_pixel_script');
3426
  }
3427
 
3428
+ if ( ! function_exists('woo_feed_addtocart' ) ) {
3429
  /**
3430
  * Woo Feed Add to Cart
3431
  */
woo-feed.php CHANGED
@@ -10,7 +10,7 @@
10
  * Plugin Name: WooCommerce Product 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.3.8
14
  * Author: WebAppick
15
  * Author URI: https://webappick.com/
16
  * License: GPL v2
@@ -38,7 +38,7 @@ if ( ! defined( 'WOO_FEED_FREE_VERSION' ) ) {
38
  * @var string
39
  * @since 3.1.6
40
  */
41
- define( 'WOO_FEED_FREE_VERSION', '4.3.8' );
42
  }
43
 
44
  if ( ! defined( 'WOO_FEED_FREE_FILE' ) ) {
@@ -399,7 +399,7 @@ if ( ! function_exists( 'woo_feed_save_feed_file' ) ) {
399
  }
400
 
401
  //make file xml string
402
- if( isset($info['provider']) && 'googlereview' === $info['provider'] ) {
403
  //review template xml string
404
  $string = $feedHeader . $feedBody . $feedFooter;
405
 
10
  * Plugin Name: WooCommerce Product 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.3.9
14
  * Author: WebAppick
15
  * Author URI: https://webappick.com/
16
  * License: GPL v2
38
  * @var string
39
  * @since 3.1.6
40
  */
41
+ define( 'WOO_FEED_FREE_VERSION', '4.3.9' );
42
  }
43
 
44
  if ( ! defined( 'WOO_FEED_FREE_FILE' ) ) {
399
  }
400
 
401
  //make file xml string
402
+ if ( isset($info['provider']) && 'googlereview' === $info['provider'] ) {
403
  //review template xml string
404
  $string = $feedHeader . $feedBody . $feedFooter;
405