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