| @@ -41,8 +41,10 @@ | ||
| 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 | |
| 46 | 48 | public $currency; |
| 47 | 49 | |
| 48 | 50 | /** |
| @@ -56,9 +58,9 @@ | ||
| 56 | 58 | if ( ! defined( 'ABSPATH' ) ) { |
| 57 | 59 | die( 'You are not allowed to call this page directly.' ); |
| 58 | 60 | } |
| 59 | 61 | |
| 60 | - $settings = get_transient( $this->option_name ); | |
| 62 | + $settings = get_option( $this->option_name ); | |
| 61 | 63 | |
| 62 | 64 | if ( ! is_object( $settings ) ) { |
| 63 | 65 | $settings = $this->translate_settings( $settings ); |
| 64 | 66 | } |
| @@ -73,29 +75,18 @@ | ||
| 73 | 75 | $this->maybe_filter_for_form( $args ); |
| 74 | 76 | } |
| 75 | 77 | |
| 76 | 78 | private function translate_settings( $settings ) { |
| 77 | - if ( $settings ) { //workaround for W3 total cache conflict | |
| 79 | + if ( $settings ) { | |
| 80 | + // Workaround for W3 total cache conflict. | |
| 78 | 81 | return unserialize( serialize( $settings ) ); |
| 79 | 82 | } |
| 80 | 83 | |
| 81 | - $settings = get_option( $this->option_name ); | |
| 82 | - if ( is_object( $settings ) ) { | |
| 83 | - set_transient( $this->option_name, $settings ); | |
| 84 | + // If unserializing didn't work. | |
| 85 | + $settings = $this; | |
| 84 | 86 | |
| 85 | - return $settings; | |
| 86 | - } | |
| 87 | + update_option( $this->option_name, $settings, 'yes' ); | |
| 87 | 88 | |
| 88 | - // If unserializing didn't work | |
| 89 | - if ( $settings ) { //workaround for W3 total cache conflict | |
| 90 | - $settings = unserialize( serialize( $settings ) ); | |
| 91 | - } else { | |
| 92 | - $settings = $this; | |
| 93 | - } | |
| 94 | - | |
| 95 | - update_option( $this->option_name, $settings ); | |
| 96 | - set_transient( $this->option_name, $settings ); | |
| 97 | - | |
| 98 | 89 | return $settings; |
| 99 | 90 | } |
| 100 | 91 | |
| 101 | 92 | /** |
| @@ -125,10 +116,14 @@ | ||
| 125 | 116 | 'new_tab_msg' => __( 'The page has been opened in a new tab.', 'formidable' ), |
| 126 | 117 | |
| 127 | 118 | 'email_to' => '[admin_email]', |
| 128 | 119 | 'no_ips' => 0, |
| 129 | - '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, | |
| 130 | 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]', | |
| 131 | 126 | |
| 132 | 127 | // Normally custom CSS is a string. A false value is used when nothing has been set. |
| 133 | 128 | // When it is false, we try to use the old custom_key value from the default style's post_content array. |
| 134 | 129 | 'custom_css' => false, |
| @@ -356,9 +351,9 @@ | ||
| 356 | 351 | $this->load_style = $params['frm_load_style']; |
| 357 | 352 | $this->custom_css = $params['frm_custom_css']; |
| 358 | 353 | $this->currency = $params['frm_currency']; |
| 359 | 354 | |
| 360 | - $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' ); | |
| 361 | 356 | foreach ( $checkboxes as $set ) { |
| 362 | 357 | $this->$set = isset( $params[ 'frm_' . $set ] ) ? absint( $params[ 'frm_' . $set ] ) : 0; |
| 363 | 358 | } |
| 364 | 359 | } |