id = 'notification-center'; $this->title = __( 'Notification Center', 'better-wp-security' ); $this->description = __( 'Manage and configure email notifications sent by iThemes Security related to various settings modules.', 'better-wp-security' ); $this->type = 'recommended'; $this->can_save = true; $this->validator = ITSEC_Modules::get_validator( 'notification-center' ); if ( ITSEC_Modules::get_setting( 'notification-center', 'last_mail_error' ) ) { $this->status = 'warning'; } parent::__construct(); } public function enqueue_scripts_and_styles() { wp_enqueue_style( 'itsec-notification-center-admin', plugins_url( 'css/settings-page.css', __FILE__ ), array(), $this->version ); wp_enqueue_script( 'itsec-notification-center-admin', plugins_url( 'js/settings-page.js', __FILE__ ), array( 'jquery', 'itsec-settings-page-script' ), $this->version ); } public function handle_ajax_request( $data ) { if ( empty( $data['method'] ) ) { return; } switch ( $data['method'] ) { case 'dismiss-mail-error': ITSEC_Modules::set_setting( 'notification-center', 'last_mail_error', '' ); ITSEC_Response::set_success( true ); break; } } protected function render_description( $form ) { ?>

last_sent = ITSEC_Modules::get_setting( 'notification-center', 'last_sent' ); $this->render_mail_errors(); ?>
add_text( 'from_email' ); ?>

get_notifications(); usort( $notifications, array( $this, 'sort_notifications' ) ); $form->add_input_group( 'notifications' ); foreach ( $notifications as $notification ) { $this->render_notification_setting( $form, $notification['slug'], $notification ); } $form->remove_input_group(); } protected function render_mail_errors() { if ( ! $message = ITSEC_Modules::get_setting( 'notification-center', 'last_mail_error' ) ) { return; } $link = esc_url( ITSEC_Core::get_logs_page_url( 'notification_center', 'error' ) ); ?>

", '' ); ?>

get_notification_strings( $slug ); $form->add_input_group( $slug ); ?>

get_option( 'subject' ) ? '' : $form->set_option( 'subject', $strings['subject'] ); ?> get_option( 'message' ) ? '' : $form->set_option( 'message', $strings['message'] ); ?> render_user_list( $slug, $form, $config['recipient'] ); ?>
add_checkbox( 'enabled', array( 'data-slug' => $slug ) ); ?>
add_text( 'subject' ); ?>
add_textarea( 'message' ); ?>

validator->get_allowed_html() ) ); ?> {{ $tag_name }}' ); ?>

$description ): ?>
add_select( 'schedule', $this->validator->get_schedule_options( $config['schedule'] ) ); ?>

last_sent[ $slug ] ) ): ?> last_sent[ $slug ] ) ); ?>

add_textarea( 'email_list', array( 'class' => 'textarea-small' ) ); ?>

remove_input_group(); } /** * Render the User List form. * * @param string $slug Notification slug. * @param ITSEC_Form $form * @param string $type */ protected function render_user_list( $slug, $form, $type ) { ?> add_select( 'recipient_type', array( 'class' => 'itsec-notification-center-user-list-type', 'value' => array( 'default' => esc_html__( 'Default Recipients', 'better-wp-security' ), 'custom' => esc_html__( 'Custom', 'better-wp-security' ) ), ) ); ?>
render_user_list_fieldset( $form, $type ); ?>
validator->get_available_admin_users_and_roles(); $users = $users_and_roles['users']; $roles = $users_and_roles['roles']; natcasesort( $users ); ?>

get_option( 'previous_emails' ) ): ?>

get_notification_strings( $a['slug'] ); $b_s = ITSEC_Core::get_notification_center()->get_notification_strings( $b['slug'] ); return strcmp( $a_s['label'], $b_s['label'] ); } } new ITSEC_Notification_Center_Settings_Page();