PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.23
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.23
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 +9 -86 6.266.23 View file →
@@ -13,11 +13,8 @@
13 13 * @var array
14 14 */
15 15 private static $removed_payments_sections = array();
16 16
17 - /**
18 - * @return void
19 - */
20 17 public static function menu() {
21 18 // Make sure admins can see the menu items
22 19 FrmAppHelper::force_capability( 'frm_change_settings' );
23 20
@@ -35,14 +32,8 @@
35 32 }
36 33 include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/license_box.php';
37 34 }
38 35
39 - /**
40 - * @param array $errors
41 - * @param string $message
42 - *
43 - * @return void
44 - */
45 36 public static function display_form( $errors = array(), $message = '' ) {
46 37 global $frm_vars;
47 38
48 39 $frm_settings = FrmAppHelper::get_settings();
@@ -67,21 +58,21 @@
67 58 */
68 59 private static function get_settings_tabs() {
69 60 $sections = array(
70 61 'general' => array(
71 - 'class' => self::class,
62 + 'class' => __CLASS__,
72 63 'function' => 'general_settings',
73 64 'name' => __( 'General Settings', 'formidable' ),
74 65 'icon' => 'frm_icon_font frm_settings_icon',
75 66 ),
76 67 'messages' => array(
77 - 'class' => self::class,
68 + 'class' => __CLASS__,
78 69 'function' => 'message_settings',
79 70 'name' => __( 'Message Defaults', 'formidable' ),
80 71 'icon' => 'frm_icon_font frm_stamp_icon',
81 72 ),
82 73 'permissions' => array(
83 - 'class' => self::class,
74 + 'class' => __CLASS__,
84 75 'function' => 'permission_settings',
85 76 'name' => __( 'Permissions', 'formidable' ),
86 77 'icon' => 'frm_icon_font frm_lock_icon',
87 78 ),
@@ -87,9 +78,9 @@
87 78 ),
88 79 'payments' => array(
89 80 'name' => __( 'Payments', 'formidable' ),
90 81 'icon' => 'frm_icon_font frm_simple_cc_icon',
91 - 'class' => self::class,
82 + 'class' => __CLASS__,
92 83 'function' => 'payments_settings',
93 84 ),
94 85 'custom_css' => array(
95 86 'class' => 'FrmStylesController',
@@ -103,19 +94,13 @@
103 94 'name' => __( 'Manage Styles', 'formidable' ),
104 95 'icon' => 'frm_icon_font frm_pallet_icon',
105 96 ),
106 97 'captcha' => array(
107 - 'class' => self::class,
98 + 'class' => __CLASS__,
108 99 'function' => 'captcha_settings',
109 100 'name' => __( 'Captcha/Spam', 'formidable' ),
110 101 'icon' => 'frm_icon_font frm_shield_check_icon',
111 102 ),
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 103 'white_label' => array(
119 104 'name' => __( 'White Labeling', 'formidable' ),
120 105 'icon' => 'frm_icon_font frm_ghost_icon',
121 106 'html_class' => 'frm_show_upgrade_tab frm_noallow',
@@ -122,9 +107,8 @@
122 107 'data' => array(
123 108 'medium' => 'white-label',
124 109 'upgrade' => __( 'White labeling options', 'formidable' ),
125 110 'screenshot' => 'white-label.png',
126 - 'learn-more' => FrmAppHelper::get_doc_url( 'features/white-label-form-builder-wordpress', 'white-labeling-global-settings', false ),
127 111 ),
128 112 ),
129 113 'inbox' => array(
130 114 'name' => __( 'Inbox', 'formidable' ),
@@ -133,9 +117,8 @@
133 117 'data' => array(
134 118 'medium' => 'inbox-settings',
135 119 'upgrade' => __( 'Inbox settings', 'formidable' ),
136 120 'screenshot' => 'inbox.png',
137 - 'learn-more' => FrmAppHelper::get_doc_url( 'global-settings-overview/#kb-inbox', 'inbox-global-settings' ),
138 121 ),
139 122 ),
140 123 );
141 124
@@ -142,9 +125,8 @@
142 125 if ( apply_filters( 'frm_include_addon_page', false ) ) {
143 126 // If no addons need a license, skip this page
144 127 $show_licenses = false;
145 128 $installed_addons = apply_filters( 'frm_installed_addons', array() );
146 -
147 129 foreach ( $installed_addons as $installed_addon ) {
148 130 if ( ! $installed_addon->is_parent_licence && $installed_addon->plugin_name != 'Formidable Pro' && $installed_addon->needs_license ) {
149 131 $show_licenses = true;
150 132 break;
@@ -170,9 +152,9 @@
170 152
171 153 $sections['misc'] = array(
172 154 'name' => __( 'Miscellaneous', 'formidable' ),
173 155 'icon' => 'frm_icon_font frm_shuffle_icon',
174 - 'class' => self::class,
156 + 'class' => __CLASS__,
175 157 'function' => 'misc_settings',
176 158 );
177 159
178 160 foreach ( $sections as $key => $section ) {
@@ -208,9 +190,8 @@
208 190 *
209 191 * @since 6.22.1
210 192 *
211 193 * @param array $sections
212 - *
213 194 * @return void
214 195 */
215 196 private static function remove_payments_sections( &$sections ) {
216 197 $payment_section_keys = array( 'paypal', 'square', 'stripe', 'authorize_net' );
@@ -221,9 +202,9 @@
221 202 unset( $sections[ $key ] );
222 203 }
223 204 }
224 205
225 - uksort( self::$removed_payments_sections, array( self::class, 'payment_sections_sort_callback' ) );
206 + uksort( self::$removed_payments_sections, array( __CLASS__, 'payment_sections_sort_callback' ) );
226 207 }
227 208
228 209 /**
229 210 * Sort the payments sections (PayPal, Square, Stripe, Authorize.Net)
@@ -231,9 +212,8 @@
231 212 * @since 6.22.1
232 213 *
233 214 * @param string $a
234 215 * @param string $b
235 - *
236 216 * @return int
237 217 */
238 218 private static function payment_sections_sort_callback( $a, $b ) {
239 219 $order = array( 'stripe', 'square', 'paypal', 'authorize_net' );
@@ -238,9 +218,8 @@
238 218 private static function payment_sections_sort_callback( $a, $b ) {
239 219 $order = array( 'stripe', 'square', 'paypal', 'authorize_net' );
240 220 $first_key = array_search( $a, $order );
241 221 $second_key = array_search( $b, $order );
242 -
243 222 if ( false === $first_key || false === $second_key ) {
244 223 return 0;
245 224 }
246 225 return $first_key - $second_key;
@@ -251,9 +230,8 @@
251 230 check_ajax_referer( 'frm_ajax', 'nonce' );
252 231
253 232 $section = FrmAppHelper::get_post_param( 'tab', '', 'sanitize_text_field' );
254 233 $sections = self::get_settings_tabs();
255 -
256 234 if ( ! isset( $sections[ $section ] ) ) {
257 235 wp_die();
258 236 }
259 237
@@ -261,9 +239,9 @@
261 239
262 240 if ( isset( $section['class'] ) ) {
263 241 call_user_func( array( $section['class'], $section['function'] ) );
264 242 } else {
265 - call_user_func( ( $section['function'] ?? $section ) );
243 + call_user_func( ( isset( $section['function'] ) ? $section['function'] : $section ) );
266 244 }
267 245 wp_die();
268 246 }
269 247
@@ -286,9 +264,8 @@
286 264 * Render the global currency selector if Pro is up to date.
287 265 *
288 266 * @param FrmSettings $frm_settings
289 267 * @param string $more_html
290 - *
291 268 * @return void
292 269 */
293 270 public static function maybe_render_currency_selector( $frm_settings, $more_html ) {
294 271 if ( is_callable( 'FrmProSettingsController::add_currency_settings' ) ) {
@@ -301,10 +278,8 @@
301 278 }
302 279
303 280 /**
304 281 * @since 4.0
305 - *
306 - * @return void
307 282 */
308 283 public static function message_settings() {
309 284 $frm_settings = FrmAppHelper::get_settings();
310 285
@@ -312,10 +287,8 @@
312 287 }
313 288
314 289 /**
315 290 * @since 4.0
316 - *
317 - * @return void
318 291 */
319 292 public static function captcha_settings() {
320 293 $frm_settings = FrmAppHelper::get_settings();
321 294 $captcha_lang = FrmAppHelper::locales( 'captcha' );
@@ -323,24 +296,9 @@
323 296 include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/captcha/captcha.php';
324 297 }
325 298
326 299 /**
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 300 * @since 4.0
341 - *
342 - * @return void
343 301 */
344 302 public static function permission_settings() {
345 303 $frm_settings = FrmAppHelper::get_settings();
346 304 $frm_roles = FrmAppHelper::frm_capabilities();
@@ -347,16 +305,12 @@
347 305
348 306 include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/permissions.php';
349 307 }
350 308
351 - /**
352 - * @return void
353 - */
354 309 public static function payments_settings() {
355 310 $payment_sections = self::$removed_payments_sections;
356 311
357 312 $tab = FrmAppHelper::simple_get( 't', 'sanitize_title', 'general_settings' );
358 -
359 313 if ( $tab && in_array( $tab, array( 'stripe_settings', 'square_settings', 'authorize_net_settings', 'paypal_settings' ), true ) ) {
360 314 $tab = str_replace( '_settings', '', $tab );
361 315 } else {
362 316 $tab = 'stripe';
@@ -366,10 +320,8 @@
366 320 }
367 321
368 322 /**
369 323 * @since 4.0
370 - *
371 - * @return void
372 324 */
373 325 public static function misc_settings() {
374 326 $frm_settings = FrmAppHelper::get_settings();
375 327
@@ -426,10 +378,8 @@
426 378 /**
427 379 * Include the Update button on the global settings page.
428 380 *
429 381 * @since 4.0.02
430 - *
431 - * @return void
432 382 */
433 383 public static function save_button() {
434 384 echo '<input class="button-primary frm-button-primary" type="submit"
435 385 value="' . esc_attr__( 'Update', 'formidable' ) . '"/>';
@@ -434,13 +384,8 @@
434 384 echo '<input class="button-primary frm-button-primary" type="submit"
435 385 value="' . esc_attr__( 'Update', 'formidable' ) . '"/>';
436 386 }
437 387
438 - /**
439 - * @param bool|string $stop_load
440 - *
441 - * @return void
442 - */
443 388 public static function route( $stop_load = false ) {
444 389 $action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action';
445 390 $action = FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' );
446 391 FrmAppHelper::include_svg();
@@ -455,12 +400,10 @@
455 400 /**
456 401 * Add CTA to the bottom on the plugin settings pages.
457 402 *
458 403 * @since 3.04.02
459 - *
460 - * @return void
461 404 */
462 - public static function settings_cta() {
405 + public static function settings_cta( $view ) {
463 406 if ( get_option( 'frm_lite_settings_upgrade', false ) ) {
464 407 return;
465 408 }
466 409
@@ -508,9 +451,8 @@
508 451
509 452 $pages = FrmDb::get_results( $wpdb->posts, $where, 'ID, post_title', $atts );
510 453
511 454 $results = array();
512 -
513 455 foreach ( $pages as $page ) {
514 456 $results[] = array(
515 457 'value' => $page->ID,
516 458 'label' => $page->post_title,
@@ -517,25 +459,6 @@
517 459 );
518 460 }
519 461
520 462 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 463 }
541 464 }