Test Failed
Pull Request — master (#3324)
by Devin
07:59
created
includes/emails/template.php 1 patch
Spacing   +55 added lines, -55 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
 
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
  *
43 43
  * @return string $message Fully formatted message
44 44
  */
45
-function give_email_template_tags( $message, $payment_data, $payment_id, $admin_notice = false ) {
46
-	return give_do_email_tags( $message, $payment_id );
45
+function give_email_template_tags($message, $payment_data, $payment_id, $admin_notice = false) {
46
+	return give_do_email_tags($message, $payment_id);
47 47
 }
48 48
 
49 49
 /**
@@ -57,45 +57,45 @@  discard block
 block discarded – undo
57 57
  *
58 58
  * @return string $message Fully formatted message
59 59
  */
60
-function give_email_preview_template_tags( $message ) {
60
+function give_email_preview_template_tags($message) {
61 61
 
62
-	$price = give_currency_filter( give_format_amount( 10.50, array( 'sanitize' => false ) ) );
62
+	$price = give_currency_filter(give_format_amount(10.50, array('sanitize' => false)));
63 63
 
64 64
 	$gateway = 'PayPal';
65 65
 
66
-	$receipt_id = strtolower( md5( uniqid() ) );
66
+	$receipt_id = strtolower(md5(uniqid()));
67 67
 
68
-	$payment_id = rand( 1, 100 );
69
-	$receipt_link_url = esc_url( add_query_arg( array( 'payment_key' => $receipt_id ), give_get_history_page_uri() ) );
68
+	$payment_id = rand(1, 100);
69
+	$receipt_link_url = esc_url(add_query_arg(array('payment_key' => $receipt_id), give_get_history_page_uri()));
70 70
 
71 71
 	$receipt_link     = sprintf(
72 72
 		'<a href="%1$s">%2$s</a>',
73 73
 		$receipt_link_url,
74
-		esc_html__( 'View the receipt in your browser &raquo;', 'give' )
74
+		esc_html__('View the receipt in your browser &raquo;', 'give')
75 75
 	);
76 76
 
77 77
 	// Set user.
78 78
 	$user = wp_get_current_user();
79 79
 
80
-	$message = str_replace( '{name}', $user->display_name, $message );
81
-	$message = str_replace( '{fullname}', $user->display_name, $message );
82
-	$message = str_replace( '{username}', $user->user_login, $message );
83
-	$message = str_replace( '{user_email}', $user->user_email, $message );
84
-	$message = str_replace( '{billing_address}', "123 Test Street, Unit 222\nSomewhere Town, CA, 92101", $message );
85
-	$message = str_replace( '{date}', date( give_date_format(), current_time( 'timestamp' ) ), $message );
86
-	$message = str_replace( '{amount}', $price, $message );
87
-	$message = str_replace( '{price}', $price, $message );
88
-	$message = str_replace( '{donation}', esc_html__( 'Sample Donation Form Title', 'give' ), $message );
89
-	$message = str_replace( '{form_title}', esc_html__( 'Sample Donation Form Title - Sample Donation Level', 'give' ), $message );
90
-	$message = str_replace( '{receipt_id}', $receipt_id, $message );
91
-	$message = str_replace( '{payment_method}', $gateway, $message );
92
-	$message = str_replace( '{sitename}', get_bloginfo( 'name' ), $message );
93
-	$message = str_replace( '{payment_id}', $payment_id, $message );
94
-	$message = str_replace( '{receipt_link}', $receipt_link, $message );
95
-	$message = str_replace( '{receipt_link_url}', $receipt_link_url, $message );
96
-	$message = str_replace( '{pdf_receipt}', '<a href="#">Download Receipt</a>', $message );
97
-
98
-	return wpautop( apply_filters( 'give_email_preview_template_tags', $message ) );
80
+	$message = str_replace('{name}', $user->display_name, $message);
81
+	$message = str_replace('{fullname}', $user->display_name, $message);
82
+	$message = str_replace('{username}', $user->user_login, $message);
83
+	$message = str_replace('{user_email}', $user->user_email, $message);
84
+	$message = str_replace('{billing_address}', "123 Test Street, Unit 222\nSomewhere Town, CA, 92101", $message);
85
+	$message = str_replace('{date}', date(give_date_format(), current_time('timestamp')), $message);
86
+	$message = str_replace('{amount}', $price, $message);
87
+	$message = str_replace('{price}', $price, $message);
88
+	$message = str_replace('{donation}', esc_html__('Sample Donation Form Title', 'give'), $message);
89
+	$message = str_replace('{form_title}', esc_html__('Sample Donation Form Title - Sample Donation Level', 'give'), $message);
90
+	$message = str_replace('{receipt_id}', $receipt_id, $message);
91
+	$message = str_replace('{payment_method}', $gateway, $message);
92
+	$message = str_replace('{sitename}', get_bloginfo('name'), $message);
93
+	$message = str_replace('{payment_id}', $payment_id, $message);
94
+	$message = str_replace('{receipt_link}', $receipt_link, $message);
95
+	$message = str_replace('{receipt_link_url}', $receipt_link_url, $message);
96
+	$message = str_replace('{pdf_receipt}', '<a href="#">Download Receipt</a>', $message);
97
+
98
+	return wpautop(apply_filters('give_email_preview_template_tags', $message));
99 99
 }
100 100
 
101 101
 
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
  *
112 112
  * @return array
113 113
  */
114
-function give_email_preview_buttons_callback( $field ) {
115
-	$field_id = str_replace( '_preview_buttons', '', $field['id'] );
114
+function give_email_preview_buttons_callback($field) {
115
+	$field_id = str_replace('_preview_buttons', '', $field['id']);
116 116
 
117 117
 	ob_start();
118 118
 
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 		'<a href="%1$s" class="button-secondary" target="_blank">%2$s</a>',
121 121
 		wp_nonce_url(
122 122
 			add_query_arg(
123
-				array( 'give_action' => 'preview_email', 'email_type' => $field_id ),
123
+				array('give_action' => 'preview_email', 'email_type' => $field_id),
124 124
 				home_url()
125 125
 			), 'give-preview-email'
126 126
 		),
@@ -130,13 +130,13 @@  discard block
 block discarded – undo
130 130
 	echo sprintf(
131 131
 		' <a href="%1$s" aria-label="%2$s" class="button-secondary">%3$s</a>',
132 132
 		wp_nonce_url(
133
-				add_query_arg( array(
133
+				add_query_arg(array(
134 134
 			'give_action'  => 'send_preview_email',
135 135
 			'email_type' => $field_id,
136 136
 			'give-messages[]' => 'sent-test-email',
137
-		) ), 'give-send-preview-email' ),
138
-		esc_attr__( 'Send Test Email.', 'give' ),
139
-		esc_html__( 'Send Test Email', 'give' )
137
+		)), 'give-send-preview-email' ),
138
+		esc_attr__('Send Test Email.', 'give'),
139
+		esc_html__('Send Test Email', 'give')
140 140
 	);
141 141
 
142 142
 	echo ob_get_clean();
@@ -155,34 +155,34 @@  discard block
 block discarded – undo
155 155
 
156 156
 	//Payment receipt switcher
157 157
 	$payment_count = give_count_payments()->publish;
158
-	$payment_id    = give_check_variable( give_clean( $_GET ), 'isset', 0, 'preview_id' );
158
+	$payment_id    = give_check_variable(give_clean($_GET), 'isset', 0, 'preview_id');
159 159
 
160
-	if ( $payment_count <= 0 ) {
160
+	if ($payment_count <= 0) {
161 161
 		return false;
162 162
 	}
163 163
 
164 164
 	//Get payments.
165
-	$donations = new Give_Payments_Query( array(
165
+	$donations = new Give_Payments_Query(array(
166 166
 		'number' => 100,
167 167
 		'output' => '',
168 168
 		'fields' => 'ids'
169
-	) );
169
+	));
170 170
 	$donations = $donations->get_payments();
171
-	$options  = array();
171
+	$options = array();
172 172
 
173 173
 	// Default option.
174
-	$options[0] = esc_html__( 'No donations found.', 'give' );
174
+	$options[0] = esc_html__('No donations found.', 'give');
175 175
 
176 176
 	//Provide nice human readable options.
177
-	if ( $donations ) {
178
-		$options[0] = esc_html__( '- Select a donation -', 'give' );
179
-		foreach ( $donations as $donation_id ) {
177
+	if ($donations) {
178
+		$options[0] = esc_html__('- Select a donation -', 'give');
179
+		foreach ($donations as $donation_id) {
180 180
 
181
-			$options[ $donation_id ] = sprintf(
181
+			$options[$donation_id] = sprintf(
182 182
 				'#%1$s - %2$s - %3$s',
183 183
 				$donation_id,
184
-				give_get_donation_donor_email( $donation_id ),
185
-				get_the_title( $donation_id )
184
+				give_get_donation_donor_email($donation_id),
185
+				get_the_title($donation_id)
186 186
 			);
187 187
 		}
188 188
 	}
@@ -191,27 +191,27 @@  discard block
 block discarded – undo
191 191
 	$transaction_header = '<div style="margin:0;padding:10px 0;width:100%;background-color:#FFF;border-bottom:1px solid #eee; text-align:center;">';
192 192
 
193 193
 	// Remove payment id query param if set from request url.
194
-	$request_url_data = wp_parse_url( $_SERVER['REQUEST_URI'] );
194
+	$request_url_data = wp_parse_url($_SERVER['REQUEST_URI']);
195 195
 	$query            = $request_url_data['query'];
196
-	$query            = remove_query_arg( array( 'preview_id' ), $query );
196
+	$query            = remove_query_arg(array('preview_id'), $query);
197 197
 
198
-	$request_url = home_url( '/?' . str_replace( '', '', $query ) );
198
+	$request_url = home_url('/?'.str_replace('', '', $query));
199 199
 
200 200
 	$transaction_header .= '<script>
201 201
 				 function change_preview(){
202 202
 				  var transactions = document.getElementById("give_preview_email_payment_id");
203 203
 			        var selected_trans = transactions.options[transactions.selectedIndex];
204 204
 				        if (selected_trans){
205
-				            var url_string = "' . $request_url . '&preview_id=" + selected_trans.value;
205
+				            var url_string = "' . $request_url.'&preview_id=" + selected_trans.value;
206 206
 				                window.location = url_string;
207 207
 				        }
208 208
 				    }
209 209
 			    </script>';
210 210
 
211
-	$transaction_header .= '<label for="give_preview_email_payment_id" style="font-size:12px;color:#333;margin:0 4px 0 0;">' . esc_html__( 'Preview email with a donation:', 'give' ) . '</label>';
211
+	$transaction_header .= '<label for="give_preview_email_payment_id" style="font-size:12px;color:#333;margin:0 4px 0 0;">'.esc_html__('Preview email with a donation:', 'give').'</label>';
212 212
 
213 213
 	//The select field with 100 latest transactions
214
-	$transaction_header .= Give()->html->select( array(
214
+	$transaction_header .= Give()->html->select(array(
215 215
 		'name'             => 'preview_email_payment_id',
216 216
 		'selected'         => $payment_id,
217 217
 		'id'               => 'give_preview_email_payment_id',
@@ -221,11 +221,11 @@  discard block
 block discarded – undo
221 221
 		'select_atts'      => 'onchange="change_preview()"',
222 222
 		'show_option_all'  => false,
223 223
 		'show_option_none' => false,
224
-	) );
224
+	));
225 225
 
226 226
 	//Closing tag
227 227
 	$transaction_header .= '</div>';
228 228
 
229
-	return apply_filters( 'give_preview_email_receipt_header', $transaction_header );
229
+	return apply_filters('give_preview_email_receipt_header', $transaction_header);
230 230
 
231 231
 }
Please login to merge, or discard this patch.
includes/emails/functions.php 1 patch
Spacing   +70 added lines, -70 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,14 +26,14 @@  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 31
 	 * Fire the action
32 32
 	 */
33
-	do_action( 'give_donation-receipt_email_notification', $payment_id );
33
+	do_action('give_donation-receipt_email_notification', $payment_id);
34 34
 
35 35
 	// If admin notifications are on, send the admin notice.
36
-	if ( $admin_notice && give_is_setting_enabled( Give_Email_Notification::get_instance('new-donation' )->get_notification_status() ) ) {
36
+	if ($admin_notice && give_is_setting_enabled(Give_Email_Notification::get_instance('new-donation')->get_notification_status())) {
37 37
 		/**
38 38
 		 * Fires in the donation email receipt.
39 39
 		 *
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 		 * @param int   $payment_id   Payment id.
45 45
 		 * @param mixed $payment_data Payment meta data.
46 46
 		 */
47
-		do_action( 'give_new-donation_email_notification', $payment_id, give_get_payment_meta( $payment_id ) );
47
+		do_action('give_new-donation_email_notification', $payment_id, give_get_payment_meta($payment_id));
48 48
 	}
49 49
 }
50 50
 
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
  *
58 58
  * @return void
59 59
  */
60
-function give_admin_email_notice( $payment_id ) {
60
+function give_admin_email_notice($payment_id) {
61 61
 	/**
62 62
 	 * Fires in the donation email receipt.
63 63
 	 *
@@ -68,10 +68,10 @@  discard block
 block discarded – undo
68 68
 	 * @param int   $payment_id   Payment id.
69 69
 	 * @param mixed $payment_data Payment meta data.
70 70
 	 */
71
-	do_action( 'give_new-donation_email_notification', $payment_id );
71
+	do_action('give_new-donation_email_notification', $payment_id);
72 72
 }
73 73
 
74
-add_action( 'give_admin_donation_email', 'give_admin_email_notice' );
74
+add_action('give_admin_donation_email', 'give_admin_email_notice');
75 75
 
76 76
 
77 77
 /**
@@ -84,16 +84,16 @@  discard block
 block discarded – undo
84 84
  */
85 85
 function give_get_default_donation_notification_email() {
86 86
 
87
-	$default_email_body = __( 'Hi there,', 'give' ) . "\n\n";
88
-	$default_email_body .= __( '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";
89
-	$default_email_body .= '<strong>' . __( 'Donor:', 'give' ) . '</strong> {name}' . "\n";
90
-	$default_email_body .= '<strong>' . __( 'Donation:', 'give' ) . '</strong> {donation}' . "\n";
91
-	$default_email_body .= '<strong>' . __( 'Amount:', 'give' ) . '</strong> {amount}' . "\n";
92
-	$default_email_body .= '<strong>' . __( 'Payment Method:', 'give' ) . '</strong> {payment_method}' . "\n\n";
93
-	$default_email_body .= __( 'Thank you,', 'give' ) . "\n\n";
94
-	$default_email_body .= '{sitename}' . "\n";
87
+	$default_email_body = __('Hi there,', 'give')."\n\n";
88
+	$default_email_body .= __('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";
89
+	$default_email_body .= '<strong>'.__('Donor:', 'give').'</strong> {name}'."\n";
90
+	$default_email_body .= '<strong>'.__('Donation:', 'give').'</strong> {donation}'."\n";
91
+	$default_email_body .= '<strong>'.__('Amount:', 'give').'</strong> {amount}'."\n";
92
+	$default_email_body .= '<strong>'.__('Payment Method:', 'give').'</strong> {payment_method}'."\n\n";
93
+	$default_email_body .= __('Thank you,', 'give')."\n\n";
94
+	$default_email_body .= '{sitename}'."\n";
95 95
 
96
-	return apply_filters( 'give_default_donation_notification_email', $default_email_body );
96
+	return apply_filters('give_default_donation_notification_email', $default_email_body);
97 97
 }
98 98
 
99 99
 
@@ -107,21 +107,21 @@  discard block
 block discarded – undo
107 107
  */
108 108
 function give_get_default_donation_receipt_email() {
109 109
 
110
-	$default_email_body = __( 'Dear', 'give' ) . " {name},\n\n";
111
-	$default_email_body .= __( 'Thank you for your donation. Your generosity is appreciated! Here are the details of your donation:', 'give' ) . "\n\n";
112
-	$default_email_body .= '<strong>' . __( 'Donor:', 'give' ) . '</strong> {fullname}' . "\n";
113
-	$default_email_body .= '<strong>' . __( 'Donation:', 'give' ) . '</strong> {donation}' . "\n";
114
-	$default_email_body .= '<strong>' . __( 'Donation Date:', 'give' ) . '</strong> {date}' . "\n";
115
-	$default_email_body .= '<strong>' . __( 'Amount:', 'give' ) . '</strong> {amount}' . "\n";
116
-	$default_email_body .= '<strong>' . __( 'Payment Method:', 'give' ) . '</strong> {payment_method}' . "\n";
117
-	$default_email_body .= '<strong>' . __( 'Payment ID:', 'give' ) . '</strong> {payment_id}' . "\n";
118
-	$default_email_body .= '<strong>' . __( 'Receipt ID:', 'give' ) . '</strong> {receipt_id}' . "\n\n";
119
-	$default_email_body .= '{receipt_link}' . "\n\n";
110
+	$default_email_body = __('Dear', 'give')." {name},\n\n";
111
+	$default_email_body .= __('Thank you for your donation. Your generosity is appreciated! Here are the details of your donation:', 'give')."\n\n";
112
+	$default_email_body .= '<strong>'.__('Donor:', 'give').'</strong> {fullname}'."\n";
113
+	$default_email_body .= '<strong>'.__('Donation:', 'give').'</strong> {donation}'."\n";
114
+	$default_email_body .= '<strong>'.__('Donation Date:', 'give').'</strong> {date}'."\n";
115
+	$default_email_body .= '<strong>'.__('Amount:', 'give').'</strong> {amount}'."\n";
116
+	$default_email_body .= '<strong>'.__('Payment Method:', 'give').'</strong> {payment_method}'."\n";
117
+	$default_email_body .= '<strong>'.__('Payment ID:', 'give').'</strong> {payment_id}'."\n";
118
+	$default_email_body .= '<strong>'.__('Receipt ID:', 'give').'</strong> {receipt_id}'."\n\n";
119
+	$default_email_body .= '{receipt_link}'."\n\n";
120 120
 	$default_email_body .= "\n\n";
121
-	$default_email_body .= __( 'Sincerely,', 'give' ) . "\n";
122
-	$default_email_body .= '{sitename}' . "\n";
121
+	$default_email_body .= __('Sincerely,', 'give')."\n";
122
+	$default_email_body .= '{sitename}'."\n";
123 123
 
124
-	return apply_filters( 'give_default_donation_receipt_email', $default_email_body );
124
+	return apply_filters('give_default_donation_receipt_email', $default_email_body);
125 125
 }
126 126
 
127 127
 /**
@@ -134,22 +134,22 @@  discard block
 block discarded – undo
134 134
  *
135 135
  * @return array $email_names
136 136
  */
137
-function give_get_email_names( $user_info, $payment = false ) {
137
+function give_get_email_names($user_info, $payment = false) {
138 138
 	$email_names = array();
139 139
 
140
-	if ( is_a( $payment, 'Give_Payment' ) ) {
140
+	if (is_a($payment, 'Give_Payment')) {
141 141
 
142
-		if ( $payment->user_id > 0 ) {
142
+		if ($payment->user_id > 0) {
143 143
 
144
-			$user_data               = get_userdata( $payment->user_id );
144
+			$user_data               = get_userdata($payment->user_id);
145 145
 			$email_names['name']     = $payment->first_name;
146
-			$email_names['fullname'] = trim( $payment->first_name . ' ' . $payment->last_name );
146
+			$email_names['fullname'] = trim($payment->first_name.' '.$payment->last_name);
147 147
 			$email_names['username'] = $user_data->user_login;
148 148
 
149
-		} elseif ( ! empty( $payment->first_name ) ) {
149
+		} elseif ( ! empty($payment->first_name)) {
150 150
 
151 151
 			$email_names['name']     = $payment->first_name;
152
-			$email_names['fullname'] = trim( $payment->first_name . ' ' . $payment->last_name );
152
+			$email_names['fullname'] = trim($payment->first_name.' '.$payment->last_name);
153 153
 			$email_names['username'] = $payment->first_name;
154 154
 
155 155
 		} else {
@@ -162,30 +162,30 @@  discard block
 block discarded – undo
162 162
 	} else {
163 163
 
164 164
 		// Support for old serialized data.
165
-		if ( is_serialized( $user_info ) ) {
165
+		if (is_serialized($user_info)) {
166 166
 
167 167
 			// Security check.
168
-			preg_match( '/[oO]\s*:\s*\d+\s*:\s*"\s*(?!(?i)(stdClass))/', $user_info, $matches );
169
-			if ( ! empty( $matches ) ) {
168
+			preg_match('/[oO]\s*:\s*\d+\s*:\s*"\s*(?!(?i)(stdClass))/', $user_info, $matches);
169
+			if ( ! empty($matches)) {
170 170
 				return array(
171 171
 					'name'     => '',
172 172
 					'fullname' => '',
173 173
 					'username' => '',
174 174
 				);
175 175
 			} else {
176
-				$user_info = maybe_unserialize( $user_info );
176
+				$user_info = maybe_unserialize($user_info);
177 177
 			}
178 178
 
179 179
 		}
180 180
 
181
-		if ( isset( $user_info['id'] ) && $user_info['id'] > 0 && isset( $user_info['first_name'] ) ) {
182
-			$user_data               = get_userdata( $user_info['id'] );
181
+		if (isset($user_info['id']) && $user_info['id'] > 0 && isset($user_info['first_name'])) {
182
+			$user_data               = get_userdata($user_info['id']);
183 183
 			$email_names['name']     = $user_info['first_name'];
184
-			$email_names['fullname'] = $user_info['first_name'] . ' ' . $user_info['last_name'];
184
+			$email_names['fullname'] = $user_info['first_name'].' '.$user_info['last_name'];
185 185
 			$email_names['username'] = $user_data->user_login;
186
-		} elseif ( isset( $user_info['first_name'] ) ) {
186
+		} elseif (isset($user_info['first_name'])) {
187 187
 			$email_names['name']     = $user_info['first_name'];
188
-			$email_names['fullname'] = $user_info['first_name'] . ' ' . $user_info['last_name'];
188
+			$email_names['fullname'] = $user_info['first_name'].' '.$user_info['last_name'];
189 189
 			$email_names['username'] = $user_info['first_name'];
190 190
 		} else {
191 191
 			$email_names['name']     = $user_info['email'];
@@ -205,37 +205,37 @@  discard block
 block discarded – undo
205 205
  *
206 206
  * @since 1.8.14
207 207
  */
208
-function give_admin_email_user_donor_disconnection( $user_id, $donor_id ) {
208
+function give_admin_email_user_donor_disconnection($user_id, $donor_id) {
209 209
 
210
-	$user_id  = absint( $user_id );
211
-	$donor_id = absint( $donor_id );
210
+	$user_id  = absint($user_id);
211
+	$donor_id = absint($donor_id);
212 212
 
213 213
 	// Bail Out, if user id doesn't exists.
214
-	if ( empty( $user_id ) ) {
214
+	if (empty($user_id)) {
215 215
 		return;
216 216
 	}
217 217
 
218 218
 	// Bail Out, if donor id doesn't exists.
219
-	if ( empty( $donor_id ) ) {
219
+	if (empty($donor_id)) {
220 220
 		return;
221 221
 	}
222 222
 
223
-	$from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) );
223
+	$from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES));
224 224
 
225
-	$from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) );
225
+	$from_email = give_get_option('from_email', get_bloginfo('admin_email'));
226 226
 
227 227
 	/* translators: %s: payment id */
228
-	$subject = __( 'Attention: User tries to login whose Donor profile is disconnected!', 'give' );
228
+	$subject = __('Attention: User tries to login whose Donor profile is disconnected!', 'give');
229 229
 
230 230
 	/**
231 231
 	 * Filters the Donor-User Disconnection notification subject.
232 232
 	 *
233 233
 	 * @since 1.8.14
234 234
 	 */
235
-	$subject = apply_filters( 'give_admin_donor_user_disconnection_notification_subject', wp_strip_all_tags( $subject ) );
235
+	$subject = apply_filters('give_admin_donor_user_disconnection_notification_subject', wp_strip_all_tags($subject));
236 236
 
237
-	$headers = "From: " . stripslashes_deep( html_entity_decode( $from_name, ENT_COMPAT, 'UTF-8' ) ) . " <$from_email>\r\n";
238
-	$headers .= "Reply-To: " . $from_email . "\r\n";
237
+	$headers = "From: ".stripslashes_deep(html_entity_decode($from_name, ENT_COMPAT, 'UTF-8'))." <$from_email>\r\n";
238
+	$headers .= "Reply-To: ".$from_email."\r\n";
239 239
 	$headers .= "Content-Type: text/html; charset=utf-8\r\n";
240 240
 
241 241
 	/**
@@ -243,25 +243,25 @@  discard block
 block discarded – undo
243 243
 	 *
244 244
 	 * @since 1.8.14
245 245
 	 */
246
-	$headers = apply_filters( 'give_admin_donor_user_disconnection_notification_headers', $headers );
246
+	$headers = apply_filters('give_admin_donor_user_disconnection_notification_headers', $headers);
247 247
 
248
-	$message = __( 'Hi Admin,', 'give' ) . "\n\n";
249
-	$message .= __( 'This email is to inform you that a user has tried logging in. But, User was unable to login due to User-Donor profile disconnection.', 'give' ) . "\n\n";
250
-	$message .= __( 'Do you want to reconnect User and Donor profile again?', 'give' ) . "\n\n";
248
+	$message = __('Hi Admin,', 'give')."\n\n";
249
+	$message .= __('This email is to inform you that a user has tried logging in. But, User was unable to login due to User-Donor profile disconnection.', 'give')."\n\n";
250
+	$message .= __('Do you want to reconnect User and Donor profile again?', 'give')."\n\n";
251 251
 	$message .= sprintf(
252 252
 		'<a href="%1$s">%2$s</a>',
253
-		esc_url( admin_url() . 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor_id . '&user_id=' . $user_id . '&give-messages[]=reconnect-user' ),
254
-		__( 'Reconnect User', 'give' ) . "\n\n"
253
+		esc_url(admin_url().'edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor_id.'&user_id='.$user_id.'&give-messages[]=reconnect-user'),
254
+		__('Reconnect User', 'give')."\n\n"
255 255
 	);
256
-	$message .= __( 'Thank you,', 'give' ) . "\n\n";
257
-	$message .= '{sitename}' . "\n";
256
+	$message .= __('Thank you,', 'give')."\n\n";
257
+	$message .= '{sitename}'."\n";
258 258
 
259 259
 	$emails = Give()->emails;
260
-	$emails->__set( 'from_name', $from_name );
261
-	$emails->__set( 'from_email', $from_email );
262
-	$emails->__set( 'headers', $headers );
263
-	$emails->__set( 'heading', __( 'User - Donor Profile Disconnection', 'give' ) );
260
+	$emails->__set('from_name', $from_name);
261
+	$emails->__set('from_email', $from_email);
262
+	$emails->__set('headers', $headers);
263
+	$emails->__set('heading', __('User - Donor Profile Disconnection', 'give'));
264 264
 
265
-	$emails->send( give_get_admin_notice_emails(), $subject, give_do_email_tags( $message ) );
265
+	$emails->send(give_get_admin_notice_emails(), $subject, give_do_email_tags($message));
266 266
 
267 267
 }
Please login to merge, or discard this patch.
includes/shortcodes.php 1 patch
Spacing   +206 added lines, -206 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,42 +26,42 @@  discard block
 block discarded – undo
26 26
  *
27 27
  * @return string|bool
28 28
  */
29
-function give_donation_history( $atts, $content = false ) {
29
+function give_donation_history($atts, $content = false) {
30 30
 
31
-	$donation_history_args = shortcode_atts( array(
31
+	$donation_history_args = shortcode_atts(array(
32 32
 		'id'             => true,
33 33
 		'date'           => true,
34 34
 		'donor'          => false,
35 35
 		'amount'         => true,
36 36
 		'status'         => false,
37 37
 		'payment_method' => false,
38
-	), $atts, 'donation_history' );
38
+	), $atts, 'donation_history');
39 39
 
40 40
 	// Always show receipt link.
41 41
 	$donation_history_args['details'] = true;
42 42
 
43 43
 	// Set Donation History Shortcode Arguments in session variable.
44
-	Give()->session->set( 'give_donation_history_args', $donation_history_args );
44
+	Give()->session->set('give_donation_history_args', $donation_history_args);
45 45
 
46 46
 	// If payment_key query arg exists, return receipt instead of donation history.
47
-	if ( isset( $_GET['payment_key'] ) ) {
47
+	if (isset($_GET['payment_key'])) {
48 48
 		ob_start();
49 49
 
50
-		echo give_receipt_shortcode( array() );
50
+		echo give_receipt_shortcode(array());
51 51
 
52 52
 		// Display donation history link only if Receipt Access Session is available.
53
-		if ( give_get_receipt_session() ) {
53
+		if (give_get_receipt_session()) {
54 54
 			echo sprintf(
55 55
 				'<a href="%s">%s</a>',
56
-				esc_url( give_get_history_page_uri() ),
57
-				__( '&laquo; Return to All Donations', 'give' )
56
+				esc_url(give_get_history_page_uri()),
57
+				__('&laquo; Return to All Donations', 'give')
58 58
 			);
59 59
 		}
60 60
 
61 61
 		return ob_get_clean();
62 62
 	}
63 63
 
64
-	$email_access = give_get_option( 'email_access' );
64
+	$email_access = give_get_option('email_access');
65 65
 
66 66
 	ob_start();
67 67
 
@@ -74,23 +74,23 @@  discard block
 block discarded – undo
74 74
 	if (
75 75
 		is_user_logged_in() ||
76 76
 		false !== Give()->session->get_session_expiration() ||
77
-		( give_is_setting_enabled( $email_access ) && Give()->email_access->token_exists ) ||
77
+		(give_is_setting_enabled($email_access) && Give()->email_access->token_exists) ||
78 78
 		true === give_get_history_session()
79 79
 	) {
80
-		give_get_template_part( 'history', 'donations' );
80
+		give_get_template_part('history', 'donations');
81 81
 
82
-		if ( ! empty( $content ) ) {
83
-			echo do_shortcode( $content );
82
+		if ( ! empty($content)) {
83
+			echo do_shortcode($content);
84 84
 		}
85 85
 
86
-	} elseif ( give_is_setting_enabled( $email_access ) ) {
86
+	} elseif (give_is_setting_enabled($email_access)) {
87 87
 		// Is Email-based access enabled?
88
-		give_get_template_part( 'email', 'login-form' );
88
+		give_get_template_part('email', 'login-form');
89 89
 
90 90
 	} else {
91 91
 
92
-		echo apply_filters( 'give_donation_history_nonuser_message', Give()->notices->print_frontend_notice( __( 'You must be logged in to view your donation history. Please login using your account or create an account using the same email you used to donate with.', 'give' ), false ) );
93
-		echo do_shortcode( '[give_login]' );
92
+		echo apply_filters('give_donation_history_nonuser_message', Give()->notices->print_frontend_notice(__('You must be logged in to view your donation history. Please login using your account or create an account using the same email you used to donate with.', 'give'), false));
93
+		echo do_shortcode('[give_login]');
94 94
 	}
95 95
 
96 96
 	/**
@@ -104,10 +104,10 @@  discard block
 block discarded – undo
104 104
 	 *
105 105
 	 * @return string HTML content
106 106
 	 */
107
-	return apply_filters( 'give_donation_history_shortcode_html', ob_get_clean(), $atts, $content );
107
+	return apply_filters('give_donation_history_shortcode_html', ob_get_clean(), $atts, $content);
108 108
 }
109 109
 
110
-add_shortcode( 'donation_history', 'give_donation_history' );
110
+add_shortcode('donation_history', 'give_donation_history');
111 111
 
112 112
 /**
113 113
  * Donation Form Shortcode
@@ -120,8 +120,8 @@  discard block
 block discarded – undo
120 120
  *
121 121
  * @return string
122 122
  */
123
-function give_form_shortcode( $atts ) {
124
-	$atts = shortcode_atts( array(
123
+function give_form_shortcode($atts) {
124
+	$atts = shortcode_atts(array(
125 125
 		'id'                    => '',
126 126
 		'show_title'            => true,
127 127
 		'show_goal'             => true,
@@ -129,21 +129,21 @@  discard block
 block discarded – undo
129 129
 		'float_labels'          => '',
130 130
 		'display_style'         => '',
131 131
 		'continue_button_title' => '',
132
-	), $atts, 'give_form' );
132
+	), $atts, 'give_form');
133 133
 
134 134
 	// Convert string to bool.
135
-	$atts['show_title'] = filter_var( $atts['show_title'], FILTER_VALIDATE_BOOLEAN );
136
-	$atts['show_goal']  = filter_var( $atts['show_goal'], FILTER_VALIDATE_BOOLEAN );
135
+	$atts['show_title'] = filter_var($atts['show_title'], FILTER_VALIDATE_BOOLEAN);
136
+	$atts['show_goal']  = filter_var($atts['show_goal'], FILTER_VALIDATE_BOOLEAN);
137 137
 
138 138
 	// get the Give Form
139 139
 	ob_start();
140
-	give_get_donation_form( $atts );
140
+	give_get_donation_form($atts);
141 141
 	$final_output = ob_get_clean();
142 142
 
143
-	return apply_filters( 'give_donate_form', $final_output, $atts );
143
+	return apply_filters('give_donate_form', $final_output, $atts);
144 144
 }
145 145
 
146
-add_shortcode( 'give_form', 'give_form_shortcode' );
146
+add_shortcode('give_form', 'give_form_shortcode');
147 147
 
148 148
 /**
149 149
  * Donation Form Goal Shortcode.
@@ -156,36 +156,36 @@  discard block
 block discarded – undo
156 156
  *
157 157
  * @return string
158 158
  */
159
-function give_goal_shortcode( $atts ) {
160
-	$atts = shortcode_atts( array(
159
+function give_goal_shortcode($atts) {
160
+	$atts = shortcode_atts(array(
161 161
 		'id'        => '',
162 162
 		'show_text' => true,
163 163
 		'show_bar'  => true,
164
-	), $atts, 'give_goal' );
164
+	), $atts, 'give_goal');
165 165
 
166 166
 	// get the Give Form.
167 167
 	ob_start();
168 168
 
169 169
 	// Sanity check 1: ensure there is an ID Provided.
170
-	if ( empty( $atts['id'] ) ) {
171
-		Give()->notices->print_frontend_notice( __( 'The shortcode is missing Donation Form ID attribute.', 'give' ), true );
170
+	if (empty($atts['id'])) {
171
+		Give()->notices->print_frontend_notice(__('The shortcode is missing Donation Form ID attribute.', 'give'), true);
172 172
 	}
173 173
 
174 174
 	// Sanity check 2: Check the form even has Goals enabled.
175
-	if ( ! give_is_setting_enabled( give_get_meta( $atts['id'], '_give_goal_option', true ) ) ) {
175
+	if ( ! give_is_setting_enabled(give_get_meta($atts['id'], '_give_goal_option', true))) {
176 176
 
177
-		Give()->notices->print_frontend_notice( __( 'The form does not have Goals enabled.', 'give' ), true );
177
+		Give()->notices->print_frontend_notice(__('The form does not have Goals enabled.', 'give'), true);
178 178
 	} else {
179 179
 		// Passed all sanity checks: output Goal.
180
-		give_show_goal_progress( $atts['id'], $atts );
180
+		give_show_goal_progress($atts['id'], $atts);
181 181
 	}
182 182
 
183 183
 	$final_output = ob_get_clean();
184 184
 
185
-	return apply_filters( 'give_goal_shortcode_output', $final_output, $atts );
185
+	return apply_filters('give_goal_shortcode_output', $final_output, $atts);
186 186
 }
187 187
 
188
-add_shortcode( 'give_goal', 'give_goal_shortcode' );
188
+add_shortcode('give_goal', 'give_goal_shortcode');
189 189
 
190 190
 
191 191
 /**
@@ -202,22 +202,22 @@  discard block
 block discarded – undo
202 202
  *
203 203
  * @return string
204 204
  */
205
-function give_login_form_shortcode( $atts ) {
205
+function give_login_form_shortcode($atts) {
206 206
 
207
-	$atts = shortcode_atts( array(
207
+	$atts = shortcode_atts(array(
208 208
 		// Add backward compatibility for redirect attribute.
209 209
 		'redirect' => '',
210 210
 		'login-redirect'  => '',
211 211
 		'logout-redirect' => '',
212
-	), $atts, 'give_login' );
212
+	), $atts, 'give_login');
213 213
 
214 214
 	// Check login-redirect attribute first, if it empty or not found then check for redirect attribute and add value of this to login-redirect attribute.
215
-	$atts['login-redirect'] = ! empty( $atts['login-redirect'] ) ? $atts['login-redirect'] : ( ! empty( $atts['redirect'] ) ? $atts['redirect'] : '' );
215
+	$atts['login-redirect'] = ! empty($atts['login-redirect']) ? $atts['login-redirect'] : ( ! empty($atts['redirect']) ? $atts['redirect'] : '');
216 216
 
217
-	return give_login_form( $atts['login-redirect'], $atts['logout-redirect'] );
217
+	return give_login_form($atts['login-redirect'], $atts['logout-redirect']);
218 218
 }
219 219
 
220
-add_shortcode( 'give_login', 'give_login_form_shortcode' );
220
+add_shortcode('give_login', 'give_login_form_shortcode');
221 221
 
222 222
 /**
223 223
  * Register Shortcode.
@@ -232,15 +232,15 @@  discard block
 block discarded – undo
232 232
  *
233 233
  * @return string
234 234
  */
235
-function give_register_form_shortcode( $atts ) {
236
-	$atts = shortcode_atts( array(
235
+function give_register_form_shortcode($atts) {
236
+	$atts = shortcode_atts(array(
237 237
 		'redirect' => '',
238
-	), $atts, 'give_register' );
238
+	), $atts, 'give_register');
239 239
 
240
-	return give_register_form( $atts['redirect'] );
240
+	return give_register_form($atts['redirect']);
241 241
 }
242 242
 
243
-add_shortcode( 'give_register', 'give_register_form_shortcode' );
243
+add_shortcode('give_register', 'give_register_form_shortcode');
244 244
 
245 245
 /**
246 246
  * Receipt Shortcode.
@@ -253,12 +253,12 @@  discard block
 block discarded – undo
253 253
  *
254 254
  * @return string
255 255
  */
256
-function give_receipt_shortcode( $atts ) {
256
+function give_receipt_shortcode($atts) {
257 257
 
258 258
 	global $give_receipt_args;
259 259
 
260
-	$give_receipt_args = shortcode_atts( array(
261
-		'error'          => __( 'You are missing the payment key to view this donation receipt.', 'give' ),
260
+	$give_receipt_args = shortcode_atts(array(
261
+		'error'          => __('You are missing the payment key to view this donation receipt.', 'give'),
262 262
 		'price'          => true,
263 263
 		'donor'          => true,
264 264
 		'date'           => true,
@@ -268,49 +268,49 @@  discard block
 block discarded – undo
268 268
 		'payment_status' => false,
269 269
 		'company_name'   => false,
270 270
 		'status_notice'  => true,
271
-	), $atts, 'give_receipt' );
271
+	), $atts, 'give_receipt');
272 272
 
273 273
 	// set $session var
274 274
 	$session = give_get_purchase_session();
275 275
 
276 276
 	// set payment key var
277
-	if ( isset( $_GET['payment_key'] ) ) {
278
-		$payment_key = urldecode( $_GET['payment_key'] );
279
-	} elseif ( $session ) {
277
+	if (isset($_GET['payment_key'])) {
278
+		$payment_key = urldecode($_GET['payment_key']);
279
+	} elseif ($session) {
280 280
 		$payment_key = $session['purchase_key'];
281
-	} elseif ( $give_receipt_args['payment_key'] ) {
281
+	} elseif ($give_receipt_args['payment_key']) {
282 282
 		$payment_key = $give_receipt_args['payment_key'];
283 283
 	}
284 284
 
285
-	$email_access = give_get_option( 'email_access' );
285
+	$email_access = give_get_option('email_access');
286 286
 
287 287
 	// No payment_key found & Email Access is Turned on.
288
-	if ( ! isset( $payment_key ) && give_is_setting_enabled( $email_access ) && ! Give()->email_access->token_exists ) {
288
+	if ( ! isset($payment_key) && give_is_setting_enabled($email_access) && ! Give()->email_access->token_exists) {
289 289
 
290 290
 		ob_start();
291 291
 
292
-		give_get_template_part( 'email-login-form' );
292
+		give_get_template_part('email-login-form');
293 293
 
294 294
 		return ob_get_clean();
295 295
 
296
-	} elseif ( ! isset( $payment_key ) ) {
296
+	} elseif ( ! isset($payment_key)) {
297 297
 
298
-		return Give()->notices->print_frontend_notice( $give_receipt_args['error'], false, 'error' );
298
+		return Give()->notices->print_frontend_notice($give_receipt_args['error'], false, 'error');
299 299
 
300 300
 	}
301 301
 
302
-	$user_can_view = give_can_view_receipt( $payment_key );
302
+	$user_can_view = give_can_view_receipt($payment_key);
303 303
 
304 304
 	// Key was provided, but user is logged out. Offer them the ability to login and view the receipt.
305
-	if ( ! $user_can_view && give_is_setting_enabled( $email_access ) && ! Give()->email_access->token_exists ) {
305
+	if ( ! $user_can_view && give_is_setting_enabled($email_access) && ! Give()->email_access->token_exists) {
306 306
 
307 307
 		ob_start();
308 308
 
309
-		give_get_template_part( 'email-login-form' );
309
+		give_get_template_part('email-login-form');
310 310
 
311 311
 		return ob_get_clean();
312 312
 
313
-	} elseif ( ! $user_can_view ) {
313
+	} elseif ( ! $user_can_view) {
314 314
 
315 315
 		global $give_login_redirect;
316 316
 
@@ -318,9 +318,9 @@  discard block
 block discarded – undo
318 318
 
319 319
 		ob_start();
320 320
 
321
-		Give()->notices->print_frontend_notice( apply_filters( 'give_must_be_logged_in_error_message', __( 'You must be logged in to view this donation receipt.', 'give' ) ) );
321
+		Give()->notices->print_frontend_notice(apply_filters('give_must_be_logged_in_error_message', __('You must be logged in to view this donation receipt.', 'give')));
322 322
 
323
-		give_get_template_part( 'shortcode', 'login' );
323
+		give_get_template_part('shortcode', 'login');
324 324
 
325 325
 		$login_form = ob_get_clean();
326 326
 
@@ -334,20 +334,20 @@  discard block
 block discarded – undo
334 334
 	 * or if user is logged out and donation was made as a guest, the donation session is checked for
335 335
 	 * or if user is logged in and the user can view sensitive shop data.
336 336
 	 */
337
-	if ( ! apply_filters( 'give_user_can_view_receipt', $user_can_view, $give_receipt_args ) ) {
338
-		return Give()->notices->print_frontend_notice( $give_receipt_args['error'], false, 'error' );
337
+	if ( ! apply_filters('give_user_can_view_receipt', $user_can_view, $give_receipt_args)) {
338
+		return Give()->notices->print_frontend_notice($give_receipt_args['error'], false, 'error');
339 339
 	}
340 340
 
341 341
 	ob_start();
342 342
 
343
-	give_get_template_part( 'shortcode', 'receipt' );
343
+	give_get_template_part('shortcode', 'receipt');
344 344
 
345 345
 	$display = ob_get_clean();
346 346
 
347 347
 	return $display;
348 348
 }
349 349
 
350
-add_shortcode( 'give_receipt', 'give_receipt_shortcode' );
350
+add_shortcode('give_receipt', 'give_receipt_shortcode');
351 351
 
352 352
 /**
353 353
  * Profile Editor Shortcode.
@@ -366,25 +366,25 @@  discard block
 block discarded – undo
366 366
  *
367 367
  * @return string Output generated from the profile editor
368 368
  */
369
-function give_profile_editor_shortcode( $atts ) {
369
+function give_profile_editor_shortcode($atts) {
370 370
 
371 371
 	ob_start();
372 372
 
373 373
 	// Restrict access to donor profile, if donor and user are disconnected.
374
-	$is_donor_disconnected = get_user_meta( get_current_user_id(), '_give_is_donor_disconnected', true );
375
-	if ( is_user_logged_in() && $is_donor_disconnected ) {
376
-		Give()->notices->print_frontend_notice( __( 'Your Donor and User profile are no longer connected. Please contact the site administrator.', 'give' ), true, 'error' );
374
+	$is_donor_disconnected = get_user_meta(get_current_user_id(), '_give_is_donor_disconnected', true);
375
+	if (is_user_logged_in() && $is_donor_disconnected) {
376
+		Give()->notices->print_frontend_notice(__('Your Donor and User profile are no longer connected. Please contact the site administrator.', 'give'), true, 'error');
377 377
 		return false;
378 378
 	}
379 379
 
380
-	give_get_template_part( 'shortcode', 'profile-editor' );
380
+	give_get_template_part('shortcode', 'profile-editor');
381 381
 
382 382
 	$display = ob_get_clean();
383 383
 
384 384
 	return $display;
385 385
 }
386 386
 
387
-add_shortcode( 'give_profile_editor', 'give_profile_editor_shortcode' );
387
+add_shortcode('give_profile_editor', 'give_profile_editor_shortcode');
388 388
 
389 389
 /**
390 390
  * Process Profile Updater Form.
@@ -397,31 +397,31 @@  discard block
 block discarded – undo
397 397
  *
398 398
  * @return bool
399 399
  */
400
-function give_process_profile_editor_updates( $data ) {
400
+function give_process_profile_editor_updates($data) {
401 401
 	// Profile field change request.
402
-	if ( empty( $_POST['give_profile_editor_submit'] ) && ! is_user_logged_in() ) {
402
+	if (empty($_POST['give_profile_editor_submit']) && ! is_user_logged_in()) {
403 403
 		return false;
404 404
 	}
405 405
 
406 406
 	// Nonce security.
407
-	if ( ! wp_verify_nonce( $data['give_profile_editor_nonce'], 'give-profile-editor-nonce' ) ) {
407
+	if ( ! wp_verify_nonce($data['give_profile_editor_nonce'], 'give-profile-editor-nonce')) {
408 408
 		return false;
409 409
 	}
410 410
 
411 411
 	$user_id       = get_current_user_id();
412
-	$old_user_data = get_userdata( $user_id );
412
+	$old_user_data = get_userdata($user_id);
413 413
 
414 414
 	/* @var Give_Donor $donor */
415
-	$donor            = new Give_Donor( $user_id, true );
415
+	$donor            = new Give_Donor($user_id, true);
416 416
 	$old_company_name = $donor->get_company_name();
417 417
 
418
-	$display_name     = isset( $data['give_display_name'] ) ? sanitize_text_field( $data['give_display_name'] ) : $old_user_data->display_name;
419
-	$first_name       = isset( $data['give_first_name'] ) ? sanitize_text_field( $data['give_first_name'] ) : $old_user_data->first_name;
420
-	$last_name        = isset( $data['give_last_name'] ) ? sanitize_text_field( $data['give_last_name'] ) : $old_user_data->last_name;
421
-	$company_name     = ! empty( $data['give_company_name'] ) ? sanitize_text_field( $data['give_company_name'] ) : $old_company_name;
422
-	$email            = isset( $data['give_email'] ) ? sanitize_email( $data['give_email'] ) : $old_user_data->user_email;
423
-	$password         = ! empty( $data['give_new_user_pass1'] ) ? $data['give_new_user_pass1'] : '';
424
-	$confirm_password = ! empty( $data['give_new_user_pass2'] ) ? $data['give_new_user_pass2'] : '';
418
+	$display_name     = isset($data['give_display_name']) ? sanitize_text_field($data['give_display_name']) : $old_user_data->display_name;
419
+	$first_name       = isset($data['give_first_name']) ? sanitize_text_field($data['give_first_name']) : $old_user_data->first_name;
420
+	$last_name        = isset($data['give_last_name']) ? sanitize_text_field($data['give_last_name']) : $old_user_data->last_name;
421
+	$company_name     = ! empty($data['give_company_name']) ? sanitize_text_field($data['give_company_name']) : $old_company_name;
422
+	$email            = isset($data['give_email']) ? sanitize_email($data['give_email']) : $old_user_data->user_email;
423
+	$password         = ! empty($data['give_new_user_pass1']) ? $data['give_new_user_pass1'] : '';
424
+	$confirm_password = ! empty($data['give_new_user_pass2']) ? $data['give_new_user_pass2'] : '';
425 425
 
426 426
 	$userdata = array(
427 427
 		'ID'           => $user_id,
@@ -441,60 +441,60 @@  discard block
 block discarded – undo
441 441
 	 * @param int $user_id The ID of the user.
442 442
 	 * @param array $userdata User info, including ID, first name, last name, display name and email.
443 443
 	 */
444
-	do_action( 'give_pre_update_user_profile', $user_id, $userdata );
444
+	do_action('give_pre_update_user_profile', $user_id, $userdata);
445 445
 
446 446
 	// Make sure to validate first name of existing donors.
447
-	if ( empty( $first_name ) ) {
447
+	if (empty($first_name)) {
448 448
 		// Empty First Name.
449
-		give_set_error( 'empty_first_name', __( 'Please enter your first name.', 'give' ) );
449
+		give_set_error('empty_first_name', __('Please enter your first name.', 'give'));
450 450
 	}
451 451
 
452 452
 	// Make sure to validate passwords for existing Donors.
453
-	give_validate_user_password( $password, $confirm_password );
453
+	give_validate_user_password($password, $confirm_password);
454 454
 
455
-	if ( empty( $email ) ) {
455
+	if (empty($email)) {
456 456
 		// Make sure email should not be empty.
457
-		give_set_error( 'email_empty', __( 'The email you entered is empty.', 'give' ) );
457
+		give_set_error('email_empty', __('The email you entered is empty.', 'give'));
458 458
 
459
-	} elseif ( ! is_email( $email ) ) {
459
+	} elseif ( ! is_email($email)) {
460 460
 		// Make sure email should be valid.
461
-		give_set_error( 'email_not_valid', __( 'The email you entered is not valid. Please use another', 'give' ) );
461
+		give_set_error('email_not_valid', __('The email you entered is not valid. Please use another', 'give'));
462 462
 
463
-	} elseif ( $email != $old_user_data->user_email ) {
463
+	} elseif ($email != $old_user_data->user_email) {
464 464
 		// Make sure the new email doesn't belong to another user.
465
-		if ( email_exists( $email ) ) {
466
-			give_set_error( 'user_email_exists', __( 'The email you entered belongs to another user. Please use another.', 'give' ) );
467
-		} elseif ( Give()->donors->get_donor_by( 'email', $email ) ) {
465
+		if (email_exists($email)) {
466
+			give_set_error('user_email_exists', __('The email you entered belongs to another user. Please use another.', 'give'));
467
+		} elseif (Give()->donors->get_donor_by('email', $email)) {
468 468
 			// Make sure the new email doesn't belong to another user.
469
-			give_set_error( 'donor_email_exists', __( 'The email you entered belongs to another donor. Please use another.', 'give' ) );
469
+			give_set_error('donor_email_exists', __('The email you entered belongs to another donor. Please use another.', 'give'));
470 470
 		}
471 471
 	}
472 472
 
473 473
 	// Check for errors.
474 474
 	$errors = give_get_errors();
475 475
 
476
-	if ( $errors ) {
476
+	if ($errors) {
477 477
 		// Send back to the profile editor if there are errors.
478
-		wp_redirect( $data['give_redirect'] );
478
+		wp_redirect($data['give_redirect']);
479 479
 		give_die();
480 480
 	}
481 481
 
482 482
 	// Update Donor First Name and Last Name.
483
-	Give()->donors->update( $donor->id, array(
484
-		'name' => trim( "{$first_name} {$last_name}" ),
485
-	) );
486
-	Give()->donor_meta->update_meta( $donor->id, '_give_donor_first_name', $first_name );
487
-	Give()->donor_meta->update_meta( $donor->id, '_give_donor_last_name', $last_name );
488
-	Give()->donor_meta->update_meta( $donor->id, '_give_donor_company', $company_name );
483
+	Give()->donors->update($donor->id, array(
484
+		'name' => trim("{$first_name} {$last_name}"),
485
+	));
486
+	Give()->donor_meta->update_meta($donor->id, '_give_donor_first_name', $first_name);
487
+	Give()->donor_meta->update_meta($donor->id, '_give_donor_last_name', $last_name);
488
+	Give()->donor_meta->update_meta($donor->id, '_give_donor_company', $company_name);
489 489
 
490 490
 	$current_user = wp_get_current_user();
491 491
 
492 492
 	// Compares new values with old values to detect change in values.
493
-	$email_update        = ( $email !== $current_user->user_email ) ? true : false;
494
-	$display_name_update = ( $display_name !== $current_user->display_name ) ? true : false;
495
-	$first_name_update   = ( $first_name !== $current_user->first_name ) ? true : false;
496
-	$last_name_update    = ( $last_name !== $current_user->last_name ) ? true : false;
497
-	$company_name_update = ( $company_name !== $old_company_name ) ? true : false;
493
+	$email_update        = ($email !== $current_user->user_email) ? true : false;
494
+	$display_name_update = ($display_name !== $current_user->display_name) ? true : false;
495
+	$first_name_update   = ($first_name !== $current_user->first_name) ? true : false;
496
+	$last_name_update    = ($last_name !== $current_user->last_name) ? true : false;
497
+	$company_name_update = ($company_name !== $old_company_name) ? true : false;
498 498
 	$update_code         = 0;
499 499
 
500 500
 	/**
@@ -502,35 +502,35 @@  discard block
 block discarded – undo
502 502
 	 *
503 503
 	 * @var boolean
504 504
 	 */
505
-	$profile_update = ( $email_update || $display_name_update || $first_name_update || $last_name_update || $company_name_update );
505
+	$profile_update = ($email_update || $display_name_update || $first_name_update || $last_name_update || $company_name_update);
506 506
 
507 507
 	/**
508 508
 	 * True if password fields are filled.
509 509
 	 *
510 510
 	 * @var boolean
511 511
 	 */
512
-	$password_update = ( ! empty( $password ) && ! empty( $confirm_password ) );
512
+	$password_update = ( ! empty($password) && ! empty($confirm_password));
513 513
 
514
-	if ( $profile_update ) {
514
+	if ($profile_update) {
515 515
 
516 516
 		// If only profile fields are updated.
517 517
 		$update_code = '1';
518 518
 
519
-		if ( $password_update ) {
519
+		if ($password_update) {
520 520
 
521 521
 			// If profile fields AND password both are updated.
522 522
 			$update_code = '2';
523 523
 		}
524
-	} elseif ( $password_update ) {
524
+	} elseif ($password_update) {
525 525
 
526 526
 		// If only password is updated.
527 527
 		$update_code = '3';
528 528
 	}
529 529
 
530 530
 	// Update the user.
531
-	$updated = wp_update_user( $userdata );
531
+	$updated = wp_update_user($userdata);
532 532
 
533
-	if ( $updated ) {
533
+	if ($updated) {
534 534
 
535 535
 		/**
536 536
 		 * Fires after updating user profile.
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
 		 * @param int $user_id The ID of the user.
541 541
 		 * @param array $userdata User info, including ID, first name, last name, display name and email.
542 542
 		 */
543
-		do_action( 'give_user_profile_updated', $user_id, $userdata );
543
+		do_action('give_user_profile_updated', $user_id, $userdata);
544 544
 
545 545
 		$profile_edit_redirect_args = array(
546 546
 			'updated'     => 'true',
@@ -551,10 +551,10 @@  discard block
 block discarded – undo
551 551
 		 * Update codes '2' and '3' indicate a password change.
552 552
 		 * If the password is changed, then logout and redirect to the same page.
553 553
 		 */
554
-		if ( '2' === $update_code || '3' === $update_code ) {
555
-			wp_logout( wp_redirect( add_query_arg( $profile_edit_redirect_args, $data['give_redirect'] ) ) );
554
+		if ('2' === $update_code || '3' === $update_code) {
555
+			wp_logout(wp_redirect(add_query_arg($profile_edit_redirect_args, $data['give_redirect'])));
556 556
 		} else {
557
-			wp_redirect( add_query_arg( $profile_edit_redirect_args, $data['give_redirect'] ) );
557
+			wp_redirect(add_query_arg($profile_edit_redirect_args, $data['give_redirect']));
558 558
 		}
559 559
 
560 560
 		give_die();
@@ -563,7 +563,7 @@  discard block
 block discarded – undo
563 563
 	return false;
564 564
 }
565 565
 
566
-add_action( 'give_edit_user_profile', 'give_process_profile_editor_updates' );
566
+add_action('give_edit_user_profile', 'give_process_profile_editor_updates');
567 567
 
568 568
 /**
569 569
  * Give totals Shortcode.
@@ -576,24 +576,24 @@  discard block
 block discarded – undo
576 576
  *
577 577
  * @return string
578 578
  */
579
-function give_totals_shortcode( $atts ) {
580
-	$total = get_option( 'give_earnings_total', false );
579
+function give_totals_shortcode($atts) {
580
+	$total = get_option('give_earnings_total', false);
581 581
 
582
-	$message = apply_filters( 'give_totals_message', __( 'Hey! We\'ve raised {total} of the {total_goal} we are trying to raise for this campaign!', 'give' ) );
582
+	$message = apply_filters('give_totals_message', __('Hey! We\'ve raised {total} of the {total_goal} we are trying to raise for this campaign!', 'give'));
583 583
 
584
-	$atts = shortcode_atts( array(
584
+	$atts = shortcode_atts(array(
585 585
 		'total_goal'   => 0, // integer
586 586
 		'ids'          => 0, // integer|array
587 587
 		'cats'         => 0, // integer|array
588 588
 		'tags'         => 0, // integer|array
589 589
 		'message'      => $message,
590 590
 		'link'         => '', // URL
591
-		'link_text'    => __( 'Donate Now', 'give' ), // string,
591
+		'link_text'    => __('Donate Now', 'give'), // string,
592 592
 		'progress_bar' => true, // boolean
593
-	), $atts, 'give_totals' );
593
+	), $atts, 'give_totals');
594 594
 
595 595
 	// Total Goal.
596
-	$total_goal = give_maybe_sanitize_amount( $atts['total_goal'] );
596
+	$total_goal = give_maybe_sanitize_amount($atts['total_goal']);
597 597
 
598 598
 	/**
599 599
 	 * Give Action fire before the shortcode is rendering is started.
@@ -602,14 +602,14 @@  discard block
 block discarded – undo
602 602
 	 *
603 603
 	 * @param array $atts shortcode attribute.
604 604
 	 */
605
-	do_action( 'give_totals_goal_shortcode_before_render', $atts );
605
+	do_action('give_totals_goal_shortcode_before_render', $atts);
606 606
 
607 607
 	// Build query based on cat, tag and Form ids.
608
-	if ( ! empty( $atts['cats'] ) || ! empty( $atts['tags'] ) || ! empty( $atts['ids'] ) ) {
608
+	if ( ! empty($atts['cats']) || ! empty($atts['tags']) || ! empty($atts['ids'])) {
609 609
 
610 610
 		$form_ids = array();
611
-		if ( ! empty( $atts['ids'] ) ) {
612
-			$form_ids = array_filter( array_map( 'trim', explode( ',', $atts['ids'] ) ) );
611
+		if ( ! empty($atts['ids'])) {
612
+			$form_ids = array_filter(array_map('trim', explode(',', $atts['ids'])));
613 613
 		}
614 614
 
615 615
 		/**
@@ -623,23 +623,23 @@  discard block
 block discarded – undo
623 623
 			'post_type'        => 'give_forms',
624 624
 			'post_status'      => 'publish',
625 625
 			'post__in'         => $form_ids,
626
-			'posts_per_page'   => - 1,
626
+			'posts_per_page'   => -1,
627 627
 			'fields'           => 'ids',
628 628
 			'tax_query'        => array(
629 629
 				'relation' => 'AND',
630 630
 			),
631 631
 		);
632 632
 
633
-		if ( ! empty( $atts['cats'] ) ) {
634
-			$cats                     = array_filter( array_map( 'trim', explode( ',', $atts['cats'] ) ) );
633
+		if ( ! empty($atts['cats'])) {
634
+			$cats                     = array_filter(array_map('trim', explode(',', $atts['cats'])));
635 635
 			$form_args['tax_query'][] = array(
636 636
 				'taxonomy' => 'give_forms_category',
637 637
 				'terms'    => $cats,
638 638
 			);
639 639
 		}
640 640
 
641
-		if ( ! empty( $atts['tags'] ) ) {
642
-			$tags                     = array_filter( array_map( 'trim', explode( ',', $atts['tags'] ) ) );
641
+		if ( ! empty($atts['tags'])) {
642
+			$tags                     = array_filter(array_map('trim', explode(',', $atts['tags'])));
643 643
 			$form_args['tax_query'][] = array(
644 644
 				'taxonomy' => 'give_forms_tag',
645 645
 				'terms'    => $tags,
@@ -655,15 +655,15 @@  discard block
 block discarded – undo
655 655
 		 *
656 656
 		 * @return array $form_args WP query argument for Total Goal.
657 657
 		 */
658
-		$form_args = (array) apply_filters( 'give_totals_goal_shortcode_query_args', $form_args );
658
+		$form_args = (array) apply_filters('give_totals_goal_shortcode_query_args', $form_args);
659 659
 
660
-		$forms = new WP_Query( $form_args );
660
+		$forms = new WP_Query($form_args);
661 661
 
662
-		if ( isset( $forms->posts ) ) {
662
+		if (isset($forms->posts)) {
663 663
 			$total = 0;
664
-			foreach ( $forms->posts as $post ) {
665
-				$form_earning = give_get_meta( $post, '_give_form_earnings', true );
666
-				$form_earning = ! empty( $form_earning ) ? $form_earning : 0;
664
+			foreach ($forms->posts as $post) {
665
+				$form_earning = give_get_meta($post, '_give_form_earnings', true);
666
+				$form_earning = ! empty($form_earning) ? $form_earning : 0;
667 667
 
668 668
 				/**
669 669
 				 * Update Form earnings.
@@ -673,7 +673,7 @@  discard block
 block discarded – undo
673 673
 				 * @param int $post Form ID.
674 674
 				 * @param string $form_earning Total earning of Form.
675 675
 				 */
676
-				$total += apply_filters( 'give_totals_form_earning', $form_earning, $post );
676
+				$total += apply_filters('give_totals_form_earning', $form_earning, $post);
677 677
 			}
678 678
 		}
679 679
 
@@ -681,23 +681,23 @@  discard block
 block discarded – undo
681 681
 
682 682
 	// Append link with text.
683 683
 	$donate_link = '';
684
-	if ( ! empty( $atts['link'] ) ) {
685
-		$donate_link = sprintf( ' <a class="give-totals-text-link" href="%1$s">%2$s</a>', esc_url( $atts['link'] ), esc_html( $atts['link_text'] ) );
684
+	if ( ! empty($atts['link'])) {
685
+		$donate_link = sprintf(' <a class="give-totals-text-link" href="%1$s">%2$s</a>', esc_url($atts['link']), esc_html($atts['link_text']));
686 686
 	}
687 687
 
688 688
 	// Replace {total} in message.
689
-	$message = str_replace( '{total}', give_currency_filter(
690
-		give_format_amount( $total,
691
-			array( 'sanitize' => false )
689
+	$message = str_replace('{total}', give_currency_filter(
690
+		give_format_amount($total,
691
+			array('sanitize' => false)
692 692
 		)
693
-	), esc_html( $atts['message'] ) );
693
+	), esc_html($atts['message']));
694 694
 
695 695
 	// Replace {total_goal} in message.
696
-	$message = str_replace( '{total_goal}', give_currency_filter(
697
-		give_format_amount( $total_goal,
698
-			array( 'sanitize' => true )
696
+	$message = str_replace('{total_goal}', give_currency_filter(
697
+		give_format_amount($total_goal,
698
+			array('sanitize' => true)
699 699
 		)
700
-	), $message );
700
+	), $message);
701 701
 
702 702
 	/**
703 703
 	 * Update Give totals shortcode output.
@@ -707,19 +707,19 @@  discard block
 block discarded – undo
707 707
 	 * @param string $message Shortcode Message.
708 708
 	 * @param array $atts ShortCode attributes.
709 709
 	 */
710
-	$message = apply_filters( 'give_totals_shortcode_message', $message, $atts );
710
+	$message = apply_filters('give_totals_shortcode_message', $message, $atts);
711 711
 
712 712
 	ob_start();
713 713
 	?>
714 714
 	<div class="give-totals-shortcode-wrap">
715 715
 		<?php
716 716
 		// Show Progress Bar if progress_bar set true.
717
-		$show_progress_bar = isset( $atts['progress_bar'] ) ? filter_var( $atts['progress_bar'], FILTER_VALIDATE_BOOLEAN ) : true;
718
-		if ( $show_progress_bar ) {
719
-			give_show_goal_totals_progress( $total, $total_goal );
717
+		$show_progress_bar = isset($atts['progress_bar']) ? filter_var($atts['progress_bar'], FILTER_VALIDATE_BOOLEAN) : true;
718
+		if ($show_progress_bar) {
719
+			give_show_goal_totals_progress($total, $total_goal);
720 720
 		}
721 721
 
722
-		echo sprintf( $message ) . $donate_link;
722
+		echo sprintf($message).$donate_link;
723 723
 		?>
724 724
 	</div>
725 725
 	<?php
@@ -734,7 +734,7 @@  discard block
 block discarded – undo
734 734
 	 * @param array  $atts               shortcode attribute.
735 735
 	 * @param string $give_totals_output shortcode output.
736 736
 	 */
737
-	do_action( 'give_totals_goal_shortcode_after_render', $atts, $give_totals_output );
737
+	do_action('give_totals_goal_shortcode_after_render', $atts, $give_totals_output);
738 738
 
739 739
 	/**
740 740
 	 * Give Totals Shortcode output.
@@ -743,11 +743,11 @@  discard block
 block discarded – undo
743 743
 	 *
744 744
 	 * @param string $give_totals_output
745 745
 	 */
746
-	return apply_filters( 'give_totals_shortcode_output', $give_totals_output );
746
+	return apply_filters('give_totals_shortcode_output', $give_totals_output);
747 747
 
748 748
 }
749 749
 
750
-add_shortcode( 'give_totals', 'give_totals_shortcode' );
750
+add_shortcode('give_totals', 'give_totals_shortcode');
751 751
 
752 752
 
753 753
 /**
@@ -777,11 +777,11 @@  discard block
 block discarded – undo
777 777
  * }
778 778
  * @return string|bool The markup of the form grid or false.
779 779
  */
780
-function give_form_grid_shortcode( $atts ) {
780
+function give_form_grid_shortcode($atts) {
781 781
 	$form_ids = array();
782 782
 	$give_settings = give_get_settings();
783 783
 
784
-	$atts = shortcode_atts( array(
784
+	$atts = shortcode_atts(array(
785 785
 		'forms_per_page'      => 12,
786 786
 		'paged'               => true,
787 787
 		'ids'                 => '',
@@ -797,11 +797,11 @@  discard block
 block discarded – undo
797 797
 		'excerpt_length'      => 16,
798 798
 		'display_style'       => 'modal_reveal',
799 799
 		'status'              => '' // open or closed
800
-	), $atts );
800
+	), $atts);
801 801
 
802 802
 	// Validate integer attributes.
803
-	$atts['forms_per_page'] = intval( $atts['forms_per_page'] );
804
-	$atts['excerpt_length'] = intval( $atts['excerpt_length'] );
803
+	$atts['forms_per_page'] = intval($atts['forms_per_page']);
804
+	$atts['excerpt_length'] = intval($atts['excerpt_length']);
805 805
 
806 806
 	// Validate boolean attributes.
807 807
 	$boolean_attributes = array(
@@ -812,8 +812,8 @@  discard block
 block discarded – undo
812 812
 		'show_featured_image',
813 813
 	);
814 814
 
815
-	foreach ( $boolean_attributes as $att ) {
816
-		$atts[ $att ] = filter_var( $atts[ $att ], FILTER_VALIDATE_BOOLEAN );
815
+	foreach ($boolean_attributes as $att) {
816
+		$atts[$att] = filter_var($atts[$att], FILTER_VALIDATE_BOOLEAN);
817 817
 	}
818 818
 
819 819
 	// Set default form query args.
@@ -827,8 +827,8 @@  discard block
 block discarded – undo
827 827
 	);
828 828
 
829 829
 	// Filter results of form grid based on form status.
830
-	$form_closed_status = trim( $atts['status'] );
831
-	if ( ! empty( $form_closed_status ) ) {
830
+	$form_closed_status = trim($atts['status']);
831
+	if ( ! empty($form_closed_status)) {
832 832
 		$form_args['meta_query'] = array(
833 833
 			array(
834 834
 				'key'   => '_give_form_status',
@@ -838,18 +838,18 @@  discard block
 block discarded – undo
838 838
 	}
839 839
 
840 840
 	// Maybe add pagination.
841
-	if ( true === $atts['paged'] ) {
842
-		$form_args['paged'] = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;
841
+	if (true === $atts['paged']) {
842
+		$form_args['paged'] = get_query_var('paged') ? get_query_var('paged') : 1;
843 843
 	}
844 844
 
845 845
 	// Maybe filter forms by IDs.
846
-	if ( ! empty( $atts['ids'] ) ) {
847
-		$form_args['post__in'] = array_filter( array_map( 'trim', explode( ',', $atts['ids'] ) ) );
846
+	if ( ! empty($atts['ids'])) {
847
+		$form_args['post__in'] = array_filter(array_map('trim', explode(',', $atts['ids'])));
848 848
 	}
849 849
 
850 850
 	// Maybe filter by form category.
851
-	if ( ! empty( $atts['cats'] ) ) {
852
-		$cats      = array_filter( array_map( 'trim', explode( ',', $atts['cats'] ) ) );
851
+	if ( ! empty($atts['cats'])) {
852
+		$cats      = array_filter(array_map('trim', explode(',', $atts['cats'])));
853 853
 		$tax_query = array(
854 854
 			'taxonomy' => 'give_forms_category',
855 855
 			'terms'    => $cats,
@@ -858,8 +858,8 @@  discard block
 block discarded – undo
858 858
 	}
859 859
 
860 860
 	// Maybe filter by form tag.
861
-	if ( ! empty( $atts['tags'] ) ) {
862
-		$tags      = array_filter( array_map( 'trim', explode( ',', $atts['tags'] ) ) );
861
+	if ( ! empty($atts['tags'])) {
862
+		$tags      = array_filter(array_map('trim', explode(',', $atts['tags'])));
863 863
 		$tax_query = array(
864 864
 			'taxonomy' => 'give_forms_tag',
865 865
 			'terms'    => $tags,
@@ -868,24 +868,24 @@  discard block
 block discarded – undo
868 868
 	}
869 869
 
870 870
 	// Query to output donation forms.
871
-	$form_query = new WP_Query( $form_args );
871
+	$form_query = new WP_Query($form_args);
872 872
 
873
-	if ( $form_query->have_posts() ) {
873
+	if ($form_query->have_posts()) {
874 874
 		ob_start();
875 875
 
876
-		add_filter( 'add_give_goal_progress_class', 'add_give_goal_progress_class', 10, 1 );
877
-		add_filter( 'add_give_goal_progress_bar_class', 'add_give_goal_progress_bar_class', 10, 1 );
878
-		add_filter( 'give_form_wrap_classes', 'add_class_for_form_grid', 10, 3 );
879
-		add_action( 'give_donation_form_top', 'give_is_form_grid_page_hidden_field', 10, 3 );
876
+		add_filter('add_give_goal_progress_class', 'add_give_goal_progress_class', 10, 1);
877
+		add_filter('add_give_goal_progress_bar_class', 'add_give_goal_progress_bar_class', 10, 1);
878
+		add_filter('give_form_wrap_classes', 'add_class_for_form_grid', 10, 3);
879
+		add_action('give_donation_form_top', 'give_is_form_grid_page_hidden_field', 10, 3);
880 880
 
881 881
 		echo '<div class="give-wrap">';
882
-		echo '<div class="give-grid give-grid--' . esc_attr( $atts['columns'] ) . '">';
882
+		echo '<div class="give-grid give-grid--'.esc_attr($atts['columns']).'">';
883 883
 
884
-		while ( $form_query->have_posts() ) {
884
+		while ($form_query->have_posts()) {
885 885
 			$form_query->the_post();
886 886
 
887 887
 			// Give/templates/shortcode-form-grid.php.
888
-			give_get_template( 'shortcode-form-grid', array( $give_settings, $atts ) );
888
+			give_get_template('shortcode-form-grid', array($give_settings, $atts));
889 889
 
890 890
 		}
891 891
 
@@ -893,28 +893,28 @@  discard block
 block discarded – undo
893 893
 
894 894
 		echo '</div><!-- .give-grid -->';
895 895
 
896
-		remove_filter( 'add_give_goal_progress_class', 'add_give_goal_progress_class' );
897
-		remove_filter( 'add_give_goal_progress_bar_class', 'add_give_goal_progress_bar_class' );
898
-		remove_filter( 'give_form_wrap_classes', 'add_class_for_form_grid', 10 );
899
-		remove_action( 'give_donation_form_top', 'give_is_form_grid_page_hidden_field', 10 );
896
+		remove_filter('add_give_goal_progress_class', 'add_give_goal_progress_class');
897
+		remove_filter('add_give_goal_progress_bar_class', 'add_give_goal_progress_bar_class');
898
+		remove_filter('give_form_wrap_classes', 'add_class_for_form_grid', 10);
899
+		remove_action('give_donation_form_top', 'give_is_form_grid_page_hidden_field', 10);
900 900
 
901
-		if ( false !== $atts['paged'] ) {
901
+		if (false !== $atts['paged']) {
902 902
 			$paginate_args = array(
903
-				'current'   => max( 1, get_query_var( 'paged' ) ),
903
+				'current'   => max(1, get_query_var('paged')),
904 904
 				'total'     => $form_query->max_num_pages,
905 905
 				'show_all'  => false,
906 906
 				'end_size'  => 1,
907 907
 				'mid_size'  => 2,
908 908
 				'prev_next' => true,
909
-				'prev_text' => __( '« Previous', 'give' ),
910
-				'next_text' => __( 'Next »', 'give' ),
909
+				'prev_text' => __('« Previous', 'give'),
910
+				'next_text' => __('Next »', 'give'),
911 911
 				'type'      => 'plain',
912 912
 				'add_args'  => false,
913 913
 			);
914 914
 
915 915
 			printf(
916 916
 				'<div class="give-page-numbers">%s</div>',
917
-				paginate_links( $paginate_args )
917
+				paginate_links($paginate_args)
918 918
 			);
919 919
 		}
920 920
 		echo '</div><!-- .give-wrap -->';
@@ -923,4 +923,4 @@  discard block
 block discarded – undo
923 923
 	}
924 924
 }
925 925
 
926
-add_shortcode( 'give_form_grid', 'give_form_grid_shortcode' );
926
+add_shortcode('give_form_grid', 'give_form_grid_shortcode');
Please login to merge, or discard this patch.
includes/admin/reports/graphing.php 1 patch
Spacing   +246 added lines, -246 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,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	$dates          = give_get_report_dates();
27 27
 
28 28
 	// Determine graph options.
29
-	switch ( $dates['range'] ) :
29
+	switch ($dates['range']) :
30 30
 		case 'today' :
31 31
 		case 'yesterday' :
32 32
 			$day_by_day = true;
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 			$day_by_day = false;
39 39
 			break;
40 40
 		case 'other' :
41
-			if ( $dates['m_end'] - $dates['m_start'] >= 2 || $dates['year_end'] > $dates['year'] && ( $dates['m_start'] != '12' && $dates['m_end'] != '1' ) ) {
41
+			if ($dates['m_end'] - $dates['m_start'] >= 2 || $dates['year_end'] > $dates['year'] && ($dates['m_start'] != '12' && $dates['m_end'] != '1')) {
42 42
 				$day_by_day = false;
43 43
 			} else {
44 44
 				$day_by_day = true;
@@ -55,60 +55,60 @@  discard block
 block discarded – undo
55 55
 	$earnings_data = array();
56 56
 	$sales_data    = array();
57 57
 
58
-	if ( 'today' === $dates['range'] || 'yesterday' === $dates['range'] ) {
58
+	if ('today' === $dates['range'] || 'yesterday' === $dates['range']) {
59 59
 
60 60
 		// Hour by hour.
61 61
 		$hour  = 0;
62
-		$month = date( 'n', current_time( 'timestamp' ) );
63
-		while ( $hour <= 23 ) :
62
+		$month = date('n', current_time('timestamp'));
63
+		while ($hour <= 23) :
64 64
 
65
-			$start_date = mktime( $hour, 0, 0, $month, $dates['day'], $dates['year'] );
66
-			$end_date   = mktime( $hour, 59, 59, $month, $dates['day'], $dates['year'] );
67
-			$sales      = $donation_stats->get_sales( 0, $start_date, $end_date );
68
-			$earnings   = $donation_stats->get_earnings( 0, $start_date, $end_date );
65
+			$start_date = mktime($hour, 0, 0, $month, $dates['day'], $dates['year']);
66
+			$end_date   = mktime($hour, 59, 59, $month, $dates['day'], $dates['year']);
67
+			$sales      = $donation_stats->get_sales(0, $start_date, $end_date);
68
+			$earnings   = $donation_stats->get_earnings(0, $start_date, $end_date);
69 69
 
70 70
 			$sales_totals    += $sales;
71 71
 			$earnings_totals += $earnings;
72 72
 
73
-			$sales_data[]    = array( $start_date * 1000, $sales );
74
-			$earnings_data[] = array( $start_date * 1000, $earnings );
73
+			$sales_data[]    = array($start_date * 1000, $sales);
74
+			$earnings_data[] = array($start_date * 1000, $earnings);
75 75
 
76
-			$hour ++;
76
+			$hour++;
77 77
 		endwhile;
78 78
 
79
-	} elseif ( 'this_week' === $dates['range'] || 'last_week' === $dates['range'] ) {
79
+	} elseif ('this_week' === $dates['range'] || 'last_week' === $dates['range']) {
80 80
 
81 81
 		// Day by day.
82 82
 		$day     = $dates['day'];
83 83
 		$day_end = $dates['day_end'];
84 84
 		$month   = $dates['m_start'];
85
-		while ( $day <= $day_end ) :
85
+		while ($day <= $day_end) :
86 86
 
87
-			$start_date = mktime( 0, 0, 0, $month, $day, $dates['year'] );
88
-			$end_date   = mktime( 23, 59, 59, $month, $day, $dates['year'] );
89
-			$sales      = $donation_stats->get_sales( 0, $start_date, $end_date );
90
-			$earnings   = $donation_stats->get_earnings( 0, $start_date, $end_date );
87
+			$start_date = mktime(0, 0, 0, $month, $day, $dates['year']);
88
+			$end_date   = mktime(23, 59, 59, $month, $day, $dates['year']);
89
+			$sales      = $donation_stats->get_sales(0, $start_date, $end_date);
90
+			$earnings   = $donation_stats->get_earnings(0, $start_date, $end_date);
91 91
 
92 92
 			$sales_totals    += $sales;
93 93
 			$earnings_totals += $earnings;
94 94
 
95
-			$sales_data[]    = array( $start_date * 1000, $sales );
96
-			$earnings_data[] = array( $start_date * 1000, $earnings );
97
-			$day ++;
95
+			$sales_data[]    = array($start_date * 1000, $sales);
96
+			$earnings_data[] = array($start_date * 1000, $earnings);
97
+			$day++;
98 98
 		endwhile;
99 99
 
100 100
 	} else {
101 101
 
102 102
 		$y = $dates['year'];
103
-		while ( $y <= $dates['year_end'] ) :
103
+		while ($y <= $dates['year_end']) :
104 104
 
105
-			if ( $dates['year'] === $dates['year_end'] ) {
105
+			if ($dates['year'] === $dates['year_end']) {
106 106
 				$month_start = $dates['m_start'];
107 107
 				$month_end   = $dates['m_end'];
108
-			} elseif ( $y === $dates['year'] ) {
108
+			} elseif ($y === $dates['year']) {
109 109
 				$month_start = $dates['m_start'];
110 110
 				$month_end   = 12;
111
-			} elseif ( $y === $dates['year_end'] ) {
111
+			} elseif ($y === $dates['year_end']) {
112 112
 				$month_start = 1;
113 113
 				$month_end   = $dates['m_end'];
114 114
 			} else {
@@ -117,67 +117,67 @@  discard block
 block discarded – undo
117 117
 			}
118 118
 
119 119
 			$i = $month_start;
120
-			while ( $i <= $month_end ) :
120
+			while ($i <= $month_end) :
121 121
 
122
-				if ( $day_by_day ) {
122
+				if ($day_by_day) {
123 123
 
124
-					if ( $i === $month_end ) {
124
+					if ($i === $month_end) {
125 125
 
126 126
 						$num_of_days = $dates['day_end'];
127 127
 
128 128
 					} else {
129 129
 
130
-						$num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y );
130
+						$num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y);
131 131
 
132 132
 					}
133 133
 
134 134
 					$d = $dates['day'];
135 135
 
136
-					while ( $d <= $num_of_days ) :
136
+					while ($d <= $num_of_days) :
137 137
 
138
-						$start_date = mktime( 0, 0, 0, $i, $d, $y );
139
-						$end_date   = mktime( 23, 59, 59, $i, $d, $y );
140
-						$sales      = $donation_stats->get_sales( 0, $start_date, $end_date );
141
-						$earnings   = $donation_stats->get_earnings( 0, $start_date, $end_date );
138
+						$start_date = mktime(0, 0, 0, $i, $d, $y);
139
+						$end_date   = mktime(23, 59, 59, $i, $d, $y);
140
+						$sales      = $donation_stats->get_sales(0, $start_date, $end_date);
141
+						$earnings   = $donation_stats->get_earnings(0, $start_date, $end_date);
142 142
 
143 143
 						$sales_totals    += $sales;
144 144
 						$earnings_totals += $earnings;
145 145
 
146
-						$sales_data[]    = array( $start_date * 1000, $sales );
147
-						$earnings_data[] = array( $start_date * 1000, $earnings );
146
+						$sales_data[]    = array($start_date * 1000, $sales);
147
+						$earnings_data[] = array($start_date * 1000, $earnings);
148 148
 
149
-						$d ++;
149
+						$d++;
150 150
 
151 151
 					endwhile;
152 152
 
153 153
 				} else {
154 154
 
155 155
 					// This Quarter, Last Quarter, This Year, Last Year.
156
-					$start_date = mktime( 0, 0, 0, $i, 1, $y );
157
-					$end_date   = mktime( 23, 59, 59, $i + 1, 0, $y );
158
-					$sales      = $donation_stats->get_sales( 0, $start_date, $end_date );
159
-					$earnings   = $donation_stats->get_earnings( 0, $start_date, $end_date );
156
+					$start_date = mktime(0, 0, 0, $i, 1, $y);
157
+					$end_date   = mktime(23, 59, 59, $i + 1, 0, $y);
158
+					$sales      = $donation_stats->get_sales(0, $start_date, $end_date);
159
+					$earnings   = $donation_stats->get_earnings(0, $start_date, $end_date);
160 160
 
161 161
 					$sales_totals    += $sales;
162 162
 					$earnings_totals += $earnings;
163 163
 
164
-					$sales_data[]    = array( $start_date * 1000, $sales );
165
-					$earnings_data[] = array( $start_date * 1000, $earnings );
164
+					$sales_data[]    = array($start_date * 1000, $sales);
165
+					$earnings_data[] = array($start_date * 1000, $earnings);
166 166
 
167 167
 				}
168 168
 
169
-				$i ++;
169
+				$i++;
170 170
 
171 171
 			endwhile;
172 172
 
173
-			$y ++;
173
+			$y++;
174 174
 		endwhile;
175 175
 
176 176
 	}
177 177
 
178 178
 	$data = array(
179
-		__( 'Income', 'give' )    => $earnings_data,
180
-		__( 'Donations', 'give' ) => $sales_data
179
+		__('Income', 'give')    => $earnings_data,
180
+		__('Donations', 'give') => $sales_data
181 181
 	);
182 182
 
183 183
 	// start our own output buffer.
@@ -190,12 +190,12 @@  discard block
 block discarded – undo
190 190
 				<div class="inside">
191 191
 					<?php give_reports_graph_controls(); ?>
192 192
 					<?php
193
-					$graph = new Give_Graph( $data, array( 'dataType' => array( 'amount', 'count' ) ) );
194
-					$graph->set( 'x_mode', 'time' );
195
-					$graph->set( 'multiple_y_axes', true );
193
+					$graph = new Give_Graph($data, array('dataType' => array('amount', 'count')));
194
+					$graph->set('x_mode', 'time');
195
+					$graph->set('multiple_y_axes', true);
196 196
 					$graph->display();
197 197
 
198
-					if ( 'this_month' === $dates['range'] ) {
198
+					if ('this_month' === $dates['range']) {
199 199
 						$estimated = give_estimated_monthly_stats();
200 200
 					}
201 201
 					?>
@@ -204,21 +204,21 @@  discard block
 block discarded – undo
204 204
 			<table class="widefat reports-table alignleft" style="max-width:450px">
205 205
 				<tbody>
206 206
 				<tr>
207
-					<th scope="row"><strong><?php _e( 'Total income for period:', 'give' ); ?></strong></th>
208
-					<td><?php echo give_currency_filter( give_format_amount( $earnings_totals, array( 'sanitize' => false ) ) ); ?></td>
207
+					<th scope="row"><strong><?php _e('Total income for period:', 'give'); ?></strong></th>
208
+					<td><?php echo give_currency_filter(give_format_amount($earnings_totals, array('sanitize' => false))); ?></td>
209 209
 				</tr>
210 210
 				<tr class="alternate">
211
-					<th scope="row"><strong><?php _e( 'Total donations for period:', 'give' ); ?><strong></th>
211
+					<th scope="row"><strong><?php _e('Total donations for period:', 'give'); ?><strong></th>
212 212
 					<td><?php echo $sales_totals; ?></td>
213 213
 				</tr>
214
-				<?php if ( 'this_month' === $dates['range'] ) : ?>
214
+				<?php if ('this_month' === $dates['range']) : ?>
215 215
 					<tr>
216
-						<th scope="row"><strong><?php _e( 'Estimated monthly income:', 'give' ); ?></strong></th>
217
-						<td><?php echo give_currency_filter( give_format_amount( $estimated['earnings'], array( 'sanitize' => false ) ) ); ?></td>
216
+						<th scope="row"><strong><?php _e('Estimated monthly income:', 'give'); ?></strong></th>
217
+						<td><?php echo give_currency_filter(give_format_amount($estimated['earnings'], array('sanitize' => false))); ?></td>
218 218
 					</tr>
219 219
 					<tr class="alternate">
220
-						<th scope="row"><strong><?php _e( 'Estimated monthly donations:', 'give' ); ?></strong></th>
221
-						<td><?php echo floor( $estimated['sales'] ); ?></td>
220
+						<th scope="row"><strong><?php _e('Estimated monthly donations:', 'give'); ?></strong></th>
221
+						<td><?php echo floor($estimated['sales']); ?></td>
222 222
 					</tr>
223 223
 				<?php endif; ?>
224 224
 			</table>
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 			 *
232 232
 			 * @since 1.0
233 233
 			 */
234
-			do_action( 'give_reports_graph_additional_stats' );
234
+			do_action('give_reports_graph_additional_stats');
235 235
 			?>
236 236
 
237 237
 		</div>
@@ -251,12 +251,12 @@  discard block
 block discarded – undo
251 251
  *
252 252
  * @return void
253 253
  */
254
-function give_reports_graph_of_form( $form_id = 0 ) {
254
+function give_reports_graph_of_form($form_id = 0) {
255 255
 	// Retrieve the queried dates.
256 256
 	$dates = give_get_report_dates();
257 257
 
258 258
 	// Determine graph options.
259
-	switch ( $dates['range'] ) :
259
+	switch ($dates['range']) :
260 260
 		case 'today' :
261 261
 		case 'yesterday' :
262 262
 			$day_by_day = true;
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
 			$day_by_day = false;
275 275
 			break;
276 276
 		case 'other' :
277
-			if ( $dates['m_end'] - $dates['m_start'] >= 2 || $dates['year_end'] > $dates['year'] ) {
277
+			if ($dates['m_end'] - $dates['m_start'] >= 2 || $dates['year_end'] > $dates['year']) {
278 278
 				$day_by_day = false;
279 279
 			} else {
280 280
 				$day_by_day = true;
@@ -286,75 +286,75 @@  discard block
 block discarded – undo
286 286
 	endswitch;
287 287
 
288 288
 	$earnings_totals = (float) 0.00; // Total earnings for time period shown.
289
-	$sales_totals    = 0;            // Total sales for time period shown.
289
+	$sales_totals    = 0; // Total sales for time period shown.
290 290
 
291 291
 	$earnings_data = array();
292 292
 	$sales_data    = array();
293 293
 	$stats         = new Give_Payment_Stats;
294 294
 
295
-	if ( $dates['range'] == 'today' || $dates['range'] == 'yesterday' ) {
295
+	if ($dates['range'] == 'today' || $dates['range'] == 'yesterday') {
296 296
 
297 297
 		// Hour by hour
298 298
 		$month  = $dates['m_start'];
299 299
 		$hour   = 0;
300 300
 		$minute = 0;
301 301
 		$second = 0;
302
-		while ( $hour <= 23 ) :
302
+		while ($hour <= 23) :
303 303
 
304
-			if ( $hour == 23 ) {
304
+			if ($hour == 23) {
305 305
 				$minute = $second = 59;
306 306
 			}
307 307
 
308
-			$date     = mktime( $hour, $minute, $second, $month, $dates['day'], $dates['year'] );
309
-			$date_end = mktime( $hour + 1, $minute, $second, $month, $dates['day'], $dates['year'] );
308
+			$date     = mktime($hour, $minute, $second, $month, $dates['day'], $dates['year']);
309
+			$date_end = mktime($hour + 1, $minute, $second, $month, $dates['day'], $dates['year']);
310 310
 
311
-			$sales = $stats->get_sales( $form_id, $date, $date_end );
311
+			$sales = $stats->get_sales($form_id, $date, $date_end);
312 312
 			$sales_totals += $sales;
313 313
 
314
-			$earnings = $stats->get_earnings( $form_id, $date, $date_end );
314
+			$earnings = $stats->get_earnings($form_id, $date, $date_end);
315 315
 			$earnings_totals += $earnings;
316 316
 
317
-			$sales_data[]    = array( $date * 1000, $sales );
318
-			$earnings_data[] = array( $date * 1000, $earnings );
317
+			$sales_data[]    = array($date * 1000, $sales);
318
+			$earnings_data[] = array($date * 1000, $earnings);
319 319
 
320
-			$hour ++;
320
+			$hour++;
321 321
 		endwhile;
322 322
 
323
-	} elseif ( $dates['range'] == 'this_week' || $dates['range'] == 'last_week' ) {
323
+	} elseif ($dates['range'] == 'this_week' || $dates['range'] == 'last_week') {
324 324
 
325 325
 		//Day by day.
326 326
 		$day     = $dates['day'];
327 327
 		$day_end = $dates['day_end'];
328 328
 		$month   = $dates['m_start'];
329
-		while ( $day <= $day_end ) :
329
+		while ($day <= $day_end) :
330 330
 
331
-			$date     = mktime( 0, 0, 0, $month, $day, $dates['year'] );
332
-			$date_end = mktime( 0, 0, 0, $month, $day + 1, $dates['year'] );
333
-			$sales    = $stats->get_sales( $form_id, $date, $date_end );
331
+			$date     = mktime(0, 0, 0, $month, $day, $dates['year']);
332
+			$date_end = mktime(0, 0, 0, $month, $day + 1, $dates['year']);
333
+			$sales    = $stats->get_sales($form_id, $date, $date_end);
334 334
 			$sales_totals += $sales;
335 335
 
336
-			$earnings = $stats->get_earnings( $form_id, $date, $date_end );
336
+			$earnings = $stats->get_earnings($form_id, $date, $date_end);
337 337
 			$earnings_totals += $earnings;
338 338
 
339
-			$sales_data[]    = array( $date * 1000, $sales );
340
-			$earnings_data[] = array( $date * 1000, $earnings );
339
+			$sales_data[]    = array($date * 1000, $sales);
340
+			$earnings_data[] = array($date * 1000, $earnings);
341 341
 
342
-			$day ++;
342
+			$day++;
343 343
 		endwhile;
344 344
 
345 345
 	} else {
346 346
 
347 347
 		$y = $dates['year'];
348 348
 
349
-		while ( $y <= $dates['year_end'] ) :
349
+		while ($y <= $dates['year_end']) :
350 350
 
351 351
 			$last_year = false;
352 352
 
353
-			if ( $dates['year'] == $dates['year_end'] ) {
353
+			if ($dates['year'] == $dates['year_end']) {
354 354
 				$month_start = $dates['m_start'];
355 355
 				$month_end   = $dates['m_end'];
356 356
 				$last_year   = true;
357
-			} elseif ( $y == $dates['year'] ) {
357
+			} elseif ($y == $dates['year']) {
358 358
 				$month_start = $dates['m_start'];
359 359
 				$month_end   = 12;
360 360
 			} else {
@@ -363,76 +363,76 @@  discard block
 block discarded – undo
363 363
 			}
364 364
 
365 365
 			$i = $month_start;
366
-			while ( $i <= $month_end ) :
366
+			while ($i <= $month_end) :
367 367
 
368
-				if ( $day_by_day ) {
368
+				if ($day_by_day) {
369 369
 
370
-					if ( $i == $month_end && $last_year ) {
370
+					if ($i == $month_end && $last_year) {
371 371
 
372 372
 						$num_of_days = $dates['day_end'];
373 373
 
374 374
 					} else {
375 375
 
376
-						$num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y );
376
+						$num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y);
377 377
 
378 378
 					}
379 379
 
380 380
 					$d = $dates['day'];
381
-					while ( $d <= $num_of_days ) :
381
+					while ($d <= $num_of_days) :
382 382
 
383
-						$date     = mktime( 0, 0, 0, $i, $d, $y );
384
-						$end_date = mktime( 23, 59, 59, $i, $d, $y );
383
+						$date     = mktime(0, 0, 0, $i, $d, $y);
384
+						$end_date = mktime(23, 59, 59, $i, $d, $y);
385 385
 
386
-						$sales = $stats->get_sales( $form_id, $date, $end_date );
386
+						$sales = $stats->get_sales($form_id, $date, $end_date);
387 387
 						$sales_totals += $sales;
388 388
 
389
-						$earnings = $stats->get_earnings( $form_id, $date, $end_date );
389
+						$earnings = $stats->get_earnings($form_id, $date, $end_date);
390 390
 						$earnings_totals += $earnings;
391 391
 
392
-						$sales_data[]    = array( $date * 1000, $sales );
393
-						$earnings_data[] = array( $date * 1000, $earnings );
394
-						$d ++;
392
+						$sales_data[]    = array($date * 1000, $sales);
393
+						$earnings_data[] = array($date * 1000, $earnings);
394
+						$d++;
395 395
 
396 396
 					endwhile;
397 397
 
398 398
 				} else {
399 399
 
400
-					$num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y );
400
+					$num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y);
401 401
 
402
-					$date     = mktime( 0, 0, 0, $i, 1, $y );
403
-					$end_date = mktime( 23, 59, 59, $i, $num_of_days, $y );
402
+					$date     = mktime(0, 0, 0, $i, 1, $y);
403
+					$end_date = mktime(23, 59, 59, $i, $num_of_days, $y);
404 404
 
405
-					$sales = $stats->get_sales( $form_id, $date, $end_date );
405
+					$sales = $stats->get_sales($form_id, $date, $end_date);
406 406
 					$sales_totals += $sales;
407 407
 
408
-					$earnings = $stats->get_earnings( $form_id, $date, $end_date );
408
+					$earnings = $stats->get_earnings($form_id, $date, $end_date);
409 409
 					$earnings_totals += $earnings;
410 410
 
411
-					$sales_data[]    = array( $date * 1000, $sales );
412
-					$earnings_data[] = array( $date * 1000, $earnings );
411
+					$sales_data[]    = array($date * 1000, $sales);
412
+					$earnings_data[] = array($date * 1000, $earnings);
413 413
 
414 414
 				}
415 415
 
416
-				$i ++;
416
+				$i++;
417 417
 
418 418
 			endwhile;
419 419
 
420
-			$y ++;
420
+			$y++;
421 421
 		endwhile;
422 422
 
423 423
 	}
424 424
 
425 425
 	$data = array(
426
-		__( 'Income', 'give' )    => $earnings_data,
427
-		__( 'Donations', 'give' ) => $sales_data
426
+		__('Income', 'give')    => $earnings_data,
427
+		__('Donations', 'give') => $sales_data
428 428
 	);
429 429
 
430 430
 	?>
431 431
 	<h3><span><?php
432 432
 			printf(
433 433
 			/* translators: %s: form title */
434
-				esc_html__( 'Income Report for %s', 'give' ),
435
-				get_the_title( $form_id )
434
+				esc_html__('Income Report for %s', 'give'),
435
+				get_the_title($form_id)
436 436
 			);
437 437
 			?></span></h3>
438 438
 	<div id="give-dashboard-widgets-wrap">
@@ -441,9 +441,9 @@  discard block
 block discarded – undo
441 441
 				<div class="inside">
442 442
 					<?php give_reports_graph_controls(); ?>
443 443
 					<?php
444
-					$graph = new Give_Graph( $data, array( 'dataType' => array( 'amount', 'count' ) ) );
445
-					$graph->set( 'x_mode', 'time' );
446
-					$graph->set( 'multiple_y_axes', true );
444
+					$graph = new Give_Graph($data, array('dataType' => array('amount', 'count')));
445
+					$graph->set('x_mode', 'time');
446
+					$graph->set('multiple_y_axes', true);
447 447
 					$graph->display();
448 448
 					?>
449 449
 				</div>
@@ -452,20 +452,20 @@  discard block
 block discarded – undo
452 452
 			<table class="widefat reports-table alignleft" style="max-width:450px">
453 453
 				<tbody>
454 454
 				<tr>
455
-					<th scope="row"><strong><?php _e( 'Total income for period:', 'give' ); ?></strong></th>
456
-					<td><?php echo give_currency_filter( give_format_amount( $earnings_totals, array( 'sanitize' => false ) ) ); ?></td>
455
+					<th scope="row"><strong><?php _e('Total income for period:', 'give'); ?></strong></th>
456
+					<td><?php echo give_currency_filter(give_format_amount($earnings_totals, array('sanitize' => false))); ?></td>
457 457
 				</tr>
458 458
 				<tr class="alternate">
459
-					<th scope="row"><strong><?php _e( 'Total donations for period:', 'give' ); ?></strong></th>
459
+					<th scope="row"><strong><?php _e('Total donations for period:', 'give'); ?></strong></th>
460 460
 					<td><?php echo $sales_totals; ?></td>
461 461
 				</tr>
462 462
 				<tr>
463
-					<th scope="row"><strong><?php _e( 'Average monthly income:', 'give' ); ?></strong></th>
464
-					<td><?php echo give_currency_filter( give_format_amount( give_get_average_monthly_form_earnings( $form_id ), array( 'sanitize' => false ) ) ); ?></td>
463
+					<th scope="row"><strong><?php _e('Average monthly income:', 'give'); ?></strong></th>
464
+					<td><?php echo give_currency_filter(give_format_amount(give_get_average_monthly_form_earnings($form_id), array('sanitize' => false))); ?></td>
465 465
 				</tr>
466 466
 				<tr class="alternate">
467
-					<th scope="row"><strong><?php _e( 'Average monthly donations:', 'give' ); ?></strong></th>
468
-					<td><?php echo number_format( give_get_average_monthly_form_sales( $form_id ), 0 ); ?></td>
467
+					<th scope="row"><strong><?php _e('Average monthly donations:', 'give'); ?></strong></th>
468
+					<td><?php echo number_format(give_get_average_monthly_form_sales($form_id), 0); ?></td>
469 469
 				</tr>
470 470
 				</tbody>
471 471
 			</table>
@@ -484,26 +484,26 @@  discard block
 block discarded – undo
484 484
  * @return void
485 485
  */
486 486
 function give_reports_graph_controls() {
487
-	$date_options = apply_filters( 'give_report_date_options', array(
488
-		'today'        => __( 'Today', 'give' ),
489
-		'yesterday'    => __( 'Yesterday', 'give' ),
490
-		'this_week'    => __( 'This Week', 'give' ),
491
-		'last_week'    => __( 'Last Week', 'give' ),
492
-		'this_month'   => __( 'This Month', 'give' ),
493
-		'last_month'   => __( 'Last Month', 'give' ),
494
-		'this_quarter' => __( 'This Quarter', 'give' ),
495
-		'last_quarter' => __( 'Last Quarter', 'give' ),
496
-		'this_year'    => __( 'This Year', 'give' ),
497
-		'last_year'    => __( 'Last Year', 'give' ),
498
-		'other'        => __( 'Custom', 'give' )
499
-	) );
487
+	$date_options = apply_filters('give_report_date_options', array(
488
+		'today'        => __('Today', 'give'),
489
+		'yesterday'    => __('Yesterday', 'give'),
490
+		'this_week'    => __('This Week', 'give'),
491
+		'last_week'    => __('Last Week', 'give'),
492
+		'this_month'   => __('This Month', 'give'),
493
+		'last_month'   => __('Last Month', 'give'),
494
+		'this_quarter' => __('This Quarter', 'give'),
495
+		'last_quarter' => __('Last Quarter', 'give'),
496
+		'this_year'    => __('This Year', 'give'),
497
+		'last_year'    => __('Last Year', 'give'),
498
+		'other'        => __('Custom', 'give')
499
+	));
500 500
 
501 501
 	$dates   = give_get_report_dates();
502 502
 	$display = $dates['range'] == 'other' ? '' : 'display: none;';
503
-	$tab     = isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : 'earnings';
503
+	$tab     = isset($_GET['tab']) ? sanitize_text_field($_GET['tab']) : 'earnings';
504 504
 
505
-	if ( empty( $dates['day_end'] ) ) {
506
-		$dates['day_end'] = cal_days_in_month( CAL_GREGORIAN, date( 'n' ), date( 'Y' ) );
505
+	if (empty($dates['day_end'])) {
506
+		$dates['day_end'] = cal_days_in_month(CAL_GREGORIAN, date('n'), date('Y'));
507 507
 	}
508 508
 
509 509
 	/**
@@ -511,7 +511,7 @@  discard block
 block discarded – undo
511 511
 	 *
512 512
 	 * @since 1.0
513 513
 	 */
514
-	do_action( 'give_report_graph_controls_before' );
514
+	do_action('give_report_graph_controls_before');
515 515
 	?>
516 516
 	<form id="give-graphs-filter" method="get">
517 517
 		<div class="tablenav top">
@@ -519,56 +519,56 @@  discard block
 block discarded – undo
519 519
 
520 520
 				<input type="hidden" name="post_type" value="give_forms" />
521 521
 				<input type="hidden" name="page" value="give-reports" />
522
-				<input type="hidden" name="tab" value="<?php echo esc_attr( $tab ); ?>" />
522
+				<input type="hidden" name="tab" value="<?php echo esc_attr($tab); ?>" />
523 523
 
524
-				<?php if ( isset( $_GET['form-id'] ) ) : ?>
525
-					<input type="hidden" name="form-id" value="<?php echo absint( $_GET['form-id'] ); ?>" />
524
+				<?php if (isset($_GET['form-id'])) : ?>
525
+					<input type="hidden" name="form-id" value="<?php echo absint($_GET['form-id']); ?>" />
526 526
 				<?php endif; ?>
527 527
 
528 528
 				<div id="give-graphs-date-options-wrap">
529 529
 					<select id="give-graphs-date-options" name="range">
530
-						<?php foreach ( $date_options as $key => $option ) : ?>
531
-							<option value="<?php echo esc_attr( $key ); ?>"<?php selected( $key, $dates['range'] ); ?>><?php echo esc_html( $option ); ?></option>
530
+						<?php foreach ($date_options as $key => $option) : ?>
531
+							<option value="<?php echo esc_attr($key); ?>"<?php selected($key, $dates['range']); ?>><?php echo esc_html($option); ?></option>
532 532
 						<?php endforeach; ?>
533 533
 					</select>
534 534
 
535
-					<div id="give-date-range-options" style="<?php echo esc_attr( $display ); ?>">
536
-						<span class="screen-reader-text"><?php _e( 'From', 'give' ); ?>&nbsp;</span>
535
+					<div id="give-date-range-options" style="<?php echo esc_attr($display); ?>">
536
+						<span class="screen-reader-text"><?php _e('From', 'give'); ?>&nbsp;</span>
537 537
 						<select id="give-graphs-month-start" name="m_start" aria-label="Start Month">
538
-							<?php for ( $i = 1; $i <= 12; $i ++ ) : ?>
539
-								<option value="<?php echo absint( $i ); ?>" <?php echo esc_attr( selected( $i, $dates['m_start'] ) ); ?>><?php echo esc_html( give_month_num_to_name( $i ) ); ?></option>
538
+							<?php for ($i = 1; $i <= 12; $i++) : ?>
539
+								<option value="<?php echo absint($i); ?>" <?php echo esc_attr(selected($i, $dates['m_start'])); ?>><?php echo esc_html(give_month_num_to_name($i)); ?></option>
540 540
 							<?php endfor; ?>
541 541
 						</select>
542 542
 						<select id="give-graphs-day-start" name="day" aria-label="Start Day">
543
-							<?php for ( $i = 1; $i <= 31; $i ++ ) : ?>
544
-								<option value="<?php echo absint( $i ); ?>" <?php echo esc_attr( selected( $i, $dates['day'] ) ); ?>><?php echo esc_html( $i ); ?></option>
543
+							<?php for ($i = 1; $i <= 31; $i++) : ?>
544
+								<option value="<?php echo absint($i); ?>" <?php echo esc_attr(selected($i, $dates['day'])); ?>><?php echo esc_html($i); ?></option>
545 545
 							<?php endfor; ?>
546 546
 						</select>
547 547
 						<select id="give-graphs-year-start" name="year" aria-label="Start Year">
548
-							<?php for ( $i = 2007; $i <= date( 'Y' ); $i ++ ) : ?>
549
-								<option value="<?php echo absint( $i ); ?>" <?php echo esc_attr( selected( $i, $dates['year'] ) ); ?>><?php echo esc_html( $i ); ?></option>
548
+							<?php for ($i = 2007; $i <= date('Y'); $i++) : ?>
549
+								<option value="<?php echo absint($i); ?>" <?php echo esc_attr(selected($i, $dates['year'])); ?>><?php echo esc_html($i); ?></option>
550 550
 							<?php endfor; ?>
551 551
 						</select>
552
-						<span class="screen-reader-text"><?php esc_html_e( 'To', 'give' ); ?>&nbsp;</span>
552
+						<span class="screen-reader-text"><?php esc_html_e('To', 'give'); ?>&nbsp;</span>
553 553
 						<span>&ndash;</span>
554 554
 						<select id="give-graphs-month-end" name="m_end" aria-label="End Month">
555
-							<?php for ( $i = 1; $i <= 12; $i ++ ) : ?>
556
-								<option value="<?php echo absint( $i ); ?>" <?php echo esc_attr( selected( $i, $dates['m_end'] ) ); ?>><?php echo esc_html( give_month_num_to_name( $i ) ); ?></option>
555
+							<?php for ($i = 1; $i <= 12; $i++) : ?>
556
+								<option value="<?php echo absint($i); ?>" <?php echo esc_attr(selected($i, $dates['m_end'])); ?>><?php echo esc_html(give_month_num_to_name($i)); ?></option>
557 557
 							<?php endfor; ?>
558 558
 						</select>
559 559
 						<select id="give-graphs-day-end" name="day_end" aria-label="End Day">
560
-							<?php for ( $i = 1; $i <= 31; $i ++ ) : ?>
561
-								<option value="<?php echo absint( $i ); ?>" <?php echo esc_attr( selected( $i, $dates['day_end'] ) ); ?>><?php echo esc_html( $i ); ?></option>
560
+							<?php for ($i = 1; $i <= 31; $i++) : ?>
561
+								<option value="<?php echo absint($i); ?>" <?php echo esc_attr(selected($i, $dates['day_end'])); ?>><?php echo esc_html($i); ?></option>
562 562
 							<?php endfor; ?>
563 563
 						</select>
564 564
 						<select id="give-graphs-year-end" name="year_end" aria-label="End Year">
565
-							<?php for ( $i = 2007; $i <= date( 'Y' ); $i ++ ) : ?>
566
-								<option value="<?php echo absint( $i ); ?>" <?php echo esc_attr( selected( $i, $dates['year_end'] ) ); ?>><?php echo esc_html( $i ); ?></option>
565
+							<?php for ($i = 2007; $i <= date('Y'); $i++) : ?>
566
+								<option value="<?php echo absint($i); ?>" <?php echo esc_attr(selected($i, $dates['year_end'])); ?>><?php echo esc_html($i); ?></option>
567 567
 							<?php endfor; ?>
568 568
 						</select>
569 569
 					</div>
570 570
 
571
-					<input type="submit" class="button-secondary" value="<?php _e( 'Filter', 'give' ); ?>" />
571
+					<input type="submit" class="button-secondary" value="<?php _e('Filter', 'give'); ?>" />
572 572
 				</div>
573 573
 
574 574
 				<input type="hidden" name="give_action" value="filter_reports" />
@@ -581,7 +581,7 @@  discard block
 block discarded – undo
581 581
 	 *
582 582
 	 * @since 1.0
583 583
 	 */
584
-	do_action( 'give_report_graph_controls_after' );
584
+	do_action('give_report_graph_controls_after');
585 585
 }
586 586
 
587 587
 /**
@@ -597,67 +597,67 @@  discard block
 block discarded – undo
597 597
 function give_get_report_dates() {
598 598
 	$dates = array();
599 599
 
600
-	$current_time = current_time( 'timestamp' );
600
+	$current_time = current_time('timestamp');
601 601
 
602
-	$dates['range']    = isset( $_GET['range'] ) ? $_GET['range'] : 'this_month';
603
-	$dates['year']     = isset( $_GET['year'] ) ? $_GET['year'] : date( 'Y' );
604
-	$dates['year_end'] = isset( $_GET['year_end'] ) ? $_GET['year_end'] : date( 'Y' );
605
-	$dates['m_start']  = isset( $_GET['m_start'] ) ? $_GET['m_start'] : 1;
606
-	$dates['m_end']    = isset( $_GET['m_end'] ) ? $_GET['m_end'] : 12;
607
-	$dates['day']      = isset( $_GET['day'] ) ? $_GET['day'] : 1;
608
-	$dates['day_end']  = isset( $_GET['day_end'] ) ? $_GET['day_end'] : cal_days_in_month( CAL_GREGORIAN, $dates['m_end'], $dates['year'] );
602
+	$dates['range']    = isset($_GET['range']) ? $_GET['range'] : 'this_month';
603
+	$dates['year']     = isset($_GET['year']) ? $_GET['year'] : date('Y');
604
+	$dates['year_end'] = isset($_GET['year_end']) ? $_GET['year_end'] : date('Y');
605
+	$dates['m_start']  = isset($_GET['m_start']) ? $_GET['m_start'] : 1;
606
+	$dates['m_end']    = isset($_GET['m_end']) ? $_GET['m_end'] : 12;
607
+	$dates['day']      = isset($_GET['day']) ? $_GET['day'] : 1;
608
+	$dates['day_end']  = isset($_GET['day_end']) ? $_GET['day_end'] : cal_days_in_month(CAL_GREGORIAN, $dates['m_end'], $dates['year']);
609 609
 
610 610
 	// Modify dates based on predefined ranges.
611
-	switch ( $dates['range'] ) :
611
+	switch ($dates['range']) :
612 612
 
613 613
 		case 'this_month' :
614
-			$dates['m_start']  = date( 'n', $current_time );
615
-			$dates['m_end']    = date( 'n', $current_time );
614
+			$dates['m_start']  = date('n', $current_time);
615
+			$dates['m_end']    = date('n', $current_time);
616 616
 			$dates['day']      = 1;
617
-			$dates['day_end']  = cal_days_in_month( CAL_GREGORIAN, $dates['m_end'], $dates['year'] );
618
-			$dates['year']     = date( 'Y' );
619
-			$dates['year_end'] = date( 'Y' );
617
+			$dates['day_end']  = cal_days_in_month(CAL_GREGORIAN, $dates['m_end'], $dates['year']);
618
+			$dates['year']     = date('Y');
619
+			$dates['year_end'] = date('Y');
620 620
 			break;
621 621
 
622 622
 		case 'last_month' :
623
-			if ( date( 'n' ) == 1 ) {
623
+			if (date('n') == 1) {
624 624
 				$dates['m_start']  = 12;
625 625
 				$dates['m_end']    = 12;
626
-				$dates['year']     = date( 'Y', $current_time ) - 1;
627
-				$dates['year_end'] = date( 'Y', $current_time ) - 1;
626
+				$dates['year']     = date('Y', $current_time) - 1;
627
+				$dates['year_end'] = date('Y', $current_time) - 1;
628 628
 			} else {
629
-				$dates['m_start']  = date( 'n' ) - 1;
630
-				$dates['m_end']    = date( 'n' ) - 1;
629
+				$dates['m_start']  = date('n') - 1;
630
+				$dates['m_end']    = date('n') - 1;
631 631
 				$dates['year_end'] = $dates['year'];
632 632
 			}
633
-			$dates['day_end'] = cal_days_in_month( CAL_GREGORIAN, $dates['m_end'], $dates['year'] );
633
+			$dates['day_end'] = cal_days_in_month(CAL_GREGORIAN, $dates['m_end'], $dates['year']);
634 634
 			break;
635 635
 
636 636
 		case 'today' :
637
-			$dates['day']      = date( 'd', $current_time );
638
-			$dates['day_end']  = date( 'd', $current_time );
639
-			$dates['m_start']  = date( 'n', $current_time );
640
-			$dates['m_end']    = date( 'n', $current_time );
641
-			$dates['year']     = date( 'Y', $current_time );
642
-			$dates['year_end'] = date( 'Y', $current_time );
637
+			$dates['day']      = date('d', $current_time);
638
+			$dates['day_end']  = date('d', $current_time);
639
+			$dates['m_start']  = date('n', $current_time);
640
+			$dates['m_end']    = date('n', $current_time);
641
+			$dates['year']     = date('Y', $current_time);
642
+			$dates['year_end'] = date('Y', $current_time);
643 643
 			break;
644 644
 
645 645
 		case 'yesterday' :
646 646
 
647
-			$year  = date( 'Y', $current_time );
648
-			$month = date( 'n', $current_time );
649
-			$day   = date( 'd', $current_time );
647
+			$year  = date('Y', $current_time);
648
+			$month = date('n', $current_time);
649
+			$day   = date('d', $current_time);
650 650
 
651
-			if ( $month == 1 && $day == 1 ) {
651
+			if ($month == 1 && $day == 1) {
652 652
 
653 653
 				$year -= 1;
654 654
 				$month = 12;
655
-				$day   = cal_days_in_month( CAL_GREGORIAN, $month, $year );
655
+				$day   = cal_days_in_month(CAL_GREGORIAN, $month, $year);
656 656
 
657
-			} elseif ( $month > 1 && $day == 1 ) {
657
+			} elseif ($month > 1 && $day == 1) {
658 658
 
659 659
 				$month -= 1;
660
-				$day = cal_days_in_month( CAL_GREGORIAN, $month, $year );
660
+				$day = cal_days_in_month(CAL_GREGORIAN, $month, $year);
661 661
 
662 662
 			} else {
663 663
 
@@ -673,48 +673,48 @@  discard block
 block discarded – undo
673 673
 			break;
674 674
 
675 675
 		case 'this_week' :
676
-			$dates['day'] = date( 'd', $current_time - ( date( 'w', $current_time ) - 1 ) * 60 * 60 * 24 ) - 1;
677
-			$dates['day'] += get_option( 'start_of_week' );
676
+			$dates['day'] = date('d', $current_time - (date('w', $current_time) - 1) * 60 * 60 * 24) - 1;
677
+			$dates['day'] += get_option('start_of_week');
678 678
 			$dates['day_end'] = $dates['day'] + 6;
679
-			$dates['m_start'] = date( 'n', $current_time );
680
-			$dates['m_end']   = date( 'n', $current_time );
681
-			$dates['year']    = date( 'Y', $current_time );
679
+			$dates['m_start'] = date('n', $current_time);
680
+			$dates['m_end']   = date('n', $current_time);
681
+			$dates['year']    = date('Y', $current_time);
682 682
 			break;
683 683
 
684 684
 		case 'last_week' :
685
-			$dates['day'] = date( 'd', $current_time - ( date( 'w' ) - 1 ) * 60 * 60 * 24 ) - 8;
686
-			$dates['day'] += get_option( 'start_of_week' );
685
+			$dates['day'] = date('d', $current_time - (date('w') - 1) * 60 * 60 * 24) - 8;
686
+			$dates['day'] += get_option('start_of_week');
687 687
 			$dates['day_end'] = $dates['day'] + 6;
688
-			$dates['year']    = date( 'Y' );
689
-
690
-			if ( date( 'j', $current_time ) <= 7 ) {
691
-				$dates['m_start'] = date( 'n', $current_time ) - 1;
692
-				$dates['m_end']   = date( 'n', $current_time ) - 1;
693
-				if ( $dates['m_start'] <= 1 ) {
694
-					$dates['year']     = date( 'Y', $current_time ) - 1;
695
-					$dates['year_end'] = date( 'Y', $current_time ) - 1;
688
+			$dates['year']    = date('Y');
689
+
690
+			if (date('j', $current_time) <= 7) {
691
+				$dates['m_start'] = date('n', $current_time) - 1;
692
+				$dates['m_end']   = date('n', $current_time) - 1;
693
+				if ($dates['m_start'] <= 1) {
694
+					$dates['year']     = date('Y', $current_time) - 1;
695
+					$dates['year_end'] = date('Y', $current_time) - 1;
696 696
 				}
697 697
 			} else {
698
-				$dates['m_start'] = date( 'n', $current_time );
699
-				$dates['m_end']   = date( 'n', $current_time );
698
+				$dates['m_start'] = date('n', $current_time);
699
+				$dates['m_end']   = date('n', $current_time);
700 700
 			}
701 701
 			break;
702 702
 
703 703
 		case 'this_quarter' :
704
-			$month_now     = date( 'n', $current_time );
705
-			$dates['year'] = date( 'Y', $current_time );
704
+			$month_now     = date('n', $current_time);
705
+			$dates['year'] = date('Y', $current_time);
706 706
 
707
-			if ( $month_now <= 3 ) {
707
+			if ($month_now <= 3) {
708 708
 
709 709
 				$dates['m_start'] = 1;
710 710
 				$dates['m_end']   = 4;
711 711
 
712
-			} else if ( $month_now <= 6 ) {
712
+			} else if ($month_now <= 6) {
713 713
 
714 714
 				$dates['m_start'] = 4;
715 715
 				$dates['m_end']   = 7;
716 716
 
717
-			} else if ( $month_now <= 9 ) {
717
+			} else if ($month_now <= 9) {
718 718
 
719 719
 				$dates['m_start'] = 7;
720 720
 				$dates['m_end']   = 10;
@@ -723,28 +723,28 @@  discard block
 block discarded – undo
723 723
 
724 724
 				$dates['m_start']  = 10;
725 725
 				$dates['m_end']    = 1;
726
-				$dates['year_end'] = date( 'Y', $current_time ) + 1;
726
+				$dates['year_end'] = date('Y', $current_time) + 1;
727 727
 
728 728
 			}
729 729
 			break;
730 730
 
731 731
 		case 'last_quarter' :
732
-			$month_now         = date( 'n', $current_time );
733
-			$dates['year']     = date( 'Y', $current_time );
734
-			$dates['year_end'] = date( 'Y', $current_time );
732
+			$month_now         = date('n', $current_time);
733
+			$dates['year']     = date('Y', $current_time);
734
+			$dates['year_end'] = date('Y', $current_time);
735 735
 
736
-			if ( $month_now <= 3 ) {
736
+			if ($month_now <= 3) {
737 737
 
738 738
 				$dates['m_start'] = 10;
739 739
 				$dates['m_end']   = 1;
740
-				$dates['year']    = date( 'Y', $current_time ) - 1; // Previous year.
740
+				$dates['year']    = date('Y', $current_time) - 1; // Previous year.
741 741
 
742
-			} else if ( $month_now <= 6 ) {
742
+			} else if ($month_now <= 6) {
743 743
 
744 744
 				$dates['m_start'] = 1;
745 745
 				$dates['m_end']   = 4;
746 746
 
747
-			} else if ( $month_now <= 9 ) {
747
+			} else if ($month_now <= 9) {
748 748
 
749 749
 				$dates['m_start'] = 4;
750 750
 				$dates['m_end']   = 7;
@@ -760,20 +760,20 @@  discard block
 block discarded – undo
760 760
 		case 'this_year' :
761 761
 			$dates['m_start']  = 1;
762 762
 			$dates['m_end']    = 12;
763
-			$dates['year']     = date( 'Y', $current_time );
764
-			$dates['year_end'] = date( 'Y', $current_time );
763
+			$dates['year']     = date('Y', $current_time);
764
+			$dates['year_end'] = date('Y', $current_time);
765 765
 			break;
766 766
 
767 767
 		case 'last_year' :
768 768
 			$dates['m_start']  = 1;
769 769
 			$dates['m_end']    = 12;
770
-			$dates['year']     = date( 'Y', $current_time ) - 1;
771
-			$dates['year_end'] = date( 'Y', $current_time ) - 1;
770
+			$dates['year']     = date('Y', $current_time) - 1;
771
+			$dates['year_end'] = date('Y', $current_time) - 1;
772 772
 			break;
773 773
 
774 774
 	endswitch;
775 775
 
776
-	return apply_filters( 'give_report_dates', $dates );
776
+	return apply_filters('give_report_dates', $dates);
777 777
 }
778 778
 
779 779
 /**
@@ -784,18 +784,18 @@  discard block
 block discarded – undo
784 784
  *
785 785
  * @param $data
786 786
  */
787
-function give_parse_report_dates( $data ) {
787
+function give_parse_report_dates($data) {
788 788
 	$dates = give_get_report_dates();
789 789
 
790 790
 	$view = give_get_reporting_view();
791
-	$tab  = isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : 'earnings';
792
-	$id   = isset( $_GET['form-id'] ) ? $_GET['form-id'] : null;
791
+	$tab  = isset($_GET['tab']) ? sanitize_text_field($_GET['tab']) : 'earnings';
792
+	$id   = isset($_GET['form-id']) ? $_GET['form-id'] : null;
793 793
 
794
-	wp_redirect( add_query_arg( $dates, admin_url( 'edit.php?post_type=give_forms&page=give-reports&tab=' . esc_attr( $tab ) . '&view=' . esc_attr( $view ) . '&form-id=' . absint( $id ) ) ) );
794
+	wp_redirect(add_query_arg($dates, admin_url('edit.php?post_type=give_forms&page=give-reports&tab='.esc_attr($tab).'&view='.esc_attr($view).'&form-id='.absint($id))));
795 795
 	give_die();
796 796
 }
797 797
 
798
-add_action( 'give_filter_reports', 'give_parse_report_dates' );
798
+add_action('give_filter_reports', 'give_parse_report_dates');
799 799
 
800 800
 
801 801
 /**
@@ -807,23 +807,23 @@  discard block
 block discarded – undo
807 807
  */
808 808
 function give_reports_refresh_button() {
809 809
 
810
-	$url = wp_nonce_url( add_query_arg( array(
810
+	$url = wp_nonce_url(add_query_arg(array(
811 811
 		'give_action'  => 'refresh_reports_transients',
812 812
 		'give-messages[]' => 'refreshed-reports'
813
-	) ), 'give-refresh-reports' );
813
+	)), 'give-refresh-reports');
814 814
 
815
-	echo Give()->tooltips->render_link( array(
816
-		'label'       => esc_attr__( 'Clicking this will clear the reports cache.', 'give' ),
817
-		'tag_content' => '<span class="give-admin-button-icon give-admin-button-icon-update"></span>' . esc_html__( 'Refresh Report Data', 'give' ),
815
+	echo Give()->tooltips->render_link(array(
816
+		'label'       => esc_attr__('Clicking this will clear the reports cache.', 'give'),
817
+		'tag_content' => '<span class="give-admin-button-icon give-admin-button-icon-update"></span>'.esc_html__('Refresh Report Data', 'give'),
818 818
 		'link'        => $url,
819 819
 		'position'    => 'left',
820 820
 		'attributes'  => array(
821 821
 			'class' => 'button alignright give-admin-button'
822 822
 		)
823
-	) );
823
+	));
824 824
 }
825 825
 
826
-add_action( 'give_reports_graph_additional_stats', 'give_reports_refresh_button' );
826
+add_action('give_reports_graph_additional_stats', 'give_reports_refresh_button');
827 827
 
828 828
 /**
829 829
  * Trigger the refresh of reports transients
@@ -834,20 +834,20 @@  discard block
 block discarded – undo
834 834
  *
835 835
  * @return void
836 836
  */
837
-function give_run_refresh_reports_transients( $data ) {
837
+function give_run_refresh_reports_transients($data) {
838 838
 
839
-	if ( ! wp_verify_nonce( $data['_wpnonce'], 'give-refresh-reports' ) ) {
839
+	if ( ! wp_verify_nonce($data['_wpnonce'], 'give-refresh-reports')) {
840 840
 		return;
841 841
 	}
842 842
 
843 843
 	// Monthly stats.
844
-	Give_Cache::delete( Give_Cache::get_key( 'give_estimated_monthly_stats' ) );
844
+	Give_Cache::delete(Give_Cache::get_key('give_estimated_monthly_stats'));
845 845
 
846 846
 	// Total earning.
847
-	delete_option( 'give_earnings_total' );
847
+	delete_option('give_earnings_total');
848 848
 
849 849
 	// @todo: Refresh only range related stat cache
850 850
 	give_delete_donation_stats();
851 851
 }
852 852
 
853
-add_action( 'give_refresh_reports_transients', 'give_run_refresh_reports_transients' );
854 853
\ No newline at end of file
854
+add_action('give_refresh_reports_transients', 'give_run_refresh_reports_transients');
855 855
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/donors/donor-actions.php 1 patch
Spacing   +204 added lines, -204 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
 
@@ -23,33 +23,33 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return array|bool $output Response messages
25 25
  */
26
-function give_edit_donor( $args ) {
26
+function give_edit_donor($args) {
27 27
 
28
-	$donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' );
28
+	$donor_edit_role = apply_filters('give_edit_donors_role', 'edit_give_payments');
29 29
 
30
-	if ( ! is_admin() || ! current_user_can( $donor_edit_role ) ) {
31
-		wp_die( __( 'You do not have permission to edit this donor.', 'give' ), __( 'Error', 'give' ), array(
30
+	if ( ! is_admin() || ! current_user_can($donor_edit_role)) {
31
+		wp_die(__('You do not have permission to edit this donor.', 'give'), __('Error', 'give'), array(
32 32
 			'response' => 403,
33
-		) );
33
+		));
34 34
 	}
35 35
 
36
-	if ( empty( $args ) ) {
36
+	if (empty($args)) {
37 37
 		return false;
38 38
 	}
39 39
 
40
-	$donor_info = give_clean( $args['customerinfo'] );
40
+	$donor_info = give_clean($args['customerinfo']);
41 41
 	$donor_id   = (int) $args['customerinfo']['id'];
42 42
 	$nonce      = $args['_wpnonce'];
43 43
 
44
-	if ( ! wp_verify_nonce( $nonce, 'edit-donor' ) ) {
45
-		wp_die( __( 'Cheatin&#8217; uh?', 'give' ), __( 'Error', 'give' ), array(
44
+	if ( ! wp_verify_nonce($nonce, 'edit-donor')) {
45
+		wp_die(__('Cheatin&#8217; uh?', 'give'), __('Error', 'give'), array(
46 46
 			'response' => 400,
47
-		) );
47
+		));
48 48
 	}
49 49
 
50
-	$donor = new Give_Donor( $donor_id );
50
+	$donor = new Give_Donor($donor_id);
51 51
 
52
-	if ( empty( $donor->id ) ) {
52
+	if (empty($donor->id)) {
53 53
 		return false;
54 54
 	}
55 55
 
@@ -64,39 +64,39 @@  discard block
 block discarded – undo
64 64
 		'country' => '',
65 65
 	);
66 66
 
67
-	$donor_info = wp_parse_args( $donor_info, $defaults );
67
+	$donor_info = wp_parse_args($donor_info, $defaults);
68 68
 
69
-	if ( (int) $donor_info['user_id'] !== (int) $donor->user_id ) {
69
+	if ((int) $donor_info['user_id'] !== (int) $donor->user_id) {
70 70
 
71 71
 		// Make sure we don't already have this user attached to a donor.
72
-		if ( ! empty( $donor_info['user_id'] ) && false !== Give()->donors->get_donor_by( 'user_id', $donor_info['user_id'] ) ) {
73
-			give_set_error( 'give-invalid-donor-user_id', sprintf( __( 'The User ID #%d is already associated with a different donor.', 'give' ), $donor_info['user_id'] ) );
72
+		if ( ! empty($donor_info['user_id']) && false !== Give()->donors->get_donor_by('user_id', $donor_info['user_id'])) {
73
+			give_set_error('give-invalid-donor-user_id', sprintf(__('The User ID #%d is already associated with a different donor.', 'give'), $donor_info['user_id']));
74 74
 		}
75 75
 
76 76
 		// Make sure it's actually a user.
77
-		$user = get_user_by( 'id', $donor_info['user_id'] );
78
-		if ( ! empty( $donor_info['user_id'] ) && false === $user ) {
79
-			give_set_error( 'give-invalid-user_id', sprintf( __( 'The User ID #%d does not exist. Please assign an existing user.', 'give' ), $donor_info['user_id'] ) );
77
+		$user = get_user_by('id', $donor_info['user_id']);
78
+		if ( ! empty($donor_info['user_id']) && false === $user) {
79
+			give_set_error('give-invalid-user_id', sprintf(__('The User ID #%d does not exist. Please assign an existing user.', 'give'), $donor_info['user_id']));
80 80
 		}
81 81
 	}
82 82
 
83
-	if ( give_get_errors() ) {
83
+	if (give_get_errors()) {
84 84
 		return false;
85 85
 	}
86 86
 
87 87
 	// If First name of donor is empty, then fetch the current first name of donor.
88
-	if ( empty( $donor_info['first_name'] ) ) {
88
+	if (empty($donor_info['first_name'])) {
89 89
 		$donor_info['first_name'] = $donor->get_first_name();
90 90
 	}
91 91
 
92 92
 	// Sanitize the inputs.
93 93
 	$donor_data               = array();
94
-	$donor_data['name']       = trim( "{$donor_info['first_name']} {$donor_info['last_name']}" );
94
+	$donor_data['name']       = trim("{$donor_info['first_name']} {$donor_info['last_name']}");
95 95
 	$donor_data['first_name'] = $donor_info['first_name'];
96 96
 	$donor_data['last_name']  = $donor_info['last_name'];
97 97
 	$donor_data['user_id']    = $donor_info['user_id'];
98 98
 
99
-	$donor_data             = apply_filters( 'give_edit_donor_info', $donor_data, $donor_id );
99
+	$donor_data = apply_filters('give_edit_donor_info', $donor_data, $donor_id);
100 100
 
101 101
 	/**
102 102
 	 * Filter the address
@@ -104,28 +104,28 @@  discard block
 block discarded – undo
104 104
 	 *
105 105
 	 * @since 1.0
106 106
 	 */
107
-	$address                = apply_filters( 'give_edit_donor_address', array(), $donor_id );
107
+	$address                = apply_filters('give_edit_donor_address', array(), $donor_id);
108 108
 
109
-	$donor_data             = give_clean( $donor_data );
110
-	$address                = give_clean( $address );
109
+	$donor_data             = give_clean($donor_data);
110
+	$address                = give_clean($address);
111 111
 
112
-	$output = give_connect_user_donor_profile( $donor, $donor_data, $address );
112
+	$output = give_connect_user_donor_profile($donor, $donor_data, $address);
113 113
 
114
-	if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
115
-		header( 'Content-Type: application/json' );
116
-		echo json_encode( $output );
114
+	if (defined('DOING_AJAX') && DOING_AJAX) {
115
+		header('Content-Type: application/json');
116
+		echo json_encode($output);
117 117
 		wp_die();
118 118
 	}
119 119
 
120
-	if ( $output['success'] ) {
121
-		wp_redirect( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id={$donor_id}&give-messages[]=profile-updated" ) );
120
+	if ($output['success']) {
121
+		wp_redirect(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id={$donor_id}&give-messages[]=profile-updated"));
122 122
 	}
123 123
 
124 124
 	exit;
125 125
 
126 126
 }
127 127
 
128
-add_action( 'give_edit-donor', 'give_edit_donor', 10, 1 );
128
+add_action('give_edit-donor', 'give_edit_donor', 10, 1);
129 129
 
130 130
 /**
131 131
  * Save a donor note.
@@ -136,40 +136,40 @@  discard block
 block discarded – undo
136 136
  *
137 137
  * @return int The Note ID that was saved, or 0 if nothing was saved.
138 138
  */
139
-function give_donor_save_note( $args ) {
139
+function give_donor_save_note($args) {
140 140
 
141
-	$donor_view_role = apply_filters( 'give_view_donors_role', 'view_give_reports' );
141
+	$donor_view_role = apply_filters('give_view_donors_role', 'view_give_reports');
142 142
 
143
-	if ( ! is_admin() || ! current_user_can( $donor_view_role ) ) {
144
-		wp_die( __( 'You do not have permission to edit this donor.', 'give' ), __( 'Error', 'give' ), array(
143
+	if ( ! is_admin() || ! current_user_can($donor_view_role)) {
144
+		wp_die(__('You do not have permission to edit this donor.', 'give'), __('Error', 'give'), array(
145 145
 			'response' => 403,
146
-		) );
146
+		));
147 147
 	}
148 148
 
149
-	if ( empty( $args ) ) {
149
+	if (empty($args)) {
150 150
 		return false;
151 151
 	}
152 152
 
153
-	$donor_note = trim( give_clean( $args['donor_note'] ) );
153
+	$donor_note = trim(give_clean($args['donor_note']));
154 154
 	$donor_id   = (int) $args['customer_id'];
155 155
 	$nonce      = $args['add_donor_note_nonce'];
156 156
 
157
-	if ( ! wp_verify_nonce( $nonce, 'add-donor-note' ) ) {
158
-		wp_die( __( 'Cheatin&#8217; uh?', 'give' ), __( 'Error', 'give' ), array(
157
+	if ( ! wp_verify_nonce($nonce, 'add-donor-note')) {
158
+		wp_die(__('Cheatin&#8217; uh?', 'give'), __('Error', 'give'), array(
159 159
 			'response' => 400,
160
-		) );
160
+		));
161 161
 	}
162 162
 
163
-	if ( empty( $donor_note ) ) {
164
-		give_set_error( 'empty-donor-note', __( 'A note is required.', 'give' ) );
163
+	if (empty($donor_note)) {
164
+		give_set_error('empty-donor-note', __('A note is required.', 'give'));
165 165
 	}
166 166
 
167
-	if ( give_get_errors() ) {
167
+	if (give_get_errors()) {
168 168
 		return false;
169 169
 	}
170 170
 
171
-	$donor    = new Give_Donor( $donor_id );
172
-	$new_note = $donor->add_note( $donor_note );
171
+	$donor    = new Give_Donor($donor_id);
172
+	$new_note = $donor->add_note($donor_note);
173 173
 
174 174
 	/**
175 175
 	 * Fires before inserting donor note.
@@ -179,22 +179,22 @@  discard block
 block discarded – undo
179 179
 	 *
180 180
 	 * @since 1.0
181 181
 	 */
182
-	do_action( 'give_pre_insert_donor_note', $donor_id, $new_note );
182
+	do_action('give_pre_insert_donor_note', $donor_id, $new_note);
183 183
 
184
-	if ( ! empty( $new_note ) && ! empty( $donor->id ) ) {
184
+	if ( ! empty($new_note) && ! empty($donor->id)) {
185 185
 
186 186
 		ob_start();
187 187
 		?>
188 188
 		<div class="donor-note-wrapper dashboard-comment-wrap comment-item">
189 189
 			<span class="note-content-wrap">
190
-				<?php echo stripslashes( $new_note ); ?>
190
+				<?php echo stripslashes($new_note); ?>
191 191
 			</span>
192 192
 		</div>
193 193
 		<?php
194 194
 		$output = ob_get_contents();
195 195
 		ob_end_clean();
196 196
 
197
-		if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
197
+		if (defined('DOING_AJAX') && DOING_AJAX) {
198 198
 			echo $output;
199 199
 			exit;
200 200
 		}
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 
208 208
 }
209 209
 
210
-add_action( 'give_add-donor-note', 'give_donor_save_note', 10, 1 );
210
+add_action('give_add-donor-note', 'give_donor_save_note', 10, 1);
211 211
 
212 212
 /**
213 213
  * Delete a donor.
@@ -218,41 +218,41 @@  discard block
 block discarded – undo
218 218
  *
219 219
  * @return int Whether it was a successful deletion.
220 220
  */
221
-function give_donor_delete( $args ) {
221
+function give_donor_delete($args) {
222 222
 
223
-	$donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' );
223
+	$donor_edit_role = apply_filters('give_edit_donors_role', 'edit_give_payments');
224 224
 
225
-	if ( ! is_admin() || ! current_user_can( $donor_edit_role ) ) {
226
-		wp_die( __( 'You do not have permission to delete donors.', 'give' ), __( 'Error', 'give' ), array(
225
+	if ( ! is_admin() || ! current_user_can($donor_edit_role)) {
226
+		wp_die(__('You do not have permission to delete donors.', 'give'), __('Error', 'give'), array(
227 227
 			'response' => 403,
228
-		) );
228
+		));
229 229
 	}
230 230
 
231
-	if ( empty( $args ) ) {
231
+	if (empty($args)) {
232 232
 		return false;
233 233
 	}
234 234
 
235 235
 	$donor_id    = (int) $args['customer_id'];
236
-	$confirm     = ! empty( $args['give-donor-delete-confirm'] ) ? true : false;
237
-	$remove_data = ! empty( $args['give-donor-delete-records'] ) ? true : false;
236
+	$confirm     = ! empty($args['give-donor-delete-confirm']) ? true : false;
237
+	$remove_data = ! empty($args['give-donor-delete-records']) ? true : false;
238 238
 	$nonce       = $args['_wpnonce'];
239 239
 
240
-	if ( ! wp_verify_nonce( $nonce, 'delete-donor' ) ) {
241
-		wp_die( __( 'Cheatin&#8217; uh?', 'give' ), __( 'Error', 'give' ), array(
240
+	if ( ! wp_verify_nonce($nonce, 'delete-donor')) {
241
+		wp_die(__('Cheatin&#8217; uh?', 'give'), __('Error', 'give'), array(
242 242
 			'response' => 400,
243
-		) );
243
+		));
244 244
 	}
245 245
 
246
-	if ( ! $confirm ) {
247
-		give_set_error( 'donor-delete-no-confirm', __( 'Please confirm you want to delete this donor.', 'give' ) );
246
+	if ( ! $confirm) {
247
+		give_set_error('donor-delete-no-confirm', __('Please confirm you want to delete this donor.', 'give'));
248 248
 	}
249 249
 
250
-	if ( give_get_errors() ) {
251
-		wp_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor_id ) );
250
+	if (give_get_errors()) {
251
+		wp_redirect(admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor_id));
252 252
 		exit;
253 253
 	}
254 254
 
255
-	$donor = new Give_Donor( $donor_id );
255
+	$donor = new Give_Donor($donor_id);
256 256
 
257 257
 	/**
258 258
 	 * Fires before deleting donor.
@@ -263,50 +263,50 @@  discard block
 block discarded – undo
263 263
 	 *
264 264
 	 * @since 1.0
265 265
 	 */
266
-	do_action( 'give_pre_delete_donor', $donor_id, $confirm, $remove_data );
266
+	do_action('give_pre_delete_donor', $donor_id, $confirm, $remove_data);
267 267
 
268
-	if ( $donor->id > 0 ) {
268
+	if ($donor->id > 0) {
269 269
 
270
-		$payments_array = explode( ',', $donor->payment_ids );
271
-		$success        = Give()->donors->delete( $donor->id );
270
+		$payments_array = explode(',', $donor->payment_ids);
271
+		$success        = Give()->donors->delete($donor->id);
272 272
 
273
-		if ( $success ) {
273
+		if ($success) {
274 274
 
275
-			if ( $remove_data ) {
275
+			if ($remove_data) {
276 276
 
277 277
 				// Remove all donations, logs, etc.
278
-				foreach ( $payments_array as $payment_id ) {
279
-					give_delete_donation( $payment_id );
278
+				foreach ($payments_array as $payment_id) {
279
+					give_delete_donation($payment_id);
280 280
 				}
281 281
 			} else {
282 282
 
283 283
 				// Just set the donations to customer_id of 0.
284
-				foreach ( $payments_array as $payment_id ) {
285
-					give_update_payment_meta( $payment_id, '_give_payment_donor_id', 0 );
284
+				foreach ($payments_array as $payment_id) {
285
+					give_update_payment_meta($payment_id, '_give_payment_donor_id', 0);
286 286
 				}
287 287
 			}
288 288
 
289
-			$redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors&give-messages[]=donor-deleted' );
289
+			$redirect = admin_url('edit.php?post_type=give_forms&page=give-donors&give-messages[]=donor-deleted');
290 290
 
291 291
 		} else {
292 292
 
293
-			give_set_error( 'give-donor-delete-failed', __( 'Error deleting donor.', 'give' ) );
294
-			$redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=delete&id=' . $donor_id );
293
+			give_set_error('give-donor-delete-failed', __('Error deleting donor.', 'give'));
294
+			$redirect = admin_url('edit.php?post_type=give_forms&page=give-donors&view=delete&id='.$donor_id);
295 295
 
296 296
 		}
297 297
 	} else {
298 298
 
299
-		give_set_error( 'give-donor-delete-invalid-id', __( 'Invalid Donor ID.', 'give' ) );
300
-		$redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors' );
299
+		give_set_error('give-donor-delete-invalid-id', __('Invalid Donor ID.', 'give'));
300
+		$redirect = admin_url('edit.php?post_type=give_forms&page=give-donors');
301 301
 
302 302
 	}
303 303
 
304
-	wp_redirect( $redirect );
304
+	wp_redirect($redirect);
305 305
 	exit;
306 306
 
307 307
 }
308 308
 
309
-add_action( 'give_delete-donor', 'give_donor_delete', 10, 1 );
309
+add_action('give_delete-donor', 'give_donor_delete', 10, 1);
310 310
 
311 311
 /**
312 312
  * Disconnect a user ID from a donor
@@ -317,17 +317,17 @@  discard block
 block discarded – undo
317 317
  *
318 318
  * @return bool|array If the disconnect was successful.
319 319
  */
320
-function give_disconnect_donor_user_id( $args ) {
320
+function give_disconnect_donor_user_id($args) {
321 321
 
322
-	$donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' );
322
+	$donor_edit_role = apply_filters('give_edit_donors_role', 'edit_give_payments');
323 323
 
324
-	if ( ! is_admin() || ! current_user_can( $donor_edit_role ) ) {
325
-		wp_die( __( 'You do not have permission to edit this donor.', 'give' ), __( 'Error', 'give' ), array(
324
+	if ( ! is_admin() || ! current_user_can($donor_edit_role)) {
325
+		wp_die(__('You do not have permission to edit this donor.', 'give'), __('Error', 'give'), array(
326 326
 			'response' => 403,
327
-		) );
327
+		));
328 328
 	}
329 329
 
330
-	if ( empty( $args ) ) {
330
+	if (empty($args)) {
331 331
 		return false;
332 332
 	}
333 333
 
@@ -335,14 +335,14 @@  discard block
 block discarded – undo
335 335
 
336 336
 	$nonce = $args['_wpnonce'];
337 337
 
338
-	if ( ! wp_verify_nonce( $nonce, 'edit-donor' ) ) {
339
-		wp_die( __( 'Cheatin&#8217; uh?', 'give' ), __( 'Error', 'give' ), array(
338
+	if ( ! wp_verify_nonce($nonce, 'edit-donor')) {
339
+		wp_die(__('Cheatin&#8217; uh?', 'give'), __('Error', 'give'), array(
340 340
 			'response' => 400,
341
-		) );
341
+		));
342 342
 	}
343 343
 
344
-	$donor = new Give_Donor( $donor_id );
345
-	if ( empty( $donor->id ) ) {
344
+	$donor = new Give_Donor($donor_id);
345
+	if (empty($donor->id)) {
346 346
 		return false;
347 347
 	}
348 348
 
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
 	 *
357 357
 	 * @since 1.0
358 358
 	 */
359
-	do_action( 'give_pre_donor_disconnect_user_id', $donor_id, $user_id );
359
+	do_action('give_pre_donor_disconnect_user_id', $donor_id, $user_id);
360 360
 
361 361
 	$output     = array();
362 362
 	$donor_args = array(
@@ -365,19 +365,19 @@  discard block
 block discarded – undo
365 365
 
366 366
 
367 367
 	$output['success'] = true;
368
-	if ( ! $donor->update( $donor_args ) ) {
369
-		update_user_meta( $user_id, '_give_is_donor_disconnected', true );
370
-		update_user_meta( $user_id, '_give_disconnected_donor_id', $donor->id );
371
-		$donor->update_meta( '_give_disconnected_user_id', $user_id );
368
+	if ( ! $donor->update($donor_args)) {
369
+		update_user_meta($user_id, '_give_is_donor_disconnected', true);
370
+		update_user_meta($user_id, '_give_disconnected_donor_id', $donor->id);
371
+		$donor->update_meta('_give_disconnected_user_id', $user_id);
372 372
 
373 373
 		$output['success'] = true;
374 374
 
375 375
 	} else {
376 376
 		$output['success'] = false;
377
-		give_set_error( 'give-disconnect-user-fail', __( 'Failed to disconnect user from donor.', 'give' ) );
377
+		give_set_error('give-disconnect-user-fail', __('Failed to disconnect user from donor.', 'give'));
378 378
 	}
379 379
 
380
-	$output['redirect'] = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' ) . $donor_id;
380
+	$output['redirect'] = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id=').$donor_id;
381 381
 
382 382
 	/**
383 383
 	 * Fires after disconnecting user ID from a donor.
@@ -386,11 +386,11 @@  discard block
 block discarded – undo
386 386
 	 *
387 387
 	 * @since 1.0
388 388
 	 */
389
-	do_action( 'give_post_donor_disconnect_user_id', $donor_id );
389
+	do_action('give_post_donor_disconnect_user_id', $donor_id);
390 390
 
391
-	if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
392
-		header( 'Content-Type: application/json' );
393
-		echo json_encode( $output );
391
+	if (defined('DOING_AJAX') && DOING_AJAX) {
392
+		header('Content-Type: application/json');
393
+		echo json_encode($output);
394 394
 		wp_die();
395 395
 	}
396 396
 
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
 
399 399
 }
400 400
 
401
-add_action( 'give_disconnect-userid', 'give_disconnect_donor_user_id', 10, 1 );
401
+add_action('give_disconnect-userid', 'give_disconnect_donor_user_id', 10, 1);
402 402
 
403 403
 /**
404 404
  * Add an email address to the donor from within the admin and log a donor note.
@@ -409,86 +409,86 @@  discard block
 block discarded – undo
409 409
  *
410 410
  * @return mixed If DOING_AJAX echos out JSON, otherwise returns array of success (bool) and message (string).
411 411
  */
412
-function give_add_donor_email( $args ) {
412
+function give_add_donor_email($args) {
413 413
 
414 414
 	$donor_id = '';
415
-	$donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' );
415
+	$donor_edit_role = apply_filters('give_edit_donors_role', 'edit_give_payments');
416 416
 
417
-	if ( ! is_admin() || ! current_user_can( $donor_edit_role ) ) {
418
-		wp_die( __( 'You do not have permission to edit this donor.', 'give' ), __( 'Error', 'give' ), array(
417
+	if ( ! is_admin() || ! current_user_can($donor_edit_role)) {
418
+		wp_die(__('You do not have permission to edit this donor.', 'give'), __('Error', 'give'), array(
419 419
 			'response' => 403,
420
-		) );
420
+		));
421 421
 	}
422 422
 
423 423
 	$output = array();
424
-	if ( empty( $args ) || empty( $args['email'] ) || empty( $args['customer_id'] ) ) {
424
+	if (empty($args) || empty($args['email']) || empty($args['customer_id'])) {
425 425
 		$output['success'] = false;
426
-		if ( empty( $args['email'] ) ) {
427
-			$output['message'] = __( 'Email address is required.', 'give' );
428
-		} elseif ( empty( $args['customer_id'] ) ) {
429
-			$output['message'] = __( 'Donor ID is required.', 'give' );
426
+		if (empty($args['email'])) {
427
+			$output['message'] = __('Email address is required.', 'give');
428
+		} elseif (empty($args['customer_id'])) {
429
+			$output['message'] = __('Donor ID is required.', 'give');
430 430
 		} else {
431
-			$output['message'] = __( 'An error has occurred. Please try again.', 'give' );
431
+			$output['message'] = __('An error has occurred. Please try again.', 'give');
432 432
 		}
433
-	} elseif ( ! wp_verify_nonce( $args['_wpnonce'], 'give_add_donor_email' ) ) {
433
+	} elseif ( ! wp_verify_nonce($args['_wpnonce'], 'give_add_donor_email')) {
434 434
 		$output = array(
435 435
 			'success' => false,
436
-			'message' => __( 'Nonce verification failed.', 'give' ),
436
+			'message' => __('Nonce verification failed.', 'give'),
437 437
 		);
438
-	} elseif ( ! is_email( $args['email'] ) ) {
438
+	} elseif ( ! is_email($args['email'])) {
439 439
 		$output = array(
440 440
 			'success' => false,
441
-			'message' => __( 'Invalid email.', 'give' ),
441
+			'message' => __('Invalid email.', 'give'),
442 442
 		);
443 443
 	} else {
444
-		$email    = sanitize_email( $args['email'] );
444
+		$email    = sanitize_email($args['email']);
445 445
 		$donor_id = (int) $args['customer_id'];
446 446
 		$primary  = 'true' === $args['primary'] ? true : false;
447
-		$donor    = new Give_Donor( $donor_id );
448
-		if ( false === $donor->add_email( $email, $primary ) ) {
449
-			if ( in_array( $email, $donor->emails ) ) {
447
+		$donor    = new Give_Donor($donor_id);
448
+		if (false === $donor->add_email($email, $primary)) {
449
+			if (in_array($email, $donor->emails)) {
450 450
 				$output = array(
451 451
 					'success' => false,
452
-					'message' => __( 'Email already associated with this donor.', 'give' ),
452
+					'message' => __('Email already associated with this donor.', 'give'),
453 453
 				);
454 454
 			} else {
455 455
 				$output = array(
456 456
 					'success' => false,
457
-					'message' => __( 'Email address is already associated with another donor.', 'give' ),
457
+					'message' => __('Email address is already associated with another donor.', 'give'),
458 458
 				);
459 459
 			}
460 460
 		} else {
461
-			$redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor_id . '&give-messages[]=email-added' );
461
+			$redirect = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor_id.'&give-messages[]=email-added');
462 462
 			$output   = array(
463 463
 				'success'  => true,
464
-				'message'  => __( 'Email successfully added to donor.', 'give' ),
464
+				'message'  => __('Email successfully added to donor.', 'give'),
465 465
 				'redirect' => $redirect,
466 466
 			);
467 467
 
468 468
 			$user       = wp_get_current_user();
469
-			$user_login = ! empty( $user->user_login ) ? $user->user_login : __( 'System', 'give' );
470
-			$donor_note = sprintf( __( 'Email address %1$s added by %2$s', 'give' ), $email, $user_login );
471
-			$donor->add_note( $donor_note );
469
+			$user_login = ! empty($user->user_login) ? $user->user_login : __('System', 'give');
470
+			$donor_note = sprintf(__('Email address %1$s added by %2$s', 'give'), $email, $user_login);
471
+			$donor->add_note($donor_note);
472 472
 
473
-			if ( $primary ) {
474
-				$donor_note = sprintf( __( 'Email address %1$s set as primary by %2$s', 'give' ), $email, $user_login );
475
-				$donor->add_note( $donor_note );
473
+			if ($primary) {
474
+				$donor_note = sprintf(__('Email address %1$s set as primary by %2$s', 'give'), $email, $user_login);
475
+				$donor->add_note($donor_note);
476 476
 			}
477 477
 		}
478 478
 	} // End if().
479 479
 
480
-	do_action( 'give_post_add_donor_email', $donor_id, $args );
480
+	do_action('give_post_add_donor_email', $donor_id, $args);
481 481
 
482
-	if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
483
-		header( 'Content-Type: application/json' );
484
-		echo json_encode( $output );
482
+	if (defined('DOING_AJAX') && DOING_AJAX) {
483
+		header('Content-Type: application/json');
484
+		echo json_encode($output);
485 485
 		wp_die();
486 486
 	}
487 487
 
488 488
 	return $output;
489 489
 }
490 490
 
491
-add_action( 'give_add_donor_email', 'give_add_donor_email', 10, 1 );
491
+add_action('give_add_donor_email', 'give_add_donor_email', 10, 1);
492 492
 
493 493
 
494 494
 /**
@@ -499,39 +499,39 @@  discard block
 block discarded – undo
499 499
  * @return bool|null
500 500
  */
501 501
 function give_remove_donor_email() {
502
-	if ( empty( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) {
502
+	if (empty($_GET['id']) || ! is_numeric($_GET['id'])) {
503 503
 		return false;
504 504
 	}
505
-	if ( empty( $_GET['email'] ) || ! is_email( $_GET['email'] ) ) {
505
+	if (empty($_GET['email']) || ! is_email($_GET['email'])) {
506 506
 		return false;
507 507
 	}
508
-	if ( empty( $_GET['_wpnonce'] ) ) {
508
+	if (empty($_GET['_wpnonce'])) {
509 509
 		return false;
510 510
 	}
511 511
 
512 512
 	$nonce = $_GET['_wpnonce'];
513
-	if ( ! wp_verify_nonce( $nonce, 'give-remove-donor-email' ) ) {
514
-		wp_die( __( 'Nonce verification failed', 'give' ), __( 'Error', 'give' ), array(
513
+	if ( ! wp_verify_nonce($nonce, 'give-remove-donor-email')) {
514
+		wp_die(__('Nonce verification failed', 'give'), __('Error', 'give'), array(
515 515
 			'response' => 403,
516
-		) );
516
+		));
517 517
 	}
518 518
 
519
-	$donor = new Give_Donor( $_GET['id'] );
520
-	if ( $donor->remove_email( $_GET['email'] ) ) {
521
-		$url        = add_query_arg( 'give-messages[]', 'email-removed', admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ) );
519
+	$donor = new Give_Donor($_GET['id']);
520
+	if ($donor->remove_email($_GET['email'])) {
521
+		$url        = add_query_arg('give-messages[]', 'email-removed', admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id));
522 522
 		$user       = wp_get_current_user();
523
-		$user_login = ! empty( $user->user_login ) ? $user->user_login : __( 'System', 'give' );
524
-		$donor_note = sprintf( __( 'Email address %1$s removed by %2$s', 'give' ), $_GET['email'], $user_login );
525
-		$donor->add_note( $donor_note );
523
+		$user_login = ! empty($user->user_login) ? $user->user_login : __('System', 'give');
524
+		$donor_note = sprintf(__('Email address %1$s removed by %2$s', 'give'), $_GET['email'], $user_login);
525
+		$donor->add_note($donor_note);
526 526
 	} else {
527
-		$url = add_query_arg( 'give-messages[]', 'email-remove-failed', admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ) );
527
+		$url = add_query_arg('give-messages[]', 'email-remove-failed', admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id));
528 528
 	}
529 529
 
530
-	wp_safe_redirect( $url );
530
+	wp_safe_redirect($url);
531 531
 	exit;
532 532
 }
533 533
 
534
-add_action( 'give_remove_donor_email', 'give_remove_donor_email', 10 );
534
+add_action('give_remove_donor_email', 'give_remove_donor_email', 10);
535 535
 
536 536
 
537 537
 /**
@@ -543,44 +543,44 @@  discard block
 block discarded – undo
543 543
  * @return bool|null
544 544
  */
545 545
 function give_set_donor_primary_email() {
546
-	if ( empty( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) {
546
+	if (empty($_GET['id']) || ! is_numeric($_GET['id'])) {
547 547
 		return false;
548 548
 	}
549 549
 
550
-	if ( empty( $_GET['email'] ) || ! is_email( $_GET['email'] ) ) {
550
+	if (empty($_GET['email']) || ! is_email($_GET['email'])) {
551 551
 		return false;
552 552
 	}
553 553
 
554
-	if ( empty( $_GET['_wpnonce'] ) ) {
554
+	if (empty($_GET['_wpnonce'])) {
555 555
 		return false;
556 556
 	}
557 557
 
558 558
 	$nonce = $_GET['_wpnonce'];
559 559
 
560
-	if ( ! wp_verify_nonce( $nonce, 'give-set-donor-primary-email' ) ) {
561
-		wp_die( __( 'Nonce verification failed', 'give' ), __( 'Error', 'give' ), array(
560
+	if ( ! wp_verify_nonce($nonce, 'give-set-donor-primary-email')) {
561
+		wp_die(__('Nonce verification failed', 'give'), __('Error', 'give'), array(
562 562
 			'response' => 403,
563
-		) );
563
+		));
564 564
 	}
565 565
 
566
-	$donor = new Give_Donor( $_GET['id'] );
566
+	$donor = new Give_Donor($_GET['id']);
567 567
 
568
-	if ( $donor->set_primary_email( $_GET['email'] ) ) {
569
-		$url        = add_query_arg( 'give-messages[]', 'primary-email-updated', admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ) );
568
+	if ($donor->set_primary_email($_GET['email'])) {
569
+		$url        = add_query_arg('give-messages[]', 'primary-email-updated', admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id));
570 570
 		$user       = wp_get_current_user();
571
-		$user_login = ! empty( $user->user_login ) ? $user->user_login : __( 'System', 'give' );
572
-		$donor_note = sprintf( __( 'Email address %1$s set as primary by %2$s', 'give' ), $_GET['email'], $user_login );
571
+		$user_login = ! empty($user->user_login) ? $user->user_login : __('System', 'give');
572
+		$donor_note = sprintf(__('Email address %1$s set as primary by %2$s', 'give'), $_GET['email'], $user_login);
573 573
 
574
-		$donor->add_note( $donor_note );
574
+		$donor->add_note($donor_note);
575 575
 	} else {
576
-		$url = add_query_arg( 'give-messages[]', 'primary-email-failed', admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ) );
576
+		$url = add_query_arg('give-messages[]', 'primary-email-failed', admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id));
577 577
 	}
578 578
 
579
-	wp_safe_redirect( $url );
579
+	wp_safe_redirect($url);
580 580
 	exit;
581 581
 }
582 582
 
583
-add_action( 'give_set_donor_primary_email', 'give_set_donor_primary_email', 10 );
583
+add_action('give_set_donor_primary_email', 'give_set_donor_primary_email', 10);
584 584
 
585 585
 /**
586 586
  * Delete Donor using Bulk Actions.
@@ -591,57 +591,57 @@  discard block
 block discarded – undo
591 591
  *
592 592
  * @return void
593 593
  */
594
-function give_delete_donor( $args ) {
594
+function give_delete_donor($args) {
595 595
 
596
-	$donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' );
596
+	$donor_edit_role = apply_filters('give_edit_donors_role', 'edit_give_payments');
597 597
 
598
-	if ( ! is_admin() || ! current_user_can( $donor_edit_role ) ) {
599
-		wp_die( __( 'You do not have permission to delete donors.', 'give' ), __( 'Error', 'give' ), array(
598
+	if ( ! is_admin() || ! current_user_can($donor_edit_role)) {
599
+		wp_die(__('You do not have permission to delete donors.', 'give'), __('Error', 'give'), array(
600 600
 			'response' => 403,
601
-		) );
601
+		));
602 602
 	}
603 603
 
604 604
 	$give_args            = array();
605
-	$donor_ids            = ( ! empty( $_GET['donor'] ) && is_array( $_GET['donor'] ) && count( $_GET['donor'] ) > 0 ) ? $_GET['donor'] : array();
606
-	$delete_donor         = ! empty( $_GET['give-delete-donor-confirm'] ) ? $_GET['give-delete-donor-confirm'] : '';
607
-	$delete_donations     = ! empty( $_GET['give-delete-donor-records'] ) ? $_GET['give-delete-donor-records'] : '';
608
-	$search_keyword       = ! empty( $_GET['s'] ) ? $_GET['s'] : '';
609
-	$give_args['orderby'] = ! empty( $_GET['orderby'] ) ? $_GET['orderby'] : 'id';
610
-	$give_args['order']   = ! empty( $_GET['order'] ) ? $_GET['order'] : 'desc';
605
+	$donor_ids            = ( ! empty($_GET['donor']) && is_array($_GET['donor']) && count($_GET['donor']) > 0) ? $_GET['donor'] : array();
606
+	$delete_donor         = ! empty($_GET['give-delete-donor-confirm']) ? $_GET['give-delete-donor-confirm'] : '';
607
+	$delete_donations     = ! empty($_GET['give-delete-donor-records']) ? $_GET['give-delete-donor-records'] : '';
608
+	$search_keyword       = ! empty($_GET['s']) ? $_GET['s'] : '';
609
+	$give_args['orderby'] = ! empty($_GET['orderby']) ? $_GET['orderby'] : 'id';
610
+	$give_args['order']   = ! empty($_GET['order']) ? $_GET['order'] : 'desc';
611 611
 	$nonce                = $args['_wpnonce'];
612 612
 
613 613
 	// Verify Nonce for deleting bulk donors.
614
-	if ( ! wp_verify_nonce( $nonce, 'bulk-donors' ) ) {
615
-		wp_die( __( 'Cheatin&#8217; uh?', 'give' ), __( 'Error', 'give' ), array(
614
+	if ( ! wp_verify_nonce($nonce, 'bulk-donors')) {
615
+		wp_die(__('Cheatin&#8217; uh?', 'give'), __('Error', 'give'), array(
616 616
 			'response' => 400,
617
-		) );
617
+		));
618 618
 	}
619 619
 
620
-	if( count( $donor_ids ) > 0 ) {
621
-		foreach ( $donor_ids as $donor_id ) {
622
-			$donor = new Give_Donor( $donor_id );
620
+	if (count($donor_ids) > 0) {
621
+		foreach ($donor_ids as $donor_id) {
622
+			$donor = new Give_Donor($donor_id);
623 623
 
624
-			if ( $donor->id > 0 ) {
624
+			if ($donor->id > 0) {
625 625
 
626
-				if( $delete_donor ) {
627
-					$donor_deleted = Give()->donors->delete( $donor->id );
626
+				if ($delete_donor) {
627
+					$donor_deleted = Give()->donors->delete($donor->id);
628 628
 
629
-					if ( $donor_deleted ) {
630
-						$donation_ids  = explode( ',', $donor->payment_ids );
629
+					if ($donor_deleted) {
630
+						$donation_ids = explode(',', $donor->payment_ids);
631 631
 
632
-						if( $delete_donations ) {
632
+						if ($delete_donations) {
633 633
 
634 634
 							// Remove all donations, logs, etc.
635
-							foreach ( $donation_ids as $donation_id ) {
636
-								give_delete_donation( $donation_id );
635
+							foreach ($donation_ids as $donation_id) {
636
+								give_delete_donation($donation_id);
637 637
 							}
638 638
 
639 639
 							$give_args['give-messages[]'] = 'donor-donations-deleted';
640 640
 						} else {
641 641
 
642 642
 							// Just set the donations to customer_id of 0.
643
-							foreach ( $donation_ids as $donation_id ) {
644
-								give_update_payment_meta( $donation_id, '_give_payment_customer_id', 0 );
643
+							foreach ($donation_ids as $donation_id) {
644
+								give_update_payment_meta($donation_id, '_give_payment_customer_id', 0);
645 645
 							}
646 646
 
647 647
 							$give_args['give-messages[]'] = 'donor-deleted';
@@ -658,13 +658,13 @@  discard block
 block discarded – undo
658 658
 		}
659 659
 
660 660
 		// Add Search Keyword on redirection, if it exists.
661
-		if ( ! empty( $search_keyword ) ) {
661
+		if ( ! empty($search_keyword)) {
662 662
 			$give_args['s'] = $search_keyword;
663 663
 		}
664 664
 
665
-		wp_redirect( add_query_arg( $give_args, admin_url( 'edit.php?post_type=give_forms&page=give-donors' ) ) );
665
+		wp_redirect(add_query_arg($give_args, admin_url('edit.php?post_type=give_forms&page=give-donors')));
666 666
 		give_die();
667 667
 	}
668 668
 }
669 669
 
670
-add_action( 'give_delete_donor', 'give_delete_donor' );
671 670
\ No newline at end of file
671
+add_action('give_delete_donor', 'give_delete_donor');
672 672
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/admin-actions.php 1 patch
Spacing   +296 added lines, -302 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,19 +20,19 @@  discard block
 block discarded – undo
20 20
  * @since 1.8
21 21
  */
22 22
 function give_load_wp_editor() {
23
-	if ( ! isset( $_POST['wp_editor'] ) ) {
23
+	if ( ! isset($_POST['wp_editor'])) {
24 24
 		die();
25 25
 	}
26 26
 
27
-	$wp_editor                     = json_decode( base64_decode( $_POST['wp_editor'] ), true );
27
+	$wp_editor                     = json_decode(base64_decode($_POST['wp_editor']), true);
28 28
 	$wp_editor[2]['textarea_name'] = $_POST['textarea_name'];
29 29
 
30
-	wp_editor( $wp_editor[0], $_POST['wp_editor_id'], $wp_editor[2] );
30
+	wp_editor($wp_editor[0], $_POST['wp_editor_id'], $wp_editor[2]);
31 31
 
32 32
 	die();
33 33
 }
34 34
 
35
-add_action( 'wp_ajax_give_load_wp_editor', 'give_load_wp_editor' );
35
+add_action('wp_ajax_give_load_wp_editor', 'give_load_wp_editor');
36 36
 
37 37
 
38 38
 /**
@@ -52,13 +52,13 @@  discard block
 block discarded – undo
52 52
 	);
53 53
 
54 54
 	// Get current page.
55
-	$current_page = isset( $_GET['page'] ) ? esc_attr( $_GET['page'] ) : '';
55
+	$current_page = isset($_GET['page']) ? esc_attr($_GET['page']) : '';
56 56
 
57 57
 	// Bailout.
58 58
 	if (
59
-		empty( $current_page )
60
-		|| empty( $_GET['_wp_http_referer'] )
61
-		|| ! in_array( $current_page, $give_pages )
59
+		empty($current_page)
60
+		|| empty($_GET['_wp_http_referer'])
61
+		|| ! in_array($current_page, $give_pages)
62 62
 	) {
63 63
 		return false;
64 64
 	}
@@ -68,21 +68,21 @@  discard block
 block discarded – undo
68 68
 	 *
69 69
 	 * @since 1.8
70 70
 	 */
71
-	$redirect = apply_filters( "give_validate_{$current_page}", true );
71
+	$redirect = apply_filters("give_validate_{$current_page}", true);
72 72
 
73
-	if ( $redirect ) {
73
+	if ($redirect) {
74 74
 		// Redirect.
75 75
 		wp_redirect(
76 76
 			remove_query_arg(
77
-				array( '_wp_http_referer', '_wpnonce' ),
78
-				wp_unslash( $_SERVER['REQUEST_URI'] )
77
+				array('_wp_http_referer', '_wpnonce'),
78
+				wp_unslash($_SERVER['REQUEST_URI'])
79 79
 			)
80 80
 		);
81 81
 		exit;
82 82
 	}
83 83
 }
84 84
 
85
-add_action( 'admin_init', 'give_redirect_to_clean_url_admin_pages' );
85
+add_action('admin_init', 'give_redirect_to_clean_url_admin_pages');
86 86
 
87 87
 
88 88
 /**
@@ -96,25 +96,25 @@  discard block
 block discarded – undo
96 96
  */
97 97
 function give_hide_outdated_php_notice() {
98 98
 
99
-	if ( ! isset( $_POST['_give_hide_outdated_php_notices_shortly'] ) ) {
99
+	if ( ! isset($_POST['_give_hide_outdated_php_notices_shortly'])) {
100 100
 		give_die();
101 101
 	}
102 102
 
103 103
 	// Transient key name.
104 104
 	$transient_key = '_give_hide_outdated_php_notices_shortly';
105 105
 
106
-	if ( Give_Cache::get( $transient_key, true ) ) {
106
+	if (Give_Cache::get($transient_key, true)) {
107 107
 		return;
108 108
 	}
109 109
 
110 110
 	// Hide notice for 24 hours.
111
-	Give_Cache::set( $transient_key, true, DAY_IN_SECONDS, true );
111
+	Give_Cache::set($transient_key, true, DAY_IN_SECONDS, true);
112 112
 
113 113
 	give_die();
114 114
 
115 115
 }
116 116
 
117
-add_action( 'wp_ajax_give_hide_outdated_php_notice', 'give_hide_outdated_php_notice' );
117
+add_action('wp_ajax_give_hide_outdated_php_notice', 'give_hide_outdated_php_notice');
118 118
 
119 119
 /**
120 120
  * Register admin notices.
@@ -123,27 +123,27 @@  discard block
 block discarded – undo
123 123
  */
124 124
 function _give_register_admin_notices() {
125 125
 	// Bailout.
126
-	if ( ! is_admin() ) {
126
+	if ( ! is_admin()) {
127 127
 		return;
128 128
 	}
129 129
 
130 130
 	// Bulk action notices.
131 131
 	if (
132
-		isset( $_GET['action'] ) &&
133
-		! empty( $_GET['action'] )
132
+		isset($_GET['action']) &&
133
+		! empty($_GET['action'])
134 134
 	) {
135 135
 
136 136
 		// Add payment bulk notice.
137 137
 		if (
138
-			current_user_can( 'edit_give_payments' ) &&
139
-			isset( $_GET['payment'] ) &&
140
-			! empty( $_GET['payment'] )
138
+			current_user_can('edit_give_payments') &&
139
+			isset($_GET['payment']) &&
140
+			! empty($_GET['payment'])
141 141
 		) {
142
-			$payment_count = isset( $_GET['payment'] ) ? count( $_GET['payment'] ) : 0;
142
+			$payment_count = isset($_GET['payment']) ? count($_GET['payment']) : 0;
143 143
 
144
-			switch ( $_GET['action'] ) {
144
+			switch ($_GET['action']) {
145 145
 				case 'delete':
146
-					Give()->notices->register_notice( array(
146
+					Give()->notices->register_notice(array(
147 147
 						'id'          => 'bulk_action_delete',
148 148
 						'type'        => 'updated',
149 149
 						'description' => sprintf(
@@ -155,12 +155,12 @@  discard block
 block discarded – undo
155 155
 							),
156 156
 							$payment_count ),
157 157
 						'show'        => true,
158
-					) );
158
+					));
159 159
 
160 160
 					break;
161 161
 
162 162
 				case 'resend-receipt':
163
-					Give()->notices->register_notice( array(
163
+					Give()->notices->register_notice(array(
164 164
 						'id'          => 'bulk_action_resend_receipt',
165 165
 						'type'        => 'updated',
166 166
 						'description' => sprintf(
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 							$payment_count
174 174
 						),
175 175
 						'show'        => true,
176
-					) );
176
+					));
177 177
 					break;
178 178
 
179 179
 				case 'set-status-publish' :
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 				case 'set-status-cancelled' :
186 186
 				case 'set-status-abandoned' :
187 187
 				case 'set-status-preapproval' :
188
-					Give()->notices->register_notice( array(
188
+					Give()->notices->register_notice(array(
189 189
 						'id'          => 'bulk_action_status_change',
190 190
 						'type'        => 'updated',
191 191
 						'description' => _n(
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 							'give'
196 196
 						),
197 197
 						'show'        => true,
198
-					) );
198
+					));
199 199
 					break;
200 200
 			}// End switch().
201 201
 		}// End if().
@@ -203,239 +203,239 @@  discard block
 block discarded – undo
203 203
 
204 204
 	// Add give message notices.
205 205
 	$message_notices = give_get_admin_messages_key();
206
-	if ( ! empty( $message_notices ) ) {
207
-		foreach ( $message_notices as $message_notice ) {
206
+	if ( ! empty($message_notices)) {
207
+		foreach ($message_notices as $message_notice) {
208 208
 			// Donation reports errors.
209
-			if ( current_user_can( 'view_give_reports' ) ) {
210
-				switch ( $message_notice ) {
209
+			if (current_user_can('view_give_reports')) {
210
+				switch ($message_notice) {
211 211
 					case 'donation-deleted' :
212
-						Give()->notices->register_notice( array(
212
+						Give()->notices->register_notice(array(
213 213
 							'id'          => 'give-donation-deleted',
214 214
 							'type'        => 'updated',
215
-							'description' => __( 'The donation has been deleted.', 'give' ),
215
+							'description' => __('The donation has been deleted.', 'give'),
216 216
 							'show'        => true,
217
-						) );
217
+						));
218 218
 						break;
219 219
 					case 'email-sent' :
220
-						Give()->notices->register_notice( array(
220
+						Give()->notices->register_notice(array(
221 221
 							'id'          => 'give-email-sent',
222 222
 							'type'        => 'updated',
223
-							'description' => __( 'The donation receipt has been resent.', 'give' ),
223
+							'description' => __('The donation receipt has been resent.', 'give'),
224 224
 							'show'        => true,
225
-						) );
225
+						));
226 226
 						break;
227 227
 					case 'refreshed-reports' :
228
-						Give()->notices->register_notice( array(
228
+						Give()->notices->register_notice(array(
229 229
 							'id'          => 'give-refreshed-reports',
230 230
 							'type'        => 'updated',
231
-							'description' => __( 'The reports cache has been cleared.', 'give' ),
231
+							'description' => __('The reports cache has been cleared.', 'give'),
232 232
 							'show'        => true,
233
-						) );
233
+						));
234 234
 						break;
235 235
 					case 'donation-note-deleted' :
236
-						Give()->notices->register_notice( array(
236
+						Give()->notices->register_notice(array(
237 237
 							'id'          => 'give-donation-note-deleted',
238 238
 							'type'        => 'updated',
239
-							'description' => __( 'The donation note has been deleted.', 'give' ),
239
+							'description' => __('The donation note has been deleted.', 'give'),
240 240
 							'show'        => true,
241
-						) );
241
+						));
242 242
 						break;
243 243
 				}// End switch().
244 244
 			}// End if().
245 245
 
246 246
 			// Give settings notices and errors.
247
-			if ( current_user_can( 'manage_give_settings' ) ) {
248
-				switch ( $message_notice ) {
247
+			if (current_user_can('manage_give_settings')) {
248
+				switch ($message_notice) {
249 249
 					case 'settings-imported' :
250
-						Give()->notices->register_notice( array(
250
+						Give()->notices->register_notice(array(
251 251
 							'id'          => 'give-settings-imported',
252 252
 							'type'        => 'updated',
253
-							'description' => __( 'The settings have been imported.', 'give' ),
253
+							'description' => __('The settings have been imported.', 'give'),
254 254
 							'show'        => true,
255
-						) );
255
+						));
256 256
 						break;
257 257
 					case 'api-key-generated' :
258
-						Give()->notices->register_notice( array(
258
+						Give()->notices->register_notice(array(
259 259
 							'id'          => 'give-api-key-generated',
260 260
 							'type'        => 'updated',
261
-							'description' => __( 'API keys have been generated.', 'give' ),
261
+							'description' => __('API keys have been generated.', 'give'),
262 262
 							'show'        => true,
263
-						) );
263
+						));
264 264
 						break;
265 265
 					case 'api-key-exists' :
266
-						Give()->notices->register_notice( array(
266
+						Give()->notices->register_notice(array(
267 267
 							'id'          => 'give-api-key-exists',
268 268
 							'type'        => 'updated',
269
-							'description' => __( 'The specified user already has API keys.', 'give' ),
269
+							'description' => __('The specified user already has API keys.', 'give'),
270 270
 							'show'        => true,
271
-						) );
271
+						));
272 272
 						break;
273 273
 					case 'api-key-regenerated' :
274
-						Give()->notices->register_notice( array(
274
+						Give()->notices->register_notice(array(
275 275
 							'id'          => 'give-api-key-regenerated',
276 276
 							'type'        => 'updated',
277
-							'description' => __( 'API keys have been regenerated.', 'give' ),
277
+							'description' => __('API keys have been regenerated.', 'give'),
278 278
 							'show'        => true,
279
-						) );
279
+						));
280 280
 						break;
281 281
 					case 'api-key-revoked' :
282
-						Give()->notices->register_notice( array(
282
+						Give()->notices->register_notice(array(
283 283
 							'id'          => 'give-api-key-revoked',
284 284
 							'type'        => 'updated',
285
-							'description' => __( 'API keys have been revoked.', 'give' ),
285
+							'description' => __('API keys have been revoked.', 'give'),
286 286
 							'show'        => true,
287
-						) );
287
+						));
288 288
 						break;
289 289
 					case 'sent-test-email' :
290
-						Give()->notices->register_notice( array(
290
+						Give()->notices->register_notice(array(
291 291
 							'id'          => 'give-sent-test-email',
292 292
 							'type'        => 'updated',
293
-							'description' => __( 'The test email has been sent.', 'give' ),
293
+							'description' => __('The test email has been sent.', 'give'),
294 294
 							'show'        => true,
295
-						) );
295
+						));
296 296
 						break;
297 297
 					case 'matched-success-failure-page':
298
-						Give()->notices->register_notice( array(
298
+						Give()->notices->register_notice(array(
299 299
 							'id'          => 'give-matched-success-failure-page',
300 300
 							'type'        => 'updated',
301
-							'description' => __( 'You cannot set the success and failed pages to the same page', 'give' ),
301
+							'description' => __('You cannot set the success and failed pages to the same page', 'give'),
302 302
 							'show'        => true,
303
-						) );
303
+						));
304 304
 						break;
305 305
 				}// End switch().
306 306
 			}// End if().
307 307
 
308 308
 			// Payments errors.
309
-			if ( current_user_can( 'edit_give_payments' ) ) {
310
-				switch ( $message_notice ) {
309
+			if (current_user_can('edit_give_payments')) {
310
+				switch ($message_notice) {
311 311
 					case 'note-added' :
312
-						Give()->notices->register_notice( array(
312
+						Give()->notices->register_notice(array(
313 313
 							'id'          => 'give-note-added',
314 314
 							'type'        => 'updated',
315
-							'description' => __( 'The donation note has been added.', 'give' ),
315
+							'description' => __('The donation note has been added.', 'give'),
316 316
 							'show'        => true,
317
-						) );
317
+						));
318 318
 						break;
319 319
 					case 'payment-updated' :
320
-						Give()->notices->register_notice( array(
320
+						Give()->notices->register_notice(array(
321 321
 							'id'          => 'give-payment-updated',
322 322
 							'type'        => 'updated',
323
-							'description' => __( 'The donation has been updated.', 'give' ),
323
+							'description' => __('The donation has been updated.', 'give'),
324 324
 							'show'        => true,
325
-						) );
325
+						));
326 326
 						break;
327 327
 				}// End switch().
328 328
 			}// End if().
329 329
 
330 330
 			// Donor Notices.
331
-			if ( current_user_can( 'edit_give_payments' ) ) {
332
-				switch ( $message_notice ) {
331
+			if (current_user_can('edit_give_payments')) {
332
+				switch ($message_notice) {
333 333
 					case 'donor-deleted' :
334
-						Give()->notices->register_notice( array(
334
+						Give()->notices->register_notice(array(
335 335
 							'id'          => 'give-donor-deleted',
336 336
 							'type'        => 'updated',
337
-							'description' => __( 'The selected donor(s) has been deleted.', 'give' ),
337
+							'description' => __('The selected donor(s) has been deleted.', 'give'),
338 338
 							'show'        => true,
339
-						) );
339
+						));
340 340
 						break;
341 341
 
342 342
 					case 'donor-donations-deleted' :
343
-						Give()->notices->register_notice( array(
343
+						Give()->notices->register_notice(array(
344 344
 							'id'          => 'give-donor-donations-deleted',
345 345
 							'type'        => 'updated',
346
-							'description' => __( 'The selected donor(s) and the associated donation(s) has been deleted.', 'give' ),
346
+							'description' => __('The selected donor(s) and the associated donation(s) has been deleted.', 'give'),
347 347
 							'show'        => true,
348
-						) );
348
+						));
349 349
 						break;
350 350
 
351 351
 					case 'confirm-delete-donor' :
352
-						Give()->notices->register_notice( array(
352
+						Give()->notices->register_notice(array(
353 353
 							'id'          => 'give-confirm-delete-donor',
354 354
 							'type'        => 'updated',
355
-							'description' => __( 'You must confirm to delete the selected donor(s).', 'give' ),
355
+							'description' => __('You must confirm to delete the selected donor(s).', 'give'),
356 356
 							'show'        => true,
357
-						) );
357
+						));
358 358
 						break;
359 359
 
360 360
 					case 'invalid-donor-id' :
361
-						Give()->notices->register_notice( array(
361
+						Give()->notices->register_notice(array(
362 362
 							'id'          => 'give-invalid-donor-id',
363 363
 							'type'        => 'updated',
364
-							'description' => __( 'Invalid Donor ID.', 'give' ),
364
+							'description' => __('Invalid Donor ID.', 'give'),
365 365
 							'show'        => true,
366
-						) );
366
+						));
367 367
 						break;
368 368
 
369 369
 					case 'donor-delete-failed' :
370
-						Give()->notices->register_notice( array(
370
+						Give()->notices->register_notice(array(
371 371
 							'id'          => 'give-donor-delete-failed',
372 372
 							'type'        => 'error',
373
-							'description' => __( 'Unable to delete selected donor(s).', 'give' ),
373
+							'description' => __('Unable to delete selected donor(s).', 'give'),
374 374
 							'show'        => true,
375
-						) );
375
+						));
376 376
 						break;
377 377
 
378 378
 					case 'email-added' :
379
-						Give()->notices->register_notice( array(
379
+						Give()->notices->register_notice(array(
380 380
 							'id'          => 'give-email-added',
381 381
 							'type'        => 'updated',
382
-							'description' => __( 'Donor email added.', 'give' ),
382
+							'description' => __('Donor email added.', 'give'),
383 383
 							'show'        => true,
384
-						) );
384
+						));
385 385
 						break;
386 386
 
387 387
 					case 'email-removed' :
388
-						Give()->notices->register_notice( array(
388
+						Give()->notices->register_notice(array(
389 389
 							'id'          => 'give-email-removed',
390 390
 							'type'        => 'updated',
391
-							'description' => __( 'Donor email removed.', 'give' ),
391
+							'description' => __('Donor email removed.', 'give'),
392 392
 							'show'        => true,
393
-						) );
393
+						));
394 394
 						break;
395 395
 
396 396
 					case 'email-remove-failed' :
397
-						Give()->notices->register_notice( array(
397
+						Give()->notices->register_notice(array(
398 398
 							'id'          => 'give-email-remove-failed',
399 399
 							'type'        => 'updated',
400
-							'description' => __( 'Failed to remove donor email.', 'give' ),
400
+							'description' => __('Failed to remove donor email.', 'give'),
401 401
 							'show'        => true,
402
-						) );
402
+						));
403 403
 						break;
404 404
 
405 405
 					case 'primary-email-updated' :
406
-						Give()->notices->register_notice( array(
406
+						Give()->notices->register_notice(array(
407 407
 							'id'          => 'give-primary-email-updated',
408 408
 							'type'        => 'updated',
409
-							'description' => __( 'Primary email updated for donor.', 'give' ),
409
+							'description' => __('Primary email updated for donor.', 'give'),
410 410
 							'show'        => true,
411
-						) );
411
+						));
412 412
 						break;
413 413
 
414 414
 					case 'primary-email-failed' :
415
-						Give()->notices->register_notice( array(
415
+						Give()->notices->register_notice(array(
416 416
 							'id'          => 'give-primary-email-failed',
417 417
 							'type'        => 'updated',
418
-							'description' => __( 'Failed to set primary email.', 'give' ),
418
+							'description' => __('Failed to set primary email.', 'give'),
419 419
 							'show'        => true,
420
-						) );
420
+						));
421 421
 						break;
422 422
 
423 423
 					case 'reconnect-user' :
424
-						Give()->notices->register_notice( array(
424
+						Give()->notices->register_notice(array(
425 425
 							'id'          => 'give-reconnect-user',
426 426
 							'type'        => 'updated',
427
-							'description' => __( 'User has been successfully connected with Donor.', 'give' ),
427
+							'description' => __('User has been successfully connected with Donor.', 'give'),
428 428
 							'show'        => true,
429
-						) );
429
+						));
430 430
 						break;
431 431
 
432 432
 					case 'profile-updated' :
433
-						Give()->notices->register_notice( array(
433
+						Give()->notices->register_notice(array(
434 434
 							'id'          => 'give-profile-updated',
435 435
 							'type'        => 'updated',
436
-							'description' => __( 'Donor information updated successfully.', 'give' ),
436
+							'description' => __('Donor information updated successfully.', 'give'),
437 437
 							'show'        => true,
438
-						) );
438
+						));
439 439
 						break;
440 440
 				}// End switch().
441 441
 			}// End if().
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
 	}
444 444
 }
445 445
 
446
-add_action( 'admin_notices', '_give_register_admin_notices', - 1 );
446
+add_action('admin_notices', '_give_register_admin_notices', - 1);
447 447
 
448 448
 
449 449
 /**
@@ -453,39 +453,38 @@  discard block
 block discarded – undo
453 453
  *
454 454
  * @return bool
455 455
  */
456
-function _give_show_test_mode_notice_in_admin_bar( $wp_admin_bar ) {
457
-	$is_test_mode = ! empty( $_POST['test_mode'] ) ?
458
-		give_is_setting_enabled( $_POST['test_mode'] ) :
459
-		give_is_test_mode();
456
+function _give_show_test_mode_notice_in_admin_bar($wp_admin_bar) {
457
+	$is_test_mode = ! empty($_POST['test_mode']) ?
458
+		give_is_setting_enabled($_POST['test_mode']) : give_is_test_mode();
460 459
 
461 460
 	if (
462
-		! current_user_can( 'view_give_reports' ) ||
461
+		! current_user_can('view_give_reports') ||
463 462
 		! $is_test_mode
464 463
 	) {
465 464
 		return false;
466 465
 	}
467 466
 
468 467
 	// Add the main site admin menu item.
469
-	$wp_admin_bar->add_menu( array(
468
+	$wp_admin_bar->add_menu(array(
470 469
 		'id'     => 'give-test-notice',
471
-		'href'   => admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=gateways' ),
470
+		'href'   => admin_url('edit.php?post_type=give_forms&page=give-settings&tab=gateways'),
472 471
 		'parent' => 'top-secondary',
473
-		'title'  => __( 'Give Test Mode Active', 'give' ),
472
+		'title'  => __('Give Test Mode Active', 'give'),
474 473
 		'meta'   => array(
475 474
 			'class' => 'give-test-mode-active',
476 475
 		),
477
-	) );
476
+	));
478 477
 
479 478
 	return true;
480 479
 }
481 480
 
482
-add_action( 'admin_bar_menu', '_give_show_test_mode_notice_in_admin_bar', 1000, 1 );
481
+add_action('admin_bar_menu', '_give_show_test_mode_notice_in_admin_bar', 1000, 1);
483 482
 
484 483
 /**
485 484
  * Outputs the Give admin bar CSS.
486 485
  */
487 486
 function _give_test_mode_notice_admin_bar_css() {
488
-	if ( ! give_is_test_mode() ) {
487
+	if ( ! give_is_test_mode()) {
489 488
 		return;
490 489
 	}
491 490
 	?>
@@ -503,7 +502,7 @@  discard block
 block discarded – undo
503 502
 	<?php
504 503
 }
505 504
 
506
-add_action( 'admin_head', '_give_test_mode_notice_admin_bar_css' );
505
+add_action('admin_head', '_give_test_mode_notice_admin_bar_css');
507 506
 
508 507
 
509 508
 /**
@@ -513,12 +512,12 @@  discard block
 block discarded – undo
513 512
  */
514 513
 function give_import_page_link_callback() {
515 514
 	?>
516
-	<a href="<?php echo esc_url( give_import_page_url() ); ?>"
517
-	   class="page-import-action page-title-action"><?php _e( 'Import Donations', 'give' ); ?></a>
515
+	<a href="<?php echo esc_url(give_import_page_url()); ?>"
516
+	   class="page-import-action page-title-action"><?php _e('Import Donations', 'give'); ?></a>
518 517
 
519 518
 	<?php
520 519
 	// Check if view donation single page only.
521
-	if ( ! empty( $_REQUEST['view'] ) && 'view-payment-details' === (string) give_clean( $_REQUEST['view'] ) && 'give-payment-history' === give_clean( $_REQUEST['page'] ) ) {
520
+	if ( ! empty($_REQUEST['view']) && 'view-payment-details' === (string) give_clean($_REQUEST['view']) && 'give-payment-history' === give_clean($_REQUEST['page'])) {
522 521
 		?>
523 522
 		<style type="text/css">
524 523
 			.wrap #transaction-details-heading {
@@ -529,7 +528,7 @@  discard block
 block discarded – undo
529 528
 	}
530 529
 }
531 530
 
532
-add_action( 'give_payments_page_top', 'give_import_page_link_callback', 11 );
531
+add_action('give_payments_page_top', 'give_import_page_link_callback', 11);
533 532
 
534 533
 /**
535 534
  * Load donation import ajax callback
@@ -545,9 +544,9 @@  discard block
 block discarded – undo
545 544
 	Give_Cache::get_instance()->disable();
546 545
 
547 546
 	$import_setting = array();
548
-	$fields         = isset( $_POST['fields'] ) ? $_POST['fields'] : null;
547
+	$fields         = isset($_POST['fields']) ? $_POST['fields'] : null;
549 548
 
550
-	parse_str( $fields );
549
+	parse_str($fields);
551 550
 
552 551
 	$import_setting['create_user'] = $create_user;
553 552
 	$import_setting['mode']        = $mode;
@@ -557,67 +556,67 @@  discard block
 block discarded – undo
557 556
 	$import_setting['dry_run']     = $dry_run;
558 557
 
559 558
 	// Parent key id.
560
-	$main_key = maybe_unserialize( $main_key );
561
-
562
-	$current    = absint( $_REQUEST['current'] );
563
-	$total_ajax = absint( $_REQUEST['total_ajax'] );
564
-	$start      = absint( $_REQUEST['start'] );
565
-	$end        = absint( $_REQUEST['end'] );
566
-	$next       = absint( $_REQUEST['next'] );
567
-	$total      = absint( $_REQUEST['total'] );
568
-	$per_page   = absint( $_REQUEST['per_page'] );
569
-	if ( empty( $delimiter ) ) {
559
+	$main_key = maybe_unserialize($main_key);
560
+
561
+	$current    = absint($_REQUEST['current']);
562
+	$total_ajax = absint($_REQUEST['total_ajax']);
563
+	$start      = absint($_REQUEST['start']);
564
+	$end        = absint($_REQUEST['end']);
565
+	$next       = absint($_REQUEST['next']);
566
+	$total      = absint($_REQUEST['total']);
567
+	$per_page   = absint($_REQUEST['per_page']);
568
+	if (empty($delimiter)) {
570 569
 		$delimiter = ',';
571 570
 	}
572 571
 
573 572
 	// Processing done here.
574
-	$raw_data                  = give_get_donation_data_from_csv( $csv, $start, $end, $delimiter );
575
-	$raw_key                   = maybe_unserialize( $mapto );
573
+	$raw_data                  = give_get_donation_data_from_csv($csv, $start, $end, $delimiter);
574
+	$raw_key                   = maybe_unserialize($mapto);
576 575
 	$import_setting['raw_key'] = $raw_key;
577 576
 
578
-	if ( ! empty( $dry_run ) ) {
579
-		$import_setting['csv_raw_data'] = give_get_donation_data_from_csv( $csv, 1, $end, $delimiter );
577
+	if ( ! empty($dry_run)) {
578
+		$import_setting['csv_raw_data'] = give_get_donation_data_from_csv($csv, 1, $end, $delimiter);
580 579
 
581
-		$import_setting['donors_list'] = Give()->donors->get_donors( array(
582
-			'number' => - 1,
583
-			'fields' => array( 'id', 'user_id', 'email' ),
584
-		) );
580
+		$import_setting['donors_list'] = Give()->donors->get_donors(array(
581
+			'number' => -1,
582
+			'fields' => array('id', 'user_id', 'email'),
583
+		));
585 584
 	}
586 585
 
587 586
 	// Prevent normal emails.
588
-	remove_action( 'give_complete_donation', 'give_trigger_donation_receipt', 999 );
589
-	remove_action( 'give_insert_user', 'give_new_user_notification', 10 );
590
-	remove_action( 'give_insert_payment', 'give_payment_save_page_data' );
587
+	remove_action('give_complete_donation', 'give_trigger_donation_receipt', 999);
588
+	remove_action('give_insert_user', 'give_new_user_notification', 10);
589
+	remove_action('give_insert_payment', 'give_payment_save_page_data');
591 590
 
592 591
 	$current_key = $start;
593
-	foreach ( $raw_data as $row_data ) {
592
+	foreach ($raw_data as $row_data) {
594 593
 		$import_setting['donation_key'] = $current_key;
595
-		give_save_import_donation_to_db( $raw_key, $row_data, $main_key, $import_setting );
596
-		$current_key ++;
594
+		give_save_import_donation_to_db($raw_key, $row_data, $main_key, $import_setting);
595
+		$current_key++;
597 596
 	}
598 597
 
599 598
 	// Check if function exists or not.
600
-	if ( function_exists( 'give_payment_save_page_data' ) ) {
601
-		add_action( 'give_insert_payment', 'give_payment_save_page_data' );
599
+	if (function_exists('give_payment_save_page_data')) {
600
+		add_action('give_insert_payment', 'give_payment_save_page_data');
602 601
 	}
603
-	add_action( 'give_insert_user', 'give_new_user_notification', 10, 2 );
604
-	add_action( 'give_complete_donation', 'give_trigger_donation_receipt', 999 );
602
+	add_action('give_insert_user', 'give_new_user_notification', 10, 2);
603
+	add_action('give_complete_donation', 'give_trigger_donation_receipt', 999);
605 604
 
606
-	if ( $next == false ) {
605
+	if ($next == false) {
607 606
 		$json_data = array(
608 607
 			'success' => true,
609
-			'message' => __( 'All donation uploaded successfully!', 'give' ),
608
+			'message' => __('All donation uploaded successfully!', 'give'),
610 609
 		);
611 610
 	} else {
612 611
 		$index_start = $start;
613 612
 		$index_end   = $end;
614 613
 		$last        = false;
615 614
 		$next        = true;
616
-		if ( $next ) {
615
+		if ($next) {
617 616
 			$index_start = $index_start + $per_page;
618
-			$index_end   = $per_page + ( $index_start - 1 );
617
+			$index_end   = $per_page + ($index_start - 1);
619 618
 		}
620
-		if ( $index_end >= $total ) {
619
+		if ($index_end >= $total) {
621 620
 			$index_end = $total;
622 621
 			$last      = true;
623 622
 		}
@@ -631,31 +630,31 @@  discard block
 block discarded – undo
631 630
 		);
632 631
 	}
633 632
 
634
-	$url              = give_import_page_url( array(
633
+	$url = give_import_page_url(array(
635 634
 		'step'          => '4',
636 635
 		'importer-type' => 'import_donations',
637 636
 		'csv'           => $csv,
638 637
 		'total'         => $total,
639 638
 		'delete_csv'    => $import_setting['delete_csv'],
640
-		'success'       => ( isset( $json_data['success'] ) ? $json_data['success'] : '' ),
639
+		'success'       => (isset($json_data['success']) ? $json_data['success'] : ''),
641 640
 		'dry_run'       => $dry_run,
642
-	) );
641
+	));
643 642
 	$json_data['url'] = $url;
644 643
 
645
-	$current ++;
644
+	$current++;
646 645
 	$json_data['current'] = $current;
647 646
 
648
-	$percentage              = ( 100 / ( $total_ajax + 1 ) ) * $current;
647
+	$percentage              = (100 / ($total_ajax + 1)) * $current;
649 648
 	$json_data['percentage'] = $percentage;
650 649
 
651 650
 	// Enable Give cache
652 651
 	Give_Cache::get_instance()->enable();
653 652
 
654
-	$json_data = apply_filters( 'give_import_ajax_responces', $json_data, $fields );
655
-	wp_die( json_encode( $json_data ) );
653
+	$json_data = apply_filters('give_import_ajax_responces', $json_data, $fields);
654
+	wp_die(json_encode($json_data));
656 655
 }
657 656
 
658
-add_action( 'wp_ajax_give_donation_import', 'give_donation_import_callback' );
657
+add_action('wp_ajax_give_donation_import', 'give_donation_import_callback');
659 658
 
660 659
 /**
661 660
  * Load core settings import ajax callback
@@ -667,8 +666,8 @@  discard block
 block discarded – undo
667 666
  */
668 667
 
669 668
 function give_core_settings_import_callback() {
670
-	$fields = isset( $_POST['fields'] ) ? $_POST['fields'] : null;
671
-	parse_str( $fields, $fields );
669
+	$fields = isset($_POST['fields']) ? $_POST['fields'] : null;
670
+	parse_str($fields, $fields);
672 671
 
673 672
 	$json_data['success'] = false;
674 673
 
@@ -683,22 +682,22 @@  discard block
 block discarded – undo
683 682
 	 *
684 683
 	 * @return array $fields
685 684
 	 */
686
-	$fields = (array) apply_filters( 'give_import_core_settings_fields', $fields );
685
+	$fields = (array) apply_filters('give_import_core_settings_fields', $fields);
687 686
 
688
-	$file_name = ( ! empty( $fields['file_name'] ) ? give_clean( $fields['file_name'] ) : false );
687
+	$file_name = ( ! empty($fields['file_name']) ? give_clean($fields['file_name']) : false);
689 688
 
690
-	if ( ! empty( $file_name ) ) {
691
-		$type = ( ! empty( $fields['type'] ) ? give_clean( $fields['type'] ) : 'merge' );
689
+	if ( ! empty($file_name)) {
690
+		$type = ( ! empty($fields['type']) ? give_clean($fields['type']) : 'merge');
692 691
 
693 692
 		// Get the json data from the file and then alter it in array format
694
-		$json_string   = give_get_core_settings_json( $file_name );
695
-		$json_to_array = json_decode( $json_string, true );
693
+		$json_string   = give_get_core_settings_json($file_name);
694
+		$json_to_array = json_decode($json_string, true);
696 695
 
697 696
 		// get the current settign from the options table.
698
-		$host_give_options = get_option( 'give_settings', array() );
697
+		$host_give_options = get_option('give_settings', array());
699 698
 
700 699
 		// Save old settins for backup.
701
-		update_option( 'give_settings_old', $host_give_options );
700
+		update_option('give_settings_old', $host_give_options);
702 701
 
703 702
 		/**
704 703
 		 * Filter to Modify Core Settings that are being going to get import in options table as give settings.
@@ -714,9 +713,9 @@  discard block
 block discarded – undo
714 713
 		 *
715 714
 		 * @return array $json_to_array Setting that are being going to get imported
716 715
 		 */
717
-		$json_to_array = (array) apply_filters( 'give_import_core_settings_data', $json_to_array, $type, $host_give_options, $fields );
716
+		$json_to_array = (array) apply_filters('give_import_core_settings_data', $json_to_array, $type, $host_give_options, $fields);
718 717
 
719
-		update_option( 'give_settings', $json_to_array );
718
+		update_option('give_settings', $json_to_array);
720 719
 
721 720
 		$json_data['success'] = true;
722 721
 	}
@@ -732,16 +731,16 @@  discard block
 block discarded – undo
732 731
 	 *
733 732
 	 * @return array $url
734 733
 	 */
735
-	$json_data['url'] = give_import_page_url( (array) apply_filters( 'give_import_core_settings_success_url', array(
736
-		'step'          => ( empty( $json_data['success'] ) ? '1' : '3' ),
734
+	$json_data['url'] = give_import_page_url((array) apply_filters('give_import_core_settings_success_url', array(
735
+		'step'          => (empty($json_data['success']) ? '1' : '3'),
737 736
 		'importer-type' => 'import_core_setting',
738
-		'success'       => ( empty( $json_data['success'] ) ? '0' : '1' ),
739
-	) ) );
737
+		'success'       => (empty($json_data['success']) ? '0' : '1'),
738
+	)));
740 739
 
741
-	wp_send_json( $json_data );
740
+	wp_send_json($json_data);
742 741
 }
743 742
 
744
-add_action( 'wp_ajax_give_core_settings_import', 'give_core_settings_import_callback' );
743
+add_action('wp_ajax_give_core_settings_import', 'give_core_settings_import_callback');
745 744
 
746 745
 /**
747 746
  * Initializes blank slate content if a list table is empty.
@@ -753,7 +752,7 @@  discard block
 block discarded – undo
753 752
 	$blank_slate->init();
754 753
 }
755 754
 
756
-add_action( 'current_screen', 'give_blank_slate' );
755
+add_action('current_screen', 'give_blank_slate');
757 756
 
758 757
 /**
759 758
  * Validate Fields of User Profile
@@ -766,24 +765,24 @@  discard block
 block discarded – undo
766 765
  *
767 766
  * @return mixed
768 767
  */
769
-function give_validate_user_profile( $errors, $update, $user ) {
768
+function give_validate_user_profile($errors, $update, $user) {
770 769
 
771
-	if ( ! empty( $_POST['action'] ) && ( 'adduser' === $_POST['action'] || 'createuser' === $_POST['action'] ) ) {
770
+	if ( ! empty($_POST['action']) && ('adduser' === $_POST['action'] || 'createuser' === $_POST['action'])) {
772 771
 		return;
773 772
 	}
774 773
 
775
-	if ( ! empty( $user->ID ) ) {
776
-		$donor = Give()->donors->get_donor_by( 'user_id', $user->ID );
774
+	if ( ! empty($user->ID)) {
775
+		$donor = Give()->donors->get_donor_by('user_id', $user->ID);
777 776
 
778
-		if ( $donor ) {
777
+		if ($donor) {
779 778
 			// If Donor is attached with User, then validate first name.
780
-			if ( empty( $_POST['first_name'] ) ) {
779
+			if (empty($_POST['first_name'])) {
781 780
 				$errors->add(
782 781
 					'empty_first_name',
783 782
 					sprintf(
784 783
 						'<strong>%1$s:</strong> %2$s',
785
-						__( 'ERROR', 'give' ),
786
-						__( 'Please enter your first name.', 'give' )
784
+						__('ERROR', 'give'),
785
+						__('Please enter your first name.', 'give')
787 786
 					)
788 787
 				);
789 788
 			}
@@ -792,7 +791,7 @@  discard block
 block discarded – undo
792 791
 
793 792
 }
794 793
 
795
-add_action( 'user_profile_update_errors', 'give_validate_user_profile', 10, 3 );
794
+add_action('user_profile_update_errors', 'give_validate_user_profile', 10, 3);
796 795
 
797 796
 /**
798 797
  * Show Donor Information on User Profile Page.
@@ -801,19 +800,19 @@  discard block
 block discarded – undo
801 800
  *
802 801
  * @since 2.0
803 802
  */
804
-function give_donor_information_profile_fields( $user ) {
805
-	$donor = Give()->donors->get_donor_by( 'user_id', $user->ID );
803
+function give_donor_information_profile_fields($user) {
804
+	$donor = Give()->donors->get_donor_by('user_id', $user->ID);
806 805
 
807 806
 	// Display Donor Information, only if donor is attached with User.
808
-	if ( ! empty( $donor->user_id ) ) {
807
+	if ( ! empty($donor->user_id)) {
809 808
 		?>
810 809
 		<table class="form-table">
811 810
 			<tbody>
812 811
 			<tr>
813
-				<th scope="row"><?php _e( 'Donor', 'give' ); ?></th>
812
+				<th scope="row"><?php _e('Donor', 'give'); ?></th>
814 813
 				<td>
815
-					<a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ); ?>">
816
-						<?php _e( 'View Donor Information', 'give' ); ?>
814
+					<a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id); ?>">
815
+						<?php _e('View Donor Information', 'give'); ?>
817 816
 					</a>
818 817
 				</td>
819 818
 			</tr>
@@ -823,7 +822,7 @@  discard block
 block discarded – undo
823 822
 	}
824 823
 }
825 824
 
826
-add_action( 'personal_options', 'give_donor_information_profile_fields' );
825
+add_action('personal_options', 'give_donor_information_profile_fields');
827 826
 /**
828 827
  * Get Array of WP User Roles.
829 828
  *
@@ -835,8 +834,8 @@  discard block
 block discarded – undo
835 834
 	$user_roles = array();
836 835
 
837 836
 	// Loop through User Roles.
838
-	foreach ( get_editable_roles() as $role_name => $role_info ) :
839
-		$user_roles[ $role_name ] = $role_info['name'];
837
+	foreach (get_editable_roles() as $role_name => $role_info) :
838
+		$user_roles[$role_name] = $role_info['name'];
840 839
 	endforeach;
841 840
 
842 841
 	return $user_roles;
@@ -853,48 +852,46 @@  discard block
 block discarded – undo
853 852
 function __give_ajax_donor_manage_addresses() {
854 853
 	// Bailout.
855 854
 	if (
856
-		empty( $_POST['form'] ) ||
857
-		empty( $_POST['donorID'] )
855
+		empty($_POST['form']) ||
856
+		empty($_POST['donorID'])
858 857
 	) {
859
-		wp_send_json_error( array(
858
+		wp_send_json_error(array(
860 859
 			'error' => 1,
861
-		) );
860
+		));
862 861
 	}
863 862
 
864
-	$post                  = give_clean( wp_parse_args( $_POST ) );
865
-	$donorID               = absint( $post['donorID'] );
866
-	$form_data             = give_clean( wp_parse_args( $post['form'] ) );
867
-	$is_multi_address_type = ( 'billing' === $form_data['address-id'] || false !== strpos( $form_data['address-id'], '_' ) );
868
-	$address_type          = false !== strpos( $form_data['address-id'], '_' ) ?
869
-		array_shift( explode( '_', $form_data['address-id'] ) ) :
870
-		$form_data['address-id'];
871
-	$address_id            = false !== strpos( $form_data['address-id'], '_' ) ?
872
-		array_pop( explode( '_', $form_data['address-id'] ) ) :
873
-		null;
863
+	$post                  = give_clean(wp_parse_args($_POST));
864
+	$donorID               = absint($post['donorID']);
865
+	$form_data             = give_clean(wp_parse_args($post['form']));
866
+	$is_multi_address_type = ('billing' === $form_data['address-id'] || false !== strpos($form_data['address-id'], '_'));
867
+	$address_type          = false !== strpos($form_data['address-id'], '_') ?
868
+		array_shift(explode('_', $form_data['address-id'])) : $form_data['address-id'];
869
+	$address_id            = false !== strpos($form_data['address-id'], '_') ?
870
+		array_pop(explode('_', $form_data['address-id'])) : null;
874 871
 	$response_data         = array(
875 872
 		'action' => $form_data['address-action'],
876 873
 		'id'     => $form_data['address-id'],
877 874
 	);
878 875
 
879 876
 	// Security check.
880
-	if ( ! wp_verify_nonce( $form_data['_wpnonce'], 'give-manage-donor-addresses' ) ) {
881
-		wp_send_json_error( array(
877
+	if ( ! wp_verify_nonce($form_data['_wpnonce'], 'give-manage-donor-addresses')) {
878
+		wp_send_json_error(array(
882 879
 				'error'     => 1,
883 880
 				'error_msg' => wp_sprintf(
884 881
 					'<div class="notice notice-error"><p>%s</p></div>',
885
-					__( 'Error: Security issue.', 'give' )
882
+					__('Error: Security issue.', 'give')
886 883
 				),
887 884
 			)
888 885
 		);
889 886
 	}
890 887
 
891
-	$donor = new Give_Donor( $donorID );
888
+	$donor = new Give_Donor($donorID);
892 889
 
893 890
 	// Verify donor.
894
-	if ( ! $donor->id ) {
895
-		wp_send_json_error( array(
891
+	if ( ! $donor->id) {
892
+		wp_send_json_error(array(
896 893
 			'error' => 3,
897
-		) );
894
+		));
898 895
 	}
899 896
 
900 897
 	// Unset all data except address.
@@ -905,59 +902,57 @@  discard block
 block discarded – undo
905 902
 	);
906 903
 
907 904
 	// Process action.
908
-	switch ( $response_data['action'] ) {
905
+	switch ($response_data['action']) {
909 906
 
910 907
 		case 'add':
911
-			if ( ! $donor->add_address( "{$address_type}[]", $form_data ) ) {
912
-				wp_send_json_error( array(
908
+			if ( ! $donor->add_address("{$address_type}[]", $form_data)) {
909
+				wp_send_json_error(array(
913 910
 						'error'     => 1,
914 911
 						'error_msg' => wp_sprintf(
915 912
 							'<div class="notice notice-error"><p>%s</p></div>',
916
-							__( 'Error: Unable to save the address. Please check if address already exist.', 'give' )
913
+							__('Error: Unable to save the address. Please check if address already exist.', 'give')
917 914
 						),
918 915
 					)
919 916
 				);
920 917
 			}
921 918
 
922
-			$total_addresses = count( $donor->address[ $address_type ] );
919
+			$total_addresses = count($donor->address[$address_type]);
923 920
 
924 921
 			$address_index = $is_multi_address_type ?
925
-				$total_addresses - 1 :
926
-				$address_type;
922
+				$total_addresses - 1 : $address_type;
927 923
 
928
-			$array_keys = array_keys( $donor->address[ $address_type ] );
924
+			$array_keys = array_keys($donor->address[$address_type]);
929 925
 
930 926
 			$address_id = $is_multi_address_type ?
931
-				end( $array_keys ) :
932
-				$address_type;
927
+				end($array_keys) : $address_type;
933 928
 
934 929
 			$response_data['address_html'] = __give_get_format_address(
935
-				end( $donor->address['billing'] ),
930
+				end($donor->address['billing']),
936 931
 				array(
937 932
 					// We can add only billing address from donor screen.
938 933
 					'type'  => 'billing',
939 934
 					'id'    => $address_id,
940
-					'index' => ++ $address_index,
935
+					'index' => ++$address_index,
941 936
 				)
942 937
 			);
943
-			$response_data['success_msg']  = wp_sprintf(
938
+			$response_data['success_msg'] = wp_sprintf(
944 939
 				'<div class="notice updated"><p>%s</p></div>',
945
-				__( 'Successfully added a new address to the donor.', 'give' )
940
+				__('Successfully added a new address to the donor.', 'give')
946 941
 			);
947 942
 
948
-			if ( $is_multi_address_type ) {
943
+			if ($is_multi_address_type) {
949 944
 				$response_data['id'] = "{$response_data['id']}_{$address_index}";
950 945
 			}
951 946
 
952 947
 			break;
953 948
 
954 949
 		case 'remove':
955
-			if ( ! $donor->remove_address( $response_data['id'] ) ) {
956
-				wp_send_json_error( array(
950
+			if ( ! $donor->remove_address($response_data['id'])) {
951
+				wp_send_json_error(array(
957 952
 						'error'     => 2,
958 953
 						'error_msg' => wp_sprintf(
959 954
 							'<div class="notice notice-error"><p>%s</p></div>',
960
-							__( 'Error: Unable to delete address.', 'give' )
955
+							__('Error: Unable to delete address.', 'give')
961 956
 						),
962 957
 					)
963 958
 				);
@@ -965,18 +960,18 @@  discard block
 block discarded – undo
965 960
 
966 961
 			$response_data['success_msg'] = wp_sprintf(
967 962
 				'<div class="notice updated"><p>%s</p></div>',
968
-				__( 'Successfully removed a address of donor.', 'give' )
963
+				__('Successfully removed a address of donor.', 'give')
969 964
 			);
970 965
 
971 966
 			break;
972 967
 
973 968
 		case 'update':
974
-			if ( ! $donor->update_address( $response_data['id'], $form_data ) ) {
975
-				wp_send_json_error( array(
969
+			if ( ! $donor->update_address($response_data['id'], $form_data)) {
970
+				wp_send_json_error(array(
976 971
 						'error'     => 3,
977 972
 						'error_msg' => wp_sprintf(
978 973
 							'<div class="notice notice-error"><p>%s</p></div>',
979
-							__( 'Error: Unable to update address. Please check if address already exist.', 'give' )
974
+							__('Error: Unable to update address. Please check if address already exist.', 'give')
980 975
 						),
981 976
 					)
982 977
 				);
@@ -984,26 +979,25 @@  discard block
 block discarded – undo
984 979
 
985 980
 			$response_data['address_html'] = __give_get_format_address(
986 981
 				$is_multi_address_type ?
987
-					$donor->address[ $address_type ][ $address_id ] :
988
-					$donor->address[ $address_type ],
982
+					$donor->address[$address_type][$address_id] : $donor->address[$address_type],
989 983
 				array(
990 984
 					'type'  => $address_type,
991 985
 					'id'    => $address_id,
992 986
 					'index' => $address_id,
993 987
 				)
994 988
 			);
995
-			$response_data['success_msg']  = wp_sprintf(
989
+			$response_data['success_msg'] = wp_sprintf(
996 990
 				'<div class="notice updated"><p>%s</p></div>',
997
-				__( 'Successfully updated a address of donor', 'give' )
991
+				__('Successfully updated a address of donor', 'give')
998 992
 			);
999 993
 
1000 994
 			break;
1001 995
 	}// End switch().
1002 996
 
1003
-	wp_send_json_success( $response_data );
997
+	wp_send_json_success($response_data);
1004 998
 }
1005 999
 
1006
-add_action( 'wp_ajax_donor_manage_addresses', '__give_ajax_donor_manage_addresses' );
1000
+add_action('wp_ajax_donor_manage_addresses', '__give_ajax_donor_manage_addresses');
1007 1001
 
1008 1002
 /**
1009 1003
  * Admin donor billing address label
@@ -1014,13 +1008,13 @@  discard block
 block discarded – undo
1014 1008
  *
1015 1009
  * @return string
1016 1010
  */
1017
-function __give_donor_billing_address_label( $address_label ) {
1018
-	$address_label = __( 'Billing Address', 'give' );
1011
+function __give_donor_billing_address_label($address_label) {
1012
+	$address_label = __('Billing Address', 'give');
1019 1013
 
1020 1014
 	return $address_label;
1021 1015
 }
1022 1016
 
1023
-add_action( 'give_donor_billing_address_label', '__give_donor_billing_address_label' );
1017
+add_action('give_donor_billing_address_label', '__give_donor_billing_address_label');
1024 1018
 
1025 1019
 /**
1026 1020
  * Admin donor personal address label
@@ -1031,13 +1025,13 @@  discard block
 block discarded – undo
1031 1025
  *
1032 1026
  * @return string
1033 1027
  */
1034
-function __give_donor_personal_address_label( $address_label ) {
1035
-	$address_label = __( 'Personal Address', 'give' );
1028
+function __give_donor_personal_address_label($address_label) {
1029
+	$address_label = __('Personal Address', 'give');
1036 1030
 
1037 1031
 	return $address_label;
1038 1032
 }
1039 1033
 
1040
-add_action( 'give_donor_personal_address_label', '__give_donor_personal_address_label' );
1034
+add_action('give_donor_personal_address_label', '__give_donor_personal_address_label');
1041 1035
 
1042 1036
 /**
1043 1037
  * Update Donor Information when User Profile is updated from admin.
@@ -1050,34 +1044,34 @@  discard block
 block discarded – undo
1050 1044
  *
1051 1045
  * @return bool
1052 1046
  */
1053
-function give_update_donor_name_on_user_update( $user_id = 0 ) {
1047
+function give_update_donor_name_on_user_update($user_id = 0) {
1054 1048
 
1055
-	if ( current_user_can( 'edit_user', $user_id ) ) {
1049
+	if (current_user_can('edit_user', $user_id)) {
1056 1050
 
1057
-		$donor = new Give_Donor( $user_id, true );
1051
+		$donor = new Give_Donor($user_id, true);
1058 1052
 
1059 1053
 		// Bailout, if donor doesn't exists.
1060
-		if ( ! $donor ) {
1054
+		if ( ! $donor) {
1061 1055
 			return false;
1062 1056
 		}
1063 1057
 
1064 1058
 		// Get User First name and Last name.
1065
-		$first_name = ( $_POST['first_name'] ) ? give_clean( $_POST['first_name'] ) : get_user_meta( $user_id, 'first_name', true );
1066
-		$last_name  = ( $_POST['last_name'] ) ? give_clean( $_POST['last_name'] ) : get_user_meta( $user_id, 'last_name', true );
1067
-		$full_name  = strip_tags( wp_unslash( trim( "{$first_name} {$last_name}" ) ) );
1059
+		$first_name = ($_POST['first_name']) ? give_clean($_POST['first_name']) : get_user_meta($user_id, 'first_name', true);
1060
+		$last_name  = ($_POST['last_name']) ? give_clean($_POST['last_name']) : get_user_meta($user_id, 'last_name', true);
1061
+		$full_name  = strip_tags(wp_unslash(trim("{$first_name} {$last_name}")));
1068 1062
 
1069 1063
 		// Assign User First name and Last name to Donor.
1070
-		Give()->donors->update( $donor->id, array(
1064
+		Give()->donors->update($donor->id, array(
1071 1065
 			'name' => $full_name,
1072
-		) );
1073
-		Give()->donor_meta->update_meta( $donor->id, '_give_donor_first_name', $first_name );
1074
-		Give()->donor_meta->update_meta( $donor->id, '_give_donor_last_name', $last_name );
1066
+		));
1067
+		Give()->donor_meta->update_meta($donor->id, '_give_donor_first_name', $first_name);
1068
+		Give()->donor_meta->update_meta($donor->id, '_give_donor_last_name', $last_name);
1075 1069
 
1076 1070
 	}
1077 1071
 }
1078 1072
 
1079
-add_action( 'edit_user_profile_update', 'give_update_donor_name_on_user_update', 10 );
1080
-add_action( 'personal_options_update', 'give_update_donor_name_on_user_update', 10 );
1073
+add_action('edit_user_profile_update', 'give_update_donor_name_on_user_update', 10);
1074
+add_action('personal_options_update', 'give_update_donor_name_on_user_update', 10);
1081 1075
 
1082 1076
 
1083 1077
 /**
@@ -1092,31 +1086,31 @@  discard block
 block discarded – undo
1092 1086
  *
1093 1087
  * @return bool
1094 1088
  */
1095
-function give_update_donor_email_on_user_update( $user_id = 0, $old_user_data = false ) {
1089
+function give_update_donor_email_on_user_update($user_id = 0, $old_user_data = false) {
1096 1090
 
1097
-	$donor = new Give_Donor( $user_id, true );
1091
+	$donor = new Give_Donor($user_id, true);
1098 1092
 
1099
-	if ( ! $donor ) {
1093
+	if ( ! $donor) {
1100 1094
 		return false;
1101 1095
 	}
1102 1096
 
1103
-	$user = get_userdata( $user_id );
1097
+	$user = get_userdata($user_id);
1104 1098
 
1105
-	if ( ! empty( $user ) && $user->user_email !== $donor->email ) {
1099
+	if ( ! empty($user) && $user->user_email !== $donor->email) {
1106 1100
 
1107
-		$success = Give()->donors->update( $donor->id, array(
1101
+		$success = Give()->donors->update($donor->id, array(
1108 1102
 			'email' => $user->user_email,
1109
-		) );
1103
+		));
1110 1104
 
1111
-		if ( $success ) {
1105
+		if ($success) {
1112 1106
 			// Update some payment meta if we need to
1113
-			$payments_array = explode( ',', $donor->payment_ids );
1107
+			$payments_array = explode(',', $donor->payment_ids);
1114 1108
 
1115
-			if ( ! empty( $payments_array ) ) {
1109
+			if ( ! empty($payments_array)) {
1116 1110
 
1117
-				foreach ( $payments_array as $payment_id ) {
1111
+				foreach ($payments_array as $payment_id) {
1118 1112
 
1119
-					give_update_payment_meta( $payment_id, 'email', $user->user_email );
1113
+					give_update_payment_meta($payment_id, 'email', $user->user_email);
1120 1114
 
1121 1115
 				}
1122 1116
 			}
@@ -1129,14 +1123,14 @@  discard block
 block discarded – undo
1129 1123
 			 * @param  WP_User    $user  WordPress User object.
1130 1124
 			 * @param  Give_Donor $donor Give donor object.
1131 1125
 			 */
1132
-			do_action( 'give_update_donor_email_on_user_update', $user, $donor );
1126
+			do_action('give_update_donor_email_on_user_update', $user, $donor);
1133 1127
 
1134 1128
 		}
1135 1129
 	}
1136 1130
 
1137 1131
 }
1138 1132
 
1139
-add_action( 'profile_update', 'give_update_donor_email_on_user_update', 10, 2 );
1133
+add_action('profile_update', 'give_update_donor_email_on_user_update', 10, 2);
1140 1134
 
1141 1135
 
1142 1136
 /**
@@ -1145,15 +1139,15 @@  discard block
 block discarded – undo
1145 1139
 function give_cache_flush() {
1146 1140
 	$result = Give_Cache::flush_cache();
1147 1141
 
1148
-	if ( $result ) {
1149
-		wp_send_json_success( array(
1150
-			'message' => __( 'Cache flushed successfully.', 'give' ),
1142
+	if ($result) {
1143
+		wp_send_json_success(array(
1144
+			'message' => __('Cache flushed successfully.', 'give'),
1151 1145
 		));
1152 1146
 	} else {
1153
-		wp_send_json_error( array(
1154
-			'message' => __( 'An error occured while flushing the cache.', 'give' ),
1147
+		wp_send_json_error(array(
1148
+			'message' => __('An error occured while flushing the cache.', 'give'),
1155 1149
 		));
1156 1150
 	}
1157 1151
 }
1158 1152
 
1159
-add_action( 'wp_ajax_give_cache_flush', 'give_cache_flush', 10, 0 );
1153
+add_action('wp_ajax_give_cache_flush', 'give_cache_flush', 10, 0);
Please login to merge, or discard this patch.
includes/admin/payments/actions.php 1 patch
Spacing   +124 added lines, -124 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
 
@@ -25,48 +25,48 @@  discard block
 block discarded – undo
25 25
  *
26 26
  * @return      void
27 27
  */
28
-function give_update_payment_details( $data ) {
28
+function give_update_payment_details($data) {
29 29
 
30
-	if ( ! current_user_can( 'edit_give_payments', $data['give_payment_id'] ) ) {
31
-		wp_die( __( 'You do not have permission to edit payments.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
30
+	if ( ! current_user_can('edit_give_payments', $data['give_payment_id'])) {
31
+		wp_die(__('You do not have permission to edit payments.', 'give'), __('Error', 'give'), array('response' => 403));
32 32
 	}
33 33
 
34
-	check_admin_referer( 'give_update_payment_details_nonce' );
34
+	check_admin_referer('give_update_payment_details_nonce');
35 35
 
36 36
 	// Retrieve the payment ID.
37
-	$payment_id = absint( $data['give_payment_id'] );
37
+	$payment_id = absint($data['give_payment_id']);
38 38
 
39 39
 	/* @var Give_Payment $payment */
40
-	$payment = new Give_Payment( $payment_id );
40
+	$payment = new Give_Payment($payment_id);
41 41
 
42 42
 	$status = $data['give-payment-status'];
43
-	$date   = sanitize_text_field( $data['give-payment-date'] );
44
-	$hour   = sanitize_text_field( $data['give-payment-time-hour'] );
43
+	$date   = sanitize_text_field($data['give-payment-date']);
44
+	$hour   = sanitize_text_field($data['give-payment-time-hour']);
45 45
 
46 46
 	// Restrict to our high and low.
47
-	if ( $hour > 23 ) {
47
+	if ($hour > 23) {
48 48
 		$hour = 23;
49
-	} elseif ( $hour < 0 ) {
49
+	} elseif ($hour < 0) {
50 50
 		$hour = 00;
51 51
 	}
52 52
 
53
-	$minute = sanitize_text_field( $data['give-payment-time-min'] );
53
+	$minute = sanitize_text_field($data['give-payment-time-min']);
54 54
 
55 55
 	// Restrict to our high and low.
56
-	if ( $minute > 59 ) {
56
+	if ($minute > 59) {
57 57
 		$minute = 59;
58
-	} elseif ( $minute < 0 ) {
58
+	} elseif ($minute < 0) {
59 59
 		$minute = 00;
60 60
 	}
61 61
 
62
-	$address = give_clean( $data['give-payment-address'][0] );
62
+	$address = give_clean($data['give-payment-address'][0]);
63 63
 
64 64
 	$curr_total = $payment->total;
65
-	$new_total  = give_maybe_sanitize_amount( ( ! empty( $data['give-payment-total'] ) ? $data['give-payment-total'] : 0 ) );
66
-	$date       = date( 'Y-m-d', strtotime( $date ) ) . ' ' . $hour . ':' . $minute . ':00';
65
+	$new_total  = give_maybe_sanitize_amount(( ! empty($data['give-payment-total']) ? $data['give-payment-total'] : 0));
66
+	$date       = date('Y-m-d', strtotime($date)).' '.$hour.':'.$minute.':00';
67 67
 
68
-	$curr_donor_id = sanitize_text_field( $data['give-current-donor'] );
69
-	$new_donor_id  = sanitize_text_field( $data['donor-id'] );
68
+	$curr_donor_id = sanitize_text_field($data['give-current-donor']);
69
+	$new_donor_id  = sanitize_text_field($data['donor-id']);
70 70
 
71 71
 	/**
72 72
 	 * Fires before updating edited donation.
@@ -76,71 +76,71 @@  discard block
 block discarded – undo
76 76
 	 *
77 77
 	 * @param int $payment_id The ID of the payment.
78 78
 	 */
79
-	do_action( 'give_update_edited_donation', $payment_id );
79
+	do_action('give_update_edited_donation', $payment_id);
80 80
 
81 81
 	$payment->date = $date;
82 82
 	$updated       = $payment->save();
83 83
 
84
-	if ( 0 === $updated ) {
85
-		wp_die( __( 'Error Updating Donation.', 'give' ), __( 'Error', 'give' ), array( 'response' => 400 ) );
84
+	if (0 === $updated) {
85
+		wp_die(__('Error Updating Donation.', 'give'), __('Error', 'give'), array('response' => 400));
86 86
 	}
87 87
 
88 88
 	$donor_changed = false;
89 89
 
90
-	if ( isset( $data['give-new-donor'] ) && $data['give-new-donor'] == '1' ) {
90
+	if (isset($data['give-new-donor']) && $data['give-new-donor'] == '1') {
91 91
 
92
-		$email      = ! empty( $data['give-new-donor-email'] ) ? sanitize_text_field( $data['give-new-donor-email'] ) : '';
93
-		$first_name = ! empty( $data['give-new-donor-first-name'] ) ? sanitize_text_field( $data['give-new-donor-first-name'] ) : '';
94
-		$last_name  = ! empty( $data['give-new-donor-last-name'] ) ? sanitize_text_field( $data['give-new-donor-last-name'] ) : '';
95
-		$names      = strip_tags( wp_unslash( trim( "{$first_name} {$last_name}" ) ) );
92
+		$email      = ! empty($data['give-new-donor-email']) ? sanitize_text_field($data['give-new-donor-email']) : '';
93
+		$first_name = ! empty($data['give-new-donor-first-name']) ? sanitize_text_field($data['give-new-donor-first-name']) : '';
94
+		$last_name  = ! empty($data['give-new-donor-last-name']) ? sanitize_text_field($data['give-new-donor-last-name']) : '';
95
+		$names      = strip_tags(wp_unslash(trim("{$first_name} {$last_name}")));
96 96
 
97
-		if ( empty( $email ) || empty( $first_name ) ) {
98
-			wp_die( __( 'New Donor requires first name and email address.', 'give' ), __( 'Error', 'give' ), array( 'response' => 400 ) );
97
+		if (empty($email) || empty($first_name)) {
98
+			wp_die(__('New Donor requires first name and email address.', 'give'), __('Error', 'give'), array('response' => 400));
99 99
 		}
100 100
 
101
-		$donor = new Give_Donor( $email );
102
-		if ( empty( $donor->id ) ) {
103
-			$donor_data = array( 'name' => $names, 'email' => $email );
104
-			$user_id       = email_exists( $email );
105
-			if ( false !== $user_id ) {
101
+		$donor = new Give_Donor($email);
102
+		if (empty($donor->id)) {
103
+			$donor_data = array('name' => $names, 'email' => $email);
104
+			$user_id = email_exists($email);
105
+			if (false !== $user_id) {
106 106
 				$donor_data['user_id'] = $user_id;
107 107
 			}
108 108
 
109
-			if ( ! $donor->create( $donor_data ) ) {
109
+			if ( ! $donor->create($donor_data)) {
110 110
 				// Failed to create the new donor, assume the previous donor.
111 111
 				$donor_changed = false;
112
-				$donor         = new Give_Donor( $curr_donor_id );
113
-				give_set_error( 'give-payment-new-donor-fail', __( 'Error creating new donor.', 'give' ) );
112
+				$donor         = new Give_Donor($curr_donor_id);
113
+				give_set_error('give-payment-new-donor-fail', __('Error creating new donor.', 'give'));
114 114
 			}
115 115
 		}
116 116
 
117 117
 		// Create and Update Donor First Name and Last Name in Meta Fields.
118
-		$donor->update_meta( '_give_donor_first_name', $first_name );
119
-		$donor->update_meta( '_give_donor_last_name', $last_name );
118
+		$donor->update_meta('_give_donor_first_name', $first_name);
119
+		$donor->update_meta('_give_donor_last_name', $last_name);
120 120
 
121 121
 		$new_donor_id = $donor->id;
122 122
 
123
-		$previous_donor = new Give_Donor( $curr_donor_id );
123
+		$previous_donor = new Give_Donor($curr_donor_id);
124 124
 
125 125
 		$donor_changed = true;
126 126
 
127
-	} elseif ( $curr_donor_id !== $new_donor_id ) {
127
+	} elseif ($curr_donor_id !== $new_donor_id) {
128 128
 
129
-		$donor = new Give_Donor( $new_donor_id );
129
+		$donor = new Give_Donor($new_donor_id);
130 130
 		$email    = $donor->email;
131 131
 		$names    = $donor->name;
132 132
 
133
-		$previous_donor = new Give_Donor( $curr_donor_id );
133
+		$previous_donor = new Give_Donor($curr_donor_id);
134 134
 
135 135
 		$donor_changed = true;
136 136
 
137 137
 	} else {
138
-		$donor = new Give_Donor( $curr_donor_id );
138
+		$donor = new Give_Donor($curr_donor_id);
139 139
 		$email    = $donor->email;
140 140
 		$names    = $donor->name;
141 141
 	}
142 142
 
143
-	if ( $donor_changed ) {
143
+	if ($donor_changed) {
144 144
 
145 145
 		// Setup first and last name from input values.
146 146
 		$first_name = $donor->get_first_name();
@@ -150,26 +150,26 @@  discard block
 block discarded – undo
150 150
 		$payment->last_name  = $last_name;
151 151
 
152 152
 		// Remove the stats and payment from the previous donor and attach it to the new donor.
153
-		$previous_donor->remove_payment( $payment_id, false );
154
-		$donor->attach_payment( $payment_id, false );
153
+		$previous_donor->remove_payment($payment_id, false);
154
+		$donor->attach_payment($payment_id, false);
155 155
 
156
-		if ( 'publish' == $status ) {
156
+		if ('publish' == $status) {
157 157
 
158 158
 			// Reduce previous user donation count and amount.
159 159
 			$previous_donor->decrease_donation_count();
160
-			$previous_donor->decrease_value( $curr_total );
160
+			$previous_donor->decrease_value($curr_total);
161 161
 
162 162
 			// If donation was completed adjust stats of new donors.
163 163
 			$donor->increase_purchase_count();
164
-			$donor->increase_value( $new_total );
164
+			$donor->increase_value($new_total);
165 165
 		}
166 166
 
167 167
 		$payment->customer_id = $donor->id;
168 168
 	} else {
169 169
 
170
-		if ( 'publish' === $status ) {
170
+		if ('publish' === $status) {
171 171
 			// Update user donation stat.
172
-			$donor->update_donation_value( $curr_total, $new_total );
172
+			$donor->update_donation_value($curr_total, $new_total);
173 173
 		}
174 174
 	}
175 175
 
@@ -180,10 +180,10 @@  discard block
 block discarded – undo
180 180
 	$payment->total      = $new_total;
181 181
 
182 182
 	// Check for payment notes.
183
-	if ( ! empty( $data['give-payment-note'] ) ) {
183
+	if ( ! empty($data['give-payment-note'])) {
184 184
 
185
-		$note = wp_kses( $data['give-payment-note'], array() );
186
-		give_insert_payment_note( $payment_id, $note );
185
+		$note = wp_kses($data['give-payment-note'], array());
186
+		give_insert_payment_note($payment_id, $note);
187 187
 
188 188
 	}
189 189
 
@@ -191,17 +191,17 @@  discard block
 block discarded – undo
191 191
 	$payment->status = $status;
192 192
 
193 193
 	// Adjust total store earnings if the payment total has been changed.
194
-	if ( $new_total !== $curr_total && 'publish' == $status ) {
194
+	if ($new_total !== $curr_total && 'publish' == $status) {
195 195
 
196
-		if ( $new_total > $curr_total ) {
196
+		if ($new_total > $curr_total) {
197 197
 			// Increase if our new total is higher.
198 198
 			$difference = $new_total - $curr_total;
199
-			give_increase_total_earnings( $difference );
199
+			give_increase_total_earnings($difference);
200 200
 
201
-		} elseif ( $curr_total > $new_total ) {
201
+		} elseif ($curr_total > $new_total) {
202 202
 			// Decrease if our new total is lower.
203 203
 			$difference = $curr_total - $new_total;
204
-			give_decrease_total_earnings( $difference );
204
+			give_decrease_total_earnings($difference);
205 205
 
206 206
 		}
207 207
 	}
@@ -209,55 +209,55 @@  discard block
 block discarded – undo
209 209
 	$payment->save();
210 210
 
211 211
 	// Get new give form ID.
212
-	$new_form_id     = absint( $data['give-payment-form-select'] );
213
-	$current_form_id = absint( $payment->get_meta( '_give_payment_form_id' ) );
212
+	$new_form_id     = absint($data['give-payment-form-select']);
213
+	$current_form_id = absint($payment->get_meta('_give_payment_form_id'));
214 214
 
215 215
 	// We are adding payment transfer code in last to remove any conflict with above functionality.
216 216
 	// For example: above code will automatically handle form stat (increase/decrease) when payment status changes.
217 217
 	// Check if user want to transfer current payment to new give form id.
218
-	if ( $new_form_id && $new_form_id != $current_form_id ) {
218
+	if ($new_form_id && $new_form_id != $current_form_id) {
219 219
 
220 220
 		// Get new give form title.
221
-		$new_form_title = get_the_title( $new_form_id );
221
+		$new_form_title = get_the_title($new_form_id);
222 222
 
223 223
 		// Update payment give form meta data.
224
-		$payment->update_meta( '_give_payment_form_id', $new_form_id );
225
-		$payment->update_meta( '_give_payment_form_title', $new_form_title );
224
+		$payment->update_meta('_give_payment_form_id', $new_form_id);
225
+		$payment->update_meta('_give_payment_form_title', $new_form_title);
226 226
 
227 227
 		// Update price id payment metadata.
228
-		if ( ! give_has_variable_prices( $new_form_id ) ) {
229
-			$payment->update_meta( '_give_payment_price_id', '' );
228
+		if ( ! give_has_variable_prices($new_form_id)) {
229
+			$payment->update_meta('_give_payment_price_id', '');
230 230
 		}
231 231
 
232 232
 		// If donation was completed, adjust stats of forms.
233
-		if ( 'publish' == $status ) {
233
+		if ('publish' == $status) {
234 234
 
235 235
 			// Decrease sale of old give form. For other payment status.
236
-			$current_form = new Give_Donate_Form( $current_form_id );
236
+			$current_form = new Give_Donate_Form($current_form_id);
237 237
 			$current_form->decrease_sales();
238
-			$current_form->decrease_earnings( $curr_total, $payment->ID );
238
+			$current_form->decrease_earnings($curr_total, $payment->ID);
239 239
 
240 240
 			// Increase sale of new give form.
241
-			$new_form = new Give_Donate_Form( $new_form_id );
241
+			$new_form = new Give_Donate_Form($new_form_id);
242 242
 			$new_form->increase_sales();
243
-			$new_form->increase_earnings( $new_total, $payment->ID );
243
+			$new_form->increase_earnings($new_total, $payment->ID);
244 244
 		}
245 245
 
246 246
 		// Re setup payment to update new meta value in object.
247
-		$payment->update_payment_setup( $payment->ID );
247
+		$payment->update_payment_setup($payment->ID);
248 248
 
249 249
 		// Update form id in payment logs.
250
-		Give()->async_process->data( array(
251
-			'data' => array( $new_form_id, $payment_id ),
250
+		Give()->async_process->data(array(
251
+			'data' => array($new_form_id, $payment_id),
252 252
 			'hook' => 'give_update_log_form_id',
253
-		) )->dispatch();
253
+		))->dispatch();
254 254
 	}
255 255
 
256 256
 	// Update price id if current form is variable form.
257 257
 	/* @var Give_Donate_Form $form */
258
-	$form = new Give_Donate_Form( $payment->form_id );
258
+	$form = new Give_Donate_Form($payment->form_id);
259 259
 
260
-	if ( isset( $data['give-variable-price'] ) && $form->has_variable_prices() ) {
260
+	if (isset($data['give-variable-price']) && $form->has_variable_prices()) {
261 261
 
262 262
 		// Get payment meta data.
263 263
 		$payment_meta = $payment->get_meta();
@@ -266,9 +266,9 @@  discard block
 block discarded – undo
266 266
 		$price_id = '';
267 267
 
268 268
 		// Get price info
269
-		if( 0 <= $data['give-variable-price'] ) {
270
-			foreach ( $form->prices as $variable_price ) {
271
-				if( $new_total === give_maybe_sanitize_amount( $variable_price['_give_amount'] ) ) {
269
+		if (0 <= $data['give-variable-price']) {
270
+			foreach ($form->prices as $variable_price) {
271
+				if ($new_total === give_maybe_sanitize_amount($variable_price['_give_amount'])) {
272 272
 					$price_info = $variable_price;
273 273
 					break;
274 274
 				}
@@ -276,15 +276,15 @@  discard block
 block discarded – undo
276 276
 		}
277 277
 
278 278
 		// Set price id.
279
-		if( ! empty( $price_info ) ) {
279
+		if ( ! empty($price_info)) {
280 280
 			$price_id = $data['give-variable-price'];
281 281
 
282
-			if( $data['give-variable-price'] !== $price_info['_give_id']['level_id'] ) {
282
+			if ($data['give-variable-price'] !== $price_info['_give_id']['level_id']) {
283 283
 				// Set price id to amount match.
284 284
 				$price_id = $price_info['_give_id']['level_id'];
285 285
 			}
286 286
 
287
-		} elseif( $form->is_custom_price_mode() ){
287
+		} elseif ($form->is_custom_price_mode()) {
288 288
 			$price_id = 'custom';
289 289
 		}
290 290
 
@@ -292,11 +292,11 @@  discard block
 block discarded – undo
292 292
 		$payment_meta['price_id'] = $price_id;
293 293
 
294 294
 		// Update payment give form meta data.
295
-		$payment->update_meta( '_give_payment_price_id', $price_id );
296
-		$payment->update_meta( '_give_payment_meta', $payment_meta );
295
+		$payment->update_meta('_give_payment_price_id', $price_id);
296
+		$payment->update_meta('_give_payment_meta', $payment_meta);
297 297
 
298 298
 		// Re setup payment to update new meta value in object.
299
-		$payment->update_payment_setup( $payment->ID );
299
+		$payment->update_payment_setup($payment->ID);
300 300
 	}
301 301
 
302 302
 	/**
@@ -307,13 +307,13 @@  discard block
 block discarded – undo
307 307
 	 *
308 308
 	 * @param int $payment_id The ID of the payment.
309 309
 	 */
310
-	do_action( 'give_updated_edited_donation', $payment_id );
310
+	do_action('give_updated_edited_donation', $payment_id);
311 311
 
312
-	wp_safe_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-messages[]=payment-updated&id=' . $payment_id ) );
312
+	wp_safe_redirect(admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-messages[]=payment-updated&id='.$payment_id));
313 313
 	exit;
314 314
 }
315 315
 
316
-add_action( 'give_update_payment_details', 'give_update_payment_details' );
316
+add_action('give_update_payment_details', 'give_update_payment_details');
317 317
 
318 318
 /**
319 319
  * Trigger a Donation Deletion.
@@ -324,48 +324,48 @@  discard block
 block discarded – undo
324 324
  *
325 325
  * @return void
326 326
  */
327
-function give_trigger_donation_delete( $data ) {
328
-	if ( wp_verify_nonce( $data['_wpnonce'], 'give_donation_nonce' ) ) {
327
+function give_trigger_donation_delete($data) {
328
+	if (wp_verify_nonce($data['_wpnonce'], 'give_donation_nonce')) {
329 329
 
330
-		$payment_id = absint( $data['purchase_id'] );
330
+		$payment_id = absint($data['purchase_id']);
331 331
 
332
-		if ( ! current_user_can( 'edit_give_payments', $payment_id ) ) {
333
-			wp_die( __( 'You do not have permission to edit payments.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
332
+		if ( ! current_user_can('edit_give_payments', $payment_id)) {
333
+			wp_die(__('You do not have permission to edit payments.', 'give'), __('Error', 'give'), array('response' => 403));
334 334
 		}
335 335
 
336
-		give_delete_donation( $payment_id );
337
-		wp_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&give-messages[]=donation-deleted' ) );
336
+		give_delete_donation($payment_id);
337
+		wp_redirect(admin_url('edit.php?post_type=give_forms&page=give-payment-history&give-messages[]=donation-deleted'));
338 338
 		give_die();
339 339
 	}
340 340
 }
341 341
 
342
-add_action( 'give_delete_payment', 'give_trigger_donation_delete' );
342
+add_action('give_delete_payment', 'give_trigger_donation_delete');
343 343
 
344 344
 /**
345 345
  * AJAX Store Donation Note
346 346
  */
347 347
 function give_ajax_store_payment_note() {
348 348
 
349
-	$payment_id = absint( $_POST['payment_id'] );
350
-	$note       = wp_kses( $_POST['note'], array() );
349
+	$payment_id = absint($_POST['payment_id']);
350
+	$note       = wp_kses($_POST['note'], array());
351 351
 
352
-	if ( ! current_user_can( 'edit_give_payments', $payment_id ) ) {
353
-		wp_die( __( 'You do not have permission to edit payments.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
352
+	if ( ! current_user_can('edit_give_payments', $payment_id)) {
353
+		wp_die(__('You do not have permission to edit payments.', 'give'), __('Error', 'give'), array('response' => 403));
354 354
 	}
355 355
 
356
-	if ( empty( $payment_id ) ) {
357
-		die( '-1' );
356
+	if (empty($payment_id)) {
357
+		die('-1');
358 358
 	}
359 359
 
360
-	if ( empty( $note ) ) {
361
-		die( '-1' );
360
+	if (empty($note)) {
361
+		die('-1');
362 362
 	}
363 363
 
364
-	$note_id = give_insert_payment_note( $payment_id, $note );
365
-	die( give_get_payment_note_html( $note_id ) );
364
+	$note_id = give_insert_payment_note($payment_id, $note);
365
+	die(give_get_payment_note_html($note_id));
366 366
 }
367 367
 
368
-add_action( 'wp_ajax_give_insert_payment_note', 'give_ajax_store_payment_note' );
368
+add_action('wp_ajax_give_insert_payment_note', 'give_ajax_store_payment_note');
369 369
 
370 370
 /**
371 371
  * Triggers a donation note deletion without ajax
@@ -376,24 +376,24 @@  discard block
 block discarded – undo
376 376
  *
377 377
  * @return void
378 378
  */
379
-function give_trigger_payment_note_deletion( $data ) {
379
+function give_trigger_payment_note_deletion($data) {
380 380
 
381
-	if ( ! wp_verify_nonce( $data['_wpnonce'], 'give_delete_payment_note_' . $data['note_id'] ) ) {
381
+	if ( ! wp_verify_nonce($data['_wpnonce'], 'give_delete_payment_note_'.$data['note_id'])) {
382 382
 		return;
383 383
 	}
384 384
 
385
-	if ( ! current_user_can( 'edit_give_payments', $data['payment_id'] ) ) {
386
-		wp_die( __( 'You do not have permission to edit payments.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
385
+	if ( ! current_user_can('edit_give_payments', $data['payment_id'])) {
386
+		wp_die(__('You do not have permission to edit payments.', 'give'), __('Error', 'give'), array('response' => 403));
387 387
 	}
388 388
 
389
-	$edit_order_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-messages[]=donation-note-deleted&id=' . absint( $data['payment_id'] ) );
389
+	$edit_order_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-messages[]=donation-note-deleted&id='.absint($data['payment_id']));
390 390
 
391
-	give_delete_payment_note( $data['note_id'], $data['payment_id'] );
391
+	give_delete_payment_note($data['note_id'], $data['payment_id']);
392 392
 
393
-	wp_redirect( $edit_order_url );
393
+	wp_redirect($edit_order_url);
394 394
 }
395 395
 
396
-add_action( 'give_delete_payment_note', 'give_trigger_payment_note_deletion' );
396
+add_action('give_delete_payment_note', 'give_trigger_payment_note_deletion');
397 397
 
398 398
 /**
399 399
  * Delete a payment note deletion with ajax
@@ -404,16 +404,16 @@  discard block
 block discarded – undo
404 404
  */
405 405
 function give_ajax_delete_payment_note() {
406 406
 
407
-	if ( ! current_user_can( 'edit_give_payments', $_POST['payment_id'] ) ) {
408
-		wp_die( __( 'You do not have permission to edit payments.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
407
+	if ( ! current_user_can('edit_give_payments', $_POST['payment_id'])) {
408
+		wp_die(__('You do not have permission to edit payments.', 'give'), __('Error', 'give'), array('response' => 403));
409 409
 	}
410 410
 
411
-	if ( give_delete_payment_note( $_POST['note_id'], $_POST['payment_id'] ) ) {
412
-		die( '1' );
411
+	if (give_delete_payment_note($_POST['note_id'], $_POST['payment_id'])) {
412
+		die('1');
413 413
 	} else {
414
-		die( '-1' );
414
+		die('-1');
415 415
 	}
416 416
 
417 417
 }
418 418
 
419
-add_action( 'wp_ajax_give_delete_payment_note', 'give_ajax_delete_payment_note' );
419
+add_action('wp_ajax_give_delete_payment_note', 'give_ajax_delete_payment_note');
Please login to merge, or discard this patch.
includes/admin/payments/view-payment-details.php 1 patch
Spacing   +151 added lines, -151 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  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
-if ( ! current_user_can( 'view_give_payments' ) ) {
17
+if ( ! current_user_can('view_give_payments')) {
18 18
 	wp_die(
19
-		__( 'Sorry, you are not allowed to access this page.', 'give' ), __( 'Error', 'give' ), array(
19
+		__('Sorry, you are not allowed to access this page.', 'give'), __('Error', 'give'), array(
20 20
 			'response' => 403,
21 21
 		)
22 22
 	);
@@ -28,35 +28,35 @@  discard block
 block discarded – undo
28 28
  * @since 1.0
29 29
  * @return void
30 30
  */
31
-if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) {
32
-	wp_die( __( 'Donation ID not supplied. Please try again.', 'give' ), __( 'Error', 'give' ), array( 'response' => 400 ) );
31
+if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) {
32
+	wp_die(__('Donation ID not supplied. Please try again.', 'give'), __('Error', 'give'), array('response' => 400));
33 33
 }
34 34
 
35 35
 // Setup the variables
36
-$payment_id = absint( $_GET['id'] );
37
-$payment    = new Give_Payment( $payment_id );
36
+$payment_id = absint($_GET['id']);
37
+$payment    = new Give_Payment($payment_id);
38 38
 
39 39
 // Sanity check... fail if donation ID is invalid
40 40
 $payment_exists = $payment->ID;
41
-if ( empty( $payment_exists ) ) {
42
-	wp_die( __( 'The specified ID does not belong to a donation. Please try again.', 'give' ), __( 'Error', 'give' ), array( 'response' => 400 ) );
41
+if (empty($payment_exists)) {
42
+	wp_die(__('The specified ID does not belong to a donation. Please try again.', 'give'), __('Error', 'give'), array('response' => 400));
43 43
 }
44 44
 
45 45
 $number       = $payment->number;
46 46
 $payment_meta = $payment->get_meta();
47 47
 
48
-$company_name   = ! empty( $payment_meta['_give_donation_company'] ) ? esc_attr( $payment_meta['_give_donation_company'] ) : '';
49
-$transaction_id = esc_attr( $payment->transaction_id );
48
+$company_name   = ! empty($payment_meta['_give_donation_company']) ? esc_attr($payment_meta['_give_donation_company']) : '';
49
+$transaction_id = esc_attr($payment->transaction_id);
50 50
 $user_id        = $payment->user_id;
51 51
 $donor_id       = $payment->customer_id;
52
-$payment_date   = strtotime( $payment->date );
53
-$user_info      = give_get_payment_meta_user_info( $payment_id );
52
+$payment_date   = strtotime($payment->date);
53
+$user_info      = give_get_payment_meta_user_info($payment_id);
54 54
 $address        = $payment->address;
55 55
 $currency_code  = $payment->currency;
56 56
 $gateway        = $payment->gateway;
57 57
 $currency_code  = $payment->currency;
58 58
 $payment_mode   = $payment->mode;
59
-$base_url       = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' );
59
+$base_url       = admin_url('edit.php?post_type=give_forms&page=give-payment-history');
60 60
 
61 61
 ?>
62 62
 <div class="wrap give-wrap">
@@ -65,13 +65,13 @@  discard block
 block discarded – undo
65 65
 	<?php
66 66
 		printf(
67 67
 			/* translators: %s: donation number */
68
-			esc_html__( 'Donation %s', 'give' ),
68
+			esc_html__('Donation %s', 'give'),
69 69
 			$number
70 70
 		);
71
-		if ( $payment_mode == 'test' ) {
71
+		if ($payment_mode == 'test') {
72 72
 			echo Give()->tooltips->render_span(array(
73
-				'label' => __( 'This donation was made in test mode.', 'give' ),
74
-				'tag_content' => __( 'Test Donation', 'give' ),
73
+				'label' => __('This donation was made in test mode.', 'give'),
74
+				'tag_content' => __('Test Donation', 'give'),
75 75
 				'position'=> 'right',
76 76
 				'attributes' => array(
77 77
 					'id' => 'test-payment-label',
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 	 *
91 91
 	 * @param int $payment_id Payment id.
92 92
 	 */
93
-	do_action( 'give_view_donation_details_before', $payment_id );
93
+	do_action('give_view_donation_details_before', $payment_id);
94 94
 	?>
95 95
 
96 96
 	<hr class="wp-header-end">
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 		 *
105 105
 		 * @param int $payment_id Payment id.
106 106
 		 */
107
-		do_action( 'give_view_donation_details_form_top', $payment_id );
107
+		do_action('give_view_donation_details_form_top', $payment_id);
108 108
 		?>
109 109
 		<div id="poststuff">
110 110
 			<div id="give-dashboard-widgets-wrap">
@@ -120,16 +120,16 @@  discard block
 block discarded – undo
120 120
 							 *
121 121
 							 * @param int $payment_id Payment id.
122 122
 							 */
123
-							do_action( 'give_view_donation_details_sidebar_before', $payment_id );
123
+							do_action('give_view_donation_details_sidebar_before', $payment_id);
124 124
 							?>
125 125
 
126 126
 							<div id="give-order-update" class="postbox give-order-data">
127 127
 
128 128
 								<div class="give-order-top">
129
-									<h3 class="hndle"><?php _e( 'Update Donation', 'give' ); ?></h3>
129
+									<h3 class="hndle"><?php _e('Update Donation', 'give'); ?></h3>
130 130
 
131 131
 									<?php
132
-									if ( current_user_can( 'view_give_payments' ) ) {
132
+									if (current_user_can('view_give_payments')) {
133 133
 										echo sprintf(
134 134
 											'<span class="delete-donation" id="delete-donation-%d"><a class="delete-single-donation delete-donation-button dashicons dashicons-trash" href="%s" aria-label="%s"></a></span>',
135 135
 											$payment_id,
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 													), $base_url
142 142
 												), 'give_donation_nonce'
143 143
 											),
144
-											sprintf( __( 'Delete Donation %s', 'give' ), $payment_id )
144
+											sprintf(__('Delete Donation %s', 'give'), $payment_id)
145 145
 										);
146 146
 									}
147 147
 									?>
@@ -158,33 +158,33 @@  discard block
 block discarded – undo
158 158
 										 *
159 159
 										 * @param int $payment_id Payment id.
160 160
 										 */
161
-										do_action( 'give_view_donation_details_totals_before', $payment_id );
161
+										do_action('give_view_donation_details_totals_before', $payment_id);
162 162
 										?>
163 163
 
164 164
 										<div class="give-admin-box-inside">
165 165
 											<p>
166
-												<label for="give-payment-status" class="strong"><?php _e( 'Status:', 'give' ); ?></label>&nbsp;
166
+												<label for="give-payment-status" class="strong"><?php _e('Status:', 'give'); ?></label>&nbsp;
167 167
 												<select id="give-payment-status" name="give-payment-status" class="medium-text">
168
-													<?php foreach ( give_get_payment_statuses() as $key => $status ) : ?>
169
-														<option value="<?php echo esc_attr( $key ); ?>"<?php selected( $payment->status, $key, true ); ?>><?php echo esc_html( $status ); ?></option>
168
+													<?php foreach (give_get_payment_statuses() as $key => $status) : ?>
169
+														<option value="<?php echo esc_attr($key); ?>"<?php selected($payment->status, $key, true); ?>><?php echo esc_html($status); ?></option>
170 170
 													<?php endforeach; ?>
171 171
 												</select>
172
-												<span class="give-donation-status status-<?php echo sanitize_title( $payment->status ); ?>"><span class="give-donation-status-icon"></span></span>
172
+												<span class="give-donation-status status-<?php echo sanitize_title($payment->status); ?>"><span class="give-donation-status-icon"></span></span>
173 173
 											</p>
174 174
 										</div>
175 175
 
176 176
 										<div class="give-admin-box-inside">
177 177
 											<p>
178
-												<label for="give-payment-date" class="strong"><?php _e( 'Date:', 'give' ); ?></label>&nbsp;
179
-												<input type="text" id="give-payment-date" name="give-payment-date" value="<?php echo esc_attr( date( 'm/d/Y', $payment_date ) ); ?>" class="medium-text give_datepicker"/>
178
+												<label for="give-payment-date" class="strong"><?php _e('Date:', 'give'); ?></label>&nbsp;
179
+												<input type="text" id="give-payment-date" name="give-payment-date" value="<?php echo esc_attr(date('m/d/Y', $payment_date)); ?>" class="medium-text give_datepicker"/>
180 180
 											</p>
181 181
 										</div>
182 182
 
183 183
 										<div class="give-admin-box-inside">
184 184
 											<p>
185
-												<label for="give-payment-time-hour" class="strong"><?php _e( 'Time:', 'give' ); ?></label>&nbsp;
186
-												<input type="number" step="1" max="24" id="give-payment-time-hour" name="give-payment-time-hour" value="<?php echo esc_attr( date_i18n( 'H', $payment_date ) ); ?>" class="small-text give-payment-time-hour"/>&nbsp;:&nbsp;
187
-												<input type="number" step="1" max="59" id="give-payment-time-min" name="give-payment-time-min" value="<?php echo esc_attr( date( 'i', $payment_date ) ); ?>" class="small-text give-payment-time-min"/>
185
+												<label for="give-payment-time-hour" class="strong"><?php _e('Time:', 'give'); ?></label>&nbsp;
186
+												<input type="number" step="1" max="24" id="give-payment-time-hour" name="give-payment-time-hour" value="<?php echo esc_attr(date_i18n('H', $payment_date)); ?>" class="small-text give-payment-time-hour"/>&nbsp;:&nbsp;
187
+												<input type="number" step="1" max="59" id="give-payment-time-min" name="give-payment-time-min" value="<?php echo esc_attr(date('i', $payment_date)); ?>" class="small-text give-payment-time-min"/>
188 188
 											</p>
189 189
 										</div>
190 190
 
@@ -198,14 +198,14 @@  discard block
 block discarded – undo
198 198
 										 *
199 199
 										 * @param int $payment_id Payment id.
200 200
 										 */
201
-										do_action( 'give_view_donation_details_update_inner', $payment_id );
201
+										do_action('give_view_donation_details_update_inner', $payment_id);
202 202
 										?>
203 203
 
204 204
 										<div class="give-order-payment give-admin-box-inside">
205 205
 											<p>
206
-												<label for="give-payment-total" class="strong"><?php _e( 'Total Donation:', 'give' ); ?></label>&nbsp;
207
-												<?php echo give_currency_symbol( $payment->currency ); ?>
208
-												&nbsp;<input id="give-payment-total" name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr( give_format_decimal( give_donation_amount( $payment_id ), false, false ) ); ?>"/>
206
+												<label for="give-payment-total" class="strong"><?php _e('Total Donation:', 'give'); ?></label>&nbsp;
207
+												<?php echo give_currency_symbol($payment->currency); ?>
208
+												&nbsp;<input id="give-payment-total" name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr(give_format_decimal(give_donation_amount($payment_id), false, false)); ?>"/>
209 209
 											</p>
210 210
 										</div>
211 211
 
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 										 *
218 218
 										 * @param int $payment_id Payment id.
219 219
 										 */
220
-										do_action( 'give_view_donation_details_totals_after', $payment_id );
220
+										do_action('give_view_donation_details_totals_after', $payment_id);
221 221
 										?>
222 222
 
223 223
 									</div>
@@ -235,27 +235,27 @@  discard block
 block discarded – undo
235 235
 									 *
236 236
 									 * @param int $payment_id Payment id.
237 237
 									 */
238
-									do_action( 'give_view_donation_details_update_before', $payment_id );
238
+									do_action('give_view_donation_details_update_before', $payment_id);
239 239
 									?>
240 240
 
241 241
 									<div id="major-publishing-actions">
242 242
 										<div id="publishing-action">
243 243
 
244
-											<input type="submit" class="button button-primary right" value="<?php esc_attr_e( 'Save Donation', 'give' ); ?>"/>
244
+											<input type="submit" class="button button-primary right" value="<?php esc_attr_e('Save Donation', 'give'); ?>"/>
245 245
 											<?php
246
-											if ( give_is_payment_complete( $payment_id ) ) {
246
+											if (give_is_payment_complete($payment_id)) {
247 247
 												$url = add_query_arg(
248 248
 													array(
249 249
 														'give-action' => 'email_links',
250 250
 														'purchase_id' => $payment_id,
251 251
 													),
252
-													admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $payment_id )
252
+													admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id='.$payment_id)
253 253
 												);
254 254
 
255 255
 												echo sprintf(
256 256
 													'<a href="%1$s" id="give-resend-receipt" class="button-secondary right">%2$s</a>',
257
-													esc_url( $url ),
258
-													esc_html__( 'Resend Receipt', 'give' )
257
+													esc_url($url),
258
+													esc_html__('Resend Receipt', 'give')
259 259
 												);
260 260
 											}
261 261
 											?>
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 									 *
271 271
 									 * @param int $payment_id Payment id.
272 272
 									 */
273
-									do_action( 'give_view_donation_details_update_after', $payment_id );
273
+									do_action('give_view_donation_details_update_after', $payment_id);
274 274
 									?>
275 275
 
276 276
 								</div>
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 
282 282
 							<div id="give-order-details" class="postbox give-order-data">
283 283
 
284
-								<h3 class="hndle"><?php _e( 'Donation Meta', 'give' ); ?></h3>
284
+								<h3 class="hndle"><?php _e('Donation Meta', 'give'); ?></h3>
285 285
 
286 286
 								<div class="inside">
287 287
 									<div class="give-admin-box">
@@ -294,30 +294,30 @@  discard block
 block discarded – undo
294 294
 										 *
295 295
 										 * @param int $payment_id Payment id.
296 296
 										 */
297
-										do_action( 'give_view_donation_details_payment_meta_before', $payment_id );
297
+										do_action('give_view_donation_details_payment_meta_before', $payment_id);
298 298
 
299
-										$gateway = give_get_payment_gateway( $payment_id );
300
-										if ( $gateway ) :
299
+										$gateway = give_get_payment_gateway($payment_id);
300
+										if ($gateway) :
301 301
 										?>
302 302
 											<div class="give-order-gateway give-admin-box-inside">
303 303
 												<p>
304
-													<strong><?php _e( 'Gateway:', 'give' ); ?></strong>&nbsp;
305
-													<?php echo give_get_gateway_admin_label( $gateway ); ?>
304
+													<strong><?php _e('Gateway:', 'give'); ?></strong>&nbsp;
305
+													<?php echo give_get_gateway_admin_label($gateway); ?>
306 306
 												</p>
307 307
 											</div>
308 308
 										<?php endif; ?>
309 309
 
310 310
 										<div class="give-order-payment-key give-admin-box-inside">
311 311
 											<p>
312
-												<strong><?php _e( 'Key:', 'give' ); ?></strong>&nbsp;
313
-												<?php echo give_get_payment_key( $payment_id ); ?>
312
+												<strong><?php _e('Key:', 'give'); ?></strong>&nbsp;
313
+												<?php echo give_get_payment_key($payment_id); ?>
314 314
 											</p>
315 315
 										</div>
316 316
 
317 317
 										<div class="give-order-ip give-admin-box-inside">
318 318
 											<p>
319
-												<strong><?php _e( 'IP:', 'give' ); ?></strong>&nbsp;
320
-												<?php echo esc_html( give_get_payment_user_ip( $payment_id ) ); ?>
319
+												<strong><?php _e('IP:', 'give'); ?></strong>&nbsp;
320
+												<?php echo esc_html(give_get_payment_user_ip($payment_id)); ?>
321 321
 											</p>
322 322
 										</div>
323 323
 
@@ -325,18 +325,18 @@  discard block
 block discarded – undo
325 325
 										// Display the transaction ID present.
326 326
 										// The transaction ID is the charge ID from the gateway.
327 327
 										// For instance, stripe "ch_BzvwYCchqOy5Nt".
328
-										if ( $transaction_id != $payment_id ) : ?>
328
+										if ($transaction_id != $payment_id) : ?>
329 329
 											<div class="give-order-tx-id give-admin-box-inside">
330 330
 												<p>
331
-													<strong><?php _e( 'Transaction ID:', 'give' ); ?> <span class="give-tooltip give-icon give-icon-question"  data-tooltip="<?php echo sprintf( esc_attr__( 'The transaction ID within %s.', 'give' ), $gateway); ?>"></span></strong>&nbsp;
332
-													<?php echo apply_filters( "give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id ); ?>
331
+													<strong><?php _e('Transaction ID:', 'give'); ?> <span class="give-tooltip give-icon give-icon-question"  data-tooltip="<?php echo sprintf(esc_attr__('The transaction ID within %s.', 'give'), $gateway); ?>"></span></strong>&nbsp;
332
+													<?php echo apply_filters("give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id); ?>
333 333
 												</p>
334 334
 											</div>
335 335
 										<?php endif; ?>
336 336
 
337 337
 										<div class="give-admin-box-inside">
338
-											<p><?php $purchase_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&donor=' . absint( give_get_payment_donor_id( $payment_id ) ) ); ?>
339
-												<a href="<?php echo $purchase_url; ?>"><?php _e( 'View all donations for this donor &raquo;', 'give' ); ?></a>
338
+											<p><?php $purchase_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&donor='.absint(give_get_payment_donor_id($payment_id))); ?>
339
+												<a href="<?php echo $purchase_url; ?>"><?php _e('View all donations for this donor &raquo;', 'give'); ?></a>
340 340
 											</p>
341 341
 										</div>
342 342
 
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
 										 *
349 349
 										 * @param int $payment_id Payment id.
350 350
 										 */
351
-										do_action( 'give_view_donation_details_payment_meta_after', $payment_id );
351
+										do_action('give_view_donation_details_payment_meta_after', $payment_id);
352 352
 										?>
353 353
 
354 354
 									</div>
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
 							 *
369 369
 							 * @param int $payment_id Payment id.
370 370
 							 */
371
-							do_action( 'give_view_donation_details_sidebar_after', $payment_id );
371
+							do_action('give_view_donation_details_sidebar_after', $payment_id);
372 372
 							?>
373 373
 
374 374
 						</div>
@@ -388,31 +388,31 @@  discard block
 block discarded – undo
388 388
 							 *
389 389
 							 * @param int $payment_id Payment id.
390 390
 							 */
391
-							do_action( 'give_view_donation_details_main_before', $payment_id );
391
+							do_action('give_view_donation_details_main_before', $payment_id);
392 392
 							?>
393 393
 
394 394
 							<?php $column_count = 'columns-3'; ?>
395 395
 							<div id="give-donation-overview" class="postbox <?php echo $column_count; ?>">
396
-								<h3 class="hndle"><?php _e( 'Donation Information', 'give' ); ?></h3>
396
+								<h3 class="hndle"><?php _e('Donation Information', 'give'); ?></h3>
397 397
 
398 398
 								<div class="inside">
399 399
 
400 400
 									<div class="column-container">
401 401
 										<div class="column">
402 402
 											<p>
403
-												<strong><?php _e( 'Donation Form ID:', 'give' ); ?></strong><br>
403
+												<strong><?php _e('Donation Form ID:', 'give'); ?></strong><br>
404 404
 												<?php
405
-												if ( $payment_meta['form_id'] ) :
405
+												if ($payment_meta['form_id']) :
406 406
 													printf(
407 407
 														'<a href="%1$s">%2$s</a>',
408
-														admin_url( 'post.php?action=edit&post=' . $payment_meta['form_id'] ),
408
+														admin_url('post.php?action=edit&post='.$payment_meta['form_id']),
409 409
 														$payment_meta['form_id']
410 410
 													);
411 411
 												endif;
412 412
 												?>
413 413
 											</p>
414 414
 											<p>
415
-												<strong><?php esc_html_e( 'Donation Form Title:', 'give' ); ?></strong><br>
415
+												<strong><?php esc_html_e('Donation Form Title:', 'give'); ?></strong><br>
416 416
 												<?php
417 417
 												echo Give()->html->forms_dropdown(
418 418
 													array(
@@ -428,21 +428,21 @@  discard block
 block discarded – undo
428 428
 										</div>
429 429
 										<div class="column">
430 430
 											<p>
431
-												<strong><?php _e( 'Donation Date:', 'give' ); ?></strong><br>
432
-												<?php echo date_i18n( give_date_format(), $payment_date ); ?>
431
+												<strong><?php _e('Donation Date:', 'give'); ?></strong><br>
432
+												<?php echo date_i18n(give_date_format(), $payment_date); ?>
433 433
 											</p>
434 434
 											<p>
435
-												<strong><?php _e( 'Donation Level:', 'give' ); ?></strong><br>
435
+												<strong><?php _e('Donation Level:', 'give'); ?></strong><br>
436 436
 												<span class="give-donation-level">
437 437
 													<?php
438
-													$var_prices = give_has_variable_prices( $payment_meta['form_id'] );
439
-													if ( empty( $var_prices ) ) {
440
-														_e( 'n/a', 'give' );
438
+													$var_prices = give_has_variable_prices($payment_meta['form_id']);
439
+													if (empty($var_prices)) {
440
+														_e('n/a', 'give');
441 441
 													} else {
442 442
 														$prices_atts = array();
443
-														if ( $variable_prices = give_get_variable_prices( $payment_meta['form_id'] ) ) {
444
-															foreach ( $variable_prices as $variable_price ) {
445
-																$prices_atts[ $variable_price['_give_id']['level_id'] ] = give_format_amount( $variable_price['_give_amount'], array( 'sanitize' => false ) );
443
+														if ($variable_prices = give_get_variable_prices($payment_meta['form_id'])) {
444
+															foreach ($variable_prices as $variable_price) {
445
+																$prices_atts[$variable_price['_give_id']['level_id']] = give_format_amount($variable_price['_give_amount'], array('sanitize' => false));
446 446
 															}
447 447
 														}
448 448
 														// Variable price dropdown options.
@@ -451,12 +451,12 @@  discard block
 block discarded – undo
451 451
 															'name'             => 'give-variable-price',
452 452
 															'chosen'           => true,
453 453
 															'show_option_all'  => '',
454
-															'show_option_none' => ( '' === get_post_meta( $payment_id, '_give_payment_price_id', true ) ? __( 'None', 'give' ) : '' ),
455
-															'select_atts'      => 'data-prices=' . esc_attr( wp_json_encode( $prices_atts ) ),
454
+															'show_option_none' => ('' === get_post_meta($payment_id, '_give_payment_price_id', true) ? __('None', 'give') : ''),
455
+															'select_atts'      => 'data-prices='.esc_attr(wp_json_encode($prices_atts)),
456 456
 															'selected'         => $payment_meta['price_id'],
457 457
 														);
458 458
 														// Render variable prices select tag html.
459
-														give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true );
459
+														give_get_form_variable_price_dropdown($variable_price_dropdown_option, true);
460 460
 													}
461 461
 													?>
462 462
 												</span>
@@ -464,8 +464,8 @@  discard block
 block discarded – undo
464 464
 										</div>
465 465
 										<div class="column">
466 466
 											<p>
467
-												<strong><?php esc_html_e( 'Total Donation:', 'give' ); ?></strong><br>
468
-												<?php echo give_donation_amount( $payment, true ); ?>
467
+												<strong><?php esc_html_e('Total Donation:', 'give'); ?></strong><br>
468
+												<?php echo give_donation_amount($payment, true); ?>
469 469
 											</p>
470 470
 
471 471
 											<p>
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
 												 *
480 480
 												 * @param int $payment_id Payment id.
481 481
 												 */
482
-												do_action( 'give_donation_details_thead_before', $payment_id );
482
+												do_action('give_donation_details_thead_before', $payment_id);
483 483
 
484 484
 
485 485
 												/**
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
 												 *
492 492
 												 * @param int $payment_id Payment id.
493 493
 												 */
494
-												do_action( 'give_donation_details_thead_after', $payment_id );
494
+												do_action('give_donation_details_thead_after', $payment_id);
495 495
 
496 496
 												/**
497 497
 												 * Fires in donation details page, in the donation-information metabox, before the body elements.
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
 												 *
503 503
 												 * @param int $payment_id Payment id.
504 504
 												 */
505
-												do_action( 'give_donation_details_tbody_before', $payment_id );
505
+												do_action('give_donation_details_tbody_before', $payment_id);
506 506
 
507 507
 												/**
508 508
 												 * Fires in donation details page, in the donation-information metabox, after the body elements.
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
 												 *
514 514
 												 * @param int $payment_id Payment id.
515 515
 												 */
516
-												do_action( 'give_donation_details_tbody_after', $payment_id );
516
+												do_action('give_donation_details_tbody_after', $payment_id);
517 517
 												?>
518 518
 											</p>
519 519
 										</div>
@@ -533,59 +533,59 @@  discard block
 block discarded – undo
533 533
 							 *
534 534
 							 * @param int $payment_id Payment id.
535 535
 							 */
536
-							do_action( 'give_view_donation_details_donor_detail_before', $payment_id );
536
+							do_action('give_view_donation_details_donor_detail_before', $payment_id);
537 537
 							?>
538 538
 
539 539
 							<div id="give-donor-details" class="postbox">
540
-								<h3 class="hndle"><?php _e( 'Donor Details', 'give' ); ?></h3>
540
+								<h3 class="hndle"><?php _e('Donor Details', 'give'); ?></h3>
541 541
 
542 542
 								<div class="inside">
543 543
 
544
-									<?php $donor = new Give_Donor( $donor_id ); ?>
544
+									<?php $donor = new Give_Donor($donor_id); ?>
545 545
 
546 546
 									<div class="column-container donor-info">
547 547
 										<div class="column">
548 548
 											<p>
549
-												<strong><?php _e( 'Donor ID:', 'give' ); ?></strong><br>
549
+												<strong><?php _e('Donor ID:', 'give'); ?></strong><br>
550 550
 												<?php
551
-												if ( ! empty( $donor->id ) ) {
551
+												if ( ! empty($donor->id)) {
552 552
 													printf(
553 553
 														'<a href="%1$s">%2$s</a>',
554
-														admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ),
554
+														admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id),
555 555
 														$donor->id
556 556
 													);
557 557
 												}
558 558
 												?>
559
-												<span>(<a href="#new" class="give-payment-new-donor"><?php _e( 'Create New Donor', 'give' ); ?></a>)</span>
559
+												<span>(<a href="#new" class="give-payment-new-donor"><?php _e('Create New Donor', 'give'); ?></a>)</span>
560 560
 											</p>
561 561
 											<p>
562
-												<strong><?php _e( 'Donor Since:', 'give' ); ?></strong><br>
563
-												<?php echo date_i18n( give_date_format(), strtotime( $donor->date_created ) ) ?>
562
+												<strong><?php _e('Donor Since:', 'give'); ?></strong><br>
563
+												<?php echo date_i18n(give_date_format(), strtotime($donor->date_created)) ?>
564 564
 											</p>
565 565
 										</div>
566 566
 										<div class="column">
567 567
 											<p>
568
-												<strong><?php _e( 'Donor Name:', 'give' ); ?></strong><br>
568
+												<strong><?php _e('Donor Name:', 'give'); ?></strong><br>
569 569
 												<?php
570
-												$donor_billing_name = give_get_donor_name_by( $payment_id, 'donation' );
571
-												$donor_name         = give_get_donor_name_by( $donor_id, 'donor' );
570
+												$donor_billing_name = give_get_donor_name_by($payment_id, 'donation');
571
+												$donor_name         = give_get_donor_name_by($donor_id, 'donor');
572 572
 
573 573
 												// Check whether the donor name and WP_User name is same or not.
574
-												if ( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ) {
575
-													echo $donor_billing_name . ' (<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id" ) ) . '">' . $donor_name . '</a>)';
574
+												if (sanitize_title($donor_billing_name) != sanitize_title($donor_name)) {
575
+													echo $donor_billing_name.' (<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id")).'">'.$donor_name.'</a>)';
576 576
 												} else {
577 577
 													echo $donor_name;
578 578
 												}
579 579
 												?>
580 580
 											</p>
581 581
 											<p>
582
-												<strong><?php _e( 'Donor Email:', 'give' ); ?></strong><br>
582
+												<strong><?php _e('Donor Email:', 'give'); ?></strong><br>
583 583
 												<?php echo $donor->email; ?>
584 584
 											</p>
585 585
 										</div>
586 586
 										<div class="column">
587 587
 											<p>
588
-												<strong><?php _e( 'Change Donor:', 'give' ); ?></strong><br>
588
+												<strong><?php _e('Change Donor:', 'give'); ?></strong><br>
589 589
 												<?php
590 590
 												echo Give()->html->donor_dropdown(
591 591
 													array(
@@ -596,9 +596,9 @@  discard block
 block discarded – undo
596 596
 												?>
597 597
 											</p>
598 598
 											<p>
599
-												<?php if ( ! empty( $company_name ) ) {
599
+												<?php if ( ! empty($company_name)) {
600 600
 													?>
601
-													<strong><?php esc_html_e( 'Company Name:', 'give' ); ?></strong><br>
601
+													<strong><?php esc_html_e('Company Name:', 'give'); ?></strong><br>
602 602
 													<?php
603 603
 													echo $company_name;
604 604
 												} ?>
@@ -609,19 +609,19 @@  discard block
 block discarded – undo
609 609
 									<div class="column-container new-donor" style="display: none">
610 610
 										<div class="column">
611 611
 											<p>
612
-												<label for="give-new-donor-first-name"><?php _e( 'New Donor First Name:', 'give' ); ?></label>
612
+												<label for="give-new-donor-first-name"><?php _e('New Donor First Name:', 'give'); ?></label>
613 613
 												<input id="give-new-donor-first-name" type="text" name="give-new-donor-first-name" value="" class="medium-text"/>
614 614
 											</p>
615 615
 										</div>
616 616
 										<div class="column">
617 617
 											<p>
618
-												<label for="give-new-donor-last-name"><?php _e( 'New Donor Last Name:', 'give' ); ?></label>
618
+												<label for="give-new-donor-last-name"><?php _e('New Donor Last Name:', 'give'); ?></label>
619 619
 												<input id="give-new-donor-last-name" type="text" name="give-new-donor-last-name" value="" class="medium-text"/>
620 620
 											</p>
621 621
 										</div>
622 622
 										<div class="column">
623 623
 											<p>
624
-												<label for="give-new-donor-email"><?php _e( 'New Donor Email:', 'give' ); ?></label>
624
+												<label for="give-new-donor-email"><?php _e('New Donor Email:', 'give'); ?></label>
625 625
 												<input id="give-new-donor-email" type="email" name="give-new-donor-email" value="" class="medium-text"/>
626 626
 											</p>
627 627
 										</div>
@@ -629,9 +629,9 @@  discard block
 block discarded – undo
629 629
 											<p>
630 630
 												<input type="hidden" name="give-current-donor" value="<?php echo $donor->id; ?>"/>
631 631
 												<input type="hidden" id="give-new-donor" name="give-new-donor" value="0"/>
632
-												<a href="#cancel" class="give-payment-new-donor-cancel give-delete"><?php _e( 'Cancel', 'give' ); ?></a>
632
+												<a href="#cancel" class="give-payment-new-donor-cancel give-delete"><?php _e('Cancel', 'give'); ?></a>
633 633
 												<br>
634
-												<em><?php _e( 'Click "Save Donation" to create new donor.', 'give' ); ?></em>
634
+												<em><?php _e('Click "Save Donation" to create new donor.', 'give'); ?></em>
635 635
 											</p>
636 636
 										</div>
637 637
 									</div>
@@ -646,7 +646,7 @@  discard block
 block discarded – undo
646 646
 									 * @param array $payment_meta Payment meta.
647 647
 									 * @param array $user_info    User information.
648 648
 									 */
649
-									do_action( 'give_payment_personal_details_list', $payment_meta, $user_info );
649
+									do_action('give_payment_personal_details_list', $payment_meta, $user_info);
650 650
 
651 651
 									/**
652 652
 									 * Fires on the donation details page, in the donor-details metabox.
@@ -655,7 +655,7 @@  discard block
 block discarded – undo
655 655
 									 *
656 656
 									 * @param int $payment_id Payment id.
657 657
 									 */
658
-									do_action( 'give_payment_view_details', $payment_id );
658
+									do_action('give_payment_view_details', $payment_id);
659 659
 									?>
660 660
 
661 661
 								</div>
@@ -671,11 +671,11 @@  discard block
 block discarded – undo
671 671
 							 *
672 672
 							 * @param int $payment_id Payment id.
673 673
 							 */
674
-							do_action( 'give_view_donation_details_billing_before', $payment_id );
674
+							do_action('give_view_donation_details_billing_before', $payment_id);
675 675
 							?>
676 676
 
677 677
 							<div id="give-billing-details" class="postbox">
678
-								<h3 class="hndle"><?php _e( 'Billing Address', 'give' ); ?></h3>
678
+								<h3 class="hndle"><?php _e('Billing Address', 'give'); ?></h3>
679 679
 
680 680
 								<div class="inside">
681 681
 
@@ -685,9 +685,9 @@  discard block
 block discarded – undo
685 685
 											<div class="data column-container">
686 686
 
687 687
 												<?php
688
-												$address['country'] = ( ! empty( $address['country'] ) ? $address['country'] : give_get_country() );
688
+												$address['country'] = ( ! empty($address['country']) ? $address['country'] : give_get_country());
689 689
 
690
-												$address['state'] = ( ! empty( $address['state'] ) ? $address['state'] : '' );
690
+												$address['state'] = ( ! empty($address['state']) ? $address['state'] : '');
691 691
 
692 692
 												// Get the country list that does not have any states init.
693 693
 												$no_states_country = give_no_states_country_list();
@@ -695,7 +695,7 @@  discard block
 block discarded – undo
695 695
 
696 696
 												<div class="row">
697 697
 													<div id="give-order-address-country-wrap">
698
-														<label class="order-data-address-line"><?php _e( 'Country:', 'give' ); ?></label>
698
+														<label class="order-data-address-line"><?php _e('Country:', 'give'); ?></label>
699 699
 														<?php
700 700
 														echo Give()->html->select(
701 701
 															array(
@@ -705,8 +705,8 @@  discard block
 block discarded – undo
705 705
 																'show_option_all'  => false,
706 706
 																'show_option_none' => false,
707 707
 																'chosen'           => true,
708
-																'placeholder'      => esc_attr__( 'Select a country', 'give' ),
709
-																'data'             => array( 'search-type' => 'no_ajax' ),
708
+																'placeholder'      => esc_attr__('Select a country', 'give'),
709
+																'data'             => array('search-type' => 'no_ajax'),
710 710
 															)
711 711
 														);
712 712
 														?>
@@ -715,35 +715,35 @@  discard block
 block discarded – undo
715 715
 
716 716
 												<div class="row">
717 717
 													<div class="give-wrap-address-line1">
718
-														<label for="give-payment-address-line1" class="order-data-address"><?php _e( 'Address 1:', 'give' ); ?></label>
719
-														<input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr( $address['line1'] ); ?>" class="medium-text"/>
718
+														<label for="give-payment-address-line1" class="order-data-address"><?php _e('Address 1:', 'give'); ?></label>
719
+														<input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr($address['line1']); ?>" class="medium-text"/>
720 720
 													</div>
721 721
 												</div>
722 722
 
723 723
 												<div class="row">
724 724
 													<div class="give-wrap-address-line2">
725
-														<label for="give-payment-address-line2" class="order-data-address-line"><?php _e( 'Address 2:', 'give' ); ?></label>
726
-														<input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr( $address['line2'] ); ?>" class="medium-text"/>
725
+														<label for="give-payment-address-line2" class="order-data-address-line"><?php _e('Address 2:', 'give'); ?></label>
726
+														<input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr($address['line2']); ?>" class="medium-text"/>
727 727
 													</div>
728 728
 												</div>
729 729
 
730 730
 												<div class="row">
731 731
 													<div class="give-wrap-address-city">
732
-														<label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e( 'City:', 'give' ); ?></label>
733
-														<input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr( $address['city'] ); ?>" class="medium-text"/>
732
+														<label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e('City:', 'give'); ?></label>
733
+														<input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr($address['city']); ?>" class="medium-text"/>
734 734
 													</div>
735 735
 												</div>
736 736
 
737 737
 												<?php
738
-												$state_exists = ( ! empty( $address['country'] ) && array_key_exists( $address['country'], $no_states_country ) ? true : false );
738
+												$state_exists = ( ! empty($address['country']) && array_key_exists($address['country'], $no_states_country) ? true : false);
739 739
 												?>
740 740
 												<div class="row">
741
-													<div class="<?php echo( ! empty( $state_exists ) ? 'column-full' : 'column' ); ?> give-column give-column-state">
742
-														<div id="give-order-address-state-wrap" class="<?php echo( ! empty( $state_exists ) ? 'give-hidden' : '' ); ?>">
743
-															<label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e( 'State / Province / County:', 'give' ); ?></label>
741
+													<div class="<?php echo( ! empty($state_exists) ? 'column-full' : 'column'); ?> give-column give-column-state">
742
+														<div id="give-order-address-state-wrap" class="<?php echo( ! empty($state_exists) ? 'give-hidden' : ''); ?>">
743
+															<label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e('State / Province / County:', 'give'); ?></label>
744 744
 															<?php
745
-															$states = give_get_states( $address['country'] );
746
-															if ( ! empty( $states ) ) {
745
+															$states = give_get_states($address['country']);
746
+															if ( ! empty($states)) {
747 747
 																echo Give()->html->select(
748 748
 																	array(
749 749
 																		'options'          => $states,
@@ -752,23 +752,23 @@  discard block
 block discarded – undo
752 752
 																		'show_option_all'  => false,
753 753
 																		'show_option_none' => false,
754 754
 																		'chosen'           => true,
755
-																		'placeholder'      => esc_attr__( 'Select a state', 'give' ),
756
-																		'data'             => array( 'search-type' => 'no_ajax' ),
755
+																		'placeholder'      => esc_attr__('Select a state', 'give'),
756
+																		'data'             => array('search-type' => 'no_ajax'),
757 757
 																	)
758 758
 																);
759 759
 															} else {
760 760
 																?>
761
-																<input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr( $address['state'] ); ?>" class="medium-text"/>
761
+																<input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr($address['state']); ?>" class="medium-text"/>
762 762
 																<?php
763 763
 															}
764 764
 															?>
765 765
 														</div>
766 766
 													</div>
767 767
 
768
-													<div class="<?php echo( ! empty( $state_exists ) ? 'column-full' : 'column' ); ?> give-column give-column-zip">
768
+													<div class="<?php echo( ! empty($state_exists) ? 'column-full' : 'column'); ?> give-column give-column-zip">
769 769
 														<div class="give-wrap-address-zip">
770
-															<label for="give-payment-address-zip" class="order-data-address-line"><?php _e( 'Zip / Postal Code:', 'give' ); ?></label>
771
-															<input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr( $address['zip'] ); ?>" class="medium-text"/>
770
+															<label for="give-payment-address-zip" class="order-data-address-line"><?php _e('Zip / Postal Code:', 'give'); ?></label>
771
+															<input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr($address['zip']); ?>" class="medium-text"/>
772 772
 														</div>
773 773
 													</div>
774 774
 												</div>
@@ -787,7 +787,7 @@  discard block
 block discarded – undo
787 787
 									 *
788 788
 									 * @param int $payment_id Payment id.
789 789
 									 */
790
-									do_action( 'give_payment_billing_details', $payment_id );
790
+									do_action('give_payment_billing_details', $payment_id);
791 791
 									?>
792 792
 
793 793
 								</div>
@@ -803,34 +803,34 @@  discard block
 block discarded – undo
803 803
 							 *
804 804
 							 * @param int $payment_id Payment id.
805 805
 							 */
806
-							do_action( 'give_view_donation_details_billing_after', $payment_id );
806
+							do_action('give_view_donation_details_billing_after', $payment_id);
807 807
 							?>
808 808
 
809 809
 							<div id="give-payment-notes" class="postbox">
810
-								<h3 class="hndle"><?php _e( 'Donation Notes', 'give' ); ?></h3>
810
+								<h3 class="hndle"><?php _e('Donation Notes', 'give'); ?></h3>
811 811
 
812 812
 								<div class="inside">
813 813
 									<div id="give-payment-notes-inner">
814 814
 										<?php
815
-										$notes = give_get_payment_notes( $payment_id );
816
-										if ( ! empty( $notes ) ) {
815
+										$notes = give_get_payment_notes($payment_id);
816
+										if ( ! empty($notes)) {
817 817
 											$no_notes_display = ' style="display:none;"';
818
-											foreach ( $notes as $note ) :
818
+											foreach ($notes as $note) :
819 819
 
820
-												echo give_get_payment_note_html( $note, $payment_id );
820
+												echo give_get_payment_note_html($note, $payment_id);
821 821
 
822 822
 											endforeach;
823 823
 										} else {
824 824
 											$no_notes_display = '';
825 825
 										}
826 826
 
827
-										echo '<p class="give-no-payment-notes"' . $no_notes_display . '>' . esc_html__( 'No donation notes.', 'give' ) . '</p>';
827
+										echo '<p class="give-no-payment-notes"'.$no_notes_display.'>'.esc_html__('No donation notes.', 'give').'</p>';
828 828
 										?>
829 829
 									</div>
830 830
 									<textarea name="give-payment-note" id="give-payment-note" class="large-text"></textarea>
831 831
 
832 832
 									<div class="give-clearfix">
833
-										<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>
833
+										<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>
834 834
 									</div>
835 835
 
836 836
 								</div>
@@ -846,7 +846,7 @@  discard block
 block discarded – undo
846 846
 							 *
847 847
 							 * @param int $payment_id Payment id.
848 848
 							 */
849
-							do_action( 'give_view_donation_details_main_after', $payment_id );
849
+							do_action('give_view_donation_details_main_after', $payment_id);
850 850
 							?>
851 851
 
852 852
 						</div>
@@ -868,11 +868,11 @@  discard block
 block discarded – undo
868 868
 		 *
869 869
 		 * @param int $payment_id Payment id.
870 870
 		 */
871
-		do_action( 'give_view_donation_details_form_bottom', $payment_id );
871
+		do_action('give_view_donation_details_form_bottom', $payment_id);
872 872
 
873
-		wp_nonce_field( 'give_update_payment_details_nonce' );
873
+		wp_nonce_field('give_update_payment_details_nonce');
874 874
 		?>
875
-		<input type="hidden" name="give_payment_id" value="<?php echo esc_attr( $payment_id ); ?>"/>
875
+		<input type="hidden" name="give_payment_id" value="<?php echo esc_attr($payment_id); ?>"/>
876 876
 		<input type="hidden" name="give_action" value="update_payment_details"/>
877 877
 	</form>
878 878
 	<?php
@@ -883,6 +883,6 @@  discard block
 block discarded – undo
883 883
 	 *
884 884
 	 * @param int $payment_id Payment id.
885 885
 	 */
886
-	do_action( 'give_view_donation_details_after', $payment_id );
886
+	do_action('give_view_donation_details_after', $payment_id);
887 887
 	?>
888 888
 </div><!-- /.wrap -->
Please login to merge, or discard this patch.
includes/admin/shortcodes/shortcode-give-totals.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  */
10 10
 
11 11
 // Exit if accessed directly.
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit;
14 14
 }
15 15
 
@@ -23,10 +23,10 @@  discard block
 block discarded – undo
23 23
 	 */
24 24
 	public function __construct() {
25 25
 
26
-		$this->shortcode['title'] = __( 'Give Totals', 'give' );
27
-		$this->shortcode['label'] = __( 'Give Totals', 'give' );
26
+		$this->shortcode['title'] = __('Give Totals', 'give');
27
+		$this->shortcode['label'] = __('Give Totals', 'give');
28 28
 
29
-		parent::__construct( 'give_totals' );
29
+		parent::__construct('give_totals');
30 30
 	}
31 31
 
32 32
 	/**
@@ -39,69 +39,69 @@  discard block
 block discarded – undo
39 39
 
40 40
 		$category_options = array();
41 41
 		$category_lists   = array();
42
-		$categories       = get_terms( 'give_forms_category', apply_filters( 'give_forms_category_dropdown', array() ) );
43
-		if ( give_is_setting_enabled( give_get_option( 'categories' ) ) && ! is_wp_error( $categories ) ) {
44
-			foreach ( $categories as $category ) {
45
-				$category_options[ absint( $category->term_id ) ] = esc_html( $category->name );
42
+		$categories       = get_terms('give_forms_category', apply_filters('give_forms_category_dropdown', array()));
43
+		if (give_is_setting_enabled(give_get_option('categories')) && ! is_wp_error($categories)) {
44
+			foreach ($categories as $category) {
45
+				$category_options[absint($category->term_id)] = esc_html($category->name);
46 46
 			}
47 47
 
48 48
 			$category_lists['type']    = 'listbox';
49 49
 			$category_lists['name']    = 'cats';
50
-			$category_lists['label']   = __( 'Select a Donation Form Category:', 'give' );
51
-			$category_lists['tooltip'] = __( 'Select a Donation Form Category', 'give' );
50
+			$category_lists['label']   = __('Select a Donation Form Category:', 'give');
51
+			$category_lists['tooltip'] = __('Select a Donation Form Category', 'give');
52 52
 			$category_lists['options'] = $category_options;
53 53
 		}
54 54
 
55 55
 		$tag_options = array();
56 56
 		$tag_lists   = array();
57
-		$tags        = get_terms( 'give_forms_tag', apply_filters( 'give_forms_tag_dropdown', array() ) );
58
-		if ( give_is_setting_enabled( give_get_option( 'tags' ) ) && ! is_wp_error( $tags ) ) {
59
-			$tags = get_terms( 'give_forms_tag', apply_filters( 'give_forms_tag_dropdown', array() ) );
60
-			foreach ( $tags as $tag ) {
61
-				$tag_options[ absint( $tag->term_id ) ] = esc_html( $tag->name );
57
+		$tags        = get_terms('give_forms_tag', apply_filters('give_forms_tag_dropdown', array()));
58
+		if (give_is_setting_enabled(give_get_option('tags')) && ! is_wp_error($tags)) {
59
+			$tags = get_terms('give_forms_tag', apply_filters('give_forms_tag_dropdown', array()));
60
+			foreach ($tags as $tag) {
61
+				$tag_options[absint($tag->term_id)] = esc_html($tag->name);
62 62
 			}
63 63
 
64 64
 			$tag_lists['type']    = 'listbox';
65 65
 			$tag_lists['name']    = 'tags';
66
-			$tag_lists['label']   = __( 'Select a Donation Form Tag:', 'give' );
67
-			$tag_lists['tooltip'] = __( 'Select a Donation Form Tag', 'give' );
66
+			$tag_lists['label']   = __('Select a Donation Form Tag:', 'give');
67
+			$tag_lists['tooltip'] = __('Select a Donation Form Tag', 'give');
68 68
 			$tag_lists['options'] = $tag_options;
69 69
 		}
70 70
 
71 71
 		return array(
72 72
 			array(
73 73
 				'type' => 'container',
74
-				'html' => sprintf( '<p class="give-totals-shortcode-container-message">%s</p>',
75
-					__( 'This shortcode shows the total amount raised towards a custom goal for one or several forms regardless of whether they have goals enabled or not.', 'give' )
74
+				'html' => sprintf('<p class="give-totals-shortcode-container-message">%s</p>',
75
+					__('This shortcode shows the total amount raised towards a custom goal for one or several forms regardless of whether they have goals enabled or not.', 'give')
76 76
 				),
77 77
 			),
78 78
 			array(
79 79
 				'type' => 'container',
80
-				'html' => sprintf( '<p class="strong margin-top">%s</p>', __( 'Shortcode Configuration', 'give' ) ),
80
+				'html' => sprintf('<p class="strong margin-top">%s</p>', __('Shortcode Configuration', 'give')),
81 81
 			),
82 82
 			array(
83 83
 				'type'    => 'textbox',
84 84
 				'name'    => 'ids',
85
-				'label'   => __( 'Donation Form IDs:', 'give' ),
86
-				'tooltip' => __( 'Enter the IDs separated by commas for the donation forms you would like to combine within the totals.', 'give' ),
85
+				'label'   => __('Donation Form IDs:', 'give'),
86
+				'tooltip' => __('Enter the IDs separated by commas for the donation forms you would like to combine within the totals.', 'give'),
87 87
 			),
88 88
 			$category_lists,
89 89
 			$tag_lists,
90 90
 			array(
91 91
 				'type'     => 'textbox',
92 92
 				'name'     => 'total_goal',
93
-				'label'    => __( 'Total Goal:', 'give' ),
94
-				'tooltip'  => __( 'Enter the total goal amount that you would like to display.', 'give' ),
93
+				'label'    => __('Total Goal:', 'give'),
94
+				'tooltip'  => __('Enter the total goal amount that you would like to display.', 'give'),
95 95
 				'required' => array(
96
-					'alert' => esc_html__( 'Please enter a valid total goal amount.', 'give' ),
96
+					'alert' => esc_html__('Please enter a valid total goal amount.', 'give'),
97 97
 				),
98 98
 			),
99 99
 			array(
100 100
 				'type'      => 'textbox',
101 101
 				'name'      => 'message',
102
-				'label'     => __( 'Message:', 'give' ),
103
-				'tooltip'   => __( 'Enter a message to display encouraging donors to support the goal.', 'give' ),
104
-				'value'     => apply_filters( 'give_totals_message', __( 'Hey! We\'ve raised {total} of the {total_goal} we are trying to raise for this campaign!', 'give' ) ),
102
+				'label'     => __('Message:', 'give'),
103
+				'tooltip'   => __('Enter a message to display encouraging donors to support the goal.', 'give'),
104
+				'value'     => apply_filters('give_totals_message', __('Hey! We\'ve raised {total} of the {total_goal} we are trying to raise for this campaign!', 'give')),
105 105
 				'multiline' => true,
106 106
 				'minWidth'  => 300,
107 107
 				'minHeight' => 60,
@@ -109,24 +109,24 @@  discard block
 block discarded – undo
109 109
 			array(
110 110
 				'type'    => 'textbox',
111 111
 				'name'    => 'link',
112
-				'label'   => __( 'Link:', 'give' ),
113
-				'tooltip' => __( 'Enter a link to the main campaign donation form.', 'give' ),
112
+				'label'   => __('Link:', 'give'),
113
+				'tooltip' => __('Enter a link to the main campaign donation form.', 'give'),
114 114
 			),
115 115
 			array(
116 116
 				'type'    => 'textbox',
117 117
 				'name'    => 'link_text',
118
-				'label'   => __( 'Link Text:', 'give' ),
119
-				'tooltip' => __( 'Enter hyperlink text for the link to the main campaign donation form.', 'give' ),
120
-				'value'   => __( 'Donate!', 'give' ),
118
+				'label'   => __('Link Text:', 'give'),
119
+				'tooltip' => __('Enter hyperlink text for the link to the main campaign donation form.', 'give'),
120
+				'value'   => __('Donate!', 'give'),
121 121
 			),
122 122
 			array(
123 123
 				'type'    => 'listbox',
124 124
 				'name'    => 'progress_bar',
125
-				'label'   => __( 'Show Progress Bar:', 'give' ),
126
-				'tooltip' => __( 'Select whether you would like to show a goal progress bar.', 'give' ),
125
+				'label'   => __('Show Progress Bar:', 'give'),
126
+				'tooltip' => __('Select whether you would like to show a goal progress bar.', 'give'),
127 127
 				'options' => array(
128
-					'true'  => __( 'Show', 'give' ),
129
-					'false' => __( 'Hide', 'give' ),
128
+					'true'  => __('Show', 'give'),
129
+					'false' => __('Hide', 'give'),
130 130
 				),
131 131
 				'value'   => 'true',
132 132
 			),
Please login to merge, or discard this patch.