PluginProbe
Additional Terms Lite for WooCommerce / 1.6.0
Additional Terms Lite for WooCommerce v1.6.0
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 1.6.0, at src/Assets.php

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