PluginProbe
SureForms – Contact Form Builder, AI Forms, Payment Form, Survey & Quiz / 2.12.8
SureForms – Contact Form Builder, AI Forms, Payment Form, Survey & Quiz v2.12.8
2.12.8 2.12.7 2.12.6 2.12.5 2.12.4 2.12.3 2.12.2 2.12.1 2.12.0 2.11.1 2.11.0 2.10.1 2.10.0 2.9.1 2.9.0 2.8.2 2.8.1 2.7.0 2.7.1 2.8.0 trunk 0.0.10 0.0.11 0.0.12 0.0.13 All 98 releases
← All changes | inc/global-settings/global-settings.php +31 -10 2.12.5 → 2.12.8 View file →
@@ -7,8 +7,9 @@
7 7 */
8 8
9 9 namespace SRFM\Inc\Global_Settings;
10 10
11 +use SRFM\Inc\Client_Logger;
11 12 use SRFM\Inc\Events_Scheduler;
12 13 use SRFM\Inc\Helper;
13 14 use SRFM\Inc\Payments\Payment_Helper;
14 15 use SRFM\Inc\Traits\Get_Instance;
@@ -147,17 +148,23 @@
147 148 * @since 0.0.1
148 149 */
149 150 public static function srfm_save_general_settings( $setting_options ) {
150 151
151 - $srfm_ip_log = $setting_options['srfm_ip_log'] ?? false;
152 - $srfm_form_analytics = $setting_options['srfm_form_analytics'] ?? false;
153 - $srfm_bsf_analytics = $setting_options['srfm_bsf_analytics'] ?? false;
154 - $srfm_admin_notification = isset( $setting_options['srfm_admin_notification'] ) ? (bool) $setting_options['srfm_admin_notification'] : true;
152 + $srfm_ip_log = $setting_options['srfm_ip_log'] ?? false;
153 + $srfm_form_analytics = $setting_options['srfm_form_analytics'] ?? false;
154 + $srfm_bsf_analytics = $setting_options['srfm_bsf_analytics'] ?? false;
155 + $srfm_admin_notification = isset( $setting_options['srfm_admin_notification'] ) ? (bool) $setting_options['srfm_admin_notification'] : true;
156 + $srfm_form_views_tracking = isset( $setting_options['srfm_form_views_tracking'] ) ? (bool) $setting_options['srfm_form_views_tracking'] : false;
157 + // Absent means on, matching Client_Logger::is_enabled(). A save that omits
158 + // the key must not be read as the site opting out.
159 + $srfm_enable_logs = isset( $setting_options['srfm_enable_logs'] ) ? (bool) $setting_options['srfm_enable_logs'] : true;
155 160
156 161 $settings = [
157 - 'srfm_ip_log' => $srfm_ip_log,
158 - 'srfm_form_analytics' => $srfm_form_analytics,
159 - 'srfm_admin_notification' => $srfm_admin_notification,
162 + 'srfm_ip_log' => $srfm_ip_log,
163 + 'srfm_form_analytics' => $srfm_form_analytics,
164 + 'srfm_admin_notification' => $srfm_admin_notification,
165 + 'srfm_form_views_tracking' => $srfm_form_views_tracking,
166 + 'srfm_enable_logs' => $srfm_enable_logs,
160 167 ];
161 168
162 169 /**
163 170 * We are updating sureforms_analytics_optin option from the general settings as it has been introduced
@@ -659,11 +666,13 @@
659 666 }
660 667
661 668 if ( empty( $global_setting_options['srfm_general_settings_options'] ) || ! is_array( $global_setting_options['srfm_general_settings_options'] ) ) {
662 669 $global_setting_options['srfm_general_settings_options'] = [
663 - 'srfm_ip_log' => false,
664 - 'srfm_form_analytics' => false,
665 - 'srfm_admin_notification' => true,
670 + 'srfm_ip_log' => false,
671 + 'srfm_form_analytics' => false,
672 + 'srfm_admin_notification' => true,
673 + 'srfm_form_views_tracking' => false,
674 + 'srfm_enable_logs' => true,
666 675 ];
667 676 }
668 677
669 678 if ( ! isset( $global_setting_options['srfm_general_settings_options']['srfm_admin_notification'] ) ) {
@@ -668,8 +677,20 @@
668 677
669 678 if ( ! isset( $global_setting_options['srfm_general_settings_options']['srfm_admin_notification'] ) ) {
670 679 $global_setting_options['srfm_general_settings_options']['srfm_admin_notification'] = true;
671 680 }
681 +
682 + if ( ! isset( $global_setting_options['srfm_general_settings_options']['srfm_form_views_tracking'] ) ) {
683 + $global_setting_options['srfm_general_settings_options']['srfm_form_views_tracking'] = false;
684 + }
685 +
686 + // Back-fill for installs whose option predates the setting. Logging is on by
687 + // default, so an absent key means on, not off.
688 + if ( ! isset( $global_setting_options['srfm_general_settings_options']['srfm_enable_logs'] ) ) {
689 + $global_setting_options['srfm_general_settings_options']['srfm_enable_logs'] = true;
690 + }
691 +
692 + $global_setting_options['srfm_log_file_size'] = Client_Logger::get_file_size();
672 693
673 694 /**
674 695 * We have introduced toggle for analytics optin in the general settings.
675 696 * Hence retrieving the option sureforms_analytics_optin to get current status.