PluginProbe
Booktics – Appointment Booking Calendar for Service Businesses / 1.0.27
Booktics – Appointment Booking Calendar for Service Businesses v1.0.27
1.0.29 1.0.28 1.0.27 1.0.26 1.0.25 1.0.24 1.0.23 1.0.22 1.0.21 1.0.20 1.0.19 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.2 1.0.3 All 31 releases
← All changes | core/admin/notification.php +221 -46 1.0.3 → 1.0.27 View file →
@@ -1,10 +1,12 @@
1 1 <?php
2 2
3 3 namespace Booktics\Admin;
4 4
5 +if ( ! defined( 'ABSPATH' ) ) exit;
6 +
5 7 use Booktics\Contracts\Hookable_Service_Contract;
6 -use ENS\Core\SDK;
8 +use Ens\Core\SDK;
7 9
8 10 class Notification implements Hookable_Service_Contract {
9 11
10 12 /**
@@ -13,8 +15,10 @@
13 15 * @return void
14 16 */
15 17 public function register() {
16 18 if ( class_exists( SDK::class ) ) {
19 + add_filter( 'notification_sdk_email_body', [ $this, 'wrap_email_body' ], 10, 1 );
20 +
17 21 SDK::get_instance()
18 22 ->setup(
19 23 array(
20 24 'plugin_name' => 'Booktics',
@@ -19,8 +23,9 @@
19 23 array(
20 24 'plugin_name' => 'Booktics',
21 25 'plugin_slug' => 'booktics',
22 26 'general_prefix' => 'bt',
27 + 'hook_prefix' => 'booktics',
23 28 'text_domain' => 'booktics',
24 29 'admin_script_handler' => 'booktics-dashboard-scripts',
25 30 'sub_menu_filter_hook' => 'booktics_menu',
26 31 'sub_menu_details' =>
@@ -34,37 +39,100 @@
34 39 )
35 40 )
36 41 ->init();
37 42
38 - add_filter(
39 - 'ens_available_actions', function ( $actions ) {
43 + add_filter(
44 + 'ens_bt_available_actions', function ( $actions ) {
45 + // Google Meet link generation is gated behind Pro (the pro plugin is what
46 + // adds the enable_google_meet field to the service model), but the tag
47 + // itself is registered here in free. Without this, a free user picks the
48 + // tag, gets an empty value in the email and reads it as a broken feature.
49 + $meet_label = booktics_is_pro_active()
50 + ? __( 'Google Meet URL', 'booktics' )
51 + : __( 'Google Meet URL (Pro)', 'booktics' );
52 +
40 53 $actions = array(
41 54 array(
42 - 'trigger_label' => 'Order Created',
55 + 'trigger_label' => __( 'Order Created', 'booktics' ),
43 56 'trigger_value' => 'order_created',
44 57 'trigger_data' => array(
45 58 array(
46 - 'label' => 'Order No',
59 + 'label' => __( 'Order No', 'booktics' ),
47 60 'value' => 'order_no',
48 61 'type' => 'string',
49 62 ),
50 63 array(
51 - 'label' => 'Order Date',
64 + 'label' => __( 'Order Status', 'booktics' ),
65 + 'value' => 'order_status',
66 + 'type' => 'string',
67 + ),
68 + array(
69 + 'label' => __( 'Order Date', 'booktics' ),
52 70 'value' => 'order_date',
53 71 'type' => 'date',
54 72 ),
55 73 array(
56 - 'label' => 'Order Total',
74 + 'label' => __( 'Service Name', 'booktics' ),
75 + 'value' => 'service_name',
76 + 'type' => 'string',
77 + ),
78 + array(
79 + 'label' => __( 'Team Name', 'booktics' ),
80 + 'value' => 'team_name',
81 + 'type' => 'string',
82 + ),
83 + array(
84 + 'label' => __( 'Appointment Date', 'booktics' ),
85 + 'value' => 'appointment_date',
86 + 'type' => 'date',
87 + ),
88 + array(
89 + 'label' => __( 'Appointment Status', 'booktics' ),
90 + 'value' => 'appointment_status',
91 + 'type' => 'string',
92 + ),
93 + array(
94 + 'label' => __( 'Start Time', 'booktics' ),
95 + 'value' => 'start_time',
96 + 'type' => 'string',
97 + ),
98 + array(
99 + 'label' => __( 'End Time', 'booktics' ),
100 + 'value' => 'end_time',
101 + 'type' => 'string',
102 + ),
103 + array(
104 + 'label' => __( 'Location Address', 'booktics' ),
105 + 'value' => 'location_address',
106 + 'type' => 'string',
107 + ),
108 + array(
109 + 'label' => __( 'Order Total', 'booktics' ),
57 110 'value' => 'order_total',
58 111 'type' => 'string',
59 112 ),
60 113 array(
61 - 'label' => 'Customer Name',
114 + 'label' => __( 'Customer Name', 'booktics' ),
62 115 'value' => 'customer_name',
63 116 'type' => 'string',
64 117 ),
65 118 array(
66 - 'label' => 'User Email',
119 + 'label' => $meet_label,
120 + 'value' => 'google_meet_url',
121 + 'type' => 'string',
122 + ),
123 + array(
124 + 'label' => __( 'Appointment Reschedule Url', 'booktics' ),
125 + 'value' => 'appointment_reschedule_url',
126 + 'type' => 'string',
127 + ),
128 + array(
129 + 'label' => __( 'Appointment Cancel Url', 'booktics' ),
130 + 'value' => 'appointment_cancel_url',
131 + 'type' => 'string',
132 + ),
133 + array(
134 + 'label' => __( 'User Email', 'booktics' ),
67 135 'value' => 'user_email',
68 136 'type' => 'string',
69 137 ),
70 138 ),
@@ -75,107 +143,121 @@
75 143 ),
76 144 ),
77 145 'email_receivers' => array(
78 146 array(
79 - 'label' => 'User Email',
147 + 'label' => __( 'User Email', 'booktics' ),
80 148 'value' => 'user_email',
81 149 ),
82 150 ),
83 151 ),
84 152 array(
85 - 'trigger_label' => 'Appointment Scheduled',
153 + 'trigger_label' => __( 'Appointment Scheduled', 'booktics' ),
86 154 'trigger_value' => 'appointment_scheduled',
87 155 'trigger_data' => array(
88 156 array(
89 - 'label' => 'Service Name',
157 + 'label' => __( 'Service Name', 'booktics' ),
90 158 'value' => 'appointment_service',
91 159 'type' => 'string',
92 160 ),
93 161 array(
94 - 'label' => 'Team Member Name',
162 + 'label' => __( 'Team Member Name', 'booktics' ),
95 163 'value' => 'appointment_team_member',
96 164 'type' => 'string',
97 165 ),
98 166 array(
99 - 'label' => 'Appointment Date',
167 + 'label' => __( 'Appointment Date', 'booktics' ),
100 168 'value' => 'appointment_date',
101 169 'type' => 'date',
102 170 ),
103 171 array(
104 - 'label' => 'Appointment Start Time',
172 + 'label' => __( 'Appointment Start Time', 'booktics' ),
105 173 'value' => 'start_time',
106 174 'type' => 'string',
107 175 ),
108 176 array(
109 - 'label' => 'Appointment Time',
177 + 'label' => __( 'Appointment Time', 'booktics' ),
110 178 'value' => 'appointment_time',
111 179 'type' => 'date',
112 180 ),
113 181 array(
114 - 'label' => 'Attendee Count',
182 + 'label' => __( 'Attendee Count', 'booktics' ),
115 183 'value' => 'attendee_count',
116 184 'type' => 'string',
117 185 ),
118 186 array(
119 - 'label' => 'Customer Name',
187 + 'label' => __( 'Customer Name', 'booktics' ),
120 188 'value' => 'customer_name',
121 189 'type' => 'string',
122 190 ),
123 191 array(
124 - 'label' => 'User Email',
192 + 'label' => __( 'User Email', 'booktics' ),
125 193 'value' => 'user_email',
126 194 'type' => 'string',
127 195 ),
196 + array(
197 + 'label' => $meet_label,
198 + 'value' => 'google_meet_url',
199 + 'type' => 'string',
200 + ),
201 + array(
202 + 'label' => __( 'Extra Services', 'booktics' ),
203 + 'value' => 'extra_services',
204 + 'type' => 'string',
205 + ),
128 206 ),
129 207 'delay_dependencies' => array(
130 208 array(
131 - 'label' => 'Appointment Time',
209 + 'label' => __( 'Appointment Time', 'booktics' ),
132 210 'value' => 'before_appointment_time',
133 211 ),
134 212 ),
135 213 'email_receivers' => array(
136 214 array(
137 - 'label' => 'User Email',
215 + 'label' => __( 'User Email', 'booktics' ),
138 216 'value' => 'user_email',
139 217 ),
218 + array(
219 + 'label' => __( 'Team Member Email', 'booktics' ),
220 + 'value' => 'appointment_team_member_email',
221 + ),
140 222 ),
141 223 ),
142 224 array(
143 - 'trigger_label' => 'Appointment Rescheduled',
225 + 'trigger_label' => __( 'Appointment Rescheduled', 'booktics' ),
144 226 'trigger_value' => 'appointment_rescheduled',
145 227 'trigger_data' => array(
146 228 array(
147 - 'label' => 'Service Name',
229 + 'label' => __( 'Service Name', 'booktics' ),
148 230 'value' => 'appointment_service',
149 231 'type' => 'string',
150 232 ),
151 233 array(
152 - 'label' => 'Date',
234 + 'label' => __( 'Date', 'booktics' ),
153 235 'value' => 'date',
154 236 'type' => 'date',
155 237 ),
156 238 array(
157 - 'label' => 'Team Member Name',
239 + 'label' => __( 'Team Member Name', 'booktics' ),
158 240 'value' => 'appointment_team_member',
159 241 'type' => 'string',
160 242 ),
161 243 array(
162 - 'label' => 'Start Time',
244 + 'label' => __( 'Start Time', 'booktics' ),
163 245 'value' => 'start_time',
164 246 'type' => 'string',
165 247 ),
166 248 array(
167 - 'label' => 'End Time',
249 + 'label' => __( 'End Time', 'booktics' ),
168 250 'value' => 'end_time',
169 251 'type' => 'string',
170 252 ),
171 253 array(
172 - 'label' => 'Customer Name',
254 + 'label' => __( 'Customer Name', 'booktics' ),
173 255 'value' => 'customer_name',
174 256 'type' => 'string',
175 257 ),
176 258 array(
177 - 'label' => 'User Email',
259 + 'label' => __( 'User Email', 'booktics' ),
178 260 'value' => 'user_email',
179 261 'type' => 'string',
180 262 ),
181 263 ),
@@ -180,55 +262,59 @@
180 262 ),
181 263 ),
182 264 'delay_dependencies' => array(
183 265 array(
184 - 'label' => 'Date',
266 + 'label' => __( 'Date', 'booktics' ),
185 267 'value' => 'date',
186 268 ),
187 269 ),
188 270 'email_receivers' => array(
189 271 array(
190 - 'label' => 'User Email',
272 + 'label' => __( 'User Email', 'booktics' ),
191 273 'value' => 'user_email',
192 274 ),
275 + array(
276 + 'label' => __( 'Team Member Email', 'booktics' ),
277 + 'value' => 'appointment_team_member_email',
278 + ),
193 279 ),
194 280 ),
195 281 array(
196 - 'trigger_label' => 'Appointment Cancelled',
282 + 'trigger_label' => __( 'Appointment Cancelled', 'booktics' ),
197 283 'trigger_value' => 'appointment_cancelled',
198 284 'trigger_data' => array(
199 285 array(
200 - 'label' => 'Service Name',
286 + 'label' => __( 'Service Name', 'booktics' ),
201 287 'value' => 'appointment_service',
202 288 'type' => 'string',
203 289 ),
204 290 array(
205 - 'label' => 'Date',
291 + 'label' => __( 'Date', 'booktics' ),
206 292 'value' => 'date',
207 293 'type' => 'date',
208 294 ),
209 295 array(
210 - 'label' => 'Team Member Name',
296 + 'label' => __( 'Team Member Name', 'booktics' ),
211 297 'value' => 'appointment_team_member',
212 298 'type' => 'string',
213 299 ),
214 300 array(
215 - 'label' => 'Start Time',
301 + 'label' => __( 'Start Time', 'booktics' ),
216 302 'value' => 'start_time',
217 303 'type' => 'string',
218 304 ),
219 305 array(
220 - 'label' => 'End Time',
306 + 'label' => __( 'End Time', 'booktics' ),
221 307 'value' => 'end_time',
222 308 'type' => 'string',
223 309 ),
224 310 array(
225 - 'label' => 'Customer Name',
311 + 'label' => __( 'Customer Name', 'booktics' ),
226 312 'value' => 'customer_name',
227 313 'type' => 'string',
228 314 ),
229 315 array(
230 - 'label' => 'User Email',
316 + 'label' => __( 'User Email', 'booktics' ),
231 317 'value' => 'user_email',
232 318 'type' => 'string',
233 319 ),
234 320 ),
@@ -233,35 +319,39 @@
233 319 ),
234 320 ),
235 321 'delay_dependencies' => array(
236 322 array(
237 - 'label' => 'Date',
323 + 'label' => __( 'Date', 'booktics' ),
238 324 'value' => 'date',
239 325 ),
240 326 ),
241 327 'email_receivers' => array(
242 328 array(
243 - 'label' => 'User Email',
329 + 'label' => __( 'User Email', 'booktics' ),
244 330 'value' => 'user_email',
245 331 ),
332 + array(
333 + 'label' => __( 'Team Member Email', 'booktics' ),
334 + 'value' => 'appointment_team_member_email',
335 + ),
246 336 ),
247 337 ),
248 338 array(
249 - 'trigger_label' => 'Team Member Created',
339 + 'trigger_label' => __( 'Team Member Created', 'booktics' ),
250 340 'trigger_value' => 'team_member_created',
251 341 'trigger_data' => array(
252 342 array(
253 - 'label' => 'Team Member Name',
343 + 'label' => __( 'Team Member Name', 'booktics' ),
254 344 'value' => 'team_member_name',
255 345 'type' => 'string',
256 346 ),
257 347 array(
258 - 'label' => 'Team Member Email',
348 + 'label' => __( 'Team Member Email', 'booktics' ),
259 349 'value' => 'team_member_email',
260 350 'type' => 'string',
261 351 ),
262 352 array(
263 - 'label' => 'Password Reset URL',
353 + 'label' => __( 'Password Reset URL', 'booktics' ),
264 354 'value' => 'password_reset_url',
265 355 'type' => 'string',
266 356 ),
267 357 ),
@@ -267,13 +357,61 @@
267 357 ),
268 358 'delay_dependencies' => array(),
269 359 'email_receivers' => array(
270 360 array(
271 - 'label' => 'Team Member Email',
361 + 'label' => __( 'Team Member Email', 'booktics' ),
272 362 'value' => 'team_member_email',
273 363 ),
274 364 ),
275 365 ),
366 + array(
367 + 'trigger_label' => __( 'Customer Created', 'booktics' ),
368 + 'trigger_value' => 'customer_created',
369 + 'trigger_data' => array(
370 + array(
371 + 'label' => __( 'Customer First Name', 'booktics' ),
372 + 'value' => 'customer_first_name',
373 + 'type' => 'string',
374 + ),
375 + array(
376 + 'label' => __( 'Customer Last Name', 'booktics' ),
377 + 'value' => 'customer_last_name',
378 + 'type' => 'string',
379 + ),
380 + array(
381 + 'label' => __( 'Customer Full Name', 'booktics' ),
382 + 'value' => 'customer_full_name',
383 + 'type' => 'string',
384 + ),
385 + array(
386 + 'label' => __( 'Customer Phone', 'booktics' ),
387 + 'value' => 'customer_phone',
388 + 'type' => 'string',
389 + ),
390 + array(
391 + 'label' => __( 'Customer User Name', 'booktics' ),
392 + 'value' => 'customer_user_name',
393 + 'type' => 'string',
394 + ),
395 + array(
396 + 'label' => __( 'Customer Email', 'booktics' ),
397 + 'value' => 'customer_email',
398 + 'type' => 'string',
399 + ),
400 + array(
401 + 'label' => __( 'Password Reset URL', 'booktics' ),
402 + 'value' => 'password_reset_url',
403 + 'type' => 'string',
404 + ),
405 + ),
406 + 'delay_dependencies' => array(),
407 + 'email_receivers' => array(
408 + array(
409 + 'label' => __( 'Customer Email', 'booktics' ),
410 + 'value' => 'customer_email',
411 + ),
412 + ),
413 + ),
276 414 );
277 415
278 416 return $actions;
279 417 }
@@ -278,6 +416,43 @@
278 416 return $actions;
279 417 }
280 418 );
281 419 }
420 + }
421 +
422 + /**
423 + * Wrap email body with custom template
424 + *
425 + * @param string $message
426 + * @return string
427 + */
428 + public function wrap_email_body( $message ) {
429 +
430 + $template_path = BOOKTICS_DIR . '/templates/email/team-member-create.html';
431 +
432 + if ( ! file_exists( $template_path ) ) {
433 + return $message;
434 + }
435 + $template = file_get_contents( $template_path );
436 + $default_image = get_template_directory_uri() . '/assets/images/placeholder.jpg';
437 + $plugin_name = apply_filters(
438 + 'booktics_plugin_name',
439 + BOOKTICS_PLUGIN_NAME
440 + );
441 + $show_powered_by = apply_filters( 'booktics_show_email_powered_by', true );
442 +
443 + // Build powered-by HTML if enabled
444 + $powered_by_html = '';
445 + if ( $show_powered_by ) {
446 + $powered_by_html = '<p class="bkt-powered-by">Powered by ' . esc_html( $plugin_name ) . '</p>';
447 + }
448 + $variables = array(
449 + '{{MESSAGE}}' => wp_kses_post( $message ),
450 + '{{COMPANY_NAME}}' => booktics_get_option( 'business_name', get_bloginfo( 'name' ) ),
451 + '{{COMPANY_LOGO}}' => booktics_get_option( 'business_logo', $default_image ),
452 + '{{COMPANY_ADDRESS}}' => booktics_get_option( 'business_address', 'California, USA' ),
453 + '{%powered_by_section%}' => $powered_by_html,
454 + );
455 +
456 + return str_replace( array_keys( $variables ), array_values( $variables ), $template );
282 457 }
283 458 }