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

228 lines 7.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 Eric Daams
7 * @copyright Copyright (c) 2022, Studio 164a
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' => 'AU',
90 'options' => charitable_get_location_helper()->get_countries(),
91 ),
92 'currency' => array(
93 'title' => __( 'Currency', 'charitable' ),
94 'type' => 'select',
95 'priority' => 10,
96 'default' => 'AUD',
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 'section_pages' => array(
158 'title' => __( 'Pages', 'charitable' ),
159 'type' => 'heading',
160 'priority' => 30,
161 ),
162 'login_page' => array(
163 'title' => __( 'Login Page', 'charitable' ),
164 'type' => 'select',
165 'priority' => 32,
166 'default' => 'wp',
167 'options' => array(
168 'wp' => __( 'Use WordPress Login', 'charitable' ),
169 'pages' => array(
170 'options' => charitable_get_admin_settings()->get_pages(),
171 'label' => __( 'Choose a Static Page', 'charitable' ),
172 ),
173 ),
174 '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' ),
175 ),
176 'registration_page' => array(
177 'title' => __( 'Registration Page', 'charitable' ),
178 'type' => 'select',
179 'priority' => 34,
180 'default' => 'wp',
181 'options' => array(
182 'wp' => __( 'Use WordPress Registration Page', 'charitable' ),
183 'pages' => array(
184 'options' => charitable_get_admin_settings()->get_pages(),
185 'label' => __( 'Choose a Static Page', 'charitable' ),
186 ),
187 ),
188 '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' ),
189 ),
190 'profile_page' => array(
191 'title' => __( 'Profile Page', 'charitable' ),
192 'type' => 'select',
193 'priority' => 36,
194 'options' => charitable_get_admin_settings()->get_pages(),
195 'help' => __( 'The static page should contain the <code>[charitable_profile]</code> shortcode.', 'charitable' ),
196 ),
197 'donation_receipt_page' => array(
198 'title' => __( 'Donation Receipt Page', 'charitable' ),
199 'type' => 'select',
200 'priority' => 38,
201 'default' => 'auto',
202 'options' => array(
203 'auto' => __( 'Automatic', 'charitable' ),
204 'pages' => array(
205 'options' => charitable_get_admin_settings()->get_pages(),
206 'label' => __( 'Choose a Static Page', 'charitable' ),
207 ),
208 ),
209 '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' ),
210 ),
211 );
212
213 /* If we're using a zero-decimal currency, get rid of the decimal separator and decimal number fields */
214 if ( $currency_helper->is_zero_decimal_currency() ) {
215 unset(
216 $general_fields['decimal_separator'],
217 $general_fields['decimal_count']
218 );
219 }
220
221 $fields = array_merge( $fields, $general_fields );
222
223 return $fields;
224 }
225 }
226
227 endif;
228