Test Failed
Pull Request — master (#3324)
by Devin
07:59
created
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/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/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.
includes/admin/shortcodes/class-shortcode-button.php 1 patch
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly.
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	 * Class constructor
33 33
 	 */
34 34
 	public function __construct() {
35
-		add_action( 'admin_init', array( $this, 'init'), 999 );
35
+		add_action('admin_init', array($this, 'init'), 999);
36 36
 	}
37 37
 
38 38
 	/**
@@ -41,17 +41,17 @@  discard block
 block discarded – undo
41 41
 	 * @since 2.1.0
42 42
 	 * @access public
43 43
 	 */
44
-	public function init(){
45
-		if ( $this->is_add_button() ) {
46
-			add_filter( 'mce_external_plugins', array( $this, 'mce_external_plugins' ), 15 );
44
+	public function init() {
45
+		if ($this->is_add_button()) {
46
+			add_filter('mce_external_plugins', array($this, 'mce_external_plugins'), 15);
47 47
 
48
-			add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_assets' ) );
49
-			add_action( 'admin_enqueue_scripts', array( $this, 'admin_localize_scripts' ), 13 );
50
-			add_action( 'media_buttons', array( $this, 'shortcode_button' ) );
48
+			add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_assets'));
49
+			add_action('admin_enqueue_scripts', array($this, 'admin_localize_scripts'), 13);
50
+			add_action('media_buttons', array($this, 'shortcode_button'));
51 51
 		}
52 52
 
53
-		add_action( "wp_ajax_give_shortcode", array( $this, 'shortcode_ajax' ) );
54
-		add_action( "wp_ajax_nopriv_give_shortcode", array( $this, 'shortcode_ajax' ) );
53
+		add_action("wp_ajax_give_shortcode", array($this, 'shortcode_ajax'));
54
+		add_action("wp_ajax_nopriv_give_shortcode", array($this, 'shortcode_ajax'));
55 55
 	}
56 56
 
57 57
 	/**
@@ -63,13 +63,13 @@  discard block
 block discarded – undo
63 63
 	 *
64 64
 	 * @since 1.0
65 65
 	 */
66
-	public function mce_external_plugins( $plugin_array ) {
66
+	public function mce_external_plugins($plugin_array) {
67 67
 
68
-		if ( ! current_user_can( 'edit_posts' ) && ! current_user_can( 'edit_pages' ) ) {
68
+		if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages')) {
69 69
 			return false;
70 70
 		}
71 71
 
72
-		$plugin_array['give_shortcode'] = GIVE_PLUGIN_URL . 'includes/admin/shortcodes/mce-plugin.js';
72
+		$plugin_array['give_shortcode'] = GIVE_PLUGIN_URL.'includes/admin/shortcodes/mce-plugin.js';
73 73
 
74 74
 		return $plugin_array;
75 75
 	}
@@ -82,19 +82,19 @@  discard block
 block discarded – undo
82 82
 	 * @since 1.0
83 83
 	 */
84 84
 	public function admin_enqueue_assets() {
85
-		$direction = ( is_rtl() || isset( $_GET['d'] ) && 'rtl' === $_GET['d'] ) ? '.rtl' : '';
85
+		$direction = (is_rtl() || isset($_GET['d']) && 'rtl' === $_GET['d']) ? '.rtl' : '';
86 86
 
87 87
 		wp_enqueue_script(
88 88
 			'give_shortcode',
89
-			GIVE_PLUGIN_URL . 'assets/dist/js/admin-shortcodes.js',
90
-			array( 'jquery' ),
89
+			GIVE_PLUGIN_URL.'assets/dist/js/admin-shortcodes.js',
90
+			array('jquery'),
91 91
 			GIVE_VERSION,
92 92
 			true
93 93
 		);
94 94
 
95 95
 		wp_enqueue_style(
96 96
 			'give-admin-shortcode-button-style',
97
-			GIVE_PLUGIN_URL . 'assets/dist/css/admin-shortcode-button' . $direction . '.css',
97
+			GIVE_PLUGIN_URL.'assets/dist/css/admin-shortcode-button'.$direction.'.css',
98 98
 			array(),
99 99
 			GIVE_VERSION
100 100
 		);
@@ -109,17 +109,17 @@  discard block
 block discarded – undo
109 109
 	 */
110 110
 	public function admin_localize_scripts() {
111 111
 
112
-		if ( ! empty( self::$shortcodes ) ) {
112
+		if ( ! empty(self::$shortcodes)) {
113 113
 
114 114
 			$variables = array();
115 115
 
116
-			foreach ( self::$shortcodes as $shortcode => $values ) {
117
-				if ( ! empty( $values['required'] ) ) {
118
-					$variables[ $shortcode ] = $values['required'];
116
+			foreach (self::$shortcodes as $shortcode => $values) {
117
+				if ( ! empty($values['required'])) {
118
+					$variables[$shortcode] = $values['required'];
119 119
 				}
120 120
 			}
121 121
 
122
-			wp_localize_script( 'give_shortcode', 'scShortcodes', $variables );
122
+			wp_localize_script('give_shortcode', 'scShortcodes', $variables);
123 123
 		}
124 124
 	}
125 125
 
@@ -134,16 +134,16 @@  discard block
 block discarded – undo
134 134
 
135 135
 		$shortcodes = array();
136 136
 
137
-		foreach ( self::$shortcodes as $shortcode => $values ) {
137
+		foreach (self::$shortcodes as $shortcode => $values) {
138 138
 
139 139
 			/**
140 140
 			 * Filters the condition for including the current shortcode
141 141
 			 *
142 142
 			 * @since 1.0
143 143
 			 */
144
-			if ( apply_filters( sanitize_title( $shortcode ) . '_condition', true ) ) {
144
+			if (apply_filters(sanitize_title($shortcode).'_condition', true)) {
145 145
 
146
-				$shortcodes[ $shortcode ] = sprintf(
146
+				$shortcodes[$shortcode] = sprintf(
147 147
 					'<div class="sc-shortcode mce-menu-item give-shortcode-item-%1$s" data-shortcode="%2$s">%3$s</div>',
148 148
 					$shortcode,
149 149
 					$shortcode,
@@ -152,37 +152,37 @@  discard block
 block discarded – undo
152 152
 			}
153 153
 		}
154 154
 
155
-		if ( ! empty( $shortcodes ) ) {
155
+		if ( ! empty($shortcodes)) {
156 156
 
157 157
 			// check current WP version
158
-			$img = ( version_compare( get_bloginfo( 'version' ), '3.5', '<' ) )
159
-				? '<img src="' . GIVE_PLUGIN_URL . 'assets/dist/images/give-media.png" />'
160
-				: '<span class="wp-media-buttons-icon" id="give-media-button" style="background-image: url(' . give_svg_icons( 'give_grey' ) . ');"></span>';
158
+			$img = (version_compare(get_bloginfo('version'), '3.5', '<'))
159
+				? '<img src="'.GIVE_PLUGIN_URL.'assets/dist/images/give-media.png" />'
160
+				: '<span class="wp-media-buttons-icon" id="give-media-button" style="background-image: url('.give_svg_icons('give_grey').');"></span>';
161 161
 
162
-			reset( $shortcodes );
162
+			reset($shortcodes);
163 163
 
164
-			if ( 1 === count( $shortcodes ) ) {
164
+			if (1 === count($shortcodes)) {
165 165
 
166
-				$shortcode = key( $shortcodes );
166
+				$shortcode = key($shortcodes);
167 167
 
168 168
 				printf(
169 169
 					'<button type="button" class="button sc-shortcode" data-shortcode="%s">%s</button>',
170 170
 					$shortcode,
171
-					sprintf( '%s %s %s',
171
+					sprintf('%s %s %s',
172 172
 						$img,
173
-						__( 'Insert', 'give' ),
174
-						self::$shortcodes[ $shortcode ]['label']
173
+						__('Insert', 'give'),
174
+						self::$shortcodes[$shortcode]['label']
175 175
 					)
176 176
 				);
177 177
 			} else {
178 178
 				printf(
179
-					'<div class="sc-wrap">' .
180
-					'<button class="button sc-button" type="button">%s %s</button>' .
181
-					'<div class="sc-menu mce-menu">%s</div>' .
179
+					'<div class="sc-wrap">'.
180
+					'<button class="button sc-button" type="button">%s %s</button>'.
181
+					'<div class="sc-menu mce-menu">%s</div>'.
182 182
 					'</div>',
183 183
 					$img,
184
-					__( 'Give Shortcodes', 'give' ),
185
-					implode( '', array_values( $shortcodes ) )
184
+					__('Give Shortcodes', 'give'),
185
+					implode('', array_values($shortcodes))
186 186
 				);
187 187
 			}
188 188
 		}
@@ -197,15 +197,15 @@  discard block
 block discarded – undo
197 197
 	 */
198 198
 	public function shortcode_ajax() {
199 199
 
200
-		$shortcode = isset( $_POST['shortcode'] ) ? $_POST['shortcode'] : false;
200
+		$shortcode = isset($_POST['shortcode']) ? $_POST['shortcode'] : false;
201 201
 		$response  = false;
202 202
 
203
-		if ( $shortcode && array_key_exists( $shortcode, self::$shortcodes ) ) {
203
+		if ($shortcode && array_key_exists($shortcode, self::$shortcodes)) {
204 204
 
205
-			$data = self::$shortcodes[ $shortcode ];
205
+			$data = self::$shortcodes[$shortcode];
206 206
 
207
-			if ( ! empty( $data['errors'] ) ) {
208
-				$data['btn_okay'] = array( esc_html__( 'Okay', 'give' ) );
207
+			if ( ! empty($data['errors'])) {
208
+				$data['btn_okay'] = array(esc_html__('Okay', 'give'));
209 209
 			}
210 210
 
211 211
 			$response = array(
@@ -217,10 +217,10 @@  discard block
 block discarded – undo
217 217
 			);
218 218
 		} else {
219 219
 			// todo: handle error
220
-			error_log( print_r( 'AJAX error!', 1 ) );
220
+			error_log(print_r('AJAX error!', 1));
221 221
 		}
222 222
 
223
-		wp_send_json( $response );
223
+		wp_send_json($response);
224 224
 	}
225 225
 
226 226
 
@@ -234,21 +234,21 @@  discard block
 block discarded – undo
234 234
 	private function is_add_button() {
235 235
 		global $pagenow;
236 236
 
237
-		$shortcode_button_pages = apply_filters( 'give_shortcode_button_pages', array(
237
+		$shortcode_button_pages = apply_filters('give_shortcode_button_pages', array(
238 238
 			'post.php',
239 239
 			'page.php',
240 240
 			'post-new.php',
241 241
 			'post-edit.php',
242 242
 			'edit.php',
243 243
 			'edit.php?post_type=page',
244
-		) );
244
+		));
245 245
 
246 246
 		// Only run in admin post/page creation and edit screens
247 247
 		if (
248 248
 			! is_admin()
249
-			|| ! in_array( $pagenow, $shortcode_button_pages )
250
-			|| ! apply_filters( 'give_shortcode_button_condition', true )
251
-			|| empty( self::$shortcodes )
249
+			|| ! in_array($pagenow, $shortcode_button_pages)
250
+			|| ! apply_filters('give_shortcode_button_condition', true)
251
+			|| empty(self::$shortcodes)
252 252
 		) {
253 253
 			return false;
254 254
 		}
Please login to merge, or discard this patch.
includes/admin/forms/dashboard-columns.php 1 patch
Spacing   +76 added lines, -76 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
 
@@ -27,34 +27,34 @@  discard block
 block discarded – undo
27 27
  * @return array $form_columns Updated array of forms columns
28 28
  *  Post Type List Table
29 29
  */
30
-function give_form_columns( $give_form_columns ) {
30
+function give_form_columns($give_form_columns) {
31 31
 
32 32
 	// Standard columns
33 33
 	$give_form_columns = array(
34 34
 		'cb'            => '<input type="checkbox"/>',
35
-		'title'         => __( 'Name', 'give' ),
36
-		'form_category' => __( 'Categories', 'give' ),
37
-		'form_tag'      => __( 'Tags', 'give' ),
38
-		'price'         => __( 'Amount', 'give' ),
39
-		'goal'          => __( 'Goal', 'give' ),
40
-		'donations'     => __( 'Donations', 'give' ),
41
-		'earnings'      => __( 'Income', 'give' ),
42
-		'shortcode'     => __( 'Shortcode', 'give' ),
43
-		'date'          => __( 'Date', 'give' ),
35
+		'title'         => __('Name', 'give'),
36
+		'form_category' => __('Categories', 'give'),
37
+		'form_tag'      => __('Tags', 'give'),
38
+		'price'         => __('Amount', 'give'),
39
+		'goal'          => __('Goal', 'give'),
40
+		'donations'     => __('Donations', 'give'),
41
+		'earnings'      => __('Income', 'give'),
42
+		'shortcode'     => __('Shortcode', 'give'),
43
+		'date'          => __('Date', 'give'),
44 44
 	);
45 45
 
46 46
 	// Does the user want categories / tags?
47
-	if ( ! give_is_setting_enabled( give_get_option( 'categories', 'disabled' ) ) ) {
48
-		unset( $give_form_columns['form_category'] );
47
+	if ( ! give_is_setting_enabled(give_get_option('categories', 'disabled'))) {
48
+		unset($give_form_columns['form_category']);
49 49
 	}
50
-	if ( ! give_is_setting_enabled( give_get_option( 'tags', 'disabled' ) ) ) {
51
-		unset( $give_form_columns['form_tag'] );
50
+	if ( ! give_is_setting_enabled(give_get_option('tags', 'disabled'))) {
51
+		unset($give_form_columns['form_tag']);
52 52
 	}
53 53
 
54
-	return apply_filters( 'give_forms_columns', $give_form_columns );
54
+	return apply_filters('give_forms_columns', $give_form_columns);
55 55
 }
56 56
 
57
-add_filter( 'manage_edit-give_forms_columns', 'give_form_columns' );
57
+add_filter('manage_edit-give_forms_columns', 'give_form_columns');
58 58
 
59 59
 /**
60 60
  * Render Give Form Columns
@@ -66,70 +66,70 @@  discard block
 block discarded – undo
66 66
  *
67 67
  * @return void
68 68
  */
69
-function give_render_form_columns( $column_name, $post_id ) {
70
-	if ( get_post_type( $post_id ) == 'give_forms' ) {
69
+function give_render_form_columns($column_name, $post_id) {
70
+	if (get_post_type($post_id) == 'give_forms') {
71 71
 
72
-		switch ( $column_name ) {
72
+		switch ($column_name) {
73 73
 			case 'form_category':
74
-				echo get_the_term_list( $post_id, 'give_forms_category', '', ', ', '' );
74
+				echo get_the_term_list($post_id, 'give_forms_category', '', ', ', '');
75 75
 				break;
76 76
 			case 'form_tag':
77
-				echo get_the_term_list( $post_id, 'give_forms_tag', '', ', ', '' );
77
+				echo get_the_term_list($post_id, 'give_forms_tag', '', ', ', '');
78 78
 				break;
79 79
 			case 'price':
80
-				if ( give_has_variable_prices( $post_id ) ) {
81
-					echo give_price_range( $post_id );
80
+				if (give_has_variable_prices($post_id)) {
81
+					echo give_price_range($post_id);
82 82
 				} else {
83
-					echo give_price( $post_id, false );
84
-					printf( '<input type="hidden" class="formprice-%1$s" value="%2$s" />', esc_attr( $post_id ), esc_attr( give_get_form_price( $post_id ) ) );
83
+					echo give_price($post_id, false);
84
+					printf('<input type="hidden" class="formprice-%1$s" value="%2$s" />', esc_attr($post_id), esc_attr(give_get_form_price($post_id)));
85 85
 				}
86 86
 				break;
87 87
 			case 'goal':
88
-				if ( give_is_setting_enabled( give_get_meta( $post_id, '_give_goal_option', true ) ) ) {
88
+				if (give_is_setting_enabled(give_get_meta($post_id, '_give_goal_option', true))) {
89 89
 
90
-					echo give_admin_form_goal_stats( $post_id );
90
+					echo give_admin_form_goal_stats($post_id);
91 91
 
92 92
 				} else {
93
-					_e( 'No Goal Set', 'give' );
93
+					_e('No Goal Set', 'give');
94 94
 				}
95 95
 
96 96
 				printf(
97 97
 					'<input type="hidden" class="formgoal-%1$s" value="%2$s" />',
98
-					esc_attr( $post_id ),
99
-					give_get_form_goal( $post_id )
98
+					esc_attr($post_id),
99
+					give_get_form_goal($post_id)
100 100
 				);
101 101
 
102 102
 				break;
103 103
 			case 'donations':
104
-				if ( current_user_can( 'view_give_form_stats', $post_id ) ) {
104
+				if (current_user_can('view_give_form_stats', $post_id)) {
105 105
 					printf(
106 106
 						'<a href="%1$s">%2$s</a>',
107
-						esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&form_id=' . $post_id ) ),
108
-						give_get_form_sales_stats( $post_id )
107
+						esc_url(admin_url('edit.php?post_type=give_forms&page=give-payment-history&form_id='.$post_id)),
108
+						give_get_form_sales_stats($post_id)
109 109
 					);
110 110
 				} else {
111 111
 					echo '-';
112 112
 				}
113 113
 				break;
114 114
 			case 'earnings':
115
-				if ( current_user_can( 'view_give_form_stats', $post_id ) ) {
115
+				if (current_user_can('view_give_form_stats', $post_id)) {
116 116
 					printf(
117 117
 						'<a href="%1$s">%2$s</a>',
118
-						esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-reports&tab=forms&form-id=' . $post_id ) ),
119
-						give_currency_filter( give_format_amount( give_get_form_earnings_stats( $post_id ), array( 'sanitize' => false ) ) )
118
+						esc_url(admin_url('edit.php?post_type=give_forms&page=give-reports&tab=forms&form-id='.$post_id)),
119
+						give_currency_filter(give_format_amount(give_get_form_earnings_stats($post_id), array('sanitize' => false)))
120 120
 					);
121 121
 				} else {
122 122
 					echo '-';
123 123
 				}
124 124
 				break;
125 125
 			case 'shortcode':
126
-				printf( '<input onclick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly="" value="[give_form id=&#34;%s&#34;]"', absint( $post_id ) );
126
+				printf('<input onclick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly="" value="[give_form id=&#34;%s&#34;]"', absint($post_id));
127 127
 				break;
128 128
 		}// End switch().
129 129
 	}// End if().
130 130
 }
131 131
 
132
-add_action( 'manage_posts_custom_column', 'give_render_form_columns', 10, 2 );
132
+add_action('manage_posts_custom_column', 'give_render_form_columns', 10, 2);
133 133
 
134 134
 /**
135 135
  * Registers the sortable columns in the list table
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
  *
141 141
  * @return array $columns Array of sortable columns
142 142
  */
143
-function give_sortable_form_columns( $columns ) {
143
+function give_sortable_form_columns($columns) {
144 144
 	$columns['price']     = 'amount';
145 145
 	$columns['sales']     = 'sales';
146 146
 	$columns['earnings']  = 'earnings';
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 	return $columns;
151 151
 }
152 152
 
153
-add_filter( 'manage_edit-give_forms_sortable_columns', 'give_sortable_form_columns' );
153
+add_filter('manage_edit-give_forms_sortable_columns', 'give_sortable_form_columns');
154 154
 
155 155
 /**
156 156
  * Sorts Columns in the Forms List Table
@@ -161,13 +161,13 @@  discard block
 block discarded – undo
161 161
  *
162 162
  * @return array $vars Array of all the sort variables.
163 163
  */
164
-function give_sort_forms( $vars ) {
164
+function give_sort_forms($vars) {
165 165
 	// Check if we're viewing the "give_forms" post type.
166
-	if ( ! isset( $vars['post_type'] ) || ! isset( $vars['orderby'] ) || 'give_forms' !== $vars['post_type'] ) {
166
+	if ( ! isset($vars['post_type']) || ! isset($vars['orderby']) || 'give_forms' !== $vars['post_type']) {
167 167
 		return $vars;
168 168
 	}
169 169
 
170
-	switch ( $vars['orderby'] ) {
170
+	switch ($vars['orderby']) {
171 171
 		// Check if 'orderby' is set to "sales".
172 172
 		case 'sales':
173 173
 			$vars = array_merge(
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 
193 193
 		// Check if "orderby" is set to "price/amount".
194 194
 		case 'amount':
195
-			$multi_level_meta_key = ( 'asc' === $vars['order'] ) ? '_give_levels_minimum_amount' : '_give_levels_maximum_amount';
195
+			$multi_level_meta_key = ('asc' === $vars['order']) ? '_give_levels_minimum_amount' : '_give_levels_maximum_amount';
196 196
 
197 197
 			$vars['orderby']    = 'meta_value_num';
198 198
 			$vars['meta_query'] = array(
@@ -244,17 +244,17 @@  discard block
 block discarded – undo
244 244
  *
245 245
  * @return array       Array of all sort variables.
246 246
  */
247
-function give_filter_forms( $vars ) {
248
-	if ( isset( $vars['post_type'] ) && 'give_forms' == $vars['post_type'] ) {
247
+function give_filter_forms($vars) {
248
+	if (isset($vars['post_type']) && 'give_forms' == $vars['post_type']) {
249 249
 
250 250
 		// If an author ID was passed, use it
251
-		if ( isset( $_REQUEST['author'] ) && ! current_user_can( 'view_give_reports' ) ) {
251
+		if (isset($_REQUEST['author']) && ! current_user_can('view_give_reports')) {
252 252
 
253 253
 			$author_id = $_REQUEST['author'];
254
-			if ( (int) $author_id !== get_current_user_id() ) {
255
-				wp_die( esc_html__( 'You do not have permission to view this data.', 'give' ), esc_html__( 'Error', 'give' ), array(
254
+			if ((int) $author_id !== get_current_user_id()) {
255
+				wp_die(esc_html__('You do not have permission to view this data.', 'give'), esc_html__('Error', 'give'), array(
256 256
 					'response' => 403,
257
-				) );
257
+				));
258 258
 			}
259 259
 			$vars = array_merge(
260 260
 				$vars,
@@ -278,11 +278,11 @@  discard block
 block discarded – undo
278 278
  * @return void
279 279
  */
280 280
 function give_forms_load() {
281
-	add_filter( 'request', 'give_sort_forms' );
282
-	add_filter( 'request', 'give_filter_forms' );
281
+	add_filter('request', 'give_sort_forms');
282
+	add_filter('request', 'give_filter_forms');
283 283
 }
284 284
 
285
-add_action( 'load-edit.php', 'give_forms_load', 9999 );
285
+add_action('load-edit.php', 'give_forms_load', 9999);
286 286
 
287 287
 /**
288 288
  * Remove Forms Month Filter
@@ -296,17 +296,17 @@  discard block
 block discarded – undo
296 296
  * @global      $typenow The post type we are viewing.
297 297
  * @return array Empty array disables the dropdown.
298 298
  */
299
-function give_remove_month_filter( $dates ) {
299
+function give_remove_month_filter($dates) {
300 300
 	global $typenow;
301 301
 
302
-	if ( $typenow == 'give_forms' ) {
302
+	if ($typenow == 'give_forms') {
303 303
 		$dates = array();
304 304
 	}
305 305
 
306 306
 	return $dates;
307 307
 }
308 308
 
309
-add_filter( 'months_dropdown_results', 'give_remove_month_filter', 99 );
309
+add_filter('months_dropdown_results', 'give_remove_month_filter', 99);
310 310
 
311 311
 /**
312 312
  * Updates price when saving post
@@ -318,33 +318,33 @@  discard block
 block discarded – undo
318 318
  *
319 319
  * @return int|null
320 320
  */
321
-function give_price_save_quick_edit( $post_id ) {
322
-	if ( ! isset( $_POST['post_type'] ) || 'give_forms' !== $_POST['post_type'] ) {
321
+function give_price_save_quick_edit($post_id) {
322
+	if ( ! isset($_POST['post_type']) || 'give_forms' !== $_POST['post_type']) {
323 323
 		return;
324 324
 	}
325
-	if ( ! current_user_can( 'edit_post', $post_id ) ) {
325
+	if ( ! current_user_can('edit_post', $post_id)) {
326 326
 		return $post_id;
327 327
 	}
328
-	if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
328
+	if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
329 329
 		return $post_id;
330 330
 	}
331 331
 
332
-	if ( isset( $_REQUEST['_give_regprice'] ) ) {
333
-		give_update_meta( $post_id, '_give_set_price', give_sanitize_amount_for_db( strip_tags( stripslashes( $_REQUEST['_give_regprice'] ) ) ) );
332
+	if (isset($_REQUEST['_give_regprice'])) {
333
+		give_update_meta($post_id, '_give_set_price', give_sanitize_amount_for_db(strip_tags(stripslashes($_REQUEST['_give_regprice']))));
334 334
 	}
335 335
 
336 336
 	// Override the Donation minimum amount.
337 337
 	if (
338
-		isset( $_REQUEST['_give_custom_amount'], $_REQUEST['_give_set_price'], $_REQUEST['_give_price_option'], $_REQUEST['_give_custom_amount_range'] )
338
+		isset($_REQUEST['_give_custom_amount'], $_REQUEST['_give_set_price'], $_REQUEST['_give_price_option'], $_REQUEST['_give_custom_amount_range'])
339 339
 		&& 'set' === $_REQUEST['_give_price_option']
340
-		&& give_is_setting_enabled( $_REQUEST['_give_custom_amount'] )
341
-		&& give_maybe_sanitize_amount( $_REQUEST['_give_set_price'] ) < give_maybe_sanitize_amount( $_REQUEST['_give_custom_amount_range']['minimum'] )
340
+		&& give_is_setting_enabled($_REQUEST['_give_custom_amount'])
341
+		&& give_maybe_sanitize_amount($_REQUEST['_give_set_price']) < give_maybe_sanitize_amount($_REQUEST['_give_custom_amount_range']['minimum'])
342 342
 	) {
343
-		give_update_meta( $post_id, '_give_custom_amount_range_minimum', give_sanitize_amount_for_db( $_REQUEST['_give_set_price'] ) );
343
+		give_update_meta($post_id, '_give_custom_amount_range_minimum', give_sanitize_amount_for_db($_REQUEST['_give_set_price']));
344 344
 	}
345 345
 }
346 346
 
347
-add_action( 'save_post', 'give_price_save_quick_edit' );
347
+add_action('save_post', 'give_price_save_quick_edit');
348 348
 
349 349
 /**
350 350
  * Process bulk edit actions via AJAX
@@ -354,18 +354,18 @@  discard block
 block discarded – undo
354 354
  */
355 355
 function give_save_bulk_edit() {
356 356
 
357
-	$post_ids = ( isset( $_POST['post_ids'] ) && ! empty( $_POST['post_ids'] ) ) ? $_POST['post_ids'] : array();
357
+	$post_ids = (isset($_POST['post_ids']) && ! empty($_POST['post_ids'])) ? $_POST['post_ids'] : array();
358 358
 
359
-	if ( ! empty( $post_ids ) && is_array( $post_ids ) ) {
360
-		$price = isset( $_POST['price'] ) ? strip_tags( stripslashes( $_POST['price'] ) ) : 0;
361
-		foreach ( $post_ids as $post_id ) {
359
+	if ( ! empty($post_ids) && is_array($post_ids)) {
360
+		$price = isset($_POST['price']) ? strip_tags(stripslashes($_POST['price'])) : 0;
361
+		foreach ($post_ids as $post_id) {
362 362
 
363
-			if ( ! current_user_can( 'edit_post', $post_id ) ) {
363
+			if ( ! current_user_can('edit_post', $post_id)) {
364 364
 				continue;
365 365
 			}
366 366
 
367
-			if ( ! empty( $price ) ) {
368
-				give_update_meta( $post_id, '_give_set_price', give_sanitize_amount_for_db( $price ) );
367
+			if ( ! empty($price)) {
368
+				give_update_meta($post_id, '_give_set_price', give_sanitize_amount_for_db($price));
369 369
 			}
370 370
 		}
371 371
 	}
@@ -373,4 +373,4 @@  discard block
 block discarded – undo
373 373
 	die();
374 374
 }
375 375
 
376
-add_action( 'wp_ajax_give_save_bulk_edit', 'give_save_bulk_edit' );
376
+add_action('wp_ajax_give_save_bulk_edit', 'give_save_bulk_edit');
Please login to merge, or discard this patch.
includes/admin/abstract-admin-settings-page.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@  discard block
 block discarded – undo
9 9
  * @since       1.8
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit; // Exit if accessed directly
14 14
 }
15 15
 
16
-if ( ! class_exists( 'Give_Settings_Page' ) ) :
16
+if ( ! class_exists('Give_Settings_Page')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Settings_Page.
@@ -70,25 +70,25 @@  discard block
 block discarded – undo
70 70
 			// Get current setting page.
71 71
 			$this->current_setting_page = give_get_current_setting_page();
72 72
 
73
-			add_filter( "give_default_setting_tab_section_{$this->id}", array( $this, 'set_default_setting_tab' ), 10 );
74
-			add_filter( "{$this->current_setting_page}_tabs_array", array( $this, 'add_settings_page' ), 20 );
75
-			add_action( "{$this->current_setting_page}_settings_{$this->id}_page", array( $this, 'output' ) );
73
+			add_filter("give_default_setting_tab_section_{$this->id}", array($this, 'set_default_setting_tab'), 10);
74
+			add_filter("{$this->current_setting_page}_tabs_array", array($this, 'add_settings_page'), 20);
75
+			add_action("{$this->current_setting_page}_settings_{$this->id}_page", array($this, 'output'));
76 76
 
77 77
 			// Output section only if exist.
78 78
 			$sections = $this->get_sections();
79
-			if ( ! empty( $sections ) ) {
80
-				add_action( "{$this->current_setting_page}_sections_{$this->id}_page", array(
79
+			if ( ! empty($sections)) {
80
+				add_action("{$this->current_setting_page}_sections_{$this->id}_page", array(
81 81
 					$this,
82 82
 					'output_sections',
83
-				) );
83
+				));
84 84
 			}
85 85
 
86 86
 			// Save hide button by default.
87 87
 			$GLOBALS['give_hide_save_button'] = true;
88 88
 
89 89
 			// Enable saving feature.
90
-			if ( $this->enable_save ) {
91
-				add_action( "{$this->current_setting_page}_save_{$this->id}", array( $this, 'save' ) );
90
+			if ($this->enable_save) {
91
+				add_action("{$this->current_setting_page}_save_{$this->id}", array($this, 'save'));
92 92
 			}
93 93
 		}
94 94
 
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 		 *
114 114
 		 * @return string
115 115
 		 */
116
-		function set_default_setting_tab( $setting_tab ) {
116
+		function set_default_setting_tab($setting_tab) {
117 117
 			return $this->default_tab;
118 118
 		}
119 119
 
@@ -126,8 +126,8 @@  discard block
 block discarded – undo
126 126
 		 *
127 127
 		 * @return array
128 128
 		 */
129
-		public function add_settings_page( $pages ) {
130
-			$pages[ $this->id ] = $this->label;
129
+		public function add_settings_page($pages) {
130
+			$pages[$this->id] = $this->label;
131 131
 
132 132
 			return $pages;
133 133
 		}
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 			 *
147 147
 			 * @param  array $settings
148 148
 			 */
149
-			$settings = apply_filters( 'give_get_settings_' . $this->id, array() );
149
+			$settings = apply_filters('give_get_settings_'.$this->id, array());
150 150
 
151 151
 			// Output.
152 152
 			return $settings;
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 		 * @return array
160 160
 		 */
161 161
 		public function get_sections() {
162
-			return apply_filters( 'give_get_sections_' . $this->id, array() );
162
+			return apply_filters('give_get_sections_'.$this->id, array());
163 163
 		}
164 164
 
165 165
 		/**
@@ -176,40 +176,40 @@  discard block
 block discarded – undo
176 176
 			$sections = $this->get_sections();
177 177
 
178 178
 			// Bailout.
179
-			if ( empty( $sections ) ) {
179
+			if (empty($sections)) {
180 180
 				return;
181 181
 			}
182 182
 
183 183
 			// Show section settings only if setting section exist.
184
-			if ( $current_section && ! in_array( $current_section, array_keys( $sections ), true ) ) {
185
-				echo wp_kses_post( '<div class="error"><p>' . __( 'Oops, this settings page does not exist.', 'give' ) . '</p></div>' );
184
+			if ($current_section && ! in_array($current_section, array_keys($sections), true)) {
185
+				echo wp_kses_post('<div class="error"><p>'.__('Oops, this settings page does not exist.', 'give').'</p></div>');
186 186
 				$GLOBALS['give_hide_save_button'] = true;
187 187
 
188 188
 				return;
189 189
 			}
190 190
 
191
-			if ( is_null( $this->current_setting_page ) ) {
191
+			if (is_null($this->current_setting_page)) {
192 192
 				$this->current_setting_page = give_get_current_setting_page();
193 193
 			}
194 194
 
195 195
 			$section_list = array();
196
-			foreach ( $sections as $id => $label ) {
196
+			foreach ($sections as $id => $label) {
197 197
 				/**
198 198
 				 * Fire the filter to hide particular section on tab.
199 199
 				 *
200 200
 				 * @since 2.0
201 201
 				 */
202
-				if ( apply_filters( "give_hide_section_{$id}_on_{$this->id}_page", false, $sections, $this->id ) ) {
202
+				if (apply_filters("give_hide_section_{$id}_on_{$this->id}_page", false, $sections, $this->id)) {
203 203
 					continue;
204 204
 				}
205 205
 
206
-				$section_list[] = '<li><a href="' . admin_url( 'edit.php?post_type=give_forms&page=' . $this->current_setting_page . '&tab=' . $this->id . '&section=' . sanitize_title( $id ) ) . '" class="' . ( $current_section === $id ? 'current' : '' ) . '">' . $label . '</a>';
206
+				$section_list[] = '<li><a href="'.admin_url('edit.php?post_type=give_forms&page='.$this->current_setting_page.'&tab='.$this->id.'&section='.sanitize_title($id)).'" class="'.($current_section === $id ? 'current' : '').'">'.$label.'</a>';
207 207
 			}
208 208
 
209
-			echo wp_kses_post( sprintf(
209
+			echo wp_kses_post(sprintf(
210 210
 				'<ul class="give-subsubsub">%s</ul><br class="clear" /><hr>',
211
-				implode( ' | </li>', $section_list )
212
-			) );
211
+				implode(' | </li>', $section_list)
212
+			));
213 213
 		}
214 214
 
215 215
 		/**
@@ -221,13 +221,13 @@  discard block
 block discarded – undo
221 221
 		 * @return void
222 222
 		 */
223 223
 		public function output() {
224
-			if ( $this->enable_save ) {
224
+			if ($this->enable_save) {
225 225
 				$GLOBALS['give_hide_save_button'] = false;
226 226
 			}
227 227
 
228 228
 			$settings = $this->get_settings();
229 229
 
230
-			Give_Admin_Settings::output_fields( $settings, 'give_settings' );
230
+			Give_Admin_Settings::output_fields($settings, 'give_settings');
231 231
 		}
232 232
 
233 233
 		/**
@@ -245,8 +245,8 @@  discard block
 block discarded – undo
245 245
 			 *
246 246
 			 * @since 2.1
247 247
 			 */
248
-			if ( apply_filters( "give_save_options_{$this->id}_{$current_section}", true ) ) {
249
-				Give_Admin_Settings::save_fields( $settings, 'give_settings' );
248
+			if (apply_filters("give_save_options_{$this->id}_{$current_section}", true)) {
249
+				Give_Admin_Settings::save_fields($settings, 'give_settings');
250 250
 			}
251 251
 
252 252
 			/**
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 			 *
255 255
 			 * @since 1.8
256 256
 			 */
257
-			do_action( 'give_update_options_' . $this->id . '_' . $current_section );
257
+			do_action('give_update_options_'.$this->id.'_'.$current_section);
258 258
 		}
259 259
 
260 260
 		/**
@@ -271,11 +271,11 @@  discard block
 block discarded – undo
271 271
 			$section         = $this->get_sections();
272 272
 			$current_section = give_get_current_setting_section();
273 273
 
274
-			if ( array_key_exists( $current_section, $section ) ) {
275
-				$heading[] = $section[ $current_section ];
274
+			if (array_key_exists($current_section, $section)) {
275
+				$heading[] = $section[$current_section];
276 276
 			}
277 277
 
278
-			return array_unique( $heading );
278
+			return array_unique($heading);
279 279
 		}
280 280
 
281 281
 		/**
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 		public function get_heading_html() {
290 290
 			return sprintf(
291 291
 				'<h1 class="wp-heading-inline">%s</h1><hr class="wp-header-end">',
292
-				implode( ' <span class="give-settings-heading-sep dashicons dashicons-arrow-right-alt2"></span> ', $this->get_heading() )
292
+				implode(' <span class="give-settings-heading-sep dashicons dashicons-arrow-right-alt2"></span> ', $this->get_heading())
293 293
 			);
294 294
 		}
295 295
 	}
Please login to merge, or discard this patch.
includes/admin/settings/class-settings-license.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@  discard block
 block discarded – undo
9 9
  * @since       1.8
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit; // Exit if accessed directly.
14 14
 }
15 15
 
16
-if ( ! class_exists( 'Give_Settings_License' ) ) :
16
+if ( ! class_exists('Give_Settings_License')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Settings_License.
@@ -27,12 +27,12 @@  discard block
 block discarded – undo
27 27
 		 */
28 28
 		public function __construct() {
29 29
 			$this->id    = 'licenses';
30
-			$this->label = esc_html__( 'Licenses', 'give' );
30
+			$this->label = esc_html__('Licenses', 'give');
31 31
 
32 32
 			parent::__construct();
33 33
 
34 34
 			// Filter to remove the license tab.
35
-			add_filter( 'give-settings_tabs_array', array( $this, 'remove_license_tab' ), 9999999, 1 );
35
+			add_filter('give-settings_tabs_array', array($this, 'remove_license_tab'), 9999999, 1);
36 36
 
37 37
 		}
38 38
 
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 			 * Filter the licenses settings.
50 50
 			 * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8
51 51
 			 */
52
-			$settings = apply_filters( 'give_settings_licenses', $settings );
52
+			$settings = apply_filters('give_settings_licenses', $settings);
53 53
 
54 54
 			/**
55 55
 			 * Filter the settings.
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 			 *
59 59
 			 * @param  array $settings
60 60
 			 */
61
-			$settings = apply_filters( 'give_get_settings_' . $this->id, $settings );
61
+			$settings = apply_filters('give_get_settings_'.$this->id, $settings);
62 62
 
63 63
 			// Output.
64 64
 			return $settings;
@@ -74,13 +74,13 @@  discard block
 block discarded – undo
74 74
 		 *
75 75
 		 * @return array
76 76
 		 */
77
-		public function remove_license_tab( $tabs ) {
77
+		public function remove_license_tab($tabs) {
78 78
 			/**
79 79
 			 * Remove the license tab if no Give licensed addon
80 80
 			 * is activated.
81 81
 			 */
82
-			if ( ! $this->is_show_setting_page() ) {
83
-				unset( $tabs['licenses'] );
82
+			if ( ! $this->is_show_setting_page()) {
83
+				unset($tabs['licenses']);
84 84
 			}
85 85
 
86 86
 			return $tabs;
@@ -97,9 +97,9 @@  discard block
 block discarded – undo
97 97
 		 */
98 98
 		private function is_show_setting_page() {
99 99
 			$licensed_addons   = Give_License::get_licensed_addons();
100
-			$activated_plugins = get_option( 'active_plugins', array() );
100
+			$activated_plugins = get_option('active_plugins', array());
101 101
 
102
-			return (bool) count( array_intersect( $activated_plugins, $licensed_addons ) );
102
+			return (bool) count(array_intersect($activated_plugins, $licensed_addons));
103 103
 		}
104 104
 	}
105 105
 
Please login to merge, or discard this patch.