PluginProbe
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) / 1.8.13
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) v1.8.13
1.8.13.1 1.8.13 1.8.12.3 1.8.12.2 1.8.12.1 1.8.12 1.8.11.3 1.8.11.2 1.8.11.1 1.8.11 1.6.6 1.6.60 1.6.7 1.6.8 1.6.9 1.7.0 1.7.0.1 1.7.0.11 1.7.0.12 1.7.0.14 1.7.0.2 1.7.0.3 1.7.0.5 1.7.0.6 1.7.0.7 All 212 releases
charitable / templates / campaign-loop / donate-modal-window.php

donate-modal-window.php in Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) 1.8.13, at templates/campaign-loop/donate-modal-window.php

85 lines 2.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 // Exit if accessed directly.
4 if ( ! defined( 'ABSPATH' ) ) {
5 exit;
6 }
7
8 /**
9 * Sets up the modal window for the campaigns in the loop.
10 *
11 * Override this template by copying it to yourtheme/charitable/campaign-loop/donate-modal-window.php
12 *
13 * @author WP Charitable LLC
14 * @package Charitable/Templates/Campaign
15 * @since 1.0.0
16 * @version 1.6.57
17 * @version 1.8.8.6
18 */
19
20 $charitable_modal_class = apply_filters( 'charitable_modal_window_class', 'charitable-modal' );
21
22 wp_enqueue_script( 'lean-modal' );
23 wp_enqueue_style( 'lean-modal-css' );
24 ?>
25 <div id="charitable-donation-form-modal-loop" style="display: none;" class="<?php echo esc_attr( $charitable_modal_class ); ?>">
26 <a class="modal-close"></a>
27 <div class="donation-form-wrapper"></div>
28 </div>
29 <script type="text/javascript">
30 ( function( $ ) {
31 var resize_modal = function(){
32 $.fn.leanModal( 'resize', $('#charitable-donation-form-modal-loop') );
33 };
34
35 $( '[data-trigger-modal]' ).on( 'click', function(){
36 var campaign_id = $( this ).data( 'campaign-id' ),
37 $wrapper = $( '#charitable-donation-form-modal-loop .donation-form-wrapper' );
38
39 if ( ! campaign_id ) {
40 return;
41 }
42
43 $wrapper.html( "<img src=\"<?php echo esc_url( charitable()->get_path( 'assets', false ) ); ?>/images/charitable-loading.gif\" width=\"60\" height=\"60\" alt=\"<?php esc_attr_e( 'Loading&hellip;', 'charitable' ); ?>\" />" );
44
45 resize_modal();
46
47 $.ajax({
48 type: "POST",
49 data: {
50 action: 'get_donation_form',
51 campaign_id: campaign_id
52 },
53 dataType: "json",
54 url: CHARITABLE_VARS.ajaxurl,
55 xhrFields: {
56 withCredentials: true
57 },
58 success: function ( response ) {
59 if ( response.success ) {
60 $wrapper.html( response.data );
61
62 new CHARITABLE.Donation_Form( $wrapper.find( '#charitable-donation-form' ) );
63
64 CHARITABLE.Toggle();
65
66 resize_modal();
67
68 return;
69 }
70
71 $wrapper.html( "<?php esc_html_e( 'Unfortunately, something went wrong while trying to retrieve the donation form. Please reload the page and try again.', 'charitable' ); ?>" );
72 },
73 error: function() {
74 $wrapper.html( "<?php esc_html_e( 'Unfortunately, something went wrong while trying to retrieve the donation form. Please reload the page and try again.', 'charitable' ); ?>" );
75 }
76 }).fail(function ( response ) {
77 if ( window.console && window.console.log ) {
78 console.log( response );
79 }
80 });
81
82 return false;
83 });
84 })( jQuery );
85 </script>