PluginProbe
Adminify – White Label, Admin Menu Editor, Login Customizer / 4.3.2
Adminify – White Label, Admin Menu Editor, Login Customizer v4.3.2
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/AdminBar.php +54 -1 4.3.04.3.2 View file →
@@ -59,8 +59,12 @@
59 59 if (is_admin()) {
60 60 // Light/Dark Mode switcher add
61 61 if (!empty($this->options['admin_bar_dark_light_btn'])) {
62 62 add_action('admin_bar_menu', [$this, 'dark_mode_switcher_icon']);
63 + // customize.php never fires `admin_enqueue_scripts` - it does not
64 + // load admin-header.php - so the switcher's assets have to come in
65 + // on the Customizer's own hook. See enqueue_standalone_switcher().
66 + add_action('customize_controls_enqueue_scripts', [$this, 'enqueue_standalone_switcher']);
63 67 }
64 68 // Add Frontend Site Preview Icon for UI.
65 69 // Priority 10000: nodes render in the order they are added, and core fills
66 70 // top-secondary late - my-account at 9991, recovery mode at 9992, search at
@@ -109,9 +113,16 @@
109 113 {
110 114 $global_color_mode = !empty($this->options['light_dark_mode']['admin_ui_mode']) ? $this->options['light_dark_mode']['admin_ui_mode'] : 'light';
111 115 $color_mode = empty(get_user_meta(get_current_user_id(), 'color_mode', true))? $global_color_mode : get_user_meta(get_current_user_id(), 'color_mode', true);
112 116
113 - $color_var = !empty($this->adminify_ui) ? 'var(--adminify-menu-text-color)' : '#fff';
117 + // currentColor, so the glyphs take the colour of whatever bar they land in:
118 + // #f0f0f1 from core's `#wpadminbar .ab-empty-item` in the stock admin bar,
119 + // and the surrounding text colour inside the dropdown or anywhere Adminify
120 + // styles the bar itself. --adminify-menu-text-color was the SIDEBAR's
121 + // colour - near-black in light mode, so the icon all but vanished against
122 + // the dark admin bar - and it is not even defined on screens where
123 + // OutputCSS does not run, customize.php among them.
124 + $color_var = 'currentColor';
114 125
115 126 $adminbar_switcher_icon = '<div id="wp-adminify-color-mode-wrapper">
116 127 <div class="mode-icon adminify-color-mode-' . esc_attr($color_mode) . '-active">
117 128 <svg viewBox="0 0 24 24" width="24" height="24" class="darkIcon" ><path fill="' . $color_var . '" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg>
@@ -296,8 +307,12 @@
296 307 public function admin_scripts()
297 308 {
298 309 global $pagenow;
299 310 if ($pagenow == 'wp-login.php' || $pagenow == 'wp-register.php' || $pagenow == 'customize.php') {
311 + // Adminify's main bundle is skipped on these screens by design, but
312 + // WordPress 7.1 prints the admin bar on customize.php - switcher node
313 + // and all. Hand it the standalone assets so it is not left inert.
314 + $this->enqueue_standalone_switcher();
300 315 return;
301 316 }
302 317
303 318 // Commented on: 9-6-24
@@ -305,8 +320,46 @@
305 320 wp_enqueue_style('wp-adminify-admin-bar');
306 321 $this->admin_topbar_loader_css();
307 322 }
308 323 wp_localize_script('adminify-admin', 'PXLBSADMINIFY_ADMINBAR', $this->create_admin_bar_js_object());
324 + }
325 +
326 + /**
327 + * Self-contained Light/Dark/System switcher for screens the main bundle skips.
328 + *
329 + * `wp-adminify.css` scopes the switcher rules under `.adminify-ui` and
330 + * `wp-adminify.js` carries the behaviour, and neither loads on customize.php
331 + * (Assets::should_skip_adminify_scripts). WordPress 7.1 renders the admin bar
332 + * there, so without this the node paints as bare unstyled SVGs and clicking it
333 + * does nothing. Same approach DarkModeConflicts already takes for dark mode.
334 + *
335 + * Safe to call more than once: wp_enqueue_*() is a no-op on a handle that is
336 + * already queued.
337 + *
338 + * @return void
339 + */
340 + public function enqueue_standalone_switcher()
341 + {
342 + if (empty($this->options['admin_bar_dark_light_btn'])) {
343 + return;
344 + }
345 +
346 + wp_enqueue_style(
347 + 'adminify-admin-bar-switcher',
348 + PXLBSADMINIFY_ASSETS . 'css/wp-adminify-admin-bar-switcher' . Utils::assets_ext('.css'),
349 + array(),
350 + PXLBSADMINIFY_VER
351 + );
352 +
353 + wp_enqueue_script(
354 + 'adminify-admin-bar-switcher',
355 + PXLBSADMINIFY_ASSETS . 'admin/js/wp-adminify-admin-bar-switcher' . Utils::assets_ext('.js'),
356 + array(),
357 + PXLBSADMINIFY_VER,
358 + true
359 + );
360 +
361 + wp_localize_script('adminify-admin-bar-switcher', 'PXLBSADMINIFY_ADMINBAR', $this->create_admin_bar_js_object());
309 362 }
310 363
311 364
312 365 public function create_admin_bar_js_object()