PluginProbe
Timetics – Appointment Booking Calendar & Scheduling / 1.0.24
Timetics – Appointment Booking Calendar & Scheduling v1.0.24
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.24, at core/frontend/shortcode.php

175 lines 5.2 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-flatpickr-scripts' );
51 wp_enqueue_script( 'timetics-frontend-scripts' );
52 wp_enqueue_script( 'calendar-locale' );
53
54 $id = isset( $attribute['id'] ) ? $attribute['id'] : '';
55 $data_controls = [
56 'id' => $id,
57 ];
58 $controls = json_encode( $data_controls );
59
60 ob_start();
61 ?>
62 <div class="timetics-shortcode-wrapper">
63 <div class="timetics-single-booking-wrapper"
64 data-controls="<?php echo esc_attr( $controls ); ?>"></div>
65 </div>
66 <?php
67 return ob_get_clean();
68 }
69 /**
70 * user dashboard for frontend
71 *
72 * @return void
73 */
74 public function user_dashboard( $attribute ) {
75 wp_enqueue_style( 'timetics-vendor' );
76 wp_enqueue_style( 'timetics-frontend' );
77 wp_enqueue_script( 'timetics-frontend-scripts' );
78
79 $id = get_current_user_id();
80 $data_controls = [
81 'id' => $id,
82 ];
83 $controls = json_encode( $data_controls );
84
85 ob_start();
86 if (is_user_logged_in()) {
87
88 ?>
89 <div class="timetics-shortcode-wrapper">
90 <div class="timetics-user-dashboard-wrapper"
91 data-controls="<?php echo esc_attr( $controls ); ?>">
92 </div>
93 </div>
94 <?php
95
96 }else{
97 ?>
98 <div class="timetics-userdashbaord-wrapper">
99 <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>
100 </div>
101 <?php
102 }
103 return ob_get_clean();
104
105 }
106
107 public function eventin_seat_plan() {
108 wp_enqueue_style( 'timetics-vendor' );
109 wp_enqueue_style( 'timetics-frontend' );
110 wp_enqueue_script( 'timetics-flatpickr-scripts' );
111 wp_enqueue_script( 'timetics-frontend-scripts' );
112 }
113
114 /**
115 * booking form for frontend
116 *
117 * @return void
118 */
119 public function meeting_list( $attribute ) {
120 wp_enqueue_style( 'timetics-vendor' );
121 wp_enqueue_style( 'timetics-frontend' );
122 wp_enqueue_script( 'timetics-flatpickr-scripts' );
123 wp_enqueue_script( 'timetics-frontend-scripts' );
124 wp_enqueue_script( 'calendar-locale' );
125 wp_enqueue_script( 'jquery' );
126
127 wp_enqueue_script( 'timetics-meeting-filtering', TIMETICS_ASSETS_URL . 'js/meeting-filter.js', ['jquery'], time() );
128
129 $limit = isset( $attribute['limit'] ) ? $attribute['limit'] : '';
130 $show_filter = isset( $attribute['show_filter'] ) && 'true' == $attribute['show_filter'] ? $attribute['show_filter'] : false;
131
132 ob_start();
133 ?>
134 <div class="timetics-shortcode-wrapper">
135 <div class="timetics-meeting-list-wrapper">
136 <?php
137 if ( file_exists( TIMETICS_PLUGIN_DIR . 'core/frontend/templates/meeting-list.php' ) ) {
138 require_once TIMETICS_PLUGIN_DIR . 'core/frontend/templates/meeting-list.php';
139 }
140 ?>
141 </div>
142 </div>
143 <?php
144 return ob_get_clean();
145 }
146
147 /**
148 * category wise meeting for frontend
149 *
150 * @return void
151 */
152 public function category_meetings( $attribute ) {
153 wp_enqueue_style( 'timetics-vendor' );
154 wp_enqueue_style( 'timetics-frontend' );
155 wp_enqueue_script( 'timetics-flatpickr-scripts' );
156 wp_enqueue_script( 'timetics-frontend-scripts' );
157 wp_enqueue_script( 'calendar-locale' );
158
159 $id = isset( $attribute['id'] ) ? $attribute['id'] : '';
160 $data_controls = [
161 'id' => $id,
162 ];
163 $controls = json_encode( $data_controls );
164
165 ob_start();
166 ?>
167 <div class="timetics-shortcode-wrapper">
168 <div class="timetics-category-wrapper"
169 data-controls="<?php echo esc_attr( $controls ); ?>"></div>
170 </div>
171 <?php
172 return ob_get_clean();
173 }
174 }
175