Code Duplication    Length = 23-23 lines in 2 locations

includes/actions.php 2 locations

@@ 28-50 (lines=23) @@
25
 *
26
 * @return void
27
 */
28
function give_get_actions() {
29
30
	$get_data = give_clean( $_GET ); // WPCS: input var ok, sanitization ok, CSRF ok.
31
32
	$_get_action = ! empty( $get_data['give_action'] ) ? $get_data['give_action'] : null;
33
34
	// Add backward compatibility to give-action param ( $_GET ).
35
	if ( empty( $_get_action ) ) {
36
		$_get_action = ! empty( $get_data['give-action'] ) ? $get_data['give-action'] : null;
37
	}
38
39
	if ( isset( $_get_action ) ) {
40
		/**
41
		 * Fires in WordPress init or admin init, when give_action is present in $_GET.
42
		 *
43
		 * @since 1.0
44
		 *
45
		 * @param array $_GET Array of HTTP GET variables.
46
		 */
47
		do_action( "give_{$_get_action}", $get_data );
48
	}
49
50
}
51
52
add_action( 'init', 'give_get_actions' );
53
@@ 63-85 (lines=23) @@
60
 *
61
 * @return void
62
 */
63
function give_post_actions() {
64
65
	$post_data = give_clean( $_POST ); // WPCS: input var ok, sanitization ok, CSRF ok.
66
67
	$_post_action = ! empty( $post_data['give_action'] ) ? $post_data['give_action'] : null;
68
69
	// Add backward compatibility to give-action param ( $_POST ).
70
	if ( empty( $_post_action ) ) {
71
		$_post_action = ! empty( $post_data['give-action'] ) ? $post_data['give-action'] : null;
72
	}
73
74
	if ( isset( $_post_action ) ) {
75
		/**
76
		 * Fires in WordPress init or admin init, when give_action is present in $_POST.
77
		 *
78
		 * @since 1.0
79
		 *
80
		 * @param array $_POST Array of HTTP POST variables.
81
		 */
82
		do_action( "give_{$_post_action}", $post_data );
83
	}
84
85
}
86
87
add_action( 'init', 'give_post_actions' );
88