__( 'Jetpack Protect checks', 'jetpack-protect' ), 'test' => array( __CLASS__, 'do_checks' ), ); return $checks; } /** * Do site-health page checks * * @access public * @return array */ public static function do_checks() { $total_vuls = Status::get_total_vulnerabilities(); $vulns = Status::get_all_vulnerabilities(); $vulns = array_map( function ( $v ) { return $v->title; }, $vulns ); /** * Default, no vulnerabilities found */ $result = array( 'label' => __( 'No known vulnerabilities found', 'jetpack-protect' ), 'status' => 'good', 'badge' => array( 'label' => __( 'Security', 'jetpack-protect' ), 'color' => 'gray', ), 'description' => sprintf( '
%s
', __( 'Jetpack Protect did not find any known vulnerabilities in your site. Vulnerabilities can be exploited by hackers and cause harm to your website.', 'jetpack-protect' ) ), 'actions' => '', 'test' => 'jetpack_protect_checks', ); /** * If vulnerabilities found. */ if ( $total_vuls ) { $result['status'] = 'critical'; /* translators: $d is the number of vulnerabilities found. */ $result['label'] = sprintf( _n( 'Your site is affected by %d security vulnerability', 'Your site is affected by %d security vulnerabilities', $total_vuls, 'jetpack-protect' ), $total_vuls ); $result['description'] = __( 'Jetpack Protect detected the following security vulnerabilities in your site:', 'jetpack-protect' ); foreach ( $vulns as $vuln ) { $result['description'] .= ''; $result['description'] .= "  "; $result['description'] .= wp_kses( $vuln, array( 'a' => array( 'href' => array() ) ) ); // Only allow a href HTML tags. $result['description'] .= '
'; } $result['description'] .= ''; $result['description'] .= sprintf( wp_kses( /* translators: Link to Jetpack Protect. */ __( 'See Protect overview page for more information.', 'jetpack-protect' ), array( 'a' => array( 'href' => array() ), ) ), esc_url( admin_url( 'admin.php?page=jetpack-protect' ) ) ); $result['description'] .= '
'; } return $result; } }