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

302 lines 11.8 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) 2022, 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 'section_license' => array(
81 'title' => __( 'License', 'charitable' ),
82 'type' => 'heading',
83 'priority' => 1,
84 'class' => 'section-heading general-settings',
85 'help' => __( 'Your license key provides access to updates and addons.', 'charitable' ),
86 ),
87 'license_key' => array(
88 'title' => __( 'License Key', 'charitable' ),
89 'type' => 'content',
90 'class' => 'general-settings',
91 'content' => Charitable_Licenses_Settings::get_instance()->generate_license_check_html(),
92 'priority' => 2,
93 'help' => __( 'Your license key provides access to updates and addons.', 'charitable' ),
94 ),
95 'section_locale' => array(
96 'title' => __( 'Currency & Location', 'charitable' ),
97 'type' => 'heading',
98 'class' => 'section-heading general-settings',
99 'priority' => 3,
100 ),
101 'country' => array(
102 'title' => __( 'Base Country', 'charitable' ),
103 'type' => 'select',
104 'priority' => 4,
105 'default' => 'US',
106 'class' => 'general-settings',
107 'options' => charitable_get_location_helper()->get_countries(),
108 ),
109 'currency' => array(
110 'title' => __( 'Currency', 'charitable' ),
111 'type' => 'select',
112 'priority' => 10,
113 'default' => 'USD',
114 'class' => 'general-settings',
115 'options' => charitable_get_currency_helper()->get_all_currencies(),
116 ),
117 'currency_format' => array(
118 'title' => __( 'Currency Format', 'charitable' ),
119 'type' => 'select',
120 'priority' => 12,
121 'default' => 'left',
122 'class' => 'general-settings',
123 'options' => array(
124 'left' => $currency_helper->get_monetary_amount( '23', false, false, 'left' ),
125 'right' => $currency_helper->get_monetary_amount( '23', false, false, 'right' ),
126 'left-with-space' => $currency_helper->get_monetary_amount( '23', false, false, 'left-with-space' ),
127 'right-with-space' => $currency_helper->get_monetary_amount( '23', false, false, 'right-with-space' ),
128 ),
129 ),
130 'decimal_separator' => array(
131 'title' => __( 'Decimal Separator', 'charitable' ),
132 'type' => 'select',
133 'priority' => 14,
134 'default' => '.',
135 'class' => 'general-settings',
136 'options' => array(
137 '.' => 'Period (12.50)',
138 ',' => 'Comma (12,50)',
139 ),
140 ),
141 'thousands_separator' => array(
142 'title' => __( 'Thousands Separator', 'charitable' ),
143 'type' => 'select',
144 'priority' => 16,
145 'default' => ',',
146 'class' => 'general-settings',
147 'options' => array(
148 ',' => __( 'Comma (10,000)', 'charitable' ),
149 '.' => __( 'Period (10.000)', 'charitable' ),
150 ' ' => __( 'Space (10 000)', 'charitable' ),
151 'none' => __( 'None', 'charitable' ),
152 ),
153 ),
154 'decimal_count' => array(
155 'title' => __( 'Number of Decimals', 'charitable' ),
156 'type' => 'number',
157 'priority' => 18,
158 'class' => 'general-settings',
159 'default' => 2,
160 'class' => 'short',
161 ),
162 'section_donation_form' => array(
163 'title' => __( 'Donation Form', 'charitable' ),
164 'type' => 'heading',
165 'class' => 'section-heading general-settings',
166 'priority' => 20,
167 ),
168 'donation_form_display' => array(
169 'title' => __( 'Display Options', 'charitable' ),
170 'type' => 'select',
171 'priority' => 22,
172 'default' => 'separate_page',
173 'class' => 'general-settings',
174 'options' => array(
175 'separate_page' => __( 'Show on a Separate Page', 'charitable' ),
176 'same_page' => __( 'Show on the Same Page', 'charitable' ),
177 'modal' => __( 'Reveal in a Modal', 'charitable' ),
178 ),
179 'help' => __( 'Choose how you want a campaign\'s donation form to show.', 'charitable' ),
180 ),
181 'donation_form_minimal_fields' => array(
182 'title' => __( 'Only show required fields', 'charitable' ),
183 'type' => 'radio',
184 'priority' => 24,
185 'class' => 'general-settings',
186 'default' => '0',
187 'options' => array(
188 '1' => __( 'Yes', 'charitable' ),
189 '0' => __( 'No', 'charitable' ),
190 ),
191 'help' => __( 'Choose if you wish fields not required on the donation form to be hidden.', 'charitable' ),
192 ),
193 'donation_form_minimal_amount_notice_display' => array(
194 'title' => __( 'Minimum donation location <span class="badge beta">Beta</span>', 'charitable' ),
195 'type' => 'select',
196 'priority' => 26,
197 'class' => 'general-settings',
198 'default' => 'below_amount_selection',
199 'options' => array(
200 'below_amount_selection' => __( 'Below donation choices / amounts', 'charitable' ),
201 'below_donation_title' => __( 'Below donation title', 'charitable' ),
202 'above_donation_title' => __( 'Above donation title', 'charitable' ),
203 ),
204 'help' => __( 'Choose where you wish the minimum donation message to appear on the donation form, if a minimum is set for the campaign.', 'charitable' ),
205 ),
206 'donation_form_notices_display' => array(
207 'title' => __( 'Notice display location <span class="badge beta">Beta</span>', 'charitable' ),
208 'type' => 'select',
209 'priority' => 28,
210 'default' => 'top',
211 'class' => 'general-settings',
212 'options' => array(
213 'top' => __( 'Top', 'charitable' ),
214 'bottom' => __( 'Bottom', 'charitable' ),
215 ),
216 'help' => __( 'Choose where notice and validation errors appear on the donation form.', 'charitable' ),
217 ),
218 'donation_form_default_highlight_colour' => array(
219 'title' => __( 'Default highlight color <span class="badge beta">Beta</span>', 'charitable' ),
220 'type' => 'color-picker',
221 'priority' => 28,
222 'default' => false,
223 'class' => 'general-settings charitable-color-field',
224 'help' => __( 'Define a highlight color for form notices, errors, and other UI. Default is ', 'charitable' ) . apply_filters( 'charitable_default_highlight_colour', '#f89d35' ) . '. CSS in your theme and/or third-party plugin may be able to override.',
225 ),
226 'section_pages' => array(
227 'title' => __( 'Pages', 'charitable' ),
228 'type' => 'heading',
229 'class' => 'section-heading general-settings',
230 'priority' => 30,
231 ),
232 'login_page' => array(
233 'title' => __( 'Login Page', 'charitable' ),
234 'type' => 'select',
235 'class' => 'general-settings',
236 'priority' => 32,
237 'default' => 'wp',
238 'options' => array(
239 'wp' => __( 'Use WordPress Login', 'charitable' ),
240 'pages' => array(
241 'options' => charitable_get_admin_settings()->get_pages(),
242 'label' => __( 'Choose a Static Page', 'charitable' ),
243 ),
244 ),
245 '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' ),
246 ),
247 'registration_page' => array(
248 'title' => __( 'Registration Page', 'charitable' ),
249 'type' => 'select',
250 'priority' => 34,
251 'default' => 'wp',
252 'class' => 'general-settings',
253 'options' => array(
254 'wp' => __( 'Use WordPress Registration Page', 'charitable' ),
255 'pages' => array(
256 'options' => charitable_get_admin_settings()->get_pages(),
257 'label' => __( 'Choose a Static Page', 'charitable' ),
258 ),
259 ),
260 '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' ),
261 ),
262 'profile_page' => array(
263 'title' => __( 'Profile Page', 'charitable' ),
264 'type' => 'select',
265 'priority' => 36,
266 'class' => 'general-settings',
267 'options' => charitable_get_admin_settings()->get_pages(),
268 'help' => __( 'The static page should contain the <code>[charitable_profile]</code> shortcode.', 'charitable' ),
269 ),
270 'donation_receipt_page' => array(
271 'title' => __( 'Donation Receipt Page', 'charitable' ),
272 'type' => 'select',
273 'priority' => 38,
274 'default' => 'auto',
275 'class' => 'general-settings',
276 'options' => array(
277 'auto' => __( 'Automatic', 'charitable' ),
278 'pages' => array(
279 'options' => charitable_get_admin_settings()->get_pages(),
280 'label' => __( 'Choose a Static Page', 'charitable' ),
281 ),
282 ),
283 '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' ),
284 ),
285 );
286
287 /* If we're using a zero-decimal currency, get rid of the decimal separator and decimal number fields */
288 if ( $currency_helper->is_zero_decimal_currency() ) {
289 unset(
290 $general_fields['decimal_separator'],
291 $general_fields['decimal_count']
292 );
293 }
294
295 $fields = array_merge( $fields, $general_fields );
296
297 return $fields;
298 }
299 }
300
301 endif;
302