Server IP : 172.67.216.182 / Your IP : 162.158.170.172 Web Server : Apache System : Linux krdc-ubuntu-s-2vcpu-4gb-amd-blr1-01.localdomain 5.15.0-142-generic #152-Ubuntu SMP Mon May 19 10:54:31 UTC 2025 x86_64 User : www ( 1000) PHP Version : 7.4.33 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /www/wwwroot/coircraft.com/wp-content/plugins/wp-mail-smtp/src/Admin/ |
Upload File : |
<?php namespace WPMailSMTP\Admin; use WPMailSMTP\Debug; use WPMailSMTP\Options; /** * WP Mail SMTP admin bar menu. * * @since 2.3.0 */ class AdminBarMenu { /** * Initialize class. * * @since 2.3.0 */ public function init() { $this->hooks(); } /** * Register hooks. * * @since 2.3.0 */ public function hooks() { add_action( 'wp_enqueue_scripts', [ $this, 'enqueues' ] ); add_action( 'admin_enqueue_scripts', [ $this, 'enqueues' ] ); add_action( 'admin_bar_menu', [ $this, 'register' ], 999 ); } /** * Check if current user has access to see admin bar menu. * * @since 2.3.0 * * @return bool */ public function has_access() { $access = false; if ( is_user_logged_in() && current_user_can( 'manage_options' ) ) { $access = true; } return apply_filters( 'wp_mail_smtp_admin_adminbarmenu_has_access', $access ); } /** * Check if new notifications are available. * * @since 2.3.0 * * @return bool */ public function has_notifications() { return wp_mail_smtp()->get_notifications()->get_count(); } /** * Enqueue styles. * * @since 2.3.0 */ public function enqueues() { if ( ! is_admin_bar_showing() ) { return; } if ( ! $this->has_access() ) { return; } wp_enqueue_style( 'wp-mail-smtp-admin-bar', wp_mail_smtp()->assets_url . '/css/admin-bar.min.css', [], WPMS_PLUGIN_VER ); } /** * Register and render admin menu bar. * * @since 2.3.0 * * @param \WP_Admin_Bar $wp_admin_bar WordPress Admin Bar object. */ public function register( \WP_Admin_Bar $wp_admin_bar ) { if ( ! $this->has_access() || ( ( empty( Debug::get_last() ) || (bool) Options::init()->get( 'general', 'email_delivery_errors_hidden' ) ) && empty( $this->has_notifications() ) ) ) { return; } $items = apply_filters( 'wp_mail_smtp_admin_adminbarmenu_register', [ 'main_menu', ], $wp_admin_bar ); foreach ( $items as $item ) { $this->{ $item }( $wp_admin_bar ); do_action( "wp_mail_smtp_admin_adminbarmenu_register_{$item}_after", $wp_admin_bar ); } } /** * Render primary top-level admin menu bar item. * * @since 2.3.0 * * @param \WP_Admin_Bar $wp_admin_bar WordPress Admin Bar object. */ public function main_menu( \WP_Admin_Bar $wp_admin_bar ) { if ( ! empty( Debug::get_last() ) && ! (bool) Options::init()->get( 'general', 'email_delivery_errors_hidden' ) ) { $indicator = ' <span class="wp-mail-smtp-admin-bar-menu-error">!</span>'; } elseif ( ! empty( $this->has_notifications() ) ) { $count = $this->has_notifications() < 10 ? $this->has_notifications() : '!'; $indicator = ' <div class="wp-mail-smtp-admin-bar-menu-notification-counter"><span>' . $count . '</span></div>'; } if ( ! isset( $indicator ) ) { return; } $wp_admin_bar->add_menu( [ 'id' => 'wp-mail-smtp-menu', 'title' => 'WP Mail SMTP' . $indicator, 'href' => apply_filters( 'wp_mail_smtp_admin_adminbarmenu_main_menu_href', wp_mail_smtp()->get_admin()->get_admin_page_url() ), ] ); } }