@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * @return void |
24 | 24 | */ |
25 | 25 | function give_logs_view_sales() { |
26 | - include( dirname( __FILE__ ) . '/class-sales-logs-list-table.php' ); |
|
26 | + include(dirname(__FILE__).'/class-sales-logs-list-table.php'); |
|
27 | 27 | |
28 | 28 | $logs_table = new Give_Sales_Log_Table(); |
29 | 29 | $logs_table->prepare_items(); |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | |
32 | 32 | } |
33 | 33 | |
34 | -add_action( 'give_logs_view_sales', 'give_logs_view_sales' ); |
|
34 | +add_action('give_logs_view_sales', 'give_logs_view_sales'); |
|
35 | 35 | |
36 | 36 | |
37 | 37 | /** |
@@ -43,14 +43,14 @@ discard block |
||
43 | 43 | * @return void |
44 | 44 | */ |
45 | 45 | function give_logs_view_gateway_errors() { |
46 | - include( dirname( __FILE__ ) . '/class-gateway-error-logs-list-table.php' ); |
|
46 | + include(dirname(__FILE__).'/class-gateway-error-logs-list-table.php'); |
|
47 | 47 | |
48 | 48 | $logs_table = new Give_Gateway_Error_Log_Table(); |
49 | 49 | $logs_table->prepare_items(); |
50 | 50 | $logs_table->display(); |
51 | 51 | } |
52 | 52 | |
53 | -add_action( 'give_logs_view_gateway_errors', 'give_logs_view_gateway_errors' ); |
|
53 | +add_action('give_logs_view_gateway_errors', 'give_logs_view_gateway_errors'); |
|
54 | 54 | |
55 | 55 | /** |
56 | 56 | * API Request Logs |
@@ -62,28 +62,28 @@ discard block |
||
62 | 62 | * @return void |
63 | 63 | */ |
64 | 64 | function give_logs_view_api_requests() { |
65 | - include( dirname( __FILE__ ) . '/class-api-requests-logs-list-table.php' ); |
|
65 | + include(dirname(__FILE__).'/class-api-requests-logs-list-table.php'); |
|
66 | 66 | |
67 | 67 | $logs_table = new Give_API_Request_Log_Table(); |
68 | 68 | $logs_table->prepare_items(); |
69 | 69 | ?> |
70 | 70 | <div class="wrap"> |
71 | - <?php do_action( 'give_logs_api_requests_top' ); ?> |
|
72 | - <form id="give-logs-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-reports&tab=logs' ); ?>"> |
|
71 | + <?php do_action('give_logs_api_requests_top'); ?> |
|
72 | + <form id="give-logs-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-reports&tab=logs'); ?>"> |
|
73 | 73 | <?php |
74 | - $logs_table->search_box( esc_html__( 'Search', 'give' ), 'give-api-requests' ); |
|
74 | + $logs_table->search_box(esc_html__('Search', 'give'), 'give-api-requests'); |
|
75 | 75 | $logs_table->display(); |
76 | 76 | ?> |
77 | 77 | <input type="hidden" name="post_type" value="give_forms"/> |
78 | 78 | <input type="hidden" name="page" value="give-reports"/> |
79 | 79 | <input type="hidden" name="tab" value="logs"/> |
80 | 80 | </form> |
81 | - <?php do_action( 'give_logs_api_requests_bottom' ); ?> |
|
81 | + <?php do_action('give_logs_api_requests_bottom'); ?> |
|
82 | 82 | </div> |
83 | 83 | <?php |
84 | 84 | } |
85 | 85 | |
86 | -add_action( 'give_logs_view_api_requests', 'give_logs_view_api_requests' ); |
|
86 | +add_action('give_logs_view_api_requests', 'give_logs_view_api_requests'); |
|
87 | 87 | |
88 | 88 | |
89 | 89 | /** |
@@ -94,12 +94,12 @@ discard block |
||
94 | 94 | */ |
95 | 95 | function give_log_default_views() { |
96 | 96 | $views = array( |
97 | - 'sales' => esc_html__( 'Donations', 'give' ), |
|
98 | - 'gateway_errors' => esc_html__( 'Payment Errors', 'give' ), |
|
99 | - 'api_requests' => esc_html__( 'API Requests', 'give' ) |
|
97 | + 'sales' => esc_html__('Donations', 'give'), |
|
98 | + 'gateway_errors' => esc_html__('Payment Errors', 'give'), |
|
99 | + 'api_requests' => esc_html__('API Requests', 'give') |
|
100 | 100 | ); |
101 | 101 | |
102 | - $views = apply_filters( 'give_log_views', $views ); |
|
102 | + $views = apply_filters('give_log_views', $views); |
|
103 | 103 | |
104 | 104 | return $views; |
105 | 105 | } |
@@ -112,24 +112,24 @@ discard block |
||
112 | 112 | */ |
113 | 113 | function give_log_views() { |
114 | 114 | $views = give_log_default_views(); |
115 | - $current_view = isset( $_GET['view'] ) && array_key_exists( $_GET['view'], give_log_default_views() ) ? sanitize_text_field( $_GET['view'] ) : 'sales'; |
|
115 | + $current_view = isset($_GET['view']) && array_key_exists($_GET['view'], give_log_default_views()) ? sanitize_text_field($_GET['view']) : 'sales'; |
|
116 | 116 | ?> |
117 | 117 | <form id="give-logs-filter" method="get" action="edit.php"> |
118 | 118 | <select id="give-logs-view" name="view"> |
119 | 119 | <optgroup label="Log Type:"> |
120 | - <?php foreach ( $views as $view_id => $label ): ?> |
|
121 | - <option value="<?php esc_attr_e( $view_id ); ?>" <?php selected( $view_id, $current_view ); ?>><?php echo $label; ?></option> |
|
120 | + <?php foreach ($views as $view_id => $label): ?> |
|
121 | + <option value="<?php esc_attr_e($view_id); ?>" <?php selected($view_id, $current_view); ?>><?php echo $label; ?></option> |
|
122 | 122 | <?php endforeach; ?> |
123 | 123 | </optgroup> |
124 | 124 | </select> |
125 | 125 | |
126 | - <?php do_action( 'give_log_view_actions' ); ?> |
|
126 | + <?php do_action('give_log_view_actions'); ?> |
|
127 | 127 | |
128 | 128 | <input type="hidden" name="post_type" value="give_forms"/> |
129 | 129 | <input type="hidden" name="page" value="give-reports"/> |
130 | 130 | <input type="hidden" name="tab" value="logs"/> |
131 | 131 | |
132 | - <?php submit_button( esc_html__( 'Apply', 'give' ), 'secondary', 'submit', false ); ?> |
|
132 | + <?php submit_button(esc_html__('Apply', 'give'), 'secondary', 'submit', false); ?> |
|
133 | 133 | </form> |
134 | 134 | <?php |
135 | 135 | } |
136 | 136 | \ No newline at end of file |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | */ |
17 | 17 | |
18 | 18 | // Exit if accessed directly |
19 | -if ( ! defined( 'ABSPATH' ) ) { |
|
19 | +if ( ! defined('ABSPATH')) { |
|
20 | 20 | exit; |
21 | 21 | } |
22 | 22 | |
@@ -29,36 +29,36 @@ discard block |
||
29 | 29 | * @return void |
30 | 30 | */ |
31 | 31 | function give_reports_page() { |
32 | - $current_page = admin_url( 'edit.php?post_type=give_forms&page=give-reports' ); |
|
33 | - $active_tab = isset( $_GET['tab'] ) ? $_GET['tab'] : 'reports'; |
|
32 | + $current_page = admin_url('edit.php?post_type=give_forms&page=give-reports'); |
|
33 | + $active_tab = isset($_GET['tab']) ? $_GET['tab'] : 'reports'; |
|
34 | 34 | ?> |
35 | 35 | <div class="wrap"> |
36 | 36 | <h1 class="nav-tab-wrapper"> |
37 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
37 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
38 | 38 | 'tab' => 'reports', |
39 | 39 | 'settings-updated' => false |
40 | - ), $current_page ) ); ?>" class="nav-tab <?php echo $active_tab == 'reports' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e( 'Reports', 'give' ); ?></a> |
|
41 | - <?php if ( current_user_can( 'export_give_reports' ) ) { ?> |
|
42 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
40 | + ), $current_page)); ?>" class="nav-tab <?php echo $active_tab == 'reports' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e('Reports', 'give'); ?></a> |
|
41 | + <?php if (current_user_can('export_give_reports')) { ?> |
|
42 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
43 | 43 | 'tab' => 'export', |
44 | 44 | 'settings-updated' => false |
45 | - ), $current_page ) ); ?>" class="nav-tab <?php echo $active_tab == 'export' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e( 'Export', 'give' ); ?></a> |
|
45 | + ), $current_page)); ?>" class="nav-tab <?php echo $active_tab == 'export' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e('Export', 'give'); ?></a> |
|
46 | 46 | <?php } ?> |
47 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
47 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
48 | 48 | 'tab' => 'logs', |
49 | 49 | 'settings-updated' => false |
50 | - ), $current_page ) ); ?>" class="nav-tab <?php echo $active_tab == 'logs' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e( 'Logs', 'give' ); ?></a> |
|
51 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
50 | + ), $current_page)); ?>" class="nav-tab <?php echo $active_tab == 'logs' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e('Logs', 'give'); ?></a> |
|
51 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
52 | 52 | 'tab' => 'tools', |
53 | 53 | 'settings-updated' => false |
54 | - ), $current_page ) ); ?>" class="nav-tab <?php echo $active_tab == 'tools' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e( 'Tools', 'give' ); ?></a> |
|
55 | - <?php do_action( 'give_reports_tabs' ); ?> |
|
54 | + ), $current_page)); ?>" class="nav-tab <?php echo $active_tab == 'tools' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e('Tools', 'give'); ?></a> |
|
55 | + <?php do_action('give_reports_tabs'); ?> |
|
56 | 56 | </h1> |
57 | 57 | |
58 | 58 | <?php |
59 | - do_action( 'give_reports_page_top' ); |
|
60 | - do_action( 'give_reports_tab_' . $active_tab ); |
|
61 | - do_action( 'give_reports_page_bottom' ); |
|
59 | + do_action('give_reports_page_top'); |
|
60 | + do_action('give_reports_tab_'.$active_tab); |
|
61 | + do_action('give_reports_page_bottom'); |
|
62 | 62 | ?> |
63 | 63 | </div><!-- .wrap --> |
64 | 64 | <?php |
@@ -72,13 +72,13 @@ discard block |
||
72 | 72 | */ |
73 | 73 | function give_reports_default_views() { |
74 | 74 | $views = array( |
75 | - 'earnings' => esc_html__( 'Income', 'give' ), |
|
75 | + 'earnings' => esc_html__('Income', 'give'), |
|
76 | 76 | 'forms' => give_get_forms_label_plural(), |
77 | - 'donors' => esc_html__( 'Donors', 'give' ), |
|
78 | - 'gateways' => esc_html__( 'Payment Methods', 'give' ) |
|
77 | + 'donors' => esc_html__('Donors', 'give'), |
|
78 | + 'gateways' => esc_html__('Payment Methods', 'give') |
|
79 | 79 | ); |
80 | 80 | |
81 | - $views = apply_filters( 'give_report_views', $views ); |
|
81 | + $views = apply_filters('give_report_views', $views); |
|
82 | 82 | |
83 | 83 | return $views; |
84 | 84 | } |
@@ -94,15 +94,15 @@ discard block |
||
94 | 94 | * @return string $view Report View |
95 | 95 | * |
96 | 96 | */ |
97 | -function give_get_reporting_view( $default = 'earnings' ) { |
|
97 | +function give_get_reporting_view($default = 'earnings') { |
|
98 | 98 | |
99 | - if ( ! isset( $_GET['view'] ) || ! in_array( $_GET['view'], array_keys( give_reports_default_views() ) ) ) { |
|
99 | + if ( ! isset($_GET['view']) || ! in_array($_GET['view'], array_keys(give_reports_default_views()))) { |
|
100 | 100 | $view = $default; |
101 | 101 | } else { |
102 | 102 | $view = $_GET['view']; |
103 | 103 | } |
104 | 104 | |
105 | - return apply_filters( 'give_get_reporting_view', $view ); |
|
105 | + return apply_filters('give_get_reporting_view', $view); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | /** |
@@ -115,14 +115,14 @@ discard block |
||
115 | 115 | $current_view = 'earnings'; |
116 | 116 | $views = give_reports_default_views(); |
117 | 117 | |
118 | - if ( isset( $_GET['view'] ) && array_key_exists( $_GET['view'], $views ) ) { |
|
118 | + if (isset($_GET['view']) && array_key_exists($_GET['view'], $views)) { |
|
119 | 119 | $current_view = $_GET['view']; |
120 | 120 | } |
121 | 121 | |
122 | - do_action( 'give_reports_view_' . $current_view ); |
|
122 | + do_action('give_reports_view_'.$current_view); |
|
123 | 123 | } |
124 | 124 | |
125 | -add_action( 'give_reports_tab_reports', 'give_reports_tab_reports' ); |
|
125 | +add_action('give_reports_tab_reports', 'give_reports_tab_reports'); |
|
126 | 126 | |
127 | 127 | /** |
128 | 128 | * Renders the Reports Page Views Drop Downs |
@@ -132,25 +132,25 @@ discard block |
||
132 | 132 | */ |
133 | 133 | function give_report_views() { |
134 | 134 | $views = give_reports_default_views(); |
135 | - $current_view = isset( $_GET['view'] ) ? $_GET['view'] : 'earnings'; |
|
136 | - do_action( 'give_report_view_actions_before' ); |
|
135 | + $current_view = isset($_GET['view']) ? $_GET['view'] : 'earnings'; |
|
136 | + do_action('give_report_view_actions_before'); |
|
137 | 137 | ?> |
138 | 138 | <form id="give-reports-filter" method="get"> |
139 | 139 | <select id="give-reports-view" name="view"> |
140 | - <option value="-1"><?php esc_html_e( 'Report Type', 'give' ); ?></option> |
|
141 | - <?php foreach ( $views as $view_id => $label ) : ?> |
|
142 | - <option value="<?php esc_attr_e( $view_id ); ?>" <?php selected( $view_id, $current_view ); ?>><?php echo $label; ?></option> |
|
140 | + <option value="-1"><?php esc_html_e('Report Type', 'give'); ?></option> |
|
141 | + <?php foreach ($views as $view_id => $label) : ?> |
|
142 | + <option value="<?php esc_attr_e($view_id); ?>" <?php selected($view_id, $current_view); ?>><?php echo $label; ?></option> |
|
143 | 143 | <?php endforeach; ?> |
144 | 144 | </select> |
145 | 145 | |
146 | - <?php do_action( 'give_report_view_actions' ); ?> |
|
146 | + <?php do_action('give_report_view_actions'); ?> |
|
147 | 147 | |
148 | 148 | <input type="hidden" name="post_type" value="give_forms"/> |
149 | 149 | <input type="hidden" name="page" value="give-reports"/> |
150 | - <?php submit_button( esc_html__( 'Show', 'give' ), 'secondary', 'submit', false ); ?> |
|
150 | + <?php submit_button(esc_html__('Show', 'give'), 'secondary', 'submit', false); ?> |
|
151 | 151 | </form> |
152 | 152 | <?php |
153 | - do_action( 'give_report_view_actions_after' ); |
|
153 | + do_action('give_report_view_actions_after'); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | /** |
@@ -163,18 +163,18 @@ discard block |
||
163 | 163 | */ |
164 | 164 | function give_reports_forms_table() { |
165 | 165 | |
166 | - if ( isset( $_GET['form-id'] ) ) { |
|
166 | + if (isset($_GET['form-id'])) { |
|
167 | 167 | return; |
168 | 168 | } |
169 | 169 | |
170 | - include( dirname( __FILE__ ) . '/class-form-reports-table.php' ); |
|
170 | + include(dirname(__FILE__).'/class-form-reports-table.php'); |
|
171 | 171 | |
172 | 172 | $give_table = new Give_Form_Reports_Table(); |
173 | 173 | $give_table->prepare_items(); |
174 | 174 | $give_table->display(); |
175 | 175 | } |
176 | 176 | |
177 | -add_action( 'give_reports_view_forms', 'give_reports_forms_table' ); |
|
177 | +add_action('give_reports_view_forms', 'give_reports_forms_table'); |
|
178 | 178 | |
179 | 179 | /** |
180 | 180 | * Renders the detailed report for a specific give form |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | * @return void |
184 | 184 | */ |
185 | 185 | function give_reports_form_details() { |
186 | - if ( ! isset( $_GET['form-id'] ) ) { |
|
186 | + if ( ! isset($_GET['form-id'])) { |
|
187 | 187 | return; |
188 | 188 | } |
189 | 189 | ?> |
@@ -191,14 +191,14 @@ discard block |
||
191 | 191 | <div class="actions bulkactions"> |
192 | 192 | <?php give_report_views(); ?> |
193 | 193 | |
194 | - <button onclick="history.go(-1);" class="button-secondary"><?php esc_html_e( 'Go Back', 'give' ); ?></button> |
|
194 | + <button onclick="history.go(-1);" class="button-secondary"><?php esc_html_e('Go Back', 'give'); ?></button> |
|
195 | 195 | </div> |
196 | 196 | </div> |
197 | 197 | <?php |
198 | - give_reports_graph_of_form( absint( $_GET['form-id'] ) ); |
|
198 | + give_reports_graph_of_form(absint($_GET['form-id'])); |
|
199 | 199 | } |
200 | 200 | |
201 | -add_action( 'give_reports_view_forms', 'give_reports_form_details' ); |
|
201 | +add_action('give_reports_view_forms', 'give_reports_form_details'); |
|
202 | 202 | |
203 | 203 | /** |
204 | 204 | * Renders the Reports Donors Table |
@@ -209,28 +209,28 @@ discard block |
||
209 | 209 | * @return void |
210 | 210 | */ |
211 | 211 | function give_reports_donors_table() { |
212 | - include( dirname( __FILE__ ) . '/class-donor-reports-table.php' ); |
|
212 | + include(dirname(__FILE__).'/class-donor-reports-table.php'); |
|
213 | 213 | |
214 | 214 | $give_table = new Give_Donor_Reports_Table(); |
215 | 215 | $give_table->prepare_items(); |
216 | 216 | ?> |
217 | 217 | <div class="wrap give-reports-donors-wrap"> |
218 | - <?php do_action( 'give_logs_donors_table_top' ); ?> |
|
219 | - <form id="give-donors-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-reports&view=donors' ); ?>"> |
|
218 | + <?php do_action('give_logs_donors_table_top'); ?> |
|
219 | + <form id="give-donors-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-reports&view=donors'); ?>"> |
|
220 | 220 | <?php |
221 | - $give_table->search_box( esc_html__( 'Search', 'give' ), 'give-donors' ); |
|
221 | + $give_table->search_box(esc_html__('Search', 'give'), 'give-donors'); |
|
222 | 222 | $give_table->display(); |
223 | 223 | ?> |
224 | 224 | <input type="hidden" name="post_type" value="give_forms"/> |
225 | 225 | <input type="hidden" name="page" value="give-reports"/> |
226 | 226 | <input type="hidden" name="view" value="donors"/> |
227 | 227 | </form> |
228 | - <?php do_action( 'give_logs_donors_table_bottom' ); ?> |
|
228 | + <?php do_action('give_logs_donors_table_bottom'); ?> |
|
229 | 229 | </div> |
230 | 230 | <?php |
231 | 231 | } |
232 | 232 | |
233 | -add_action( 'give_reports_view_donors', 'give_reports_donors_table' ); |
|
233 | +add_action('give_reports_view_donors', 'give_reports_donors_table'); |
|
234 | 234 | |
235 | 235 | |
236 | 236 | /** |
@@ -242,14 +242,14 @@ discard block |
||
242 | 242 | * @return void |
243 | 243 | */ |
244 | 244 | function give_reports_gateways_table() { |
245 | - include( dirname( __FILE__ ) . '/class-gateways-reports-table.php' ); |
|
245 | + include(dirname(__FILE__).'/class-gateways-reports-table.php'); |
|
246 | 246 | |
247 | 247 | $give_table = new Give_Gateawy_Reports_Table(); |
248 | 248 | $give_table->prepare_items(); |
249 | 249 | $give_table->display(); |
250 | 250 | } |
251 | 251 | |
252 | -add_action( 'give_reports_view_gateways', 'give_reports_gateways_table' ); |
|
252 | +add_action('give_reports_view_gateways', 'give_reports_gateways_table'); |
|
253 | 253 | |
254 | 254 | |
255 | 255 | /** |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | function give_reports_earnings() { |
262 | 262 | ?> |
263 | 263 | <div class="tablenav top reports-table-nav"> |
264 | - <h3 class="alignleft reports-earnings-title"><span><?php esc_html_e( 'Income Over Time', 'give' ); ?></span></h3> |
|
264 | + <h3 class="alignleft reports-earnings-title"><span><?php esc_html_e('Income Over Time', 'give'); ?></span></h3> |
|
265 | 265 | |
266 | 266 | <div class="alignright actions reports-views-wrap"><?php give_report_views(); ?></div> |
267 | 267 | </div> |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | give_reports_graph(); |
270 | 270 | } |
271 | 271 | |
272 | -add_action( 'give_reports_view_earnings', 'give_reports_earnings' ); |
|
272 | +add_action('give_reports_view_earnings', 'give_reports_earnings'); |
|
273 | 273 | |
274 | 274 | |
275 | 275 | /** |
@@ -284,53 +284,53 @@ discard block |
||
284 | 284 | <div id="post-body"> |
285 | 285 | <div id="post-body-content"> |
286 | 286 | |
287 | - <?php do_action( 'give_reports_tab_export_content_top' ); ?> |
|
287 | + <?php do_action('give_reports_tab_export_content_top'); ?> |
|
288 | 288 | |
289 | 289 | <table class="widefat export-options-table give-table"> |
290 | 290 | <thead> |
291 | 291 | <tr> |
292 | - <th class="row-title"><?php esc_html_e( 'Export Type', 'give' ); ?></th> |
|
293 | - <th><?php esc_html_e( 'Export Options', 'give' ); ?></th> |
|
292 | + <th class="row-title"><?php esc_html_e('Export Type', 'give'); ?></th> |
|
293 | + <th><?php esc_html_e('Export Options', 'give'); ?></th> |
|
294 | 294 | </tr> |
295 | 295 | </thead> |
296 | 296 | <tbody> |
297 | - <?php do_action( 'give_reports_tab_export_table_top' ); ?> |
|
297 | + <?php do_action('give_reports_tab_export_table_top'); ?> |
|
298 | 298 | <tr class="give-export-pdf-sales-earnings"> |
299 | 299 | <td class="row-title"> |
300 | - <h3><span><?php esc_html_e( 'Export PDF of Donations and Income', 'give' ); ?></span></h3> |
|
300 | + <h3><span><?php esc_html_e('Export PDF of Donations and Income', 'give'); ?></span></h3> |
|
301 | 301 | |
302 | - <p><?php esc_html_e( 'Download a PDF of Donations and Income reports for all forms for the current year.', 'give' ); ?></p> |
|
302 | + <p><?php esc_html_e('Download a PDF of Donations and Income reports for all forms for the current year.', 'give'); ?></p> |
|
303 | 303 | </td> |
304 | 304 | <td> |
305 | - <a class="button" href="<?php echo wp_nonce_url( add_query_arg( array( 'give-action' => 'generate_pdf' ) ), 'give_generate_pdf' ); ?>"><?php esc_html_e( 'Generate PDF', 'give' ); ?></a> |
|
305 | + <a class="button" href="<?php echo wp_nonce_url(add_query_arg(array('give-action' => 'generate_pdf')), 'give_generate_pdf'); ?>"><?php esc_html_e('Generate PDF', 'give'); ?></a> |
|
306 | 306 | </td> |
307 | 307 | </tr> |
308 | 308 | <tr class="alternate give-export-sales-earnings"> |
309 | 309 | <td class="row-title"> |
310 | - <h3><span><?php esc_html_e( 'Export Income and Donation Stats', 'give' ); ?></span></h3> |
|
310 | + <h3><span><?php esc_html_e('Export Income and Donation Stats', 'give'); ?></span></h3> |
|
311 | 311 | |
312 | - <p><?php esc_html_e( 'Download a CSV of income and donations over time.', 'give' ); ?></p> |
|
312 | + <p><?php esc_html_e('Download a CSV of income and donations over time.', 'give'); ?></p> |
|
313 | 313 | </td> |
314 | 314 | <td> |
315 | 315 | <form method="post"> |
316 | 316 | <?php |
317 | 317 | printf( |
318 | 318 | /* translators: 1: start date dropdown 2: end date dropdown */ |
319 | - esc_html__( '%1$s to %2$s', 'give' ), |
|
320 | - Give()->html->year_dropdown( 'start_year' ) . ' ' . Give()->html->month_dropdown( 'start_month' ), |
|
321 | - Give()->html->year_dropdown( 'end_year' ) . ' ' . Give()->html->month_dropdown( 'end_month' ) |
|
319 | + esc_html__('%1$s to %2$s', 'give'), |
|
320 | + Give()->html->year_dropdown('start_year').' '.Give()->html->month_dropdown('start_month'), |
|
321 | + Give()->html->year_dropdown('end_year').' '.Give()->html->month_dropdown('end_month') |
|
322 | 322 | ); |
323 | 323 | ?> |
324 | 324 | <input type="hidden" name="give-action" value="earnings_export"/> |
325 | - <input type="submit" value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>" class="button-secondary"/> |
|
325 | + <input type="submit" value="<?php esc_attr_e('Generate CSV', 'give'); ?>" class="button-secondary"/> |
|
326 | 326 | </form> |
327 | 327 | </td> |
328 | 328 | </tr> |
329 | 329 | <tr class="give-export-payment-history"> |
330 | 330 | <td class="row-title"> |
331 | - <h3><span><?php esc_html_e( 'Export Donation History', 'give' ); ?></span></h3> |
|
331 | + <h3><span><?php esc_html_e('Export Donation History', 'give'); ?></span></h3> |
|
332 | 332 | |
333 | - <p><?php esc_html_e( 'Download a CSV of all donations recorded.', 'give' ); ?></p> |
|
333 | + <p><?php esc_html_e('Download a CSV of all donations recorded.', 'give'); ?></p> |
|
334 | 334 | </td> |
335 | 335 | <td> |
336 | 336 | <form id="give-export-payments" class="give-export-form" method="post"> |
@@ -338,29 +338,29 @@ discard block |
||
338 | 338 | $args = array( |
339 | 339 | 'id' => 'give-payment-export-start', |
340 | 340 | 'name' => 'start', |
341 | - 'placeholder' => esc_attr__( 'Start date', 'give' ) |
|
341 | + 'placeholder' => esc_attr__('Start date', 'give') |
|
342 | 342 | ); |
343 | - echo Give()->html->date_field( $args ); ?> |
|
343 | + echo Give()->html->date_field($args); ?> |
|
344 | 344 | <?php |
345 | 345 | $args = array( |
346 | 346 | 'id' => 'give-payment-export-end', |
347 | 347 | 'name' => 'end', |
348 | - 'placeholder' => esc_attr__( 'End date', 'give' ) |
|
348 | + 'placeholder' => esc_attr__('End date', 'give') |
|
349 | 349 | ); |
350 | - echo Give()->html->date_field( $args ); ?> |
|
350 | + echo Give()->html->date_field($args); ?> |
|
351 | 351 | <select name="status"> |
352 | - <option value="any"><?php esc_html_e( 'All Statuses', 'give' ); ?></option> |
|
352 | + <option value="any"><?php esc_html_e('All Statuses', 'give'); ?></option> |
|
353 | 353 | <?php |
354 | 354 | $statuses = give_get_payment_statuses(); |
355 | - foreach ( $statuses as $status => $label ) { |
|
356 | - echo '<option value="' . $status . '">' . $label . '</option>'; |
|
355 | + foreach ($statuses as $status => $label) { |
|
356 | + echo '<option value="'.$status.'">'.$label.'</option>'; |
|
357 | 357 | } |
358 | 358 | ?> |
359 | 359 | </select> |
360 | - <?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?> |
|
360 | + <?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?> |
|
361 | 361 | <input type="hidden" name="give-export-class" value="Give_Batch_Payments_Export"/> |
362 | 362 | <span> |
363 | - <input type="submit" value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>" class="button-secondary"/> |
|
363 | + <input type="submit" value="<?php esc_attr_e('Generate CSV', 'give'); ?>" class="button-secondary"/> |
|
364 | 364 | <span class="spinner"></span> |
365 | 365 | </span> |
366 | 366 | </form> |
@@ -369,9 +369,9 @@ discard block |
||
369 | 369 | </tr> |
370 | 370 | <tr class="alternate give-export-donors"> |
371 | 371 | <td class="row-title"> |
372 | - <h3><span><?php esc_html_e( 'Export Donors in CSV', 'give' ); ?></span></h3> |
|
372 | + <h3><span><?php esc_html_e('Export Donors in CSV', 'give'); ?></span></h3> |
|
373 | 373 | |
374 | - <p><?php esc_html_e( 'Download an export of donors for all donation forms or only those who have given to a particular form.', 'give' ); ?></p> |
|
374 | + <p><?php esc_html_e('Download an export of donors for all donation forms or only those who have given to a particular form.', 'give'); ?></p> |
|
375 | 375 | </td> |
376 | 376 | <td> |
377 | 377 | <form method="post" id="give_donor_export" class="give-export-form"> |
@@ -382,54 +382,54 @@ discard block |
||
382 | 382 | 'id' => 'give_customer_export_form', |
383 | 383 | 'chosen' => true |
384 | 384 | ); |
385 | - echo Give()->html->forms_dropdown( $args ); ?> |
|
385 | + echo Give()->html->forms_dropdown($args); ?> |
|
386 | 386 | |
387 | - <input type="submit" value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>" class="button-secondary"/> |
|
387 | + <input type="submit" value="<?php esc_attr_e('Generate CSV', 'give'); ?>" class="button-secondary"/> |
|
388 | 388 | |
389 | 389 | <div id="export-donor-options-wrap" class="give-clearfix"> |
390 | - <p><?php esc_html_e( 'Export Columns', 'give' ); ?>:</p> |
|
390 | + <p><?php esc_html_e('Export Columns', 'give'); ?>:</p> |
|
391 | 391 | <ul id="give-export-option-ul"> |
392 | 392 | <li> |
393 | - <label for="give-export-fullname"><input type="checkbox" checked name="give_export_option[full_name]" id="give-export-fullname"><?php esc_html_e( 'Name', 'give' ); ?> |
|
393 | + <label for="give-export-fullname"><input type="checkbox" checked name="give_export_option[full_name]" id="give-export-fullname"><?php esc_html_e('Name', 'give'); ?> |
|
394 | 394 | </label> |
395 | 395 | </li> |
396 | 396 | <li> |
397 | - <label for="give-export-email"><input type="checkbox" checked name="give_export_option[email]" id="give-export-email"><?php esc_html_e( 'Email', 'give' ); ?> |
|
397 | + <label for="give-export-email"><input type="checkbox" checked name="give_export_option[email]" id="give-export-email"><?php esc_html_e('Email', 'give'); ?> |
|
398 | 398 | </label> |
399 | 399 | </li> |
400 | 400 | <li> |
401 | - <label for="give-export-address"><input type="checkbox" checked name="give_export_option[address]" id="give-export-address"><?php esc_html_e( 'Address', 'give' ); ?> |
|
401 | + <label for="give-export-address"><input type="checkbox" checked name="give_export_option[address]" id="give-export-address"><?php esc_html_e('Address', 'give'); ?> |
|
402 | 402 | </label> |
403 | 403 | </li> |
404 | 404 | <li> |
405 | - <label for="give-export-userid"><input type="checkbox" checked name="give_export_option[userid]" id="give-export-userid"><?php esc_html_e( 'User ID', 'give' ); ?> |
|
405 | + <label for="give-export-userid"><input type="checkbox" checked name="give_export_option[userid]" id="give-export-userid"><?php esc_html_e('User ID', 'give'); ?> |
|
406 | 406 | </label> |
407 | 407 | </li> |
408 | 408 | <li> |
409 | - <label for="give-export-first-donation-date"><input type="checkbox" checked name="give_export_option[date_first_donated]" id="give-export-first-donation-date"><?php esc_html_e( 'First Donation Date', 'give' ); ?> |
|
409 | + <label for="give-export-first-donation-date"><input type="checkbox" checked name="give_export_option[date_first_donated]" id="give-export-first-donation-date"><?php esc_html_e('First Donation Date', 'give'); ?> |
|
410 | 410 | </label> |
411 | 411 | </li> |
412 | 412 | <li> |
413 | - <label for="give-export-donation-number"><input type="checkbox" checked name="give_export_option[donations]" id="give-export-donation-number"><?php esc_html_e( 'Number of Donations', 'give' ); ?> |
|
413 | + <label for="give-export-donation-number"><input type="checkbox" checked name="give_export_option[donations]" id="give-export-donation-number"><?php esc_html_e('Number of Donations', 'give'); ?> |
|
414 | 414 | </label> |
415 | 415 | </li> |
416 | 416 | <li> |
417 | - <label for="give-export-donation-sum"><input type="checkbox" checked name="give_export_option[donation_sum]" id="give-export-donation-sum"><?php esc_html_e( 'Total Donated', 'give' ); ?> |
|
417 | + <label for="give-export-donation-sum"><input type="checkbox" checked name="give_export_option[donation_sum]" id="give-export-donation-sum"><?php esc_html_e('Total Donated', 'give'); ?> |
|
418 | 418 | </label> |
419 | 419 | </li> |
420 | 420 | </ul> |
421 | 421 | </div> |
422 | - <?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?> |
|
422 | + <?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?> |
|
423 | 423 | <input type="hidden" name="give-export-class" value="Give_Batch_Customers_Export"/> |
424 | 424 | <input type="hidden" name="give-action" value="email_export"/> |
425 | 425 | </form> |
426 | 426 | </td> |
427 | 427 | </tr> |
428 | - <?php do_action( 'give_reports_tab_export_table_bottom' ); ?> |
|
428 | + <?php do_action('give_reports_tab_export_table_bottom'); ?> |
|
429 | 429 | </tbody> |
430 | 430 | </table> |
431 | 431 | |
432 | - <?php do_action( 'give_reports_tab_export_content_bottom' ); ?> |
|
432 | + <?php do_action('give_reports_tab_export_content_bottom'); ?> |
|
433 | 433 | |
434 | 434 | </div> |
435 | 435 | <!-- .post-body-content --> |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | <?php |
440 | 440 | } |
441 | 441 | |
442 | -add_action( 'give_reports_tab_export', 'give_reports_tab_export' ); |
|
442 | +add_action('give_reports_tab_export', 'give_reports_tab_export'); |
|
443 | 443 | |
444 | 444 | /** |
445 | 445 | * Renders the Reports page |
@@ -449,19 +449,19 @@ discard block |
||
449 | 449 | */ |
450 | 450 | function give_reports_tab_logs() { |
451 | 451 | |
452 | - require( GIVE_PLUGIN_DIR . 'includes/admin/reporting/logs.php' ); |
|
452 | + require(GIVE_PLUGIN_DIR.'includes/admin/reporting/logs.php'); |
|
453 | 453 | |
454 | 454 | $current_view = 'sales'; |
455 | 455 | $log_views = give_log_default_views(); |
456 | 456 | |
457 | - if ( isset( $_GET['view'] ) && array_key_exists( $_GET['view'], $log_views ) ) { |
|
457 | + if (isset($_GET['view']) && array_key_exists($_GET['view'], $log_views)) { |
|
458 | 458 | $current_view = $_GET['view']; |
459 | 459 | } |
460 | 460 | |
461 | - do_action( 'give_logs_view_' . $current_view ); |
|
461 | + do_action('give_logs_view_'.$current_view); |
|
462 | 462 | } |
463 | 463 | |
464 | -add_action( 'give_reports_tab_logs', 'give_reports_tab_logs' ); |
|
464 | +add_action('give_reports_tab_logs', 'give_reports_tab_logs'); |
|
465 | 465 | |
466 | 466 | /** |
467 | 467 | * Retrieves estimated monthly earnings and sales |
@@ -471,9 +471,9 @@ discard block |
||
471 | 471 | */ |
472 | 472 | function give_estimated_monthly_stats() { |
473 | 473 | |
474 | - $estimated = get_transient( 'give_estimated_monthly_stats' ); |
|
474 | + $estimated = get_transient('give_estimated_monthly_stats'); |
|
475 | 475 | |
476 | - if ( false === $estimated ) { |
|
476 | + if (false === $estimated) { |
|
477 | 477 | |
478 | 478 | $estimated = array( |
479 | 479 | 'earnings' => 0, |
@@ -482,20 +482,20 @@ discard block |
||
482 | 482 | |
483 | 483 | $stats = new Give_Payment_Stats; |
484 | 484 | |
485 | - $to_date_earnings = $stats->get_earnings( 0, 'this_month' ); |
|
486 | - $to_date_sales = $stats->get_sales( 0, 'this_month' ); |
|
485 | + $to_date_earnings = $stats->get_earnings(0, 'this_month'); |
|
486 | + $to_date_sales = $stats->get_sales(0, 'this_month'); |
|
487 | 487 | |
488 | - $current_day = date( 'd', current_time( 'timestamp' ) ); |
|
489 | - $current_month = date( 'n', current_time( 'timestamp' ) ); |
|
490 | - $current_year = date( 'Y', current_time( 'timestamp' ) ); |
|
491 | - $days_in_month = cal_days_in_month( CAL_GREGORIAN, $current_month, $current_year ); |
|
488 | + $current_day = date('d', current_time('timestamp')); |
|
489 | + $current_month = date('n', current_time('timestamp')); |
|
490 | + $current_year = date('Y', current_time('timestamp')); |
|
491 | + $days_in_month = cal_days_in_month(CAL_GREGORIAN, $current_month, $current_year); |
|
492 | 492 | |
493 | - $estimated['earnings'] = ( $to_date_earnings / $current_day ) * $days_in_month; |
|
494 | - $estimated['sales'] = ( $to_date_sales / $current_day ) * $days_in_month; |
|
493 | + $estimated['earnings'] = ($to_date_earnings / $current_day) * $days_in_month; |
|
494 | + $estimated['sales'] = ($to_date_sales / $current_day) * $days_in_month; |
|
495 | 495 | |
496 | 496 | // Cache for one day |
497 | - set_transient( 'give_estimated_monthly_stats', $estimated, 86400 ); |
|
497 | + set_transient('give_estimated_monthly_stats', $estimated, 86400); |
|
498 | 498 | } |
499 | 499 | |
500 | - return maybe_unserialize( $estimated ); |
|
500 | + return maybe_unserialize($estimated); |
|
501 | 501 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -22,80 +22,80 @@ discard block |
||
22 | 22 | */ |
23 | 23 | function give_tools_recount_stats_display() { |
24 | 24 | |
25 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
25 | + if ( ! current_user_can('manage_give_settings')) { |
|
26 | 26 | return; |
27 | 27 | } |
28 | 28 | |
29 | - do_action( 'give_tools_recount_stats_before' ); |
|
29 | + do_action('give_tools_recount_stats_before'); |
|
30 | 30 | ?> |
31 | 31 | <div id="poststuff"> |
32 | 32 | <div class="postbox"> |
33 | 33 | |
34 | - <h2 class="hndle ui-sortable-handle"><span><?php esc_html_e( 'Recount Stats', 'give' ); ?></span></h2> |
|
34 | + <h2 class="hndle ui-sortable-handle"><span><?php esc_html_e('Recount Stats', 'give'); ?></span></h2> |
|
35 | 35 | |
36 | 36 | <div class="inside recount-stats-controls"> |
37 | - <p><?php esc_html_e( 'Use these tools to recount stats, delete test transactions, or reset stats.', 'give' ); ?></p> |
|
37 | + <p><?php esc_html_e('Use these tools to recount stats, delete test transactions, or reset stats.', 'give'); ?></p> |
|
38 | 38 | <form method="post" id="give-tools-recount-form" class="give-export-form"> |
39 | 39 | |
40 | - <?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?> |
|
40 | + <?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?> |
|
41 | 41 | |
42 | 42 | <select name="give-export-class" id="recount-stats-type"> |
43 | - <option value="0" selected="selected" disabled="disabled"><?php esc_html_e( 'Please select an option', 'give' ); ?></option> |
|
44 | - <option data-type="recount-stats" value="Give_Tools_Recount_Income"><?php esc_html_e( 'Recalculate Total Donation Income Amount', 'give' ); ?></option> |
|
45 | - <option data-type="recount-form" value="Give_Tools_Recount_Form_Stats"><?php esc_html_e( 'Recalculate Income Amount and Donation Counts for a Form', 'give' ); ?></option> |
|
46 | - <option data-type="recount-all" value="Give_Tools_Recount_All_Stats"><?php esc_html_e( 'Recalculate Income Amount and Donation Counts for All Forms', 'give' ); ?></option> |
|
47 | - <option data-type="recount-customer-stats" value="Give_Tools_Recount_Customer_Stats"><?php esc_html_e( 'Recalculate Donor Statistics', 'give' ); ?></option> |
|
48 | - <option data-type="delete-test-transactions" value="Give_Tools_Delete_Test_Transactions"><?php esc_html_e( 'Delete Test Transactions', 'give' ); ?></option> |
|
49 | - <option data-type="reset-stats" value="Give_Tools_Reset_Stats"><?php esc_html_e( 'Delete All Data', 'give' ); ?></option> |
|
50 | - <?php do_action( 'give_recount_tool_options' ); ?> |
|
43 | + <option value="0" selected="selected" disabled="disabled"><?php esc_html_e('Please select an option', 'give'); ?></option> |
|
44 | + <option data-type="recount-stats" value="Give_Tools_Recount_Income"><?php esc_html_e('Recalculate Total Donation Income Amount', 'give'); ?></option> |
|
45 | + <option data-type="recount-form" value="Give_Tools_Recount_Form_Stats"><?php esc_html_e('Recalculate Income Amount and Donation Counts for a Form', 'give'); ?></option> |
|
46 | + <option data-type="recount-all" value="Give_Tools_Recount_All_Stats"><?php esc_html_e('Recalculate Income Amount and Donation Counts for All Forms', 'give'); ?></option> |
|
47 | + <option data-type="recount-customer-stats" value="Give_Tools_Recount_Customer_Stats"><?php esc_html_e('Recalculate Donor Statistics', 'give'); ?></option> |
|
48 | + <option data-type="delete-test-transactions" value="Give_Tools_Delete_Test_Transactions"><?php esc_html_e('Delete Test Transactions', 'give'); ?></option> |
|
49 | + <option data-type="reset-stats" value="Give_Tools_Reset_Stats"><?php esc_html_e('Delete All Data', 'give'); ?></option> |
|
50 | + <?php do_action('give_recount_tool_options'); ?> |
|
51 | 51 | </select> |
52 | 52 | |
53 | 53 | <span id="tools-form-dropdown" style="display: none"> |
54 | 54 | <?php |
55 | 55 | $args = array( |
56 | 56 | 'name' => 'form_id', |
57 | - 'number' => - 1, |
|
57 | + 'number' => -1, |
|
58 | 58 | 'chosen' => true, |
59 | 59 | ); |
60 | - echo Give()->html->forms_dropdown( $args ); |
|
60 | + echo Give()->html->forms_dropdown($args); |
|
61 | 61 | ?> |
62 | 62 | </span> |
63 | 63 | |
64 | - <input type="submit" id="recount-stats-submit" value="<?php esc_attr_e( 'Submit', 'give' ); ?>" class="button-secondary"/> |
|
64 | + <input type="submit" id="recount-stats-submit" value="<?php esc_attr_e('Submit', 'give'); ?>" class="button-secondary"/> |
|
65 | 65 | |
66 | 66 | <br/> |
67 | 67 | |
68 | 68 | <span class="give-recount-stats-descriptions"> |
69 | - <span id="recount-stats"><?php esc_html_e( 'Recalculates the overall donation income amount.', 'give' ); ?></span> |
|
69 | + <span id="recount-stats"><?php esc_html_e('Recalculates the overall donation income amount.', 'give'); ?></span> |
|
70 | 70 | <span id="recount-form"><?php |
71 | 71 | printf( |
72 | 72 | /* translators: %s: form singular label */ |
73 | - esc_html__( 'Recalculates the donation and income stats for a specific %s.', 'give' ), |
|
74 | - give_get_forms_label_singular( true ) |
|
73 | + esc_html__('Recalculates the donation and income stats for a specific %s.', 'give'), |
|
74 | + give_get_forms_label_singular(true) |
|
75 | 75 | ); |
76 | 76 | ?></span> |
77 | 77 | <span id="recount-all"><?php |
78 | 78 | printf( |
79 | 79 | /* translators: %s: form plural label */ |
80 | - esc_html__( 'Recalculates the earnings and sales stats for all %s.', 'give' ), |
|
81 | - give_get_forms_label_plural( true ) |
|
80 | + esc_html__('Recalculates the earnings and sales stats for all %s.', 'give'), |
|
81 | + give_get_forms_label_plural(true) |
|
82 | 82 | ); |
83 | 83 | ?></span> |
84 | - <span id="recount-customer-stats"><?php esc_html_e( 'Recalculates the lifetime value and donation counts for all donors.', 'give' ); ?></span> |
|
85 | - <?php do_action( 'give_recount_tool_descriptions' ); ?> |
|
86 | - <span id="delete-test-transactions"><?php _e( '<strong>Deletes</strong> all TEST payment records, donors, and related log entries.', 'give' ); ?></span> |
|
87 | - <span id="reset-stats"><?php _e( '<strong>Deletes</strong> ALL transaction records, donors, and related log entries regardless of test or live mode.', 'give' ); ?></span> |
|
84 | + <span id="recount-customer-stats"><?php esc_html_e('Recalculates the lifetime value and donation counts for all donors.', 'give'); ?></span> |
|
85 | + <?php do_action('give_recount_tool_descriptions'); ?> |
|
86 | + <span id="delete-test-transactions"><?php _e('<strong>Deletes</strong> all TEST payment records, donors, and related log entries.', 'give'); ?></span> |
|
87 | + <span id="reset-stats"><?php _e('<strong>Deletes</strong> ALL transaction records, donors, and related log entries regardless of test or live mode.', 'give'); ?></span> |
|
88 | 88 | </span> |
89 | 89 | |
90 | 90 | <span class="spinner"></span> |
91 | 91 | |
92 | 92 | </form> |
93 | - <?php do_action( 'give_tools_recount_forms' ); ?> |
|
93 | + <?php do_action('give_tools_recount_forms'); ?> |
|
94 | 94 | </div><!-- .inside --> |
95 | 95 | </div><!-- .postbox --> |
96 | 96 | </div><!-- #poststuff --> |
97 | 97 | <?php |
98 | - do_action( 'give_tools_recount_stats_after' ); |
|
98 | + do_action('give_tools_recount_stats_after'); |
|
99 | 99 | } |
100 | 100 | |
101 | -add_action( 'give_reports_tab_tools', 'give_tools_recount_stats_display' ); |
|
101 | +add_action('give_reports_tab_tools', 'give_tools_recount_stats_display'); |
@@ -10,13 +10,13 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
17 | 17 | // Load WP_List_Table if not loaded |
18 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
19 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
18 | +if ( ! class_exists('WP_List_Table')) { |
|
19 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
@@ -45,11 +45,11 @@ discard block |
||
45 | 45 | global $status, $page; |
46 | 46 | |
47 | 47 | // Set parent defaults |
48 | - parent::__construct( array( |
|
49 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
50 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
48 | + parent::__construct(array( |
|
49 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
50 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
51 | 51 | 'ajax' => false // Does this table support ajax? |
52 | - ) ); |
|
52 | + )); |
|
53 | 53 | |
54 | 54 | } |
55 | 55 | |
@@ -64,10 +64,10 @@ discard block |
||
64 | 64 | * |
65 | 65 | * @return string Column Name |
66 | 66 | */ |
67 | - public function column_default( $item, $column_name ) { |
|
68 | - switch ( $column_name ) { |
|
67 | + public function column_default($item, $column_name) { |
|
68 | + switch ($column_name) { |
|
69 | 69 | default: |
70 | - return $item[ $column_name ]; |
|
70 | + return $item[$column_name]; |
|
71 | 71 | } |
72 | 72 | } |
73 | 73 | |
@@ -80,11 +80,11 @@ discard block |
||
80 | 80 | */ |
81 | 81 | public function get_columns() { |
82 | 82 | $columns = array( |
83 | - 'label' => esc_attr__( 'Gateway', 'give' ), |
|
84 | - 'complete_sales' => esc_attr__( 'Complete Transactions', 'give' ), |
|
85 | - 'pending_sales' => esc_attr__( 'Pending / Failed Transactions', 'give' ), |
|
86 | - 'total_sales' => esc_attr__( 'Total Transactions', 'give' ), |
|
87 | - 'total_donations' => esc_attr__( 'Total Donations', 'give' ) |
|
83 | + 'label' => esc_attr__('Gateway', 'give'), |
|
84 | + 'complete_sales' => esc_attr__('Complete Transactions', 'give'), |
|
85 | + 'pending_sales' => esc_attr__('Pending / Failed Transactions', 'give'), |
|
86 | + 'total_sales' => esc_attr__('Total Transactions', 'give'), |
|
87 | + 'total_donations' => esc_attr__('Total Donations', 'give') |
|
88 | 88 | ); |
89 | 89 | |
90 | 90 | return $columns; |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | * @return int Current page number |
100 | 100 | */ |
101 | 101 | public function get_paged() { |
102 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
102 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | * @since 1.0 |
111 | 111 | * @return void |
112 | 112 | */ |
113 | - public function bulk_actions( $which = '' ) { |
|
113 | + public function bulk_actions($which = '') { |
|
114 | 114 | // These aren't really bulk actions but this outputs the markup in the right place |
115 | 115 | give_report_views(); |
116 | 116 | } |
@@ -123,23 +123,23 @@ discard block |
||
123 | 123 | * |
124 | 124 | * @param string $which |
125 | 125 | */ |
126 | - protected function display_tablenav( $which ) { |
|
126 | + protected function display_tablenav($which) { |
|
127 | 127 | |
128 | - if ( 'top' == $which ) { |
|
129 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
128 | + if ('top' == $which) { |
|
129 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
130 | 130 | } |
131 | 131 | ?> |
132 | - <div class="tablenav gateways-report-tablenav give-clearfix <?php esc_attr_e( $which ); ?>"> |
|
132 | + <div class="tablenav gateways-report-tablenav give-clearfix <?php esc_attr_e($which); ?>"> |
|
133 | 133 | |
134 | - <h3 class="alignleft reports-earnings-title"><span><?php esc_html_e( 'Payment Methods Report', 'give' ); ?></span></h3> |
|
134 | + <h3 class="alignleft reports-earnings-title"><span><?php esc_html_e('Payment Methods Report', 'give'); ?></span></h3> |
|
135 | 135 | |
136 | 136 | <div class="alignright tablenav-right"> |
137 | 137 | <div class="actions bulkactions"> |
138 | - <?php $this->bulk_actions( $which ); ?> |
|
138 | + <?php $this->bulk_actions($which); ?> |
|
139 | 139 | </div> |
140 | 140 | <?php |
141 | - $this->extra_tablenav( $which ); |
|
142 | - $this->pagination( $which ); |
|
141 | + $this->extra_tablenav($which); |
|
142 | + $this->pagination($which); |
|
143 | 143 | ?> |
144 | 144 | </div> |
145 | 145 | |
@@ -164,18 +164,18 @@ discard block |
||
164 | 164 | $gateways = give_get_payment_gateways(); |
165 | 165 | $stats = new Give_Payment_Stats(); |
166 | 166 | |
167 | - foreach ( $gateways as $gateway_id => $gateway ) { |
|
167 | + foreach ($gateways as $gateway_id => $gateway) { |
|
168 | 168 | |
169 | - $complete_count = give_count_sales_by_gateway( $gateway_id, 'publish' ); |
|
170 | - $pending_count = give_count_sales_by_gateway( $gateway_id, array( 'pending', 'failed' ) ); |
|
169 | + $complete_count = give_count_sales_by_gateway($gateway_id, 'publish'); |
|
170 | + $pending_count = give_count_sales_by_gateway($gateway_id, array('pending', 'failed')); |
|
171 | 171 | |
172 | 172 | $reports_data[] = array( |
173 | 173 | 'ID' => $gateway_id, |
174 | 174 | 'label' => $gateway['admin_label'], |
175 | - 'complete_sales' => give_format_amount( $complete_count, false ), |
|
176 | - 'pending_sales' => give_format_amount( $pending_count, false ), |
|
177 | - 'total_sales' => give_format_amount( $complete_count + $pending_count, false ), |
|
178 | - 'total_donations' => give_currency_filter( give_format_amount( $stats->get_earnings( 0, 0, 0, $gateway_id ) ) ) |
|
175 | + 'complete_sales' => give_format_amount($complete_count, false), |
|
176 | + 'pending_sales' => give_format_amount($pending_count, false), |
|
177 | + 'total_sales' => give_format_amount($complete_count + $pending_count, false), |
|
178 | + 'total_donations' => give_currency_filter(give_format_amount($stats->get_earnings(0, 0, 0, $gateway_id))) |
|
179 | 179 | ); |
180 | 180 | } |
181 | 181 | |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | $columns = $this->get_columns(); |
198 | 198 | $hidden = array(); // No hidden columns |
199 | 199 | $sortable = $this->get_sortable_columns(); |
200 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
200 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
201 | 201 | $this->items = $this->reports_data(); |
202 | 202 | |
203 | 203 | } |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | // Exit if accessed directly |
11 | -if ( ! defined( 'ABSPATH' ) ) { |
|
11 | +if ( ! defined('ABSPATH')) { |
|
12 | 12 | exit; |
13 | 13 | } |
14 | 14 | |
@@ -26,12 +26,12 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @param $_banner_details |
28 | 28 | */ |
29 | - function __construct( $_banner_details ) { |
|
29 | + function __construct($_banner_details) { |
|
30 | 30 | |
31 | 31 | global $current_user; |
32 | 32 | $this->banner_details = $_banner_details; |
33 | - $this->test_mode = ( $this->banner_details['testing'] == 'true' ) ? true : false; |
|
34 | - $this->nag_meta_key = 'give_addon_activation_ignore_' . sanitize_title( $this->banner_details['name'] ); |
|
33 | + $this->test_mode = ($this->banner_details['testing'] == 'true') ? true : false; |
|
34 | + $this->nag_meta_key = 'give_addon_activation_ignore_'.sanitize_title($this->banner_details['name']); |
|
35 | 35 | |
36 | 36 | //Get current user |
37 | 37 | $this->user_id = $current_user->ID; |
@@ -50,13 +50,13 @@ discard block |
||
50 | 50 | public function init() { |
51 | 51 | |
52 | 52 | //Testing? |
53 | - if ( $this->test_mode ) { |
|
54 | - delete_user_meta( $this->user_id, $this->nag_meta_key ); |
|
53 | + if ($this->test_mode) { |
|
54 | + delete_user_meta($this->user_id, $this->nag_meta_key); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | //Get the current page to add the notice to |
58 | - add_action( 'current_screen', array( $this, 'give_addon_notice_ignore' ) ); |
|
59 | - add_action( 'admin_notices', array( $this, 'give_addon_activation_admin_notice' ) ); |
|
58 | + add_action('current_screen', array($this, 'give_addon_notice_ignore')); |
|
59 | + add_action('admin_notices', array($this, 'give_addon_activation_admin_notice')); |
|
60 | 60 | |
61 | 61 | |
62 | 62 | } |
@@ -71,13 +71,13 @@ discard block |
||
71 | 71 | global $pagenow; |
72 | 72 | |
73 | 73 | //Make sure we're on the plugins page. |
74 | - if ( $pagenow !== 'plugins.php' ) { |
|
74 | + if ($pagenow !== 'plugins.php') { |
|
75 | 75 | return false; |
76 | 76 | } |
77 | 77 | |
78 | 78 | // If the user hasn't already dismissed our alert, |
79 | 79 | // Output the activation banner |
80 | - if ( ! get_user_meta( $this->user_id, $this->nag_meta_key ) ) { ?> |
|
80 | + if ( ! get_user_meta($this->user_id, $this->nag_meta_key)) { ?> |
|
81 | 81 | |
82 | 82 | <!-- * I output inline styles here |
83 | 83 | * because there's no reason to keep these |
@@ -157,15 +157,15 @@ discard block |
||
157 | 157 | <h3><?php |
158 | 158 | printf( |
159 | 159 | /* translators: %s: Add-on name */ |
160 | - esc_html__( "Thank you for installing Give's %s Add-on!", 'give' ), |
|
161 | - '<span>' . $this->banner_details['name'] . '</span>' |
|
160 | + esc_html__("Thank you for installing Give's %s Add-on!", 'give'), |
|
161 | + '<span>'.$this->banner_details['name'].'</span>' |
|
162 | 162 | ); |
163 | 163 | ?></h3> |
164 | 164 | |
165 | 165 | <a href="<?php |
166 | 166 | //The Dismiss Button |
167 | - $nag_admin_dismiss_url = 'plugins.php?' . $this->nag_meta_key . '=0'; |
|
168 | - echo admin_url( $nag_admin_dismiss_url ); ?>" class="dismiss"><span class="dashicons dashicons-dismiss"></span></a> |
|
167 | + $nag_admin_dismiss_url = 'plugins.php?'.$this->nag_meta_key.'=0'; |
|
168 | + echo admin_url($nag_admin_dismiss_url); ?>" class="dismiss"><span class="dashicons dashicons-dismiss"></span></a> |
|
169 | 169 | |
170 | 170 | <!-- * Now we output a few "actions" |
171 | 171 | * that the user can take from here --> |
@@ -173,21 +173,21 @@ discard block |
||
173 | 173 | <div class="alert-actions"> |
174 | 174 | |
175 | 175 | <?php //Point them to your settings page |
176 | - if ( isset( $this->banner_details['settings_url'] ) ) { ?> |
|
176 | + if (isset($this->banner_details['settings_url'])) { ?> |
|
177 | 177 | <a href="<?php echo $this->banner_details['settings_url']; ?>"> |
178 | - <span class="dashicons dashicons-admin-settings"></span><?php esc_html_e( 'Go to Settings', 'give' ); ?> |
|
178 | + <span class="dashicons dashicons-admin-settings"></span><?php esc_html_e('Go to Settings', 'give'); ?> |
|
179 | 179 | </a> |
180 | 180 | <?php } ?> |
181 | 181 | |
182 | 182 | <?php |
183 | 183 | // Show them how to configure the Addon |
184 | - if ( isset( $this->banner_details['documentation_url'] ) ) { ?> |
|
184 | + if (isset($this->banner_details['documentation_url'])) { ?> |
|
185 | 185 | <a href="<?php echo $this->banner_details['documentation_url'] ?>" target="_blank"> |
186 | 186 | <span class="dashicons dashicons-media-text"></span> |
187 | 187 | <?php |
188 | 188 | printf( |
189 | 189 | /* translators: %s: Add-on name */ |
190 | - esc_html__( 'Documentation: %s Add-on', 'give' ), |
|
190 | + esc_html__('Documentation: %s Add-on', 'give'), |
|
191 | 191 | $this->banner_details['name'] |
192 | 192 | ); |
193 | 193 | ?> |
@@ -195,10 +195,10 @@ discard block |
||
195 | 195 | <?php } ?> |
196 | 196 | <?php |
197 | 197 | //Let them signup for plugin updates |
198 | - if ( isset( $this->banner_details['support_url'] ) ) { ?> |
|
198 | + if (isset($this->banner_details['support_url'])) { ?> |
|
199 | 199 | |
200 | 200 | <a href="<?php echo $this->banner_details['support_url'] ?>" target="_blank"> |
201 | - <span class="dashicons dashicons-sos"></span><?php esc_html_e( 'Get Support', 'give' ); ?> |
|
201 | + <span class="dashicons dashicons-sos"></span><?php esc_html_e('Get Support', 'give'); ?> |
|
202 | 202 | </a> |
203 | 203 | |
204 | 204 | <?php } ?> |
@@ -220,13 +220,13 @@ discard block |
||
220 | 220 | /* If user clicks to ignore the notice, add that to their user meta the banner then checks whether this tag exists already or not. |
221 | 221 | * See here: http://codex.wordpress.org/Function_Reference/add_user_meta |
222 | 222 | */ |
223 | - if ( isset( $_GET[ $this->nag_meta_key ] ) && '0' == $_GET[ $this->nag_meta_key ] ) { |
|
223 | + if (isset($_GET[$this->nag_meta_key]) && '0' == $_GET[$this->nag_meta_key]) { |
|
224 | 224 | |
225 | 225 | //Get the global user |
226 | 226 | global $current_user; |
227 | 227 | $user_id = $current_user->ID; |
228 | 228 | |
229 | - add_user_meta( $user_id, $this->nag_meta_key, 'true', true ); |
|
229 | + add_user_meta($user_id, $this->nag_meta_key, 'true', true); |
|
230 | 230 | } |
231 | 231 | } |
232 | 232 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -25,12 +25,12 @@ discard block |
||
25 | 25 | function give_add_ons_page() { |
26 | 26 | ob_start(); ?> |
27 | 27 | <div class="wrap" id="give-add-ons"> |
28 | - <h2><?php esc_html_e( 'Give Add-ons', 'give' ); ?> |
|
29 | - — <a href="https://givewp.com/addons/" class="button-primary give-view-addons-all" title="<?php esc_attr_e( 'Browse All Add-ons', 'give' ); ?>" target="_blank"><?php esc_html_e( 'View All Add-ons', 'give' ); ?> |
|
28 | + <h2><?php esc_html_e('Give Add-ons', 'give'); ?> |
|
29 | + — <a href="https://givewp.com/addons/" class="button-primary give-view-addons-all" title="<?php esc_attr_e('Browse All Add-ons', 'give'); ?>" target="_blank"><?php esc_html_e('View All Add-ons', 'give'); ?> |
|
30 | 30 | <span class="dashicons dashicons-external"></span></a> |
31 | 31 | </h2> |
32 | 32 | |
33 | - <p><?php esc_html_e( 'The following Add-ons extend the functionality of Give.', 'give' ); ?></p> |
|
33 | + <p><?php esc_html_e('The following Add-ons extend the functionality of Give.', 'give'); ?></p> |
|
34 | 34 | <?php echo give_add_ons_get_feed(); ?> |
35 | 35 | </div> |
36 | 36 | <?php |
@@ -48,18 +48,18 @@ discard block |
||
48 | 48 | function give_add_ons_get_feed() { |
49 | 49 | |
50 | 50 | $addons_debug = false; //set to true to debug |
51 | - $cache = get_transient( 'give_add_ons_feed' ); |
|
51 | + $cache = get_transient('give_add_ons_feed'); |
|
52 | 52 | |
53 | - if ( $cache === false || $addons_debug === true && WP_DEBUG === true ) { |
|
54 | - $feed = wp_remote_get( 'https://givewp.com/downloads/feed/', array( 'sslverify' => false ) ); |
|
53 | + if ($cache === false || $addons_debug === true && WP_DEBUG === true) { |
|
54 | + $feed = wp_remote_get('https://givewp.com/downloads/feed/', array('sslverify' => false)); |
|
55 | 55 | |
56 | - if ( ! is_wp_error( $feed ) ) { |
|
57 | - if ( isset( $feed['body'] ) && strlen( $feed['body'] ) > 0 ) { |
|
58 | - $cache = wp_remote_retrieve_body( $feed ); |
|
59 | - set_transient( 'give_add_ons_feed', $cache, 3600 ); |
|
56 | + if ( ! is_wp_error($feed)) { |
|
57 | + if (isset($feed['body']) && strlen($feed['body']) > 0) { |
|
58 | + $cache = wp_remote_retrieve_body($feed); |
|
59 | + set_transient('give_add_ons_feed', $cache, 3600); |
|
60 | 60 | } |
61 | 61 | } else { |
62 | - $cache = '<div class="error"><p>' . esc_html__( 'There was an error retrieving the Give Add-ons list from the server. Please try again later.', 'give' ) . '</div>'; |
|
62 | + $cache = '<div class="error"><p>'.esc_html__('There was an error retrieving the Give Add-ons list from the server. Please try again later.', 'give').'</div>'; |
|
63 | 63 | } |
64 | 64 | } |
65 | 65 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -21,12 +21,12 @@ discard block |
||
21 | 21 | * @return void |
22 | 22 | */ |
23 | 23 | function give_register_dashboard_widgets() { |
24 | - if ( current_user_can( apply_filters( 'give_dashboard_stats_cap', 'view_give_reports' ) ) ) { |
|
25 | - wp_add_dashboard_widget( 'give_dashboard_sales', esc_html__( 'Give: Donation Statistics', 'give' ), 'give_dashboard_sales_widget' ); |
|
24 | + if (current_user_can(apply_filters('give_dashboard_stats_cap', 'view_give_reports'))) { |
|
25 | + wp_add_dashboard_widget('give_dashboard_sales', esc_html__('Give: Donation Statistics', 'give'), 'give_dashboard_sales_widget'); |
|
26 | 26 | } |
27 | 27 | } |
28 | 28 | |
29 | -add_action( 'wp_dashboard_setup', 'give_register_dashboard_widgets', 10 ); |
|
29 | +add_action('wp_dashboard_setup', 'give_register_dashboard_widgets', 10); |
|
30 | 30 | |
31 | 31 | /** |
32 | 32 | * Sales Summary Dashboard Widget |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | */ |
39 | 39 | function give_dashboard_sales_widget() { |
40 | 40 | |
41 | - if ( ! current_user_can( apply_filters( 'give_dashboard_stats_cap', 'view_give_reports' ) ) ) { |
|
41 | + if ( ! current_user_can(apply_filters('give_dashboard_stats_cap', 'view_give_reports'))) { |
|
42 | 42 | return; |
43 | 43 | } |
44 | 44 | $stats = new Give_Payment_Stats; ?> |
@@ -46,25 +46,25 @@ discard block |
||
46 | 46 | <div class="give-dashboard-widget"> |
47 | 47 | |
48 | 48 | <div class="give-dashboard-today give-clearfix"> |
49 | - <h3 class="give-dashboard-date-today"><?php echo date( 'F j, Y' ); ?></h3> |
|
49 | + <h3 class="give-dashboard-date-today"><?php echo date('F j, Y'); ?></h3> |
|
50 | 50 | |
51 | 51 | <p class="give-dashboard-happy-day"><?php |
52 | 52 | printf( |
53 | 53 | /* translators: %s: day of the week */ |
54 | - esc_html__( 'Happy %s!', 'give' ), |
|
55 | - date( 'l', current_time( 'timestamp' ) ) |
|
54 | + esc_html__('Happy %s!', 'give'), |
|
55 | + date('l', current_time('timestamp')) |
|
56 | 56 | ); |
57 | 57 | ?></p> |
58 | 58 | |
59 | - <?php $earnings_today = $stats->get_earnings( 0, 'today', false ); ?> |
|
59 | + <?php $earnings_today = $stats->get_earnings(0, 'today', false); ?> |
|
60 | 60 | |
61 | - <p class="give-dashboard-today-earnings"><?php echo give_currency_filter( give_format_amount( $earnings_today ) ); ?></p> |
|
61 | + <p class="give-dashboard-today-earnings"><?php echo give_currency_filter(give_format_amount($earnings_today)); ?></p> |
|
62 | 62 | |
63 | - <p class="give-orders-today"><?php $donations_today = $stats->get_sales( 0, 'today', false, array( |
|
63 | + <p class="give-orders-today"><?php $donations_today = $stats->get_sales(0, 'today', false, array( |
|
64 | 64 | 'publish', |
65 | 65 | 'revoked' |
66 | - ) ); ?><?php echo give_format_amount( $donations_today, false ); ?> |
|
67 | - <span><?php echo _x( 'donations today', 'Displays in WP admin dashboard widget after the day\'s total donations', 'give' ); ?></span> |
|
66 | + )); ?><?php echo give_format_amount($donations_today, false); ?> |
|
67 | + <span><?php echo _x('donations today', 'Displays in WP admin dashboard widget after the day\'s total donations', 'give'); ?></span> |
|
68 | 68 | </p> |
69 | 69 | |
70 | 70 | |
@@ -74,34 +74,34 @@ discard block |
||
74 | 74 | <table class="give-table-stats"> |
75 | 75 | <thead style="display: none;"> |
76 | 76 | <tr> |
77 | - <th><?php esc_html_e( 'This Week', 'give' ); ?></th> |
|
78 | - <th><?php esc_html_e( 'This Month', 'give' ); ?></th> |
|
79 | - <th><?php esc_html_e( 'Past 30 Days', 'give' ); ?></th> |
|
77 | + <th><?php esc_html_e('This Week', 'give'); ?></th> |
|
78 | + <th><?php esc_html_e('This Month', 'give'); ?></th> |
|
79 | + <th><?php esc_html_e('Past 30 Days', 'give'); ?></th> |
|
80 | 80 | </tr> |
81 | 81 | </thead> |
82 | 82 | <tbody> |
83 | 83 | <tr id="give-table-stats-tr-1"> |
84 | 84 | <td> |
85 | - <p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'this_week' ) ) ); ?></p> |
|
85 | + <p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'this_week'))); ?></p> |
|
86 | 86 | |
87 | - <p class="give-dashboard-stat-total-label"><?php esc_html_e( 'this week', 'give' ); ?></p> |
|
87 | + <p class="give-dashboard-stat-total-label"><?php esc_html_e('this week', 'give'); ?></p> |
|
88 | 88 | </td> |
89 | 89 | <td> |
90 | - <p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'this_month' ) ) ); ?></p> |
|
90 | + <p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'this_month'))); ?></p> |
|
91 | 91 | |
92 | - <p class="give-dashboard-stat-total-label"><?php esc_html_e( 'this month', 'give' ); ?></p> |
|
92 | + <p class="give-dashboard-stat-total-label"><?php esc_html_e('this month', 'give'); ?></p> |
|
93 | 93 | </td> |
94 | 94 | </tr> |
95 | 95 | <tr id="give-table-stats-tr-2"> |
96 | 96 | <td> |
97 | - <p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'last_month' ) ) ) ?></p> |
|
97 | + <p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'last_month'))) ?></p> |
|
98 | 98 | |
99 | - <p class="give-dashboard-stat-total-label"><?php esc_html_e( 'last month', 'give' ); ?></p> |
|
99 | + <p class="give-dashboard-stat-total-label"><?php esc_html_e('last month', 'give'); ?></p> |
|
100 | 100 | </td> |
101 | 101 | <td> |
102 | - <p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'this_year', false ) ) ) ?></p> |
|
102 | + <p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'this_year', false))) ?></p> |
|
103 | 103 | |
104 | - <p class="give-dashboard-stat-total-label"><?php esc_html_e( 'this year', 'give' ); ?></p> |
|
104 | + <p class="give-dashboard-stat-total-label"><?php esc_html_e('this year', 'give'); ?></p> |
|
105 | 105 | </td> |
106 | 106 | </tr> |
107 | 107 | </tbody> |
@@ -121,25 +121,25 @@ discard block |
||
121 | 121 | * |
122 | 122 | * @return array |
123 | 123 | */ |
124 | -function give_dashboard_at_a_glance_widget( $items ) { |
|
125 | - $num_posts = wp_count_posts( 'give_forms' ); |
|
124 | +function give_dashboard_at_a_glance_widget($items) { |
|
125 | + $num_posts = wp_count_posts('give_forms'); |
|
126 | 126 | |
127 | - if ( $num_posts && $num_posts->publish ) { |
|
127 | + if ($num_posts && $num_posts->publish) { |
|
128 | 128 | |
129 | 129 | $text = sprintf( |
130 | 130 | /* translators: 1: number of posts published 2: forms singular label 3: forms plural label */ |
131 | - _n( '%1$s Give %2$s', '%1$s Give %3$s', $num_posts->publish, 'give' ), |
|
131 | + _n('%1$s Give %2$s', '%1$s Give %3$s', $num_posts->publish, 'give'), |
|
132 | 132 | $num_posts->publish, |
133 | 133 | give_get_forms_label_singular(), |
134 | 134 | give_get_forms_label_plural() |
135 | 135 | ); |
136 | 136 | |
137 | - $text = sprintf( $text, number_format_i18n( $num_posts->publish ) ); |
|
137 | + $text = sprintf($text, number_format_i18n($num_posts->publish)); |
|
138 | 138 | |
139 | - if ( current_user_can( 'edit_give_forms', get_current_user_id() ) ) { |
|
140 | - $text = sprintf( '<a class="give-forms-count" href="edit.php?post_type=give_forms">%1$s</a>', $text ); |
|
139 | + if (current_user_can('edit_give_forms', get_current_user_id())) { |
|
140 | + $text = sprintf('<a class="give-forms-count" href="edit.php?post_type=give_forms">%1$s</a>', $text); |
|
141 | 141 | } else { |
142 | - $text = sprintf( '<span class="give-forms-count">%1$s</span>', $text ); |
|
142 | + $text = sprintf('<span class="give-forms-count">%1$s</span>', $text); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | $items[] = $text; |
@@ -148,4 +148,4 @@ discard block |
||
148 | 148 | return $items; |
149 | 149 | } |
150 | 150 | |
151 | -add_filter( 'dashboard_glance_items', 'give_dashboard_at_a_glance_widget', 1, 1); |
|
151 | +add_filter('dashboard_glance_items', 'give_dashboard_at_a_glance_widget', 1, 1); |
@@ -115,8 +115,8 @@ |
||
115 | 115 | |
116 | 116 | case 'num_purchases' : |
117 | 117 | $value = '<a href="' . |
118 | - admin_url( '/edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $item['email'] ) |
|
119 | - ) . '">' . esc_html__( $item['num_purchases'] ) . '</a>'; |
|
118 | + admin_url( '/edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $item['email'] ) |
|
119 | + ) . '">' . esc_html__( $item['num_purchases'] ) . '</a>'; |
|
120 | 120 | break; |
121 | 121 | |
122 | 122 | case 'amount_spent' : |
@@ -10,13 +10,13 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
17 | 17 | // Load WP_List_Table if not loaded |
18 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
19 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
18 | +if ( ! class_exists('WP_List_Table')) { |
|
19 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
@@ -62,11 +62,11 @@ discard block |
||
62 | 62 | global $status, $page; |
63 | 63 | |
64 | 64 | // Set parent defaults |
65 | - parent::__construct( array( |
|
66 | - 'singular' => esc_html__( 'Donor', 'give' ), // Singular name of the listed records |
|
67 | - 'plural' => esc_html__( 'Donors', 'give' ), // Plural name of the listed records |
|
65 | + parent::__construct(array( |
|
66 | + 'singular' => esc_html__('Donor', 'give'), // Singular name of the listed records |
|
67 | + 'plural' => esc_html__('Donors', 'give'), // Plural name of the listed records |
|
68 | 68 | 'ajax' => false // Does this table support ajax? |
69 | - ) ); |
|
69 | + )); |
|
70 | 70 | |
71 | 71 | } |
72 | 72 | |
@@ -81,20 +81,20 @@ discard block |
||
81 | 81 | * |
82 | 82 | * @return void |
83 | 83 | */ |
84 | - public function search_box( $text, $input_id ) { |
|
85 | - $input_id = $input_id . '-search-input'; |
|
84 | + public function search_box($text, $input_id) { |
|
85 | + $input_id = $input_id.'-search-input'; |
|
86 | 86 | |
87 | - if ( ! empty( $_REQUEST['orderby'] ) ) { |
|
88 | - echo '<input type="hidden" name="orderby" value="' . esc_attr__( $_REQUEST['orderby'] ) . '" />'; |
|
87 | + if ( ! empty($_REQUEST['orderby'])) { |
|
88 | + echo '<input type="hidden" name="orderby" value="'.esc_attr__($_REQUEST['orderby']).'" />'; |
|
89 | 89 | } |
90 | - if ( ! empty( $_REQUEST['order'] ) ) { |
|
91 | - echo '<input type="hidden" name="order" value="' . esc_attr__( $_REQUEST['order'] ) . '" />'; |
|
90 | + if ( ! empty($_REQUEST['order'])) { |
|
91 | + echo '<input type="hidden" name="order" value="'.esc_attr__($_REQUEST['order']).'" />'; |
|
92 | 92 | } |
93 | 93 | ?> |
94 | 94 | <p class="search-box"> |
95 | 95 | <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label> |
96 | 96 | <input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>" /> |
97 | - <?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?> |
|
97 | + <?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?> |
|
98 | 98 | </p> |
99 | 99 | <?php |
100 | 100 | } |
@@ -110,42 +110,42 @@ discard block |
||
110 | 110 | * |
111 | 111 | * @return string Column Name |
112 | 112 | */ |
113 | - public function column_default( $item, $column_name ) { |
|
114 | - switch ( $column_name ) { |
|
113 | + public function column_default($item, $column_name) { |
|
114 | + switch ($column_name) { |
|
115 | 115 | |
116 | 116 | case 'num_purchases' : |
117 | - $value = '<a href="' . |
|
118 | - admin_url( '/edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $item['email'] ) |
|
119 | - ) . '">' . esc_html__( $item['num_purchases'] ) . '</a>'; |
|
117 | + $value = '<a href="'. |
|
118 | + admin_url('/edit.php?post_type=give_forms&page=give-payment-history&user='.urlencode($item['email']) |
|
119 | + ).'">'.esc_html__($item['num_purchases']).'</a>'; |
|
120 | 120 | break; |
121 | 121 | |
122 | 122 | case 'amount_spent' : |
123 | - $value = give_currency_filter( give_format_amount( $item[ $column_name ] ) ); |
|
123 | + $value = give_currency_filter(give_format_amount($item[$column_name])); |
|
124 | 124 | break; |
125 | 125 | |
126 | 126 | case 'date_created' : |
127 | - $value = date_i18n( get_option( 'date_format' ), strtotime( $item['date_created'] ) ); |
|
127 | + $value = date_i18n(get_option('date_format'), strtotime($item['date_created'])); |
|
128 | 128 | break; |
129 | 129 | |
130 | 130 | default: |
131 | - $value = isset( $item[ $column_name ] ) ? $item[ $column_name ] : null; |
|
131 | + $value = isset($item[$column_name]) ? $item[$column_name] : null; |
|
132 | 132 | break; |
133 | 133 | } |
134 | 134 | |
135 | - return apply_filters( 'give_report_column_' . $column_name, $value, $item['id'] ); |
|
135 | + return apply_filters('give_report_column_'.$column_name, $value, $item['id']); |
|
136 | 136 | |
137 | 137 | } |
138 | 138 | |
139 | - public function column_name( $item ) { |
|
140 | - $name = '#' . $item['id'] . ' '; |
|
141 | - $name .= ! empty( $item['name'] ) ? $item['name'] : '<em>' . esc_html__( 'Unnamed Donor', 'give' ) . '</em>'; |
|
142 | - $view_url = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $item['id'] ); |
|
139 | + public function column_name($item) { |
|
140 | + $name = '#'.$item['id'].' '; |
|
141 | + $name .= ! empty($item['name']) ? $item['name'] : '<em>'.esc_html__('Unnamed Donor', 'give').'</em>'; |
|
142 | + $view_url = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$item['id']); |
|
143 | 143 | $actions = array( |
144 | - 'view' => sprintf( '<a href="%1$s">%2$s</a>', $view_url, esc_html__( 'View Donor', 'give' ) ), |
|
145 | - 'delete' => sprintf( '<a href="%1$s">%2$s</a>', admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=delete&id=' . $item['id'] ), esc_html__( 'Delete', 'give' ) ) |
|
144 | + 'view' => sprintf('<a href="%1$s">%2$s</a>', $view_url, esc_html__('View Donor', 'give')), |
|
145 | + 'delete' => sprintf('<a href="%1$s">%2$s</a>', admin_url('edit.php?post_type=give_forms&page=give-donors&view=delete&id='.$item['id']), esc_html__('Delete', 'give')) |
|
146 | 146 | ); |
147 | 147 | |
148 | - return '<a href="' . esc_url( $view_url ) . '">' . $name . '</a>' . $this->row_actions( $actions ); |
|
148 | + return '<a href="'.esc_url($view_url).'">'.$name.'</a>'.$this->row_actions($actions); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | /** |
@@ -157,14 +157,14 @@ discard block |
||
157 | 157 | */ |
158 | 158 | public function get_columns() { |
159 | 159 | $columns = array( |
160 | - 'name' => esc_html__( 'Name', 'give' ), |
|
161 | - 'email' => esc_html__( 'Email', 'give' ), |
|
162 | - 'num_purchases' => esc_html__( 'Donations', 'give' ), |
|
163 | - 'amount_spent' => esc_html__( 'Total Donated', 'give' ), |
|
164 | - 'date_created' => esc_html__( 'Date Created', 'give' ) |
|
160 | + 'name' => esc_html__('Name', 'give'), |
|
161 | + 'email' => esc_html__('Email', 'give'), |
|
162 | + 'num_purchases' => esc_html__('Donations', 'give'), |
|
163 | + 'amount_spent' => esc_html__('Total Donated', 'give'), |
|
164 | + 'date_created' => esc_html__('Date Created', 'give') |
|
165 | 165 | ); |
166 | 166 | |
167 | - return apply_filters( 'give_report_customer_columns', $columns ); |
|
167 | + return apply_filters('give_report_customer_columns', $columns); |
|
168 | 168 | |
169 | 169 | } |
170 | 170 | |
@@ -177,10 +177,10 @@ discard block |
||
177 | 177 | */ |
178 | 178 | public function get_sortable_columns() { |
179 | 179 | return array( |
180 | - 'date_created' => array( 'date_created', true ), |
|
181 | - 'name' => array( 'name', true ), |
|
182 | - 'num_purchases' => array( 'purchase_count', false ), |
|
183 | - 'amount_spent' => array( 'purchase_value', false ), |
|
180 | + 'date_created' => array('date_created', true), |
|
181 | + 'name' => array('name', true), |
|
182 | + 'num_purchases' => array('purchase_count', false), |
|
183 | + 'amount_spent' => array('purchase_value', false), |
|
184 | 184 | ); |
185 | 185 | } |
186 | 186 | |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | * @since 1.0 |
192 | 192 | * @return void |
193 | 193 | */ |
194 | - public function bulk_actions( $which = '' ) { |
|
194 | + public function bulk_actions($which = '') { |
|
195 | 195 | // These aren't really bulk actions but this outputs the markup in the right place |
196 | 196 | } |
197 | 197 | |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | * @return int Current page number |
204 | 204 | */ |
205 | 205 | public function get_paged() { |
206 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
206 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | /** |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | * @return mixed string If search is present, false otherwise |
215 | 215 | */ |
216 | 216 | public function get_search() { |
217 | - return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false; |
|
217 | + return ! empty($_GET['s']) ? urldecode(trim($_GET['s'])) : false; |
|
218 | 218 | } |
219 | 219 | |
220 | 220 | /** |
@@ -231,10 +231,10 @@ discard block |
||
231 | 231 | |
232 | 232 | $data = array(); |
233 | 233 | $paged = $this->get_paged(); |
234 | - $offset = $this->per_page * ( $paged - 1 ); |
|
234 | + $offset = $this->per_page * ($paged - 1); |
|
235 | 235 | $search = $this->get_search(); |
236 | - $order = isset( $_GET['order'] ) ? sanitize_text_field( $_GET['order'] ) : 'DESC'; |
|
237 | - $orderby = isset( $_GET['orderby'] ) ? sanitize_text_field( $_GET['orderby'] ) : 'id'; |
|
236 | + $order = isset($_GET['order']) ? sanitize_text_field($_GET['order']) : 'DESC'; |
|
237 | + $orderby = isset($_GET['orderby']) ? sanitize_text_field($_GET['orderby']) : 'id'; |
|
238 | 238 | |
239 | 239 | $args = array( |
240 | 240 | 'number' => $this->per_page, |
@@ -243,21 +243,21 @@ discard block |
||
243 | 243 | 'orderby' => $orderby |
244 | 244 | ); |
245 | 245 | |
246 | - if ( is_email( $search ) ) { |
|
246 | + if (is_email($search)) { |
|
247 | 247 | $args['email'] = $search; |
248 | - } elseif ( is_numeric( $search ) ) { |
|
248 | + } elseif (is_numeric($search)) { |
|
249 | 249 | $args['id'] = $search; |
250 | 250 | } else { |
251 | 251 | $args['name'] = $search; |
252 | 252 | } |
253 | 253 | |
254 | - $customers = Give()->customers->get_customers( $args ); |
|
254 | + $customers = Give()->customers->get_customers($args); |
|
255 | 255 | |
256 | - if ( $customers ) { |
|
256 | + if ($customers) { |
|
257 | 257 | |
258 | - foreach ( $customers as $customer ) { |
|
258 | + foreach ($customers as $customer) { |
|
259 | 259 | |
260 | - $user_id = ! empty( $customer->user_id ) ? intval( $customer->user_id ) : 0; |
|
260 | + $user_id = ! empty($customer->user_id) ? intval($customer->user_id) : 0; |
|
261 | 261 | |
262 | 262 | $data[] = array( |
263 | 263 | 'id' => $customer->id, |
@@ -291,16 +291,16 @@ discard block |
||
291 | 291 | $hidden = array(); // No hidden columns |
292 | 292 | $sortable = $this->get_sortable_columns(); |
293 | 293 | |
294 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
294 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
295 | 295 | |
296 | 296 | $this->items = $this->reports_data(); |
297 | 297 | |
298 | 298 | $this->total = give_count_total_customers(); |
299 | 299 | |
300 | - $this->set_pagination_args( array( |
|
300 | + $this->set_pagination_args(array( |
|
301 | 301 | 'total_items' => $this->total, |
302 | 302 | 'per_page' => $this->per_page, |
303 | - 'total_pages' => ceil( $this->total / $this->per_page ) |
|
304 | - ) ); |
|
303 | + 'total_pages' => ceil($this->total / $this->per_page) |
|
304 | + )); |
|
305 | 305 | } |
306 | 306 | } |
307 | 307 | \ No newline at end of file |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -23,15 +23,15 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return array $output Response messages |
25 | 25 | */ |
26 | -function give_edit_customer( $args ) { |
|
26 | +function give_edit_customer($args) { |
|
27 | 27 | |
28 | - $customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' ); |
|
28 | + $customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments'); |
|
29 | 29 | |
30 | - if ( ! is_admin() || ! current_user_can( $customer_edit_role ) ) { |
|
31 | - wp_die( esc_html__( 'You do not have permission to edit this donor.', 'give' ) ); |
|
30 | + if ( ! is_admin() || ! current_user_can($customer_edit_role)) { |
|
31 | + wp_die(esc_html__('You do not have permission to edit this donor.', 'give')); |
|
32 | 32 | } |
33 | 33 | |
34 | - if ( empty( $args ) ) { |
|
34 | + if (empty($args)) { |
|
35 | 35 | return; |
36 | 36 | } |
37 | 37 | |
@@ -39,12 +39,12 @@ discard block |
||
39 | 39 | $customer_id = (int) $args['customerinfo']['id']; |
40 | 40 | $nonce = $args['_wpnonce']; |
41 | 41 | |
42 | - if ( ! wp_verify_nonce( $nonce, 'edit-customer' ) ) { |
|
43 | - wp_die( esc_html__( 'Cheatin\' eh?!', 'give' ) ); |
|
42 | + if ( ! wp_verify_nonce($nonce, 'edit-customer')) { |
|
43 | + wp_die(esc_html__('Cheatin\' eh?!', 'give')); |
|
44 | 44 | } |
45 | 45 | |
46 | - $customer = new Give_Customer( $customer_id ); |
|
47 | - if ( empty( $customer->id ) ) { |
|
46 | + $customer = new Give_Customer($customer_id); |
|
47 | + if (empty($customer->id)) { |
|
48 | 48 | return false; |
49 | 49 | } |
50 | 50 | |
@@ -54,23 +54,23 @@ discard block |
||
54 | 54 | 'user_id' => 0 |
55 | 55 | ); |
56 | 56 | |
57 | - $customer_info = wp_parse_args( $customer_info, $defaults ); |
|
57 | + $customer_info = wp_parse_args($customer_info, $defaults); |
|
58 | 58 | |
59 | - if ( ! is_email( $customer_info['email'] ) ) { |
|
60 | - give_set_error( 'give-invalid-email', esc_html__( 'Please enter a valid email address.', 'give' ) ); |
|
59 | + if ( ! is_email($customer_info['email'])) { |
|
60 | + give_set_error('give-invalid-email', esc_html__('Please enter a valid email address.', 'give')); |
|
61 | 61 | } |
62 | 62 | |
63 | - if ( (int) $customer_info['user_id'] != (int) $customer->user_id ) { |
|
63 | + if ((int) $customer_info['user_id'] != (int) $customer->user_id) { |
|
64 | 64 | |
65 | 65 | // Make sure we don't already have this user attached to a customer |
66 | - if ( ! empty( $customer_info['user_id'] ) && false !== Give()->customers->get_customer_by( 'user_id', $customer_info['user_id'] ) ) { |
|
67 | - give_set_error( 'give-invalid-customer-user_id', sprintf( esc_html__( 'The User ID %d is already associated with a different donor.', 'give' ), $customer_info['user_id'] ) ); |
|
66 | + if ( ! empty($customer_info['user_id']) && false !== Give()->customers->get_customer_by('user_id', $customer_info['user_id'])) { |
|
67 | + give_set_error('give-invalid-customer-user_id', sprintf(esc_html__('The User ID %d is already associated with a different donor.', 'give'), $customer_info['user_id'])); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | // Make sure it's actually a user |
71 | - $user = get_user_by( 'id', $customer_info['user_id'] ); |
|
72 | - if ( ! empty( $customer_info['user_id'] ) && false === $user ) { |
|
73 | - give_set_error( 'give-invalid-user_id', sprintf( esc_html__( 'The User ID %d does not exist. Please assign an existing user.', 'give' ), $customer_info['user_id'] ) ); |
|
71 | + $user = get_user_by('id', $customer_info['user_id']); |
|
72 | + if ( ! empty($customer_info['user_id']) && false === $user) { |
|
73 | + give_set_error('give-invalid-user_id', sprintf(esc_html__('The User ID %d does not exist. Please assign an existing user.', 'give'), $customer_info['user_id'])); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | } |
@@ -78,82 +78,82 @@ discard block |
||
78 | 78 | // Record this for later |
79 | 79 | $previous_user_id = $customer->user_id; |
80 | 80 | |
81 | - if ( give_get_errors() ) { |
|
81 | + if (give_get_errors()) { |
|
82 | 82 | return; |
83 | 83 | } |
84 | 84 | |
85 | 85 | // Setup the customer address, if present |
86 | 86 | $address = array(); |
87 | - if ( intval( $customer_info['user_id'] ) > 0 ) { |
|
87 | + if (intval($customer_info['user_id']) > 0) { |
|
88 | 88 | |
89 | - $current_address = get_user_meta( $customer_info['user_id'], '_give_user_address', true ); |
|
89 | + $current_address = get_user_meta($customer_info['user_id'], '_give_user_address', true); |
|
90 | 90 | |
91 | - if ( false === $current_address ) { |
|
92 | - $address['line1'] = isset( $customer_info['line1'] ) ? $customer_info['line1'] : ''; |
|
93 | - $address['line2'] = isset( $customer_info['line2'] ) ? $customer_info['line2'] : ''; |
|
94 | - $address['city'] = isset( $customer_info['city'] ) ? $customer_info['city'] : ''; |
|
95 | - $address['country'] = isset( $customer_info['country'] ) ? $customer_info['country'] : ''; |
|
96 | - $address['zip'] = isset( $customer_info['zip'] ) ? $customer_info['zip'] : ''; |
|
97 | - $address['state'] = isset( $customer_info['state'] ) ? $customer_info['state'] : ''; |
|
91 | + if (false === $current_address) { |
|
92 | + $address['line1'] = isset($customer_info['line1']) ? $customer_info['line1'] : ''; |
|
93 | + $address['line2'] = isset($customer_info['line2']) ? $customer_info['line2'] : ''; |
|
94 | + $address['city'] = isset($customer_info['city']) ? $customer_info['city'] : ''; |
|
95 | + $address['country'] = isset($customer_info['country']) ? $customer_info['country'] : ''; |
|
96 | + $address['zip'] = isset($customer_info['zip']) ? $customer_info['zip'] : ''; |
|
97 | + $address['state'] = isset($customer_info['state']) ? $customer_info['state'] : ''; |
|
98 | 98 | } else { |
99 | - $current_address = wp_parse_args( $current_address, array( |
|
99 | + $current_address = wp_parse_args($current_address, array( |
|
100 | 100 | 'line1', |
101 | 101 | 'line2', |
102 | 102 | 'city', |
103 | 103 | 'zip', |
104 | 104 | 'state', |
105 | 105 | 'country' |
106 | - ) ); |
|
107 | - $address['line1'] = isset( $customer_info['line1'] ) ? $customer_info['line1'] : $current_address['line1']; |
|
108 | - $address['line2'] = isset( $customer_info['line2'] ) ? $customer_info['line2'] : $current_address['line2']; |
|
109 | - $address['city'] = isset( $customer_info['city'] ) ? $customer_info['city'] : $current_address['city']; |
|
110 | - $address['country'] = isset( $customer_info['country'] ) ? $customer_info['country'] : $current_address['country']; |
|
111 | - $address['zip'] = isset( $customer_info['zip'] ) ? $customer_info['zip'] : $current_address['zip']; |
|
112 | - $address['state'] = isset( $customer_info['state'] ) ? $customer_info['state'] : $current_address['state']; |
|
106 | + )); |
|
107 | + $address['line1'] = isset($customer_info['line1']) ? $customer_info['line1'] : $current_address['line1']; |
|
108 | + $address['line2'] = isset($customer_info['line2']) ? $customer_info['line2'] : $current_address['line2']; |
|
109 | + $address['city'] = isset($customer_info['city']) ? $customer_info['city'] : $current_address['city']; |
|
110 | + $address['country'] = isset($customer_info['country']) ? $customer_info['country'] : $current_address['country']; |
|
111 | + $address['zip'] = isset($customer_info['zip']) ? $customer_info['zip'] : $current_address['zip']; |
|
112 | + $address['state'] = isset($customer_info['state']) ? $customer_info['state'] : $current_address['state']; |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | } |
116 | 116 | |
117 | 117 | // Sanitize the inputs |
118 | 118 | $customer_data = array(); |
119 | - $customer_data['name'] = strip_tags( stripslashes( $customer_info['name'] ) ); |
|
119 | + $customer_data['name'] = strip_tags(stripslashes($customer_info['name'])); |
|
120 | 120 | $customer_data['email'] = $customer_info['email']; |
121 | 121 | $customer_data['user_id'] = $customer_info['user_id']; |
122 | 122 | |
123 | - $customer_data = apply_filters( 'give_edit_customer_info', $customer_data, $customer_id ); |
|
124 | - $address = apply_filters( 'give_edit_customer_address', $address, $customer_id ); |
|
123 | + $customer_data = apply_filters('give_edit_customer_info', $customer_data, $customer_id); |
|
124 | + $address = apply_filters('give_edit_customer_address', $address, $customer_id); |
|
125 | 125 | |
126 | - $customer_data = array_map( 'sanitize_text_field', $customer_data ); |
|
127 | - $address = array_map( 'sanitize_text_field', $address ); |
|
126 | + $customer_data = array_map('sanitize_text_field', $customer_data); |
|
127 | + $address = array_map('sanitize_text_field', $address); |
|
128 | 128 | |
129 | - do_action( 'give_pre_edit_customer', $customer_id, $customer_data, $address ); |
|
129 | + do_action('give_pre_edit_customer', $customer_id, $customer_data, $address); |
|
130 | 130 | |
131 | 131 | $output = array(); |
132 | 132 | $previous_email = $customer->email; |
133 | 133 | |
134 | - if ( $customer->update( $customer_data ) ) { |
|
134 | + if ($customer->update($customer_data)) { |
|
135 | 135 | |
136 | - if ( ! empty( $customer->user_id ) && $customer->user_id > 0 ) { |
|
137 | - update_user_meta( $customer->user_id, '_give_user_address', $address ); |
|
136 | + if ( ! empty($customer->user_id) && $customer->user_id > 0) { |
|
137 | + update_user_meta($customer->user_id, '_give_user_address', $address); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | // Update some payment meta if we need to |
141 | - $payments_array = explode( ',', $customer->payment_ids ); |
|
141 | + $payments_array = explode(',', $customer->payment_ids); |
|
142 | 142 | |
143 | - if ( $customer->email != $previous_email ) { |
|
144 | - foreach ( $payments_array as $payment_id ) { |
|
145 | - give_update_payment_meta( $payment_id, 'email', $customer->email ); |
|
143 | + if ($customer->email != $previous_email) { |
|
144 | + foreach ($payments_array as $payment_id) { |
|
145 | + give_update_payment_meta($payment_id, 'email', $customer->email); |
|
146 | 146 | } |
147 | 147 | } |
148 | 148 | |
149 | - if ( $customer->user_id != $previous_user_id ) { |
|
150 | - foreach ( $payments_array as $payment_id ) { |
|
151 | - give_update_payment_meta( $payment_id, '_give_payment_user_id', $customer->user_id ); |
|
149 | + if ($customer->user_id != $previous_user_id) { |
|
150 | + foreach ($payments_array as $payment_id) { |
|
151 | + give_update_payment_meta($payment_id, '_give_payment_user_id', $customer->user_id); |
|
152 | 152 | } |
153 | 153 | } |
154 | 154 | |
155 | 155 | $output['success'] = true; |
156 | - $customer_data = array_merge( $customer_data, $address ); |
|
156 | + $customer_data = array_merge($customer_data, $address); |
|
157 | 157 | $output['customer_info'] = $customer_data; |
158 | 158 | |
159 | 159 | } else { |
@@ -162,11 +162,11 @@ discard block |
||
162 | 162 | |
163 | 163 | } |
164 | 164 | |
165 | - do_action( 'give_post_edit_customer', $customer_id, $customer_data ); |
|
165 | + do_action('give_post_edit_customer', $customer_id, $customer_data); |
|
166 | 166 | |
167 | - if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
|
168 | - header( 'Content-Type: application/json' ); |
|
169 | - echo json_encode( $output ); |
|
167 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
168 | + header('Content-Type: application/json'); |
|
169 | + echo json_encode($output); |
|
170 | 170 | wp_die(); |
171 | 171 | } |
172 | 172 | |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | |
175 | 175 | } |
176 | 176 | |
177 | -add_action( 'give_edit-customer', 'give_edit_customer', 10, 1 ); |
|
177 | +add_action('give_edit-customer', 'give_edit_customer', 10, 1); |
|
178 | 178 | |
179 | 179 | /** |
180 | 180 | * Save a customer note being added |
@@ -185,53 +185,53 @@ discard block |
||
185 | 185 | * |
186 | 186 | * @return int The Note ID that was saved, or 0 if nothing was saved |
187 | 187 | */ |
188 | -function give_customer_save_note( $args ) { |
|
188 | +function give_customer_save_note($args) { |
|
189 | 189 | |
190 | - $customer_view_role = apply_filters( 'give_view_customers_role', 'view_give_reports' ); |
|
190 | + $customer_view_role = apply_filters('give_view_customers_role', 'view_give_reports'); |
|
191 | 191 | |
192 | - if ( ! is_admin() || ! current_user_can( $customer_view_role ) ) { |
|
193 | - wp_die( esc_html__( 'You do not have permission to edit this donor.', 'give' ) ); |
|
192 | + if ( ! is_admin() || ! current_user_can($customer_view_role)) { |
|
193 | + wp_die(esc_html__('You do not have permission to edit this donor.', 'give')); |
|
194 | 194 | } |
195 | 195 | |
196 | - if ( empty( $args ) ) { |
|
196 | + if (empty($args)) { |
|
197 | 197 | return; |
198 | 198 | } |
199 | 199 | |
200 | - $customer_note = trim( sanitize_text_field( $args['customer_note'] ) ); |
|
200 | + $customer_note = trim(sanitize_text_field($args['customer_note'])); |
|
201 | 201 | $customer_id = (int) $args['customer_id']; |
202 | 202 | $nonce = $args['add_customer_note_nonce']; |
203 | 203 | |
204 | - if ( ! wp_verify_nonce( $nonce, 'add-customer-note' ) ) { |
|
205 | - wp_die( esc_html__( 'Cheatin\' eh?!', 'give' ) ); |
|
204 | + if ( ! wp_verify_nonce($nonce, 'add-customer-note')) { |
|
205 | + wp_die(esc_html__('Cheatin\' eh?!', 'give')); |
|
206 | 206 | } |
207 | 207 | |
208 | - if ( empty( $customer_note ) ) { |
|
209 | - give_set_error( 'empty-customer-note', esc_html__( 'A note is required.', 'give' ) ); |
|
208 | + if (empty($customer_note)) { |
|
209 | + give_set_error('empty-customer-note', esc_html__('A note is required.', 'give')); |
|
210 | 210 | } |
211 | 211 | |
212 | - if ( give_get_errors() ) { |
|
212 | + if (give_get_errors()) { |
|
213 | 213 | return; |
214 | 214 | } |
215 | 215 | |
216 | - $customer = new Give_Customer( $customer_id ); |
|
217 | - $new_note = $customer->add_note( $customer_note ); |
|
216 | + $customer = new Give_Customer($customer_id); |
|
217 | + $new_note = $customer->add_note($customer_note); |
|
218 | 218 | |
219 | - do_action( 'give_pre_insert_customer_note', $customer_id, $new_note ); |
|
219 | + do_action('give_pre_insert_customer_note', $customer_id, $new_note); |
|
220 | 220 | |
221 | - if ( ! empty( $new_note ) && ! empty( $customer->id ) ) { |
|
221 | + if ( ! empty($new_note) && ! empty($customer->id)) { |
|
222 | 222 | |
223 | 223 | ob_start(); |
224 | 224 | ?> |
225 | 225 | <div class="customer-note-wrapper dashboard-comment-wrap comment-item"> |
226 | 226 | <span class="note-content-wrap"> |
227 | - <?php echo stripslashes( $new_note ); ?> |
|
227 | + <?php echo stripslashes($new_note); ?> |
|
228 | 228 | </span> |
229 | 229 | </div> |
230 | 230 | <?php |
231 | 231 | $output = ob_get_contents(); |
232 | 232 | ob_end_clean(); |
233 | 233 | |
234 | - if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
|
234 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
235 | 235 | echo $output; |
236 | 236 | exit; |
237 | 237 | } |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | |
245 | 245 | } |
246 | 246 | |
247 | -add_action( 'give_add-customer-note', 'give_customer_save_note', 10, 1 ); |
|
247 | +add_action('give_add-customer-note', 'give_customer_save_note', 10, 1); |
|
248 | 248 | |
249 | 249 | /** |
250 | 250 | * Delete a customer |
@@ -255,87 +255,87 @@ discard block |
||
255 | 255 | * |
256 | 256 | * @return int Whether it was a successful deletion |
257 | 257 | */ |
258 | -function give_customer_delete( $args ) { |
|
258 | +function give_customer_delete($args) { |
|
259 | 259 | |
260 | - $customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' ); |
|
260 | + $customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments'); |
|
261 | 261 | |
262 | - if ( ! is_admin() || ! current_user_can( $customer_edit_role ) ) { |
|
263 | - wp_die( esc_html__( 'You do not have permission to delete donors.', 'give' ) ); |
|
262 | + if ( ! is_admin() || ! current_user_can($customer_edit_role)) { |
|
263 | + wp_die(esc_html__('You do not have permission to delete donors.', 'give')); |
|
264 | 264 | } |
265 | 265 | |
266 | - if ( empty( $args ) ) { |
|
266 | + if (empty($args)) { |
|
267 | 267 | return; |
268 | 268 | } |
269 | 269 | |
270 | 270 | $customer_id = (int) $args['customer_id']; |
271 | - $confirm = ! empty( $args['give-customer-delete-confirm'] ) ? true : false; |
|
272 | - $remove_data = ! empty( $args['give-customer-delete-records'] ) ? true : false; |
|
271 | + $confirm = ! empty($args['give-customer-delete-confirm']) ? true : false; |
|
272 | + $remove_data = ! empty($args['give-customer-delete-records']) ? true : false; |
|
273 | 273 | $nonce = $args['_wpnonce']; |
274 | 274 | |
275 | - if ( ! wp_verify_nonce( $nonce, 'delete-customer' ) ) { |
|
276 | - wp_die( esc_html__( 'Cheatin\' eh?!', 'give' ) ); |
|
275 | + if ( ! wp_verify_nonce($nonce, 'delete-customer')) { |
|
276 | + wp_die(esc_html__('Cheatin\' eh?!', 'give')); |
|
277 | 277 | } |
278 | 278 | |
279 | - if ( ! $confirm ) { |
|
280 | - give_set_error( 'customer-delete-no-confirm', esc_html__( 'Please confirm you want to delete this donor.', 'give' ) ); |
|
279 | + if ( ! $confirm) { |
|
280 | + give_set_error('customer-delete-no-confirm', esc_html__('Please confirm you want to delete this donor.', 'give')); |
|
281 | 281 | } |
282 | 282 | |
283 | - if ( give_get_errors() ) { |
|
284 | - wp_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer_id ) ); |
|
283 | + if (give_get_errors()) { |
|
284 | + wp_redirect(admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer_id)); |
|
285 | 285 | exit; |
286 | 286 | } |
287 | 287 | |
288 | - $customer = new Give_Customer( $customer_id ); |
|
288 | + $customer = new Give_Customer($customer_id); |
|
289 | 289 | |
290 | - do_action( 'give_pre_delete_customer', $customer_id, $confirm, $remove_data ); |
|
290 | + do_action('give_pre_delete_customer', $customer_id, $confirm, $remove_data); |
|
291 | 291 | |
292 | 292 | $success = false; |
293 | 293 | |
294 | - if ( $customer->id > 0 ) { |
|
294 | + if ($customer->id > 0) { |
|
295 | 295 | |
296 | - $payments_array = explode( ',', $customer->payment_ids ); |
|
297 | - $success = Give()->customers->delete( $customer->id ); |
|
296 | + $payments_array = explode(',', $customer->payment_ids); |
|
297 | + $success = Give()->customers->delete($customer->id); |
|
298 | 298 | |
299 | - if ( $success ) { |
|
299 | + if ($success) { |
|
300 | 300 | |
301 | - if ( $remove_data ) { |
|
301 | + if ($remove_data) { |
|
302 | 302 | |
303 | 303 | // Remove all payments, logs, etc |
304 | - foreach ( $payments_array as $payment_id ) { |
|
305 | - give_delete_purchase( $payment_id ); |
|
304 | + foreach ($payments_array as $payment_id) { |
|
305 | + give_delete_purchase($payment_id); |
|
306 | 306 | } |
307 | 307 | |
308 | 308 | } else { |
309 | 309 | |
310 | 310 | // Just set the payments to customer_id of 0 |
311 | - foreach ( $payments_array as $payment_id ) { |
|
312 | - give_update_payment_meta( $payment_id, '_give_payment_customer_id', 0 ); |
|
311 | + foreach ($payments_array as $payment_id) { |
|
312 | + give_update_payment_meta($payment_id, '_give_payment_customer_id', 0); |
|
313 | 313 | } |
314 | 314 | |
315 | 315 | } |
316 | 316 | |
317 | - $redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors&give-message=customer-deleted' ); |
|
317 | + $redirect = admin_url('edit.php?post_type=give_forms&page=give-donors&give-message=customer-deleted'); |
|
318 | 318 | |
319 | 319 | } else { |
320 | 320 | |
321 | - give_set_error( 'give-donor-delete-failed', esc_html__( 'Error deleting donor.', 'give' ) ); |
|
322 | - $redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=delete&id=' . $customer_id ); |
|
321 | + give_set_error('give-donor-delete-failed', esc_html__('Error deleting donor.', 'give')); |
|
322 | + $redirect = admin_url('edit.php?post_type=give_forms&page=give-donors&view=delete&id='.$customer_id); |
|
323 | 323 | |
324 | 324 | } |
325 | 325 | |
326 | 326 | } else { |
327 | 327 | |
328 | - give_set_error( 'give-customer-delete-invalid-id', esc_html__( 'Invalid Donor ID.', 'give' ) ); |
|
329 | - $redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors' ); |
|
328 | + give_set_error('give-customer-delete-invalid-id', esc_html__('Invalid Donor ID.', 'give')); |
|
329 | + $redirect = admin_url('edit.php?post_type=give_forms&page=give-donors'); |
|
330 | 330 | |
331 | 331 | } |
332 | 332 | |
333 | - wp_redirect( $redirect ); |
|
333 | + wp_redirect($redirect); |
|
334 | 334 | exit; |
335 | 335 | |
336 | 336 | } |
337 | 337 | |
338 | -add_action( 'give_delete-customer', 'give_customer_delete', 10, 1 ); |
|
338 | +add_action('give_delete-customer', 'give_customer_delete', 10, 1); |
|
339 | 339 | |
340 | 340 | /** |
341 | 341 | * Disconnect a user ID from a donor |
@@ -346,39 +346,39 @@ discard block |
||
346 | 346 | * |
347 | 347 | * @return bool If the disconnect was successful |
348 | 348 | */ |
349 | -function give_disconnect_customer_user_id( $args ) { |
|
349 | +function give_disconnect_customer_user_id($args) { |
|
350 | 350 | |
351 | - $customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' ); |
|
351 | + $customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments'); |
|
352 | 352 | |
353 | - if ( ! is_admin() || ! current_user_can( $customer_edit_role ) ) { |
|
354 | - wp_die( esc_html__( 'You do not have permission to edit this donor.', 'give' ) ); |
|
353 | + if ( ! is_admin() || ! current_user_can($customer_edit_role)) { |
|
354 | + wp_die(esc_html__('You do not have permission to edit this donor.', 'give')); |
|
355 | 355 | } |
356 | 356 | |
357 | - if ( empty( $args ) ) { |
|
357 | + if (empty($args)) { |
|
358 | 358 | return; |
359 | 359 | } |
360 | 360 | |
361 | 361 | $customer_id = (int) $args['customer_id']; |
362 | 362 | $nonce = $args['_wpnonce']; |
363 | 363 | |
364 | - if ( ! wp_verify_nonce( $nonce, 'edit-customer' ) ) { |
|
365 | - wp_die( esc_html__( 'Cheatin\' eh?!', 'give' ) ); |
|
364 | + if ( ! wp_verify_nonce($nonce, 'edit-customer')) { |
|
365 | + wp_die(esc_html__('Cheatin\' eh?!', 'give')); |
|
366 | 366 | } |
367 | 367 | |
368 | - $customer = new Give_Customer( $customer_id ); |
|
369 | - if ( empty( $customer->id ) ) { |
|
368 | + $customer = new Give_Customer($customer_id); |
|
369 | + if (empty($customer->id)) { |
|
370 | 370 | return false; |
371 | 371 | } |
372 | 372 | |
373 | - do_action( 'give_pre_customer_disconnect_user_id', $customer_id, $customer->user_id ); |
|
373 | + do_action('give_pre_customer_disconnect_user_id', $customer_id, $customer->user_id); |
|
374 | 374 | |
375 | - $customer_args = array( 'user_id' => 0 ); |
|
375 | + $customer_args = array('user_id' => 0); |
|
376 | 376 | |
377 | - if ( $customer->update( $customer_args ) ) { |
|
377 | + if ($customer->update($customer_args)) { |
|
378 | 378 | global $wpdb; |
379 | 379 | |
380 | - if ( ! empty( $customer->payment_ids ) ) { |
|
381 | - $wpdb->query( "UPDATE $wpdb->postmeta SET meta_value = 0 WHERE meta_key = '_give_payment_user_id' AND post_id IN ( $customer->payment_ids )" ); |
|
380 | + if ( ! empty($customer->payment_ids)) { |
|
381 | + $wpdb->query("UPDATE $wpdb->postmeta SET meta_value = 0 WHERE meta_key = '_give_payment_user_id' AND post_id IN ( $customer->payment_ids )"); |
|
382 | 382 | } |
383 | 383 | |
384 | 384 | $output['success'] = true; |
@@ -386,14 +386,14 @@ discard block |
||
386 | 386 | } else { |
387 | 387 | |
388 | 388 | $output['success'] = false; |
389 | - give_set_error( 'give-disconnect-user-fail', esc_html__( 'Failed to disconnect user from donor.', 'give' ) ); |
|
389 | + give_set_error('give-disconnect-user-fail', esc_html__('Failed to disconnect user from donor.', 'give')); |
|
390 | 390 | } |
391 | 391 | |
392 | - do_action( 'give_post_customer_disconnect_user_id', $customer_id ); |
|
392 | + do_action('give_post_customer_disconnect_user_id', $customer_id); |
|
393 | 393 | |
394 | - if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
|
395 | - header( 'Content-Type: application/json' ); |
|
396 | - echo json_encode( $output ); |
|
394 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
395 | + header('Content-Type: application/json'); |
|
396 | + echo json_encode($output); |
|
397 | 397 | wp_die(); |
398 | 398 | } |
399 | 399 | |
@@ -401,4 +401,4 @@ discard block |
||
401 | 401 | |
402 | 402 | } |
403 | 403 | |
404 | -add_action( 'give_disconnect-userid', 'give_disconnect_customer_user_id', 10, 1 ); |
|
404 | +add_action('give_disconnect-userid', 'give_disconnect_customer_user_id', 10, 1); |