'array', 'sanitize_callback' => array( __CLASS__, 'sanitize' ), 'default' => alpeg_forms_default_settings(), ) ); } /** * Sanitize input. * * @param mixed $input Input. * @return array */ public static function sanitize( $input ) { $input = is_array( $input ) ? $input : array(); $emails = array_filter( array_map( 'trim', explode( ',', isset( $input['notify_email'] ) ? (string) $input['notify_email'] : '' ) ) ); $valid = array_filter( $emails, 'is_email' ); if ( count( $valid ) !== count( $emails ) ) { add_settings_error( 'alpeg_forms_settings', 'email', __( 'At least one email address was invalid and has been removed.', 'alpeg-forms' ) ); } $days = isset( $input['retention_days'] ) ? max( 0, min( 3650, (int) $input['retention_days'] ) ) : 180; $ip = isset( $input['ip_mode'] ) && in_array( $input['ip_mode'], array( 'none', 'anonymized', 'full' ), true ) ? $input['ip_mode'] : 'anonymized'; return array( 'notify_email' => implode( ', ', array_map( 'sanitize_email', $valid ) ), 'retention_days' => $days, 'ip_mode' => $ip, 'delete_on_remove' => ! empty( $input['delete_on_remove'] ), ); } /** * Render the page. */ public static function render() { $s = wp_parse_args( (array) get_option( 'alpeg_forms_settings', array() ), alpeg_forms_default_settings() ); $notice = get_transient( 'alpeg_forms_settings_notice_' . get_current_user_id() ); delete_transient( 'alpeg_forms_settings_notice_' . get_current_user_id() ); ?>



' . esc_html__( 'Settings → Privacy', 'alpeg-forms' ) . '', '' . esc_html__( 'Tools', 'alpeg-forms' ) . '' ); ?>

' . esc_html( $from ) . '' ); ?>

()

' . esc_html( str_replace( ABSPATH, '/', $base ) ) . '', esc_html( size_format( wp_max_upload_size() ) ) ); ?>