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