PluginProbe
Adminify – White Label, Admin Menu Editor, Login Customizer / 4.2.24
Adminify – White Label, Admin Menu Editor, Login Customizer v4.2.24
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 4.1.17 All 164 releases
adminify / Inc / Classes / AdminBar.php

AdminBar.php in Adminify – White Label, Admin Menu Editor, Login Customizer 4.2.24, at Inc/Classes/AdminBar.php

991 lines 38.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace PXLBSAdminify\Inc\Classes;
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
10 // no direct access allowed
11 if (!defined('ABSPATH')) {
12 exit;
13 }
14 class AdminBar extends AdminSettingsModel
15 {
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 // Switcher for Default UI
61 if (empty($this->adminify_ui)) {
62 if (!empty($this->options['admin_bar_dark_light_btn'])) {
63 add_action('admin_bar_menu', [$this, 'dark_mode_switcher_icon']);
64 }
65 }
66 }
67 }
68
69
70 // Add Switcher Icon on Admin Bar Secondary
71 public function dark_mode_switcher_icon($wp_admin_bar)
72 {
73 $args = [
74 'parent' => 'top-secondary',
75 'id' => 'wp-adminify-admin-bar-switcher',
76 'title' => $this->dark_mode_switcher_dom(),
77 'meta' => false
78 ];
79
80 $wp_admin_bar->add_node($args);
81 }
82
83 public function dark_mode_switcher_dom()
84 {
85 $global_color_mode = !empty($this->options['light_dark_mode']['admin_ui_mode']) ? $this->options['light_dark_mode']['admin_ui_mode'] : 'light';
86 $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);
87
88 $color_var = !empty($this->adminify_ui) ? 'var(--adminify-menu-text-color)' : '#fff';
89
90 $adminbar_switcher_icon = '<div id="wp-adminify-color-mode-wrapper">
91 <div class="mode-icon adminify-color-mode-' . esc_attr($color_mode) . '-active">
92 <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>
93 <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>
94 <svg width="16" height="16" viewBox="0 0 22 18" fill="none" xmlns="http://www.w3.org/2000/svg" class="systemIcon">
95 <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"/>
96 </svg>
97 </div>
98 <div class="light-dark-dropdown">
99 <div class="light">
100 <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>
101 <span>Light</span>
102 </div>
103 <div class="dark">
104 <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>
105 <span>Dark</span>
106 </div>
107 <div class="system">
108 <svg width="16" height="16" viewBox="0 0 22 18" fill="none" xmlns="http://www.w3.org/2000/svg" class="systemIcon">
109 <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"/>
110 </svg>
111 <span>System</span>
112 </div>
113 </div>
114 </div>';
115
116 return $adminbar_switcher_icon;
117 }
118
119
120
121 public function initialize()
122 {
123 $admin_bar_position = (!empty($this->options['admin_bar_position'])) ? $this->options['admin_bar_position'] : 'top';
124
125 if (is_admin()) {
126 if ($admin_bar_position == 'top' || $admin_bar_position == 'bottom') {
127 if (!empty($this->adminify_ui)) {
128 //TODO: not need to adminify ui. alternative use iframe topbar
129 // add_action('admin_init', [$this, 'add_admin_bar']);
130 // } else {
131 add_action('admin_head', [$this, 'legacy_admin_bar_positon']);
132 }
133 }
134 add_action('admin_enqueue_scripts', [$this, 'admin_scripts'], 100);
135
136 // Remove Unnecessary Menus from Admin bar
137 // add_action('wp_before_admin_bar_render', [$this, 'remove_admin_bar_menus'], 0);
138
139 // add_filter('admin_body_class', [$this, 'admin_bar_body_class']);
140 // add_action('admin_head', [$this, 'admin_bar_css'], 999);
141
142 add_action('wp_ajax_pxlbsadminify_all_search', [$this, 'all_search']);
143 add_action('wp_ajax_pxlbsadminify_color_mode', [$this, 'color_mode']);
144
145
146 // Screen Option and Help Tab
147 add_action('admin_head', [$this, 'remove_screen_options'], 10, 3);
148 add_action('admin_head', [$this, 'remove_help_tab']);
149 } else {
150 // Admin bar Frontend settings
151 $frontend_admin = (!empty($this->options['admin_bar_hide_frontend'])) ? $this->options['admin_bar_hide_frontend'] : 'show';
152
153 // if (jltwp_adminify()->can_use_premium_code__premium_only()) {
154 // if ($frontend_admin == 'show') {
155 // $frontend_admin_roles = (!empty($this->options['admin_bar_hide_frontend_user_roles'])) ? $this->options['admin_bar_hide_frontend_user_roles'] : [];
156 // if (Utils::restricted_for($frontend_admin_roles)) {
157 // $frontend_admin = 'hide';
158 // }
159 // }
160 // }
161 $this->front_bar();
162
163 if ($admin_bar_position == 'bottom') {
164 add_action('init', [$this, 'admin_bar_front_style_init']);
165 }
166
167 if ($frontend_admin == 'hide') {
168 add_filter('show_admin_bar', '__return_false');
169 }
170 }
171 }
172
173 public function before_secondary_menu()
174 {
175 ?>
176 <div class="wp-adminify-top-header--search--form">
177 <form class="top-header--search--form" action="$">
178 <span class="adminify-search-expand"><i class="icon-magnifier icons"></i></span>
179 <input id="top-header-search-input" class="top-header-search-input" type="search" placeholder="Search here">
180 </form>
181
182 <div id="top-header-search-results" class=" top-header-search-results" style="display: none;">
183 <div class="top-header-results-wrapper">
184 </div>
185 </div>
186 </div>
187 <?php
188 }
189
190 public function load_wp_admin_bar_class()
191 {
192 return 'PXLBSAdminify\Inc\Classes\Adminify_Admin_Bar';
193 }
194
195 public function front_bar()
196 {
197 add_action('admin_init', [$this, 'add_admin_bar']);
198 add_filter('body_class', [$this, 'admin_bar_body_class']);
199 }
200
201 public function admin_bar_front_style_init()
202 {
203 add_filter('wp_enqueue_scripts', [$this, 'admin_bar_front_style']);
204 }
205
206 // Frontend Admin bar style
207 public function admin_bar_front_style()
208 {
209 $admin_bar_css = '';
210 $admin_bar_css .= '.admin-bar-position-bottom #wpadminbar{
211 top:auto;
212 bottom: 0;
213 }
214 .admin-bar-position-bottom #wpadminbar .menupop .ab-sub-wrapper{
215 bottom: 32px;
216 }
217 @media all and (max-width:600px){
218 body.logged-in.admin-bar-position-bottom {
219 position: relative;
220 }
221 }';
222 wp_add_inline_style('admin-bar', $admin_bar_css);
223 }
224
225 // Remove Screen Options
226 public function remove_screen_options()
227 {
228 $enable_screen_tab = Utils::get_user_preference('screen_options_tab');
229 if ($enable_screen_tab) {
230 add_filter('screen_options_show_screen', '__return_false');
231 }
232 }
233
234 // Contextual Help Tab Remove
235 public function remove_help_tab()
236 {
237 $enable_screen_tab = Utils::get_user_preference('adminify_help_tab');
238 if ($enable_screen_tab) {
239 $screen = get_current_screen();
240 $screen->remove_help_tabs();
241 }
242 }
243
244 // Get All registered WP Admin Menus
245 public static function get_wp_admin_menus($thismenu, $thissubmenu)
246 {
247 $options = [];
248
249 if (!empty($thismenu) && is_array($thismenu)) {
250 foreach ($thismenu as $item) {
251 if (!empty($item[0])) {
252 // the preg_replace removes "Comments" & "Plugins" menu spans.
253 $options[$item[2]] = (preg_replace('/\<span.*?>.*?\<\/span><\/span>/s', '', $item[0]));
254 }
255 }
256 }
257
258 if (!empty($thissubmenu) && is_array($thissubmenu)) {
259 foreach ($thissubmenu as $items) {
260 foreach ($items as $item) {
261 if (!empty($item[0])) {
262 $options[$item[1]] = (preg_replace('/\<span.*?>.*?\<\/span><\/span>/s', '', $item[0]));
263 }
264 }
265 }
266 }
267
268 return $options;
269 }
270
271 public function admin_scripts()
272 {
273 global $pagenow;
274 if ($pagenow == 'wp-login.php' || $pagenow == 'wp-register.php' || $pagenow == 'customize.php') {
275 return;
276 }
277
278 // Commented on: 9-6-24
279 if (!empty($this->adminify_ui)) {
280 wp_enqueue_style('wp-adminify-admin-bar');
281 $this->admin_topbar_loader_css();
282 }
283 wp_localize_script('adminify-admin', 'PXLBSADMINIFY_ADMINBAR', $this->create_admin_bar_js_object());
284 }
285
286
287 public function create_admin_bar_js_object()
288 {
289 return [
290 'ajax_url' => admin_url('admin-ajax.php'),
291 'security_nonce' => wp_create_nonce('pxlbsadminify_frame_nonce'),
292 'notice_nonce' => wp_create_nonce('pxlbsadminify-notice-nonce'),
293 ];
294 }
295
296 /**
297 * Preloader
298 *
299 * @return void
300 */
301 public function admin_topbar_loader_css()
302 {
303 $output_css = '';
304 $topbar_wireframe_img = PXLBSADMINIFY_ASSETS_IMAGE . 'topbar-wireframe.svg';
305 $output_css .= '.js .wp-adminify-topbar-loader{background: url(' . esc_url($topbar_wireframe_img) . '); }';
306
307 // Use wp_add_inline_style instead of echo to prevent "headers already sent" errors
308 wp_add_inline_style( 'wp-adminify-admin-bar', wp_strip_all_tags($output_css) );
309
310 $screen = get_current_screen(); // Get current screen details
311
312 if (isset($screen->base) && $screen->base === 'post') {
313 $inline_script = "window.addEventListener('load', function() {
314 const isFullscreenMode = wp.data.select('core/edit-post').isFeatureActive('fullscreenMode');
315 if (isFullscreenMode) {
316 jQuery('.adminify-top_bar').css({
317 'display': 'none !important'
318 });
319 }
320 });";
321 wp_add_inline_script( 'adminify-admin', $inline_script );
322 }
323 }
324
325 /**
326 * Save Color Mode by Ajax
327 *
328 * @return void
329 */
330 public function color_mode()
331 {
332 if (defined('DOING_AJAX') && DOING_AJAX) {
333 // Both callers (classic admin bar wp-adminify.js and the React frame
334 // dropdown dev/admin/frame/utils/uitls.js) post the
335 // pxlbsadminify_frame_nonce nonce.
336 if ( check_ajax_referer('pxlbsadminify_frame_nonce', 'security', false) <= 0 ) {
337 wp_send_json_error( array( 'mess' => __( 'Invalid request.', 'adminify' ) ), 403 );
338 }
339 // Color mode is per-user preference; require the caller to be
340 // a logged-in user with admin-bar access.
341 if ( ! is_user_logged_in() || ! current_user_can( 'read' ) ) {
342 wp_send_json_error( array( 'mess' => __( 'You are not allowed to perform this action.', 'adminify' ) ), 403 );
343 }
344 $admin_bar_mode = AdminSettings::get_instance()->get();
345
346 if (!empty($_POST['key'])) {
347 $key = sanitize_key($_POST['key']);
348 $value = isset($_POST['value']) ? Utils::clean_ajax_input(wp_unslash($_POST['value'])) : ''; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- sanitized via Utils::clean_ajax_input().
349
350 if ($key == '') {
351 $message = __('No Color Mode supplied to save', 'adminify');
352 echo wp_json_encode( array( 'error' => true, 'error_message' => $message ) );
353 die();
354 }
355 }
356
357 // Light/Dark Mode
358 if ($key === 'color_mode') {
359 // For User preference
360 $userid = get_current_user_id();
361 $current = get_user_meta($userid, $key, true);
362 if($current !== $value) {
363 $state = update_user_meta($userid, $key, $value);
364 }
365 die();
366 }
367
368 // Screen Options, Help Tabs and WP Hide Links
369 if ($key === 'screen_options_tab' || $key === 'hide_wp_links' || $key === 'adminify_help_tab') {
370 $userid = get_current_user_id();
371 $current = get_user_meta($userid, 'pxlbsadminify_preferences', true);
372
373 if (is_array($current)) {
374 $current[$key] = $value;
375 } else {
376 $current = [];
377 $current[$key] = $value;
378 }
379
380 $state = update_user_meta($userid, 'pxlbsadminify_preferences', $current);
381
382 if ($state) {
383 $returndata = [];
384 $returndata['success'] = true;
385 $returndata['message'] = __('Preferences saved', 'adminify');
386 echo wp_json_encode($returndata);
387 } else {
388 $message = __('Unable to save user preferences', 'adminify');
389 echo wp_json_encode( array( 'error' => true, 'error_message' => $message ) );
390 die();
391 }
392 }
393 }
394 }
395
396 /**
397 * Search Everything
398 *
399 * @return void
400 */
401 public function all_search()
402 {
403 if (defined('DOING_AJAX') && DOING_AJAX) {
404 // Both the classic admin bar and the React frame search (SearchForm.jsx)
405 // post the pxlbsadminify_frame_nonce nonce.
406 if ( check_ajax_referer('pxlbsadminify_frame_nonce', 'security', false) <= 0 ) {
407 wp_send_json_error( array( 'message' => __( 'Invalid request.', 'adminify' ) ), 403 );
408 }
409 // Security check - only users who can edit posts should access admin search
410 if (!current_user_can('edit_posts')) {
411 wp_send_json_error(array('message' => __('You do not have permission to perform this action.', 'adminify')));
412 }
413
414 $search_text = '';
415 if (!empty($_POST['search'])) {
416 $search_text = sanitize_text_field(wp_unslash($_POST['search']));
417 }
418
419 // Error Handling For Minimum 3 Char
420 if (strlen($search_text) < 3) {
421 wp_send_json_success(
422 [
423 'message' => 'Please Enter Minimum 3 Characters'
424 ]
425 );
426 }
427
428
429 // Search Arguments
430 $args = [
431 'numberposts' => -1,
432 's' => $search_text,
433 'post_status' => ['publish', 'pending', 'draft', 'future', 'private', 'inherit'],
434 // Restrict non-public statuses (private/draft/pending/future) to posts the
435 // current user is allowed to read. Without this, any role holding edit_posts
436 // (e.g. Contributor) could read other authors' unpublished post titles.
437 'perm' => 'readable',
438 ];
439
440 // All Post Types
441 $post_types = $this->get_post_types();
442 foreach ($post_types as $type) {
443 $args['post_type'][] = $type->name;
444 }
445
446 // All Categories/Taxonomies
447 $all_taxonomies = get_taxonomies();
448
449 // Get Comments — only for users who can moderate them. Otherwise the search
450 // would expose unapproved/pending comment content to roles that cannot see it
451 // in the WordPress admin (e.g. Contributor).
452 $all_comments = current_user_can('moderate_comments') ? get_comments() : [];
453
454 // Get All Users — only for users who can list users. Prevents leaking user
455 // logins/display names to roles without the list_users capability.
456 $all_users = current_user_can('list_users') ? get_users() : [];
457
458 // All Users
459 // $blogusers = get_users();
460 // foreach ($blogusers as $type) {
461 // $name = $type->user_login;
462 // $id = $type->ID;
463 // $args['author__in'][] = $type->ID;
464 // }
465
466 // // All Menus
467 // $all_admin_menus = self::get_wp_admin_menus();
468
469 // All Plugins — only for users who can manage plugins. Prevents leaking the
470 // site's plugin inventory to roles without the activate_plugins capability.
471 $all_plugins = [];
472 if (current_user_can('activate_plugins')) {
473 if (!function_exists('get_plugins')) {
474 require_once ABSPATH . 'wp-admin/includes/plugin.php';
475 }
476 $all_plugins = get_plugins();
477 }
478
479 $foundposts = get_posts($args);
480
481 // $count_items = '';
482 // if (count($foundposts) > 0) {
483 // $count_items .= count($foundposts);
484 // } elseif (count($all_plugins)) {
485 // $count_items .= count($all_plugins);
486 // }
487
488
489
490
491
492 $output_data = [
493 'foundposts' => $this->set_edit_url_foundposts($foundposts),
494 'all_taxonomies' => $this->filter_all_taxonomies($all_taxonomies, $search_text),
495 'all_comments' => $this->filter_all_comments($all_comments, $search_text),
496 'all_users' => $this->filter_all_users($all_users, $search_text),
497 'all_plugins' => $this->filter_all_plugins($all_plugins, $search_text),
498 ];
499
500 wp_send_json_success(
501 [
502 'data' => wp_json_encode($output_data),
503 ]
504 );
505 }
506
507 die();
508 }
509
510 /**
511 * Set URL to All Post
512 */
513 public function set_edit_url_foundposts($foundposts)
514 {
515 $all_posts = [];
516 foreach ($foundposts as $key => $post) {
517 // Defense in depth alongside the query's perm=readable: never surface a post
518 // the current user cannot read (e.g. another author's unpublished content).
519 if (!current_user_can('read_post', $post->ID)) {
520 continue;
521 }
522 $edit_url = get_edit_post_link($post);
523 $all_posts[$key]['title'] = get_the_title($post->ID);
524 $all_posts[$key]['link'] = $edit_url;
525 }
526
527 return $all_posts;
528 }
529
530 /**
531 * Search Taxonomies
532 */
533 public function filter_all_taxonomies($all_taxonomies, $search_text)
534 {
535 $find_taxonomies = [];
536
537 foreach ($all_taxonomies as $tax_name) {
538 $terms = get_terms(
539 [
540 'taxonomy' => $tax_name,
541 'hide_empty' => 1,
542 ]
543 );
544
545 foreach ($terms as $key => $cat) {
546 if (strpos(strtolower($cat->name), strtolower($search_text)) === false) {
547 continue;
548 }
549 $find_taxonomies[$key]['name'] = $cat->name;
550 $find_taxonomies[$key]['link'] = get_edit_term_link($cat);
551 }
552 }
553
554 return $find_taxonomies;
555 }
556
557 /**
558 * Search Comments
559 */
560 public function filter_all_comments($all_comments, $search_text)
561 {
562 $find_comments = [];
563
564 foreach ($all_comments as $key => $comment) {
565 if (strpos(strtolower($comment->comment_content), strtolower($search_text)) === false) {
566 continue;
567 }
568 $find_comments[$key]['content'] = $comment->comment_content;
569 $find_comments[$key]['link'] = admin_url('comment.php?action=editcomment&c=' . esc_attr($comment->comment_ID));
570 }
571
572 return $find_comments;
573 }
574
575 /**
576 * Search Users
577 */
578 public function filter_all_users($all_users, $search_text)
579 {
580 $find_users = [];
581
582 foreach ($all_users as $key => $user) {
583 if (str_contains(strtolower($user->data->user_login), strtolower($search_text)) || str_contains(strtolower($user->data->display_name), strtolower($search_text))) {
584 $find_users[$key]['name'] = $user->data->user_login;
585 $find_users[$key]['display_name'] = $user->data->display_name;
586 $find_users[$key]['link'] = admin_url('user-edit.php?user_id=' . $user->ID);
587 }
588 }
589
590 return $find_users;
591 }
592
593 /**
594 * Search Plugins
595 */
596 public function filter_all_plugins($all_plugins, $search_text)
597 {
598 $find_plugins = [];
599
600 foreach ($all_plugins as $key => $plugin) {
601 if (strpos(strtolower($plugin['Name']), strtolower($search_text)) === false) {
602 continue;
603 }
604
605 $find_plugins[] = [
606 'name' => $plugin['Name'],
607 'link' => admin_url('plugins.php')
608 ];
609 }
610
611 return $find_plugins;
612 }
613
614 // Admin Bar Body Class
615 public function admin_bar_body_class($classes)
616 {
617 if (is_admin()) {
618 $classes .= ' wp-adminify-admin-bar';
619
620 $admin_bar_position = !empty($this->options['admin_bar_position']) ? $this->options['admin_bar_position'] : 'top';
621 if ($admin_bar_position === 'top') {
622 $classes .= ' position-top';
623 } elseif ($admin_bar_position === 'bottom') {
624 $classes .= ' position-bottom';
625 }
626
627 if (!empty($this->options['enable_admin_bar'])) {
628 $classes .= ' topbar-disabled';
629 }
630 } else {
631 global $pagenow;
632
633 if (!is_user_logged_in() && $pagenow != 'wp-login.php') {
634 return $classes;
635 }
636
637 $classes[] = 'wp-adminify-admin-bar';
638
639 $admin_bar_position = !empty($this->options['admin_bar_position']) ? $this->options['admin_bar_position'] : 'top';
640 if ($admin_bar_position === 'top') {
641 $classes[] = 'admin-bar-position-top';
642 } elseif ($admin_bar_position === 'bottom') {
643 $classes[] = 'admin-bar-position-bottom';
644 }
645
646 if (!empty($this->options['enable_admin_bar'])) {
647 $classes[] = 'topbar-disabled';
648 }
649 }
650
651 return $classes;
652 }
653
654 public function get_post_types()
655 {
656 if (is_array($this->post_types)) {
657 return $this->post_types;
658 } else {
659 $args = ['public' => true];
660 $output = 'objects';
661 $post_types = get_post_types($args, $output);
662 $this->post_types = $post_types;
663 return $post_types;
664 }
665 }
666
667 public function legacy_admin_bar_positon()
668 {
669 if (!empty($this->options['admin_bar_position']) && $this->options['admin_bar_position'] == 'bottom') {
670
671 $pxlbsadminify_thirdparty_css = '';
672 $pxlbsadminify_thirdparty_css .= 'body.wp-adminify.position-bottom {
673 margin-top: -28px;
674 padding-bottom: 28px;
675 }
676
677 body.wp-adminify.position-bottom.admin-bar #wphead {
678 padding-top: 0;
679 }
680
681 body.wp-adminify.position-bottom.admin-bar #footer {
682 padding-bottom: 28px;
683 }
684
685 body.wp-adminify.position-bottom #wpadminbar {
686 top: auto !important;
687 bottom: 0;
688 }
689
690 body.wp-adminify.position-bottom #wpadminbar .quicklinks .ab-top-menu .menupop .ab-sub-wrapper {
691 bottom: 32px;
692 }
693
694 body.wp-adminify.position-bottom #wpadminbar .quicklinks .ab-top-menu .menupop .ab-sub-wrapper .ab-submenu .menupop .ab-sub-wrapper {
695 bottom: -9px;
696 }';
697 echo '<style>' . esc_html(wp_strip_all_tags($pxlbsadminify_thirdparty_css)) . '</style>';
698 }
699 }
700
701 public function add_admin_bar()
702 {
703 // For Testing Admin Bar on Setup Wizard
704 // add_action('admin_head', [$this, 'render_admin_bar']);
705
706 add_action('in_admin_header', [$this, 'render_admin_bar'], -999999999);
707 // on frontend area
708 add_action('wp_head', [$this, 'render_admin_bar']);
709 }
710
711
712 public function render_admin_bar()
713 {
714
715 global $pagenow;
716 if (!is_user_logged_in() && $pagenow != 'wp-login.php') {
717 return;
718 }
719
720 // Check Gutenberg Editor Page
721 // if (Utils::is_block_editor_page()) {
722 // return;
723 // }
724
725 // if (!is_admin_bar_showing()) {
726 // return false;
727 // }
728
729 // Remove Adminbar from Gutenberg Block Editor Page
730 // if (function_exists('is_gutenberg_page') && is_gutenberg_page()) {
731 // // The Gutenberg plugin is on.
732 // return;
733 // }
734 // if (function_exists('get_current_screen')) {
735 // $current_screen = get_current_screen();
736 // if (!empty($current_screen->is_block_editor)) {
737 // return;
738 // }
739 // }
740
741 global $wp_admin_bar;
742
743 if (empty($wp_admin_bar)) {
744 return false;
745 }
746
747 $admin_bar_mode = empty($admin_bar_mode['light_dark_mode']['admin_ui_mode']) ? 'light' : $admin_bar_mode['light_dark_mode']['admin_ui_mode'];
748
749 // Light/Dark Mode
750 $enable_dark_mode = $admin_bar_mode != 'light';
751
752 // Screen Option && Hide WP Links
753 $enable_screen_tab = Utils::get_user_preference('screen_options_tab');
754 $enable_help_tab = Utils::get_user_preference('adminify_help_tab');
755 // $enable_hide_wp_links = Utils::get_user_preference( 'hide_wp_links' );
756
757 // Admin Bar Position
758 if (!empty($this->options['admin_bar_position']) && $this->options['admin_bar_position'] === 'top') {
759 $admin_bar_position = 'top_bar';
760 } elseif (!empty($this->options['admin_bar_position']) && $this->options['admin_bar_position'] === 'bottom') {
761 $admin_bar_position = 'bottom_bar is-fixed-bottom';
762 } else {
763 $admin_bar_position = 'top_bar';
764 }
765
766 $current_user = wp_get_current_user();
767
768 ob_start();
769
770 // Temporarily removing Topbar
771 // <div class="wp-adminify-topbar-loader"></div>
772
773 // 17-7-23, removed opacity for Conflicting Opacity Issue
774 // <div class="wp-adminify adminify-top_bar" style="opacity: 0;">
775 ?>
776
777
778
779 <div class="wp-adminify adminify-top_bar">
780 <nav class="navbar adminify-top-navbar <?php echo esc_attr($admin_bar_position); ?>">
781
782 <?php $this->logo(); ?>
783 <div class="adminify-admin-wrapper">
784 <div class="adminify-legacy-admin">
785 <div class="adminify-hamburger navbar-burger" data-target="wp-adminify-top-adminbar">
786 <svg width="11" height="8" viewBox="0 0 11 8" fill="none" xmlns="http://www.w3.org/2000/svg">
787 <path d="M7 0H0V1H7V0Z" fill="#48455F" />
788 <path d="M7 7H0V8H7V7Z" fill="#48455F" />
789 <path d="M4.67 3.5H0V4.5H4.67V3.5Z" fill="#48455F" />
790 <path d="M9.65 7.35L6.29 4L9.65 0.65L10.35 1.35L7.71 4L10.35 6.65L9.65 7.35Z" fill="#48455F" />
791 </svg>
792 </div>
793 <?php wp_admin_bar_render(); ?>
794 </div>
795
796 <div id="wp-adminify-top-adminbar" class="navbar-menu">
797
798 <div class="navbar-end">
799 <div class="field is-grouped">
800
801 <?php echo wp_kses_post($this->dark_mode_switcher_dom()) ?>
802
803 <?php if (!empty($this->options['admin_bar_notif'])) { ?>
804 <div class="wp-adminify--top--comment">
805 <button class="comment-trigger is-clickable">
806 <div class="topbar-icon">
807 <svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
808 <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)" />
809 </svg>
810 </div>
811 <span class="comment-counter">
812 <?php
813 $comments_count = wp_count_comments();
814 echo esc_html($comments_count->moderated);
815 ?>
816 </span>
817 </button>
818 </div>
819
820 <?php
821 }
822 ?>
823
824 <div class="wp-adminify--preview">
825 <a class="preview-trigger is-clickable" href="<?php echo esc_url(get_home_url()); ?>" target="_blank">
826 <i class="dashicons dashicons-visibility"></i>
827 </a>
828 </div>
829
830 <div class="wp-adminify--user--account">
831 <button class="user-avatar is-clickable">
832 <div class="image is-45x45">
833 <?php echo get_avatar($current_user->user_email, 45, '', '', ['class' => 'is-rounded']); ?>
834 </div>
835 <span class="user-status tag p-0 is-rounded"></span>
836 </button>
837
838 <?php if (!empty($this->adminify_ui)) { ?>
839 <div class="wp-adminify--user--wrapper">
840 <div class="wp-adminify-user-info">
841 <h3 class="wp-adminify-user-name">
842 <?php echo esc_html($current_user->display_name); ?>
843 </h3>
844 <span><?php echo wp_kses_post(is_email($current_user->user_email)); ?></span>
845
846 <ul>
847 <hr>
848 <li>
849 <a href="<?php echo esc_url(admin_url('profile.php')); ?>">
850 <svg class="wp-adminify-profile-icon" width="16" height="18" viewBox="0 0 16 18" fill="none" xmlns="http://www.w3.org/2000/svg">
851 <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>
852 </svg>
853 <span><?php esc_html_e('View Profile', 'adminify'); ?></span>
854 </a>
855 </li>
856 <hr>
857 <li>
858 <a href="<?php echo esc_url(wp_logout_url(home_url())); ?>" class="wp-adminify-logout">
859 <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
860 <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>
861 </svg>
862 <span><?php echo esc_html__('Log Out', 'adminify'); ?></span>
863 </a>
864 </li>
865 </ul>
866 </div>
867 </div>
868 <?php } ?>
869 </div>
870 </div>
871 </div>
872 </div>
873 </div>
874 </nav>
875 </div>
876
877 <?php
878 $output_wp_admin_bar = ob_get_clean();
879 echo wp_kses( $output_wp_admin_bar, Utils::kses_allowed_html() );
880 }
881
882 public function logo()
883 {
884 global $wp_admin_bar;
885 $adminurl = get_admin_url();
886 $homeurl = $adminurl;
887
888 // Light Logo
889 // menu_layout_settings.layout_type / .menu_mode were read here
890 // previously but the resulting locals were never used
891 // downstream. Removed because layout_type === 'horizontal' is
892 // a Pro-only feature whose handler now lives in
893 // Pro/Classes/OutputCSS_Body_Pro.php.
894 $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';
895
896 $light_mode = !empty($this->options['light_dark_mode']['admin_ui_light_mode']) ? $this->options['light_dark_mode']['admin_ui_light_mode'] : '';
897
898 $light_logo = '';
899 $light_mini_logo = '';
900 if ($admin_ui_logo_type == 'image_logo') {
901 if (isset($light_mode['mini_admin_ui_light_logo']['url']) && $light_mode['mini_admin_ui_light_logo']['url']) {
902 $light_mini_logo = $light_mode['mini_admin_ui_light_logo']['url'];
903 } else {
904 $light_mini_logo = PXLBSADMINIFY_ASSETS_IMAGE . 'logos/mini-logo-light.svg';
905 }
906
907 // Logo Image
908 if (!empty($light_mode['admin_ui_light_logo']['url'])) {
909 $light_logo = $light_mode['admin_ui_light_logo']['url'];
910 } else {
911 $light_logo = PXLBSADMINIFY_ASSETS_IMAGE . 'logos/logo-text-light.svg';
912 }
913 } elseif ($admin_ui_logo_type == 'text_logo') {
914 // Text Logo
915 if ($this->options['light_dark_mode']['admin_ui_mode'] == 'light') {
916 $text_logo = $light_mode['admin_ui_light_logo_text'];
917 }
918 }
919
920 // Logo Size
921 $light_width = !empty($light_mode['light_logo_size']['width']) ? $light_mode['light_logo_size']['width'] : '120';
922 $light_height = !empty($light_mode['light_logo_size']['height']) ? $light_mode['light_logo_size']['height'] : '32';
923
924 // Dark Logo
925 $dark_mode = !empty($this->options['light_dark_mode']['admin_ui_dark_mode']) ? $this->options['light_dark_mode']['admin_ui_dark_mode'] : '';
926
927 $dark_logo = '';
928 $dark_mini_logo = '';
929 if ($admin_ui_logo_type == 'image_logo') {
930 if (isset($dark_mode['mini_admin_ui_dark_logo']['url']) && $dark_mode['mini_admin_ui_dark_logo']['url']) {
931 $dark_mini_logo = $dark_mode['mini_admin_ui_dark_logo']['url'];
932 } else {
933 $dark_mini_logo = PXLBSADMINIFY_ASSETS_IMAGE . 'logos/mini-logo-dark.svg';
934 }
935 // Dark Logo Image
936 if (isset($dark_mode['admin_ui_dark_logo']['url']) && $dark_mode['admin_ui_dark_logo']['url']) {
937 $dark_logo = $dark_mode['admin_ui_dark_logo']['url'];
938 } else {
939 $dark_logo = PXLBSADMINIFY_ASSETS_IMAGE . 'logos/logo-text-dark.svg';
940 }
941 } elseif ($admin_ui_logo_type == 'text_logo') {
942 // Text Logo
943 if ($this->options['light_dark_mode']['admin_ui_mode'] == 'dark') {
944 $text_logo = $dark_mode['admin_ui_dark_logo_text'];
945 }
946 }
947
948 // Dark Logo Size
949 $dark_width = !empty($dark_mode['dark_logo_size']['width']) ? $dark_mode['dark_logo_size']['width'] : '120';
950 $dark_height = !empty($dark_mode['dark_logo_size']['height']) ? $dark_mode['dark_logo_size']['height'] : '32';
951
952 ?>
953
954 <div class="navbar-brand">
955 <a class="navbar-item p-0" href="<?php echo esc_url($homeurl); ?>">
956 <?php if ($admin_ui_logo_type == 'image_logo') { ?>
957 <!-- Light Logo -->
958 <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); ?>">
959 <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">
960 <!-- Dark Logo -->
961 <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); ?>">
962 <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">
963 <?php } elseif ($admin_ui_logo_type == 'text_logo') { ?>
964 <span class="wp-adminify-site-name">
965 <?php echo esc_html($text_logo); ?>
966 </span>
967 <?php } ?>
968 </a>
969
970 <!-- <div class="navbar-burger" data-target="wp-adminify-top-adminbar">
971 <img src="<?php // echo PXLBSADMINIFY_ASSETS_IMAGE . 'icons/toggol.svg';
972 ?>" alt="Toggol icon"/>
973 </div> -->
974
975 </div>
976
977 <?php
978 }
979
980
981 /* Remove from the administration bar */
982 public function remove_admin_bar_menus()
983 {
984 global $wp_admin_bar;
985 $wp_admin_bar->remove_menu('wp-logo');
986 $wp_admin_bar->remove_menu('site-name');
987 $wp_admin_bar->remove_menu('updates');
988 $wp_admin_bar->remove_menu('menu-toggle');
989 }
990 }
991