parent = $parent; add_action( 'admin_init', array( $this, 'add_meta_box_summary' ) ); add_action( 'wp_ajax_wpscan_check_now', array( $this, 'ajax_check_now' ) ); add_action( 'wp_ajax_wpscan_security_check_now', array( $this, 'ajax_security_check_now' ) ); add_action( 'wp_ajax_' . $this->parent->WPSCAN_TRANSIENT_CRON, array( $this, 'ajax_doing_cron' ) ); } /** * Add meta box * * @return void * @since 1.0.0 * @access public */ public function add_meta_box_summary() { $report = $this->parent->get_report(); add_meta_box( 'wpscan-metabox-summary', __( 'Summary', 'wpscan' ), array( $this, 'do_meta_box_summary' ), 'wpscan', 'side', 'high' ); } /** * Render meta box * * @return string * @since 1.0.0 * @access public */ public function do_meta_box_summary() { $report = $this->parent->get_report(); $errors = get_option( $this->parent->OPT_ERRORS ); $total = $this->parent->get_total_not_ignored(); ?> parent->get_report() ) ) { ?> ' . $err . '
'; } } elseif ( empty( $this->parent->get_report() ) ) { // No scan run yet. echo '' . __( 'No scan run yet!', 'wpscan' ) . '
'; } elseif ( empty( $errors ) && 0 === $total ) { echo '' . __( 'No known vulnerabilities found', 'wpscan' ) . '
'; } elseif ( ! get_option( $this->parent->OPT_API_TOKEN ) ) { echo '' . __( 'You need to add a WPScan API Token to the settings page', 'wpscan' ) . '
'; } else { echo '' . __( 'Some vulnerabilities were found', 'wpscan' ) . '
'; } ?>
parent->WPSCAN_SCHEDULE ) ) { ?>
parent->WPSCAN_SCHEDULE ) ); ?>
parent->OPT_API_TOKEN ) ) { _e( 'Click the Run All button to run a full vulnerability scan against your WordPress website.', 'wpscan' ); } else { _e( 'Add your API token to the settings page to be able to run a full scan.', 'wpscan' ); } ?>
parent->OPT_API_TOKEN ) ) : ?>parent->WPSCAN_RUN_ALL ) ) { $spinner_display = ' style="visibility: visible;"'; $button_disabled = 'disabled'; } ?> >
parent->WPSCAN_ROLE ) ) { wp_redirect( home_url() ); wp_die(); } if ( false === as_next_scheduled_action( $this->parent->WPSCAN_RUN_ALL ) ) { as_schedule_single_action( strtotime( 'now' ), $this->parent->WPSCAN_RUN_ALL ); } wp_die(); } /** * Ajax scurity check now * * @return void * @since 1.0.0 * @access public */ public function ajax_security_check_now() { check_ajax_referer( 'wpscan' ); if ( ! current_user_can( $this->parent->WPSCAN_ROLE ) ) { wp_redirect( home_url() ); wp_die(); } $items_inline = get_option( $this->parent->WPSCAN_RUN_SECURITY ); $plugins = array(); foreach ( $this->parent->classes['checks/system']->checks as $id => $data ) { $plugins[ $id ] = array( 'status' => $this->parent->classes['report']->get_status( 'security-checks', $id ), 'vulnerabilities' => $this->parent->classes['checks/system']->get_check_vulnerabilities( $data['instance'] ), 'security-check-actions' => $this->parent->classes['checks/system']->get_list_actions( $data['instance'] ), ); } $response = array( 'inline' => $items_inline, 'plugins' => $plugins, ); wp_die( wp_json_encode( $response ) ); } /** * Ajax to check when the cron task has finished * * @return void * @since 1.0.0 * @access public */ public function ajax_doing_cron() { check_ajax_referer( 'wpscan' ); if ( ! current_user_can( $this->parent->WPSCAN_ROLE ) ) { wp_redirect( home_url() ); wp_die(); } // echo get_transient( $this->parent->WPSCAN_TRANSIENT_CRON ) ? 'YES' : 'NO'; echo false !== as_next_scheduled_action( $this->parent->WPSCAN_RUN_ALL ) ? 'YES' : 'NO'; wp_die(); } }