Completed
Push — master-stable ( e17c57...c646dd )
by
unknown
276:05 queued 265:38
created

class.jetpack-jitm.php (3 issues)

Labels
Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
/**
4
 * Jetpack just in time messaging through out the admin
5
 *
6
 * @since 3.7.0
7
 */
8
class Jetpack_JITM {
9
10
	/**
11
	 * @var Jetpack_JITM
12
	 **/
13
	private static $instance = null;
14
15
	/**
16
	 * Get user dismissed messages.
17
	 *
18
	 * @var array
19
	 */
20
	private static $jetpack_hide_jitm = null;
21
22
	/**
23
	 * Whether plugin auto updates are allowed in this WordPress installation or not.
24
	 *
25
	 * @var bool
26
	 */
27
	private static $auto_updates_allowed = false;
28
29
	static function init() {
30
		if ( is_null( self::$instance ) ) {
31
			self::$instance = new Jetpack_JITM;
32
		}
33
34
		return self::$instance;
35
	}
36
37
	private function __construct() {
38
		if ( ! Jetpack::is_active() || self::is_jitm_dismissed() ) {
39
			return;
40
		}
41
		add_action( 'current_screen', array( $this, 'prepare_jitms' ) );
42
	}
43
44
	/**
45
	 * Prepare actions according to screen and post type.
46
	 *
47
	 * @since 3.8.2
48
	 *
49
	 * @uses Jetpack_Autoupdate::get_possible_failures()
50
	 *
51
	 * @param object $screen
52
	 */
53
	function prepare_jitms( $screen ) {
54
		if ( ! current_user_can( 'jetpack_manage_modules' ) ) {
55
			return;
56
		}
57
58
		if ( 'edit-comments' == $screen->base && ! Jetpack::is_plugin_active( 'akismet/akismet.php' ) ) {
59
			add_action( 'admin_enqueue_scripts', array( $this, 'jitm_enqueue_files' ) );
60
			add_action( 'admin_notices', array( $this, 'akismet_msg' ) );
61
		}
62
		elseif (
63
			'post' == $screen->base
64
			&& ( isset( $_GET['message'] ) && 6 == $_GET['message'] )
65
			&& ! Jetpack::is_plugin_active( 'vaultpress/vaultpress.php' )
66
		) {
67
			add_action( 'admin_enqueue_scripts', array( $this, 'jitm_enqueue_files' ) );
68
			add_action( 'edit_form_top', array( $this, 'backups_after_publish_msg' ) );
69
		}
70
		elseif ( 'update-core' == $screen->base && ! Jetpack::is_plugin_active( 'vaultpress/vaultpress.php' ) ) {
71
			add_action( 'admin_enqueue_scripts', array( $this, 'jitm_enqueue_files' ) );
72
			add_action( 'admin_notices', array( $this, 'backups_updates_msg' ) );
73
		}
74
	}
75
76
	/*
77
	 * Present Manage just in time activation msg on update-core.php
78
	 *
79
	 */
80
	function manage_msg() {
81
		$normalized_site_url = Jetpack::build_raw_urls( get_home_url() );
82
		?>
83
		<div class="jp-jitm">
84
			<a href="#" data-module="manage" class="dismiss"><span class="genericon genericon-close"></span></a>
85
86
			<div class="jp-emblem">
87
				<?php echo Jetpack::get_jp_emblem(); ?>
88
			</div>
89
			<p class="msg">
90
				<?php esc_html_e( 'Reduce security risks with automated plugin updates.', 'jetpack' ); ?>
91
			</p>
92
93
			<p>
94
				<img class="j-spinner hide" src="<?php echo esc_url( includes_url( 'images/spinner-2x.gif' ) ); ?>" alt="<?php echo esc_attr__( 'Loading...', 'jetpack' ); ?>" /><a href="#" data-module="manage" class="activate button <?php if ( Jetpack::is_module_active( 'manage' ) ) {
95
					echo 'hide';
96
				} ?>"><?php esc_html_e( 'Activate Now', 'jetpack' ); ?></a><a href="<?php echo esc_url( 'https://wordpress.com/plugins/' . $normalized_site_url ); ?>" target="_blank" title="<?php esc_attr_e( 'Go to WordPress.com to try these features', 'jetpack' ); ?>" id="jetpack-wordpressdotcom" class="button button-jetpack <?php if ( ! Jetpack::is_module_active( 'manage' ) ) {
97
					echo 'hide';
98
				} ?>"><?php esc_html_e( 'Go to WordPress.com', 'jetpack' ); ?></a>
99
			</p>
100
		</div>
101
		<?php
102
		//jitm is being viewed, track it
103
		$jetpack = Jetpack::init();
104
		$jetpack->stat( 'jitm', 'manage-viewed-' . JETPACK__VERSION );
105
		$jetpack->do_stats( 'server_side' );
106
	}
107
108
	/*
109
	 * Present Photon just in time activation msg
110
	 *
111
	 */
112
	function photon_msg() {
113
		?>
114
		<div class="jp-jitm">
115
			<a href="#" data-module="photon" class="dismiss"><span class="genericon genericon-close"></span></a>
116
117
			<div class="jp-emblem">
118
				<?php echo Jetpack::get_jp_emblem(); ?>
119
			</div>
120
			<p class="msg">
121
				<?php esc_html_e( 'Speed up your photos and save bandwidth costs by using a free content delivery network.', 'jetpack' ); ?>
122
			</p>
123
124
			<p>
125
				<img class="j-spinner hide" style="margin-top: 13px;" width="17" height="17" src="<?php echo esc_url( includes_url( 'images/spinner-2x.gif' ) ); ?>" alt="<?php echo esc_attr__( 'Loading...', 'jetpack' ); ?>" /><a href="#" data-module="photon" class="activate button button-jetpack"><?php esc_html_e( 'Activate Photon', 'jetpack' ); ?></a>
126
			</p>
127
		</div>
128
		<?php
129
		//jitm is being viewed, track it
130
		$jetpack = Jetpack::init();
131
		$jetpack->stat( 'jitm', 'photon-viewed-' . JETPACK__VERSION );
132
		$jetpack->do_stats( 'server_side' );
133
	}
134
135
	/**
136
	 * Display Photon JITM template in Media Library after user uploads an image.
137
	 *
138
	 * @since 3.9.0
139
	 */
140
	function photon_tmpl() {
141
		?>
142
		<script id="tmpl-jitm-photon" type="text/html">
143
			<div class="jp-jitm" data-track="photon-modal">
144
				<a href="#" data-module="photon" class="dismiss"><span class="genericon genericon-close"></span></a>
145
146
				<div class="jp-emblem">
147
					<?php echo Jetpack::get_jp_emblem(); ?>
148
				</div>
149
				<p class="msg">
150
					<?php esc_html_e( 'Let Jetpack deliver your images optimized and faster than ever.', 'jetpack' ); ?>
151
				</p>
152
153
				<p>
154
					<img class="j-spinner hide" style="margin-top: 13px;" width="17" height="17" src="<?php echo esc_url( includes_url( 'images/spinner-2x.gif' ) ); ?>" alt="<?php echo esc_attr__( 'Loading...', 'jetpack' ); ?>" /><a href="#" data-module="photon" class="activate button button-jetpack"><?php esc_html_e( 'Activate Photon', 'jetpack' ); ?></a>
155
				</p>
156
			</div>
157
		</script>
158
		<?php
159
	}
160
161
	/**
162
	 * Display message prompting user to enable auto-updates in WordPress.com.
163
	 *
164
	 * @since 3.8.2
165
	 */
166
	function manage_pi_msg() {
167
		$normalized_site_url = Jetpack::build_raw_urls( get_home_url() );
168
		$manage_active       = Jetpack::is_module_active( 'manage' );
169
170
		// Check if plugin has auto update already enabled in WordPress.com and don't show JITM in such case.
171
		$active_before = get_option( 'jetpack_temp_active_plugins_before', array() );
172
		delete_option( 'jetpack_temp_active_plugins_before' );
173
		$active_now                  = get_option( 'active_plugins', array() );
174
		$activated                   = array_diff( $active_now, $active_before );
175
		$auto_update_plugin_list     = Jetpack_Options::get_option( 'autoupdate_plugins', array() );
176
		$plugin_auto_update_disabled = false;
177
		foreach ( $activated as $plugin ) {
178
			if ( ! in_array( $plugin, $auto_update_plugin_list ) ) {
179
180
				// Plugin doesn't have auto updates enabled in WordPress.com yet.
181
				$plugin_auto_update_disabled = true;
182
183
				// We don't need to continue checking, it's ok to show JITM for this plugin.
184
				break;
185
			}
186
		}
187
188
		// Check if the activated plugin is in the WordPress.org repository
189
		$plugin_can_auto_update = false;
190
		$plugin_updates 		= get_site_transient( 'update_plugins' );
191
		if ( false === $plugin_updates ) {
192
193
			// If update_plugins doesn't exist, display message anyway
194
			$plugin_can_auto_update = true;
195
		} else {
196
			$plugin_updates = array_merge( $plugin_updates->response, $plugin_updates->no_update );
197
			foreach ( $activated as $plugin ) {
198
				if ( isset( $plugin_updates[ $plugin ] ) ) {
199
200
					// There's at least one plugin set cleared for auto updates
201
					$plugin_can_auto_update = true;
202
203
					// We don't need to continue checking, it's ok to show JITM for this round.
204
					break;
205
				}
206
			}
207
		}
208
209
		if ( ! $manage_active && $plugin_auto_update_disabled && $plugin_can_auto_update && self::$auto_updates_allowed ) :
210
			?>
211
			<div class="jp-jitm">
212
				<a href="#" data-module="manage-pi" class="dismiss"><span class="genericon genericon-close"></span></a>
213
214
				<div class="jp-emblem">
215
					<?php echo Jetpack::get_jp_emblem(); ?>
216
				</div>
217
				<?php if ( ! $manage_active ) : ?>
218
					<p class="msg">
219
						<?php esc_html_e( 'Save time with automated plugin updates.', 'jetpack' ); ?>
220
					</p>
221
					<p>
222
						<img class="j-spinner hide" src="<?php echo esc_url( includes_url( 'images/spinner-2x.gif' ) ); ?>" alt="<?php echo esc_attr__( 'Loading...', 'jetpack' ); ?>" /><a href="#" data-module="manage" data-module-success="<?php esc_attr_e( 'Success!', 'jetpack' ); ?>" class="activate button"><?php esc_html_e( 'Activate remote management', 'jetpack' ); ?></a>
223
					</p>
224
				<?php elseif ( $manage_active ) : ?>
225
					<p>
226
						<?php esc_html_e( 'Save time with auto updates on WordPress.com', 'jetpack' ); ?>
227
					</p>
228
				<?php endif; // manage inactive
229
				?>
230
				<p class="show-after-enable <?php echo $manage_active ? '' : 'hide'; ?>">
231
					<a href="<?php echo esc_url( 'https://wordpress.com/plugins/' . $normalized_site_url ); ?>" target="_blank" title="<?php esc_attr_e( 'Go to WordPress.com to enable auto-updates for plugins', 'jetpack' ); ?>" data-module="manage-pi" class="button button-jetpack launch show-after-enable"><?php if ( ! $manage_active ) : ?><?php esc_html_e( 'Enable auto-updates on WordPress.com', 'jetpack' ); ?><?php elseif ( $manage_active ) : ?><?php esc_html_e( 'Enable auto-updates', 'jetpack' ); ?><?php endif; // manage inactive ?></a>
232
				</p>
233
			</div>
234
			<?php
235
			//jitm is being viewed, track it
236
			$jetpack = Jetpack::init();
237
			$jetpack->stat( 'jitm', 'manage-pi-viewed-' . JETPACK__VERSION );
238
			$jetpack->do_stats( 'server_side' );
239
		endif; // manage inactive
240
	}
241
242
	/**
243
	 * Display message in editor prompting user to compose entry in WordPress.com.
244
	 *
245
	 * @since 3.8.2
246
	 */
247
	function editor_msg() {
248
		global $typenow;
249
		if ( current_user_can( 'manage_options' ) ) {
250
			$normalized_site_url = Jetpack::build_raw_urls( get_home_url() );
251
			$editor_dismissed = isset( self::$jetpack_hide_jitm['editor'] );
252
			if ( ! $editor_dismissed ) :
253
			?>
254
			<div class="jp-jitm">
255
				<a href="#"  data-module="editor" class="dismiss"><span class="genericon genericon-close"></span></a>
256
				<div class="jp-emblem">
257
					<?php echo Jetpack::get_jp_emblem(); ?>
258
				</div>
259
				<p class="msg">
260
					<?php esc_html_e( 'Try the brand new editor.', 'jetpack' ); ?>
261
				</p>
262
				<p>
263
					<a href="<?php echo esc_url( 'https://wordpress.com/' . $typenow . '/' . $normalized_site_url ); ?>" target="_blank" title="<?php esc_attr_e( 'Write on WordPress.com', 'jetpack' ); ?>" data-module="editor" class="button button-jetpack launch show-after-enable"><?php esc_html_e( 'Write on WordPress.com', 'jetpack' ); ?></a>
264
				</p>
265
			</div>
266
			<?php
267
			//jitm is being viewed, track it
268
			$jetpack = Jetpack::init();
269
			$jetpack->stat( 'jitm', 'editor-viewed-' . JETPACK__VERSION );
270
			$jetpack->do_stats( 'server_side' );
271
			endif; // manage or editor inactive
272
		}
273
	}
274
275
	/**
276
	 * Display message in editor prompting user to enable stats.
277
	 *
278
	 * @since 3.9.0
279
	 */
280
	function stats_msg() {
281
		$stats_active        = Jetpack::is_module_active( 'stats' );
282
		$normalized_site_url = Jetpack::build_raw_urls( get_home_url() );
283
		?>
284
		<div class="jp-jitm">
285
			<a href="#" data-module="stats" class="dismiss"><span class="genericon genericon-close"></span></a>
286
287
			<div class="jp-emblem">
288
				<?php echo Jetpack::get_jp_emblem(); ?>
289
			</div>
290
			<p class="msg">
291
				<?php esc_html_e( 'Track detailed stats on this post and the rest of your site.', 'jetpack' ); ?>
292
			</p>
293
			<?php if ( ! $stats_active ) : ?>
294
				<p>
295
					<img class="j-spinner hide" src="<?php echo esc_url( includes_url( 'images/spinner-2x.gif' ) ); ?>" alt="<?php echo esc_attr__( 'Loading...', 'jetpack' ); ?>" /><a href="#" data-module="stats" data-module-success="<?php esc_attr_e( 'Success! Jetpack Stats is now activated.', 'jetpack' ); ?>" class="activate button"><?php esc_html_e( 'Enable Jetpack Stats', 'jetpack' ); ?></a>
296
				</p>
297
			<?php endif; // stats inactive
298
			?>
299
			<p class="show-after-enable <?php echo $stats_active ? '' : 'hide'; ?>">
300
				<a href="<?php echo esc_url( 'https://wordpress.com/stats/insights/' . $normalized_site_url ); ?>" target="_blank" title="<?php esc_attr_e( 'Go to WordPress.com', 'jetpack' ); ?>" data-module="stats" class="button button-jetpack launch show-after-enable"><?php esc_html_e( 'Go to WordPress.com', 'jetpack' ); ?></a>
301
			</p>
302
		</div>
303
		<?php
304
		//jitm is being viewed, track it
305
		$jetpack = Jetpack::init();
306
		$jetpack->stat( 'jitm', 'post-stats-viewed-' . JETPACK__VERSION );
307
		$jetpack->do_stats( 'server_side' );
308
	}
309
310
	/**
311
	 * Display JITM in Updates screen prompting user to enable Backups.
312
	 *
313
	 * @since 3.9.5
314
	 */
315 View Code Duplication
	function backups_updates_msg() {
316
		$normalized_site_url = Jetpack::build_raw_urls( get_home_url() );
317
		$url = 'https://wordpress.com/plans/' . $normalized_site_url;
318
		$jitm_stats_url = Jetpack::build_stats_url( array( 'x_jetpack-jitm' => 'vaultpress' ) );
319
		?>
320
		<div class="jp-jitm" data-track="vaultpress-updates" data-stats_url="<?php echo esc_url( $jitm_stats_url ); ?>">
321
			<a href="#" data-module="vaultpress" class="dismiss"><span class="genericon genericon-close"></span></a>
322
323
			<div class="jp-emblem">
324
				<?php echo self::get_jp_emblem(); ?>
0 ignored issues
show
The method get_jp_emblem() does not seem to exist on object<Jetpack_JITM>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
325
			</div>
326
			<p class="msg">
327
				<?php esc_html_e( 'Backups are recommended to protect your site before you make any changes.', 'jetpack' ); ?>
328
			</p>
329
			<p>
330
				<a href="<?php echo esc_url( $url ); ?>" target="_blank" title="<?php esc_attr_e( 'Enable VaultPress Backups', 'jetpack' ); ?>" data-module="vaultpress" data-jptracks-name="nudge_click" data-jptracks-prop="jitm-vault" class="button button-jetpack launch jptracks"><?php esc_html_e( 'Enable VaultPress Backups', 'jetpack' ); ?></a>
331
			</p>
332
		</div>
333
		<?php
334
		//jitm is being viewed, track it
335
		$jetpack = Jetpack::init();
336
		$jetpack->stat( 'jitm', 'vaultpress-updates-viewed-' . JETPACK__VERSION );
337
		$jetpack->do_stats( 'server_side' );
338
	}
339
340
	/**
341
	 * Display JITM in Comments screen prompting user to enable Akismet.
342
	 *
343
	 * @since 3.9.5
344
	 */
345 View Code Duplication
	function akismet_msg() {
346
		$normalized_site_url = Jetpack::build_raw_urls( get_home_url() );
347
		$url = 'https://wordpress.com/plans/' . $normalized_site_url;
348
		$jitm_stats_url = Jetpack::build_stats_url( array( 'x_jetpack-jitm' => 'akismet' ) );
349
		?>
350
		<div class="jp-jitm" data-stats_url="<?php echo esc_url( $jitm_stats_url ); ?>">
351
			<a href="#" data-module="akismet" class="dismiss"><span class="genericon genericon-close"></span></a>
352
353
			<div class="jp-emblem">
354
				<?php echo self::get_jp_emblem(); ?>
0 ignored issues
show
The method get_jp_emblem() does not seem to exist on object<Jetpack_JITM>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
355
			</div>
356
			<p class="msg">
357
				<?php esc_html_e( "Spam affects your site's legitimacy, protect your site with Akismet.", 'jetpack' ); ?>
358
			</p>
359
			<p>
360
				<a href="<?php echo esc_url( $url ); ?>" target="_blank" title="<?php esc_attr_e( 'Automate Spam Blocking', 'jetpack' ); ?>" data-module="akismet" data-jptracks-name="nudge_click" data-jptracks-prop="jitm-akismet" class="button button-jetpack launch jptracks"><?php esc_html_e( 'Automate Spam Blocking', 'jetpack' ); ?></a>
361
			</p>
362
		</div>
363
		<?php
364
		//jitm is being viewed, track it
365
		$jetpack = Jetpack::init();
366
		$jetpack->stat( 'jitm', 'akismet-viewed-' . JETPACK__VERSION );
367
		$jetpack->do_stats( 'server_side' );
368
	}
369
370
	/**
371
	 * Display JITM after a post is published prompting user to enable Backups.
372
	 *
373
	 * @since 3.9.5
374
	 */
375 View Code Duplication
	function backups_after_publish_msg() {
376
		$normalized_site_url = Jetpack::build_raw_urls( get_home_url() );
377
		$url = 'https://wordpress.com/plans/' . $normalized_site_url;
378
		$jitm_stats_url = Jetpack::build_stats_url( array( 'x_jetpack-jitm' => 'vaultpress' ) );
379
		?>
380
		<div class="jp-jitm" data-track="vaultpress-publish" data-stats_url="<?php echo esc_url( $jitm_stats_url ); ?>">
381
			<a href="#" data-module="vaultpress" class="dismiss"><span class="genericon genericon-close"></span></a>
382
383
			<div class="jp-emblem">
384
				<?php echo self::get_jp_emblem(); ?>
0 ignored issues
show
The method get_jp_emblem() does not seem to exist on object<Jetpack_JITM>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
385
			</div>
386
			<p class="msg">
387
				<?php esc_html_e( "Great job! Now let's make sure your hard work is never lost, backup everything with VaultPress.", 'jetpack' ); ?>
388
			</p>
389
			<p>
390
				<a href="<?php echo esc_url( $url ); ?>" target="_blank" title="<?php esc_attr_e( 'Enable Backups', 'jetpack' ); ?>" data-module="vaultpress" data-jptracks-name="nudge_click" data-jptracks-prop="jitm-vault-post" class="button button-jetpack launch jptracks"><?php esc_html_e( 'Enable Backups', 'jetpack' ); ?></a>
391
			</p>
392
		</div>
393
		<?php
394
		//jitm is being viewed, track it
395
		$jetpack = Jetpack::init();
396
		$jetpack->stat( 'jitm', 'vaultpress-publish-viewed-' . JETPACK__VERSION );
397
		$jetpack->do_stats( 'server_side' );
398
	}
399
400
	/*
401
	* Function to enqueue jitm css and js
402
	*/
403
	function jitm_enqueue_files( $hook ) {
404
405
		$wp_styles = new WP_Styles();
406
		$min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
407
		wp_enqueue_style( 'jetpack-jitm-css', plugins_url( "css/jetpack-admin-jitm{$min}.css", JETPACK__PLUGIN_FILE ), false, JETPACK__VERSION . '-201243242' );
408
		$wp_styles->add_data( 'jetpack-jitm-css', 'rtl', true );
409
410
		//Build stats url for tracking manage button
411
		$jitm_stats_url = Jetpack::build_stats_url( array( 'x_jetpack-jitm' => 'wordpresstools' ) );
412
413
		// Enqueue javascript to handle jitm notice events
414
		wp_enqueue_script( 'jetpack-jitm-js', plugins_url( '_inc/jetpack-jitm.js', JETPACK__PLUGIN_FILE ),
415
			array( 'jquery' ), JETPACK__VERSION, true );
416
		wp_localize_script(
417
			'jetpack-jitm-js',
418
			'jitmL10n',
419
			array(
420
				'ajaxurl'     => admin_url( 'admin-ajax.php' ),
421
				'jitm_nonce'  => wp_create_nonce( 'jetpack-jitm-nonce' ),
422
				'photon_msgs' => array(
423
					'success' => esc_html__( 'Success! Photon is now actively optimizing and serving your images for free.', 'jetpack' ),
424
					'fail'    => esc_html__( 'We are sorry but unfortunately Photon did not activate.', 'jetpack' )
425
				),
426
				'manage_msgs' => array(
427
					'success' => esc_html__( 'Success! WordPress.com tools are now active.', 'jetpack' ),
428
					'fail'    => esc_html__( 'We are sorry but unfortunately Manage did not activate.', 'jetpack' )
429
				),
430
				'stats_msgs' => array(
431
					'success' => esc_html__( 'Success! Stats are now active.', 'jetpack' ),
432
					'fail'    => esc_html__( 'We are sorry but unfortunately Stats did not activate.', 'jetpack' )
433
				),
434
				'jitm_stats_url' => $jitm_stats_url
435
			)
436
		);
437
	}
438
439
	/**
440
	 * Check if a JITM was dismissed or not. Currently, dismissing one JITM will dismiss all of them.
441
	 *
442
	 * @since 3.8.2
443
	 *
444
	 * @return bool
445
	 */
446
	function is_jitm_dismissed() {
447
		if ( is_null( self::$jetpack_hide_jitm ) ) {
448
449
			// The option returns false when nothing was dismissed
450
			self::$jetpack_hide_jitm = Jetpack_Options::get_option( 'hide_jitm' );
451
		}
452
453
		// so if it's not an array, it means no JITM was dismissed
454
		return is_array( self::$jetpack_hide_jitm );
455
	}
456
}
457
/**
458
 * Filter to turn off all just in time messages
459
 *
460
 * @since 3.7.0
461
 *
462
 * @param bool true Whether to show just in time messages.
463
 */
464
if ( apply_filters( 'jetpack_just_in_time_msgs', false ) ) {
465
	Jetpack_JITM::init();
466
}
467