| @@ -4,17 +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 | 8 | public static function menu() { |
| 18 | 9 | // Make sure admins can see the menu items |
| 19 | 10 | FrmAppHelper::force_capability( 'frm_change_settings' ); |
| 20 | 11 | |
| @@ -43,12 +34,8 @@ | ||
| 43 | 34 | |
| 44 | 35 | $sections = self::get_settings_tabs(); |
| 45 | 36 | $current = FrmAppHelper::simple_get( 't', 'sanitize_title', 'general_settings' ); |
| 46 | 37 | |
| 47 | - if ( in_array( $current, array( 'stripe_settings', 'square_settings', 'authorize_net_settings', 'paypal_settings' ), true ) ) { | |
| 48 | - $current = 'payments_settings'; | |
| 49 | - } | |
| 50 | - | |
| 51 | 38 | require FrmAppHelper::plugin_path() . '/classes/views/frm-settings/form.php'; |
| 52 | 39 | } |
| 53 | 40 | |
| 54 | 41 | /** |
| @@ -58,31 +45,25 @@ | ||
| 58 | 45 | */ |
| 59 | 46 | private static function get_settings_tabs() { |
| 60 | 47 | $sections = array( |
| 61 | 48 | 'general' => array( |
| 62 | - 'class' => self::class, | |
| 49 | + 'class' => __CLASS__, | |
| 63 | 50 | 'function' => 'general_settings', |
| 64 | 51 | 'name' => __( 'General Settings', 'formidable' ), |
| 65 | 52 | 'icon' => 'frm_icon_font frm_settings_icon', |
| 66 | 53 | ), |
| 67 | 54 | 'messages' => array( |
| 68 | - 'class' => self::class, | |
| 55 | + 'class' => __CLASS__, | |
| 69 | 56 | 'function' => 'message_settings', |
| 70 | 57 | 'name' => __( 'Message Defaults', 'formidable' ), |
| 71 | 58 | 'icon' => 'frm_icon_font frm_stamp_icon', |
| 72 | 59 | ), |
| 73 | 60 | 'permissions' => array( |
| 74 | - 'class' => self::class, | |
| 61 | + 'class' => __CLASS__, | |
| 75 | 62 | 'function' => 'permission_settings', |
| 76 | 63 | 'name' => __( 'Permissions', 'formidable' ), |
| 77 | 64 | 'icon' => 'frm_icon_font frm_lock_icon', |
| 78 | 65 | ), |
| 79 | - 'payments' => array( | |
| 80 | - 'name' => __( 'Payments', 'formidable' ), | |
| 81 | - 'icon' => 'frm_icon_font frm_simple_cc_icon', | |
| 82 | - 'class' => self::class, | |
| 83 | - 'function' => 'payments_settings', | |
| 84 | - ), | |
| 85 | 66 | 'custom_css' => array( |
| 86 | 67 | 'class' => 'FrmStylesController', |
| 87 | 68 | 'function' => 'custom_css', |
| 88 | 69 | 'name' => __( 'Custom CSS', 'formidable' ), |
| @@ -94,19 +75,13 @@ | ||
| 94 | 75 | 'name' => __( 'Manage Styles', 'formidable' ), |
| 95 | 76 | 'icon' => 'frm_icon_font frm_pallet_icon', |
| 96 | 77 | ), |
| 97 | 78 | 'captcha' => array( |
| 98 | - 'class' => self::class, | |
| 79 | + 'class' => __CLASS__, | |
| 99 | 80 | 'function' => 'captcha_settings', |
| 100 | - 'name' => __( 'Captcha/Spam', 'formidable' ), | |
| 81 | + 'name' => __( 'Captcha', 'formidable' ), | |
| 101 | 82 | 'icon' => 'frm_icon_font frm_shield_check_icon', |
| 102 | 83 | ), |
| 103 | - 'email' => array( | |
| 104 | - 'class' => self::class, | |
| 105 | - 'function' => 'email_settings', | |
| 106 | - 'name' => __( 'Email', 'formidable' ), | |
| 107 | - 'icon' => 'frm_icon_font frm_email_icon', | |
| 108 | - ), | |
| 109 | 84 | 'white_label' => array( |
| 110 | 85 | 'name' => __( 'White Labeling', 'formidable' ), |
| 111 | 86 | 'icon' => 'frm_icon_font frm_ghost_icon', |
| 112 | 87 | 'html_class' => 'frm_show_upgrade_tab frm_noallow', |
| @@ -153,14 +128,13 @@ | ||
| 153 | 128 | /** |
| 154 | 129 | * @param array<array> $sections |
| 155 | 130 | */ |
| 156 | 131 | $sections = apply_filters( 'frm_add_settings_section', $sections ); |
| 157 | - self::remove_payments_sections( $sections ); | |
| 158 | 132 | |
| 159 | 133 | $sections['misc'] = array( |
| 160 | 134 | 'name' => __( 'Miscellaneous', 'formidable' ), |
| 161 | 135 | 'icon' => 'frm_icon_font frm_shuffle_icon', |
| 162 | - 'class' => self::class, | |
| 136 | + 'class' => __CLASS__, | |
| 163 | 137 | 'function' => 'misc_settings', |
| 164 | 138 | ); |
| 165 | 139 | |
| 166 | 140 | foreach ( $sections as $key => $section ) { |
| @@ -189,49 +163,8 @@ | ||
| 189 | 163 | |
| 190 | 164 | return $sections; |
| 191 | 165 | } |
| 192 | 166 | |
| 193 | - /** | |
| 194 | - * Remove the payments sections (PayPal, Square, Stripe, Authorize.Net) | |
| 195 | - * and show them all on the payments section in separate tabs. | |
| 196 | - * | |
| 197 | - * @since 6.22.1 | |
| 198 | - * | |
| 199 | - * @param array $sections | |
| 200 | - * @return void | |
| 201 | - */ | |
| 202 | - private static function remove_payments_sections( &$sections ) { | |
| 203 | - $payment_section_keys = array( 'paypal', 'square', 'stripe', 'authorize_net' ); | |
| 204 | - | |
| 205 | - foreach ( $sections as $key => $section ) { | |
| 206 | - if ( in_array( $key, $payment_section_keys, true ) ) { | |
| 207 | - self::$removed_payments_sections[ $key ] = $section; | |
| 208 | - unset( $sections[ $key ] ); | |
| 209 | - } | |
| 210 | - } | |
| 211 | - | |
| 212 | - uksort( self::$removed_payments_sections, array( self::class, 'payment_sections_sort_callback' ) ); | |
| 213 | - } | |
| 214 | - | |
| 215 | - /** | |
| 216 | - * Sort the payments sections (PayPal, Square, Stripe, Authorize.Net) | |
| 217 | - * | |
| 218 | - * @since 6.22.1 | |
| 219 | - * | |
| 220 | - * @param string $a | |
| 221 | - * @param string $b | |
| 222 | - * @return int | |
| 223 | - */ | |
| 224 | - private static function payment_sections_sort_callback( $a, $b ) { | |
| 225 | - $order = array( 'stripe', 'square', 'paypal', 'authorize_net' ); | |
| 226 | - $first_key = array_search( $a, $order ); | |
| 227 | - $second_key = array_search( $b, $order ); | |
| 228 | - if ( false === $first_key || false === $second_key ) { | |
| 229 | - return 0; | |
| 230 | - } | |
| 231 | - return $first_key - $second_key; | |
| 232 | - } | |
| 233 | - | |
| 234 | 167 | public static function load_settings_tab() { |
| 235 | 168 | FrmAppHelper::permission_check( 'frm_change_settings' ); |
| 236 | 169 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
| 237 | 170 | |
| @@ -245,9 +178,9 @@ | ||
| 245 | 178 | |
| 246 | 179 | if ( isset( $section['class'] ) ) { |
| 247 | 180 | call_user_func( array( $section['class'], $section['function'] ) ); |
| 248 | 181 | } else { |
| 249 | - call_user_func( ( $section['function'] ?? $section ) ); | |
| 182 | + call_user_func( ( isset( $section['function'] ) ? $section['function'] : $section ) ); | |
| 250 | 183 | } |
| 251 | 184 | wp_die(); |
| 252 | 185 | } |
| 253 | 186 | |
| @@ -273,10 +206,11 @@ | ||
| 273 | 206 | * @param string $more_html |
| 274 | 207 | * @return void |
| 275 | 208 | */ |
| 276 | 209 | public static function maybe_render_currency_selector( $frm_settings, $more_html ) { |
| 277 | - if ( is_callable( 'FrmProSettingsController::add_currency_settings' ) ) { | |
| 278 | - 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. | |
| 279 | 213 | return; |
| 280 | 214 | } |
| 281 | 215 | |
| 282 | 216 | $currencies = FrmCurrencyHelper::get_currencies(); |
| @@ -302,19 +236,8 @@ | ||
| 302 | 236 | include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/captcha/captcha.php'; |
| 303 | 237 | } |
| 304 | 238 | |
| 305 | 239 | /** |
| 306 | - * Shows email settings. | |
| 307 | - * | |
| 308 | - * @since 6.25 | |
| 309 | - */ | |
| 310 | - public static function email_settings() { | |
| 311 | - $frm_settings = FrmAppHelper::get_settings(); | |
| 312 | - | |
| 313 | - include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/email/email-styles.php'; | |
| 314 | - } | |
| 315 | - | |
| 316 | - /** | |
| 317 | 240 | * @since 4.0 |
| 318 | 241 | */ |
| 319 | 242 | public static function permission_settings() { |
| 320 | 243 | $frm_settings = FrmAppHelper::get_settings(); |
| @@ -322,21 +245,8 @@ | ||
| 322 | 245 | |
| 323 | 246 | include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/permissions.php'; |
| 324 | 247 | } |
| 325 | 248 | |
| 326 | - public static function payments_settings() { | |
| 327 | - $payment_sections = self::$removed_payments_sections; | |
| 328 | - | |
| 329 | - $tab = FrmAppHelper::simple_get( 't', 'sanitize_title', 'general_settings' ); | |
| 330 | - if ( $tab && in_array( $tab, array( 'stripe_settings', 'square_settings', 'authorize_net_settings', 'paypal_settings' ), true ) ) { | |
| 331 | - $tab = str_replace( '_settings', '', $tab ); | |
| 332 | - } else { | |
| 333 | - $tab = 'stripe'; | |
| 334 | - } | |
| 335 | - | |
| 336 | - include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/payments.php'; | |
| 337 | - } | |
| 338 | - | |
| 339 | 249 | /** |
| 340 | 250 | * @since 4.0 |
| 341 | 251 | */ |
| 342 | 252 | public static function misc_settings() { |
| @@ -419,12 +329,31 @@ | ||
| 419 | 329 | * |
| 420 | 330 | * @since 3.04.02 |
| 421 | 331 | */ |
| 422 | 332 | public static function settings_cta( $view ) { |
| 333 | + | |
| 423 | 334 | if ( get_option( 'frm_lite_settings_upgrade', false ) ) { |
| 424 | 335 | return; |
| 425 | 336 | } |
| 426 | 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 | + | |
| 427 | 356 | include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/settings_cta.php'; |
| 428 | 357 | } |
| 429 | 358 | |
| 430 | 359 | /** |
| @@ -476,23 +405,6 @@ | ||
| 476 | 405 | ); |
| 477 | 406 | } |
| 478 | 407 | |
| 479 | 408 | wp_send_json( $results ); |
| 480 | - } | |
| 481 | - | |
| 482 | - /** | |
| 483 | - * Shows a fake color picker. | |
| 484 | - * | |
| 485 | - * @since 6.25 | |
| 486 | - * | |
| 487 | - * @param string $color Color value. | |
| 488 | - */ | |
| 489 | - public static function fake_color_picker( $color ) { | |
| 490 | - ?> | |
| 491 | - <div class="wp-picker-container"> | |
| 492 | - <button type="button" class="button wp-color-result" aria-expanded="false" aria-disabled="true" tabindex="-1" style="background-color:<?php echo esc_attr( $color ); ?>;"> | |
| 493 | - <span class="wp-color-result-text" style="color:#a7aaad;"><?php esc_html_e( 'Select Color', 'formidable' ); ?></span> | |
| 494 | - </button> | |
| 495 | - </div> | |
| 496 | - <?php | |
| 497 | 409 | } |
| 498 | 410 | } |