| @@ -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,50 +50,36 @@ | ||
| 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 | - 'captcha' => array( | |
| 54 | + 'recaptcha' => array( | |
| 72 | 55 | 'class' => __CLASS__, |
| 73 | - 'function' => 'captcha_settings', | |
| 74 | - 'name' => __( 'Captcha', 'formidable' ), | |
| 56 | + 'function' => 'recaptcha_settings', | |
| 57 | + 'name' => __( 'reCaptcha', 'formidable' ), | |
| 75 | 58 | 'icon' => 'frm_icon_font frm_shield_check_icon', |
| 76 | 59 | ), |
| 77 | 60 | 'white_label' => array( |
| 78 | 61 | 'name' => __( 'White Labeling', 'formidable' ), |
| 79 | 62 | 'icon' => 'frm_icon_font frm_ghost_icon', |
| 80 | - 'html_class' => 'frm_show_upgrade_tab frm_noallow', | |
| 63 | + 'html_class' => 'frm_show_upgrade frm_noallow', | |
| 81 | 64 | 'data' => array( |
| 82 | - 'medium' => 'white-label', | |
| 83 | - 'upgrade' => __( 'White labeling options', 'formidable' ), | |
| 84 | - 'screenshot' => 'white-label.png', | |
| 65 | + 'medium' => 'white-label', | |
| 66 | + 'upgrade' => __( 'White labeling options', 'formidable' ), | |
| 85 | 67 | ), |
| 86 | 68 | ), |
| 87 | 69 | 'inbox' => array( |
| 88 | 70 | 'name' => __( 'Inbox', 'formidable' ), |
| 89 | 71 | 'icon' => 'frm_icon_font frm_email_icon', |
| 90 | - 'html_class' => 'frm_show_upgrade_tab frm_noallow', | |
| 72 | + 'html_class' => 'frm_show_upgrade frm_noallow', | |
| 91 | 73 | 'data' => array( |
| 92 | - 'medium' => 'inbox-settings', | |
| 93 | - 'upgrade' => __( 'Inbox settings', 'formidable' ), | |
| 94 | - 'screenshot' => 'inbox.png', | |
| 74 | + 'medium' => 'inbox-settings', | |
| 75 | + 'upgrade' => __( 'Inbox settings', 'formidable' ), | |
| 95 | 76 | ), |
| 96 | 77 | ), |
| 97 | 78 | ); |
| 98 | 79 | |
| 99 | 80 | if ( apply_filters( 'frm_include_addon_page', false ) ) { |
| 100 | - // If no addons need a license, skip this page | |
| 81 | + // if no addons need a license, skip this page | |
| 101 | 82 | $show_licenses = false; |
| 102 | 83 | $installed_addons = apply_filters( 'frm_installed_addons', array() ); |
| 103 | 84 | foreach ( $installed_addons as $installed_addon ) { |
| 104 | 85 | if ( ! $installed_addon->is_parent_licence && $installed_addon->plugin_name != 'Formidable Pro' && $installed_addon->needs_license ) { |
| @@ -116,12 +97,8 @@ | ||
| 116 | 97 | 'ajax' => true, |
| 117 | 98 | ); |
| 118 | 99 | } |
| 119 | 100 | } |
| 120 | - | |
| 121 | - /** | |
| 122 | - * @param array<array> $sections | |
| 123 | - */ | |
| 124 | 101 | $sections = apply_filters( 'frm_add_settings_section', $sections ); |
| 125 | 102 | |
| 126 | 103 | $sections['misc'] = array( |
| 127 | 104 | 'name' => __( 'Miscellaneous', 'formidable' ), |
| @@ -200,13 +177,13 @@ | ||
| 200 | 177 | |
| 201 | 178 | /** |
| 202 | 179 | * @since 4.0 |
| 203 | 180 | */ |
| 204 | - public static function captcha_settings() { | |
| 181 | + public static function recaptcha_settings() { | |
| 205 | 182 | $frm_settings = FrmAppHelper::get_settings(); |
| 206 | 183 | $captcha_lang = FrmAppHelper::locales( 'captcha' ); |
| 207 | 184 | |
| 208 | - include( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/captcha/captcha.php' ); | |
| 185 | + include( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/recaptcha.php' ); | |
| 209 | 186 | } |
| 210 | 187 | |
| 211 | 188 | /** |
| 212 | 189 | * @since 4.0 |
| @@ -226,21 +203,14 @@ | ||
| 226 | 203 | |
| 227 | 204 | include( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/misc.php' ); |
| 228 | 205 | } |
| 229 | 206 | |
| 230 | - /** | |
| 231 | - * Save form data submitted from the Global settings page. | |
| 232 | - * | |
| 233 | - * @param string|bool $stop_load | |
| 234 | - * | |
| 235 | - * @return void | |
| 236 | - */ | |
| 237 | 207 | public static function process_form( $stop_load = false ) { |
| 238 | 208 | global $frm_vars; |
| 239 | 209 | |
| 240 | 210 | $frm_settings = FrmAppHelper::get_settings(); |
| 211 | + | |
| 241 | 212 | $process_form = FrmAppHelper::get_post_param( 'process_form', '', 'sanitize_text_field' ); |
| 242 | - | |
| 243 | 213 | if ( ! wp_verify_nonce( $process_form, 'process_form_nonce' ) ) { |
| 244 | 214 | wp_die( esc_html( $frm_settings->admin_permission ) ); |
| 245 | 215 | } |
| 246 | 216 | |
| @@ -246,14 +216,14 @@ | ||
| 246 | 216 | |
| 247 | 217 | $errors = array(); |
| 248 | 218 | $message = ''; |
| 249 | 219 | |
| 250 | - if ( empty( $frm_vars['settings_routed'] ) ) { | |
| 220 | + if ( ! isset( $frm_vars['settings_routed'] ) || ! $frm_vars['settings_routed'] ) { | |
| 251 | 221 | $errors = $frm_settings->validate( $_POST, array() ); |
| 252 | 222 | |
| 253 | 223 | $frm_settings->update( wp_unslash( $_POST ) ); |
| 254 | 224 | |
| 255 | - if ( ! $errors ) { | |
| 225 | + if ( empty( $errors ) ) { | |
| 256 | 226 | $frm_settings->store(); |
| 257 | 227 | $message = __( 'Settings Saved', 'formidable' ); |
| 258 | 228 | } |
| 259 | 229 | } else { |
| @@ -259,10 +229,11 @@ | ||
| 259 | 229 | } else { |
| 260 | 230 | $message = __( 'Settings Saved', 'formidable' ); |
| 261 | 231 | } |
| 262 | 232 | |
| 263 | - if ( $stop_load === 'stop_load' ) { | |
| 233 | + if ( $stop_load == 'stop_load' ) { | |
| 264 | 234 | $frm_vars['settings_routed'] = true; |
| 235 | + | |
| 265 | 236 | return; |
| 266 | 237 | } |
| 267 | 238 | |
| 268 | 239 | self::display_form( $errors, $message ); |
| @@ -370,14 +341,6 @@ | ||
| 370 | 341 | ); |
| 371 | 342 | } |
| 372 | 343 | |
| 373 | 344 | wp_send_json( $results ); |
| 374 | - } | |
| 375 | - | |
| 376 | - /** | |
| 377 | - * @deprecated 6.0 use FrmSettingsController::captcha_settings(). | |
| 378 | - */ | |
| 379 | - public static function recaptcha_settings() { | |
| 380 | - _deprecated_function( __FUNCTION__, '6.0', 'FrmSettingsController::captcha_settings()' ); | |
| 381 | - self::captcha_settings(); | |
| 382 | 345 | } |
| 383 | 346 | } |