@@ -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,55 +40,55 @@ 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 | |
45 | - $post_offline_customization_option = get_post_meta( $form_id, '_give_customize_offline_donations', true ); |
|
46 | - $post_offline_instructions = get_post_meta( $form_id, '_give_offline_checkout_notes', true ); |
|
47 | - $global_offline_instruction = give_get_option( 'global_offline_donation_content' ); |
|
45 | + $post_offline_customization_option = get_post_meta($form_id, '_give_customize_offline_donations', true); |
|
46 | + $post_offline_instructions = get_post_meta($form_id, '_give_offline_checkout_notes', true); |
|
47 | + $global_offline_instruction = give_get_option('global_offline_donation_content'); |
|
48 | 48 | $offline_instructions = $global_offline_instruction; |
49 | 49 | |
50 | - if ( $post_offline_customization_option == 'yes' ) { |
|
50 | + if ($post_offline_customization_option == 'yes') { |
|
51 | 51 | $offline_instructions = $post_offline_instructions; |
52 | 52 | } |
53 | 53 | |
54 | 54 | |
55 | 55 | ob_start(); ?> |
56 | - <?php do_action( 'give_before_offline_info_fields', $form_id ); ?> |
|
56 | + <?php do_action('give_before_offline_info_fields', $form_id); ?> |
|
57 | 57 | <fieldset id="give_offline_payment_info"> |
58 | 58 | <?php |
59 | - $settings_url = admin_url( 'post.php?post=' . $form_id . '&action=edit&message=1' ); |
|
60 | - $offline_instructions = ! empty( $offline_instructions ) ? $offline_instructions : sprintf( esc_attr__( 'Please enter offline donation instructions in the %s.', 'give' ), '<a href="' . $settings_url . '">' . __( 'this form\'s settings', 'give' ) . '</a>' ); |
|
61 | - echo wpautop( stripslashes( $offline_instructions ) ); |
|
59 | + $settings_url = admin_url('post.php?post='.$form_id.'&action=edit&message=1'); |
|
60 | + $offline_instructions = ! empty($offline_instructions) ? $offline_instructions : sprintf(esc_attr__('Please enter offline donation instructions in the %s.', 'give'), '<a href="'.$settings_url.'">'.__('this form\'s settings', 'give').'</a>'); |
|
61 | + echo wpautop(stripslashes($offline_instructions)); |
|
62 | 62 | ?> |
63 | 63 | </fieldset> |
64 | - <?php do_action( 'give_after_offline_info_fields', $form_id ); ?> |
|
64 | + <?php do_action('give_after_offline_info_fields', $form_id); ?> |
|
65 | 65 | <?php |
66 | 66 | echo ob_get_clean(); |
67 | 67 | } |
68 | 68 | |
69 | -add_action( 'give_offline_cc_form', 'give_offline_payment_cc_form' ); |
|
69 | +add_action('give_offline_cc_form', 'give_offline_payment_cc_form'); |
|
70 | 70 | |
71 | 71 | /** |
72 | 72 | * Give Offline Billing Field |
73 | 73 | * |
74 | 74 | * @param $form_id |
75 | 75 | */ |
76 | -function give_offline_billing_fields( $form_id ) { |
|
76 | +function give_offline_billing_fields($form_id) { |
|
77 | 77 | //Enable Default CC fields (billing info) |
78 | - $post_offline_cc_fields = get_post_meta( $form_id, '_give_offline_donation_enable_billing_fields_single', true ); |
|
79 | - $post_offline_customize_option = get_post_meta( $form_id, '_give_customize_offline_donations', true ); |
|
78 | + $post_offline_cc_fields = get_post_meta($form_id, '_give_offline_donation_enable_billing_fields_single', true); |
|
79 | + $post_offline_customize_option = get_post_meta($form_id, '_give_customize_offline_donations', true); |
|
80 | 80 | |
81 | - $global_offline_cc_fields = give_get_option( 'give_offline_donation_enable_billing_fields' ); |
|
81 | + $global_offline_cc_fields = give_get_option('give_offline_donation_enable_billing_fields'); |
|
82 | 82 | |
83 | 83 | //Output CC Address fields if global option is on and user hasn't elected to customize this form's offline donation options |
84 | - if ( $global_offline_cc_fields == 'on' && $post_offline_customize_option !== 'yes' ) { |
|
85 | - give_default_cc_address_fields( $form_id ); |
|
86 | - } elseif($post_offline_customize_option == 'yes' && $post_offline_cc_fields == 'on') { |
|
87 | - give_default_cc_address_fields( $form_id ); |
|
84 | + if ($global_offline_cc_fields == 'on' && $post_offline_customize_option !== 'yes') { |
|
85 | + give_default_cc_address_fields($form_id); |
|
86 | + } elseif ($post_offline_customize_option == 'yes' && $post_offline_cc_fields == 'on') { |
|
87 | + give_default_cc_address_fields($form_id); |
|
88 | 88 | } |
89 | 89 | } |
90 | 90 | |
91 | -add_action( 'give_before_offline_info_fields', 'give_offline_billing_fields', 10, 1 ); |
|
91 | +add_action('give_before_offline_info_fields', 'give_offline_billing_fields', 10, 1); |
|
92 | 92 | |
93 | 93 | /** |
94 | 94 | * Process the payment |
@@ -99,16 +99,16 @@ discard block |
||
99 | 99 | * |
100 | 100 | * @return void |
101 | 101 | */ |
102 | -function give_offline_process_payment( $purchase_data ) { |
|
102 | +function give_offline_process_payment($purchase_data) { |
|
103 | 103 | |
104 | - $purchase_summary = give_get_purchase_summary( $purchase_data ); |
|
104 | + $purchase_summary = give_get_purchase_summary($purchase_data); |
|
105 | 105 | |
106 | 106 | // setup the payment details |
107 | 107 | $payment_data = array( |
108 | 108 | 'price' => $purchase_data['price'], |
109 | 109 | 'give_form_title' => $purchase_data['post_data']['give-form-title'], |
110 | - 'give_form_id' => intval( $purchase_data['post_data']['give-form-id'] ), |
|
111 | - 'give_price_id' => isset( $purchase_data['post_data']['give-price-id'] ) ? $purchase_data['post_data']['give-price-id'] : '', |
|
110 | + 'give_form_id' => intval($purchase_data['post_data']['give-form-id']), |
|
111 | + 'give_price_id' => isset($purchase_data['post_data']['give-price-id']) ? $purchase_data['post_data']['give-price-id'] : '', |
|
112 | 112 | 'date' => $purchase_data['date'], |
113 | 113 | 'user_email' => $purchase_data['user_email'], |
114 | 114 | 'purchase_key' => $purchase_data['purchase_key'], |
@@ -120,20 +120,20 @@ discard block |
||
120 | 120 | |
121 | 121 | |
122 | 122 | // record the pending payment |
123 | - $payment = give_insert_payment( $payment_data ); |
|
123 | + $payment = give_insert_payment($payment_data); |
|
124 | 124 | |
125 | - if ( $payment ) { |
|
126 | - give_offline_send_admin_notice( $payment ); |
|
127 | - give_offline_send_donor_instructions( $payment ); |
|
125 | + if ($payment) { |
|
126 | + give_offline_send_admin_notice($payment); |
|
127 | + give_offline_send_donor_instructions($payment); |
|
128 | 128 | give_send_to_success_page(); |
129 | 129 | } else { |
130 | 130 | // if errors are present, send the user back to the donation form so they can be corrected |
131 | - give_send_back_to_checkout( '?payment-mode=' . $purchase_data['post_data']['give-gateway'] ); |
|
131 | + give_send_back_to_checkout('?payment-mode='.$purchase_data['post_data']['give-gateway']); |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | } |
135 | 135 | |
136 | -add_action( 'give_gateway_offline', 'give_offline_process_payment' ); |
|
136 | +add_action('give_gateway_offline', 'give_offline_process_payment'); |
|
137 | 137 | |
138 | 138 | |
139 | 139 | /** |
@@ -146,47 +146,47 @@ discard block |
||
146 | 146 | * @since 1.0 |
147 | 147 | * @return void |
148 | 148 | */ |
149 | -function give_offline_send_donor_instructions( $payment_id = 0 ) { |
|
149 | +function give_offline_send_donor_instructions($payment_id = 0) { |
|
150 | 150 | |
151 | - $payment_data = give_get_payment_meta( $payment_id ); |
|
152 | - $post_offline_customization_option = get_post_meta( $payment_data['form_id'], '_give_customize_offline_donations', true ); |
|
151 | + $payment_data = give_get_payment_meta($payment_id); |
|
152 | + $post_offline_customization_option = get_post_meta($payment_data['form_id'], '_give_customize_offline_donations', true); |
|
153 | 153 | |
154 | 154 | //Customize email content depending on whether the single form has been customized |
155 | - $email_content = give_get_option( 'global_offline_donation_email' ); |
|
155 | + $email_content = give_get_option('global_offline_donation_email'); |
|
156 | 156 | |
157 | - if ( $post_offline_customization_option === 'yes' ) { |
|
158 | - $email_content = get_post_meta( $payment_data['form_id'], '_give_offline_donation_email', true ); |
|
157 | + if ($post_offline_customization_option === 'yes') { |
|
158 | + $email_content = get_post_meta($payment_data['form_id'], '_give_offline_donation_email', true); |
|
159 | 159 | } |
160 | 160 | |
161 | - $from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ); |
|
162 | - $from_name = apply_filters( 'give_purchase_from_name', $from_name, $payment_id, $payment_data ); |
|
161 | + $from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)); |
|
162 | + $from_name = apply_filters('give_purchase_from_name', $from_name, $payment_id, $payment_data); |
|
163 | 163 | |
164 | - $from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) ); |
|
165 | - $from_email = apply_filters( 'give_purchase_from_address', $from_email, $payment_id, $payment_data ); |
|
164 | + $from_email = give_get_option('from_email', get_bloginfo('admin_email')); |
|
165 | + $from_email = apply_filters('give_purchase_from_address', $from_email, $payment_id, $payment_data); |
|
166 | 166 | |
167 | - $to_email = give_get_payment_user_email( $payment_id ); |
|
167 | + $to_email = give_get_payment_user_email($payment_id); |
|
168 | 168 | |
169 | - $subject = give_get_option( 'offline_donation_subject', __( 'Offline Donation Instructions', 'give' ) ); |
|
170 | - if ( $post_offline_customization_option === 'yes' ) { |
|
171 | - $subject = get_post_meta( $payment_data['form_id'], '_give_offline_donation_subject', true ); |
|
169 | + $subject = give_get_option('offline_donation_subject', __('Offline Donation Instructions', 'give')); |
|
170 | + if ($post_offline_customization_option === 'yes') { |
|
171 | + $subject = get_post_meta($payment_data['form_id'], '_give_offline_donation_subject', true); |
|
172 | 172 | } |
173 | 173 | |
174 | - $subject = apply_filters( 'give_offline_donation_subject', wp_strip_all_tags( $subject ), $payment_id ); |
|
175 | - $subject = give_do_email_tags( $subject, $payment_id ); |
|
174 | + $subject = apply_filters('give_offline_donation_subject', wp_strip_all_tags($subject), $payment_id); |
|
175 | + $subject = give_do_email_tags($subject, $payment_id); |
|
176 | 176 | |
177 | - $attachments = apply_filters( 'give_offline_donation_attachments', array(), $payment_id, $payment_data ); |
|
178 | - $message = give_do_email_tags( $email_content, $payment_id ); |
|
177 | + $attachments = apply_filters('give_offline_donation_attachments', array(), $payment_id, $payment_data); |
|
178 | + $message = give_do_email_tags($email_content, $payment_id); |
|
179 | 179 | |
180 | 180 | $emails = Give()->emails; |
181 | 181 | |
182 | - $emails->__set( 'from_name', $from_name ); |
|
183 | - $emails->__set( 'from_email', $from_email ); |
|
184 | - $emails->__set( 'heading', __( 'Offline Donation Instructions', 'give' ) ); |
|
182 | + $emails->__set('from_name', $from_name); |
|
183 | + $emails->__set('from_email', $from_email); |
|
184 | + $emails->__set('heading', __('Offline Donation Instructions', 'give')); |
|
185 | 185 | |
186 | - $headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data ); |
|
187 | - $emails->__set( 'headers', $headers ); |
|
186 | + $headers = apply_filters('give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data); |
|
187 | + $emails->__set('headers', $headers); |
|
188 | 188 | |
189 | - $emails->send( $to_email, $subject, $message, $attachments ); |
|
189 | + $emails->send($to_email, $subject, $message, $attachments); |
|
190 | 190 | |
191 | 191 | } |
192 | 192 | |
@@ -203,50 +203,50 @@ discard block |
||
203 | 203 | * @return void |
204 | 204 | * |
205 | 205 | */ |
206 | -function give_offline_send_admin_notice( $payment_id = 0 ) { |
|
206 | +function give_offline_send_admin_notice($payment_id = 0) { |
|
207 | 207 | |
208 | 208 | /* Send an email notification to the admin */ |
209 | 209 | $admin_email = give_get_admin_notice_emails(); |
210 | - $user_info = give_get_payment_meta_user_info( $payment_id ); |
|
210 | + $user_info = give_get_payment_meta_user_info($payment_id); |
|
211 | 211 | |
212 | - if ( isset( $user_info['id'] ) && $user_info['id'] > 0 ) { |
|
213 | - $user_data = get_userdata( $user_info['id'] ); |
|
212 | + if (isset($user_info['id']) && $user_info['id'] > 0) { |
|
213 | + $user_data = get_userdata($user_info['id']); |
|
214 | 214 | $name = $user_data->display_name; |
215 | - } elseif ( isset( $user_info['first_name'] ) && isset( $user_info['last_name'] ) ) { |
|
216 | - $name = $user_info['first_name'] . ' ' . $user_info['last_name']; |
|
215 | + } elseif (isset($user_info['first_name']) && isset($user_info['last_name'])) { |
|
216 | + $name = $user_info['first_name'].' '.$user_info['last_name']; |
|
217 | 217 | } else { |
218 | 218 | $name = $user_info['email']; |
219 | 219 | } |
220 | 220 | |
221 | - $amount = give_currency_filter( give_format_amount( give_get_payment_amount( $payment_id ) ) ); |
|
221 | + $amount = give_currency_filter(give_format_amount(give_get_payment_amount($payment_id))); |
|
222 | 222 | |
223 | - $admin_subject = apply_filters( 'give_offline_admin_donation_notification_subject', esc_attr__( 'New Pending Donation', 'give' ), $payment_id ); |
|
223 | + $admin_subject = apply_filters('give_offline_admin_donation_notification_subject', esc_attr__('New Pending Donation', 'give'), $payment_id); |
|
224 | 224 | |
225 | - $admin_message = esc_attr__( 'Dear Admin,', 'give' ) . "\n\n"; |
|
226 | - $admin_message .= esc_attr__( 'An offline donation has been made on your website: ', 'give' ) . get_bloginfo( 'name' ) . ' '; |
|
227 | - $admin_message .= esc_attr__( 'Hooray! 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"; |
|
225 | + $admin_message = esc_attr__('Dear Admin,', 'give')."\n\n"; |
|
226 | + $admin_message .= esc_attr__('An offline donation has been made on your website: ', 'give').get_bloginfo('name').' '; |
|
227 | + $admin_message .= esc_attr__('Hooray! 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"; |
|
228 | 228 | |
229 | 229 | |
230 | - $admin_message .= '<strong>' . esc_attr__( 'Donor: ', 'give' ) . '</strong>' . html_entity_decode( $name, ENT_COMPAT, 'UTF-8' ) . "\n"; |
|
231 | - $admin_message .= '<strong>' . esc_attr__( 'Amount: ', 'give' ) . '</strong>' . html_entity_decode( $amount, ENT_COMPAT, 'UTF-8' ) . "\n\n"; |
|
230 | + $admin_message .= '<strong>'.esc_attr__('Donor: ', 'give').'</strong>'.html_entity_decode($name, ENT_COMPAT, 'UTF-8')."\n"; |
|
231 | + $admin_message .= '<strong>'.esc_attr__('Amount: ', 'give').'</strong>'.html_entity_decode($amount, ENT_COMPAT, 'UTF-8')."\n\n"; |
|
232 | 232 | |
233 | 233 | $admin_message .= sprintf( |
234 | 234 | '<a href="%1$s">%2$s</a>', |
235 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $payment_id ), |
|
236 | - __( 'Click Here to View and/or Update Donation Details', 'give' ) |
|
237 | - ) . "\n\n"; |
|
235 | + admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id='.$payment_id), |
|
236 | + __('Click Here to View and/or Update Donation Details', 'give') |
|
237 | + )."\n\n"; |
|
238 | 238 | |
239 | - $admin_message = apply_filters( 'give_offline_admin_donation_notification', $admin_message, $payment_id ); |
|
240 | - $attachments = apply_filters( 'give_offline_admin_donation_notification_attachments', array(), $payment_id ); |
|
241 | - $admin_headers = apply_filters( 'give_offline_admin_donation_notification_headers', array(), $payment_id ); |
|
239 | + $admin_message = apply_filters('give_offline_admin_donation_notification', $admin_message, $payment_id); |
|
240 | + $attachments = apply_filters('give_offline_admin_donation_notification_attachments', array(), $payment_id); |
|
241 | + $admin_headers = apply_filters('give_offline_admin_donation_notification_headers', array(), $payment_id); |
|
242 | 242 | |
243 | 243 | //Send Email |
244 | 244 | $emails = Give()->emails; |
245 | - if ( ! empty( $admin_headers ) ) { |
|
246 | - $emails->__set( 'headers', $admin_headers ); |
|
245 | + if ( ! empty($admin_headers)) { |
|
246 | + $emails->__set('headers', $admin_headers); |
|
247 | 247 | } |
248 | 248 | |
249 | - $emails->send( $admin_email, $admin_subject, $admin_message, $attachments ); |
|
249 | + $emails->send($admin_email, $admin_subject, $admin_message, $attachments); |
|
250 | 250 | |
251 | 251 | } |
252 | 252 | |
@@ -257,15 +257,15 @@ discard block |
||
257 | 257 | * @since 1.0 |
258 | 258 | * @return array |
259 | 259 | */ |
260 | -function give_offline_add_settings( $settings ) { |
|
260 | +function give_offline_add_settings($settings) { |
|
261 | 261 | |
262 | 262 | //Vars |
263 | 263 | $prefix = '_give_'; |
264 | 264 | |
265 | - $is_gateway_active = give_is_gateway_active( 'offline' ); |
|
265 | + $is_gateway_active = give_is_gateway_active('offline'); |
|
266 | 266 | |
267 | 267 | //this gateway isn't active |
268 | - if ( ! $is_gateway_active ) { |
|
268 | + if ( ! $is_gateway_active) { |
|
269 | 269 | //return settings and bounce |
270 | 270 | return $settings; |
271 | 271 | } |
@@ -274,27 +274,27 @@ discard block |
||
274 | 274 | $check_settings = array( |
275 | 275 | |
276 | 276 | array( |
277 | - 'name' => esc_attr__( 'Customize Offline Donations', 'give' ), |
|
278 | - 'desc' => esc_attr__( 'If you would like to customize the donation instructions for this specific forms check this option.', 'give' ), |
|
279 | - 'id' => $prefix . 'customize_offline_donations', |
|
277 | + 'name' => esc_attr__('Customize Offline Donations', 'give'), |
|
278 | + 'desc' => esc_attr__('If you would like to customize the donation instructions for this specific forms check this option.', 'give'), |
|
279 | + 'id' => $prefix.'customize_offline_donations', |
|
280 | 280 | 'type' => 'radio_inline', |
281 | 281 | 'default' => 'no', |
282 | 282 | 'options' => array( |
283 | - 'yes' => esc_attr__( 'Yes', 'give' ), |
|
284 | - 'no' => esc_attr__( 'No', 'give' ), |
|
283 | + 'yes' => esc_attr__('Yes', 'give'), |
|
284 | + 'no' => esc_attr__('No', 'give'), |
|
285 | 285 | ), |
286 | 286 | ), |
287 | 287 | array( |
288 | - 'name' => esc_attr__( 'Request Billing Information', 'give' ), |
|
289 | - 'desc' => esc_attr__( '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' ), |
|
290 | - 'id' => $prefix . 'offline_donation_enable_billing_fields_single', |
|
288 | + 'name' => esc_attr__('Request Billing Information', 'give'), |
|
289 | + 'desc' => esc_attr__('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'), |
|
290 | + 'id' => $prefix.'offline_donation_enable_billing_fields_single', |
|
291 | 291 | 'row_classes' => 'give-subfield', |
292 | 292 | 'type' => 'checkbox' |
293 | 293 | ), |
294 | 294 | array( |
295 | - 'id' => $prefix . 'offline_checkout_notes', |
|
296 | - 'name' => esc_attr__( 'Offline Donation Instructions', 'give' ), |
|
297 | - 'desc' => esc_attr__( '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' ), |
|
295 | + 'id' => $prefix.'offline_checkout_notes', |
|
296 | + 'name' => esc_attr__('Offline Donation Instructions', 'give'), |
|
297 | + 'desc' => esc_attr__('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'), |
|
298 | 298 | 'default' => give_get_default_offline_donation_content(), |
299 | 299 | 'type' => 'wysiwyg', |
300 | 300 | 'row_classes' => 'give-subfield', |
@@ -303,17 +303,17 @@ discard block |
||
303 | 303 | ) |
304 | 304 | ), |
305 | 305 | array( |
306 | - 'id' => $prefix . 'offline_donation_subject', |
|
307 | - 'name' => esc_attr__( 'Offline Donation Email Instructions Subject', 'give' ), |
|
308 | - 'desc' => esc_attr__( 'Enter the subject line for the donation receipt email.', 'give' ), |
|
309 | - 'default' => esc_attr__( '{donation} - Offline Donation Instructions', 'give' ), |
|
306 | + 'id' => $prefix.'offline_donation_subject', |
|
307 | + 'name' => esc_attr__('Offline Donation Email Instructions Subject', 'give'), |
|
308 | + 'desc' => esc_attr__('Enter the subject line for the donation receipt email.', 'give'), |
|
309 | + 'default' => esc_attr__('{donation} - Offline Donation Instructions', 'give'), |
|
310 | 310 | 'row_classes' => 'give-subfield', |
311 | 311 | 'type' => 'text' |
312 | 312 | ), |
313 | 313 | array( |
314 | - 'id' => $prefix . 'offline_donation_email', |
|
315 | - 'name' => esc_attr__( 'Offline Donation Email Instructions', 'give' ), |
|
316 | - 'desc' => esc_attr__( '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' ), |
|
314 | + 'id' => $prefix.'offline_donation_email', |
|
315 | + 'name' => esc_attr__('Offline Donation Email Instructions', 'give'), |
|
316 | + 'desc' => esc_attr__('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'), |
|
317 | 317 | 'default' => give_get_default_offline_donation_email_content(), |
318 | 318 | 'type' => 'wysiwyg', |
319 | 319 | 'row_classes' => 'give-subfield', |
@@ -323,10 +323,10 @@ discard block |
||
323 | 323 | ) |
324 | 324 | ); |
325 | 325 | |
326 | - return array_merge( $settings, $check_settings ); |
|
326 | + return array_merge($settings, $check_settings); |
|
327 | 327 | } |
328 | 328 | |
329 | -add_filter( 'give_forms_display_options_metabox_fields', 'give_offline_add_settings' ); |
|
329 | +add_filter('give_forms_display_options_metabox_fields', 'give_offline_add_settings'); |
|
330 | 330 | |
331 | 331 | |
332 | 332 | /** |
@@ -338,20 +338,20 @@ discard block |
||
338 | 338 | */ |
339 | 339 | function give_get_default_offline_donation_content() { |
340 | 340 | |
341 | - $sitename = get_bloginfo( 'sitename' ); |
|
341 | + $sitename = get_bloginfo('sitename'); |
|
342 | 342 | |
343 | - $default_text = '<p>' . esc_attr__( 'In order to make an offline donation we ask that you please follow these instructions', 'give' ) . ': </p>'; |
|
343 | + $default_text = '<p>'.esc_attr__('In order to make an offline donation we ask that you please follow these instructions', 'give').': </p>'; |
|
344 | 344 | $default_text .= '<ol>'; |
345 | - $default_text .= '<li>' . sprintf( __( 'Make a check payable to "%s"', 'give' ), $sitename ) . '</li>'; |
|
346 | - $default_text .= '<li>' . sprintf( __( 'On the memo line of the check, please indicate that the donation is for "%s"', 'give' ), $sitename ) . '</li>'; |
|
347 | - $default_text .= '<li>' . __( 'Please mail your check to:', 'give' ) . '</li>'; |
|
345 | + $default_text .= '<li>'.sprintf(__('Make a check payable to "%s"', 'give'), $sitename).'</li>'; |
|
346 | + $default_text .= '<li>'.sprintf(__('On the memo line of the check, please indicate that the donation is for "%s"', 'give'), $sitename).'</li>'; |
|
347 | + $default_text .= '<li>'.__('Please mail your check to:', 'give').'</li>'; |
|
348 | 348 | $default_text .= '</ol>'; |
349 | - $default_text .= ' <em>' . $sitename . '</em><br>'; |
|
349 | + $default_text .= ' <em>'.$sitename.'</em><br>'; |
|
350 | 350 | $default_text .= ' <em>123 G Street </em><br>'; |
351 | 351 | $default_text .= ' <em>San Diego, CA 92101 </em><br>'; |
352 | - $default_text .= '<p>' . esc_attr__( 'All contributions will be gratefully acknowledged and are tax deductible.', 'give' ) . '</p>'; |
|
352 | + $default_text .= '<p>'.esc_attr__('All contributions will be gratefully acknowledged and are tax deductible.', 'give').'</p>'; |
|
353 | 353 | |
354 | - return apply_filters( 'give_default_offline_donation_content', $default_text ); |
|
354 | + return apply_filters('give_default_offline_donation_content', $default_text); |
|
355 | 355 | |
356 | 356 | } |
357 | 357 | |
@@ -364,21 +364,21 @@ discard block |
||
364 | 364 | */ |
365 | 365 | function give_get_default_offline_donation_email_content() { |
366 | 366 | |
367 | - $sitename = get_bloginfo( 'sitename' ); |
|
368 | - $default_text = '<p>' . esc_attr__( 'Dear {name},', 'give' ) . '</p>'; |
|
369 | - $default_text .= '<p>' . esc_attr__( '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>'; |
|
367 | + $sitename = get_bloginfo('sitename'); |
|
368 | + $default_text = '<p>'.esc_attr__('Dear {name},', 'give').'</p>'; |
|
369 | + $default_text .= '<p>'.esc_attr__('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>'; |
|
370 | 370 | $default_text .= '<ol>'; |
371 | - $default_text .= '<li>' . sprintf( __( 'Make a check payable to "%s"', 'give' ), $sitename ) . '</li>'; |
|
372 | - $default_text .= '<li>' . sprintf( __( 'On the memo line of the check, please indicate that the donation is for "%s"', 'give' ), $sitename ) . '</li>'; |
|
373 | - $default_text .= '<li>' . __( 'Please mail your check to:', 'give' ) . '</li>'; |
|
371 | + $default_text .= '<li>'.sprintf(__('Make a check payable to "%s"', 'give'), $sitename).'</li>'; |
|
372 | + $default_text .= '<li>'.sprintf(__('On the memo line of the check, please indicate that the donation is for "%s"', 'give'), $sitename).'</li>'; |
|
373 | + $default_text .= '<li>'.__('Please mail your check to:', 'give').'</li>'; |
|
374 | 374 | $default_text .= '</ol>'; |
375 | - $default_text .= ' <em>' . $sitename . '</em><br>'; |
|
375 | + $default_text .= ' <em>'.$sitename.'</em><br>'; |
|
376 | 376 | $default_text .= ' <em>123 G Street </em><br>'; |
377 | 377 | $default_text .= ' <em>San Diego, CA 92101 </em><br>'; |
378 | - $default_text .= '<p>' . esc_attr__( '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>'; |
|
379 | - $default_text .= '<p>' . esc_attr__( 'Sincerely,', 'give' ) . '</p>'; |
|
380 | - $default_text .= '<p>' . $sitename . '</p>'; |
|
378 | + $default_text .= '<p>'.esc_attr__('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>'; |
|
379 | + $default_text .= '<p>'.esc_attr__('Sincerely,', 'give').'</p>'; |
|
380 | + $default_text .= '<p>'.$sitename.'</p>'; |
|
381 | 381 | |
382 | - return apply_filters( 'give_default_offline_donation_content', $default_text ); |
|
382 | + return apply_filters('give_default_offline_donation_content', $default_text); |
|
383 | 383 | |
384 | 384 | } |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | */ |
17 | 17 | |
18 | 18 | // Exit if accessed directly |
19 | -if ( ! defined( 'ABSPATH' ) ) { |
|
19 | +if ( ! defined('ABSPATH')) { |
|
20 | 20 | exit; |
21 | 21 | } |
22 | 22 | |
@@ -29,36 +29,36 @@ discard block |
||
29 | 29 | * @return void |
30 | 30 | */ |
31 | 31 | function give_reports_page() { |
32 | - $current_page = admin_url( 'edit.php?post_type=give_forms&page=give-reports' ); |
|
33 | - $active_tab = isset( $_GET['tab'] ) ? $_GET['tab'] : 'reports'; |
|
32 | + $current_page = admin_url('edit.php?post_type=give_forms&page=give-reports'); |
|
33 | + $active_tab = isset($_GET['tab']) ? $_GET['tab'] : 'reports'; |
|
34 | 34 | ?> |
35 | 35 | <div class="wrap"> |
36 | 36 | <h1 class="nav-tab-wrapper"> |
37 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
37 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
38 | 38 | 'tab' => 'reports', |
39 | 39 | 'settings-updated' => false |
40 | - ), $current_page ) ); ?>" class="nav-tab <?php echo $active_tab == 'reports' ? 'nav-tab-active' : ''; ?>"><?php _e( 'Reports', 'give' ); ?></a> |
|
41 | - <?php if ( current_user_can( 'export_give_reports' ) ) { ?> |
|
42 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
40 | + ), $current_page)); ?>" class="nav-tab <?php echo $active_tab == 'reports' ? 'nav-tab-active' : ''; ?>"><?php _e('Reports', 'give'); ?></a> |
|
41 | + <?php if (current_user_can('export_give_reports')) { ?> |
|
42 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
43 | 43 | 'tab' => 'export', |
44 | 44 | 'settings-updated' => false |
45 | - ), $current_page ) ); ?>" class="nav-tab <?php echo $active_tab == 'export' ? 'nav-tab-active' : ''; ?>"><?php _e( 'Export', 'give' ); ?></a> |
|
45 | + ), $current_page)); ?>" class="nav-tab <?php echo $active_tab == 'export' ? 'nav-tab-active' : ''; ?>"><?php _e('Export', 'give'); ?></a> |
|
46 | 46 | <?php } ?> |
47 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
47 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
48 | 48 | 'tab' => 'logs', |
49 | 49 | 'settings-updated' => false |
50 | - ), $current_page ) ); ?>" class="nav-tab <?php echo $active_tab == 'logs' ? 'nav-tab-active' : ''; ?>"><?php _e( 'Logs', 'give' ); ?></a> |
|
51 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
50 | + ), $current_page)); ?>" class="nav-tab <?php echo $active_tab == 'logs' ? 'nav-tab-active' : ''; ?>"><?php _e('Logs', 'give'); ?></a> |
|
51 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
52 | 52 | 'tab' => 'tools', |
53 | 53 | 'settings-updated' => false |
54 | - ), $current_page ) ); ?>" class="nav-tab <?php echo $active_tab == 'tools' ? 'nav-tab-active' : ''; ?>"><?php _e( 'Tools', 'give' ); ?></a> |
|
55 | - <?php do_action( 'give_reports_tabs' ); ?> |
|
54 | + ), $current_page)); ?>" class="nav-tab <?php echo $active_tab == 'tools' ? 'nav-tab-active' : ''; ?>"><?php _e('Tools', 'give'); ?></a> |
|
55 | + <?php do_action('give_reports_tabs'); ?> |
|
56 | 56 | </h1> |
57 | 57 | |
58 | 58 | <?php |
59 | - do_action( 'give_reports_page_top' ); |
|
60 | - do_action( 'give_reports_tab_' . $active_tab ); |
|
61 | - do_action( 'give_reports_page_bottom' ); |
|
59 | + do_action('give_reports_page_top'); |
|
60 | + do_action('give_reports_tab_'.$active_tab); |
|
61 | + do_action('give_reports_page_bottom'); |
|
62 | 62 | ?> |
63 | 63 | </div><!-- .wrap --> |
64 | 64 | <?php |
@@ -72,13 +72,13 @@ discard block |
||
72 | 72 | */ |
73 | 73 | function give_reports_default_views() { |
74 | 74 | $views = array( |
75 | - 'earnings' => __( 'Income', 'give' ), |
|
75 | + 'earnings' => __('Income', 'give'), |
|
76 | 76 | 'forms' => give_get_forms_label_plural(), |
77 | - 'donors' => __( 'Donors', 'give' ), |
|
78 | - 'gateways' => __( 'Payment Methods', 'give' ) |
|
77 | + 'donors' => __('Donors', 'give'), |
|
78 | + 'gateways' => __('Payment Methods', 'give') |
|
79 | 79 | ); |
80 | 80 | |
81 | - $views = apply_filters( 'give_report_views', $views ); |
|
81 | + $views = apply_filters('give_report_views', $views); |
|
82 | 82 | |
83 | 83 | return $views; |
84 | 84 | } |
@@ -94,15 +94,15 @@ discard block |
||
94 | 94 | * @return string $view Report View |
95 | 95 | * |
96 | 96 | */ |
97 | -function give_get_reporting_view( $default = 'earnings' ) { |
|
97 | +function give_get_reporting_view($default = 'earnings') { |
|
98 | 98 | |
99 | - if ( ! isset( $_GET['view'] ) || ! in_array( $_GET['view'], array_keys( give_reports_default_views() ) ) ) { |
|
99 | + if ( ! isset($_GET['view']) || ! in_array($_GET['view'], array_keys(give_reports_default_views()))) { |
|
100 | 100 | $view = $default; |
101 | 101 | } else { |
102 | 102 | $view = $_GET['view']; |
103 | 103 | } |
104 | 104 | |
105 | - return apply_filters( 'give_get_reporting_view', $view ); |
|
105 | + return apply_filters('give_get_reporting_view', $view); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | /** |
@@ -115,14 +115,14 @@ discard block |
||
115 | 115 | $current_view = 'earnings'; |
116 | 116 | $views = give_reports_default_views(); |
117 | 117 | |
118 | - if ( isset( $_GET['view'] ) && array_key_exists( $_GET['view'], $views ) ) { |
|
118 | + if (isset($_GET['view']) && array_key_exists($_GET['view'], $views)) { |
|
119 | 119 | $current_view = $_GET['view']; |
120 | 120 | } |
121 | 121 | |
122 | - do_action( 'give_reports_view_' . $current_view ); |
|
122 | + do_action('give_reports_view_'.$current_view); |
|
123 | 123 | } |
124 | 124 | |
125 | -add_action( 'give_reports_tab_reports', 'give_reports_tab_reports' ); |
|
125 | +add_action('give_reports_tab_reports', 'give_reports_tab_reports'); |
|
126 | 126 | |
127 | 127 | /** |
128 | 128 | * Renders the Reports Page Views Drop Downs |
@@ -132,25 +132,25 @@ discard block |
||
132 | 132 | */ |
133 | 133 | function give_report_views() { |
134 | 134 | $views = give_reports_default_views(); |
135 | - $current_view = isset( $_GET['view'] ) ? $_GET['view'] : 'earnings'; |
|
136 | - do_action( 'give_report_view_actions_before' ); |
|
135 | + $current_view = isset($_GET['view']) ? $_GET['view'] : 'earnings'; |
|
136 | + do_action('give_report_view_actions_before'); |
|
137 | 137 | ?> |
138 | 138 | <form id="give-reports-filter" method="get"> |
139 | 139 | <select id="give-reports-view" name="view"> |
140 | - <option value="-1"><?php _e( 'Report Type', 'give' ); ?></option> |
|
141 | - <?php foreach ( $views as $view_id => $label ) : ?> |
|
142 | - <option value="<?php echo esc_attr( $view_id ); ?>" <?php selected( $view_id, $current_view ); ?>><?php echo $label; ?></option> |
|
140 | + <option value="-1"><?php _e('Report Type', 'give'); ?></option> |
|
141 | + <?php foreach ($views as $view_id => $label) : ?> |
|
142 | + <option value="<?php echo esc_attr($view_id); ?>" <?php selected($view_id, $current_view); ?>><?php echo $label; ?></option> |
|
143 | 143 | <?php endforeach; ?> |
144 | 144 | </select> |
145 | 145 | |
146 | - <?php do_action( 'give_report_view_actions' ); ?> |
|
146 | + <?php do_action('give_report_view_actions'); ?> |
|
147 | 147 | |
148 | 148 | <input type="hidden" name="post_type" value="give_forms"/> |
149 | 149 | <input type="hidden" name="page" value="give-reports"/> |
150 | - <?php submit_button( __( 'Show', 'give' ), 'secondary', 'submit', false ); ?> |
|
150 | + <?php submit_button(__('Show', 'give'), 'secondary', 'submit', false); ?> |
|
151 | 151 | </form> |
152 | 152 | <?php |
153 | - do_action( 'give_report_view_actions_after' ); |
|
153 | + do_action('give_report_view_actions_after'); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | /** |
@@ -163,18 +163,18 @@ discard block |
||
163 | 163 | */ |
164 | 164 | function give_reports_forms_table() { |
165 | 165 | |
166 | - if ( isset( $_GET['form-id'] ) ) { |
|
166 | + if (isset($_GET['form-id'])) { |
|
167 | 167 | return; |
168 | 168 | } |
169 | 169 | |
170 | - include( dirname( __FILE__ ) . '/class-form-reports-table.php' ); |
|
170 | + include(dirname(__FILE__).'/class-form-reports-table.php'); |
|
171 | 171 | |
172 | 172 | $give_table = new Give_Form_Reports_Table(); |
173 | 173 | $give_table->prepare_items(); |
174 | 174 | $give_table->display(); |
175 | 175 | } |
176 | 176 | |
177 | -add_action( 'give_reports_view_forms', 'give_reports_forms_table' ); |
|
177 | +add_action('give_reports_view_forms', 'give_reports_forms_table'); |
|
178 | 178 | |
179 | 179 | /** |
180 | 180 | * Renders the detailed report for a specific give form |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | * @return void |
184 | 184 | */ |
185 | 185 | function give_reports_form_details() { |
186 | - if ( ! isset( $_GET['form-id'] ) ) { |
|
186 | + if ( ! isset($_GET['form-id'])) { |
|
187 | 187 | return; |
188 | 188 | } |
189 | 189 | ?> |
@@ -191,14 +191,14 @@ discard block |
||
191 | 191 | <div class="actions bulkactions"> |
192 | 192 | <?php give_report_views(); ?> |
193 | 193 | |
194 | - <button onclick="history.go(-1);" class="button-secondary"><?php _e( 'Go Back', 'give' ); ?></button> |
|
194 | + <button onclick="history.go(-1);" class="button-secondary"><?php _e('Go Back', 'give'); ?></button> |
|
195 | 195 | </div> |
196 | 196 | </div> |
197 | 197 | <?php |
198 | - give_reports_graph_of_form( absint( $_GET['form-id'] ) ); |
|
198 | + give_reports_graph_of_form(absint($_GET['form-id'])); |
|
199 | 199 | } |
200 | 200 | |
201 | -add_action( 'give_reports_view_forms', 'give_reports_form_details' ); |
|
201 | +add_action('give_reports_view_forms', 'give_reports_form_details'); |
|
202 | 202 | |
203 | 203 | /** |
204 | 204 | * Renders the Reports Donors Table |
@@ -209,28 +209,28 @@ discard block |
||
209 | 209 | * @return void |
210 | 210 | */ |
211 | 211 | function give_reports_donors_table() { |
212 | - include( dirname( __FILE__ ) . '/class-donor-reports-table.php' ); |
|
212 | + include(dirname(__FILE__).'/class-donor-reports-table.php'); |
|
213 | 213 | |
214 | 214 | $give_table = new Give_Donor_Reports_Table(); |
215 | 215 | $give_table->prepare_items(); |
216 | 216 | ?> |
217 | 217 | <div class="wrap give-reports-donors-wrap"> |
218 | - <?php do_action( 'give_logs_donors_table_top' ); ?> |
|
219 | - <form id="give-donors-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-reports&view=donors' ); ?>"> |
|
218 | + <?php do_action('give_logs_donors_table_top'); ?> |
|
219 | + <form id="give-donors-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-reports&view=donors'); ?>"> |
|
220 | 220 | <?php |
221 | - $give_table->search_box( __( 'Search', 'give' ), 'give-donors' ); |
|
221 | + $give_table->search_box(__('Search', 'give'), 'give-donors'); |
|
222 | 222 | $give_table->display(); |
223 | 223 | ?> |
224 | 224 | <input type="hidden" name="post_type" value="give_forms"/> |
225 | 225 | <input type="hidden" name="page" value="give-reports"/> |
226 | 226 | <input type="hidden" name="view" value="donors"/> |
227 | 227 | </form> |
228 | - <?php do_action( 'give_logs_donors_table_bottom' ); ?> |
|
228 | + <?php do_action('give_logs_donors_table_bottom'); ?> |
|
229 | 229 | </div> |
230 | 230 | <?php |
231 | 231 | } |
232 | 232 | |
233 | -add_action( 'give_reports_view_donors', 'give_reports_donors_table' ); |
|
233 | +add_action('give_reports_view_donors', 'give_reports_donors_table'); |
|
234 | 234 | |
235 | 235 | |
236 | 236 | /** |
@@ -242,14 +242,14 @@ discard block |
||
242 | 242 | * @return void |
243 | 243 | */ |
244 | 244 | function give_reports_gateways_table() { |
245 | - include( dirname( __FILE__ ) . '/class-gateways-reports-table.php' ); |
|
245 | + include(dirname(__FILE__).'/class-gateways-reports-table.php'); |
|
246 | 246 | |
247 | 247 | $give_table = new Give_Gateawy_Reports_Table(); |
248 | 248 | $give_table->prepare_items(); |
249 | 249 | $give_table->display(); |
250 | 250 | } |
251 | 251 | |
252 | -add_action( 'give_reports_view_gateways', 'give_reports_gateways_table' ); |
|
252 | +add_action('give_reports_view_gateways', 'give_reports_gateways_table'); |
|
253 | 253 | |
254 | 254 | |
255 | 255 | /** |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | function give_reports_earnings() { |
262 | 262 | ?> |
263 | 263 | <div class="tablenav top reports-table-nav"> |
264 | - <h3 class="alignleft reports-earnings-title"><span><?php _e( 'Income Over Time', 'give' ); ?></span></h3> |
|
264 | + <h3 class="alignleft reports-earnings-title"><span><?php _e('Income Over Time', 'give'); ?></span></h3> |
|
265 | 265 | |
266 | 266 | <div class="alignright actions reports-views-wrap"><?php give_report_views(); ?></div> |
267 | 267 | </div> |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | give_reports_graph(); |
270 | 270 | } |
271 | 271 | |
272 | -add_action( 'give_reports_view_earnings', 'give_reports_earnings' ); |
|
272 | +add_action('give_reports_view_earnings', 'give_reports_earnings'); |
|
273 | 273 | |
274 | 274 | |
275 | 275 | /** |
@@ -284,52 +284,52 @@ discard block |
||
284 | 284 | <div id="post-body"> |
285 | 285 | <div id="post-body-content"> |
286 | 286 | |
287 | - <?php do_action( 'give_reports_tab_export_content_top' ); ?> |
|
287 | + <?php do_action('give_reports_tab_export_content_top'); ?> |
|
288 | 288 | |
289 | 289 | <table class="widefat export-options-table give-table"> |
290 | 290 | <thead> |
291 | 291 | <tr> |
292 | - <th class="row-title"><?php _e( 'Export Type', 'give' ); ?></th> |
|
293 | - <th><?php _e( 'Export Options', 'give' ); ?></th> |
|
292 | + <th class="row-title"><?php _e('Export Type', 'give'); ?></th> |
|
293 | + <th><?php _e('Export Options', 'give'); ?></th> |
|
294 | 294 | </tr> |
295 | 295 | </thead> |
296 | 296 | <tbody> |
297 | - <?php do_action( 'give_reports_tab_export_table_top' ); ?> |
|
297 | + <?php do_action('give_reports_tab_export_table_top'); ?> |
|
298 | 298 | <tr class="give-export-pdf-sales-earnings"> |
299 | 299 | <td class="row-title"> |
300 | - <h3><span><?php _e( 'Export PDF of Donations and Income', 'give' ); ?></span></h3> |
|
300 | + <h3><span><?php _e('Export PDF of Donations and Income', 'give'); ?></span></h3> |
|
301 | 301 | |
302 | - <p><?php _e( 'Download a PDF of Donations and Income reports for all forms for the current year.', 'give' ); ?></p> |
|
302 | + <p><?php _e('Download a PDF of Donations and Income reports for all forms for the current year.', 'give'); ?></p> |
|
303 | 303 | </td> |
304 | 304 | <td> |
305 | - <a class="button" href="<?php echo wp_nonce_url( add_query_arg( array( 'give-action' => 'generate_pdf' ) ), 'give_generate_pdf' ); ?>"><?php _e( 'Generate PDF', 'give' ); ?></a> |
|
305 | + <a class="button" href="<?php echo wp_nonce_url(add_query_arg(array('give-action' => 'generate_pdf')), 'give_generate_pdf'); ?>"><?php _e('Generate PDF', 'give'); ?></a> |
|
306 | 306 | </td> |
307 | 307 | </tr> |
308 | 308 | <tr class="alternate give-export-sales-earnings"> |
309 | 309 | <td class="row-title"> |
310 | - <h3><span><?php _e( 'Export Income and Donation Stats', 'give' ); ?></span></h3> |
|
310 | + <h3><span><?php _e('Export Income and Donation Stats', 'give'); ?></span></h3> |
|
311 | 311 | |
312 | - <p><?php _e( 'Download a CSV of income and donations over time.', 'give' ); ?></p> |
|
312 | + <p><?php _e('Download a CSV of income and donations over time.', 'give'); ?></p> |
|
313 | 313 | </td> |
314 | 314 | <td> |
315 | 315 | <form method="post"> |
316 | 316 | <?php |
317 | 317 | printf( |
318 | - __( '%1$s to %2$s', 'give' ), |
|
319 | - Give()->html->year_dropdown( 'start_year' ) . ' ' . Give()->html->month_dropdown( 'start_month' ), |
|
320 | - Give()->html->year_dropdown( 'end_year' ) . ' ' . Give()->html->month_dropdown( 'end_month' ) |
|
318 | + __('%1$s to %2$s', 'give'), |
|
319 | + Give()->html->year_dropdown('start_year').' '.Give()->html->month_dropdown('start_month'), |
|
320 | + Give()->html->year_dropdown('end_year').' '.Give()->html->month_dropdown('end_month') |
|
321 | 321 | ); |
322 | 322 | ?> |
323 | 323 | <input type="hidden" name="give-action" value="earnings_export"/> |
324 | - <input type="submit" value="<?php _e( 'Generate CSV', 'give' ); ?>" class="button-secondary"/> |
|
324 | + <input type="submit" value="<?php _e('Generate CSV', 'give'); ?>" class="button-secondary"/> |
|
325 | 325 | </form> |
326 | 326 | </td> |
327 | 327 | </tr> |
328 | 328 | <tr class="give-export-payment-history"> |
329 | 329 | <td class="row-title"> |
330 | - <h3><span><?php _e( 'Export Donation History', 'give' ); ?></span></h3> |
|
330 | + <h3><span><?php _e('Export Donation History', 'give'); ?></span></h3> |
|
331 | 331 | |
332 | - <p><?php _e( 'Download a CSV of all donations recorded.', 'give' ); ?></p> |
|
332 | + <p><?php _e('Download a CSV of all donations recorded.', 'give'); ?></p> |
|
333 | 333 | </td> |
334 | 334 | <td> |
335 | 335 | <form id="give-export-payments" class="give-export-form" method="post"> |
@@ -337,29 +337,29 @@ discard block |
||
337 | 337 | $args = array( |
338 | 338 | 'id' => 'give-payment-export-start', |
339 | 339 | 'name' => 'start', |
340 | - 'placeholder' => __( 'Start date', 'give' ) |
|
340 | + 'placeholder' => __('Start date', 'give') |
|
341 | 341 | ); |
342 | - echo Give()->html->date_field( $args ); ?> |
|
342 | + echo Give()->html->date_field($args); ?> |
|
343 | 343 | <?php |
344 | 344 | $args = array( |
345 | 345 | 'id' => 'give-payment-export-end', |
346 | 346 | 'name' => 'end', |
347 | - 'placeholder' => __( 'End date', 'give' ) |
|
347 | + 'placeholder' => __('End date', 'give') |
|
348 | 348 | ); |
349 | - echo Give()->html->date_field( $args ); ?> |
|
349 | + echo Give()->html->date_field($args); ?> |
|
350 | 350 | <select name="status"> |
351 | - <option value="any"><?php _e( 'All Statuses', 'give' ); ?></option> |
|
351 | + <option value="any"><?php _e('All Statuses', 'give'); ?></option> |
|
352 | 352 | <?php |
353 | 353 | $statuses = give_get_payment_statuses(); |
354 | - foreach ( $statuses as $status => $label ) { |
|
355 | - echo '<option value="' . $status . '">' . $label . '</option>'; |
|
354 | + foreach ($statuses as $status => $label) { |
|
355 | + echo '<option value="'.$status.'">'.$label.'</option>'; |
|
356 | 356 | } |
357 | 357 | ?> |
358 | 358 | </select> |
359 | - <?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?> |
|
359 | + <?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?> |
|
360 | 360 | <input type="hidden" name="give-export-class" value="Give_Batch_Payments_Export"/> |
361 | 361 | <span> |
362 | - <input type="submit" value="<?php _e( 'Generate CSV', 'give' ); ?>" class="button-secondary"/> |
|
362 | + <input type="submit" value="<?php _e('Generate CSV', 'give'); ?>" class="button-secondary"/> |
|
363 | 363 | <span class="spinner"></span> |
364 | 364 | </span> |
365 | 365 | </form> |
@@ -368,9 +368,9 @@ discard block |
||
368 | 368 | </tr> |
369 | 369 | <tr class="alternate give-export-donors"> |
370 | 370 | <td class="row-title"> |
371 | - <h3><span><?php _e( 'Export Donors in CSV', 'give' ); ?></span></h3> |
|
371 | + <h3><span><?php _e('Export Donors in CSV', 'give'); ?></span></h3> |
|
372 | 372 | |
373 | - <p><?php _e( 'Download an export of donors for all donation forms or only those who have given to a particular form.', 'give' ); ?></p> |
|
373 | + <p><?php _e('Download an export of donors for all donation forms or only those who have given to a particular form.', 'give'); ?></p> |
|
374 | 374 | </td> |
375 | 375 | <td> |
376 | 376 | <form method="post" id="give_donor_export" class="give-export-form"> |
@@ -381,54 +381,54 @@ discard block |
||
381 | 381 | 'id' => 'give_customer_export_form', |
382 | 382 | 'chosen' => true |
383 | 383 | ); |
384 | - echo Give()->html->forms_dropdown( $args ); ?> |
|
384 | + echo Give()->html->forms_dropdown($args); ?> |
|
385 | 385 | |
386 | - <input type="submit" value="<?php _e( 'Generate CSV', 'give' ); ?>" class="button-secondary"/> |
|
386 | + <input type="submit" value="<?php _e('Generate CSV', 'give'); ?>" class="button-secondary"/> |
|
387 | 387 | |
388 | 388 | <div id="export-donor-options-wrap" class="give-clearfix"> |
389 | - <p><?php _e( 'Export Columns', 'give' ); ?>:</p> |
|
389 | + <p><?php _e('Export Columns', 'give'); ?>:</p> |
|
390 | 390 | <ul id="give-export-option-ul"> |
391 | 391 | <li> |
392 | - <label for="give-export-fullname"><input type="checkbox" checked name="give_export_option[full_name]" id="give-export-fullname"><?php _e( 'Name', 'give' ); ?> |
|
392 | + <label for="give-export-fullname"><input type="checkbox" checked name="give_export_option[full_name]" id="give-export-fullname"><?php _e('Name', 'give'); ?> |
|
393 | 393 | </label> |
394 | 394 | </li> |
395 | 395 | <li> |
396 | - <label for="give-export-email"><input type="checkbox" checked name="give_export_option[email]" id="give-export-email"><?php _e( 'Email', 'give' ); ?> |
|
396 | + <label for="give-export-email"><input type="checkbox" checked name="give_export_option[email]" id="give-export-email"><?php _e('Email', 'give'); ?> |
|
397 | 397 | </label> |
398 | 398 | </li> |
399 | 399 | <li> |
400 | - <label for="give-export-address"><input type="checkbox" checked name="give_export_option[address]" id="give-export-address"><?php _e( 'Address', 'give' ); ?> |
|
400 | + <label for="give-export-address"><input type="checkbox" checked name="give_export_option[address]" id="give-export-address"><?php _e('Address', 'give'); ?> |
|
401 | 401 | </label> |
402 | 402 | </li> |
403 | 403 | <li> |
404 | - <label for="give-export-userid"><input type="checkbox" checked name="give_export_option[userid]" id="give-export-userid"><?php _e( 'User ID', 'give' ); ?> |
|
404 | + <label for="give-export-userid"><input type="checkbox" checked name="give_export_option[userid]" id="give-export-userid"><?php _e('User ID', 'give'); ?> |
|
405 | 405 | </label> |
406 | 406 | </li> |
407 | 407 | <li> |
408 | - <label for="give-export-first-donation-date"><input type="checkbox" checked name="give_export_option[date_first_donated]" id="give-export-first-donation-date"><?php _e( 'First Donation Date', 'give' ); ?> |
|
408 | + <label for="give-export-first-donation-date"><input type="checkbox" checked name="give_export_option[date_first_donated]" id="give-export-first-donation-date"><?php _e('First Donation Date', 'give'); ?> |
|
409 | 409 | </label> |
410 | 410 | </li> |
411 | 411 | <li> |
412 | - <label for="give-export-donation-number"><input type="checkbox" checked name="give_export_option[donations]" id="give-export-donation-number"><?php _e( 'Number of Donations', 'give' ); ?> |
|
412 | + <label for="give-export-donation-number"><input type="checkbox" checked name="give_export_option[donations]" id="give-export-donation-number"><?php _e('Number of Donations', 'give'); ?> |
|
413 | 413 | </label> |
414 | 414 | </li> |
415 | 415 | <li> |
416 | - <label for="give-export-donation-sum"><input type="checkbox" checked name="give_export_option[donation_sum]" id="give-export-donation-sum"><?php _e( 'Total Donated', 'give' ); ?> |
|
416 | + <label for="give-export-donation-sum"><input type="checkbox" checked name="give_export_option[donation_sum]" id="give-export-donation-sum"><?php _e('Total Donated', 'give'); ?> |
|
417 | 417 | </label> |
418 | 418 | </li> |
419 | 419 | </ul> |
420 | 420 | </div> |
421 | - <?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?> |
|
421 | + <?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?> |
|
422 | 422 | <input type="hidden" name="give-export-class" value="Give_Batch_Customers_Export"/> |
423 | 423 | <input type="hidden" name="give-action" value="email_export"/> |
424 | 424 | </form> |
425 | 425 | </td> |
426 | 426 | </tr> |
427 | - <?php do_action( 'give_reports_tab_export_table_bottom' ); ?> |
|
427 | + <?php do_action('give_reports_tab_export_table_bottom'); ?> |
|
428 | 428 | </tbody> |
429 | 429 | </table> |
430 | 430 | |
431 | - <?php do_action( 'give_reports_tab_export_content_bottom' ); ?> |
|
431 | + <?php do_action('give_reports_tab_export_content_bottom'); ?> |
|
432 | 432 | |
433 | 433 | </div> |
434 | 434 | <!-- .post-body-content --> |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | <?php |
439 | 439 | } |
440 | 440 | |
441 | -add_action( 'give_reports_tab_export', 'give_reports_tab_export' ); |
|
441 | +add_action('give_reports_tab_export', 'give_reports_tab_export'); |
|
442 | 442 | |
443 | 443 | /** |
444 | 444 | * Renders the Reports page |
@@ -448,19 +448,19 @@ discard block |
||
448 | 448 | */ |
449 | 449 | function give_reports_tab_logs() { |
450 | 450 | |
451 | - require( GIVE_PLUGIN_DIR . 'includes/admin/reporting/logs.php' ); |
|
451 | + require(GIVE_PLUGIN_DIR.'includes/admin/reporting/logs.php'); |
|
452 | 452 | |
453 | 453 | $current_view = 'sales'; |
454 | 454 | $log_views = give_log_default_views(); |
455 | 455 | |
456 | - if ( isset( $_GET['view'] ) && array_key_exists( $_GET['view'], $log_views ) ) { |
|
456 | + if (isset($_GET['view']) && array_key_exists($_GET['view'], $log_views)) { |
|
457 | 457 | $current_view = $_GET['view']; |
458 | 458 | } |
459 | 459 | |
460 | - do_action( 'give_logs_view_' . $current_view ); |
|
460 | + do_action('give_logs_view_'.$current_view); |
|
461 | 461 | } |
462 | 462 | |
463 | -add_action( 'give_reports_tab_logs', 'give_reports_tab_logs' ); |
|
463 | +add_action('give_reports_tab_logs', 'give_reports_tab_logs'); |
|
464 | 464 | |
465 | 465 | /** |
466 | 466 | * Retrieves estimated monthly earnings and sales |
@@ -470,9 +470,9 @@ discard block |
||
470 | 470 | */ |
471 | 471 | function give_estimated_monthly_stats() { |
472 | 472 | |
473 | - $estimated = get_transient( 'give_estimated_monthly_stats' ); |
|
473 | + $estimated = get_transient('give_estimated_monthly_stats'); |
|
474 | 474 | |
475 | - if ( false === $estimated ) { |
|
475 | + if (false === $estimated) { |
|
476 | 476 | |
477 | 477 | $estimated = array( |
478 | 478 | 'earnings' => 0, |
@@ -481,20 +481,20 @@ discard block |
||
481 | 481 | |
482 | 482 | $stats = new Give_Payment_Stats; |
483 | 483 | |
484 | - $to_date_earnings = $stats->get_earnings( 0, 'this_month' ); |
|
485 | - $to_date_sales = $stats->get_sales( 0, 'this_month' ); |
|
484 | + $to_date_earnings = $stats->get_earnings(0, 'this_month'); |
|
485 | + $to_date_sales = $stats->get_sales(0, 'this_month'); |
|
486 | 486 | |
487 | - $current_day = date( 'd', current_time( 'timestamp' ) ); |
|
488 | - $current_month = date( 'n', current_time( 'timestamp' ) ); |
|
489 | - $current_year = date( 'Y', current_time( 'timestamp' ) ); |
|
490 | - $days_in_month = cal_days_in_month( CAL_GREGORIAN, $current_month, $current_year ); |
|
487 | + $current_day = date('d', current_time('timestamp')); |
|
488 | + $current_month = date('n', current_time('timestamp')); |
|
489 | + $current_year = date('Y', current_time('timestamp')); |
|
490 | + $days_in_month = cal_days_in_month(CAL_GREGORIAN, $current_month, $current_year); |
|
491 | 491 | |
492 | - $estimated['earnings'] = ( $to_date_earnings / $current_day ) * $days_in_month; |
|
493 | - $estimated['sales'] = ( $to_date_sales / $current_day ) * $days_in_month; |
|
492 | + $estimated['earnings'] = ($to_date_earnings / $current_day) * $days_in_month; |
|
493 | + $estimated['sales'] = ($to_date_sales / $current_day) * $days_in_month; |
|
494 | 494 | |
495 | 495 | // Cache for one day |
496 | - set_transient( 'give_estimated_monthly_stats', $estimated, 86400 ); |
|
496 | + set_transient('give_estimated_monthly_stats', $estimated, 86400); |
|
497 | 497 | } |
498 | 498 | |
499 | - return maybe_unserialize( $estimated ); |
|
499 | + return maybe_unserialize($estimated); |
|
500 | 500 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -25,10 +25,10 @@ discard block |
||
25 | 25 | * |
26 | 26 | * @return string Login form |
27 | 27 | */ |
28 | -function give_login_form( $redirect = '' ) { |
|
28 | +function give_login_form($redirect = '') { |
|
29 | 29 | global $give_login_redirect; |
30 | 30 | |
31 | - if ( empty( $redirect ) ) { |
|
31 | + if (empty($redirect)) { |
|
32 | 32 | $redirect = add_query_arg('give-login-success', 'true', give_get_current_page_url()); |
33 | 33 | } |
34 | 34 | |
@@ -36,9 +36,9 @@ discard block |
||
36 | 36 | |
37 | 37 | ob_start(); |
38 | 38 | |
39 | - give_get_template_part( 'shortcode', 'login' ); |
|
39 | + give_get_template_part('shortcode', 'login'); |
|
40 | 40 | |
41 | - return apply_filters( 'give_login_form', ob_get_clean() ); |
|
41 | + return apply_filters('give_login_form', ob_get_clean()); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -52,10 +52,10 @@ discard block |
||
52 | 52 | * |
53 | 53 | * @return string Register form |
54 | 54 | */ |
55 | -function give_register_form( $redirect = '' ) { |
|
55 | +function give_register_form($redirect = '') { |
|
56 | 56 | global $give_options, $give_register_redirect; |
57 | 57 | |
58 | - if ( empty( $redirect ) ) { |
|
58 | + if (empty($redirect)) { |
|
59 | 59 | $redirect = give_get_current_page_url(); |
60 | 60 | } |
61 | 61 | |
@@ -63,11 +63,11 @@ discard block |
||
63 | 63 | |
64 | 64 | ob_start(); |
65 | 65 | |
66 | - if ( ! is_user_logged_in() ) { |
|
67 | - give_get_template_part( 'shortcode', 'register' ); |
|
66 | + if ( ! is_user_logged_in()) { |
|
67 | + give_get_template_part('shortcode', 'register'); |
|
68 | 68 | } |
69 | 69 | |
70 | - return apply_filters( 'give_register_form', ob_get_clean() ); |
|
70 | + return apply_filters('give_register_form', ob_get_clean()); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | /** |
@@ -79,34 +79,34 @@ discard block |
||
79 | 79 | * |
80 | 80 | * @return void |
81 | 81 | */ |
82 | -function give_process_login_form( $data ) { |
|
83 | - if ( wp_verify_nonce( $data['give_login_nonce'], 'give-login-nonce' ) ) { |
|
84 | - $user_data = get_user_by( 'login', $data['give_user_login'] ); |
|
85 | - if ( ! $user_data ) { |
|
86 | - $user_data = get_user_by( 'email', $data['give_user_login'] ); |
|
82 | +function give_process_login_form($data) { |
|
83 | + if (wp_verify_nonce($data['give_login_nonce'], 'give-login-nonce')) { |
|
84 | + $user_data = get_user_by('login', $data['give_user_login']); |
|
85 | + if ( ! $user_data) { |
|
86 | + $user_data = get_user_by('email', $data['give_user_login']); |
|
87 | 87 | } |
88 | - if ( $user_data ) { |
|
88 | + if ($user_data) { |
|
89 | 89 | $user_ID = $user_data->ID; |
90 | 90 | $user_email = $user_data->user_email; |
91 | - if ( wp_check_password( $data['give_user_pass'], $user_data->user_pass, $user_data->ID ) ) { |
|
92 | - give_log_user_in( $user_data->ID, $data['give_user_login'], $data['give_user_pass'] ); |
|
91 | + if (wp_check_password($data['give_user_pass'], $user_data->user_pass, $user_data->ID)) { |
|
92 | + give_log_user_in($user_data->ID, $data['give_user_login'], $data['give_user_pass']); |
|
93 | 93 | } else { |
94 | - give_set_error( 'password_incorrect', __( 'The password you entered is incorrect', 'give' ) ); |
|
94 | + give_set_error('password_incorrect', __('The password you entered is incorrect', 'give')); |
|
95 | 95 | } |
96 | 96 | } else { |
97 | - give_set_error( 'username_incorrect', __( 'The username you entered does not exist', 'give' ) ); |
|
97 | + give_set_error('username_incorrect', __('The username you entered does not exist', 'give')); |
|
98 | 98 | } |
99 | 99 | // Check for errors and redirect if none present |
100 | 100 | $errors = give_get_errors(); |
101 | - if ( ! $errors ) { |
|
102 | - $redirect = apply_filters( 'give_login_redirect', $data['give_redirect'], $user_ID ); |
|
103 | - wp_redirect( $redirect ); |
|
101 | + if ( ! $errors) { |
|
102 | + $redirect = apply_filters('give_login_redirect', $data['give_redirect'], $user_ID); |
|
103 | + wp_redirect($redirect); |
|
104 | 104 | give_die(); |
105 | 105 | } |
106 | 106 | } |
107 | 107 | } |
108 | 108 | |
109 | -add_action( 'give_user_login', 'give_process_login_form' ); |
|
109 | +add_action('give_user_login', 'give_process_login_form'); |
|
110 | 110 | |
111 | 111 | /** |
112 | 112 | * Log User In |
@@ -119,15 +119,15 @@ discard block |
||
119 | 119 | * |
120 | 120 | * @return void |
121 | 121 | */ |
122 | -function give_log_user_in( $user_id, $user_login, $user_pass ) { |
|
123 | - if ( $user_id < 1 ) { |
|
122 | +function give_log_user_in($user_id, $user_login, $user_pass) { |
|
123 | + if ($user_id < 1) { |
|
124 | 124 | return; |
125 | 125 | } |
126 | 126 | |
127 | - wp_set_auth_cookie( $user_id ); |
|
128 | - wp_set_current_user( $user_id, $user_login ); |
|
129 | - do_action( 'wp_login', $user_login, get_userdata( $user_id ) ); |
|
130 | - do_action( 'give_log_user_in', $user_id, $user_login, $user_pass ); |
|
127 | + wp_set_auth_cookie($user_id); |
|
128 | + wp_set_current_user($user_id, $user_login); |
|
129 | + do_action('wp_login', $user_login, get_userdata($user_id)); |
|
130 | + do_action('give_log_user_in', $user_id, $user_login, $user_pass); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | |
@@ -140,70 +140,70 @@ discard block |
||
140 | 140 | * |
141 | 141 | * @return void |
142 | 142 | */ |
143 | -function give_process_register_form( $data ) { |
|
143 | +function give_process_register_form($data) { |
|
144 | 144 | |
145 | - if ( is_user_logged_in() ) { |
|
145 | + if (is_user_logged_in()) { |
|
146 | 146 | return; |
147 | 147 | } |
148 | 148 | |
149 | - if ( empty( $_POST['give_register_submit'] ) ) { |
|
149 | + if (empty($_POST['give_register_submit'])) { |
|
150 | 150 | return; |
151 | 151 | } |
152 | 152 | |
153 | - do_action( 'give_pre_process_register_form' ); |
|
153 | + do_action('give_pre_process_register_form'); |
|
154 | 154 | |
155 | - if ( empty( $data['give_user_login'] ) ) { |
|
156 | - give_set_error( 'empty_username', __( 'Invalid username', 'give' ) ); |
|
155 | + if (empty($data['give_user_login'])) { |
|
156 | + give_set_error('empty_username', __('Invalid username', 'give')); |
|
157 | 157 | } |
158 | 158 | |
159 | - if ( username_exists( $data['give_user_login'] ) ) { |
|
160 | - give_set_error( 'username_unavailable', __( 'Username already taken', 'give' ) ); |
|
159 | + if (username_exists($data['give_user_login'])) { |
|
160 | + give_set_error('username_unavailable', __('Username already taken', 'give')); |
|
161 | 161 | } |
162 | 162 | |
163 | - if ( ! validate_username( $data['give_user_login'] ) ) { |
|
164 | - give_set_error( 'username_invalid', __( 'Invalid username', 'give' ) ); |
|
163 | + if ( ! validate_username($data['give_user_login'])) { |
|
164 | + give_set_error('username_invalid', __('Invalid username', 'give')); |
|
165 | 165 | } |
166 | 166 | |
167 | - if ( email_exists( $data['give_user_email'] ) ) { |
|
168 | - give_set_error( 'email_unavailable', __( 'Email address already taken', 'give' ) ); |
|
167 | + if (email_exists($data['give_user_email'])) { |
|
168 | + give_set_error('email_unavailable', __('Email address already taken', 'give')); |
|
169 | 169 | } |
170 | 170 | |
171 | - if ( empty( $data['give_user_email'] ) || ! is_email( $data['give_user_email'] ) ) { |
|
172 | - give_set_error( 'email_invalid', __( 'Invalid email', 'give' ) ); |
|
171 | + if (empty($data['give_user_email']) || ! is_email($data['give_user_email'])) { |
|
172 | + give_set_error('email_invalid', __('Invalid email', 'give')); |
|
173 | 173 | } |
174 | 174 | |
175 | - if ( ! empty( $data['give_payment_email'] ) && $data['give_payment_email'] != $data['give_user_email'] && ! is_email( $data['give_payment_email'] ) ) { |
|
176 | - give_set_error( 'payment_email_invalid', __( 'Invalid payment email', 'give' ) ); |
|
175 | + if ( ! empty($data['give_payment_email']) && $data['give_payment_email'] != $data['give_user_email'] && ! is_email($data['give_payment_email'])) { |
|
176 | + give_set_error('payment_email_invalid', __('Invalid payment email', 'give')); |
|
177 | 177 | } |
178 | 178 | |
179 | - if ( empty( $_POST['give_user_pass'] ) ) { |
|
180 | - give_set_error( 'empty_password', __( 'Please enter a password', 'give' ) ); |
|
179 | + if (empty($_POST['give_user_pass'])) { |
|
180 | + give_set_error('empty_password', __('Please enter a password', 'give')); |
|
181 | 181 | } |
182 | 182 | |
183 | - if ( ( ! empty( $_POST['give_user_pass'] ) && empty( $_POST['give_user_pass2'] ) ) || ( $_POST['give_user_pass'] !== $_POST['give_user_pass2'] ) ) { |
|
184 | - give_set_error( 'password_mismatch', __( 'Passwords don\'t match', 'give' ) ); |
|
183 | + if (( ! empty($_POST['give_user_pass']) && empty($_POST['give_user_pass2'])) || ($_POST['give_user_pass'] !== $_POST['give_user_pass2'])) { |
|
184 | + give_set_error('password_mismatch', __('Passwords don\'t match', 'give')); |
|
185 | 185 | } |
186 | 186 | |
187 | - do_action( 'give_process_register_form' ); |
|
187 | + do_action('give_process_register_form'); |
|
188 | 188 | |
189 | 189 | // Check for errors and redirect if none present |
190 | 190 | $errors = give_get_errors(); |
191 | 191 | |
192 | - if ( empty( $errors ) ) { |
|
192 | + if (empty($errors)) { |
|
193 | 193 | |
194 | - $redirect = apply_filters( 'give_register_redirect', $data['give_redirect'] ); |
|
194 | + $redirect = apply_filters('give_register_redirect', $data['give_redirect']); |
|
195 | 195 | |
196 | - give_register_and_login_new_user( array( |
|
196 | + give_register_and_login_new_user(array( |
|
197 | 197 | 'user_login' => $data['give_user_login'], |
198 | 198 | 'user_pass' => $data['give_user_pass'], |
199 | 199 | 'user_email' => $data['give_user_email'], |
200 | - 'user_registered' => date( 'Y-m-d H:i:s' ), |
|
201 | - 'role' => get_option( 'default_role' ) |
|
202 | - ) ); |
|
200 | + 'user_registered' => date('Y-m-d H:i:s'), |
|
201 | + 'role' => get_option('default_role') |
|
202 | + )); |
|
203 | 203 | |
204 | - wp_redirect( $redirect ); |
|
204 | + wp_redirect($redirect); |
|
205 | 205 | give_die(); |
206 | 206 | } |
207 | 207 | } |
208 | 208 | |
209 | -add_action( 'give_user_register', 'give_process_register_form' ); |
|
210 | 209 | \ No newline at end of file |
210 | +add_action('give_user_register', 'give_process_register_form'); |
|
211 | 211 | \ No newline at end of file |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -24,9 +24,9 @@ discard block |
||
24 | 24 | */ |
25 | 25 | function give_customers_page() { |
26 | 26 | $default_views = give_customer_views(); |
27 | - $requested_view = isset( $_GET['view'] ) ? sanitize_text_field( $_GET['view'] ) : 'customers'; |
|
28 | - if ( array_key_exists( $requested_view, $default_views ) && function_exists( $default_views[ $requested_view ] ) ) { |
|
29 | - give_render_customer_view( $requested_view, $default_views ); |
|
27 | + $requested_view = isset($_GET['view']) ? sanitize_text_field($_GET['view']) : 'customers'; |
|
28 | + if (array_key_exists($requested_view, $default_views) && function_exists($default_views[$requested_view])) { |
|
29 | + give_render_customer_view($requested_view, $default_views); |
|
30 | 30 | } else { |
31 | 31 | give_customers_list(); |
32 | 32 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | |
43 | 43 | $views = array(); |
44 | 44 | |
45 | - return apply_filters( 'give_customer_views', $views ); |
|
45 | + return apply_filters('give_customer_views', $views); |
|
46 | 46 | |
47 | 47 | } |
48 | 48 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | |
57 | 57 | $tabs = array(); |
58 | 58 | |
59 | - return apply_filters( 'give_customer_tabs', $tabs ); |
|
59 | + return apply_filters('give_customer_tabs', $tabs); |
|
60 | 60 | |
61 | 61 | } |
62 | 62 | |
@@ -67,24 +67,24 @@ discard block |
||
67 | 67 | * @return void |
68 | 68 | */ |
69 | 69 | function give_customers_list() { |
70 | - include( dirname( __FILE__ ) . '/class-customer-table.php' ); |
|
70 | + include(dirname(__FILE__).'/class-customer-table.php'); |
|
71 | 71 | |
72 | 72 | $customers_table = new Give_Customer_Reports_Table(); |
73 | 73 | $customers_table->prepare_items(); |
74 | 74 | ?> |
75 | 75 | <div class="wrap"> |
76 | - <h2><?php _e( 'Donors', 'give' ); ?></h2> |
|
77 | - <?php do_action( 'give_donors_table_top' ); ?> |
|
78 | - <form id="give-donors-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors' ); ?>"> |
|
76 | + <h2><?php _e('Donors', 'give'); ?></h2> |
|
77 | + <?php do_action('give_donors_table_top'); ?> |
|
78 | + <form id="give-donors-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors'); ?>"> |
|
79 | 79 | <?php |
80 | - $customers_table->search_box( __( 'Search Donors', 'give' ), 'give-donors' ); |
|
80 | + $customers_table->search_box(__('Search Donors', 'give'), 'give-donors'); |
|
81 | 81 | $customers_table->display(); |
82 | 82 | ?> |
83 | 83 | <input type="hidden" name="post_type" value="give_forms" /> |
84 | 84 | <input type="hidden" name="page" value="give-donors" /> |
85 | 85 | <input type="hidden" name="view" value="customers" /> |
86 | 86 | </form> |
87 | - <?php do_action( 'give_donors_table_bottom' ); ?> |
|
87 | + <?php do_action('give_donors_table_bottom'); ?> |
|
88 | 88 | </div> |
89 | 89 | <?php |
90 | 90 | } |
@@ -99,27 +99,27 @@ discard block |
||
99 | 99 | * |
100 | 100 | * @return void |
101 | 101 | */ |
102 | -function give_render_customer_view( $view, $callbacks ) { |
|
102 | +function give_render_customer_view($view, $callbacks) { |
|
103 | 103 | |
104 | 104 | $render = true; |
105 | 105 | |
106 | - $customer_view_role = apply_filters( 'give_view_customers_role', 'view_give_reports' ); |
|
106 | + $customer_view_role = apply_filters('give_view_customers_role', 'view_give_reports'); |
|
107 | 107 | |
108 | - if ( ! current_user_can( $customer_view_role ) ) { |
|
109 | - give_set_error( 'give-no-access', __( 'You are not permitted to view this data.', 'give' ) ); |
|
108 | + if ( ! current_user_can($customer_view_role)) { |
|
109 | + give_set_error('give-no-access', __('You are not permitted to view this data.', 'give')); |
|
110 | 110 | $render = false; |
111 | 111 | } |
112 | 112 | |
113 | - if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) { |
|
114 | - give_set_error( 'give-invalid_customer', __( 'Invalid Donor ID Provided.', 'give' ) ); |
|
113 | + if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) { |
|
114 | + give_set_error('give-invalid_customer', __('Invalid Donor ID Provided.', 'give')); |
|
115 | 115 | $render = false; |
116 | 116 | } |
117 | 117 | |
118 | 118 | $customer_id = (int) $_GET['id']; |
119 | - $customer = new Give_Customer( $customer_id ); |
|
119 | + $customer = new Give_Customer($customer_id); |
|
120 | 120 | |
121 | - if ( empty( $customer->id ) ) { |
|
122 | - give_set_error( 'give-invalid_customer', __( 'Invalid Donor ID Provided.', 'give' ) ); |
|
121 | + if (empty($customer->id)) { |
|
122 | + give_set_error('give-invalid_customer', __('Invalid Donor ID Provided.', 'give')); |
|
123 | 123 | $render = false; |
124 | 124 | } |
125 | 125 | |
@@ -128,27 +128,27 @@ discard block |
||
128 | 128 | |
129 | 129 | <div class='wrap'> |
130 | 130 | |
131 | - <?php if ( give_get_errors() ) : ?> |
|
131 | + <?php if (give_get_errors()) : ?> |
|
132 | 132 | <div class="error settings-error"> |
133 | - <?php give_print_errors( 0 ); ?> |
|
133 | + <?php give_print_errors(0); ?> |
|
134 | 134 | </div> |
135 | 135 | <?php endif; ?> |
136 | 136 | |
137 | - <?php if ( $customer && $render ) : ?> |
|
137 | + <?php if ($customer && $render) : ?> |
|
138 | 138 | |
139 | 139 | <div id="customer-tab-wrapper"> |
140 | 140 | <ul id="customer-tab-wrapper-list" class="nav-tab-wrapper"> |
141 | - <?php foreach ( $customer_tabs as $key => $tab ) : ?> |
|
141 | + <?php foreach ($customer_tabs as $key => $tab) : ?> |
|
142 | 142 | <?php $active = $key === $view ? true : false; ?> |
143 | 143 | <?php $class = $active ? 'active' : 'inactive'; ?> |
144 | 144 | |
145 | - <li class="<?php echo sanitize_html_class( $class ); ?>"> |
|
146 | - <?php if ( ! $active ) : ?> |
|
147 | - <a title="<?php echo esc_attr( $tab['title'] ); ?>" aria-label="<?php echo esc_attr( $tab['title'] ); ?>" href="<?php echo esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=' . $key . '&id=' . $customer->id ) ); ?>"> |
|
145 | + <li class="<?php echo sanitize_html_class($class); ?>"> |
|
146 | + <?php if ( ! $active) : ?> |
|
147 | + <a title="<?php echo esc_attr($tab['title']); ?>" aria-label="<?php echo esc_attr($tab['title']); ?>" href="<?php echo esc_url(admin_url('edit.php?post_type=give_forms&page=give-donors&view='.$key.'&id='.$customer->id)); ?>"> |
|
148 | 148 | <?php endif; ?> |
149 | 149 | |
150 | - <span class="dashicons <?php echo sanitize_html_class( $tab['dashicon'] ); ?>"></span> <?php echo esc_attr( $tab['title'] ); ?> |
|
151 | - <?php if ( ! $active ) : ?> |
|
150 | + <span class="dashicons <?php echo sanitize_html_class($tab['dashicon']); ?>"></span> <?php echo esc_attr($tab['title']); ?> |
|
151 | + <?php if ( ! $active) : ?> |
|
152 | 152 | </a> |
153 | 153 | <?php endif; ?> |
154 | 154 | |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | </div> |
161 | 161 | |
162 | 162 | <div id="give-customer-card-wrapper"> |
163 | - <?php $callbacks[ $view ]( $customer ) ?> |
|
163 | + <?php $callbacks[$view]($customer) ?> |
|
164 | 164 | </div> |
165 | 165 | |
166 | 166 | <?php endif; ?> |
@@ -180,17 +180,17 @@ discard block |
||
180 | 180 | * |
181 | 181 | * @return void |
182 | 182 | */ |
183 | -function give_customers_view( $customer ) { |
|
183 | +function give_customers_view($customer) { |
|
184 | 184 | |
185 | - $customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' ); |
|
185 | + $customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments'); |
|
186 | 186 | |
187 | 187 | ?> |
188 | 188 | |
189 | - <?php do_action( 'give_donor_card_top', $customer ); ?> |
|
189 | + <?php do_action('give_donor_card_top', $customer); ?> |
|
190 | 190 | |
191 | 191 | <div id="donor-summary" class="info-wrapper customer-section postbox"> |
192 | 192 | |
193 | - <form id="edit-customer-info" method="post" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer->id ); ?>"> |
|
193 | + <form id="edit-customer-info" method="post" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer->id); ?>"> |
|
194 | 194 | |
195 | 195 | <div class="customer-info"> |
196 | 196 | |
@@ -198,22 +198,22 @@ discard block |
||
198 | 198 | <div class="donor-bio-header clearfix"> |
199 | 199 | |
200 | 200 | <div class="avatar-wrap left" id="customer-avatar"> |
201 | - <?php echo get_avatar( $customer->email ); ?> |
|
201 | + <?php echo get_avatar($customer->email); ?> |
|
202 | 202 | </div> |
203 | 203 | |
204 | 204 | <div class="customer-id" class="left"> |
205 | 205 | #<?php echo $customer->id; ?> |
206 | 206 | </div> |
207 | 207 | <div id="customer-name-wrap" class="left"> |
208 | - <span class="customer-name info-item edit-item"><input size="15" data-key="name" name="customerinfo[name]" type="text" value="<?php echo esc_attr( $customer->name ); ?>" placeholder="<?php _e( 'Donor Name', 'give' ); ?>" /></span> |
|
208 | + <span class="customer-name info-item edit-item"><input size="15" data-key="name" name="customerinfo[name]" type="text" value="<?php echo esc_attr($customer->name); ?>" placeholder="<?php _e('Donor Name', 'give'); ?>" /></span> |
|
209 | 209 | <span class="customer-name info-item editable"><span data-key="name"><?php echo $customer->name; ?></span></span> |
210 | 210 | </div> |
211 | 211 | <p class="customer-since info-item"> |
212 | - <?php _e( 'Donor since', 'give' ); ?> |
|
213 | - <?php echo date_i18n( get_option( 'date_format' ), strtotime( $customer->date_created ) ) ?> |
|
212 | + <?php _e('Donor since', 'give'); ?> |
|
213 | + <?php echo date_i18n(get_option('date_format'), strtotime($customer->date_created)) ?> |
|
214 | 214 | </p> |
215 | - <?php if ( current_user_can( $customer_edit_role ) ): ?> |
|
216 | - <a title="<?php _e( 'Edit Donor', 'give' ); ?>" href="#" id="edit-customer" class="button info-item editable customer-edit-link"><?php _e( 'Edit Donor', 'give' ); ?></a> |
|
215 | + <?php if (current_user_can($customer_edit_role)): ?> |
|
216 | + <a title="<?php _e('Edit Donor', 'give'); ?>" href="#" id="edit-customer" class="button info-item editable customer-edit-link"><?php _e('Edit Donor', 'give'); ?></a> |
|
217 | 217 | <?php endif; ?> |
218 | 218 | </div> |
219 | 219 | <!-- /donor-bio-header --> |
@@ -223,14 +223,14 @@ discard block |
||
223 | 223 | <table class="widefat"> |
224 | 224 | <tbody> |
225 | 225 | <tr> |
226 | - <td><label for="tablecell"><?php esc_attr_e( 'Email', 'give' ); ?></label>:</td> |
|
226 | + <td><label for="tablecell"><?php esc_attr_e('Email', 'give'); ?></label>:</td> |
|
227 | 227 | <td class="row-title"> |
228 | - <span class="customer-name info-item edit-item"><input size="20" data-key="email" name="customerinfo[email]" type="text" value="<?php echo $customer->email; ?>" placeholder="<?php _e( 'Donor Email', 'give' ); ?>" /></span> |
|
228 | + <span class="customer-name info-item edit-item"><input size="20" data-key="email" name="customerinfo[email]" type="text" value="<?php echo $customer->email; ?>" placeholder="<?php _e('Donor Email', 'give'); ?>" /></span> |
|
229 | 229 | <span class="customer-email info-item editable" data-key="email"><?php echo $customer->email; ?></span> |
230 | 230 | </td> |
231 | 231 | </tr> |
232 | 232 | <tr class="alternate"> |
233 | - <td><label for="tablecell"><?php esc_attr_e( 'User ID', 'give' ); ?></label>:</td> |
|
233 | + <td><label for="tablecell"><?php esc_attr_e('User ID', 'give'); ?></label>:</td> |
|
234 | 234 | <td class="row-title"> |
235 | 235 | <span class="customer-user-id info-item edit-item"> |
236 | 236 | <?php |
@@ -246,38 +246,38 @@ discard block |
||
246 | 246 | 'data' => $data_atts, |
247 | 247 | ); |
248 | 248 | |
249 | - if ( ! empty( $user_id ) ) { |
|
250 | - $userdata = get_userdata( $user_id ); |
|
249 | + if ( ! empty($user_id)) { |
|
250 | + $userdata = get_userdata($user_id); |
|
251 | 251 | $user_args['value'] = $userdata->user_login; |
252 | 252 | } |
253 | 253 | |
254 | - echo Give()->html->ajax_user_search( $user_args ); |
|
254 | + echo Give()->html->ajax_user_search($user_args); |
|
255 | 255 | ?> |
256 | 256 | <input type="hidden" name="customerinfo[user_id]" data-key="user_id" value="<?php echo $customer->user_id; ?>" /> |
257 | 257 | </span> |
258 | 258 | |
259 | 259 | <span class="customer-user-id info-item editable"> |
260 | - <?php if ( intval( $customer->user_id ) > 0 ) : ?> |
|
260 | + <?php if (intval($customer->user_id) > 0) : ?> |
|
261 | 261 | <span data-key="user_id"><?php echo $customer->user_id; ?></span> |
262 | 262 | <?php else : ?> |
263 | - <span data-key="user_id"><?php _e( 'None', 'give' ); ?></span> |
|
263 | + <span data-key="user_id"><?php _e('None', 'give'); ?></span> |
|
264 | 264 | <?php endif; ?> |
265 | - <?php if ( current_user_can( $customer_edit_role ) && intval( $customer->user_id ) > 0 ) : ?> |
|
266 | - <span class="disconnect-user"> - <a id="disconnect-customer" href="#disconnect" title="<?php _e( 'Disconnects the current user ID from this customer record', 'give' ); ?>"><?php _e( 'Disconnect User', 'give' ); ?></a></span> |
|
265 | + <?php if (current_user_can($customer_edit_role) && intval($customer->user_id) > 0) : ?> |
|
266 | + <span class="disconnect-user"> - <a id="disconnect-customer" href="#disconnect" title="<?php _e('Disconnects the current user ID from this customer record', 'give'); ?>"><?php _e('Disconnect User', 'give'); ?></a></span> |
|
267 | 267 | <?php endif; ?> |
268 | 268 | </span> |
269 | 269 | </td> |
270 | 270 | </tr> |
271 | - <?php if ( isset( $customer->user_id ) && $customer->user_id > 0 ) : ?> |
|
271 | + <?php if (isset($customer->user_id) && $customer->user_id > 0) : ?> |
|
272 | 272 | |
273 | 273 | <tr> |
274 | - <td><?php esc_attr_e( 'Address', 'give' ); ?>:</td> |
|
274 | + <td><?php esc_attr_e('Address', 'give'); ?>:</td> |
|
275 | 275 | <td class="row-title"> |
276 | 276 | |
277 | 277 | <div class="customer-address-wrapper"> |
278 | 278 | |
279 | 279 | <?php |
280 | - $address = get_user_meta( $customer->user_id, '_give_user_address', true ); |
|
280 | + $address = get_user_meta($customer->user_id, '_give_user_address', true); |
|
281 | 281 | $defaults = array( |
282 | 282 | 'line1' => '', |
283 | 283 | 'line2' => '', |
@@ -287,10 +287,10 @@ discard block |
||
287 | 287 | 'zip' => '' |
288 | 288 | ); |
289 | 289 | |
290 | - $address = wp_parse_args( $address, $defaults ); |
|
290 | + $address = wp_parse_args($address, $defaults); |
|
291 | 291 | ?> |
292 | 292 | |
293 | - <?php if ( ! empty( $address ) ) { ?> |
|
293 | + <?php if ( ! empty($address)) { ?> |
|
294 | 294 | <span class="customer-address info-item editable"> |
295 | 295 | <span class="info-item" data-key="line1"><?php echo $address['line1']; ?></span> |
296 | 296 | <span class="info-item" data-key="line2"><?php echo $address['line2']; ?></span> |
@@ -301,38 +301,38 @@ discard block |
||
301 | 301 | </span> |
302 | 302 | <?php } ?> |
303 | 303 | <span class="customer-address info-item edit-item"> |
304 | - <input class="info-item" type="text" data-key="line1" name="customerinfo[line1]" placeholder="<?php _e( 'Address 1', 'give' ); ?>" value="<?php echo $address['line1']; ?>" /> |
|
305 | - <input class="info-item" type="text" data-key="line2" name="customerinfo[line2]" placeholder="<?php _e( 'Address 2', 'give' ); ?>" value="<?php echo $address['line2']; ?>" /> |
|
306 | - <input class="info-item" type="text" data-key="city" name="customerinfo[city]" placeholder="<?php _e( 'City', 'give' ); ?>" value="<?php echo $address['city']; ?>" /> |
|
304 | + <input class="info-item" type="text" data-key="line1" name="customerinfo[line1]" placeholder="<?php _e('Address 1', 'give'); ?>" value="<?php echo $address['line1']; ?>" /> |
|
305 | + <input class="info-item" type="text" data-key="line2" name="customerinfo[line2]" placeholder="<?php _e('Address 2', 'give'); ?>" value="<?php echo $address['line2']; ?>" /> |
|
306 | + <input class="info-item" type="text" data-key="city" name="customerinfo[city]" placeholder="<?php _e('City', 'give'); ?>" value="<?php echo $address['city']; ?>" /> |
|
307 | 307 | <select data-key="country" name="customerinfo[country]" id="billing_country" class="billing_country give-select edit-item"> |
308 | 308 | <?php |
309 | 309 | |
310 | 310 | $selected_country = $address['country']; |
311 | 311 | |
312 | 312 | $countries = give_get_country_list(); |
313 | - foreach ( $countries as $country_code => $country ) { |
|
314 | - echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>'; |
|
313 | + foreach ($countries as $country_code => $country) { |
|
314 | + echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>'; |
|
315 | 315 | } |
316 | 316 | ?> |
317 | 317 | </select> |
318 | 318 | <?php |
319 | 319 | $selected_state = give_get_state(); |
320 | - $states = give_get_states( $selected_country ); |
|
320 | + $states = give_get_states($selected_country); |
|
321 | 321 | |
322 | - $selected_state = isset( $address['state'] ) ? $address['state'] : $selected_state; |
|
322 | + $selected_state = isset($address['state']) ? $address['state'] : $selected_state; |
|
323 | 323 | |
324 | - if ( ! empty( $states ) ) : ?> |
|
324 | + if ( ! empty($states)) : ?> |
|
325 | 325 | <select data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-select info-item"> |
326 | 326 | <?php |
327 | - foreach ( $states as $state_code => $state ) { |
|
328 | - echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>'; |
|
327 | + foreach ($states as $state_code => $state) { |
|
328 | + echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>'; |
|
329 | 329 | } |
330 | 330 | ?> |
331 | 331 | </select> |
332 | 332 | <?php else : ?> |
333 | - <input type="text" size="6" data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-input info-item" placeholder="<?php _e( 'State / Province', 'give' ); ?>" /> |
|
333 | + <input type="text" size="6" data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-input info-item" placeholder="<?php _e('State / Province', 'give'); ?>" /> |
|
334 | 334 | <?php endif; ?> |
335 | - <input class="info-item" type="text" data-key="zip" name="customerinfo[zip]" placeholder="<?php _e( 'Postal', 'give' ); ?>" value="<?php echo $address['zip']; ?>" /> |
|
335 | + <input class="info-item" type="text" data-key="zip" name="customerinfo[zip]" placeholder="<?php _e('Postal', 'give'); ?>" value="<?php echo $address['zip']; ?>" /> |
|
336 | 336 | </span> |
337 | 337 | |
338 | 338 | </div> |
@@ -350,120 +350,120 @@ discard block |
||
350 | 350 | |
351 | 351 | <span id="customer-edit-actions" class="edit-item"> |
352 | 352 | <input type="hidden" data-key="id" name="customerinfo[id]" value="<?php echo $customer->id; ?>" /> |
353 | - <?php wp_nonce_field( 'edit-customer', '_wpnonce', false, true ); ?> |
|
353 | + <?php wp_nonce_field('edit-customer', '_wpnonce', false, true); ?> |
|
354 | 354 | <input type="hidden" name="give_action" value="edit-customer" /> |
355 | - <input type="submit" id="give-edit-customer-save" class="button-secondary" value="<?php _e( 'Update Donor', 'give' ); ?>" /> |
|
356 | - <a id="give-edit-customer-cancel" href="" class="delete"><?php _e( 'Cancel', 'give' ); ?></a> |
|
355 | + <input type="submit" id="give-edit-customer-save" class="button-secondary" value="<?php _e('Update Donor', 'give'); ?>" /> |
|
356 | + <a id="give-edit-customer-cancel" href="" class="delete"><?php _e('Cancel', 'give'); ?></a> |
|
357 | 357 | </span> |
358 | 358 | |
359 | 359 | </form> |
360 | 360 | </div> |
361 | 361 | |
362 | - <?php do_action( 'give_donor_before_stats', $customer ); ?> |
|
362 | + <?php do_action('give_donor_before_stats', $customer); ?> |
|
363 | 363 | |
364 | 364 | <div id="customer-stats-wrapper" class="customer-section postbox clear"> |
365 | 365 | <ul> |
366 | 366 | <li> |
367 | - <a title="<?php _e( 'View All Donations', 'give' ); ?>" href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $customer->email ) ); ?>"> |
|
367 | + <a title="<?php _e('View All Donations', 'give'); ?>" href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history&user='.urlencode($customer->email)); ?>"> |
|
368 | 368 | <span class="dashicons dashicons-heart"></span> |
369 | 369 | <?php |
370 | 370 | //Completed Donations |
371 | - $completed_donations_text = sprintf( _n( '%d Completed Donation', '%d Completed Donations', $customer->purchase_count, 'give' ), $customer->purchase_count ); |
|
372 | - echo apply_filters( 'give_donor_completed_donations', $completed_donations_text, $customer ); |
|
371 | + $completed_donations_text = sprintf(_n('%d Completed Donation', '%d Completed Donations', $customer->purchase_count, 'give'), $customer->purchase_count); |
|
372 | + echo apply_filters('give_donor_completed_donations', $completed_donations_text, $customer); |
|
373 | 373 | ?> |
374 | 374 | </a> |
375 | 375 | </li> |
376 | 376 | <li> |
377 | 377 | <span class="dashicons dashicons-chart-area"></span> |
378 | - <?php echo give_currency_filter( give_format_amount( $customer->purchase_value ) ); ?> <?php _e( 'Lifetime Donations', 'give' ); ?> |
|
378 | + <?php echo give_currency_filter(give_format_amount($customer->purchase_value)); ?> <?php _e('Lifetime Donations', 'give'); ?> |
|
379 | 379 | </li> |
380 | - <?php do_action( 'give_donor_stats_list', $customer ); ?> |
|
380 | + <?php do_action('give_donor_stats_list', $customer); ?> |
|
381 | 381 | </ul> |
382 | 382 | </div> |
383 | 383 | |
384 | - <?php do_action( 'give_donor_before_tables_wrapper', $customer ); ?> |
|
384 | + <?php do_action('give_donor_before_tables_wrapper', $customer); ?> |
|
385 | 385 | |
386 | 386 | <div id="customer-tables-wrapper" class="customer-section"> |
387 | 387 | |
388 | - <?php do_action( 'give_donor_before_tables', $customer ); ?> |
|
388 | + <?php do_action('give_donor_before_tables', $customer); ?> |
|
389 | 389 | |
390 | - <h3><?php _e( 'Recent Donations', 'give' ); ?></h3> |
|
390 | + <h3><?php _e('Recent Donations', 'give'); ?></h3> |
|
391 | 391 | <?php |
392 | - $payment_ids = explode( ',', $customer->payment_ids ); |
|
393 | - $payments = give_get_payments( array( 'post__in' => $payment_ids ) ); |
|
394 | - $payments = array_slice( $payments, 0, 10 ); |
|
392 | + $payment_ids = explode(',', $customer->payment_ids); |
|
393 | + $payments = give_get_payments(array('post__in' => $payment_ids)); |
|
394 | + $payments = array_slice($payments, 0, 10); |
|
395 | 395 | ?> |
396 | 396 | <table class="wp-list-table widefat striped payments"> |
397 | 397 | <thead> |
398 | 398 | <tr> |
399 | - <th><?php _e( 'ID', 'give' ); ?></th> |
|
400 | - <th><?php _e( 'Amount', 'give' ); ?></th> |
|
401 | - <th><?php _e( 'Date', 'give' ); ?></th> |
|
402 | - <th><?php _e( 'Status', 'give' ); ?></th> |
|
403 | - <th><?php _e( 'Actions', 'give' ); ?></th> |
|
399 | + <th><?php _e('ID', 'give'); ?></th> |
|
400 | + <th><?php _e('Amount', 'give'); ?></th> |
|
401 | + <th><?php _e('Date', 'give'); ?></th> |
|
402 | + <th><?php _e('Status', 'give'); ?></th> |
|
403 | + <th><?php _e('Actions', 'give'); ?></th> |
|
404 | 404 | </tr> |
405 | 405 | </thead> |
406 | 406 | <tbody> |
407 | - <?php if ( ! empty( $payments ) ) : ?> |
|
408 | - <?php foreach ( $payments as $payment ) : ?> |
|
407 | + <?php if ( ! empty($payments)) : ?> |
|
408 | + <?php foreach ($payments as $payment) : ?> |
|
409 | 409 | <tr> |
410 | 410 | <td><?php echo $payment->ID; ?></td> |
411 | - <td><?php echo give_payment_amount( $payment->ID ); ?></td> |
|
412 | - <td><?php echo date_i18n( get_option( 'date_format' ), strtotime( $payment->post_date ) ); ?></td> |
|
413 | - <td><?php echo give_get_payment_status( $payment, true ); ?></td> |
|
411 | + <td><?php echo give_payment_amount($payment->ID); ?></td> |
|
412 | + <td><?php echo date_i18n(get_option('date_format'), strtotime($payment->post_date)); ?></td> |
|
413 | + <td><?php echo give_get_payment_status($payment, true); ?></td> |
|
414 | 414 | <td> |
415 | - <a title="<?php _e( 'View Details for Donation', 'give' ); |
|
416 | - echo ' ' . $payment->ID; ?>" href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $payment->ID ); ?>"> |
|
417 | - <?php _e( 'View Details', 'give' ); ?> |
|
415 | + <a title="<?php _e('View Details for Donation', 'give'); |
|
416 | + echo ' '.$payment->ID; ?>" href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id='.$payment->ID); ?>"> |
|
417 | + <?php _e('View Details', 'give'); ?> |
|
418 | 418 | </a> |
419 | - <?php do_action( 'give_donor_recent_purchases_actions', $customer, $payment ); ?> |
|
419 | + <?php do_action('give_donor_recent_purchases_actions', $customer, $payment); ?> |
|
420 | 420 | </td> |
421 | 421 | </tr> |
422 | 422 | <?php endforeach; ?> |
423 | 423 | <?php else: ?> |
424 | 424 | <tr> |
425 | - <td colspan="5"><?php _e( 'No Donations Found', 'give' ); ?></td> |
|
425 | + <td colspan="5"><?php _e('No Donations Found', 'give'); ?></td> |
|
426 | 426 | </tr> |
427 | 427 | <?php endif; ?> |
428 | 428 | </tbody> |
429 | 429 | </table> |
430 | 430 | |
431 | - <h3><?php _e( 'Completed Donations', 'give' ); ?></h3> |
|
431 | + <h3><?php _e('Completed Donations', 'give'); ?></h3> |
|
432 | 432 | <?php |
433 | - $donations = give_get_users_completed_donations( $customer->email ); |
|
433 | + $donations = give_get_users_completed_donations($customer->email); |
|
434 | 434 | ?> |
435 | 435 | <table class="wp-list-table widefat striped donations"> |
436 | 436 | <thead> |
437 | 437 | <tr> |
438 | 438 | <th><?php echo give_get_forms_label_singular(); ?></th> |
439 | - <th width="120px"><?php _e( 'Actions', 'give' ); ?></th> |
|
439 | + <th width="120px"><?php _e('Actions', 'give'); ?></th> |
|
440 | 440 | </tr> |
441 | 441 | </thead> |
442 | 442 | <tbody> |
443 | - <?php if ( ! empty( $donations ) ) : ?> |
|
444 | - <?php foreach ( $donations as $donation ) : ?> |
|
443 | + <?php if ( ! empty($donations)) : ?> |
|
444 | + <?php foreach ($donations as $donation) : ?> |
|
445 | 445 | <tr> |
446 | 446 | <td><?php echo $donation->post_title; ?></td> |
447 | 447 | <td> |
448 | - <a title="<?php echo esc_attr( sprintf( __( 'View %s', 'give' ), $donation->post_title ) ); ?>" href="<?php echo esc_url( admin_url( 'post.php?action=edit&post=' . $donation->ID ) ); ?>"> |
|
449 | - <?php printf( __( 'View %s', 'give' ), give_get_forms_label_singular() ); ?> |
|
448 | + <a title="<?php echo esc_attr(sprintf(__('View %s', 'give'), $donation->post_title)); ?>" href="<?php echo esc_url(admin_url('post.php?action=edit&post='.$donation->ID)); ?>"> |
|
449 | + <?php printf(__('View %s', 'give'), give_get_forms_label_singular()); ?> |
|
450 | 450 | </a> |
451 | 451 | </td> |
452 | 452 | </tr> |
453 | 453 | <?php endforeach; ?> |
454 | 454 | <?php else: ?> |
455 | 455 | <tr> |
456 | - <td colspan="2"><?php _e( 'No Completed Donations Found', 'give' ); ?></td> |
|
456 | + <td colspan="2"><?php _e('No Completed Donations Found', 'give'); ?></td> |
|
457 | 457 | </tr> |
458 | 458 | <?php endif; ?> |
459 | 459 | </tbody> |
460 | 460 | </table> |
461 | 461 | |
462 | - <?php do_action( 'give_donor_after_tables', $customer ); ?> |
|
462 | + <?php do_action('give_donor_after_tables', $customer); ?> |
|
463 | 463 | |
464 | 464 | </div> |
465 | 465 | |
466 | - <?php do_action( 'give_donor_card_bottom', $customer ); ?> |
|
466 | + <?php do_action('give_donor_card_bottom', $customer); ?> |
|
467 | 467 | |
468 | 468 | <?php |
469 | 469 | } |
@@ -477,30 +477,30 @@ discard block |
||
477 | 477 | * |
478 | 478 | * @return void |
479 | 479 | */ |
480 | -function give_customer_notes_view( $customer ) { |
|
480 | +function give_customer_notes_view($customer) { |
|
481 | 481 | |
482 | - $paged = isset( $_GET['paged'] ) && is_numeric( $_GET['paged'] ) ? $_GET['paged'] : 1; |
|
483 | - $paged = absint( $paged ); |
|
482 | + $paged = isset($_GET['paged']) && is_numeric($_GET['paged']) ? $_GET['paged'] : 1; |
|
483 | + $paged = absint($paged); |
|
484 | 484 | $note_count = $customer->get_notes_count(); |
485 | - $per_page = apply_filters( 'give_customer_notes_per_page', 20 ); |
|
486 | - $total_pages = ceil( $note_count / $per_page ); |
|
487 | - $customer_notes = $customer->get_notes( $per_page, $paged ); |
|
485 | + $per_page = apply_filters('give_customer_notes_per_page', 20); |
|
486 | + $total_pages = ceil($note_count / $per_page); |
|
487 | + $customer_notes = $customer->get_notes($per_page, $paged); |
|
488 | 488 | ?> |
489 | 489 | |
490 | 490 | <div id="customer-notes-wrapper"> |
491 | 491 | <div class="customer-notes-header"> |
492 | - <?php echo get_avatar( $customer->email, 30 ); ?> <span><?php echo $customer->name; ?></span> |
|
492 | + <?php echo get_avatar($customer->email, 30); ?> <span><?php echo $customer->name; ?></span> |
|
493 | 493 | </div> |
494 | - <h3><?php _e( 'Notes', 'give' ); ?></h3> |
|
494 | + <h3><?php _e('Notes', 'give'); ?></h3> |
|
495 | 495 | |
496 | - <?php if ( 1 == $paged ) : ?> |
|
496 | + <?php if (1 == $paged) : ?> |
|
497 | 497 | <div style="display: block; margin-bottom: 55px;"> |
498 | - <form id="give-add-customer-note" method="post" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=notes&id=' . $customer->id ); ?>"> |
|
498 | + <form id="give-add-customer-note" method="post" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=notes&id='.$customer->id); ?>"> |
|
499 | 499 | <textarea id="customer-note" name="customer_note" class="customer-note-input" rows="10"></textarea> |
500 | 500 | <br /> |
501 | 501 | <input type="hidden" id="customer-id" name="customer_id" value="<?php echo $customer->id; ?>" /> |
502 | 502 | <input type="hidden" name="give_action" value="add-customer-note" /> |
503 | - <?php wp_nonce_field( 'add-customer-note', 'add_customer_note_nonce', true, true ); ?> |
|
503 | + <?php wp_nonce_field('add-customer-note', 'add_customer_note_nonce', true, true); ?> |
|
504 | 504 | <input id="add-customer-note" class="right button-primary" type="submit" value="Add Note" /> |
505 | 505 | </form> |
506 | 506 | </div> |
@@ -515,46 +515,46 @@ discard block |
||
515 | 515 | 'show_all' => true |
516 | 516 | ); |
517 | 517 | |
518 | - echo paginate_links( $pagination_args ); |
|
518 | + echo paginate_links($pagination_args); |
|
519 | 519 | ?> |
520 | 520 | |
521 | 521 | <div id="give-customer-notes" class="postbox"> |
522 | - <?php if ( count( $customer_notes ) > 0 ) : ?> |
|
523 | - <?php foreach ( $customer_notes as $key => $note ) : ?> |
|
522 | + <?php if (count($customer_notes) > 0) : ?> |
|
523 | + <?php foreach ($customer_notes as $key => $note) : ?> |
|
524 | 524 | <div class="customer-note-wrapper dashboard-comment-wrap comment-item"> |
525 | 525 | <span class="note-content-wrap"> |
526 | - <?php echo stripslashes( $note ); ?> |
|
526 | + <?php echo stripslashes($note); ?> |
|
527 | 527 | </span> |
528 | 528 | </div> |
529 | 529 | <?php endforeach; ?> |
530 | 530 | <?php else: ?> |
531 | 531 | <div class="give-no-customer-notes"> |
532 | - <?php _e( 'No Donor Notes', 'give' ); ?> |
|
532 | + <?php _e('No Donor Notes', 'give'); ?> |
|
533 | 533 | </div> |
534 | 534 | <?php endif; ?> |
535 | 535 | </div> |
536 | 536 | |
537 | - <?php echo paginate_links( $pagination_args ); ?> |
|
537 | + <?php echo paginate_links($pagination_args); ?> |
|
538 | 538 | |
539 | 539 | </div> |
540 | 540 | |
541 | 541 | <?php |
542 | 542 | } |
543 | 543 | |
544 | -function give_customers_delete_view( $customer ) { |
|
544 | +function give_customers_delete_view($customer) { |
|
545 | 545 | |
546 | - $customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' ); |
|
546 | + $customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments'); |
|
547 | 547 | |
548 | 548 | ?> |
549 | 549 | |
550 | - <?php do_action( 'give_customer_delete_top', $customer ); ?> |
|
550 | + <?php do_action('give_customer_delete_top', $customer); ?> |
|
551 | 551 | |
552 | 552 | <div class="info-wrapper customer-section"> |
553 | 553 | |
554 | - <form id="delete-customer" method="post" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=delete&id=' . $customer->id ); ?>"> |
|
554 | + <form id="delete-customer" method="post" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=delete&id='.$customer->id); ?>"> |
|
555 | 555 | |
556 | 556 | <div class="customer-notes-header"> |
557 | - <?php echo get_avatar( $customer->email, 30 ); ?> <span><?php echo $customer->name; ?></span> |
|
557 | + <?php echo get_avatar($customer->email, 30); ?> <span><?php echo $customer->name; ?></span> |
|
558 | 558 | </div> |
559 | 559 | |
560 | 560 | |
@@ -562,27 +562,27 @@ discard block |
||
562 | 562 | |
563 | 563 | <span class="delete-customer-options"> |
564 | 564 | <p> |
565 | - <?php echo Give()->html->checkbox( array( 'name' => 'give-customer-delete-confirm' ) ); ?> |
|
566 | - <label for="give-customer-delete-confirm"><?php _e( 'Are you sure you want to delete this donor?', 'give' ); ?></label> |
|
565 | + <?php echo Give()->html->checkbox(array('name' => 'give-customer-delete-confirm')); ?> |
|
566 | + <label for="give-customer-delete-confirm"><?php _e('Are you sure you want to delete this donor?', 'give'); ?></label> |
|
567 | 567 | </p> |
568 | 568 | |
569 | 569 | <p> |
570 | - <?php echo Give()->html->checkbox( array( |
|
570 | + <?php echo Give()->html->checkbox(array( |
|
571 | 571 | 'name' => 'give-customer-delete-records', |
572 | - 'options' => array( 'disabled' => true ) |
|
573 | - ) ); ?> |
|
574 | - <label for="give-customer-delete-records"><?php _e( 'Delete all associated payments and records?', 'give' ); ?></label> |
|
572 | + 'options' => array('disabled' => true) |
|
573 | + )); ?> |
|
574 | + <label for="give-customer-delete-records"><?php _e('Delete all associated payments and records?', 'give'); ?></label> |
|
575 | 575 | </p> |
576 | 576 | |
577 | - <?php do_action( 'give_customer_delete_inputs', $customer ); ?> |
|
577 | + <?php do_action('give_customer_delete_inputs', $customer); ?> |
|
578 | 578 | </span> |
579 | 579 | |
580 | 580 | <span id="customer-edit-actions"> |
581 | 581 | <input type="hidden" name="customer_id" value="<?php echo $customer->id; ?>" /> |
582 | - <?php wp_nonce_field( 'delete-customer', '_wpnonce', false, true ); ?> |
|
582 | + <?php wp_nonce_field('delete-customer', '_wpnonce', false, true); ?> |
|
583 | 583 | <input type="hidden" name="give_action" value="delete-customer" /> |
584 | - <input type="submit" disabled="disabled" id="give-delete-customer" class="button-primary" value="<?php _e( 'Delete Donor', 'give' ); ?>" /> |
|
585 | - <a id="give-delete-customer-cancel" href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer->id ); ?>" class="delete"><?php _e( 'Cancel', 'give' ); ?></a> |
|
584 | + <input type="submit" disabled="disabled" id="give-delete-customer" class="button-primary" value="<?php _e('Delete Donor', 'give'); ?>" /> |
|
585 | + <a id="give-delete-customer-cancel" href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer->id); ?>" class="delete"><?php _e('Cancel', 'give'); ?></a> |
|
586 | 586 | </span> |
587 | 587 | |
588 | 588 | </div> |
@@ -592,5 +592,5 @@ discard block |
||
592 | 592 | |
593 | 593 | <?php |
594 | 594 | |
595 | - do_action( 'give_customer_delete_bottom', $customer ); |
|
595 | + do_action('give_customer_delete_bottom', $customer); |
|
596 | 596 | } |
@@ -259,8 +259,11 @@ discard block |
||
259 | 259 | <span class="customer-user-id info-item editable"> |
260 | 260 | <?php if ( intval( $customer->user_id ) > 0 ) : ?> |
261 | 261 | <span data-key="user_id"><?php echo $customer->user_id; ?></span> |
262 | - <?php else : ?> |
|
263 | - <span data-key="user_id"><?php _e( 'None', 'give' ); ?></span> |
|
262 | + <?php else { |
|
263 | + : ?> |
|
264 | + <span data-key="user_id"><?php _e( 'None', 'give' ); |
|
265 | +} |
|
266 | +?></span> |
|
264 | 267 | <?php endif; ?> |
265 | 268 | <?php if ( current_user_can( $customer_edit_role ) && intval( $customer->user_id ) > 0 ) : ?> |
266 | 269 | <span class="disconnect-user"> - <a id="disconnect-customer" href="#disconnect" title="<?php _e( 'Disconnects the current user ID from this customer record', 'give' ); ?>"><?php _e( 'Disconnect User', 'give' ); ?></a></span> |
@@ -329,8 +332,11 @@ discard block |
||
329 | 332 | } |
330 | 333 | ?> |
331 | 334 | </select> |
332 | - <?php else : ?> |
|
333 | - <input type="text" size="6" data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-input info-item" placeholder="<?php _e( 'State / Province', 'give' ); ?>" /> |
|
335 | + <?php else { |
|
336 | + : ?> |
|
337 | + <input type="text" size="6" data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-input info-item" placeholder="<?php _e( 'State / Province', 'give' ); |
|
338 | +} |
|
339 | +?>" /> |
|
334 | 340 | <?php endif; ?> |
335 | 341 | <input class="info-item" type="text" data-key="zip" name="customerinfo[zip]" placeholder="<?php _e( 'Postal', 'give' ); ?>" value="<?php echo $address['zip']; ?>" /> |
336 | 342 | </span> |
@@ -420,9 +426,12 @@ discard block |
||
420 | 426 | </td> |
421 | 427 | </tr> |
422 | 428 | <?php endforeach; ?> |
423 | - <?php else: ?> |
|
429 | + <?php else { |
|
430 | + : ?> |
|
424 | 431 | <tr> |
425 | - <td colspan="5"><?php _e( 'No Donations Found', 'give' ); ?></td> |
|
432 | + <td colspan="5"><?php _e( 'No Donations Found', 'give' ); |
|
433 | +} |
|
434 | +?></td> |
|
426 | 435 | </tr> |
427 | 436 | <?php endif; ?> |
428 | 437 | </tbody> |
@@ -451,9 +460,12 @@ discard block |
||
451 | 460 | </td> |
452 | 461 | </tr> |
453 | 462 | <?php endforeach; ?> |
454 | - <?php else: ?> |
|
463 | + <?php else { |
|
464 | + : ?> |
|
455 | 465 | <tr> |
456 | - <td colspan="2"><?php _e( 'No Completed Donations Found', 'give' ); ?></td> |
|
466 | + <td colspan="2"><?php _e( 'No Completed Donations Found', 'give' ); |
|
467 | +} |
|
468 | +?></td> |
|
457 | 469 | </tr> |
458 | 470 | <?php endif; ?> |
459 | 471 | </tbody> |
@@ -527,9 +539,12 @@ discard block |
||
527 | 539 | </span> |
528 | 540 | </div> |
529 | 541 | <?php endforeach; ?> |
530 | - <?php else: ?> |
|
542 | + <?php else { |
|
543 | + : ?> |
|
531 | 544 | <div class="give-no-customer-notes"> |
532 | - <?php _e( 'No Donor Notes', 'give' ); ?> |
|
545 | + <?php _e( 'No Donor Notes', 'give' ); |
|
546 | +} |
|
547 | +?> |
|
533 | 548 | </div> |
534 | 549 | <?php endif; ?> |
535 | 550 | </div> |
@@ -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 | |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * |
34 | 34 | * @return string $output Give forms dropdown |
35 | 35 | */ |
36 | - public function forms_dropdown( $args = array() ) { |
|
36 | + public function forms_dropdown($args = array()) { |
|
37 | 37 | |
38 | 38 | $defaults = array( |
39 | 39 | 'name' => 'forms', |
@@ -43,43 +43,43 @@ discard block |
||
43 | 43 | 'selected' => 0, |
44 | 44 | 'chosen' => false, |
45 | 45 | 'number' => 30, |
46 | - 'placeholder' => sprintf( __( 'Select a %s', 'give' ), give_get_forms_label_singular() ) |
|
46 | + 'placeholder' => sprintf(__('Select a %s', 'give'), give_get_forms_label_singular()) |
|
47 | 47 | ); |
48 | 48 | |
49 | - $args = wp_parse_args( $args, $defaults ); |
|
49 | + $args = wp_parse_args($args, $defaults); |
|
50 | 50 | |
51 | - $forms = get_posts( array( |
|
51 | + $forms = get_posts(array( |
|
52 | 52 | 'post_type' => 'give_forms', |
53 | 53 | 'orderby' => 'title', |
54 | 54 | 'order' => 'ASC', |
55 | 55 | 'posts_per_page' => $args['number'] |
56 | - ) ); |
|
56 | + )); |
|
57 | 57 | |
58 | 58 | $options = array(); |
59 | 59 | |
60 | - if ( $forms ) { |
|
61 | - $options[0] = sprintf( __( 'Select a %s', 'give' ), give_get_forms_label_singular() ); |
|
62 | - foreach ( $forms as $form ) { |
|
63 | - $options[ absint( $form->ID ) ] = esc_html( $form->post_title ); |
|
60 | + if ($forms) { |
|
61 | + $options[0] = sprintf(__('Select a %s', 'give'), give_get_forms_label_singular()); |
|
62 | + foreach ($forms as $form) { |
|
63 | + $options[absint($form->ID)] = esc_html($form->post_title); |
|
64 | 64 | } |
65 | 65 | } else { |
66 | - $options[0] = __( 'No Give Forms Found', 'give' ); |
|
66 | + $options[0] = __('No Give Forms Found', 'give'); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | // This ensures that any selected forms are included in the drop down |
70 | - if ( is_array( $args['selected'] ) ) { |
|
71 | - foreach ( $args['selected'] as $item ) { |
|
72 | - if ( ! in_array( $item, $options ) ) { |
|
73 | - $options[ $item ] = get_the_title( $item ); |
|
70 | + if (is_array($args['selected'])) { |
|
71 | + foreach ($args['selected'] as $item) { |
|
72 | + if ( ! in_array($item, $options)) { |
|
73 | + $options[$item] = get_the_title($item); |
|
74 | 74 | } |
75 | 75 | } |
76 | - } elseif ( is_numeric( $args['selected'] ) && $args['selected'] !== 0 ) { |
|
77 | - if ( ! in_array( $args['selected'], $options ) ) { |
|
78 | - $options[ $args['selected'] ] = get_the_title( $args['selected'] ); |
|
76 | + } elseif (is_numeric($args['selected']) && $args['selected'] !== 0) { |
|
77 | + if ( ! in_array($args['selected'], $options)) { |
|
78 | + $options[$args['selected']] = get_the_title($args['selected']); |
|
79 | 79 | } |
80 | 80 | } |
81 | 81 | |
82 | - $output = $this->select( array( |
|
82 | + $output = $this->select(array( |
|
83 | 83 | 'name' => $args['name'], |
84 | 84 | 'selected' => $args['selected'], |
85 | 85 | 'id' => $args['id'], |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | 'placeholder' => $args['placeholder'], |
91 | 91 | 'show_option_all' => false, |
92 | 92 | 'show_option_none' => false |
93 | - ) ); |
|
93 | + )); |
|
94 | 94 | |
95 | 95 | return $output; |
96 | 96 | } |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | * |
106 | 106 | * @return string $output Donor dropdown |
107 | 107 | */ |
108 | - public function donor_dropdown( $args = array() ) { |
|
108 | + public function donor_dropdown($args = array()) { |
|
109 | 109 | |
110 | 110 | $defaults = array( |
111 | 111 | 'name' => 'customers', |
@@ -114,38 +114,38 @@ discard block |
||
114 | 114 | 'multiple' => false, |
115 | 115 | 'selected' => 0, |
116 | 116 | 'chosen' => true, |
117 | - 'placeholder' => __( 'Select a Donor', 'give' ), |
|
117 | + 'placeholder' => __('Select a Donor', 'give'), |
|
118 | 118 | 'number' => 30 |
119 | 119 | ); |
120 | 120 | |
121 | - $args = wp_parse_args( $args, $defaults ); |
|
121 | + $args = wp_parse_args($args, $defaults); |
|
122 | 122 | |
123 | - $customers = Give()->customers->get_customers( array( |
|
123 | + $customers = Give()->customers->get_customers(array( |
|
124 | 124 | 'number' => $args['number'] |
125 | - ) ); |
|
125 | + )); |
|
126 | 126 | |
127 | 127 | $options = array(); |
128 | 128 | |
129 | - if ( $customers ) { |
|
130 | - $options[0] = __( 'No donor attached', 'give' ); |
|
131 | - foreach ( $customers as $customer ) { |
|
132 | - $options[ absint( $customer->id ) ] = esc_html( $customer->name . ' (' . $customer->email . ')' ); |
|
129 | + if ($customers) { |
|
130 | + $options[0] = __('No donor attached', 'give'); |
|
131 | + foreach ($customers as $customer) { |
|
132 | + $options[absint($customer->id)] = esc_html($customer->name.' ('.$customer->email.')'); |
|
133 | 133 | } |
134 | 134 | } else { |
135 | - $options[0] = __( 'No donors found', 'give' ); |
|
135 | + $options[0] = __('No donors found', 'give'); |
|
136 | 136 | } |
137 | 137 | |
138 | - if ( ! empty( $args['selected'] ) ) { |
|
138 | + if ( ! empty($args['selected'])) { |
|
139 | 139 | |
140 | 140 | // If a selected customer has been specified, we need to ensure it's in the initial list of customers displayed |
141 | 141 | |
142 | - if ( ! array_key_exists( $args['selected'], $options ) ) { |
|
142 | + if ( ! array_key_exists($args['selected'], $options)) { |
|
143 | 143 | |
144 | - $customer = new Give_Customer( $args['selected'] ); |
|
144 | + $customer = new Give_Customer($args['selected']); |
|
145 | 145 | |
146 | - if ( $customer ) { |
|
146 | + if ($customer) { |
|
147 | 147 | |
148 | - $options[ absint( $args['selected'] ) ] = esc_html( $customer->name . ' (' . $customer->email . ')' ); |
|
148 | + $options[absint($args['selected'])] = esc_html($customer->name.' ('.$customer->email.')'); |
|
149 | 149 | |
150 | 150 | } |
151 | 151 | |
@@ -153,17 +153,17 @@ discard block |
||
153 | 153 | |
154 | 154 | } |
155 | 155 | |
156 | - $output = $this->select( array( |
|
156 | + $output = $this->select(array( |
|
157 | 157 | 'name' => $args['name'], |
158 | 158 | 'selected' => $args['selected'], |
159 | 159 | 'id' => $args['id'], |
160 | - 'class' => $args['class'] . ' give-customer-select', |
|
160 | + 'class' => $args['class'].' give-customer-select', |
|
161 | 161 | 'options' => $options, |
162 | 162 | 'multiple' => $args['multiple'], |
163 | 163 | 'chosen' => $args['chosen'], |
164 | 164 | 'show_option_all' => false, |
165 | 165 | 'show_option_none' => false |
166 | - ) ); |
|
166 | + )); |
|
167 | 167 | |
168 | 168 | return $output; |
169 | 169 | } |
@@ -180,21 +180,21 @@ discard block |
||
180 | 180 | * |
181 | 181 | * @return string $output Category dropdown |
182 | 182 | */ |
183 | - public function category_dropdown( $name = 'give_forms_categories', $selected = 0 ) { |
|
184 | - $categories = get_terms( 'give_forms_category', apply_filters( 'give_forms_category_dropdown', array() ) ); |
|
183 | + public function category_dropdown($name = 'give_forms_categories', $selected = 0) { |
|
184 | + $categories = get_terms('give_forms_category', apply_filters('give_forms_category_dropdown', array())); |
|
185 | 185 | $options = array(); |
186 | 186 | |
187 | - foreach ( $categories as $category ) { |
|
188 | - $options[ absint( $category->term_id ) ] = esc_html( $category->name ); |
|
187 | + foreach ($categories as $category) { |
|
188 | + $options[absint($category->term_id)] = esc_html($category->name); |
|
189 | 189 | } |
190 | 190 | |
191 | - $output = $this->select( array( |
|
191 | + $output = $this->select(array( |
|
192 | 192 | 'name' => $name, |
193 | 193 | 'selected' => $selected, |
194 | 194 | 'options' => $options, |
195 | - 'show_option_all' => __( 'All Categories', 'give' ), |
|
195 | + 'show_option_all' => __('All Categories', 'give'), |
|
196 | 196 | 'show_option_none' => false |
197 | - ) ); |
|
197 | + )); |
|
198 | 198 | |
199 | 199 | return $output; |
200 | 200 | } |
@@ -212,25 +212,25 @@ discard block |
||
212 | 212 | * |
213 | 213 | * @return string $output Year dropdown |
214 | 214 | */ |
215 | - public function year_dropdown( $name = 'year', $selected = 0, $years_before = 5, $years_after = 0 ) { |
|
216 | - $current = date( 'Y' ); |
|
217 | - $start_year = $current - absint( $years_before ); |
|
218 | - $end_year = $current + absint( $years_after ); |
|
219 | - $selected = empty( $selected ) ? date( 'Y' ) : $selected; |
|
215 | + public function year_dropdown($name = 'year', $selected = 0, $years_before = 5, $years_after = 0) { |
|
216 | + $current = date('Y'); |
|
217 | + $start_year = $current - absint($years_before); |
|
218 | + $end_year = $current + absint($years_after); |
|
219 | + $selected = empty($selected) ? date('Y') : $selected; |
|
220 | 220 | $options = array(); |
221 | 221 | |
222 | - while ( $start_year <= $end_year ) { |
|
223 | - $options[ absint( $start_year ) ] = $start_year; |
|
224 | - $start_year ++; |
|
222 | + while ($start_year <= $end_year) { |
|
223 | + $options[absint($start_year)] = $start_year; |
|
224 | + $start_year++; |
|
225 | 225 | } |
226 | 226 | |
227 | - $output = $this->select( array( |
|
227 | + $output = $this->select(array( |
|
228 | 228 | 'name' => $name, |
229 | 229 | 'selected' => $selected, |
230 | 230 | 'options' => $options, |
231 | 231 | 'show_option_all' => false, |
232 | 232 | 'show_option_none' => false |
233 | - ) ); |
|
233 | + )); |
|
234 | 234 | |
235 | 235 | return $output; |
236 | 236 | } |
@@ -247,23 +247,23 @@ discard block |
||
247 | 247 | * |
248 | 248 | * @return string $output Month dropdown |
249 | 249 | */ |
250 | - public function month_dropdown( $name = 'month', $selected = 0 ) { |
|
250 | + public function month_dropdown($name = 'month', $selected = 0) { |
|
251 | 251 | $month = 1; |
252 | 252 | $options = array(); |
253 | - $selected = empty( $selected ) ? date( 'n' ) : $selected; |
|
253 | + $selected = empty($selected) ? date('n') : $selected; |
|
254 | 254 | |
255 | - while ( $month <= 12 ) { |
|
256 | - $options[ absint( $month ) ] = give_month_num_to_name( $month ); |
|
257 | - $month ++; |
|
255 | + while ($month <= 12) { |
|
256 | + $options[absint($month)] = give_month_num_to_name($month); |
|
257 | + $month++; |
|
258 | 258 | } |
259 | 259 | |
260 | - $output = $this->select( array( |
|
260 | + $output = $this->select(array( |
|
261 | 261 | 'name' => $name, |
262 | 262 | 'selected' => $selected, |
263 | 263 | 'options' => $options, |
264 | 264 | 'show_option_all' => false, |
265 | 265 | 'show_option_none' => false |
266 | - ) ); |
|
266 | + )); |
|
267 | 267 | |
268 | 268 | return $output; |
269 | 269 | } |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | * |
278 | 278 | * @return string |
279 | 279 | */ |
280 | - public function select( $args = array() ) { |
|
280 | + public function select($args = array()) { |
|
281 | 281 | $defaults = array( |
282 | 282 | 'options' => array(), |
283 | 283 | 'name' => null, |
@@ -287,60 +287,60 @@ discard block |
||
287 | 287 | 'chosen' => false, |
288 | 288 | 'placeholder' => null, |
289 | 289 | 'multiple' => false, |
290 | - 'show_option_all' => __( 'All', 'give' ), |
|
291 | - 'show_option_none' => __( 'None', 'give' ) |
|
290 | + 'show_option_all' => __('All', 'give'), |
|
291 | + 'show_option_none' => __('None', 'give') |
|
292 | 292 | ); |
293 | 293 | |
294 | - $args = wp_parse_args( $args, $defaults ); |
|
294 | + $args = wp_parse_args($args, $defaults); |
|
295 | 295 | |
296 | 296 | |
297 | - if ( $args['multiple'] ) { |
|
297 | + if ($args['multiple']) { |
|
298 | 298 | $multiple = ' MULTIPLE'; |
299 | 299 | } else { |
300 | 300 | $multiple = ''; |
301 | 301 | } |
302 | 302 | |
303 | - if ( $args['chosen'] ) { |
|
303 | + if ($args['chosen']) { |
|
304 | 304 | $args['class'] .= ' give-select-chosen'; |
305 | 305 | } |
306 | 306 | |
307 | - if ( $args['placeholder'] ) { |
|
307 | + if ($args['placeholder']) { |
|
308 | 308 | $placeholder = $args['placeholder']; |
309 | 309 | } else { |
310 | 310 | $placeholder = ''; |
311 | 311 | } |
312 | 312 | |
313 | - $output = '<select name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( sanitize_key( str_replace( '-', '_', $args['id'] ) ) ) . '" class="give-select ' . esc_attr( $args['class'] ) . '"' . $multiple . ' data-placeholder="' . $placeholder . '">'; |
|
313 | + $output = '<select name="'.esc_attr($args['name']).'" id="'.esc_attr(sanitize_key(str_replace('-', '_', $args['id']))).'" class="give-select '.esc_attr($args['class']).'"'.$multiple.' data-placeholder="'.$placeholder.'">'; |
|
314 | 314 | |
315 | - if ( $args['show_option_all'] ) { |
|
316 | - if ( $args['multiple'] ) { |
|
317 | - $selected = selected( true, in_array( 0, $args['selected'] ), false ); |
|
315 | + if ($args['show_option_all']) { |
|
316 | + if ($args['multiple']) { |
|
317 | + $selected = selected(true, in_array(0, $args['selected']), false); |
|
318 | 318 | } else { |
319 | - $selected = selected( $args['selected'], 0, false ); |
|
319 | + $selected = selected($args['selected'], 0, false); |
|
320 | 320 | } |
321 | - $output .= '<option value="all"' . $selected . '>' . esc_html( $args['show_option_all'] ) . '</option>'; |
|
321 | + $output .= '<option value="all"'.$selected.'>'.esc_html($args['show_option_all']).'</option>'; |
|
322 | 322 | } |
323 | 323 | |
324 | - if ( ! empty( $args['options'] ) ) { |
|
324 | + if ( ! empty($args['options'])) { |
|
325 | 325 | |
326 | - if ( $args['show_option_none'] ) { |
|
327 | - if ( $args['multiple'] ) { |
|
328 | - $selected = selected( true, in_array( - 1, $args['selected'] ), false ); |
|
326 | + if ($args['show_option_none']) { |
|
327 | + if ($args['multiple']) { |
|
328 | + $selected = selected(true, in_array( -1, $args['selected'] ), false); |
|
329 | 329 | } else { |
330 | - $selected = selected( $args['selected'], - 1, false ); |
|
330 | + $selected = selected($args['selected'], - 1, false); |
|
331 | 331 | } |
332 | - $output .= '<option value="-1"' . $selected . '>' . esc_html( $args['show_option_none'] ) . '</option>'; |
|
332 | + $output .= '<option value="-1"'.$selected.'>'.esc_html($args['show_option_none']).'</option>'; |
|
333 | 333 | } |
334 | 334 | |
335 | - foreach ( $args['options'] as $key => $option ) { |
|
335 | + foreach ($args['options'] as $key => $option) { |
|
336 | 336 | |
337 | - if ( $args['multiple'] && is_array( $args['selected'] ) ) { |
|
338 | - $selected = selected( true, in_array( $key, $args['selected'] ), false ); |
|
337 | + if ($args['multiple'] && is_array($args['selected'])) { |
|
338 | + $selected = selected(true, in_array($key, $args['selected']), false); |
|
339 | 339 | } else { |
340 | - $selected = selected( $args['selected'], $key, false ); |
|
340 | + $selected = selected($args['selected'], $key, false); |
|
341 | 341 | } |
342 | 342 | |
343 | - $output .= '<option value="' . esc_attr( $key ) . '"' . $selected . '>' . esc_html( $option ) . '</option>'; |
|
343 | + $output .= '<option value="'.esc_attr($key).'"'.$selected.'>'.esc_html($option).'</option>'; |
|
344 | 344 | } |
345 | 345 | } |
346 | 346 | |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | * |
359 | 359 | * @return string |
360 | 360 | */ |
361 | - public function checkbox( $args = array() ) { |
|
361 | + public function checkbox($args = array()) { |
|
362 | 362 | $defaults = array( |
363 | 363 | 'name' => null, |
364 | 364 | 'current' => null, |
@@ -369,16 +369,16 @@ discard block |
||
369 | 369 | ) |
370 | 370 | ); |
371 | 371 | |
372 | - $args = wp_parse_args( $args, $defaults ); |
|
372 | + $args = wp_parse_args($args, $defaults); |
|
373 | 373 | |
374 | 374 | $options = ''; |
375 | - if ( ! empty( $args['options']['disabled'] ) ) { |
|
375 | + if ( ! empty($args['options']['disabled'])) { |
|
376 | 376 | $options .= ' disabled="disabled"'; |
377 | - } elseif ( ! empty( $args['options']['readonly'] ) ) { |
|
377 | + } elseif ( ! empty($args['options']['readonly'])) { |
|
378 | 378 | $options .= ' readonly'; |
379 | 379 | } |
380 | 380 | |
381 | - $output = '<input type="checkbox"' . $options . ' name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['name'] ) . '" class="' . $args['class'] . ' ' . esc_attr( $args['name'] ) . '" ' . checked( 1, $args['current'], false ) . ' />'; |
|
381 | + $output = '<input type="checkbox"'.$options.' name="'.esc_attr($args['name']).'" id="'.esc_attr($args['name']).'" class="'.$args['class'].' '.esc_attr($args['name']).'" '.checked(1, $args['current'], false).' />'; |
|
382 | 382 | |
383 | 383 | return $output; |
384 | 384 | } |
@@ -392,22 +392,22 @@ discard block |
||
392 | 392 | * |
393 | 393 | * @return string Text field |
394 | 394 | */ |
395 | - public function text( $args = array() ) { |
|
395 | + public function text($args = array()) { |
|
396 | 396 | // Backwards compatabliity |
397 | - if ( func_num_args() > 1 ) { |
|
397 | + if (func_num_args() > 1) { |
|
398 | 398 | $args = func_get_args(); |
399 | 399 | |
400 | 400 | $name = $args[0]; |
401 | - $value = isset( $args[1] ) ? $args[1] : ''; |
|
402 | - $label = isset( $args[2] ) ? $args[2] : ''; |
|
403 | - $desc = isset( $args[3] ) ? $args[3] : ''; |
|
401 | + $value = isset($args[1]) ? $args[1] : ''; |
|
402 | + $label = isset($args[2]) ? $args[2] : ''; |
|
403 | + $desc = isset($args[3]) ? $args[3] : ''; |
|
404 | 404 | } |
405 | 405 | |
406 | 406 | $defaults = array( |
407 | - 'name' => isset( $name ) ? $name : 'text', |
|
408 | - 'value' => isset( $value ) ? $value : null, |
|
409 | - 'label' => isset( $label ) ? $label : null, |
|
410 | - 'desc' => isset( $desc ) ? $desc : null, |
|
407 | + 'name' => isset($name) ? $name : 'text', |
|
408 | + 'value' => isset($value) ? $value : null, |
|
409 | + 'label' => isset($label) ? $label : null, |
|
410 | + 'desc' => isset($desc) ? $desc : null, |
|
411 | 411 | 'placeholder' => '', |
412 | 412 | 'class' => 'regular-text', |
413 | 413 | 'disabled' => false, |
@@ -415,29 +415,29 @@ discard block |
||
415 | 415 | 'data' => false |
416 | 416 | ); |
417 | 417 | |
418 | - $args = wp_parse_args( $args, $defaults ); |
|
418 | + $args = wp_parse_args($args, $defaults); |
|
419 | 419 | |
420 | 420 | $disabled = ''; |
421 | - if ( $args['disabled'] ) { |
|
421 | + if ($args['disabled']) { |
|
422 | 422 | $disabled = ' disabled="disabled"'; |
423 | 423 | } |
424 | 424 | |
425 | 425 | $data = ''; |
426 | - if ( ! empty( $args['data'] ) ) { |
|
427 | - foreach ( $args['data'] as $key => $value ) { |
|
428 | - $data .= 'data-' . $key . '="' . $value . '" '; |
|
426 | + if ( ! empty($args['data'])) { |
|
427 | + foreach ($args['data'] as $key => $value) { |
|
428 | + $data .= 'data-'.$key.'="'.$value.'" '; |
|
429 | 429 | } |
430 | 430 | } |
431 | 431 | |
432 | - $output = '<span id="give-' . sanitize_key( $args['name'] ) . '-wrap">'; |
|
432 | + $output = '<span id="give-'.sanitize_key($args['name']).'-wrap">'; |
|
433 | 433 | |
434 | - $output .= '<label class="give-label" for="give-' . sanitize_key( $args['name'] ) . '">' . esc_html( $args['label'] ) . '</label>'; |
|
434 | + $output .= '<label class="give-label" for="give-'.sanitize_key($args['name']).'">'.esc_html($args['label']).'</label>'; |
|
435 | 435 | |
436 | - if ( ! empty( $args['desc'] ) ) { |
|
437 | - $output .= '<span class="give-description">' . esc_html( $args['desc'] ) . '</span>'; |
|
436 | + if ( ! empty($args['desc'])) { |
|
437 | + $output .= '<span class="give-description">'.esc_html($args['desc']).'</span>'; |
|
438 | 438 | } |
439 | 439 | |
440 | - $output .= '<input type="text" name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['name'] ) . '" autocomplete="' . esc_attr( $args['autocomplete'] ) . '" value="' . esc_attr( $args['value'] ) . '" placeholder="' . esc_attr( $args['placeholder'] ) . '" class="' . $args['class'] . '" ' . $data . '' . $disabled . '/>'; |
|
440 | + $output .= '<input type="text" name="'.esc_attr($args['name']).'" id="'.esc_attr($args['name']).'" autocomplete="'.esc_attr($args['autocomplete']).'" value="'.esc_attr($args['value']).'" placeholder="'.esc_attr($args['placeholder']).'" class="'.$args['class'].'" '.$data.''.$disabled.'/>'; |
|
441 | 441 | |
442 | 442 | $output .= '</span>'; |
443 | 443 | |
@@ -453,15 +453,15 @@ discard block |
||
453 | 453 | * |
454 | 454 | * @return string Datepicker field |
455 | 455 | */ |
456 | - public function date_field( $args = array() ) { |
|
456 | + public function date_field($args = array()) { |
|
457 | 457 | |
458 | - if ( empty( $args['class'] ) ) { |
|
458 | + if (empty($args['class'])) { |
|
459 | 459 | $args['class'] = 'give_datepicker'; |
460 | - } elseif ( ! strpos( $args['class'], 'give_datepicker' ) ) { |
|
460 | + } elseif ( ! strpos($args['class'], 'give_datepicker')) { |
|
461 | 461 | $args['class'] .= ' give_datepicker'; |
462 | 462 | } |
463 | 463 | |
464 | - return $this->text( $args ); |
|
464 | + return $this->text($args); |
|
465 | 465 | } |
466 | 466 | |
467 | 467 | |
@@ -474,7 +474,7 @@ discard block |
||
474 | 474 | * |
475 | 475 | * @return string textarea |
476 | 476 | */ |
477 | - public function textarea( $args = array() ) { |
|
477 | + public function textarea($args = array()) { |
|
478 | 478 | $defaults = array( |
479 | 479 | 'name' => 'textarea', |
480 | 480 | 'value' => null, |
@@ -484,21 +484,21 @@ discard block |
||
484 | 484 | 'disabled' => false |
485 | 485 | ); |
486 | 486 | |
487 | - $args = wp_parse_args( $args, $defaults ); |
|
487 | + $args = wp_parse_args($args, $defaults); |
|
488 | 488 | |
489 | 489 | $disabled = ''; |
490 | - if ( $args['disabled'] ) { |
|
490 | + if ($args['disabled']) { |
|
491 | 491 | $disabled = ' disabled="disabled"'; |
492 | 492 | } |
493 | 493 | |
494 | - $output = '<span id="give-' . sanitize_key( $args['name'] ) . '-wrap">'; |
|
494 | + $output = '<span id="give-'.sanitize_key($args['name']).'-wrap">'; |
|
495 | 495 | |
496 | - $output .= '<label class="give-label" for="give-' . sanitize_key( $args['name'] ) . '">' . esc_html( $args['label'] ) . '</label>'; |
|
496 | + $output .= '<label class="give-label" for="give-'.sanitize_key($args['name']).'">'.esc_html($args['label']).'</label>'; |
|
497 | 497 | |
498 | - $output .= '<textarea name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['name'] ) . '" class="' . $args['class'] . '"' . $disabled . '>' . esc_attr( $args['value'] ) . '</textarea>'; |
|
498 | + $output .= '<textarea name="'.esc_attr($args['name']).'" id="'.esc_attr($args['name']).'" class="'.$args['class'].'"'.$disabled.'>'.esc_attr($args['value']).'</textarea>'; |
|
499 | 499 | |
500 | - if ( ! empty( $args['desc'] ) ) { |
|
501 | - $output .= '<span class="give-description">' . esc_html( $args['desc'] ) . '</span>'; |
|
500 | + if ( ! empty($args['desc'])) { |
|
501 | + $output .= '<span class="give-description">'.esc_html($args['desc']).'</span>'; |
|
502 | 502 | } |
503 | 503 | |
504 | 504 | $output .= '</span>'; |
@@ -515,12 +515,12 @@ discard block |
||
515 | 515 | * |
516 | 516 | * @return string text field with ajax search |
517 | 517 | */ |
518 | - public function ajax_user_search( $args = array() ) { |
|
518 | + public function ajax_user_search($args = array()) { |
|
519 | 519 | |
520 | 520 | $defaults = array( |
521 | 521 | 'name' => 'user_id', |
522 | 522 | 'value' => null, |
523 | - 'placeholder' => __( 'Enter username', 'give' ), |
|
523 | + 'placeholder' => __('Enter username', 'give'), |
|
524 | 524 | 'label' => null, |
525 | 525 | 'desc' => null, |
526 | 526 | 'class' => '', |
@@ -529,13 +529,13 @@ discard block |
||
529 | 529 | 'data' => false |
530 | 530 | ); |
531 | 531 | |
532 | - $args = wp_parse_args( $args, $defaults ); |
|
532 | + $args = wp_parse_args($args, $defaults); |
|
533 | 533 | |
534 | - $args['class'] = 'give-ajax-user-search ' . $args['class']; |
|
534 | + $args['class'] = 'give-ajax-user-search '.$args['class']; |
|
535 | 535 | |
536 | 536 | $output = '<span class="give_user_search_wrap">'; |
537 | - $output .= $this->text( $args ); |
|
538 | - $output .= '<span class="give_user_search_results hidden"><a class="give-ajax-user-cancel" title="' . __( 'Cancel', 'give' ) . '" aria-label="' . __( 'Cancel', 'give' ) . '" href="#">x</a><span></span></span>'; |
|
537 | + $output .= $this->text($args); |
|
538 | + $output .= '<span class="give_user_search_results hidden"><a class="give-ajax-user-cancel" title="'.__('Cancel', 'give').'" aria-label="'.__('Cancel', 'give').'" href="#">x</a><span></span></span>'; |
|
539 | 539 | $output .= '</span>'; |
540 | 540 | |
541 | 541 | return $output; |