| @@ -20,9 +20,9 @@ | ||
| 20 | 20 | public static function license_box() { |
| 21 | 21 | if ( ! current_user_can( 'activate_plugins' ) ) { |
| 22 | 22 | return; |
| 23 | 23 | } |
| 24 | - include( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/license_box.php' ); | |
| 24 | + include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/license_box.php'; | |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | public static function display_form( $errors = array(), $message = '' ) { |
| 28 | 28 | global $frm_vars; |
| @@ -34,9 +34,9 @@ | ||
| 34 | 34 | |
| 35 | 35 | $sections = self::get_settings_tabs(); |
| 36 | 36 | $current = FrmAppHelper::simple_get( 't', 'sanitize_title', 'general_settings' ); |
| 37 | 37 | |
| 38 | - require( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/form.php' ); | |
| 38 | + require FrmAppHelper::plugin_path() . '/classes/views/frm-settings/form.php'; | |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | /** |
| 42 | 42 | * Get sections to use for Global Settings. |
| @@ -44,27 +44,27 @@ | ||
| 44 | 44 | * @return array<array> |
| 45 | 45 | */ |
| 46 | 46 | private static function get_settings_tabs() { |
| 47 | 47 | $sections = array( |
| 48 | - 'general' => array( | |
| 48 | + 'general' => array( | |
| 49 | 49 | 'class' => __CLASS__, |
| 50 | 50 | 'function' => 'general_settings', |
| 51 | 51 | 'name' => __( 'General Settings', 'formidable' ), |
| 52 | 52 | 'icon' => 'frm_icon_font frm_settings_icon', |
| 53 | 53 | ), |
| 54 | - 'messages' => array( | |
| 54 | + 'messages' => array( | |
| 55 | 55 | 'class' => __CLASS__, |
| 56 | 56 | 'function' => 'message_settings', |
| 57 | 57 | 'name' => __( 'Message Defaults', 'formidable' ), |
| 58 | 58 | 'icon' => 'frm_icon_font frm_stamp_icon', |
| 59 | 59 | ), |
| 60 | - 'permissions' => array( | |
| 60 | + 'permissions' => array( | |
| 61 | 61 | 'class' => __CLASS__, |
| 62 | 62 | 'function' => 'permission_settings', |
| 63 | 63 | 'name' => __( 'Permissions', 'formidable' ), |
| 64 | 64 | 'icon' => 'frm_icon_font frm_lock_icon', |
| 65 | 65 | ), |
| 66 | - 'custom_css' => array( | |
| 66 | + 'custom_css' => array( | |
| 67 | 67 | 'class' => 'FrmStylesController', |
| 68 | 68 | 'function' => 'custom_css', |
| 69 | 69 | 'name' => __( 'Custom CSS', 'formidable' ), |
| 70 | 70 | 'icon' => 'frm_icon_font frm_code_icon', |
| @@ -74,15 +74,15 @@ | ||
| 74 | 74 | 'function' => 'manage', |
| 75 | 75 | 'name' => __( 'Manage Styles', 'formidable' ), |
| 76 | 76 | 'icon' => 'frm_icon_font frm_pallet_icon', |
| 77 | 77 | ), |
| 78 | - 'captcha' => array( | |
| 78 | + 'captcha' => array( | |
| 79 | 79 | 'class' => __CLASS__, |
| 80 | 80 | 'function' => 'captcha_settings', |
| 81 | 81 | 'name' => __( 'Captcha', 'formidable' ), |
| 82 | 82 | 'icon' => 'frm_icon_font frm_shield_check_icon', |
| 83 | 83 | ), |
| 84 | - 'white_label' => array( | |
| 84 | + 'white_label' => array( | |
| 85 | 85 | 'name' => __( 'White Labeling', 'formidable' ), |
| 86 | 86 | 'icon' => 'frm_icon_font frm_ghost_icon', |
| 87 | 87 | 'html_class' => 'frm_show_upgrade_tab frm_noallow', |
| 88 | 88 | 'data' => array( |
| @@ -90,9 +90,9 @@ | ||
| 90 | 90 | 'upgrade' => __( 'White labeling options', 'formidable' ), |
| 91 | 91 | 'screenshot' => 'white-label.png', |
| 92 | 92 | ), |
| 93 | 93 | ), |
| 94 | - 'inbox' => array( | |
| 94 | + 'inbox' => array( | |
| 95 | 95 | 'name' => __( 'Inbox', 'formidable' ), |
| 96 | 96 | 'icon' => 'frm_icon_font frm_email_icon', |
| 97 | 97 | 'html_class' => 'frm_show_upgrade_tab frm_noallow', |
| 98 | 98 | 'data' => array( |
| @@ -118,13 +118,13 @@ | ||
| 118 | 118 | $sections['licenses'] = array( |
| 119 | 119 | 'class' => 'FrmAddonsController', |
| 120 | 120 | 'function' => 'license_settings', |
| 121 | 121 | 'name' => __( 'Plugin Licenses', 'formidable' ), |
| 122 | - 'icon' => 'frm_icon_font frm_keyalt_icon', | |
| 122 | + 'icon' => 'frmfont frm_key_icon', | |
| 123 | 123 | 'ajax' => true, |
| 124 | 124 | ); |
| 125 | 125 | } |
| 126 | - } | |
| 126 | + }//end if | |
| 127 | 127 | |
| 128 | 128 | /** |
| 129 | 129 | * @param array<array> $sections |
| 130 | 130 | */ |
| @@ -158,9 +158,9 @@ | ||
| 158 | 158 | $section['function'] = $original; |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | $sections[ $key ] = $section; |
| 162 | - } | |
| 162 | + }//end foreach | |
| 163 | 163 | |
| 164 | 164 | return $sections; |
| 165 | 165 | } |
| 166 | 166 | |
| @@ -202,15 +202,14 @@ | ||
| 202 | 202 | /** |
| 203 | 203 | * Render the global currency selector if Pro is up to date. |
| 204 | 204 | * |
| 205 | 205 | * @param FrmSettings $frm_settings |
| 206 | - * @param string $more_html | |
| 206 | + * @param string $more_html | |
| 207 | 207 | * @return void |
| 208 | 208 | */ |
| 209 | 209 | public static function maybe_render_currency_selector( $frm_settings, $more_html ) { |
| 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. | |
| 210 | + if ( is_callable( 'FrmProSettingsController::add_currency_settings' ) ) { | |
| 211 | + FrmProSettingsController::add_currency_settings(); | |
| 213 | 212 | return; |
| 214 | 213 | } |
| 215 | 214 | |
| 216 | 215 | $currencies = FrmCurrencyHelper::get_currencies(); |
| @@ -222,9 +221,9 @@ | ||
| 222 | 221 | */ |
| 223 | 222 | public static function message_settings() { |
| 224 | 223 | $frm_settings = FrmAppHelper::get_settings(); |
| 225 | 224 | |
| 226 | - include( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/messages.php' ); | |
| 225 | + include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/messages.php'; | |
| 227 | 226 | } |
| 228 | 227 | |
| 229 | 228 | /** |
| 230 | 229 | * @since 4.0 |
| @@ -232,9 +231,9 @@ | ||
| 232 | 231 | public static function captcha_settings() { |
| 233 | 232 | $frm_settings = FrmAppHelper::get_settings(); |
| 234 | 233 | $captcha_lang = FrmAppHelper::locales( 'captcha' ); |
| 235 | 234 | |
| 236 | - include( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/captcha/captcha.php' ); | |
| 235 | + include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/captcha/captcha.php'; | |
| 237 | 236 | } |
| 238 | 237 | |
| 239 | 238 | /** |
| 240 | 239 | * @since 4.0 |
| @@ -242,9 +241,9 @@ | ||
| 242 | 241 | public static function permission_settings() { |
| 243 | 242 | $frm_settings = FrmAppHelper::get_settings(); |
| 244 | 243 | $frm_roles = FrmAppHelper::frm_capabilities(); |
| 245 | 244 | |
| 246 | - include( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/permissions.php' ); | |
| 245 | + include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/permissions.php'; | |
| 247 | 246 | } |
| 248 | 247 | |
| 249 | 248 | /** |
| 250 | 249 | * @since 4.0 |
| @@ -251,15 +250,15 @@ | ||
| 251 | 250 | */ |
| 252 | 251 | public static function misc_settings() { |
| 253 | 252 | $frm_settings = FrmAppHelper::get_settings(); |
| 254 | 253 | |
| 255 | - include( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/misc.php' ); | |
| 254 | + include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/misc.php'; | |
| 256 | 255 | } |
| 257 | 256 | |
| 258 | 257 | /** |
| 259 | 258 | * Save form data submitted from the Global settings page. |
| 260 | 259 | * |
| 261 | - * @param string|bool $stop_load | |
| 260 | + * @param bool|string $stop_load | |
| 262 | 261 | * |
| 263 | 262 | * @return void |
| 264 | 263 | */ |
| 265 | 264 | public static function process_form( $stop_load = false ) { |
| @@ -268,9 +267,15 @@ | ||
| 268 | 267 | $frm_settings = FrmAppHelper::get_settings(); |
| 269 | 268 | $process_form = FrmAppHelper::get_post_param( 'process_form', '', 'sanitize_text_field' ); |
| 270 | 269 | |
| 271 | 270 | if ( ! wp_verify_nonce( $process_form, 'process_form_nonce' ) ) { |
| 272 | - wp_die( esc_html( $frm_settings->admin_permission ) ); | |
| 271 | + $error_args = array( | |
| 272 | + 'title' => __( 'Verification failed', 'formidable' ), | |
| 273 | + 'body' => $frm_settings->admin_permission, | |
| 274 | + 'cancel_text' => __( 'Cancel', 'formidable' ), | |
| 275 | + ); | |
| 276 | + FrmAppController::show_error_modal( $error_args ); | |
| 277 | + return; | |
| 273 | 278 | } |
| 274 | 279 | |
| 275 | 280 | $errors = array(); |
| 276 | 281 | $message = ''; |
| @@ -310,9 +315,9 @@ | ||
| 310 | 315 | $action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action'; |
| 311 | 316 | $action = FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' ); |
| 312 | 317 | FrmAppHelper::include_svg(); |
| 313 | 318 | |
| 314 | - if ( $action == 'process-form' ) { | |
| 319 | + if ( $action === 'process-form' ) { | |
| 315 | 320 | self::process_form( $stop_load ); |
| 316 | 321 | } elseif ( $stop_load != 'stop_load' ) { |
| 317 | 322 | self::display_form(); |
| 318 | 323 | } |
| @@ -323,32 +328,13 @@ | ||
| 323 | 328 | * |
| 324 | 329 | * @since 3.04.02 |
| 325 | 330 | */ |
| 326 | 331 | public static function settings_cta( $view ) { |
| 327 | - | |
| 328 | 332 | if ( get_option( 'frm_lite_settings_upgrade', false ) ) { |
| 329 | 333 | return; |
| 330 | 334 | } |
| 331 | 335 | |
| 332 | - $features = array( | |
| 333 | - __( 'Extra form features like file uploads, pagination, etc', 'formidable' ), | |
| 334 | - __( 'Repeaters & cascading fields for advanced forms', 'formidable' ), | |
| 335 | - __( 'Flexibly view, search, edit, and delete entries anywhere', 'formidable' ), | |
| 336 | - __( 'Display entries with virtually limitless Formidable views', 'formidable' ), | |
| 337 | - __( 'Create surveys & polls', 'formidable' ), | |
| 338 | - __( 'WordPress user registration and login forms', 'formidable' ), | |
| 339 | - __( 'Create Stripe, PayPal or Authorize.net payment forms', 'formidable' ), | |
| 340 | - __( 'Powerful conditional logic for smart forms', 'formidable' ), | |
| 341 | - __( 'Integrations with 1000+ marketing & payment services', 'formidable' ), | |
| 342 | - __( 'Collect digital signatures', 'formidable' ), | |
| 343 | - __( 'Accept user-submitted content with Post submissions', 'formidable' ), | |
| 344 | - __( 'Email routing', 'formidable' ), | |
| 345 | - __( 'Create calculator forms', 'formidable' ), | |
| 346 | - __( 'Save draft entries and return later', 'formidable' ), | |
| 347 | - __( 'Analyze form data with graphs & stats', 'formidable' ), | |
| 348 | - ); | |
| 349 | - | |
| 350 | - include( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/settings_cta.php' ); | |
| 336 | + include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/settings_cta.php'; | |
| 351 | 337 | } |
| 352 | 338 | |
| 353 | 339 | /** |
| 354 | 340 | * Dismiss upgrade notice at the bottom on the plugin settings pages. |
| @@ -355,8 +341,9 @@ | ||
| 355 | 341 | * |
| 356 | 342 | * @since 3.04.02 |
| 357 | 343 | */ |
| 358 | 344 | public static function settings_cta_dismiss() { |
| 345 | + check_ajax_referer( 'frm_ajax', 'nonce' ); | |
| 359 | 346 | FrmAppHelper::permission_check( 'frm_change_settings' ); |
| 360 | 347 | |
| 361 | 348 | update_option( 'frm_lite_settings_upgrade', time(), 'no' ); |
| 362 | 349 | |
| @@ -373,9 +360,9 @@ | ||
| 373 | 360 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
| 374 | 361 | |
| 375 | 362 | global $wpdb; |
| 376 | 363 | |
| 377 | - $term = FrmAppHelper::get_param( 'term', '', 'get', 'sanitize_text_field' ); | |
| 364 | + $term = FrmAppHelper::get_param( 'term', '', 'get', 'sanitize_text_field' ); | |
| 378 | 365 | $post_type = FrmAppHelper::get_param( 'post_type', 'page', 'get', 'sanitize_text_field' ); |
| 379 | 366 | |
| 380 | 367 | $where = array( |
| 381 | 368 | 'post_status' => 'publish', |
| @@ -398,14 +385,6 @@ | ||
| 398 | 385 | ); |
| 399 | 386 | } |
| 400 | 387 | |
| 401 | 388 | wp_send_json( $results ); |
| 402 | - } | |
| 403 | - | |
| 404 | - /** | |
| 405 | - * @deprecated 6.0 use FrmSettingsController::captcha_settings(). | |
| 406 | - */ | |
| 407 | - public static function recaptcha_settings() { | |
| 408 | - _deprecated_function( __FUNCTION__, '6.0', 'FrmSettingsController::captcha_settings()' ); | |
| 409 | - self::captcha_settings(); | |
| 410 | 389 | } |
| 411 | 390 | } |