PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3-beta
Jetpack – WP Security, Backup, Speed, & Growth v16.3-beta
16.3-beta 16.3-a.5 16.3-a.7 16.3-a.3 16.3-a.1 16.2 16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 13.7.2 All 507 releases
← All changes | jetpack_vendor/automattic/jetpack-masterbar/src/admin-menu/load.php +26 -48 13.7.2 → 16.3-beta View file →
@@ -10,8 +10,12 @@
10 10 use Automattic\Jetpack\Modules;
11 11 use Automattic\Jetpack\Status\Host;
12 12 use Automattic\Jetpack\Tracking;
13 13
14 +if ( ! defined( 'ABSPATH' ) ) {
15 + exit( 0 );
16 +}
17 +
14 18 /**
15 19 * Checks whether the navigation customizations should be performed for the given class.
16 20 *
17 21 * @param string $admin_menu_class Class name.
@@ -30,55 +34,17 @@
30 34 if ( is_a( $admin_menu_class, Atomic_Admin_Menu::class, true ) && ! $is_api_request && ! ( new Modules() )->is_active( 'sso' ) ) {
31 35 return false;
32 36 }
33 37
34 - // No nav customizations on WP Admin of Jetpack sites.
35 - if ( is_a( $admin_menu_class, Jetpack_Admin_Menu::class, true ) && ! $is_api_request ) {
36 - return false;
37 - }
38 -
39 38 return true;
40 39 }
41 40
42 41 /**
43 - * Hides the Customizer menu items when the block theme is active by removing the dotcom-specific actions.
44 - * They are not needed for block themes.
45 - *
46 - * @see https://github.com/Automattic/jetpack/pull/36017
47 - */
48 -function hide_customizer_menu_on_block_theme() {
49 - add_action(
50 - 'init',
51 - function () {
52 - if ( wp_is_block_theme() && ! is_customize_preview() ) {
53 - remove_action( 'customize_register', 'add_logotool_button', 20 );
54 - remove_action( 'customize_register', 'footercredits_register', 99 );
55 - remove_action( 'customize_register', 'wpcom_disable_customizer_site_icon', 20 );
56 -
57 - if ( class_exists( '\Jetpack_Fonts' ) ) {
58 - $jetpack_fonts_instance = \Jetpack_Fonts::get_instance();
59 - remove_action( 'customize_register', array( $jetpack_fonts_instance, 'register_controls' ) );
60 - remove_action( 'customize_register', array( $jetpack_fonts_instance, 'maybe_prepopulate_option' ), 0 );
61 - }
62 -
63 - remove_action( 'customize_register', array( 'Jetpack_Fonts_Typekit', 'maybe_override_for_advanced_mode' ), 20 );
64 -
65 - remove_action( 'customize_register', 'Automattic\Jetpack\Masterbar\register_css_nudge_control' );
66 -
67 - remove_action( 'customize_register', array( 'Jetpack_Custom_CSS_Enhancements', 'customize_register' ) );
68 - }
69 - }
70 - );
71 -}
72 -
73 -/**
74 42 * Gets the name of the class that customizes the admin menu.
75 43 *
76 44 * @return string Class name.
77 45 */
78 46 function get_admin_menu_class() {
79 - hide_customizer_menu_on_block_theme();
80 -
81 47 // WordPress.com Atomic sites.
82 48 if ( ( new Host() )->is_woa_site() ) {
83 49
84 50 // DIFM Lite In Progress Atomic Sites. Uses the same menu used for domain-only sites.
@@ -86,8 +52,18 @@
86 52 $is_difm_lite_in_progress = wpcomsh_is_site_sticker_active( 'difm-lite-in-progress' );
87 53 $is_support_session = defined( 'WPCOM_SUPPORT_SESSION' ) && WPCOM_SUPPORT_SESSION;
88 54 if ( $is_difm_lite_in_progress && ! $is_support_session ) {
89 55 require_once __DIR__ . '/class-domain-only-admin-menu.php';
56 +
57 + // While the content form is still open the customer needs to read
58 + // their own Posts, Media and Pages to fill it in. The sticker is
59 + // absent for builds that predate it and whenever wpcom has not set
60 + // it, so the fallback is the existing full lockout.
61 + if ( wpcomsh_is_site_sticker_active( 'difm-lite-awaiting-content' ) ) {
62 + require_once __DIR__ . '/class-difm-lite-admin-menu.php';
63 + return DIFM_Lite_Admin_Menu::class;
64 + }
65 +
90 66 return Domain_Only_Admin_Menu::class;
91 67 }
92 68
93 69 require_once __DIR__ . '/class-atomic-admin-menu.php';
@@ -111,26 +87,28 @@
111 87 $is_difm_lite_in_progress = has_blog_sticker( 'difm-lite-in-progress' );
112 88 $is_support_session = defined( 'WPCOM_SUPPORT_SESSION' ) && WPCOM_SUPPORT_SESSION;
113 89 if ( $is_difm_lite_in_progress && ! $is_support_session ) {
114 90 require_once __DIR__ . '/class-domain-only-admin-menu.php';
91 +
92 + // See the Atomic branch above: pre-submit the customer keeps access
93 + // to their own content, and an absent sticker falls back to the
94 + // existing full lockout.
95 + if ( has_blog_sticker( 'difm-lite-awaiting-content' ) ) {
96 + require_once __DIR__ . '/class-difm-lite-admin-menu.php';
97 + return DIFM_Lite_Admin_Menu::class;
98 + }
99 +
115 100 return Domain_Only_Admin_Menu::class;
116 101 }
117 102
118 - // P2 sites.
119 - require_once WP_CONTENT_DIR . '/lib/wpforteams/functions.php';
120 - if ( \WPForTeams\is_wpforteams_site( $blog_id ) ) {
121 - require_once __DIR__ . '/class-p2-admin-menu.php';
122 - return P2_Admin_Menu::class;
123 - }
124 -
125 103 // Rest of simple sites.
126 104 require_once __DIR__ . '/class-wpcom-admin-menu.php';
127 105 return WPcom_Admin_Menu::class;
128 106 }
129 107
130 - // Jetpack sites.
131 - require_once __DIR__ . '/class-jetpack-admin-menu.php';
132 - return Jetpack_Admin_Menu::class;
108 + // Default menu class.
109 + require_once __DIR__ . '/class-admin-menu.php';
110 + return Admin_Menu::class;
133 111 }
134 112
135 113 /**
136 114 * Filters the name of the class that customizes the admin menu. It should extends the `Base_Admin_Menu` class.