@@ -249,10 +249,10 @@ |
||
249 | 249 | $admin_message .= '<strong>' . __( 'Amount:', 'give' ) . '</strong> {amount}' . "\n\n"; |
250 | 250 | |
251 | 251 | $admin_message .= sprintf( |
252 | - '<a href="%1$s">%2$s</a>', |
|
253 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $payment_id ), |
|
254 | - __( 'View Donation Details »', 'give' ) |
|
255 | - ) . "\n\n"; |
|
252 | + '<a href="%1$s">%2$s</a>', |
|
253 | + admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $payment_id ), |
|
254 | + __( 'View Donation Details »', 'give' ) |
|
255 | + ) . "\n\n"; |
|
256 | 256 | |
257 | 257 | $admin_message = apply_filters( 'give_offline_admin_donation_notification', $admin_message, $payment_id ); |
258 | 258 | $admin_message = give_do_email_tags( $admin_message, $payment_id ); |
@@ -18,17 +18,17 @@ discard block |
||
18 | 18 | * |
19 | 19 | * @return array |
20 | 20 | */ |
21 | -function give_offline_register_gateway( $gateways ) { |
|
21 | +function give_offline_register_gateway($gateways) { |
|
22 | 22 | // Format: ID => Name |
23 | 23 | $gateways['offline'] = array( |
24 | - 'admin_label' => esc_attr__( 'Offline Donation', 'give' ), |
|
25 | - 'checkout_label' => esc_attr__( 'Offline Donation', 'give' ) |
|
24 | + 'admin_label' => esc_attr__('Offline Donation', 'give'), |
|
25 | + 'checkout_label' => esc_attr__('Offline Donation', 'give') |
|
26 | 26 | ); |
27 | 27 | |
28 | 28 | return $gateways; |
29 | 29 | } |
30 | 30 | |
31 | -add_filter( 'give_payment_gateways', 'give_offline_register_gateway', 1 ); |
|
31 | +add_filter('give_payment_gateways', 'give_offline_register_gateway', 1); |
|
32 | 32 | |
33 | 33 | |
34 | 34 | /** |
@@ -40,9 +40,9 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @return void |
42 | 42 | */ |
43 | -function give_offline_payment_cc_form( $form_id ) { |
|
43 | +function give_offline_payment_cc_form($form_id) { |
|
44 | 44 | // Get offline payment instruction. |
45 | - $offline_instructions = give_get_offline_payment_instruction( $form_id, true ); |
|
45 | + $offline_instructions = give_get_offline_payment_instruction($form_id, true); |
|
46 | 46 | |
47 | 47 | ob_start(); |
48 | 48 | |
@@ -53,10 +53,10 @@ discard block |
||
53 | 53 | * |
54 | 54 | * @param int $form_id Give form id. |
55 | 55 | */ |
56 | - do_action( 'give_before_offline_info_fields', $form_id ); |
|
56 | + do_action('give_before_offline_info_fields', $form_id); |
|
57 | 57 | ?> |
58 | 58 | <fieldset id="give_offline_payment_info"> |
59 | - <?php echo stripslashes( $offline_instructions ); ?> |
|
59 | + <?php echo stripslashes($offline_instructions); ?> |
|
60 | 60 | </fieldset> |
61 | 61 | <?php |
62 | 62 | /** |
@@ -66,35 +66,35 @@ discard block |
||
66 | 66 | * |
67 | 67 | * @param int $form_id Give form id. |
68 | 68 | */ |
69 | - do_action( 'give_after_offline_info_fields', $form_id ); |
|
69 | + do_action('give_after_offline_info_fields', $form_id); |
|
70 | 70 | |
71 | 71 | echo ob_get_clean(); |
72 | 72 | } |
73 | 73 | |
74 | -add_action( 'give_offline_cc_form', 'give_offline_payment_cc_form' ); |
|
74 | +add_action('give_offline_cc_form', 'give_offline_payment_cc_form'); |
|
75 | 75 | |
76 | 76 | /** |
77 | 77 | * Give Offline Billing Field |
78 | 78 | * |
79 | 79 | * @param $form_id |
80 | 80 | */ |
81 | -function give_offline_billing_fields( $form_id ) { |
|
81 | +function give_offline_billing_fields($form_id) { |
|
82 | 82 | //Enable Default CC fields (billing info) |
83 | - $post_offline_cc_fields = give_get_meta( $form_id, '_give_offline_donation_enable_billing_fields_single', true ); |
|
84 | - $post_offline_customize_option = give_get_meta( $form_id, '_give_customize_offline_donations', true ); |
|
83 | + $post_offline_cc_fields = give_get_meta($form_id, '_give_offline_donation_enable_billing_fields_single', true); |
|
84 | + $post_offline_customize_option = give_get_meta($form_id, '_give_customize_offline_donations', true); |
|
85 | 85 | |
86 | - $global_offline_cc_fields = give_get_option( 'give_offline_donation_enable_billing_fields' ); |
|
86 | + $global_offline_cc_fields = give_get_option('give_offline_donation_enable_billing_fields'); |
|
87 | 87 | |
88 | 88 | //Output CC Address fields if global option is on and user hasn't elected to customize this form's offline donation options |
89 | 89 | if ( |
90 | - ( give_is_setting_enabled( $post_offline_customize_option, 'global' ) && give_is_setting_enabled( $global_offline_cc_fields ) ) |
|
91 | - || ( give_is_setting_enabled( $post_offline_customize_option, 'enabled' ) && give_is_setting_enabled( $post_offline_cc_fields ) ) |
|
90 | + (give_is_setting_enabled($post_offline_customize_option, 'global') && give_is_setting_enabled($global_offline_cc_fields)) |
|
91 | + || (give_is_setting_enabled($post_offline_customize_option, 'enabled') && give_is_setting_enabled($post_offline_cc_fields)) |
|
92 | 92 | ) { |
93 | - give_default_cc_address_fields( $form_id ); |
|
93 | + give_default_cc_address_fields($form_id); |
|
94 | 94 | } |
95 | 95 | } |
96 | 96 | |
97 | -add_action( 'give_before_offline_info_fields', 'give_offline_billing_fields', 10, 1 ); |
|
97 | +add_action('give_before_offline_info_fields', 'give_offline_billing_fields', 10, 1); |
|
98 | 98 | |
99 | 99 | /** |
100 | 100 | * Process the payment |
@@ -105,18 +105,18 @@ discard block |
||
105 | 105 | * |
106 | 106 | * @return void |
107 | 107 | */ |
108 | -function give_offline_process_payment( $purchase_data ) { |
|
108 | +function give_offline_process_payment($purchase_data) { |
|
109 | 109 | |
110 | 110 | // Setup the payment details. |
111 | 111 | $payment_data = array( |
112 | 112 | 'price' => $purchase_data['price'], |
113 | 113 | 'give_form_title' => $purchase_data['post_data']['give-form-title'], |
114 | - 'give_form_id' => intval( $purchase_data['post_data']['give-form-id'] ), |
|
115 | - 'give_price_id' => isset( $purchase_data['post_data']['give-price-id'] ) ? $purchase_data['post_data']['give-price-id'] : '', |
|
114 | + 'give_form_id' => intval($purchase_data['post_data']['give-form-id']), |
|
115 | + 'give_price_id' => isset($purchase_data['post_data']['give-price-id']) ? $purchase_data['post_data']['give-price-id'] : '', |
|
116 | 116 | 'date' => $purchase_data['date'], |
117 | 117 | 'user_email' => $purchase_data['user_email'], |
118 | 118 | 'purchase_key' => $purchase_data['purchase_key'], |
119 | - 'currency' => give_get_currency( $purchase_data['post_data']['give-form-id'], $purchase_data ), |
|
119 | + 'currency' => give_get_currency($purchase_data['post_data']['give-form-id'], $purchase_data), |
|
120 | 120 | 'user_info' => $purchase_data['user_info'], |
121 | 121 | 'status' => 'pending', |
122 | 122 | 'gateway' => 'offline' |
@@ -124,20 +124,20 @@ discard block |
||
124 | 124 | |
125 | 125 | |
126 | 126 | // record the pending payment |
127 | - $payment = give_insert_payment( $payment_data ); |
|
127 | + $payment = give_insert_payment($payment_data); |
|
128 | 128 | |
129 | - if ( $payment ) { |
|
130 | - give_offline_send_admin_notice( $payment ); |
|
131 | - give_offline_send_donor_instructions( $payment ); |
|
129 | + if ($payment) { |
|
130 | + give_offline_send_admin_notice($payment); |
|
131 | + give_offline_send_donor_instructions($payment); |
|
132 | 132 | give_send_to_success_page(); |
133 | 133 | } else { |
134 | 134 | // if errors are present, send the user back to the donation form so they can be corrected |
135 | - give_send_back_to_checkout( '?payment-mode=' . $purchase_data['post_data']['give-gateway'] ); |
|
135 | + give_send_back_to_checkout('?payment-mode='.$purchase_data['post_data']['give-gateway']); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | } |
139 | 139 | |
140 | -add_action( 'give_gateway_offline', 'give_offline_process_payment' ); |
|
140 | +add_action('give_gateway_offline', 'give_offline_process_payment'); |
|
141 | 141 | |
142 | 142 | |
143 | 143 | /** |
@@ -150,59 +150,59 @@ discard block |
||
150 | 150 | * @since 1.0 |
151 | 151 | * @return void |
152 | 152 | */ |
153 | -function give_offline_send_donor_instructions( $payment_id = 0 ) { |
|
153 | +function give_offline_send_donor_instructions($payment_id = 0) { |
|
154 | 154 | |
155 | - $payment_data = give_get_payment_meta( $payment_id ); |
|
156 | - $post_offline_customization_option = give_get_meta( $payment_data['form_id'], '_give_customize_offline_donations', true ); |
|
155 | + $payment_data = give_get_payment_meta($payment_id); |
|
156 | + $post_offline_customization_option = give_get_meta($payment_data['form_id'], '_give_customize_offline_donations', true); |
|
157 | 157 | |
158 | 158 | //Customize email content depending on whether the single form has been customized |
159 | - $email_content = give_get_option( 'global_offline_donation_email' ); |
|
159 | + $email_content = give_get_option('global_offline_donation_email'); |
|
160 | 160 | |
161 | - if ( give_is_setting_enabled( $post_offline_customization_option, 'enabled' ) ) { |
|
162 | - $email_content = give_get_meta( $payment_data['form_id'], '_give_offline_donation_email', true ); |
|
161 | + if (give_is_setting_enabled($post_offline_customization_option, 'enabled')) { |
|
162 | + $email_content = give_get_meta($payment_data['form_id'], '_give_offline_donation_email', true); |
|
163 | 163 | } |
164 | 164 | |
165 | - $from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ); |
|
165 | + $from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)); |
|
166 | 166 | |
167 | 167 | /** |
168 | 168 | * Filters the from name. |
169 | 169 | * |
170 | 170 | * @since 1.7 |
171 | 171 | */ |
172 | - $from_name = apply_filters( 'give_donation_from_name', $from_name, $payment_id, $payment_data ); |
|
172 | + $from_name = apply_filters('give_donation_from_name', $from_name, $payment_id, $payment_data); |
|
173 | 173 | |
174 | - $from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) ); |
|
174 | + $from_email = give_get_option('from_email', get_bloginfo('admin_email')); |
|
175 | 175 | |
176 | 176 | /** |
177 | 177 | * Filters the from email. |
178 | 178 | * |
179 | 179 | * @since 1.7 |
180 | 180 | */ |
181 | - $from_email = apply_filters( 'give_donation_from_address', $from_email, $payment_id, $payment_data ); |
|
181 | + $from_email = apply_filters('give_donation_from_address', $from_email, $payment_id, $payment_data); |
|
182 | 182 | |
183 | - $to_email = give_get_payment_user_email( $payment_id ); |
|
183 | + $to_email = give_get_payment_user_email($payment_id); |
|
184 | 184 | |
185 | - $subject = give_get_option( 'offline_donation_subject', __( 'Offline Donation Instructions', 'give' ) ); |
|
186 | - if ( give_is_setting_enabled( $post_offline_customization_option, 'enabled' ) ) { |
|
187 | - $subject = give_get_meta( $payment_data['form_id'], '_give_offline_donation_subject', true ); |
|
185 | + $subject = give_get_option('offline_donation_subject', __('Offline Donation Instructions', 'give')); |
|
186 | + if (give_is_setting_enabled($post_offline_customization_option, 'enabled')) { |
|
187 | + $subject = give_get_meta($payment_data['form_id'], '_give_offline_donation_subject', true); |
|
188 | 188 | } |
189 | 189 | |
190 | - $subject = apply_filters( 'give_offline_donation_subject', wp_strip_all_tags( $subject ), $payment_id ); |
|
191 | - $subject = give_do_email_tags( $subject, $payment_id ); |
|
190 | + $subject = apply_filters('give_offline_donation_subject', wp_strip_all_tags($subject), $payment_id); |
|
191 | + $subject = give_do_email_tags($subject, $payment_id); |
|
192 | 192 | |
193 | - $attachments = apply_filters( 'give_offline_donation_attachments', array(), $payment_id, $payment_data ); |
|
194 | - $message = give_do_email_tags( $email_content, $payment_id ); |
|
193 | + $attachments = apply_filters('give_offline_donation_attachments', array(), $payment_id, $payment_data); |
|
194 | + $message = give_do_email_tags($email_content, $payment_id); |
|
195 | 195 | |
196 | 196 | $emails = Give()->emails; |
197 | 197 | |
198 | - $emails->__set( 'from_name', $from_name ); |
|
199 | - $emails->__set( 'from_email', $from_email ); |
|
200 | - $emails->__set( 'heading', __( 'Offline Donation Instructions', 'give' ) ); |
|
198 | + $emails->__set('from_name', $from_name); |
|
199 | + $emails->__set('from_email', $from_email); |
|
200 | + $emails->__set('heading', __('Offline Donation Instructions', 'give')); |
|
201 | 201 | |
202 | - $headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data ); |
|
203 | - $emails->__set( 'headers', $headers ); |
|
202 | + $headers = apply_filters('give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data); |
|
203 | + $emails->__set('headers', $headers); |
|
204 | 204 | |
205 | - $emails->send( $to_email, $subject, $message, $attachments ); |
|
205 | + $emails->send($to_email, $subject, $message, $attachments); |
|
206 | 206 | |
207 | 207 | } |
208 | 208 | |
@@ -219,54 +219,54 @@ discard block |
||
219 | 219 | * @return void |
220 | 220 | * |
221 | 221 | */ |
222 | -function give_offline_send_admin_notice( $payment_id = 0 ) { |
|
222 | +function give_offline_send_admin_notice($payment_id = 0) { |
|
223 | 223 | |
224 | 224 | /* Send an email notification to the admin */ |
225 | 225 | $admin_email = give_get_admin_notice_emails(); |
226 | - $user_info = give_get_payment_meta_user_info( $payment_id ); |
|
226 | + $user_info = give_get_payment_meta_user_info($payment_id); |
|
227 | 227 | |
228 | - if ( isset( $user_info['id'] ) && $user_info['id'] > 0 ) { |
|
229 | - $user_data = get_userdata( $user_info['id'] ); |
|
228 | + if (isset($user_info['id']) && $user_info['id'] > 0) { |
|
229 | + $user_data = get_userdata($user_info['id']); |
|
230 | 230 | $name = $user_data->display_name; |
231 | - } elseif ( isset( $user_info['first_name'] ) && isset( $user_info['last_name'] ) ) { |
|
232 | - $name = $user_info['first_name'] . ' ' . $user_info['last_name']; |
|
231 | + } elseif (isset($user_info['first_name']) && isset($user_info['last_name'])) { |
|
232 | + $name = $user_info['first_name'].' '.$user_info['last_name']; |
|
233 | 233 | } else { |
234 | 234 | $name = $user_info['email']; |
235 | 235 | } |
236 | 236 | |
237 | - $amount = give_currency_filter( give_format_amount( give_get_payment_amount( $payment_id ), array( 'sanitize' => false ) ) ); |
|
237 | + $amount = give_currency_filter(give_format_amount(give_get_payment_amount($payment_id), array('sanitize' => false))); |
|
238 | 238 | |
239 | - $admin_subject = apply_filters( 'give_offline_admin_donation_notification_subject', __( 'New Pending Donation', 'give' ), $payment_id ); |
|
239 | + $admin_subject = apply_filters('give_offline_admin_donation_notification_subject', __('New Pending Donation', 'give'), $payment_id); |
|
240 | 240 | |
241 | - $admin_message = __( 'Dear Admin,', 'give' ) . "\n\n"; |
|
242 | - $admin_message .= sprintf(__( 'A new offline donation has been made on your website for %s.', 'give' ), $amount) . "\n\n"; |
|
243 | - $admin_message .= __( 'The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give' ) . "\n\n"; |
|
241 | + $admin_message = __('Dear Admin,', 'give')."\n\n"; |
|
242 | + $admin_message .= sprintf(__('A new offline donation has been made on your website for %s.', 'give'), $amount)."\n\n"; |
|
243 | + $admin_message .= __('The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give')."\n\n"; |
|
244 | 244 | |
245 | 245 | |
246 | - $admin_message .= '<strong>' . __( 'Donor:', 'give' ) . '</strong> {fullname}' . "\n"; |
|
247 | - $admin_message .= '<strong>' . __( 'Amount:', 'give' ) . '</strong> {amount}' . "\n\n"; |
|
246 | + $admin_message .= '<strong>'.__('Donor:', 'give').'</strong> {fullname}'."\n"; |
|
247 | + $admin_message .= '<strong>'.__('Amount:', 'give').'</strong> {amount}'."\n\n"; |
|
248 | 248 | |
249 | 249 | $admin_message .= sprintf( |
250 | 250 | '<a href="%1$s">%2$s</a>', |
251 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $payment_id ), |
|
252 | - __( 'View Donation Details »', 'give' ) |
|
253 | - ) . "\n\n"; |
|
251 | + admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id='.$payment_id), |
|
252 | + __('View Donation Details »', 'give') |
|
253 | + )."\n\n"; |
|
254 | 254 | |
255 | - $admin_message = apply_filters( 'give_offline_admin_donation_notification', $admin_message, $payment_id ); |
|
256 | - $admin_message = give_do_email_tags( $admin_message, $payment_id ); |
|
255 | + $admin_message = apply_filters('give_offline_admin_donation_notification', $admin_message, $payment_id); |
|
256 | + $admin_message = give_do_email_tags($admin_message, $payment_id); |
|
257 | 257 | |
258 | - $attachments = apply_filters( 'give_offline_admin_donation_notification_attachments', array(), $payment_id ); |
|
259 | - $admin_headers = apply_filters( 'give_offline_admin_donation_notification_headers', array(), $payment_id ); |
|
258 | + $attachments = apply_filters('give_offline_admin_donation_notification_attachments', array(), $payment_id); |
|
259 | + $admin_headers = apply_filters('give_offline_admin_donation_notification_headers', array(), $payment_id); |
|
260 | 260 | |
261 | 261 | //Send Email |
262 | 262 | $emails = Give()->emails; |
263 | - $emails->__set( 'heading', __( 'New Offline Donation', 'give' ) ); |
|
263 | + $emails->__set('heading', __('New Offline Donation', 'give')); |
|
264 | 264 | |
265 | - if ( ! empty( $admin_headers ) ) { |
|
266 | - $emails->__set( 'headers', $admin_headers ); |
|
265 | + if ( ! empty($admin_headers)) { |
|
266 | + $emails->__set('headers', $admin_headers); |
|
267 | 267 | } |
268 | 268 | |
269 | - $emails->send( $admin_email, $admin_subject, $admin_message, $attachments ); |
|
269 | + $emails->send($admin_email, $admin_subject, $admin_message, $attachments); |
|
270 | 270 | |
271 | 271 | } |
272 | 272 | |
@@ -278,20 +278,20 @@ discard block |
||
278 | 278 | * |
279 | 279 | * @return array |
280 | 280 | */ |
281 | -function give_offline_add_settings( $settings ) { |
|
281 | +function give_offline_add_settings($settings) { |
|
282 | 282 | |
283 | 283 | // Bailout: Do not show offline gateways setting in to metabox if its disabled globally. |
284 | - if ( in_array( 'offline', give_get_option( 'gateways' ) ) ) { |
|
284 | + if (in_array('offline', give_get_option('gateways'))) { |
|
285 | 285 | return $settings; |
286 | 286 | } |
287 | 287 | |
288 | 288 | //Vars |
289 | 289 | $prefix = '_give_'; |
290 | 290 | |
291 | - $is_gateway_active = give_is_gateway_active( 'offline' ); |
|
291 | + $is_gateway_active = give_is_gateway_active('offline'); |
|
292 | 292 | |
293 | 293 | //this gateway isn't active |
294 | - if ( ! $is_gateway_active ) { |
|
294 | + if ( ! $is_gateway_active) { |
|
295 | 295 | //return settings and bounce |
296 | 296 | return $settings; |
297 | 297 | } |
@@ -300,34 +300,34 @@ discard block |
||
300 | 300 | $check_settings = array( |
301 | 301 | |
302 | 302 | array( |
303 | - 'name' => __( 'Offline Donations', 'give' ), |
|
304 | - 'desc' => __( 'Do you want to customize the donation instructions for this form?', 'give' ), |
|
305 | - 'id' => $prefix . 'customize_offline_donations', |
|
303 | + 'name' => __('Offline Donations', 'give'), |
|
304 | + 'desc' => __('Do you want to customize the donation instructions for this form?', 'give'), |
|
305 | + 'id' => $prefix.'customize_offline_donations', |
|
306 | 306 | 'type' => 'radio_inline', |
307 | 307 | 'default' => 'global', |
308 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
309 | - 'global' => __( 'Global Option', 'give' ), |
|
310 | - 'enabled' => __( 'Customize', 'give' ), |
|
311 | - 'disabled' => __( 'Disable', 'give' ), |
|
308 | + 'options' => apply_filters('give_forms_content_options_select', array( |
|
309 | + 'global' => __('Global Option', 'give'), |
|
310 | + 'enabled' => __('Customize', 'give'), |
|
311 | + 'disabled' => __('Disable', 'give'), |
|
312 | 312 | ) |
313 | 313 | ), |
314 | 314 | ), |
315 | 315 | array( |
316 | - 'name' => __( 'Billing Fields', 'give' ), |
|
317 | - 'desc' => __( 'This option will enable the billing details section for this form\'s offline donation payment gateway. The fieldset will appear above the offline donation instructions.', 'give' ), |
|
318 | - 'id' => $prefix . 'offline_donation_enable_billing_fields_single', |
|
316 | + 'name' => __('Billing Fields', 'give'), |
|
317 | + 'desc' => __('This option will enable the billing details section for this form\'s offline donation payment gateway. The fieldset will appear above the offline donation instructions.', 'give'), |
|
318 | + 'id' => $prefix.'offline_donation_enable_billing_fields_single', |
|
319 | 319 | 'row_classes' => 'give-subfield give-hidden', |
320 | 320 | 'type' => 'radio_inline', |
321 | 321 | 'default' => 'disabled', |
322 | 322 | 'options' => array( |
323 | - 'enabled' => __( 'Enabled', 'give' ), |
|
324 | - 'disabled' => __( 'Disabled', 'give' ), |
|
323 | + 'enabled' => __('Enabled', 'give'), |
|
324 | + 'disabled' => __('Disabled', 'give'), |
|
325 | 325 | ), |
326 | 326 | ), |
327 | 327 | array( |
328 | - 'id' => $prefix . 'offline_checkout_notes', |
|
329 | - 'name' => __( 'Donation Instructions', 'give' ), |
|
330 | - 'desc' => __( 'Enter the instructions you want to display to the donor during the donation process. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ), |
|
328 | + 'id' => $prefix.'offline_checkout_notes', |
|
329 | + 'name' => __('Donation Instructions', 'give'), |
|
330 | + 'desc' => __('Enter the instructions you want to display to the donor during the donation process. Most likely this would include important information like mailing address and who to make the check out to.', 'give'), |
|
331 | 331 | 'default' => give_get_default_offline_donation_content(), |
332 | 332 | 'type' => 'wysiwyg', |
333 | 333 | 'row_classes' => 'give-subfield give-hidden', |
@@ -336,17 +336,17 @@ discard block |
||
336 | 336 | ), |
337 | 337 | ), |
338 | 338 | array( |
339 | - 'id' => $prefix . 'offline_donation_subject', |
|
340 | - 'name' => __( 'Email Subject', 'give' ), |
|
341 | - 'desc' => __( 'Enter the subject line for the donation receipt email.', 'give' ), |
|
342 | - 'default' => __( '{form_title} - Offline Donation Instructions', 'give' ), |
|
339 | + 'id' => $prefix.'offline_donation_subject', |
|
340 | + 'name' => __('Email Subject', 'give'), |
|
341 | + 'desc' => __('Enter the subject line for the donation receipt email.', 'give'), |
|
342 | + 'default' => __('{form_title} - Offline Donation Instructions', 'give'), |
|
343 | 343 | 'row_classes' => 'give-subfield give-hidden', |
344 | 344 | 'type' => 'text', |
345 | 345 | ), |
346 | 346 | array( |
347 | - 'id' => $prefix . 'offline_donation_email', |
|
348 | - 'name' => __( 'Email Instructions', 'give' ), |
|
349 | - 'desc' => __( 'Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ) . ' ' . __( 'Available template tags:', 'give' ) . give_get_emails_tags_list(), |
|
347 | + 'id' => $prefix.'offline_donation_email', |
|
348 | + 'name' => __('Email Instructions', 'give'), |
|
349 | + 'desc' => __('Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give').' '.__('Available template tags:', 'give').give_get_emails_tags_list(), |
|
350 | 350 | 'default' => give_get_default_offline_donation_email_content(), |
351 | 351 | 'type' => 'wysiwyg', |
352 | 352 | 'row_classes' => 'give-subfield give-hidden', |
@@ -358,14 +358,14 @@ discard block |
||
358 | 358 | 'name' => 'offline_docs', |
359 | 359 | 'type' => 'docs_link', |
360 | 360 | 'url' => 'http://docs.givewp.com/settings-gateway-offline-donations', |
361 | - 'title' => __( 'Offline Donations', 'give' ), |
|
361 | + 'title' => __('Offline Donations', 'give'), |
|
362 | 362 | ), |
363 | 363 | ); |
364 | 364 | |
365 | - return array_merge( $settings, $check_settings ); |
|
365 | + return array_merge($settings, $check_settings); |
|
366 | 366 | } |
367 | 367 | |
368 | -add_filter( 'give_forms_offline_donations_metabox_fields', 'give_offline_add_settings' ); |
|
368 | +add_filter('give_forms_offline_donations_metabox_fields', 'give_offline_add_settings'); |
|
369 | 369 | |
370 | 370 | |
371 | 371 | /** |
@@ -377,32 +377,32 @@ discard block |
||
377 | 377 | */ |
378 | 378 | function give_get_default_offline_donation_content() { |
379 | 379 | |
380 | - $sitename = get_bloginfo( 'sitename' ); |
|
380 | + $sitename = get_bloginfo('sitename'); |
|
381 | 381 | |
382 | - $default_text = '<p>' . __( 'In order to make an offline donation we ask that you please follow these instructions', 'give' ) . ': </p>'; |
|
382 | + $default_text = '<p>'.__('In order to make an offline donation we ask that you please follow these instructions', 'give').': </p>'; |
|
383 | 383 | $default_text .= '<ol>'; |
384 | 384 | $default_text .= '<li>'; |
385 | 385 | $default_text .= sprintf( |
386 | 386 | /* translators: %s: site name */ |
387 | - __( 'Make a check payable to "%s"', 'give' ), |
|
387 | + __('Make a check payable to "%s"', 'give'), |
|
388 | 388 | $sitename |
389 | 389 | ); |
390 | 390 | $default_text .= '</li>'; |
391 | 391 | $default_text .= '<li>'; |
392 | 392 | $default_text .= sprintf( |
393 | 393 | /* translators: %s: site name */ |
394 | - __( 'On the memo line of the check, please indicate that the donation is for "%s"', 'give' ), |
|
394 | + __('On the memo line of the check, please indicate that the donation is for "%s"', 'give'), |
|
395 | 395 | $sitename |
396 | 396 | ); |
397 | 397 | $default_text .= '</li>'; |
398 | - $default_text .= '<li>' . __( 'Please mail your check to:', 'give' ) . '</li>'; |
|
398 | + $default_text .= '<li>'.__('Please mail your check to:', 'give').'</li>'; |
|
399 | 399 | $default_text .= '</ol>'; |
400 | - $default_text .= ' <em>' . $sitename . '</em><br>'; |
|
400 | + $default_text .= ' <em>'.$sitename.'</em><br>'; |
|
401 | 401 | $default_text .= ' <em>111 Not A Real St.</em><br>'; |
402 | 402 | $default_text .= ' <em>Anytown, CA 12345 </em><br>'; |
403 | - $default_text .= '<p>' . __( 'All contributions will be gratefully acknowledged and are tax deductible.', 'give' ) . '</p>'; |
|
403 | + $default_text .= '<p>'.__('All contributions will be gratefully acknowledged and are tax deductible.', 'give').'</p>'; |
|
404 | 404 | |
405 | - return apply_filters( 'give_default_offline_donation_content', $default_text ); |
|
405 | + return apply_filters('give_default_offline_donation_content', $default_text); |
|
406 | 406 | |
407 | 407 | } |
408 | 408 | |
@@ -415,34 +415,34 @@ discard block |
||
415 | 415 | */ |
416 | 416 | function give_get_default_offline_donation_email_content() { |
417 | 417 | |
418 | - $sitename = get_bloginfo( 'sitename' ); |
|
419 | - $default_text = '<p>' . __( 'Dear {name},', 'give' ) . '</p>'; |
|
420 | - $default_text .= '<p>' . __( 'Thank you for your offline donation request! Your generosity is greatly appreciated. In order to make an offline donation we ask that you please follow these instructions:', 'give' ) . '</p>'; |
|
418 | + $sitename = get_bloginfo('sitename'); |
|
419 | + $default_text = '<p>'.__('Dear {name},', 'give').'</p>'; |
|
420 | + $default_text .= '<p>'.__('Thank you for your offline donation request! Your generosity is greatly appreciated. In order to make an offline donation we ask that you please follow these instructions:', 'give').'</p>'; |
|
421 | 421 | $default_text .= '<ol>'; |
422 | 422 | $default_text .= '<li>'; |
423 | 423 | $default_text .= sprintf( |
424 | 424 | /* translators: %s: site name */ |
425 | - __( 'Make a check payable to "%s"', 'give' ), |
|
425 | + __('Make a check payable to "%s"', 'give'), |
|
426 | 426 | $sitename |
427 | 427 | ); |
428 | 428 | $default_text .= '</li>'; |
429 | 429 | $default_text .= '<li>'; |
430 | 430 | $default_text .= sprintf( |
431 | 431 | /* translators: %s: site name */ |
432 | - __( 'On the memo line of the check, please indicate that the donation is for "%s"', 'give' ), |
|
432 | + __('On the memo line of the check, please indicate that the donation is for "%s"', 'give'), |
|
433 | 433 | $sitename |
434 | 434 | ); |
435 | 435 | $default_text .= '</li>'; |
436 | - $default_text .= '<li>' . __( 'Please mail your check to:', 'give' ) . '</li>'; |
|
436 | + $default_text .= '<li>'.__('Please mail your check to:', 'give').'</li>'; |
|
437 | 437 | $default_text .= '</ol>'; |
438 | - $default_text .= ' <em>' . $sitename . '</em><br>'; |
|
438 | + $default_text .= ' <em>'.$sitename.'</em><br>'; |
|
439 | 439 | $default_text .= ' <em>111 Not A Real St.</em><br>'; |
440 | 440 | $default_text .= ' <em>Anytown, CA 12345 </em><br>'; |
441 | - $default_text .= '<p>' . __( 'Once your donation has been received we will mark it as complete and you will receive an email receipt for your records. Please contact us with any questions you may have!', 'give' ) . '</p>'; |
|
442 | - $default_text .= '<p>' . __( 'Sincerely,', 'give' ) . '</p>'; |
|
443 | - $default_text .= '<p>' . $sitename . '</p>'; |
|
441 | + $default_text .= '<p>'.__('Once your donation has been received we will mark it as complete and you will receive an email receipt for your records. Please contact us with any questions you may have!', 'give').'</p>'; |
|
442 | + $default_text .= '<p>'.__('Sincerely,', 'give').'</p>'; |
|
443 | + $default_text .= '<p>'.$sitename.'</p>'; |
|
444 | 444 | |
445 | - return apply_filters( 'give_default_offline_donation_content', $default_text ); |
|
445 | + return apply_filters('give_default_offline_donation_content', $default_text); |
|
446 | 446 | |
447 | 447 | } |
448 | 448 | |
@@ -456,17 +456,17 @@ discard block |
||
456 | 456 | * |
457 | 457 | * @return string |
458 | 458 | */ |
459 | -function give_offline_donation_receipt_status_notice( $notice, $id ) { |
|
460 | - $payment = new Give_Payment( $id ); |
|
459 | +function give_offline_donation_receipt_status_notice($notice, $id) { |
|
460 | + $payment = new Give_Payment($id); |
|
461 | 461 | |
462 | - if ( 'offline' !== $payment->gateway || $payment->is_completed() ) { |
|
462 | + if ('offline' !== $payment->gateway || $payment->is_completed()) { |
|
463 | 463 | return $notice; |
464 | 464 | } |
465 | 465 | |
466 | - return Give()->notices->print_frontend_notice( __( 'Payment Pending: Please follow the instructions below to complete your donation.', 'give' ), false, 'warning' ); |
|
466 | + return Give()->notices->print_frontend_notice(__('Payment Pending: Please follow the instructions below to complete your donation.', 'give'), false, 'warning'); |
|
467 | 467 | } |
468 | 468 | |
469 | -add_filter( 'give_receipt_status_notice', 'give_offline_donation_receipt_status_notice', 10, 2 ); |
|
469 | +add_filter('give_receipt_status_notice', 'give_offline_donation_receipt_status_notice', 10, 2); |
|
470 | 470 | |
471 | 471 | /** |
472 | 472 | * Get offline payment instructions. |
@@ -478,27 +478,27 @@ discard block |
||
478 | 478 | * |
479 | 479 | * @return string |
480 | 480 | */ |
481 | -function give_get_offline_payment_instruction( $form_id, $wpautop = false ) { |
|
481 | +function give_get_offline_payment_instruction($form_id, $wpautop = false) { |
|
482 | 482 | // Bailout. |
483 | - if ( ! $form_id ) { |
|
483 | + if ( ! $form_id) { |
|
484 | 484 | return ''; |
485 | 485 | } |
486 | 486 | |
487 | - $post_offline_customization_option = give_get_meta( $form_id, '_give_customize_offline_donations', true ); |
|
488 | - $post_offline_instructions = give_get_meta( $form_id, '_give_offline_checkout_notes', true ); |
|
489 | - $global_offline_instruction = give_get_option( 'global_offline_donation_content' ); |
|
487 | + $post_offline_customization_option = give_get_meta($form_id, '_give_customize_offline_donations', true); |
|
488 | + $post_offline_instructions = give_get_meta($form_id, '_give_offline_checkout_notes', true); |
|
489 | + $global_offline_instruction = give_get_option('global_offline_donation_content'); |
|
490 | 490 | $offline_instructions = $global_offline_instruction; |
491 | 491 | |
492 | - if ( give_is_setting_enabled( $post_offline_customization_option ) ) { |
|
492 | + if (give_is_setting_enabled($post_offline_customization_option)) { |
|
493 | 493 | $offline_instructions = $post_offline_instructions; |
494 | 494 | } |
495 | 495 | |
496 | - $settings_url = admin_url( 'post.php?post=' . $form_id . '&action=edit&message=1' ); |
|
496 | + $settings_url = admin_url('post.php?post='.$form_id.'&action=edit&message=1'); |
|
497 | 497 | |
498 | 498 | /* translators: %s: form settings url */ |
499 | - $offline_instructions = ! empty( $offline_instructions ) ? $offline_instructions : sprintf( __( 'Please enter offline donation instructions in <a href="%s">this form\'s settings</a>.', 'give' ), $settings_url ); |
|
499 | + $offline_instructions = ! empty($offline_instructions) ? $offline_instructions : sprintf(__('Please enter offline donation instructions in <a href="%s">this form\'s settings</a>.', 'give'), $settings_url); |
|
500 | 500 | |
501 | - return ( $wpautop ? wpautop( $offline_instructions ) : $offline_instructions ); |
|
501 | + return ($wpautop ? wpautop($offline_instructions) : $offline_instructions); |
|
502 | 502 | } |
503 | 503 | |
504 | 504 | |
@@ -512,24 +512,24 @@ discard block |
||
512 | 512 | * |
513 | 513 | * @return array |
514 | 514 | */ |
515 | -function give_filter_offline_gateway( $gateway_list, $form_id ) { |
|
515 | +function give_filter_offline_gateway($gateway_list, $form_id) { |
|
516 | 516 | if ( |
517 | 517 | // Show offline payment gateway if enable for new donation form. |
518 | - ( false === strpos( $_SERVER['REQUEST_URI'], '/wp-admin/post-new.php?post_type=give_forms' ) ) |
|
518 | + (false === strpos($_SERVER['REQUEST_URI'], '/wp-admin/post-new.php?post_type=give_forms')) |
|
519 | 519 | && $form_id |
520 | - && ! give_is_setting_enabled( give_get_meta( $form_id, '_give_customize_offline_donations', true ), array( |
|
520 | + && ! give_is_setting_enabled(give_get_meta($form_id, '_give_customize_offline_donations', true), array( |
|
521 | 521 | 'enabled', |
522 | 522 | 'global', |
523 | - ) ) |
|
523 | + )) |
|
524 | 524 | ) { |
525 | - unset( $gateway_list['offline'] ); |
|
525 | + unset($gateway_list['offline']); |
|
526 | 526 | } |
527 | 527 | |
528 | 528 | // Output. |
529 | 529 | return $gateway_list; |
530 | 530 | } |
531 | 531 | |
532 | -add_filter( 'give_enabled_payment_gateways', 'give_filter_offline_gateway', 10, 2 ); |
|
532 | +add_filter('give_enabled_payment_gateways', 'give_filter_offline_gateway', 10, 2); |
|
533 | 533 | |
534 | 534 | /** |
535 | 535 | * Set default gateway to global default payment gateway |
@@ -543,10 +543,10 @@ discard block |
||
543 | 543 | * |
544 | 544 | * @return void |
545 | 545 | */ |
546 | -function _give_customize_offline_donations_on_save_callback( $meta_key, $meta_value, $postid ) { |
|
547 | - if ( ! give_is_setting_enabled( $meta_value ) && ( 'offline' === give_get_meta( $postid, '_give_default_gateway', true ) ) ) { |
|
548 | - give_update_meta( $postid, '_give_default_gateway', 'global' ); |
|
546 | +function _give_customize_offline_donations_on_save_callback($meta_key, $meta_value, $postid) { |
|
547 | + if ( ! give_is_setting_enabled($meta_value) && ('offline' === give_get_meta($postid, '_give_default_gateway', true))) { |
|
548 | + give_update_meta($postid, '_give_default_gateway', 'global'); |
|
549 | 549 | } |
550 | 550 | } |
551 | 551 | |
552 | -add_filter( 'give_save__give_customize_offline_donations', '_give_customize_offline_donations_on_save_callback', 10, 3 ); |
|
552 | +add_filter('give_save__give_customize_offline_donations', '_give_customize_offline_donations_on_save_callback', 10, 3); |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | * @license https://opensource.org/licenses/gpl-license GNU Public License |
11 | 11 | */ |
12 | 12 | |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -22,13 +22,13 @@ discard block |
||
22 | 22 | */ |
23 | 23 | function give_process_batch_export_form() { |
24 | 24 | |
25 | - if ( ! wp_verify_nonce( $_REQUEST['nonce'], 'give-batch-export' ) ) { |
|
26 | - wp_die( esc_html__( 'Nonce verification failed.', 'give' ), esc_html__( 'Error', 'give' ), array( |
|
25 | + if ( ! wp_verify_nonce($_REQUEST['nonce'], 'give-batch-export')) { |
|
26 | + wp_die(esc_html__('Nonce verification failed.', 'give'), esc_html__('Error', 'give'), array( |
|
27 | 27 | 'response' => 403, |
28 | - ) ); |
|
28 | + )); |
|
29 | 29 | } |
30 | 30 | |
31 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-batch-export.php'; |
|
31 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-batch-export.php'; |
|
32 | 32 | |
33 | 33 | /** |
34 | 34 | * Fires before batch export. |
@@ -37,14 +37,14 @@ discard block |
||
37 | 37 | * |
38 | 38 | * @param string $class Export class. |
39 | 39 | */ |
40 | - do_action( 'give_batch_export_class_include', $_REQUEST['class'] ); |
|
40 | + do_action('give_batch_export_class_include', $_REQUEST['class']); |
|
41 | 41 | |
42 | 42 | $export = new $_REQUEST['class']; |
43 | 43 | $export->export(); |
44 | 44 | |
45 | 45 | } |
46 | 46 | |
47 | -add_action( 'give_form_batch_export', 'give_process_batch_export_form' ); |
|
47 | +add_action('give_form_batch_export', 'give_process_batch_export_form'); |
|
48 | 48 | |
49 | 49 | /** |
50 | 50 | * Exports earnings for a specified time period. |
@@ -55,14 +55,14 @@ discard block |
||
55 | 55 | * @return void |
56 | 56 | */ |
57 | 57 | function give_export_earnings() { |
58 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-export-earnings.php'; |
|
58 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-export-earnings.php'; |
|
59 | 59 | |
60 | 60 | $earnings_export = new Give_Earnings_Export(); |
61 | 61 | |
62 | 62 | $earnings_export->export(); |
63 | 63 | } |
64 | 64 | |
65 | -add_action( 'give_earnings_export', 'give_export_earnings' ); |
|
65 | +add_action('give_earnings_export', 'give_export_earnings'); |
|
66 | 66 | |
67 | 67 | |
68 | 68 | /** |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * @return void |
73 | 73 | */ |
74 | 74 | function give_register_batch_exporters() { |
75 | - if ( is_admin() ) { |
|
75 | + if (is_admin()) { |
|
76 | 76 | /** |
77 | 77 | * Fires in the admin, while plugins loaded. |
78 | 78 | * |
@@ -82,11 +82,11 @@ discard block |
||
82 | 82 | * |
83 | 83 | * @param string $class Export class. |
84 | 84 | */ |
85 | - do_action( 'give_register_batch_exporter' ); |
|
85 | + do_action('give_register_batch_exporter'); |
|
86 | 86 | } |
87 | 87 | } |
88 | 88 | |
89 | -add_action( 'plugins_loaded', 'give_register_batch_exporters' ); |
|
89 | +add_action('plugins_loaded', 'give_register_batch_exporters'); |
|
90 | 90 | |
91 | 91 | /** |
92 | 92 | * Register the payments batch exporter |
@@ -94,10 +94,10 @@ discard block |
||
94 | 94 | * @since 1.5 |
95 | 95 | */ |
96 | 96 | function give_register_payments_batch_export() { |
97 | - add_action( 'give_batch_export_class_include', 'give_include_payments_batch_processor', 10, 1 ); |
|
97 | + add_action('give_batch_export_class_include', 'give_include_payments_batch_processor', 10, 1); |
|
98 | 98 | } |
99 | 99 | |
100 | -add_action( 'give_register_batch_exporter', 'give_register_payments_batch_export', 10 ); |
|
100 | +add_action('give_register_batch_exporter', 'give_register_payments_batch_export', 10); |
|
101 | 101 | |
102 | 102 | /** |
103 | 103 | * Loads the payments batch process if needed |
@@ -108,10 +108,10 @@ discard block |
||
108 | 108 | * |
109 | 109 | * @return void |
110 | 110 | */ |
111 | -function give_include_payments_batch_processor( $class ) { |
|
111 | +function give_include_payments_batch_processor($class) { |
|
112 | 112 | |
113 | - if ( 'Give_Batch_Payments_Export' === $class ) { |
|
114 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-batch-export-payments.php'; |
|
113 | + if ('Give_Batch_Payments_Export' === $class) { |
|
114 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-batch-export-payments.php'; |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | } |
@@ -122,10 +122,10 @@ discard block |
||
122 | 122 | * @since 1.5.2 |
123 | 123 | */ |
124 | 124 | function give_register_donors_batch_export() { |
125 | - add_action( 'give_batch_export_class_include', 'give_include_donors_batch_processor', 10, 1 ); |
|
125 | + add_action('give_batch_export_class_include', 'give_include_donors_batch_processor', 10, 1); |
|
126 | 126 | } |
127 | 127 | |
128 | -add_action( 'give_register_batch_exporter', 'give_register_donors_batch_export', 10 ); |
|
128 | +add_action('give_register_batch_exporter', 'give_register_donors_batch_export', 10); |
|
129 | 129 | |
130 | 130 | /** |
131 | 131 | * Loads the donors batch process if needed. |
@@ -136,10 +136,10 @@ discard block |
||
136 | 136 | * |
137 | 137 | * @return void |
138 | 138 | */ |
139 | -function give_include_donors_batch_processor( $class ) { |
|
139 | +function give_include_donors_batch_processor($class) { |
|
140 | 140 | |
141 | - if ( 'Give_Batch_Donors_Export' === $class ) { |
|
142 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-batch-export-donors.php'; |
|
141 | + if ('Give_Batch_Donors_Export' === $class) { |
|
142 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-batch-export-donors.php'; |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | } |
@@ -150,10 +150,10 @@ discard block |
||
150 | 150 | * @since 1.5 |
151 | 151 | */ |
152 | 152 | function give_register_forms_batch_export() { |
153 | - add_action( 'give_batch_export_class_include', 'give_include_forms_batch_processor', 10, 1 ); |
|
153 | + add_action('give_batch_export_class_include', 'give_include_forms_batch_processor', 10, 1); |
|
154 | 154 | } |
155 | 155 | |
156 | -add_action( 'give_register_batch_exporter', 'give_register_forms_batch_export', 10 ); |
|
156 | +add_action('give_register_batch_exporter', 'give_register_forms_batch_export', 10); |
|
157 | 157 | |
158 | 158 | /** |
159 | 159 | * Loads the file downloads batch process if needed |
@@ -164,10 +164,10 @@ discard block |
||
164 | 164 | * |
165 | 165 | * @return void |
166 | 166 | */ |
167 | -function give_include_forms_batch_processor( $class ) { |
|
167 | +function give_include_forms_batch_processor($class) { |
|
168 | 168 | |
169 | - if ( 'Give_Batch_Forms_Export' === $class ) { |
|
170 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-batch-export-forms.php'; |
|
169 | + if ('Give_Batch_Forms_Export' === $class) { |
|
170 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-batch-export-forms.php'; |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | } |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // Exit if accessed directly. |
14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
14 | +if ( ! defined('ABSPATH')) { |
|
15 | 15 | exit; |
16 | 16 | } |
17 | 17 | |
@@ -25,14 +25,14 @@ discard block |
||
25 | 25 | */ |
26 | 26 | function give_do_ajax_export() { |
27 | 27 | |
28 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-batch-export.php'; |
|
28 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-batch-export.php'; |
|
29 | 29 | |
30 | - parse_str( $_POST['form'], $form ); |
|
30 | + parse_str($_POST['form'], $form); |
|
31 | 31 | |
32 | 32 | $_REQUEST = $form = (array) $form; |
33 | 33 | |
34 | - if ( ! wp_verify_nonce( $_REQUEST['give_ajax_export'], 'give_ajax_export' ) ) { |
|
35 | - die( '-2' ); |
|
34 | + if ( ! wp_verify_nonce($_REQUEST['give_ajax_export'], 'give_ajax_export')) { |
|
35 | + die('-2'); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | /** |
@@ -42,28 +42,28 @@ discard block |
||
42 | 42 | * |
43 | 43 | * @param string $class Export class. |
44 | 44 | */ |
45 | - do_action( 'give_batch_export_class_include', $form['give-export-class'] ); |
|
45 | + do_action('give_batch_export_class_include', $form['give-export-class']); |
|
46 | 46 | |
47 | - $step = absint( $_POST['step'] ); |
|
48 | - $class = sanitize_text_field( $form['give-export-class'] ); |
|
47 | + $step = absint($_POST['step']); |
|
48 | + $class = sanitize_text_field($form['give-export-class']); |
|
49 | 49 | |
50 | 50 | /* @var Give_Batch_Export $export */ |
51 | - $export = new $class( $step ); |
|
51 | + $export = new $class($step); |
|
52 | 52 | |
53 | - if ( ! $export->can_export() ) { |
|
54 | - die( '-1' ); |
|
53 | + if ( ! $export->can_export()) { |
|
54 | + die('-1'); |
|
55 | 55 | } |
56 | 56 | |
57 | - if ( ! $export->is_writable ) { |
|
57 | + if ( ! $export->is_writable) { |
|
58 | 58 | $json_args = array( |
59 | 59 | 'error' => true, |
60 | - 'message' => esc_html__( 'Export location or file not writable.', 'give' ) |
|
60 | + 'message' => esc_html__('Export location or file not writable.', 'give') |
|
61 | 61 | ); |
62 | 62 | echo json_encode($json_args); |
63 | 63 | exit; |
64 | 64 | } |
65 | 65 | |
66 | - $export->set_properties( give_clean( $_REQUEST ) ); |
|
66 | + $export->set_properties(give_clean($_REQUEST)); |
|
67 | 67 | |
68 | 68 | $export->pre_fetch(); |
69 | 69 | |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | |
72 | 72 | $percentage = $export->get_percentage_complete(); |
73 | 73 | |
74 | - if ( $ret ) { |
|
74 | + if ($ret) { |
|
75 | 75 | |
76 | 76 | $step += 1; |
77 | 77 | $json_data = array( |
@@ -79,18 +79,17 @@ discard block |
||
79 | 79 | 'percentage' => $percentage |
80 | 80 | ); |
81 | 81 | |
82 | - } elseif ( true === $export->is_empty ) { |
|
82 | + } elseif (true === $export->is_empty) { |
|
83 | 83 | |
84 | 84 | $json_data = array( |
85 | 85 | 'error' => true, |
86 | - 'message' => esc_html__( 'No data found for export parameters.', 'give' ) |
|
86 | + 'message' => esc_html__('No data found for export parameters.', 'give') |
|
87 | 87 | ); |
88 | 88 | |
89 | - } elseif ( true === $export->done && true === $export->is_void ) { |
|
89 | + } elseif (true === $export->done && true === $export->is_void) { |
|
90 | 90 | |
91 | - $message = ! empty( $export->message ) ? |
|
92 | - $export->message : |
|
93 | - esc_html__( 'Batch Processing Complete', 'give' ); |
|
91 | + $message = ! empty($export->message) ? |
|
92 | + $export->message : esc_html__('Batch Processing Complete', 'give'); |
|
94 | 93 | |
95 | 94 | $json_data = array( |
96 | 95 | 'success' => true, |
@@ -99,23 +98,23 @@ discard block |
||
99 | 98 | |
100 | 99 | } else { |
101 | 100 | |
102 | - $args = array_merge( $_REQUEST, array( |
|
101 | + $args = array_merge($_REQUEST, array( |
|
103 | 102 | 'step' => $step, |
104 | 103 | 'class' => $class, |
105 | - 'nonce' => wp_create_nonce( 'give-batch-export' ), |
|
104 | + 'nonce' => wp_create_nonce('give-batch-export'), |
|
106 | 105 | 'give_action' => 'form_batch_export', |
107 | - ) ); |
|
106 | + )); |
|
108 | 107 | |
109 | 108 | $json_data = array( |
110 | 109 | 'step' => 'done', |
111 | - 'url' => add_query_arg( $args, admin_url() ) |
|
110 | + 'url' => add_query_arg($args, admin_url()) |
|
112 | 111 | ); |
113 | 112 | |
114 | 113 | } |
115 | 114 | |
116 | - $export->unset_properties( give_clean( $_REQUEST ), $export ); |
|
117 | - echo json_encode( $json_data ); |
|
115 | + $export->unset_properties(give_clean($_REQUEST), $export); |
|
116 | + echo json_encode($json_data); |
|
118 | 117 | exit; |
119 | 118 | } |
120 | 119 | |
121 | -add_action( 'wp_ajax_give_do_ajax_export', 'give_do_ajax_export' ); |
|
120 | +add_action('wp_ajax_give_do_ajax_export', 'give_do_ajax_export'); |
@@ -245,7 +245,7 @@ |
||
245 | 245 | |
246 | 246 | // Continue if donor already included. |
247 | 247 | if ( empty( $payment->customer_id ) || |
248 | - in_array( $payment->customer_id, $cached_donor_ids ) |
|
248 | + in_array( $payment->customer_id, $cached_donor_ids ) |
|
249 | 249 | ) { |
250 | 250 | continue; |
251 | 251 | } |
@@ -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 | |
@@ -70,23 +70,23 @@ discard block |
||
70 | 70 | * |
71 | 71 | * @param array $request The Form Data passed into the batch processing |
72 | 72 | */ |
73 | - public function set_properties( $request ) { |
|
73 | + public function set_properties($request) { |
|
74 | 74 | |
75 | 75 | // Set data from form submission |
76 | - if ( isset( $_POST['form'] ) ) { |
|
77 | - parse_str( $_POST['form'], $this->data ); |
|
76 | + if (isset($_POST['form'])) { |
|
77 | + parse_str($_POST['form'], $this->data); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | $this->form = $this->data['forms']; |
81 | 81 | |
82 | 82 | // Setup donor ids cache. |
83 | - if ( ! empty( $this->form ) ) { |
|
83 | + if ( ! empty($this->form)) { |
|
84 | 84 | // Cache donor ids to output unique list of donor. |
85 | - $this->query_id = give_clean( $_REQUEST['give_export_option']['query_id'] ); |
|
85 | + $this->query_id = give_clean($_REQUEST['give_export_option']['query_id']); |
|
86 | 86 | $this->cache_donor_ids(); |
87 | 87 | } |
88 | 88 | |
89 | - $this->price_id = ! empty( $request['give_price_option'] ) && 'all' !== $request['give_price_option'] ? absint( $request['give_price_option'] ) : null; |
|
89 | + $this->price_id = ! empty($request['give_price_option']) && 'all' !== $request['give_price_option'] ? absint($request['give_price_option']) : null; |
|
90 | 90 | |
91 | 91 | } |
92 | 92 | |
@@ -101,12 +101,12 @@ discard block |
||
101 | 101 | // Fetch already cached donor ids. |
102 | 102 | $donor_ids = $this->donor_ids; |
103 | 103 | |
104 | - if ( $cached_donor_ids = Give_Cache::get( $this->query_id, true ) ) { |
|
105 | - $donor_ids = array_unique( array_merge( $cached_donor_ids, $this->donor_ids ) ); |
|
104 | + if ($cached_donor_ids = Give_Cache::get($this->query_id, true)) { |
|
105 | + $donor_ids = array_unique(array_merge($cached_donor_ids, $this->donor_ids)); |
|
106 | 106 | } |
107 | 107 | |
108 | - $donor_ids = array_values( $donor_ids ); |
|
109 | - Give_Cache::set( $this->query_id, $donor_ids, HOUR_IN_SECONDS, true ); |
|
108 | + $donor_ids = array_values($donor_ids); |
|
109 | + Give_Cache::set($this->query_id, $donor_ids, HOUR_IN_SECONDS, true); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | /** |
@@ -118,14 +118,14 @@ discard block |
||
118 | 118 | */ |
119 | 119 | public function csv_cols() { |
120 | 120 | |
121 | - $columns = isset( $this->data['give_export_option'] ) ? $this->data['give_export_option'] : array(); |
|
121 | + $columns = isset($this->data['give_export_option']) ? $this->data['give_export_option'] : array(); |
|
122 | 122 | |
123 | 123 | // We need columns. |
124 | - if ( empty( $columns ) ) { |
|
124 | + if (empty($columns)) { |
|
125 | 125 | return false; |
126 | 126 | } |
127 | 127 | |
128 | - $cols = $this->get_cols( $columns ); |
|
128 | + $cols = $this->get_cols($columns); |
|
129 | 129 | |
130 | 130 | return $cols; |
131 | 131 | } |
@@ -137,41 +137,41 @@ discard block |
||
137 | 137 | * |
138 | 138 | * @return array |
139 | 139 | */ |
140 | - private function get_cols( $columns ) { |
|
140 | + private function get_cols($columns) { |
|
141 | 141 | |
142 | 142 | $cols = array(); |
143 | 143 | |
144 | - foreach ( $columns as $key => $value ) { |
|
144 | + foreach ($columns as $key => $value) { |
|
145 | 145 | |
146 | - switch ( $key ) { |
|
146 | + switch ($key) { |
|
147 | 147 | case 'full_name' : |
148 | - $cols['full_name'] = esc_html__( 'Full Name', 'give' ); |
|
148 | + $cols['full_name'] = esc_html__('Full Name', 'give'); |
|
149 | 149 | break; |
150 | 150 | case 'email' : |
151 | - $cols['email'] = esc_html__( 'Email Address', 'give' ); |
|
151 | + $cols['email'] = esc_html__('Email Address', 'give'); |
|
152 | 152 | break; |
153 | 153 | case 'address' : |
154 | - $cols['address_line1'] = esc_html__( 'Address', 'give' ); |
|
155 | - $cols['address_line2'] = esc_html__( 'Address 2', 'give' ); |
|
156 | - $cols['address_city'] = esc_html__( 'City', 'give' ); |
|
157 | - $cols['address_state'] = esc_html__( 'State', 'give' ); |
|
158 | - $cols['address_zip'] = esc_html__( 'Zip', 'give' ); |
|
159 | - $cols['address_country'] = esc_html__( 'Country', 'give' ); |
|
154 | + $cols['address_line1'] = esc_html__('Address', 'give'); |
|
155 | + $cols['address_line2'] = esc_html__('Address 2', 'give'); |
|
156 | + $cols['address_city'] = esc_html__('City', 'give'); |
|
157 | + $cols['address_state'] = esc_html__('State', 'give'); |
|
158 | + $cols['address_zip'] = esc_html__('Zip', 'give'); |
|
159 | + $cols['address_country'] = esc_html__('Country', 'give'); |
|
160 | 160 | break; |
161 | 161 | case 'userid' : |
162 | - $cols['userid'] = esc_html__( 'User ID', 'give' ); |
|
162 | + $cols['userid'] = esc_html__('User ID', 'give'); |
|
163 | 163 | break; |
164 | 164 | case 'donation_form' : |
165 | - $cols['donation_form'] = esc_html__( 'Donation Form', 'give' ); |
|
165 | + $cols['donation_form'] = esc_html__('Donation Form', 'give'); |
|
166 | 166 | break; |
167 | 167 | case 'date_first_donated' : |
168 | - $cols['date_first_donated'] = esc_html__( 'First Donation Date', 'give' ); |
|
168 | + $cols['date_first_donated'] = esc_html__('First Donation Date', 'give'); |
|
169 | 169 | break; |
170 | 170 | case 'donations' : |
171 | - $cols['donations'] = esc_html__( 'Number of Donations', 'give' ); |
|
171 | + $cols['donations'] = esc_html__('Number of Donations', 'give'); |
|
172 | 172 | break; |
173 | 173 | case 'donation_sum' : |
174 | - $cols['donation_sum'] = esc_html__( 'Sum of Donations', 'give' ); |
|
174 | + $cols['donation_sum'] = esc_html__('Sum of Donations', 'give'); |
|
175 | 175 | break; |
176 | 176 | } |
177 | 177 | } |
@@ -192,29 +192,29 @@ discard block |
||
192 | 192 | $i = 0; |
193 | 193 | |
194 | 194 | $data = array(); |
195 | - $cached_donor_ids = Give_Cache::get( $this->query_id, true ); |
|
195 | + $cached_donor_ids = Give_Cache::get($this->query_id, true); |
|
196 | 196 | |
197 | - if ( ! empty( $this->form ) ) { |
|
197 | + if ( ! empty($this->form)) { |
|
198 | 198 | |
199 | 199 | // Export donors for a specific donation form and also within specified timeframe |
200 | 200 | $args = array( |
201 | 201 | 'output' => 'payments', // Use 'posts' to get standard post objects |
202 | - 'post_type' => array( 'give_payment' ), |
|
202 | + 'post_type' => array('give_payment'), |
|
203 | 203 | 'number' => 30, |
204 | 204 | 'paged' => $this->step, |
205 | 205 | 'status' => 'publish', |
206 | 206 | 'meta_key' => '_give_payment_form_id', |
207 | - 'meta_value' => absint( $this->form ), |
|
207 | + 'meta_value' => absint($this->form), |
|
208 | 208 | ); |
209 | 209 | |
210 | 210 | // Check for date option filter |
211 | - if ( ! empty( $this->data['donor_export_start_date'] ) || ! empty( $this->data['donor_export_end_date'] ) ) { |
|
212 | - $args['start_date'] = ! empty( $this->data['donor_export_start_date'] ) ? date( 'Y-n-d 00:00:00', strtotime( $this->data['donor_export_start_date'] ) ) : date( 'Y-n-d 23:59:59', '1970-1-01 00:00:00' ); |
|
213 | - $args['end_date'] = ! empty( $this->data['donor_export_end_date'] ) ? date( 'Y-n-d 23:59:59', strtotime( $this->data['donor_export_end_date'] ) ) : date( 'Y-n-d 23:59:59', current_time( 'timestamp' ) ); |
|
211 | + if ( ! empty($this->data['donor_export_start_date']) || ! empty($this->data['donor_export_end_date'])) { |
|
212 | + $args['start_date'] = ! empty($this->data['donor_export_start_date']) ? date('Y-n-d 00:00:00', strtotime($this->data['donor_export_start_date'])) : date('Y-n-d 23:59:59', '1970-1-01 00:00:00'); |
|
213 | + $args['end_date'] = ! empty($this->data['donor_export_end_date']) ? date('Y-n-d 23:59:59', strtotime($this->data['donor_export_end_date'])) : date('Y-n-d 23:59:59', current_time('timestamp')); |
|
214 | 214 | } |
215 | 215 | |
216 | 216 | // Check for price option. |
217 | - if ( null !== $this->price_id ) { |
|
217 | + if (null !== $this->price_id) { |
|
218 | 218 | $args['meta_query'] = array( |
219 | 219 | array( |
220 | 220 | 'key' => '_give_payment_price_id', |
@@ -223,45 +223,43 @@ discard block |
||
223 | 223 | ); |
224 | 224 | } |
225 | 225 | |
226 | - $payments_query = new Give_Payments_Query( $args ); |
|
226 | + $payments_query = new Give_Payments_Query($args); |
|
227 | 227 | $payments = $payments_query->get_payments(); |
228 | 228 | |
229 | - if ( $payments ) { |
|
229 | + if ($payments) { |
|
230 | 230 | /* @var Give_Payment $payment */ |
231 | - foreach ( $payments as $payment ) { |
|
231 | + foreach ($payments as $payment) { |
|
232 | 232 | // Set donation sum. |
233 | - $this->payment_stats[ $payment->customer_id ]['donation_sum'] = isset( $this->payment_stats[ $payment->customer_id ]['donation_sum'] ) ? |
|
234 | - $this->payment_stats[ $payment->customer_id ]['donation_sum'] : |
|
235 | - 0; |
|
236 | - $this->payment_stats[ $payment->customer_id ]['donation_sum'] += $payment->total; |
|
233 | + $this->payment_stats[$payment->customer_id]['donation_sum'] = isset($this->payment_stats[$payment->customer_id]['donation_sum']) ? |
|
234 | + $this->payment_stats[$payment->customer_id]['donation_sum'] : 0; |
|
235 | + $this->payment_stats[$payment->customer_id]['donation_sum'] += $payment->total; |
|
237 | 236 | |
238 | 237 | // Set donation count. |
239 | - $this->payment_stats[ $payment->customer_id ]['donations'] = isset( $this->payment_stats[ $payment->customer_id ]['donations'] ) ? |
|
240 | - ++ $this->payment_stats[ $payment->customer_id ]['donations'] : |
|
241 | - 1; |
|
238 | + $this->payment_stats[$payment->customer_id]['donations'] = isset($this->payment_stats[$payment->customer_id]['donations']) ? |
|
239 | + ++$this->payment_stats[$payment->customer_id]['donations'] : 1; |
|
242 | 240 | |
243 | 241 | // Set donation form name. |
244 | - $this->payment_stats[ $payment->customer_id ]['form_title'] = $payment->form_title; |
|
242 | + $this->payment_stats[$payment->customer_id]['form_title'] = $payment->form_title; |
|
245 | 243 | |
246 | 244 | // Continue if donor already included. |
247 | - if ( empty( $payment->customer_id ) || |
|
248 | - in_array( $payment->customer_id, $cached_donor_ids ) |
|
245 | + if (empty($payment->customer_id) || |
|
246 | + in_array($payment->customer_id, $cached_donor_ids) |
|
249 | 247 | ) { |
250 | 248 | continue; |
251 | 249 | } |
252 | 250 | |
253 | 251 | $this->donor_ids[] = $cached_donor_ids[] = $payment->customer_id; |
254 | 252 | |
255 | - $i ++; |
|
253 | + $i++; |
|
256 | 254 | } |
257 | 255 | |
258 | - if ( ! empty( $this->donor_ids ) ) { |
|
259 | - foreach ( $this->donor_ids as $donor_id ) { |
|
260 | - $donor = Give()->donors->get_donor_by( 'id', $donor_id ); |
|
261 | - $donor->donation_form_title = $this->payment_stats[ $donor_id ]['form_title']; |
|
262 | - $donor->purchase_count = $this->payment_stats[ $donor_id ]['donations']; |
|
263 | - $donor->purchase_value = $this->payment_stats[ $donor_id ]['donation_sum']; |
|
264 | - $data[] = $this->set_donor_data( $i, $data, $donor ); |
|
256 | + if ( ! empty($this->donor_ids)) { |
|
257 | + foreach ($this->donor_ids as $donor_id) { |
|
258 | + $donor = Give()->donors->get_donor_by('id', $donor_id); |
|
259 | + $donor->donation_form_title = $this->payment_stats[$donor_id]['form_title']; |
|
260 | + $donor->purchase_count = $this->payment_stats[$donor_id]['donations']; |
|
261 | + $donor->purchase_value = $this->payment_stats[$donor_id]['donation_sum']; |
|
262 | + $data[] = $this->set_donor_data($i, $data, $donor); |
|
265 | 263 | } |
266 | 264 | |
267 | 265 | // Cache donor ids only if admin export donor for specific form. |
@@ -271,7 +269,7 @@ discard block |
||
271 | 269 | } else { |
272 | 270 | |
273 | 271 | // Export all donors. |
274 | - $offset = 30 * ( $this->step - 1 ); |
|
272 | + $offset = 30 * ($this->step - 1); |
|
275 | 273 | |
276 | 274 | $args = array( |
277 | 275 | 'number' => 30, |
@@ -279,31 +277,31 @@ discard block |
||
279 | 277 | ); |
280 | 278 | |
281 | 279 | // Check for date option filter |
282 | - if ( ! empty( $this->data['donor_export_start_date'] ) || ! empty( $this->data['donor_export_end_date'] ) ) { |
|
280 | + if ( ! empty($this->data['donor_export_start_date']) || ! empty($this->data['donor_export_end_date'])) { |
|
283 | 281 | $args['date'] = array( |
284 | - 'start' => ! empty( $this->data['donor_export_start_date'] ) ? date( 'Y-n-d 00:00:00', strtotime( $this->data['donor_export_start_date'] ) ) : date( 'Y-n-d 23:59:59', '1970-1-01 00:00:00' ), |
|
285 | - 'end' => ! empty( $this->data['donor_export_end_date'] ) ? date( 'Y-n-d 23:59:59', strtotime( $this->data['donor_export_end_date'] ) ) : date( 'Y-n-d 23:59:59', current_time( 'timestamp' ) ), |
|
282 | + 'start' => ! empty($this->data['donor_export_start_date']) ? date('Y-n-d 00:00:00', strtotime($this->data['donor_export_start_date'])) : date('Y-n-d 23:59:59', '1970-1-01 00:00:00'), |
|
283 | + 'end' => ! empty($this->data['donor_export_end_date']) ? date('Y-n-d 23:59:59', strtotime($this->data['donor_export_end_date'])) : date('Y-n-d 23:59:59', current_time('timestamp')), |
|
286 | 284 | ); |
287 | 285 | } |
288 | 286 | |
289 | - $donors = Give()->donors->get_donors( $args ); |
|
287 | + $donors = Give()->donors->get_donors($args); |
|
290 | 288 | |
291 | - foreach ( $donors as $donor ) { |
|
289 | + foreach ($donors as $donor) { |
|
292 | 290 | |
293 | 291 | // Continue if donor already included. |
294 | - if ( empty( $donor->id ) || empty( $donor->payment_ids ) ) { |
|
292 | + if (empty($donor->id) || empty($donor->payment_ids)) { |
|
295 | 293 | continue; |
296 | 294 | } |
297 | 295 | |
298 | - $payment = new Give_Payment( $donor->payment_ids ); |
|
296 | + $payment = new Give_Payment($donor->payment_ids); |
|
299 | 297 | $donor->donation_form_title = $payment->form_title; |
300 | - $data[] = $this->set_donor_data( $i, $data, $donor ); |
|
301 | - $i ++; |
|
298 | + $data[] = $this->set_donor_data($i, $data, $donor); |
|
299 | + $i++; |
|
302 | 300 | } |
303 | 301 | }// End if(). |
304 | 302 | |
305 | - $data = apply_filters( 'give_export_get_data', $data ); |
|
306 | - $data = apply_filters( "give_export_get_data_{$this->export_type}", $data ); |
|
303 | + $data = apply_filters('give_export_get_data', $data); |
|
304 | + $data = apply_filters("give_export_get_data_{$this->export_type}", $data); |
|
307 | 305 | |
308 | 306 | return $data; |
309 | 307 | } |
@@ -319,18 +317,18 @@ discard block |
||
319 | 317 | $percentage = 0; |
320 | 318 | |
321 | 319 | // We can't count the number when getting them for a specific form. |
322 | - if ( empty( $this->form ) ) { |
|
320 | + if (empty($this->form)) { |
|
323 | 321 | |
324 | 322 | $total = Give()->donors->count(); |
325 | 323 | |
326 | - if ( $total > 0 ) { |
|
324 | + if ($total > 0) { |
|
327 | 325 | |
328 | - $percentage = ( ( 30 * $this->step ) / $total ) * 100; |
|
326 | + $percentage = ((30 * $this->step) / $total) * 100; |
|
329 | 327 | |
330 | 328 | } |
331 | 329 | } |
332 | 330 | |
333 | - if ( $percentage > 100 ) { |
|
331 | + if ($percentage > 100) { |
|
334 | 332 | $percentage = 100; |
335 | 333 | } |
336 | 334 | |
@@ -346,51 +344,51 @@ discard block |
||
346 | 344 | * |
347 | 345 | * @return mixed |
348 | 346 | */ |
349 | - private function set_donor_data( $i, $data, $donor ) { |
|
347 | + private function set_donor_data($i, $data, $donor) { |
|
350 | 348 | |
351 | 349 | $columns = $this->csv_cols(); |
352 | 350 | |
353 | 351 | // Set address variable |
354 | 352 | $address = ''; |
355 | - if ( isset( $donor->user_id ) && $donor->user_id > 0 ) { |
|
356 | - $address = give_get_donor_address( $donor->user_id ); |
|
353 | + if (isset($donor->user_id) && $donor->user_id > 0) { |
|
354 | + $address = give_get_donor_address($donor->user_id); |
|
357 | 355 | } |
358 | 356 | |
359 | 357 | // Set columns |
360 | - if ( ! empty( $columns['full_name'] ) ) { |
|
361 | - $data[ $i ]['full_name'] = $donor->name; |
|
358 | + if ( ! empty($columns['full_name'])) { |
|
359 | + $data[$i]['full_name'] = $donor->name; |
|
362 | 360 | } |
363 | - if ( ! empty( $columns['email'] ) ) { |
|
364 | - $data[ $i ]['email'] = $donor->email; |
|
361 | + if ( ! empty($columns['email'])) { |
|
362 | + $data[$i]['email'] = $donor->email; |
|
365 | 363 | } |
366 | - if ( ! empty( $columns['address_line1'] ) ) { |
|
367 | - |
|
368 | - $data[ $i ]['address_line1'] = isset( $address['line1'] ) ? $address['line1'] : ''; |
|
369 | - $data[ $i ]['address_line2'] = isset( $address['line2'] ) ? $address['line2'] : ''; |
|
370 | - $data[ $i ]['address_city'] = isset( $address['city'] ) ? $address['city'] : ''; |
|
371 | - $data[ $i ]['address_state'] = isset( $address['state'] ) ? $address['state'] : ''; |
|
372 | - $data[ $i ]['address_zip'] = isset( $address['zip'] ) ? $address['zip'] : ''; |
|
373 | - $data[ $i ]['address_country'] = isset( $address['country'] ) ? $address['country'] : ''; |
|
364 | + if ( ! empty($columns['address_line1'])) { |
|
365 | + |
|
366 | + $data[$i]['address_line1'] = isset($address['line1']) ? $address['line1'] : ''; |
|
367 | + $data[$i]['address_line2'] = isset($address['line2']) ? $address['line2'] : ''; |
|
368 | + $data[$i]['address_city'] = isset($address['city']) ? $address['city'] : ''; |
|
369 | + $data[$i]['address_state'] = isset($address['state']) ? $address['state'] : ''; |
|
370 | + $data[$i]['address_zip'] = isset($address['zip']) ? $address['zip'] : ''; |
|
371 | + $data[$i]['address_country'] = isset($address['country']) ? $address['country'] : ''; |
|
374 | 372 | } |
375 | - if ( ! empty( $columns['userid'] ) ) { |
|
376 | - $data[ $i ]['userid'] = ! empty( $donor->user_id ) ? $donor->user_id : ''; |
|
373 | + if ( ! empty($columns['userid'])) { |
|
374 | + $data[$i]['userid'] = ! empty($donor->user_id) ? $donor->user_id : ''; |
|
377 | 375 | } |
378 | - if ( ! empty( $columns['donation_form'] ) ) { |
|
379 | - $data[ $i ]['donation_form'] = ! empty( $donor->donation_form_title ) ? $donor->donation_form_title : ''; |
|
376 | + if ( ! empty($columns['donation_form'])) { |
|
377 | + $data[$i]['donation_form'] = ! empty($donor->donation_form_title) ? $donor->donation_form_title : ''; |
|
380 | 378 | } |
381 | - if ( ! empty( $columns['date_first_donated'] ) ) { |
|
382 | - $data[ $i ]['date_first_donated'] = date_i18n( give_date_format(), strtotime( $donor->date_created ) ); |
|
379 | + if ( ! empty($columns['date_first_donated'])) { |
|
380 | + $data[$i]['date_first_donated'] = date_i18n(give_date_format(), strtotime($donor->date_created)); |
|
383 | 381 | } |
384 | - if ( ! empty( $columns['donations'] ) ) { |
|
385 | - $data[ $i ]['donations'] = $donor->purchase_count; |
|
382 | + if ( ! empty($columns['donations'])) { |
|
383 | + $data[$i]['donations'] = $donor->purchase_count; |
|
386 | 384 | } |
387 | - if ( ! empty( $columns['donation_sum'] ) ) { |
|
388 | - $data[ $i ]['donation_sum'] = give_format_amount( $donor->purchase_value, array( 'sanitize' => false ) ); |
|
385 | + if ( ! empty($columns['donation_sum'])) { |
|
386 | + $data[$i]['donation_sum'] = give_format_amount($donor->purchase_value, array('sanitize' => false)); |
|
389 | 387 | } |
390 | 388 | |
391 | - $data[ $i ] = apply_filters( 'give_export_set_donor_data', $data[ $i ], $donor ); |
|
389 | + $data[$i] = apply_filters('give_export_set_donor_data', $data[$i], $donor); |
|
392 | 390 | |
393 | - return $data[ $i ]; |
|
391 | + return $data[$i]; |
|
394 | 392 | |
395 | 393 | } |
396 | 394 | |
@@ -400,9 +398,9 @@ discard block |
||
400 | 398 | * @param array $request |
401 | 399 | * @param Give_Batch_Export $export |
402 | 400 | */ |
403 | - public function unset_properties( $request, $export ) { |
|
404 | - if ( $export->done ) { |
|
405 | - Give_Cache::delete( "give_cache_{$this->query_id}" ); |
|
401 | + public function unset_properties($request, $export) { |
|
402 | + if ($export->done) { |
|
403 | + Give_Cache::delete("give_cache_{$this->query_id}"); |
|
406 | 404 | } |
407 | 405 | } |
408 | 406 | } |
409 | 407 | \ No newline at end of file |
@@ -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 | |
@@ -118,14 +118,14 @@ discard block |
||
118 | 118 | * |
119 | 119 | * @param int $_step |
120 | 120 | */ |
121 | - public function __construct( $_step = 1 ) { |
|
121 | + public function __construct($_step = 1) { |
|
122 | 122 | |
123 | 123 | $upload_dir = wp_upload_dir(); |
124 | 124 | $this->filetype = '.csv'; |
125 | - $this->filename = 'give-' . $this->export_type . $this->filetype; |
|
126 | - $this->file = trailingslashit( $upload_dir['basedir'] ) . $this->filename; |
|
125 | + $this->filename = 'give-'.$this->export_type.$this->filetype; |
|
126 | + $this->file = trailingslashit($upload_dir['basedir']).$this->filename; |
|
127 | 127 | |
128 | - if ( ! is_writeable( $upload_dir['basedir'] ) ) { |
|
128 | + if ( ! is_writeable($upload_dir['basedir'])) { |
|
129 | 129 | $this->is_writable = false; |
130 | 130 | } |
131 | 131 | |
@@ -141,22 +141,22 @@ discard block |
||
141 | 141 | */ |
142 | 142 | public function process_step() { |
143 | 143 | |
144 | - if ( ! $this->can_export() ) { |
|
145 | - wp_die( esc_html__( 'You do not have permission to export data.', 'give' ), esc_html__( 'Error', 'give' ), array( |
|
144 | + if ( ! $this->can_export()) { |
|
145 | + wp_die(esc_html__('You do not have permission to export data.', 'give'), esc_html__('Error', 'give'), array( |
|
146 | 146 | 'response' => 403, |
147 | - ) ); |
|
147 | + )); |
|
148 | 148 | } |
149 | 149 | |
150 | - if ( $this->step < 2 ) { |
|
150 | + if ($this->step < 2) { |
|
151 | 151 | |
152 | 152 | // Make sure we start with a fresh file on step 1. |
153 | - @unlink( $this->file ); |
|
153 | + @unlink($this->file); |
|
154 | 154 | $this->print_csv_cols(); |
155 | 155 | } |
156 | 156 | |
157 | 157 | $rows = $this->print_csv_rows(); |
158 | 158 | |
159 | - if ( $rows ) { |
|
159 | + if ($rows) { |
|
160 | 160 | return true; |
161 | 161 | } else { |
162 | 162 | return false; |
@@ -176,14 +176,14 @@ discard block |
||
176 | 176 | $col_data = ''; |
177 | 177 | $cols = $this->get_csv_cols(); |
178 | 178 | $i = 1; |
179 | - foreach ( $cols as $col_id => $column ) { |
|
180 | - $col_data .= '"' . addslashes( $column ) . '"'; |
|
181 | - $col_data .= $i == count( $cols ) ? '' : ','; |
|
182 | - $i ++; |
|
179 | + foreach ($cols as $col_id => $column) { |
|
180 | + $col_data .= '"'.addslashes($column).'"'; |
|
181 | + $col_data .= $i == count($cols) ? '' : ','; |
|
182 | + $i++; |
|
183 | 183 | } |
184 | 184 | $col_data .= "\r\n"; |
185 | 185 | |
186 | - $this->stash_step_data( $col_data ); |
|
186 | + $this->stash_step_data($col_data); |
|
187 | 187 | |
188 | 188 | return $col_data; |
189 | 189 | |
@@ -202,23 +202,23 @@ discard block |
||
202 | 202 | $data = $this->get_data(); |
203 | 203 | $cols = $this->get_csv_cols(); |
204 | 204 | |
205 | - if ( $data ) { |
|
205 | + if ($data) { |
|
206 | 206 | |
207 | 207 | // Output each row |
208 | - foreach ( $data as $row ) { |
|
208 | + foreach ($data as $row) { |
|
209 | 209 | $i = 1; |
210 | - foreach ( $row as $col_id => $column ) { |
|
210 | + foreach ($row as $col_id => $column) { |
|
211 | 211 | // Make sure the column is valid |
212 | - if ( array_key_exists( $col_id, $cols ) ) { |
|
213 | - $row_data .= '"' . addslashes( preg_replace( '/"/', "'", $column ) ) . '"'; |
|
214 | - $row_data .= $i == count( $cols ) ? '' : ','; |
|
215 | - $i ++; |
|
212 | + if (array_key_exists($col_id, $cols)) { |
|
213 | + $row_data .= '"'.addslashes(preg_replace('/"/', "'", $column)).'"'; |
|
214 | + $row_data .= $i == count($cols) ? '' : ','; |
|
215 | + $i++; |
|
216 | 216 | } |
217 | 217 | } |
218 | 218 | $row_data .= "\r\n"; |
219 | 219 | } |
220 | 220 | |
221 | - $this->stash_step_data( $row_data ); |
|
221 | + $this->stash_step_data($row_data); |
|
222 | 222 | |
223 | 223 | return $row_data; |
224 | 224 | } |
@@ -246,18 +246,18 @@ discard block |
||
246 | 246 | |
247 | 247 | $file = ''; |
248 | 248 | |
249 | - if ( @file_exists( $this->file ) ) { |
|
249 | + if (@file_exists($this->file)) { |
|
250 | 250 | |
251 | - if ( ! is_writeable( $this->file ) ) { |
|
251 | + if ( ! is_writeable($this->file)) { |
|
252 | 252 | $this->is_writable = false; |
253 | 253 | } |
254 | 254 | |
255 | - $file = @file_get_contents( $this->file ); |
|
255 | + $file = @file_get_contents($this->file); |
|
256 | 256 | |
257 | 257 | } else { |
258 | 258 | |
259 | - @file_put_contents( $this->file, '' ); |
|
260 | - @chmod( $this->file, 0664 ); |
|
259 | + @file_put_contents($this->file, ''); |
|
260 | + @chmod($this->file, 0664); |
|
261 | 261 | |
262 | 262 | } |
263 | 263 | |
@@ -273,18 +273,18 @@ discard block |
||
273 | 273 | * |
274 | 274 | * @return void |
275 | 275 | */ |
276 | - protected function stash_step_data( $data = '' ) { |
|
276 | + protected function stash_step_data($data = '') { |
|
277 | 277 | |
278 | 278 | $file = $this->get_file(); |
279 | 279 | $file .= $data; |
280 | - @file_put_contents( $this->file, $file ); |
|
280 | + @file_put_contents($this->file, $file); |
|
281 | 281 | |
282 | 282 | // If we have no rows after this step, mark it as an empty export. |
283 | - $file_rows = file( $this->file, FILE_SKIP_EMPTY_LINES ); |
|
283 | + $file_rows = file($this->file, FILE_SKIP_EMPTY_LINES); |
|
284 | 284 | $default_cols = $this->get_csv_cols(); |
285 | - $default_cols = empty( $default_cols ) ? 0 : 1; |
|
285 | + $default_cols = empty($default_cols) ? 0 : 1; |
|
286 | 286 | |
287 | - $this->is_empty = count( $file_rows ) == $default_cols ? true : false; |
|
287 | + $this->is_empty = count($file_rows) == $default_cols ? true : false; |
|
288 | 288 | |
289 | 289 | } |
290 | 290 | |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | |
303 | 303 | $file = $this->get_file(); |
304 | 304 | |
305 | - @unlink( $this->file ); |
|
305 | + @unlink($this->file); |
|
306 | 306 | |
307 | 307 | echo $file; |
308 | 308 | |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | * |
312 | 312 | * @since 1.8 |
313 | 313 | */ |
314 | - do_action( 'give_file_export_complete', $_REQUEST ); |
|
314 | + do_action('give_file_export_complete', $_REQUEST); |
|
315 | 315 | |
316 | 316 | give_die(); |
317 | 317 | } |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | * |
324 | 324 | * @param array $request The Form Data passed into the batch processing. |
325 | 325 | */ |
326 | - public function set_properties( $request ) { |
|
326 | + public function set_properties($request) { |
|
327 | 327 | } |
328 | 328 | |
329 | 329 | /** |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | * @param array $request The Form Data passed into the batch processing. |
335 | 335 | * @param Give_Batch_Export $export |
336 | 336 | */ |
337 | - public function unset_properties( $request, $export ) { |
|
337 | + public function unset_properties($request, $export) { |
|
338 | 338 | } |
339 | 339 | |
340 | 340 | /** |
@@ -514,16 +514,16 @@ |
||
514 | 514 | <p> |
515 | 515 | <strong><?php esc_html_e( 'Donor Name:', 'give' ); ?></strong><br> |
516 | 516 | <?php |
517 | - $donor_billing_name = give_get_donor_name_by( $payment_id, 'donation' ); |
|
518 | - $donor_name = give_get_donor_name_by( $donor_id, 'donor' ); |
|
519 | - |
|
520 | - // Check whether the donor name and WP_User name is same or not. |
|
521 | - if( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ){ |
|
522 | - echo $donor_billing_name . ' (<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id" ) ) . '">' . $donor_name . '</a>)'; |
|
523 | - }else{ |
|
524 | - echo $donor_name; |
|
525 | - } |
|
526 | - ?> |
|
517 | + $donor_billing_name = give_get_donor_name_by( $payment_id, 'donation' ); |
|
518 | + $donor_name = give_get_donor_name_by( $donor_id, 'donor' ); |
|
519 | + |
|
520 | + // Check whether the donor name and WP_User name is same or not. |
|
521 | + if( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ){ |
|
522 | + echo $donor_billing_name . ' (<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id" ) ) . '">' . $donor_name . '</a>)'; |
|
523 | + }else{ |
|
524 | + echo $donor_name; |
|
525 | + } |
|
526 | + ?> |
|
527 | 527 | </p> |
528 | 528 | <p> |
529 | 529 | <strong><?php esc_html_e( 'Donor Email:', 'give' ); ?></strong><br> |
@@ -520,7 +520,7 @@ |
||
520 | 520 | // Check whether the donor name and WP_User name is same or not. |
521 | 521 | if( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ){ |
522 | 522 | echo $donor_billing_name . ' (<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id" ) ) . '">' . $donor_name . '</a>)'; |
523 | - }else{ |
|
523 | + } else{ |
|
524 | 524 | echo $donor_name; |
525 | 525 | } |
526 | 526 | ?> |
@@ -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 | |
@@ -20,27 +20,27 @@ discard block |
||
20 | 20 | * @since 1.0 |
21 | 21 | * @return void |
22 | 22 | */ |
23 | -if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) { |
|
24 | - wp_die( esc_html__( 'Donation ID not supplied. Please try again.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
23 | +if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) { |
|
24 | + wp_die(esc_html__('Donation ID not supplied. Please try again.', 'give'), esc_html__('Error', 'give'), array('response' => 400)); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | // Setup the variables |
28 | -$payment_id = absint( $_GET['id'] ); |
|
29 | -$payment = new Give_Payment( $payment_id ); |
|
28 | +$payment_id = absint($_GET['id']); |
|
29 | +$payment = new Give_Payment($payment_id); |
|
30 | 30 | |
31 | 31 | // Sanity check... fail if donation ID is invalid |
32 | 32 | $payment_exists = $payment->ID; |
33 | -if ( empty( $payment_exists ) ) { |
|
34 | - wp_die( esc_html__( 'The specified ID does not belong to a donation. Please try again.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
33 | +if (empty($payment_exists)) { |
|
34 | + wp_die(esc_html__('The specified ID does not belong to a donation. Please try again.', 'give'), esc_html__('Error', 'give'), array('response' => 400)); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | $number = $payment->number; |
38 | 38 | $payment_meta = $payment->get_meta(); |
39 | -$transaction_id = esc_attr( $payment->transaction_id ); |
|
39 | +$transaction_id = esc_attr($payment->transaction_id); |
|
40 | 40 | $user_id = $payment->user_id; |
41 | 41 | $donor_id = $payment->customer_id; |
42 | -$payment_date = strtotime( $payment->date ); |
|
43 | -$user_info = give_get_payment_meta_user_info( $payment_id ); |
|
42 | +$payment_date = strtotime($payment->date); |
|
43 | +$user_info = give_get_payment_meta_user_info($payment_id); |
|
44 | 44 | $address = $payment->address; |
45 | 45 | $currency_code = $payment->currency; |
46 | 46 | $gateway = $payment->gateway; |
@@ -52,11 +52,11 @@ discard block |
||
52 | 52 | <h1 id="transaction-details-heading" class="wp-heading-inline"><?php |
53 | 53 | printf( |
54 | 54 | /* translators: %s: donation number */ |
55 | - esc_html__( 'Donation %s', 'give' ), |
|
55 | + esc_html__('Donation %s', 'give'), |
|
56 | 56 | $number |
57 | 57 | ); |
58 | - if ( $payment_mode == 'test' ) { |
|
59 | - echo '<span id="test-payment-label" class="give-item-label give-item-label-orange" data-tooltip="' . esc_attr__( 'This donation was made in test mode.', 'give' ) . '" data-tooltip-my-position="center left" data-tooltip-target-position="center right">' . esc_html__( 'Test Donation', 'give' ) . '</span>'; |
|
58 | + if ($payment_mode == 'test') { |
|
59 | + echo '<span id="test-payment-label" class="give-item-label give-item-label-orange" data-tooltip="'.esc_attr__('This donation was made in test mode.', 'give').'" data-tooltip-my-position="center left" data-tooltip-target-position="center right">'.esc_html__('Test Donation', 'give').'</span>'; |
|
60 | 60 | } |
61 | 61 | ?></h1> |
62 | 62 | |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * |
69 | 69 | * @param int $payment_id Payment id. |
70 | 70 | */ |
71 | - do_action( 'give_view_order_details_before', $payment_id ); |
|
71 | + do_action('give_view_order_details_before', $payment_id); |
|
72 | 72 | ?> |
73 | 73 | |
74 | 74 | <hr class="wp-header-end"> |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | * |
83 | 83 | * @param int $payment_id Payment id. |
84 | 84 | */ |
85 | - do_action( 'give_view_order_details_form_top', $payment_id ); |
|
85 | + do_action('give_view_order_details_form_top', $payment_id); |
|
86 | 86 | ?> |
87 | 87 | <div id="poststuff"> |
88 | 88 | <div id="give-dashboard-widgets-wrap"> |
@@ -98,12 +98,12 @@ discard block |
||
98 | 98 | * |
99 | 99 | * @param int $payment_id Payment id. |
100 | 100 | */ |
101 | - do_action( 'give_view_order_details_sidebar_before', $payment_id ); |
|
101 | + do_action('give_view_order_details_sidebar_before', $payment_id); |
|
102 | 102 | ?> |
103 | 103 | |
104 | 104 | <div id="give-order-update" class="postbox give-order-data"> |
105 | 105 | |
106 | - <h3 class="hndle"><?php esc_html_e( 'Update Donation', 'give' ); ?></h3> |
|
106 | + <h3 class="hndle"><?php esc_html_e('Update Donation', 'give'); ?></h3> |
|
107 | 107 | |
108 | 108 | <div class="inside"> |
109 | 109 | <div class="give-admin-box"> |
@@ -116,33 +116,33 @@ discard block |
||
116 | 116 | * |
117 | 117 | * @param int $payment_id Payment id. |
118 | 118 | */ |
119 | - do_action( 'give_view_order_details_totals_before', $payment_id ); |
|
119 | + do_action('give_view_order_details_totals_before', $payment_id); |
|
120 | 120 | ?> |
121 | 121 | |
122 | 122 | <div class="give-admin-box-inside"> |
123 | 123 | <p> |
124 | - <label for="give-payment-status" class="strong"><?php esc_html_e( 'Status:', 'give' ); ?></label> |
|
124 | + <label for="give-payment-status" class="strong"><?php esc_html_e('Status:', 'give'); ?></label> |
|
125 | 125 | <select id="give-payment-status" name="give-payment-status" class="medium-text"> |
126 | - <?php foreach ( give_get_payment_statuses() as $key => $status ) : ?> |
|
127 | - <option value="<?php echo esc_attr( $key ); ?>"<?php selected( $payment->status, $key, true ); ?>><?php echo esc_html( $status ); ?></option> |
|
126 | + <?php foreach (give_get_payment_statuses() as $key => $status) : ?> |
|
127 | + <option value="<?php echo esc_attr($key); ?>"<?php selected($payment->status, $key, true); ?>><?php echo esc_html($status); ?></option> |
|
128 | 128 | <?php endforeach; ?> |
129 | 129 | </select> |
130 | - <span class="give-donation-status status-<?php echo sanitize_title( $payment->status ); ?>"><span class="give-donation-status-icon"></span></span> |
|
130 | + <span class="give-donation-status status-<?php echo sanitize_title($payment->status); ?>"><span class="give-donation-status-icon"></span></span> |
|
131 | 131 | </p> |
132 | 132 | </div> |
133 | 133 | |
134 | 134 | <div class="give-admin-box-inside"> |
135 | 135 | <p> |
136 | - <label for="give-payment-date" class="strong"><?php esc_html_e( 'Date:', 'give' ); ?></label> |
|
137 | - <input type="text" id="give-payment-date" name="give-payment-date" value="<?php echo esc_attr( date( 'm/d/Y', $payment_date ) ); ?>" class="medium-text give_datepicker"/> |
|
136 | + <label for="give-payment-date" class="strong"><?php esc_html_e('Date:', 'give'); ?></label> |
|
137 | + <input type="text" id="give-payment-date" name="give-payment-date" value="<?php echo esc_attr(date('m/d/Y', $payment_date)); ?>" class="medium-text give_datepicker"/> |
|
138 | 138 | </p> |
139 | 139 | </div> |
140 | 140 | |
141 | 141 | <div class="give-admin-box-inside"> |
142 | 142 | <p> |
143 | - <label for="give-payment-time-hour" class="strong"><?php esc_html_e( 'Time:', 'give' ); ?></label> |
|
144 | - <input type="number" step="1" max="24" id="give-payment-time-hour" name="give-payment-time-hour" value="<?php echo esc_attr( date_i18n( 'H', $payment_date ) ); ?>" class="small-text give-payment-time-hour"/> : |
|
145 | - <input type="number" step="1" max="59" id="give-payment-time-min" name="give-payment-time-min" value="<?php echo esc_attr( date( 'i', $payment_date ) ); ?>" class="small-text give-payment-time-min"/> |
|
143 | + <label for="give-payment-time-hour" class="strong"><?php esc_html_e('Time:', 'give'); ?></label> |
|
144 | + <input type="number" step="1" max="24" id="give-payment-time-hour" name="give-payment-time-hour" value="<?php echo esc_attr(date_i18n('H', $payment_date)); ?>" class="small-text give-payment-time-hour"/> : |
|
145 | + <input type="number" step="1" max="59" id="give-payment-time-min" name="give-payment-time-min" value="<?php echo esc_attr(date('i', $payment_date)); ?>" class="small-text give-payment-time-min"/> |
|
146 | 146 | </p> |
147 | 147 | </div> |
148 | 148 | |
@@ -156,13 +156,13 @@ discard block |
||
156 | 156 | * |
157 | 157 | * @param int $payment_id Payment id. |
158 | 158 | */ |
159 | - do_action( 'give_view_order_details_update_inner', $payment_id ); ?> |
|
159 | + do_action('give_view_order_details_update_inner', $payment_id); ?> |
|
160 | 160 | |
161 | 161 | <div class="give-order-payment give-admin-box-inside"> |
162 | 162 | <p> |
163 | - <label for="give-payment-total" class="strong"><?php esc_html_e( 'Total Donation:', 'give' ); ?></label> |
|
164 | - <?php echo give_currency_symbol( $payment->currency ); ?> |
|
165 | - <input id="give-payment-total" name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr( give_format_decimal( give_get_payment_amount( $payment_id ), false, false ) ); ?>"/> |
|
163 | + <label for="give-payment-total" class="strong"><?php esc_html_e('Total Donation:', 'give'); ?></label> |
|
164 | + <?php echo give_currency_symbol($payment->currency); ?> |
|
165 | + <input id="give-payment-total" name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr(give_format_decimal(give_get_payment_amount($payment_id), false, false)); ?>"/> |
|
166 | 166 | </p> |
167 | 167 | </div> |
168 | 168 | |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | * |
175 | 175 | * @param int $payment_id Payment id. |
176 | 176 | */ |
177 | - do_action( 'give_view_order_details_totals_after', $payment_id ); |
|
177 | + do_action('give_view_order_details_totals_after', $payment_id); |
|
178 | 178 | ?> |
179 | 179 | |
180 | 180 | </div> |
@@ -192,17 +192,17 @@ discard block |
||
192 | 192 | * |
193 | 193 | * @param int $payment_id Payment id. |
194 | 194 | */ |
195 | - do_action( 'give_view_order_details_update_before', $payment_id ); |
|
195 | + do_action('give_view_order_details_update_before', $payment_id); |
|
196 | 196 | ?> |
197 | 197 | |
198 | 198 | <div id="major-publishing-actions"> |
199 | 199 | <div id="publishing-action"> |
200 | - <input type="submit" class="button button-primary right" value="<?php esc_attr_e( 'Save Donation', 'give' ); ?>"/> |
|
201 | - <?php if ( give_is_payment_complete( $payment_id ) ) : ?> |
|
202 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
200 | + <input type="submit" class="button button-primary right" value="<?php esc_attr_e('Save Donation', 'give'); ?>"/> |
|
201 | + <?php if (give_is_payment_complete($payment_id)) : ?> |
|
202 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
203 | 203 | 'give-action' => 'email_links', |
204 | 204 | 'purchase_id' => $payment_id, |
205 | - ) ) ); ?>" id="give-resend-receipt" class="button-secondary right"><?php esc_html_e( 'Resend Receipt', 'give' ); ?></a> |
|
205 | + ))); ?>" id="give-resend-receipt" class="button-secondary right"><?php esc_html_e('Resend Receipt', 'give'); ?></a> |
|
206 | 206 | <?php endif; ?> |
207 | 207 | </div> |
208 | 208 | <div class="clear"></div> |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | * |
217 | 217 | * @param int $payment_id Payment id. |
218 | 218 | */ |
219 | - do_action( 'give_view_order_details_update_after', $payment_id ); |
|
219 | + do_action('give_view_order_details_update_after', $payment_id); |
|
220 | 220 | ?> |
221 | 221 | |
222 | 222 | </div> |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | |
228 | 228 | <div id="give-order-details" class="postbox give-order-data"> |
229 | 229 | |
230 | - <h3 class="hndle"><?php esc_html_e( 'Donation Meta', 'give' ); ?></h3> |
|
230 | + <h3 class="hndle"><?php esc_html_e('Donation Meta', 'give'); ?></h3> |
|
231 | 231 | |
232 | 232 | <div class="inside"> |
233 | 233 | <div class="give-admin-box"> |
@@ -240,44 +240,44 @@ discard block |
||
240 | 240 | * |
241 | 241 | * @param int $payment_id Payment id. |
242 | 242 | */ |
243 | - do_action( 'give_view_order_details_payment_meta_before', $payment_id ); |
|
243 | + do_action('give_view_order_details_payment_meta_before', $payment_id); |
|
244 | 244 | |
245 | - $gateway = give_get_payment_gateway( $payment_id ); |
|
246 | - if ( $gateway ) : ?> |
|
245 | + $gateway = give_get_payment_gateway($payment_id); |
|
246 | + if ($gateway) : ?> |
|
247 | 247 | <div class="give-order-gateway give-admin-box-inside"> |
248 | 248 | <p> |
249 | - <strong><?php esc_html_e( 'Gateway:', 'give' ); ?></strong> |
|
250 | - <?php echo give_get_gateway_admin_label( $gateway ); ?> |
|
249 | + <strong><?php esc_html_e('Gateway:', 'give'); ?></strong> |
|
250 | + <?php echo give_get_gateway_admin_label($gateway); ?> |
|
251 | 251 | </p> |
252 | 252 | </div> |
253 | 253 | <?php endif; ?> |
254 | 254 | |
255 | 255 | <div class="give-order-payment-key give-admin-box-inside"> |
256 | 256 | <p> |
257 | - <strong><?php esc_html_e( 'Key:', 'give' ); ?></strong> |
|
258 | - <?php echo give_get_payment_key( $payment_id ); ?> |
|
257 | + <strong><?php esc_html_e('Key:', 'give'); ?></strong> |
|
258 | + <?php echo give_get_payment_key($payment_id); ?> |
|
259 | 259 | </p> |
260 | 260 | </div> |
261 | 261 | |
262 | 262 | <div class="give-order-ip give-admin-box-inside"> |
263 | 263 | <p> |
264 | - <strong><?php esc_html_e( 'IP:', 'give' ); ?></strong> |
|
265 | - <?php echo esc_html( give_get_payment_user_ip( $payment_id ) ); ?> |
|
264 | + <strong><?php esc_html_e('IP:', 'give'); ?></strong> |
|
265 | + <?php echo esc_html(give_get_payment_user_ip($payment_id)); ?> |
|
266 | 266 | </p> |
267 | 267 | </div> |
268 | 268 | |
269 | - <?php if ( $transaction_id ) : ?> |
|
269 | + <?php if ($transaction_id) : ?> |
|
270 | 270 | <div class="give-order-tx-id give-admin-box-inside"> |
271 | 271 | <p> |
272 | - <strong><?php esc_html_e( 'Donation ID:', 'give' ); ?></strong> |
|
273 | - <?php echo apply_filters( "give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id ); ?> |
|
272 | + <strong><?php esc_html_e('Donation ID:', 'give'); ?></strong> |
|
273 | + <?php echo apply_filters("give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id); ?> |
|
274 | 274 | </p> |
275 | 275 | </div> |
276 | 276 | <?php endif; ?> |
277 | 277 | |
278 | 278 | <div class="give-admin-box-inside"> |
279 | - <p><?php $purchase_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&donor=' . absint( give_get_payment_donor_id( $payment_id ) ) ); ?> |
|
280 | - <a href="<?php echo $purchase_url; ?>"><?php esc_html_e( 'View all donations for this donor »', 'give' ); ?></a> |
|
279 | + <p><?php $purchase_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&donor='.absint(give_get_payment_donor_id($payment_id))); ?> |
|
280 | + <a href="<?php echo $purchase_url; ?>"><?php esc_html_e('View all donations for this donor »', 'give'); ?></a> |
|
281 | 281 | </p> |
282 | 282 | </div> |
283 | 283 | |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | * |
290 | 290 | * @param int $payment_id Payment id. |
291 | 291 | */ |
292 | - do_action( 'give_view_order_details_payment_meta_after', $payment_id ); |
|
292 | + do_action('give_view_order_details_payment_meta_after', $payment_id); |
|
293 | 293 | ?> |
294 | 294 | |
295 | 295 | </div> |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | * |
310 | 310 | * @param int $payment_id Payment id. |
311 | 311 | */ |
312 | - do_action( 'give_view_order_details_sidebar_after', $payment_id ); |
|
312 | + do_action('give_view_order_details_sidebar_after', $payment_id); |
|
313 | 313 | ?> |
314 | 314 | |
315 | 315 | </div> |
@@ -329,56 +329,56 @@ discard block |
||
329 | 329 | * |
330 | 330 | * @param int $payment_id Payment id. |
331 | 331 | */ |
332 | - do_action( 'give_view_order_details_main_before', $payment_id ); |
|
332 | + do_action('give_view_order_details_main_before', $payment_id); |
|
333 | 333 | ?> |
334 | 334 | |
335 | 335 | <?php $column_count = 'columns-3'; ?> |
336 | 336 | <div id="give-donation-overview" class="postbox <?php echo $column_count; ?>"> |
337 | - <h3 class="hndle"><?php esc_html_e( 'Donation Information', 'give' ); ?></h3> |
|
337 | + <h3 class="hndle"><?php esc_html_e('Donation Information', 'give'); ?></h3> |
|
338 | 338 | |
339 | 339 | <div class="inside"> |
340 | 340 | |
341 | 341 | <div class="column-container"> |
342 | 342 | <div class="column"> |
343 | 343 | <p> |
344 | - <strong><?php esc_html_e( 'Donation Form ID:', 'give' ); ?></strong><br> |
|
344 | + <strong><?php esc_html_e('Donation Form ID:', 'give'); ?></strong><br> |
|
345 | 345 | <?php |
346 | - if ( $payment_meta['form_id'] ) : |
|
346 | + if ($payment_meta['form_id']) : |
|
347 | 347 | printf( |
348 | 348 | '<a href="%1$s">#%2$s</a>', |
349 | - admin_url( 'post.php?action=edit&post=' . $payment_meta['form_id'] ), |
|
349 | + admin_url('post.php?action=edit&post='.$payment_meta['form_id']), |
|
350 | 350 | $payment_meta['form_id'] |
351 | 351 | ); |
352 | 352 | endif; |
353 | 353 | ?> |
354 | 354 | </p> |
355 | 355 | <p> |
356 | - <strong><?php esc_html_e( 'Donation Form Title:', 'give' ); ?></strong><br> |
|
357 | - <?php echo Give()->html->forms_dropdown( array( |
|
356 | + <strong><?php esc_html_e('Donation Form Title:', 'give'); ?></strong><br> |
|
357 | + <?php echo Give()->html->forms_dropdown(array( |
|
358 | 358 | 'selected' => $payment_meta['form_id'], |
359 | 359 | 'name' => 'give-payment-form-select', |
360 | 360 | 'id' => 'give-payment-form-select', |
361 | 361 | 'chosen' => true, |
362 | - ) ); ?> |
|
362 | + )); ?> |
|
363 | 363 | </p> |
364 | 364 | </div> |
365 | 365 | <div class="column"> |
366 | 366 | <p> |
367 | - <strong><?php esc_html_e( 'Donation Date:', 'give' ); ?></strong><br> |
|
368 | - <?php echo date_i18n( give_date_format(), $payment_date ); ?> |
|
367 | + <strong><?php esc_html_e('Donation Date:', 'give'); ?></strong><br> |
|
368 | + <?php echo date_i18n(give_date_format(), $payment_date); ?> |
|
369 | 369 | </p> |
370 | 370 | <p> |
371 | - <strong><?php esc_html_e( 'Donation Level:', 'give' ); ?></strong><br> |
|
371 | + <strong><?php esc_html_e('Donation Level:', 'give'); ?></strong><br> |
|
372 | 372 | <span class="give-donation-level"> |
373 | 373 | <?php |
374 | - $var_prices = give_has_variable_prices( $payment_meta['form_id'] ); |
|
375 | - if ( empty( $var_prices ) ) { |
|
376 | - esc_html_e( 'n/a', 'give' ); |
|
374 | + $var_prices = give_has_variable_prices($payment_meta['form_id']); |
|
375 | + if (empty($var_prices)) { |
|
376 | + esc_html_e('n/a', 'give'); |
|
377 | 377 | } else { |
378 | 378 | $prices_atts = ''; |
379 | - if( $variable_prices = give_get_variable_prices( $payment_meta['form_id'] ) ) { |
|
380 | - foreach ( $variable_prices as $variable_price ) { |
|
381 | - $prices_atts[$variable_price['_give_id']['level_id']] = give_format_amount( $variable_price['_give_amount'], array( 'sanitize' => false ) ); |
|
379 | + if ($variable_prices = give_get_variable_prices($payment_meta['form_id'])) { |
|
380 | + foreach ($variable_prices as $variable_price) { |
|
381 | + $prices_atts[$variable_price['_give_id']['level_id']] = give_format_amount($variable_price['_give_amount'], array('sanitize' => false)); |
|
382 | 382 | } |
383 | 383 | } |
384 | 384 | // Variable price dropdown options. |
@@ -387,12 +387,12 @@ discard block |
||
387 | 387 | 'name' => 'give-variable-price', |
388 | 388 | 'chosen' => true, |
389 | 389 | 'show_option_all' => '', |
390 | - 'show_option_none' => ( '' === get_post_meta( $payment_id, '_give_payment_price_id', true ) ? __( 'None', 'give' ) : '' ), |
|
391 | - 'select_atts' => 'data-prices=' . esc_attr( json_encode( $prices_atts ) ), |
|
390 | + 'show_option_none' => ('' === get_post_meta($payment_id, '_give_payment_price_id', true) ? __('None', 'give') : ''), |
|
391 | + 'select_atts' => 'data-prices='.esc_attr(json_encode($prices_atts)), |
|
392 | 392 | 'selected' => $payment_meta['price_id'], |
393 | 393 | ); |
394 | 394 | // Render variable prices select tag html. |
395 | - give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true ); |
|
395 | + give_get_form_variable_price_dropdown($variable_price_dropdown_option, true); |
|
396 | 396 | } |
397 | 397 | ?> |
398 | 398 | </span> |
@@ -400,8 +400,8 @@ discard block |
||
400 | 400 | </div> |
401 | 401 | <div class="column"> |
402 | 402 | <p> |
403 | - <strong><?php esc_html_e( 'Total Donation:', 'give' ); ?></strong><br> |
|
404 | - <?php echo give_currency_filter( give_format_amount( $payment->total, array( 'sanitize' => false ) ), give_get_payment_currency_code( $payment->ID ) ); ?> |
|
403 | + <strong><?php esc_html_e('Total Donation:', 'give'); ?></strong><br> |
|
404 | + <?php echo give_currency_filter(give_format_amount($payment->total, array('sanitize' => false)), give_get_payment_currency_code($payment->ID)); ?> |
|
405 | 405 | </p> |
406 | 406 | <p> |
407 | 407 | <?php |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | * |
415 | 415 | * @param int $payment_id Payment id. |
416 | 416 | */ |
417 | - do_action( 'give_donation_details_thead_before', $payment_id ); |
|
417 | + do_action('give_donation_details_thead_before', $payment_id); |
|
418 | 418 | |
419 | 419 | |
420 | 420 | /** |
@@ -426,7 +426,7 @@ discard block |
||
426 | 426 | * |
427 | 427 | * @param int $payment_id Payment id. |
428 | 428 | */ |
429 | - do_action( 'give_donation_details_thead_after', $payment_id ); |
|
429 | + do_action('give_donation_details_thead_after', $payment_id); |
|
430 | 430 | |
431 | 431 | /** |
432 | 432 | * Fires in order details page, in the donation-information metabox, before the body elements. |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | * |
438 | 438 | * @param int $payment_id Payment id. |
439 | 439 | */ |
440 | - do_action( 'give_donation_details_tbody_before', $payment_id ); |
|
440 | + do_action('give_donation_details_tbody_before', $payment_id); |
|
441 | 441 | |
442 | 442 | /** |
443 | 443 | * Fires in order details page, in the donation-information metabox, after the body elements. |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | * |
449 | 449 | * @param int $payment_id Payment id. |
450 | 450 | */ |
451 | - do_action( 'give_donation_details_tbody_after', $payment_id ); |
|
451 | + do_action('give_donation_details_tbody_after', $payment_id); |
|
452 | 452 | ?> |
453 | 453 | </p> |
454 | 454 | </div> |
@@ -468,67 +468,67 @@ discard block |
||
468 | 468 | * |
469 | 469 | * @param int $payment_id Payment id. |
470 | 470 | */ |
471 | - do_action( 'give_view_order_details_files_after', $payment_id ); |
|
471 | + do_action('give_view_order_details_files_after', $payment_id); |
|
472 | 472 | ?> |
473 | 473 | |
474 | 474 | <div id="give-donor-details" class="postbox"> |
475 | - <h3 class="hndle"><?php esc_html_e( 'Donor Details', 'give' ); ?></h3> |
|
475 | + <h3 class="hndle"><?php esc_html_e('Donor Details', 'give'); ?></h3> |
|
476 | 476 | |
477 | 477 | <div class="inside"> |
478 | 478 | |
479 | - <?php $donor = new Give_Donor( $donor_id ); ?> |
|
479 | + <?php $donor = new Give_Donor($donor_id); ?> |
|
480 | 480 | |
481 | 481 | <div class="column-container donor-info"> |
482 | 482 | <div class="column"> |
483 | 483 | <p> |
484 | - <strong><?php esc_html_e( 'Donor ID:', 'give' ); ?></strong><br> |
|
484 | + <strong><?php esc_html_e('Donor ID:', 'give'); ?></strong><br> |
|
485 | 485 | <?php |
486 | - if ( ! empty( $donor->id ) ) { |
|
486 | + if ( ! empty($donor->id)) { |
|
487 | 487 | printf( |
488 | 488 | '<a href="%1$s">#%2$s</a>', |
489 | - admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ), |
|
489 | + admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id), |
|
490 | 490 | $donor->id |
491 | 491 | ); |
492 | 492 | } |
493 | 493 | ?> |
494 | 494 | </p> |
495 | 495 | <p> |
496 | - <strong><?php esc_html_e( 'Donor Since:', 'give' ); ?></strong><br> |
|
497 | - <?php echo date_i18n( give_date_format(), strtotime( $donor->date_created ) ) ?> |
|
496 | + <strong><?php esc_html_e('Donor Since:', 'give'); ?></strong><br> |
|
497 | + <?php echo date_i18n(give_date_format(), strtotime($donor->date_created)) ?> |
|
498 | 498 | </p> |
499 | 499 | </div> |
500 | 500 | <div class="column"> |
501 | 501 | <p> |
502 | - <strong><?php esc_html_e( 'Donor Name:', 'give' ); ?></strong><br> |
|
502 | + <strong><?php esc_html_e('Donor Name:', 'give'); ?></strong><br> |
|
503 | 503 | <?php |
504 | - $donor_billing_name = give_get_donor_name_by( $payment_id, 'donation' ); |
|
505 | - $donor_name = give_get_donor_name_by( $donor_id, 'donor' ); |
|
504 | + $donor_billing_name = give_get_donor_name_by($payment_id, 'donation'); |
|
505 | + $donor_name = give_get_donor_name_by($donor_id, 'donor'); |
|
506 | 506 | |
507 | 507 | // Check whether the donor name and WP_User name is same or not. |
508 | - if( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ){ |
|
509 | - echo $donor_billing_name . ' (<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id" ) ) . '">' . $donor_name . '</a>)'; |
|
510 | - }else{ |
|
508 | + if (sanitize_title($donor_billing_name) != sanitize_title($donor_name)) { |
|
509 | + echo $donor_billing_name.' (<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id")).'">'.$donor_name.'</a>)'; |
|
510 | + } else { |
|
511 | 511 | echo $donor_name; |
512 | 512 | } |
513 | 513 | ?> |
514 | 514 | </p> |
515 | 515 | <p> |
516 | - <strong><?php esc_html_e( 'Donor Email:', 'give' ); ?></strong><br> |
|
516 | + <strong><?php esc_html_e('Donor Email:', 'give'); ?></strong><br> |
|
517 | 517 | <?php echo $donor->email; ?> |
518 | 518 | </p> |
519 | 519 | </div> |
520 | 520 | <div class="column"> |
521 | 521 | <p> |
522 | - <strong><?php esc_html_e( 'Change Donor:', 'give' ); ?></strong><br> |
|
522 | + <strong><?php esc_html_e('Change Donor:', 'give'); ?></strong><br> |
|
523 | 523 | <?php |
524 | - echo Give()->html->donor_dropdown( array( |
|
524 | + echo Give()->html->donor_dropdown(array( |
|
525 | 525 | 'selected' => $donor->id, |
526 | 526 | 'name' => 'donor-id', |
527 | - ) ); |
|
527 | + )); |
|
528 | 528 | ?> |
529 | 529 | </p> |
530 | 530 | <p> |
531 | - <a href="#new" class="give-payment-new-donor"><?php esc_html_e( 'Create New Donor', 'give' ); ?></a> |
|
531 | + <a href="#new" class="give-payment-new-donor"><?php esc_html_e('Create New Donor', 'give'); ?></a> |
|
532 | 532 | </p> |
533 | 533 | </div> |
534 | 534 | </div> |
@@ -536,13 +536,13 @@ discard block |
||
536 | 536 | <div class="column-container new-donor" style="display: none"> |
537 | 537 | <div class="column"> |
538 | 538 | <p> |
539 | - <label for="give-new-donor-name"><?php esc_html_e( 'New Donor Name:', 'give' ); ?></label> |
|
539 | + <label for="give-new-donor-name"><?php esc_html_e('New Donor Name:', 'give'); ?></label> |
|
540 | 540 | <input id="give-new-donor-name" type="text" name="give-new-donor-name" value="" class="medium-text"/> |
541 | 541 | </p> |
542 | 542 | </div> |
543 | 543 | <div class="column"> |
544 | 544 | <p> |
545 | - <label for="give-new-donor-email"><?php esc_html_e( 'New Donor Email:', 'give' ); ?></label> |
|
545 | + <label for="give-new-donor-email"><?php esc_html_e('New Donor Email:', 'give'); ?></label> |
|
546 | 546 | <input id="give-new-donor-email" type="email" name="give-new-donor-email" value="" class="medium-text"/> |
547 | 547 | </p> |
548 | 548 | </div> |
@@ -550,9 +550,9 @@ discard block |
||
550 | 550 | <p> |
551 | 551 | <input type="hidden" name="give-current-donor" value="<?php echo $donor->id; ?>"/> |
552 | 552 | <input type="hidden" id="give-new-donor" name="give-new-donor" value="0"/> |
553 | - <a href="#cancel" class="give-payment-new-donor-cancel give-delete"><?php esc_html_e( 'Cancel', 'give' ); ?></a> |
|
553 | + <a href="#cancel" class="give-payment-new-donor-cancel give-delete"><?php esc_html_e('Cancel', 'give'); ?></a> |
|
554 | 554 | <br> |
555 | - <em><?php esc_html_e( 'Click "Save Donation" to create new donor.', 'give' ); ?></em> |
|
555 | + <em><?php esc_html_e('Click "Save Donation" to create new donor.', 'give'); ?></em> |
|
556 | 556 | </p> |
557 | 557 | </div> |
558 | 558 | </div> |
@@ -568,7 +568,7 @@ discard block |
||
568 | 568 | * @param array $payment_meta Payment meta. |
569 | 569 | * @param array $user_info User information. |
570 | 570 | */ |
571 | - do_action( 'give_payment_personal_details_list', $payment_meta, $user_info ); |
|
571 | + do_action('give_payment_personal_details_list', $payment_meta, $user_info); |
|
572 | 572 | |
573 | 573 | /** |
574 | 574 | * Fires on the donation details page, in the donor-details metabox. |
@@ -577,7 +577,7 @@ discard block |
||
577 | 577 | * |
578 | 578 | * @param int $payment_id Payment id. |
579 | 579 | */ |
580 | - do_action( 'give_payment_view_details', $payment_id ); |
|
580 | + do_action('give_payment_view_details', $payment_id); |
|
581 | 581 | ?> |
582 | 582 | |
583 | 583 | </div> |
@@ -593,11 +593,11 @@ discard block |
||
593 | 593 | * |
594 | 594 | * @param int $payment_id Payment id. |
595 | 595 | */ |
596 | - do_action( 'give_view_order_details_billing_before', $payment_id ); |
|
596 | + do_action('give_view_order_details_billing_before', $payment_id); |
|
597 | 597 | ?> |
598 | 598 | |
599 | 599 | <div id="give-billing-details" class="postbox"> |
600 | - <h3 class="hndle"><?php esc_html_e( 'Billing Address', 'give' ); ?></h3> |
|
600 | + <h3 class="hndle"><?php esc_html_e('Billing Address', 'give'); ?></h3> |
|
601 | 601 | |
602 | 602 | <div class="inside"> |
603 | 603 | |
@@ -607,9 +607,9 @@ discard block |
||
607 | 607 | <div class="data column-container"> |
608 | 608 | |
609 | 609 | <?php |
610 | - $address['country'] = ( ! empty( $address['country'] ) ? $address['country'] : give_get_country() ); |
|
610 | + $address['country'] = ( ! empty($address['country']) ? $address['country'] : give_get_country()); |
|
611 | 611 | |
612 | - $address['state'] = ( ! empty( $address['state'] ) ? $address['state'] : '' ); |
|
612 | + $address['state'] = ( ! empty($address['state']) ? $address['state'] : ''); |
|
613 | 613 | |
614 | 614 | // Get the country list that does not have any states init. |
615 | 615 | $no_states_country = give_no_states_country_list(); |
@@ -617,55 +617,55 @@ discard block |
||
617 | 617 | |
618 | 618 | <div class="row"> |
619 | 619 | <div id="give-order-address-country-wrap"> |
620 | - <label class="order-data-address-line"><?php esc_html_e( 'Country:', 'give' ); ?></label> |
|
620 | + <label class="order-data-address-line"><?php esc_html_e('Country:', 'give'); ?></label> |
|
621 | 621 | <?php |
622 | - echo Give()->html->select( array( |
|
622 | + echo Give()->html->select(array( |
|
623 | 623 | 'options' => give_get_country_list(), |
624 | 624 | 'name' => 'give-payment-address[0][country]', |
625 | 625 | 'selected' => $address['country'], |
626 | 626 | 'show_option_all' => false, |
627 | 627 | 'show_option_none' => false, |
628 | 628 | 'chosen' => true, |
629 | - 'placeholder' => esc_attr__( 'Select a country', 'give' ), |
|
630 | - 'data' => array( 'search-type' => 'no_ajax' ), |
|
631 | - ) ); |
|
629 | + 'placeholder' => esc_attr__('Select a country', 'give'), |
|
630 | + 'data' => array('search-type' => 'no_ajax'), |
|
631 | + )); |
|
632 | 632 | ?> |
633 | 633 | </div> |
634 | 634 | </div> |
635 | 635 | |
636 | 636 | <div class="row"> |
637 | 637 | <div class="give-wrap-address-line1"> |
638 | - <label for="give-payment-address-line1" class="order-data-address"><?php esc_html_e( 'Address 1:', 'give' ); ?></label> |
|
639 | - <input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr( $address['line1'] ); ?>" class="medium-text"/> |
|
638 | + <label for="give-payment-address-line1" class="order-data-address"><?php esc_html_e('Address 1:', 'give'); ?></label> |
|
639 | + <input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr($address['line1']); ?>" class="medium-text"/> |
|
640 | 640 | </div> |
641 | 641 | </div> |
642 | 642 | |
643 | 643 | <div class="row"> |
644 | 644 | <div class="give-wrap-address-line2"> |
645 | - <label for="give-payment-address-line2" class="order-data-address-line"><?php esc_html_e( 'Address 2:', 'give' ); ?></label> |
|
646 | - <input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr( $address['line2'] ); ?>" class="medium-text"/> |
|
645 | + <label for="give-payment-address-line2" class="order-data-address-line"><?php esc_html_e('Address 2:', 'give'); ?></label> |
|
646 | + <input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr($address['line2']); ?>" class="medium-text"/> |
|
647 | 647 | </div> |
648 | 648 | </div> |
649 | 649 | |
650 | 650 | <div class="row"> |
651 | - <div id="give-order-address-state-wrap" class="<?php echo ( ! empty( $address['country'] ) && array_key_exists( $address['country'], $no_states_country ) ? 'give-hidden' : '' ); ?>"> |
|
652 | - <label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e( 'State / Province / County:', 'give' ); ?></label> |
|
651 | + <div id="give-order-address-state-wrap" class="<?php echo ( ! empty($address['country']) && array_key_exists($address['country'], $no_states_country) ? 'give-hidden' : ''); ?>"> |
|
652 | + <label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e('State / Province / County:', 'give'); ?></label> |
|
653 | 653 | <?php |
654 | - $states = give_get_states( $address['country'] ); |
|
655 | - if ( ! empty( $states ) ) { |
|
656 | - echo Give()->html->select( array( |
|
654 | + $states = give_get_states($address['country']); |
|
655 | + if ( ! empty($states)) { |
|
656 | + echo Give()->html->select(array( |
|
657 | 657 | 'options' => $states, |
658 | 658 | 'name' => 'give-payment-address[0][state]', |
659 | 659 | 'selected' => $address['state'], |
660 | 660 | 'show_option_all' => false, |
661 | 661 | 'show_option_none' => false, |
662 | 662 | 'chosen' => true, |
663 | - 'placeholder' => esc_attr__( 'Select a state', 'give' ), |
|
664 | - 'data' => array( 'search-type' => 'no_ajax' ), |
|
665 | - ) ); |
|
663 | + 'placeholder' => esc_attr__('Select a state', 'give'), |
|
664 | + 'data' => array('search-type' => 'no_ajax'), |
|
665 | + )); |
|
666 | 666 | } else { |
667 | 667 | ?> |
668 | - <input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr( $address['state'] ); ?>" class="medium-text"/> |
|
668 | + <input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr($address['state']); ?>" class="medium-text"/> |
|
669 | 669 | <?php |
670 | 670 | } ?> |
671 | 671 | </div> |
@@ -674,15 +674,15 @@ discard block |
||
674 | 674 | <div class="row"> |
675 | 675 | <div class="column"> |
676 | 676 | <div class="give-wrap-address-city"> |
677 | - <label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e( 'City:', 'give' ); ?></label> |
|
678 | - <input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr( $address['city'] ); ?>" class="medium-text"/> |
|
677 | + <label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e('City:', 'give'); ?></label> |
|
678 | + <input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr($address['city']); ?>" class="medium-text"/> |
|
679 | 679 | </div> |
680 | 680 | </div> |
681 | 681 | |
682 | 682 | <div class="column"> |
683 | 683 | <div class="give-wrap-address-zip"> |
684 | - <label for="give-payment-address-zip" class="order-data-address-line"><?php esc_html_e( 'Zip / Postal Code:', 'give' ); ?></label> |
|
685 | - <input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr( $address['zip'] ); ?>" class="medium-text"/> |
|
684 | + <label for="give-payment-address-zip" class="order-data-address-line"><?php esc_html_e('Zip / Postal Code:', 'give'); ?></label> |
|
685 | + <input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr($address['zip']); ?>" class="medium-text"/> |
|
686 | 686 | </div> |
687 | 687 | </div> |
688 | 688 | </div> |
@@ -701,7 +701,7 @@ discard block |
||
701 | 701 | * |
702 | 702 | * @param int $payment_id Payment id. |
703 | 703 | */ |
704 | - do_action( 'give_payment_billing_details', $payment_id ); |
|
704 | + do_action('give_payment_billing_details', $payment_id); |
|
705 | 705 | ?> |
706 | 706 | |
707 | 707 | </div> |
@@ -717,32 +717,32 @@ discard block |
||
717 | 717 | * |
718 | 718 | * @param int $payment_id Payment id. |
719 | 719 | */ |
720 | - do_action( 'give_view_order_details_billing_after', $payment_id ); |
|
720 | + do_action('give_view_order_details_billing_after', $payment_id); |
|
721 | 721 | ?> |
722 | 722 | |
723 | 723 | <div id="give-payment-notes" class="postbox"> |
724 | - <h3 class="hndle"><?php esc_html_e( 'Donation Notes', 'give' ); ?></h3> |
|
724 | + <h3 class="hndle"><?php esc_html_e('Donation Notes', 'give'); ?></h3> |
|
725 | 725 | |
726 | 726 | <div class="inside"> |
727 | 727 | <div id="give-payment-notes-inner"> |
728 | 728 | <?php |
729 | - $notes = give_get_payment_notes( $payment_id ); |
|
730 | - if ( ! empty( $notes ) ) { |
|
729 | + $notes = give_get_payment_notes($payment_id); |
|
730 | + if ( ! empty($notes)) { |
|
731 | 731 | $no_notes_display = ' style="display:none;"'; |
732 | - foreach ( $notes as $note ) : |
|
732 | + foreach ($notes as $note) : |
|
733 | 733 | |
734 | - echo give_get_payment_note_html( $note, $payment_id ); |
|
734 | + echo give_get_payment_note_html($note, $payment_id); |
|
735 | 735 | |
736 | 736 | endforeach; |
737 | 737 | } else { |
738 | 738 | $no_notes_display = ''; |
739 | 739 | } |
740 | - echo '<p class="give-no-payment-notes"' . $no_notes_display . '>' . esc_html__( 'No donation notes.', 'give' ) . '</p>'; ?> |
|
740 | + echo '<p class="give-no-payment-notes"'.$no_notes_display.'>'.esc_html__('No donation notes.', 'give').'</p>'; ?> |
|
741 | 741 | </div> |
742 | 742 | <textarea name="give-payment-note" id="give-payment-note" class="large-text"></textarea> |
743 | 743 | |
744 | 744 | <div class="give-clearfix"> |
745 | - <button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint( $payment_id ); ?>"><?php esc_html_e( 'Add Note', 'give' ); ?></button> |
|
745 | + <button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint($payment_id); ?>"><?php esc_html_e('Add Note', 'give'); ?></button> |
|
746 | 746 | </div> |
747 | 747 | |
748 | 748 | </div> |
@@ -758,7 +758,7 @@ discard block |
||
758 | 758 | * |
759 | 759 | * @param int $payment_id Payment id. |
760 | 760 | */ |
761 | - do_action( 'give_view_order_details_main_after', $payment_id ); |
|
761 | + do_action('give_view_order_details_main_after', $payment_id); |
|
762 | 762 | ?> |
763 | 763 | |
764 | 764 | </div> |
@@ -780,11 +780,11 @@ discard block |
||
780 | 780 | * |
781 | 781 | * @param int $payment_id Payment id. |
782 | 782 | */ |
783 | - do_action( 'give_view_order_details_form_bottom', $payment_id ); |
|
783 | + do_action('give_view_order_details_form_bottom', $payment_id); |
|
784 | 784 | |
785 | - wp_nonce_field( 'give_update_payment_details_nonce' ); |
|
785 | + wp_nonce_field('give_update_payment_details_nonce'); |
|
786 | 786 | ?> |
787 | - <input type="hidden" name="give_payment_id" value="<?php echo esc_attr( $payment_id ); ?>"/> |
|
787 | + <input type="hidden" name="give_payment_id" value="<?php echo esc_attr($payment_id); ?>"/> |
|
788 | 788 | <input type="hidden" name="give_action" value="update_payment_details"/> |
789 | 789 | </form> |
790 | 790 | <?php |
@@ -795,6 +795,6 @@ discard block |
||
795 | 795 | * |
796 | 796 | * @param int $payment_id Payment id. |
797 | 797 | */ |
798 | - do_action( 'give_view_order_details_after', $payment_id ); |
|
798 | + do_action('give_view_order_details_after', $payment_id); |
|
799 | 799 | ?> |
800 | 800 | </div><!-- /.wrap --> |
@@ -9,13 +9,13 @@ discard block |
||
9 | 9 | */ |
10 | 10 | |
11 | 11 | // Exit if accessed directly. |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; |
14 | 14 | } |
15 | 15 | |
16 | 16 | // Load WP_List_Table if not loaded. |
17 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
18 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
17 | +if ( ! class_exists('WP_List_Table')) { |
|
18 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | /** |
@@ -44,11 +44,11 @@ discard block |
||
44 | 44 | */ |
45 | 45 | public function __construct() { |
46 | 46 | // Set parent defaults. |
47 | - parent::__construct( array( |
|
48 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records. |
|
49 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. |
|
47 | + parent::__construct(array( |
|
48 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records. |
|
49 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. |
|
50 | 50 | 'ajax' => false // Does this table support ajax?. |
51 | - ) ); |
|
51 | + )); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
@@ -62,19 +62,19 @@ discard block |
||
62 | 62 | * |
63 | 63 | * @return string Column Name. |
64 | 64 | */ |
65 | - public function column_default( $item, $column_name ) { |
|
65 | + public function column_default($item, $column_name) { |
|
66 | 66 | |
67 | - switch ( $column_name ) { |
|
67 | + switch ($column_name) { |
|
68 | 68 | case 'ID' : |
69 | 69 | return $item['ID_label']; |
70 | 70 | case 'payment_id' : |
71 | - return empty( $item['payment_id'] ) ? esc_html__( 'n/a', 'give' ) : sprintf( "<a href=\"%s\" target=\"_blank\">{$item['payment_id']}</a>", get_edit_post_link( $item['payment_id'] ) ); |
|
71 | + return empty($item['payment_id']) ? esc_html__('n/a', 'give') : sprintf("<a href=\"%s\" target=\"_blank\">{$item['payment_id']}</a>", get_edit_post_link($item['payment_id'])); |
|
72 | 72 | case 'gateway' : |
73 | - return empty( $item['gateway'] ) ? esc_html__( 'n/a', 'give' ) : $item['gateway']; |
|
73 | + return empty($item['gateway']) ? esc_html__('n/a', 'give') : $item['gateway']; |
|
74 | 74 | case 'error' : |
75 | - return get_the_title( $item['ID'] ) ? get_the_title( $item['ID'] ) : esc_html__( 'Payment Error', 'give' ); |
|
75 | + return get_the_title($item['ID']) ? get_the_title($item['ID']) : esc_html__('Payment Error', 'give'); |
|
76 | 76 | default: |
77 | - return $item[ $column_name ]; |
|
77 | + return $item[$column_name]; |
|
78 | 78 | } |
79 | 79 | } |
80 | 80 | |
@@ -88,27 +88,27 @@ discard block |
||
88 | 88 | * |
89 | 89 | * @return void |
90 | 90 | */ |
91 | - public function column_message( $item ) { ?> |
|
92 | - <a href="#TB_inline?width=640&inlineId=log-message-<?php echo $item['ID']; ?>" class="thickbox give-error-log-details-link button button-small" data-tooltip="<?php esc_attr_e( 'View Log Message', 'give' ); ?>"><span class="dashicons dashicons-visibility"></span></a> |
|
91 | + public function column_message($item) { ?> |
|
92 | + <a href="#TB_inline?width=640&inlineId=log-message-<?php echo $item['ID']; ?>" class="thickbox give-error-log-details-link button button-small" data-tooltip="<?php esc_attr_e('View Log Message', 'give'); ?>"><span class="dashicons dashicons-visibility"></span></a> |
|
93 | 93 | <div id="log-message-<?php echo $item['ID']; ?>" style="display:none;"> |
94 | 94 | <?php |
95 | 95 | |
96 | - $log_message = get_post_field( 'post_content', $item['ID'] ); |
|
96 | + $log_message = get_post_field('post_content', $item['ID']); |
|
97 | 97 | |
98 | - $serialized = strpos( $log_message, '{"' ); |
|
98 | + $serialized = strpos($log_message, '{"'); |
|
99 | 99 | |
100 | 100 | // Check to see if the log message contains serialized information |
101 | - if ( $serialized !== false ) { |
|
102 | - $length = strlen( $log_message ) - $serialized; |
|
103 | - $intro = substr( $log_message, 0, - $length ); |
|
104 | - $data = substr( $log_message, $serialized, strlen( $log_message ) - 1 ); |
|
101 | + if ($serialized !== false) { |
|
102 | + $length = strlen($log_message) - $serialized; |
|
103 | + $intro = substr($log_message, 0, - $length); |
|
104 | + $data = substr($log_message, $serialized, strlen($log_message) - 1); |
|
105 | 105 | |
106 | - echo wpautop( $intro ); |
|
107 | - echo wpautop( '<strong>' . esc_html__( 'Log data:', 'give' ) . '</strong>' ); |
|
108 | - echo '<div style="word-wrap: break-word;">' . wpautop( $data ) . '</div>'; |
|
106 | + echo wpautop($intro); |
|
107 | + echo wpautop('<strong>'.esc_html__('Log data:', 'give').'</strong>'); |
|
108 | + echo '<div style="word-wrap: break-word;">'.wpautop($data).'</div>'; |
|
109 | 109 | } else { |
110 | 110 | // No serialized data found |
111 | - echo wpautop( $log_message ); |
|
111 | + echo wpautop($log_message); |
|
112 | 112 | } |
113 | 113 | ?> |
114 | 114 | </div> |
@@ -124,12 +124,12 @@ discard block |
||
124 | 124 | */ |
125 | 125 | public function get_columns() { |
126 | 126 | $columns = array( |
127 | - 'ID' => esc_html__( 'Log ID', 'give' ), |
|
128 | - 'error' => esc_html__( 'Error', 'give' ), |
|
129 | - 'gateway' => esc_html__( 'Gateway', 'give' ), |
|
130 | - 'payment_id' => esc_html__( 'Donation ID', 'give' ), |
|
131 | - 'date' => esc_html__( 'Date', 'give' ), |
|
132 | - 'message' => esc_html__( 'Details', 'give' ) |
|
127 | + 'ID' => esc_html__('Log ID', 'give'), |
|
128 | + 'error' => esc_html__('Error', 'give'), |
|
129 | + 'gateway' => esc_html__('Gateway', 'give'), |
|
130 | + 'payment_id' => esc_html__('Donation ID', 'give'), |
|
131 | + 'date' => esc_html__('Date', 'give'), |
|
132 | + 'message' => esc_html__('Details', 'give') |
|
133 | 133 | ); |
134 | 134 | |
135 | 135 | return $columns; |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | * @return int Current page number |
144 | 144 | */ |
145 | 145 | public function get_paged() { |
146 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
146 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | /** |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | * @since 1.0 |
154 | 154 | * @return void |
155 | 155 | */ |
156 | - public function bulk_actions( $which = '' ) { |
|
156 | + public function bulk_actions($which = '') { |
|
157 | 157 | give_log_views(); |
158 | 158 | } |
159 | 159 | |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | |
172 | 172 | // Prevent the queries from getting cached. |
173 | 173 | // Without this there are occasional memory issues for some installs. |
174 | - wp_suspend_cache_addition( true ); |
|
174 | + wp_suspend_cache_addition(true); |
|
175 | 175 | |
176 | 176 | $logs_data = array(); |
177 | 177 | $paged = $this->get_paged(); |
@@ -181,17 +181,17 @@ discard block |
||
181 | 181 | 'posts_per_page' => $this->per_page, |
182 | 182 | ); |
183 | 183 | |
184 | - $logs = $give_logs->get_connected_logs( $log_query ); |
|
184 | + $logs = $give_logs->get_connected_logs($log_query); |
|
185 | 185 | |
186 | - if ( $logs ) { |
|
187 | - foreach ( $logs as $log ) { |
|
186 | + if ($logs) { |
|
187 | + foreach ($logs as $log) { |
|
188 | 188 | |
189 | 189 | $logs_data[] = array( |
190 | 190 | 'ID' => $log->ID, |
191 | - 'ID_label' => '<span class=\'give-item-label give-item-label-gray\'>' . $log->ID . '</span>', |
|
191 | + 'ID_label' => '<span class=\'give-item-label give-item-label-gray\'>'.$log->ID.'</span>', |
|
192 | 192 | 'payment_id' => $log->post_parent, |
193 | 193 | 'error' => 'error', |
194 | - 'gateway' => give_get_payment_gateway( $log->post_parent ), |
|
194 | + 'gateway' => give_get_payment_gateway($log->post_parent), |
|
195 | 195 | 'date' => $log->post_date |
196 | 196 | ); |
197 | 197 | } |
@@ -213,19 +213,19 @@ discard block |
||
213 | 213 | * |
214 | 214 | * @param string $which |
215 | 215 | */ |
216 | - protected function display_tablenav( $which ) { |
|
217 | - if ( 'top' === $which ) { |
|
218 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
216 | + protected function display_tablenav($which) { |
|
217 | + if ('top' === $which) { |
|
218 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
219 | 219 | } |
220 | 220 | ?> |
221 | - <div class="tablenav <?php echo esc_attr( $which ); ?>"> |
|
221 | + <div class="tablenav <?php echo esc_attr($which); ?>"> |
|
222 | 222 | |
223 | 223 | <div class="alignleft actions bulkactions"> |
224 | - <?php $this->bulk_actions( $which ); ?> |
|
224 | + <?php $this->bulk_actions($which); ?> |
|
225 | 225 | </div> |
226 | 226 | <?php |
227 | - $this->extra_tablenav( $which ); |
|
228 | - $this->pagination( $which ); |
|
227 | + $this->extra_tablenav($which); |
|
228 | + $this->pagination($which); |
|
229 | 229 | ?> |
230 | 230 | |
231 | 231 | <br class="clear"/> |
@@ -252,14 +252,14 @@ discard block |
||
252 | 252 | $columns = $this->get_columns(); |
253 | 253 | $hidden = array(); // No hidden columns |
254 | 254 | $sortable = $this->get_sortable_columns(); |
255 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
255 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
256 | 256 | $this->items = $this->get_logs(); |
257 | - $total_items = $give_logs->get_log_count( 0, 'gateway_error' ); |
|
257 | + $total_items = $give_logs->get_log_count(0, 'gateway_error'); |
|
258 | 258 | |
259 | - $this->set_pagination_args( array( |
|
259 | + $this->set_pagination_args(array( |
|
260 | 260 | 'total_items' => $total_items, |
261 | 261 | 'per_page' => $this->per_page, |
262 | - 'total_pages' => ceil( $total_items / $this->per_page ), |
|
262 | + 'total_pages' => ceil($total_items / $this->per_page), |
|
263 | 263 | ) |
264 | 264 | ); |
265 | 265 | } |
@@ -143,7 +143,7 @@ |
||
143 | 143 | * |
144 | 144 | * @access public |
145 | 145 | * @since 1.0 |
146 | - * @return mixed string If search is present, false otherwise |
|
146 | + * @return string|false string If search is present, false otherwise |
|
147 | 147 | */ |
148 | 148 | public function get_search() { |
149 | 149 | return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false; |
@@ -10,13 +10,13 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
17 | 17 | // Load WP_List_Table if not loaded |
18 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
19 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
18 | +if ( ! class_exists('WP_List_Table')) { |
|
19 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
@@ -62,11 +62,11 @@ discard block |
||
62 | 62 | global $status, $page; |
63 | 63 | |
64 | 64 | // Set parent defaults |
65 | - parent::__construct( array( |
|
66 | - 'singular' => esc_html__( 'Donor', 'give' ), // Singular name of the listed records |
|
67 | - 'plural' => esc_html__( 'Donors', 'give' ), // Plural name of the listed records |
|
68 | - 'ajax' => false,// Does this table support ajax? |
|
69 | - ) ); |
|
65 | + parent::__construct(array( |
|
66 | + 'singular' => esc_html__('Donor', 'give'), // Singular name of the listed records |
|
67 | + 'plural' => esc_html__('Donors', 'give'), // Plural name of the listed records |
|
68 | + 'ajax' => false, // Does this table support ajax? |
|
69 | + )); |
|
70 | 70 | |
71 | 71 | } |
72 | 72 | |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | * |
84 | 84 | * @return false |
85 | 85 | */ |
86 | - public function search_box( $text, $input_id ) { |
|
86 | + public function search_box($text, $input_id) { |
|
87 | 87 | return false; |
88 | 88 | } |
89 | 89 | |
@@ -98,20 +98,20 @@ discard block |
||
98 | 98 | * |
99 | 99 | * @return void |
100 | 100 | */ |
101 | - public function give_search_box( $text, $input_id ) { |
|
102 | - $input_id = $input_id . '-search-input'; |
|
101 | + public function give_search_box($text, $input_id) { |
|
102 | + $input_id = $input_id.'-search-input'; |
|
103 | 103 | |
104 | - if ( ! empty( $_REQUEST['orderby'] ) ) { |
|
105 | - echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />'; |
|
104 | + if ( ! empty($_REQUEST['orderby'])) { |
|
105 | + echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />'; |
|
106 | 106 | } |
107 | - if ( ! empty( $_REQUEST['order'] ) ) { |
|
108 | - echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />'; |
|
107 | + if ( ! empty($_REQUEST['order'])) { |
|
108 | + echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />'; |
|
109 | 109 | } |
110 | 110 | ?> |
111 | 111 | <p class="search-box donor-search" role="search"> |
112 | 112 | <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label> |
113 | 113 | <input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>" /> |
114 | - <?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?> |
|
114 | + <?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?> |
|
115 | 115 | </p> |
116 | 116 | <?php |
117 | 117 | } |
@@ -124,33 +124,33 @@ discard block |
||
124 | 124 | * |
125 | 125 | * @param string $which |
126 | 126 | */ |
127 | - protected function display_tablenav( $which ) { |
|
127 | + protected function display_tablenav($which) { |
|
128 | 128 | |
129 | - if ( 'top' === $which ) { |
|
130 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
129 | + if ('top' === $which) { |
|
130 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
131 | 131 | } |
132 | 132 | ?> |
133 | - <div class="tablenav give-clearfix <?php echo esc_attr( $which ); ?>"> |
|
133 | + <div class="tablenav give-clearfix <?php echo esc_attr($which); ?>"> |
|
134 | 134 | |
135 | - <?php if ( 'top' === $which ) { ?> |
|
135 | + <?php if ('top' === $which) { ?> |
|
136 | 136 | <h2 class="alignleft reports-earnings-title"> |
137 | - <?php esc_html_e( 'Donors Report', 'give' ); ?> |
|
137 | + <?php esc_html_e('Donors Report', 'give'); ?> |
|
138 | 138 | </h2> |
139 | 139 | <?php } ?> |
140 | 140 | |
141 | 141 | <div class="alignright tablenav-right"> |
142 | 142 | <div class="actions bulkactions"> |
143 | 143 | <?php |
144 | - if ( 'top' === $which ) { |
|
145 | - $this->give_search_box( esc_html__( 'Search Donors', 'give' ), 'give-donors-report-search' ); |
|
144 | + if ('top' === $which) { |
|
145 | + $this->give_search_box(esc_html__('Search Donors', 'give'), 'give-donors-report-search'); |
|
146 | 146 | } |
147 | 147 | |
148 | - $this->bulk_actions( $which ); ?> |
|
148 | + $this->bulk_actions($which); ?> |
|
149 | 149 | |
150 | 150 | </div> |
151 | 151 | <?php |
152 | - $this->extra_tablenav( $which ); |
|
153 | - $this->pagination( $which ); |
|
152 | + $this->extra_tablenav($which); |
|
153 | + $this->pagination($which); |
|
154 | 154 | ?> |
155 | 155 | </div> |
156 | 156 | |
@@ -172,35 +172,35 @@ discard block |
||
172 | 172 | * |
173 | 173 | * @return string Column Name |
174 | 174 | */ |
175 | - public function column_default( $item, $column_name ) { |
|
175 | + public function column_default($item, $column_name) { |
|
176 | 176 | |
177 | - switch ( $column_name ) { |
|
177 | + switch ($column_name) { |
|
178 | 178 | |
179 | 179 | case 'name' : |
180 | - $name = '#' . $item['id'] . ' '; |
|
181 | - $name .= ! empty( $item['name'] ) ? $item['name'] : '<em>' . esc_html__( 'Unnamed Donor', 'give' ) . '</em>'; |
|
182 | - $view_url = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $item['id'] ); |
|
183 | - $value = '<a href="' . esc_url( $view_url ) . '">' . $name . '</a>'; |
|
180 | + $name = '#'.$item['id'].' '; |
|
181 | + $name .= ! empty($item['name']) ? $item['name'] : '<em>'.esc_html__('Unnamed Donor', 'give').'</em>'; |
|
182 | + $view_url = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$item['id']); |
|
183 | + $value = '<a href="'.esc_url($view_url).'">'.$name.'</a>'; |
|
184 | 184 | break; |
185 | 185 | |
186 | 186 | case 'num_donations' : |
187 | 187 | $value = sprintf( |
188 | 188 | '<a href="%s">%s</a>', |
189 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&donor=' . absint( $item['id'] ) ), |
|
190 | - esc_html( $item['num_donations'] ) |
|
189 | + admin_url('edit.php?post_type=give_forms&page=give-payment-history&donor='.absint($item['id'])), |
|
190 | + esc_html($item['num_donations']) |
|
191 | 191 | ); |
192 | 192 | break; |
193 | 193 | |
194 | 194 | case 'amount_spent' : |
195 | - $value = give_currency_filter( give_format_amount( $item[ $column_name ], array( 'sanitize' => false ) ) ); |
|
195 | + $value = give_currency_filter(give_format_amount($item[$column_name], array('sanitize' => false))); |
|
196 | 196 | break; |
197 | 197 | |
198 | 198 | default: |
199 | - $value = isset( $item[ $column_name ] ) ? $item[ $column_name ] : null; |
|
199 | + $value = isset($item[$column_name]) ? $item[$column_name] : null; |
|
200 | 200 | break; |
201 | 201 | } |
202 | 202 | |
203 | - return apply_filters( "give_report_column_{$column_name}", $value, $item['id'] ); |
|
203 | + return apply_filters("give_report_column_{$column_name}", $value, $item['id']); |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | /** |
@@ -212,13 +212,13 @@ discard block |
||
212 | 212 | */ |
213 | 213 | public function get_columns() { |
214 | 214 | $columns = array( |
215 | - 'name' => __( 'Name', 'give' ), |
|
216 | - 'email' => __( 'Email', 'give' ), |
|
217 | - 'num_donations' => __( 'Donations', 'give' ), |
|
218 | - 'amount_spent' => __( 'Total Donated', 'give' ), |
|
215 | + 'name' => __('Name', 'give'), |
|
216 | + 'email' => __('Email', 'give'), |
|
217 | + 'num_donations' => __('Donations', 'give'), |
|
218 | + 'amount_spent' => __('Total Donated', 'give'), |
|
219 | 219 | ); |
220 | 220 | |
221 | - return apply_filters( 'give_report_donor_columns', $columns ); |
|
221 | + return apply_filters('give_report_donor_columns', $columns); |
|
222 | 222 | |
223 | 223 | } |
224 | 224 | |
@@ -231,10 +231,10 @@ discard block |
||
231 | 231 | */ |
232 | 232 | public function get_sortable_columns() { |
233 | 233 | return array( |
234 | - 'id' => array( 'id', true ), |
|
235 | - 'name' => array( 'name', true ), |
|
236 | - 'num_donations' => array( 'purchase_count', false ), |
|
237 | - 'amount_spent' => array( 'purchase_value', false ), |
|
234 | + 'id' => array('id', true), |
|
235 | + 'name' => array('name', true), |
|
236 | + 'num_donations' => array('purchase_count', false), |
|
237 | + 'amount_spent' => array('purchase_value', false), |
|
238 | 238 | ); |
239 | 239 | } |
240 | 240 | |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | * @since 1.0 |
246 | 246 | * @return void |
247 | 247 | */ |
248 | - public function bulk_actions( $which = '' ) { |
|
248 | + public function bulk_actions($which = '') { |
|
249 | 249 | |
250 | 250 | } |
251 | 251 | |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | * @return int Current page number |
258 | 258 | */ |
259 | 259 | public function get_paged() { |
260 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
260 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
261 | 261 | } |
262 | 262 | |
263 | 263 | /** |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | * @return mixed string If search is present, false otherwise |
269 | 269 | */ |
270 | 270 | public function get_search() { |
271 | - return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false; |
|
271 | + return ! empty($_GET['s']) ? urldecode(trim($_GET['s'])) : false; |
|
272 | 272 | } |
273 | 273 | |
274 | 274 | /** |
@@ -287,15 +287,15 @@ discard block |
||
287 | 287 | |
288 | 288 | // Get donor query. |
289 | 289 | $args = $this->get_donor_query(); |
290 | - $donors = Give()->donors->get_donors( $args ); |
|
290 | + $donors = Give()->donors->get_donors($args); |
|
291 | 291 | |
292 | - if ( $donors ) { |
|
292 | + if ($donors) { |
|
293 | 293 | |
294 | - $this->count = count( $donors ); |
|
294 | + $this->count = count($donors); |
|
295 | 295 | |
296 | - foreach ( $donors as $donor ) { |
|
296 | + foreach ($donors as $donor) { |
|
297 | 297 | |
298 | - $user_id = ! empty( $donor->user_id ) ? absint( $donor->user_id ) : 0; |
|
298 | + $user_id = ! empty($donor->user_id) ? absint($donor->user_id) : 0; |
|
299 | 299 | |
300 | 300 | $data[] = array( |
301 | 301 | 'id' => $donor->id, |
@@ -323,9 +323,9 @@ discard block |
||
323 | 323 | |
324 | 324 | $_donor_query['number'] = -1; |
325 | 325 | $_donor_query['offset'] = 0; |
326 | - $donors = Give()->donors->get_donors( $_donor_query ); |
|
326 | + $donors = Give()->donors->get_donors($_donor_query); |
|
327 | 327 | |
328 | - return count( $donors ); |
|
328 | + return count($donors); |
|
329 | 329 | } |
330 | 330 | |
331 | 331 | /** |
@@ -337,10 +337,10 @@ discard block |
||
337 | 337 | */ |
338 | 338 | public function get_donor_query() { |
339 | 339 | $paged = $this->get_paged(); |
340 | - $offset = $this->per_page * ( $paged - 1 ); |
|
340 | + $offset = $this->per_page * ($paged - 1); |
|
341 | 341 | $search = $this->get_search(); |
342 | - $order = isset( $_GET['order'] ) ? sanitize_text_field( $_GET['order'] ) : 'DESC'; |
|
343 | - $orderby = isset( $_GET['orderby'] ) ? sanitize_text_field( $_GET['orderby'] ) : 'id'; |
|
342 | + $order = isset($_GET['order']) ? sanitize_text_field($_GET['order']) : 'DESC'; |
|
343 | + $orderby = isset($_GET['orderby']) ? sanitize_text_field($_GET['orderby']) : 'id'; |
|
344 | 344 | |
345 | 345 | $args = array( |
346 | 346 | 'number' => $this->per_page, |
@@ -349,10 +349,10 @@ discard block |
||
349 | 349 | 'orderby' => $orderby, |
350 | 350 | ); |
351 | 351 | |
352 | - if( $search ) { |
|
353 | - if ( is_email( $search ) ) { |
|
352 | + if ($search) { |
|
353 | + if (is_email($search)) { |
|
354 | 354 | $args['email'] = $search; |
355 | - } elseif ( is_numeric( $search ) ) { |
|
355 | + } elseif (is_numeric($search)) { |
|
356 | 356 | $args['id'] = $search; |
357 | 357 | } else { |
358 | 358 | $args['name'] = $search; |
@@ -379,16 +379,16 @@ discard block |
||
379 | 379 | $hidden = array(); // No hidden columns |
380 | 380 | $sortable = $this->get_sortable_columns(); |
381 | 381 | |
382 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
382 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
383 | 383 | |
384 | 384 | $this->items = $this->reports_data(); |
385 | 385 | |
386 | 386 | $this->total = $this->get_donor_count(); |
387 | 387 | |
388 | - $this->set_pagination_args( array( |
|
388 | + $this->set_pagination_args(array( |
|
389 | 389 | 'total_items' => $this->total, |
390 | 390 | 'per_page' => $this->per_page, |
391 | - 'total_pages' => ceil( $this->total / $this->per_page ), |
|
392 | - ) ); |
|
391 | + 'total_pages' => ceil($this->total / $this->per_page), |
|
392 | + )); |
|
393 | 393 | } |
394 | 394 | } |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Gateways_Report' ) ) : |
|
16 | +if ( ! class_exists('Give_Gateways_Report')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Gateways_Report. |
@@ -43,16 +43,16 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function __construct() { |
45 | 45 | $this->id = 'gateways'; |
46 | - $this->label = esc_html__( 'Donation Methods', 'give' ); |
|
46 | + $this->label = esc_html__('Donation Methods', 'give'); |
|
47 | 47 | |
48 | - add_filter( 'give-reports_tabs_array', array( $this, 'add_settings_page' ), 20 ); |
|
49 | - add_action( "give-reports_settings_{$this->id}_page", array( $this, 'output' ) ); |
|
50 | - add_action( 'give_admin_field_report_gateways', array( $this, 'render_report_gateways_field' ), 10, 2 ); |
|
48 | + add_filter('give-reports_tabs_array', array($this, 'add_settings_page'), 20); |
|
49 | + add_action("give-reports_settings_{$this->id}_page", array($this, 'output')); |
|
50 | + add_action('give_admin_field_report_gateways', array($this, 'render_report_gateways_field'), 10, 2); |
|
51 | 51 | |
52 | 52 | // Do not use main form for this tab. |
53 | - if( give_get_current_setting_tab() === $this->id ) { |
|
54 | - add_action( 'give-reports_open_form', '__return_empty_string' ); |
|
55 | - add_action( 'give-reports_close_form', '__return_empty_string' ); |
|
53 | + if (give_get_current_setting_tab() === $this->id) { |
|
54 | + add_action('give-reports_open_form', '__return_empty_string'); |
|
55 | + add_action('give-reports_close_form', '__return_empty_string'); |
|
56 | 56 | } |
57 | 57 | } |
58 | 58 | |
@@ -63,8 +63,8 @@ discard block |
||
63 | 63 | * @param array $pages Lst of pages. |
64 | 64 | * @return array |
65 | 65 | */ |
66 | - public function add_settings_page( $pages ) { |
|
67 | - $pages[ $this->id ] = $this->label; |
|
66 | + public function add_settings_page($pages) { |
|
67 | + $pages[$this->id] = $this->label; |
|
68 | 68 | |
69 | 69 | return $pages; |
70 | 70 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * @param array $settings |
87 | 87 | */ |
88 | 88 | $settings = apply_filters( |
89 | - 'give_get_settings_' . $this->id, |
|
89 | + 'give_get_settings_'.$this->id, |
|
90 | 90 | array( |
91 | 91 | array( |
92 | 92 | 'id' => 'give_reports_gateways', |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | ), |
96 | 96 | array( |
97 | 97 | 'id' => 'gateways', |
98 | - 'name' => esc_html__( 'Gateways', 'give' ), |
|
98 | + 'name' => esc_html__('Gateways', 'give'), |
|
99 | 99 | 'type' => 'report_gateways', |
100 | 100 | ), |
101 | 101 | array( |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | public function output() { |
120 | 120 | $settings = $this->get_settings(); |
121 | 121 | |
122 | - Give_Admin_Settings::output_fields( $settings, 'give_settings' ); |
|
122 | + Give_Admin_Settings::output_fields($settings, 'give_settings'); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | /** |
@@ -131,8 +131,8 @@ discard block |
||
131 | 131 | * @param $field |
132 | 132 | * @param $option_value |
133 | 133 | */ |
134 | - public function render_report_gateways_field( $field, $option_value ) { |
|
135 | - do_action( 'give_reports_view_gateways'); |
|
134 | + public function render_report_gateways_field($field, $option_value) { |
|
135 | + do_action('give_reports_view_gateways'); |
|
136 | 136 | } |
137 | 137 | } |
138 | 138 |