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

148 lines 4.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 if ( class_exists( 'Wpeventin' ) ) {
35 add_action( 'init', [ $this, 'eventin_seat_plan' ] );
36 }
37 }
38
39 /**
40 * booking form for frontend
41 *
42 * @return void
43 */
44 public function booking_form( $attribute ) {
45 wp_enqueue_style( 'timetics-vendor' );
46 wp_enqueue_style( 'timetics-frontend' );
47 wp_enqueue_script( 'timetics-antd-scripts' );
48 wp_enqueue_script( 'timetics-flatpickr-scripts' );
49 wp_enqueue_script( 'timetics-frontend-scripts' );
50 wp_enqueue_script( 'calendar-locale' );
51
52 $id = isset( $attribute['id'] ) ? $attribute['id'] : '';
53 $data_controls = [
54 'id' => $id,
55 ];
56 $controls = json_encode( $data_controls );
57
58 ob_start();
59 ?>
60 <div class="timetics-shortcode-wrapper">
61 <div class="timetics-single-booking-wrapper"
62 data-controls="<?php echo esc_attr( $controls ); ?>"></div>
63 </div>
64 <?php
65 return ob_get_clean();
66 }
67 /**
68 * user dashboard for frontend
69 *
70 * @return void
71 */
72 public function user_dashboard( $attribute ) {
73 wp_enqueue_style( 'timetics-vendor' );
74 wp_enqueue_style( 'timetics-frontend' );
75 wp_enqueue_script( 'timetics-antd-scripts' );
76 wp_enqueue_script( 'timetics-frontend-scripts' );
77
78 $id = get_current_user_id();
79 $data_controls = [
80 'id' => $id,
81 ];
82 $controls = json_encode( $data_controls );
83
84 ob_start();
85 if (is_user_logged_in()) {
86
87 ?>
88 <div class="timetics-shortcode-wrapper">
89 <div class="timetics-user-dashboard-wrapper"
90 data-controls="<?php echo esc_attr( $controls ); ?>">
91 </div>
92 </div>
93 <?php
94
95 }else{
96 ?>
97 <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>
99 </div>
100 <?php
101 }
102 return ob_get_clean();
103
104 }
105
106 public function eventin_seat_plan() {
107 wp_enqueue_style( 'timetics-vendor' );
108 wp_enqueue_style( 'timetics-frontend' );
109 wp_enqueue_script( 'timetics-antd-scripts' );
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-antd-scripts' );
123 wp_enqueue_script( 'timetics-flatpickr-scripts' );
124 wp_enqueue_script( 'timetics-frontend-scripts' );
125 wp_enqueue_script( 'calendar-locale' );
126 wp_enqueue_script( 'jquery' );
127
128 wp_enqueue_script( 'timetics-meeting-filtering', TIMETICS_ASSETS_URL . 'js/meeting-filter.js', ['jquery'], time() );
129
130 $limit = isset( $attribute['limit'] ) ? $attribute['limit'] : '';
131 $show_filter = isset( $attribute['show_filter'] ) && 'true' == $attribute['show_filter'] ? $attribute['show_filter'] : false;
132
133 ob_start();
134 ?>
135 <div class="timetics-shortcode-wrapper">
136 <div class="timetics-meeting-list-wrapper">
137 <?php
138 if ( file_exists( TIMETICS_PLUGIN_DIR . 'core/frontend/templates/meeting-list.php' ) ) {
139 require_once TIMETICS_PLUGIN_DIR . 'core/frontend/templates/meeting-list.php';
140 }
141 ?>
142 </div>
143 </div>
144 <?php
145 return ob_get_clean();
146 }
147 }
148