Test email sent successfully.

'; } else { echo '

Failed to send test email.

'; } } if ( isset( $_POST['astr_save_notifications_main'] ) && check_admin_referer( 'astr_save_email_notifications' ) ) { $emails_raw = isset( $_POST['astr_emails'] ) ? sanitize_textarea_field( wp_unslash( $_POST['astr_emails'] ) ) : ''; $emails_array = array_filter( array_map( 'trim', preg_split( '/[\r\n,]+/', $emails_raw ) ) ); update_option( 'astr_notification_emails', $emails_array ); $events = isset( $_POST['astr_events'] ) ? array_map( 'sanitize_text_field', wp_unslash( $_POST['astr_events'] ) ) : []; $events = array_diff( $events, [ 'all' ] ); update_option( 'astr_notification_events', $events ); delete_transient( 'astr_email_buffer' ); // RESET BUFFER $delay = isset( $_POST['astr_email_delay'] ) ? sanitize_text_field( wp_unslash( $_POST['astr_email_delay'] ) ) : '5min'; update_option( 'astr_email_delay', $delay ); echo '

Notification settings saved.

'; } // === Save uninstall option === if ( isset( $_POST['astr_save_uninstall_option'] ) && check_admin_referer( 'astr_save_email_notifications' ) ) { $delete_history = isset( $_POST['astr_delete_on_uninstall'] ) ? 'yes' : 'no'; update_option( 'astr_delete_on_uninstall', $delete_history ); echo '

Uninstall cleanup option saved.

'; } // === Clear history === if ( isset( $_POST['astr_clear_history'] ) && check_admin_referer( 'astr_clear_history_action' ) ) { $clear_confirm = isset( $_POST['astr_clear_confirm'] ) ? sanitize_text_field( wp_unslash( $_POST['astr_clear_confirm'] ) ) : ''; if ( trim( $clear_confirm ) === 'CLEAR' ) { global $wpdb; $table = esc_sql( $wpdb->prefix . 'astr_plugins_history' ); // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared $wpdb->query( "TRUNCATE TABLE {$table}" ); echo '

Plugin history has been cleared.

'; } else { echo '

Confirmation failed. Type CLEAR to confirm.

'; } } // === Save CPT revisions option === if ( isset( $_POST['astr_save_cpt_revisions'] ) && check_admin_referer( 'astr_save_cpt_revisions' ) ) { update_option( 'astr_enable_cpt_revisions', isset( $_POST['astr_enable_cpt_revisions'] ) ? 1 : 0 ); echo '

CPT revisions setting saved.

'; } // === Load values === $saved_emails = (array) get_option( 'astr_notification_emails', [] ); $saved_events = (array) get_option( 'astr_notification_events', [] ); if ( ! in_array( 'rolled_back', $saved_events, true ) ) { $saved_events[] = 'rolled_back'; } $emails_text = implode( "\n", $saved_emails ); $cpt_revisions_enabled = (bool) get_option( 'astr_enable_cpt_revisions', 1 ); $delete_on_uninstall = get_option( 'astr_delete_on_uninstall' ) === 'yes'; ?>


true, '_builtin' => false, ], 'names' ); foreach ( $post_types as $post_type ) { add_post_type_support( $post_type, 'revisions' ); } } );