Give_Settings_General::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 0
dl 0
loc 15
rs 9.7666
c 0
b 0
f 0
1
<?php
2
/**
3
 * Give Settings Page/Tab
4
 *
5
 * @package     Give
6
 * @subpackage  Classes/Give_Settings_General
7
 * @copyright   Copyright (c) 2016, GiveWP
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
			if ( $this->id === give_get_current_setting_tab() ) {
35
				add_action( 'give_save_settings_give_settings', array( $this, '_give_change_donation_stating_number' ), 10, 3 );
36
				add_action( 'give_admin_field_give_sequential_donation_code_preview', array( $this, '_render_give_sequential_donation_code_preview' ), 10, 3 );
37
				add_action( 'give_admin_field_give_currency_preview', array( $this, '_render_give_currency_preview' ), 10, 2 );
38
				add_action( 'give_admin_field_give_unlock_all_settings', array( $this, '_render_give_unlock_all_settings' ), 10, 3 );
39
			}
40
41
			parent::__construct();
42
		}
43
44
		/**
45
		 * Get settings array.
46
		 *
47
		 * @since  1.8
48
		 * @return array
49
		 */
50
		public function get_settings() {
51
			$settings        = array();
52
			$current_section = give_get_current_setting_section();
53
54
			switch ( $current_section ) {
55
				case 'access-control':
56
					$settings = array(
57
						// Section 3: Access control.
58
						array(
59
							'id'   => 'give_title_session_control_1',
60
							'type' => 'title',
61
						),
62
						array(
63
							'id'      => 'session_lifetime',
64
							'name'    => __( 'Session Lifetime', 'give' ),
65
							'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' ),
66
							'type'    => 'select',
67
							'options' => array(
68
								'86400'  => __( '24 Hours', 'give' ),
69
								'172800' => __( '48 Hours', 'give' ),
70
								'259200' => __( '72 Hours', 'give' ),
71
								'604800' => __( '1 Week', 'give' ),
72
							),
73
						),
74
						array(
75
							'id'         => 'limit_display_donations',
76
							'name'       => __( 'Limit Donations Displayed', 'give' ),
77
							'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' ),
78
							'default'    => '1',
79
							'type'       => 'number',
80
							'css'        => 'width:50px;',
81
							'attributes' => array(
82
								'min' => '1',
83
								'max' => '10',
84
							),
85
						),
86
						array(
87
							'name'    => __( 'Email Access', 'give' ),
88
							'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' ),
89
							'id'      => 'email_access',
90
							'type'    => 'radio_inline',
91
							'default' => 'disabled',
92
							'options' => array(
93
								'enabled'  => __( 'Enabled', 'give' ),
94
								'disabled' => __( 'Disabled', 'give' ),
95
							),
96
						),
97
						array(
98
							'name'    => __( 'Enable reCAPTCHA', 'give' ),
99
							'desc'    => __( 'Would you like to enable the reCAPTCHA feature?', 'give' ),
100
							'id'      => 'enable_recaptcha',
101
							'type'    => 'radio_inline',
102
							'default' => 'disabled',
103
							'options' => array(
104
								'enabled'  => __( 'Enabled', 'give' ),
105
								'disabled' => __( 'Disabled', 'give' ),
106
							),
107
						),
108
						array(
109
							'id'      => 'recaptcha_key',
110
							'name'    => __( 'reCAPTCHA Site Key', 'give' ),
111
							/* translators: %s: https://www.google.com/recaptcha/ */
112
							'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' ) ),
113
							'default' => '',
114
							'type'    => 'text',
115
						),
116
						array(
117
							'id'      => 'recaptcha_secret',
118
							'name'    => __( 'reCAPTCHA Secret Key', 'give' ),
119
							'desc'    => __( 'Please paste the reCAPTCHA secret key here from your  reCAPTCHA API Keys panel.', 'give' ),
120
							'default' => '',
121
							'type'    => 'text',
122
						),
123
						array(
124
							'name'  => __( 'Access Control Docs Link', 'give' ),
125
							'id'    => 'access_control_docs_link',
126
							'url'   => esc_url( 'http://docs.givewp.com/settings-access-control' ),
127
							'title' => __( 'Access Control', 'give' ),
128
							'type'  => 'give_docs_link',
129
						),
130
						array(
131
							'id'   => 'give_title_session_control_1',
132
							'type' => 'sectionend',
133
						),
134
					);
135
					break;
136
137
				case 'currency-settings' :
138
					$currency_position_before = __( 'Before - %s&#x200e;10', 'give' );
139
					$currency_position_after  = __( 'After - 10%s&#x200f;', 'give' );
140
141
					$settings = array(
142
						// Section 2: Currency
143
						array(
144
							'type' => 'title',
145
							'id'   => 'give_title_general_settings_2',
146
						),
147
						array(
148
							'name' => __( 'Currency Settings', 'give' ),
149
							'desc' => '',
150
							'type' => 'give_title',
151
							'id'   => 'give_title_general_settings_2',
152
						),
153
						array(
154
							'name'    => __( 'Currency', 'give' ),
155
							'desc'    => __( 'The donation currency. Note that some payment gateways have currency restrictions.', 'give' ),
156
							'id'      => 'currency',
157
							'class'   => 'give-select-chosen',
158
							'type'    => 'select',
159
							'options' => give_get_currencies(),
160
							'default' => 'USD',
161
						),
162
						array(
163
							'name'       => __( 'Currency Position', 'give' ),
164
							'desc'       => __( 'The position of the currency symbol.', 'give' ),
165
							'id'         => 'currency_position',
166
							'type'       => 'select',
167
							'options'    => array(
168
								/* translators: %s: currency symbol */
169
								'before' => sprintf( $currency_position_before, give_currency_symbol( give_get_currency() ) ),
170
								/* translators: %s: currency symbol */
171
								'after'  => sprintf( $currency_position_after, give_currency_symbol( give_get_currency() ) ),
172
							),
173
							'default'    => 'before',
174
							'attributes' => array(
175
								'data-before-template' => sprintf( $currency_position_before, '{currency_pos}' ),
176
								'data-after-template'  => sprintf( $currency_position_after, '{currency_pos}' ),
177
							),
178
						),
179
						array(
180
							'name'    => __( 'Thousands Separator', 'give' ),
181
							'desc'    => __( 'The symbol (typically , or .) to separate thousands.', 'give' ),
182
							'id'      => 'thousands_separator',
183
							'type'    => 'text',
184
							'default' => ',',
185
							'css'     => 'width:12em;',
186
						),
187
						array(
188
							'name'    => __( 'Decimal Separator', 'give' ),
189
							'desc'    => __( 'The symbol (usually , or .) to separate decimal points.', 'give' ),
190
							'id'      => 'decimal_separator',
191
							'type'    => 'text',
192
							'default' => '.',
193
							'css'     => 'width:12em;',
194
						),
195
						array(
196
							'name'    => __( 'Number of Decimals', 'give' ),
197
							'desc'    => __( 'The number of decimal points displayed in amounts.', 'give' ),
198
							'id'      => 'number_decimals',
199
							'type'    => 'text',
200
							'default' => 2,
201
							'css'     => 'width:12em;',
202
						),
203
						array(
204
							'name'    => __( 'Currency Preview', 'give' ),
205
							'desc'    => __( 'A preview of the formatted currency. This preview cannot be edited directly as it is generated from the settings above.', 'give' ),
206
							'id'      => 'currency_preview',
207
							'type'    => 'give_currency_preview',
208
							'default' => give_format_amount( 123456.12345,
209
								array(
210
									'sanitize' => false,
211
									'currency' => give_get_option( 'currency' ),
212
								)
213
							),
214
							'css'     => 'width:12em;',
215
						),
216
						array(
217
							'name'  => __( 'Currency Options Docs Link', 'give' ),
218
							'id'    => 'currency_settings_docs_link',
219
							'url'   => esc_url( 'http://docs.givewp.com/settings-currency' ),
220
							'title' => __( 'Currency Settings', 'give' ),
221
							'type'  => 'give_docs_link',
222
						),
223
						array(
224
							'type' => 'sectionend',
225
							'id'   => 'give_title_general_settings_2',
226
						),
227
					);
228
229
					break;
230
231
				case 'general-settings':
232
					// Get default country code.
233
					$countries = give_get_country();
234
235
					// get the list of the states of which default country is selected.
236
					$states = give_get_states( $countries );
237
238
					// Get the country list that does not have any states init.
239
					$no_states_country = give_no_states_country_list();
240
241
					$states_label = give_get_states_label();
242
					$country      = give_get_country();
243
					$label        = __( 'State', 'give' );
244
					// Check if $country code exists in the array key for states label.
245
					if ( array_key_exists( $country, $states_label ) ) {
246
						$label = $states_label[ $country ];
247
					}
248
0 ignored issues
show
Coding Style introduced by
Functions must not contain multiple empty lines in a row; found 2 empty lines
Loading history...
249
250
					$settings = array(
251
						// Section 1: General.
252
						array(
253
							'type' => 'title',
254
							'id'   => 'give_title_general_settings_1',
255
						),
256
						array(
257
							'name' => __( 'General Settings', 'give' ),
258
							'desc' => '',
259
							'type' => 'give_title',
260
							'id'   => 'give_title_general_settings_1',
261
						),
262
						array(
263
							'name'       => __( 'Success Page', 'give' ),
264
							/* translators: %s: [give_receipt] */
265
							'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>' ),
266
							'id'         => 'success_page',
267
							'class'      => 'give-select give-select-chosen',
268
							'type'       => 'select',
269
							'options'    => give_cmb2_get_post_options( array(
270
								'post_type'   => 'page',
271
								'numberposts' => 30,
272
							) ),
273
							'attributes' => array(
274
								'data-search-type' => 'pages',
275
								'data-placeholder' => esc_html__('Choose a page', 'give'),
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after opening bracket; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing bracket; 0 found
Loading history...
276
							)
277
						),
278
						array(
279
							'name'       => __( 'Failed Donation Page', 'give' ),
280
							'desc'       => __( 'The page donors are sent to if their donation is cancelled or fails.', 'give' ),
281
							'class'      => 'give-select give-select-chosen',
282
							'id'         => 'failure_page',
283
							'type'       => 'select',
284
							'options'    => give_cmb2_get_post_options( array(
285
								'post_type'   => 'page',
286
								'numberposts' => 30,
287
							) ),
288
							'attributes' => array(
289
								'data-search-type' => 'pages',
290
								'data-placeholder' => esc_html__('Choose a page', 'give'),
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after opening bracket; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing bracket; 0 found
Loading history...
291
							)
292
						),
293
						array(
294
							'name'       => __( 'Donation History Page', 'give' ),
295
							/* translators: %s: [donation_history] */
296
							'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>' ),
297
							'id'         => 'history_page',
298
							'class'      => 'give-select give-select-chosen',
299
							'type'       => 'select',
300
							'options'    => give_cmb2_get_post_options( array(
301
								'post_type'   => 'page',
302
								'numberposts' => 30,
303
							) ),
304
							'attributes' => array(
305
								'data-search-type' => 'pages',
306
								'data-placeholder' => esc_html__('Choose a page', 'give'),
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after opening bracket; 0 found
Loading history...
Coding Style introduced by
Expected 1 spaces before closing bracket; 0 found
Loading history...
307
							)
308
						),
309
						array(
310
							'name'       => __( 'Base Country', 'give' ),
311
							'desc'       => __( 'The country your site operates from.', 'give' ),
312
							'id'         => 'base_country',
313
							'type'       => 'select',
314
							'options'    => give_get_country_list(),
315
							'class'      => 'give-select give-select-chosen',
316
							'attributes' => array(
317
								'data-search-type' => 'no_ajax'
318
							),
319
							'default'    => $country,
320
						),
321
						/**
322
						 * Add base state to give setting
323
						 *
324
						 * @since 1.8.14
325
						 */
326
						array(
327
							'wrapper_class' => ( array_key_exists( $countries, $no_states_country ) ? 'give-hidden' : '' ),
328
							'name'          => __( 'Base State/Province', 'give' ),
329
							'desc'          => __( 'The state/province your site operates from.', 'give' ),
330
							'id'            => 'base_state',
331
							'type'          => ( empty( $states ) ? 'text' : 'select' ),
332
							'class'         => ( empty( $states ) ? '' : 'give-select give-select-chosen' ),
333
							'options'       => $states,
334
							'attributes'    => array(
335
								'data-search-type' => 'no_ajax',
336
								'data-placeholder' => $label,
337
							),
338
						),
339
						array(
340
							'name'  => __( 'General Options Docs Link', 'give' ),
341
							'id'    => 'general_options_docs_link',
342
							'url'   => esc_url( 'http://docs.givewp.com/settings-general' ),
343
							'title' => __( 'General Options', 'give' ),
344
							'type'  => 'give_docs_link',
345
						),
346
						array(
347
							'type' => 'sectionend',
348
							'id'   => 'give_title_general_settings_1',
349
						),
350
					);
351
					break;
352
353
				case 'sequential-ordering':
354
					$settings = array(
355
356
						// Section 4: Sequential Ordering
357
358
						array(
359
							'id'   => 'give_title_general_settings_4',
360
							'type' => 'title'
361
						),
362
						array(
363
							'name'    => __( 'Sequential Ordering', 'give' ),
364
							'id'      => "{$current_section}_status",
365
							'desc'    => __( 'Custom donation numbering that increases sequentially to prevent gaps between donation IDs. If disabled, then donation numbers are generated from WordPress post IDs, which will result in gaps between numbers.', 'give' ),
366
							'type'    => 'radio_inline',
367
							'default' => 'disabled',
368
							'options' => array(
369
								'enabled'  => __( 'Enabled', 'give' ),
370
								'disabled' => __( 'Disabled', 'give' )
371
							)
372
						),
373
						array(
374
							'name' => __( 'Next Donation Number', 'give' ),
375
							'id'   => "{$current_section}_number",
376
							'desc' => sprintf(
377
								__( 'The number used to generate the next donation ID. This value must be greater than or equal to %s to avoid conflicts with existing donation IDs.', 'give' ),
378
								'<code>' . Give()->seq_donation_number->get_next_number() . '</code>'
0 ignored issues
show
introduced by
Expected a sanitizing function (see Codex for 'Data Validation'), but instead saw 'Give'
Loading history...
379
							),
380
							'type' => 'number',
381
						),
382
						array(
383
							'name' => __( 'Number Prefix', 'give' ),
384
							'id'   => "{$current_section}_number_prefix",
385
							'desc' => sprintf(
386
								__( 'The prefix appended to all sequential donation numbers. Spaces are replaced by %s.', 'give' ),
387
								'<code>-</code>'
388
							),
389
							'type' => 'text',
390
						),
391
						array(
392
							'name' => __( 'Number Suffix', 'give' ),
393
							'id'   => "{$current_section}_number_suffix",
394
							'desc' => sprintf(
395
								__( 'The suffix appended to all sequential donation numbers. Spaces are replaced by %s.', 'give' ),
396
								'<code>-</code>'
397
							),
398
							'type' => 'text',
399
						),
400
						array(
401
							'name'    => __( 'Number Padding', 'give' ),
402
							'id'      => "{$current_section}_number_padding",
403
							'desc'    => sprintf(
404
								__( 'The minimum number of digits in the sequential donation number. Enter %s to display %s as %s.', 'give' ),
405
								'<code>4</code>',
406
								'<code>1</code>',
407
								'<code>0001</code>'
408
							),
409
							'type'    => 'number',
410
							'default' => '0',
411
						),
412
						array(
413
							'name' => __( 'Donation ID Preview', 'give' ),
414
							'id'   => "{$current_section}_preview",
415
							'type' => 'give_sequential_donation_code_preview',
416
							'desc' => __( 'A preview of the next sequential donation ID. This preview cannot be edited directly as it is generated from the settings above.', 'give' ),
417
						),
418
						array(
419
							'name'  => __( 'Sequential Ordering Docs Link', 'give' ),
420
							'id'    => "{$current_section}_doc link",
421
							'url'   => esc_url( 'http://docs.givewp.com/settings-sequential-ordering' ),
422
							'title' => __( 'Sequential Ordering', 'give' ),
423
							'type'  => 'give_docs_link',
424
						),
425
						array(
426
							'id'   => 'give_title_general_settings_4',
427
							'type' => 'sectionend'
428
						)
429
					);
430
			}
431
432
			/**
433
			 * Filter the general settings.
434
			 * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8
435
			 */
436
			$settings = apply_filters( 'give_settings_general', $settings );
437
438
			/**
439
			 * Filter the settings.
440
			 *
441
			 * @since  1.8
442
			 *
443
			 * @param  array $settings
444
			 */
445
			$settings = apply_filters( 'give_get_settings_' . $this->id, $settings );
446
447
			// Output.
448
			return $settings;
449
		}
450
451
		/**
452
		 * Get sections.
453
		 *
454
		 * @since 1.8
455
		 * @return array
456
		 */
457
		public function get_sections() {
458
			$sections = array(
459
				'general-settings'    => __( 'General', 'give' ),
460
				'currency-settings'   => __( 'Currency', 'give' ),
461
				'access-control'      => __( 'Access Control', 'give' ),
462
				'sequential-ordering' => __( 'Sequential Ordering', 'give' ),
463
			);
464
465
			return apply_filters( 'give_get_sections_' . $this->id, $sections );
466
		}
467
468
469
		/**
470
		 * Set flag to reset sequestion donation number starting point when "Sequential Starting Number" value changes
471
		 *
472
		 * @since  2.1
473
		 * @access public
474
		 *
475
		 * @param $update_options
476
		 * @param $option_name
477
		 * @param $old_options
478
		 *
479
		 * @return bool
480
		 */
481
		public function _give_change_donation_stating_number( $update_options, $option_name, $old_options ) {
482
			if ( ! isset( $_POST['sequential-ordering_number'] ) ) {
0 ignored issues
show
introduced by
Detected access of super global var $_POST, probably need manual inspection.
Loading history...
483
				return false;
484
			}
485
486
			if ( ( $next_number = Give()->seq_donation_number->get_next_number() ) > $update_options['sequential-ordering_number'] ) {
487
				give_update_option( 'sequential-ordering_number', $next_number );
488
489
				Give_Admin_Settings::add_error(
490
					'give-invalid-sequential-starting-number',
491
					sprintf(
492
						__( 'Next Donation Number must be equal to or larger than %s to avoid conflicts with existing donation IDs.', 'give' ),
493
						$next_number
494
					)
495
				);
496
			} elseif ( $update_options['sequential-ordering_number'] !== $old_options['sequential-ordering_number'] ) {
497
				update_option( '_give_reset_sequential_number', 1, false );
498
			}
499
500
			return true;
501
		}
502
503
		/**
504
		 * Render give_sequential_donation_code_preview field type
505
		 *
506
		 * @since  2.1.0
507
		 * @access public
508
		 *
509
		 * @param $field
510
		 */
511 View Code Duplication
		public function _render_give_sequential_donation_code_preview( $field ) {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
512
			?>
513
			<tr valign="top" <?php echo ! empty( $field['wrapper_class'] ) ? 'class="' . $field['wrapper_class'] . '"' : '' ?>>
0 ignored issues
show
introduced by
Expected next thing to be a escaping function, not '!'
Loading history...
introduced by
Expected next thing to be a escaping function, not '$field'
Loading history...
514
				<th scope="row" class="titledesc">
515
					<label
516
						for="<?php echo esc_attr( $field['id'] ); ?>"><?php echo esc_html( $field['name'] ) ?></label>
517
				</th>
518
				<td class="give-forminp">
519
					<input id="<?php echo esc_attr( $field['id'] ); ?>" class="give-input-field" type="text" disabled>
520
					<?php echo Give_Admin_Settings::get_field_description( $field ); ?>
0 ignored issues
show
introduced by
Expected a sanitizing function (see Codex for 'Data Validation'), but instead saw 'Give_Admin_Settings'
Loading history...
521
				</td>
522
			</tr>
523
			<?php
524
		}
525
526
		/**
527
		 * Render give_currency_code_preview field type
528
		 *
529
		 * @since  2.3.0
530
		 * @access public
531
		 *
532
		 * @param array $field Field Attributes array.
533
		 *
534
		 * @return void
535
		 */
536
		public function _render_give_currency_preview( $field, $value ) {
0 ignored issues
show
Unused Code introduced by
The parameter $value is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
537
			$currency          = give_get_currency();
538
			$currency_position = give_get_currency_position();
539
			$currency_symbol   = give_currency_symbol( $currency, false );
540
			$formatted_currency = ( 'before' === $currency_position )
541
				? sprintf( '%1$s%2$s', esc_html( $currency_symbol ), esc_html( $field['default'] ) )
542
				: sprintf( '%1$s%2$s', esc_html( $field['default'] ), esc_html( $currency_symbol ) );
543
			?>
544
			<tr valign="top" <?php echo ! empty( $field['wrapper_class'] ) ? 'class="' . $field['wrapper_class'] . '"' : '' ?>>
0 ignored issues
show
introduced by
Expected next thing to be a escaping function, not '!'
Loading history...
introduced by
Expected next thing to be a escaping function, not '$field'
Loading history...
545
				<th scope="row" class="titledesc">
546
					<label
547
						for="<?php echo esc_attr( $field['id'] ); ?>"><?php echo esc_html( $field['name'] ) ?></label>
548
				</th>
549
				<td class="give-forminp">
550
					<input id="<?php echo esc_attr( $field['id'] ); ?>" class="give-input-field" type="text" disabled value="<?php echo esc_attr( $formatted_currency ); ?>">
551
					<?php echo Give_Admin_Settings::get_field_description( $field ); ?>
0 ignored issues
show
introduced by
Expected a sanitizing function (see Codex for 'Data Validation'), but instead saw 'Give_Admin_Settings'
Loading history...
552
				</td>
553
			</tr>
554
			<?php
555
		}
556
557
		/**
558
		 * Render give_unlock_all_settings field type
559
		 *
560
		 * @since  2.1.0
561
		 * @access public
562
		 *
563
		 * @param $field
564
		 */
565 View Code Duplication
		public function _render_give_unlock_all_settings( $field ) {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
566
			?>
567
			<tr valign="top" <?php echo ! empty( $field['wrapper_class'] ) ? 'class="' . $field['wrapper_class'] . '"' : '' ?>>
0 ignored issues
show
introduced by
Expected next thing to be a escaping function, not '!'
Loading history...
introduced by
Expected next thing to be a escaping function, not '$field'
Loading history...
568
				<th scope="row" class="titledesc">
569
					<label
570
						for="<?php echo esc_attr( $field['id'] ); ?>"><?php echo esc_html( $field['name'] ) ?></label>
571
				</th>
572
				<td class="give-forminp">
573
					<?php echo Give_Admin_Settings::get_field_description( $field ); ?>
0 ignored issues
show
introduced by
Expected a sanitizing function (see Codex for 'Data Validation'), but instead saw 'Give_Admin_Settings'
Loading history...
574
					<a href="" id="<?php echo $field['id']; ?>" data-message="<?php echo $field['confirmation_msg'] ?>"><?php echo __( 'Unlock all settings', 'give' ); ?></a>
0 ignored issues
show
introduced by
Expected next thing to be a escaping function, not '$field'
Loading history...
introduced by
Expected a sanitizing function (see Codex for 'Data Validation'), but instead saw '__'
Loading history...
575
				</td>
576
			</tr>
577
			<?php
578
		}
579
	}
580
581
endif;
582
583
return new Give_Settings_General();
584