PluginProbe
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) / 1.8.11
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) v1.8.11
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
charitable / includes / admin / settings / class-charitable-general-settings.php

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

359 lines 13.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Charitable General Settings UI.
4 *
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
11 */
12
13 // Exit if accessed directly.
14 if ( ! defined( 'ABSPATH' ) ) {
15 exit;
16 }
17
18 if ( ! class_exists( 'Charitable_General_Settings' ) ) :
19
20 /**
21 * Charitable_General_Settings
22 *
23 * @final
24 * @since 1.0.0
25 */
26 final class Charitable_General_Settings {
27
28 /**
29 * The single instance of this class.
30 *
31 * @var Charitable_General_Settings|null
32 */
33 private static $instance = null;
34
35 /**
36 * Create object instance.
37 *
38 * @since 1.0.0
39 */
40 private function __construct() {
41 }
42
43 /**
44 * Returns and/or create the single instance of this class.
45 *
46 * @since 1.2.0
47 *
48 * @return Charitable_General_Settings
49 */
50 public static function get_instance() {
51 if ( is_null( self::$instance ) ) {
52 self::$instance = new self();
53 }
54
55 return self::$instance;
56 }
57
58 /**
59 * Add the general tab settings fields.
60 *
61 * @since 1.0.0
62 *
63 * @param array[] $fields
64 * @return array
65 */
66 public function add_general_fields( $fields = array() ) {
67 if ( ! charitable_is_settings_view( 'general' ) ) {
68 return array();
69 }
70
71 $currency_helper = charitable_get_currency_helper();
72
73 $general_fields = array(
74 'section' => array(
75 'title' => '',
76 'type' => 'hidden',
77 'priority' => 10000,
78 'value' => 'general',
79 ),
80 'general_settings' => array(
81 'title' => __( 'General Settings', 'charitable' ),
82 'type' => 'heading',
83 'priority' => 1,
84 ),
85 'section_license' => array(
86 'title' => __( 'License', 'charitable' ),
87 'type' => 'heading',
88 'priority' => 2,
89 'class' => 'section-heading general-settings',
90 ),
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' ),
98 ),
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' ),
132 ),
133 ),
134 'decimal_separator' => array(
135 'title' => __( 'Decimal Separator', 'charitable' ),
136 'type' => 'select',
137 'priority' => 14,
138 'default' => '.',
139 'class' => 'general-settings',
140 'options' => array(
141 '.' => 'Period (12.50)',
142 ',' => 'Comma (12,50)',
143 ),
144 ),
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' ),
156 ),
157 ),
158 'decimal_count' => array(
159 'title' => __( 'Number of Decimals', 'charitable' ),
160 'type' => 'number',
161 'priority' => 18,
162 'class' => 'general-settings short',
163 'default' => 2,
164 ),
165 'section_donation_form' => array(
166 'title' => __( 'Donation Form', 'charitable' ),
167 'type' => 'heading',
168 'class' => 'section-heading general-settings',
169 'priority' => 20,
170 ),
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(
178 'separate_page' => __( 'Show on a Separate Page', 'charitable' ),
179 'same_page' => __( 'Show on the Same Page', 'charitable' ),
180 'modal' => __( 'Reveal in a Modal', 'charitable' ),
181 ),
182 'help' => __( 'Choose how you want a campaign\'s donation form to show.', 'charitable' ),
183 ),
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' ),
195 ),
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' ),
270 ),
271 ),
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' ),
273 ),
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' ),
285 ),
286 ),
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' ),
288 ),
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' ),
296 ),
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' ),
308 ),
309 ),
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' ),
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 ),
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 }
351
352 $fields = array_merge( $fields, $general_fields );
353
354 return $fields;
355 }
356 }
357
358 endif;
359