PluginProbe
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) / 1.7.0
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) v1.7.0
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-general-settings.php

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

239 lines 8.3 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_locale' => array(
81 'title' => __( 'Currency & Location', 'charitable' ),
82 'type' => 'heading',
83 'priority' => 2,
84 ),
85 'country' => array(
86 'title' => __( 'Base Country', 'charitable' ),
87 'type' => 'select',
88 'priority' => 4,
89 'default' => 'US',
90 'options' => charitable_get_location_helper()->get_countries(),
91 ),
92 'currency' => array(
93 'title' => __( 'Currency', 'charitable' ),
94 'type' => 'select',
95 'priority' => 10,
96 'default' => 'USD',
97 'options' => charitable_get_currency_helper()->get_all_currencies(),
98 ),
99 'currency_format' => array(
100 'title' => __( 'Currency Format', 'charitable' ),
101 'type' => 'select',
102 'priority' => 12,
103 'default' => 'left',
104 'options' => array(
105 'left' => $currency_helper->get_monetary_amount( '23', false, false, 'left' ),
106 'right' => $currency_helper->get_monetary_amount( '23', false, false, 'right' ),
107 'left-with-space' => $currency_helper->get_monetary_amount( '23', false, false, 'left-with-space' ),
108 'right-with-space' => $currency_helper->get_monetary_amount( '23', false, false, 'right-with-space' ),
109 ),
110 ),
111 'decimal_separator' => array(
112 'title' => __( 'Decimal Separator', 'charitable' ),
113 'type' => 'select',
114 'priority' => 14,
115 'default' => '.',
116 'options' => array(
117 '.' => 'Period (12.50)',
118 ',' => 'Comma (12,50)',
119 ),
120 ),
121 'thousands_separator' => array(
122 'title' => __( 'Thousands Separator', 'charitable' ),
123 'type' => 'select',
124 'priority' => 16,
125 'default' => ',',
126 'options' => array(
127 ',' => __( 'Comma (10,000)', 'charitable' ),
128 '.' => __( 'Period (10.000)', 'charitable' ),
129 ' ' => __( 'Space (10 000)', 'charitable' ),
130 'none' => __( 'None', 'charitable' ),
131 ),
132 ),
133 'decimal_count' => array(
134 'title' => __( 'Number of Decimals', 'charitable' ),
135 'type' => 'number',
136 'priority' => 18,
137 'default' => 2,
138 'class' => 'short',
139 ),
140 'section_donation_form' => array(
141 'title' => __( 'Donation Form', 'charitable' ),
142 'type' => 'heading',
143 'priority' => 20,
144 ),
145 'donation_form_display' => array(
146 'title' => __( 'Display Options', 'charitable' ),
147 'type' => 'select',
148 'priority' => 22,
149 'default' => 'separate_page',
150 'options' => array(
151 'separate_page' => __( 'Show on a Separate Page', 'charitable' ),
152 'same_page' => __( 'Show on the Same Page', 'charitable' ),
153 'modal' => __( 'Reveal in a Modal', 'charitable' ),
154 ),
155 'help' => __( 'Choose how you want a campaign\'s donation form to show.', 'charitable' ),
156 ),
157 'donation_form_minimal_fields' => array(
158 'title' => __( 'Only show required fields', 'charitable' ),
159 'type' => 'radio',
160 'priority' => 24,
161 'default' => '0',
162 'options' => array(
163 '1' => __( 'Yes', 'charitable' ),
164 '0' => __( 'No', 'charitable' ),
165 ),
166 'help' => __( 'Choose if you wish fields not required on the donation form to be hidden.', 'charitable' ),
167 ),
168 'section_pages' => array(
169 'title' => __( 'Pages', 'charitable' ),
170 'type' => 'heading',
171 'priority' => 30,
172 ),
173 'login_page' => array(
174 'title' => __( 'Login Page', 'charitable' ),
175 'type' => 'select',
176 'priority' => 32,
177 'default' => 'wp',
178 'options' => array(
179 'wp' => __( 'Use WordPress Login', 'charitable' ),
180 'pages' => array(
181 'options' => charitable_get_admin_settings()->get_pages(),
182 'label' => __( 'Choose a Static Page', 'charitable' ),
183 ),
184 ),
185 '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' ),
186 ),
187 'registration_page' => array(
188 'title' => __( 'Registration Page', 'charitable' ),
189 'type' => 'select',
190 'priority' => 34,
191 'default' => 'wp',
192 'options' => array(
193 'wp' => __( 'Use WordPress Registration Page', 'charitable' ),
194 'pages' => array(
195 'options' => charitable_get_admin_settings()->get_pages(),
196 'label' => __( 'Choose a Static Page', 'charitable' ),
197 ),
198 ),
199 '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' ),
200 ),
201 'profile_page' => array(
202 'title' => __( 'Profile Page', 'charitable' ),
203 'type' => 'select',
204 'priority' => 36,
205 'options' => charitable_get_admin_settings()->get_pages(),
206 'help' => __( 'The static page should contain the <code>[charitable_profile]</code> shortcode.', 'charitable' ),
207 ),
208 'donation_receipt_page' => array(
209 'title' => __( 'Donation Receipt Page', 'charitable' ),
210 'type' => 'select',
211 'priority' => 38,
212 'default' => 'auto',
213 'options' => array(
214 'auto' => __( 'Automatic', 'charitable' ),
215 'pages' => array(
216 'options' => charitable_get_admin_settings()->get_pages(),
217 'label' => __( 'Choose a Static Page', 'charitable' ),
218 ),
219 ),
220 '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' ),
221 ),
222 );
223
224 /* If we're using a zero-decimal currency, get rid of the decimal separator and decimal number fields */
225 if ( $currency_helper->is_zero_decimal_currency() ) {
226 unset(
227 $general_fields['decimal_separator'],
228 $general_fields['decimal_count']
229 );
230 }
231
232 $fields = array_merge( $fields, $general_fields );
233
234 return $fields;
235 }
236 }
237
238 endif;
239