Completed
Push — master ( 4753ca...040342 )
by Matt
12:05
created
includes/admin/shortcodes/shortcode-give-goal.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  * @since       1.3.0
10 10
  */
11 11
 
12
-defined( 'ABSPATH' ) or exit;
12
+defined('ABSPATH') or exit;
13 13
 
14 14
 class Give_Shortcode_Donation_Form_Goal extends Give_Shortcode_Generator {
15 15
 
@@ -18,10 +18,10 @@  discard block
 block discarded – undo
18 18
 	 */
19 19
 	public function __construct() {
20 20
 
21
-		$this->shortcode['title'] = __( 'Donation Form Goal', 'give' );
22
-		$this->shortcode['label'] = __( 'Donation Form Goal', 'give' );
21
+		$this->shortcode['title'] = __('Donation Form Goal', 'give');
22
+		$this->shortcode['label'] = __('Donation Form Goal', 'give');
23 23
 
24
-		parent::__construct( 'give_goal' );
24
+		parent::__construct('give_goal');
25 25
 	}
26 26
 
27 27
 	/**
@@ -31,8 +31,8 @@  discard block
 block discarded – undo
31 31
 	 */
32 32
 	public function define_fields() {
33 33
 
34
-		$create_form_link = sprintf( __( '%sClick here%s to create a new Donation Form.', 'give' ),
35
-			'<a href="' . admin_url( 'post-new.php?post_type=give_forms' ) . '">',
34
+		$create_form_link = sprintf(__('%sClick here%s to create a new Donation Form.', 'give'),
35
+			'<a href="'.admin_url('post-new.php?post_type=give_forms').'">',
36 36
 			'</a>'
37 37
 		);
38 38
 
@@ -43,35 +43,35 @@  discard block
 block discarded – undo
43 43
 					'post_type' => 'give_forms',
44 44
 				),
45 45
 				'name'        => 'id',
46
-				'tooltip'     => __( 'Select a Donation Form', 'give' ),
47
-				'placeholder' => sprintf( '– %s –', __( 'Select a Form', 'give' ) ),
46
+				'tooltip'     => __('Select a Donation Form', 'give'),
47
+				'placeholder' => sprintf('– %s –', __('Select a Form', 'give')),
48 48
 				'required'    => array(
49
-					'alert' => __( 'You must first select a Form!', 'give' ),
50
-					'error' => sprintf( '<p class="strong">%s</p><p class="no-margin">%s</p>', __( 'No donation forms were found!', 'give' ), $create_form_link ),
49
+					'alert' => __('You must first select a Form!', 'give'),
50
+					'error' => sprintf('<p class="strong">%s</p><p class="no-margin">%s</p>', __('No donation forms were found!', 'give'), $create_form_link),
51 51
 				),
52 52
 			),
53 53
 			array(
54 54
 				'type' => 'container',
55
-				'html' => sprintf( '<p class="strong margin-top">%s</p>', __( 'Optional settings', 'give' ) ),
55
+				'html' => sprintf('<p class="strong margin-top">%s</p>', __('Optional settings', 'give')),
56 56
 			),
57 57
 			array(
58 58
 				'type'    => 'listbox',
59 59
 				'name'    => 'show_text',
60
-				'label'   => __( 'Show Text:', 'give' ),
61
-				'tooltip' => __( 'This text displays the amount of income raised compared to the goal.', 'give' ),
60
+				'label'   => __('Show Text:', 'give'),
61
+				'tooltip' => __('This text displays the amount of income raised compared to the goal.', 'give'),
62 62
 				'options' => array(
63
-					'true'  => __( 'Show', 'give' ),
64
-					'false' => __( 'Hide', 'give' ),
63
+					'true'  => __('Show', 'give'),
64
+					'false' => __('Hide', 'give'),
65 65
 				),
66 66
 			),
67 67
 			array(
68 68
 				'type'    => 'listbox',
69 69
 				'name'    => 'show_bar',
70
-				'label'   => __( 'Show Progress Bar:', 'give' ),
71
-				'tooltip' => __( 'Do you want to display the goal\'s progress bar?', 'give' ),
70
+				'label'   => __('Show Progress Bar:', 'give'),
71
+				'tooltip' => __('Do you want to display the goal\'s progress bar?', 'give'),
72 72
 				'options' => array(
73
-					'true'  => __( 'Show', 'give' ),
74
-					'false' => __( 'Hide', 'give' ),
73
+					'true'  => __('Show', 'give'),
74
+					'false' => __('Hide', 'give'),
75 75
 				),
76 76
 			),
77 77
 		);
Please login to merge, or discard this patch.
includes/admin/shortcodes/shortcode-give-login.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  * @since       1.3.0
10 10
  */
11 11
 
12
-defined( 'ABSPATH' ) or exit;
12
+defined('ABSPATH') or exit;
13 13
 
14 14
 class Give_Shortcode_Login extends Give_Shortcode_Generator {
15 15
 
@@ -18,10 +18,10 @@  discard block
 block discarded – undo
18 18
 	 */
19 19
 	public function __construct() {
20 20
 
21
-		$this->shortcode['title'] = __( 'Login', 'give' );
22
-		$this->shortcode['label'] = __( 'Login', 'give' );
21
+		$this->shortcode['title'] = __('Login', 'give');
22
+		$this->shortcode['label'] = __('Login', 'give');
23 23
 
24
-		parent::__construct( 'give_login' );
24
+		parent::__construct('give_login');
25 25
 	}
26 26
 
27 27
 	/**
@@ -34,13 +34,13 @@  discard block
 block discarded – undo
34 34
 		return array(
35 35
 			array(
36 36
 				'type' => 'container',
37
-				'html' => sprintf( '<p class="no-margin">%s</p>', __( 'Redirect URL (optional):', 'give' ) ),
37
+				'html' => sprintf('<p class="no-margin">%s</p>', __('Redirect URL (optional):', 'give')),
38 38
 			),
39 39
 			array(
40 40
 				'type'     => 'textbox',
41 41
 				'name'     => 'redirect',
42 42
 				'minWidth' => 320,
43
-				'tooltip'  => __( 'Enter an URL here to redirect to after login.', 'give' ),
43
+				'tooltip'  => __('Enter an URL here to redirect to after login.', 'give'),
44 44
 			),
45 45
 		);
46 46
 	}
Please login to merge, or discard this patch.
includes/admin/shortcodes/shortcode-give-profile-editor.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  * @since       1.3.0
10 10
  */
11 11
 
12
-defined( 'ABSPATH' ) or exit;
12
+defined('ABSPATH') or exit;
13 13
 
14 14
 class Give_Shortcode_Profile_Editor extends Give_Shortcode_Generator {
15 15
 
@@ -18,9 +18,9 @@  discard block
 block discarded – undo
18 18
 	 */
19 19
 	public function __construct() {
20 20
 
21
-		$this->shortcode['label'] = __( 'Profile Editor', 'give' );
21
+		$this->shortcode['label'] = __('Profile Editor', 'give');
22 22
 
23
-		parent::__construct( 'give_profile_editor' );
23
+		parent::__construct('give_profile_editor');
24 24
 	}
25 25
 }
26 26
 
Please login to merge, or discard this patch.
includes/admin/shortcodes/shortcode-give-receipt.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  * @since       1.3.0
10 10
  */
11 11
 
12
-defined( 'ABSPATH' ) or exit;
12
+defined('ABSPATH') or exit;
13 13
 
14 14
 class Give_Shortcode_Donation_Receipt extends Give_Shortcode_Generator {
15 15
 
@@ -18,10 +18,10 @@  discard block
 block discarded – undo
18 18
 	 */
19 19
 	public function __construct() {
20 20
 
21
-		$this->shortcode['title'] = __( 'Donation Receipt', 'give' );
22
-		$this->shortcode['label'] = __( 'Donation Receipt', 'give' );
21
+		$this->shortcode['title'] = __('Donation Receipt', 'give');
22
+		$this->shortcode['label'] = __('Donation Receipt', 'give');
23 23
 
24
-		parent::__construct( 'give_receipt' );
24
+		parent::__construct('give_receipt');
25 25
 	}
26 26
 
27 27
 	/**
@@ -34,51 +34,51 @@  discard block
 block discarded – undo
34 34
 		return array(
35 35
 			array(
36 36
 				'type' => 'container',
37
-				'html' => sprintf( '<p class="strong">%s</p>', __( 'Optional settings', 'give' ) ),
37
+				'html' => sprintf('<p class="strong">%s</p>', __('Optional settings', 'give')),
38 38
 			),
39 39
 			array(
40 40
 				'type'    => 'listbox',
41 41
 				'name'    => 'price',
42
-				'label'   => __( 'Show Price:', 'give' ),
42
+				'label'   => __('Show Price:', 'give'),
43 43
 				'options' => array(
44
-					'true'  => __( 'Show', 'give' ),
45
-					'false' => __( 'Hide', 'give' ),
44
+					'true'  => __('Show', 'give'),
45
+					'false' => __('Hide', 'give'),
46 46
 				),
47 47
 			),
48 48
 			array(
49 49
 				'type'    => 'listbox',
50 50
 				'name'    => 'date',
51
-				'label'   => __( 'Show Date:', 'give' ),
51
+				'label'   => __('Show Date:', 'give'),
52 52
 				'options' => array(
53
-					'true'  => __( 'Show', 'give' ),
54
-					'false' => __( 'Hide', 'give' ),
53
+					'true'  => __('Show', 'give'),
54
+					'false' => __('Hide', 'give'),
55 55
 				),
56 56
 			),
57 57
 			array(
58 58
 				'type'    => 'listbox',
59 59
 				'name'    => 'payment_key',
60
-				'label'   => __( 'Show Payment Key:', 'give' ),
60
+				'label'   => __('Show Payment Key:', 'give'),
61 61
 				'options' => array(
62
-					'true'  => __( 'Show', 'give' ),
63
-					'false' => __( 'Hide', 'give' ),
62
+					'true'  => __('Show', 'give'),
63
+					'false' => __('Hide', 'give'),
64 64
 				),
65 65
 			),
66 66
 			array(
67 67
 				'type'    => 'listbox',
68 68
 				'name'    => 'payment_method',
69
-				'label'   => __( 'Show Payment Method:', 'give' ),
69
+				'label'   => __('Show Payment Method:', 'give'),
70 70
 				'options' => array(
71
-					'true'  => __( 'Show', 'give' ),
72
-					'false' => __( 'Hide', 'give' ),
71
+					'true'  => __('Show', 'give'),
72
+					'false' => __('Hide', 'give'),
73 73
 				),
74 74
 			),
75 75
 			array(
76 76
 				'type'    => 'listbox',
77 77
 				'name'    => 'payment_id',
78
-				'label'   => __( 'Show Payment ID:', 'give' ),
78
+				'label'   => __('Show Payment ID:', 'give'),
79 79
 				'options' => array(
80
-					'true'  => __( 'Show', 'give' ),
81
-					'false' => __( 'Hide', 'give' ),
80
+					'true'  => __('Show', 'give'),
81
+					'false' => __('Hide', 'give'),
82 82
 				),
83 83
 			),
84 84
 		);
Please login to merge, or discard this patch.
includes/admin/shortcodes/shortcode-give-register.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  * @since       1.3.0
10 10
  */
11 11
 
12
-defined( 'ABSPATH' ) or exit;
12
+defined('ABSPATH') or exit;
13 13
 
14 14
 class Give_Shortcode_Register extends Give_Shortcode_Generator {
15 15
 
@@ -18,10 +18,10 @@  discard block
 block discarded – undo
18 18
 	 */
19 19
 	public function __construct() {
20 20
 
21
-		$this->shortcode['title'] = __( 'Register', 'give' );
22
-		$this->shortcode['label'] = __( 'Register', 'give' );
21
+		$this->shortcode['title'] = __('Register', 'give');
22
+		$this->shortcode['label'] = __('Register', 'give');
23 23
 
24
-		parent::__construct( 'give_register' );
24
+		parent::__construct('give_register');
25 25
 	}
26 26
 
27 27
 	/**
@@ -34,13 +34,13 @@  discard block
 block discarded – undo
34 34
 		return array(
35 35
 			array(
36 36
 				'type' => 'container',
37
-				'html' => sprintf( '<p class="no-margin">%s</p>', __( 'Redirect URL (optional):', 'give' ) ),
37
+				'html' => sprintf('<p class="no-margin">%s</p>', __('Redirect URL (optional):', 'give')),
38 38
 			),
39 39
 			array(
40 40
 				'type'     => 'textbox',
41 41
 				'name'     => 'redirect',
42 42
 				'minWidth' => 320,
43
-				'tooltip'  => __( 'Enter an URL here to redirect to after registering.', 'give' ),
43
+				'tooltip'  => __('Enter an URL here to redirect to after registering.', 'give'),
44 44
 			),
45 45
 		);
46 46
 	}
Please login to merge, or discard this patch.
includes/admin/upgrades/upgrades.php 2 patches
Spacing   +17 added lines, -17 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
 
@@ -21,12 +21,12 @@  discard block
 block discarded – undo
21 21
  * @return void
22 22
  */
23 23
 function give_upgrades_screen() {
24
-	$action = isset( $_GET['give-upgrade'] ) ? sanitize_text_field( $_GET['give-upgrade'] ) : '';
25
-	$step   = isset( $_GET['step'] ) ? absint( $_GET['step'] ) : 1;
26
-	$total  = isset( $_GET['total'] ) ? absint( $_GET['total'] ) : false;
27
-	$custom = isset( $_GET['custom'] ) ? absint( $_GET['custom'] ) : 0;
28
-	$number = isset( $_GET['number'] ) ? absint( $_GET['number'] ) : 100;
29
-	$steps  = round( ( $total / $number ), 0 );
24
+	$action = isset($_GET['give-upgrade']) ? sanitize_text_field($_GET['give-upgrade']) : '';
25
+	$step   = isset($_GET['step']) ? absint($_GET['step']) : 1;
26
+	$total  = isset($_GET['total']) ? absint($_GET['total']) : false;
27
+	$custom = isset($_GET['custom']) ? absint($_GET['custom']) : 0;
28
+	$number = isset($_GET['number']) ? absint($_GET['number']) : 100;
29
+	$steps  = round(($total / $number), 0);
30 30
 
31 31
 	$doing_upgrade_args = array(
32 32
 		'page'         => 'give-upgrades',
@@ -36,25 +36,25 @@  discard block
 block discarded – undo
36 36
 		'custom'       => $custom,
37 37
 		'steps'        => $steps
38 38
 	);
39
-	update_option( 'give_doing_upgrade', $doing_upgrade_args );
40
-	if ( $step > $steps ) {
39
+	update_option('give_doing_upgrade', $doing_upgrade_args);
40
+	if ($step > $steps) {
41 41
 		// Prevent a weird case where the estimate was off. Usually only a couple.
42 42
 		$steps = $step;
43 43
 	}
44 44
 	?>
45 45
 	<div class="wrap">
46
-		<h2><?php _e( 'Give - Upgrades', 'give' ); ?></h2>
46
+		<h2><?php _e('Give - Upgrades', 'give'); ?></h2>
47 47
 
48
-		<?php if ( ! empty( $action ) ) : ?>
48
+		<?php if ( ! empty($action)) : ?>
49 49
 
50 50
 			<div id="give-upgrade-status">
51
-				<p style="font-size: 20px;max-width: 900px;"><?php _e( 'The upgrade process has started, please be patient and do not close this window or navigate away from this page. This could take several minutes depending on the upgrade and the size of your website. You will be automatically redirected when the upgrade is finished.', 'give' ); ?>
52
-					<img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/spinner.gif'; ?>" id="give-upgrade-loader" style="  position: relative; top: 3px; left: 6px;" />
51
+				<p style="font-size: 20px;max-width: 900px;"><?php _e('The upgrade process has started, please be patient and do not close this window or navigate away from this page. This could take several minutes depending on the upgrade and the size of your website. You will be automatically redirected when the upgrade is finished.', 'give'); ?>
52
+					<img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/spinner.gif'; ?>" id="give-upgrade-loader" style="  position: relative; top: 3px; left: 6px;" />
53 53
 				</p>
54 54
 
55
-				<?php if ( ! empty( $total ) ) : ?>
55
+				<?php if ( ! empty($total)) : ?>
56 56
 					<p>
57
-						<strong><?php printf( __( 'Step %d of approximately %d running', 'give' ), $step, $steps ); ?></strong>
57
+						<strong><?php printf(__('Step %d of approximately %d running', 'give'), $step, $steps); ?></strong>
58 58
 					</p>
59 59
 				<?php endif; ?>
60 60
 			</div>
@@ -68,8 +68,8 @@  discard block
 block discarded – undo
68 68
 
69 69
 			<div id="give-upgrade-status">
70 70
 				<p style="font-size: 20px;max-width: 900px;">
71
-					<?php _e( 'The upgrade process has started, please be patient and do not close this window or navigate away from this page. This could take several minutes depending on the upgrade and the size of your website. You will be automatically redirected when the upgrade is finished.', 'give' ); ?>
72
-					<img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/spinner.gif'; ?>" id="give-upgrade-loader" style="  position: relative; top: 3px; left: 6px;" />
71
+					<?php _e('The upgrade process has started, please be patient and do not close this window or navigate away from this page. This could take several minutes depending on the upgrade and the size of your website. You will be automatically redirected when the upgrade is finished.', 'give'); ?>
72
+					<img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/spinner.gif'; ?>" id="give-upgrade-loader" style="  position: relative; top: 3px; left: 6px;" />
73 73
 				</p>
74 74
 			</div>
75 75
 			<script type="text/javascript">
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -64,11 +64,14 @@
 block discarded – undo
64 64
 				}, 250 );
65 65
 			</script>
66 66
 
67
-		<?php else : ?>
67
+		<?php else {
68
+	: ?>
68 69
 
69 70
 			<div id="give-upgrade-status">
70 71
 				<p style="font-size: 20px;max-width: 900px;">
71
-					<?php _e( 'The upgrade process has started, please be patient and do not close this window or navigate away from this page. This could take several minutes depending on the upgrade and the size of your website. You will be automatically redirected when the upgrade is finished.', 'give' ); ?>
72
+					<?php _e( 'The upgrade process has started, please be patient and do not close this window or navigate away from this page. This could take several minutes depending on the upgrade and the size of your website. You will be automatically redirected when the upgrade is finished.', 'give' );
73
+}
74
+?>
72 75
 					<img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/spinner.gif'; ?>" id="give-upgrade-loader" style="  position: relative; top: 3px; left: 6px;" />
73 76
 				</p>
74 77
 			</div>
Please login to merge, or discard this patch.
includes/ajax-functions.php 1 patch
Spacing   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -25,27 +25,27 @@  discard block
 block discarded – undo
25 25
 function give_test_ajax_works() {
26 26
 
27 27
 	// Check if the Airplane Mode plugin is installed
28
-	if ( class_exists( 'Airplane_Mode_Core' ) ) {
28
+	if (class_exists('Airplane_Mode_Core')) {
29 29
 
30 30
 		$airplane = Airplane_Mode_Core::getInstance();
31 31
 
32
-		if ( method_exists( $airplane, 'enabled' ) ) {
32
+		if (method_exists($airplane, 'enabled')) {
33 33
 
34
-			if ( $airplane->enabled() ) {
34
+			if ($airplane->enabled()) {
35 35
 				return true;
36 36
 			}
37 37
 
38 38
 		} else {
39 39
 
40
-			if ( $airplane->check_status() == 'on' ) {
40
+			if ($airplane->check_status() == 'on') {
41 41
 				return true;
42 42
 			}
43 43
 		}
44 44
 	}
45 45
 
46
-	add_filter( 'block_local_requests', '__return_false' );
46
+	add_filter('block_local_requests', '__return_false');
47 47
 
48
-	if ( get_transient( '_give_ajax_works' ) ) {
48
+	if (get_transient('_give_ajax_works')) {
49 49
 		return true;
50 50
 	}
51 51
 
@@ -57,35 +57,35 @@  discard block
 block discarded – undo
57 57
 		)
58 58
 	);
59 59
 
60
-	$ajax  = wp_remote_post( give_get_ajax_url(), $params );
60
+	$ajax  = wp_remote_post(give_get_ajax_url(), $params);
61 61
 	$works = true;
62 62
 
63
-	if ( is_wp_error( $ajax ) ) {
63
+	if (is_wp_error($ajax)) {
64 64
 
65 65
 		$works = false;
66 66
 
67 67
 	} else {
68 68
 
69
-		if( empty( $ajax['response'] ) ) {
69
+		if (empty($ajax['response'])) {
70 70
 			$works = false;
71 71
 		}
72 72
 
73
-		if( empty( $ajax['response']['code'] ) || 200 !== (int) $ajax['response']['code'] ) {
73
+		if (empty($ajax['response']['code']) || 200 !== (int) $ajax['response']['code']) {
74 74
 			$works = false;
75 75
 		}
76 76
 
77
-		if( empty( $ajax['response']['message'] ) || 'OK' !== $ajax['response']['message'] ) {
77
+		if (empty($ajax['response']['message']) || 'OK' !== $ajax['response']['message']) {
78 78
 			$works = false;
79 79
 		}
80 80
 
81
-		if( ! isset( $ajax['body'] ) || 0 !== (int) $ajax['body'] ) {
81
+		if ( ! isset($ajax['body']) || 0 !== (int) $ajax['body']) {
82 82
 			$works = false;
83 83
 		}
84 84
 
85 85
 	}
86 86
 
87
-	if ( $works ) {
88
-		set_transient( '_give_ajax_works', '1', DAY_IN_SECONDS );
87
+	if ($works) {
88
+		set_transient('_give_ajax_works', '1', DAY_IN_SECONDS);
89 89
 	}
90 90
 
91 91
 	return $works;
@@ -99,16 +99,16 @@  discard block
 block discarded – undo
99 99
  * @return string
100 100
  */
101 101
 function give_get_ajax_url() {
102
-	$scheme = defined( 'FORCE_SSL_ADMIN' ) && FORCE_SSL_ADMIN ? 'https' : 'admin';
102
+	$scheme = defined('FORCE_SSL_ADMIN') && FORCE_SSL_ADMIN ? 'https' : 'admin';
103 103
 
104 104
 	$current_url = give_get_current_page_url();
105
-	$ajax_url    = admin_url( 'admin-ajax.php', $scheme );
105
+	$ajax_url    = admin_url('admin-ajax.php', $scheme);
106 106
 
107
-	if ( preg_match( '/^https/', $current_url ) && ! preg_match( '/^https/', $ajax_url ) ) {
108
-		$ajax_url = preg_replace( '/^http/', 'https', $ajax_url );
107
+	if (preg_match('/^https/', $current_url) && ! preg_match('/^https/', $ajax_url)) {
108
+		$ajax_url = preg_replace('/^http/', 'https', $ajax_url);
109 109
 	}
110 110
 
111
-	return apply_filters( 'give_ajax_url', $ajax_url );
111
+	return apply_filters('give_ajax_url', $ajax_url);
112 112
 }
113 113
 
114 114
 /**
@@ -118,11 +118,11 @@  discard block
 block discarded – undo
118 118
  * @return void
119 119
  */
120 120
 function give_load_checkout_login_fields() {
121
-	do_action( 'give_purchase_form_login_fields' );
121
+	do_action('give_purchase_form_login_fields');
122 122
 	give_die();
123 123
 }
124 124
 
125
-add_action( 'wp_ajax_nopriv_give_checkout_login', 'give_load_checkout_login_fields' );
125
+add_action('wp_ajax_nopriv_give_checkout_login', 'give_load_checkout_login_fields');
126 126
 
127 127
 /**
128 128
  * Load Checkout Register Fields via AJAX
@@ -131,11 +131,11 @@  discard block
 block discarded – undo
131 131
  * @return void
132 132
  */
133 133
 function give_load_checkout_register_fields() {
134
-	do_action( 'give_purchase_form_register_fields' );
134
+	do_action('give_purchase_form_register_fields');
135 135
 	give_die();
136 136
 }
137 137
 
138
-add_action( 'wp_ajax_nopriv_checkout_register', 'give_load_checkout_register_fields' );
138
+add_action('wp_ajax_nopriv_checkout_register', 'give_load_checkout_register_fields');
139 139
 
140 140
 /**
141 141
  * Get Form Title via AJAX (used only in WordPress Admin)
@@ -144,9 +144,9 @@  discard block
 block discarded – undo
144 144
  * @return void
145 145
  */
146 146
 function give_ajax_get_form_title() {
147
-	if ( isset( $_POST['form_id'] ) ) {
148
-		$title = get_the_title( $_POST['form_id'] );
149
-		if ( $title ) {
147
+	if (isset($_POST['form_id'])) {
148
+		$title = get_the_title($_POST['form_id']);
149
+		if ($title) {
150 150
 			echo $title;
151 151
 		} else {
152 152
 			echo 'fail';
@@ -155,8 +155,8 @@  discard block
 block discarded – undo
155 155
 	give_die();
156 156
 }
157 157
 
158
-add_action( 'wp_ajax_give_get_form_title', 'give_ajax_get_form_title' );
159
-add_action( 'wp_ajax_nopriv_give_get_form_title', 'give_ajax_get_form_title' );
158
+add_action('wp_ajax_give_get_form_title', 'give_ajax_get_form_title');
159
+add_action('wp_ajax_nopriv_give_get_form_title', 'give_ajax_get_form_title');
160 160
 
161 161
 /**
162 162
  * Retrieve a states drop down
@@ -166,23 +166,23 @@  discard block
 block discarded – undo
166 166
  */
167 167
 function give_ajax_get_states_field() {
168 168
 
169
-	if ( empty( $_POST['country'] ) ) {
169
+	if (empty($_POST['country'])) {
170 170
 		$_POST['country'] = give_get_country();
171 171
 	}
172
-	$states = give_get_states( $_POST['country'] );
172
+	$states = give_get_states($_POST['country']);
173 173
 
174
-	if ( ! empty( $states ) ) {
174
+	if ( ! empty($states)) {
175 175
 
176 176
 		$args = array(
177 177
 			'name'             => $_POST['field_name'],
178 178
 			'id'               => $_POST['field_name'],
179
-			'class'            => $_POST['field_name'] . '  give-select',
180
-			'options'          => give_get_states( $_POST['country'] ),
179
+			'class'            => $_POST['field_name'].'  give-select',
180
+			'options'          => give_get_states($_POST['country']),
181 181
 			'show_option_all'  => false,
182 182
 			'show_option_none' => false
183 183
 		);
184 184
 
185
-		$response = Give()->html->select( $args );
185
+		$response = Give()->html->select($args);
186 186
 
187 187
 	} else {
188 188
 
@@ -194,8 +194,8 @@  discard block
 block discarded – undo
194 194
 	give_die();
195 195
 }
196 196
 
197
-add_action( 'wp_ajax_give_get_states', 'give_ajax_get_states_field' );
198
-add_action( 'wp_ajax_nopriv_give_get_states', 'give_ajax_get_states_field' );
197
+add_action('wp_ajax_give_get_states', 'give_ajax_get_states_field');
198
+add_action('wp_ajax_nopriv_give_get_states', 'give_ajax_get_states_field');
199 199
 
200 200
 /**
201 201
  * Retrieve a states drop down
@@ -206,17 +206,17 @@  discard block
 block discarded – undo
206 206
 function give_ajax_form_search() {
207 207
 	global $wpdb;
208 208
 
209
-	$search  = esc_sql( sanitize_text_field( $_GET['s'] ) );
209
+	$search  = esc_sql(sanitize_text_field($_GET['s']));
210 210
 	$results = array();
211
-	if ( current_user_can( 'edit_give_forms' ) ) {
212
-		$items = $wpdb->get_results( "SELECT ID,post_title FROM $wpdb->posts WHERE `post_type` = 'give_forms' AND `post_title` LIKE '%$search%' LIMIT 50" );
211
+	if (current_user_can('edit_give_forms')) {
212
+		$items = $wpdb->get_results("SELECT ID,post_title FROM $wpdb->posts WHERE `post_type` = 'give_forms' AND `post_title` LIKE '%$search%' LIMIT 50");
213 213
 	} else {
214
-		$items = $wpdb->get_results( "SELECT ID,post_title FROM $wpdb->posts WHERE `post_type` = 'give_forms' AND `post_status` = 'publish' AND `post_title` LIKE '%$search%' LIMIT 50" );
214
+		$items = $wpdb->get_results("SELECT ID,post_title FROM $wpdb->posts WHERE `post_type` = 'give_forms' AND `post_status` = 'publish' AND `post_title` LIKE '%$search%' LIMIT 50");
215 215
 	}
216 216
 
217
-	if ( $items ) {
217
+	if ($items) {
218 218
 
219
-		foreach ( $items as $item ) {
219
+		foreach ($items as $item) {
220 220
 
221 221
 			$results[] = array(
222 222
 				'id'   => $item->ID,
@@ -228,18 +228,18 @@  discard block
 block discarded – undo
228 228
 
229 229
 		$items[] = array(
230 230
 			'id'   => 0,
231
-			'name' => __( 'No results found', 'give' )
231
+			'name' => __('No results found', 'give')
232 232
 		);
233 233
 
234 234
 	}
235 235
 
236
-	echo json_encode( $results );
236
+	echo json_encode($results);
237 237
 
238 238
 	give_die();
239 239
 }
240 240
 
241
-add_action( 'wp_ajax_give_form_search', 'give_ajax_form_search' );
242
-add_action( 'wp_ajax_nopriv_give_form_search', 'give_ajax_form_search' );
241
+add_action('wp_ajax_give_form_search', 'give_ajax_form_search');
242
+add_action('wp_ajax_nopriv_give_form_search', 'give_ajax_form_search');
243 243
 
244 244
 /**
245 245
  * Search the donors database via Ajax
@@ -250,21 +250,21 @@  discard block
 block discarded – undo
250 250
 function give_ajax_donor_search() {
251 251
 	global $wpdb;
252 252
 
253
-	$search  = esc_sql( sanitize_text_field( $_GET['s'] ) );
253
+	$search  = esc_sql(sanitize_text_field($_GET['s']));
254 254
 	$results = array();
255
-	if ( ! current_user_can( 'view_give_reports' ) ) {
255
+	if ( ! current_user_can('view_give_reports')) {
256 256
 		$donors = array();
257 257
 	} else {
258
-		$donors = $wpdb->get_results( "SELECT id,name,email FROM {$wpdb->prefix}give_donors WHERE `name` LIKE '%$search%' OR `email` LIKE '%$search%' LIMIT 50" );
258
+		$donors = $wpdb->get_results("SELECT id,name,email FROM {$wpdb->prefix}give_donors WHERE `name` LIKE '%$search%' OR `email` LIKE '%$search%' LIMIT 50");
259 259
 	}
260 260
 
261
-	if ( $donors ) {
261
+	if ($donors) {
262 262
 
263
-		foreach ( $donors as $donor ) {
263
+		foreach ($donors as $donor) {
264 264
 
265 265
 			$results[] = array(
266 266
 				'id'   => $donor->id,
267
-				'name' => $donor->name . '(' . $donor->email . ')'
267
+				'name' => $donor->name.'('.$donor->email.')'
268 268
 			);
269 269
 		}
270 270
 
@@ -272,17 +272,17 @@  discard block
 block discarded – undo
272 272
 
273 273
 		$donors[] = array(
274 274
 			'id'   => 0,
275
-			'name' => __( 'No results found', 'give' )
275
+			'name' => __('No results found', 'give')
276 276
 		);
277 277
 
278 278
 	}
279 279
 
280
-	echo json_encode( $results );
280
+	echo json_encode($results);
281 281
 
282 282
 	give_die();
283 283
 }
284 284
 
285
-add_action( 'wp_ajax_give_donor_search', 'give_ajax_donor_search' );
285
+add_action('wp_ajax_give_donor_search', 'give_ajax_donor_search');
286 286
 
287 287
 
288 288
 /**
@@ -293,30 +293,30 @@  discard block
 block discarded – undo
293 293
  */
294 294
 function give_ajax_search_users() {
295 295
 
296
-	if ( current_user_can( 'manage_give_settings' ) ) {
296
+	if (current_user_can('manage_give_settings')) {
297 297
 
298
-		$search_query = trim( $_POST['user_name'] );
298
+		$search_query = trim($_POST['user_name']);
299 299
 
300
-		$found_users = get_users( array(
300
+		$found_users = get_users(array(
301 301
 				'number' => 9999,
302
-				'search' => $search_query . '*'
302
+				'search' => $search_query.'*'
303 303
 			)
304 304
 		);
305 305
 
306 306
 		$user_list = '<ul>';
307
-		if ( $found_users ) {
308
-			foreach ( $found_users as $user ) {
309
-				$user_list .= '<li><a href="#" data-login="' . esc_attr( $user->user_login ) . '">' . esc_html( $user->user_login ) . '</a></li>';
307
+		if ($found_users) {
308
+			foreach ($found_users as $user) {
309
+				$user_list .= '<li><a href="#" data-login="'.esc_attr($user->user_login).'">'.esc_html($user->user_login).'</a></li>';
310 310
 			}
311 311
 		} else {
312
-			$user_list .= '<li>' . __( 'No users found', 'give' ) . '</li>';
312
+			$user_list .= '<li>'.__('No users found', 'give').'</li>';
313 313
 		}
314 314
 		$user_list .= '</ul>';
315 315
 
316
-		echo json_encode( array( 'results' => $user_list ) );
316
+		echo json_encode(array('results' => $user_list));
317 317
 
318 318
 	}
319 319
 	die();
320 320
 }
321 321
 
322
-add_action( 'wp_ajax_give_search_users', 'give_ajax_search_users' );
323 322
\ No newline at end of file
323
+add_action('wp_ajax_give_search_users', 'give_ajax_search_users');
324 324
\ No newline at end of file
Please login to merge, or discard this patch.
includes/api/class-give-api-v1.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) exit;
13
+if ( ! defined('ABSPATH')) exit;
14 14
 
15 15
 /**
16 16
  * Give_API_V1 Class
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,9 @@
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) exit;
13
+if ( ! defined( 'ABSPATH' ) ) {
14
+	exit;
15
+}
14 16
 
15 17
 /**
16 18
  * Give_API_V1 Class
Please login to merge, or discard this patch.
includes/class-give-customer.php 1 patch
Spacing   +126 added lines, -126 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -96,29 +96,29 @@  discard block
 block discarded – undo
96 96
 	 *
97 97
 	 * @since 1.0
98 98
 	 */
99
-	public function __construct( $_id_or_email = false, $by_user_id = false ) {
99
+	public function __construct($_id_or_email = false, $by_user_id = false) {
100 100
 
101 101
 		$this->db = new Give_DB_Customers;
102 102
 
103
-		if ( false === $_id_or_email || ( is_numeric( $_id_or_email ) && (int) $_id_or_email !== absint( $_id_or_email ) ) ) {
103
+		if (false === $_id_or_email || (is_numeric($_id_or_email) && (int) $_id_or_email !== absint($_id_or_email))) {
104 104
 			return false;
105 105
 		}
106 106
 
107
-		$by_user_id = is_bool( $by_user_id ) ? $by_user_id : false;
107
+		$by_user_id = is_bool($by_user_id) ? $by_user_id : false;
108 108
 
109
-		if ( is_numeric( $_id_or_email ) ) {
109
+		if (is_numeric($_id_or_email)) {
110 110
 			$field = $by_user_id ? 'user_id' : 'id';
111 111
 		} else {
112 112
 			$field = 'email';
113 113
 		}
114 114
 
115
-		$customer = $this->db->get_customer_by( $field, $_id_or_email );
115
+		$customer = $this->db->get_customer_by($field, $_id_or_email);
116 116
 
117
-		if ( empty( $customer ) || ! is_object( $customer ) ) {
117
+		if (empty($customer) || ! is_object($customer)) {
118 118
 			return false;
119 119
 		}
120 120
 
121
-		$this->setup_customer( $customer );
121
+		$this->setup_customer($customer);
122 122
 
123 123
 	}
124 124
 
@@ -131,15 +131,15 @@  discard block
 block discarded – undo
131 131
 	 *
132 132
 	 * @return bool             If the setup was successful or not
133 133
 	 */
134
-	private function setup_customer( $customer ) {
134
+	private function setup_customer($customer) {
135 135
 
136
-		if ( ! is_object( $customer ) ) {
136
+		if ( ! is_object($customer)) {
137 137
 			return false;
138 138
 		}
139 139
 
140
-		foreach ( $customer as $key => $value ) {
140
+		foreach ($customer as $key => $value) {
141 141
 
142
-			switch ( $key ) {
142
+			switch ($key) {
143 143
 
144 144
 				case 'notes':
145 145
 					$this->$key = $this->get_notes();
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 		}
155 155
 
156 156
 		// Customer ID and email are the only things that are necessary, make sure they exist
157
-		if ( ! empty( $this->id ) && ! empty( $this->email ) ) {
157
+		if ( ! empty($this->id) && ! empty($this->email)) {
158 158
 			return true;
159 159
 		}
160 160
 
@@ -167,15 +167,15 @@  discard block
 block discarded – undo
167 167
 	 *
168 168
 	 * @since 1.0
169 169
 	 */
170
-	public function __get( $key ) {
170
+	public function __get($key) {
171 171
 
172
-		if ( method_exists( $this, 'get_' . $key ) ) {
172
+		if (method_exists($this, 'get_'.$key)) {
173 173
 
174
-			return call_user_func( array( $this, 'get_' . $key ) );
174
+			return call_user_func(array($this, 'get_'.$key));
175 175
 
176 176
 		} else {
177 177
 
178
-			return new WP_Error( 'give-customer-invalid-property', sprintf( __( 'Can\'t get property %s', 'give' ), $key ) );
178
+			return new WP_Error('give-customer-invalid-property', sprintf(__('Can\'t get property %s', 'give'), $key));
179 179
 
180 180
 		}
181 181
 
@@ -190,9 +190,9 @@  discard block
 block discarded – undo
190 190
 	 *
191 191
 	 * @return mixed        False if not a valid creation, Customer ID if user is found or valid creation
192 192
 	 */
193
-	public function create( $data = array() ) {
193
+	public function create($data = array()) {
194 194
 
195
-		if ( $this->id != 0 || empty( $data ) ) {
195
+		if ($this->id != 0 || empty($data)) {
196 196
 			return false;
197 197
 		}
198 198
 
@@ -200,34 +200,34 @@  discard block
 block discarded – undo
200 200
 			'payment_ids' => ''
201 201
 		);
202 202
 
203
-		$args = wp_parse_args( $data, $defaults );
204
-		$args = $this->sanitize_columns( $args );
203
+		$args = wp_parse_args($data, $defaults);
204
+		$args = $this->sanitize_columns($args);
205 205
 
206
-		if ( empty( $args['email'] ) || ! is_email( $args['email'] ) ) {
206
+		if (empty($args['email']) || ! is_email($args['email'])) {
207 207
 			return false;
208 208
 		}
209 209
 
210
-		if ( ! empty( $args['payment_ids'] ) && is_array( $args['payment_ids'] ) ) {
211
-			$args['payment_ids'] = implode( ',', array_unique( array_values( $args['payment_ids'] ) ) );
210
+		if ( ! empty($args['payment_ids']) && is_array($args['payment_ids'])) {
211
+			$args['payment_ids'] = implode(',', array_unique(array_values($args['payment_ids'])));
212 212
 		}
213 213
 
214
-		do_action( 'give_customer_pre_create', $args );
214
+		do_action('give_customer_pre_create', $args);
215 215
 
216 216
 		$created = false;
217 217
 
218 218
 		// The DB class 'add' implies an update if the customer being asked to be created already exists
219
-		if ( $this->db->add( $data ) ) {
219
+		if ($this->db->add($data)) {
220 220
 
221 221
 			// We've successfully added/updated the customer, reset the class vars with the new data
222
-			$customer = $this->db->get_customer_by( 'email', $args['email'] );
222
+			$customer = $this->db->get_customer_by('email', $args['email']);
223 223
 
224 224
 			// Setup the customer data with the values from DB
225
-			$this->setup_customer( $customer );
225
+			$this->setup_customer($customer);
226 226
 
227 227
 			$created = $this->id;
228 228
 		}
229 229
 
230
-		do_action( 'give_customer_post_create', $created, $args );
230
+		do_action('give_customer_post_create', $created, $args);
231 231
 
232 232
 		return $created;
233 233
 
@@ -242,27 +242,27 @@  discard block
 block discarded – undo
242 242
 	 *
243 243
 	 * @return bool         If the update was successful or not
244 244
 	 */
245
-	public function update( $data = array() ) {
245
+	public function update($data = array()) {
246 246
 
247
-		if ( empty( $data ) ) {
247
+		if (empty($data)) {
248 248
 			return false;
249 249
 		}
250 250
 
251
-		$data = $this->sanitize_columns( $data );
251
+		$data = $this->sanitize_columns($data);
252 252
 
253
-		do_action( 'give_customer_pre_update', $this->id, $data );
253
+		do_action('give_customer_pre_update', $this->id, $data);
254 254
 
255 255
 		$updated = false;
256 256
 
257
-		if ( $this->db->update( $this->id, $data ) ) {
257
+		if ($this->db->update($this->id, $data)) {
258 258
 
259
-			$customer = $this->db->get_customer_by( 'id', $this->id );
260
-			$this->setup_customer( $customer );
259
+			$customer = $this->db->get_customer_by('id', $this->id);
260
+			$this->setup_customer($customer);
261 261
 
262 262
 			$updated = true;
263 263
 		}
264 264
 
265
-		do_action( 'give_customer_post_update', $updated, $this->id, $data );
265
+		do_action('give_customer_post_update', $updated, $this->id, $data);
266 266
 
267 267
 		return $updated;
268 268
 	}
@@ -278,44 +278,44 @@  discard block
 block discarded – undo
278 278
 	 *
279 279
 	 * @return bool            If the attachment was successfuly
280 280
 	 */
281
-	public function attach_payment( $payment_id = 0, $update_stats = true ) {
281
+	public function attach_payment($payment_id = 0, $update_stats = true) {
282 282
 
283
-		if ( empty( $payment_id ) ) {
283
+		if (empty($payment_id)) {
284 284
 			return false;
285 285
 		}
286 286
 
287
-		if ( empty( $this->payment_ids ) ) {
287
+		if (empty($this->payment_ids)) {
288 288
 
289 289
 			$new_payment_ids = $payment_id;
290 290
 
291 291
 		} else {
292 292
 
293
-			$payment_ids = array_map( 'absint', explode( ',', $this->payment_ids ) );
293
+			$payment_ids = array_map('absint', explode(',', $this->payment_ids));
294 294
 
295
-			if ( in_array( $payment_id, $payment_ids ) ) {
295
+			if (in_array($payment_id, $payment_ids)) {
296 296
 				$update_stats = false;
297 297
 			}
298 298
 
299 299
 			$payment_ids[] = $payment_id;
300 300
 
301
-			$new_payment_ids = implode( ',', array_unique( array_values( $payment_ids ) ) );
301
+			$new_payment_ids = implode(',', array_unique(array_values($payment_ids)));
302 302
 
303 303
 		}
304 304
 
305
-		do_action( 'give_customer_pre_attach_payment', $payment_id, $this->id );
305
+		do_action('give_customer_pre_attach_payment', $payment_id, $this->id);
306 306
 
307
-		$payment_added = $this->update( array( 'payment_ids' => $new_payment_ids ) );
307
+		$payment_added = $this->update(array('payment_ids' => $new_payment_ids));
308 308
 
309
-		if ( $payment_added ) {
309
+		if ($payment_added) {
310 310
 
311 311
 			$this->payment_ids = $new_payment_ids;
312 312
 
313 313
 			// We added this payment successfully, increment the stats
314
-			if ( $update_stats ) {
315
-				$payment_amount = give_get_payment_amount( $payment_id );
314
+			if ($update_stats) {
315
+				$payment_amount = give_get_payment_amount($payment_id);
316 316
 
317
-				if ( ! empty( $payment_amount ) ) {
318
-					$this->increase_value( $payment_amount );
317
+				if ( ! empty($payment_amount)) {
318
+					$this->increase_value($payment_amount);
319 319
 				}
320 320
 
321 321
 				$this->increase_purchase_count();
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 
324 324
 		}
325 325
 
326
-		do_action( 'give_customer_post_attach_payment', $payment_added, $payment_id, $this->id );
326
+		do_action('give_customer_post_attach_payment', $payment_added, $payment_id, $this->id);
327 327
 
328 328
 		return $payment_added;
329 329
 	}
@@ -339,44 +339,44 @@  discard block
 block discarded – undo
339 339
 	 *
340 340
 	 * @return boolean             If the removal was successful
341 341
 	 */
342
-	public function remove_payment( $payment_id = 0, $update_stats = true ) {
342
+	public function remove_payment($payment_id = 0, $update_stats = true) {
343 343
 
344
-		if ( empty( $payment_id ) ) {
344
+		if (empty($payment_id)) {
345 345
 			return false;
346 346
 		}
347 347
 
348 348
 		$new_payment_ids = '';
349 349
 
350
-		if ( ! empty( $this->payment_ids ) ) {
350
+		if ( ! empty($this->payment_ids)) {
351 351
 
352
-			$payment_ids = array_map( 'absint', explode( ',', $this->payment_ids ) );
352
+			$payment_ids = array_map('absint', explode(',', $this->payment_ids));
353 353
 
354
-			$pos = array_search( $payment_id, $payment_ids );
355
-			if ( false === $pos ) {
354
+			$pos = array_search($payment_id, $payment_ids);
355
+			if (false === $pos) {
356 356
 				return false;
357 357
 			}
358 358
 
359
-			unset( $payment_ids[ $pos ] );
360
-			$payment_ids = array_filter( $payment_ids );
359
+			unset($payment_ids[$pos]);
360
+			$payment_ids = array_filter($payment_ids);
361 361
 
362
-			$new_payment_ids = implode( ',', array_unique( array_values( $payment_ids ) ) );
362
+			$new_payment_ids = implode(',', array_unique(array_values($payment_ids)));
363 363
 
364 364
 		}
365 365
 
366
-		do_action( 'give_customer_pre_remove_payment', $payment_id, $this->id );
366
+		do_action('give_customer_pre_remove_payment', $payment_id, $this->id);
367 367
 
368
-		$payment_removed = $this->update( array( 'payment_ids' => $new_payment_ids ) );
368
+		$payment_removed = $this->update(array('payment_ids' => $new_payment_ids));
369 369
 
370
-		if ( $payment_removed ) {
370
+		if ($payment_removed) {
371 371
 
372 372
 			$this->payment_ids = $new_payment_ids;
373 373
 
374
-			if ( $update_stats ) {
374
+			if ($update_stats) {
375 375
 				// We removed this payment successfully, decrement the stats
376
-				$payment_amount = give_get_payment_amount( $payment_id );
376
+				$payment_amount = give_get_payment_amount($payment_id);
377 377
 
378
-				if ( ! empty( $payment_amount ) ) {
379
-					$this->decrease_value( $payment_amount );
378
+				if ( ! empty($payment_amount)) {
379
+					$this->decrease_value($payment_amount);
380 380
 				}
381 381
 
382 382
 				$this->decrease_purchase_count();
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
 
385 385
 		}
386 386
 
387
-		do_action( 'give_customer_post_remove_payment', $payment_removed, $payment_id, $this->id );
387
+		do_action('give_customer_post_remove_payment', $payment_removed, $payment_id, $this->id);
388 388
 
389 389
 		return $payment_removed;
390 390
 
@@ -399,22 +399,22 @@  discard block
 block discarded – undo
399 399
 	 *
400 400
 	 * @return int            The purchase count
401 401
 	 */
402
-	public function increase_purchase_count( $count = 1 ) {
402
+	public function increase_purchase_count($count = 1) {
403 403
 
404 404
 		// Make sure it's numeric and not negative
405
-		if ( ! is_numeric( $count ) || $count != absint( $count ) ) {
405
+		if ( ! is_numeric($count) || $count != absint($count)) {
406 406
 			return false;
407 407
 		}
408 408
 
409 409
 		$new_total = (int) $this->purchase_count + (int) $count;
410 410
 
411
-		do_action( 'give_customer_pre_increase_purchase_count', $count, $this->id );
411
+		do_action('give_customer_pre_increase_purchase_count', $count, $this->id);
412 412
 
413
-		if ( $this->update( array( 'purchase_count' => $new_total ) ) ) {
413
+		if ($this->update(array('purchase_count' => $new_total))) {
414 414
 			$this->purchase_count = $new_total;
415 415
 		}
416 416
 
417
-		do_action( 'give_customer_post_increase_purchase_count', $this->purchase_count, $count, $this->id );
417
+		do_action('give_customer_post_increase_purchase_count', $this->purchase_count, $count, $this->id);
418 418
 
419 419
 		return $this->purchase_count;
420 420
 	}
@@ -428,26 +428,26 @@  discard block
 block discarded – undo
428 428
 	 *
429 429
 	 * @return mixed          If successful, the new count, otherwise false
430 430
 	 */
431
-	public function decrease_purchase_count( $count = 1 ) {
431
+	public function decrease_purchase_count($count = 1) {
432 432
 
433 433
 		// Make sure it's numeric and not negative
434
-		if ( ! is_numeric( $count ) || $count != absint( $count ) ) {
434
+		if ( ! is_numeric($count) || $count != absint($count)) {
435 435
 			return false;
436 436
 		}
437 437
 
438 438
 		$new_total = (int) $this->purchase_count - (int) $count;
439 439
 
440
-		if ( $new_total < 0 ) {
440
+		if ($new_total < 0) {
441 441
 			$new_total = 0;
442 442
 		}
443 443
 
444
-		do_action( 'give_customer_pre_decrease_purchase_count', $count, $this->id );
444
+		do_action('give_customer_pre_decrease_purchase_count', $count, $this->id);
445 445
 
446
-		if ( $this->update( array( 'purchase_count' => $new_total ) ) ) {
446
+		if ($this->update(array('purchase_count' => $new_total))) {
447 447
 			$this->purchase_count = $new_total;
448 448
 		}
449 449
 
450
-		do_action( 'give_customer_post_decrease_purchase_count', $this->purchase_count, $count, $this->id );
450
+		do_action('give_customer_post_decrease_purchase_count', $this->purchase_count, $count, $this->id);
451 451
 
452 452
 		return $this->purchase_count;
453 453
 	}
@@ -461,17 +461,17 @@  discard block
 block discarded – undo
461 461
 	 *
462 462
 	 * @return mixed         If successful, the new value, otherwise false
463 463
 	 */
464
-	public function increase_value( $value = 0.00 ) {
464
+	public function increase_value($value = 0.00) {
465 465
 
466
-		$new_value = floatval( $this->purchase_value ) + $value;
466
+		$new_value = floatval($this->purchase_value) + $value;
467 467
 
468
-		do_action( 'give_customer_pre_increase_value', $value, $this->id );
468
+		do_action('give_customer_pre_increase_value', $value, $this->id);
469 469
 
470
-		if ( $this->update( array( 'purchase_value' => $new_value ) ) ) {
470
+		if ($this->update(array('purchase_value' => $new_value))) {
471 471
 			$this->purchase_value = $new_value;
472 472
 		}
473 473
 
474
-		do_action( 'give_customer_post_increase_value', $this->purchase_value, $value, $this->id );
474
+		do_action('give_customer_post_increase_value', $this->purchase_value, $value, $this->id);
475 475
 
476 476
 		return $this->purchase_value;
477 477
 	}
@@ -485,21 +485,21 @@  discard block
 block discarded – undo
485 485
 	 *
486 486
 	 * @return mixed         If successful, the new value, otherwise false
487 487
 	 */
488
-	public function decrease_value( $value = 0.00 ) {
488
+	public function decrease_value($value = 0.00) {
489 489
 
490
-		$new_value = floatval( $this->purchase_value ) - $value;
490
+		$new_value = floatval($this->purchase_value) - $value;
491 491
 
492
-		if ( $new_value < 0 ) {
492
+		if ($new_value < 0) {
493 493
 			$new_value = 0.00;
494 494
 		}
495 495
 
496
-		do_action( 'give_customer_pre_decrease_value', $value, $this->id );
496
+		do_action('give_customer_pre_decrease_value', $value, $this->id);
497 497
 
498
-		if ( $this->update( array( 'purchase_value' => $new_value ) ) ) {
498
+		if ($this->update(array('purchase_value' => $new_value))) {
499 499
 			$this->purchase_value = $new_value;
500 500
 		}
501 501
 
502
-		do_action( 'give_customer_post_decrease_value', $this->purchase_value, $value, $this->id );
502
+		do_action('give_customer_post_decrease_value', $this->purchase_value, $value, $this->id);
503 503
 
504 504
 		return $this->purchase_value;
505 505
 	}
@@ -514,15 +514,15 @@  discard block
 block discarded – undo
514 514
 	 *
515 515
 	 * @return array           The notes requsted
516 516
 	 */
517
-	public function get_notes( $length = 20, $paged = 1 ) {
517
+	public function get_notes($length = 20, $paged = 1) {
518 518
 
519
-		$length = is_numeric( $length ) ? $length : 20;
520
-		$offset = is_numeric( $paged ) && $paged != 1 ? ( ( absint( $paged ) - 1 ) * $length ) : 0;
519
+		$length = is_numeric($length) ? $length : 20;
520
+		$offset = is_numeric($paged) && $paged != 1 ? ((absint($paged) - 1) * $length) : 0;
521 521
 
522 522
 		$all_notes   = $this->get_raw_notes();
523
-		$notes_array = array_reverse( array_filter( explode( "\n\n", $all_notes ) ) );
523
+		$notes_array = array_reverse(array_filter(explode("\n\n", $all_notes)));
524 524
 
525
-		$desired_notes = array_slice( $notes_array, $offset, $length );
525
+		$desired_notes = array_slice($notes_array, $offset, $length);
526 526
 
527 527
 		return $desired_notes;
528 528
 
@@ -537,9 +537,9 @@  discard block
 block discarded – undo
537 537
 	public function get_notes_count() {
538 538
 
539 539
 		$all_notes   = $this->get_raw_notes();
540
-		$notes_array = array_reverse( array_filter( explode( "\n\n", $all_notes ) ) );
540
+		$notes_array = array_reverse(array_filter(explode("\n\n", $all_notes)));
541 541
 
542
-		return count( $notes_array );
542
+		return count($notes_array);
543 543
 
544 544
 	}
545 545
 
@@ -552,32 +552,32 @@  discard block
 block discarded – undo
552 552
 	 *
553 553
 	 * @return string|boolean The new note if added succesfully, false otherwise
554 554
 	 */
555
-	public function add_note( $note = '' ) {
555
+	public function add_note($note = '') {
556 556
 
557
-		$note = trim( $note );
558
-		if ( empty( $note ) ) {
557
+		$note = trim($note);
558
+		if (empty($note)) {
559 559
 			return false;
560 560
 		}
561 561
 
562 562
 		$notes = $this->get_raw_notes();
563 563
 
564
-		if ( empty( $notes ) ) {
564
+		if (empty($notes)) {
565 565
 			$notes = '';
566 566
 		}
567 567
 
568
-		$note_string = date_i18n( 'F j, Y H:i:s', current_time( 'timestamp' ) ) . ' - ' . $note;
569
-		$new_note    = apply_filters( 'give_customer_add_note_string', $note_string );
570
-		$notes .= "\n\n" . $new_note;
568
+		$note_string = date_i18n('F j, Y H:i:s', current_time('timestamp')).' - '.$note;
569
+		$new_note    = apply_filters('give_customer_add_note_string', $note_string);
570
+		$notes .= "\n\n".$new_note;
571 571
 
572
-		do_action( 'give_customer_pre_add_note', $new_note, $this->id );
572
+		do_action('give_customer_pre_add_note', $new_note, $this->id);
573 573
 
574
-		$updated = $this->update( array( 'notes' => $notes ) );
574
+		$updated = $this->update(array('notes' => $notes));
575 575
 
576
-		if ( $updated ) {
576
+		if ($updated) {
577 577
 			$this->notes = $this->get_notes();
578 578
 		}
579 579
 
580
-		do_action( 'give_customer_post_add_note', $this->notes, $new_note, $this->id );
580
+		do_action('give_customer_post_add_note', $this->notes, $new_note, $this->id);
581 581
 
582 582
 		// Return the formatted note, so we can test, as well as update any displays
583 583
 		return $new_note;
@@ -592,7 +592,7 @@  discard block
 block discarded – undo
592 592
 	 */
593 593
 	private function get_raw_notes() {
594 594
 
595
-		$all_notes = $this->db->get_column( 'notes', $this->id );
595
+		$all_notes = $this->db->get_column('notes', $this->id);
596 596
 
597 597
 		return $all_notes;
598 598
 
@@ -607,51 +607,51 @@  discard block
 block discarded – undo
607 607
 	 *
608 608
 	 * @return array       The sanitized data, based off column defaults
609 609
 	 */
610
-	private function sanitize_columns( $data ) {
610
+	private function sanitize_columns($data) {
611 611
 
612 612
 		$columns        = $this->db->get_columns();
613 613
 		$default_values = $this->db->get_column_defaults();
614 614
 
615
-		foreach ( $columns as $key => $type ) {
615
+		foreach ($columns as $key => $type) {
616 616
 
617 617
 			// Only sanitize data that we were provided
618
-			if ( ! array_key_exists( $key, $data ) ) {
618
+			if ( ! array_key_exists($key, $data)) {
619 619
 				continue;
620 620
 			}
621 621
 
622
-			switch ( $type ) {
622
+			switch ($type) {
623 623
 
624 624
 				case '%s':
625
-					if ( 'email' == $key ) {
626
-						$data[ $key ] = sanitize_email( $data[ $key ] );
627
-					} elseif ( 'notes' == $key ) {
628
-						$data[ $key ] = strip_tags( $data[ $key ] );
625
+					if ('email' == $key) {
626
+						$data[$key] = sanitize_email($data[$key]);
627
+					} elseif ('notes' == $key) {
628
+						$data[$key] = strip_tags($data[$key]);
629 629
 					} else {
630
-						$data[ $key ] = sanitize_text_field( $data[ $key ] );
630
+						$data[$key] = sanitize_text_field($data[$key]);
631 631
 					}
632 632
 					break;
633 633
 
634 634
 				case '%d':
635
-					if ( ! is_numeric( $data[ $key ] ) || (int) $data[ $key ] !== absint( $data[ $key ] ) ) {
636
-						$data[ $key ] = $default_values[ $key ];
635
+					if ( ! is_numeric($data[$key]) || (int) $data[$key] !== absint($data[$key])) {
636
+						$data[$key] = $default_values[$key];
637 637
 					} else {
638
-						$data[ $key ] = absint( $data[ $key ] );
638
+						$data[$key] = absint($data[$key]);
639 639
 					}
640 640
 					break;
641 641
 
642 642
 				case '%f':
643 643
 					// Convert what was given to a float
644
-					$value = floatval( $data[ $key ] );
644
+					$value = floatval($data[$key]);
645 645
 
646
-					if ( ! is_float( $value ) ) {
647
-						$data[ $key ] = $default_values[ $key ];
646
+					if ( ! is_float($value)) {
647
+						$data[$key] = $default_values[$key];
648 648
 					} else {
649
-						$data[ $key ] = $value;
649
+						$data[$key] = $value;
650 650
 					}
651 651
 					break;
652 652
 
653 653
 				default:
654
-					$data[ $key ] = sanitize_text_field( $data[ $key ] );
654
+					$data[$key] = sanitize_text_field($data[$key]);
655 655
 					break;
656 656
 
657 657
 			}
Please login to merge, or discard this patch.