Completed
Push — master ( 45b05a...b92b5a )
by Devin
53s
created
includes/emails/functions.php 1 patch
Spacing   +93 added lines, -93 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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'];
Please login to merge, or discard this patch.
includes/admin/payments/view-order-details.php 1 patch
Spacing   +126 added lines, -126 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -20,27 +20,27 @@  discard block
 block discarded – undo
20 20
  * @since 1.0
21 21
  * @return void
22 22
  */
23
-if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) {
24
-	wp_die( __( 'Donation ID not supplied. Please try again', 'give' ), __( 'Error', 'give' ) );
23
+if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) {
24
+	wp_die(__('Donation ID not supplied. Please try again', 'give'), __('Error', 'give'));
25 25
 }
26 26
 
27 27
 // Setup the variables
28
-$payment_id = absint( $_GET['id'] );
29
-$payment    = new Give_Payment( $payment_id );
28
+$payment_id = absint($_GET['id']);
29
+$payment    = new Give_Payment($payment_id);
30 30
 
31 31
 // Sanity check... fail if purchase ID is invalid
32 32
 $payment_exists = $payment->ID;
33
-if ( empty( $payment_exists ) ) {
34
-	wp_die( __( 'The specified ID does not belong to a payment. Please try again', 'give' ), __( 'Error', 'give' ) );
33
+if (empty($payment_exists)) {
34
+	wp_die(__('The specified ID does not belong to a payment. Please try again', 'give'), __('Error', 'give'));
35 35
 }
36 36
 
37 37
 $number         = $payment->number;
38 38
 $payment_meta   = $payment->get_meta();
39
-$transaction_id = esc_attr( $payment->transaction_id );
39
+$transaction_id = esc_attr($payment->transaction_id);
40 40
 $user_id        = $payment->user_id;
41 41
 $customer_id    = $payment->customer_id;
42
-$payment_date   = strtotime( $payment->date );
43
-$user_info      = give_get_payment_meta_user_info( $payment_id );
42
+$payment_date   = strtotime($payment->date);
43
+$user_info      = give_get_payment_meta_user_info($payment_id);
44 44
 $address        = $payment->address;
45 45
 $gateway        = $payment->gateway;
46 46
 $currency_code  = $payment->currency;
@@ -49,72 +49,72 @@  discard block
 block discarded – undo
49 49
 $payment_mode   = $payment->mode;
50 50
 ?>
51 51
 <div class="wrap give-wrap">
52
-	<h1 id="transaction-details-heading"><?php printf( __( 'Payment %s', 'give' ), $number ); ?><?php if ( $payment_mode == 'test' ) {
53
-			echo '<span id="test-payment-label" class="give-item-label give-item-label-orange" data-tooltip="' . __( 'This payment was made in Test Mode', 'give' ) . '" data-tooltip-my-position="center left" data-tooltip-target-position="center right">' . __( 'Test Payment', 'give' ) . '</span>';
52
+	<h1 id="transaction-details-heading"><?php printf(__('Payment %s', 'give'), $number); ?><?php if ($payment_mode == 'test') {
53
+			echo '<span id="test-payment-label" class="give-item-label give-item-label-orange" data-tooltip="'.__('This payment was made in Test Mode', 'give').'" data-tooltip-my-position="center left" data-tooltip-target-position="center right">'.__('Test Payment', 'give').'</span>';
54 54
 		} ?></h1>
55 55
 
56
-	<?php do_action( 'give_view_order_details_before', $payment_id ); ?>
56
+	<?php do_action('give_view_order_details_before', $payment_id); ?>
57 57
 	<form id="give-edit-order-form" method="post">
58
-		<?php do_action( 'give_view_order_details_form_top', $payment_id ); ?>
58
+		<?php do_action('give_view_order_details_form_top', $payment_id); ?>
59 59
 		<div id="poststuff">
60 60
 			<div id="give-dashboard-widgets-wrap">
61 61
 				<div id="post-body" class="metabox-holder columns-2">
62 62
 					<div id="postbox-container-1" class="postbox-container">
63 63
 						<div id="side-sortables" class="meta-box-sortables ui-sortable">
64 64
 
65
-							<?php do_action( 'give_view_order_details_sidebar_before', $payment_id ); ?>
65
+							<?php do_action('give_view_order_details_sidebar_before', $payment_id); ?>
66 66
 
67 67
 
68 68
 							<div id="give-order-update" class="postbox give-order-data">
69 69
 
70 70
 								<h3 class="hndle">
71
-									<span><?php _e( 'Update Payment', 'give' ); ?></span>
71
+									<span><?php _e('Update Payment', 'give'); ?></span>
72 72
 								</h3>
73 73
 
74 74
 								<div class="inside">
75 75
 									<div class="give-admin-box">
76 76
 
77
-										<?php do_action( 'give_view_order_details_totals_before', $payment_id ); ?>
77
+										<?php do_action('give_view_order_details_totals_before', $payment_id); ?>
78 78
 
79 79
 										<div class="give-admin-box-inside">
80 80
 											<p>
81
-												<span class="label"><?php _e( 'Status:', 'give' ); ?></span>&nbsp;
81
+												<span class="label"><?php _e('Status:', 'give'); ?></span>&nbsp;
82 82
 												<select name="give-payment-status" class="medium-text">
83
-													<?php foreach ( give_get_payment_statuses() as $key => $status ) : ?>
84
-														<option value="<?php echo esc_attr( $key ); ?>"<?php selected( $payment->status, $key, true ); ?>><?php echo esc_html( $status ); ?></option>
83
+													<?php foreach (give_get_payment_statuses() as $key => $status) : ?>
84
+														<option value="<?php echo esc_attr($key); ?>"<?php selected($payment->status, $key, true); ?>><?php echo esc_html($status); ?></option>
85 85
 													<?php endforeach; ?>
86 86
 												</select>
87
-												<span class="give-donation-status status-<?php echo sanitize_title( $payment->status ); ?>"><span class="give-donation-status-icon"></span></span>
87
+												<span class="give-donation-status status-<?php echo sanitize_title($payment->status); ?>"><span class="give-donation-status-icon"></span></span>
88 88
 											</p>
89 89
 										</div>
90 90
 
91 91
 										<div class="give-admin-box-inside">
92 92
 											<p>
93
-												<span class="label"><?php _e( 'Date:', 'give' ); ?></span>&nbsp;
94
-												<input type="text" name="give-payment-date" value="<?php echo esc_attr( date( 'm/d/Y', $payment_date ) ); ?>" class="medium-text give_datepicker"/>
93
+												<span class="label"><?php _e('Date:', 'give'); ?></span>&nbsp;
94
+												<input type="text" name="give-payment-date" value="<?php echo esc_attr(date('m/d/Y', $payment_date)); ?>" class="medium-text give_datepicker"/>
95 95
 											</p>
96 96
 										</div>
97 97
 
98 98
 										<div class="give-admin-box-inside">
99 99
 											<p>
100
-												<span class="label"><?php _e( 'Time:', 'give' ); ?></span>&nbsp;
101
-												<input type="number" step="1" max="24" name="give-payment-time-hour" value="<?php echo esc_attr( date_i18n( 'H', $payment_date ) ); ?>" class="small-text give-payment-time-hour"/>&nbsp;:&nbsp;
102
-												<input type="number" step="1" max="59" name="give-payment-time-min" value="<?php echo esc_attr( date( 'i', $payment_date ) ); ?>" class="small-text give-payment-time-min"/>
100
+												<span class="label"><?php _e('Time:', 'give'); ?></span>&nbsp;
101
+												<input type="number" step="1" max="24" name="give-payment-time-hour" value="<?php echo esc_attr(date_i18n('H', $payment_date)); ?>" class="small-text give-payment-time-hour"/>&nbsp;:&nbsp;
102
+												<input type="number" step="1" max="59" name="give-payment-time-min" value="<?php echo esc_attr(date('i', $payment_date)); ?>" class="small-text give-payment-time-min"/>
103 103
 											</p>
104 104
 										</div>
105 105
 
106
-										<?php do_action( 'give_view_order_details_update_inner', $payment_id ); ?>
106
+										<?php do_action('give_view_order_details_update_inner', $payment_id); ?>
107 107
 
108 108
 										<?php
109 109
 										//@TODO: Fees
110
-										$fees = give_get_payment_fees( $payment_id );
111
-										if ( ! empty( $fees ) ) : ?>
110
+										$fees = give_get_payment_fees($payment_id);
111
+										if ( ! empty($fees)) : ?>
112 112
 											<div class="give-order-fees give-admin-box-inside">
113
-												<p class="strong"><?php _e( 'Fees', 'give' ); ?>:</p>
113
+												<p class="strong"><?php _e('Fees', 'give'); ?>:</p>
114 114
 												<ul class="give-payment-fees">
115
-													<?php foreach ( $fees as $fee ) : ?>
115
+													<?php foreach ($fees as $fee) : ?>
116 116
 														<li>
117
-															<span class="fee-label"><?php echo $fee['label'] . ':</span> ' . '<span class="fee-amount" data-fee="' . esc_attr( $fee['amount'] ) . '">' . give_currency_filter( $fee['amount'], $currency_code ); ?></span>
117
+															<span class="fee-label"><?php echo $fee['label'].':</span> '.'<span class="fee-amount" data-fee="'.esc_attr($fee['amount']).'">'.give_currency_filter($fee['amount'], $currency_code); ?></span>
118 118
 														</li>
119 119
 													<?php endforeach; ?>
120 120
 												</ul>
@@ -124,12 +124,12 @@  discard block
 block discarded – undo
124 124
 
125 125
 										<div class="give-order-payment give-admin-box-inside">
126 126
 											<p>
127
-												<span class="label"><?php _e( 'Total Donation', 'give' ); ?>:</span>&nbsp;
128
-												<?php echo give_currency_symbol( $payment->currency ); ?>&nbsp;<input name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr( give_format_amount( give_get_payment_amount( $payment_id ) ) ); ?>"/>
127
+												<span class="label"><?php _e('Total Donation', 'give'); ?>:</span>&nbsp;
128
+												<?php echo give_currency_symbol($payment->currency); ?>&nbsp;<input name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr(give_format_amount(give_get_payment_amount($payment_id))); ?>"/>
129 129
 											</p>
130 130
 										</div>
131 131
 
132
-										<?php do_action( 'give_view_order_details_totals_after', $payment_id ); ?>
132
+										<?php do_action('give_view_order_details_totals_after', $payment_id); ?>
133 133
 
134 134
 									</div>
135 135
 									<!-- /.give-admin-box -->
@@ -138,20 +138,20 @@  discard block
 block discarded – undo
138 138
 								<!-- /.inside -->
139 139
 
140 140
 								<div class="give-order-update-box give-admin-box">
141
-									<?php do_action( 'give_view_order_details_update_before', $payment_id ); ?>
141
+									<?php do_action('give_view_order_details_update_before', $payment_id); ?>
142 142
 									<div id="major-publishing-actions">
143 143
 										<div id="publishing-action">
144
-											<input type="submit" class="button button-primary right" value="<?php esc_attr_e( 'Save Payment', 'give' ); ?>"/>
145
-											<?php if ( give_is_payment_complete( $payment_id ) ) : ?>
146
-												<a href="<?php echo esc_url( add_query_arg( array(
144
+											<input type="submit" class="button button-primary right" value="<?php esc_attr_e('Save Payment', 'give'); ?>"/>
145
+											<?php if (give_is_payment_complete($payment_id)) : ?>
146
+												<a href="<?php echo esc_url(add_query_arg(array(
147 147
 													'give-action' => 'email_links',
148 148
 													'purchase_id' => $payment_id
149
-												) ) ); ?>" id="give-resend-receipt" class="button-secondary right"><?php _e( 'Resend Receipt', 'give' ); ?></a>
149
+												))); ?>" id="give-resend-receipt" class="button-secondary right"><?php _e('Resend Receipt', 'give'); ?></a>
150 150
 											<?php endif; ?>
151 151
 										</div>
152 152
 										<div class="clear"></div>
153 153
 									</div>
154
-									<?php do_action( 'give_view_order_details_update_after', $payment_id ); ?>
154
+									<?php do_action('give_view_order_details_update_after', $payment_id); ?>
155 155
 								</div>
156 156
 								<!-- /.give-order-update-box -->
157 157
 
@@ -161,55 +161,55 @@  discard block
 block discarded – undo
161 161
 							<div id="give-order-details" class="postbox give-order-data">
162 162
 
163 163
 								<h3 class="hndle">
164
-									<span><?php _e( 'Payment Meta', 'give' ); ?></span>
164
+									<span><?php _e('Payment Meta', 'give'); ?></span>
165 165
 								</h3>
166 166
 
167 167
 								<div class="inside">
168 168
 									<div class="give-admin-box">
169 169
 
170
-										<?php do_action( 'give_view_order_details_payment_meta_before', $payment_id ); ?>
170
+										<?php do_action('give_view_order_details_payment_meta_before', $payment_id); ?>
171 171
 
172 172
 										<?php
173
-										$gateway = give_get_payment_gateway( $payment_id );
174
-										if ( $gateway ) : ?>
173
+										$gateway = give_get_payment_gateway($payment_id);
174
+										if ($gateway) : ?>
175 175
 											<div class="give-order-gateway give-admin-box-inside">
176 176
 												<p>
177
-													<span class="label"><?php _e( 'Gateway:', 'give' ); ?></span>&nbsp;
178
-													<?php echo give_get_gateway_admin_label( $gateway ); ?>
177
+													<span class="label"><?php _e('Gateway:', 'give'); ?></span>&nbsp;
178
+													<?php echo give_get_gateway_admin_label($gateway); ?>
179 179
 												</p>
180 180
 											</div>
181 181
 										<?php endif; ?>
182 182
 
183 183
 										<div class="give-order-payment-key give-admin-box-inside">
184 184
 											<p>
185
-												<span class="label"><?php _e( 'Key:', 'give' ); ?></span>&nbsp;
186
-												<span><?php echo give_get_payment_key( $payment_id ); ?></span>
185
+												<span class="label"><?php _e('Key:', 'give'); ?></span>&nbsp;
186
+												<span><?php echo give_get_payment_key($payment_id); ?></span>
187 187
 											</p>
188 188
 										</div>
189 189
 
190 190
 										<div class="give-order-ip give-admin-box-inside">
191 191
 											<p>
192
-												<span class="label"><?php _e( 'IP:', 'give' ); ?></span>&nbsp;
193
-												<span><?php echo esc_html( give_get_payment_user_ip( $payment_id ) ); ?></span>
192
+												<span class="label"><?php _e('IP:', 'give'); ?></span>&nbsp;
193
+												<span><?php echo esc_html(give_get_payment_user_ip($payment_id)); ?></span>
194 194
 											</p>
195 195
 										</div>
196 196
 
197
-										<?php if ( $transaction_id ) : ?>
197
+										<?php if ($transaction_id) : ?>
198 198
 											<div class="give-order-tx-id give-admin-box-inside">
199 199
 												<p>
200
-													<span class="label"><?php _e( 'Transaction ID:', 'give' ); ?></span>&nbsp;
201
-													<span><?php echo apply_filters( 'give_payment_details_transaction_id-' . $gateway, $transaction_id, $payment_id ); ?></span>
200
+													<span class="label"><?php _e('Transaction ID:', 'give'); ?></span>&nbsp;
201
+													<span><?php echo apply_filters('give_payment_details_transaction_id-'.$gateway, $transaction_id, $payment_id); ?></span>
202 202
 												</p>
203 203
 											</div>
204 204
 										<?php endif; ?>
205 205
 
206 206
 										<div class="give-admin-box-inside">
207
-											<p><?php $purchase_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . esc_attr( give_get_payment_user_email( $payment_id ) ) ); ?>
208
-												<a href="<?php echo $purchase_url; ?>"><?php _e( 'View all donations for this donor', 'give' ); ?> &raquo;</a>
207
+											<p><?php $purchase_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&user='.esc_attr(give_get_payment_user_email($payment_id))); ?>
208
+												<a href="<?php echo $purchase_url; ?>"><?php _e('View all donations for this donor', 'give'); ?> &raquo;</a>
209 209
 											</p>
210 210
 										</div>
211 211
 
212
-										<?php do_action( 'give_view_order_details_payment_meta_after', $payment_id ); ?>
212
+										<?php do_action('give_view_order_details_payment_meta_after', $payment_id); ?>
213 213
 
214 214
 									</div>
215 215
 									<!-- /.column-container -->
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 							</div>
221 221
 							<!-- /#give-order-data -->
222 222
 
223
-							<?php do_action( 'give_view_order_details_sidebar_after', $payment_id ); ?>
223
+							<?php do_action('give_view_order_details_sidebar_after', $payment_id); ?>
224 224
 
225 225
 						</div>
226 226
 						<!-- /#side-sortables -->
@@ -231,12 +231,12 @@  discard block
 block discarded – undo
231 231
 
232 232
 						<div id="normal-sortables" class="meta-box-sortables ui-sortable">
233 233
 
234
-							<?php do_action( 'give_view_order_details_main_before', $payment_id ); ?>
234
+							<?php do_action('give_view_order_details_main_before', $payment_id); ?>
235 235
 
236 236
 							<?php $column_count = 'columns-3'; ?>
237 237
 							<div id="give-donation-overview" class="postbox <?php echo $column_count; ?>">
238 238
 								<h3 class="hndle">
239
-									<span><?php _e( 'Donation Information', 'give' ); ?></span>
239
+									<span><?php _e('Donation Information', 'give'); ?></span>
240 240
 								</h3>
241 241
 
242 242
 								<div class="inside">
@@ -244,29 +244,29 @@  discard block
 block discarded – undo
244 244
 									<table style="width:100%;text-align:left;">
245 245
 										<thead>
246 246
 										<tr>
247
-											<?php do_action( 'give_donation_details_thead_before', $payment_id ); ?>
248
-											<th><?php _e( 'Donation Form ID', 'give' ) ?></th>
249
-											<th><?php _e( 'Donation Form Title', 'give' ) ?></th>
250
-											<th><?php _e( 'Donation Level', 'give' ) ?></th>
251
-											<th><?php _e( 'Donation Date', 'give' ) ?></th>
252
-											<th><?php _e( 'Total Donation', 'give' ) ?></th>
253
-											<?php do_action( 'give_donation_details_thead_after', $payment_id ); ?>
247
+											<?php do_action('give_donation_details_thead_before', $payment_id); ?>
248
+											<th><?php _e('Donation Form ID', 'give') ?></th>
249
+											<th><?php _e('Donation Form Title', 'give') ?></th>
250
+											<th><?php _e('Donation Level', 'give') ?></th>
251
+											<th><?php _e('Donation Date', 'give') ?></th>
252
+											<th><?php _e('Total Donation', 'give') ?></th>
253
+											<?php do_action('give_donation_details_thead_after', $payment_id); ?>
254 254
 										</tr>
255 255
 										</thead>
256 256
 										<tr>
257
-											<?php do_action( 'give_donation_details_tbody_before', $payment_id ); ?>
257
+											<?php do_action('give_donation_details_tbody_before', $payment_id); ?>
258 258
 											<td>
259 259
 												<?php echo $payment_meta['form_id']; ?>
260 260
 											</td>
261 261
 											<td>
262
-												<a href="<?php echo get_permalink( $payment_meta['form_id'] ); ?>"><?php echo $payment_meta['form_title']; ?></a>
262
+												<a href="<?php echo get_permalink($payment_meta['form_id']); ?>"><?php echo $payment_meta['form_title']; ?></a>
263 263
 											</td>
264 264
 											<td>
265 265
 												<?php
266 266
 												//Level ID
267
-												$level_title = give_get_payment_form_title( $payment_meta, true );
268
-												if ( empty( $level_title ) ) {
269
-													echo __( 'n/a', 'give' );
267
+												$level_title = give_get_payment_form_title($payment_meta, true);
268
+												if (empty($level_title)) {
269
+													echo __('n/a', 'give');
270 270
 												} else {
271 271
 													echo $level_title;
272 272
 												} ?>
@@ -274,13 +274,13 @@  discard block
 block discarded – undo
274 274
 											<td>
275 275
 												<?php
276 276
 												//Transaction Date
277
-												$date_format = get_option( 'date_format' );
278
-												echo date_i18n( $date_format, strtotime( $payment_date ) );
277
+												$date_format = get_option('date_format');
278
+												echo date_i18n($date_format, strtotime($payment_date));
279 279
 												?>
280 280
 											</td>
281 281
 											<td>
282
-												<?php echo esc_html( give_currency_filter( give_format_amount( give_get_payment_amount( $payment_id ) ) ) ); ?></td>
283
-											<?php do_action( 'give_donation_details_tbody_after', $payment_id ); ?>
282
+												<?php echo esc_html(give_currency_filter(give_format_amount(give_get_payment_amount($payment_id)))); ?></td>
283
+											<?php do_action('give_donation_details_tbody_after', $payment_id); ?>
284 284
 
285 285
 										</tr>
286 286
 									</table>
@@ -292,64 +292,64 @@  discard block
 block discarded – undo
292 292
 							</div>
293 293
 							<!-- /#give-donation-overview -->
294 294
 
295
-							<?php do_action( 'give_view_order_details_files_after', $payment_id ); ?>
295
+							<?php do_action('give_view_order_details_files_after', $payment_id); ?>
296 296
 
297
-							<?php do_action( 'give_view_order_details_billing_before', $payment_id ); ?>
297
+							<?php do_action('give_view_order_details_billing_before', $payment_id); ?>
298 298
 
299 299
 
300 300
 							<div id="give-customer-details" class="postbox">
301 301
 								<h3 class="hndle">
302
-									<span><?php _e( 'Donor Details', 'give' ); ?></span>
302
+									<span><?php _e('Donor Details', 'give'); ?></span>
303 303
 								</h3>
304 304
 
305 305
 								<div class="inside give-clearfix">
306 306
 
307
-									<?php $customer = new Give_Customer( $customer_id ); ?>
307
+									<?php $customer = new Give_Customer($customer_id); ?>
308 308
 
309 309
 									<div class="column-container customer-info">
310 310
 										<div class="column">
311
-											<?php echo Give()->html->donor_dropdown( array(
311
+											<?php echo Give()->html->donor_dropdown(array(
312 312
 												'selected' => $customer->id,
313 313
 												'name'     => 'customer-id'
314
-											) ); ?>
314
+											)); ?>
315 315
 										</div>
316 316
 										<div class="column">
317 317
 											<input type="hidden" name="give-current-customer" value="<?php echo $customer->id; ?>"/>
318 318
 										</div>
319 319
 										<div class="column">
320
-											<?php if ( ! empty( $customer->id ) ) : ?>
321
-												<?php $customer_url = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer->id ); ?>
322
-												<a href="<?php echo $customer_url; ?>" title="<?php _e( 'View Donor Details', 'give' ); ?>"><?php _e( 'View Donor Details', 'give' ); ?></a>
320
+											<?php if ( ! empty($customer->id)) : ?>
321
+												<?php $customer_url = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer->id); ?>
322
+												<a href="<?php echo $customer_url; ?>" title="<?php _e('View Donor Details', 'give'); ?>"><?php _e('View Donor Details', 'give'); ?></a>
323 323
 												&nbsp;|&nbsp;
324 324
 											<?php endif; ?>
325
-											<a href="#new" class="give-payment-new-customer" title="<?php _e( 'New Donor', 'give' ); ?>"><?php _e( 'New Donor', 'give' ); ?></a>
325
+											<a href="#new" class="give-payment-new-customer" title="<?php _e('New Donor', 'give'); ?>"><?php _e('New Donor', 'give'); ?></a>
326 326
 										</div>
327 327
 									</div>
328 328
 
329 329
 									<div class="column-container new-customer" style="display: none">
330 330
 										<div class="column">
331
-											<strong><?php _e( 'Name:', 'give' ); ?></strong>&nbsp;
331
+											<strong><?php _e('Name:', 'give'); ?></strong>&nbsp;
332 332
 											<input type="text" name="give-new-customer-name" value="" class="medium-text"/>
333 333
 										</div>
334 334
 										<div class="column">
335
-											<strong><?php _e( 'Email:', 'give' ); ?></strong>&nbsp;
335
+											<strong><?php _e('Email:', 'give'); ?></strong>&nbsp;
336 336
 											<input type="email" name="give-new-customer-email" value="" class="medium-text"/>
337 337
 										</div>
338 338
 										<div class="column">
339 339
 											<input type="hidden" id="give-new-customer" name="give-new-customer" value="0"/>
340
-											<a href="#cancel" class="give-payment-new-customer-cancel give-delete"><?php _e( 'Cancel', 'give' ); ?></a>
340
+											<a href="#cancel" class="give-payment-new-customer-cancel give-delete"><?php _e('Cancel', 'give'); ?></a>
341 341
 										</div>
342 342
 										<div class="column">
343 343
 											<small>
344
-												<em>*<?php _e( 'Click "Save Payment" to create new donor', 'give' ); ?></em>
344
+												<em>*<?php _e('Click "Save Payment" to create new donor', 'give'); ?></em>
345 345
 											</small>
346 346
 										</div>
347 347
 									</div>
348 348
 
349 349
 									<?php
350 350
 									// The give_payment_personal_details_list hook is left here for backwards compatibility
351
-									do_action( 'give_payment_personal_details_list', $payment_meta, $user_info );
352
-									do_action( 'give_payment_view_details', $payment_id );
351
+									do_action('give_payment_personal_details_list', $payment_meta, $user_info);
352
+									do_action('give_payment_view_details', $payment_id);
353 353
 									?>
354 354
 
355 355
 								</div>
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
 
361 361
 							<div id="give-billing-details" class="postbox">
362 362
 								<h3 class="hndle">
363
-									<span><?php _e( 'Billing Address', 'give' ); ?></span>
363
+									<span><?php _e('Billing Address', 'give'); ?></span>
364 364
 								</h3>
365 365
 
366 366
 								<div class="inside give-clearfix">
@@ -371,62 +371,62 @@  discard block
 block discarded – undo
371 371
 											<div class="data column-container">
372 372
 												<div class="column">
373 373
 													<p>
374
-														<strong class="order-data-address-line"><?php _e( 'Street Address Line 1:', 'give' ); ?></strong><br/>
375
-														<input type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr( $address['line1'] ); ?>" class="medium-text"/>
374
+														<strong class="order-data-address-line"><?php _e('Street Address Line 1:', 'give'); ?></strong><br/>
375
+														<input type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr($address['line1']); ?>" class="medium-text"/>
376 376
 													</p>
377 377
 
378 378
 													<p>
379
-														<strong class="order-data-address-line"><?php _e( 'Street Address Line 2:', 'give' ); ?></strong><br/>
380
-														<input type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr( $address['line2'] ); ?>" class="medium-text"/>
379
+														<strong class="order-data-address-line"><?php _e('Street Address Line 2:', 'give'); ?></strong><br/>
380
+														<input type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr($address['line2']); ?>" class="medium-text"/>
381 381
 													</p>
382 382
 
383 383
 												</div>
384 384
 												<div class="column">
385 385
 													<p>
386
-														<strong class="order-data-address-line"><?php echo _x( 'City:', 'Address City', 'give' ); ?></strong><br/>
387
-														<input type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr( $address['city'] ); ?>" class="medium-text"/>
386
+														<strong class="order-data-address-line"><?php echo _x('City:', 'Address City', 'give'); ?></strong><br/>
387
+														<input type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr($address['city']); ?>" class="medium-text"/>
388 388
 
389 389
 													</p>
390 390
 
391 391
 													<p>
392
-														<strong class="order-data-address-line"><?php echo _x( 'Zip / Postal Code:', 'Zip / Postal code of address', 'give' ); ?></strong><br/>
393
-														<input type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr( $address['zip'] ); ?>" class="medium-text"/>
392
+														<strong class="order-data-address-line"><?php echo _x('Zip / Postal Code:', 'Zip / Postal code of address', 'give'); ?></strong><br/>
393
+														<input type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr($address['zip']); ?>" class="medium-text"/>
394 394
 
395 395
 													</p>
396 396
 												</div>
397 397
 												<div class="column">
398 398
 													<p id="give-order-address-country-wrap">
399
-														<strong class="order-data-address-line"><?php echo _x( 'Country:', 'Address country', 'give' ); ?></strong><br/>
399
+														<strong class="order-data-address-line"><?php echo _x('Country:', 'Address country', 'give'); ?></strong><br/>
400 400
 														<?php
401
-														echo Give()->html->select( array(
401
+														echo Give()->html->select(array(
402 402
 															'options'          => give_get_country_list(),
403 403
 															'name'             => 'give-payment-address[0][country]',
404 404
 															'selected'         => $address['country'],
405 405
 															'show_option_all'  => false,
406 406
 															'show_option_none' => false,
407 407
 															'chosen'           => true,
408
-															'placeholder'      => __( 'Select a country', 'give' )
409
-														) );
408
+															'placeholder'      => __('Select a country', 'give')
409
+														));
410 410
 														?>
411 411
 													</p>
412 412
 
413 413
 													<p id="give-order-address-state-wrap">
414
-														<strong class="order-data-address-line"><?php echo _x( 'State / Province:', 'State / province of address', 'give' ); ?></strong><br/>
414
+														<strong class="order-data-address-line"><?php echo _x('State / Province:', 'State / province of address', 'give'); ?></strong><br/>
415 415
 														<?php
416
-														$states = give_get_states( $address['country'] );
417
-														if ( ! empty( $states ) ) {
418
-															echo Give()->html->select( array(
416
+														$states = give_get_states($address['country']);
417
+														if ( ! empty($states)) {
418
+															echo Give()->html->select(array(
419 419
 																'options'          => $states,
420 420
 																'name'             => 'give-payment-address[0][state]',
421 421
 																'selected'         => $address['state'],
422 422
 																'show_option_all'  => false,
423 423
 																'show_option_none' => false,
424 424
 																'chosen'           => true,
425
-																'placeholder'      => __( 'Select a state', 'give' )
426
-															) );
425
+																'placeholder'      => __('Select a state', 'give')
426
+															));
427 427
 														} else {
428 428
 															?>
429
-															<input type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr( $address['state'] ); ?>" class="medium-text"/>
429
+															<input type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr($address['state']); ?>" class="medium-text"/>
430 430
 															<?php
431 431
 														} ?>
432 432
 													</p>
@@ -436,39 +436,39 @@  discard block
 block discarded – undo
436 436
 									</div>
437 437
 									<!-- /#give-order-address -->
438 438
 
439
-									<?php do_action( 'give_payment_billing_details', $payment_id ); ?>
439
+									<?php do_action('give_payment_billing_details', $payment_id); ?>
440 440
 
441 441
 								</div>
442 442
 								<!-- /.inside -->
443 443
 							</div>
444 444
 							<!-- /#give-billing-details -->
445 445
 
446
-							<?php do_action( 'give_view_order_details_billing_after', $payment_id ); ?>
446
+							<?php do_action('give_view_order_details_billing_after', $payment_id); ?>
447 447
 
448 448
 							<div id="give-payment-notes" class="postbox">
449
-								<h3 class="hndle"><span><?php _e( 'Payment Notes', 'give' ); ?></span></h3>
449
+								<h3 class="hndle"><span><?php _e('Payment Notes', 'give'); ?></span></h3>
450 450
 
451 451
 								<div class="inside">
452 452
 									<div id="give-payment-notes-inner">
453 453
 										<?php
454
-										$notes = give_get_payment_notes( $payment_id );
455
-										if ( ! empty( $notes ) ) :
454
+										$notes = give_get_payment_notes($payment_id);
455
+										if ( ! empty($notes)) :
456 456
 											$no_notes_display = ' style="display:none;"';
457
-											foreach ( $notes as $note ) :
457
+											foreach ($notes as $note) :
458 458
 
459
-												echo give_get_payment_note_html( $note, $payment_id );
459
+												echo give_get_payment_note_html($note, $payment_id);
460 460
 
461 461
 											endforeach;
462 462
 										else :
463 463
 											$no_notes_display = '';
464 464
 										endif;
465
-										echo '<p class="give-no-payment-notes"' . $no_notes_display . '>' . __( 'No payment notes', 'give' ) . '</p>';
465
+										echo '<p class="give-no-payment-notes"'.$no_notes_display.'>'.__('No payment notes', 'give').'</p>';
466 466
 										?>
467 467
 									</div>
468 468
 									<textarea name="give-payment-note" id="give-payment-note" class="large-text"></textarea>
469 469
 
470 470
 									<p class="give-clearfix">
471
-										<button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint( $payment_id ); ?>"><?php _e( 'Add Note', 'give' ); ?></button>
471
+										<button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint($payment_id); ?>"><?php _e('Add Note', 'give'); ?></button>
472 472
 									</p>
473 473
 
474 474
 									<div class="clear"></div>
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
 							</div>
478 478
 							<!-- /#give-payment-notes -->
479 479
 
480
-							<?php do_action( 'give_view_order_details_main_after', $payment_id ); ?>
480
+							<?php do_action('give_view_order_details_main_after', $payment_id); ?>
481 481
 						</div>
482 482
 						<!-- /#normal-sortables -->
483 483
 					</div>
@@ -488,10 +488,10 @@  discard block
 block discarded – undo
488 488
 			<!-- #give-dashboard-widgets-wrap -->
489 489
 		</div>
490 490
 		<!-- /#post-stuff -->
491
-		<?php do_action( 'give_view_order_details_form_bottom', $payment_id ); ?>
492
-		<?php wp_nonce_field( 'give_update_payment_details_nonce' ); ?>
493
-		<input type="hidden" name="give_payment_id" value="<?php echo esc_attr( $payment_id ); ?>"/>
491
+		<?php do_action('give_view_order_details_form_bottom', $payment_id); ?>
492
+		<?php wp_nonce_field('give_update_payment_details_nonce'); ?>
493
+		<input type="hidden" name="give_payment_id" value="<?php echo esc_attr($payment_id); ?>"/>
494 494
 		<input type="hidden" name="give_action" value="update_payment_details"/>
495 495
 	</form>
496
-	<?php do_action( 'give_view_order_details_after', $payment_id ); ?>
496
+	<?php do_action('give_view_order_details_after', $payment_id); ?>
497 497
 </div><!-- /.wrap -->
Please login to merge, or discard this patch.
includes/admin/forms/metabox.php 1 patch
Spacing   +182 added lines, -182 removed lines patch added patch discarded remove patch
@@ -10,11 +10,11 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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');
Please login to merge, or discard this patch.
includes/admin/reporting/export/class-batch-export-forms.php 1 patch
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
includes/admin/reporting/export/class-batch-export-payments.php 1 patch
Spacing   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
includes/admin/reporting/export/class-batch-export.php 2 patches
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,9 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
includes/admin/reporting/export/export-functions.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -11,12 +11,12 @@  discard block
 block discarded – undo
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
 block discarded – undo
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');
Please login to merge, or discard this patch.
includes/admin/reporting/tools.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -22,68 +22,68 @@  discard block
 block discarded – undo
22 22
  */
23 23
 function give_tools_recount_stats_display() {
24 24
 
25
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
25
+	if ( ! current_user_can('manage_give_settings')) {
26 26
 		return;
27 27
 	}
28 28
 
29
-	do_action( 'give_tools_recount_stats_before' );
29
+	do_action('give_tools_recount_stats_before');
30 30
 	?>
31 31
 	<div id="poststuff">
32 32
 		<div class="postbox">
33 33
 
34
-			<h2 class="hndle ui-sortable-handle"><span><?php _e( 'Recount Stats', 'give' ); ?></span></h2>
34
+			<h2 class="hndle ui-sortable-handle"><span><?php _e('Recount Stats', 'give'); ?></span></h2>
35 35
 
36 36
 			<div class="inside recount-stats-controls">
37
-				<p><?php _e( 'Use these tools to recount stats, delete test transactions, or reset stats.', 'give' ); ?></p>
37
+				<p><?php _e('Use these tools to recount stats, delete test transactions, or reset stats.', 'give'); ?></p>
38 38
 				<form method="post" id="give-tools-recount-form" class="give-export-form">
39 39
 
40
-					<?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?>
40
+					<?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?>
41 41
 
42 42
 					<select name="give-export-class" id="recount-stats-type">
43
-						<option value="0" selected="selected" disabled="disabled"><?php _e( 'Please select an option', 'give' ); ?></option>
44
-						<option data-type="recount-stats" value="Give_Tools_Recount_Income"><?php _e( 'Recalculate Total Donation Income Amount', 'give' ); ?></option>
45
-						<option data-type="recount-form" value="Give_Tools_Recount_Form_Stats"><?php _e( 'Recalculate Income Amount and Donation Counts for a Form', 'give' ); ?></option>
46
-						<option data-type="recount-all" value="Give_Tools_Recount_All_Stats"><?php _e( 'Recalculate Income Amount and Donation Counts for All Forms', 'give' ); ?></option>
47
-						<option data-type="recount-customer-stats" value="Give_Tools_Recount_Customer_Stats"><?php _e( 'Recalculate Donor Statistics', 'give' ); ?></option>
48
-						<option data-type="delete-test-transactions" value="Give_Tools_Delete_Test_Transactions"><?php _e( 'Delete Test Transactions', 'give' ); ?></option>
49
-						<option data-type="reset-stats" value="Give_Tools_Reset_Stats"><?php _e( 'Delete All Data', 'give' ); ?></option>
50
-						<?php do_action( 'give_recount_tool_options' ); ?>
43
+						<option value="0" selected="selected" disabled="disabled"><?php _e('Please select an option', 'give'); ?></option>
44
+						<option data-type="recount-stats" value="Give_Tools_Recount_Income"><?php _e('Recalculate Total Donation Income Amount', 'give'); ?></option>
45
+						<option data-type="recount-form" value="Give_Tools_Recount_Form_Stats"><?php _e('Recalculate Income Amount and Donation Counts for a Form', 'give'); ?></option>
46
+						<option data-type="recount-all" value="Give_Tools_Recount_All_Stats"><?php _e('Recalculate Income Amount and Donation Counts for All Forms', 'give'); ?></option>
47
+						<option data-type="recount-customer-stats" value="Give_Tools_Recount_Customer_Stats"><?php _e('Recalculate Donor Statistics', 'give'); ?></option>
48
+						<option data-type="delete-test-transactions" value="Give_Tools_Delete_Test_Transactions"><?php _e('Delete Test Transactions', 'give'); ?></option>
49
+						<option data-type="reset-stats" value="Give_Tools_Reset_Stats"><?php _e('Delete All Data', 'give'); ?></option>
50
+						<?php do_action('give_recount_tool_options'); ?>
51 51
 					</select>
52 52
 
53 53
 					<span id="tools-form-dropdown" style="display: none">
54 54
 						<?php
55 55
 						$args = array(
56 56
 							'name'   => 'form_id',
57
-							'number' => - 1,
57
+							'number' => -1,
58 58
 							'chosen' => true,
59 59
 						);
60
-						echo Give()->html->forms_dropdown( $args );
60
+						echo Give()->html->forms_dropdown($args);
61 61
 						?>
62 62
 					</span>
63 63
 
64
-					<input type="submit" id="recount-stats-submit" value="<?php _e( 'Submit', 'give' ); ?>" class="button-secondary"/>
64
+					<input type="submit" id="recount-stats-submit" value="<?php _e('Submit', 'give'); ?>" class="button-secondary"/>
65 65
 
66 66
 					<br/>
67 67
 
68 68
 					<span class="give-recount-stats-descriptions">
69
-						<span id="recount-stats"><?php _e( 'Recalculates the overall donation income amount.', 'give' ); ?></span>
70
-						<span id="recount-form"><?php printf( __( 'Recalculates the donation and income stats for a specific %s.', 'give' ), give_get_forms_label_singular( true ) ); ?></span>
71
-						<span id="recount-all"><?php printf( __( 'Recalculates the earnings and sales stats for all %s.', 'give' ), give_get_forms_label_plural( true ) ); ?></span>
72
-						<span id="recount-customer-stats"><?php _e( 'Recalculates the lifetime value and donation counts for all donors.', 'give' ); ?></span>
73
-						<?php do_action( 'give_recount_tool_descriptions' ); ?>
74
-						<span id="delete-test-transactions"><?php _e( '<strong>Deletes</strong> all TEST payment records, donors, and related log entries.', 'give' ); ?></span>
75
-						<span id="reset-stats"><?php _e( '<strong>Deletes</strong> ALL transaction records, donors, and related log entries regardless of test or live mode.', 'give' ); ?></span>
69
+						<span id="recount-stats"><?php _e('Recalculates the overall donation income amount.', 'give'); ?></span>
70
+						<span id="recount-form"><?php printf(__('Recalculates the donation and income stats for a specific %s.', 'give'), give_get_forms_label_singular(true)); ?></span>
71
+						<span id="recount-all"><?php printf(__('Recalculates the earnings and sales stats for all %s.', 'give'), give_get_forms_label_plural(true)); ?></span>
72
+						<span id="recount-customer-stats"><?php _e('Recalculates the lifetime value and donation counts for all donors.', 'give'); ?></span>
73
+						<?php do_action('give_recount_tool_descriptions'); ?>
74
+						<span id="delete-test-transactions"><?php _e('<strong>Deletes</strong> all TEST payment records, donors, and related log entries.', 'give'); ?></span>
75
+						<span id="reset-stats"><?php _e('<strong>Deletes</strong> ALL transaction records, donors, and related log entries regardless of test or live mode.', 'give'); ?></span>
76 76
 					</span>
77 77
 
78 78
 					<span class="spinner"></span>
79 79
 
80 80
 				</form>
81
-				<?php do_action( 'give_tools_recount_forms' ); ?>
81
+				<?php do_action('give_tools_recount_forms'); ?>
82 82
 			</div><!-- .inside -->
83 83
 		</div><!-- .postbox -->
84 84
 	</div><!-- #poststuff -->
85 85
 	<?php
86
-	do_action( 'give_tools_recount_stats_after' );
86
+	do_action('give_tools_recount_stats_after');
87 87
 }
88 88
 
89
-add_action( 'give_reports_tab_tools', 'give_tools_recount_stats_display' );
89
+add_action('give_reports_tab_tools', 'give_tools_recount_stats_display');
Please login to merge, or discard this patch.
admin/reporting/tools/class-give-tools-recount-single-customer-stats.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -188,8 +188,8 @@
 block discarded – undo
188 188
 
189 189
 			$payment_ids = implode( ',', $payment_ids );
190 190
 			$customer->update( array( 'payment_ids'    => $payment_ids,
191
-			                          'purchase_count' => $purchase_count,
192
-			                          'purchase_value' => $pending_total
191
+									  'purchase_count' => $purchase_count,
192
+									  'purchase_value' => $pending_total
193 193
 			) );
194 194
 
195 195
 			$this->done    = true;
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
 	 * @since 1.5
51 51
 	 * @global object $wpdb Used to query the database using the WordPress
52 52
 	 *   Database API
53
-	 * @return array $data The data for the CSV file
53
+	 * @return boolean $data The data for the CSV file
54 54
 	 */
55 55
 	public function get_data() {
56 56
 		global $wpdb;
Please login to merge, or discard this patch.
Spacing   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
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
 
@@ -54,39 +54,39 @@  discard block
 block discarded – undo
54 54
 	 */
55 55
 	public function get_data() {
56 56
 
57
-		$customer = new Give_Customer( $this->customer_id );
58
-		$payments = $this->get_stored_data( 'give_recount_customer_payments_' . $customer->id, array() );
57
+		$customer = new Give_Customer($this->customer_id);
58
+		$payments = $this->get_stored_data('give_recount_customer_payments_'.$customer->id, array());
59 59
 
60
-		$offset     = ( $this->step - 1 ) * $this->per_step;
61
-		$step_items = array_slice( $payments, $offset, $this->per_step );
60
+		$offset     = ($this->step - 1) * $this->per_step;
61
+		$step_items = array_slice($payments, $offset, $this->per_step);
62 62
 
63
-		if ( count( $step_items ) > 0 ) {
64
-			$pending_total = (float) $this->get_stored_data( 'give_stats_customer_pending_total' . $customer->id, 0 );
63
+		if (count($step_items) > 0) {
64
+			$pending_total = (float) $this->get_stored_data('give_stats_customer_pending_total'.$customer->id, 0);
65 65
 			$step_total    = 0;
66 66
 
67
-			$found_payment_ids = $this->get_stored_data( 'give_stats_found_payments_' . $customer->id, array() );
67
+			$found_payment_ids = $this->get_stored_data('give_stats_found_payments_'.$customer->id, array());
68 68
 
69
-			foreach ( $step_items as $payment ) {
70
-				$payment = get_post( $payment->ID );
69
+			foreach ($step_items as $payment) {
70
+				$payment = get_post($payment->ID);
71 71
 
72
-				if ( is_null( $payment ) || is_wp_error( $payment ) || 'give_payment' !== $payment->post_type ) {
72
+				if (is_null($payment) || is_wp_error($payment) || 'give_payment' !== $payment->post_type) {
73 73
 
74
-					$missing_payments   = $this->get_stored_data( 'give_stats_missing_payments' . $customer->id, array() );
74
+					$missing_payments   = $this->get_stored_data('give_stats_missing_payments'.$customer->id, array());
75 75
 					$missing_payments[] = $payment->ID;
76
-					$this->store_data( 'give_stats_missing_payments' . $customer->id, $missing_payments );
76
+					$this->store_data('give_stats_missing_payments'.$customer->id, $missing_payments);
77 77
 
78 78
 					continue;
79 79
 				}
80 80
 
81 81
 				$should_process_payment = 'publish' == $payment->post_status || 'revoked' == $payment->post_status ? true : false;
82
-				$should_process_payment = apply_filters( 'give_customer_recount_should_process_payment', $should_process_payment, $payment );
82
+				$should_process_payment = apply_filters('give_customer_recount_should_process_payment', $should_process_payment, $payment);
83 83
 
84
-				if ( true === $should_process_payment ) {
84
+				if (true === $should_process_payment) {
85 85
 
86 86
 					$found_payment_ids[] = $payment->ID;
87 87
 
88
-					if ( apply_filters( 'give_customer_recount_sholud_increase_value', true, $payment ) ) {
89
-						$payment_amount = give_get_payment_amount( $payment->ID );
88
+					if (apply_filters('give_customer_recount_sholud_increase_value', true, $payment)) {
89
+						$payment_amount = give_get_payment_amount($payment->ID);
90 90
 						$step_total += $payment_amount;
91 91
 					}
92 92
 
@@ -95,8 +95,8 @@  discard block
 block discarded – undo
95 95
 			}
96 96
 
97 97
 			$updated_total = $pending_total + $step_total;
98
-			$this->store_data( 'give_stats_customer_pending_total' . $customer->id, $updated_total );
99
-			$this->store_data( 'give_stats_found_payments_' . $customer->id, $found_payment_ids );
98
+			$this->store_data('give_stats_customer_pending_total'.$customer->id, $updated_total);
99
+			$this->store_data('give_stats_found_payments_'.$customer->id, $found_payment_ids);
100 100
 
101 101
 			return true;
102 102
 		}
@@ -113,16 +113,16 @@  discard block
 block discarded – undo
113 113
 	 */
114 114
 	public function get_percentage_complete() {
115 115
 
116
-		$payments = $this->get_stored_data( 'give_recount_customer_payments_' . $this->customer_id );
117
-		$total    = count( $payments );
116
+		$payments = $this->get_stored_data('give_recount_customer_payments_'.$this->customer_id);
117
+		$total    = count($payments);
118 118
 
119 119
 		$percentage = 100;
120 120
 
121
-		if ( $total > 0 ) {
122
-			$percentage = ( ( $this->per_step * $this->step ) / $total ) * 100;
121
+		if ($total > 0) {
122
+			$percentage = (($this->per_step * $this->step) / $total) * 100;
123 123
 		}
124 124
 
125
-		if ( $percentage > 100 ) {
125
+		if ($percentage > 100) {
126 126
 			$percentage = 100;
127 127
 		}
128 128
 
@@ -136,8 +136,8 @@  discard block
 block discarded – undo
136 136
 	 *
137 137
 	 * @param array $request The Form Data passed into the batch processing
138 138
 	 */
139
-	public function set_properties( $request ) {
140
-		$this->customer_id = isset( $request['customer_id'] ) ? sanitize_text_field( $request['customer_id'] ) : false;
139
+	public function set_properties($request) {
140
+		$this->customer_id = isset($request['customer_id']) ? sanitize_text_field($request['customer_id']) : false;
141 141
 	}
142 142
 
143 143
 	/**
@@ -148,62 +148,62 @@  discard block
 block discarded – undo
148 148
 	 */
149 149
 	public function process_step() {
150 150
 
151
-		if ( ! $this->can_export() ) {
152
-			wp_die( __( 'You do not have permission to recount stats.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
151
+		if ( ! $this->can_export()) {
152
+			wp_die(__('You do not have permission to recount stats.', 'give'), __('Error', 'give'), array('response' => 403));
153 153
 		}
154 154
 
155 155
 		$had_data = $this->get_data();
156 156
 
157
-		if ( $had_data ) {
157
+		if ($had_data) {
158 158
 			$this->done = false;
159 159
 
160 160
 			return true;
161 161
 		} else {
162
-			$customer    = new Give_Customer( $this->customer_id );
163
-			$payment_ids = get_option( 'give_stats_found_payments_' . $customer->id, array() );
164
-			$this->delete_data( 'give_stats_found_payments_' . $customer->id );
162
+			$customer    = new Give_Customer($this->customer_id);
163
+			$payment_ids = get_option('give_stats_found_payments_'.$customer->id, array());
164
+			$this->delete_data('give_stats_found_payments_'.$customer->id);
165 165
 
166
-			$removed_payments = array_unique( get_option( 'give_stats_missing_payments' . $customer->id, array() ) );
166
+			$removed_payments = array_unique(get_option('give_stats_missing_payments'.$customer->id, array()));
167 167
 
168 168
 			// Find non-existing payments (deleted) and total up the purchase count
169 169
 			$purchase_count = 0;
170
-			foreach ( $payment_ids as $key => $payment_id ) {
171
-				if ( in_array( $payment_id, $removed_payments ) ) {
172
-					unset( $payment_ids[ $key ] );
170
+			foreach ($payment_ids as $key => $payment_id) {
171
+				if (in_array($payment_id, $removed_payments)) {
172
+					unset($payment_ids[$key]);
173 173
 					continue;
174 174
 				}
175 175
 
176
-				$payment = get_post( $payment_id );
177
-				if ( apply_filters( 'give_customer_recount_should_increase_count', true, $payment ) ) {
178
-					$purchase_count ++;
176
+				$payment = get_post($payment_id);
177
+				if (apply_filters('give_customer_recount_should_increase_count', true, $payment)) {
178
+					$purchase_count++;
179 179
 				}
180 180
 			}
181 181
 
182
-			$this->delete_data( 'give_stats_missing_payments' . $customer->id );
182
+			$this->delete_data('give_stats_missing_payments'.$customer->id);
183 183
 
184
-			$pending_total = $this->get_stored_data( 'give_stats_customer_pending_total' . $customer->id, 0 );
185
-			$this->delete_data( 'give_stats_customer_pending_total' . $customer->id );
186
-			$this->delete_data( 'give_recount_customer_stats_' . $customer->id );
187
-			$this->delete_data( 'give_recount_customer_payments_' . $this->customer_id );
184
+			$pending_total = $this->get_stored_data('give_stats_customer_pending_total'.$customer->id, 0);
185
+			$this->delete_data('give_stats_customer_pending_total'.$customer->id);
186
+			$this->delete_data('give_recount_customer_stats_'.$customer->id);
187
+			$this->delete_data('give_recount_customer_payments_'.$this->customer_id);
188 188
 
189
-			$payment_ids = implode( ',', $payment_ids );
190
-			$customer->update( array( 'payment_ids'    => $payment_ids,
189
+			$payment_ids = implode(',', $payment_ids);
190
+			$customer->update(array('payment_ids'    => $payment_ids,
191 191
 			                          'purchase_count' => $purchase_count,
192 192
 			                          'purchase_value' => $pending_total
193
-			) );
193
+			));
194 194
 
195 195
 			$this->done    = true;
196
-			$this->message = __( 'Donor stats successfully recounted.', 'give' );
196
+			$this->message = __('Donor stats successfully recounted.', 'give');
197 197
 
198 198
 			return false;
199 199
 		}
200 200
 	}
201 201
 
202 202
 	public function headers() {
203
-		ignore_user_abort( true );
203
+		ignore_user_abort(true);
204 204
 
205
-		if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
206
-			set_time_limit( 0 );
205
+		if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
206
+			set_time_limit(0);
207 207
 		}
208 208
 	}
209 209
 
@@ -230,26 +230,26 @@  discard block
 block discarded – undo
230 230
 	 * @return void
231 231
 	 */
232 232
 	public function pre_fetch() {
233
-		if ( $this->step === 1 ) {
234
-			$allowed_payment_status = apply_filters( 'give_recount_customer_payment_statuses', give_get_payment_status_keys() );
233
+		if ($this->step === 1) {
234
+			$allowed_payment_status = apply_filters('give_recount_customer_payment_statuses', give_get_payment_status_keys());
235 235
 
236 236
 			// Before we start, let's zero out the customer's data
237
-			$customer = new Give_Customer( $this->customer_id );
238
-			$customer->update( array( 'purchase_value' => give_format_amount( 0 ), 'purchase_count' => 0 ) );
237
+			$customer = new Give_Customer($this->customer_id);
238
+			$customer->update(array('purchase_value' => give_format_amount(0), 'purchase_count' => 0));
239 239
 
240
-			$attached_payment_ids = explode( ',', $customer->payment_ids );
240
+			$attached_payment_ids = explode(',', $customer->payment_ids);
241 241
 
242 242
 			$attached_args = array(
243 243
 				'post__in' => $attached_payment_ids,
244
-				'number'   => - 1,
244
+				'number'   => -1,
245 245
 				'status'   => $allowed_post_status,
246 246
 			);
247 247
 
248
-			$attached_payments = give_get_payments( $attached_args );
248
+			$attached_payments = give_get_payments($attached_args);
249 249
 
250 250
 			$unattached_args = array(
251 251
 				'post__not_in' => $attached_payment_ids,
252
-				'number'       => - 1,
252
+				'number'       => -1,
253 253
 				'status'       => $allowed_post_status,
254 254
 				'meta_query'   => array(
255 255
 					array(
@@ -259,11 +259,11 @@  discard block
 block discarded – undo
259 259
 				),
260 260
 			);
261 261
 
262
-			$unattached_payments = give_get_payments( $unattached_args );
262
+			$unattached_payments = give_get_payments($unattached_args);
263 263
 
264
-			$payments = array_merge( $attached_payments, $unattached_payments );
264
+			$payments = array_merge($attached_payments, $unattached_payments);
265 265
 
266
-			$this->store_data( 'give_recount_customer_payments_' . $customer->id, $payments );
266
+			$this->store_data('give_recount_customer_payments_'.$customer->id, $payments);
267 267
 		}
268 268
 	}
269 269
 
@@ -276,11 +276,11 @@  discard block
 block discarded – undo
276 276
 	 *
277 277
 	 * @return mixed       Returns the data from the database
278 278
 	 */
279
-	private function get_stored_data( $key ) {
279
+	private function get_stored_data($key) {
280 280
 		global $wpdb;
281
-		$value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) );
281
+		$value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key));
282 282
 
283
-		return empty( $value ) ? false : maybe_unserialize( $value );
283
+		return empty($value) ? false : maybe_unserialize($value);
284 284
 	}
285 285
 
286 286
 	/**
@@ -293,10 +293,10 @@  discard block
 block discarded – undo
293 293
 	 *
294 294
 	 * @return void
295 295
 	 */
296
-	private function store_data( $key, $value ) {
296
+	private function store_data($key, $value) {
297 297
 		global $wpdb;
298 298
 
299
-		$value = maybe_serialize( $value );
299
+		$value = maybe_serialize($value);
300 300
 
301 301
 		$data = array(
302 302
 			'option_name'  => $key,
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 			'%s',
311 311
 		);
312 312
 
313
-		$wpdb->replace( $wpdb->options, $data, $formats );
313
+		$wpdb->replace($wpdb->options, $data, $formats);
314 314
 	}
315 315
 
316 316
 	/**
@@ -322,9 +322,9 @@  discard block
 block discarded – undo
322 322
 	 *
323 323
 	 * @return void
324 324
 	 */
325
-	private function delete_data( $key ) {
325
+	private function delete_data($key) {
326 326
 		global $wpdb;
327
-		$wpdb->delete( $wpdb->options, array( 'option_name' => $key ) );
327
+		$wpdb->delete($wpdb->options, array('option_name' => $key));
328 328
 	}
329 329
 
330 330
 }
Please login to merge, or discard this patch.