PluginProbe
Additional Terms Lite for WooCommerce / trunk
Additional Terms Lite for WooCommerce vtrunk
1.7.3 1.7.2.1 trunk 1.0.1 1.0.2 1.1.0 1.2.0 1.2.1 1.2.2 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.4.0 1.4.1 1.5.0 1.5.1 1.5.2 1.6.0 1.6.1 1.6.2 1.6.3 All 35 releases
woo-additional-terms / src / Assets.php

Assets.php in Additional Terms Lite for WooCommerce trunk, at src/Assets.php

137 lines 3.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * The plugin assets (static resources).
4 *
5 * @since 1.0.0
6 *
7 * @package woo-additional-terms
8 */
9
10 namespace Woo_Additional_Terms;
11
12 use Woo_Additional_Terms\Enhancements\Notices;
13
14 /**
15 * Load plugin static resources (CSS and JS files).
16 */
17 abstract class Assets {
18
19 /**
20 * Enqueue editor scripts and styles.
21 *
22 * @since 1.5.0
23 *
24 * @return void
25 */
26 public static function enqueue_editor() {
27
28 wp_register_script(
29 'woo-additional-terms-block',
30 woo_additional_terms()->service( 'file' )->asset_path( 'block.js' ),
31 array( 'react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n', 'wp-primitives', 'wc-blocks-checkout', 'wc-settings' ),
32 woo_additional_terms()->get_version(),
33 true
34 );
35 }
36
37 /**
38 * Enqueue admin scripts and styles.
39 *
40 * @since 1.0.0
41 *
42 * @return void
43 */
44 public static function enqueue_admin() {
45
46 $version = woo_additional_terms()->get_version();
47
48 wp_register_style(
49 'woo-additional-terms-admin',
50 woo_additional_terms()->service( 'file' )->asset_path( 'admin.css' ),
51 array( 'woocommerce_admin_styles' ),
52 $version,
53 'screen'
54 );
55 wp_register_script(
56 'woo-additional-terms-admin',
57 woo_additional_terms()->service( 'file' )->asset_path( 'admin.js' ),
58 array( 'jquery' ),
59 $version,
60 true
61 );
62
63 wp_register_style(
64 'woo-additional-terms-rate',
65 woo_additional_terms()->service( 'file' )->asset_path( 'rate.css' ),
66 array(),
67 $version,
68 'screen'
69 );
70
71 wp_register_script(
72 'woo-additional-terms-dismiss',
73 woo_additional_terms()->service( 'file' )->asset_path( 'dismiss.js' ),
74 array( 'jquery' ),
75 $version,
76 true
77 );
78 wp_localize_script(
79 'woo-additional-terms-dismiss',
80 'woo_additional_terms_params',
81 array(
82 'dismiss_nonce' => wp_create_nonce( Notices::DISMISS_NONCE_NAME ),
83 )
84 );
85 }
86
87 /**
88 * Enqueue front-end scripts and styles.
89 *
90 * @since 1.0.0
91 *
92 * @return void
93 */
94 public static function enqueue_frontend() {
95
96 $version = woo_additional_terms()->get_version();
97
98 wp_register_style(
99 'woo-additional-terms',
100 woo_additional_terms()->service( 'file' )->asset_path( 'style.css' ),
101 array(),
102 $version,
103 'screen'
104 );
105 wp_register_script(
106 'woo-additional-terms',
107 woo_additional_terms()->service( 'file' )->asset_path( 'script.js' ),
108 array( 'jquery', 'wc-checkout' ),
109 $version,
110 true
111 );
112
113 wp_register_script(
114 'woo-additional-terms-checkout',
115 woo_additional_terms()->service( 'file' )->asset_path( 'checkout.js' ),
116 array( 'react', 'wp-compose', 'wp-data', 'wp-element', 'wp-i18n', 'wc-blocks-data-store', 'wc-blocks-checkout', 'wc-settings' ),
117 $version,
118 true
119 );
120
121 wp_register_style(
122 'jquery.fancybox',
123 woo_additional_terms()->service( 'file' )->asset_path( 'jquery.fancybox.css' ),
124 array( 'woo-additional-terms' ),
125 '3.5.6',
126 'screen'
127 );
128 wp_register_script(
129 'jquery.fancybox',
130 woo_additional_terms()->service( 'file' )->asset_path( 'jquery.fancybox.js' ),
131 array( 'jquery', 'woo-additional-terms' ),
132 '3.5.6',
133 true
134 );
135 }
136 }
137