PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.16.9
GiveWP – Donation Plugin and Fundraising Platform v4.16.9
4.16.9 4.16.8.1 4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 2.30.0 All 255 releases
give / src / DonationForms / AsyncData / Actions / LoadAsyncDataAssets.php

LoadAsyncDataAssets.php in GiveWP – Donation Plugin and Fundraising Platform 4.16.9, at src/DonationForms/AsyncData/Actions/LoadAsyncDataAssets.php

66 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Give\DonationForms\AsyncData\Actions;
4
5 /**
6 * @since 3.16.0
7 */
8 class LoadAsyncDataAssets
9 {
10 /**
11 * @since 3.16.0
12 */
13 public function __invoke()
14 {
15 LoadAsyncDataAssets::registerAssets();
16 LoadAsyncDataAssets::enqueueAssets();
17 }
18
19 /**
20 * @since 3.16.0
21 */
22 public static function handleName(): string
23 {
24 return 'givewp-form-donations-async-data';
25 }
26
27 /**
28 * @since 3.16.0
29 */
30 public static function registerAssets()
31 {
32 wp_register_style(
33 LoadAsyncDataAssets::handleName(),
34 GIVE_PLUGIN_URL . 'build/assets/dist/css/give-donation-forms-load-async-data.css',
35 [],
36 GIVE_VERSION
37 );
38
39 wp_register_script(
40 LoadAsyncDataAssets::handleName(),
41 GIVE_PLUGIN_URL . 'build/assets/dist/js/give-donation-forms-load-async-data.js',
42 [],
43 GIVE_VERSION,
44 true
45 );
46
47 wp_localize_script(LoadAsyncDataAssets::handleName(), 'GiveDonationFormsAsyncData',
48 [
49 'ajaxUrl' => admin_url('admin-ajax.php'),
50 'ajaxNonce' => wp_create_nonce('GiveDonationFormsAsyncDataAjaxNonce'),
51 'scriptDebug' => defined('SCRIPT_DEBUG') && SCRIPT_DEBUG,
52 'throttlingEnabled' => ! defined('GIVE_ASYNC_DATA_THROTTLING') || GIVE_ASYNC_DATA_THROTTLING,
53 ]
54 );
55 }
56
57 /**
58 * @since 3.16.0
59 */
60 public static function enqueueAssets()
61 {
62 wp_enqueue_style(LoadAsyncDataAssets::handleName());
63 wp_enqueue_script(LoadAsyncDataAssets::handleName());
64 }
65 }
66