Version Description
(2019-11-25) = * Promo Update
Download this release
Release Info
Developer | wahid0003 |
Plugin | CTX Feed – WooCommerce Product Feed Manager Plugin |
Version | 3.1.53 |
Comparing to | |
See all releases |
Code changes from version 3.1.52 to 3.1.53
- README.txt +4 -1
- includes/classes/class-woo-feed-tracker.php +13 -3
- libs/WebAppick/AppServices/Client.php +8 -1
- libs/WebAppick/AppServices/Insights.php +1 -1
- libs/WebAppick/AppServices/License.php +1 -0
- libs/WebAppick/AppServices/Promotions.php +349 -0
- libs/WebAppick/AppServices/Updater.php +1 -1
- woo-feed.php +2 -2
README.txt
CHANGED
@@ -5,7 +5,7 @@ Tags:woocommerce,google product feed,facebook product feed,woocommerce product f
|
|
5 |
Requires at least: 3.6
|
6 |
Tested Up To: 5.4-alpha-46743
|
7 |
Requires PHP: 5.6
|
8 |
-
Stable tag: 3.1.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -305,6 +305,9 @@ Using pro version:
|
|
305 |
|
306 |
== Changelog ==
|
307 |
|
|
|
|
|
|
|
308 |
= 3.1.52 (2019-11-24) =
|
309 |
* Fix: Hide google taxonomy dropdown if attribute selected
|
310 |
* Fix: Autocomplete attribute value
|
5 |
Requires at least: 3.6
|
6 |
Tested Up To: 5.4-alpha-46743
|
7 |
Requires PHP: 5.6
|
8 |
+
Stable tag: 3.1.53
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
305 |
|
306 |
== Changelog ==
|
307 |
|
308 |
+
= 3.1.53 (2019-11-25) =
|
309 |
+
* Promo Update
|
310 |
+
|
311 |
= 3.1.52 (2019-11-24) =
|
312 |
* Fix: Hide google taxonomy dropdown if attribute selected
|
313 |
* Fix: Autocomplete attribute value
|
includes/classes/class-woo-feed-tracker.php
CHANGED
@@ -10,10 +10,17 @@ if( ! defined( 'ABSPATH' ) ) die();
|
|
10 |
* Class WooFeedTracker
|
11 |
*/
|
12 |
final class WooFeedTracker {
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
/**
|
14 |
-
*
|
|
|
15 |
*/
|
16 |
-
public $
|
17 |
|
18 |
/**
|
19 |
* Class constructor
|
@@ -29,7 +36,6 @@ final class WooFeedTracker {
|
|
29 |
}
|
30 |
|
31 |
$client = new WebAppick\AppServices\Client( '4e68acba-cbdc-476b-b4bf-eab176ac6a16', 'WooCommerce Product Feed', WOO_FEED_FREE_FILE );
|
32 |
-
|
33 |
$this->insights = $client->insights();
|
34 |
// Hide tracker notice until tracking server gets ready...
|
35 |
// Tracker will not send data until user click Allow (optIn)
|
@@ -45,6 +51,10 @@ final class WooFeedTracker {
|
|
45 |
'product_cat_num' => wp_count_terms( 'product_cat', ['hide_empty'=> false, 'parent' => 0] ),
|
46 |
] );
|
47 |
$this->insights->init_plugin();
|
|
|
|
|
|
|
|
|
48 |
add_filter( $client->getSlug() . '_WebAppick_API_URL', array( $this, 'uninstallStatEndPoint' ), 10, 3 );
|
49 |
}
|
50 |
|
10 |
* Class WooFeedTracker
|
11 |
*/
|
12 |
final class WooFeedTracker {
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Insight class instance
|
16 |
+
* @var \WebAppick\AppServices\Insights
|
17 |
+
*/
|
18 |
+
public $insights;
|
19 |
/**
|
20 |
+
* Promotions Class Instance
|
21 |
+
* @var \WebAppick\AppServices\Promotions
|
22 |
*/
|
23 |
+
public $promotion;
|
24 |
|
25 |
/**
|
26 |
* Class constructor
|
36 |
}
|
37 |
|
38 |
$client = new WebAppick\AppServices\Client( '4e68acba-cbdc-476b-b4bf-eab176ac6a16', 'WooCommerce Product Feed', WOO_FEED_FREE_FILE );
|
|
|
39 |
$this->insights = $client->insights();
|
40 |
// Hide tracker notice until tracking server gets ready...
|
41 |
// Tracker will not send data until user click Allow (optIn)
|
51 |
'product_cat_num' => wp_count_terms( 'product_cat', ['hide_empty'=> false, 'parent' => 0] ),
|
52 |
] );
|
53 |
$this->insights->init_plugin();
|
54 |
+
// Promo offers
|
55 |
+
$this->promotion = $client->promotions();
|
56 |
+
$this->promotion->set_source( 'https://api.bitbucket.org/2.0/snippets/woofeed/RLbyop/files/woo-feed-notice.json' )->init();
|
57 |
+
|
58 |
add_filter( $client->getSlug() . '_WebAppick_API_URL', array( $this, 'uninstallStatEndPoint' ), 10, 3 );
|
59 |
}
|
60 |
|
libs/WebAppick/AppServices/Client.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
namespace WebAppick\AppServices;
|
3 |
use WP_Error;
|
4 |
-
|
5 |
/**
|
6 |
* WebAppick Services Client
|
7 |
* @package WebAppick
|
@@ -111,6 +111,13 @@ class Client {
|
|
111 |
return new Insights( $this );
|
112 |
}
|
113 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
114 |
/**
|
115 |
* Initialize Plugin/Theme updater
|
116 |
*
|
1 |
<?php
|
2 |
namespace WebAppick\AppServices;
|
3 |
use WP_Error;
|
4 |
+
if( ! defined( 'ABSPATH' ) ) die();
|
5 |
/**
|
6 |
* WebAppick Services Client
|
7 |
* @package WebAppick
|
111 |
return new Insights( $this );
|
112 |
}
|
113 |
|
114 |
+
public function promotions() {
|
115 |
+
if( ! class_exists( __NAMESPACE__ . '\Promotions' ) ) {
|
116 |
+
require_once __DIR__ . '/Promotions.php';
|
117 |
+
}
|
118 |
+
return new Promotions( $this );
|
119 |
+
}
|
120 |
+
|
121 |
/**
|
122 |
* Initialize Plugin/Theme updater
|
123 |
*
|
libs/WebAppick/AppServices/Insights.php
CHANGED
@@ -3,7 +3,7 @@ namespace WebAppick\AppServices;
|
|
3 |
use mysql_xdevapi\Exception;
|
4 |
use WP_Theme;
|
5 |
use WP_User;
|
6 |
-
|
7 |
/**
|
8 |
* WebAppick Insights
|
9 |
*
|
3 |
use mysql_xdevapi\Exception;
|
4 |
use WP_Theme;
|
5 |
use WP_User;
|
6 |
+
if( ! defined( 'ABSPATH' ) ) die();
|
7 |
/**
|
8 |
* WebAppick Insights
|
9 |
*
|
libs/WebAppick/AppServices/License.php
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
<?php
|
2 |
namespace WebAppick\AppServices;
|
|
|
3 |
/**
|
4 |
* WebAppick License Checker
|
5 |
*
|
1 |
<?php
|
2 |
namespace WebAppick\AppServices;
|
3 |
+
if( ! defined( 'ABSPATH' ) ) die();
|
4 |
/**
|
5 |
* WebAppick License Checker
|
6 |
*
|
libs/WebAppick/AppServices/Promotions.php
ADDED
@@ -0,0 +1,349 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace WebAppick\AppServices;
|
3 |
+
if( ! defined( 'ABSPATH' ) ) die();
|
4 |
+
/**
|
5 |
+
* Webappick Promotion handler
|
6 |
+
* @version 1.0.0
|
7 |
+
*/
|
8 |
+
/**
|
9 |
+
* Class Promotions
|
10 |
+
* Source Format
|
11 |
+
*
|
12 |
+
$promos = [
|
13 |
+
(object) [
|
14 |
+
// required; offer start
|
15 |
+
'start' => '2019-11-20 00:00:01',
|
16 |
+
// required; offer end
|
17 |
+
'end' => '2019-12-04 23:59:00',
|
18 |
+
// required; some unique hash for offer, use for hiding the offer when user click to close.
|
19 |
+
'hash' => '9df37798-bd35-421b-b6f2-fbc095686efc',
|
20 |
+
// Optional; Allow closing default is 0, set to 1 to allow user hide it
|
21 |
+
'dismissible' => 1, // 0
|
22 |
+
// required; main content required, will be filtered with wp_kses_post()
|
23 |
+
'content' => '<p>Biggest Sale of the year on this</p><h3>Black Friday & Cyber Monday</h3><p>Claim your discount on till 4th December</p>',
|
24 |
+
// optional; wrapper padding
|
25 |
+
wrapperPadding => ''
|
26 |
+
// optional; image source url or data url
|
27 |
+
'backgroundImage' => '',
|
28 |
+
// optional;
|
29 |
+
'backgroundRepeat' => '',
|
30 |
+
// optional;
|
31 |
+
'backgroundSize' => '',
|
32 |
+
// optional; background color to apply with the background image
|
33 |
+
'backgroundColor' => '#000',
|
34 |
+
// optional; text color will be inherited by the content
|
35 |
+
'color' => '#fff',
|
36 |
+
// optional; can be empty
|
37 |
+
'logo' => [
|
38 |
+
// required; image source url or data url
|
39 |
+
'src' => '',
|
40 |
+
// required;
|
41 |
+
'alt' => 'Woo Feed Pro',
|
42 |
+
],
|
43 |
+
// optional; can be empty
|
44 |
+
'button' => [
|
45 |
+
// required
|
46 |
+
'label' => 'Save 30%',
|
47 |
+
// required
|
48 |
+
'url' => '#?utm_campaign=black_friday_&_cyber_monday&utm_medium=banner&utm_source=wp_dashboard',
|
49 |
+
// optional;
|
50 |
+
'backgroundColor' => '#F71560',
|
51 |
+
// optional;
|
52 |
+
'color' => '#FFF',
|
53 |
+
// optional;
|
54 |
+
'after' => '<span style="font-size: 12px; font-weight: 700; margin-top: 12px; display: block;">Coupon: BFCM2019</span>', // html content filtered with wp_kses_post()
|
55 |
+
],
|
56 |
+
],
|
57 |
+
];
|
58 |
+
*
|
59 |
+
*/
|
60 |
+
class Promotions {
|
61 |
+
|
62 |
+
/**
|
63 |
+
* WebAppick\AppServices\Client
|
64 |
+
*
|
65 |
+
* @var Client
|
66 |
+
*/
|
67 |
+
protected $client;
|
68 |
+
|
69 |
+
/**
|
70 |
+
* URL for Promotions source json file
|
71 |
+
* @var string
|
72 |
+
*/
|
73 |
+
private $promotionSrc;
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Promotions
|
77 |
+
* @var bool|object[]
|
78 |
+
*/
|
79 |
+
private $promotions = false;
|
80 |
+
/**
|
81 |
+
* List of hidden promotions for current user
|
82 |
+
* @var array
|
83 |
+
*/
|
84 |
+
private $hiddenPromotions;
|
85 |
+
/**
|
86 |
+
* Current User Id
|
87 |
+
* @var int
|
88 |
+
*/
|
89 |
+
private $currentUser = 0;
|
90 |
+
|
91 |
+
/**
|
92 |
+
* Promotions constructor.
|
93 |
+
* @param Client $client
|
94 |
+
* @param string $data_source
|
95 |
+
* @return void
|
96 |
+
*/
|
97 |
+
public function __construct( Client $client, $data_source = null ) {
|
98 |
+
$this->client = $client;
|
99 |
+
if( ! is_null( $data_source ) ) $this->promotionSrc = esc_url( $data_source );
|
100 |
+
}
|
101 |
+
|
102 |
+
/**
|
103 |
+
* Set JSON Source File URL For getting promotion data
|
104 |
+
* @param $URL
|
105 |
+
*
|
106 |
+
* @return Promotions
|
107 |
+
*/
|
108 |
+
public function set_source( $URL ) {
|
109 |
+
$this->promotionSrc = esc_url( $URL );
|
110 |
+
return $this;
|
111 |
+
}
|
112 |
+
|
113 |
+
/**
|
114 |
+
* Init Promotions
|
115 |
+
* @return void
|
116 |
+
*/
|
117 |
+
public function init() {
|
118 |
+
if( is_null( $this->promotionSrc ) ) {
|
119 |
+
_doing_it_wrong( __METHOD__, __( 'Promotion Source URL Not Set. see Promotions::set_source( $URL )', 'webappick' ), '1.0.0' );
|
120 |
+
}
|
121 |
+
add_action( 'admin_init', [ $this, '__init_internal' ], 10 );
|
122 |
+
}
|
123 |
+
|
124 |
+
/**
|
125 |
+
* Set environment variables and init internal hooks
|
126 |
+
* @return void
|
127 |
+
*/
|
128 |
+
public function __init_internal() {
|
129 |
+
$this->currentUser = get_current_user_id();
|
130 |
+
$this->hiddenPromotions = get_user_option( $this->client->getSlug() . '_hidden_promos', $this->currentUser ) ?: [];
|
131 |
+
$this->promotions = $this->__get_promos();
|
132 |
+
// only run if there is active promotions.
|
133 |
+
if( count( $this->promotions ) ) {
|
134 |
+
add_action( 'admin_notices', [ $this, '__show_promos' ], 10 );
|
135 |
+
add_action( 'wp_ajax_webappick_dismiss_promo', [ $this, '__webappick_dismiss_promo' ], 10 );
|
136 |
+
add_action( 'admin_print_styles', [ $this, '__get_promo_styles' ], 99 );
|
137 |
+
add_action( 'admin_enqueue_scripts', [ $this, '__enqueue_deps' ], 10 );
|
138 |
+
add_action( 'admin_print_footer_scripts', [ $this, '__get_promo_scripts' ], 10 );
|
139 |
+
}
|
140 |
+
}
|
141 |
+
|
142 |
+
/**
|
143 |
+
* Render Promotions
|
144 |
+
* @return void
|
145 |
+
*/
|
146 |
+
public function __show_promos() {
|
147 |
+
foreach( $this->promotions as $promotion ) {
|
148 |
+
$wrapperStyles = $buttonStyles = "";
|
149 |
+
$is_dismissible = ! isset( $promotion->dismissible ) || isset( $promotion->dismissible ) && $promotion->dismissible == 0 ? false : true;
|
150 |
+
|
151 |
+
$has_columns = isset( $promotion->button, $promotion->logo );
|
152 |
+
if( isset( $promotion->color ) ) $wrapperStyles .= 'color: '.$promotion->color.';';
|
153 |
+
if( isset( $promotion->wrapperPadding ) ) $wrapperStyles .= 'padding: '.$promotion->wrapperPadding.';';
|
154 |
+
if( isset( $promotion->backgroundColor ) ) $wrapperStyles .= 'background-color: '.$promotion->backgroundColor.';';
|
155 |
+
if( isset( $promotion->backgroundImage ) ) $wrapperStyles .= 'background-image: url("'. esc_url( $promotion->backgroundImage ) .'");';
|
156 |
+
if( isset( $promotion->backgroundRepeat ) ) $wrapperStyles .= 'background-repeat: '.$promotion->backgroundRepeat.';';
|
157 |
+
if( isset( $promotion->backgroundSize ) ) $wrapperStyles .= 'background-size: '.$promotion->backgroundSize.';';
|
158 |
+
if( property_exists( $promotion, 'button' ) ) {
|
159 |
+
if( isset( $promotion->button->backgroundColor ) ) $buttonStyles .= 'background-color: '.$promotion->button->backgroundColor.';border-color: '.$promotion->button->backgroundColor .';';
|
160 |
+
if( isset( $promotion->button->color ) ) $buttonStyles .= 'color: '.$promotion->button->color.';';
|
161 |
+
}
|
162 |
+
$noticeClasses = 'notice notice-success wapk-promo';
|
163 |
+
if( $is_dismissible ) $noticeClasses .= ' is-dismissible';
|
164 |
+
?>
|
165 |
+
<div class="<?php echo esc_attr( $noticeClasses ); ?> " id="<?php echo esc_attr( $promotion->hash ); ?>" data-nonce="<?php echo wp_create_nonce( 'wapk-dismiss-promo' ); ?>" style="<?php echo esc_attr( $wrapperStyles ); ?>">
|
166 |
+
<div class="wapk-promo-wrap<?php if( ! $has_columns ) echo ' no-column'; ?>">
|
167 |
+
<?php if( isset( $promotion->logo ) && ! empty( $promotion->logo ) ) { ?>
|
168 |
+
<div class="wapk-logo wapk-column">
|
169 |
+
<img src="<?php echo esc_url( $promotion->logo->src ); ?>" alt="<?php echo esc_attr( $promotion->logo->alt ); ?>">
|
170 |
+
</div>
|
171 |
+
<?php } ?>
|
172 |
+
<div class="wapk-details<?php if( $has_columns ) echo ' wapk-column'; ?>">
|
173 |
+
<?php echo wp_kses_post( $promotion->content ); ?>
|
174 |
+
</div>
|
175 |
+
<?php if( isset( $promotion->button ) && ! empty( $promotion->button ) ) { ?>
|
176 |
+
<div class="wapk-btn-container wapk-column">
|
177 |
+
<a href="<?php echo esc_url( $promotion->button->url ) ?>" class="button wapk-promo-btn" style="<?php echo esc_attr( $buttonStyles ); ?>" target="_blank"><?php echo wp_kses_post( $promotion->button->label ); ?></a>
|
178 |
+
<?php if( isset( $promotion->button->after ) && ! empty( $promotion->button->after ) ) {
|
179 |
+
echo wp_kses_post( $promotion->button->after );
|
180 |
+
} ?>
|
181 |
+
</div>
|
182 |
+
<?php } ?>
|
183 |
+
<?php if( isset( $promotion->button ) && ! empty( $promotion->button ) ) { ?>
|
184 |
+
<?php } ?>
|
185 |
+
</div>
|
186 |
+
</div>
|
187 |
+
<?php
|
188 |
+
}
|
189 |
+
}
|
190 |
+
|
191 |
+
/**
|
192 |
+
* Get Promotion Data
|
193 |
+
* Cache First then fetch source url for json data.
|
194 |
+
* @return array
|
195 |
+
*/
|
196 |
+
private function __get_promos() {
|
197 |
+
$promos = get_transient( $this->client->getSlug() . '_cached_promos' );
|
198 |
+
if( empty( $promos ) ) {
|
199 |
+
// get promotions data from json source
|
200 |
+
$response = wp_remote_get( $this->promotionSrc, array( 'timeout' => 15 ) );
|
201 |
+
$promos = wp_remote_retrieve_body( $response );
|
202 |
+
if ( is_wp_error( $response ) || $response['response']['code'] != 200 ) $promos = '[]';
|
203 |
+
// cache data
|
204 |
+
set_transient( $this->client->getSlug() . '_cached_promos', $promos, 12 * HOUR_IN_SECONDS );
|
205 |
+
}
|
206 |
+
// decode to array
|
207 |
+
$promos = json_decode( $promos );
|
208 |
+
|
209 |
+
// filter promotions by date
|
210 |
+
$promos = array_filter( $promos, [ $this, '__is_promo_active' ] );
|
211 |
+
if( ! empty( $promos ) ) {
|
212 |
+
// filter promotions by list of hidden promotions by the user
|
213 |
+
$promos = array_filter( $promos, [ $this, '__is_promo_hidden' ] );
|
214 |
+
}
|
215 |
+
return $promos;
|
216 |
+
}
|
217 |
+
|
218 |
+
/**
|
219 |
+
* Check if promotion is active by date.
|
220 |
+
* must have start and end property
|
221 |
+
* @param stdClass $promo {
|
222 |
+
* @type string $content string. required
|
223 |
+
* @type string $start valid timestamp. required
|
224 |
+
* @type string $end valid timestamp. required
|
225 |
+
* }
|
226 |
+
*
|
227 |
+
* @return bool
|
228 |
+
*/
|
229 |
+
public function __is_promo_active( $promo ) {
|
230 |
+
return ( ! empty( $promo->content ) && strtotime( $promo->start ) < current_time( 'timestamp' ) && current_time( 'timestamp' ) < strtotime( $promo->end ) );
|
231 |
+
}
|
232 |
+
|
233 |
+
/**
|
234 |
+
* Check if promo is hidden by current user
|
235 |
+
* @param stdClass $promo {
|
236 |
+
* @type string $hash valid unique hash for a promo
|
237 |
+
* }
|
238 |
+
*
|
239 |
+
* @return bool true if promo is hidden by user
|
240 |
+
*/
|
241 |
+
public function __is_promo_hidden( $promo ) {
|
242 |
+
return ! in_array( $promo->hash, $this->hiddenPromotions );
|
243 |
+
}
|
244 |
+
|
245 |
+
/**
|
246 |
+
* Js Dependencies
|
247 |
+
* @return void
|
248 |
+
*/
|
249 |
+
public function __enqueue_deps(){
|
250 |
+
wp_enqueue_script( 'wp-util' );
|
251 |
+
wp_enqueue_script( 'jquery' );
|
252 |
+
}
|
253 |
+
|
254 |
+
/**
|
255 |
+
* Script for hiding promo on user click
|
256 |
+
* @return void
|
257 |
+
*/
|
258 |
+
public function __get_promo_scripts() {
|
259 |
+
?><script>
|
260 |
+
(function($){
|
261 |
+
$('body').on('click', '.wapk-promo .notice-dismiss', function (e) {
|
262 |
+
e.preventDefault();
|
263 |
+
var $parent = $(this).closest( '.wapk-promo' );
|
264 |
+
wp.ajax.post('webappick_dismiss_promo', {
|
265 |
+
dismissed: true,
|
266 |
+
hash: $parent.attr( 'id' ),
|
267 |
+
_wpnonce: $parent.data( 'nonce' ),
|
268 |
+
});
|
269 |
+
});
|
270 |
+
})(jQuery);
|
271 |
+
</script><?php
|
272 |
+
}
|
273 |
+
|
274 |
+
/**
|
275 |
+
* Global Promo Styles
|
276 |
+
* @return void
|
277 |
+
*/
|
278 |
+
public function __get_promo_styles() {
|
279 |
+
?><style>
|
280 |
+
.wapk-promo { border: none; padding: 15px 0; }
|
281 |
+
.wapk-promo-wrap { display: flex; justify-content: center; align-items: center; text-align: center; color: inherit; max-width: 1820px; margin: 0 auto; }
|
282 |
+
.wapk-promo-wrap.no-column{ display: block; }
|
283 |
+
.wapk-column.wapk-logo { flex: 0 0 25%; }
|
284 |
+
.wapk-column.wapk-logo img { height: 48px; width: auto; }
|
285 |
+
.wapk-details {display: block;}
|
286 |
+
.wapk-details h3 { color: inherit; font-size: 30px; margin: 12px 0; }
|
287 |
+
.wapk-details p { color: inherit; font-size: 15px; }
|
288 |
+
.wapk-column.wapk-details { flex: 0 0 50%; }
|
289 |
+
.wapk-column.wapk-btn-container { flex: 0 0 25%; }
|
290 |
+
.wapk-promo-wrap .wapk-promo-btn { position: relative; padding: 15px; border-radius: 30px; font-size: 15px; font-weight: 700; display: block; color: inherit; text-decoration: none; max-width: 200px; margin: 0 auto; line-height: normal; height: auto; box-shadow: 1px 2px 0 rgba(0, 0, 0, 0.1); }
|
291 |
+
.wapk-promo-wrap .wapk-promo-btn:focus,
|
292 |
+
.wapk-promo-wrap .wapk-promo-btn:hover,
|
293 |
+
.wapk-promo-wrap .wapk-promo-btn:active { box-shadow: inset 3px 4px 6px 0 rgba(1, 9, 12, 0.25); }
|
294 |
+
.wapk-promo-wrap .wapk-promo-btn:active { top: 1px; }
|
295 |
+
|
296 |
+
@media screen and (max-width: 1200px) {
|
297 |
+
.wapk-promo-wrap { display: block; overflow: hidden; }
|
298 |
+
.wapk-column .wapk-logo { width: 100%; margin: 0 auto; }
|
299 |
+
.wapk-column .wapk-details { width: 68%; float: left; margin-right: 4%; margin-top: 32px; }
|
300 |
+
.wapk-column.wapk-btn-container { width: 28%; float: right; margin-top: 42px; }
|
301 |
+
}
|
302 |
+
@media screen and (max-width: 782px) {
|
303 |
+
.wapk-promo-wrap .wapk-details { float: none; width: 100%; }
|
304 |
+
.wapk-btn-container { float: none; width: 100%; margin-top: 32px; }
|
305 |
+
.wapk-column.wapk-btn-container { width: 100%; float: right; margin-top: 42px; }
|
306 |
+
}
|
307 |
+
</style><?php
|
308 |
+
}
|
309 |
+
|
310 |
+
/**
|
311 |
+
* Ajax Callback handler for hiding promo
|
312 |
+
* @return void
|
313 |
+
*/
|
314 |
+
public function __webappick_dismiss_promo() {
|
315 |
+
if (
|
316 |
+
isset( $_REQUEST['dismissed'], $_REQUEST['hash'], $_REQUEST['_wpnonce'] ) &&
|
317 |
+
$_REQUEST['dismissed'] == 'true' &&
|
318 |
+
! empty( $_REQUEST['hash'] ) &&
|
319 |
+
wp_verify_nonce( $_REQUEST['_wpnonce'], 'wapk-dismiss-promo' )
|
320 |
+
) {
|
321 |
+
$this->hiddenPromotions = array_merge( $this->hiddenPromotions, [ $_REQUEST['hash'] ] );
|
322 |
+
update_user_option( $this->currentUser, $this->client->getSlug() . '_hidden_promos', $this->hiddenPromotions );
|
323 |
+
wp_send_json_success( __( 'Promo hidden', 'webappick' ) );
|
324 |
+
}
|
325 |
+
wp_send_json_error( __( 'Invalid Request', 'webappick' ) );
|
326 |
+
die();
|
327 |
+
}
|
328 |
+
|
329 |
+
/**
|
330 |
+
* Clear Hidden Promotion preference for User
|
331 |
+
* @return bool
|
332 |
+
*/
|
333 |
+
public function clear_hidden_promos() {
|
334 |
+
if( ! did_action( 'admin_init' ) ) {
|
335 |
+
_doing_it_wrong( __METHOD__, __( 'Method must be invoked inside admin_init action', 'webappick' ), '1.0.0' );
|
336 |
+
}
|
337 |
+
$this->currentUser = get_current_user_id();
|
338 |
+
return delete_user_option( $this->currentUser, $this->client->getSlug() . '_hidden_promos' );
|
339 |
+
}
|
340 |
+
|
341 |
+
/**
|
342 |
+
* Clear Cached Promotion data
|
343 |
+
* @return bool
|
344 |
+
*/
|
345 |
+
public function clear_cache() {
|
346 |
+
return delete_transient( $this->client->getSlug() . '_cached_promos' );
|
347 |
+
}
|
348 |
+
}
|
349 |
+
// End of file class-woo-feed-promotions.php
|
libs/WebAppick/AppServices/Updater.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
namespace WebAppick\AppServices;
|
3 |
use stdClass;
|
4 |
-
|
5 |
/**
|
6 |
* WebAppick Updater
|
7 |
*
|
1 |
<?php
|
2 |
namespace WebAppick\AppServices;
|
3 |
use stdClass;
|
4 |
+
if( ! defined( 'ABSPATH' ) ) die();
|
5 |
/**
|
6 |
* WebAppick Updater
|
7 |
*
|
woo-feed.php
CHANGED
@@ -15,7 +15,7 @@
|
|
15 |
* Plugin Name: WooCommerce Product Feed
|
16 |
* Plugin URI: https://webappick.com/
|
17 |
* Description: This plugin generate WooCommerce product feed for Shopping Engines like Google Shopping,Facebook Product Feed,eBay,Amazon,Idealo and many more..
|
18 |
-
* Version: 3.1.
|
19 |
* Author: WebAppick
|
20 |
* Author URI: https://webappick.com/
|
21 |
* License: GPL v2
|
@@ -41,7 +41,7 @@ if( ! defined( 'WOO_FEED_VERSION' ) ) {
|
|
41 |
* Plugin Version
|
42 |
* @var string
|
43 |
*/
|
44 |
-
define( 'WOO_FEED_VERSION', '3.1.
|
45 |
}
|
46 |
if( ! defined( 'WOO_FEED_FREE_FILE') ) {
|
47 |
/**
|
15 |
* Plugin Name: WooCommerce Product Feed
|
16 |
* Plugin URI: https://webappick.com/
|
17 |
* Description: This plugin generate WooCommerce product feed for Shopping Engines like Google Shopping,Facebook Product Feed,eBay,Amazon,Idealo and many more..
|
18 |
+
* Version: 3.1.53
|
19 |
* Author: WebAppick
|
20 |
* Author URI: https://webappick.com/
|
21 |
* License: GPL v2
|
41 |
* Plugin Version
|
42 |
* @var string
|
43 |
*/
|
44 |
+
define( 'WOO_FEED_VERSION', '3.1.53' );
|
45 |
}
|
46 |
if( ! defined( 'WOO_FEED_FREE_FILE') ) {
|
47 |
/**
|