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