PluginProbe
Easy Hotel – Powerful Hotel Booking / 2.0.2
Easy Hotel – Powerful Hotel Booking v2.0.2
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.2, at admin/includes/admin-settings.php

1,416 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 //error_log('easy hotel loaded');
275
276 $general_option_fields = apply_filters( 'eshb_general_option_fields', $general_option_fields );
277
278 // Control core classes for avoid errors
279 if( class_exists( 'ESHB' ) ) {
280
281 // Set a unique slug-like ID
282 $prefix = 'eshb_settings';
283
284 // Create options
285 ESHB::createOptions( $prefix, array(
286
287 // framework title
288 'framework_title' => 'Easy Hotel Settings',
289 'framework_class' => 'easy-hotel-settings easy-hotel-plugin-settings',
290
291 // menu settings
292 'menu_title' => 'Settings',
293 'menu_slug' => 'easy-hotel-settings',
294 //'menu_type' => 'submenu',
295 'menu_capability' => 'manage_options',
296 'menu_icon' => 'dashicons-schedule',
297 'menu_position' => 15,
298 'menu_hidden' => true,
299 //'menu_parent' => 'edit.php?post_type=eshb_accomodation',
300
301 // menu extras
302 'show_bar_menu' => false,
303 'show_sub_menu' => true,
304 'show_in_network' => true,
305 'show_in_customizer' => false,
306
307 'show_search' => false,
308 'show_reset_all' => true,
309 'show_reset_section' => false,
310 'show_footer' => false,
311 'show_all_options' => false,
312 'show_form_warning' => true,
313 'sticky_header' => true,
314 'save_defaults' => true,
315 'ajax_save' => true,
316
317 // admin bar menu settings
318 'admin_bar_menu_icon' => '',
319 'admin_bar_menu_priority' => 80,
320
321 // footer
322 'footer_text' => '',
323 'footer_after' => '',
324 'footer_credit' => '',
325
326 // database model
327 'database' => '', // options, transient, theme_mod, network
328 'transient_time' => 0,
329
330 // contextual help
331 'contextual_help' => array(),
332 'contextual_help_sidebar' => '',
333
334 // typography options
335 'enqueue_webfont' => true,
336 'async_webfont' => false,
337
338 // others
339 'output_css' => true,
340
341 // theme and wrapper classname
342 'nav' => 'inline',
343 'theme' => 'light',
344 'class' => '',
345
346 // external default values
347 'defaults' => array(),
348
349 ) );
350
351
352
353 ESHB::createSection( $prefix, array(
354 'title' => 'General',
355 'fields' => $general_option_fields
356 ));
357
358 ESHB::createSection( $prefix, array(
359 'title' => 'Pages',
360 'fields' => array(
361 // Select with pages
362 array(
363 'id' => 'archive-page',
364 'type' => 'select',
365 'title' => 'Rooms Archive Page',
366 'placeholder' => 'Default',
367 'options' => 'pages',
368 'default' => '1',
369 'query_args' => array(
370 'posts_per_page' => -1 // for get all pages (also it's same for posts).
371 ),
372 ),
373 array(
374 'id' => 'archive-page-template-style',
375 'type' => 'select',
376 'title' => 'Room Archive Page Style',
377 'options' => array(
378 'style-one' => 'Style One',
379 'style-two' => 'Style Two'
380 ),
381 'default' => 'style-one',
382 ),
383 array(
384 'id' => 'single-page-template-style',
385 'type' => 'select',
386 'title' => 'Room Details Page Style',
387 'options' => array(
388 'style-one' => 'Style One',
389 'style-two' => 'Style Two'
390 ),
391 'default' => 'style-one',
392 ),
393 array(
394 'id' => 'search-result-page',
395 'type' => 'select',
396 'title' => 'Search Result Page',
397 'placeholder' => 'Default',
398 'options' => 'pages',
399 'query_args' => array(
400 'posts_per_page' => -1 // for get all pages (also it's same for posts).
401 ),
402 ),
403 array(
404 'id' => 'account-page',
405 'type' => 'select',
406 'title' => 'Account Page',
407 'placeholder' => 'Default',
408 'options' => 'pages',
409 'query_args' => array(
410 'posts_per_page' => -1 // for get all pages (also it's same for posts).
411 ),
412 ),
413 array(
414 'id' => 'terms-and-conditions-page',
415 'type' => 'select',
416 'title' => 'Terms and Conditions Page',
417 'placeholder' => 'Default',
418 'options' => 'pages',
419 'query_args' => array(
420 'posts_per_page' => -1 // for get all pages (also it's same for posts).
421 ),
422 ),
423 )
424 )
425 );
426
427 ESHB::createSection( $prefix, array(
428 'title' => 'Accomodations',
429 'fields' => array(
430 array(
431 'id' => 'accomodation_base_name',
432 'type' => 'text',
433 'title' => 'Base Name',
434 //'desc' => 'Add URL if you select External Booking'
435 'default' => 'eshb_accomodation'
436 ),
437 array(
438 'id' => 'accomodation_posts_per_page',
439 'type' => 'number',
440 'title' => 'Posts Per Page',
441 //'desc' => 'Add URL if you select External Booking'
442 'default' => 6
443 ),
444 array(
445 'id' => 'accomodation_posts_per_row',
446 'type' => 'number',
447 'title' => 'Posts Per Row (Columns)',
448 //'desc' => 'Add URL if you select External Booking'
449 'default' => 3
450 ),
451 array(
452 'id' => 'accomodation_posts_order_by',
453 'type' => 'select',
454 'title' => 'Posts Order By',
455 //'desc' => 'Add URL if you select External Booking'
456 'options' => array(
457 'none' => 'none',
458 'id' => 'ID',
459 'date' => 'Date',
460 'title' => 'Title',
461 'name' => 'name',
462 'menu_order' => 'Menu Order',
463 'random' => 'Random'
464 ),
465 'default' => 'none'
466 ),
467 array(
468 'id' => 'accomodation_posts_order',
469 'type' => 'select',
470 'title' => 'Posts Order',
471 //'desc' => 'Add URL if you select External Booking'
472 'options' => array(
473 'DESC' => 'DESC',
474 'ASC' => 'ASC'
475 ),
476 'default' => 'DESC'
477 ),
478 array(
479 'id' => 'related-accomodation-switcher-in-single',
480 'type' => 'switcher',
481 'title' => 'Show Related Accomodations in Details Page',
482 'default' => true
483 ),
484 )
485 )
486 );
487
488 $admin_email = get_option('admin_email');
489
490 ESHB::createSection( $prefix, array(
491 'title' => 'Booking',
492 'fields' => array(
493 // Select with pages
494 array(
495 'id' => 'booking-type',
496 'type' => 'select',
497 'title' => 'Checkout Method',
498 'placeholder' => 'Select an option',
499 'options' => array(
500 'woocommerce' => 'Woocoommerce Checkout',
501 'surecart' => 'SurecCart Checkout',
502 'native_checkout' => 'Native Checkout',
503 'external' => 'External Checkout',
504 'booking_request' => 'Booking Request',
505 'disable' => 'Disable Booking',
506 ),
507 'default' => 'native_checkout'
508 ),
509 array(
510 'id' => 'booking-form-type',
511 'type' => 'select',
512 'title' => 'Booking Form Type',
513 'placeholder' => 'Select an option',
514 'options' => array(
515 'default' => 'Default',
516 'cf7' => 'Contact Form 7',
517 'fluentform' => 'Fluent Form',
518 ),
519 'default' => 'default',
520 'dependency' => array( 'booking-type', '==', 'booking_request' )
521 ),
522 array(
523 'id' => 'booking-form-shortcode',
524 'type' => 'text',
525 'title' => 'Booking Form Shortcode',
526 '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.',
527 'default' => '',
528 'dependency' => array( ['booking-type', '==', 'booking_request'], ['booking-form-type', '!=', 'default'] )
529 ),
530 array(
531 'id' => 'external-booking-link',
532 'type' => 'text',
533 'title' => 'External Booking Link',
534 'desc' => 'Add URL if you select External Booking',
535 'dependency' => array( 'booking-type', '==', 'external' )
536 ),
537 array(
538 'id' => 'direct-booking',
539 'type' => 'switcher',
540 'title' => 'Direct Booking',
541 'desc' => 'Enable for redirect to checkout page after adding room to cart.',
542 'default' => true,
543 'dependency' => array( 'booking-type', '==', 'woocommerce' ),
544 ),
545 array(
546 'id' => 'cart-blocking-switcher',
547 'type' => 'switcher',
548 'title' => 'Enable Cart Blocking',
549 'desc' => 'Temporarily block calendar dates when a user adds to cart.',
550 'default' => false,
551 ),
552 array(
553 'id' => 'cart-blocking-time',
554 'type' => 'number',
555 'title' => 'Blocking Duration (minutes)',
556 'desc' => 'How long dates are held after a user adds to cart.',
557 'default' => 5,
558 'dependency' => array( 'cart-blocking-switcher', '==', true ),
559 ),
560 array(
561 'id' => 'cart-blocking-notice-msg',
562 'type' => 'text',
563 'title' => 'Checkout Countdown Message',
564 'desc' => 'Text shown before the countdown timer on the cart/checkout page.',
565 'default' => 'Your reservation is held for',
566 'dependency' => array( 'cart-blocking-switcher', '==', true ),
567 ),
568 array(
569 'id' => 'checkout-billing-fields',
570 'type' => 'select',
571 'title' => 'Billing Fields',
572 'desc' => 'Select which billing fields to display on the checkout page. Unselected fields will be hidden.',
573 'multiple' => true,
574 'dependency' => array( 'booking-type', '==', 'woocommerce' ),
575 'placeholder' => 'Select fields to show',
576 'options' => array(
577 'billing_first_name' => 'First Name',
578 'billing_last_name' => 'Last Name',
579 'billing_company' => 'Company',
580 'billing_email' => 'Email Address',
581 'billing_phone' => 'Phone',
582 'billing_address_1' => 'Address Line 1',
583 'billing_address_2' => 'Address Line 2',
584 'billing_city' => 'City',
585 'billing_postcode' => 'Postcode / ZIP',
586 'billing_country' => 'Country',
587 'billing_state' => 'State / County',
588 ),
589 'default' => array(
590 'billing_first_name', 'billing_last_name',
591 'billing_email', 'billing_phone', 'billing_address_1',
592 ),
593 ),
594 array(
595 'id' => 'checkout-shipping-fields',
596 'type' => 'select',
597 'title' => 'Shipping Fields',
598 'desc' => 'Select which shipping fields to display on the checkout page. Unselected fields will be hidden.',
599 'multiple' => true,
600 'placeholder' => 'Select fields to show',
601 'dependency' => array( 'booking-type', '==', 'woocommerce' ),
602 'options' => array(
603 'shipping_first_name' => 'First Name',
604 'shipping_last_name' => 'Last Name',
605 'shipping_company' => 'Company',
606 'shipping_address_1' => 'Address Line 1',
607 'shipping_address_2' => 'Address Line 2',
608 'shipping_city' => 'City',
609 'shipping_postcode' => 'Postcode / ZIP',
610 'shipping_country' => 'Country',
611 'shipping_state' => 'State / County',
612 ),
613 'default' => array(
614 'shipping_first_name', 'shipping_last_name', 'shipping_address_1',
615 ),
616 ),
617 array(
618 'id' => 'checkout-additional-fields',
619 'type' => 'switcher',
620 'title' => 'Additional Information',
621 'desc' => 'Enable or disable the entire Additional Information section on the checkout page.',
622 'default' => false,
623 'dependency' => array( 'booking-type', '==', 'woocommerce' ),
624 ),
625 array(
626 'id' => 'recipent_email',
627 'type' => 'text',
628 'title' => 'Recipent Email Address',
629 'desc' => 'Add recipent email address for getting Booking Request.',
630 'default' => $admin_email,
631 'dependency' => array( ['booking-type', '==', 'booking_request'], ['booking-form-type', '==', 'default'] )
632 ),
633
634 // Payment Gateways
635 array(
636 'id' => 'payment-gateways',
637 'type' => 'tabbed',
638 'title' => 'Payment Gateways',
639 'dependency' => array( 'booking-type', '==', 'native_checkout' ),
640 'tabs' => array(
641 // --- Cash on Delivery -------------------------------------
642 array(
643 'title' => 'Cash on Delivery',
644 'icon' => 'fas fa-hand-holding-usd',
645 'fields' => array(
646 array(
647 'id' => 'gateway-cod-enable',
648 'type' => 'switcher',
649 'title' => 'Enable Cash on Delivery',
650 'desc' => 'Let customers reserve now and pay with cash on arrival / at the property.',
651 'default' => true,
652 ),
653 array(
654 'id' => 'cod-title',
655 'type' => 'text',
656 'title' => 'Cash on Delivery',
657 'desc' => 'The label shown to customers on the checkout page.',
658 'default' => 'Cash on Delivery',
659 'dependency' => array( 'gateway-cod-enable', '==', true ),
660 ),
661 array(
662 'id' => 'cod-description',
663 'type' => 'textarea',
664 'title' => 'Cash on Delivery Description',
665 'desc' => 'Short instructions shown under the title at checkout.',
666 'default' => 'Pay with cash upon arrival / at the property.',
667 'dependency' => array( 'gateway-cod-enable', '==', true ),
668 ),
669 )
670 ),
671 array(
672 'title' => 'PayPal',
673 'icon' => 'fab fa-paypal',
674 'fields' => array(
675 // --- PayPal ----------------------------------------------
676 array(
677 'id' => 'gateway-paypal-enable',
678 'type' => 'switcher',
679 'title' => 'Enable PayPal',
680 'desc' => 'Requires a valid Client ID & Secret below.',
681 'default' => true,
682 ),
683 array(
684 'id' => 'paypal-mode',
685 'type' => 'select',
686 'title' => 'PayPal Mode',
687 'desc' => 'Use "Sandbox" while testing and "Live" for real payments.',
688 'options' => array(
689 'sandbox' => 'Sandbox',
690 'live' => 'Live',
691 ),
692 'default' => 'sandbox',
693 'dependency' => array( 'gateway-paypal-enable', '==', true ),
694 ),
695 array(
696 'id' => 'paypal-client-id',
697 'type' => 'text',
698 'title' => 'PayPal Client ID',
699 'desc' => 'PayPal REST API client ID. Required for the PayPal gateway.',
700 'dependency' => array( 'gateway-paypal-enable', '==', true ),
701 ),
702 array(
703 'id' => 'paypal-client-secret',
704 'type' => 'text',
705 'title' => 'PayPal Client Secret',
706 'desc' => 'PayPal REST API client secret. Required for the PayPal gateway.',
707 'dependency' => array( 'gateway-paypal-enable', '==', true ),
708 ),
709 )
710 ),
711 array(
712 'title' => 'Tax',
713 'icon' => 'fas fa-percentage',
714 'fields' => array(
715 // --- General ---------------------------------------------
716 array(
717 'id' => 'native-checkout-tax-rate',
718 'type' => 'number',
719 'title' => 'Native Checkout Tax Rate (%)',
720 'desc' => 'Optional tax percentage applied on the native checkout total.',
721 'default' => 0,
722 ),
723 )
724 )
725 )
726 ),
727 array(
728 'id' => 'holidays',
729 'type' => 'repeater',
730 'title' => 'Holidays',
731 'fields' => array(
732
733 array(
734 'id' => 'holiday-date',
735 'type' => 'date',
736 'title' => 'Date',
737 'desc' => 'Add holiday by date from here.',
738 'from_to' => true,
739 'settings' => array(
740 'dateFormat' => 'yy-mm-dd',
741 'changeMonth' => true,
742 'changeYear' => true,
743 'showButtonPanel' => true,
744 'weekHeader' => 'Week',
745 'monthNamesShort' => array( 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' ),
746 'dayNamesMin' => array( 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday' ),
747 ),
748 ),
749 array(
750 'id' => 'holiday-title',
751 'type' => 'text',
752 'title' => 'Title',
753 'desc' => 'Add holiday title from here.',
754 ),
755 array(
756 'id' => 'accomodation-ids',
757 'type' => 'select',
758 'title' => 'Accomodations',
759 'placeholder' => 'Select Accomodations',
760 'desc' => 'Select Accomodations for this coupon.',
761 'options' => 'posts',
762 'multiple' => true,
763 'chosen' => false,
764 'query_args' => array(
765 'post_type' => 'eshb_accomodation',
766 'posts_per_page' => -1,
767 ),
768 ),
769
770 ),
771 ),
772
773 )
774 )
775 );
776
777 ESHB::createSection( $prefix, array(
778 'title' => 'Design',
779 'fields' => array(
780 array(
781 'id' => 'booking-form-style',
782 'type' => 'select',
783 'title' => 'Booking Form Style',
784
785 'options' => array(
786 'default' => 'Default',
787 'style-one' => 'Style One',
788 'style-two' => 'Style Two'
789 ),
790 'default' => 'style-two'
791 ),
792 array(
793 'id' => 'calendar-colors',
794 'type' => 'color_group',
795 'title' => 'Calendar Colors',
796 'output_mode' => 'background-color',
797 'options' => array(
798 'booked-bg-color' => 'Booked Background',
799 'booked-color' => 'Booked Color',
800 'active-bg-color' => 'Active Background',
801 'active-color' => 'Active Color',
802 'inrange-bg-color' => 'Inrange Background',
803 'inrange-color' => 'Inrange Color',
804 'reserved-bg-color' => 'Reserved Background',
805 'reserved-color' => 'Reserved Color',
806 )
807 ),
808 array(
809 'id' => 'theme-colors',
810 'type' => 'color_group',
811 'title' => 'Theme Colors',
812 'output_mode' => 'background-color',
813 'options' => array(
814 'primary-color' => 'Primary Color',
815 'secondary-color' => 'Secondary Color',
816 'territory-color' => 'Territory Color',
817 'success-color' => 'Success Color',
818 'danger-color' => 'Danger Color',
819 'dark-color' => 'Dark Color',
820 'text-color' => 'Text Color',
821 'white-color' => 'White Color',
822 'border-color' => 'Border Color',
823 ),
824 'default' => array(
825 'primary-color' => '#ab8965',
826 'secondary-color' => '#fff5ed',
827 'territory-color' => '#70533a',
828 'success-color' => '#1ec734',
829 'danger-color' => '#e41749',
830 'dark-color' => '#181818',
831 'text-color' => '#212529',
832 'white-color' => '#ffffff',
833 'border-color' => '#ab8965',
834 )
835 ),
836 array(
837 'id' => 'page-spacing',
838 'type' => 'spacing',
839 'title' => 'Page Spacing',
840 'left' => false,
841 'right' => false,
842 'units' => array( 'px' ),
843 'output_mode' => 'padding', // or margin, relative
844 ),
845 array(
846 'id' => 'page-container-size',
847 'type' => 'dimensions',
848 'title' => 'Page Container Size',
849 'units' => array( 'px' ),
850 'height' => false,
851 'output_mode' => 'width', // or margin, relative
852 ),
853
854 )
855 )
856 );
857
858 // Create a section
859 ESHB::createSection( $prefix, array(
860 'title' => 'Usage',
861 'fields' => array(
862 array(
863 'type' => 'callback',
864 'function' => 'eshb_easy_hotel_usage_callback',
865 ),
866 )
867 )
868 );
869
870
871
872 ESHB::createSection( $prefix, array(
873 'title' => 'Translation',
874 'fields' => array(
875 array(
876 'type' => 'subheading',
877 'content' => 'Booking & Search Form Translation',
878 ),
879 array(
880 'id' => 'string_reserve',
881 'type' => 'text',
882 'title' => 'Reserve',
883 //'desc' => 'Add URL if you select External Booking'
884 'default' => 'Reserve'
885 ),
886 array(
887 'id' => 'string_check_availability',
888 'type' => 'text',
889 'title' => 'Check Availability',
890 //'desc' => 'Add URL if you select External Booking'
891 'default' => 'Check Availability'
892 ),
893 array(
894 'id' => 'string_from',
895 'type' => 'text',
896 'title' => 'From',
897 //'desc' => 'Add URL if you select External Booking'
898 'default' => 'From'
899 ),
900 array(
901 'id' => 'view_details',
902 'type' => 'text',
903 'title' => 'View Details',
904 //'desc' => 'Add URL if you select External Booking'
905 ),
906 array(
907 'id' => 'string_night',
908 'type' => 'text',
909 'title' => 'Night',
910 //'desc' => 'Add URL if you select External Booking'
911 'default' => 'night'
912 ),
913 array(
914 'id' => 'string_hour',
915 'type' => 'text',
916 'title' => 'Hour',
917 //'desc' => 'Add URL if you select External Booking'
918 'default' => 'hour'
919 ),
920 array(
921 'id' => 'string_check_in',
922 'type' => 'text',
923 'title' => 'Check In',
924 //'desc' => 'Add URL if you select External Booking'
925 'default' => 'Check In'
926 ),
927 array(
928 'id' => 'string_check_out',
929 'type' => 'text',
930 'title' => 'Check Out',
931 //'desc' => 'Add URL if you select External Booking'
932 'default' => 'Check Out'
933 ),
934 array(
935 'id' => 'string_guest',
936 'type' => 'text',
937 'title' => 'Guest',
938 //'desc' => 'Add URL if you select External Booking'
939 'default' => 'Guest'
940 ),
941 array(
942 'id' => 'string_adult',
943 'type' => 'text',
944 'title' => 'Adult',
945 //'desc' => 'Add URL if you select External Booking'
946 'default' => 'Adult'
947 ),
948 array(
949 'id' => 'string_children',
950 'type' => 'text',
951 'title' => 'Children',
952 //'desc' => 'Add URL if you select External Booking'
953 'default' => 'Children'
954 ),
955 array(
956 'id' => 'string_room',
957 'type' => 'text',
958 'title' => 'Room',
959 //'desc' => 'Add URL if you select External Booking'
960 'default' => 'Room'
961 ),
962 array(
963 'id' => 'string_rooms',
964 'type' => 'text',
965 'title' => 'Rooms',
966 //'desc' => 'Add URL if you select External Booking'
967 'default' => 'Rooms'
968 ),
969 array(
970 'id' => 'available_rooms',
971 'type' => 'text',
972 'title' => 'Available Rooms',
973 //'desc' => 'Add URL if you select External Booking'
974 'default' => 'Available Rooms:'
975 ),
976 array(
977 'id' => 'string_extra_bed',
978 'type' => 'text',
979 'title' => 'Extra Bed',
980 //'desc' => 'Add URL if you select External Booking'
981 'default' => 'Extra Bed'
982 ),
983 array(
984 'id' => 'string_extra_services',
985 'type' => 'text',
986 'title' => 'Extra Services',
987 //'desc' => 'Add URL if you select External Booking'
988 'default' => 'Extra Services'
989 ),
990 array(
991 'id' => 'string_total_cost',
992 'type' => 'text',
993 'title' => 'Total Cost',
994 //'desc' => 'Add URL if you select External Booking'
995 'default' => 'Total Cost'
996 ),
997 array(
998 'id' => 'string_disocunted_price',
999 'type' => 'text',
1000 'title' => 'Discounted Price',
1001 //'desc' => 'Add URL if you select External Booking'
1002 'default' => 'Discounted Price'
1003 ),
1004 array(
1005 'id' => 'string_book_your_stay',
1006 'type' => 'text',
1007 'title' => 'Book Your Stay',
1008 //'desc' => 'Add URL if you select External Booking'
1009 'default' => 'Book Your Stay'
1010 ),
1011 array(
1012 'id' => 'string_book_now',
1013 'type' => 'text',
1014 'title' => 'Book Now',
1015 //'desc' => 'Add URL if you select External Booking'
1016 'default' => 'Book Now'
1017 ),
1018 array(
1019 'id' => 'string_booking_success_msg',
1020 'type' => 'text',
1021 'title' => 'Booking Success Message',
1022 //'desc' => 'Add URL if you select External Booking'
1023 'default' => 'Reservation Successfully added to your cart.'
1024 ),
1025 array(
1026 'id' => 'string_booking_failed_msg',
1027 'type' => 'text',
1028 'title' => 'Booking Failed Message',
1029 //'desc' => 'Add URL if you select External Booking'
1030 'default' => 'Ops! This Reservation has been failed.'
1031 ),
1032 array(
1033 'id' => 'string_booking_request_success_msg',
1034 'type' => 'text',
1035 'title' => 'Booking Request Success Message',
1036 //'desc' => 'Add URL if you select External Booking'
1037 'default' => 'Booking request has been sent successfully.'
1038 ),
1039 array(
1040 'id' => 'string_booking_request_failed_msg',
1041 'type' => 'text',
1042 'title' => 'Booking Request Failed Message',
1043 //'desc' => 'Add URL if you select External Booking'
1044 'default' => 'Ops! Booking request can\'t be sent.'
1045 ),
1046 array(
1047 'id' => 'string_availability_calendar',
1048 'type' => 'text',
1049 'title' => 'Availability Calendar',
1050 //'desc' => 'Add URL if you select External Booking'
1051 'default' => 'Availability Calendar',
1052 ),
1053 array(
1054 'id' => 'string_apply',
1055 'type' => 'text',
1056 'title' => 'Apply',
1057 //'desc' => 'Add URL if you select External Booking'
1058 ),
1059 array(
1060 'id' => 'string_cancel',
1061 'type' => 'text',
1062 'title' => 'Cancel',
1063 //'desc' => 'Add URL if you select External Booking'
1064 ),
1065
1066 array(
1067 'id' => 'string_related_sub_title',
1068 'type' => 'text',
1069 'title' => 'Related Sub Title Change Here',
1070 //'desc' => 'Related Sub Title Change Here'
1071 ),
1072
1073 array(
1074 'id' => 'string_related__title',
1075 'type' => 'text',
1076 'title' => 'Related Title Change Here',
1077 //'desc' => 'Related Title Change Here'
1078 ),
1079 array(
1080 'id' => 'string_pay_later_due',
1081 'type' => 'text',
1082 'title' => 'Pay Later (Due)',
1083 //'desc' => 'Add URL if you select External Booking'
1084 'default' => 'Pay Later (Due)',
1085 ),
1086 array(
1087 'id' => 'string_pay_now',
1088 'type' => 'text',
1089 'title' => 'Pay Now',
1090 //'desc' => 'Add URL if you select External Booking'
1091 'default' => 'Pay Now',
1092 ),
1093 array(
1094 'id' => 'string_deposit_amount',
1095 'type' => 'text',
1096 'title' => 'Deposit Amount',
1097 //'desc' => 'Add URL if you select External Booking'
1098 'default' => 'Deposit Amount',
1099 ),
1100 array(
1101 'id' => 'string_pay_deposit',
1102 'type' => 'text',
1103 'title' => 'Pay Deposit',
1104 //'desc' => 'Add URL if you select External Booking'
1105 'default' => 'Pay Deposit',
1106 ),
1107 array(
1108 'id' => 'string_pay_full_amount',
1109 'type' => 'text',
1110 'title' => 'Pay Full Amount',
1111 //'desc' => 'Add URL if you select External Booking'
1112 'default' => 'Pay Full Amount',
1113 ),
1114 array(
1115 'id' => 'string_please_wait',
1116 'type' => 'text',
1117 'title' => 'Please Wait',
1118 //'desc' => 'Add URL if you select External Booking'
1119 'default' => 'Please Wait',
1120 ),
1121 )
1122 )
1123 );
1124
1125
1126 // Create a section
1127 ESHB::createSection( $prefix, array(
1128 'title' => 'Help & Support',
1129 'fields' => array(
1130 array(
1131 'type' => 'callback',
1132 'function' => 'eshb_easy_hotel_help_support_callback',
1133 ),
1134 )
1135 )
1136 );
1137
1138
1139
1140
1141 }
1142 function eshb_easy_hotel_usage_callback() {
1143 ?>
1144
1145 <div class="eshb_easy_hotel_usage_callback">
1146 <h3> <?php echo esc_html__('Shortcode:', 'easy-hotel')?></h3>
1147 <div>
1148 <p><strong>Archive Grid: </strong><?php echo esc_html__('[eshb_accomodation_grid]', 'easy-hotel')?></p>
1149 <p><strong>Search Form: </strong><?php echo esc_html__('[eshb_search_form]', 'easy-hotel')?></p>
1150 <p><strong>Booking Form For Room Details Page: </strong><?php echo esc_html__('[eshb_booking_form]', 'easy-hotel')?></p>
1151 <p><strong>Booking Form For Global: </strong><?php echo esc_html__('[eshb_booking_form accomodation_id="123"]', 'easy-hotel')?></p>
1152 <p><strong>Availability Calendar For Room Details Page: </strong><?php echo esc_html__('[eshb_availability_calendar]', 'easy-hotel')?></p>
1153 <p><strong>Availability Calendar For Global: </strong><?php echo esc_html__('[eshb_availability_calendar accomodation_id="123"]', 'easy-hotel')?></p>
1154 <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>
1155 <p><strong>Day Wise Pricing Table For Room Details Page: </strong><?php echo esc_html__('[eshb_daywise_pricing_table]', 'easy-hotel')?></p>
1156 <p><strong>Day Wise Pricing Table For Global: </strong><?php echo esc_html__('[eshb_daywise_pricing_table accomodation_id="123"]', 'easy-hotel')?></p>
1157 <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>
1158 <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>
1159 </div>
1160 </div>
1161
1162 <p>
1163 <?php echo esc_html__('Easy Hotel', 'easy-hotel')?>
1164 <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')?>
1165 </p>
1166
1167 <?php
1168
1169 }
1170
1171 function eshb_easy_hotel_help_support_callback() {
1172 ?>
1173
1174 <div class="eshb_easy_hotel_help_support_callback">
1175 <div class="eshb-help-support">
1176
1177 <h2><?php echo esc_html__( 'Welcome to Easy Hotel Booking – Help & Support', 'easy-hotel' )?></h2>
1178 <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>
1179
1180 <div class="help-col-container">
1181 <div class="help-col">
1182 <h3><span class="eshb-dashicon-bg docs"><span class="dashicons dashicons-book-alt"></span></span><?php echo esc_html__('Documentation', 'easy-hotel')?></h3>
1183 <p>
1184 <?php echo esc_html__('Find step-by-step guides and configuration help in our documentation:', 'easy-hotel')?><br>
1185 <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>
1186 </p>
1187 </div>
1188 <div class="help-col">
1189 <h3><span class="eshb-dashicon-bg support"><span class="dashicons dashicons-sos"></span></span><?php echo esc_html__('Get Support', 'easy-hotel')?></h3>
1190 <p><?php echo esc_html__('If you have questions or face any issues, please reach out to us:', 'easy-hotel')?></p>
1191 <ul>
1192 <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>
1193
1194 </ul>
1195 </div>
1196 <div class="help-col">
1197 <h3><span class="eshb-dashicon-bg community"><span class="dashicons dashicons-groups"></span></span><?php echo esc_html__('Community', 'easy-hotel')?></h3>
1198 <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>
1199 <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>
1200 </div>
1201 <div class="help-col">
1202 <h3><span class="eshb-dashicon-bg follow"><span class="dashicons dashicons-share"></span></span><?php echo esc_html__('Follow Us', 'easy-hotel')?></h3>
1203 <p><?php echo esc_html__('Stay updated and connect with us on social media:', 'easy-hotel')?></p>
1204 <p class="eshb-social-icons" style="font-size: 24px;">
1205 <a href="<?php echo esc_url('https://www.facebook.com/themewant') ?>" target="_blank" rel="noopener">
1206 <i class="fab fa-facebook"></i>
1207 </a>
1208 <a href="<?php echo esc_url('https://www.youtube.com/watch?v=m5wq7NE2rzw&list=PL-hcevD9GINf8Ae3I6UddfU1TJfRZzst4') ?>" target="_blank" rel="noopener">
1209 <i class="fab fa-youtube"></i>
1210 </a>
1211 <a href="<?php echo esc_url('https://www.linkedin.com/company/themewant/') ?>" target="_blank" rel="noopener">
1212 <i class="fab fa-linkedin"></i>
1213 </a>
1214 </p>
1215 </div>
1216 </div>
1217 <div class="help-col-video">
1218 <h3><span class="eshb-dashicon-bg video"><span class="dashicons dashicons-format-video"></span></span><?php echo esc_html__('Video Tutorials', 'easy-hotel')?></h3>
1219 <p><?php echo esc_html__('Watch video guides on how to set up and customize Easy Hotel Booking:', 'easy-hotel')?></p>
1220 <div class="eshb-youtube-playlist">
1221 <div class="eshb-video-player">
1222 <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>
1223 </div>
1224 <div class="eshb-playlist-sidebar">
1225 <h3><?php echo esc_html__('Playlist', 'easy-hotel') ?></h3>
1226 <div style="display: flex; flex-direction: column; gap: 10px;">
1227 <button class="eshb-playlist-item" type="button" onclick="loadEshbTutotialVideo('NUb_lGXbhyU')">
1228 <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;">
1229 <strong><?php echo esc_html__('Intro Video', 'easy-hotel') ?></strong>
1230 </button>
1231 <button class="eshb-playlist-item" type="button" onclick="loadEshbTutotialVideo('m5wq7NE2rzw')">
1232 <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;">
1233 <strong><?php echo esc_html__('Setup Guide', 'easy-hotel') ?></strong>
1234 </button>
1235 <button class="eshb-playlist-item" type="button" onclick="loadEshbTutotialVideo('HYKkw8SK-7U')">
1236 <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;">
1237 <strong><?php echo esc_html__('Seasonal Pricing', 'easy-hotel') ?></strong>
1238 </button>
1239 <button class="eshb-playlist-item" type="button" onclick="loadEshbTutotialVideo('YbUmgyhSGP8')">
1240 <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;">
1241 <strong><?php echo esc_html__('Setup Coupon Code', 'easy-hotel') ?></strong>
1242 </button>
1243 <button class="eshb-playlist-item" type="button" onclick="loadEshbTutotialVideo('Kd72Tekpd8Q')">
1244 <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;">
1245 <strong><?php echo esc_html__('Setup Extra Services', 'easy-hotel') ?></strong>
1246 </button>
1247 <button class="eshb-playlist-item" type="button" onclick="loadEshbTutotialVideo('E8_RSyVLbjg')">
1248 <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;">
1249 <strong><?php echo esc_html__('Setup iCal', 'easy-hotel') ?></strong>
1250 </button>
1251 <button class="eshb-playlist-item" type="button" onclick="loadEshbTutotialVideo('rowRYH4Y5lk')">
1252 <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;">
1253 <strong><?php echo esc_html__('Setup Max/Min Night', 'easy-hotel') ?></strong>
1254 </button>
1255 </div>
1256 </div>
1257 </div>
1258 <script>
1259 function loadEshbTutotialVideo(videoId) {
1260 document.querySelector('iframe').src = `https://www.youtube.com/embed/${videoId}?rel=0`;
1261 }
1262 </script>
1263 </div>
1264 </div>
1265 </div>
1266 <?php
1267
1268 }
1269
1270 function eshb_pro_addons_themes_callback(){
1271 $pro_addons = new ESHB_PRO_ADDONS();
1272 ?>
1273 <h1><?php echo esc_html__( 'Get Addons & Themes', 'easy-hotel' ); ?></h1>
1274 <div class="eshb-themes-addons-row">
1275 <div class="eshb-themes-addons-col">
1276 <h2><?php echo esc_html__( 'Addons', 'easy-hotel' ); ?></h2>
1277 <?php $pro_addons->eshb_get_addons_html(); ?>
1278 </div>
1279 <div class="eshb-themes-addons-col">
1280 <h2><?php echo esc_html__( 'Themes', 'easy-hotel' ); ?></h2>
1281 <?php $pro_addons->eshb_get_themes_html(); ?>
1282 </div>
1283 </div>
1284 <?php
1285 }
1286
1287 // Add custom field (nonce) to taxonomy edit page
1288 function eshb_add_custom_nonce_field() {
1289 // Add nonce field
1290 wp_nonce_field('eshb_save_meta_box_nonce', 'eshb_save_meta');
1291 }
1292
1293 add_action('category_edit_form_fields', 'eshb_add_custom_nonce_field', 10, 2);
1294 add_action('category_add_form_fields', 'eshb_add_custom_nonce_field', 10, 2);
1295
1296 // resposition admin menus
1297 function eshb_reposition_admin_submenus() {
1298 global $submenu;
1299
1300 $parent_slug = 'edit.php?post_type=eshb_accomodation'; // Example: 'edit.php' for Posts menu
1301 $submenu_items = $submenu[$parent_slug] ?? [];
1302
1303 if (!empty($submenu_items)) {
1304
1305 // Remove existing submenus
1306 remove_submenu_page($parent_slug, 'easy-hotel-settings');
1307
1308 // Re-add submenus in the desired order
1309 add_submenu_page($parent_slug, 'Settings', 'Settings', 'manage_options', 'easy-hotel-settings');
1310 add_submenu_page($parent_slug, 'Themes & Addons', 'Themes & Addons', 'manage_options', 'edit.php?post_type=eshb_addons', 'eshb_pro_addons_themes_callback');
1311
1312 }
1313 }
1314
1315 add_action('admin_menu', 'eshb_reposition_admin_submenus', 999); // Priority 999 ensures it runs after all menus are added
1316
1317
1318
1319 // Register the string for translation
1320 function eshb_get_translated_string($option_key, $option_name = 'eshb_settings') {
1321 if (empty($option_key) || empty($option_name)) {
1322 return '';
1323 }
1324
1325 $settings = get_option($option_name);
1326
1327 $default_text = isset($settings[$option_key]) && !empty($settings[$option_key])
1328 ? $settings[$option_key]
1329 : $option_key;
1330
1331 // Polylang exists
1332 if (function_exists('pll__')) {
1333 return pll__($default_text);
1334 }
1335 // WPML exists
1336 else if (function_exists('icl_t')) {
1337 return icl_t('Easy Hotel Booking', $option_key, $default_text);
1338 }
1339 // No translation plugin
1340 else {
1341 return $default_text;
1342 }
1343 }
1344
1345
1346 /**
1347 * Register strings for translation with Polylang or WPML
1348 */
1349 function eshb_register_string_translations($fields = [], $option_name = 'eshb_settings') {
1350 if (empty($fields) || !is_array($fields)) {
1351 return;
1352 }
1353
1354 // Get the settings array
1355 $settings = get_option($option_name);
1356
1357 foreach ($fields as $option_key) {
1358 // Get default text
1359 $default_text = isset($settings[$option_key]) && !empty($settings[$option_key])
1360 ? $settings[$option_key]
1361 : str_replace('_', ' ', ucfirst(str_replace('string_', '', $option_key)));
1362
1363 // Register with Polylang
1364 if (function_exists('pll_register_string')) {
1365 pll_register_string($option_key, $default_text, 'Easy Hotel Booking');
1366 }
1367 // Register with WPML
1368 elseif (function_exists('icl_register_string')) {
1369 icl_register_string('Easy Hotel Booking', $option_key, $default_text);
1370 }
1371 }
1372 }
1373 }, 11);
1374
1375 // Auto hook into init
1376 add_action('init', function() {
1377 $fields = [
1378 'accomodation_base_name',
1379 'string_reserve',
1380 'string_check_availability',
1381 'string_from',
1382 'view_details',
1383 'string_night',
1384 'string_hour',
1385 'string_check_in',
1386 'string_check_out',
1387 'string_guest',
1388 'string_adult',
1389 'string_children',
1390 'string_room',
1391 'string_rooms',
1392 'available_rooms',
1393 'string_extra_bed',
1394 'string_extra_services',
1395 'string_total_cost',
1396 'string_disocunted_price',
1397 'string_book_your_stay',
1398 'string_book_now',
1399 'string_booking_success_msg',
1400 'string_booking_failed_msg',
1401 'string_booking_request_success_msg',
1402 'string_booking_request_failed_msg',
1403 'string_availability_calendar',
1404 'string_apply',
1405 'string_cancel',
1406 'string_related_sub_title',
1407 'string_related__title',
1408 'string_pay_later_due',
1409 'string_deposit_amount',
1410 'string_pay_deposit',
1411 'string_pay_now',
1412 'string_pay_full_amount',
1413 ];
1414
1415 eshb_register_string_translations($fields, 'eshb_settings');
1416 });