PluginProbe
Adminify – White Label, Admin Menu Editor, Login Customizer / 2.0.9
Adminify – White Label, Admin Menu Editor, Login Customizer v2.0.9
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 +1189 -1002 4.3.12.0.9 View file →
@@ -1,250 +1,84 @@
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\Classes\DarkModeConflicts;
8 -use PXLBSAdminify\Inc\Admin\AdminSettingsModel;
9 -
5 +use WPAdminify\Inc\Utils ;
6 +use WPAdminify\Inc\Admin\AdminSettings ;
7 +use WPAdminify\Inc\Admin\AdminSettingsModel ;
10 8 // no direct access allowed
11 -if (!defined('ABSPATH')) {
12 - exit;
9 +if ( !defined( 'ABSPATH' ) ) {
10 + exit;
13 11 }
14 12 class AdminBar extends AdminSettingsModel
15 13 {
16 -
17 - public $options;
18 - public $post_types;
19 - public $adminify_ui;
20 -
21 - public function __construct()
22 - {
23 - $this->options = (array) AdminSettings::get_instance()->get();
24 - $this->adminify_ui = $this->options['admin_ui'];
25 - $global_ui_mode = empty($this->options['light_dark_mode']['admin_ui_mode']) ? 'light' : $this->options['light_dark_mode']['admin_ui_mode'];
26 - $current_ui_mode = empty(get_user_meta(get_current_user_id(), 'color_mode', true)) ? $global_ui_mode : get_user_meta(get_current_user_id(), 'color_mode', true);
27 -
28 - if ( $current_ui_mode === 'dark' || $current_ui_mode === 'system' ) {
29 - new DarkModeConflicts();
30 - }
31 -
32 - // $admin_bar_user_roles = !empty($this->options['admin_bar_user_roles']) ? $this->options['admin_bar_user_roles'] : '';
33 - // if (Utils::restricted_for($admin_bar_user_roles)) {
34 - // return;
35 - // }
36 -
37 - // Disable the default admin bar
38 - // add_filter('show_admin_bar', '__return_false');
39 -
40 - // Add admin-bar support if not already activated
41 - // add_theme_support('admin-bar', ['callback' => '__return_false']);
42 -
43 -
44 -
45 - // 05-06-2024
46 - // Check Adminify Setup Wizard Page
47 - // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- read-only check, no state change.
48 - if (!empty($_GET['page']) && 'wp-adminify-setup-wizard' == sanitize_key(wp_unslash($_GET['page']))) {
49 - return;
50 - }
51 -
52 - $this->initialize();
53 -
54 - // if (!empty($this->adminify_ui) && !empty($this->options['admin_bar_search'] )) {
55 - // add_action('wp_admin_bar_class', [$this, 'load_wp_admin_bar_class']);
56 - // add_action('pxlbsadminify/before/secondary_menu', [$this, 'before_secondary_menu']);
57 - // }
58 -
59 - if (is_admin()) {
60 - // Light/Dark Mode switcher add
61 - if (!empty($this->options['admin_bar_dark_light_btn'])) {
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']);
67 - }
68 - // Add Frontend Site Preview Icon for UI.
69 - // Priority 10000: nodes render in the order they are added, and core fills
70 - // top-secondary late - my-account at 9991, recovery mode at 9992, search at
71 - // 9999 - so anything lower than this lands before them instead of last.
72 - if (!empty($this->adminify_ui)) {
73 - add_action('admin_bar_menu', [$this, 'preview_icon'], 10000);
74 - }
75 - }
76 - }
77 -
78 - public function preview_icon($wp_admin_bar) {
79 - $args = [
80 - 'parent' => 'top-secondary',
81 - 'id' => 'adminify-frontend-site-preview',
82 - // Icon only. ab-icon is what WordPress uses to size and align admin bar
83 - // glyphs; the label stays for screen readers.
84 - 'title' => '<span class="ab-icon dashicons dashicons-visibility" aria-hidden="true"></span><span class="screen-reader-text">' . esc_html__('Preview', 'adminify') . '</span>',
85 - 'href' => home_url('/'),
86 - 'meta' => [
87 - // Opens the site in a new tab so the admin screen stays put.
88 - // noopener keeps the new tab from reaching back via window.opener.
89 - 'target' => '_blank',
90 - 'rel' => 'noopener',
91 - 'title' => esc_attr__('Preview site in a new tab', 'adminify'),
92 - ],
93 - ];
94 -
95 - $wp_admin_bar->add_node($args);
96 - }
97 -
98 -
99 - // Add Switcher Icon on Admin Bar Secondary
100 - public function dark_mode_switcher_icon($wp_admin_bar)
101 - {
102 - $args = [
103 - 'parent' => 'top-secondary',
104 - 'id' => 'wp-adminify-admin-bar-switcher',
105 - 'title' => $this->dark_mode_switcher_dom(),
106 - 'meta' => false
107 - ];
108 -
109 - $wp_admin_bar->add_node($args);
110 - }
111 -
112 - public function dark_mode_switcher_dom()
113 - {
114 - $global_color_mode = !empty($this->options['light_dark_mode']['admin_ui_mode']) ? $this->options['light_dark_mode']['admin_ui_mode'] : 'light';
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);
116 -
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';
125 -
126 - $adminbar_switcher_icon = '<div id="wp-adminify-color-mode-wrapper">
127 - <div class="mode-icon adminify-color-mode-' . esc_attr($color_mode) . '-active">
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>
129 - <svg viewBox="0 0 24 24" width="24" height="24" class="lightIcon"><path fill="' . $color_var . '" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg>
130 - <svg width="16" height="16" viewBox="0 0 22 18" fill="none" xmlns="http://www.w3.org/2000/svg" class="systemIcon">
131 - <path d="M20 13V4.2C20 3.0799 20 2.51984 19.782 2.09202C19.5903 1.71569 19.2843 1.40973 18.908 1.21799C18.4802 1 17.9201 1 16.8 1H5.2C4.07989 1 3.51984 1 3.09202 1.21799C2.71569 1.40973 2.40973 1.71569 2.21799 2.09202C2 2.51984 2 3.0799 2 4.2V13M3.66667 17H18.3333C18.9533 17 19.2633 17 19.5176 16.9319C20.2078 16.7469 20.7469 16.2078 20.9319 15.5176C21 15.2633 21 14.9533 21 14.3333C21 14.0233 21 13.8683 20.9659 13.7412C20.8735 13.3961 20.6039 13.1265 20.2588 13.0341C20.1317 13 19.9767 13 19.6667 13H2.33333C2.02334 13 1.86835 13 1.74118 13.0341C1.39609 13.1265 1.12654 13.3961 1.03407 13.7412C1 13.8683 1 14.0233 1 14.3333C1 14.9533 1 15.2633 1.06815 15.5176C1.25308 16.2078 1.79218 16.7469 2.48236 16.9319C2.73669 17 3.04669 17 3.66667 17Z" stroke="' . $color_var . '" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
132 - </svg>
133 - </div>
134 - <div class="light-dark-dropdown">
135 - <div class="light">
136 - <svg viewBox="0 0 24 24" width="24" height="24" class="lightIcon"><path fill="' . $color_var . '" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg>
137 - <span>Light</span>
138 - </div>
139 - <div class="dark">
140 - <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>
141 - <span>Dark</span>
142 - </div>
143 - <div class="system">
144 - <svg width="16" height="16" viewBox="0 0 22 18" fill="none" xmlns="http://www.w3.org/2000/svg" class="systemIcon">
145 - <path d="M20 13V4.2C20 3.0799 20 2.51984 19.782 2.09202C19.5903 1.71569 19.2843 1.40973 18.908 1.21799C18.4802 1 17.9201 1 16.8 1H5.2C4.07989 1 3.51984 1 3.09202 1.21799C2.71569 1.40973 2.40973 1.71569 2.21799 2.09202C2 2.51984 2 3.0799 2 4.2V13M3.66667 17H18.3333C18.9533 17 19.2633 17 19.5176 16.9319C20.2078 16.7469 20.7469 16.2078 20.9319 15.5176C21 15.2633 21 14.9533 21 14.3333C21 14.0233 21 13.8683 20.9659 13.7412C20.8735 13.3961 20.6039 13.1265 20.2588 13.0341C20.1317 13 19.9767 13 19.6667 13H2.33333C2.02334 13 1.86835 13 1.74118 13.0341C1.39609 13.1265 1.12654 13.3961 1.03407 13.7412C1 13.8683 1 14.0233 1 14.3333C1 14.9533 1 15.2633 1.06815 15.5176C1.25308 16.2078 1.79218 16.7469 2.48236 16.9319C2.73669 17 3.04669 17 3.66667 17Z" stroke="' . $color_var . '" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
146 - </svg>
147 - <span>System</span>
148 - </div>
149 - </div>
150 - </div>';
151 -
152 - return $adminbar_switcher_icon;
153 - }
154 -
155 -
156 -
157 - public function initialize()
158 - {
159 - $admin_bar_position = (!empty($this->options['admin_bar_position'])) ? $this->options['admin_bar_position'] : 'top';
160 -
161 - if (is_admin()) {
162 - if ($admin_bar_position == 'top' || $admin_bar_position == 'bottom') {
163 - if (!empty($this->adminify_ui)) {
164 - //TODO: not need to adminify ui. alternative use iframe topbar
165 - // add_action('admin_init', [$this, 'add_admin_bar']);
166 - // } else {
167 - add_action('admin_head', [$this, 'legacy_admin_bar_positon']);
168 - }
169 - }
170 - add_action('admin_enqueue_scripts', [$this, 'admin_scripts'], 100);
171 -
172 - // Remove Unnecessary Menus from Admin bar
173 - // add_action('wp_before_admin_bar_render', [$this, 'remove_admin_bar_menus'], 0);
174 -
175 - // add_filter('admin_body_class', [$this, 'admin_bar_body_class']);
176 - // add_action('admin_head', [$this, 'admin_bar_css'], 999);
177 -
178 - add_action('wp_ajax_pxlbsadminify_all_search', [$this, 'all_search']);
179 - add_action('wp_ajax_pxlbsadminify_color_mode', [$this, 'color_mode']);
180 -
181 -
182 - // Screen Option and Help Tab
183 - add_action('admin_head', [$this, 'remove_screen_options'], 10, 3);
184 - add_action('admin_head', [$this, 'remove_help_tab']);
185 - } else {
186 - // Admin bar Frontend settings
187 - $frontend_admin = (!empty($this->options['admin_bar_hide_frontend'])) ? $this->options['admin_bar_hide_frontend'] : 'show';
188 -
189 - // if (jltwp_adminify()->can_use_premium_code__premium_only()) {
190 - // if ($frontend_admin == 'show') {
191 - // $frontend_admin_roles = (!empty($this->options['admin_bar_hide_frontend_user_roles'])) ? $this->options['admin_bar_hide_frontend_user_roles'] : [];
192 - // if (Utils::restricted_for($frontend_admin_roles)) {
193 - // $frontend_admin = 'hide';
194 - // }
195 - // }
196 - // }
197 - $this->front_bar();
198 -
199 - if ($admin_bar_position == 'bottom') {
200 - add_action('init', [$this, 'admin_bar_front_style_init']);
201 - }
202 -
203 - if ($frontend_admin == 'hide') {
204 - add_filter('show_admin_bar', '__return_false');
205 - }
206 - }
207 - }
208 -
209 - public function before_secondary_menu()
210 - {
211 -?>
212 - <div class="wp-adminify-top-header--search--form">
213 - <form class="top-header--search--form" action="$">
214 - <span class="adminify-search-expand"><i class="icon-magnifier icons"></i></span>
215 - <input id="top-header-search-input" class="top-header-search-input" type="search" placeholder="Search here">
216 - </form>
217 -
218 - <div id="top-header-search-results" class=" top-header-search-results" style="display: none;">
219 - <div class="top-header-results-wrapper">
220 - </div>
221 - </div>
222 - </div>
223 - <?php
224 - }
225 -
226 - public function load_wp_admin_bar_class()
227 - {
228 - return 'PXLBSAdminify\Inc\Classes\Adminify_Admin_Bar';
229 - }
230 -
231 - public function front_bar()
232 - {
233 - add_action('admin_init', [$this, 'add_admin_bar']);
234 - add_filter('body_class', [$this, 'admin_bar_body_class']);
235 - }
236 -
237 - public function admin_bar_front_style_init()
238 - {
239 - add_filter('wp_enqueue_scripts', [$this, 'admin_bar_front_style']);
240 - }
241 -
242 - // Frontend Admin bar style
243 - public function admin_bar_front_style()
244 - {
245 - $admin_bar_css = '';
246 - $admin_bar_css .= '.admin-bar-position-bottom #wpadminbar{
14 + public $post_types ;
15 + public function __construct()
16 + {
17 + $this->options = (array) AdminSettings::get_instance()->get( 'admin_bar_settings' );
18 + $admin_bar_user_roles = ( !empty($this->options['admin_bar_user_roles']) ? $this->options['admin_bar_user_roles'] : '' );
19 + // if (Utils::restricted_for($admin_bar_user_roles)) {
20 + // return;
21 + // }
22 + $admin_bar_position = ( !empty($this->options['admin_bar_position']) ? $this->options['admin_bar_position'] : 'top' );
23 + // Disable the default admin bar
24 + // add_filter('show_admin_bar', '__return_false');
25 + // Add admin-bar support if not already activated
26 + add_theme_support( 'admin-bar', array(
27 + 'callback' => '__return_false',
28 + ) );
29 + // Check Adminify Setup Wizard Page
30 + if ( !empty($_GET['page']) && 'wp-adminify-setup-wizard' == $_GET['page'] ) {
31 + return;
32 + }
33 +
34 + if ( is_admin() ) {
35 + if ( $admin_bar_position == 'top' || $admin_bar_position == 'bottom' ) {
36 + add_action( 'admin_init', [ $this, 'jltwp_adminify_add_admin_bar' ] );
37 + }
38 + // Remove Unnecessary Menus from Admin bar
39 + add_action( 'wp_before_admin_bar_render', [ $this, 'jltma_adminify_remove_admin_bar_menus' ], 0 );
40 + add_filter( 'admin_body_class', [ $this, 'admin_bar_body_class' ] );
41 + add_action( 'admin_head', [ $this, 'jltwp_adminify_admin_bar_css' ], 999 );
42 + add_action( 'wp_ajax_adminify_all_search', [ $this, 'adminify_all_search' ] );
43 + add_action( 'wp_ajax_wp_adminify_color_mode', [ $this, 'wp_adminify_color_mode' ] );
44 + add_action( 'admin_enqueue_scripts', [ $this, 'jltwp_adminify_admin_scripts' ], 100 );
45 + // Screen Option and Help Tab
46 + add_action(
47 + 'admin_head',
48 + [ $this, 'jltwp_adminify_remove_screen_options' ],
49 + 10,
50 + 3
51 + );
52 + add_action( 'admin_head', [ $this, 'jltwp_adminify_remove_help_tab' ] );
53 + } else {
54 + // Admin bar Frontend settings
55 + $frontend_admin = ( !empty($this->options['admin_bar_hide_frontend']) ? $this->options['admin_bar_hide_frontend'] : 'show' );
56 + $this->jltwp_adminify_front_bar();
57 + add_action( 'init', [ $this, 'admin_bar_front_style_init' ] );
58 + if ( $frontend_admin == 'hide' ) {
59 + add_filter( 'show_admin_bar', '__return_false' );
60 + }
61 + }
62 +
63 + }
64 +
65 + public function jltwp_adminify_front_bar()
66 + {
67 + add_action( 'admin_init', [ $this, 'jltwp_adminify_add_admin_bar' ] );
68 + add_filter( 'body_class', [ $this, 'admin_bar_body_class' ] );
69 + }
70 +
71 + public function admin_bar_front_style_init()
72 + {
73 + add_filter( 'wp_enqueue_scripts', [ $this, 'admin_bar_front_style' ] );
74 + }
75 +
76 + // Frontend Admin bar style
77 + public function admin_bar_front_style()
78 + {
79 + $admin_bar_css = '';
80 + $admin_bar_css .= '.admin-bar-position-bottom #wpadminbar{
247 81 top:auto;
248 82 bottom: 0;
249 83 }
250 84 .admin-bar-position-bottom #wpadminbar .menupop .ab-sub-wrapper{
@@ -249,820 +83,1173 @@
249 83 }
250 84 .admin-bar-position-bottom #wpadminbar .menupop .ab-sub-wrapper{
251 85 bottom: 32px;
252 86 }
87 +
253 88 @media all and (max-width:600px){
254 89 body.logged-in.admin-bar-position-bottom {
255 90 position: relative;
256 91 }
257 92 }';
258 - wp_add_inline_style('admin-bar', $admin_bar_css);
259 - }
93 + wp_add_inline_style( 'admin-bar', $admin_bar_css );
94 + }
95 +
96 + //Remove Screen Options
97 + public function jltwp_adminify_remove_screen_options()
98 + {
99 + $enable_screen_tab = Utils::get_user_preference( 'screen_options_tab' );
100 + if ( $enable_screen_tab ) {
101 + add_filter( 'screen_options_show_screen', '__return_false' );
102 + }
103 + }
104 +
105 + // Contextual Help Tab Remove
106 + public function jltwp_adminify_remove_help_tab()
107 + {
108 + $enable_screen_tab = Utils::get_user_preference( 'adminify_help_tab' );
109 +
110 + if ( $enable_screen_tab ) {
111 + $screen = get_current_screen();
112 + $screen->remove_help_tabs();
113 + }
114 +
115 + }
116 +
117 + // Get All registered WP Admin Menus
118 + public static function get_wp_admin_menus( $thismenu, $thissubmenu )
119 + {
120 + $options = [];
121 + if ( !empty($thismenu) && is_array( $thismenu ) ) {
122 + foreach ( $thismenu as $item ) {
123 + if ( !empty($item[0]) ) {
124 + // the preg_replace removes "Comments" & "Plugins" menu spans.
125 + $options[$item[2]] = preg_replace( '/\\<span.*?>.*?\\<\\/span><\\/span>/s', '', $item[0] );
126 + }
127 + }
128 + }
129 + if ( !empty($thissubmenu) && is_array( $thissubmenu ) ) {
130 + foreach ( $thissubmenu as $items ) {
131 + foreach ( $items as $item ) {
132 + if ( !empty($item[0]) ) {
133 + $options[$item[1]] = preg_replace( '/\\<span.*?>.*?\\<\\/span><\\/span>/s', '', $item[0] );
134 + }
135 + }
136 + }
137 + }
138 + return $options;
139 + }
140 +
141 + public function jltwp_adminify_admin_scripts()
142 + {
143 + global $pagenow ;
144 + if ( !is_user_logged_in() && $pagenow != 'wp-login.php' ) {
145 + return;
146 + }
147 + if ( is_admin_bar_showing() ) {
148 + }
149 + wp_enqueue_style( 'wp-adminify-admin-bar' );
150 + wp_localize_script( 'wp-adminify-admin', 'WPAdminify', $this->adminify_create_admin_bar_js_object() );
151 + $this->admin_topbar_loader_css();
152 + // wp_enqueue_style('wp-adminify-admin-bar', WP_ADMINIFY_ASSETS . 'css/admin-bar.css', false, WP_ADMINIFY_VER);
153 + // wp_enqueue_script('wp-adminify-admin', WP_ADMINIFY_ASSETS . 'js/wp-adminify.js', ['jquery'], WP_ADMINIFY_VER, true);
154 + // wp_localize_script('wp-adminify-admin', 'WPAdminify', $this->adminify_create_admin_bar_js_object());
155 + }
156 +
157 + public function adminify_create_admin_bar_js_object()
158 + {
159 + return array(
160 + 'ajax_url' => admin_url( 'admin-ajax.php' ),
161 + 'security_nonce' => wp_create_nonce( 'adminify-admin-bar-security-nonce' ),
162 + 'notice_nonce' => wp_create_nonce( 'adminify-notice-nonce' ),
163 + );
164 + }
165 +
166 + /**
167 + * Preloader
168 + *
169 + * @return void
170 + */
171 + public function admin_topbar_loader_css()
172 + {
173 + $output_css = '';
174 + $topbar_wireframe_img = WP_ADMINIFY_ASSETS_IMAGE . 'topbar-wireframe.svg';
175 + $output_css .= '.js .wp-adminify-topbar-loader{background: url(' . $topbar_wireframe_img . '); }';
176 + echo '<style>' . $output_css . '</style>' ;
177 + }
178 +
179 + /**
180 + * Save Color Mode by Ajax
181 + *
182 + * @return void
183 + */
184 + public function wp_adminify_color_mode()
185 + {
186 +
187 + if ( defined( 'DOING_AJAX' ) && DOING_AJAX && check_ajax_referer( 'adminify-admin-bar-security-nonce', 'security' ) > 0 ) {
188 + $admin_bar_mode = AdminSettings::get_instance()->get();
189 + $key = Utils::clean_ajax_input( $_POST['key'] );
190 + $value = Utils::clean_ajax_input( $_POST['value'] );
191 +
192 + if ( $key == "" ) {
193 + $message = __( "No Color Mode supplied to save", 'adminify' );
194 + echo Utils::ajax_error_message( $message ) ;
195 + die;
196 + }
197 +
198 + // Light/Dark Mode
199 +
200 + if ( $key === 'color_mode' ) {
201 + $admin_bar_mode['admin_bar_mode'] = $value;
202 + $admin_bar_mode['enable_schedule_dark_mode'] = false;
203 + update_option( '_wpadminify', $admin_bar_mode );
204 + die;
205 + }
206 +
207 + // Screen Options, Help Tabs and WP Hide Links
208 +
209 + if ( $key === 'screen_options_tab' || $key === 'hide_wp_links' || $key === 'adminify_help_tab' ) {
210 + $userid = get_current_user_id();
211 + $current = get_user_meta( $userid, '_wpadminify_preferences', true );
212 +
213 + if ( is_array( $current ) ) {
214 + $current[$key] = $value;
215 + } else {
216 + $current = array();
217 + $current[$key] = $value;
218 + }
219 +
220 + $state = update_user_meta( $userid, '_wpadminify_preferences', $current );
221 +
222 + if ( $state ) {
223 + $returndata = array();
224 + $returndata['success'] = true;
225 + $returndata['message'] = __( 'Preferences saved', 'adminify' );
226 + echo json_encode( $returndata ) ;
227 + } else {
228 + $message = __( "Unable to save user preferences", 'adminify' );
229 + echo Utils::ajax_error_message( $message ) ;
230 + die;
231 + }
232 +
233 + }
234 +
235 + }
236 +
237 + }
238 +
239 + /**
240 + * Search Everything
241 + *
242 + * @return void
243 + */
244 + public function adminify_all_search()
245 + {
246 +
247 + if ( defined( 'DOING_AJAX' ) && DOING_AJAX && check_ajax_referer( 'adminify-admin-bar-security-nonce', 'security' ) > 0 ) {
248 + $term = $_POST['search'];
249 + // Search Arguments
250 + $args = array(
251 + 'numberposts' => -1,
252 + 's' => $term,
253 + 'post_status' => array(
254 + 'publish',
255 + 'pending',
256 + 'draft',
257 + 'future',
258 + 'private',
259 + 'inherit'
260 + ),
261 + );
262 + // All Post Types
263 + $post_types = $this->get_post_types();
264 + foreach ( $post_types as $type ) {
265 + $args['post_type'][] = $type->name;
266 + }
267 + // All Categories/Taxonomies
268 + $all_taxonomies = get_taxonomies();
269 + // Get Comments
270 + $all_comments = get_comments();
271 + // Get All Users
272 + $all_users = get_users();
273 + // All Users
274 + // $blogusers = get_users();
275 + // foreach ($blogusers as $type) {
276 + // // $name = $type->user_login;
277 + // // $id = $type->ID;
278 + // $args['author__in'][] = $type->ID;
279 + // }
280 + // // All Menus
281 + // $all_admin_menus = self::get_wp_admin_menus();
282 + // All Plugins
283 + if ( !function_exists( 'get_plugins' ) ) {
284 + require_once ABSPATH . 'wp-admin/includes/plugin.php';
285 + }
286 + $all_plugins = get_plugins();
287 + $foundposts = get_posts( $args );
288 + // $count_items = '';
289 + // if (count($foundposts) > 0) {
290 + // $count_items .= count($foundposts);
291 + // } elseif (count($all_plugins)) {
292 + // $count_items .= count($all_plugins);
293 + // }
294 + ob_start();
295 + ?>
260 296
261 - // Remove Screen Options
262 - public function remove_screen_options()
263 - {
264 - $enable_screen_tab = Utils::get_user_preference('screen_options_tab');
265 - if ($enable_screen_tab) {
266 - add_filter('screen_options_show_screen', '__return_false');
267 - }
268 - }
297 + <p><span class="count"></span><?php
298 + echo count( $foundposts ) . __( ' item<span>s</span> found', 'adminify' ) ;
299 + ?></p>
300 + <table class="top-header-result-table" style="height:500px;">
301 + <thead>
302 + <tr class="has-text-left">
303 + <th><?php
304 + _e( 'Title', 'adminify' );
305 + ?></th>
306 + <th><?php
307 + _e( 'Type', 'adminify' );
308 + ?></th>
309 + <th><?php
310 + _e( 'User', 'adminify' );
311 + ?></th>
312 + <th><?php
313 + _e( 'Date', 'adminify' );
314 + ?></th>
315 + </tr>
316 + </thead>
317 + <tbody>
269 318
270 - // Contextual Help Tab Remove
271 - public function remove_help_tab()
272 - {
273 - $enable_screen_tab = Utils::get_user_preference('adminify_help_tab');
274 - if ($enable_screen_tab) {
275 - $screen = get_current_screen();
276 - $screen->remove_help_tabs();
277 - }
278 - }
319 + <?php
320 + foreach ( $foundposts as $item ) {
321 + $author_id = $item->post_author;
322 + $editurl = get_edit_post_link( $item );
323 + $public = get_permalink( $item );
324 + ?>
325 + <tr>
326 + <td><span class="table-title"><a href="<?php
327 + echo $editurl ;
328 + ?>"><?php
329 + echo get_the_title( $item ) ;
330 + ?></a></span></td>
331 + <td><span class="type"><?php
332 + echo get_post_type( $item ) ;
333 + ?></span></td>
334 + <td><span class="user"><?php
335 + echo the_author_meta( 'user_login', $author_id ) ;
336 + ?></span></td>
337 + <td><span class="date"><?php
338 + echo get_the_date( get_option( 'date_format' ), $item ) ;
339 + ?></span></td>
340 + </tr>
341 + <?php
342 + }
343 + ?>
279 344
280 - // Get All registered WP Admin Menus
281 - public static function get_wp_admin_menus($thismenu, $thissubmenu)
282 - {
283 - $options = [];
345 + <?php
346 + foreach ( $all_taxonomies as $tax_name ) {
347 + $terms = get_terms( array(
348 + 'taxonomy' => $tax_name,
349 + 'hide_empty' => 1,
350 + ) );
351 + foreach ( $terms as $cat ) {
352 + if ( strpos( strtolower( $cat->name ), strtolower( $term ) ) === false ) {
353 + continue;
354 + }
355 + // $user = get_userdata($cat->term_id);
356 + ?>
357 + <tr>
358 + <td>
359 + <span class="table-title">
360 + <a href="<?php
361 + echo get_term_link( $cat->slug, $cat->taxonomy ) ;
362 + ?>">
363 + <?php
364 + echo $cat->name ;
365 + ?>
366 + </a>
367 + </span>
368 + </td>
369 + <td>
370 + <span class="type"><?php
371 + echo $cat->taxonomy ;
372 + ?></span>
373 + </td>
374 + <td>
375 + <span class="user">
376 + N/A
377 + </span>
378 + </td>
379 + <td>
380 + <span class="date">
381 + N/A
382 + </span>
383 + </td>
384 + <td>
385 + </td>
386 + </tr>
387 + <?php
388 + }
389 + }
390 + ?>
284 391
285 - if (!empty($thismenu) && is_array($thismenu)) {
286 - foreach ($thismenu as $item) {
287 - if (!empty($item[0])) {
288 - // the preg_replace removes "Comments" & "Plugins" menu spans.
289 - $options[$item[2]] = (preg_replace('/\<span.*?>.*?\<\/span><\/span>/s', '', $item[0]));
290 - }
291 - }
292 - }
293 392
294 - if (!empty($thissubmenu) && is_array($thissubmenu)) {
295 - foreach ($thissubmenu as $items) {
296 - foreach ($items as $item) {
297 - if (!empty($item[0])) {
298 - $options[$item[1]] = (preg_replace('/\<span.*?>.*?\<\/span><\/span>/s', '', $item[0]));
299 - }
300 - }
301 - }
302 - }
393 + <!-- Get Comments -->
394 + <?php
395 + foreach ( $all_comments as $comment ) {
396 + if ( strpos( strtolower( $comment->comment_content ), strtolower( $term ) ) === false ) {
397 + continue;
398 + }
399 + ?>
400 + <tr>
401 + <td>
402 + <span class="table-title">
403 + <a href="<?php
404 + echo admin_url( 'comment.php?action=editcomment&c=' . $comment->comment_ID ) ;
405 + ?>">
406 + <?php
407 + echo $comment->comment_content ;
408 + ?>
409 + </a>
410 + </span>
411 + </td>
412 + <td>
413 + <span class="type">
414 + <?php
415 + echo ucwords( $comment->comment_type ) ;
416 + ?>
417 + </span>
418 + </td>
419 + <td>
420 + <span class="user">
421 + <?php
422 + echo the_author_meta( 'display_name', $comment->user_id ) ;
423 + ?>
424 + </span>
425 + </td>
426 + <td>
427 + <span class="date">
428 + <?php
429 + echo get_the_date( get_option( 'date_format' ), $comment->comment_date ) ;
430 + ?>
431 + </span>
432 + </td>
433 + </tr>
434 + <?php
435 + }
436 + ?>
303 437
304 - return $options;
305 - }
306 438
307 - public function admin_scripts()
308 - {
309 - global $pagenow;
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();
315 - return;
316 - }
317 439
318 - // Commented on: 9-6-24
319 - if (!empty($this->adminify_ui)) {
320 - wp_enqueue_style('wp-adminify-admin-bar');
321 - $this->admin_topbar_loader_css();
322 - }
323 - wp_localize_script('adminify-admin', 'PXLBSADMINIFY_ADMINBAR', $this->create_admin_bar_js_object());
324 - }
440 + <!-- Get Users -->
441 + <?php
442 + foreach ( $all_users as $user ) {
443 + if ( strpos( strtolower( $user->user_login ), strtolower( $term ) ) === false ) {
444 + continue;
445 + }
446 + ?>
447 + <tr>
448 + <td>
449 + <span class="table-title">
450 + <a href="<?php
451 + echo admin_url( 'user-edit.php?user_id=' . $user->ID ) ;
452 + ?>">
453 + <?php
454 + echo $user->display_name ;
455 + ?>
456 + </a>
457 + </span>
458 + </td>
459 + <td>
460 + <span class="type">
461 + <?php
462 + _e( "User", 'adminify' );
463 + ?>
464 + </span>
465 + </td>
466 + <td>
467 + <span class="user">
468 + <?php
469 + echo the_author_meta( 'display_name', $user->ID ) ;
470 + ?>
471 + </span>
472 + </td>
473 + <td>
474 + <span class="date">
475 + <?php
476 + echo get_the_date( get_option( 'date_format' ), $user->user_registered ) ;
477 + ?>
478 + </span>
479 + </td>
480 + </tr>
481 + <?php
482 + }
483 + ?>
325 484
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 485
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 486
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 - );
487 + <!-- Get Plugins -->
488 + <?php
489 + foreach ( $all_plugins as $plugin ) {
490 + if ( strpos( strtolower( $plugin['Name'] ), strtolower( $term ) ) === false ) {
491 + continue;
492 + }
493 + ?>
494 + <tr>
495 + <td>
496 + <span class="table-title">
497 + <a href="<?php
498 + echo admin_url( 'plugins.php' ) ;
499 + ?>">
500 + <?php
501 + echo $plugin['Name'] ;
502 + ?>
503 + </a>
504 + </span>
505 + </td>
506 + <td>
507 + <span class="type">
508 + <?php
509 + _e( "Plugin", 'adminify' );
510 + ?>
511 + </span>
512 + </td>
513 + <td>
514 + <span class="user">
515 + <?php
516 + echo $plugin['AuthorName'] ;
517 + ?>
518 + </span>
519 + </td>
520 + <td>
521 + <span class="date">
522 + N/A
523 + </span>
524 + </td>
525 + </tr>
526 + <?php
527 + }
528 + ?>
360 529
361 - wp_localize_script('adminify-admin-bar-switcher', 'PXLBSADMINIFY_ADMINBAR', $this->create_admin_bar_js_object());
362 - }
363 530
531 + </tbody>
532 + </table>
364 533
365 - public function create_admin_bar_js_object()
366 - {
367 - return [
368 - 'ajax_url' => admin_url('admin-ajax.php'),
369 - 'security_nonce' => wp_create_nonce('pxlbsadminify_frame_nonce'),
370 - 'notice_nonce' => wp_create_nonce('pxlbsadminify-notice-nonce'),
371 - ];
372 - }
373 534
374 - /**
375 - * Preloader
376 - *
377 - * @return void
378 - */
379 - public function admin_topbar_loader_css()
380 - {
381 - $output_css = '';
382 - $topbar_wireframe_img = PXLBSADMINIFY_ASSETS_IMAGE . 'topbar-wireframe.svg';
383 - $output_css .= '.js .wp-adminify-topbar-loader{background: url(' . esc_url($topbar_wireframe_img) . '); }';
535 + <?php
536 + $output_data = ob_get_clean();
537 + echo json_encode( $output_data ) ;
538 + }
539 +
540 + die;
541 + }
542 +
543 + public function jltwp_adminify_admin_bar_css()
544 + {
545 + $admin_bar_mode = AdminSettings::get_instance()->get();
546 + $admin_bar_mode = ( !empty($admin_bar_mode['admin_bar_mode']) ? $admin_bar_mode['admin_bar_mode'] : '' );
547 + $output_css = '';
548 + $output_css .= '<style type="text/css">';
549 + $admin_bar_container = ( !empty($this->options['admin_bar_container']) ? $this->options['admin_bar_container'] : 'full_container' );
550 +
551 + if ( $admin_bar_mode === 'light' ) {
552 + $light_bg_type = ( !empty($this->options['admin_bar_light_bg']) ? $this->options['admin_bar_light_bg'] : 'color' );
553 + $light_bg_color = ( !empty($this->options['admin_bar_light_bg_color']) ? $this->options['admin_bar_light_bg_color'] : '' );
554 + // Full Container Colors
555 +
556 + if ( $admin_bar_container == 'full_container' ) {
557 + if ( $light_bg_type === 'color' ) {
558 + $output_css .= '.wp-adminify.adminify-light-mode .adminify-top_bar nav.navbar, .wp-adminify .wp-adminify-horizontal-menu { background-color:' . $light_bg_color . ' ; }';
559 + }
560 + } elseif ( $admin_bar_container == 'admin_bar_only' ) {
561 + // Admin Bar Colors
562 + if ( $light_bg_type === 'color' ) {
563 + if ( !empty($this->options['admin_bar_light_bg_color']) ) {
564 + $output_css .= '.wp-adminify.adminify-light-mode .adminify-top_bar nav.navbar { background-color:' . $light_bg_color . ' }';
565 + }
566 + }
567 + }
568 +
569 + if ( !empty($admin_bar_colors['icon_color']) ) {
570 + $output_css .= '.adminify-top_bar nav.navbar .navbar-menu .topbar-icon { fill: ' . $admin_bar_colors['icon_color'] . ' }';
571 + }
572 + } elseif ( $admin_bar_mode === 'dark' ) {
573 + $dark_bg_type = ( isset( $this->options['admin_bar_dark_bg'] ) ? $this->options['admin_bar_dark_bg'] : 'color' );
574 +
575 + if ( $admin_bar_container == 'full_container' ) {
576 +
577 + if ( $dark_bg_type === 'color' ) {
578 + $dark_bg_color = $this->options['admin_bar_dark_bg_color'];
579 + $output_css .= '.wp-adminify.adminify-dark-mode .adminify-top_bar nav.navbar, .wp-adminify .wp-adminify-horizontal-menu{ background-color:' . $dark_bg_color . ' }';
580 + } elseif ( $dark_bg_type === 'gradient' ) {
581 + $dark_gradient_bg_color = $this->options['admin_bar_dark_bg_gradient']['background-color'];
582 + $dark_gradient_color = $this->options['admin_bar_dark_bg_gradient']['background-gradient-color'];
583 + $dark_gradient_color_dir = $this->options['admin_bar_dark_bg_gradient']['background-gradient-direction'];
584 + $output_css .= '.wp-adminify.adminify-dark-mode .adminify-top_bar nav.navbar, .wp-adminify .wp-adminify-horizontal-menu{ background-image : linear-gradient(' . esc_attr( $dark_gradient_color_dir ) . ', ' . esc_attr( $dark_gradient_bg_color ) . ' , ' . esc_attr( $dark_gradient_color ) . '); }';
585 + }
586 +
587 + } elseif ( $admin_bar_container == 'admin_bar_only' ) {
588 +
589 + if ( $dark_bg_type === 'color' ) {
590 + $dark_bg_color = $this->options['admin_bar_dark_bg_color'];
591 + $output_css .= '.wp-adminify.adminify-dark-mode .adminify-top_bar nav.navbar{ background-color:' . $dark_bg_color . ' }';
592 + }
593 +
594 + }
595 +
596 + }
597 +
598 + // "New" Button Colors
599 + $new_btn_colors = ( !empty($this->options['admin_bar_link_color']) ? $this->options['admin_bar_link_color'] : '' );
600 + if ( !empty($new_btn_colors['link_color']) ) {
601 + $output_css .= '.wp-adminify #wpadminbar #wp-admin-bar-root-default #wp-admin-bar-new-content > .ab-item .ab-label, .wp-adminify #wpadminbar #wp-admin-bar-root-default #wp-admin-bar-new-content .ab-item .ab-icon:before { color:' . $new_btn_colors['link_color'] . ' }';
602 + }
603 + if ( !empty($new_btn_colors['hover_color']) ) {
604 + $output_css .= '.wp-adminify #wpadminbar #wp-admin-bar-root-default #wp-admin-bar-new-content > .ab-item:hover .ab-label, .wp-adminify #wpadminbar #wp-admin-bar-root-default #wp-admin-bar-new-content .ab-item:hover .ab-icon:before{ color:' . $new_btn_colors['hover_color'] . ' }';
605 + }
606 + if ( !empty($new_btn_colors['bg_color']) ) {
607 + $output_css .= '.wp-adminify #wpadminbar #wp-admin-bar-root-default #wp-admin-bar-new-content > .ab-item, .wp-adminify #wpadminbar #wp-admin-bar-root-default #wp-admin-bar-new-content:hover > .ab-item { background:' . $new_btn_colors['bg_color'] . ';}';
608 + }
609 + // "New" Button Hover Colors
610 + $new_btn_dropwon = ( !empty($this->options['admin_bar_link_dropdown_color']) ? $this->options['admin_bar_link_dropdown_color'] : '' );
611 + if ( !empty($new_btn_dropwon['wrapper_bg']) ) {
612 + $output_css .= '.wp-adminify #wpadminbar .ab-top-menu .ab-sub-wrapper, .wp-adminify #wpadminbar .ab-top-menu .ab-sub-wrapper .ab-submenu, .wp-adminify #wpadminbar .ab-top-menu .ab-sub-wrapper .ab-submenu .ab-item { background-color:' . $new_btn_dropwon['wrapper_bg'] . ' !important;}';
613 + }
614 + if ( !empty($new_btn_dropwon['bg_color']) ) {
615 + $output_css .= '.wp-adminify #wpadminbar .ab-top-menu .ab-sub-wrapper .ab-submenu .ab-item:hover { background-color:' . $new_btn_dropwon['bg_color'] . ' !important;}';
616 + }
617 + if ( !empty($new_btn_dropwon['link_color']) ) {
618 + $output_css .= '.wp-adminify #wpadminbar .ab-top-menu .ab-sub-wrapper .ab-submenu .ab-item { color:' . $new_btn_dropwon['link_color'] . ' !important }';
619 + }
620 + if ( !empty($new_btn_dropwon['hover_color']) ) {
621 + $output_css .= '.wp-adminify #wpadminbar .ab-top-menu .ab-sub-wrapper .ab-submenu .ab-item:hover { color:' . $new_btn_dropwon['hover_color'] . ' !important }';
622 + }
623 + // Text Color
624 +
625 + if ( !empty($this->options['admin_bar_text_color']) ) {
626 + $output_css .= '.adminify-top_bar nav.navbar .navbar-brand .navbar-item .wp-adminify-site-name, .adminify-top_bar nav.navbar .navbar-menu .wp-adminify-user-site-list button { color:' . $this->options['admin_bar_text_color'] . ' }';
627 + $output_css .= '.wp-adminify #wpadminbar #wp-admin-bar-root-default #wp-admin-bar-new-post > .ab-item { color:' . $this->options['admin_bar_text_color'] . ' ; }';
628 + $output_css .= '.wp-adminify #wpadminbar #wp-admin-bar-root-default #wp-admin-bar-new-post > .ab-item .ab-icon:before { color:' . $this->options['admin_bar_text_color'] . ' ; }';
629 + $output_css .= '.wp-adminify #wpadminbar #wp-admin-bar-root-default #wp-admin-bar-new-post > .ab-item .ab-label { color:' . $this->options['admin_bar_text_color'] . ' ; }';
630 + }
631 +
632 + // Icon Color
633 +
634 + if ( !empty($this->options['admin_bar_icon_color']) ) {
635 + $output_css .= '.adminify-top_bar nav.navbar .navbar-menu .topbar-icon svg path { fill:' . $this->options['admin_bar_icon_color'] . ' }';
636 + $output_css .= '.adminify-top_bar nav.navbar .navbar-end i, .adminify-top_bar nav.navbar .navbar-burger i { color:' . $this->options['admin_bar_icon_color'] . ' }';
637 + }
638 +
639 + $output_css .= ' </style>';
640 + echo $output_css ;
641 + }
642 +
643 + // Admin Bar Body Class
644 + public function admin_bar_body_class( $classes )
645 + {
646 +
647 + if ( is_admin() ) {
648 + $classes .= " wp-adminify-admin-bar";
649 + $admin_bar_position = ( !empty($this->options['admin_bar_position']) ? $this->options['admin_bar_position'] : 'top' );
650 +
651 + if ( $admin_bar_position === 'top' ) {
652 + $classes .= " position-top";
653 + } elseif ( $admin_bar_position === 'bottom' ) {
654 + $classes .= " position-bottom";
655 + }
656 +
657 + if ( !empty($this->options['enable_admin_bar']) ) {
658 + $classes .= " topbar-disabled";
659 + }
660 + } else {
661 + global $pagenow ;
662 + if ( !is_user_logged_in() && $pagenow != 'wp-login.php' ) {
663 + return $classes;
664 + }
665 + $classes[] = "wp-adminify-admin-bar";
666 + $admin_bar_position = ( !empty($this->options['admin_bar_position']) ? $this->options['admin_bar_position'] : 'top' );
667 +
668 + if ( $admin_bar_position === 'top' ) {
669 + $classes[] = "admin-bar-position-top";
670 + } elseif ( $admin_bar_position === 'bottom' ) {
671 + $classes[] = "admin-bar-position-bottom";
672 + }
673 +
674 + if ( !empty($this->options['enable_admin_bar']) ) {
675 + $classes[] = "topbar-disabled";
676 + }
677 + }
678 +
679 + return $classes;
680 + }
681 +
682 + public function get_post_types()
683 + {
684 +
685 + if ( is_array( $this->post_types ) ) {
686 + return $this->post_types;
687 + } else {
688 + $args = array(
689 + 'public' => true,
690 + );
691 + $output = 'objects';
692 + $post_types = get_post_types( $args, $output );
693 + $this->post_types = $post_types;
694 + return $post_types;
695 + }
696 +
697 + }
698 +
699 + public function jltwp_adminify_add_admin_bar()
700 + {
701 + // For Testing Admin Bar on Setup Wizard
702 + // add_action('admin_head', [$this, 'jltwp_adminify_render_admin_bar']);
703 + add_action( 'in_admin_header', [ $this, 'jltwp_adminify_render_admin_bar' ], -999999999 );
704 + // on frontend area
705 + add_action( 'wp_head', [ $this, 'jltwp_adminify_render_admin_bar' ] );
706 + }
707 +
708 + public function jltwp_adminify_render_admin_bar()
709 + {
710 + global $pagenow ;
711 + if ( !is_user_logged_in() && $pagenow != 'wp-login.php' ) {
712 + return;
713 + }
714 + if ( !is_admin_bar_showing() ) {
715 + return false;
716 + }
717 + global $wp_admin_bar ;
718 + if ( empty($wp_admin_bar) ) {
719 + return false;
720 + }
721 + $admin_bar_mode = AdminSettings::get_instance()->get();
722 + $admin_bar_mode = ( empty($admin_bar_mode['admin_bar_mode']) ? 'light' : $admin_bar_mode['admin_bar_mode'] );
723 + // Light/Dark Mode
724 + $enable_dark_mode = $admin_bar_mode != 'light';
725 + // Screen Option && Hide WP Links
726 + $enable_screen_tab = Utils::get_user_preference( 'screen_options_tab' );
727 + $enable_help_tab = Utils::get_user_preference( 'adminify_help_tab' );
728 + $enable_hide_wp_links = Utils::get_user_preference( 'hide_wp_links' );
729 + // Admin Bar Position
730 +
731 + if ( !empty($this->options['admin_bar_position']) === 'top' ) {
732 + $admin_bar_position = 'top_bar';
733 + } elseif ( !empty($this->options['admin_bar_position']) === 'bottom' ) {
734 + $admin_bar_position = 'bottom_bar is-fixed-bottom';
735 + } else {
736 + $admin_bar_position = 'top_bar';
737 + }
738 +
739 + $current_user = wp_get_current_user();
740 + ob_start();
741 + ?>
384 742
385 - // Use wp_add_inline_style instead of echo to prevent "headers already sent" errors
386 - wp_add_inline_style( 'wp-adminify-admin-bar', wp_strip_all_tags($output_css) );
743 + <div class="wp-adminify-topbar-loader"></div>
744 + <div class="wp-adminify adminify-top_bar" style="opacity: 0;">
745 + <nav class="navbar adminify-top-navbar <?php
746 + echo esc_attr( $admin_bar_position ) ;
747 + ?>">
387 748
388 - $screen = get_current_screen(); // Get current screen details
749 + <?php
750 + $this->jltwp_adminify_logo();
751 + ?>
389 752
390 - if (isset($screen->base) && $screen->base === 'post') {
391 - $inline_script = "window.addEventListener('load', function() {
392 - const isFullscreenMode = wp.data.select('core/edit-post').isFeatureActive('fullscreenMode');
393 - if (isFullscreenMode) {
394 - jQuery('.adminify-top_bar').css({
395 - 'display': 'none !important'
396 - });
397 - }
398 - });";
399 - wp_add_inline_script( 'adminify-admin', $inline_script );
400 - }
401 - }
753 + <div class="adminify-legacy-admin">
754 + <?php
755 + if ( !$enable_hide_wp_links ) {
756 + echo wp_admin_bar_render() ;
757 + }
758 + ?>
759 + </div>
402 760
403 - /**
404 - * Save Color Mode by Ajax
405 - *
406 - * @return void
407 - */
408 - public function color_mode()
409 - {
410 - if (defined('DOING_AJAX') && DOING_AJAX) {
411 - // Both callers (classic admin bar wp-adminify.js and the React frame
412 - // dropdown dev/admin/frame/utils/uitls.js) post the
413 - // pxlbsadminify_frame_nonce nonce.
414 - if ( check_ajax_referer('pxlbsadminify_frame_nonce', 'security', false) <= 0 ) {
415 - wp_send_json_error( array( 'mess' => __( 'Invalid request.', 'adminify' ) ), 403 );
416 - }
417 - // Color mode is per-user preference; require the caller to be
418 - // a logged-in user with admin-bar access.
419 - if ( ! is_user_logged_in() || ! current_user_can( 'read' ) ) {
420 - wp_send_json_error( array( 'mess' => __( 'You are not allowed to perform this action.', 'adminify' ) ), 403 );
421 - }
422 - $admin_bar_mode = AdminSettings::get_instance()->get();
761 + <div id="wp-adminify-top-adminbar" class="navbar-menu">
762 + <div class="navbar-start">
423 763
424 - if (!empty($_POST['key'])) {
425 - $key = sanitize_key($_POST['key']);
426 - $value = isset($_POST['value']) ? Utils::clean_ajax_input(wp_unslash($_POST['value'])) : ''; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- sanitized via Utils::clean_ajax_input().
764 + <?php
765 + if ( !empty($this->options['admin_bar_search']) ) {
766 + ?>
767 + <div class="wp-adminify-top-header--search--form">
768 + <form class="top-header--search--form" action="$">
769 + <span class="adminify-search-expand"><i class="icon-magnifier icons"></i></span>
770 + <input id="top-header-search-input" class="top-header-search-input" type="search" placeholder="Search here">
771 + </form>
427 772
428 - if ($key == '') {
429 - $message = __('No Color Mode supplied to save', 'adminify');
430 - echo wp_json_encode( array( 'error' => true, 'error_message' => $message ) );
431 - die();
432 - }
433 - }
773 + <div id="top-header-search-results" class=" top-header-search-results" style="display: none;">
774 + <div class="top-header-results-wrapper">
775 + </div>
776 + </div>
777 + </div>
778 + <?php
779 + }
780 + ?>
434 781
435 - // Light/Dark Mode
436 - if ($key === 'color_mode') {
437 - // For User preference
438 - $userid = get_current_user_id();
439 - $current = get_user_meta($userid, $key, true);
440 - if($current !== $value) {
441 - $state = update_user_meta($userid, $key, $value);
442 - }
443 - die();
444 - }
782 + </div>
445 783
446 - // Screen Options, Help Tabs and WP Hide Links
447 - if ($key === 'screen_options_tab' || $key === 'hide_wp_links' || $key === 'adminify_help_tab') {
448 - $userid = get_current_user_id();
449 - $current = get_user_meta($userid, 'pxlbsadminify_preferences', true);
784 + <div class="navbar-end">
785 + <div class="field is-grouped">
450 786
451 - if (is_array($current)) {
452 - $current[$key] = $value;
453 - } else {
454 - $current = [];
455 - $current[$key] = $value;
456 - }
787 + <?php
788 +
789 + if ( !empty($this->options['admin_bar_dark_light_btn']) ) {
790 + ?>
791 + <div class="wp-admnify--mode--switcher pr-4">
792 + <label class="admnify-switcher is-pulled-right">
793 + <input type="checkbox" id="light-dark-switcher-btn" <?php
794 + checked( $enable_dark_mode, 1 );
795 + ?>>
796 + <span class="slider round"></span>
797 + </label>
798 + </div>
799 + <?php
800 + }
801 +
802 + ?>
457 803
458 - $state = update_user_meta($userid, 'pxlbsadminify_preferences', $current);
804 + <?php
805 +
806 + if ( !empty($this->options['admin_bar_comments']) ) {
807 + ?>
808 + <div class="wp-adminify--top--comment ml-4 mr-4">
809 + <button class="comment-trigger is-clickable">
810 + <div class="topbar-icon">
811 + <svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
812 + <path d="M0.25 13.75V1.75C0.25 0.921573 0.921572 0.25 1.75 0.25H12.25C13.0784 0.25 13.75 0.921573 13.75 1.75V9.25C13.75 10.0784 13.0784 10.75 12.25 10.75H4.75C4.42535 10.7494 4.10936 10.8547 3.85 11.05L0.25 13.75ZM1.75 1.75V10.75L3.3505 9.55C3.60973 9.35448 3.9258 9.24913 4.2505 9.25H12.25V1.75H1.75Z" fill="#4E4B66" />
813 + </svg>
814 + </div>
815 + <span class="comment-counter p-0 tag is-rounded">
816 + <?php
817 + $comments_count = wp_count_comments();
818 + echo $comments_count->moderated ;
819 + ?>
820 + </span>
821 + </button>
822 + </div>
459 823
460 - if ($state) {
461 - $returndata = [];
462 - $returndata['success'] = true;
463 - $returndata['message'] = __('Preferences saved', 'adminify');
464 - echo wp_json_encode($returndata);
465 - } else {
466 - $message = __('Unable to save user preferences', 'adminify');
467 - echo wp_json_encode( array( 'error' => true, 'error_message' => $message ) );
468 - die();
469 - }
470 - }
471 - }
472 - }
824 + <?php
825 + }
826 +
827 +
828 + if ( !empty($this->options['admin_bar_view_website']) ) {
829 + ?>
830 + <div class="wp-adminify--preview mr-4">
831 + <a class="preview-trigger is-clickable" href="<?php
832 + echo get_home_url() ;
833 + ?>" target="_blank">
834 + <i class="dashicons dashicons-visibility"></i>
835 + </a>
836 + </div>
837 + <?php
838 + }
839 +
840 + ?>
473 841
474 - /**
475 - * Search Everything
476 - *
477 - * @return void
478 - */
479 - public function all_search()
480 - {
481 - if (defined('DOING_AJAX') && DOING_AJAX) {
482 - // Both the classic admin bar and the React frame search (SearchForm.jsx)
483 - // post the pxlbsadminify_frame_nonce nonce.
484 - if ( check_ajax_referer('pxlbsadminify_frame_nonce', 'security', false) <= 0 ) {
485 - wp_send_json_error( array( 'message' => __( 'Invalid request.', 'adminify' ) ), 403 );
486 - }
487 - // Security check - only users who can edit posts should access admin search
488 - if (!current_user_can('edit_posts')) {
489 - wp_send_json_error(array('message' => __('You do not have permission to perform this action.', 'adminify')));
490 - }
842 + <div class="wp-adminify--user--account">
843 + <button class="user-avatar is-clickable">
844 + <div class="image is-45x45">
845 + <?php
846 + echo get_avatar(
847 + $current_user->user_email,
848 + 45,
849 + '',
850 + '',
851 + array(
852 + 'class' => 'is-rounded',
853 + )
854 + ) ;
855 + ?>
856 + </div>
857 + <span class="user-status tag p-0 is-rounded"></span>
858 + </button>
859 + </div>
491 860
492 - $search_text = '';
493 - if (!empty($_POST['search'])) {
494 - $search_text = sanitize_text_field(wp_unslash($_POST['search']));
495 - }
861 + </div>
862 + </div>
863 + </div>
864 + </nav>
496 865
497 - // Error Handling For Minimum 3 Char
498 - if (strlen($search_text) < 3) {
499 - wp_send_json_success(
500 - [
501 - 'message' => 'Please Enter Minimum 3 Characters'
502 - ]
503 - );
504 - }
505 866
867 + <div class="wp-adminify--user--wrapper">
868 + <div class="user-wqrapper-inner">
869 + <button class="user-wrapper-close is-clickable">
870 + <img src="<?php
871 + echo WP_ADMINIFY_ASSETS ;
872 + ?>images/header/close.svg" alt="Close Icon">
873 + </button>
506 874
507 - // Search Arguments
508 - $args = [
509 - 'numberposts' => -1,
510 - 's' => $search_text,
511 - 'post_status' => ['publish', 'pending', 'draft', 'future', 'private', 'inherit'],
512 - // Restrict non-public statuses (private/draft/pending/future) to posts the
513 - // current user is allowed to read. Without this, any role holding edit_posts
514 - // (e.g. Contributor) could read other authors' unpublished post titles.
515 - 'perm' => 'readable',
516 - ];
875 + <div class="user-wrapper-top media">
876 + <figure class="media-left">
877 + <p class="image is-85x85">
878 + <?php
879 + echo get_avatar(
880 + $current_user->user_email,
881 + 85,
882 + '',
883 + '',
884 + array(
885 + 'class' => 'is-rounded',
886 + )
887 + ) ;
888 + ?>
889 + </p>
890 + </figure>
891 + <div class="media-content">
892 + <div class="content">
893 + <h3 class="name">
894 + <?php
895 + echo esc_html( $current_user->display_name ) ;
896 + ?>
897 + </h3>
898 + <a href="<?php
899 + echo admin_url( 'profile.php' ) ;
900 + ?>" class="email">
901 + <?php
902 + echo is_email( $current_user->user_email ) ;
903 + ?>
904 + </a>
905 + <br>
906 + <a href="<?php
907 + echo wp_logout_url() ;
908 + ?>" class="logout button">
909 + <?php
910 + echo esc_html__( 'Log Out', 'adminify' ) ;
911 + ?>
912 + </a>
913 + </div>
914 + </div>
915 + </div>
517 916
518 - // All Post Types
519 - $post_types = $this->get_post_types();
520 - foreach ($post_types as $type) {
521 - $args['post_type'][] = $type->name;
522 - }
523 917
524 - // All Categories/Taxonomies
525 - $all_taxonomies = get_taxonomies();
918 + <div class="user-wrapper-content">
919 + <div class="panel-insider">
920 + <h4 class="title"><?php
921 + esc_html__( 'Overview', 'adminify' );
922 + ?></h4>
923 + <ul>
924 + <li>
925 + <a href="<?php
926 + echo get_home_url() ;
927 + ?>" target="_blank">
928 + <img class="user-panel-icon" src="<?php
929 + echo WP_ADMINIFY_ASSETS ;
930 + ?>images/header/panel/building.svg" alt="<?php
931 + echo esc_html__( 'View Website Icon', 'adminify' ) ;
932 + ?>">
933 + <?php
934 + echo _e( 'View Website', 'adminify' ) ;
935 + ?>
936 + </a>
937 + </li>
938 + <li>
939 + <a href="<?php
940 + echo admin_url( 'profile.php' ) ;
941 + ?>">
942 + <img class="user-panel-icon" src="<?php
943 + echo WP_ADMINIFY_ASSETS ;
944 + ?>images/header/panel/users.svg" alt="<?php
945 + echo esc_html__( 'Profile Icon', 'adminify' ) ;
946 + ?>">
947 + <?php
948 + _e( 'View Profile', 'adminify' );
949 + ?>
950 + </a>
951 + </li>
952 + </ul>
953 + </div>
526 954
527 - // Get Comments — only for users who can moderate them. Otherwise the search
528 - // would expose unapproved/pending comment content to roles that cannot see it
529 - // in the WordPress admin (e.g. Contributor).
530 - $all_comments = current_user_can('moderate_comments') ? get_comments() : [];
955 + <?php
956 + $all_updates = Utils::get_all_updates();
957 + $total_updates = $all_updates['total'];
958 + $plugin_updates = $all_updates['plugin'];
959 + $theme_updates = $all_updates['theme'];
960 + $wp_updates = $all_updates['wordpress'];
961 + ?>
531 962
532 - // Get All Users — only for users who can list users. Prevents leaking user
533 - // logins/display names to roles without the list_users capability.
534 - $all_users = current_user_can('list_users') ? get_users() : [];
535 963
536 - // All Users
537 - // $blogusers = get_users();
538 - // foreach ($blogusers as $type) {
539 - // $name = $type->user_login;
540 - // $id = $type->ID;
541 - // $args['author__in'][] = $type->ID;
542 - // }
964 + <div class="panel-insider">
965 + <h4 class="title"><?php
966 + _e( 'Updates', 'adminify' );
967 + ?></h4>
968 + <?php
969 +
970 + if ( $total_updates < 1 ) {
971 + ?>
972 + <p class="adminify-meta">
973 + <?php
974 + _e( 'Everything is up to date', 'adminify' );
975 + ?>
976 + </p>
977 + <?php
978 + } else {
979 + ?>
980 + <ul>
543 981
544 - // // All Menus
545 - // $all_admin_menus = self::get_wp_admin_menus();
982 + <li>
983 + <a href="<?php
984 + echo admin_url( 'update-core.php' ) ;
985 + ?>">
986 + <span class="icon-reload"></span>
987 + <?php
988 + _e( 'All Updates', 'adminify' );
989 + ?>
990 + <span class="count tag is-rounded">
991 + <?php
992 + echo esc_html( $total_updates ) ;
993 + ?>
994 + </span>
995 + </a>
996 + </li>
997 + <li>
998 + <a href="<?php
999 + echo admin_url( 'update-core.php' ) ;
1000 + ?>">
1001 + <span class="dashicons dashicons-wordpress"></span>
1002 + <?php
1003 + _e( ' WordPress Core', 'adminify' );
1004 + ?>
1005 + <span class="count tag is-rounded">
1006 + <?php
1007 + echo esc_html( $wp_updates ) ;
1008 + ?>
1009 + </span>
1010 + </a>
1011 + </li>
1012 + <li>
1013 + <a href="<?php
1014 + echo admin_url( 'plugins.php' ) ;
1015 + ?>">
1016 + <span class="icon-energy"></span>
1017 + <?php
1018 + _e( ' Plugins', 'adminify' );
1019 + ?>
1020 + <span class="count tag is-rounded"><?php
1021 + echo esc_html( count( $plugin_updates ) ) ;
1022 + ?></span>
1023 + </a>
1024 + </li>
1025 + <li>
1026 + <a href="<?php
1027 + echo admin_url( 'themes.php' ) ;
1028 + ?>">
1029 + <img class="user-panel-icon" src="<?php
1030 + echo WP_ADMINIFY_ASSETS ;
1031 + ?>images/header/panel/plugins.svg" />
1032 + <?php
1033 + _e( ' Themes', 'adminify' );
1034 + ?>
1035 + <span class="count tag is-rounded"><?php
1036 + echo esc_html( count( $theme_updates ) ) ;
1037 + ?></span>
1038 + </a>
1039 + </li>
1040 + </ul>
1041 + <?php
1042 + }
1043 +
1044 + ?>
1045 + </div>
546 1046
547 - // All Plugins — only for users who can manage plugins. Prevents leaking the
548 - // site's plugin inventory to roles without the activate_plugins capability.
549 - $all_plugins = [];
550 - if (current_user_can('activate_plugins')) {
551 - if (!function_exists('get_plugins')) {
552 - require_once ABSPATH . 'wp-admin/includes/plugin.php';
553 - }
554 - $all_plugins = get_plugins();
555 - }
1047 + <div class="panel-insider">
1048 + <h4 class="title"><?php
1049 + _e( 'Preferences', 'adminify' );
1050 + ?></h4>
1051 + <ul>
1052 + <li>
1053 + <?php
1054 + _e( 'Screen Tab Hide', 'adminify' );
1055 + ?>
1056 + <label class="admnify-switcher is-pulled-right">
1057 + <input type="checkbox" id="screen-option-switcher-btn" <?php
1058 + checked( $enable_screen_tab, 1 );
1059 + ?>>
1060 + <span class="slider round"></span>
1061 + </label>
1062 + </li>
1063 + <li>
1064 + <?php
1065 + _e( 'Help Tab Hide ', 'adminify' );
1066 + ?>
1067 + <label class="admnify-switcher is-pulled-right">
1068 + <input type="checkbox" id="help-option-switcher-btn" <?php
1069 + checked( $enable_help_tab, 1 );
1070 + ?>>
1071 + <span class="slider round"></span>
1072 + </label>
1073 + </li>
1074 + <li>
1075 + <?php
1076 + _e( 'Hide WP Links', 'adminify' );
1077 + ?>
1078 + <label class="admnify-switcher is-pulled-right">
1079 + <input type="checkbox" id="hide-wp-links-switcher-btn" <?php
1080 + checked( $enable_hide_wp_links, 1 );
1081 + ?>>
1082 + <span class="slider round"></span>
1083 + </label>
1084 + </li>
1085 + </ul>
1086 + </div>
1087 + </div>
556 1088
557 - $foundposts = get_posts($args);
1089 + <!-- <div class="user-notification-area pb-5">
1090 + <h4><?php
1091 + //_e('All Notifications', 'adminify');
1092 + ?></h4>
1093 + <ul class="m-0 p-0">
1094 + <li>
1095 + <a href="#">Dashboard: <span class="count has-text-centered is-pulled-right">2</span></a>
1096 + </li>
1097 + <li>
1098 + <a href="#">Themes: <span class="count has-text-centered is-pulled-right">2</span></a>
1099 + </li>
1100 + <li>
1101 + <a href="#">Plugins: <span class="count has-text-centered is-pulled-right">2</span></a>
1102 + </li>
1103 + <li>
1104 + <a href="#">Settings: <span class="count has-text-centered is-pulled-right">2</span></a>
1105 + </li>
1106 + </ul>
1107 + </div> -->
558 1108
559 - // $count_items = '';
560 - // if (count($foundposts) > 0) {
561 - // $count_items .= count($foundposts);
562 - // } elseif (count($all_plugins)) {
563 - // $count_items .= count($all_plugins);
564 - // }
1109 + </div>
1110 + </div>
1111 + </div>
565 1112
1113 + <?php
1114 + $wp_admin_bar = ob_get_clean();
1115 + echo $wp_admin_bar ;
1116 + }
1117 +
1118 + public function jltwp_adminify_logo()
1119 + {
1120 + global $wp_admin_bar ;
1121 + $adminurl = get_admin_url();
1122 + $homeurl = $adminurl;
1123 + // Light Logo
1124 + $admin_bar_mode = AdminSettings::get_instance()->get();
1125 + $menu_layout = (array) $admin_bar_mode['menu_layout_settings'];
1126 + // Menu Layouts
1127 + $menu_layout = ( !empty($admin_bar_mode['menu_layout_settings']) ? $admin_bar_mode['menu_layout_settings'] : '' );
1128 + $menu_mode = ( !empty($menu_layout['menu_mode']) ? $menu_layout['menu_mode'] : 'classic' );
1129 + $menu_layout = ( !empty($menu_layout['layout_type']) ? $menu_layout['layout_type'] : 'vertical' );
1130 + $admin_bar_logo_type = ( !empty($admin_bar_mode['admin_bar_logo_type']) ? $admin_bar_mode['admin_bar_logo_type'] : 'image_logo' );
1131 + $light_mode = ( !empty($admin_bar_mode['admin_bar_light_mode']) ? $admin_bar_mode['admin_bar_light_mode'] : '' );
1132 +
1133 + if ( $admin_bar_logo_type == 'image_logo' ) {
1134 + // Logo Image
1135 +
1136 + if ( !empty($light_mode['admin_bar_light_logo']['url']) ) {
1137 + $light_logo = $light_mode['admin_bar_light_logo']['url'];
1138 + } else {
1139 +
1140 + if ( $menu_layout == 'vertical' && $menu_mode == 'icon_menu' ) {
1141 + $light_logo = WP_ADMINIFY_ASSETS_IMAGE . 'logos/logo-text-light.svg';
1142 + } else {
1143 + $light_logo = WP_ADMINIFY_ASSETS_IMAGE . 'logos/logo-text-light.svg';
1144 + }
1145 +
1146 + }
1147 +
1148 + } elseif ( $admin_bar_logo_type == 'text_logo' ) {
1149 + // Text Logo
1150 + $light_logo = $light_mode['admin_bar_light_logo_text'];
1151 + }
1152 +
1153 + // Logo Size
1154 + $light_width = ( isset( $light_mode['light_logo_size']['width'] ) ? $light_mode['light_logo_size']['width'] : '150' );
1155 + $light_height = ( isset( $light_mode['light_logo_size']['height'] ) ? $light_mode['light_logo_size']['height'] : '45' );
1156 + // Dark Logo
1157 + $dark_mode = ( !empty($admin_bar_mode['admin_bar_dark_mode']) ? $admin_bar_mode['admin_bar_dark_mode'] : '' );
1158 +
1159 + if ( $admin_bar_logo_type == 'image_logo' ) {
1160 + // Dark Logo Image
1161 +
1162 + if ( isset( $dark_mode['admin_bar_dark_logo']['url'] ) && $dark_mode['admin_bar_dark_logo']['url'] ) {
1163 + $dark_logo = $dark_mode['admin_bar_dark_logo']['url'];
1164 + } else {
1165 +
1166 + if ( $menu_layout == 'vertical' && $menu_mode === 'icon_menu' ) {
1167 + $dark_logo = WP_ADMINIFY_ASSETS_IMAGE . 'logos/logo-text-dark.svg';
1168 + } else {
1169 + $dark_logo = WP_ADMINIFY_ASSETS_IMAGE . 'logos/logo-text-dark.svg';
1170 + }
1171 +
1172 + }
1173 +
1174 + } elseif ( $admin_bar_logo_type == 'text_logo' ) {
1175 + // Text Logo
1176 + $dark_logo = $dark_mode['admin_bar_dark_logo_text'];
1177 + }
1178 +
1179 + // Dark Logo Size
1180 + $dark_width = ( isset( $dark_mode['dark_logo_size']['width'] ) ? $dark_mode['dark_logo_size']['width'] : '150' );
1181 + $dark_height = ( isset( $dark_mode['dark_logo_size']['height'] ) ? $dark_mode['dark_logo_size']['height'] : '45' );
1182 + ?>
566 1183
1184 + <div class="navbar-brand">
1185 + <a class="navbar-item p-0" href="<?php
1186 + echo esc_url( $homeurl ) ;
1187 + ?>">
1188 + <?php
1189 +
1190 + if ( $admin_bar_logo_type == 'image_logo' ) {
1191 + ?>
1192 + <img alt="<?php
1193 + echo get_bloginfo( 'name' ) ;
1194 + ?>" class="logo-light" src="<?php
1195 + echo esc_url( $light_logo ) ;
1196 + ?>" width="<?php
1197 + echo esc_attr( $light_width ) ;
1198 + ?>" height="<?php
1199 + echo esc_attr( $light_height ) ;
1200 + ?>">
1201 + <img alt="<?php
1202 + echo get_bloginfo( 'name' ) ;
1203 + ?>" class="logo-dark" src="<?php
1204 + echo esc_url( $dark_logo ) ;
1205 + ?>" width="<?php
1206 + echo esc_attr( $dark_width ) ;
1207 + ?>" height="<?php
1208 + echo esc_attr( $dark_height ) ;
1209 + ?>">
1210 + <?php
1211 + } elseif ( $admin_bar_logo_type == 'text_logo' ) {
1212 + ?>
1213 + <span class="wp-adminify-site-name">
1214 + <?php
1215 + echo esc_html( $light_logo ) ;
1216 + ?>
1217 + </span>
1218 + <?php
1219 + }
1220 +
1221 + ?>
1222 + </a>
567 1223
568 1224
1225 + <div class="navbar-burger" data-target="wp-adminify-top-adminbar">
1226 + <i class="dashicons dashicons-menu-alt"></i>
1227 + </div>
569 1228
570 - $output_data = [
571 - 'foundposts' => $this->set_edit_url_foundposts($foundposts),
572 - 'all_taxonomies' => $this->filter_all_taxonomies($all_taxonomies, $search_text),
573 - 'all_comments' => $this->filter_all_comments($all_comments, $search_text),
574 - 'all_users' => $this->filter_all_users($all_users, $search_text),
575 - 'all_plugins' => $this->filter_all_plugins($all_plugins, $search_text),
576 - ];
577 1229
578 - wp_send_json_success(
579 - [
580 - 'data' => wp_json_encode($output_data),
581 - ]
582 - );
583 - }
1230 + </div>
584 1231
585 - die();
586 - }
1232 +<?php
1233 + }
1234 +
1235 + /* Remove from the administration bar */
1236 + public function jltma_adminify_remove_admin_bar_menus()
1237 + {
1238 + global $wp_admin_bar ;
1239 + $restricted_user = ( !empty($this->options['admin_bar_new_button_user_roles']) ? $this->options['admin_bar_new_button_user_roles'] : '' );
1240 + if ( $restricted_user ) {
1241 +
1242 + if ( Utils::restrict_for( $this->options['admin_bar_new_button_user_roles'] ) ) {
1243 + $wp_admin_bar->remove_menu( 'new-content' );
1244 + return;
1245 + }
1246 +
1247 + }
1248 + $wp_admin_bar->remove_menu( 'wp-logo' );
1249 + $wp_admin_bar->remove_menu( 'site-name' );
1250 + $wp_admin_bar->remove_menu( 'updates' );
1251 + $wp_admin_bar->remove_menu( 'menu-toggle' );
1252 + $wp_admin_bar->remove_menu( 'top-secondary' );
1253 + }
587 1254
588 - /**
589 - * Set URL to All Post
590 - */
591 - public function set_edit_url_foundposts($foundposts)
592 - {
593 - $all_posts = [];
594 - foreach ($foundposts as $key => $post) {
595 - // Defense in depth alongside the query's perm=readable: never surface a post
596 - // the current user cannot read (e.g. another author's unpublished content).
597 - if (!current_user_can('read_post', $post->ID)) {
598 - continue;
599 - }
600 - $edit_url = get_edit_post_link($post);
601 - $all_posts[$key]['title'] = get_the_title($post->ID);
602 - $all_posts[$key]['link'] = $edit_url;
603 - }
604 -
605 - return $all_posts;
606 - }
607 -
608 - /**
609 - * Search Taxonomies
610 - */
611 - public function filter_all_taxonomies($all_taxonomies, $search_text)
612 - {
613 - $find_taxonomies = [];
614 -
615 - foreach ($all_taxonomies as $tax_name) {
616 - $terms = get_terms(
617 - [
618 - 'taxonomy' => $tax_name,
619 - 'hide_empty' => 1,
620 - ]
621 - );
622 -
623 - foreach ($terms as $key => $cat) {
624 - if (strpos(strtolower($cat->name), strtolower($search_text)) === false) {
625 - continue;
626 - }
627 - $find_taxonomies[$key]['name'] = $cat->name;
628 - $find_taxonomies[$key]['link'] = get_edit_term_link($cat);
629 - }
630 - }
631 -
632 - return $find_taxonomies;
633 - }
634 -
635 - /**
636 - * Search Comments
637 - */
638 - public function filter_all_comments($all_comments, $search_text)
639 - {
640 - $find_comments = [];
641 -
642 - foreach ($all_comments as $key => $comment) {
643 - if (strpos(strtolower($comment->comment_content), strtolower($search_text)) === false) {
644 - continue;
645 - }
646 - $find_comments[$key]['content'] = $comment->comment_content;
647 - $find_comments[$key]['link'] = admin_url('comment.php?action=editcomment&c=' . esc_attr($comment->comment_ID));
648 - }
649 -
650 - return $find_comments;
651 - }
652 -
653 - /**
654 - * Search Users
655 - */
656 - public function filter_all_users($all_users, $search_text)
657 - {
658 - $find_users = [];
659 -
660 - foreach ($all_users as $key => $user) {
661 - if (str_contains(strtolower($user->data->user_login), strtolower($search_text)) || str_contains(strtolower($user->data->display_name), strtolower($search_text))) {
662 - $find_users[$key]['name'] = $user->data->user_login;
663 - $find_users[$key]['display_name'] = $user->data->display_name;
664 - $find_users[$key]['link'] = admin_url('user-edit.php?user_id=' . $user->ID);
665 - }
666 - }
667 -
668 - return $find_users;
669 - }
670 -
671 - /**
672 - * Search Plugins
673 - */
674 - public function filter_all_plugins($all_plugins, $search_text)
675 - {
676 - $find_plugins = [];
677 -
678 - foreach ($all_plugins as $key => $plugin) {
679 - if (strpos(strtolower($plugin['Name']), strtolower($search_text)) === false) {
680 - continue;
681 - }
682 -
683 - $find_plugins[] = [
684 - 'name' => $plugin['Name'],
685 - 'link' => admin_url('plugins.php')
686 - ];
687 - }
688 -
689 - return $find_plugins;
690 - }
691 -
692 - // Admin Bar Body Class
693 - public function admin_bar_body_class($classes)
694 - {
695 - if (is_admin()) {
696 - $classes .= ' wp-adminify-admin-bar';
697 -
698 - $admin_bar_position = !empty($this->options['admin_bar_position']) ? $this->options['admin_bar_position'] : 'top';
699 - if ($admin_bar_position === 'top') {
700 - $classes .= ' position-top';
701 - } elseif ($admin_bar_position === 'bottom') {
702 - $classes .= ' position-bottom';
703 - }
704 -
705 - if (!empty($this->options['enable_admin_bar'])) {
706 - $classes .= ' topbar-disabled';
707 - }
708 - } else {
709 - global $pagenow;
710 -
711 - if (!is_user_logged_in() && $pagenow != 'wp-login.php') {
712 - return $classes;
713 - }
714 -
715 - $classes[] = 'wp-adminify-admin-bar';
716 -
717 - $admin_bar_position = !empty($this->options['admin_bar_position']) ? $this->options['admin_bar_position'] : 'top';
718 - if ($admin_bar_position === 'top') {
719 - $classes[] = 'admin-bar-position-top';
720 - } elseif ($admin_bar_position === 'bottom') {
721 - $classes[] = 'admin-bar-position-bottom';
722 - }
723 -
724 - if (!empty($this->options['enable_admin_bar'])) {
725 - $classes[] = 'topbar-disabled';
726 - }
727 - }
728 -
729 - return $classes;
730 - }
731 -
732 - public function get_post_types()
733 - {
734 - if (is_array($this->post_types)) {
735 - return $this->post_types;
736 - } else {
737 - $args = ['public' => true];
738 - $output = 'objects';
739 - $post_types = get_post_types($args, $output);
740 - $this->post_types = $post_types;
741 - return $post_types;
742 - }
743 - }
744 -
745 - public function legacy_admin_bar_positon()
746 - {
747 - if (!empty($this->options['admin_bar_position']) && $this->options['admin_bar_position'] == 'bottom') {
748 -
749 - $pxlbsadminify_thirdparty_css = '';
750 - $pxlbsadminify_thirdparty_css .= 'body.wp-adminify.position-bottom {
751 - margin-top: -28px;
752 - padding-bottom: 28px;
753 - }
754 -
755 - body.wp-adminify.position-bottom.admin-bar #wphead {
756 - padding-top: 0;
757 - }
758 -
759 - body.wp-adminify.position-bottom.admin-bar #footer {
760 - padding-bottom: 28px;
761 - }
762 -
763 - body.wp-adminify.position-bottom #wpadminbar {
764 - top: auto !important;
765 - bottom: 0;
766 - }
767 -
768 - body.wp-adminify.position-bottom #wpadminbar .quicklinks .ab-top-menu .menupop .ab-sub-wrapper {
769 - bottom: 32px;
770 - }
771 -
772 - body.wp-adminify.position-bottom #wpadminbar .quicklinks .ab-top-menu .menupop .ab-sub-wrapper .ab-submenu .menupop .ab-sub-wrapper {
773 - bottom: -9px;
774 - }';
775 - echo '<style>' . esc_html(wp_strip_all_tags($pxlbsadminify_thirdparty_css)) . '</style>';
776 - }
777 - }
778 -
779 - public function add_admin_bar()
780 - {
781 - // For Testing Admin Bar on Setup Wizard
782 - // add_action('admin_head', [$this, 'render_admin_bar']);
783 -
784 - add_action('in_admin_header', [$this, 'render_admin_bar'], -999999999);
785 - // on frontend area
786 - add_action('wp_head', [$this, 'render_admin_bar']);
787 - }
788 -
789 -
790 - public function render_admin_bar()
791 - {
792 -
793 - global $pagenow;
794 - if (!is_user_logged_in() && $pagenow != 'wp-login.php') {
795 - return;
796 - }
797 -
798 - // Check Gutenberg Editor Page
799 - // if (Utils::is_block_editor_page()) {
800 - // return;
801 - // }
802 -
803 - // if (!is_admin_bar_showing()) {
804 - // return false;
805 - // }
806 -
807 - // Remove Adminbar from Gutenberg Block Editor Page
808 - // if (function_exists('is_gutenberg_page') && is_gutenberg_page()) {
809 - // // The Gutenberg plugin is on.
810 - // return;
811 - // }
812 - // if (function_exists('get_current_screen')) {
813 - // $current_screen = get_current_screen();
814 - // if (!empty($current_screen->is_block_editor)) {
815 - // return;
816 - // }
817 - // }
818 -
819 - global $wp_admin_bar;
820 -
821 - if (empty($wp_admin_bar)) {
822 - return false;
823 - }
824 -
825 - $admin_bar_mode = empty($admin_bar_mode['light_dark_mode']['admin_ui_mode']) ? 'light' : $admin_bar_mode['light_dark_mode']['admin_ui_mode'];
826 -
827 - // Light/Dark Mode
828 - $enable_dark_mode = $admin_bar_mode != 'light';
829 -
830 - // Screen Option && Hide WP Links
831 - $enable_screen_tab = Utils::get_user_preference('screen_options_tab');
832 - $enable_help_tab = Utils::get_user_preference('adminify_help_tab');
833 - // $enable_hide_wp_links = Utils::get_user_preference( 'hide_wp_links' );
834 -
835 - // Admin Bar Position
836 - if (!empty($this->options['admin_bar_position']) && $this->options['admin_bar_position'] === 'top') {
837 - $admin_bar_position = 'top_bar';
838 - } elseif (!empty($this->options['admin_bar_position']) && $this->options['admin_bar_position'] === 'bottom') {
839 - $admin_bar_position = 'bottom_bar is-fixed-bottom';
840 - } else {
841 - $admin_bar_position = 'top_bar';
842 - }
843 -
844 - $current_user = wp_get_current_user();
845 -
846 - ob_start();
847 -
848 - // Temporarily removing Topbar
849 - // <div class="wp-adminify-topbar-loader"></div>
850 -
851 - // 17-7-23, removed opacity for Conflicting Opacity Issue
852 - // <div class="wp-adminify adminify-top_bar" style="opacity: 0;">
853 - ?>
854 -
855 -
856 -
857 - <div class="wp-adminify adminify-top_bar">
858 - <nav class="navbar adminify-top-navbar <?php echo esc_attr($admin_bar_position); ?>">
859 -
860 - <?php $this->logo(); ?>
861 - <div class="adminify-admin-wrapper">
862 - <div class="adminify-legacy-admin">
863 - <div class="adminify-hamburger navbar-burger" data-target="wp-adminify-top-adminbar">
864 - <svg width="11" height="8" viewBox="0 0 11 8" fill="none" xmlns="http://www.w3.org/2000/svg">
865 - <path d="M7 0H0V1H7V0Z" fill="#48455F" />
866 - <path d="M7 7H0V8H7V7Z" fill="#48455F" />
867 - <path d="M4.67 3.5H0V4.5H4.67V3.5Z" fill="#48455F" />
868 - <path d="M9.65 7.35L6.29 4L9.65 0.65L10.35 1.35L7.71 4L10.35 6.65L9.65 7.35Z" fill="#48455F" />
869 - </svg>
870 - </div>
871 - <?php wp_admin_bar_render(); ?>
872 - </div>
873 -
874 - <div id="wp-adminify-top-adminbar" class="navbar-menu">
875 -
876 - <div class="navbar-end">
877 - <div class="field is-grouped">
878 -
879 - <?php echo wp_kses_post($this->dark_mode_switcher_dom()) ?>
880 -
881 - <?php if (!empty($this->options['admin_bar_notif'])) { ?>
882 - <div class="wp-adminify--top--comment">
883 - <button class="comment-trigger is-clickable">
884 - <div class="topbar-icon">
885 - <svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
886 - <path d="M0.25 13.75V1.75C0.25 0.921573 0.921572 0.25 1.75 0.25H12.25C13.0784 0.25 13.75 0.921573 13.75 1.75V9.25C13.75 10.0784 13.0784 10.75 12.25 10.75H4.75C4.42535 10.7494 4.10936 10.8547 3.85 11.05L0.25 13.75ZM1.75 1.75V10.75L3.3505 9.55C3.60973 9.35448 3.9258 9.24913 4.2505 9.25H12.25V1.75H1.75Z" fill="var(--adminify-menu-text-color)" />
887 - </svg>
888 - </div>
889 - <span class="comment-counter">
890 - <?php
891 - $comments_count = wp_count_comments();
892 - echo esc_html($comments_count->moderated);
893 - ?>
894 - </span>
895 - </button>
896 - </div>
897 -
898 - <?php
899 - }
900 - ?>
901 -
902 - <div class="wp-adminify--preview">
903 - <a class="preview-trigger is-clickable" href="<?php echo esc_url(get_home_url()); ?>" target="_blank">
904 - <i class="dashicons dashicons-visibility"></i>
905 - </a>
906 - </div>
907 -
908 - <div class="wp-adminify--user--account">
909 - <button class="user-avatar is-clickable">
910 - <div class="image is-45x45">
911 - <?php echo get_avatar($current_user->user_email, 45, '', '', ['class' => 'is-rounded']); ?>
912 - </div>
913 - <span class="user-status tag p-0 is-rounded"></span>
914 - </button>
915 -
916 - <?php if (!empty($this->adminify_ui)) { ?>
917 - <div class="wp-adminify--user--wrapper">
918 - <div class="wp-adminify-user-info">
919 - <h3 class="wp-adminify-user-name">
920 - <?php echo esc_html($current_user->display_name); ?>
921 - </h3>
922 - <span><?php echo wp_kses_post(is_email($current_user->user_email)); ?></span>
923 -
924 - <ul>
925 - <hr>
926 - <li>
927 - <a href="<?php echo esc_url(admin_url('profile.php')); ?>">
928 - <svg class="wp-adminify-profile-icon" width="16" height="18" viewBox="0 0 16 18" fill="none" xmlns="http://www.w3.org/2000/svg">
929 - <path d="M14.6654 16.5C14.6654 15.337 14.6654 14.7555 14.5218 14.2824C14.1987 13.217 13.365 12.3834 12.2996 12.0602C11.8265 11.9167 11.245 11.9167 10.082 11.9167H5.91537C4.7524 11.9167 4.17091 11.9167 3.69775 12.0602C2.63241 12.3834 1.79873 13.217 1.47556 14.2824C1.33203 14.7555 1.33203 15.337 1.33203 16.5M11.7487 5.25C11.7487 7.32107 10.0698 9 7.9987 9C5.92763 9 4.2487 7.32107 4.2487 5.25C4.2487 3.17893 5.92763 1.5 7.9987 1.5C10.0698 1.5 11.7487 3.17893 11.7487 5.25Z" stroke="var(--adminify-primary)" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>
930 - </svg>
931 - <span><?php esc_html_e('View Profile', 'adminify'); ?></span>
932 - </a>
933 - </li>
934 - <hr>
935 - <li>
936 - <a href="<?php echo esc_url(wp_logout_url(home_url())); ?>" class="wp-adminify-logout">
937 - <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
938 - <path fill-rule="evenodd" clip-rule="evenodd" d="M5.7587 4.31292e-07L7 9.08129e-07C7.55229 9.08129e-07 8 0.447716 8 1C8 1.55229 7.55229 2 7 2H5.8C4.94342 2 4.36113 2.00078 3.91104 2.03755C3.47262 2.07337 3.24842 2.1383 3.09202 2.21799C2.7157 2.40973 2.40974 2.7157 2.21799 3.09202C2.1383 3.24842 2.07337 3.47262 2.03755 3.91104C2.00078 4.36113 2 4.94342 2 5.8V14.2C2 15.0566 2.00078 15.6389 2.03755 16.089C2.07337 16.5274 2.1383 16.7516 2.21799 16.908C2.40973 17.2843 2.7157 17.5903 3.09202 17.782C3.24842 17.8617 3.47262 17.9266 3.91104 17.9624C4.36113 17.9992 4.94342 18 5.8 18H7C7.55229 18 8 18.4477 8 19C8 19.5523 7.55229 20 7 20H5.75868C4.95372 20 4.28937 20 3.74818 19.9558C3.18608 19.9099 2.66937 19.8113 2.18404 19.564C1.43139 19.1805 0.819468 18.5686 0.435975 17.816C0.188684 17.3306 0.0901197 16.8139 0.0441946 16.2518C-2.28137e-05 15.7106 -1.23241e-05 15.0463 4.31291e-07 14.2413V5.7587C-1.23241e-05 4.95373 -2.28137e-05 4.28937 0.0441947 3.74817C0.09012 3.18608 0.188685 2.66937 0.435976 2.18404C0.81947 1.43139 1.43139 0.819468 2.18404 0.435975C2.66938 0.188684 3.18608 0.0901197 3.74818 0.0441945C4.28937 -2.28137e-05 4.95373 -1.23241e-05 5.7587 4.31292e-07ZM13.2929 4.29289C13.6834 3.90237 14.3166 3.90237 14.7071 4.29289L19.7071 9.29289C20.0976 9.68342 20.0976 10.3166 19.7071 10.7071L14.7071 15.7071C14.3166 16.0976 13.6834 16.0976 13.2929 15.7071C12.9024 15.3166 12.9024 14.6834 13.2929 14.2929L16.5858 11H7C6.44772 11 6 10.5523 6 10C6 9.44772 6.44772 9 7 9H16.5858L13.2929 5.70711C12.9024 5.31658 12.9024 4.68342 13.2929 4.29289Z" fill="var(--adminify-primary)"></path>
939 - </svg>
940 - <span><?php echo esc_html__('Log Out', 'adminify'); ?></span>
941 - </a>
942 - </li>
943 - </ul>
944 - </div>
945 - </div>
946 - <?php } ?>
947 - </div>
948 - </div>
949 - </div>
950 - </div>
951 - </div>
952 - </nav>
953 - </div>
954 -
955 - <?php
956 - $output_wp_admin_bar = ob_get_clean();
957 - echo wp_kses( $output_wp_admin_bar, Utils::kses_allowed_html() );
958 - }
959 -
960 - public function logo()
961 - {
962 - global $wp_admin_bar;
963 - $adminurl = get_admin_url();
964 - $homeurl = $adminurl;
965 -
966 - // Light Logo
967 - // menu_layout_settings.layout_type / .menu_mode were read here
968 - // previously but the resulting locals were never used
969 - // downstream. Removed because layout_type === 'horizontal' is
970 - // a Pro-only feature whose handler now lives in
971 - // Pro/Classes/OutputCSS_Body_Pro.php.
972 - $admin_ui_logo_type = !empty($this->options['light_dark_mode']['admin_ui_logo_type']) ? $this->options['light_dark_mode']['admin_ui_logo_type'] : 'image_logo';
973 -
974 - $light_mode = !empty($this->options['light_dark_mode']['admin_ui_light_mode']) ? $this->options['light_dark_mode']['admin_ui_light_mode'] : '';
975 -
976 - $light_logo = '';
977 - $light_mini_logo = '';
978 - if ($admin_ui_logo_type == 'image_logo') {
979 - if (isset($light_mode['mini_admin_ui_light_logo']['url']) && $light_mode['mini_admin_ui_light_logo']['url']) {
980 - $light_mini_logo = $light_mode['mini_admin_ui_light_logo']['url'];
981 - } else {
982 - $light_mini_logo = PXLBSADMINIFY_ASSETS_IMAGE . 'logos/mini-logo-light.svg';
983 - }
984 -
985 - // Logo Image
986 - if (!empty($light_mode['admin_ui_light_logo']['url'])) {
987 - $light_logo = $light_mode['admin_ui_light_logo']['url'];
988 - } else {
989 - $light_logo = PXLBSADMINIFY_ASSETS_IMAGE . 'logos/logo-text-light.svg';
990 - }
991 - } elseif ($admin_ui_logo_type == 'text_logo') {
992 - // Text Logo
993 - if ($this->options['light_dark_mode']['admin_ui_mode'] == 'light') {
994 - $text_logo = $light_mode['admin_ui_light_logo_text'];
995 - }
996 - }
997 -
998 - // Logo Size
999 - $light_width = !empty($light_mode['light_logo_size']['width']) ? $light_mode['light_logo_size']['width'] : '120';
1000 - $light_height = !empty($light_mode['light_logo_size']['height']) ? $light_mode['light_logo_size']['height'] : '32';
1001 -
1002 - // Dark Logo
1003 - $dark_mode = !empty($this->options['light_dark_mode']['admin_ui_dark_mode']) ? $this->options['light_dark_mode']['admin_ui_dark_mode'] : '';
1004 -
1005 - $dark_logo = '';
1006 - $dark_mini_logo = '';
1007 - if ($admin_ui_logo_type == 'image_logo') {
1008 - if (isset($dark_mode['mini_admin_ui_dark_logo']['url']) && $dark_mode['mini_admin_ui_dark_logo']['url']) {
1009 - $dark_mini_logo = $dark_mode['mini_admin_ui_dark_logo']['url'];
1010 - } else {
1011 - $dark_mini_logo = PXLBSADMINIFY_ASSETS_IMAGE . 'logos/mini-logo-dark.svg';
1012 - }
1013 - // Dark Logo Image
1014 - if (isset($dark_mode['admin_ui_dark_logo']['url']) && $dark_mode['admin_ui_dark_logo']['url']) {
1015 - $dark_logo = $dark_mode['admin_ui_dark_logo']['url'];
1016 - } else {
1017 - $dark_logo = PXLBSADMINIFY_ASSETS_IMAGE . 'logos/logo-text-dark.svg';
1018 - }
1019 - } elseif ($admin_ui_logo_type == 'text_logo') {
1020 - // Text Logo
1021 - if ($this->options['light_dark_mode']['admin_ui_mode'] == 'dark') {
1022 - $text_logo = $dark_mode['admin_ui_dark_logo_text'];
1023 - }
1024 - }
1025 -
1026 - // Dark Logo Size
1027 - $dark_width = !empty($dark_mode['dark_logo_size']['width']) ? $dark_mode['dark_logo_size']['width'] : '120';
1028 - $dark_height = !empty($dark_mode['dark_logo_size']['height']) ? $dark_mode['dark_logo_size']['height'] : '32';
1029 -
1030 - ?>
1031 -
1032 - <div class="navbar-brand">
1033 - <a class="navbar-item p-0" href="<?php echo esc_url($homeurl); ?>">
1034 - <?php if ($admin_ui_logo_type == 'image_logo') { ?>
1035 - <!-- Light Logo -->
1036 - <img alt="<?php echo esc_attr(get_bloginfo('name')); ?>" class="logo-light" src="<?php echo esc_url($light_logo); ?>" width="<?php echo esc_attr($light_width); ?>" height="<?php echo esc_attr($light_height); ?>">
1037 - <img alt="<?php echo esc_attr(get_bloginfo('name')); ?>" class="mini-logo-light" src="<?php echo esc_url($light_mini_logo); ?>" width="36" height="36">
1038 - <!-- Dark Logo -->
1039 - <img alt="<?php echo esc_attr(get_bloginfo('name')); ?>" class="logo-dark" src="<?php echo esc_url($dark_logo); ?>" width="<?php echo esc_attr($dark_width); ?>" height="<?php echo esc_attr($dark_height); ?>">
1040 - <img alt="<?php echo esc_attr(get_bloginfo('name')); ?>" class="mini-logo-dark" src="<?php echo esc_url($dark_mini_logo); ?>" width="36" height="36">
1041 - <?php } elseif ($admin_ui_logo_type == 'text_logo') { ?>
1042 - <span class="wp-adminify-site-name">
1043 - <?php echo esc_html($text_logo); ?>
1044 - </span>
1045 - <?php } ?>
1046 - </a>
1047 -
1048 - <!-- <div class="navbar-burger" data-target="wp-adminify-top-adminbar">
1049 - <img src="<?php // echo PXLBSADMINIFY_ASSETS_IMAGE . 'icons/toggol.svg';
1050 - ?>" alt="Toggol icon"/>
1051 - </div> -->
1052 -
1053 - </div>
1054 -
1055 -<?php
1056 - }
1057 -
1058 -
1059 - /* Remove from the administration bar */
1060 - public function remove_admin_bar_menus()
1061 - {
1062 - global $wp_admin_bar;
1063 - $wp_admin_bar->remove_menu('wp-logo');
1064 - $wp_admin_bar->remove_menu('site-name');
1065 - $wp_admin_bar->remove_menu('updates');
1066 - $wp_admin_bar->remove_menu('menu-toggle');
1067 - }
1068 -}
1255 +}