PluginProbe
Adminify – White Label, Admin Menu Editor, Login Customizer / 3.2.4.1
Adminify – White Label, Admin Menu Editor, Login Customizer v3.2.4.1
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 +1211 -955 4.2.63.2.4.1 View file →
@@ -1,214 +1,181 @@
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 13 class AdminBar extends AdminSettingsModel
15 14 {
16 -
17 - public $options;
18 - public $post_types;
19 - public $adminify_ui;
20 -
21 - public function __construct()
22 - {
23 - $this->options = (array) AdminSettings::get_instance()->get();
24 - $this->adminify_ui = $this->options['admin_ui'];
25 - $global_ui_mode = empty($this->options['light_dark_mode']['admin_ui_mode']) ? 'light' : $this->options['light_dark_mode']['admin_ui_mode'];
26 - $current_ui_mode = empty(get_user_meta(get_current_user_id(), 'color_mode', true)) ? $global_ui_mode : get_user_meta(get_current_user_id(), 'color_mode', true);
27 -
28 - if ( $current_ui_mode === 'dark' || $current_ui_mode === 'system' ) {
29 - new DarkModeConflicts();
30 - }
31 -
32 - // $admin_bar_user_roles = !empty($this->options['admin_bar_user_roles']) ? $this->options['admin_bar_user_roles'] : '';
33 - // if (Utils::restricted_for($admin_bar_user_roles)) {
34 - // return;
35 - // }
36 -
37 - // Disable the default admin bar
38 - // add_filter('show_admin_bar', '__return_false');
39 -
40 - // Add admin-bar support if not already activated
41 - // add_theme_support('admin-bar', ['callback' => '__return_false']);
42 -
43 -
44 -
45 - // 05-06-2024
46 - // Check Adminify Setup Wizard Page
47 - // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- read-only check, no state change.
48 - if (!empty($_GET['page']) && 'wp-adminify-setup-wizard' == sanitize_key(wp_unslash($_GET['page']))) {
49 - return;
50 - }
51 -
52 - $this->initialize();
53 -
54 - // if (!empty($this->adminify_ui) && !empty($this->options['admin_bar_search'] )) {
55 - // add_action('wp_admin_bar_class', [$this, 'load_wp_admin_bar_class']);
56 - // add_action('pxlbsadminify/before/secondary_menu', [$this, 'before_secondary_menu']);
57 - // }
58 -
59 - if (is_admin()) {
60 - // Switcher for Default UI
61 - if (empty($this->adminify_ui)) {
62 - if (!empty($this->options['admin_bar_dark_light_btn'])) {
63 - add_action('admin_bar_menu', [$this, 'dark_mode_switcher_icon']);
64 - }
65 - }
66 - }
67 - }
68 -
69 -
70 - // Add Switcher Icon on Admin Bar Secondary
71 - public function dark_mode_switcher_icon($wp_admin_bar)
72 - {
73 - $args = [
74 - 'parent' => 'top-secondary',
75 - 'id' => 'wp-adminify-admin-bar-switcher',
76 - 'title' => $this->dark_mode_switcher_dom(),
77 - 'meta' => false
78 - ];
79 -
80 - $wp_admin_bar->add_node($args);
81 - }
82 -
83 - public function dark_mode_switcher_dom()
84 - {
85 - $global_color_mode = !empty($this->options['light_dark_mode']['admin_ui_mode']) ? $this->options['light_dark_mode']['admin_ui_mode'] : 'light';
86 - $color_mode = empty(get_user_meta(get_current_user_id(), 'color_mode', true))? $global_color_mode : get_user_meta(get_current_user_id(), 'color_mode', true);
87 -
88 - $color_var = !empty($this->adminify_ui) ? 'var(--adminify-menu-text-color)' : '#fff';
89 -
90 - $adminbar_switcher_icon = '<div id="wp-adminify-color-mode-wrapper">
91 - <div class="mode-icon adminify-color-mode-' . esc_attr($color_mode) . '-active">
92 - <svg viewBox="0 0 24 24" width="24" height="24" class="darkIcon" ><path fill="' . $color_var . '" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg>
93 - <svg viewBox="0 0 24 24" width="24" height="24" class="lightIcon"><path fill="' . $color_var . '" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg>
15 + public $options ;
16 + public $post_types ;
17 + public $adminify_ui ;
18 + public function __construct()
19 + {
20 + $this->options = (array) AdminSettings::get_instance()->get( 'admin_bar_settings' );
21 + $this->adminify_ui = AdminSettings::get_instance()->get( 'admin_ui' );
22 + $admin_bar_mode = AdminSettings::get_instance()->get( 'admin_bar_mode' );
23 + if ( $admin_bar_mode != 'light' ) {
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', [
34 + 'callback' => '__return_false',
35 + ] );
36 + // Check Adminify Setup Wizard Page
37 + if ( !empty($_GET['page']) && 'wp-adminify-setup-wizard' == $_GET['page'] ) {
38 + return;
39 + }
40 + add_action( 'plugins_loaded', [ $this, 'initialize' ] );
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 + // Switcher for Default UI
44 + if ( empty($this->adminify_ui) ) {
45 + add_action( 'admin_bar_menu', [ $this, 'jltwp_adminify_dark_mode_switcher_icon' ] );
46 + }
47 + }
48 +
49 + // Add Switcher Icon on Admin Bar Secondary
50 + public function jltwp_adminify_dark_mode_switcher_icon( $wp_admin_bar )
51 + {
52 + $this->options = (array) AdminSettings::get_instance()->get();
53 + $color_mode = ( !empty($this->options['admin_bar_mode']) ? $this->options['admin_bar_mode'] : 'light' );
54 + $adminbar_switcher_icon = '<div id="wp-adminify-color-mode-wrapper">
55 + <div class="mode-icon adminify-color-mode-' . esc_attr( $color_mode ) . '-active">
56 + <svg viewBox="0 0 24 24" width="24" height="24" class="darkIcon" ><path fill="currentColor" 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>
57 + <svg viewBox="0 0 24 24" width="24" height="24" class="lightIcon"><path fill="currentColor" 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 58 <svg width="16" height="16" viewBox="0 0 22 18" fill="none" xmlns="http://www.w3.org/2000/svg" class="systemIcon">
95 - <path d="M20 13V4.2C20 3.0799 20 2.51984 19.782 2.09202C19.5903 1.71569 19.2843 1.40973 18.908 1.21799C18.4802 1 17.9201 1 16.8 1H5.2C4.07989 1 3.51984 1 3.09202 1.21799C2.71569 1.40973 2.40973 1.71569 2.21799 2.09202C2 2.51984 2 3.0799 2 4.2V13M3.66667 17H18.3333C18.9533 17 19.2633 17 19.5176 16.9319C20.2078 16.7469 20.7469 16.2078 20.9319 15.5176C21 15.2633 21 14.9533 21 14.3333C21 14.0233 21 13.8683 20.9659 13.7412C20.8735 13.3961 20.6039 13.1265 20.2588 13.0341C20.1317 13 19.9767 13 19.6667 13H2.33333C2.02334 13 1.86835 13 1.74118 13.0341C1.39609 13.1265 1.12654 13.3961 1.03407 13.7412C1 13.8683 1 14.0233 1 14.3333C1 14.9533 1 15.2633 1.06815 15.5176C1.25308 16.2078 1.79218 16.7469 2.48236 16.9319C2.73669 17 3.04669 17 3.66667 17Z" stroke="' . $color_var . '" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
59 + <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="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
96 60 </svg>
97 61 </div>
98 62 <div class="light-dark-dropdown">
99 63 <div class="light">
100 - <svg viewBox="0 0 24 24" width="24" height="24" class="lightIcon"><path fill="' . $color_var . '" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg>
64 + <svg viewBox="0 0 24 24" width="24" height="24" class="lightIcon"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg>
101 65 <span>Light</span>
102 66 </div>
103 67 <div class="dark">
104 - <svg viewBox="0 0 24 24" width="24" height="24" class="darkIcon"><path fill="' . $color_var . '" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg>
68 + <svg viewBox="0 0 24 24" width="24" height="24" class="darkIcon"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg>
105 69 <span>Dark</span>
106 70 </div>
107 71 <div class="system">
108 72 <svg width="16" height="16" viewBox="0 0 22 18" fill="none" xmlns="http://www.w3.org/2000/svg" class="systemIcon">
109 - <path d="M20 13V4.2C20 3.0799 20 2.51984 19.782 2.09202C19.5903 1.71569 19.2843 1.40973 18.908 1.21799C18.4802 1 17.9201 1 16.8 1H5.2C4.07989 1 3.51984 1 3.09202 1.21799C2.71569 1.40973 2.40973 1.71569 2.21799 2.09202C2 2.51984 2 3.0799 2 4.2V13M3.66667 17H18.3333C18.9533 17 19.2633 17 19.5176 16.9319C20.2078 16.7469 20.7469 16.2078 20.9319 15.5176C21 15.2633 21 14.9533 21 14.3333C21 14.0233 21 13.8683 20.9659 13.7412C20.8735 13.3961 20.6039 13.1265 20.2588 13.0341C20.1317 13 19.9767 13 19.6667 13H2.33333C2.02334 13 1.86835 13 1.74118 13.0341C1.39609 13.1265 1.12654 13.3961 1.03407 13.7412C1 13.8683 1 14.0233 1 14.3333C1 14.9533 1 15.2633 1.06815 15.5176C1.25308 16.2078 1.79218 16.7469 2.48236 16.9319C2.73669 17 3.04669 17 3.66667 17Z" stroke="' . $color_var . '" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
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="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
110 74 </svg>
111 75 <span>System</span>
112 76 </div>
113 77 </div>
114 78 </div>';
79 + // $user_id = get_current_user_id();
80 + // if ( ! $user_id ) {
81 + // return;
82 + // }
83 + // $adminbar_switcher_icon_toggle = get_user_meta( $user_id, 'adminbar_switcher_icon_toggle', true );
84 + // $admin_bar_mode = !empty($this->options['admin_bar_mode']) ? $this->options['admin_bar_mode'] : '';
85 + // if ( $adminbar_switcher_icon_toggle == 'off' ) {
86 + // return;
87 + // }
88 + $args = [
89 + 'parent' => 'top-secondary',
90 + 'id' => 'wp-adminify-admin-bar-switcher',
91 + 'title' => $adminbar_switcher_icon,
92 + 'meta' => false,
93 + ];
94 + $wp_admin_bar->add_node( $args );
95 + }
96 +
97 + public function initialize()
98 + {
99 + $admin_bar_position = ( !empty($this->options['admin_bar_position']) ? $this->options['admin_bar_position'] : 'top' );
100 +
101 + if ( is_admin() ) {
102 + if ( $admin_bar_position == 'top' || $admin_bar_position == 'bottom' ) {
103 +
104 + if ( !empty($this->adminify_ui) ) {
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 + }
111 + add_action( 'admin_enqueue_scripts', [ $this, 'jltwp_adminify_admin_scripts' ], 100 );
112 + // Remove Unnecessary Menus from Admin bar
113 + // add_action('wp_before_admin_bar_render', [$this, 'jltma_adminify_remove_admin_bar_menus'], 0);
114 + add_filter( 'admin_body_class', [ $this, 'admin_bar_body_class' ] );
115 + add_action( 'admin_head', [ $this, 'jltwp_adminify_admin_bar_css' ], 999 );
116 + add_action( 'wp_ajax_adminify_all_search', [ $this, 'adminify_all_search' ] );
117 + add_action( 'wp_ajax_wp_adminify_color_mode', [ $this, 'wp_adminify_color_mode' ] );
118 + // Screen Option and Help Tab
119 + add_action(
120 + 'admin_head',
121 + [ $this, 'jltwp_adminify_remove_screen_options' ],
122 + 10,
123 + 3
124 + );
125 + add_action( 'admin_head', [ $this, 'jltwp_adminify_remove_help_tab' ] );
126 + } else {
127 + // Admin bar Frontend settings
128 + $frontend_admin = ( !empty($this->options['admin_bar_hide_frontend']) ? $this->options['admin_bar_hide_frontend'] : 'show' );
129 + $this->jltwp_adminify_front_bar();
130 + add_action( 'init', [ $this, 'admin_bar_front_style_init' ] );
131 + if ( $frontend_admin == 'hide' ) {
132 + add_filter( 'show_admin_bar', '__return_false' );
133 + }
134 + }
135 +
136 + }
137 +
138 + public function before_secondary_menu()
139 + {
140 + if ( !empty($this->options['admin_bar_search']) ) {
141 + ?>
142 + <div class="wp-adminify-top-header--search--form">
143 + <form class="top-header--search--form" action="$">
144 + <span class="adminify-search-expand"><i class="icon-magnifier icons"></i></span>
145 + <input id="top-header-search-input" class="top-header-search-input" type="search" placeholder="Search here">
146 + </form>
115 147
116 - return $adminbar_switcher_icon;
117 - }
118 -
119 -
120 -
121 - public function initialize()
122 - {
123 - $admin_bar_position = (!empty($this->options['admin_bar_position'])) ? $this->options['admin_bar_position'] : 'top';
124 -
125 - if (is_admin()) {
126 - if ($admin_bar_position == 'top' || $admin_bar_position == 'bottom') {
127 - if (!empty($this->adminify_ui)) {
128 - //TODO: not need to adminify ui. alternative use iframe topbar
129 - // add_action('admin_init', [$this, 'add_admin_bar']);
130 - // } else {
131 - add_action('admin_head', [$this, 'legacy_admin_bar_positon']);
132 - }
133 - }
134 - add_action('admin_enqueue_scripts', [$this, 'admin_scripts'], 100);
135 -
136 - // Remove Unnecessary Menus from Admin bar
137 - // add_action('wp_before_admin_bar_render', [$this, 'remove_admin_bar_menus'], 0);
138 -
139 - // add_filter('admin_body_class', [$this, 'admin_bar_body_class']);
140 - // add_action('admin_head', [$this, 'admin_bar_css'], 999);
141 -
142 - add_action('wp_ajax_pxlbsadminify_all_search', [$this, 'all_search']);
143 - add_action('wp_ajax_pxlbsadminify_color_mode', [$this, 'color_mode']);
144 -
145 -
146 - // Screen Option and Help Tab
147 - add_action('admin_head', [$this, 'remove_screen_options'], 10, 3);
148 - add_action('admin_head', [$this, 'remove_help_tab']);
149 - } else {
150 - // Admin bar Frontend settings
151 - $frontend_admin = (!empty($this->options['admin_bar_hide_frontend'])) ? $this->options['admin_bar_hide_frontend'] : 'show';
152 -
153 - // if (jltwp_adminify()->can_use_premium_code__premium_only()) {
154 - // if ($frontend_admin == 'show') {
155 - // $frontend_admin_roles = (!empty($this->options['admin_bar_hide_frontend_user_roles'])) ? $this->options['admin_bar_hide_frontend_user_roles'] : [];
156 - // if (Utils::restricted_for($frontend_admin_roles)) {
157 - // $frontend_admin = 'hide';
158 - // }
159 - // }
160 - // }
161 - $this->front_bar();
162 -
163 - if ($admin_bar_position == 'bottom') {
164 - add_action('init', [$this, 'admin_bar_front_style_init']);
165 - }
166 -
167 - if ($frontend_admin == 'hide') {
168 - add_filter('show_admin_bar', '__return_false');
169 - }
170 - }
171 - }
172 -
173 - public function before_secondary_menu()
174 - {
175 -?>
176 - <div class="wp-adminify-top-header--search--form">
177 - <form class="top-header--search--form" action="$">
178 - <span class="adminify-search-expand"><i class="icon-magnifier icons"></i></span>
179 - <input id="top-header-search-input" class="top-header-search-input" type="search" placeholder="Search here">
180 - </form>
181 -
182 - <div id="top-header-search-results" class=" top-header-search-results" style="display: none;">
183 - <div class="top-header-results-wrapper">
148 + <div id="top-header-search-results" class=" top-header-search-results" style="display: none;">
149 + <div class="top-header-results-wrapper">
150 + </div>
184 151 </div>
185 152 </div>
186 - </div>
187 - <?php
188 - }
189 -
190 - public function load_wp_admin_bar_class()
191 - {
192 - return 'PXLBSAdminify\Inc\Classes\Adminify_Admin_Bar';
193 - }
194 -
195 - public function front_bar()
196 - {
197 - add_action('admin_init', [$this, 'add_admin_bar']);
198 - add_filter('body_class', [$this, 'admin_bar_body_class']);
199 - }
200 -
201 - public function admin_bar_front_style_init()
202 - {
203 - add_filter('wp_enqueue_scripts', [$this, 'admin_bar_front_style']);
204 - }
205 -
206 - // Frontend Admin bar style
207 - public function admin_bar_front_style()
208 - {
209 - $admin_bar_css = '';
210 - $admin_bar_css .= '.admin-bar-position-bottom #wpadminbar{
153 + <?php
154 + }
155 + }
156 +
157 + public function load_wp_admin_bar_class()
158 + {
159 + return 'WPAdminify\\Inc\\Classes\\Adminify_Admin_Bar';
160 + }
161 +
162 + public function jltwp_adminify_front_bar()
163 + {
164 + add_action( 'admin_init', [ $this, 'jltwp_adminify_add_admin_bar' ] );
165 + add_filter( 'body_class', [ $this, 'admin_bar_body_class' ] );
166 + }
167 +
168 + public function admin_bar_front_style_init()
169 + {
170 + add_filter( 'wp_enqueue_scripts', [ $this, 'admin_bar_front_style' ] );
171 + }
172 +
173 + // Frontend Admin bar style
174 + public function admin_bar_front_style()
175 + {
176 + $admin_bar_css = '';
177 + $admin_bar_css .= '.admin-bar-position-bottom #wpadminbar{
211 178 top:auto;
212 179 bottom: 0;
213 180 }
214 181 .admin-bar-position-bottom #wpadminbar .menupop .ab-sub-wrapper{
@@ -218,462 +185,468 @@
218 185 body.logged-in.admin-bar-position-bottom {
219 186 position: relative;
220 187 }
221 188 }';
222 - wp_add_inline_style('admin-bar', $admin_bar_css);
223 - }
189 + wp_add_inline_style( 'admin-bar', $admin_bar_css );
190 + }
191 +
192 + // Remove Screen Options
193 + public function jltwp_adminify_remove_screen_options()
194 + {
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 + }
200 +
201 + // Contextual Help Tab Remove
202 + public function jltwp_adminify_remove_help_tab()
203 + {
204 + $enable_screen_tab = Utils::get_user_preference( 'adminify_help_tab' );
205 +
206 + if ( $enable_screen_tab ) {
207 + $screen = get_current_screen();
208 + $screen->remove_help_tabs();
209 + }
210 +
211 + }
212 +
213 + // Get All registered WP Admin Menus
214 + public static function get_wp_admin_menus( $thismenu, $thissubmenu )
215 + {
216 + $options = [];
217 + if ( !empty($thismenu) && is_array( $thismenu ) ) {
218 + foreach ( $thismenu as $item ) {
219 + if ( !empty($item[0]) ) {
220 + // the preg_replace removes "Comments" & "Plugins" menu spans.
221 + $options[$item[2]] = preg_replace( '/\\<span.*?>.*?\\<\\/span><\\/span>/s', '', $item[0] );
222 + }
223 + }
224 + }
225 + if ( !empty($thissubmenu) && is_array( $thissubmenu ) ) {
226 + foreach ( $thissubmenu as $items ) {
227 + foreach ( $items as $item ) {
228 + if ( !empty($item[0]) ) {
229 + $options[$item[1]] = preg_replace( '/\\<span.*?>.*?\\<\\/span><\\/span>/s', '', $item[0] );
230 + }
231 + }
232 + }
233 + }
234 + return $options;
235 + }
236 +
237 + public function jltwp_adminify_admin_scripts()
238 + {
239 + global $pagenow ;
240 + // 21-2-24
241 + // if (!is_user_logged_in() && $pagenow != 'wp-login.php') {
242 + if ( $pagenow == 'wp-login.php' || $pagenow == 'wp-register.php' || $pagenow == 'customize.php' ) {
243 + return;
244 + }
245 + // if (is_admin_bar_showing()) { }
246 +
247 + if ( !empty($this->adminify_ui) ) {
248 + wp_enqueue_style( 'wp-adminify-admin-bar' );
249 + $this->admin_topbar_loader_css();
250 + }
251 +
252 + wp_localize_script( 'wp-adminify-admin', 'WPAdminify', $this->adminify_create_admin_bar_js_object() );
253 + // wp_enqueue_style('wp-adminify-admin-bar', WP_ADMINIFY_ASSETS . 'css/admin-bar.css', false, WP_ADMINIFY_VER);
254 + // wp_enqueue_script('wp-adminify-admin', WP_ADMINIFY_ASSETS . 'js/wp-adminify.js', ['jquery'], WP_ADMINIFY_VER, true);
255 + // wp_localize_script('wp-adminify-admin', 'WPAdminify', $this->adminify_create_admin_bar_js_object());
256 + }
257 +
258 + public function adminify_create_admin_bar_js_object()
259 + {
260 + return [
261 + 'ajax_url' => admin_url( 'admin-ajax.php' ),
262 + 'security_nonce' => wp_create_nonce( 'adminify-admin-bar-security-nonce' ),
263 + 'notice_nonce' => wp_create_nonce( 'adminify-notice-nonce' ),
264 + ];
265 + }
266 +
267 + /**
268 + * Preloader
269 + *
270 + * @return void
271 + */
272 + public function admin_topbar_loader_css()
273 + {
274 + $output_css = '';
275 + $topbar_wireframe_img = WP_ADMINIFY_ASSETS_IMAGE . 'topbar-wireframe.svg';
276 + $output_css .= '.js .wp-adminify-topbar-loader{background: url(' . esc_url( $topbar_wireframe_img ) . '); }';
277 + echo '<style>' . wp_strip_all_tags( $output_css ) . '</style>' ;
278 + }
279 +
280 + /**
281 + * Save Color Mode by Ajax
282 + *
283 + * @return void
284 + */
285 + public function wp_adminify_color_mode()
286 + {
287 +
288 + if ( defined( 'DOING_AJAX' ) && DOING_AJAX && check_ajax_referer( 'adminify-admin-bar-security-nonce', 'security' ) > 0 ) {
289 + $admin_bar_mode = AdminSettings::get_instance()->get();
290 +
291 + if ( !empty($_POST['key']) ) {
292 + $key = sanitize_key( $_POST['key'] );
293 + $value = Utils::clean_ajax_input( wp_unslash( $_POST['value'] ) );
294 +
295 + if ( $key == '' ) {
296 + $message = __( 'No Color Mode supplied to save', 'adminify' );
297 + echo Utils::ajax_error_message( $message ) ;
298 + die;
299 + }
300 +
301 + }
302 +
303 + // Light/Dark Mode
304 +
305 + if ( $key === 'color_mode' ) {
306 + $admin_bar_mode['admin_bar_mode'] = $value;
307 + $admin_bar_mode['enable_schedule_dark_mode'] = false;
308 +
309 + if ( $value == 'system' ) {
310 + $admin_bar_mode['enable_schedule_dark_mode'] = true;
311 + $admin_bar_mode['schedule_dark_mode_type'] = 'system';
312 + }
313 +
314 + update_option( '_wpadminify', $admin_bar_mode );
315 + die;
316 + }
317 +
318 + // Screen Options, Help Tabs and WP Hide Links
319 +
320 + if ( $key === 'screen_options_tab' || $key === 'hide_wp_links' || $key === 'adminify_help_tab' ) {
321 + $userid = get_current_user_id();
322 + $current = get_user_meta( $userid, '_wpadminify_preferences', true );
323 +
324 + if ( is_array( $current ) ) {
325 + $current[$key] = $value;
326 + } else {
327 + $current = [];
328 + $current[$key] = $value;
329 + }
330 +
331 + $state = update_user_meta( $userid, '_wpadminify_preferences', $current );
332 +
333 + if ( $state ) {
334 + $returndata = [];
335 + $returndata['success'] = true;
336 + $returndata['message'] = __( 'Preferences saved', 'adminify' );
337 + echo json_encode( $returndata ) ;
338 + } else {
339 + $message = __( 'Unable to save user preferences', 'adminify' );
340 + echo Utils::ajax_error_message( $message ) ;
341 + die;
342 + }
343 +
344 + }
345 +
346 + }
347 +
348 + }
349 +
350 + /**
351 + * Search Everything
352 + *
353 + * @return void
354 + */
355 + public function adminify_all_search()
356 + {
357 +
358 + if ( defined( 'DOING_AJAX' ) && DOING_AJAX && check_ajax_referer( 'adminify-admin-bar-security-nonce', 'security' ) > 0 ) {
359 + if ( !empty($_POST['search']) ) {
360 + $term = sanitize_text_field( wp_unslash( $_POST['search'] ) );
361 + }
362 + // Search Arguments
363 + $args = [
364 + 'numberposts' => -1,
365 + 's' => $term,
366 + 'post_status' => [
367 + 'publish',
368 + 'pending',
369 + 'draft',
370 + 'future',
371 + 'private',
372 + 'inherit'
373 + ],
374 + ];
375 + // All Post Types
376 + $post_types = $this->get_post_types();
377 + foreach ( $post_types as $type ) {
378 + $args['post_type'][] = $type->name;
379 + }
380 + // All Categories/Taxonomies
381 + $all_taxonomies = get_taxonomies();
382 + // Get Comments
383 + $all_comments = get_comments();
384 + // Get All Users
385 + $all_users = get_users();
386 + // All Users
387 + // $blogusers = get_users();
388 + // foreach ($blogusers as $type) {
389 + // $name = $type->user_login;
390 + // $id = $type->ID;
391 + // $args['author__in'][] = $type->ID;
392 + // }
393 + // // All Menus
394 + // $all_admin_menus = self::get_wp_admin_menus();
395 + // All Plugins
396 + if ( !function_exists( 'get_plugins' ) ) {
397 + require_once ABSPATH . 'wp-admin/includes/plugin.php';
398 + }
399 + $all_plugins = get_plugins();
400 + $foundposts = get_posts( $args );
401 + // $count_items = '';
402 + // if (count($foundposts) > 0) {
403 + // $count_items .= count($foundposts);
404 + // } elseif (count($all_plugins)) {
405 + // $count_items .= count($all_plugins);
406 + // }
407 + ob_start();
408 + ?>
224 409
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 - }
410 + <p><span class="count"></span><?php
411 + echo count( $foundposts ) . wp_kses_post( ' item<span>s</span> found' ) ;
412 + ?></p>
233 413
234 - // Contextual Help Tab Remove
235 - public function remove_help_tab()
236 - {
237 - $enable_screen_tab = Utils::get_user_preference('adminify_help_tab');
238 - if ($enable_screen_tab) {
239 - $screen = get_current_screen();
240 - $screen->remove_help_tabs();
241 - }
242 - }
243 -
244 - // Get All registered WP Admin Menus
245 - public static function get_wp_admin_menus($thismenu, $thissubmenu)
246 - {
247 - $options = [];
248 -
249 - if (!empty($thismenu) && is_array($thismenu)) {
250 - foreach ($thismenu as $item) {
251 - if (!empty($item[0])) {
252 - // the preg_replace removes "Comments" & "Plugins" menu spans.
253 - $options[$item[2]] = (preg_replace('/\<span.*?>.*?\<\/span><\/span>/s', '', $item[0]));
254 - }
255 - }
256 - }
257 -
258 - if (!empty($thissubmenu) && is_array($thissubmenu)) {
259 - foreach ($thissubmenu as $items) {
260 - foreach ($items as $item) {
261 - if (!empty($item[0])) {
262 - $options[$item[1]] = (preg_replace('/\<span.*?>.*?\<\/span><\/span>/s', '', $item[0]));
263 - }
264 - }
265 - }
266 - }
267 -
268 - return $options;
269 - }
270 -
271 - public function admin_scripts()
272 - {
273 - global $pagenow;
274 - if ($pagenow == 'wp-login.php' || $pagenow == 'wp-register.php' || $pagenow == 'customize.php') {
275 - return;
276 - }
277 -
278 - // Commented on: 9-6-24
279 - if (!empty($this->adminify_ui)) {
280 - wp_enqueue_style('wp-adminify-admin-bar');
281 - $this->admin_topbar_loader_css();
282 - }
283 - wp_localize_script('adminify-admin', 'PXLBSADMINIFY_ADMINBAR', $this->create_admin_bar_js_object());
284 - }
285 -
286 -
287 - public function create_admin_bar_js_object()
288 - {
289 - return [
290 - 'ajax_url' => admin_url('admin-ajax.php'),
291 - 'security_nonce' => wp_create_nonce('pxlbsadminify-admin-bar-security-nonce'),
292 - 'notice_nonce' => wp_create_nonce('pxlbsadminify-notice-nonce'),
293 - ];
294 - }
295 -
296 - /**
297 - * Preloader
298 - *
299 - * @return void
300 - */
301 - public function admin_topbar_loader_css()
302 - {
303 - $output_css = '';
304 - $topbar_wireframe_img = PXLBSADMINIFY_ASSETS_IMAGE . 'topbar-wireframe.svg';
305 - $output_css .= '.js .wp-adminify-topbar-loader{background: url(' . esc_url($topbar_wireframe_img) . '); }';
306 -
307 - // Use wp_add_inline_style instead of echo to prevent "headers already sent" errors
308 - wp_add_inline_style( 'wp-adminify-admin-bar', wp_strip_all_tags($output_css) );
309 -
310 - $screen = get_current_screen(); // Get current screen details
311 -
312 - if (isset($screen->base) && $screen->base === 'post') {
313 - $inline_script = "window.addEventListener('load', function() {
314 - const isFullscreenMode = wp.data.select('core/edit-post').isFeatureActive('fullscreenMode');
315 - if (isFullscreenMode) {
316 - jQuery('.adminify-top_bar').css({
317 - 'display': 'none !important'
318 - });
319 - }
320 - });";
321 - wp_add_inline_script( 'adminify-admin', $inline_script );
322 - }
323 - }
324 -
325 - /**
326 - * Save Color Mode by Ajax
327 - *
328 - * @return void
329 - */
330 - public function color_mode()
331 - {
332 - if (defined('DOING_AJAX') && DOING_AJAX) {
333 - // 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 - ];
436 -
437 - // All Post Types
438 - $post_types = $this->get_post_types();
439 - foreach ($post_types as $type) {
440 - $args['post_type'][] = $type->name;
441 - }
442 -
443 - // All Categories/Taxonomies
444 - $all_taxonomies = get_taxonomies();
445 -
446 - // Get Comments
447 - $all_comments = get_comments();
448 -
449 - // Get All Users
450 - $all_users = get_users();
451 -
452 - // All Users
453 - // $blogusers = get_users();
454 - // foreach ($blogusers as $type) {
455 - // $name = $type->user_login;
456 - // $id = $type->ID;
457 - // $args['author__in'][] = $type->ID;
458 - // }
459 -
460 - // // All Menus
461 - // $all_admin_menus = self::get_wp_admin_menus();
462 -
463 - // All Plugins
464 -
465 - if (!function_exists('get_plugins')) {
466 - require_once ABSPATH . 'wp-admin/includes/plugin.php';
467 - }
468 - $all_plugins = get_plugins();
469 -
470 - $foundposts = get_posts($args);
471 -
472 - // $count_items = '';
473 - // if (count($foundposts) > 0) {
474 - // $count_items .= count($foundposts);
475 - // } elseif (count($all_plugins)) {
476 - // $count_items .= count($all_plugins);
477 - // }
478 -
479 -
480 -
481 -
482 -
483 - $output_data = [
484 - 'foundposts' => $this->set_edit_url_foundposts($foundposts),
485 - 'all_taxonomies' => $this->filter_all_taxonomies($all_taxonomies, $search_text),
486 - 'all_comments' => $this->filter_all_comments($all_comments, $search_text),
487 - 'all_users' => $this->filter_all_users($all_users, $search_text),
488 - 'all_plugins' => $this->filter_all_plugins($all_plugins, $search_text),
489 - ];
490 -
491 - wp_send_json_success(
492 - [
493 - 'data' => wp_json_encode($output_data),
494 - ]
495 - );
496 -
497 - return;
498 -
499 - ob_start();
500 - ?>
501 -
502 - <p><span class="count"></span><?php echo count($foundposts) . wp_kses_post(' item<span>s</span> found'); ?></p>
503 -
504 414 <table class="top-header-result-table" style="height:500px;">
505 415 <thead>
506 416 <tr class="has-text-left">
507 - <th><?php esc_html_e('Title', 'adminify'); ?></th>
508 - <th><?php esc_html_e('Type', 'adminify'); ?></th>
509 - <th><?php esc_html_e('User', 'adminify'); ?></th>
510 - <th><?php esc_html_e('Date', 'adminify'); ?></th>
417 + <th><?php
418 + esc_html_e( 'Title', 'adminify' );
419 + ?></th>
420 + <th><?php
421 + esc_html_e( 'Type', 'adminify' );
422 + ?></th>
423 + <th><?php
424 + esc_html_e( 'User', 'adminify' );
425 + ?></th>
426 + <th><?php
427 + esc_html_e( 'Date', 'adminify' );
428 + ?></th>
511 429 </tr>
512 430 </thead>
513 431 <tbody>
514 432
515 - <?php
516 - foreach ($foundposts as $item) {
517 - $author_id = $item->post_author;
518 - $editurl = get_edit_post_link($item);
519 - $public = get_permalink($item);
520 - ?>
433 + <?php
434 + foreach ( $foundposts as $item ) {
435 + $author_id = $item->post_author;
436 + $editurl = get_edit_post_link( $item );
437 + $public = get_permalink( $item );
438 + ?>
521 439 <tr>
522 - <td><span class="table-title"><a href="<?php echo esc_url($editurl); ?>"><?php echo wp_kses_post(get_the_title($item)); ?></a></span></td>
523 - <td><span class="type"><?php echo wp_kses_post(get_post_type($item)); ?></span></td>
524 - <td><span class="user"><?php echo wp_kses_post(the_author_meta('user_login', $author_id)); ?></span></td>
525 - <td><span class="date"><?php echo wp_kses_post(get_the_date(get_option('date_format'), $item)); ?></span></td>
440 + <td><span class="table-title"><a href="<?php
441 + echo esc_url( $editurl ) ;
442 + ?>"><?php
443 + echo wp_kses_post( get_the_title( $item ) ) ;
444 + ?></a></span></td>
445 + <td><span class="type"><?php
446 + echo wp_kses_post( get_post_type( $item ) ) ;
447 + ?></span></td>
448 + <td><span class="user"><?php
449 + echo wp_kses_post( the_author_meta( 'user_login', $author_id ) ) ;
450 + ?></span></td>
451 + <td><span class="date"><?php
452 + echo wp_kses_post( get_the_date( get_option( 'date_format' ), $item ) ) ;
453 + ?></span></td>
526 454 </tr>
527 - <?php } ?>
455 + <?php
456 + }
457 + ?>
528 458
529 - <?php
530 - foreach ($all_taxonomies as $tax_name) {
531 - $terms = get_terms(
532 - [
533 - 'taxonomy' => $tax_name,
534 - 'hide_empty' => 1,
535 - ]
536 - );
537 - foreach ($terms as $cat) {
538 - if (strpos(strtolower($cat->name), strtolower($term)) === false) {
539 - continue;
540 - }
541 - // $user = get_userdata($cat->term_id);
542 - ?>
459 + <?php
460 + foreach ( $all_taxonomies as $tax_name ) {
461 + $terms = get_terms( [
462 + 'taxonomy' => $tax_name,
463 + 'hide_empty' => 1,
464 + ] );
465 + foreach ( $terms as $cat ) {
466 + if ( strpos( strtolower( $cat->name ), strtolower( $term ) ) === false ) {
467 + continue;
468 + }
469 + // $user = get_userdata($cat->term_id);
470 + ?>
543 471 <tr>
544 472 <td>
545 473 <span class="table-title">
546 - <a href="<?php echo esc_url(get_term_link($cat->slug, $cat->taxonomy)); ?>">
547 - <?php echo esc_html($cat->name); ?>
474 + <a href="<?php
475 + echo esc_url( get_term_link( $cat->slug, $cat->taxonomy ) ) ;
476 + ?>">
477 + <?php
478 + echo esc_html( $cat->name ) ;
479 + ?>
548 480 </a>
549 481 </span>
550 482 </td>
551 483 <td>
552 - <span class="type"><?php echo esc_html($cat->taxonomy); ?></span>
484 + <span class="type"><?php
485 + echo esc_html( $cat->taxonomy ) ;
486 + ?></span>
553 487 </td>
554 488 <td>
555 489 <span class="user">
556 - <?php esc_html_e('N/A', 'adminify'); ?>
490 + <?php
491 + esc_html_e( 'N/A', 'adminify' );
492 + ?>
557 493 </span>
558 494 </td>
559 495 <td>
560 496 <span class="date">
561 - <?php esc_html_e('N/A', 'adminify'); ?>
497 + <?php
498 + esc_html_e( 'N/A', 'adminify' );
499 + ?>
562 500 </span>
563 501 </td>
564 502 <td>
565 503 </td>
566 504 </tr>
567 - <?php
568 - }
569 - }
570 - ?>
505 + <?php
506 + }
507 + }
508 + ?>
571 509
572 510
573 511 <!-- Get Comments -->
574 - <?php
575 - foreach ($all_comments as $comment) {
576 - if (strpos(strtolower($comment->comment_content), strtolower($term)) === false) {
577 - continue;
578 - }
579 - ?>
512 + <?php
513 + foreach ( $all_comments as $comment ) {
514 + if ( strpos( strtolower( $comment->comment_content ), strtolower( $term ) ) === false ) {
515 + continue;
516 + }
517 + ?>
580 518 <tr>
581 519 <td>
582 520 <span class="table-title">
583 - <a href="<?php echo esc_url(admin_url('comment.php?action=editcomment&c=' . esc_attr($comment->comment_ID))); ?>">
584 - <?php echo wp_kses_post($comment->comment_content); ?>
521 + <a href="<?php
522 + echo esc_url_raw( admin_url( 'comment.php?action=editcomment&c=' . esc_attr( $comment->comment_ID ) ) ) ;
523 + ?>">
524 + <?php
525 + echo wp_kses_post( $comment->comment_content ) ;
526 + ?>
585 527 </a>
586 528 </span>
587 529 </td>
588 530 <td>
589 531 <span class="type">
590 - <?php echo wp_kses_post(ucwords($comment->comment_type)); ?>
532 + <?php
533 + echo wp_kses_post( ucwords( $comment->comment_type ) ) ;
534 + ?>
591 535 </span>
592 536 </td>
593 537 <td>
594 538 <span class="user">
595 - <?php echo wp_kses_post(the_author_meta('display_name', $comment->user_id)); ?>
539 + <?php
540 + echo wp_kses_post( the_author_meta( 'display_name', $comment->user_id ) ) ;
541 + ?>
596 542 </span>
597 543 </td>
598 544 <td>
599 545 <span class="date">
600 - <?php echo esc_html(get_the_date(get_option('date_format'), $comment->comment_date)); ?>
546 + <?php
547 + echo esc_html( get_the_date( get_option( 'date_format' ), $comment->comment_date ) ) ;
548 + ?>
601 549 </span>
602 550 </td>
603 551 </tr>
604 - <?php } ?>
552 + <?php
553 + }
554 + ?>
605 555
606 556
607 557
608 558 <!-- Get Users -->
609 - <?php
610 -
611 - foreach ($all_users as $user) {
612 - if (strpos(strtolower($user->user_login), strtolower($term)) === false) {
613 - continue;
614 - }
615 - ?>
559 + <?php
560 + foreach ( $all_users as $user ) {
561 + if ( strpos( strtolower( $user->user_login ), strtolower( $term ) ) === false ) {
562 + continue;
563 + }
564 + ?>
616 565 <tr>
617 566 <td>
618 567 <span class="table-title">
619 - <a href="<?php echo esc_url(admin_url('user-edit.php?user_id=' . $user->ID)); ?>">
620 - <?php echo esc_html($user->display_name); ?>
568 + <a href="<?php
569 + echo esc_url( admin_url( 'user-edit.php?user_id=' . $user->ID ) ) ;
570 + ?>">
571 + <?php
572 + echo esc_html( $user->display_name ) ;
573 + ?>
621 574 </a>
622 575 </span>
623 576 </td>
624 577 <td>
625 578 <span class="type">
626 - <?php echo wp_kses_post(ucwords($comment->comment_type)); ?>
579 + <?php
580 + esc_html_e( 'User', 'adminify' );
581 + ?>
627 582 </span>
628 583 </td>
629 584 <td>
630 585 <span class="user">
631 - <?php echo wp_kses_post(the_author_meta('display_name', $comment->user_id)); ?>
586 + <?php
587 + echo wp_kses_post( the_author_meta( 'display_name', $user->ID ) ) ;
588 + ?>
632 589 </span>
633 590 </td>
634 591 <td>
635 592 <span class="date">
636 - <?php echo wp_kses_post(get_the_date(get_option('date_format'), $user->user_registered)); ?>
593 + <?php
594 + echo wp_kses_post( get_the_date( get_option( 'date_format' ), $user->user_registered ) ) ;
595 + ?>
637 596 </span>
638 597 </td>
639 598 </tr>
640 - <?php } ?>
599 + <?php
600 + }
601 + ?>
641 602
642 603
643 604
644 605 <!-- Get Plugins -->
645 - <?php
646 - foreach ($all_plugins as $plugin) {
647 - if (strpos(strtolower($plugin['Name']), strtolower($term)) === false) {
648 - continue;
649 - }
650 - ?>
606 + <?php
607 + foreach ( $all_plugins as $plugin ) {
608 + if ( strpos( strtolower( $plugin['Name'] ), strtolower( $term ) ) === false ) {
609 + continue;
610 + }
611 + ?>
651 612 <tr>
652 613 <td>
653 614 <span class="table-title">
654 - <a href="<?php echo esc_url(admin_url('plugins.php')); ?>">
655 - <?php echo esc_html($plugin['Name']); ?>
615 + <a href="<?php
616 + echo esc_url( admin_url( 'plugins.php' ) ) ;
617 + ?>">
618 + <?php
619 + echo esc_html( $plugin['Name'] ) ;
620 + ?>
656 621 </a>
657 622 </span>
658 623 </td>
659 624 <td>
660 625 <span class="type">
661 - <?php esc_html_e('Plugin', 'adminify'); ?>
626 + <?php
627 + esc_html_e( 'Plugin', 'adminify' );
628 + ?>
662 629 </span>
663 630 </td>
664 631 <td>
665 632 <span class="user">
666 - <?php echo esc_html($plugin['AuthorName']); ?>
633 + <?php
634 + echo esc_html( $plugin['AuthorName'] ) ;
635 + ?>
667 636 </span>
668 637 </td>
669 638 <td>
670 639 <span class="date">
671 - <?php esc_html_e('N/A', 'adminify'); ?>
640 + <?php
641 + esc_html_e( 'N/A', 'adminify' );
642 + ?>
672 643 </span>
673 644 </td>
674 645 </tr>
675 - <?php } ?>
646 + <?php
647 + }
648 + ?>
676 649
677 650
678 651 </tbody>
679 652 </table>
@@ -678,189 +651,183 @@
678 651 </tbody>
679 652 </table>
680 653
681 654
682 - <?php
683 -
684 - // $output_data = ob_get_clean();
685 -
686 - // $output_data = [
687 - // 'foundposts' => $foundposts,
688 - // 'all_taxonomies' => $all_taxonomies,
689 - // 'all_comments' => $all_comments,
690 - // 'all_users' => $all_users,
691 - // 'all_plugins' => $all_plugins,
692 - // ];
693 - // echo json_encode($output_data);
694 - echo wp_json_encode($foundposts);
695 - wp_send_json_success(
696 - [
697 - 'data' => $foundposts,
698 - ]
699 - );
700 - }
701 -
702 - die();
703 - }
704 -
705 - /**
706 - * Set URL to All Post
707 - */
708 - public function set_edit_url_foundposts($foundposts)
709 - {
710 - $all_posts = [];
711 - foreach ($foundposts as $key => $post) {
712 - $edit_url = get_edit_post_link($post);
713 - $all_posts[$key]['title'] = get_the_title($post->ID);
714 - $all_posts[$key]['link'] = $edit_url;
715 - }
716 -
717 - return $all_posts;
718 - }
719 -
720 - /**
721 - * Search Taxonomies
722 - */
723 - public function filter_all_taxonomies($all_taxonomies, $search_text)
724 - {
725 - $find_taxonomies = [];
726 -
727 - foreach ($all_taxonomies as $tax_name) {
728 - $terms = get_terms(
729 - [
730 - 'taxonomy' => $tax_name,
731 - 'hide_empty' => 1,
732 - ]
733 - );
734 -
735 - foreach ($terms as $key => $cat) {
736 - if (strpos(strtolower($cat->name), strtolower($search_text)) === false) {
737 - continue;
738 - }
739 - $find_taxonomies[$key]['name'] = $cat->name;
740 - $find_taxonomies[$key]['link'] = get_edit_term_link($cat);
741 - }
742 - }
743 -
744 - return $find_taxonomies;
745 - }
746 -
747 - /**
748 - * Search Comments
749 - */
750 - public function filter_all_comments($all_comments, $search_text)
751 - {
752 - $find_comments = [];
753 -
754 - foreach ($all_comments as $key => $comment) {
755 - if (strpos(strtolower($comment->comment_content), strtolower($search_text)) === false) {
756 - continue;
757 - }
758 - $find_comments[$key]['content'] = $comment->comment_content;
759 - $find_comments[$key]['link'] = admin_url('comment.php?action=editcomment&c=' . esc_attr($comment->comment_ID));
760 - }
761 -
762 - return $find_comments;
763 - }
764 -
765 - /**
766 - * Search Users
767 - */
768 - public function filter_all_users($all_users, $search_text)
769 - {
770 - $find_users = [];
771 -
772 - foreach ($all_users as $key => $user) {
773 - if (str_contains(strtolower($user->data->user_login), strtolower($search_text)) || str_contains(strtolower($user->data->display_name), strtolower($search_text))) {
774 - $find_users[$key]['name'] = $user->data->user_login;
775 - $find_users[$key]['display_name'] = $user->data->display_name;
776 - $find_users[$key]['link'] = admin_url('user-edit.php?user_id=' . $user->ID);
777 - }
778 - }
779 -
780 - return $find_users;
781 - }
782 -
783 - /**
784 - * Search Plugins
785 - */
786 - public function filter_all_plugins($all_plugins, $search_text)
787 - {
788 - $find_plugins = [];
789 -
790 - foreach ($all_plugins as $key => $plugin) {
791 - if (strpos(strtolower($plugin['Name']), strtolower($search_text)) === false) {
792 - continue;
793 - }
794 -
795 - $find_plugins[] = [
796 - 'name' => $plugin['Name'],
797 - 'link' => admin_url('plugins.php')
798 - ];
799 - }
800 -
801 - return $find_plugins;
802 - }
803 -
804 - // Admin Bar Body Class
805 - public function admin_bar_body_class($classes)
806 - {
807 - if (is_admin()) {
808 - $classes .= ' wp-adminify-admin-bar';
809 -
810 - $admin_bar_position = !empty($this->options['admin_bar_position']) ? $this->options['admin_bar_position'] : 'top';
811 - if ($admin_bar_position === 'top') {
812 - $classes .= ' position-top';
813 - } elseif ($admin_bar_position === 'bottom') {
814 - $classes .= ' position-bottom';
815 - }
816 -
817 - if (!empty($this->options['enable_admin_bar'])) {
818 - $classes .= ' topbar-disabled';
819 - }
820 - } else {
821 - global $pagenow;
822 -
823 - if (!is_user_logged_in() && $pagenow != 'wp-login.php') {
824 - return $classes;
825 - }
826 -
827 - $classes[] = 'wp-adminify-admin-bar';
828 -
829 - $admin_bar_position = !empty($this->options['admin_bar_position']) ? $this->options['admin_bar_position'] : 'top';
830 - if ($admin_bar_position === 'top') {
831 - $classes[] = 'admin-bar-position-top';
832 - } elseif ($admin_bar_position === 'bottom') {
833 - $classes[] = 'admin-bar-position-bottom';
834 - }
835 -
836 - if (!empty($this->options['enable_admin_bar'])) {
837 - $classes[] = 'topbar-disabled';
838 - }
839 - }
840 -
841 - return $classes;
842 - }
843 -
844 - public function get_post_types()
845 - {
846 - if (is_array($this->post_types)) {
847 - return $this->post_types;
848 - } else {
849 - $args = ['public' => true];
850 - $output = 'objects';
851 - $post_types = get_post_types($args, $output);
852 - $this->post_types = $post_types;
853 - return $post_types;
854 - }
855 - }
856 -
857 - public function legacy_admin_bar_positon()
858 - {
859 - if (!empty($this->options['admin_bar_position']) && $this->options['admin_bar_position'] == 'bottom') {
860 -
861 - $pxlbsadminify_thirdparty_css = '';
862 - $pxlbsadminify_thirdparty_css .= 'body.wp-adminify.position-bottom {
655 + <?php
656 + $output_data = ob_get_clean();
657 + echo json_encode( $output_data ) ;
658 + }
659 +
660 + die;
661 + }
662 +
663 + public function jltwp_adminify_admin_bar_css()
664 + {
665 + $current_screen = get_current_screen();
666 + $admin_bar_mode = AdminSettings::get_instance()->get();
667 + $admin_bar_mode = ( !empty($admin_bar_mode['admin_bar_mode']) ? $admin_bar_mode['admin_bar_mode'] : '' );
668 + $output_css = '';
669 + $output_css .= '<style type="text/css">';
670 + if ( !empty($current_screen->is_block_editor) ) {
671 + $output_css .= '.wp-adminify.block-editor-page .interface-interface-skeleton { top: 0 !important; border-top: 0 !important; border-left: 0 !important; }';
672 + }
673 + $admin_bar_container = ( !empty($this->options['admin_bar_container']) ? $this->options['admin_bar_container'] : 'full_container' );
674 +
675 + if ( $admin_bar_mode === 'light' ) {
676 + $light_bg_type = ( !empty($this->options['admin_bar_light_bg']) ? $this->options['admin_bar_light_bg'] : 'color' );
677 + $light_bg_color = ( !empty($this->options['admin_bar_light_bg_color']) ? $this->options['admin_bar_light_bg_color'] : '' );
678 + // Full Container Colors
679 +
680 + if ( $admin_bar_container == 'full_container' ) {
681 + if ( $light_bg_type === 'color' ) {
682 + $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 ) . ' ; }';
683 + }
684 + } elseif ( $admin_bar_container == 'admin_bar_only' ) {
685 + // Admin Bar Colors
686 + if ( $light_bg_type === 'color' ) {
687 + if ( !empty($this->options['admin_bar_light_bg_color']) ) {
688 + $output_css .= '.wp-adminify.adminify-light-mode .adminify-top_bar nav.navbar { background-color:' . esc_attr( $light_bg_color ) . ' }';
689 + }
690 + }
691 + }
692 +
693 + if ( !empty($admin_bar_colors['icon_color']) ) {
694 + $output_css .= '.adminify-top_bar nav.navbar .navbar-menu .topbar-icon { fill: ' . esc_attr( $admin_bar_colors['icon_color'] ) . ' }';
695 + }
696 + } elseif ( $admin_bar_mode === 'dark' ) {
697 + $dark_bg_type = ( isset( $this->options['admin_bar_dark_bg'] ) ? $this->options['admin_bar_dark_bg'] : 'color' );
698 +
699 + if ( $admin_bar_container == 'full_container' ) {
700 +
701 + if ( $dark_bg_type === 'color' ) {
702 + $dark_bg_color = $this->options['admin_bar_dark_bg_color'];
703 + $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 ) . ' }';
704 + } elseif ( $dark_bg_type === 'gradient' ) {
705 + $dark_gradient_bg_color = $this->options['admin_bar_dark_bg_gradient']['background-color'];
706 + $dark_gradient_color = $this->options['admin_bar_dark_bg_gradient']['background-gradient-color'];
707 + $dark_gradient_color_dir = $this->options['admin_bar_dark_bg_gradient']['background-gradient-direction'];
708 + $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 ) . '); }';
709 + }
710 +
711 + } elseif ( $admin_bar_container == 'admin_bar_only' ) {
712 +
713 + if ( $dark_bg_type === 'color' ) {
714 + $dark_bg_color = $this->options['admin_bar_dark_bg_color'];
715 + $output_css .= '.wp-adminify.adminify-dark-mode .adminify-top_bar nav.navbar{ background-color:' . esc_attr( $dark_bg_color ) . ' }';
716 + }
717 +
718 + }
719 +
720 + }
721 +
722 + // "New" Button Colors
723 + $new_btn_colors = ( !empty($this->options['admin_bar_link_color']) ? $this->options['admin_bar_link_color'] : '' );
724 + if ( !empty($new_btn_colors['link_color']) ) {
725 + $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'] ) . ' }';
726 + }
727 + if ( !empty($new_btn_colors['hover_color']) ) {
728 + $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'] ) . ' }';
729 + }
730 + if ( !empty($new_btn_colors['bg_color']) ) {
731 + $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'] ) . ';}';
732 + }
733 + // "New" Button Hover Colors
734 + $new_btn_dropwon = ( !empty($this->options['admin_bar_link_dropdown_color']) ? $this->options['admin_bar_link_dropdown_color'] : '' );
735 + if ( !empty($new_btn_dropwon['wrapper_bg']) ) {
736 + $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;}';
737 + }
738 + if ( !empty($new_btn_dropwon['bg_color']) ) {
739 + $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;}';
740 + }
741 + if ( !empty($new_btn_dropwon['link_color']) ) {
742 + $output_css .= '.wp-adminify #wpadminbar .ab-top-menu .ab-sub-wrapper .ab-submenu .ab-item { color:' . esc_attr( $new_btn_dropwon['link_color'] ) . ' !important }';
743 + }
744 + if ( !empty($new_btn_dropwon['hover_color']) ) {
745 + $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 }';
746 + }
747 + // Text Color
748 +
749 + if ( !empty($this->options['admin_bar_text_color']) ) {
750 + $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'] ) . ' }';
751 + $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'] ) . ' ; }';
752 + $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'] ) . ' ; }';
753 + $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'] ) . ' ; }';
754 + }
755 +
756 + // Icon Color
757 +
758 + if ( !empty($this->options['admin_bar_icon_color']) ) {
759 + $output_css .= '.adminify-top_bar nav.navbar .navbar-menu .topbar-icon svg path { fill:' . esc_attr( $this->options['admin_bar_icon_color'] ) . ' }';
760 + $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'] ) . ' }';
761 + }
762 +
763 + $output_css .= ' </style>';
764 + echo Utils::wp_kses_custom( $output_css ) ;
765 + }
766 +
767 + // Admin Bar Body Class
768 + public function admin_bar_body_class( $classes )
769 + {
770 +
771 + if ( is_admin() ) {
772 + $classes .= ' wp-adminify-admin-bar';
773 + $admin_bar_position = ( !empty($this->options['admin_bar_position']) ? $this->options['admin_bar_position'] : 'top' );
774 +
775 + if ( $admin_bar_position === 'top' ) {
776 + $classes .= ' position-top';
777 + } elseif ( $admin_bar_position === 'bottom' ) {
778 + $classes .= ' position-bottom';
779 + }
780 +
781 + if ( !empty($this->options['enable_admin_bar']) ) {
782 + $classes .= ' topbar-disabled';
783 + }
784 + } else {
785 + global $pagenow ;
786 + if ( !is_user_logged_in() && $pagenow != 'wp-login.php' ) {
787 + return $classes;
788 + }
789 + $classes[] = 'wp-adminify-admin-bar';
790 + $admin_bar_position = ( !empty($this->options['admin_bar_position']) ? $this->options['admin_bar_position'] : 'top' );
791 +
792 + if ( $admin_bar_position === 'top' ) {
793 + $classes[] = 'admin-bar-position-top';
794 + } elseif ( $admin_bar_position === 'bottom' ) {
795 + $classes[] = 'admin-bar-position-bottom';
796 + }
797 +
798 + if ( !empty($this->options['enable_admin_bar']) ) {
799 + $classes[] = 'topbar-disabled';
800 + }
801 + }
802 +
803 + return $classes;
804 + }
805 +
806 + public function get_post_types()
807 + {
808 +
809 + if ( is_array( $this->post_types ) ) {
810 + return $this->post_types;
811 + } else {
812 + $args = [
813 + 'public' => true,
814 + ];
815 + $output = 'objects';
816 + $post_types = get_post_types( $args, $output );
817 + $this->post_types = $post_types;
818 + return $post_types;
819 + }
820 +
821 + }
822 +
823 + public function jltwp_adminify_legacy_admin_bar_positon()
824 + {
825 + $admin_bar_position = $this->options['admin_bar_position'];
826 +
827 + if ( $admin_bar_position == 'bottom' ) {
828 + $jltwp_adminify_thirdparty_css = '';
829 + $jltwp_adminify_thirdparty_css .= 'body.wp-adminify.position-bottom {
863 830 margin-top: -28px;
864 831 padding-bottom: 28px;
865 832 }
866 833
@@ -883,105 +850,89 @@
883 850
884 851 body.wp-adminify.position-bottom #wpadminbar .quicklinks .ab-top-menu .menupop .ab-sub-wrapper .ab-submenu .menupop .ab-sub-wrapper {
885 852 bottom: -9px;
886 853 }';
887 - echo '<style>' . esc_html(wp_strip_all_tags($pxlbsadminify_thirdparty_css)) . '</style>';
888 - }
889 - }
854 + echo '<style>' . wp_strip_all_tags( $jltwp_adminify_thirdparty_css ) . '</style>' ;
855 + }
856 +
857 + }
858 +
859 + public function jltwp_adminify_add_admin_bar()
860 + {
861 + // For Testing Admin Bar on Setup Wizard
862 + // add_action('admin_head', [$this, 'jltwp_adminify_render_admin_bar']);
863 + add_action( 'in_admin_header', [ $this, 'jltwp_adminify_render_admin_bar' ], -999999999 );
864 + // on frontend area
865 + add_action( 'wp_head', [ $this, 'jltwp_adminify_render_admin_bar' ] );
866 + }
867 +
868 + public function jltwp_adminify_render_admin_bar()
869 + {
870 + global $pagenow ;
871 + if ( !is_user_logged_in() && $pagenow != 'wp-login.php' ) {
872 + return;
873 + }
874 + if ( !is_admin_bar_showing() ) {
875 + return false;
876 + }
877 + // Remove Adminbar from Gutenberg Block Editor Page
878 + if ( function_exists( 'is_gutenberg_page' ) && is_gutenberg_page() ) {
879 + // The Gutenberg plugin is on.
880 + return;
881 + }
882 +
883 + if ( function_exists( 'get_current_screen' ) ) {
884 + $current_screen = get_current_screen();
885 + if ( !empty($current_screen->is_block_editor) ) {
886 + return;
887 + }
888 + }
889 +
890 + global $wp_admin_bar ;
891 + if ( empty($wp_admin_bar) ) {
892 + return false;
893 + }
894 + $admin_bar_mode = AdminSettings::get_instance()->get();
895 + $admin_bar_mode = ( empty($admin_bar_mode['admin_bar_mode']) ? 'light' : $admin_bar_mode['admin_bar_mode'] );
896 + // Light/Dark Mode
897 + $enable_dark_mode = $admin_bar_mode != 'light';
898 + // Screen Option && Hide WP Links
899 + $enable_screen_tab = Utils::get_user_preference( 'screen_options_tab' );
900 + $enable_help_tab = Utils::get_user_preference( 'adminify_help_tab' );
901 + // $enable_hide_wp_links = Utils::get_user_preference( 'hide_wp_links' );
902 + // Admin Bar Position
903 +
904 + if ( !empty($this->options['admin_bar_position']) && $this->options['admin_bar_position'] === 'top' ) {
905 + $admin_bar_position = 'top_bar';
906 + } elseif ( !empty($this->options['admin_bar_position']) && $this->options['admin_bar_position'] === 'bottom' ) {
907 + $admin_bar_position = 'bottom_bar is-fixed-bottom';
908 + } else {
909 + $admin_bar_position = 'top_bar';
910 + }
911 +
912 + $current_user = wp_get_current_user();
913 + ob_start();
914 + // Temporarily removing Topbar
915 + // <div class="wp-adminify-topbar-loader"></div>
916 + // 17-7-23, removed opacity for Conflicting Opacity Issue
917 + // <div class="wp-adminify adminify-top_bar" style="opacity: 0;">
918 + ?>
890 919
891 - public function add_admin_bar()
892 - {
893 - // For Testing Admin Bar on Setup Wizard
894 - // add_action('admin_head', [$this, 'render_admin_bar']);
895 920
896 - add_action('in_admin_header', [$this, 'render_admin_bar'], -999999999);
897 - // on frontend area
898 - add_action('wp_head', [$this, 'render_admin_bar']);
899 - }
900 921
901 -
902 - public function render_admin_bar()
903 - {
904 -
905 - global $pagenow;
906 - if (!is_user_logged_in() && $pagenow != 'wp-login.php') {
907 - return;
908 - }
909 -
910 - // Check Gutenberg Editor Page
911 - // if (Utils::is_block_editor_page()) {
912 - // return;
913 - // }
914 -
915 - // if (!is_admin_bar_showing()) {
916 - // return false;
917 - // }
918 -
919 - // Remove Adminbar from Gutenberg Block Editor Page
920 - // if (function_exists('is_gutenberg_page') && is_gutenberg_page()) {
921 - // // The Gutenberg plugin is on.
922 - // return;
923 - // }
924 - // if (function_exists('get_current_screen')) {
925 - // $current_screen = get_current_screen();
926 - // if (!empty($current_screen->is_block_editor)) {
927 - // return;
928 - // }
929 - // }
930 -
931 - global $wp_admin_bar;
932 -
933 - if (empty($wp_admin_bar)) {
934 - return false;
935 - }
936 -
937 - $admin_bar_mode = empty($admin_bar_mode['light_dark_mode']['admin_ui_mode']) ? 'light' : $admin_bar_mode['light_dark_mode']['admin_ui_mode'];
938 -
939 - // Light/Dark Mode
940 - $enable_dark_mode = $admin_bar_mode != 'light';
941 -
942 - // Screen Option && Hide WP Links
943 - $enable_screen_tab = Utils::get_user_preference('screen_options_tab');
944 - $enable_help_tab = Utils::get_user_preference('adminify_help_tab');
945 - // $enable_hide_wp_links = Utils::get_user_preference( 'hide_wp_links' );
946 -
947 - // Admin Bar Position
948 - if (!empty($this->options['admin_bar_position']) && $this->options['admin_bar_position'] === 'top') {
949 - $admin_bar_position = 'top_bar';
950 - } elseif (!empty($this->options['admin_bar_position']) && $this->options['admin_bar_position'] === 'bottom') {
951 - $admin_bar_position = 'bottom_bar is-fixed-bottom';
952 - } else {
953 - $admin_bar_position = 'top_bar';
954 - }
955 -
956 - $current_user = wp_get_current_user();
957 -
958 - ob_start();
959 -
960 - // Temporarily removing Topbar
961 - // <div class="wp-adminify-topbar-loader"></div>
962 -
963 - // 17-7-23, removed opacity for Conflicting Opacity Issue
964 - // <div class="wp-adminify adminify-top_bar" style="opacity: 0;">
965 - ?>
966 -
967 -
968 -
969 922 <div class="wp-adminify adminify-top_bar">
970 - <nav class="navbar adminify-top-navbar <?php echo esc_attr($admin_bar_position); ?>">
923 + <nav class="navbar adminify-top-navbar <?php
924 + echo esc_attr( $admin_bar_position ) ;
925 + ?>">
971 926
972 - <?php $this->logo(); ?>
927 + <?php
928 + $this->jltwp_adminify_logo();
929 + ?>
973 930 <div class="adminify-admin-wrapper">
974 931 <div class="adminify-legacy-admin">
975 - <div class="adminify-hamburger navbar-burger" data-target="wp-adminify-top-adminbar">
976 - <svg width="11" height="8" viewBox="0 0 11 8" fill="none" xmlns="http://www.w3.org/2000/svg">
977 - <path d="M7 0H0V1H7V0Z" fill="#48455F" />
978 - <path d="M7 7H0V8H7V7Z" fill="#48455F" />
979 - <path d="M4.67 3.5H0V4.5H4.67V3.5Z" fill="#48455F" />
980 - <path d="M9.65 7.35L6.29 4L9.65 0.65L10.35 1.35L7.71 4L10.35 6.65L9.65 7.35Z" fill="#48455F" />
981 - </svg>
982 - </div>
983 - <?php wp_admin_bar_render(); ?>
932 + <?php
933 + echo wp_admin_bar_render() ;
934 + ?>
984 935 </div>
985 936
986 937 <div id="wp-adminify-top-adminbar" class="navbar-menu">
987 938
@@ -987,194 +938,499 @@
987 938
988 939 <div class="navbar-end">
989 940 <div class="field is-grouped">
990 941
991 - <?php echo wp_kses_post($this->dark_mode_switcher_dom()) ?>
942 + <?php
943 +
944 + if ( !empty($this->options['admin_bar_dark_light_btn']) ) {
945 + ?>
946 + <div class="wp-admnify--mode--switcher pr-4">
947 + <label class="admnify-switcher is-pulled-right">
948 + <input type="checkbox" id="light-dark-switcher-btn" <?php
949 + checked( $enable_dark_mode, 1 );
950 + ?>>
951 + <span class="slider round"></span>
952 + </label>
953 + </div>
954 + <?php
955 + }
956 +
957 + ?>
992 958
993 - <?php if (!empty($this->options['admin_bar_notif'])) { ?>
994 - <div class="wp-adminify--top--comment">
959 + <?php
960 +
961 + if ( !empty($this->options['admin_bar_comments']) ) {
962 + ?>
963 + <div class="wp-adminify--top--comment ml-4 mr-4">
995 964 <button class="comment-trigger is-clickable">
996 965 <div class="topbar-icon">
997 966 <svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
998 - <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)" />
967 + <path d="M0.25 13.75V1.75C0.25 0.921573 0.921572 0.25 1.75 0.25H12.25C13.0784 0.25 13.75 0.921573 13.75 1.75V9.25C13.75 10.0784 13.0784 10.75 12.25 10.75H4.75C4.42535 10.7494 4.10936 10.8547 3.85 11.05L0.25 13.75ZM1.75 1.75V10.75L3.3505 9.55C3.60973 9.35448 3.9258 9.24913 4.2505 9.25H12.25V1.75H1.75Z" fill="#4E4B66" />
999 968 </svg>
1000 969 </div>
1001 - <span class="comment-counter">
1002 - <?php
1003 - $comments_count = wp_count_comments();
1004 - echo esc_html($comments_count->moderated);
1005 - ?>
970 + <span class="comment-counter p-0 tag is-rounded">
971 + <?php
972 + $comments_count = wp_count_comments();
973 + echo esc_html( $comments_count->moderated ) ;
974 + ?>
1006 975 </span>
1007 976 </button>
1008 977 </div>
1009 978
1010 - <?php
1011 - }
1012 - ?>
979 + <?php
980 + }
981 +
982 +
983 + if ( !empty($this->options['admin_bar_view_website']) ) {
984 + ?>
985 + <div class="wp-adminify--preview mr-4">
986 + <a class="preview-trigger is-clickable" href="<?php
987 + echo esc_url( get_home_url() ) ;
988 + ?>" <?php
989 + if ( !empty($this->options['admin_bar_view_website_window_type']) && $this->options['admin_bar_view_website_window_type'] == 'new_tab' ) {
990 + ?> target="_blank" <?php
991 + }
992 + ?>>
993 + <i class="dashicons dashicons-visibility"></i>
994 + </a>
995 + </div>
996 + <?php
997 + }
998 +
999 + ?>
1013 1000
1014 - <div class="wp-adminify--preview">
1015 - <a class="preview-trigger is-clickable" href="<?php echo esc_url(get_home_url()); ?>" target="_blank">
1016 - <i class="dashicons dashicons-visibility"></i>
1017 - </a>
1018 - </div>
1019 -
1020 1001 <div class="wp-adminify--user--account">
1021 1002 <button class="user-avatar is-clickable">
1022 1003 <div class="image is-45x45">
1023 - <?php echo get_avatar($current_user->user_email, 45, '', '', ['class' => 'is-rounded']); ?>
1004 + <?php
1005 + echo get_avatar(
1006 + $current_user->user_email,
1007 + 45,
1008 + '',
1009 + '',
1010 + [
1011 + 'class' => 'is-rounded',
1012 + ]
1013 + ) ;
1014 + ?>
1024 1015 </div>
1025 1016 <span class="user-status tag p-0 is-rounded"></span>
1026 1017 </button>
1018 + </div>
1027 1019
1028 - <?php if (!empty($this->adminify_ui)) { ?>
1029 - <div class="wp-adminify--user--wrapper">
1030 - <div class="wp-adminify-user-info">
1031 - <h3 class="wp-adminify-user-name">
1032 - <?php echo esc_html($current_user->display_name); ?>
1033 - </h3>
1034 - <span><?php echo wp_kses_post(is_email($current_user->user_email)); ?></span>
1035 -
1036 - <ul>
1037 - <hr>
1038 - <li>
1039 - <a href="<?php echo esc_url(admin_url('profile.php')); ?>">
1040 - <svg class="wp-adminify-profile-icon" width="16" height="18" viewBox="0 0 16 18" fill="none" xmlns="http://www.w3.org/2000/svg">
1041 - <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>
1042 - </svg>
1043 - <span><?php esc_html_e('View Profile', 'adminify'); ?></span>
1044 - </a>
1045 - </li>
1046 - <hr>
1047 - <li>
1048 - <a href="<?php echo esc_url(wp_logout_url(home_url())); ?>" class="wp-adminify-logout">
1049 - <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
1050 - <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>
1051 - </svg>
1052 - <span><?php echo esc_html__('Log Out', 'adminify'); ?></span>
1053 - </a>
1054 - </li>
1055 - </ul>
1056 - </div>
1057 - </div>
1058 - <?php } ?>
1059 - </div>
1060 1020 </div>
1061 1021 </div>
1062 1022 </div>
1063 1023 </div>
1064 1024 </nav>
1065 - </div>
1066 1025
1067 - <?php
1068 - $output_wp_admin_bar = ob_get_clean();
1069 - echo wp_kses( $output_wp_admin_bar, Utils::kses_allowed_html() );
1070 - }
1026 + <?php
1027 +
1028 + if ( !empty($this->options['admin_bar_user_offcanvas_menu']) ) {
1029 + ?>
1030 + <div class="wp-adminify--user--wrapper">
1031 + <div class="user-wqrapper-inner">
1032 + <button class="user-wrapper-close is-clickable">
1033 + <img src="<?php
1034 + echo esc_url( WP_ADMINIFY_ASSETS ) ;
1035 + ?>images/header/close.svg" alt="Close Icon">
1036 + </button>
1071 1037
1072 - public function logo()
1073 - {
1074 - global $wp_admin_bar;
1075 - $adminurl = get_admin_url();
1076 - $homeurl = $adminurl;
1038 + <div class="user-wrapper-top media">
1039 + <figure class="media-left">
1040 + <p class="image is-85x85">
1041 + <?php
1042 + echo get_avatar(
1043 + $current_user->user_email,
1044 + 85,
1045 + '',
1046 + '',
1047 + [
1048 + 'class' => 'is-rounded',
1049 + ]
1050 + ) ;
1051 + ?>
1052 + </p>
1053 + </figure>
1054 + <div class="media-content">
1055 + <div class="content">
1056 + <h3 class="name">
1057 + <?php
1058 + echo esc_html( $current_user->display_name ) ;
1059 + ?>
1060 + </h3>
1061 + <a href="<?php
1062 + echo esc_url( admin_url( 'profile.php' ) ) ;
1063 + ?>" class="email">
1064 + <?php
1065 + echo wp_kses_post( is_email( $current_user->user_email ) ) ;
1066 + ?>
1067 + </a>
1068 + <br>
1069 + <a href="<?php
1070 + echo esc_url( wp_logout_url() ) ;
1071 + ?>" class="logout button">
1072 + <?php
1073 + echo esc_html__( 'Log Out', 'adminify' ) ;
1074 + ?>
1075 + </a>
1076 + </div>
1077 + </div>
1078 + </div>
1077 1079
1078 - // Light Logo
1079 - // menu_layout_settings.layout_type / .menu_mode were read here
1080 - // previously but the resulting locals were never used
1081 - // downstream. Removed because layout_type === 'horizontal' is
1082 - // a Pro-only feature whose handler now lives in
1083 - // Pro/Classes/OutputCSS_Body_Pro.php.
1084 - $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';
1085 1080
1086 - $light_mode = !empty($this->options['light_dark_mode']['admin_ui_light_mode']) ? $this->options['light_dark_mode']['admin_ui_light_mode'] : '';
1081 + <div class="user-wrapper-content">
1082 + <div class="panel-insider">
1083 + <h4 class="title"><?php
1084 + esc_html__( 'Overview', 'adminify' );
1085 + ?></h4>
1086 + <ul>
1087 + <li>
1088 + <a href="<?php
1089 + echo esc_url( get_home_url() ) ;
1090 + ?>" target="_blank">
1091 + <img class="user-panel-icon" src="<?php
1092 + echo esc_url( WP_ADMINIFY_ASSETS ) ;
1093 + ?>images/header/panel/building.svg" alt="<?php
1094 + echo esc_html__( 'View Website Icon', 'adminify' ) ;
1095 + ?>">
1096 + <?php
1097 + echo esc_html_e( 'View Website', 'adminify' ) ;
1098 + ?>
1099 + </a>
1100 + </li>
1101 + <li>
1102 + <a href="<?php
1103 + echo esc_url( admin_url( 'profile.php' ) ) ;
1104 + ?>">
1105 + <img class="user-panel-icon" src="<?php
1106 + echo esc_url( WP_ADMINIFY_ASSETS ) ;
1107 + ?>images/header/panel/users.svg" alt="<?php
1108 + echo esc_html__( 'Profile Icon', 'adminify' ) ;
1109 + ?>">
1110 + <?php
1111 + esc_html_e( 'View Profile', 'adminify' );
1112 + ?>
1113 + </a>
1114 + </li>
1115 + </ul>
1116 + </div>
1087 1117
1088 - $light_logo = '';
1089 - $light_mini_logo = '';
1090 - if ($admin_ui_logo_type == 'image_logo') {
1091 - if (isset($light_mode['mini_admin_ui_light_logo']['url']) && $light_mode['mini_admin_ui_light_logo']['url']) {
1092 - $light_mini_logo = $light_mode['mini_admin_ui_light_logo']['url'];
1093 - } else {
1094 - $light_mini_logo = PXLBSADMINIFY_ASSETS_IMAGE . 'logos/mini-logo-light.svg';
1095 - }
1118 + <?php
1119 + $all_updates = Utils::get_all_updates();
1120 + $total_updates = $all_updates['total'];
1121 + $plugin_updates = $all_updates['plugin'];
1122 + $theme_updates = $all_updates['theme'];
1123 + $wp_updates = $all_updates['wordpress'];
1124 + ?>
1096 1125
1097 - // Logo Image
1098 - if (!empty($light_mode['admin_ui_light_logo']['url'])) {
1099 - $light_logo = $light_mode['admin_ui_light_logo']['url'];
1100 - } else {
1101 - $light_logo = PXLBSADMINIFY_ASSETS_IMAGE . 'logos/logo-text-light.svg';
1102 - }
1103 - } elseif ($admin_ui_logo_type == 'text_logo') {
1104 - // Text Logo
1105 - if ($this->options['light_dark_mode']['admin_ui_mode'] == 'light') {
1106 - $text_logo = $light_mode['admin_ui_light_logo_text'];
1107 - }
1108 - }
1109 1126
1110 - // Logo Size
1111 - $light_width = !empty($light_mode['light_logo_size']['width']) ? $light_mode['light_logo_size']['width'] : '120';
1112 - $light_height = !empty($light_mode['light_logo_size']['height']) ? $light_mode['light_logo_size']['height'] : '32';
1127 + <div class="panel-insider">
1128 + <h4 class="title"><?php
1129 + esc_html_e( 'Updates', 'adminify' );
1130 + ?></h4>
1131 + <?php
1132 +
1133 + if ( $total_updates < 1 ) {
1134 + ?>
1135 + <p class="adminify-meta">
1136 + <?php
1137 + esc_html_e( 'Everything is up to date', 'adminify' );
1138 + ?>
1139 + </p>
1140 + <?php
1141 + } else {
1142 + ?>
1143 + <ul>
1113 1144
1114 - // Dark Logo
1115 - $dark_mode = !empty($this->options['light_dark_mode']['admin_ui_dark_mode']) ? $this->options['light_dark_mode']['admin_ui_dark_mode'] : '';
1145 + <li>
1146 + <a href="<?php
1147 + echo esc_url( admin_url( 'update-core.php' ) ) ;
1148 + ?>">
1149 + <span class="icon-reload"></span>
1150 + <?php
1151 + esc_html_e( 'All Updates', 'adminify' );
1152 + ?>
1153 + <span class="count tag is-rounded">
1154 + <?php
1155 + echo esc_html( $total_updates ) ;
1156 + ?>
1157 + </span>
1158 + </a>
1159 + </li>
1160 + <li>
1161 + <a href="<?php
1162 + echo esc_url( admin_url( 'update-core.php' ) ) ;
1163 + ?>">
1164 + <span class="dashicons dashicons-wordpress"></span>
1165 + <?php
1166 + esc_html_e( ' WordPress Core', 'adminify' );
1167 + ?>
1168 + <span class="count tag is-rounded">
1169 + <?php
1170 + echo esc_html( $wp_updates ) ;
1171 + ?>
1172 + </span>
1173 + </a>
1174 + </li>
1175 + <li>
1176 + <a href="<?php
1177 + echo esc_url( admin_url( 'plugins.php' ) ) ;
1178 + ?>">
1179 + <span class="icon-energy"></span>
1180 + <?php
1181 + esc_html_e( ' Plugins', 'adminify' );
1182 + ?>
1183 + <span class="count tag is-rounded"><?php
1184 + echo esc_html( count( $plugin_updates ) ) ;
1185 + ?></span>
1186 + </a>
1187 + </li>
1188 + <li>
1189 + <a href="<?php
1190 + echo esc_url( admin_url( 'themes.php' ) ) ;
1191 + ?>">
1192 + <img class="user-panel-icon" src="<?php
1193 + echo esc_url( WP_ADMINIFY_ASSETS ) ;
1194 + ?>images/header/panel/plugins.svg" />
1195 + <?php
1196 + esc_html_e( ' Themes', 'adminify' );
1197 + ?>
1198 + <span class="count tag is-rounded"><?php
1199 + echo esc_html( count( $theme_updates ) ) ;
1200 + ?></span>
1201 + </a>
1202 + </li>
1203 + </ul>
1204 + <?php
1205 + }
1206 +
1207 + ?>
1208 + </div>
1116 1209
1117 - $dark_logo = '';
1118 - $dark_mini_logo = '';
1119 - if ($admin_ui_logo_type == 'image_logo') {
1120 - if (isset($dark_mode['mini_admin_ui_dark_logo']['url']) && $dark_mode['mini_admin_ui_dark_logo']['url']) {
1121 - $dark_mini_logo = $dark_mode['mini_admin_ui_dark_logo']['url'];
1122 - } else {
1123 - $dark_mini_logo = PXLBSADMINIFY_ASSETS_IMAGE . 'logos/mini-logo-dark.svg';
1124 - }
1125 - // Dark Logo Image
1126 - if (isset($dark_mode['admin_ui_dark_logo']['url']) && $dark_mode['admin_ui_dark_logo']['url']) {
1127 - $dark_logo = $dark_mode['admin_ui_dark_logo']['url'];
1128 - } else {
1129 - $dark_logo = PXLBSADMINIFY_ASSETS_IMAGE . 'logos/logo-text-dark.svg';
1130 - }
1131 - } elseif ($admin_ui_logo_type == 'text_logo') {
1132 - // Text Logo
1133 - if ($this->options['light_dark_mode']['admin_ui_mode'] == 'dark') {
1134 - $text_logo = $dark_mode['admin_ui_dark_logo_text'];
1135 - }
1136 - }
1210 + <div class="panel-insider">
1211 + <h4 class="title"><?php
1212 + esc_html_e( 'Preferences', 'adminify' );
1213 + ?></h4>
1214 + <ul>
1215 + <li>
1216 + <?php
1217 + esc_html_e( 'Screen Tab Hide', 'adminify' );
1218 + ?>
1219 + <label class="admnify-switcher is-pulled-right">
1220 + <input type="checkbox" id="screen-option-switcher-btn" <?php
1221 + checked( $enable_screen_tab, 1 );
1222 + ?>>
1223 + <span class="slider round"></span>
1224 + </label>
1225 + </li>
1226 + <li>
1227 + <?php
1228 + esc_html_e( 'Help Tab Hide ', 'adminify' );
1229 + ?>
1230 + <label class="admnify-switcher is-pulled-right">
1231 + <input type="checkbox" id="help-option-switcher-btn" <?php
1232 + checked( $enable_help_tab, 1 );
1233 + ?>>
1234 + <span class="slider round"></span>
1235 + </label>
1236 + </li>
1237 + <?php
1238 + $on = false;
1239 + // temporary hide this menu
1240 +
1241 + if ( $on == true ) {
1242 + ?>
1243 + <li>
1244 + <?php
1245 + esc_html_e( 'Hide WP Links', 'adminify' );
1246 + ?>
1247 + <label class="admnify-switcher is-pulled-right">
1248 + <input type="checkbox" id="hide-wp-links-switcher-btn" <?php
1249 + checked( $enable_hide_wp_links, 1 );
1250 + ?>>
1251 + <span class="slider round"></span>
1252 + </label>
1253 + </li>
1254 + <?php
1255 + }
1256 +
1257 + ?>
1258 + </ul>
1259 + </div>
1260 + </div>
1137 1261
1138 - // Dark Logo Size
1139 - $dark_width = !empty($dark_mode['dark_logo_size']['width']) ? $dark_mode['dark_logo_size']['width'] : '120';
1140 - $dark_height = !empty($dark_mode['dark_logo_size']['height']) ? $dark_mode['dark_logo_size']['height'] : '32';
1262 + <!-- <div class="user-notification-area pb-5">
1263 + <h4>
1264 + <?php
1265 + // esc_html_e('All Notifications', 'adminify');
1266 + ?>
1267 + </h4>
1268 + <ul class="m-0 p-0">
1269 + <li>
1270 + <a href="#">Dashboard: <span class="count has-text-centered is-pulled-right">2</span></a>
1271 + </li>
1272 + <li>
1273 + <a href="#">Themes: <span class="count has-text-centered is-pulled-right">2</span></a>
1274 + </li>
1275 + <li>
1276 + <a href="#">Plugins: <span class="count has-text-centered is-pulled-right">2</span></a>
1277 + </li>
1278 + <li>
1279 + <a href="#">Settings: <span class="count has-text-centered is-pulled-right">2</span></a>
1280 + </li>
1281 + </ul>
1282 + </div> -->
1141 1283
1142 - ?>
1284 + </div>
1285 + </div>
1286 + <?php
1287 + }
1288 +
1289 + ?>
1290 + </div>
1143 1291
1292 + <?php
1293 + $output_wp_admin_bar = ob_get_clean();
1294 + echo Utils::wp_kses_custom( $output_wp_admin_bar ) ;
1295 + }
1296 +
1297 + public function jltwp_adminify_logo()
1298 + {
1299 + global $wp_admin_bar ;
1300 + $adminurl = get_admin_url();
1301 + $homeurl = $adminurl;
1302 + // Light Logo
1303 + $admin_bar_mode = AdminSettings::get_instance()->get();
1304 + $menu_layout = (array) $admin_bar_mode['menu_layout_settings'];
1305 + // Menu Layouts
1306 + $menu_layout = ( !empty($admin_bar_mode['menu_layout_settings']) ? $admin_bar_mode['menu_layout_settings'] : '' );
1307 + $menu_mode = ( !empty($menu_layout['menu_mode']) ? $menu_layout['menu_mode'] : 'classic' );
1308 + $menu_layout = ( !empty($menu_layout['layout_type']) ? $menu_layout['layout_type'] : 'vertical' );
1309 + $admin_bar_logo_type = ( !empty($admin_bar_mode['admin_bar_logo_type']) ? $admin_bar_mode['admin_bar_logo_type'] : 'image_logo' );
1310 + $light_mode = ( !empty($admin_bar_mode['admin_bar_light_mode']) ? $admin_bar_mode['admin_bar_light_mode'] : '' );
1311 +
1312 + if ( $admin_bar_logo_type == 'image_logo' ) {
1313 + // Logo Image
1314 +
1315 + if ( !empty($light_mode['admin_bar_light_logo']['url']) ) {
1316 + $light_logo = $light_mode['admin_bar_light_logo']['url'];
1317 + } else {
1318 +
1319 + if ( $menu_layout == 'vertical' && $menu_mode == 'icon_menu' ) {
1320 + $light_logo = WP_ADMINIFY_ASSETS_IMAGE . 'logos/logo-text-light.svg';
1321 + } else {
1322 + $light_logo = WP_ADMINIFY_ASSETS_IMAGE . 'logos/logo-text-light.svg';
1323 + }
1324 +
1325 + }
1326 +
1327 + } elseif ( $admin_bar_logo_type == 'text_logo' ) {
1328 + // Text Logo
1329 + if ( $admin_bar_mode['admin_bar_mode'] == 'light' ) {
1330 + $text_logo = $light_mode['admin_bar_light_logo_text'];
1331 + }
1332 + }
1333 +
1334 + // Logo Size
1335 + $light_width = ( isset( $light_mode['light_logo_size']['width'] ) ? $light_mode['light_logo_size']['width'] : '150' );
1336 + $light_height = ( isset( $light_mode['light_logo_size']['height'] ) ? $light_mode['light_logo_size']['height'] : '45' );
1337 + // Dark Logo
1338 + $dark_mode = ( !empty($admin_bar_mode['admin_bar_dark_mode']) ? $admin_bar_mode['admin_bar_dark_mode'] : '' );
1339 +
1340 + if ( $admin_bar_logo_type == 'image_logo' ) {
1341 + // Dark Logo Image
1342 +
1343 + if ( isset( $dark_mode['admin_bar_dark_logo']['url'] ) && $dark_mode['admin_bar_dark_logo']['url'] ) {
1344 + $dark_logo = $dark_mode['admin_bar_dark_logo']['url'];
1345 + } else {
1346 +
1347 + if ( $menu_layout == 'vertical' && $menu_mode === 'icon_menu' ) {
1348 + $dark_logo = WP_ADMINIFY_ASSETS_IMAGE . 'logos/logo-text-dark.svg';
1349 + } else {
1350 + $dark_logo = WP_ADMINIFY_ASSETS_IMAGE . 'logos/logo-text-dark.svg';
1351 + }
1352 +
1353 + }
1354 +
1355 + } elseif ( $admin_bar_logo_type == 'text_logo' ) {
1356 + // Text Logo
1357 + if ( $admin_bar_mode['admin_bar_mode'] == 'dark' ) {
1358 + $text_logo = $dark_mode['admin_bar_dark_logo_text'];
1359 + }
1360 + }
1361 +
1362 + // Dark Logo Size
1363 + $dark_width = ( isset( $dark_mode['dark_logo_size']['width'] ) ? $dark_mode['dark_logo_size']['width'] : '150' );
1364 + $dark_height = ( isset( $dark_mode['dark_logo_size']['height'] ) ? $dark_mode['dark_logo_size']['height'] : '45' );
1365 + ?>
1366 +
1144 1367 <div class="navbar-brand">
1145 - <a class="navbar-item p-0" href="<?php echo esc_url($homeurl); ?>">
1146 - <?php if ($admin_ui_logo_type == 'image_logo') { ?>
1147 - <!-- Light Logo -->
1148 - <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); ?>">
1149 - <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">
1150 - <!-- Dark Logo -->
1151 - <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); ?>">
1152 - <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">
1153 - <?php } elseif ($admin_ui_logo_type == 'text_logo') { ?>
1368 + <a class="navbar-item p-0" href="<?php
1369 + echo esc_url( $homeurl ) ;
1370 + ?>">
1371 + <?php
1372 +
1373 + if ( $admin_bar_logo_type == 'image_logo' ) {
1374 + ?>
1375 + <img alt="<?php
1376 + echo esc_attr( get_bloginfo( 'name' ) ) ;
1377 + ?>" class="logo-light" src="<?php
1378 + echo esc_url( $light_logo ) ;
1379 + ?>" width="<?php
1380 + echo esc_attr( $light_width ) ;
1381 + ?>" height="<?php
1382 + echo esc_attr( $light_height ) ;
1383 + ?>">
1384 + <img alt="<?php
1385 + echo esc_attr( get_bloginfo( 'name' ) ) ;
1386 + ?>" class="logo-dark" src="<?php
1387 + echo esc_url( $dark_logo ) ;
1388 + ?>" width="<?php
1389 + echo esc_attr( $dark_width ) ;
1390 + ?>" height="<?php
1391 + echo esc_attr( $dark_height ) ;
1392 + ?>">
1393 + <?php
1394 + } elseif ( $admin_bar_logo_type == 'text_logo' ) {
1395 + ?>
1154 1396 <span class="wp-adminify-site-name">
1155 - <?php echo esc_html($text_logo); ?>
1397 + <?php
1398 + echo esc_html( $text_logo ) ;
1399 + ?>
1156 1400 </span>
1157 - <?php } ?>
1401 + <?php
1402 + }
1403 +
1404 + ?>
1158 1405 </a>
1159 1406
1160 - <!-- <div class="navbar-burger" data-target="wp-adminify-top-adminbar">
1161 - <img src="<?php // echo PXLBSADMINIFY_ASSETS_IMAGE . 'icons/toggol.svg';
1162 - ?>" alt="Toggol icon"/>
1163 - </div> -->
1164 1407
1408 + <div class="navbar-burger" data-target="wp-adminify-top-adminbar">
1409 + <i class="dashicons dashicons-menu-alt"></i>
1410 + </div>
1411 +
1165 1412 </div>
1166 1413
1167 -<?php
1168 - }
1414 +<?php
1415 + }
1416 +
1417 + /* Remove from the administration bar */
1418 + public function jltma_adminify_remove_admin_bar_menus()
1419 + {
1420 + global $wp_admin_bar ;
1421 + $restricted_user = ( !empty($this->options['admin_bar_new_button_user_roles']) ? $this->options['admin_bar_new_button_user_roles'] : '' );
1422 + if ( $restricted_user ) {
1423 +
1424 + if ( Utils::restrict_for( $this->options['admin_bar_new_button_user_roles'] ) ) {
1425 + $wp_admin_bar->remove_menu( 'new-content' );
1426 + return;
1427 + }
1428 +
1429 + }
1430 + $wp_admin_bar->remove_menu( 'wp-logo' );
1431 + $wp_admin_bar->remove_menu( 'site-name' );
1432 + $wp_admin_bar->remove_menu( 'updates' );
1433 + $wp_admin_bar->remove_menu( 'menu-toggle' );
1434 + }
1169 1435
1170 -
1171 - /* Remove from the administration bar */
1172 - public function remove_admin_bar_menus()
1173 - {
1174 - global $wp_admin_bar;
1175 - $wp_admin_bar->remove_menu('wp-logo');
1176 - $wp_admin_bar->remove_menu('site-name');
1177 - $wp_admin_bar->remove_menu('updates');
1178 - $wp_admin_bar->remove_menu('menu-toggle');
1179 - }
1180 -}
1436 +}