parent = $parent; $this->page = 'wpscan_notification'; add_action( 'admin_init', array( $this, 'admin_init' ) ); add_action( 'admin_init', array( $this, 'add_meta_box_notification' ) ); } /** * Notification Options * * @since 1.0.0 * @access public * @return void */ public function admin_init() { $total = $this->parent->get_total(); register_setting( $this->page, $this->parent->OPT_EMAIL, array( $this, 'sanitize_email' ) ); register_setting( $this->page, $this->parent->OPT_INTERVAL, array( $this, 'sanitize_interval' ) ); $section = $this->page . '_section'; add_settings_section( $section, null, array( $this, 'introduction' ), $this->page ); add_settings_field( $this->parent->OPT_EMAIL, __( 'E-mail', 'wpscan' ), array( $this, 'field_email' ), $this->page, $section ); add_settings_field( $this->parent->OPT_INTERVAL, __( 'Send Alerts', 'wpscan' ), array( $this, 'field_interval' ), $this->page, $section ); } /** * Add meta box * * @since 1.0.0 * @access public * @return void */ public function add_meta_box_notification() { add_meta_box( 'wpscan-metabox-notification', __( 'Notification', 'wpscan' ), array( $this, 'do_meta_box_notification' ), 'wpscan', 'side', 'low' ); } /** * Render meta box * * @since 1.0.0 * @access public * @return string */ public function do_meta_box_notification() { echo '
'; settings_fields( $this->page ); do_settings_sections( $this->page ); submit_button(); echo '
'; } /** * Introduction * * @since 1.0.0 * @access public * @return string */ public function introduction() { echo '

' . __( 'Fill in the options below if you want to be notified by mail about new vulnerabilities. To add multiple e-mail addresses comma separate them.', 'wpscan' ) . '

'; } /** * Email field * * @since 1.0.0 * @access public * @return string */ public function field_email() { echo sprintf( '', esc_attr( $this->parent->OPT_EMAIL ), esc_attr( get_option( $this->parent->OPT_EMAIL, '' ) ) ); } /** * Interval field * * @since 1.0.0 * @access public * @return string */ public function field_interval() { $interval = get_option( $this->parent->OPT_INTERVAL, 'd' ); echo '