PluginProbe
Ultimate Store Kit – Store Builder Addons for Elementor, WooCommerce Store Builder, EDD Store Builder / 3.1.4
Ultimate Store Kit – Store Builder Addons for Elementor, WooCommerce Store Builder, EDD Store Builder v3.1.4
3.1.4 3.0.8 3.0.9 3.1.0 3.1.2 3.1.3 3.0.7 3.0.5 3.0.4 3.0.3 3.0.2 trunk 1.5.0 1.5.1 1.5.2 1.6.1 1.6.2 1.6.3 1.6.4 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 All 93 releases
← All changes | includes/wishlist-compare.php +13 -11 3.0.83.1.4 View file →
@@ -7,12 +7,8 @@
7 7 }
8 8
9 9 // Exit if accessed directly
10 10
11 -if (! function_exists('is_plugin_active')) {
12 - include_once ABSPATH . 'wp-admin/includes/plugin.php';
13 -}
14 -
15 11 final class WishlistCompare {
16 12 public function __construct() {
17 13 add_action('wp_ajax_usk_add_to_wishlist', [$this, 'usk_add_to_wishlist']);
18 14 add_action('wp_ajax_nopriv_usk_add_to_wishlist', [$this, 'usk_add_to_wishlist']);
@@ -49,8 +45,12 @@
49 45
50 46 check_ajax_referer('usk_wishlist_compare', 'nonce');
51 47 }
52 48
49 + // Every handler below calls verify_request() first, which PHPCS cannot follow.
50 + // See its docblock for why the logged-out path is deliberately exempt.
51 + // phpcs:disable WordPress.Security.NonceVerification.Missing
52 +
53 53 public function usk_add_to_wishlist() {
54 54 $this->verify_request();
55 55
56 56 $response = [
@@ -76,14 +76,14 @@
76 76 unset($wishlist[$key]);
77 77 } else {
78 78 // Only gate additions. A removal just drops an id the visitor already
79 79 // holds, so it must keep working even if the product was since unpublished.
80 - if (! usk_is_public_product($product_id)) {
80 + if (! ultimate_store_kit_is_public_product($product_id)) {
81 81 $response['message'] = __('Invalid product!', 'ultimate-store-kit');
82 82 wp_send_json($response);
83 83 }
84 84
85 - if ($wishlistCounter >= usk_get_list_item_limit()) {
85 + if ($wishlistCounter >= ultimate_store_kit_get_list_item_limit()) {
86 86 $response['message'] = __('Wishlist is full!', 'ultimate-store-kit');
87 87 wp_send_json($response);
88 88 }
89 89
@@ -193,21 +193,21 @@
193 193 }
194 194
195 195 $product_id = absint($_POST['product_id']);
196 196
197 - if (! usk_is_public_product($product_id)) {
197 + if (! ultimate_store_kit_is_public_product($product_id)) {
198 198 $response['message'] = __('Invalid product!', 'ultimate-store-kit');
199 199 wp_send_json($response);
200 200 }
201 201
202 202 $user_id = get_current_user_id();
203 - $compare_products = usk_get_compare_products($user_id);
203 + $compare_products = ultimate_store_kit_get_compare_products($user_id);
204 204
205 205 if (! is_array($compare_products)) {
206 206 $compare_products = [];
207 207 }
208 208
209 - if (count($compare_products) >= usk_get_list_item_limit() && ! in_array($product_id, $compare_products)) {
209 + if (count($compare_products) >= ultimate_store_kit_get_list_item_limit() && ! in_array($product_id, $compare_products)) {
210 210 $response['message'] = __('Compare list is full!', 'ultimate-store-kit');
211 211 wp_send_json($response);
212 212 }
213 213
@@ -250,9 +250,9 @@
250 250 wp_send_json($response);
251 251 }
252 252 $product_id = absint($_POST['product_id']);
253 253 $user_id = get_current_user_id();
254 - $compare_products = usk_get_compare_products($user_id);
254 + $compare_products = ultimate_store_kit_get_compare_products($user_id);
255 255
256 256 //add remove from compare products
257 257 if (($key = array_search($product_id, $compare_products)) !== false) {
258 258 $response['action'] = 'removed';
@@ -259,9 +259,9 @@
259 259 unset($compare_products[$key]);
260 260 }
261 261
262 262 // Reindex: unset() leaves a gap, and a gapped array json_encodes to an
263 - // object, which breaks the cookie read back in usk_get_compare_products().
263 + // object, which breaks the cookie read back in ultimate_store_kit_get_compare_products().
264 264 $compare_products = array_values(array_unique($compare_products));
265 265
266 266 // update compare_products
267 267 $this->ultimate_store_kit_set_compare_products($compare_products, $user_id);
@@ -282,7 +282,9 @@
282 282 } else {
283 283 setcookie($_compare_products_key, json_encode($compare_products), time() + MONTH_IN_SECONDS, COOKIEPATH, COOKIE_DOMAIN);
284 284 }
285 285 }
286 +
287 + // phpcs:enable WordPress.Security.NonceVerification.Missing
286 288 }
287 289
288 290 new WishlistCompare();