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.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 1.7.0.9 All 211 releases
← All changes | includes/privacy/class-charitable-privacy.php +86 -43 1.6.8 → 1.8.13 View file →
@@ -2,10 +2,10 @@
2 2 /**
3 3 * A class providing privacy tools for Charitable.
4 4 *
5 5 * @package Charitable/Classes/Charitable_Privacy
6 - * @author Eric Daams
7 - * @copyright Copyright (c) 2019, 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.6.0
10 10 * @version 1.6.0
11 11 */
@@ -42,8 +42,26 @@
42 42 */
43 43 protected $data_retention_fields;
44 44
45 45 /**
46 + * Whether data was retained during erasure.
47 + *
48 + * @since 1.6.0
49 + *
50 + * @var boolean
51 + */
52 + protected $retained;
53 +
54 + /**
55 + * Whether data was removed during erasure.
56 + *
57 + * @since 1.6.0
58 + *
59 + * @var boolean
60 + */
61 + protected $removed;
62 +
63 + /**
46 64 * Set up class instance.
47 65 *
48 66 * @since 1.6.0
49 67 */
@@ -129,13 +147,13 @@
129 147 */
130 148 public function is_donation_in_data_retention_period( $donation_id ) {
131 149 $period = $this->get_data_retention_period();
132 150
133 - if ( '0' == (string) $period ) {
151 + if ( '0' == (string) $period ) { // phpcs:ignore Universal.Operators.StrictComparisons.LooseEqual
134 152 return false;
135 153 }
136 154
137 - if ( 'endless' == $period ) {
155 + if ( 'endless' == $period ) { // phpcs:ignore Universal.Operators.StrictComparisons.LooseEqual
138 156 return true;
139 157 }
140 158
141 159 $diff = (int) abs( time() - strtotime( get_post_field( 'post_date_gmt', $donation_id, 'raw' ) ) );
@@ -151,14 +169,17 @@
151 169 * @param array $exporters The list of exporters.
152 170 * @return array
153 171 */
154 172 public function register_exporter( $exporters ) {
155 - return array_merge( $exporters, array(
173 + return array_merge(
174 + $exporters,
156 175 array(
157 - 'exporter_friendly_name' => __( 'Charitable Donor Data', 'charitable' ),
158 - 'callback' => array( $this, 'export_user_data' ),
159 - ),
160 - ) );
176 + array(
177 + 'exporter_friendly_name' => __( 'Charitable Donor Data', 'charitable' ),
178 + 'callback' => array( $this, 'export_user_data' ),
179 + ),
180 + )
181 + );
161 182 }
162 183
163 184 /**
164 185 * Register the data eraser.
@@ -168,14 +189,17 @@
168 189 * @param array $erasers The list of registered data erasers.
169 190 * @return array
170 191 */
171 192 public function register_eraser( $erasers ) {
172 - return array_merge( $erasers, array(
193 + return array_merge(
194 + $erasers,
173 195 array(
174 - 'eraser_friendly_name' => __( 'Charitable Donor Data Eraser', 'charitable' ),
175 - 'callback' => array( $this, 'erase_user_data' ),
176 - ),
177 - ) );
196 + array(
197 + 'eraser_friendly_name' => __( 'Charitable Donor Data Eraser', 'charitable' ),
198 + 'callback' => array( $this, 'erase_user_data' ),
199 + ),
200 + )
201 + );
178 202 }
179 203
180 204 /**
181 205 * Add privacy policy content for Charitable.
@@ -195,9 +219,14 @@
195 219 * @since 1.6.0
196 220 *
197 221 * @param string $content The privacy policy content.
198 222 */
199 - $content = wp_kses_post( apply_filters( 'charitable_privacy_policy_content', wpautop( __( '
223 + $content = wp_kses_post(
224 + apply_filters(
225 + 'charitable_privacy_policy_content',
226 + wpautop(
227 + __(
228 + '
200 229 We collect information about you during the donation process on our website. This information may include, but is not limited to, your name, address, phone number, credit card/payment details and any other details that might be requested from you for the purpose of processing your donations.
201 230
202 231 Handling this data allows us to:
203 232
@@ -211,9 +240,14 @@
211 240 - Your donor comments if you choose to leave them on our website.
212 241 - Cookies which are essential to keep track of your donation history whilst your session is active. This allows you to access your donation receipt without being a registered, logged in user.
213 242 - Account email/password to allow access to your account, if you have one.
214 243 - If you choose to create an account with us, your name, address, email and phone number, which will be used to populate the donation form for future donations.
215 -', 'charitable' ) ) ) );
244 +',
245 + 'charitable'
246 + )
247 + )
248 + )
249 + );
216 250
217 251 wp_add_privacy_policy_content( 'Charitable', $content );
218 252 }
219 253
@@ -288,9 +322,9 @@
288 322 * @param string $email The user's email address.
289 323 * @param int $page The page of data to retrieve.
290 324 * @return array
291 325 */
292 - public function erase_user_data( $email, $page = 1 ) {
326 + public function erase_user_data( $email, $page = 1 ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed
293 327 $this->retained = false;
294 328 $this->removed = false;
295 329
296 330 /* 1. Remove registered donor meta. */
@@ -345,9 +379,9 @@
345 379 * @return array
346 380 */
347 381 public function get_registered_donor_data( $user ) {
348 382 $data = array();
349 - $form = new Charitable_Profile_Form;
383 + $form = new Charitable_Profile_Form();
350 384 $methods = array(
351 385 'get_user_fields',
352 386 'get_address_fields',
353 387 'get_social_fields',
@@ -409,22 +443,25 @@
409 443 *
410 444 * @param array $data Set of personal donor data.
411 445 * @param object $profile The profile record.
412 446 */
413 - $data = apply_filters( 'charitable_privacy_export_personal_donor_profile_data', array(
447 + $data = apply_filters(
448 + 'charitable_privacy_export_personal_donor_profile_data',
414 449 array(
415 - 'name' => __( 'First Name', 'charitable' ),
416 - 'value' => $profile->first_name,
417 - ),
418 - array(
419 - 'name' => __( 'Last Name', 'charitable' ),
420 - 'value' => $profile->last_name,
421 - ),
422 - array(
423 - 'name' => __( 'Email', 'charitable' ),
424 - 'value' => $profile->email,
425 - ),
426 - ) );
450 + array(
451 + 'name' => __( 'First Name', 'charitable' ),
452 + 'value' => $profile->first_name,
453 + ),
454 + array(
455 + 'name' => __( 'Last Name', 'charitable' ),
456 + 'value' => $profile->last_name,
457 + ),
458 + array(
459 + 'name' => __( 'Email', 'charitable' ),
460 + 'value' => $profile->email,
461 + ),
462 + )
463 + );
427 464
428 465 return array(
429 466 'item_id' => 'donor-' . $profile->donor_id,
430 467 'group_id' => 'charitable_donors',
@@ -488,9 +525,9 @@
488 525 * @param WP_User $user The instance of `WP_User`.
489 526 * @return void
490 527 */
491 528 protected function erase_registered_donor_personal_data( WP_User $user ) {
492 - $form = new Charitable_Profile_Form;
529 + $form = new Charitable_Profile_Form();
493 530 $methods = array(
494 531 'get_user_fields',
495 532 'get_address_fields',
496 533 'get_social_fields',
@@ -569,16 +606,18 @@
569 606 update_post_meta( $donation_id, 'donor', $meta );
570 607 update_post_meta( $donation_id, 'data_erased', current_time( 'mysql', 0 ) );
571 608
572 609 /* Change the post_title since that otherwise has the donor's name. */
573 - wp_update_post( array(
574 - 'ID' => $donation_id,
575 - 'post_title' => sprintf(
610 + wp_update_post(
611 + array(
612 + 'ID' => $donation_id,
613 + 'post_title' => sprintf(
576 614 /* translators: %s: campaign names */
577 - __( 'Anonymous – %s', 'charitable' ),
578 - charitable_get_donation( $donation_id )->get_campaigns_donated_to()
579 - ),
580 - ) );
615 + __( 'Anonymous – %s', 'charitable' ),
616 + charitable_get_donation( $donation_id )->get_campaigns_donated_to()
617 + ),
618 + )
619 + );
581 620
582 621 $log = new Charitable_Donation_Log( $donation_id );
583 622 $log->add( __( 'Personal data erased.', 'charitable' ) );
584 623 }
@@ -591,12 +630,16 @@
591 630 *
592 631 * @return boolean
593 632 */
594 633 protected function has_erasable_fields_within_data_retention_period() {
595 - return 0 < count( array_unique(
596 - array_keys( $this->get_user_donation_fields() ),
597 - $this->get_data_retention_fields()
598 - ) );
634 + return 0 < count(
635 + array_unique(
636 + array_merge(
637 + array_keys( $this->get_user_donation_fields() ),
638 + $this->get_data_retention_fields()
639 + )
640 + )
641 + );
599 642 }
600 643
601 644 /**
602 645 * Returns the erasable fields within the Data Retention Period.