PluginProbe
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) / 1.6.22
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) v1.6.22
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 1.8.0 All 210 releases
charitable / includes / admin / settings / class-charitable-privacy-settings.php

class-charitable-privacy-settings.php in Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) 1.6.22, at includes/admin/settings/class-charitable-privacy-settings.php

148 lines 4.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Charitable Privacy Settings UI.
4 *
5 * @package Charitable/Classes/Charitable_Privacy_Settings
6 * @author Eric Daams
7 * @copyright Copyright (c) 2019, Studio 164a
8 * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
9 * @since 1.6.0
10 * @version 1.6.0
11 */
12
13 // Exit if accessed directly.
14 if ( ! defined( 'ABSPATH' ) ) {
15 exit;
16 }
17
18 if ( ! class_exists( 'Charitable_Privacy_Settings' ) ) :
19
20 /**
21 * Charitable_Privacy_Settings
22 *
23 * @since 1.6.0
24 */
25 final class Charitable_Privacy_Settings {
26
27 /**
28 * The single instance of this class.
29 *
30 * @since 1.6.0
31 *
32 * @var Charitable_Privacy_Settings|null
33 */
34 private static $instance = null;
35
36 /**
37 * Create object instance.
38 *
39 * @since 1.6.0
40 */
41 private function __construct() {
42 }
43
44 /**
45 * Returns and/or create the single instance of this class.
46 *
47 * @since 1.6.0
48 *
49 * @return Charitable_Privacy_Settings
50 */
51 public static function get_instance() {
52 if ( is_null( self::$instance ) ) {
53 self::$instance = new self();
54 }
55
56 return self::$instance;
57 }
58
59 /**
60 * Add the privacy tab settings fields.
61 *
62 * @since 1.6.0
63 *
64 * @return array<string,array>
65 */
66 public function add_privacy_fields() {
67 if ( ! charitable_is_settings_view( 'privacy' ) ) {
68 return array();
69 }
70
71 $data_fields = $this->get_user_donation_field_options();
72
73 return array(
74 'section' => array(
75 'title' => '',
76 'type' => 'hidden',
77 'priority' => 10000,
78 'value' => 'privacy',
79 ),
80 'section_privacy_description' => array(
81 'type' => 'content',
82 'priority' => 20,
83 'content' => '<div class="charitable-settings-notice">'
84 . '<p>' . __( 'Charitable stores personal data such as donors\' names, email addresses, addresses and phone numbers in your database. Donors may request to have their personal data erased, but you may be legally required to retain some personal data for donations made within a certain time. Below you can control how long personal data is retained for at a minimum, as well as which data fields must be retained.' ) . '</p>'
85 . '<p><a href="https://www.wpcharitable.com/documentation/charitable-user-privacy/?utm_source=privacy-page&utm_medium=wordpress-dashboard&utm_campaign=documentation">' . __( 'Read more about Charitable & user privacy', 'charitable' ) . '</a></p>'
86 . '</div>',
87 ),
88 'minimum_data_retention_period' => array(
89 'label_for' => __( 'Minimum Data Retention Period', 'charitable' ),
90 'type' => 'select',
91 'help' => sprintf(
92 /* translators: %1$s: HTML strong tag. %2$s: HTML closing strong tag. %1$s: HTML break tag. */
93 __( 'Prevent personal data from being erased for donations made within a certain amount of time.%3$sChoose %1$sNone%2$s to allow the personal data of any donation to be erased.%3$sChoose %1$sForever%2$s to prevent any personal data from being erased from donations, regardless of how long ago they were made.' ),
94 '<strong>',
95 '</strong>',
96 '<br />'
97 ),
98 'priority' => 25,
99 'default' => 2,
100 'options' => array(
101 0 => __( 'None', 'charitable' ),
102 1 => __( 'One year', 'charitable' ),
103 2 => __( 'Two years', 'charitable' ),
104 3 => __( 'Three years', 'charitable' ),
105 4 => __( 'Four years', 'charitable' ),
106 5 => __( 'Five years', 'charitable' ),
107 6 => __( 'Six years', 'charitable' ),
108 7 => __( 'Seven years', 'charitable' ),
109 8 => __( 'Eight years', 'charitable' ),
110 9 => __( 'Nine years', 'charitable' ),
111 10 => __( 'Ten years', 'charitable' ),
112 'endless' => __( 'Forever', 'charitable' ),
113 ),
114 ),
115 'data_retention_fields' => array(
116 'label_for' => __( 'Retained Data', 'charitable' ),
117 'type' => 'multi-checkbox',
118 'priority' => 30,
119 'default' => array_keys( $data_fields ),
120 'options' => $data_fields,
121 'help' => __( 'The checked fields will not be erased fields when personal data is erased for a donation made within the Minimum Data Retention Period.', 'charitable' ),
122 'attrs' => array(
123 'data-trigger-key' => '#charitable_settings_minimum_data_retention_period',
124 'data-trigger-value' => '!0',
125 ),
126 ),
127 );
128 }
129
130 /**
131 * Return the list of user donation field options.
132 *
133 * @since 1.6.0
134 *
135 * @return string[]
136 */
137 protected function get_user_donation_field_options() {
138 $fields = charitable()->donation_fields()->get_data_type_fields( 'user' );
139
140 return array_combine(
141 array_keys( $fields ),
142 wp_list_pluck( $fields, 'label' )
143 );
144 }
145 }
146
147 endif;
148