PluginProbe
King Addons for Elementor – 100+ Elementor Widgets, 4 000+ Elementor Templates, WooCommerce Builder, Mega Menu, Popup Builder / 51.1.83
King Addons for Elementor – 100+ Elementor Widgets, 4 000+ Elementor Templates, WooCommerce Builder, Mega Menu, Popup Builder v51.1.83
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 51.1.45 All 40 releases
← All changes | king-addons.php +80 -59 51.1.79 → 51.1.83 View file →
@@ -4,9 +4,9 @@
4 4 * Plugin Name: King Addons for Elementor
5 5 * Description: Elementor addons, 4,000+ Templates & Sections, 80+ Widgets, AI Tools, Mega Menu, Popup Builder, WooCommerce, Templates & Sections. Lightweight & fast Elementor toolkit.
6 6 * Author URI: https://kingaddons.com/
7 7 * Author: KingAddons.com
8 - * Version: 51.1.79
8 + * Version: 51.1.83
9 9 * Text Domain: king-addons
10 10 * Requires at least: 6.0
11 11 * Requires PHP: 7.4
12 12 * License: GPLv3
@@ -21,9 +21,9 @@
21 21 // Load plugin textdomain immediately to prevent early translation loading notices.
22 22 load_plugin_textdomain('king-addons');
23 23
24 24 /** PLUGIN VERSION */
25 -const KING_ADDONS_VERSION = '51.1.79';
25 +const KING_ADDONS_VERSION = '51.1.83';
26 26
27 27 /** DEFINES */
28 28 define('KING_ADDONS_PATH', plugin_dir_path(__FILE__));
29 29 define('KING_ADDONS_URL', plugins_url('/', __FILE__));
@@ -106,8 +106,82 @@
106 106 return (bool) $fs->can_use_premium_code();
107 107 }
108 108 }
109 109
110 +/**
111 + * Whether the WooCommerce Builder top-level menu is registered.
112 + *
113 + * Wishlist and other store screens hang off that menu when it exists,
114 + * and fall back to King Addons when it does not.
115 + *
116 + * @return bool
117 + */
118 +if (!function_exists('king_addons_woo_builder_menu_is_active')) {
119 + function king_addons_woo_builder_menu_is_active(): bool
120 + {
121 + $options = get_option('king_addons_options', []);
122 + $enabled = !isset($options['ext_woo-builder']) || $options['ext_woo-builder'] === 'enabled';
123 +
124 + return $enabled
125 + && (defined('KING_ADDONS_EXT_WOO_BUILDER') ? (bool) KING_ADDONS_EXT_WOO_BUILDER : true)
126 + && class_exists('WooCommerce')
127 + && function_exists('WC');
128 + }
129 +}
130 +
131 +/**
132 + * Parent slug for WooCommerce-related admin screens.
133 + *
134 + * Page slugs stay the same; only the WP menu parent changes.
135 + *
136 + * @return string
137 + */
138 +if (!function_exists('king_addons_woo_admin_parent_slug')) {
139 + function king_addons_woo_admin_parent_slug(): string
140 + {
141 + return king_addons_woo_builder_menu_is_active() ? 'king-addons-woo-builder' : 'king-addons';
142 + }
143 +}
144 +
145 +/**
146 + * Whether the current admin screen belongs to King Addons.
147 + *
148 + * Screen IDs follow the WP parent menu title, so Woo screens under
149 + * WooCommerce Builder become `woocommerce-builder_page_*`. Page slugs
150 + * still start with `king-addons`.
151 + *
152 + * @param string|null $current_screen Optional screen id; current screen if omitted.
153 + * @return bool
154 + */
155 +if (!function_exists('king_addons_is_plugin_admin_screen')) {
156 + function king_addons_is_plugin_admin_screen(?string $current_screen = null): bool
157 + {
158 + $page = isset($_GET['page']) ? sanitize_key(wp_unslash($_GET['page'])) : '';
159 + if ($page !== '' && strpos($page, 'king-addons') === 0) {
160 + return true;
161 + }
162 +
163 + if ($current_screen === null) {
164 + $screen = function_exists('get_current_screen') ? get_current_screen() : null;
165 + if (!$screen || empty($screen->id)) {
166 + return false;
167 + }
168 + $current_screen = (string) $screen->id;
169 + }
170 +
171 + $legacy_screens = [
172 + 'edit-king-addons-el-hf',
173 + 'edit-king-addons-fb-sub',
174 + 'header-footer_page_king-addons-el-hf-settings',
175 + ];
176 +
177 + return (strpos($current_screen, 'king-addons_') === 0)
178 + || (strpos($current_screen, 'toplevel_page_king-addons') === 0)
179 + || (strpos($current_screen, 'woocommerce-builder_page_') === 0)
180 + || in_array($current_screen, $legacy_screens, true);
181 + }
182 +}
183 +
110 184 if (!function_exists('king_addons_doActivation')) {
111 185 function king_addons_doActivation()
112 186 {
113 187 add_option('king_addons_plugin_activated', true);
@@ -230,27 +304,9 @@
230 304 if (isset($_GET['page']) && $_GET['page'] === 'king-addons-account') {
231 305 return;
232 306 }
233 307
234 - $screen = function_exists('get_current_screen') ? get_current_screen() : null;
235 - if (!$screen || empty($screen->id)) {
236 - return;
237 - }
238 -
239 - $current_screen = (string) $screen->id;
240 -
241 - // Legacy explicit screens that do not follow the generic prefixes.
242 - $legacy_screens = [
243 - 'edit-king-addons-el-hf',
244 - 'edit-king-addons-fb-sub',
245 - 'header-footer_page_king-addons-el-hf-settings',
246 - ];
247 -
248 - $is_king_addons_screen = (strpos($current_screen, 'king-addons_') === 0)
249 - || (strpos($current_screen, 'toplevel_page_king-addons') === 0)
250 - || in_array($current_screen, $legacy_screens, true);
251 -
252 - if ($is_king_addons_screen) {
308 + if (king_addons_is_plugin_admin_screen()) {
253 309 // Remove all notices
254 310 remove_all_actions('user_admin_notices');
255 311 remove_all_actions('admin_notices');
256 312 }
@@ -273,30 +329,12 @@
273 329 if (!current_user_can('manage_options')) {
274 330 return $footer_text;
275 331 }
276 332
277 - $screen = function_exists('get_current_screen') ? get_current_screen() : null;
278 - if (!$screen || empty($screen->id)) {
333 + if (!king_addons_is_plugin_admin_screen()) {
279 334 return $footer_text;
280 335 }
281 336
282 - $current_screen = (string) $screen->id;
283 -
284 - // Check if we're on a King Addons admin page
285 - $legacy_screens = [
286 - 'edit-king-addons-el-hf',
287 - 'edit-king-addons-fb-sub',
288 - 'header-footer_page_king-addons-el-hf-settings',
289 - ];
290 -
291 - $is_king_addons_screen = (strpos($current_screen, 'king-addons_') === 0)
292 - || (strpos($current_screen, 'toplevel_page_king-addons') === 0)
293 - || in_array($current_screen, $legacy_screens, true);
294 -
295 - if (!$is_king_addons_screen) {
296 - return $footer_text;
297 - }
298 -
299 337 // Check if user has already rated
300 338 if (!get_option('king_addons_admin_footer_text_rated')) {
301 339 $footer_text = sprintf(
302 340 /* translators: 1: King Addons 2: five stars */
@@ -327,29 +365,12 @@
327 365 return;
328 366 }
329 367
330 368 // Only on King Addons pages and only if not already rated
331 - $screen = function_exists('get_current_screen') ? get_current_screen() : null;
332 - if (!$screen || empty($screen->id)) {
369 + if (!king_addons_is_plugin_admin_screen() || get_option('king_addons_admin_footer_text_rated')) {
333 370 return;
334 371 }
335 372
336 - $current_screen = (string) $screen->id;
337 -
338 - $legacy_screens = [
339 - 'edit-king-addons-el-hf',
340 - 'edit-king-addons-fb-sub',
341 - 'header-footer_page_king-addons-el-hf-settings',
342 - ];
343 -
344 - $is_king_addons_screen = (strpos($current_screen, 'king-addons_') === 0)
345 - || (strpos($current_screen, 'toplevel_page_king-addons') === 0)
346 - || in_array($current_screen, $legacy_screens, true);
347 -
348 - if (!$is_king_addons_screen || get_option('king_addons_admin_footer_text_rated')) {
349 - return;
350 - }
351 -
352 373 $script = "
353 374 (function() {
354 375 'use strict';
355 376 var ratingLink = document.querySelector('a.king-addons-rating-link');
@@ -424,9 +445,9 @@
424 445 // Get user's theme preference
425 446 $theme_mode = get_user_meta(get_current_user_id(), 'king_addons_theme_mode', true);
426 447 $allowed_theme_modes = ['dark', 'light', 'auto'];
427 448 if (!in_array($theme_mode, $allowed_theme_modes, true)) {
428 - $theme_mode = 'dark'; // Default to dark theme
449 + $theme_mode = 'auto';
429 450 }
430 451 ?>
431 452 <script>
432 453 (function() {