| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
| 3 |
add_action('admin_menu', 'eshb_custom_submenu_page'); |
| 4 |
|
| 5 |
function eshb_custom_submenu_page() { |
| 6 |
|
| 7 |
include 'functions.php'; |
| 8 |
|
| 9 |
// Define all submenus in an array |
| 10 |
$submenus = [ |
| 11 |
|
| 12 |
// Always visible menus |
| 13 |
[ |
| 14 |
'parent' => 'edit.php?post_type=eshb_accomodation', |
| 15 |
'page' => 'Services', |
| 16 |
'menu' => 'Services', |
| 17 |
'cap' => 'manage_options', |
| 18 |
'slug' => 'edit.php?post_type=eshb_service', |
| 19 |
'callback' => '' |
| 20 |
], |
| 21 |
[ |
| 22 |
'parent' => 'edit.php?post_type=eshb_accomodation', |
| 23 |
'page' => 'Seasons & Pricing', |
| 24 |
'menu' => 'Seasons & Pricing', |
| 25 |
'cap' => 'manage_options', |
| 26 |
'slug' => 'edit.php?post_type=eshb_session', |
| 27 |
'callback' => '' |
| 28 |
], |
| 29 |
[ |
| 30 |
'parent' => 'edit.php?post_type=eshb_accomodation', |
| 31 |
'page' => 'Coupons', |
| 32 |
'menu' => 'Coupons', |
| 33 |
'cap' => 'manage_options', |
| 34 |
'slug' => 'edit.php?post_type=eshb_coupon', |
| 35 |
'callback' => '' |
| 36 |
], |
| 37 |
[ |
| 38 |
'parent' => 'edit.php?post_type=eshb_accomodation', |
| 39 |
'page' => 'Bookings', |
| 40 |
'menu' => 'Bookings', |
| 41 |
'cap' => 'manage_options', |
| 42 |
'slug' => 'edit.php?post_type=eshb_booking', |
| 43 |
'callback' => '' |
| 44 |
], |
| 45 |
[ |
| 46 |
'parent' => 'edit.php?post_type=eshb_accomodation', |
| 47 |
'page' => 'Payments', |
| 48 |
'menu' => 'Payments', |
| 49 |
'cap' => 'manage_options', |
| 50 |
'slug' => 'edit.php?post_type=eshb_payment', |
| 51 |
'callback' => '' |
| 52 |
], |
| 53 |
[ |
| 54 |
'parent' => 'edit.php?post_type=eshb_accomodation', |
| 55 |
'page' => 'Booking Calendar', |
| 56 |
'menu' => 'Booking Calendar', |
| 57 |
'cap' => 'manage_options', |
| 58 |
'slug' => 'eshb_bookings_calendar', |
| 59 |
'callback' => 'eshb_booking_details_calendar_callback' |
| 60 |
], |
| 61 |
|
| 62 |
// Hidden page |
| 63 |
[ |
| 64 |
'parent' => 'admin.php', |
| 65 |
'page' => 'View Booking Data', |
| 66 |
'menu' => 'View Booking Data', |
| 67 |
'cap' => 'edit_posts', |
| 68 |
'slug' => 'view_booking_data', |
| 69 |
'callback' => 'eshb_get_booking_data_tables' |
| 70 |
] |
| 71 |
]; |
| 72 |
|
| 73 |
// Loop through and register each submenu |
| 74 |
foreach ($submenus as $submenu) { |
| 75 |
if ( $submenu ) { |
| 76 |
add_submenu_page( |
| 77 |
$submenu['parent'], |
| 78 |
$submenu['page'], |
| 79 |
$submenu['menu'], |
| 80 |
$submenu['cap'], |
| 81 |
$submenu['slug'], |
| 82 |
$submenu['callback'] |
| 83 |
); |
| 84 |
} |
| 85 |
} |
| 86 |
} |
| 87 |
|
| 88 |
add_action( 'plugins_loaded', function(){ |
| 89 |
// Create a section |
| 90 |
$general_option_fields = array( |
| 91 |
array( |
| 92 |
'id' => 'availability-calendar', |
| 93 |
'type' => 'switcher', |
| 94 |
'title' => 'Availability Calendar', |
| 95 |
'desc' => 'On this switch if you want to show Availability Calendar on the accomodation page.', |
| 96 |
'default' => true, |
| 97 |
), |
| 98 |
array( |
| 99 |
'id' => 'day-wise-pricing', |
| 100 |
'type' => 'switcher', |
| 101 |
'title' => 'Show Day Wise Pricing', |
| 102 |
'desc' => 'On this switch if you want to show day wise pricing on the accomodation page.', |
| 103 |
'default' => true, |
| 104 |
), |
| 105 |
array( |
| 106 |
'id' => 'check-in-out-time', |
| 107 |
'type' => 'switcher', |
| 108 |
'title' => 'Show Check In & Out Time', |
| 109 |
'desc' => 'On this switch if you want to show check-in and check-out on the accomodation page.', |
| 110 |
'default' => true, |
| 111 |
), |
| 112 |
array( |
| 113 |
'id' => 'check-in-time', |
| 114 |
'type' => 'datetime', |
| 115 |
'title' => 'Check in Time', |
| 116 |
//'desc' => 'Add Booking Time', |
| 117 |
'settings' => array( |
| 118 |
'time_24hr' => false, |
| 119 |
'noCalendar' => true, |
| 120 |
'enableTime' => true, |
| 121 |
), |
| 122 |
'dependency' => array( 'check-in-out-time', '==', true ), |
| 123 |
), |
| 124 |
array( |
| 125 |
'id' => 'check-out-time', |
| 126 |
'type' => 'datetime', |
| 127 |
'title' => 'Check out Time', |
| 128 |
//'desc' => 'Add Booking Time', |
| 129 |
'settings' => array( |
| 130 |
'time_24hr' => false, |
| 131 |
'noCalendar' => true, |
| 132 |
'enableTime' => true, |
| 133 |
), |
| 134 |
'dependency' => array( 'check-in-out-time', '==', true ), |
| 135 |
), |
| 136 |
array( |
| 137 |
'id' => 'extra-services-switcher', |
| 138 |
'type' => 'switcher', |
| 139 |
'title' => 'Extra Services', |
| 140 |
'default' => true |
| 141 |
), |
| 142 |
array( |
| 143 |
'id' => 'accomodation-gallery', |
| 144 |
'type' => 'switcher', |
| 145 |
'title' => 'Accomodation Gallery', |
| 146 |
'desc' => 'On this switch if you want to show accomodation gallery on the accomodation page.', |
| 147 |
'default' => true, |
| 148 |
), |
| 149 |
array( |
| 150 |
'id' => 'currency_symbol', |
| 151 |
'type' => 'text', |
| 152 |
'title' => 'Currency Symbol', |
| 153 |
'desc' => 'Add currency symbol here if you want to use custom currency.' |
| 154 |
), |
| 155 |
array( |
| 156 |
'id' => 'currency_position', |
| 157 |
'type' => 'select', |
| 158 |
'title' => 'Currency Position', |
| 159 |
'placeholder' => 'Select an option', |
| 160 |
'options' => array( |
| 161 |
'left' => 'Left', |
| 162 |
'right' => 'Right', |
| 163 |
), |
| 164 |
'default' => 'left' |
| 165 |
), |
| 166 |
|
| 167 |
// --- Search Options ------------------------------------- |
| 168 |
array( |
| 169 |
'type' => 'subheading', |
| 170 |
'content' => 'Search Options', |
| 171 |
), |
| 172 |
array( |
| 173 |
'id' => 'search-form-archive', |
| 174 |
'type' => 'switcher', |
| 175 |
'title' => 'Search Form at Archive Page', |
| 176 |
'default' => true |
| 177 |
), |
| 178 |
array( |
| 179 |
'id' => 'search-form-fields', |
| 180 |
'type' => 'select', |
| 181 |
'title' => 'Search Form Fields', |
| 182 |
'multiple' => true, |
| 183 |
'placeholder' => 'Select an option', |
| 184 |
'options' => array( |
| 185 |
'adults' => 'Adults', |
| 186 |
'childrens' => 'Children', |
| 187 |
'rooms' => 'Rooms', |
| 188 |
), |
| 189 |
'default' => ['adults', 'childrens'] |
| 190 |
), |
| 191 |
array( |
| 192 |
'id' => 'min-adult-capacity', |
| 193 |
'type' => 'number', |
| 194 |
'title' => 'Minimum Adult Capacity for Search', |
| 195 |
), |
| 196 |
array( |
| 197 |
'id' => 'adult-capacity', |
| 198 |
'type' => 'number', |
| 199 |
'title' => 'Maximum Adult Capacity for Search', |
| 200 |
), |
| 201 |
array( |
| 202 |
'id' => 'min-children-capacity', |
| 203 |
'type' => 'number', |
| 204 |
'title' => 'Minimum Children Capacity for Search', |
| 205 |
), |
| 206 |
array( |
| 207 |
'id' => 'children-capacity', |
| 208 |
'type' => 'number', |
| 209 |
'title' => 'Maximum Children Capacity for Search', |
| 210 |
), |
| 211 |
array( |
| 212 |
'id' => 'search-form-calendar-icon', |
| 213 |
'type' => 'switcher', |
| 214 |
'title' => 'Search Form Calendar Icon', |
| 215 |
'default' => false |
| 216 |
), |
| 217 |
// --- Booking Options ------------------------------------- |
| 218 |
array( |
| 219 |
'type' => 'subheading', |
| 220 |
'content' => 'Booking Options', |
| 221 |
), |
| 222 |
array( |
| 223 |
'id' => 'booking-auto-approval', |
| 224 |
'type' => 'switcher', |
| 225 |
'title' => 'Auto Approve Booking', |
| 226 |
'default' => true |
| 227 |
), |
| 228 |
array( |
| 229 |
'id' => 'booking-form', |
| 230 |
'type' => 'switcher', |
| 231 |
'title' => 'Booking Form', |
| 232 |
'desc' => 'On this switch if you want to show booking form on the accomodation page.', |
| 233 |
'default' => true, |
| 234 |
), |
| 235 |
array( |
| 236 |
'id' => 'booking-form-calendar-icon', |
| 237 |
'type' => 'switcher', |
| 238 |
'title' => 'Booking Form Calendar Icon', |
| 239 |
'default' => false |
| 240 |
), |
| 241 |
array( |
| 242 |
'id' => 'booking-btn-switcher', |
| 243 |
'type' => 'switcher', |
| 244 |
'title' => 'Booking Button Visibility', |
| 245 |
'default' => true |
| 246 |
), |
| 247 |
array( |
| 248 |
'id' => 'booking-min-adult-capacity', |
| 249 |
'type' => 'number', |
| 250 |
'title' => 'Minimum Adult Capacity for Booking', |
| 251 |
), |
| 252 |
array( |
| 253 |
'id' => 'booking-min-children-capacity', |
| 254 |
'type' => 'number', |
| 255 |
'title' => 'Minimum Children Capacity for Booking', |
| 256 |
), |
| 257 |
array( |
| 258 |
'id' => 'booking-form-fields', |
| 259 |
'type' => 'select', |
| 260 |
'title' => 'Booking Form Fields', |
| 261 |
'multiple' => true, |
| 262 |
'placeholder' => 'Select an option', |
| 263 |
'options' => array( |
| 264 |
'adults' => 'Adults', |
| 265 |
'childrens' => 'Children', |
| 266 |
'rooms' => 'Rooms', |
| 267 |
'extra_beds' => 'Extra Beds', |
| 268 |
), |
| 269 |
'default' => ['adults', 'childrens', 'rooms', 'extra_beds'] |
| 270 |
), |
| 271 |
); |
| 272 |
do_action( 'eshb_settings_fields_init'); |
| 273 |
|
| 274 |
$general_option_fields = apply_filters( 'eshb_general_option_fields', $general_option_fields ); |
| 275 |
|
| 276 |
// Control core classes for avoid errors |
| 277 |
if( class_exists( 'ESHB' ) ) { |
| 278 |
|
| 279 |
// Set a unique slug-like ID |
| 280 |
$prefix = 'eshb_settings'; |
| 281 |
|
| 282 |
// Create options |
| 283 |
ESHB::createOptions( $prefix, array( |
| 284 |
|
| 285 |
// framework title |
| 286 |
'framework_title' => 'Easy Hotel Settings', |
| 287 |
'framework_class' => 'easy-hotel-settings easy-hotel-plugin-settings', |
| 288 |
|
| 289 |
// menu settings |
| 290 |
'menu_title' => 'Settings', |
| 291 |
'menu_slug' => 'easy-hotel-settings', |
| 292 |
//'menu_type' => 'submenu', |
| 293 |
'menu_capability' => 'manage_options', |
| 294 |
'menu_icon' => 'dashicons-schedule', |
| 295 |
'menu_position' => 15, |
| 296 |
'menu_hidden' => true, |
| 297 |
//'menu_parent' => 'edit.php?post_type=eshb_accomodation', |
| 298 |
|
| 299 |
// menu extras |
| 300 |
'show_bar_menu' => false, |
| 301 |
'show_sub_menu' => true, |
| 302 |
'show_in_network' => true, |
| 303 |
'show_in_customizer' => false, |
| 304 |
|
| 305 |
'show_search' => false, |
| 306 |
'show_reset_all' => true, |
| 307 |
'show_reset_section' => false, |
| 308 |
'show_footer' => false, |
| 309 |
'show_all_options' => false, |
| 310 |
'show_form_warning' => true, |
| 311 |
'sticky_header' => true, |
| 312 |
'save_defaults' => true, |
| 313 |
'ajax_save' => true, |
| 314 |
|
| 315 |
// admin bar menu settings |
| 316 |
'admin_bar_menu_icon' => '', |
| 317 |
'admin_bar_menu_priority' => 80, |
| 318 |
|
| 319 |
// footer |
| 320 |
'footer_text' => '', |
| 321 |
'footer_after' => '', |
| 322 |
'footer_credit' => '', |
| 323 |
|
| 324 |
// database model |
| 325 |
'database' => '', // options, transient, theme_mod, network |
| 326 |
'transient_time' => 0, |
| 327 |
|
| 328 |
// contextual help |
| 329 |
'contextual_help' => array(), |
| 330 |
'contextual_help_sidebar' => '', |
| 331 |
|
| 332 |
// typography options |
| 333 |
'enqueue_webfont' => true, |
| 334 |
'async_webfont' => false, |
| 335 |
|
| 336 |
// others |
| 337 |
'output_css' => true, |
| 338 |
|
| 339 |
// theme and wrapper classname |
| 340 |
'nav' => 'inline', |
| 341 |
'theme' => 'light', |
| 342 |
'class' => '', |
| 343 |
|
| 344 |
// external default values |
| 345 |
'defaults' => array(), |
| 346 |
|
| 347 |
) ); |
| 348 |
|
| 349 |
|
| 350 |
|
| 351 |
ESHB::createSection( $prefix, array( |
| 352 |
'title' => 'General', |
| 353 |
'fields' => $general_option_fields |
| 354 |
)); |
| 355 |
|
| 356 |
ESHB::createSection( $prefix, array( |
| 357 |
'title' => 'Pages', |
| 358 |
'fields' => array( |
| 359 |
// Select with pages |
| 360 |
array( |
| 361 |
'id' => 'archive-page', |
| 362 |
'type' => 'select', |
| 363 |
'title' => 'Rooms Archive Page', |
| 364 |
'placeholder' => 'Default', |
| 365 |
'options' => 'pages', |
| 366 |
'default' => '1', |
| 367 |
'query_args' => array( |
| 368 |
'posts_per_page' => -1 // for get all pages (also it's same for posts). |
| 369 |
), |
| 370 |
), |
| 371 |
array( |
| 372 |
'id' => 'archive-page-template-style', |
| 373 |
'type' => 'select', |
| 374 |
'title' => 'Room Archive Page Style', |
| 375 |
'options' => array( |
| 376 |
'style-one' => 'Style One', |
| 377 |
'style-two' => 'Style Two' |
| 378 |
), |
| 379 |
'default' => 'style-one', |
| 380 |
), |
| 381 |
array( |
| 382 |
'id' => 'single-page-template-style', |
| 383 |
'type' => 'select', |
| 384 |
'title' => 'Room Details Page Style', |
| 385 |
'options' => array( |
| 386 |
'style-one' => 'Style One', |
| 387 |
'style-two' => 'Style Two' |
| 388 |
), |
| 389 |
'default' => 'style-one', |
| 390 |
), |
| 391 |
array( |
| 392 |
'id' => 'search-result-page', |
| 393 |
'type' => 'select', |
| 394 |
'title' => 'Search Result Page', |
| 395 |
'placeholder' => 'Default', |
| 396 |
'options' => 'pages', |
| 397 |
'query_args' => array( |
| 398 |
'posts_per_page' => -1 // for get all pages (also it's same for posts). |
| 399 |
), |
| 400 |
), |
| 401 |
array( |
| 402 |
'id' => 'account-page', |
| 403 |
'type' => 'select', |
| 404 |
'title' => 'Account Page', |
| 405 |
'placeholder' => 'Default', |
| 406 |
'options' => 'pages', |
| 407 |
'query_args' => array( |
| 408 |
'posts_per_page' => -1 // for get all pages (also it's same for posts). |
| 409 |
), |
| 410 |
), |
| 411 |
array( |
| 412 |
'id' => 'terms-and-conditions-page', |
| 413 |
'type' => 'select', |
| 414 |
'title' => 'Terms and Conditions Page', |
| 415 |
'placeholder' => 'Default', |
| 416 |
'options' => 'pages', |
| 417 |
'query_args' => array( |
| 418 |
'posts_per_page' => -1 // for get all pages (also it's same for posts). |
| 419 |
), |
| 420 |
), |
| 421 |
) |
| 422 |
) |
| 423 |
); |
| 424 |
|
| 425 |
ESHB::createSection( $prefix, array( |
| 426 |
'title' => 'Accomodations', |
| 427 |
'fields' => array( |
| 428 |
array( |
| 429 |
'id' => 'accomodation_base_name', |
| 430 |
'type' => 'text', |
| 431 |
'title' => 'Base Name', |
| 432 |
//'desc' => 'Add URL if you select External Booking' |
| 433 |
'default' => 'eshb_accomodation' |
| 434 |
), |
| 435 |
array( |
| 436 |
'id' => 'accomodation_posts_per_page', |
| 437 |
'type' => 'number', |
| 438 |
'title' => 'Posts Per Page', |
| 439 |
//'desc' => 'Add URL if you select External Booking' |
| 440 |
'default' => 6 |
| 441 |
), |
| 442 |
array( |
| 443 |
'id' => 'accomodation_posts_per_row', |
| 444 |
'type' => 'number', |
| 445 |
'title' => 'Posts Per Row (Columns)', |
| 446 |
//'desc' => 'Add URL if you select External Booking' |
| 447 |
'default' => 3 |
| 448 |
), |
| 449 |
array( |
| 450 |
'id' => 'accomodation_posts_order_by', |
| 451 |
'type' => 'select', |
| 452 |
'title' => 'Posts Order By', |
| 453 |
//'desc' => 'Add URL if you select External Booking' |
| 454 |
'options' => array( |
| 455 |
'none' => 'none', |
| 456 |
'id' => 'ID', |
| 457 |
'date' => 'Date', |
| 458 |
'title' => 'Title', |
| 459 |
'name' => 'name', |
| 460 |
'menu_order' => 'Menu Order', |
| 461 |
'random' => 'Random' |
| 462 |
), |
| 463 |
'default' => 'none' |
| 464 |
), |
| 465 |
array( |
| 466 |
'id' => 'accomodation_posts_order', |
| 467 |
'type' => 'select', |
| 468 |
'title' => 'Posts Order', |
| 469 |
//'desc' => 'Add URL if you select External Booking' |
| 470 |
'options' => array( |
| 471 |
'DESC' => 'DESC', |
| 472 |
'ASC' => 'ASC' |
| 473 |
), |
| 474 |
'default' => 'DESC' |
| 475 |
), |
| 476 |
array( |
| 477 |
'id' => 'related-accomodation-switcher-in-single', |
| 478 |
'type' => 'switcher', |
| 479 |
'title' => 'Show Related Accomodations in Details Page', |
| 480 |
'default' => true |
| 481 |
), |
| 482 |
) |
| 483 |
) |
| 484 |
); |
| 485 |
|
| 486 |
$admin_email = get_option('admin_email'); |
| 487 |
|
| 488 |
ESHB::createSection( $prefix, array( |
| 489 |
'title' => 'Booking', |
| 490 |
'fields' => array( |
| 491 |
// Select with pages |
| 492 |
array( |
| 493 |
'id' => 'booking-type', |
| 494 |
'type' => 'select', |
| 495 |
'title' => 'Checkout Method', |
| 496 |
'placeholder' => 'Select an option', |
| 497 |
'options' => array( |
| 498 |
'woocommerce' => 'Woocoommerce Checkout', |
| 499 |
'surecart' => 'SurecCart Checkout', |
| 500 |
'native_checkout' => 'Native Checkout', |
| 501 |
'external' => 'External Checkout', |
| 502 |
'booking_request' => 'Booking Request', |
| 503 |
'disable' => 'Disable Booking', |
| 504 |
), |
| 505 |
'default' => 'native_checkout' |
| 506 |
), |
| 507 |
array( |
| 508 |
'id' => 'booking-form-type', |
| 509 |
'type' => 'select', |
| 510 |
'title' => 'Booking Form Type', |
| 511 |
'placeholder' => 'Select an option', |
| 512 |
'options' => array( |
| 513 |
'default' => 'Default', |
| 514 |
'cf7' => 'Contact Form 7', |
| 515 |
'fluentform' => 'Fluent Form', |
| 516 |
), |
| 517 |
'default' => 'default', |
| 518 |
'dependency' => array( 'booking-type', '==', 'booking_request' ) |
| 519 |
), |
| 520 |
array( |
| 521 |
'id' => 'booking-form-shortcode', |
| 522 |
'type' => 'text', |
| 523 |
'title' => 'Booking Form Shortcode', |
| 524 |
'desc' => 'You can use Contact Form 7 or MetForm shortcode to display booking form. Read <a href="https://documentation.themewant.com/easy-hotel/booking-form-shortcode/" target="_blank">Documentation</a> to know how to configure this.', |
| 525 |
'default' => '', |
| 526 |
'dependency' => array( ['booking-type', '==', 'booking_request'], ['booking-form-type', '!=', 'default'] ) |
| 527 |
), |
| 528 |
array( |
| 529 |
'id' => 'external-booking-link', |
| 530 |
'type' => 'text', |
| 531 |
'title' => 'External Booking Link', |
| 532 |
'desc' => 'Add URL if you select External Booking', |
| 533 |
'dependency' => array( 'booking-type', '==', 'external' ) |
| 534 |
), |
| 535 |
array( |
| 536 |
'id' => 'direct-booking', |
| 537 |
'type' => 'switcher', |
| 538 |
'title' => 'Direct Booking', |
| 539 |
'desc' => 'Enable for redirect to checkout page after adding room to cart.', |
| 540 |
'default' => true, |
| 541 |
'dependency' => array( 'booking-type', '==', 'woocommerce' ), |
| 542 |
), |
| 543 |
array( |
| 544 |
'id' => 'cart-blocking-switcher', |
| 545 |
'type' => 'switcher', |
| 546 |
'title' => 'Enable Cart Blocking', |
| 547 |
'desc' => 'Temporarily block calendar dates when a user adds to cart.', |
| 548 |
'default' => false, |
| 549 |
), |
| 550 |
array( |
| 551 |
'id' => 'cart-blocking-time', |
| 552 |
'type' => 'number', |
| 553 |
'title' => 'Blocking Duration (minutes)', |
| 554 |
'desc' => 'How long dates are held after a user adds to cart.', |
| 555 |
'default' => 5, |
| 556 |
'dependency' => array( 'cart-blocking-switcher', '==', true ), |
| 557 |
), |
| 558 |
array( |
| 559 |
'id' => 'cart-blocking-notice-msg', |
| 560 |
'type' => 'text', |
| 561 |
'title' => 'Checkout Countdown Message', |
| 562 |
'desc' => 'Text shown before the countdown timer on the cart/checkout page.', |
| 563 |
'default' => 'Your reservation is held for', |
| 564 |
'dependency' => array( 'cart-blocking-switcher', '==', true ), |
| 565 |
), |
| 566 |
array( |
| 567 |
'id' => 'checkout-billing-fields', |
| 568 |
'type' => 'select', |
| 569 |
'title' => 'Billing Fields', |
| 570 |
'desc' => 'Select which billing fields to display on the checkout page. Unselected fields will be hidden.', |
| 571 |
'multiple' => true, |
| 572 |
'dependency' => array( 'booking-type', '==', 'woocommerce' ), |
| 573 |
'placeholder' => 'Select fields to show', |
| 574 |
'options' => array( |
| 575 |
'billing_first_name' => 'First Name', |
| 576 |
'billing_last_name' => 'Last Name', |
| 577 |
'billing_company' => 'Company', |
| 578 |
'billing_email' => 'Email Address', |
| 579 |
'billing_phone' => 'Phone', |
| 580 |
'billing_address_1' => 'Address Line 1', |
| 581 |
'billing_address_2' => 'Address Line 2', |
| 582 |
'billing_city' => 'City', |
| 583 |
'billing_postcode' => 'Postcode / ZIP', |
| 584 |
'billing_country' => 'Country', |
| 585 |
'billing_state' => 'State / County', |
| 586 |
), |
| 587 |
'default' => array( |
| 588 |
'billing_first_name', 'billing_last_name', |
| 589 |
'billing_email', 'billing_phone', 'billing_address_1', |
| 590 |
), |
| 591 |
), |
| 592 |
array( |
| 593 |
'id' => 'checkout-shipping-fields', |
| 594 |
'type' => 'select', |
| 595 |
'title' => 'Shipping Fields', |
| 596 |
'desc' => 'Select which shipping fields to display on the checkout page. Unselected fields will be hidden.', |
| 597 |
'multiple' => true, |
| 598 |
'placeholder' => 'Select fields to show', |
| 599 |
'dependency' => array( 'booking-type', '==', 'woocommerce' ), |
| 600 |
'options' => array( |
| 601 |
'shipping_first_name' => 'First Name', |
| 602 |
'shipping_last_name' => 'Last Name', |
| 603 |
'shipping_company' => 'Company', |
| 604 |
'shipping_address_1' => 'Address Line 1', |
| 605 |
'shipping_address_2' => 'Address Line 2', |
| 606 |
'shipping_city' => 'City', |
| 607 |
'shipping_postcode' => 'Postcode / ZIP', |
| 608 |
'shipping_country' => 'Country', |
| 609 |
'shipping_state' => 'State / County', |
| 610 |
), |
| 611 |
'default' => array( |
| 612 |
'shipping_first_name', 'shipping_last_name', 'shipping_address_1', |
| 613 |
), |
| 614 |
), |
| 615 |
array( |
| 616 |
'id' => 'checkout-additional-fields', |
| 617 |
'type' => 'switcher', |
| 618 |
'title' => 'Additional Information', |
| 619 |
'desc' => 'Enable or disable the entire Additional Information section on the checkout page.', |
| 620 |
'default' => false, |
| 621 |
'dependency' => array( 'booking-type', '==', 'woocommerce' ), |
| 622 |
), |
| 623 |
array( |
| 624 |
'id' => 'recipent_email', |
| 625 |
'type' => 'text', |
| 626 |
'title' => 'Recipent Email Address', |
| 627 |
'desc' => 'Add recipent email address for getting Booking Request.', |
| 628 |
'default' => $admin_email, |
| 629 |
'dependency' => array( ['booking-type', '==', 'booking_request'], ['booking-form-type', '==', 'default'] ) |
| 630 |
), |
| 631 |
|
| 632 |
// Payment Gateways |
| 633 |
array( |
| 634 |
'id' => 'payment-gateways', |
| 635 |
'type' => 'tabbed', |
| 636 |
'title' => 'Payment Gateways', |
| 637 |
'dependency' => array( 'booking-type', '==', 'native_checkout' ), |
| 638 |
'tabs' => array( |
| 639 |
// --- Cash on Delivery ------------------------------------- |
| 640 |
array( |
| 641 |
'title' => 'Cash on Delivery', |
| 642 |
'icon' => 'fas fa-hand-holding-usd', |
| 643 |
'fields' => array( |
| 644 |
array( |
| 645 |
'id' => 'gateway-cod-enable', |
| 646 |
'type' => 'switcher', |
| 647 |
'title' => 'Enable Cash on Delivery', |
| 648 |
'desc' => 'Let customers reserve now and pay with cash on arrival / at the property.', |
| 649 |
'default' => true, |
| 650 |
), |
| 651 |
array( |
| 652 |
'id' => 'cod-title', |
| 653 |
'type' => 'text', |
| 654 |
'title' => 'Cash on Delivery', |
| 655 |
'desc' => 'The label shown to customers on the checkout page.', |
| 656 |
'default' => 'Cash on Delivery', |
| 657 |
'dependency' => array( 'gateway-cod-enable', '==', true ), |
| 658 |
), |
| 659 |
array( |
| 660 |
'id' => 'cod-description', |
| 661 |
'type' => 'textarea', |
| 662 |
'title' => 'Cash on Delivery Description', |
| 663 |
'desc' => 'Short instructions shown under the title at checkout.', |
| 664 |
'default' => 'Pay with cash upon arrival / at the property.', |
| 665 |
'dependency' => array( 'gateway-cod-enable', '==', true ), |
| 666 |
), |
| 667 |
) |
| 668 |
), |
| 669 |
array( |
| 670 |
'title' => 'PayPal', |
| 671 |
'icon' => 'fab fa-paypal', |
| 672 |
'fields' => array( |
| 673 |
// --- PayPal ---------------------------------------------- |
| 674 |
array( |
| 675 |
'id' => 'gateway-paypal-enable', |
| 676 |
'type' => 'switcher', |
| 677 |
'title' => 'Enable PayPal', |
| 678 |
'desc' => 'Requires a valid Client ID & Secret below.', |
| 679 |
'default' => true, |
| 680 |
), |
| 681 |
array( |
| 682 |
'id' => 'paypal-mode', |
| 683 |
'type' => 'select', |
| 684 |
'title' => 'PayPal Mode', |
| 685 |
'desc' => 'Use "Sandbox" while testing and "Live" for real payments.', |
| 686 |
'options' => array( |
| 687 |
'sandbox' => 'Sandbox', |
| 688 |
'live' => 'Live', |
| 689 |
), |
| 690 |
'default' => 'sandbox', |
| 691 |
'dependency' => array( 'gateway-paypal-enable', '==', true ), |
| 692 |
), |
| 693 |
array( |
| 694 |
'id' => 'paypal-client-id', |
| 695 |
'type' => 'text', |
| 696 |
'title' => 'PayPal Client ID', |
| 697 |
'desc' => 'PayPal REST API client ID. Required for the PayPal gateway.', |
| 698 |
'dependency' => array( 'gateway-paypal-enable', '==', true ), |
| 699 |
), |
| 700 |
array( |
| 701 |
'id' => 'paypal-client-secret', |
| 702 |
'type' => 'text', |
| 703 |
'title' => 'PayPal Client Secret', |
| 704 |
'desc' => 'PayPal REST API client secret. Required for the PayPal gateway.', |
| 705 |
'dependency' => array( 'gateway-paypal-enable', '==', true ), |
| 706 |
), |
| 707 |
) |
| 708 |
), |
| 709 |
array( |
| 710 |
'title' => 'Tax', |
| 711 |
'icon' => 'fas fa-percentage', |
| 712 |
'fields' => array( |
| 713 |
// --- General --------------------------------------------- |
| 714 |
array( |
| 715 |
'id' => 'native-checkout-tax-rate', |
| 716 |
'type' => 'number', |
| 717 |
'title' => 'Native Checkout Tax Rate (%)', |
| 718 |
'desc' => 'Optional tax percentage applied on the native checkout total.', |
| 719 |
'default' => 0, |
| 720 |
), |
| 721 |
) |
| 722 |
) |
| 723 |
) |
| 724 |
), |
| 725 |
|
| 726 |
) |
| 727 |
) |
| 728 |
); |
| 729 |
|
| 730 |
ESHB::createSection( $prefix, array( |
| 731 |
'title' => 'Design', |
| 732 |
'fields' => array( |
| 733 |
array( |
| 734 |
'id' => 'booking-form-style', |
| 735 |
'type' => 'select', |
| 736 |
'title' => 'Booking Form Style', |
| 737 |
|
| 738 |
'options' => array( |
| 739 |
'default' => 'Default', |
| 740 |
'style-one' => 'Style One', |
| 741 |
'style-two' => 'Style Two' |
| 742 |
), |
| 743 |
'default' => 'style-two' |
| 744 |
), |
| 745 |
array( |
| 746 |
'id' => 'calendar-colors', |
| 747 |
'type' => 'color_group', |
| 748 |
'title' => 'Calendar Colors', |
| 749 |
'output_mode' => 'background-color', |
| 750 |
'options' => array( |
| 751 |
'booked-bg-color' => 'Booked Background', |
| 752 |
'booked-color' => 'Booked Color', |
| 753 |
'active-bg-color' => 'Active Background', |
| 754 |
'active-color' => 'Active Color', |
| 755 |
'inrange-bg-color' => 'Inrange Background', |
| 756 |
'inrange-color' => 'Inrange Color', |
| 757 |
'reserved-bg-color' => 'Reserved Background', |
| 758 |
'reserved-color' => 'Reserved Color', |
| 759 |
) |
| 760 |
), |
| 761 |
array( |
| 762 |
'id' => 'theme-colors', |
| 763 |
'type' => 'color_group', |
| 764 |
'title' => 'Theme Colors', |
| 765 |
'output_mode' => 'background-color', |
| 766 |
'options' => array( |
| 767 |
'primary-color' => 'Primary Color', |
| 768 |
'secondary-color' => 'Secondary Color', |
| 769 |
'territory-color' => 'Territory Color', |
| 770 |
'success-color' => 'Success Color', |
| 771 |
'danger-color' => 'Danger Color', |
| 772 |
'dark-color' => 'Dark Color', |
| 773 |
'text-color' => 'Text Color', |
| 774 |
'white-color' => 'White Color', |
| 775 |
'border-color' => 'Border Color', |
| 776 |
), |
| 777 |
'default' => array( |
| 778 |
'primary-color' => '#ab8965', |
| 779 |
'secondary-color' => '#fff5ed', |
| 780 |
'territory-color' => '#70533a', |
| 781 |
'success-color' => '#1ec734', |
| 782 |
'danger-color' => '#e41749', |
| 783 |
'dark-color' => '#181818', |
| 784 |
'text-color' => '#212529', |
| 785 |
'white-color' => '#ffffff', |
| 786 |
'border-color' => '#ab8965', |
| 787 |
) |
| 788 |
), |
| 789 |
array( |
| 790 |
'id' => 'page-spacing', |
| 791 |
'type' => 'spacing', |
| 792 |
'title' => 'Page Spacing', |
| 793 |
'left' => false, |
| 794 |
'right' => false, |
| 795 |
'units' => array( 'px' ), |
| 796 |
'output_mode' => 'padding', // or margin, relative |
| 797 |
), |
| 798 |
array( |
| 799 |
'id' => 'page-container-size', |
| 800 |
'type' => 'dimensions', |
| 801 |
'title' => 'Page Container Size', |
| 802 |
'units' => array( 'px' ), |
| 803 |
'height' => false, |
| 804 |
'output_mode' => 'width', // or margin, relative |
| 805 |
), |
| 806 |
|
| 807 |
) |
| 808 |
) |
| 809 |
); |
| 810 |
|
| 811 |
// Create a section |
| 812 |
ESHB::createSection( $prefix, array( |
| 813 |
'title' => 'Usage', |
| 814 |
'fields' => array( |
| 815 |
array( |
| 816 |
'type' => 'callback', |
| 817 |
'function' => 'eshb_easy_hotel_usage_callback', |
| 818 |
), |
| 819 |
) |
| 820 |
) |
| 821 |
); |
| 822 |
|
| 823 |
|
| 824 |
|
| 825 |
ESHB::createSection( $prefix, array( |
| 826 |
'title' => 'Translation', |
| 827 |
'fields' => array( |
| 828 |
array( |
| 829 |
'type' => 'subheading', |
| 830 |
'content' => 'Booking & Search Form Translation', |
| 831 |
), |
| 832 |
array( |
| 833 |
'id' => 'string_reserve', |
| 834 |
'type' => 'text', |
| 835 |
'title' => 'Reserve', |
| 836 |
//'desc' => 'Add URL if you select External Booking' |
| 837 |
'default' => 'Reserve' |
| 838 |
), |
| 839 |
array( |
| 840 |
'id' => 'string_check_availability', |
| 841 |
'type' => 'text', |
| 842 |
'title' => 'Check Availability', |
| 843 |
//'desc' => 'Add URL if you select External Booking' |
| 844 |
'default' => 'Check Availability' |
| 845 |
), |
| 846 |
array( |
| 847 |
'id' => 'string_from', |
| 848 |
'type' => 'text', |
| 849 |
'title' => 'From', |
| 850 |
//'desc' => 'Add URL if you select External Booking' |
| 851 |
'default' => 'From' |
| 852 |
), |
| 853 |
array( |
| 854 |
'id' => 'view_details', |
| 855 |
'type' => 'text', |
| 856 |
'title' => 'View Details', |
| 857 |
//'desc' => 'Add URL if you select External Booking' |
| 858 |
), |
| 859 |
array( |
| 860 |
'id' => 'string_night', |
| 861 |
'type' => 'text', |
| 862 |
'title' => 'Night', |
| 863 |
//'desc' => 'Add URL if you select External Booking' |
| 864 |
'default' => 'night' |
| 865 |
), |
| 866 |
array( |
| 867 |
'id' => 'string_hour', |
| 868 |
'type' => 'text', |
| 869 |
'title' => 'Hour', |
| 870 |
//'desc' => 'Add URL if you select External Booking' |
| 871 |
'default' => 'hour' |
| 872 |
), |
| 873 |
array( |
| 874 |
'id' => 'string_check_in', |
| 875 |
'type' => 'text', |
| 876 |
'title' => 'Check In', |
| 877 |
//'desc' => 'Add URL if you select External Booking' |
| 878 |
'default' => 'Check In' |
| 879 |
), |
| 880 |
array( |
| 881 |
'id' => 'string_check_out', |
| 882 |
'type' => 'text', |
| 883 |
'title' => 'Check Out', |
| 884 |
//'desc' => 'Add URL if you select External Booking' |
| 885 |
'default' => 'Check Out' |
| 886 |
), |
| 887 |
array( |
| 888 |
'id' => 'string_guest', |
| 889 |
'type' => 'text', |
| 890 |
'title' => 'Guest', |
| 891 |
//'desc' => 'Add URL if you select External Booking' |
| 892 |
'default' => 'Guest' |
| 893 |
), |
| 894 |
array( |
| 895 |
'id' => 'string_adult', |
| 896 |
'type' => 'text', |
| 897 |
'title' => 'Adult', |
| 898 |
//'desc' => 'Add URL if you select External Booking' |
| 899 |
'default' => 'Adult' |
| 900 |
), |
| 901 |
array( |
| 902 |
'id' => 'string_children', |
| 903 |
'type' => 'text', |
| 904 |
'title' => 'Children', |
| 905 |
//'desc' => 'Add URL if you select External Booking' |
| 906 |
'default' => 'Children' |
| 907 |
), |
| 908 |
array( |
| 909 |
'id' => 'string_room', |
| 910 |
'type' => 'text', |
| 911 |
'title' => 'Room', |
| 912 |
//'desc' => 'Add URL if you select External Booking' |
| 913 |
'default' => 'Room' |
| 914 |
), |
| 915 |
array( |
| 916 |
'id' => 'string_rooms', |
| 917 |
'type' => 'text', |
| 918 |
'title' => 'Rooms', |
| 919 |
//'desc' => 'Add URL if you select External Booking' |
| 920 |
'default' => 'Rooms' |
| 921 |
), |
| 922 |
array( |
| 923 |
'id' => 'available_rooms', |
| 924 |
'type' => 'text', |
| 925 |
'title' => 'Available Rooms', |
| 926 |
//'desc' => 'Add URL if you select External Booking' |
| 927 |
'default' => 'Available Rooms:' |
| 928 |
), |
| 929 |
array( |
| 930 |
'id' => 'string_extra_bed', |
| 931 |
'type' => 'text', |
| 932 |
'title' => 'Extra Bed', |
| 933 |
//'desc' => 'Add URL if you select External Booking' |
| 934 |
'default' => 'Extra Bed' |
| 935 |
), |
| 936 |
array( |
| 937 |
'id' => 'string_extra_services', |
| 938 |
'type' => 'text', |
| 939 |
'title' => 'Extra Services', |
| 940 |
//'desc' => 'Add URL if you select External Booking' |
| 941 |
'default' => 'Extra Services' |
| 942 |
), |
| 943 |
array( |
| 944 |
'id' => 'string_total_cost', |
| 945 |
'type' => 'text', |
| 946 |
'title' => 'Total Cost', |
| 947 |
//'desc' => 'Add URL if you select External Booking' |
| 948 |
'default' => 'Total Cost' |
| 949 |
), |
| 950 |
array( |
| 951 |
'id' => 'string_disocunted_price', |
| 952 |
'type' => 'text', |
| 953 |
'title' => 'Discounted Price', |
| 954 |
//'desc' => 'Add URL if you select External Booking' |
| 955 |
'default' => 'Discounted Price' |
| 956 |
), |
| 957 |
array( |
| 958 |
'id' => 'string_book_your_stay', |
| 959 |
'type' => 'text', |
| 960 |
'title' => 'Book Your Stay', |
| 961 |
//'desc' => 'Add URL if you select External Booking' |
| 962 |
'default' => 'Book Your Stay' |
| 963 |
), |
| 964 |
array( |
| 965 |
'id' => 'string_book_now', |
| 966 |
'type' => 'text', |
| 967 |
'title' => 'Book Now', |
| 968 |
//'desc' => 'Add URL if you select External Booking' |
| 969 |
'default' => 'Book Now' |
| 970 |
), |
| 971 |
array( |
| 972 |
'id' => 'string_booking_success_msg', |
| 973 |
'type' => 'text', |
| 974 |
'title' => 'Booking Success Message', |
| 975 |
//'desc' => 'Add URL if you select External Booking' |
| 976 |
'default' => 'Reservation Successfully added to your cart.' |
| 977 |
), |
| 978 |
array( |
| 979 |
'id' => 'string_booking_failed_msg', |
| 980 |
'type' => 'text', |
| 981 |
'title' => 'Booking Failed Message', |
| 982 |
//'desc' => 'Add URL if you select External Booking' |
| 983 |
'default' => 'Ops! This Reservation has been failed.' |
| 984 |
), |
| 985 |
array( |
| 986 |
'id' => 'string_booking_request_success_msg', |
| 987 |
'type' => 'text', |
| 988 |
'title' => 'Booking Request Success Message', |
| 989 |
//'desc' => 'Add URL if you select External Booking' |
| 990 |
'default' => 'Booking request has been sent successfully.' |
| 991 |
), |
| 992 |
array( |
| 993 |
'id' => 'string_booking_request_failed_msg', |
| 994 |
'type' => 'text', |
| 995 |
'title' => 'Booking Request Failed Message', |
| 996 |
//'desc' => 'Add URL if you select External Booking' |
| 997 |
'default' => 'Ops! Booking request can\'t be sent.' |
| 998 |
), |
| 999 |
array( |
| 1000 |
'id' => 'string_availability_calendar', |
| 1001 |
'type' => 'text', |
| 1002 |
'title' => 'Availability Calendar', |
| 1003 |
//'desc' => 'Add URL if you select External Booking' |
| 1004 |
'default' => 'Availability Calendar', |
| 1005 |
), |
| 1006 |
array( |
| 1007 |
'id' => 'string_apply', |
| 1008 |
'type' => 'text', |
| 1009 |
'title' => 'Apply', |
| 1010 |
//'desc' => 'Add URL if you select External Booking' |
| 1011 |
), |
| 1012 |
array( |
| 1013 |
'id' => 'string_cancel', |
| 1014 |
'type' => 'text', |
| 1015 |
'title' => 'Cancel', |
| 1016 |
//'desc' => 'Add URL if you select External Booking' |
| 1017 |
), |
| 1018 |
|
| 1019 |
array( |
| 1020 |
'id' => 'string_related_sub_title', |
| 1021 |
'type' => 'text', |
| 1022 |
'title' => 'Related Sub Title Change Here', |
| 1023 |
//'desc' => 'Related Sub Title Change Here' |
| 1024 |
), |
| 1025 |
|
| 1026 |
array( |
| 1027 |
'id' => 'string_related__title', |
| 1028 |
'type' => 'text', |
| 1029 |
'title' => 'Related Title Change Here', |
| 1030 |
//'desc' => 'Related Title Change Here' |
| 1031 |
), |
| 1032 |
array( |
| 1033 |
'id' => 'string_pay_later_due', |
| 1034 |
'type' => 'text', |
| 1035 |
'title' => 'Pay Later (Due)', |
| 1036 |
//'desc' => 'Add URL if you select External Booking' |
| 1037 |
'default' => 'Pay Later (Due)', |
| 1038 |
), |
| 1039 |
array( |
| 1040 |
'id' => 'string_pay_now', |
| 1041 |
'type' => 'text', |
| 1042 |
'title' => 'Pay Now', |
| 1043 |
//'desc' => 'Add URL if you select External Booking' |
| 1044 |
'default' => 'Pay Now', |
| 1045 |
), |
| 1046 |
array( |
| 1047 |
'id' => 'string_deposit_amount', |
| 1048 |
'type' => 'text', |
| 1049 |
'title' => 'Deposit Amount', |
| 1050 |
//'desc' => 'Add URL if you select External Booking' |
| 1051 |
'default' => 'Deposit Amount', |
| 1052 |
), |
| 1053 |
array( |
| 1054 |
'id' => 'string_pay_deposit', |
| 1055 |
'type' => 'text', |
| 1056 |
'title' => 'Pay Deposit', |
| 1057 |
//'desc' => 'Add URL if you select External Booking' |
| 1058 |
'default' => 'Pay Deposit', |
| 1059 |
), |
| 1060 |
array( |
| 1061 |
'id' => 'string_pay_full_amount', |
| 1062 |
'type' => 'text', |
| 1063 |
'title' => 'Pay Full Amount', |
| 1064 |
//'desc' => 'Add URL if you select External Booking' |
| 1065 |
'default' => 'Pay Full Amount', |
| 1066 |
), |
| 1067 |
array( |
| 1068 |
'id' => 'string_please_wait', |
| 1069 |
'type' => 'text', |
| 1070 |
'title' => 'Please Wait', |
| 1071 |
//'desc' => 'Add URL if you select External Booking' |
| 1072 |
'default' => 'Please Wait', |
| 1073 |
), |
| 1074 |
) |
| 1075 |
) |
| 1076 |
); |
| 1077 |
|
| 1078 |
|
| 1079 |
// Create a section |
| 1080 |
ESHB::createSection( $prefix, array( |
| 1081 |
'title' => 'Help & Support', |
| 1082 |
'fields' => array( |
| 1083 |
array( |
| 1084 |
'type' => 'callback', |
| 1085 |
'function' => 'eshb_easy_hotel_help_support_callback', |
| 1086 |
), |
| 1087 |
) |
| 1088 |
) |
| 1089 |
); |
| 1090 |
|
| 1091 |
|
| 1092 |
|
| 1093 |
|
| 1094 |
} |
| 1095 |
function eshb_easy_hotel_usage_callback() { |
| 1096 |
?> |
| 1097 |
|
| 1098 |
<div class="eshb_easy_hotel_usage_callback"> |
| 1099 |
<h3> <?php echo esc_html__('Shortcode:', 'easy-hotel')?></h3> |
| 1100 |
<div> |
| 1101 |
<p><strong>Archive Grid: </strong><?php echo esc_html__('[eshb_accomodation_grid]', 'easy-hotel')?></p> |
| 1102 |
<p><strong>Search Form: </strong><?php echo esc_html__('[eshb_search_form]', 'easy-hotel')?></p> |
| 1103 |
<p><strong>Booking Form For Room Details Page: </strong><?php echo esc_html__('[eshb_booking_form]', 'easy-hotel')?></p> |
| 1104 |
<p><strong>Booking Form For Global: </strong><?php echo esc_html__('[eshb_booking_form accomodation_id="123"]', 'easy-hotel')?></p> |
| 1105 |
<p><strong>Availability Calendar For Room Details Page: </strong><?php echo esc_html__('[eshb_availability_calendar]', 'easy-hotel')?></p> |
| 1106 |
<p><strong>Availability Calendar For Global: </strong><?php echo esc_html__('[eshb_availability_calendar accomodation_id="123"]', 'easy-hotel')?></p> |
| 1107 |
<p><strong>Related Accomodations: </strong><?php echo esc_html__('[eshb_related_accomodations]', 'easy-hotel')?> <?php echo esc_html__('(only allowed for room details page)', 'easy-hotel')?></p> |
| 1108 |
<p><strong>Day Wise Pricing Table For Room Details Page: </strong><?php echo esc_html__('[eshb_daywise_pricing_table]', 'easy-hotel')?></p> |
| 1109 |
<p><strong>Day Wise Pricing Table For Global: </strong><?php echo esc_html__('[eshb_daywise_pricing_table accomodation_id="123"]', 'easy-hotel')?></p> |
| 1110 |
<p><strong>Check In/Out Times: </strong><?php echo esc_html__('[eshb_check_in_out_times]', 'easy-hotel')?> <?php echo esc_html__('(only allowed for room details page)', 'easy-hotel')?></p> |
| 1111 |
<p><strong>Reviews: </strong><?php echo esc_html__('[eshb_average_rarings]', 'easy-hotel')?> <?php echo esc_html__('(only allowed for room details page)', 'easy-hotel')?></p> |
| 1112 |
</div> |
| 1113 |
</div> |
| 1114 |
|
| 1115 |
<p> |
| 1116 |
<?php echo esc_html__('Easy Hotel', 'easy-hotel')?> |
| 1117 |
<a href="<?php echo esc_url('https://documentation.themewant.com/easy-hotel-booking/')?>" target="_blank"><?php echo esc_html__('documentation ', 'easy-hotel')?></a><?php echo esc_html__('to learn more in details.', 'easy-hotel')?> |
| 1118 |
</p> |
| 1119 |
|
| 1120 |
<?php |
| 1121 |
|
| 1122 |
} |
| 1123 |
|
| 1124 |
function eshb_easy_hotel_help_support_callback() { |
| 1125 |
?> |
| 1126 |
|
| 1127 |
<div class="eshb_easy_hotel_help_support_callback"> |
| 1128 |
<div class="eshb-help-support"> |
| 1129 |
|
| 1130 |
<h2><?php echo esc_html__( 'Welcome to Easy Hotel Booking – Help & Support', 'easy-hotel' )?></h2> |
| 1131 |
<p><?php echo esc_html__('Thank you for using', 'easy-hotel')?> <strong><?php echo esc_html__('Easy Hotel Booking', 'easy-hotel') ?></strong>. <?php echo esc_html__('If you need assistance or want to learn how to get the most from the plugin, please explore the resources below:', 'easy-hotel')?></p> |
| 1132 |
|
| 1133 |
<div class="help-col-container"> |
| 1134 |
<div class="help-col"> |
| 1135 |
<h3><span class="eshb-dashicon-bg docs"><span class="dashicons dashicons-book-alt"></span></span><?php echo esc_html__('Documentation', 'easy-hotel')?></h3> |
| 1136 |
<p> |
| 1137 |
<?php echo esc_html__('Find step-by-step guides and configuration help in our documentation:', 'easy-hotel')?><br> |
| 1138 |
<a class="btn-docs" href="<?php echo esc_url('https://documentation.themewant.com/easy-hotel-booking/')?>" target="_blank" rel="noopener"><?php echo esc_html__('Easy Hotel Booking Documentation', 'easy-hotel')?></a> |
| 1139 |
</p> |
| 1140 |
</div> |
| 1141 |
<div class="help-col"> |
| 1142 |
<h3><span class="eshb-dashicon-bg support"><span class="dashicons dashicons-sos"></span></span><?php echo esc_html__('Get Support', 'easy-hotel')?></h3> |
| 1143 |
<p><?php echo esc_html__('If you have questions or face any issues, please reach out to us:', 'easy-hotel')?></p> |
| 1144 |
<ul> |
| 1145 |
<li><a class="btn-support" href="<?php echo esc_url('https://themewant.com/support/')?>" target="_blank" rel="noopener"><?php echo esc_html__('Submit a Support Ticket', 'easy-hotel')?></a></li> |
| 1146 |
|
| 1147 |
</ul> |
| 1148 |
</div> |
| 1149 |
<div class="help-col"> |
| 1150 |
<h3><span class="eshb-dashicon-bg community"><span class="dashicons dashicons-groups"></span></span><?php echo esc_html__('Community', 'easy-hotel')?></h3> |
| 1151 |
<p><?php echo esc_html__('Share feedback, ask questions, or get help from other Easy Hotel Booking users. 👉 Connect with our group and get an extra 20% discount!', 'easy-hotel') ?></p> |
| 1152 |
<a class="btn-community" href="<?php echo esc_url('https://www.facebook.com/groups/easyhotelbookingcommunity')?>" target="_blank" rel="noopener"><?php echo esc_html__('Join Our Community', 'easy-hotel')?></a> |
| 1153 |
</div> |
| 1154 |
<div class="help-col"> |
| 1155 |
<h3><span class="eshb-dashicon-bg follow"><span class="dashicons dashicons-share"></span></span><?php echo esc_html__('Follow Us', 'easy-hotel')?></h3> |
| 1156 |
<p><?php echo esc_html__('Stay updated and connect with us on social media:', 'easy-hotel')?></p> |
| 1157 |
<p class="eshb-social-icons" style="font-size: 24px;"> |
| 1158 |
<a href="<?php echo esc_url('https://www.facebook.com/themewant') ?>" target="_blank" rel="noopener"> |
| 1159 |
<i class="fab fa-facebook"></i> |
| 1160 |
</a> |
| 1161 |
<a href="<?php echo esc_url('https://www.youtube.com/watch?v=m5wq7NE2rzw&list=PL-hcevD9GINf8Ae3I6UddfU1TJfRZzst4') ?>" target="_blank" rel="noopener"> |
| 1162 |
<i class="fab fa-youtube"></i> |
| 1163 |
</a> |
| 1164 |
<a href="<?php echo esc_url('https://www.linkedin.com/company/themewant/') ?>" target="_blank" rel="noopener"> |
| 1165 |
<i class="fab fa-linkedin"></i> |
| 1166 |
</a> |
| 1167 |
</p> |
| 1168 |
</div> |
| 1169 |
</div> |
| 1170 |
<div class="help-col-video"> |
| 1171 |
<h3><span class="eshb-dashicon-bg video"><span class="dashicons dashicons-format-video"></span></span><?php echo esc_html__('Video Tutorials', 'easy-hotel')?></h3> |
| 1172 |
<p><?php echo esc_html__('Watch video guides on how to set up and customize Easy Hotel Booking:', 'easy-hotel')?></p> |
| 1173 |
<div class="eshb-youtube-playlist"> |
| 1174 |
<div class="eshb-video-player"> |
| 1175 |
<iframe id="eshb-playlist-player" src="https://www.youtube.com/embed/videoseries?si=r_rVc9IYXTzIkDbG&list=PL-hcevD9GINf8Ae3I6UddfU1TJfRZzst4" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe> |
| 1176 |
</div> |
| 1177 |
<div class="eshb-playlist-sidebar"> |
| 1178 |
<h3><?php echo esc_html__('Playlist', 'easy-hotel') ?></h3> |
| 1179 |
<div style="display: flex; flex-direction: column; gap: 10px;"> |
| 1180 |
<button class="eshb-playlist-item" type="button" onclick="loadEshbTutotialVideo('NUb_lGXbhyU')"> |
| 1181 |
<img src="<?php echo esc_url( ESHB_PL_URL.'admin/assets/img/thumbnails/yt/intro.jpg' ) ?>" alt="Video 1 Thumbnail" style="width: 100%; display: block;"> |
| 1182 |
<strong><?php echo esc_html__('Intro Video', 'easy-hotel') ?></strong> |
| 1183 |
</button> |
| 1184 |
<button class="eshb-playlist-item" type="button" onclick="loadEshbTutotialVideo('m5wq7NE2rzw')"> |
| 1185 |
<img src="<?php echo esc_url( ESHB_PL_URL.'admin/assets/img/thumbnails/yt/setup-guide.jpg' ) ?>" alt="Video 2 Thumbnail" style="width: 100%; display: block;"> |
| 1186 |
<strong><?php echo esc_html__('Setup Guide', 'easy-hotel') ?></strong> |
| 1187 |
</button> |
| 1188 |
<button class="eshb-playlist-item" type="button" onclick="loadEshbTutotialVideo('HYKkw8SK-7U')"> |
| 1189 |
<img src="<?php echo esc_url( ESHB_PL_URL.'admin/assets/img/thumbnails/yt/seasonal-pricing' ) ?>" alt="Video 3 Thumbnail" style="width: 100%; display: block;"> |
| 1190 |
<strong><?php echo esc_html__('Seasonal Pricing', 'easy-hotel') ?></strong> |
| 1191 |
</button> |
| 1192 |
<button class="eshb-playlist-item" type="button" onclick="loadEshbTutotialVideo('YbUmgyhSGP8')"> |
| 1193 |
<img src="<?php echo esc_url( ESHB_PL_URL.'admin/assets/img/thumbnails/yt/setup-coupon-code.jpg' ) ?>" alt="Video 3 Thumbnail" style="width: 100%; display: block;"> |
| 1194 |
<strong><?php echo esc_html__('Setup Coupon Code', 'easy-hotel') ?></strong> |
| 1195 |
</button> |
| 1196 |
<button class="eshb-playlist-item" type="button" onclick="loadEshbTutotialVideo('Kd72Tekpd8Q')"> |
| 1197 |
<img src="<?php echo esc_url( ESHB_PL_URL.'admin/assets/img/thumbnails/yt/setup-extra-services.jpg' ) ?>" alt="Video 3 Thumbnail" style="width: 100%; display: block;"> |
| 1198 |
<strong><?php echo esc_html__('Setup Extra Services', 'easy-hotel') ?></strong> |
| 1199 |
</button> |
| 1200 |
<button class="eshb-playlist-item" type="button" onclick="loadEshbTutotialVideo('E8_RSyVLbjg')"> |
| 1201 |
<img src="<?php echo esc_url( ESHB_PL_URL.'admin/assets/img/thumbnails/yt/setup-ical.jpg' ) ?>" alt="Video 3 Thumbnail" style="width: 100%; display: block;"> |
| 1202 |
<strong><?php echo esc_html__('Setup iCal', 'easy-hotel') ?></strong> |
| 1203 |
</button> |
| 1204 |
<button class="eshb-playlist-item" type="button" onclick="loadEshbTutotialVideo('rowRYH4Y5lk')"> |
| 1205 |
<img src="<?php echo esc_url( ESHB_PL_URL.'admin/assets/img/thumbnails/yt/setup-min-max.jpg' ) ?>" alt="Video 3 Thumbnail" style="width: 100%; display: block;"> |
| 1206 |
<strong><?php echo esc_html__('Setup Max/Min Night', 'easy-hotel') ?></strong> |
| 1207 |
</button> |
| 1208 |
</div> |
| 1209 |
</div> |
| 1210 |
</div> |
| 1211 |
<script> |
| 1212 |
function loadEshbTutotialVideo(videoId) { |
| 1213 |
document.querySelector('iframe').src = `https://www.youtube.com/embed/${videoId}?rel=0`; |
| 1214 |
} |
| 1215 |
</script> |
| 1216 |
</div> |
| 1217 |
</div> |
| 1218 |
</div> |
| 1219 |
<?php |
| 1220 |
|
| 1221 |
} |
| 1222 |
|
| 1223 |
function eshb_pro_addons_themes_callback(){ |
| 1224 |
$pro_addons = new ESHB_PRO_ADDONS(); |
| 1225 |
?> |
| 1226 |
<h1><?php echo esc_html__( 'Get Addons & Themes', 'easy-hotel' ); ?></h1> |
| 1227 |
<div class="eshb-themes-addons-row"> |
| 1228 |
<div class="eshb-themes-addons-col"> |
| 1229 |
<h2><?php echo esc_html__( 'Addons', 'easy-hotel' ); ?></h2> |
| 1230 |
<?php $pro_addons->eshb_get_addons_html(); ?> |
| 1231 |
</div> |
| 1232 |
<div class="eshb-themes-addons-col"> |
| 1233 |
<h2><?php echo esc_html__( 'Themes', 'easy-hotel' ); ?></h2> |
| 1234 |
<?php $pro_addons->eshb_get_themes_html(); ?> |
| 1235 |
</div> |
| 1236 |
</div> |
| 1237 |
<?php |
| 1238 |
} |
| 1239 |
|
| 1240 |
// Add custom field (nonce) to taxonomy edit page |
| 1241 |
function eshb_add_custom_nonce_field() { |
| 1242 |
// Add nonce field |
| 1243 |
wp_nonce_field('eshb_save_meta_box_nonce', 'eshb_save_meta'); |
| 1244 |
} |
| 1245 |
|
| 1246 |
add_action('category_edit_form_fields', 'eshb_add_custom_nonce_field', 10, 2); |
| 1247 |
add_action('category_add_form_fields', 'eshb_add_custom_nonce_field', 10, 2); |
| 1248 |
|
| 1249 |
// resposition admin menus |
| 1250 |
function eshb_reposition_admin_submenus() { |
| 1251 |
global $submenu; |
| 1252 |
|
| 1253 |
$parent_slug = 'edit.php?post_type=eshb_accomodation'; // Example: 'edit.php' for Posts menu |
| 1254 |
$submenu_items = $submenu[$parent_slug] ?? []; |
| 1255 |
|
| 1256 |
if (!empty($submenu_items)) { |
| 1257 |
|
| 1258 |
// Remove existing submenus |
| 1259 |
remove_submenu_page($parent_slug, 'easy-hotel-settings'); |
| 1260 |
|
| 1261 |
// Re-add submenus in the desired order |
| 1262 |
add_submenu_page($parent_slug, 'Settings', 'Settings', 'manage_options', 'easy-hotel-settings'); |
| 1263 |
add_submenu_page($parent_slug, 'Themes & Addons', 'Themes & Addons', 'manage_options', 'edit.php?post_type=eshb_addons', 'eshb_pro_addons_themes_callback'); |
| 1264 |
|
| 1265 |
} |
| 1266 |
} |
| 1267 |
|
| 1268 |
add_action('admin_menu', 'eshb_reposition_admin_submenus', 999); // Priority 999 ensures it runs after all menus are added |
| 1269 |
|
| 1270 |
|
| 1271 |
|
| 1272 |
// Register the string for translation |
| 1273 |
/** |
| 1274 |
* Resolve a settings string, run it through the active translation plugin |
| 1275 |
* and expose the result to filters. |
| 1276 |
* |
| 1277 |
* The optional $context tells a filter *which* label this is and where it is |
| 1278 |
* being rendered, so a child theme can retarget a single label — on a single |
| 1279 |
* accommodation if it wants — without having to match on the printed text. |
| 1280 |
* Matching on text is unreliable here: it changes with the active language |
| 1281 |
* under Polylang, and several settings resolve to the same words. Call sites |
| 1282 |
* that pass no context keep working exactly as before. |
| 1283 |
* |
| 1284 |
* @param string $option_key Text the caller already resolved from settings. |
| 1285 |
* @param string $option_name Option the value came from. |
| 1286 |
* @param array|string $context Context array, or just the settings key as a string. |
| 1287 |
* |
| 1288 |
* @return string |
| 1289 |
*/ |
| 1290 |
function eshb_get_translated_string($option_key, $option_name = 'eshb_settings', $context = array()) { |
| 1291 |
if (empty($option_key) || empty($option_name)) { |
| 1292 |
return ''; |
| 1293 |
} |
| 1294 |
|
| 1295 |
// Shorthand: eshb_get_translated_string( $text, 'eshb_settings', 'string_adult' ). |
| 1296 |
if (!is_array($context)) { |
| 1297 |
$context = array('key' => (string) $context); |
| 1298 |
} |
| 1299 |
|
| 1300 |
$context = wp_parse_args($context, array( |
| 1301 |
'key' => '', // settings key, e.g. 'string_adult' |
| 1302 |
'accomodation_id' => 0, // 0 when the string is not tied to one room |
| 1303 |
'form' => '', // 'booking' | 'search' | 'calendar' |
| 1304 |
)); |
| 1305 |
|
| 1306 |
$key = $context['key']; |
| 1307 |
|
| 1308 |
$settings = get_option($option_name); |
| 1309 |
|
| 1310 |
$default_text = isset($settings[$option_key]) && !empty($settings[$option_key]) |
| 1311 |
? $settings[$option_key] |
| 1312 |
: $option_key; |
| 1313 |
|
| 1314 |
/** |
| 1315 |
* Filter the text *before* it reaches Polylang / WPML, so a replacement |
| 1316 |
* supplied here is still translatable on a multilingual site. |
| 1317 |
*/ |
| 1318 |
$default_text = apply_filters('eshb_label_raw', $default_text, $key, $context); |
| 1319 |
|
| 1320 |
// Polylang exists |
| 1321 |
if (function_exists('pll__')) { |
| 1322 |
$output = pll__($default_text); |
| 1323 |
} |
| 1324 |
// WPML exists |
| 1325 |
else if (function_exists('icl_t')) { |
| 1326 |
$output = icl_t('Easy Hotel Booking', $option_key, $default_text); |
| 1327 |
} |
| 1328 |
// No translation plugin |
| 1329 |
else { |
| 1330 |
$output = $default_text; |
| 1331 |
} |
| 1332 |
|
| 1333 |
/** |
| 1334 |
* Catch-all. Fires for every string the plugin and its add-ons translate, |
| 1335 |
* including the call sites that pass no context. |
| 1336 |
*/ |
| 1337 |
$output = apply_filters('eshb_translated_string', $output, $option_key, $option_name, $context); |
| 1338 |
|
| 1339 |
// Key aware hooks, only for call sites that identified the string. |
| 1340 |
if (!empty($key)) { |
| 1341 |
$output = apply_filters('eshb_label', $output, $key, $context); |
| 1342 |
$output = apply_filters("eshb_label_{$key}", $output, $context); |
| 1343 |
} |
| 1344 |
|
| 1345 |
return $output; |
| 1346 |
} |
| 1347 |
|
| 1348 |
/** |
| 1349 |
* Wrapper for the form templates. Keeps the call sites short while still |
| 1350 |
* handing the settings key and the surrounding context to the filters above. |
| 1351 |
* |
| 1352 |
* @param string $text Text already resolved from settings. |
| 1353 |
* @param string $key Settings key, e.g. 'string_adult'. |
| 1354 |
* @param array $context Extra context — 'accomodation_id', 'form'. |
| 1355 |
* |
| 1356 |
* @return string |
| 1357 |
*/ |
| 1358 |
function eshb_get_form_label($text, $key, $context = array()) { |
| 1359 |
$context = is_array($context) ? $context : array(); |
| 1360 |
$context['key'] = $key; |
| 1361 |
|
| 1362 |
return eshb_get_translated_string($text, 'eshb_settings', $context); |
| 1363 |
} |
| 1364 |
|
| 1365 |
|
| 1366 |
/** |
| 1367 |
* Register strings for translation with Polylang or WPML |
| 1368 |
*/ |
| 1369 |
function eshb_register_string_translations($fields = [], $option_name = 'eshb_settings') { |
| 1370 |
if (empty($fields) || !is_array($fields)) { |
| 1371 |
return; |
| 1372 |
} |
| 1373 |
|
| 1374 |
// Get the settings array |
| 1375 |
$settings = get_option($option_name); |
| 1376 |
|
| 1377 |
foreach ($fields as $option_key) { |
| 1378 |
// Get default text |
| 1379 |
$default_text = isset($settings[$option_key]) && !empty($settings[$option_key]) |
| 1380 |
? $settings[$option_key] |
| 1381 |
: str_replace('_', ' ', ucfirst(str_replace('string_', '', $option_key))); |
| 1382 |
|
| 1383 |
// Register with Polylang |
| 1384 |
if (function_exists('pll_register_string')) { |
| 1385 |
pll_register_string($option_key, $default_text, 'Easy Hotel Booking'); |
| 1386 |
} |
| 1387 |
// Register with WPML |
| 1388 |
elseif (function_exists('icl_register_string')) { |
| 1389 |
icl_register_string('Easy Hotel Booking', $option_key, $default_text); |
| 1390 |
} |
| 1391 |
} |
| 1392 |
} |
| 1393 |
}, 11); |
| 1394 |
|
| 1395 |
// Auto hook into init |
| 1396 |
add_action('init', function() { |
| 1397 |
$fields = [ |
| 1398 |
'accomodation_base_name', |
| 1399 |
'string_reserve', |
| 1400 |
'string_check_availability', |
| 1401 |
'string_from', |
| 1402 |
'view_details', |
| 1403 |
'string_night', |
| 1404 |
'string_hour', |
| 1405 |
'string_check_in', |
| 1406 |
'string_check_out', |
| 1407 |
'string_guest', |
| 1408 |
'string_adult', |
| 1409 |
'string_children', |
| 1410 |
'string_room', |
| 1411 |
'string_rooms', |
| 1412 |
'available_rooms', |
| 1413 |
'string_extra_bed', |
| 1414 |
'string_extra_services', |
| 1415 |
'string_total_cost', |
| 1416 |
'string_disocunted_price', |
| 1417 |
'string_book_your_stay', |
| 1418 |
'string_book_now', |
| 1419 |
'string_booking_success_msg', |
| 1420 |
'string_booking_failed_msg', |
| 1421 |
'string_booking_request_success_msg', |
| 1422 |
'string_booking_request_failed_msg', |
| 1423 |
'string_availability_calendar', |
| 1424 |
'string_apply', |
| 1425 |
'string_cancel', |
| 1426 |
'string_related_sub_title', |
| 1427 |
'string_related__title', |
| 1428 |
'string_pay_later_due', |
| 1429 |
'string_deposit_amount', |
| 1430 |
'string_pay_deposit', |
| 1431 |
'string_pay_now', |
| 1432 |
'string_pay_full_amount', |
| 1433 |
]; |
| 1434 |
|
| 1435 |
eshb_register_string_translations($fields, 'eshb_settings'); |
| 1436 |
}); |