setting-page-functions.php ➔ give_get_current_setting_tab()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 19

Duplication

Lines 19
Ratio 100 %

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 0
dl 19
loc 19
rs 9.6333
c 0
b 0
f 0
1
<?php
2
/**
3
 * Get current setting tab.
4
 *
5
 * @since  1.8
6
 * @return string
7
 */
8 View Code Duplication
function give_get_current_setting_tab() {
0 ignored issues
show
Duplication introduced by
This function 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...
9
	// Get current setting page.
10
	$current_setting_page = give_get_current_setting_page();
11
12
	/**
13
	 * Filter the default tab for current setting page.
14
	 *
15
	 * @since 1.8
16
	 *
17
	 * @param string
18
	 */
19
	$default_current_tab = apply_filters( "give_default_setting_tab_{$current_setting_page}", 'general' );
20
21
	// Get current tab.
22
	$current_tab = empty( $_GET['tab'] ) ? $default_current_tab : urldecode( $_GET['tab'] );
23
24
	// Output.
25
	return $current_tab;
26
}
27
28
29
/**
30
 * Get current setting section.
31
 *
32
 * @since  1.8
33
 * @return string
34
 */
35 View Code Duplication
function give_get_current_setting_section() {
0 ignored issues
show
Duplication introduced by
This function 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...
36
	// Get current tab.
37
	$current_tab = give_get_current_setting_tab();
38
39
	/**
40
	 * Filter the default section for current setting page tab.
41
	 *
42
	 * @since 1.8
43
	 *
44
	 * @param string
45
	 */
46
	$default_current_section = apply_filters( "give_default_setting_tab_section_{$current_tab}", '' );
47
48
	// Get current section.
49
	$current_section = empty( $_REQUEST['section'] ) ? $default_current_section : urldecode( $_REQUEST['section'] );
50
51
	// Output.
52
	return $current_section;
53
}
54
55
/**
56
 * Get current setting page.
57
 *
58
 * @since  1.8
59
 * @return string
60
 */
61
function give_get_current_setting_page() {
62
	// Get current page.
63
	$setting_page = ! empty( $_GET['page'] ) ? urldecode( $_GET['page'] ) : '';
64
65
	// Output.
66
	return $setting_page;
67
}
68