settings_api === false ) $this->settings_api = new WPBM_Settings_API_General(); return $this->settings_api; } public function tabs() { $tabs = array(); $tabs[ 'wpbm-settings' ] = array( 'title' => __( 'Settings', 'booking-manager' ) // Title of TAB , 'page_title' => __( 'Settings', 'booking-manager' ) // Title of Page , 'hint' => __( 'Settings', 'booking-manager' ) // Hint , 'link' => '' // Can be skiped, then generated link based on Page and Tab tags. Or can be extenral link , 'position' => '' // 'left' || 'right' || '' , 'css_classes' => '' // CSS class(es) , 'icon' => '' // Icon - link to the real PNG img , 'font_icon' => 'glyphicon glyphicon-cog' // CSS definition of forn Icon , 'default' => ! true // Is this tab activated by default or not: true || false. ); $subtabs = array(); /* $subtabs['wpbm-settings-listing'] = array( 'type' => 'goto-link' , 'title' => __('Misc', 'booking-manager') , 'show_section' => 'wpbm_general_settings_wpbm_misc_metabox' ); $subtabs['wpbm-settings-menu-access'] = array( 'type' => 'goto-link' , 'title' => __('Plugin Menu', 'booking-manager') , 'show_section' => 'wpbm_general_settings_permissions_metabox' ); $subtabs['wpbm-settings-uninstall'] = array( 'type' => 'goto-link' , 'title' => __('Uninstall', 'booking-manager') , 'show_section' => 'wpbm_general_settings_uninstall_metabox' ); $subtabs['wpbm-settings-advanced'] = array( 'type' => 'goto-link' , 'title' => __('Advanced', 'booking-manager') , 'show_section' => 'wpbm_general_settings_advanced_metabox' ); $subtabs['form-save'] = array( 'type' => 'button' , 'title' => __('Save Changes', 'booking-manager') , 'form' => 'wpbm_general_settings_form' ); */ $subtabs['general'] = array( 'type' => 'subtab' // Required| Possible values: 'subtab' | 'separator' | 'button' | 'goto-link' | 'html' , 'title' => __('General Settings' , 'booking-manager') // Title of TAB , 'page_title' => __('General Settings', 'booking-manager') // Title of Page , 'hint' => __('General Settings' , 'booking-manager') // Hint , 'link' => '' // link , 'position' => '' // 'left' || 'right' || '' , 'css_classes' => '' // CSS class(es) //, 'icon' => 'http://.../icon.png' // Icon - link to the real PNG img //, 'font_icon' => 'glyphicon glyphicon-envelope' // CSS definition of Font Icon , 'default' => true // Is this sub tab activated by default or not: true || false. , 'disabled' => false // Is this sub tab deactivated: true || false. , 'checkbox' => false // or definition array for specific checkbox: array( 'checked' => true, 'name' => 'feature1_active_status' ) //, 'checkbox' => array( 'checked' => $is_checked, 'name' => 'enabled_active_status' ) , 'content' => 'content' // Function to load as conten of this TAB ); $tabs[ 'wpbm-settings' ]['subtabs'] = $subtabs; return $tabs; } public function content() { // Checking //////////////////////////////////////////////////////////// do_action( 'wpbm_hook_settings_page_header', array( 'page' => $this->in_page() ) ); // Define Notices Section and show some static messages, if needed. $is_can = apply_wpbm_filter('recheck_version', true); if ( ! $is_can ) { ?>settings_api(); // Define all fields and get values from DB // Submit ///////////////////////////////////////////////////////////// $submit_form_name = 'wpbm_general_settings_form'; // Define form name if ( isset( $_POST['is_form_sbmitted_'. $submit_form_name ] ) ) { // Nonce checking {Return false if invalid, 1 if generated between, 0-12 hours ago, 2 if generated between 12-24 hours ago. } $nonce_gen_time = check_admin_referer( 'wpbm_settings_page_' . $submit_form_name ); // Its stop show anything on submiting, if its not refear to the original page // Save Changes $this->update(); } //$wpbm_user_role_master = get_wpbm_option( 'wpbm_user_role_master' ); // O L D W A Y: Get Fields Data // JavaScript: Tooltips, Popover, Datepick (js & css) ////////////////// echo ''; wpbm_js_for_items_page(); echo ''; ?>
settings_api()->show( 'general' ); ?> settings_api()->show( 'wpbm_listing' ); ?> settings_api()->show( 'permissions' ); ?> settings_api()->show( 'uninstall' ); ?>
settings_api()->show( 'information' ); ?> settings_api()->show( 'advanced' ); ?>
' . basename(__FILE__ ) . ' ' . __FILE__ . ''); } public function update() { //debuge($_POST); $validated_fields = $this->settings_api()->validate_post(); // Get Validated Settings fields in $_POST request. $validated_fields = apply_filters( 'wpbm_settings_validate_fields_before_saving', $validated_fields ); //Hook for validated fields. //debuge($validated_fields); // Skip saving specific option, for example in Demo mode. // unset($validated_fields['wpbm_start_day_weeek']); $this->settings_api()->save_to_db( $validated_fields ); // Save fields to DB wpbm_show_changes_saved_message(); //debuge( basename(__FILE__), 'UPDATE', $_POST, $validated_fields); // O L D W A Y: Saving Fields Data // update_wpbm_option( 'wpbm_is_delete_if_deactive' // , WPBM_Settings_API::validate_checkbox_post('wpbm_is_delete_if_deactive') ); // ( (isset( $_POST['wpbm_is_delete_if_deactive'] ))?'On':'Off') ); } } //if ( $is_other_tab ) { // // if ( ( ! isset( $_GET['tab'] ) ) || ( $_GET['tab'] == 'general' ) ) { // If tab was not selected or selected default, then redirect it to the "form" tab. // $_GET['tab'] = 'form'; // } //} else { // add_action('wpbm_menu_created', array( new WPBM_Page_SettingsGeneral() , '__construct') ); // Executed after creation of Menu //} add_action('wpbm_menu_created', array( new WPBM_Page_SettingsGeneral() , '__construct') ); // Executed after creation of Menu