Completed
Push — master ( fd4092...0d56d4 )
by Devin
20:39
created
includes/emails/class-give-email-tags.php 3 patches
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -1,26 +1,26 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Give API for creating Email template tags
4
- *
5
- * Email tags are wrapped in { }
6
- *
7
- * A few examples:
8
- *
9
- * {name}
10
- * {sitename}
11
- *
12
- *
13
- * To replace tags in content, use: give_do_email_tags( $content, payment_id );
14
- *
15
- * To add tags, use: give_add_email_tag( $tag, $description, $func ). Be sure to wrap give_add_email_tag()
16
- * in a function hooked to the 'give_email_tags' action
17
- *
18
- * @package     Give
19
- * @subpackage  Emails
20
- * @copyright   Copyright (c) 2015, WordImpress
21
- * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
22
- * @since       1.0
23
- */
3
+	 * Give API for creating Email template tags
4
+	 *
5
+	 * Email tags are wrapped in { }
6
+	 *
7
+	 * A few examples:
8
+	 *
9
+	 * {name}
10
+	 * {sitename}
11
+	 *
12
+	 *
13
+	 * To replace tags in content, use: give_do_email_tags( $content, payment_id );
14
+	 *
15
+	 * To add tags, use: give_add_email_tag( $tag, $description, $func ). Be sure to wrap give_add_email_tag()
16
+	 * in a function hooked to the 'give_email_tags' action
17
+	 *
18
+	 * @package     Give
19
+	 * @subpackage  Emails
20
+	 * @copyright   Copyright (c) 2015, WordImpress
21
+	 * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
22
+	 * @since       1.0
23
+	 */
24 24
 
25 25
 // Exit if accessed directly
26 26
 if ( ! defined( 'ABSPATH' ) ) {
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,6 +50,7 @@  discard block
 block discarded – undo
50 50
 	 *
51 51
 	 * @param string   $tag  Email tag to be replace in email
52 52
 	 * @param callable $func Hook to run when email tag is found
53
+	 * @param string $description
53 54
 	 */
54 55
 	public function add( $tag, $description, $func ) {
55 56
 		if ( is_callable( $func ) ) {
@@ -477,7 +478,7 @@  discard block
 block discarded – undo
477 478
  *
478 479
  * @param int $payment_id
479 480
  *
480
- * @return int payment_id
481
+ * @return string payment_id
481 482
  */
482 483
 function give_email_tag_payment_id( $payment_id ) {
483 484
 	return give_get_payment_number( $payment_id );
Please login to merge, or discard this patch.
Spacing   +89 added lines, -89 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  */
24 24
 
25 25
 // Exit if accessed directly
26
-if ( ! defined( 'ABSPATH' ) ) {
26
+if ( ! defined('ABSPATH')) {
27 27
 	exit;
28 28
 }
29 29
 
@@ -51,9 +51,9 @@  discard block
 block discarded – undo
51 51
 	 * @param string   $tag  Email tag to be replace in email
52 52
 	 * @param callable $func Hook to run when email tag is found
53 53
 	 */
54
-	public function add( $tag, $description, $func ) {
55
-		if ( is_callable( $func ) ) {
56
-			$this->tags[ $tag ] = array(
54
+	public function add($tag, $description, $func) {
55
+		if (is_callable($func)) {
56
+			$this->tags[$tag] = array(
57 57
 				'tag'         => $tag,
58 58
 				'description' => $description,
59 59
 				'func'        => $func
@@ -68,8 +68,8 @@  discard block
 block discarded – undo
68 68
 	 *
69 69
 	 * @param string $tag Email tag to remove hook from
70 70
 	 */
71
-	public function remove( $tag ) {
72
-		unset( $this->tags[ $tag ] );
71
+	public function remove($tag) {
72
+		unset($this->tags[$tag]);
73 73
 	}
74 74
 
75 75
 	/**
@@ -81,8 +81,8 @@  discard block
 block discarded – undo
81 81
 	 *
82 82
 	 * @return bool
83 83
 	 */
84
-	public function email_tag_exists( $tag ) {
85
-		return array_key_exists( $tag, $this->tags );
84
+	public function email_tag_exists($tag) {
85
+		return array_key_exists($tag, $this->tags);
86 86
 	}
87 87
 
88 88
 	/**
@@ -106,16 +106,16 @@  discard block
 block discarded – undo
106 106
 	 *
107 107
 	 * @return string Content with email tags filtered out.
108 108
 	 */
109
-	public function do_tags( $content, $payment_id ) {
109
+	public function do_tags($content, $payment_id) {
110 110
 
111 111
 		// Check if there is atleast one tag added
112
-		if ( empty( $this->tags ) || ! is_array( $this->tags ) ) {
112
+		if (empty($this->tags) || ! is_array($this->tags)) {
113 113
 			return $content;
114 114
 		}
115 115
 
116 116
 		$this->payment_id = $payment_id;
117 117
 
118
-		$new_content = preg_replace_callback( "/{([A-z0-9\-\_]+)}/s", array( $this, 'do_tag' ), $content );
118
+		$new_content = preg_replace_callback("/{([A-z0-9\-\_]+)}/s", array($this, 'do_tag'), $content);
119 119
 
120 120
 		$this->payment_id = null;
121 121
 
@@ -131,17 +131,17 @@  discard block
 block discarded – undo
131 131
 	 *
132 132
 	 * @return mixed
133 133
 	 */
134
-	public function do_tag( $m ) {
134
+	public function do_tag($m) {
135 135
 
136 136
 		// Get tag
137 137
 		$tag = $m[1];
138 138
 
139 139
 		// Return tag if tag not set
140
-		if ( ! $this->email_tag_exists( $tag ) ) {
140
+		if ( ! $this->email_tag_exists($tag)) {
141 141
 			return $m[0];
142 142
 		}
143 143
 
144
-		return call_user_func( $this->tags[ $tag ]['func'], $this->payment_id, $tag );
144
+		return call_user_func($this->tags[$tag]['func'], $this->payment_id, $tag);
145 145
 	}
146 146
 
147 147
 }
@@ -155,8 +155,8 @@  discard block
 block discarded – undo
155 155
  * @param string   $description Description of the email tag added
156 156
  * @param callable $func        Hook to run when email tag is found
157 157
  */
158
-function give_add_email_tag( $tag, $description, $func ) {
159
-	Give()->email_tags->add( $tag, $description, $func );
158
+function give_add_email_tag($tag, $description, $func) {
159
+	Give()->email_tags->add($tag, $description, $func);
160 160
 }
161 161
 
162 162
 /**
@@ -166,8 +166,8 @@  discard block
 block discarded – undo
166 166
  *
167 167
  * @param string $tag Email tag to remove hook from
168 168
  */
169
-function give_remove_email_tag( $tag ) {
170
-	Give()->email_tags->remove( $tag );
169
+function give_remove_email_tag($tag) {
170
+	Give()->email_tags->remove($tag);
171 171
 }
172 172
 
173 173
 /**
@@ -179,8 +179,8 @@  discard block
 block discarded – undo
179 179
  *
180 180
  * @return bool
181 181
  */
182
-function give_email_tag_exists( $tag ) {
183
-	return Give()->email_tags->email_tag_exists( $tag );
182
+function give_email_tag_exists($tag) {
183
+	return Give()->email_tags->email_tag_exists($tag);
184 184
 }
185 185
 
186 186
 /**
@@ -209,13 +209,13 @@  discard block
 block discarded – undo
209 209
 	$email_tags = give_get_email_tags();
210 210
 
211 211
 	// Check
212
-	if ( count( $email_tags ) > 0 ) {
212
+	if (count($email_tags) > 0) {
213 213
 
214 214
 		// Loop
215
-		foreach ( $email_tags as $email_tag ) {
215
+		foreach ($email_tags as $email_tag) {
216 216
 
217 217
 			// Add email tag to list
218
-			$list .= '<code>{' . $email_tag['tag'] . '}</code> - ' . $email_tag['description'] . '<br/>';
218
+			$list .= '<code>{'.$email_tag['tag'].'}</code> - '.$email_tag['description'].'<br/>';
219 219
 
220 220
 		}
221 221
 
@@ -235,13 +235,13 @@  discard block
 block discarded – undo
235 235
  *
236 236
  * @return string Content with email tags filtered out.
237 237
  */
238
-function give_do_email_tags( $content, $payment_id ) {
238
+function give_do_email_tags($content, $payment_id) {
239 239
 
240 240
 	// Replace all tags
241
-	$content = Give()->email_tags->do_tags( $content, $payment_id );
241
+	$content = Give()->email_tags->do_tags($content, $payment_id);
242 242
 
243 243
 	// Maintaining backwards compatibility
244
-	$content = apply_filters( 'give_email_template_tags', $content, give_get_payment_meta( $payment_id ), $payment_id );
244
+	$content = apply_filters('give_email_template_tags', $content, give_get_payment_meta($payment_id), $payment_id);
245 245
 
246 246
 	// Return content
247 247
 	return $content;
@@ -253,10 +253,10 @@  discard block
 block discarded – undo
253 253
  * @since 1.0
254 254
  */
255 255
 function give_load_email_tags() {
256
-	do_action( 'give_add_email_tags' );
256
+	do_action('give_add_email_tags');
257 257
 }
258 258
 
259
-add_action( 'init', 'give_load_email_tags', - 999 );
259
+add_action('init', 'give_load_email_tags', - 999);
260 260
 
261 261
 /**
262 262
  * Add default Give email template tags
@@ -269,82 +269,82 @@  discard block
 block discarded – undo
269 269
 	$email_tags = array(
270 270
 		array(
271 271
 			'tag'         => 'donation',
272
-			'description' => __( 'The name of completed donation form', 'give' ),
272
+			'description' => __('The name of completed donation form', 'give'),
273 273
 			'function'    => 'give_email_tag_donation'
274 274
 		),
275 275
 		array(
276 276
 			'tag'         => 'name',
277
-			'description' => __( 'The donor\'s first name', 'give' ),
277
+			'description' => __('The donor\'s first name', 'give'),
278 278
 			'function'    => 'give_email_tag_first_name'
279 279
 		),
280 280
 		array(
281 281
 			'tag'         => 'fullname',
282
-			'description' => __( 'The donor\'s full name, first and last', 'give' ),
282
+			'description' => __('The donor\'s full name, first and last', 'give'),
283 283
 			'function'    => 'give_email_tag_fullname'
284 284
 		),
285 285
 		array(
286 286
 			'tag'         => 'username',
287
-			'description' => __( 'The donor\'s user name on the site, if they registered an account', 'give' ),
287
+			'description' => __('The donor\'s user name on the site, if they registered an account', 'give'),
288 288
 			'function'    => 'give_email_tag_username'
289 289
 		),
290 290
 		array(
291 291
 			'tag'         => 'user_email',
292
-			'description' => __( 'The donor\'s email address', 'give' ),
292
+			'description' => __('The donor\'s email address', 'give'),
293 293
 			'function'    => 'give_email_tag_user_email'
294 294
 		),
295 295
 		array(
296 296
 			'tag'         => 'billing_address',
297
-			'description' => __( 'The donor\'s billing address', 'give' ),
297
+			'description' => __('The donor\'s billing address', 'give'),
298 298
 			'function'    => 'give_email_tag_billing_address'
299 299
 		),
300 300
 		array(
301 301
 			'tag'         => 'date',
302
-			'description' => __( 'The date of the donation', 'give' ),
302
+			'description' => __('The date of the donation', 'give'),
303 303
 			'function'    => 'give_email_tag_date'
304 304
 		),
305 305
 		array(
306 306
 			'tag'         => 'price',
307
-			'description' => __( 'The total price of the donation', 'give' ),
307
+			'description' => __('The total price of the donation', 'give'),
308 308
 			'function'    => 'give_email_tag_price'
309 309
 		),
310 310
 		array(
311 311
 			'tag'         => 'payment_id',
312
-			'description' => __( 'The unique ID number for this donation', 'give' ),
312
+			'description' => __('The unique ID number for this donation', 'give'),
313 313
 			'function'    => 'give_email_tag_payment_id'
314 314
 		),
315 315
 		array(
316 316
 			'tag'         => 'receipt_id',
317
-			'description' => __( 'The unique ID number for this donation receipt', 'give' ),
317
+			'description' => __('The unique ID number for this donation receipt', 'give'),
318 318
 			'function'    => 'give_email_tag_receipt_id'
319 319
 		),
320 320
 		array(
321 321
 			'tag'         => 'payment_method',
322
-			'description' => __( 'The method of payment used for this donation', 'give' ),
322
+			'description' => __('The method of payment used for this donation', 'give'),
323 323
 			'function'    => 'give_email_tag_payment_method'
324 324
 		),
325 325
 		array(
326 326
 			'tag'         => 'sitename',
327
-			'description' => __( 'Your site name', 'give' ),
327
+			'description' => __('Your site name', 'give'),
328 328
 			'function'    => 'give_email_tag_sitename'
329 329
 		),
330 330
 		array(
331 331
 			'tag'         => 'receipt_link',
332
-			'description' => __( 'Adds a link so users can view their receipt directly on your website if they are unable to view it in the browser correctly.', 'give' ),
332
+			'description' => __('Adds a link so users can view their receipt directly on your website if they are unable to view it in the browser correctly.', 'give'),
333 333
 			'function'    => 'give_email_tag_receipt_link'
334 334
 		),
335 335
 	);
336 336
 
337 337
 	// Apply give_email_tags filter
338
-	$email_tags = apply_filters( 'give_email_tags', $email_tags );
338
+	$email_tags = apply_filters('give_email_tags', $email_tags);
339 339
 
340 340
 	// Add email tags
341
-	foreach ( $email_tags as $email_tag ) {
342
-		give_add_email_tag( $email_tag['tag'], $email_tag['description'], $email_tag['function'] );
341
+	foreach ($email_tags as $email_tag) {
342
+		give_add_email_tag($email_tag['tag'], $email_tag['description'], $email_tag['function']);
343 343
 	}
344 344
 
345 345
 }
346 346
 
347
-add_action( 'give_add_email_tags', 'give_setup_email_tags' );
347
+add_action('give_add_email_tags', 'give_setup_email_tags');
348 348
 
349 349
 
350 350
 /**
@@ -355,12 +355,12 @@  discard block
 block discarded – undo
355 355
  *
356 356
  * @return string name
357 357
  */
358
-function give_email_tag_first_name( $payment_id ) {
359
-	$payment_data = give_get_payment_meta( $payment_id );
360
-	if ( empty( $payment_data['user_info'] ) ) {
358
+function give_email_tag_first_name($payment_id) {
359
+	$payment_data = give_get_payment_meta($payment_id);
360
+	if (empty($payment_data['user_info'])) {
361 361
 		return '';
362 362
 	}
363
-	$email_name = give_get_email_names( $payment_data['user_info'] );
363
+	$email_name = give_get_email_names($payment_data['user_info']);
364 364
 
365 365
 	return $email_name['name'];
366 366
 }
@@ -373,12 +373,12 @@  discard block
 block discarded – undo
373 373
  *
374 374
  * @return string fullname
375 375
  */
376
-function give_email_tag_fullname( $payment_id ) {
377
-	$payment_data = give_get_payment_meta( $payment_id );
378
-	if ( empty( $payment_data['user_info'] ) ) {
376
+function give_email_tag_fullname($payment_id) {
377
+	$payment_data = give_get_payment_meta($payment_id);
378
+	if (empty($payment_data['user_info'])) {
379 379
 		return '';
380 380
 	}
381
-	$email_name = give_get_email_names( $payment_data['user_info'] );
381
+	$email_name = give_get_email_names($payment_data['user_info']);
382 382
 
383 383
 	return $email_name['fullname'];
384 384
 }
@@ -391,12 +391,12 @@  discard block
 block discarded – undo
391 391
  *
392 392
  * @return string username
393 393
  */
394
-function give_email_tag_username( $payment_id ) {
395
-	$payment_data = give_get_payment_meta( $payment_id );
396
-	if ( empty( $payment_data['user_info'] ) ) {
394
+function give_email_tag_username($payment_id) {
395
+	$payment_data = give_get_payment_meta($payment_id);
396
+	if (empty($payment_data['user_info'])) {
397 397
 		return '';
398 398
 	}
399
-	$email_name = give_get_email_names( $payment_data['user_info'] );
399
+	$email_name = give_get_email_names($payment_data['user_info']);
400 400
 
401 401
 	return $email_name['username'];
402 402
 }
@@ -409,8 +409,8 @@  discard block
 block discarded – undo
409 409
  *
410 410
  * @return string user_email
411 411
  */
412
-function give_email_tag_user_email( $payment_id ) {
413
-	return give_get_payment_user_email( $payment_id );
412
+function give_email_tag_user_email($payment_id) {
413
+	return give_get_payment_user_email($payment_id);
414 414
 }
415 415
 
416 416
 /**
@@ -421,10 +421,10 @@  discard block
 block discarded – undo
421 421
  *
422 422
  * @return string billing_address
423 423
  */
424
-function give_email_tag_billing_address( $payment_id ) {
424
+function give_email_tag_billing_address($payment_id) {
425 425
 
426
-	$user_info    = give_get_payment_meta_user_info( $payment_id );
427
-	$user_address = ! empty( $user_info['address'] ) ? $user_info['address'] : array(
426
+	$user_info    = give_get_payment_meta_user_info($payment_id);
427
+	$user_address = ! empty($user_info['address']) ? $user_info['address'] : array(
428 428
 		'line1'   => '',
429 429
 		'line2'   => '',
430 430
 		'city'    => '',
@@ -433,11 +433,11 @@  discard block
 block discarded – undo
433 433
 		'zip'     => ''
434 434
 	);
435 435
 
436
-	$return = $user_address['line1'] . "\n";
437
-	if ( ! empty( $user_address['line2'] ) ) {
438
-		$return .= $user_address['line2'] . "\n";
436
+	$return = $user_address['line1']."\n";
437
+	if ( ! empty($user_address['line2'])) {
438
+		$return .= $user_address['line2']."\n";
439 439
 	}
440
-	$return .= $user_address['city'] . ' ' . $user_address['zip'] . ' ' . $user_address['state'] . "\n";
440
+	$return .= $user_address['city'].' '.$user_address['zip'].' '.$user_address['state']."\n";
441 441
 	$return .= $user_address['country'];
442 442
 
443 443
 	return $return;
@@ -451,10 +451,10 @@  discard block
 block discarded – undo
451 451
  *
452 452
  * @return string date
453 453
  */
454
-function give_email_tag_date( $payment_id ) {
455
-	$payment_data = give_get_payment_meta( $payment_id );
454
+function give_email_tag_date($payment_id) {
455
+	$payment_data = give_get_payment_meta($payment_id);
456 456
 
457
-	return date_i18n( get_option( 'date_format' ), strtotime( $payment_data['date'] ) );
457
+	return date_i18n(get_option('date_format'), strtotime($payment_data['date']));
458 458
 }
459 459
 
460 460
 /**
@@ -465,10 +465,10 @@  discard block
 block discarded – undo
465 465
  *
466 466
  * @return string price
467 467
  */
468
-function give_email_tag_price( $payment_id ) {
469
-	$price = give_currency_filter( give_format_amount( give_get_payment_amount( $payment_id ) ), give_get_payment_currency_code( $payment_id ) );
468
+function give_email_tag_price($payment_id) {
469
+	$price = give_currency_filter(give_format_amount(give_get_payment_amount($payment_id)), give_get_payment_currency_code($payment_id));
470 470
 
471
-	return html_entity_decode( $price, ENT_COMPAT, 'UTF-8' );
471
+	return html_entity_decode($price, ENT_COMPAT, 'UTF-8');
472 472
 }
473 473
 
474 474
 /**
@@ -479,8 +479,8 @@  discard block
 block discarded – undo
479 479
  *
480 480
  * @return int payment_id
481 481
  */
482
-function give_email_tag_payment_id( $payment_id ) {
483
-	return give_get_payment_number( $payment_id );
482
+function give_email_tag_payment_id($payment_id) {
483
+	return give_get_payment_number($payment_id);
484 484
 }
485 485
 
486 486
 /**
@@ -491,8 +491,8 @@  discard block
 block discarded – undo
491 491
  *
492 492
  * @return string receipt_id
493 493
  */
494
-function give_email_tag_receipt_id( $payment_id ) {
495
-	return give_get_payment_key( $payment_id );
494
+function give_email_tag_receipt_id($payment_id) {
495
+	return give_get_payment_key($payment_id);
496 496
 }
497 497
 
498 498
 /**
@@ -503,9 +503,9 @@  discard block
 block discarded – undo
503 503
  *
504 504
  * @return string $form_title
505 505
  */
506
-function give_email_tag_donation( $payment_id ) {
507
-	$payment_data = give_get_payment_meta( $payment_id );
508
-	$form_title   = ( ! empty( $payment_data['form_title'] ) ? $payment_data['form_title'] : __( 'There was an error retrieving this donation title', 'give' ) );
506
+function give_email_tag_donation($payment_id) {
507
+	$payment_data = give_get_payment_meta($payment_id);
508
+	$form_title   = ( ! empty($payment_data['form_title']) ? $payment_data['form_title'] : __('There was an error retrieving this donation title', 'give'));
509 509
 
510 510
 	return $form_title;
511 511
 }
@@ -518,8 +518,8 @@  discard block
 block discarded – undo
518 518
  *
519 519
  * @return string gateway
520 520
  */
521
-function give_email_tag_payment_method( $payment_id ) {
522
-	return give_get_gateway_checkout_label( give_get_payment_gateway( $payment_id ) );
521
+function give_email_tag_payment_method($payment_id) {
522
+	return give_get_gateway_checkout_label(give_get_payment_gateway($payment_id));
523 523
 }
524 524
 
525 525
 /**
@@ -530,8 +530,8 @@  discard block
 block discarded – undo
530 530
  *
531 531
  * @return string sitename
532 532
  */
533
-function give_email_tag_sitename( $payment_id ) {
534
-	return wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES );
533
+function give_email_tag_sitename($payment_id) {
534
+	return wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES);
535 535
 }
536 536
 
537 537
 /**
@@ -543,15 +543,15 @@  discard block
 block discarded – undo
543 543
  *
544 544
  * @return string receipt_link
545 545
  */
546
-function give_email_tag_receipt_link( $payment_id ) {
546
+function give_email_tag_receipt_link($payment_id) {
547 547
 
548
-	$receipt_url       = esc_url( add_query_arg( array(
549
-		'payment_key' => give_get_payment_key( $payment_id ),
548
+	$receipt_url = esc_url(add_query_arg(array(
549
+		'payment_key' => give_get_payment_key($payment_id),
550 550
 		'give_action' => 'view_receipt'
551
-	), home_url() ) );
552
-	$formatted = sprintf( __( '%1$sView it in your browser.%2$s', 'give' ), '<a href="' . $receipt_url . '">', '</a>' );
551
+	), home_url()));
552
+	$formatted = sprintf(__('%1$sView it in your browser.%2$s', 'give'), '<a href="'.$receipt_url.'">', '</a>');
553 553
 
554
-	if(give_get_option('email_template') !== 'none') {
554
+	if (give_get_option('email_template') !== 'none') {
555 555
 		return $formatted;
556 556
 	} else {
557 557
 		return $receipt_url;
Please login to merge, or discard this patch.
includes/admin/add-ons.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Admin Add-ons
4
- *
5
- * @package     Give
6
- * @subpackage  Admin/Add-ons
7
- * @copyright   Copyright (c) 2015, WordImpress
8
- * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
9
- * @since       1.0
10
- */
3
+	 * Admin Add-ons
4
+	 *
5
+	 * @package     Give
6
+	 * @subpackage  Admin/Add-ons
7
+	 * @copyright   Copyright (c) 2015, WordImpress
8
+	 * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
9
+	 * @since       1.0
10
+	 */
11 11
 
12 12
 // Exit if accessed directly
13 13
 if ( ! defined( 'ABSPATH' ) ) {
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -25,12 +25,12 @@  discard block
 block discarded – undo
25 25
 function give_add_ons_page() {
26 26
 	ob_start(); ?>
27 27
 	<div class="wrap" id="give-add-ons">
28
-		<h2><?php _e( 'Give Add-ons', 'give' ); ?>
29
-			&nbsp;&mdash;&nbsp;<a href="https://givewp.com/addons/" class="button-primary give-view-addons-all" title="<?php _e( 'Browse All Add-ons', 'give' ); ?>" target="_blank"><?php _e( 'View All Add-ons', 'give' ); ?>
28
+		<h2><?php _e('Give Add-ons', 'give'); ?>
29
+			&nbsp;&mdash;&nbsp;<a href="https://givewp.com/addons/" class="button-primary give-view-addons-all" title="<?php _e('Browse All Add-ons', 'give'); ?>" target="_blank"><?php _e('View All Add-ons', 'give'); ?>
30 30
 				<span class="dashicons dashicons-external"></span></a>
31 31
 		</h2>
32 32
 
33
-		<p><?php _e( 'The following Add-ons extend the functionality of Give.', 'give' ); ?></p>
33
+		<p><?php _e('The following Add-ons extend the functionality of Give.', 'give'); ?></p>
34 34
 		<?php echo give_add_ons_get_feed(); ?>
35 35
 	</div>
36 36
 	<?php
@@ -48,18 +48,18 @@  discard block
 block discarded – undo
48 48
 function give_add_ons_get_feed() {
49 49
 
50 50
 	$addons_debug = false; //set to true to debug
51
-	$cache        = get_transient( 'give_add_ons_feed' );
51
+	$cache        = get_transient('give_add_ons_feed');
52 52
 
53
-	if ( $cache === false || $addons_debug === true && WP_DEBUG === true ) {
54
-		$feed = wp_remote_get( 'https://givewp.com/downloads/feed/', array( 'sslverify' => false ) );
53
+	if ($cache === false || $addons_debug === true && WP_DEBUG === true) {
54
+		$feed = wp_remote_get('https://givewp.com/downloads/feed/', array('sslverify' => false));
55 55
 
56
-		if ( ! is_wp_error( $feed ) ) {
57
-			if ( isset( $feed['body'] ) && strlen( $feed['body'] ) > 0 ) {
58
-				$cache = wp_remote_retrieve_body( $feed );
59
-				set_transient( 'give_add_ons_feed', $cache, 3600 );
56
+		if ( ! is_wp_error($feed)) {
57
+			if (isset($feed['body']) && strlen($feed['body']) > 0) {
58
+				$cache = wp_remote_retrieve_body($feed);
59
+				set_transient('give_add_ons_feed', $cache, 3600);
60 60
 			}
61 61
 		} else {
62
-			$cache = '<div class="error"><p>' . __( 'There was an error retrieving the Give Add-ons list from the server. Please try again later.', 'give' ) . '</div>';
62
+			$cache = '<div class="error"><p>'.__('There was an error retrieving the Give Add-ons list from the server. Please try again later.', 'give').'</div>';
63 63
 		}
64 64
 	}
65 65
 
Please login to merge, or discard this patch.
includes/scripts.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Scripts
4
- *
5
- * @package     Give
6
- * @subpackage  Functions
7
- * @copyright   Copyright (c) 2015, WordImpress
8
- * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
9
- * @since       1.0
10
- */
3
+	 * Scripts
4
+	 *
5
+	 * @package     Give
6
+	 * @subpackage  Functions
7
+	 * @copyright   Copyright (c) 2015, WordImpress
8
+	 * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
9
+	 * @since       1.0
10
+	 */
11 11
 
12 12
 // Exit if accessed directly
13 13
 if ( ! defined( 'ABSPATH' ) ) {
Please login to merge, or discard this patch.
Spacing   +130 added lines, -130 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
 
@@ -28,93 +28,93 @@  discard block
 block discarded – undo
28 28
 
29 29
 	global $give_options;
30 30
 
31
-	$js_dir         = GIVE_PLUGIN_URL . 'assets/js/frontend/';
32
-	$js_plugins     = GIVE_PLUGIN_URL . 'assets/js/plugins/';
33
-	$scripts_footer = ( give_get_option( 'scripts_footer' ) == 'on' ) ? true : false;
31
+	$js_dir         = GIVE_PLUGIN_URL.'assets/js/frontend/';
32
+	$js_plugins     = GIVE_PLUGIN_URL.'assets/js/plugins/';
33
+	$scripts_footer = (give_get_option('scripts_footer') == 'on') ? true : false;
34 34
 
35 35
 	// Use minified libraries if SCRIPT_DEBUG is turned off
36
-	$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
36
+	$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
37 37
 
38 38
 	//Localize / PHP to AJAX vars
39
-	$localize_give_checkout = apply_filters( 'give_global_script_vars', array(
39
+	$localize_give_checkout = apply_filters('give_global_script_vars', array(
40 40
 		'ajaxurl'             => give_get_ajax_url(),
41
-		'checkout_nonce'      => wp_create_nonce( 'give_checkout_nonce' ),
42
-		'currency_sign'       => give_currency_filter( '' ),
41
+		'checkout_nonce'      => wp_create_nonce('give_checkout_nonce'),
42
+		'currency_sign'       => give_currency_filter(''),
43 43
 		'currency_pos'        => give_get_currency_position(),
44
-		'thousands_separator' => isset( $give_options['thousands_separator'] ) ? $give_options['thousands_separator'] : ',',
45
-		'decimal_separator'   => isset( $give_options['decimal_separator'] ) ? $give_options['decimal_separator'] : '.',
46
-		'no_gateway'          => __( 'Please select a payment method', 'give' ),
47
-		'bad_minimum'         => __( 'The minimum donation amount for this form is', 'give' ),
48
-		'general_loading'     => __( 'Loading...', 'give' ),
49
-		'purchase_loading'    => __( 'Please Wait...', 'give' ),
44
+		'thousands_separator' => isset($give_options['thousands_separator']) ? $give_options['thousands_separator'] : ',',
45
+		'decimal_separator'   => isset($give_options['decimal_separator']) ? $give_options['decimal_separator'] : '.',
46
+		'no_gateway'          => __('Please select a payment method', 'give'),
47
+		'bad_minimum'         => __('The minimum donation amount for this form is', 'give'),
48
+		'general_loading'     => __('Loading...', 'give'),
49
+		'purchase_loading'    => __('Please Wait...', 'give'),
50 50
 		'give_version'        => GIVE_VERSION
51
-	) );
52
-	$localize_give_ajax     = apply_filters( 'give_global_ajax_vars', array(
51
+	));
52
+	$localize_give_ajax = apply_filters('give_global_ajax_vars', array(
53 53
 		'ajaxurl'          => give_get_ajax_url(),
54
-		'loading'          => __( 'Loading', 'give' ),
54
+		'loading'          => __('Loading', 'give'),
55 55
 		// General loading message
56
-		'select_option'    => __( 'Please select an option', 'give' ),
56
+		'select_option'    => __('Please select an option', 'give'),
57 57
 		// Variable pricing error with multi-purchase option enabled
58
-		'default_gateway'  => give_get_default_gateway( null ),
59
-		'permalinks'       => get_option( 'permalink_structure' ) ? '1' : '0',
60
-		'number_decimals'  => apply_filters( 'give_format_amount_decimals', 2 )
61
-	) );
58
+		'default_gateway'  => give_get_default_gateway(null),
59
+		'permalinks'       => get_option('permalink_structure') ? '1' : '0',
60
+		'number_decimals'  => apply_filters('give_format_amount_decimals', 2)
61
+	));
62 62
 
63 63
 	//DEBUG is On
64
-	if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) {
64
+	if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) {
65 65
 
66
-		if ( give_is_cc_verify_enabled() ) {
67
-			wp_register_script( 'give-cc-validator', $js_plugins . 'jquery.payment' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
68
-			wp_enqueue_script( 'give-cc-validator' );
66
+		if (give_is_cc_verify_enabled()) {
67
+			wp_register_script('give-cc-validator', $js_plugins.'jquery.payment'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
68
+			wp_enqueue_script('give-cc-validator');
69 69
 		}
70 70
 
71
-		wp_register_script( 'give-float-labels', $js_plugins . 'float-labels' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
72
-		wp_enqueue_script( 'give-float-labels' );
71
+		wp_register_script('give-float-labels', $js_plugins.'float-labels'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
72
+		wp_enqueue_script('give-float-labels');
73 73
 
74
-		wp_register_script( 'give-blockui', $js_plugins . 'jquery.blockUI' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
75
-		wp_enqueue_script( 'give-blockui' );
74
+		wp_register_script('give-blockui', $js_plugins.'jquery.blockUI'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
75
+		wp_enqueue_script('give-blockui');
76 76
 
77
-		wp_register_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
78
-		wp_enqueue_script( 'give-qtip' );
77
+		wp_register_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
78
+		wp_enqueue_script('give-qtip');
79 79
 
80
-		wp_register_script( 'give-accounting', $js_plugins . 'accounting' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
81
-		wp_enqueue_script( 'give-accounting' );
80
+		wp_register_script('give-accounting', $js_plugins.'accounting'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
81
+		wp_enqueue_script('give-accounting');
82 82
 
83
-		wp_register_script( 'give-magnific', $js_plugins . 'jquery.magnific-popup' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
84
-		wp_enqueue_script( 'give-magnific' );
83
+		wp_register_script('give-magnific', $js_plugins.'jquery.magnific-popup'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
84
+		wp_enqueue_script('give-magnific');
85 85
 
86
-		wp_register_script( 'give-checkout-global', $js_dir . 'give-checkout-global' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
87
-		wp_enqueue_script( 'give-checkout-global' );
86
+		wp_register_script('give-checkout-global', $js_dir.'give-checkout-global'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
87
+		wp_enqueue_script('give-checkout-global');
88 88
 
89 89
 		//General scripts
90
-		wp_register_script( 'give-scripts', $js_dir . 'give' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
91
-		wp_enqueue_script( 'give-scripts' );
90
+		wp_register_script('give-scripts', $js_dir.'give'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
91
+		wp_enqueue_script('give-scripts');
92 92
 
93 93
 		// Load AJAX scripts, if enabled
94
-		wp_register_script( 'give-ajax', $js_dir . 'give-ajax' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
95
-		wp_enqueue_script( 'give-ajax' );
94
+		wp_register_script('give-ajax', $js_dir.'give-ajax'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
95
+		wp_enqueue_script('give-ajax');
96 96
 
97 97
 		//Localize / Pass AJAX vars from PHP
98
-		wp_localize_script( 'give-checkout-global', 'give_global_vars', $localize_give_checkout );
99
-		wp_localize_script( 'give-ajax', 'give_scripts', $localize_give_ajax );
98
+		wp_localize_script('give-checkout-global', 'give_global_vars', $localize_give_checkout);
99
+		wp_localize_script('give-ajax', 'give_scripts', $localize_give_ajax);
100 100
 
101 101
 
102 102
 	} else {
103 103
 
104 104
 		//DEBUG is OFF (one JS file to rule them all!)
105
-		wp_register_script( 'give', $js_dir . 'give.all.min.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
106
-		wp_enqueue_script( 'give' );
105
+		wp_register_script('give', $js_dir.'give.all.min.js', array('jquery'), GIVE_VERSION, $scripts_footer);
106
+		wp_enqueue_script('give');
107 107
 
108 108
 		//Localize / Pass AJAX vars from PHP
109
-		wp_localize_script( 'give', 'give_global_vars', $localize_give_checkout );
110
-		wp_localize_script( 'give', 'give_scripts', $localize_give_ajax );
109
+		wp_localize_script('give', 'give_global_vars', $localize_give_checkout);
110
+		wp_localize_script('give', 'give_scripts', $localize_give_ajax);
111 111
 
112 112
 	}
113 113
 
114 114
 
115 115
 }
116 116
 
117
-add_action( 'wp_enqueue_scripts', 'give_load_scripts' );
117
+add_action('wp_enqueue_scripts', 'give_load_scripts');
118 118
 
119 119
 /**
120 120
  * Register Styles
@@ -126,47 +126,47 @@  discard block
 block discarded – undo
126 126
  */
127 127
 function give_register_styles() {
128 128
 
129
-	if ( give_get_option( 'disable_css', false ) ) {
129
+	if (give_get_option('disable_css', false)) {
130 130
 		return;
131 131
 	}
132 132
 
133 133
 	// Use minified libraries if SCRIPT_DEBUG is turned off
134
-	$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
134
+	$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
135 135
 
136
-	$file          = 'give' . $suffix . '.css';
136
+	$file          = 'give'.$suffix.'.css';
137 137
 	$templates_dir = give_get_theme_template_dir_name();
138 138
 
139
-	$child_theme_style_sheet    = trailingslashit( get_stylesheet_directory() ) . $templates_dir . $file;
140
-	$child_theme_style_sheet_2  = trailingslashit( get_stylesheet_directory() ) . $templates_dir . 'give.css';
141
-	$parent_theme_style_sheet   = trailingslashit( get_template_directory() ) . $templates_dir . $file;
142
-	$parent_theme_style_sheet_2 = trailingslashit( get_template_directory() ) . $templates_dir . 'give.css';
143
-	$give_plugin_style_sheet    = trailingslashit( give_get_templates_dir() ) . $file;
139
+	$child_theme_style_sheet    = trailingslashit(get_stylesheet_directory()).$templates_dir.$file;
140
+	$child_theme_style_sheet_2  = trailingslashit(get_stylesheet_directory()).$templates_dir.'give.css';
141
+	$parent_theme_style_sheet   = trailingslashit(get_template_directory()).$templates_dir.$file;
142
+	$parent_theme_style_sheet_2 = trailingslashit(get_template_directory()).$templates_dir.'give.css';
143
+	$give_plugin_style_sheet    = trailingslashit(give_get_templates_dir()).$file;
144 144
 
145 145
 	// Look in the child theme directory first, followed by the parent theme, followed by the Give core templates directory
146 146
 	// Also look for the min version first, followed by non minified version, even if SCRIPT_DEBUG is not enabled.
147 147
 	// This allows users to copy just give.css to their theme
148
-	if ( file_exists( $child_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $child_theme_style_sheet_2 ) ) ) ) {
149
-		if ( ! empty( $nonmin ) ) {
150
-			$url = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . 'give.css';
148
+	if (file_exists($child_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($child_theme_style_sheet_2)))) {
149
+		if ( ! empty($nonmin)) {
150
+			$url = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.'give.css';
151 151
 		} else {
152
-			$url = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . $file;
152
+			$url = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.$file;
153 153
 		}
154
-	} elseif ( file_exists( $parent_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $parent_theme_style_sheet_2 ) ) ) ) {
155
-		if ( ! empty( $nonmin ) ) {
156
-			$url = trailingslashit( get_template_directory_uri() ) . $templates_dir . 'give.css';
154
+	} elseif (file_exists($parent_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($parent_theme_style_sheet_2)))) {
155
+		if ( ! empty($nonmin)) {
156
+			$url = trailingslashit(get_template_directory_uri()).$templates_dir.'give.css';
157 157
 		} else {
158
-			$url = trailingslashit( get_template_directory_uri() ) . $templates_dir . $file;
158
+			$url = trailingslashit(get_template_directory_uri()).$templates_dir.$file;
159 159
 		}
160
-	} elseif ( file_exists( $give_plugin_style_sheet ) || file_exists( $give_plugin_style_sheet ) ) {
161
-		$url = trailingslashit( give_get_templates_url() ) . $file;
160
+	} elseif (file_exists($give_plugin_style_sheet) || file_exists($give_plugin_style_sheet)) {
161
+		$url = trailingslashit(give_get_templates_url()).$file;
162 162
 	}
163 163
 
164
-	wp_register_style( 'give-styles', $url, array(), GIVE_VERSION, 'all' );
165
-	wp_enqueue_style( 'give-styles' );
164
+	wp_register_style('give-styles', $url, array(), GIVE_VERSION, 'all');
165
+	wp_enqueue_style('give-styles');
166 166
 
167 167
 }
168 168
 
169
-add_action( 'wp_enqueue_scripts', 'give_register_styles' );
169
+add_action('wp_enqueue_scripts', 'give_register_styles');
170 170
 
171 171
 /**
172 172
  * Load Admin Scripts
@@ -180,93 +180,93 @@  discard block
 block discarded – undo
180 180
  *
181 181
  * @return void
182 182
  */
183
-function give_load_admin_scripts( $hook ) {
183
+function give_load_admin_scripts($hook) {
184 184
 
185 185
 	global $wp_version, $post, $post_type;
186 186
 
187 187
 	//Directories of assets
188
-	$js_dir     = GIVE_PLUGIN_URL . 'assets/js/admin/';
189
-	$js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/';
190
-	$css_dir    = GIVE_PLUGIN_URL . 'assets/css/';
188
+	$js_dir     = GIVE_PLUGIN_URL.'assets/js/admin/';
189
+	$js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/';
190
+	$css_dir    = GIVE_PLUGIN_URL.'assets/css/';
191 191
 
192 192
 	// Use minified libraries if SCRIPT_DEBUG is turned off
193
-	$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
193
+	$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
194 194
 
195 195
 	//Global Admin:
196
-	wp_register_style( 'give-admin-bar-notification', $css_dir . 'adminbar-style.css' );
197
-	wp_enqueue_style( 'give-admin-bar-notification' );
196
+	wp_register_style('give-admin-bar-notification', $css_dir.'adminbar-style.css');
197
+	wp_enqueue_style('give-admin-bar-notification');
198 198
 
199 199
 	//Give Admin Only:
200
-	if ( ! apply_filters( 'give_load_admin_scripts', give_is_admin_page(), $hook ) ) {
200
+	if ( ! apply_filters('give_load_admin_scripts', give_is_admin_page(), $hook)) {
201 201
 		return;
202 202
 	}
203 203
 
204 204
 	//CSS
205
-	wp_register_style( 'jquery-ui-css', $css_dir . 'jquery-ui-fresh' . $suffix . '.css' );
206
-	wp_enqueue_style( 'jquery-ui-css' );
207
-	wp_register_style( 'give-admin', $css_dir . 'give-admin' . $suffix . '.css', GIVE_VERSION );
208
-	wp_enqueue_style( 'give-admin' );
209
-	wp_register_style( 'jquery-chosen', $css_dir . 'chosen' . $suffix . '.css', array(), GIVE_VERSION );
210
-	wp_enqueue_style( 'jquery-chosen' );
211
-	wp_enqueue_style( 'thickbox' );
205
+	wp_register_style('jquery-ui-css', $css_dir.'jquery-ui-fresh'.$suffix.'.css');
206
+	wp_enqueue_style('jquery-ui-css');
207
+	wp_register_style('give-admin', $css_dir.'give-admin'.$suffix.'.css', GIVE_VERSION);
208
+	wp_enqueue_style('give-admin');
209
+	wp_register_style('jquery-chosen', $css_dir.'chosen'.$suffix.'.css', array(), GIVE_VERSION);
210
+	wp_enqueue_style('jquery-chosen');
211
+	wp_enqueue_style('thickbox');
212 212
 
213 213
 	//JS
214
-	wp_register_script( 'jquery-chosen', $js_plugins . 'chosen.jquery' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION );
215
-	wp_enqueue_script( 'jquery-chosen' );
214
+	wp_register_script('jquery-chosen', $js_plugins.'chosen.jquery'.$suffix.'.js', array('jquery'), GIVE_VERSION);
215
+	wp_enqueue_script('jquery-chosen');
216 216
 
217
-	wp_register_script( 'give-admin-scripts', $js_dir . 'admin-scripts' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
218
-	wp_enqueue_script( 'give-admin-scripts' );
217
+	wp_register_script('give-admin-scripts', $js_dir.'admin-scripts'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
218
+	wp_enqueue_script('give-admin-scripts');
219 219
 
220
-	wp_register_script( 'jquery-flot', $js_plugins . 'jquery.flot' . $suffix . '.js' );
221
-	wp_enqueue_script( 'jquery-flot' );
220
+	wp_register_script('jquery-flot', $js_plugins.'jquery.flot'.$suffix.'.js');
221
+	wp_enqueue_script('jquery-flot');
222 222
 
223
-	wp_register_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
224
-	wp_enqueue_script( 'give-qtip' );
223
+	wp_register_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
224
+	wp_enqueue_script('give-qtip');
225 225
 
226
-	wp_enqueue_script( 'jquery-ui-datepicker' );
227
-	wp_enqueue_script( 'thickbox' );
226
+	wp_enqueue_script('jquery-ui-datepicker');
227
+	wp_enqueue_script('thickbox');
228 228
 
229 229
 	//Forms CPT Script
230
-	if ( $post_type === 'give_forms' ) {
231
-		wp_register_script( 'give-admin-forms-scripts', $js_dir . 'admin-forms' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
232
-		wp_enqueue_script( 'give-admin-forms-scripts' );
230
+	if ($post_type === 'give_forms') {
231
+		wp_register_script('give-admin-forms-scripts', $js_dir.'admin-forms'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
232
+		wp_enqueue_script('give-admin-forms-scripts');
233 233
 	}
234 234
 
235 235
 	//Localize strings & variables for JS
236
-	wp_localize_script( 'give-admin-scripts', 'give_vars', array(
237
-		'post_id'                 => isset( $post->ID ) ? $post->ID : null,
236
+	wp_localize_script('give-admin-scripts', 'give_vars', array(
237
+		'post_id'                 => isset($post->ID) ? $post->ID : null,
238 238
 		'give_version'            => GIVE_VERSION,
239
-		'quick_edit_warning'      => __( 'Sorry, not available for variable priced forms.', 'give' ),
240
-		'delete_payment'          => __( 'Are you sure you wish to delete this payment?', 'give' ),
241
-		'delete_payment_note'     => __( 'Are you sure you wish to delete this note?', 'give' ),
242
-		'revoke_api_key'          => __( 'Are you sure you wish to revoke this API key?', 'give' ),
243
-		'regenerate_api_key'      => __( 'Are you sure you wish to regenerate this API key?', 'give' ),
244
-		'resend_receipt'          => __( 'Are you sure you wish to resend the donation receipt?', 'give' ),
245
-		'copy_download_link_text' => __( 'Copy these links to your clipboard and give them to your donor', 'give' ),
246
-		'delete_payment_download' => sprintf( __( 'Are you sure you wish to delete this %s?', 'give' ), give_get_forms_label_singular() ),
247
-		'one_price_min'           => __( 'You must have at least one price', 'give' ),
248
-		'one_file_min'            => __( 'You must have at least one file', 'give' ),
249
-		'one_field_min'           => __( 'You must have at least one field', 'give' ),
250
-		'one_option'              => sprintf( __( 'Choose a %s', 'give' ), give_get_forms_label_singular() ),
251
-		'one_or_more_option'      => sprintf( __( 'Choose one or more %s', 'give' ), give_get_forms_label_plural() ),
252
-		'numeric_item_price'      => __( 'Item price must be numeric', 'give' ),
253
-		'numeric_quantity'        => __( 'Quantity must be numeric', 'give' ),
254
-		'currency_sign'           => give_currency_filter( '' ),
255
-		'currency_pos'            => isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before',
239
+		'quick_edit_warning'      => __('Sorry, not available for variable priced forms.', 'give'),
240
+		'delete_payment'          => __('Are you sure you wish to delete this payment?', 'give'),
241
+		'delete_payment_note'     => __('Are you sure you wish to delete this note?', 'give'),
242
+		'revoke_api_key'          => __('Are you sure you wish to revoke this API key?', 'give'),
243
+		'regenerate_api_key'      => __('Are you sure you wish to regenerate this API key?', 'give'),
244
+		'resend_receipt'          => __('Are you sure you wish to resend the donation receipt?', 'give'),
245
+		'copy_download_link_text' => __('Copy these links to your clipboard and give them to your donor', 'give'),
246
+		'delete_payment_download' => sprintf(__('Are you sure you wish to delete this %s?', 'give'), give_get_forms_label_singular()),
247
+		'one_price_min'           => __('You must have at least one price', 'give'),
248
+		'one_file_min'            => __('You must have at least one file', 'give'),
249
+		'one_field_min'           => __('You must have at least one field', 'give'),
250
+		'one_option'              => sprintf(__('Choose a %s', 'give'), give_get_forms_label_singular()),
251
+		'one_or_more_option'      => sprintf(__('Choose one or more %s', 'give'), give_get_forms_label_plural()),
252
+		'numeric_item_price'      => __('Item price must be numeric', 'give'),
253
+		'numeric_quantity'        => __('Quantity must be numeric', 'give'),
254
+		'currency_sign'           => give_currency_filter(''),
255
+		'currency_pos'            => isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before',
256 256
 		'currency_decimals'       => give_currency_decimal_filter(),
257
-		'new_media_ui'            => apply_filters( 'give_use_35_media_ui', 1 ),
258
-		'remove_text'             => __( 'Remove', 'give' ),
259
-		'type_to_search'          => sprintf( __( 'Type to search %s', 'give' ), give_get_forms_label_plural() ),
260
-	) );
257
+		'new_media_ui'            => apply_filters('give_use_35_media_ui', 1),
258
+		'remove_text'             => __('Remove', 'give'),
259
+		'type_to_search'          => sprintf(__('Type to search %s', 'give'), give_get_forms_label_plural()),
260
+	));
261 261
 
262
-	if ( function_exists( 'wp_enqueue_media' ) && version_compare( $wp_version, '3.5', '>=' ) ) {
262
+	if (function_exists('wp_enqueue_media') && version_compare($wp_version, '3.5', '>=')) {
263 263
 		//call for new media manager
264 264
 		wp_enqueue_media();
265 265
 	}
266 266
 
267 267
 }
268 268
 
269
-add_action( 'admin_enqueue_scripts', 'give_load_admin_scripts', 100 );
269
+add_action('admin_enqueue_scripts', 'give_load_admin_scripts', 100);
270 270
 
271 271
 /**
272 272
  * Admin Give Icon
@@ -283,14 +283,14 @@  discard block
 block discarded – undo
283 283
 	?>
284 284
 	<style type="text/css" media="screen">
285 285
 
286
-		<?php if( version_compare( $wp_version, '3.8-RC', '>=' ) || version_compare( $wp_version, '3.8', '>=' ) ) { ?>
286
+		<?php if (version_compare($wp_version, '3.8-RC', '>=') || version_compare($wp_version, '3.8', '>=')) { ?>
287 287
 		@font-face {
288 288
 			font-family: 'give-icomoon';
289
-			src: url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.eot?-ngjl88'; ?>');
290
-			src: url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.eot?#iefix-ngjl88'?>') format('embedded-opentype'),
291
-			url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.woff?-ngjl88'; ?>') format('woff'),
292
-			url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.ttf?-ngjl88'; ?>') format('truetype'),
293
-			url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.svg?-ngjl88#icomoon'; ?>') format('svg');
289
+			src: url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.eot?-ngjl88'; ?>');
290
+			src: url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.eot?#iefix-ngjl88'?>') format('embedded-opentype'),
291
+			url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.woff?-ngjl88'; ?>') format('woff'),
292
+			url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.ttf?-ngjl88'; ?>') format('truetype'),
293
+			url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.svg?-ngjl88#icomoon'; ?>') format('svg');
294 294
 			font-weight: normal;
295 295
 			font-style: normal;
296 296
 		}
@@ -309,4 +309,4 @@  discard block
 block discarded – undo
309 309
 	<?php
310 310
 }
311 311
 
312
-add_action( 'admin_head', 'give_admin_icon' );
312
+add_action('admin_head', 'give_admin_icon');
Please login to merge, or discard this patch.
includes/payments/class-payment-stats.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Earnings / Sales Stats
4
- *
5
- * @package     Give
6
- * @subpackage  Classes/Stats
7
- * @copyright   Copyright (c) 2015, WordImpress
8
- * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
9
- * @since       1.0
10
- */
3
+	 * Earnings / Sales Stats
4
+	 *
5
+	 * @package     Give
6
+	 * @subpackage  Classes/Stats
7
+	 * @copyright   Copyright (c) 2015, WordImpress
8
+	 * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
9
+	 * @since       1.0
10
+	 */
11 11
 
12 12
 // Exit if accessed directly
13 13
 if ( ! defined( 'ABSPATH' ) ) {
Please login to merge, or discard this patch.
Spacing   +46 added lines, -46 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
 
@@ -39,46 +39,46 @@  discard block
 block discarded – undo
39 39
 	 *
40 40
 	 * @return float|int
41 41
 	 */
42
-	public function get_sales( $form_id = 0, $start_date = false, $end_date = false, $status = 'publish' ) {
42
+	public function get_sales($form_id = 0, $start_date = false, $end_date = false, $status = 'publish') {
43 43
 
44
-		$this->setup_dates( $start_date, $end_date );
44
+		$this->setup_dates($start_date, $end_date);
45 45
 
46 46
 		// Make sure start date is valid
47
-		if ( is_wp_error( $this->start_date ) ) {
47
+		if (is_wp_error($this->start_date)) {
48 48
 			return $this->start_date;
49 49
 		}
50 50
 
51 51
 		// Make sure end date is valid
52
-		if ( is_wp_error( $this->end_date ) ) {
52
+		if (is_wp_error($this->end_date)) {
53 53
 			return $this->end_date;
54 54
 		}
55 55
 
56
-		if ( empty( $form_id ) ) {
56
+		if (empty($form_id)) {
57 57
 
58 58
 			// Global sale stats
59
-			add_filter( 'give_count_payments_where', array( $this, 'count_where' ) );
59
+			add_filter('give_count_payments_where', array($this, 'count_where'));
60 60
 
61
-			if ( is_array( $status ) ) {
61
+			if (is_array($status)) {
62 62
 				$count = 0;
63
-				foreach ( $status as $payment_status ) {
63
+				foreach ($status as $payment_status) {
64 64
 					$count += give_count_payments()->$payment_status;
65 65
 				}
66 66
 			} else {
67 67
 				$count = give_count_payments()->$status;
68 68
 			}
69 69
 
70
-			remove_filter( 'give_count_payments_where', array( $this, 'count_where' ) );
70
+			remove_filter('give_count_payments_where', array($this, 'count_where'));
71 71
 
72 72
 		} else {
73 73
 
74 74
 			// Product specific stats
75 75
 			global $give_logs;
76 76
 
77
-			add_filter( 'posts_where', array( $this, 'payments_where' ) );
77
+			add_filter('posts_where', array($this, 'payments_where'));
78 78
 
79
-			$count = $give_logs->get_log_count( $form_id, 'sale' );
79
+			$count = $give_logs->get_log_count($form_id, 'sale');
80 80
 
81
-			remove_filter( 'posts_where', array( $this, 'payments_where' ) );
81
+			remove_filter('posts_where', array($this, 'payments_where'));
82 82
 
83 83
 		}
84 84
 
@@ -100,31 +100,31 @@  discard block
 block discarded – undo
100 100
 	 *
101 101
 	 * @return float|int
102 102
 	 */
103
-	public function get_earnings( $form_id = 0, $start_date = false, $end_date = false, $gateway_id = false ) {
103
+	public function get_earnings($form_id = 0, $start_date = false, $end_date = false, $gateway_id = false) {
104 104
 
105 105
 		global $wpdb;
106 106
 
107
-		$this->setup_dates( $start_date, $end_date );
107
+		$this->setup_dates($start_date, $end_date);
108 108
 
109 109
 		// Make sure start date is valid
110
-		if ( is_wp_error( $this->start_date ) ) {
110
+		if (is_wp_error($this->start_date)) {
111 111
 			return $this->start_date;
112 112
 		}
113 113
 
114 114
 		// Make sure end date is valid
115
-		if ( is_wp_error( $this->end_date ) ) {
115
+		if (is_wp_error($this->end_date)) {
116 116
 			return $this->end_date;
117 117
 		}
118 118
 
119
-		add_filter( 'posts_where', array( $this, 'payments_where' ) );
119
+		add_filter('posts_where', array($this, 'payments_where'));
120 120
 
121
-		if ( empty( $form_id ) ) {
121
+		if (empty($form_id)) {
122 122
 
123 123
 			// Global earning stats
124 124
 			$args = array(
125 125
 				'post_type'              => 'give_payment',
126 126
 				'nopaging'               => true,
127
-				'post_status'            => array( 'publish', 'revoked' ),
127
+				'post_status'            => array('publish', 'revoked'),
128 128
 				'fields'                 => 'ids',
129 129
 				'update_post_term_cache' => false,
130 130
 				'suppress_filters'       => false,
@@ -136,24 +136,24 @@  discard block
 block discarded – undo
136 136
 			);
137 137
 
138 138
 			//Filter by Gateway ID meta_key
139
-			if ( $gateway_id !== false ) {
139
+			if ($gateway_id !== false) {
140 140
 				$args['meta_key']   = '_give_payment_gateway';
141 141
 				$args['meta_value'] = $gateway_id;
142 142
 			}
143 143
 
144
-			$args = apply_filters( 'give_stats_earnings_args', $args );
145
-			$key  = 'give_stats_' . substr( md5( serialize( $args ) ), 0, 15 );
144
+			$args = apply_filters('give_stats_earnings_args', $args);
145
+			$key  = 'give_stats_'.substr(md5(serialize($args)), 0, 15);
146 146
 
147
-			$earnings = get_transient( $key );
148
-			if ( false === $earnings ) {
149
-				$sales    = get_posts( $args );
147
+			$earnings = get_transient($key);
148
+			if (false === $earnings) {
149
+				$sales    = get_posts($args);
150 150
 				$earnings = 0;
151
-				if ( $sales ) {
152
-					$sales = implode( ',', $sales );
153
-					$earnings += $wpdb->get_var( "SELECT SUM(meta_value) FROM $wpdb->postmeta WHERE meta_key = '_give_payment_total' AND post_id IN({$sales})" );
151
+				if ($sales) {
152
+					$sales = implode(',', $sales);
153
+					$earnings += $wpdb->get_var("SELECT SUM(meta_value) FROM $wpdb->postmeta WHERE meta_key = '_give_payment_total' AND post_id IN({$sales})");
154 154
 				}
155 155
 				// Cache the results for one hour
156
-				set_transient( $key, $earnings, HOUR_IN_SECONDS );
156
+				set_transient($key, $earnings, HOUR_IN_SECONDS);
157 157
 			}
158 158
 
159 159
 		} else {
@@ -174,34 +174,34 @@  discard block
 block discarded – undo
174 174
 				// This is not a valid query arg, but is used for cache keying
175 175
 			);
176 176
 
177
-			$args = apply_filters( 'give_stats_earnings_args', $args );
178
-			$key  = 'give_stats_' . substr( md5( serialize( $args ) ), 0, 15 );
177
+			$args = apply_filters('give_stats_earnings_args', $args);
178
+			$key  = 'give_stats_'.substr(md5(serialize($args)), 0, 15);
179 179
 			//Set transient for faster stats
180
-			$earnings = get_transient( $key );
180
+			$earnings = get_transient($key);
181 181
 
182
-			if ( false === $earnings ) {
182
+			if (false === $earnings) {
183 183
 
184
-				$log_ids  = $give_logs->get_connected_logs( $args, 'sale' );
184
+				$log_ids  = $give_logs->get_connected_logs($args, 'sale');
185 185
 				$earnings = 0;
186 186
 
187
-				if ( $log_ids ) {
188
-					$log_ids     = implode( ',', $log_ids );
189
-					$payment_ids = $wpdb->get_col( "SELECT meta_value FROM $wpdb->postmeta WHERE meta_key='_give_log_payment_id' AND post_id IN ($log_ids);" );
190
-					foreach ( $payment_ids as $payment_id ) {
191
-						$earnings += give_get_payment_amount( $payment_id );
187
+				if ($log_ids) {
188
+					$log_ids     = implode(',', $log_ids);
189
+					$payment_ids = $wpdb->get_col("SELECT meta_value FROM $wpdb->postmeta WHERE meta_key='_give_log_payment_id' AND post_id IN ($log_ids);");
190
+					foreach ($payment_ids as $payment_id) {
191
+						$earnings += give_get_payment_amount($payment_id);
192 192
 					}
193 193
 				}
194 194
 
195 195
 				// Cache the results for one hour
196
-				set_transient( $key, $earnings, 60 * 60 );
196
+				set_transient($key, $earnings, 60 * 60);
197 197
 			}
198 198
 		}
199 199
 
200 200
 		//remove our filter
201
-		remove_filter( 'posts_where', array( $this, 'payments_where' ) );
201
+		remove_filter('posts_where', array($this, 'payments_where'));
202 202
 
203 203
 		//return earnings
204
-		return round( $earnings, give_currency_decimal_filter() );
204
+		return round($earnings, give_currency_decimal_filter());
205 205
 
206 206
 	}
207 207
 
@@ -215,16 +215,16 @@  discard block
 block discarded – undo
215 215
 	 *
216 216
 	 * @return array
217 217
 	 */
218
-	public function get_best_selling( $number = 10 ) {
218
+	public function get_best_selling($number = 10) {
219 219
 
220 220
 		global $wpdb;
221 221
 
222
-		$give_forms = $wpdb->get_results( $wpdb->prepare(
222
+		$give_forms = $wpdb->get_results($wpdb->prepare(
223 223
 			"SELECT post_id as form_id, max(meta_value) as sales
224 224
 				FROM $wpdb->postmeta WHERE meta_key='_give_form_sales' AND meta_value > 0
225 225
 				GROUP BY meta_value+0
226 226
 				DESC LIMIT %d;", $number
227
-		) );
227
+		));
228 228
 
229 229
 		return $give_forms;
230 230
 	}
Please login to merge, or discard this patch.
includes/class-give-cron.php 1 patch
Spacing   +9 added lines, -9 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
 
@@ -29,8 +29,8 @@  discard block
 block discarded – undo
29 29
 	 * @see   Give_Cron::weekly_events()
30 30
 	 */
31 31
 	public function __construct() {
32
-		add_filter( 'cron_schedules', array( $this, 'add_schedules' ) );
33
-		add_action( 'wp', array( $this, 'schedule_Events' ) );
32
+		add_filter('cron_schedules', array($this, 'add_schedules'));
33
+		add_action('wp', array($this, 'schedule_Events'));
34 34
 	}
35 35
 
36 36
 	/**
@@ -42,11 +42,11 @@  discard block
 block discarded – undo
42 42
 	 *
43 43
 	 * @return array
44 44
 	 */
45
-	public function add_schedules( $schedules = array() ) {
45
+	public function add_schedules($schedules = array()) {
46 46
 		// Adds once weekly to the existing schedules.
47 47
 		$schedules['weekly'] = array(
48 48
 			'interval' => 604800,
49
-			'display'  => __( 'Once Weekly', 'easy-digital-downloads' )
49
+			'display'  => __('Once Weekly', 'easy-digital-downloads')
50 50
 		);
51 51
 
52 52
 		return $schedules;
@@ -72,8 +72,8 @@  discard block
 block discarded – undo
72 72
 	 * @return void
73 73
 	 */
74 74
 	private function weekly_events() {
75
-		if ( ! wp_next_scheduled( 'give_weekly_scheduled_events' ) ) {
76
-			wp_schedule_event( current_time( 'timestamp' ), 'weekly', 'give_weekly_scheduled_events' );
75
+		if ( ! wp_next_scheduled('give_weekly_scheduled_events')) {
76
+			wp_schedule_event(current_time('timestamp'), 'weekly', 'give_weekly_scheduled_events');
77 77
 		}
78 78
 	}
79 79
 
@@ -85,8 +85,8 @@  discard block
 block discarded – undo
85 85
 	 * @return void
86 86
 	 */
87 87
 	private function daily_events() {
88
-		if ( ! wp_next_scheduled( 'give_daily_scheduled_events' ) ) {
89
-			wp_schedule_event( current_time( 'timestamp' ), 'daily', 'give_daily_scheduled_events' );
88
+		if ( ! wp_next_scheduled('give_daily_scheduled_events')) {
89
+			wp_schedule_event(current_time('timestamp'), 'daily', 'give_daily_scheduled_events');
90 90
 		}
91 91
 	}
92 92
 
Please login to merge, or discard this patch.
includes/admin/upgrades/upgrade-functions.php 2 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Upgrade Functions
4
- *
5
- * @package     Give
6
- * @subpackage  Admin/Upgrades
7
- * @copyright   Copyright (c) 2015, WordImpress
8
- * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
9
- * @since       1.0
10
- *
11
- * NOTICE: When adding new upgrade notices, please be sure to put the action into the upgrades array during install: /includes/install.php @ Appox Line 156
12
- *
13
- */
3
+	 * Upgrade Functions
4
+	 *
5
+	 * @package     Give
6
+	 * @subpackage  Admin/Upgrades
7
+	 * @copyright   Copyright (c) 2015, WordImpress
8
+	 * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
9
+	 * @since       1.0
10
+	 *
11
+	 * NOTICE: When adding new upgrade notices, please be sure to put the action into the upgrades array during install: /includes/install.php @ Appox Line 156
12
+	 *
13
+	 */
14 14
 
15 15
 // Exit if accessed directly
16 16
 if ( ! defined( 'ABSPATH' ) ) {
Please login to merge, or discard this patch.
Spacing   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
  */
14 14
 
15 15
 // Exit if accessed directly
16
-if ( ! defined( 'ABSPATH' ) ) {
16
+if ( ! defined('ABSPATH')) {
17 17
 	exit;
18 18
 }
19 19
 
@@ -25,18 +25,18 @@  discard block
 block discarded – undo
25 25
  */
26 26
 function give_show_upgrade_notices() {
27 27
 
28
-	if ( isset( $_GET['page'] ) && $_GET['page'] == 'give-upgrades' ) {
28
+	if (isset($_GET['page']) && $_GET['page'] == 'give-upgrades') {
29 29
 		return;
30 30
 	} // Don't show notices on the upgrades page
31 31
 
32
-	$give_version = get_option( 'give_version' );
32
+	$give_version = get_option('give_version');
33 33
 
34
-	if ( ! $give_version ) {
34
+	if ( ! $give_version) {
35 35
 		// 1.0 is the first version to use this option so we must add it
36 36
 		$give_version = '1.0';
37 37
 	}
38 38
 
39
-	$give_version = preg_replace( '/[^0-9.].*/', '', $give_version );
39
+	$give_version = preg_replace('/[^0-9.].*/', '', $give_version);
40 40
 
41 41
 	/*
42 42
 	 *  NOTICE:
@@ -47,18 +47,18 @@  discard block
 block discarded – undo
47 47
 	 */
48 48
 
49 49
 	//v1.3.2 Upgrades
50
-	if ( version_compare( $give_version, '1.3.2', '<' ) || ! give_has_upgrade_completed( 'upgrade_give_payment_customer_id' ) ) {
50
+	if (version_compare($give_version, '1.3.2', '<') || ! give_has_upgrade_completed('upgrade_give_payment_customer_id')) {
51 51
 		printf(
52
-			'<div class="updated"><p>' . __( 'Give needs to upgrade the donor database, click <a href="%s">here</a> to start the upgrade.', 'give' ) . '</p></div>',
53
-			esc_url( admin_url( 'index.php?page=give-upgrades&give-upgrade=upgrade_give_payment_customer_id' ) )
52
+			'<div class="updated"><p>'.__('Give needs to upgrade the donor database, click <a href="%s">here</a> to start the upgrade.', 'give').'</p></div>',
53
+			esc_url(admin_url('index.php?page=give-upgrades&give-upgrade=upgrade_give_payment_customer_id'))
54 54
 		);
55 55
 	}
56 56
 
57 57
 	//v1.3.4 Upgrades //ensure the user has gone through 1.3.4
58
-	if ( version_compare( $give_version, '1.3.4', '<' ) || ( ! give_has_upgrade_completed( 'upgrade_give_offline_status' ) && give_has_upgrade_completed( 'upgrade_give_payment_customer_id' ) ) ) {
58
+	if (version_compare($give_version, '1.3.4', '<') || ( ! give_has_upgrade_completed('upgrade_give_offline_status') && give_has_upgrade_completed('upgrade_give_payment_customer_id'))) {
59 59
 		printf(
60
-			'<div class="updated"><p>' . __( 'Give needs to upgrade the transaction database, click <a href="%s">here</a> to start the upgrade.', 'give' ) . '</p></div>',
61
-			esc_url( admin_url( 'index.php?page=give-upgrades&give-upgrade=upgrade_give_offline_status' ) )
60
+			'<div class="updated"><p>'.__('Give needs to upgrade the transaction database, click <a href="%s">here</a> to start the upgrade.', 'give').'</p></div>',
61
+			esc_url(admin_url('index.php?page=give-upgrades&give-upgrade=upgrade_give_offline_status'))
62 62
 		);
63 63
 	}
64 64
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 
69 69
 }
70 70
 
71
-add_action( 'admin_notices', 'give_show_upgrade_notices' );
71
+add_action('admin_notices', 'give_show_upgrade_notices');
72 72
 
73 73
 /**
74 74
  * Triggers all upgrade functions
@@ -80,26 +80,26 @@  discard block
 block discarded – undo
80 80
  */
81 81
 function give_trigger_upgrades() {
82 82
 
83
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
84
-		wp_die( __( 'You do not have permission to do Give upgrades', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
83
+	if ( ! current_user_can('manage_give_settings')) {
84
+		wp_die(__('You do not have permission to do Give upgrades', 'give'), __('Error', 'give'), array('response' => 403));
85 85
 	}
86 86
 
87
-	$give_version = get_option( 'give_version' );
87
+	$give_version = get_option('give_version');
88 88
 
89
-	if ( ! $give_version ) {
89
+	if ( ! $give_version) {
90 90
 		// 1.0 is the first version to use this option so we must add it
91 91
 		$give_version = '1.0';
92
-		add_option( 'give_version', $give_version );
92
+		add_option('give_version', $give_version);
93 93
 	}
94 94
 
95
-	update_option( 'give_version', GIVE_VERSION );
95
+	update_option('give_version', GIVE_VERSION);
96 96
 
97
-	if ( DOING_AJAX ) {
98
-		die( 'complete' );
97
+	if (DOING_AJAX) {
98
+		die('complete');
99 99
 	} // Let AJAX know that the upgrade is complete
100 100
 }
101 101
 
102
-add_action( 'wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades' );
102
+add_action('wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades');
103 103
 
104 104
 /**
105 105
  * Check if the upgrade routine has been run for a specific action
@@ -110,15 +110,15 @@  discard block
 block discarded – undo
110 110
  *
111 111
  * @return bool                   If the action has been added to the completed actions array
112 112
  */
113
-function give_has_upgrade_completed( $upgrade_action = '' ) {
113
+function give_has_upgrade_completed($upgrade_action = '') {
114 114
 
115
-	if ( empty( $upgrade_action ) ) {
115
+	if (empty($upgrade_action)) {
116 116
 		return false;
117 117
 	}
118 118
 
119 119
 	$completed_upgrades = give_get_completed_upgrades();
120 120
 
121
-	return in_array( $upgrade_action, $completed_upgrades );
121
+	return in_array($upgrade_action, $completed_upgrades);
122 122
 
123 123
 }
124 124
 
@@ -131,9 +131,9 @@  discard block
 block discarded – undo
131 131
  *
132 132
  * @return bool                   If the function was successfully added
133 133
  */
134
-function give_set_upgrade_complete( $upgrade_action = '' ) {
134
+function give_set_upgrade_complete($upgrade_action = '') {
135 135
 
136
-	if ( empty( $upgrade_action ) ) {
136
+	if (empty($upgrade_action)) {
137 137
 		return false;
138 138
 	}
139 139
 
@@ -141,9 +141,9 @@  discard block
 block discarded – undo
141 141
 	$completed_upgrades[] = $upgrade_action;
142 142
 
143 143
 	// Remove any blanks, and only show uniques
144
-	$completed_upgrades = array_unique( array_values( $completed_upgrades ) );
144
+	$completed_upgrades = array_unique(array_values($completed_upgrades));
145 145
 
146
-	return update_option( 'give_completed_upgrades', $completed_upgrades );
146
+	return update_option('give_completed_upgrades', $completed_upgrades);
147 147
 }
148 148
 
149 149
 /**
@@ -154,9 +154,9 @@  discard block
 block discarded – undo
154 154
  */
155 155
 function give_get_completed_upgrades() {
156 156
 
157
-	$completed_upgrades = get_option( 'give_completed_upgrades' );
157
+	$completed_upgrades = get_option('give_completed_upgrades');
158 158
 
159
-	if ( false === $completed_upgrades ) {
159
+	if (false === $completed_upgrades) {
160 160
 		$completed_upgrades = array();
161 161
 	}
162 162
 
@@ -175,30 +175,30 @@  discard block
 block discarded – undo
175 175
  */
176 176
 function give_v132_upgrade_give_payment_customer_id() {
177 177
 	global $wpdb;
178
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
179
-		wp_die( __( 'You do not have permission to do Give upgrades', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
178
+	if ( ! current_user_can('manage_give_settings')) {
179
+		wp_die(__('You do not have permission to do Give upgrades', 'give'), __('Error', 'give'), array('response' => 403));
180 180
 	}
181 181
 
182
-	ignore_user_abort( true );
182
+	ignore_user_abort(true);
183 183
 
184
-	if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
185
-		@set_time_limit( 0 );
184
+	if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
185
+		@set_time_limit(0);
186 186
 	}
187 187
 
188 188
 	//UPDATE DB METAKEYS
189 189
 	$sql   = "UPDATE $wpdb->postmeta SET meta_key = '_give_payment_customer_id' WHERE meta_key = '_give_payment_donor_id'";
190
-	$query = $wpdb->query( $sql );
190
+	$query = $wpdb->query($sql);
191 191
 
192
-	update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
193
-	give_set_upgrade_complete( 'upgrade_give_payment_customer_id' );
194
-	delete_option( 'give_doing_upgrade' );
195
-	wp_redirect( admin_url() );
192
+	update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
193
+	give_set_upgrade_complete('upgrade_give_payment_customer_id');
194
+	delete_option('give_doing_upgrade');
195
+	wp_redirect(admin_url());
196 196
 	exit;
197 197
 
198 198
 
199 199
 }
200 200
 
201
-add_action( 'give_upgrade_give_payment_customer_id', 'give_v132_upgrade_give_payment_customer_id' );
201
+add_action('give_upgrade_give_payment_customer_id', 'give_v132_upgrade_give_payment_customer_id');
202 202
 
203 203
 /**
204 204
  * Upgrades the Offline Status
@@ -212,14 +212,14 @@  discard block
 block discarded – undo
212 212
 
213 213
 	global $wpdb;
214 214
 
215
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
216
-		wp_die( __( 'You do not have permission to do Give upgrades', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
215
+	if ( ! current_user_can('manage_give_settings')) {
216
+		wp_die(__('You do not have permission to do Give upgrades', 'give'), __('Error', 'give'), array('response' => 403));
217 217
 	}
218 218
 
219
-	ignore_user_abort( true );
219
+	ignore_user_abort(true);
220 220
 
221
-	if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
222
-		@set_time_limit( 0 );
221
+	if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
222
+		@set_time_limit(0);
223 223
 	}
224 224
 
225 225
 	// Get abandoned offline payments
@@ -229,32 +229,32 @@  discard block
 block discarded – undo
229 229
 	$where .= "AND ( p.post_status = 'abandoned' )";
230 230
 	$where .= "AND ( m.meta_key = '_give_payment_gateway' AND m.meta_value = 'offline' )";
231 231
 
232
-	$sql            = $select . $join . $where;
233
-	$found_payments = $wpdb->get_col( $sql );
232
+	$sql            = $select.$join.$where;
233
+	$found_payments = $wpdb->get_col($sql);
234 234
 
235 235
 
236
-	foreach ( $found_payments as $payment ) {
236
+	foreach ($found_payments as $payment) {
237 237
 
238 238
 		//Only change ones marked abandoned since our release last week
239 239
 		//because the admin may have marked some abandoned themselves
240
-		$modified_time = get_post_modified_time( 'U', false, $payment );
240
+		$modified_time = get_post_modified_time('U', false, $payment);
241 241
 
242 242
 		//1450124863 =  12/10/2015 20:42:25
243
-		if ( $modified_time >= 1450124863 ) {
243
+		if ($modified_time >= 1450124863) {
244 244
 
245
-			give_update_payment_status( $payment, 'pending' );
245
+			give_update_payment_status($payment, 'pending');
246 246
 
247 247
 		}
248 248
 
249 249
 	}
250 250
 
251
-	update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
252
-	give_set_upgrade_complete( 'upgrade_give_offline_status' );
253
-	delete_option( 'give_doing_upgrade' );
254
-	wp_redirect( admin_url() );
251
+	update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
252
+	give_set_upgrade_complete('upgrade_give_offline_status');
253
+	delete_option('give_doing_upgrade');
254
+	wp_redirect(admin_url());
255 255
 	exit;
256 256
 
257 257
 
258 258
 }
259 259
 
260
-add_action( 'give_upgrade_give_offline_status', 'give_v134_upgrade_give_offline_status' );
260
+add_action('give_upgrade_give_offline_status', 'give_v134_upgrade_give_offline_status');
Please login to merge, or discard this patch.
includes/gateways/offline-donations.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Offline Donations Gateway
4
- *
5
- * @package     Give
6
- * @subpackage  Gateways
7
- * @copyright   Copyright (c) 2015, WordImpress
8
- * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
9
- * @since       1.0
10
- */
3
+	 * Offline Donations Gateway
4
+	 *
5
+	 * @package     Give
6
+	 * @subpackage  Gateways
7
+	 * @copyright   Copyright (c) 2015, WordImpress
8
+	 * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
9
+	 * @since       1.0
10
+	 */
11 11
 
12 12
 /**
13 13
  * Register the payment gateway
Please login to merge, or discard this patch.
Spacing   +117 added lines, -117 removed lines patch added patch discarded remove patch
@@ -18,17 +18,17 @@  discard block
 block discarded – undo
18 18
  *
19 19
  * @return array
20 20
  */
21
-function give_offline_register_gateway( $gateways ) {
21
+function give_offline_register_gateway($gateways) {
22 22
 	// Format: ID => Name
23 23
 	$gateways['offline'] = array(
24
-		'admin_label'    => esc_attr__( 'Offline Donation', 'give' ),
25
-		'checkout_label' => esc_attr__( 'Offline Donation', 'give' )
24
+		'admin_label'    => esc_attr__('Offline Donation', 'give'),
25
+		'checkout_label' => esc_attr__('Offline Donation', 'give')
26 26
 	);
27 27
 
28 28
 	return $gateways;
29 29
 }
30 30
 
31
-add_filter( 'give_payment_gateways', 'give_offline_register_gateway', 1 );
31
+add_filter('give_payment_gateways', 'give_offline_register_gateway', 1);
32 32
 
33 33
 
34 34
 /**
@@ -40,47 +40,47 @@  discard block
 block discarded – undo
40 40
  *
41 41
  * @return void
42 42
  */
43
-function give_offline_payment_cc_form( $form_id ) {
43
+function give_offline_payment_cc_form($form_id) {
44 44
 
45
-	$post_offline_customization_option = get_post_meta( $form_id, '_give_customize_offline_donations', true );
46
-	$post_offline_instructions         = get_post_meta( $form_id, '_give_offline_checkout_notes', true );
47
-	$global_offline_instruction        = give_get_option( 'global_offline_donation_content' );
45
+	$post_offline_customization_option = get_post_meta($form_id, '_give_customize_offline_donations', true);
46
+	$post_offline_instructions         = get_post_meta($form_id, '_give_offline_checkout_notes', true);
47
+	$global_offline_instruction        = give_get_option('global_offline_donation_content');
48 48
 	$offline_instructions              = $global_offline_instruction;
49 49
 
50
-	if ( $post_offline_customization_option == 'yes' ) {
50
+	if ($post_offline_customization_option == 'yes') {
51 51
 		$offline_instructions = $post_offline_instructions;
52 52
 	}
53 53
 
54 54
 
55 55
 	ob_start(); ?>
56
-	<?php do_action( 'give_before_offline_info_fields', $form_id ); ?>
56
+	<?php do_action('give_before_offline_info_fields', $form_id); ?>
57 57
 	<fieldset id="give_offline_payment_info">
58 58
 		<?php
59
-		$settings_url         = admin_url( 'post.php?post=' . $form_id . '&action=edit&message=1' );
60
-		$offline_instructions = ! empty( $offline_instructions ) ? $offline_instructions : sprintf( esc_attr__( 'Please enter offline donation instructions in the %s.', 'give' ), '<a href="' . $settings_url . '">' . __( 'this form\'s settings', 'give' ) . '</a>' );
61
-		echo wpautop( stripslashes( $offline_instructions ) );
59
+		$settings_url         = admin_url('post.php?post='.$form_id.'&action=edit&message=1');
60
+		$offline_instructions = ! empty($offline_instructions) ? $offline_instructions : sprintf(esc_attr__('Please enter offline donation instructions in the %s.', 'give'), '<a href="'.$settings_url.'">'.__('this form\'s settings', 'give').'</a>');
61
+		echo wpautop(stripslashes($offline_instructions));
62 62
 		?>
63 63
 	</fieldset>
64
-	<?php do_action( 'give_after_offline_info_fields', $form_id ); ?>
64
+	<?php do_action('give_after_offline_info_fields', $form_id); ?>
65 65
 	<?php
66 66
 	echo ob_get_clean();
67 67
 }
68 68
 
69
-add_action( 'give_offline_cc_form', 'give_offline_payment_cc_form' );
69
+add_action('give_offline_cc_form', 'give_offline_payment_cc_form');
70 70
 
71 71
 
72
-function give_offline_billing_fields( $form_id ) {
72
+function give_offline_billing_fields($form_id) {
73 73
 	//Enable Default CC fields (billing info)
74
-	$post_offline_cc_fields   = get_post_meta( $form_id, '_give_offline_donation_enable_billing_fields_single', true );
75
-	$global_offline_cc_fields = give_get_option( 'give_offline_donation_enable_billing_fields' );
74
+	$post_offline_cc_fields   = get_post_meta($form_id, '_give_offline_donation_enable_billing_fields_single', true);
75
+	$global_offline_cc_fields = give_get_option('give_offline_donation_enable_billing_fields');
76 76
 
77 77
 
78
-	if ( $global_offline_cc_fields == 'on' || $post_offline_cc_fields == 'on' ) {
79
-		give_default_cc_address_fields( $form_id );
78
+	if ($global_offline_cc_fields == 'on' || $post_offline_cc_fields == 'on') {
79
+		give_default_cc_address_fields($form_id);
80 80
 	}
81 81
 }
82 82
 
83
-add_action( 'give_before_offline_info_fields', 'give_offline_billing_fields', 10, 1 );
83
+add_action('give_before_offline_info_fields', 'give_offline_billing_fields', 10, 1);
84 84
 
85 85
 /**
86 86
  * Process the payment
@@ -91,15 +91,15 @@  discard block
 block discarded – undo
91 91
  *
92 92
  * @return void
93 93
  */
94
-function give_offline_process_payment( $purchase_data ) {
94
+function give_offline_process_payment($purchase_data) {
95 95
 
96
-	$purchase_summary = give_get_purchase_summary( $purchase_data );
96
+	$purchase_summary = give_get_purchase_summary($purchase_data);
97 97
 
98 98
 	// setup the payment details
99 99
 	$payment_data = array(
100 100
 		'price'           => $purchase_data['price'],
101 101
 		'give_form_title' => $purchase_data['post_data']['give-form-title'],
102
-		'give_form_id'    => intval( $purchase_data['post_data']['give-form-id'] ),
102
+		'give_form_id'    => intval($purchase_data['post_data']['give-form-id']),
103 103
 		'date'            => $purchase_data['date'],
104 104
 		'user_email'      => $purchase_data['user_email'],
105 105
 		'purchase_key'    => $purchase_data['purchase_key'],
@@ -111,20 +111,20 @@  discard block
 block discarded – undo
111 111
 
112 112
 
113 113
 	// record the pending payment
114
-	$payment = give_insert_payment( $payment_data );
114
+	$payment = give_insert_payment($payment_data);
115 115
 
116
-	if ( $payment ) {
117
-		give_offline_send_admin_notice( $payment );
118
-		give_offline_send_donor_instructions( $payment );
116
+	if ($payment) {
117
+		give_offline_send_admin_notice($payment);
118
+		give_offline_send_donor_instructions($payment);
119 119
 		give_send_to_success_page();
120 120
 	} else {
121 121
 		// if errors are present, send the user back to the donation form so they can be corrected
122
-		give_send_back_to_checkout( '?payment-mode=' . $purchase_data['post_data']['give-gateway'] );
122
+		give_send_back_to_checkout('?payment-mode='.$purchase_data['post_data']['give-gateway']);
123 123
 	}
124 124
 
125 125
 }
126 126
 
127
-add_action( 'give_gateway_offline', 'give_offline_process_payment' );
127
+add_action('give_gateway_offline', 'give_offline_process_payment');
128 128
 
129 129
 
130 130
 /**
@@ -137,47 +137,47 @@  discard block
 block discarded – undo
137 137
  * @since       1.0
138 138
  * @return void
139 139
  */
140
-function give_offline_send_donor_instructions( $payment_id = 0 ) {
140
+function give_offline_send_donor_instructions($payment_id = 0) {
141 141
 
142
-	$payment_data                      = give_get_payment_meta( $payment_id );
143
-	$post_offline_customization_option = get_post_meta( $payment_data['form_id'], '_give_customize_offline_donations', true );
142
+	$payment_data                      = give_get_payment_meta($payment_id);
143
+	$post_offline_customization_option = get_post_meta($payment_data['form_id'], '_give_customize_offline_donations', true);
144 144
 
145 145
 	//Customize email content depending on whether the single form has been customized
146
-	$email_content = give_get_option( 'global_offline_donation_email' );
146
+	$email_content = give_get_option('global_offline_donation_email');
147 147
 
148
-	if ( $post_offline_customization_option === 'yes' ) {
149
-		$email_content = get_post_meta( $payment_data['form_id'], '_give_offline_donation_email', true );
148
+	if ($post_offline_customization_option === 'yes') {
149
+		$email_content = get_post_meta($payment_data['form_id'], '_give_offline_donation_email', true);
150 150
 	}
151 151
 
152
-	$from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) );
153
-	$from_name = apply_filters( 'give_purchase_from_name', $from_name, $payment_id, $payment_data );
152
+	$from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES));
153
+	$from_name = apply_filters('give_purchase_from_name', $from_name, $payment_id, $payment_data);
154 154
 
155
-	$from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) );
156
-	$from_email = apply_filters( 'give_purchase_from_address', $from_email, $payment_id, $payment_data );
155
+	$from_email = give_get_option('from_email', get_bloginfo('admin_email'));
156
+	$from_email = apply_filters('give_purchase_from_address', $from_email, $payment_id, $payment_data);
157 157
 
158
-	$to_email = give_get_payment_user_email( $payment_id );
158
+	$to_email = give_get_payment_user_email($payment_id);
159 159
 
160
-	$subject = give_get_option( 'offline_donation_subject', __( 'Offline Donation Instructions', 'give' ) );
161
-	if ( $post_offline_customization_option === 'yes' ) {
162
-		$subject = get_post_meta( $payment_data['form_id'], '_give_offline_donation_subject', true );
160
+	$subject = give_get_option('offline_donation_subject', __('Offline Donation Instructions', 'give'));
161
+	if ($post_offline_customization_option === 'yes') {
162
+		$subject = get_post_meta($payment_data['form_id'], '_give_offline_donation_subject', true);
163 163
 	}
164 164
 
165
-	$subject = apply_filters( 'give_offline_donation_subject', wp_strip_all_tags( $subject ), $payment_id );
166
-	$subject = give_do_email_tags( $subject, $payment_id );
165
+	$subject = apply_filters('give_offline_donation_subject', wp_strip_all_tags($subject), $payment_id);
166
+	$subject = give_do_email_tags($subject, $payment_id);
167 167
 
168
-	$attachments = apply_filters( 'give_offline_donation_attachments', array(), $payment_id, $payment_data );
169
-	$message     = give_do_email_tags( $email_content, $payment_id );
168
+	$attachments = apply_filters('give_offline_donation_attachments', array(), $payment_id, $payment_data);
169
+	$message     = give_do_email_tags($email_content, $payment_id);
170 170
 
171 171
 	$emails = Give()->emails;
172 172
 
173
-	$emails->__set( 'from_name', $from_name );
174
-	$emails->__set( 'from_email', $from_email );
175
-	$emails->__set( 'heading', __( 'Offline Donation Instructions', 'give' ) );
173
+	$emails->__set('from_name', $from_name);
174
+	$emails->__set('from_email', $from_email);
175
+	$emails->__set('heading', __('Offline Donation Instructions', 'give'));
176 176
 
177
-	$headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data );
178
-	$emails->__set( 'headers', $headers );
177
+	$headers = apply_filters('give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data);
178
+	$emails->__set('headers', $headers);
179 179
 
180
-	$emails->send( $to_email, $subject, $message, $attachments );
180
+	$emails->send($to_email, $subject, $message, $attachments);
181 181
 
182 182
 }
183 183
 
@@ -194,48 +194,48 @@  discard block
 block discarded – undo
194 194
  * @return void
195 195
  *
196 196
  */
197
-function give_offline_send_admin_notice( $payment_id = 0 ) {
197
+function give_offline_send_admin_notice($payment_id = 0) {
198 198
 
199 199
 	/* Send an email notification to the admin */
200 200
 	$admin_email = give_get_admin_notice_emails();
201
-	$user_info   = give_get_payment_meta_user_info( $payment_id );
201
+	$user_info   = give_get_payment_meta_user_info($payment_id);
202 202
 
203
-	if ( isset( $user_info['id'] ) && $user_info['id'] > 0 ) {
204
-		$user_data = get_userdata( $user_info['id'] );
203
+	if (isset($user_info['id']) && $user_info['id'] > 0) {
204
+		$user_data = get_userdata($user_info['id']);
205 205
 		$name      = $user_data->display_name;
206
-	} elseif ( isset( $user_info['first_name'] ) && isset( $user_info['last_name'] ) ) {
207
-		$name = $user_info['first_name'] . ' ' . $user_info['last_name'];
206
+	} elseif (isset($user_info['first_name']) && isset($user_info['last_name'])) {
207
+		$name = $user_info['first_name'].' '.$user_info['last_name'];
208 208
 	} else {
209 209
 		$name = $user_info['email'];
210 210
 	}
211 211
 
212
-	$amount = give_currency_filter( give_format_amount( give_get_payment_amount( $payment_id ) ) );
212
+	$amount = give_currency_filter(give_format_amount(give_get_payment_amount($payment_id)));
213 213
 
214
-	$admin_subject = apply_filters( 'give_offline_admin_donation_notification_subject', esc_attr__( 'New Pending Donation', 'give' ), $payment_id );
214
+	$admin_subject = apply_filters('give_offline_admin_donation_notification_subject', esc_attr__('New Pending Donation', 'give'), $payment_id);
215 215
 
216
-	$admin_message = esc_attr__( 'Dear Admin,', 'give' ) . "\n\n";
217
-	$admin_message .= esc_attr__( 'An offline donation has been made on your website: ', 'give' ) . get_bloginfo( 'name' ) . ' ';
218
-	$admin_message .= esc_attr__( 'Hooray! The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give' ) . "\n\n";
216
+	$admin_message = esc_attr__('Dear Admin,', 'give')."\n\n";
217
+	$admin_message .= esc_attr__('An offline donation has been made on your website: ', 'give').get_bloginfo('name').' ';
218
+	$admin_message .= esc_attr__('Hooray! The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give')."\n\n";
219 219
 
220 220
 
221
-	$admin_message .= '<strong>' . esc_attr__( 'Donor: ', 'give' ) . '</strong>' . html_entity_decode( $name, ENT_COMPAT, 'UTF-8' ) . "\n";
222
-	$admin_message .= '<strong>' . esc_attr__( 'Amount: ', 'give' ) . '</strong>' . html_entity_decode( $amount, ENT_COMPAT, 'UTF-8' ) . "\n\n";
221
+	$admin_message .= '<strong>'.esc_attr__('Donor: ', 'give').'</strong>'.html_entity_decode($name, ENT_COMPAT, 'UTF-8')."\n";
222
+	$admin_message .= '<strong>'.esc_attr__('Amount: ', 'give').'</strong>'.html_entity_decode($amount, ENT_COMPAT, 'UTF-8')."\n\n";
223 223
 
224 224
 	//Order URL
225
-	$order_url = '<a href="' . admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $payment_id ) . '">';
226
-	$admin_message .= sprintf( __( '%sClick Here to View and/or Update Donation Details%s', 'give' ), $order_url, ' &raquo;</a>' ) . "\n\n";
225
+	$order_url = '<a href="'.admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id='.$payment_id).'">';
226
+	$admin_message .= sprintf(__('%sClick Here to View and/or Update Donation Details%s', 'give'), $order_url, ' &raquo;</a>')."\n\n";
227 227
 
228
-	$admin_message = apply_filters( 'give_offline_admin_donation_notification', $admin_message, $payment_id );
229
-	$attachments   = apply_filters( 'give_offline_admin_donation_notification_attachments', array(), $payment_id );
230
-	$admin_headers = apply_filters( 'give_offline_admin_donation_notification_headers', array(), $payment_id );
228
+	$admin_message = apply_filters('give_offline_admin_donation_notification', $admin_message, $payment_id);
229
+	$attachments   = apply_filters('give_offline_admin_donation_notification_attachments', array(), $payment_id);
230
+	$admin_headers = apply_filters('give_offline_admin_donation_notification_headers', array(), $payment_id);
231 231
 
232 232
 	//Send Email
233 233
 	$emails = Give()->emails;
234
-	if ( ! empty( $admin_headers ) ) {
235
-		$emails->__set( 'headers', $admin_headers );
234
+	if ( ! empty($admin_headers)) {
235
+		$emails->__set('headers', $admin_headers);
236 236
 	}
237 237
 
238
-	$emails->send( $admin_email, $admin_subject, $admin_message, $attachments );
238
+	$emails->send($admin_email, $admin_subject, $admin_message, $attachments);
239 239
 
240 240
 }
241 241
 
@@ -246,15 +246,15 @@  discard block
 block discarded – undo
246 246
  * @since  1.0
247 247
  * @return array
248 248
  */
249
-function give_offline_add_settings( $settings ) {
249
+function give_offline_add_settings($settings) {
250 250
 
251 251
 	//Vars
252 252
 	$prefix = '_give_';
253 253
 
254
-	$is_gateway_active = give_is_gateway_active( 'offline' );
254
+	$is_gateway_active = give_is_gateway_active('offline');
255 255
 
256 256
 	//this gateway isn't active
257
-	if ( ! $is_gateway_active ) {
257
+	if ( ! $is_gateway_active) {
258 258
 		//return settings and bounce
259 259
 		return $settings;
260 260
 	}
@@ -263,27 +263,27 @@  discard block
 block discarded – undo
263 263
 	$check_settings = array(
264 264
 
265 265
 		array(
266
-			'name'    => esc_attr__( 'Customize Offline Donations', 'give' ),
267
-			'desc'    => esc_attr__( 'If you would like to customize the donation instructions for this specific forms check this option.', 'give' ),
268
-			'id'      => $prefix . 'customize_offline_donations',
266
+			'name'    => esc_attr__('Customize Offline Donations', 'give'),
267
+			'desc'    => esc_attr__('If you would like to customize the donation instructions for this specific forms check this option.', 'give'),
268
+			'id'      => $prefix.'customize_offline_donations',
269 269
 			'type'    => 'radio_inline',
270 270
 			'default' => 'no',
271 271
 			'options' => array(
272
-				'yes' => esc_attr__( 'Yes', 'give' ),
273
-				'no'  => esc_attr__( 'No', 'give' ),
272
+				'yes' => esc_attr__('Yes', 'give'),
273
+				'no'  => esc_attr__('No', 'give'),
274 274
 			),
275 275
 		),
276 276
 		array(
277
-			'name'        => esc_attr__( 'Request Billing Information', 'give' ),
278
-			'desc'        => esc_attr__( 'This option will enable the billing details section for this form\'s offline donation payment gateway. The fieldset will appear above the offline donation instructions.', 'give' ),
279
-			'id'          => $prefix . 'offline_donation_enable_billing_fields_single',
277
+			'name'        => esc_attr__('Request Billing Information', 'give'),
278
+			'desc'        => esc_attr__('This option will enable the billing details section for this form\'s offline donation payment gateway. The fieldset will appear above the offline donation instructions.', 'give'),
279
+			'id'          => $prefix.'offline_donation_enable_billing_fields_single',
280 280
 			'row_classes' => 'give-subfield',
281 281
 			'type'        => 'checkbox'
282 282
 		),
283 283
 		array(
284
-			'id'          => $prefix . 'offline_checkout_notes',
285
-			'name'        => esc_attr__( 'Offline Donation Instructions', 'give' ),
286
-			'desc'        => esc_attr__( 'Enter the instructions you want to display to the donor during the donation process. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ),
284
+			'id'          => $prefix.'offline_checkout_notes',
285
+			'name'        => esc_attr__('Offline Donation Instructions', 'give'),
286
+			'desc'        => esc_attr__('Enter the instructions you want to display to the donor during the donation process. Most likely this would include important information like mailing address and who to make the check out to.', 'give'),
287 287
 			'default'     => give_get_default_offline_donation_content(),
288 288
 			'type'        => 'wysiwyg',
289 289
 			'row_classes' => 'give-subfield',
@@ -292,17 +292,17 @@  discard block
 block discarded – undo
292 292
 			)
293 293
 		),
294 294
 		array(
295
-			'id'          => $prefix . 'offline_donation_subject',
296
-			'name'        => esc_attr__( 'Offline Donation Email Instructions Subject', 'give' ),
297
-			'desc'        => esc_attr__( 'Enter the subject line for the donation receipt email.', 'give' ),
298
-			'default'     => esc_attr__( '{donation} - Offline Donation Instructions', 'give' ),
295
+			'id'          => $prefix.'offline_donation_subject',
296
+			'name'        => esc_attr__('Offline Donation Email Instructions Subject', 'give'),
297
+			'desc'        => esc_attr__('Enter the subject line for the donation receipt email.', 'give'),
298
+			'default'     => esc_attr__('{donation} - Offline Donation Instructions', 'give'),
299 299
 			'row_classes' => 'give-subfield',
300 300
 			'type'        => 'text'
301 301
 		),
302 302
 		array(
303
-			'id'          => $prefix . 'offline_donation_email',
304
-			'name'        => esc_attr__( 'Offline Donation Email Instructions', 'give' ),
305
-			'desc'        => esc_attr__( 'Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ),
303
+			'id'          => $prefix.'offline_donation_email',
304
+			'name'        => esc_attr__('Offline Donation Email Instructions', 'give'),
305
+			'desc'        => esc_attr__('Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give'),
306 306
 			'default'     => give_get_default_offline_donation_email_content(),
307 307
 			'type'        => 'wysiwyg',
308 308
 			'row_classes' => 'give-subfield',
@@ -312,10 +312,10 @@  discard block
 block discarded – undo
312 312
 		)
313 313
 	);
314 314
 
315
-	return array_merge( $settings, $check_settings );
315
+	return array_merge($settings, $check_settings);
316 316
 }
317 317
 
318
-add_filter( 'give_forms_display_options_metabox_fields', 'give_offline_add_settings' );
318
+add_filter('give_forms_display_options_metabox_fields', 'give_offline_add_settings');
319 319
 
320 320
 
321 321
 /**
@@ -327,20 +327,20 @@  discard block
 block discarded – undo
327 327
  */
328 328
 function give_get_default_offline_donation_content() {
329 329
 
330
-	$sitename = get_bloginfo( 'sitename' );
330
+	$sitename = get_bloginfo('sitename');
331 331
 
332
-	$default_text = '<p>' . esc_attr__( 'In order to make an offline donation we ask that you please follow these instructions', 'give' ) . ': </p>';
332
+	$default_text = '<p>'.esc_attr__('In order to make an offline donation we ask that you please follow these instructions', 'give').': </p>';
333 333
 	$default_text .= '<ol>';
334
-	$default_text .= '<li>' . _x( 'Make a check payable to ', 'Step 1 for donating offline by check', 'give' ) . '"' . $sitename . '"' . '</li>';
335
-	$default_text .= '<li>' . _x( 'On the memo line of the check, please indicate that the donation is for ', 'Step 2 for donating by check; this explains who the check should be written to', 'give' ) . '"' . $sitename . '"' . '</li>';
336
-	$default_text .= '<li>' . _x( 'Please mail your check to:', 'Step 3; where to mail the check', 'give' ) . '</li>';
334
+	$default_text .= '<li>'._x('Make a check payable to ', 'Step 1 for donating offline by check', 'give').'"'.$sitename.'"'.'</li>';
335
+	$default_text .= '<li>'._x('On the memo line of the check, please indicate that the donation is for ', 'Step 2 for donating by check; this explains who the check should be written to', 'give').'"'.$sitename.'"'.'</li>';
336
+	$default_text .= '<li>'._x('Please mail your check to:', 'Step 3; where to mail the check', 'give').'</li>';
337 337
 	$default_text .= '</ol>';
338
-	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>' . $sitename . '</em><br>';
338
+	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>'.$sitename.'</em><br>';
339 339
 	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>123 G Street </em><br>';
340 340
 	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>San Diego, CA 92101 </em><br>';
341
-	$default_text .= '<p>' . esc_attr__( 'All contributions will be gratefully acknowledged and are tax deductible.', 'give' ) . '</p>';
341
+	$default_text .= '<p>'.esc_attr__('All contributions will be gratefully acknowledged and are tax deductible.', 'give').'</p>';
342 342
 
343
-	return apply_filters( 'give_default_offline_donation_content', $default_text );
343
+	return apply_filters('give_default_offline_donation_content', $default_text);
344 344
 
345 345
 }
346 346
 
@@ -353,21 +353,21 @@  discard block
 block discarded – undo
353 353
  */
354 354
 function give_get_default_offline_donation_email_content() {
355 355
 
356
-	$sitename     = get_bloginfo( 'sitename' );
357
-	$default_text = '<p>' . esc_attr__( 'Dear {name},', 'give' ) . '</p>';
358
-	$default_text .= '<p>' . esc_attr__( 'Thank you for your offline donation request! Your generosity is greatly appreciated. In order to make an offline donation we ask that you please follow these instructions', 'give' ) . ': </p>';
356
+	$sitename     = get_bloginfo('sitename');
357
+	$default_text = '<p>'.esc_attr__('Dear {name},', 'give').'</p>';
358
+	$default_text .= '<p>'.esc_attr__('Thank you for your offline donation request! Your generosity is greatly appreciated. In order to make an offline donation we ask that you please follow these instructions', 'give').': </p>';
359 359
 	$default_text .= '<ol>';
360
-	$default_text .= '<li>' . _x( 'Make a check payable to ', 'Step 1 for donating offline by check', 'give' ) . '"' . $sitename . '"' . '</li>';
361
-	$default_text .= '<li>' . _x( 'On the memo line of the check, please indicate that the donation is for ', 'Step 2 for donating by check; this explains who the check should be written to', 'give' ) . '"' . $sitename . '"' . '</li>';
362
-	$default_text .= '<li>' . _x( 'Please mail your check to:', 'Step 3; where to mail the check', 'give' ) . '</li>';
360
+	$default_text .= '<li>'._x('Make a check payable to ', 'Step 1 for donating offline by check', 'give').'"'.$sitename.'"'.'</li>';
361
+	$default_text .= '<li>'._x('On the memo line of the check, please indicate that the donation is for ', 'Step 2 for donating by check; this explains who the check should be written to', 'give').'"'.$sitename.'"'.'</li>';
362
+	$default_text .= '<li>'._x('Please mail your check to:', 'Step 3; where to mail the check', 'give').'</li>';
363 363
 	$default_text .= '</ol>';
364
-	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>' . $sitename . '</em><br>';
364
+	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>'.$sitename.'</em><br>';
365 365
 	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>123 G Street </em><br>';
366 366
 	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>San Diego, CA 92101 </em><br>';
367
-	$default_text .= '<p>' . esc_attr__( 'Once your donation has been received we will mark it as complete and you will receive an email receipt for your records. Please contact us with any questions you may have!', 'give' ) . '</p>';
368
-	$default_text .= '<p>' . esc_attr__( 'Sincerely,', 'give' ) . '</p>';
369
-	$default_text .= '<p>' . $sitename . '</p>';
367
+	$default_text .= '<p>'.esc_attr__('Once your donation has been received we will mark it as complete and you will receive an email receipt for your records. Please contact us with any questions you may have!', 'give').'</p>';
368
+	$default_text .= '<p>'.esc_attr__('Sincerely,', 'give').'</p>';
369
+	$default_text .= '<p>'.$sitename.'</p>';
370 370
 
371
-	return apply_filters( 'give_default_offline_donation_content', $default_text );
371
+	return apply_filters('give_default_offline_donation_content', $default_text);
372 372
 
373 373
 }
Please login to merge, or discard this patch.
includes/payments/actions.php 1 patch
Spacing   +72 added lines, -72 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
 
@@ -28,66 +28,66 @@  discard block
 block discarded – undo
28 28
  *
29 29
  * @return void
30 30
  */
31
-function give_complete_purchase( $payment_id, $new_status, $old_status ) {
32
-	if ( $old_status == 'publish' || $old_status == 'complete' ) {
31
+function give_complete_purchase($payment_id, $new_status, $old_status) {
32
+	if ($old_status == 'publish' || $old_status == 'complete') {
33 33
 		return;
34 34
 	} // Make sure that payments are only completed once
35 35
 
36 36
 	// Make sure the payment completion is only processed when new status is complete
37
-	if ( $new_status != 'publish' && $new_status != 'complete' ) {
37
+	if ($new_status != 'publish' && $new_status != 'complete') {
38 38
 		return;
39 39
 	}
40 40
 
41
-	$payment_meta   = give_get_payment_meta( $payment_id );
42
-	$creation_date  = get_post_field( 'post_date', $payment_id, 'raw' );
43
-	$completed_date = give_get_payment_completed_date( $payment_id );
44
-	$user_info      = give_get_payment_meta_user_info( $payment_id );
45
-	$donor_id       = give_get_payment_customer_id( $payment_id );
46
-	$amount         = give_get_payment_amount( $payment_id );
41
+	$payment_meta   = give_get_payment_meta($payment_id);
42
+	$creation_date  = get_post_field('post_date', $payment_id, 'raw');
43
+	$completed_date = give_get_payment_completed_date($payment_id);
44
+	$user_info      = give_get_payment_meta_user_info($payment_id);
45
+	$donor_id       = give_get_payment_customer_id($payment_id);
46
+	$amount         = give_get_payment_amount($payment_id);
47 47
 
48
-	do_action( 'give_pre_complete_purchase', $payment_id );
48
+	do_action('give_pre_complete_purchase', $payment_id);
49 49
 
50
-	$price_id = isset( $_POST['give-price-id'] ) ? (int) $_POST['give-price-id'] : false;
50
+	$price_id = isset($_POST['give-price-id']) ? (int) $_POST['give-price-id'] : false;
51 51
 
52 52
 	// Ensure these actions only run once, ever
53
-	if ( empty( $completed_date ) ) {
53
+	if (empty($completed_date)) {
54 54
 
55
-		if ( ! give_is_test_mode() || apply_filters( 'give_log_test_payment_stats', false ) ) {
55
+		if ( ! give_is_test_mode() || apply_filters('give_log_test_payment_stats', false)) {
56 56
 
57
-			give_record_sale_in_log( $payment_meta['form_id'], $payment_id, $price_id, $creation_date );
58
-			give_increase_purchase_count( $payment_meta['form_id'] );
59
-			give_increase_earnings( $payment_meta['form_id'], $amount );
57
+			give_record_sale_in_log($payment_meta['form_id'], $payment_id, $price_id, $creation_date);
58
+			give_increase_purchase_count($payment_meta['form_id']);
59
+			give_increase_earnings($payment_meta['form_id'], $amount);
60 60
 
61 61
 		}
62 62
 
63
-		do_action( 'give_complete_form_donation', $payment_meta['form_id'], $payment_id, $payment_meta );
63
+		do_action('give_complete_form_donation', $payment_meta['form_id'], $payment_id, $payment_meta);
64 64
 	}
65 65
 
66 66
 
67 67
 	// Clear the total earnings cache
68
-	delete_transient( 'give_earnings_total' );
68
+	delete_transient('give_earnings_total');
69 69
 	// Clear the This Month earnings (this_monththis_month is NOT a typo)
70
-	delete_transient( md5( 'give_earnings_this_monththis_month' ) );
71
-	delete_transient( md5( 'give_earnings_todaytoday' ) );
70
+	delete_transient(md5('give_earnings_this_monththis_month'));
71
+	delete_transient(md5('give_earnings_todaytoday'));
72 72
 
73 73
 
74 74
 	// Increase the donor's purchase stats
75
-	Give()->customers->increment_stats( $donor_id, $amount );
75
+	Give()->customers->increment_stats($donor_id, $amount);
76 76
 
77
-	give_increase_total_earnings( $amount );
77
+	give_increase_total_earnings($amount);
78 78
 
79 79
 	// Ensure this action only runs once ever
80
-	if ( empty( $completed_date ) ) {
80
+	if (empty($completed_date)) {
81 81
 
82 82
 		// Save the completed date
83
-		give_update_payment_meta( $payment_id, '_give_completed_date', current_time( 'mysql' ) );
83
+		give_update_payment_meta($payment_id, '_give_completed_date', current_time('mysql'));
84 84
 
85
-		do_action( 'give_complete_purchase', $payment_id );
85
+		do_action('give_complete_purchase', $payment_id);
86 86
 	}
87 87
 
88 88
 }
89 89
 
90
-add_action( 'give_update_payment_status', 'give_complete_purchase', 100, 3 );
90
+add_action('give_update_payment_status', 'give_complete_purchase', 100, 3);
91 91
 
92 92
 
93 93
 /**
@@ -101,19 +101,19 @@  discard block
 block discarded – undo
101 101
  *
102 102
  * @return void
103 103
  */
104
-function give_record_status_change( $payment_id, $new_status, $old_status ) {
104
+function give_record_status_change($payment_id, $new_status, $old_status) {
105 105
 
106 106
 	// Get the list of statuses so that status in the payment note can be translated
107 107
 	$stati      = give_get_payment_statuses();
108
-	$old_status = isset( $stati[ $old_status ] ) ? $stati[ $old_status ] : $old_status;
109
-	$new_status = isset( $stati[ $new_status ] ) ? $stati[ $new_status ] : $new_status;
108
+	$old_status = isset($stati[$old_status]) ? $stati[$old_status] : $old_status;
109
+	$new_status = isset($stati[$new_status]) ? $stati[$new_status] : $new_status;
110 110
 
111
-	$status_change = sprintf( __( 'Status changed from %s to %s', 'give' ), $old_status, $new_status );
111
+	$status_change = sprintf(__('Status changed from %s to %s', 'give'), $old_status, $new_status);
112 112
 
113
-	give_insert_payment_note( $payment_id, $status_change );
113
+	give_insert_payment_note($payment_id, $status_change);
114 114
 }
115 115
 
116
-add_action( 'give_update_payment_status', 'give_record_status_change', 100, 3 );
116
+add_action('give_update_payment_status', 'give_record_status_change', 100, 3);
117 117
 
118 118
 /**
119 119
  * Reduces earnings and donation stats when a donation is refunded
@@ -126,40 +126,40 @@  discard block
 block discarded – undo
126 126
  *
127 127
  * @return void
128 128
  */
129
-function give_undo_donation_on_refund( $payment_id, $new_status, $old_status ) {
129
+function give_undo_donation_on_refund($payment_id, $new_status, $old_status) {
130 130
 
131
-	if ( 'publish' != $old_status && 'revoked' != $old_status ) {
131
+	if ('publish' != $old_status && 'revoked' != $old_status) {
132 132
 		return;
133 133
 	}
134 134
 
135
-	if ( 'refunded' != $new_status ) {
135
+	if ('refunded' != $new_status) {
136 136
 		return;
137 137
 	}
138 138
 
139 139
 	// Set necessary vars
140
-	$payment_meta = give_get_payment_meta( $payment_id );
141
-	$amount       = give_get_payment_amount( $payment_id );
140
+	$payment_meta = give_get_payment_meta($payment_id);
141
+	$amount       = give_get_payment_amount($payment_id);
142 142
 
143 143
 	// Undo this purchase
144
-	give_undo_purchase( $payment_meta['form_id'], $payment_id );
144
+	give_undo_purchase($payment_meta['form_id'], $payment_id);
145 145
 
146 146
 	// Decrease total earnings
147
-	give_decrease_total_earnings( $amount );
147
+	give_decrease_total_earnings($amount);
148 148
 
149 149
 	// Decrement the stats for the donor
150
-	$donor_id = give_get_payment_customer_id( $payment_id );
150
+	$donor_id = give_get_payment_customer_id($payment_id);
151 151
 
152
-	if ( $donor_id ) {
152
+	if ($donor_id) {
153 153
 
154
-		Give()->customers->decrement_stats( $donor_id, $amount );
154
+		Give()->customers->decrement_stats($donor_id, $amount);
155 155
 
156 156
 	}
157 157
 
158 158
 	// Clear the This Month earnings (this_monththis_month is NOT a typo)
159
-	delete_transient( md5( 'give_earnings_this_monththis_month' ) );
159
+	delete_transient(md5('give_earnings_this_monththis_month'));
160 160
 }
161 161
 
162
-add_action( 'give_update_payment_status', 'give_undo_donation_on_refund', 100, 3 );
162
+add_action('give_update_payment_status', 'give_undo_donation_on_refund', 100, 3);
163 163
 
164 164
 
165 165
 /**
@@ -172,13 +172,13 @@  discard block
 block discarded – undo
172 172
  * @param $new_status the status of the payment, probably "publish"
173 173
  * @param $old_status the status of the payment prior to being marked as "complete", probably "pending"
174 174
  */
175
-function give_clear_user_history_cache( $payment_id, $new_status, $old_status ) {
176
-	$user_info = give_get_payment_meta_user_info( $payment_id );
175
+function give_clear_user_history_cache($payment_id, $new_status, $old_status) {
176
+	$user_info = give_get_payment_meta_user_info($payment_id);
177 177
 
178
-	delete_transient( 'give_user_' . $user_info['id'] . '_purchases' );
178
+	delete_transient('give_user_'.$user_info['id'].'_purchases');
179 179
 }
180 180
 
181
-add_action( 'give_update_payment_status', 'give_clear_user_history_cache', 10, 3 );
181
+add_action('give_update_payment_status', 'give_clear_user_history_cache', 10, 3);
182 182
 
183 183
 /**
184 184
  * Updates all old payments, prior to 1.2, with new
@@ -192,32 +192,32 @@  discard block
 block discarded – undo
192 192
  *
193 193
  * @return void
194 194
  */
195
-function give_update_old_payments_with_totals( $data ) {
196
-	if ( ! wp_verify_nonce( $data['_wpnonce'], 'give_upgrade_payments_nonce' ) ) {
195
+function give_update_old_payments_with_totals($data) {
196
+	if ( ! wp_verify_nonce($data['_wpnonce'], 'give_upgrade_payments_nonce')) {
197 197
 		return;
198 198
 	}
199 199
 
200
-	if ( get_option( 'give_payment_totals_upgraded' ) ) {
200
+	if (get_option('give_payment_totals_upgraded')) {
201 201
 		return;
202 202
 	}
203 203
 
204
-	$payments = give_get_payments( array(
204
+	$payments = give_get_payments(array(
205 205
 		'offset' => 0,
206
-		'number' => - 1,
206
+		'number' => -1,
207 207
 		'mode'   => 'all'
208
-	) );
208
+	));
209 209
 
210
-	if ( $payments ) {
211
-		foreach ( $payments as $payment ) {
212
-			$meta = give_get_payment_meta( $payment->ID );
213
-			give_update_payment_meta( $payment->ID, '_give_payment_total', $meta['amount'] );
210
+	if ($payments) {
211
+		foreach ($payments as $payment) {
212
+			$meta = give_get_payment_meta($payment->ID);
213
+			give_update_payment_meta($payment->ID, '_give_payment_total', $meta['amount']);
214 214
 		}
215 215
 	}
216 216
 
217
-	add_option( 'give_payment_totals_upgraded', 1 );
217
+	add_option('give_payment_totals_upgraded', 1);
218 218
 }
219 219
 
220
-add_action( 'give_upgrade_payments', 'give_update_old_payments_with_totals' );
220
+add_action('give_upgrade_payments', 'give_update_old_payments_with_totals');
221 221
 
222 222
 /**
223 223
  * Updates week-old+ 'pending' orders to 'abandoned'
@@ -226,29 +226,29 @@  discard block
 block discarded – undo
226 226
  * @return void
227 227
  */
228 228
 function give_mark_abandoned_donations() {
229
-	$args     = array(
229
+	$args = array(
230 230
 		'status' => 'pending',
231
-		'number' => - 1,
231
+		'number' => -1,
232 232
 		'fields' => 'ids'
233 233
 	);
234 234
 
235
-	add_filter( 'posts_where', 'give_filter_where_older_than_week' );
235
+	add_filter('posts_where', 'give_filter_where_older_than_week');
236 236
 
237
-	$payments = give_get_payments( $args );
237
+	$payments = give_get_payments($args);
238 238
 
239
-	remove_filter( 'posts_where', 'give_filter_where_older_than_week' );
239
+	remove_filter('posts_where', 'give_filter_where_older_than_week');
240 240
 
241
-	if ( $payments ) {
242
-		foreach ( $payments as $payment ) {
243
-			$gateway = give_get_payment_gateway( $payment );
241
+	if ($payments) {
242
+		foreach ($payments as $payment) {
243
+			$gateway = give_get_payment_gateway($payment);
244 244
 			//Skip offline gateway payments
245
-			if ( $gateway == 'offline' ) {
245
+			if ($gateway == 'offline') {
246 246
 				continue;
247 247
 			}
248 248
 			//Non-offline get marked as 'abandoned'
249
-			give_update_payment_status( $payment, 'abandoned' );
249
+			give_update_payment_status($payment, 'abandoned');
250 250
 		}
251 251
 	}
252 252
 }
253 253
 
254
-add_action( 'give_weekly_scheduled_events', 'give_mark_abandoned_donations' );
255 254
\ No newline at end of file
255
+add_action('give_weekly_scheduled_events', 'give_mark_abandoned_donations');
256 256
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/system-info.php 1 patch
Spacing   +138 added lines, -138 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
 
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
  */
25 25
 function give_system_info_callback() {
26 26
 
27
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
27
+	if ( ! current_user_can('manage_give_settings')) {
28 28
 		return;
29 29
 	}
30 30
 
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	<textarea readonly="readonly" onclick="this.focus(); this.select()" id="system-info-textarea" name="give-sysinfo" title="To copy the system info, click below then press Ctrl + C (PC) or Cmd + C (Mac)."><?php echo give_tools_sysinfo_get(); ?></textarea>
33 33
 	<p class="submit">
34 34
 		<input type="hidden" name="give-action" value="download_sysinfo" />
35
-		<?php submit_button( 'Download System Info File', 'secondary', 'give-download-sysinfo', false ); ?>
35
+		<?php submit_button('Download System Info File', 'secondary', 'give-download-sysinfo', false); ?>
36 36
 	</p>
37 37
 	<style>
38 38
 		.give_forms_page_give-settings .give-submit-wrap {
@@ -55,63 +55,63 @@  discard block
 block discarded – undo
55 55
 function give_tools_sysinfo_get() {
56 56
 	global $wpdb, $give_options;
57 57
 
58
-	if ( ! class_exists( 'Browser' ) ) {
59
-		require_once GIVE_PLUGIN_DIR . 'includes/libraries/browser.php';
58
+	if ( ! class_exists('Browser')) {
59
+		require_once GIVE_PLUGIN_DIR.'includes/libraries/browser.php';
60 60
 	}
61 61
 
62 62
 	$browser = new Browser();
63 63
 
64 64
 	// Get theme info
65
-	if ( get_bloginfo( 'version' ) < '3.4' ) {
66
-		$theme_data = get_theme_data( get_stylesheet_directory() . '/style.css' );
67
-		$theme      = $theme_data['Name'] . ' ' . $theme_data['Version'];
65
+	if (get_bloginfo('version') < '3.4') {
66
+		$theme_data = get_theme_data(get_stylesheet_directory().'/style.css');
67
+		$theme      = $theme_data['Name'].' '.$theme_data['Version'];
68 68
 	} else {
69 69
 		$theme_data = wp_get_theme();
70
-		$theme      = $theme_data->Name . ' ' . $theme_data->Version;
70
+		$theme      = $theme_data->Name.' '.$theme_data->Version;
71 71
 	}
72 72
 
73 73
 	// Try to identify the hosting provider
74 74
 	$host = give_get_host();
75 75
 
76
-	$return = '### Begin System Info ###' . "\n\n";
76
+	$return = '### Begin System Info ###'."\n\n";
77 77
 
78 78
 	// Start with the basics...
79
-	$return .= '-- Site Info' . "\n\n";
80
-	$return .= 'Site URL:                 ' . site_url() . "\n";
81
-	$return .= 'Home URL:                 ' . home_url() . "\n";
82
-	$return .= 'Multisite:                ' . ( is_multisite() ? 'Yes' : 'No' ) . "\n";
79
+	$return .= '-- Site Info'."\n\n";
80
+	$return .= 'Site URL:                 '.site_url()."\n";
81
+	$return .= 'Home URL:                 '.home_url()."\n";
82
+	$return .= 'Multisite:                '.(is_multisite() ? 'Yes' : 'No')."\n";
83 83
 
84
-	$return = apply_filters( 'give_sysinfo_after_site_info', $return );
84
+	$return = apply_filters('give_sysinfo_after_site_info', $return);
85 85
 
86 86
 	// Can we determine the site's host?
87
-	if ( $host ) {
88
-		$return .= "\n" . '-- Hosting Provider' . "\n\n";
89
-		$return .= 'Host:                     ' . $host . "\n";
87
+	if ($host) {
88
+		$return .= "\n".'-- Hosting Provider'."\n\n";
89
+		$return .= 'Host:                     '.$host."\n";
90 90
 
91
-		$return = apply_filters( 'give_sysinfo_after_host_info', $return );
91
+		$return = apply_filters('give_sysinfo_after_host_info', $return);
92 92
 	}
93 93
 
94 94
 	// The local users' browser information, handled by the Browser class
95
-	$return .= "\n" . '-- User Browser' . "\n\n";
95
+	$return .= "\n".'-- User Browser'."\n\n";
96 96
 	$return .= $browser;
97 97
 
98
-	$return = apply_filters( 'give_sysinfo_after_user_browser', $return );
98
+	$return = apply_filters('give_sysinfo_after_user_browser', $return);
99 99
 
100 100
 	// WordPress configuration
101
-	$return .= "\n" . '-- WordPress Configuration' . "\n\n";
102
-	$return .= 'Version:                  ' . get_bloginfo( 'version' ) . "\n";
103
-	$return .= 'Language:                 ' . ( defined( 'WPLANG' ) && WPLANG ? WPLANG : 'en_US' ) . "\n";
104
-	$return .= 'Permalink Structure:      ' . ( get_option( 'permalink_structure' ) ? get_option( 'permalink_structure' ) : 'Default' ) . "\n";
105
-	$return .= 'Active Theme:             ' . $theme . "\n";
106
-	$return .= 'Show On Front:            ' . get_option( 'show_on_front' ) . "\n";
101
+	$return .= "\n".'-- WordPress Configuration'."\n\n";
102
+	$return .= 'Version:                  '.get_bloginfo('version')."\n";
103
+	$return .= 'Language:                 '.(defined('WPLANG') && WPLANG ? WPLANG : 'en_US')."\n";
104
+	$return .= 'Permalink Structure:      '.(get_option('permalink_structure') ? get_option('permalink_structure') : 'Default')."\n";
105
+	$return .= 'Active Theme:             '.$theme."\n";
106
+	$return .= 'Show On Front:            '.get_option('show_on_front')."\n";
107 107
 
108 108
 	// Only show page specs if frontpage is set to 'page'
109
-	if ( get_option( 'show_on_front' ) == 'page' ) {
110
-		$front_page_id = get_option( 'page_on_front' );
111
-		$blog_page_id  = get_option( 'page_for_posts' );
109
+	if (get_option('show_on_front') == 'page') {
110
+		$front_page_id = get_option('page_on_front');
111
+		$blog_page_id  = get_option('page_for_posts');
112 112
 
113
-		$return .= 'Page On Front:            ' . ( $front_page_id != 0 ? get_the_title( $front_page_id ) . ' (#' . $front_page_id . ')' : 'Unset' ) . "\n";
114
-		$return .= 'Page For Posts:           ' . ( $blog_page_id != 0 ? get_the_title( $blog_page_id ) . ' (#' . $blog_page_id . ')' : 'Unset' ) . "\n";
113
+		$return .= 'Page On Front:            '.($front_page_id != 0 ? get_the_title($front_page_id).' (#'.$front_page_id.')' : 'Unset')."\n";
114
+		$return .= 'Page For Posts:           '.($blog_page_id != 0 ? get_the_title($blog_page_id).' (#'.$blog_page_id.')' : 'Unset')."\n";
115 115
 	}
116 116
 
117 117
 	// Make sure wp_remote_post() is working
@@ -120,200 +120,200 @@  discard block
 block discarded – undo
120 120
 	$params = array(
121 121
 		'sslverify'  => false,
122 122
 		'timeout'    => 60,
123
-		'user-agent' => 'Give/' . GIVE_VERSION,
123
+		'user-agent' => 'Give/'.GIVE_VERSION,
124 124
 		'body'       => $request
125 125
 	);
126 126
 
127
-	$response = wp_remote_post( 'https://www.paypal.com/cgi-bin/webscr', $params );
127
+	$response = wp_remote_post('https://www.paypal.com/cgi-bin/webscr', $params);
128 128
 
129
-	if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) {
129
+	if ( ! is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) {
130 130
 		$WP_REMOTE_POST = 'wp_remote_post() works';
131 131
 	} else {
132 132
 		$WP_REMOTE_POST = 'wp_remote_post() does not work';
133 133
 	}
134 134
 
135
-	$return .= 'Remote Post:              ' . $WP_REMOTE_POST . "\n";
136
-	$return .= 'Table Prefix:             ' . 'Length: ' . strlen( $wpdb->prefix ) . '   Status: ' . ( strlen( $wpdb->prefix ) > 16 ? 'ERROR: Too long' : 'Acceptable' ) . "\n";
137
-	$return .= 'Admin AJAX:               ' . ( give_test_ajax_works() ? 'Accessible' : 'Inaccessible' ) . "\n";
138
-	$return .= 'WP_DEBUG:                 ' . ( defined( 'WP_DEBUG' ) ? WP_DEBUG ? 'Enabled' : 'Disabled' : 'Not set' ) . "\n";
139
-	$return .= 'Memory Limit:             ' . WP_MEMORY_LIMIT . "\n";
140
-	$return .= 'Registered Post Stati:    ' . implode( ', ', get_post_stati() ) . "\n";
135
+	$return .= 'Remote Post:              '.$WP_REMOTE_POST."\n";
136
+	$return .= 'Table Prefix:             '.'Length: '.strlen($wpdb->prefix).'   Status: '.(strlen($wpdb->prefix) > 16 ? 'ERROR: Too long' : 'Acceptable')."\n";
137
+	$return .= 'Admin AJAX:               '.(give_test_ajax_works() ? 'Accessible' : 'Inaccessible')."\n";
138
+	$return .= 'WP_DEBUG:                 '.(defined('WP_DEBUG') ? WP_DEBUG ? 'Enabled' : 'Disabled' : 'Not set')."\n";
139
+	$return .= 'Memory Limit:             '.WP_MEMORY_LIMIT."\n";
140
+	$return .= 'Registered Post Stati:    '.implode(', ', get_post_stati())."\n";
141 141
 
142
-	$return = apply_filters( 'give_sysinfo_after_wordpress_config', $return );
142
+	$return = apply_filters('give_sysinfo_after_wordpress_config', $return);
143 143
 
144 144
 	// GIVE configuration
145
-	$return .= "\n" . '-- Give Configuration' . "\n\n";
146
-	$return .= 'Version:                  ' . GIVE_VERSION . "\n";
147
-	$return .= 'Upgraded From:            ' . get_option( 'give_version_upgraded_from', 'None' ) . "\n";
148
-	$return .= 'Test Mode:                ' . ( give_is_test_mode() ? "Enabled\n" : "Disabled\n" );
149
-	$return .= 'Currency Code:            ' . give_get_currency() . "\n";
150
-	$return .= 'Currency Position:        ' . give_get_option( 'currency_position', 'before' ) . "\n";
151
-	$return .= 'Decimal Separator:        ' . give_get_option( 'decimal_separator', '.' ) . "\n";
152
-	$return .= 'Thousands Separator:      ' . give_get_option( 'thousands_separator', ',' ) . "\n";
145
+	$return .= "\n".'-- Give Configuration'."\n\n";
146
+	$return .= 'Version:                  '.GIVE_VERSION."\n";
147
+	$return .= 'Upgraded From:            '.get_option('give_version_upgraded_from', 'None')."\n";
148
+	$return .= 'Test Mode:                '.(give_is_test_mode() ? "Enabled\n" : "Disabled\n");
149
+	$return .= 'Currency Code:            '.give_get_currency()."\n";
150
+	$return .= 'Currency Position:        '.give_get_option('currency_position', 'before')."\n";
151
+	$return .= 'Decimal Separator:        '.give_get_option('decimal_separator', '.')."\n";
152
+	$return .= 'Thousands Separator:      '.give_get_option('thousands_separator', ',')."\n";
153 153
 
154
-	$return = apply_filters( 'give_sysinfo_after_give_config', $return );
154
+	$return = apply_filters('give_sysinfo_after_give_config', $return);
155 155
 
156 156
 	// GIVE pages
157
-	$return .= "\n" . '-- Give Page Configuration' . "\n\n";
158
-	$return .= 'Success Page:             ' . ( ! empty( $give_options['success_page'] ) ? get_permalink( $give_options['success_page'] ) . "\n" : "Unset\n" );
159
-	$return .= 'Failure Page:             ' . ( ! empty( $give_options['failure_page'] ) ? get_permalink( $give_options['failure_page'] ) . "\n" : "Unset\n" );
160
-	$return .= 'Give Forms Slug:           ' . ( defined( 'GIVE_SLUG' ) ? '/' . GIVE_SLUG . "\n" : "/donations\n" );
157
+	$return .= "\n".'-- Give Page Configuration'."\n\n";
158
+	$return .= 'Success Page:             '.( ! empty($give_options['success_page']) ? get_permalink($give_options['success_page'])."\n" : "Unset\n");
159
+	$return .= 'Failure Page:             '.( ! empty($give_options['failure_page']) ? get_permalink($give_options['failure_page'])."\n" : "Unset\n");
160
+	$return .= 'Give Forms Slug:           '.(defined('GIVE_SLUG') ? '/'.GIVE_SLUG."\n" : "/donations\n");
161 161
 
162
-	$return = apply_filters( 'give_sysinfo_after_give_pages', $return );
162
+	$return = apply_filters('give_sysinfo_after_give_pages', $return);
163 163
 
164 164
 	// GIVE gateways
165
-	$return .= "\n" . '-- Give Gateway Configuration' . "\n\n";
165
+	$return .= "\n".'-- Give Gateway Configuration'."\n\n";
166 166
 
167 167
 	$active_gateways = give_get_enabled_payment_gateways();
168
-	if ( $active_gateways ) {
169
-		$default_gateway_is_active = give_is_gateway_active( give_get_default_gateway( null ) );
170
-		if ( $default_gateway_is_active ) {
171
-			$default_gateway = give_get_default_gateway( null );
172
-			$default_gateway = $active_gateways[ $default_gateway ]['admin_label'];
168
+	if ($active_gateways) {
169
+		$default_gateway_is_active = give_is_gateway_active(give_get_default_gateway(null));
170
+		if ($default_gateway_is_active) {
171
+			$default_gateway = give_get_default_gateway(null);
172
+			$default_gateway = $active_gateways[$default_gateway]['admin_label'];
173 173
 		} else {
174 174
 			$default_gateway = 'Test Payment';
175 175
 		}
176 176
 
177 177
 		$gateways = array();
178
-		foreach ( $active_gateways as $gateway ) {
178
+		foreach ($active_gateways as $gateway) {
179 179
 			$gateways[] = $gateway['admin_label'];
180 180
 		}
181 181
 
182
-		$return .= 'Enabled Gateways:         ' . implode( ', ', $gateways ) . "\n";
183
-		$return .= 'Default Gateway:          ' . $default_gateway . "\n";
182
+		$return .= 'Enabled Gateways:         '.implode(', ', $gateways)."\n";
183
+		$return .= 'Default Gateway:          '.$default_gateway."\n";
184 184
 	} else {
185
-		$return .= 'Enabled Gateways:         None' . "\n";
185
+		$return .= 'Enabled Gateways:         None'."\n";
186 186
 	}
187 187
 
188
-	$return = apply_filters( 'give_sysinfo_after_give_gateways', $return );
188
+	$return = apply_filters('give_sysinfo_after_give_gateways', $return);
189 189
 
190 190
 	// GIVE Templates
191
-	$dir = get_stylesheet_directory() . '/give_templates/*';
192
-	if ( is_dir( $dir ) && ( count( glob( "$dir/*" ) ) !== 0 ) ) {
193
-		$return .= "\n" . '-- Give Template Overrides' . "\n\n";
191
+	$dir = get_stylesheet_directory().'/give_templates/*';
192
+	if (is_dir($dir) && (count(glob("$dir/*")) !== 0)) {
193
+		$return .= "\n".'-- Give Template Overrides'."\n\n";
194 194
 
195
-		foreach ( glob( $dir ) as $file ) {
196
-			$return .= 'Filename:                 ' . basename( $file ) . "\n";
195
+		foreach (glob($dir) as $file) {
196
+			$return .= 'Filename:                 '.basename($file)."\n";
197 197
 		}
198 198
 
199
-		$return = apply_filters( 'give_sysinfo_after_give_templates', $return );
199
+		$return = apply_filters('give_sysinfo_after_give_templates', $return);
200 200
 	}
201 201
 
202 202
 	// Must-use plugins
203 203
 	$muplugins = get_mu_plugins();
204
-	if ( count( $muplugins > 0 ) ) {
205
-		$return .= "\n" . '-- Must-Use Plugins' . "\n\n";
204
+	if (count($muplugins > 0)) {
205
+		$return .= "\n".'-- Must-Use Plugins'."\n\n";
206 206
 
207
-		foreach ( $muplugins as $plugin => $plugin_data ) {
208
-			$return .= $plugin_data['Name'] . ': ' . $plugin_data['Version'] . "\n";
207
+		foreach ($muplugins as $plugin => $plugin_data) {
208
+			$return .= $plugin_data['Name'].': '.$plugin_data['Version']."\n";
209 209
 		}
210 210
 
211
-		$return = apply_filters( 'give_sysinfo_after_wordpress_mu_plugins', $return );
211
+		$return = apply_filters('give_sysinfo_after_wordpress_mu_plugins', $return);
212 212
 	}
213 213
 
214 214
 	// WordPress active plugins
215
-	$return .= "\n" . '-- WordPress Active Plugins' . "\n\n";
215
+	$return .= "\n".'-- WordPress Active Plugins'."\n\n";
216 216
 
217 217
 	$plugins        = get_plugins();
218
-	$active_plugins = get_option( 'active_plugins', array() );
218
+	$active_plugins = get_option('active_plugins', array());
219 219
 
220
-	foreach ( $plugins as $plugin_path => $plugin ) {
221
-		if ( ! in_array( $plugin_path, $active_plugins ) ) {
220
+	foreach ($plugins as $plugin_path => $plugin) {
221
+		if ( ! in_array($plugin_path, $active_plugins)) {
222 222
 			continue;
223 223
 		}
224 224
 
225
-		$return .= $plugin['Name'] . ': ' . $plugin['Version'] . "\n";
225
+		$return .= $plugin['Name'].': '.$plugin['Version']."\n";
226 226
 	}
227 227
 
228
-	$return = apply_filters( 'give_sysinfo_after_wordpress_plugins', $return );
228
+	$return = apply_filters('give_sysinfo_after_wordpress_plugins', $return);
229 229
 
230 230
 	// WordPress inactive plugins
231
-	$return .= "\n" . '-- WordPress Inactive Plugins' . "\n\n";
231
+	$return .= "\n".'-- WordPress Inactive Plugins'."\n\n";
232 232
 
233
-	foreach ( $plugins as $plugin_path => $plugin ) {
234
-		if ( in_array( $plugin_path, $active_plugins ) ) {
233
+	foreach ($plugins as $plugin_path => $plugin) {
234
+		if (in_array($plugin_path, $active_plugins)) {
235 235
 			continue;
236 236
 		}
237 237
 
238
-		$return .= $plugin['Name'] . ': ' . $plugin['Version'] . "\n";
238
+		$return .= $plugin['Name'].': '.$plugin['Version']."\n";
239 239
 	}
240 240
 
241
-	$return = apply_filters( 'give_sysinfo_after_wordpress_plugins_inactive', $return );
241
+	$return = apply_filters('give_sysinfo_after_wordpress_plugins_inactive', $return);
242 242
 
243
-	if ( is_multisite() ) {
243
+	if (is_multisite()) {
244 244
 		// WordPress Multisite active plugins
245
-		$return .= "\n" . '-- Network Active Plugins' . "\n\n";
245
+		$return .= "\n".'-- Network Active Plugins'."\n\n";
246 246
 
247 247
 		$plugins        = wp_get_active_network_plugins();
248
-		$active_plugins = get_site_option( 'active_sitewide_plugins', array() );
248
+		$active_plugins = get_site_option('active_sitewide_plugins', array());
249 249
 
250
-		foreach ( $plugins as $plugin_path ) {
251
-			$plugin_base = plugin_basename( $plugin_path );
250
+		foreach ($plugins as $plugin_path) {
251
+			$plugin_base = plugin_basename($plugin_path);
252 252
 
253
-			if ( ! array_key_exists( $plugin_base, $active_plugins ) ) {
253
+			if ( ! array_key_exists($plugin_base, $active_plugins)) {
254 254
 				continue;
255 255
 			}
256 256
 
257
-			$plugin = get_plugin_data( $plugin_path );
258
-			$return .= $plugin['Name'] . ': ' . $plugin['Version'] . "\n";
257
+			$plugin = get_plugin_data($plugin_path);
258
+			$return .= $plugin['Name'].': '.$plugin['Version']."\n";
259 259
 		}
260 260
 
261
-		$return = apply_filters( 'give_sysinfo_after_wordpress_ms_plugins', $return );
261
+		$return = apply_filters('give_sysinfo_after_wordpress_ms_plugins', $return);
262 262
 	}
263 263
 
264 264
 	// Server configuration (really just versioning)
265
-	$return .= "\n" . '-- Webserver Configuration' . "\n\n";
266
-	$return .= 'PHP Version:              ' . PHP_VERSION . "\n";
267
-	$return .= 'MySQL Version:            ' . $wpdb->db_version() . "\n";
268
-	$return .= 'Webserver Info:           ' . $_SERVER['SERVER_SOFTWARE'] . "\n";
265
+	$return .= "\n".'-- Webserver Configuration'."\n\n";
266
+	$return .= 'PHP Version:              '.PHP_VERSION."\n";
267
+	$return .= 'MySQL Version:            '.$wpdb->db_version()."\n";
268
+	$return .= 'Webserver Info:           '.$_SERVER['SERVER_SOFTWARE']."\n";
269 269
 
270
-	$return = apply_filters( 'give_sysinfo_after_webserver_config', $return );
270
+	$return = apply_filters('give_sysinfo_after_webserver_config', $return);
271 271
 
272 272
 	// PHP configs... now we're getting to the important stuff
273
-	$return .= "\n" . '-- PHP Configuration' . "\n\n";
274
-	$return .= 'Safe Mode:                ' . ( ini_get( 'safe_mode' ) ? 'Enabled' : 'Disabled' . "\n" );
275
-	$return .= 'Memory Limit:             ' . ini_get( 'memory_limit' ) . "\n";
276
-	$return .= 'Upload Max Size:          ' . ini_get( 'upload_max_filesize' ) . "\n";
277
-	$return .= 'Post Max Size:            ' . ini_get( 'post_max_size' ) . "\n";
278
-	$return .= 'Upload Max Filesize:      ' . ini_get( 'upload_max_filesize' ) . "\n";
279
-	$return .= 'Time Limit:               ' . ini_get( 'max_execution_time' ) . "\n";
280
-	$return .= 'Max Input Vars:           ' . ini_get( 'max_input_vars' ) . "\n";
281
-	$return .= 'Display Errors:           ' . ( ini_get( 'display_errors' ) ? 'On (' . ini_get( 'display_errors' ) . ')' : 'N/A' ) . "\n";
282
-
283
-	$return = apply_filters( 'give_sysinfo_after_php_config', $return );
273
+	$return .= "\n".'-- PHP Configuration'."\n\n";
274
+	$return .= 'Safe Mode:                '.(ini_get('safe_mode') ? 'Enabled' : 'Disabled'."\n");
275
+	$return .= 'Memory Limit:             '.ini_get('memory_limit')."\n";
276
+	$return .= 'Upload Max Size:          '.ini_get('upload_max_filesize')."\n";
277
+	$return .= 'Post Max Size:            '.ini_get('post_max_size')."\n";
278
+	$return .= 'Upload Max Filesize:      '.ini_get('upload_max_filesize')."\n";
279
+	$return .= 'Time Limit:               '.ini_get('max_execution_time')."\n";
280
+	$return .= 'Max Input Vars:           '.ini_get('max_input_vars')."\n";
281
+	$return .= 'Display Errors:           '.(ini_get('display_errors') ? 'On ('.ini_get('display_errors').')' : 'N/A')."\n";
282
+
283
+	$return = apply_filters('give_sysinfo_after_php_config', $return);
284 284
 
285 285
 	// PHP extensions and such
286
-	$return .= "\n" . '-- PHP Extensions' . "\n\n";
287
-	$return .= 'cURL:                     ' . ( function_exists( 'curl_init' ) ? 'Supported' : 'Not Supported' ) . "\n";
286
+	$return .= "\n".'-- PHP Extensions'."\n\n";
287
+	$return .= 'cURL:                     '.(function_exists('curl_init') ? 'Supported' : 'Not Supported')."\n";
288 288
 
289 289
 	//cURL version
290
-	if ( function_exists( 'curl_init' ) && function_exists( 'curl_version' ) ) {
290
+	if (function_exists('curl_init') && function_exists('curl_version')) {
291 291
 		$curl_values = curl_version();
292
-		$return .= 'cURL Version:             ' . $curl_values["version"] . "\n";
292
+		$return .= 'cURL Version:             '.$curl_values["version"]."\n";
293 293
 	}
294
-	$return .= 'fsockopen:                ' . ( function_exists( 'fsockopen' ) ? 'Supported' : 'Not Supported' ) . "\n";
295
-	$return .= 'SOAP Client:              ' . ( class_exists( 'SoapClient' ) ? 'Installed' : 'Not Installed' ) . "\n";
296
-	$return .= 'Suhosin:                  ' . ( extension_loaded( 'suhosin' ) ? 'Installed' : 'Not Installed' ) . "\n";
294
+	$return .= 'fsockopen:                '.(function_exists('fsockopen') ? 'Supported' : 'Not Supported')."\n";
295
+	$return .= 'SOAP Client:              '.(class_exists('SoapClient') ? 'Installed' : 'Not Installed')."\n";
296
+	$return .= 'Suhosin:                  '.(extension_loaded('suhosin') ? 'Installed' : 'Not Installed')."\n";
297 297
 
298
-	$return = apply_filters( 'give_sysinfo_after_php_ext', $return );
298
+	$return = apply_filters('give_sysinfo_after_php_ext', $return);
299 299
 
300 300
 	// Session stuff
301
-	$return .= "\n" . '-- Session Configuration' . "\n\n";
302
-	$return .= 'Give Use Sessions:        ' . ( defined( 'GIVE_USE_PHP_SESSIONS' ) && GIVE_USE_PHP_SESSIONS ? 'Enforced' : ( Give()->session->use_php_sessions() ? 'Enabled' : 'Disabled' ) ) . "\n";
303
-	$return .= 'Session:                  ' . ( isset( $_SESSION ) ? 'Enabled' : 'Disabled' ) . "\n";
301
+	$return .= "\n".'-- Session Configuration'."\n\n";
302
+	$return .= 'Give Use Sessions:        '.(defined('GIVE_USE_PHP_SESSIONS') && GIVE_USE_PHP_SESSIONS ? 'Enforced' : (Give()->session->use_php_sessions() ? 'Enabled' : 'Disabled'))."\n";
303
+	$return .= 'Session:                  '.(isset($_SESSION) ? 'Enabled' : 'Disabled')."\n";
304 304
 
305 305
 	// The rest of this is only relevant is session is enabled
306
-	if ( isset( $_SESSION ) ) {
307
-		$return .= 'Session Name:             ' . esc_html( ini_get( 'session.name' ) ) . "\n";
308
-		$return .= 'Cookie Path:              ' . esc_html( ini_get( 'session.cookie_path' ) ) . "\n";
309
-		$return .= 'Save Path:                ' . esc_html( ini_get( 'session.save_path' ) ) . "\n";
310
-		$return .= 'Use Cookies:              ' . ( ini_get( 'session.use_cookies' ) ? 'On' : 'Off' ) . "\n";
311
-		$return .= 'Use Only Cookies:         ' . ( ini_get( 'session.use_only_cookies' ) ? 'On' : 'Off' ) . "\n";
306
+	if (isset($_SESSION)) {
307
+		$return .= 'Session Name:             '.esc_html(ini_get('session.name'))."\n";
308
+		$return .= 'Cookie Path:              '.esc_html(ini_get('session.cookie_path'))."\n";
309
+		$return .= 'Save Path:                '.esc_html(ini_get('session.save_path'))."\n";
310
+		$return .= 'Use Cookies:              '.(ini_get('session.use_cookies') ? 'On' : 'Off')."\n";
311
+		$return .= 'Use Only Cookies:         '.(ini_get('session.use_only_cookies') ? 'On' : 'Off')."\n";
312 312
 	}
313 313
 
314
-	$return = apply_filters( 'give_sysinfo_after_session_config', $return );
314
+	$return = apply_filters('give_sysinfo_after_session_config', $return);
315 315
 
316
-	$return .= "\n" . '### End System Info ###';
316
+	$return .= "\n".'### End System Info ###';
317 317
 
318 318
 	return $return;
319 319
 }
@@ -327,17 +327,17 @@  discard block
 block discarded – undo
327 327
  */
328 328
 function give_tools_sysinfo_download() {
329 329
 
330
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
330
+	if ( ! current_user_can('manage_give_settings')) {
331 331
 		return;
332 332
 	}
333 333
 
334 334
 	nocache_headers();
335 335
 
336
-	header( 'Content-Type: text/plain' );
337
-	header( 'Content-Disposition: attachment; filename="give-system-info.txt"' );
336
+	header('Content-Type: text/plain');
337
+	header('Content-Disposition: attachment; filename="give-system-info.txt"');
338 338
 
339
-	echo wp_strip_all_tags( $_POST['give-sysinfo'] );
339
+	echo wp_strip_all_tags($_POST['give-sysinfo']);
340 340
 	give_die();
341 341
 }
342 342
 
343
-add_action( 'give_download_sysinfo', 'give_tools_sysinfo_download' );
344 343
\ No newline at end of file
344
+add_action('give_download_sysinfo', 'give_tools_sysinfo_download');
345 345
\ No newline at end of file
Please login to merge, or discard this patch.