PluginProbe
VikBooking Hotel Booking Engine & PMS / 1.6.6
VikBooking Hotel Booking Engine & PMS v1.6.6
1.8.16 1.8.15 1.8.14 1.8.13 1.8.12 1.8.11 1.8.10 1.8.9 1.8.6 1.8.7 1.8.8 trunk 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.6.9 1.7.0 1.7.1 1.7.2 All 37 releases
vikbooking / libraries / html / plugins / calendar.php

calendar.php in VikBooking Hotel Booking Engine & PMS 1.6.6, at libraries/html/plugins/calendar.php

69 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * @package VikBooking - Libraries
4 * @subpackage html.plugins
5 * @author E4J s.r.l.
6 * @copyright Copyright (C) 2018 E4J s.r.l. All Rights Reserved.
7 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
8 * @link https://vikwp.com
9 */
10
11 // No direct access
12 defined('ABSPATH') or die('No script kiddies please!');
13
14 $value = !empty($displayData['value']) ? $displayData['value'] : '';
15 $name = !empty($displayData['name']) ? $displayData['name'] : uniqid();
16 $id = !empty($displayData['id']) ? $displayData['id'] : $name;
17 $class = !empty($displayData['class']) ? $displayData['class'] : '';
18 $format = !empty($displayData['format']) ? $displayData['format'] : 'Y-m-d';
19 $attr = !empty($displayData['attr']) ? $displayData['attr'] : '';
20 $showTime = !empty($displayData['showTime']) ? $displayData['showTime'] : false;
21
22 ?>
23
24 <span class="wp-calendar-box">
25
26 <input
27 type="text"
28 name="<?php echo $name; ?>"
29 id="<?php echo $id; ?>"
30 class="<?php echo $class; ?> wp-datepicker"
31 value="<?php echo $value; ?>"
32 data-value="<?php echo $value; ?>"
33 autocomplete="off"
34 <?php echo $attr; ?>
35 />
36
37 <i class="dashicons dashicons-calendar-alt"></i>
38
39 </span>
40
41 <script>
42
43 jQuery('input[name="<?php echo $name; ?>"]').on('change', function() {
44 <?php if ($showTime) { ?>
45 var curr = jQuery(this).val();
46 var prev = jQuery(this).attr('data-value');
47
48 if (!curr) {
49 // do nothing in case of empty dates
50 return;
51 }
52
53 // extract time from previous date set
54 var time = prev.match(/ (\d{1,2}:\d{1,2})$/);
55
56 // check if we have a time and the selected date doesn't
57 if (time && !curr.match(/ (\d{1,2}:\d{1,2})$/)) {
58 // append time to current date
59 curr += ' ' + time.pop();
60 }
61
62 // update previous value with current one
63 jQuery(this).attr('data-value', curr);
64 jQuery(this).val(curr);
65 <?php } ?>
66 });
67
68 </script>
69