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 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 All 212 releases
← All changes | includes/admin/settings/class-charitable-general-settings.php +257 -113 1.6.9 → 1.8.13 View file →
@@ -1,17 +1,20 @@
1 1 <?php
2 2 /**
3 3 * Charitable General Settings UI.
4 4 *
5 - * @package Charitable/Classes/Charitable_General_Settings
6 - * @version 1.0.0
7 - * @author Eric Daams
8 - * @copyright Copyright (c) 2019, Studio 164a
9 - * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
5 + * @package Charitable/Classes/Charitable_General_Settings
6 + * @author David Bisset
7 + * @copyright Copyright (c) 2023, WP Charitable LLC
8 + * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
9 + * @since 1.0.0
10 + * @version 1.6.38
10 11 */
11 12
12 13 // Exit if accessed directly.
13 -if ( ! defined( 'ABSPATH' ) ) { exit; }
14 +if ( ! defined( 'ABSPATH' ) ) {
15 + exit;
16 +}
14 17
15 18 if ( ! class_exists( 'Charitable_General_Settings' ) ) :
16 19
17 20 /**
@@ -64,147 +67,288 @@
64 67 if ( ! charitable_is_settings_view( 'general' ) ) {
65 68 return array();
66 69 }
67 70
71 + $currency_helper = charitable_get_currency_helper();
72 +
68 73 $general_fields = array(
69 - 'section' => array(
70 - 'title' => '',
71 - 'type' => 'hidden',
72 - 'priority' => 10000,
73 - 'value' => 'general',
74 + 'section' => array(
75 + 'title' => '',
76 + 'type' => 'hidden',
77 + 'priority' => 10000,
78 + 'value' => 'general',
74 79 ),
75 - 'section_locale' => array(
76 - 'title' => __( 'Currency & Location', 'charitable' ),
77 - 'type' => 'heading',
78 - 'priority' => 2,
80 + 'general_settings' => array(
81 + 'title' => __( 'General Settings', 'charitable' ),
82 + 'type' => 'heading',
83 + 'priority' => 1,
79 84 ),
80 - 'country' => array(
81 - 'title' => __( 'Base Country', 'charitable' ),
82 - 'type' => 'select',
83 - 'priority' => 4,
84 - 'default' => 'AU',
85 - 'options' => charitable_get_location_helper()->get_countries(),
85 + 'section_license' => array(
86 + 'title' => __( 'License', 'charitable' ),
87 + 'type' => 'heading',
88 + 'priority' => 2,
89 + 'class' => 'section-heading general-settings',
86 90 ),
87 - 'currency' => array(
88 - 'title' => __( 'Currency', 'charitable' ),
89 - 'type' => 'select',
90 - 'priority' => 10,
91 - 'default' => 'AUD',
92 - 'options' => charitable_get_currency_helper()->get_all_currencies(),
91 + 'license_key' => array(
92 + 'title' => __( 'License Key', 'charitable' ),
93 + 'type' => 'content',
94 + 'class' => 'general-settings',
95 + 'content' => Charitable_Licenses_Settings::get_instance()->generate_license_check_html(),
96 + 'priority' => 3,
97 + 'help' => __( 'Your license key provides access to updates and addons.', 'charitable' ),
93 98 ),
94 - 'currency_format' => array(
95 - 'title' => __( 'Currency Format', 'charitable' ),
96 - 'type' => 'select',
97 - 'priority' => 12,
98 - 'default' => 'left',
99 - 'options' => array(
100 - 'left' => '$23.00',
101 - 'right' => '23.00$',
102 - 'left-with-space' => '$ 23.00',
103 - 'right-with-space' => '23.00 $',
99 + 'section_locale' => array(
100 + 'title' => __( 'Currency & Location', 'charitable' ),
101 + 'type' => 'heading',
102 + 'class' => 'section-heading general-setting currrency-location',
103 + 'priority' => 4,
104 + ),
105 + 'country' => array(
106 + 'title' => __( 'Base Country', 'charitable' ),
107 + 'type' => 'select',
108 + 'priority' => 8,
109 + 'default' => 'US',
110 + 'class' => 'general-setting',
111 + 'options' => charitable_get_location_helper()->get_countries(),
112 + ),
113 + 'currency' => array(
114 + 'title' => __( 'Currency', 'charitable' ),
115 + 'type' => 'select',
116 + 'priority' => 10,
117 + 'default' => 'USD',
118 + 'class' => 'general-settings',
119 + 'options' => charitable_get_currency_helper()->get_all_currencies(),
120 + ),
121 + 'currency_format' => array(
122 + 'title' => __( 'Currency Format', 'charitable' ),
123 + 'type' => 'select',
124 + 'priority' => 12,
125 + 'default' => 'left',
126 + 'class' => 'general-settings',
127 + 'options' => array(
128 + 'left' => $currency_helper->get_monetary_amount( '23', false, false, 'left' ),
129 + 'right' => $currency_helper->get_monetary_amount( '23', false, false, 'right' ),
130 + 'left-with-space' => $currency_helper->get_monetary_amount( '23', false, false, 'left-with-space' ),
131 + 'right-with-space' => $currency_helper->get_monetary_amount( '23', false, false, 'right-with-space' ),
104 132 ),
105 133 ),
106 - 'decimal_separator' => array(
107 - 'title' => __( 'Decimal Separator', 'charitable' ),
108 - 'type' => 'select',
109 - 'priority' => 14,
110 - 'default' => '.',
111 - 'options' => array(
134 + 'decimal_separator' => array(
135 + 'title' => __( 'Decimal Separator', 'charitable' ),
136 + 'type' => 'select',
137 + 'priority' => 14,
138 + 'default' => '.',
139 + 'class' => 'general-settings',
140 + 'options' => array(
112 141 '.' => 'Period (12.50)',
113 142 ',' => 'Comma (12,50)',
114 143 ),
115 144 ),
116 - 'thousands_separator' => array(
117 - 'title' => __( 'Thousands Separator', 'charitable' ),
118 - 'type' => 'select',
119 - 'priority' => 16,
120 - 'default' => ',',
121 - 'options' => array(
122 - ',' => __( 'Comma (10,000)', 'charitable' ),
123 - '.' => __( 'Period (10.000)', 'charitable' ),
124 - ' ' => __( 'Space (10 000)', 'charitable' ),
125 - 'none' => __( 'None', 'charitable' ),
145 + 'thousands_separator' => array(
146 + 'title' => __( 'Thousands Separator', 'charitable' ),
147 + 'type' => 'select',
148 + 'priority' => 16,
149 + 'default' => ',',
150 + 'class' => 'general-settings',
151 + 'options' => array(
152 + ',' => __( 'Comma (10,000)', 'charitable' ),
153 + '.' => __( 'Period (10.000)', 'charitable' ),
154 + ' ' => __( 'Space (10 000)', 'charitable' ),
155 + 'none' => __( 'None', 'charitable' ),
126 156 ),
127 157 ),
128 - 'decimal_count' => array(
129 - 'title' => __( 'Number of Decimals', 'charitable' ),
130 - 'type' => 'number',
131 - 'priority' => 18,
132 - 'default' => 2,
133 - 'class' => 'short',
158 + 'decimal_count' => array(
159 + 'title' => __( 'Number of Decimals', 'charitable' ),
160 + 'type' => 'number',
161 + 'priority' => 18,
162 + 'class' => 'general-settings short',
163 + 'default' => 2,
134 164 ),
135 - 'section_donation_form' => array(
136 - 'title' => __( 'Donation Form', 'charitable' ),
137 - 'type' => 'heading',
138 - 'priority' => 20,
165 + 'section_donation_form' => array(
166 + 'title' => __( 'Donation Form', 'charitable' ),
167 + 'type' => 'heading',
168 + 'class' => 'section-heading general-settings',
169 + 'priority' => 20,
139 170 ),
140 - 'donation_form_display' => array(
141 - 'title' => __( 'Display Options', 'charitable' ),
142 - 'type' => 'select',
143 - 'priority' => 22,
144 - 'default' => 'separate_page',
145 - 'options' => array(
171 + 'donation_form_display' => array(
172 + 'title' => __( 'Display Options', 'charitable' ),
173 + 'type' => 'select',
174 + 'priority' => 22,
175 + 'default' => 'modal',
176 + 'class' => 'general-settings',
177 + 'options' => array(
146 178 'separate_page' => __( 'Show on a Separate Page', 'charitable' ),
147 179 'same_page' => __( 'Show on the Same Page', 'charitable' ),
148 180 'modal' => __( 'Reveal in a Modal', 'charitable' ),
149 181 ),
150 - 'help' => __( 'Choose how you want a campaign\'s donation form to show.', 'charitable' ),
182 + 'help' => __( 'Choose how you want a campaign\'s donation form to show.', 'charitable' ),
151 183 ),
152 - 'section_pages' => array(
153 - 'title' => __( 'Pages', 'charitable' ),
154 - 'type' => 'heading',
155 - 'priority' => 30,
184 + 'donation_form_template' => array(
185 + 'title' => __( 'Form Template <span class="badge beta">Beta</span>', 'charitable' ),
186 + 'type' => 'select',
187 + 'priority' => 23,
188 + 'default' => '',
189 + 'class' => 'general-settings',
190 + 'options' => array(
191 + '' => __( 'Standard', 'charitable' ),
192 + 'minimal' => __( 'Minimal', 'charitable' ),
193 + ),
194 + 'help' => __( 'The minimal template has a more compact and simplified layout. It is most effective with "only show required fields" set to "Yes".', 'charitable' ),
156 195 ),
157 - 'login_page' => array(
158 - 'title' => __( 'Login Page', 'charitable' ),
159 - 'type' => 'select',
160 - 'priority' => 32,
161 - 'default' => 'wp',
162 - 'options' => array(
163 - 'wp' => __( 'Use WordPress Login', 'charitable' ),
164 - 'pages' => array(
165 - 'options' => charitable_get_admin_settings()->get_pages(),
166 - 'label' => __( 'Choose a Static Page', 'charitable' ),
196 + 'donation_form_minimal_fields' => array(
197 + 'title' => __( 'Only Show Required Fields', 'charitable' ),
198 + 'type' => 'radio',
199 + 'priority' => 24,
200 + 'class' => 'general-settings',
201 + 'default' => '0',
202 + 'options' => array(
203 + '1' => __( 'Yes', 'charitable' ),
204 + '0' => __( 'No', 'charitable' ),
205 + ),
206 + 'help' => __( 'Choose if you wish fields not required on the donation form to be hidden.', 'charitable' ),
207 + ),
208 + 'donation_form_show_login_message' => array(
209 + 'title' => __( 'Show Login Form <span class="badge beta">Beta</span>', 'charitable' ),
210 + 'type' => 'radio',
211 + 'priority' => 25,
212 + 'class' => 'general-settings',
213 + 'default' => '1',
214 + 'options' => array(
215 + '1' => __( 'Yes', 'charitable' ),
216 + '0' => __( 'No', 'charitable' ),
217 + ),
218 + 'help' => __( 'Choose if you wish to display a register reminder or login form at the top of the donation form.', 'charitable' ),
219 + ),
220 + 'donation_form_minimal_amount_notice_display' => array(
221 + 'title' => __( 'Minimum Donation Location', 'charitable' ),
222 + 'type' => 'select',
223 + 'priority' => 26,
224 + 'class' => 'general-settings',
225 + 'default' => 'below_amount_selection',
226 + 'options' => array(
227 + 'below_amount_selection' => __( 'Below Donation Choices / Amounts', 'charitable' ),
228 + 'below_donation_title' => __( 'Below Donation Title', 'charitable' ),
229 + 'above_donation_title' => __( 'Above Donation Title', 'charitable' ),
230 + ),
231 + 'help' => __( 'Choose where you wish the minimum donation message to appear on the donation form, if a minimum is set for the campaign.', 'charitable' ),
232 + ),
233 + 'donation_form_notices_display' => array(
234 + 'title' => __( 'Notice Display Location', 'charitable' ),
235 + 'type' => 'select',
236 + 'priority' => 27,
237 + 'default' => 'top',
238 + 'class' => 'general-settings',
239 + 'options' => array(
240 + 'top' => __( 'Top', 'charitable' ),
241 + 'bottom' => __( 'Bottom', 'charitable' ),
242 + ),
243 + 'help' => __( 'Choose where notice and validation errors appear on the donation form.', 'charitable' ),
244 + ),
245 + 'donation_form_default_highlight_colour' => array(
246 + 'title' => __( 'Default Highlight Color', 'charitable' ),
247 + 'type' => 'color-picker',
248 + 'priority' => 28,
249 + 'default' => false,
250 + 'class' => 'general-settings charitable-color-field',
251 + 'help' => __( 'Define a highlight color for form notices, errors, and other UI. Default is ', 'charitable' ) . apply_filters( 'charitable_default_highlight_colour', '#f89d35' ) . '. Templates built in Campaign Builder or CSS in your theme or plugins might override this.',
252 + ),
253 + 'section_pages' => array(
254 + 'title' => __( 'Pages', 'charitable' ),
255 + 'type' => 'heading',
256 + 'class' => 'section-heading general-settings',
257 + 'priority' => 30,
258 + ),
259 + 'login_page' => array(
260 + 'title' => __( 'Login Page', 'charitable' ),
261 + 'type' => 'select',
262 + 'class' => 'general-settings',
263 + 'priority' => 31,
264 + 'default' => 'wp',
265 + 'options' => array(
266 + 'wp' => __( 'Use WordPress Login', 'charitable' ),
267 + 'pages' => array(
268 + 'options' => charitable_get_admin_settings()->get_pages(),
269 + 'label' => __( 'Choose a Static Page', 'charitable' ),
167 270 ),
168 271 ),
169 - 'help' => __( 'Allow users to login via the normal WordPress login page or via a static page. The static page should contain the <code>[charitable_login]</code> shortcode.', 'charitable' ),
272 + 'help' => __( 'Allow users to login via the normal WordPress login page or via a static page. The static page should contain the <code>[charitable_login]</code> shortcode.', 'charitable' ),
170 273 ),
171 - 'registration_page' => array(
172 - 'title' => __( 'Registration Page', 'charitable' ),
173 - 'type' => 'select',
174 - 'priority' => 34,
175 - 'default' => 'wp',
176 - 'options' => array(
177 - 'wp' => __( 'Use WordPress Registration Page', 'charitable' ),
178 - 'pages' => array(
179 - 'options' => charitable_get_admin_settings()->get_pages(),
180 - 'label' => __( 'Choose a Static Page', 'charitable' ),
274 + 'registration_page' => array(
275 + 'title' => __( 'Registration Page', 'charitable' ),
276 + 'type' => 'select',
277 + 'priority' => 32,
278 + 'default' => 'wp',
279 + 'class' => 'general-settings',
280 + 'options' => array(
281 + 'wp' => __( 'Use WordPress Registration Page', 'charitable' ),
282 + 'pages' => array(
283 + 'options' => charitable_get_admin_settings()->get_pages(),
284 + 'label' => __( 'Choose a Static Page', 'charitable' ),
181 285 ),
182 286 ),
183 - 'help' => __( 'Allow users to register via the default WordPress login or via a static page. The static page should contain the <code>[charitable_registration]</code> shortcode.', 'charitable' ),
287 + 'help' => __( 'Allow users to register via the default WordPress login or via a static page. The static page should contain the <code>[charitable_registration]</code> shortcode.', 'charitable' ),
184 288 ),
185 - 'profile_page' => array(
186 - 'title' => __( 'Profile Page', 'charitable' ),
187 - 'type' => 'select',
188 - 'priority' => 36,
189 - 'options' => charitable_get_admin_settings()->get_pages(),
190 - 'help' => __( 'The static page should contain the <code>[charitable_profile]</code> shortcode.', 'charitable' ),
289 + 'profile_page' => array(
290 + 'title' => __( 'Profile Page', 'charitable' ),
291 + 'type' => 'select',
292 + 'priority' => 33,
293 + 'class' => 'general-settings',
294 + 'options' => charitable_get_admin_settings()->get_pages(),
295 + 'help' => __( 'The static page should contain the <code>[charitable_profile]</code> shortcode.', 'charitable' ),
191 296 ),
192 - 'donation_receipt_page' => array(
193 - 'title' => __( 'Donation Receipt Page', 'charitable' ),
194 - 'type' => 'select',
195 - 'priority' => 38,
196 - 'default' => 'auto',
197 - 'options' => array(
198 - 'auto' => __( 'Automatic', 'charitable' ),
199 - 'pages' => array(
200 - 'options' => charitable_get_admin_settings()->get_pages(),
201 - 'label' => __( 'Choose a Static Page', 'charitable' ),
297 + 'donation_receipt_page' => array(
298 + 'title' => __( 'Donation Receipt Page', 'charitable' ),
299 + 'type' => 'select',
300 + 'priority' => 34,
301 + 'default' => 'auto',
302 + 'class' => 'general-settings',
303 + 'options' => array(
304 + 'auto' => __( 'Automatic', 'charitable' ),
305 + 'pages' => array(
306 + 'options' => charitable_get_admin_settings()->get_pages(),
307 + 'label' => __( 'Choose a Static Page', 'charitable' ),
202 308 ),
203 309 ),
204 - 'help' => __( 'Choose the page that users will be redirected to after donating. Leave it set to automatic to use the built-in Charitable receipt. If you choose a static page, it should contain the <code>[donation_receipt]</code> shortcode.', 'charitable' ),
310 + 'help' => __( 'Choose the page that users will be redirected to after donating. Leave it set to automatic to use the built-in Charitable receipt. If you choose a static page, it should contain the <code>[donation_receipt]</code> shortcode.', 'charitable' ),
205 311 ),
312 + 'privacy_policy_page' => array(
313 + 'title' => __( 'Privacy Policy Page', 'charitable' ),
314 + 'type' => 'select',
315 + 'class' => 'general-settings',
316 + 'priority' => 40,
317 + 'default' => '0',
318 + 'options' => array(
319 + '0' => __( 'No Privacy Page', 'charitable' ),
320 + 'pages' => array(
321 + 'options' => charitable_get_admin_settings()->get_pages(),
322 + 'label' => __( 'Choose a Static Page', 'charitable' ),
323 + ),
324 + ),
325 + 'help' => __( 'Choose the page that contains your site\'s privacy policy.', 'charitable' ),
326 + ),
327 + 'terms_conditions_page' => array(
328 + 'title' => __( 'Terms and Conditions Page', 'charitable' ),
329 + 'type' => 'select',
330 + 'priority' => 45,
331 + 'default' => '0',
332 + 'class' => 'general-settings',
333 + 'options' => array(
334 + '0' => __( 'No Terms Page', 'charitable' ),
335 + 'pages' => array(
336 + 'options' => charitable_get_admin_settings()->get_pages(),
337 + 'label' => __( 'Choose a Static Page', 'charitable' ),
338 + ),
339 + ),
340 + 'help' => __( 'Choose the page that contains your site\'s terms and conditions.', 'charitable' ),
341 + ),
206 342 );
343 +
344 + /* If we're using a zero-decimal currency, get rid of the decimal separator and decimal number fields */
345 + if ( $currency_helper->is_zero_decimal_currency() ) {
346 + unset(
347 + $general_fields['decimal_separator'],
348 + $general_fields['decimal_count']
349 + );
350 + }
207 351
208 352 $fields = array_merge( $fields, $general_fields );
209 353
210 354 return $fields;