@@ -1,242 +1,242 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | class FrmSettings { |
4 | - public $option_name = 'frm_options'; |
|
5 | - public $menu; |
|
6 | - public $mu_menu; |
|
7 | - public $preview_page_id; |
|
8 | - public $use_html; |
|
9 | - public $jquery_css; |
|
10 | - public $accordion_js; |
|
11 | - |
|
12 | - public $success_msg; |
|
13 | - public $blank_msg; |
|
14 | - public $unique_msg; |
|
15 | - public $invalid_msg; |
|
16 | - public $failed_msg; |
|
17 | - public $submit_value; |
|
18 | - public $login_msg; |
|
19 | - public $admin_permission; |
|
20 | - |
|
21 | - public $email_to; |
|
22 | - public $load_style; |
|
23 | - public $custom_style; |
|
24 | - |
|
25 | - public $pubkey; |
|
26 | - public $privkey; |
|
27 | - public $re_lang; |
|
28 | - public $re_msg; |
|
4 | + public $option_name = 'frm_options'; |
|
5 | + public $menu; |
|
6 | + public $mu_menu; |
|
7 | + public $preview_page_id; |
|
8 | + public $use_html; |
|
9 | + public $jquery_css; |
|
10 | + public $accordion_js; |
|
11 | + |
|
12 | + public $success_msg; |
|
13 | + public $blank_msg; |
|
14 | + public $unique_msg; |
|
15 | + public $invalid_msg; |
|
16 | + public $failed_msg; |
|
17 | + public $submit_value; |
|
18 | + public $login_msg; |
|
19 | + public $admin_permission; |
|
20 | + |
|
21 | + public $email_to; |
|
22 | + public $load_style; |
|
23 | + public $custom_style; |
|
24 | + |
|
25 | + public $pubkey; |
|
26 | + public $privkey; |
|
27 | + public $re_lang; |
|
28 | + public $re_msg; |
|
29 | 29 | public $re_multi; |
30 | 30 | |
31 | - public function __construct() { |
|
32 | - if ( ! defined('ABSPATH') ) { |
|
33 | - die('You are not allowed to call this page directly.'); |
|
34 | - } |
|
31 | + public function __construct() { |
|
32 | + if ( ! defined('ABSPATH') ) { |
|
33 | + die('You are not allowed to call this page directly.'); |
|
34 | + } |
|
35 | 35 | |
36 | - $settings = get_transient($this->option_name); |
|
36 | + $settings = get_transient($this->option_name); |
|
37 | 37 | |
38 | - if ( ! is_object($settings) ) { |
|
39 | - $settings = $this->translate_settings($settings); |
|
40 | - } |
|
38 | + if ( ! is_object($settings) ) { |
|
39 | + $settings = $this->translate_settings($settings); |
|
40 | + } |
|
41 | 41 | |
42 | - foreach ( $settings as $setting_name => $setting ) { |
|
43 | - $this->{$setting_name} = $setting; |
|
44 | - unset($setting_name, $setting); |
|
45 | - } |
|
42 | + foreach ( $settings as $setting_name => $setting ) { |
|
43 | + $this->{$setting_name} = $setting; |
|
44 | + unset($setting_name, $setting); |
|
45 | + } |
|
46 | 46 | |
47 | - $this->set_default_options(); |
|
48 | - } |
|
47 | + $this->set_default_options(); |
|
48 | + } |
|
49 | 49 | |
50 | 50 | private function translate_settings( $settings ) { |
51 | - if ( $settings ) { //workaround for W3 total cache conflict |
|
52 | - return unserialize(serialize($settings)); |
|
53 | - } |
|
54 | - |
|
55 | - $settings = get_option($this->option_name); |
|
56 | - if ( is_object($settings) ) { |
|
57 | - set_transient($this->option_name, $settings); |
|
58 | - return $settings; |
|
59 | - } |
|
60 | - |
|
61 | - // If unserializing didn't work |
|
62 | - if ( $settings ) { //workaround for W3 total cache conflict |
|
63 | - $settings = unserialize(serialize($settings)); |
|
64 | - } else { |
|
65 | - $settings = $this; |
|
66 | - } |
|
67 | - |
|
68 | - update_option($this->option_name, $settings); |
|
69 | - set_transient($this->option_name, $settings); |
|
70 | - |
|
71 | - return $settings; |
|
72 | - } |
|
73 | - |
|
74 | - /** |
|
75 | - * @return array |
|
76 | - */ |
|
51 | + if ( $settings ) { //workaround for W3 total cache conflict |
|
52 | + return unserialize(serialize($settings)); |
|
53 | + } |
|
54 | + |
|
55 | + $settings = get_option($this->option_name); |
|
56 | + if ( is_object($settings) ) { |
|
57 | + set_transient($this->option_name, $settings); |
|
58 | + return $settings; |
|
59 | + } |
|
60 | + |
|
61 | + // If unserializing didn't work |
|
62 | + if ( $settings ) { //workaround for W3 total cache conflict |
|
63 | + $settings = unserialize(serialize($settings)); |
|
64 | + } else { |
|
65 | + $settings = $this; |
|
66 | + } |
|
67 | + |
|
68 | + update_option($this->option_name, $settings); |
|
69 | + set_transient($this->option_name, $settings); |
|
70 | + |
|
71 | + return $settings; |
|
72 | + } |
|
73 | + |
|
74 | + /** |
|
75 | + * @return array |
|
76 | + */ |
|
77 | 77 | public function default_options() { |
78 | - return array( |
|
79 | - 'menu' => apply_filters( 'frm_default_menu', __( 'Forms', 'formidable' ) ), |
|
80 | - 'mu_menu' => 0, |
|
81 | - 'preview_page_id' => 0, |
|
82 | - 'use_html' => true, |
|
83 | - 'jquery_css' => false, |
|
84 | - 'accordion_js' => false, |
|
78 | + return array( |
|
79 | + 'menu' => apply_filters( 'frm_default_menu', __( 'Forms', 'formidable' ) ), |
|
80 | + 'mu_menu' => 0, |
|
81 | + 'preview_page_id' => 0, |
|
82 | + 'use_html' => true, |
|
83 | + 'jquery_css' => false, |
|
84 | + 'accordion_js' => false, |
|
85 | 85 | |
86 | 86 | 're_multi' => 0, |
87 | 87 | |
88 | - 'success_msg' => __( 'Your responses were successfully submitted. Thank you!', 'formidable' ), |
|
89 | - 'blank_msg' => __( 'This field cannot be blank.', 'formidable' ), |
|
90 | - 'unique_msg' => __( 'This value must be unique.', 'formidable' ), |
|
91 | - 'invalid_msg' => __( 'There was a problem with your submission. Errors are marked below.', 'formidable' ), |
|
92 | - 'failed_msg' => __( 'We\'re sorry. It looks like you\'ve already submitted that.', 'formidable' ), |
|
93 | - 'submit_value' => __( 'Submit', 'formidable' ), |
|
94 | - 'login_msg' => __( 'You do not have permission to view this form.', 'formidable' ), |
|
95 | - 'admin_permission' => __( 'You do not have permission to do that', 'formidable' ), |
|
88 | + 'success_msg' => __( 'Your responses were successfully submitted. Thank you!', 'formidable' ), |
|
89 | + 'blank_msg' => __( 'This field cannot be blank.', 'formidable' ), |
|
90 | + 'unique_msg' => __( 'This value must be unique.', 'formidable' ), |
|
91 | + 'invalid_msg' => __( 'There was a problem with your submission. Errors are marked below.', 'formidable' ), |
|
92 | + 'failed_msg' => __( 'We\'re sorry. It looks like you\'ve already submitted that.', 'formidable' ), |
|
93 | + 'submit_value' => __( 'Submit', 'formidable' ), |
|
94 | + 'login_msg' => __( 'You do not have permission to view this form.', 'formidable' ), |
|
95 | + 'admin_permission' => __( 'You do not have permission to do that', 'formidable' ), |
|
96 | 96 | |
97 | - 'email_to' => '[admin_email]', |
|
98 | - ); |
|
99 | - } |
|
97 | + 'email_to' => '[admin_email]', |
|
98 | + ); |
|
99 | + } |
|
100 | 100 | |
101 | 101 | private function set_default_options() { |
102 | - $this->fill_recaptcha_settings(); |
|
103 | - |
|
104 | - if ( ! isset($this->load_style) ) { |
|
105 | - if ( ! isset($this->custom_style) ) { |
|
106 | - $this->custom_style = true; |
|
107 | - } |
|
108 | - |
|
109 | - $this->load_style = 'all'; |
|
110 | - } |
|
111 | - |
|
112 | - $this->fill_with_defaults(); |
|
113 | - |
|
114 | - if ( is_multisite() && is_admin() ) { |
|
115 | - $mu_menu = get_site_option('frm_admin_menu_name'); |
|
116 | - if ( $mu_menu && ! empty($mu_menu) ) { |
|
117 | - $this->menu = $mu_menu; |
|
118 | - $this->mu_menu = 1; |
|
119 | - } |
|
120 | - } |
|
121 | - |
|
122 | - $frm_roles = FrmAppHelper::frm_capabilities('pro'); |
|
123 | - foreach ( $frm_roles as $frm_role => $frm_role_description ) { |
|
124 | - if ( ! isset($this->$frm_role) ) { |
|
125 | - $this->$frm_role = 'administrator'; |
|
126 | - } |
|
127 | - } |
|
128 | - } |
|
102 | + $this->fill_recaptcha_settings(); |
|
103 | + |
|
104 | + if ( ! isset($this->load_style) ) { |
|
105 | + if ( ! isset($this->custom_style) ) { |
|
106 | + $this->custom_style = true; |
|
107 | + } |
|
108 | + |
|
109 | + $this->load_style = 'all'; |
|
110 | + } |
|
111 | + |
|
112 | + $this->fill_with_defaults(); |
|
113 | + |
|
114 | + if ( is_multisite() && is_admin() ) { |
|
115 | + $mu_menu = get_site_option('frm_admin_menu_name'); |
|
116 | + if ( $mu_menu && ! empty($mu_menu) ) { |
|
117 | + $this->menu = $mu_menu; |
|
118 | + $this->mu_menu = 1; |
|
119 | + } |
|
120 | + } |
|
121 | + |
|
122 | + $frm_roles = FrmAppHelper::frm_capabilities('pro'); |
|
123 | + foreach ( $frm_roles as $frm_role => $frm_role_description ) { |
|
124 | + if ( ! isset($this->$frm_role) ) { |
|
125 | + $this->$frm_role = 'administrator'; |
|
126 | + } |
|
127 | + } |
|
128 | + } |
|
129 | 129 | |
130 | 130 | public function fill_with_defaults( $params = array() ) { |
131 | - $settings = $this->default_options(); |
|
131 | + $settings = $this->default_options(); |
|
132 | 132 | |
133 | - foreach ( $settings as $setting => $default ) { |
|
133 | + foreach ( $settings as $setting => $default ) { |
|
134 | 134 | if ( isset( $params[ 'frm_' . $setting ] ) ) { |
135 | 135 | $this->{$setting} = $params[ 'frm_' . $setting ]; |
136 | - } else if ( ! isset($this->{$setting}) ) { |
|
137 | - $this->{$setting} = $default; |
|
138 | - } |
|
136 | + } else if ( ! isset($this->{$setting}) ) { |
|
137 | + $this->{$setting} = $default; |
|
138 | + } |
|
139 | 139 | |
140 | 140 | if ( $setting == 'menu' && empty( $this->{$setting} ) ) { |
141 | 141 | $this->{$setting} = $default; |
142 | 142 | } |
143 | 143 | |
144 | - unset($setting, $default); |
|
145 | - } |
|
146 | - } |
|
144 | + unset($setting, $default); |
|
145 | + } |
|
146 | + } |
|
147 | 147 | |
148 | - private function fill_recaptcha_settings() { |
|
149 | - $privkey = ''; |
|
148 | + private function fill_recaptcha_settings() { |
|
149 | + $privkey = ''; |
|
150 | 150 | $re_lang = ''; |
151 | 151 | |
152 | - if ( ! isset($this->pubkey) ) { |
|
153 | - // get the options from the database |
|
154 | - $recaptcha_opt = is_multisite() ? get_site_option('recaptcha') : get_option('recaptcha'); |
|
155 | - $this->pubkey = isset($recaptcha_opt['pubkey']) ? $recaptcha_opt['pubkey'] : ''; |
|
156 | - $privkey = isset($recaptcha_opt['privkey']) ? $recaptcha_opt['privkey'] : $privkey; |
|
157 | - $re_lang = isset($recaptcha_opt['re_lang']) ? $recaptcha_opt['re_lang'] : $re_lang; |
|
158 | - } |
|
152 | + if ( ! isset($this->pubkey) ) { |
|
153 | + // get the options from the database |
|
154 | + $recaptcha_opt = is_multisite() ? get_site_option('recaptcha') : get_option('recaptcha'); |
|
155 | + $this->pubkey = isset($recaptcha_opt['pubkey']) ? $recaptcha_opt['pubkey'] : ''; |
|
156 | + $privkey = isset($recaptcha_opt['privkey']) ? $recaptcha_opt['privkey'] : $privkey; |
|
157 | + $re_lang = isset($recaptcha_opt['re_lang']) ? $recaptcha_opt['re_lang'] : $re_lang; |
|
158 | + } |
|
159 | 159 | |
160 | - if ( ! isset($this->re_msg) || empty($this->re_msg) ) { |
|
161 | - $this->re_msg = __( 'The reCAPTCHA was not entered correctly', 'formidable' ); |
|
162 | - } |
|
160 | + if ( ! isset($this->re_msg) || empty($this->re_msg) ) { |
|
161 | + $this->re_msg = __( 'The reCAPTCHA was not entered correctly', 'formidable' ); |
|
162 | + } |
|
163 | 163 | |
164 | - if ( ! isset($this->privkey) ) { |
|
165 | - $this->privkey = $privkey; |
|
166 | - } |
|
164 | + if ( ! isset($this->privkey) ) { |
|
165 | + $this->privkey = $privkey; |
|
166 | + } |
|
167 | 167 | |
168 | - if ( ! isset($this->re_lang) ) { |
|
169 | - $this->re_lang = $re_lang; |
|
170 | - } |
|
171 | - } |
|
168 | + if ( ! isset($this->re_lang) ) { |
|
169 | + $this->re_lang = $re_lang; |
|
170 | + } |
|
171 | + } |
|
172 | 172 | |
173 | - public function validate( $params, $errors ) { |
|
174 | - return apply_filters( 'frm_validate_settings', $errors, $params ); |
|
175 | - } |
|
173 | + public function validate( $params, $errors ) { |
|
174 | + return apply_filters( 'frm_validate_settings', $errors, $params ); |
|
175 | + } |
|
176 | 176 | |
177 | 177 | public function update( $params ) { |
178 | - $this->fill_with_defaults($params); |
|
179 | - $this->update_settings($params); |
|
178 | + $this->fill_with_defaults($params); |
|
179 | + $this->update_settings($params); |
|
180 | 180 | |
181 | - if ( $this->mu_menu ) { |
|
182 | - update_site_option('frm_admin_menu_name', $this->menu); |
|
183 | - } else if ( current_user_can('administrator') ) { |
|
184 | - update_site_option('frm_admin_menu_name', false); |
|
185 | - } |
|
181 | + if ( $this->mu_menu ) { |
|
182 | + update_site_option('frm_admin_menu_name', $this->menu); |
|
183 | + } else if ( current_user_can('administrator') ) { |
|
184 | + update_site_option('frm_admin_menu_name', false); |
|
185 | + } |
|
186 | 186 | |
187 | - $this->update_roles($params); |
|
187 | + $this->update_roles($params); |
|
188 | 188 | |
189 | - do_action( 'frm_update_settings', $params ); |
|
190 | - } |
|
189 | + do_action( 'frm_update_settings', $params ); |
|
190 | + } |
|
191 | 191 | |
192 | 192 | private function update_settings( $params ) { |
193 | - $this->mu_menu = isset($params['frm_mu_menu']) ? $params['frm_mu_menu'] : 0; |
|
193 | + $this->mu_menu = isset($params['frm_mu_menu']) ? $params['frm_mu_menu'] : 0; |
|
194 | 194 | |
195 | - $this->pubkey = trim($params['frm_pubkey']); |
|
196 | - $this->privkey = $params['frm_privkey']; |
|
197 | - $this->re_lang = $params['frm_re_lang']; |
|
195 | + $this->pubkey = trim($params['frm_pubkey']); |
|
196 | + $this->privkey = $params['frm_privkey']; |
|
197 | + $this->re_lang = $params['frm_re_lang']; |
|
198 | 198 | $this->re_multi = isset( $params['frm_re_multi'] ) ? $params['frm_re_multi'] : 0; |
199 | 199 | |
200 | - $this->load_style = $params['frm_load_style']; |
|
201 | - $this->preview_page_id = (int) $params['frm-preview-page-id']; |
|
200 | + $this->load_style = $params['frm_load_style']; |
|
201 | + $this->preview_page_id = (int) $params['frm-preview-page-id']; |
|
202 | 202 | |
203 | - $this->use_html = isset($params['frm_use_html']) ? $params['frm_use_html'] : 0; |
|
204 | - //$this->custom_style = isset($params['frm_custom_style']) ? $params['frm_custom_style'] : 0; |
|
203 | + $this->use_html = isset($params['frm_use_html']) ? $params['frm_use_html'] : 0; |
|
204 | + //$this->custom_style = isset($params['frm_custom_style']) ? $params['frm_custom_style'] : 0; |
|
205 | 205 | $this->jquery_css = isset( $params['frm_jquery_css'] ) ? absint( $params['frm_jquery_css'] ) : 0; |
206 | 206 | $this->accordion_js = isset( $params['frm_accordion_js'] ) ? absint( $params['frm_accordion_js'] ) : 0; |
207 | - } |
|
207 | + } |
|
208 | 208 | |
209 | 209 | private function update_roles( $params ) { |
210 | - global $wp_roles; |
|
210 | + global $wp_roles; |
|
211 | 211 | |
212 | - $frm_roles = FrmAppHelper::frm_capabilities(); |
|
213 | - $roles = get_editable_roles(); |
|
214 | - foreach ( $frm_roles as $frm_role => $frm_role_description ) { |
|
215 | - $this->$frm_role = (array) ( isset( $params[ $frm_role ] ) ? $params[ $frm_role ] : 'administrator' ); |
|
212 | + $frm_roles = FrmAppHelper::frm_capabilities(); |
|
213 | + $roles = get_editable_roles(); |
|
214 | + foreach ( $frm_roles as $frm_role => $frm_role_description ) { |
|
215 | + $this->$frm_role = (array) ( isset( $params[ $frm_role ] ) ? $params[ $frm_role ] : 'administrator' ); |
|
216 | 216 | |
217 | - // Make sure administrators always have permissions |
|
218 | - if ( ! in_array( 'administrator', $this->$frm_role ) ) { |
|
217 | + // Make sure administrators always have permissions |
|
218 | + if ( ! in_array( 'administrator', $this->$frm_role ) ) { |
|
219 | 219 | array_push( $this->$frm_role, 'administrator' ); |
220 | - } |
|
220 | + } |
|
221 | 221 | |
222 | - foreach ( $roles as $role => $details ) { |
|
223 | - if ( in_array($role, $this->$frm_role) ) { |
|
224 | - $wp_roles->add_cap( $role, $frm_role ); |
|
225 | - } else { |
|
226 | - $wp_roles->remove_cap( $role, $frm_role ); |
|
227 | - } |
|
228 | - } |
|
222 | + foreach ( $roles as $role => $details ) { |
|
223 | + if ( in_array($role, $this->$frm_role) ) { |
|
224 | + $wp_roles->add_cap( $role, $frm_role ); |
|
225 | + } else { |
|
226 | + $wp_roles->remove_cap( $role, $frm_role ); |
|
227 | + } |
|
228 | + } |
|
229 | 229 | } |
230 | - } |
|
230 | + } |
|
231 | 231 | |
232 | 232 | public function store() { |
233 | - // Save the posted value in the database |
|
233 | + // Save the posted value in the database |
|
234 | 234 | |
235 | - update_option('frm_options', $this); |
|
235 | + update_option('frm_options', $this); |
|
236 | 236 | |
237 | - delete_transient('frm_options'); |
|
238 | - set_transient('frm_options', $this); |
|
237 | + delete_transient('frm_options'); |
|
238 | + set_transient('frm_options', $this); |
|
239 | 239 | |
240 | - do_action( 'frm_store_settings' ); |
|
241 | - } |
|
240 | + do_action( 'frm_store_settings' ); |
|
241 | + } |
|
242 | 242 | } |
@@ -2,26 +2,26 @@ discard block |
||
2 | 2 | |
3 | 3 | class FrmSettingsController { |
4 | 4 | |
5 | - public static function menu() { |
|
5 | + public static function menu() { |
|
6 | 6 | // Make sure admins can see the menu items |
7 | 7 | FrmAppHelper::force_capability( 'frm_change_settings' ); |
8 | 8 | |
9 | - add_submenu_page( 'formidable', 'Formidable | ' . __( 'Global Settings', 'formidable' ), __( 'Global Settings', 'formidable' ), 'frm_change_settings', 'formidable-settings', 'FrmSettingsController::route' ); |
|
10 | - } |
|
9 | + add_submenu_page( 'formidable', 'Formidable | ' . __( 'Global Settings', 'formidable' ), __( 'Global Settings', 'formidable' ), 'frm_change_settings', 'formidable-settings', 'FrmSettingsController::route' ); |
|
10 | + } |
|
11 | 11 | |
12 | - public static function license_box() { |
|
12 | + public static function license_box() { |
|
13 | 13 | $a = FrmAppHelper::simple_get( 't', 'sanitize_title', 'general_settings' ); |
14 | - include( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/license_box.php' ); |
|
15 | - } |
|
14 | + include( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/license_box.php' ); |
|
15 | + } |
|
16 | 16 | |
17 | - public static function display_form( $errors = array(), $message = '' ) { |
|
18 | - global $frm_vars; |
|
17 | + public static function display_form( $errors = array(), $message = '' ) { |
|
18 | + global $frm_vars; |
|
19 | 19 | |
20 | - $frm_settings = FrmAppHelper::get_settings(); |
|
21 | - $frm_roles = FrmAppHelper::frm_capabilities(); |
|
20 | + $frm_settings = FrmAppHelper::get_settings(); |
|
21 | + $frm_roles = FrmAppHelper::frm_capabilities(); |
|
22 | 22 | |
23 | - $uploads = wp_upload_dir(); |
|
24 | - $target_path = $uploads['basedir'] . '/formidable/css'; |
|
23 | + $uploads = wp_upload_dir(); |
|
24 | + $target_path = $uploads['basedir'] . '/formidable/css'; |
|
25 | 25 | |
26 | 26 | $sections = array(); |
27 | 27 | if ( apply_filters( 'frm_include_addon_page', false ) ) { |
@@ -30,54 +30,54 @@ discard block |
||
30 | 30 | 'name' => __( 'Plugin Licenses', 'formidable' ), |
31 | 31 | ); |
32 | 32 | } |
33 | - $sections = apply_filters( 'frm_add_settings_section', $sections ); |
|
33 | + $sections = apply_filters( 'frm_add_settings_section', $sections ); |
|
34 | 34 | |
35 | - $captcha_lang = FrmAppHelper::locales( 'captcha' ); |
|
35 | + $captcha_lang = FrmAppHelper::locales( 'captcha' ); |
|
36 | 36 | |
37 | - require( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/form.php' ); |
|
38 | - } |
|
37 | + require( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/form.php' ); |
|
38 | + } |
|
39 | 39 | |
40 | - public static function process_form( $stop_load = false ) { |
|
41 | - global $frm_vars; |
|
40 | + public static function process_form( $stop_load = false ) { |
|
41 | + global $frm_vars; |
|
42 | 42 | |
43 | - $frm_settings = FrmAppHelper::get_settings(); |
|
43 | + $frm_settings = FrmAppHelper::get_settings(); |
|
44 | 44 | |
45 | 45 | $process_form = FrmAppHelper::get_post_param( 'process_form', '', 'sanitize_text_field' ); |
46 | 46 | if ( ! wp_verify_nonce( $process_form, 'process_form_nonce' ) ) { |
47 | - wp_die( $frm_settings->admin_permission ); |
|
48 | - } |
|
47 | + wp_die( $frm_settings->admin_permission ); |
|
48 | + } |
|
49 | 49 | |
50 | - $errors = array(); |
|
51 | - $message = ''; |
|
50 | + $errors = array(); |
|
51 | + $message = ''; |
|
52 | 52 | |
53 | - if ( ! isset( $frm_vars['settings_routed'] ) || ! $frm_vars['settings_routed'] ) { |
|
54 | - $errors = $frm_settings->validate( $_POST, array() ); |
|
53 | + if ( ! isset( $frm_vars['settings_routed'] ) || ! $frm_vars['settings_routed'] ) { |
|
54 | + $errors = $frm_settings->validate( $_POST, array() ); |
|
55 | 55 | |
56 | - $frm_settings->update( stripslashes_deep( $_POST ) ); |
|
56 | + $frm_settings->update( stripslashes_deep( $_POST ) ); |
|
57 | 57 | |
58 | - if ( empty( $errors ) ) { |
|
59 | - $frm_settings->store(); |
|
60 | - $message = __( 'Settings Saved', 'formidable' ); |
|
61 | - } |
|
62 | - } else { |
|
63 | - $message = __( 'Settings Saved', 'formidable' ); |
|
64 | - } |
|
58 | + if ( empty( $errors ) ) { |
|
59 | + $frm_settings->store(); |
|
60 | + $message = __( 'Settings Saved', 'formidable' ); |
|
61 | + } |
|
62 | + } else { |
|
63 | + $message = __( 'Settings Saved', 'formidable' ); |
|
64 | + } |
|
65 | 65 | |
66 | 66 | if ( $stop_load == 'stop_load' ) { |
67 | - $frm_vars['settings_routed'] = true; |
|
68 | - return; |
|
69 | - } |
|
67 | + $frm_vars['settings_routed'] = true; |
|
68 | + return; |
|
69 | + } |
|
70 | 70 | |
71 | - self::display_form( $errors, $message ); |
|
72 | - } |
|
71 | + self::display_form( $errors, $message ); |
|
72 | + } |
|
73 | 73 | |
74 | - public static function route( $stop_load = false ) { |
|
75 | - $action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action'; |
|
74 | + public static function route( $stop_load = false ) { |
|
75 | + $action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action'; |
|
76 | 76 | $action = FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' ); |
77 | - if ( $action == 'process-form' ) { |
|
77 | + if ( $action == 'process-form' ) { |
|
78 | 78 | self::process_form( $stop_load ); |
79 | - } else if ( $stop_load != 'stop_load' ) { |
|
79 | + } else if ( $stop_load != 'stop_load' ) { |
|
80 | 80 | self::display_form(); |
81 | - } |
|
82 | - } |
|
81 | + } |
|
82 | + } |
|
83 | 83 | } |