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.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 51.1.46 All 39 releases
← All changes | king-addons.php +83 -59 51.1.7651.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.76
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.76';
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__));
@@ -32,8 +32,11 @@
32 32 const KING_ADDONS_ASSETS_UNIQUE_KEY = 'king-addons';
33 33
34 34 require_once(KING_ADDONS_PATH . 'includes/helpers/Global/global-constants.php');
35 35
36 +// Shared AI provider abstraction (OpenAI / OpenRouter), used by admin and extensions.
37 +require_once(KING_ADDONS_PATH . 'includes/AI_Provider.php');
38 +
36 39 if (!function_exists('king_addons_freemius')) {
37 40 // Create a helper function for easy SDK access.
38 41 function king_addons_freemius()
39 42 {
@@ -103,8 +106,82 @@
103 106 return (bool) $fs->can_use_premium_code();
104 107 }
105 108 }
106 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 +
107 184 if (!function_exists('king_addons_doActivation')) {
108 185 function king_addons_doActivation()
109 186 {
110 187 add_option('king_addons_plugin_activated', true);
@@ -227,27 +304,9 @@
227 304 if (isset($_GET['page']) && $_GET['page'] === 'king-addons-account') {
228 305 return;
229 306 }
230 307
231 - $screen = function_exists('get_current_screen') ? get_current_screen() : null;
232 - if (!$screen || empty($screen->id)) {
233 - return;
234 - }
235 -
236 - $current_screen = (string) $screen->id;
237 -
238 - // Legacy explicit screens that do not follow the generic prefixes.
239 - $legacy_screens = [
240 - 'edit-king-addons-el-hf',
241 - 'edit-king-addons-fb-sub',
242 - 'header-footer_page_king-addons-el-hf-settings',
243 - ];
244 -
245 - $is_king_addons_screen = (strpos($current_screen, 'king-addons_') === 0)
246 - || (strpos($current_screen, 'toplevel_page_king-addons') === 0)
247 - || in_array($current_screen, $legacy_screens, true);
248 -
249 - if ($is_king_addons_screen) {
308 + if (king_addons_is_plugin_admin_screen()) {
250 309 // Remove all notices
251 310 remove_all_actions('user_admin_notices');
252 311 remove_all_actions('admin_notices');
253 312 }
@@ -270,30 +329,12 @@
270 329 if (!current_user_can('manage_options')) {
271 330 return $footer_text;
272 331 }
273 332
274 - $screen = function_exists('get_current_screen') ? get_current_screen() : null;
275 - if (!$screen || empty($screen->id)) {
333 + if (!king_addons_is_plugin_admin_screen()) {
276 334 return $footer_text;
277 335 }
278 336
279 - $current_screen = (string) $screen->id;
280 -
281 - // Check if we're on a King Addons admin page
282 - $legacy_screens = [
283 - 'edit-king-addons-el-hf',
284 - 'edit-king-addons-fb-sub',
285 - 'header-footer_page_king-addons-el-hf-settings',
286 - ];
287 -
288 - $is_king_addons_screen = (strpos($current_screen, 'king-addons_') === 0)
289 - || (strpos($current_screen, 'toplevel_page_king-addons') === 0)
290 - || in_array($current_screen, $legacy_screens, true);
291 -
292 - if (!$is_king_addons_screen) {
293 - return $footer_text;
294 - }
295 -
296 337 // Check if user has already rated
297 338 if (!get_option('king_addons_admin_footer_text_rated')) {
298 339 $footer_text = sprintf(
299 340 /* translators: 1: King Addons 2: five stars */
@@ -324,29 +365,12 @@
324 365 return;
325 366 }
326 367
327 368 // Only on King Addons pages and only if not already rated
328 - $screen = function_exists('get_current_screen') ? get_current_screen() : null;
329 - if (!$screen || empty($screen->id)) {
369 + if (!king_addons_is_plugin_admin_screen() || get_option('king_addons_admin_footer_text_rated')) {
330 370 return;
331 371 }
332 372
333 - $current_screen = (string) $screen->id;
334 -
335 - $legacy_screens = [
336 - 'edit-king-addons-el-hf',
337 - 'edit-king-addons-fb-sub',
338 - 'header-footer_page_king-addons-el-hf-settings',
339 - ];
340 -
341 - $is_king_addons_screen = (strpos($current_screen, 'king-addons_') === 0)
342 - || (strpos($current_screen, 'toplevel_page_king-addons') === 0)
343 - || in_array($current_screen, $legacy_screens, true);
344 -
345 - if (!$is_king_addons_screen || get_option('king_addons_admin_footer_text_rated')) {
346 - return;
347 - }
348 -
349 373 $script = "
350 374 (function() {
351 375 'use strict';
352 376 var ratingLink = document.querySelector('a.king-addons-rating-link');
@@ -421,9 +445,9 @@
421 445 // Get user's theme preference
422 446 $theme_mode = get_user_meta(get_current_user_id(), 'king_addons_theme_mode', true);
423 447 $allowed_theme_modes = ['dark', 'light', 'auto'];
424 448 if (!in_array($theme_mode, $allowed_theme_modes, true)) {
425 - $theme_mode = 'dark'; // Default to dark theme
449 + $theme_mode = 'auto';
426 450 }
427 451 ?>
428 452 <script>
429 453 (function() {