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
← All changes | includes/class-give-scripts.php +35 -22 2.30.04.16.9 View file →
@@ -1,7 +1,9 @@
1 1 <?php
2 2
3 +use Give\Framework\Support\Facades\Scripts\ScriptAsset;
3 4 use Give\Helpers\EnqueueScript;
5 +use Give\Helpers\Language;
4 6
5 7 /**
6 8 * Loads the plugin's scripts and styles.
7 9 *
@@ -90,17 +92,17 @@
90 92 */
91 93 public function register_styles() {
92 94
93 95 // Global WP-admin.
94 - wp_register_style( 'give-admin-global-styles', GIVE_PLUGIN_URL . 'assets/dist/css/admin-global' . $this->direction . '.css', [], GIVE_VERSION );
96 + wp_register_style( 'give-admin-global-styles', GIVE_PLUGIN_URL . 'build/assets/dist/css/admin-global' . $this->direction . '.css', [], GIVE_VERSION );
95 97
96 98 // GiveWP-only WP-admin.
97 - wp_register_style( 'give-admin-styles', GIVE_PLUGIN_URL . 'assets/dist/css/admin' . $this->direction . '.css', [], GIVE_VERSION );
99 + wp_register_style( 'give-admin-styles', GIVE_PLUGIN_URL . 'build/assets/dist/css/admin' . $this->direction . '.css', [], GIVE_VERSION );
98 100
99 101 // WP-admin: plugin page.
100 102 wp_register_style(
101 103 'plugin-deactivation-survey-css',
102 - GIVE_PLUGIN_URL . 'assets/dist/css/plugin-deactivation-survey.css',
104 + GIVE_PLUGIN_URL . 'build/assets/dist/css/plugin-deactivation-survey.css',
103 105 [],
104 106 GIVE_VERSION
105 107 );
106 108
@@ -118,9 +120,9 @@
118 120 public function register_scripts() {
119 121 // WP-Admin.
120 122 EnqueueScript::make(
121 123 'give-admin-scripts',
122 - 'assets/dist/js/admin.js'
124 + 'build/assets/dist/js/admin.js'
123 125 )
124 126 ->dependencies(
125 127 [
126 128 'jquery',
@@ -134,9 +136,9 @@
134 136
135 137 // WP-admin: plugin page.
136 138 wp_register_script(
137 139 'plugin-deactivation-survey-js',
138 - GIVE_PLUGIN_URL . 'assets/dist/js/plugin-deactivation-survey.js',
140 + GIVE_PLUGIN_URL . 'build/assets/dist/js/plugin-deactivation-survey.js',
139 141 [ 'jquery' ],
140 142 GIVE_VERSION,
141 143 true
142 144 );
@@ -143,9 +145,9 @@
143 145
144 146 // WP-admin: add-ons page.
145 147 wp_register_script(
146 148 'admin-add-ons-js',
147 - GIVE_PLUGIN_URL . 'assets/dist/js/admin-add-ons.js',
149 + GIVE_PLUGIN_URL . 'build/assets/dist/js/admin-add-ons.js',
148 150 [ 'jquery' ],
149 151 GIVE_VERSION,
150 152 true
151 153 );
@@ -150,9 +152,9 @@
150 152 true
151 153 );
152 154
153 155 // Frontend.
154 - $giveScript = EnqueueScript::make('give', 'assets/dist/js/give.js')
156 + $giveScript = EnqueueScript::make('give', 'build/assets/dist/js/give.js')
155 157 ->registerTranslations();
156 158
157 159 if (self::$scripts_footer) {
158 160 $giveScript->loadInFooter();
@@ -261,8 +263,9 @@
261 263 /**
262 264 * Localize admin scripts.
263 265 *
264 266 * @since 2.25.3 Add nonce for payment note AJAX requests.
267 + * @since 4.15.4 Add nonce for give_set_notification_status AJAX request.
265 268 */
266 269 public function admin_localize_scripts() {
267 270
268 271 global $post;
@@ -388,11 +391,15 @@
388 391 'db_update_confirmation_msg' => __( 'The following process will make updates to your site\'s database. Please create a database backup before proceeding with updates.', 'give' ),
389 392 'error_message' => __( 'Something went wrong kindly try again!', 'give' ),
390 393 'give_donation_import' => 'give_donation_import',
391 394 'give_donation_import_nonce' => wp_create_nonce('give_donation_import'),
395 + 'give_subscription_import' => 'give_subscription_import',
396 + 'give_subscription_import_nonce' => wp_create_nonce('give_subscription_import'),
392 397 'core_settings_import' => 'give_core_settings_import',
393 - 'give_insert_payment_note_nonce' => wp_create_nonce('give_insert_payment_note'),
394 - 'give_delete_payment_note_nonce' => wp_create_nonce('give_delete_payment_note'),
398 + 'core_settings_import_nonce' => wp_create_nonce('give_core_settings_import'),
399 + 'give_insert_payment_note_nonce' => wp_create_nonce('give_insert_payment_note'),
400 + 'give_delete_payment_note_nonce' => wp_create_nonce('give_delete_payment_note'),
401 + 'give_set_notification_status_nonce' => wp_create_nonce('give_set_notification_status'),
395 402 'setting_not_save_message' => __( 'Changes you made may not be saved.', 'give' ),
396 403 'give_donation_amounts' => [
397 404 'minimum' => apply_filters( 'give_donation_minimum_limit', 1 ),
398 405 'maximum' => apply_filters( 'give_donation_maximum_limit', 999999.99 ),
@@ -425,12 +432,12 @@
425 432 ?>
426 433 <style type="text/css" media="screen">
427 434 @font-face {
428 435 font-family: 'give-icomoon';
429 - src: url('<?php echo GIVE_PLUGIN_URL . 'assets/dist/fonts/icomoon.eot?ngjl88'; ?>');
430 - src: url('<?php echo GIVE_PLUGIN_URL . 'assets/dist/fonts/icomoon.eot?#iefixngjl88'; ?>') format('embedded-opentype'),
431 - url('<?php echo GIVE_PLUGIN_URL . 'assets/dist/fonts/icomoon.woff?ngjl88'; ?>') format('woff'),
432 - url('<?php echo GIVE_PLUGIN_URL . 'assets/dist/fonts/icomoon.svg?ngjl88#icomoon'; ?>') format('svg');
436 + src: url('<?php echo GIVE_PLUGIN_URL . 'build/assets/dist/fonts/icomoon.eot?ngjl88'; ?>');
437 + src: url('<?php echo GIVE_PLUGIN_URL . 'build/assets/dist/fonts/icomoon.eot?#iefixngjl88'; ?>') format('embedded-opentype'),
438 + url('<?php echo GIVE_PLUGIN_URL . 'build/assets/dist/fonts/icomoon.woff?ngjl88'; ?>') format('woff'),
439 + url('<?php echo GIVE_PLUGIN_URL . 'build/assets/dist/fonts/icomoon.svg?ngjl88#icomoon'; ?>') format('svg');
433 440 font-weight: normal;
434 441 font-style: normal;
435 442 }
436 443
@@ -567,9 +574,9 @@
567 574 $child_theme_style_sheet = trailingslashit( get_stylesheet_directory() ) . $templates_dir . $file;
568 575 $child_theme_style_sheet_2 = trailingslashit( get_stylesheet_directory() ) . $templates_dir . 'give' . $this->direction . '.css';
569 576 $parent_theme_style_sheet = trailingslashit( get_template_directory() ) . $templates_dir . $file;
570 577 $parent_theme_style_sheet_2 = trailingslashit( get_template_directory() ) . $templates_dir . 'give' . $this->direction . '.css';
571 - $give_plugin_style_sheet = trailingslashit( GIVE_PLUGIN_DIR ) . 'assets/dist/css/' . $file;
578 + $give_plugin_style_sheet = trailingslashit( GIVE_PLUGIN_DIR ) . 'build/assets/dist/css/' . $file;
572 579 $uri = false;
573 580
574 581 /**
575 582 * Locate the Give stylesheet:
@@ -591,9 +598,9 @@
591 598 } else {
592 599 $uri = trailingslashit( get_template_directory_uri() ) . $templates_dir . $file;
593 600 }
594 601 } elseif ( file_exists( $give_plugin_style_sheet ) ) {
595 - $uri = trailingslashit( GIVE_PLUGIN_URL ) . 'assets/dist/css/' . $file;
602 + $uri = trailingslashit( GIVE_PLUGIN_URL ) . 'build/assets/dist/css/' . $file;
596 603 }
597 604
598 605 return apply_filters( 'give_get_stylesheet_uri', $uri );
599 606
@@ -601,8 +608,9 @@
601 608
602 609 /**
603 610 * Gutenberg admin scripts.
604 611 *
612 + * @since 3.1.0 Use wp scripts to compile blocks
605 613 * @since 2.19.0 Remove undefined gutenberg.css
606 614 * @since 2.19.6 Load script with EnqueueScript.
607 615 * @since 2.19.6 Load missing block styles
608 616 */
@@ -607,20 +615,25 @@
607 615 * @since 2.19.6 Load missing block styles
608 616 */
609 617 public function gutenberg_admin_scripts()
610 618 {
611 - // Enqueue the bundled block JS file
612 - EnqueueScript::make('give-blocks-js', 'assets/dist/js/gutenberg.js')
613 - ->dependencies(['give-admin-scripts'])
614 - ->registerTranslations()
615 - ->enqueue();
616 -
617 619 wp_enqueue_style(
618 620 'give-blocks-css',
619 - GIVE_PLUGIN_URL . 'assets/dist/css/admin-block-editor.css',
621 + GIVE_PLUGIN_URL . 'build/assets/dist/css/admin-block-editor.css',
620 622 [],
621 623 GIVE_VERSION
622 624 );
623 625
626 + $scriptAsset = ScriptAsset::get(GIVE_PLUGIN_DIR . 'build/adminBlocks.asset.php');
624 627
628 + $handle = 'give-blocks-js';
629 + wp_enqueue_script(
630 + $handle,
631 + GIVE_PLUGIN_URL . 'build/adminBlocks.js',
632 + array_merge(['give-admin-scripts'], $scriptAsset['dependencies']),
633 + $scriptAsset['version'],
634 + true
635 + );
636 +
637 + Language::setScriptTranslations($handle);
625 638 }
626 639 }