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