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