@@ -2,26 +2,26 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | class FrmSettingsController { |
| 4 | 4 | |
| 5 | - public static function menu() { |
|
| 5 | + public static function menu() { |
|
| 6 | 6 | // Make sure admins can see the menu items |
| 7 | 7 | FrmAppHelper::force_capability( 'frm_change_settings' ); |
| 8 | 8 | |
| 9 | - add_submenu_page( 'formidable', 'Formidable | ' . __( 'Global Settings', 'formidable' ), __( 'Global Settings', 'formidable' ), 'frm_change_settings', 'formidable-settings', 'FrmSettingsController::route' ); |
|
| 10 | - } |
|
| 9 | + add_submenu_page( 'formidable', 'Formidable | ' . __( 'Global Settings', 'formidable' ), __( 'Global Settings', 'formidable' ), 'frm_change_settings', 'formidable-settings', 'FrmSettingsController::route' ); |
|
| 10 | + } |
|
| 11 | 11 | |
| 12 | - public static function license_box() { |
|
| 12 | + public static function license_box() { |
|
| 13 | 13 | $a = FrmAppHelper::simple_get( 't', 'sanitize_title', 'general_settings' ); |
| 14 | - include( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/license_box.php' ); |
|
| 15 | - } |
|
| 14 | + include( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/license_box.php' ); |
|
| 15 | + } |
|
| 16 | 16 | |
| 17 | - public static function display_form( $errors = array(), $message = '' ) { |
|
| 18 | - global $frm_vars; |
|
| 17 | + public static function display_form( $errors = array(), $message = '' ) { |
|
| 18 | + global $frm_vars; |
|
| 19 | 19 | |
| 20 | - $frm_settings = FrmAppHelper::get_settings(); |
|
| 21 | - $frm_roles = FrmAppHelper::frm_capabilities(); |
|
| 20 | + $frm_settings = FrmAppHelper::get_settings(); |
|
| 21 | + $frm_roles = FrmAppHelper::frm_capabilities(); |
|
| 22 | 22 | |
| 23 | - $uploads = wp_upload_dir(); |
|
| 24 | - $target_path = $uploads['basedir'] . '/formidable/css'; |
|
| 23 | + $uploads = wp_upload_dir(); |
|
| 24 | + $target_path = $uploads['basedir'] . '/formidable/css'; |
|
| 25 | 25 | |
| 26 | 26 | $sections = array(); |
| 27 | 27 | if ( apply_filters( 'frm_include_addon_page', false ) ) { |
@@ -30,55 +30,55 @@ discard block |
||
| 30 | 30 | 'name' => __( 'Plugin Licenses', 'formidable' ), |
| 31 | 31 | ); |
| 32 | 32 | } |
| 33 | - $sections = apply_filters( 'frm_add_settings_section', $sections ); |
|
| 33 | + $sections = apply_filters( 'frm_add_settings_section', $sections ); |
|
| 34 | 34 | |
| 35 | - $captcha_lang = FrmAppHelper::locales( 'captcha' ); |
|
| 35 | + $captcha_lang = FrmAppHelper::locales( 'captcha' ); |
|
| 36 | 36 | |
| 37 | - require( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/form.php' ); |
|
| 38 | - } |
|
| 37 | + require( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/form.php' ); |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | - public static function process_form( $stop_load = false ) { |
|
| 41 | - global $frm_vars; |
|
| 40 | + public static function process_form( $stop_load = false ) { |
|
| 41 | + global $frm_vars; |
|
| 42 | 42 | |
| 43 | - $frm_settings = FrmAppHelper::get_settings(); |
|
| 43 | + $frm_settings = FrmAppHelper::get_settings(); |
|
| 44 | 44 | |
| 45 | 45 | $process_form = FrmAppHelper::get_post_param( 'process_form', '', 'sanitize_text_field' ); |
| 46 | 46 | if ( ! wp_verify_nonce( $process_form, 'process_form_nonce' ) ) { |
| 47 | - wp_die( $frm_settings->admin_permission ); |
|
| 48 | - } |
|
| 47 | + wp_die( $frm_settings->admin_permission ); |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | - $errors = array(); |
|
| 51 | - $message = ''; |
|
| 50 | + $errors = array(); |
|
| 51 | + $message = ''; |
|
| 52 | 52 | |
| 53 | - if ( ! isset( $frm_vars['settings_routed'] ) || ! $frm_vars['settings_routed'] ) { |
|
| 54 | - //$errors = $frm_settings->validate($_POST,array()); |
|
| 55 | - $errors = apply_filters( 'frm_get_global_settings_errors', $errors ); |
|
| 53 | + if ( ! isset( $frm_vars['settings_routed'] ) || ! $frm_vars['settings_routed'] ) { |
|
| 54 | + //$errors = $frm_settings->validate($_POST,array()); |
|
| 55 | + $errors = apply_filters( 'frm_get_global_settings_errors', $errors ); |
|
| 56 | 56 | |
| 57 | - $frm_settings->update( stripslashes_deep( $_POST ) ); |
|
| 57 | + $frm_settings->update( stripslashes_deep( $_POST ) ); |
|
| 58 | 58 | |
| 59 | - if ( empty( $errors ) ) { |
|
| 60 | - $frm_settings->store(); |
|
| 61 | - $message = __( 'Settings Saved', 'formidable' ); |
|
| 62 | - } |
|
| 63 | - } else { |
|
| 64 | - $message = __( 'Settings Saved', 'formidable' ); |
|
| 65 | - } |
|
| 59 | + if ( empty( $errors ) ) { |
|
| 60 | + $frm_settings->store(); |
|
| 61 | + $message = __( 'Settings Saved', 'formidable' ); |
|
| 62 | + } |
|
| 63 | + } else { |
|
| 64 | + $message = __( 'Settings Saved', 'formidable' ); |
|
| 65 | + } |
|
| 66 | 66 | |
| 67 | 67 | if ( $stop_load == 'stop_load' ) { |
| 68 | - $frm_vars['settings_routed'] = true; |
|
| 69 | - return; |
|
| 70 | - } |
|
| 68 | + $frm_vars['settings_routed'] = true; |
|
| 69 | + return; |
|
| 70 | + } |
|
| 71 | 71 | |
| 72 | - self::display_form( $errors, $message ); |
|
| 73 | - } |
|
| 72 | + self::display_form( $errors, $message ); |
|
| 73 | + } |
|
| 74 | 74 | |
| 75 | - public static function route( $stop_load = false ) { |
|
| 76 | - $action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action'; |
|
| 75 | + public static function route( $stop_load = false ) { |
|
| 76 | + $action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action'; |
|
| 77 | 77 | $action = FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' ); |
| 78 | - if ( $action == 'process-form' ) { |
|
| 78 | + if ( $action == 'process-form' ) { |
|
| 79 | 79 | self::process_form( $stop_load ); |
| 80 | - } else if ( $stop_load != 'stop_load' ) { |
|
| 80 | + } else if ( $stop_load != 'stop_load' ) { |
|
| 81 | 81 | self::display_form(); |
| 82 | - } |
|
| 83 | - } |
|
| 82 | + } |
|
| 83 | + } |
|
| 84 | 84 | } |