PluginProbe
King Addons for Elementor – 100+ Elementor Widgets, 4 000+ Elementor Templates, WooCommerce Builder, Mega Menu, Popup Builder / 51.1.87
King Addons for Elementor – 100+ Elementor Widgets, 4 000+ Elementor Templates, WooCommerce Builder, Mega Menu, Popup Builder v51.1.87
51.1.87 51.1.86 51.1.84 51.1.85 51.1.83 51.1.82 51.1.81 51.1.79 51.1.78 51.1.77 51.1.76 51.1.74 51.1.75 51.1.65 51.1.64 51.1.63 trunk 51.1.14 51.1.2 51.1.35 51.1.36 51.1.37 51.1.38 51.1.39 51.1.44 All 41 releases
← All changes | includes/wishlist/Wishlist_Settings.php +63 -3 51.1.64 → 51.1.87 View file →
@@ -13,8 +13,18 @@
13 13 {
14 14 private const OPTION_KEY = 'king_addons_wishlist_settings';
15 15
16 16 /**
17 + * One-time flag: archive product-card buttons used to default on.
18 + */
19 + private const ARCHIVE_BUTTON_OPT_IN_FLAG = 'king_addons_wishlist_archive_button_opt_in';
20 +
21 + /**
22 + * One-time flag: single-product auto buttons used to always inject.
23 + */
24 + private const SINGLE_BUTTON_OPT_IN_FLAG = 'king_addons_wishlist_single_button_opt_in';
25 +
26 + /**
17 27 * Get merged wishlist settings with defaults.
18 28 *
19 29 * @return array<string, mixed> Settings.
20 30 */
@@ -20,12 +30,61 @@
20 30 */
21 31 public static function get_settings(): array
22 32 {
23 33 $saved = get_option(self::OPTION_KEY, []);
24 - return wp_parse_args($saved, self::defaults());
34 + return wp_parse_args(is_array($saved) ? $saved : [], self::defaults());
25 35 }
26 36
27 37 /**
38 + * Turn off auto-injected product-card buttons unless the site opts in.
39 + *
40 + * Older versions defaulted this on, so a plugin update put a wishlist
41 + * button on every shop card. Sites that want it can enable “Show on
42 + * Product Cards” in King Addons → Wishlist → Buttons.
43 + *
44 + * @return void
45 + */
46 + public static function maybe_disable_archive_buttons(): void
47 + {
48 + if ('1' !== (string) get_option(self::ARCHIVE_BUTTON_OPT_IN_FLAG, '')) {
49 + $saved = get_option(self::OPTION_KEY, []);
50 + if (is_array($saved) && array_key_exists('show_in_archives', $saved)) {
51 + $saved['show_in_archives'] = false;
52 + update_option(self::OPTION_KEY, $saved, false);
53 + }
54 +
55 + update_option(self::ARCHIVE_BUTTON_OPT_IN_FLAG, '1', false);
56 + }
57 +
58 + self::maybe_disable_single_buttons();
59 + }
60 +
61 + /**
62 + * Turn off auto-injected single-product buttons unless the site opts in.
63 + *
64 + * Older versions always hooked next to Add to Cart / Buy Now, including
65 + * the King Addons Add to Cart widget. Sites that want that can enable
66 + * “Show on Single Product” in King Addons → Wishlist → Buttons.
67 + *
68 + * @return void
69 + */
70 + public static function maybe_disable_single_buttons(): void
71 + {
72 + if ('1' === (string) get_option(self::SINGLE_BUTTON_OPT_IN_FLAG, '')) {
73 + return;
74 + }
75 +
76 + $saved = get_option(self::OPTION_KEY, []);
77 + if (!is_array($saved)) {
78 + $saved = [];
79 + }
80 +
81 + $saved['show_on_single'] = false;
82 + update_option(self::OPTION_KEY, $saved, false);
83 + update_option(self::SINGLE_BUTTON_OPT_IN_FLAG, '1', false);
84 + }
85 +
86 + /**
28 87 * Get a specific setting value.
29 88 *
30 89 * @param string $key Setting key.
31 90 * @param mixed $default Default fallback.
@@ -94,13 +153,14 @@
94 153 'button_add_text' => esc_html__('Add to wishlist', 'king-addons'),
95 154 'button_added_text' => esc_html__('In wishlist', 'king-addons'),
96 155 'button_display_mode' => 'icon_text', // icon, icon_text
97 156 'button_position' => 'after_add_to_cart', // before_add_to_cart|after_add_to_cart
98 - 'show_in_archives' => true,
157 + 'show_in_archives' => false,
158 + 'show_on_single' => false,
99 159 'wishlist_columns' => ['image', 'title', 'price', 'stock', 'notes', 'add_to_cart', 'remove'],
100 160 'cache_enabled' => false,
101 161 'cache_ttl' => 0,
102 - 'icon_choice' => 'eicon-heart',
162 + 'icon_choice' => 'fas fa-heart',
103 163 ];
104 164 }
105 165
106 166 /**