PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.0
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.0
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 +56 -214 6.266.0 View file →
@@ -4,20 +4,8 @@
4 4 }
5 5
6 6 class FrmSettingsController {
7 7
8 - /**
9 - * Payments sections are removed from the top level and added to a payments section.
10 - *
11 - * @since 6.22.1
12 - *
13 - * @var array
14 - */
15 - private static $removed_payments_sections = array();
16 -
17 - /**
18 - * @return void
19 - */
20 8 public static function menu() {
21 9 // Make sure admins can see the menu items
22 10 FrmAppHelper::force_capability( 'frm_change_settings' );
23 11
@@ -23,26 +11,13 @@
23 11
24 12 add_submenu_page( 'formidable', 'Formidable | ' . __( 'Global Settings', 'formidable' ), __( 'Global Settings', 'formidable' ), 'frm_change_settings', 'formidable-settings', 'FrmSettingsController::route' );
25 13 }
26 14
27 - /**
28 - * Include license box template on demand.
29 - *
30 - * @return void
31 - */
32 15 public static function license_box() {
33 - if ( ! current_user_can( 'activate_plugins' ) ) {
34 - return;
35 - }
36 - include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/license_box.php';
16 + $a = FrmAppHelper::simple_get( 't', 'sanitize_title', 'general_settings' );
17 + include( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/license_box.php' );
37 18 }
38 19
39 - /**
40 - * @param array $errors
41 - * @param string $message
42 - *
43 - * @return void
44 - */
45 20 public static function display_form( $errors = array(), $message = '' ) {
46 21 global $frm_vars;
47 22
48 23 $frm_settings = FrmAppHelper::get_settings();
@@ -52,13 +27,9 @@
52 27
53 28 $sections = self::get_settings_tabs();
54 29 $current = FrmAppHelper::simple_get( 't', 'sanitize_title', 'general_settings' );
55 30
56 - if ( in_array( $current, array( 'stripe_settings', 'square_settings', 'authorize_net_settings', 'paypal_settings' ), true ) ) {
57 - $current = 'payments_settings';
58 - }
59 -
60 - require FrmAppHelper::plugin_path() . '/classes/views/frm-settings/form.php';
31 + require( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/form.php' );
61 32 }
62 33
63 34 /**
64 35 * Get sections to use for Global Settings.
@@ -66,33 +37,27 @@
66 37 * @return array<array>
67 38 */
68 39 private static function get_settings_tabs() {
69 40 $sections = array(
70 - 'general' => array(
71 - 'class' => self::class,
41 + 'general' => array(
42 + 'class' => __CLASS__,
72 43 'function' => 'general_settings',
73 44 'name' => __( 'General Settings', 'formidable' ),
74 45 'icon' => 'frm_icon_font frm_settings_icon',
75 46 ),
76 - 'messages' => array(
77 - 'class' => self::class,
47 + 'messages' => array(
48 + 'class' => __CLASS__,
78 49 'function' => 'message_settings',
79 50 'name' => __( 'Message Defaults', 'formidable' ),
80 51 'icon' => 'frm_icon_font frm_stamp_icon',
81 52 ),
82 - 'permissions' => array(
83 - 'class' => self::class,
53 + 'permissions' => array(
54 + 'class' => __CLASS__,
84 55 'function' => 'permission_settings',
85 56 'name' => __( 'Permissions', 'formidable' ),
86 57 'icon' => 'frm_icon_font frm_lock_icon',
87 58 ),
88 - 'payments' => array(
89 - 'name' => __( 'Payments', 'formidable' ),
90 - 'icon' => 'frm_icon_font frm_simple_cc_icon',
91 - 'class' => self::class,
92 - 'function' => 'payments_settings',
93 - ),
94 - 'custom_css' => array(
59 + 'custom_css' => array(
95 60 'class' => 'FrmStylesController',
96 61 'function' => 'custom_css',
97 62 'name' => __( 'Custom CSS', 'formidable' ),
98 63 'icon' => 'frm_icon_font frm_code_icon',
@@ -102,21 +67,15 @@
102 67 'function' => 'manage',
103 68 'name' => __( 'Manage Styles', 'formidable' ),
104 69 'icon' => 'frm_icon_font frm_pallet_icon',
105 70 ),
106 - 'captcha' => array(
107 - 'class' => self::class,
71 + 'captcha' => array(
72 + 'class' => __CLASS__,
108 73 'function' => 'captcha_settings',
109 - 'name' => __( 'Captcha/Spam', 'formidable' ),
74 + 'name' => __( 'Captcha', 'formidable' ),
110 75 'icon' => 'frm_icon_font frm_shield_check_icon',
111 76 ),
112 - 'email' => array(
113 - 'class' => self::class,
114 - 'function' => 'email_settings',
115 - 'name' => __( 'Email', 'formidable' ),
116 - 'icon' => 'frm_icon_font frm_email_icon',
117 - ),
118 - 'white_label' => array(
77 + 'white_label' => array(
119 78 'name' => __( 'White Labeling', 'formidable' ),
120 79 'icon' => 'frm_icon_font frm_ghost_icon',
121 80 'html_class' => 'frm_show_upgrade_tab frm_noallow',
122 81 'data' => array(
@@ -122,12 +81,11 @@
122 81 'data' => array(
123 82 'medium' => 'white-label',
124 83 'upgrade' => __( 'White labeling options', 'formidable' ),
125 84 'screenshot' => 'white-label.png',
126 - 'learn-more' => FrmAppHelper::get_doc_url( 'features/white-label-form-builder-wordpress', 'white-labeling-global-settings', false ),
127 85 ),
128 86 ),
129 - 'inbox' => array(
87 + 'inbox' => array(
130 88 'name' => __( 'Inbox', 'formidable' ),
131 89 'icon' => 'frm_icon_font frm_email_icon',
132 90 'html_class' => 'frm_show_upgrade_tab frm_noallow',
133 91 'data' => array(
@@ -133,9 +91,8 @@
133 91 'data' => array(
134 92 'medium' => 'inbox-settings',
135 93 'upgrade' => __( 'Inbox settings', 'formidable' ),
136 94 'screenshot' => 'inbox.png',
137 - 'learn-more' => FrmAppHelper::get_doc_url( 'global-settings-overview/#kb-inbox', 'inbox-global-settings' ),
138 95 ),
139 96 ),
140 97 );
141 98
@@ -142,9 +99,8 @@
142 99 if ( apply_filters( 'frm_include_addon_page', false ) ) {
143 100 // If no addons need a license, skip this page
144 101 $show_licenses = false;
145 102 $installed_addons = apply_filters( 'frm_installed_addons', array() );
146 -
147 103 foreach ( $installed_addons as $installed_addon ) {
148 104 if ( ! $installed_addon->is_parent_licence && $installed_addon->plugin_name != 'Formidable Pro' && $installed_addon->needs_license ) {
149 105 $show_licenses = true;
150 106 break;
@@ -155,24 +111,23 @@
155 111 $sections['licenses'] = array(
156 112 'class' => 'FrmAddonsController',
157 113 'function' => 'license_settings',
158 114 'name' => __( 'Plugin Licenses', 'formidable' ),
159 - 'icon' => 'frmfont frm_key_icon',
115 + 'icon' => 'frm_icon_font frm_keyalt_icon',
160 116 'ajax' => true,
161 117 );
162 118 }
163 - }//end if
119 + }
164 120
165 121 /**
166 122 * @param array<array> $sections
167 123 */
168 124 $sections = apply_filters( 'frm_add_settings_section', $sections );
169 - self::remove_payments_sections( $sections );
170 125
171 126 $sections['misc'] = array(
172 127 'name' => __( 'Miscellaneous', 'formidable' ),
173 128 'icon' => 'frm_icon_font frm_shuffle_icon',
174 - 'class' => self::class,
129 + 'class' => __CLASS__,
175 130 'function' => 'misc_settings',
176 131 );
177 132
178 133 foreach ( $sections as $key => $section ) {
@@ -196,57 +151,13 @@
196 151 $section['function'] = $original;
197 152 }
198 153
199 154 $sections[ $key ] = $section;
200 - }//end foreach
155 + }
201 156
202 157 return $sections;
203 158 }
204 159
205 - /**
206 - * Remove the payments sections (PayPal, Square, Stripe, Authorize.Net)
207 - * and show them all on the payments section in separate tabs.
208 - *
209 - * @since 6.22.1
210 - *
211 - * @param array $sections
212 - *
213 - * @return void
214 - */
215 - private static function remove_payments_sections( &$sections ) {
216 - $payment_section_keys = array( 'paypal', 'square', 'stripe', 'authorize_net' );
217 -
218 - foreach ( $sections as $key => $section ) {
219 - if ( in_array( $key, $payment_section_keys, true ) ) {
220 - self::$removed_payments_sections[ $key ] = $section;
221 - unset( $sections[ $key ] );
222 - }
223 - }
224 -
225 - uksort( self::$removed_payments_sections, array( self::class, 'payment_sections_sort_callback' ) );
226 - }
227 -
228 - /**
229 - * Sort the payments sections (PayPal, Square, Stripe, Authorize.Net)
230 - *
231 - * @since 6.22.1
232 - *
233 - * @param string $a
234 - * @param string $b
235 - *
236 - * @return int
237 - */
238 - private static function payment_sections_sort_callback( $a, $b ) {
239 - $order = array( 'stripe', 'square', 'paypal', 'authorize_net' );
240 - $first_key = array_search( $a, $order );
241 - $second_key = array_search( $b, $order );
242 -
243 - if ( false === $first_key || false === $second_key ) {
244 - return 0;
245 - }
246 - return $first_key - $second_key;
247 - }
248 -
249 160 public static function load_settings_tab() {
250 161 FrmAppHelper::permission_check( 'frm_change_settings' );
251 162 check_ajax_referer( 'frm_ajax', 'nonce' );
252 163
@@ -251,9 +162,8 @@
251 162 check_ajax_referer( 'frm_ajax', 'nonce' );
252 163
253 164 $section = FrmAppHelper::get_post_param( 'tab', '', 'sanitize_text_field' );
254 165 $sections = self::get_settings_tabs();
255 -
256 166 if ( ! isset( $sections[ $section ] ) ) {
257 167 wp_die();
258 168 }
259 169
@@ -261,126 +171,67 @@
261 171
262 172 if ( isset( $section['class'] ) ) {
263 173 call_user_func( array( $section['class'], $section['function'] ) );
264 174 } else {
265 - call_user_func( ( $section['function'] ?? $section ) );
175 + call_user_func( ( isset( $section['function'] ) ? $section['function'] : $section ) );
266 176 }
267 177 wp_die();
268 178 }
269 179
270 180 /**
271 - * Render the general global settings section.
272 - *
273 181 * @since 4.0
274 - *
275 - * @return void
276 182 */
277 183 public static function general_settings() {
278 184 $frm_settings = FrmAppHelper::get_settings();
279 - $uploads = wp_upload_dir();
280 - $target_path = $uploads['basedir'] . '/formidable/css';
281 185
282 - include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/general.php';
283 - }
186 + $uploads = wp_upload_dir();
187 + $target_path = $uploads['basedir'] . '/formidable/css';
284 188
285 - /**
286 - * Render the global currency selector if Pro is up to date.
287 - *
288 - * @param FrmSettings $frm_settings
289 - * @param string $more_html
290 - *
291 - * @return void
292 - */
293 - public static function maybe_render_currency_selector( $frm_settings, $more_html ) {
294 - if ( is_callable( 'FrmProSettingsController::add_currency_settings' ) ) {
295 - FrmProSettingsController::add_currency_settings();
296 - return;
297 - }
298 -
299 - $currencies = FrmCurrencyHelper::get_currencies();
300 - include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/_currency.php';
189 + include( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/general.php' );
301 190 }
302 191
303 192 /**
304 193 * @since 4.0
305 - *
306 - * @return void
307 194 */
308 195 public static function message_settings() {
309 196 $frm_settings = FrmAppHelper::get_settings();
310 197
311 - include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/messages.php';
198 + include( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/messages.php' );
312 199 }
313 200
314 201 /**
315 202 * @since 4.0
316 - *
317 - * @return void
318 203 */
319 204 public static function captcha_settings() {
320 205 $frm_settings = FrmAppHelper::get_settings();
321 206 $captcha_lang = FrmAppHelper::locales( 'captcha' );
322 207
323 - include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/captcha/captcha.php';
208 + include( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/captcha/captcha.php' );
324 209 }
325 210
326 211 /**
327 - * Shows email settings.
328 - *
329 - * @since 6.25
330 - *
331 - * @return void
332 - */
333 - public static function email_settings() {
334 - $frm_settings = FrmAppHelper::get_settings();
335 -
336 - include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/email/email-styles.php';
337 - }
338 -
339 - /**
340 212 * @since 4.0
341 - *
342 - * @return void
343 213 */
344 214 public static function permission_settings() {
345 215 $frm_settings = FrmAppHelper::get_settings();
346 216 $frm_roles = FrmAppHelper::frm_capabilities();
347 217
348 - include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/permissions.php';
218 + include( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/permissions.php' );
349 219 }
350 220
351 221 /**
352 - * @return void
353 - */
354 - public static function payments_settings() {
355 - $payment_sections = self::$removed_payments_sections;
356 -
357 - $tab = FrmAppHelper::simple_get( 't', 'sanitize_title', 'general_settings' );
358 -
359 - if ( $tab && in_array( $tab, array( 'stripe_settings', 'square_settings', 'authorize_net_settings', 'paypal_settings' ), true ) ) {
360 - $tab = str_replace( '_settings', '', $tab );
361 - } else {
362 - $tab = 'stripe';
363 - }
364 -
365 - include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/payments.php';
366 - }
367 -
368 - /**
369 222 * @since 4.0
370 - *
371 - * @return void
372 223 */
373 224 public static function misc_settings() {
374 225 $frm_settings = FrmAppHelper::get_settings();
375 226
376 - include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/misc.php';
227 + include( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/misc.php' );
377 228 }
378 229
379 230 /**
380 231 * Save form data submitted from the Global settings page.
381 232 *
382 - * @param bool|string $stop_load
233 + * @param string|bool $stop_load
383 234 *
384 235 * @return void
385 236 */
386 237 public static function process_form( $stop_load = false ) {
@@ -389,15 +240,9 @@
389 240 $frm_settings = FrmAppHelper::get_settings();
390 241 $process_form = FrmAppHelper::get_post_param( 'process_form', '', 'sanitize_text_field' );
391 242
392 243 if ( ! wp_verify_nonce( $process_form, 'process_form_nonce' ) ) {
393 - $error_args = array(
394 - 'title' => __( 'Verification failed', 'formidable' ),
395 - 'body' => $frm_settings->admin_permission,
396 - 'cancel_text' => __( 'Cancel', 'formidable' ),
397 - );
398 - FrmAppController::show_error_modal( $error_args );
399 - return;
244 + wp_die( esc_html( $frm_settings->admin_permission ) );
400 245 }
401 246
402 247 $errors = array();
403 248 $message = '';
@@ -426,10 +271,8 @@
426 271 /**
427 272 * Include the Update button on the global settings page.
428 273 *
429 274 * @since 4.0.02
430 - *
431 - * @return void
432 275 */
433 276 public static function save_button() {
434 277 echo '<input class="button-primary frm-button-primary" type="submit"
435 278 value="' . esc_attr__( 'Update', 'formidable' ) . '"/>';
@@ -434,19 +277,14 @@
434 277 echo '<input class="button-primary frm-button-primary" type="submit"
435 278 value="' . esc_attr__( 'Update', 'formidable' ) . '"/>';
436 279 }
437 280
438 - /**
439 - * @param bool|string $stop_load
440 - *
441 - * @return void
442 - */
443 281 public static function route( $stop_load = false ) {
444 282 $action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action';
445 283 $action = FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' );
446 284 FrmAppHelper::include_svg();
447 285
448 - if ( $action === 'process-form' ) {
286 + if ( $action == 'process-form' ) {
449 287 self::process_form( $stop_load );
450 288 } elseif ( $stop_load != 'stop_load' ) {
451 289 self::display_form();
452 290 }
@@ -455,17 +293,34 @@
455 293 /**
456 294 * Add CTA to the bottom on the plugin settings pages.
457 295 *
458 296 * @since 3.04.02
459 - *
460 - * @return void
461 297 */
462 - public static function settings_cta() {
298 + public static function settings_cta( $view ) {
299 +
463 300 if ( get_option( 'frm_lite_settings_upgrade', false ) ) {
464 301 return;
465 302 }
466 303
467 - include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/settings_cta.php';
304 + $features = array(
305 + __( 'Extra form features like file uploads, pagination, etc', 'formidable' ),
306 + __( 'Repeaters & cascading fields for advanced forms', 'formidable' ),
307 + __( 'Flexibly view, search, edit, and delete entries anywhere', 'formidable' ),
308 + __( 'Display entries with virtually limitless Formidable views', 'formidable' ),
309 + __( 'Create surveys & polls', 'formidable' ),
310 + __( 'WordPress user registration and login forms', 'formidable' ),
311 + __( 'Create Stripe, PayPal or Authorize.net payment forms', 'formidable' ),
312 + __( 'Powerful conditional logic for smart forms', 'formidable' ),
313 + __( 'Integrations with 1000+ marketing & payment services', 'formidable' ),
314 + __( 'Collect digital signatures', 'formidable' ),
315 + __( 'Accept user-submitted content with Post submissions', 'formidable' ),
316 + __( 'Email routing', 'formidable' ),
317 + __( 'Create calculator forms', 'formidable' ),
318 + __( 'Save draft entries and return later', 'formidable' ),
319 + __( 'Analyze form data with graphs & stats', 'formidable' ),
320 + );
321 +
322 + include( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/settings_cta.php' );
468 323 }
469 324
470 325 /**
471 326 * Dismiss upgrade notice at the bottom on the plugin settings pages.
@@ -472,9 +327,8 @@
472 327 *
473 328 * @since 3.04.02
474 329 */
475 330 public static function settings_cta_dismiss() {
476 - check_ajax_referer( 'frm_ajax', 'nonce' );
477 331 FrmAppHelper::permission_check( 'frm_change_settings' );
478 332
479 333 update_option( 'frm_lite_settings_upgrade', time(), 'no' );
480 334
@@ -491,9 +345,9 @@
491 345 check_ajax_referer( 'frm_ajax', 'nonce' );
492 346
493 347 global $wpdb;
494 348
495 - $term = FrmAppHelper::get_param( 'term', '', 'get', 'sanitize_text_field' );
349 + $term = FrmAppHelper::get_param( 'term', '', 'get', 'sanitize_text_field' );
496 350 $post_type = FrmAppHelper::get_param( 'post_type', 'page', 'get', 'sanitize_text_field' );
497 351
498 352 $where = array(
499 353 'post_status' => 'publish',
@@ -508,9 +362,8 @@
508 362
509 363 $pages = FrmDb::get_results( $wpdb->posts, $where, 'ID, post_title', $atts );
510 364
511 365 $results = array();
512 -
513 366 foreach ( $pages as $page ) {
514 367 $results[] = array(
515 368 'value' => $page->ID,
516 369 'label' => $page->post_title,
@@ -520,22 +373,11 @@
520 373 wp_send_json( $results );
521 374 }
522 375
523 376 /**
524 - * Shows a fake color picker.
525 - *
526 - * @since 6.25
527 - *
528 - * @param string $color Color value.
529 - *
530 - * @return void
377 + * @deprecated x.x use FrmSettingsController::captcha_settings().
531 378 */
532 - public static function fake_color_picker( $color ) {
533 - ?>
534 - <div class="wp-picker-container">
535 - <button type="button" class="button wp-color-result" aria-expanded="false" aria-disabled="true" tabindex="-1" style="background-color:<?php echo esc_attr( $color ); ?>;">
536 - <span class="wp-color-result-text" style="color:#a7aaad;"><?php esc_html_e( 'Select Color', 'formidable' ); ?></span>
537 - </button>
538 - </div>
539 - <?php
379 + public static function recaptcha_settings() {
380 + _deprecated_function( __FUNCTION__, 'x.x', 'FrmSettingsController::captcha_settings()' );
381 + self::captcha_settings();
540 382 }
541 383 }