PluginProbe
Adminify – White Label, Admin Menu Editor, Login Customizer / 4.0.5.4
Adminify – White Label, Admin Menu Editor, Login Customizer v4.0.5.4
4.3.2 4.3.1 4.3.0 4.2.26 4.2.25 4.2.24 4.2.23 4.2.22 4.2.21 4.2.20 4.2.19 4.2.18 4.2.17 4.2.16 4.2.15 4.2.14 4.2.13 4.2.12 4.2.11 4.2.10 4.2.9 4.2.8 4.2.7 4.2.6 4.2.5 All 165 releases
← All changes | Inc/Classes/Assets.php +117 -482 4.3.24.0.5.4 View file →
@@ -1,12 +1,11 @@
1 1 <?php
2 2
3 -namespace PXLBSAdminify\Inc\Classes;
3 +namespace WPAdminify\Inc\Classes;
4 4
5 -use PXLBSAdminify\Inc\Utils;
6 -use PXLBSAdminify\Inc\Admin\AdminSettings;
7 -use PXLBSAdminify\Inc\Admin\AdminSettingsModel;
8 -use PXLBSAdminify\Inc\Classes\Addons_Plugins;
5 +use WPAdminify\Inc\Utils;
6 +use WPAdminify\Inc\Admin\AdminSettings;
7 +use WPAdminify\Inc\Admin\AdminSettingsModel;
9 8
10 9
11 10
12 11 // no direct access allowed
@@ -25,48 +24,21 @@
25 24 {
26 25 $this->options = (array) AdminSettings::get_instance()->get();
27 26 $global_dark_mode = !empty($this->options['light_dark_mode']['admin_ui_mode']) ? $this->options['light_dark_mode']['admin_ui_mode'] : 'light';
28 27 $this->dark_mode = empty(get_user_meta(get_current_user_id(), 'color_mode', true)) ? $global_dark_mode : get_user_meta(get_current_user_id(), 'color_mode', true);
29 - add_action('admin_enqueue_scripts', array($this, 'pxlbsadminify_admin_scripts'), 100);
30 - add_action('wp_ajax_pxlbsadminify_addons_install_active', array( $this, 'pxlbsadminify_addons_install_active' ) );
31 - add_action('wp_ajax_pxlbsadminify_ssl_check', array( $this, 'pxlbsadminify_ssl_check' ) );
28 + add_action('admin_enqueue_scripts', array($this, 'jltwp_adminify_admin_scripts'), 100);
29 + add_action('wp_ajax_jltwp_adminify_addons_install_active', 'jltwp_adminify_addons_install_active');
32 30
33 - // Always hooked: header_scripts() prints the dark-mode loader, which the
34 - // topbar toggle needs even on pages that booted in light mode.
35 - add_action('admin_head', array($this, 'header_scripts'));
31 + if ($this->is_dark_mode() || $this->classic_editor || $this->block_editor) {
32 + add_action('admin_head', array($this, 'header_scripts'));
33 + }
36 34 }
37 35
38 36
39 37 /**
40 - * Resolved light/dark mode for the current user, normalised to
41 - * 'light' | 'dark' | 'system'. The settings UI has used 'auto' as a
42 - * synonym for 'system', so fold that in here.
43 - *
44 - * @return string
45 - */
46 - public function color_mode()
47 - {
48 - $mode = !empty($this->dark_mode) ? $this->dark_mode : 'light';
49 -
50 - return ('auto' === $mode) ? 'system' : $mode;
51 - }
52 -
53 -
54 - /**
55 - * URL of the dark mode (Darkreader) bundle.
56 - *
57 - * @return string
58 - */
59 - private function dark_mode_url()
60 - {
61 - return PXLBSADMINIFY_ASSETS . 'admin/js/wp-adminify-dark-mode' . Utils::assets_ext('.js');
62 - }
63 -
64 -
65 - /**
66 38 * Function: Ajax Call for Install and Activate WP Adminify Plugin
67 39 */
68 - function pxlbsadminify_addons_install_active()
40 + function jltwp_adminify_addons_install_active()
69 41 {
70 42
71 43 // Include necessary WordPress files
72 44 require_once ABSPATH . 'wp-admin/includes/plugin-install.php';
@@ -77,9 +49,9 @@
77 49 if (isset($_POST['plugin'])) {
78 50
79 51 $nonce = isset($_POST['nonce']) ? sanitize_text_field(wp_unslash($_POST['nonce'])) : '';
80 52
81 - if (!wp_verify_nonce($nonce, 'pxlbsadminify_addons_nonce')) {
53 + if (!wp_verify_nonce($nonce, 'jltwp_adminify_addons_nonce')) {
82 54 wp_send_json_error(array('mess' => esc_html__('Nonce is invalid', 'adminify')));
83 55 }
84 56
85 57 if ((is_multisite() && is_network_admin()) || !current_user_can('install_plugins')) {
@@ -91,37 +63,14 @@
91 63 if (empty($plugin)) {
92 64 wp_send_json_error(array('mess' => esc_html__('Invalid plugin', 'adminify')));
93 65 }
94 66
95 - // Validate the requested plugin against the trusted addons list
96 - // and replace the user-supplied value with the canonical
97 - // download URL from that list before passing it to the upgrader.
98 - $addons = new Addons_Plugins();
99 - $plugins_list = (array) $addons->get_adminify_plugins_lists();
100 - $requested_slug = '';
101 - $trusted_source = '';
102 - foreach ( $plugins_list as $slug => $entry ) {
103 - if ( ! empty( $entry['download_link'] ) && $entry['download_link'] === $plugin ) {
104 - $requested_slug = $slug;
105 - $trusted_source = $entry['download_link'];
106 - break;
107 - }
108 - if ( $slug === $plugin ) {
109 - $requested_slug = $slug;
110 - $trusted_source = ! empty( $entry['download_link'] ) ? $entry['download_link'] : '';
111 - break;
112 - }
113 - }
114 - if ( empty( $requested_slug ) || empty( $trusted_source ) ) {
115 - wp_send_json_error( array( 'mess' => esc_html__( 'Invalid plugin', 'adminify' ) ) );
116 - }
117 -
118 67 $type = isset($_POST['type']) ? sanitize_text_field(wp_unslash($_POST['type'])) : 'install';
119 68 $skin = new \WP_Ajax_Upgrader_Skin();
120 69 $upgrader = new \Plugin_Upgrader($skin);
121 70
122 71 if ('install' === $type) {
123 - $result = $upgrader->install( $trusted_source );
72 + $result = $upgrader->install($plugin);
124 73 if (is_wp_error($result)) {
125 74 wp_send_json_error(
126 75 array(
127 76 'mess' => $result->get_error_message(),
@@ -175,144 +124,48 @@
175 124 }
176 125 return $adminify_dark_mode;
177 126 }
178 127
179 - /**
180 - * Print the dark-mode loader and boot it for the resolved mode.
181 - *
182 - * The Darkreader bundle is ~110 KB, so it is no longer enqueued on every admin
183 - * page. What ships on every page instead is `window.PXLBSADMINIFYDarkMode`, a few hundred
184 - * bytes that know how to pull the bundle into a window on demand:
185 - *
186 - * - 'dark' the bundle is already enqueued in the head by
187 - * pxlbsadminify_admin_scripts(), so this only calls enable().
188 - * - 'system' nothing is enqueued; the browser decides. When the OS prefers dark
189 - * the loader fetches the bundle, with a pre-paint guard so the page
190 - * does not flash white while it streams in.
191 - * - 'light' nothing is fetched at all.
192 - *
193 - * The topbar toggle (classic admin bar and the React frame alike) calls
194 - * PXLBSADMINIFYDarkMode.load() so switching to dark works without a page reload.
195 - */
196 128 public function header_scripts()
197 129 {
198 - // Skip on excluded pages
199 - if ( $this->should_skip_adminify_scripts() ) {
200 - return;
201 - }
130 + if (!empty($this->dark_mode) && $this->dark_mode == 'dark') { ?>
202 131
203 - $mode = $this->color_mode();
204 - ?>
205 - <script id="adminify-dark-mode-loader">
206 - window.PXLBSADMINIFYDarkMode = window.PXLBSADMINIFYDarkMode || (function () {
207 - var url = <?php echo wp_json_encode( $this->dark_mode_url() ); ?>;
132 + <script>
133 + window.AdminifyDarkMode.enable({
134 + brightness: 120
135 + })
208 136
209 - // Pulls the bundle into `win` (defaults to this window) and hands
210 - // AdminifyDarkMode to `cb`. Repeat calls while a fetch is in flight
211 - // queue up behind it instead of requesting the file again.
212 - function load(win, cb) {
213 - win = win || window;
214 - cb = cb || function () {};
137 + addEventListener("load", (event) => {
138 + window.AdminifyDarkMode.enable({
139 + brightness: 120
140 + })
141 + });
142 + </script>
143 + <?php }
215 144
216 - var doc;
217 - try {
218 - doc = win.document;
219 - } catch (e) {
220 - return;
221 - }
222 - if (!doc) {
223 - return;
224 - }
145 + if (!empty($this->dark_mode) && $this->dark_mode == 'system') { ?>
146 + <script>
147 + const isDark = window.matchMedia("(prefers-color-scheme: dark)").matches;
148 + if(!!isDark) {
149 + window.AdminifyDarkMode.enable({
150 + brightness: 120
151 + })
225 152
226 - if (win.AdminifyDarkMode) {
227 - cb(win.AdminifyDarkMode);
228 - return;
229 - }
153 + addEventListener("load", (event) => {
154 + window.AdminifyDarkMode.enable({
155 + brightness: 120
156 + })
157 + });
158 + } else {
159 + window.AdminifyDarkMode.disable()
230 160
231 - if (win.__pxlbsadminifyDarkModeQueue) {
232 - win.__pxlbsadminifyDarkModeQueue.push(cb);
233 - return;
234 - }
235 - win.__pxlbsadminifyDarkModeQueue = [cb];
236 -
237 - var script = doc.createElement('script');
238 - script.src = url;
239 - script.async = false;
240 - script.onload = function () {
241 - var queue = win.__pxlbsadminifyDarkModeQueue || [];
242 - win.__pxlbsadminifyDarkModeQueue = null;
243 - for (var i = 0; i < queue.length; i++) {
244 - try {
245 - queue[i](win.AdminifyDarkMode);
246 - } catch (e) {}
247 - }
248 - };
249 - script.onerror = function () {
250 - win.__pxlbsadminifyDarkModeQueue = null;
251 - };
252 - (doc.head || doc.documentElement).appendChild(script);
253 - }
254 -
255 - function enable(win) {
256 - load(win, function (dm) {
257 - if (dm) {
258 - dm.enable({ brightness: 120 });
259 - }
161 + addEventListener("load", (event) => {
162 + window.AdminifyDarkMode.disable()
260 163 });
261 164 }
262 165
263 - function disable(win) {
264 - win = win || window;
265 - // Nothing to undo when the bundle was never fetched.
266 - if (win.AdminifyDarkMode) {
267 - win.AdminifyDarkMode.disable();
268 - }
269 - }
270 -
271 - return { url: url, load: load, enable: enable, disable: disable };
272 - }());
273 - </script>
274 - <?php if ( 'dark' === $mode ) { ?>
275 - <script>
276 - window.PXLBSADMINIFYDarkMode.enable();
277 - addEventListener("load", function () {
278 - window.PXLBSADMINIFYDarkMode.enable();
279 - });
280 166 </script>
281 - <?php } elseif ( 'system' === $mode ) { ?>
282 - <script>
283 - (function () {
284 - if (!(window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches)) {
285 - return;
286 - }
287 167
288 - // The bundle is fetched rather than blocking in the head, so paint
289 - // the page dark up front and drop the guard once Darkreader owns it.
290 - var guard = document.createElement('style');
291 - guard.textContent = 'html,body{background-color:#181a1b!important;color:#e8e6e3!important}';
292 - (document.head || document.documentElement).appendChild(guard);
293 -
294 - var dropGuard = function () {
295 - if (guard && guard.parentNode) {
296 - guard.parentNode.removeChild(guard);
297 - }
298 - };
299 -
300 - window.PXLBSADMINIFYDarkMode.load(window, function (dm) {
301 - if (dm) {
302 - dm.enable({ brightness: 120 });
303 - }
304 - dropGuard();
305 - });
306 -
307 - // Failsafe: never leave the guard behind if the fetch never lands.
308 - setTimeout(dropGuard, 5000);
309 -
310 - addEventListener("load", function () {
311 - window.PXLBSADMINIFYDarkMode.enable();
312 - });
313 - }());
314 - </script>
315 168 <?php }
316 169
317 170 }
318 171
@@ -317,365 +170,147 @@
317 170 }
318 171
319 172
320 173
321 - /**
322 - * Check if current page should skip Adminify scripts
323 - * Handles root, subdirectory, subdomain, and multisite installations
324 - *
325 - * @return bool True if scripts should be skipped
326 - */
327 - private function should_skip_adminify_scripts() {
328 - global $pagenow;
174 + // Google Fonts
175 + function jltwp_adminify_google_fonts_url()
176 + {
177 + $font_url = '';
178 + $font_family = !empty($this->options['admin_general_google_font']['font-family']) ? ($this->options['admin_general_google_font']['font-family']) : 'Nunito Sans:300,400,600,700,800';
329 179
330 - // Pages where Adminify scripts should not load
331 - $excluded_pages = [
332 - 'customize.php',
333 - 'wp-login.php',
334 - 'wp-register.php',
335 - ];
336 -
337 - // Check global $pagenow
338 - if ( in_array( $pagenow, $excluded_pages, true ) ) {
339 - return true;
180 + if ('off' !== _x('on', 'Google font: on or off', 'adminify')) {
181 + $font_url = add_query_arg('family', urlencode($font_family), '//fonts.googleapis.com/css');
340 182 }
341 183
342 - // Fallback: Check PHP_SELF for subdirectory WordPress installs
343 - // Normalize path by extracting just the filename
344 - $php_self = isset( $_SERVER['PHP_SELF'] ) ? sanitize_text_field( wp_unslash( $_SERVER['PHP_SELF'] ) ) : '';
345 - $current_file = basename( $php_self );
346 -
347 - if ( in_array( $current_file, $excluded_pages, true ) ) {
348 - return true;
349 - }
350 -
351 - // Additional check using REQUEST_URI for edge cases
352 - $request_uri = isset( $_SERVER['REQUEST_URI'] ) ? sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ) : '';
353 - foreach ( $excluded_pages as $page ) {
354 - if ( strpos( $request_uri, '/' . $page ) !== false ) {
355 - return true;
356 - }
357 - }
358 -
359 - return false;
184 + return $font_url;
360 185 }
361 186
362 187
363 - /**
364 - * Matches a Font Awesome class in any of the shapes Adminify stores:
365 - * "fa fa-gear", "fas fa-rocket", and the URL-encoded "fas%20fa-rocket" that
366 - * WordPress produces when an icon class is handed to add_menu_page().
367 - */
368 - const FONTAWESOME_CLASS_PATTERN = '/(?:^|[^a-z0-9-])fa[bsrl]?(?:\s|%20|-)fa-/i';
369 -
370 -
371 - /**
372 - * Whether Font Awesome has anything to paint on the current screen.
373 - *
374 - * The stylesheet plus its webfonts weigh well over a megabyte, so it is only
375 - * worth loading where Adminify actually renders an icon with it:
376 - *
377 - * - Adminify's own screens, whose section headers and field UI use hardcoded
378 - * `fas fa-*` classes.
379 - * - The dashboard, but only when a widget is actually configured with a Font
380 - * Awesome class.
381 - * - Any screen at all when an admin menu item carries a Font Awesome icon,
382 - * because the sidebar renders on every screen.
383 - *
384 - * Framework option, metabox, taxonomy, widget, customizer, nav-menu, profile
385 - * and comment screens are deliberately not listed: the framework scopes and
386 - * enqueues Font Awesome itself in ADMINIFY::add_admin_enqueue_scripts().
387 - *
388 - * @param \WP_Screen|null $screen Current screen.
389 - * @return bool
390 - */
391 - private function needs_fontawesome( $screen ) {
392 -
393 - if ( isset( $screen->id ) && false !== strpos( $screen->id, 'wp-adminify' ) ) {
394 - return true;
395 - }
396 -
397 - if ( isset( $screen->id ) && 'dashboard' === $screen->id && $this->has_fontawesome_dashboard_widget() ) {
398 - return true;
399 - }
400 -
401 - // Falls through on the dashboard too: the admin menu renders there as well.
402 - return $this->has_fontawesome_menu_icon();
403 - }
404 -
405 -
406 - /**
407 - * Whether any dashboard widget is configured with a Font Awesome class.
408 - *
409 - * Widget icons come from the framework icon field, whose list is still Font
410 - * Awesome (Libs/adminify-framework/functions/actions.php), and the editor and
411 - * script widget types can hold arbitrary markup — so scan the whole saved
412 - * option rather than just the icon keys, or a widget whose body contains
413 - * `<i class="fas fa-star">` would render a blank square.
414 - *
415 - * The option is the one read by DashboardWidgetModel::$prefix, which the
416 - * Dashboard Widget module already loads on every admin page, so this is an
417 - * options-cache hit rather than a query. Only ever called on the dashboard.
418 - *
419 - * @return bool
420 - */
421 - private function has_fontawesome_dashboard_widget() {
422 -
423 - $settings = get_option( 'pxlbsadminify_dasboard_widgets' );
424 -
425 - if ( empty( $settings ) ) {
426 - return false;
427 - }
428 -
429 - // Arrays and objects come back as a serialized string; scalars pass through.
430 - $settings = maybe_serialize( $settings );
431 -
432 - if ( ! is_string( $settings ) || '' === $settings ) {
433 - return false;
434 - }
435 -
436 - return (bool) preg_match( self::FONTAWESOME_CLASS_PATTERN, $settings );
437 - }
438 -
439 -
440 - /**
441 - * Look for a Font Awesome class stored as an admin menu icon.
442 - *
443 - * Pro admin pages pass the picked icon class straight to add_menu_page()
444 - * (Pro/Modules/AdminPages/AdminPages_Output.php), where WordPress treats it as
445 - * an image URL and prints `http://fas%20fa-rocket`; wp-adminify.js turns that
446 - * back into a class. Either shape counts as a hit.
447 - *
448 - * $menu is built during admin_menu, which runs before admin_enqueue_scripts,
449 - * so it is fully populated by the time this is called.
450 - *
451 - * @return bool
452 - */
453 - private function has_fontawesome_menu_icon() {
454 - global $menu;
455 -
456 - if ( empty( $menu ) || ! is_array( $menu ) ) {
457 - return false;
458 - }
459 -
460 - foreach ( $menu as $item ) {
461 -
462 - if ( empty( $item[6] ) || ! is_string( $item[6] ) ) {
463 - continue;
464 - }
465 -
466 - if ( preg_match( self::FONTAWESOME_CLASS_PATTERN, $item[6] ) ) {
467 - return true;
468 - }
469 - }
470 -
471 - return false;
472 - }
473 -
474 -
475 - public function pxlbsadminify_admin_scripts()
188 + public function jltwp_adminify_admin_scripts()
476 189 {
477 - // Skip loading scripts on excluded pages (customize.php, login, etc.)
478 - if ( $this->should_skip_adminify_scripts() ) {
479 - return;
480 - }
481 -
482 190 $screen = get_current_screen();
483 191
484 192
485 193 // Register Styles
486 - wp_register_style('adminify-admin', PXLBSADMINIFY_ASSETS . 'css/wp-adminify' . Utils::assets_ext('.css'), false, PXLBSADMINIFY_VER);
487 - wp_register_style('adminify-default-ui', PXLBSADMINIFY_ASSETS . 'css/wp-adminify-default-ui' . Utils::assets_ext('.css'), false, PXLBSADMINIFY_VER);
194 + wp_register_style('wp-adminify-admin', WP_ADMINIFY_ASSETS . 'css/wp-adminify' . Utils::assets_ext('.css'), false, WP_ADMINIFY_VER);
195 + wp_register_style('wp-adminify-default-ui', WP_ADMINIFY_ASSETS . 'css/wp-adminify-default-ui' . Utils::assets_ext('.css'), false, WP_ADMINIFY_VER);
196 + // wp_register_style('wp-adminify-admin-bar', WP_ADMINIFY_ASSETS . 'css/admin-bar' . Utils::assets_ext('.css'), false, WP_ADMINIFY_VER);
197 + wp_register_style('wp-adminify-menu-editor', WP_ADMINIFY_ASSETS . 'css/adminify-menu-editor' . Utils::assets_ext('.css'), false, WP_ADMINIFY_VER);
198 + // wp_register_style('wp-adminify-dark-mode', WP_ADMINIFY_ASSETS . 'css/dark-mode' . Utils::assets_ext('.css'), false, WP_ADMINIFY_VER);
199 + // wp_register_style('wp-adminify-rtl', WP_ADMINIFY_ASSETS . 'css/adminify-rtl' . Utils::assets_ext('.css'), false, WP_ADMINIFY_VER);
200 + // wp_register_style('wp-adminify-responsive', WP_ADMINIFY_ASSETS . 'css/adminify-responsive' . Utils::assets_ext('.css'), false, WP_ADMINIFY_VER);
201 + // wp_register_style('wp-adminify-animate', WP_ADMINIFY_ASSETS . 'vendors/animatecss/animate' . Utils::assets_ext('.css'), false, WP_ADMINIFY_VER);
202 + wp_register_style('wp-adminify-tokenize2', WP_ADMINIFY_ASSETS . 'vendors/tokenize/tokenize2' . Utils::assets_ext('.css'), false, WP_ADMINIFY_VER);
488 203
489 204
490 205 // Register Scripts
491 - wp_register_script('adminify-admin', PXLBSADMINIFY_ASSETS . 'admin/js/wp-adminify' . Utils::assets_ext('.js'), array('jquery'), PXLBSADMINIFY_VER, true);
206 + wp_register_script('wp-adminify-tokenize2', WP_ADMINIFY_ASSETS . 'vendors/tokenize/tokenize2.min.js', array('jquery'), WP_ADMINIFY_VER, false);
207 + wp_register_script('wp-adminify-admin', WP_ADMINIFY_ASSETS . 'admin/js/wp-adminify' . Utils::assets_ext('.js'), array('jquery'), WP_ADMINIFY_VER, true);
492 208
209 + // wp_register_script('wp-adminify-realtime-server', WP_ADMINIFY_ASSETS . 'js/adminify-realtime-server.js', array('jquery'), WP_ADMINIFY_VER, true);
210 +
493 211 // Adminify Icon Picker
494 - wp_register_style('adminify-simple-line-icons', PXLBSADMINIFY_ASSETS . 'vendors/font-icons/simple-line-icons/css/simple-line-icons' . Utils::assets_ext('.css'), false, PXLBSADMINIFY_VER);
495 - wp_register_style('adminify-icon-picker', PXLBSADMINIFY_ASSETS . 'vendors/adminify-icon-picker/css/style' . Utils::assets_ext('.css'), false, PXLBSADMINIFY_VER);
496 - wp_register_script('adminify-icon-picker', PXLBSADMINIFY_ASSETS . 'vendors/adminify-icon-picker/js/adminify-icon-picker' . Utils::assets_ext('.js'), array('jquery'), PXLBSADMINIFY_VER, true);
212 + wp_register_style('wp-adminify-simple-line-icons', WP_ADMINIFY_ASSETS . 'vendors/font-icons/simple-line-icons/css/simple-line-icons' . Utils::assets_ext('.css'), false, WP_ADMINIFY_VER);
213 + wp_register_style('wp-adminify-icon-picker', WP_ADMINIFY_ASSETS . 'vendors/adminify-icon-picker/css/style' . Utils::assets_ext('.css'), false, WP_ADMINIFY_VER);
214 + wp_register_script('wp-adminify-icon-picker', WP_ADMINIFY_ASSETS . 'vendors/adminify-icon-picker/js/adminify-icon-picker' . Utils::assets_ext('.js'), array('jquery'), WP_ADMINIFY_VER, true);
497 215
498 216 // Dark Mode
499 - wp_register_script('adminify--dark-mode', $this->dark_mode_url(), array(), PXLBSADMINIFY_VER, false);
217 + wp_register_script('wp-adminify--dark-mode', WP_ADMINIFY_ASSETS . 'admin/js/wp-adminify-dark-mode' . Utils::assets_ext('.js'), array(), WP_ADMINIFY_VER, false);
500 218
219 + // Menu Editor
220 + wp_register_script('wp-adminify-menu-editor', WP_ADMINIFY_ASSETS . 'admin/js/wp-adminify-menu-editor' . Utils::assets_ext('.js'), array('jquery', 'jquery-ui-sortable', 'wp-adminify-icon-picker'), WP_ADMINIFY_VER, true);
221 +
501 222 // Styles Enqueue
223 + if ( !empty($this->options['admin_general_google_font']['font-family'])) {
224 + wp_enqueue_style('wp-adminify-google-fonts', $this->jltwp_adminify_google_fonts_url());
225 + }
226 +
502 227 if (!empty($this->options['admin_ui'])) {
503 228 // wp_enqueue_style('wp-adminify-animate');
504 - wp_enqueue_style('adminify-admin');
229 + wp_enqueue_style('wp-adminify-admin');
505 230 // Commented on: 9-6-24
506 231 // wp_enqueue_style('wp-adminify-admin-bar');
232 + // wp_enqueue_style('wp-adminify-responsive');
507 233 } else {
508 - wp_enqueue_style('adminify-default-ui');
234 + wp_enqueue_style('wp-adminify-default-ui');
509 235 }
510 236
511 237
512 238 // RTL CSS
513 239 if ( is_rtl() ) {
514 - wp_enqueue_style( 'adminify-rtl', PXLBSADMINIFY_URL . 'Libs/adminify-framework/assets/css/style-rtl'. Utils::assets_ext('.css'), array(), PXLBSADMINIFY_VER, 'all' );
240 + wp_enqueue_style( 'adminify-rtl', WP_ADMINIFY_URL . 'Libs/adminify-framework/assets/css/style-rtl'. Utils::assets_ext('.css'), array(), WP_ADMINIFY_VER, 'all' );
515 241 }
516 242
517 243
518 244 // Dark Mode Style
519 - // wp_enqueue_style('adminify-dark-mode');
245 + // wp_enqueue_style('wp-adminify-dark-mode');
246 + wp_enqueue_script('wp-adminify--dark-mode');
520 247
521 - // Only a user who is actually in dark mode gets the ~110 KB bundle up front.
522 - // 'system' is resolved in the browser and 'light' never needs it at all; both
523 - // go through the loader printed by header_scripts().
524 - if ('dark' === $this->color_mode()) {
525 - wp_enqueue_script('adminify--dark-mode');
526 - }
527 248
528 -
529 - // Get local fonts data for frontend - download if not exists
530 - $local_fonts = GoogleFontsLocal::get_instance();
531 - $local_fonts_urls = [];
532 -
533 - // Process light mode logo font
534 - if (!empty($this->options['light_dark_mode']['admin_ui_light_mode']['admin_ui_light_logo_text_typo']['font-family'])) {
535 - $font_family = $this->options['light_dark_mode']['admin_ui_light_mode']['admin_ui_light_logo_text_typo']['font-family'];
536 - $font_weight = !empty($this->options['light_dark_mode']['admin_ui_light_mode']['admin_ui_light_logo_text_typo']['font-weight']) ? $this->options['light_dark_mode']['admin_ui_light_mode']['admin_ui_light_logo_text_typo']['font-weight'] : '400';
537 -
538 - if (!$local_fonts->is_font_local($font_family)) {
539 - $local_fonts->download_font($font_family, $font_weight);
540 - }
541 -
542 - $local_url = $local_fonts->get_local_font_url($font_family);
543 - if ($local_url) {
544 - $local_fonts_urls['light_logo'] = $local_url;
545 - }
546 - }
547 -
548 - // Process dark mode logo font
549 - if (!empty($this->options['light_dark_mode']['admin_ui_dark_mode']['admin_ui_dark_logo_text_typo']['font-family'])) {
550 - $font_family = $this->options['light_dark_mode']['admin_ui_dark_mode']['admin_ui_dark_logo_text_typo']['font-family'];
551 - $font_weight = !empty($this->options['light_dark_mode']['admin_ui_dark_mode']['admin_ui_dark_logo_text_typo']['font-weight']) ? $this->options['light_dark_mode']['admin_ui_dark_mode']['admin_ui_dark_logo_text_typo']['font-weight'] : '400';
552 -
553 - if (!$local_fonts->is_font_local($font_family)) {
554 - $local_fonts->download_font($font_family, $font_weight);
555 - }
556 -
557 - $local_url = $local_fonts->get_local_font_url($font_family);
558 - if ($local_url) {
559 - $local_fonts_urls['dark_logo'] = $local_url;
560 - }
561 - }
562 -
563 - $local_fonts_data = [
564 - 'base_url' => $local_fonts->get_folder_url(),
565 - 'urls' => $local_fonts_urls,
566 - ];
567 -
568 249 $localize_array_data = [
569 250 'admin_ajax' => admin_url('admin-ajax.php'),
570 251 'settings' => [
571 - 'adminify_ui' => !empty($this->options['admin_ui']) ? true : false,
252 + 'adminify_ui' => !empty($this->options['admin_ui']) ? true : false
572 253 ],
573 - 'admin_nonce' => wp_create_nonce('pxlbsadminify_frame_nonce'),
574 - 'is_pro' => (class_exists('\\PXLBSAdminify\\Pro\\Adminify_Pro') && !empty(\PXLBSAdminify\Pro\Adminify_Pro::is_premium())) ? true : false,
575 - 'local_fonts' => $local_fonts_data
254 + 'admin_nonce' => wp_create_nonce('adminify_nonce'),
255 + 'is_pro' => (class_exists('\\WPAdminify\\Pro\\Adminify_Pro') && !empty(\WPAdminify\Pro\Adminify_Pro::is_premium())) ? true : false
576 256 ];
577 257
578 - // Pro-only settings flags (e.g. menu_search) attach via this
579 - // filter from Pro/Classes/Assets_Pro.php. Free leaves the
580 - // localize array untouched.
581 - $localize_array_data = (array) apply_filters( 'pxlbsadminify_admin_localize_data', $localize_array_data, $this->options );
582 -
583 258 // Scripts Enqueue
584 - wp_enqueue_script('adminify-admin');
585 - wp_localize_script( 'adminify-admin', 'PXLBSADMINIFY_ADMIN', $localize_array_data );
259 + wp_enqueue_script('wp-adminify-admin');
260 + wp_localize_script( 'wp-adminify-admin', 'WP_ADMINIFY_ADMIN', $localize_array_data );
586 261
587 - // Font Awesome, only on screens that actually paint an icon with it. The
588 - // old guard called wp_script_is() on what are styles, so it always passed
589 - // and every admin page paid for the font. wp_enqueue_style() is a no-op on
590 - // an already-enqueued handle, so no guard is needed against the framework
591 - // having enqueued these first.
592 - if ($this->needs_fontawesome($screen)) {
262 + if (!wp_script_is('adminify-fa', 'enqueued') || !wp_script_is('adminify-fa5', 'enqueued')) {
593 263 if (apply_filters('adminify_fa4', false)) {
594 - wp_enqueue_style('adminify-fa', PXLBSADMINIFY_ASSETS . 'vendors/fontawesome/fa4/css/font-awesome.min.css', array(), '4.7.0', 'all');
264 + wp_enqueue_style('adminify-fa', 'https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome' . Utils::assets_ext('.css'), array(), '4.7.0', 'all');
595 265 } else {
596 - wp_enqueue_style('adminify-fa5', PXLBSADMINIFY_ASSETS . 'vendors/fontawesome/fa5/css/all.min.css', array(), '5.15.4', 'all');
597 - wp_enqueue_style('adminify-fa5-v4-shims', PXLBSADMINIFY_ASSETS . 'vendors/fontawesome/fa5/css/v4-shims.min.css', array(), '5.15.4', 'all');
266 + wp_enqueue_style('adminify-fa5', 'https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.15.4/css/all' . Utils::assets_ext('.css'), array(), '5.15.5', 'all');
267 + wp_enqueue_style('adminify-fa5-v4-shims', 'https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.15.4/css/v4-shims' . Utils::assets_ext('.css'), array(), '5.15.5', 'all');
598 268 }
599 269 }
600 - wp_enqueue_style('adminify-simple-line-icons');
270 + wp_enqueue_style('wp-adminify-simple-line-icons');
601 271
602 - // Adminify UI HTTPS gate — only on the main settings screen where the switcher lives.
603 - if (isset($screen->id) && false !== strpos($screen->id, 'wp-adminify-settings')) {
604 - wp_enqueue_script('adminify-ui-ssl-check', PXLBSADMINIFY_ASSETS . 'admin/js/adminify-ui-ssl-check.js', array('jquery'), PXLBSADMINIFY_VER, true);
605 - wp_localize_script(
606 - 'adminify-ui-ssl-check',
607 - 'PXLBSADMINIFY_SSL',
608 - array(
609 - 'ajax_url' => admin_url('admin-ajax.php'),
610 - 'nonce' => wp_create_nonce('pxlbsadminify_frame_nonce'),
611 - 'field_id' => 'admin_ui',
612 - 'i18n' => array(
613 - 'label' => esc_html__('Adminify UI needs HTTPS:', 'adminify'),
614 - 'generic_error' => esc_html__('Could not verify HTTPS right now. Please try again.', 'adminify'),
615 - ),
616 - )
617 - );
272 + // Load Scripts/Styles only WP Adminify Admin Page
273 + if ($screen->id === 'toplevel_page_wp-adminify-settings') {
274 + // Admin Notice Dismiss
275 + // $this->jltwp_adminify_admin_script();
618 276
619 - // Adminify UI live theme preset changer
620 - wp_enqueue_script('adminify-theme-presetter', PXLBSADMINIFY_ASSETS . 'admin/js/wp-adminify-theme-presetter' . Utils::assets_ext('.js'), ['jquery'], PXLBSADMINIFY_VER, true);
621 - wp_localize_script('adminify-theme-presetter', 'PXLBSADMINIFY_PRESET_THEMES', Utils::get_theme_presets());
277 + global $menu, $submenu;
278 + $set_menu = new \WPAdminify\Inc\Modules\MenuEditor\MenuEditor();
279 + $main_menus = $set_menu->sort_menu_settings($menu);
280 + $sub_menus = $set_menu->sort_sub_menu_settings( $main_menus, $submenu );
281 +
282 + // Menu Editor
283 + wp_enqueue_script('wp-adminify-menu-editor-script');
284 + wp_localize_script(
285 + 'wp-adminify-menu-editor-script',
286 + 'WPAdminifyIconPicker',
287 + [
288 + 'main_menu' => $main_menus,
289 + 'sub_menu' => $sub_menus,
290 + // 'is_elementor_active' => Utils::is_plugin_active('elementor/elementor.php'),
291 + ]
292 + );
293 +
622 294 }
623 295
624 - if ($screen->id === 'adminify_page_wp-adminify-addons-plugins' || $screen->id === 'adminify-pro_page_wp-adminify-addons-plugins') {
296 + if ($screen->id === 'wp-adminify_page_wp-adminify-addons-plugins' || $screen->id === 'wp-adminify-pro_page_wp-adminify-addons-plugins') {
625 297 // JS Files .
626 - wp_enqueue_script('adminify-addons', PXLBSADMINIFY_ASSETS . 'admin/js/wp-adminify-addons' . Utils::assets_ext('.js'), array('jquery'), PXLBSADMINIFY_VER, true);
298 + wp_enqueue_script('wp-adminify-addons', WP_ADMINIFY_ASSETS . 'admin/js/wp-adminify-addons' . Utils::assets_ext('.js'), array('jquery'), WP_ADMINIFY_VER, true);
627 299 wp_localize_script(
628 - 'adminify-addons',
629 - 'PXLBSADMINIFY_CORE',
300 + 'wp-adminify-addons',
301 + 'WP_ADMINIFYCORE',
630 302 array(
631 303 'admin_ajax' => admin_url('admin-ajax.php'),
632 - 'addons_nonce' => wp_create_nonce('pxlbsadminify_addons_nonce'),
633 - 'plugin_key' => 'pxlbsadminify'
304 + 'addons_nonce' => wp_create_nonce('jltwp_adminify_addons_nonce'),
305 + 'plugin_key' => 'jltwp_adminify'
634 306 )
635 307 );
636 308 }
637 309 }
638 310
639 - /**
640 - * AJAX: verify the site is HTTPS-ready before enabling the Adminify UI.
641 - *
642 - * Called from assets/admin/js/adminify-ui-ssl-check.js when the user flips
643 - * the "Adminify UI" switcher on. Returns success only when the dashboard
644 - * frame would actually load (see Utils::adminify_ui_https_status()).
645 - */
646 - public function pxlbsadminify_ssl_check()
647 - {
648 - $nonce = isset($_POST['nonce']) ? sanitize_text_field(wp_unslash($_POST['nonce'])) : '';
649 -
650 - if (!wp_verify_nonce($nonce, 'pxlbsadminify_frame_nonce')) {
651 - wp_send_json_error(array(
652 - 'https_ready' => false,
653 - 'message' => esc_html__('Security check failed. Please reload the page and try again.', 'adminify'),
654 - ));
655 - }
656 -
657 - if (!current_user_can('manage_options')) {
658 - wp_send_json_error(array(
659 - 'https_ready' => false,
660 - 'message' => esc_html__('You do not have permission to change this setting.', 'adminify'),
661 - ));
662 - }
663 -
664 - $status = Utils::adminify_ui_https_status();
665 -
666 - if (!empty($status['ready'])) {
667 - wp_send_json_success(array('https_ready' => true));
668 - }
669 -
670 - wp_send_json_error(array(
671 - 'https_ready' => false,
672 - 'message' => $status['message'],
673 - ));
674 - }
675 -
676 311 // WP Adminify Options Page Style
677 - public function pxlbsadminify_admin_script()
312 + public function jltwp_adminify_admin_script()
678 313 {
679 314 echo '<style>.wp-adminify-two-columns{ display: flex; flex-wrap: wrap; padding: 15px; } .wp-adminify .adminify-hightlight-field{ border: 2px solid #0347FF !important; font-weight: 600 !important;} .wp-adminify-two-columns .adminify-full-width-field{ width: 100% !important; flex-basis: 100% !important; } .wp-adminify-two-columns > .adminify-field{ width: 49%; flex-basis: 49%; margin-right: 1%; margin-top: -1px; border: 1px solid #eee; box-sizing: border-box; } .wp-adminify-two-columns.aminify-title-width-40 .adminify-title, .aminify-title-width-40 .adminify-title{ width: 40% !important;} .wp-adminify-two-columns.aminify-title-width-40 .adminify-fieldset, .aminify-title-width-40 .adminify-fieldset{ width: calc(60% - 20px) !important;} .wp-adminify-two-columns.aminify-title-width-65 .adminify-title{ width: 65%;} .wp-adminify-two-columns.aminify-title-width-65 .adminify-fieldset{ width: calc(35% - 20px);} .wp-adminify-two-columns .adminify-field-subheading{height:25px;box-sizing: content-box; width: 100%; flex-basis: 100%;} .wp-adminify-white-label-notice-content { background-color: #fff; box-shadow: 0px 0px 50px rgb(0 0 0 / 13%); position: absolute; top: 150px; left: 400px; width: 530px; padding: 32px; padding-bottom: 50px; -webkit-border-radius: 20px; border-radius: 20px; text-align: center; z-index: 2; } .wp-adminify-white-label-notice-logo img { height: 100px; width: 250px; padding: 10px; padding-top: 10px; } .wp-adminify-white-label-notice-content h2 span{ color: #6814cd; text-transform: uppercase; } .wp-adminify-white-label-notice-content em{ font-size: 13px; color: red; } .wp-adminify-white-label-notice .wp-adminify-get-pro{ background-image: -moz-linear-gradient( 0deg, rgb(223,29,198) 0%, rgb(106,20,209) 100%); background-image: -webkit-linear-gradient( 0deg , rgb(223,29,198) 0%, rgb(106,20,209) 100%); background-image: -ms-linear-gradient( 0deg, rgb(223,29,198) 0%, rgb(106,20,209) 100%); border: none; box-shadow: none; color: #fff; cursor: pointer; font-weight: 700; line-height: 35px; padding: 0 15px; text-transform: uppercase; text-decoration: none; display: inline-block; width: 180px; padding: 5px 15px !important; border-radius: 10px; font-size: 15px; font-weight: 800; -webkit-transition: all 0.2s ease-in-out; transition: all 0.2s ease-in-out; } .wp-adminify-white-label-notice{ position: absolute !important; top: 0; left: 0; width: 100% !important; height: 100%; background: rgba(200, 200, 200, 0.5); -js-display: flex; display: -webkit-box; display: -webkit-flex; display: -moz-box; display: -ms-flexbox; display: flex; -webkit-box-pack: center; -webkit-justify-content: center; -moz-box-pack: center; -ms-flex-pack: center; justify-content: center;z-index: 1; } .wp-adminify-white-label-notice .wp-adminify-get-pro:hover { color:#fff; background-image: -moz-linear-gradient(0deg, rgb(106, 20, 209) 0%, rgb(223, 29, 198) 100%); background-image: -webkit-linear-gradient( 0deg, rgb(106, 20, 209) 0%, rgb(223, 29, 198) 100%); background-image: -ms-linear-gradient(0deg, rgb(106, 20, 209) 0%, rgb(223, 29, 198) 100%);} .adminify-field-callback a.wp-adminify-rollback-button{font-family:inherit !important;} .wp-adminify-rollback-button.dashicons, .wp-adminify-rollback-button.dashicons-before:before{ width: inherit !important;}</style>';
680 315 }
681 316