Test Setup Failed
Pull Request — master (#2014)
by Rami
05:17
created
includes/emails/template.php 1 patch
Spacing   +106 added lines, -106 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
 
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
  *
42 42
  * @return string $message Fully formatted message
43 43
  */
44
-function give_email_template_tags( $message, $payment_data, $payment_id, $admin_notice = false ) {
45
-	return give_do_email_tags( $message, $payment_id );
44
+function give_email_template_tags($message, $payment_data, $payment_id, $admin_notice = false) {
45
+	return give_do_email_tags($message, $payment_id);
46 46
 }
47 47
 
48 48
 /**
@@ -56,45 +56,45 @@  discard block
 block discarded – undo
56 56
  *
57 57
  * @return string $message Fully formatted message
58 58
  */
59
-function give_email_preview_template_tags( $message ) {
59
+function give_email_preview_template_tags($message) {
60 60
 
61
-	$price = give_currency_filter( give_format_amount( 10.50, array( 'sanitize' => false ) ) );
61
+	$price = give_currency_filter(give_format_amount(10.50, array('sanitize' => false)));
62 62
 
63 63
 	$gateway = 'PayPal';
64 64
 
65
-	$receipt_id = strtolower( md5( uniqid() ) );
65
+	$receipt_id = strtolower(md5(uniqid()));
66 66
 
67
-	$payment_id = rand( 1, 100 );
67
+	$payment_id = rand(1, 100);
68 68
 
69
-	$receipt_link_url = esc_url( add_query_arg( array( 'payment_key' => $receipt_id, 'give_action' => 'view_receipt' ), home_url() ) );
69
+	$receipt_link_url = esc_url(add_query_arg(array('payment_key' => $receipt_id, 'give_action' => 'view_receipt'), home_url()));
70 70
 	$receipt_link = sprintf(
71 71
 		'<a href="%1$s">%2$s</a>',
72 72
 		$receipt_link_url,
73
-		esc_html__( 'View the receipt in your browser &raquo;', 'give' )
73
+		esc_html__('View the receipt in your browser &raquo;', 'give')
74 74
 	);
75 75
 
76 76
 	// Set user.
77 77
 	$user = wp_get_current_user();
78 78
 
79
-	$message = str_replace( '{name}', $user->display_name, $message );
80
-	$message = str_replace( '{fullname}', $user->display_name, $message );
81
-	$message = str_replace( '{username}', $user->user_login, $message );
82
-	$message = str_replace( '{user_email}', $user->user_email, $message );
83
-	$message = str_replace( '{billing_address}', "123 Test Street, Unit 222\nSomewhere Town, CA, 92101", $message );
84
-	$message = str_replace( '{date}', date( give_date_format(), current_time( 'timestamp' ) ), $message );
85
-	$message = str_replace( '{amount}', $price, $message );
86
-	$message = str_replace( '{price}', $price, $message );
87
-	$message = str_replace( '{donation}', esc_html__( 'Sample Donation Form Title', 'give' ), $message );
88
-	$message = str_replace( '{form_title}', esc_html__( 'Sample Donation Form Title - Sample Donation Level', 'give' ), $message );
89
-	$message = str_replace( '{receipt_id}', $receipt_id, $message );
90
-	$message = str_replace( '{payment_method}', $gateway, $message );
91
-	$message = str_replace( '{sitename}', get_bloginfo( 'name' ), $message );
92
-	$message = str_replace( '{payment_id}', $payment_id, $message );
93
-	$message = str_replace( '{receipt_link}', $receipt_link, $message );
94
-	$message = str_replace( '{receipt_link_url}', $receipt_link_url, $message );
95
-	$message = str_replace( '{pdf_receipt}', '<a href="#">Download Receipt</a>', $message );
96
-
97
-	return wpautop( apply_filters( 'give_email_preview_template_tags', $message ) );
79
+	$message = str_replace('{name}', $user->display_name, $message);
80
+	$message = str_replace('{fullname}', $user->display_name, $message);
81
+	$message = str_replace('{username}', $user->user_login, $message);
82
+	$message = str_replace('{user_email}', $user->user_email, $message);
83
+	$message = str_replace('{billing_address}', "123 Test Street, Unit 222\nSomewhere Town, CA, 92101", $message);
84
+	$message = str_replace('{date}', date(give_date_format(), current_time('timestamp')), $message);
85
+	$message = str_replace('{amount}', $price, $message);
86
+	$message = str_replace('{price}', $price, $message);
87
+	$message = str_replace('{donation}', esc_html__('Sample Donation Form Title', 'give'), $message);
88
+	$message = str_replace('{form_title}', esc_html__('Sample Donation Form Title - Sample Donation Level', 'give'), $message);
89
+	$message = str_replace('{receipt_id}', $receipt_id, $message);
90
+	$message = str_replace('{payment_method}', $gateway, $message);
91
+	$message = str_replace('{sitename}', get_bloginfo('name'), $message);
92
+	$message = str_replace('{payment_id}', $payment_id, $message);
93
+	$message = str_replace('{receipt_link}', $receipt_link, $message);
94
+	$message = str_replace('{receipt_link_url}', $receipt_link_url, $message);
95
+	$message = str_replace('{pdf_receipt}', '<a href="#">Download Receipt</a>', $message);
96
+
97
+	return wpautop(apply_filters('give_email_preview_template_tags', $message));
98 98
 }
99 99
 
100 100
 /**
@@ -106,23 +106,23 @@  discard block
 block discarded – undo
106 106
  * @since  1.0
107 107
  * @return array|bool
108 108
  */
109
-function give_email_template_preview( $array ) {
109
+function give_email_template_preview($array) {
110 110
 
111
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
111
+	if ( ! current_user_can('manage_give_settings')) {
112 112
 		return false;
113 113
 	}
114 114
 	$custom_field = array(
115
-		'name' => esc_html__( 'Preview Email', 'give' ),
116
-		'desc' => esc_html__( 'Click the buttons to preview or send test emails.', 'give' ),
115
+		'name' => esc_html__('Preview Email', 'give'),
116
+		'desc' => esc_html__('Click the buttons to preview or send test emails.', 'give'),
117 117
 		'id'   => 'give_email_preview_buttons',
118 118
 		'type' => 'email_preview_buttons'
119 119
 	);
120 120
 
121
-	return give_settings_array_insert( $array, 'donation_subject', array( $custom_field ) );
121
+	return give_settings_array_insert($array, 'donation_subject', array($custom_field));
122 122
 
123 123
 }
124 124
 
125
-add_filter( 'give_settings_emails', 'give_email_template_preview' );
125
+add_filter('give_settings_emails', 'give_email_template_preview');
126 126
 
127 127
 /**
128 128
  * Output Email Template Preview Buttons.
@@ -134,12 +134,12 @@  discard block
 block discarded – undo
134 134
 function give_email_preview_buttons_callback() {
135 135
 	ob_start();
136 136
 	?>
137
-	<a href="<?php echo esc_url( add_query_arg( array( 'give_action' => 'preview_email' ), home_url() ) ); ?>" class="button-secondary" target="_blank"><?php esc_html_e( 'Preview Donation Receipt', 'give' ); ?></a>
138
-	<a href="<?php echo wp_nonce_url( add_query_arg( array(
137
+	<a href="<?php echo esc_url(add_query_arg(array('give_action' => 'preview_email'), home_url())); ?>" class="button-secondary" target="_blank"><?php esc_html_e('Preview Donation Receipt', 'give'); ?></a>
138
+	<a href="<?php echo wp_nonce_url(add_query_arg(array(
139 139
 		'give_action'  => 'send_test_email',
140 140
 		'give-message' => 'sent-test-email',
141 141
 		'tag'          => 'emails'
142
-	) ), 'give-test-email' ); ?>" aria-label="<?php esc_attr_e( 'Send demo donation receipt to the emails listed below.', 'give' ); ?>" class="button-secondary"><?php esc_html_e( 'Send Test Email', 'give' ); ?></a>
142
+	)), 'give-test-email'); ?>" aria-label="<?php esc_attr_e('Send demo donation receipt to the emails listed below.', 'give'); ?>" class="button-secondary"><?php esc_html_e('Send Test Email', 'give'); ?></a>
143 143
 	<?php
144 144
 	echo ob_get_clean();
145 145
 }
@@ -152,46 +152,46 @@  discard block
 block discarded – undo
152 152
  */
153 153
 function give_display_email_template_preview() {
154 154
 
155
-	if ( empty( $_GET['give_action'] ) ) {
155
+	if (empty($_GET['give_action'])) {
156 156
 		return;
157 157
 	}
158 158
 
159
-	if ( 'preview_email' !== $_GET['give_action'] ) {
159
+	if ('preview_email' !== $_GET['give_action']) {
160 160
 		return;
161 161
 	}
162 162
 
163
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
163
+	if ( ! current_user_can('manage_give_settings')) {
164 164
 		return;
165 165
 	}
166 166
 
167 167
 
168
-	Give()->emails->heading = esc_html__( 'Donation Receipt', 'give' );
168
+	Give()->emails->heading = esc_html__('Donation Receipt', 'give');
169 169
 
170
-	$payment_id = (int) isset( $_GET['preview_id'] ) ? $_GET['preview_id'] : '';
170
+	$payment_id = (int) isset($_GET['preview_id']) ? $_GET['preview_id'] : '';
171 171
 
172 172
 	echo give_get_preview_email_header();
173 173
 
174 174
 	//Are we previewing an actual payment?
175
-	if ( ! empty( $payment_id ) ) {
175
+	if ( ! empty($payment_id)) {
176 176
 
177
-		$content = give_get_email_body_content( $payment_id );
177
+		$content = give_get_email_body_content($payment_id);
178 178
 
179
-		$preview_content = give_do_email_tags( $content, $payment_id );
179
+		$preview_content = give_do_email_tags($content, $payment_id);
180 180
 
181 181
 	} else {
182 182
 
183 183
 		//No payment ID, use sample preview content
184
-		$preview_content = give_email_preview_template_tags( give_get_email_body_content( 0, array() ) );
184
+		$preview_content = give_email_preview_template_tags(give_get_email_body_content(0, array()));
185 185
 	}
186 186
 
187 187
 
188
-	echo Give()->emails->build_email( $preview_content );
188
+	echo Give()->emails->build_email($preview_content);
189 189
 
190 190
 	exit;
191 191
 
192 192
 }
193 193
 
194
-add_action( 'init', 'give_display_email_template_preview' );
194
+add_action('init', 'give_display_email_template_preview');
195 195
 
196 196
 /**
197 197
  * Email Template Body.
@@ -203,18 +203,18 @@  discard block
 block discarded – undo
203 203
  *
204 204
  * @return string $email_body Body of the email
205 205
  */
206
-function give_get_email_body_content( $payment_id = 0, $payment_data = array() ) {
206
+function give_get_email_body_content($payment_id = 0, $payment_data = array()) {
207 207
 
208 208
 	$default_email_body = give_get_default_donation_receipt_email();
209 209
 
210
-	$email_content = give_get_option( 'donation_receipt' );
211
-	$email_content = ( $email_content ) ? stripslashes( $email_content ) : $default_email_body;
210
+	$email_content = give_get_option('donation_receipt');
211
+	$email_content = ($email_content) ? stripslashes($email_content) : $default_email_body;
212 212
 
213
-	$email_body = wpautop( $email_content );
213
+	$email_body = wpautop($email_content);
214 214
 
215
-	$email_body = apply_filters( 'give_donation_receipt_' . Give()->emails->get_template(), $email_body, $payment_id, $payment_data );
215
+	$email_body = apply_filters('give_donation_receipt_'.Give()->emails->get_template(), $email_body, $payment_id, $payment_data);
216 216
 
217
-	return apply_filters( 'give_donation_receipt', $email_body, $payment_id, $payment_data );
217
+	return apply_filters('give_donation_receipt', $email_body, $payment_id, $payment_data);
218 218
 }
219 219
 
220 220
 /**
@@ -227,36 +227,36 @@  discard block
 block discarded – undo
227 227
  *
228 228
  * @return string $email_body Body of the email
229 229
  */
230
-function give_get_donation_notification_body_content( $payment_id = 0, $payment_data = array() ) {
230
+function give_get_donation_notification_body_content($payment_id = 0, $payment_data = array()) {
231 231
 
232
-	$user_info = maybe_unserialize( $payment_data['user_info'] );
233
-	$email     = give_get_payment_user_email( $payment_id );
232
+	$user_info = maybe_unserialize($payment_data['user_info']);
233
+	$email     = give_get_payment_user_email($payment_id);
234 234
 
235
-	if ( isset( $user_info['id'] ) && $user_info['id'] > 0 ) {
236
-		$user_data = get_userdata( $user_info['id'] );
235
+	if (isset($user_info['id']) && $user_info['id'] > 0) {
236
+		$user_data = get_userdata($user_info['id']);
237 237
 		$name      = $user_data->display_name;
238
-	} elseif ( isset( $user_info['first_name'] ) && isset( $user_info['last_name'] ) ) {
239
-		$name = $user_info['first_name'] . ' ' . $user_info['last_name'];
238
+	} elseif (isset($user_info['first_name']) && isset($user_info['last_name'])) {
239
+		$name = $user_info['first_name'].' '.$user_info['last_name'];
240 240
 	} else {
241 241
 		$name = $email;
242 242
 	}
243 243
 
244
-	$gateway = give_get_gateway_admin_label( give_get_meta( $payment_id, '_give_payment_gateway', true ) );
244
+	$gateway = give_get_gateway_admin_label(give_get_meta($payment_id, '_give_payment_gateway', true));
245 245
 
246
-	$default_email_body = esc_html__( 'Hello', 'give' ) . "\n\n";
247
-	$default_email_body .= esc_html__( 'A donation has been made.', 'give' ) . "\n\n";
248
-	$default_email_body .= esc_html__( 'Donation:', 'give' ) . "\n\n";
249
-	$default_email_body .= esc_html__( 'Donor:', 'give' ) . ' ' . html_entity_decode( $name, ENT_COMPAT, 'UTF-8' ) . "\n";
250
-	$default_email_body .= esc_html__( 'Amount:', 'give' ) . ' ' . html_entity_decode( give_currency_filter( give_format_amount( give_get_payment_amount( $payment_id ), array( 'sanitize' => false ) ) ), ENT_COMPAT, 'UTF-8' ) . "\n";
251
-	$default_email_body .= esc_html__( 'Payment Method:', 'give' ) . ' ' . $gateway . "\n\n";
252
-	$default_email_body .= esc_html__( 'Thank you', 'give' );
246
+	$default_email_body = esc_html__('Hello', 'give')."\n\n";
247
+	$default_email_body .= esc_html__('A donation has been made.', 'give')."\n\n";
248
+	$default_email_body .= esc_html__('Donation:', 'give')."\n\n";
249
+	$default_email_body .= esc_html__('Donor:', 'give').' '.html_entity_decode($name, ENT_COMPAT, 'UTF-8')."\n";
250
+	$default_email_body .= esc_html__('Amount:', 'give').' '.html_entity_decode(give_currency_filter(give_format_amount(give_get_payment_amount($payment_id), array('sanitize' => false))), ENT_COMPAT, 'UTF-8')."\n";
251
+	$default_email_body .= esc_html__('Payment Method:', 'give').' '.$gateway."\n\n";
252
+	$default_email_body .= esc_html__('Thank you', 'give');
253 253
 
254
-	$email = give_get_option( 'donation_notification' );
255
-	$email = isset( $email ) ? stripslashes( $email ) : $default_email_body;
254
+	$email = give_get_option('donation_notification');
255
+	$email = isset($email) ? stripslashes($email) : $default_email_body;
256 256
 
257
-	$email_body = give_do_email_tags( $email, $payment_id );
257
+	$email_body = give_do_email_tags($email, $payment_id);
258 258
 
259
-	return apply_filters( 'give_donation_notification', wpautop( $email_body ), $payment_id, $payment_data );
259
+	return apply_filters('give_donation_notification', wpautop($email_body), $payment_id, $payment_data);
260 260
 }
261 261
 
262 262
 /**
@@ -269,19 +269,19 @@  discard block
 block discarded – undo
269 269
  * @since  1.0
270 270
  */
271 271
 function give_render_receipt_in_browser() {
272
-	if ( ! isset( $_GET['payment_key'] ) ) {
273
-		wp_die( esc_html__( 'Missing donation payment key.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) );
272
+	if ( ! isset($_GET['payment_key'])) {
273
+		wp_die(esc_html__('Missing donation payment key.', 'give'), esc_html__('Error', 'give'), array('response' => 400));
274 274
 	}
275 275
 
276
-	$key = urlencode( $_GET['payment_key'] );
276
+	$key = urlencode($_GET['payment_key']);
277 277
 
278 278
 	ob_start();
279 279
 	//Disallows caching of the page
280
-	header( "Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . " GMT" );
281
-	header( "Cache-Control: no-store, no-cache, must-revalidate" ); // HTTP/1.1
282
-	header( "Cache-Control: post-check=0, pre-check=0", false );
283
-	header( "Pragma: no-cache" ); // HTTP/1.0
284
-	header( "Expires: Sat, 23 Oct 1977 05:00:00 PST" ); // Date in the past
280
+	header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
281
+	header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
282
+	header("Cache-Control: post-check=0, pre-check=0", false);
283
+	header("Pragma: no-cache"); // HTTP/1.0
284
+	header("Expires: Sat, 23 Oct 1977 05:00:00 PST"); // Date in the past
285 285
 	?>
286 286
 	<!DOCTYPE html>
287 287
 	<html lang="en">
@@ -292,10 +292,10 @@  discard block
 block discarded – undo
292 292
 		 *
293 293
 		 * @since 1.0
294 294
 		 */
295
-		do_action( 'give_receipt_head' );
295
+		do_action('give_receipt_head');
296 296
 		?>
297 297
 	</head>
298
-	<body class="<?php echo apply_filters( 'give_receipt_page_body_class', 'give_receipt_page' ); ?>">
298
+	<body class="<?php echo apply_filters('give_receipt_page_body_class', 'give_receipt_page'); ?>">
299 299
 
300 300
 	<div id="give_receipt_wrapper">
301 301
 		<?php
@@ -304,16 +304,16 @@  discard block
 block discarded – undo
304 304
 		 *
305 305
 		 * @since 1.0
306 306
 		 */
307
-		do_action( 'give_render_receipt_in_browser_before' );
307
+		do_action('give_render_receipt_in_browser_before');
308 308
 
309
-		echo do_shortcode( '[give_receipt payment_key=' . $key . ']' );
309
+		echo do_shortcode('[give_receipt payment_key='.$key.']');
310 310
 
311 311
 		/**
312 312
 		 * Fires in the receipt template after the content.
313 313
 		 *
314 314
 		 * @since 1.0
315 315
 		 */
316
-		do_action( 'give_render_receipt_in_browser_after' );
316
+		do_action('give_render_receipt_in_browser_after');
317 317
 		?>
318 318
 	</div>
319 319
 
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 	 *
324 324
 	 * @since 1.0
325 325
 	 */
326
-	do_action( 'give_receipt_footer' );
326
+	do_action('give_receipt_footer');
327 327
 	?>
328 328
 	</body>
329 329
 	</html>
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 	die();
333 333
 }
334 334
 
335
-add_action( 'give_view_receipt', 'give_render_receipt_in_browser' );
335
+add_action('give_view_receipt', 'give_render_receipt_in_browser');
336 336
 
337 337
 
338 338
 /**
@@ -347,29 +347,29 @@  discard block
 block discarded – undo
347 347
 
348 348
 	//Payment receipt switcher
349 349
 	$payment_count = give_count_payments()->publish;
350
-	$payment_id    = (int) isset( $_GET['preview_id'] ) ? $_GET['preview_id'] : '';
350
+	$payment_id    = (int) isset($_GET['preview_id']) ? $_GET['preview_id'] : '';
351 351
 
352
-	if ( $payment_count <= 0 ) {
352
+	if ($payment_count <= 0) {
353 353
 		return false;
354 354
 	}
355 355
 
356 356
 	//Get payments.
357
-	$payments = new Give_Payments_Query( array(
357
+	$payments = new Give_Payments_Query(array(
358 358
 		'number' => 100
359
-	) );
359
+	));
360 360
 	$payments = $payments->get_payments();
361 361
 	$options  = array();
362 362
 
363 363
 	//Provide nice human readable options.
364
-	if ( $payments ) {
365
-		$options[0] = esc_html__( '- Select a donation -', 'give' );
366
-		foreach ( $payments as $payment ) {
364
+	if ($payments) {
365
+		$options[0] = esc_html__('- Select a donation -', 'give');
366
+		foreach ($payments as $payment) {
367 367
 
368
-			$options[ $payment->ID ] = esc_html( '#' . $payment->ID . ' - ' . $payment->email . ' - ' . $payment->form_title );
368
+			$options[$payment->ID] = esc_html('#'.$payment->ID.' - '.$payment->email.' - '.$payment->form_title);
369 369
 
370 370
 		}
371 371
 	} else {
372
-		$options[0] = esc_html__( 'No donations found.', 'give' );
372
+		$options[0] = esc_html__('No donations found.', 'give');
373 373
 	}
374 374
 
375 375
 	//Start constructing HTML output.
@@ -382,16 +382,16 @@  discard block
 block discarded – undo
382 382
 			        var selected_trans = transactions.options[transactions.selectedIndex];
383 383
 				        console.log(selected_trans);
384 384
 				        if (selected_trans){
385
-				            var url_string = "' . get_bloginfo( 'url' ) . '?give_action=preview_email&preview_id=" + selected_trans.value;
385
+				            var url_string = "' . get_bloginfo('url').'?give_action=preview_email&preview_id=" + selected_trans.value;
386 386
 				                window.location = url_string;
387 387
 				        }
388 388
 				    }
389 389
 			    </script>';
390 390
 
391
-	$transaction_header .= '<label for="give_preview_email_payment_id" style="font-size:12px;color:#333;margin:0 4px 0 0;">' . esc_html__( 'Preview email with a donation:', 'give' ) . '</label>';
391
+	$transaction_header .= '<label for="give_preview_email_payment_id" style="font-size:12px;color:#333;margin:0 4px 0 0;">'.esc_html__('Preview email with a donation:', 'give').'</label>';
392 392
 
393 393
 	//The select field with 100 latest transactions
394
-	$transaction_header .= Give()->html->select( array(
394
+	$transaction_header .= Give()->html->select(array(
395 395
 		'name'             => 'preview_email_payment_id',
396 396
 		'selected'         => $payment_id,
397 397
 		'id'               => 'give_preview_email_payment_id',
@@ -401,12 +401,12 @@  discard block
 block discarded – undo
401 401
 		'select_atts'      => 'onchange="change_preview()">',
402 402
 		'show_option_all'  => false,
403 403
 		'show_option_none' => false
404
-	) );
404
+	));
405 405
 
406 406
 	//Closing tag
407 407
 	$transaction_header .= '</div>';
408 408
 
409
-	return apply_filters( 'give_preview_email_receipt_header', $transaction_header );
409
+	return apply_filters('give_preview_email_receipt_header', $transaction_header);
410 410
 
411 411
 }
412 412
 
@@ -420,7 +420,7 @@  discard block
 block discarded – undo
420 420
 function give_receipt_head_content() {
421 421
 
422 422
 	//Title.
423
-	$output = '<title>' . esc_html__( 'Donation Receipt', 'give' ) . '</title>';
423
+	$output = '<title>'.esc_html__('Donation Receipt', 'give').'</title>';
424 424
 
425 425
 	//Meta.
426 426
 	$output .= '<meta charset="utf-8"/>
@@ -434,10 +434,10 @@  discard block
 block discarded – undo
434 434
 		<meta name="robots" content="noindex, nofollow"/>';
435 435
 
436 436
 	//CSS
437
-	$output .= '<link rel="stylesheet" href="' . give_get_stylesheet_uri() . '?ver=' . GIVE_VERSION . '">';
437
+	$output .= '<link rel="stylesheet" href="'.give_get_stylesheet_uri().'?ver='.GIVE_VERSION.'">';
438 438
 
439
-	echo apply_filters( 'give_receipt_head_content', $output );
439
+	echo apply_filters('give_receipt_head_content', $output);
440 440
 
441 441
 }
442 442
 
443
-add_action( 'give_receipt_head', 'give_receipt_head_content' );
444 443
\ No newline at end of file
444
+add_action('give_receipt_head', 'give_receipt_head_content');
445 445
\ No newline at end of file
Please login to merge, or discard this patch.
templates/emails/header-default.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -6,16 +6,16 @@  discard block
 block discarded – undo
6 6
  * @version     1.0
7 7
  */
8 8
 
9
-if ( ! defined( 'ABSPATH' ) ) {
9
+if ( ! defined('ABSPATH')) {
10 10
 	exit;
11 11
 } // Exit if accessed directly.
12 12
 
13 13
 // For gmail compatibility, including CSS styles in head/body are stripped out therefore styles need to be inline. These variables contain rules which are added to the template inline. !important; is a gmail hack to prevent styles being stripped if it doesn't like something.
14
-$body               = "
14
+$body = "
15 15
 	background-color: #f6f6f6;
16 16
 	font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;
17 17
 ";
18
-$wrapper            = "
18
+$wrapper = "
19 19
 	width:100%;
20 20
 	-webkit-text-size-adjust:none !important;
21 21
 	margin:0;
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 	text-align: center;
43 43
 	vertical-align:middle;
44 44
 ";
45
-$body_content       = "
45
+$body_content = "
46 46
 	border-radius:3px !important;
47 47
 	font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;
48 48
 ";
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	line-height:150%;
54 54
 	text-align:left;
55 55
 ";
56
-$header_content_h1  = "
56
+$header_content_h1 = "
57 57
 	color: #000000;
58 58
 	margin:0;
59 59
 	padding: 28px 24px;
@@ -63,13 +63,13 @@  discard block
 block discarded – undo
63 63
 	font-weight: 500;
64 64
 	line-height: 1.2;
65 65
 ";
66
-$header_img         = give_get_option( 'email_logo', '' );
66
+$header_img = give_get_option('email_logo', '');
67 67
 ?>
68 68
 <!DOCTYPE html>
69 69
 <html>
70 70
 <head>
71 71
 	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
72
-	<title><?php echo get_bloginfo( 'name' ); ?></title>
72
+	<title><?php echo get_bloginfo('name'); ?></title>
73 73
 </head>
74 74
 <body leftmargin="0" marginwidth="0" topmargin="0" marginheight="0" offset="0" style="<?php echo $body; ?>">
75 75
 <div style="<?php echo $wrapper; ?>">
@@ -77,9 +77,9 @@  discard block
 block discarded – undo
77 77
 		<tr>
78 78
 			<td align="center" valign="top">
79 79
 				<?php
80
-				if ( ! empty( $header_img ) ) : ?>
80
+				if ( ! empty($header_img)) : ?>
81 81
 					<div id="template_header_image">
82
-						<?php echo '<p style="margin-top:0;"><img style="' . $template_image . '" src="' . esc_url( $header_img ) . '" alt="' . get_bloginfo( 'name' ) . '" /></p>'; ?>
82
+						<?php echo '<p style="margin-top:0;"><img style="'.$template_image.'" src="'.esc_url($header_img).'" alt="'.get_bloginfo('name').'" /></p>'; ?>
83 83
 					</div>
84 84
 				<?php endif; ?>
85 85
 				<table border="0" cellpadding="0" cellspacing="0" width="600" id="template_container" style="<?php echo $template_container; ?>">
Please login to merge, or discard this patch.
templates/emails/body.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
  * @version     1.0
7 7
  */
8 8
 
9
-if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly.
9
+if ( ! defined('ABSPATH')) exit; // Exit if accessed directly.
10 10
 
11 11
 // {email} is replaced by the content entered in Donations > Settings > Emails
12 12
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,10 @@
 block discarded – undo
6 6
  * @version     1.0
7 7
  */
8 8
 
9
-if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly.
9
+if ( ! defined( 'ABSPATH' ) ) {
10
+	exit;
11
+}
12
+// Exit if accessed directly.
10 13
 
11 14
 // {email} is replaced by the content entered in Donations > Settings > Emails
12 15
 
Please login to merge, or discard this patch.
includes/user-functions.php 1 patch
Spacing   +143 added lines, -143 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
 
@@ -30,54 +30,54 @@  discard block
 block discarded – undo
30 30
  *
31 31
  * @return bool|array List of all user donations.
32 32
  */
33
-function give_get_users_donations( $user = 0, $number = 20, $pagination = false, $status = 'complete' ) {
33
+function give_get_users_donations($user = 0, $number = 20, $pagination = false, $status = 'complete') {
34 34
 
35
-	if ( empty( $user ) ) {
35
+	if (empty($user)) {
36 36
 		$user = get_current_user_id();
37 37
 	}
38 38
 
39
-	if ( 0 === $user && ! Give()->email_access->token_exists ) {
39
+	if (0 === $user && ! Give()->email_access->token_exists) {
40 40
 		return false;
41 41
 	}
42 42
 
43 43
 	$status = $status === 'complete' ? 'publish' : $status;
44 44
 	$paged = 1;
45 45
 
46
-	if ( $pagination ) {
47
-		if ( get_query_var( 'paged' ) ) {
48
-			$paged = get_query_var( 'paged' );
49
-		} elseif ( get_query_var( 'page' ) ) {
50
-			$paged = get_query_var( 'page' );
46
+	if ($pagination) {
47
+		if (get_query_var('paged')) {
48
+			$paged = get_query_var('paged');
49
+		} elseif (get_query_var('page')) {
50
+			$paged = get_query_var('page');
51 51
 		}
52 52
 	}
53 53
 
54
-	$args = apply_filters( 'give_get_users_donations_args', array(
54
+	$args = apply_filters('give_get_users_donations_args', array(
55 55
 		'user'    => $user,
56 56
 		'number'  => $number,
57 57
 		'status'  => $status,
58 58
 		'orderby' => 'date',
59
-	) );
59
+	));
60 60
 
61
-	if ( $pagination ) {
61
+	if ($pagination) {
62 62
 		$args['page'] = $paged;
63 63
 	} else {
64 64
 		$args['nopaging'] = true;
65 65
 	}
66 66
 
67
-	$by_user_id = is_numeric( $user ) ? true : false;
68
-	$donor   = new Give_Donor( $user, $by_user_id );
67
+	$by_user_id = is_numeric($user) ? true : false;
68
+	$donor = new Give_Donor($user, $by_user_id);
69 69
 
70
-	if ( ! empty( $donor->payment_ids ) ) {
70
+	if ( ! empty($donor->payment_ids)) {
71 71
 
72
-		unset( $args['user'] );
73
-		$args['post__in'] = array_map( 'absint', explode( ',', $donor->payment_ids ) );
72
+		unset($args['user']);
73
+		$args['post__in'] = array_map('absint', explode(',', $donor->payment_ids));
74 74
 
75 75
 	}
76 76
 
77
-	$donations = give_get_payments( apply_filters( 'give_get_users_donations_args', $args ) );
77
+	$donations = give_get_payments(apply_filters('give_get_users_donations_args', $args));
78 78
 
79 79
 	// No donations
80
-	if ( ! $donations ) {
80
+	if ( ! $donations) {
81 81
 		return false;
82 82
 	}
83 83
 
@@ -96,65 +96,65 @@  discard block
 block discarded – undo
96 96
  *
97 97
  * @return bool|object List of unique forms donated by user
98 98
  */
99
-function give_get_users_completed_donations( $user = 0, $status = 'complete' ) {
100
-	if ( empty( $user ) ) {
99
+function give_get_users_completed_donations($user = 0, $status = 'complete') {
100
+	if (empty($user)) {
101 101
 		$user = get_current_user_id();
102 102
 	}
103 103
 
104
-	if ( empty( $user ) ) {
104
+	if (empty($user)) {
105 105
 		return false;
106 106
 	}
107 107
 
108
-	$by_user_id = is_numeric( $user ) ? true : false;
108
+	$by_user_id = is_numeric($user) ? true : false;
109 109
 
110
-	$donor = new Give_Donor( $user, $by_user_id );
110
+	$donor = new Give_Donor($user, $by_user_id);
111 111
 
112
-	if ( empty( $donor->payment_ids ) ) {
112
+	if (empty($donor->payment_ids)) {
113 113
 		return false;
114 114
 	}
115 115
 
116 116
 	// Get all the items donated.
117
-	$payment_ids    = array_reverse( explode( ',', $donor->payment_ids ) );
118
-	$limit_payments = apply_filters( 'give_users_completed_donations_payments', 50 );
119
-	if ( ! empty( $limit_payments ) ) {
120
-		$payment_ids = array_slice( $payment_ids, 0, $limit_payments );
117
+	$payment_ids    = array_reverse(explode(',', $donor->payment_ids));
118
+	$limit_payments = apply_filters('give_users_completed_donations_payments', 50);
119
+	if ( ! empty($limit_payments)) {
120
+		$payment_ids = array_slice($payment_ids, 0, $limit_payments);
121 121
 	}
122 122
 	$donation_data = array();
123
-	foreach ( $payment_ids as $payment_id ) {
124
-		$donation_data[] = give_get_payment_meta( $payment_id );
123
+	foreach ($payment_ids as $payment_id) {
124
+		$donation_data[] = give_get_payment_meta($payment_id);
125 125
 	}
126 126
 
127
-	if ( empty( $donation_data ) ) {
127
+	if (empty($donation_data)) {
128 128
 		return false;
129 129
 	}
130 130
 
131 131
 	// Grab only the post ids "form_id" of the forms donated on this order
132 132
 	$completed_donations_ids = array();
133
-	foreach ( $donation_data as $donation_meta ) {
134
-		$completed_donations_ids[] = isset( $donation_meta['form_id'] ) ? $donation_meta['form_id'] : '';
133
+	foreach ($donation_data as $donation_meta) {
134
+		$completed_donations_ids[] = isset($donation_meta['form_id']) ? $donation_meta['form_id'] : '';
135 135
 	}
136 136
 
137
-	if ( empty( $completed_donations_ids ) ) {
137
+	if (empty($completed_donations_ids)) {
138 138
 		return false;
139 139
 	}
140 140
 
141 141
 	// Only include each donation once
142
-	$form_ids = array_unique( $completed_donations_ids );
142
+	$form_ids = array_unique($completed_donations_ids);
143 143
 
144 144
 	// Make sure we still have some products and a first item
145
-	if ( empty( $form_ids ) || ! isset( $form_ids[0] ) ) {
145
+	if (empty($form_ids) || ! isset($form_ids[0])) {
146 146
 		return false;
147 147
 	}
148 148
 
149
-	$post_type = get_post_type( $form_ids[0] );
149
+	$post_type = get_post_type($form_ids[0]);
150 150
 
151
-	$args = apply_filters( 'give_get_users_completed_donations_args', array(
151
+	$args = apply_filters('give_get_users_completed_donations_args', array(
152 152
 		'include'        => $form_ids,
153 153
 		'post_type'      => $post_type,
154
-		'posts_per_page' => - 1,
155
-	) );
154
+		'posts_per_page' => -1,
155
+	));
156 156
 
157
-	return apply_filters( 'give_users_completed_donations_list', get_posts( $args ) );
157
+	return apply_filters('give_users_completed_donations_list', get_posts($args));
158 158
 }
159 159
 
160 160
 
@@ -170,12 +170,12 @@  discard block
 block discarded – undo
170 170
  *
171 171
  * @return      bool True if has donated, false other wise.
172 172
  */
173
-function give_has_donations( $user_id = null ) {
174
-	if ( empty( $user_id ) ) {
173
+function give_has_donations($user_id = null) {
174
+	if (empty($user_id)) {
175 175
 		$user_id = get_current_user_id();
176 176
 	}
177 177
 
178
-	if ( give_get_users_donations( $user_id, 1 ) ) {
178
+	if (give_get_users_donations($user_id, 1)) {
179 179
 		return true; // User has at least one donation.
180 180
 	}
181 181
 
@@ -196,23 +196,23 @@  discard block
 block discarded – undo
196 196
  *
197 197
  * @return      array
198 198
  */
199
-function give_get_donation_stats_by_user( $user = '' ) {
199
+function give_get_donation_stats_by_user($user = '') {
200 200
 
201 201
 	$field = '';
202 202
 
203
-	if ( is_email( $user ) ) {
203
+	if (is_email($user)) {
204 204
 		$field = 'email';
205
-	} elseif ( is_numeric( $user ) ) {
205
+	} elseif (is_numeric($user)) {
206 206
 		$field = 'user_id';
207 207
 	}
208 208
 
209
-	$stats    = array();
210
-	$donor = Give()->donors->get_donor_by( $field, $user );
209
+	$stats = array();
210
+	$donor = Give()->donors->get_donor_by($field, $user);
211 211
 
212
-	if ( $donor ) {
213
-		$donor = new Give_Donor( $donor->id );
214
-		$stats['purchases']   = absint( $donor->purchase_count );
215
-		$stats['total_spent'] = give_maybe_sanitize_amount( $donor->purchase_value );
212
+	if ($donor) {
213
+		$donor = new Give_Donor($donor->id);
214
+		$stats['purchases']   = absint($donor->purchase_count);
215
+		$stats['total_spent'] = give_maybe_sanitize_amount($donor->purchase_value);
216 216
 	}
217 217
 
218 218
 	/**
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 	 *
221 221
 	 * @since 1.7
222 222
 	 */
223
-	$stats = (array) apply_filters( 'give_donation_stats_by_user', $stats, $user );
223
+	$stats = (array) apply_filters('give_donation_stats_by_user', $stats, $user);
224 224
 
225 225
 	return $stats;
226 226
 }
@@ -238,21 +238,21 @@  discard block
 block discarded – undo
238 238
  *
239 239
  * @return      int The total number of donations.
240 240
  */
241
-function give_count_donations_of_donor( $user = null ) {
241
+function give_count_donations_of_donor($user = null) {
242 242
 
243 243
 	// Logged in?
244
-	if ( empty( $user ) ) {
244
+	if (empty($user)) {
245 245
 		$user = get_current_user_id();
246 246
 	}
247 247
 
248 248
 	// Email access?
249
-	if ( empty( $user ) && Give()->email_access->token_email ) {
249
+	if (empty($user) && Give()->email_access->token_email) {
250 250
 		$user = Give()->email_access->token_email;
251 251
 	}
252 252
 
253
-	$stats = ! empty( $user ) ? give_get_donation_stats_by_user( $user ) : false;
253
+	$stats = ! empty($user) ? give_get_donation_stats_by_user($user) : false;
254 254
 
255
-	return isset( $stats['purchases'] ) ? $stats['purchases'] : 0;
255
+	return isset($stats['purchases']) ? $stats['purchases'] : 0;
256 256
 }
257 257
 
258 258
 /**
@@ -265,9 +265,9 @@  discard block
 block discarded – undo
265 265
  *
266 266
  * @return      float The total amount the user has spent
267 267
  */
268
-function give_donation_total_of_user( $user = null ) {
268
+function give_donation_total_of_user($user = null) {
269 269
 
270
-	$stats = give_get_donation_stats_by_user( $user );
270
+	$stats = give_get_donation_stats_by_user($user);
271 271
 
272 272
 	return $stats['total_spent'];
273 273
 }
@@ -283,40 +283,40 @@  discard block
 block discarded – undo
283 283
  *
284 284
  * @return bool
285 285
  */
286
-function give_validate_username( $username, $form_id = 0 ) {
286
+function give_validate_username($username, $form_id = 0) {
287 287
 	$valid = true;
288 288
 
289 289
 	// Validate username.
290
-	if ( ! empty( $username ) ) {
290
+	if ( ! empty($username)) {
291 291
 
292 292
 		// Sanitize username.
293
-		$sanitized_user_name = sanitize_user( $username, false );
293
+		$sanitized_user_name = sanitize_user($username, false);
294 294
 
295 295
 		// We have an user name, check if it already exists.
296
-		if ( username_exists( $username ) ) {
296
+		if (username_exists($username)) {
297 297
 			// Username already registered.
298
-			give_set_error( 'username_unavailable', __( 'Username already taken.', 'give' ) );
298
+			give_set_error('username_unavailable', __('Username already taken.', 'give'));
299 299
 			$valid = false;
300 300
 
301 301
 			// Check if it's valid.
302
-		} elseif ( $sanitized_user_name !== $username ) {
302
+		} elseif ($sanitized_user_name !== $username) {
303 303
 			// Invalid username.
304
-			if ( is_multisite() ) {
305
-				give_set_error( 'username_invalid', __( 'Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give' ) );
304
+			if (is_multisite()) {
305
+				give_set_error('username_invalid', __('Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give'));
306 306
 				$valid = false;
307 307
 			} else {
308
-				give_set_error( 'username_invalid', __( 'Invalid username.', 'give' ) );
308
+				give_set_error('username_invalid', __('Invalid username.', 'give'));
309 309
 				$valid = false;
310 310
 			}
311 311
 		}
312 312
 	} else {
313 313
 		// Username is empty.
314
-		give_set_error( 'username_empty', __( 'Enter a username.', 'give' ) );
314
+		give_set_error('username_empty', __('Enter a username.', 'give'));
315 315
 		$valid = false;
316 316
 
317 317
 		// Check if guest checkout is disable for form.
318
-		if ( $form_id && give_logged_in_only( $form_id ) ) {
319
-			give_set_error( 'registration_required', __( 'You must register or login to complete your donation.', 'give' ) );
318
+		if ($form_id && give_logged_in_only($form_id)) {
319
+			give_set_error('registration_required', __('You must register or login to complete your donation.', 'give'));
320 320
 			$valid = false;
321 321
 		}
322 322
 	}
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
 	 * @param string $username
331 331
 	 * @param bool   $form_id
332 332
 	 */
333
-	$valid = (bool) apply_filters( 'give_validate_username', $valid, $username, $form_id );
333
+	$valid = (bool) apply_filters('give_validate_username', $valid, $username, $form_id);
334 334
 
335 335
 	return $valid;
336 336
 }
@@ -346,22 +346,22 @@  discard block
 block discarded – undo
346 346
  *
347 347
  * @return bool
348 348
  */
349
-function give_validate_user_email( $email, $registering_new_user = false ) {
349
+function give_validate_user_email($email, $registering_new_user = false) {
350 350
 	$valid = true;
351 351
 
352
-	if ( empty( $email ) ) {
352
+	if (empty($email)) {
353 353
 		// No email.
354
-		give_set_error( 'email_empty', __( 'Enter an email.', 'give' ) );
354
+		give_set_error('email_empty', __('Enter an email.', 'give'));
355 355
 		$valid = false;
356 356
 
357
-	} elseif ( ! is_email( $email ) ) {
357
+	} elseif ( ! is_email($email)) {
358 358
 		// Validate email.
359
-		give_set_error( 'email_invalid', __( 'Invalid email.', 'give' ) );
359
+		give_set_error('email_invalid', __('Invalid email.', 'give'));
360 360
 		$valid = false;
361 361
 
362
-	} elseif ( $registering_new_user && ( give_donor_email_exists( $email ) || email_exists( $email ) ) ) {
362
+	} elseif ($registering_new_user && (give_donor_email_exists($email) || email_exists($email))) {
363 363
 		// Check if email exists.
364
-		give_set_error( 'email_used', __( 'The email address provided is already active for another user.', 'give' ) );
364
+		give_set_error('email_used', __('The email address provided is already active for another user.', 'give'));
365 365
 		$valid = false;
366 366
 	}
367 367
 
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
 	 * @param string $email
375 375
 	 * @param bool   $registering_new_user
376 376
 	 */
377
-	$valid = (bool) apply_filters( 'give_validate_user_email', $valid, $email, $registering_new_user );
377
+	$valid = (bool) apply_filters('give_validate_user_email', $valid, $email, $registering_new_user);
378 378
 
379 379
 	return $valid;
380 380
 }
@@ -390,34 +390,34 @@  discard block
 block discarded – undo
390 390
  *
391 391
  * @return bool
392 392
  */
393
-function give_validate_user_password( $password = '', $confirm_password = '', $registering_new_user = false ) {
393
+function give_validate_user_password($password = '', $confirm_password = '', $registering_new_user = false) {
394 394
 	$valid = true;
395 395
 
396 396
 	// Passwords Validation For New Donors Only
397
-	if ( $registering_new_user ) {
397
+	if ($registering_new_user) {
398 398
 		// Password or confirmation missing.
399
-		if ( ! $password ) {
399
+		if ( ! $password) {
400 400
 			// The password is invalid.
401
-			give_set_error( 'password_empty', __( 'Enter a password.', 'give' ) );
401
+			give_set_error('password_empty', __('Enter a password.', 'give'));
402 402
 			$valid = false;
403
-		} elseif ( ! $confirm_password ) {
403
+		} elseif ( ! $confirm_password) {
404 404
 			// Confirmation password is invalid.
405
-			give_set_error( 'confirmation_empty', __( 'Enter the password confirmation.', 'give' ) );
405
+			give_set_error('confirmation_empty', __('Enter the password confirmation.', 'give'));
406 406
 			$valid = false;
407 407
 		}
408 408
 	}
409 409
 	// Passwords Validation For New Donors as well as Existing Donors
410
-	if( $password || $confirm_password ) {
411
-		if ( strlen( $password ) < 6 || strlen( $confirm_password ) < 6 ) {
410
+	if ($password || $confirm_password) {
411
+		if (strlen($password) < 6 || strlen($confirm_password) < 6) {
412 412
 			// Seems Weak Password
413
-			give_set_error( 'password_weak', __( 'Passwords should have at least 6 characters.', 'give' ) );
413
+			give_set_error('password_weak', __('Passwords should have at least 6 characters.', 'give'));
414 414
 			$valid = false;
415 415
 		}
416
-		if ( $password && $confirm_password ) {
416
+		if ($password && $confirm_password) {
417 417
 			// Verify confirmation matches.
418
-			if ( $password != $confirm_password ) {
418
+			if ($password != $confirm_password) {
419 419
 				// Passwords do not match
420
-				give_set_error( 'password_mismatch', __( 'Passwords you entered do not match. Please try again.', 'give' ) );
420
+				give_set_error('password_mismatch', __('Passwords you entered do not match. Please try again.', 'give'));
421 421
 				$valid = false;
422 422
 			}
423 423
 		}
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
 	 * @param string $confirm_password
434 434
 	 * @param bool   $registering_new_user
435 435
 	 */
436
-	$valid = (bool) apply_filters( 'give_validate_user_email', $valid, $password, $confirm_password, $registering_new_user );
436
+	$valid = (bool) apply_filters('give_validate_user_email', $valid, $password, $confirm_password, $registering_new_user);
437 437
 
438 438
 	return $valid;
439 439
 }
@@ -451,33 +451,33 @@  discard block
 block discarded – undo
451 451
  *
452 452
  * @return      void
453 453
  */
454
-function give_add_past_donations_to_new_user( $user_id ) {
454
+function give_add_past_donations_to_new_user($user_id) {
455 455
 
456
-	$email = get_the_author_meta( 'user_email', $user_id );
456
+	$email = get_the_author_meta('user_email', $user_id);
457 457
 
458
-	$payments = give_get_payments( array(
458
+	$payments = give_get_payments(array(
459 459
 		's' => $email,
460
-	) );
460
+	));
461 461
 
462
-	if ( $payments ) {
463
-		foreach ( $payments as $payment ) {
464
-			if ( intval( give_get_payment_user_id( $payment->ID ) ) > 0 ) {
462
+	if ($payments) {
463
+		foreach ($payments as $payment) {
464
+			if (intval(give_get_payment_user_id($payment->ID)) > 0) {
465 465
 				continue;
466 466
 			} // End if().
467 467
 
468
-			$meta                    = give_get_payment_meta( $payment->ID );
469
-			$meta['user_info']       = maybe_unserialize( $meta['user_info'] );
468
+			$meta                    = give_get_payment_meta($payment->ID);
469
+			$meta['user_info']       = maybe_unserialize($meta['user_info']);
470 470
 			$meta['user_info']['id'] = $user_id;
471 471
 
472 472
 			// Store the updated user ID in the payment meta.
473
-			give_update_payment_meta( $payment->ID, '_give_payment_meta', $meta );
474
-			give_update_payment_meta( $payment->ID, '_give_payment_user_id', $user_id );
473
+			give_update_payment_meta($payment->ID, '_give_payment_meta', $meta);
474
+			give_update_payment_meta($payment->ID, '_give_payment_user_id', $user_id);
475 475
 		}
476 476
 	}
477 477
 
478 478
 }
479 479
 
480
-add_action( 'user_register', 'give_add_past_donations_to_new_user' );
480
+add_action('user_register', 'give_add_past_donations_to_new_user');
481 481
 
482 482
 
483 483
 /**
@@ -503,34 +503,34 @@  discard block
 block discarded – undo
503 503
  *
504 504
  * @return        array The donor's address, if any
505 505
  */
506
-function give_get_donor_address( $user_id = 0 ) {
507
-	if ( empty( $user_id ) ) {
506
+function give_get_donor_address($user_id = 0) {
507
+	if (empty($user_id)) {
508 508
 		$user_id = get_current_user_id();
509 509
 	}
510 510
 
511
-	$address = get_user_meta( $user_id, '_give_user_address', true );
511
+	$address = get_user_meta($user_id, '_give_user_address', true);
512 512
 
513
-	if ( ! isset( $address['line1'] ) ) {
513
+	if ( ! isset($address['line1'])) {
514 514
 		$address['line1'] = '';
515 515
 	}
516 516
 
517
-	if ( ! isset( $address['line2'] ) ) {
517
+	if ( ! isset($address['line2'])) {
518 518
 		$address['line2'] = '';
519 519
 	}
520 520
 
521
-	if ( ! isset( $address['city'] ) ) {
521
+	if ( ! isset($address['city'])) {
522 522
 		$address['city'] = '';
523 523
 	}
524 524
 
525
-	if ( ! isset( $address['zip'] ) ) {
525
+	if ( ! isset($address['zip'])) {
526 526
 		$address['zip'] = '';
527 527
 	}
528 528
 
529
-	if ( ! isset( $address['country'] ) ) {
529
+	if ( ! isset($address['country'])) {
530 530
 		$address['country'] = '';
531 531
 	}
532 532
 
533
-	if ( ! isset( $address['state'] ) ) {
533
+	if ( ! isset($address['state'])) {
534 534
 		$address['state'] = '';
535 535
 	}
536 536
 
@@ -550,32 +550,32 @@  discard block
 block discarded – undo
550 550
  *
551 551
  * @return        void
552 552
  */
553
-function give_new_user_notification( $user_id = 0, $user_data = array() ) {
553
+function give_new_user_notification($user_id = 0, $user_data = array()) {
554 554
 
555
-	if ( empty( $user_id ) || empty( $user_data ) ) {
555
+	if (empty($user_id) || empty($user_data)) {
556 556
 		return;
557 557
 	}
558
-	$blogname = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
558
+	$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
559 559
 
560 560
 
561 561
 	// New User Registration: Email sends to the site admin.
562 562
 	$emails = Give()->emails;
563
-	$emails->__set( 'heading', esc_html__( 'New User Registration', 'give' ) );
563
+	$emails->__set('heading', esc_html__('New User Registration', 'give'));
564 564
 
565 565
 	/* translators: %s: site name */
566
-	$message = sprintf( esc_attr__( 'A new user has registered on %s:', 'give' ), $blogname ) . "\r\n\r\n";
566
+	$message = sprintf(esc_attr__('A new user has registered on %s:', 'give'), $blogname)."\r\n\r\n";
567 567
 	/* translators: %s: user login */
568
-	$message .= '<strong>' . esc_attr__( 'Username:', 'give' ) . '</strong> ' . $user_data['user_login'] . "\r\n";
568
+	$message .= '<strong>'.esc_attr__('Username:', 'give').'</strong> '.$user_data['user_login']."\r\n";
569 569
 	/* translators: %s: user email */
570
-	$message .= '<strong>' . esc_attr__( 'E-mail:', 'give' ) . '</strong> ' . $user_data['user_email']  . "\r\n\r\n";
570
+	$message .= '<strong>'.esc_attr__('E-mail:', 'give').'</strong> '.$user_data['user_email']."\r\n\r\n";
571 571
 
572
-	$message .= '<a href="' . admin_url('user-edit.php?user_id=' . $user_id) . '" target="_blank"> ' . esc_attr__( 'Click here to view &raquo;', 'give' ) . '</a>' . "\r\n";
572
+	$message .= '<a href="'.admin_url('user-edit.php?user_id='.$user_id).'" target="_blank"> '.esc_attr__('Click here to view &raquo;', 'give').'</a>'."\r\n";
573 573
 
574 574
 	$emails->send(
575
-		get_option( 'admin_email' ),
575
+		get_option('admin_email'),
576 576
 		sprintf(
577 577
 			/* translators: %s: site name */
578
-			esc_attr__( '[%s] New User Registration', 'give' ),
578
+			esc_attr__('[%s] New User Registration', 'give'),
579 579
 			$blogname
580 580
 		),
581 581
 		$message
@@ -583,22 +583,22 @@  discard block
 block discarded – undo
583 583
 
584 584
 
585 585
 	// Account Information: Email sends to donor who registered.
586
-	$emails->__set( 'heading', esc_html__( 'Account Information', 'give' ) );
586
+	$emails->__set('heading', esc_html__('Account Information', 'give'));
587 587
 
588
-	$message = sprintf( esc_attr__( 'The following email contains your account information for %s:', 'give' ), $blogname ) . "\r\n\r\n";
588
+	$message = sprintf(esc_attr__('The following email contains your account information for %s:', 'give'), $blogname)."\r\n\r\n";
589 589
 
590 590
 	/* translators: %s: user login */
591
-	$message .=  '<strong>' . esc_attr__( 'Username:', 'give' ) . '</strong> ' .  $user_data['user_login'] . "\r\n";
591
+	$message .= '<strong>'.esc_attr__('Username:', 'give').'</strong> '.$user_data['user_login']."\r\n";
592 592
 	/* translators: %s: password */
593
-	$message .=  '<strong>' . esc_attr__( 'Password:', 'give' ) . '</strong> ' . esc_attr__( '[Password entered during donation]', 'give' ) . "\r\n\r\n";
593
+	$message .= '<strong>'.esc_attr__('Password:', 'give').'</strong> '.esc_attr__('[Password entered during donation]', 'give')."\r\n\r\n";
594 594
 
595
-	$message .= '<a href="' . wp_login_url() . '" target="_blank"> ' . esc_attr__( 'Click here to login &raquo;', 'give' ) . '</a>' . "\r\n";
595
+	$message .= '<a href="'.wp_login_url().'" target="_blank"> '.esc_attr__('Click here to login &raquo;', 'give').'</a>'."\r\n";
596 596
 
597 597
 	$emails->send(
598 598
 		$user_data['user_email'],
599 599
 		sprintf(
600 600
 			/* translators: %s: site name */
601
-			esc_attr__( '[%s] Your username and password', 'give' ),
601
+			esc_attr__('[%s] Your username and password', 'give'),
602 602
 			$blogname
603 603
 		),
604 604
 		$message
@@ -606,7 +606,7 @@  discard block
 block discarded – undo
606 606
 
607 607
 }
608 608
 
609
-add_action( 'give_insert_user', 'give_new_user_notification', 10, 2 );
609
+add_action('give_insert_user', 'give_new_user_notification', 10, 2);
610 610
 
611 611
 
612 612
 /**
@@ -622,34 +622,34 @@  discard block
 block discarded – undo
622 622
  *
623 623
  * @return      string
624 624
  */
625
-function give_get_donor_name_by( $id = 0, $from = 'donation' ) {
625
+function give_get_donor_name_by($id = 0, $from = 'donation') {
626 626
 
627 627
 	// ID shouldn't be empty
628
-	if ( empty( $id ) ) {
628
+	if (empty($id)) {
629 629
 		return;
630 630
 	}
631 631
 
632 632
 	$name = '';
633 633
 
634
-	switch ( $from ) {
634
+	switch ($from) {
635 635
 
636 636
 		case 'donation':
637 637
 
638
-			$user_info = give_get_payment_meta_user_info( $id );
639
-			$name = $user_info['first_name'] . ' ' . $user_info['last_name'];
638
+			$user_info = give_get_payment_meta_user_info($id);
639
+			$name = $user_info['first_name'].' '.$user_info['last_name'];
640 640
 
641 641
 		break;
642 642
 
643 643
 		case 'donor':
644 644
 
645
-			$donor = new Give_Donor( $id );
645
+			$donor = new Give_Donor($id);
646 646
 			$name = $donor->name;
647 647
 
648 648
 		break;
649 649
 
650 650
 	}
651 651
 
652
-	return trim( $name );
652
+	return trim($name);
653 653
 
654 654
 }
655 655
 
@@ -661,8 +661,8 @@  discard block
 block discarded – undo
661 661
  * @param  string   $email Donor Email.
662 662
  * @return boolean  The user's ID on success, and false on failure.
663 663
  */
664
-function give_donor_email_exists( $email ) {
665
-	if ( Give()->donors->get_donor_by( 'email', $email ) ) {
664
+function give_donor_email_exists($email) {
665
+	if (Give()->donors->get_donor_by('email', $email)) {
666 666
 		return true;
667 667
 	}
668 668
 	return false;
Please login to merge, or discard this patch.
includes/admin/admin-actions.php 1 patch
Spacing   +107 added lines, -108 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -20,19 +20,19 @@  discard block
 block discarded – undo
20 20
  * @since 1.8
21 21
  */
22 22
 function give_load_wp_editor() {
23
-	if ( ! isset( $_POST['wp_editor'] ) ) {
23
+	if ( ! isset($_POST['wp_editor'])) {
24 24
 		die();
25 25
 	}
26 26
 
27
-	$wp_editor                     = json_decode( base64_decode( $_POST['wp_editor'] ), true );
27
+	$wp_editor                     = json_decode(base64_decode($_POST['wp_editor']), true);
28 28
 	$wp_editor[2]['textarea_name'] = $_POST['textarea_name'];
29 29
 
30
-	wp_editor( $wp_editor[0], $_POST['wp_editor_id'], $wp_editor[2] );
30
+	wp_editor($wp_editor[0], $_POST['wp_editor_id'], $wp_editor[2]);
31 31
 
32 32
 	die();
33 33
 }
34 34
 
35
-add_action( 'wp_ajax_give_load_wp_editor', 'give_load_wp_editor' );
35
+add_action('wp_ajax_give_load_wp_editor', 'give_load_wp_editor');
36 36
 
37 37
 
38 38
 /**
@@ -52,13 +52,13 @@  discard block
 block discarded – undo
52 52
 	);
53 53
 
54 54
 	// Get current page.
55
-	$current_page = isset( $_GET['page'] ) ? esc_attr( $_GET['page'] ) : '';
55
+	$current_page = isset($_GET['page']) ? esc_attr($_GET['page']) : '';
56 56
 
57 57
 	// Bailout.
58 58
 	if (
59
-		empty( $current_page )
60
-		|| empty( $_GET['_wp_http_referer'] )
61
-		|| ! in_array( $current_page, $give_pages )
59
+		empty($current_page)
60
+		|| empty($_GET['_wp_http_referer'])
61
+		|| ! in_array($current_page, $give_pages)
62 62
 	) {
63 63
 		return false;
64 64
 	}
@@ -68,21 +68,21 @@  discard block
 block discarded – undo
68 68
 	 *
69 69
 	 * @since 1.8
70 70
 	 */
71
-	$redirect = apply_filters( "give_validate_{$current_page}", true );
71
+	$redirect = apply_filters("give_validate_{$current_page}", true);
72 72
 
73
-	if ( $redirect ) {
73
+	if ($redirect) {
74 74
 		// Redirect.
75 75
 		wp_redirect(
76 76
 			remove_query_arg(
77
-				array( '_wp_http_referer', '_wpnonce' ),
78
-				wp_unslash( $_SERVER['REQUEST_URI'] )
77
+				array('_wp_http_referer', '_wpnonce'),
78
+				wp_unslash($_SERVER['REQUEST_URI'])
79 79
 			)
80 80
 		);
81 81
 		exit;
82 82
 	}
83 83
 }
84 84
 
85
-add_action( 'admin_init', 'give_redirect_to_clean_url_admin_pages' );
85
+add_action('admin_init', 'give_redirect_to_clean_url_admin_pages');
86 86
 
87 87
 
88 88
 /**
@@ -96,25 +96,25 @@  discard block
 block discarded – undo
96 96
  */
97 97
 function give_hide_outdated_php_notice() {
98 98
 
99
-	if ( ! isset( $_POST['_give_hide_outdated_php_notices_shortly'] ) ) {
99
+	if ( ! isset($_POST['_give_hide_outdated_php_notices_shortly'])) {
100 100
 		give_die();
101 101
 	}
102 102
 
103 103
 	// Transient key name.
104 104
 	$transient_key = "_give_hide_outdated_php_notices_shortly";
105 105
 
106
-	if ( Give_Cache::get( $transient_key, true ) ) {
106
+	if (Give_Cache::get($transient_key, true)) {
107 107
 		return;
108 108
 	}
109 109
 
110 110
 	// Hide notice for 24 hours.
111
-	Give_Cache::set( $transient_key, true, DAY_IN_SECONDS, true );
111
+	Give_Cache::set($transient_key, true, DAY_IN_SECONDS, true);
112 112
 
113 113
 	give_die();
114 114
 
115 115
 }
116 116
 
117
-add_action( 'wp_ajax_give_hide_outdated_php_notice', 'give_hide_outdated_php_notice' );
117
+add_action('wp_ajax_give_hide_outdated_php_notice', 'give_hide_outdated_php_notice');
118 118
 
119 119
 /**
120 120
  * Register admin notices.
@@ -123,23 +123,23 @@  discard block
 block discarded – undo
123 123
  */
124 124
 function _give_register_admin_notices() {
125 125
 	// Bailout.
126
-	if( ! is_admin() ) {
126
+	if ( ! is_admin()) {
127 127
 		return;
128 128
 	}
129 129
 
130 130
 	// Add payment bulk notice.
131 131
 	if (
132
-		current_user_can( 'edit_give_payments' )
133
-		&& isset( $_GET['action'] )
134
-		&& ! empty( $_GET['action'] )
135
-		&& isset( $_GET['payment'] )
136
-		&& ! empty( $_GET['payment'] )
132
+		current_user_can('edit_give_payments')
133
+		&& isset($_GET['action'])
134
+		&& ! empty($_GET['action'])
135
+		&& isset($_GET['payment'])
136
+		&& ! empty($_GET['payment'])
137 137
 	) {
138
-		$payment_count = isset( $_GET['payment'] ) ? count( $_GET['payment'] ) : 0;
138
+		$payment_count = isset($_GET['payment']) ? count($_GET['payment']) : 0;
139 139
 
140
-		switch ( $_GET['action'] ) {
140
+		switch ($_GET['action']) {
141 141
 			case 'delete':
142
-				Give()->notices->register_notice( array(
142
+				Give()->notices->register_notice(array(
143 143
 					'id'          => 'bulk_action_delete',
144 144
 					'type'        => 'updated',
145 145
 					'description' => sprintf(
@@ -151,12 +151,12 @@  discard block
 block discarded – undo
151 151
 						),
152 152
 						$payment_count ),
153 153
 					'show'        => true,
154
-				) );
154
+				));
155 155
 
156 156
 				break;
157 157
 
158 158
 			case 'resend-receipt':
159
-				Give()->notices->register_notice( array(
159
+				Give()->notices->register_notice(array(
160 160
 					'id'          => 'bulk_action_resend_receipt',
161 161
 					'type'        => 'updated',
162 162
 					'description' => sprintf(
@@ -169,196 +169,196 @@  discard block
 block discarded – undo
169 169
 						$payment_count
170 170
 					),
171 171
 					'show'        => true,
172
-				) );
172
+				));
173 173
 				break;
174 174
 		}
175 175
 	}
176 176
 
177 177
 	// Add give message notices.
178
-	if ( ! empty( $_GET['give-message'] ) ) {
178
+	if ( ! empty($_GET['give-message'])) {
179 179
 		// Donation reports errors.
180
-		if ( current_user_can( 'view_give_reports' ) ) {
181
-			switch ( $_GET['give-message'] ) {
180
+		if (current_user_can('view_give_reports')) {
181
+			switch ($_GET['give-message']) {
182 182
 				case 'donation_deleted' :
183
-					Give()->notices->register_notice( array(
183
+					Give()->notices->register_notice(array(
184 184
 						'id'          => 'give-donation-deleted',
185 185
 						'type'        => 'updated',
186
-						'description' => __( 'The donation has been deleted.', 'give' ),
186
+						'description' => __('The donation has been deleted.', 'give'),
187 187
 						'show'        => true,
188
-					) );
188
+					));
189 189
 					break;
190 190
 				case 'email_sent' :
191
-					Give()->notices->register_notice( array(
191
+					Give()->notices->register_notice(array(
192 192
 						'id'          => 'give-payment-sent',
193 193
 						'type'        => 'updated',
194
-						'description' => __( 'The donation receipt has been resent.', 'give' ),
194
+						'description' => __('The donation receipt has been resent.', 'give'),
195 195
 						'show'        => true,
196
-					) );
196
+					));
197 197
 					break;
198 198
 				case 'refreshed-reports' :
199
-					Give()->notices->register_notice( array(
199
+					Give()->notices->register_notice(array(
200 200
 						'id'          => 'give-refreshed-reports',
201 201
 						'type'        => 'updated',
202
-						'description' => __( 'The reports cache has been cleared.', 'give' ),
202
+						'description' => __('The reports cache has been cleared.', 'give'),
203 203
 						'show'        => true,
204
-					) );
204
+					));
205 205
 					break;
206 206
 				case 'donation-note-deleted' :
207
-					Give()->notices->register_notice( array(
207
+					Give()->notices->register_notice(array(
208 208
 						'id'          => 'give-donation-note-deleted',
209 209
 						'type'        => 'updated',
210
-						'description' => __( 'The donation note has been deleted.', 'give' ),
210
+						'description' => __('The donation note has been deleted.', 'give'),
211 211
 						'show'        => true,
212
-					) );
212
+					));
213 213
 					break;
214 214
 			}
215 215
 		}
216 216
 
217 217
 		// Give settings notices and errors.
218
-		if ( current_user_can( 'manage_give_settings' ) ) {
219
-			switch ( $_GET['give-message'] ) {
218
+		if (current_user_can('manage_give_settings')) {
219
+			switch ($_GET['give-message']) {
220 220
 				case 'settings-imported' :
221
-					Give()->notices->register_notice( array(
221
+					Give()->notices->register_notice(array(
222 222
 						'id'          => 'give-settings-imported',
223 223
 						'type'        => 'updated',
224
-						'description' => __( 'The settings have been imported.', 'give' ),
224
+						'description' => __('The settings have been imported.', 'give'),
225 225
 						'show'        => true,
226
-					) );
226
+					));
227 227
 					break;
228 228
 				case 'api-key-generated' :
229
-					Give()->notices->register_notice( array(
229
+					Give()->notices->register_notice(array(
230 230
 						'id'          => 'give-api-key-generated',
231 231
 						'type'        => 'updated',
232
-						'description' => __( 'API keys have been generated.', 'give' ),
232
+						'description' => __('API keys have been generated.', 'give'),
233 233
 						'show'        => true,
234
-					) );
234
+					));
235 235
 					break;
236 236
 				case 'api-key-exists' :
237
-					Give()->notices->register_notice( array(
237
+					Give()->notices->register_notice(array(
238 238
 						'id'          => 'give-api-key-exists',
239 239
 						'type'        => 'updated',
240
-						'description' => __( 'The specified user already has API keys.', 'give' ),
240
+						'description' => __('The specified user already has API keys.', 'give'),
241 241
 						'show'        => true,
242
-					) );
242
+					));
243 243
 					break;
244 244
 				case 'api-key-regenerated' :
245
-					Give()->notices->register_notice( array(
245
+					Give()->notices->register_notice(array(
246 246
 						'id'          => 'give-api-key-regenerated',
247 247
 						'type'        => 'updated',
248
-						'description' => __( 'API keys have been regenerated.', 'give' ),
248
+						'description' => __('API keys have been regenerated.', 'give'),
249 249
 						'show'        => true,
250
-					) );
250
+					));
251 251
 					break;
252 252
 				case 'api-key-revoked' :
253
-					Give()->notices->register_notice( array(
253
+					Give()->notices->register_notice(array(
254 254
 						'id'          => 'give-api-key-revoked',
255 255
 						'type'        => 'updated',
256
-						'description' => __( 'API keys have been revoked.', 'give' ),
256
+						'description' => __('API keys have been revoked.', 'give'),
257 257
 						'show'        => true,
258
-					) );
258
+					));
259 259
 					break;
260 260
 				case 'sent-test-email' :
261
-					Give()->notices->register_notice( array(
261
+					Give()->notices->register_notice(array(
262 262
 						'id'          => 'give-sent-test-email',
263 263
 						'type'        => 'updated',
264
-						'description' => __( 'The test email has been sent.', 'give' ),
264
+						'description' => __('The test email has been sent.', 'give'),
265 265
 						'show'        => true,
266
-					) );
266
+					));
267 267
 					break;
268 268
 				case 'matched-success-failure-page':
269
-					Give()->notices->register_notice( array(
269
+					Give()->notices->register_notice(array(
270 270
 						'id'          => 'give-matched-success-failure-page',
271 271
 						'type'        => 'updated',
272
-						'description' => __( 'You cannot set the success and failed pages to the same page', 'give' ),
272
+						'description' => __('You cannot set the success and failed pages to the same page', 'give'),
273 273
 						'show'        => true,
274
-					) );
274
+					));
275 275
 					break;
276 276
 			}
277 277
 		}
278 278
 		// Payments errors.
279
-		if ( current_user_can( 'edit_give_payments' ) ) {
280
-			switch ( $_GET['give-message'] ) {
279
+		if (current_user_can('edit_give_payments')) {
280
+			switch ($_GET['give-message']) {
281 281
 				case 'note-added' :
282
-					Give()->notices->register_notice( array(
282
+					Give()->notices->register_notice(array(
283 283
 						'id'          => 'give-note-added',
284 284
 						'type'        => 'updated',
285
-						'description' => __( 'The donation note has been added.', 'give' ),
285
+						'description' => __('The donation note has been added.', 'give'),
286 286
 						'show'        => true,
287
-					) );
287
+					));
288 288
 					break;
289 289
 				case 'payment-updated' :
290
-					Give()->notices->register_notice( array(
290
+					Give()->notices->register_notice(array(
291 291
 						'id'          => 'give-payment-updated',
292 292
 						'type'        => 'updated',
293
-						'description' => __( 'The donation has been updated.', 'give' ),
293
+						'description' => __('The donation has been updated.', 'give'),
294 294
 						'show'        => true,
295
-					) );
295
+					));
296 296
 					break;
297 297
 			}
298 298
 		}
299 299
 
300 300
 		// Donor Notices.
301
-		if ( current_user_can( 'edit_give_payments' ) ) {
302
-			switch ( $_GET['give-message'] ) {
301
+		if (current_user_can('edit_give_payments')) {
302
+			switch ($_GET['give-message']) {
303 303
 				case 'donor-deleted' :
304
-					Give()->notices->register_notice( array(
304
+					Give()->notices->register_notice(array(
305 305
 						'id'          => 'give-donor-deleted',
306 306
 						'type'        => 'updated',
307
-						'description' => __( 'The donor has been deleted.', 'give' ),
307
+						'description' => __('The donor has been deleted.', 'give'),
308 308
 						'show'        => true,
309
-					) );
309
+					));
310 310
 					break;
311 311
 
312 312
 				case 'email-added' :
313
-					Give()->notices->register_notice( array(
313
+					Give()->notices->register_notice(array(
314 314
 						'id'          => 'give-donor-email-added',
315 315
 						'type'        => 'updated',
316
-						'description' => __( 'Donor email added.', 'give' ),
316
+						'description' => __('Donor email added.', 'give'),
317 317
 						'show'        => true,
318
-					) );
318
+					));
319 319
 					break;
320 320
 
321 321
 				case 'email-removed' :
322
-					Give()->notices->register_notice( array(
322
+					Give()->notices->register_notice(array(
323 323
 						'id'          => 'give-donor-email-removed',
324 324
 						'type'        => 'updated',
325
-						'description' => __( 'Donor email removed.', 'give' ),
325
+						'description' => __('Donor email removed.', 'give'),
326 326
 						'show'        => true,
327
-					) );
327
+					));
328 328
 					break;
329 329
 
330 330
 				case 'email-remove-failed' :
331
-					Give()->notices->register_notice( array(
331
+					Give()->notices->register_notice(array(
332 332
 						'id'          => 'give-donor-email-remove-failed',
333 333
 						'type'        => 'updated',
334
-						'description' => __( 'Failed to remove donor email.', 'give' ),
334
+						'description' => __('Failed to remove donor email.', 'give'),
335 335
 						'show'        => true,
336
-					) );
336
+					));
337 337
 					break;
338 338
 
339 339
 				case 'primary-email-updated' :
340
-					Give()->notices->register_notice( array(
340
+					Give()->notices->register_notice(array(
341 341
 						'id'          => 'give-donor-primary-email-updated',
342 342
 						'type'        => 'updated',
343
-						'description' => __( 'Primary email updated for donor.', 'give' ),
343
+						'description' => __('Primary email updated for donor.', 'give'),
344 344
 						'show'        => true,
345
-					) );
345
+					));
346 346
 					break;
347 347
 
348 348
 				case 'primary-email-failed' :
349
-					Give()->notices->register_notice( array(
349
+					Give()->notices->register_notice(array(
350 350
 						'id'          => 'give-donor-primary-email-failed',
351 351
 						'type'        => 'updated',
352
-						'description' => __( 'Failed to set primary email.', 'give' ),
352
+						'description' => __('Failed to set primary email.', 'give'),
353 353
 						'show'        => true,
354
-					) );
354
+					));
355 355
 					break;
356 356
 			}
357 357
 		}
358 358
 	}
359 359
 }
360 360
 
361
-add_action( 'admin_notices', '_give_register_admin_notices', - 1 );
361
+add_action('admin_notices', '_give_register_admin_notices', - 1);
362 362
 
363 363
 
364 364
 /**
@@ -368,27 +368,26 @@  discard block
 block discarded – undo
368 368
  *
369 369
  * @return bool
370 370
  */
371
-function _give_show_test_mode_notice_in_admin_bar( $wp_admin_bar ) {
372
-	$is_test_mode = ! empty( $_POST['test_mode'] ) ?
373
-		give_is_setting_enabled( $_POST['test_mode'] ) :
374
-		give_is_test_mode();
371
+function _give_show_test_mode_notice_in_admin_bar($wp_admin_bar) {
372
+	$is_test_mode = ! empty($_POST['test_mode']) ?
373
+		give_is_setting_enabled($_POST['test_mode']) : give_is_test_mode();
375 374
 
376 375
 	if (
377
-		! current_user_can( 'view_give_reports' ) ||
376
+		! current_user_can('view_give_reports') ||
378 377
 		! $is_test_mode
379 378
 	) {
380 379
 		return false;
381 380
 	}
382 381
 
383 382
 	// Add the main siteadmin menu item.
384
-	$wp_admin_bar->add_menu( array(
383
+	$wp_admin_bar->add_menu(array(
385 384
 		'id'     => 'give-test-notice',
386
-		'href'   => admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=gateways' ),
385
+		'href'   => admin_url('edit.php?post_type=give_forms&page=give-settings&tab=gateways'),
387 386
 		'parent' => 'top-secondary',
388
-		'title'  => esc_html__( 'Give Test Mode Active', 'give' ),
389
-		'meta'   => array( 'class' => 'give-test-mode-active' ),
390
-	) );
387
+		'title'  => esc_html__('Give Test Mode Active', 'give'),
388
+		'meta'   => array('class' => 'give-test-mode-active'),
389
+	));
391 390
 
392 391
 	return true;
393 392
 }
394
-add_action( 'admin_bar_menu', '_give_show_test_mode_notice_in_admin_bar', 1000, 1 );
395 393
\ No newline at end of file
394
+add_action('admin_bar_menu', '_give_show_test_mode_notice_in_admin_bar', 1000, 1);
396 395
\ No newline at end of file
Please login to merge, or discard this patch.
templates/shortcode-receipt.php 1 patch
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -6,25 +6,25 @@  discard block
 block discarded – undo
6 6
 global $give_receipt_args, $payment;
7 7
 
8 8
 // Validation: Ensure $payment var is set.
9
-if ( empty( $payment ) ) {
10
-	$payment = ! empty( $give_receipt_args['id'] ) ? get_post( $give_receipt_args['id'] ) : 0;
9
+if (empty($payment)) {
10
+	$payment = ! empty($give_receipt_args['id']) ? get_post($give_receipt_args['id']) : 0;
11 11
 }
12 12
 
13 13
 // Double-Validation: Check for $payment global.
14
-if ( empty( $payment ) ) {
15
-	Give()->notices->print_frontend_notice( __( 'The specified receipt ID appears to be invalid.', 'give' ) );
14
+if (empty($payment)) {
15
+	Give()->notices->print_frontend_notice(__('The specified receipt ID appears to be invalid.', 'give'));
16 16
 
17 17
 	return;
18 18
 }
19 19
 
20 20
 $donation_id    = $payment->ID;
21
-$form_id        = give_get_payment_meta( $donation_id, '_give_payment_form_id', true );
22
-$meta           = give_get_payment_meta( $donation_id );
23
-$donation       = give_get_payment_form_title( $meta );
24
-$user           = give_get_payment_meta_user_info( $donation_id );
25
-$email          = give_get_payment_user_email( $donation_id );
21
+$form_id        = give_get_payment_meta($donation_id, '_give_payment_form_id', true);
22
+$meta           = give_get_payment_meta($donation_id);
23
+$donation       = give_get_payment_form_title($meta);
24
+$user           = give_get_payment_meta_user_info($donation_id);
25
+$email          = give_get_payment_user_email($donation_id);
26 26
 $status         = $payment->post_status;
27
-$status_label   = give_get_payment_status( $payment, true );
27
+$status_label   = give_get_payment_status($payment, true);
28 28
 
29 29
 /**
30 30
  * Generate Donation Receipt Arguments.
@@ -34,56 +34,56 @@  discard block
 block discarded – undo
34 34
  * @since 1.8.8
35 35
  */
36 36
 $give_receipt_args['donation_receipt']['donor'] = array(
37
-	'name'      => __( 'Donor', 'give' ),
38
-	'value'     => $user['first_name'] . ' ' . $user['last_name'],
37
+	'name'      => __('Donor', 'give'),
38
+	'value'     => $user['first_name'].' '.$user['last_name'],
39 39
 	'display'   => $give_receipt_args['donor'],
40 40
 );
41 41
 
42 42
 $give_receipt_args['donation_receipt']['date'] = array(
43
-	'name'      => __( 'Date', 'give' ),
44
-	'value'     => date_i18n( give_date_format(), strtotime( $meta['date'] ) ),
43
+	'name'      => __('Date', 'give'),
44
+	'value'     => date_i18n(give_date_format(), strtotime($meta['date'])),
45 45
 	'display'   => $give_receipt_args['date'],
46 46
 );
47 47
 
48 48
 $give_receipt_args['donation_receipt']['total_donation'] = array(
49
-	'name'      => __( 'Total Donation', 'give' ),
50
-	'value'     => give_payment_amount( $donation_id ),
49
+	'name'      => __('Total Donation', 'give'),
50
+	'value'     => give_payment_amount($donation_id),
51 51
 	'display'   => true,
52 52
 );
53 53
 
54 54
 $give_receipt_args['donation_receipt']['donation'] = array(
55
-	'name'      => __( 'Donation', 'give' ),
55
+	'name'      => __('Donation', 'give'),
56 56
 	'value'     => $donation,
57 57
 	'display'   => true,
58 58
 );
59 59
 
60 60
 $give_receipt_args['donation_receipt']['donation_status'] = array(
61
-	'name'      => __( 'Donation Status', 'give' ),
62
-	'value'     => esc_attr( $status ),
61
+	'name'      => __('Donation Status', 'give'),
62
+	'value'     => esc_attr($status),
63 63
 	'display'   => $give_receipt_args['payment_status'],
64 64
 );
65 65
 
66 66
 $give_receipt_args['donation_receipt']['donation_id'] = array(
67
-	'name'      => __( 'Donation ID', 'give' ),
67
+	'name'      => __('Donation ID', 'give'),
68 68
 	'value'     => $donation_id,
69
-	'display'   => ($give_receipt_args['payment_id'])?true:false,
69
+	'display'   => ($give_receipt_args['payment_id']) ?true:false,
70 70
 );
71 71
 
72 72
 $give_receipt_args['donation_receipt']['payment_details'] = array(
73
-	'name'      => __( 'Payment:', 'give' ),
74
-	'value'     => __( 'Details:', 'give' ),
75
-	'display'   => ($give_receipt_args['payment_id'])?false:true,
73
+	'name'      => __('Payment:', 'give'),
74
+	'value'     => __('Details:', 'give'),
75
+	'display'   => ($give_receipt_args['payment_id']) ?false:true,
76 76
 );
77 77
 
78 78
 $give_receipt_args['donation_receipt']['payment_key'] = array(
79
-	'name'      => __( 'Payment Key', 'give' ),
80
-	'value'     => get_post_meta( $donation_id, '_give_payment_purchase_key', true ),
79
+	'name'      => __('Payment Key', 'give'),
80
+	'value'     => get_post_meta($donation_id, '_give_payment_purchase_key', true),
81 81
 	'display'   => $give_receipt_args['payment_key'],
82 82
 );
83 83
 
84 84
 $give_receipt_args['donation_receipt']['payment_method'] = array(
85
-	'name'      => __( 'Payment Method', 'give' ),
86
-	'value'     => give_get_gateway_checkout_label( give_get_payment_gateway( $donation_id ) ),
85
+	'name'      => __('Payment Method', 'give'),
86
+	'value'     => give_get_gateway_checkout_label(give_get_payment_gateway($donation_id)),
87 87
 	'display'   => true,
88 88
 );
89 89
 
@@ -98,49 +98,49 @@  discard block
 block discarded – undo
98 98
  *
99 99
  * @since 1.8.8
100 100
  */
101
-$give_receipt_args['donation_receipt'] = apply_filters( 'give_donation_receipt_args', $give_receipt_args['donation_receipt'], $donation_id, $form_id );
101
+$give_receipt_args['donation_receipt'] = apply_filters('give_donation_receipt_args', $give_receipt_args['donation_receipt'], $donation_id, $form_id);
102 102
 
103 103
 // Show payment status notice based on shortcode attribute.
104
-if ( filter_var( $give_receipt_args['status_notice'], FILTER_VALIDATE_BOOLEAN ) ) {
104
+if (filter_var($give_receipt_args['status_notice'], FILTER_VALIDATE_BOOLEAN)) {
105 105
 	$notice_message = '';
106 106
 	$notice_type    = 'warning';
107 107
 
108
-	switch ( $status ) {
108
+	switch ($status) {
109 109
 		case 'publish':
110
-			$notice_message = __( 'Payment Complete: Thank you for your donation.', 'give' );
110
+			$notice_message = __('Payment Complete: Thank you for your donation.', 'give');
111 111
 			$notice_type    = 'success';
112 112
 			break;
113 113
 		case 'pending':
114
-			$notice_message = __( 'Payment Pending: Your donation is currently processing.', 'give' );
114
+			$notice_message = __('Payment Pending: Your donation is currently processing.', 'give');
115 115
 			$notice_type    = 'warning';
116 116
 			break;
117 117
 		case 'refunded':
118
-			$notice_message = __( 'Payment Refunded: Your donation has been refunded.', 'give' );
118
+			$notice_message = __('Payment Refunded: Your donation has been refunded.', 'give');
119 119
 			$notice_type    = 'warning';
120 120
 			break;
121 121
 		case 'preapproval':
122
-			$notice_message = __( 'Payment Preapproved: Thank you for your donation.', 'give' );
122
+			$notice_message = __('Payment Preapproved: Thank you for your donation.', 'give');
123 123
 			$notice_type    = 'warning';
124 124
 			break;
125 125
 		case 'failed':
126
-			$notice_message = __( 'Payment Failed: Please contact the site owner for assistance.', 'give' );
126
+			$notice_message = __('Payment Failed: Please contact the site owner for assistance.', 'give');
127 127
 			$notice_type    = 'error';
128 128
 			break;
129 129
 		case 'cancelled':
130
-			$notice_message = __( 'Payment Cancelled: Your donation has been cancelled.', 'give' );
130
+			$notice_message = __('Payment Cancelled: Your donation has been cancelled.', 'give');
131 131
 			$notice_type    = 'error';
132 132
 			break;
133 133
 		case 'abandoned':
134
-			$notice_message = __( 'Payment Abandoned: This donation has not been completed.', 'give' );
134
+			$notice_message = __('Payment Abandoned: This donation has not been completed.', 'give');
135 135
 			$notice_type    = 'error';
136 136
 			break;
137 137
 		case 'revoked':
138
-			$notice_message = __( 'Payment Revoked: Please contact the site owner for assistance.', 'give' );
138
+			$notice_message = __('Payment Revoked: Please contact the site owner for assistance.', 'give');
139 139
 			$notice_type    = 'error';
140 140
 			break;
141 141
 	}
142 142
 
143
-	if ( ! empty( $notice_message ) ) {
143
+	if ( ! empty($notice_message)) {
144 144
 		/**
145 145
 		 * Filters payment status notice for receipts.
146 146
 		 *
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 		 * @param string $status Payment status.
156 156
 		 * @param array  $meta   Array of meta data related to the payment.
157 157
 		 */
158
-		echo apply_filters( 'give_receipt_status_notice', Give()->notices->print_frontend_notice( $notice_message, false, $notice_type ), $id, $status, $meta );
158
+		echo apply_filters('give_receipt_status_notice', Give()->notices->print_frontend_notice($notice_message, false, $notice_type), $id, $status, $meta);
159 159
 	}
160 160
 }// End if().
161 161
 
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
  * @param object $payment           The payment object.
170 170
  * @param array  $give_receipt_args Receipt_argument.
171 171
  */
172
-do_action( 'give_payment_receipt_before_table', $payment, $give_receipt_args );
172
+do_action('give_payment_receipt_before_table', $payment, $give_receipt_args);
173 173
 ?>
174 174
 
175 175
 	<table id="give_donation_receipt" class="give-table">
@@ -185,11 +185,11 @@  discard block
 block discarded – undo
185 185
 		 * @param object $payment           The payment object.
186 186
 		 * @param array  $give_receipt_args Receipt_argument.
187 187
 		 */
188
-		do_action( 'give_payment_receipt_header_before', $payment, $give_receipt_args );
188
+		do_action('give_payment_receipt_header_before', $payment, $give_receipt_args);
189 189
 		?>
190 190
 		<tr>
191 191
 			<th scope="colgroup" colspan="2">
192
-				<span class="give-receipt-thead-text"><?php esc_html_e( 'Donation Receipt', 'give' ) ?></span>
192
+				<span class="give-receipt-thead-text"><?php esc_html_e('Donation Receipt', 'give') ?></span>
193 193
 			</th>
194 194
 		</tr>
195 195
 		<?php
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 		 * @param object $payment           The payment object.
204 204
 		 * @param array  $give_receipt_args Receipt_argument.
205 205
 		 */
206
-		do_action( 'give_payment_receipt_header_after', $payment, $give_receipt_args );
206
+		do_action('give_payment_receipt_header_after', $payment, $give_receipt_args);
207 207
 		?>
208 208
 		</thead>
209 209
 
@@ -219,11 +219,11 @@  discard block
 block discarded – undo
219 219
 		 * @param object $payment           The payment object.
220 220
 		 * @param array  $give_receipt_args Receipt_argument.
221 221
 		 */
222
-		do_action( 'give_payment_receipt_before', $payment, $give_receipt_args );
222
+		do_action('give_payment_receipt_before', $payment, $give_receipt_args);
223 223
 		?>
224 224
 
225
-		<?php foreach ( $give_receipt_args['donation_receipt'] as $receipt_item ) { ?>
226
-			<?php if ( filter_var( $receipt_item['display'], FILTER_VALIDATE_BOOLEAN ) ) : ?>
225
+		<?php foreach ($give_receipt_args['donation_receipt'] as $receipt_item) { ?>
226
+			<?php if (filter_var($receipt_item['display'], FILTER_VALIDATE_BOOLEAN)) : ?>
227 227
 			<tr>
228 228
 				<td scope="row"><strong><?php echo $receipt_item['name']; ?></strong></td>
229 229
 				<td><?php echo $receipt_item['value']; ?></td>
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 		 * @param object $payment           The payment object.
243 243
 		 * @param array  $give_receipt_args Receipt_argument.
244 244
 		 */
245
-		do_action( 'give_payment_receipt_after', $payment, $give_receipt_args );
245
+		do_action('give_payment_receipt_after', $payment, $give_receipt_args);
246 246
 		?>
247 247
 		</tbody>
248 248
 	</table>
@@ -258,5 +258,5 @@  discard block
 block discarded – undo
258 258
  * @param object $payment           The payment object.
259 259
  * @param array  $give_receipt_args Receipt_argument.
260 260
  */
261
-do_action( 'give_payment_receipt_after_table', $payment, $give_receipt_args );
261
+do_action('give_payment_receipt_after_table', $payment, $give_receipt_args);
262 262
 ?>
Please login to merge, or discard this patch.
includes/admin/upgrades/class-give-updates.php 1 patch
Spacing   +82 added lines, -82 removed lines patch added patch discarded remove patch
@@ -70,24 +70,24 @@  discard block
 block discarded – undo
70 70
 	 *
71 71
 	 * @param array $args
72 72
 	 */
73
-	public function register( $args ) {
73
+	public function register($args) {
74 74
 		$args_default = array(
75 75
 			'id'       => '',
76 76
 			'version'  => '',
77 77
 			'callback' => '',
78 78
 		);
79 79
 
80
-		$args = wp_parse_args( $args, $args_default );
80
+		$args = wp_parse_args($args, $args_default);
81 81
 
82 82
 		// You can only register database upgrade.
83 83
 		$args['type'] = 'database';
84 84
 
85 85
 		// Bailout.
86
-		if ( empty( $args['id'] ) || empty( $args['version'] ) || empty( $args['callback'] ) || ! is_callable( $args['callback'] ) ) {
86
+		if (empty($args['id']) || empty($args['version']) || empty($args['callback']) || ! is_callable($args['callback'])) {
87 87
 			return;
88 88
 		}
89 89
 
90
-		$this->updates[ $args['type'] ][] = $args;
90
+		$this->updates[$args['type']][] = $args;
91 91
 	}
92 92
 
93 93
 
@@ -102,32 +102,32 @@  discard block
 block discarded – undo
102 102
 	 *
103 103
 	 * @return array
104 104
 	 */
105
-	public function get_updates( $update_type = '', $status = 'all' ) {
105
+	public function get_updates($update_type = '', $status = 'all') {
106 106
 		// return all updates.
107
-		if ( empty( $update_type ) ) {
107
+		if (empty($update_type)) {
108 108
 			return $this->updates;
109 109
 		}
110 110
 
111 111
 		// Get specific update.
112
-		$updates = ! empty( $this->updates[ $update_type ] ) ? $this->updates[ $update_type ] : array();
112
+		$updates = ! empty($this->updates[$update_type]) ? $this->updates[$update_type] : array();
113 113
 
114 114
 		// Bailout.
115
-		if ( empty( $updates ) ) {
115
+		if (empty($updates)) {
116 116
 			return $updates;
117 117
 		}
118 118
 
119
-		switch ( $status ) {
119
+		switch ($status) {
120 120
 			case 'new':
121 121
 				// Remove already completed updates.
122 122
 				$completed_updates = give_get_completed_upgrades();
123 123
 
124
-				if ( ! empty( $completed_updates ) ) {
125
-					foreach ( $updates as $index => $update ) {
126
-						if ( in_array( $update['id'], $completed_updates ) ) {
127
-							unset( $updates[ $index ] );
124
+				if ( ! empty($completed_updates)) {
125
+					foreach ($updates as $index => $update) {
126
+						if (in_array($update['id'], $completed_updates)) {
127
+							unset($updates[$index]);
128 128
 						}
129 129
 					}
130
-					$updates = array_values( $updates );
130
+					$updates = array_values($updates);
131 131
 				}
132 132
 
133 133
 				break;
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 	 * @return static
145 145
 	 */
146 146
 	static function get_instance() {
147
-		if ( is_null( self::$instance ) ) {
147
+		if (is_null(self::$instance)) {
148 148
 			self::$instance = new self();
149 149
 		}
150 150
 
@@ -162,16 +162,16 @@  discard block
 block discarded – undo
162 162
 		/**
163 163
 		 * Setup hooks.
164 164
 		 */
165
-		add_action( 'init', array( $this, '__register_upgrade' ), 9999 );
166
-		add_action( 'admin_init', array( $this, '__change_donations_label' ), 9999 );
167
-		add_action( 'admin_menu', array( $this, '__register_menu' ), 9999 );
168
-		add_action( 'give_set_upgrade_completed', array( $this, '__flush_resume_updates' ), 9999 );
169
-		add_action( 'wp_ajax_give_do_ajax_updates', array( $this, '__give_ajax_updates' ) );
165
+		add_action('init', array($this, '__register_upgrade'), 9999);
166
+		add_action('admin_init', array($this, '__change_donations_label'), 9999);
167
+		add_action('admin_menu', array($this, '__register_menu'), 9999);
168
+		add_action('give_set_upgrade_completed', array($this, '__flush_resume_updates'), 9999);
169
+		add_action('wp_ajax_give_do_ajax_updates', array($this, '__give_ajax_updates'));
170 170
 
171 171
 		/**
172 172
 		 * Load file
173 173
 		 */
174
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php';
174
+		require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php';
175 175
 	}
176 176
 
177 177
 	/**
@@ -184,12 +184,12 @@  discard block
 block discarded – undo
184 184
 		$addons         = give_get_plugins();
185 185
 		$plugin_updates = get_plugin_updates();
186 186
 
187
-		foreach ( $addons as $key => $info ) {
188
-			if ( 'active' != $info['Status'] || 'add-on' != $info['Type'] || empty( $plugin_updates[ $key ] ) ) {
187
+		foreach ($addons as $key => $info) {
188
+			if ('active' != $info['Status'] || 'add-on' != $info['Type'] || empty($plugin_updates[$key])) {
189 189
 				continue;
190 190
 			}
191 191
 
192
-			$this->updates['plugin'][] = array_merge( $info, (array) $plugin_updates[ $key ] );
192
+			$this->updates['plugin'][] = array_merge($info, (array) $plugin_updates[$key]);
193 193
 		}
194 194
 	}
195 195
 
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 	 * @access public
202 202
 	 */
203 203
 	public function __register_upgrade() {
204
-		if ( ! is_admin() ) {
204
+		if ( ! is_admin()) {
205 205
 			return;
206 206
 		}
207 207
 
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 		 *
211 211
 		 * @since 1.8.12
212 212
 		 */
213
-		do_action( 'give_register_updates', $this );
213
+		do_action('give_register_updates', $this);
214 214
 	}
215 215
 
216 216
 	/**
@@ -224,17 +224,17 @@  discard block
 block discarded – undo
224 224
 		global $submenu;
225 225
 
226 226
 		// Bailout.
227
-		if ( empty( $menu ) || ! $this->get_update_count() ) {
227
+		if (empty($menu) || ! $this->get_update_count()) {
228 228
 			return;
229 229
 		}
230 230
 
231
-		foreach ( $menu as $index => $menu_item ) {
232
-			if ( 'edit.php?post_type=give_forms' !== $menu_item[2] ) {
231
+		foreach ($menu as $index => $menu_item) {
232
+			if ('edit.php?post_type=give_forms' !== $menu_item[2]) {
233 233
 				continue;
234 234
 			}
235 235
 
236
-			$menu[ $index ][0] = sprintf(
237
-				__( 'Donations %s', 'give' ),
236
+			$menu[$index][0] = sprintf(
237
+				__('Donations %s', 'give'),
238 238
 				sprintf(
239 239
 					'<span class="update-plugins count-%1$d"><span class="plugin-count">%1$d</span></span>',
240 240
 					$this->get_update_count()
@@ -259,15 +259,15 @@  discard block
 block discarded – undo
259 259
 		// Bailout.
260 260
 		if ( ! $this->get_update_count()) {
261 261
 			// Show complete update message if still on update setting page.
262
-			if ( isset($_GET['page']) && 'give-updates' === $_GET['page'] ) {
262
+			if (isset($_GET['page']) && 'give-updates' === $_GET['page']) {
263 263
 				// Upgrades
264 264
 				add_submenu_page(
265 265
 					'edit.php?post_type=give_forms',
266
-					esc_html__( 'Give Updates Complete', 'give' ),
267
-					__( 'Updates', 'give' ),
266
+					esc_html__('Give Updates Complete', 'give'),
267
+					__('Updates', 'give'),
268 268
 					'manage_give_settings',
269 269
 					'give-updates',
270
-					array( $this, 'render_complete_page' )
270
+					array($this, 'render_complete_page')
271 271
 				);
272 272
 			}
273 273
 
@@ -277,15 +277,15 @@  discard block
 block discarded – undo
277 277
 		// Upgrades
278 278
 		add_submenu_page(
279 279
 			'edit.php?post_type=give_forms',
280
-			esc_html__( 'Give Updates', 'give' ),
280
+			esc_html__('Give Updates', 'give'),
281 281
 			sprintf(
282 282
 				'%1$s <span class="update-plugins count-%2$d"><span class="plugin-count">%2$d</span></span>',
283
-				__( 'Updates', 'give' ),
283
+				__('Updates', 'give'),
284 284
 				$this->get_update_count()
285 285
 			),
286 286
 			'manage_give_settings',
287 287
 			'give-updates',
288
-			array( $this, 'render_page' )
288
+			array($this, 'render_page')
289 289
 		);
290 290
 	}
291 291
 
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 	 * @return int
298 298
 	 */
299 299
 	public function get_db_update_count() {
300
-		return count( $this->get_updates( 'database', 'new' ) );
300
+		return count($this->get_updates('database', 'new'));
301 301
 	}
302 302
 
303 303
 	/**
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 	 * @access public
308 308
 	 */
309 309
 	public function render_complete_page() {
310
-		include_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/views/upgrades-complete.php';
310
+		include_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/views/upgrades-complete.php';
311 311
 	}
312 312
 
313 313
 	/**
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
 	 * @access public
318 318
 	 */
319 319
 	public function render_page() {
320
-		include_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/views/upgrades.php';
320
+		include_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/views/upgrades.php';
321 321
 	}
322 322
 
323 323
 	/**
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 	 * @return int
329 329
 	 */
330 330
 	public function get_plugin_update_count() {
331
-		return count( $this->get_updates( 'plugin' ) );
331
+		return count($this->get_updates('plugin'));
332 332
 	}
333 333
 
334 334
 	/**
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
 		$db_update_count     = $this->get_db_update_count();
344 344
 		$plugin_update_count = $this->get_plugin_update_count();
345 345
 
346
-		return ( $db_update_count + $plugin_update_count );
346
+		return ($db_update_count + $plugin_update_count);
347 347
 	}
348 348
 
349 349
 
@@ -354,12 +354,12 @@  discard block
 block discarded – undo
354 354
 	 * @access public
355 355
 	 */
356 356
 	public function __flush_resume_updates() {
357
-		delete_option( 'give_doing_upgrade' );
358
-		update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
357
+		delete_option('give_doing_upgrade');
358
+		update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
359 359
 
360 360
 		// Reset counter.
361 361
 		$this->step = $this->percentage = 0;
362
-		++ $this->update;
362
+		++$this->update;
363 363
 	}
364 364
 
365 365
 	/**
@@ -370,30 +370,30 @@  discard block
 block discarded – undo
370 370
 	 */
371 371
 	public function __give_ajax_updates() {
372 372
 		// Check permission.
373
-		if ( ! current_user_can( 'manage_give_settings' ) ) {
373
+		if ( ! current_user_can('manage_give_settings')) {
374 374
 			$this->send_ajax_response(
375 375
 				array(
376
-					'message' => esc_html__( 'You do not have permission to do Give upgrades.', 'give' ),
376
+					'message' => esc_html__('You do not have permission to do Give upgrades.', 'give'),
377 377
 				),
378 378
 				'error'
379 379
 			);
380 380
 		}
381 381
 
382 382
 		// Update timeout error.
383
-		ignore_user_abort( true );
384
-		if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
385
-			@set_time_limit( 0 );
383
+		ignore_user_abort(true);
384
+		if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
385
+			@set_time_limit(0);
386 386
 		}
387 387
 
388 388
 		// Set params.
389
-		$this->step   = absint( $_POST['step'] );
390
-		$this->update = absint( $_POST['update'] );
389
+		$this->step   = absint($_POST['step']);
390
+		$this->update = absint($_POST['update']);
391 391
 
392 392
 		// Bailout: step and update must be positive and greater then zero.
393
-		if ( ! $this->step ) {
393
+		if ( ! $this->step) {
394 394
 			$this->send_ajax_response(
395 395
 				array(
396
-					'message'    => __( 'Please reload this page  and try again', 'give' ),
396
+					'message'    => __('Please reload this page  and try again', 'give'),
397 397
 					'heading'    => '',
398 398
 					'percentage' => 0,
399 399
 				),
@@ -402,14 +402,14 @@  discard block
 block discarded – undo
402 402
 		}
403 403
 
404 404
 		// Get updates.
405
-		$updates = $this->get_updates( 'database', 'new' );
405
+		$updates = $this->get_updates('database', 'new');
406 406
 
407 407
 		// Bailout if we do not have nay updates.
408
-		if ( empty( $updates ) ) {
408
+		if (empty($updates)) {
409 409
 			$this->send_ajax_response(
410 410
 				array(
411
-					'message'    => __( 'The database is already up to date.', 'give' ),
412
-					'heading'    => __( 'Updates Completed.', 'give' ),
411
+					'message'    => __('The database is already up to date.', 'give'),
412
+					'heading'    => __('Updates Completed.', 'give'),
413 413
 					'percentage' => 0,
414 414
 				),
415 415
 				'success'
@@ -417,26 +417,26 @@  discard block
 block discarded – undo
417 417
 		}
418 418
 
419 419
 		// Process update.
420
-		foreach ( $updates as $index => $update ) {
420
+		foreach ($updates as $index => $update) {
421 421
 			// Check if update depend upon any other update.
422
-			if ( ! empty( $update['depend'] ) && ! give_has_upgrade_completed( $update['depend'] ) ) {
422
+			if ( ! empty($update['depend']) && ! give_has_upgrade_completed($update['depend'])) {
423 423
 				continue;
424 424
 			}
425 425
 
426 426
 			// Run update.
427
-			if ( is_array( $update['callback'] ) ) {
427
+			if (is_array($update['callback'])) {
428 428
 				$update['callback'][0]->$update['callback'][1]();
429 429
 			} else {
430 430
 				$update['callback']();
431 431
 			}
432 432
 
433 433
 			// Check if current update completed or not.
434
-			if ( give_has_upgrade_completed( $update['id'] ) ) {
435
-				if ( 1 === count( $updates ) ) {
434
+			if (give_has_upgrade_completed($update['id'])) {
435
+				if (1 === count($updates)) {
436 436
 					$this->send_ajax_response(
437 437
 						array(
438
-							'message'    => __( 'Database updated successfully.', 'give' ),
439
-							'heading'    => __( 'Updates Completed.', 'give' ),
438
+							'message'    => __('Database updated successfully.', 'give'),
439
+							'heading'    => __('Updates Completed.', 'give'),
440 440
 							'percentage' => 0,
441 441
 						),
442 442
 						'success'
@@ -446,16 +446,16 @@  discard block
 block discarded – undo
446 446
 
447 447
 			$doing_upgrade_args = array(
448 448
 				'update_info' => $update,
449
-				'step'        => ++ $this->step,
449
+				'step'        => ++$this->step,
450 450
 				'update'      => $this->update,
451
-				'heading'     => sprintf( 'Update %s of {update_count}', $this->update ),
451
+				'heading'     => sprintf('Update %s of {update_count}', $this->update),
452 452
 				'percentage'  => $this->percentage,
453 453
 			);
454 454
 
455 455
 			// Cache upgrade.
456
-			update_option( 'give_doing_upgrade', $doing_upgrade_args );
456
+			update_option('give_doing_upgrade', $doing_upgrade_args);
457 457
 
458
-			$this->send_ajax_response( $doing_upgrade_args );
458
+			$this->send_ajax_response($doing_upgrade_args);
459 459
 		}// End foreach().
460 460
 	}
461 461
 
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
 	 * @param        $data
469 469
 	 * @param string $type
470 470
 	 */
471
-	public function send_ajax_response( $data, $type = '' ) {
471
+	public function send_ajax_response($data, $type = '') {
472 472
 		$default = array(
473 473
 			'message'    => '',
474 474
 			'heading'    => '',
@@ -478,21 +478,21 @@  discard block
 block discarded – undo
478 478
 		);
479 479
 
480 480
 		// Set data.
481
-		$data = wp_parse_args( $data, $default );
481
+		$data = wp_parse_args($data, $default);
482 482
 
483
-		switch ( $type ) {
483
+		switch ($type) {
484 484
 			case 'success':
485
-				wp_send_json_success( $data );
485
+				wp_send_json_success($data);
486 486
 				break;
487 487
 
488 488
 			case 'error':
489
-				wp_send_json_error( $data );
489
+				wp_send_json_error($data);
490 490
 				break;
491 491
 
492 492
 			default:
493
-				wp_send_json( array(
493
+				wp_send_json(array(
494 494
 					'data' => $data,
495
-				) );
495
+				));
496 496
 				break;
497 497
 		}
498 498
 	}
@@ -509,8 +509,8 @@  discard block
 block discarded – undo
509 509
 	public function resume_updates() {
510 510
 		$status = false;
511 511
 
512
-		if ( $update = get_option( 'give_doing_upgrade' ) ) {
513
-			$status = ! empty( $update['step'] ) ? $update['step'] : $status;
512
+		if ($update = get_option('give_doing_upgrade')) {
513
+			$status = ! empty($update['step']) ? $update['step'] : $status;
514 514
 		}
515 515
 
516 516
 		return $status;
@@ -526,12 +526,12 @@  discard block
 block discarded – undo
526 526
 	 * @param $total
527 527
 	 * @param $current_total
528 528
 	 */
529
-	public function set_percentage( $total, $current_total ) {
529
+	public function set_percentage($total, $current_total) {
530 530
 		// Set percentage.
531
-		$this->percentage = $total ? ( ( $current_total ) / $total ) * 100 : 0;
531
+		$this->percentage = $total ? (($current_total) / $total) * 100 : 0;
532 532
 
533 533
 		// Verify percentage.
534
-		$this->percentage = ( 100 < $this->percentage ) ? 100 : $this->percentage;
534
+		$this->percentage = (100 < $this->percentage) ? 100 : $this->percentage;
535 535
 	}
536 536
 }
537 537
 
Please login to merge, or discard this patch.
includes/admin/welcome.php 1 patch
Spacing   +108 added lines, -108 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if accessed directly.
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
@@ -35,9 +35,9 @@  discard block
 block discarded – undo
35 35
 	 * @since 1.0
36 36
 	 */
37 37
 	public function __construct() {
38
-		add_action( 'admin_menu', array( $this, 'admin_menus' ) );
39
-		add_action( 'admin_head', array( $this, 'admin_head' ) );
40
-		add_action( 'admin_init', array( $this, 'welcome' ) );
38
+		add_action('admin_menu', array($this, 'admin_menus'));
39
+		add_action('admin_head', array($this, 'admin_head'));
40
+		add_action('admin_init', array($this, 'welcome'));
41 41
 	}
42 42
 
43 43
 	/**
@@ -49,45 +49,45 @@  discard block
 block discarded – undo
49 49
 	 * @return void
50 50
 	 */
51 51
 	public function admin_menus() {
52
-		list( $display_version ) = explode( '-', GIVE_VERSION );
52
+		list($display_version) = explode('-', GIVE_VERSION);
53 53
 
54 54
 		// About Page
55 55
 		add_dashboard_page(
56 56
 		/* translators: %s: Give version */
57
-			sprintf( esc_html__( 'Welcome to Give %s', 'give' ), $display_version ),
58
-			esc_html__( 'Welcome to Give', 'give' ),
57
+			sprintf(esc_html__('Welcome to Give %s', 'give'), $display_version),
58
+			esc_html__('Welcome to Give', 'give'),
59 59
 			$this->minimum_capability,
60 60
 			'give-about',
61
-			array( $this, 'about_screen' )
61
+			array($this, 'about_screen')
62 62
 		);
63 63
 
64 64
 		// Changelog Page
65 65
 		add_dashboard_page(
66
-			esc_html__( 'Give Changelog', 'give' ),
67
-			esc_html__( 'Give Changelog', 'give' ),
66
+			esc_html__('Give Changelog', 'give'),
67
+			esc_html__('Give Changelog', 'give'),
68 68
 			$this->minimum_capability,
69 69
 			'give-changelog',
70
-			array( $this, 'changelog_screen' )
70
+			array($this, 'changelog_screen')
71 71
 		);
72 72
 
73 73
 		// Getting Started Page
74 74
 		add_dashboard_page(
75 75
 		/* translators: %s: Give version */
76
-			sprintf( esc_html__( 'Give %s - Getting Started Guide', 'give' ), $display_version ),
77
-			esc_html__( 'Getting started with Give', 'give' ),
76
+			sprintf(esc_html__('Give %s - Getting Started Guide', 'give'), $display_version),
77
+			esc_html__('Getting started with Give', 'give'),
78 78
 			$this->minimum_capability,
79 79
 			'give-getting-started',
80
-			array( $this, 'getting_started_screen' )
80
+			array($this, 'getting_started_screen')
81 81
 		);
82 82
 
83 83
 		// Credits Page
84 84
 		add_dashboard_page(
85 85
 		/* translators: %s: Give version */
86
-			sprintf( esc_html__( 'Give %s - Credits', 'give' ), $display_version ),
87
-			esc_html__( 'The people that build Give', 'give' ),
86
+			sprintf(esc_html__('Give %s - Credits', 'give'), $display_version),
87
+			esc_html__('The people that build Give', 'give'),
88 88
 			$this->minimum_capability,
89 89
 			'give-credits',
90
-			array( $this, 'credits_screen' )
90
+			array($this, 'credits_screen')
91 91
 		);
92 92
 	}
93 93
 
@@ -100,10 +100,10 @@  discard block
 block discarded – undo
100 100
 	 */
101 101
 	public function admin_head() {
102 102
 
103
-		remove_submenu_page( 'index.php', 'give-about' );
104
-		remove_submenu_page( 'index.php', 'give-changelog' );
105
-		remove_submenu_page( 'index.php', 'give-getting-started' );
106
-		remove_submenu_page( 'index.php', 'give-credits' );
103
+		remove_submenu_page('index.php', 'give-about');
104
+		remove_submenu_page('index.php', 'give-changelog');
105
+		remove_submenu_page('index.php', 'give-getting-started');
106
+		remove_submenu_page('index.php', 'give-credits');
107 107
 
108 108
 	}
109 109
 
@@ -115,24 +115,24 @@  discard block
 block discarded – undo
115 115
 	 * @return void
116 116
 	 */
117 117
 	public function tabs() {
118
-		$selected = isset( $_GET['page'] ) ? $_GET['page'] : 'give-about';
118
+		$selected = isset($_GET['page']) ? $_GET['page'] : 'give-about';
119 119
 		?>
120 120
         <h2 class="nav-tab-wrapper">
121 121
             <a class="nav-tab <?php echo $selected == 'give-about' ? 'nav-tab-active' : ''; ?>"
122
-               href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-about' ), 'index.php' ) ) ); ?>">
123
-				<?php esc_html_e( 'About Give', 'give' ); ?>
122
+               href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-about'), 'index.php'))); ?>">
123
+				<?php esc_html_e('About Give', 'give'); ?>
124 124
             </a>
125 125
             <a class="nav-tab <?php echo $selected == 'give-getting-started' ? 'nav-tab-active' : ''; ?>"
126
-               href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-getting-started' ), 'index.php' ) ) ); ?>">
127
-				<?php esc_html_e( 'Getting Started', 'give' ); ?>
126
+               href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-getting-started'), 'index.php'))); ?>">
127
+				<?php esc_html_e('Getting Started', 'give'); ?>
128 128
             </a>
129 129
             <a class="nav-tab <?php echo $selected == 'give-credits' ? 'nav-tab-active' : ''; ?>"
130
-               href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-credits' ), 'index.php' ) ) ); ?>">
131
-				<?php esc_html_e( 'Credits', 'give' ); ?>
130
+               href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-credits'), 'index.php'))); ?>">
131
+				<?php esc_html_e('Credits', 'give'); ?>
132 132
             </a>
133 133
             <a class="nav-tab <?php echo $selected == 'give-add-ons' ? 'nav-tab-active' : ''; ?>"
134
-               href="<?php echo esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-addons' ) ); ?>">
135
-				<?php esc_html_e( 'Add-ons', 'give' ); ?>
134
+               href="<?php echo esc_url(admin_url('edit.php?post_type=give_forms&page=give-addons')); ?>">
135
+				<?php esc_html_e('Add-ons', 'give'); ?>
136 136
             </a>
137 137
         </h2>
138 138
 		<?php
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	 * @return void
147 147
 	 */
148 148
 	public function about_screen() {
149
-		list( $display_version ) = explode( '-', GIVE_VERSION );
149
+		list($display_version) = explode('-', GIVE_VERSION);
150 150
 		?>
151 151
         <div class="wrap about-wrap">
152 152
 
@@ -155,8 +155,8 @@  discard block
 block discarded – undo
155 155
             <p class="about-text"><?php
156 156
 				printf(
157 157
 				/* translators: %s: https://givewp.com/documenation/ */
158
-					__( 'Thank you for activating or updating to the latest version of Give! If you\'re a first time user, welcome! You\'re well on your way to empowering your cause. We encourage you to check out the <a href="%s" target="_blank">plugin documentation</a> and getting started guide below.', 'give' ),
159
-					esc_url( 'https://givewp.com/documenation/' )
158
+					__('Thank you for activating or updating to the latest version of Give! If you\'re a first time user, welcome! You\'re well on your way to empowering your cause. We encourage you to check out the <a href="%s" target="_blank">plugin documentation</a> and getting started guide below.', 'give'),
159
+					esc_url('https://givewp.com/documenation/')
160 160
 				);
161 161
 				?></p>
162 162
 
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
             <div class="give-badge"><?php
166 166
 				printf(
167 167
 				/* translators: %s: Give version */
168
-					esc_html__( 'Version %s', 'give' ),
168
+					esc_html__('Version %s', 'give'),
169 169
 					$display_version
170 170
 				);
171 171
 				?></div>
@@ -175,17 +175,17 @@  discard block
 block discarded – undo
175 175
             <div class="feature-section clearfix introduction">
176 176
 
177 177
                 <div class="video feature-section-item">
178
-                    <img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/give-logo-photo-mashup.png' ?>"
179
-                         alt="<?php esc_attr_e( 'Give', 'give' ); ?>">
178
+                    <img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/give-logo-photo-mashup.png' ?>"
179
+                         alt="<?php esc_attr_e('Give', 'give'); ?>">
180 180
                 </div>
181 181
 
182 182
                 <div class="content feature-section-item last-feature">
183 183
 
184
-                    <h3><?php esc_html_e( 'Give - Democratizing Generosity', 'give' ); ?></h3>
184
+                    <h3><?php esc_html_e('Give - Democratizing Generosity', 'give'); ?></h3>
185 185
 
186
-                    <p><?php esc_html_e( 'Give empowers you to easily accept donations and setup fundraising campaigns, directly within WordPress. We created Give to provide a better donation experience for you and your users. Robust, flexible, and intuitive, the plugin is built from the ground up to be the goto donation solution for WordPress. Create powerful donation forms, embed them throughout your website, start a campaign, and exceed your fundraising goals with Give. This plugin is actively developed and proudly supported by folks who are dedicated to helping you and your cause.', 'give' ); ?></p>
186
+                    <p><?php esc_html_e('Give empowers you to easily accept donations and setup fundraising campaigns, directly within WordPress. We created Give to provide a better donation experience for you and your users. Robust, flexible, and intuitive, the plugin is built from the ground up to be the goto donation solution for WordPress. Create powerful donation forms, embed them throughout your website, start a campaign, and exceed your fundraising goals with Give. This plugin is actively developed and proudly supported by folks who are dedicated to helping you and your cause.', 'give'); ?></p>
187 187
                     <a href="https://givewp.com" target="_blank" class="button-secondary">
188
-						<?php esc_html_e( 'Learn More', 'give' ); ?>
188
+						<?php esc_html_e('Learn More', 'give'); ?>
189 189
                         <span class="dashicons dashicons-external"></span>
190 190
                     </a>
191 191
 
@@ -198,22 +198,22 @@  discard block
 block discarded – undo
198 198
 
199 199
                 <div class="content feature-section-item">
200 200
 
201
-                    <h3><?php esc_html_e( 'Getting to Know Give', 'give' ); ?></h3>
201
+                    <h3><?php esc_html_e('Getting to Know Give', 'give'); ?></h3>
202 202
 
203
-                    <p><?php esc_html_e( 'Before you get started with Give we suggest you take a look at the online documentation. There you will find the getting started guide which will help you get up and running quickly. If you have a question, issue or bug with the Core plugin please submit an issue on the Give website. We also welcome your feedback and feature requests. Welcome to Give. We hope you much success with your cause.', 'give' ); ?></p>
203
+                    <p><?php esc_html_e('Before you get started with Give we suggest you take a look at the online documentation. There you will find the getting started guide which will help you get up and running quickly. If you have a question, issue or bug with the Core plugin please submit an issue on the Give website. We also welcome your feedback and feature requests. Welcome to Give. We hope you much success with your cause.', 'give'); ?></p>
204 204
 
205 205
                     <h4>Find Out More:</h4>
206 206
                     <ul class="ul-disc">
207
-                        <li><a href="https://givewp.com/" target="_blank"><?php esc_html_e( 'Visit the Give Website', 'give' ); ?></a></li>
208
-                        <li><a href="https://givewp.com/features/" target="_blank"><?php esc_html_e( 'View the Give Features', 'give' ); ?></a></li>
209
-                        <li><a href="https://givewp.com/documentation/" target="_blank"><?php esc_html_e( 'Read the Documentation', 'give' ); ?></a></li>
207
+                        <li><a href="https://givewp.com/" target="_blank"><?php esc_html_e('Visit the Give Website', 'give'); ?></a></li>
208
+                        <li><a href="https://givewp.com/features/" target="_blank"><?php esc_html_e('View the Give Features', 'give'); ?></a></li>
209
+                        <li><a href="https://givewp.com/documentation/" target="_blank"><?php esc_html_e('Read the Documentation', 'give'); ?></a></li>
210 210
                     </ul>
211 211
 
212 212
                 </div>
213 213
 
214 214
                 <div class="content  feature-section-item last-feature">
215
-                    <img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/admin/give-form-mockup.png' ?>"
216
-                         alt="<?php esc_attr_e( 'A Give donation form', 'give' ); ?>">
215
+                    <img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/admin/give-form-mockup.png' ?>"
216
+                         alt="<?php esc_attr_e('A Give donation form', 'give'); ?>">
217 217
                 </div>
218 218
 
219 219
             </div>
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 	 * @return void
233 233
 	 */
234 234
 	public function changelog_screen() {
235
-		list( $display_version ) = explode( '-', GIVE_VERSION );
235
+		list($display_version) = explode('-', GIVE_VERSION);
236 236
 		?>
237 237
         <div class="wrap about-wrap">
238 238
             <h1><?php echo get_admin_page_title(); ?></h1>
@@ -240,14 +240,14 @@  discard block
 block discarded – undo
240 240
             <p class="about-text"><?php
241 241
 				printf(
242 242
 				/* translators: %s: Give version */
243
-					esc_html__( 'Thank you for updating to the latest version! Give %s is ready to make your online store faster, safer, and better!', 'give' ),
243
+					esc_html__('Thank you for updating to the latest version! Give %s is ready to make your online store faster, safer, and better!', 'give'),
244 244
 					$display_version
245 245
 				);
246 246
 				?></p>
247 247
             <div class="give-badge"><?php
248 248
 				printf(
249 249
 				/* translators: %s: Give version */
250
-					esc_html__( 'Version %s', 'give' ),
250
+					esc_html__('Version %s', 'give'),
251 251
 					$display_version
252 252
 				);
253 253
 				?></div>
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 			<?php $this->tabs(); ?>
256 256
 
257 257
             <div class="changelog">
258
-                <h3><?php esc_html_e( 'Full Changelog', 'give' ); ?></h3>
258
+                <h3><?php esc_html_e('Full Changelog', 'give'); ?></h3>
259 259
 
260 260
                 <div class="feature-section">
261 261
 					<?php echo $this->parse_readme(); ?>
@@ -263,10 +263,10 @@  discard block
 block discarded – undo
263 263
             </div>
264 264
 
265 265
             <div class="return-to-dashboard">
266
-                <a href="<?php echo esc_url( admin_url( add_query_arg( array(
266
+                <a href="<?php echo esc_url(admin_url(add_query_arg(array(
267 267
 					'post_type' => 'give_forms',
268 268
 					'page'      => 'give-settings'
269
-				), 'edit.php' ) ) ); ?>"><?php esc_html_e( 'Give Settings', 'give' ); ?></a>
269
+				), 'edit.php'))); ?>"><?php esc_html_e('Give Settings', 'give'); ?></a>
270 270
             </div>
271 271
         </div>
272 272
 		<?php
@@ -280,36 +280,36 @@  discard block
 block discarded – undo
280 280
 	 * @return void
281 281
 	 */
282 282
 	public function getting_started_screen() {
283
-		list( $display_version ) = explode( '-', GIVE_VERSION );
283
+		list($display_version) = explode('-', GIVE_VERSION);
284 284
 		?>
285 285
         <div class="wrap about-wrap get-started">
286 286
 
287 287
 			<?php $this->get_welcome_header() ?>
288 288
 
289
-            <p class="about-text"><?php esc_html_e( 'Welcome to the getting started guide.', 'give' ); ?></p>
289
+            <p class="about-text"><?php esc_html_e('Welcome to the getting started guide.', 'give'); ?></p>
290 290
 
291 291
 			<?php give_get_newsletter(); ?>
292 292
 
293 293
             <div class="give-badge"><?php
294 294
 				printf(
295 295
 				/* translators: %s: Give version */
296
-					esc_html__( 'Version %s', 'give' ),
296
+					esc_html__('Version %s', 'give'),
297 297
 					$display_version
298 298
 				);
299 299
 				?></div>
300 300
 
301 301
 			<?php $this->tabs(); ?>
302 302
 
303
-            <p class="about-text"><?php printf( esc_html__( 'Getting started with Give is easy! We put together this quick start guide to help first time users of the plugin. Our goal is to get you up and running in no time. Let\'s begin!', 'give' ), $display_version ); ?></p>
303
+            <p class="about-text"><?php printf(esc_html__('Getting started with Give is easy! We put together this quick start guide to help first time users of the plugin. Our goal is to get you up and running in no time. Let\'s begin!', 'give'), $display_version); ?></p>
304 304
 
305 305
             <div class="feature-section clearfix">
306 306
 
307 307
                 <div class="content feature-section-item">
308
-                    <h3><?php esc_html_e( 'STEP 1: Create a New Form', 'give' ); ?></h3>
308
+                    <h3><?php esc_html_e('STEP 1: Create a New Form', 'give'); ?></h3>
309 309
 
310
-                    <p><?php esc_html_e( 'Give is driven by it\'s powerful donation form building features. However, it is much more than just a "donation form". From the "Add Form" page you\'ll be able to choose how and where you want to receive your donations. You will also be able to set the preferred donation amounts.', 'give' ); ?></p>
310
+                    <p><?php esc_html_e('Give is driven by it\'s powerful donation form building features. However, it is much more than just a "donation form". From the "Add Form" page you\'ll be able to choose how and where you want to receive your donations. You will also be able to set the preferred donation amounts.', 'give'); ?></p>
311 311
 
312
-                    <p><?php esc_html_e( 'All of these features begin by simply going to the menu and choosing "Donations > Add Form".', 'give' ); ?></p>
312
+                    <p><?php esc_html_e('All of these features begin by simply going to the menu and choosing "Donations > Add Form".', 'give'); ?></p>
313 313
                 </div>
314 314
 
315 315
                 <div class="content feature-section-item last-feature">
@@ -326,9 +326,9 @@  discard block
 block discarded – undo
326 326
                 </div>
327 327
 
328 328
                 <div class="content feature-section-item last-feature">
329
-                    <h3><?php esc_html_e( 'STEP 2: Customize Your Donation Forms', 'give' ); ?></h3>
329
+                    <h3><?php esc_html_e('STEP 2: Customize Your Donation Forms', 'give'); ?></h3>
330 330
 
331
-                    <p><?php esc_html_e( 'Each donation form you create can be customized to receive either a pre-determined set donation amount or have multiple suggested levels of giving. Choosing "Multi-level Donation" opens up the donation levels view where you can add as many levels as you\'d like with your own custom names and suggested amounts. As well, you can allow donors to give a custom amount and even set up donation goals.', 'give' ); ?></p>
331
+                    <p><?php esc_html_e('Each donation form you create can be customized to receive either a pre-determined set donation amount or have multiple suggested levels of giving. Choosing "Multi-level Donation" opens up the donation levels view where you can add as many levels as you\'d like with your own custom names and suggested amounts. As well, you can allow donors to give a custom amount and even set up donation goals.', 'give'); ?></p>
332 332
                 </div>
333 333
 
334 334
             </div>
@@ -337,11 +337,11 @@  discard block
 block discarded – undo
337 337
             <div class="feature-section clearfix">
338 338
 
339 339
                 <div class="content feature-section-item add-content">
340
-                    <h3><?php esc_html_e( 'STEP 3: Add Additional Content', 'give' ); ?></h3>
340
+                    <h3><?php esc_html_e('STEP 3: Add Additional Content', 'give'); ?></h3>
341 341
 
342
-                    <p><?php esc_html_e( 'Every donation form you create with Give can be used on its own stand-alone page, or it can be inserted into any other page or post throughout your site via a shortcode or widget.', 'give' ); ?></p>
342
+                    <p><?php esc_html_e('Every donation form you create with Give can be used on its own stand-alone page, or it can be inserted into any other page or post throughout your site via a shortcode or widget.', 'give'); ?></p>
343 343
 
344
-                    <p><?php esc_html_e( 'You can choose these different modes by going to the "Form Content" section. From there, you can choose to add content before or after the donation form on a page, or if you choose "None" perhaps you want to instead use the shortcode. You can find the shortcode in the top right column directly under the Publish/Save button. This feature gives you the most amount of flexibility with controlling your content on your website all within the same page.', 'give' ); ?></p>
344
+                    <p><?php esc_html_e('You can choose these different modes by going to the "Form Content" section. From there, you can choose to add content before or after the donation form on a page, or if you choose "None" perhaps you want to instead use the shortcode. You can find the shortcode in the top right column directly under the Publish/Save button. This feature gives you the most amount of flexibility with controlling your content on your website all within the same page.', 'give'); ?></p>
345 345
                 </div>
346 346
 
347 347
                 <div class="content feature-section-item last-feature">
@@ -358,9 +358,9 @@  discard block
 block discarded – undo
358 358
                 </div>
359 359
 
360 360
                 <div class="content feature-section-item last-feature">
361
-                    <h3><?php esc_html_e( 'STEP 4: Configure Your Display Options', 'give' ); ?></h3>
361
+                    <h3><?php esc_html_e('STEP 4: Configure Your Display Options', 'give'); ?></h3>
362 362
 
363
-                    <p><?php esc_html_e( 'Lastly, you can present the form in a number of different ways that each create their own unique donor experience. The "Modal" display mode opens the credit card fieldset within a popup window. The "Reveal" mode will slide into place the additional fields. If you\'re looking for a simple button, then "Button" more is the way to go. This allows you to create a customizable "Donate Now" button which will open the donation form upon clicking. There\'s tons of possibilities here, give it a try!', 'give' ); ?></p>
363
+                    <p><?php esc_html_e('Lastly, you can present the form in a number of different ways that each create their own unique donor experience. The "Modal" display mode opens the credit card fieldset within a popup window. The "Reveal" mode will slide into place the additional fields. If you\'re looking for a simple button, then "Button" more is the way to go. This allows you to create a customizable "Donate Now" button which will open the donation form upon clicking. There\'s tons of possibilities here, give it a try!', 'give'); ?></p>
364 364
                 </div>
365 365
 
366 366
 
@@ -380,20 +380,20 @@  discard block
 block discarded – undo
380 380
 	 * @return void
381 381
 	 */
382 382
 	public function credits_screen() {
383
-		list( $display_version ) = explode( '-', GIVE_VERSION );
383
+		list($display_version) = explode('-', GIVE_VERSION);
384 384
 		?>
385 385
         <div class="wrap about-wrap">
386 386
 
387 387
 			<?php $this->get_welcome_header() ?>
388 388
 
389
-            <p class="about-text"><?php esc_html_e( 'Thanks to all those who have contributed code directly or indirectly.', 'give' ); ?></p>
389
+            <p class="about-text"><?php esc_html_e('Thanks to all those who have contributed code directly or indirectly.', 'give'); ?></p>
390 390
 
391 391
 			<?php give_get_newsletter(); ?>
392 392
 
393 393
             <div class="give-badge"><?php
394 394
 				printf(
395 395
 				/* translators: %s: Give version */
396
-					esc_html__( 'Version %s', 'give' ),
396
+					esc_html__('Version %s', 'give'),
397 397
 					$display_version
398 398
 				);
399 399
 				?></div>
@@ -403,8 +403,8 @@  discard block
 block discarded – undo
403 403
             <p class="about-description"><?php
404 404
 				printf(
405 405
 				/* translators: %s: https://github.com/WordImpress/give */
406
-					__( 'Give is created by a dedicated team of developers. If you are interested in contributing please visit the <a href="%s" target="_blank">GitHub Repo</a>.', 'give' ),
407
-					esc_url( 'https://github.com/WordImpress/give' )
406
+					__('Give is created by a dedicated team of developers. If you are interested in contributing please visit the <a href="%s" target="_blank">GitHub Repo</a>.', 'give'),
407
+					esc_url('https://github.com/WordImpress/give')
408 408
 				);
409 409
 				?></p>
410 410
 
@@ -421,21 +421,21 @@  discard block
 block discarded – undo
421 421
 	 * @return string $readme HTML formatted readme file
422 422
 	 */
423 423
 	public function parse_readme() {
424
-		$file = file_exists( GIVE_PLUGIN_DIR . 'readme.txt' ) ? GIVE_PLUGIN_DIR . 'readme.txt' : null;
424
+		$file = file_exists(GIVE_PLUGIN_DIR.'readme.txt') ? GIVE_PLUGIN_DIR . 'readme.txt' : null;
425 425
 
426
-		if ( ! $file ) {
427
-			$readme = '<p>' . esc_html__( 'No valid changlog was found.', 'give' ) . '</p>';
426
+		if ( ! $file) {
427
+			$readme = '<p>'.esc_html__('No valid changlog was found.', 'give').'</p>';
428 428
 		} else {
429
-			$readme = file_get_contents( $file );
430
-			$readme = nl2br( esc_html( $readme ) );
431
-			$readme = explode( '== Changelog ==', $readme );
432
-			$readme = end( $readme );
433
-
434
-			$readme = preg_replace( '/`(.*?)`/', '<code>\\1</code>', $readme );
435
-			$readme = preg_replace( '/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme );
436
-			$readme = preg_replace( '/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme );
437
-			$readme = preg_replace( '/= (.*?) =/', '<h4>\\1</h4>', $readme );
438
-			$readme = preg_replace( '/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme );
429
+			$readme = file_get_contents($file);
430
+			$readme = nl2br(esc_html($readme));
431
+			$readme = explode('== Changelog ==', $readme);
432
+			$readme = end($readme);
433
+
434
+			$readme = preg_replace('/`(.*?)`/', '<code>\\1</code>', $readme);
435
+			$readme = preg_replace('/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme);
436
+			$readme = preg_replace('/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme);
437
+			$readme = preg_replace('/= (.*?) =/', '<h4>\\1</h4>', $readme);
438
+			$readme = preg_replace('/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme);
439 439
 		}
440 440
 
441 441
 		return $readme;
@@ -452,24 +452,24 @@  discard block
 block discarded – undo
452 452
 	public function contributors() {
453 453
 		$contributors = $this->get_contributors();
454 454
 
455
-		if ( empty( $contributors ) ) {
455
+		if (empty($contributors)) {
456 456
 			return '';
457 457
 		}
458 458
 
459 459
 		$contributor_list = '<ul class="wp-people-group">';
460 460
 
461
-		foreach ( $contributors as $contributor ) {
461
+		foreach ($contributors as $contributor) {
462 462
 			$contributor_list .= '<li class="wp-person">';
463 463
 			$contributor_list .= sprintf(
464 464
 				'<a href="%1$s" target="_blank"><img src="%2$s" width="64" height="64" class="gravatar" alt="%3$s" /></a>',
465
-				esc_url( 'https://github.com/' . $contributor->login ),
466
-				esc_url( $contributor->avatar_url ),
467
-				esc_attr( $contributor->login )
465
+				esc_url('https://github.com/'.$contributor->login),
466
+				esc_url($contributor->avatar_url),
467
+				esc_attr($contributor->login)
468 468
 			);
469 469
 			$contributor_list .= sprintf(
470 470
 				'<a class="web" target="_blank" href="%1$s">%2$s</a>',
471
-				esc_url( 'https://github.com/' . $contributor->login ),
472
-				esc_html( $contributor->login )
471
+				esc_url('https://github.com/'.$contributor->login),
472
+				esc_html($contributor->login)
473 473
 			);
474 474
 			$contributor_list .= '</li>';
475 475
 		}
@@ -487,25 +487,25 @@  discard block
 block discarded – undo
487 487
 	 * @return array $contributors List of contributors
488 488
 	 */
489 489
 	public function get_contributors() {
490
-		$contributors = Give_Cache::get( 'give_contributors', true );
490
+		$contributors = Give_Cache::get('give_contributors', true);
491 491
 
492
-		if ( false !== $contributors ) {
492
+		if (false !== $contributors) {
493 493
 			return $contributors;
494 494
 		}
495 495
 
496
-		$response = wp_remote_get( 'https://api.github.com/repos/WordImpress/Give/contributors', array( 'sslverify' => false ) );
496
+		$response = wp_remote_get('https://api.github.com/repos/WordImpress/Give/contributors', array('sslverify' => false));
497 497
 
498
-		if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) {
498
+		if (is_wp_error($response) || 200 != wp_remote_retrieve_response_code($response)) {
499 499
 			return array();
500 500
 		}
501 501
 
502
-		$contributors = json_decode( wp_remote_retrieve_body( $response ) );
502
+		$contributors = json_decode(wp_remote_retrieve_body($response));
503 503
 
504
-		if ( ! is_array( $contributors ) ) {
504
+		if ( ! is_array($contributors)) {
505 505
 			return array();
506 506
 		}
507 507
 
508
-		Give_Cache::set( 'give_contributors', $contributors, HOUR_IN_SECONDS, true );
508
+		Give_Cache::set('give_contributors', $contributors, HOUR_IN_SECONDS, true);
509 509
 
510 510
 		return $contributors;
511 511
 	}
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
 	 */
518 518
 	public function get_welcome_header() {
519 519
 		// Badge for welcome page
520
-		$badge_url = GIVE_PLUGIN_URL . 'assets/images/give-badge.png';
520
+		$badge_url = GIVE_PLUGIN_URL.'assets/images/give-badge.png';
521 521
 		?>
522 522
         <h1 class="welcome-h1"><?php echo get_admin_page_title(); ?></h1>
523 523
 		<?php $this->social_media_elements(); ?>
@@ -610,7 +610,7 @@  discard block
 block discarded – undo
610 610
             <a href="https://twitter.com/givewp" class="twitter-follow-button" data-show-count="false"><?php
611 611
 				printf(
612 612
 				/* translators: %s: Give twitter user @givewp */
613
-					esc_html_e( 'Follow %s', 'give' ),
613
+					esc_html_e('Follow %s', 'give'),
614 614
 					'@givewp'
615 615
 				);
616 616
 				?></a>
@@ -644,27 +644,27 @@  discard block
 block discarded – undo
644 644
 	public function welcome() {
645 645
 
646 646
 		// Bail if no activation redirect
647
-		if ( ! Give_Cache::get( '_give_activation_redirect', true ) ) {
647
+		if ( ! Give_Cache::get('_give_activation_redirect', true)) {
648 648
 			return;
649 649
 		}
650 650
 
651 651
 		// Delete the redirect transient
652
-		Give_Cache::delete( Give_Cache::get_key( '_give_activation_redirect' ) );
652
+		Give_Cache::delete(Give_Cache::get_key('_give_activation_redirect'));
653 653
 
654 654
 		// Bail if activating from network, or bulk
655
-		if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
655
+		if (is_network_admin() || isset($_GET['activate-multi'])) {
656 656
 			return;
657 657
 		}
658 658
 
659
-		$upgrade = get_option( 'give_version_upgraded_from' );
659
+		$upgrade = get_option('give_version_upgraded_from');
660 660
 
661
-		if ( ! $upgrade ) { // First time install
662
-			wp_safe_redirect( admin_url( 'index.php?page=give-about' ) );
661
+		if ( ! $upgrade) { // First time install
662
+			wp_safe_redirect(admin_url('index.php?page=give-about'));
663 663
 			exit;
664
-		} elseif ( ! give_is_setting_enabled( give_get_option( 'welcome' ) ) ) { // Welcome is disabled in settings
664
+		} elseif ( ! give_is_setting_enabled(give_get_option('welcome'))) { // Welcome is disabled in settings
665 665
 
666 666
 		} else { // Welcome is NOT disabled in settings
667
-			wp_safe_redirect( admin_url( 'index.php?page=give-about' ) );
667
+			wp_safe_redirect(admin_url('index.php?page=give-about'));
668 668
 			exit;
669 669
 		}
670 670
 	}
Please login to merge, or discard this patch.