| @@ -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 | * |
| @@ -107,13 +108,13 @@ | ||
| 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 | 109 | Assets::register_script( |
| 109 | 110 | self::SCRIPT_NAME, |
| 110 | 111 | '_inc/build/scan/admin-bar-notice.min.js', |
| 111 | - __FILE__, | |
| 112 | + JETPACK__PLUGIN_FILE, | |
| 112 | 113 | array( |
| 113 | 114 | 'in_footer' => true, |
| 114 | 115 | 'strategy' => 'defer', |
| 115 | - 'nonmin_path' => '_inc/build/scan/admin-bar-notice.js', | |
| 116 | + 'nonmin_path' => 'modules/scan/admin-bar-notice.js', | |
| 116 | 117 | 'dependencies' => array( 'admin-bar' ), |
| 117 | 118 | 'version' => self::SCRIPT_VERSION, |
| 118 | 119 | 'enqueue' => true, |
| 119 | 120 | ) |
| @@ -173,12 +174,13 @@ | ||
| 173 | 174 | ), |
| 174 | 175 | ); |
| 175 | 176 | |
| 176 | 177 | if ( $has_threats ) { |
| 177 | - $node['href'] = esc_url( Redirect::get_url( 'calypso-scanner' ) ); | |
| 178 | - $node['meta']['onclick'] = 'window.open( this.href ); return false;'; | |
| 179 | - $node['meta']['class'] = 'error'; | |
| 180 | - $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( | |
| 181 | 183 | esc_html( |
| 182 | 184 | /* translators: %s is the alert icon */ |
| 183 | 185 | _n( '%s Threat found', '%s Threats found', $this->get_threat_count(), 'jetpack' ) |
| 184 | 186 | ), |
| @@ -208,9 +210,9 @@ | ||
| 208 | 210 | if ( empty( $scan_state ) ) { |
| 209 | 211 | return null; |
| 210 | 212 | } |
| 211 | 213 | // Return true if there is at least one threat found. |
| 212 | - return (bool) isset( $scan_state->threats[0] ); | |
| 214 | + return isset( $scan_state->threats[0] ); | |
| 213 | 215 | } |
| 214 | 216 | |
| 215 | 217 | /** |
| 216 | 218 | * Returns the number of threats found or 0. |