@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if accessed directly. |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
@@ -62,26 +62,26 @@ discard block |
||
62 | 62 | * |
63 | 63 | * @param array $request The Form Data passed into the batch processing |
64 | 64 | */ |
65 | - public function set_properties( $request ) { |
|
65 | + public function set_properties($request) { |
|
66 | 66 | |
67 | 67 | // Set data from form submission |
68 | - if ( isset( $_POST['form'] ) ) { |
|
69 | - parse_str( $_POST['form'], $this->data ); |
|
68 | + if (isset($_POST['form'])) { |
|
69 | + parse_str($_POST['form'], $this->data); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | $this->form = $this->data['forms']; |
73 | 73 | |
74 | 74 | // Setup donor ids cache. |
75 | - if( ! empty( $this->form ) ) { |
|
75 | + if ( ! empty($this->form)) { |
|
76 | 76 | // Cache donor ids to output unique list of donor. |
77 | - $this->query_id = give_clean( $_REQUEST['give_export_option']['query_id'] ); |
|
78 | - if( ! ( $this->donor_ids = Give_Cache::get( $this->query_id, true ) ) ) { |
|
77 | + $this->query_id = give_clean($_REQUEST['give_export_option']['query_id']); |
|
78 | + if ( ! ($this->donor_ids = Give_Cache::get($this->query_id, true))) { |
|
79 | 79 | $this->donor_ids = array(); |
80 | - Give_Cache::set( $this->query_id, $this->donor_ids, HOUR_IN_SECONDS, true ); |
|
80 | + Give_Cache::set($this->query_id, $this->donor_ids, HOUR_IN_SECONDS, true); |
|
81 | 81 | } |
82 | 82 | } |
83 | 83 | |
84 | - $this->price_id = ! empty( $request['give_price_option'] ) && 'all' !== $request['give_price_option'] ? absint( $request['give_price_option'] ) : null; |
|
84 | + $this->price_id = ! empty($request['give_price_option']) && 'all' !== $request['give_price_option'] ? absint($request['give_price_option']) : null; |
|
85 | 85 | |
86 | 86 | } |
87 | 87 | |
@@ -94,14 +94,14 @@ discard block |
||
94 | 94 | */ |
95 | 95 | public function csv_cols() { |
96 | 96 | |
97 | - $columns = isset( $this->data['give_export_option'] ) ? $this->data['give_export_option'] : array(); |
|
97 | + $columns = isset($this->data['give_export_option']) ? $this->data['give_export_option'] : array(); |
|
98 | 98 | |
99 | 99 | // We need columns. |
100 | - if ( empty( $columns ) ) { |
|
100 | + if (empty($columns)) { |
|
101 | 101 | return false; |
102 | 102 | } |
103 | 103 | |
104 | - $cols = $this->get_cols( $columns ); |
|
104 | + $cols = $this->get_cols($columns); |
|
105 | 105 | |
106 | 106 | return $cols; |
107 | 107 | } |
@@ -113,38 +113,38 @@ discard block |
||
113 | 113 | * |
114 | 114 | * @return array |
115 | 115 | */ |
116 | - private function get_cols( $columns ) { |
|
116 | + private function get_cols($columns) { |
|
117 | 117 | |
118 | 118 | $cols = array(); |
119 | 119 | |
120 | - foreach ( $columns as $key => $value ) { |
|
120 | + foreach ($columns as $key => $value) { |
|
121 | 121 | |
122 | - switch ( $key ) { |
|
122 | + switch ($key) { |
|
123 | 123 | case 'full_name' : |
124 | - $cols['full_name'] = esc_html__( 'Full Name', 'give' ); |
|
124 | + $cols['full_name'] = esc_html__('Full Name', 'give'); |
|
125 | 125 | break; |
126 | 126 | case 'email' : |
127 | - $cols['email'] = esc_html__( 'Email Address', 'give' ); |
|
127 | + $cols['email'] = esc_html__('Email Address', 'give'); |
|
128 | 128 | break; |
129 | 129 | case 'address' : |
130 | - $cols['address_line1'] = esc_html__( 'Address', 'give' ); |
|
131 | - $cols['address_line2'] = esc_html__( 'Address 2', 'give' ); |
|
132 | - $cols['address_city'] = esc_html__( 'City', 'give' ); |
|
133 | - $cols['address_state'] = esc_html__( 'State', 'give' ); |
|
134 | - $cols['address_zip'] = esc_html__( 'Zip', 'give' ); |
|
135 | - $cols['address_country'] = esc_html__( 'Country', 'give' ); |
|
130 | + $cols['address_line1'] = esc_html__('Address', 'give'); |
|
131 | + $cols['address_line2'] = esc_html__('Address 2', 'give'); |
|
132 | + $cols['address_city'] = esc_html__('City', 'give'); |
|
133 | + $cols['address_state'] = esc_html__('State', 'give'); |
|
134 | + $cols['address_zip'] = esc_html__('Zip', 'give'); |
|
135 | + $cols['address_country'] = esc_html__('Country', 'give'); |
|
136 | 136 | break; |
137 | 137 | case 'userid' : |
138 | - $cols['userid'] = esc_html__( 'User ID', 'give' ); |
|
138 | + $cols['userid'] = esc_html__('User ID', 'give'); |
|
139 | 139 | break; |
140 | 140 | case 'date_first_donated' : |
141 | - $cols['date_first_donated'] = esc_html__( 'First Donation Date', 'give' ); |
|
141 | + $cols['date_first_donated'] = esc_html__('First Donation Date', 'give'); |
|
142 | 142 | break; |
143 | 143 | case 'donations' : |
144 | - $cols['donations'] = esc_html__( 'Number of Donations', 'give' ); |
|
144 | + $cols['donations'] = esc_html__('Number of Donations', 'give'); |
|
145 | 145 | break; |
146 | 146 | case 'donation_sum' : |
147 | - $cols['donation_sum'] = esc_html__( 'Sum of Donations', 'give' ); |
|
147 | + $cols['donation_sum'] = esc_html__('Sum of Donations', 'give'); |
|
148 | 148 | break; |
149 | 149 | } |
150 | 150 | } |
@@ -167,20 +167,20 @@ discard block |
||
167 | 167 | |
168 | 168 | $i = 0; |
169 | 169 | |
170 | - if ( ! empty( $this->form ) ) { |
|
170 | + if ( ! empty($this->form)) { |
|
171 | 171 | |
172 | 172 | // Export donors of a specific product |
173 | 173 | global $give_logs; |
174 | 174 | |
175 | 175 | $args = array( |
176 | - 'post_parent' => absint( $this->form ), |
|
176 | + 'post_parent' => absint($this->form), |
|
177 | 177 | 'log_type' => 'sale', |
178 | 178 | 'posts_per_page' => 30, |
179 | 179 | 'paged' => $this->step, |
180 | 180 | ); |
181 | 181 | |
182 | 182 | // Check for price option |
183 | - if ( null !== $this->price_id ) { |
|
183 | + if (null !== $this->price_id) { |
|
184 | 184 | $args['meta_query'] = array( |
185 | 185 | array( |
186 | 186 | 'key' => '_give_log_price_id', |
@@ -189,44 +189,44 @@ discard block |
||
189 | 189 | ); |
190 | 190 | } |
191 | 191 | |
192 | - $logs = $give_logs->get_connected_logs( $args ); |
|
192 | + $logs = $give_logs->get_connected_logs($args); |
|
193 | 193 | |
194 | - if ( $logs ) { |
|
195 | - foreach ( $logs as $log ) { |
|
196 | - $payment_id = give_get_meta( $log->ID, '_give_log_payment_id', true ); |
|
197 | - $payment = new Give_Payment( $payment_id ); |
|
194 | + if ($logs) { |
|
195 | + foreach ($logs as $log) { |
|
196 | + $payment_id = give_get_meta($log->ID, '_give_log_payment_id', true); |
|
197 | + $payment = new Give_Payment($payment_id); |
|
198 | 198 | |
199 | 199 | // Continue if donor already included. |
200 | - if( in_array( $payment->customer_id , $this->donor_ids ) ) { |
|
200 | + if (in_array($payment->customer_id, $this->donor_ids)) { |
|
201 | 201 | continue; |
202 | 202 | } |
203 | 203 | |
204 | 204 | $this->donor_ids[] = $payment->customer_id; |
205 | 205 | |
206 | - $donor = Give()->customers->get_customer_by( 'id', $payment->customer_id ); |
|
207 | - $data[] = $this->set_donor_data( $i, $data, $donor ); |
|
208 | - $i ++; |
|
206 | + $donor = Give()->customers->get_customer_by('id', $payment->customer_id); |
|
207 | + $data[] = $this->set_donor_data($i, $data, $donor); |
|
208 | + $i++; |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | // Cache donor ids only if admin export donor for specific form. |
212 | - Give_Cache::set( $this->query_id, array_unique( $this->donor_ids ), HOUR_IN_SECONDS, true ); |
|
212 | + Give_Cache::set($this->query_id, array_unique($this->donor_ids), HOUR_IN_SECONDS, true); |
|
213 | 213 | } |
214 | 214 | } else { |
215 | 215 | |
216 | 216 | // Export all donors. |
217 | - $offset = 30 * ( $this->step - 1 ); |
|
218 | - $donors = Give()->customers->get_customers( array( 'number' => 30, 'offset' => $offset ) ); |
|
217 | + $offset = 30 * ($this->step - 1); |
|
218 | + $donors = Give()->customers->get_customers(array('number' => 30, 'offset' => $offset)); |
|
219 | 219 | |
220 | - foreach ( $donors as $donor ) { |
|
220 | + foreach ($donors as $donor) { |
|
221 | 221 | |
222 | - $data[] = $this->set_donor_data( $i, $data, $donor ); |
|
223 | - $i ++; |
|
222 | + $data[] = $this->set_donor_data($i, $data, $donor); |
|
223 | + $i++; |
|
224 | 224 | } |
225 | 225 | } |
226 | 226 | |
227 | 227 | |
228 | - $data = apply_filters( 'give_export_get_data', $data ); |
|
229 | - $data = apply_filters( "give_export_get_data_{$this->export_type}", $data ); |
|
228 | + $data = apply_filters('give_export_get_data', $data); |
|
229 | + $data = apply_filters("give_export_get_data_{$this->export_type}", $data); |
|
230 | 230 | |
231 | 231 | return $data; |
232 | 232 | } |
@@ -242,18 +242,18 @@ discard block |
||
242 | 242 | $percentage = 0; |
243 | 243 | |
244 | 244 | // We can't count the number when getting them for a specific form |
245 | - if ( empty( $this->form ) ) { |
|
245 | + if (empty($this->form)) { |
|
246 | 246 | |
247 | 247 | $total = Give()->customers->count(); |
248 | 248 | |
249 | - if ( $total > 0 ) { |
|
249 | + if ($total > 0) { |
|
250 | 250 | |
251 | - $percentage = ( ( 30 * $this->step ) / $total ) * 100; |
|
251 | + $percentage = ((30 * $this->step) / $total) * 100; |
|
252 | 252 | |
253 | 253 | } |
254 | 254 | } |
255 | 255 | |
256 | - if ( $percentage > 100 ) { |
|
256 | + if ($percentage > 100) { |
|
257 | 257 | $percentage = 100; |
258 | 258 | } |
259 | 259 | |
@@ -269,46 +269,46 @@ discard block |
||
269 | 269 | * |
270 | 270 | * @return mixed |
271 | 271 | */ |
272 | - private function set_donor_data( $i, $data, $donor ) { |
|
272 | + private function set_donor_data($i, $data, $donor) { |
|
273 | 273 | |
274 | 274 | $columns = $this->csv_cols(); |
275 | 275 | |
276 | 276 | // Set address variable |
277 | 277 | $address = ''; |
278 | - if ( isset( $donor->user_id ) && $donor->user_id > 0 ) { |
|
279 | - $address = give_get_donor_address( $donor->user_id ); |
|
278 | + if (isset($donor->user_id) && $donor->user_id > 0) { |
|
279 | + $address = give_get_donor_address($donor->user_id); |
|
280 | 280 | } |
281 | 281 | |
282 | 282 | // Set columns |
283 | - if ( ! empty( $columns['full_name'] ) ) { |
|
284 | - $data[ $i ]['full_name'] = $donor->name; |
|
283 | + if ( ! empty($columns['full_name'])) { |
|
284 | + $data[$i]['full_name'] = $donor->name; |
|
285 | 285 | } |
286 | - if ( ! empty( $columns['email'] ) ) { |
|
287 | - $data[ $i ]['email'] = $donor->email; |
|
286 | + if ( ! empty($columns['email'])) { |
|
287 | + $data[$i]['email'] = $donor->email; |
|
288 | 288 | } |
289 | - if ( ! empty( $columns['address_line1'] ) ) { |
|
290 | - |
|
291 | - $data[ $i ]['address_line1'] = isset( $address['line1'] ) ? $address['line1'] : ''; |
|
292 | - $data[ $i ]['address_line2'] = isset( $address['line2'] ) ? $address['line2'] : ''; |
|
293 | - $data[ $i ]['address_city'] = isset( $address['city'] ) ? $address['city'] : ''; |
|
294 | - $data[ $i ]['address_state'] = isset( $address['state'] ) ? $address['state'] : ''; |
|
295 | - $data[ $i ]['address_zip'] = isset( $address['zip'] ) ? $address['zip'] : ''; |
|
296 | - $data[ $i ]['address_country'] = isset( $address['country'] ) ? $address['country'] : ''; |
|
289 | + if ( ! empty($columns['address_line1'])) { |
|
290 | + |
|
291 | + $data[$i]['address_line1'] = isset($address['line1']) ? $address['line1'] : ''; |
|
292 | + $data[$i]['address_line2'] = isset($address['line2']) ? $address['line2'] : ''; |
|
293 | + $data[$i]['address_city'] = isset($address['city']) ? $address['city'] : ''; |
|
294 | + $data[$i]['address_state'] = isset($address['state']) ? $address['state'] : ''; |
|
295 | + $data[$i]['address_zip'] = isset($address['zip']) ? $address['zip'] : ''; |
|
296 | + $data[$i]['address_country'] = isset($address['country']) ? $address['country'] : ''; |
|
297 | 297 | } |
298 | - if ( ! empty( $columns['userid'] ) ) { |
|
299 | - $data[ $i ]['userid'] = ! empty( $donor->user_id ) ? $donor->user_id : ''; |
|
298 | + if ( ! empty($columns['userid'])) { |
|
299 | + $data[$i]['userid'] = ! empty($donor->user_id) ? $donor->user_id : ''; |
|
300 | 300 | } |
301 | - if ( ! empty( $columns['date_first_donated'] ) ) { |
|
302 | - $data[ $i ]['date_first_donated'] = date_i18n( give_date_format(), strtotime( $donor->date_created ) ); |
|
301 | + if ( ! empty($columns['date_first_donated'])) { |
|
302 | + $data[$i]['date_first_donated'] = date_i18n(give_date_format(), strtotime($donor->date_created)); |
|
303 | 303 | } |
304 | - if ( ! empty( $columns['donations'] ) ) { |
|
305 | - $data[ $i ]['donations'] = $donor->purchase_count; |
|
304 | + if ( ! empty($columns['donations'])) { |
|
305 | + $data[$i]['donations'] = $donor->purchase_count; |
|
306 | 306 | } |
307 | - if ( ! empty( $columns['donation_sum'] ) ) { |
|
308 | - $data[ $i ]['donation_sum'] = give_format_amount( $donor->purchase_value ); |
|
307 | + if ( ! empty($columns['donation_sum'])) { |
|
308 | + $data[$i]['donation_sum'] = give_format_amount($donor->purchase_value); |
|
309 | 309 | } |
310 | 310 | |
311 | - return $data[ $i ]; |
|
311 | + return $data[$i]; |
|
312 | 312 | |
313 | 313 | } |
314 | 314 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | * @license https://opensource.org/licenses/gpl-license GNU Public License |
11 | 11 | */ |
12 | 12 | |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -22,11 +22,11 @@ discard block |
||
22 | 22 | */ |
23 | 23 | function give_process_batch_export_form() { |
24 | 24 | |
25 | - if ( ! wp_verify_nonce( $_REQUEST['nonce'], 'give-batch-export' ) ) { |
|
26 | - wp_die( esc_html__( 'Nonce verification failed.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
25 | + if ( ! wp_verify_nonce($_REQUEST['nonce'], 'give-batch-export')) { |
|
26 | + wp_die(esc_html__('Nonce verification failed.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
27 | 27 | } |
28 | 28 | |
29 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-batch-export.php'; |
|
29 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-batch-export.php'; |
|
30 | 30 | |
31 | 31 | /** |
32 | 32 | * Fires before batch export. |
@@ -35,14 +35,14 @@ discard block |
||
35 | 35 | * |
36 | 36 | * @param string $class Export class. |
37 | 37 | */ |
38 | - do_action( 'give_batch_export_class_include', $_REQUEST['class'] ); |
|
38 | + do_action('give_batch_export_class_include', $_REQUEST['class']); |
|
39 | 39 | |
40 | 40 | $export = new $_REQUEST['class']; |
41 | 41 | $export->export(); |
42 | 42 | |
43 | 43 | } |
44 | 44 | |
45 | -add_action( 'give_form_batch_export', 'give_process_batch_export_form' ); |
|
45 | +add_action('give_form_batch_export', 'give_process_batch_export_form'); |
|
46 | 46 | |
47 | 47 | /** |
48 | 48 | * Exports earnings for a specified time period |
@@ -53,14 +53,14 @@ discard block |
||
53 | 53 | * @return void |
54 | 54 | */ |
55 | 55 | function give_export_earnings() { |
56 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-export-earnings.php'; |
|
56 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-export-earnings.php'; |
|
57 | 57 | |
58 | 58 | $earnings_export = new Give_Earnings_Export(); |
59 | 59 | |
60 | 60 | $earnings_export->export(); |
61 | 61 | } |
62 | 62 | |
63 | -add_action( 'give_earnings_export', 'give_export_earnings' ); |
|
63 | +add_action('give_earnings_export', 'give_export_earnings'); |
|
64 | 64 | |
65 | 65 | |
66 | 66 | /** |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * @return void |
71 | 71 | */ |
72 | 72 | function give_register_batch_exporters() { |
73 | - if ( is_admin() ) { |
|
73 | + if (is_admin()) { |
|
74 | 74 | /** |
75 | 75 | * Fires in the admin, while plugins loaded. |
76 | 76 | * |
@@ -80,11 +80,11 @@ discard block |
||
80 | 80 | * |
81 | 81 | * @param string $class Export class. |
82 | 82 | */ |
83 | - do_action( 'give_register_batch_exporter' ); |
|
83 | + do_action('give_register_batch_exporter'); |
|
84 | 84 | } |
85 | 85 | } |
86 | 86 | |
87 | -add_action( 'plugins_loaded', 'give_register_batch_exporters' ); |
|
87 | +add_action('plugins_loaded', 'give_register_batch_exporters'); |
|
88 | 88 | |
89 | 89 | /** |
90 | 90 | * Register the payments batch exporter |
@@ -92,10 +92,10 @@ discard block |
||
92 | 92 | * @since 1.5 |
93 | 93 | */ |
94 | 94 | function give_register_payments_batch_export() { |
95 | - add_action( 'give_batch_export_class_include', 'give_include_payments_batch_processor', 10, 1 ); |
|
95 | + add_action('give_batch_export_class_include', 'give_include_payments_batch_processor', 10, 1); |
|
96 | 96 | } |
97 | 97 | |
98 | -add_action( 'give_register_batch_exporter', 'give_register_payments_batch_export', 10 ); |
|
98 | +add_action('give_register_batch_exporter', 'give_register_payments_batch_export', 10); |
|
99 | 99 | |
100 | 100 | /** |
101 | 101 | * Loads the payments batch process if needed |
@@ -106,10 +106,10 @@ discard block |
||
106 | 106 | * |
107 | 107 | * @return void |
108 | 108 | */ |
109 | -function give_include_payments_batch_processor( $class ) { |
|
109 | +function give_include_payments_batch_processor($class) { |
|
110 | 110 | |
111 | - if ( 'Give_Batch_Payments_Export' === $class ) { |
|
112 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-batch-export-payments.php'; |
|
111 | + if ('Give_Batch_Payments_Export' === $class) { |
|
112 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-batch-export-payments.php'; |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | } |
@@ -120,10 +120,10 @@ discard block |
||
120 | 120 | * @since 1.5.2 |
121 | 121 | */ |
122 | 122 | function give_register_customers_batch_export() { |
123 | - add_action( 'give_batch_export_class_include', 'give_include_customers_batch_processor', 10, 1 ); |
|
123 | + add_action('give_batch_export_class_include', 'give_include_customers_batch_processor', 10, 1); |
|
124 | 124 | } |
125 | 125 | |
126 | -add_action( 'give_register_batch_exporter', 'give_register_customers_batch_export', 10 ); |
|
126 | +add_action('give_register_batch_exporter', 'give_register_customers_batch_export', 10); |
|
127 | 127 | |
128 | 128 | /** |
129 | 129 | * Loads the customers batch process if needed |
@@ -134,10 +134,10 @@ discard block |
||
134 | 134 | * |
135 | 135 | * @return void |
136 | 136 | */ |
137 | -function give_include_customers_batch_processor( $class ) { |
|
137 | +function give_include_customers_batch_processor($class) { |
|
138 | 138 | |
139 | - if ( 'Give_Batch_Customers_Export' === $class ) { |
|
140 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-batch-export-customers.php'; |
|
139 | + if ('Give_Batch_Customers_Export' === $class) { |
|
140 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-batch-export-customers.php'; |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | } |
@@ -148,10 +148,10 @@ discard block |
||
148 | 148 | * @since 1.5 |
149 | 149 | */ |
150 | 150 | function give_register_forms_batch_export() { |
151 | - add_action( 'give_batch_export_class_include', 'give_include_forms_batch_processor', 10, 1 ); |
|
151 | + add_action('give_batch_export_class_include', 'give_include_forms_batch_processor', 10, 1); |
|
152 | 152 | } |
153 | 153 | |
154 | -add_action( 'give_register_batch_exporter', 'give_register_forms_batch_export', 10 ); |
|
154 | +add_action('give_register_batch_exporter', 'give_register_forms_batch_export', 10); |
|
155 | 155 | |
156 | 156 | /** |
157 | 157 | * Loads the file downloads batch process if needed |
@@ -162,10 +162,10 @@ discard block |
||
162 | 162 | * |
163 | 163 | * @return void |
164 | 164 | */ |
165 | -function give_include_forms_batch_processor( $class ) { |
|
165 | +function give_include_forms_batch_processor($class) { |
|
166 | 166 | |
167 | - if ( 'Give_Batch_Forms_Export' === $class ) { |
|
168 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-batch-export-forms.php'; |
|
167 | + if ('Give_Batch_Forms_Export' === $class) { |
|
168 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-batch-export-forms.php'; |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | } |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if accessed directly. |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | * @return bool Whether we can export or not |
38 | 38 | */ |
39 | 39 | public function can_export() { |
40 | - return (bool) apply_filters( 'give_export_capability', current_user_can( 'export_give_reports' ) ); |
|
40 | + return (bool) apply_filters('give_export_capability', current_user_can('export_give_reports')); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -48,16 +48,16 @@ discard block |
||
48 | 48 | * @return void |
49 | 49 | */ |
50 | 50 | public function headers() { |
51 | - ignore_user_abort( true ); |
|
51 | + ignore_user_abort(true); |
|
52 | 52 | |
53 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
54 | - set_time_limit( 0 ); |
|
53 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
54 | + set_time_limit(0); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | nocache_headers(); |
58 | - header( 'Content-Type: text/csv; charset=utf-8' ); |
|
59 | - header( 'Content-Disposition: attachment; filename=give-export-' . $this->export_type . '-' . date( 'm-d-Y' ) . '.csv' ); |
|
60 | - header( "Expires: 0" ); |
|
58 | + header('Content-Type: text/csv; charset=utf-8'); |
|
59 | + header('Content-Disposition: attachment; filename=give-export-'.$this->export_type.'-'.date('m-d-Y').'.csv'); |
|
60 | + header("Expires: 0"); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
@@ -69,8 +69,8 @@ discard block |
||
69 | 69 | */ |
70 | 70 | public function csv_cols() { |
71 | 71 | $cols = array( |
72 | - 'id' => __( 'ID', 'give' ), |
|
73 | - 'date' => __( 'Date', 'give' ) |
|
72 | + 'id' => __('ID', 'give'), |
|
73 | + 'date' => __('Date', 'give') |
|
74 | 74 | ); |
75 | 75 | |
76 | 76 | return $cols; |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | public function get_csv_cols() { |
87 | 87 | $cols = $this->csv_cols(); |
88 | 88 | |
89 | - return apply_filters( "give_export_csv_cols_{$this->export_type}", $cols ); |
|
89 | + return apply_filters("give_export_csv_cols_{$this->export_type}", $cols); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
@@ -100,10 +100,10 @@ discard block |
||
100 | 100 | public function csv_cols_out() { |
101 | 101 | $cols = $this->get_csv_cols(); |
102 | 102 | $i = 1; |
103 | - foreach ( $cols as $col_id => $column ) { |
|
104 | - echo '"' . addslashes( $column ) . '"'; |
|
105 | - echo $i == count( $cols ) ? '' : ','; |
|
106 | - $i ++; |
|
103 | + foreach ($cols as $col_id => $column) { |
|
104 | + echo '"'.addslashes($column).'"'; |
|
105 | + echo $i == count($cols) ? '' : ','; |
|
106 | + $i++; |
|
107 | 107 | } |
108 | 108 | echo "\r\n"; |
109 | 109 | } |
@@ -120,16 +120,16 @@ discard block |
||
120 | 120 | $data = array( |
121 | 121 | 0 => array( |
122 | 122 | 'id' => '', |
123 | - 'data' => date( 'F j, Y' ) |
|
123 | + 'data' => date('F j, Y') |
|
124 | 124 | ), |
125 | 125 | 1 => array( |
126 | 126 | 'id' => '', |
127 | - 'data' => date( 'F j, Y' ) |
|
127 | + 'data' => date('F j, Y') |
|
128 | 128 | ) |
129 | 129 | ); |
130 | 130 | |
131 | - $data = apply_filters( 'give_export_get_data', $data ); |
|
132 | - $data = apply_filters( "give_export_get_data_{$this->export_type}", $data ); |
|
131 | + $data = apply_filters('give_export_get_data', $data); |
|
132 | + $data = apply_filters("give_export_get_data_{$this->export_type}", $data); |
|
133 | 133 | |
134 | 134 | return $data; |
135 | 135 | } |
@@ -147,14 +147,14 @@ discard block |
||
147 | 147 | $cols = $this->get_csv_cols(); |
148 | 148 | |
149 | 149 | // Output each row |
150 | - foreach ( $data as $row ) { |
|
150 | + foreach ($data as $row) { |
|
151 | 151 | $i = 1; |
152 | - foreach ( $row as $col_id => $column ) { |
|
152 | + foreach ($row as $col_id => $column) { |
|
153 | 153 | // Make sure the column is valid |
154 | - if ( array_key_exists( $col_id, $cols ) ) { |
|
155 | - echo '"' . addslashes( $column ) . '"'; |
|
156 | - echo $i == count( $cols ) ? '' : ','; |
|
157 | - $i ++; |
|
154 | + if (array_key_exists($col_id, $cols)) { |
|
155 | + echo '"'.addslashes($column).'"'; |
|
156 | + echo $i == count($cols) ? '' : ','; |
|
157 | + $i++; |
|
158 | 158 | } |
159 | 159 | } |
160 | 160 | echo "\r\n"; |
@@ -173,8 +173,8 @@ discard block |
||
173 | 173 | * @return void |
174 | 174 | */ |
175 | 175 | public function export() { |
176 | - if ( ! $this->can_export() ) { |
|
177 | - wp_die( __( 'You do not have permission to export data.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
176 | + if ( ! $this->can_export()) { |
|
177 | + wp_die(__('You do not have permission to export data.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | // Set headers |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // Exit if accessed directly. |
14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
14 | +if ( ! defined('ABSPATH')) { |
|
15 | 15 | exit; |
16 | 16 | } |
17 | 17 | |
@@ -25,14 +25,14 @@ discard block |
||
25 | 25 | */ |
26 | 26 | function give_do_ajax_export() { |
27 | 27 | |
28 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-batch-export.php'; |
|
28 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-batch-export.php'; |
|
29 | 29 | |
30 | - parse_str( $_POST['form'], $form ); |
|
30 | + parse_str($_POST['form'], $form); |
|
31 | 31 | |
32 | 32 | $_REQUEST = $form = (array) $form; |
33 | 33 | |
34 | - if ( ! wp_verify_nonce( $_REQUEST['give_ajax_export'], 'give_ajax_export' ) ) { |
|
35 | - die( '-2' ); |
|
34 | + if ( ! wp_verify_nonce($_REQUEST['give_ajax_export'], 'give_ajax_export')) { |
|
35 | + die('-2'); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | /** |
@@ -42,69 +42,69 @@ discard block |
||
42 | 42 | * |
43 | 43 | * @param string $class Export class. |
44 | 44 | */ |
45 | - do_action( 'give_batch_export_class_include', $form['give-export-class'] ); |
|
45 | + do_action('give_batch_export_class_include', $form['give-export-class']); |
|
46 | 46 | |
47 | - $step = absint( $_POST['step'] ); |
|
48 | - $class = sanitize_text_field( $form['give-export-class'] ); |
|
47 | + $step = absint($_POST['step']); |
|
48 | + $class = sanitize_text_field($form['give-export-class']); |
|
49 | 49 | |
50 | - $export = new $class( $step ); |
|
50 | + $export = new $class($step); |
|
51 | 51 | |
52 | - if ( ! $export->can_export() ) { |
|
53 | - die( '-1' ); |
|
52 | + if ( ! $export->can_export()) { |
|
53 | + die('-1'); |
|
54 | 54 | } |
55 | 55 | |
56 | - if ( ! $export->is_writable ) { |
|
56 | + if ( ! $export->is_writable) { |
|
57 | 57 | $json_args = array( |
58 | 58 | 'error' => true, |
59 | - 'message' => esc_html__( 'Export location or file not writable.', 'give' ) |
|
59 | + 'message' => esc_html__('Export location or file not writable.', 'give') |
|
60 | 60 | ); |
61 | 61 | echo json_encode($json_args); |
62 | 62 | exit; |
63 | 63 | } |
64 | 64 | |
65 | - $export->set_properties( $_REQUEST ); |
|
65 | + $export->set_properties($_REQUEST); |
|
66 | 66 | |
67 | 67 | $export->pre_fetch(); |
68 | 68 | |
69 | - $ret = $export->process_step( $step ); |
|
69 | + $ret = $export->process_step($step); |
|
70 | 70 | |
71 | 71 | $percentage = $export->get_percentage_complete(); |
72 | 72 | |
73 | - if ( $ret ) { |
|
73 | + if ($ret) { |
|
74 | 74 | |
75 | 75 | $step += 1; |
76 | - echo json_encode( array( 'step' => $step, 'percentage' => $percentage ) ); |
|
76 | + echo json_encode(array('step' => $step, 'percentage' => $percentage)); |
|
77 | 77 | exit; |
78 | 78 | |
79 | - } elseif ( true === $export->is_empty ) { |
|
79 | + } elseif (true === $export->is_empty) { |
|
80 | 80 | |
81 | - echo json_encode( array( |
|
81 | + echo json_encode(array( |
|
82 | 82 | 'error' => true, |
83 | - 'message' => esc_html__( 'No data found for export parameters.', 'give' ) |
|
84 | - ) ); |
|
83 | + 'message' => esc_html__('No data found for export parameters.', 'give') |
|
84 | + )); |
|
85 | 85 | exit; |
86 | 86 | |
87 | - } elseif ( true === $export->done && true === $export->is_void ) { |
|
87 | + } elseif (true === $export->done && true === $export->is_void) { |
|
88 | 88 | |
89 | - $message = ! empty( $export->message ) ? $export->message : esc_html__( 'Batch Processing Complete', 'give' ); |
|
90 | - echo json_encode( array( 'success' => true, 'message' => $message ) ); |
|
89 | + $message = ! empty($export->message) ? $export->message : esc_html__('Batch Processing Complete', 'give'); |
|
90 | + echo json_encode(array('success' => true, 'message' => $message)); |
|
91 | 91 | exit; |
92 | 92 | |
93 | 93 | } else { |
94 | 94 | |
95 | - $args = array_merge( $_REQUEST, array( |
|
95 | + $args = array_merge($_REQUEST, array( |
|
96 | 96 | 'step' => $step, |
97 | 97 | 'class' => $class, |
98 | - 'nonce' => wp_create_nonce( 'give-batch-export' ), |
|
98 | + 'nonce' => wp_create_nonce('give-batch-export'), |
|
99 | 99 | 'give_action' => 'form_batch_export', |
100 | - ) ); |
|
100 | + )); |
|
101 | 101 | |
102 | - $download_url = add_query_arg( $args, admin_url() ); |
|
102 | + $download_url = add_query_arg($args, admin_url()); |
|
103 | 103 | |
104 | - echo json_encode( array( 'step' => 'done', 'url' => $download_url ) ); |
|
104 | + echo json_encode(array('step' => 'done', 'url' => $download_url)); |
|
105 | 105 | exit; |
106 | 106 | |
107 | 107 | } |
108 | 108 | } |
109 | 109 | |
110 | -add_action( 'wp_ajax_give_do_ajax_export', 'give_do_ajax_export' ); |
|
110 | +add_action('wp_ajax_give_do_ajax_export', 'give_do_ajax_export'); |
@@ -3,11 +3,11 @@ discard block |
||
3 | 3 | * Admin View: Exports |
4 | 4 | */ |
5 | 5 | |
6 | -if ( ! defined( 'ABSPATH' ) ) { |
|
6 | +if ( ! defined('ABSPATH')) { |
|
7 | 7 | exit; |
8 | 8 | } |
9 | 9 | |
10 | -if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
10 | +if ( ! current_user_can('manage_give_settings')) { |
|
11 | 11 | return; |
12 | 12 | } |
13 | 13 | |
@@ -16,27 +16,27 @@ discard block |
||
16 | 16 | * |
17 | 17 | * @since 1.5 |
18 | 18 | */ |
19 | -do_action( 'give_tools_recount_stats_before' ); |
|
19 | +do_action('give_tools_recount_stats_before'); |
|
20 | 20 | ?> |
21 | 21 | <div id="poststuff"> |
22 | 22 | <div class="postbox"> |
23 | 23 | |
24 | - <h2 class="hndle ui-sortable-handle"><span><?php esc_html_e( 'Recount Stats', 'give' ); ?></span></h2> |
|
24 | + <h2 class="hndle ui-sortable-handle"><span><?php esc_html_e('Recount Stats', 'give'); ?></span></h2> |
|
25 | 25 | |
26 | 26 | <div class="inside recount-stats-controls"> |
27 | - <p><?php esc_html_e( 'Use these tools to recount stats, delete test transactions, or reset stats.', 'give' ); ?></p> |
|
27 | + <p><?php esc_html_e('Use these tools to recount stats, delete test transactions, or reset stats.', 'give'); ?></p> |
|
28 | 28 | <form method="post" id="give-tools-recount-form" class="give-export-form"> |
29 | 29 | |
30 | - <?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?> |
|
30 | + <?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?> |
|
31 | 31 | |
32 | 32 | <select name="give-export-class" id="recount-stats-type"> |
33 | - <option value="0" selected="selected" disabled="disabled"><?php esc_html_e( 'Please select an option', 'give' ); ?></option> |
|
34 | - <option data-type="recount-stats" value="Give_Tools_Recount_Income"><?php esc_html_e( 'Recalculate Total Donation Income Amount', 'give' ); ?></option> |
|
35 | - <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> |
|
36 | - <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> |
|
37 | - <option data-type="recount-customer-stats" value="Give_Tools_Recount_Customer_Stats"><?php esc_html_e( 'Recalculate Donor Statistics', 'give' ); ?></option> |
|
38 | - <option data-type="delete-test-transactions" value="Give_Tools_Delete_Test_Transactions"><?php esc_html_e( 'Delete Test Transactions', 'give' ); ?></option> |
|
39 | - <option data-type="reset-stats" value="Give_Tools_Reset_Stats"><?php esc_html_e( 'Delete All Data', 'give' ); ?></option> |
|
33 | + <option value="0" selected="selected" disabled="disabled"><?php esc_html_e('Please select an option', 'give'); ?></option> |
|
34 | + <option data-type="recount-stats" value="Give_Tools_Recount_Income"><?php esc_html_e('Recalculate Total Donation Income Amount', 'give'); ?></option> |
|
35 | + <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> |
|
36 | + <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> |
|
37 | + <option data-type="recount-customer-stats" value="Give_Tools_Recount_Customer_Stats"><?php esc_html_e('Recalculate Donor Statistics', 'give'); ?></option> |
|
38 | + <option data-type="delete-test-transactions" value="Give_Tools_Delete_Test_Transactions"><?php esc_html_e('Delete Test Transactions', 'give'); ?></option> |
|
39 | + <option data-type="reset-stats" value="Give_Tools_Reset_Stats"><?php esc_html_e('Delete All Data', 'give'); ?></option> |
|
40 | 40 | <?php |
41 | 41 | /** |
42 | 42 | * Fires in the recount stats selectbox. |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * |
46 | 46 | * @since 1.5 |
47 | 47 | */ |
48 | - do_action( 'give_recount_tool_options' ); |
|
48 | + do_action('give_recount_tool_options'); |
|
49 | 49 | ?> |
50 | 50 | </select> |
51 | 51 | |
@@ -53,22 +53,22 @@ discard block |
||
53 | 53 | <?php |
54 | 54 | $args = array( |
55 | 55 | 'name' => 'form_id', |
56 | - 'number' => - 1, |
|
56 | + 'number' => -1, |
|
57 | 57 | 'chosen' => true, |
58 | 58 | ); |
59 | - echo Give()->html->forms_dropdown( $args ); |
|
59 | + echo Give()->html->forms_dropdown($args); |
|
60 | 60 | ?> |
61 | 61 | </span> |
62 | 62 | |
63 | - <input type="submit" id="recount-stats-submit" value="<?php esc_attr_e( 'Submit', 'give' ); ?>" class="button-secondary"/> |
|
63 | + <input type="submit" id="recount-stats-submit" value="<?php esc_attr_e('Submit', 'give'); ?>" class="button-secondary"/> |
|
64 | 64 | |
65 | 65 | <br/> |
66 | 66 | |
67 | 67 | <span class="give-recount-stats-descriptions"> |
68 | - <span id="recount-stats"><?php esc_html_e( 'Recalculates the overall donation income amount.', 'give' ); ?></span> |
|
69 | - <span id="recount-form"><?php esc_html_e( 'Recalculates the donation and income stats for a specific form.', 'give' ); ?></span> |
|
70 | - <span id="recount-all"><?php esc_html_e( 'Recalculates the earnings and sales stats for all forms.', 'give' ); ?></span> |
|
71 | - <span id="recount-customer-stats"><?php esc_html_e( 'Recalculates the lifetime value and donation counts for all donors.', 'give' ); ?></span> |
|
68 | + <span id="recount-stats"><?php esc_html_e('Recalculates the overall donation income amount.', 'give'); ?></span> |
|
69 | + <span id="recount-form"><?php esc_html_e('Recalculates the donation and income stats for a specific form.', 'give'); ?></span> |
|
70 | + <span id="recount-all"><?php esc_html_e('Recalculates the earnings and sales stats for all forms.', 'give'); ?></span> |
|
71 | + <span id="recount-customer-stats"><?php esc_html_e('Recalculates the lifetime value and donation counts for all donors.', 'give'); ?></span> |
|
72 | 72 | <?php |
73 | 73 | /** |
74 | 74 | * Fires in the recount stats description area. |
@@ -77,10 +77,10 @@ discard block |
||
77 | 77 | * |
78 | 78 | * @since 1.5 |
79 | 79 | */ |
80 | - do_action( 'give_recount_tool_descriptions' ); |
|
80 | + do_action('give_recount_tool_descriptions'); |
|
81 | 81 | ?> |
82 | - <span id="delete-test-transactions"><?php _e( '<strong>Deletes</strong> all TEST donations, donors, and related log entries.', 'give' ); ?></span> |
|
83 | - <span id="reset-stats"><?php _e( '<strong>Deletes</strong> ALL donations, donors, and related log entries regardless of test or live mode.', 'give' ); ?></span> |
|
82 | + <span id="delete-test-transactions"><?php _e('<strong>Deletes</strong> all TEST donations, donors, and related log entries.', 'give'); ?></span> |
|
83 | + <span id="reset-stats"><?php _e('<strong>Deletes</strong> ALL donations, donors, and related log entries regardless of test or live mode.', 'give'); ?></span> |
|
84 | 84 | </span> |
85 | 85 | |
86 | 86 | <span class="spinner"></span> |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | * |
95 | 95 | * @since 1.5 |
96 | 96 | */ |
97 | - do_action( 'give_tools_recount_forms' ); |
|
97 | + do_action('give_tools_recount_forms'); |
|
98 | 98 | ?> |
99 | 99 | </div><!-- .inside --> |
100 | 100 | </div><!-- .postbox --> |
@@ -105,4 +105,4 @@ discard block |
||
105 | 105 | * |
106 | 106 | * @since 1.5 |
107 | 107 | */ |
108 | -do_action( 'give_tools_recount_stats_after' ); |
|
108 | +do_action('give_tools_recount_stats_after'); |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Settings_Logs' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_Logs')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_Logs. |
@@ -43,16 +43,16 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function __construct() { |
45 | 45 | $this->id = 'logs'; |
46 | - $this->label = __( 'Logs', 'give' ); |
|
46 | + $this->label = __('Logs', 'give'); |
|
47 | 47 | |
48 | 48 | $this->default_tab = 'sales'; |
49 | 49 | |
50 | 50 | parent::__construct(); |
51 | 51 | |
52 | 52 | // Do not use main form for this tab. |
53 | - if ( give_get_current_setting_tab() === $this->id ) { |
|
54 | - add_action( 'give-tools_open_form', '__return_empty_string' ); |
|
55 | - add_action( 'give-tools_close_form', '__return_empty_string' ); |
|
53 | + if (give_get_current_setting_tab() === $this->id) { |
|
54 | + add_action('give-tools_open_form', '__return_empty_string'); |
|
55 | + add_action('give-tools_close_form', '__return_empty_string'); |
|
56 | 56 | } |
57 | 57 | } |
58 | 58 | |
@@ -65,8 +65,8 @@ discard block |
||
65 | 65 | * |
66 | 66 | * @return array |
67 | 67 | */ |
68 | - public function add_settings_page( $pages ) { |
|
69 | - $pages[ $this->id ] = $this->label; |
|
68 | + public function add_settings_page($pages) { |
|
69 | + $pages[$this->id] = $this->label; |
|
70 | 70 | |
71 | 71 | return $pages; |
72 | 72 | } |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | $GLOBALS['give_hide_save_button'] = true; |
83 | 83 | |
84 | 84 | // Get settings. |
85 | - $settings = apply_filters( 'give_settings_logs', array( |
|
85 | + $settings = apply_filters('give_settings_logs', array( |
|
86 | 86 | array( |
87 | 87 | 'id' => 'give_tools_logs', |
88 | 88 | 'type' => 'title', |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | ), |
91 | 91 | array( |
92 | 92 | 'id' => 'api', |
93 | - 'name' => __( 'Log', 'give' ), |
|
93 | + 'name' => __('Log', 'give'), |
|
94 | 94 | 'type' => 'logs', |
95 | 95 | |
96 | 96 | ), |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | 'type' => 'sectionend', |
100 | 100 | 'table_html' => false, |
101 | 101 | ), |
102 | - ) ); |
|
102 | + )); |
|
103 | 103 | |
104 | 104 | /** |
105 | 105 | * Filter the settings. |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | * |
109 | 109 | * @param array $settings |
110 | 110 | */ |
111 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
111 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
112 | 112 | |
113 | 113 | // Output. |
114 | 114 | return $settings; |
@@ -122,14 +122,14 @@ discard block |
||
122 | 122 | */ |
123 | 123 | public function get_sections() { |
124 | 124 | $sections = array( |
125 | - 'sales' => __( 'Donations', 'give' ), |
|
126 | - 'gateway_errors' => __( 'Payment Errors', 'give' ), |
|
127 | - 'api_requests' => __( 'API Requests', 'give' ), |
|
125 | + 'sales' => __('Donations', 'give'), |
|
126 | + 'gateway_errors' => __('Payment Errors', 'give'), |
|
127 | + 'api_requests' => __('API Requests', 'give'), |
|
128 | 128 | ); |
129 | 129 | |
130 | - $sections = apply_filters( 'give_log_views', $sections ); |
|
130 | + $sections = apply_filters('give_log_views', $sections); |
|
131 | 131 | |
132 | - return apply_filters( 'give_get_sections_' . $this->id, $sections ); |
|
132 | + return apply_filters('give_get_sections_'.$this->id, $sections); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | /** |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | public function output() { |
142 | 142 | $settings = $this->get_settings(); |
143 | 143 | |
144 | - Give_Admin_Settings::output_fields( $settings, 'give_settings' ); |
|
144 | + Give_Admin_Settings::output_fields($settings, 'give_settings'); |
|
145 | 145 | } |
146 | 146 | } |
147 | 147 |
@@ -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,7 +22,7 @@ discard block |
||
22 | 22 | */ |
23 | 23 | function give_get_logs_tab() { |
24 | 24 | |
25 | - require( GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/logs.php' ); |
|
25 | + require(GIVE_PLUGIN_DIR.'includes/admin/tools/logs/logs.php'); |
|
26 | 26 | |
27 | 27 | // Get current section. |
28 | 28 | $current_section = $_GET['section'] = give_get_current_setting_section(); |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * |
33 | 33 | * @since 1.0 |
34 | 34 | */ |
35 | - do_action( "give_logs_view_{$current_section}" ); |
|
35 | + do_action("give_logs_view_{$current_section}"); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | */ |
47 | 47 | function give_logs_view_sales() { |
48 | 48 | |
49 | - include GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/class-sales-logs-list-table.php'; |
|
49 | + include GIVE_PLUGIN_DIR.'includes/admin/tools/logs/class-sales-logs-list-table.php'; |
|
50 | 50 | |
51 | 51 | $logs_table = new Give_Sales_Log_Table(); |
52 | 52 | $logs_table->prepare_items(); |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | |
55 | 55 | } |
56 | 56 | |
57 | -add_action( 'give_logs_view_sales', 'give_logs_view_sales' ); |
|
57 | +add_action('give_logs_view_sales', 'give_logs_view_sales'); |
|
58 | 58 | |
59 | 59 | |
60 | 60 | /** |
@@ -66,14 +66,14 @@ discard block |
||
66 | 66 | * @return void |
67 | 67 | */ |
68 | 68 | function give_logs_view_gateway_errors() { |
69 | - include( GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/class-gateway-error-logs-list-table.php' ); |
|
69 | + include(GIVE_PLUGIN_DIR.'includes/admin/tools/logs/class-gateway-error-logs-list-table.php'); |
|
70 | 70 | |
71 | 71 | $logs_table = new Give_Gateway_Error_Log_Table(); |
72 | 72 | $logs_table->prepare_items(); |
73 | 73 | $logs_table->display(); |
74 | 74 | } |
75 | 75 | |
76 | -add_action( 'give_logs_view_gateway_errors', 'give_logs_view_gateway_errors' ); |
|
76 | +add_action('give_logs_view_gateway_errors', 'give_logs_view_gateway_errors'); |
|
77 | 77 | |
78 | 78 | /** |
79 | 79 | * API Request Logs |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | * @return void |
86 | 86 | */ |
87 | 87 | function give_logs_view_api_requests() { |
88 | - include( GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/class-api-requests-logs-list-table.php' ); |
|
88 | + include(GIVE_PLUGIN_DIR.'includes/admin/tools/logs/class-api-requests-logs-list-table.php'); |
|
89 | 89 | |
90 | 90 | $logs_table = new Give_API_Request_Log_Table(); |
91 | 91 | $logs_table->prepare_items(); |
@@ -98,12 +98,12 @@ discard block |
||
98 | 98 | * |
99 | 99 | * @since 1.0 |
100 | 100 | */ |
101 | - do_action( 'give_logs_api_requests_top' ); |
|
101 | + do_action('give_logs_api_requests_top'); |
|
102 | 102 | ?> |
103 | 103 | |
104 | 104 | <form id="give-logs-filter" method="get" action="<?php echo 'edit.php?post_type=give_forms&page=give-tools&tab=logs'; ?>"> |
105 | 105 | <?php |
106 | - $logs_table->search_box( esc_html__( 'Search', 'give' ), 'give-api-requests' ); |
|
106 | + $logs_table->search_box(esc_html__('Search', 'give'), 'give-api-requests'); |
|
107 | 107 | $logs_table->display(); |
108 | 108 | ?> |
109 | 109 | <input type="hidden" name="post_type" value="give_forms"/> |
@@ -116,14 +116,14 @@ discard block |
||
116 | 116 | * |
117 | 117 | * @since 1.0 |
118 | 118 | */ |
119 | - do_action( 'give_logs_api_requests_bottom' ); |
|
119 | + do_action('give_logs_api_requests_bottom'); |
|
120 | 120 | ?> |
121 | 121 | |
122 | 122 | </div> |
123 | 123 | <?php |
124 | 124 | } |
125 | 125 | |
126 | -add_action( 'give_logs_view_api_requests', 'give_logs_view_api_requests' ); |
|
126 | +add_action('give_logs_view_api_requests', 'give_logs_view_api_requests'); |
|
127 | 127 | |
128 | 128 | /** |
129 | 129 | * Renders the log views drop down. |
@@ -135,11 +135,11 @@ discard block |
||
135 | 135 | $current_section = give_get_current_setting_section(); |
136 | 136 | |
137 | 137 | // If there are not any event attach to action then do not show form. |
138 | - if ( ! has_action( 'give_log_view_actions' ) ) { |
|
138 | + if ( ! has_action('give_log_view_actions')) { |
|
139 | 139 | return; |
140 | 140 | } |
141 | 141 | ?> |
142 | - <form id="give-logs-filter" method="get" action="<?php echo 'edit.php?post_type=give_forms&page=give-tools&tab=logs§ion=' . $current_section; ?>"> |
|
142 | + <form id="give-logs-filter" method="get" action="<?php echo 'edit.php?post_type=give_forms&page=give-tools&tab=logs§ion='.$current_section; ?>"> |
|
143 | 143 | <?php |
144 | 144 | /** |
145 | 145 | * Fires after displaying the reports page views drop down. |
@@ -148,14 +148,14 @@ discard block |
||
148 | 148 | * |
149 | 149 | * @since 1.0 |
150 | 150 | */ |
151 | - do_action( 'give_log_view_actions' ); |
|
151 | + do_action('give_log_view_actions'); |
|
152 | 152 | ?> |
153 | 153 | |
154 | 154 | <input type="hidden" name="post_type" value="give_forms"/> |
155 | 155 | <input type="hidden" name="page" value="give-tools"/> |
156 | 156 | <input type="hidden" name="tab" value="logs"/> |
157 | 157 | |
158 | - <?php submit_button( esc_html__( 'Apply', 'give' ), 'secondary', 'submit', false ); ?> |
|
158 | + <?php submit_button(esc_html__('Apply', 'give'), 'secondary', 'submit', false); ?> |
|
159 | 159 | </form> |
160 | 160 | <?php |
161 | 161 | } |
162 | 162 | \ No newline at end of file |
@@ -9,13 +9,13 @@ discard block |
||
9 | 9 | */ |
10 | 10 | |
11 | 11 | // Exit if accessed directly. |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; |
14 | 14 | } |
15 | 15 | |
16 | 16 | // Load WP_List_Table if not loaded. |
17 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
18 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
17 | +if ( ! class_exists('WP_List_Table')) { |
|
18 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | /** |
@@ -44,11 +44,11 @@ discard block |
||
44 | 44 | */ |
45 | 45 | public function __construct() { |
46 | 46 | // Set parent defaults. |
47 | - parent::__construct( array( |
|
48 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records. |
|
49 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. |
|
47 | + parent::__construct(array( |
|
48 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records. |
|
49 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. |
|
50 | 50 | 'ajax' => false // Does this table support ajax?. |
51 | - ) ); |
|
51 | + )); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
@@ -62,19 +62,19 @@ discard block |
||
62 | 62 | * |
63 | 63 | * @return string Column Name. |
64 | 64 | */ |
65 | - public function column_default( $item, $column_name ) { |
|
65 | + public function column_default($item, $column_name) { |
|
66 | 66 | |
67 | - switch ( $column_name ) { |
|
67 | + switch ($column_name) { |
|
68 | 68 | case 'ID' : |
69 | 69 | return $item['ID_label']; |
70 | 70 | case 'payment_id' : |
71 | - return empty( $item['payment_id'] ) ? esc_html__( 'n/a', 'give' ) : sprintf( "<a href=\"%s\" target=\"_blank\">{$item['payment_id']}</a>", get_edit_post_link( $item['payment_id'] ) ); |
|
71 | + return empty($item['payment_id']) ? esc_html__('n/a', 'give') : sprintf("<a href=\"%s\" target=\"_blank\">{$item['payment_id']}</a>", get_edit_post_link($item['payment_id'])); |
|
72 | 72 | case 'gateway' : |
73 | - return empty( $item['gateway'] ) ? esc_html__( 'n/a', 'give' ) : $item['gateway']; |
|
73 | + return empty($item['gateway']) ? esc_html__('n/a', 'give') : $item['gateway']; |
|
74 | 74 | case 'error' : |
75 | - return get_the_title( $item['ID'] ) ? get_the_title( $item['ID'] ) : esc_html__( 'Payment Error', 'give' ); |
|
75 | + return get_the_title($item['ID']) ? get_the_title($item['ID']) : esc_html__('Payment Error', 'give'); |
|
76 | 76 | default: |
77 | - return $item[ $column_name ]; |
|
77 | + return $item[$column_name]; |
|
78 | 78 | } |
79 | 79 | } |
80 | 80 | |
@@ -88,27 +88,27 @@ discard block |
||
88 | 88 | * |
89 | 89 | * @return void |
90 | 90 | */ |
91 | - public function column_message( $item ) { ?> |
|
92 | - <a href="#TB_inline?width=640&inlineId=log-message-<?php echo $item['ID']; ?>" class="thickbox give-error-log-details-link button button-small" data-tooltip="<?php esc_attr_e( 'View Log Message', 'give' ); ?>"><span class="dashicons dashicons-visibility"></span></a> |
|
91 | + public function column_message($item) { ?> |
|
92 | + <a href="#TB_inline?width=640&inlineId=log-message-<?php echo $item['ID']; ?>" class="thickbox give-error-log-details-link button button-small" data-tooltip="<?php esc_attr_e('View Log Message', 'give'); ?>"><span class="dashicons dashicons-visibility"></span></a> |
|
93 | 93 | <div id="log-message-<?php echo $item['ID']; ?>" style="display:none;"> |
94 | 94 | <?php |
95 | 95 | |
96 | - $log_message = get_post_field( 'post_content', $item['ID'] ); |
|
96 | + $log_message = get_post_field('post_content', $item['ID']); |
|
97 | 97 | |
98 | - $serialized = strpos( $log_message, '{"' ); |
|
98 | + $serialized = strpos($log_message, '{"'); |
|
99 | 99 | |
100 | 100 | // Check to see if the log message contains serialized information |
101 | - if ( $serialized !== false ) { |
|
102 | - $length = strlen( $log_message ) - $serialized; |
|
103 | - $intro = substr( $log_message, 0, - $length ); |
|
104 | - $data = substr( $log_message, $serialized, strlen( $log_message ) - 1 ); |
|
101 | + if ($serialized !== false) { |
|
102 | + $length = strlen($log_message) - $serialized; |
|
103 | + $intro = substr($log_message, 0, - $length); |
|
104 | + $data = substr($log_message, $serialized, strlen($log_message) - 1); |
|
105 | 105 | |
106 | - echo wpautop( $intro ); |
|
107 | - echo wpautop( '<strong>' . esc_html__( 'Log data:', 'give' ) . '</strong>' ); |
|
108 | - echo '<div style="word-wrap: break-word;">' . wpautop( $data ) . '</div>'; |
|
106 | + echo wpautop($intro); |
|
107 | + echo wpautop('<strong>'.esc_html__('Log data:', 'give').'</strong>'); |
|
108 | + echo '<div style="word-wrap: break-word;">'.wpautop($data).'</div>'; |
|
109 | 109 | } else { |
110 | 110 | // No serialized data found |
111 | - echo wpautop( $log_message ); |
|
111 | + echo wpautop($log_message); |
|
112 | 112 | } |
113 | 113 | ?> |
114 | 114 | </div> |
@@ -124,12 +124,12 @@ discard block |
||
124 | 124 | */ |
125 | 125 | public function get_columns() { |
126 | 126 | $columns = array( |
127 | - 'ID' => esc_html__( 'Log ID', 'give' ), |
|
128 | - 'error' => esc_html__( 'Error', 'give' ), |
|
129 | - 'gateway' => esc_html__( 'Gateway', 'give' ), |
|
130 | - 'payment_id' => esc_html__( 'Donation ID', 'give' ), |
|
131 | - 'date' => esc_html__( 'Date', 'give' ), |
|
132 | - 'message' => esc_html__( 'Details', 'give' ) |
|
127 | + 'ID' => esc_html__('Log ID', 'give'), |
|
128 | + 'error' => esc_html__('Error', 'give'), |
|
129 | + 'gateway' => esc_html__('Gateway', 'give'), |
|
130 | + 'payment_id' => esc_html__('Donation ID', 'give'), |
|
131 | + 'date' => esc_html__('Date', 'give'), |
|
132 | + 'message' => esc_html__('Details', 'give') |
|
133 | 133 | ); |
134 | 134 | |
135 | 135 | return $columns; |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | * @return int Current page number |
144 | 144 | */ |
145 | 145 | public function get_paged() { |
146 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
146 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | /** |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | * @since 1.0 |
154 | 154 | * @return void |
155 | 155 | */ |
156 | - public function bulk_actions( $which = '' ) { |
|
156 | + public function bulk_actions($which = '') { |
|
157 | 157 | give_log_views(); |
158 | 158 | } |
159 | 159 | |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | |
172 | 172 | // Prevent the queries from getting cached. |
173 | 173 | // Without this there are occasional memory issues for some installs. |
174 | - wp_suspend_cache_addition( true ); |
|
174 | + wp_suspend_cache_addition(true); |
|
175 | 175 | |
176 | 176 | $logs_data = array(); |
177 | 177 | $paged = $this->get_paged(); |
@@ -180,17 +180,17 @@ discard block |
||
180 | 180 | 'paged' => $paged |
181 | 181 | ); |
182 | 182 | |
183 | - $logs = $give_logs->get_connected_logs( $log_query ); |
|
183 | + $logs = $give_logs->get_connected_logs($log_query); |
|
184 | 184 | |
185 | - if ( $logs ) { |
|
186 | - foreach ( $logs as $log ) { |
|
185 | + if ($logs) { |
|
186 | + foreach ($logs as $log) { |
|
187 | 187 | |
188 | 188 | $logs_data[] = array( |
189 | 189 | 'ID' => $log->ID, |
190 | - 'ID_label' => '<span class=\'give-item-label give-item-label-gray\'>' . $log->ID . '</span>', |
|
190 | + 'ID_label' => '<span class=\'give-item-label give-item-label-gray\'>'.$log->ID.'</span>', |
|
191 | 191 | 'payment_id' => $log->post_parent, |
192 | 192 | 'error' => 'error', |
193 | - 'gateway' => give_get_payment_gateway( $log->post_parent ), |
|
193 | + 'gateway' => give_get_payment_gateway($log->post_parent), |
|
194 | 194 | 'date' => $log->post_date |
195 | 195 | ); |
196 | 196 | } |
@@ -212,19 +212,19 @@ discard block |
||
212 | 212 | * |
213 | 213 | * @param string $which |
214 | 214 | */ |
215 | - protected function display_tablenav( $which ) { |
|
216 | - if ( 'top' === $which ) { |
|
217 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
215 | + protected function display_tablenav($which) { |
|
216 | + if ('top' === $which) { |
|
217 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
218 | 218 | } |
219 | 219 | ?> |
220 | - <div class="tablenav <?php echo esc_attr( $which ); ?>"> |
|
220 | + <div class="tablenav <?php echo esc_attr($which); ?>"> |
|
221 | 221 | |
222 | 222 | <div class="alignleft actions bulkactions"> |
223 | - <?php $this->bulk_actions( $which ); ?> |
|
223 | + <?php $this->bulk_actions($which); ?> |
|
224 | 224 | </div> |
225 | 225 | <?php |
226 | - $this->extra_tablenav( $which ); |
|
227 | - $this->pagination( $which ); |
|
226 | + $this->extra_tablenav($which); |
|
227 | + $this->pagination($which); |
|
228 | 228 | ?> |
229 | 229 | |
230 | 230 | <br class="clear"/> |
@@ -251,14 +251,14 @@ discard block |
||
251 | 251 | $columns = $this->get_columns(); |
252 | 252 | $hidden = array(); // No hidden columns |
253 | 253 | $sortable = $this->get_sortable_columns(); |
254 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
254 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
255 | 255 | $this->items = $this->get_logs(); |
256 | - $total_items = $give_logs->get_log_count( 0, 'gateway_error' ); |
|
256 | + $total_items = $give_logs->get_log_count(0, 'gateway_error'); |
|
257 | 257 | |
258 | - $this->set_pagination_args( array( |
|
258 | + $this->set_pagination_args(array( |
|
259 | 259 | 'total_items' => $total_items, |
260 | 260 | 'per_page' => $this->per_page, |
261 | - 'total_pages' => ceil( $total_items / $this->per_page ) |
|
261 | + 'total_pages' => ceil($total_items / $this->per_page) |
|
262 | 262 | ) |
263 | 263 | ); |
264 | 264 | } |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // Exit if accessed directly. |
14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
14 | +if ( ! defined('ABSPATH')) { |
|
15 | 15 | exit; |
16 | 16 | } |
17 | 17 | |
@@ -55,22 +55,22 @@ discard block |
||
55 | 55 | public function get_data() { |
56 | 56 | global $wpdb; |
57 | 57 | |
58 | - $items = $this->get_stored_data( 'give_temp_delete_test_ids' ); |
|
58 | + $items = $this->get_stored_data('give_temp_delete_test_ids'); |
|
59 | 59 | |
60 | - if ( ! is_array( $items ) ) { |
|
60 | + if ( ! is_array($items)) { |
|
61 | 61 | return false; |
62 | 62 | } |
63 | 63 | |
64 | - $offset = ( $this->step - 1 ) * $this->per_step; |
|
65 | - $step_items = array_slice( $items, $offset, $this->per_step ); |
|
64 | + $offset = ($this->step - 1) * $this->per_step; |
|
65 | + $step_items = array_slice($items, $offset, $this->per_step); |
|
66 | 66 | |
67 | - if ( $step_items ) { |
|
67 | + if ($step_items) { |
|
68 | 68 | |
69 | 69 | $step_ids = array( |
70 | 70 | 'other' => array(), |
71 | 71 | ); |
72 | 72 | |
73 | - foreach ( $step_items as $item ) { |
|
73 | + foreach ($step_items as $item) { |
|
74 | 74 | |
75 | 75 | $step_ids['other'][] = $item['id']; |
76 | 76 | |
@@ -78,15 +78,15 @@ discard block |
||
78 | 78 | |
79 | 79 | $sql = array(); |
80 | 80 | |
81 | - foreach ( $step_ids as $type => $ids ) { |
|
81 | + foreach ($step_ids as $type => $ids) { |
|
82 | 82 | |
83 | - if ( empty( $ids ) ) { |
|
83 | + if (empty($ids)) { |
|
84 | 84 | continue; |
85 | 85 | } |
86 | 86 | |
87 | - $ids = implode( ',', $ids ); |
|
87 | + $ids = implode(',', $ids); |
|
88 | 88 | |
89 | - switch ( $type ) { |
|
89 | + switch ($type) { |
|
90 | 90 | case 'other': |
91 | 91 | $sql[] = "DELETE FROM $wpdb->posts WHERE id IN ($ids)"; |
92 | 92 | $sql[] = "DELETE FROM $wpdb->postmeta WHERE post_id IN ($ids)"; |
@@ -97,9 +97,9 @@ discard block |
||
97 | 97 | |
98 | 98 | } |
99 | 99 | |
100 | - if ( ! empty( $sql ) ) { |
|
101 | - foreach ( $sql as $query ) { |
|
102 | - $wpdb->query( $query ); |
|
100 | + if ( ! empty($sql)) { |
|
101 | + foreach ($sql as $query) { |
|
102 | + $wpdb->query($query); |
|
103 | 103 | } |
104 | 104 | } |
105 | 105 | |
@@ -119,16 +119,16 @@ discard block |
||
119 | 119 | */ |
120 | 120 | public function get_percentage_complete() { |
121 | 121 | |
122 | - $items = $this->get_stored_data( 'give_temp_delete_test_ids', false ); |
|
123 | - $total = count( $items ); |
|
122 | + $items = $this->get_stored_data('give_temp_delete_test_ids', false); |
|
123 | + $total = count($items); |
|
124 | 124 | |
125 | 125 | $percentage = 100; |
126 | 126 | |
127 | - if ( $total > 0 ) { |
|
128 | - $percentage = ( ( $this->per_step * $this->step ) / $total ) * 100; |
|
127 | + if ($total > 0) { |
|
128 | + $percentage = (($this->per_step * $this->step) / $total) * 100; |
|
129 | 129 | } |
130 | 130 | |
131 | - if ( $percentage > 100 ) { |
|
131 | + if ($percentage > 100) { |
|
132 | 132 | $percentage = 100; |
133 | 133 | } |
134 | 134 | |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | * |
143 | 143 | * @param array $request The Form Data passed into the batch processing |
144 | 144 | */ |
145 | - public function set_properties( $request ) { |
|
145 | + public function set_properties($request) { |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | /** |
@@ -153,29 +153,29 @@ discard block |
||
153 | 153 | */ |
154 | 154 | public function process_step() { |
155 | 155 | |
156 | - if ( ! $this->can_export() ) { |
|
157 | - wp_die( __( 'You do not have permission to delete test transactions.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
156 | + if ( ! $this->can_export()) { |
|
157 | + wp_die(__('You do not have permission to delete test transactions.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | $had_data = $this->get_data(); |
161 | 161 | |
162 | - if ( $had_data ) { |
|
162 | + if ($had_data) { |
|
163 | 163 | $this->done = false; |
164 | 164 | |
165 | 165 | return true; |
166 | 166 | } else { |
167 | - update_option( 'give_earnings_total', give_get_total_earnings( true ) ); |
|
168 | - Give_Cache::delete( Give_Cache::get_key('give_estimated_monthly_stats' ) ); |
|
167 | + update_option('give_earnings_total', give_get_total_earnings(true)); |
|
168 | + Give_Cache::delete(Give_Cache::get_key('give_estimated_monthly_stats')); |
|
169 | 169 | |
170 | - $this->delete_data( 'give_temp_delete_test_ids' ); |
|
170 | + $this->delete_data('give_temp_delete_test_ids'); |
|
171 | 171 | |
172 | 172 | // Reset the sequential order numbers |
173 | - if ( give_get_option( 'enable_sequential' ) ) { |
|
174 | - delete_option( 'give_last_payment_number' ); |
|
173 | + if (give_get_option('enable_sequential')) { |
|
174 | + delete_option('give_last_payment_number'); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | $this->done = true; |
178 | - $this->message = __( 'Test transactions successfully deleted.', 'give' ); |
|
178 | + $this->message = __('Test transactions successfully deleted.', 'give'); |
|
179 | 179 | |
180 | 180 | return false; |
181 | 181 | } |
@@ -185,10 +185,10 @@ discard block |
||
185 | 185 | * Headers |
186 | 186 | */ |
187 | 187 | public function headers() { |
188 | - ignore_user_abort( true ); |
|
188 | + ignore_user_abort(true); |
|
189 | 189 | |
190 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
191 | - set_time_limit( 0 ); |
|
190 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
191 | + set_time_limit(0); |
|
192 | 192 | } |
193 | 193 | } |
194 | 194 | |
@@ -212,26 +212,26 @@ discard block |
||
212 | 212 | */ |
213 | 213 | public function pre_fetch() { |
214 | 214 | |
215 | - if ( $this->step == 1 ) { |
|
216 | - $this->delete_data( 'give_temp_delete_test_ids' ); |
|
215 | + if ($this->step == 1) { |
|
216 | + $this->delete_data('give_temp_delete_test_ids'); |
|
217 | 217 | } |
218 | 218 | |
219 | - $items = get_option( 'give_temp_delete_test_ids', false ); |
|
219 | + $items = get_option('give_temp_delete_test_ids', false); |
|
220 | 220 | |
221 | - if ( false === $items ) { |
|
221 | + if (false === $items) { |
|
222 | 222 | $items = array(); |
223 | 223 | |
224 | - $args = apply_filters( 'give_tools_reset_stats_total_args', array( |
|
224 | + $args = apply_filters('give_tools_reset_stats_total_args', array( |
|
225 | 225 | 'post_type' => 'give_payment', |
226 | 226 | 'post_status' => 'any', |
227 | - 'posts_per_page' => - 1, |
|
227 | + 'posts_per_page' => -1, |
|
228 | 228 | // ONLY TEST MODE TRANSACTIONS!!! |
229 | 229 | 'meta_key' => '_give_payment_mode', |
230 | 230 | 'meta_value' => 'test' |
231 | - ) ); |
|
231 | + )); |
|
232 | 232 | |
233 | - $posts = get_posts( $args ); |
|
234 | - foreach ( $posts as $post ) { |
|
233 | + $posts = get_posts($args); |
|
234 | + foreach ($posts as $post) { |
|
235 | 235 | $items[] = array( |
236 | 236 | 'id' => (int) $post->ID, |
237 | 237 | 'type' => $post->post_type, |
@@ -240,9 +240,9 @@ discard block |
||
240 | 240 | |
241 | 241 | // Allow filtering of items to remove with an unassociative array for each item. |
242 | 242 | // The array contains the unique ID of the item, and a 'type' for you to use in the execution of the get_data method. |
243 | - $items = apply_filters( 'give_delete_test_items', $items ); |
|
243 | + $items = apply_filters('give_delete_test_items', $items); |
|
244 | 244 | |
245 | - $this->store_data( 'give_temp_delete_test_ids', $items ); |
|
245 | + $this->store_data('give_temp_delete_test_ids', $items); |
|
246 | 246 | } |
247 | 247 | |
248 | 248 | } |
@@ -256,11 +256,11 @@ discard block |
||
256 | 256 | * |
257 | 257 | * @return mixed Returns the data from the database |
258 | 258 | */ |
259 | - private function get_stored_data( $key ) { |
|
259 | + private function get_stored_data($key) { |
|
260 | 260 | global $wpdb; |
261 | - $value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) ); |
|
261 | + $value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key)); |
|
262 | 262 | |
263 | - return empty( $value ) ? false : maybe_unserialize( $value ); |
|
263 | + return empty($value) ? false : maybe_unserialize($value); |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | /** |
@@ -273,10 +273,10 @@ discard block |
||
273 | 273 | * |
274 | 274 | * @return void |
275 | 275 | */ |
276 | - private function store_data( $key, $value ) { |
|
276 | + private function store_data($key, $value) { |
|
277 | 277 | global $wpdb; |
278 | 278 | |
279 | - $value = maybe_serialize( $value ); |
|
279 | + $value = maybe_serialize($value); |
|
280 | 280 | |
281 | 281 | $data = array( |
282 | 282 | 'option_name' => $key, |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | '%s', |
291 | 291 | ); |
292 | 292 | |
293 | - $wpdb->replace( $wpdb->options, $data, $formats ); |
|
293 | + $wpdb->replace($wpdb->options, $data, $formats); |
|
294 | 294 | } |
295 | 295 | |
296 | 296 | /** |
@@ -302,9 +302,9 @@ discard block |
||
302 | 302 | * |
303 | 303 | * @return void |
304 | 304 | */ |
305 | - private function delete_data( $key ) { |
|
305 | + private function delete_data($key) { |
|
306 | 306 | global $wpdb; |
307 | - $wpdb->delete( $wpdb->options, array( 'option_name' => $key ) ); |
|
307 | + $wpdb->delete($wpdb->options, array('option_name' => $key)); |
|
308 | 308 | } |
309 | 309 | |
310 | 310 | } |