PluginProbe
Booktics – Appointment Booking Calendar for Service Businesses / 1.0.3
Booktics – Appointment Booking Calendar for Service Businesses v1.0.3
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
booktics / trunk / core / assets / frontend-assets.php

frontend-assets.php in Booktics – Appointment Booking Calendar for Service Businesses 1.0.3, at trunk/core/assets/frontend-assets.php

79 lines 2.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Booktics\Assets;
3
4 /**
5 * Manage all frontend scripts and styles
6 */
7 class Frontend_Assets extends Base_Assets {
8 /**
9 * Register single service
10 *
11 * @return void
12 */
13 public function register() {
14 add_action( 'wp_enqueue_scripts', [$this, 'register_styles_scripts'] );
15 add_action( 'wp_enqueue_scripts', [$this, 'enqueue'] );
16 }
17
18 /**
19 * Enqueue scripts and styles
20 *
21 * @return void
22 */
23 public function enqueue() {
24 wp_enqueue_style( 'booktics-vendor' );
25 wp_enqueue_style( 'booktics-frontend' );
26
27 wp_enqueue_script( 'booktics-packages' );
28 wp_enqueue_script( 'booktics-frontend-scripts' );
29 wp_enqueue_script( 'booktics-flatpickr-scripts' );
30
31 wp_localize_script( 'booktics-packages', 'booktics', Localize::get_frontend() );
32 wp_localize_script( 'booktics-packages', 'booktics_enabled_modules', booktics_get_enabled_modules() );
33 }
34
35 /**
36 * Get all scripts
37 *
38 * @return array List register scripts
39 */
40 public function get_scripts(): array {
41 $scripts = [
42 'booktics-frontend-scripts' => [
43 'src' => booktics()->assets_url . '/build/js/frontend.js',
44 'deps' => ['booktics-packages'],
45 'in_footer' => true,
46 ],
47 'booktics-packages' => [
48 'src' => booktics()->assets_url . '/build/js/packages.js',
49 'deps' => ['wp-i18n'],
50 'in_footer' => true,
51 ],
52 'booktics-flatpickr-scripts' => [
53 'src' => booktics()->assets_url . '/js/vendors/flatpickr.js',
54 'deps' => ['wp-plugins', 'wp-i18n', 'wp-element', 'wp-dom', 'wp-data' ],
55 'in_footer' => true,
56 ],
57 ];
58
59 return apply_filters( 'booktics_frontend_assets', $scripts );
60 }
61
62 /**
63 * List of register styles
64 *
65 * @return array
66 */
67 public function get_styles(): array {
68 $styles = [
69 'booktics-vendor' => [
70 'src' => booktics()->assets_url . '/build/css/vendor.css',
71 ],
72 'booktics-frontend' => [
73 'src' => booktics()->assets_url . '/build/css/frontend.css',
74 ],
75 ];
76
77 return apply_filters( 'booktics_frontend_styles', $styles );
78 }
79 }