PluginProbe
Booking Manager – Sync WP Booking Calendar – Import Events, Export Bookings to ICS Calendar / 2.0
Booking Manager – Sync WP Booking Calendar – Import Events, Export Bookings to ICS Calendar v2.0
2.1.21 2.1.20 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 trunk 1.1 2.0 2.0.1 2.0.10.2 2.0.11 2.0.12 2.0.13 2.0.14 2.0.15 2.0.16 2.0.17 2.0.18 2.0.2 2.0.20 2.0.21 2.0.22 All 55 releases
booking-manager / core / admin / page-settings.php

page-settings.php in Booking Manager – Sync WP Booking Calendar – Import Events, Export Bookings to ICS Calendar 2.0, at core/admin/page-settings.php

286 lines 14.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php /**
2 * @version 1.0
3 * @package Booking Manager
4 * @category Content of Settings page
5 * @author wpdevelop
6 *
7 * @web-site http://oplugins.com/
8 * @email info@oplugins.com
9 *
10 * @modified 2015-11-02
11 */
12
13 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
14
15
16 /** Show Content
17 * Update Content
18 * Define Slug
19 * Define where to show
20 */
21 class WPBM_Page_SettingsGeneral extends WPBM_Page_Structure {
22
23 private $settings_api = false;
24
25 public function in_page() {
26
27 return 'oplugins';// 'wpbm-settings';
28 }
29
30 /** Get Settings API class - define, show, update "Fields".
31 *
32 * @return object Settings API
33 */
34 public function settings_api(){
35
36 if ( $this->settings_api === false )
37 $this->settings_api = new WPBM_Settings_API_General();
38
39 return $this->settings_api;
40 }
41
42 public function tabs() {
43
44 $tabs = array();
45
46 $tabs[ 'wpbm-settings' ] = array(
47 'title' => __( 'Settings', 'booking-manager' ) // Title of TAB
48 , 'page_title' => __( 'Settings', 'booking-manager' ) // Title of Page
49 , 'hint' => __( 'Settings', 'booking-manager' ) // Hint
50 , 'link' => '' // Can be skiped, then generated link based on Page and Tab tags. Or can be extenral link
51 , 'position' => '' // 'left' || 'right' || ''
52 , 'css_classes' => '' // CSS class(es)
53 , 'icon' => '' // Icon - link to the real PNG img
54 , 'font_icon' => 'glyphicon glyphicon-cog' // CSS definition of forn Icon
55 , 'default' => ! true // Is this tab activated by default or not: true || false.
56 );
57
58 $subtabs = array();
59
60 /*
61 $subtabs['wpbm-settings-listing'] = array( 'type' => 'goto-link'
62 , 'title' => __('Misc', 'booking-manager')
63 , 'show_section' => 'wpbm_general_settings_wpbm_misc_metabox'
64 );
65
66 $subtabs['wpbm-settings-menu-access'] = array( 'type' => 'goto-link'
67 , 'title' => __('Plugin Menu', 'booking-manager')
68 , 'show_section' => 'wpbm_general_settings_permissions_metabox'
69 );
70
71 $subtabs['wpbm-settings-uninstall'] = array( 'type' => 'goto-link'
72 , 'title' => __('Uninstall', 'booking-manager')
73 , 'show_section' => 'wpbm_general_settings_uninstall_metabox'
74 );
75
76 $subtabs['wpbm-settings-advanced'] = array( 'type' => 'goto-link'
77 , 'title' => __('Advanced', 'booking-manager')
78 , 'show_section' => 'wpbm_general_settings_advanced_metabox'
79 );
80
81
82
83 $subtabs['form-save'] = array(
84 'type' => 'button'
85 , 'title' => __('Save Changes', 'booking-manager')
86 , 'form' => 'wpbm_general_settings_form'
87 );
88 */
89
90 $subtabs['general'] = array(
91 'type' => 'subtab' // Required| Possible values: 'subtab' | 'separator' | 'button' | 'goto-link' | 'html'
92 , 'title' => __('General Settings' , 'booking-manager') // Title of TAB
93 , 'page_title' => __('General Settings', 'booking-manager') // Title of Page
94 , 'hint' => __('General Settings' , 'booking-manager') // Hint
95 , 'link' => '' // link
96 , 'position' => '' // 'left' || 'right' || ''
97 , 'css_classes' => '' // CSS class(es)
98 //, 'icon' => 'http://.../icon.png' // Icon - link to the real PNG img
99 //, 'font_icon' => 'glyphicon glyphicon-envelope' // CSS definition of Font Icon
100 , 'default' => true // Is this sub tab activated by default or not: true || false.
101 , 'disabled' => false // Is this sub tab deactivated: true || false.
102 , 'checkbox' => false // or definition array for specific checkbox: array( 'checked' => true, 'name' => 'feature1_active_status' ) //, 'checkbox' => array( 'checked' => $is_checked, 'name' => 'enabled_active_status' )
103 , 'content' => 'content' // Function to load as conten of this TAB
104 );
105
106 $tabs[ 'wpbm-settings' ]['subtabs'] = $subtabs;
107
108 return $tabs;
109 }
110
111
112 public function content() {
113
114 // Checking ////////////////////////////////////////////////////////////
115
116 do_action( 'wpbm_hook_settings_page_header', array( 'page' => $this->in_page() ) ); // Define Notices Section and show some static messages, if needed.
117
118 $is_can = apply_wpbm_filter('recheck_version', true); if ( ! $is_can ) { ?><script type="text/javascript"> jQuery(document).ready(function(){ jQuery( '.wpdvlp-sub-tabs').remove(); }); </script><?php return; }
119
120
121 // Init Settings API & Get Data from DB ////////////////////////////////
122 $this->settings_api(); // Define all fields and get values from DB
123
124 // Submit /////////////////////////////////////////////////////////////
125
126 $submit_form_name = 'wpbm_general_settings_form'; // Define form name
127
128 if ( isset( $_POST['is_form_sbmitted_'. $submit_form_name ] ) ) {
129
130 // Nonce checking {Return false if invalid, 1 if generated between, 0-12 hours ago, 2 if generated between 12-24 hours ago. }
131 $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
132
133 // Save Changes
134 $this->update();
135 }
136 //$wpbm_user_role_master = get_wpbm_option( 'wpbm_user_role_master' ); // O L D W A Y: Get Fields Data
137
138
139 // JavaScript: Tooltips, Popover, Datepick (js & css) //////////////////
140 echo '<span class="wpdevelop">';
141 wpbm_js_for_items_page();
142 echo '</span>';
143
144
145 ?><div class="clear"></div><?php
146
147 if ( 1 ) {
148 // Scroll links ////////////////////////////////////////////////////////
149 ?>
150 <div class="wpdvlp-sub-tabs" style="background:none;border:none;box-shadow: none;padding:0;"><span class="nav-tabs" style="text-align:right;">
151 <a onclick="javascript:wpbm_scroll_to('#wpbm_general_settings_wpbm_misc_metabox' );" href="javascript:void(0);" original-title="" class="nav-tab go-to-link"><span><?php
152 echo ucwords( __('Misc', 'booking-manager') ); ?></span></a>
153 </span>
154 <span class="nav-tabs" style="text-align:right;">
155 <a onclick="javascript:wpbm_scroll_to('#wpbm_general_settings_permissions_metabox' );" href="javascript:void(0);" original-title="" class="nav-tab go-to-link"><span><?php
156 echo ucwords( __('Plugin Menu', 'booking-manager') ); ?></span></a>
157 </span><span class="nav-tabs" style="text-align:right;">
158 <a onclick="javascript:wpbm_scroll_to('#wpbm_general_settings_uninstall_metabox' );" href="javascript:void(0);" original-title="" class="nav-tab go-to-link"><span><?php
159 echo ucwords( __('Uninstall', 'booking-manager') ); ?></span></a>
160 </span><span class="nav-tabs" style="text-align:right;">
161 <a onclick="javascript:wpbm_scroll_to('#wpbm_general_settings_advanced_metabox' );" href="javascript:void(0);" original-title="" class="nav-tab go-to-link"><span><?php
162 echo ucwords( __('Advanced', 'booking-manager') ); ?></span></a>
163 </span></div>
164 <?php
165 }
166
167
168 // Content ////////////////////////////////////////////////////////////
169 ?>
170 <div class="clear" style="margin-bottom:10px;"></div>
171 <span class="metabox-holder">
172 <form name="<?php echo $submit_form_name; ?>" id="<?php echo $submit_form_name; ?>" action="" method="post">
173 <?php
174 // N o n c e field, and key for checking S u b m i t
175 wp_nonce_field( 'wpbm_settings_page_' . $submit_form_name );
176 ?><input type="hidden" name="is_form_sbmitted_<?php echo $submit_form_name; ?>" id="is_form_sbmitted_<?php echo $submit_form_name; ?>" value="1" />
177
178 <div class="wpbm_settings_row wpbm_settings_row_left" >
179
180 <?php // wpbm_open_meta_box_section( 'wpbm_general_settings_calendar', __('General', 'booking-manager') ); ?>
181
182 <?php // $this->settings_api()->show( 'general' ); ?>
183
184 <?php // wpbm_close_meta_box_section(); ?>
185
186
187 <?php wpbm_open_meta_box_section( 'wpbm_general_settings_wpbm_misc', __('Miscellaneous', 'booking-manager') ); ?>
188
189 <?php $this->settings_api()->show( 'wpbm_listing' ); ?>
190
191 <?php wpbm_close_meta_box_section(); ?>
192
193
194 <?php wpbm_open_meta_box_section( 'wpbm_general_settings_permissions', __('Plugin Menu', 'booking-manager') ); ?>
195
196 <?php $this->settings_api()->show( 'permissions' ); ?>
197
198 <?php wpbm_close_meta_box_section(); ?>
199
200
201 <?php wpbm_open_meta_box_section( 'wpbm_general_settings_uninstall', __('Uninstall / deactivation', 'booking-manager') ); ?>
202
203 <?php $this->settings_api()->show( 'uninstall' ); ?>
204
205 <?php wpbm_close_meta_box_section(); ?>
206
207 </div>
208 <div class="wpbm_settings_row wpbm_settings_row_right">
209
210 <?php wpbm_open_meta_box_section( 'wpbm_general_settings_information', __('Information', 'booking-manager') ); ?>
211
212 <?php $this->settings_api()->show( 'information' ); ?>
213
214 <?php wpbm_close_meta_box_section(); ?>
215
216
217
218
219 <?php wpbm_open_meta_box_section( 'wpbm_general_settings_advanced', __('Advanced', 'booking-manager') ); ?>
220
221 <?php $this->settings_api()->show( 'advanced' ); ?>
222
223 <?php wpbm_close_meta_box_section(); ?>
224
225 </div>
226 <div class="clear"></div>
227 <input type="submit" value="<?php _e('Save Changes', 'booking-manager'); ?>" class="button button-primary wpbm_submit_button" />
228 </form>
229 <?php if ( ( isset( $_GET['system_info'] ) ) && ( $_GET['system_info'] == 'show' ) ) { ?>
230
231 <div class="clear" style="height:30px;"></div>
232
233 <?php wpbm_open_meta_box_section( 'wpbm_general_settings_system_info', 'System Info' ); ?>
234
235 <?php wpbm_system_info(); ?>
236
237 <?php wpbm_close_meta_box_section(); ?>
238
239 <?php } ?>
240
241 </span>
242 <?php
243
244
245
246 do_action( 'wpbm_hook_settings_page_footer', 'general_settings' );
247
248 //debuge( 'Content <strong>' . basename(__FILE__ ) . '</strong> <span style="font-size:9px;">' . __FILE__ . '</span>');
249 }
250
251
252 public function update() {
253 //debuge($_POST);
254 $validated_fields = $this->settings_api()->validate_post(); // Get Validated Settings fields in $_POST request.
255
256 $validated_fields = apply_filters( 'wpbm_settings_validate_fields_before_saving', $validated_fields ); //Hook for validated fields.
257 //debuge($validated_fields);
258 // Skip saving specific option, for example in Demo mode.
259 // unset($validated_fields['wpbm_start_day_weeek']);
260
261 $this->settings_api()->save_to_db( $validated_fields ); // Save fields to DB
262 wpbm_show_changes_saved_message();
263
264 //debuge( basename(__FILE__), 'UPDATE', $_POST, $validated_fields);
265
266 // O L D W A Y: Saving Fields Data
267 // update_wpbm_option( 'wpbm_is_delete_if_deactive'
268 // , WPBM_Settings_API::validate_checkbox_post('wpbm_is_delete_if_deactive') );
269 // ( (isset( $_POST['wpbm_is_delete_if_deactive'] ))?'On':'Off') );
270
271 }
272 }
273
274
275
276 //if ( $is_other_tab ) {
277 //
278 // if ( ( ! isset( $_GET['tab'] ) ) || ( $_GET['tab'] == 'general' ) ) { // If tab was not selected or selected default, then redirect it to the "form" tab.
279 // $_GET['tab'] = 'form';
280 // }
281 //} else {
282 // add_action('wpbm_menu_created', array( new WPBM_Page_SettingsGeneral() , '__construct') ); // Executed after creation of Menu
283 //}
284
285 add_action('wpbm_menu_created', array( new WPBM_Page_SettingsGeneral() , '__construct') ); // Executed after creation of Menu
286