@@ -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 | |
@@ -26,39 +26,39 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @return void |
28 | 28 | */ |
29 | -function give_email_donation_receipt( $payment_id, $admin_notice = true ) { |
|
29 | +function give_email_donation_receipt($payment_id, $admin_notice = true) { |
|
30 | 30 | |
31 | - $payment_data = give_get_payment_meta( $payment_id ); |
|
31 | + $payment_data = give_get_payment_meta($payment_id); |
|
32 | 32 | |
33 | - $from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ); |
|
34 | - $from_name = apply_filters( 'give_purchase_from_name', $from_name, $payment_id, $payment_data ); |
|
33 | + $from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)); |
|
34 | + $from_name = apply_filters('give_purchase_from_name', $from_name, $payment_id, $payment_data); |
|
35 | 35 | |
36 | - $from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) ); |
|
37 | - $from_email = apply_filters( 'give_purchase_from_address', $from_email, $payment_id, $payment_data ); |
|
36 | + $from_email = give_get_option('from_email', get_bloginfo('admin_email')); |
|
37 | + $from_email = apply_filters('give_purchase_from_address', $from_email, $payment_id, $payment_data); |
|
38 | 38 | |
39 | - $to_email = give_get_payment_user_email( $payment_id ); |
|
39 | + $to_email = give_get_payment_user_email($payment_id); |
|
40 | 40 | |
41 | - $subject = give_get_option( 'donation_subject', __( 'Donation Receipt', 'give' ) ); |
|
42 | - $subject = apply_filters( 'give_donation_subject', wp_strip_all_tags( $subject ), $payment_id ); |
|
43 | - $subject = give_do_email_tags( $subject, $payment_id ); |
|
41 | + $subject = give_get_option('donation_subject', __('Donation Receipt', 'give')); |
|
42 | + $subject = apply_filters('give_donation_subject', wp_strip_all_tags($subject), $payment_id); |
|
43 | + $subject = give_do_email_tags($subject, $payment_id); |
|
44 | 44 | |
45 | - $attachments = apply_filters( 'give_receipt_attachments', array(), $payment_id, $payment_data ); |
|
46 | - $message = give_do_email_tags( give_get_email_body_content( $payment_id, $payment_data ), $payment_id ); |
|
45 | + $attachments = apply_filters('give_receipt_attachments', array(), $payment_id, $payment_data); |
|
46 | + $message = give_do_email_tags(give_get_email_body_content($payment_id, $payment_data), $payment_id); |
|
47 | 47 | |
48 | 48 | $emails = Give()->emails; |
49 | 49 | |
50 | - $emails->__set( 'from_name', $from_name ); |
|
51 | - $emails->__set( 'from_email', $from_email ); |
|
52 | - $emails->__set( 'heading', __( 'Donation Receipt', 'give' ) ); |
|
50 | + $emails->__set('from_name', $from_name); |
|
51 | + $emails->__set('from_email', $from_email); |
|
52 | + $emails->__set('heading', __('Donation Receipt', 'give')); |
|
53 | 53 | |
54 | 54 | |
55 | - $headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data ); |
|
56 | - $emails->__set( 'headers', $headers ); |
|
55 | + $headers = apply_filters('give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data); |
|
56 | + $emails->__set('headers', $headers); |
|
57 | 57 | |
58 | - $emails->send( $to_email, $subject, $message, $attachments ); |
|
58 | + $emails->send($to_email, $subject, $message, $attachments); |
|
59 | 59 | |
60 | - if ( $admin_notice && ! give_admin_notices_disabled( $payment_id ) ) { |
|
61 | - do_action( 'give_admin_sale_notice', $payment_id, $payment_data ); |
|
60 | + if ($admin_notice && ! give_admin_notices_disabled($payment_id)) { |
|
61 | + do_action('give_admin_sale_notice', $payment_id, $payment_data); |
|
62 | 62 | } |
63 | 63 | } |
64 | 64 | |
@@ -71,29 +71,29 @@ discard block |
||
71 | 71 | */ |
72 | 72 | function give_email_test_donation_receipt() { |
73 | 73 | |
74 | - $from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ); |
|
75 | - $from_name = apply_filters( 'give_purchase_from_name', $from_name, 0, array() ); |
|
74 | + $from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)); |
|
75 | + $from_name = apply_filters('give_purchase_from_name', $from_name, 0, array()); |
|
76 | 76 | |
77 | - $from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) ); |
|
78 | - $from_email = apply_filters( 'give_purchase_from_address', $from_email, 0, array() ); |
|
77 | + $from_email = give_get_option('from_email', get_bloginfo('admin_email')); |
|
78 | + $from_email = apply_filters('give_purchase_from_address', $from_email, 0, array()); |
|
79 | 79 | |
80 | - $subject = give_get_option( 'donation_subject', __( 'Donation Receipt', 'give' ) ); |
|
81 | - $subject = apply_filters( 'give_donation_subject', wp_strip_all_tags( $subject ), 0 ); |
|
82 | - $subject = give_do_email_tags( $subject, 0 ); |
|
80 | + $subject = give_get_option('donation_subject', __('Donation Receipt', 'give')); |
|
81 | + $subject = apply_filters('give_donation_subject', wp_strip_all_tags($subject), 0); |
|
82 | + $subject = give_do_email_tags($subject, 0); |
|
83 | 83 | |
84 | - $attachments = apply_filters( 'give_receipt_attachments', array(), 0, array() ); |
|
84 | + $attachments = apply_filters('give_receipt_attachments', array(), 0, array()); |
|
85 | 85 | |
86 | - $message = give_email_preview_template_tags( give_get_email_body_content( 0, array() ) ); |
|
86 | + $message = give_email_preview_template_tags(give_get_email_body_content(0, array())); |
|
87 | 87 | |
88 | 88 | $emails = Give()->emails; |
89 | - $emails->__set( 'from_name', $from_name ); |
|
90 | - $emails->__set( 'from_email', $from_email ); |
|
91 | - $emails->__set( 'heading', __( 'Donation Receipt', 'give' ) ); |
|
89 | + $emails->__set('from_name', $from_name); |
|
90 | + $emails->__set('from_email', $from_email); |
|
91 | + $emails->__set('heading', __('Donation Receipt', 'give')); |
|
92 | 92 | |
93 | - $headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), 0, array() ); |
|
94 | - $emails->__set( 'headers', $headers ); |
|
93 | + $headers = apply_filters('give_receipt_headers', $emails->get_headers(), 0, array()); |
|
94 | + $emails->__set('headers', $headers); |
|
95 | 95 | |
96 | - $emails->send( give_get_admin_notice_emails(), $subject, $message, $attachments ); |
|
96 | + $emails->send(give_get_admin_notice_emails(), $subject, $message, $attachments); |
|
97 | 97 | |
98 | 98 | } |
99 | 99 | |
@@ -107,49 +107,49 @@ discard block |
||
107 | 107 | * |
108 | 108 | * @return void |
109 | 109 | */ |
110 | -function give_admin_email_notice( $payment_id = 0, $payment_data = array() ) { |
|
110 | +function give_admin_email_notice($payment_id = 0, $payment_data = array()) { |
|
111 | 111 | |
112 | - $payment_id = absint( $payment_id ); |
|
112 | + $payment_id = absint($payment_id); |
|
113 | 113 | |
114 | - if ( empty( $payment_id ) ) { |
|
114 | + if (empty($payment_id)) { |
|
115 | 115 | return; |
116 | 116 | } |
117 | 117 | |
118 | - if ( ! give_get_payment_by( 'id', $payment_id ) ) { |
|
118 | + if ( ! give_get_payment_by('id', $payment_id)) { |
|
119 | 119 | return; |
120 | 120 | } |
121 | 121 | |
122 | - $from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ); |
|
123 | - $from_name = apply_filters( 'give_purchase_from_name', $from_name, $payment_id, $payment_data ); |
|
122 | + $from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)); |
|
123 | + $from_name = apply_filters('give_purchase_from_name', $from_name, $payment_id, $payment_data); |
|
124 | 124 | |
125 | - $from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) ); |
|
126 | - $from_email = apply_filters( 'give_purchase_from_address', $from_email, $payment_id, $payment_data ); |
|
125 | + $from_email = give_get_option('from_email', get_bloginfo('admin_email')); |
|
126 | + $from_email = apply_filters('give_purchase_from_address', $from_email, $payment_id, $payment_data); |
|
127 | 127 | |
128 | - $subject = give_get_option( 'donation_notification_subject', sprintf( __( 'New Donation - Payment #%1$s', 'give' ), $payment_id ) ); |
|
129 | - $subject = apply_filters( 'give_admin_donation_notification_subject', wp_strip_all_tags( $subject ), $payment_id ); |
|
130 | - $subject = give_do_email_tags( $subject, $payment_id ); |
|
128 | + $subject = give_get_option('donation_notification_subject', sprintf(__('New Donation - Payment #%1$s', 'give'), $payment_id)); |
|
129 | + $subject = apply_filters('give_admin_donation_notification_subject', wp_strip_all_tags($subject), $payment_id); |
|
130 | + $subject = give_do_email_tags($subject, $payment_id); |
|
131 | 131 | |
132 | - $headers = "From: " . stripslashes_deep( html_entity_decode( $from_name, ENT_COMPAT, 'UTF-8' ) ) . " <$from_email>\r\n"; |
|
133 | - $headers .= "Reply-To: " . $from_email . "\r\n"; |
|
132 | + $headers = "From: ".stripslashes_deep(html_entity_decode($from_name, ENT_COMPAT, 'UTF-8'))." <$from_email>\r\n"; |
|
133 | + $headers .= "Reply-To: ".$from_email."\r\n"; |
|
134 | 134 | //$headers .= "MIME-Version: 1.0\r\n"; |
135 | 135 | $headers .= "Content-Type: text/html; charset=utf-8\r\n"; |
136 | - $headers = apply_filters( 'give_admin_donation_notification_headers', $headers, $payment_id, $payment_data ); |
|
136 | + $headers = apply_filters('give_admin_donation_notification_headers', $headers, $payment_id, $payment_data); |
|
137 | 137 | |
138 | - $attachments = apply_filters( 'give_admin_donation_notification_attachments', array(), $payment_id, $payment_data ); |
|
138 | + $attachments = apply_filters('give_admin_donation_notification_attachments', array(), $payment_id, $payment_data); |
|
139 | 139 | |
140 | - $message = give_get_donation_notification_body_content( $payment_id, $payment_data ); |
|
140 | + $message = give_get_donation_notification_body_content($payment_id, $payment_data); |
|
141 | 141 | |
142 | 142 | $emails = Give()->emails; |
143 | - $emails->__set( 'from_name', $from_name ); |
|
144 | - $emails->__set( 'from_email', $from_email ); |
|
145 | - $emails->__set( 'headers', $headers ); |
|
146 | - $emails->__set( 'heading', __( 'New Donation!', 'give' ) ); |
|
143 | + $emails->__set('from_name', $from_name); |
|
144 | + $emails->__set('from_email', $from_email); |
|
145 | + $emails->__set('headers', $headers); |
|
146 | + $emails->__set('heading', __('New Donation!', 'give')); |
|
147 | 147 | |
148 | - $emails->send( give_get_admin_notice_emails(), $subject, $message, $attachments ); |
|
148 | + $emails->send(give_get_admin_notice_emails(), $subject, $message, $attachments); |
|
149 | 149 | |
150 | 150 | } |
151 | 151 | |
152 | -add_action( 'give_admin_sale_notice', 'give_admin_email_notice', 10, 2 ); |
|
152 | +add_action('give_admin_sale_notice', 'give_admin_email_notice', 10, 2); |
|
153 | 153 | |
154 | 154 | /** |
155 | 155 | * Retrieves the emails for which admin notifications are sent to (these can be |
@@ -162,10 +162,10 @@ discard block |
||
162 | 162 | function give_get_admin_notice_emails() { |
163 | 163 | global $give_options; |
164 | 164 | |
165 | - $emails = isset( $give_options['admin_notice_emails'] ) && strlen( trim( $give_options['admin_notice_emails'] ) ) > 0 ? $give_options['admin_notice_emails'] : get_bloginfo( 'admin_email' ); |
|
166 | - $emails = array_map( 'trim', explode( "\n", $emails ) ); |
|
165 | + $emails = isset($give_options['admin_notice_emails']) && strlen(trim($give_options['admin_notice_emails'])) > 0 ? $give_options['admin_notice_emails'] : get_bloginfo('admin_email'); |
|
166 | + $emails = array_map('trim', explode("\n", $emails)); |
|
167 | 167 | |
168 | - return apply_filters( 'give_admin_notice_emails', $emails ); |
|
168 | + return apply_filters('give_admin_notice_emails', $emails); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | /** |
@@ -177,11 +177,11 @@ discard block |
||
177 | 177 | * |
178 | 178 | * @return mixed |
179 | 179 | */ |
180 | -function give_admin_notices_disabled( $payment_id = 0 ) { |
|
180 | +function give_admin_notices_disabled($payment_id = 0) { |
|
181 | 181 | global $give_options; |
182 | - $retval = isset( $give_options['disable_admin_notices'] ); |
|
182 | + $retval = isset($give_options['disable_admin_notices']); |
|
183 | 183 | |
184 | - return apply_filters( 'give_admin_notices_disabled', $retval, $payment_id ); |
|
184 | + return apply_filters('give_admin_notices_disabled', $retval, $payment_id); |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | /** |
@@ -195,16 +195,16 @@ discard block |
||
195 | 195 | function give_get_default_donation_notification_email() { |
196 | 196 | global $give_options; |
197 | 197 | |
198 | - $default_email_body = __( 'Hi there,', 'give' ) . "\n\n" . __( 'This email is to inform you that a new donation has been made on your website: ', 'give' ) . '<a href="' . get_bloginfo( 'url' ) . '" target="_blank">' . get_bloginfo( 'url' ) . '</a>' . ".\n\n"; |
|
199 | - $default_email_body .= '<strong>' . __( 'Donor: ', 'give' ) . '</strong> ' . ' {name}' . "\n"; |
|
200 | - $default_email_body .= '<strong>' . __( 'Donation: ', 'give' ) . '</strong> ' . ' {donation}' . "\n"; |
|
201 | - $default_email_body .= '<strong>' . __( 'Amount: ', 'give' ) . '</strong> ' . ' {price}' . "\n"; |
|
202 | - $default_email_body .= '<strong>' . __( 'Payment Method: ', 'give' ) . '</strong> ' . ' {payment_method}' . "\n\n"; |
|
203 | - $default_email_body .= __( 'Thank you,', 'give' ) . "\n\n" . '{sitename}'; |
|
198 | + $default_email_body = __('Hi there,', 'give')."\n\n".__('This email is to inform you that a new donation has been made on your website: ', 'give').'<a href="'.get_bloginfo('url').'" target="_blank">'.get_bloginfo('url').'</a>'.".\n\n"; |
|
199 | + $default_email_body .= '<strong>'.__('Donor: ', 'give').'</strong> '.' {name}'."\n"; |
|
200 | + $default_email_body .= '<strong>'.__('Donation: ', 'give').'</strong> '.' {donation}'."\n"; |
|
201 | + $default_email_body .= '<strong>'.__('Amount: ', 'give').'</strong> '.' {price}'."\n"; |
|
202 | + $default_email_body .= '<strong>'.__('Payment Method: ', 'give').'</strong> '.' {payment_method}'."\n\n"; |
|
203 | + $default_email_body .= __('Thank you,', 'give')."\n\n".'{sitename}'; |
|
204 | 204 | |
205 | - $message = ( isset( $give_options['donation_notification'] ) && ! empty( $give_options['donation_notification'] ) ) ? $give_options['donation_notification'] : $default_email_body; |
|
205 | + $message = (isset($give_options['donation_notification']) && ! empty($give_options['donation_notification'])) ? $give_options['donation_notification'] : $default_email_body; |
|
206 | 206 | |
207 | - return apply_filters( 'give_default_donation_notification_email', $message ); |
|
207 | + return apply_filters('give_default_donation_notification_email', $message); |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | |
@@ -219,24 +219,24 @@ discard block |
||
219 | 219 | function give_get_default_donation_receipt_email() { |
220 | 220 | global $give_options; |
221 | 221 | |
222 | - $default_email_body = __( 'Dear', 'give' ) . " {name},\n\n"; |
|
223 | - $default_email_body .= __( 'Thank you for your donation. Your generosity is appreciated! Here are the details of your donation:', 'give' ) . "\n\n"; |
|
224 | - $default_email_body .= '<strong>' . __( 'Donor', 'give' ) . ':</strong> ' . '{fullname}' . "\n"; |
|
225 | - $default_email_body .= '<strong>' . __( 'Donation', 'give' ) . ':</strong> ' . '{donation}' . "\n"; |
|
226 | - $default_email_body .= '<strong>' . __( 'Donation Date', 'give' ) . ':</strong> ' . '{date}' . "\n"; |
|
227 | - $default_email_body .= '<strong>' . __( 'Amount', 'give' ) . ':</strong> ' . '{price}' . "\n"; |
|
228 | - $default_email_body .= '<strong>' . __( 'Payment Method', 'give' ) . ':</strong> ' . '{payment_method}' . "\n"; |
|
229 | - $default_email_body .= '<strong>' . __( 'Payment ID', 'give' ) . ':</strong> ' . '{payment_id}' . "\n"; |
|
230 | - $default_email_body .= '<strong>' . __( 'Receipt ID', 'give' ) . ':</strong> ' . '{receipt_id}' . "\n\n"; |
|
231 | - $default_email_body .= '{receipt_link}' . "\n\n"; |
|
222 | + $default_email_body = __('Dear', 'give')." {name},\n\n"; |
|
223 | + $default_email_body .= __('Thank you for your donation. Your generosity is appreciated! Here are the details of your donation:', 'give')."\n\n"; |
|
224 | + $default_email_body .= '<strong>'.__('Donor', 'give').':</strong> '.'{fullname}'."\n"; |
|
225 | + $default_email_body .= '<strong>'.__('Donation', 'give').':</strong> '.'{donation}'."\n"; |
|
226 | + $default_email_body .= '<strong>'.__('Donation Date', 'give').':</strong> '.'{date}'."\n"; |
|
227 | + $default_email_body .= '<strong>'.__('Amount', 'give').':</strong> '.'{price}'."\n"; |
|
228 | + $default_email_body .= '<strong>'.__('Payment Method', 'give').':</strong> '.'{payment_method}'."\n"; |
|
229 | + $default_email_body .= '<strong>'.__('Payment ID', 'give').':</strong> '.'{payment_id}'."\n"; |
|
230 | + $default_email_body .= '<strong>'.__('Receipt ID', 'give').':</strong> '.'{receipt_id}'."\n\n"; |
|
231 | + $default_email_body .= '{receipt_link}'."\n\n"; |
|
232 | 232 | |
233 | 233 | $default_email_body .= "\n\n"; |
234 | - $default_email_body .= __( 'Sincerely,', 'give' ); |
|
235 | - $default_email_body .= "\n" . '{sitename}' . "\n"; |
|
234 | + $default_email_body .= __('Sincerely,', 'give'); |
|
235 | + $default_email_body .= "\n".'{sitename}'."\n"; |
|
236 | 236 | |
237 | - $message = ( isset( $give_options['donation_receipt'] ) && ! empty( $give_options['donation_receipt'] ) ) ? $give_options['donation_receipt'] : $default_email_body; |
|
237 | + $message = (isset($give_options['donation_receipt']) && ! empty($give_options['donation_receipt'])) ? $give_options['donation_receipt'] : $default_email_body; |
|
238 | 238 | |
239 | - return apply_filters( 'give_default_donation_receipt_email', $message ); |
|
239 | + return apply_filters('give_default_donation_receipt_email', $message); |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | /** |
@@ -248,19 +248,19 @@ discard block |
||
248 | 248 | * |
249 | 249 | * @return array $email_names |
250 | 250 | */ |
251 | -function give_get_email_names( $user_info ) { |
|
251 | +function give_get_email_names($user_info) { |
|
252 | 252 | $email_names = array(); |
253 | - $user_info = maybe_unserialize( $user_info ); |
|
253 | + $user_info = maybe_unserialize($user_info); |
|
254 | 254 | |
255 | 255 | $email_names['fullname'] = ''; |
256 | - if ( isset( $user_info['id'] ) && $user_info['id'] > 0 && isset( $user_info['first_name'] ) ) { |
|
257 | - $user_data = get_userdata( $user_info['id'] ); |
|
256 | + if (isset($user_info['id']) && $user_info['id'] > 0 && isset($user_info['first_name'])) { |
|
257 | + $user_data = get_userdata($user_info['id']); |
|
258 | 258 | $email_names['name'] = $user_info['first_name']; |
259 | - $email_names['fullname'] = $user_info['first_name'] . ' ' . $user_info['last_name']; |
|
259 | + $email_names['fullname'] = $user_info['first_name'].' '.$user_info['last_name']; |
|
260 | 260 | $email_names['username'] = $user_data->user_login; |
261 | - } elseif ( isset( $user_info['first_name'] ) ) { |
|
261 | + } elseif (isset($user_info['first_name'])) { |
|
262 | 262 | $email_names['name'] = $user_info['first_name']; |
263 | - $email_names['fullname'] = $user_info['first_name'] . ' ' . $user_info['last_name']; |
|
263 | + $email_names['fullname'] = $user_info['first_name'].' '.$user_info['last_name']; |
|
264 | 264 | $email_names['username'] = $user_info['first_name']; |
265 | 265 | } else { |
266 | 266 | $email_names['name'] = $user_info['email']; |
@@ -10,11 +10,11 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
17 | -add_filter( 'cmb2_meta_boxes', 'give_single_forms_cmb2_metaboxes' ); |
|
17 | +add_filter('cmb2_meta_boxes', 'give_single_forms_cmb2_metaboxes'); |
|
18 | 18 | |
19 | 19 | /** |
20 | 20 | * Define the metabox and field configurations. |
@@ -23,23 +23,23 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return array |
25 | 25 | */ |
26 | -function give_single_forms_cmb2_metaboxes( array $meta_boxes ) { |
|
26 | +function give_single_forms_cmb2_metaboxes(array $meta_boxes) { |
|
27 | 27 | |
28 | 28 | $post_id = give_get_admin_post_id(); |
29 | - $price = give_get_form_price( $post_id ); |
|
30 | - $custom_amount_minimum = give_get_form_minimum_price( $post_id ); |
|
31 | - $goal = give_get_form_goal( $post_id ); |
|
32 | - $variable_pricing = give_has_variable_prices( $post_id ); |
|
33 | - $prices = give_get_variable_prices( $post_id ); |
|
29 | + $price = give_get_form_price($post_id); |
|
30 | + $custom_amount_minimum = give_get_form_minimum_price($post_id); |
|
31 | + $goal = give_get_form_goal($post_id); |
|
32 | + $variable_pricing = give_has_variable_prices($post_id); |
|
33 | + $prices = give_get_variable_prices($post_id); |
|
34 | 34 | |
35 | 35 | //No empty prices - min. 1.00 for new forms |
36 | - if ( empty( $price ) && is_null( $post_id ) ) { |
|
37 | - $price = esc_attr( give_format_amount( '1.00' ) ); |
|
36 | + if (empty($price) && is_null($post_id)) { |
|
37 | + $price = esc_attr(give_format_amount('1.00')); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | //Min. $1.00 for new forms |
41 | - if ( empty( $custom_amount_minimum ) ) { |
|
42 | - $custom_amount_minimum = esc_attr( give_format_amount( '1.00' ) ); |
|
41 | + if (empty($custom_amount_minimum)) { |
|
42 | + $custom_amount_minimum = esc_attr(give_format_amount('1.00')); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | // Start with an underscore to hide fields from custom fields list |
@@ -48,302 +48,302 @@ discard block |
||
48 | 48 | /** |
49 | 49 | * Repeatable Field Groups |
50 | 50 | */ |
51 | - $meta_boxes['form_field_options'] = apply_filters( 'give_forms_field_options', array( |
|
51 | + $meta_boxes['form_field_options'] = apply_filters('give_forms_field_options', array( |
|
52 | 52 | 'id' => 'form_field_options', |
53 | - 'title' => __( 'Donation Options', 'give' ), |
|
54 | - 'object_types' => array( 'give_forms' ), |
|
53 | + 'title' => __('Donation Options', 'give'), |
|
54 | + 'object_types' => array('give_forms'), |
|
55 | 55 | 'context' => 'normal', |
56 | 56 | 'priority' => 'high', //Show above Content WYSIWYG |
57 | - 'fields' => apply_filters( 'give_forms_donation_form_metabox_fields', array( |
|
57 | + 'fields' => apply_filters('give_forms_donation_form_metabox_fields', array( |
|
58 | 58 | //Donation Option |
59 | 59 | array( |
60 | - 'name' => __( 'Donation Option', 'give' ), |
|
61 | - 'description' => __( 'Would you like this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give' ), |
|
62 | - 'id' => $prefix . 'price_option', |
|
60 | + 'name' => __('Donation Option', 'give'), |
|
61 | + 'description' => __('Would you like this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give'), |
|
62 | + 'id' => $prefix.'price_option', |
|
63 | 63 | 'type' => 'radio_inline', |
64 | 64 | 'default' => 'set', |
65 | - 'options' => apply_filters( 'give_forms_price_options', array( |
|
66 | - 'set' => __( 'Set Donation', 'give' ), |
|
67 | - 'multi' => __( 'Multi-level Donation', 'give' ), |
|
68 | - ) ), |
|
65 | + 'options' => apply_filters('give_forms_price_options', array( |
|
66 | + 'set' => __('Set Donation', 'give'), |
|
67 | + 'multi' => __('Multi-level Donation', 'give'), |
|
68 | + )), |
|
69 | 69 | ), |
70 | 70 | array( |
71 | - 'name' => __( 'Set Donation', 'give' ), |
|
72 | - 'description' => __( 'This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give' ), |
|
73 | - 'id' => $prefix . 'set_price', |
|
71 | + 'name' => __('Set Donation', 'give'), |
|
72 | + 'description' => __('This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give'), |
|
73 | + 'id' => $prefix.'set_price', |
|
74 | 74 | 'type' => 'text_small', |
75 | 75 | 'row_classes' => 'give-subfield', |
76 | - 'before_field' => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '', |
|
77 | - 'after_field' => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '', |
|
76 | + 'before_field' => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : '', |
|
77 | + 'after_field' => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : '', |
|
78 | 78 | 'attributes' => array( |
79 | - 'placeholder' => give_format_amount( '1.00' ), |
|
80 | - 'value' => give_format_amount( $price ), |
|
79 | + 'placeholder' => give_format_amount('1.00'), |
|
80 | + 'value' => give_format_amount($price), |
|
81 | 81 | 'class' => 'cmb-type-text-small give-money-field', |
82 | 82 | ), |
83 | 83 | ), |
84 | 84 | //Donation levels: Header |
85 | 85 | array( |
86 | - 'id' => $prefix . 'levels_header', |
|
86 | + 'id' => $prefix.'levels_header', |
|
87 | 87 | 'type' => 'levels_repeater_header', |
88 | 88 | ), |
89 | 89 | //Donation Levels: Repeatable CMB2 Group |
90 | 90 | array( |
91 | - 'id' => $prefix . 'donation_levels', |
|
91 | + 'id' => $prefix.'donation_levels', |
|
92 | 92 | 'type' => 'group', |
93 | 93 | 'row_classes' => 'give-subfield', |
94 | 94 | 'options' => array( |
95 | - 'add_button' => __( 'Add Level', 'give' ), |
|
96 | - 'remove_button' => __( '<span class="dashicons dashicons-no"></span>', 'give' ), |
|
95 | + 'add_button' => __('Add Level', 'give'), |
|
96 | + 'remove_button' => __('<span class="dashicons dashicons-no"></span>', 'give'), |
|
97 | 97 | 'sortable' => true, // beta |
98 | 98 | ), |
99 | 99 | // Fields array works the same, except id's only need to be unique for this group. Prefix is not needed. |
100 | - 'fields' => apply_filters( 'give_donation_levels_table_row', array( |
|
100 | + 'fields' => apply_filters('give_donation_levels_table_row', array( |
|
101 | 101 | array( |
102 | - 'name' => __( 'ID', 'give' ), |
|
103 | - 'id' => $prefix . 'id', |
|
102 | + 'name' => __('ID', 'give'), |
|
103 | + 'id' => $prefix.'id', |
|
104 | 104 | 'type' => 'levels_id', |
105 | 105 | ), |
106 | 106 | array( |
107 | - 'name' => __( 'Amount', 'give' ), |
|
108 | - 'id' => $prefix . 'amount', |
|
107 | + 'name' => __('Amount', 'give'), |
|
108 | + 'id' => $prefix.'amount', |
|
109 | 109 | 'type' => 'text_small', |
110 | - 'before_field' => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '', |
|
111 | - 'after_field' => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '', |
|
110 | + 'before_field' => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : '', |
|
111 | + 'after_field' => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : '', |
|
112 | 112 | 'attributes' => array( |
113 | - 'placeholder' => give_format_amount( '1.00' ), |
|
113 | + 'placeholder' => give_format_amount('1.00'), |
|
114 | 114 | 'class' => 'cmb-type-text-small give-money-field', |
115 | 115 | ), |
116 | 116 | 'before' => 'give_format_admin_multilevel_amount', |
117 | 117 | ), |
118 | 118 | array( |
119 | - 'name' => __( 'Text', 'give' ), |
|
120 | - 'id' => $prefix . 'text', |
|
119 | + 'name' => __('Text', 'give'), |
|
120 | + 'id' => $prefix.'text', |
|
121 | 121 | 'type' => 'text', |
122 | 122 | 'attributes' => array( |
123 | - 'placeholder' => __( 'Donation Level', 'give' ), |
|
123 | + 'placeholder' => __('Donation Level', 'give'), |
|
124 | 124 | 'class' => 'give-multilevel-text-field', |
125 | 125 | ), |
126 | 126 | ), |
127 | 127 | array( |
128 | - 'name' => __( 'Default', 'give' ), |
|
129 | - 'id' => $prefix . 'default', |
|
128 | + 'name' => __('Default', 'give'), |
|
129 | + 'id' => $prefix.'default', |
|
130 | 130 | 'type' => 'give_default_radio_inline' |
131 | 131 | ), |
132 | - ) ), |
|
132 | + )), |
|
133 | 133 | ), |
134 | 134 | //Display Style |
135 | 135 | array( |
136 | - 'name' => __( 'Display Style', 'give' ), |
|
137 | - 'description' => __( 'Set how the donations levels will display on the form.', 'give' ), |
|
138 | - 'id' => $prefix . 'display_style', |
|
136 | + 'name' => __('Display Style', 'give'), |
|
137 | + 'description' => __('Set how the donations levels will display on the form.', 'give'), |
|
138 | + 'id' => $prefix.'display_style', |
|
139 | 139 | 'type' => 'radio_inline', |
140 | 140 | 'default' => 'buttons', |
141 | 141 | 'options' => array( |
142 | - 'buttons' => __( 'Buttons', 'give' ), |
|
143 | - 'radios' => __( 'Radios', 'give' ), |
|
144 | - 'dropdown' => __( 'Dropdown', 'give' ), |
|
142 | + 'buttons' => __('Buttons', 'give'), |
|
143 | + 'radios' => __('Radios', 'give'), |
|
144 | + 'dropdown' => __('Dropdown', 'give'), |
|
145 | 145 | ), |
146 | 146 | ), |
147 | 147 | //Custom Amount |
148 | 148 | array( |
149 | - 'name' => __( 'Custom Amount', 'give' ), |
|
150 | - 'description' => __( 'Do you want the user to be able to input their own donation amount?', 'give' ), |
|
151 | - 'id' => $prefix . 'custom_amount', |
|
149 | + 'name' => __('Custom Amount', 'give'), |
|
150 | + 'description' => __('Do you want the user to be able to input their own donation amount?', 'give'), |
|
151 | + 'id' => $prefix.'custom_amount', |
|
152 | 152 | 'type' => 'radio_inline', |
153 | 153 | 'default' => 'no', |
154 | 154 | 'options' => array( |
155 | - 'yes' => __( 'Yes', 'give' ), |
|
156 | - 'no' => __( 'No', 'give' ), |
|
155 | + 'yes' => __('Yes', 'give'), |
|
156 | + 'no' => __('No', 'give'), |
|
157 | 157 | ), |
158 | 158 | ), |
159 | 159 | array( |
160 | - 'name' => __( 'Custom Amount Minimum', 'give' ), |
|
161 | - 'description' => __( 'If you would like to set a minimum custom donation amount please enter it here.', 'give' ), |
|
162 | - 'id' => $prefix . 'custom_amount_minimum', |
|
160 | + 'name' => __('Custom Amount Minimum', 'give'), |
|
161 | + 'description' => __('If you would like to set a minimum custom donation amount please enter it here.', 'give'), |
|
162 | + 'id' => $prefix.'custom_amount_minimum', |
|
163 | 163 | 'type' => 'text_small', |
164 | 164 | 'row_classes' => 'give-subfield', |
165 | - 'before_field' => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '', |
|
166 | - 'after_field' => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '', |
|
165 | + 'before_field' => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : '', |
|
166 | + 'after_field' => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : '', |
|
167 | 167 | 'attributes' => array( |
168 | - 'placeholder' => give_format_amount( '1.00' ), |
|
169 | - 'value' => give_format_amount( $custom_amount_minimum ), |
|
168 | + 'placeholder' => give_format_amount('1.00'), |
|
169 | + 'value' => give_format_amount($custom_amount_minimum), |
|
170 | 170 | 'class' => 'cmb-type-text-small give-money-field', |
171 | 171 | ), |
172 | 172 | ), |
173 | 173 | array( |
174 | - 'name' => __( 'Custom Amount Text', 'give' ), |
|
175 | - 'description' => __( 'This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give' ), |
|
176 | - 'id' => $prefix . 'custom_amount_text', |
|
174 | + 'name' => __('Custom Amount Text', 'give'), |
|
175 | + 'description' => __('This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give'), |
|
176 | + 'id' => $prefix.'custom_amount_text', |
|
177 | 177 | 'type' => 'text', |
178 | 178 | 'row_classes' => 'give-subfield', |
179 | 179 | 'attributes' => array( |
180 | 180 | 'rows' => 3, |
181 | - 'placeholder' => __( 'Give a Custom Amount', 'give' ), |
|
181 | + 'placeholder' => __('Give a Custom Amount', 'give'), |
|
182 | 182 | ), |
183 | 183 | ), |
184 | 184 | //Goals |
185 | 185 | array( |
186 | - 'name' => __( 'Goal', 'give' ), |
|
187 | - 'description' => __( 'Do you want to set a donation goal for this form?', 'give' ), |
|
188 | - 'id' => $prefix . 'goal_option', |
|
186 | + 'name' => __('Goal', 'give'), |
|
187 | + 'description' => __('Do you want to set a donation goal for this form?', 'give'), |
|
188 | + 'id' => $prefix.'goal_option', |
|
189 | 189 | 'type' => 'radio_inline', |
190 | 190 | 'default' => 'no', |
191 | 191 | 'options' => array( |
192 | - 'yes' => __( 'Yes', 'give' ), |
|
193 | - 'no' => __( 'No', 'give' ), |
|
192 | + 'yes' => __('Yes', 'give'), |
|
193 | + 'no' => __('No', 'give'), |
|
194 | 194 | ), |
195 | 195 | ), |
196 | 196 | array( |
197 | - 'name' => __( 'Goal Amount', 'give' ), |
|
198 | - 'description' => __( 'This is the monetary goal amount you want to reach for this donation form.', 'give' ), |
|
199 | - 'id' => $prefix . 'set_goal', |
|
197 | + 'name' => __('Goal Amount', 'give'), |
|
198 | + 'description' => __('This is the monetary goal amount you want to reach for this donation form.', 'give'), |
|
199 | + 'id' => $prefix.'set_goal', |
|
200 | 200 | 'type' => 'text_small', |
201 | 201 | 'row_classes' => 'give-subfield', |
202 | - 'before_field' => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '', |
|
203 | - 'after_field' => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '', |
|
202 | + 'before_field' => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : '', |
|
203 | + 'after_field' => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : '', |
|
204 | 204 | 'attributes' => array( |
205 | - 'placeholder' => give_format_amount( '0.00' ), |
|
206 | - 'value' => isset( $goal ) ? esc_attr( give_format_amount( $goal ) ) : '', |
|
205 | + 'placeholder' => give_format_amount('0.00'), |
|
206 | + 'value' => isset($goal) ? esc_attr(give_format_amount($goal)) : '', |
|
207 | 207 | 'class' => 'cmb-type-text-small give-money-field', |
208 | 208 | ), |
209 | 209 | ), |
210 | 210 | |
211 | 211 | array( |
212 | - 'name' => __( 'Goal Format', 'give' ), |
|
213 | - 'description' => __( 'Would you like to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded".', 'give' ), |
|
214 | - 'id' => $prefix . 'goal_format', |
|
212 | + 'name' => __('Goal Format', 'give'), |
|
213 | + 'description' => __('Would you like to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded".', 'give'), |
|
214 | + 'id' => $prefix.'goal_format', |
|
215 | 215 | 'type' => 'radio_inline', |
216 | 216 | 'default' => 'amount', |
217 | 217 | 'row_classes' => 'give-subfield', |
218 | 218 | 'options' => array( |
219 | - 'amount' => __( 'Amount ', 'give' ), |
|
220 | - 'percentage' => __( 'Percentage', 'give' ), |
|
219 | + 'amount' => __('Amount ', 'give'), |
|
220 | + 'percentage' => __('Percentage', 'give'), |
|
221 | 221 | ), |
222 | 222 | ), |
223 | 223 | array( |
224 | - 'name' => __( 'Goal Progress Bar Color', 'give' ), |
|
225 | - 'id' => $prefix . 'goal_color', |
|
224 | + 'name' => __('Goal Progress Bar Color', 'give'), |
|
225 | + 'id' => $prefix.'goal_color', |
|
226 | 226 | 'type' => 'colorpicker', |
227 | 227 | 'row_classes' => 'give-subfield', |
228 | 228 | 'default' => '#2bc253', |
229 | 229 | ), |
230 | 230 | ) |
231 | 231 | ) |
232 | - ) ); |
|
232 | + )); |
|
233 | 233 | |
234 | 234 | |
235 | 235 | /** |
236 | 236 | * Content Field |
237 | 237 | */ |
238 | - $meta_boxes['form_content_options'] = apply_filters( 'give_forms_content_options', array( |
|
238 | + $meta_boxes['form_content_options'] = apply_filters('give_forms_content_options', array( |
|
239 | 239 | 'id' => 'form_content_options', |
240 | - 'title' => __( 'Form Content', 'give' ), |
|
241 | - 'object_types' => array( 'give_forms' ), |
|
240 | + 'title' => __('Form Content', 'give'), |
|
241 | + 'object_types' => array('give_forms'), |
|
242 | 242 | 'context' => 'normal', |
243 | 243 | 'priority' => 'high', //Show above Content WYSIWYG |
244 | - 'fields' => apply_filters( 'give_forms_content_options_metabox_fields', array( |
|
244 | + 'fields' => apply_filters('give_forms_content_options_metabox_fields', array( |
|
245 | 245 | //Donation Option |
246 | 246 | array( |
247 | - 'name' => __( 'Display Content', 'give' ), |
|
248 | - 'description' => __( 'Do you want to display content? If you select "Yes" a WYSIWYG editor will appear which you will be able to enter content to display above or below the form.', 'give' ), |
|
249 | - 'id' => $prefix . 'content_option', |
|
247 | + 'name' => __('Display Content', 'give'), |
|
248 | + 'description' => __('Do you want to display content? If you select "Yes" a WYSIWYG editor will appear which you will be able to enter content to display above or below the form.', 'give'), |
|
249 | + 'id' => $prefix.'content_option', |
|
250 | 250 | 'type' => 'select', |
251 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
252 | - 'none' => __( 'No content', 'give' ), |
|
253 | - 'give_pre_form' => __( 'Yes, display content ABOVE the form fields', 'give' ), |
|
254 | - 'give_post_form' => __( 'Yes, display content BELOW the form fields', 'give' ), |
|
251 | + 'options' => apply_filters('give_forms_content_options_select', array( |
|
252 | + 'none' => __('No content', 'give'), |
|
253 | + 'give_pre_form' => __('Yes, display content ABOVE the form fields', 'give'), |
|
254 | + 'give_post_form' => __('Yes, display content BELOW the form fields', 'give'), |
|
255 | 255 | ) |
256 | 256 | ), |
257 | 257 | 'default' => 'none', |
258 | 258 | ), |
259 | 259 | array( |
260 | - 'name' => __( 'Content', 'give' ), |
|
261 | - 'description' => __( 'This content will display on the single give form page.', 'give' ), |
|
262 | - 'id' => $prefix . 'form_content', |
|
260 | + 'name' => __('Content', 'give'), |
|
261 | + 'description' => __('This content will display on the single give form page.', 'give'), |
|
262 | + 'id' => $prefix.'form_content', |
|
263 | 263 | 'row_classes' => 'give-subfield', |
264 | 264 | 'type' => 'wysiwyg' |
265 | 265 | ), |
266 | 266 | ) |
267 | 267 | ) |
268 | - ) ); |
|
268 | + )); |
|
269 | 269 | |
270 | 270 | |
271 | 271 | /** |
272 | 272 | * Display Options |
273 | 273 | */ |
274 | - $meta_boxes['form_display_options'] = apply_filters( 'give_form_display_options', array( |
|
274 | + $meta_boxes['form_display_options'] = apply_filters('give_form_display_options', array( |
|
275 | 275 | 'id' => 'form_display_options', |
276 | - 'title' => __( 'Form Display Options', 'give' ), |
|
277 | - 'object_types' => array( 'give_forms' ), |
|
276 | + 'title' => __('Form Display Options', 'give'), |
|
277 | + 'object_types' => array('give_forms'), |
|
278 | 278 | 'context' => 'normal', // 'normal', 'advanced', or 'side' |
279 | 279 | 'priority' => 'high', //Show above Content WYSIWYG |
280 | 280 | 'show_names' => true, // Show field names on the left |
281 | - 'fields' => apply_filters( 'give_forms_display_options_metabox_fields', array( |
|
281 | + 'fields' => apply_filters('give_forms_display_options_metabox_fields', array( |
|
282 | 282 | array( |
283 | - 'name' => __( 'Payment Fields', 'give' ), |
|
284 | - 'desc' => __( 'How would you like to display payment information for this form? The "Show on Page" option will display the entire form when the page loads. "Reveal Upon Click" places a button below the donation fields and upon click slides into view the rest of the fields. "Modal Window Upon Click" is a similar option, rather than sliding into view the fields they will open in a shadow box or "modal" window.', 'give' ), |
|
285 | - 'id' => $prefix . 'payment_display', |
|
283 | + 'name' => __('Payment Fields', 'give'), |
|
284 | + 'desc' => __('How would you like to display payment information for this form? The "Show on Page" option will display the entire form when the page loads. "Reveal Upon Click" places a button below the donation fields and upon click slides into view the rest of the fields. "Modal Window Upon Click" is a similar option, rather than sliding into view the fields they will open in a shadow box or "modal" window.', 'give'), |
|
285 | + 'id' => $prefix.'payment_display', |
|
286 | 286 | 'type' => 'select', |
287 | 287 | 'options' => array( |
288 | - 'onpage' => __( 'Show on Page', 'give' ), |
|
289 | - 'reveal' => __( 'Reveal Upon Click', 'give' ), |
|
290 | - 'modal' => __( 'Modal Window Upon Click', 'give' ), |
|
288 | + 'onpage' => __('Show on Page', 'give'), |
|
289 | + 'reveal' => __('Reveal Upon Click', 'give'), |
|
290 | + 'modal' => __('Modal Window Upon Click', 'give'), |
|
291 | 291 | ), |
292 | 292 | 'default' => 'onpage', |
293 | 293 | ), |
294 | 294 | array( |
295 | - 'id' => $prefix . 'reveal_label', |
|
296 | - 'name' => __( 'Reveal / Modal Open Text', 'give' ), |
|
297 | - 'desc' => __( 'The button label for completing the donation.', 'give' ), |
|
295 | + 'id' => $prefix.'reveal_label', |
|
296 | + 'name' => __('Reveal / Modal Open Text', 'give'), |
|
297 | + 'desc' => __('The button label for completing the donation.', 'give'), |
|
298 | 298 | 'type' => 'text_small', |
299 | 299 | 'row_classes' => 'give-subfield', |
300 | 300 | 'attributes' => array( |
301 | - 'placeholder' => __( 'Donate Now', 'give' ), |
|
301 | + 'placeholder' => __('Donate Now', 'give'), |
|
302 | 302 | ), |
303 | 303 | ), |
304 | 304 | array( |
305 | - 'id' => $prefix . 'checkout_label', |
|
306 | - 'name' => __( 'Complete Donation Text', 'give' ), |
|
307 | - 'desc' => __( 'The button label for completing a donation.', 'give' ), |
|
305 | + 'id' => $prefix.'checkout_label', |
|
306 | + 'name' => __('Complete Donation Text', 'give'), |
|
307 | + 'desc' => __('The button label for completing a donation.', 'give'), |
|
308 | 308 | 'type' => 'text_small', |
309 | 309 | 'attributes' => array( |
310 | - 'placeholder' => __( 'Donate Now', 'give' ), |
|
310 | + 'placeholder' => __('Donate Now', 'give'), |
|
311 | 311 | ), |
312 | 312 | ), |
313 | 313 | array( |
314 | - 'name' => __( 'Default Gateway', 'give' ), |
|
315 | - 'desc' => __( 'By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give' ), |
|
316 | - 'id' => $prefix . 'default_gateway', |
|
314 | + 'name' => __('Default Gateway', 'give'), |
|
315 | + 'desc' => __('By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give'), |
|
316 | + 'id' => $prefix.'default_gateway', |
|
317 | 317 | 'type' => 'default_gateway' |
318 | 318 | ), |
319 | 319 | array( |
320 | - 'name' => __( 'Disable Guest Donations', 'give' ), |
|
321 | - 'desc' => __( 'Do you want to require users be logged-in to make donations?', 'give' ), |
|
322 | - 'id' => $prefix . 'logged_in_only', |
|
320 | + 'name' => __('Disable Guest Donations', 'give'), |
|
321 | + 'desc' => __('Do you want to require users be logged-in to make donations?', 'give'), |
|
322 | + 'id' => $prefix.'logged_in_only', |
|
323 | 323 | 'type' => 'checkbox' |
324 | 324 | ), |
325 | 325 | array( |
326 | - 'name' => __( 'Register / Login Form', 'give' ), |
|
327 | - 'desc' => __( 'Display the registration and login forms in the payment section for non-logged-in users.', 'give' ), |
|
328 | - 'id' => $prefix . 'show_register_form', |
|
326 | + 'name' => __('Register / Login Form', 'give'), |
|
327 | + 'desc' => __('Display the registration and login forms in the payment section for non-logged-in users.', 'give'), |
|
328 | + 'id' => $prefix.'show_register_form', |
|
329 | 329 | 'type' => 'select', |
330 | 330 | 'options' => array( |
331 | - 'both' => __( 'Registration and Login Forms', 'give' ), |
|
332 | - 'registration' => __( 'Registration Form Only', 'give' ), |
|
333 | - 'login' => __( 'Login Form Only', 'give' ), |
|
334 | - 'none' => __( 'None', 'give' ), |
|
331 | + 'both' => __('Registration and Login Forms', 'give'), |
|
332 | + 'registration' => __('Registration Form Only', 'give'), |
|
333 | + 'login' => __('Login Form Only', 'give'), |
|
334 | + 'none' => __('None', 'give'), |
|
335 | 335 | ), |
336 | 336 | 'default' => 'none', |
337 | 337 | ), |
338 | 338 | array( |
339 | - 'name' => __( 'Floating Labels', 'give' ), |
|
340 | - 'desc' => sprintf( __( 'Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form.<br>Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give' ), esc_url( "http://bradfrost.com/blog/post/float-label-pattern/" ) ), |
|
341 | - 'id' => $prefix . 'form_floating_labels', |
|
339 | + 'name' => __('Floating Labels', 'give'), |
|
340 | + 'desc' => sprintf(__('Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form.<br>Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give'), esc_url("http://bradfrost.com/blog/post/float-label-pattern/")), |
|
341 | + 'id' => $prefix.'form_floating_labels', |
|
342 | 342 | 'type' => 'select', |
343 | 343 | 'options' => array( |
344 | - '' => __( 'Use the global setting', 'give' ), |
|
345 | - 'enabled' => __( 'Enabled', 'give' ), |
|
346 | - 'disabled' => __( 'Disabled', 'give' ), |
|
344 | + '' => __('Use the global setting', 'give'), |
|
345 | + 'enabled' => __('Enabled', 'give'), |
|
346 | + 'disabled' => __('Disabled', 'give'), |
|
347 | 347 | ), |
348 | 348 | 'default' => 'none', |
349 | 349 | ) |
@@ -355,47 +355,47 @@ discard block |
||
355 | 355 | /** |
356 | 356 | * Terms & Conditions |
357 | 357 | */ |
358 | - $meta_boxes['form_terms_options'] = apply_filters( 'give_forms_terms_options', array( |
|
358 | + $meta_boxes['form_terms_options'] = apply_filters('give_forms_terms_options', array( |
|
359 | 359 | 'id' => 'form_terms_options', |
360 | - 'title' => __( 'Terms and Conditions', 'give' ), |
|
361 | - 'object_types' => array( 'give_forms' ), |
|
360 | + 'title' => __('Terms and Conditions', 'give'), |
|
361 | + 'object_types' => array('give_forms'), |
|
362 | 362 | 'context' => 'normal', |
363 | 363 | 'priority' => 'high', //Show above Content WYSIWYG |
364 | - 'fields' => apply_filters( 'give_forms_terms_options_metabox_fields', array( |
|
364 | + 'fields' => apply_filters('give_forms_terms_options_metabox_fields', array( |
|
365 | 365 | //Donation Option |
366 | 366 | array( |
367 | - 'name' => __( 'Terms and Conditions', 'give' ), |
|
368 | - 'description' => __( 'Do you want to require the user to agree to terms and conditions prior to being able to complete their donation?', 'give' ), |
|
369 | - 'id' => $prefix . 'terms_option', |
|
367 | + 'name' => __('Terms and Conditions', 'give'), |
|
368 | + 'description' => __('Do you want to require the user to agree to terms and conditions prior to being able to complete their donation?', 'give'), |
|
369 | + 'id' => $prefix.'terms_option', |
|
370 | 370 | 'type' => 'select', |
371 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
372 | - 'none' => __( 'No', 'give' ), |
|
373 | - 'yes' => __( 'Yes', 'give' ), |
|
371 | + 'options' => apply_filters('give_forms_content_options_select', array( |
|
372 | + 'none' => __('No', 'give'), |
|
373 | + 'yes' => __('Yes', 'give'), |
|
374 | 374 | ) |
375 | 375 | ), |
376 | 376 | 'default' => 'none', |
377 | 377 | ), |
378 | 378 | array( |
379 | - 'id' => $prefix . 'agree_label', |
|
380 | - 'name' => __( 'Agree to Terms Label', 'give' ), |
|
381 | - 'desc' => __( 'The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give' ), |
|
379 | + 'id' => $prefix.'agree_label', |
|
380 | + 'name' => __('Agree to Terms Label', 'give'), |
|
381 | + 'desc' => __('The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give'), |
|
382 | 382 | 'type' => 'text', |
383 | 383 | 'row_classes' => 'give-subfield', |
384 | 384 | 'size' => 'regular', |
385 | 385 | 'attributes' => array( |
386 | - 'placeholder' => __( 'Agree to Terms?', 'give' ), |
|
386 | + 'placeholder' => __('Agree to Terms?', 'give'), |
|
387 | 387 | ), |
388 | 388 | ), |
389 | 389 | array( |
390 | - 'id' => $prefix . 'agree_text', |
|
390 | + 'id' => $prefix.'agree_text', |
|
391 | 391 | 'row_classes' => 'give-subfield', |
392 | - 'name' => __( 'Agreement Text', 'give' ), |
|
393 | - 'desc' => __( 'This is the actual text which the user will have to agree to in order to make a donation.', 'give' ), |
|
392 | + 'name' => __('Agreement Text', 'give'), |
|
393 | + 'desc' => __('This is the actual text which the user will have to agree to in order to make a donation.', 'give'), |
|
394 | 394 | 'type' => 'wysiwyg' |
395 | 395 | ), |
396 | 396 | ) |
397 | 397 | ) |
398 | - ) ); |
|
398 | + )); |
|
399 | 399 | |
400 | 400 | return $meta_boxes; |
401 | 401 | |
@@ -409,18 +409,18 @@ discard block |
||
409 | 409 | |
410 | 410 | <div class="table-container"> |
411 | 411 | <div class="table-row"> |
412 | - <div class="table-cell col-amount"><?php _e( 'Amount', 'give' ); ?></div> |
|
413 | - <div class="table-cell col-text"><?php _e( 'Text', 'give' ); ?></div> |
|
414 | - <div class="table-cell col-default"><?php _e( 'Default', 'give' ); ?></div> |
|
415 | - <?php do_action( 'give_donation_levels_table_head' ); ?> |
|
416 | - <div class="table-cell col-sort"><?php _e( 'Sort', 'give' ); ?></div> |
|
412 | + <div class="table-cell col-amount"><?php _e('Amount', 'give'); ?></div> |
|
413 | + <div class="table-cell col-text"><?php _e('Text', 'give'); ?></div> |
|
414 | + <div class="table-cell col-default"><?php _e('Default', 'give'); ?></div> |
|
415 | + <?php do_action('give_donation_levels_table_head'); ?> |
|
416 | + <div class="table-cell col-sort"><?php _e('Sort', 'give'); ?></div> |
|
417 | 417 | |
418 | 418 | </div> |
419 | 419 | </div> |
420 | 420 | |
421 | 421 | <?php |
422 | 422 | } |
423 | -add_action( 'cmb2_render_levels_repeater_header', 'give_cmb_render_levels_repeater_header', 10 ); |
|
423 | +add_action('cmb2_render_levels_repeater_header', 'give_cmb_render_levels_repeater_header', 10); |
|
424 | 424 | |
425 | 425 | |
426 | 426 | /** |
@@ -437,24 +437,24 @@ discard block |
||
437 | 437 | * @param $object_type |
438 | 438 | * @param $field_type_object |
439 | 439 | */ |
440 | -function give_cmb_render_levels_id( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
440 | +function give_cmb_render_levels_id($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
441 | 441 | |
442 | - $escaped_value = ( isset( $escaped_value['level_id'] ) ? $escaped_value['level_id'] : '' ); |
|
442 | + $escaped_value = (isset($escaped_value['level_id']) ? $escaped_value['level_id'] : ''); |
|
443 | 443 | |
444 | 444 | $field_options_array = array( |
445 | 445 | 'class' => 'give-hidden give-level-id-input', |
446 | - 'name' => $field_type_object->_name( '[level_id]' ), |
|
447 | - 'id' => $field_type_object->_id( '_level_id' ), |
|
446 | + 'name' => $field_type_object->_name('[level_id]'), |
|
447 | + 'id' => $field_type_object->_id('_level_id'), |
|
448 | 448 | 'value' => $escaped_value, |
449 | 449 | 'type' => 'number', |
450 | 450 | 'desc' => '', |
451 | 451 | ); |
452 | 452 | |
453 | - echo '<p class="give-level-id">' . $escaped_value . '</p>'; |
|
454 | - echo $field_type_object->input( $field_options_array ); |
|
453 | + echo '<p class="give-level-id">'.$escaped_value.'</p>'; |
|
454 | + echo $field_type_object->input($field_options_array); |
|
455 | 455 | |
456 | 456 | } |
457 | -add_action( 'cmb2_render_levels_id', 'give_cmb_render_levels_id', 10, 5 ); |
|
457 | +add_action('cmb2_render_levels_id', 'give_cmb_render_levels_id', 10, 5); |
|
458 | 458 | |
459 | 459 | |
460 | 460 | /** |
@@ -466,13 +466,13 @@ discard block |
||
466 | 466 | * @param $object_type |
467 | 467 | * @param $field_type_object |
468 | 468 | */ |
469 | -function give_cmb_give_default_radio_inline( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
470 | - echo '<input type="radio" class="cmb2-option donation-level-radio" name="' . $field_object->args['_name'] . '" id="' . $field_object->args['id'] . '" value="default" ' . checked( 'default', $escaped_value, false ) . '>'; |
|
471 | - echo '<label for="' . $field_object->args['id'] . '">Default</label>'; |
|
469 | +function give_cmb_give_default_radio_inline($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
470 | + echo '<input type="radio" class="cmb2-option donation-level-radio" name="'.$field_object->args['_name'].'" id="'.$field_object->args['id'].'" value="default" '.checked('default', $escaped_value, false).'>'; |
|
471 | + echo '<label for="'.$field_object->args['id'].'">Default</label>'; |
|
472 | 472 | |
473 | 473 | } |
474 | 474 | |
475 | -add_action( 'cmb2_render_give_default_radio_inline', 'give_cmb_give_default_radio_inline', 10, 5 ); |
|
475 | +add_action('cmb2_render_give_default_radio_inline', 'give_cmb_give_default_radio_inline', 10, 5); |
|
476 | 476 | |
477 | 477 | |
478 | 478 | /** |
@@ -482,20 +482,20 @@ discard block |
||
482 | 482 | */ |
483 | 483 | function give_add_shortcode_to_publish_metabox() { |
484 | 484 | |
485 | - if ( 'give_forms' !== get_post_type() ) { |
|
485 | + if ('give_forms' !== get_post_type()) { |
|
486 | 486 | return false; |
487 | 487 | } |
488 | 488 | |
489 | 489 | global $post; |
490 | 490 | |
491 | 491 | //Only enqueue scripts for CPT on post type screen |
492 | - if ( 'give_forms' === $post->post_type ) { |
|
492 | + if ('give_forms' === $post->post_type) { |
|
493 | 493 | //Shortcode column with select all input |
494 | - $shortcode = htmlentities( '[give_form id="' . $post->ID . '"]' ); |
|
495 | - echo '<div class="shortcode-wrap box-sizing"><label>' . __( 'Give Form Shortcode:', 'give' ) . '</label><input onClick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly value="' . $shortcode . '"></div>'; |
|
494 | + $shortcode = htmlentities('[give_form id="'.$post->ID.'"]'); |
|
495 | + echo '<div class="shortcode-wrap box-sizing"><label>'.__('Give Form Shortcode:', 'give').'</label><input onClick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly value="'.$shortcode.'"></div>'; |
|
496 | 496 | |
497 | 497 | } |
498 | 498 | |
499 | 499 | } |
500 | 500 | |
501 | -add_action( 'post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox' ); |
|
501 | +add_action('post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox'); |
@@ -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,51 +284,51 @@ 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 | |
290 | 290 | <table class="widefat export-options-table give-table"> |
291 | 291 | <thead> |
292 | 292 | <tr> |
293 | - <th class="row-title"><?php _e( 'Export Type', 'give' ); ?></th> |
|
294 | - <th><?php _e( 'Export Options', 'give' ); ?></th> |
|
293 | + <th class="row-title"><?php _e('Export Type', 'give'); ?></th> |
|
294 | + <th><?php _e('Export Options', 'give'); ?></th> |
|
295 | 295 | </tr> |
296 | 296 | </thead> |
297 | 297 | <tbody> |
298 | - <?php do_action( 'give_reports_tab_export_table_top' ); ?> |
|
298 | + <?php do_action('give_reports_tab_export_table_top'); ?> |
|
299 | 299 | <tr class="give-export-pdf-sales-earnings"> |
300 | 300 | <td class="row-title"> |
301 | - <h3><span><?php _e( 'Export PDF of Donations and Income', 'give' ); ?></span></h3> |
|
301 | + <h3><span><?php _e('Export PDF of Donations and Income', 'give'); ?></span></h3> |
|
302 | 302 | |
303 | - <p><?php _e( 'Download a PDF of Donations and Income reports for all forms for the current year.', 'give' ); ?></p> |
|
303 | + <p><?php _e('Download a PDF of Donations and Income reports for all forms for the current year.', 'give'); ?></p> |
|
304 | 304 | </td> |
305 | 305 | <td> |
306 | - <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 | + <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> |
|
307 | 307 | </td> |
308 | 308 | </tr> |
309 | 309 | <tr class="alternate give-export-sales-earnings"> |
310 | 310 | <td class="row-title"> |
311 | - <h3><span><?php _e( 'Export Income and Donation Stats', 'give' ); ?></span></h3> |
|
311 | + <h3><span><?php _e('Export Income and Donation Stats', 'give'); ?></span></h3> |
|
312 | 312 | |
313 | - <p><?php _e( 'Download a CSV of income and donations over time.', 'give' ); ?></p> |
|
313 | + <p><?php _e('Download a CSV of income and donations over time.', 'give'); ?></p> |
|
314 | 314 | </td> |
315 | 315 | <td> |
316 | 316 | <form method="post"> |
317 | - <?php echo Give()->html->year_dropdown( 'start_year' ); ?> |
|
318 | - <?php echo Give()->html->month_dropdown( 'start_month' ); ?> |
|
319 | - <?php echo _x( 'to', 'Date one to date two', 'give' ); ?> |
|
320 | - <?php echo Give()->html->year_dropdown( 'end_year' ); ?> |
|
321 | - <?php echo Give()->html->month_dropdown( 'end_month' ); ?> |
|
317 | + <?php echo Give()->html->year_dropdown('start_year'); ?> |
|
318 | + <?php echo Give()->html->month_dropdown('start_month'); ?> |
|
319 | + <?php echo _x('to', 'Date one to date two', 'give'); ?> |
|
320 | + <?php echo Give()->html->year_dropdown('end_year'); ?> |
|
321 | + <?php echo Give()->html->month_dropdown('end_month'); ?> |
|
322 | 322 | <input type="hidden" name="give-action" value="earnings_export"/> |
323 | - <input type="submit" value="<?php _e( 'Generate CSV', 'give' ); ?>" class="button-secondary"/> |
|
323 | + <input type="submit" value="<?php _e('Generate CSV', 'give'); ?>" class="button-secondary"/> |
|
324 | 324 | </form> |
325 | 325 | </td> |
326 | 326 | </tr> |
327 | 327 | <tr class="give-export-payment-history"> |
328 | 328 | <td class="row-title"> |
329 | - <h3><span><?php _e( 'Export Donation History', 'give' ); ?></span></h3> |
|
329 | + <h3><span><?php _e('Export Donation History', 'give'); ?></span></h3> |
|
330 | 330 | |
331 | - <p><?php _e( 'Download a CSV of all donations recorded.', 'give' ); ?></p> |
|
331 | + <p><?php _e('Download a CSV of all donations recorded.', 'give'); ?></p> |
|
332 | 332 | </td> |
333 | 333 | <td> |
334 | 334 | <form id="give-export-payments" class="give-export-form" method="post"> |
@@ -336,29 +336,29 @@ discard block |
||
336 | 336 | $args = array( |
337 | 337 | 'id' => 'give-payment-export-start', |
338 | 338 | 'name' => 'start', |
339 | - 'placeholder' => __( 'Start date', 'give' ) |
|
339 | + 'placeholder' => __('Start date', 'give') |
|
340 | 340 | ); |
341 | - echo Give()->html->date_field( $args ); ?> |
|
341 | + echo Give()->html->date_field($args); ?> |
|
342 | 342 | <?php |
343 | 343 | $args = array( |
344 | 344 | 'id' => 'give-payment-export-end', |
345 | 345 | 'name' => 'end', |
346 | - 'placeholder' => __( 'End date', 'give' ) |
|
346 | + 'placeholder' => __('End date', 'give') |
|
347 | 347 | ); |
348 | - echo Give()->html->date_field( $args ); ?> |
|
348 | + echo Give()->html->date_field($args); ?> |
|
349 | 349 | <select name="status"> |
350 | - <option value="any"><?php _e( 'All Statuses', 'give' ); ?></option> |
|
350 | + <option value="any"><?php _e('All Statuses', 'give'); ?></option> |
|
351 | 351 | <?php |
352 | 352 | $statuses = give_get_payment_statuses(); |
353 | - foreach ( $statuses as $status => $label ) { |
|
354 | - echo '<option value="' . $status . '">' . $label . '</option>'; |
|
353 | + foreach ($statuses as $status => $label) { |
|
354 | + echo '<option value="'.$status.'">'.$label.'</option>'; |
|
355 | 355 | } |
356 | 356 | ?> |
357 | 357 | </select> |
358 | - <?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?> |
|
358 | + <?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?> |
|
359 | 359 | <input type="hidden" name="give-export-class" value="Give_Batch_Payments_Export"/> |
360 | 360 | <span> |
361 | - <input type="submit" value="<?php _e( 'Generate CSV', 'give' ); ?>" class="button-secondary" /> |
|
361 | + <input type="submit" value="<?php _e('Generate CSV', 'give'); ?>" class="button-secondary" /> |
|
362 | 362 | <span class="spinner"></span> |
363 | 363 | </span> |
364 | 364 | </form> |
@@ -367,41 +367,41 @@ discard block |
||
367 | 367 | </tr> |
368 | 368 | <tr class="alternate give-export-donors"> |
369 | 369 | <td class="row-title"> |
370 | - <h3><span><?php _e( 'Export Donors in CSV', 'give' ); ?></span></h3> |
|
370 | + <h3><span><?php _e('Export Donors in CSV', 'give'); ?></span></h3> |
|
371 | 371 | |
372 | - <p><?php _e( 'Download a CSV of all donors\' emails. Optionally export only donors that have donated to a particular form. Note: if you have a large number of donors, exporting the donation stats may fail.', 'give' ); ?></p> |
|
372 | + <p><?php _e('Download a CSV of all donors\' emails. Optionally export only donors that have donated to a particular form. Note: if you have a large number of donors, exporting the donation stats may fail.', 'give'); ?></p> |
|
373 | 373 | </td> |
374 | 374 | <td> |
375 | 375 | <form method="post" id="give_donor_export"> |
376 | 376 | <select name="give_export_download" id="give_donor_export_download"> |
377 | - <option value="0"><?php printf( __( 'All %s', 'give' ), give_get_forms_label_plural() ); ?></option> |
|
377 | + <option value="0"><?php printf(__('All %s', 'give'), give_get_forms_label_plural()); ?></option> |
|
378 | 378 | <?php |
379 | - $forms = get_posts( array( |
|
379 | + $forms = get_posts(array( |
|
380 | 380 | 'post_type' => 'give_forms', |
381 | - 'posts_per_page' => - 1 |
|
382 | - ) ); |
|
383 | - if ( $forms ) { |
|
384 | - foreach ( $forms as $form ) { |
|
385 | - echo '<option value="' . $form->ID . '">' . get_the_title( $form->ID ) . '</option>'; |
|
381 | + 'posts_per_page' => -1 |
|
382 | + )); |
|
383 | + if ($forms) { |
|
384 | + foreach ($forms as $form) { |
|
385 | + echo '<option value="'.$form->ID.'">'.get_the_title($form->ID).'</option>'; |
|
386 | 386 | } |
387 | 387 | } |
388 | 388 | ?> |
389 | 389 | </select> |
390 | 390 | <select name="give_export_option" id="give_donor_export_option"> |
391 | - <option value="emails"><?php _e( 'Emails', 'give' ); ?></option> |
|
392 | - <option value="emails_and_names"><?php _e( 'Emails and Names', 'give' ); ?></option> |
|
393 | - <option value="full"><?php _e( 'Emails, Names, and Purchase Stats', 'give' ); ?></option> |
|
391 | + <option value="emails"><?php _e('Emails', 'give'); ?></option> |
|
392 | + <option value="emails_and_names"><?php _e('Emails and Names', 'give'); ?></option> |
|
393 | + <option value="full"><?php _e('Emails, Names, and Purchase Stats', 'give'); ?></option> |
|
394 | 394 | </select> |
395 | 395 | <input type="hidden" name="give-action" value="email_export"/> |
396 | - <input type="submit" value="<?php _e( 'Generate CSV', 'give' ); ?>" class="button-secondary"/> |
|
396 | + <input type="submit" value="<?php _e('Generate CSV', 'give'); ?>" class="button-secondary"/> |
|
397 | 397 | </form> |
398 | 398 | </td> |
399 | 399 | </tr> |
400 | - <?php do_action( 'give_reports_tab_export_table_bottom' ); ?> |
|
400 | + <?php do_action('give_reports_tab_export_table_bottom'); ?> |
|
401 | 401 | </tbody> |
402 | 402 | </table> |
403 | 403 | |
404 | - <?php do_action( 'give_reports_tab_export_content_bottom' ); ?> |
|
404 | + <?php do_action('give_reports_tab_export_content_bottom'); ?> |
|
405 | 405 | |
406 | 406 | </div> |
407 | 407 | <!-- .post-body-content --> |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | <?php |
412 | 412 | } |
413 | 413 | |
414 | -add_action( 'give_reports_tab_export', 'give_reports_tab_export' ); |
|
414 | +add_action('give_reports_tab_export', 'give_reports_tab_export'); |
|
415 | 415 | |
416 | 416 | /** |
417 | 417 | * Renders the Reports page |
@@ -420,19 +420,19 @@ discard block |
||
420 | 420 | * @return void |
421 | 421 | */ |
422 | 422 | function give_reports_tab_logs() { |
423 | - require( GIVE_PLUGIN_DIR . 'includes/admin/reporting/logs.php' ); |
|
423 | + require(GIVE_PLUGIN_DIR.'includes/admin/reporting/logs.php'); |
|
424 | 424 | |
425 | 425 | $current_view = 'sales'; |
426 | 426 | $log_views = give_log_default_views(); |
427 | 427 | |
428 | - if ( isset( $_GET['view'] ) && array_key_exists( $_GET['view'], $log_views ) ) { |
|
428 | + if (isset($_GET['view']) && array_key_exists($_GET['view'], $log_views)) { |
|
429 | 429 | $current_view = $_GET['view']; |
430 | 430 | } |
431 | 431 | |
432 | - do_action( 'give_logs_view_' . $current_view ); |
|
432 | + do_action('give_logs_view_'.$current_view); |
|
433 | 433 | } |
434 | 434 | |
435 | -add_action( 'give_reports_tab_logs', 'give_reports_tab_logs' ); |
|
435 | +add_action('give_reports_tab_logs', 'give_reports_tab_logs'); |
|
436 | 436 | |
437 | 437 | /** |
438 | 438 | * Retrieves estimated monthly earnings and sales |
@@ -442,9 +442,9 @@ discard block |
||
442 | 442 | */ |
443 | 443 | function give_estimated_monthly_stats() { |
444 | 444 | |
445 | - $estimated = get_transient( 'give_estimated_monthly_stats' ); |
|
445 | + $estimated = get_transient('give_estimated_monthly_stats'); |
|
446 | 446 | |
447 | - if ( false === $estimated ) { |
|
447 | + if (false === $estimated) { |
|
448 | 448 | |
449 | 449 | $estimated = array( |
450 | 450 | 'earnings' => 0, |
@@ -453,20 +453,20 @@ discard block |
||
453 | 453 | |
454 | 454 | $stats = new Give_Payment_Stats; |
455 | 455 | |
456 | - $to_date_earnings = $stats->get_earnings( 0, 'this_month' ); |
|
457 | - $to_date_sales = $stats->get_sales( 0, 'this_month' ); |
|
456 | + $to_date_earnings = $stats->get_earnings(0, 'this_month'); |
|
457 | + $to_date_sales = $stats->get_sales(0, 'this_month'); |
|
458 | 458 | |
459 | - $current_day = date( 'd', current_time( 'timestamp' ) ); |
|
460 | - $current_month = date( 'n', current_time( 'timestamp' ) ); |
|
461 | - $current_year = date( 'Y', current_time( 'timestamp' ) ); |
|
462 | - $days_in_month = cal_days_in_month( CAL_GREGORIAN, $current_month, $current_year ); |
|
459 | + $current_day = date('d', current_time('timestamp')); |
|
460 | + $current_month = date('n', current_time('timestamp')); |
|
461 | + $current_year = date('Y', current_time('timestamp')); |
|
462 | + $days_in_month = cal_days_in_month(CAL_GREGORIAN, $current_month, $current_year); |
|
463 | 463 | |
464 | - $estimated['earnings'] = ( $to_date_earnings / $current_day ) * $days_in_month; |
|
465 | - $estimated['sales'] = ( $to_date_sales / $current_day ) * $days_in_month; |
|
464 | + $estimated['earnings'] = ($to_date_earnings / $current_day) * $days_in_month; |
|
465 | + $estimated['sales'] = ($to_date_sales / $current_day) * $days_in_month; |
|
466 | 466 | |
467 | 467 | // Cache for one day |
468 | - set_transient( 'give_estimated_monthly_stats', $estimated, 86400 ); |
|
468 | + set_transient('give_estimated_monthly_stats', $estimated, 86400); |
|
469 | 469 | } |
470 | 470 | |
471 | - return maybe_unserialize( $estimated ); |
|
471 | + return maybe_unserialize($estimated); |
|
472 | 472 | } |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if accessed directly |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
@@ -41,20 +41,20 @@ discard block |
||
41 | 41 | public function csv_cols() { |
42 | 42 | |
43 | 43 | $cols = array( |
44 | - 'ID' => __( 'ID', 'give' ), |
|
45 | - 'post_name' => __( 'Slug', 'give' ), |
|
46 | - 'post_title' => __( 'Name', 'give' ), |
|
47 | - 'post_date' => __( 'Date Created', 'give' ), |
|
48 | - 'post_author' => __( 'Author', 'give' ), |
|
49 | - 'post_content' => __( 'Description', 'give' ), |
|
50 | - 'post_excerpt' => __( 'Excerpt', 'give' ), |
|
51 | - 'post_status' => __( 'Status', 'give' ), |
|
52 | - 'categories' => __( 'Categories', 'give' ), |
|
53 | - 'tags' => __( 'Tags', 'give' ), |
|
54 | - 'give_price' => __( 'Price', 'give' ), |
|
55 | - '_thumbnail_id' => __( 'Featured Image', 'give' ), |
|
56 | - '_give_form_sales' => __( 'Donations', 'give' ), |
|
57 | - '_give_download_earnings' => __( 'Income', 'give' ), |
|
44 | + 'ID' => __('ID', 'give'), |
|
45 | + 'post_name' => __('Slug', 'give'), |
|
46 | + 'post_title' => __('Name', 'give'), |
|
47 | + 'post_date' => __('Date Created', 'give'), |
|
48 | + 'post_author' => __('Author', 'give'), |
|
49 | + 'post_content' => __('Description', 'give'), |
|
50 | + 'post_excerpt' => __('Excerpt', 'give'), |
|
51 | + 'post_status' => __('Status', 'give'), |
|
52 | + 'categories' => __('Categories', 'give'), |
|
53 | + 'tags' => __('Tags', 'give'), |
|
54 | + 'give_price' => __('Price', 'give'), |
|
55 | + '_thumbnail_id' => __('Featured Image', 'give'), |
|
56 | + '_give_form_sales' => __('Donations', 'give'), |
|
57 | + '_give_download_earnings' => __('Income', 'give'), |
|
58 | 58 | ); |
59 | 59 | |
60 | 60 | return $cols; |
@@ -86,43 +86,43 @@ discard block |
||
86 | 86 | 'paged' => $this->step |
87 | 87 | ); |
88 | 88 | |
89 | - $downloads = new WP_Query( $args ); |
|
89 | + $downloads = new WP_Query($args); |
|
90 | 90 | |
91 | - if ( $downloads->posts ) { |
|
92 | - foreach ( $downloads->posts as $download ) { |
|
91 | + if ($downloads->posts) { |
|
92 | + foreach ($downloads->posts as $download) { |
|
93 | 93 | |
94 | 94 | $row = array(); |
95 | 95 | |
96 | - foreach ( $this->csv_cols() as $key => $value ) { |
|
96 | + foreach ($this->csv_cols() as $key => $value) { |
|
97 | 97 | |
98 | 98 | // Setup default value |
99 | - $row[ $key ] = ''; |
|
99 | + $row[$key] = ''; |
|
100 | 100 | |
101 | - if ( in_array( $key, $meta ) ) { |
|
101 | + if (in_array($key, $meta)) { |
|
102 | 102 | |
103 | - switch ( $key ) { |
|
103 | + switch ($key) { |
|
104 | 104 | |
105 | 105 | case '_thumbnail_id' : |
106 | 106 | |
107 | - $image_id = get_post_thumbnail_id( $download->ID ); |
|
108 | - $row[ $key ] = wp_get_attachment_url( $image_id ); |
|
107 | + $image_id = get_post_thumbnail_id($download->ID); |
|
108 | + $row[$key] = wp_get_attachment_url($image_id); |
|
109 | 109 | |
110 | 110 | break; |
111 | 111 | |
112 | 112 | case 'give_price' : |
113 | 113 | |
114 | - if ( give_has_variable_prices( $download->ID ) ) { |
|
114 | + if (give_has_variable_prices($download->ID)) { |
|
115 | 115 | |
116 | 116 | $prices = array(); |
117 | - foreach ( give_get_variable_prices( $download->ID ) as $price ) { |
|
118 | - $prices[] = $price['name'] . ': ' . $price['amount']; |
|
117 | + foreach (give_get_variable_prices($download->ID) as $price) { |
|
118 | + $prices[] = $price['name'].': '.$price['amount']; |
|
119 | 119 | } |
120 | 120 | |
121 | - $row[ $key ] = implode( ' | ', $prices ); |
|
121 | + $row[$key] = implode(' | ', $prices); |
|
122 | 122 | |
123 | 123 | } else { |
124 | 124 | |
125 | - $row[ $key ] = give_get_download_price( $download->ID ); |
|
125 | + $row[$key] = give_get_download_price($download->ID); |
|
126 | 126 | |
127 | 127 | } |
128 | 128 | |
@@ -132,54 +132,54 @@ discard block |
||
132 | 132 | |
133 | 133 | |
134 | 134 | $files = array(); |
135 | - foreach ( give_get_download_files( $download->ID ) as $file ) { |
|
135 | + foreach (give_get_download_files($download->ID) as $file) { |
|
136 | 136 | $files[] = $file['file']; |
137 | 137 | } |
138 | 138 | |
139 | - $row[ $key ] = implode( ' | ', $files ); |
|
139 | + $row[$key] = implode(' | ', $files); |
|
140 | 140 | |
141 | 141 | break; |
142 | 142 | |
143 | 143 | default : |
144 | 144 | |
145 | - $row[ $key ] = get_post_meta( $download->ID, $key, true ); |
|
145 | + $row[$key] = get_post_meta($download->ID, $key, true); |
|
146 | 146 | |
147 | 147 | break; |
148 | 148 | |
149 | 149 | } |
150 | 150 | |
151 | - } elseif ( isset( $download->$key ) ) { |
|
151 | + } elseif (isset($download->$key)) { |
|
152 | 152 | |
153 | - switch ( $key ) { |
|
153 | + switch ($key) { |
|
154 | 154 | |
155 | 155 | case 'post_author' : |
156 | 156 | |
157 | - $row[ $key ] = get_the_author_meta( 'user_login', $download->post_author ); |
|
157 | + $row[$key] = get_the_author_meta('user_login', $download->post_author); |
|
158 | 158 | |
159 | 159 | break; |
160 | 160 | |
161 | 161 | default : |
162 | 162 | |
163 | - $row[ $key ] = $download->$key; |
|
163 | + $row[$key] = $download->$key; |
|
164 | 164 | |
165 | 165 | break; |
166 | 166 | } |
167 | 167 | |
168 | - } elseif ( 'tags' == $key ) { |
|
168 | + } elseif ('tags' == $key) { |
|
169 | 169 | |
170 | - $terms = get_the_terms( $download->ID, 'download_tag' ); |
|
171 | - if ( $terms ) { |
|
172 | - $terms = wp_list_pluck( $terms, 'name' ); |
|
173 | - $row[ $key ] = implode( ' | ', $terms ); |
|
170 | + $terms = get_the_terms($download->ID, 'download_tag'); |
|
171 | + if ($terms) { |
|
172 | + $terms = wp_list_pluck($terms, 'name'); |
|
173 | + $row[$key] = implode(' | ', $terms); |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | |
177 | - } elseif ( 'categories' == $key ) { |
|
177 | + } elseif ('categories' == $key) { |
|
178 | 178 | |
179 | - $terms = get_the_terms( $download->ID, 'download_category' ); |
|
180 | - if ( $terms ) { |
|
181 | - $terms = wp_list_pluck( $terms, 'name' ); |
|
182 | - $row[ $key ] = implode( ' | ', $terms ); |
|
179 | + $terms = get_the_terms($download->ID, 'download_category'); |
|
180 | + if ($terms) { |
|
181 | + $terms = wp_list_pluck($terms, 'name'); |
|
182 | + $row[$key] = implode(' | ', $terms); |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | } |
@@ -190,8 +190,8 @@ discard block |
||
190 | 190 | |
191 | 191 | } |
192 | 192 | |
193 | - $data = apply_filters( 'give_export_get_data', $data ); |
|
194 | - $data = apply_filters( 'give_export_get_data_' . $this->export_type, $data ); |
|
193 | + $data = apply_filters('give_export_get_data', $data); |
|
194 | + $data = apply_filters('give_export_get_data_'.$this->export_type, $data); |
|
195 | 195 | |
196 | 196 | return $data; |
197 | 197 | } |
@@ -210,20 +210,20 @@ discard block |
||
210 | 210 | |
211 | 211 | $args = array( |
212 | 212 | 'post_type' => 'give_forms', |
213 | - 'posts_per_page' => - 1, |
|
213 | + 'posts_per_page' => -1, |
|
214 | 214 | 'post_status' => 'any', |
215 | 215 | 'fields' => 'ids', |
216 | 216 | ); |
217 | 217 | |
218 | - $downloads = new WP_Query( $args ); |
|
218 | + $downloads = new WP_Query($args); |
|
219 | 219 | $total = (int) $downloads->post_count; |
220 | 220 | $percentage = 100; |
221 | 221 | |
222 | - if ( $total > 0 ) { |
|
223 | - $percentage = ( ( 30 * $this->step ) / $total ) * 100; |
|
222 | + if ($total > 0) { |
|
223 | + $percentage = ((30 * $this->step) / $total) * 100; |
|
224 | 224 | } |
225 | 225 | |
226 | - if ( $percentage > 100 ) { |
|
226 | + if ($percentage > 100) { |
|
227 | 227 | $percentage = 100; |
228 | 228 | } |
229 | 229 |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if accessed directly |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
@@ -39,29 +39,29 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function csv_cols() { |
41 | 41 | $cols = array( |
42 | - 'id' => __( 'ID', 'give' ), // unaltered payment ID (use for querying) |
|
43 | - 'seq_id' => __( 'Payment Number', 'give' ), // sequential payment ID |
|
44 | - 'email' => __( 'Email', 'give' ), |
|
45 | - 'first' => __( 'First Name', 'give' ), |
|
46 | - 'last' => __( 'Last Name', 'give' ), |
|
47 | - 'address1' => __( 'Address', 'give' ), |
|
48 | - 'address2' => __( 'Address (Line 2)', 'give' ), |
|
49 | - 'city' => __( 'City', 'give' ), |
|
50 | - 'state' => __( 'State', 'give' ), |
|
51 | - 'country' => __( 'Country', 'give' ), |
|
52 | - 'zip' => __( 'Zip / Postal Code', 'give' ), |
|
53 | - 'products' => __( 'Products', 'give' ), |
|
54 | - 'amount' => __( 'Amount', 'give' ) . ' (' . html_entity_decode( give_currency_filter( '' ) ) . ')', |
|
55 | - 'gateway' => __( 'Payment Method', 'give' ), |
|
56 | - 'trans_id' => __( 'Transaction ID', 'give' ), |
|
57 | - 'key' => __( 'Purchase Key', 'give' ), |
|
58 | - 'date' => __( 'Date', 'give' ), |
|
59 | - 'user' => __( 'User', 'give' ), |
|
60 | - 'status' => __( 'Status', 'give' ) |
|
42 | + 'id' => __('ID', 'give'), // unaltered payment ID (use for querying) |
|
43 | + 'seq_id' => __('Payment Number', 'give'), // sequential payment ID |
|
44 | + 'email' => __('Email', 'give'), |
|
45 | + 'first' => __('First Name', 'give'), |
|
46 | + 'last' => __('Last Name', 'give'), |
|
47 | + 'address1' => __('Address', 'give'), |
|
48 | + 'address2' => __('Address (Line 2)', 'give'), |
|
49 | + 'city' => __('City', 'give'), |
|
50 | + 'state' => __('State', 'give'), |
|
51 | + 'country' => __('Country', 'give'), |
|
52 | + 'zip' => __('Zip / Postal Code', 'give'), |
|
53 | + 'products' => __('Products', 'give'), |
|
54 | + 'amount' => __('Amount', 'give').' ('.html_entity_decode(give_currency_filter('')).')', |
|
55 | + 'gateway' => __('Payment Method', 'give'), |
|
56 | + 'trans_id' => __('Transaction ID', 'give'), |
|
57 | + 'key' => __('Purchase Key', 'give'), |
|
58 | + 'date' => __('Date', 'give'), |
|
59 | + 'user' => __('User', 'give'), |
|
60 | + 'status' => __('Status', 'give') |
|
61 | 61 | ); |
62 | 62 | |
63 | - if ( ! give_get_option( 'enable_sequential' ) ) { |
|
64 | - unset( $cols['seq_id'] ); |
|
63 | + if ( ! give_get_option('enable_sequential')) { |
|
64 | + unset($cols['seq_id']); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | return $cols; |
@@ -87,12 +87,12 @@ discard block |
||
87 | 87 | 'status' => $this->status |
88 | 88 | ); |
89 | 89 | |
90 | - if ( ! empty( $this->start ) || ! empty( $this->end ) ) { |
|
90 | + if ( ! empty($this->start) || ! empty($this->end)) { |
|
91 | 91 | |
92 | 92 | $args['date_query'] = array( |
93 | 93 | array( |
94 | - 'after' => date( 'Y-n-d 00:00:00', strtotime( $this->start ) ), |
|
95 | - 'before' => date( 'Y-n-d 23:59:59', strtotime( $this->end ) ), |
|
94 | + 'after' => date('Y-n-d 00:00:00', strtotime($this->start)), |
|
95 | + 'before' => date('Y-n-d 23:59:59', strtotime($this->end)), |
|
96 | 96 | 'inclusive' => true |
97 | 97 | ) |
98 | 98 | ); |
@@ -101,104 +101,104 @@ discard block |
||
101 | 101 | |
102 | 102 | //echo json_encode($args ); exit; |
103 | 103 | |
104 | - $payments = give_get_payments( $args ); |
|
104 | + $payments = give_get_payments($args); |
|
105 | 105 | |
106 | - if ( $payments ) { |
|
106 | + if ($payments) { |
|
107 | 107 | |
108 | - foreach ( $payments as $payment ) { |
|
109 | - $payment_meta = give_get_payment_meta( $payment->ID ); |
|
110 | - $user_info = give_get_payment_meta_user_info( $payment->ID ); |
|
111 | - $total = give_get_payment_amount( $payment->ID ); |
|
112 | - $user_id = isset( $user_info['id'] ) && $user_info['id'] != - 1 ? $user_info['id'] : $user_info['email']; |
|
108 | + foreach ($payments as $payment) { |
|
109 | + $payment_meta = give_get_payment_meta($payment->ID); |
|
110 | + $user_info = give_get_payment_meta_user_info($payment->ID); |
|
111 | + $total = give_get_payment_amount($payment->ID); |
|
112 | + $user_id = isset($user_info['id']) && $user_info['id'] != - 1 ? $user_info['id'] : $user_info['email']; |
|
113 | 113 | $products = ''; |
114 | 114 | $skus = ''; |
115 | 115 | |
116 | - if ( $downloads ) { |
|
117 | - foreach ( $downloads as $key => $download ) { |
|
116 | + if ($downloads) { |
|
117 | + foreach ($downloads as $key => $download) { |
|
118 | 118 | |
119 | 119 | // Form ID |
120 | - $id = isset( $payment_meta['cart_details'] ) ? $download['id'] : $download; |
|
121 | - $qty = isset( $download['quantity'] ) ? $download['quantity'] : 1; |
|
120 | + $id = isset($payment_meta['cart_details']) ? $download['id'] : $download; |
|
121 | + $qty = isset($download['quantity']) ? $download['quantity'] : 1; |
|
122 | 122 | |
123 | - if ( isset( $download['price'] ) ) { |
|
123 | + if (isset($download['price'])) { |
|
124 | 124 | $price = $download['price']; |
125 | 125 | } else { |
126 | 126 | // If the download has variable prices, override the default price |
127 | - $price_override = isset( $payment_meta['cart_details'] ) ? $download['price'] : null; |
|
128 | - $price = give_get_download_final_price( $id, $user_info, $price_override ); |
|
127 | + $price_override = isset($payment_meta['cart_details']) ? $download['price'] : null; |
|
128 | + $price = give_get_download_final_price($id, $user_info, $price_override); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | |
132 | 132 | // Display the Downoad Name |
133 | - $products .= html_entity_decode( get_the_title( $id ) ); |
|
133 | + $products .= html_entity_decode(get_the_title($id)); |
|
134 | 134 | |
135 | - if ( $qty > 1 ) { |
|
136 | - $products .= html_entity_decode( ' (' . $qty . ')' ); |
|
135 | + if ($qty > 1) { |
|
136 | + $products .= html_entity_decode(' ('.$qty.')'); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | $products .= ' - '; |
140 | 140 | |
141 | - if ( give_use_skus() ) { |
|
142 | - $sku = give_get_download_sku( $id ); |
|
141 | + if (give_use_skus()) { |
|
142 | + $sku = give_get_download_sku($id); |
|
143 | 143 | |
144 | - if ( ! empty( $sku ) ) { |
|
144 | + if ( ! empty($sku)) { |
|
145 | 145 | $skus .= $sku; |
146 | 146 | } |
147 | 147 | } |
148 | 148 | |
149 | - if ( isset( $downloads[ $key ]['item_number'] ) && isset( $downloads[ $key ]['item_number']['options'] ) ) { |
|
150 | - $price_options = $downloads[ $key ]['item_number']['options']; |
|
149 | + if (isset($downloads[$key]['item_number']) && isset($downloads[$key]['item_number']['options'])) { |
|
150 | + $price_options = $downloads[$key]['item_number']['options']; |
|
151 | 151 | |
152 | - if ( isset( $price_options['price_id'] ) ) { |
|
153 | - $products .= html_entity_decode( give_get_price_option_name( $id, $price_options['price_id'], $payment->ID ) ) . ' - '; |
|
152 | + if (isset($price_options['price_id'])) { |
|
153 | + $products .= html_entity_decode(give_get_price_option_name($id, $price_options['price_id'], $payment->ID)).' - '; |
|
154 | 154 | } |
155 | 155 | } |
156 | 156 | |
157 | - $products .= html_entity_decode( give_currency_filter( give_format_amount( $price ) ) ); |
|
157 | + $products .= html_entity_decode(give_currency_filter(give_format_amount($price))); |
|
158 | 158 | |
159 | - if ( $key != ( count( $downloads ) - 1 ) ) { |
|
159 | + if ($key != (count($downloads) - 1)) { |
|
160 | 160 | $products .= ' / '; |
161 | 161 | |
162 | - if ( give_use_skus() ) { |
|
162 | + if (give_use_skus()) { |
|
163 | 163 | $skus .= ' / '; |
164 | 164 | } |
165 | 165 | } |
166 | 166 | } |
167 | 167 | } |
168 | 168 | |
169 | - if ( is_numeric( $user_id ) ) { |
|
170 | - $user = get_userdata( $user_id ); |
|
169 | + if (is_numeric($user_id)) { |
|
170 | + $user = get_userdata($user_id); |
|
171 | 171 | } else { |
172 | 172 | $user = false; |
173 | 173 | } |
174 | 174 | |
175 | 175 | $data[] = array( |
176 | 176 | 'id' => $payment->ID, |
177 | - 'seq_id' => give_get_payment_number( $payment->ID ), |
|
177 | + 'seq_id' => give_get_payment_number($payment->ID), |
|
178 | 178 | 'email' => $payment_meta['email'], |
179 | 179 | 'first' => $user_info['first_name'], |
180 | 180 | 'last' => $user_info['last_name'], |
181 | - 'address1' => isset( $user_info['address']['line1'] ) ? $user_info['address']['line1'] : '', |
|
182 | - 'address2' => isset( $user_info['address']['line2'] ) ? $user_info['address']['line2'] : '', |
|
183 | - 'city' => isset( $user_info['address']['city'] ) ? $user_info['address']['city'] : '', |
|
184 | - 'state' => isset( $user_info['address']['state'] ) ? $user_info['address']['state'] : '', |
|
185 | - 'country' => isset( $user_info['address']['country'] ) ? $user_info['address']['country'] : '', |
|
186 | - 'zip' => isset( $user_info['address']['zip'] ) ? $user_info['address']['zip'] : '', |
|
181 | + 'address1' => isset($user_info['address']['line1']) ? $user_info['address']['line1'] : '', |
|
182 | + 'address2' => isset($user_info['address']['line2']) ? $user_info['address']['line2'] : '', |
|
183 | + 'city' => isset($user_info['address']['city']) ? $user_info['address']['city'] : '', |
|
184 | + 'state' => isset($user_info['address']['state']) ? $user_info['address']['state'] : '', |
|
185 | + 'country' => isset($user_info['address']['country']) ? $user_info['address']['country'] : '', |
|
186 | + 'zip' => isset($user_info['address']['zip']) ? $user_info['address']['zip'] : '', |
|
187 | 187 | 'products' => $products, |
188 | 188 | 'skus' => $skus, |
189 | - 'amount' => html_entity_decode( give_format_amount( $total ) ), |
|
190 | - 'gateway' => give_get_gateway_admin_label( get_post_meta( $payment->ID, '_give_payment_gateway', true ) ), |
|
191 | - 'trans_id' => give_get_payment_transaction_id( $payment->ID ), |
|
189 | + 'amount' => html_entity_decode(give_format_amount($total)), |
|
190 | + 'gateway' => give_get_gateway_admin_label(get_post_meta($payment->ID, '_give_payment_gateway', true)), |
|
191 | + 'trans_id' => give_get_payment_transaction_id($payment->ID), |
|
192 | 192 | 'key' => $payment_meta['key'], |
193 | 193 | 'date' => $payment->post_date, |
194 | - 'user' => $user ? $user->display_name : __( 'guest', 'give' ), |
|
195 | - 'status' => give_get_payment_status( $payment, true ) |
|
194 | + 'user' => $user ? $user->display_name : __('guest', 'give'), |
|
195 | + 'status' => give_get_payment_status($payment, true) |
|
196 | 196 | ); |
197 | 197 | |
198 | 198 | } |
199 | 199 | |
200 | - $data = apply_filters( 'give_export_get_data', $data ); |
|
201 | - $data = apply_filters( 'give_export_get_data_' . $this->export_type, $data ); |
|
200 | + $data = apply_filters('give_export_get_data', $data); |
|
201 | + $data = apply_filters('give_export_get_data_'.$this->export_type, $data); |
|
202 | 202 | |
203 | 203 | return $data; |
204 | 204 | |
@@ -218,27 +218,27 @@ discard block |
||
218 | 218 | |
219 | 219 | $status = $this->status; |
220 | 220 | $args = array( |
221 | - 'start-date' => date( 'n/d/Y', strtotime( $this->start ) ), |
|
222 | - 'end-date' => date( 'n/d/Y', strtotime( $this->end ) ), |
|
221 | + 'start-date' => date('n/d/Y', strtotime($this->start)), |
|
222 | + 'end-date' => date('n/d/Y', strtotime($this->end)), |
|
223 | 223 | ); |
224 | 224 | |
225 | - if ( 'any' == $status ) { |
|
225 | + if ('any' == $status) { |
|
226 | 226 | |
227 | - $total = array_sum( (array) give_count_payments( $args ) ); |
|
227 | + $total = array_sum((array) give_count_payments($args)); |
|
228 | 228 | |
229 | 229 | } else { |
230 | 230 | |
231 | - $total = give_count_payments( $args )->$status; |
|
231 | + $total = give_count_payments($args)->$status; |
|
232 | 232 | |
233 | 233 | } |
234 | 234 | |
235 | 235 | $percentage = 100; |
236 | 236 | |
237 | - if ( $total > 0 ) { |
|
238 | - $percentage = ( ( 30 * $this->step ) / $total ) * 100; |
|
237 | + if ($total > 0) { |
|
238 | + $percentage = ((30 * $this->step) / $total) * 100; |
|
239 | 239 | } |
240 | 240 | |
241 | - if ( $percentage > 100 ) { |
|
241 | + if ($percentage > 100) { |
|
242 | 242 | $percentage = 100; |
243 | 243 | } |
244 | 244 | |
@@ -252,9 +252,9 @@ discard block |
||
252 | 252 | * |
253 | 253 | * @param array $request The Form Data passed into the batch processing |
254 | 254 | */ |
255 | - public function set_properties( $request ) { |
|
256 | - $this->start = isset( $request['start'] ) ? sanitize_text_field( $request['start'] ) : ''; |
|
257 | - $this->end = isset( $request['end'] ) ? sanitize_text_field( $request['end'] ) : ''; |
|
258 | - $this->status = isset( $request['status'] ) ? sanitize_text_field( $request['status'] ) : 'complete'; |
|
255 | + public function set_properties($request) { |
|
256 | + $this->start = isset($request['start']) ? sanitize_text_field($request['start']) : ''; |
|
257 | + $this->end = isset($request['end']) ? sanitize_text_field($request['end']) : ''; |
|
258 | + $this->status = isset($request['status']) ? sanitize_text_field($request['status']) : 'complete'; |
|
259 | 259 | } |
260 | 260 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
11 | 11 | */ |
12 | 12 | |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -22,20 +22,20 @@ discard block |
||
22 | 22 | */ |
23 | 23 | function give_process_batch_export_form() { |
24 | 24 | |
25 | - if ( ! wp_verify_nonce( $_REQUEST['nonce'], 'give-batch-export' ) ) { |
|
26 | - wp_die( __( 'Nonce verification failed', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
25 | + if ( ! wp_verify_nonce($_REQUEST['nonce'], 'give-batch-export')) { |
|
26 | + wp_die(__('Nonce verification failed', 'give'), __('Error', 'give'), array('response' => 403)); |
|
27 | 27 | } |
28 | 28 | |
29 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export.php'; |
|
29 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/class-batch-export.php'; |
|
30 | 30 | |
31 | - do_action( 'give_batch_export_class_include', $_REQUEST['class'] ); |
|
31 | + do_action('give_batch_export_class_include', $_REQUEST['class']); |
|
32 | 32 | |
33 | 33 | $export = new $_REQUEST['class']; |
34 | 34 | $export->export(); |
35 | 35 | |
36 | 36 | } |
37 | 37 | |
38 | -add_action( 'give_form_batch_export', 'give_process_batch_export_form' ); |
|
38 | +add_action('give_form_batch_export', 'give_process_batch_export_form'); |
|
39 | 39 | |
40 | 40 | /** |
41 | 41 | * Exports earnings for a specified time period |
@@ -46,14 +46,14 @@ discard block |
||
46 | 46 | * @return void |
47 | 47 | */ |
48 | 48 | function give_export_earnings() { |
49 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-export-earnings.php'; |
|
49 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-export-earnings.php'; |
|
50 | 50 | |
51 | 51 | $earnings_export = new Give_Earnings_Export(); |
52 | 52 | |
53 | 53 | $earnings_export->export(); |
54 | 54 | } |
55 | 55 | |
56 | -add_action( 'give_earnings_export', 'give_export_earnings' ); |
|
56 | +add_action('give_earnings_export', 'give_export_earnings'); |
|
57 | 57 | |
58 | 58 | |
59 | 59 | /** |
@@ -66,14 +66,14 @@ discard block |
||
66 | 66 | * @return void |
67 | 67 | */ |
68 | 68 | function give_export_all_customers() { |
69 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-export-customers.php'; |
|
69 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-export-customers.php'; |
|
70 | 70 | |
71 | 71 | $customer_export = new Give_Customers_Export(); |
72 | 72 | |
73 | 73 | $customer_export->export(); |
74 | 74 | } |
75 | 75 | |
76 | -add_action( 'give_email_export', 'give_export_all_customers' ); |
|
76 | +add_action('give_email_export', 'give_export_all_customers'); |
|
77 | 77 | |
78 | 78 | /** |
79 | 79 | * Exports all the downloads to a CSV file using the Give_Export class. |
@@ -82,14 +82,14 @@ discard block |
||
82 | 82 | * @return void |
83 | 83 | */ |
84 | 84 | function give_export_all_downloads_history() { |
85 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-export-download-history.php'; |
|
85 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-export-download-history.php'; |
|
86 | 86 | |
87 | 87 | $file_download_export = new Give_Download_History_Export(); |
88 | 88 | |
89 | 89 | $file_download_export->export(); |
90 | 90 | } |
91 | 91 | |
92 | -add_action( 'give_downloads_history_export', 'give_export_all_downloads_history' ); |
|
92 | +add_action('give_downloads_history_export', 'give_export_all_downloads_history'); |
|
93 | 93 | |
94 | 94 | /** |
95 | 95 | * Add a hook allowing extensions to register a hook on the batch export process |
@@ -98,22 +98,22 @@ discard block |
||
98 | 98 | * @return void |
99 | 99 | */ |
100 | 100 | function give_register_batch_exporters() { |
101 | - if ( is_admin() ) { |
|
102 | - do_action( 'give_register_batch_exporter' ); |
|
101 | + if (is_admin()) { |
|
102 | + do_action('give_register_batch_exporter'); |
|
103 | 103 | } |
104 | 104 | } |
105 | 105 | |
106 | -add_action( 'plugins_loaded', 'give_register_batch_exporters' ); |
|
106 | +add_action('plugins_loaded', 'give_register_batch_exporters'); |
|
107 | 107 | |
108 | 108 | /** |
109 | 109 | * Register the payments batch exporter |
110 | 110 | * @since 1.5 |
111 | 111 | */ |
112 | 112 | function give_register_payments_batch_export() { |
113 | - add_action( 'give_batch_export_class_include', 'give_include_payments_batch_processer', 10, 1 ); |
|
113 | + add_action('give_batch_export_class_include', 'give_include_payments_batch_processer', 10, 1); |
|
114 | 114 | } |
115 | 115 | |
116 | -add_action( 'give_register_batch_exporter', 'give_register_payments_batch_export', 10 ); |
|
116 | +add_action('give_register_batch_exporter', 'give_register_payments_batch_export', 10); |
|
117 | 117 | |
118 | 118 | /** |
119 | 119 | * Loads the payments batch process if needed |
@@ -124,10 +124,10 @@ discard block |
||
124 | 124 | * |
125 | 125 | * @return void |
126 | 126 | */ |
127 | -function give_include_payments_batch_processer( $class ) { |
|
127 | +function give_include_payments_batch_processer($class) { |
|
128 | 128 | |
129 | - if ( 'Give_Batch_Payments_Export' === $class ) { |
|
130 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export-payments.php'; |
|
129 | + if ('Give_Batch_Payments_Export' === $class) { |
|
130 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/class-batch-export-payments.php'; |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | } |
@@ -137,10 +137,10 @@ discard block |
||
137 | 137 | * @since 1.5.2 |
138 | 138 | */ |
139 | 139 | function give_register_customers_batch_export() { |
140 | - add_action( 'give_batch_export_class_include', 'give_include_customers_batch_processer', 10, 1 ); |
|
140 | + add_action('give_batch_export_class_include', 'give_include_customers_batch_processer', 10, 1); |
|
141 | 141 | } |
142 | 142 | |
143 | -add_action( 'give_register_batch_exporter', 'give_register_customers_batch_export', 10 ); |
|
143 | +add_action('give_register_batch_exporter', 'give_register_customers_batch_export', 10); |
|
144 | 144 | |
145 | 145 | /** |
146 | 146 | * Loads the customers batch process if needed |
@@ -151,10 +151,10 @@ discard block |
||
151 | 151 | * |
152 | 152 | * @return void |
153 | 153 | */ |
154 | -function give_include_customers_batch_processer( $class ) { |
|
154 | +function give_include_customers_batch_processer($class) { |
|
155 | 155 | |
156 | - if ( 'Give_Batch_Customers_Export' === $class ) { |
|
157 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export-customers.php'; |
|
156 | + if ('Give_Batch_Customers_Export' === $class) { |
|
157 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/class-batch-export-customers.php'; |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | } |
@@ -165,10 +165,10 @@ discard block |
||
165 | 165 | * @since 1.5 |
166 | 166 | */ |
167 | 167 | function give_register_forms_batch_export() { |
168 | - add_action( 'give_batch_export_class_include', 'give_include_forms_batch_processor', 10, 1 ); |
|
168 | + add_action('give_batch_export_class_include', 'give_include_forms_batch_processor', 10, 1); |
|
169 | 169 | } |
170 | 170 | |
171 | -add_action( 'give_register_batch_exporter', 'give_register_forms_batch_export', 10 ); |
|
171 | +add_action('give_register_batch_exporter', 'give_register_forms_batch_export', 10); |
|
172 | 172 | |
173 | 173 | /** |
174 | 174 | * Loads the file downloads batch process if needed |
@@ -179,10 +179,10 @@ discard block |
||
179 | 179 | * |
180 | 180 | * @return void |
181 | 181 | */ |
182 | -function give_include_forms_batch_processor( $class ) { |
|
182 | +function give_include_forms_batch_processor($class) { |
|
183 | 183 | |
184 | - if ( 'Give_Batch_Forms_Export' === $class ) { |
|
185 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export-forms.php'; |
|
184 | + if ('Give_Batch_Forms_Export' === $class) { |
|
185 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/class-batch-export-forms.php'; |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | } |
189 | 189 | \ No newline at end of file |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if accessed directly |
15 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
15 | +if ( ! defined('ABSPATH')) exit; |
|
16 | 16 | |
17 | 17 | /** |
18 | 18 | * Give_Batch_Export Class |
@@ -104,14 +104,14 @@ discard block |
||
104 | 104 | * @param $_step int The step to process |
105 | 105 | * @since 1.5 |
106 | 106 | */ |
107 | - public function __construct( $_step = 1 ) { |
|
107 | + public function __construct($_step = 1) { |
|
108 | 108 | |
109 | 109 | $upload_dir = wp_upload_dir(); |
110 | 110 | $this->filetype = '.csv'; |
111 | - $this->filename = 'give-' . $this->export_type . $this->filetype; |
|
112 | - $this->file = trailingslashit( $upload_dir['basedir'] ) . $this->filename; |
|
111 | + $this->filename = 'give-'.$this->export_type.$this->filetype; |
|
112 | + $this->file = trailingslashit($upload_dir['basedir']).$this->filename; |
|
113 | 113 | |
114 | - if ( ! is_writeable( $upload_dir['basedir'] ) ) { |
|
114 | + if ( ! is_writeable($upload_dir['basedir'])) { |
|
115 | 115 | $this->is_writable = false; |
116 | 116 | } |
117 | 117 | |
@@ -127,20 +127,20 @@ discard block |
||
127 | 127 | */ |
128 | 128 | public function process_step() { |
129 | 129 | |
130 | - if ( ! $this->can_export() ) { |
|
131 | - wp_die( __( 'You do not have permission to export data.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
130 | + if ( ! $this->can_export()) { |
|
131 | + wp_die(__('You do not have permission to export data.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
132 | 132 | } |
133 | 133 | |
134 | - if( $this->step < 2 ) { |
|
134 | + if ($this->step < 2) { |
|
135 | 135 | |
136 | 136 | // Make sure we start with a fresh file on step 1 |
137 | - @unlink( $this->file ); |
|
137 | + @unlink($this->file); |
|
138 | 138 | $this->print_csv_cols(); |
139 | 139 | } |
140 | 140 | |
141 | 141 | $rows = $this->print_csv_rows(); |
142 | 142 | |
143 | - if( $rows ) { |
|
143 | + if ($rows) { |
|
144 | 144 | return true; |
145 | 145 | } else { |
146 | 146 | return false; |
@@ -160,14 +160,14 @@ discard block |
||
160 | 160 | $col_data = ''; |
161 | 161 | $cols = $this->get_csv_cols(); |
162 | 162 | $i = 1; |
163 | - foreach( $cols as $col_id => $column ) { |
|
164 | - $col_data .= '"' . addslashes( $column ) . '"'; |
|
165 | - $col_data .= $i == count( $cols ) ? '' : ','; |
|
163 | + foreach ($cols as $col_id => $column) { |
|
164 | + $col_data .= '"'.addslashes($column).'"'; |
|
165 | + $col_data .= $i == count($cols) ? '' : ','; |
|
166 | 166 | $i++; |
167 | 167 | } |
168 | 168 | $col_data .= "\r\n"; |
169 | 169 | |
170 | - $this->stash_step_data( $col_data ); |
|
170 | + $this->stash_step_data($col_data); |
|
171 | 171 | |
172 | 172 | return $col_data; |
173 | 173 | |
@@ -186,23 +186,23 @@ discard block |
||
186 | 186 | $data = $this->get_data(); |
187 | 187 | $cols = $this->get_csv_cols(); |
188 | 188 | |
189 | - if( $data ) { |
|
189 | + if ($data) { |
|
190 | 190 | |
191 | 191 | // Output each row |
192 | - foreach ( $data as $row ) { |
|
192 | + foreach ($data as $row) { |
|
193 | 193 | $i = 1; |
194 | - foreach ( $row as $col_id => $column ) { |
|
194 | + foreach ($row as $col_id => $column) { |
|
195 | 195 | // Make sure the column is valid |
196 | - if ( array_key_exists( $col_id, $cols ) ) { |
|
197 | - $row_data .= '"' . addslashes( preg_replace( "/\"/","'", $column ) ) . '"'; |
|
198 | - $row_data .= $i == count( $cols ) ? '' : ','; |
|
196 | + if (array_key_exists($col_id, $cols)) { |
|
197 | + $row_data .= '"'.addslashes(preg_replace("/\"/", "'", $column)).'"'; |
|
198 | + $row_data .= $i == count($cols) ? '' : ','; |
|
199 | 199 | $i++; |
200 | 200 | } |
201 | 201 | } |
202 | 202 | $row_data .= "\r\n"; |
203 | 203 | } |
204 | 204 | |
205 | - $this->stash_step_data( $row_data ); |
|
205 | + $this->stash_step_data($row_data); |
|
206 | 206 | |
207 | 207 | return $row_data; |
208 | 208 | } |
@@ -230,18 +230,18 @@ discard block |
||
230 | 230 | |
231 | 231 | $file = ''; |
232 | 232 | |
233 | - if ( @file_exists( $this->file ) ) { |
|
233 | + if (@file_exists($this->file)) { |
|
234 | 234 | |
235 | - if ( ! is_writeable( $this->file ) ) { |
|
235 | + if ( ! is_writeable($this->file)) { |
|
236 | 236 | $this->is_writable = false; |
237 | 237 | } |
238 | 238 | |
239 | - $file = @file_get_contents( $this->file ); |
|
239 | + $file = @file_get_contents($this->file); |
|
240 | 240 | |
241 | 241 | } else { |
242 | 242 | |
243 | - @file_put_contents( $this->file, '' ); |
|
244 | - @chmod( $this->file, 0664 ); |
|
243 | + @file_put_contents($this->file, ''); |
|
244 | + @chmod($this->file, 0664); |
|
245 | 245 | |
246 | 246 | } |
247 | 247 | |
@@ -255,18 +255,18 @@ discard block |
||
255 | 255 | * @param $data string The data to add to the file |
256 | 256 | * @return void |
257 | 257 | */ |
258 | - protected function stash_step_data( $data = '' ) { |
|
258 | + protected function stash_step_data($data = '') { |
|
259 | 259 | |
260 | 260 | $file = $this->get_file(); |
261 | 261 | $file .= $data; |
262 | - @file_put_contents( $this->file, $file ); |
|
262 | + @file_put_contents($this->file, $file); |
|
263 | 263 | |
264 | 264 | // If we have no rows after this step, mark it as an empty export |
265 | - $file_rows = file( $this->file, FILE_SKIP_EMPTY_LINES); |
|
265 | + $file_rows = file($this->file, FILE_SKIP_EMPTY_LINES); |
|
266 | 266 | $default_cols = $this->get_csv_cols(); |
267 | - $default_cols = empty( $default_cols ) ? 0 : 1; |
|
267 | + $default_cols = empty($default_cols) ? 0 : 1; |
|
268 | 268 | |
269 | - $this->is_empty = count( $file_rows ) == $default_cols ? true : false; |
|
269 | + $this->is_empty = count($file_rows) == $default_cols ? true : false; |
|
270 | 270 | |
271 | 271 | } |
272 | 272 | |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | |
285 | 285 | $file = $this->get_file(); |
286 | 286 | |
287 | - @unlink( $this->file ); |
|
287 | + @unlink($this->file); |
|
288 | 288 | |
289 | 289 | echo $file; |
290 | 290 | |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | * @since 1.5 |
298 | 298 | * @param array $request The Form Data passed into the batch processing |
299 | 299 | */ |
300 | - public function set_properties( $request ) {} |
|
300 | + public function set_properties($request) {} |
|
301 | 301 | |
302 | 302 | /** |
303 | 303 | * Allow for prefetching of data for the remainder of the exporter |
@@ -10,7 +10,9 @@ |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
13 | +if ( ! defined( 'ABSPATH' ) ) { |
|
14 | + exit; |
|
15 | +} |
|
14 | 16 | |
15 | 17 | /** |
16 | 18 | * Give_API_V1 Class |
@@ -11,12 +11,12 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // Exit if accessed directly |
14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
14 | +if ( ! defined('ABSPATH')) { |
|
15 | 15 | exit; |
16 | 16 | } |
17 | 17 | |
18 | -require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-export.php'; |
|
19 | -require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/export-actions.php'; |
|
18 | +require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-export.php'; |
|
19 | +require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/export-actions.php'; |
|
20 | 20 | |
21 | 21 | /** |
22 | 22 | * Process batch exports via ajax |
@@ -26,79 +26,79 @@ discard block |
||
26 | 26 | */ |
27 | 27 | function give_do_ajax_export() { |
28 | 28 | |
29 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export.php'; |
|
29 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/class-batch-export.php'; |
|
30 | 30 | |
31 | - parse_str( $_POST['form'], $form ); |
|
31 | + parse_str($_POST['form'], $form); |
|
32 | 32 | |
33 | 33 | $_REQUEST = $form = (array) $form; |
34 | 34 | |
35 | - if ( ! wp_verify_nonce( $_REQUEST['give_ajax_export'], 'give_ajax_export' ) ) { |
|
36 | - die( '-2' ); |
|
35 | + if ( ! wp_verify_nonce($_REQUEST['give_ajax_export'], 'give_ajax_export')) { |
|
36 | + die('-2'); |
|
37 | 37 | } |
38 | 38 | |
39 | - do_action( 'give_batch_export_class_include', $form['give-export-class'] ); |
|
39 | + do_action('give_batch_export_class_include', $form['give-export-class']); |
|
40 | 40 | |
41 | - $step = absint( $_POST['step'] ); |
|
42 | - $class = sanitize_text_field( $form['give-export-class'] ); |
|
41 | + $step = absint($_POST['step']); |
|
42 | + $class = sanitize_text_field($form['give-export-class']); |
|
43 | 43 | |
44 | - $export = new $class( $step ); |
|
44 | + $export = new $class($step); |
|
45 | 45 | |
46 | - if ( ! $export->can_export() ) { |
|
47 | - die( '-1' ); |
|
46 | + if ( ! $export->can_export()) { |
|
47 | + die('-1'); |
|
48 | 48 | } |
49 | 49 | |
50 | - if ( ! $export->is_writable ) { |
|
50 | + if ( ! $export->is_writable) { |
|
51 | 51 | $json_args = array( |
52 | 52 | 'error' => true, |
53 | - 'message' => __( 'Export location or file not writable', 'give' ) |
|
53 | + 'message' => __('Export location or file not writable', 'give') |
|
54 | 54 | ); |
55 | 55 | echo json_encode($json_args); |
56 | 56 | exit; |
57 | 57 | } |
58 | 58 | |
59 | - $export->set_properties( $_REQUEST ); |
|
59 | + $export->set_properties($_REQUEST); |
|
60 | 60 | |
61 | 61 | $export->pre_fetch(); |
62 | 62 | |
63 | - $ret = $export->process_step( $step ); |
|
63 | + $ret = $export->process_step($step); |
|
64 | 64 | |
65 | 65 | $percentage = $export->get_percentage_complete(); |
66 | 66 | |
67 | - if ( $ret ) { |
|
67 | + if ($ret) { |
|
68 | 68 | |
69 | 69 | $step += 1; |
70 | - echo json_encode( array( 'step' => $step, 'percentage' => $percentage ) ); |
|
70 | + echo json_encode(array('step' => $step, 'percentage' => $percentage)); |
|
71 | 71 | exit; |
72 | 72 | |
73 | - } elseif ( true === $export->is_empty ) { |
|
73 | + } elseif (true === $export->is_empty) { |
|
74 | 74 | |
75 | - echo json_encode( array( |
|
75 | + echo json_encode(array( |
|
76 | 76 | 'error' => true, |
77 | - 'message' => __( 'No data found for export parameters', 'give' ) |
|
78 | - ) ); |
|
77 | + 'message' => __('No data found for export parameters', 'give') |
|
78 | + )); |
|
79 | 79 | exit; |
80 | 80 | |
81 | - } elseif ( true === $export->done && true === $export->is_void ) { |
|
81 | + } elseif (true === $export->done && true === $export->is_void) { |
|
82 | 82 | |
83 | - $message = ! empty( $export->message ) ? $export->message : __( 'Batch Processing Complete', 'give' ); |
|
84 | - echo json_encode( array( 'success' => true, 'message' => $message ) ); |
|
83 | + $message = ! empty($export->message) ? $export->message : __('Batch Processing Complete', 'give'); |
|
84 | + echo json_encode(array('success' => true, 'message' => $message)); |
|
85 | 85 | exit; |
86 | 86 | |
87 | 87 | } else { |
88 | 88 | |
89 | - $args = array_merge( $_REQUEST, array( |
|
89 | + $args = array_merge($_REQUEST, array( |
|
90 | 90 | 'step' => $step, |
91 | 91 | 'class' => $class, |
92 | - 'nonce' => wp_create_nonce( 'give-batch-export' ), |
|
92 | + 'nonce' => wp_create_nonce('give-batch-export'), |
|
93 | 93 | 'give_action' => 'form_batch_export', |
94 | - ) ); |
|
94 | + )); |
|
95 | 95 | |
96 | - $download_url = add_query_arg( $args, admin_url() ); |
|
96 | + $download_url = add_query_arg($args, admin_url()); |
|
97 | 97 | |
98 | - echo json_encode( array( 'step' => 'done', 'url' => $download_url ) ); |
|
98 | + echo json_encode(array('step' => 'done', 'url' => $download_url)); |
|
99 | 99 | exit; |
100 | 100 | |
101 | 101 | } |
102 | 102 | } |
103 | 103 | |
104 | -add_action( 'wp_ajax_give_do_ajax_export', 'give_do_ajax_export' ); |
|
104 | +add_action('wp_ajax_give_do_ajax_export', 'give_do_ajax_export'); |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if accessed directly |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
@@ -41,11 +41,11 @@ discard block |
||
41 | 41 | public function csv_cols() { |
42 | 42 | |
43 | 43 | $cols = array( |
44 | - 'id' => __( 'ID', 'give' ), |
|
45 | - 'name' => __( 'Name', 'give' ), |
|
46 | - 'email' => __( 'Email', 'give' ), |
|
47 | - 'purchases' => __( 'Number of Donations', 'give' ), |
|
48 | - 'amount' => __( 'Donor Value', 'give' ) |
|
44 | + 'id' => __('ID', 'give'), |
|
45 | + 'name' => __('Name', 'give'), |
|
46 | + 'email' => __('Email', 'give'), |
|
47 | + 'purchases' => __('Number of Donations', 'give'), |
|
48 | + 'amount' => __('Donor Value', 'give') |
|
49 | 49 | ); |
50 | 50 | |
51 | 51 | return $cols; |
@@ -64,19 +64,19 @@ discard block |
||
64 | 64 | |
65 | 65 | $data = array(); |
66 | 66 | |
67 | - if ( ! empty( $this->form ) ) { |
|
67 | + if ( ! empty($this->form)) { |
|
68 | 68 | |
69 | 69 | // Export customers of a specific product |
70 | 70 | global $give_logs; |
71 | 71 | |
72 | 72 | $args = array( |
73 | - 'post_parent' => absint( $this->form ), |
|
73 | + 'post_parent' => absint($this->form), |
|
74 | 74 | 'log_type' => 'sale', |
75 | 75 | 'posts_per_page' => 30, |
76 | 76 | 'paged' => $this->step |
77 | 77 | ); |
78 | 78 | |
79 | - if ( null !== $this->price_id ) { |
|
79 | + if (null !== $this->price_id) { |
|
80 | 80 | $args['meta_query'] = array( |
81 | 81 | array( |
82 | 82 | 'key' => '_give_log_price_id', |
@@ -85,21 +85,21 @@ discard block |
||
85 | 85 | ); |
86 | 86 | } |
87 | 87 | |
88 | - $logs = $give_logs->get_connected_logs( $args ); |
|
88 | + $logs = $give_logs->get_connected_logs($args); |
|
89 | 89 | |
90 | - if ( $logs ) { |
|
91 | - foreach ( $logs as $log ) { |
|
90 | + if ($logs) { |
|
91 | + foreach ($logs as $log) { |
|
92 | 92 | |
93 | - $payment_id = get_post_meta( $log->ID, '_give_log_payment_id', true ); |
|
94 | - $customer_id = give_get_payment_customer_id( $payment_id ); |
|
95 | - $customer = new Give_Customer( $customer_id ); |
|
93 | + $payment_id = get_post_meta($log->ID, '_give_log_payment_id', true); |
|
94 | + $customer_id = give_get_payment_customer_id($payment_id); |
|
95 | + $customer = new Give_Customer($customer_id); |
|
96 | 96 | |
97 | 97 | $data[] = array( |
98 | 98 | 'id' => $customer->id, |
99 | 99 | 'name' => $customer->name, |
100 | 100 | 'email' => $customer->email, |
101 | 101 | 'purchases' => $customer->purchase_count, |
102 | - 'amount' => give_format_amount( $customer->purchase_value ), |
|
102 | + 'amount' => give_format_amount($customer->purchase_value), |
|
103 | 103 | ); |
104 | 104 | } |
105 | 105 | } |
@@ -107,25 +107,25 @@ discard block |
||
107 | 107 | } else { |
108 | 108 | |
109 | 109 | // Export all customers |
110 | - $offset = 30 * ( $this->step - 1 ); |
|
111 | - $customers = Give()->customers->get_customers( array( 'number' => 30, 'offset' => $offset ) ); |
|
110 | + $offset = 30 * ($this->step - 1); |
|
111 | + $customers = Give()->customers->get_customers(array('number' => 30, 'offset' => $offset)); |
|
112 | 112 | |
113 | 113 | $i = 0; |
114 | 114 | |
115 | - foreach ( $customers as $customer ) { |
|
115 | + foreach ($customers as $customer) { |
|
116 | 116 | |
117 | - $data[ $i ]['id'] = $customer->id; |
|
118 | - $data[ $i ]['name'] = $customer->name; |
|
119 | - $data[ $i ]['email'] = $customer->email; |
|
120 | - $data[ $i ]['purchases'] = $customer->purchase_count; |
|
121 | - $data[ $i ]['amount'] = give_format_amount( $customer->purchase_value ); |
|
117 | + $data[$i]['id'] = $customer->id; |
|
118 | + $data[$i]['name'] = $customer->name; |
|
119 | + $data[$i]['email'] = $customer->email; |
|
120 | + $data[$i]['purchases'] = $customer->purchase_count; |
|
121 | + $data[$i]['amount'] = give_format_amount($customer->purchase_value); |
|
122 | 122 | |
123 | - $i ++; |
|
123 | + $i++; |
|
124 | 124 | } |
125 | 125 | } |
126 | 126 | |
127 | - $data = apply_filters( 'give_export_get_data', $data ); |
|
128 | - $data = apply_filters( 'give_export_get_data_' . $this->export_type, $data ); |
|
127 | + $data = apply_filters('give_export_get_data', $data); |
|
128 | + $data = apply_filters('give_export_get_data_'.$this->export_type, $data); |
|
129 | 129 | |
130 | 130 | return $data; |
131 | 131 | } |
@@ -141,19 +141,19 @@ discard block |
||
141 | 141 | $percentage = 0; |
142 | 142 | |
143 | 143 | // We can't count the number when getting them for a specific form |
144 | - if ( empty( $this->form ) ) { |
|
144 | + if (empty($this->form)) { |
|
145 | 145 | |
146 | 146 | $total = Give()->customers->count(); |
147 | 147 | |
148 | - if ( $total > 0 ) { |
|
148 | + if ($total > 0) { |
|
149 | 149 | |
150 | - $percentage = ( ( 30 * $this->step ) / $total ) * 100; |
|
150 | + $percentage = ((30 * $this->step) / $total) * 100; |
|
151 | 151 | |
152 | 152 | } |
153 | 153 | |
154 | 154 | } |
155 | 155 | |
156 | - if ( $percentage > 100 ) { |
|
156 | + if ($percentage > 100) { |
|
157 | 157 | $percentage = 100; |
158 | 158 | } |
159 | 159 | |
@@ -167,10 +167,10 @@ discard block |
||
167 | 167 | * |
168 | 168 | * @param array $request The Form Data passed into the batch processing |
169 | 169 | */ |
170 | - public function set_properties( $request ) { |
|
171 | - $this->start = isset( $request['start'] ) ? sanitize_text_field( $request['start'] ) : ''; |
|
172 | - $this->end = isset( $request['end'] ) ? sanitize_text_field( $request['end'] ) : ''; |
|
173 | - $this->form = isset( $request['form'] ) ? absint( $request['form'] ) : null; |
|
174 | - $this->price_id = ! empty( $request['give_price_option'] ) && 0 !== $request['give_price_option'] ? absint( $request['give_price_option'] ) : null; |
|
170 | + public function set_properties($request) { |
|
171 | + $this->start = isset($request['start']) ? sanitize_text_field($request['start']) : ''; |
|
172 | + $this->end = isset($request['end']) ? sanitize_text_field($request['end']) : ''; |
|
173 | + $this->form = isset($request['form']) ? absint($request['form']) : null; |
|
174 | + $this->price_id = ! empty($request['give_price_option']) && 0 !== $request['give_price_option'] ? absint($request['give_price_option']) : null; |
|
175 | 175 | } |
176 | 176 | } |