PluginProbe ʕ •ᴥ•ʔ
Appointment Booking Plugin – LatePoint | Calendar & Scheduling for WordPress / 5.1.1
Appointment Booking Plugin – LatePoint | Calendar & Scheduling for WordPress v5.1.1
5.6.9 5.6.8 5.6.7 5.6.6 5.6.5 5.6.4 5.6.3 5.6.2 5.6.1 5.6.0 5.5.2 5.5.1 5.5.0 5.4.2 trunk 5.1.0 5.1.1 5.1.2 5.1.3 5.1.4 5.1.5 5.1.6 5.1.7 5.1.8 5.1.9 5.1.91 5.1.92 5.1.93 5.1.94 5.2.0 5.2.1 5.2.10 5.2.11 5.2.2 5.2.3 5.2.4 5.2.5 5.2.6 5.2.7 5.2.8 5.2.9 5.3.0 5.3.1 5.3.2 5.4.0 5.4.1
latepoint / latepoint.php
latepoint Last commit date
blocks 1 year ago languages 1 year ago lib 1 year ago public 1 year ago .gitignore 1 year ago _webpack.config.js 1 year ago api-cheat-sheet.txt 1 year ago config.codekit3 1 year ago latepoint.php 1 year ago package-lock.json 1 year ago package.json 1 year ago prepros.config 1 year ago readme.txt 1 year ago
latepoint.php
1466 lines
1 <?php
2 /**
3 * Plugin Name: LatePoint
4 * Description: Appointment Scheduling Software for WordPress
5 * Version: 5.1.1
6 * Author: LatePoint
7 * Author URI: http://latepoint.com
8 * Text Domain: latepoint
9 * Domain Path: /languages
10 * License: GPLv3
11 */
12
13 if ( ! defined( 'ABSPATH' ) ) {
14 exit; // Exit if accessed directly.
15 }
16
17
18 if ( ! class_exists( 'LatePoint' ) ) :
19
20 /**
21 * Main LatePoint Class.
22 *
23 */
24
25 final class LatePoint {
26
27 /**
28 * LatePoint version.
29 *
30 */
31 public $version = '5.1.1';
32 public $db_version = '2.1.5';
33
34
35 /**
36 * LatePoint Constructor.
37 */
38 public function __construct() {
39
40 $this->define_constants();
41 $this->includes();
42 $this->init_hooks();
43 OsDatabaseHelper::check_db_version();
44 OsDatabaseHelper::check_db_version_for_addons();
45
46
47 $GLOBALS['latepoint_settings'] = new OsSettingsHelper();
48
49 }
50
51
52 /**
53 * Define constant if not already set.
54 *
55 */
56 public function define( $name, $value ) {
57 if ( ! defined( $name ) ) {
58 define( $name, $value );
59 }
60 }
61
62
63 /**
64 * Get the plugin url. *has trailing slash
65 * @return string
66 */
67 public static function plugin_url() {
68 return plugin_dir_url( __FILE__ );
69 }
70
71 public static function public_javascripts() {
72 return plugin_dir_url( __FILE__ ) . 'public/javascripts/';
73 }
74
75 public static function public_vendor_javascripts() {
76 return plugin_dir_url( __FILE__ ) . 'public/javascripts/vendor/';
77 }
78
79 public static function public_stylesheets() {
80 return plugin_dir_url( __FILE__ ) . 'public/stylesheets/';
81 }
82
83 public static function blocks_build_url() {
84 return plugin_dir_url( __FILE__ ) . 'blocks/build/';
85 }
86
87 public static function node_modules_url() {
88 return plugin_dir_url( __FILE__ ) . 'node_modules/';
89 }
90
91 public static function vendor_assets_url() {
92 return plugin_dir_url( __FILE__ ) . 'vendor/';
93 }
94
95 public static function images_url() {
96 return plugin_dir_url( __FILE__ ) . 'public/images/';
97 }
98
99 /**
100 * Get the plugin path.
101 * @return string
102 */
103 public static function plugin_path() {
104 return plugin_dir_path( __FILE__ );
105 }
106
107
108 /**
109 * Define LatePoint Constants.
110 */
111 public function define_constants() {
112 $upload_dir = wp_upload_dir();
113
114 // ENVIRONMENTS TYPES
115 if ( ! defined( 'LATEPOINT_ENV_LIVE' ) ) {
116 define( 'LATEPOINT_ENV_LIVE', 'live' );
117 }
118 if ( ! defined( 'LATEPOINT_ENV_DEMO' ) ) {
119 define( 'LATEPOINT_ENV_DEMO', 'demo' );
120 }
121 if ( ! defined( 'LATEPOINT_ENV_DEV' ) ) {
122 define( 'LATEPOINT_ENV_DEV', 'dev' );
123 }
124
125 // PAYMENT ENVIRONMENTS TYPES
126 if ( ! defined( 'LATEPOINT_PAYMENTS_ENV_LIVE' ) ) {
127 define( 'LATEPOINT_PAYMENTS_ENV_LIVE', 'live' );
128 }
129 if ( ! defined( 'LATEPOINT_PAYMENTS_ENV_DEMO' ) ) {
130 define( 'LATEPOINT_PAYMENTS_ENV_DEMO', 'demo' );
131 }
132 if ( ! defined( 'LATEPOINT_PAYMENTS_ENV_DEV' ) ) {
133 define( 'LATEPOINT_PAYMENTS_ENV_DEV', 'dev' );
134 }
135
136
137 if ( ! defined( 'LATEPOINT_PAYMENTS_DEV_SUFFIX' ) ) {
138 define( 'LATEPOINT_PAYMENTS_DEV_SUFFIX', '_dev' );
139 }
140
141 if ( ! defined( 'LATEPOINT_ENV' ) ) {
142 define( 'LATEPOINT_ENV', LATEPOINT_ENV_LIVE );
143 }
144 if ( ! defined( 'LATEPOINT_ALLOW_LOCAL_SERVER' ) ) {
145 define( 'LATEPOINT_ALLOW_LOCAL_SERVER', true );
146 }
147
148 if ( ! defined( 'LATEPOINT_ALLOW_SMS' ) ) {
149 define( 'LATEPOINT_ALLOW_SMS', true );
150 }
151 if ( ! defined( 'LATEPOINT_ALLOW_EMAILS' ) ) {
152 define( 'LATEPOINT_ALLOW_EMAILS', true );
153 }
154
155 if ( ! defined( 'LATEPOINT_PLUGIN_FILE' ) ) {
156 define( 'LATEPOINT_PLUGIN_FILE', __FILE__ );
157 }
158 if ( ! defined( 'LATEPOINT_STYLESHEETS_URL' ) ) {
159 define( 'LATEPOINT_STYLESHEETS_URL', $this->public_stylesheets() );
160 }
161 if ( ! defined( 'LATEPOINT_BLOCKS_BUILD_URL' ) ) {
162 define( 'LATEPOINT_BLOCKS_BUILD_URL', $this->blocks_build_url() );
163 }
164 if ( ! defined( 'LATEPOINT_ABSPATH' ) ) {
165 define( 'LATEPOINT_ABSPATH', dirname( __FILE__ ) . '/' );
166 }
167 if ( ! defined( 'LATEPOINT_LIB_ABSPATH' ) ) {
168 define( 'LATEPOINT_LIB_ABSPATH', LATEPOINT_ABSPATH . 'lib/' );
169 }
170 if ( ! defined( 'LATEPOINT_CONFIG_ABSPATH' ) ) {
171 define( 'LATEPOINT_CONFIG_ABSPATH', LATEPOINT_LIB_ABSPATH . 'config/' );
172 }
173 if ( ! defined( 'LATEPOINT_BLOCKS_ABSPATH' ) ) {
174 define( 'LATEPOINT_BLOCKS_ABSPATH', LATEPOINT_ABSPATH . 'blocks/build/' );
175 }
176 if ( ! defined( 'LATEPOINT_BOWER_ABSPATH' ) ) {
177 define( 'LATEPOINT_BOWER_ABSPATH', LATEPOINT_ABSPATH . 'vendor/bower_components/' );
178 }
179 if ( ! defined( 'LATEPOINT_VIEWS_ABSPATH' ) ) {
180 define( 'LATEPOINT_VIEWS_ABSPATH', LATEPOINT_LIB_ABSPATH . 'views/' );
181 }
182 if ( ! defined( 'LATEPOINT_VIEWS_ABSPATH_SHARED' ) ) {
183 define( 'LATEPOINT_VIEWS_ABSPATH_SHARED', LATEPOINT_LIB_ABSPATH . 'views/shared/' );
184 }
185 if ( ! defined( 'LATEPOINT_VIEWS_MAILERS_ABSPATH' ) ) {
186 define( 'LATEPOINT_VIEWS_MAILERS_ABSPATH', LATEPOINT_VIEWS_ABSPATH . 'mailers/' );
187 }
188 if ( ! defined( 'LATEPOINT_VIEWS_LAYOUTS_ABSPATH' ) ) {
189 define( 'LATEPOINT_VIEWS_LAYOUTS_ABSPATH', LATEPOINT_VIEWS_ABSPATH . 'layouts/' );
190 }
191 if ( ! defined( 'LATEPOINT_VIEWS_PARTIALS_ABSPATH' ) ) {
192 define( 'LATEPOINT_VIEWS_PARTIALS_ABSPATH', LATEPOINT_VIEWS_ABSPATH . 'partials/' );
193 }
194 if ( ! defined( 'LATEPOINT_PLUGIN_BASENAME' ) ) {
195 define( 'LATEPOINT_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
196 }
197
198 if ( ! defined( 'LATEPOINT_PLUGIN_URL' ) ) {
199 define( 'LATEPOINT_PLUGIN_URL', $this->plugin_url() );
200 }
201 if ( ! defined( 'LATEPOINT_LIB_URL' ) ) {
202 define( 'LATEPOINT_LIB_URL', LATEPOINT_PLUGIN_URL . 'lib/' );
203 }
204 if ( ! defined( 'LATEPOINT_PUBLIC_URL' ) ) {
205 define( 'LATEPOINT_PUBLIC_URL', LATEPOINT_PLUGIN_URL . 'public/' );
206 }
207 if ( ! defined( 'LATEPOINT_IMAGES_URL' ) ) {
208 define( 'LATEPOINT_IMAGES_URL', LATEPOINT_PUBLIC_URL . 'images/' );
209 }
210 if ( ! defined( 'LATEPOINT_DEFAULT_AVATAR_URL' ) ) {
211 define( 'LATEPOINT_DEFAULT_AVATAR_URL', LATEPOINT_IMAGES_URL . 'default-avatar.jpg' );
212 }
213 if ( ! defined( 'LATEPOINT_MARKETPLACE' ) ) {
214 define( 'LATEPOINT_MARKETPLACE', 'codecanyon' );
215 }
216 if ( ! defined( 'LATEPOINT_REMOTE_HASH' ) ) {
217 define( 'LATEPOINT_REMOTE_HASH', 'aHR0cHM6Ly9sYXRlcG9pbnQuY29t' );
218 }
219
220 // role to assigne WP user to so they are connected to a LatePoint backend user type (agent or manager)
221 if ( ! defined( 'LATEPOINT_WP_ADMIN_ROLE' ) ) {
222 define( 'LATEPOINT_WP_ADMIN_ROLE', 'administrator' );
223 }
224 if ( ! defined( 'LATEPOINT_WP_AGENT_ROLE' ) ) {
225 define( 'LATEPOINT_WP_AGENT_ROLE', 'latepoint_agent' );
226 }
227 if ( ! defined( 'LATEPOINT_WP_MANAGER_ROLE' ) ) {
228 define( 'LATEPOINT_WP_MANAGER_ROLE', 'latepoint_manager' );
229 }
230
231 if ( ! defined( 'LATEPOINT_USER_TYPE_ADMIN' ) ) {
232 define( 'LATEPOINT_USER_TYPE_ADMIN', 'admin' );
233 }
234 if ( ! defined( 'LATEPOINT_USER_TYPE_AGENT' ) ) {
235 define( 'LATEPOINT_USER_TYPE_AGENT', 'agent' );
236 }
237 if ( ! defined( 'LATEPOINT_USER_TYPE_CUSTOM' ) ) {
238 define( 'LATEPOINT_USER_TYPE_CUSTOM', 'custom' );
239 }
240 if ( ! defined( 'LATEPOINT_USER_TYPE_CUSTOMER' ) ) {
241 define( 'LATEPOINT_USER_TYPE_CUSTOMER', 'customer' );
242 }
243
244 if ( ! defined( 'LATEPOINT_PARAMS_SCOPE_PUBLIC' ) ) {
245 define( 'LATEPOINT_PARAMS_SCOPE_PUBLIC', 'public' );
246 }
247 if ( ! defined( 'LATEPOINT_PARAMS_SCOPE_ADMIN' ) ) {
248 define( 'LATEPOINT_PARAMS_SCOPE_ADMIN', 'admin' );
249 }
250 if ( ! defined( 'LATEPOINT_PARAMS_SCOPE_CUSTOMER' ) ) {
251 define( 'LATEPOINT_PARAMS_SCOPE_CUSTOMER', 'customer' );
252 }
253
254
255 if ( ! defined( 'LATEPOINT_VERSION' ) ) {
256 define( 'LATEPOINT_VERSION', $this->version );
257 }
258 if ( ! defined( 'LATEPOINT_ENCRYPTION_KEY' ) ) {
259 define( 'LATEPOINT_ENCRYPTION_KEY', 'oiaf(*Ufdsoh2ie7QEy,R@6(I9H/VoX^r4}SHC_7W-<$S!,/kd)OSw?.Y9lcd105cu$' );
260 }
261
262 if ( ! defined( 'LATEPOINT_AGENT_POST_TYPE' ) ) {
263 define( 'LATEPOINT_AGENT_POST_TYPE', 'latepoint_agent' );
264 }
265
266 if ( ! defined( 'LATEPOINT_UPGRADE_URL' ) ) {
267 define( 'LATEPOINT_UPGRADE_URL', 'https://latepoint.com/upgrade-from-wp' );
268 }
269 if ( ! defined( 'LATEPOINT_SERVICE_POST_TYPE' ) ) {
270 define( 'LATEPOINT_SERVICE_POST_TYPE', 'latepoint_service' );
271 }
272 if ( ! defined( 'LATEPOINT_CUSTOMER_POST_TYPE' ) ) {
273 define( 'LATEPOINT_CUSTOMER_POST_TYPE', 'latepoint_customer' );
274 }
275
276 if ( ! defined( 'LATEPOINT_DB_VERSION' ) ) {
277 define( 'LATEPOINT_DB_VERSION', $this->db_version );
278 }
279
280 global $wpdb;
281 if ( ! defined( 'LATEPOINT_TABLE_BUNDLES' ) ) {
282 define( 'LATEPOINT_TABLE_BUNDLES', $wpdb->prefix . 'latepoint_bundles' );
283 }
284 if ( ! defined( 'LATEPOINT_TABLE_BUNDLES_SERVICES' ) ) {
285 define( 'LATEPOINT_TABLE_JOIN_BUNDLES_SERVICES', $wpdb->prefix . 'latepoint_bundles_services' );
286 }
287 if ( ! defined( 'LATEPOINT_TABLE_BOOKINGS' ) ) {
288 define( 'LATEPOINT_TABLE_BOOKINGS', $wpdb->prefix . 'latepoint_bookings' );
289 }
290 if ( ! defined( 'LATEPOINT_TABLE_SESSIONS' ) ) {
291 define( 'LATEPOINT_TABLE_SESSIONS', $wpdb->prefix . 'latepoint_sessions' );
292 }
293 if ( ! defined( 'LATEPOINT_TABLE_SERVICES' ) ) {
294 define( 'LATEPOINT_TABLE_SERVICES', $wpdb->prefix . 'latepoint_services' );
295 }
296 if ( ! defined( 'LATEPOINT_TABLE_SETTINGS' ) ) {
297 define( 'LATEPOINT_TABLE_SETTINGS', $wpdb->prefix . 'latepoint_settings' );
298 }
299 if ( ! defined( 'LATEPOINT_TABLE_SERVICE_CATEGORIES' ) ) {
300 define( 'LATEPOINT_TABLE_SERVICE_CATEGORIES', $wpdb->prefix . 'latepoint_service_categories' );
301 }
302 if ( ! defined( 'LATEPOINT_TABLE_WORK_PERIODS' ) ) {
303 define( 'LATEPOINT_TABLE_WORK_PERIODS', $wpdb->prefix . 'latepoint_work_periods' );
304 }
305 if ( ! defined( 'LATEPOINT_TABLE_CUSTOM_PRICES' ) ) {
306 define( 'LATEPOINT_TABLE_CUSTOM_PRICES', $wpdb->prefix . 'latepoint_custom_prices' );
307 }
308 if ( ! defined( 'LATEPOINT_TABLE_AGENTS_SERVICES' ) ) {
309 define( 'LATEPOINT_TABLE_AGENTS_SERVICES', $wpdb->prefix . 'latepoint_agents_services' );
310 }
311 if ( ! defined( 'LATEPOINT_TABLE_ACTIVITIES' ) ) {
312 define( 'LATEPOINT_TABLE_ACTIVITIES', $wpdb->prefix . 'latepoint_activities' );
313 }
314 if ( ! defined( 'LATEPOINT_TABLE_TRANSACTIONS' ) ) {
315 define( 'LATEPOINT_TABLE_TRANSACTIONS', $wpdb->prefix . 'latepoint_transactions' );
316 }
317 if ( ! defined( 'LATEPOINT_TABLE_TRANSACTION_REFUNDS' ) ) {
318 define( 'LATEPOINT_TABLE_TRANSACTION_REFUNDS', $wpdb->prefix . 'latepoint_transaction_refunds' );
319 }
320 if ( ! defined( 'LATEPOINT_TABLE_TRANSACTION_INTENTS' ) ) {
321 define( 'LATEPOINT_TABLE_TRANSACTION_INTENTS', $wpdb->prefix . 'latepoint_transaction_intents' );
322 }
323 if ( ! defined( 'LATEPOINT_TABLE_AGENTS' ) ) {
324 define( 'LATEPOINT_TABLE_AGENTS', $wpdb->prefix . 'latepoint_agents' );
325 }
326 if ( ! defined( 'LATEPOINT_TABLE_CUSTOMERS' ) ) {
327 define( 'LATEPOINT_TABLE_CUSTOMERS', $wpdb->prefix . 'latepoint_customers' );
328 }
329 if ( ! defined( 'LATEPOINT_TABLE_CUSTOMER_META' ) ) {
330 define( 'LATEPOINT_TABLE_CUSTOMER_META', $wpdb->prefix . 'latepoint_customer_meta' );
331 }
332 if ( ! defined( 'LATEPOINT_TABLE_SERVICE_META' ) ) {
333 define( 'LATEPOINT_TABLE_SERVICE_META', $wpdb->prefix . 'latepoint_service_meta' );
334 }
335 if ( ! defined( 'LATEPOINT_TABLE_BOOKING_META' ) ) {
336 define( 'LATEPOINT_TABLE_BOOKING_META', $wpdb->prefix . 'latepoint_booking_meta' );
337 }
338 if ( ! defined( 'LATEPOINT_TABLE_AGENT_META' ) ) {
339 define( 'LATEPOINT_TABLE_AGENT_META', $wpdb->prefix . 'latepoint_agent_meta' );
340 }
341 if ( ! defined( 'LATEPOINT_TABLE_STEPS' ) ) {
342 define( 'LATEPOINT_TABLE_STEPS', $wpdb->prefix . 'latepoint_steps' );
343 }
344 if ( ! defined( 'LATEPOINT_TABLE_STEP_SETTINGS' ) ) {
345 define( 'LATEPOINT_TABLE_STEP_SETTINGS', $wpdb->prefix . 'latepoint_step_settings' );
346 }
347 if ( ! defined( 'LATEPOINT_TABLE_LOCATIONS' ) ) {
348 define( 'LATEPOINT_TABLE_LOCATIONS', $wpdb->prefix . 'latepoint_locations' );
349 }
350 if ( ! defined( 'LATEPOINT_TABLE_LOCATION_CATEGORIES' ) ) {
351 define( 'LATEPOINT_TABLE_LOCATION_CATEGORIES', $wpdb->prefix . 'latepoint_location_categories' );
352 }
353 if ( ! defined( 'LATEPOINT_TABLE_PROCESSES' ) ) {
354 define( 'LATEPOINT_TABLE_PROCESSES', $wpdb->prefix . 'latepoint_processes' );
355 }
356 if ( ! defined( 'LATEPOINT_TABLE_PROCESS_JOBS' ) ) {
357 define( 'LATEPOINT_TABLE_PROCESS_JOBS', $wpdb->prefix . 'latepoint_process_jobs' );
358 }
359
360 if ( ! defined( 'LATEPOINT_TABLE_CARTS' ) ) {
361 define( 'LATEPOINT_TABLE_CARTS', $wpdb->prefix . 'latepoint_carts' );
362 }
363 if ( ! defined( 'LATEPOINT_TABLE_CART_META' ) ) {
364 define( 'LATEPOINT_TABLE_CART_META', $wpdb->prefix . 'latepoint_cart_meta' );
365 }
366 if ( ! defined( 'LATEPOINT_TABLE_CART_ITEMS' ) ) {
367 define( 'LATEPOINT_TABLE_CART_ITEMS', $wpdb->prefix . 'latepoint_cart_items' );
368 }
369
370 if ( ! defined( 'LATEPOINT_TABLE_ORDERS' ) ) {
371 define( 'LATEPOINT_TABLE_ORDERS', $wpdb->prefix . 'latepoint_orders' );
372 }
373 if ( ! defined( 'LATEPOINT_TABLE_ORDER_META' ) ) {
374 define( 'LATEPOINT_TABLE_ORDER_META', $wpdb->prefix . 'latepoint_order_meta' );
375 }
376 if ( ! defined( 'LATEPOINT_TABLE_ORDER_ITEMS' ) ) {
377 define( 'LATEPOINT_TABLE_ORDER_ITEMS', $wpdb->prefix . 'latepoint_order_items' );
378 }
379 if ( ! defined( 'LATEPOINT_TABLE_ORDER_INTENTS' ) ) {
380 define( 'LATEPOINT_TABLE_ORDER_INTENTS', $wpdb->prefix . 'latepoint_order_intents' );
381 }
382 if ( ! defined( 'LATEPOINT_TABLE_ORDER_INTENT_META' ) ) {
383 define( 'LATEPOINT_TABLE_ORDER_INTENT_META', $wpdb->prefix . 'latepoint_order_intent_meta' );
384 }
385 if ( ! defined( 'LATEPOINT_TABLE_ORDER_INVOICES' ) ) {
386 define( 'LATEPOINT_TABLE_ORDER_INVOICES', $wpdb->prefix . 'latepoint_order_invoices' );
387 }
388 if ( ! defined( 'LATEPOINT_TABLE_PAYMENT_REQUESTS' ) ) {
389 define( 'LATEPOINT_TABLE_PAYMENT_REQUESTS', $wpdb->prefix . 'latepoint_payment_requests' );
390 }
391 if ( ! defined( 'LATEPOINT_ORDER_INTENT_STATUS_NEW' ) ) {
392 define( 'LATEPOINT_ORDER_INTENT_STATUS_NEW', 'new' );
393 }
394 if ( ! defined( 'LATEPOINT_ORDER_INTENT_STATUS_CONVERTED' ) ) {
395 define( 'LATEPOINT_ORDER_INTENT_STATUS_CONVERTED', 'converted' );
396 }
397 if ( ! defined( 'LATEPOINT_ORDER_INTENT_STATUS_PROCESSING' ) ) {
398 define( 'LATEPOINT_ORDER_INTENT_STATUS_PROCESSING', 'processing' );
399 }
400
401 if ( ! defined( 'LATEPOINT_TRANSACTION_INTENT_STATUS_NEW' ) ) {
402 define( 'LATEPOINT_TRANSACTION_INTENT_STATUS_NEW', 'new' );
403 }
404 if ( ! defined( 'LATEPOINT_TRANSACTION_INTENT_STATUS_CONVERTED' ) ) {
405 define( 'LATEPOINT_TRANSACTION_INTENT_STATUS_CONVERTED', 'converted' );
406 }
407 if ( ! defined( 'LATEPOINT_TRANSACTION_INTENT_STATUS_PROCESSING' ) ) {
408 define( 'LATEPOINT_TRANSACTION_INTENT_STATUS_PROCESSING', 'processing' );
409 }
410
411 if ( ! defined( 'LATEPOINT_BOOKING_STATUS_APPROVED' ) ) {
412 define( 'LATEPOINT_BOOKING_STATUS_APPROVED', 'approved' );
413 }
414 if ( ! defined( 'LATEPOINT_BOOKING_STATUS_PENDING' ) ) {
415 define( 'LATEPOINT_BOOKING_STATUS_PENDING', 'pending' );
416 }
417 if ( ! defined( 'LATEPOINT_BOOKING_STATUS_PAYMENT_PENDING' ) ) {
418 define( 'LATEPOINT_BOOKING_STATUS_PAYMENT_PENDING', 'payment_pending' );
419 }
420 if ( ! defined( 'LATEPOINT_BOOKING_STATUS_CANCELLED' ) ) {
421 define( 'LATEPOINT_BOOKING_STATUS_CANCELLED', 'cancelled' );
422 }
423 if ( ! defined( 'LATEPOINT_BOOKING_STATUS_NO_SHOW' ) ) {
424 define( 'LATEPOINT_BOOKING_STATUS_NO_SHOW', 'no_show' );
425 }
426 if ( ! defined( 'LATEPOINT_BOOKING_STATUS_COMPLETED' ) ) {
427 define( 'LATEPOINT_BOOKING_STATUS_COMPLETED', 'completed' );
428 }
429
430 if ( ! defined( 'LATEPOINT_JOB_STATUS_COMPLETED' ) ) {
431 define( 'LATEPOINT_JOB_STATUS_COMPLETED', 'completed' );
432 }
433 if ( ! defined( 'LATEPOINT_JOB_STATUS_SCHEDULED' ) ) {
434 define( 'LATEPOINT_JOB_STATUS_SCHEDULED', 'scheduled' );
435 }
436 if ( ! defined( 'LATEPOINT_JOB_STATUS_CANCELLED' ) ) {
437 define( 'LATEPOINT_JOB_STATUS_CANCELLED', 'cancelled' );
438 }
439 if ( ! defined( 'LATEPOINT_JOB_STATUS_ERROR' ) ) {
440 define( 'LATEPOINT_JOB_STATUS_ERROR', 'error' );
441 }
442
443 // order statuses
444 if ( ! defined( 'LATEPOINT_ORDER_STATUS_OPEN' ) ) {
445 define( 'LATEPOINT_ORDER_STATUS_OPEN', 'open' );
446 }
447 if ( ! defined( 'LATEPOINT_ORDER_STATUS_CANCELLED' ) ) {
448 define( 'LATEPOINT_ORDER_STATUS_CANCELLED', 'cancelled' );
449 }
450 if ( ! defined( 'LATEPOINT_ORDER_STATUS_COMPLETED' ) ) {
451 define( 'LATEPOINT_ORDER_STATUS_COMPLETED', 'completed' );
452 }
453
454 // order fulfillment statuses
455 if ( ! defined( 'LATEPOINT_ORDER_FULFILLMENT_STATUS_NOT_FULFILLED' ) ) {
456 define( 'LATEPOINT_ORDER_FULFILLMENT_STATUS_NOT_FULFILLED', 'not_fulfilled' );
457 }
458 if ( ! defined( 'LATEPOINT_ORDER_FULFILLMENT_STATUS_FULFILLED' ) ) {
459 define( 'LATEPOINT_ORDER_FULFILLMENT_STATUS_FULFILLED', 'fulfilled' );
460 }
461 if ( ! defined( 'LATEPOINT_ORDER_FULFILLMENT_STATUS_PARTIALLY_FULFILLED' ) ) {
462 define( 'LATEPOINT_ORDER_FULFILLMENT_STATUS_PARTIALLY_FULFILLED', 'partially_fulfilled' );
463 }
464
465 if ( ! defined( 'LATEPOINT_ORDER_PAYMENT_STATUS_NOT_PAID' ) ) {
466 define( 'LATEPOINT_ORDER_PAYMENT_STATUS_NOT_PAID', 'not_paid' );
467 }
468 if ( ! defined( 'LATEPOINT_ORDER_PAYMENT_STATUS_PARTIALLY_PAID' ) ) {
469 define( 'LATEPOINT_ORDER_PAYMENT_STATUS_PARTIALLY_PAID', 'partially_paid' );
470 }
471 if ( ! defined( 'LATEPOINT_ORDER_PAYMENT_STATUS_FULLY_PAID' ) ) {
472 define( 'LATEPOINT_ORDER_PAYMENT_STATUS_FULLY_PAID', 'fully_paid' );
473 }
474 if ( ! defined( 'LATEPOINT_ORDER_PAYMENT_STATUS_PROCESSING' ) ) {
475 define( 'LATEPOINT_ORDER_PAYMENT_STATUS_PROCESSING', 'processing' );
476 }
477 if ( ! defined( 'LATEPOINT_ORDER_PAYMENT_STATUS_REFUNDED' ) ) {
478 define( 'LATEPOINT_ORDER_PAYMENT_STATUS_REFUNDED', 'refunded' );
479 }
480 if ( ! defined( 'LATEPOINT_ORDER_PAYMENT_STATUS_PARTIALLY_REFUNDED' ) ) {
481 define( 'LATEPOINT_ORDER_PAYMENT_STATUS_PARTIALLY_REFUNDED', 'partially_refunded' );
482 }
483
484 if ( ! defined( 'LATEPOINT_DEFAULT_TIME_SYSTEM' ) ) {
485 define( 'LATEPOINT_DEFAULT_TIME_SYSTEM', '12' );
486 }
487 if ( ! defined( 'LATEPOINT_DEFAULT_DATE_FORMAT' ) ) {
488 define( 'LATEPOINT_DEFAULT_DATE_FORMAT', 'm/d/Y' );
489 }
490 if ( ! defined( 'LATEPOINT_DATETIME_DB_FORMAT' ) ) {
491 define( 'LATEPOINT_DATETIME_DB_FORMAT', 'Y-m-d H:i:s' );
492 }
493
494 if ( ! defined( 'LATEPOINT_STATUS_ERROR' ) ) {
495 define( 'LATEPOINT_STATUS_ERROR', 'error' );
496 }
497 if ( ! defined( 'LATEPOINT_STATUS_SUCCESS' ) ) {
498 define( 'LATEPOINT_STATUS_SUCCESS', 'success' );
499 }
500
501 if ( ! defined( 'LATEPOINT_SERVICE_STATUS_ACTIVE' ) ) {
502 define( 'LATEPOINT_SERVICE_STATUS_ACTIVE', 'active' );
503 }
504 if ( ! defined( 'LATEPOINT_SERVICE_STATUS_DISABLED' ) ) {
505 define( 'LATEPOINT_SERVICE_STATUS_DISABLED', 'disabled' );
506 }
507
508 if ( ! defined( 'LATEPOINT_SERVICE_VISIBILITY_VISIBLE' ) ) {
509 define( 'LATEPOINT_SERVICE_VISIBILITY_VISIBLE', 'visible' );
510 }
511 if ( ! defined( 'LATEPOINT_SERVICE_VISIBILITY_HIDDEN' ) ) {
512 define( 'LATEPOINT_SERVICE_VISIBILITY_HIDDEN', 'hidden' );
513 }
514
515
516 if ( ! defined( 'LATEPOINT_LOCATION_STATUS_ACTIVE' ) ) {
517 define( 'LATEPOINT_LOCATION_STATUS_ACTIVE', 'active' );
518 }
519 if ( ! defined( 'LATEPOINT_LOCATION_STATUS_DISABLED' ) ) {
520 define( 'LATEPOINT_LOCATION_STATUS_DISABLED', 'disabled' );
521 }
522
523 if ( ! defined( 'LATEPOINT_AGENT_STATUS_ACTIVE' ) ) {
524 define( 'LATEPOINT_AGENT_STATUS_ACTIVE', 'active' );
525 }
526 if ( ! defined( 'LATEPOINT_AGENT_STATUS_DISABLED' ) ) {
527 define( 'LATEPOINT_AGENT_STATUS_DISABLED', 'disabled' );
528 }
529
530 if ( ! defined( 'LATEPOINT_BUNDLE_STATUS_ACTIVE' ) ) {
531 define( 'LATEPOINT_BUNDLE_STATUS_ACTIVE', 'active' );
532 }
533 if ( ! defined( 'LATEPOINT_BUNDLE_STATUS_DISABLED' ) ) {
534 define( 'LATEPOINT_BUNDLE_STATUS_DISABLED', 'disabled' );
535 }
536
537 if ( ! defined( 'LATEPOINT_BUNDLE_VISIBILITY_VISIBLE' ) ) {
538 define( 'LATEPOINT_BUNDLE_VISIBILITY_VISIBLE', 'visible' );
539 }
540 if ( ! defined( 'LATEPOINT_BUNDLE_VISIBILITY_HIDDEN' ) ) {
541 define( 'LATEPOINT_BUNDLE_VISIBILITY_HIDDEN', 'hidden' );
542 }
543
544 if ( ! defined( 'LATEPOINT_ITEM_VARIANT_BOOKING' ) ) {
545 define( 'LATEPOINT_ITEM_VARIANT_BOOKING', 'booking' );
546 }
547 if ( ! defined( 'LATEPOINT_ITEM_VARIANT_BUNDLE' ) ) {
548 define( 'LATEPOINT_ITEM_VARIANT_BUNDLE', 'bundle' );
549 }
550
551 if ( ! defined( 'LATEPOINT_DEFAULT_TIMEBLOCK_INTERVAL' ) ) {
552 define( 'LATEPOINT_DEFAULT_TIMEBLOCK_INTERVAL', 30 );
553 }
554 if ( ! defined( 'LATEPOINT_DEFAULT_PHONE_CODE' ) ) {
555 define( 'LATEPOINT_DEFAULT_PHONE_CODE', '+1' );
556 }
557 if ( ! defined( 'LATEPOINT_DEFAULT_PHONE_FORMAT' ) ) {
558 define( 'LATEPOINT_DEFAULT_PHONE_FORMAT', '(999) 999-9999' );
559 }
560
561 if ( ! defined( 'LATEPOINT_TRANSACTION_STATUS_SUCCEEDED' ) ) {
562 define( 'LATEPOINT_TRANSACTION_STATUS_SUCCEEDED', 'succeeded' );
563 }
564 if ( ! defined( 'LATEPOINT_TRANSACTION_STATUS_PROCESSING' ) ) {
565 define( 'LATEPOINT_TRANSACTION_STATUS_PROCESSING', 'processing' );
566 }
567 if ( ! defined( 'LATEPOINT_TRANSACTION_STATUS_FAILED' ) ) {
568 define( 'LATEPOINT_TRANSACTION_STATUS_FAILED', 'failed' );
569 }
570
571 // invoices
572 if ( ! defined( 'LATEPOINT_INVOICE_STATUS_OPEN' ) ) {
573 define( 'LATEPOINT_INVOICE_STATUS_OPEN', 'open' );
574 }
575 if ( ! defined( 'LATEPOINT_INVOICE_STATUS_PAID' ) ) {
576 define( 'LATEPOINT_INVOICE_STATUS_PAID', 'paid' );
577 }
578 if ( ! defined( 'LATEPOINT_INVOICE_STATUS_PARTIALLY_PAID' ) ) {
579 define( 'LATEPOINT_INVOICE_STATUS_PARTIALLY_PAID', 'partially_paid' );
580 }
581 if ( ! defined( 'LATEPOINT_INVOICE_STATUS_DRAFT' ) ) {
582 define( 'LATEPOINT_INVOICE_STATUS_DRAFT', 'draft' );
583 }
584 if ( ! defined( 'LATEPOINT_INVOICE_STATUS_VOID' ) ) {
585 define( 'LATEPOINT_INVOICE_STATUS_VOID', 'void' );
586 }
587 if ( ! defined( 'LATEPOINT_INVOICE_STATUS_UNCOLLECTIBLE' ) ) {
588 define( 'LATEPOINT_INVOICE_STATUS_UNCOLLECTIBLE', 'uncollectible' );
589 }
590
591 // PAYMENTS
592
593 if ( ! defined( 'LATEPOINT_PAYMENT_PROCESSOR_STRIPE' ) ) {
594 define( 'LATEPOINT_PAYMENT_PROCESSOR_STRIPE', 'stripe' );
595 }
596 if ( ! defined( 'LATEPOINT_PAYMENT_PROCESSOR_BRAINTREE' ) ) {
597 define( 'LATEPOINT_PAYMENT_PROCESSOR_BRAINTREE', 'braintree' );
598 }
599 if ( ! defined( 'LATEPOINT_PAYMENT_PROCESSOR_PAYPAL' ) ) {
600 define( 'LATEPOINT_PAYMENT_PROCESSOR_PAYPAL', 'paypal' );
601 }
602
603 if ( ! defined( 'LATEPOINT_TRANSACTION_KIND_CAPTURE' ) ) {
604 define( 'LATEPOINT_TRANSACTION_KIND_CAPTURE', 'capture' );
605 }
606 if ( ! defined( 'LATEPOINT_TRANSACTION_KIND_AUTHORIZATION' ) ) {
607 define( 'LATEPOINT_TRANSACTION_KIND_AUTHORIZATION', 'authorization' );
608 }
609 if ( ! defined( 'LATEPOINT_TRANSACTION_KIND_VOID' ) ) {
610 define( 'LATEPOINT_TRANSACTION_KIND_VOID', 'void' );
611 }
612
613 if ( ! defined( 'LATEPOINT_PAYMENT_METHOD_LOCAL' ) ) {
614 define( 'LATEPOINT_PAYMENT_METHOD_LOCAL', 'local' );
615 }
616 if ( ! defined( 'LATEPOINT_PAYMENT_METHOD_PAYPAL' ) ) {
617 define( 'LATEPOINT_PAYMENT_METHOD_PAYPAL', 'paypal' );
618 }
619 if ( ! defined( 'LATEPOINT_PAYMENT_METHOD_CARD' ) ) {
620 define( 'LATEPOINT_PAYMENT_METHOD_CARD', 'card' );
621 }
622
623 if ( ! defined( 'LATEPOINT_PAYMENT_TIME_LATER' ) ) {
624 define( 'LATEPOINT_PAYMENT_TIME_LATER', 'later' );
625 }
626 if ( ! defined( 'LATEPOINT_PAYMENT_TIME_NOW' ) ) {
627 define( 'LATEPOINT_PAYMENT_TIME_NOW', 'now' );
628 }
629
630 if ( ! defined( 'LATEPOINT_VALUE_ON' ) ) {
631 define( 'LATEPOINT_VALUE_ON', 'on' );
632 }
633 if ( ! defined( 'LATEPOINT_VALUE_OFF' ) ) {
634 define( 'LATEPOINT_VALUE_OFF', 'off' );
635 }
636
637 if ( ! defined( 'LATEPOINT_STATUS_ACTIVE' ) ) {
638 define( 'LATEPOINT_STATUS_ACTIVE', 'active' );
639 }
640 if ( ! defined( 'LATEPOINT_STATUS_DISABLED' ) ) {
641 define( 'LATEPOINT_STATUS_DISABLED', 'disabled' );
642 }
643
644 if ( ! defined( 'LATEPOINT_PAYMENT_PORTION_FULL' ) ) {
645 define( 'LATEPOINT_PAYMENT_PORTION_FULL', 'full' );
646 }
647 if ( ! defined( 'LATEPOINT_PAYMENT_PORTION_REMAINING' ) ) {
648 define( 'LATEPOINT_PAYMENT_PORTION_REMAINING', 'remaining' );
649 }
650 if ( ! defined( 'LATEPOINT_PAYMENT_PORTION_DEPOSIT' ) ) {
651 define( 'LATEPOINT_PAYMENT_PORTION_DEPOSIT', 'deposit' );
652 }
653 if ( ! defined( 'LATEPOINT_PAYMENT_PORTION_CUSTOM' ) ) {
654 define( 'LATEPOINT_PAYMENT_PORTION_CUSTOM', 'custom' );
655 }
656
657 if ( ! defined( 'LATEPOINT_ANY_AGENT' ) ) {
658 define( 'LATEPOINT_ANY_AGENT', 'any' );
659 }
660 if ( ! defined( 'LATEPOINT_ANY_LOCATION' ) ) {
661 define( 'LATEPOINT_ANY_LOCATION', 'any' );
662 }
663
664 if ( ! defined( 'LATEPOINT_ANY_AGENT_ORDER_RANDOM' ) ) {
665 define( 'LATEPOINT_ANY_AGENT_ORDER_RANDOM', 'random' );
666 }
667 if ( ! defined( 'LATEPOINT_ANY_AGENT_ORDER_PRICE_HIGH' ) ) {
668 define( 'LATEPOINT_ANY_AGENT_ORDER_PRICE_HIGH', 'price_high' );
669 }
670 if ( ! defined( 'LATEPOINT_ANY_AGENT_ORDER_PRICE_LOW' ) ) {
671 define( 'LATEPOINT_ANY_AGENT_ORDER_PRICE_LOW', 'price_low' );
672 }
673 if ( ! defined( 'LATEPOINT_ANY_AGENT_ORDER_BUSY_HIGH' ) ) {
674 define( 'LATEPOINT_ANY_AGENT_ORDER_BUSY_HIGH', 'busy_high' );
675 }
676 if ( ! defined( 'LATEPOINT_ANY_AGENT_ORDER_BUSY_LOW' ) ) {
677 define( 'LATEPOINT_ANY_AGENT_ORDER_BUSY_LOW', 'busy_low' );
678 }
679
680 if ( ! defined( 'LATEPOINT_ALL' ) ) {
681 define( 'LATEPOINT_ALL', 'all' );
682 }
683
684 // Stripe Connect
685 if ( ! defined( 'LATEPOINT_STRIPE_CONNECT_URL' ) ) {
686 define( 'LATEPOINT_STRIPE_CONNECT_URL', 'https://app.latepoint.com' );
687 }
688 }
689
690
691 /**
692 * Include required core files used in admin and on the frontend.
693 */
694 public function includes() {
695
696 // CONTROLLERS
697 include_once( LATEPOINT_ABSPATH . 'lib/controllers/controller.php' );
698 include_once( LATEPOINT_ABSPATH . 'lib/controllers/pro_controller.php' );
699 include_once( LATEPOINT_ABSPATH . 'lib/controllers/default_agent_controller.php' );
700 include_once( LATEPOINT_ABSPATH . 'lib/controllers/activities_controller.php' );
701 include_once( LATEPOINT_ABSPATH . 'lib/controllers/search_controller.php' );
702 include_once( LATEPOINT_ABSPATH . 'lib/controllers/customers_controller.php' );
703 include_once( LATEPOINT_ABSPATH . 'lib/controllers/services_controller.php' );
704 include_once( LATEPOINT_ABSPATH . 'lib/controllers/carts_controller.php' );
705 include_once( LATEPOINT_ABSPATH . 'lib/controllers/transactions_controller.php' );
706 include_once( LATEPOINT_ABSPATH . 'lib/controllers/orders_controller.php' );
707 include_once( LATEPOINT_ABSPATH . 'lib/controllers/auth_controller.php' );
708 include_once( LATEPOINT_ABSPATH . 'lib/controllers/processes_controller.php' );
709 include_once( LATEPOINT_ABSPATH . 'lib/controllers/process_jobs_controller.php' );
710 include_once( LATEPOINT_ABSPATH . 'lib/controllers/settings_controller.php' );
711 include_once( LATEPOINT_ABSPATH . 'lib/controllers/form_fields_controller.php' );
712 include_once( LATEPOINT_ABSPATH . 'lib/controllers/bookings_controller.php' );
713 include_once( LATEPOINT_ABSPATH . 'lib/controllers/dashboard_controller.php' );
714 include_once( LATEPOINT_ABSPATH . 'lib/controllers/wizard_controller.php' );
715 include_once( LATEPOINT_ABSPATH . 'lib/controllers/notifications_controller.php' );
716 include_once( LATEPOINT_ABSPATH . 'lib/controllers/steps_controller.php' );
717 include_once( LATEPOINT_ABSPATH . 'lib/controllers/calendars_controller.php' );
718 include_once( LATEPOINT_ABSPATH . 'lib/controllers/booking_form_settings_controller.php' );
719 include_once( LATEPOINT_ABSPATH . 'lib/controllers/integrations_controller.php' );
720 include_once( LATEPOINT_ABSPATH . 'lib/controllers/customer_cabinet_controller.php' );
721 include_once( LATEPOINT_ABSPATH . 'lib/controllers/manage_booking_by_key_controller.php' );
722 include_once( LATEPOINT_ABSPATH . 'lib/controllers/manage_order_by_key_controller.php' );
723 include_once( LATEPOINT_ABSPATH . 'lib/controllers/events_controller.php' );
724 include_once( LATEPOINT_ABSPATH . 'lib/controllers/stripe_connect_controller.php' );
725 include_once( LATEPOINT_ABSPATH . 'lib/controllers/invoices_controller.php' );
726 include_once( LATEPOINT_ABSPATH . 'lib/controllers/support_topics_controller.php' );
727
728
729
730 // MODELS
731 include_once( LATEPOINT_ABSPATH . 'lib/models/model.php' );
732 include_once( LATEPOINT_ABSPATH . 'lib/models/meta_model.php' );
733 include_once( LATEPOINT_ABSPATH . 'lib/models/bundle_model.php' );
734 include_once( LATEPOINT_ABSPATH . 'lib/models/cart_model.php' );
735 include_once( LATEPOINT_ABSPATH . 'lib/models/cart_meta_model.php' );
736 include_once( LATEPOINT_ABSPATH . 'lib/models/cart_item_model.php' );
737 include_once( LATEPOINT_ABSPATH . 'lib/models/order_model.php' );
738 include_once( LATEPOINT_ABSPATH . 'lib/models/order_meta_model.php' );
739 include_once( LATEPOINT_ABSPATH . 'lib/models/order_item_model.php' );
740 include_once( LATEPOINT_ABSPATH . 'lib/models/activity_model.php' );
741 include_once( LATEPOINT_ABSPATH . 'lib/models/work_period_model.php' );
742 include_once( LATEPOINT_ABSPATH . 'lib/models/agent_model.php' );
743 include_once( LATEPOINT_ABSPATH . 'lib/models/service_model.php' );
744 include_once( LATEPOINT_ABSPATH . 'lib/models/connector_model.php' );
745 include_once( LATEPOINT_ABSPATH . 'lib/models/service_category_model.php' );
746 include_once( LATEPOINT_ABSPATH . 'lib/models/customer_model.php' );
747 include_once( LATEPOINT_ABSPATH . 'lib/models/settings_model.php' );
748 include_once( LATEPOINT_ABSPATH . 'lib/models/booking_model.php' );
749 include_once( LATEPOINT_ABSPATH . 'lib/models/step_settings_model.php' );
750 include_once( LATEPOINT_ABSPATH . 'lib/models/transaction_model.php' );
751 include_once( LATEPOINT_ABSPATH . 'lib/models/transaction_intent_model.php' );
752 include_once( LATEPOINT_ABSPATH . 'lib/models/transaction_refund_model.php' );
753 include_once( LATEPOINT_ABSPATH . 'lib/models/booking_meta_model.php' );
754 include_once( LATEPOINT_ABSPATH . 'lib/models/customer_meta_model.php' );
755 include_once( LATEPOINT_ABSPATH . 'lib/models/agent_meta_model.php' );
756 include_once( LATEPOINT_ABSPATH . 'lib/models/service_meta_model.php' );
757 include_once( LATEPOINT_ABSPATH . 'lib/models/location_model.php' );
758 include_once( LATEPOINT_ABSPATH . 'lib/models/location_category_model.php' );
759 include_once( LATEPOINT_ABSPATH . 'lib/models/session_model.php' );
760 include_once( LATEPOINT_ABSPATH . 'lib/models/order_intent_model.php' );
761 include_once( LATEPOINT_ABSPATH . 'lib/models/order_intent_meta_model.php' );
762 include_once( LATEPOINT_ABSPATH . 'lib/models/process_model.php' );
763 include_once( LATEPOINT_ABSPATH . 'lib/models/process_job_model.php' );
764 include_once( LATEPOINT_ABSPATH . 'lib/models/join_bundles_services_model.php' );
765 include_once( LATEPOINT_ABSPATH . 'lib/models/invoice_model.php' );
766 include_once( LATEPOINT_ABSPATH . 'lib/models/payment_request_model.php' );
767
768
769 // HELPERS
770 include_once( LATEPOINT_ABSPATH . 'lib/helpers/wp_datetime.php' );
771 include_once( LATEPOINT_ABSPATH . 'lib/helpers/router_helper.php' );
772 include_once( LATEPOINT_ABSPATH . 'lib/helpers/sessions_helper.php' );
773 include_once( LATEPOINT_ABSPATH . 'lib/helpers/auth_helper.php' );
774 include_once( LATEPOINT_ABSPATH . 'lib/helpers/encrypt_helper.php' );
775 include_once( LATEPOINT_ABSPATH . 'lib/helpers/license_helper.php' );
776 include_once( LATEPOINT_ABSPATH . 'lib/helpers/form_helper.php' );
777 include_once( LATEPOINT_ABSPATH . 'lib/helpers/migrations_helper.php' );
778 include_once( LATEPOINT_ABSPATH . 'lib/helpers/util_helper.php' );
779 include_once( LATEPOINT_ABSPATH . 'lib/helpers/debug_helper.php' );
780 include_once( LATEPOINT_ABSPATH . 'lib/helpers/wp_user_helper.php' );
781 include_once( LATEPOINT_ABSPATH . 'lib/helpers/menu_helper.php' );
782 include_once( LATEPOINT_ABSPATH . 'lib/helpers/image_helper.php' );
783 include_once( LATEPOINT_ABSPATH . 'lib/helpers/events_helper.php' );
784 include_once( LATEPOINT_ABSPATH . 'lib/helpers/icalendar_helper.php' );
785 include_once( LATEPOINT_ABSPATH . 'lib/helpers/version_specific_updates_helper.php' );
786 include_once( LATEPOINT_ABSPATH . 'lib/helpers/calendar_helper.php' );
787 include_once( LATEPOINT_ABSPATH . 'lib/helpers/meeting_systems_helper.php' );
788 include_once( LATEPOINT_ABSPATH . 'lib/helpers/marketing_systems_helper.php' );
789 include_once( LATEPOINT_ABSPATH . 'lib/helpers/timeline_helper.php' );
790 include_once( LATEPOINT_ABSPATH . 'lib/helpers/booking_helper.php' );
791 include_once( LATEPOINT_ABSPATH . 'lib/helpers/order_intent_helper.php' );
792 include_once( LATEPOINT_ABSPATH . 'lib/helpers/activities_helper.php' );
793 include_once( LATEPOINT_ABSPATH . 'lib/helpers/settings_helper.php' );
794 include_once( LATEPOINT_ABSPATH . 'lib/helpers/customer_helper.php' );
795 include_once( LATEPOINT_ABSPATH . 'lib/helpers/processes_helper.php' );
796 include_once( LATEPOINT_ABSPATH . 'lib/helpers/agent_helper.php' );
797 include_once( LATEPOINT_ABSPATH . 'lib/helpers/service_helper.php' );
798 include_once( LATEPOINT_ABSPATH . 'lib/helpers/database_helper.php' );
799 include_once( LATEPOINT_ABSPATH . 'lib/helpers/money_helper.php' );
800 include_once( LATEPOINT_ABSPATH . 'lib/helpers/time_helper.php' );
801 include_once( LATEPOINT_ABSPATH . 'lib/helpers/notifications_helper.php' );
802 include_once( LATEPOINT_ABSPATH . 'lib/helpers/email_helper.php' );
803 include_once( LATEPOINT_ABSPATH . 'lib/helpers/sms_helper.php' );
804 include_once( LATEPOINT_ABSPATH . 'lib/helpers/styles_helper.php' );
805 include_once( LATEPOINT_ABSPATH . 'lib/helpers/work_periods_helper.php' );
806 include_once( LATEPOINT_ABSPATH . 'lib/helpers/bundles_helper.php' );
807 include_once( LATEPOINT_ABSPATH . 'lib/helpers/carts_helper.php' );
808 include_once( LATEPOINT_ABSPATH . 'lib/helpers/orders_helper.php' );
809 include_once( LATEPOINT_ABSPATH . 'lib/helpers/replacer_helper.php' );
810 include_once( LATEPOINT_ABSPATH . 'lib/helpers/payments_helper.php' );
811 include_once( LATEPOINT_ABSPATH . 'lib/helpers/resource_helper.php' );
812 include_once( LATEPOINT_ABSPATH . 'lib/helpers/meta_helper.php' );
813 include_once( LATEPOINT_ABSPATH . 'lib/helpers/shortcodes_helper.php' );
814 include_once( LATEPOINT_ABSPATH . 'lib/helpers/connector_helper.php' );
815 include_once( LATEPOINT_ABSPATH . 'lib/helpers/location_helper.php' );
816 include_once( LATEPOINT_ABSPATH . 'lib/helpers/csv_helper.php' );
817 include_once( LATEPOINT_ABSPATH . 'lib/helpers/steps_helper.php' );
818 include_once( LATEPOINT_ABSPATH . 'lib/helpers/params_helper.php' );
819 include_once( LATEPOINT_ABSPATH . 'lib/helpers/process_jobs_helper.php' );
820 include_once( LATEPOINT_ABSPATH . 'lib/helpers/blocks_helper.php' );
821 include_once( LATEPOINT_ABSPATH . 'lib/helpers/roles_helper.php' );
822 include_once( LATEPOINT_ABSPATH . 'lib/helpers/price_breakdown_helper.php' );
823 include_once( LATEPOINT_ABSPATH . 'lib/helpers/stripe_connect_helper.php' );
824 include_once( LATEPOINT_ABSPATH . 'lib/helpers/pages_helper.php' );
825 include_once( LATEPOINT_ABSPATH . 'lib/helpers/elementor_helper.php' );
826 include_once( LATEPOINT_ABSPATH . 'lib/helpers/bricks_helper.php' );
827 include_once( LATEPOINT_ABSPATH . 'lib/helpers/transaction_intent_helper.php' );
828 include_once( LATEPOINT_ABSPATH . 'lib/helpers/invoices_helper.php' );
829 include_once( LATEPOINT_ABSPATH . 'lib/helpers/support_topics_helper.php' );
830
831 // MISC
832 include_once( LATEPOINT_ABSPATH . 'lib/misc/time_period.php' );
833 include_once( LATEPOINT_ABSPATH . 'lib/misc/blocked_period.php' );
834 include_once( LATEPOINT_ABSPATH . 'lib/misc/booked_period.php' );
835 include_once( LATEPOINT_ABSPATH . 'lib/misc/stripe_connect_customer.php' );
836 include_once( LATEPOINT_ABSPATH . 'lib/misc/booking_request.php' );
837 include_once( LATEPOINT_ABSPATH . 'lib/misc/booking_resource.php' );
838 include_once( LATEPOINT_ABSPATH . 'lib/misc/work_period.php' );
839 include_once( LATEPOINT_ABSPATH . 'lib/misc/filter.php' );
840 include_once( LATEPOINT_ABSPATH . 'lib/misc/booking_slot.php' );
841 include_once( LATEPOINT_ABSPATH . 'lib/misc/process_event.php' );
842 include_once( LATEPOINT_ABSPATH . 'lib/misc/process_action.php' );
843 include_once( LATEPOINT_ABSPATH . 'lib/misc/role.php' );
844 include_once( LATEPOINT_ABSPATH . 'lib/misc/user.php' );
845 include_once( LATEPOINT_ABSPATH . 'lib/misc/step.php' );
846 include_once( LATEPOINT_ABSPATH . 'lib/misc/router.php' );
847
848 // MAILERS
849 include_once( LATEPOINT_ABSPATH . 'lib/mailers/mailer.php' );
850 include_once( LATEPOINT_ABSPATH . 'lib/mailers/agent_mailer.php' );
851 include_once( LATEPOINT_ABSPATH . 'lib/mailers/customer_mailer.php' );
852
853
854 do_action( 'latepoint_includes' );
855 }
856
857
858 /**
859 * Hook into actions and filters.
860 */
861 public function init_hooks() {
862 $siteurl = get_site_option( 'siteurl' );
863 if ( $siteurl ) {
864 $siteurl_hash = md5( $siteurl );
865 } else {
866 $siteurl_hash = '';
867 }
868
869 if ( ! defined( 'LATEPOINT_CUSTOMER_LOGGED_IN_COOKIE' ) ) {
870 define( 'LATEPOINT_CUSTOMER_LOGGED_IN_COOKIE', 'latepoint_customer_logged_in_' . $siteurl_hash );
871 }
872 if ( ! defined( 'LATEPOINT_ADMIN_MENU_LAYOUT_STYLE_COOKIE' ) ) {
873 define( 'LATEPOINT_ADMIN_MENU_LAYOUT_STYLE_COOKIE', 'latepoint_admin_menu_layout_style_' . $siteurl_hash );
874 }
875 if ( ! defined( 'LATEPOINT_SELECTED_TIMEZONE_COOKIE' ) ) {
876 define( 'LATEPOINT_SELECTED_TIMEZONE_COOKIE', 'latepoint_selected_timezone_' . $siteurl_hash );
877 }
878
879 if ( ! defined( 'LATEPOINT_CART_COOKIE' ) ) {
880 define( 'LATEPOINT_CART_COOKIE', 'latepoint_cart_' . $siteurl_hash );
881 }
882
883
884 // Activation hook
885 register_activation_hook( __FILE__, array( $this, 'create_required_tables' ) );
886 register_activation_hook( __FILE__, array( $this, 'on_activate' ) );
887 register_deactivation_hook( __FILE__, [ $this, 'on_deactivate' ] );
888
889
890 add_action( 'after_setup_theme', array( $this, 'setup_environment' ) );
891 add_action( 'init', array( $this, 'init' ), 0 );
892 add_action( 'init', array( $this, 'init_widgets' ), 11 );
893
894 add_action( 'admin_menu', array( $this, 'init_menus' ) );
895 add_action( 'wp_enqueue_scripts', array( $this, 'load_front_scripts_and_styles' ) );
896 add_action( 'admin_enqueue_scripts', array( $this, 'load_admin_scripts_and_styles' ) );
897 add_filter( 'admin_body_class', array( $this, 'add_admin_body_class' ), 40 );
898 add_filter( 'body_class', array( $this, 'add_body_class' ) );
899
900 add_filter( 'cron_schedules', [ $this, 'add_custom_cron_schedules' ] );
901
902 // used for testing of localhost to prevent wordpress issues with getting files from local server
903 if ( LATEPOINT_ALLOW_LOCAL_SERVER ) {
904 add_filter( 'http_request_args', [ $this, 'disable_localhost_url_check_for_development' ] );
905 }
906
907 // Add Link to latepoint to admin bar
908 add_action( 'admin_bar_menu', array( $this, 'add_latepoint_link_to_admin_bar' ), 999 );
909
910
911 // fix for output buffering error in WP
912 // remove_action( 'shutdown', 'wp_ob_end_flush_all', 1 );
913
914 add_action( 'wp_loaded', array( $this, 'pre_route_call' ) );
915
916
917 // Create router action
918 // ajax
919 add_action( 'wp_ajax_latepoint_route_call', array( $this, 'route_call' ) );
920 add_action( 'wp_ajax_nopriv_latepoint_route_call', array( $this, 'route_call' ) );
921 // admin custom post/get
922 add_action( 'admin_post_latepoint_route_call', array( $this, 'route_call' ) );
923 add_action( 'admin_post_nopriv_latepoint_route_call', array( $this, 'route_call' ) );
924
925 // crons
926 add_action( 'latepoint_clear_old_activity_logs', [ $this, 'clear_old_activity_logs' ] );
927
928
929 add_action( 'latepoint_on_addon_activate', [ $this, 'init_addon' ], 10, 2 );
930 add_action( 'latepoint_on_addon_deactivate', [ $this, 'deactivate_addon' ], 10, 2 );
931
932
933 add_action( 'latepoint_email_processor_settings', [ $this, 'email_processor_settings' ], 10, 2 );
934
935
936 // Auth
937 add_filter( 'login_redirect', [ $this, 'redirect_manager_and_agent_to_latepoint' ], 10, 3 );
938
939
940 // But WordPress has a whitelist of variables it allows, so we must put it on that list
941 add_action( 'query_vars', array( $this, 'front_route_query_vars' ) );
942
943 // If this is done, we can access it later
944 // This example checks very early in the process:
945 // if the variable is set, we include our page and stop execution after it
946 add_action( 'parse_request', array( $this, 'front_route_parse_request' ) );
947
948
949 add_action( 'admin_init', array( $this, 'redirect_after_activation' ) );
950
951 add_filter( 'display_post_states', 'OsPagesHelper::add_display_post_states', 10, 2);
952
953 // allow agents to access admin when woocommerce plugin is installed
954 add_filter( 'woocommerce_prevent_admin_access', [
955 $this,
956 'woocommerce_allow_agent_to_access_admin'
957 ], 20, 1 );
958
959 // plugin related hooks
960 add_action( 'latepoint_model_save', [ $this, 'save_connected_wordpress_user' ] );
961
962 // Stripe Connect
963
964 add_filter( 'latepoint_payment_processors', 'OsStripeConnectHelper::register_payment_processor' );
965 add_action( 'latepoint_payment_processor_settings', 'OsStripeConnectHelper::add_settings_fields', 10 );
966 add_action( 'latepoint_step_payment__pay_content', 'OsStripeConnectHelper::output_payment_step_contents', 10 );
967 add_action( 'latepoint_order_payment__pay_content_after', 'OsStripeConnectHelper::output_order_payment_pay_contents', 10 );
968
969 add_filter( 'latepoint_convert_charge_amount_to_requirements', 'OsStripeConnectHelper::convert_charge_amount_to_requirements', 10, 2 );
970 add_filter( 'latepoint_process_payment_for_order_intent', 'OsStripeConnectHelper::process_payment', 10, 2 );
971 add_filter( 'latepoint_process_payment_for_transaction_intent', 'OsStripeConnectHelper::process_payment_for_transaction_intent', 10, 2 );
972
973 add_filter( 'latepoint_get_all_payment_times', 'OsStripeConnectHelper::add_all_payment_methods_to_payment_times' );
974 add_filter( 'latepoint_get_enabled_payment_times', 'OsStripeConnectHelper::add_enabled_payment_methods_to_payment_times' );
975
976 add_action( 'latepoint_customer_edit_form_after', 'OsStripeConnectHelper::output_stripe_link_on_customer_quick_form' );
977
978 add_action('save_post', 'OsBlockHelper::save_blocks_styles');
979 // misc
980 add_action( 'latepoint_after_step_content', 'OsStepsHelper::output_preset_fields' );
981
982 OsActivitiesHelper::init_hooks();
983 OsProcessJobsHelper::init_hooks();
984
985 do_action('latepoint_init_hooks');
986 }
987
988
989 function add_custom_cron_schedules( $schedules ) {
990 if ( ! isset( $schedules['latepoint_5_minutes'] ) ) {
991 $schedules['latepoint_5_minutes'] = array(
992 'interval' => 5 * 60,
993 'display' => __( 'Once every 5 minutes', 'latepoint' )
994 );
995 }
996
997 return $schedules;
998 }
999
1000 function woocommerce_allow_agent_to_access_admin( $prevent_access ) {
1001 if ( OsAuthHelper::is_agent_logged_in() ) {
1002 $prevent_access = false;
1003 }
1004
1005 return $prevent_access;
1006 }
1007
1008 function email_processor_settings( $processor_code ) {
1009 if ( $processor_code == 'wp_mail' ) {
1010 echo '<div class="sub-section-row">
1011 <div class="sub-section-label">
1012 <h3>' . esc_html__( 'Email Settings', 'latepoint' ) . '</h3>
1013 </div>
1014 <div class="sub-section-content">
1015 <div class="os-row">
1016 <div class="os-col-4">' . OsFormHelper::text_field( 'settings[notification_email_setting_from_name]', __( 'From Name', 'latepoint' ), OsSettingsHelper::get_settings_value( 'notification_email_setting_from_name', get_bloginfo( 'name' ) ), [ 'theme' => 'simple' ] ) . '</div>
1017 <div class="os-col-8">' . OsFormHelper::text_field( 'settings[notification_email_setting_from_email]', __( 'From Email Address', 'latepoint' ), OsSettingsHelper::get_settings_value( 'notification_email_setting_from_email', get_bloginfo( 'admin_email' ) ), [ 'theme' => 'simple' ] ) . '</div>
1018 </div>
1019 </div>
1020 </div>';
1021 }
1022 }
1023
1024 public function save_connected_wordpress_user( $customer ) {
1025 if ( $customer->is_new_record() ) {
1026 return;
1027 }
1028 if ( $customer instanceof OsCustomerModel ) {
1029 if ( $customer->wordpress_user_id ) {
1030 // has connected wp user
1031 $wp_user = get_user_by( 'id', $customer->wordpress_user_id );
1032 if ( $wp_user && ! is_super_admin( $wp_user->ID ) ) {
1033 // update linked wordpress user
1034 if ( $customer->first_name && $customer->first_name != $wp_user->first_name ) {
1035 $wp_user->first_name = $customer->first_name;
1036 }
1037 if ( $customer->last_name && $customer->last_name != $wp_user->last_name ) {
1038 $wp_user->last_name = $customer->last_name;
1039 }
1040 if ( $customer->email && $customer->email != $wp_user->user_email ) {
1041 $wp_user->user_email = $customer->email;
1042 }
1043 $result = wp_update_user( $wp_user );
1044 if ( is_wp_error( $result ) ) {
1045 error_log( 'Error saving wp user' );
1046 } else {
1047 // update user cookies because their data has changed
1048 }
1049 }
1050 } else {
1051 if ( OsAuthHelper::wp_users_as_customers() ) {
1052 OsCustomerHelper::create_wp_user_for_customer( $customer );
1053 }
1054 }
1055 }
1056 }
1057
1058 // used for testing of localhost to prevent wordpress issues with getting files from local server
1059 public function disable_localhost_url_check_for_development( $parsed_args ) {
1060 $parsed_args['reject_unsafe_urls'] = false;
1061
1062 return $parsed_args;
1063 }
1064
1065 /*
1066 * Check if current user is Agent or Manager, automatically redirect to latepoint dashboard instead of default WordPress admin
1067 */
1068 public function redirect_manager_and_agent_to_latepoint( $redirect_to, $request, $user ) {
1069 if ( $user && is_object( $user ) && is_a( $user, 'WP_User' ) ) {
1070 if ( $user->has_cap( 'edit_bookings' ) || $user->has_cap( 'manage_latepoint' ) ) {
1071 return OsRouterHelper::build_link( [ 'dashboard', 'index' ] );
1072 }
1073 }
1074
1075 return $redirect_to;
1076 }
1077
1078
1079 public function clear_old_activity_logs() {
1080 global $wpdb;
1081 $activity = new OsActivityModel();
1082 $cutoff = OsTimeHelper::get_modified_now_object( '-1 week' )->format( LATEPOINT_DATETIME_DB_FORMAT );
1083 $wpdb->query( $wpdb->prepare( "DELETE FROM %i WHERE `created_at` < %s", [esc_sql($activity->table_name), $cutoff] ) );
1084 }
1085
1086 public function init_addon( $addon_name, $addon_version ) {
1087 OsDatabaseHelper::check_db_version_for_addons();
1088 }
1089
1090 public function deactivate_addon( $addon_name, $addon_version ) {
1091 OsDatabaseHelper::delete_addon_info( $addon_name, $addon_version );
1092 }
1093
1094
1095 public function on_deactivate() {
1096 wp_clear_scheduled_hook( 'latepoint_check_if_addons_update_available' );
1097 wp_clear_scheduled_hook( 'latepoint_clear_old_activity_logs' );
1098 }
1099
1100 function on_activate() {
1101 OsRolesHelper::register_roles_in_wp();
1102
1103 if ( ! wp_next_scheduled( 'latepoint_check_if_addons_update_available' ) ) {
1104 wp_schedule_event( time(), 'daily', 'latepoint_check_if_addons_update_available' );
1105 }
1106
1107 if ( ! wp_next_scheduled( 'latepoint_clear_old_activity_logs' ) ) {
1108 wp_schedule_event( time(), 'daily', 'latepoint_clear_old_activity_logs' );
1109 }
1110
1111 // if wizard has not been visited yet - redirect to it
1112 if ( ! get_option( 'latepoint_wizard_visited', false ) ) {
1113 add_option( 'latepoint_redirect_to_wizard', true );
1114 }
1115
1116 // create default location
1117 OsLocationHelper::get_default_location();
1118
1119 # create default pages if not existing (customer cabinet)
1120 OsPagesHelper::create_predefined_pages();
1121
1122 do_action( 'latepoint_on_activate', 'latepoint', $this->version );
1123 }
1124
1125 function redirect_after_activation() {
1126 if ( get_option( 'latepoint_redirect_to_wizard', false ) ) {
1127 delete_option( 'latepoint_redirect_to_wizard' );
1128 if ( ! isset( $_GET['activate-multi'] ) ) {
1129 wp_redirect( OsRouterHelper::build_link( OsRouterHelper::build_route_name( 'wizard', 'setup' ) ) );
1130 }
1131 } elseif ( get_option( 'latepoint_show_version_5_modal', false ) ) {
1132 delete_option( 'latepoint_show_version_5_modal' );
1133 if ( ! isset( $_GET['activate-multi'] ) ) {
1134 wp_redirect( OsRouterHelper::build_link( OsRouterHelper::build_route_name( 'settings', 'version_5_intro' ) ) );
1135 }
1136 }
1137 }
1138
1139 public function front_route_parse_request( $wp ) {
1140 if ( isset( $wp->query_vars['latepoint_is_custom_route'] ) ) {
1141 if ( isset( $wp->query_vars['route_name'] ) ) {
1142 $this->route_call();
1143 }
1144 }
1145 }
1146
1147 public function front_route_query_vars( $query_vars ) {
1148 $query_vars[] = 'latepoint_booking_id';
1149 $query_vars[] = 'latepoint_is_custom_route';
1150 $query_vars[] = 'route_name';
1151
1152 return $query_vars;
1153 }
1154
1155 public function route_call() {
1156 $route_name = OsRouterHelper::get_request_param( 'route_name', OsRouterHelper::build_route_name( 'dashboard', 'index' ) );
1157 OsRouterHelper::call_by_route_name( $route_name, OsRouterHelper::get_request_param( 'return_format', 'html' ) );
1158 }
1159
1160 public function pre_route_call() {
1161 if ( OsRouterHelper::get_request_param( 'pre_route' ) ) {
1162 $this->route_call();
1163 }
1164 }
1165
1166
1167
1168 /**
1169 * Init LatePoint when WordPress Initialises.
1170 */
1171 public function init() {
1172 OsAuthHelper::set_current_user();
1173 OsStepsHelper::init_step_actions();
1174 OsSettingsHelper::run_autoload();
1175 $this->register_post_types();
1176 $this->register_shortcodes();
1177 // Set up localisation.
1178 $this->load_plugin_textdomain();
1179 do_action( 'latepoint_init' );
1180 add_filter( 'http_request_host_is_external', '__return_true' );
1181
1182 OsBlockHelper::register_blocks();
1183 }
1184
1185 public function init_widgets( ) {
1186 OsElementorHelper::init();
1187 OsBricksHelper::init();
1188 }
1189
1190 public function load_plugin_textdomain() {
1191 load_plugin_textdomain( 'latepoint', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
1192 }
1193
1194
1195 /**
1196 * Register a custom menu page.
1197 */
1198 function init_menus() {
1199 // link for admins
1200 add_menu_page(
1201 __( 'LatePoint', 'latepoint' ),
1202 __( 'LatePoint', 'latepoint' ),
1203 OsAuthHelper::get_current_user()->wp_capability,
1204 'latepoint',
1205 [ $this, 'route_call' ],
1206 'none'
1207 );
1208
1209
1210 }
1211
1212
1213 function add_latepoint_link_to_admin_bar( $wp_admin_bar ) {
1214 if ( OsAuthHelper::get_current_user()->has_backend_access() ) {
1215 // build link depending on who is logged in
1216 $args = [
1217 'id' => 'latepoint_top_link',
1218 'title' => '<span class="latepoint-icon latepoint-icon-lp-logo" style="margin-right: 7px;"></span><span style="">' . __( 'LatePoint', 'latepoint' ) . '</span>',
1219 'href' => OsRouterHelper::build_link( [ 'dashboard', 'index' ] ),
1220 'meta' => array( 'class' => '' )
1221 ];
1222 $wp_admin_bar->add_node( $args );
1223 }
1224 }
1225
1226
1227 /**
1228 * Register shortcodes
1229 */
1230 public function register_shortcodes() {
1231 add_shortcode( 'latepoint_book_button', array( 'OsShortcodesHelper', 'shortcode_latepoint_book_button' ) );
1232 add_shortcode( 'latepoint_book_form', array( 'OsShortcodesHelper', 'shortcode_latepoint_book_form' ) );
1233 add_shortcode( 'latepoint_customer_dashboard', array(
1234 'OsShortcodesHelper',
1235 'shortcode_latepoint_customer_dashboard'
1236 ) );
1237 add_shortcode( 'latepoint_customer_login', array(
1238 'OsShortcodesHelper',
1239 'shortcode_latepoint_customer_login'
1240 ) );
1241 add_shortcode( 'latepoint_resources', array( 'OsShortcodesHelper', 'shortcode_latepoint_resources' ) );
1242 add_shortcode( 'latepoint_calendar', array( 'OsShortcodesHelper', 'shortcode_latepoint_calendar' ) );
1243 }
1244
1245 /*
1246
1247 SHORTCODES
1248
1249 */
1250
1251
1252 public function setup_environment() {
1253 if ( ! current_theme_supports( 'post-thumbnails' ) ) {
1254 add_theme_support( 'post-thumbnails' );
1255 }
1256 add_post_type_support( LATEPOINT_AGENT_POST_TYPE, 'thumbnail' );
1257 add_post_type_support( LATEPOINT_SERVICE_POST_TYPE, 'thumbnail' );
1258 add_post_type_support( LATEPOINT_CUSTOMER_POST_TYPE, 'thumbnail' );
1259 }
1260
1261
1262 public function create_required_tables() {
1263 OsDatabaseHelper::run_setup();
1264 }
1265
1266
1267 /**
1268 * Register core post types.
1269 */
1270 public function register_post_types() {
1271 }
1272
1273
1274
1275 /**
1276 * Register scripts and styles - FRONT
1277 */
1278 public function load_front_scripts_and_styles() {
1279 $localized_vars = [
1280 'route_action' => 'latepoint_route_call',
1281 'response_status' => [ 'success' => 'success', 'error' => 'error' ],
1282 'ajaxurl' => admin_url( 'admin-ajax.php' ),
1283 'time_pick_style' => OsStepsHelper::get_time_pick_style(),
1284 'string_today' => __( 'Today', 'latepoint' ),
1285 'reload_booking_form_summary_route' => OsRouterHelper::build_route_name( 'steps', 'reload_booking_form_summary_panel' ),
1286 'time_system' => OsTimeHelper::get_time_system(),
1287 'msg_not_available' => __( 'Not Available', 'latepoint' ),
1288 'booking_button_route' => OsRouterHelper::build_route_name( 'steps', 'start' ),
1289 'remove_cart_item_route' => OsRouterHelper::build_route_name( 'carts', 'remove_item_from_cart' ),
1290 'show_booking_end_time' => ( OsSettingsHelper::is_on( 'show_booking_end_time' ) ) ? 'yes' : 'no',
1291 'customer_dashboard_url' => OsSettingsHelper::get_customer_dashboard_url( true ),
1292 'demo_mode' => OsSettingsHelper::is_env_demo(),
1293 'cancel_booking_prompt' => __( 'Are you sure you want to cancel this appointment?', 'latepoint' ),
1294 'single_space_message' => __( 'Space Available', 'latepoint' ),
1295 'many_spaces_message' => __( 'Spaces Available', 'latepoint' ),
1296 'body_font_family' => '"latepoint", -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif ',
1297 'headings_font_family' => '"latepoint", -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif ',
1298 'currency_symbol_before' => OsSettingsHelper::get_settings_value( 'currency_symbol_before', '' ),
1299 'currency_symbol_after' => OsSettingsHelper::get_settings_value( 'currency_symbol_after', '' ),
1300 'thousand_separator' => OsSettingsHelper::get_settings_value( 'thousand_separator', ',' ),
1301 'decimal_separator' => OsSettingsHelper::get_settings_value( 'decimal_separator', '.' ),
1302 'number_of_decimals' => OsSettingsHelper::get_settings_value( 'number_of_decimals', '2' ),
1303 'included_phone_countries' => wp_json_encode( OsSettingsHelper::get_included_phone_countries() ),
1304 'default_phone_country' => OsSettingsHelper::get_default_phone_country(),
1305 'is_timezone_selected' => OsTimeHelper::is_timezone_saved_in_session(),
1306 'start_from_order_intent_route' => OsRouterHelper::build_route_name( 'steps', 'start_from_order_intent' ),
1307 'start_from_order_intent_key' => OsRouterHelper::get_request_param( 'latepoint_order_intent_key' ) ? OsRouterHelper::get_request_param( 'latepoint_order_intent_key' ) : '',
1308 'is_enabled_show_dial_code_with_flag' => OsSettingsHelper::is_enabled_show_dial_code_with_flag(),
1309 'mask_phone_number_fields' => OsSettingsHelper::is_on( 'mask_phone_number_fields', LATEPOINT_VALUE_ON ),
1310 'msg_validation_presence' => __( 'can not be blank', 'latepoint' ),
1311 'msg_validation_presence_checkbox' => __( 'has to be checked', 'latepoint' ),
1312 'msg_validation_invalid' => __( 'is invalid', 'latepoint' ),
1313 'msg_minutes_suffix' => __( ' minutes', 'latepoint' ),
1314 'is_stripe_connect_enabled' => OsPaymentsHelper::is_payment_processor_enabled( OsStripeConnectHelper::$processor_code ),
1315 'check_order_intent_bookable_route' => OsRouterHelper::build_route_name( 'steps', 'check_order_intent_bookable' ),
1316 'payment_environment' => OsSettingsHelper::get_payments_environment(),
1317 'style_border_radius' => OsSettingsHelper::get_booking_form_border_radius(),
1318 'datepicker_timeslot_selected_label' => __('Selected', 'latepoint'),
1319 'invoices_payment_form_route' => OsRouterHelper::build_route_name('invoices', 'payment_form')
1320 ];
1321
1322 if ( OsPaymentsHelper::is_payment_processor_enabled( OsStripeConnectHelper::$processor_code ) ) {
1323 $localized_vars['stripe_connect_key'] = OsStripeConnectHelper::get_connect_publishable_key();
1324 $localized_vars['stripe_connected_account_id'] = OsStripeConnectHelper::get_connect_account_id();
1325 }
1326 $localized_vars['stripe_connect_route_create_payment_intent'] = OsRouterHelper::build_route_name( 'stripe_connect', 'create_payment_intent' );
1327 $localized_vars['stripe_connect_route_create_payment_intent_for_transaction_intent'] = OsRouterHelper::build_route_name( 'stripe_connect', 'create_payment_intent_for_transaction' );
1328
1329 // Stylesheets
1330 wp_enqueue_style( 'latepoint-main-front', $this->public_stylesheets() . 'front.css', false, $this->version );
1331
1332 // add styles from options if gutenberg blocks exists
1333 OsBlockHelper::add_block_styles_to_page();
1334
1335 // Javscripts
1336
1337 // Addon scripts and styles
1338 do_action( 'latepoint_wp_enqueue_scripts' );
1339
1340 if ( OsPaymentsHelper::is_payment_processor_enabled( OsStripeConnectHelper::$processor_code ) ) {
1341 wp_enqueue_script( 'stripe', 'https://js.stripe.com/v3/', false, null );
1342 }
1343
1344 wp_register_script( 'latepoint-vendor-front', $this->public_javascripts() . 'vendor-front.js', [ 'jquery' ], $this->version );
1345 wp_register_script( 'latepoint-main-front', $this->public_javascripts() . 'front.js', [
1346 'jquery',
1347 'latepoint-vendor-front',
1348 'wp-i18n'
1349 ], $this->version );
1350
1351
1352 $localized_vars = apply_filters( 'latepoint_localized_vars_front', $localized_vars );
1353
1354 wp_localize_script( 'latepoint-main-front', 'latepoint_helper', $localized_vars );
1355 wp_enqueue_script( 'latepoint-main-front' );
1356
1357
1358 $latepoint_css_variables = OsStylesHelper::generate_css_variables();
1359 wp_add_inline_style( 'latepoint-main-front', $latepoint_css_variables );
1360 }
1361
1362 public function add_admin_body_class( $classes ) {
1363 if ( ( is_admin() ) && isset( $_GET['page'] ) && $_GET['page'] == 'latepoint' ) {
1364 $classes = $classes . ' latepoint-admin latepoint';
1365 }
1366
1367 return $classes;
1368 }
1369
1370 public function add_body_class( $classes ) {
1371 $classes[] = 'latepoint';
1372
1373 return $classes;
1374 }
1375
1376
1377 /**
1378 * Register admin scripts and styles - ADMIN
1379 */
1380 public function load_admin_scripts_and_styles() {
1381 // Stylesheets
1382 wp_enqueue_style( 'latepoint-blocks-editor', LatePoint::plugin_url() . 'blocks/assets/css/editor-styles.css', array( 'wp-edit-blocks' ), $this->version );
1383 wp_enqueue_style( 'latepoint-main-admin', $this->public_stylesheets() . 'admin.css', false, $this->version );
1384
1385 // Javscripts
1386 wp_enqueue_media();
1387
1388
1389 wp_enqueue_script( 'latepoint-vendor-admin', $this->public_javascripts() . 'vendor-admin.js', [ 'jquery' ], $this->version );
1390 wp_enqueue_script( 'latepoint-main-admin', $this->public_javascripts() . 'admin.js', [
1391 'jquery',
1392 'latepoint-vendor-admin',
1393 'wp-i18n'
1394 ], $this->version );
1395
1396
1397 do_action( 'latepoint_admin_enqueue_scripts' );
1398
1399 $localized_vars = [
1400 'route_action' => 'latepoint_route_call',
1401 'response_status' => [ 'success' => 'success', 'error' => 'error' ],
1402 'ajaxurl' => admin_url( 'admin-ajax.php' ),
1403 'value_all' => LATEPOINT_ALL,
1404 'value_on' => LATEPOINT_VALUE_ON,
1405 'value_off' => LATEPOINT_VALUE_OFF,
1406 'body_font_family' => '"latepoint", -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif ',
1407 'headings_font_family' => '"latepoint", -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif ',
1408 'wp_locale' => get_locale(),
1409 'string_today' => __( 'Today', 'latepoint' ),
1410 'click_to_copy_done' => __( 'Copied', 'latepoint' ),
1411 'click_to_copy_prompt' => __( 'Just click to copy', 'latepoint' ),
1412 'approve_confirm' => __( 'Are you sure you want to approve this booking?', 'latepoint' ),
1413 'reject_confirm' => __( 'Are you sure you want to reject this booking?', 'latepoint' ),
1414 'time_system' => OsTimeHelper::get_time_system(),
1415 'msg_not_available' => __( 'Not Available', 'latepoint' ),
1416 'msg_addon_activated' => __( 'Active', 'latepoint' ),
1417 'datepicker_timeslot_selected_label' => __( 'Selected', 'latepoint' ),
1418 'string_minutes' => __( 'minutes', 'latepoint' ),
1419 'single_space_message' => __( 'Space Available', 'latepoint' ),
1420 'many_spaces_message' => __( 'Spaces Available', 'latepoint' ),
1421 'currency_symbol_before' => OsSettingsHelper::get_settings_value( 'currency_symbol_before', '' ),
1422 'currency_symbol_after' => OsSettingsHelper::get_settings_value( 'currency_symbol_after', '' ),
1423 'thousand_separator' => OsSettingsHelper::get_settings_value( 'thousand_separator', ',' ),
1424 'decimal_separator' => OsSettingsHelper::get_settings_value( 'decimal_separator', '.' ),
1425 'number_of_decimals' => OsSettingsHelper::get_settings_value( 'number_of_decimals', '2' ),
1426 'included_phone_countries' => wp_json_encode( OsSettingsHelper::get_included_phone_countries() ),
1427 'default_phone_country' => OsSettingsHelper::get_default_phone_country(),
1428 'date_format' => OsSettingsHelper::get_date_format(),
1429 'date_format_for_js' => OsSettingsHelper::get_date_format_for_js(),
1430 'is_enabled_show_dial_code_with_flag' => OsSettingsHelper::is_enabled_show_dial_code_with_flag(),
1431 'mask_phone_number_fields' => OsSettingsHelper::is_on( 'mask_phone_number_fields', LATEPOINT_VALUE_ON ),
1432 'msg_validation_presence' => __( 'can not be blank', 'latepoint' ),
1433 'msg_validation_presence_checkbox' => __( 'has to be checked', 'latepoint' ),
1434 'msg_validation_invalid' => __( 'is invalid', 'latepoint' ),
1435 'msg_minutes_suffix' => __( ' minutes', 'latepoint' ),
1436 'order_item_variant_booking' => LATEPOINT_ITEM_VARIANT_BOOKING,
1437 'order_item_variant_bundle' => LATEPOINT_ITEM_VARIANT_BUNDLE
1438 ];
1439
1440 // Add block related variables
1441 $localized_vars = array_merge($localized_vars, OsBlockHelper::localized_vars_for_blocks());
1442
1443 /**
1444 * Array of localized variables to be available in latepoint_helper object in admin
1445 *
1446 * @since 5.0.0
1447 * @hook latepoint_localized_vars_admin
1448 *
1449 * @param {array} $localized_vars The default array being filtered
1450 * @returns {array} The filtered array of localized variables
1451 */
1452 $localized_vars = apply_filters( 'latepoint_localized_vars_admin', $localized_vars );
1453
1454 wp_localize_script( 'latepoint-main-admin', 'latepoint_helper', $localized_vars );
1455
1456
1457 $latepoint_css_variables = OsStylesHelper::generate_css_variables();
1458 wp_add_inline_style( 'latepoint-main-admin', $latepoint_css_variables );
1459
1460 }
1461
1462 }
1463 endif;
1464
1465
1466 $LATEPOINT = new LatePoint();