admin-menu-nav-unification-rtl.css
2 years ago
admin-menu-nav-unification-rtl.min.css
2 years ago
admin-menu-nav-unification.css
2 years ago
admin-menu-nav-unification.min.css
2 years ago
admin-menu-rtl.css
2 years ago
admin-menu-rtl.min.css
2 years ago
admin-menu.css
2 years ago
admin-menu.js
2 years ago
admin-menu.min.css
2 years ago
class-admin-menu.php
2 years ago
class-atomic-admin-menu.php
2 years ago
class-base-admin-menu.php
2 years ago
class-dashboard-switcher-tracking.php
3 years ago
class-domain-only-admin-menu.php
2 years ago
class-jetpack-admin-menu.php
2 years ago
class-p2-admin-menu.php
4 years ago
class-wpcom-admin-menu.php
2 years ago
class-wpcom-email-subscription-checker.php
3 years ago
dashicon-set.php
4 years ago
globe-icon.svg
3 years ago
load.php
2 years ago
menu-mappings.php
3 years ago
class-domain-only-admin-menu.php
69 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Domain-only sites Admin Menu file. |
| 4 | * |
| 5 | * @package automattic/jetpack |
| 6 | */ |
| 7 | |
| 8 | namespace Automattic\Jetpack\Dashboard_Customizations; |
| 9 | |
| 10 | require_once __DIR__ . '/class-base-admin-menu.php'; |
| 11 | require_once __DIR__ . '/class-wpcom-email-subscription-checker.php'; |
| 12 | |
| 13 | /** |
| 14 | * Class Domain_Only_Admin_Menu. |
| 15 | */ |
| 16 | class Domain_Only_Admin_Menu extends Base_Admin_Menu { |
| 17 | /** |
| 18 | * The `WPCOM_Email_Subscription_Checker` instance used to verify if a site has an email subscription. |
| 19 | * |
| 20 | * @var \WPCOM_Email_Subscription_Checker |
| 21 | */ |
| 22 | private $email_subscriptions_checker; |
| 23 | |
| 24 | /** |
| 25 | * Constructor that lets us pass in a WPCOM_Email_Subscription_Checker dependency. |
| 26 | * |
| 27 | * @param \WPCOM_Email_Subscription_Checker $email_subscriptions_checker The WPCOM_Email_Subscription_Checker instance. |
| 28 | */ |
| 29 | protected function __construct( $email_subscriptions_checker = null ) { |
| 30 | parent::__construct(); |
| 31 | |
| 32 | $this->email_subscriptions_checker = $email_subscriptions_checker; |
| 33 | |
| 34 | if ( empty( $this->email_subscriptions_checker ) ) { |
| 35 | $this->set_email_subscription_checker( new \WPCOM_Email_Subscription_Checker() ); |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | /** |
| 40 | * This setter lets us inject an WPCOM_Email_Subscription_Checker instance. |
| 41 | * |
| 42 | * @param \WPCOM_Email_Subscription_Checker $email_subscriptions_checker An WPCOM_Email_Subscription_Checker instance. |
| 43 | * |
| 44 | * @return void |
| 45 | */ |
| 46 | public function set_email_subscription_checker( $email_subscriptions_checker ) { |
| 47 | $this->email_subscriptions_checker = $email_subscriptions_checker; |
| 48 | } |
| 49 | |
| 50 | /** |
| 51 | * Create the desired menu output. |
| 52 | */ |
| 53 | public function reregister_menu_items() { |
| 54 | global $menu, $submenu; |
| 55 | |
| 56 | $menu = array(); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited |
| 57 | $submenu = array(); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited |
| 58 | |
| 59 | add_menu_page( esc_attr__( 'Manage Domain', 'jetpack' ), __( 'Manage Domain', 'jetpack' ), 'manage_options', 'https://wordpress.com/domains/manage/' . $this->domain . '/edit/' . $this->domain, null, 'dashicons-admin-settings' ); |
| 60 | |
| 61 | if ( $this->email_subscriptions_checker->has_email() ) { |
| 62 | add_menu_page( esc_attr__( 'Manage Email', 'jetpack' ), __( 'Manage Email', 'jetpack' ), 'manage_options', 'https://wordpress.com/email/' . $this->domain . '/manage/' . $this->domain, null, 'dashicons-admin-settings' ); |
| 63 | } |
| 64 | |
| 65 | add_menu_page( esc_attr__( 'Manage Purchases', 'jetpack' ), __( 'Manage Purchases', 'jetpack' ), 'manage_options', 'https://wordpress.com/purchases/subscriptions/' . $this->domain, null, 'dashicons-cart' ); |
| 66 | add_menu_page( esc_attr__( 'My Mailboxes', 'jetpack' ), __( 'My Mailboxes', 'jetpack' ), 'manage_options', 'https://wordpress.com/mailboxes/' . $this->domain, null, 'dashicons-email' ); |
| 67 | } |
| 68 | } |
| 69 |