← All changes
|
includes/shortcodes/class-charitable-donation-form-shortcode.php
+5
-29
1.6.7
→
1.8.13
View file →
| @@ -2,13 +2,13 @@ | ||
| 2 | 2 | /** |
| 3 | 3 | * Donation Form shortcode class. |
| 4 | 4 | * |
| 5 | 5 | * @package Charitable/Shortcodes/Donation Form |
| 6 | - * @author Eric Daams | |
| 7 | - * @copyright Copyright (c) 2018, Studio 164a | |
| 6 | + * @author David Bisset | |
| 7 | + * @copyright Copyright (c) 2023, WP Charitable LLC | |
| 8 | 8 | * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
| 9 | 9 | * @since 1.5.0 |
| 10 | - * @version 1.5.14 | |
| 10 | + * @version 1.8.3.5 | |
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | 13 | // Exit if accessed directly. |
| 14 | 14 | if ( ! defined( 'ABSPATH' ) ) { |
| @@ -36,43 +36,19 @@ | ||
| 36 | 36 | */ |
| 37 | 37 | public static function display( $atts ) { |
| 38 | 38 | $defaults = array( |
| 39 | 39 | 'campaign_id' => 0, |
| 40 | + 'type' => 'full', | |
| 40 | 41 | ); |
| 41 | 42 | |
| 42 | 43 | /* Parse incoming $atts into an array and merge it with $defaults. */ |
| 43 | 44 | $args = shortcode_atts( $defaults, $atts, 'charitable_donation_form' ); |
| 44 | 45 | |
| 45 | - if ( ! charitable_campaign_can_receive_donations( $args['campaign_id'] ) ) { | |
| 46 | - return ''; | |
| 47 | - } | |
| 48 | - | |
| 49 | - $donation_id = get_query_var( 'donation_id', false ); | |
| 50 | - | |
| 51 | - /* If a donation ID is included, make sure it belongs to the current user. */ | |
| 52 | - if ( $donation_id && ! charitable_user_can_access_donation( $donation_id ) ) { | |
| 53 | - return ''; | |
| 54 | - } | |
| 55 | - | |
| 56 | 46 | ob_start(); |
| 57 | 47 | |
| 58 | - if ( ! wp_script_is( 'charitable-script', 'enqueued' ) ) { | |
| 59 | - Charitable_Public::get_instance()->enqueue_donation_form_scripts(); | |
| 60 | - } | |
| 48 | + charitable_template_donation_form( $args['campaign_id'], $args ); | |
| 61 | 49 | |
| 62 | - $form = charitable_get_campaign( $args['campaign_id'] )->get_donation_form(); | |
| 63 | - | |
| 64 | - do_action( 'charitable_donation_form_before', $form ); | |
| 65 | - | |
| 66 | - $args['form'] = $form; | |
| 67 | - $args['campaign'] = $form->get_campaign(); | |
| 68 | - | |
| 69 | - charitable_template( 'donation-form/form-donation.php', $args ); | |
| 70 | - | |
| 71 | - do_action( 'charitable_donation_form_after', $form ); | |
| 72 | - | |
| 73 | 50 | return ob_get_clean(); |
| 74 | - | |
| 75 | 51 | } |
| 76 | 52 | } |
| 77 | 53 | |
| 78 | 54 | endif; |