add_menu( array( 'id' => 'password_protected', 'title' => '', 'href' => self::get_toolbar_item_url(), 'meta' => array( 'title' => self::get_toolbar_item_title() ) ) ); } } /** * Get Toolbar Item URL * * @return string */ private static function get_toolbar_item_url() { if ( current_user_can( 'manage_options' ) ) { return admin_url( 'options-general.php?page=password-protected' ); } return ''; } /** * Get Toolbar Item Title * * @return string */ private static function get_toolbar_item_title() { if ( self::is_enabled() ) { return __( 'Password Protection is enabled.', 'password-protected' ); } return __( 'Password Protection is disabled.', 'password-protected' ); } /** * Styles * * @internal Private. Called via `wp_head` and `admin_head` actions. */ public static function styles() { if ( self::allow_current_user() ) { if ( self::is_enabled() ) { $icon = '\f160'; // Locked $background = '#46b450'; } else { $icon = '\f528'; // Unlocked $background = 'transparent'; } ?>