PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 8.2
Jetpack – WP Security, Backup, Speed, & Growth v8.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 13.9.2 14.0.1 14.1.1 14.2.2 14.3.1 All 501 releases
jetpack / class.jetpack-idc.php

class.jetpack-idc.php in Jetpack – WP Security, Backup, Speed, & Growth 8.2, at class.jetpack-idc.php

720 lines 20.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 use Automattic\Jetpack\Assets;
4 use Automattic\Jetpack\Assets\Logo as Jetpack_Logo;
5
6 /**
7 * This class will handle everything involved with fixing an Identity Crisis.
8 *
9 * @since 4.4.0
10 */
11 class Jetpack_IDC {
12
13 /**
14 * @var Jetpack_IDC
15 **/
16 private static $instance = null;
17
18 /**
19 * The wpcom value of the home URL
20 *
21 * @var string
22 */
23 static $wpcom_home_url;
24
25 /**
26 * Has safe mode been confirmed?
27 *
28 * @var bool
29 */
30 static $is_safe_mode_confirmed;
31
32 /**
33 * The current screen, which is set if the current user is a non-admin and this is an admin page.
34 *
35 * @var WP_Screen
36 */
37 static $current_screen;
38
39 /**
40 * The link to the support document used to explain Safe Mode to users
41 *
42 * @var string
43 */
44 const SAFE_MODE_DOC_LINK = 'https://jetpack.com/support/safe-mode';
45
46 static function init() {
47 if ( is_null( self::$instance ) ) {
48 self::$instance = new Jetpack_IDC();
49 }
50
51 return self::$instance;
52 }
53
54 private function __construct() {
55 add_action( 'jetpack_sync_processed_actions', array( $this, 'maybe_clear_migrate_option' ) );
56 if ( false === $urls_in_crisis = Jetpack::check_identity_crisis() ) {
57 return;
58 }
59
60 self::$wpcom_home_url = $urls_in_crisis['wpcom_home'];
61 add_action( 'init', array( $this, 'wordpress_init' ) );
62 }
63
64 /**
65 * This method loops through the array of processed items from sync and checks if one of the items was the
66 * home_url or site_url callable. If so, then we delete the jetpack_migrate_for_idc option.
67 *
68 * @param $processed_items array Array of processed items that were synced to WordPress.com
69 */
70 function maybe_clear_migrate_option( $processed_items ) {
71 foreach ( (array) $processed_items as $item ) {
72
73 // First, is this item a jetpack_sync_callable action? If so, then proceed.
74 $callable_args = ( is_array( $item ) && isset( $item[0], $item[1] ) && 'jetpack_sync_callable' === $item[0] )
75 ? $item[1]
76 : null;
77
78 // Second, if $callable_args is set, check if the callable was home_url or site_url. If so,
79 // clear the migrate option.
80 if (
81 isset( $callable_args, $callable_args[0] )
82 && ( 'home_url' === $callable_args[0] || 'site_url' === $callable_args[1] )
83 ) {
84 Jetpack_Options::delete_option( 'migrate_for_idc' );
85 break;
86 }
87 }
88 }
89
90 function wordpress_init() {
91 if ( ! current_user_can( 'jetpack_disconnect' ) && is_admin() ) {
92 add_action( 'admin_notices', array( $this, 'display_non_admin_idc_notice' ) );
93 add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_idc_notice_files' ) );
94 add_action( 'current_screen', array( $this, 'non_admins_current_screen_check' ) );
95 return;
96 }
97
98 if (
99 isset( $_GET['jetpack_idc_clear_confirmation'], $_GET['_wpnonce'] ) &&
100 wp_verify_nonce( $_GET['_wpnonce'], 'jetpack_idc_clear_confirmation' )
101 ) {
102 Jetpack_Options::delete_option( 'safe_mode_confirmed' );
103 self::$is_safe_mode_confirmed = false;
104 } else {
105 self::$is_safe_mode_confirmed = (bool) Jetpack_Options::get_option( 'safe_mode_confirmed' );
106 }
107
108 // 121 Priority so that it's the most inner Jetpack item in the admin bar.
109 add_action( 'admin_bar_menu', array( $this, 'display_admin_bar_button' ), 121 );
110 add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_bar_css' ) );
111
112 if ( is_admin() && ! self::$is_safe_mode_confirmed ) {
113 add_action( 'admin_notices', array( $this, 'display_idc_notice' ) );
114 add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_idc_notice_files' ) );
115 }
116 }
117
118 function non_admins_current_screen_check( $current_screen ) {
119 self::$current_screen = $current_screen;
120 if ( isset( $current_screen->id ) && 'toplevel_page_jetpack' == $current_screen->id ) {
121 return null;
122 }
123
124 // If the user has dismissed the notice, and we're not currently on a Jetpack page,
125 // then do not show the non-admin notice.
126 if ( isset( $_COOKIE, $_COOKIE['jetpack_idc_dismiss_notice'] ) ) {
127 remove_action( 'admin_notices', array( $this, 'display_non_admin_idc_notice' ) );
128 remove_action( 'admin_enqueue_scripts', array( $this, 'enqueue_idc_notice_files' ) );
129 }
130 }
131
132 function display_admin_bar_button() {
133 global $wp_admin_bar;
134
135 $href = is_admin()
136 ? add_query_arg( 'jetpack_idc_clear_confirmation', '1' )
137 : add_query_arg( 'jetpack_idc_clear_confirmation', '1', admin_url() );
138
139 $href = wp_nonce_url( $href, 'jetpack_idc_clear_confirmation' );
140
141 $title = sprintf(
142 '<span class="jp-idc-admin-bar">%s %s</span>',
143 '<span class="dashicons dashicons-warning"></span>',
144 esc_html__( 'Jetpack Safe Mode', 'jetpack' )
145 );
146
147 $menu = array(
148 'id' => 'jetpack-idc',
149 'title' => $title,
150 'href' => esc_url( $href ),
151 'parent' => 'top-secondary',
152 );
153
154 if ( ! self::$is_safe_mode_confirmed ) {
155 $menu['meta'] = array(
156 'class' => 'hide',
157 );
158 }
159
160 $wp_admin_bar->add_node( $menu );
161 }
162
163 static function prepare_url_for_display( $url ) {
164 return untrailingslashit( Jetpack::normalize_url_protocol_agnostic( $url ) );
165 }
166
167 /**
168 * Clears all IDC specific options. This method is used on disconnect and reconnect.
169 */
170 static function clear_all_idc_options() {
171 // If the site is currently in IDC, let's also clear the VaultPress connection options.
172 // We have to check if the site is in IDC, otherwise we'd be clearing the VaultPress
173 // connection any time the Jetpack connection is cycled.
174 if ( Jetpack::validate_sync_error_idc_option() ) {
175 delete_option( 'vaultpress' );
176 delete_option( 'vaultpress_auto_register' );
177 }
178
179 Jetpack_Options::delete_option(
180 array(
181 'sync_error_idc',
182 'safe_mode_confirmed',
183 'migrate_for_idc',
184 )
185 );
186 }
187
188 /**
189 * Does the current admin page have help tabs?
190 *
191 * @return bool
192 */
193 function admin_page_has_help_tabs() {
194 if ( ! function_exists( 'get_current_screen' ) ) {
195 return false;
196 }
197
198 $current_screen = get_current_screen();
199 $tabs = $current_screen->get_help_tabs();
200
201 return ! empty( $tabs );
202 }
203
204 function display_non_admin_idc_notice() {
205 $classes = 'jp-idc-notice inline is-non-admin notice notice-warning';
206 if ( isset( self::$current_screen ) && 'toplevel_page_jetpack' != self::$current_screen->id ) {
207 $classes .= ' is-dismissible';
208 }
209
210 if ( $this->admin_page_has_help_tabs() ) {
211 $classes .= ' has-help-tabs';
212 }
213 ?>
214
215 <div class="<?php echo $classes; ?>">
216 <?php $this->render_notice_header(); ?>
217 <div class="jp-idc-notice__content-header">
218 <h3 class="jp-idc-notice__content-header__lead">
219 <?php echo $this->get_non_admin_notice_text(); ?>
220 </h3>
221
222 <p class="jp-idc-notice__content-header__explanation">
223 <?php echo $this->get_non_admin_contact_admin_text(); ?>
224 </p>
225 </div>
226 </div>
227 <?php
228 }
229
230 /**
231 * First "step" of the IDC mitigation. Will provide some messaging and two options/buttons.
232 * "Confirm Staging" - Dismiss the notice and continue on with our lives in staging mode.
233 * "Fix Jetpack Connection" - Will disconnect the site and start the mitigation...
234 */
235 function display_idc_notice() {
236 $classes = 'jp-idc-notice inline notice notice-warning';
237 if ( $this->admin_page_has_help_tabs() ) {
238 $classes .= ' has-help-tabs';
239 }
240 ?>
241 <div class="<?php echo $classes; ?>">
242 <?php $this->render_notice_header(); ?>
243 <?php $this->render_notice_first_step(); ?>
244 <?php $this->render_notice_second_step(); ?>
245 </div>
246 <?php
247 }
248
249 function enqueue_admin_bar_css() {
250 wp_enqueue_style(
251 'jetpack-idc-admin-bar-css',
252 plugins_url( 'css/jetpack-idc-admin-bar.css', JETPACK__PLUGIN_FILE ),
253 array( 'dashicons' ),
254 JETPACK__VERSION
255 );
256 }
257
258 /**
259 * Enqueue scripts for the notice
260 */
261 function enqueue_idc_notice_files() {
262
263 wp_enqueue_script(
264 'jetpack-idc-js',
265 Assets::get_file_url_for_environment( '_inc/build/idc-notice.min.js', '_inc/idc-notice.js' ),
266 array( 'jquery' ),
267 JETPACK__VERSION,
268 true
269 );
270
271 wp_localize_script(
272 'jetpack-idc-js',
273 'idcL10n',
274 array(
275 'apiRoot' => esc_url_raw( rest_url() ),
276 'nonce' => wp_create_nonce( 'wp_rest' ),
277 'tracksUserData' => Jetpack_Tracks_Client::get_connected_user_tracks_identity(),
278 'currentUrl' => remove_query_arg( '_wpnonce', remove_query_arg( 'jetpack_idc_clear_confirmation' ) ),
279 'tracksEventData' => array(
280 'isAdmin' => current_user_can( 'jetpack_disconnect' ),
281 'currentScreen' => self::$current_screen ? self::$current_screen->id : false,
282 ),
283 )
284 );
285
286 if ( ! wp_style_is( 'jetpack-dops-style' ) ) {
287 wp_register_style(
288 'jetpack-dops-style',
289 plugins_url( '_inc/build/admin.css', JETPACK__PLUGIN_FILE ),
290 array(),
291 JETPACK__VERSION
292 );
293 }
294
295 wp_enqueue_style(
296 'jetpack-idc-css',
297 plugins_url( 'css/jetpack-idc.css', JETPACK__PLUGIN_FILE ),
298 array( 'jetpack-dops-style' ),
299 JETPACK__VERSION
300 );
301
302 // Required for Tracks
303 wp_enqueue_script(
304 'jp-tracks',
305 '//stats.wp.com/w.js',
306 array(),
307 gmdate( 'YW' ),
308 true
309 );
310
311 wp_enqueue_script(
312 'jp-tracks-functions',
313 plugins_url( '_inc/lib/tracks/tracks-callables.js', JETPACK__PLUGIN_FILE ),
314 array(),
315 JETPACK__VERSION,
316 false
317 );
318 }
319
320 function render_notice_header() {
321 ?>
322 <div class="jp-idc-notice__header">
323 <div class="jp-idc-notice__header__emblem">
324 <?php
325 $jetpack_logo = new Jetpack_Logo();
326 echo $jetpack_logo->get_jp_emblem();
327 ?>
328 </div>
329 <p class="jp-idc-notice__header__text">
330 <?php esc_html_e( 'Jetpack Safe Mode', 'jetpack' ); ?>
331 </p>
332 </div>
333
334 <div class="jp-idc-notice__separator"></div>
335 <?php
336 }
337
338 /**
339 * Is a container for the error notices.
340 * Will be shown/controlled by jQuery in idc-notice.js
341 */
342 function render_error_notice() {
343 ?>
344 <div class="jp-idc-error__notice dops-notice is-error">
345 <svg class="gridicon gridicons-notice dops-notice__icon" height="24" width="24" viewBox="0 0 24 24">
346 <g>
347 <path d="M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2l-.5-6h3l-.5 6z"></path>
348 </g>
349 </svg>
350 <div class="dops-notice__content">
351 <span class="dops-notice__text">
352 <?php esc_html_e( 'Something went wrong:', 'jetpack' ); ?>
353 <span class="jp-idc-error__desc"></span>
354 </span>
355 <a class="dops-notice__action" href="javascript:void(0);">
356 <span id="jp-idc-error__action">
357 <?php esc_html_e( 'Try Again', 'jetpack' ); ?>
358 </span>
359 </a>
360 </div>
361 </div>
362 <?php
363 }
364
365 function render_notice_first_step() {
366 ?>
367 <div class="jp-idc-notice__first-step">
368 <div class="jp-idc-notice__content-header">
369 <h3 class="jp-idc-notice__content-header__lead">
370 <?php echo $this->get_first_step_header_lead(); ?>
371 </h3>
372
373 <p class="jp-idc-notice__content-header__explanation">
374 <?php echo $this->get_first_step_header_explanation(); ?>
375 </p>
376 </div>
377
378 <?php $this->render_error_notice(); ?>
379
380 <div class="jp-idc-notice__actions">
381 <div class="jp-idc-notice__action">
382 <p class="jp-idc-notice__action__explanation">
383 <?php echo $this->get_confirm_safe_mode_action_explanation(); ?>
384 </p>
385 <button id="jp-idc-confirm-safe-mode-action" class="dops-button">
386 <?php echo $this->get_confirm_safe_mode_button_text(); ?>
387 </button>
388 </div>
389
390 <div class="jp-idc-notice__action">
391 <p class="jp-idc-notice__action__explanation">
392 <?php echo $this->get_first_step_fix_connection_action_explanation(); ?>
393 </p>
394 <button id="jp-idc-fix-connection-action" class="dops-button">
395 <?php echo $this->get_first_step_fix_connection_button_text(); ?>
396 </button>
397 </div>
398 </div>
399 </div>
400 <?php
401 }
402
403 function render_notice_second_step() {
404 ?>
405 <div class="jp-idc-notice__second-step">
406 <div class="jp-idc-notice__content-header">
407 <h3 class="jp-idc-notice__content-header__lead">
408 <?php echo $this->get_second_step_header_lead(); ?>
409 </h3>
410 </div>
411
412 <?php $this->render_error_notice(); ?>
413
414 <div class="jp-idc-notice__actions">
415 <div class="jp-idc-notice__action">
416 <p class="jp-idc-notice__action__explanation">
417 <?php echo $this->get_migrate_site_action_explanation(); ?>
418 </p>
419 <button id="jp-idc-migrate-action" class="dops-button">
420 <?php echo $this->get_migrate_site_button_text(); ?>
421 </button>
422 </div>
423
424 <div class="jp-idc-notice__action">
425 <p class="jp-idc-notice__action__explanation">
426 <?php echo $this->get_start_fresh_action_explanation(); ?>
427 </p>
428 <button id="jp-idc-reconnect-site-action" class="dops-button">
429 <?php echo $this->get_start_fresh_button_text(); ?>
430 </button>
431 </div>
432
433 </div>
434
435 <p class="jp-idc-notice__unsure-prompt">
436 <?php echo $this->get_unsure_prompt(); ?>
437 </p>
438 </div>
439 <?php
440 }
441
442 function get_first_step_header_lead() {
443 $html = wp_kses(
444 sprintf(
445 __(
446 'Jetpack has been placed into <a href="%1$s">Safe mode</a> because we noticed this is an exact copy of <a href="%2$s">%3$s</a>.',
447 'jetpack'
448 ),
449 esc_url( self::SAFE_MODE_DOC_LINK ),
450 esc_url( self::$wpcom_home_url ),
451 self::prepare_url_for_display( esc_url_raw( self::$wpcom_home_url ) )
452 ),
453 array( 'a' => array( 'href' => array() ) )
454 );
455
456 /**
457 * Allows overriding of the default header text in the first step of the Safe Mode notice.
458 *
459 * @since 4.4.0
460 *
461 * @param string $html The HTML to be displayed
462 */
463 return apply_filters( 'jetpack_idc_first_step_header_lead', $html );
464 }
465
466 function get_first_step_header_explanation() {
467 $html = wp_kses(
468 sprintf(
469 __(
470 'Please confirm Safe Mode or fix the Jetpack connection. Select one of the options below or <a href="%1$s">learn
471 more about Safe Mode</a>.',
472 'jetpack'
473 ),
474 esc_url( self::SAFE_MODE_DOC_LINK )
475 ),
476 array( 'a' => array( 'href' => array() ) )
477 );
478
479 /**
480 * Allows overriding of the default header explanation text in the first step of the Safe Mode notice.
481 *
482 * @since 4.4.0
483 *
484 * @param string $html The HTML to be displayed
485 */
486 return apply_filters( 'jetpack_idc_first_step_header_explanation', $html );
487 }
488
489 function get_confirm_safe_mode_action_explanation() {
490 $html = wp_kses(
491 sprintf(
492 __(
493 'Is this website a temporary duplicate of <a href="%1$s">%2$s</a> for the purposes
494 of testing, staging or development? If so, we recommend keeping it in Safe Mode.',
495 'jetpack'
496 ),
497 esc_url( untrailingslashit( self::$wpcom_home_url ) ),
498 self::prepare_url_for_display( esc_url( self::$wpcom_home_url ) )
499 ),
500 array( 'a' => array( 'href' => array() ) )
501 );
502
503 /**
504 * Allows overriding of the default text used to explain the confirm safe mode action.
505 *
506 * @since 4.4.0
507 *
508 * @param string $html The HTML to be displayed
509 */
510 return apply_filters( 'jetpack_idc_confirm_safe_mode_explanation', $html );
511 }
512
513 function get_confirm_safe_mode_button_text() {
514 $string = esc_html__( 'Confirm Safe Mode', 'jetpack' );
515
516 /**
517 * Allows overriding of the default text used for the confirm safe mode action button.
518 *
519 * @since 4.4.0
520 *
521 * @param string $string The string to be displayed
522 */
523 return apply_filters( 'jetpack_idc_confirm_safe_mode_button_text', $string );
524 }
525
526 function get_first_step_fix_connection_action_explanation() {
527 $html = wp_kses(
528 sprintf(
529 __(
530 'If this is a separate and new website, or the new home of <a href="%1$s">%2$s</a>,
531 we recommend turning Safe Mode off, and re-establishing your connection to WordPress.com.',
532 'jetpack'
533 ),
534 esc_url( untrailingslashit( self::$wpcom_home_url ) ),
535 self::prepare_url_for_display( esc_url( self::$wpcom_home_url ) )
536 ),
537 array( 'a' => array( 'href' => array() ) )
538 );
539
540 /**
541 * Allows overriding of the default text used to explain the fix Jetpack connection action.
542 *
543 * @since 4.4.0
544 *
545 * @param string $html The HTML to be displayed
546 */
547 return apply_filters( 'jetpack_idc_first_fix_connection_explanation', $html );
548 }
549
550 function get_first_step_fix_connection_button_text() {
551 $string = esc_html__( "Fix Jetpack's Connection", 'jetpack' );
552
553 /**
554 * Allows overriding of the default text used for the fix Jetpack connection action button.
555 *
556 * @since 4.4.0
557 *
558 * @param string $string The string to be displayed
559 */
560 return apply_filters( 'jetpack_idc_first_step_fix_connection_button_text', $string );
561 }
562
563 function get_second_step_header_lead() {
564 $string = sprintf(
565 esc_html__(
566 'Is %1$s the new home of %2$s?',
567 'jetpack'
568 ),
569 untrailingslashit( Jetpack::normalize_url_protocol_agnostic( get_home_url() ) ),
570 untrailingslashit( Jetpack::normalize_url_protocol_agnostic( esc_url_raw( self::$wpcom_home_url ) ) )
571 );
572
573 /**
574 * Allows overriding of the default header text in the second step of the Safe Mode notice.
575 *
576 * @since 4.4.0
577 *
578 * @param string $html The HTML to be displayed
579 */
580 return apply_filters( 'jetpack_idc_second_step_header_lead', $string );
581 }
582
583 function get_migrate_site_action_explanation() {
584 $html = wp_kses(
585 sprintf(
586 __(
587 'Yes. <a href="%1$s">%2$s</a> is replacing <a href="%3$s">%4$s</a>. I would like to
588 migrate my stats and subscribers from <a href="%3$s">%4$s</a> to <a href="%1$s">%2$s</a>.',
589 'jetpack'
590 ),
591 esc_url( get_home_url() ),
592 self::prepare_url_for_display( get_home_url() ),
593 esc_url( self::$wpcom_home_url ),
594 untrailingslashit( Jetpack::normalize_url_protocol_agnostic( esc_url_raw( self::$wpcom_home_url ) ) )
595 ),
596 array( 'a' => array( 'href' => array() ) )
597 );
598
599 /**
600 * Allows overriding of the default text for explaining the migrate site action.
601 *
602 * @since 4.4.0
603 *
604 * @param string $html The HTML to be displayed
605 */
606 return apply_filters( 'jetpack_idc_migrate_site_explanation', $html );
607 }
608
609 function get_migrate_site_button_text() {
610 $string = esc_html__( 'Migrate Stats &amp; Subscribers', 'jetpack' );
611
612 /**
613 * Allows overriding of the default text used for the migrate site action button.
614 *
615 * @since 4.4.0
616 *
617 * @param string $string The string to be displayed
618 */
619 return apply_filters( 'jetpack_idc_migrate_site_button_text', $string );
620 }
621
622 function get_start_fresh_action_explanation() {
623 $html = wp_kses(
624 sprintf(
625 __(
626 'No. <a href="%1$s">%2$s</a> is a new and different website that\'s separate from
627 <a href="%3$s">%4$s</a>. It requires a new connection to WordPress.com for new stats and subscribers.',
628 'jetpack'
629 ),
630 esc_url( get_home_url() ),
631 self::prepare_url_for_display( get_home_url() ),
632 esc_url( self::$wpcom_home_url ),
633 untrailingslashit( Jetpack::normalize_url_protocol_agnostic( esc_url_raw( self::$wpcom_home_url ) ) )
634 ),
635 array( 'a' => array( 'href' => array() ) )
636 );
637
638 /**
639 * Allows overriding of the default text for explaining the start fresh action.
640 *
641 * @since 4.4.0
642 *
643 * @param string $html The HTML to be displayed
644 */
645 return apply_filters( 'jetpack_idc_start_fresh_explanation', $html );
646 }
647
648 function get_start_fresh_button_text() {
649 $string = esc_html__( 'Start Fresh &amp; Create New Connection', 'jetpack' );
650
651 /**
652 * Allows overriding of the default text used for the start fresh action button.
653 *
654 * @since 4.4.0
655 *
656 * @param string $string The string to be displayed
657 */
658 return apply_filters( 'jetpack_idc_start_fresh_button_text', $string );
659 }
660
661 function get_unsure_prompt() {
662 $html = wp_kses(
663 sprintf(
664 __(
665 'Unsure what to do? <a href="%1$s">Read more about Jetpack Safe Mode</a>',
666 'jetpack'
667 ),
668 esc_url( self::SAFE_MODE_DOC_LINK )
669 ),
670 array( 'a' => array( 'href' => array() ) )
671 );
672
673 /**
674 * Allows overriding of the default text using in the "Unsure what to do?" prompt.
675 *
676 * @since 4.4.0
677 *
678 * @param string $html The HTML to be displayed
679 */
680 return apply_filters( 'jetpack_idc_unsure_prompt', $html );
681 }
682
683 function get_non_admin_notice_text() {
684 $html = wp_kses(
685 sprintf(
686 __(
687 'Jetpack has been placed into Safe Mode. Learn more about <a href="%1$s">Safe Mode</a>.',
688 'jetpack'
689 ),
690 esc_url( self::SAFE_MODE_DOC_LINK )
691 ),
692 array( 'a' => array( 'href' => array() ) )
693 );
694
695 /**
696 * Allows overriding of the default text that is displayed to non-admin on the Jetpack admin page.
697 *
698 * @since 4.4.0
699 *
700 * @param string $html The HTML to be displayed
701 */
702 return apply_filters( 'jetpack_idc_non_admin_notice_text', $html );
703 }
704
705 function get_non_admin_contact_admin_text() {
706 $string = esc_html__( 'An administrator of this site can take Jetpack out of Safe Mode.', 'jetpack' );
707
708 /**
709 * Allows overriding of the default text that is displayed to non-admins prompting them to contact an admin.
710 *
711 * @since 4.4.0
712 *
713 * @param string $string The string to be displayed
714 */
715 return apply_filters( 'jetpack_idc_non_admin_contact_admin_text', $string );
716 }
717 }
718
719 add_action( 'plugins_loaded', array( 'Jetpack_IDC', 'init' ) );
720