PluginProbe ʕ •ᴥ•ʔ
GiveWP – Donation Plugin and Fundraising Platform / 2.0.3
GiveWP – Donation Plugin and Fundraising Platform v2.0.3
4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 2.30.0 2.31.0 2.31.1 2.32.0 2.33.0 2.33.1 2.33.2 2.33.3 2.33.4 2.33.5 2.4.0 2.4.1 2.4.2 2.4.3 2.4.4 2.4.5 2.4.6 2.4.7 2.5.0 2.5.1 2.5.10 2.5.11 2.5.12 2.5.13 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 2.5.7 2.5.8 2.5.9 2.6.0 2.6.1 2.6.2 2.6.3 2.7.0 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.8.0 2.8.1 2.9.0 2.9.1 2.9.2 2.9.3 2.9.4 2.9.5 2.9.6 2.9.7 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.1.0 3.1.1 3.1.2 3.10.0 3.11.0 3.12.0 3.12.1 3.12.2 3.12.3 3.13.0 3.14.0 3.14.1 3.14.2 3.15.0 3.15.1 3.16.0 3.16.1 3.16.2 3.16.3 3.16.4 3.16.5 3.17.0 3.17.1 3.17.2 3.18.0 3.19.0 3.19.1 3.19.2 3.19.3 3.19.4 3.2.0 3.2.1 3.2.2 3.20.0 3.21.0 3.21.1 3.22.0 3.22.1 3.22.2 3.3.0 3.3.1 3.4.0 3.4.1 3.4.2 3.5.0 3.5.1 3.6.0 3.6.1 3.6.2 3.7.0 3.8.0 3.9.0 4.0.0 4.1.0 4.1.1 4.10.0 4.10.1 4.11.0 4.12.0 4.13.0 4.13.1 4.13.2 4.14.0 4.14.1 4.14.2 4.14.3 4.14.4 4.14.5 4.14.6 4.2.0 4.2.1 4.3.0 4.3.1 4.3.2 4.4.0 4.5.0 4.6.1 4.7.0 4.7.1 4.8.0 4.8.1 4.9.0 trunk 1.9.0 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.10.0 2.10.1 2.10.2 2.10.3 2.10.4 2.11.0 2.11.1 2.11.2 2.11.3 2.12.0 2.12.1 2.12.2 2.12.3 2.13.0 2.13.1 2.13.2 2.13.3 2.13.4 2.14.0 2.15.0 2.16.0 2.16.1 2.17.0 2.17.1 2.17.3 2.18.0 2.18.1 2.19.1 2.19.2 2.19.3 2.19.4 2.19.5 2.19.6 2.19.7 2.19.8 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.20.0 2.20.1 2.20.2 2.21.0 2.21.1 2.21.2 2.21.3 2.21.4 2.22.0 2.22.1 2.22.2 2.22.3 2.23.0 2.23.1 2.23.2 2.24.0 2.24.1 2.24.2 2.25.0 2.25.1 2.25.2 2.25.3 2.26.0 2.27.0 2.27.1 2.27.2 2.27.3 2.28.0 2.29.0 2.29.1 2.29.2
give / includes / admin / settings / class-settings-general.php
give / includes / admin / settings Last commit date
class-settings-addon.php 9 years ago class-settings-advanced.php 8 years ago class-settings-cmb2-backward-compatibility.php 8 years ago class-settings-display.php 8 years ago class-settings-email.php 8 years ago class-settings-gateways.php 8 years ago class-settings-general.php 8 years ago class-settings-license.php 8 years ago
class-settings-general.php
339 lines
1 <?php
2 /**
3 * Give Settings Page/Tab
4 *
5 * @package Give
6 * @subpackage Classes/Give_Settings_General
7 * @copyright Copyright (c) 2016, WordImpress
8 * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
9 * @since 1.8
10 */
11
12 if ( ! defined( 'ABSPATH' ) ) {
13 exit; // Exit if accessed directly.
14 }
15
16 if ( ! class_exists( 'Give_Settings_General' ) ) :
17
18 /**
19 * Give_Settings_General.
20 *
21 * @sine 1.8
22 */
23 class Give_Settings_General extends Give_Settings_Page {
24
25 /**
26 * Constructor.
27 */
28 public function __construct() {
29 $this->id = 'general';
30 $this->label = __( 'General', 'give' );
31
32 $this->default_tab = 'general-settings';
33
34 parent::__construct();
35 }
36
37 /**
38 * Get settings array.
39 *
40 * @since 1.8
41 * @return array
42 */
43 public function get_settings() {
44 $settings = array();
45 $current_section = give_get_current_setting_section();
46
47 switch ( $current_section ) {
48 case 'access-control':
49 $settings = array(
50 // Section 3: Access control.
51 array(
52 'id' => 'give_title_session_control_1',
53 'type' => 'title',
54 ),
55 array(
56 'id' => 'session_lifetime',
57 'name' => __( 'Session Lifetime', 'give' ),
58 'desc' => __( 'The length of time a user\'s session is kept alive. Give starts a new session per user upon donation. Sessions allow donors to view their donation receipts without being logged in.', 'give' ),
59 'type' => 'select',
60 'options' => array(
61 '86400' => __( '24 Hours', 'give' ),
62 '172800' => __( '48 Hours', 'give' ),
63 '259200' => __( '72 Hours', 'give' ),
64 '604800' => __( '1 Week', 'give' ),
65 ),
66 ),
67 array(
68 'id' => 'limit_display_donations',
69 'name' => __( 'Limit Donations Displayed', 'give' ),
70 'desc' => __( 'Adjusts the number of donations displayed to a non logged-in user when they attempt to access the Donation History page without an active session. For security reasons, it\'s best to leave this at 1-3 donations.', 'give' ),
71 'default' => '1',
72 'type' => 'number',
73 'css' => 'width:50px;',
74 'attributes' => array(
75 'min' => '1',
76 'max' => '10',
77 ),
78 ),
79 array(
80 'name' => __( 'Email Access', 'give' ),
81 'desc' => __( 'Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give' ),
82 'id' => 'email_access',
83 'type' => 'radio_inline',
84 'default' => 'disabled',
85 'options' => array(
86 'enabled' => __( 'Enabled', 'give' ),
87 'disabled' => __( 'Disabled', 'give' ),
88 ),
89 ),
90 array(
91 'name' => __( 'Enable reCAPTCHA', 'give' ),
92 'desc' => __( 'Would you like to enable the reCAPTCHA feature?', 'give' ),
93 'id' => 'enable_recaptcha',
94 'type' => 'radio_inline',
95 'default' => 'disabled',
96 'options' => array(
97 'enabled' => __( 'Enabled', 'give' ),
98 'disabled' => __( 'Disabled', 'give' ),
99 ),
100 ),
101 array(
102 'id' => 'recaptcha_key',
103 'name' => __( 'reCAPTCHA Site Key', 'give' ),
104 /* translators: %s: https://www.google.com/recaptcha/ */
105 'desc' => sprintf( __( 'If you would like to prevent spam on the email access form navigate to <a href="%s" target="_blank">the reCAPTCHA website</a> and sign up for an API key and paste your reCAPTCHA site key here. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give' ), esc_url( 'http://docs.givewp.com/recaptcha' ) ),
106 'default' => '',
107 'type' => 'text',
108 ),
109 array(
110 'id' => 'recaptcha_secret',
111 'name' => __( 'reCAPTCHA Secret Key', 'give' ),
112 'desc' => __( 'Please paste the reCAPTCHA secret key here from your reCAPTCHA API Keys panel.', 'give' ),
113 'default' => '',
114 'type' => 'text',
115 ),
116 array(
117 'name' => __( 'Access Control Docs Link', 'give' ),
118 'id' => 'access_control_docs_link',
119 'url' => esc_url( 'http://docs.givewp.com/settings-access-control' ),
120 'title' => __( 'Access Control', 'give' ),
121 'type' => 'give_docs_link',
122 ),
123 array(
124 'id' => 'give_title_session_control_1',
125 'type' => 'sectionend',
126 ),
127 );
128 break;
129
130 case 'currency-settings' :
131 $currency_position_before = __( 'Before - %s&#x200e;10', 'give' );
132 $currency_position_after = __( 'After - 10%s&#x200f;', 'give' );
133
134 $settings = array(
135 // Section 2: Currency
136 array(
137 'type' => 'title',
138 'id' => 'give_title_general_settings_2',
139 ),
140 array(
141 'name' => __( 'Currency Settings', 'give' ),
142 'desc' => '',
143 'type' => 'give_title',
144 'id' => 'give_title_general_settings_2',
145 ),
146 array(
147 'name' => __( 'Currency', 'give' ),
148 'desc' => __( 'The donation currency. Note that some payment gateways have currency restrictions.', 'give' ),
149 'id' => 'currency',
150 'class' => 'give-select-chosen',
151 'type' => 'select',
152 'options' => give_get_currencies(),
153 'default' => 'USD',
154 ),
155 array(
156 'name' => __( 'Currency Position', 'give' ),
157 'desc' => __( 'The position of the currency symbol.', 'give' ),
158 'id' => 'currency_position',
159 'type' => 'select',
160 'options' => array(
161 /* translators: %s: currency symbol */
162 'before' => sprintf( $currency_position_before, give_currency_symbol( give_get_currency() ) ),
163 /* translators: %s: currency symbol */
164 'after' => sprintf( $currency_position_after, give_currency_symbol( give_get_currency() ) ),
165 ),
166 'default' => 'before',
167 'attributes' => array(
168 'data-before-template' => sprintf( $currency_position_before, '{currency_pos}' ),
169 'data-after-template' => sprintf( $currency_position_after, '{currency_pos}' ),
170 ),
171 ),
172 array(
173 'name' => __( 'Thousands Separator', 'give' ),
174 'desc' => __( 'The symbol (typically , or .) to separate thousands.', 'give' ),
175 'id' => 'thousands_separator',
176 'type' => 'text',
177 'default' => ',',
178 'css' => 'width:12em;',
179 ),
180 array(
181 'name' => __( 'Decimal Separator', 'give' ),
182 'desc' => __( 'The symbol (usually , or .) to separate decimal points.', 'give' ),
183 'id' => 'decimal_separator',
184 'type' => 'text',
185 'default' => '.',
186 'css' => 'width:12em;',
187 ),
188 array(
189 'name' => __( 'Number of Decimals', 'give' ),
190 'desc' => __( 'The number of decimal points displayed in amounts.', 'give' ),
191 'id' => 'number_decimals',
192 'type' => 'text',
193 'default' => 2,
194 'css' => 'width:12em;',
195 ),
196 array(
197 'name' => __( 'Currency Options Docs Link', 'give' ),
198 'id' => 'currency_settings_docs_link',
199 'url' => esc_url( 'http://docs.givewp.com/settings-currency' ),
200 'title' => __( 'Currency Settings', 'give' ),
201 'type' => 'give_docs_link',
202 ),
203 array(
204 'type' => 'sectionend',
205 'id' => 'give_title_general_settings_2',
206 ),
207 );
208
209 break;
210
211 case 'general-settings':
212 // Get default country code.
213 $country = give_get_country();
214
215 // get the list of the states of which default country is selected.
216 $states = give_get_states( $country );
217
218 // Get the country list that does not have any states init.
219 $no_states_country = give_no_states_country_list();
220
221 $settings = array(
222 // Section 1: General.
223 array(
224 'type' => 'title',
225 'id' => 'give_title_general_settings_1',
226 ),
227 array(
228 'name' => __( 'General Settings', 'give' ),
229 'desc' => '',
230 'type' => 'give_title',
231 'id' => 'give_title_general_settings_1',
232 ),
233 array(
234 'name' => __( 'Success Page', 'give' ),
235 /* translators: %s: [give_receipt] */
236 'desc' => sprintf( __( 'The page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give' ), '<code>[give_receipt]</code>' ),
237 'id' => 'success_page',
238 'type' => 'select',
239 'options' => give_cmb2_get_post_options( array(
240 'post_type' => 'page',
241 'numberposts' => 999,
242 ) ),
243 ),
244 array(
245 'name' => __( 'Failed Donation Page', 'give' ),
246 'desc' => __( 'The page donors are sent to if their donation is cancelled or fails.', 'give' ),
247 'id' => 'failure_page',
248 'type' => 'select',
249 'options' => give_cmb2_get_post_options( array(
250 'post_type' => 'page',
251 'numberposts' => 999,
252 ) ),
253 ),
254 array(
255 'name' => __( 'Donation History Page', 'give' ),
256 /* translators: %s: [donation_history] */
257 'desc' => sprintf( __( 'The page showing a complete donation history for the current user. The %s shortcode should be on this page.', 'give' ), '<code>[donation_history]</code>' ),
258 'id' => 'history_page',
259 'type' => 'select',
260 'options' => give_cmb2_get_post_options( array(
261 'post_type' => 'page',
262 'numberposts' => 999,
263 ) ),
264 ),
265 array(
266 'name' => __( 'Base Country', 'give' ),
267 'desc' => __( 'The country your site operates from.', 'give' ),
268 'id' => 'base_country',
269 'type' => 'select',
270 'options' => give_get_country_list(),
271 ),
272 /**
273 * Add base state to give setting
274 *
275 * @since 1.8.14
276 */
277 array(
278 'wrapper_class' => ( array_key_exists( $country, $no_states_country ) ? 'give-hidden' : '' ),
279 'name' => __( 'Base State/Province', 'give' ),
280 'desc' => __( 'The state/province your site operates from.', 'give' ),
281 'id' => 'base_state',
282 'type' => ( empty( $states ) ? 'text' : 'select' ),
283 'options' => $states,
284 ),
285 array(
286 'name' => __( 'General Options Docs Link', 'give' ),
287 'id' => 'general_options_docs_link',
288 'url' => esc_url( 'http://docs.givewp.com/settings-general' ),
289 'title' => __( 'General Options', 'give' ),
290 'type' => 'give_docs_link',
291 ),
292 array(
293 'type' => 'sectionend',
294 'id' => 'give_title_general_settings_1',
295 ),
296 );
297 break;
298 }
299
300 /**
301 * Filter the general settings.
302 * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8
303 */
304 $settings = apply_filters( 'give_settings_general', $settings );
305
306 /**
307 * Filter the settings.
308 *
309 * @since 1.8
310 *
311 * @param array $settings
312 */
313 $settings = apply_filters( 'give_get_settings_' . $this->id, $settings );
314
315 // Output.
316 return $settings;
317 }
318
319 /**
320 * Get sections.
321 *
322 * @since 1.8
323 * @return array
324 */
325 public function get_sections() {
326 $sections = array(
327 'general-settings' => __( 'General', 'give' ),
328 'currency-settings' => __( 'Currency', 'give' ),
329 'access-control' => __( 'Access Control', 'give' ),
330 );
331
332 return apply_filters( 'give_get_sections_' . $this->id, $sections );
333 }
334 }
335
336 endif;
337
338 return new Give_Settings_General();
339