Test Failed
Push — issues/370 ( 90279e )
by Ravinder
05:35
created

admin-pages.php ➔ give_add_options_links()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 73
Code Lines 51

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 51
nc 1
nop 0
dl 0
loc 73
rs 9.0675
c 0
b 0
f 0

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
/**
3
 * Admin Pages
4
 *
5
 * @package     Give
6
 * @subpackage  Admin/Pages
7
 * @copyright   Copyright (c) 2016, WordImpress
8
 * @license     https://opensource.org/licenses/gpl-license GNU Public License
9
 * @since       1.0
10
 */
11
12
// Exit if accessed directly.
13
if ( ! defined( 'ABSPATH' ) ) {
14
	exit;
15
}
16
17
/**
18
 * Creates the admin submenu pages under the Give menu and assigns their
19
 * links to global variables
20
 *
21
 * @since 1.0
22
 *
23
 * @global $give_settings_page
24
 * @global $give_payments_page
25
 * @global $give_reports_page
26
 * @global $give_add_ons_page
27
 * @global $give_donors_page
28
 *
29
 * @return void
30
 */
31
function give_add_options_links() {
32
	global $give_settings_page, $give_payments_page, $give_reports_page, $give_add_ons_page, $give_donors_page, $give_tools_page;
33
34
	//Payments
35
	$give_payment       = get_post_type_object( 'give_payment' );
36
	$give_payments_page = add_submenu_page(
37
		'edit.php?post_type=give_forms',
38
		$give_payment->labels->name,
39
		$give_payment->labels->menu_name,
40
		'edit_give_payments',
41
		'give-payment-history',
42
		'give_payment_history_page'
43
	);
44
45
	//Donors
46
	$give_donors_page = add_submenu_page(
47
		'edit.php?post_type=give_forms',
48
		esc_html__( 'Donors', 'give' ),
49
		esc_html__( 'Donors', 'give' ),
50
		'view_give_reports',
51
		'give-donors',
52
		'give_donors_page'
53
	);
54
55
	//Reports`
56
	$give_reports_page = add_submenu_page(
57
		'edit.php?post_type=give_forms',
58
		esc_html__( 'Donation Reports', 'give' ),
59
		esc_html__( 'Reports', 'give' ),
60
		'view_give_reports',
61
		'give-reports',
62
		array(
63
			Give()->give_settings,
64
			'output',
65
		)
66
	);
67
68
	//Settings
69
	$give_settings_page = add_submenu_page(
70
		'edit.php?post_type=give_forms',
71
		esc_html__( 'Give Settings', 'give' ),
72
		esc_html__( 'Settings', 'give' ),
73
		'manage_give_settings',
74
		'give-settings',
75
		array(
76
			Give()->give_settings,
77
			'output',
78
		)
79
	);
80
81
	//Tools.
82
	$give_tools_page = add_submenu_page(
83
		'edit.php?post_type=give_forms',
84
		esc_html__( 'Give Tools', 'give' ),
85
		esc_html__( 'Tools', 'give' ),
86
		'manage_give_settings',
87
		'give-tools',
88
		array(
89
			Give()->give_settings,
90
			'output',
91
		)
92
	);
93
94
	//Add-ons
95
	$give_add_ons_page = add_submenu_page(
96
		'edit.php?post_type=give_forms',
97
		esc_html__( 'Give Add-ons', 'give' ),
98
		esc_html__( 'Add-ons', 'give' ),
99
		'install_plugins',
100
		'give-addons',
101
		'give_add_ons_page'
102
	);
103
}
104
105
add_action( 'admin_menu', 'give_add_options_links', 10 );
106
107
/**
108
 *  Determines whether the current admin page is a Give admin page.
109
 *
110
 *  Only works after the `wp_loaded` hook, & most effective
111
 *  starting on `admin_menu` hook.
112
 *
113
 * @since 1.0
114
 *
115
 * @param string $passed_page Optional. Main page's slug
116
 * @param string $passed_view Optional. Page view ( ex: `edit` or `delete` )
117
 *
118
 * @return bool True if Give admin page.
119
 */
120
function give_is_admin_page( $passed_page = '', $passed_view = '' ) {
121
122
	global $pagenow, $typenow;
123
124
	$found     = false;
125
	$post_type = isset( $_GET['post_type'] ) ? strtolower( $_GET['post_type'] ) : false;
0 ignored issues
show
introduced by
Detected access of super global var $_GET, probably need manual inspection.
Loading history...
introduced by
Detected usage of a non-sanitized input variable: $_GET
Loading history...
126
	$action    = isset( $_GET['action'] ) ? strtolower( $_GET['action'] ) : false;
0 ignored issues
show
introduced by
Detected access of super global var $_GET, probably need manual inspection.
Loading history...
introduced by
Detected usage of a non-sanitized input variable: $_GET
Loading history...
127
	$taxonomy  = isset( $_GET['taxonomy'] ) ? strtolower( $_GET['taxonomy'] ) : false;
0 ignored issues
show
introduced by
Detected access of super global var $_GET, probably need manual inspection.
Loading history...
introduced by
Detected usage of a non-sanitized input variable: $_GET
Loading history...
128
	$page      = isset( $_GET['page'] ) ? strtolower( $_GET['page'] ) : false;
0 ignored issues
show
introduced by
Detected access of super global var $_GET, probably need manual inspection.
Loading history...
introduced by
Detected usage of a non-sanitized input variable: $_GET
Loading history...
129
	$view      = isset( $_GET['view'] ) ? strtolower( $_GET['view'] ) : false;
0 ignored issues
show
introduced by
Detected access of super global var $_GET, probably need manual inspection.
Loading history...
introduced by
Detected usage of a non-sanitized input variable: $_GET
Loading history...
130
	$tab       = isset( $_GET['tab'] ) ? strtolower( $_GET['tab'] ) : false;
0 ignored issues
show
introduced by
Detected access of super global var $_GET, probably need manual inspection.
Loading history...
introduced by
Detected usage of a non-sanitized input variable: $_GET
Loading history...
131
132
	switch ( $passed_page ) {
133
		case 'give_forms':
134
			switch ( $passed_view ) {
135
				case 'list-table':
136
					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' ) {
0 ignored issues
show
introduced by
Found "== '". Use Yoda Condition checks, you must
Loading history...
137
						$found = true;
138
					}
139
					break;
140 View Code Duplication
				case 'edit':
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across 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...
141
					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'post.php' ) {
0 ignored issues
show
introduced by
Found "== '". Use Yoda Condition checks, you must
Loading history...
142
						$found = true;
143
					}
144
					break;
145 View Code Duplication
				case 'new':
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across 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...
146
					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'post-new.php' ) {
0 ignored issues
show
introduced by
Found "== '". Use Yoda Condition checks, you must
Loading history...
147
						$found = true;
148
					}
149
					break;
150
				default:
151
					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) || 'give_forms' === $post_type || ( 'post-new.php' == $pagenow && 'give_forms' === $post_type ) ) {
152
						$found = true;
153
					}
154
					break;
155
			}
156
			break;
157 View Code Duplication
		case 'categories':
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across 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...
158
			switch ( $passed_view ) {
159
				case 'list-table':
160
				case 'new':
161
					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_category' === $taxonomy ) {
0 ignored issues
show
introduced by
Found "== '". Use Yoda Condition checks, you must
Loading history...
162
						$found = true;
163
					}
164
					break;
165
				case 'edit':
166
					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_category' === $taxonomy ) {
0 ignored issues
show
introduced by
Found "== '". Use Yoda Condition checks, you must
Loading history...
167
						$found = true;
168
					}
169
					break;
170
				default:
171
					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'give_forms_category' === $taxonomy ) {
0 ignored issues
show
introduced by
Found "== '". Use Yoda Condition checks, you must
Loading history...
172
						$found = true;
173
					}
174
					break;
175
			}
176
			break;
177 View Code Duplication
		case 'tags':
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across 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...
178
			switch ( $passed_view ) {
179
				case 'list-table':
180
				case 'new':
181
					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_tag' === $taxonomy ) {
0 ignored issues
show
introduced by
Found "== '". Use Yoda Condition checks, you must
Loading history...
182
						$found = true;
183
					}
184
					break;
185
				case 'edit':
186
					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_tag' === $taxonomy ) {
0 ignored issues
show
introduced by
Found "== '". Use Yoda Condition checks, you must
Loading history...
187
						$found = true;
188
					}
189
					break;
190
				default:
191
					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'give_forms_tag' === $taxonomy ) {
0 ignored issues
show
introduced by
Found "== '". Use Yoda Condition checks, you must
Loading history...
192
						$found = true;
193
					}
194
					break;
195
			}
196
			break;
197
		case 'payments':
198
			switch ( $passed_view ) {
199
				case 'list-table':
200
					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page && false === $view ) {
0 ignored issues
show
introduced by
Found "== '". Use Yoda Condition checks, you must
Loading history...
201
						$found = true;
202
					}
203
					break;
204
				case 'edit':
205
					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page && 'view-payment-details' === $view ) {
0 ignored issues
show
introduced by
Found "== '". Use Yoda Condition checks, you must
Loading history...
206
						$found = true;
207
					}
208
					break;
209
				default:
210
					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page ) {
0 ignored issues
show
introduced by
Found "== '". Use Yoda Condition checks, you must
Loading history...
211
						$found = true;
212
					}
213
					break;
214
			}
215
			break;
216
		case 'reports':
217
			switch ( $passed_view ) {
218
				// If you want to do something like enqueue a script on a particular report's duration, look at $_GET[ 'range' ]
219
				case 'earnings':
220
					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && ( 'earnings' === $view || '-1' === $view || false === $view ) ) {
0 ignored issues
show
introduced by
Found "== '". Use Yoda Condition checks, you must
Loading history...
221
						$found = true;
222
					}
223
					break;
224
				case 'donors':
225
					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'customers' === $view ) {
0 ignored issues
show
introduced by
Found "== '". Use Yoda Condition checks, you must
Loading history...
226
						$found = true;
227
					}
228
					break;
229
				case 'gateways':
230
					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'gateways' === $view ) {
0 ignored issues
show
introduced by
Found "== '". Use Yoda Condition checks, you must
Loading history...
231
						$found = true;
232
					}
233
					break;
234
				case 'export':
235
					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'export' === $view ) {
0 ignored issues
show
introduced by
Found "== '". Use Yoda Condition checks, you must
Loading history...
236
						$found = true;
237
					}
238
					break;
239
				case 'logs':
240
					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'logs' === $view ) {
0 ignored issues
show
introduced by
Found "== '". Use Yoda Condition checks, you must
Loading history...
241
						$found = true;
242
					}
243
					break;
244
				default:
245
					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page ) {
0 ignored issues
show
introduced by
Found "== '". Use Yoda Condition checks, you must
Loading history...
246
						$found = true;
247
					}
248
					break;
249
			}
250
			break;
251
		case 'settings':
252
			switch ( $passed_view ) {
253
				case 'general':
254
					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && ( 'general' === $tab || false === $tab ) ) {
0 ignored issues
show
introduced by
Found "== '". Use Yoda Condition checks, you must
Loading history...
255
						$found = true;
256
					}
257
					break;
258
				case 'gateways':
259
					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'gateways' === $tab ) {
0 ignored issues
show
introduced by
Found "== '". Use Yoda Condition checks, you must
Loading history...
260
						$found = true;
261
					}
262
					break;
263
				case 'emails':
264
					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'emails' === $tab ) {
0 ignored issues
show
introduced by
Found "== '". Use Yoda Condition checks, you must
Loading history...
265
						$found = true;
266
					}
267
					break;
268
				case 'display':
269
					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'display' === $tab ) {
0 ignored issues
show
introduced by
Found "== '". Use Yoda Condition checks, you must
Loading history...
270
						$found = true;
271
					}
272
					break;
273
				case 'licenses':
274
					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'licenses' === $tab ) {
0 ignored issues
show
introduced by
Found "== '". Use Yoda Condition checks, you must
Loading history...
275
						$found = true;
276
					}
277
					break;
278
				case 'api':
279
					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'api' === $tab ) {
0 ignored issues
show
introduced by
Found "== '". Use Yoda Condition checks, you must
Loading history...
280
						$found = true;
281
					}
282
					break;
283
				case 'advanced':
284
					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'advanced' === $tab ) {
0 ignored issues
show
introduced by
Found "== '". Use Yoda Condition checks, you must
Loading history...
285
						$found = true;
286
					}
287
					break;
288
				case 'system_info':
289
					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'system_info' === $tab ) {
0 ignored issues
show
introduced by
Found "== '". Use Yoda Condition checks, you must
Loading history...
290
						$found = true;
291
					}
292
					break;
293
				default:
294
					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page ) {
0 ignored issues
show
introduced by
Found "== '". Use Yoda Condition checks, you must
Loading history...
295
						$found = true;
296
					}
297
					break;
298
			}
299
			break;
300
		case 'addons':
301
			if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-addons' === $page ) {
0 ignored issues
show
introduced by
Found "== '". Use Yoda Condition checks, you must
Loading history...
302
				$found = true;
303
			}
304
			break;
305
		case 'donors':
306
			switch ( $passed_view ) {
307
				case 'list-table':
308
					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && false === $view ) {
0 ignored issues
show
introduced by
Found "== '". Use Yoda Condition checks, you must
Loading history...
309
						$found = true;
310
					}
311
					break;
312
				case 'overview':
313
					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && 'overview' === $view ) {
0 ignored issues
show
introduced by
Found "== '". Use Yoda Condition checks, you must
Loading history...
314
						$found = true;
315
					}
316
					break;
317
				case 'notes':
318
					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && 'notes' === $view ) {
0 ignored issues
show
introduced by
Found "== '". Use Yoda Condition checks, you must
Loading history...
319
						$found = true;
320
					}
321
					break;
322
				default:
323
					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page ) {
0 ignored issues
show
introduced by
Found "== '". Use Yoda Condition checks, you must
Loading history...
324
						$found = true;
325
					}
326
					break;
327
			}
328
			break;
329
		case 'reports':
330
			if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page ) {
0 ignored issues
show
introduced by
Found "== '". Use Yoda Condition checks, you must
Loading history...
331
				$found = true;
332
			}
333
			break;
334
		default:
335
			global $give_payments_page, $give_settings_page, $give_reports_page, $give_system_info_page, $give_add_ons_page, $give_settings_export, $give_donors_page, $give_tools_page;
336
337
			$admin_pages = apply_filters( 'give_admin_pages', array(
338
				$give_payments_page,
339
				$give_settings_page,
340
				$give_reports_page,
341
				$give_system_info_page,
342
				$give_add_ons_page,
343
				$give_settings_export,
344
				$give_donors_page,
345
				$give_tools_page,
346
				'widgets.php'
0 ignored issues
show
introduced by
Comma required after last value in array declaration
Loading history...
347
		) );
0 ignored issues
show
Coding Style introduced by
This line of the multi-line function call does not seem to be indented correctly. Expected 12 spaces, but found 8.
Loading history...
348
			if ( 'give_forms' == $typenow || 'index.php' == $pagenow || 'post-new.php' == $pagenow || 'post.php' == $pagenow ) {
349
				$found = true;
350
			} elseif ( in_array( $pagenow, $admin_pages ) ) {
351
				$found = true;
352
			}
353
			break;
354
	}
355
356
	return (bool) apply_filters( 'give_is_admin_page', $found, $page, $view, $passed_page, $passed_view );
357
358
}
359
360
361
/**
362
 * Add setting tab to give-settings page
363
 *
364
 * @since  1.8
365
 * @param  array $settings
366
 * @return array
367
 */
368
function give_settings_page_pages( $settings ) {
369
	include( 'abstract-admin-settings-page.php' );
370
	include( 'settings/class-settings-cmb2-backward-compatibility.php' );
371
372
	$settings = array(
373
		// General settings.
374
		include( GIVE_PLUGIN_DIR . 'includes/admin/settings/class-settings-general.php' ),
375
376
		// Payment Gateways Settings.
377
		include( GIVE_PLUGIN_DIR . 'includes/admin/settings/class-settings-gateways.php' ),
378
379
		// Display settings.
380
		include( GIVE_PLUGIN_DIR . 'includes/admin/settings/class-settings-display.php' ),
381
382
		// Emails settings.
383
		include( GIVE_PLUGIN_DIR . 'includes/admin/settings/class-settings-email.php' ),
384
385
		// Addons settings.
386
		include( GIVE_PLUGIN_DIR . 'includes/admin/settings/class-settings-addon.php' ),
387
388
		// License settings.
389
		include( GIVE_PLUGIN_DIR . 'includes/admin/settings/class-settings-license.php' ),
390
391
		// Advanced settings.
392
		include( GIVE_PLUGIN_DIR . 'includes/admin/settings/class-settings-advanced.php' )
0 ignored issues
show
introduced by
Comma required after last value in array declaration
Loading history...
393
	);
394
395
	// Output.
396
	return $settings;
397
}
398
add_filter( 'give-settings_get_settings_pages', 'give_settings_page_pages', 0, 1 );
399
400
401
/**
402
 * Add setting tab to give-settings page
403
 *
404
 * @since  1.8
405
 * @param  array $settings
406
 * @return array
407
 */
408
function give_reports_page_pages( $settings ) {
409
	include( 'abstract-admin-settings-page.php' );
410
411
	$settings = array(
412
		// Earnings.
413
		include( 'reports/class-earnings-report.php' ),
414
415
		// Forms.
416
		include( 'reports/class-forms-report.php' ),
417
418
		// Gateways.
419
		include( 'reports/class-gateways-report.php' ),
420
421
	);
422
423
	// Output.
424
	return $settings;
425
}
426
add_filter( 'give-reports_get_settings_pages', 'give_reports_page_pages', 0, 1 );
427
428
/**
429
 * Add setting tab to give-settings page
430
 *
431
 * @since  1.8
432
 * @param  array $settings
433
 * @return array
434
 */
435
function give_tools_page_pages( $settings ) {
436
	include( 'abstract-admin-settings-page.php' );
437
438
	$settings = array(
439
		// System Info.
440
		include( GIVE_PLUGIN_DIR . 'includes/admin/tools/class-settings-system-info.php' ),
441
442
		// Logs.
443
		include( GIVE_PLUGIN_DIR . 'includes/admin/tools/class-settings-logs.php' ),
444
445
		// API.
446
		include( GIVE_PLUGIN_DIR . 'includes/admin/tools/class-settings-api.php' ),
447
448
		// Data.
449
		include( GIVE_PLUGIN_DIR . 'includes/admin/tools/class-settings-data.php' ),
450
451
		// Export.
452
		include( GIVE_PLUGIN_DIR . 'includes/admin/tools/class-settings-export.php' ),
453
454
		// Import
455
		include_once( GIVE_PLUGIN_DIR . 'includes/admin/tools/class-settings-import.php' ),
456
	);
457
458
	// Output.
459
	return $settings;
460
}
461
add_filter( 'give-tools_get_settings_pages', 'give_tools_page_pages', 0, 1 );
462
463
/**
464
 * Set default tools page tab.
465
 *
466
 * @since  1.8
467
 * @param  string $default_tab Default tab name.
468
 * @return string
469
 */
470
function give_set_default_tab_form_tools_page( $default_tab ) {
0 ignored issues
show
Unused Code introduced by
The parameter $default_tab 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...
471
	return 'system-info';
472
}
473
add_filter( 'give_default_setting_tab_give-tools', 'give_set_default_tab_form_tools_page', 10, 1 );
474
475
476
/**
477
 * Set default reports page tab.
478
 *
479
 * @since  1.8
480
 * @param  string $default_tab Default tab name.
481
 * @return string
482
 */
483
function give_set_default_tab_form_reports_page( $default_tab ) {
0 ignored issues
show
Unused Code introduced by
The parameter $default_tab 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...
484
	return 'earnings';
485
}
486
add_filter( 'give_default_setting_tab_give-reports', 'give_set_default_tab_form_reports_page', 10, 1 );