Version Description
(2022-01-31) = * Updated: Idealo template attributes and link updated.
Download this release
Release Info
Developer | wahid0003 |
Plugin | CTX Feed – WooCommerce Product Feed Manager Plugin |
Version | 4.4.48 |
Comparing to | |
See all releases |
Code changes from version 4.4.47 to 4.4.48
- README.txt +4 -1
- includes/classes/class-woo-feed-constants.php +1 -1
- includes/classes/class-woo-feed-products-v3.php +35 -5
- includes/classes/class-woo-feed-shipping.php +12 -9
- includes/helper.php +17 -1
- includes/template-configs.php +8 -160
- includes/template-infos.php +1 -1
- woo-feed.php +57 -57
README.txt
CHANGED
@@ -5,7 +5,7 @@ Tags: Product Feed, WooCommerce, Google Shopping, Google Merchant, Facebook Cata
|
|
5 |
Requires at least: 4.4
|
6 |
Tested Up To: 5.8.2
|
7 |
Requires PHP: 5.6
|
8 |
-
Stable tag: 4.4.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -516,6 +516,9 @@ Using pro version:
|
|
516 |
|
517 |
== Changelog ==
|
518 |
|
|
|
|
|
|
|
519 |
= 4.4.47 (2022-01-24) =
|
520 |
* Added: WordPress 5.9 compatibility test and version dump.
|
521 |
|
5 |
Requires at least: 4.4
|
6 |
Tested Up To: 5.8.2
|
7 |
Requires PHP: 5.6
|
8 |
+
Stable tag: 4.4.48
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
516 |
|
517 |
== Changelog ==
|
518 |
|
519 |
+
= 4.4.48 (2022-01-31) =
|
520 |
+
* Updated: Idealo template attributes and link updated.
|
521 |
+
|
522 |
= 4.4.47 (2022-01-24) =
|
523 |
* Added: WordPress 5.9 compatibility test and version dump.
|
524 |
|
includes/classes/class-woo-feed-constants.php
CHANGED
@@ -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.
|
26 |
}
|
27 |
|
28 |
if ( ! defined( 'WOO_FEED_FREE_PATH' ) ) {
|
22 |
* @var string
|
23 |
* @since 3.1.6
|
24 |
*/
|
25 |
+
define( 'WOO_FEED_FREE_VERSION', '4.4.48' );
|
26 |
}
|
27 |
|
28 |
if ( ! defined( 'WOO_FEED_FREE_PATH' ) ) {
|
includes/classes/class-woo-feed-products-v3.php
CHANGED
@@ -71,6 +71,22 @@ class Woo_Feed_Products_v3
|
|
71 |
* @var array
|
72 |
*/
|
73 |
public $products = [];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
/**
|
75 |
* Processed Products
|
76 |
*
|
@@ -426,6 +442,9 @@ class Woo_Feed_Products_v3
|
|
426 |
$products = array_unique(array_merge($wc, $wp));
|
427 |
}
|
428 |
|
|
|
|
|
|
|
429 |
return $products;
|
430 |
}
|
431 |
|
@@ -475,6 +494,9 @@ class Woo_Feed_Products_v3
|
|
475 |
return [];
|
476 |
}
|
477 |
|
|
|
|
|
|
|
478 |
/**
|
479 |
* Fires before looping through request product for getting product data
|
480 |
*
|
@@ -3597,9 +3619,15 @@ class Woo_Feed_Products_v3
|
|
3597 |
protected function shipping($product)
|
3598 |
{
|
3599 |
$feedBody = '';
|
3600 |
-
|
3601 |
-
|
3602 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
3603 |
}
|
3604 |
|
3605 |
return apply_filters('woo_feed_filter_product_shipping', $feedBody, $product, $this->config);
|
@@ -3617,7 +3645,8 @@ class Woo_Feed_Products_v3
|
|
3617 |
*/
|
3618 |
protected function shipping_cost($product)
|
3619 |
{
|
3620 |
-
$shipping_obj = new Woo_Feed_Shipping($
|
|
|
3621 |
|
3622 |
return apply_filters('woo_feed_filter_product_shipping_cost', $shipping_obj->get_lowest_shipping_price(), $product, $this->config);
|
3623 |
}
|
@@ -3712,7 +3741,8 @@ class Woo_Feed_Products_v3
|
|
3712 |
{
|
3713 |
$feedBody = '';
|
3714 |
if (in_array($this->config['provider'], ['google', 'facebook', 'pinterest', 'bing', 'snapchat'])) {
|
3715 |
-
$shipping_obj = new Woo_Feed_Shipping($
|
|
|
3716 |
$feedBody .= $shipping_obj->get_google_tax();
|
3717 |
}
|
3718 |
|
71 |
* @var array
|
72 |
*/
|
73 |
public $products = [];
|
74 |
+
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Products IDs
|
78 |
+
*
|
79 |
+
* @var array
|
80 |
+
*/
|
81 |
+
public $product_ids = [];
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Feed Big Data
|
85 |
+
*
|
86 |
+
* @var array
|
87 |
+
*/
|
88 |
+
public $data = [];
|
89 |
+
|
90 |
/**
|
91 |
* Processed Products
|
92 |
*
|
442 |
$products = array_unique(array_merge($wc, $wp));
|
443 |
}
|
444 |
|
445 |
+
//set product ids
|
446 |
+
$this->product_ids = $products;
|
447 |
+
|
448 |
return $products;
|
449 |
}
|
450 |
|
494 |
return [];
|
495 |
}
|
496 |
|
497 |
+
//filter big data
|
498 |
+
$this->data = apply_filters("woo_feed_feed_big_data", $this->data, $productIds, $this->config);
|
499 |
+
|
500 |
/**
|
501 |
* Fires before looping through request product for getting product data
|
502 |
*
|
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 |
+
}
|
3631 |
}
|
3632 |
|
3633 |
return apply_filters('woo_feed_filter_product_shipping', $feedBody, $product, $this->config);
|
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 |
|
3651 |
return apply_filters('woo_feed_filter_product_shipping_cost', $shipping_obj->get_lowest_shipping_price(), $product, $this->config);
|
3652 |
}
|
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();
|
3747 |
}
|
3748 |
|
includes/classes/class-woo-feed-shipping.php
CHANGED
@@ -37,11 +37,9 @@ class Woo_Feed_Shipping {
|
|
37 |
*/
|
38 |
public $obj_v3;
|
39 |
|
40 |
-
public function __construct( $
|
41 |
$this->config = $feed_config;
|
42 |
-
|
43 |
-
$this->class_cost_id = $this->set_shipping_class_id();
|
44 |
-
$this->shipping_zones = $this->set_shipping_zone();
|
45 |
$this->feed_country = $this->set_country();
|
46 |
$this->settings = woo_feed_get_options( 'all' );
|
47 |
$this->currency = $this->get_currency();
|
@@ -50,6 +48,12 @@ class Woo_Feed_Shipping {
|
|
50 |
$this->obj_v3 = apply_filters("woo_feed_filter_object_v3", $obj_v3);
|
51 |
}
|
52 |
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
|
54 |
private function set_country() {
|
55 |
return $this->config['feed_country'];
|
@@ -94,11 +98,10 @@ class Woo_Feed_Shipping {
|
|
94 |
return $class_cost_id;
|
95 |
}
|
96 |
|
97 |
-
public function set_shipping_zone() {
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
return false;
|
102 |
}
|
103 |
|
104 |
/**
|
37 |
*/
|
38 |
public $obj_v3;
|
39 |
|
40 |
+
public function __construct( $feed_config ) {
|
41 |
$this->config = $feed_config;
|
42 |
+
//$this->class_cost_id = $this->set_shipping_class_id();
|
|
|
|
|
43 |
$this->feed_country = $this->set_country();
|
44 |
$this->settings = woo_feed_get_options( 'all' );
|
45 |
$this->currency = $this->get_currency();
|
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;
|
55 |
+
}
|
56 |
+
|
57 |
|
58 |
private function set_country() {
|
59 |
return $this->config['feed_country'];
|
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;
|
|
|
105 |
}
|
106 |
|
107 |
/**
|
includes/helper.php
CHANGED
@@ -2210,7 +2210,7 @@ if (!function_exists('woo_feed_parse_string')) {
|
|
2210 |
// split on outer delimiter
|
2211 |
$pairs = explode('&', $str);
|
2212 |
|
2213 |
-
if (!empty($pairs)) {
|
2214 |
|
2215 |
// loop through each pair
|
2216 |
foreach ($pairs as $i) {
|
@@ -5507,6 +5507,22 @@ if( ! function_exists( 'woo_feed_get_plugin_pages_slugs' ) ) {
|
|
5507 |
|
5508 |
}
|
5509 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5510 |
#==== MERCHANT TEMPLATE OVERRIDE END ================#
|
5511 |
|
5512 |
// Including pluggable functions file
|
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) {
|
5507 |
|
5508 |
}
|
5509 |
|
5510 |
+
if( ! function_exists('woo_feed_make_feed_big_data') ) {
|
5511 |
+
function woo_feed_make_feed_big_data($data, $ids, $config) {
|
5512 |
+
|
5513 |
+
//setup feed shipping data @TODO: need to make a class when another data setup will be added
|
5514 |
+
if( isset($config['attributes']) && in_array("shipping", $config["attributes"]) ) {
|
5515 |
+
if ( class_exists( 'WC_Shipping_Zones' ) ) {
|
5516 |
+
$data['shipping_zones'] = WC_Shipping_Zones::get_zones();
|
5517 |
+
}
|
5518 |
+
}
|
5519 |
+
|
5520 |
+
return $data;
|
5521 |
+
|
5522 |
+
}
|
5523 |
+
add_filter('woo_feed_feed_big_data', 'woo_feed_make_feed_big_data', 10, 3);
|
5524 |
+
}
|
5525 |
+
|
5526 |
#==== MERCHANT TEMPLATE OVERRIDE END ================#
|
5527 |
|
5528 |
// Including pluggable functions file
|
includes/template-configs.php
CHANGED
@@ -2704,166 +2704,14 @@ return array(
|
|
2704 |
'limit' => array( '', '', '', '', '', '', '', '', '', '', '', '', '', '', '' ),
|
2705 |
),
|
2706 |
'idealo' => array(
|
2707 |
-
'mattributes' => array(
|
2708 |
-
|
2709 |
-
|
2710 |
-
|
2711 |
-
|
2712 |
-
|
2713 |
-
|
2714 |
-
|
2715 |
-
'Product group in shop',
|
2716 |
-
'Product description',
|
2717 |
-
'Product characteristics',
|
2718 |
-
'Product URL',
|
2719 |
-
'Image URL',
|
2720 |
-
'Colour',
|
2721 |
-
'Size',
|
2722 |
-
'Cash in advance',
|
2723 |
-
'Unit price',
|
2724 |
-
'Energy efficiency rating',
|
2725 |
-
'Shipping cost comment',
|
2726 |
-
),
|
2727 |
-
'prefix' => array(
|
2728 |
-
'',
|
2729 |
-
'',
|
2730 |
-
'',
|
2731 |
-
'',
|
2732 |
-
'',
|
2733 |
-
'',
|
2734 |
-
'',
|
2735 |
-
'',
|
2736 |
-
'',
|
2737 |
-
'',
|
2738 |
-
'',
|
2739 |
-
'',
|
2740 |
-
'',
|
2741 |
-
'',
|
2742 |
-
'',
|
2743 |
-
'',
|
2744 |
-
'',
|
2745 |
-
'',
|
2746 |
-
),
|
2747 |
-
'type' => array(
|
2748 |
-
'attribute',
|
2749 |
-
'attribute',
|
2750 |
-
'attribute',
|
2751 |
-
'attribute',
|
2752 |
-
'attribute',
|
2753 |
-
'attribute',
|
2754 |
-
'pattern',
|
2755 |
-
'attribute',
|
2756 |
-
'attribute',
|
2757 |
-
'attribute',
|
2758 |
-
'attribute',
|
2759 |
-
'attribute',
|
2760 |
-
'attribute',
|
2761 |
-
'attribute',
|
2762 |
-
'attribute',
|
2763 |
-
'attribute',
|
2764 |
-
'attribute',
|
2765 |
-
'attribute',
|
2766 |
-
),
|
2767 |
-
'attributes' => array(
|
2768 |
-
'id',
|
2769 |
-
'',
|
2770 |
-
'',
|
2771 |
-
'',
|
2772 |
-
'title',
|
2773 |
-
'price',
|
2774 |
-
'',
|
2775 |
-
'product_type',
|
2776 |
-
'description',
|
2777 |
-
'',
|
2778 |
-
'link',
|
2779 |
-
'image',
|
2780 |
-
'',
|
2781 |
-
'',
|
2782 |
-
'',
|
2783 |
-
'',
|
2784 |
-
'',
|
2785 |
-
'shipping_cost',
|
2786 |
-
),
|
2787 |
-
'default' => array(
|
2788 |
-
'',
|
2789 |
-
'',
|
2790 |
-
'',
|
2791 |
-
'',
|
2792 |
-
'',
|
2793 |
-
'',
|
2794 |
-
'1-3 working days',
|
2795 |
-
'',
|
2796 |
-
'',
|
2797 |
-
'',
|
2798 |
-
'',
|
2799 |
-
'',
|
2800 |
-
'',
|
2801 |
-
'',
|
2802 |
-
'',
|
2803 |
-
'',
|
2804 |
-
'',
|
2805 |
-
'',
|
2806 |
-
),
|
2807 |
-
'suffix' => array(
|
2808 |
-
'',
|
2809 |
-
'',
|
2810 |
-
'',
|
2811 |
-
'',
|
2812 |
-
'',
|
2813 |
-
'',
|
2814 |
-
'',
|
2815 |
-
'',
|
2816 |
-
'',
|
2817 |
-
'',
|
2818 |
-
'',
|
2819 |
-
'',
|
2820 |
-
'',
|
2821 |
-
'',
|
2822 |
-
'',
|
2823 |
-
'',
|
2824 |
-
'',
|
2825 |
-
' ' . $this->currency,
|
2826 |
-
),
|
2827 |
-
'output_type' => array(
|
2828 |
-
'1',
|
2829 |
-
'1',
|
2830 |
-
'1',
|
2831 |
-
'1',
|
2832 |
-
'1',
|
2833 |
-
'1',
|
2834 |
-
'1',
|
2835 |
-
'1',
|
2836 |
-
'11',
|
2837 |
-
'1',
|
2838 |
-
'1',
|
2839 |
-
'1',
|
2840 |
-
'1',
|
2841 |
-
'1',
|
2842 |
-
'1',
|
2843 |
-
'1',
|
2844 |
-
'1',
|
2845 |
-
'1',
|
2846 |
-
),
|
2847 |
-
'limit' => array(
|
2848 |
-
'',
|
2849 |
-
'',
|
2850 |
-
'',
|
2851 |
-
'',
|
2852 |
-
'',
|
2853 |
-
'',
|
2854 |
-
'',
|
2855 |
-
'',
|
2856 |
-
'',
|
2857 |
-
'',
|
2858 |
-
'',
|
2859 |
-
'',
|
2860 |
-
'',
|
2861 |
-
'',
|
2862 |
-
'',
|
2863 |
-
'',
|
2864 |
-
'',
|
2865 |
-
'',
|
2866 |
-
),
|
2867 |
),
|
2868 |
'pricespy' => array(
|
2869 |
'mattributes' => 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(
|
includes/template-infos.php
CHANGED
@@ -82,7 +82,7 @@ return array(
|
|
82 |
'feed_file_type' => array( 'TXT' ),
|
83 |
), // Prisjakt.
|
84 |
'idealo' => array(
|
85 |
-
'link' => 'https://connect.idealo.de/
|
86 |
'feed_file_type' => array( 'CSV', 'TXT' ),
|
87 |
), // Idealo.
|
88 |
'yandex_csv' => array(
|
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(
|
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.
|
14 |
* Author: WebAppick
|
15 |
* Author URI: https://webappick.com/
|
16 |
* License: GPL v2
|
@@ -896,67 +896,67 @@ if ( ! function_exists( 'woo_feed_flash_cache_action' ) ) {
|
|
896 |
}
|
897 |
}
|
898 |
|
899 |
-
// Suggest other plugins of webappick.
|
900 |
if ( ! class_exists( 'webappick_suggest_plugin' ) ) {
|
901 |
-
|
902 |
|
903 |
-
|
904 |
-
|
905 |
-
|
906 |
add_filter( 'install_plugins_table_api_args_featured', array( __CLASS__, 'featured_plugins_tab' ) );
|
907 |
}
|
908 |
-
|
909 |
-
|
910 |
-
|
911 |
-
|
912 |
-
|
913 |
-
|
914 |
-
|
915 |
-
|
916 |
-
|
917 |
-
|
918 |
-
|
919 |
-
|
920 |
-
|
921 |
-
|
922 |
-
|
923 |
-
|
924 |
-
|
925 |
-
|
926 |
-
|
927 |
-
|
928 |
-
|
929 |
-
|
930 |
-
|
931 |
-
|
932 |
-
|
933 |
-
|
934 |
-
|
935 |
-
|
936 |
-
|
937 |
-
|
938 |
-
|
939 |
-
|
940 |
-
|
941 |
-
|
942 |
-
|
943 |
-
|
944 |
-
|
945 |
-
|
946 |
-
|
947 |
-
|
948 |
-
|
949 |
-
|
950 |
-
|
951 |
-
|
952 |
-
|
953 |
-
|
954 |
-
|
955 |
-
|
956 |
-
|
957 |
-
|
958 |
-
|
959 |
}
|
|
|
960 |
|
961 |
register_deactivation_hook( __FILE__, 'woo_feed_deactivate' );
|
962 |
if ( ! function_exists( 'woo_feed_deactivate' ) ) {
|
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.48
|
14 |
* Author: WebAppick
|
15 |
* Author URI: https://webappick.com/
|
16 |
* License: GPL v2
|
896 |
}
|
897 |
}
|
898 |
|
|
|
899 |
if ( ! class_exists( 'webappick_suggest_plugin' ) ) {
|
900 |
+
class webappick_suggest_plugin {
|
901 |
|
902 |
+
static function init() {
|
903 |
+
if ( is_admin() ) {
|
904 |
+
if ( ! is_plugin_active('xt-woo-variation-swatches/xt-woo-variation-swatches.php') ) {
|
905 |
add_filter( 'install_plugins_table_api_args_featured', array( __CLASS__, 'featured_plugins_tab' ) );
|
906 |
}
|
907 |
+
}
|
908 |
+
} // init
|
909 |
+
// add our plugins to recommended list
|
910 |
+
static function plugins_api_result( $res, $action, $args ) {
|
911 |
+
remove_filter( 'plugins_api_result', array( __CLASS__, 'plugins_api_result' ), 10, 1 );
|
912 |
+
$res = self::add_plugin_favs( 'webappick-pdf-invoice-for-woocommerce', $res );
|
913 |
+
|
914 |
+
return $res;
|
915 |
+
} // plugins_api_result
|
916 |
+
// helper function for adding plugins to fav list
|
917 |
+
static function featured_plugins_tab( $args ) {
|
918 |
+
add_filter( 'plugins_api_result', array( __CLASS__, 'plugins_api_result' ), 10, 3 );
|
919 |
+
return $args;
|
920 |
+
} // featured_plugins_tab
|
921 |
+
// add single plugin to list of favs
|
922 |
+
static function add_plugin_favs( $plugin_slug, $res ) {
|
923 |
+
if ( ! empty( $res->plugins ) && is_array( $res->plugins ) ) {
|
924 |
+
foreach ( $res->plugins as $plugin ) {
|
925 |
+
if ( is_object( $plugin ) && ! empty( $plugin->slug ) && $plugin->slug === $plugin_slug ) {
|
926 |
+
return $res;
|
927 |
+
}
|
928 |
+
} // foreach
|
929 |
+
}
|
930 |
+
$plugin_info = get_transient( 'wf-plugin-info-' . $plugin_slug );
|
931 |
+
if ( $plugin_info ) {
|
932 |
+
array_unshift( $res->plugins, $plugin_info );
|
933 |
+
} else {
|
934 |
+
$plugin_info = plugins_api(
|
935 |
+
'plugin_information',
|
936 |
+
array(
|
937 |
+
'slug' => $plugin_slug,
|
938 |
+
'is_ssl' => is_ssl(),
|
939 |
+
'fields' => array(
|
940 |
+
'banners' => true,
|
941 |
+
'reviews' => true,
|
942 |
+
'downloaded' => true,
|
943 |
+
'active_installs' => true,
|
944 |
+
'icons' => true,
|
945 |
+
'short_description' => true,
|
946 |
+
),
|
947 |
+
)
|
948 |
+
);
|
949 |
+
if ( ! is_wp_error( $plugin_info ) ) {
|
950 |
+
$res->plugins[] = $plugin_info;
|
951 |
+
set_transient( 'wf-plugin-info-' . $plugin_slug, $plugin_info, DAY_IN_SECONDS * 7 );
|
952 |
+
}
|
953 |
+
}
|
954 |
+
return $res;
|
955 |
+
} // add_plugin_favs
|
956 |
+
}
|
957 |
+
add_action( 'init', array( 'webappick_suggest_plugin', 'init' ) );
|
958 |
}
|
959 |
+
// Suggest other plugins of webappick.
|
960 |
|
961 |
register_deactivation_hook( __FILE__, 'woo_feed_deactivate' );
|
962 |
if ( ! function_exists( 'woo_feed_deactivate' ) ) {
|