PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.14
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.14
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
← All changes | classes/controllers/FrmSettingsController.php +60 -33 6.36.14 View file →
@@ -11,11 +11,18 @@
11 11
12 12 add_submenu_page( 'formidable', 'Formidable | ' . __( 'Global Settings', 'formidable' ), __( 'Global Settings', 'formidable' ), 'frm_change_settings', 'formidable-settings', 'FrmSettingsController::route' );
13 13 }
14 14
15 + /**
16 + * Include license box template on demand.
17 + *
18 + * @return void
19 + */
15 20 public static function license_box() {
16 - $a = FrmAppHelper::simple_get( 't', 'sanitize_title', 'general_settings' );
17 - include( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/license_box.php' );
21 + if ( ! current_user_can( 'activate_plugins' ) ) {
22 + return;
23 + }
24 + include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/license_box.php';
18 25 }
19 26
20 27 public static function display_form( $errors = array(), $message = '' ) {
21 28 global $frm_vars;
@@ -27,9 +34,9 @@
27 34
28 35 $sections = self::get_settings_tabs();
29 36 $current = FrmAppHelper::simple_get( 't', 'sanitize_title', 'general_settings' );
30 37
31 - require( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/form.php' );
38 + require FrmAppHelper::plugin_path() . '/classes/views/frm-settings/form.php';
32 39 }
33 40
34 41 /**
35 42 * Get sections to use for Global Settings.
@@ -37,27 +44,27 @@
37 44 * @return array<array>
38 45 */
39 46 private static function get_settings_tabs() {
40 47 $sections = array(
41 - 'general' => array(
48 + 'general' => array(
42 49 'class' => __CLASS__,
43 50 'function' => 'general_settings',
44 51 'name' => __( 'General Settings', 'formidable' ),
45 52 'icon' => 'frm_icon_font frm_settings_icon',
46 53 ),
47 - 'messages' => array(
54 + 'messages' => array(
48 55 'class' => __CLASS__,
49 56 'function' => 'message_settings',
50 57 'name' => __( 'Message Defaults', 'formidable' ),
51 58 'icon' => 'frm_icon_font frm_stamp_icon',
52 59 ),
53 - 'permissions' => array(
60 + 'permissions' => array(
54 61 'class' => __CLASS__,
55 62 'function' => 'permission_settings',
56 63 'name' => __( 'Permissions', 'formidable' ),
57 64 'icon' => 'frm_icon_font frm_lock_icon',
58 65 ),
59 - 'custom_css' => array(
66 + 'custom_css' => array(
60 67 'class' => 'FrmStylesController',
61 68 'function' => 'custom_css',
62 69 'name' => __( 'Custom CSS', 'formidable' ),
63 70 'icon' => 'frm_icon_font frm_code_icon',
@@ -67,15 +74,15 @@
67 74 'function' => 'manage',
68 75 'name' => __( 'Manage Styles', 'formidable' ),
69 76 'icon' => 'frm_icon_font frm_pallet_icon',
70 77 ),
71 - 'captcha' => array(
78 + 'captcha' => array(
72 79 'class' => __CLASS__,
73 80 'function' => 'captcha_settings',
74 81 'name' => __( 'Captcha', 'formidable' ),
75 82 'icon' => 'frm_icon_font frm_shield_check_icon',
76 83 ),
77 - 'white_label' => array(
84 + 'white_label' => array(
78 85 'name' => __( 'White Labeling', 'formidable' ),
79 86 'icon' => 'frm_icon_font frm_ghost_icon',
80 87 'html_class' => 'frm_show_upgrade_tab frm_noallow',
81 88 'data' => array(
@@ -83,9 +90,9 @@
83 90 'upgrade' => __( 'White labeling options', 'formidable' ),
84 91 'screenshot' => 'white-label.png',
85 92 ),
86 93 ),
87 - 'inbox' => array(
94 + 'inbox' => array(
88 95 'name' => __( 'Inbox', 'formidable' ),
89 96 'icon' => 'frm_icon_font frm_email_icon',
90 97 'html_class' => 'frm_show_upgrade_tab frm_noallow',
91 98 'data' => array(
@@ -111,13 +118,13 @@
111 118 $sections['licenses'] = array(
112 119 'class' => 'FrmAddonsController',
113 120 'function' => 'license_settings',
114 121 'name' => __( 'Plugin Licenses', 'formidable' ),
115 - 'icon' => 'frm_icon_font frm_keyalt_icon',
122 + 'icon' => 'frmfont frm_key_icon',
116 123 'ajax' => true,
117 124 );
118 125 }
119 - }
126 + }//end if
120 127
121 128 /**
122 129 * @param array<array> $sections
123 130 */
@@ -151,9 +158,9 @@
151 158 $section['function'] = $original;
152 159 }
153 160
154 161 $sections[ $key ] = $section;
155 - }
162 + }//end foreach
156 163
157 164 return $sections;
158 165 }
159 166
@@ -177,17 +184,38 @@
177 184 wp_die();
178 185 }
179 186
180 187 /**
188 + * Render the general global settings section.
189 + *
181 190 * @since 4.0
191 + *
192 + * @return void
182 193 */
183 194 public static function general_settings() {
184 195 $frm_settings = FrmAppHelper::get_settings();
196 + $uploads = wp_upload_dir();
197 + $target_path = $uploads['basedir'] . '/formidable/css';
185 198
186 - $uploads = wp_upload_dir();
187 - $target_path = $uploads['basedir'] . '/formidable/css';
199 + include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/general.php';
200 + }
188 201
189 - include( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/general.php' );
202 + /**
203 + * Render the global currency selector if Pro is up to date.
204 + *
205 + * @param FrmSettings $frm_settings
206 + * @param string $more_html
207 + * @return void
208 + */
209 + public static function maybe_render_currency_selector( $frm_settings, $more_html ) {
210 + if ( false !== strpos( $more_html, 'id="frm_currency"' ) ) {
211 + // Avoid rendering the Currency setting if it gets rendered from the frm_settings_form hook.
212 + // This is for backward compatibility. If Pro is outdated there won't be two currency dropdowns.
213 + return;
214 + }
215 +
216 + $currencies = FrmCurrencyHelper::get_currencies();
217 + include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/_currency.php';
190 218 }
191 219
192 220 /**
193 221 * @since 4.0
@@ -194,9 +222,9 @@
194 222 */
195 223 public static function message_settings() {
196 224 $frm_settings = FrmAppHelper::get_settings();
197 225
198 - include( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/messages.php' );
226 + include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/messages.php';
199 227 }
200 228
201 229 /**
202 230 * @since 4.0
@@ -204,9 +232,9 @@
204 232 public static function captcha_settings() {
205 233 $frm_settings = FrmAppHelper::get_settings();
206 234 $captcha_lang = FrmAppHelper::locales( 'captcha' );
207 235
208 - include( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/captcha/captcha.php' );
236 + include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/captcha/captcha.php';
209 237 }
210 238
211 239 /**
212 240 * @since 4.0
@@ -214,9 +242,9 @@
214 242 public static function permission_settings() {
215 243 $frm_settings = FrmAppHelper::get_settings();
216 244 $frm_roles = FrmAppHelper::frm_capabilities();
217 245
218 - include( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/permissions.php' );
246 + include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/permissions.php';
219 247 }
220 248
221 249 /**
222 250 * @since 4.0
@@ -223,15 +251,15 @@
223 251 */
224 252 public static function misc_settings() {
225 253 $frm_settings = FrmAppHelper::get_settings();
226 254
227 - include( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/misc.php' );
255 + include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/misc.php';
228 256 }
229 257
230 258 /**
231 259 * Save form data submitted from the Global settings page.
232 260 *
233 - * @param string|bool $stop_load
261 + * @param bool|string $stop_load
234 262 *
235 263 * @return void
236 264 */
237 265 public static function process_form( $stop_load = false ) {
@@ -240,9 +268,15 @@
240 268 $frm_settings = FrmAppHelper::get_settings();
241 269 $process_form = FrmAppHelper::get_post_param( 'process_form', '', 'sanitize_text_field' );
242 270
243 271 if ( ! wp_verify_nonce( $process_form, 'process_form_nonce' ) ) {
244 - wp_die( esc_html( $frm_settings->admin_permission ) );
272 + $error_args = array(
273 + 'title' => __( 'Verification failed', 'formidable' ),
274 + 'body' => $frm_settings->admin_permission,
275 + 'cancel_text' => __( 'Cancel', 'formidable' ),
276 + );
277 + FrmAppController::show_error_modal( $error_args );
278 + return;
245 279 }
246 280
247 281 $errors = array();
248 282 $message = '';
@@ -282,9 +316,9 @@
282 316 $action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action';
283 317 $action = FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' );
284 318 FrmAppHelper::include_svg();
285 319
286 - if ( $action == 'process-form' ) {
320 + if ( $action === 'process-form' ) {
287 321 self::process_form( $stop_load );
288 322 } elseif ( $stop_load != 'stop_load' ) {
289 323 self::display_form();
290 324 }
@@ -318,9 +352,9 @@
318 352 __( 'Save draft entries and return later', 'formidable' ),
319 353 __( 'Analyze form data with graphs & stats', 'formidable' ),
320 354 );
321 355
322 - include( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/settings_cta.php' );
356 + include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/settings_cta.php';
323 357 }
324 358
325 359 /**
326 360 * Dismiss upgrade notice at the bottom on the plugin settings pages.
@@ -327,8 +361,9 @@
327 361 *
328 362 * @since 3.04.02
329 363 */
330 364 public static function settings_cta_dismiss() {
365 + check_ajax_referer( 'frm_ajax', 'nonce' );
331 366 FrmAppHelper::permission_check( 'frm_change_settings' );
332 367
333 368 update_option( 'frm_lite_settings_upgrade', time(), 'no' );
334 369
@@ -345,9 +380,9 @@
345 380 check_ajax_referer( 'frm_ajax', 'nonce' );
346 381
347 382 global $wpdb;
348 383
349 - $term = FrmAppHelper::get_param( 'term', '', 'get', 'sanitize_text_field' );
384 + $term = FrmAppHelper::get_param( 'term', '', 'get', 'sanitize_text_field' );
350 385 $post_type = FrmAppHelper::get_param( 'post_type', 'page', 'get', 'sanitize_text_field' );
351 386
352 387 $where = array(
353 388 'post_status' => 'publish',
@@ -370,14 +405,6 @@
370 405 );
371 406 }
372 407
373 408 wp_send_json( $results );
374 - }
375 -
376 - /**
377 - * @deprecated 6.0 use FrmSettingsController::captcha_settings().
378 - */
379 - public static function recaptcha_settings() {
380 - _deprecated_function( __FUNCTION__, '6.0', 'FrmSettingsController::captcha_settings()' );
381 - self::captcha_settings();
382 409 }
383 410 }