PluginProbe ʕ •ᴥ•ʔ
GiveWP – Donation Plugin and Fundraising Platform / trunk
GiveWP – Donation Plugin and Fundraising Platform vtrunk
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 2.31.0 2.31.1 2.32.0 2.33.0 2.33.1 2.33.2 2.33.3 2.33.4 2.33.5 2.4.0 2.4.1 2.4.2 2.4.3 2.4.4 2.4.5 2.4.6 2.4.7 2.5.0 2.5.1 2.5.10 2.5.11 2.5.12 2.5.13 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 2.5.7 2.5.8 2.5.9 2.6.0 2.6.1 2.6.2 2.6.3 2.7.0 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.8.0 2.8.1 2.9.0 2.9.1 2.9.2 2.9.3 2.9.4 2.9.5 2.9.6 2.9.7 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.1.0 3.1.1 3.1.2 3.10.0 3.11.0 3.12.0 3.12.1 3.12.2 3.12.3 3.13.0 3.14.0 3.14.1 3.14.2 3.15.0 3.15.1 3.16.0 3.16.1 3.16.2 3.16.3 3.16.4 3.16.5 3.17.0 3.17.1 3.17.2 3.18.0 3.19.0 3.19.1 3.19.2 3.19.3 3.19.4 3.2.0 3.2.1 3.2.2 3.20.0 3.21.0 3.21.1 3.22.0 3.22.1 3.22.2 3.3.0 3.3.1 3.4.0 3.4.1 3.4.2 3.5.0 3.5.1 3.6.0 3.6.1 3.6.2 3.7.0 3.8.0 3.9.0 4.0.0 4.1.0 4.1.1 4.10.0 4.10.1 4.11.0 4.12.0 4.13.0 4.13.1 4.13.2 4.14.0 4.14.1 4.14.2 4.14.3 4.14.4 4.14.5 4.14.6 4.2.0 4.2.1 4.3.0 4.3.1 4.3.2 4.4.0 4.5.0 4.6.1 4.7.0 4.7.1 4.8.0 4.8.1 4.9.0 trunk 1.9.0 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.10.0 2.10.1 2.10.2 2.10.3 2.10.4 2.11.0 2.11.1 2.11.2 2.11.3 2.12.0 2.12.1 2.12.2 2.12.3 2.13.0 2.13.1 2.13.2 2.13.3 2.13.4 2.14.0 2.15.0 2.16.0 2.16.1 2.17.0 2.17.1 2.17.3 2.18.0 2.18.1 2.19.1 2.19.2 2.19.3 2.19.4 2.19.5 2.19.6 2.19.7 2.19.8 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.20.0 2.20.1 2.20.2 2.21.0 2.21.1 2.21.2 2.21.3 2.21.4 2.22.0 2.22.1 2.22.2 2.22.3 2.23.0 2.23.1 2.23.2 2.24.0 2.24.1 2.24.2 2.25.0 2.25.1 2.25.2 2.25.3 2.26.0 2.27.0 2.27.1 2.27.2 2.27.3 2.28.0 2.29.0 2.29.1 2.29.2
give / templates / shortcode-donor-wall.php
give / templates Last commit date
emails 2 years ago global 6 years ago receipt 7 years ago single-give-form 6 years ago email-login-form.php 6 years ago history-donations.php 4 years ago payment-processing.php 6 years ago shortcode-donor-wall.php 7 months ago shortcode-form-grid.php 4 months ago shortcode-goal.php 10 months ago shortcode-login.php 6 years ago shortcode-profile-editor.php 6 years ago shortcode-receipt.php 2 years ago shortcode-register.php 8 years ago shortcode-totals-progress.php 6 years ago single-give-form.php 6 years ago
shortcode-donor-wall.php
230 lines
1 <?php
2
3 /**
4 * This template is used to display the donation grid with [give_donor_wall]
5 */
6
7 // Exit if accessed directly.
8 if (!defined('ABSPATH')) {
9 exit;
10 }
11
12 /** @var $args array */
13 /** @var $donation array kind of like Give_Payment */
14 /** @var $donor Give_Donor */
15 /** @var $atts array Shortcode attributes */
16 /** @var $give_settings array Give settings */
17
18 list($donation, $give_settings, $atts, $donor) = $args;
19
20 $primary_color = $atts['color'];
21 $avatarSize = (int)$atts['avatar_size'];
22 $tribute_background_color = !empty($atts['color']) ? $atts['color'] . '20' : '#219653';
23
24 ?>
25
26
27 <div class="give-grid__item">
28 <div class="give-donor give-card">
29 <div class="give-donor-container">
30 <?php
31 if ($atts['show_avatar']) {
32 if (!empty($donation['_give_anonymous_donation'])) {
33 // Donor gave anonymously
34 $imageUrl = GIVE_PLUGIN_URL . 'build/assets/dist/images/anonymous-user.svg';
35 $alt = __('Anonymous User', 'give');
36
37 echo "
38 <div class='give-donor-container__image' >
39 <img class='give-donor-container__image__anonymous' src='" . esc_url($imageUrl) . "' alt='" . esc_attr($alt) . "' style='" . esc_attr('height: ' . $avatarSize . 'px;') . "'/>
40 </div>
41 ";
42 } elseif (($avatar = $donor->get_meta('_give_donor_avatar_id', true))) {
43 // Donor has an avatar
44 $imageUrl = wp_get_attachment_image_url($avatar, 'thumbnail');
45 $alt = __('Donor Avatar', 'give');
46
47 echo "
48 <div class='give-donor-container__image' >
49 <img src='" . esc_url($imageUrl) . "' alt='" . esc_attr($alt) . "' style='" . esc_attr('height: ' . $avatarSize . 'px;') . "'/>
50 </div>
51 ";
52 } elseif ($donation['_give_payment_donor_email'] && give_validate_gravatar(
53 $donation['_give_payment_donor_email']
54 )) {
55 // Donor has a valid Gravatar
56 $hash = md5(strtolower(trim($donation['_give_payment_donor_email'])));
57
58
59 echo "
60 <div class='give-donor-container__image' >
61 <img src='" . esc_url('https://gravatar.com/avatar/' . $hash) . "' alt='" . esc_attr($donor->name) . "' style='" . esc_attr('height: ' . $avatarSize . 'px;') . "'/>
62 </div>
63 ";
64 } else {
65 // Everyone else
66
67 $initial = esc_html($donation['name_initial']);
68 echo "
69 <div class='give-donor-container__image' style='" . esc_attr('height: ' . $avatarSize . 'px; width: ' . $avatarSize . 'px;') . "'>
70 <span class='give-donor-container__image__name_initial'>$initial</span>
71 </div>
72 ";
73 }
74 }
75 ?>
76 <?php
77 $flexDirection = $atts['show_avatar'] ? 'column' : 'row';
78 $alignItems = $atts['show_avatar'] ? 'center' : 'flex-end';
79 ?>
80 <div class="give-donor-container-variation"
81 style="<?php echo esc_attr('flex-direction: ' . $flexDirection . '; align-items: ' . $alignItems . ';'); ?>">
82 <?php if ($atts['show_name']) : ?>
83 <h3 class="give-donor-container-variation__name">
84 <?php
85 // Get donor name based on donation parameter.
86 $donor_name = ! empty($donation['_give_anonymous_donation'])
87 ? esc_html__('Anonymous', 'give')
88 : trim($donation['_give_donor_billing_first_name'] . ' ' . $donation['_give_donor_billing_last_name']);
89 ?>
90 <?php echo esc_html($donor_name); ?>
91 </h3>
92 <?php endif; ?>
93
94 <?php if ($atts['show_company_name'] && isset($donation['_give_donation_company'])) : ?>
95 <h3 class="give-donor-container-variation__name">
96 <?php echo esc_html($donation['_give_donation_company']); ?>
97 </h3>
98 <?php endif; ?>
99
100 <?php if ($atts['show_time']) : ?>
101 <p class="give-donor-container-variation__timestamp">
102 <?php echo esc_html(give_get_formatted_date($donation['donation_date'], give_date_format(), 'Y-m-d H:i:s', true)); ?>
103 </p>
104 <?php endif; ?>
105 </div>
106 <?php
107 if (
108 $atts['show_comments']
109 && empty($donation['_give_anonymous_donation'])
110 && absint($atts['comment_length'])
111 && !empty($donation['donor_comment'])
112 ) :
113 ?>
114 <div class="give-donor-wrapper">
115 <div class="give-donor-content"
116 style="border-color: <?php echo !empty($atts['color']) ? esc_attr($atts['color']) : '#219653' ?>">
117 <?php
118 $comment = esc_html($donation['donor_comment']);
119 $stripped_comment = str_replace(' ', '', $comment);
120
121 $total_chars = strlen($stripped_comment);
122 $max_chars = $atts['comment_length'];
123 $read_more_text = $atts['readmore_text'];
124
125 // A truncated excerpt is displayed if the comment is too long.
126 if ($max_chars < $total_chars) {
127 $excerpt = '';
128 $offset = - ($total_chars - $max_chars);
129 $last_space = strrpos($comment, ' ', $offset);
130
131 if ($last_space) {
132 // Truncate excerpt at last space before limit.
133 $excerpt = substr($comment, 0, $last_space);
134 } else {
135 // There are no spaces, so truncate excerpt at limit.
136 $excerpt = substr($comment, 0, $max_chars);
137 }
138
139 $excerpt = trim($excerpt, '.!,:;');
140
141 echo "<p class='give-donor-content__excerpt'>$excerpt &hellip;
142 <span> <a class='give-donor-content__read-more' style='color: " . esc_attr($primary_color) . "'> $read_more_text </a></span>
143 </p>";
144
145 echo "<p class='give-donor-content__comment'> $comment </p>";
146 } else {
147 echo "<p class='give-donor-content__comment'>
148 $comment
149 </p>";
150 }
151 ?>
152 </div>
153 </div>
154 <?php endif; ?>
155 <div class="give-donor-details">
156 <div class="give-donor-details__wrapper">
157 <?php
158 $full_form_name = esc_html($donation['_give_payment_form_title']);
159 $word_count = 3;
160 preg_match("/(\S+\s*){0,$word_count}/", esc_html($donation['_give_payment_form_title']), $regs);
161 $truncated_form_name = trim($regs[0] . "...");
162
163 // Determine whether to truncate form name based on amount of words
164 if ($atts['show_form'] && $atts['show_total'] && isset($donation['_give_payment_form_title'])) {
165 if (str_word_count($donation['_give_payment_form_title'], 0) <= $word_count) {
166 echo "<span class='give-donor-details__form_title'> $full_form_name </span>";
167 } else {
168 echo "<span class='give-donor-details__form_title'> $truncated_form_name </span>";
169 }
170 } // Display full form name if ['show_total'] is false
171 else {
172 if ($atts['show_form'] && !$atts['show_total'] && isset($donation['_give_payment_form_title'])) {
173 echo "<span class='give-donor-details__form_title' style='text-align: center'> $full_form_name </span>";
174 }
175 }
176
177 if ($atts['show_total']) {
178 echo sprintf(
179 '<span class=\'give - donor - details__amount_donated\'>%1$s</span>',
180 esc_html__('Amount Donated', 'give')
181 );
182 }
183 ?>
184 </div>
185
186 <?php
187 $donation_amount = give_donation_amount(esc_html($donation['donation_id']), true);
188
189 if ($atts['show_total']) {
190 echo "
191 <span class= 'give-donor-details__total' style='color: " . esc_attr($primary_color) . "'> $donation_amount </span>
192 ";
193 }
194 ?>
195 </div>
196 </div>
197 <?php
198 if ($atts['show_tributes'] && (isset($donation['_give_tributes_first_name']) || isset($donation['_give_tributes_last_name']))) {
199 $tribute_message = esc_html($donation['_give_tributes_type']);
200 $honoree_first_name = esc_html($donation['_give_tributes_first_name']);
201 $honoree_last_name = esc_html($donation['_give_tributes_last_name']);
202
203 $honoree_full_name =
204 //Determine if a last name is available
205 $donation['_give_tributes_last_name'] ?
206 //Remove full last name, and add as an initial.
207 trim($honoree_first_name . " " . strtoupper($honoree_last_name[0]) . ".") :
208 // Else add period at the end of first name
209 trim($honoree_first_name) . ".";
210
211 echo
212 "<div class='give-donor-tribute' style='background-color: " . esc_attr($tribute_background_color) . " '>
213 <span>
214 <svg width='16' height='16' viewBox='0 0 16 16' xmlns='http://www.w3.org/2000/svg' class='give-donor-tribute__svg'>
215 <path fill=' " . esc_attr($primary_color) . "' opacity='0.4' d='M11.9667 5.13998L11.8734 5.08665L10.9467 4.55332L9.0334 3.44665C8.44673 3.10665 7.5534 3.10665 6.96673 3.44665L5.0534 4.55332L4.12673 5.09332L4.00673 5.15998C2.8134 5.95998 2.7334 6.10665 2.7334 7.39332V10.4667C2.7334 11.7533 2.8134 11.9 4.0334 12.72L6.96673 14.4133C7.26007 14.5867 7.62673 14.6667 8.00007 14.6667C8.36673 14.6667 8.74007 14.5867 9.0334 14.4133L11.9934 12.7C13.1867 11.9 13.2667 11.7533 13.2667 10.4667V7.39332C13.2667 6.10665 13.1867 5.95998 11.9667 5.13998Z' fill='#15AE56'/>
216 <path fill=' " . esc_attr($primary_color) . "' d='M4.12671 5.09337L5.05338 4.55337L6.88004 3.50004L6.96671 3.44671C7.55337 3.10671 8.44671 3.10671 9.03338 3.44671L9.12004 3.50004L10.9467 4.55337L11.8734 5.08671V3.66004C11.8734 2.16004 11.0467 1.33337 9.54671 1.33337H6.44671C4.94671 1.33337 4.12671 2.16004 4.12671 3.66004V5.09337Z' fill='#15AE56'/>
217 <path fill=' " . esc_attr($primary_color) . "' d='M9.89333 8.89327L9.47999 9.39994C9.41333 9.47327 9.36666 9.61994 9.37333 9.71994L9.41333 10.3733C9.43999 10.7733 9.15333 10.9799 8.77999 10.8333L8.17333 10.5933C8.07999 10.5599 7.91999 10.5599 7.82666 10.5933L7.21999 10.8333C6.84666 10.9799 6.55999 10.7733 6.58666 10.3733L6.62666 9.71994C6.63333 9.61994 6.58666 9.47327 6.51999 9.39994L6.10666 8.89327C5.84666 8.5866 5.95999 8.2466 6.34666 8.1466L6.97999 7.9866C7.07999 7.95994 7.19999 7.8666 7.25333 7.77994L7.60666 7.23327C7.82666 6.89327 8.17333 6.89327 8.39333 7.23327L8.74666 7.77994C8.79999 7.8666 8.91999 7.95994 9.01999 7.9866L9.65333 8.1466C10.04 8.2466 10.1533 8.5866 9.89333 8.89327Z' fill='#15AE56'/>
218 </svg>
219 </span>
220
221 <span class='give-donor-tribute__message'>
222 <span> $tribute_message </span>
223 <span> $honoree_full_name </span>
224 </span>
225 </div>";
226 }
227 ?>
228 </div>
229 </div>
230