PluginProbe
Timetics – Appointment Booking Calendar & Scheduling / 1.0.21
Timetics – Appointment Booking Calendar & Scheduling v1.0.21
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 1.0.22 1.0.23 1.0.24 All 62 releases
timetics / core / frontend / shortcode.php

shortcode.php in Timetics – Appointment Booking Calendar & Scheduling 1.0.21, at core/frontend/shortcode.php

180 lines 5.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Shortcode class
4 *
5 * @package Timetics
6 */
7
8 namespace Timetics\Core\Frontend;
9
10 use Timetics\Utils\Singleton;
11 use Timetics;
12
13 /**
14 * Class Shortcode
15 */
16 class Shortcode {
17 use Singleton;
18
19 /**
20 * Initialize the shortcode class
21 *
22 * @return void
23 */
24 public function init() {
25 // [timetics-booking-form id='']
26 add_shortcode( 'timetics-booking-form', [ $this, 'booking_form' ] );
27
28 // [timetics-meeting-list limit='']
29 add_shortcode( 'timetics-meeting-list', [ $this, 'meeting_list' ] );
30
31 // [timetics-user-dashboard]
32 add_shortcode( 'timetics-user-dashboard', [ $this, 'user_dashboard' ] );
33
34 // [timetics-category id='']
35 add_shortcode( 'timetics-category', [ $this, 'category_meetings' ] );
36
37 if ( class_exists( 'Wpeventin' ) ) {
38 add_action( 'init', [ $this, 'eventin_seat_plan' ] );
39 }
40 }
41
42 /**
43 * booking form for frontend
44 *
45 * @return void
46 */
47 public function booking_form( $attribute ) {
48 wp_enqueue_style( 'timetics-vendor' );
49 wp_enqueue_style( 'timetics-frontend' );
50 wp_enqueue_script( 'timetics-antd-scripts' );
51 wp_enqueue_script( 'timetics-flatpickr-scripts' );
52 wp_enqueue_script( 'timetics-frontend-scripts' );
53 wp_enqueue_script( 'calendar-locale' );
54
55 $id = isset( $attribute['id'] ) ? $attribute['id'] : '';
56 $data_controls = [
57 'id' => $id,
58 ];
59 $controls = json_encode( $data_controls );
60
61 ob_start();
62 ?>
63 <div class="timetics-shortcode-wrapper">
64 <div class="timetics-single-booking-wrapper"
65 data-controls="<?php echo esc_attr( $controls ); ?>"></div>
66 </div>
67 <?php
68 return ob_get_clean();
69 }
70 /**
71 * user dashboard for frontend
72 *
73 * @return void
74 */
75 public function user_dashboard( $attribute ) {
76 wp_enqueue_style( 'timetics-vendor' );
77 wp_enqueue_style( 'timetics-frontend' );
78 wp_enqueue_script( 'timetics-antd-scripts' );
79 wp_enqueue_script( 'timetics-frontend-scripts' );
80
81 $id = get_current_user_id();
82 $data_controls = [
83 'id' => $id,
84 ];
85 $controls = json_encode( $data_controls );
86
87 ob_start();
88 if (is_user_logged_in()) {
89
90 ?>
91 <div class="timetics-shortcode-wrapper">
92 <div class="timetics-user-dashboard-wrapper"
93 data-controls="<?php echo esc_attr( $controls ); ?>">
94 </div>
95 </div>
96 <?php
97
98 }else{
99 ?>
100 <div class="timetics-userdashbaord-wrapper">
101 <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>
102 </div>
103 <?php
104 }
105 return ob_get_clean();
106
107 }
108
109 public function eventin_seat_plan() {
110 wp_enqueue_style( 'timetics-vendor' );
111 wp_enqueue_style( 'timetics-frontend' );
112 wp_enqueue_script( 'timetics-antd-scripts' );
113 wp_enqueue_script( 'timetics-flatpickr-scripts' );
114 wp_enqueue_script( 'timetics-frontend-scripts' );
115 }
116
117 /**
118 * booking form for frontend
119 *
120 * @return void
121 */
122 public function meeting_list( $attribute ) {
123 wp_enqueue_style( 'timetics-vendor' );
124 wp_enqueue_style( 'timetics-frontend' );
125 wp_enqueue_script( 'timetics-antd-scripts' );
126 wp_enqueue_script( 'timetics-flatpickr-scripts' );
127 wp_enqueue_script( 'timetics-frontend-scripts' );
128 wp_enqueue_script( 'calendar-locale' );
129 wp_enqueue_script( 'jquery' );
130
131 wp_enqueue_script( 'timetics-meeting-filtering', TIMETICS_ASSETS_URL . 'js/meeting-filter.js', ['jquery'], time() );
132
133 $limit = isset( $attribute['limit'] ) ? $attribute['limit'] : '';
134 $show_filter = isset( $attribute['show_filter'] ) && 'true' == $attribute['show_filter'] ? $attribute['show_filter'] : false;
135
136 ob_start();
137 ?>
138 <div class="timetics-shortcode-wrapper">
139 <div class="timetics-meeting-list-wrapper">
140 <?php
141 if ( file_exists( TIMETICS_PLUGIN_DIR . 'core/frontend/templates/meeting-list.php' ) ) {
142 require_once TIMETICS_PLUGIN_DIR . 'core/frontend/templates/meeting-list.php';
143 }
144 ?>
145 </div>
146 </div>
147 <?php
148 return ob_get_clean();
149 }
150
151 /**
152 * category wise meeting for frontend
153 *
154 * @return void
155 */
156 public function category_meetings( $attribute ) {
157 wp_enqueue_style( 'timetics-vendor' );
158 wp_enqueue_style( 'timetics-frontend' );
159 wp_enqueue_script( 'timetics-antd-scripts' );
160 wp_enqueue_script( 'timetics-flatpickr-scripts' );
161 wp_enqueue_script( 'timetics-frontend-scripts' );
162 wp_enqueue_script( 'calendar-locale' );
163
164 $id = isset( $attribute['id'] ) ? $attribute['id'] : '';
165 $data_controls = [
166 'id' => $id,
167 ];
168 $controls = json_encode( $data_controls );
169
170 ob_start();
171 ?>
172 <div class="timetics-shortcode-wrapper">
173 <div class="timetics-category-wrapper"
174 data-controls="<?php echo esc_attr( $controls ); ?>"></div>
175 </div>
176 <?php
177 return ob_get_clean();
178 }
179 }
180