From b4f871537ea1905e68c0095d7fc87ce50c4c38ee Mon Sep 17 00:00:00 2001 From: Amaan Khan Date: Fri, 12 Apr 2024 18:56:55 +0530 Subject: [PATCH 1/2] fix: fixes 'Fatal Error on Empty Redis Port Setting' bug --- admin/partials/nginx-helper-general-options.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/admin/partials/nginx-helper-general-options.php b/admin/partials/nginx-helper-general-options.php index ef1423d..8a93a50 100644 --- a/admin/partials/nginx-helper-general-options.php +++ b/admin/partials/nginx-helper-general-options.php @@ -61,14 +61,21 @@ $site_options = get_site_option( 'rt_wp_nginx_helper_options', array() ); - // Uncheck checkbox fields whose default value is `1` but user has unchecked. foreach ( $nginx_helper_admin->nginx_helper_default_settings() as $default_setting_field => $default_setting_value ) { + // Uncheck checkbox fields whose default value is `1` but user has unchecked. if ( 1 === $default_setting_value && isset( $site_options[ $default_setting_field ] ) && empty( $all_inputs[ $default_setting_field ] ) ) { $nginx_settings[ $default_setting_field ] = 0; } + + // Populate the setting field with default value when it is empty. + if ( '' === $nginx_settings[ $default_setting_field ] ) { + + $nginx_settings[ $default_setting_field ] = $default_setting_value; + + } } if ( ( ! is_numeric( $nginx_settings['log_filesize'] ) ) || ( empty( $nginx_settings['log_filesize'] ) ) ) { From 8699ac15169b1003f00f67c2e6ac037d60d59587 Mon Sep 17 00:00:00 2001 From: Amaan Khan Date: Fri, 12 Apr 2024 19:02:46 +0530 Subject: [PATCH 2/2] refactor: updates spaces with tabs --- .../partials/nginx-helper-general-options.php | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/admin/partials/nginx-helper-general-options.php b/admin/partials/nginx-helper-general-options.php index 8a93a50..a91eb53 100644 --- a/admin/partials/nginx-helper-general-options.php +++ b/admin/partials/nginx-helper-general-options.php @@ -59,24 +59,24 @@ $nginx_helper_admin->nginx_helper_default_settings() ); - $site_options = get_site_option( 'rt_wp_nginx_helper_options', array() ); + $site_options = get_site_option( 'rt_wp_nginx_helper_options', array() ); - foreach ( $nginx_helper_admin->nginx_helper_default_settings() as $default_setting_field => $default_setting_value ) { + foreach ( $nginx_helper_admin->nginx_helper_default_settings() as $default_setting_field => $default_setting_value ) { - // Uncheck checkbox fields whose default value is `1` but user has unchecked. - if ( 1 === $default_setting_value && isset( $site_options[ $default_setting_field ] ) && empty( $all_inputs[ $default_setting_field ] ) ) { + // Uncheck checkbox fields whose default value is `1` but user has unchecked. + if ( 1 === $default_setting_value && isset( $site_options[ $default_setting_field ] ) && empty( $all_inputs[ $default_setting_field ] ) ) { - $nginx_settings[ $default_setting_field ] = 0; + $nginx_settings[ $default_setting_field ] = 0; - } + } - // Populate the setting field with default value when it is empty. - if ( '' === $nginx_settings[ $default_setting_field ] ) { + // Populate the setting field with default value when it is empty. + if ( '' === $nginx_settings[ $default_setting_field ] ) { - $nginx_settings[ $default_setting_field ] = $default_setting_value; + $nginx_settings[ $default_setting_field ] = $default_setting_value; - } - } + } + } if ( ( ! is_numeric( $nginx_settings['log_filesize'] ) ) || ( empty( $nginx_settings['log_filesize'] ) ) ) { $error_log_filesize = __( 'Log file size must be a number.', 'nginx-helper' );