@@ -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 | |
@@ -53,19 +53,19 @@ discard block |
||
53 | 53 | * @return array|bool $data The data for the CSV file |
54 | 54 | */ |
55 | 55 | public function get_data() { |
56 | - $items = $this->get_stored_data( 'give_temp_delete_test_ids' ); |
|
56 | + $items = $this->get_stored_data('give_temp_delete_test_ids'); |
|
57 | 57 | |
58 | - if ( ! is_array( $items ) ) { |
|
58 | + if ( ! is_array($items)) { |
|
59 | 59 | return false; |
60 | 60 | } |
61 | 61 | |
62 | - $offset = ( $this->step - 1 ) * $this->per_step; |
|
63 | - $step_items = array_slice( $items, $offset, $this->per_step ); |
|
62 | + $offset = ($this->step - 1) * $this->per_step; |
|
63 | + $step_items = array_slice($items, $offset, $this->per_step); |
|
64 | 64 | |
65 | - if ( $step_items ) { |
|
66 | - foreach ( $step_items as $item ) { |
|
65 | + if ($step_items) { |
|
66 | + foreach ($step_items as $item) { |
|
67 | 67 | // Delete the main payment. |
68 | - give_delete_donation( absint( $item['id'] ) ); |
|
68 | + give_delete_donation(absint($item['id'])); |
|
69 | 69 | } |
70 | 70 | return true; |
71 | 71 | } |
@@ -81,16 +81,16 @@ discard block |
||
81 | 81 | */ |
82 | 82 | public function get_percentage_complete() { |
83 | 83 | |
84 | - $items = $this->get_stored_data( 'give_temp_delete_test_ids', false ); |
|
85 | - $total = count( $items ); |
|
84 | + $items = $this->get_stored_data('give_temp_delete_test_ids', false); |
|
85 | + $total = count($items); |
|
86 | 86 | |
87 | 87 | $percentage = 100; |
88 | 88 | |
89 | - if ( $total > 0 ) { |
|
90 | - $percentage = ( ( $this->per_step * $this->step ) / $total ) * 100; |
|
89 | + if ($total > 0) { |
|
90 | + $percentage = (($this->per_step * $this->step) / $total) * 100; |
|
91 | 91 | } |
92 | 92 | |
93 | - if ( $percentage > 100 ) { |
|
93 | + if ($percentage > 100) { |
|
94 | 94 | $percentage = 100; |
95 | 95 | } |
96 | 96 | |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | * |
105 | 105 | * @param array $request The Form Data passed into the batch processing |
106 | 106 | */ |
107 | - public function set_properties( $request ) { |
|
107 | + public function set_properties($request) { |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | /** |
@@ -115,29 +115,29 @@ discard block |
||
115 | 115 | */ |
116 | 116 | public function process_step() { |
117 | 117 | |
118 | - if ( ! $this->can_export() ) { |
|
119 | - wp_die( __( 'You do not have permission to delete test transactions.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
118 | + if ( ! $this->can_export()) { |
|
119 | + wp_die(__('You do not have permission to delete test transactions.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | $had_data = $this->get_data(); |
123 | 123 | |
124 | - if ( $had_data ) { |
|
124 | + if ($had_data) { |
|
125 | 125 | $this->done = false; |
126 | 126 | |
127 | 127 | return true; |
128 | 128 | } else { |
129 | - update_option( 'give_earnings_total', give_get_total_earnings( true ) ); |
|
130 | - Give_Cache::delete( Give_Cache::get_key( 'give_estimated_monthly_stats' ) ); |
|
129 | + update_option('give_earnings_total', give_get_total_earnings(true)); |
|
130 | + Give_Cache::delete(Give_Cache::get_key('give_estimated_monthly_stats')); |
|
131 | 131 | |
132 | - $this->delete_data( 'give_temp_delete_test_ids' ); |
|
132 | + $this->delete_data('give_temp_delete_test_ids'); |
|
133 | 133 | |
134 | 134 | // Reset the sequential order numbers |
135 | - if ( give_get_option( 'enable_sequential' ) ) { |
|
136 | - delete_option( 'give_last_payment_number' ); |
|
135 | + if (give_get_option('enable_sequential')) { |
|
136 | + delete_option('give_last_payment_number'); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | $this->done = true; |
140 | - $this->message = __( 'Test transactions successfully deleted.', 'give' ); |
|
140 | + $this->message = __('Test transactions successfully deleted.', 'give'); |
|
141 | 141 | |
142 | 142 | return false; |
143 | 143 | } |
@@ -170,27 +170,27 @@ discard block |
||
170 | 170 | */ |
171 | 171 | public function pre_fetch() { |
172 | 172 | |
173 | - if ( $this->step == 1 ) { |
|
174 | - $this->delete_data( 'give_temp_delete_test_ids' ); |
|
173 | + if ($this->step == 1) { |
|
174 | + $this->delete_data('give_temp_delete_test_ids'); |
|
175 | 175 | } |
176 | 176 | |
177 | - $items = get_option( 'give_temp_delete_test_ids', false ); |
|
177 | + $items = get_option('give_temp_delete_test_ids', false); |
|
178 | 178 | |
179 | - if ( false === $items ) { |
|
179 | + if (false === $items) { |
|
180 | 180 | $items = array(); |
181 | 181 | |
182 | - $args = apply_filters( 'give_tools_reset_stats_total_args', array( |
|
182 | + $args = apply_filters('give_tools_reset_stats_total_args', array( |
|
183 | 183 | 'post_status' => 'any', |
184 | - 'number' => - 1, |
|
184 | + 'number' => -1, |
|
185 | 185 | 'meta_key' => '_give_payment_mode', |
186 | 186 | 'meta_value' => 'test' |
187 | - ) ); |
|
187 | + )); |
|
188 | 188 | |
189 | - $posts = new Give_Payments_Query( $args ); |
|
189 | + $posts = new Give_Payments_Query($args); |
|
190 | 190 | $payments = $posts->get_payments(); |
191 | 191 | |
192 | 192 | /* @var Give_Payment $payment */ |
193 | - foreach ( $payments as $payment ) { |
|
193 | + foreach ($payments as $payment) { |
|
194 | 194 | $items[] = array( |
195 | 195 | 'id' => (int) $payment->ID, |
196 | 196 | 'type' => 'give_payment', |
@@ -199,9 +199,9 @@ discard block |
||
199 | 199 | |
200 | 200 | // Allow filtering of items to remove with an unassociative array for each item. |
201 | 201 | // The array contains the unique ID of the item, and a 'type' for you to use in the execution of the get_data method. |
202 | - $items = apply_filters( 'give_delete_test_items', $items ); |
|
202 | + $items = apply_filters('give_delete_test_items', $items); |
|
203 | 203 | |
204 | - $this->store_data( 'give_temp_delete_test_ids', $items ); |
|
204 | + $this->store_data('give_temp_delete_test_ids', $items); |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | } |
@@ -215,17 +215,17 @@ discard block |
||
215 | 215 | * |
216 | 216 | * @return mixed Returns the data from the database |
217 | 217 | */ |
218 | - private function get_stored_data( $key ) { |
|
218 | + private function get_stored_data($key) { |
|
219 | 219 | global $wpdb; |
220 | - $value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) ); |
|
220 | + $value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key)); |
|
221 | 221 | |
222 | - if ( empty( $value ) ) { |
|
222 | + if (empty($value)) { |
|
223 | 223 | return false; |
224 | 224 | } |
225 | 225 | |
226 | - $maybe_json = json_decode( $value ); |
|
227 | - if ( ! is_null( $maybe_json ) ) { |
|
228 | - $value = json_decode( $value, true ); |
|
226 | + $maybe_json = json_decode($value); |
|
227 | + if ( ! is_null($maybe_json)) { |
|
228 | + $value = json_decode($value, true); |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | return $value; |
@@ -241,10 +241,10 @@ discard block |
||
241 | 241 | * |
242 | 242 | * @return void |
243 | 243 | */ |
244 | - private function store_data( $key, $value ) { |
|
244 | + private function store_data($key, $value) { |
|
245 | 245 | global $wpdb; |
246 | 246 | |
247 | - $value = is_array( $value ) ? wp_json_encode( $value ) : esc_attr( $value ); |
|
247 | + $value = is_array($value) ? wp_json_encode($value) : esc_attr($value); |
|
248 | 248 | |
249 | 249 | $data = array( |
250 | 250 | 'option_name' => $key, |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | '%s', |
259 | 259 | ); |
260 | 260 | |
261 | - $wpdb->replace( $wpdb->options, $data, $formats ); |
|
261 | + $wpdb->replace($wpdb->options, $data, $formats); |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | /** |
@@ -270,9 +270,9 @@ discard block |
||
270 | 270 | * |
271 | 271 | * @return void |
272 | 272 | */ |
273 | - private function delete_data( $key ) { |
|
273 | + private function delete_data($key) { |
|
274 | 274 | global $wpdb; |
275 | - $wpdb->delete( $wpdb->options, array( 'option_name' => $key ) ); |
|
275 | + $wpdb->delete($wpdb->options, array('option_name' => $key)); |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | } |
@@ -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 | |
@@ -39,30 +39,30 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function csv_cols() { |
41 | 41 | $cols = array( |
42 | - 'id' => __( 'ID', 'give' ), // unaltered payment ID (use for querying). |
|
43 | - 'seq_id' => __( 'Payment Number', 'give' ), // sequential payment ID. |
|
44 | - 'email' => __( 'Email', 'give' ), |
|
45 | - 'first' => __( 'First Name', 'give' ), |
|
46 | - 'last' => __( 'Last Name', 'give' ), |
|
47 | - 'address1' => __( 'Address 1', 'give' ), |
|
48 | - 'address2' => __( 'Address 2', 'give' ), |
|
49 | - 'city' => __( 'City', 'give' ), |
|
50 | - 'state' => __( 'State', 'give' ), |
|
51 | - 'country' => __( 'Country', 'give' ), |
|
52 | - 'zip' => __( 'Zip / Postal Code', 'give' ), |
|
53 | - 'form_id' => __( 'Form ID', 'give' ), |
|
54 | - 'form_name' => __( 'Form Name', 'give' ), |
|
55 | - 'amount' => __( 'Amount', 'give' ) . ' (' . give_currency_symbol( '', true ) . ')', |
|
56 | - 'gateway' => __( 'Payment Method', 'give' ), |
|
57 | - 'trans_id' => __( 'Transaction ID', 'give' ), |
|
58 | - 'key' => __( 'Key', 'give' ), |
|
59 | - 'date' => __( 'Date', 'give' ), |
|
60 | - 'user' => __( 'User', 'give' ), |
|
61 | - 'status' => __( 'Status', 'give' ) |
|
42 | + 'id' => __('ID', 'give'), // unaltered payment ID (use for querying). |
|
43 | + 'seq_id' => __('Payment Number', 'give'), // sequential payment ID. |
|
44 | + 'email' => __('Email', 'give'), |
|
45 | + 'first' => __('First Name', 'give'), |
|
46 | + 'last' => __('Last Name', 'give'), |
|
47 | + 'address1' => __('Address 1', 'give'), |
|
48 | + 'address2' => __('Address 2', 'give'), |
|
49 | + 'city' => __('City', 'give'), |
|
50 | + 'state' => __('State', 'give'), |
|
51 | + 'country' => __('Country', 'give'), |
|
52 | + 'zip' => __('Zip / Postal Code', 'give'), |
|
53 | + 'form_id' => __('Form ID', 'give'), |
|
54 | + 'form_name' => __('Form Name', 'give'), |
|
55 | + 'amount' => __('Amount', 'give').' ('.give_currency_symbol('', true).')', |
|
56 | + 'gateway' => __('Payment Method', 'give'), |
|
57 | + 'trans_id' => __('Transaction ID', 'give'), |
|
58 | + 'key' => __('Key', 'give'), |
|
59 | + 'date' => __('Date', 'give'), |
|
60 | + 'user' => __('User', 'give'), |
|
61 | + 'status' => __('Status', 'give') |
|
62 | 62 | ); |
63 | 63 | |
64 | - if ( ! give_get_option( 'enable_sequential' ) ) { |
|
65 | - unset( $cols['seq_id'] ); |
|
64 | + if ( ! give_get_option('enable_sequential')) { |
|
65 | + unset($cols['seq_id']); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | return $cols; |
@@ -86,12 +86,12 @@ discard block |
||
86 | 86 | 'status' => $this->status |
87 | 87 | ); |
88 | 88 | |
89 | - if ( ! empty( $this->start ) || ! empty( $this->end ) ) { |
|
89 | + if ( ! empty($this->start) || ! empty($this->end)) { |
|
90 | 90 | |
91 | 91 | $args['date_query'] = array( |
92 | 92 | array( |
93 | - 'after' => date( 'Y-n-d 00:00:00', strtotime( $this->start ) ), |
|
94 | - 'before' => date( 'Y-n-d 23:59:59', strtotime( $this->end ) ), |
|
93 | + 'after' => date('Y-n-d 00:00:00', strtotime($this->start)), |
|
94 | + 'before' => date('Y-n-d 23:59:59', strtotime($this->end)), |
|
95 | 95 | 'inclusive' => true |
96 | 96 | ) |
97 | 97 | ); |
@@ -99,11 +99,11 @@ discard block |
||
99 | 99 | } |
100 | 100 | |
101 | 101 | // Add category or tag to payment query if any. |
102 | - if ( ! empty( $this->categories ) || ! empty( $this->tags ) ) { |
|
102 | + if ( ! empty($this->categories) || ! empty($this->tags)) { |
|
103 | 103 | $form_args = array( |
104 | 104 | 'post_type' => 'give_forms', |
105 | 105 | 'post_status' => 'publish', |
106 | - 'posts_per_page' => - 1, |
|
106 | + 'posts_per_page' => -1, |
|
107 | 107 | 'fields' => 'ids', |
108 | 108 | 'tax_query' => array( |
109 | 109 | 'relation' => 'AND', |
@@ -111,72 +111,72 @@ discard block |
||
111 | 111 | ); |
112 | 112 | |
113 | 113 | |
114 | - if ( ! empty( $this->categories ) ) { |
|
114 | + if ( ! empty($this->categories)) { |
|
115 | 115 | $form_args['tax_query'][] = array( |
116 | 116 | 'taxonomy' => 'give_forms_category', |
117 | 117 | 'terms' => $this->categories, |
118 | 118 | ); |
119 | 119 | } |
120 | 120 | |
121 | - if ( ! empty( $this->tags ) ) { |
|
121 | + if ( ! empty($this->tags)) { |
|
122 | 122 | $form_args['tax_query'][] = array( |
123 | 123 | 'taxonomy' => 'give_forms_tag', |
124 | 124 | 'terms' => $this->tags, |
125 | 125 | ); |
126 | 126 | } |
127 | 127 | |
128 | - $forms = new WP_Query( $form_args ); |
|
128 | + $forms = new WP_Query($form_args); |
|
129 | 129 | |
130 | - if ( empty( $forms->posts ) ) { |
|
130 | + if (empty($forms->posts)) { |
|
131 | 131 | return array(); |
132 | 132 | } |
133 | 133 | |
134 | 134 | $args['give_forms'] = $forms->posts; |
135 | 135 | } |
136 | 136 | |
137 | - $payments = give_get_payments( $args ); |
|
137 | + $payments = give_get_payments($args); |
|
138 | 138 | |
139 | - if ( $payments ) { |
|
139 | + if ($payments) { |
|
140 | 140 | |
141 | - foreach ( $payments as $payment ) { |
|
142 | - $payment_meta = give_get_payment_meta( $payment->ID ); |
|
143 | - $user_info = give_get_payment_meta_user_info( $payment->ID ); |
|
144 | - $total = give_donation_amount( $payment->ID, array( 'type' => 'stats' ) ); |
|
145 | - $user_id = isset( $user_info['id'] ) && $user_info['id'] != - 1 ? $user_info['id'] : $user_info['email']; |
|
141 | + foreach ($payments as $payment) { |
|
142 | + $payment_meta = give_get_payment_meta($payment->ID); |
|
143 | + $user_info = give_get_payment_meta_user_info($payment->ID); |
|
144 | + $total = give_donation_amount($payment->ID, array('type' => 'stats')); |
|
145 | + $user_id = isset($user_info['id']) && $user_info['id'] != - 1 ? $user_info['id'] : $user_info['email']; |
|
146 | 146 | |
147 | - if ( is_numeric( $user_id ) ) { |
|
148 | - $user = get_userdata( $user_id ); |
|
147 | + if (is_numeric($user_id)) { |
|
148 | + $user = get_userdata($user_id); |
|
149 | 149 | } else { |
150 | 150 | $user = false; |
151 | 151 | } |
152 | 152 | |
153 | 153 | $data[] = array( |
154 | 154 | 'id' => $payment->ID, |
155 | - 'seq_id' => give_get_payment_number( $payment->ID ), |
|
155 | + 'seq_id' => give_get_payment_number($payment->ID), |
|
156 | 156 | 'email' => $payment_meta['email'], |
157 | 157 | 'first' => $user_info['first_name'], |
158 | 158 | 'last' => $user_info['last_name'], |
159 | - 'address1' => isset( $user_info['address']['line1'] ) ? $user_info['address']['line1'] : '', |
|
160 | - 'address2' => isset( $user_info['address']['line2'] ) ? $user_info['address']['line2'] : '', |
|
161 | - 'city' => isset( $user_info['address']['city'] ) ? $user_info['address']['city'] : '', |
|
162 | - 'state' => isset( $user_info['address']['state'] ) ? $user_info['address']['state'] : '', |
|
163 | - 'country' => isset( $user_info['address']['country'] ) ? $user_info['address']['country'] : '', |
|
164 | - 'zip' => isset( $user_info['address']['zip'] ) ? $user_info['address']['zip'] : '', |
|
165 | - 'form_id' => isset( $payment_meta['form_id'] ) ? $payment_meta['form_id'] : '', |
|
166 | - 'form_name' => isset( $payment_meta['form_title'] ) ? $payment_meta['form_title'] : '', |
|
167 | - 'amount' => html_entity_decode( give_format_amount( $total, array( 'sanitize' => false ) ) ), |
|
168 | - 'gateway' => give_get_gateway_admin_label( give_get_meta( $payment->ID, '_give_payment_gateway', true ) ), |
|
169 | - 'trans_id' => give_get_payment_transaction_id( $payment->ID ), |
|
159 | + 'address1' => isset($user_info['address']['line1']) ? $user_info['address']['line1'] : '', |
|
160 | + 'address2' => isset($user_info['address']['line2']) ? $user_info['address']['line2'] : '', |
|
161 | + 'city' => isset($user_info['address']['city']) ? $user_info['address']['city'] : '', |
|
162 | + 'state' => isset($user_info['address']['state']) ? $user_info['address']['state'] : '', |
|
163 | + 'country' => isset($user_info['address']['country']) ? $user_info['address']['country'] : '', |
|
164 | + 'zip' => isset($user_info['address']['zip']) ? $user_info['address']['zip'] : '', |
|
165 | + 'form_id' => isset($payment_meta['form_id']) ? $payment_meta['form_id'] : '', |
|
166 | + 'form_name' => isset($payment_meta['form_title']) ? $payment_meta['form_title'] : '', |
|
167 | + 'amount' => html_entity_decode(give_format_amount($total, array('sanitize' => false))), |
|
168 | + 'gateway' => give_get_gateway_admin_label(give_get_meta($payment->ID, '_give_payment_gateway', true)), |
|
169 | + 'trans_id' => give_get_payment_transaction_id($payment->ID), |
|
170 | 170 | 'key' => $payment_meta['key'], |
171 | 171 | 'date' => $payment->post_date, |
172 | - 'user' => $user ? $user->display_name : __( 'guest', 'give' ), |
|
173 | - 'status' => give_get_payment_status( $payment, true ) |
|
172 | + 'user' => $user ? $user->display_name : __('guest', 'give'), |
|
173 | + 'status' => give_get_payment_status($payment, true) |
|
174 | 174 | ); |
175 | 175 | |
176 | 176 | } |
177 | 177 | |
178 | - $data = apply_filters( 'give_export_get_data', $data ); |
|
179 | - $data = apply_filters( "give_export_get_data_{$this->export_type}", $data ); |
|
178 | + $data = apply_filters('give_export_get_data', $data); |
|
179 | + $data = apply_filters("give_export_get_data_{$this->export_type}", $data); |
|
180 | 180 | |
181 | 181 | return $data; |
182 | 182 | |
@@ -196,27 +196,27 @@ discard block |
||
196 | 196 | |
197 | 197 | $status = $this->status; |
198 | 198 | $args = array( |
199 | - 'start-date' => date( 'n/d/Y', strtotime( $this->start ) ), |
|
200 | - 'end-date' => date( 'n/d/Y', strtotime( $this->end ) ), |
|
199 | + 'start-date' => date('n/d/Y', strtotime($this->start)), |
|
200 | + 'end-date' => date('n/d/Y', strtotime($this->end)), |
|
201 | 201 | ); |
202 | 202 | |
203 | - if ( 'any' == $status ) { |
|
203 | + if ('any' == $status) { |
|
204 | 204 | |
205 | - $total = array_sum( (array) give_count_payments( $args ) ); |
|
205 | + $total = array_sum((array) give_count_payments($args)); |
|
206 | 206 | |
207 | 207 | } else { |
208 | 208 | |
209 | - $total = give_count_payments( $args )->$status; |
|
209 | + $total = give_count_payments($args)->$status; |
|
210 | 210 | |
211 | 211 | } |
212 | 212 | |
213 | 213 | $percentage = 100; |
214 | 214 | |
215 | - if ( $total > 0 ) { |
|
216 | - $percentage = ( ( 30 * $this->step ) / $total ) * 100; |
|
215 | + if ($total > 0) { |
|
216 | + $percentage = ((30 * $this->step) / $total) * 100; |
|
217 | 217 | } |
218 | 218 | |
219 | - if ( $percentage > 100 ) { |
|
219 | + if ($percentage > 100) { |
|
220 | 220 | $percentage = 100; |
221 | 221 | } |
222 | 222 | |
@@ -230,11 +230,11 @@ discard block |
||
230 | 230 | * |
231 | 231 | * @param array $request The Form Data passed into the batch processing. |
232 | 232 | */ |
233 | - public function set_properties( $request ) { |
|
234 | - $this->start = isset( $request['start'] ) ? sanitize_text_field( $request['start'] ) : ''; |
|
235 | - $this->end = isset( $request['end'] ) ? sanitize_text_field( $request['end'] ) : ''; |
|
236 | - $this->status = isset( $request['status'] ) ? sanitize_text_field( $request['status'] ) : 'complete'; |
|
237 | - $this->categories = isset( $request['give_forms_categories'] ) ? give_clean( $request['give_forms_categories'] ) : array(); |
|
238 | - $this->tags = isset( $request['give_forms_tags'] ) ? give_clean( $request['give_forms_tags'] ) : array(); |
|
233 | + public function set_properties($request) { |
|
234 | + $this->start = isset($request['start']) ? sanitize_text_field($request['start']) : ''; |
|
235 | + $this->end = isset($request['end']) ? sanitize_text_field($request['end']) : ''; |
|
236 | + $this->status = isset($request['status']) ? sanitize_text_field($request['status']) : 'complete'; |
|
237 | + $this->categories = isset($request['give_forms_categories']) ? give_clean($request['give_forms_categories']) : array(); |
|
238 | + $this->tags = isset($request['give_forms_tags']) ? give_clean($request['give_forms_tags']) : array(); |
|
239 | 239 | } |
240 | 240 | } |
@@ -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,134 +25,134 @@ discard block |
||
25 | 25 | * |
26 | 26 | * @uses give_pdf |
27 | 27 | */ |
28 | -function give_generate_pdf( $data ) { |
|
28 | +function give_generate_pdf($data) { |
|
29 | 29 | |
30 | - if ( ! current_user_can( 'view_give_reports' ) ) { |
|
31 | - wp_die( __( 'You do not have permission to generate PDF sales reports.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
30 | + if ( ! current_user_can('view_give_reports')) { |
|
31 | + wp_die(__('You do not have permission to generate PDF sales reports.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
32 | 32 | } |
33 | 33 | |
34 | - if ( ! wp_verify_nonce( $_GET['_wpnonce'], 'give_generate_pdf' ) ) { |
|
35 | - wp_die( __( 'Nonce verification failed.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
34 | + if ( ! wp_verify_nonce($_GET['_wpnonce'], 'give_generate_pdf')) { |
|
35 | + wp_die(__('Nonce verification failed.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
36 | 36 | } |
37 | 37 | |
38 | - if ( ! file_exists( GIVE_PLUGIN_DIR . '/includes/libraries/give-pdf.php' ) ) { |
|
39 | - wp_die( __( 'Dependency missing.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
38 | + if ( ! file_exists(GIVE_PLUGIN_DIR.'/includes/libraries/give-pdf.php')) { |
|
39 | + wp_die(__('Dependency missing.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
40 | 40 | } |
41 | 41 | |
42 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/give-pdf.php'; |
|
42 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/give-pdf.php'; |
|
43 | 43 | |
44 | 44 | $daterange = utf8_decode( |
45 | 45 | sprintf( |
46 | 46 | /* translators: 1: start date 2: end date */ |
47 | - __( '%1$s to %2$s', 'give' ), |
|
48 | - date_i18n( give_date_format(), mktime( 0, 0, 0, 1, 1, date( 'Y' ) ) ), |
|
49 | - date_i18n( give_date_format() ) |
|
47 | + __('%1$s to %2$s', 'give'), |
|
48 | + date_i18n(give_date_format(), mktime(0, 0, 0, 1, 1, date('Y'))), |
|
49 | + date_i18n(give_date_format()) |
|
50 | 50 | ) |
51 | 51 | ); |
52 | 52 | |
53 | - $categories_enabled = give_is_setting_enabled( give_get_option( 'categories', 'disabled' ) ); |
|
54 | - $tags_enabled = give_is_setting_enabled( give_get_option( 'tags', 'disabled' ) ); |
|
53 | + $categories_enabled = give_is_setting_enabled(give_get_option('categories', 'disabled')); |
|
54 | + $tags_enabled = give_is_setting_enabled(give_get_option('tags', 'disabled')); |
|
55 | 55 | |
56 | - $pdf = new Give_PDF( 'L', 'mm', 'A', true, 'UTF-8', false ); |
|
57 | - $default_font = apply_filters( 'give_pdf_default_font', 'Helvetica' ); |
|
56 | + $pdf = new Give_PDF('L', 'mm', 'A', true, 'UTF-8', false); |
|
57 | + $default_font = apply_filters('give_pdf_default_font', 'Helvetica'); |
|
58 | 58 | $custom_font = 'dejavusans'; |
59 | 59 | $font_style = ''; |
60 | 60 | |
61 | 61 | if ( |
62 | - file_exists( GIVE_PLUGIN_DIR . '/includes/libraries/tcpdf/fonts/CODE2000.TTF' ) && |
|
62 | + file_exists(GIVE_PLUGIN_DIR.'/includes/libraries/tcpdf/fonts/CODE2000.TTF') && |
|
63 | 63 | |
64 | 64 | // RIAL exist for backward compatibility. |
65 | - in_array( give_get_currency(), array( 'RIAL', 'RUB', 'IRR' ) ) |
|
65 | + in_array(give_get_currency(), array('RIAL', 'RUB', 'IRR')) |
|
66 | 66 | ) { |
67 | - TCPDF_FONTS::addTTFfont( GIVE_PLUGIN_DIR . '/includes/libraries/tcpdf/fonts/CODE2000.TTF', '' ); |
|
67 | + TCPDF_FONTS::addTTFfont(GIVE_PLUGIN_DIR.'/includes/libraries/tcpdf/fonts/CODE2000.TTF', ''); |
|
68 | 68 | $custom_font = 'CODE2000'; |
69 | 69 | $font_style = 'B'; |
70 | 70 | } |
71 | 71 | |
72 | - $pdf->AddPage( 'L', 'A4' ); |
|
73 | - $pdf->setImageScale( 1.5 ); |
|
74 | - $pdf->SetTitle( utf8_decode( __( 'Donation report for the current year for all forms', 'give' ) ) ); |
|
75 | - $pdf->SetAuthor( utf8_decode( __( 'Give - Democratizing Generosity', 'give' ) ) ); |
|
76 | - $pdf->SetCreator( utf8_decode( __( 'Give - Democratizing Generosity', 'give' ) ) ); |
|
72 | + $pdf->AddPage('L', 'A4'); |
|
73 | + $pdf->setImageScale(1.5); |
|
74 | + $pdf->SetTitle(utf8_decode(__('Donation report for the current year for all forms', 'give'))); |
|
75 | + $pdf->SetAuthor(utf8_decode(__('Give - Democratizing Generosity', 'give'))); |
|
76 | + $pdf->SetCreator(utf8_decode(__('Give - Democratizing Generosity', 'give'))); |
|
77 | 77 | |
78 | - $pdf->Image( apply_filters( 'give_pdf_export_logo', GIVE_PLUGIN_URL . 'assets/images/give-logo-small.png' ), 247, 8 ); |
|
78 | + $pdf->Image(apply_filters('give_pdf_export_logo', GIVE_PLUGIN_URL.'assets/images/give-logo-small.png'), 247, 8); |
|
79 | 79 | |
80 | - $pdf->SetMargins( 8, 8, 8 ); |
|
81 | - $pdf->SetX( 8 ); |
|
80 | + $pdf->SetMargins(8, 8, 8); |
|
81 | + $pdf->SetX(8); |
|
82 | 82 | |
83 | - $pdf->SetFont( $default_font, '', 16 ); |
|
84 | - $pdf->SetTextColor( 50, 50, 50 ); |
|
85 | - $pdf->Cell( 0, 3, utf8_decode( __( 'Donation report for the current year for all forms', 'give' ) ), 0, 2, 'L', false ); |
|
83 | + $pdf->SetFont($default_font, '', 16); |
|
84 | + $pdf->SetTextColor(50, 50, 50); |
|
85 | + $pdf->Cell(0, 3, utf8_decode(__('Donation report for the current year for all forms', 'give')), 0, 2, 'L', false); |
|
86 | 86 | |
87 | - $pdf->SetFont( $default_font, '', 13 ); |
|
88 | - $pdf->SetTextColor( 150, 150, 150 ); |
|
89 | - $pdf->Ln( 1 ); |
|
90 | - $pdf->Cell( 0, 6, utf8_decode( __( 'Date Range: ', 'give' ) ) . $daterange, 0, 2, 'L', false ); |
|
87 | + $pdf->SetFont($default_font, '', 13); |
|
88 | + $pdf->SetTextColor(150, 150, 150); |
|
89 | + $pdf->Ln(1); |
|
90 | + $pdf->Cell(0, 6, utf8_decode(__('Date Range: ', 'give')).$daterange, 0, 2, 'L', false); |
|
91 | 91 | $pdf->Ln(); |
92 | - $pdf->SetTextColor( 50, 50, 50 ); |
|
93 | - $pdf->SetFont( $default_font, '', 14 ); |
|
94 | - $pdf->Cell( 0, 10, utf8_decode( __( 'Table View', 'give' ) ), 0, 2, 'L', false ); |
|
95 | - $pdf->SetFont( $default_font, '', 12 ); |
|
92 | + $pdf->SetTextColor(50, 50, 50); |
|
93 | + $pdf->SetFont($default_font, '', 14); |
|
94 | + $pdf->Cell(0, 10, utf8_decode(__('Table View', 'give')), 0, 2, 'L', false); |
|
95 | + $pdf->SetFont($default_font, '', 12); |
|
96 | 96 | |
97 | - $pdf->SetFillColor( 238, 238, 238 ); |
|
98 | - $pdf->SetTextColor( 0, 0, 0, 100 ); // Set Black color. |
|
99 | - $pdf->Cell( 50, 6, utf8_decode( __( 'Form Name', 'give' ) ), 1, 0, 'L', true ); |
|
100 | - $pdf->Cell( 50, 6, utf8_decode( __( 'Price', 'give' ) ), 1, 0, 'L', true ); |
|
97 | + $pdf->SetFillColor(238, 238, 238); |
|
98 | + $pdf->SetTextColor(0, 0, 0, 100); // Set Black color. |
|
99 | + $pdf->Cell(50, 6, utf8_decode(__('Form Name', 'give')), 1, 0, 'L', true); |
|
100 | + $pdf->Cell(50, 6, utf8_decode(__('Price', 'give')), 1, 0, 'L', true); |
|
101 | 101 | |
102 | 102 | // Display Categories Heading only, if user has opted for it. |
103 | - if ( $categories_enabled ) { |
|
104 | - $pdf->Cell( 45, 6, utf8_decode( __( 'Categories', 'give' ) ), 1, 0, 'L', true ); |
|
103 | + if ($categories_enabled) { |
|
104 | + $pdf->Cell(45, 6, utf8_decode(__('Categories', 'give')), 1, 0, 'L', true); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | // Display Tags Heading only, if user has opted for it. |
108 | - if ( $tags_enabled ) { |
|
109 | - $pdf->Cell( 45, 6, utf8_decode( __( 'Tags', 'give' ) ), 1, 0, 'L', true ); |
|
108 | + if ($tags_enabled) { |
|
109 | + $pdf->Cell(45, 6, utf8_decode(__('Tags', 'give')), 1, 0, 'L', true); |
|
110 | 110 | } |
111 | 111 | |
112 | - $pdf->Cell( 45, 6, utf8_decode( __( 'Number of Donations', 'give' ) ), 1, 0, 'L', true ); |
|
113 | - $pdf->Cell( 45, 6, utf8_decode( __( 'Income to Date', 'give' ) ), 1, 1, 'L', true ); |
|
112 | + $pdf->Cell(45, 6, utf8_decode(__('Number of Donations', 'give')), 1, 0, 'L', true); |
|
113 | + $pdf->Cell(45, 6, utf8_decode(__('Income to Date', 'give')), 1, 1, 'L', true); |
|
114 | 114 | |
115 | 115 | // Set Custom Font to support various currencies. |
116 | - $pdf->SetFont( apply_filters( 'give_pdf_custom_font', $custom_font ), $font_style, 12 ); |
|
116 | + $pdf->SetFont(apply_filters('give_pdf_custom_font', $custom_font), $font_style, 12); |
|
117 | 117 | |
118 | - $year = date( 'Y' ); |
|
119 | - $give_forms = get_posts( array( |
|
118 | + $year = date('Y'); |
|
119 | + $give_forms = get_posts(array( |
|
120 | 120 | 'post_type' => 'give_forms', |
121 | 121 | 'year' => $year, |
122 | - 'posts_per_page' => - 1, |
|
122 | + 'posts_per_page' => -1, |
|
123 | 123 | 'supply_filter' => false, |
124 | - ) ); |
|
124 | + )); |
|
125 | 125 | |
126 | - if ( $give_forms ) { |
|
127 | - $pdf->SetWidths( array( 50, 50, 45, 45, 45, 45 ) ); |
|
126 | + if ($give_forms) { |
|
127 | + $pdf->SetWidths(array(50, 50, 45, 45, 45, 45)); |
|
128 | 128 | |
129 | - foreach ( $give_forms as $form ): |
|
130 | - $pdf->SetFillColor( 255, 255, 255 ); |
|
129 | + foreach ($give_forms as $form): |
|
130 | + $pdf->SetFillColor(255, 255, 255); |
|
131 | 131 | |
132 | 132 | $title = $form->post_title; |
133 | 133 | |
134 | - if ( give_has_variable_prices( $form->ID ) ) { |
|
135 | - $price = html_entity_decode( give_price_range( $form->ID, false ), ENT_COMPAT, 'UTF-8' ); |
|
134 | + if (give_has_variable_prices($form->ID)) { |
|
135 | + $price = html_entity_decode(give_price_range($form->ID, false), ENT_COMPAT, 'UTF-8'); |
|
136 | 136 | } else { |
137 | - $price = give_currency_filter( give_get_form_price( $form->ID ), array( 'decode_currency' => true ) ); |
|
137 | + $price = give_currency_filter(give_get_form_price($form->ID), array('decode_currency' => true)); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | // Display Categories Data only, if user has opted for it. |
141 | 141 | $categories = array(); |
142 | - if ( $categories_enabled ) { |
|
143 | - $categories = get_the_term_list( $form->ID, 'give_forms_category', '', ', ', '' ); |
|
144 | - $categories = ! is_wp_error( $categories ) ? strip_tags( $categories ) : ''; |
|
142 | + if ($categories_enabled) { |
|
143 | + $categories = get_the_term_list($form->ID, 'give_forms_category', '', ', ', ''); |
|
144 | + $categories = ! is_wp_error($categories) ? strip_tags($categories) : ''; |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | // Display Tags Data only, if user has opted for it. |
148 | 148 | $tags = array(); |
149 | - if ( $tags_enabled ) { |
|
150 | - $tags = get_the_term_list( $form->ID, 'give_forms_tag', '', ', ', '' ); |
|
151 | - $tags = ! is_wp_error( $tags ) ? strip_tags( $tags ) : ''; |
|
149 | + if ($tags_enabled) { |
|
150 | + $tags = get_the_term_list($form->ID, 'give_forms_tag', '', ', ', ''); |
|
151 | + $tags = ! is_wp_error($tags) ? strip_tags($tags) : ''; |
|
152 | 152 | } |
153 | 153 | |
154 | - $sales = give_get_form_sales_stats( $form->ID ); |
|
155 | - $earnings = give_currency_filter( give_format_amount( give_get_form_earnings_stats( $form->ID ), array( 'sanitize' => false, ) ), array( 'decode_currency' => true ) ); |
|
154 | + $sales = give_get_form_sales_stats($form->ID); |
|
155 | + $earnings = give_currency_filter(give_format_amount(give_get_form_earnings_stats($form->ID), array('sanitize' => false,)), array('decode_currency' => true)); |
|
156 | 156 | |
157 | 157 | // This will help filter data before appending it to PDF Receipt. |
158 | 158 | $prepare_pdf_data = array(); |
@@ -160,54 +160,54 @@ discard block |
||
160 | 160 | $prepare_pdf_data[] = $price; |
161 | 161 | |
162 | 162 | // Append Categories Data only, if user has opted for it. |
163 | - if ( $categories_enabled ) { |
|
163 | + if ($categories_enabled) { |
|
164 | 164 | $prepare_pdf_data[] = $categories; |
165 | 165 | } |
166 | 166 | |
167 | 167 | // Append Tags Data only, if user has opted for it. |
168 | - if ( $tags_enabled ) { |
|
168 | + if ($tags_enabled) { |
|
169 | 169 | $prepare_pdf_data[] = $tags; |
170 | 170 | } |
171 | 171 | |
172 | 172 | $prepare_pdf_data[] = $sales; |
173 | 173 | $prepare_pdf_data[] = $earnings; |
174 | 174 | |
175 | - $pdf->Row( $prepare_pdf_data ); |
|
175 | + $pdf->Row($prepare_pdf_data); |
|
176 | 176 | |
177 | 177 | endforeach; |
178 | 178 | } else { |
179 | 179 | |
180 | 180 | // Fix: Minor Styling Alignment Issue for PDF. |
181 | - if ( $categories_enabled && $tags_enabled ) { |
|
181 | + if ($categories_enabled && $tags_enabled) { |
|
182 | 182 | $no_found_width = 280; |
183 | - } elseif ( $categories_enabled || $tags_enabled ) { |
|
183 | + } elseif ($categories_enabled || $tags_enabled) { |
|
184 | 184 | $no_found_width = 235; |
185 | 185 | } else { |
186 | 186 | $no_found_width = 190; |
187 | 187 | } |
188 | - $title = utf8_decode( __( 'No forms found.', 'give' ) ); |
|
189 | - $pdf->MultiCell( $no_found_width, 5, $title, 1, 'C', false, 1, '', '', true, 0, false, true, 0, 'T', false ); |
|
188 | + $title = utf8_decode(__('No forms found.', 'give')); |
|
189 | + $pdf->MultiCell($no_found_width, 5, $title, 1, 'C', false, 1, '', '', true, 0, false, true, 0, 'T', false); |
|
190 | 190 | }// End if(). |
191 | 191 | $pdf->Ln(); |
192 | - $pdf->SetTextColor( 50, 50, 50 ); |
|
193 | - $pdf->SetFont( $default_font, '', 14 ); |
|
192 | + $pdf->SetTextColor(50, 50, 50); |
|
193 | + $pdf->SetFont($default_font, '', 14); |
|
194 | 194 | |
195 | 195 | // Output Graph on a new page. |
196 | - $pdf->AddPage( 'L', 'A4' ); |
|
197 | - $pdf->Cell( 0, 10, utf8_decode( __( 'Graph View', 'give' ) ), 0, 2, 'L', false ); |
|
198 | - $pdf->SetFont( $default_font, '', 12 ); |
|
196 | + $pdf->AddPage('L', 'A4'); |
|
197 | + $pdf->Cell(0, 10, utf8_decode(__('Graph View', 'give')), 0, 2, 'L', false); |
|
198 | + $pdf->SetFont($default_font, '', 12); |
|
199 | 199 | |
200 | - $image = html_entity_decode( urldecode( give_draw_chart_image() ) ); |
|
201 | - $image = str_replace( ' ', '%20', $image ); |
|
200 | + $image = html_entity_decode(urldecode(give_draw_chart_image())); |
|
201 | + $image = str_replace(' ', '%20', $image); |
|
202 | 202 | |
203 | - $pdf->SetX( 25 ); |
|
204 | - $pdf->Image( $image . '&file=.png' ); |
|
205 | - $pdf->Ln( 7 ); |
|
206 | - $pdf->Output( apply_filters( 'give_sales_earnings_pdf_export_filename', 'give-report-' . date_i18n( 'Y-m-d' ) ) . '.pdf', 'D' ); |
|
203 | + $pdf->SetX(25); |
|
204 | + $pdf->Image($image.'&file=.png'); |
|
205 | + $pdf->Ln(7); |
|
206 | + $pdf->Output(apply_filters('give_sales_earnings_pdf_export_filename', 'give-report-'.date_i18n('Y-m-d')).'.pdf', 'D'); |
|
207 | 207 | exit(); |
208 | 208 | } |
209 | 209 | |
210 | -add_action( 'give_generate_pdf', 'give_generate_pdf' ); |
|
210 | +add_action('give_generate_pdf', 'give_generate_pdf'); |
|
211 | 211 | |
212 | 212 | /** |
213 | 213 | * Draws Chart for PDF Report. |
@@ -224,38 +224,38 @@ discard block |
||
224 | 224 | * @return string $chart->getUrl() URL for the Google Chart |
225 | 225 | */ |
226 | 226 | function give_draw_chart_image() { |
227 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/GoogleChart.php'; |
|
228 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/markers/GoogleChartShapeMarker.php'; |
|
229 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/markers/GoogleChartTextMarker.php'; |
|
227 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/GoogleChart.php'; |
|
228 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/markers/GoogleChartShapeMarker.php'; |
|
229 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/markers/GoogleChartTextMarker.php'; |
|
230 | 230 | |
231 | - $chart = new GoogleChart( 'lc', 900, 330 ); |
|
231 | + $chart = new GoogleChart('lc', 900, 330); |
|
232 | 232 | |
233 | 233 | $i = 1; |
234 | 234 | $earnings = ""; |
235 | 235 | $sales = ""; |
236 | 236 | |
237 | - while ( $i <= 12 ) : |
|
238 | - $earnings .= give_get_earnings_by_date( null, $i, date( 'Y' ) ) . ","; |
|
239 | - $sales .= give_get_sales_by_date( null, $i, date( 'Y' ) ) . ","; |
|
240 | - $i ++; |
|
237 | + while ($i <= 12) : |
|
238 | + $earnings .= give_get_earnings_by_date(null, $i, date('Y')).","; |
|
239 | + $sales .= give_get_sales_by_date(null, $i, date('Y')).","; |
|
240 | + $i++; |
|
241 | 241 | endwhile; |
242 | 242 | |
243 | - $earnings_array = explode( ",", $earnings ); |
|
244 | - $sales_array = explode( ",", $sales ); |
|
243 | + $earnings_array = explode(",", $earnings); |
|
244 | + $sales_array = explode(",", $sales); |
|
245 | 245 | |
246 | 246 | $i = 0; |
247 | - while ( $i <= 11 ) { |
|
248 | - if ( empty( $sales_array[ $i ] ) ) { |
|
249 | - $sales_array[ $i ] = 0; |
|
247 | + while ($i <= 11) { |
|
248 | + if (empty($sales_array[$i])) { |
|
249 | + $sales_array[$i] = 0; |
|
250 | 250 | } |
251 | - $i ++; |
|
251 | + $i++; |
|
252 | 252 | } |
253 | 253 | |
254 | 254 | $min_earnings = 0; |
255 | - $max_earnings = max( $earnings_array ); |
|
256 | - $earnings_scale = round( $max_earnings, - 1 ); |
|
255 | + $max_earnings = max($earnings_array); |
|
256 | + $earnings_scale = round($max_earnings, - 1); |
|
257 | 257 | |
258 | - $data = new GoogleChartData( array( |
|
258 | + $data = new GoogleChartData(array( |
|
259 | 259 | $earnings_array[0], |
260 | 260 | $earnings_array[1], |
261 | 261 | $earnings_array[2], |
@@ -268,25 +268,25 @@ discard block |
||
268 | 268 | $earnings_array[9], |
269 | 269 | $earnings_array[10], |
270 | 270 | $earnings_array[11], |
271 | - ) ); |
|
271 | + )); |
|
272 | 272 | |
273 | - $data->setLegend( __( 'Income', 'give' ) ); |
|
274 | - $data->setColor( '1b58a3' ); |
|
275 | - $chart->addData( $data ); |
|
273 | + $data->setLegend(__('Income', 'give')); |
|
274 | + $data->setColor('1b58a3'); |
|
275 | + $chart->addData($data); |
|
276 | 276 | |
277 | - $shape_marker = new GoogleChartShapeMarker( GoogleChartShapeMarker::CIRCLE ); |
|
278 | - $shape_marker->setColor( '000000' ); |
|
279 | - $shape_marker->setSize( 7 ); |
|
280 | - $shape_marker->setBorder( 2 ); |
|
281 | - $shape_marker->setData( $data ); |
|
282 | - $chart->addMarker( $shape_marker ); |
|
277 | + $shape_marker = new GoogleChartShapeMarker(GoogleChartShapeMarker::CIRCLE); |
|
278 | + $shape_marker->setColor('000000'); |
|
279 | + $shape_marker->setSize(7); |
|
280 | + $shape_marker->setBorder(2); |
|
281 | + $shape_marker->setData($data); |
|
282 | + $chart->addMarker($shape_marker); |
|
283 | 283 | |
284 | - $value_marker = new GoogleChartTextMarker( GoogleChartTextMarker::VALUE ); |
|
285 | - $value_marker->setColor( '000000' ); |
|
286 | - $value_marker->setData( $data ); |
|
287 | - $chart->addMarker( $value_marker ); |
|
284 | + $value_marker = new GoogleChartTextMarker(GoogleChartTextMarker::VALUE); |
|
285 | + $value_marker->setColor('000000'); |
|
286 | + $value_marker->setData($data); |
|
287 | + $chart->addMarker($value_marker); |
|
288 | 288 | |
289 | - $data = new GoogleChartData( array( |
|
289 | + $data = new GoogleChartData(array( |
|
290 | 290 | $sales_array[0], |
291 | 291 | $sales_array[1], |
292 | 292 | $sales_array[2], |
@@ -299,46 +299,46 @@ discard block |
||
299 | 299 | $sales_array[9], |
300 | 300 | $sales_array[10], |
301 | 301 | $sales_array[11], |
302 | - ) ); |
|
303 | - $data->setLegend( __( 'Donations', 'give' ) ); |
|
304 | - $data->setColor( 'ff6c1c' ); |
|
305 | - $chart->addData( $data ); |
|
306 | - |
|
307 | - $chart->setTitle( __( 'Donations by Month for all Give Forms', 'give' ), '336699', 18 ); |
|
308 | - |
|
309 | - $chart->setScale( 0, $max_earnings ); |
|
310 | - |
|
311 | - $y_axis = new GoogleChartAxis( 'y' ); |
|
312 | - $y_axis->setDrawTickMarks( true )->setLabels( array( 0, $max_earnings ) ); |
|
313 | - $chart->addAxis( $y_axis ); |
|
314 | - |
|
315 | - $x_axis = new GoogleChartAxis( 'x' ); |
|
316 | - $x_axis->setTickMarks( 5 ); |
|
317 | - $x_axis->setLabels( array( |
|
318 | - __( 'Jan', 'give' ), |
|
319 | - __( 'Feb', 'give' ), |
|
320 | - __( 'Mar', 'give' ), |
|
321 | - __( 'Apr', 'give' ), |
|
322 | - __( 'May', 'give' ), |
|
323 | - __( 'June', 'give' ), |
|
324 | - __( 'July', 'give' ), |
|
325 | - __( 'Aug', 'give' ), |
|
326 | - __( 'Sept', 'give' ), |
|
327 | - __( 'Oct', 'give' ), |
|
328 | - __( 'Nov', 'give' ), |
|
329 | - __( 'Dec', 'give' ), |
|
330 | - ) ); |
|
331 | - $chart->addAxis( $x_axis ); |
|
332 | - |
|
333 | - $shape_marker = new GoogleChartShapeMarker( GoogleChartShapeMarker::CIRCLE ); |
|
334 | - $shape_marker->setSize( 6 ); |
|
335 | - $shape_marker->setBorder( 2 ); |
|
336 | - $shape_marker->setData( $data ); |
|
337 | - $chart->addMarker( $shape_marker ); |
|
338 | - |
|
339 | - $value_marker = new GoogleChartTextMarker( GoogleChartTextMarker::VALUE ); |
|
340 | - $value_marker->setData( $data ); |
|
341 | - $chart->addMarker( $value_marker ); |
|
302 | + )); |
|
303 | + $data->setLegend(__('Donations', 'give')); |
|
304 | + $data->setColor('ff6c1c'); |
|
305 | + $chart->addData($data); |
|
306 | + |
|
307 | + $chart->setTitle(__('Donations by Month for all Give Forms', 'give'), '336699', 18); |
|
308 | + |
|
309 | + $chart->setScale(0, $max_earnings); |
|
310 | + |
|
311 | + $y_axis = new GoogleChartAxis('y'); |
|
312 | + $y_axis->setDrawTickMarks(true)->setLabels(array(0, $max_earnings)); |
|
313 | + $chart->addAxis($y_axis); |
|
314 | + |
|
315 | + $x_axis = new GoogleChartAxis('x'); |
|
316 | + $x_axis->setTickMarks(5); |
|
317 | + $x_axis->setLabels(array( |
|
318 | + __('Jan', 'give'), |
|
319 | + __('Feb', 'give'), |
|
320 | + __('Mar', 'give'), |
|
321 | + __('Apr', 'give'), |
|
322 | + __('May', 'give'), |
|
323 | + __('June', 'give'), |
|
324 | + __('July', 'give'), |
|
325 | + __('Aug', 'give'), |
|
326 | + __('Sept', 'give'), |
|
327 | + __('Oct', 'give'), |
|
328 | + __('Nov', 'give'), |
|
329 | + __('Dec', 'give'), |
|
330 | + )); |
|
331 | + $chart->addAxis($x_axis); |
|
332 | + |
|
333 | + $shape_marker = new GoogleChartShapeMarker(GoogleChartShapeMarker::CIRCLE); |
|
334 | + $shape_marker->setSize(6); |
|
335 | + $shape_marker->setBorder(2); |
|
336 | + $shape_marker->setData($data); |
|
337 | + $chart->addMarker($shape_marker); |
|
338 | + |
|
339 | + $value_marker = new GoogleChartTextMarker(GoogleChartTextMarker::VALUE); |
|
340 | + $value_marker->setData($data); |
|
341 | + $chart->addMarker($value_marker); |
|
342 | 342 | |
343 | 343 | return $chart->getUrl(); |
344 | 344 | } |
@@ -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 | |
@@ -42,9 +42,9 @@ discard block |
||
42 | 42 | give_ignore_user_abort(); |
43 | 43 | |
44 | 44 | nocache_headers(); |
45 | - header( 'Content-Type: application/json; charset=utf-8' ); |
|
46 | - header( 'Content-Disposition: attachment; filename=' . apply_filters( 'give_core_settings_export_filename', 'give-export-' . $this->export_type . '-' . date( 'n' ) . '-' . date( 'Y' ) ) . '.json' ); |
|
47 | - header( 'Expires: 0' ); |
|
45 | + header('Content-Type: application/json; charset=utf-8'); |
|
46 | + header('Content-Disposition: attachment; filename='.apply_filters('give_core_settings_export_filename', 'give-export-'.$this->export_type.'-'.date('n').'-'.date('Y')).'.json'); |
|
47 | + header('Expires: 0'); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | /** |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * @since 1.8.17 |
55 | 55 | */ |
56 | 56 | public function json_core_settings_export() { |
57 | - echo wp_json_encode( get_option( 'give_settings' ) ); |
|
57 | + echo wp_json_encode(get_option('give_settings')); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
@@ -64,8 +64,8 @@ discard block |
||
64 | 64 | * @since 1.8.17 |
65 | 65 | */ |
66 | 66 | public function export() { |
67 | - if ( ! $this->can_export() ) { |
|
68 | - wp_die( __( 'You do not have permission to export data.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
67 | + if ( ! $this->can_export()) { |
|
68 | + wp_die(__('You do not have permission to export data.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | // Set headers. |
@@ -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 | /** |
@@ -51,9 +51,9 @@ discard block |
||
51 | 51 | give_ignore_user_abort(); |
52 | 52 | |
53 | 53 | nocache_headers(); |
54 | - header( 'Content-Type: text/csv; charset=utf-8' ); |
|
55 | - header( 'Content-Disposition: attachment; filename=give-export-' . $this->export_type . '-' . date( 'm-d-Y' ) . '.csv' ); |
|
56 | - header( "Expires: 0" ); |
|
54 | + header('Content-Type: text/csv; charset=utf-8'); |
|
55 | + header('Content-Disposition: attachment; filename=give-export-'.$this->export_type.'-'.date('m-d-Y').'.csv'); |
|
56 | + header("Expires: 0"); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
@@ -65,8 +65,8 @@ discard block |
||
65 | 65 | */ |
66 | 66 | public function csv_cols() { |
67 | 67 | $cols = array( |
68 | - 'id' => __( 'ID', 'give' ), |
|
69 | - 'date' => __( 'Date', 'give' ) |
|
68 | + 'id' => __('ID', 'give'), |
|
69 | + 'date' => __('Date', 'give') |
|
70 | 70 | ); |
71 | 71 | |
72 | 72 | return $cols; |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | public function get_csv_cols() { |
83 | 83 | $cols = $this->csv_cols(); |
84 | 84 | |
85 | - return apply_filters( "give_export_csv_cols_{$this->export_type}", $cols ); |
|
85 | + return apply_filters("give_export_csv_cols_{$this->export_type}", $cols); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | /** |
@@ -96,10 +96,10 @@ discard block |
||
96 | 96 | public function csv_cols_out() { |
97 | 97 | $cols = $this->get_csv_cols(); |
98 | 98 | $i = 1; |
99 | - foreach ( $cols as $col_id => $column ) { |
|
100 | - echo '"' . addslashes( $column ) . '"'; |
|
101 | - echo $i == count( $cols ) ? '' : ','; |
|
102 | - $i ++; |
|
99 | + foreach ($cols as $col_id => $column) { |
|
100 | + echo '"'.addslashes($column).'"'; |
|
101 | + echo $i == count($cols) ? '' : ','; |
|
102 | + $i++; |
|
103 | 103 | } |
104 | 104 | echo "\r\n"; |
105 | 105 | } |
@@ -116,16 +116,16 @@ discard block |
||
116 | 116 | $data = array( |
117 | 117 | 0 => array( |
118 | 118 | 'id' => '', |
119 | - 'data' => date( 'F j, Y' ) |
|
119 | + 'data' => date('F j, Y') |
|
120 | 120 | ), |
121 | 121 | 1 => array( |
122 | 122 | 'id' => '', |
123 | - 'data' => date( 'F j, Y' ) |
|
123 | + 'data' => date('F j, Y') |
|
124 | 124 | ) |
125 | 125 | ); |
126 | 126 | |
127 | - $data = apply_filters( 'give_export_get_data', $data ); |
|
128 | - $data = apply_filters( "give_export_get_data_{$this->export_type}", $data ); |
|
127 | + $data = apply_filters('give_export_get_data', $data); |
|
128 | + $data = apply_filters("give_export_get_data_{$this->export_type}", $data); |
|
129 | 129 | |
130 | 130 | return $data; |
131 | 131 | } |
@@ -143,14 +143,14 @@ discard block |
||
143 | 143 | $cols = $this->get_csv_cols(); |
144 | 144 | |
145 | 145 | // Output each row |
146 | - foreach ( $data as $row ) { |
|
146 | + foreach ($data as $row) { |
|
147 | 147 | $i = 1; |
148 | - foreach ( $row as $col_id => $column ) { |
|
148 | + foreach ($row as $col_id => $column) { |
|
149 | 149 | // Make sure the column is valid |
150 | - if ( array_key_exists( $col_id, $cols ) ) { |
|
151 | - echo '"' . addslashes( $column ) . '"'; |
|
152 | - echo $i == count( $cols ) ? '' : ','; |
|
153 | - $i ++; |
|
150 | + if (array_key_exists($col_id, $cols)) { |
|
151 | + echo '"'.addslashes($column).'"'; |
|
152 | + echo $i == count($cols) ? '' : ','; |
|
153 | + $i++; |
|
154 | 154 | } |
155 | 155 | } |
156 | 156 | echo "\r\n"; |
@@ -169,8 +169,8 @@ discard block |
||
169 | 169 | * @return void |
170 | 170 | */ |
171 | 171 | public function export() { |
172 | - if ( ! $this->can_export() ) { |
|
173 | - wp_die( __( 'You do not have permission to export data.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
172 | + if ( ! $this->can_export()) { |
|
173 | + wp_die(__('You do not have permission to export data.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | // Set headers |
@@ -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 | |
@@ -41,9 +41,9 @@ discard block |
||
41 | 41 | give_ignore_user_abort(); |
42 | 42 | |
43 | 43 | nocache_headers(); |
44 | - header( 'Content-Type: text/csv; charset=utf-8' ); |
|
45 | - header( 'Content-Disposition: attachment; filename=' . apply_filters( 'give_earnings_export_filename', 'give-export-' . $this->export_type . '-' . date( 'n' ) . '-' . date( 'Y' ) ) . '.csv' ); |
|
46 | - header( "Expires: 0" ); |
|
44 | + header('Content-Type: text/csv; charset=utf-8'); |
|
45 | + header('Content-Disposition: attachment; filename='.apply_filters('give_earnings_export_filename', 'give-export-'.$this->export_type.'-'.date('n').'-'.date('Y')).'.csv'); |
|
46 | + header("Expires: 0"); |
|
47 | 47 | |
48 | 48 | } |
49 | 49 | |
@@ -57,10 +57,10 @@ discard block |
||
57 | 57 | public function csv_cols() { |
58 | 58 | |
59 | 59 | $cols = array( |
60 | - 'date' => __( 'Date', 'give' ), |
|
61 | - 'donations' => __( 'Donations', 'give' ), |
|
60 | + 'date' => __('Date', 'give'), |
|
61 | + 'donations' => __('Donations', 'give'), |
|
62 | 62 | /* translators: %s: currency */ |
63 | - 'earnings' => sprintf( __( 'Income (%s)', 'give' ), give_currency_symbol('', true) ) |
|
63 | + 'earnings' => sprintf(__('Income (%s)', 'give'), give_currency_symbol('', true)) |
|
64 | 64 | ); |
65 | 65 | |
66 | 66 | return $cols; |
@@ -75,28 +75,28 @@ discard block |
||
75 | 75 | */ |
76 | 76 | public function get_data() { |
77 | 77 | |
78 | - $start_year = isset( $_POST['start_year'] ) ? absint( $_POST['start_year'] ) : date( 'Y' ); |
|
79 | - $end_year = isset( $_POST['end_year'] ) ? absint( $_POST['end_year'] ) : date( 'Y' ); |
|
80 | - $start_month = isset( $_POST['start_month'] ) ? absint( $_POST['start_month'] ) : date( 'n' ); |
|
81 | - $end_month = isset( $_POST['end_month'] ) ? absint( $_POST['end_month'] ) : date( 'n' ); |
|
78 | + $start_year = isset($_POST['start_year']) ? absint($_POST['start_year']) : date('Y'); |
|
79 | + $end_year = isset($_POST['end_year']) ? absint($_POST['end_year']) : date('Y'); |
|
80 | + $start_month = isset($_POST['start_month']) ? absint($_POST['start_month']) : date('n'); |
|
81 | + $end_month = isset($_POST['end_month']) ? absint($_POST['end_month']) : date('n'); |
|
82 | 82 | |
83 | 83 | $data = array(); |
84 | 84 | $year = $start_year; |
85 | 85 | $stats = new Give_Payment_Stats; |
86 | 86 | |
87 | - while ( $year <= $end_year ) { |
|
87 | + while ($year <= $end_year) { |
|
88 | 88 | |
89 | - if ( $year == $start_year && $year == $end_year ) { |
|
89 | + if ($year == $start_year && $year == $end_year) { |
|
90 | 90 | |
91 | 91 | $m1 = $start_month; |
92 | 92 | $m2 = $end_month; |
93 | 93 | |
94 | - } elseif ( $year == $start_year ) { |
|
94 | + } elseif ($year == $start_year) { |
|
95 | 95 | |
96 | 96 | $m1 = $start_month; |
97 | 97 | $m2 = 12; |
98 | 98 | |
99 | - } elseif ( $year == $end_year ) { |
|
99 | + } elseif ($year == $end_year) { |
|
100 | 100 | |
101 | 101 | $m1 = 1; |
102 | 102 | $m2 = $end_month; |
@@ -108,28 +108,28 @@ discard block |
||
108 | 108 | |
109 | 109 | } |
110 | 110 | |
111 | - while ( $m1 <= $m2 ) { |
|
111 | + while ($m1 <= $m2) { |
|
112 | 112 | |
113 | - $date1 = mktime( 0, 0, 0, $m1, 1, $year ); |
|
114 | - $date2 = mktime( 0, 0, 0, $m1, cal_days_in_month( CAL_GREGORIAN, $m1, $year ), $year ); |
|
113 | + $date1 = mktime(0, 0, 0, $m1, 1, $year); |
|
114 | + $date2 = mktime(0, 0, 0, $m1, cal_days_in_month(CAL_GREGORIAN, $m1, $year), $year); |
|
115 | 115 | |
116 | 116 | $data[] = array( |
117 | - 'date' => date_i18n( 'F Y', $date1 ), |
|
118 | - 'donations' => $stats->get_sales( 0, $date1, $date2 ), |
|
119 | - 'earnings' => give_format_amount( $stats->get_earnings( 0, $date1, $date2 ), array( 'sanitize' => false ) ), |
|
117 | + 'date' => date_i18n('F Y', $date1), |
|
118 | + 'donations' => $stats->get_sales(0, $date1, $date2), |
|
119 | + 'earnings' => give_format_amount($stats->get_earnings(0, $date1, $date2), array('sanitize' => false)), |
|
120 | 120 | ); |
121 | 121 | |
122 | - $m1 ++; |
|
122 | + $m1++; |
|
123 | 123 | |
124 | 124 | } |
125 | 125 | |
126 | 126 | |
127 | - $year ++; |
|
127 | + $year++; |
|
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 | } |
@@ -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 |
|
51 | - 'ajax' => false,// Does this table support ajax? |
|
52 | - ) ); |
|
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 | + 'ajax' => false, // Does this table support ajax? |
|
52 | + )); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
@@ -63,20 +63,20 @@ discard block |
||
63 | 63 | * |
64 | 64 | * @return void |
65 | 65 | */ |
66 | - public function search_box( $text, $input_id ) { |
|
67 | - $input_id = $input_id . '-search-input'; |
|
66 | + public function search_box($text, $input_id) { |
|
67 | + $input_id = $input_id.'-search-input'; |
|
68 | 68 | |
69 | - if ( ! empty( $_REQUEST['orderby'] ) ) { |
|
70 | - echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />'; |
|
69 | + if ( ! empty($_REQUEST['orderby'])) { |
|
70 | + echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />'; |
|
71 | 71 | } |
72 | - if ( ! empty( $_REQUEST['order'] ) ) { |
|
73 | - echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />'; |
|
72 | + if ( ! empty($_REQUEST['order'])) { |
|
73 | + echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />'; |
|
74 | 74 | } |
75 | 75 | ?> |
76 | 76 | <p class="search-box" role="search"> |
77 | 77 | <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label> |
78 | 78 | <input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>"/> |
79 | - <?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?> |
|
79 | + <?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?> |
|
80 | 80 | </p> |
81 | 81 | <?php |
82 | 82 | } |
@@ -90,10 +90,10 @@ discard block |
||
90 | 90 | */ |
91 | 91 | public function get_columns() { |
92 | 92 | $columns = array( |
93 | - 'ID' => esc_html__( 'Log ID', 'give' ), |
|
94 | - 'details' => esc_html__( 'Request Details', 'give' ), |
|
95 | - 'ip' => esc_html__( 'Request IP', 'give' ), |
|
96 | - 'date' => esc_html__( 'Date', 'give' ), |
|
93 | + 'ID' => esc_html__('Log ID', 'give'), |
|
94 | + 'details' => esc_html__('Request Details', 'give'), |
|
95 | + 'ip' => esc_html__('Request IP', 'give'), |
|
96 | + 'date' => esc_html__('Date', 'give'), |
|
97 | 97 | ); |
98 | 98 | |
99 | 99 | return $columns; |
@@ -110,10 +110,10 @@ 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 | default: |
116 | - return esc_attr( $item[ $column_name ] ); |
|
116 | + return esc_attr($item[$column_name]); |
|
117 | 117 | } |
118 | 118 | } |
119 | 119 | |
@@ -127,26 +127,26 @@ discard block |
||
127 | 127 | * |
128 | 128 | * @return void |
129 | 129 | */ |
130 | - public function column_details( $item ) { |
|
130 | + public function column_details($item) { |
|
131 | 131 | ?> |
132 | - <a href="#TB_inline?width=640&inlineId=log-details-<?php echo $item['ID']; ?>" class="thickbox"><?php esc_html_e( 'View Request', 'give' ); ?></a> |
|
132 | + <a href="#TB_inline?width=640&inlineId=log-details-<?php echo $item['ID']; ?>" class="thickbox"><?php esc_html_e('View Request', 'give'); ?></a> |
|
133 | 133 | <div id="log-details-<?php echo $item['ID']; ?>" style="display:none;"> |
134 | 134 | <?php |
135 | 135 | |
136 | - $request = get_post_field( 'post_excerpt', $item['ID'] ); |
|
137 | - $error = get_post_field( 'post_content', $item['ID'] ); |
|
138 | - echo '<p><strong>' . esc_html__( 'API Request:', 'give' ) . '</strong></p>'; |
|
139 | - echo '<div>' . $request . '</div>'; |
|
140 | - if ( ! empty( $error ) ) { |
|
141 | - echo '<p><strong>' . esc_html__( 'Error', 'give' ) . '</strong></p>'; |
|
142 | - echo '<div>' . esc_html( $error ) . '</div>'; |
|
136 | + $request = get_post_field('post_excerpt', $item['ID']); |
|
137 | + $error = get_post_field('post_content', $item['ID']); |
|
138 | + echo '<p><strong>'.esc_html__('API Request:', 'give').'</strong></p>'; |
|
139 | + echo '<div>'.$request.'</div>'; |
|
140 | + if ( ! empty($error)) { |
|
141 | + echo '<p><strong>'.esc_html__('Error', 'give').'</strong></p>'; |
|
142 | + echo '<div>'.esc_html($error).'</div>'; |
|
143 | 143 | } |
144 | - echo '<p><strong>' . esc_html__( 'API User:', 'give' ) . '</strong></p>'; |
|
145 | - echo '<div>' . give_get_meta( $item['ID'], '_give_log_user', true ) . '</div>'; |
|
146 | - echo '<p><strong>' . esc_html__( 'API Key:', 'give' ) . '</strong></p>'; |
|
147 | - echo '<div>' . give_get_meta( $item['ID'], '_give_log_key', true ) . '</div>'; |
|
148 | - echo '<p><strong>' . esc_html__( 'Request Date:', 'give' ) . '</strong></p>'; |
|
149 | - echo '<div>' . get_post_field( 'post_date', $item['ID'] ) . '</div>'; |
|
144 | + echo '<p><strong>'.esc_html__('API User:', 'give').'</strong></p>'; |
|
145 | + echo '<div>'.give_get_meta($item['ID'], '_give_log_user', true).'</div>'; |
|
146 | + echo '<p><strong>'.esc_html__('API Key:', 'give').'</strong></p>'; |
|
147 | + echo '<div>'.give_get_meta($item['ID'], '_give_log_key', true).'</div>'; |
|
148 | + echo '<p><strong>'.esc_html__('Request Date:', 'give').'</strong></p>'; |
|
149 | + echo '<div>'.get_post_field('post_date', $item['ID']).'</div>'; |
|
150 | 150 | ?> |
151 | 151 | </div> |
152 | 152 | <?php |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | * @return string|bool String if search is present, false otherwise |
161 | 161 | */ |
162 | 162 | public function get_search() { |
163 | - return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false; |
|
163 | + return ! empty($_GET['s']) ? urldecode(trim($_GET['s'])) : false; |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | |
@@ -176,19 +176,19 @@ discard block |
||
176 | 176 | * |
177 | 177 | * @param string $which |
178 | 178 | */ |
179 | - protected function display_tablenav( $which ) { |
|
180 | - if ( 'top' === $which ) { |
|
181 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
179 | + protected function display_tablenav($which) { |
|
180 | + if ('top' === $which) { |
|
181 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
182 | 182 | } |
183 | 183 | ?> |
184 | - <div class="tablenav <?php echo esc_attr( $which ); ?>"> |
|
184 | + <div class="tablenav <?php echo esc_attr($which); ?>"> |
|
185 | 185 | |
186 | 186 | <div class="alignleft actions bulkactions"> |
187 | - <?php $this->bulk_actions( $which ); ?> |
|
187 | + <?php $this->bulk_actions($which); ?> |
|
188 | 188 | </div> |
189 | 189 | <?php |
190 | - $this->extra_tablenav( $which ); |
|
191 | - $this->pagination( $which ); |
|
190 | + $this->extra_tablenav($which); |
|
191 | + $this->pagination($which); |
|
192 | 192 | ?> |
193 | 193 | |
194 | 194 | <br class="clear"/> |
@@ -210,31 +210,31 @@ discard block |
||
210 | 210 | |
211 | 211 | $search = $this->get_search(); |
212 | 212 | |
213 | - if ( $search ) { |
|
214 | - if ( filter_var( $search, FILTER_VALIDATE_IP ) ) { |
|
213 | + if ($search) { |
|
214 | + if (filter_var($search, FILTER_VALIDATE_IP)) { |
|
215 | 215 | // This is an IP address search |
216 | 216 | $key = '_give_log_request_ip'; |
217 | - } elseif ( is_email( $search ) ) { |
|
217 | + } elseif (is_email($search)) { |
|
218 | 218 | // This is an email search |
219 | - $userdata = get_user_by( 'email', $search ); |
|
219 | + $userdata = get_user_by('email', $search); |
|
220 | 220 | |
221 | - if ( $userdata ) { |
|
221 | + if ($userdata) { |
|
222 | 222 | $search = $userdata->ID; |
223 | 223 | } |
224 | 224 | |
225 | 225 | $key = '_give_log_user'; |
226 | - } elseif ( strlen( $search ) == 32 ) { |
|
226 | + } elseif (strlen($search) == 32) { |
|
227 | 227 | // Look for an API key |
228 | 228 | $key = '_give_log_key'; |
229 | - } elseif ( stristr( $search, 'token:' ) ) { |
|
229 | + } elseif (stristr($search, 'token:')) { |
|
230 | 230 | // Look for an API token |
231 | - $search = str_ireplace( 'token:', '', $search ); |
|
231 | + $search = str_ireplace('token:', '', $search); |
|
232 | 232 | $key = '_give_log_token'; |
233 | 233 | } else { |
234 | 234 | // This is (probably) a user ID search |
235 | - $userdata = get_userdata( $search ); |
|
235 | + $userdata = get_userdata($search); |
|
236 | 236 | |
237 | - if ( $userdata ) { |
|
237 | + if ($userdata) { |
|
238 | 238 | $search = $userdata->ID; |
239 | 239 | } |
240 | 240 | |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | * @return int Current page number |
261 | 261 | */ |
262 | 262 | public function get_paged() { |
263 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
263 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | /** |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | * @since 1.0 |
271 | 271 | * @return void |
272 | 272 | */ |
273 | - function bulk_actions( $which = '' ) { |
|
273 | + function bulk_actions($which = '') { |
|
274 | 274 | give_log_views(); |
275 | 275 | } |
276 | 276 | |
@@ -294,14 +294,14 @@ discard block |
||
294 | 294 | 'posts_per_page' => $this->per_page, |
295 | 295 | ); |
296 | 296 | |
297 | - $logs = $give_logs->get_connected_logs( $log_query ); |
|
297 | + $logs = $give_logs->get_connected_logs($log_query); |
|
298 | 298 | |
299 | - if ( $logs ) { |
|
300 | - foreach ( $logs as $log ) { |
|
299 | + if ($logs) { |
|
300 | + foreach ($logs as $log) { |
|
301 | 301 | |
302 | 302 | $logs_data[] = array( |
303 | 303 | 'ID' => $log->ID, |
304 | - 'ip' => give_get_meta( $log->ID, '_give_log_request_ip', true ), |
|
304 | + 'ip' => give_get_meta($log->ID, '_give_log_request_ip', true), |
|
305 | 305 | 'date' => $log->post_date, |
306 | 306 | ); |
307 | 307 | } |
@@ -329,14 +329,14 @@ discard block |
||
329 | 329 | $columns = $this->get_columns(); |
330 | 330 | $hidden = array(); // No hidden columns |
331 | 331 | $sortable = $this->get_sortable_columns(); |
332 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
332 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
333 | 333 | $this->items = $this->get_logs(); |
334 | - $total_items = $give_logs->get_log_count( 0, 'api_request' ); |
|
334 | + $total_items = $give_logs->get_log_count(0, 'api_request'); |
|
335 | 335 | |
336 | - $this->set_pagination_args( array( |
|
336 | + $this->set_pagination_args(array( |
|
337 | 337 | 'total_items' => $total_items, |
338 | 338 | 'per_page' => $this->per_page, |
339 | - 'total_pages' => ceil( $total_items / $this->per_page ), |
|
339 | + 'total_pages' => ceil($total_items / $this->per_page), |
|
340 | 340 | ) |
341 | 341 | ); |
342 | 342 | } |
@@ -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 | |
@@ -24,9 +24,9 @@ discard block |
||
24 | 24 | */ |
25 | 25 | function give_donors_page() { |
26 | 26 | $default_views = give_donor_views(); |
27 | - $requested_view = isset( $_GET['view'] ) ? sanitize_text_field( $_GET['view'] ) : 'donors'; |
|
28 | - if ( array_key_exists( $requested_view, $default_views ) && function_exists( $default_views[ $requested_view ] ) ) { |
|
29 | - give_render_donor_view( $requested_view, $default_views ); |
|
27 | + $requested_view = isset($_GET['view']) ? sanitize_text_field($_GET['view']) : 'donors'; |
|
28 | + if (array_key_exists($requested_view, $default_views) && function_exists($default_views[$requested_view])) { |
|
29 | + give_render_donor_view($requested_view, $default_views); |
|
30 | 30 | } else { |
31 | 31 | give_donors_list(); |
32 | 32 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | |
43 | 43 | $views = array(); |
44 | 44 | |
45 | - return apply_filters( 'give_donor_views', $views ); |
|
45 | + return apply_filters('give_donor_views', $views); |
|
46 | 46 | |
47 | 47 | } |
48 | 48 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | |
57 | 57 | $tabs = array(); |
58 | 58 | |
59 | - return apply_filters( 'give_donor_tabs', $tabs ); |
|
59 | + return apply_filters('give_donor_tabs', $tabs); |
|
60 | 60 | |
61 | 61 | } |
62 | 62 | |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | * @return void |
68 | 68 | */ |
69 | 69 | function give_donors_list() { |
70 | - include dirname( __FILE__ ) . '/class-donor-table.php'; |
|
70 | + include dirname(__FILE__).'/class-donor-table.php'; |
|
71 | 71 | |
72 | 72 | $donors_table = new Give_Donor_List_Table(); |
73 | 73 | $donors_table->prepare_items(); |
@@ -80,12 +80,12 @@ discard block |
||
80 | 80 | * |
81 | 81 | * @since 1.0 |
82 | 82 | */ |
83 | - do_action( 'give_donors_table_top' ); |
|
83 | + do_action('give_donors_table_top'); |
|
84 | 84 | ?> |
85 | 85 | |
86 | 86 | <hr class="wp-header-end"> |
87 | - <form id="give-donors-search-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors' ); ?>"> |
|
88 | - <?php $donors_table->search_box( __( 'Search Donors', 'give' ), 'give-donors' ); ?> |
|
87 | + <form id="give-donors-search-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors'); ?>"> |
|
88 | + <?php $donors_table->search_box(__('Search Donors', 'give'), 'give-donors'); ?> |
|
89 | 89 | <input type="hidden" name="post_type" value="give_forms" /> |
90 | 90 | <input type="hidden" name="page" value="give-donors" /> |
91 | 91 | <input type="hidden" name="view" value="donors" /> |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | * |
103 | 103 | * @since 1.0 |
104 | 104 | */ |
105 | - do_action( 'give_donors_table_bottom' ); |
|
105 | + do_action('give_donors_table_bottom'); |
|
106 | 106 | ?> |
107 | 107 | </div> |
108 | 108 | <?php |
@@ -118,33 +118,33 @@ discard block |
||
118 | 118 | * |
119 | 119 | * @return void |
120 | 120 | */ |
121 | -function give_render_donor_view( $view, $callbacks ) { |
|
121 | +function give_render_donor_view($view, $callbacks) { |
|
122 | 122 | |
123 | 123 | $render = true; |
124 | 124 | |
125 | - $donor_view_role = apply_filters( 'give_view_donors_role', 'view_give_reports' ); |
|
125 | + $donor_view_role = apply_filters('give_view_donors_role', 'view_give_reports'); |
|
126 | 126 | |
127 | - if ( ! current_user_can( $donor_view_role ) ) { |
|
128 | - give_set_error( 'give-no-access', __( 'You are not permitted to view this data.', 'give' ) ); |
|
127 | + if ( ! current_user_can($donor_view_role)) { |
|
128 | + give_set_error('give-no-access', __('You are not permitted to view this data.', 'give')); |
|
129 | 129 | $render = false; |
130 | 130 | } |
131 | 131 | |
132 | - if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) { |
|
133 | - give_set_error( 'give-invalid_donor', __( 'Invalid Donor ID.', 'give' ) ); |
|
132 | + if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) { |
|
133 | + give_set_error('give-invalid_donor', __('Invalid Donor ID.', 'give')); |
|
134 | 134 | $render = false; |
135 | 135 | } |
136 | 136 | |
137 | 137 | $donor_id = (int) $_GET['id']; |
138 | - $reconnect_user_id = ! empty( $_GET['user_id'] ) ? (int) $_GET['user_id'] : ''; |
|
139 | - $donor = new Give_Donor( $donor_id ); |
|
138 | + $reconnect_user_id = ! empty($_GET['user_id']) ? (int) $_GET['user_id'] : ''; |
|
139 | + $donor = new Give_Donor($donor_id); |
|
140 | 140 | |
141 | 141 | // Reconnect User with Donor profile. |
142 | - if( $reconnect_user_id ) { |
|
143 | - give_connect_user_donor_profile( $donor, array( 'user_id' => $reconnect_user_id ), array() ); |
|
142 | + if ($reconnect_user_id) { |
|
143 | + give_connect_user_donor_profile($donor, array('user_id' => $reconnect_user_id), array()); |
|
144 | 144 | } |
145 | 145 | |
146 | - if ( empty( $donor->id ) ) { |
|
147 | - give_set_error( 'give-invalid_donor', __( 'Invalid Donor ID.', 'give' ) ); |
|
146 | + if (empty($donor->id)) { |
|
147 | + give_set_error('give-invalid_donor', __('Invalid Donor ID.', 'give')); |
|
148 | 148 | $render = false; |
149 | 149 | } |
150 | 150 | |
@@ -153,9 +153,9 @@ discard block |
||
153 | 153 | |
154 | 154 | <div class='wrap'> |
155 | 155 | |
156 | - <?php if ( give_get_errors() ) : ?> |
|
156 | + <?php if (give_get_errors()) : ?> |
|
157 | 157 | <div class="error settings-error"> |
158 | - <?php Give()->notices->render_frontend_notices( 0 ); ?> |
|
158 | + <?php Give()->notices->render_frontend_notices(0); ?> |
|
159 | 159 | </div> |
160 | 160 | <?php endif; ?> |
161 | 161 | |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | <?php |
164 | 164 | printf( |
165 | 165 | /* translators: %s: donor number */ |
166 | - esc_html__( 'Donor %s', 'give' ), |
|
166 | + esc_html__('Donor %s', 'give'), |
|
167 | 167 | $donor_id |
168 | 168 | ); |
169 | 169 | ?> |
@@ -171,26 +171,26 @@ discard block |
||
171 | 171 | |
172 | 172 | <hr class="wp-header-end"> |
173 | 173 | |
174 | - <?php if ( $donor && $render ) : ?> |
|
174 | + <?php if ($donor && $render) : ?> |
|
175 | 175 | |
176 | 176 | <h2 class="nav-tab-wrapper"> |
177 | 177 | <?php |
178 | - foreach ( $donor_tabs as $key => $tab ) : |
|
178 | + foreach ($donor_tabs as $key => $tab) : |
|
179 | 179 | $active = $key === $view ? true : false; |
180 | 180 | $class = $active ? 'nav-tab nav-tab-active' : 'nav-tab'; |
181 | 181 | printf( |
182 | - '<a href="%1$s" class="%2$s"><span class="dashicons %3$s"></span>%4$s</a>' . "\n", |
|
183 | - esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=' . $key . '&id=' . $donor->id ) ), |
|
184 | - esc_attr( $class ), |
|
185 | - sanitize_html_class( $tab['dashicon'] ), |
|
186 | - esc_html( $tab['title'] ) |
|
182 | + '<a href="%1$s" class="%2$s"><span class="dashicons %3$s"></span>%4$s</a>'."\n", |
|
183 | + esc_url(admin_url('edit.php?post_type=give_forms&page=give-donors&view='.$key.'&id='.$donor->id)), |
|
184 | + esc_attr($class), |
|
185 | + sanitize_html_class($tab['dashicon']), |
|
186 | + esc_html($tab['title']) |
|
187 | 187 | ); |
188 | 188 | endforeach; |
189 | 189 | ?> |
190 | 190 | </h2> |
191 | 191 | |
192 | 192 | <div id="give-donor-card-wrapper"> |
193 | - <?php $callbacks[ $view ]( $donor ) ?> |
|
193 | + <?php $callbacks[$view]($donor) ?> |
|
194 | 194 | </div> |
195 | 195 | |
196 | 196 | <?php endif; ?> |
@@ -210,9 +210,9 @@ discard block |
||
210 | 210 | * |
211 | 211 | * @return void |
212 | 212 | */ |
213 | -function give_donor_view( $donor ) { |
|
213 | +function give_donor_view($donor) { |
|
214 | 214 | |
215 | - $donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' ); |
|
215 | + $donor_edit_role = apply_filters('give_edit_donors_role', 'edit_give_payments'); |
|
216 | 216 | |
217 | 217 | /** |
218 | 218 | * Fires in donor profile screen, above the donor card. |
@@ -221,32 +221,32 @@ discard block |
||
221 | 221 | * |
222 | 222 | * @param object $donor The donor object being displayed. |
223 | 223 | */ |
224 | - do_action( 'give_donor_card_top', $donor ); |
|
224 | + do_action('give_donor_card_top', $donor); |
|
225 | 225 | ?> |
226 | 226 | |
227 | 227 | <div id="donor-summary" class="info-wrapper donor-section postbox"> |
228 | 228 | |
229 | - <form id="edit-donor-info" method="post" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ); ?>"> |
|
229 | + <form id="edit-donor-info" method="post" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id); ?>"> |
|
230 | 230 | |
231 | 231 | <div class="donor-info"> |
232 | 232 | |
233 | 233 | <div class="donor-bio-header clearfix"> |
234 | 234 | |
235 | 235 | <div class="avatar-wrap left" id="donor-avatar"> |
236 | - <?php echo get_avatar( $donor->email ); ?> |
|
236 | + <?php echo get_avatar($donor->email); ?> |
|
237 | 237 | </div> |
238 | 238 | |
239 | 239 | <div id="donor-name-wrap" class="left"> |
240 | 240 | <span class="donor-id">#<?php echo $donor->id; ?></span> |
241 | - <span class="donor-name info-item edit-item"><input size="15" data-key="name" name="customerinfo[name]" type="text" value="<?php echo esc_attr( $donor->name ); ?>" placeholder="<?php _e( 'Donor Name', 'give' ); ?>" /></span> |
|
241 | + <span class="donor-name info-item edit-item"><input size="15" data-key="name" name="customerinfo[name]" type="text" value="<?php echo esc_attr($donor->name); ?>" placeholder="<?php _e('Donor Name', 'give'); ?>" /></span> |
|
242 | 242 | <span class="donor-name info-item editable"><span data-key="name"><?php echo $donor->name; ?></span></span> |
243 | 243 | </div> |
244 | 244 | <p class="donor-since info-item"> |
245 | - <?php _e( 'Donor since', 'give' ); ?> |
|
246 | - <?php echo date_i18n( give_date_format(), strtotime( $donor->date_created ) ) ?> |
|
245 | + <?php _e('Donor since', 'give'); ?> |
|
246 | + <?php echo date_i18n(give_date_format(), strtotime($donor->date_created)) ?> |
|
247 | 247 | </p> |
248 | - <?php if ( current_user_can( $donor_edit_role ) ) : ?> |
|
249 | - <a href="#" id="edit-donor" class="button info-item editable donor-edit-link"><?php _e( 'Edit Donor', 'give' ); ?></a> |
|
248 | + <?php if (current_user_can($donor_edit_role)) : ?> |
|
249 | + <a href="#" id="edit-donor" class="button info-item editable donor-edit-link"><?php _e('Edit Donor', 'give'); ?></a> |
|
250 | 250 | <?php endif; ?> |
251 | 251 | </div> |
252 | 252 | <!-- /donor-bio-header --> |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | <table class="widefat"> |
257 | 257 | <tbody> |
258 | 258 | <tr class="alternate"> |
259 | - <th scope="col"><label for="tablecell"><?php _e( 'User:', 'give' ); ?></label></th> |
|
259 | + <th scope="col"><label for="tablecell"><?php _e('User:', 'give'); ?></label></th> |
|
260 | 260 | <td> |
261 | 261 | <span class="donor-user-id info-item edit-item"> |
262 | 262 | <?php |
@@ -273,48 +273,48 @@ discard block |
||
273 | 273 | 'data' => $data_atts, |
274 | 274 | ); |
275 | 275 | |
276 | - if ( ! empty( $user_id ) ) { |
|
277 | - $userdata = get_userdata( $user_id ); |
|
276 | + if ( ! empty($user_id)) { |
|
277 | + $userdata = get_userdata($user_id); |
|
278 | 278 | $user_args['selected'] = $user_id; |
279 | 279 | } |
280 | 280 | |
281 | - echo Give()->html->ajax_user_search( $user_args ); |
|
281 | + echo Give()->html->ajax_user_search($user_args); |
|
282 | 282 | ?> |
283 | 283 | </span> |
284 | 284 | |
285 | 285 | <span class="donor-user-id info-item editable"> |
286 | - <?php if ( ! empty( $userdata ) ) { ?> |
|
287 | - <span data-key="user_id">#<?php echo $donor->user_id . ' - ' . $userdata->display_name; ?></span> |
|
286 | + <?php if ( ! empty($userdata)) { ?> |
|
287 | + <span data-key="user_id">#<?php echo $donor->user_id.' - '.$userdata->display_name; ?></span> |
|
288 | 288 | <?php } else { ?> |
289 | - <span data-key="user_id"><?php _e( 'None', 'give' ); ?></span> |
|
289 | + <span data-key="user_id"><?php _e('None', 'give'); ?></span> |
|
290 | 290 | <?php } ?> |
291 | - <?php if ( current_user_can( $donor_edit_role ) && intval( $donor->user_id ) > 0 ) { ?> |
|
291 | + <?php if (current_user_can($donor_edit_role) && intval($donor->user_id) > 0) { ?> |
|
292 | 292 | <span class="disconnect-user"> |
293 | 293 | - |
294 | - <a id="disconnect-donor" href="#disconnect" aria-label="<?php _e( 'Disconnects the current user ID from this donor record.', 'give' ); ?>"> |
|
295 | - <?php _e( 'Disconnect User', 'give' ); ?> |
|
294 | + <a id="disconnect-donor" href="#disconnect" aria-label="<?php _e('Disconnects the current user ID from this donor record.', 'give'); ?>"> |
|
295 | + <?php _e('Disconnect User', 'give'); ?> |
|
296 | 296 | </a> |
297 | 297 | </span> |
298 | 298 | <span class="view-user-profile"> |
299 | 299 | | |
300 | - <a id="view-user-profile" href="<?php echo 'user-edit.php?user_id=' . $donor->user_id; ?>" aria-label="<?php _e( 'View User Profile of current user ID.', 'give' ); ?>"> |
|
301 | - <?php _e( 'View User Profile', 'give' ); ?> |
|
300 | + <a id="view-user-profile" href="<?php echo 'user-edit.php?user_id='.$donor->user_id; ?>" aria-label="<?php _e('View User Profile of current user ID.', 'give'); ?>"> |
|
301 | + <?php _e('View User Profile', 'give'); ?> |
|
302 | 302 | </a> |
303 | 303 | </span> |
304 | 304 | <?php } ?> |
305 | 305 | </span> |
306 | 306 | </td> |
307 | 307 | </tr> |
308 | - <?php if ( isset( $donor->user_id ) && $donor->user_id > 0 ) : ?> |
|
308 | + <?php if (isset($donor->user_id) && $donor->user_id > 0) : ?> |
|
309 | 309 | |
310 | 310 | <tr> |
311 | - <th scope="col"><?php _e( 'Address:', 'give' ); ?></th> |
|
311 | + <th scope="col"><?php _e('Address:', 'give'); ?></th> |
|
312 | 312 | <td class="row-title"> |
313 | 313 | |
314 | 314 | <div class="donor-address-wrapper"> |
315 | 315 | |
316 | 316 | <?php |
317 | - $address = get_user_meta( $donor->user_id, '_give_user_address', true ); |
|
317 | + $address = get_user_meta($donor->user_id, '_give_user_address', true); |
|
318 | 318 | $defaults = array( |
319 | 319 | 'line1' => '', |
320 | 320 | 'line2' => '', |
@@ -324,10 +324,10 @@ discard block |
||
324 | 324 | 'zip' => '', |
325 | 325 | ); |
326 | 326 | |
327 | - $address = wp_parse_args( $address, $defaults ); |
|
327 | + $address = wp_parse_args($address, $defaults); |
|
328 | 328 | ?> |
329 | 329 | |
330 | - <?php if ( ! empty( $address ) ) { ?> |
|
330 | + <?php if ( ! empty($address)) { ?> |
|
331 | 331 | <span class="donor-address info-item editable"> |
332 | 332 | <span class="info-item" data-key="line1"><?php echo $address['line1']; ?></span> |
333 | 333 | <span class="info-item" data-key="line2"><?php echo $address['line2']; ?></span> |
@@ -344,8 +344,8 @@ discard block |
||
344 | 344 | |
345 | 345 | // For State. |
346 | 346 | $selected_state = give_get_state(); |
347 | - $states = give_get_states( $selected_country ); |
|
348 | - $selected_state = ( isset( $address['state'] ) ? $address['state'] : $selected_state ); |
|
347 | + $states = give_get_states($selected_country); |
|
348 | + $selected_state = (isset($address['state']) ? $address['state'] : $selected_state); |
|
349 | 349 | |
350 | 350 | // Get the country list that does not have any states init. |
351 | 351 | $no_states_country = give_no_states_country_list(); |
@@ -353,32 +353,32 @@ discard block |
||
353 | 353 | <span class="donor-address info-item edit-item"> |
354 | 354 | <select data-key="country" name="customerinfo[country]" id="billing_country" class="billing_country give-select edit-item"> |
355 | 355 | <?php |
356 | - foreach ( $countries as $country_code => $country ) { |
|
357 | - echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>'; |
|
356 | + foreach ($countries as $country_code => $country) { |
|
357 | + echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>'; |
|
358 | 358 | } |
359 | 359 | ?> |
360 | 360 | </select> |
361 | - <input class="info-item" type="text" data-key="line1" name="customerinfo[line1]" placeholder="<?php _e( 'Address 1', 'give' ); ?>" value="<?php echo $address['line1']; ?>" /> |
|
362 | - <input class="info-item" type="text" data-key="line2" name="customerinfo[line2]" placeholder="<?php _e( 'Address 2', 'give' ); ?>" value="<?php echo $address['line2']; ?>" /> |
|
363 | - <input class="info-item" type="text" data-key="city" name="customerinfo[city]" placeholder="<?php _e( 'City', 'give' ); ?>" value="<?php echo $address['city']; ?>" /> |
|
361 | + <input class="info-item" type="text" data-key="line1" name="customerinfo[line1]" placeholder="<?php _e('Address 1', 'give'); ?>" value="<?php echo $address['line1']; ?>" /> |
|
362 | + <input class="info-item" type="text" data-key="line2" name="customerinfo[line2]" placeholder="<?php _e('Address 2', 'give'); ?>" value="<?php echo $address['line2']; ?>" /> |
|
363 | + <input class="info-item" type="text" data-key="city" name="customerinfo[city]" placeholder="<?php _e('City', 'give'); ?>" value="<?php echo $address['city']; ?>" /> |
|
364 | 364 | <?php |
365 | - if ( ! empty( $states ) ) { |
|
365 | + if ( ! empty($states)) { |
|
366 | 366 | ?> |
367 | 367 | <select data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-select info-item"> |
368 | 368 | <?php |
369 | - foreach ( $states as $state_code => $state ) { |
|
370 | - echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>'; |
|
369 | + foreach ($states as $state_code => $state) { |
|
370 | + echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>'; |
|
371 | 371 | } |
372 | 372 | ?> |
373 | 373 | </select> |
374 | 374 | <?php |
375 | 375 | } else { |
376 | 376 | ?> |
377 | - <input type="text" size="6" data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-input info-item <?php echo ( ! empty( $selected_country ) && array_key_exists( $selected_country, $no_states_country ) ? 'give-hidden' : '' ); ?>" placeholder="<?php _e( 'State / Province / County', 'give' ); ?>" /> |
|
377 | + <input type="text" size="6" data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-input info-item <?php echo ( ! empty($selected_country) && array_key_exists($selected_country, $no_states_country) ? 'give-hidden' : ''); ?>" placeholder="<?php _e('State / Province / County', 'give'); ?>" /> |
|
378 | 378 | <?php |
379 | 379 | } |
380 | 380 | ?> |
381 | - <input class="info-item" type="text" data-key="zip" name="customerinfo[zip]" placeholder="<?php _e( 'Zip / Postal Code', 'give' ); ?>" value="<?php echo $address['zip']; ?>" /> |
|
381 | + <input class="info-item" type="text" data-key="zip" name="customerinfo[zip]" placeholder="<?php _e('Zip / Postal Code', 'give'); ?>" value="<?php echo $address['zip']; ?>" /> |
|
382 | 382 | </span> |
383 | 383 | |
384 | 384 | </div> |
@@ -394,10 +394,10 @@ discard block |
||
394 | 394 | |
395 | 395 | <span id="donor-edit-actions" class="edit-item"> |
396 | 396 | <input type="hidden" data-key="id" name="customerinfo[id]" value="<?php echo $donor->id; ?>" /> |
397 | - <?php wp_nonce_field( 'edit-donor', '_wpnonce', false, true ); ?> |
|
397 | + <?php wp_nonce_field('edit-donor', '_wpnonce', false, true); ?> |
|
398 | 398 | <input type="hidden" name="give_action" value="edit-donor" /> |
399 | - <input type="submit" id="give-edit-donor-save" class="button-secondary" value="<?php _e( 'Update Donor', 'give' ); ?>" /> |
|
400 | - <a id="give-edit-donor-cancel" href="" class="delete"><?php _e( 'Cancel', 'give' ); ?></a> |
|
399 | + <input type="submit" id="give-edit-donor-save" class="button-secondary" value="<?php _e('Update Donor', 'give'); ?>" /> |
|
400 | + <a id="give-edit-donor-cancel" href="" class="delete"><?php _e('Cancel', 'give'); ?></a> |
|
401 | 401 | </span> |
402 | 402 | |
403 | 403 | </form> |
@@ -412,24 +412,24 @@ discard block |
||
412 | 412 | * |
413 | 413 | * @param object $donor The donor object being displayed. |
414 | 414 | */ |
415 | - do_action( 'give_donor_before_stats', $donor ); |
|
415 | + do_action('give_donor_before_stats', $donor); |
|
416 | 416 | ?> |
417 | 417 | |
418 | 418 | <div id="donor-stats-wrapper" class="donor-section postbox clear"> |
419 | 419 | <ul> |
420 | 420 | <li> |
421 | - <a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&donor=' . absint( $donor->id ) ); ?>"> |
|
421 | + <a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history&donor='.absint($donor->id)); ?>"> |
|
422 | 422 | <span class="dashicons dashicons-heart"></span> |
423 | 423 | <?php |
424 | 424 | // Completed Donations. |
425 | - $completed_donations_text = sprintf( _n( '%d Completed Donation', '%d Completed Donations', $donor->purchase_count, 'give' ), $donor->purchase_count ); |
|
426 | - echo apply_filters( 'give_donor_completed_donations', $completed_donations_text, $donor ); |
|
425 | + $completed_donations_text = sprintf(_n('%d Completed Donation', '%d Completed Donations', $donor->purchase_count, 'give'), $donor->purchase_count); |
|
426 | + echo apply_filters('give_donor_completed_donations', $completed_donations_text, $donor); |
|
427 | 427 | ?> |
428 | 428 | </a> |
429 | 429 | </li> |
430 | 430 | <li> |
431 | 431 | <span class="dashicons dashicons-chart-area"></span> |
432 | - <?php echo give_currency_filter( give_format_amount( $donor->get_total_donation_amount(), array( 'sanitize' => false ) ) ); ?> <?php _e( 'Lifetime Donations', 'give' ); ?> |
|
432 | + <?php echo give_currency_filter(give_format_amount($donor->get_total_donation_amount(), array('sanitize' => false))); ?> <?php _e('Lifetime Donations', 'give'); ?> |
|
433 | 433 | </li> |
434 | 434 | <?php |
435 | 435 | /** |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | * |
442 | 442 | * @param object $donor The donor object being displayed. |
443 | 443 | */ |
444 | - do_action( 'give_donor_stats_list', $donor ); |
|
444 | + do_action('give_donor_stats_list', $donor); |
|
445 | 445 | ?> |
446 | 446 | </ul> |
447 | 447 | </div> |
@@ -454,7 +454,7 @@ discard block |
||
454 | 454 | * |
455 | 455 | * @param object $donor The donor object being displayed. |
456 | 456 | */ |
457 | - do_action( 'give_donor_before_tables_wrapper', $donor ); |
|
457 | + do_action('give_donor_before_tables_wrapper', $donor); |
|
458 | 458 | ?> |
459 | 459 | |
460 | 460 | <div id="donor-tables-wrapper" class="donor-section"> |
@@ -467,46 +467,46 @@ discard block |
||
467 | 467 | * |
468 | 468 | * @param object $donor The donor object being displayed. |
469 | 469 | */ |
470 | - do_action( 'give_donor_before_tables', $donor ); |
|
470 | + do_action('give_donor_before_tables', $donor); |
|
471 | 471 | ?> |
472 | 472 | |
473 | - <h3><?php _e( 'Donor Emails', 'give' ); ?></h3> |
|
473 | + <h3><?php _e('Donor Emails', 'give'); ?></h3> |
|
474 | 474 | |
475 | 475 | <table class="wp-list-table widefat striped emails"> |
476 | 476 | <thead> |
477 | 477 | <tr> |
478 | - <th><?php _e( 'Email', 'give' ); ?></th> |
|
479 | - <th><?php _e( 'Actions', 'give' ); ?></th> |
|
478 | + <th><?php _e('Email', 'give'); ?></th> |
|
479 | + <th><?php _e('Actions', 'give'); ?></th> |
|
480 | 480 | </tr> |
481 | 481 | </thead> |
482 | 482 | |
483 | 483 | <tbody> |
484 | - <?php if ( ! empty( $donor->emails ) ) { ?> |
|
484 | + <?php if ( ! empty($donor->emails)) { ?> |
|
485 | 485 | |
486 | - <?php foreach ( $donor->emails as $key => $email ) : ?> |
|
486 | + <?php foreach ($donor->emails as $key => $email) : ?> |
|
487 | 487 | <tr data-key="<?php echo $key; ?>"> |
488 | 488 | <td> |
489 | 489 | <?php echo $email; ?> |
490 | - <?php if ( 'primary' === $key ) : ?> |
|
490 | + <?php if ('primary' === $key) : ?> |
|
491 | 491 | <span class="dashicons dashicons-star-filled primary-email-icon"></span> |
492 | 492 | <?php endif; ?> |
493 | 493 | </td> |
494 | 494 | <td> |
495 | - <?php if ( 'primary' !== $key ) : ?> |
|
495 | + <?php if ('primary' !== $key) : ?> |
|
496 | 496 | <?php |
497 | - $base_url = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ); |
|
498 | - $promote_url = wp_nonce_url( add_query_arg( array( |
|
499 | - 'email' => rawurlencode( $email ), |
|
497 | + $base_url = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id); |
|
498 | + $promote_url = wp_nonce_url(add_query_arg(array( |
|
499 | + 'email' => rawurlencode($email), |
|
500 | 500 | 'give_action' => 'set_donor_primary_email', |
501 | - ), $base_url ), 'give-set-donor-primary-email' ); |
|
502 | - $remove_url = wp_nonce_url( add_query_arg( array( |
|
503 | - 'email' => rawurlencode( $email ), |
|
501 | + ), $base_url), 'give-set-donor-primary-email'); |
|
502 | + $remove_url = wp_nonce_url(add_query_arg(array( |
|
503 | + 'email' => rawurlencode($email), |
|
504 | 504 | 'give_action' => 'remove_donor_email', |
505 | - ), $base_url ), 'give-remove-donor-email' ); |
|
505 | + ), $base_url), 'give-remove-donor-email'); |
|
506 | 506 | ?> |
507 | - <a href="<?php echo $promote_url; ?>"><?php _e( 'Make Primary', 'give' ); ?></a> |
|
507 | + <a href="<?php echo $promote_url; ?>"><?php _e('Make Primary', 'give'); ?></a> |
|
508 | 508 | | |
509 | - <a href="<?php echo $remove_url; ?>" class="delete"><?php _e( 'Remove', 'give' ); ?></a> |
|
509 | + <a href="<?php echo $remove_url; ?>" class="delete"><?php _e('Remove', 'give'); ?></a> |
|
510 | 510 | <?php endif; ?> |
511 | 511 | </td> |
512 | 512 | </tr> |
@@ -516,59 +516,59 @@ discard block |
||
516 | 516 | <td colspan="2" class="add-donor-email-td"> |
517 | 517 | <div class="add-donor-email-wrapper"> |
518 | 518 | <input type="hidden" name="donor-id" value="<?php echo $donor->id; ?>" /> |
519 | - <?php wp_nonce_field( 'give_add_donor_email', 'add_email_nonce', false, true ); ?> |
|
520 | - <input type="email" name="additional-email" value="" placeholder="<?php _e( 'Email Address', 'give' ); ?>" /> |
|
521 | - <input type="checkbox" name="make-additional-primary" value="1" id="make-additional-primary" /> <label for="make-additional-primary"><?php _e( 'Make Primary', 'give' ); ?></label> |
|
522 | - <button class="button-secondary give-add-donor-email" id="add-donor-email"><?php _e( 'Add Email', 'give' ); ?></button> |
|
519 | + <?php wp_nonce_field('give_add_donor_email', 'add_email_nonce', false, true); ?> |
|
520 | + <input type="email" name="additional-email" value="" placeholder="<?php _e('Email Address', 'give'); ?>" /> |
|
521 | + <input type="checkbox" name="make-additional-primary" value="1" id="make-additional-primary" /> <label for="make-additional-primary"><?php _e('Make Primary', 'give'); ?></label> |
|
522 | + <button class="button-secondary give-add-donor-email" id="add-donor-email"><?php _e('Add Email', 'give'); ?></button> |
|
523 | 523 | <span class="spinner"></span> |
524 | 524 | </div> |
525 | 525 | <div class="notice-wrap"></div> |
526 | 526 | </td> |
527 | 527 | </tr> |
528 | 528 | <?php } else { ?> |
529 | - <tr><td colspan="2"><?php _e( 'No Emails Found', 'give' ); ?></td></tr> |
|
529 | + <tr><td colspan="2"><?php _e('No Emails Found', 'give'); ?></td></tr> |
|
530 | 530 | <?php }// End if(). |
531 | 531 | ?> |
532 | 532 | </tbody> |
533 | 533 | </table> |
534 | 534 | |
535 | - <h3><?php _e( 'Recent Donations', 'give' ); ?></h3> |
|
535 | + <h3><?php _e('Recent Donations', 'give'); ?></h3> |
|
536 | 536 | <?php |
537 | - $payment_ids = explode( ',', $donor->payment_ids ); |
|
538 | - $payments = give_get_payments( array( |
|
537 | + $payment_ids = explode(',', $donor->payment_ids); |
|
538 | + $payments = give_get_payments(array( |
|
539 | 539 | 'post__in' => $payment_ids, |
540 | - ) ); |
|
541 | - $payments = array_slice( $payments, 0, 10 ); |
|
540 | + )); |
|
541 | + $payments = array_slice($payments, 0, 10); |
|
542 | 542 | ?> |
543 | 543 | <table class="wp-list-table widefat striped payments"> |
544 | 544 | <thead> |
545 | 545 | <tr> |
546 | - <th scope="col"><?php _e( 'ID', 'give' ); ?></th> |
|
547 | - <th scope="col"><?php _e( 'Amount', 'give' ); ?></th> |
|
548 | - <th scope="col"><?php _e( 'Date', 'give' ); ?></th> |
|
549 | - <th scope="col"><?php _e( 'Status', 'give' ); ?></th> |
|
550 | - <th scope="col"><?php _e( 'Actions', 'give' ); ?></th> |
|
546 | + <th scope="col"><?php _e('ID', 'give'); ?></th> |
|
547 | + <th scope="col"><?php _e('Amount', 'give'); ?></th> |
|
548 | + <th scope="col"><?php _e('Date', 'give'); ?></th> |
|
549 | + <th scope="col"><?php _e('Status', 'give'); ?></th> |
|
550 | + <th scope="col"><?php _e('Actions', 'give'); ?></th> |
|
551 | 551 | </tr> |
552 | 552 | </thead> |
553 | 553 | <tbody> |
554 | - <?php if ( ! empty( $payments ) ) { ?> |
|
555 | - <?php foreach ( $payments as $payment ) : ?> |
|
554 | + <?php if ( ! empty($payments)) { ?> |
|
555 | + <?php foreach ($payments as $payment) : ?> |
|
556 | 556 | <tr> |
557 | 557 | <td><?php echo $payment->ID; ?></td> |
558 | - <td><?php echo give_donation_amount( $payment->ID, array( 'currency' => true, 'amount' => true, 'type' => 'donor' ) ); ?></td> |
|
559 | - <td><?php echo date_i18n( give_date_format(), strtotime( $payment->post_date ) ); ?></td> |
|
560 | - <td><?php echo give_get_payment_status( $payment, true ); ?></td> |
|
558 | + <td><?php echo give_donation_amount($payment->ID, array('currency' => true, 'amount' => true, 'type' => 'donor')); ?></td> |
|
559 | + <td><?php echo date_i18n(give_date_format(), strtotime($payment->post_date)); ?></td> |
|
560 | + <td><?php echo give_get_payment_status($payment, true); ?></td> |
|
561 | 561 | <td> |
562 | 562 | <?php |
563 | 563 | printf( |
564 | 564 | '<a href="%1$s" aria-label="%2$s">%3$s</a>', |
565 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $payment->ID ), |
|
565 | + admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id='.$payment->ID), |
|
566 | 566 | sprintf( |
567 | 567 | /* translators: %s: Donation ID */ |
568 | - esc_attr__( 'View Donation %s.', 'give' ), |
|
568 | + esc_attr__('View Donation %s.', 'give'), |
|
569 | 569 | $payment->ID |
570 | 570 | ), |
571 | - __( 'View Donation', 'give' ) |
|
571 | + __('View Donation', 'give') |
|
572 | 572 | ); |
573 | 573 | ?> |
574 | 574 | |
@@ -583,47 +583,47 @@ discard block |
||
583 | 583 | * @param object $donor The donor object being displayed. |
584 | 584 | * @param object $payment The payment object being displayed. |
585 | 585 | */ |
586 | - do_action( 'give_donor_recent_purchases_actions', $donor, $payment ); |
|
586 | + do_action('give_donor_recent_purchases_actions', $donor, $payment); |
|
587 | 587 | ?> |
588 | 588 | </td> |
589 | 589 | </tr> |
590 | 590 | <?php endforeach; ?> |
591 | 591 | <?php } else { ?> |
592 | 592 | <tr> |
593 | - <td colspan="5"><?php _e( 'No donations found.', 'give' ); ?></td> |
|
593 | + <td colspan="5"><?php _e('No donations found.', 'give'); ?></td> |
|
594 | 594 | </tr> |
595 | 595 | <?php }// End if(). |
596 | 596 | ?> |
597 | 597 | </tbody> |
598 | 598 | </table> |
599 | 599 | |
600 | - <h3><?php _e( 'Completed Forms', 'give' ); ?></h3> |
|
600 | + <h3><?php _e('Completed Forms', 'give'); ?></h3> |
|
601 | 601 | <?php |
602 | - $donations = give_get_users_completed_donations( $donor->email ); |
|
602 | + $donations = give_get_users_completed_donations($donor->email); |
|
603 | 603 | ?> |
604 | 604 | <table class="wp-list-table widefat striped donations"> |
605 | 605 | <thead> |
606 | 606 | <tr> |
607 | - <th scope="col"><?php _e( 'Form', 'give' ); ?></th> |
|
608 | - <th scope="col" width="120px"><?php _e( 'Actions', 'give' ); ?></th> |
|
607 | + <th scope="col"><?php _e('Form', 'give'); ?></th> |
|
608 | + <th scope="col" width="120px"><?php _e('Actions', 'give'); ?></th> |
|
609 | 609 | </tr> |
610 | 610 | </thead> |
611 | 611 | <tbody> |
612 | - <?php if ( ! empty( $donations ) ) { ?> |
|
613 | - <?php foreach ( $donations as $donation ) : ?> |
|
612 | + <?php if ( ! empty($donations)) { ?> |
|
613 | + <?php foreach ($donations as $donation) : ?> |
|
614 | 614 | <tr> |
615 | 615 | <td><?php echo $donation->post_title; ?></td> |
616 | 616 | <td> |
617 | 617 | <?php |
618 | 618 | printf( |
619 | 619 | '<a href="%1$s" aria-label="%2$s">%3$s</a>', |
620 | - esc_url( admin_url( 'post.php?action=edit&post=' . $donation->ID ) ), |
|
620 | + esc_url(admin_url('post.php?action=edit&post='.$donation->ID)), |
|
621 | 621 | sprintf( |
622 | 622 | /* translators: %s: form name */ |
623 | - esc_attr__( 'View Form %s.', 'give' ), |
|
623 | + esc_attr__('View Form %s.', 'give'), |
|
624 | 624 | $donation->post_title |
625 | 625 | ), |
626 | - __( 'View Form', 'give' ) |
|
626 | + __('View Form', 'give') |
|
627 | 627 | ); |
628 | 628 | ?> |
629 | 629 | </td> |
@@ -631,7 +631,7 @@ discard block |
||
631 | 631 | <?php endforeach; ?> |
632 | 632 | <?php } else { ?> |
633 | 633 | <tr> |
634 | - <td colspan="2"><?php _e( 'No completed donations found.', 'give' ); ?></td> |
|
634 | + <td colspan="2"><?php _e('No completed donations found.', 'give'); ?></td> |
|
635 | 635 | </tr> |
636 | 636 | <?php } ?> |
637 | 637 | </tbody> |
@@ -645,7 +645,7 @@ discard block |
||
645 | 645 | * |
646 | 646 | * @param object $donor The donor object being displayed. |
647 | 647 | */ |
648 | - do_action( 'give_donor_after_tables', $donor ); |
|
648 | + do_action('give_donor_after_tables', $donor); |
|
649 | 649 | ?> |
650 | 650 | |
651 | 651 | </div> |
@@ -658,7 +658,7 @@ discard block |
||
658 | 658 | * |
659 | 659 | * @param object $donor The donor object being displayed. |
660 | 660 | */ |
661 | - do_action( 'give_donor_card_bottom', $donor ); |
|
661 | + do_action('give_donor_card_bottom', $donor); |
|
662 | 662 | |
663 | 663 | } |
664 | 664 | |
@@ -671,30 +671,30 @@ discard block |
||
671 | 671 | * |
672 | 672 | * @return void |
673 | 673 | */ |
674 | -function give_donor_notes_view( $donor ) { |
|
674 | +function give_donor_notes_view($donor) { |
|
675 | 675 | |
676 | - $paged = isset( $_GET['paged'] ) && is_numeric( $_GET['paged'] ) ? $_GET['paged'] : 1; |
|
677 | - $paged = absint( $paged ); |
|
676 | + $paged = isset($_GET['paged']) && is_numeric($_GET['paged']) ? $_GET['paged'] : 1; |
|
677 | + $paged = absint($paged); |
|
678 | 678 | $note_count = $donor->get_notes_count(); |
679 | - $per_page = apply_filters( 'give_donor_notes_per_page', 20 ); |
|
680 | - $total_pages = ceil( $note_count / $per_page ); |
|
681 | - $donor_notes = $donor->get_notes( $per_page, $paged ); |
|
679 | + $per_page = apply_filters('give_donor_notes_per_page', 20); |
|
680 | + $total_pages = ceil($note_count / $per_page); |
|
681 | + $donor_notes = $donor->get_notes($per_page, $paged); |
|
682 | 682 | ?> |
683 | 683 | |
684 | 684 | <div id="donor-notes-wrapper"> |
685 | 685 | <div class="donor-notes-header"> |
686 | - <?php echo get_avatar( $donor->email, 30 ); ?> <span><?php echo $donor->name; ?></span> |
|
686 | + <?php echo get_avatar($donor->email, 30); ?> <span><?php echo $donor->name; ?></span> |
|
687 | 687 | </div> |
688 | - <h3><?php _e( 'Notes', 'give' ); ?></h3> |
|
688 | + <h3><?php _e('Notes', 'give'); ?></h3> |
|
689 | 689 | |
690 | - <?php if ( 1 == $paged ) : ?> |
|
690 | + <?php if (1 == $paged) : ?> |
|
691 | 691 | <div style="display: block; margin-bottom: 55px;"> |
692 | - <form id="give-add-donor-note" method="post" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=notes&id=' . $donor->id ); ?>"> |
|
692 | + <form id="give-add-donor-note" method="post" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=notes&id='.$donor->id); ?>"> |
|
693 | 693 | <textarea id="donor-note" name="donor_note" class="donor-note-input" rows="10"></textarea> |
694 | 694 | <br /> |
695 | 695 | <input type="hidden" id="donor-id" name="customer_id" value="<?php echo $donor->id; ?>" /> |
696 | 696 | <input type="hidden" name="give_action" value="add-donor-note" /> |
697 | - <?php wp_nonce_field( 'add-donor-note', 'add_donor_note_nonce', true, true ); ?> |
|
697 | + <?php wp_nonce_field('add-donor-note', 'add_donor_note_nonce', true, true); ?> |
|
698 | 698 | <input id="add-donor-note" class="right button-primary" type="submit" value="Add Note" /> |
699 | 699 | </form> |
700 | 700 | </div> |
@@ -709,26 +709,26 @@ discard block |
||
709 | 709 | 'show_all' => true, |
710 | 710 | ); |
711 | 711 | |
712 | - echo paginate_links( $pagination_args ); |
|
712 | + echo paginate_links($pagination_args); |
|
713 | 713 | ?> |
714 | 714 | |
715 | 715 | <div id="give-donor-notes" class="postbox"> |
716 | - <?php if ( count( $donor_notes ) > 0 ) { ?> |
|
717 | - <?php foreach ( $donor_notes as $key => $note ) : ?> |
|
716 | + <?php if (count($donor_notes) > 0) { ?> |
|
717 | + <?php foreach ($donor_notes as $key => $note) : ?> |
|
718 | 718 | <div class="donor-note-wrapper dashboard-comment-wrap comment-item"> |
719 | 719 | <span class="note-content-wrap"> |
720 | - <?php echo stripslashes( $note ); ?> |
|
720 | + <?php echo stripslashes($note); ?> |
|
721 | 721 | </span> |
722 | 722 | </div> |
723 | 723 | <?php endforeach; ?> |
724 | 724 | <?php } else { ?> |
725 | 725 | <div class="give-no-donor-notes"> |
726 | - <?php _e( 'No donor notes found.', 'give' ); ?> |
|
726 | + <?php _e('No donor notes found.', 'give'); ?> |
|
727 | 727 | </div> |
728 | 728 | <?php } ?> |
729 | 729 | </div> |
730 | 730 | |
731 | - <?php echo paginate_links( $pagination_args ); ?> |
|
731 | + <?php echo paginate_links($pagination_args); ?> |
|
732 | 732 | |
733 | 733 | </div> |
734 | 734 | |
@@ -744,9 +744,9 @@ discard block |
||
744 | 744 | * |
745 | 745 | * @return void |
746 | 746 | */ |
747 | -function give_donor_delete_view( $donor ) { |
|
747 | +function give_donor_delete_view($donor) { |
|
748 | 748 | |
749 | - $donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' ); |
|
749 | + $donor_edit_role = apply_filters('give_edit_donors_role', 'edit_give_payments'); |
|
750 | 750 | |
751 | 751 | /** |
752 | 752 | * Fires in donor delete screen, above the content. |
@@ -755,15 +755,15 @@ discard block |
||
755 | 755 | * |
756 | 756 | * @param object $donor The donor object being displayed. |
757 | 757 | */ |
758 | - do_action( 'give_donor_delete_top', $donor ); |
|
758 | + do_action('give_donor_delete_top', $donor); |
|
759 | 759 | ?> |
760 | 760 | |
761 | 761 | <div class="info-wrapper donor-section"> |
762 | 762 | |
763 | - <form id="delete-donor" method="post" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=delete&id=' . $donor->id ); ?>"> |
|
763 | + <form id="delete-donor" method="post" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=delete&id='.$donor->id); ?>"> |
|
764 | 764 | |
765 | 765 | <div class="donor-notes-header"> |
766 | - <?php echo get_avatar( $donor->email, 30 ); ?> <span><?php echo $donor->name; ?></span> |
|
766 | + <?php echo get_avatar($donor->email, 30); ?> <span><?php echo $donor->name; ?></span> |
|
767 | 767 | </div> |
768 | 768 | |
769 | 769 | |
@@ -771,20 +771,20 @@ discard block |
||
771 | 771 | |
772 | 772 | <span class="delete-donor-options"> |
773 | 773 | <p> |
774 | - <?php echo Give()->html->checkbox( array( |
|
774 | + <?php echo Give()->html->checkbox(array( |
|
775 | 775 | 'name' => 'give-donor-delete-confirm', |
776 | - ) ); ?> |
|
777 | - <label for="give-donor-delete-confirm"><?php _e( 'Are you sure you want to delete this donor?', 'give' ); ?></label> |
|
776 | + )); ?> |
|
777 | + <label for="give-donor-delete-confirm"><?php _e('Are you sure you want to delete this donor?', 'give'); ?></label> |
|
778 | 778 | </p> |
779 | 779 | |
780 | 780 | <p> |
781 | - <?php echo Give()->html->checkbox( array( |
|
781 | + <?php echo Give()->html->checkbox(array( |
|
782 | 782 | 'name' => 'give-donor-delete-records', |
783 | 783 | 'options' => array( |
784 | 784 | 'disabled' => true, |
785 | 785 | ), |
786 | - ) ); ?> |
|
787 | - <label for="give-donor-delete-records"><?php _e( 'Delete all associated donations and records?', 'give' ); ?></label> |
|
786 | + )); ?> |
|
787 | + <label for="give-donor-delete-records"><?php _e('Delete all associated donations and records?', 'give'); ?></label> |
|
788 | 788 | </p> |
789 | 789 | |
790 | 790 | <?php |
@@ -797,16 +797,16 @@ discard block |
||
797 | 797 | * |
798 | 798 | * @param object $donor The donor object being displayed. |
799 | 799 | */ |
800 | - do_action( 'give_donor_delete_inputs', $donor ); |
|
800 | + do_action('give_donor_delete_inputs', $donor); |
|
801 | 801 | ?> |
802 | 802 | </span> |
803 | 803 | |
804 | 804 | <span id="donor-edit-actions"> |
805 | 805 | <input type="hidden" name="customer_id" value="<?php echo $donor->id; ?>" /> |
806 | - <?php wp_nonce_field( 'delete-donor', '_wpnonce', false, true ); ?> |
|
806 | + <?php wp_nonce_field('delete-donor', '_wpnonce', false, true); ?> |
|
807 | 807 | <input type="hidden" name="give_action" value="delete-donor" /> |
808 | - <input type="submit" disabled="disabled" id="give-delete-donor" class="button-primary" value="<?php _e( 'Delete Donor', 'give' ); ?>" /> |
|
809 | - <a id="give-delete-donor-cancel" href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ); ?>" class="delete"><?php _e( 'Cancel', 'give' ); ?></a> |
|
808 | + <input type="submit" disabled="disabled" id="give-delete-donor" class="button-primary" value="<?php _e('Delete Donor', 'give'); ?>" /> |
|
809 | + <a id="give-delete-donor-cancel" href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id); ?>" class="delete"><?php _e('Cancel', 'give'); ?></a> |
|
810 | 810 | </span> |
811 | 811 | |
812 | 812 | </div> |
@@ -822,5 +822,5 @@ discard block |
||
822 | 822 | * |
823 | 823 | * @param object $donor The donor object being displayed. |
824 | 824 | */ |
825 | - do_action( 'give_donor_delete_bottom', $donor ); |
|
825 | + do_action('give_donor_delete_bottom', $donor); |
|
826 | 826 | } |
@@ -12,13 +12,13 @@ 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 | |
19 | 19 | // Load WP_List_Table if not loaded. |
20 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
21 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
20 | +if ( ! class_exists('WP_List_Table')) { |
|
21 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | /** |
@@ -61,11 +61,11 @@ discard block |
||
61 | 61 | public function __construct() { |
62 | 62 | |
63 | 63 | // Set parent defaults. |
64 | - parent::__construct( array( |
|
65 | - 'singular' => __( 'Donor', 'give' ), // Singular name of the listed records. |
|
66 | - 'plural' => __( 'Donors', 'give' ), // Plural name of the listed records. |
|
64 | + parent::__construct(array( |
|
65 | + 'singular' => __('Donor', 'give'), // Singular name of the listed records. |
|
66 | + 'plural' => __('Donors', 'give'), // Plural name of the listed records. |
|
67 | 67 | 'ajax' => false, // Does this table support ajax?. |
68 | - ) ); |
|
68 | + )); |
|
69 | 69 | |
70 | 70 | } |
71 | 71 | |
@@ -80,23 +80,23 @@ discard block |
||
80 | 80 | * |
81 | 81 | * @return void |
82 | 82 | */ |
83 | - public function search_box( $text, $input_id ) { |
|
84 | - $input_id = $input_id . '-search-input'; |
|
83 | + public function search_box($text, $input_id) { |
|
84 | + $input_id = $input_id.'-search-input'; |
|
85 | 85 | |
86 | - if ( ! empty( $_REQUEST['orderby'] ) ) { |
|
87 | - echo sprintf( '<input type="hidden" name="orderby" value="%1$s" />', esc_attr( $_REQUEST['orderby'] ) ); |
|
86 | + if ( ! empty($_REQUEST['orderby'])) { |
|
87 | + echo sprintf('<input type="hidden" name="orderby" value="%1$s" />', esc_attr($_REQUEST['orderby'])); |
|
88 | 88 | } |
89 | 89 | |
90 | - if ( ! empty( $_REQUEST['order'] ) ) { |
|
91 | - echo sprintf( '<input type="hidden" name="order" value="%1$s" />', esc_attr( $_REQUEST['order'] ) ); |
|
90 | + if ( ! empty($_REQUEST['order'])) { |
|
91 | + echo sprintf('<input type="hidden" name="order" value="%1$s" />', esc_attr($_REQUEST['order'])); |
|
92 | 92 | } |
93 | 93 | ?> |
94 | 94 | <p class="search-box" role="search"> |
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( |
|
97 | + <?php submit_button($text, 'button', false, false, array( |
|
98 | 98 | 'ID' => 'search-submit', |
99 | - ) ); ?> |
|
99 | + )); ?> |
|
100 | 100 | </p> |
101 | 101 | <?php |
102 | 102 | } |
@@ -112,32 +112,32 @@ discard block |
||
112 | 112 | * |
113 | 113 | * @return string Column Name. |
114 | 114 | */ |
115 | - public function column_default( $donor, $column_name ) { |
|
115 | + public function column_default($donor, $column_name) { |
|
116 | 116 | |
117 | - switch ( $column_name ) { |
|
117 | + switch ($column_name) { |
|
118 | 118 | |
119 | 119 | case 'num_donations' : |
120 | 120 | $value = sprintf( |
121 | 121 | '<a href="%s">%s</a>', |
122 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&donor=' . absint( $donor['id'] ) ), |
|
123 | - esc_html( $donor['num_donations'] ) |
|
122 | + admin_url('edit.php?post_type=give_forms&page=give-payment-history&donor='.absint($donor['id'])), |
|
123 | + esc_html($donor['num_donations']) |
|
124 | 124 | ); |
125 | 125 | break; |
126 | 126 | |
127 | 127 | case 'amount_spent' : |
128 | - $value = give_currency_filter( give_format_amount( $donor[ $column_name ], array( 'sanitize' => false ) ) ); |
|
128 | + $value = give_currency_filter(give_format_amount($donor[$column_name], array('sanitize' => false))); |
|
129 | 129 | break; |
130 | 130 | |
131 | 131 | case 'date_created' : |
132 | - $value = date_i18n( give_date_format(), strtotime( $donor['date_created'] ) ); |
|
132 | + $value = date_i18n(give_date_format(), strtotime($donor['date_created'])); |
|
133 | 133 | break; |
134 | 134 | |
135 | 135 | default: |
136 | - $value = isset( $donor[ $column_name ] ) ? $donor[ $column_name ] : null; |
|
136 | + $value = isset($donor[$column_name]) ? $donor[$column_name] : null; |
|
137 | 137 | break; |
138 | 138 | } |
139 | 139 | |
140 | - return apply_filters( "give_donors_column_{$column_name}", $value, $donor['id'] ); |
|
140 | + return apply_filters("give_donors_column_{$column_name}", $value, $donor['id']); |
|
141 | 141 | |
142 | 142 | } |
143 | 143 | |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | * |
152 | 152 | * @return string |
153 | 153 | */ |
154 | - public function column_cb( $donor ){ |
|
154 | + public function column_cb($donor) { |
|
155 | 155 | return sprintf( |
156 | 156 | '<input class="donor-selector" type="checkbox" name="%1$s[]" value="%2$d" data-name="%3$s" />', |
157 | 157 | $this->_args['singular'], |
@@ -170,13 +170,13 @@ discard block |
||
170 | 170 | * |
171 | 171 | * @return string |
172 | 172 | */ |
173 | - public function column_name( $donor ) { |
|
174 | - $name = '#' . $donor['id'] . ' '; |
|
175 | - $name .= ! empty( $donor['name'] ) ? $donor['name'] : '<em>' . __( 'Unnamed Donor', 'give' ) . '</em>'; |
|
176 | - $view_url = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor['id'] ); |
|
177 | - $actions = $this->get_row_actions( $donor ); |
|
173 | + public function column_name($donor) { |
|
174 | + $name = '#'.$donor['id'].' '; |
|
175 | + $name .= ! empty($donor['name']) ? $donor['name'] : '<em>'.__('Unnamed Donor', 'give').'</em>'; |
|
176 | + $view_url = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor['id']); |
|
177 | + $actions = $this->get_row_actions($donor); |
|
178 | 178 | |
179 | - return '<a href="' . esc_url( $view_url ) . '">' . $name . '</a>' . $this->row_actions( $actions ); |
|
179 | + return '<a href="'.esc_url($view_url).'">'.$name.'</a>'.$this->row_actions($actions); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | /** |
@@ -190,14 +190,14 @@ discard block |
||
190 | 190 | public function get_columns() { |
191 | 191 | $columns = array( |
192 | 192 | 'cb' => '<input type="checkbox" />', // Render a checkbox instead of text. |
193 | - 'name' => __( 'Name', 'give' ), |
|
194 | - 'email' => __( 'Email', 'give' ), |
|
195 | - 'num_donations' => __( 'Donations', 'give' ), |
|
196 | - 'amount_spent' => __( 'Total Donated', 'give' ), |
|
197 | - 'date_created' => __( 'Date Created', 'give' ), |
|
193 | + 'name' => __('Name', 'give'), |
|
194 | + 'email' => __('Email', 'give'), |
|
195 | + 'num_donations' => __('Donations', 'give'), |
|
196 | + 'amount_spent' => __('Total Donated', 'give'), |
|
197 | + 'date_created' => __('Date Created', 'give'), |
|
198 | 198 | ); |
199 | 199 | |
200 | - return apply_filters( 'give_list_donors_columns', $columns ); |
|
200 | + return apply_filters('give_list_donors_columns', $columns); |
|
201 | 201 | |
202 | 202 | } |
203 | 203 | |
@@ -211,13 +211,13 @@ discard block |
||
211 | 211 | public function get_sortable_columns() { |
212 | 212 | |
213 | 213 | $columns = array( |
214 | - 'date_created' => array( 'date_created', true ), |
|
215 | - 'name' => array( 'name', true ), |
|
216 | - 'num_donations' => array( 'purchase_count', false ), |
|
217 | - 'amount_spent' => array( 'purchase_value', false ), |
|
214 | + 'date_created' => array('date_created', true), |
|
215 | + 'name' => array('name', true), |
|
216 | + 'num_donations' => array('purchase_count', false), |
|
217 | + 'amount_spent' => array('purchase_value', false), |
|
218 | 218 | ); |
219 | 219 | |
220 | - return apply_filters( 'give_list_donors_sortable_columns', $columns ); |
|
220 | + return apply_filters('give_list_donors_sortable_columns', $columns); |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | /** |
@@ -230,15 +230,15 @@ discard block |
||
230 | 230 | * |
231 | 231 | * @return array An array of action links. |
232 | 232 | */ |
233 | - public function get_row_actions( $donor ) { |
|
233 | + public function get_row_actions($donor) { |
|
234 | 234 | |
235 | 235 | $actions = array( |
236 | - 'view' => sprintf( '<a href="%1$s" aria-label="%2$s">%3$s</a>', admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor['id'] ), sprintf( esc_attr__( 'View "%s"', 'give' ), $donor['name'] ), __( 'View Donor', 'give' ) ), |
|
237 | - 'notes' => sprintf( '<a href="%1$s" aria-label="%2$s">%3$s</a>', admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=notes&id=' . $donor['id'] ), sprintf( esc_attr__( 'Notes for "%s"', 'give' ), $donor['name'] ), __( 'Notes', 'give' ) ), |
|
238 | - 'delete' => sprintf( '<a class="%1$s" data-id="%2$s" href="#" aria-label="%3$s">%4$s</a>', 'give-single-donor-delete', $donor['id'],sprintf( esc_attr__( 'Delete "%s"', 'give' ), $donor['name'] ), __( 'Delete', 'give' ) ), |
|
236 | + 'view' => sprintf('<a href="%1$s" aria-label="%2$s">%3$s</a>', admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor['id']), sprintf(esc_attr__('View "%s"', 'give'), $donor['name']), __('View Donor', 'give')), |
|
237 | + 'notes' => sprintf('<a href="%1$s" aria-label="%2$s">%3$s</a>', admin_url('edit.php?post_type=give_forms&page=give-donors&view=notes&id='.$donor['id']), sprintf(esc_attr__('Notes for "%s"', 'give'), $donor['name']), __('Notes', 'give')), |
|
238 | + 'delete' => sprintf('<a class="%1$s" data-id="%2$s" href="#" aria-label="%3$s">%4$s</a>', 'give-single-donor-delete', $donor['id'], sprintf(esc_attr__('Delete "%s"', 'give'), $donor['name']), __('Delete', 'give')), |
|
239 | 239 | ); |
240 | 240 | |
241 | - return apply_filters( 'give_donor_row_actions', $actions, $donor ); |
|
241 | + return apply_filters('give_donor_row_actions', $actions, $donor); |
|
242 | 242 | |
243 | 243 | } |
244 | 244 | |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | * @return int Current page number. |
252 | 252 | */ |
253 | 253 | public function get_paged() { |
254 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
254 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
255 | 255 | } |
256 | 256 | |
257 | 257 | /** |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | * @return mixed string If search is present, false otherwise. |
264 | 264 | */ |
265 | 265 | public function get_search() { |
266 | - return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false; |
|
266 | + return ! empty($_GET['s']) ? urldecode(trim($_GET['s'])) : false; |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | /** |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | */ |
277 | 277 | public function get_bulk_actions() { |
278 | 278 | $actions = array( |
279 | - 'delete' => __( 'Delete', 'give' ), |
|
279 | + 'delete' => __('Delete', 'give'), |
|
280 | 280 | ); |
281 | 281 | return $actions; |
282 | 282 | } |
@@ -289,19 +289,19 @@ discard block |
||
289 | 289 | * @access protected |
290 | 290 | * @since 1.8.16 |
291 | 291 | */ |
292 | - protected function display_tablenav( $which ) { |
|
293 | - if ( 'top' === $which ) { |
|
294 | - wp_nonce_field( 'bulk-' . $this->_args['plural'], '_wpnonce', false ); |
|
292 | + protected function display_tablenav($which) { |
|
293 | + if ('top' === $which) { |
|
294 | + wp_nonce_field('bulk-'.$this->_args['plural'], '_wpnonce', false); |
|
295 | 295 | } |
296 | 296 | ?> |
297 | - <div class="tablenav <?php echo esc_attr( $which ); ?>"> |
|
298 | - <?php if ( $this->has_items() ): ?> |
|
297 | + <div class="tablenav <?php echo esc_attr($which); ?>"> |
|
298 | + <?php if ($this->has_items()): ?> |
|
299 | 299 | <div class="alignleft actions bulkactions"> |
300 | - <?php $this->bulk_actions( $which ); ?> |
|
300 | + <?php $this->bulk_actions($which); ?> |
|
301 | 301 | </div> |
302 | 302 | <?php endif; |
303 | - $this->extra_tablenav( $which ); |
|
304 | - $this->pagination( $which ); |
|
303 | + $this->extra_tablenav($which); |
|
304 | + $this->pagination($which); |
|
305 | 305 | ?> |
306 | 306 | <br class="clear" /> |
307 | 307 | </div> |
@@ -322,13 +322,13 @@ discard block |
||
322 | 322 | |
323 | 323 | // Get donor query. |
324 | 324 | $args = $this->get_donor_query(); |
325 | - $donors = Give()->donors->get_donors( $args ); |
|
325 | + $donors = Give()->donors->get_donors($args); |
|
326 | 326 | |
327 | - if ( $donors ) { |
|
327 | + if ($donors) { |
|
328 | 328 | |
329 | - foreach ( $donors as $donor ) { |
|
329 | + foreach ($donors as $donor) { |
|
330 | 330 | |
331 | - $user_id = ! empty( $donor->user_id ) ? intval( $donor->user_id ) : 0; |
|
331 | + $user_id = ! empty($donor->user_id) ? intval($donor->user_id) : 0; |
|
332 | 332 | |
333 | 333 | $data[] = array( |
334 | 334 | 'id' => $donor->id, |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | } |
343 | 343 | } |
344 | 344 | |
345 | - return apply_filters( 'give_donors_column_query_data', $data ); |
|
345 | + return apply_filters('give_donors_column_query_data', $data); |
|
346 | 346 | } |
347 | 347 | |
348 | 348 | /** |
@@ -357,9 +357,9 @@ discard block |
||
357 | 357 | |
358 | 358 | $_donor_query['number'] = - 1; |
359 | 359 | $_donor_query['offset'] = 0; |
360 | - $donors = Give()->donors->get_donors( $_donor_query ); |
|
360 | + $donors = Give()->donors->get_donors($_donor_query); |
|
361 | 361 | |
362 | - return count( $donors ); |
|
362 | + return count($donors); |
|
363 | 363 | } |
364 | 364 | |
365 | 365 | /** |
@@ -372,10 +372,10 @@ discard block |
||
372 | 372 | */ |
373 | 373 | public function get_donor_query() { |
374 | 374 | $paged = $this->get_paged(); |
375 | - $offset = $this->per_page * ( $paged - 1 ); |
|
375 | + $offset = $this->per_page * ($paged - 1); |
|
376 | 376 | $search = $this->get_search(); |
377 | - $order = isset( $_GET['order'] ) ? sanitize_text_field( $_GET['order'] ) : 'DESC'; |
|
378 | - $orderby = isset( $_GET['orderby'] ) ? sanitize_text_field( $_GET['orderby'] ) : 'id'; |
|
377 | + $order = isset($_GET['order']) ? sanitize_text_field($_GET['order']) : 'DESC'; |
|
378 | + $orderby = isset($_GET['orderby']) ? sanitize_text_field($_GET['orderby']) : 'id'; |
|
379 | 379 | |
380 | 380 | $args = array( |
381 | 381 | 'number' => $this->per_page, |
@@ -384,10 +384,10 @@ discard block |
||
384 | 384 | 'orderby' => $orderby, |
385 | 385 | ); |
386 | 386 | |
387 | - if ( $search ) { |
|
388 | - if ( is_email( $search ) ) { |
|
387 | + if ($search) { |
|
388 | + if (is_email($search)) { |
|
389 | 389 | $args['email'] = $search; |
390 | - } elseif ( is_numeric( $search ) ) { |
|
390 | + } elseif (is_numeric($search)) { |
|
391 | 391 | $args['id'] = $search; |
392 | 392 | } else { |
393 | 393 | $args['name'] = $search; |
@@ -405,9 +405,9 @@ discard block |
||
405 | 405 | * @since 1.8.17 |
406 | 406 | * @access public |
407 | 407 | */ |
408 | - public function single_row( $item ) { |
|
409 | - echo sprintf( '<tr id="donor-%1$d" data-id="%2$d" data-name="%3$s">', $item['id'], $item['id'], $item['name'] ); |
|
410 | - $this->single_row_columns( $item ); |
|
408 | + public function single_row($item) { |
|
409 | + echo sprintf('<tr id="donor-%1$d" data-id="%2$d" data-name="%3$s">', $item['id'], $item['id'], $item['name']); |
|
410 | + $this->single_row_columns($item); |
|
411 | 411 | echo '</tr>'; |
412 | 412 | } |
413 | 413 | |
@@ -420,11 +420,11 @@ discard block |
||
420 | 420 | public function display() { |
421 | 421 | $singular = $this->_args['singular']; |
422 | 422 | |
423 | - $this->display_tablenav( 'top' ); |
|
423 | + $this->display_tablenav('top'); |
|
424 | 424 | |
425 | - $this->screen->render_screen_reader_content( 'heading_list' ); |
|
425 | + $this->screen->render_screen_reader_content('heading_list'); |
|
426 | 426 | ?> |
427 | - <table class="wp-list-table <?php echo implode( ' ', $this->get_table_classes() ); ?>"> |
|
427 | + <table class="wp-list-table <?php echo implode(' ', $this->get_table_classes()); ?>"> |
|
428 | 428 | <thead> |
429 | 429 | <tr> |
430 | 430 | <?php $this->print_column_headers(); ?> |
@@ -432,7 +432,7 @@ discard block |
||
432 | 432 | </thead> |
433 | 433 | |
434 | 434 | <tbody id="the-list"<?php |
435 | - if ( $singular ) { |
|
435 | + if ($singular) { |
|
436 | 436 | echo " data-wp-lists='list:$singular'"; |
437 | 437 | } ?>> |
438 | 438 | <tr class="hidden"></tr> |
@@ -440,7 +440,7 @@ discard block |
||
440 | 440 | <td colspan="6" class="colspanchange"> |
441 | 441 | |
442 | 442 | <fieldset class="inline-edit-col-left"> |
443 | - <legend class="inline-edit-legend"><?php _e( 'BULK DELETE', 'give' ); ?></legend> |
|
443 | + <legend class="inline-edit-legend"><?php _e('BULK DELETE', 'give'); ?></legend> |
|
444 | 444 | <div class="inline-edit-col"> |
445 | 445 | <div id="bulk-titles"> |
446 | 446 | <div id="give-bulk-donors" class="give-bulk-donors"> |
@@ -453,22 +453,22 @@ discard block |
||
453 | 453 | <div class="inline-edit-col"> |
454 | 454 | <label> |
455 | 455 | <input id="give-delete-donor-confirm" type="checkbox" name="give-delete-donor-confirm"/> |
456 | - <?php _e( 'Are you sure you want to delete the selected donor(s)?', 'give' ); ?> |
|
456 | + <?php _e('Are you sure you want to delete the selected donor(s)?', 'give'); ?> |
|
457 | 457 | </label> |
458 | 458 | <label> |
459 | 459 | <input id="give-delete-donor-records" type="checkbox" name="give-delete-donor-records"/> |
460 | - <?php _e( 'Delete all associated donations and records?', 'give' ); ?> |
|
460 | + <?php _e('Delete all associated donations and records?', 'give'); ?> |
|
461 | 461 | </label> |
462 | 462 | </div> |
463 | 463 | </fieldset> |
464 | 464 | |
465 | 465 | <p class="submit inline-edit-save"> |
466 | 466 | <input type="hidden" name="give_action" value="delete_donor"/> |
467 | - <input type="hidden" name="s" value="<?php echo ( ! empty( $_GET['s'] ) ) ? $_GET['s'] : ''; ?>"/> |
|
468 | - <input type="hidden" name="orderby" value="<?php echo ( ! empty( $_GET['orderby'] ) ) ? $_GET['orderby'] : 'id'; ?>"/> |
|
469 | - <input type="hidden" name="order" value="<?php echo ( ! empty( $_GET['order'] ) ) ? $_GET['order'] : 'desc'; ?>"/> |
|
470 | - <button type="button" id="give-bulk-delete-cancel" class="button cancel alignleft"><?php _e( 'Cancel', 'give' ); ?></button> |
|
471 | - <input type="submit" id="give-bulk-delete-button" disabled class="button button-primary alignright" value="<?php _e( 'Delete', 'give' ); ?>"> |
|
467 | + <input type="hidden" name="s" value="<?php echo ( ! empty($_GET['s'])) ? $_GET['s'] : ''; ?>"/> |
|
468 | + <input type="hidden" name="orderby" value="<?php echo ( ! empty($_GET['orderby'])) ? $_GET['orderby'] : 'id'; ?>"/> |
|
469 | + <input type="hidden" name="order" value="<?php echo ( ! empty($_GET['order'])) ? $_GET['order'] : 'desc'; ?>"/> |
|
470 | + <button type="button" id="give-bulk-delete-cancel" class="button cancel alignleft"><?php _e('Cancel', 'give'); ?></button> |
|
471 | + <input type="submit" id="give-bulk-delete-button" disabled class="button button-primary alignright" value="<?php _e('Delete', 'give'); ?>"> |
|
472 | 472 | <br class="clear"> |
473 | 473 | </p> |
474 | 474 | </td> |
@@ -478,13 +478,13 @@ discard block |
||
478 | 478 | |
479 | 479 | <tfoot> |
480 | 480 | <tr> |
481 | - <?php $this->print_column_headers( false ); ?> |
|
481 | + <?php $this->print_column_headers(false); ?> |
|
482 | 482 | </tr> |
483 | 483 | </tfoot> |
484 | 484 | |
485 | 485 | </table> |
486 | 486 | <?php |
487 | - $this->display_tablenav( 'bottom' ); |
|
487 | + $this->display_tablenav('bottom'); |
|
488 | 488 | } |
489 | 489 | |
490 | 490 | /** |
@@ -501,16 +501,16 @@ discard block |
||
501 | 501 | $hidden = array(); // No hidden columns. |
502 | 502 | $sortable = $this->get_sortable_columns(); |
503 | 503 | |
504 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
504 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
505 | 505 | |
506 | 506 | $this->items = $this->donor_data(); |
507 | 507 | |
508 | 508 | $this->total = $this->get_donor_count(); |
509 | 509 | |
510 | - $this->set_pagination_args( array( |
|
510 | + $this->set_pagination_args(array( |
|
511 | 511 | 'total_items' => $this->total, |
512 | 512 | 'per_page' => $this->per_page, |
513 | - 'total_pages' => ceil( $this->total / $this->per_page ), |
|
514 | - ) ); |
|
513 | + 'total_pages' => ceil($this->total / $this->per_page), |
|
514 | + )); |
|
515 | 515 | } |
516 | 516 | } |