| @@ -41,9 +41,13 @@ | ||
| 41 | 41 | public $no_ips; |
| 42 | 42 | public $custom_header_ip; |
| 43 | 43 | public $current_form = 0; |
| 44 | 44 | public $tracking; |
| 45 | + public $summary_emails; | |
| 46 | + public $summary_emails_recipients; | |
| 45 | 47 | |
| 48 | + public $currency; | |
| 49 | + | |
| 46 | 50 | /** |
| 47 | 51 | * @since 6.0 |
| 48 | 52 | * |
| 49 | 53 | * @var string|false|null |
| @@ -54,9 +58,9 @@ | ||
| 54 | 58 | if ( ! defined( 'ABSPATH' ) ) { |
| 55 | 59 | die( 'You are not allowed to call this page directly.' ); |
| 56 | 60 | } |
| 57 | 61 | |
| 58 | - $settings = get_transient( $this->option_name ); | |
| 62 | + $settings = get_option( $this->option_name ); | |
| 59 | 63 | |
| 60 | 64 | if ( ! is_object( $settings ) ) { |
| 61 | 65 | $settings = $this->translate_settings( $settings ); |
| 62 | 66 | } |
| @@ -71,29 +75,18 @@ | ||
| 71 | 75 | $this->maybe_filter_for_form( $args ); |
| 72 | 76 | } |
| 73 | 77 | |
| 74 | 78 | private function translate_settings( $settings ) { |
| 75 | - if ( $settings ) { //workaround for W3 total cache conflict | |
| 79 | + if ( $settings ) { | |
| 80 | + // Workaround for W3 total cache conflict. | |
| 76 | 81 | return unserialize( serialize( $settings ) ); |
| 77 | 82 | } |
| 78 | 83 | |
| 79 | - $settings = get_option( $this->option_name ); | |
| 80 | - if ( is_object( $settings ) ) { | |
| 81 | - set_transient( $this->option_name, $settings ); | |
| 84 | + // If unserializing didn't work. | |
| 85 | + $settings = $this; | |
| 82 | 86 | |
| 83 | - return $settings; | |
| 84 | - } | |
| 87 | + update_option( $this->option_name, $settings, 'yes' ); | |
| 85 | 88 | |
| 86 | - // If unserializing didn't work | |
| 87 | - if ( $settings ) { //workaround for W3 total cache conflict | |
| 88 | - $settings = unserialize( serialize( $settings ) ); | |
| 89 | - } else { | |
| 90 | - $settings = $this; | |
| 91 | - } | |
| 92 | - | |
| 93 | - update_option( $this->option_name, $settings ); | |
| 94 | - set_transient( $this->option_name, $settings ); | |
| 95 | - | |
| 96 | 89 | return $settings; |
| 97 | 90 | } |
| 98 | 91 | |
| 99 | 92 | /** |
| @@ -123,10 +116,14 @@ | ||
| 123 | 116 | 'new_tab_msg' => __( 'The page has been opened in a new tab.', 'formidable' ), |
| 124 | 117 | |
| 125 | 118 | 'email_to' => '[admin_email]', |
| 126 | 119 | 'no_ips' => 0, |
| 127 | - 'custom_header_ip' => false, // Use false by default. We show a warning when this is unset. Once global settings have been saved, this gets saved | |
| 120 | + // Use false by default. We show a warning when this is unset. Once global settings have been saved, this gets saved. | |
| 121 | + 'custom_header_ip' => false, | |
| 128 | 122 | 'tracking' => FrmAppHelper::pro_is_installed(), |
| 123 | + // Only enable this by default for the main site. | |
| 124 | + 'summary_emails' => get_current_blog_id() === get_main_site_id(), | |
| 125 | + 'summary_emails_recipients' => '[admin_email]', | |
| 129 | 126 | |
| 130 | 127 | // Normally custom CSS is a string. A false value is used when nothing has been set. |
| 131 | 128 | // When it is false, we try to use the old custom_key value from the default style's post_content array. |
| 132 | 129 | 'custom_css' => false, |
| @@ -162,8 +159,12 @@ | ||
| 162 | 159 | if ( ! isset( $this->$frm_role ) ) { |
| 163 | 160 | $this->$frm_role = 'administrator'; |
| 164 | 161 | } |
| 165 | 162 | } |
| 163 | + | |
| 164 | + if ( ! isset( $this->currency ) ) { | |
| 165 | + $this->currency = 'USD'; | |
| 166 | + } | |
| 166 | 167 | } |
| 167 | 168 | |
| 168 | 169 | /** |
| 169 | 170 | * @param array $params |
| @@ -348,10 +349,11 @@ | ||
| 348 | 349 | $this->re_lang = $params['frm_re_lang']; |
| 349 | 350 | $this->re_threshold = floatval( $params['frm_re_threshold'] ); |
| 350 | 351 | $this->load_style = $params['frm_load_style']; |
| 351 | 352 | $this->custom_css = $params['frm_custom_css']; |
| 353 | + $this->currency = $params['frm_currency']; | |
| 352 | 354 | |
| 353 | - $checkboxes = array( 'mu_menu', 're_multi', 'use_html', 'jquery_css', 'accordion_js', 'fade_form', 'no_ips', 'custom_header_ip', 'tracking', 'admin_bar' ); | |
| 355 | + $checkboxes = array( 'mu_menu', 're_multi', 'use_html', 'jquery_css', 'accordion_js', 'fade_form', 'no_ips', 'custom_header_ip', 'tracking', 'admin_bar', 'summary_emails' ); | |
| 354 | 356 | foreach ( $checkboxes as $set ) { |
| 355 | 357 | $this->$set = isset( $params[ 'frm_' . $set ] ) ? absint( $params[ 'frm_' . $set ] ) : 0; |
| 356 | 358 | } |
| 357 | 359 | } |