PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3-a.1
Jetpack – WP Security, Backup, Speed, & Growth v16.3-a.1
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 13.9.2 14.0.1 All 504 releases
← All changes | modules/scan/class-admin-bar-notice.php +20 -7 12.5.2 → 16.3-a.1 View file →
@@ -8,8 +8,9 @@
8 8 namespace Automattic\Jetpack\Scan;
9 9
10 10 use Automattic\Jetpack\Assets;
11 11 use Automattic\Jetpack\Redirect;
12 +use WP_Admin_Bar;
12 13
13 14 /**
14 15 * Class Main
15 16 *
@@ -104,10 +105,21 @@
104 105 return;
105 106 }
106 107
107 108 // We don't know about threats in the cache lets load the JS that fetches the info and updates the admin bar.
108 - Assets::enqueue_async_script( self::SCRIPT_NAME, '_inc/build/scan/admin-bar-notice.min.js', 'modules/scan/admin-bar-notice.js', array( 'admin-bar' ), self::SCRIPT_VERSION, true );
109 -
109 + Assets::register_script(
110 + self::SCRIPT_NAME,
111 + '_inc/build/scan/admin-bar-notice.min.js',
112 + JETPACK__PLUGIN_FILE,
113 + array(
114 + 'in_footer' => true,
115 + 'strategy' => 'defer',
116 + 'nonmin_path' => 'modules/scan/admin-bar-notice.js',
117 + 'dependencies' => array( 'admin-bar' ),
118 + 'version' => self::SCRIPT_VERSION,
119 + 'enqueue' => true,
120 + )
121 + );
110 122 $script_data = array(
111 123 'nonce' => wp_create_nonce( 'wp_rest' ),
112 124 'scan_endpoint' => get_rest_url( null, 'jetpack/v4/scan' ),
113 125 'scan_dashboard_url' => Redirect::get_url( 'calypso-scanner' ),
@@ -162,12 +174,13 @@
162 174 ),
163 175 );
164 176
165 177 if ( $has_threats ) {
166 - $node['href'] = esc_url( Redirect::get_url( 'calypso-scanner' ) );
167 - $node['meta']['onclick'] = 'window.open( this.href ); return false;';
168 - $node['meta']['class'] = 'error';
169 - $node['title'] = sprintf(
178 + $node['href'] = esc_url( Redirect::get_url( 'calypso-scanner' ) );
179 + $node['meta']['target'] = '_blank';
180 + $node['meta']['rel'] = 'noopener noreferrer';
181 + $node['meta']['class'] = 'error';
182 + $node['title'] = sprintf(
170 183 esc_html(
171 184 /* translators: %s is the alert icon */
172 185 _n( '%s Threat found', '%s Threats found', $this->get_threat_count(), 'jetpack' )
173 186 ),
@@ -197,9 +210,9 @@
197 210 if ( empty( $scan_state ) ) {
198 211 return null;
199 212 }
200 213 // Return true if there is at least one threat found.
201 - return (bool) isset( $scan_state->threats[0] );
214 + return isset( $scan_state->threats[0] );
202 215 }
203 216
204 217 /**
205 218 * Returns the number of threats found or 0.