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 | function get_emblem() |
||
45 | { |
||
46 | return '<div class="jp-emblem">' . Jetpack::get_jp_emblem() . '</div>'; |
||
47 | } |
||
48 | |||
49 | /** |
||
50 | * Prepare actions according to screen and post type. |
||
51 | * |
||
52 | * @since 3.8.2 |
||
53 | * |
||
54 | * @uses Jetpack_Autoupdate::get_possible_failures() |
||
55 | * |
||
56 | * @param object $screen |
||
57 | */ |
||
58 | function prepare_jitms( $screen ) { |
||
59 | if ( ! current_user_can( 'jetpack_manage_modules' ) ) { |
||
60 | return; |
||
61 | } |
||
62 | |||
63 | if ( 'edit-comments' == $screen->base && ! Jetpack::is_plugin_active( 'akismet/akismet.php' ) ) { |
||
64 | add_action( 'admin_enqueue_scripts', array( $this, 'jitm_enqueue_files' ) ); |
||
65 | add_action( 'admin_notices', array( $this, 'akismet_msg' ) ); |
||
66 | } |
||
67 | elseif ( |
||
68 | 'post' == $screen->base |
||
69 | && ( isset( $_GET['message'] ) && 6 == $_GET['message'] ) |
||
70 | && ! Jetpack::is_plugin_active( 'vaultpress/vaultpress.php' ) |
||
71 | ) { |
||
72 | add_action( 'admin_enqueue_scripts', array( $this, 'jitm_enqueue_files' ) ); |
||
73 | add_action( 'edit_form_top', array( $this, 'backups_after_publish_msg' ) ); |
||
74 | } |
||
75 | elseif ( 'update-core' == $screen->base && ! Jetpack::is_plugin_active( 'vaultpress/vaultpress.php' ) ) { |
||
76 | add_action( 'admin_enqueue_scripts', array( $this, 'jitm_enqueue_files' ) ); |
||
77 | add_action( 'admin_notices', array( $this, 'backups_updates_msg' ) ); |
||
78 | } |
||
79 | } |
||
80 | |||
81 | /* |
||
82 | * Present Manage just in time activation msg on update-core.php |
||
83 | * |
||
84 | */ |
||
85 | function manage_msg() { |
||
86 | $normalized_site_url = Jetpack::build_raw_urls( get_home_url() ); |
||
87 | ?> |
||
88 | <div class="jp-jitm"> |
||
89 | <a href="#" data-module="manage" class="dismiss"><span class="genericon genericon-close"></span></a> |
||
90 | |||
91 | <?php echo self::get_emblem(); ?> |
||
92 | |||
93 | <p class="msg"> |
||
94 | <?php esc_html_e( 'Reduce security risks with automated plugin updates.', 'jetpack' ); ?> |
||
95 | </p> |
||
96 | |||
97 | <p> |
||
98 | <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' ) ) { |
||
99 | echo 'hide'; |
||
100 | } ?>"><?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' ) ) { |
||
101 | echo 'hide'; |
||
102 | } ?>"><?php esc_html_e( 'Go to WordPress.com', 'jetpack' ); ?></a> |
||
103 | </p> |
||
104 | </div> |
||
105 | <?php |
||
106 | //jitm is being viewed, track it |
||
107 | $jetpack = Jetpack::init(); |
||
108 | $jetpack->stat( 'jitm', 'manage-viewed-' . JETPACK__VERSION ); |
||
109 | $jetpack->do_stats( 'server_side' ); |
||
110 | } |
||
111 | |||
112 | /* |
||
113 | * Present Photon just in time activation msg |
||
114 | * |
||
115 | */ |
||
116 | function photon_msg() { |
||
117 | ?> |
||
118 | <div class="jp-jitm"> |
||
119 | <a href="#" data-module="photon" class="dismiss"><span class="genericon genericon-close"></span></a> |
||
120 | |||
121 | <?php echo self::get_emblem(); ?> |
||
122 | |||
123 | <p class="msg"> |
||
124 | <?php esc_html_e( 'Speed up your photos and save bandwidth costs by using a free content delivery network.', 'jetpack' ); ?> |
||
125 | </p> |
||
126 | |||
127 | <p> |
||
128 | <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> |
||
129 | </p> |
||
130 | </div> |
||
131 | <?php |
||
132 | //jitm is being viewed, track it |
||
133 | $jetpack = Jetpack::init(); |
||
134 | $jetpack->stat( 'jitm', 'photon-viewed-' . JETPACK__VERSION ); |
||
135 | $jetpack->do_stats( 'server_side' ); |
||
136 | } |
||
137 | |||
138 | /** |
||
139 | * Display Photon JITM template in Media Library after user uploads an image. |
||
140 | * |
||
141 | * @since 3.9.0 |
||
142 | */ |
||
143 | function photon_tmpl() { |
||
144 | ?> |
||
145 | <script id="tmpl-jitm-photon" type="text/html"> |
||
146 | <div class="jp-jitm" data-track="photon-modal"> |
||
147 | <a href="#" data-module="photon" class="dismiss"><span class="genericon genericon-close"></span></a> |
||
148 | |||
149 | <?php echo self::get_emblem(); ?> |
||
150 | |||
151 | <p class="msg"> |
||
152 | <?php esc_html_e( 'Let Jetpack deliver your images optimized and faster than ever.', 'jetpack' ); ?> |
||
153 | </p> |
||
154 | |||
155 | <p> |
||
156 | <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> |
||
157 | </p> |
||
158 | </div> |
||
159 | </script> |
||
160 | <?php |
||
161 | } |
||
162 | |||
163 | /** |
||
164 | * Display message prompting user to enable auto-updates in WordPress.com. |
||
165 | * |
||
166 | * @since 3.8.2 |
||
167 | */ |
||
168 | function manage_pi_msg() { |
||
169 | $normalized_site_url = Jetpack::build_raw_urls( get_home_url() ); |
||
170 | $manage_active = Jetpack::is_module_active( 'manage' ); |
||
171 | |||
172 | // Check if plugin has auto update already enabled in WordPress.com and don't show JITM in such case. |
||
173 | $active_before = get_option( 'jetpack_temp_active_plugins_before', array() ); |
||
174 | delete_option( 'jetpack_temp_active_plugins_before' ); |
||
175 | $active_now = get_option( 'active_plugins', array() ); |
||
176 | $activated = array_diff( $active_now, $active_before ); |
||
177 | $auto_update_plugin_list = Jetpack_Options::get_option( 'autoupdate_plugins', array() ); |
||
178 | $plugin_auto_update_disabled = false; |
||
179 | foreach ( $activated as $plugin ) { |
||
180 | if ( ! in_array( $plugin, $auto_update_plugin_list ) ) { |
||
181 | |||
182 | // Plugin doesn't have auto updates enabled in WordPress.com yet. |
||
183 | $plugin_auto_update_disabled = true; |
||
184 | |||
185 | // We don't need to continue checking, it's ok to show JITM for this plugin. |
||
186 | break; |
||
187 | } |
||
188 | } |
||
189 | |||
190 | // Check if the activated plugin is in the WordPress.org repository |
||
191 | $plugin_can_auto_update = false; |
||
192 | $plugin_updates = get_site_transient( 'update_plugins' ); |
||
193 | if ( false === $plugin_updates ) { |
||
194 | |||
195 | // If update_plugins doesn't exist, display message anyway |
||
196 | $plugin_can_auto_update = true; |
||
197 | } else { |
||
198 | $plugin_updates = array_merge( $plugin_updates->response, $plugin_updates->no_update ); |
||
199 | foreach ( $activated as $plugin ) { |
||
200 | if ( isset( $plugin_updates[ $plugin ] ) ) { |
||
201 | |||
202 | // There's at least one plugin set cleared for auto updates |
||
203 | $plugin_can_auto_update = true; |
||
204 | |||
205 | // We don't need to continue checking, it's ok to show JITM for this round. |
||
206 | break; |
||
207 | } |
||
208 | } |
||
209 | } |
||
210 | |||
211 | if ( ! $manage_active && $plugin_auto_update_disabled && $plugin_can_auto_update && self::$auto_updates_allowed ) : |
||
212 | ?> |
||
213 | <div class="jp-jitm"> |
||
214 | <a href="#" data-module="manage-pi" class="dismiss"><span class="genericon genericon-close"></span></a> |
||
215 | |||
216 | <?php echo self::get_emblem(); ?> |
||
217 | |||
218 | <?php if ( ! $manage_active ) : ?> |
||
219 | <p class="msg"> |
||
220 | <?php esc_html_e( 'Save time with automated plugin updates.', 'jetpack' ); ?> |
||
221 | </p> |
||
222 | <p> |
||
223 | <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> |
||
224 | </p> |
||
225 | <?php elseif ( $manage_active ) : ?> |
||
226 | <p> |
||
227 | <?php esc_html_e( 'Save time with auto updates on WordPress.com', 'jetpack' ); ?> |
||
228 | </p> |
||
229 | <?php endif; // manage inactive |
||
230 | ?> |
||
231 | <p class="show-after-enable <?php echo $manage_active ? '' : 'hide'; ?>"> |
||
232 | <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> |
||
233 | </p> |
||
234 | </div> |
||
235 | <?php |
||
236 | //jitm is being viewed, track it |
||
237 | $jetpack = Jetpack::init(); |
||
238 | $jetpack->stat( 'jitm', 'manage-pi-viewed-' . JETPACK__VERSION ); |
||
239 | $jetpack->do_stats( 'server_side' ); |
||
240 | endif; // manage inactive |
||
241 | } |
||
242 | |||
243 | /** |
||
244 | * Display message in editor prompting user to compose entry in WordPress.com. |
||
245 | * |
||
246 | * @since 3.8.2 |
||
247 | */ |
||
248 | function editor_msg() { |
||
249 | global $typenow; |
||
250 | if ( current_user_can( 'manage_options' ) ) { |
||
251 | $normalized_site_url = Jetpack::build_raw_urls( get_home_url() ); |
||
252 | $editor_dismissed = isset( self::$jetpack_hide_jitm['editor'] ); |
||
253 | if ( ! $editor_dismissed ) : |
||
254 | ?> |
||
255 | <div class="jp-jitm"> |
||
256 | <a href="#" data-module="editor" class="dismiss"><span class="genericon genericon-close"></span></a> |
||
257 | <?php echo self::get_emblem(); ?> |
||
258 | <p class="msg"> |
||
259 | <?php esc_html_e( 'Try the brand new editor.', 'jetpack' ); ?> |
||
260 | </p> |
||
261 | <p> |
||
262 | <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> |
||
263 | </p> |
||
264 | </div> |
||
265 | <?php |
||
266 | //jitm is being viewed, track it |
||
267 | $jetpack = Jetpack::init(); |
||
268 | $jetpack->stat( 'jitm', 'editor-viewed-' . JETPACK__VERSION ); |
||
269 | $jetpack->do_stats( 'server_side' ); |
||
270 | endif; // manage or editor inactive |
||
271 | } |
||
272 | } |
||
273 | |||
274 | /** |
||
275 | * Display message in editor prompting user to enable stats. |
||
276 | * |
||
277 | * @since 3.9.0 |
||
278 | */ |
||
279 | function stats_msg() { |
||
280 | $stats_active = Jetpack::is_module_active( 'stats' ); |
||
281 | $normalized_site_url = Jetpack::build_raw_urls( get_home_url() ); |
||
282 | ?> |
||
283 | <div class="jp-jitm"> |
||
284 | <a href="#" data-module="stats" class="dismiss"><span class="genericon genericon-close"></span></a> |
||
285 | <?php echo self::get_emblem(); ?> |
||
286 | <p class="msg"> |
||
287 | <?php esc_html_e( 'Track detailed stats on this post and the rest of your site.', 'jetpack' ); ?> |
||
288 | </p> |
||
289 | <?php if ( ! $stats_active ) : ?> |
||
290 | <p> |
||
291 | <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> |
||
292 | </p> |
||
293 | <?php endif; // stats inactive |
||
294 | ?> |
||
295 | <p class="show-after-enable <?php echo $stats_active ? '' : 'hide'; ?>"> |
||
296 | <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> |
||
297 | </p> |
||
298 | </div> |
||
299 | <?php |
||
300 | //jitm is being viewed, track it |
||
301 | $jetpack = Jetpack::init(); |
||
302 | $jetpack->stat( 'jitm', 'post-stats-viewed-' . JETPACK__VERSION ); |
||
303 | $jetpack->do_stats( 'server_side' ); |
||
304 | } |
||
305 | |||
306 | /** |
||
307 | * Display JITM in Updates screen prompting user to enable Backups. |
||
308 | * |
||
309 | * @since 3.9.5 |
||
310 | */ |
||
311 | View Code Duplication | function backups_updates_msg() { |
|
312 | $normalized_site_url = Jetpack::build_raw_urls( get_home_url() ); |
||
313 | $url = 'https://jetpack.com/redirect/?source=jitm-backup-updates&site=' . $normalized_site_url; |
||
314 | $jitm_stats_url = Jetpack::build_stats_url( array( 'x_jetpack-jitm' => 'vaultpress' ) ); |
||
315 | ?> |
||
316 | <div class="jp-jitm" data-track="vaultpress-updates" data-stats_url="<?php echo esc_url( $jitm_stats_url ); ?>"> |
||
317 | <a href="#" data-module="vaultpress" class="dismiss"><span class="genericon genericon-close"></span></a> |
||
318 | <?php echo self::get_emblem(); ?> |
||
319 | <p class="msg"> |
||
320 | <?php esc_html_e( 'Backups are recommended to protect your site before you make any changes.', 'jetpack' ); ?> |
||
321 | </p> |
||
322 | <p> |
||
323 | <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> |
||
324 | </p> |
||
325 | </div> |
||
326 | <?php |
||
327 | //jitm is being viewed, track it |
||
328 | $jetpack = Jetpack::init(); |
||
329 | $jetpack->stat( 'jitm', 'vaultpress-updates-viewed-' . JETPACK__VERSION ); |
||
330 | $jetpack->do_stats( 'server_side' ); |
||
331 | } |
||
332 | |||
333 | /** |
||
334 | * Display JITM in Comments screen prompting user to enable Akismet. |
||
335 | * |
||
336 | * @since 3.9.5 |
||
337 | */ |
||
338 | View Code Duplication | function akismet_msg() { |
|
339 | $normalized_site_url = Jetpack::build_raw_urls( get_home_url() ); |
||
340 | $url = 'https://jetpack.com/redirect/?source=jitm-akismet&site=' . $normalized_site_url; |
||
341 | $jitm_stats_url = Jetpack::build_stats_url( array( 'x_jetpack-jitm' => 'akismet' ) ); |
||
342 | ?> |
||
343 | <div class="jp-jitm" data-stats_url="<?php echo esc_url( $jitm_stats_url ); ?>"> |
||
344 | <a href="#" data-module="akismet" class="dismiss"><span class="genericon genericon-close"></span></a> |
||
345 | <?php echo self::get_emblem(); ?> |
||
346 | <p class="msg"> |
||
347 | <?php esc_html_e( "Spam affects your site's legitimacy, protect your site with Akismet.", 'jetpack' ); ?> |
||
348 | </p> |
||
349 | <p> |
||
350 | <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> |
||
351 | </p> |
||
352 | </div> |
||
353 | <?php |
||
354 | //jitm is being viewed, track it |
||
355 | $jetpack = Jetpack::init(); |
||
356 | $jetpack->stat( 'jitm', 'akismet-viewed-' . JETPACK__VERSION ); |
||
357 | $jetpack->do_stats( 'server_side' ); |
||
358 | } |
||
359 | |||
360 | /** |
||
361 | * Display JITM after a post is published prompting user to enable Backups. |
||
362 | * |
||
363 | * @since 3.9.5 |
||
364 | */ |
||
365 | View Code Duplication | function backups_after_publish_msg() { |
|
366 | $normalized_site_url = Jetpack::build_raw_urls( get_home_url() ); |
||
367 | $url = 'https://jetpack.com/redirect/?source=jitm-backup-publish&site=' . $normalized_site_url; |
||
368 | $jitm_stats_url = Jetpack::build_stats_url( array( 'x_jetpack-jitm' => 'vaultpress' ) ); |
||
369 | ?> |
||
370 | <div class="jp-jitm" data-track="vaultpress-publish" data-stats_url="<?php echo esc_url( $jitm_stats_url ); ?>"> |
||
371 | <a href="#" data-module="vaultpress" class="dismiss"><span class="genericon genericon-close"></span></a> |
||
372 | |||
373 | <?php echo self::get_emblem(); ?> |
||
374 | |||
375 | <p class="msg"> |
||
376 | <?php esc_html_e( "Great job! Now let's make sure your hard work is never lost, backup everything with VaultPress.", 'jetpack' ); ?> |
||
377 | </p> |
||
378 | <p> |
||
379 | <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> |
||
380 | </p> |
||
381 | </div> |
||
382 | <?php |
||
383 | //jitm is being viewed, track it |
||
384 | $jetpack = Jetpack::init(); |
||
385 | $jetpack->stat( 'jitm', 'vaultpress-publish-viewed-' . JETPACK__VERSION ); |
||
386 | $jetpack->do_stats( 'server_side' ); |
||
387 | } |
||
388 | |||
389 | /** |
||
390 | * Display a JITM style message for the media-new page. |
||
391 | * |
||
392 | * @since 4.5 |
||
393 | */ |
||
394 | function videopress_media_upload_warning_msg() { |
||
395 | $jitm_stats_url = Jetpack::build_stats_url( array( 'x_jetpack-jitm' => 'videopress' ) ); |
||
396 | |||
397 | $upload_url = add_query_arg( 'mode', 'grid', admin_url( 'upload.php' ) ); |
||
398 | $new_post_url = admin_url( 'post-new.php' ); |
||
399 | |||
400 | $msg = sprintf( __( 'Only videos uploaded from within the <a href="%s">media library</a> or while creating a <a href="%s">new post</a> will be fully hosted by WordPress.com.', 'jetpack' ), esc_url( $upload_url ), esc_url( $new_post_url ) ); |
||
401 | ?> |
||
402 | <div class="jp-jitm" data-track="videopress-upload-warning" data-stats_url="<?php echo esc_url( $jitm_stats_url ); ?>"> |
||
403 | <!-- <a href="#" data-module="videopress" class="dismiss"><span class="genericon genericon-close"></span></a>--> |
||
404 | |||
405 | <?php echo self::get_emblem(); ?> |
||
406 | |||
407 | <p class="msg"> |
||
408 | <?php echo $msg; ?> |
||
409 | </p> |
||
410 | <p> |
||
411 | <a href="<?php echo esc_url( $upload_url ); ?>" title="<?php esc_attr_e( 'Upload a Video', 'jetpack' ); ?>" data-module="videopress" data-jptracks-name="nudge_click" data-jptracks-prop="jitm-videopress-upload" class="button button-jetpack launch jptracks"><?php esc_html_e( 'Upload a Video Now', 'jetpack' ); ?></a> |
||
412 | </p> |
||
413 | </div> |
||
414 | <?php |
||
415 | } |
||
416 | |||
417 | /* |
||
418 | * Function to enqueue jitm css and js |
||
419 | */ |
||
420 | function jitm_enqueue_files( $hook ) { |
||
421 | |||
422 | $wp_styles = new WP_Styles(); |
||
423 | $min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
||
424 | wp_enqueue_style( 'jetpack-jitm-css', plugins_url( "css/jetpack-admin-jitm{$min}.css", JETPACK__PLUGIN_FILE ), false, JETPACK__VERSION . '-201243242' ); |
||
425 | $wp_styles->add_data( 'jetpack-jitm-css', 'rtl', true ); |
||
426 | |||
427 | //Build stats url for tracking manage button |
||
428 | $jitm_stats_url = Jetpack::build_stats_url( array( 'x_jetpack-jitm' => 'wordpresstools' ) ); |
||
429 | |||
430 | // Enqueue javascript to handle jitm notice events |
||
431 | wp_enqueue_script( 'jetpack-jitm-js', plugins_url( '_inc/jetpack-jitm.js', JETPACK__PLUGIN_FILE ), |
||
432 | array( 'jquery' ), JETPACK__VERSION, true ); |
||
433 | wp_localize_script( |
||
434 | 'jetpack-jitm-js', |
||
435 | 'jitmL10n', |
||
436 | array( |
||
437 | 'ajaxurl' => admin_url( 'admin-ajax.php' ), |
||
438 | 'jitm_nonce' => wp_create_nonce( 'jetpack-jitm-nonce' ), |
||
439 | 'photon_msgs' => array( |
||
440 | 'success' => esc_html__( 'Success! Photon is now actively optimizing and serving your images for free.', 'jetpack' ), |
||
441 | 'fail' => esc_html__( 'We are sorry but unfortunately Photon did not activate.', 'jetpack' ) |
||
442 | ), |
||
443 | 'manage_msgs' => array( |
||
444 | 'success' => esc_html__( 'Success! WordPress.com tools are now active.', 'jetpack' ), |
||
445 | 'fail' => esc_html__( 'We are sorry but unfortunately Manage did not activate.', 'jetpack' ) |
||
446 | ), |
||
447 | 'stats_msgs' => array( |
||
448 | 'success' => esc_html__( 'Success! Stats are now active.', 'jetpack' ), |
||
449 | 'fail' => esc_html__( 'We are sorry but unfortunately Stats did not activate.', 'jetpack' ) |
||
450 | ), |
||
451 | 'jitm_stats_url' => $jitm_stats_url |
||
452 | ) |
||
453 | ); |
||
454 | } |
||
455 | |||
456 | /** |
||
457 | * Check if a JITM was dismissed or not. Currently, dismissing one JITM will dismiss all of them. |
||
458 | * |
||
459 | * @since 3.8.2 |
||
460 | * |
||
461 | * @return bool |
||
462 | */ |
||
463 | function is_jitm_dismissed() { |
||
464 | if ( is_null( self::$jetpack_hide_jitm ) ) { |
||
465 | |||
466 | // The option returns false when nothing was dismissed |
||
467 | self::$jetpack_hide_jitm = Jetpack_Options::get_option( 'hide_jitm' ); |
||
0 ignored issues
–
show
|
|||
468 | } |
||
469 | |||
470 | // so if it's not an array, it means no JITM was dismissed |
||
471 | return is_array( self::$jetpack_hide_jitm ); |
||
472 | } |
||
473 | } |
||
474 | if ( |
||
475 | /** |
||
476 | * Filter to turn off all just in time messages |
||
477 | * |
||
478 | * @since 3.7.0 |
||
479 | * |
||
480 | * @param bool true Whether to show just in time messages. |
||
481 | */ |
||
482 | apply_filters( 'jetpack_just_in_time_msgs', false ) |
||
483 | ) { |
||
484 | Jetpack_JITM::init(); |
||
485 | } |
||
486 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..