PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3-a.7
Jetpack – WP Security, Backup, Speed, & Growth v16.3-a.7
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 13.8.3 All 506 releases
← All changes | _inc/lib/admin-pages/class.jetpack-admin-page.php +140 -126 12.1.3 → 16.3-a.7 View file →
@@ -4,17 +4,29 @@
4 4 *
5 5 * @package automattic/jetpack
6 6 */
7 7
8 +use Automattic\Jetpack\Current_Plan as Jetpack_Plan;
8 9 use Automattic\Jetpack\Identity_Crisis;
10 +use Automattic\Jetpack\Plugin\Admin_Chrome_Logo;
11 +use Automattic\Jetpack\Plugin\Footer_Links;
9 12 use Automattic\Jetpack\Redirect;
10 13 use Automattic\Jetpack\Status;
14 +use Automattic\Jetpack\Status\Host;
11 15
12 16 /**
13 17 * Shared logic between Jetpack admin pages.
14 18 */
15 19 abstract class Jetpack_Admin_Page {
20 +
16 21 /**
22 + * Determines whether or not to hide if not active.
23 + *
24 + * @var bool
25 + */
26 + protected $dont_show_if_not_active;
27 +
28 + /**
17 29 * Add page specific actions given the page hook.
18 30 *
19 31 * @param string $hook Hook of current page.
20 32 */
@@ -37,15 +49,8 @@
37 49 */
38 50 abstract public function page_render();
39 51
40 52 /**
41 - * Should we block the page rendering because the site is in IDC?
42 - *
43 - * @var bool
44 - */
45 - public static $block_page_rendering_for_idc;
46 -
47 - /**
48 53 * Function called after admin_styles to load any additional needed styles.
49 54 *
50 55 * @since 4.3.0
51 56 */
@@ -51,28 +56,8 @@
51 56 */
52 57 public function additional_styles() {}
53 58
54 59 /**
55 - * The constructor.
56 - */
57 - public function __construct() {
58 - add_action( 'jetpack_loaded', array( $this, 'on_jetpack_loaded' ) );
59 - }
60 -
61 - /**
62 - * Runs on Jetpack being ready to load its packages.
63 - *
64 - * @param Jetpack $jetpack object.
65 - */
66 - public function on_jetpack_loaded( $jetpack ) {
67 - $this->jetpack = $jetpack;
68 -
69 - self::$block_page_rendering_for_idc = (
70 - Identity_Crisis::validate_sync_error_idc_option() && ! Jetpack_Options::get_option( 'safe_mode_confirmed' )
71 - );
72 - }
73 -
74 - /**
75 60 * Add common page actions and attach page-specific actions.
76 61 */
77 62 public function add_actions() {
78 63 $is_offline_mode = ( new Status() )->is_offline_mode();
@@ -95,17 +80,13 @@
95 80 // Initialize menu item for the page in the admin.
96 81 $hook = $this->get_page_hook();
97 82
98 83 // Attach hooks common to all Jetpack admin pages based on the created hook.
99 - add_action( "load-$hook", array( $this, 'admin_help' ) );
100 84 add_action( "load-$hook", array( $this, 'admin_page_load' ) );
101 85 add_action( "admin_print_styles-$hook", array( $this, 'admin_styles' ) );
102 86 add_action( "admin_print_scripts-$hook", array( $this, 'admin_scripts' ) );
87 + add_action( "admin_print_styles-$hook", array( $this, 'additional_styles' ) );
103 88
104 - if ( ! self::$block_page_rendering_for_idc ) {
105 - add_action( "admin_print_styles-$hook", array( $this, 'additional_styles' ) );
106 - }
107 -
108 89 // Check if the site plan changed and deactivate modules accordingly.
109 90 add_action( 'current_screen', array( $this, 'check_plan_deactivate_modules' ) );
110 91
111 92 // Attach page specific actions in addition to the above.
@@ -110,56 +91,39 @@
110 91
111 92 // Attach page specific actions in addition to the above.
112 93 $this->add_page_actions( $hook );
113 94
114 - // If the current user can connect Jetpack, Jetpack isn't connected, and is not in offline mode, let's prompt!
115 - if ( current_user_can( 'jetpack_connect' ) && $connectable ) {
116 - $this->add_connection_banner_actions();
117 - }
95 + // Override the page title for the module list page and the debugger page.
96 + add_action( 'current_screen', array( __CLASS__, 'override_page_title' ) );
118 97 }
119 98
120 99 /**
121 - * Hooks to add when Jetpack is not active or in offline mode for an user capable of connecting.
122 - */
123 - private function add_connection_banner_actions() {
124 - global $pagenow;
125 - // If someone just activated Jetpack, let's show them a fullscreen connection banner.
126 - if ( ( 'admin.php' === $pagenow && isset( $_GET['page'] ) && 'jetpack' === $_GET['page'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
127 - add_action( 'admin_enqueue_scripts', array( 'Jetpack_Connection_Banner', 'enqueue_banner_scripts' ) );
128 - add_action( 'admin_enqueue_scripts', array( 'Jetpack_Connection_Banner', 'enqueue_connect_button_scripts' ) );
129 - delete_transient( 'activated_jetpack' );
130 - }
131 -
132 - // If Jetpack not yet connected, but user is viewing one of the pages with a Jetpack connection banner.
133 - if ( ( 'index.php' === $pagenow || 'plugins.php' === $pagenow ) ) {
134 - add_action( 'admin_enqueue_scripts', array( 'Jetpack_Connection_Banner', 'enqueue_connect_button_scripts' ) );
135 - }
136 - }
137 -
138 - /**
139 100 * Render the page with a common top and bottom part, and page specific content.
140 101 */
141 102 public function render() {
103 + /** This action is documented in class.jetpack.php */
104 + do_action( 'jetpack_initialize_tracking' );
105 +
142 106 // We're in an IDC: we need a decision made before we show the UI again.
143 - if ( self::$block_page_rendering_for_idc ) {
107 + if ( $this->block_page_rendering_for_idc() ) {
144 108 return;
145 109 }
146 110
147 - // Check if we are looking at the main dashboard.
148 - if ( isset( $_GET['page'] ) && 'jetpack' === $_GET['page'] ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- View logic.
111 + // The Settings app draws its own header and footer.
112 + if ( isset( $_GET['page'] ) && 'jetpack-settings' === $_GET['page'] ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- View logic.
149 113 $this->page_render();
150 114 return;
151 115 }
152 - self::wrap_ui( array( $this, 'page_render' ) );
153 - }
154 116
155 - /**
156 - * Load Help tab.
157 - *
158 - * @todo This may no longer be used.
159 - */
160 - public function admin_help() {
161 - $this->jetpack->admin_help();
117 + $args = array();
118 +
119 + // phpcs:ignore WordPress.Security.NonceVerification.Recommended
120 + if ( isset( $_GET['page'] ) && 'jetpack_modules' === $_GET['page'] ) {
121 + $args['is-wide'] = true;
122 + $args['show-nav'] = false;
123 + }
124 +
125 + self::wrap_ui( array( $this, 'page_render' ), $args );
162 126 }
163 127
164 128 /**
165 129 * Call the existing admin page events.
@@ -164,9 +128,9 @@
164 128 /**
165 129 * Call the existing admin page events.
166 130 */
167 131 public function admin_page_load() {
168 - $this->jetpack->admin_page_load();
132 + Jetpack::init()->admin_page_load();
169 133 }
170 134
171 135 /**
172 136 * Add page specific scripts and jetpack stats for all menu pages.
@@ -172,9 +136,9 @@
172 136 * Add page specific scripts and jetpack stats for all menu pages.
173 137 */
174 138 public function admin_scripts() {
175 139 $this->page_admin_scripts(); // Delegate to inheriting class.
176 - add_action( 'admin_footer', array( $this->jetpack, 'do_stats' ) );
140 + add_action( 'admin_footer', array( Jetpack::init(), 'do_stats' ) );
177 141 }
178 142
179 143 /**
180 144 * Enqueue the Jetpack admin stylesheet.
@@ -181,9 +145,9 @@
181 145 */
182 146 public function admin_styles() {
183 147 $min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
184 148
185 - wp_enqueue_style( 'jetpack-admin', plugins_url( "css/jetpack-admin{$min}.css", JETPACK__PLUGIN_FILE ), array( 'genericons' ), JETPACK__VERSION . '-20121016' );
149 + wp_enqueue_style( 'jetpack-admin', plugins_url( "css/jetpack-admin{$min}.css", JETPACK__PLUGIN_FILE ), array( 'genericons', 'jetpack-connection' ), JETPACK__VERSION . '-20121016' );
186 150 wp_style_add_data( 'jetpack-admin', 'rtl', 'replace' );
187 151 wp_style_add_data( 'jetpack-admin', 'suffix', $min );
188 152 }
189 153
@@ -201,8 +165,28 @@
201 165 apply_filters( 'rest_authentication_errors', true );
202 166 }
203 167
204 168 /**
169 + * Fallback redirect meta tag if the REST API is disabled.
170 + *
171 + * @return void
172 + */
173 + public function add_fallback_head_meta() {
174 + echo '<meta http-equiv="refresh" content="0; url=?page=jetpack_modules">';
175 + }
176 +
177 + /**
178 + * Fallback meta tag wrapped in noscript tags for all browsers in case they have JavaScript disabled.
179 + *
180 + * @return void
181 + */
182 + public function add_noscript_head_meta() {
183 + echo '<noscript>';
184 + $this->add_fallback_head_meta();
185 + echo '</noscript>';
186 + }
187 +
188 + /**
205 189 * Checks the site plan and deactivates modules that were active but are no longer included in the plan.
206 190 *
207 191 * @since 4.4.0
208 192 *
@@ -216,8 +200,9 @@
216 200 || ! in_array(
217 201 $page->base,
218 202 array(
219 203 'toplevel_page_jetpack',
204 + 'jetpack_page_jetpack-settings',
220 205 'admin_page_jetpack_modules',
221 206 'jetpack_page_vaultpress',
222 207 'jetpack_page_stats',
223 208 'jetpack_page_akismet-key-config',
@@ -275,12 +260,12 @@
275 260
276 261 /**
277 262 * Build header, content, and footer for admin page.
278 263 *
279 - * @param string $callback Callback to produce the content of the page. The callback is responsible for any needed escaping.
280 - * @param array $args Options for the wrapping. Also passed to the `jetpack_admin_pages_wrap_ui_after_callback` action.
281 - * - is-wide: (bool) Set the "is-wide" class on the wrapper div, which increases the max width. Default false.
282 - * - show-nav: (bool) Whether to show the navigation bar at the top of the page. Default true.
264 + * @param callable $callback Callback to produce the content of the page. The callback is responsible for any needed escaping.
265 + * @param array $args Options for the wrapping. Also passed to the `jetpack_admin_pages_wrap_ui_after_callback` action.
266 + * - is-wide: (bool) Set the "is-wide" class on the wrapper div, which increases the max width. Default false.
267 + * - show-nav: (bool) Whether to show the navigation bar at the top of the page. Default true.
283 268 */
284 269 public static function wrap_ui( $callback, $args = array() ) {
285 270 $defaults = array(
286 271 'is-wide' => false,
@@ -292,19 +277,16 @@
292 277 // True means that Jetpack is NOT connected and NOT in offline mode.
293 278 // If Jetpack is connected OR in offline mode, this will be false.
294 279 $connectable = ! Jetpack::is_connection_ready() && ! ( new Status() )->is_offline_mode();
295 280
296 - $jetpack_admin_url = admin_url( 'admin.php?page=jetpack' );
281 + $my_jetpack_available = Footer_Links::is_my_jetpack_available();
282 + $my_jetpack_url = admin_url( 'admin.php?page=my-jetpack#/overview' );
283 + $jetpack_logo = Admin_Chrome_Logo::render( 20, '', __( 'Jetpack logo', 'jetpack' ) );
284 +
297 285 $jetpack_about_url = ! $connectable
298 286 ? admin_url( 'admin.php?page=jetpack_about' )
299 287 : Redirect::get_url( 'jetpack' );
300 288
301 - $jetpack_privacy_url = ! $connectable
302 - ? $jetpack_admin_url . '#/privacy'
303 - : Redirect::get_url( 'a8c-privacy' );
304 -
305 - $external_link_icon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" class="jp-footer__menu-item__icon" aria-hidden="true" focusable="false"><path d="M18.2 17c0 .7-.6 1.2-1.2 1.2H7c-.7 0-1.2-.6-1.2-1.2V7c0-.7.6-1.2 1.2-1.2h3.2V4.2H7C5.5 4.2 4.2 5.5 4.2 7v10c0 1.5 1.2 2.8 2.8 2.8h10c1.5 0 2.8-1.2 2.8-2.8v-3.6h-1.5V17zM14.9 3v1.5h3.7l-6.4 6.4 1.1 1.1 6.4-6.4v3.7h1.5V3h-6.3z"></path></svg>';
306 -
307 289 ?>
308 290 <div id="jp-plugin-container" class="
309 291 <?php
310 292 if ( $args['is-wide'] ) {
@@ -311,17 +293,51 @@
311 293 echo 'is-wide'; }
312 294 ?>
313 295 ">
314 296
315 - <div class="jp-masthead jp-masthead-middle">
297 + <header class="jp-masthead">
316 298 <div class="jp-masthead__inside-container">
317 - <div class="jp-masthead__logo-container">
318 - <a class="jp-masthead__logo-link" href="<?php echo esc_url( $jetpack_admin_url ); ?>">
319 - <svg class="jetpack-logo__masthead" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" height="40" viewBox="0 0 118 32"><path fill="#069e08" d="M16,0C7.2,0,0,7.2,0,16s7.2,16,16,16s16-7.2,16-16S24.8,0,16,0z M15,19H7l8-16V19z M17,29V13h8L17,29z"></path><path d="M41.3,26.6c-0.5-0.7-0.9-1.4-1.3-2.1c2.3-1.4,3-2.5,3-4.6V8h-3V6h6v13.4C46,22.8,45,24.8,41.3,26.6z"></path><path d="M65,18.4c0,1.1,0.8,1.3,1.4,1.3c0.5,0,2-0.2,2.6-0.4v2.1c-0.9,0.3-2.5,0.5-3.7,0.5c-1.5,0-3.2-0.5-3.2-3.1V12H60v-2h2.1V7.1 H65V10h4v2h-4V18.4z"></path><path d="M71,10h3v1.3c1.1-0.8,1.9-1.3,3.3-1.3c2.5,0,4.5,1.8,4.5,5.6s-2.2,6.3-5.8,6.3c-0.9,0-1.3-0.1-2-0.3V28h-3V10z M76.5,12.3 c-0.8,0-1.6,0.4-2.5,1.2v5.9c0.6,0.1,0.9,0.2,1.8,0.2c2,0,3.2-1.3,3.2-3.9C79,13.4,78.1,12.3,76.5,12.3z"></path><path d="M93,22h-3v-1.5c-0.9,0.7-1.9,1.5-3.5,1.5c-1.5,0-3.1-1.1-3.1-3.2c0-2.9,2.5-3.4,4.2-3.7l2.4-0.3v-0.3c0-1.5-0.5-2.3-2-2.3 c-0.7,0-2.3,0.5-3.7,1.1L84,11c1.2-0.4,3-1,4.4-1c2.7,0,4.6,1.4,4.6,4.7L93,22z M90,16.4l-2.2,0.4c-0.7,0.1-1.4,0.5-1.4,1.6 c0,0.9,0.5,1.4,1.3,1.4s1.5-0.5,2.3-1V16.4z"></path><path d="M104.5,21.3c-1.1,0.4-2.2,0.6-3.5,0.6c-4.2,0-5.9-2.4-5.9-5.9c0-3.7,2.3-6,6.1-6c1.4,0,2.3,0.2,3.2,0.5V13 c-0.8-0.3-2-0.6-3.2-0.6c-1.7,0-3.2,0.9-3.2,3.6c0,2.9,1.5,3.8,3.3,3.8c0.9,0,1.9-0.2,3.2-0.7V21.3z"></path><path d="M110,15.2c0.2-0.3,0.2-0.8,3.8-5.2h3.7l-4.6,5.7l5,6.3h-3.7l-4.2-5.8V22h-3V6h3V15.2z"></path><path d="M58.5,21.3c-1.5,0.5-2.7,0.6-4.2,0.6c-3.6,0-5.8-1.8-5.8-6c0-3.1,1.9-5.9,5.5-5.9s4.9,2.5,4.9,4.9c0,0.8,0,1.5-0.1,2h-7.3 c0.1,2.5,1.5,2.8,3.6,2.8c1.1,0,2.2-0.3,3.4-0.7C58.5,19,58.5,21.3,58.5,21.3z M56,15c0-1.4-0.5-2.9-2-2.9c-1.4,0-2.3,1.3-2.4,2.9 C51.6,15,56,15,56,15z"></path></svg>
320 - </a>
299 + <div class="jp-masthead__title-container">
300 + <?php if ( $my_jetpack_available ) : ?>
301 + <a class="jp-masthead__logo-link" href="<?php echo esc_url( $my_jetpack_url ); ?>"><?php echo $jetpack_logo; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Static SVG built above. ?></a>
302 + <?php else : ?>
303 + <span class="jp-masthead__logo-link"><?php echo $jetpack_logo; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Static SVG built above. ?></span>
304 + <?php endif; ?>
305 + <h2 class="jp-masthead__title">
306 + <?php
307 + // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- View logic only.
308 + $page = isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : '';
309 + $is_offline_mode = ( new Status() )->is_offline_mode();
310 + $current_label = '';
311 + if ( 'jetpack_modules' === $page ) {
312 + $current_label = __( 'Modules', 'jetpack' );
313 + } elseif ( 'jetpack_about' === $page ) {
314 + $current_label = __( 'About', 'jetpack' );
315 + } elseif ( 'jetpack-debugger' === $page ) {
316 + $current_label = __( 'Debug', 'jetpack' );
317 + }
318 +
319 + // "Jetpack" is a product name, do not translate.
320 + ?>
321 + <?php if ( $current_label ) : ?>
322 + <?php if ( $my_jetpack_available ) : ?>
323 + <a class="jp-masthead__title-link" href="<?php echo esc_url( $my_jetpack_url ); ?>">Jetpack</a>
324 + <?php else : ?>
325 + Jetpack
326 + <?php endif; ?>
327 + <span class="jp-masthead__title-separator" aria-hidden="true">/</span>
328 + <?php if ( $is_offline_mode ) : ?>
329 + <span class="jp-masthead__title-offline"><?php esc_html_e( 'Offline Mode', 'jetpack' ); ?></span>
330 + <span class="jp-masthead__title-separator" aria-hidden="true">/</span>
331 + <?php endif; ?>
332 + <span class="jp-masthead__title-current"><?php echo esc_html( $current_label ); ?></span>
333 + <?php else : ?>
334 + Jetpack
335 + <?php endif; ?>
336 + </h2>
321 337 </div>
322 338 <?php
323 - if ( $args['show-nav'] ) :
339 + if ( $args['show-nav'] && ! ( new Host() )->is_wpcom_platform() ) :
324 340 ?>
325 341 <div class="jp-masthead__nav">
326 342 <?php
327 343 if ( is_network_admin() ) {
@@ -342,24 +358,17 @@
342 358 <?php
343 359 }
344 360 ?>
345 361 </span>
346 - <?php } else { ?>
362 + <?php } elseif ( current_user_can( 'jetpack_manage_modules' ) ) { ?>
347 363 <span class="dops-button-group">
348 - <a href="<?php echo esc_url( $jetpack_admin_url ); ?>" type="button" class="dops-button is-compact"><?php esc_html_e( 'Dashboard', 'jetpack' ); ?></a>
349 - <?php
350 - if ( current_user_can( 'jetpack_manage_modules' ) ) {
351 - ?>
352 - <a href="<?php echo esc_url( $jetpack_admin_url . '#/settings' ); ?>" type="button" class="dops-button is-compact"><?php esc_html_e( 'Settings', 'jetpack' ); ?></a>
353 - <?php
354 - }
355 - ?>
364 + <a href="<?php echo esc_url( admin_url( 'admin.php?page=jetpack-settings#/settings' ) ); ?>" type="button" class="dops-button is-compact"><?php esc_html_e( 'Settings', 'jetpack' ); ?></a>
356 365 </span>
357 366 <?php } ?>
358 367 </div>
359 368 <?php endif; ?>
360 369 </div>
361 - </div>
370 + </header>
362 371 <div class="wrap"><div id="jp-admin-notices" aria-live="polite"></div></div>
363 372 <!-- START OF CALLBACK -->
364 373 <?php
365 374 ob_start();
@@ -394,41 +403,17 @@
394 403 <?php esc_html_e( 'Jetpack Logo', 'jetpack' ); ?>
395 404 </desc>
396 405 <path fill="#000" d="M16,0C7.2,0,0,7.2,0,16s7.2,16,16,16s16-7.2,16-16S24.8,0,16,0z M15,19H7l8-16V19z M17,29V13h8L17,29z"></path>
397 406 </svg>
398 - <span class="jp-footer__module-name">
399 - <a href="<?php echo esc_url( Redirect::get_url( 'jetpack' ) ); ?>" target="_blank" rel="noopener noreferrer" aria-label="Jetpack 12.2-a.0">
400 - <?php esc_html_e( 'Jetpack', 'jetpack' ); ?>
401 - </a>
402 - </span>
407 + <span class="jp-footer__module-name"><?php esc_html_e( 'Jetpack', 'jetpack' ); ?></span>
403 408 </div>
409 + <?php if ( ! ( new Host() )->is_wpcom_platform() && $my_jetpack_available ) : ?>
410 + <?php $products_section = Footer_Links::get_my_jetpack_products_section(); ?>
404 411 <div class="jp-footer__menu">
405 - <a href="<?php echo esc_url( $jetpack_about_url ); ?>" title="<?php esc_attr__( 'About Jetpack', 'jetpack' ); ?>" class="jp-footer__menu-item">
406 - <?php echo esc_html__( 'About', 'jetpack' ); ?>
407 - </a>
408 - <a href="<?php echo esc_url( $jetpack_privacy_url ); ?>" rel="noopener noreferrer" title="<?php esc_html_e( "Automattic's Privacy Policy", 'jetpack' ); ?>" class="jp-footer__menu-item <?php echo ! $connectable ? 'is-external' : ''; ?> ?>" target="<?php echo ! $connectable ? '_blank' : '_self'; ?>">
409 - <?php echo esc_html_x( 'Privacy', 'Navigation item', 'jetpack' ); ?>
410 - <?php echo ! $connectable ? $external_link_icon : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
411 - </a>
412 - <a href="<?php echo esc_url( Redirect::get_url( 'wpcom-tos' ) ); ?>" target="_blank" rel="noopener noreferrer" title="<?php esc_html__( 'WordPress.com Terms of Service', 'jetpack' ); ?>" class="jp-footer__menu-item is-external">
413 - <?php echo esc_html_x( 'Terms', 'Navigation item', 'jetpack' ); ?>
414 - <?php echo $external_link_icon; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
415 - </a>
416 - <a href="<?php echo esc_url( Redirect::get_url( 'jetpack' ) ); ?>" target="_blank" rel="noopener noreferrer" aria-label="Jetpack 12.2-a.0" class="jp-footer__menu-item is-external">
417 - Version <?php echo esc_html( JETPACK__VERSION ); ?>
418 - <?php echo $external_link_icon; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
419 - </a>
420 - <?php if ( is_multisite() && current_user_can( 'jetpack_network_sites_page' ) ) { ?>
421 - <a href="<?php echo esc_url( network_admin_url( 'admin.php?page=jetpack' ) ); ?>" title="<?php esc_html_e( "Manage your network's Jetpack Sites.", 'jetpack' ); ?>" class="jp-footer__menu-item"><?php echo esc_html_x( 'Network Sites', 'Navigation item', 'jetpack' ); ?></a>
422 - <?php } ?>
423 - <?php if ( is_multisite() && current_user_can( 'jetpack_network_settings_page' ) ) { ?>
424 - <a href="<?php echo esc_url( network_admin_url( 'admin.php?page=jetpack-settings' ) ); ?>" title="<?php esc_html_e( "Manage your network's Jetpack Sites.", 'jetpack' ); ?>" class="jp-footer__menu-item"><?php echo esc_html_x( 'Network Settings', 'Navigation item', 'jetpack' ); ?></a>
425 - <?php } ?>
426 - <?php if ( current_user_can( 'manage_options' ) ) { ?>
427 - <a href="<?php echo esc_url( admin_url( 'admin.php?page=jetpack_modules' ) ); ?>" title="<?php esc_html_e( 'Access the full list of Jetpack modules available on your site.', 'jetpack' ); ?>" class="jp-footer__menu-item"><?php echo esc_html_x( 'Modules', 'Navigation item', 'jetpack' ); ?></a>
428 - <a href="<?php echo esc_url( admin_url( 'admin.php?page=jetpack-debugger' ) ); ?>" title="<?php esc_html_e( "Test your site's compatibility with Jetpack.", 'jetpack' ); ?>" class="jp-footer__menu-item"><?php echo esc_html_x( 'Debug', 'Navigation item', 'jetpack' ); ?></a>
429 - <?php } ?>
412 + <a href="<?php echo esc_url( admin_url( 'admin.php?page=my-jetpack#/' . $products_section['slug'] ) ); ?>" class="jp-footer__menu-item"><?php echo esc_html( $products_section['label'] ); ?></a>
413 + <a href="<?php echo esc_url( admin_url( 'admin.php?page=my-jetpack#/help' ) ); ?>" class="jp-footer__menu-item"><?php echo esc_html_x( 'Help', 'Navigation item', 'jetpack' ); ?></a>
430 414 </div>
415 + <?php endif; ?>
431 416 <a class="jp-footer__a8c-logo" href="<?php echo esc_url( $jetpack_about_url ); ?>" aria-label="<?php echo esc_attr__( 'An Automattic Airline', 'jetpack' ); ?>">
432 417 <svg role="img" x="0" y="0" viewBox="0 0 935 38.2" enable-background="new 0 0 935 38.2" aria-labelledby="jp-automattic-byline-logo-title" height="7" class="jp-automattic-byline-logo">
433 418 <desc id="jp-automattic-byline-logo-title">
434 419 <?php echo esc_attr__( 'An Automattic Airline', 'jetpack' ); ?>
@@ -439,6 +424,35 @@
439 424 </div>
440 425 </div>
441 426 </div>
442 427 <?php
428 + }
429 +
430 + /**
431 + * Should we block the page rendering because the site is in IDC?
432 + *
433 + * @return bool
434 + */
435 + protected function block_page_rendering_for_idc() {
436 + return Jetpack::is_connection_ready() && Identity_Crisis::validate_sync_error_idc_option() && ! Jetpack_Options::get_option( 'safe_mode_confirmed' );
437 + }
438 +
439 + /**
440 + * Set a page title for both the module list page and the debugger page.
441 + * We set these here because we do not register a page title when we register them,
442 + * so they do not appear in the admin navigation.
443 + *
444 + * @since 15.4
445 + *
446 + * @param WP_Screen $screen The screen object.
447 + *
448 + * @return void
449 + */
450 + public static function override_page_title( WP_Screen $screen ) {
451 + global $title;
452 + if ( 'admin_page_jetpack_modules' === $screen->id ) {
453 + $title = __( 'Jetpack Settings', 'jetpack' ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited -- we override the title global only on this page.
454 + } elseif ( 'admin_page_jetpack-debugger' === $screen->id ) {
455 + $title = __( 'Debugging Center', 'jetpack' ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited -- we override the title global only on this page.
456 + }
443 457 }
444 458 }