PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.16.8.1
GiveWP – Donation Plugin and Fundraising Platform v4.16.8.1
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 / FormBuilder / Actions / DequeueAdminScriptsInFormBuilder.php

DequeueAdminScriptsInFormBuilder.php in GiveWP – Donation Plugin and Fundraising Platform 4.16.8.1, at src/FormBuilder/Actions/DequeueAdminScriptsInFormBuilder.php

47 lines 1002 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Give\FormBuilder\Actions;
4
5 use Give\FormBuilder\FormBuilderRouteBuilder;
6
7 /**
8 * Since our form builder exists inside a WP admin page, it comes with a lot of baggage that we don't need.
9 * This removes the unnecessary scripts before the page is loaded.
10 *
11 * @since 3.0.0
12 */
13 class DequeueAdminScriptsInFormBuilder
14 {
15 /**
16 * @since 3.0.0
17 *
18 * @return void
19 */
20 public function __invoke()
21 {
22 if ($this->isFormBuilderRoute()) {
23 $wpScripts = wp_scripts();
24
25 $legacyGiveScripts = [
26 'give',
27 'give-admin-scripts',
28 'plugin-deactivation-survey-js',
29 'admin-add-ons-js',
30 'give-stripe-admin-js'
31 ];
32
33 $wpScripts->dequeue($legacyGiveScripts);
34 }
35 }
36
37 /**
38 * @since 3.0.0
39 *
40 * @return bool
41 */
42 protected function isFormBuilderRoute(): bool
43 {
44 return FormBuilderRouteBuilder::isRoute();
45 }
46 }
47