PluginProbe
Booking Calendar / 11.8
Booking Calendar v11.8
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, at core/wpbc-activation.php

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