PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3-a.5
Jetpack – WP Security, Backup, Speed, & Growth v16.3-a.5
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 -130 12.2.3 → 16.3-a.5 View file →
@@ -4,22 +4,27 @@
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 /**
17 - * Jetpack Object.
22 + * Determines whether or not to hide if not active.
18 23 *
19 - * @var Jetpack
24 + * @var bool
20 25 */
21 - public $jetpack;
26 + protected $dont_show_if_not_active;
22 27
23 28 /**
24 29 * Add page specific actions given the page hook.
25 30 *
@@ -44,15 +49,8 @@
44 49 */
45 50 abstract public function page_render();
46 51
47 52 /**
48 - * Should we block the page rendering because the site is in IDC?
49 - *
50 - * @var bool
51 - */
52 - public static $block_page_rendering_for_idc;
53 -
54 - /**
55 53 * Function called after admin_styles to load any additional needed styles.
56 54 *
57 55 * @since 4.3.0
58 56 */
@@ -58,28 +56,8 @@
58 56 */
59 57 public function additional_styles() {}
60 58
61 59 /**
62 - * The constructor.
63 - */
64 - public function __construct() {
65 - add_action( 'jetpack_loaded', array( $this, 'on_jetpack_loaded' ) );
66 - }
67 -
68 - /**
69 - * Runs on Jetpack being ready to load its packages.
70 - *
71 - * @param Jetpack $jetpack object.
72 - */
73 - public function on_jetpack_loaded( $jetpack ) {
74 - $this->jetpack = $jetpack;
75 -
76 - self::$block_page_rendering_for_idc = (
77 - Jetpack::is_connection_ready() && Identity_Crisis::validate_sync_error_idc_option() && ! Jetpack_Options::get_option( 'safe_mode_confirmed' )
78 - );
79 - }
80 -
81 - /**
82 60 * Add common page actions and attach page-specific actions.
83 61 */
84 62 public function add_actions() {
85 63 $is_offline_mode = ( new Status() )->is_offline_mode();
@@ -102,17 +80,13 @@
102 80 // Initialize menu item for the page in the admin.
103 81 $hook = $this->get_page_hook();
104 82
105 83 // Attach hooks common to all Jetpack admin pages based on the created hook.
106 - add_action( "load-$hook", array( $this, 'admin_help' ) );
107 84 add_action( "load-$hook", array( $this, 'admin_page_load' ) );
108 85 add_action( "admin_print_styles-$hook", array( $this, 'admin_styles' ) );
109 86 add_action( "admin_print_scripts-$hook", array( $this, 'admin_scripts' ) );
87 + add_action( "admin_print_styles-$hook", array( $this, 'additional_styles' ) );
110 88
111 - if ( ! self::$block_page_rendering_for_idc ) {
112 - add_action( "admin_print_styles-$hook", array( $this, 'additional_styles' ) );
113 - }
114 -
115 89 // Check if the site plan changed and deactivate modules accordingly.
116 90 add_action( 'current_screen', array( $this, 'check_plan_deactivate_modules' ) );
117 91
118 92 // Attach page specific actions in addition to the above.
@@ -117,43 +91,26 @@
117 91
118 92 // Attach page specific actions in addition to the above.
119 93 $this->add_page_actions( $hook );
120 94
121 - // If the current user can connect Jetpack, Jetpack isn't connected, and is not in offline mode, let's prompt!
122 - if ( current_user_can( 'jetpack_connect' ) && $connectable ) {
123 - $this->add_connection_banner_actions();
124 - }
95 + // Override the page title for the module list page and the debugger page.
96 + add_action( 'current_screen', array( __CLASS__, 'override_page_title' ) );
125 97 }
126 98
127 99 /**
128 - * Hooks to add when Jetpack is not active or in offline mode for an user capable of connecting.
129 - */
130 - private function add_connection_banner_actions() {
131 - global $pagenow;
132 - // If someone just activated Jetpack, let's show them a fullscreen connection banner.
133 - if ( ( 'admin.php' === $pagenow && isset( $_GET['page'] ) && 'jetpack' === $_GET['page'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
134 - add_action( 'admin_enqueue_scripts', array( 'Jetpack_Connection_Banner', 'enqueue_banner_scripts' ) );
135 - add_action( 'admin_enqueue_scripts', array( 'Jetpack_Connection_Banner', 'enqueue_connect_button_scripts' ) );
136 - delete_transient( 'activated_jetpack' );
137 - }
138 -
139 - // If Jetpack not yet connected, but user is viewing one of the pages with a Jetpack connection banner.
140 - if ( ( 'index.php' === $pagenow || 'plugins.php' === $pagenow ) ) {
141 - add_action( 'admin_enqueue_scripts', array( 'Jetpack_Connection_Banner', 'enqueue_connect_button_scripts' ) );
142 - }
143 - }
144 -
145 - /**
146 100 * Render the page with a common top and bottom part, and page specific content.
147 101 */
148 102 public function render() {
103 + /** This action is documented in class.jetpack.php */
104 + do_action( 'jetpack_initialize_tracking' );
105 +
149 106 // We're in an IDC: we need a decision made before we show the UI again.
150 - if ( self::$block_page_rendering_for_idc ) {
107 + if ( $this->block_page_rendering_for_idc() ) {
151 108 return;
152 109 }
153 110
154 - // Check if we are looking at the main dashboard.
155 - 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.
156 113 $this->page_render();
157 114 return;
158 115 }
159 116
@@ -160,9 +117,10 @@
160 117 $args = array();
161 118
162 119 // phpcs:ignore WordPress.Security.NonceVerification.Recommended
163 120 if ( isset( $_GET['page'] ) && 'jetpack_modules' === $_GET['page'] ) {
164 - $args['is-wide'] = true;
121 + $args['is-wide'] = true;
122 + $args['show-nav'] = false;
165 123 }
166 124
167 125 self::wrap_ui( array( $this, 'page_render' ), $args );
168 126 }
@@ -167,21 +125,12 @@
167 125 self::wrap_ui( array( $this, 'page_render' ), $args );
168 126 }
169 127
170 128 /**
171 - * Load Help tab.
172 - *
173 - * @todo This may no longer be used.
174 - */
175 - public function admin_help() {
176 - $this->jetpack->admin_help();
177 - }
178 -
179 - /**
180 129 * Call the existing admin page events.
181 130 */
182 131 public function admin_page_load() {
183 - $this->jetpack->admin_page_load();
132 + Jetpack::init()->admin_page_load();
184 133 }
185 134
186 135 /**
187 136 * Add page specific scripts and jetpack stats for all menu pages.
@@ -187,9 +136,9 @@
187 136 * Add page specific scripts and jetpack stats for all menu pages.
188 137 */
189 138 public function admin_scripts() {
190 139 $this->page_admin_scripts(); // Delegate to inheriting class.
191 - add_action( 'admin_footer', array( $this->jetpack, 'do_stats' ) );
140 + add_action( 'admin_footer', array( Jetpack::init(), 'do_stats' ) );
192 141 }
193 142
194 143 /**
195 144 * Enqueue the Jetpack admin stylesheet.
@@ -196,9 +145,9 @@
196 145 */
197 146 public function admin_styles() {
198 147 $min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
199 148
200 - 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' );
201 150 wp_style_add_data( 'jetpack-admin', 'rtl', 'replace' );
202 151 wp_style_add_data( 'jetpack-admin', 'suffix', $min );
203 152 }
204 153
@@ -216,8 +165,28 @@
216 165 apply_filters( 'rest_authentication_errors', true );
217 166 }
218 167
219 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 + /**
220 189 * Checks the site plan and deactivates modules that were active but are no longer included in the plan.
221 190 *
222 191 * @since 4.4.0
223 192 *
@@ -231,8 +200,9 @@
231 200 || ! in_array(
232 201 $page->base,
233 202 array(
234 203 'toplevel_page_jetpack',
204 + 'jetpack_page_jetpack-settings',
235 205 'admin_page_jetpack_modules',
236 206 'jetpack_page_vaultpress',
237 207 'jetpack_page_stats',
238 208 'jetpack_page_akismet-key-config',
@@ -290,12 +260,12 @@
290 260
291 261 /**
292 262 * Build header, content, and footer for admin page.
293 263 *
294 - * @param string $callback Callback to produce the content of the page. The callback is responsible for any needed escaping.
295 - * @param array $args Options for the wrapping. Also passed to the `jetpack_admin_pages_wrap_ui_after_callback` action.
296 - * - is-wide: (bool) Set the "is-wide" class on the wrapper div, which increases the max width. Default false.
297 - * - 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.
298 268 */
299 269 public static function wrap_ui( $callback, $args = array() ) {
300 270 $defaults = array(
301 271 'is-wide' => false,
@@ -307,19 +277,16 @@
307 277 // True means that Jetpack is NOT connected and NOT in offline mode.
308 278 // If Jetpack is connected OR in offline mode, this will be false.
309 279 $connectable = ! Jetpack::is_connection_ready() && ! ( new Status() )->is_offline_mode();
310 280
311 - $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 +
312 285 $jetpack_about_url = ! $connectable
313 286 ? admin_url( 'admin.php?page=jetpack_about' )
314 287 : Redirect::get_url( 'jetpack' );
315 288
316 - $jetpack_privacy_url = ! $connectable
317 - ? $jetpack_admin_url . '#/privacy'
318 - : Redirect::get_url( 'a8c-privacy' );
319 -
320 - $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>';
321 -
322 289 ?>
323 290 <div id="jp-plugin-container" class="
324 291 <?php
325 292 if ( $args['is-wide'] ) {
@@ -326,17 +293,51 @@
326 293 echo 'is-wide'; }
327 294 ?>
328 295 ">
329 296
330 - <div class="jp-masthead jp-masthead-middle">
297 + <header class="jp-masthead">
331 298 <div class="jp-masthead__inside-container">
332 - <div class="jp-masthead__logo-container">
333 - <a class="jp-masthead__logo-link" href="<?php echo esc_url( $jetpack_admin_url ); ?>">
334 - <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>
335 - </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>
336 337 </div>
337 338 <?php
338 - if ( $args['show-nav'] ) :
339 + if ( $args['show-nav'] && ! ( new Host() )->is_wpcom_platform() ) :
339 340 ?>
340 341 <div class="jp-masthead__nav">
341 342 <?php
342 343 if ( is_network_admin() ) {
@@ -357,24 +358,17 @@
357 358 <?php
358 359 }
359 360 ?>
360 361 </span>
361 - <?php } else { ?>
362 + <?php } elseif ( current_user_can( 'jetpack_manage_modules' ) ) { ?>
362 363 <span class="dops-button-group">
363 - <a href="<?php echo esc_url( $jetpack_admin_url ); ?>" type="button" class="dops-button is-compact"><?php esc_html_e( 'Dashboard', 'jetpack' ); ?></a>
364 - <?php
365 - if ( current_user_can( 'jetpack_manage_modules' ) ) {
366 - ?>
367 - <a href="<?php echo esc_url( $jetpack_admin_url . '#/settings' ); ?>" type="button" class="dops-button is-compact"><?php esc_html_e( 'Settings', 'jetpack' ); ?></a>
368 - <?php
369 - }
370 - ?>
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>
371 365 </span>
372 366 <?php } ?>
373 367 </div>
374 368 <?php endif; ?>
375 369 </div>
376 - </div>
370 + </header>
377 371 <div class="wrap"><div id="jp-admin-notices" aria-live="polite"></div></div>
378 372 <!-- START OF CALLBACK -->
379 373 <?php
380 374 ob_start();
@@ -409,41 +403,17 @@
409 403 <?php esc_html_e( 'Jetpack Logo', 'jetpack' ); ?>
410 404 </desc>
411 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>
412 406 </svg>
413 - <span class="jp-footer__module-name">
414 - <a href="<?php echo esc_url( Redirect::get_url( 'jetpack' ) ); ?>" target="_blank" rel="noopener noreferrer" aria-label="Jetpack 12.2-a.0">
415 - <?php esc_html_e( 'Jetpack', 'jetpack' ); ?>
416 - </a>
417 - </span>
407 + <span class="jp-footer__module-name"><?php esc_html_e( 'Jetpack', 'jetpack' ); ?></span>
418 408 </div>
409 + <?php if ( ! ( new Host() )->is_wpcom_platform() && $my_jetpack_available ) : ?>
410 + <?php $products_section = Footer_Links::get_my_jetpack_products_section(); ?>
419 411 <div class="jp-footer__menu">
420 - <a href="<?php echo esc_url( $jetpack_about_url ); ?>" title="<?php esc_attr__( 'About Jetpack', 'jetpack' ); ?>" class="jp-footer__menu-item">
421 - <?php echo esc_html__( 'About', 'jetpack' ); ?>
422 - </a>
423 - <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'; ?>">
424 - <?php echo esc_html_x( 'Privacy', 'Navigation item', 'jetpack' ); ?>
425 - <?php echo ! $connectable ? $external_link_icon : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
426 - </a>
427 - <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">
428 - <?php echo esc_html_x( 'Terms', 'Navigation item', 'jetpack' ); ?>
429 - <?php echo $external_link_icon; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
430 - </a>
431 - <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">
432 - Version <?php echo esc_html( JETPACK__VERSION ); ?>
433 - <?php echo $external_link_icon; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
434 - </a>
435 - <?php if ( is_multisite() && current_user_can( 'jetpack_network_sites_page' ) ) { ?>
436 - <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>
437 - <?php } ?>
438 - <?php if ( is_multisite() && current_user_can( 'jetpack_network_settings_page' ) ) { ?>
439 - <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>
440 - <?php } ?>
441 - <?php if ( current_user_can( 'manage_options' ) ) { ?>
442 - <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>
443 - <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>
444 - <?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>
445 414 </div>
415 + <?php endif; ?>
446 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' ); ?>">
447 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">
448 418 <desc id="jp-automattic-byline-logo-title">
449 419 <?php echo esc_attr__( 'An Automattic Airline', 'jetpack' ); ?>
@@ -454,6 +424,35 @@
454 424 </div>
455 425 </div>
456 426 </div>
457 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 + }
458 457 }
459 458 }