| @@ -30,13 +30,8 @@ | ||
| 30 | 30 | |
| 31 | 31 | require( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/form.php' ); |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - /** | |
| 35 | - * Get sections to use for Global Settings. | |
| 36 | - * | |
| 37 | - * @return array<array> | |
| 38 | - */ | |
| 39 | 34 | private static function get_settings_tabs() { |
| 40 | 35 | $sections = array( |
| 41 | 36 | 'general' => array( |
| 42 | 37 | 'class' => __CLASS__, |
| @@ -55,24 +50,12 @@ | ||
| 55 | 50 | 'function' => 'permission_settings', |
| 56 | 51 | 'name' => __( 'Permissions', 'formidable' ), |
| 57 | 52 | 'icon' => 'frm_icon_font frm_lock_icon', |
| 58 | 53 | ), |
| 59 | - 'custom_css' => array( | |
| 60 | - 'class' => 'FrmStylesController', | |
| 61 | - 'function' => 'custom_css', | |
| 62 | - 'name' => __( 'Custom CSS', 'formidable' ), | |
| 63 | - 'icon' => 'frm_icon_font frm_code_icon', | |
| 64 | - ), | |
| 65 | - 'manage_styles' => array( | |
| 66 | - 'class' => 'FrmStylesController', | |
| 67 | - 'function' => 'manage', | |
| 68 | - 'name' => __( 'Manage Styles', 'formidable' ), | |
| 69 | - 'icon' => 'frm_icon_font frm_pallet_icon', | |
| 70 | - ), | |
| 71 | 54 | 'captcha' => array( |
| 72 | 55 | 'class' => __CLASS__, |
| 73 | 56 | 'function' => 'captcha_settings', |
| 74 | - 'name' => __( 'Captcha', 'formidable' ), | |
| 57 | + 'name' => __( 'CAPTCHA', 'formidable' ), | |
| 75 | 58 | 'icon' => 'frm_icon_font frm_shield_check_icon', |
| 76 | 59 | ), |
| 77 | 60 | 'white_label' => array( |
| 78 | 61 | 'name' => __( 'White Labeling', 'formidable' ), |
| @@ -96,9 +79,9 @@ | ||
| 96 | 79 | ), |
| 97 | 80 | ); |
| 98 | 81 | |
| 99 | 82 | if ( apply_filters( 'frm_include_addon_page', false ) ) { |
| 100 | - // If no addons need a license, skip this page | |
| 83 | + // if no addons need a license, skip this page | |
| 101 | 84 | $show_licenses = false; |
| 102 | 85 | $installed_addons = apply_filters( 'frm_installed_addons', array() ); |
| 103 | 86 | foreach ( $installed_addons as $installed_addon ) { |
| 104 | 87 | if ( ! $installed_addon->is_parent_licence && $installed_addon->plugin_name != 'Formidable Pro' && $installed_addon->needs_license ) { |
| @@ -116,12 +99,8 @@ | ||
| 116 | 99 | 'ajax' => true, |
| 117 | 100 | ); |
| 118 | 101 | } |
| 119 | 102 | } |
| 120 | - | |
| 121 | - /** | |
| 122 | - * @param array<array> $sections | |
| 123 | - */ | |
| 124 | 103 | $sections = apply_filters( 'frm_add_settings_section', $sections ); |
| 125 | 104 | |
| 126 | 105 | $sections['misc'] = array( |
| 127 | 106 | 'name' => __( 'Miscellaneous', 'formidable' ), |
| @@ -226,21 +205,14 @@ | ||
| 226 | 205 | |
| 227 | 206 | include( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/misc.php' ); |
| 228 | 207 | } |
| 229 | 208 | |
| 230 | - /** | |
| 231 | - * Save form data submitted from the Global settings page. | |
| 232 | - * | |
| 233 | - * @param string|bool $stop_load | |
| 234 | - * | |
| 235 | - * @return void | |
| 236 | - */ | |
| 237 | 209 | public static function process_form( $stop_load = false ) { |
| 238 | 210 | global $frm_vars; |
| 239 | 211 | |
| 240 | 212 | $frm_settings = FrmAppHelper::get_settings(); |
| 213 | + | |
| 241 | 214 | $process_form = FrmAppHelper::get_post_param( 'process_form', '', 'sanitize_text_field' ); |
| 242 | - | |
| 243 | 215 | if ( ! wp_verify_nonce( $process_form, 'process_form_nonce' ) ) { |
| 244 | 216 | wp_die( esc_html( $frm_settings->admin_permission ) ); |
| 245 | 217 | } |
| 246 | 218 | |
| @@ -246,14 +218,14 @@ | ||
| 246 | 218 | |
| 247 | 219 | $errors = array(); |
| 248 | 220 | $message = ''; |
| 249 | 221 | |
| 250 | - if ( empty( $frm_vars['settings_routed'] ) ) { | |
| 222 | + if ( ! isset( $frm_vars['settings_routed'] ) || ! $frm_vars['settings_routed'] ) { | |
| 251 | 223 | $errors = $frm_settings->validate( $_POST, array() ); |
| 252 | 224 | |
| 253 | 225 | $frm_settings->update( wp_unslash( $_POST ) ); |
| 254 | 226 | |
| 255 | - if ( ! $errors ) { | |
| 227 | + if ( empty( $errors ) ) { | |
| 256 | 228 | $frm_settings->store(); |
| 257 | 229 | $message = __( 'Settings Saved', 'formidable' ); |
| 258 | 230 | } |
| 259 | 231 | } else { |
| @@ -259,10 +231,11 @@ | ||
| 259 | 231 | } else { |
| 260 | 232 | $message = __( 'Settings Saved', 'formidable' ); |
| 261 | 233 | } |
| 262 | 234 | |
| 263 | - if ( $stop_load === 'stop_load' ) { | |
| 235 | + if ( $stop_load == 'stop_load' ) { | |
| 264 | 236 | $frm_vars['settings_routed'] = true; |
| 237 | + | |
| 265 | 238 | return; |
| 266 | 239 | } |
| 267 | 240 | |
| 268 | 241 | self::display_form( $errors, $message ); |
| @@ -373,11 +346,11 @@ | ||
| 373 | 346 | wp_send_json( $results ); |
| 374 | 347 | } |
| 375 | 348 | |
| 376 | 349 | /** |
| 377 | - * @deprecated 6.0 use FrmSettingsController::captcha_settings(). | |
| 350 | + * @deprecated x.x use FrmSettingsController::captcha_settings(). | |
| 378 | 351 | */ |
| 379 | 352 | public static function recaptcha_settings() { |
| 380 | - _deprecated_function( __FUNCTION__, '6.0', 'FrmSettingsController::captcha_settings()' ); | |
| 353 | + _deprecated_function( __FUNCTION__, 'x.x', 'FrmSettingsController::captcha_settings()' ); | |
| 381 | 354 | self::captcha_settings(); |
| 382 | 355 | } |
| 383 | 356 | } |