PluginProbe ʕ •ᴥ•ʔ
GiveWP – Donation Plugin and Fundraising Platform / 3.19.4
GiveWP – Donation Plugin and Fundraising Platform v3.19.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 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 1 year ago shortcode-form-grid.php 1 year ago shortcode-goal.php 2 years 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
231 lines
1 <?php
2 /**
3 * This template is used to display the donation grid with [give_donor_wall]
4 */
5
6 // Exit if accessed directly.
7 if (!defined('ABSPATH')) {
8 exit;
9 }
10
11 /** @var $args array */
12 /** @var $donation array kind of like Give_Payment */
13 /** @var $donor Give_Donor */
14 /** @var $atts array Shortcode attributes */
15 /** @var $give_settings array Give settings */
16
17 list($donation, $give_settings, $atts, $donor) = $args;
18
19 $primary_color = $atts['color'];
20 $avatarSize = (int)$atts['avatar_size'];
21 $tribute_background_color = !empty($atts['color']) ? $atts['color'] . '20' : '#219653';
22
23 ?>
24
25
26 <div class="give-grid__item">
27 <div class="give-donor give-card">
28 <div class="give-donor-container">
29 <?php
30 if ($atts['show_avatar']) {
31 if (!empty($donation['_give_anonymous_donation'])) {
32 // Donor gave anonymously
33 $imageUrl = GIVE_PLUGIN_URL . 'assets/dist/images/anonymous-user.svg';
34 $alt = __('Anonymous User', 'give');
35
36 echo "
37 <div class='give-donor-container__image' >
38 <img class='give-donor-container__image__anonymous' src='$imageUrl' alt='$alt' style='height: {$avatarSize}px;'/>
39 </div>
40 ";
41 } elseif (($avatar = $donor->get_meta('_give_donor_avatar_id', true))) {
42 // Donor has an avatar
43 $imageUrl = wp_get_attachment_image_url($avatar, 'thumbnail');
44 $alt = __('Donor Avatar', 'give');
45
46 echo "
47 <div class='give-donor-container__image' >
48 <img src='$imageUrl' alt='$alt' style='height: {$avatarSize}px;'/>
49 </div>
50 ";
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='https://gravatar.com/avatar/$hash' alt='$donor->name' style='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='height: {$avatarSize}px; width: {$avatarSize}px;'>
70 <span class='give-donor-container__image__name_initial'>$initial</span>
71 </div>
72 ";
73 }
74 }
75 ?>
76 <div class="give-donor-container-variation"
77 style="
78 flex-direction: <?php echo $atts['show_avatar'] ? 'column' : 'row'; ?>;
79 align-items: <?php echo $atts['show_avatar'] ? 'center' : 'flex-end'; ?>;
80 ">
81 <?php if ( $atts['show_name'] ) : ?>
82 <h3 class="give-donor-container-variation__name">
83 <?php
84 // Get donor name based on donation parameter.
85 $donor_name = ! empty( $donation['_give_anonymous_donation'] )
86 ? esc_html__( 'Anonymous', 'give' )
87 : trim( $donation['_give_donor_billing_first_name'] . ' ' . $donation['_give_donor_billing_last_name'] );
88 ?>
89 <?php echo esc_html( $donor_name ); ?>
90 </h3>
91 <?php endif; ?>
92
93 <?php if ( $atts['show_company_name'] && isset( $donation['_give_donation_company'] ) ) : ?>
94 <h3 class="give-donor-container-variation__name">
95 <?php echo esc_html( $donation['_give_donation_company'] ); ?>
96 </h3>
97 <?php endif; ?>
98
99 <?php if ( $atts['show_time'] ) : ?>
100 <p class="give-donor-container-variation__timestamp">
101 <?php echo esc_html( give_get_formatted_date( $donation['donation_date'], give_date_format(), 'Y-m-d H:i:s', true ) ); ?>
102 </p>
103 <?php endif; ?>
104 </div>
105 <?php
106 if (
107 $atts['show_comments']
108 && empty($donation['_give_anonymous_donation'])
109 && absint($atts['comment_length'])
110 && !empty($donation['donor_comment'])
111 ) :
112 ?>
113 <div class="give-donor-wrapper">
114 <div class="give-donor-content"
115 style="border-color: <?php echo !empty($atts['color']) ? esc_attr($atts['color']) : '#219653' ?>">
116 <?php
117 $comment = esc_html($donation['donor_comment']);
118 $stripped_comment = str_replace(' ', '', $comment);
119
120 $total_chars = strlen($stripped_comment);
121 $max_chars = $atts['comment_length'];
122 $read_more_text = $atts['readmore_text'];
123
124 // A truncated excerpt is displayed if the comment is too long.
125 if ($max_chars < $total_chars) {
126 $excerpt = '';
127 $offset = -($total_chars - $max_chars);
128 $last_space = strrpos($comment, ' ', $offset);
129
130 if ($last_space) {
131 // Truncate excerpt at last space before limit.
132 $excerpt = substr($comment, 0, $last_space);
133 } else {
134 // There are no spaces, so truncate excerpt at limit.
135 $excerpt = substr($comment, 0, $max_chars);
136 }
137
138 $excerpt = trim($excerpt, '.!,:;');
139
140 echo "<p class='give-donor-content__excerpt'>$excerpt &hellip;
141 <span> <a class='give-donor-content__read-more' style='color: " . esc_attr($primary_color) . "'> $read_more_text </a></span>
142 </p>";
143
144 echo "<p class='give-donor-content__comment'> $comment </p>";
145
146 }
147 else {
148 echo "<p class='give-donor-content__comment'>
149 $comment
150 </p>";
151 }
152 ?>
153 </div>
154 </div>
155 <?php endif; ?>
156 <div class="give-donor-details">
157 <div class="give-donor-details__wrapper">
158 <?php
159 $full_form_name = esc_html($donation['_give_payment_form_title']);
160 $word_count = 3;
161 preg_match("/(\S+\s*){0,$word_count}/", esc_html($donation['_give_payment_form_title']), $regs);
162 $truncated_form_name = trim($regs[0] . "...");
163
164 // Determine whether to truncate form name based on amount of words
165 if ($atts['show_form'] && $atts['show_total'] && isset($donation['_give_payment_form_title'])) {
166 if (str_word_count($donation['_give_payment_form_title'], 0) <= $word_count) {
167 echo "<span class='give-donor-details__form_title'> $full_form_name </span>";
168 } else {
169 echo "<span class='give-donor-details__form_title'> $truncated_form_name </span>";
170 }
171 } // Display full form name if ['show_total'] is false
172 else {
173 if ($atts['show_form'] && !$atts['show_total'] && isset($donation['_give_payment_form_title'])) {
174 echo "<span class='give-donor-details__form_title' style='text-align: center'> $full_form_name </span>";
175 }
176 }
177
178 if ($atts['show_total']) {
179 echo sprintf(
180 '<span class=\'give - donor - details__amount_donated\'>%1$s</span>',
181 esc_html__('Amount Donated', 'give')
182 );
183 }
184 ?>
185 </div>
186
187 <?php
188 $donation_amount = give_donation_amount(esc_html($donation['donation_id']), true);
189
190 if ($atts['show_total']) {
191 echo "
192 <span class= 'give-donor-details__total' style='color: " . esc_attr($primary_color) . "'> $donation_amount </span>
193 ";
194 }
195 ?>
196 </div>
197 </div>
198 <?php
199 if ($atts['show_tributes'] && (isset($donation['_give_tributes_first_name']) || isset($donation['_give_tributes_last_name']))) {
200 $tribute_message = esc_html($donation['_give_tributes_type']);
201 $honoree_first_name = esc_html($donation['_give_tributes_first_name']);
202 $honoree_last_name = esc_html($donation['_give_tributes_last_name']);
203
204 $honoree_full_name =
205 //Determine if a last name is available
206 $donation['_give_tributes_last_name'] ?
207 //Remove full last name, and add as an initial.
208 trim($honoree_first_name . " " . strtoupper($honoree_last_name [0]) . ".") :
209 // Else add period at the end of first name
210 trim($honoree_first_name) . ".";
211
212 echo
213 "<div class='give-donor-tribute' style='background-color: " . esc_attr($tribute_background_color) . " '>
214 <span>
215 <svg width='16' height='16' viewBox='0 0 16 16' xmlns='http://www.w3.org/2000/svg' class='give-donor-tribute__svg'>
216 <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'/>
217 <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'/>
218 <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'/>
219 </svg>
220 </span>
221
222 <span class='give-donor-tribute__message'>
223 <span> $tribute_message </span>
224 <span> $honoree_full_name </span>
225 </span>
226 </div>";
227 }
228 ?>
229 </div>
230 </div>
231