PluginProbe
Easy Hotel – Powerful Hotel Booking / 2.0.4
Easy Hotel – Powerful Hotel Booking v2.0.4
2.0.8 2.0.7 2.0.6 2.0.5 2.0.4 2.0.3 2.0.2 2.0.1 2.0.0 1.9.9 1.9.8 1.9.7 1.9.6 1.9.5 1.9.4 1.9.3 1.9.2 1.8.1 1.8.2 1.8.3 1.8.4 1.8.5 1.8.6 1.8.7 1.8.8 All 110 releases
easy-hotel / admin / includes / admin-settings.php

admin-settings.php in Easy Hotel – Powerful Hotel Booking 2.0.4, at admin/includes/admin-settings.php

1,414 lines 60.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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 array(
726 'id' => 'holidays',
727 'type' => 'repeater',
728 'title' => 'Holidays',
729 'fields' => array(
730
731 array(
732 'id' => 'holiday-date',
733 'type' => 'date',
734 'title' => 'Date',
735 'desc' => 'Add holiday by date from here.',
736 'from_to' => true,
737 'settings' => array(
738 'dateFormat' => 'yy-mm-dd',
739 'changeMonth' => true,
740 'changeYear' => true,
741 'showButtonPanel' => true,
742 'weekHeader' => 'Week',
743 'monthNamesShort' => array( 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' ),
744 'dayNamesMin' => array( 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday' ),
745 ),
746 ),
747 array(
748 'id' => 'holiday-title',
749 'type' => 'text',
750 'title' => 'Title',
751 'desc' => 'Add holiday title from here.',
752 ),
753 array(
754 'id' => 'accomodation-ids',
755 'type' => 'select',
756 'title' => 'Accomodations',
757 'placeholder' => 'Select Accomodations',
758 'desc' => 'Select Accomodations for this coupon.',
759 'options' => 'posts',
760 'multiple' => true,
761 'chosen' => false,
762 'query_args' => array(
763 'post_type' => 'eshb_accomodation',
764 'posts_per_page' => -1,
765 ),
766 ),
767
768 ),
769 ),
770
771 )
772 )
773 );
774
775 ESHB::createSection( $prefix, array(
776 'title' => 'Design',
777 'fields' => array(
778 array(
779 'id' => 'booking-form-style',
780 'type' => 'select',
781 'title' => 'Booking Form Style',
782
783 'options' => array(
784 'default' => 'Default',
785 'style-one' => 'Style One',
786 'style-two' => 'Style Two'
787 ),
788 'default' => 'style-two'
789 ),
790 array(
791 'id' => 'calendar-colors',
792 'type' => 'color_group',
793 'title' => 'Calendar Colors',
794 'output_mode' => 'background-color',
795 'options' => array(
796 'booked-bg-color' => 'Booked Background',
797 'booked-color' => 'Booked Color',
798 'active-bg-color' => 'Active Background',
799 'active-color' => 'Active Color',
800 'inrange-bg-color' => 'Inrange Background',
801 'inrange-color' => 'Inrange Color',
802 'reserved-bg-color' => 'Reserved Background',
803 'reserved-color' => 'Reserved Color',
804 )
805 ),
806 array(
807 'id' => 'theme-colors',
808 'type' => 'color_group',
809 'title' => 'Theme Colors',
810 'output_mode' => 'background-color',
811 'options' => array(
812 'primary-color' => 'Primary Color',
813 'secondary-color' => 'Secondary Color',
814 'territory-color' => 'Territory Color',
815 'success-color' => 'Success Color',
816 'danger-color' => 'Danger Color',
817 'dark-color' => 'Dark Color',
818 'text-color' => 'Text Color',
819 'white-color' => 'White Color',
820 'border-color' => 'Border Color',
821 ),
822 'default' => array(
823 'primary-color' => '#ab8965',
824 'secondary-color' => '#fff5ed',
825 'territory-color' => '#70533a',
826 'success-color' => '#1ec734',
827 'danger-color' => '#e41749',
828 'dark-color' => '#181818',
829 'text-color' => '#212529',
830 'white-color' => '#ffffff',
831 'border-color' => '#ab8965',
832 )
833 ),
834 array(
835 'id' => 'page-spacing',
836 'type' => 'spacing',
837 'title' => 'Page Spacing',
838 'left' => false,
839 'right' => false,
840 'units' => array( 'px' ),
841 'output_mode' => 'padding', // or margin, relative
842 ),
843 array(
844 'id' => 'page-container-size',
845 'type' => 'dimensions',
846 'title' => 'Page Container Size',
847 'units' => array( 'px' ),
848 'height' => false,
849 'output_mode' => 'width', // or margin, relative
850 ),
851
852 )
853 )
854 );
855
856 // Create a section
857 ESHB::createSection( $prefix, array(
858 'title' => 'Usage',
859 'fields' => array(
860 array(
861 'type' => 'callback',
862 'function' => 'eshb_easy_hotel_usage_callback',
863 ),
864 )
865 )
866 );
867
868
869
870 ESHB::createSection( $prefix, array(
871 'title' => 'Translation',
872 'fields' => array(
873 array(
874 'type' => 'subheading',
875 'content' => 'Booking & Search Form Translation',
876 ),
877 array(
878 'id' => 'string_reserve',
879 'type' => 'text',
880 'title' => 'Reserve',
881 //'desc' => 'Add URL if you select External Booking'
882 'default' => 'Reserve'
883 ),
884 array(
885 'id' => 'string_check_availability',
886 'type' => 'text',
887 'title' => 'Check Availability',
888 //'desc' => 'Add URL if you select External Booking'
889 'default' => 'Check Availability'
890 ),
891 array(
892 'id' => 'string_from',
893 'type' => 'text',
894 'title' => 'From',
895 //'desc' => 'Add URL if you select External Booking'
896 'default' => 'From'
897 ),
898 array(
899 'id' => 'view_details',
900 'type' => 'text',
901 'title' => 'View Details',
902 //'desc' => 'Add URL if you select External Booking'
903 ),
904 array(
905 'id' => 'string_night',
906 'type' => 'text',
907 'title' => 'Night',
908 //'desc' => 'Add URL if you select External Booking'
909 'default' => 'night'
910 ),
911 array(
912 'id' => 'string_hour',
913 'type' => 'text',
914 'title' => 'Hour',
915 //'desc' => 'Add URL if you select External Booking'
916 'default' => 'hour'
917 ),
918 array(
919 'id' => 'string_check_in',
920 'type' => 'text',
921 'title' => 'Check In',
922 //'desc' => 'Add URL if you select External Booking'
923 'default' => 'Check In'
924 ),
925 array(
926 'id' => 'string_check_out',
927 'type' => 'text',
928 'title' => 'Check Out',
929 //'desc' => 'Add URL if you select External Booking'
930 'default' => 'Check Out'
931 ),
932 array(
933 'id' => 'string_guest',
934 'type' => 'text',
935 'title' => 'Guest',
936 //'desc' => 'Add URL if you select External Booking'
937 'default' => 'Guest'
938 ),
939 array(
940 'id' => 'string_adult',
941 'type' => 'text',
942 'title' => 'Adult',
943 //'desc' => 'Add URL if you select External Booking'
944 'default' => 'Adult'
945 ),
946 array(
947 'id' => 'string_children',
948 'type' => 'text',
949 'title' => 'Children',
950 //'desc' => 'Add URL if you select External Booking'
951 'default' => 'Children'
952 ),
953 array(
954 'id' => 'string_room',
955 'type' => 'text',
956 'title' => 'Room',
957 //'desc' => 'Add URL if you select External Booking'
958 'default' => 'Room'
959 ),
960 array(
961 'id' => 'string_rooms',
962 'type' => 'text',
963 'title' => 'Rooms',
964 //'desc' => 'Add URL if you select External Booking'
965 'default' => 'Rooms'
966 ),
967 array(
968 'id' => 'available_rooms',
969 'type' => 'text',
970 'title' => 'Available Rooms',
971 //'desc' => 'Add URL if you select External Booking'
972 'default' => 'Available Rooms:'
973 ),
974 array(
975 'id' => 'string_extra_bed',
976 'type' => 'text',
977 'title' => 'Extra Bed',
978 //'desc' => 'Add URL if you select External Booking'
979 'default' => 'Extra Bed'
980 ),
981 array(
982 'id' => 'string_extra_services',
983 'type' => 'text',
984 'title' => 'Extra Services',
985 //'desc' => 'Add URL if you select External Booking'
986 'default' => 'Extra Services'
987 ),
988 array(
989 'id' => 'string_total_cost',
990 'type' => 'text',
991 'title' => 'Total Cost',
992 //'desc' => 'Add URL if you select External Booking'
993 'default' => 'Total Cost'
994 ),
995 array(
996 'id' => 'string_disocunted_price',
997 'type' => 'text',
998 'title' => 'Discounted Price',
999 //'desc' => 'Add URL if you select External Booking'
1000 'default' => 'Discounted Price'
1001 ),
1002 array(
1003 'id' => 'string_book_your_stay',
1004 'type' => 'text',
1005 'title' => 'Book Your Stay',
1006 //'desc' => 'Add URL if you select External Booking'
1007 'default' => 'Book Your Stay'
1008 ),
1009 array(
1010 'id' => 'string_book_now',
1011 'type' => 'text',
1012 'title' => 'Book Now',
1013 //'desc' => 'Add URL if you select External Booking'
1014 'default' => 'Book Now'
1015 ),
1016 array(
1017 'id' => 'string_booking_success_msg',
1018 'type' => 'text',
1019 'title' => 'Booking Success Message',
1020 //'desc' => 'Add URL if you select External Booking'
1021 'default' => 'Reservation Successfully added to your cart.'
1022 ),
1023 array(
1024 'id' => 'string_booking_failed_msg',
1025 'type' => 'text',
1026 'title' => 'Booking Failed Message',
1027 //'desc' => 'Add URL if you select External Booking'
1028 'default' => 'Ops! This Reservation has been failed.'
1029 ),
1030 array(
1031 'id' => 'string_booking_request_success_msg',
1032 'type' => 'text',
1033 'title' => 'Booking Request Success Message',
1034 //'desc' => 'Add URL if you select External Booking'
1035 'default' => 'Booking request has been sent successfully.'
1036 ),
1037 array(
1038 'id' => 'string_booking_request_failed_msg',
1039 'type' => 'text',
1040 'title' => 'Booking Request Failed Message',
1041 //'desc' => 'Add URL if you select External Booking'
1042 'default' => 'Ops! Booking request can\'t be sent.'
1043 ),
1044 array(
1045 'id' => 'string_availability_calendar',
1046 'type' => 'text',
1047 'title' => 'Availability Calendar',
1048 //'desc' => 'Add URL if you select External Booking'
1049 'default' => 'Availability Calendar',
1050 ),
1051 array(
1052 'id' => 'string_apply',
1053 'type' => 'text',
1054 'title' => 'Apply',
1055 //'desc' => 'Add URL if you select External Booking'
1056 ),
1057 array(
1058 'id' => 'string_cancel',
1059 'type' => 'text',
1060 'title' => 'Cancel',
1061 //'desc' => 'Add URL if you select External Booking'
1062 ),
1063
1064 array(
1065 'id' => 'string_related_sub_title',
1066 'type' => 'text',
1067 'title' => 'Related Sub Title Change Here',
1068 //'desc' => 'Related Sub Title Change Here'
1069 ),
1070
1071 array(
1072 'id' => 'string_related__title',
1073 'type' => 'text',
1074 'title' => 'Related Title Change Here',
1075 //'desc' => 'Related Title Change Here'
1076 ),
1077 array(
1078 'id' => 'string_pay_later_due',
1079 'type' => 'text',
1080 'title' => 'Pay Later (Due)',
1081 //'desc' => 'Add URL if you select External Booking'
1082 'default' => 'Pay Later (Due)',
1083 ),
1084 array(
1085 'id' => 'string_pay_now',
1086 'type' => 'text',
1087 'title' => 'Pay Now',
1088 //'desc' => 'Add URL if you select External Booking'
1089 'default' => 'Pay Now',
1090 ),
1091 array(
1092 'id' => 'string_deposit_amount',
1093 'type' => 'text',
1094 'title' => 'Deposit Amount',
1095 //'desc' => 'Add URL if you select External Booking'
1096 'default' => 'Deposit Amount',
1097 ),
1098 array(
1099 'id' => 'string_pay_deposit',
1100 'type' => 'text',
1101 'title' => 'Pay Deposit',
1102 //'desc' => 'Add URL if you select External Booking'
1103 'default' => 'Pay Deposit',
1104 ),
1105 array(
1106 'id' => 'string_pay_full_amount',
1107 'type' => 'text',
1108 'title' => 'Pay Full Amount',
1109 //'desc' => 'Add URL if you select External Booking'
1110 'default' => 'Pay Full Amount',
1111 ),
1112 array(
1113 'id' => 'string_please_wait',
1114 'type' => 'text',
1115 'title' => 'Please Wait',
1116 //'desc' => 'Add URL if you select External Booking'
1117 'default' => 'Please Wait',
1118 ),
1119 )
1120 )
1121 );
1122
1123
1124 // Create a section
1125 ESHB::createSection( $prefix, array(
1126 'title' => 'Help & Support',
1127 'fields' => array(
1128 array(
1129 'type' => 'callback',
1130 'function' => 'eshb_easy_hotel_help_support_callback',
1131 ),
1132 )
1133 )
1134 );
1135
1136
1137
1138
1139 }
1140 function eshb_easy_hotel_usage_callback() {
1141 ?>
1142
1143 <div class="eshb_easy_hotel_usage_callback">
1144 <h3> <?php echo esc_html__('Shortcode:', 'easy-hotel')?></h3>
1145 <div>
1146 <p><strong>Archive Grid: </strong><?php echo esc_html__('[eshb_accomodation_grid]', 'easy-hotel')?></p>
1147 <p><strong>Search Form: </strong><?php echo esc_html__('[eshb_search_form]', 'easy-hotel')?></p>
1148 <p><strong>Booking Form For Room Details Page: </strong><?php echo esc_html__('[eshb_booking_form]', 'easy-hotel')?></p>
1149 <p><strong>Booking Form For Global: </strong><?php echo esc_html__('[eshb_booking_form accomodation_id="123"]', 'easy-hotel')?></p>
1150 <p><strong>Availability Calendar For Room Details Page: </strong><?php echo esc_html__('[eshb_availability_calendar]', 'easy-hotel')?></p>
1151 <p><strong>Availability Calendar For Global: </strong><?php echo esc_html__('[eshb_availability_calendar accomodation_id="123"]', 'easy-hotel')?></p>
1152 <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>
1153 <p><strong>Day Wise Pricing Table For Room Details Page: </strong><?php echo esc_html__('[eshb_daywise_pricing_table]', 'easy-hotel')?></p>
1154 <p><strong>Day Wise Pricing Table For Global: </strong><?php echo esc_html__('[eshb_daywise_pricing_table accomodation_id="123"]', 'easy-hotel')?></p>
1155 <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>
1156 <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>
1157 </div>
1158 </div>
1159
1160 <p>
1161 <?php echo esc_html__('Easy Hotel', 'easy-hotel')?>
1162 <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')?>
1163 </p>
1164
1165 <?php
1166
1167 }
1168
1169 function eshb_easy_hotel_help_support_callback() {
1170 ?>
1171
1172 <div class="eshb_easy_hotel_help_support_callback">
1173 <div class="eshb-help-support">
1174
1175 <h2><?php echo esc_html__( 'Welcome to Easy Hotel Booking – Help & Support', 'easy-hotel' )?></h2>
1176 <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>
1177
1178 <div class="help-col-container">
1179 <div class="help-col">
1180 <h3><span class="eshb-dashicon-bg docs"><span class="dashicons dashicons-book-alt"></span></span><?php echo esc_html__('Documentation', 'easy-hotel')?></h3>
1181 <p>
1182 <?php echo esc_html__('Find step-by-step guides and configuration help in our documentation:', 'easy-hotel')?><br>
1183 <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>
1184 </p>
1185 </div>
1186 <div class="help-col">
1187 <h3><span class="eshb-dashicon-bg support"><span class="dashicons dashicons-sos"></span></span><?php echo esc_html__('Get Support', 'easy-hotel')?></h3>
1188 <p><?php echo esc_html__('If you have questions or face any issues, please reach out to us:', 'easy-hotel')?></p>
1189 <ul>
1190 <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>
1191
1192 </ul>
1193 </div>
1194 <div class="help-col">
1195 <h3><span class="eshb-dashicon-bg community"><span class="dashicons dashicons-groups"></span></span><?php echo esc_html__('Community', 'easy-hotel')?></h3>
1196 <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>
1197 <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>
1198 </div>
1199 <div class="help-col">
1200 <h3><span class="eshb-dashicon-bg follow"><span class="dashicons dashicons-share"></span></span><?php echo esc_html__('Follow Us', 'easy-hotel')?></h3>
1201 <p><?php echo esc_html__('Stay updated and connect with us on social media:', 'easy-hotel')?></p>
1202 <p class="eshb-social-icons" style="font-size: 24px;">
1203 <a href="<?php echo esc_url('https://www.facebook.com/themewant') ?>" target="_blank" rel="noopener">
1204 <i class="fab fa-facebook"></i>
1205 </a>
1206 <a href="<?php echo esc_url('https://www.youtube.com/watch?v=m5wq7NE2rzw&list=PL-hcevD9GINf8Ae3I6UddfU1TJfRZzst4') ?>" target="_blank" rel="noopener">
1207 <i class="fab fa-youtube"></i>
1208 </a>
1209 <a href="<?php echo esc_url('https://www.linkedin.com/company/themewant/') ?>" target="_blank" rel="noopener">
1210 <i class="fab fa-linkedin"></i>
1211 </a>
1212 </p>
1213 </div>
1214 </div>
1215 <div class="help-col-video">
1216 <h3><span class="eshb-dashicon-bg video"><span class="dashicons dashicons-format-video"></span></span><?php echo esc_html__('Video Tutorials', 'easy-hotel')?></h3>
1217 <p><?php echo esc_html__('Watch video guides on how to set up and customize Easy Hotel Booking:', 'easy-hotel')?></p>
1218 <div class="eshb-youtube-playlist">
1219 <div class="eshb-video-player">
1220 <iframe id="eshb-playlist-player" src="https://www.youtube.com/embed/videoseries?si=r_rVc9IYXTzIkDbG&amp;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>
1221 </div>
1222 <div class="eshb-playlist-sidebar">
1223 <h3><?php echo esc_html__('Playlist', 'easy-hotel') ?></h3>
1224 <div style="display: flex; flex-direction: column; gap: 10px;">
1225 <button class="eshb-playlist-item" type="button" onclick="loadEshbTutotialVideo('NUb_lGXbhyU')">
1226 <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;">
1227 <strong><?php echo esc_html__('Intro Video', 'easy-hotel') ?></strong>
1228 </button>
1229 <button class="eshb-playlist-item" type="button" onclick="loadEshbTutotialVideo('m5wq7NE2rzw')">
1230 <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;">
1231 <strong><?php echo esc_html__('Setup Guide', 'easy-hotel') ?></strong>
1232 </button>
1233 <button class="eshb-playlist-item" type="button" onclick="loadEshbTutotialVideo('HYKkw8SK-7U')">
1234 <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;">
1235 <strong><?php echo esc_html__('Seasonal Pricing', 'easy-hotel') ?></strong>
1236 </button>
1237 <button class="eshb-playlist-item" type="button" onclick="loadEshbTutotialVideo('YbUmgyhSGP8')">
1238 <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;">
1239 <strong><?php echo esc_html__('Setup Coupon Code', 'easy-hotel') ?></strong>
1240 </button>
1241 <button class="eshb-playlist-item" type="button" onclick="loadEshbTutotialVideo('Kd72Tekpd8Q')">
1242 <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;">
1243 <strong><?php echo esc_html__('Setup Extra Services', 'easy-hotel') ?></strong>
1244 </button>
1245 <button class="eshb-playlist-item" type="button" onclick="loadEshbTutotialVideo('E8_RSyVLbjg')">
1246 <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;">
1247 <strong><?php echo esc_html__('Setup iCal', 'easy-hotel') ?></strong>
1248 </button>
1249 <button class="eshb-playlist-item" type="button" onclick="loadEshbTutotialVideo('rowRYH4Y5lk')">
1250 <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;">
1251 <strong><?php echo esc_html__('Setup Max/Min Night', 'easy-hotel') ?></strong>
1252 </button>
1253 </div>
1254 </div>
1255 </div>
1256 <script>
1257 function loadEshbTutotialVideo(videoId) {
1258 document.querySelector('iframe').src = `https://www.youtube.com/embed/${videoId}?rel=0`;
1259 }
1260 </script>
1261 </div>
1262 </div>
1263 </div>
1264 <?php
1265
1266 }
1267
1268 function eshb_pro_addons_themes_callback(){
1269 $pro_addons = new ESHB_PRO_ADDONS();
1270 ?>
1271 <h1><?php echo esc_html__( 'Get Addons & Themes', 'easy-hotel' ); ?></h1>
1272 <div class="eshb-themes-addons-row">
1273 <div class="eshb-themes-addons-col">
1274 <h2><?php echo esc_html__( 'Addons', 'easy-hotel' ); ?></h2>
1275 <?php $pro_addons->eshb_get_addons_html(); ?>
1276 </div>
1277 <div class="eshb-themes-addons-col">
1278 <h2><?php echo esc_html__( 'Themes', 'easy-hotel' ); ?></h2>
1279 <?php $pro_addons->eshb_get_themes_html(); ?>
1280 </div>
1281 </div>
1282 <?php
1283 }
1284
1285 // Add custom field (nonce) to taxonomy edit page
1286 function eshb_add_custom_nonce_field() {
1287 // Add nonce field
1288 wp_nonce_field('eshb_save_meta_box_nonce', 'eshb_save_meta');
1289 }
1290
1291 add_action('category_edit_form_fields', 'eshb_add_custom_nonce_field', 10, 2);
1292 add_action('category_add_form_fields', 'eshb_add_custom_nonce_field', 10, 2);
1293
1294 // resposition admin menus
1295 function eshb_reposition_admin_submenus() {
1296 global $submenu;
1297
1298 $parent_slug = 'edit.php?post_type=eshb_accomodation'; // Example: 'edit.php' for Posts menu
1299 $submenu_items = $submenu[$parent_slug] ?? [];
1300
1301 if (!empty($submenu_items)) {
1302
1303 // Remove existing submenus
1304 remove_submenu_page($parent_slug, 'easy-hotel-settings');
1305
1306 // Re-add submenus in the desired order
1307 add_submenu_page($parent_slug, 'Settings', 'Settings', 'manage_options', 'easy-hotel-settings');
1308 add_submenu_page($parent_slug, 'Themes & Addons', 'Themes & Addons', 'manage_options', 'edit.php?post_type=eshb_addons', 'eshb_pro_addons_themes_callback');
1309
1310 }
1311 }
1312
1313 add_action('admin_menu', 'eshb_reposition_admin_submenus', 999); // Priority 999 ensures it runs after all menus are added
1314
1315
1316
1317 // Register the string for translation
1318 function eshb_get_translated_string($option_key, $option_name = 'eshb_settings') {
1319 if (empty($option_key) || empty($option_name)) {
1320 return '';
1321 }
1322
1323 $settings = get_option($option_name);
1324
1325 $default_text = isset($settings[$option_key]) && !empty($settings[$option_key])
1326 ? $settings[$option_key]
1327 : $option_key;
1328
1329 // Polylang exists
1330 if (function_exists('pll__')) {
1331 return pll__($default_text);
1332 }
1333 // WPML exists
1334 else if (function_exists('icl_t')) {
1335 return icl_t('Easy Hotel Booking', $option_key, $default_text);
1336 }
1337 // No translation plugin
1338 else {
1339 return $default_text;
1340 }
1341 }
1342
1343
1344 /**
1345 * Register strings for translation with Polylang or WPML
1346 */
1347 function eshb_register_string_translations($fields = [], $option_name = 'eshb_settings') {
1348 if (empty($fields) || !is_array($fields)) {
1349 return;
1350 }
1351
1352 // Get the settings array
1353 $settings = get_option($option_name);
1354
1355 foreach ($fields as $option_key) {
1356 // Get default text
1357 $default_text = isset($settings[$option_key]) && !empty($settings[$option_key])
1358 ? $settings[$option_key]
1359 : str_replace('_', ' ', ucfirst(str_replace('string_', '', $option_key)));
1360
1361 // Register with Polylang
1362 if (function_exists('pll_register_string')) {
1363 pll_register_string($option_key, $default_text, 'Easy Hotel Booking');
1364 }
1365 // Register with WPML
1366 elseif (function_exists('icl_register_string')) {
1367 icl_register_string('Easy Hotel Booking', $option_key, $default_text);
1368 }
1369 }
1370 }
1371 }, 11);
1372
1373 // Auto hook into init
1374 add_action('init', function() {
1375 $fields = [
1376 'accomodation_base_name',
1377 'string_reserve',
1378 'string_check_availability',
1379 'string_from',
1380 'view_details',
1381 'string_night',
1382 'string_hour',
1383 'string_check_in',
1384 'string_check_out',
1385 'string_guest',
1386 'string_adult',
1387 'string_children',
1388 'string_room',
1389 'string_rooms',
1390 'available_rooms',
1391 'string_extra_bed',
1392 'string_extra_services',
1393 'string_total_cost',
1394 'string_disocunted_price',
1395 'string_book_your_stay',
1396 'string_book_now',
1397 'string_booking_success_msg',
1398 'string_booking_failed_msg',
1399 'string_booking_request_success_msg',
1400 'string_booking_request_failed_msg',
1401 'string_availability_calendar',
1402 'string_apply',
1403 'string_cancel',
1404 'string_related_sub_title',
1405 'string_related__title',
1406 'string_pay_later_due',
1407 'string_deposit_amount',
1408 'string_pay_deposit',
1409 'string_pay_now',
1410 'string_pay_full_amount',
1411 ];
1412
1413 eshb_register_string_translations($fields, 'eshb_settings');
1414 });