| @@ -11,17 +11,10 @@ | ||
| 11 | 11 | |
| 12 | 12 | add_submenu_page( 'formidable', 'Formidable | ' . __( 'Global Settings', 'formidable' ), __( 'Global Settings', 'formidable' ), 'frm_change_settings', 'formidable-settings', 'FrmSettingsController::route' ); |
| 13 | 13 | } |
| 14 | 14 | |
| 15 | - /** | |
| 16 | - * Include license box template on demand. | |
| 17 | - * | |
| 18 | - * @return void | |
| 19 | - */ | |
| 20 | 15 | public static function license_box() { |
| 21 | - if ( ! current_user_can( 'activate_plugins' ) ) { | |
| 22 | - return; | |
| 23 | - } | |
| 16 | + $a = FrmAppHelper::simple_get( 't', 'sanitize_title', 'general_settings' ); | |
| 24 | 17 | include( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/license_box.php' ); |
| 25 | 18 | } |
| 26 | 19 | |
| 27 | 20 | public static function display_form( $errors = array(), $message = '' ) { |
| @@ -37,13 +30,8 @@ | ||
| 37 | 30 | |
| 38 | 31 | require( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/form.php' ); |
| 39 | 32 | } |
| 40 | 33 | |
| 41 | - /** | |
| 42 | - * Get sections to use for Global Settings. | |
| 43 | - * | |
| 44 | - * @return array<array> | |
| 45 | - */ | |
| 46 | 34 | private static function get_settings_tabs() { |
| 47 | 35 | $sections = array( |
| 48 | 36 | 'general' => array( |
| 49 | 37 | 'class' => __CLASS__, |
| @@ -62,50 +50,36 @@ | ||
| 62 | 50 | 'function' => 'permission_settings', |
| 63 | 51 | 'name' => __( 'Permissions', 'formidable' ), |
| 64 | 52 | 'icon' => 'frm_icon_font frm_lock_icon', |
| 65 | 53 | ), |
| 66 | - 'custom_css' => array( | |
| 67 | - 'class' => 'FrmStylesController', | |
| 68 | - 'function' => 'custom_css', | |
| 69 | - 'name' => __( 'Custom CSS', 'formidable' ), | |
| 70 | - 'icon' => 'frm_icon_font frm_code_icon', | |
| 71 | - ), | |
| 72 | - 'manage_styles' => array( | |
| 73 | - 'class' => 'FrmStylesController', | |
| 74 | - 'function' => 'manage', | |
| 75 | - 'name' => __( 'Manage Styles', 'formidable' ), | |
| 76 | - 'icon' => 'frm_icon_font frm_pallet_icon', | |
| 77 | - ), | |
| 78 | - 'captcha' => array( | |
| 54 | + 'recaptcha' => array( | |
| 79 | 55 | 'class' => __CLASS__, |
| 80 | - 'function' => 'captcha_settings', | |
| 81 | - 'name' => __( 'Captcha', 'formidable' ), | |
| 56 | + 'function' => 'recaptcha_settings', | |
| 57 | + 'name' => __( 'reCaptcha', 'formidable' ), | |
| 82 | 58 | 'icon' => 'frm_icon_font frm_shield_check_icon', |
| 83 | 59 | ), |
| 84 | 60 | 'white_label' => array( |
| 85 | 61 | 'name' => __( 'White Labeling', 'formidable' ), |
| 86 | 62 | 'icon' => 'frm_icon_font frm_ghost_icon', |
| 87 | - 'html_class' => 'frm_show_upgrade_tab frm_noallow', | |
| 63 | + 'html_class' => 'frm_show_upgrade frm_noallow', | |
| 88 | 64 | 'data' => array( |
| 89 | - 'medium' => 'white-label', | |
| 90 | - 'upgrade' => __( 'White labeling options', 'formidable' ), | |
| 91 | - 'screenshot' => 'white-label.png', | |
| 65 | + 'medium' => 'white-label', | |
| 66 | + 'upgrade' => __( 'White labeling options', 'formidable' ), | |
| 92 | 67 | ), |
| 93 | 68 | ), |
| 94 | 69 | 'inbox' => array( |
| 95 | 70 | 'name' => __( 'Inbox', 'formidable' ), |
| 96 | 71 | 'icon' => 'frm_icon_font frm_email_icon', |
| 97 | - 'html_class' => 'frm_show_upgrade_tab frm_noallow', | |
| 72 | + 'html_class' => 'frm_show_upgrade frm_noallow', | |
| 98 | 73 | 'data' => array( |
| 99 | - 'medium' => 'inbox-settings', | |
| 100 | - 'upgrade' => __( 'Inbox settings', 'formidable' ), | |
| 101 | - 'screenshot' => 'inbox.png', | |
| 74 | + 'medium' => 'inbox-settings', | |
| 75 | + 'upgrade' => __( 'Inbox settings', 'formidable' ), | |
| 102 | 76 | ), |
| 103 | 77 | ), |
| 104 | 78 | ); |
| 105 | 79 | |
| 106 | 80 | if ( apply_filters( 'frm_include_addon_page', false ) ) { |
| 107 | - // If no addons need a license, skip this page | |
| 81 | + // if no addons need a license, skip this page | |
| 108 | 82 | $show_licenses = false; |
| 109 | 83 | $installed_addons = apply_filters( 'frm_installed_addons', array() ); |
| 110 | 84 | foreach ( $installed_addons as $installed_addon ) { |
| 111 | 85 | if ( ! $installed_addon->is_parent_licence && $installed_addon->plugin_name != 'Formidable Pro' && $installed_addon->needs_license ) { |
| @@ -123,12 +97,8 @@ | ||
| 123 | 97 | 'ajax' => true, |
| 124 | 98 | ); |
| 125 | 99 | } |
| 126 | 100 | } |
| 127 | - | |
| 128 | - /** | |
| 129 | - * @param array<array> $sections | |
| 130 | - */ | |
| 131 | 101 | $sections = apply_filters( 'frm_add_settings_section', $sections ); |
| 132 | 102 | |
| 133 | 103 | $sections['misc'] = array( |
| 134 | 104 | 'name' => __( 'Miscellaneous', 'formidable' ), |
| @@ -207,13 +177,13 @@ | ||
| 207 | 177 | |
| 208 | 178 | /** |
| 209 | 179 | * @since 4.0 |
| 210 | 180 | */ |
| 211 | - public static function captcha_settings() { | |
| 181 | + public static function recaptcha_settings() { | |
| 212 | 182 | $frm_settings = FrmAppHelper::get_settings(); |
| 213 | 183 | $captcha_lang = FrmAppHelper::locales( 'captcha' ); |
| 214 | 184 | |
| 215 | - include( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/captcha/captcha.php' ); | |
| 185 | + include( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/recaptcha.php' ); | |
| 216 | 186 | } |
| 217 | 187 | |
| 218 | 188 | /** |
| 219 | 189 | * @since 4.0 |
| @@ -233,21 +203,14 @@ | ||
| 233 | 203 | |
| 234 | 204 | include( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/misc.php' ); |
| 235 | 205 | } |
| 236 | 206 | |
| 237 | - /** | |
| 238 | - * Save form data submitted from the Global settings page. | |
| 239 | - * | |
| 240 | - * @param string|bool $stop_load | |
| 241 | - * | |
| 242 | - * @return void | |
| 243 | - */ | |
| 244 | 207 | public static function process_form( $stop_load = false ) { |
| 245 | 208 | global $frm_vars; |
| 246 | 209 | |
| 247 | 210 | $frm_settings = FrmAppHelper::get_settings(); |
| 211 | + | |
| 248 | 212 | $process_form = FrmAppHelper::get_post_param( 'process_form', '', 'sanitize_text_field' ); |
| 249 | - | |
| 250 | 213 | if ( ! wp_verify_nonce( $process_form, 'process_form_nonce' ) ) { |
| 251 | 214 | wp_die( esc_html( $frm_settings->admin_permission ) ); |
| 252 | 215 | } |
| 253 | 216 | |
| @@ -253,14 +216,14 @@ | ||
| 253 | 216 | |
| 254 | 217 | $errors = array(); |
| 255 | 218 | $message = ''; |
| 256 | 219 | |
| 257 | - if ( empty( $frm_vars['settings_routed'] ) ) { | |
| 220 | + if ( ! isset( $frm_vars['settings_routed'] ) || ! $frm_vars['settings_routed'] ) { | |
| 258 | 221 | $errors = $frm_settings->validate( $_POST, array() ); |
| 259 | 222 | |
| 260 | 223 | $frm_settings->update( wp_unslash( $_POST ) ); |
| 261 | 224 | |
| 262 | - if ( ! $errors ) { | |
| 225 | + if ( empty( $errors ) ) { | |
| 263 | 226 | $frm_settings->store(); |
| 264 | 227 | $message = __( 'Settings Saved', 'formidable' ); |
| 265 | 228 | } |
| 266 | 229 | } else { |
| @@ -266,10 +229,11 @@ | ||
| 266 | 229 | } else { |
| 267 | 230 | $message = __( 'Settings Saved', 'formidable' ); |
| 268 | 231 | } |
| 269 | 232 | |
| 270 | - if ( $stop_load === 'stop_load' ) { | |
| 233 | + if ( $stop_load == 'stop_load' ) { | |
| 271 | 234 | $frm_vars['settings_routed'] = true; |
| 235 | + | |
| 272 | 236 | return; |
| 273 | 237 | } |
| 274 | 238 | |
| 275 | 239 | self::display_form( $errors, $message ); |
| @@ -377,14 +341,6 @@ | ||
| 377 | 341 | ); |
| 378 | 342 | } |
| 379 | 343 | |
| 380 | 344 | wp_send_json( $results ); |
| 381 | - } | |
| 382 | - | |
| 383 | - /** | |
| 384 | - * @deprecated 6.0 use FrmSettingsController::captcha_settings(). | |
| 385 | - */ | |
| 386 | - public static function recaptcha_settings() { | |
| 387 | - _deprecated_function( __FUNCTION__, '6.0', 'FrmSettingsController::captcha_settings()' ); | |
| 388 | - self::captcha_settings(); | |
| 389 | 345 | } |
| 390 | 346 | } |