| 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 |
} |
| 1516 |
|