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

294 lines 11.1 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', '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', '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 'section_pages' => array(
219 'title' => __( 'Pages', 'charitable' ),
220 'type' => 'heading',
221 'class' => 'section-heading general-settings',
222 'priority' => 30,
223 ),
224 'login_page' => array(
225 'title' => __( 'Login Page', 'charitable' ),
226 'type' => 'select',
227 'class' => 'general-settings',
228 'priority' => 32,
229 'default' => 'wp',
230 'options' => array(
231 'wp' => __( 'Use WordPress Login', 'charitable' ),
232 'pages' => array(
233 'options' => charitable_get_admin_settings()->get_pages(),
234 'label' => __( 'Choose a Static Page', 'charitable' ),
235 ),
236 ),
237 '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' ),
238 ),
239 'registration_page' => array(
240 'title' => __( 'Registration Page', 'charitable' ),
241 'type' => 'select',
242 'priority' => 34,
243 'default' => 'wp',
244 'class' => 'general-settings',
245 'options' => array(
246 'wp' => __( 'Use WordPress Registration Page', 'charitable' ),
247 'pages' => array(
248 'options' => charitable_get_admin_settings()->get_pages(),
249 'label' => __( 'Choose a Static Page', 'charitable' ),
250 ),
251 ),
252 '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' ),
253 ),
254 'profile_page' => array(
255 'title' => __( 'Profile Page', 'charitable' ),
256 'type' => 'select',
257 'priority' => 36,
258 'class' => 'general-settings',
259 'options' => charitable_get_admin_settings()->get_pages(),
260 'help' => __( 'The static page should contain the <code>[charitable_profile]</code> shortcode.', 'charitable' ),
261 ),
262 'donation_receipt_page' => array(
263 'title' => __( 'Donation Receipt Page', 'charitable' ),
264 'type' => 'select',
265 'priority' => 38,
266 'default' => 'auto',
267 'class' => 'general-settings',
268 'options' => array(
269 'auto' => __( 'Automatic', 'charitable' ),
270 'pages' => array(
271 'options' => charitable_get_admin_settings()->get_pages(),
272 'label' => __( 'Choose a Static Page', 'charitable' ),
273 ),
274 ),
275 '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' ),
276 ),
277 );
278
279 /* If we're using a zero-decimal currency, get rid of the decimal separator and decimal number fields */
280 if ( $currency_helper->is_zero_decimal_currency() ) {
281 unset(
282 $general_fields['decimal_separator'],
283 $general_fields['decimal_count']
284 );
285 }
286
287 $fields = array_merge( $fields, $general_fields );
288
289 return $fields;
290 }
291 }
292
293 endif;
294