PluginProbe
Timetics – Appointment Booking Calendar & Scheduling / 1.0.64
Timetics – Appointment Booking Calendar & Scheduling v1.0.64
1.0.64 1.0.62 1.0.63 1.0.61 1.0.60 1.0.59 1.0.58 1.0.57 1.0.56 trunk 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 1.0.17 1.0.18 1.0.19 1.0.2 1.0.20 1.0.21 All 65 releases
← All changes | core/frontend/shortcode.php +46 -10 1.0.11 → 1.0.64 View file →
@@ -6,8 +6,10 @@
6 6 */
7 7
8 8 namespace Timetics\Core\Frontend;
9 9
10 +defined( 'ABSPATH' ) || exit;
11 +
10 12 use Timetics\Utils\Singleton;
11 13 use Timetics;
12 14
13 15 /**
@@ -30,8 +32,11 @@
30 32
31 33 // [timetics-user-dashboard]
32 34 add_shortcode( 'timetics-user-dashboard', [ $this, 'user_dashboard' ] );
33 35
36 + // [timetics-category id='']
37 + add_shortcode( 'timetics-category', [ $this, 'category_meetings' ] );
38 +
34 39 if ( class_exists( 'Wpeventin' ) ) {
35 40 add_action( 'init', [ $this, 'eventin_seat_plan' ] );
36 41 }
37 42 }
@@ -43,9 +48,8 @@
43 48 */
44 49 public function booking_form( $attribute ) {
45 50 wp_enqueue_style( 'timetics-vendor' );
46 51 wp_enqueue_style( 'timetics-frontend' );
47 - wp_enqueue_script( 'timetics-antd-scripts' );
48 52 wp_enqueue_script( 'timetics-flatpickr-scripts' );
49 53 wp_enqueue_script( 'timetics-frontend-scripts' );
50 54 wp_enqueue_script( 'calendar-locale' );
51 55
@@ -52,10 +56,17 @@
52 56 $id = isset( $attribute['id'] ) ? $attribute['id'] : '';
53 57 $data_controls = [
54 58 'id' => $id,
55 59 ];
56 - $controls = json_encode( $data_controls );
60 + $controls = wp_json_encode( $data_controls );
57 61
62 + $visibility = get_post_meta( $id, '_tt_apointment_visibility', true );
63 + $is_visible = 'enabled' === $visibility;
64 +
65 + if ( ! $is_visible && ! current_user_can( 'manage_options' ) ) {
66 + return '<div class="timetics-shortcode-wrapper"><p>' . esc_html__( 'This booking form is not available.', 'timetics' ) . '</p></div>';
67 + }
68 +
58 69 ob_start();
59 70 ?>
60 71 <div class="timetics-shortcode-wrapper">
61 72 <div class="timetics-single-booking-wrapper"
@@ -71,9 +82,8 @@
71 82 */
72 83 public function user_dashboard( $attribute ) {
73 84 wp_enqueue_style( 'timetics-vendor' );
74 85 wp_enqueue_style( 'timetics-frontend' );
75 - wp_enqueue_script( 'timetics-antd-scripts' );
76 86 wp_enqueue_script( 'timetics-frontend-scripts' );
77 87
78 88 $id = get_current_user_id();
79 89 $data_controls = [
@@ -78,9 +88,9 @@
78 88 $id = get_current_user_id();
79 89 $data_controls = [
80 90 'id' => $id,
81 91 ];
82 - $controls = json_encode( $data_controls );
92 + $controls = wp_json_encode( $data_controls );
83 93
84 94 ob_start();
85 95 if (is_user_logged_in()) {
86 96
@@ -94,9 +104,9 @@
94 104
95 105 }else{
96 106 ?>
97 107 <div class="timetics-userdashbaord-wrapper">
98 - <h3> <?php esc_html_e( 'You are not logged in', 'timetics' ); ?> <a href="<?php echo esc_url(wp_login_url()) ?>"><?php esc_html_e( 'Login', 'timetics' ); ?></a></h3>
108 + <h3> <?php esc_html_e( 'You are not logged in', 'timetics' ); ?> <a href="<?php echo esc_url( wp_login_url( get_permalink() ) ); ?>"><?php esc_html_e( 'Login', 'timetics' ); ?></a></h3>
99 109 </div>
100 110 <?php
101 111 }
102 112 return ob_get_clean();
@@ -105,9 +115,8 @@
105 115
106 116 public function eventin_seat_plan() {
107 117 wp_enqueue_style( 'timetics-vendor' );
108 118 wp_enqueue_style( 'timetics-frontend' );
109 - wp_enqueue_script( 'timetics-antd-scripts' );
110 119 wp_enqueue_script( 'timetics-flatpickr-scripts' );
111 120 wp_enqueue_script( 'timetics-frontend-scripts' );
112 121 }
113 122
@@ -118,18 +127,17 @@
118 127 */
119 128 public function meeting_list( $attribute ) {
120 129 wp_enqueue_style( 'timetics-vendor' );
121 130 wp_enqueue_style( 'timetics-frontend' );
122 - wp_enqueue_script( 'timetics-antd-scripts' );
123 131 wp_enqueue_script( 'timetics-flatpickr-scripts' );
124 132 wp_enqueue_script( 'timetics-frontend-scripts' );
125 133 wp_enqueue_script( 'calendar-locale' );
126 134 wp_enqueue_script( 'jquery' );
127 135
128 - wp_enqueue_script( 'timetics-meeting-filtering', TIMETICS_ASSETS_URL . 'js/meeting-filter.js', ['jquery'], time() );
136 + wp_enqueue_script( 'timetics-meeting-filtering', TIMETICS_ASSETS_URL . 'js/meeting-filter.js', ['jquery'], time(), true );
129 137
130 - $limit = isset( $attribute['limit'] ) ? $attribute['limit'] : '';
131 - $show_filter = isset( $attribute['show_filter'] ) && 'true' == $attribute['show_filter'] ? $attribute['show_filter'] : false;
138 + $timetics_limit = isset( $attribute['limit'] ) ? $attribute['limit'] : '';
139 + $timetics_show_filter = isset( $attribute['show_filter'] ) && 'true' == $attribute['show_filter'] ? $attribute['show_filter'] : false;
132 140
133 141 ob_start();
134 142 ?>
135 143 <div class="timetics-shortcode-wrapper">
@@ -139,8 +147,36 @@
139 147 require_once TIMETICS_PLUGIN_DIR . 'core/frontend/templates/meeting-list.php';
140 148 }
141 149 ?>
142 150 </div>
151 + </div>
152 + <?php
153 + return ob_get_clean();
154 + }
155 +
156 + /**
157 + * category wise meeting for frontend
158 + *
159 + * @return void
160 + */
161 + public function category_meetings( $attribute ) {
162 + wp_enqueue_style( 'timetics-vendor' );
163 + wp_enqueue_style( 'timetics-frontend' );
164 + wp_enqueue_script( 'timetics-flatpickr-scripts' );
165 + wp_enqueue_script( 'timetics-frontend-scripts' );
166 + wp_enqueue_script( 'calendar-locale' );
167 +
168 + $id = isset( $attribute['id'] ) ? $attribute['id'] : '';
169 + $data_controls = [
170 + 'id' => $id,
171 + ];
172 + $controls = wp_json_encode( $data_controls );
173 +
174 + ob_start();
175 + ?>
176 + <div class="timetics-shortcode-wrapper">
177 + <div class="timetics-category-wrapper"
178 + data-controls="<?php echo esc_attr( $controls ); ?>"></div>
143 179 </div>
144 180 <?php
145 181 return ob_get_clean();
146 182 }