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

85 lines 2.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
32 /**
33 * booking form for frontend
34 *
35 * @return void
36 */
37 public function booking_form($attribute) {
38 wp_enqueue_style('timetics-vendor');
39 wp_enqueue_style('timetics-frontend');
40 wp_enqueue_script('timetics-antd-scripts');
41 wp_enqueue_script('timetics-flatpickr-scripts');
42 wp_enqueue_script('timetics-frontend-scripts');
43
44 $id = isset($attribute['id']) ? $attribute['id'] : '';
45 $data_controls = [
46 'id'=>$id,
47 ];
48 $controls = json_encode( $data_controls );
49
50 ob_start();
51 ?>
52 <div class="timetics-shortcode-wrapper">
53 <div class="timetics-single-booking-wrapper" data-controls="<?php echo esc_attr( $controls ); ?>" > </div>
54 </div>
55 <?php
56 return ob_get_clean();
57 }
58
59 /**
60 * booking form for frontend
61 *
62 * @return void
63 */
64 public function meeting_list($attribute) {
65 wp_enqueue_style('timetics-vendor');
66 wp_enqueue_style('timetics-frontend');
67
68 $limit = isset($attribute['limit']) ? $attribute['limit'] : '';
69
70 ob_start();
71 ?>
72 <div class="timetics-shortcode-wrapper">
73 <div class="timetics-meeting-list-wrapper">
74 <?php
75 if (file_exists(TIMETICS_PLUGIN_DIR . 'core/frontend/templates/meeting-list.php')){
76 require_once TIMETICS_PLUGIN_DIR . 'core/frontend/templates/meeting-list.php';
77 }
78 ?>
79 </div>
80 </div>
81 <?php
82 return ob_get_clean();
83 }
84 }
85