PluginProbe
Booking Calendar / 11.9
Booking Calendar v11.9
11.9 11.8.4 11.8.3 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 All 205 releases
booking / core / wpbc-activation.php

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

1,436 lines 79.4 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 [email protected]
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^[email protected]~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^[email protected]~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^[email protected]~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 $default_options['booking_setup_wizard_initial_install'] = 'Off';
684 $mu_option4delete[] = 'booking_setup_wizard_initial_install';
685 $default_options['booking_setup_wizard_first_run_prompt'] = 'Off';
686 $mu_option4delete[] = 'booking_setup_wizard_first_run_prompt';
687 $default_options['booking_setup_wizard_booking_pages_prompt'] = 'Off';
688 $mu_option4delete[] = 'booking_setup_wizard_booking_pages_prompt';
689 $default_options['booking_update_navigation_context'] = array();
690 $mu_option4delete[] = 'booking_update_navigation_context';
691
692 $default_options['booking_admin_cal_count'] = ($is_demo) ? '3' : '2';
693 $mu_option4delete[]='booking_admin_cal_count'; // $multiuser_general_option[] = implode( '', array_keys( array_slice( $default_options, -1 ) ) );
694 $default_options['booking_skin'] = '/css/skins/25_5__square_1.css'; // FixIn: 10.11.4.2.
695 $mu_option4delete[]='booking_skin';
696 // FixIn: 9.6.3.5.
697 $default_options['booking_listing_default_view_mode'] = 'vm_booking_listing'; // 'vm_calendar'; // FixIn: 9.6.3.5.
698 $mu_option4delete[]='booking_listing_default_view_mode';
699 $default_options['booking_admin_edit_booking_mode'] = 'popup';
700 $mu_option4delete[]='booking_admin_edit_booking_mode';
701 $default_options['booking_resources_catalog_default_view'] = '';
702 $mu_option4delete[] = 'booking_resources_catalog_default_view';
703
704 $default_options['booking_view_days_num'] = ( ( ! class_exists( 'wpdev_bk_personal' ) ) ? '90' : '30' );
705 $mu_option4delete[]='booking_view_days_num';
706 // FixIn: 8.9.4.3.
707 $default_options['booking_calendar_overview__day_mode__days_number_show'] = ( ( ! class_exists( 'wpdev_bk_personal' ) ) ? '7' : '7' );
708 $mu_option4delete[]='booking_calendar_overview__day_mode__days_number_show';
709 $default_options['booking_timeline__month_mode__days_number_show'] = ( ( ! class_exists( 'wpdev_bk_personal' ) ) ? '7' : '7' );
710 $mu_option4delete[]='booking_timeline__month_mode__days_number_show';
711 // FixIn: 8.6.1.13.
712 $default_options['booking_max_monthes_in_calendar'] = '2y';
713 $mu_option4delete[]='booking_max_monthes_in_calendar';
714 $default_options['booking_client_cal_count'] = '1';
715 $mu_option4delete[]='booking_client_cal_count';
716 $default_options['booking_start_day_weeek'] = '0';
717 $mu_option4delete[]='booking_start_day_weeek';
718 $default_options['booking_title_after_reservation'] = ( ! class_exists( 'wpdev_bk_biz_s' ) )
719 ? __( 'Your booking is received. We will confirm it soon. Many thanks!', 'booking' )
720 : __( 'Your booking is received. Please proceed with payment to confirm it. Many thanks!', 'booking' );
721 $mu_option4delete[]='booking_title_after_reservation';
722 // $default_options['booking_title_after_reservation_time'] = '7000';
723 //$mu_option4delete[]='booking_title_after_reservation_time';
724 $default_options['booking_type_of_thank_you_message'] = 'message';
725 $mu_option4delete[]='booking_type_of_thank_you_message';
726 $default_options['booking_thank_you_page_URL'] = '/thank-you';
727 $mu_option4delete[]='booking_thank_you_page_URL';
728 $default_options['booking_is_use_autofill_4_logged_user'] = ($is_demo) ? 'On' : 'Off';
729 $mu_option4delete[]='booking_is_use_autofill_4_logged_user';
730
731 // FixIn: 10.13.1.5.
732 $default_options['booking_is_use_phone_validation'] = 'Off';
733 $mu_option4delete[]='booking_is_use_phone_validation';
734 $wordpress_date_format = get_option( 'date_format' );
735 $default_options['booking_date_format'] = ( 'F j, Y' === $wordpress_date_format ) ? 'j M Y' : $wordpress_date_format;
736 $mu_option4delete[]='booking_date_format';
737 $default_options['booking_time_format'] = get_option( 'time_format' ); //'H:i';
738 $mu_option4delete[]='booking_time_format';
739
740 //FixIn:10.2.0.1 ------------------------------------------------------------------------------------------------
741 // Confirmation section:
742 $default_options['booking_confirmation_header_enabled'] = 'On';
743 /* translators: 1: ... */
744 $default_options['booking_confirmation_header'] = sprintf( __( 'Your booking id: %s', 'booking' ), '<strong>[booking_id]</strong>' );
745 $mu_option4delete[] = 'booking_confirmation_header_enabled';
746 $mu_option4delete[] = 'booking_confirmation_header';
747
748 $default_options['booking_confirmation__personal_info__header_enabled'] = 'On';
749 $default_options['booking_confirmation__personal_info__title'] = __( 'Personal information', 'booking' );
750 $default_options['booking_confirmation__personal_info__content'] = '[content]';
751 $mu_option4delete[] = 'booking_confirmation__personal_info__header_enabled';
752 $mu_option4delete[] = 'booking_confirmation__personal_info__title';
753 $mu_option4delete[] = 'booking_confirmation__personal_info__content';
754
755 $default_options['booking_confirmation__booking_details__header_enabled'] = 'On';
756 $default_options['booking_confirmation__booking_details__title'] = __( 'Booking details', 'booking' );
757 $default_options['booking_confirmation__booking_details__content'] = ( class_exists( 'wpdev_bk_personal' ) )
758 ? "<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>'
759 : "[readable_dates][readable_times]\n[add_to_google_cal_button]";
760
761 $mu_option4delete[] = 'booking_confirmation__booking_details__header_enabled';
762 $mu_option4delete[] = 'booking_confirmation__booking_details__title';
763 $mu_option4delete[] = 'booking_confirmation__booking_details__content';
764 //FixIn:10.2.0.1 End --------------------------------------------------------------------------------------------
765
766 $default_options['booking_date_view_type'] = 'short';
767 $mu_option4delete[]='booking_date_view_type';
768 $default_options['booking_is_delete_if_deactive'] = ($is_demo) ? 'On' : 'Off';
769 $mu_option4delete[]='booking_is_delete_if_deactive';
770 $default_options['booking_dif_colors_approval_pending'] = 'On'; // Depricated
771 $default_options['booking_is_use_hints_at_admin_panel'] = 'On';
772 $mu_option4delete[]='booking_is_use_hints_at_admin_panel';
773 $default_options['booking_is_load_js_css_on_specific_pages'] = 'Off';
774 $mu_option4delete[]='booking_is_nonce_at_front_end'; // FixIn: 10.1.1.2.
775 $default_options['booking_is_nonce_at_front_end'] = 'Off';
776 // FixIn: 9.8.6.2.
777 $mu_option4delete[]='booking_load_balancer_max_threads';
778 $default_options['booking_load_balancer_max_threads'] = ( $is_demo ) ? '1' : '3';
779
780
781 //FixIn: 7.2.1.15
782 $mu_option4delete[]='booking_is_show_system_debug_log';
783 $default_options['booking_is_show_system_debug_log'] = 'Off';
784
785
786 $mu_option4delete[]='booking_is_load_js_css_on_specific_pages';
787 $default_options['booking_pages_for_load_js_css'] = '';
788 $mu_option4delete[]='booking_pages_for_load_js_css';
789 $default_options['booking_type_of_day_selections'] = $is_free_version
790 ? 'range'
791 : ( ( get_bk_option( 'booking_range_selection_is_active' ) == 'On' ) && ( ! $is_demo ) ? 'range' : 'multiple' );
792 $mu_option4delete[]='booking_type_of_day_selections';
793
794 // FixIn: 8.7.11.10.
795 $default_options['booking_timeslot_picker'] = 'On';
796 $mu_option4delete[]= 'booking_timeslot_picker';
797 $default_options['booking_timeslot_picker_skin'] = '/css/time_picker_skins/form_style.css';
798 $mu_option4delete[]= 'booking_timeslot_picker_skin';
799
800 $default_options['booking_disable_timeslots_in_tooltip'] = 'Off'; //FixIn: 9.5.0.2.2
801 $mu_option4delete[]='booking_disable_timeslots_in_tooltip';
802
803 $default_options['booking_highlight_timeslot_word'] = __( 'Booked Times:', 'booking' ); // FixIn: 9.4.3.1.
804 $mu_option4delete[]='booking_highlight_timeslot_word';
805
806 $default_options['booking_form_is_using_bs_css'] = 'Off';
807 $mu_option4delete[]='booking_form_is_using_bs_css';
808 $default_options['booking_form_format_type'] = 'vertical';
809 $mu_option4delete[]='booking_form_format_type';
810
811 // Does not exist in MU
812 $default_options['booking_form_field_active1'] = 'On';
813 $default_options['booking_form_field_required1'] = 'On';
814 $default_options['booking_form_field_label1'] = 'First Name';
815 $default_options['booking_form_field_active2'] = 'On';
816 $default_options['booking_form_field_required2'] = 'On';
817 $default_options['booking_form_field_label2'] = 'Last Name';
818 $default_options['booking_form_field_active3'] = 'On';
819 $default_options['booking_form_field_required3'] = 'On';
820 $default_options['booking_form_field_label3'] = 'Email';
821 $default_options['booking_form_field_active4'] = 'On';
822 $default_options['booking_form_field_required4'] = 'Off';
823 $default_options['booking_form_field_label4'] = 'Phone';
824 $default_options['booking_form_field_active5'] = 'On';
825 $default_options['booking_form_field_required5'] = 'Off';
826 $default_options['booking_form_field_label5'] = 'Details';
827 $default_options['booking_form_field_active6'] = 'Off';
828 $default_options['booking_form_field_required6'] = 'Off';
829 $default_options['booking_form_field_label6'] = 'Visitors';
830 $default_options['booking_form_field_values6'] = "1\n2\n3\n4";
831
832
833 $default_options['booking_is_days_always_available'] = 'Off';
834 $mu_option4delete[]='booking_is_days_always_available';
835
836 // FixIn: 8.3.2.2.
837 $default_options['booking_is_show_pending_days_as_available'] = 'Off';
838 $mu_option4delete[]='booking_is_show_pending_days_as_available';
839
840 $default_options['booking_unavailable_days_num_from_today'] = '0';
841 $mu_option4delete[]='booking_unavailable_days_num_from_today';
842 $default_options['booking_unavailable_day0'] = 'Off';
843 $mu_option4delete[]='booking_unavailable_day0';
844 $default_options['booking_unavailable_day1'] = 'Off';
845 $mu_option4delete[]='booking_unavailable_day1';
846 $default_options['booking_unavailable_day2'] = 'Off';
847 $mu_option4delete[]='booking_unavailable_day2';
848 $default_options['booking_unavailable_day3'] = 'Off';
849 $mu_option4delete[]='booking_unavailable_day3';
850 $default_options['booking_unavailable_day4'] = 'Off';
851 $mu_option4delete[]='booking_unavailable_day4';
852 $default_options['booking_unavailable_day5'] = 'Off';
853 $mu_option4delete[]='booking_unavailable_day5';
854 $default_options['booking_unavailable_day6'] = 'Off';
855 $mu_option4delete[]='booking_unavailable_day6';
856
857 // Working Time defaults. Keep disabled by default on fresh activation/reinstall.
858 $default_options['booking_working_time_enabled'] = 'Off';
859 $mu_option4delete[]='booking_working_time_enabled';
860 $default_options['booking_working_time_rules'] = function_exists( 'wpbc_working_time__get_default_settings' ) ? wpbc_working_time__get_default_settings() : array(
861 'enabled' => 'Off',
862 'default' => array(
863 'weekdays' => array(),
864 ),
865 'resources' => array(),
866 );
867 $mu_option4delete[]='booking_working_time_rules';
868
869 $default_options['booking_menu_position'] = ( $is_demo ) ? 'top' : 'top';
870 $mu_option4delete[]='booking_menu_position';
871 $default_options['booking_translation_load_from'] = 'wp.org';
872 $mu_option4delete[]='booking_translation_load_from';
873
874 // FixIn: 10.14.12.1.
875 $default_options['booking_user_role_booking'] = 'editor';
876 $mu_option4delete[]='booking_user_role_booking';
877 $default_options['booking_user_role_availability'] = 'editor';
878 $mu_option4delete[]='booking_user_role_availability';
879 $default_options['booking_user_role_addbooking'] = 'editor';
880 $mu_option4delete[]='booking_user_role_addbooking';
881 $default_options['booking_user_role_resources'] = 'editor';
882 $mu_option4delete[]='booking_user_role_resources';
883 $default_options['booking_user_role_settings'] = 'editor';
884 $mu_option4delete[]='booking_user_role_settings';
885 //FixIn: 9.8.15.2.6
886 if ( class_exists( 'wpdev_bk_biz_m' ) ) {
887 $default_options['booking_user_role_prices'] = 'editor';
888 $mu_option4delete[]='booking_user_role_prices';
889 }
890
891 // New admin ///////////////////////////////////////////////////////////////
892
893 $default_options['booking_is_email_reservation_adress'] = 'On';
894 $default_options['booking_email_reservation_adress'] = htmlspecialchars( '"Booking system" <' . get_option( 'admin_email' ) . '>' );
895 $default_options['booking_email_reservation_from_adress'] = '[visitoremail]';
896 $default_options['booking_email_reservation_subject'] = __( 'New booking', 'booking' );
897 /* translators: 1: ... */
898 $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]' ) );
899
900 // New Visitor /////////////////////////////////////////////////////////////
901
902 $default_options['booking_is_email_newbookingbyperson_adress'] = 'Off';
903 $default_options['booking_email_newbookingbyperson_adress'] = htmlspecialchars( '"Booking system" <' . get_option( 'admin_email' ) . '>' );
904 $default_options['booking_email_newbookingbyperson_subject'] = __( 'New booking', 'booking' );
905 if ( class_exists( 'wpdev_bk_personal' ) )
906 /* translators: 1: ... */
907 $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]' ) );
908 else
909 /* translators: 1: ... */
910 $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]' ) );
911
912 // Approval ////////////////////////////////////////////////////////////////
913
914 $default_options['booking_is_email_approval_adress'] = 'On';
915 $default_options['booking_is_email_approval_send_copy_to_admin'] = 'Off';
916 $default_options['booking_email_approval_adress'] = htmlspecialchars( '"Booking system" <' . get_option( 'admin_email' ) . '>' );
917 $default_options['booking_email_approval_subject'] = __( 'Your booking has been approved', 'booking' );
918 if ( class_exists( 'wpdev_bk_personal' ) ) {
919 /* translators: 1: ... */
920 $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]' ) );
921 } else {
922 /* translators: 1: ... */
923 $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]' ) );
924 }
925
926 // Decline /////////////////////////////////////////////////////////////////
927
928 $default_options['booking_is_email_deny_adress'] = 'On';
929 $default_options['booking_is_email_deny_send_copy_to_admin'] = 'Off';
930 $default_options['booking_email_deny_adress'] = htmlspecialchars( '"Booking system" <' . get_option( 'admin_email' ) . '>' );
931 $default_options['booking_email_deny_subject'] = __( 'Your booking has been declined', 'booking' );
932 /* translators: 1: ... */
933 $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]' ) );
934
935 // -----------------------------------------------------------------------------------------------------------------
936 $default_options['booking_widget_title'] = __( 'Booking form', 'booking' );
937 $default_options['booking_widget_show'] = 'booking_form';
938 $default_options['booking_widget_type'] = '1';
939 $default_options['booking_widget_calendar_count'] = '1';
940 $default_options['booking_widget_last_field'] = '';
941
942 $default_options['booking_wpdev_copyright_adminpanel'] = 'On';
943 $mu_option4delete[]='booking_wpdev_copyright_adminpanel';
944 $default_options['booking_is_show_powered_by_notice'] = ( WPBC_IS_PLAYGROUND ) ? 'Off' : 'On';
945 $mu_option4delete[]='booking_is_show_powered_by_notice';
946 $default_options['booking_form_theme'] = '';
947 $mu_option4delete[]='booking_form_theme';
948 $default_options['booking_form_style'] = 'light_bordered';
949 $mu_option4delete[]='booking_form_style';
950 $default_options['booking_form_accent_enabled'] = 'Off';
951 $mu_option4delete[]='booking_form_accent_enabled';
952 $default_options['booking_form_accent_color'] = WPBC_DEFAULT_FORM_ACCENT_COLOR;
953 $mu_option4delete[]='booking_form_accent_color';
954 $default_options['booking_form_appearance_preset'] = 'bordered';
955 $mu_option4delete[]='booking_form_appearance_preset';
956 $default_options['booking_form_appearance_background_color'] = '#ffffff';
957 $mu_option4delete[]='booking_form_appearance_background_color';
958 $default_options['booking_form_appearance_border_color'] = '#cccccc';
959 $mu_option4delete[]='booking_form_appearance_border_color';
960 $default_options['booking_form_appearance_border_width'] = '1px';
961 $mu_option4delete[]='booking_form_appearance_border_width';
962 $default_options['booking_form_appearance_border_radius'] = '2px';
963 $mu_option4delete[]='booking_form_appearance_border_radius';
964 $default_options['booking_form_appearance_padding'] = '10px 30px';
965 $mu_option4delete[]='booking_form_appearance_padding';
966 $default_options['booking_form_custom_background_color'] = '#ffffff';
967 $mu_option4delete[]='booking_form_custom_background_color';
968 $default_options['booking_form_custom_border_color'] = '#cccccc';
969 $mu_option4delete[]='booking_form_custom_border_color';
970 $default_options['booking_form_custom_border_width'] = '1px';
971 $mu_option4delete[]='booking_form_custom_border_width';
972 $default_options['booking_form_custom_border_radius'] = '2px';
973 $mu_option4delete[]='booking_form_custom_border_radius';
974 $default_options['booking_form_custom_padding_vertical'] = '10px';
975 $mu_option4delete[]='booking_form_custom_padding_vertical';
976 $default_options['booking_form_custom_padding_horizontal'] = '30px';
977 $mu_option4delete[]='booking_form_custom_padding_horizontal';
978 $default_options['booking_form_custom_text_color'] = '#1d2327';
979 $mu_option4delete[]='booking_form_custom_text_color';
980 $default_options['booking_form_custom_field_background_color'] = '#ffffff';
981 $mu_option4delete[]='booking_form_custom_field_background_color';
982 $default_options['booking_form_custom_field_text_color'] = '#3c434a';
983 $mu_option4delete[]='booking_form_custom_field_text_color';
984 $default_options['booking_form_custom_field_border_color'] = '#cccccc';
985 $mu_option4delete[]='booking_form_custom_field_border_color';
986 $default_options['booking_form_custom_button_background_color'] = '#066aab';
987 $mu_option4delete[]='booking_form_custom_button_background_color';
988 $default_options['booking_form_custom_button_text_color'] = '#ffffff';
989 $mu_option4delete[]='booking_form_custom_button_text_color';
990 $default_options['booking_form_custom_button_border_color'] = '#066aab';
991 $mu_option4delete[]='booking_form_custom_button_border_color';
992 $default_options['booking_form_custom_button_hover_background_color'] = '#055589';
993 $mu_option4delete[]='booking_form_custom_button_hover_background_color';
994 $default_options['booking_form_custom_button_hover_text_color'] = '#ffffff';
995 $mu_option4delete[]='booking_form_custom_button_hover_text_color';
996 $default_options['booking_form_custom_button_hover_border_color'] = '#055589';
997 $mu_option4delete[]='booking_form_custom_button_hover_border_color';
998 $default_options['booking_form_custom_secondary_button_background_color'] = '#fdfdfd';
999 $mu_option4delete[]='booking_form_custom_secondary_button_background_color';
1000 $default_options['booking_form_custom_secondary_button_text_color'] = '#444444';
1001 $mu_option4delete[]='booking_form_custom_secondary_button_text_color';
1002 $default_options['booking_form_custom_secondary_button_border_color'] = '#eeeeee';
1003 $mu_option4delete[]='booking_form_custom_secondary_button_border_color';
1004 $default_options['booking_form_custom_secondary_button_hover_background_color'] = '#fdfdfd';
1005 $mu_option4delete[]='booking_form_custom_secondary_button_hover_background_color';
1006 $default_options['booking_form_custom_secondary_button_hover_text_color'] = '#444444';
1007 $mu_option4delete[]='booking_form_custom_secondary_button_hover_text_color';
1008 $default_options['booking_form_custom_secondary_button_hover_border_color'] = '#4d91cd';
1009 $mu_option4delete[]='booking_form_custom_secondary_button_hover_border_color';
1010 $default_options['booking_form_custom_button_border_width'] = '1px';
1011 $mu_option4delete[]='booking_form_custom_button_border_width';
1012 $default_options['booking_form_custom_button_border_radius'] = '3px';
1013 $mu_option4delete[]='booking_form_custom_button_border_radius';
1014 $default_options['booking_is_use_captcha'] = 'Off';
1015 $mu_option4delete[]='booking_is_use_captcha';
1016 $default_options['booking_frontend_messages'] = array( 'version' => 1, 'messages' => array(), 'enabled' => array() );
1017 $mu_option4delete[]='booking_frontend_messages';
1018 $default_options['booking_is_show_legend'] = 'On';
1019 $mu_option4delete[]='booking_is_show_legend';
1020 $default_options['booking_send_button_title'] = __( 'Send', 'booking' ); // FixIn: 8.8.1.14.
1021 $mu_option4delete[]='booking_send_button_title';
1022 $default_options['booking_legend_is_show_item_available'] = 'On';
1023 $mu_option4delete[]='booking_legend_is_show_item_available';
1024 $default_options['booking_legend_text_for_item_available'] = __( 'Available', 'booking' );
1025 $mu_option4delete[]='booking_legend_text_for_item_available';
1026 $default_options['booking_legend_is_show_item_pending'] = 'On';
1027 $mu_option4delete[]='booking_legend_is_show_item_pending';
1028 $default_options['booking_legend_text_for_item_pending'] = __( 'Pending', 'booking' );
1029 $mu_option4delete[]='booking_legend_text_for_item_pending';
1030 $default_options['booking_legend_is_show_item_approved'] = 'On';
1031 $mu_option4delete[]='booking_legend_is_show_item_approved';
1032 $default_options['booking_legend_text_for_item_approved'] = __( 'Booked', 'booking' );
1033 $mu_option4delete[]='booking_legend_text_for_item_approved';
1034 // FixIn: 9.9.0.5.
1035 $default_options['booking_legend_is_show_item_unavailable'] = 'Off';
1036 $mu_option4delete[]='booking_legend_is_show_item_unavailable';
1037 $default_options['booking_legend_text_for_item_unavailable'] = __( 'Unavailable', 'booking' );
1038 $mu_option4delete[]='booking_legend_text_for_item_unavailable';
1039
1040 // FixIn: 10.1.5.5.
1041 $default_options['booking_legend_is_show_item_partially'] = ( ( class_exists( 'wpdev_bk_personal' ) ) && ( ! class_exists( 'wpdev_bk_biz_s' ) ) ) ? 'Off' : 'On';
1042 $mu_option4delete[]='booking_legend_is_show_item_partially';
1043 $default_options['booking_legend_text_for_item_partially'] = __( 'Partially booked', 'booking' );
1044 $mu_option4delete[]='booking_legend_text_for_item_partially';
1045
1046 $default_options['booking_legend_is_show_numbers'] = 'On'; //FixIn:6.0.1.4 // FixIn: 8.1.3.8.
1047 $mu_option4delete[]='booking_legend_is_show_numbers';
1048 $default_options['booking_legend_is_vertical'] = 'Off'; // FixIn: 9.4.3.6.
1049 $mu_option4delete[]='booking_legend_is_vertical';
1050
1051 /*
1052 Import previous (old version) Email templates
1053 or get defult values from Email Classes, if the emails was not saved
1054 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.
1055 So if we get empty array for values, in this case, we need to get this optiosn from DB.
1056 */
1057 // Get NEW Email Templates default data or Import previous saved
1058 $emails_init = wpbc_import6_email__new_admin__get_fields_array_for_activation();
1059 $emails_init = array_merge( $emails_init, wpbc_import6_email__new_visitor__get_fields_array_for_activation() );
1060 $emails_init = array_merge( $emails_init, wpbc_import6_email__approved__get_fields_array_for_activation() );
1061 $emails_init = array_merge( $emails_init, wpbc_import6_email__deleted__get_fields_array_for_activation() );
1062 $emails_init = array_merge( $emails_init, wpbc_import6_email__deny__get_fields_array_for_activation() );
1063 $emails_init = array_merge( $emails_init, wpbc_import6_email__trash__get_fields_array_for_activation() );
1064 if ( class_exists( 'wpdev_bk_personal' ) )
1065 $emails_init = array_merge( $emails_init, wpbc_import6_email__modification__get_fields_array_for_activation() );
1066 if ( class_exists( 'wpdev_bk_personal' ) && function_exists( 'wpbc_customer_verification_email_get_initial_values' ) )
1067 $emails_init = array_merge( $emails_init, wpbc_customer_verification_email_get_initial_values() );
1068 if ( class_exists( 'wpdev_bk_biz_s' ) )
1069 $emails_init = array_merge( $emails_init, wpbc_import6_email__payment_request__get_fields_array_for_activation() );
1070 foreach ( $emails_init as $email_key_name => $email_values ) {
1071
1072 if ( ! empty( $email_values ) ) $default_options[ $email_key_name ] = $email_values;
1073 else $default_options[ $email_key_name ] = get_bk_option( $email_key_name );
1074 }
1075
1076
1077 $mu_option4delete[]='booking_gcal_auto_import_is_active'; // Creation in wpbc-gcal.php file
1078 $mu_option4delete[]='booking_gcal_auto_import_time';
1079 $mu_option4delete[]='booking_cron'; // Creation in wpbc-cron.php
1080
1081 // FixIn: 8.0.1.6.
1082 //$default_options['booking_form_structure_type'] = 'vertical';
1083 // $default_options['booking_form_structure_type'] = 'form_right'; // FixIn: 10.3.0.6.
1084 $default_options['booking_form_structure_type'] = 'wizard_services_a'; // FixIn: 10.11.4.3.
1085 $default_options['booking_menu_go_pro'] = ( WPBC_IS_PLAYGROUND ) ? 'hide' : 'show'; // show | hide
1086
1087 // $default_options['booking_form_layout_width'] = '440';
1088 // $default_options['booking_form_layout_width_px_pr'] = 'px';
1089 // $default_options['booking_form_layout_max_cols'] = 1;
1090
1091 // FixIn: 10.11.4.3.
1092 $default_options['booking_form_layout_width'] = '100';
1093 $default_options['booking_form_layout_width_px_pr'] = '%';
1094 $default_options['booking_form_layout_max_cols'] = 2;
1095
1096
1097 // -----------------------------------------------------------------------------------------------------------------
1098 // PS
1099 // -----------------------------------------------------------------------------------------------------------------
1100 if ( class_exists( 'wpdev_bk_personal' ) ) {
1101
1102
1103 $default_options['booking_is_use_codehighlighter_booking_form'] = 'On'; // FixIn: 8.4.7.18.
1104 $mu_option4delete[]='booking_is_use_codehighlighter_booking_form';
1105
1106 $default_options['booking_url_bookings_edit_by_visitors'] = site_url();
1107 $mu_option4delete[]='booking_url_bookings_edit_by_visitors';
1108
1109 $default_options['booking_url_bookings_listing_by_customer'] = site_url(); //FixIn: 8.1.3.5.1
1110 $mu_option4delete[]='booking_url_bookings_listing_by_customer';
1111
1112 $default_options['booking_default_booking_resource'] = ''; // All resources
1113 $mu_option4delete[]='booking_default_booking_resource';
1114 $default_options['booking_is_change_hash_after_approvement'] = 'On'; // FixIn: 10.10.1.1.
1115 $mu_option4delete[]='booking_is_change_hash_after_approvement';
1116 $default_options['booking_email_modification_adress'] = htmlspecialchars( '"Booking system" <' . get_option( 'admin_email' ) . '>' );
1117 $default_options['booking_email_modification_subject'] = __( 'The reservation has been modified', 'booking' );
1118 /* translators: 1: ... */
1119 $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]' ) );
1120 $default_options['booking_is_email_modification_adress'] = 'On';
1121 $default_options['booking_is_email_modification_send_copy_to_admin'] = 'Off';
1122 $default_options['booking_resourses_num_per_page'] = '10';
1123 $mu_option4delete[]='booking_resourses_num_per_page';
1124 $default_options['booking_default_title_in_day_for_calendar_view_mode'] = '[id]: [name] [secondname]';
1125 $mu_option4delete[]='booking_default_title_in_day_for_calendar_view_mode';
1126
1127 // FixIn: 8.1.3.31.
1128 $default_options['booking_calendar_overview_start_time'] = '0';
1129 $mu_option4delete[]='booking_calendar_overview_start_time';
1130 $default_options['booking_calendar_overview_end_time'] = '24';
1131 $mu_option4delete[]='booking_calendar_overview_end_time';
1132
1133 $default_options['booking_default_title_in_day_for_timeline_front_end'] = '[name] [secondname]';
1134 $mu_option4delete[]='booking_default_title_in_day_for_timeline_front_end';
1135 // FixIn: 10.14.10.1.
1136 $default_options['booking_is_show_popover_in_timeline_front_end'] = 'Off';
1137 $mu_option4delete[]='booking_is_show_popover_in_timeline_front_end';
1138 // FixIn: 9.6.3.5.
1139
1140 $default_options['booking_send_emails_off_addbooking'] = 'Off'; // FixIn: 8.4.5.4.
1141 $mu_option4delete[]='booking_send_emails_off_addbooking';
1142
1143 // FixIn: 9.6.3.5.
1144
1145 $default_options['booking_change_resource_skip_checking'] = 'Off'; // FixIn: 8.4.5.4.
1146 $mu_option4delete[]='booking_change_resource_skip_checking';
1147
1148 $default_options['booking_log_booking_actions'] = 'On'; // FixIn: 8.6.1.10.
1149 $mu_option4delete[]='booking_log_booking_actions';
1150
1151
1152 }
1153
1154 // FixIn: 8.5.1.1.
1155 // $default_options['booking_ics_force_import'] = 'Off'; // FixIn: 8.4.7.1.
1156 $default_options['booking_ics_force_trash_before_import'] = 'Off'; // FixIn: 8.4.7.12.
1157 //$mu_option4delete[]='booking_ics_force_trash_before_import'; // No need to delete ^
1158 $default_options['booking_ics_import_append_checkout_day'] = 'Off'; //FixIn: 9.6.2.7 // FixIn: 9.5.4.1.
1159 //$mu_option4delete[]='booking_ics_import_append_checkout_day'; // No need to delete ^
1160
1161 $default_options['booking_ics_import_append_extra_checkout_day'] = 'Off';
1162 //$mu_option4delete[]='booking_ics_import_append_extra_checkout_day'; // No need to delete ^
1163
1164 // FixIn: 9.8.15.8.
1165 $default_options['booking_condition_import_only_new'] = ( get_bk_option( 'booking_ics_force_import' ) === 'On' ) ? 'Off' : 'On';
1166 $default_options['booking_condition_import_if_available'] = 'Off';
1167
1168 // FixIn: 10.1.5.4.
1169 $default_options['booking_recurrent_time'] = ( class_exists( 'wpdev_bk_personal' ) ) ? 'Off' : 'On';
1170 $mu_option4delete[]='booking_recurrent_time';
1171
1172 $default_options['booking_calendar_allow_several_months_on_mobile'] = 'Off';
1173 $mu_option4delete[]='booking_calendar_allow_several_months_on_mobile';
1174
1175 // -----------------------------------------------------------------------------------------------------------------
1176 // BS
1177 // -----------------------------------------------------------------------------------------------------------------
1178 if ( class_exists( 'wpdev_bk_biz_s' ) ) {
1179
1180 //$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
1181
1182 $default_options['booking_gateways_order'] = 'stripe_v3,paypal_std_co,paypal,authorizenet,sage,redsys,bank_transfer,pay_cash,ipay88,ideal'; // Default Original Payment Gateways
1183 //$mu_option4delete[]='booking_gateways_order'; // No need to delete ^
1184
1185 // FixIn: 8.1.3.29.
1186 $default_options['booking_ics_import_add_change_over_time'] = 'On';
1187 //$mu_option4delete[]='booking_ics_import_add_change_over_time'; // No need to delete ^
1188
1189 // FixIn: 8.5.2.3.
1190 $default_options['booking_is_ics_export_only_approved'] = 'Off';
1191 //$mu_option4delete[]='booking_is_ics_export_only_approved'; // No need to delete ^
1192 $default_options['booking_is_ics_export_imported_bookings'] = ''; // FixIn: 8.8.3.19.
1193
1194
1195 $default_options['booking_auto_approve_new_bookings_is_active'] = 'Off';
1196 $mu_option4delete[]='booking_auto_approve_new_bookings_is_active';
1197
1198 // FixIn: 8.1.3.27.
1199 $default_options['booking_auto_approve_bookings_when_import'] = 'Off';
1200 $mu_option4delete[]='booking_auto_approve_bookings_when_import';
1201 $default_options['booking_auto_approve_bookings_when_zero_cost'] = 'Off';
1202 $mu_option4delete[]='booking_auto_approve_bookings_when_zero_cost';
1203 $default_options['booking_auto_approve_bookings_if_added_in_admin_panel'] = 'Off';
1204 $mu_option4delete[]='booking_auto_approve_bookings_if_added_in_admin_panel';
1205
1206 $default_options['booking_auto_cancel_pending_unpaid_bk_is_active'] = 'Off';
1207 $mu_option4delete[]='booking_auto_cancel_pending_unpaid_bk_is_active';
1208 $default_options['booking_auto_cancel_pending_unpaid_bk_time'] = '24';
1209 $mu_option4delete[]='booking_auto_cancel_pending_unpaid_bk_time';
1210 $default_options['booking_auto_cancel_pending_unpaid_bk_is_send_email'] = 'On';
1211 $mu_option4delete[]='booking_auto_cancel_pending_unpaid_bk_is_send_email';
1212 $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' );
1213 $mu_option4delete[]='booking_auto_cancel_pending_unpaid_bk_email_reason';
1214 // Start every edition with the unrestricted two-click range.
1215 // Business Small+ users can opt into a fixed one-click range later.
1216 $default_options['booking_range_selection_type'] = 'dynamic';
1217 $mu_option4delete[]='booking_range_selection_type';
1218 $default_options['booking_range_selection_days_count'] = '3';
1219 $mu_option4delete[]='booking_range_selection_days_count';
1220 $default_options['booking_range_selection_days_max_count_dynamic'] = 30;
1221 $mu_option4delete[]='booking_range_selection_days_max_count_dynamic';
1222 $default_options['booking_range_selection_days_specific_num_dynamic'] = '';
1223 $mu_option4delete[]='booking_range_selection_days_specific_num_dynamic';
1224 $default_options['booking_range_start_day'] = '-1';
1225 $mu_option4delete[]='booking_range_start_day';
1226 $default_options['booking_range_selection_days_count_dynamic'] = '1';
1227 $mu_option4delete[]='booking_range_selection_days_count_dynamic';
1228 $default_options['booking_range_start_day_dynamic'] = '-1';
1229 $mu_option4delete[]='booking_range_start_day_dynamic';
1230 $default_options['booking_range_selection_time_is_active'] = 'Off';
1231 $mu_option4delete[]='booking_range_selection_time_is_active';
1232 $default_options['booking_range_selection_start_time'] = '12:00';
1233 $mu_option4delete[]='booking_range_selection_start_time';
1234 $default_options['booking_range_selection_end_time'] = '10:00';
1235 $mu_option4delete[]='booking_range_selection_end_time';
1236 $default_options['booking_change_over_days_triangles'] = 'On'; // FixIn: 7.0.1.24.
1237
1238 $mu_option4delete[]='booking_last_checkout_day_available';
1239 $default_options['booking_last_checkout_day_available'] = 'Off'; // FixIn: 8.1.3.28.
1240
1241 $mu_option4delete[]='booking_change_over_days_triangles';
1242
1243 $mu_option4delete[]='booking_change_over__is_excerpt_on_pages';
1244 $default_options['booking_change_over__is_excerpt_on_pages'] = 'Off'; // FixIn: 8.9.4.10.
1245 $mu_option4delete[]='booking_change_over__excerpt_on_pages';
1246 $default_options['booking_change_over__excerpt_on_pages'] = ''; // FixIn: 8.9.4.10.
1247 $mu_option4delete[]='booking_change_over__excerpt_bk_resources';
1248 $default_options['booking_change_over__excerpt_bk_resources'] = ''; // FixIn: 10.16.4.1.
1249
1250
1251 $default_options['booking_email_payment_request_adress'] = htmlspecialchars( '"Booking system" <' . get_option( 'admin_email' ) . '>' );
1252 $default_options['booking_email_payment_request_subject'] = __( 'You need to make payment for this reservation', 'booking' );
1253 /* translators: 1: ... */
1254 $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]' ) );
1255 $default_options['booking_is_email_payment_request_adress'] = 'On';
1256 $default_options['booking_is_email_payment_request_send_copy_to_admin'] = 'Off';
1257 }
1258
1259
1260 // -----------------------------------------------------------------------------------------------------------------
1261 // BM
1262 // -----------------------------------------------------------------------------------------------------------------
1263 if ( class_exists( 'wpdev_bk_biz_m' ) ) {
1264
1265 // FixIn: 8.1.3.15.
1266 $default_options['booking_is_show_booked_data_in_tooltips'] = 'Off';
1267 $mu_option4delete[]='booking_is_show_booked_data_in_tooltips';
1268 $default_options['booking_booked_data_in_tooltips'] = '[name] [secondname]';
1269 $mu_option4delete[]='booking_booked_data_in_tooltips';
1270
1271 $default_options['booking_number_for_pre_checkin_date_hint'] = '14'; // FixIn: 10.0.0.31.
1272 $mu_option4delete[]='booking_number_for_pre_checkin_date_hint';
1273 $default_options['booking_available_days_num_from_today'] = '';
1274 $mu_option4delete[]='booking_available_days_num_from_today';
1275 $default_options['booking_unavailable_extra_in_out'] = '';
1276 $mu_option4delete[]='booking_unavailable_extra_in_out';
1277 $default_options['booking_unavailable_extra_minutes_in'] = '';
1278 $mu_option4delete[]='booking_unavailable_extra_minutes_in';
1279 $default_options['booking_unavailable_extra_minutes_out'] = '';
1280 $mu_option4delete[]='booking_unavailable_extra_minutes_out';
1281 $default_options['booking_unavailable_extra_days_in'] = '';
1282 $mu_option4delete[]='booking_unavailable_extra_days_in';
1283 $default_options['booking_unavailable_extra_days_out'] = '';
1284 $mu_option4delete[]='booking_unavailable_extra_days_out';
1285
1286 $default_options['booking_advanced_costs_values'] = serialize( array() );
1287 $default_options['booking_is_resource_deposit_payment_active'] = 'On';
1288 $mu_option4delete[]='booking_is_resource_deposit_payment_active';
1289 $default_options['booking_advanced_costs_calc_fixed_cost_with_procents'] = 'Off';
1290 $default_options['booking_is_show_cost_in_tooltips'] = 'Off';
1291 $mu_option4delete[]='booking_is_show_cost_in_tooltips';
1292 $default_options['booking_highlight_cost_word'] = __( 'Cost: ', 'booking' );
1293 $mu_option4delete[]='booking_highlight_cost_word';
1294 $default_options['booking_is_show_cost_in_date_cell'] = 'Off';
1295 $mu_option4delete[]='booking_is_show_cost_in_date_cell';
1296 $default_options['booking_cost_in_date_cell_currency'] = '&#36;';
1297 $mu_option4delete[]='booking_cost_in_date_cell_currency';
1298 $default_options['booking_visitor_number_rate'] = '0'; //Depricated
1299 $default_options['booking_visitor_number_rate_type'] = '%'; //Depricated
1300 }
1301
1302
1303 // -----------------------------------------------------------------------------------------------------------------
1304 // BL
1305 // -----------------------------------------------------------------------------------------------------------------
1306 if ( class_exists( 'wpdev_bk_biz_l' ) ) {
1307
1308 // Get Key of Last added item to "$default_options" array
1309 // $multiuser_general_option[] = implode( '', array_keys( array_slice( $default_options, -1 ) ) );
1310
1311 $default_options['booking_check_out_available_for_parents'] = 'On';
1312 $mu_option4delete[]='booking_check_out_available_for_parents';
1313 $default_options['booking_check_in_available_for_parents'] = 'Off';
1314 $mu_option4delete[]='booking_check_in_available_for_parents';
1315 $default_options['booking_is_show_pending_days_as_available'] = 'Off';
1316 $mu_option4delete[]='booking_is_show_pending_days_as_available';
1317 $default_options['booking_auto_cancel_pending_bookings_for_approved_date'] = 'Off';
1318 $mu_option4delete[]='booking_auto_cancel_pending_bookings_for_approved_date';
1319
1320 $default_options['booking_quantity_control'] = ( get_bk_option( 'booking_is_use_visitors_number_for_availability') == 'On' ) ? 'On' : 'Off';
1321 $mu_option4delete[]='booking_quantity_control';
1322 $default_options['booking_capacity_field'] = ( get_bk_option( 'booking_is_use_visitors_number_for_availability') == 'On' ) ? 'select^visitors' : '';
1323 $mu_option4delete[]='booking_capacity_field';
1324
1325 $default_options['booking_is_show_availability_in_tooltips'] = 'On'; // FixIn: 8.1.3.8.
1326 $mu_option4delete[]='booking_is_show_availability_in_tooltips';
1327 $default_options['booking_highlight_availability_word'] = __( 'Available: ', 'booking' );
1328 $mu_option4delete[]='booking_highlight_availability_word';
1329
1330 $default_options['booking_is_show_availability_in_date_cell'] = 'Off'; // FixIn: 10.6.4.1.
1331 $mu_option4delete[]='booking_is_show_availability_in_date_cell';
1332 $default_options['booking_highlight_availability_word_in_date_cell'] = __( 'available', 'booking' );
1333 $mu_option4delete[]='booking_highlight_availability_word_in_date_cell';
1334
1335
1336 $default_options['booking_is_dissbale_booking_for_different_sub_resources'] = 'Off';
1337 $mu_option4delete[]='booking_is_dissbale_booking_for_different_sub_resources';
1338 // FixIn: 10.10.1.2 $default_options['booking_is_resource_no_update__during_editing'] = 'On'; // FixIn: 9.4.2.3.
1339 // FixIn: 10.10.1.2 $mu_option4delete[]='booking_is_resource_no_update__during_editing';
1340 $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.
1341 $mu_option4delete[]='booking_search_form_show';
1342 $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.
1343 $mu_option4delete[]='booking_found_search_item';
1344 $default_options['booking_cache_expiration'] = '2d';
1345 $mu_option4delete[]='booking_cache_expiration';
1346 $default_options['booking_search_results_order'] = 'prioritet'; // FixIn: 8.4.7.8.
1347 $mu_option4delete[]='booking_search_results_order';
1348 $default_options['booking_search_form_dates_format'] = 'yy-mm-dd'; // FixIn: 8.6.1.21.
1349 $mu_option4delete[]='booking_search_form_dates_format';
1350 $default_options['booking_search_results_days_select'] = 'Off'; // FixIn: 8.8.2.3.
1351 $mu_option4delete[]='booking_search_results_days_select';
1352 $default_options['booking_from_search_scroll_to_calendar'] = 'On'; // FixIn: 9.4.4.6.
1353 $mu_option4delete[]='booking_from_search_scroll_to_calendar';
1354
1355 $default_options['booking_search_from_auto_open_checkout_cal'] = 'On'; // FixIn: 10.0.0.39.
1356 $mu_option4delete[]='booking_search_from_auto_open_checkout_cal';
1357 $default_options['booking_search_from__search_header'] = '[result_count] ' . __('Result(s) Found','booking'); // FixIn: 10.0.0.41.
1358 $mu_option4delete[]='booking_search_from__search_header';
1359 $default_options['booking_search_from__search_header_advanced'] = __( 'Extended Search Results', 'booking' ); // FixIn: 10.0.0.41.
1360 $mu_option4delete[]='booking_search_from__search_header_advanced';
1361 $default_options['booking_search_from__search_nothing_found'] = __('Nothing Found','booking');
1362 $mu_option4delete[]='booking_search_from__search_nothing_found';
1363
1364 $default_options['booking_search_form__dates_required_enabled'] = 'Off';
1365 $mu_option4delete[]='booking_search_form__dates_required_enabled';
1366 $default_options['booking_search_form__dates_required_warning'] = __('Please select check-in and check-out dates to perform the search.','booking');
1367 $mu_option4delete[]='booking_search_form__dates_required_warning';
1368
1369
1370 // Updated during regeneration seacrh cache
1371 //$default_options['booking_cache_content']='';
1372 $mu_option4delete[]='booking_cache_content';
1373 //$default_options['booking_cache_created']=wpbc_datetime_localized( date ('Y-m-d H:i:s'), 'Y-m-d H:i:s' );
1374 $mu_option4delete[]='booking_cache_created';
1375 $mu_option4delete[]='booking_resources_search_options'; // FixIn: 10.0.0.18.
1376 }
1377
1378
1379 // -----------------------------------------------------------------------------------------------------------------
1380 // MU
1381 // -----------------------------------------------------------------------------------------------------------------
1382 if ( class_exists( 'wpdev_bk_multiuser' ) ) {
1383
1384 // FixIn: 8.1.3.19.
1385 $default_options['booking_is_custom_forms_for_regular_users'] = 'Off';
1386 $mu_option4delete[]='booking_is_custom_forms_for_regular_users';
1387
1388 // FixIn: 9.2.3.8.
1389 $default_options['booking_super_admin_receive_regular_user_payments'] = 'Off';
1390 $mu_option4delete[]='booking_super_admin_receive_regular_user_payments';
1391 }
1392
1393 /**
1394 * Filters the complete Booking Calendar default-option registry.
1395 *
1396 * Edition modules may register missing-value defaults without placing their
1397 * domain-specific option names in the shared Free-version implementation.
1398 * Existing stored values continue to be preserved by the activation layer.
1399 *
1400 * @param array $default_options Default option names and values.
1401 */
1402 $default_options = apply_filters( 'wpbc_default_options', $default_options );
1403
1404 /**
1405 * Filters option names handled by the applicable MultiUser cleanup flow.
1406 *
1407 * @param array $mu_option4delete Option names registered for cleanup.
1408 */
1409 $mu_option4delete = apply_filters( 'wpbc_multiuser_options_for_delete', $mu_option4delete );
1410
1411
1412 if ( ! $is_get_multiuser_general_options ) {
1413
1414 if ( ! empty( $option_name ) ) {
1415
1416 if (isset( $default_options[ $option_name ] ))
1417 return $default_options[ $option_name ]; // Return 1 option
1418 else
1419 return false; // Option does NOT exist
1420
1421 } else {
1422 return $default_options; // Return ALL
1423 }
1424
1425 } else
1426 return $mu_option4delete; // Get options for MU
1427 }
1428
1429
1430 // <editor-fold defaultstate="collapsed" desc=" Update Deprecated Options " >
1431 function wpbc_after_activation__update_deprecated_options() {
1432 update_bk_option( 'booking_form_is_using_bs_css', 'Off' );
1433 }
1434 add_bk_action( 'wpbc_after_activation', 'wpbc_after_activation__update_deprecated_options' );
1435 // </editor-fold>
1436