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 +38 -109 6.276.23 View file →
@@ -13,16 +13,13 @@
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
24 - add_submenu_page( 'formidable', 'Formidable | ' . __( 'Global Settings', 'formidable' ), __( 'Global Settings', 'formidable' ), 'frm_change_settings', 'formidable-settings', 'FrmSettingsController::route' ); // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong
21 + add_submenu_page( 'formidable', 'Formidable | ' . __( 'Global Settings', 'formidable' ), __( 'Global Settings', 'formidable' ), 'frm_change_settings', 'formidable-settings', 'FrmSettingsController::route' );
25 22 }
26 23
27 24 /**
28 25 * Include license box template on demand.
@@ -35,23 +32,19 @@
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();
49 - $uploads = wp_upload_dir();
50 - $target_path = $uploads['basedir'] . '/formidable/css';
51 - $sections = self::get_settings_tabs();
52 - $current = FrmAppHelper::simple_get( 't', 'sanitize_title', 'general_settings' );
53 40
41 + $uploads = wp_upload_dir();
42 + $target_path = $uploads['basedir'] . '/formidable/css';
43 +
44 + $sections = self::get_settings_tabs();
45 + $current = FrmAppHelper::simple_get( 't', 'sanitize_title', 'general_settings' );
46 +
54 47 if ( in_array( $current, array( 'stripe_settings', 'square_settings', 'authorize_net_settings', 'paypal_settings' ), true ) ) {
55 48 $current = 'payments_settings';
56 49 }
57 50
@@ -65,29 +58,29 @@
65 58 */
66 59 private static function get_settings_tabs() {
67 60 $sections = array(
68 61 'general' => array(
69 - 'class' => self::class,
62 + 'class' => __CLASS__,
70 63 'function' => 'general_settings',
71 64 'name' => __( 'General Settings', 'formidable' ),
72 - 'icon' => 'frmfont frm_settings_icon',
65 + 'icon' => 'frm_icon_font frm_settings_icon',
73 66 ),
74 67 'messages' => array(
75 - 'class' => self::class,
68 + 'class' => __CLASS__,
76 69 'function' => 'message_settings',
77 70 'name' => __( 'Message Defaults', 'formidable' ),
78 - 'icon' => 'frmfont frm_stamp_icon',
71 + 'icon' => 'frm_icon_font frm_stamp_icon',
79 72 ),
80 73 'permissions' => array(
81 - 'class' => self::class,
74 + 'class' => __CLASS__,
82 75 'function' => 'permission_settings',
83 76 'name' => __( 'Permissions', 'formidable' ),
84 - 'icon' => 'frmfont frm_lock_icon',
77 + 'icon' => 'frm_icon_font frm_lock_icon',
85 78 ),
86 79 'payments' => array(
87 80 'name' => __( 'Payments', 'formidable' ),
88 - 'icon' => 'frmfont frm_simple_cc_icon',
89 - 'class' => self::class,
81 + 'icon' => 'frm_icon_font frm_simple_cc_icon',
82 + 'class' => __CLASS__,
90 83 'function' => 'payments_settings',
91 84 ),
92 85 'custom_css' => array(
93 86 'class' => 'FrmStylesController',
@@ -92,48 +85,40 @@
92 85 'custom_css' => array(
93 86 'class' => 'FrmStylesController',
94 87 'function' => 'custom_css',
95 88 'name' => __( 'Custom CSS', 'formidable' ),
96 - 'icon' => 'frmfont frm_code_icon',
89 + 'icon' => 'frm_icon_font frm_code_icon',
97 90 ),
98 91 'manage_styles' => array(
99 92 'class' => 'FrmStylesController',
100 93 'function' => 'manage',
101 94 'name' => __( 'Manage Styles', 'formidable' ),
102 - 'icon' => 'frmfont frm_pallet_icon',
95 + 'icon' => 'frm_icon_font frm_pallet_icon',
103 96 ),
104 97 'captcha' => array(
105 - 'class' => self::class,
98 + 'class' => __CLASS__,
106 99 'function' => 'captcha_settings',
107 100 'name' => __( 'Captcha/Spam', 'formidable' ),
108 - 'icon' => 'frmfont frm_shield_check_icon',
101 + 'icon' => 'frm_icon_font frm_shield_check_icon',
109 102 ),
110 - 'email' => array(
111 - 'class' => self::class,
112 - 'function' => 'email_settings',
113 - 'name' => __( 'Email', 'formidable' ),
114 - 'icon' => 'frmfont frm_email_icon',
115 - ),
116 103 'white_label' => array(
117 104 'name' => __( 'White Labeling', 'formidable' ),
118 - 'icon' => 'frmfont frm_ghost_icon',
105 + 'icon' => 'frm_icon_font frm_ghost_icon',
119 106 'html_class' => 'frm_show_upgrade_tab frm_noallow',
120 107 'data' => array(
121 108 'medium' => 'white-label',
122 109 'upgrade' => __( 'White labeling options', 'formidable' ),
123 110 'screenshot' => 'white-label.png',
124 - 'learn-more' => FrmAppHelper::get_doc_url( 'features/white-label-form-builder-wordpress', 'white-labeling-global-settings', false ),
125 111 ),
126 112 ),
127 113 'inbox' => array(
128 114 'name' => __( 'Inbox', 'formidable' ),
129 - 'icon' => 'frmfont frm_email_icon',
115 + 'icon' => 'frm_icon_font frm_email_icon',
130 116 'html_class' => 'frm_show_upgrade_tab frm_noallow',
131 117 'data' => array(
132 118 'medium' => 'inbox-settings',
133 119 'upgrade' => __( 'Inbox settings', 'formidable' ),
134 120 'screenshot' => 'inbox.png',
135 - 'learn-more' => FrmAppHelper::get_doc_url( 'global-settings-overview/#kb-inbox', 'inbox-global-settings' ),
136 121 ),
137 122 ),
138 123 );
139 124
@@ -140,11 +125,10 @@
140 125 if ( apply_filters( 'frm_include_addon_page', false ) ) {
141 126 // If no addons need a license, skip this page
142 127 $show_licenses = false;
143 128 $installed_addons = apply_filters( 'frm_installed_addons', array() );
144 -
145 129 foreach ( $installed_addons as $installed_addon ) {
146 - if ( ! $installed_addon->is_parent_licence && $installed_addon->plugin_name !== 'Formidable Pro' && $installed_addon->needs_license ) {
130 + if ( ! $installed_addon->is_parent_licence && $installed_addon->plugin_name != 'Formidable Pro' && $installed_addon->needs_license ) {
147 131 $show_licenses = true;
148 132 break;
149 133 }
150 134 }
@@ -167,10 +151,10 @@
167 151 self::remove_payments_sections( $sections );
168 152
169 153 $sections['misc'] = array(
170 154 'name' => __( 'Miscellaneous', 'formidable' ),
171 - 'icon' => 'frmfont frm_shuffle_icon',
172 - 'class' => self::class,
155 + 'icon' => 'frm_icon_font frm_shuffle_icon',
156 + 'class' => __CLASS__,
173 157 'function' => 'misc_settings',
174 158 );
175 159
176 160 foreach ( $sections as $key => $section ) {
@@ -177,9 +161,9 @@
177 161 $original = $section;
178 162 $defaults = array(
179 163 'html_class' => '',
180 164 'name' => ucfirst( $key ),
181 - 'icon' => 'frmfont frm_settings_icon',
165 + 'icon' => 'frm_icon_font frm_settings_icon',
182 166 'anchor' => $key . '_settings',
183 167 'data' => array(),
184 168 );
185 169
@@ -206,9 +190,8 @@
206 190 *
207 191 * @since 6.22.1
208 192 *
209 193 * @param array $sections
210 - *
211 194 * @return void
212 195 */
213 196 private static function remove_payments_sections( &$sections ) {
214 197 $payment_section_keys = array( 'paypal', 'square', 'stripe', 'authorize_net' );
@@ -219,9 +202,9 @@
219 202 unset( $sections[ $key ] );
220 203 }
221 204 }
222 205
223 - uksort( self::$removed_payments_sections, array( self::class, 'payment_sections_sort_callback' ) );
206 + uksort( self::$removed_payments_sections, array( __CLASS__, 'payment_sections_sort_callback' ) );
224 207 }
225 208
226 209 /**
227 210 * Sort the payments sections (PayPal, Square, Stripe, Authorize.Net)
@@ -229,20 +212,17 @@
229 212 * @since 6.22.1
230 213 *
231 214 * @param string $a
232 215 * @param string $b
233 - *
234 216 * @return int
235 217 */
236 218 private static function payment_sections_sort_callback( $a, $b ) {
237 219 $order = array( 'stripe', 'square', 'paypal', 'authorize_net' );
238 - $first_key = array_search( $a, $order, true );
239 - $second_key = array_search( $b, $order, true );
240 -
220 + $first_key = array_search( $a, $order );
221 + $second_key = array_search( $b, $order );
241 222 if ( false === $first_key || false === $second_key ) {
242 223 return 0;
243 224 }
244 -
245 225 return $first_key - $second_key;
246 226 }
247 227
248 228 public static function load_settings_tab() {
@@ -250,9 +230,8 @@
250 230 check_ajax_referer( 'frm_ajax', 'nonce' );
251 231
252 232 $section = FrmAppHelper::get_post_param( 'tab', '', 'sanitize_text_field' );
253 233 $sections = self::get_settings_tabs();
254 -
255 234 if ( ! isset( $sections[ $section ] ) ) {
256 235 wp_die();
257 236 }
258 237
@@ -260,11 +239,10 @@
260 239
261 240 if ( isset( $section['class'] ) ) {
262 241 call_user_func( array( $section['class'], $section['function'] ) );
263 242 } else {
264 - call_user_func( ( $section['function'] ?? $section ) );
243 + call_user_func( ( isset( $section['function'] ) ? $section['function'] : $section ) );
265 244 }
266 -
267 245 wp_die();
268 246 }
269 247
270 248 /**
@@ -285,12 +263,12 @@
285 263 /**
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 268 * @return void
291 269 */
292 - public static function maybe_render_currency_selector( $frm_settings ) {
270 + public static function maybe_render_currency_selector( $frm_settings, $more_html ) {
293 271 if ( is_callable( 'FrmProSettingsController::add_currency_settings' ) ) {
294 272 FrmProSettingsController::add_currency_settings();
295 273 return;
296 274 }
@@ -300,20 +278,17 @@
300 278 }
301 279
302 280 /**
303 281 * @since 4.0
304 - *
305 - * @return void
306 282 */
307 283 public static function message_settings() {
308 284 $frm_settings = FrmAppHelper::get_settings();
285 +
309 286 include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/messages.php';
310 287 }
311 288
312 289 /**
313 290 * @since 4.0
314 - *
315 - * @return void
316 291 */
317 292 public static function captcha_settings() {
318 293 $frm_settings = FrmAppHelper::get_settings();
319 294 $captcha_lang = FrmAppHelper::locales( 'captcha' );
@@ -321,23 +296,9 @@
321 296 include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/captcha/captcha.php';
322 297 }
323 298
324 299 /**
325 - * Shows email settings.
326 - *
327 - * @since 6.25
328 - *
329 - * @return void
330 - */
331 - public static function email_settings() {
332 - $frm_settings = FrmAppHelper::get_settings();
333 - include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/email/email-styles.php';
334 - }
335 -
336 - /**
337 300 * @since 4.0
338 - *
339 - * @return void
340 301 */
341 302 public static function permission_settings() {
342 303 $frm_settings = FrmAppHelper::get_settings();
343 304 $frm_roles = FrmAppHelper::frm_capabilities();
@@ -344,15 +305,12 @@
344 305
345 306 include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/permissions.php';
346 307 }
347 308
348 - /**
349 - * @return void
350 - */
351 309 public static function payments_settings() {
352 310 $payment_sections = self::$removed_payments_sections;
353 - $tab = FrmAppHelper::simple_get( 't', 'sanitize_title', 'general_settings' );
354 311
312 + $tab = FrmAppHelper::simple_get( 't', 'sanitize_title', 'general_settings' );
355 313 if ( $tab && in_array( $tab, array( 'stripe_settings', 'square_settings', 'authorize_net_settings', 'paypal_settings' ), true ) ) {
356 314 $tab = str_replace( '_settings', '', $tab );
357 315 } else {
358 316 $tab = 'stripe';
@@ -362,13 +320,12 @@
362 320 }
363 321
364 322 /**
365 323 * @since 4.0
366 - *
367 - * @return void
368 324 */
369 325 public static function misc_settings() {
370 326 $frm_settings = FrmAppHelper::get_settings();
327 +
371 328 include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/misc.php';
372 329 }
373 330
374 331 /**
@@ -421,10 +378,8 @@
421 378 /**
422 379 * Include the Update button on the global settings page.
423 380 *
424 381 * @since 4.0.02
425 - *
426 - * @return void
427 382 */
428 383 public static function save_button() {
429 384 echo '<input class="button-primary frm-button-primary" type="submit"
430 385 value="' . esc_attr__( 'Update', 'formidable' ) . '"/>';
@@ -429,13 +384,8 @@
429 384 echo '<input class="button-primary frm-button-primary" type="submit"
430 385 value="' . esc_attr__( 'Update', 'formidable' ) . '"/>';
431 386 }
432 387
433 - /**
434 - * @param bool|string $stop_load
435 - *
436 - * @return void
437 - */
438 388 public static function route( $stop_load = false ) {
439 389 $action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action';
440 390 $action = FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' );
441 391 FrmAppHelper::include_svg();
@@ -441,9 +391,9 @@
441 391 FrmAppHelper::include_svg();
442 392
443 393 if ( $action === 'process-form' ) {
444 394 self::process_form( $stop_load );
445 - } elseif ( $stop_load !== 'stop_load' ) {
395 + } elseif ( $stop_load != 'stop_load' ) {
446 396 self::display_form();
447 397 }
448 398 }
449 399
@@ -450,12 +400,10 @@
450 400 /**
451 401 * Add CTA to the bottom on the plugin settings pages.
452 402 *
453 403 * @since 3.04.02
454 - *
455 - * @return void
456 404 */
457 - public static function settings_cta() {
405 + public static function settings_cta( $view ) {
458 406 if ( get_option( 'frm_lite_settings_upgrade', false ) ) {
459 407 return;
460 408 }
461 409
@@ -500,11 +448,11 @@
500 448 'limit' => 25,
501 449 'order_by' => 'post_title',
502 450 );
503 451
504 - $pages = FrmDb::get_results( $wpdb->posts, $where, 'ID, post_title', $atts );
452 + $pages = FrmDb::get_results( $wpdb->posts, $where, 'ID, post_title', $atts );
453 +
505 454 $results = array();
506 -
507 455 foreach ( $pages as $page ) {
508 456 $results[] = array(
509 457 'value' => $page->ID,
510 458 'label' => $page->post_title,
@@ -511,25 +459,6 @@
511 459 );
512 460 }
513 461
514 462 wp_send_json( $results );
515 - }
516 -
517 - /**
518 - * Shows a fake color picker.
519 - *
520 - * @since 6.25
521 - *
522 - * @param string $color Color value.
523 - *
524 - * @return void
525 - */
526 - public static function fake_color_picker( $color ) {
527 - ?>
528 - <div class="wp-picker-container">
529 - <button type="button" class="button wp-color-result" aria-expanded="false" aria-disabled="true" tabindex="-1" style="background-color:<?php echo esc_attr( $color ); ?>;"><?php // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong ?>
530 - <span class="wp-color-result-text" style="color:#a7aaad;"><?php esc_html_e( 'Select Color', 'formidable' ); ?></span>
531 - </button>
532 - </div>
533 - <?php
534 463 }
535 464 }