PluginProbe
Booking Calendar / 11.8.1
Booking Calendar v11.8.1
11.8.2 11.8.1 11.8 11.7 11.6.1 11.6 11.5 11.4.3 11.4.2 11.4.1 11.4 11.3 11.2.1 11.2 11.1 11.0 10.15.7 10.15.6 10.1.3 10.10 10.10.1 10.10.2 10.11 10.11.2 10.11.3 All 202 releases
booking / core / wpbc-activation.php

wpbc-activation.php in Booking Calendar 11.8.1, at core/wpbc-activation.php

1,419 lines 78.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * @version 1.0
4 * @package Booking Calendar
5 * @subpackage Activation / Deactivation
6 * @category Functions
7 * @author wpdevelop
8 *
9 * @web-site https://wpbookingcalendar.com/
10 * @email info@wpbookingcalendar.com
11 * @modified 2016-03-17
12 */
13
14 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
15
16
17 /**
18 * Evaluate whether the current activation starts from a genuinely empty install.
19 *
20 * Both signals are required. A missing version option by itself is not reliable,
21 * because older installations or interrupted upgrades can still have Booking
22 * Calendar tables. A missing table by itself is also insufficient when stored
23 * installation metadata remains.
24 *
25 * @param mixed $stored_version Stored Booking Calendar version, or false when absent.
26 * @param bool $booking_table_exists Whether the canonical booking table exists.
27 *
28 * @return bool True only when neither installation signal exists.
29 */
30 function wpbc_is_plugin_initial_install_state( $stored_version, $booking_table_exists ) {
31
32 return ( false === $stored_version ) && ! (bool) $booking_table_exists;
33 }
34
35
36 /**
37 * Check whether the active activation request is a genuine first installation.
38 *
39 * The result is cached before activation creates tables or saves
40 * `booking_version_num`, allowing later activation callbacks to consume the same
41 * immutable request-scoped decision. For later administration requests, use the
42 * persisted first-install marker owned by the Setup Wizard instead.
43 *
44 * @return bool True during a genuine first-install activation; otherwise false.
45 */
46 function wpbc_is_plugin_initial_install() {
47
48 static $is_initial_install = null;
49
50 if ( null !== $is_initial_install ) {
51 return $is_initial_install;
52 }
53
54 if ( ! function_exists( 'wpbc_is_table_exists' ) ) {
55 $is_initial_install = false;
56 return $is_initial_install;
57 }
58
59 $is_initial_install = wpbc_is_plugin_initial_install_state(
60 get_option( 'booking_version_num', false ),
61 wpbc_is_table_exists( 'booking' )
62 );
63
64 return $is_initial_install;
65 }
66
67
68 /** Activation & Deactivation of Booking Calendar */
69 class WPBC_BookingInstall extends WPBC_Install {
70
71 /**
72 * Overload Booking Calendar option names and some other parameters
73 *
74 * //FixIn: 7.0.1.12
75 * Important! for correct loading of trasnaltions later, we must do not use here loacale of plugin. So here will be untranslated strings!!!
76 *
77 */
78 public function get_init_option_names() {
79
80 add_bk_action( 'wpdev_booking_activate_user', array( $this, 'wpbc_activate') ); // Hook for MU User activation
81
82 $links = array(
83 'option-version_num' => 'booking_version_num'
84 , 'option-is_delete_if_deactive' => 'booking_is_delete_if_deactive'
85 , 'option-activation_process' => 'booking_activation_process'
86 , 'transient-wpbc_activation_redirect' => '_booking_activation_redirect'
87 , 'message-delete_data' => '<strong>' . 'Warning!' . '</strong> '
88 . 'All booking data will be deleted when the plugin is deactivated.'
89 . '<br />'
90 . sprintf( 'If you want to save your booking data, please uncheck the %s"Delete booking data"%s at the'
91 , '<strong>', '</strong>')
92 . '<a href="' . esc_url( admin_url( add_query_arg( array( 'page' => 'wpbc-settings' ), 'admin.php' ) ) )
93 . '&scroll_to_section=wpbc_general_settings_uninstall_tab"> ' . 'settings page' . '.'
94 . ' </a>'
95 , 'link_settings' => '<a class="wpbc_plugins_links__settings" href="' . esc_url( admin_url( add_query_arg( array( 'page' => 'wpbc-settings' ), 'admin.php' ) ) )
96 . '">'. "Settings" .'</a>'
97 , 'link_whats_new' => '<a title="'. "Check new functionality in this plugin update." .'" href="'
98 . esc_url( admin_url( add_query_arg( array( 'page' => 'wpbc-about' ), 'index.php' ) ) )
99 .'">'. "What's New".'</a>'
100 , 'link_faq' => '<a title="FAQ" href="https://wpbookingcalendar.com/faq/">FAQ</a>'
101 , 'link_up' => '<a title="Check Pro functionality" href="https://wpbookingcalendar.com/features/#link_up" style="color: rgb(0, 163, 42);font-weight:700;">Get Pro</a>'
102 , 'link_upgrade' => '<a title="Upgrade to higher version" href="'
103 . esc_url( admin_url( add_query_arg( array( 'page' => 'wpbc-settings', 'tab' => 'upgrade' ), 'admin.php' ) ) )
104 . '" style="color: rgb(0, 163, 42);font-weight:700;">Get More</a>'
105 );
106
107 return $links;
108
109 }
110
111 /** Check if was updated from lower to high version */
112 public function is_update_from_lower_to_high_version() {
113
114 $is_make_activation = false;
115
116 // Check conditions for different version about Upgrade
117 if ( ( class_exists( 'wpdev_bk_personal' ) ) && ( ! wpbc_is_table_exists( 'bookingtypes' ) ) ) {
118 $is_make_activation = true;
119 }
120 if ( ( ! $is_make_activation ) && ( class_exists( 'wpdev_bk_biz_s' ) ) && ( wpbc_is_field_in_table_exists( 'booking', 'pay_request' ) == 0 ) ) {
121 $is_make_activation = true;
122 }
123 // FixIn: 9.9.0.13.
124 if ( ( ! $is_make_activation ) && ( class_exists( 'wpdev_bk_biz_m' ) ) && ( ! wpbc_is_table_exists( 'booking_seasons' ) ) ) {
125 $is_make_activation = true;
126 }
127 if ( ( ! $is_make_activation ) && ( class_exists( 'wpdev_bk_biz_m' ) ) && ( wpbc_is_field_in_table_exists( 'booking_seasons', 'season_color' ) == 0 ) ) {
128 $is_make_activation = true;
129 }
130 if ( ( ! $is_make_activation ) && ( class_exists( 'wpdev_bk_biz_l' ) ) && ( ! wpbc_is_table_exists( 'booking_coupons' ) ) ) {
131 $is_make_activation = true;
132 }
133 if ( ( ! $is_make_activation ) && ( class_exists( 'wpdev_bk_multiuser' ) ) && ( wpbc_is_field_in_table_exists( 'booking_coupons', 'users' ) == 0 ) ) {
134 $is_make_activation = true;
135 }
136
137 return $is_make_activation;
138 }
139
140 }
141
142
143
144
145 // <editor-fold defaultstate="collapsed" desc=" Support & Maintence " >
146
147 /** Reindex DataBase to have "date key field" for be able to sort by dates. */
148 function wpbc_reindex_booking_db(){ global $wpdb;
149 $is_show_messages = false;
150 // if ( ( wpbc_is_settings_page('QUERY_STRING') ) && ( strpos($_SERVER[ 'QUERY_STRING' ],'reindex_sort_data=1') !== false ) )
151 // $is_show_messages = true;
152
153
154 if ($is_show_messages) {
155 // Hide all settings
156 // phpcs:ignore WordPress.WP.EnqueuedResources.NonEnqueuedStylesheet
157 ?><style type="text/css" rel="stylesheet" >
158 #post_option .meta-box {
159 display:none;
160 }
161 #post_option .button-primary {
162 display:none;
163 }
164 #post_option .technical-booking-section {
165 display:block;
166 }
167 </style>
168 <?php
169 }
170
171 if (wpbc_is_field_in_table_exists('booking','sort_date') == 0) {
172 $simple_sql = "ALTER TABLE {$wpdb->prefix}booking ADD COLUMN sort_date datetime"; // FixIn: 10.12.1.5.
173 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter
174 $wpdb->query( $simple_sql );
175 }
176
177 // Refill the sort date index.
178 if (wpbc_is_field_in_table_exists('booking','sort_date') != 0) {
179
180 $bookings_res = array();
181
182 // 1. Select all bookings ID, where sort_date is NULL in wp_booking.
183 $sql = " SELECT booking_id as id FROM {$wpdb->prefix}booking as bk WHERE sort_date IS NULL";
184
185 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter, WordPress.DB.PreparedSQL.InterpolatedNotPrepared
186 $bookings_res = $wpdb->get_results( $sql );
187
188 if ( $is_show_messages ) {
189 /* translators: 1: ... */
190 echo esc_html( sprintf( __( '%1$s Found %2$s not indexed bookings %3$s', 'booking' ), ' ', count( $bookings_res ), '<br/>' ) );
191 }
192
193
194 if ( count( $bookings_res ) > 0 ) {
195 $id_string = '';
196 foreach ($bookings_res as $value) { $id_string .= $value->id . ','; }
197 $id_string = substr($id_string,0,-1);
198
199 //2. Select all (FIRST ??) booking_date, where booking_id = booking_id from #1 in wp_bookingdates
200 $sql = " SELECT booking_id as id, booking_date as date" ;
201 $sql .= " FROM {$wpdb->prefix}bookingdates as bdt" ;
202 $sql .= " WHERE booking_id IN ( ". $id_string ." ) GROUP BY bdt.booking_id ORDER BY bdt.booking_date " ;
203
204 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter
205 $sort_date_array = $wpdb->get_results( $sql );
206
207 if ( $is_show_messages ) {
208 /* translators: 1: ... */
209 echo esc_html( sprintf( __( '%1$s Finish getting sort dates. %2$s', 'booking' ), ' ', '<br/>' ) );
210 }
211
212 //3. Insert that firtst date into the bookings in wp_booking
213 $ii=0;
214 foreach ($sort_date_array as $value) { $ii++;
215 $sql = "UPDATE {$wpdb->prefix}booking ";
216 $sql .= " SET sort_date = '".$value->date. "' WHERE booking_id = ". $value->id . " ";
217 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter
218 $wpdb->query( $sql );
219
220 if ( $is_show_messages ) {
221 /* translators: 1: ... */
222 echo esc_html( sprintf( __( 'Updated booking: %s', 'booking' ), $value->id . ' [' . $ii . ' / ' . count( $bookings_res ) . '] <br/>' ) );
223 }
224 }
225 }
226
227 }
228
229
230 }
231
232 // </editor-fold>
233
234
235
236 ////////////////////////////////////////////////////////////////////////////////
237 // A c t i v a t e & D e a c t i v a t e
238 ////////////////////////////////////////////////////////////////////////////////
239
240 /** Activation */
241 function wpbc_booking_activate() {
242
243 wpbc_load_translation();
244
245 $is_new_install = wpbc_is_plugin_initial_install();
246
247 make_bk_action( 'wpbc_before_activation' );
248
249
250
251 $version = wpbc_get_plugin_version_type();
252 $is_demo = wpbc_is_this_demo();
253
254 // -----------------------------------------------------------------------------------------------------------------
255 // Options
256 // -----------------------------------------------------------------------------------------------------------------
257 $default_options_to_add = wpbc_get_default_options();
258 // Existing installations retain their saved value; add_bk_option() never overwrites it during upgrades.
259 if ( $is_new_install ) {
260 $default_options_to_add['booking_form_accent_enabled'] = 'On';
261 $default_options_to_add['booking_setup_wizard_initial_install'] = 'On';
262 $default_options_to_add['booking_setup_wizard_first_run_prompt'] = 'On';
263 $default_options_to_add['booking_setup_wizard_booking_pages_prompt'] = 'On';
264 if ( ! class_exists( 'wpdev_bk_personal' ) ) {
265 $default_options_to_add['booking_resources_catalog_default_view'] = 'publishing';
266 }
267 }
268 // TODO: for Import / Export options, we can use this function to get all option_names and then just get the real values from the wp_options table.
269 make_bk_action( 'wpbc_before_activation__add_options', $default_options_to_add ); // FixIn: 9.6.2.11.
270
271 foreach ( $default_options_to_add as $default_option_name => $default_option_value ) {
272 add_bk_option( $default_option_name, $default_option_value );
273 }
274
275
276 // -----------------------------------------------------------------------------------------------------------------
277 // DB Tables
278 // -----------------------------------------------------------------------------------------------------------------
279 if ( true ){
280
281 global $wpdb;
282
283 // ----------------------------------------------------------------------------
284 // Charset / Collation
285 // ----------------------------------------------------------------------------
286 $charset_collate = '';
287 if ( ! empty( $wpdb->charset ) ) {
288 $charset_collate = "DEFAULT CHARACTER SET {$wpdb->charset}";
289 }
290 if ( ! empty( $wpdb->collate ) ) {
291 $charset_collate .= " COLLATE {$wpdb->collate}";
292 }
293
294 // ----------------------------------------------------------------------------
295 // Table name
296 // ----------------------------------------------------------------------------
297 $table_name = $wpdb->prefix . 'booking';
298
299 // ----------------------------------------------------------------------------
300 // Queries queue for upgrades only
301 // ----------------------------------------------------------------------------
302 $wp_queries = array();
303
304 // ----------------------------------------------------------------------------
305 // 1) First install: CREATE booking TABLE.
306 // ----------------------------------------------------------------------------
307 if ( ! wpbc_is_table_exists( 'booking' ) ) {
308
309 $create_sql = "CREATE TABLE {$table_name} (
310 booking_id bigint(20) unsigned NOT NULL auto_increment,
311 booking_type bigint(10) NOT NULL default 1,
312
313 form TEXT,
314 hash TEXT,
315 booking_options TEXT,
316 status varchar(200) NOT NULL default '',
317
318 is_new bigint(10) NOT NULL default 1,
319 sync_gid varchar(200) NOT NULL default '',
320 trash bigint(10) NOT NULL default 0,
321 is_trash datetime,
322
323 sort_date datetime,
324 modification_date datetime,
325 creation_date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
326
327 PRIMARY KEY (booking_id)
328 ) {$charset_collate};";
329
330 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter
331 $wpdb->query( $create_sql );
332
333 // ----------------------------------------------------------------------------
334 // 2) Upgrade path: only add missing columns (your current logic)
335 // ----------------------------------------------------------------------------
336 } else {
337
338 if ( wpbc_is_field_in_table_exists( 'booking', 'form' ) == 0 ) {
339 $wp_queries[] = "ALTER TABLE {$table_name} ADD COLUMN form TEXT";
340 }
341
342 if ( wpbc_is_field_in_table_exists( 'booking', 'modification_date' ) == 0 ) {
343 $wp_queries[] = "ALTER TABLE {$table_name} ADD COLUMN modification_date datetime";
344 }
345
346 // FixIn: 9.2.3.3.
347 if ( wpbc_is_field_in_table_exists( 'booking', 'creation_date' ) == 0 ) {
348 $wp_queries[] = "ALTER TABLE {$table_name} ADD COLUMN creation_date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP";
349 }
350
351 if ( wpbc_is_field_in_table_exists( 'booking', 'sort_date' ) == 0 ) {
352 $wp_queries[] = "ALTER TABLE {$table_name} ADD COLUMN sort_date datetime";
353 }
354
355 if ( wpbc_is_field_in_table_exists( 'booking', 'status' ) == 0 ) {
356 $wp_queries[] = "ALTER TABLE {$table_name} ADD COLUMN status varchar(200) NOT NULL default ''";
357 }
358
359 if ( wpbc_is_field_in_table_exists( 'booking', 'is_new' ) == 0 ) {
360 $wp_queries[] = "ALTER TABLE {$table_name} ADD COLUMN is_new bigint(10) NOT NULL default 1";
361 }
362
363 // Version: 5.2 - Google ID for Sync
364 if ( wpbc_is_field_in_table_exists( 'booking', 'sync_gid' ) == 0 ) {
365 $wp_queries[] = "ALTER TABLE {$table_name} ADD COLUMN sync_gid varchar(200) NOT NULL default ''";
366 }
367
368 // FixIn: 9.2.3.5.
369 if ( wpbc_is_field_in_table_exists( 'booking', 'is_trash' ) == 0 ) {
370 $wp_queries[] = "ALTER TABLE {$table_name} ADD COLUMN is_trash datetime";
371 }
372
373 // FixIn: 6.1.1.10.
374 if ( wpbc_is_field_in_table_exists( 'booking', 'trash' ) == 0 ) {
375 $wp_queries[] = "ALTER TABLE {$table_name} ADD COLUMN trash bigint(10) NOT NULL default 0";
376 }
377
378 // FixIn: 9.1.2.12.
379 if ( wpbc_is_field_in_table_exists( 'booking', 'booking_options' ) == 0 ) {
380 $wp_queries[] = "ALTER TABLE {$table_name} ADD COLUMN booking_options TEXT";
381 }
382
383 if ( wpbc_is_field_in_table_exists( 'booking', 'hash' ) == 0 ) {
384 $wp_queries[] = "ALTER TABLE {$table_name} ADD COLUMN hash TEXT";
385
386 // Update hash value only in last 100 bookings.
387 $sql_check_table = "SELECT booking_id as id FROM {$wpdb->prefix}booking ORDER BY booking_id DESC LIMIT 0, 100";
388
389 $res = $wpdb->get_results( $sql_check_table ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter
390 foreach ( $res as $l ) {
391 $wp_queries[] = $wpdb->prepare(
392 "UPDATE {$wpdb->prefix}booking SET hash = %s WHERE booking_id = %d",
393 wpbc_hash__generate_booking_hash(),
394 $l->id
395 ); // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared
396 }
397 }
398 }
399
400 // ----------------------------------------------------------------------------
401 // Execute queued upgrade queries (only runs on upgrades, not new install)
402 // ----------------------------------------------------------------------------
403 if ( ! empty( $wp_queries ) ) {
404 foreach ( $wp_queries as $sql ) {
405 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter
406 $wpdb->query( $sql );
407 }
408 }
409
410
411 $is_insert_test_bookings = false;
412
413 // ----------------------------------------------------------------------------
414 // 2. Install: CREATE bookingdate TABLE.
415 // ----------------------------------------------------------------------------
416
417 if ( ! wpbc_is_table_exists( 'bookingdates' ) ) {
418 // Check if tables not exist yet.
419 $simple_sql = "CREATE TABLE {$wpdb->prefix}bookingdates (
420 booking_dates_id bigint(20) unsigned NOT NULL auto_increment,
421 booking_id bigint(20) unsigned NOT NULL,
422 booking_date datetime NOT NULL default '0000-00-00 00:00:00',
423 approved bigint(20) unsigned NOT NULL default 0,
424 PRIMARY KEY (booking_dates_id)
425 ) {$charset_collate}";
426
427 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter
428 $wpdb->query( $simple_sql );
429
430 if ( ! class_exists( 'wpdev_bk_personal' ) ) {
431 $is_insert_test_bookings = true;
432 }
433 }
434
435 if ( 0 === wpbc_is_index_in_table_exists( 'bookingdates', 'booking_id_dates' ) ) {
436 // If we remove this index, so then its can significant impact to the speed of page loading at the Booking Listing and Timelines.
437 // Index for SPEED opening Booking Listing and Timeline with thousands of Bookings, otherwise, without this index, speed will be TOO SLOW...
438 $simple_sql = "CREATE UNIQUE INDEX booking_id_dates ON {$wpdb->prefix}bookingdates ( booking_id, booking_date);";
439 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter
440 $wpdb->query( $simple_sql );
441 }
442
443 // ----------------------------------------------------------------------------
444 // 3. Insert test bookings.
445 // ----------------------------------------------------------------------------
446
447 if ( $is_insert_test_bookings ) {
448 // -- Test Booking #1 --
449 $is_appr = 1;
450 $wp_queries_sub = "INSERT INTO {$wpdb->prefix}booking ( form, modification_date ) VALUES (
451 'text^firstname1^John~text^secondname1^Smith~text^email1^example-free@wpbookingcalendar.com~text^phone1^458-77-77~textarea^details1^This is a test booking showing booking for several days.', " . wpbc_sql_date_math_expr_explicit('', 'now') . " );";
452 $wpdb->query( $wp_queries_sub ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter
453
454 $temp_id = $wpdb->insert_id;
455 $wp_queries_sub = "INSERT INTO {$wpdb->prefix}bookingdates ( booking_id, booking_date, approved ) VALUES
456 ( " . $temp_id . ", " . wpbc_sql_date_math_expr_explicit( "+ INTERVAL 2 DAY", 'curdate' ) . " ," . $is_appr . " ),
457 ( " . $temp_id . ", " . wpbc_sql_date_math_expr_explicit( "+ INTERVAL 3 DAY", 'curdate' ) . " ," . $is_appr . " ),
458 ( " . $temp_id . ", " . wpbc_sql_date_math_expr_explicit( "+ INTERVAL 4 DAY", 'curdate' ) . " ," . $is_appr . " );";
459 $wpdb->query( $wp_queries_sub ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter
460
461 // -- Test Booking #2 --
462 $is_appr = 0;
463 $wp_queries_sub = "INSERT INTO {$wpdb->prefix}booking ( form, modification_date ) VALUES (
464 'text^firstname1^Emma~text^secondname1^Robinson~text^email1^example-free@wpbookingcalendar.com~text^phone1^999-77-77~textarea^details1^This is a test booking showing booking for several days.', " . wpbc_sql_date_math_expr_explicit('', 'now') . " );";
465 $wpdb->query( $wp_queries_sub ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter
466
467 $temp_id = $wpdb->insert_id;
468 $wp_queries_sub = "INSERT INTO {$wpdb->prefix}bookingdates ( booking_id, booking_date, approved ) VALUES
469 ( " . $temp_id . ", " . wpbc_sql_date_math_expr_explicit( "+ INTERVAL 28 DAY", 'curdate' ) . " ," . $is_appr . " ),
470 ( " . $temp_id . ", " . wpbc_sql_date_math_expr_explicit( "+ INTERVAL 29 DAY", 'curdate' ) . " ," . $is_appr . " ),
471 ( " . $temp_id . ", " . wpbc_sql_date_math_expr_explicit( "+ INTERVAL 30 DAY", 'curdate' ) . " ," . $is_appr . " );";
472 $wpdb->query( $wp_queries_sub ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter
473
474
475 // -- Test Booking #3 --
476 $is_appr = 1;
477 $start_time = '10:00';
478 $end_time = '10:30';
479 $wp_queries_sub = "INSERT INTO {$wpdb->prefix}booking ( form, modification_date, is_new ) VALUES (
480 'selectbox^rangetime1^".$start_time." - ".$end_time."~text^firstname1^Sophia~text^secondname1^Robinson~text^email1^example-free@wpbookingcalendar.com~text^phone1^458-77-77~textarea^details1^This is a test booking showing a one day time slot booking.', " . wpbc_sql_date_math_expr_explicit('', 'now') . ", 0 );";
481 $wpdb->query( $wp_queries_sub ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter
482
483 $temp_id = $wpdb->insert_id;
484
485 $start_time_arr = explode( ':', $start_time );
486 $end_time_arr = explode( ':', $end_time );
487 $wp_queries_sub = "INSERT INTO {$wpdb->prefix}bookingdates ( booking_id, booking_date, approved ) VALUES
488 ( " . $temp_id . ", " . wpbc_sql_date_math_expr_explicit( "+ INTERVAL '" . ( ( 8 * 24 ) + intval( $start_time_arr[0] ) ) . ':' . $start_time_arr[1] . ":01' HOUR_SECOND", 'curdate' ) . " ," . $is_appr . " ),
489 ( " . $temp_id . ", " . wpbc_sql_date_math_expr_explicit( "+ INTERVAL '" . ( ( 8 * 24 ) + intval( $end_time_arr[0] ) ) . ':' . $end_time_arr[1] . ":02' HOUR_SECOND", 'curdate' ) . " ," . $is_appr . " );";
490 $wpdb->query( $wp_queries_sub ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter
491 }
492 }
493
494 make_bk_action( 'wpbc_free_version_activation' );
495
496 do_action( 'wpbc_free_version_activation' );
497
498 // -----------------------------------------------------------------------------------------------------------------
499 // Other versions Activation
500 // -----------------------------------------------------------------------------------------------------------------
501 make_bk_action( 'wpbc_other_versions_activation' );
502
503 do_action( 'wpbc_pro_versions_activation' );
504
505 wpbc_reindex_booking_db();
506
507 make_bk_action( 'wpbc_after_activation' );
508
509 do_action( 'wpbc_after_activation' );
510 }
511 add_bk_action( 'wpbc_activation', 'wpbc_booking_activate' );
512
513
514 /**
515 * Determine whether the commercial registration data must survive full data removal.
516 *
517 * Demo sites need to retain the validated commercial registration payload so that
518 * resetting demo booking data does not expose the order-number registration form.
519 * Requiring both the established demo check and the official domain prevents this
520 * exception from changing cleanup behavior on customer, local, or beta websites.
521 *
522 * @return bool True when registration data must be preserved; otherwise false.
523 */
524 function wpbc_deactivation__should_preserve_registration_data() {
525
526 if ( ! function_exists( 'wpbc_is_this_demo' ) || ! wpbc_is_this_demo() ) {
527 return false;
528 }
529
530 $site_host = wp_parse_url( home_url( '/' ), PHP_URL_HOST );
531
532 if ( ! is_string( $site_host ) || '' === $site_host ) {
533 return false;
534 }
535
536 $site_host = strtolower( rtrim( $site_host, '.' ) );
537 $official_demo_host = 'wpbookingcalendar.com';
538 $official_demo_suffix = '.' . $official_demo_host;
539
540 if ( $official_demo_host === $site_host ) {
541 return true;
542 }
543
544 return strlen( $site_host ) > strlen( $official_demo_suffix )
545 && $official_demo_suffix === substr( $site_host, -strlen( $official_demo_suffix ) );
546 }
547
548
549 /**
550 * Delete every site option and transient owned by Booking Calendar.
551 *
552 * The historical deactivation path deletes options returned by
553 * wpbc_get_default_options(). Runtime modules also create version markers,
554 * setup state, caches, and transients outside that registry. This final pass
555 * runs after all module callbacks so those callbacks can still read their
556 * settings while removing tables and other data.
557 *
558 * @return void
559 */
560 function wpbc_deactivation__delete_all_plugin_options() {
561
562 global $wpdb;
563
564 $option_name_patterns = array(
565 $wpdb->esc_like( 'booking_' ) . '%',
566 $wpdb->esc_like( 'wpbc_' ) . '%',
567 $wpdb->esc_like( '_transient_' ) . '%' . $wpdb->esc_like( 'booking_' ) . '%',
568 $wpdb->esc_like( '_transient_' ) . '%' . $wpdb->esc_like( 'wpbc_' ) . '%',
569 $wpdb->esc_like( '_site_transient_' ) . '%' . $wpdb->esc_like( 'booking_' ) . '%',
570 $wpdb->esc_like( '_site_transient_' ) . '%' . $wpdb->esc_like( 'wpbc_' ) . '%',
571 );
572
573 $sql = $wpdb->prepare(
574 "SELECT option_name
575 FROM {$wpdb->options}
576 WHERE option_name LIKE %s
577 OR option_name LIKE %s
578 OR option_name LIKE %s
579 OR option_name LIKE %s
580 OR option_name LIKE %s
581 OR option_name LIKE %s",
582 $option_name_patterns
583 );
584
585 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared
586 $option_names = $wpdb->get_col( $sql );
587 $option_names = is_array( $option_names ) ? array_unique( $option_names ) : array();
588
589 if ( ! wpbc_deactivation__should_preserve_registration_data() ) {
590 $option_names[] = 'bk_version_data';
591 }
592
593 foreach ( $option_names as $option_name ) {
594 delete_option( $option_name );
595 }
596 }
597
598
599
600 // Deactivate.
601 function wpbc_booking_deactivate() {
602
603 // -----------------------------------------------------------------------------------------------------------------
604 // Options
605 // -----------------------------------------------------------------------------------------------------------------
606 $default_options_to_add = wpbc_get_default_options();
607 foreach ( $default_options_to_add as $default_option_name => $default_option_value) {
608
609 delete_bk_option( $default_option_name );
610 }
611
612
613 // -----------------------------------------------------------------------------------------------------------------
614 // Widgets
615 // -----------------------------------------------------------------------------------------------------------------
616 delete_bk_option( 'widget_bookingwidget' );
617 delete_bk_option( 'widget_bookingsearchwidget' );
618 delete_bk_option( 'widget_bookingselectwidget' );
619 delete_bk_option( 'booking_activation_redirect_for_version' );
620
621 // -----------------------------------------------------------------------------------------------------------------
622 // DB Tables
623 // -----------------------------------------------------------------------------------------------------------------
624 global $wpdb;
625 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter, WordPress.DB.DirectDatabaseQuery.SchemaChange
626 $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}booking" );
627 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter, WordPress.DB.DirectDatabaseQuery.SchemaChange
628 $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}bookingdates" );
629
630 // Delete all Booking Calendar user options, listing state, and dismissed notices.
631 $booking_meta_pattern = '%' . $wpdb->esc_like( 'booking_' ) . '%';
632 $wpbc_meta_pattern = '%' . $wpdb->esc_like( 'wpbc_' ) . '%';
633 $user_meta_delete_sql = $wpdb->prepare(
634 "DELETE FROM {$wpdb->usermeta} WHERE meta_key LIKE %s OR meta_key LIKE %s",
635 $booking_meta_pattern,
636 $wpbc_meta_pattern
637 );
638 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter
639 if ( false === $wpdb->query( $user_meta_delete_sql ) ) {
640 debuge_error('Error during deleting user meta at DB',__FILE__,__LINE__);
641 die();
642 }
643
644 // Delete or Drafts and Pending from demo sites
645 if ( wpbc_is_this_demo() ) { // Delete all temp posts at the demo sites: (post_status = pending || draft) && ( post_type = post ) && (post_author != 1)
646 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter,
647 $postss = $wpdb->get_results( "SELECT * FROM {$wpdb->posts} WHERE ( post_status = 'pending' OR post_status = 'draft' OR post_status = 'auto-draft' OR post_status = 'trash' OR post_status = 'inherit' ) AND ( post_type='post' OR post_type='revision') AND post_author != 1" );
648 foreach ( $postss as $pp ) {
649 wp_delete_post( $pp->ID, true );
650 }
651 }
652 make_bk_action( 'wpbc_free_version_deactivation' );
653 ////////////////////////////////////////////////////////////////////////////
654 // Other versions Deactivation
655 ////////////////////////////////////////////////////////////////////////////
656 make_bk_action( 'wpbc_other_versions_deactivation' );
657
658 wpbc_deactivation__delete_all_plugin_options();
659 }
660 add_bk_action( 'wpbc_deactivation', 'wpbc_booking_deactivate' );
661
662
663 /**
664 * Default Options
665 *
666 * Exmaple of getting options for deleting in MU:
667 *
668 * $option_name = '';
669 * $is_get_multiuser_general_options = true;
670 * $options_for_delete = wpbc_get_default_options( $option_name, $is_get_multiuser_general_options );
671 */
672 function wpbc_get_default_options( $option_name = '', $is_get_multiuser_general_options = false ) {
673
674 $is_demo = wpbc_is_this_demo();
675 $is_free_version = ! class_exists( 'wpdev_bk_personal' );
676 $blg_title = str_replace( array( '"', "'" ), '', get_option( 'blogname' ) );
677
678 $default_options = array();
679
680 // If this option here, then system get this option from "Super Admin" options configuration for "Regular" users.
681 $mu_option4delete = array();
682
683 // FixIn: 9.6.3.5.
684 $default_options['booking_setup_wizard_page_steps_is_done'] = '';
685 $mu_option4delete[]='booking_setup_wizard_page_steps_is_done';
686 $default_options['booking_setup_wizard_initial_install'] = 'Off';
687 $mu_option4delete[] = 'booking_setup_wizard_initial_install';
688 $default_options['booking_setup_wizard_first_run_prompt'] = 'Off';
689 $mu_option4delete[] = 'booking_setup_wizard_first_run_prompt';
690 $default_options['booking_setup_wizard_booking_pages_prompt'] = 'Off';
691 $mu_option4delete[] = 'booking_setup_wizard_booking_pages_prompt';
692
693 $default_options['booking_admin_cal_count'] = ($is_demo) ? '3' : '2';
694 $mu_option4delete[]='booking_admin_cal_count'; // $multiuser_general_option[] = implode( '', array_keys( array_slice( $default_options, -1 ) ) );
695 $default_options['booking_skin'] = '/css/skins/25_5__square_1.css'; // FixIn: 10.11.4.2.
696 $mu_option4delete[]='booking_skin';
697 // FixIn: 9.6.3.5.
698 $default_options['booking_listing_default_view_mode'] = 'vm_booking_listing'; // 'vm_calendar'; // FixIn: 9.6.3.5.
699 $mu_option4delete[]='booking_listing_default_view_mode';
700 $default_options['booking_admin_edit_booking_mode'] = 'popup';
701 $mu_option4delete[]='booking_admin_edit_booking_mode';
702 $default_options['booking_resources_catalog_default_view'] = '';
703 $mu_option4delete[] = 'booking_resources_catalog_default_view';
704
705 $default_options['booking_view_days_num'] = ( ( ! class_exists( 'wpdev_bk_personal' ) ) ? '90' : '30' );
706 $mu_option4delete[]='booking_view_days_num';
707 // FixIn: 8.9.4.3.
708 $default_options['booking_calendar_overview__day_mode__days_number_show'] = ( ( ! class_exists( 'wpdev_bk_personal' ) ) ? '7' : '7' );
709 $mu_option4delete[]='booking_calendar_overview__day_mode__days_number_show';
710 $default_options['booking_timeline__month_mode__days_number_show'] = ( ( ! class_exists( 'wpdev_bk_personal' ) ) ? '7' : '7' );
711 $mu_option4delete[]='booking_timeline__month_mode__days_number_show';
712 // FixIn: 8.6.1.13.
713 $default_options['booking_max_monthes_in_calendar'] = '2y';
714 $mu_option4delete[]='booking_max_monthes_in_calendar';
715 $default_options['booking_client_cal_count'] = '1';
716 $mu_option4delete[]='booking_client_cal_count';
717 $default_options['booking_start_day_weeek'] = '0';
718 $mu_option4delete[]='booking_start_day_weeek';
719 $default_options['booking_title_after_reservation'] = ( ! class_exists( 'wpdev_bk_biz_s' ) )
720 ? __( 'Your booking is received. We will confirm it soon. Many thanks!', 'booking' )
721 : __( 'Your booking is received. Please proceed with payment to confirm it. Many thanks!', 'booking' );
722 $mu_option4delete[]='booking_title_after_reservation';
723 // $default_options['booking_title_after_reservation_time'] = '7000';
724 //$mu_option4delete[]='booking_title_after_reservation_time';
725 $default_options['booking_type_of_thank_you_message'] = 'message';
726 $mu_option4delete[]='booking_type_of_thank_you_message';
727 $default_options['booking_thank_you_page_URL'] = '/thank-you';
728 $mu_option4delete[]='booking_thank_you_page_URL';
729 $default_options['booking_is_use_autofill_4_logged_user'] = ($is_demo) ? 'On' : 'Off';
730 $mu_option4delete[]='booking_is_use_autofill_4_logged_user';
731
732 // FixIn: 10.13.1.5.
733 $default_options['booking_is_use_phone_validation'] = 'Off';
734 $mu_option4delete[]='booking_is_use_phone_validation';
735 $wordpress_date_format = get_option( 'date_format' );
736 $default_options['booking_date_format'] = ( 'F j, Y' === $wordpress_date_format ) ? 'j M Y' : $wordpress_date_format;
737 $mu_option4delete[]='booking_date_format';
738 $default_options['booking_time_format'] = get_option( 'time_format' ); //'H:i';
739 $mu_option4delete[]='booking_time_format';
740
741 //FixIn:10.2.0.1 ------------------------------------------------------------------------------------------------
742 // Confirmation section:
743 $default_options['booking_confirmation_header_enabled'] = 'On';
744 /* translators: 1: ... */
745 $default_options['booking_confirmation_header'] = sprintf( __( 'Your booking id: %s', 'booking' ), '<strong>[booking_id]</strong>' );
746 $mu_option4delete[] = 'booking_confirmation_header_enabled';
747 $mu_option4delete[] = 'booking_confirmation_header';
748
749 $default_options['booking_confirmation__personal_info__header_enabled'] = 'On';
750 $default_options['booking_confirmation__personal_info__title'] = __( 'Personal information', 'booking' );
751 $default_options['booking_confirmation__personal_info__content'] = '[content]';
752 $mu_option4delete[] = 'booking_confirmation__personal_info__header_enabled';
753 $mu_option4delete[] = 'booking_confirmation__personal_info__title';
754 $mu_option4delete[] = 'booking_confirmation__personal_info__content';
755
756 $default_options['booking_confirmation__booking_details__header_enabled'] = 'On';
757 $default_options['booking_confirmation__booking_details__title'] = __( 'Booking details', 'booking' );
758 $default_options['booking_confirmation__booking_details__content'] = ( class_exists( 'wpdev_bk_personal' ) )
759 ? "<h4>[resource_title]</h4>[readable_dates][readable_times]\n[add_to_google_cal_button]\n" . '<a href="[visitorbookingediturl]">Edit Booking</a> | <a href="[visitorbookingcancelurl]">Cancel Booking</a>'
760 : "[readable_dates][readable_times]\n[add_to_google_cal_button]";
761
762 $mu_option4delete[] = 'booking_confirmation__booking_details__header_enabled';
763 $mu_option4delete[] = 'booking_confirmation__booking_details__title';
764 $mu_option4delete[] = 'booking_confirmation__booking_details__content';
765 //FixIn:10.2.0.1 End --------------------------------------------------------------------------------------------
766
767 $default_options['booking_date_view_type'] = 'short';
768 $mu_option4delete[]='booking_date_view_type';
769 $default_options['booking_is_delete_if_deactive'] = ($is_demo) ? 'On' : 'Off';
770 $mu_option4delete[]='booking_is_delete_if_deactive';
771 $default_options['booking_dif_colors_approval_pending'] = 'On'; // Depricated
772 $default_options['booking_is_use_hints_at_admin_panel'] = 'On';
773 $mu_option4delete[]='booking_is_use_hints_at_admin_panel';
774 $default_options['booking_is_load_js_css_on_specific_pages'] = 'Off';
775 $mu_option4delete[]='booking_is_nonce_at_front_end'; // FixIn: 10.1.1.2.
776 $default_options['booking_is_nonce_at_front_end'] = 'Off';
777 // FixIn: 9.8.6.2.
778 $mu_option4delete[]='booking_load_balancer_max_threads';
779 $default_options['booking_load_balancer_max_threads'] = ( $is_demo ) ? '1' : '3';
780
781
782 //FixIn: 7.2.1.15
783 $mu_option4delete[]='booking_is_show_system_debug_log';
784 $default_options['booking_is_show_system_debug_log'] = 'Off';
785
786
787 $mu_option4delete[]='booking_is_load_js_css_on_specific_pages';
788 $default_options['booking_pages_for_load_js_css'] = '';
789 $mu_option4delete[]='booking_pages_for_load_js_css';
790 $default_options['booking_type_of_day_selections'] = $is_free_version
791 ? 'range'
792 : ( ( get_bk_option( 'booking_range_selection_is_active' ) == 'On' ) && ( ! $is_demo ) ? 'range' : 'multiple' );
793 $mu_option4delete[]='booking_type_of_day_selections';
794
795 // FixIn: 8.7.11.10.
796 $default_options['booking_timeslot_picker'] = 'On';
797 $mu_option4delete[]= 'booking_timeslot_picker';
798 $default_options['booking_timeslot_picker_skin'] = '/css/time_picker_skins/form_style.css';
799 $mu_option4delete[]= 'booking_timeslot_picker_skin';
800
801 $default_options['booking_disable_timeslots_in_tooltip'] = 'Off'; //FixIn: 9.5.0.2.2
802 $mu_option4delete[]='booking_disable_timeslots_in_tooltip';
803
804 $default_options['booking_highlight_timeslot_word'] = __( 'Booked Times:', 'booking' ); // FixIn: 9.4.3.1.
805 $mu_option4delete[]='booking_highlight_timeslot_word';
806
807 $default_options['booking_form_is_using_bs_css'] = 'Off';
808 $mu_option4delete[]='booking_form_is_using_bs_css';
809 $default_options['booking_form_format_type'] = 'vertical';
810 $mu_option4delete[]='booking_form_format_type';
811
812 // Does not exist in MU
813 $default_options['booking_form_field_active1'] = 'On';
814 $default_options['booking_form_field_required1'] = 'On';
815 $default_options['booking_form_field_label1'] = 'First Name';
816 $default_options['booking_form_field_active2'] = 'On';
817 $default_options['booking_form_field_required2'] = 'On';
818 $default_options['booking_form_field_label2'] = 'Last Name';
819 $default_options['booking_form_field_active3'] = 'On';
820 $default_options['booking_form_field_required3'] = 'On';
821 $default_options['booking_form_field_label3'] = 'Email';
822 $default_options['booking_form_field_active4'] = 'On';
823 $default_options['booking_form_field_required4'] = 'Off';
824 $default_options['booking_form_field_label4'] = 'Phone';
825 $default_options['booking_form_field_active5'] = 'On';
826 $default_options['booking_form_field_required5'] = 'Off';
827 $default_options['booking_form_field_label5'] = 'Details';
828 $default_options['booking_form_field_active6'] = 'Off';
829 $default_options['booking_form_field_required6'] = 'Off';
830 $default_options['booking_form_field_label6'] = 'Visitors';
831 $default_options['booking_form_field_values6'] = "1\n2\n3\n4";
832
833
834 $default_options['booking_is_days_always_available'] = 'Off';
835 $mu_option4delete[]='booking_is_days_always_available';
836
837 // FixIn: 8.3.2.2.
838 $default_options['booking_is_show_pending_days_as_available'] = 'Off';
839 $mu_option4delete[]='booking_is_show_pending_days_as_available';
840
841 $default_options['booking_unavailable_days_num_from_today'] = '0';
842 $mu_option4delete[]='booking_unavailable_days_num_from_today';
843 $default_options['booking_unavailable_day0'] = 'Off';
844 $mu_option4delete[]='booking_unavailable_day0';
845 $default_options['booking_unavailable_day1'] = 'Off';
846 $mu_option4delete[]='booking_unavailable_day1';
847 $default_options['booking_unavailable_day2'] = 'Off';
848 $mu_option4delete[]='booking_unavailable_day2';
849 $default_options['booking_unavailable_day3'] = 'Off';
850 $mu_option4delete[]='booking_unavailable_day3';
851 $default_options['booking_unavailable_day4'] = 'Off';
852 $mu_option4delete[]='booking_unavailable_day4';
853 $default_options['booking_unavailable_day5'] = 'Off';
854 $mu_option4delete[]='booking_unavailable_day5';
855 $default_options['booking_unavailable_day6'] = 'Off';
856 $mu_option4delete[]='booking_unavailable_day6';
857
858 // Working Time defaults. Keep disabled by default on fresh activation/reinstall.
859 $default_options['booking_working_time_enabled'] = 'Off';
860 $mu_option4delete[]='booking_working_time_enabled';
861 $default_options['booking_working_time_rules'] = function_exists( 'wpbc_working_time__get_default_settings' ) ? wpbc_working_time__get_default_settings() : array(
862 'enabled' => 'Off',
863 'default' => array(
864 'weekdays' => array(),
865 ),
866 'resources' => array(),
867 );
868 $mu_option4delete[]='booking_working_time_rules';
869
870 $default_options['booking_menu_position'] = ( $is_demo ) ? 'top' : 'top';
871 $mu_option4delete[]='booking_menu_position';
872 $default_options['booking_translation_load_from'] = 'wp.org';
873 $mu_option4delete[]='booking_translation_load_from';
874
875 // FixIn: 10.14.12.1.
876 $default_options['booking_user_role_booking'] = 'editor';
877 $mu_option4delete[]='booking_user_role_booking';
878 $default_options['booking_user_role_availability'] = 'editor';
879 $mu_option4delete[]='booking_user_role_availability';
880 $default_options['booking_user_role_addbooking'] = 'editor';
881 $mu_option4delete[]='booking_user_role_addbooking';
882 $default_options['booking_user_role_resources'] = 'editor';
883 $mu_option4delete[]='booking_user_role_resources';
884 $default_options['booking_user_role_settings'] = 'editor';
885 $mu_option4delete[]='booking_user_role_settings';
886 //FixIn: 9.8.15.2.6
887 if ( class_exists( 'wpdev_bk_biz_m' ) ) {
888 $default_options['booking_user_role_prices'] = 'editor';
889 $mu_option4delete[]='booking_user_role_prices';
890 }
891
892 // New admin ///////////////////////////////////////////////////////////////
893
894 $default_options['booking_is_email_reservation_adress'] = 'On';
895 $default_options['booking_email_reservation_adress'] = htmlspecialchars( '"Booking system" <' . get_option( 'admin_email' ) . '>' );
896 $default_options['booking_email_reservation_from_adress'] = '[visitoremail]';
897 $default_options['booking_email_reservation_subject'] = __( 'New booking', 'booking' );
898 /* translators: 1: ... */
899 $default_options['booking_email_reservation_content'] = htmlspecialchars( sprintf( __( 'You need to approve a new booking %1$s for: %2$s Person detail information:%3$s Currently a new booking is waiting for approval. Please visit the moderation panel%4$sThank you, %5$s', 'booking' ), '[bookingtype]', '[dates]<br/><br/>', '<br/> [content]<br/><br/>', ' [moderatelink]<br/><br/>', $blg_title . '<br/>[siteurl]' ) );
900
901 // New Visitor /////////////////////////////////////////////////////////////
902
903 $default_options['booking_is_email_newbookingbyperson_adress'] = 'Off';
904 $default_options['booking_email_newbookingbyperson_adress'] = htmlspecialchars( '"Booking system" <' . get_option( 'admin_email' ) . '>' );
905 $default_options['booking_email_newbookingbyperson_subject'] = __( 'New booking', 'booking' );
906 if ( class_exists( 'wpdev_bk_personal' ) )
907 /* translators: 1: ... */
908 $default_options['booking_email_newbookingbyperson_content'] = htmlspecialchars( sprintf( __( 'Your reservation %1$s for: %2$s is processing now! We will send confirmation by email. %3$sYou can edit this booking at this page: %4$s Thank you, %5$s', 'booking' ), '[bookingtype]', '[dates]', '<br/><br/>[content]<br/><br/>', '[visitorbookingediturl]<br/><br/>', $blg_title . '<br/>[siteurl]' ) );
909 else
910 /* translators: 1: ... */
911 $default_options['booking_email_newbookingbyperson_content'] = htmlspecialchars( sprintf( __( 'Your reservation %1$s for: %2$s is processing now! We will send confirmation by email. %3$s Thank you, %4$s', 'booking' ), '[bookingtype]', '[dates]', '<br/><br/>[content]<br/><br/>', $blg_title . '<br/>[siteurl]' ) );
912
913 // Approval ////////////////////////////////////////////////////////////////
914
915 $default_options['booking_is_email_approval_adress'] = 'On';
916 $default_options['booking_is_email_approval_send_copy_to_admin'] = 'Off';
917 $default_options['booking_email_approval_adress'] = htmlspecialchars( '"Booking system" <' . get_option( 'admin_email' ) . '>' );
918 $default_options['booking_email_approval_subject'] = __( 'Your booking has been approved', 'booking' );
919 if ( class_exists( 'wpdev_bk_personal' ) ) {
920 /* translators: 1: ... */
921 $default_options['booking_email_approval_content'] = htmlspecialchars( sprintf( __( 'Your reservation %1$s for: %2$s has been approved.%3$sYou can edit the booking on this page: %4$s Thank you, %5$s', 'booking' ), '[bookingtype]', '[dates]', '<br/><br/>[content]<br/><br/>', '[visitorbookingediturl]<br/><br/>', $blg_title . '<br/>[siteurl]' ) );
922 } else {
923 /* translators: 1: ... */
924 $default_options['booking_email_approval_content'] = htmlspecialchars( sprintf( __( 'Your booking %1$s for: %2$s has been approved.%3$sThank you, %4$s', 'booking' ), '[bookingtype]', '[dates]', '<br/><br/>[content]<br/><br/>', $blg_title . '<br/>[siteurl]' ) );
925 }
926
927 // Decline /////////////////////////////////////////////////////////////////
928
929 $default_options['booking_is_email_deny_adress'] = 'On';
930 $default_options['booking_is_email_deny_send_copy_to_admin'] = 'Off';
931 $default_options['booking_email_deny_adress'] = htmlspecialchars( '"Booking system" <' . get_option( 'admin_email' ) . '>' );
932 $default_options['booking_email_deny_subject'] = __( 'Your booking has been declined', 'booking' );
933 /* translators: 1: ... */
934 $default_options['booking_email_deny_content'] = htmlspecialchars( sprintf( __( 'Your booking %1$s for: %2$s has been canceled. %3$sThank you, %4$s', 'booking' ), '[bookingtype]', '[dates]', '<br/>[denyreason]<br/><br/>[content]<br/><br/>', $blg_title . '<br/>[siteurl]' ) );
935
936 // -----------------------------------------------------------------------------------------------------------------
937 $default_options['booking_widget_title'] = __( 'Booking form', 'booking' );
938 $default_options['booking_widget_show'] = 'booking_form';
939 $default_options['booking_widget_type'] = '1';
940 $default_options['booking_widget_calendar_count'] = '1';
941 $default_options['booking_widget_last_field'] = '';
942
943 $default_options['booking_wpdev_copyright_adminpanel'] = 'On';
944 $mu_option4delete[]='booking_wpdev_copyright_adminpanel';
945 $default_options['booking_is_show_powered_by_notice'] = ( WPBC_IS_PLAYGROUND ) ? 'Off' : 'On';
946 $mu_option4delete[]='booking_is_show_powered_by_notice';
947 $default_options['booking_form_theme'] = '';
948 $mu_option4delete[]='booking_form_theme';
949 $default_options['booking_form_style'] = 'light_bordered';
950 $mu_option4delete[]='booking_form_style';
951 $default_options['booking_form_accent_enabled'] = 'Off';
952 $mu_option4delete[]='booking_form_accent_enabled';
953 $default_options['booking_form_accent_color'] = WPBC_DEFAULT_FORM_ACCENT_COLOR;
954 $mu_option4delete[]='booking_form_accent_color';
955 $default_options['booking_form_appearance_preset'] = 'bordered';
956 $mu_option4delete[]='booking_form_appearance_preset';
957 $default_options['booking_form_appearance_background_color'] = '#ffffff';
958 $mu_option4delete[]='booking_form_appearance_background_color';
959 $default_options['booking_form_appearance_border_color'] = '#cccccc';
960 $mu_option4delete[]='booking_form_appearance_border_color';
961 $default_options['booking_form_appearance_border_width'] = '1px';
962 $mu_option4delete[]='booking_form_appearance_border_width';
963 $default_options['booking_form_appearance_border_radius'] = '2px';
964 $mu_option4delete[]='booking_form_appearance_border_radius';
965 $default_options['booking_form_appearance_padding'] = '10px 30px';
966 $mu_option4delete[]='booking_form_appearance_padding';
967 $default_options['booking_form_custom_background_color'] = '#ffffff';
968 $mu_option4delete[]='booking_form_custom_background_color';
969 $default_options['booking_form_custom_border_color'] = '#cccccc';
970 $mu_option4delete[]='booking_form_custom_border_color';
971 $default_options['booking_form_custom_border_width'] = '1px';
972 $mu_option4delete[]='booking_form_custom_border_width';
973 $default_options['booking_form_custom_border_radius'] = '2px';
974 $mu_option4delete[]='booking_form_custom_border_radius';
975 $default_options['booking_form_custom_padding_vertical'] = '10px';
976 $mu_option4delete[]='booking_form_custom_padding_vertical';
977 $default_options['booking_form_custom_padding_horizontal'] = '30px';
978 $mu_option4delete[]='booking_form_custom_padding_horizontal';
979 $default_options['booking_form_custom_text_color'] = '#1d2327';
980 $mu_option4delete[]='booking_form_custom_text_color';
981 $default_options['booking_form_custom_field_background_color'] = '#ffffff';
982 $mu_option4delete[]='booking_form_custom_field_background_color';
983 $default_options['booking_form_custom_field_text_color'] = '#3c434a';
984 $mu_option4delete[]='booking_form_custom_field_text_color';
985 $default_options['booking_form_custom_field_border_color'] = '#cccccc';
986 $mu_option4delete[]='booking_form_custom_field_border_color';
987 $default_options['booking_form_custom_button_background_color'] = '#066aab';
988 $mu_option4delete[]='booking_form_custom_button_background_color';
989 $default_options['booking_form_custom_button_text_color'] = '#ffffff';
990 $mu_option4delete[]='booking_form_custom_button_text_color';
991 $default_options['booking_form_custom_button_border_color'] = '#066aab';
992 $mu_option4delete[]='booking_form_custom_button_border_color';
993 $default_options['booking_form_custom_button_hover_background_color'] = '#055589';
994 $mu_option4delete[]='booking_form_custom_button_hover_background_color';
995 $default_options['booking_form_custom_button_hover_text_color'] = '#ffffff';
996 $mu_option4delete[]='booking_form_custom_button_hover_text_color';
997 $default_options['booking_form_custom_button_hover_border_color'] = '#055589';
998 $mu_option4delete[]='booking_form_custom_button_hover_border_color';
999 $default_options['booking_form_custom_secondary_button_background_color'] = '#fdfdfd';
1000 $mu_option4delete[]='booking_form_custom_secondary_button_background_color';
1001 $default_options['booking_form_custom_secondary_button_text_color'] = '#444444';
1002 $mu_option4delete[]='booking_form_custom_secondary_button_text_color';
1003 $default_options['booking_form_custom_secondary_button_border_color'] = '#eeeeee';
1004 $mu_option4delete[]='booking_form_custom_secondary_button_border_color';
1005 $default_options['booking_form_custom_secondary_button_hover_background_color'] = '#fdfdfd';
1006 $mu_option4delete[]='booking_form_custom_secondary_button_hover_background_color';
1007 $default_options['booking_form_custom_secondary_button_hover_text_color'] = '#444444';
1008 $mu_option4delete[]='booking_form_custom_secondary_button_hover_text_color';
1009 $default_options['booking_form_custom_secondary_button_hover_border_color'] = '#4d91cd';
1010 $mu_option4delete[]='booking_form_custom_secondary_button_hover_border_color';
1011 $default_options['booking_form_custom_button_border_width'] = '1px';
1012 $mu_option4delete[]='booking_form_custom_button_border_width';
1013 $default_options['booking_form_custom_button_border_radius'] = '3px';
1014 $mu_option4delete[]='booking_form_custom_button_border_radius';
1015 $default_options['booking_is_use_captcha'] = 'Off';
1016 $mu_option4delete[]='booking_is_use_captcha';
1017 $default_options['booking_frontend_messages'] = array( 'version' => 1, 'messages' => array(), 'enabled' => array() );
1018 $mu_option4delete[]='booking_frontend_messages';
1019 $default_options['booking_is_show_legend'] = 'On';
1020 $mu_option4delete[]='booking_is_show_legend';
1021 $default_options['booking_send_button_title'] = __( 'Send', 'booking' ); // FixIn: 8.8.1.14.
1022 $mu_option4delete[]='booking_send_button_title';
1023 $default_options['booking_legend_is_show_item_available'] = 'On';
1024 $mu_option4delete[]='booking_legend_is_show_item_available';
1025 $default_options['booking_legend_text_for_item_available'] = __( 'Available', 'booking' );
1026 $mu_option4delete[]='booking_legend_text_for_item_available';
1027 $default_options['booking_legend_is_show_item_pending'] = 'On';
1028 $mu_option4delete[]='booking_legend_is_show_item_pending';
1029 $default_options['booking_legend_text_for_item_pending'] = __( 'Pending', 'booking' );
1030 $mu_option4delete[]='booking_legend_text_for_item_pending';
1031 $default_options['booking_legend_is_show_item_approved'] = 'On';
1032 $mu_option4delete[]='booking_legend_is_show_item_approved';
1033 $default_options['booking_legend_text_for_item_approved'] = __( 'Booked', 'booking' );
1034 $mu_option4delete[]='booking_legend_text_for_item_approved';
1035 // FixIn: 9.9.0.5.
1036 $default_options['booking_legend_is_show_item_unavailable'] = 'Off';
1037 $mu_option4delete[]='booking_legend_is_show_item_unavailable';
1038 $default_options['booking_legend_text_for_item_unavailable'] = __( 'Unavailable', 'booking' );
1039 $mu_option4delete[]='booking_legend_text_for_item_unavailable';
1040
1041 // FixIn: 10.1.5.5.
1042 $default_options['booking_legend_is_show_item_partially'] = ( ( class_exists( 'wpdev_bk_personal' ) ) && ( ! class_exists( 'wpdev_bk_biz_s' ) ) ) ? 'Off' : 'On';
1043 $mu_option4delete[]='booking_legend_is_show_item_partially';
1044 $default_options['booking_legend_text_for_item_partially'] = __( 'Partially booked', 'booking' );
1045 $mu_option4delete[]='booking_legend_text_for_item_partially';
1046
1047 $default_options['booking_legend_is_show_numbers'] = 'On'; //FixIn:6.0.1.4 // FixIn: 8.1.3.8.
1048 $mu_option4delete[]='booking_legend_is_show_numbers';
1049 $default_options['booking_legend_is_vertical'] = 'Off'; // FixIn: 9.4.3.6.
1050 $mu_option4delete[]='booking_legend_is_vertical';
1051
1052 /*
1053 Import previous (old version) Email templates
1054 or get defult values from Email Classes, if the emails was not saved
1055 if the emails was saved, in this case - return empty array(), Useful for the Email Settings page to loading data from DB, during activation Mail API class.
1056 So if we get empty array for values, in this case, we need to get this optiosn from DB.
1057 */
1058 // Get NEW Email Templates default data or Import previous saved
1059 $emails_init = wpbc_import6_email__new_admin__get_fields_array_for_activation();
1060 $emails_init = array_merge( $emails_init, wpbc_import6_email__new_visitor__get_fields_array_for_activation() );
1061 $emails_init = array_merge( $emails_init, wpbc_import6_email__approved__get_fields_array_for_activation() );
1062 $emails_init = array_merge( $emails_init, wpbc_import6_email__deleted__get_fields_array_for_activation() );
1063 $emails_init = array_merge( $emails_init, wpbc_import6_email__deny__get_fields_array_for_activation() );
1064 $emails_init = array_merge( $emails_init, wpbc_import6_email__trash__get_fields_array_for_activation() );
1065 if ( class_exists( 'wpdev_bk_personal' ) )
1066 $emails_init = array_merge( $emails_init, wpbc_import6_email__modification__get_fields_array_for_activation() );
1067 if ( class_exists( 'wpdev_bk_personal' ) && function_exists( 'wpbc_customer_verification_email_get_initial_values' ) )
1068 $emails_init = array_merge( $emails_init, wpbc_customer_verification_email_get_initial_values() );
1069 if ( class_exists( 'wpdev_bk_biz_s' ) )
1070 $emails_init = array_merge( $emails_init, wpbc_import6_email__payment_request__get_fields_array_for_activation() );
1071 foreach ( $emails_init as $email_key_name => $email_values ) {
1072
1073 if ( ! empty( $email_values ) ) $default_options[ $email_key_name ] = $email_values;
1074 else $default_options[ $email_key_name ] = get_bk_option( $email_key_name );
1075 }
1076
1077
1078 $mu_option4delete[]='booking_gcal_auto_import_is_active'; // Creation in wpbc-gcal.php file
1079 $mu_option4delete[]='booking_gcal_auto_import_time';
1080 $mu_option4delete[]='booking_cron'; // Creation in wpbc-cron.php
1081
1082 // FixIn: 8.0.1.6.
1083 //$default_options['booking_form_structure_type'] = 'vertical';
1084 // $default_options['booking_form_structure_type'] = 'form_right'; // FixIn: 10.3.0.6.
1085 $default_options['booking_form_structure_type'] = 'wizard_services_a'; // FixIn: 10.11.4.3.
1086 $default_options['booking_menu_go_pro'] = ( WPBC_IS_PLAYGROUND ) ? 'hide' : 'show'; // show | hide
1087
1088 // $default_options['booking_form_layout_width'] = '440';
1089 // $default_options['booking_form_layout_width_px_pr'] = 'px';
1090 // $default_options['booking_form_layout_max_cols'] = 1;
1091
1092 // FixIn: 10.11.4.3.
1093 $default_options['booking_form_layout_width'] = '100';
1094 $default_options['booking_form_layout_width_px_pr'] = '%';
1095 $default_options['booking_form_layout_max_cols'] = 2;
1096
1097
1098 // -----------------------------------------------------------------------------------------------------------------
1099 // PS
1100 // -----------------------------------------------------------------------------------------------------------------
1101 if ( class_exists( 'wpdev_bk_personal' ) ) {
1102
1103
1104 $default_options['booking_is_use_codehighlighter_booking_form'] = 'On'; // FixIn: 8.4.7.18.
1105 $mu_option4delete[]='booking_is_use_codehighlighter_booking_form';
1106
1107 $default_options['booking_url_bookings_edit_by_visitors'] = site_url();
1108 $mu_option4delete[]='booking_url_bookings_edit_by_visitors';
1109
1110 $default_options['booking_url_bookings_listing_by_customer'] = site_url(); //FixIn: 8.1.3.5.1
1111 $mu_option4delete[]='booking_url_bookings_listing_by_customer';
1112
1113 $default_options['booking_default_booking_resource'] = ''; // All resources
1114 $mu_option4delete[]='booking_default_booking_resource';
1115 $default_options['booking_is_change_hash_after_approvement'] = 'On'; // FixIn: 10.10.1.1.
1116 $mu_option4delete[]='booking_is_change_hash_after_approvement';
1117 $default_options['booking_email_modification_adress'] = htmlspecialchars( '"Booking system" <' . get_option( 'admin_email' ) . '>' );
1118 $default_options['booking_email_modification_subject'] = __( 'The reservation has been modified', 'booking' );
1119 /* translators: 1: ... */
1120 $default_options['booking_email_modification_content'] = htmlspecialchars( sprintf( __( 'The reservation %1$s for: %2$s has been modified. %3$sYou can edit this booking on this page: %4$s Thank you, %5$s', 'booking' ), '[bookingtype]', '[dates]', '<br/><br/>[content]<br/><br/>', '[visitorbookingediturl]<br/><br/>', $blg_title . '<br/>[siteurl]' ) );
1121 $default_options['booking_is_email_modification_adress'] = 'On';
1122 $default_options['booking_is_email_modification_send_copy_to_admin'] = 'Off';
1123 $default_options['booking_resourses_num_per_page'] = '10';
1124 $mu_option4delete[]='booking_resourses_num_per_page';
1125 $default_options['booking_default_title_in_day_for_calendar_view_mode'] = '[id]: [name] [secondname]';
1126 $mu_option4delete[]='booking_default_title_in_day_for_calendar_view_mode';
1127
1128 // FixIn: 8.1.3.31.
1129 $default_options['booking_calendar_overview_start_time'] = '0';
1130 $mu_option4delete[]='booking_calendar_overview_start_time';
1131 $default_options['booking_calendar_overview_end_time'] = '24';
1132 $mu_option4delete[]='booking_calendar_overview_end_time';
1133
1134 $default_options['booking_default_title_in_day_for_timeline_front_end'] = '[name] [secondname]';
1135 $mu_option4delete[]='booking_default_title_in_day_for_timeline_front_end';
1136 // FixIn: 10.14.10.1.
1137 $default_options['booking_is_show_popover_in_timeline_front_end'] = 'Off';
1138 $mu_option4delete[]='booking_is_show_popover_in_timeline_front_end';
1139 // FixIn: 9.6.3.5.
1140
1141 $default_options['booking_send_emails_off_addbooking'] = 'Off'; // FixIn: 8.4.5.4.
1142 $mu_option4delete[]='booking_send_emails_off_addbooking';
1143
1144 // FixIn: 9.6.3.5.
1145
1146 $default_options['booking_change_resource_skip_checking'] = 'Off'; // FixIn: 8.4.5.4.
1147 $mu_option4delete[]='booking_change_resource_skip_checking';
1148
1149 $default_options['booking_log_booking_actions'] = 'On'; // FixIn: 8.6.1.10.
1150 $mu_option4delete[]='booking_log_booking_actions';
1151
1152
1153 }
1154
1155 // FixIn: 8.5.1.1.
1156 // $default_options['booking_ics_force_import'] = 'Off'; // FixIn: 8.4.7.1.
1157 $default_options['booking_ics_force_trash_before_import'] = 'Off'; // FixIn: 8.4.7.12.
1158 //$mu_option4delete[]='booking_ics_force_trash_before_import'; // No need to delete ^
1159 $default_options['booking_ics_import_append_checkout_day'] = 'Off'; //FixIn: 9.6.2.7 // FixIn: 9.5.4.1.
1160 //$mu_option4delete[]='booking_ics_import_append_checkout_day'; // No need to delete ^
1161
1162 $default_options['booking_ics_import_append_extra_checkout_day'] = 'Off';
1163 //$mu_option4delete[]='booking_ics_import_append_extra_checkout_day'; // No need to delete ^
1164
1165 // FixIn: 9.8.15.8.
1166 $default_options['booking_condition_import_only_new'] = ( get_bk_option( 'booking_ics_force_import' ) === 'On' ) ? 'Off' : 'On';
1167 $default_options['booking_condition_import_if_available'] = 'Off';
1168
1169 // FixIn: 10.1.5.4.
1170 $default_options['booking_recurrent_time'] = ( class_exists( 'wpdev_bk_personal' ) ) ? 'Off' : 'On';
1171 $mu_option4delete[]='booking_recurrent_time';
1172
1173 $default_options['booking_calendar_allow_several_months_on_mobile'] = 'Off';
1174 $mu_option4delete[]='booking_calendar_allow_several_months_on_mobile';
1175
1176 // -----------------------------------------------------------------------------------------------------------------
1177 // BS
1178 // -----------------------------------------------------------------------------------------------------------------
1179 if ( class_exists( 'wpdev_bk_biz_s' ) ) {
1180
1181 //$mu_option4delete[]='booking_paypal_price_period'; // No need to delete, this option, because different users can have different settings. During init defined at ../booking/inc/gateways/page-gateways.php
1182
1183 $default_options['booking_gateways_order'] = 'stripe_v3,paypal_std_co,paypal,authorizenet,sage,redsys,bank_transfer,pay_cash,ipay88,ideal'; // Default Original Payment Gateways
1184 //$mu_option4delete[]='booking_gateways_order'; // No need to delete ^
1185
1186 // FixIn: 8.1.3.29.
1187 $default_options['booking_ics_import_add_change_over_time'] = 'On';
1188 //$mu_option4delete[]='booking_ics_import_add_change_over_time'; // No need to delete ^
1189
1190 // FixIn: 8.5.2.3.
1191 $default_options['booking_is_ics_export_only_approved'] = 'Off';
1192 //$mu_option4delete[]='booking_is_ics_export_only_approved'; // No need to delete ^
1193 $default_options['booking_is_ics_export_imported_bookings'] = ''; // FixIn: 8.8.3.19.
1194
1195
1196 $default_options['booking_auto_approve_new_bookings_is_active'] = 'Off';
1197 $mu_option4delete[]='booking_auto_approve_new_bookings_is_active';
1198
1199 // FixIn: 8.1.3.27.
1200 $default_options['booking_auto_approve_bookings_when_import'] = 'Off';
1201 $mu_option4delete[]='booking_auto_approve_bookings_when_import';
1202 $default_options['booking_auto_approve_bookings_when_zero_cost'] = 'Off';
1203 $mu_option4delete[]='booking_auto_approve_bookings_when_zero_cost';
1204 $default_options['booking_auto_approve_bookings_if_added_in_admin_panel'] = 'Off';
1205 $mu_option4delete[]='booking_auto_approve_bookings_if_added_in_admin_panel';
1206
1207 $default_options['booking_auto_cancel_pending_unpaid_bk_is_active'] = 'Off';
1208 $mu_option4delete[]='booking_auto_cancel_pending_unpaid_bk_is_active';
1209 $default_options['booking_auto_cancel_pending_unpaid_bk_time'] = '24';
1210 $mu_option4delete[]='booking_auto_cancel_pending_unpaid_bk_time';
1211 $default_options['booking_auto_cancel_pending_unpaid_bk_is_send_email'] = 'On';
1212 $mu_option4delete[]='booking_auto_cancel_pending_unpaid_bk_is_send_email';
1213 $default_options['booking_auto_cancel_pending_unpaid_bk_email_reason'] = __( 'This booking canceled because we did not receive payment and the administrator did not approve it.', 'booking' );
1214 $mu_option4delete[]='booking_auto_cancel_pending_unpaid_bk_email_reason';
1215 // Start every edition with the unrestricted two-click range.
1216 // Business Small+ users can opt into a fixed one-click range later.
1217 $default_options['booking_range_selection_type'] = 'dynamic';
1218 $mu_option4delete[]='booking_range_selection_type';
1219 $default_options['booking_range_selection_days_count'] = '3';
1220 $mu_option4delete[]='booking_range_selection_days_count';
1221 $default_options['booking_range_selection_days_max_count_dynamic'] = 30;
1222 $mu_option4delete[]='booking_range_selection_days_max_count_dynamic';
1223 $default_options['booking_range_selection_days_specific_num_dynamic'] = '';
1224 $mu_option4delete[]='booking_range_selection_days_specific_num_dynamic';
1225 $default_options['booking_range_start_day'] = '-1';
1226 $mu_option4delete[]='booking_range_start_day';
1227 $default_options['booking_range_selection_days_count_dynamic'] = '1';
1228 $mu_option4delete[]='booking_range_selection_days_count_dynamic';
1229 $default_options['booking_range_start_day_dynamic'] = '-1';
1230 $mu_option4delete[]='booking_range_start_day_dynamic';
1231 $default_options['booking_range_selection_time_is_active'] = 'Off';
1232 $mu_option4delete[]='booking_range_selection_time_is_active';
1233 $default_options['booking_range_selection_start_time'] = '12:00';
1234 $mu_option4delete[]='booking_range_selection_start_time';
1235 $default_options['booking_range_selection_end_time'] = '10:00';
1236 $mu_option4delete[]='booking_range_selection_end_time';
1237 $default_options['booking_change_over_days_triangles'] = 'On'; // FixIn: 7.0.1.24.
1238
1239 $mu_option4delete[]='booking_last_checkout_day_available';
1240 $default_options['booking_last_checkout_day_available'] = 'Off'; // FixIn: 8.1.3.28.
1241
1242 $mu_option4delete[]='booking_change_over_days_triangles';
1243
1244 $mu_option4delete[]='booking_change_over__is_excerpt_on_pages';
1245 $default_options['booking_change_over__is_excerpt_on_pages'] = 'Off'; // FixIn: 8.9.4.10.
1246 $mu_option4delete[]='booking_change_over__excerpt_on_pages';
1247 $default_options['booking_change_over__excerpt_on_pages'] = ''; // FixIn: 8.9.4.10.
1248 $mu_option4delete[]='booking_change_over__excerpt_bk_resources';
1249 $default_options['booking_change_over__excerpt_bk_resources'] = ''; // FixIn: 10.16.4.1.
1250
1251
1252 $default_options['booking_email_payment_request_adress'] = htmlspecialchars( '"Booking system" <' . get_option( 'admin_email' ) . '>' );
1253 $default_options['booking_email_payment_request_subject'] = __( 'You need to make payment for this reservation', 'booking' );
1254 /* translators: 1: ... */
1255 $default_options['booking_email_payment_request_content'] = htmlspecialchars( sprintf( __( 'You need to make payment %1$s for reservation %2$s at %3$s. %4$s Please make payment on this page: %5$s Thank you, %6$s', 'booking' ), '[cost]', '[bookingtype]', '[dates]', '<br/><br/>[paymentreason]<br/><br/>[content]<br/><br/>', '[visitorbookingpayurl]<br/><br/>', $blg_title . '<br/>[siteurl]' ) );
1256 $default_options['booking_is_email_payment_request_adress'] = 'On';
1257 $default_options['booking_is_email_payment_request_send_copy_to_admin'] = 'Off';
1258 }
1259
1260
1261 // -----------------------------------------------------------------------------------------------------------------
1262 // BM
1263 // -----------------------------------------------------------------------------------------------------------------
1264 if ( class_exists( 'wpdev_bk_biz_m' ) ) {
1265
1266 // FixIn: 8.1.3.15.
1267 $default_options['booking_is_show_booked_data_in_tooltips'] = 'Off';
1268 $mu_option4delete[]='booking_is_show_booked_data_in_tooltips';
1269 $default_options['booking_booked_data_in_tooltips'] = '[name] [secondname]';
1270 $mu_option4delete[]='booking_booked_data_in_tooltips';
1271
1272 $default_options['booking_number_for_pre_checkin_date_hint'] = '14'; // FixIn: 10.0.0.31.
1273 $mu_option4delete[]='booking_number_for_pre_checkin_date_hint';
1274 $default_options['booking_available_days_num_from_today'] = '';
1275 $mu_option4delete[]='booking_available_days_num_from_today';
1276 $default_options['booking_unavailable_extra_in_out'] = '';
1277 $mu_option4delete[]='booking_unavailable_extra_in_out';
1278 $default_options['booking_unavailable_extra_minutes_in'] = '';
1279 $mu_option4delete[]='booking_unavailable_extra_minutes_in';
1280 $default_options['booking_unavailable_extra_minutes_out'] = '';
1281 $mu_option4delete[]='booking_unavailable_extra_minutes_out';
1282 $default_options['booking_unavailable_extra_days_in'] = '';
1283 $mu_option4delete[]='booking_unavailable_extra_days_in';
1284 $default_options['booking_unavailable_extra_days_out'] = '';
1285 $mu_option4delete[]='booking_unavailable_extra_days_out';
1286
1287 $default_options['booking_advanced_costs_values'] = serialize( array() );
1288 $default_options['booking_is_resource_deposit_payment_active'] = 'On';
1289 $mu_option4delete[]='booking_is_resource_deposit_payment_active';
1290 $default_options['booking_advanced_costs_calc_fixed_cost_with_procents'] = 'Off';
1291 $default_options['booking_is_show_cost_in_tooltips'] = 'Off';
1292 $mu_option4delete[]='booking_is_show_cost_in_tooltips';
1293 $default_options['booking_highlight_cost_word'] = __( 'Cost: ', 'booking' );
1294 $mu_option4delete[]='booking_highlight_cost_word';
1295 $default_options['booking_is_show_cost_in_date_cell'] = 'Off';
1296 $mu_option4delete[]='booking_is_show_cost_in_date_cell';
1297 $default_options['booking_cost_in_date_cell_currency'] = '&#36;';
1298 $mu_option4delete[]='booking_cost_in_date_cell_currency';
1299 $default_options['booking_visitor_number_rate'] = '0'; //Depricated
1300 $default_options['booking_visitor_number_rate_type'] = '%'; //Depricated
1301 }
1302
1303
1304 // -----------------------------------------------------------------------------------------------------------------
1305 // BL
1306 // -----------------------------------------------------------------------------------------------------------------
1307 if ( class_exists( 'wpdev_bk_biz_l' ) ) {
1308
1309 // Get Key of Last added item to "$default_options" array
1310 // $multiuser_general_option[] = implode( '', array_keys( array_slice( $default_options, -1 ) ) );
1311
1312 $default_options['booking_check_out_available_for_parents'] = 'On';
1313 $mu_option4delete[]='booking_check_out_available_for_parents';
1314 $default_options['booking_check_in_available_for_parents'] = 'Off';
1315 $mu_option4delete[]='booking_check_in_available_for_parents';
1316 $default_options['booking_is_show_pending_days_as_available'] = 'Off';
1317 $mu_option4delete[]='booking_is_show_pending_days_as_available';
1318 $default_options['booking_auto_cancel_pending_bookings_for_approved_date'] = 'Off';
1319 $mu_option4delete[]='booking_auto_cancel_pending_bookings_for_approved_date';
1320
1321 $default_options['booking_quantity_control'] = ( get_bk_option( 'booking_is_use_visitors_number_for_availability') == 'On' ) ? 'On' : 'Off';
1322 $mu_option4delete[]='booking_quantity_control';
1323 $default_options['booking_capacity_field'] = ( get_bk_option( 'booking_is_use_visitors_number_for_availability') == 'On' ) ? 'select^visitors' : '';
1324 $mu_option4delete[]='booking_capacity_field';
1325
1326 $default_options['booking_is_show_availability_in_tooltips'] = 'On'; // FixIn: 8.1.3.8.
1327 $mu_option4delete[]='booking_is_show_availability_in_tooltips';
1328 $default_options['booking_highlight_availability_word'] = __( 'Available: ', 'booking' );
1329 $mu_option4delete[]='booking_highlight_availability_word';
1330
1331 $default_options['booking_is_show_availability_in_date_cell'] = 'Off'; // FixIn: 10.6.4.1.
1332 $mu_option4delete[]='booking_is_show_availability_in_date_cell';
1333 $default_options['booking_highlight_availability_word_in_date_cell'] = __( 'available', 'booking' );
1334 $mu_option4delete[]='booking_highlight_availability_word_in_date_cell';
1335
1336
1337 $default_options['booking_is_dissbale_booking_for_different_sub_resources'] = 'Off';
1338 $mu_option4delete[]='booking_is_dissbale_booking_for_different_sub_resources';
1339 // FixIn: 10.10.1.2 $default_options['booking_is_resource_no_update__during_editing'] = 'On'; // FixIn: 9.4.2.3.
1340 // FixIn: 10.10.1.2 $mu_option4delete[]='booking_is_resource_no_update__during_editing';
1341 $default_options['booking_search_form_show'] = str_replace( '\\n\\r', "\n", wpbc_get_default_search_form_template( 'standard_search_form' ) ); //FixIn:6.1.0.1 // FixIn: 8.5.2.11.
1342 $mu_option4delete[]='booking_search_form_show';
1343 $default_options['booking_found_search_item'] = str_replace( '\\n\\r', "\n", wpbc_get_default_search_results_template( 'advanced_search_results' ) ); //FixIn:6.1.0.1 // FixIn: 8.5.2.11.
1344 $mu_option4delete[]='booking_found_search_item';
1345 $default_options['booking_cache_expiration'] = '2d';
1346 $mu_option4delete[]='booking_cache_expiration';
1347 $default_options['booking_search_results_order'] = 'prioritet'; // FixIn: 8.4.7.8.
1348 $mu_option4delete[]='booking_search_results_order';
1349 $default_options['booking_search_form_dates_format'] = 'yy-mm-dd'; // FixIn: 8.6.1.21.
1350 $mu_option4delete[]='booking_search_form_dates_format';
1351 $default_options['booking_search_results_days_select'] = 'Off'; // FixIn: 8.8.2.3.
1352 $mu_option4delete[]='booking_search_results_days_select';
1353 $default_options['booking_from_search_scroll_to_calendar'] = 'On'; // FixIn: 9.4.4.6.
1354 $mu_option4delete[]='booking_from_search_scroll_to_calendar';
1355
1356 $default_options['booking_search_from_auto_open_checkout_cal'] = 'On'; // FixIn: 10.0.0.39.
1357 $mu_option4delete[]='booking_search_from_auto_open_checkout_cal';
1358 $default_options['booking_search_from__search_header'] = '[result_count] ' . __('Result(s) Found','booking'); // FixIn: 10.0.0.41.
1359 $mu_option4delete[]='booking_search_from__search_header';
1360 $default_options['booking_search_from__search_header_advanced'] = __( 'Extended Search Results', 'booking' ); // FixIn: 10.0.0.41.
1361 $mu_option4delete[]='booking_search_from__search_header_advanced';
1362 $default_options['booking_search_from__search_nothing_found'] = __('Nothing Found','booking');
1363 $mu_option4delete[]='booking_search_from__search_nothing_found';
1364
1365 $default_options['booking_search_form__dates_required_enabled'] = 'Off';
1366 $mu_option4delete[]='booking_search_form__dates_required_enabled';
1367 $default_options['booking_search_form__dates_required_warning'] = __('Please select check-in and check-out dates to perform the search.','booking');
1368 $mu_option4delete[]='booking_search_form__dates_required_warning';
1369
1370
1371 // Updated during regeneration seacrh cache
1372 //$default_options['booking_cache_content']='';
1373 $mu_option4delete[]='booking_cache_content';
1374 //$default_options['booking_cache_created']=wpbc_datetime_localized( date ('Y-m-d H:i:s'), 'Y-m-d H:i:s' );
1375 $mu_option4delete[]='booking_cache_created';
1376 $mu_option4delete[]='booking_resources_search_options'; // FixIn: 10.0.0.18.
1377 }
1378
1379
1380 // -----------------------------------------------------------------------------------------------------------------
1381 // MU
1382 // -----------------------------------------------------------------------------------------------------------------
1383 if ( class_exists( 'wpdev_bk_multiuser' ) ) {
1384
1385 // FixIn: 8.1.3.19.
1386 $default_options['booking_is_custom_forms_for_regular_users'] = 'Off';
1387 $mu_option4delete[]='booking_is_custom_forms_for_regular_users';
1388
1389 // FixIn: 9.2.3.8.
1390 $default_options['booking_super_admin_receive_regular_user_payments'] = 'Off';
1391 $mu_option4delete[]='booking_super_admin_receive_regular_user_payments';
1392 }
1393
1394
1395 if ( ! $is_get_multiuser_general_options ) {
1396
1397 if ( ! empty( $option_name ) ) {
1398
1399 if (isset( $default_options[ $option_name ] ))
1400 return $default_options[ $option_name ]; // Return 1 option
1401 else
1402 return false; // Option does NOT exist
1403
1404 } else {
1405 return $default_options; // Return ALL
1406 }
1407
1408 } else
1409 return $mu_option4delete; // Get options for MU
1410 }
1411
1412
1413 // <editor-fold defaultstate="collapsed" desc=" Update Deprecated Options " >
1414 function wpbc_after_activation__update_deprecated_options() {
1415 update_bk_option( 'booking_form_is_using_bs_css', 'Off' );
1416 }
1417 add_bk_action( 'wpbc_after_activation', 'wpbc_after_activation__update_deprecated_options' );
1418 // </editor-fold>
1419