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 +129 -108 13.1.5 → 16.3-a.7 View file →
@@ -6,21 +6,25 @@
6 6 */
7 7
8 8 use Automattic\Jetpack\Current_Plan as Jetpack_Plan;
9 9 use Automattic\Jetpack\Identity_Crisis;
10 +use Automattic\Jetpack\Plugin\Admin_Chrome_Logo;
11 +use Automattic\Jetpack\Plugin\Footer_Links;
10 12 use Automattic\Jetpack\Redirect;
11 13 use Automattic\Jetpack\Status;
14 +use Automattic\Jetpack\Status\Host;
12 15
13 16 /**
14 17 * Shared logic between Jetpack admin pages.
15 18 */
16 19 abstract class Jetpack_Admin_Page {
20 +
17 21 /**
18 - * Jetpack Object.
22 + * Determines whether or not to hide if not active.
19 23 *
20 - * @var Jetpack
24 + * @var bool
21 25 */
22 - public $jetpack;
26 + protected $dont_show_if_not_active;
23 27
24 28 /**
25 29 * Add page specific actions given the page hook.
26 30 *
@@ -45,15 +49,8 @@
45 49 */
46 50 abstract public function page_render();
47 51
48 52 /**
49 - * Should we block the page rendering because the site is in IDC?
50 - *
51 - * @var bool
52 - */
53 - public static $block_page_rendering_for_idc;
54 -
55 - /**
56 53 * Function called after admin_styles to load any additional needed styles.
57 54 *
58 55 * @since 4.3.0
59 56 */
@@ -59,28 +56,8 @@
59 56 */
60 57 public function additional_styles() {}
61 58
62 59 /**
63 - * The constructor.
64 - */
65 - public function __construct() {
66 - add_action( 'jetpack_loaded', array( $this, 'on_jetpack_loaded' ) );
67 - }
68 -
69 - /**
70 - * Runs on Jetpack being ready to load its packages.
71 - *
72 - * @param Jetpack $jetpack object.
73 - */
74 - public function on_jetpack_loaded( $jetpack ) {
75 - $this->jetpack = $jetpack;
76 -
77 - self::$block_page_rendering_for_idc = (
78 - Jetpack::is_connection_ready() && Identity_Crisis::validate_sync_error_idc_option() && ! Jetpack_Options::get_option( 'safe_mode_confirmed' )
79 - );
80 - }
81 -
82 - /**
83 60 * Add common page actions and attach page-specific actions.
84 61 */
85 62 public function add_actions() {
86 63 $is_offline_mode = ( new Status() )->is_offline_mode();
@@ -103,22 +80,21 @@
103 80 // Initialize menu item for the page in the admin.
104 81 $hook = $this->get_page_hook();
105 82
106 83 // Attach hooks common to all Jetpack admin pages based on the created hook.
107 - add_action( "load-$hook", array( $this, 'admin_help' ) );
108 84 add_action( "load-$hook", array( $this, 'admin_page_load' ) );
109 85 add_action( "admin_print_styles-$hook", array( $this, 'admin_styles' ) );
110 86 add_action( "admin_print_scripts-$hook", array( $this, 'admin_scripts' ) );
87 + add_action( "admin_print_styles-$hook", array( $this, 'additional_styles' ) );
111 88
112 - if ( ! self::$block_page_rendering_for_idc ) {
113 - add_action( "admin_print_styles-$hook", array( $this, 'additional_styles' ) );
114 - }
115 -
116 89 // Check if the site plan changed and deactivate modules accordingly.
117 90 add_action( 'current_screen', array( $this, 'check_plan_deactivate_modules' ) );
118 91
119 92 // Attach page specific actions in addition to the above.
120 93 $this->add_page_actions( $hook );
94 +
95 + // Override the page title for the module list page and the debugger page.
96 + add_action( 'current_screen', array( __CLASS__, 'override_page_title' ) );
121 97 }
122 98
123 99 /**
124 100 * Render the page with a common top and bottom part, and page specific content.
@@ -123,15 +99,18 @@
123 99 /**
124 100 * Render the page with a common top and bottom part, and page specific content.
125 101 */
126 102 public function render() {
103 + /** This action is documented in class.jetpack.php */
104 + do_action( 'jetpack_initialize_tracking' );
105 +
127 106 // We're in an IDC: we need a decision made before we show the UI again.
128 - if ( self::$block_page_rendering_for_idc ) {
107 + if ( $this->block_page_rendering_for_idc() ) {
129 108 return;
130 109 }
131 110
132 - // Check if we are looking at the main dashboard.
133 - 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.
134 113 $this->page_render();
135 114 return;
136 115 }
137 116
@@ -138,9 +117,10 @@
138 117 $args = array();
139 118
140 119 // phpcs:ignore WordPress.Security.NonceVerification.Recommended
141 120 if ( isset( $_GET['page'] ) && 'jetpack_modules' === $_GET['page'] ) {
142 - $args['is-wide'] = true;
121 + $args['is-wide'] = true;
122 + $args['show-nav'] = false;
143 123 }
144 124
145 125 self::wrap_ui( array( $this, 'page_render' ), $args );
146 126 }
@@ -145,21 +125,12 @@
145 125 self::wrap_ui( array( $this, 'page_render' ), $args );
146 126 }
147 127
148 128 /**
149 - * Load Help tab.
150 - *
151 - * @todo This may no longer be used.
152 - */
153 - public function admin_help() {
154 - $this->jetpack->admin_help();
155 - }
156 -
157 - /**
158 129 * Call the existing admin page events.
159 130 */
160 131 public function admin_page_load() {
161 - $this->jetpack->admin_page_load();
132 + Jetpack::init()->admin_page_load();
162 133 }
163 134
164 135 /**
165 136 * Add page specific scripts and jetpack stats for all menu pages.
@@ -165,9 +136,9 @@
165 136 * Add page specific scripts and jetpack stats for all menu pages.
166 137 */
167 138 public function admin_scripts() {
168 139 $this->page_admin_scripts(); // Delegate to inheriting class.
169 - add_action( 'admin_footer', array( $this->jetpack, 'do_stats' ) );
140 + add_action( 'admin_footer', array( Jetpack::init(), 'do_stats' ) );
170 141 }
171 142
172 143 /**
173 144 * Enqueue the Jetpack admin stylesheet.
@@ -174,9 +145,9 @@
174 145 */
175 146 public function admin_styles() {
176 147 $min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
177 148
178 - 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' );
179 150 wp_style_add_data( 'jetpack-admin', 'rtl', 'replace' );
180 151 wp_style_add_data( 'jetpack-admin', 'suffix', $min );
181 152 }
182 153
@@ -194,8 +165,28 @@
194 165 apply_filters( 'rest_authentication_errors', true );
195 166 }
196 167
197 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 + /**
198 189 * Checks the site plan and deactivates modules that were active but are no longer included in the plan.
199 190 *
200 191 * @since 4.4.0
201 192 *
@@ -209,8 +200,9 @@
209 200 || ! in_array(
210 201 $page->base,
211 202 array(
212 203 'toplevel_page_jetpack',
204 + 'jetpack_page_jetpack-settings',
213 205 'admin_page_jetpack_modules',
214 206 'jetpack_page_vaultpress',
215 207 'jetpack_page_stats',
216 208 'jetpack_page_akismet-key-config',
@@ -268,12 +260,12 @@
268 260
269 261 /**
270 262 * Build header, content, and footer for admin page.
271 263 *
272 - * @param string $callback Callback to produce the content of the page. The callback is responsible for any needed escaping.
273 - * @param array $args Options for the wrapping. Also passed to the `jetpack_admin_pages_wrap_ui_after_callback` action.
274 - * - is-wide: (bool) Set the "is-wide" class on the wrapper div, which increases the max width. Default false.
275 - * - 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.
276 268 */
277 269 public static function wrap_ui( $callback, $args = array() ) {
278 270 $defaults = array(
279 271 'is-wide' => false,
@@ -285,19 +277,16 @@
285 277 // True means that Jetpack is NOT connected and NOT in offline mode.
286 278 // If Jetpack is connected OR in offline mode, this will be false.
287 279 $connectable = ! Jetpack::is_connection_ready() && ! ( new Status() )->is_offline_mode();
288 280
289 - $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 +
290 285 $jetpack_about_url = ! $connectable
291 286 ? admin_url( 'admin.php?page=jetpack_about' )
292 287 : Redirect::get_url( 'jetpack' );
293 288
294 - $jetpack_privacy_url = ! $connectable
295 - ? $jetpack_admin_url . '#/privacy'
296 - : Redirect::get_url( 'a8c-privacy' );
297 -
298 - $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>';
299 -
300 289 ?>
301 290 <div id="jp-plugin-container" class="
302 291 <?php
303 292 if ( $args['is-wide'] ) {
@@ -304,17 +293,51 @@
304 293 echo 'is-wide'; }
305 294 ?>
306 295 ">
307 296
308 - <div class="jp-masthead jp-masthead-middle">
297 + <header class="jp-masthead">
309 298 <div class="jp-masthead__inside-container">
310 - <div class="jp-masthead__logo-container">
311 - <a class="jp-masthead__logo-link" href="<?php echo esc_url( $jetpack_admin_url ); ?>">
312 - <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>
313 - </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>
314 337 </div>
315 338 <?php
316 - if ( $args['show-nav'] ) :
339 + if ( $args['show-nav'] && ! ( new Host() )->is_wpcom_platform() ) :
317 340 ?>
318 341 <div class="jp-masthead__nav">
319 342 <?php
320 343 if ( is_network_admin() ) {
@@ -335,24 +358,17 @@
335 358 <?php
336 359 }
337 360 ?>
338 361 </span>
339 - <?php } else { ?>
362 + <?php } elseif ( current_user_can( 'jetpack_manage_modules' ) ) { ?>
340 363 <span class="dops-button-group">
341 - <a href="<?php echo esc_url( $jetpack_admin_url ); ?>" type="button" class="dops-button is-compact"><?php esc_html_e( 'Dashboard', 'jetpack' ); ?></a>
342 - <?php
343 - if ( current_user_can( 'jetpack_manage_modules' ) ) {
344 - ?>
345 - <a href="<?php echo esc_url( $jetpack_admin_url . '#/settings' ); ?>" type="button" class="dops-button is-compact"><?php esc_html_e( 'Settings', 'jetpack' ); ?></a>
346 - <?php
347 - }
348 - ?>
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>
349 365 </span>
350 366 <?php } ?>
351 367 </div>
352 368 <?php endif; ?>
353 369 </div>
354 - </div>
370 + </header>
355 371 <div class="wrap"><div id="jp-admin-notices" aria-live="polite"></div></div>
356 372 <!-- START OF CALLBACK -->
357 373 <?php
358 374 ob_start();
@@ -387,41 +403,17 @@
387 403 <?php esc_html_e( 'Jetpack Logo', 'jetpack' ); ?>
388 404 </desc>
389 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>
390 406 </svg>
391 - <span class="jp-footer__module-name">
392 - <a href="<?php echo esc_url( Redirect::get_url( 'jetpack' ) ); ?>" target="_blank" rel="noopener noreferrer" aria-label="Jetpack 12.2-a.0">
393 - <?php esc_html_e( 'Jetpack', 'jetpack' ); ?>
394 - </a>
395 - </span>
407 + <span class="jp-footer__module-name"><?php esc_html_e( 'Jetpack', 'jetpack' ); ?></span>
396 408 </div>
409 + <?php if ( ! ( new Host() )->is_wpcom_platform() && $my_jetpack_available ) : ?>
410 + <?php $products_section = Footer_Links::get_my_jetpack_products_section(); ?>
397 411 <div class="jp-footer__menu">
398 - <a href="<?php echo esc_url( $jetpack_about_url ); ?>" title="<?php esc_attr__( 'About Jetpack', 'jetpack' ); ?>" class="jp-footer__menu-item">
399 - <?php echo esc_html__( 'About', 'jetpack' ); ?>
400 - </a>
401 - <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'; ?>">
402 - <?php echo esc_html_x( 'Privacy', 'Navigation item', 'jetpack' ); ?>
403 - <?php echo ! $connectable ? $external_link_icon : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
404 - </a>
405 - <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">
406 - <?php echo esc_html_x( 'Terms', 'Navigation item', 'jetpack' ); ?>
407 - <?php echo $external_link_icon; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
408 - </a>
409 - <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">
410 - Version <?php echo esc_html( JETPACK__VERSION ); ?>
411 - <?php echo $external_link_icon; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
412 - </a>
413 - <?php if ( is_multisite() && current_user_can( 'jetpack_network_sites_page' ) ) { ?>
414 - <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>
415 - <?php } ?>
416 - <?php if ( is_multisite() && current_user_can( 'jetpack_network_settings_page' ) ) { ?>
417 - <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>
418 - <?php } ?>
419 - <?php if ( current_user_can( 'manage_options' ) ) { ?>
420 - <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>
421 - <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>
422 - <?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>
423 414 </div>
415 + <?php endif; ?>
424 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' ); ?>">
425 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">
426 418 <desc id="jp-automattic-byline-logo-title">
427 419 <?php echo esc_attr__( 'An Automattic Airline', 'jetpack' ); ?>
@@ -432,6 +424,35 @@
432 424 </div>
433 425 </div>
434 426 </div>
435 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 + }
436 457 }
437 458 }