$post Unslashed form fields. * @return void */ public static function process_save( array $post ): void { $raw = isset( $post['owner_phone'] ) && is_string( $post['owner_phone'] ) ? trim( sanitize_text_field( $post['owner_phone'] ) ) : ''; if ( '' !== $raw && null === Phone::normalize( $raw, Phone::default_country_code() ) ) { Notice::add( 'error', __( 'Your phone number is not valid. Nothing was saved.', '85pl-android-sms-api' ) ); return; } $countries = Limits::clean_setting( isset( $post['allowed_countries'] ) && is_string( $post['allowed_countries'] ) ? sanitize_text_field( $post['allowed_countries'] ) : '' ); if ( array() !== $countries['invalid'] ) { /* translators: %s: entries that are not countries, e.g. "XX". */ Notice::add( 'error', sprintf( __( 'Allowed recipient countries: %s is not a country code. Use two-letter codes (PL, DE) or calling codes (48, 386). Nothing was saved.', '85pl-android-sms-api' ), implode( ', ', $countries['invalid'] ) ) ); return; } update_option( Limits::COUNTRIES_OPTION, $countries['value'], false ); update_option( self::OWNER_PHONE_OPTION, '' === $raw ? '' : Phone::normalize( $raw, Phone::default_country_code() ), false ); update_option( Replies::EMAIL_OPTION, empty( $post['reply_email'] ) ? '0' : '1', false ); Notice::add( 'success', __( 'Settings saved.', '85pl-android-sms-api' ) ); } }