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

215 lines 7.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 * @version 1.0.0
7 * @author Eric Daams
8 * @copyright Copyright (c) 2019, Studio 164a
9 * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
10 */
11
12 // Exit if accessed directly.
13 if ( ! defined( 'ABSPATH' ) ) { exit; }
14
15 if ( ! class_exists( 'Charitable_General_Settings' ) ) :
16
17 /**
18 * Charitable_General_Settings
19 *
20 * @final
21 * @since 1.0.0
22 */
23 final class Charitable_General_Settings {
24
25 /**
26 * The single instance of this class.
27 *
28 * @var Charitable_General_Settings|null
29 */
30 private static $instance = null;
31
32 /**
33 * Create object instance.
34 *
35 * @since 1.0.0
36 */
37 private function __construct() {
38 }
39
40 /**
41 * Returns and/or create the single instance of this class.
42 *
43 * @since 1.2.0
44 *
45 * @return Charitable_General_Settings
46 */
47 public static function get_instance() {
48 if ( is_null( self::$instance ) ) {
49 self::$instance = new self();
50 }
51
52 return self::$instance;
53 }
54
55 /**
56 * Add the general tab settings fields.
57 *
58 * @since 1.0.0
59 *
60 * @param array[] $fields
61 * @return array
62 */
63 public function add_general_fields( $fields = array() ) {
64 if ( ! charitable_is_settings_view( 'general' ) ) {
65 return array();
66 }
67
68 $general_fields = array(
69 'section' => array(
70 'title' => '',
71 'type' => 'hidden',
72 'priority' => 10000,
73 'value' => 'general',
74 ),
75 'section_locale' => array(
76 'title' => __( 'Currency & Location', 'charitable' ),
77 'type' => 'heading',
78 'priority' => 2,
79 ),
80 'country' => array(
81 'title' => __( 'Base Country', 'charitable' ),
82 'type' => 'select',
83 'priority' => 4,
84 'default' => 'AU',
85 'options' => charitable_get_location_helper()->get_countries(),
86 ),
87 'currency' => array(
88 'title' => __( 'Currency', 'charitable' ),
89 'type' => 'select',
90 'priority' => 10,
91 'default' => 'AUD',
92 'options' => charitable_get_currency_helper()->get_all_currencies(),
93 ),
94 'currency_format' => array(
95 'title' => __( 'Currency Format', 'charitable' ),
96 'type' => 'select',
97 'priority' => 12,
98 'default' => 'left',
99 'options' => array(
100 'left' => '$23.00',
101 'right' => '23.00$',
102 'left-with-space' => '$ 23.00',
103 'right-with-space' => '23.00 $',
104 ),
105 ),
106 'decimal_separator' => array(
107 'title' => __( 'Decimal Separator', 'charitable' ),
108 'type' => 'select',
109 'priority' => 14,
110 'default' => '.',
111 'options' => array(
112 '.' => 'Period (12.50)',
113 ',' => 'Comma (12,50)',
114 ),
115 ),
116 'thousands_separator' => array(
117 'title' => __( 'Thousands Separator', 'charitable' ),
118 'type' => 'select',
119 'priority' => 16,
120 'default' => ',',
121 'options' => array(
122 ',' => __( 'Comma (10,000)', 'charitable' ),
123 '.' => __( 'Period (10.000)', 'charitable' ),
124 ' ' => __( 'Space (10 000)', 'charitable' ),
125 'none' => __( 'None', 'charitable' ),
126 ),
127 ),
128 'decimal_count' => array(
129 'title' => __( 'Number of Decimals', 'charitable' ),
130 'type' => 'number',
131 'priority' => 18,
132 'default' => 2,
133 'class' => 'short',
134 ),
135 'section_donation_form' => array(
136 'title' => __( 'Donation Form', 'charitable' ),
137 'type' => 'heading',
138 'priority' => 20,
139 ),
140 'donation_form_display' => array(
141 'title' => __( 'Display Options', 'charitable' ),
142 'type' => 'select',
143 'priority' => 22,
144 'default' => 'separate_page',
145 'options' => array(
146 'separate_page' => __( 'Show on a Separate Page', 'charitable' ),
147 'same_page' => __( 'Show on the Same Page', 'charitable' ),
148 'modal' => __( 'Reveal in a Modal', 'charitable' ),
149 ),
150 'help' => __( 'Choose how you want a campaign\'s donation form to show.', 'charitable' ),
151 ),
152 'section_pages' => array(
153 'title' => __( 'Pages', 'charitable' ),
154 'type' => 'heading',
155 'priority' => 30,
156 ),
157 'login_page' => array(
158 'title' => __( 'Login Page', 'charitable' ),
159 'type' => 'select',
160 'priority' => 32,
161 'default' => 'wp',
162 'options' => array(
163 'wp' => __( 'Use WordPress Login', 'charitable' ),
164 'pages' => array(
165 'options' => charitable_get_admin_settings()->get_pages(),
166 'label' => __( 'Choose a Static Page', 'charitable' ),
167 ),
168 ),
169 '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' ),
170 ),
171 'registration_page' => array(
172 'title' => __( 'Registration Page', 'charitable' ),
173 'type' => 'select',
174 'priority' => 34,
175 'default' => 'wp',
176 'options' => array(
177 'wp' => __( 'Use WordPress Registration Page', 'charitable' ),
178 'pages' => array(
179 'options' => charitable_get_admin_settings()->get_pages(),
180 'label' => __( 'Choose a Static Page', 'charitable' ),
181 ),
182 ),
183 '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' ),
184 ),
185 'profile_page' => array(
186 'title' => __( 'Profile Page', 'charitable' ),
187 'type' => 'select',
188 'priority' => 36,
189 'options' => charitable_get_admin_settings()->get_pages(),
190 'help' => __( 'The static page should contain the <code>[charitable_profile]</code> shortcode.', 'charitable' ),
191 ),
192 'donation_receipt_page' => array(
193 'title' => __( 'Donation Receipt Page', 'charitable' ),
194 'type' => 'select',
195 'priority' => 38,
196 'default' => 'auto',
197 'options' => array(
198 'auto' => __( 'Automatic', 'charitable' ),
199 'pages' => array(
200 'options' => charitable_get_admin_settings()->get_pages(),
201 'label' => __( 'Choose a Static Page', 'charitable' ),
202 ),
203 ),
204 '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' ),
205 ),
206 );
207
208 $fields = array_merge( $fields, $general_fields );
209
210 return $fields;
211 }
212 }
213
214 endif;
215