| @@ -13,8 +13,59 @@ | ||
| 13 | 13 | |
| 14 | 14 | if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
| 15 | 15 | |
| 16 | 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 | + | |
| 17 | 68 | /** Activation & Deactivation of Booking Calendar */ |
| 18 | 69 | class WPBC_BookingInstall extends WPBC_Install { |
| 19 | 70 | |
| 20 | 71 | /** |
| @@ -72,8 +123,11 @@ | ||
| 72 | 123 | // FixIn: 9.9.0.13. |
| 73 | 124 | if ( ( ! $is_make_activation ) && ( class_exists( 'wpdev_bk_biz_m' ) ) && ( ! wpbc_is_table_exists( 'booking_seasons' ) ) ) { |
| 74 | 125 | $is_make_activation = true; |
| 75 | 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 | + } | |
| 76 | 130 | if ( ( ! $is_make_activation ) && ( class_exists( 'wpdev_bk_biz_l' ) ) && ( ! wpbc_is_table_exists( 'booking_coupons' ) ) ) { |
| 77 | 131 | $is_make_activation = true; |
| 78 | 132 | } |
| 79 | 133 | if ( ( ! $is_make_activation ) && ( class_exists( 'wpdev_bk_multiuser' ) ) && ( wpbc_is_field_in_table_exists( 'booking_coupons', 'users' ) == 0 ) ) { |
| @@ -187,8 +241,10 @@ | ||
| 187 | 241 | function wpbc_booking_activate() { |
| 188 | 242 | |
| 189 | 243 | wpbc_load_translation(); |
| 190 | 244 | |
| 245 | + $is_new_install = wpbc_is_plugin_initial_install(); | |
| 246 | + | |
| 191 | 247 | make_bk_action( 'wpbc_before_activation' ); |
| 192 | 248 | |
| 193 | 249 | |
| 194 | 250 | |
| @@ -197,9 +253,19 @@ | ||
| 197 | 253 | |
| 198 | 254 | // ----------------------------------------------------------------------------------------------------------------- |
| 199 | 255 | // Options |
| 200 | 256 | // ----------------------------------------------------------------------------------------------------------------- |
| 201 | - $default_options_to_add = wpbc_get_default_options(); | |
| 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 | + } | |
| 202 | 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. |
| 203 | 269 | make_bk_action( 'wpbc_before_activation__add_options', $default_options_to_add ); // FixIn: 9.6.2.11. |
| 204 | 270 | |
| 205 | 271 | foreach ( $default_options_to_add as $default_option_name => $default_option_value ) { |
| @@ -321,9 +387,13 @@ | ||
| 321 | 387 | $sql_check_table = "SELECT booking_id as id FROM {$wpdb->prefix}booking ORDER BY booking_id DESC LIMIT 0, 100"; |
| 322 | 388 | |
| 323 | 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 |
| 324 | 390 | foreach ( $res as $l ) { |
| 325 | - $wp_queries[] = "UPDATE {$wpdb->prefix}booking SET hash = MD5('" . time() . '_' . wp_rand( 1000, 1000000 ) . "') WHERE booking_id = " . $l->id; // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter | |
| 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 | |
| 326 | 396 | } |
| 327 | 397 | } |
| 328 | 398 | } |
| 329 | 399 | |
| @@ -377,9 +447,9 @@ | ||
| 377 | 447 | if ( $is_insert_test_bookings ) { |
| 378 | 448 | // -- Test Booking #1 -- |
| 379 | 449 | $is_appr = 1; |
| 380 | 450 | $wp_queries_sub = "INSERT INTO {$wpdb->prefix}booking ( form, modification_date ) VALUES ( |
| 381 | - 'text^name1^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') . " );"; | |
| 451 | + 'text^firstname1^John~text^secondname1^Smith~text^email1^example-free@wpbookingcalendar.com~text^phone1^458-77-77~textarea^details1^This is a test booking showing booking for several days.', " . wpbc_sql_date_math_expr_explicit('', 'now') . " );"; | |
| 382 | 452 | $wpdb->query( $wp_queries_sub ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter |
| 383 | 453 | |
| 384 | 454 | $temp_id = $wpdb->insert_id; |
| 385 | 455 | $wp_queries_sub = "INSERT INTO {$wpdb->prefix}bookingdates ( booking_id, booking_date, approved ) VALUES |
| @@ -390,9 +460,9 @@ | ||
| 390 | 460 | |
| 391 | 461 | // -- Test Booking #2 -- |
| 392 | 462 | $is_appr = 0; |
| 393 | 463 | $wp_queries_sub = "INSERT INTO {$wpdb->prefix}booking ( form, modification_date ) VALUES ( |
| 394 | - 'text^name1^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') . " );"; | |
| 464 | + 'text^firstname1^Emma~text^secondname1^Robinson~text^email1^example-free@wpbookingcalendar.com~text^phone1^999-77-77~textarea^details1^This is a test booking showing booking for several days.', " . wpbc_sql_date_math_expr_explicit('', 'now') . " );"; | |
| 395 | 465 | $wpdb->query( $wp_queries_sub ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter |
| 396 | 466 | |
| 397 | 467 | $temp_id = $wpdb->insert_id; |
| 398 | 468 | $wp_queries_sub = "INSERT INTO {$wpdb->prefix}bookingdates ( booking_id, booking_date, approved ) VALUES |
| @@ -406,9 +476,9 @@ | ||
| 406 | 476 | $is_appr = 1; |
| 407 | 477 | $start_time = '10:00'; |
| 408 | 478 | $end_time = '10:30'; |
| 409 | 479 | $wp_queries_sub = "INSERT INTO {$wpdb->prefix}booking ( form, modification_date, is_new ) VALUES ( |
| 410 | - 'selectbox^rangetime1^".$start_time." - ".$end_time."~text^name1^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 );"; | |
| 480 | + 'selectbox^rangetime1^".$start_time." - ".$end_time."~text^firstname1^Sophia~text^secondname1^Robinson~text^email1^example-free@wpbookingcalendar.com~text^phone1^458-77-77~textarea^details1^This is a test booking showing a one day time slot booking.', " . wpbc_sql_date_math_expr_explicit('', 'now') . ", 0 );"; | |
| 411 | 481 | $wpdb->query( $wp_queries_sub ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter |
| 412 | 482 | |
| 413 | 483 | $temp_id = $wpdb->insert_id; |
| 414 | 484 | |
| @@ -440,9 +510,94 @@ | ||
| 440 | 510 | } |
| 441 | 511 | add_bk_action( 'wpbc_activation', 'wpbc_booking_activate' ); |
| 442 | 512 | |
| 443 | 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() { | |
| 444 | 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 | + | |
| 445 | 600 | // Deactivate. |
| 446 | 601 | function wpbc_booking_deactivate() { |
| 447 | 602 | |
| 448 | 603 | // ----------------------------------------------------------------------------------------------------------------- |
| @@ -471,11 +626,18 @@ | ||
| 471 | 626 | $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}booking" ); |
| 472 | 627 | // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter, WordPress.DB.DirectDatabaseQuery.SchemaChange |
| 473 | 628 | $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}bookingdates" ); |
| 474 | 629 | |
| 475 | - // Delete all users booking windows states. | |
| 476 | - // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter, | |
| 477 | - if ( false === $wpdb->query( "DELETE FROM {$wpdb->usermeta} WHERE meta_key LIKE '%booking_%'" ) ) { | |
| 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 ) ) { | |
| 478 | 640 | debuge_error('Error during deleting user meta at DB',__FILE__,__LINE__); |
| 479 | 641 | die(); |
| 480 | 642 | } |
| 481 | 643 | |
| @@ -491,8 +653,10 @@ | ||
| 491 | 653 | //////////////////////////////////////////////////////////////////////////// |
| 492 | 654 | // Other versions Deactivation |
| 493 | 655 | //////////////////////////////////////////////////////////////////////////// |
| 494 | 656 | make_bk_action( 'wpbc_other_versions_deactivation' ); |
| 657 | + | |
| 658 | + wpbc_deactivation__delete_all_plugin_options(); | |
| 495 | 659 | } |
| 496 | 660 | add_bk_action( 'wpbc_deactivation', 'wpbc_booking_deactivate' ); |
| 497 | 661 | |
| 498 | 662 | |
| @@ -506,10 +670,11 @@ | ||
| 506 | 670 | * $options_for_delete = wpbc_get_default_options( $option_name, $is_get_multiuser_general_options ); |
| 507 | 671 | */ |
| 508 | 672 | function wpbc_get_default_options( $option_name = '', $is_get_multiuser_general_options = false ) { |
| 509 | 673 | |
| 510 | - $is_demo = wpbc_is_this_demo(); | |
| 511 | - $blg_title = str_replace( array( '"', "'" ), '', get_option( 'blogname' ) ); | |
| 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' ) ); | |
| 512 | 677 | |
| 513 | 678 | $default_options = array(); |
| 514 | 679 | |
| 515 | 680 | // If this option here, then system get this option from "Super Admin" options configuration for "Regular" users. |
| @@ -517,8 +682,14 @@ | ||
| 517 | 682 | |
| 518 | 683 | // FixIn: 9.6.3.5. |
| 519 | 684 | $default_options['booking_setup_wizard_page_steps_is_done'] = ''; |
| 520 | 685 | $mu_option4delete[]='booking_setup_wizard_page_steps_is_done'; |
| 686 | + $default_options['booking_setup_wizard_initial_install'] = 'Off'; | |
| 687 | + $mu_option4delete[] = 'booking_setup_wizard_initial_install'; | |
| 688 | + $default_options['booking_setup_wizard_first_run_prompt'] = 'Off'; | |
| 689 | + $mu_option4delete[] = 'booking_setup_wizard_first_run_prompt'; | |
| 690 | + $default_options['booking_setup_wizard_booking_pages_prompt'] = 'Off'; | |
| 691 | + $mu_option4delete[] = 'booking_setup_wizard_booking_pages_prompt'; | |
| 521 | 692 | |
| 522 | 693 | $default_options['booking_admin_cal_count'] = ($is_demo) ? '3' : '2'; |
| 523 | 694 | $mu_option4delete[]='booking_admin_cal_count'; // $multiuser_general_option[] = implode( '', array_keys( array_slice( $default_options, -1 ) ) ); |
| 524 | 695 | $default_options['booking_skin'] = '/css/skins/25_5__square_1.css'; // FixIn: 10.11.4.2. |
| @@ -525,8 +696,12 @@ | ||
| 525 | 696 | $mu_option4delete[]='booking_skin'; |
| 526 | 697 | // FixIn: 9.6.3.5. |
| 527 | 698 | $default_options['booking_listing_default_view_mode'] = 'vm_booking_listing'; // 'vm_calendar'; // FixIn: 9.6.3.5. |
| 528 | 699 | $mu_option4delete[]='booking_listing_default_view_mode'; |
| 700 | + $default_options['booking_admin_edit_booking_mode'] = 'popup'; | |
| 701 | + $mu_option4delete[]='booking_admin_edit_booking_mode'; | |
| 702 | + $default_options['booking_resources_catalog_default_view'] = ''; | |
| 703 | + $mu_option4delete[] = 'booking_resources_catalog_default_view'; | |
| 529 | 704 | |
| 530 | 705 | $default_options['booking_view_days_num'] = ( ( ! class_exists( 'wpdev_bk_personal' ) ) ? '90' : '30' ); |
| 531 | 706 | $mu_option4delete[]='booking_view_days_num'; |
| 532 | 707 | // FixIn: 8.9.4.3. |
| @@ -553,16 +728,13 @@ | ||
| 553 | 728 | $mu_option4delete[]='booking_thank_you_page_URL'; |
| 554 | 729 | $default_options['booking_is_use_autofill_4_logged_user'] = ($is_demo) ? 'On' : 'Off'; |
| 555 | 730 | $mu_option4delete[]='booking_is_use_autofill_4_logged_user'; |
| 556 | 731 | |
| 557 | -if ( defined( 'WPBC_NEW_FORM_BUILDER' ) && WPBC_NEW_FORM_BUILDER ) { | |
| 558 | - $default_options['booking_use_bfb_form'] = 'On'; | |
| 559 | -$mu_option4delete[] = 'booking_use_bfb_form'; | |
| 560 | -} | |
| 561 | 732 | // FixIn: 10.13.1.5. |
| 562 | 733 | $default_options['booking_is_use_phone_validation'] = 'Off'; |
| 563 | 734 | $mu_option4delete[]='booking_is_use_phone_validation'; |
| 564 | - $default_options['booking_date_format'] = get_option( 'date_format' ); | |
| 735 | + $wordpress_date_format = get_option( 'date_format' ); | |
| 736 | + $default_options['booking_date_format'] = ( 'F j, Y' === $wordpress_date_format ) ? 'j M Y' : $wordpress_date_format; | |
| 565 | 737 | $mu_option4delete[]='booking_date_format'; |
| 566 | 738 | $default_options['booking_time_format'] = get_option( 'time_format' ); //'H:i'; |
| 567 | 739 | $mu_option4delete[]='booking_time_format'; |
| 568 | 740 | |
| @@ -614,21 +786,19 @@ | ||
| 614 | 786 | |
| 615 | 787 | $mu_option4delete[]='booking_is_load_js_css_on_specific_pages'; |
| 616 | 788 | $default_options['booking_pages_for_load_js_css'] = ''; |
| 617 | 789 | $mu_option4delete[]='booking_pages_for_load_js_css'; |
| 618 | - $default_options['booking_type_of_day_selections'] = ( ( get_bk_option( 'booking_range_selection_is_active' ) == 'On' ) && ( ! $is_demo ) ) ? 'range' : 'multiple'; | |
| 790 | + $default_options['booking_type_of_day_selections'] = $is_free_version | |
| 791 | + ? 'range' | |
| 792 | + : ( ( get_bk_option( 'booking_range_selection_is_active' ) == 'On' ) && ( ! $is_demo ) ? 'range' : 'multiple' ); | |
| 619 | 793 | $mu_option4delete[]='booking_type_of_day_selections'; |
| 620 | 794 | |
| 621 | 795 | // FixIn: 8.7.11.10. |
| 622 | 796 | $default_options['booking_timeslot_picker'] = 'On'; |
| 623 | 797 | $mu_option4delete[]= 'booking_timeslot_picker'; |
| 624 | - $default_options['booking_timeslot_picker_skin'] = '/css/time_picker_skins/light__24_8.css'; | |
| 798 | + $default_options['booking_timeslot_picker_skin'] = '/css/time_picker_skins/form_style.css'; | |
| 625 | 799 | $mu_option4delete[]= 'booking_timeslot_picker_skin'; |
| 626 | 800 | |
| 627 | - $default_options['booking_timeslot_day_bg_as_available'] = 'Off'; //( ( class_exists( 'wpdev_bk_personal' ) ) ? 'Off' : 'On' ); // FixIn: 8.2.1.27. | |
| 628 | - $mu_option4delete[]='booking_timeslot_day_bg_as_available'; | |
| 629 | - | |
| 630 | - | |
| 631 | 801 | $default_options['booking_disable_timeslots_in_tooltip'] = 'Off'; //FixIn: 9.5.0.2.2 |
| 632 | 802 | $mu_option4delete[]='booking_disable_timeslots_in_tooltip'; |
| 633 | 803 | |
| 634 | 804 | $default_options['booking_highlight_timeslot_word'] = __( 'Booked Times:', 'booking' ); // FixIn: 9.4.3.1. |
| @@ -775,11 +945,79 @@ | ||
| 775 | 945 | $default_options['booking_is_show_powered_by_notice'] = ( WPBC_IS_PLAYGROUND ) ? 'Off' : 'On'; |
| 776 | 946 | $mu_option4delete[]='booking_is_show_powered_by_notice'; |
| 777 | 947 | $default_options['booking_form_theme'] = ''; |
| 778 | 948 | $mu_option4delete[]='booking_form_theme'; |
| 779 | - $default_options['booking_is_use_captcha'] = 'Off'; | |
| 949 | + $default_options['booking_form_style'] = 'light_bordered'; | |
| 950 | + $mu_option4delete[]='booking_form_style'; | |
| 951 | + $default_options['booking_form_accent_enabled'] = 'Off'; | |
| 952 | + $mu_option4delete[]='booking_form_accent_enabled'; | |
| 953 | + $default_options['booking_form_accent_color'] = WPBC_DEFAULT_FORM_ACCENT_COLOR; | |
| 954 | + $mu_option4delete[]='booking_form_accent_color'; | |
| 955 | + $default_options['booking_form_appearance_preset'] = 'bordered'; | |
| 956 | + $mu_option4delete[]='booking_form_appearance_preset'; | |
| 957 | + $default_options['booking_form_appearance_background_color'] = '#ffffff'; | |
| 958 | + $mu_option4delete[]='booking_form_appearance_background_color'; | |
| 959 | + $default_options['booking_form_appearance_border_color'] = '#cccccc'; | |
| 960 | + $mu_option4delete[]='booking_form_appearance_border_color'; | |
| 961 | + $default_options['booking_form_appearance_border_width'] = '1px'; | |
| 962 | + $mu_option4delete[]='booking_form_appearance_border_width'; | |
| 963 | + $default_options['booking_form_appearance_border_radius'] = '2px'; | |
| 964 | + $mu_option4delete[]='booking_form_appearance_border_radius'; | |
| 965 | + $default_options['booking_form_appearance_padding'] = '10px 30px'; | |
| 966 | + $mu_option4delete[]='booking_form_appearance_padding'; | |
| 967 | + $default_options['booking_form_custom_background_color'] = '#ffffff'; | |
| 968 | + $mu_option4delete[]='booking_form_custom_background_color'; | |
| 969 | + $default_options['booking_form_custom_border_color'] = '#cccccc'; | |
| 970 | + $mu_option4delete[]='booking_form_custom_border_color'; | |
| 971 | + $default_options['booking_form_custom_border_width'] = '1px'; | |
| 972 | + $mu_option4delete[]='booking_form_custom_border_width'; | |
| 973 | + $default_options['booking_form_custom_border_radius'] = '2px'; | |
| 974 | + $mu_option4delete[]='booking_form_custom_border_radius'; | |
| 975 | + $default_options['booking_form_custom_padding_vertical'] = '10px'; | |
| 976 | + $mu_option4delete[]='booking_form_custom_padding_vertical'; | |
| 977 | + $default_options['booking_form_custom_padding_horizontal'] = '30px'; | |
| 978 | + $mu_option4delete[]='booking_form_custom_padding_horizontal'; | |
| 979 | + $default_options['booking_form_custom_text_color'] = '#1d2327'; | |
| 980 | + $mu_option4delete[]='booking_form_custom_text_color'; | |
| 981 | + $default_options['booking_form_custom_field_background_color'] = '#ffffff'; | |
| 982 | + $mu_option4delete[]='booking_form_custom_field_background_color'; | |
| 983 | + $default_options['booking_form_custom_field_text_color'] = '#3c434a'; | |
| 984 | + $mu_option4delete[]='booking_form_custom_field_text_color'; | |
| 985 | + $default_options['booking_form_custom_field_border_color'] = '#cccccc'; | |
| 986 | + $mu_option4delete[]='booking_form_custom_field_border_color'; | |
| 987 | + $default_options['booking_form_custom_button_background_color'] = '#066aab'; | |
| 988 | + $mu_option4delete[]='booking_form_custom_button_background_color'; | |
| 989 | + $default_options['booking_form_custom_button_text_color'] = '#ffffff'; | |
| 990 | + $mu_option4delete[]='booking_form_custom_button_text_color'; | |
| 991 | + $default_options['booking_form_custom_button_border_color'] = '#066aab'; | |
| 992 | + $mu_option4delete[]='booking_form_custom_button_border_color'; | |
| 993 | + $default_options['booking_form_custom_button_hover_background_color'] = '#055589'; | |
| 994 | + $mu_option4delete[]='booking_form_custom_button_hover_background_color'; | |
| 995 | + $default_options['booking_form_custom_button_hover_text_color'] = '#ffffff'; | |
| 996 | + $mu_option4delete[]='booking_form_custom_button_hover_text_color'; | |
| 997 | + $default_options['booking_form_custom_button_hover_border_color'] = '#055589'; | |
| 998 | + $mu_option4delete[]='booking_form_custom_button_hover_border_color'; | |
| 999 | + $default_options['booking_form_custom_secondary_button_background_color'] = '#fdfdfd'; | |
| 1000 | + $mu_option4delete[]='booking_form_custom_secondary_button_background_color'; | |
| 1001 | + $default_options['booking_form_custom_secondary_button_text_color'] = '#444444'; | |
| 1002 | + $mu_option4delete[]='booking_form_custom_secondary_button_text_color'; | |
| 1003 | + $default_options['booking_form_custom_secondary_button_border_color'] = '#eeeeee'; | |
| 1004 | + $mu_option4delete[]='booking_form_custom_secondary_button_border_color'; | |
| 1005 | + $default_options['booking_form_custom_secondary_button_hover_background_color'] = '#fdfdfd'; | |
| 1006 | + $mu_option4delete[]='booking_form_custom_secondary_button_hover_background_color'; | |
| 1007 | + $default_options['booking_form_custom_secondary_button_hover_text_color'] = '#444444'; | |
| 1008 | + $mu_option4delete[]='booking_form_custom_secondary_button_hover_text_color'; | |
| 1009 | + $default_options['booking_form_custom_secondary_button_hover_border_color'] = '#4d91cd'; | |
| 1010 | + $mu_option4delete[]='booking_form_custom_secondary_button_hover_border_color'; | |
| 1011 | + $default_options['booking_form_custom_button_border_width'] = '1px'; | |
| 1012 | + $mu_option4delete[]='booking_form_custom_button_border_width'; | |
| 1013 | + $default_options['booking_form_custom_button_border_radius'] = '3px'; | |
| 1014 | + $mu_option4delete[]='booking_form_custom_button_border_radius'; | |
| 1015 | + $default_options['booking_is_use_captcha'] = 'Off'; | |
| 780 | 1016 | $mu_option4delete[]='booking_is_use_captcha'; |
| 781 | - $default_options['booking_is_show_legend'] = 'On'; | |
| 1017 | + $default_options['booking_frontend_messages'] = array( 'version' => 1, 'messages' => array(), 'enabled' => array() ); | |
| 1018 | + $mu_option4delete[]='booking_frontend_messages'; | |
| 1019 | + $default_options['booking_is_show_legend'] = 'On'; | |
| 782 | 1020 | $mu_option4delete[]='booking_is_show_legend'; |
| 783 | 1021 | $default_options['booking_send_button_title'] = __( 'Send', 'booking' ); // FixIn: 8.8.1.14. |
| 784 | 1022 | $mu_option4delete[]='booking_send_button_title'; |
| 785 | 1023 | $default_options['booking_legend_is_show_item_available'] = 'On'; |
| @@ -825,8 +1063,10 @@ | ||
| 825 | 1063 | $emails_init = array_merge( $emails_init, wpbc_import6_email__deny__get_fields_array_for_activation() ); |
| 826 | 1064 | $emails_init = array_merge( $emails_init, wpbc_import6_email__trash__get_fields_array_for_activation() ); |
| 827 | 1065 | if ( class_exists( 'wpdev_bk_personal' ) ) |
| 828 | 1066 | $emails_init = array_merge( $emails_init, wpbc_import6_email__modification__get_fields_array_for_activation() ); |
| 1067 | + if ( class_exists( 'wpdev_bk_personal' ) && function_exists( 'wpbc_customer_verification_email_get_initial_values' ) ) | |
| 1068 | + $emails_init = array_merge( $emails_init, wpbc_customer_verification_email_get_initial_values() ); | |
| 829 | 1069 | if ( class_exists( 'wpdev_bk_biz_s' ) ) |
| 830 | 1070 | $emails_init = array_merge( $emails_init, wpbc_import6_email__payment_request__get_fields_array_for_activation() ); |
| 831 | 1071 | foreach ( $emails_init as $email_key_name => $email_values ) { |
| 832 | 1072 | |
| @@ -859,17 +1099,12 @@ | ||
| 859 | 1099 | // PS |
| 860 | 1100 | // ----------------------------------------------------------------------------------------------------------------- |
| 861 | 1101 | if ( class_exists( 'wpdev_bk_personal' ) ) { |
| 862 | 1102 | |
| 863 | - $default_options['booking_is_use_simple_booking_form'] = 'Off'; // FixIn: 8.1.1.12. | |
| 864 | - $mu_option4delete[]='booking_is_use_simple_booking_form'; | |
| 865 | 1103 | |
| 866 | 1104 | $default_options['booking_is_use_codehighlighter_booking_form'] = 'On'; // FixIn: 8.4.7.18. |
| 867 | 1105 | $mu_option4delete[]='booking_is_use_codehighlighter_booking_form'; |
| 868 | 1106 | |
| 869 | - $default_options['booking_form'] = str_replace( '\\n\\', '', wpbc_get_default_booking_form() ); | |
| 870 | - $default_options['booking_form_show'] = str_replace( '\\n\\', '', wpbc_get_default_booking_form_show() ); | |
| 871 | - | |
| 872 | 1107 | $default_options['booking_url_bookings_edit_by_visitors'] = site_url(); |
| 873 | 1108 | $mu_option4delete[]='booking_url_bookings_edit_by_visitors'; |
| 874 | 1109 | |
| 875 | 1110 | $default_options['booking_url_bookings_listing_by_customer'] = site_url(); //FixIn: 8.1.3.5.1 |
| @@ -923,8 +1158,11 @@ | ||
| 923 | 1158 | //$mu_option4delete[]='booking_ics_force_trash_before_import'; // No need to delete ^ |
| 924 | 1159 | $default_options['booking_ics_import_append_checkout_day'] = 'Off'; //FixIn: 9.6.2.7 // FixIn: 9.5.4.1. |
| 925 | 1160 | //$mu_option4delete[]='booking_ics_import_append_checkout_day'; // No need to delete ^ |
| 926 | 1161 | |
| 1162 | + $default_options['booking_ics_import_append_extra_checkout_day'] = 'Off'; | |
| 1163 | + //$mu_option4delete[]='booking_ics_import_append_extra_checkout_day'; // No need to delete ^ | |
| 1164 | + | |
| 927 | 1165 | // FixIn: 9.8.15.8. |
| 928 | 1166 | $default_options['booking_condition_import_only_new'] = ( get_bk_option( 'booking_ics_force_import' ) === 'On' ) ? 'Off' : 'On'; |
| 929 | 1167 | $default_options['booking_condition_import_if_available'] = 'Off'; |
| 930 | 1168 | |
| @@ -973,9 +1211,11 @@ | ||
| 973 | 1211 | $default_options['booking_auto_cancel_pending_unpaid_bk_is_send_email'] = 'On'; |
| 974 | 1212 | $mu_option4delete[]='booking_auto_cancel_pending_unpaid_bk_is_send_email'; |
| 975 | 1213 | $default_options['booking_auto_cancel_pending_unpaid_bk_email_reason'] = __( 'This booking canceled because we did not receive payment and the administrator did not approve it.', 'booking' ); |
| 976 | 1214 | $mu_option4delete[]='booking_auto_cancel_pending_unpaid_bk_email_reason'; |
| 977 | - $default_options['booking_range_selection_type'] = 'fixed'; | |
| 1215 | + // Start every edition with the unrestricted two-click range. | |
| 1216 | + // Business Small+ users can opt into a fixed one-click range later. | |
| 1217 | + $default_options['booking_range_selection_type'] = 'dynamic'; | |
| 978 | 1218 | $mu_option4delete[]='booking_range_selection_type'; |
| 979 | 1219 | $default_options['booking_range_selection_days_count'] = '3'; |
| 980 | 1220 | $mu_option4delete[]='booking_range_selection_days_count'; |
| 981 | 1221 | $default_options['booking_range_selection_days_max_count_dynamic'] = 30; |
| @@ -1043,9 +1283,8 @@ | ||
| 1043 | 1283 | $mu_option4delete[]='booking_unavailable_extra_days_in'; |
| 1044 | 1284 | $default_options['booking_unavailable_extra_days_out'] = ''; |
| 1045 | 1285 | $mu_option4delete[]='booking_unavailable_extra_days_out'; |
| 1046 | 1286 | |
| 1047 | - $default_options['booking_forms_extended'] = serialize( array() ); | |
| 1048 | 1287 | $default_options['booking_advanced_costs_values'] = serialize( array() ); |
| 1049 | 1288 | $default_options['booking_is_resource_deposit_payment_active'] = 'On'; |
| 1050 | 1289 | $mu_option4delete[]='booking_is_resource_deposit_payment_active'; |
| 1051 | 1290 | $default_options['booking_advanced_costs_calc_fixed_cost_with_procents'] = 'Off'; |