PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.13
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.13
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 +30 -161 6.266.13 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
@@ -35,14 +23,8 @@
35 23 }
36 24 include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/license_box.php';
37 25 }
38 26
39 - /**
40 - * @param array $errors
41 - * @param string $message
42 - *
43 - * @return void
44 - */
45 27 public static function display_form( $errors = array(), $message = '' ) {
46 28 global $frm_vars;
47 29
48 30 $frm_settings = FrmAppHelper::get_settings();
@@ -52,12 +34,8 @@
52 34
53 35 $sections = self::get_settings_tabs();
54 36 $current = FrmAppHelper::simple_get( 't', 'sanitize_title', 'general_settings' );
55 37
56 - if ( in_array( $current, array( 'stripe_settings', 'square_settings', 'authorize_net_settings', 'paypal_settings' ), true ) ) {
57 - $current = 'payments_settings';
58 - }
59 -
60 38 require FrmAppHelper::plugin_path() . '/classes/views/frm-settings/form.php';
61 39 }
62 40
63 41 /**
@@ -67,31 +45,25 @@
67 45 */
68 46 private static function get_settings_tabs() {
69 47 $sections = array(
70 48 'general' => array(
71 - 'class' => self::class,
49 + 'class' => __CLASS__,
72 50 'function' => 'general_settings',
73 51 'name' => __( 'General Settings', 'formidable' ),
74 52 'icon' => 'frm_icon_font frm_settings_icon',
75 53 ),
76 54 'messages' => array(
77 - 'class' => self::class,
55 + 'class' => __CLASS__,
78 56 'function' => 'message_settings',
79 57 'name' => __( 'Message Defaults', 'formidable' ),
80 58 'icon' => 'frm_icon_font frm_stamp_icon',
81 59 ),
82 60 'permissions' => array(
83 - 'class' => self::class,
61 + 'class' => __CLASS__,
84 62 'function' => 'permission_settings',
85 63 'name' => __( 'Permissions', 'formidable' ),
86 64 'icon' => 'frm_icon_font frm_lock_icon',
87 65 ),
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 66 'custom_css' => array(
95 67 'class' => 'FrmStylesController',
96 68 'function' => 'custom_css',
97 69 'name' => __( 'Custom CSS', 'formidable' ),
@@ -103,19 +75,13 @@
103 75 'name' => __( 'Manage Styles', 'formidable' ),
104 76 'icon' => 'frm_icon_font frm_pallet_icon',
105 77 ),
106 78 'captcha' => array(
107 - 'class' => self::class,
79 + 'class' => __CLASS__,
108 80 'function' => 'captcha_settings',
109 - 'name' => __( 'Captcha/Spam', 'formidable' ),
81 + 'name' => __( 'Captcha', 'formidable' ),
110 82 'icon' => 'frm_icon_font frm_shield_check_icon',
111 83 ),
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 84 'white_label' => array(
119 85 'name' => __( 'White Labeling', 'formidable' ),
120 86 'icon' => 'frm_icon_font frm_ghost_icon',
121 87 'html_class' => 'frm_show_upgrade_tab frm_noallow',
@@ -122,9 +88,8 @@
122 88 'data' => array(
123 89 'medium' => 'white-label',
124 90 'upgrade' => __( 'White labeling options', 'formidable' ),
125 91 'screenshot' => 'white-label.png',
126 - 'learn-more' => FrmAppHelper::get_doc_url( 'features/white-label-form-builder-wordpress', 'white-labeling-global-settings', false ),
127 92 ),
128 93 ),
129 94 'inbox' => array(
130 95 'name' => __( 'Inbox', 'formidable' ),
@@ -133,9 +98,8 @@
133 98 'data' => array(
134 99 'medium' => 'inbox-settings',
135 100 'upgrade' => __( 'Inbox settings', 'formidable' ),
136 101 'screenshot' => 'inbox.png',
137 - 'learn-more' => FrmAppHelper::get_doc_url( 'global-settings-overview/#kb-inbox', 'inbox-global-settings' ),
138 102 ),
139 103 ),
140 104 );
141 105
@@ -142,9 +106,8 @@
142 106 if ( apply_filters( 'frm_include_addon_page', false ) ) {
143 107 // If no addons need a license, skip this page
144 108 $show_licenses = false;
145 109 $installed_addons = apply_filters( 'frm_installed_addons', array() );
146 -
147 110 foreach ( $installed_addons as $installed_addon ) {
148 111 if ( ! $installed_addon->is_parent_licence && $installed_addon->plugin_name != 'Formidable Pro' && $installed_addon->needs_license ) {
149 112 $show_licenses = true;
150 113 break;
@@ -165,14 +128,13 @@
165 128 /**
166 129 * @param array<array> $sections
167 130 */
168 131 $sections = apply_filters( 'frm_add_settings_section', $sections );
169 - self::remove_payments_sections( $sections );
170 132
171 133 $sections['misc'] = array(
172 134 'name' => __( 'Miscellaneous', 'formidable' ),
173 135 'icon' => 'frm_icon_font frm_shuffle_icon',
174 - 'class' => self::class,
136 + 'class' => __CLASS__,
175 137 'function' => 'misc_settings',
176 138 );
177 139
178 140 foreach ( $sections as $key => $section ) {
@@ -201,52 +163,8 @@
201 163
202 164 return $sections;
203 165 }
204 166
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 167 public static function load_settings_tab() {
250 168 FrmAppHelper::permission_check( 'frm_change_settings' );
251 169 check_ajax_referer( 'frm_ajax', 'nonce' );
252 170
@@ -251,9 +169,8 @@
251 169 check_ajax_referer( 'frm_ajax', 'nonce' );
252 170
253 171 $section = FrmAppHelper::get_post_param( 'tab', '', 'sanitize_text_field' );
254 172 $sections = self::get_settings_tabs();
255 -
256 173 if ( ! isset( $sections[ $section ] ) ) {
257 174 wp_die();
258 175 }
259 176
@@ -261,9 +178,9 @@
261 178
262 179 if ( isset( $section['class'] ) ) {
263 180 call_user_func( array( $section['class'], $section['function'] ) );
264 181 } else {
265 - call_user_func( ( $section['function'] ?? $section ) );
182 + call_user_func( ( isset( $section['function'] ) ? $section['function'] : $section ) );
266 183 }
267 184 wp_die();
268 185 }
269 186
@@ -286,14 +203,14 @@
286 203 * Render the global currency selector if Pro is up to date.
287 204 *
288 205 * @param FrmSettings $frm_settings
289 206 * @param string $more_html
290 - *
291 207 * @return void
292 208 */
293 209 public static function maybe_render_currency_selector( $frm_settings, $more_html ) {
294 - if ( is_callable( 'FrmProSettingsController::add_currency_settings' ) ) {
295 - FrmProSettingsController::add_currency_settings();
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.
296 213 return;
297 214 }
298 215
299 216 $currencies = FrmCurrencyHelper::get_currencies();
@@ -301,10 +218,8 @@
301 218 }
302 219
303 220 /**
304 221 * @since 4.0
305 - *
306 - * @return void
307 222 */
308 223 public static function message_settings() {
309 224 $frm_settings = FrmAppHelper::get_settings();
310 225
@@ -312,10 +227,8 @@
312 227 }
313 228
314 229 /**
315 230 * @since 4.0
316 - *
317 - * @return void
318 231 */
319 232 public static function captcha_settings() {
320 233 $frm_settings = FrmAppHelper::get_settings();
321 234 $captcha_lang = FrmAppHelper::locales( 'captcha' );
@@ -323,24 +236,9 @@
323 236 include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/captcha/captcha.php';
324 237 }
325 238
326 239 /**
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 240 * @since 4.0
341 - *
342 - * @return void
343 241 */
344 242 public static function permission_settings() {
345 243 $frm_settings = FrmAppHelper::get_settings();
346 244 $frm_roles = FrmAppHelper::frm_capabilities();
@@ -348,28 +246,9 @@
348 246 include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/permissions.php';
349 247 }
350 248
351 249 /**
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 250 * @since 4.0
370 - *
371 - * @return void
372 251 */
373 252 public static function misc_settings() {
374 253 $frm_settings = FrmAppHelper::get_settings();
375 254
@@ -426,10 +305,8 @@
426 305 /**
427 306 * Include the Update button on the global settings page.
428 307 *
429 308 * @since 4.0.02
430 - *
431 - * @return void
432 309 */
433 310 public static function save_button() {
434 311 echo '<input class="button-primary frm-button-primary" type="submit"
435 312 value="' . esc_attr__( 'Update', 'formidable' ) . '"/>';
@@ -434,13 +311,8 @@
434 311 echo '<input class="button-primary frm-button-primary" type="submit"
435 312 value="' . esc_attr__( 'Update', 'formidable' ) . '"/>';
436 313 }
437 314
438 - /**
439 - * @param bool|string $stop_load
440 - *
441 - * @return void
442 - */
443 315 public static function route( $stop_load = false ) {
444 316 $action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action';
445 317 $action = FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' );
446 318 FrmAppHelper::include_svg();
@@ -455,16 +327,33 @@
455 327 /**
456 328 * Add CTA to the bottom on the plugin settings pages.
457 329 *
458 330 * @since 3.04.02
459 - *
460 - * @return void
461 331 */
462 - public static function settings_cta() {
332 + public static function settings_cta( $view ) {
333 +
463 334 if ( get_option( 'frm_lite_settings_upgrade', false ) ) {
464 335 return;
465 336 }
466 337
338 + $features = array(
339 + __( 'Extra form features like file uploads, pagination, etc', 'formidable' ),
340 + __( 'Repeaters & cascading fields for advanced forms', 'formidable' ),
341 + __( 'Flexibly view, search, edit, and delete entries anywhere', 'formidable' ),
342 + __( 'Display entries with virtually limitless Formidable views', 'formidable' ),
343 + __( 'Create surveys & polls', 'formidable' ),
344 + __( 'WordPress user registration and login forms', 'formidable' ),
345 + __( 'Create Stripe, PayPal or Authorize.net payment forms', 'formidable' ),
346 + __( 'Powerful conditional logic for smart forms', 'formidable' ),
347 + __( 'Integrations with 1000+ marketing & payment services', 'formidable' ),
348 + __( 'Collect digital signatures', 'formidable' ),
349 + __( 'Accept user-submitted content with Post submissions', 'formidable' ),
350 + __( 'Email routing', 'formidable' ),
351 + __( 'Create calculator forms', 'formidable' ),
352 + __( 'Save draft entries and return later', 'formidable' ),
353 + __( 'Analyze form data with graphs & stats', 'formidable' ),
354 + );
355 +
467 356 include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/settings_cta.php';
468 357 }
469 358
470 359 /**
@@ -508,9 +397,8 @@
508 397
509 398 $pages = FrmDb::get_results( $wpdb->posts, $where, 'ID, post_title', $atts );
510 399
511 400 $results = array();
512 -
513 401 foreach ( $pages as $page ) {
514 402 $results[] = array(
515 403 'value' => $page->ID,
516 404 'label' => $page->post_title,
@@ -517,25 +405,6 @@
517 405 );
518 406 }
519 407
520 408 wp_send_json( $results );
521 - }
522 -
523 - /**
524 - * Shows a fake color picker.
525 - *
526 - * @since 6.25
527 - *
528 - * @param string $color Color value.
529 - *
530 - * @return void
531 - */
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
540 409 }
541 410 }