options = (array) AdminSettings::get_instance()->get( 'admin_bar_settings' ); $admin_bar_user_roles = ( !empty($this->options['admin_bar_user_roles']) ? $this->options['admin_bar_user_roles'] : '' ); if ( Utils::restricted_for( $admin_bar_user_roles ) ) { return; } $admin_bar_position = ( !empty($this->options['admin_bar_position']) ? $this->options['admin_bar_position'] : 'top' ); // Disable the default admin bar // add_filter('show_admin_bar', '__return_false'); // Add admin-bar support if not already activated add_theme_support( 'admin-bar', array( 'callback' => '__return_false', ) ); if ( is_admin() ) { if ( $admin_bar_position == 'top' ) { add_action( 'admin_head', [ $this, 'jltwp_adminify_render_admin_bar' ] ); } elseif ( $admin_bar_position == 'bottom' ) { add_action( 'admin_head', [ $this, 'jltwp_adminify_render_admin_bar' ] ); } // Remove Unnecessary Menus from Admin bar add_action( 'wp_before_admin_bar_render', [ $this, 'jltma_adminify_remove_admin_bar_menus' ], 0 ); add_filter( 'admin_body_class', [ $this, 'admin_bar_body_class' ] ); add_action( 'admin_head', [ $this, 'jltwp_adminify_admin_bar_css' ], 999 ); add_action( 'wp_ajax_adminify_all_search', [ $this, 'adminify_all_search' ] ); add_action( 'wp_ajax_wp_adminify_color_mode', [ $this, 'wp_adminify_color_mode' ] ); add_action( 'admin_enqueue_scripts', [ $this, 'jltwp_adminify_admin_scripts' ], 99 ); // Screen Option and Help Tab add_action( 'admin_head', [ $this, 'jltwp_adminify_remove_screen_options' ], 10, 3 ); add_action( 'admin_head', [ $this, 'jltwp_adminify_remove_help_tab' ] ); } else { // Admin bar Frontend settings $frontend_admin = ( !empty($this->options['admin_bar_hide_frontend']) ? $this->options['admin_bar_hide_frontend'] : 'show' ); $this->jltwp_adminify_front_bar(); add_action( 'init', [ $this, 'admin_bar_front_style_init' ] ); if ( $frontend_admin == 'hide' ) { add_filter( 'show_admin_bar', '__return_false' ); } } } public function jltwp_adminify_front_bar() { add_action( 'admin_head', [ $this, 'jltwp_adminify_render_admin_bar' ] ); add_filter( 'body_class', [ $this, 'admin_bar_body_class' ] ); } public function admin_bar_front_style_init() { add_filter( 'wp_enqueue_scripts', [ $this, 'admin_bar_front_style' ] ); } // Frontend Admin bar style public function admin_bar_front_style() { $admin_bar_css = ''; $admin_bar_css .= '.admin-bar-position-bottom #wpadminbar{ top:auto; bottom: 0; } .admin-bar-position-bottom #wpadminbar .menupop .ab-sub-wrapper{ bottom: 32px; } @media all and (max-width:600px){ body.logged-in.admin-bar-position-bottom { position: relative; } }'; wp_add_inline_style( 'admin-bar', $admin_bar_css ); } //Remove Screen Options public function jltwp_adminify_remove_screen_options() { $enable_screen_tab = Utils::get_user_preference( 'screen_options_tab' ); if ( $enable_screen_tab ) { add_filter( 'screen_options_show_screen', '__return_false' ); } } // Contextual Help Tab Remove public function jltwp_adminify_remove_help_tab() { $enable_screen_tab = Utils::get_user_preference( 'adminify_help_tab' ); if ( $enable_screen_tab ) { $screen = get_current_screen(); $screen->remove_help_tabs(); } } // Get All registered WP Admin Menus public static function get_wp_admin_menus( $thismenu, $thissubmenu ) { $options = []; if ( !empty($thismenu) && is_array( $thismenu ) ) { foreach ( $thismenu as $item ) { if ( !empty($item[0]) ) { // the preg_replace removes "Comments" & "Plugins" menu spans. $options[$item[2]] = preg_replace( '/\\.*?\\<\\/span><\\/span>/s', '', $item[0] ); } } } if ( !empty($thissubmenu) && is_array( $thissubmenu ) ) { foreach ( $thissubmenu as $items ) { foreach ( $items as $item ) { if ( !empty($item[0]) ) { $options[$item[1]] = preg_replace( '/\\.*?\\<\\/span><\\/span>/s', '', $item[0] ); } } } } return $options; } public function jltwp_adminify_admin_scripts() { global $pagenow ; if ( !is_user_logged_in() && $pagenow != 'wp-login.php' ) { return; } if ( is_admin_bar_showing() ) { } wp_enqueue_style( 'wp-adminify-admin-bar' ); wp_enqueue_script( 'wp-adminify-admin' ); wp_localize_script( 'wp-adminify-admin', 'WPAdminify', $this->adminify_create_admin_bar_js_object() ); $this->admin_topbar_loader_css(); // wp_enqueue_style('wp-adminify-admin-bar', WP_ADMINIFY_ASSETS . 'css/admin-bar.css', false, WP_ADMINIFY_VER); // wp_enqueue_script('wp-adminify-admin', WP_ADMINIFY_ASSETS . 'js/wp-adminify.js', ['jquery'], WP_ADMINIFY_VER, true); // wp_localize_script('wp-adminify-admin', 'WPAdminify', $this->adminify_create_admin_bar_js_object()); } public function adminify_create_admin_bar_js_object() { return array( 'ajax_url' => admin_url( 'admin-ajax.php' ), 'security_nonce' => wp_create_nonce( 'adminify-admin-bar-security-nonce' ), 'notice_nonce' => wp_create_nonce( 'adminify-notice-nonce' ), ); } /** * Preloader * * @return void */ public function admin_topbar_loader_css() { $output_css = ''; $topbar_wireframe_img = WP_ADMINIFY_ASSETS_IMAGE . 'topbar-wireframe.svg'; $output_css .= '.js .wp-adminify-topbar-loader{background: url(' . $topbar_wireframe_img . '); }'; echo '' ; } /** * Save Color Mode by Ajax * * @return void */ public function wp_adminify_color_mode() { if ( defined( 'DOING_AJAX' ) && DOING_AJAX && check_ajax_referer( 'adminify-admin-bar-security-nonce', 'security' ) > 0 ) { $admin_bar_mode = AdminSettings::get_instance()->get(); $key = Utils::clean_ajax_input( $_POST['key'] ); $value = Utils::clean_ajax_input( $_POST['value'] ); if ( $key == "" ) { $message = __( "No Color Mode supplied to save", WP_ADMINIFY_TD ); echo Utils::ajax_error_message( $message ) ; die; } // Light/Dark Mode if ( $key === 'color_mode' ) { $admin_bar_mode['admin_bar_mode'] = $value; $admin_bar_mode['enable_schedule_dark_mode'] = false; update_option( '_wpadminify', $admin_bar_mode ); die; } // Screen Options, Help Tabs and WP Hide Links if ( $key === 'screen_options_tab' || $key === 'hide_wp_links' || $key === 'adminify_help_tab' ) { $userid = get_current_user_id(); $current = get_user_meta( $userid, '_wpadminify_preferences', true ); if ( is_array( $current ) ) { $current[$key] = $value; } else { $current = array(); $current[$key] = $value; } $state = update_user_meta( $userid, '_wpadminify_preferences', $current ); if ( $state ) { $returndata = array(); $returndata['success'] = true; $returndata['message'] = __( 'Preferences saved', WP_ADMINIFY_TD ); echo json_encode( $returndata ) ; } else { $message = __( "Unable to save user preferences", WP_ADMINIFY_TD ); echo Utils::ajax_error_message( $message ) ; die; } } } } /** * Search Everything * * @return void */ public function adminify_all_search() { if ( defined( 'DOING_AJAX' ) && DOING_AJAX && check_ajax_referer( 'adminify-admin-bar-security-nonce', 'security' ) > 0 ) { $term = $_POST['search']; // Search Arguments $args = array( 'numberposts' => -1, 's' => $term, 'post_status' => array( 'publish', 'pending', 'draft', 'future', 'private', 'inherit' ), ); // All Post Types $post_types = $this->get_post_types(); foreach ( $post_types as $type ) { $args['post_type'][] = $type->name; } // All Categories/Taxonomies $all_taxonomies = get_taxonomies(); // Get Comments $all_comments = get_comments(); // Get All Users $all_users = get_users(); // All Users // $blogusers = get_users(); // foreach ($blogusers as $type) { // // $name = $type->user_login; // // $id = $type->ID; // $args['author__in'][] = $type->ID; // } // // All Menus // $all_admin_menus = self::get_wp_admin_menus(); // All Plugins if ( !function_exists( 'get_plugins' ) ) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } $all_plugins = get_plugins(); $foundposts = get_posts( $args ); // $count_items = ''; // if (count($foundposts) > 0) { // $count_items .= count($foundposts); // } elseif (count($all_plugins)) { // $count_items .= count($all_plugins); // } ob_start(); ?>

s found', WP_ADMINIFY_TD ) ; ?>

post_author; $editurl = get_edit_post_link( $item ); $public = get_permalink( $item ); ?> $tax_name, 'hide_empty' => 1, ) ); foreach ( $terms as $cat ) { if ( strpos( strtolower( $cat->name ), strtolower( $term ) ) === false ) { continue; } // $user = get_userdata($cat->term_id); ?> comment_content ), strtolower( $term ) ) === false ) { continue; } ?> user_login ), strtolower( $term ) ) === false ) { continue; } ?>
name ; ?> taxonomy ; ?> N/A N/A
comment_content ; ?> comment_type ) ; ?> user_id ) ; ?> comment_date ) ; ?>
display_name ; ?> ID ) ; ?> user_registered ) ; ?>
N/A
get(); $admin_bar_mode = ( !empty($admin_bar_mode['admin_bar_mode']) ? $admin_bar_mode['admin_bar_mode'] : '' ); $output_css = ''; $output_css .= ''; echo $output_css ; } // Admin Bar Body Class public function admin_bar_body_class( $classes ) { if ( is_admin() ) { $classes .= " wp-adminify-admin-bar "; $admin_bar_position = ( !empty($this->options['admin_bar_position']) ? $this->options['admin_bar_position'] : 'top' ); if ( $admin_bar_position === 'top' ) { $classes .= " position-top "; } elseif ( $admin_bar_position === 'bottom' ) { $classes .= " position-bottom "; } if ( !empty($this->options['enable_admin_bar']) ) { $classes .= " topbar-disabled "; } } else { global $pagenow ; if ( !is_user_logged_in() && $pagenow != 'wp-login.php' ) { return; } $classes[] = " wp-adminify-admin-bar "; $admin_bar_position = ( !empty($this->options['admin_bar_position']) ? $this->options['admin_bar_position'] : 'top' ); if ( $admin_bar_position === 'top' ) { $classes[] = " admin-bar-position-top "; } elseif ( $admin_bar_position === 'bottom' ) { $classes[] = " admin-bar-position-bottom "; } if ( !empty($this->options['enable_admin_bar']) ) { $classes[] = " topbar-disabled "; } } return $classes; } public function get_post_types() { if ( is_array( $this->post_types ) ) { return $this->post_types; } else { $args = array( 'public' => true, ); $output = 'objects'; $post_types = get_post_types( $args, $output ); $this->post_types = $post_types; return $post_types; } } public function jltwp_adminify_render_admin_bar() { global $pagenow ; if ( !is_user_logged_in() && $pagenow != 'wp-login.php' ) { return; } if ( !is_admin_bar_showing() ) { return false; } global $wp_admin_bar ; if ( empty($wp_admin_bar) ) { return false; } $admin_bar_mode = AdminSettings::get_instance()->get(); $admin_bar_mode = ( !empty($admin_bar_mode['admin_bar_mode']) ? $admin_bar_mode['admin_bar_mode'] : '' ); // Light/Dark Mode if ( $admin_bar_mode == 'light' ) { $enable_dark_mode = 0; } elseif ( $admin_bar_mode == 'dark' ) { $enable_dark_mode = 1; } // Screen Option && Hide WP Links $enable_screen_tab = Utils::get_user_preference( 'screen_options_tab' ); $enable_help_tab = Utils::get_user_preference( 'adminify_help_tab' ); $enable_hide_wp_links = Utils::get_user_preference( 'hide_wp_links' ); // Admin Bar Position if ( !empty($this->options['admin_bar_position']) === 'top' ) { $admin_bar_position = 'top_bar'; } elseif ( !empty($this->options['admin_bar_position']) === 'bottom' ) { $admin_bar_position = 'bottom_bar is-fixed-bottom'; } else { $admin_bar_position = 'top_bar'; } $current_user = wp_get_current_user(); ob_start(); ?>

user_email, 85, '', '', array( 'class' => 'is-rounded', ) ) ; ?>

display_name ) ; ?>


get(); $menu_layout = (array) $admin_bar_mode['menu_layout_settings']; // Menu Layouts $menu_layout = ( !empty($admin_bar_mode['menu_layout_settings']) ? $admin_bar_mode['menu_layout_settings'] : '' ); $menu_mode = ( !empty($menu_layout['menu_mode']) ? $menu_layout['menu_mode'] : 'classic' ); $menu_layout = ( !empty($menu_layout['layout_type']) ? $menu_layout['layout_type'] : 'vertical' ); $admin_bar_logo_type = ( !empty($admin_bar_mode['admin_bar_logo_type']) ? $admin_bar_mode['admin_bar_logo_type'] : 'image_logo' ); $light_mode = ( !empty($admin_bar_mode['admin_bar_light_mode']) ? $admin_bar_mode['admin_bar_light_mode'] : '' ); if ( $admin_bar_logo_type == 'image_logo' ) { // Logo Image if ( !empty($light_mode['admin_bar_light_logo']['url']) ) { $light_logo = $light_mode['admin_bar_light_logo']['url']; } else { if ( $menu_layout == 'vertical' && $menu_mode == 'icon_menu' ) { $light_logo = WP_ADMINIFY_ASSETS_IMAGE . 'logos/logo-text-light.svg'; } else { $light_logo = WP_ADMINIFY_ASSETS_IMAGE . 'logos/logo-text-light.svg'; } } } elseif ( $admin_bar_logo_type == 'text_logo' ) { // Text Logo $light_logo = $light_mode['admin_bar_light_logo_text']; } // Logo Size $light_width = ( isset( $light_mode['light_logo_size']['width'] ) ? $light_mode['light_logo_size']['width'] : '150' ); $light_height = ( isset( $light_mode['light_logo_size']['height'] ) ? $light_mode['light_logo_size']['height'] : '45' ); // Dark Logo $dark_mode = ( !empty($admin_bar_mode['admin_bar_dark_mode']) ? $admin_bar_mode['admin_bar_dark_mode'] : '' ); if ( $admin_bar_logo_type == 'image_logo' ) { // Dark Logo Image if ( isset( $dark_mode['admin_bar_dark_logo']['url'] ) && $dark_mode['admin_bar_dark_logo']['url'] ) { $dark_logo = $dark_mode['admin_bar_dark_logo']['url']; } else { if ( $menu_layout == 'vertical' && $menu_mode === 'icon_menu' ) { $dark_logo = WP_ADMINIFY_ASSETS_IMAGE . 'logos/logo-text-dark.svg'; } else { $dark_logo = WP_ADMINIFY_ASSETS_IMAGE . 'logos/logo-text-dark.svg'; } } } elseif ( $admin_bar_logo_type == 'text_logo' ) { // Text Logo $dark_logo = $dark_mode['admin_bar_dark_logo_text']; } // Dark Logo Size $dark_width = ( isset( $dark_mode['dark_logo_size']['width'] ) ? $dark_mode['dark_logo_size']['width'] : '150' ); $dark_height = ( isset( $dark_mode['dark_logo_size']['height'] ) ? $dark_mode['dark_logo_size']['height'] : '45' ); ?> options['admin_bar_user_roles']) ? $this->options['admin_bar_user_roles'] : '' ); if ( $restricted_user ) { if ( Utils::restrict_for( $this->options['admin_bar_user_roles'] ) ) { $wp_admin_bar->remove_menu( 'new-content' ); return; } } $wp_admin_bar->remove_menu( 'wp-logo' ); $wp_admin_bar->remove_menu( 'site-name' ); $wp_admin_bar->remove_menu( 'updates' ); $wp_admin_bar->remove_menu( 'menu-toggle' ); $wp_admin_bar->remove_menu( 'top-secondary' ); } }