Completed
Push — master ( ff09a8...afcc86 )
by Devin
53:00 queued 33:00
created
includes/admin/reporting/tools/class-give-tools-recount-form-stats.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
 	 * @since 1.5
51 51
 	 * @global object $wpdb Used to query the database using the WordPress
52 52
 	 *   Database API
53
-	 * @return array $data The data for the CSV file
53
+	 * @return boolean $data The data for the CSV file
54 54
 	 */
55 55
 	public function get_data() {
56 56
 		global $wpdb;
Please login to merge, or discard this patch.
Spacing   +66 added lines, -66 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
 
@@ -62,23 +62,23 @@  discard block
 block discarded – undo
62 62
 	public function get_data() {
63 63
 		global $give_logs, $wpdb;
64 64
 
65
-		$accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish' ) );
65
+		$accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish'));
66 66
 
67
-		if ( $this->step == 1 ) {
68
-			$this->delete_data( 'give_temp_recount_form_stats' );
67
+		if ($this->step == 1) {
68
+			$this->delete_data('give_temp_recount_form_stats');
69 69
 		}
70 70
 
71
-		$totals = $this->get_stored_data( 'give_temp_recount_form_stats' );
71
+		$totals = $this->get_stored_data('give_temp_recount_form_stats');
72 72
 
73
-		if ( false === $totals ) {
73
+		if (false === $totals) {
74 74
 			$totals = array(
75 75
 				'earnings' => (float) 0,
76 76
 				'sales'    => 0,
77 77
 			);
78
-			$this->store_data( 'give_temp_recount_form_stats', $totals );
78
+			$this->store_data('give_temp_recount_form_stats', $totals);
79 79
 		}
80 80
 
81
-		$args = apply_filters( 'give_recount_form_stats_args', array(
81
+		$args = apply_filters('give_recount_form_stats_args', array(
82 82
 			'post_parent'    => $this->form_id,
83 83
 			'post_type'      => 'give_log',
84 84
 			'posts_per_page' => $this->per_step,
@@ -86,49 +86,49 @@  discard block
 block discarded – undo
86 86
 			'paged'          => $this->step,
87 87
 			'log_type'       => 'sale',
88 88
 			'fields'         => 'ids',
89
-		) );
89
+		));
90 90
 
91
-		$log_ids              = $give_logs->get_connected_logs( $args, 'sale' );
91
+		$log_ids              = $give_logs->get_connected_logs($args, 'sale');
92 92
 		$this->_log_ids_debug = array();
93 93
 
94
-		if ( $log_ids ) {
95
-			$log_ids     = implode( ',', $log_ids );
96
-			$payment_ids = $wpdb->get_col( "SELECT meta_value FROM $wpdb->postmeta WHERE meta_key='_give_log_payment_id' AND post_id IN ($log_ids)" );
97
-			unset( $log_ids );
94
+		if ($log_ids) {
95
+			$log_ids     = implode(',', $log_ids);
96
+			$payment_ids = $wpdb->get_col("SELECT meta_value FROM $wpdb->postmeta WHERE meta_key='_give_log_payment_id' AND post_id IN ($log_ids)");
97
+			unset($log_ids);
98 98
 
99
-			$payment_ids = implode( ',', $payment_ids );
100
-			$payments    = $wpdb->get_results( "SELECT ID, post_status FROM $wpdb->posts WHERE ID IN (" . $payment_ids . ")" );
101
-			unset( $payment_ids );
99
+			$payment_ids = implode(',', $payment_ids);
100
+			$payments    = $wpdb->get_results("SELECT ID, post_status FROM $wpdb->posts WHERE ID IN (".$payment_ids.")");
101
+			unset($payment_ids);
102 102
 
103
-			foreach ( $payments as $payment ) {
103
+			foreach ($payments as $payment) {
104 104
 
105
-				$payment = new Give_Payment( $payment->ID );
105
+				$payment = new Give_Payment($payment->ID);
106 106
 
107 107
 				//Ensure acceptible status only
108
-				if ( ! in_array( $payment->post_status, $accepted_statuses ) ) {
108
+				if ( ! in_array($payment->post_status, $accepted_statuses)) {
109 109
 					continue;
110 110
 				}
111 111
 
112 112
 				//Ensure only payments for this form are counted
113
-				if ( $payment->form_id != $this->form_id ) {
113
+				if ($payment->form_id != $this->form_id) {
114 114
 					continue;
115 115
 				}
116 116
 
117 117
 				$this->_log_ids_debug[] = $payment->ID;
118 118
 
119
-				$totals['sales'] ++;
119
+				$totals['sales']++;
120 120
 				$totals['earnings'] += $payment->total;
121 121
 
122 122
 			}
123 123
 
124
-			$this->store_data( 'give_temp_recount_form_stats', $totals );
124
+			$this->store_data('give_temp_recount_form_stats', $totals);
125 125
 
126 126
 			return true;
127 127
 		}
128 128
 
129 129
 
130
-		update_post_meta( $this->form_id, '_give_form_sales', $totals['sales'] );
131
-		update_post_meta( $this->form_id, '_give_form_earnings', $totals['earnings'] );
130
+		update_post_meta($this->form_id, '_give_form_sales', $totals['sales']);
131
+		update_post_meta($this->form_id, '_give_form_earnings', $totals['earnings']);
132 132
 
133 133
 		return false;
134 134
 
@@ -143,54 +143,54 @@  discard block
 block discarded – undo
143 143
 	public function get_percentage_complete() {
144 144
 		global $give_logs, $wpdb;
145 145
 
146
-		if ( $this->step == 1 ) {
147
-			$this->delete_data( 'give_recount_total_' . $this->form_id );
146
+		if ($this->step == 1) {
147
+			$this->delete_data('give_recount_total_'.$this->form_id);
148 148
 		}
149 149
 
150
-		$accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish' ) );
151
-		$total             = $this->get_stored_data( 'give_recount_total_' . $this->form_id );
150
+		$accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish'));
151
+		$total             = $this->get_stored_data('give_recount_total_'.$this->form_id);
152 152
 
153
-		if ( false === $total ) {
153
+		if (false === $total) {
154 154
 			$total = 0;
155
-			$args  = apply_filters( 'give_recount_form_stats_total_args', array(
155
+			$args  = apply_filters('give_recount_form_stats_total_args', array(
156 156
 				'post_parent' => $this->form_id,
157 157
 				'post_type'   => 'give_log',
158 158
 				'post_status' => 'publish',
159 159
 				'log_type'    => 'sale',
160 160
 				'fields'      => 'ids',
161 161
 				'nopaging'    => true,
162
-			) );
162
+			));
163 163
 
164
-			$log_ids = $give_logs->get_connected_logs( $args, 'sale' );
164
+			$log_ids = $give_logs->get_connected_logs($args, 'sale');
165 165
 
166
-			if ( $log_ids ) {
167
-				$log_ids     = implode( ',', $log_ids );
168
-				$payment_ids = $wpdb->get_col( "SELECT meta_value FROM $wpdb->postmeta WHERE meta_key='_give_log_payment_id' AND post_id IN ($log_ids)" );
169
-				unset( $log_ids );
166
+			if ($log_ids) {
167
+				$log_ids     = implode(',', $log_ids);
168
+				$payment_ids = $wpdb->get_col("SELECT meta_value FROM $wpdb->postmeta WHERE meta_key='_give_log_payment_id' AND post_id IN ($log_ids)");
169
+				unset($log_ids);
170 170
 
171
-				$payment_ids = implode( ',', $payment_ids );
172
-				$payments    = $wpdb->get_results( "SELECT ID, post_status FROM $wpdb->posts WHERE ID IN (" . $payment_ids . ")" );
173
-				unset( $payment_ids );
171
+				$payment_ids = implode(',', $payment_ids);
172
+				$payments    = $wpdb->get_results("SELECT ID, post_status FROM $wpdb->posts WHERE ID IN (".$payment_ids.")");
173
+				unset($payment_ids);
174 174
 
175
-				foreach ( $payments as $payment ) {
176
-					if ( in_array( $payment->post_status, $accepted_statuses ) ) {
175
+				foreach ($payments as $payment) {
176
+					if (in_array($payment->post_status, $accepted_statuses)) {
177 177
 						continue;
178 178
 					}
179 179
 
180
-					$total ++;
180
+					$total++;
181 181
 				}
182 182
 			}
183 183
 
184
-			$this->store_data( 'give_recount_total_' . $this->form_id, $total );
184
+			$this->store_data('give_recount_total_'.$this->form_id, $total);
185 185
 		}
186 186
 
187 187
 		$percentage = 100;
188 188
 
189
-		if ( $total > 0 ) {
190
-			$percentage = ( ( $this->per_step * $this->step ) / $total ) * 100;
189
+		if ($total > 0) {
190
+			$percentage = (($this->per_step * $this->step) / $total) * 100;
191 191
 		}
192 192
 
193
-		if ( $percentage > 100 ) {
193
+		if ($percentage > 100) {
194 194
 			$percentage = 100;
195 195
 		}
196 196
 
@@ -204,8 +204,8 @@  discard block
 block discarded – undo
204 204
 	 *
205 205
 	 * @param array $request The Form Data passed into the batch processing
206 206
 	 */
207
-	public function set_properties( $request ) {
208
-		$this->form_id = isset( $request['form_id'] ) ? sanitize_text_field( $request['form_id'] ) : false;
207
+	public function set_properties($request) {
208
+		$this->form_id = isset($request['form_id']) ? sanitize_text_field($request['form_id']) : false;
209 209
 	}
210 210
 
211 211
 	/**
@@ -216,31 +216,31 @@  discard block
 block discarded – undo
216 216
 	 */
217 217
 	public function process_step() {
218 218
 
219
-		if ( ! $this->can_export() ) {
220
-			wp_die( esc_html__( 'You do not have permission to recount stats.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
219
+		if ( ! $this->can_export()) {
220
+			wp_die(esc_html__('You do not have permission to recount stats.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
221 221
 		}
222 222
 
223 223
 		$had_data = $this->get_data();
224 224
 
225
-		if ( $had_data ) {
225
+		if ($had_data) {
226 226
 			$this->done = false;
227 227
 
228 228
 			return true;
229 229
 		} else {
230
-			$this->delete_data( 'give_recount_total_' . $this->form_id );
231
-			$this->delete_data( 'give_temp_recount_form_stats' );
230
+			$this->delete_data('give_recount_total_'.$this->form_id);
231
+			$this->delete_data('give_temp_recount_form_stats');
232 232
 			$this->done    = true;
233
-			$this->message = sprintf( esc_html__( 'Donation counts and income amount statistics successfully recounted for "%s".', 'give' ), get_the_title( $this->form_id ) );
233
+			$this->message = sprintf(esc_html__('Donation counts and income amount statistics successfully recounted for "%s".', 'give'), get_the_title($this->form_id));
234 234
 
235 235
 			return false;
236 236
 		}
237 237
 	}
238 238
 
239 239
 	public function headers() {
240
-		ignore_user_abort( true );
240
+		ignore_user_abort(true);
241 241
 
242
-		if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
243
-			set_time_limit( 0 );
242
+		if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
243
+			set_time_limit(0);
244 244
 		}
245 245
 	}
246 246
 
@@ -268,11 +268,11 @@  discard block
 block discarded – undo
268 268
 	 *
269 269
 	 * @return mixed       Returns the data from the database
270 270
 	 */
271
-	private function get_stored_data( $key ) {
271
+	private function get_stored_data($key) {
272 272
 		global $wpdb;
273
-		$value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) );
273
+		$value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key));
274 274
 
275
-		return empty( $value ) ? false : maybe_unserialize( $value );
275
+		return empty($value) ? false : maybe_unserialize($value);
276 276
 	}
277 277
 
278 278
 	/**
@@ -285,10 +285,10 @@  discard block
 block discarded – undo
285 285
 	 *
286 286
 	 * @return void
287 287
 	 */
288
-	private function store_data( $key, $value ) {
288
+	private function store_data($key, $value) {
289 289
 		global $wpdb;
290 290
 
291
-		$value = maybe_serialize( $value );
291
+		$value = maybe_serialize($value);
292 292
 
293 293
 		$data = array(
294 294
 			'option_name'  => $key,
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 			'%s',
303 303
 		);
304 304
 
305
-		$wpdb->replace( $wpdb->options, $data, $formats );
305
+		$wpdb->replace($wpdb->options, $data, $formats);
306 306
 	}
307 307
 
308 308
 	/**
@@ -314,9 +314,9 @@  discard block
 block discarded – undo
314 314
 	 *
315 315
 	 * @return void
316 316
 	 */
317
-	private function delete_data( $key ) {
317
+	private function delete_data($key) {
318 318
 		global $wpdb;
319
-		$wpdb->delete( $wpdb->options, array( 'option_name' => $key ) );
319
+		$wpdb->delete($wpdb->options, array('option_name' => $key));
320 320
 	}
321 321
 
322 322
 }
Please login to merge, or discard this patch.
includes/admin/reporting/tools/class-give-tools-recount-income.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
 	 * @since 1.5
51 51
 	 * @global object $wpdb Used to query the database using the WordPress
52 52
 	 *   Database API
53
-	 * @return array $data The data for the CSV file
53
+	 * @return boolean $data The data for the CSV file
54 54
 	 */
55 55
 	public function get_data() {
56 56
 		global $wpdb;
Please login to merge, or discard this patch.
Spacing   +46 added lines, -46 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
 
@@ -54,50 +54,50 @@  discard block
 block discarded – undo
54 54
 	 */
55 55
 	public function get_data() {
56 56
 
57
-		if ( $this->step == 1 ) {
58
-			$this->delete_data( 'give_temp_recount_income' );
57
+		if ($this->step == 1) {
58
+			$this->delete_data('give_temp_recount_income');
59 59
 		}
60 60
 
61
-		$total = get_option( 'give_temp_recount_income', false );
61
+		$total = get_option('give_temp_recount_income', false);
62 62
 
63
-		if ( false === $total ) {
63
+		if (false === $total) {
64 64
 			$total = (float) 0;
65
-			$this->store_data( 'give_temp_recount_income', $total );
65
+			$this->store_data('give_temp_recount_income', $total);
66 66
 		}
67 67
 
68
-		$accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish' ) );
68
+		$accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish'));
69 69
 
70
-		$args = apply_filters( 'give_recount_income_args', array(
70
+		$args = apply_filters('give_recount_income_args', array(
71 71
 			'number' => $this->per_step,
72 72
 			'page'   => $this->step,
73 73
 			'status' => $accepted_statuses,
74 74
 			'fields' => 'ids'
75
-		) );
75
+		));
76 76
 
77
-		$payments = give_get_payments( $args );
77
+		$payments = give_get_payments($args);
78 78
 
79
-		if ( ! empty( $payments ) ) {
79
+		if ( ! empty($payments)) {
80 80
 
81
-			foreach ( $payments as $payment ) {
81
+			foreach ($payments as $payment) {
82 82
 
83
-				$total += give_get_payment_amount( $payment );
83
+				$total += give_get_payment_amount($payment);
84 84
 
85 85
 			}
86 86
 
87
-			if ( $total < 0 ) {
87
+			if ($total < 0) {
88 88
 				$totals = 0;
89 89
 			}
90 90
 
91
-			$total = round( $total, give_currency_decimal_filter() );
91
+			$total = round($total, give_currency_decimal_filter());
92 92
 
93
-			$this->store_data( 'give_temp_recount_income', $total );
93
+			$this->store_data('give_temp_recount_income', $total);
94 94
 
95 95
 			return true;
96 96
 
97 97
 		}
98 98
 
99
-		update_option( 'give_income_total', $total );
100
-		set_transient( 'give_income_total', $total, 86400 );
99
+		update_option('give_income_total', $total);
100
+		set_transient('give_income_total', $total, 86400);
101 101
 
102 102
 		return false;
103 103
 
@@ -111,25 +111,25 @@  discard block
 block discarded – undo
111 111
 	 */
112 112
 	public function get_percentage_complete() {
113 113
 
114
-		$total = $this->get_stored_data( 'give_recount_income_total' );
114
+		$total = $this->get_stored_data('give_recount_income_total');
115 115
 
116
-		if ( false === $total ) {
117
-			$args = apply_filters( 'give_recount_income_total_args', array() );
116
+		if (false === $total) {
117
+			$args = apply_filters('give_recount_income_total_args', array());
118 118
 
119
-			$counts = give_count_payments( $args );
120
-			$total  = absint( $counts->publish );
121
-			$total  = apply_filters( 'give_recount_store_income_total', $total );
119
+			$counts = give_count_payments($args);
120
+			$total  = absint($counts->publish);
121
+			$total  = apply_filters('give_recount_store_income_total', $total);
122 122
 
123
-			$this->store_data( 'give_recount_income_total', $total );
123
+			$this->store_data('give_recount_income_total', $total);
124 124
 		}
125 125
 
126 126
 		$percentage = 100;
127 127
 
128
-		if ( $total > 0 ) {
129
-			$percentage = ( ( $this->per_step * $this->step ) / $total ) * 100;
128
+		if ($total > 0) {
129
+			$percentage = (($this->per_step * $this->step) / $total) * 100;
130 130
 		}
131 131
 
132
-		if ( $percentage > 100 ) {
132
+		if ($percentage > 100) {
133 133
 			$percentage = 100;
134 134
 		}
135 135
 
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 	 *
144 144
 	 * @param array $request The Form Data passed into the batch processing
145 145
 	 */
146
-	public function set_properties( $request ) {
146
+	public function set_properties($request) {
147 147
 	}
148 148
 
149 149
 	/**
@@ -154,31 +154,31 @@  discard block
 block discarded – undo
154 154
 	 */
155 155
 	public function process_step() {
156 156
 
157
-		if ( ! $this->can_export() ) {
158
-			wp_die( esc_html__( 'You do not have permission to recount stats.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
157
+		if ( ! $this->can_export()) {
158
+			wp_die(esc_html__('You do not have permission to recount stats.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
159 159
 		}
160 160
 
161 161
 		$had_data = $this->get_data();
162 162
 
163
-		if ( $had_data ) {
163
+		if ($had_data) {
164 164
 			$this->done = false;
165 165
 
166 166
 			return true;
167 167
 		} else {
168
-			$this->delete_data( 'give_recount_income_total' );
169
-			$this->delete_data( 'give_temp_recount_income' );
168
+			$this->delete_data('give_recount_income_total');
169
+			$this->delete_data('give_temp_recount_income');
170 170
 			$this->done    = true;
171
-			$this->message = esc_html__( 'Give income successfully recounted.', 'give' );
171
+			$this->message = esc_html__('Give income successfully recounted.', 'give');
172 172
 
173 173
 			return false;
174 174
 		}
175 175
 	}
176 176
 
177 177
 	public function headers() {
178
-		ignore_user_abort( true );
178
+		ignore_user_abort(true);
179 179
 
180
-		if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
181
-			set_time_limit( 0 );
180
+		if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
181
+			set_time_limit(0);
182 182
 		}
183 183
 	}
184 184
 
@@ -206,11 +206,11 @@  discard block
 block discarded – undo
206 206
 	 *
207 207
 	 * @return mixed       Returns the data from the database
208 208
 	 */
209
-	private function get_stored_data( $key ) {
209
+	private function get_stored_data($key) {
210 210
 		global $wpdb;
211
-		$value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) );
211
+		$value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key));
212 212
 
213
-		return empty( $value ) ? false : maybe_unserialize( $value );
213
+		return empty($value) ? false : maybe_unserialize($value);
214 214
 	}
215 215
 
216 216
 	/**
@@ -223,10 +223,10 @@  discard block
 block discarded – undo
223 223
 	 *
224 224
 	 * @return void
225 225
 	 */
226
-	private function store_data( $key, $value ) {
226
+	private function store_data($key, $value) {
227 227
 		global $wpdb;
228 228
 
229
-		$value = maybe_serialize( $value );
229
+		$value = maybe_serialize($value);
230 230
 
231 231
 		$data = array(
232 232
 			'option_name'  => $key,
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 			'%s',
241 241
 		);
242 242
 
243
-		$wpdb->replace( $wpdb->options, $data, $formats );
243
+		$wpdb->replace($wpdb->options, $data, $formats);
244 244
 	}
245 245
 
246 246
 	/**
@@ -252,9 +252,9 @@  discard block
 block discarded – undo
252 252
 	 *
253 253
 	 * @return void
254 254
 	 */
255
-	private function delete_data( $key ) {
255
+	private function delete_data($key) {
256 256
 		global $wpdb;
257
-		$wpdb->delete( $wpdb->options, array( 'option_name' => $key ) );
257
+		$wpdb->delete($wpdb->options, array('option_name' => $key));
258 258
 	}
259 259
 
260 260
 }
Please login to merge, or discard this patch.
includes/admin/reporting/export/class-batch-export-customers.php 2 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -206,6 +206,7 @@
 block discarded – undo
206 206
 	 * Set Donor Data
207 207
 	 *
208 208
 	 * @param $donor
209
+	 * @param integer $i
209 210
 	 */
210 211
 	private function set_donor_data( $i, $data, $donor ) {
211 212
 
Please login to merge, or discard this patch.
Spacing   +69 added lines, -69 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
 
@@ -46,16 +46,16 @@  discard block
 block discarded – undo
46 46
 	 *
47 47
 	 * @param array $request The Form Data passed into the batch processing
48 48
 	 */
49
-	public function set_properties( $request ) {
49
+	public function set_properties($request) {
50 50
 
51 51
 		//Set data from form submission
52
-		if ( isset( $_POST['form'] ) ) {
53
-			parse_str( $_POST['form'], $this->data );
52
+		if (isset($_POST['form'])) {
53
+			parse_str($_POST['form'], $this->data);
54 54
 		}
55 55
 
56 56
 		$this->form = $this->data['forms'];
57 57
 
58
-		$this->price_id = ! empty( $request['give_price_option'] ) && 0 !== $request['give_price_option'] ? absint( $request['give_price_option'] ) : null;
58
+		$this->price_id = ! empty($request['give_price_option']) && 0 !== $request['give_price_option'] ? absint($request['give_price_option']) : null;
59 59
 
60 60
 	}
61 61
 
@@ -69,14 +69,14 @@  discard block
 block discarded – undo
69 69
 	public function csv_cols() {
70 70
 
71 71
 
72
-		$columns = isset( $this->data['give_export_option'] ) ? $this->data['give_export_option'] : array();
72
+		$columns = isset($this->data['give_export_option']) ? $this->data['give_export_option'] : array();
73 73
 
74 74
 		//We need columns.
75
-		if ( empty( $columns ) ) {
75
+		if (empty($columns)) {
76 76
 			return false;
77 77
 		}
78 78
 
79
-		$cols = $this->get_cols( $columns );
79
+		$cols = $this->get_cols($columns);
80 80
 
81 81
 		return $cols;
82 82
 	}
@@ -84,38 +84,38 @@  discard block
 block discarded – undo
84 84
 	/**
85 85
 	 * @param $column
86 86
 	 */
87
-	private function get_cols( $columns ) {
87
+	private function get_cols($columns) {
88 88
 
89 89
 		$cols = array();
90 90
 
91
-		foreach ( $columns as $key => $value ) {
91
+		foreach ($columns as $key => $value) {
92 92
 
93
-			switch ( $key ) {
93
+			switch ($key) {
94 94
 				case 'full_name' :
95
-					$cols['full_name'] = esc_html__( 'Full Name', 'give' );
95
+					$cols['full_name'] = esc_html__('Full Name', 'give');
96 96
 					break;
97 97
 				case 'email' :
98
-					$cols['email'] = esc_html__( 'Email Address', 'give' );
98
+					$cols['email'] = esc_html__('Email Address', 'give');
99 99
 					break;
100 100
 				case 'address' :
101
-					$cols['address_line1']   = esc_html__( 'Address', 'give' );
102
-					$cols['address_line2']   = esc_html__( 'Address 2', 'give' );
103
-					$cols['address_city']    = esc_html__( 'City', 'give' );
104
-					$cols['address_state']   = esc_html__( 'State', 'give' );
105
-					$cols['address_zip']     = esc_html__( 'Zip', 'give' );
106
-					$cols['address_country'] = esc_html__( 'Country', 'give' );
101
+					$cols['address_line1']   = esc_html__('Address', 'give');
102
+					$cols['address_line2']   = esc_html__('Address 2', 'give');
103
+					$cols['address_city']    = esc_html__('City', 'give');
104
+					$cols['address_state']   = esc_html__('State', 'give');
105
+					$cols['address_zip']     = esc_html__('Zip', 'give');
106
+					$cols['address_country'] = esc_html__('Country', 'give');
107 107
 					break;
108 108
 				case 'userid' :
109
-					$cols['userid'] = esc_html__( 'User ID', 'give' );
109
+					$cols['userid'] = esc_html__('User ID', 'give');
110 110
 					break;
111 111
 				case 'date_first_donated' :
112
-					$cols['date_first_donated'] = esc_html__( 'First Donation Date', 'give' );
112
+					$cols['date_first_donated'] = esc_html__('First Donation Date', 'give');
113 113
 					break;
114 114
 				case 'donations' :
115
-					$cols['donations'] = esc_html__( 'Number of Donations', 'give' );
115
+					$cols['donations'] = esc_html__('Number of Donations', 'give');
116 116
 					break;
117 117
 				case 'donation_sum' :
118
-					$cols['donation_sum'] = esc_html__( 'Sum of Donations', 'give' );
118
+					$cols['donation_sum'] = esc_html__('Sum of Donations', 'give');
119 119
 					break;
120 120
 			}
121 121
 		}
@@ -138,20 +138,20 @@  discard block
 block discarded – undo
138 138
 
139 139
 		$i = 0;
140 140
 
141
-		if ( ! empty( $this->form ) ) {
141
+		if ( ! empty($this->form)) {
142 142
 
143 143
 			// Export donors of a specific product
144 144
 			global $give_logs;
145 145
 
146 146
 			$args = array(
147
-				'post_parent'    => absint( $this->form ),
147
+				'post_parent'    => absint($this->form),
148 148
 				'log_type'       => 'sale',
149 149
 				'posts_per_page' => 30,
150 150
 				'paged'          => $this->step
151 151
 			);
152 152
 
153 153
 			//Check for price option
154
-			if ( null !== $this->price_id ) {
154
+			if (null !== $this->price_id) {
155 155
 				$args['meta_query'] = array(
156 156
 					array(
157 157
 						'key'   => '_give_log_price_id',
@@ -160,33 +160,33 @@  discard block
 block discarded – undo
160 160
 				);
161 161
 			}
162 162
 
163
-			$logs = $give_logs->get_connected_logs( $args );
163
+			$logs = $give_logs->get_connected_logs($args);
164 164
 
165
-			if ( $logs ) {
166
-				foreach ( $logs as $log ) {
167
-					$payment_id = get_post_meta( $log->ID, '_give_log_payment_id', true );
168
-					$payment    = new Give_Payment( $payment_id );
169
-					$donor      = Give()->customers->get_customer_by( 'id', $payment->customer_id );
170
-					$data[]     = $this->set_donor_data( $i, $data, $donor );
171
-					$i ++;
165
+			if ($logs) {
166
+				foreach ($logs as $log) {
167
+					$payment_id = get_post_meta($log->ID, '_give_log_payment_id', true);
168
+					$payment    = new Give_Payment($payment_id);
169
+					$donor      = Give()->customers->get_customer_by('id', $payment->customer_id);
170
+					$data[]     = $this->set_donor_data($i, $data, $donor);
171
+					$i++;
172 172
 				}
173 173
 			}
174 174
 
175 175
 		} else {
176 176
 
177 177
 			// Export all customers
178
-			$offset = 30 * ( $this->step - 1 );
179
-			$donors = Give()->customers->get_customers( array( 'number' => 30, 'offset' => $offset ) );
178
+			$offset = 30 * ($this->step - 1);
179
+			$donors = Give()->customers->get_customers(array('number' => 30, 'offset' => $offset));
180 180
 
181
-			foreach ( $donors as $donor ) {
181
+			foreach ($donors as $donor) {
182 182
 
183
-				$data[] = $this->set_donor_data( $i, $data, $donor );
184
-				$i ++;
183
+				$data[] = $this->set_donor_data($i, $data, $donor);
184
+				$i++;
185 185
 			}
186 186
 		}
187 187
 
188
-		$data = apply_filters( 'give_export_get_data', $data );
189
-		$data = apply_filters( 'give_export_get_data_' . $this->export_type, $data );
188
+		$data = apply_filters('give_export_get_data', $data);
189
+		$data = apply_filters('give_export_get_data_'.$this->export_type, $data);
190 190
 
191 191
 		return $data;
192 192
 	}
@@ -202,19 +202,19 @@  discard block
 block discarded – undo
202 202
 		$percentage = 0;
203 203
 
204 204
 		// We can't count the number when getting them for a specific form
205
-		if ( empty( $this->form ) ) {
205
+		if (empty($this->form)) {
206 206
 
207 207
 			$total = Give()->customers->count();
208 208
 
209
-			if ( $total > 0 ) {
209
+			if ($total > 0) {
210 210
 
211
-				$percentage = ( ( 30 * $this->step ) / $total ) * 100;
211
+				$percentage = ((30 * $this->step) / $total) * 100;
212 212
 
213 213
 			}
214 214
 
215 215
 		}
216 216
 
217
-		if ( $percentage > 100 ) {
217
+		if ($percentage > 100) {
218 218
 			$percentage = 100;
219 219
 		}
220 220
 
@@ -226,46 +226,46 @@  discard block
 block discarded – undo
226 226
 	 *
227 227
 	 * @param $donor
228 228
 	 */
229
-	private function set_donor_data( $i, $data, $donor ) {
229
+	private function set_donor_data($i, $data, $donor) {
230 230
 
231 231
 		$columns = $this->csv_cols();
232 232
 
233 233
 		//Set address variable
234 234
 		$address = '';
235
-		if ( isset( $donor->user_id ) && $donor->user_id > 0 ) {
236
-			$address = give_get_donor_address( $donor->user_id );
235
+		if (isset($donor->user_id) && $donor->user_id > 0) {
236
+			$address = give_get_donor_address($donor->user_id);
237 237
 		}
238 238
 
239 239
 		//Set columns
240
-		if ( ! empty( $columns['full_name'] ) ) {
241
-			$data[ $i ]['full_name'] = $donor->name;
240
+		if ( ! empty($columns['full_name'])) {
241
+			$data[$i]['full_name'] = $donor->name;
242 242
 		}
243
-		if ( ! empty( $columns['email'] ) ) {
244
-			$data[ $i ]['email'] = $donor->email;
243
+		if ( ! empty($columns['email'])) {
244
+			$data[$i]['email'] = $donor->email;
245 245
 		}
246
-		if ( ! empty( $columns['address_line1'] ) ) {
247
-
248
-			$data[ $i ]['address_line1']   = isset( $address['line1'] ) ? $address['line1'] : '';
249
-			$data[ $i ]['address_line2']   = isset( $address['line2'] ) ? $address['line2'] : '';
250
-			$data[ $i ]['address_city']    = isset( $address['city'] ) ? $address['city'] : '';
251
-			$data[ $i ]['address_state']   = isset( $address['state'] ) ? $address['state'] : '';
252
-			$data[ $i ]['address_zip']     = isset( $address['zip'] ) ? $address['zip'] : '';
253
-			$data[ $i ]['address_country'] = isset( $address['country'] ) ? $address['country'] : '';
246
+		if ( ! empty($columns['address_line1'])) {
247
+
248
+			$data[$i]['address_line1']   = isset($address['line1']) ? $address['line1'] : '';
249
+			$data[$i]['address_line2']   = isset($address['line2']) ? $address['line2'] : '';
250
+			$data[$i]['address_city']    = isset($address['city']) ? $address['city'] : '';
251
+			$data[$i]['address_state']   = isset($address['state']) ? $address['state'] : '';
252
+			$data[$i]['address_zip']     = isset($address['zip']) ? $address['zip'] : '';
253
+			$data[$i]['address_country'] = isset($address['country']) ? $address['country'] : '';
254 254
 		}
255
-		if ( ! empty( $columns['userid'] ) ) {
256
-			$data[ $i ]['userid'] = ! empty( $donor->user_id ) ? $donor->user_id : '';
255
+		if ( ! empty($columns['userid'])) {
256
+			$data[$i]['userid'] = ! empty($donor->user_id) ? $donor->user_id : '';
257 257
 		}
258
-		if ( ! empty( $columns['date_first_donated'] ) ) {
259
-			$data[ $i ]['date_first_donated'] = date_i18n( get_option( 'date_format' ), strtotime( $donor->date_created ) );
258
+		if ( ! empty($columns['date_first_donated'])) {
259
+			$data[$i]['date_first_donated'] = date_i18n(get_option('date_format'), strtotime($donor->date_created));
260 260
 		}
261
-		if ( ! empty( $columns['donations'] ) ) {
262
-			$data[ $i ]['donations'] = $donor->purchase_count;
261
+		if ( ! empty($columns['donations'])) {
262
+			$data[$i]['donations'] = $donor->purchase_count;
263 263
 		}
264
-		if ( ! empty( $columns['donation_sum'] ) ) {
265
-			$data[ $i ]['donation_sum'] = give_format_amount( $donor->purchase_value );
264
+		if ( ! empty($columns['donation_sum'])) {
265
+			$data[$i]['donation_sum'] = give_format_amount($donor->purchase_value);
266 266
 		}
267 267
 
268
-		return $data[ $i ];
268
+		return $data[$i];
269 269
 
270 270
 	}
271 271
 
Please login to merge, or discard this patch.
includes/error-tracking.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@
 block discarded – undo
65 65
  *
66 66
  * @since 1.0
67 67
  * @uses  Give_Session::get()
68
- * @return mixed array if errors are present, false if none found
68
+ * @return string array if errors are present, false if none found
69 69
  */
70 70
 function give_get_errors() {
71 71
 	return Give()->session->get( 'give_errors' );
Please login to merge, or discard this patch.
Spacing   +30 added lines, -30 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,33 +29,33 @@  discard block
 block discarded – undo
29 29
  *
30 30
  * @return void
31 31
  */
32
-function give_print_errors( $form_id ) {
32
+function give_print_errors($form_id) {
33 33
 
34 34
 	$errors = give_get_errors();
35 35
 
36
-	$request_form_id = isset( $_REQUEST['form-id'] ) ? intval( $_REQUEST['form-id'] ) : 0;
36
+	$request_form_id = isset($_REQUEST['form-id']) ? intval($_REQUEST['form-id']) : 0;
37 37
 
38 38
 	//Sanity checks first: Ensure that gateway returned errors display on the appropriate form
39
-	if ( ! isset( $_POST['give_ajax'] ) && $request_form_id !== $form_id ) {
39
+	if ( ! isset($_POST['give_ajax']) && $request_form_id !== $form_id) {
40 40
 		return;
41 41
 	}
42 42
 
43
-	if ( $errors ) {
44
-		$classes = apply_filters( 'give_error_class', array(
43
+	if ($errors) {
44
+		$classes = apply_filters('give_error_class', array(
45 45
 			'give_errors'
46
-		) );
47
-		echo '<div class="' . implode( ' ', $classes ) . '">';
46
+		));
47
+		echo '<div class="'.implode(' ', $classes).'">';
48 48
 		// Loop error codes and display errors
49
-		foreach ( $errors as $error_id => $error ) {
50
-			echo '<div class="give_error" id="give_error_' . $error_id . '"><p><strong>' . esc_html__( 'Error', 'give' ) . '</strong>: ' . $error . '</p></div>';
49
+		foreach ($errors as $error_id => $error) {
50
+			echo '<div class="give_error" id="give_error_'.$error_id.'"><p><strong>'.esc_html__('Error', 'give').'</strong>: '.$error.'</p></div>';
51 51
 		}
52 52
 		echo '</div>';
53 53
 		give_clear_errors();
54 54
 	}
55 55
 }
56 56
 
57
-add_action( 'give_purchase_form_before_personal_info', 'give_print_errors' );
58
-add_action( 'give_ajax_checkout_errors', 'give_print_errors' );
57
+add_action('give_purchase_form_before_personal_info', 'give_print_errors');
58
+add_action('give_ajax_checkout_errors', 'give_print_errors');
59 59
 
60 60
 /**
61 61
  * Get Errors
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
  * @return mixed array if errors are present, false if none found
69 69
  */
70 70
 function give_get_errors() {
71
-	return Give()->session->get( 'give_errors' );
71
+	return Give()->session->get('give_errors');
72 72
 }
73 73
 
74 74
 /**
@@ -84,13 +84,13 @@  discard block
 block discarded – undo
84 84
  *
85 85
  * @return void
86 86
  */
87
-function give_set_error( $error_id, $error_message ) {
87
+function give_set_error($error_id, $error_message) {
88 88
 	$errors = give_get_errors();
89
-	if ( ! $errors ) {
89
+	if ( ! $errors) {
90 90
 		$errors = array();
91 91
 	}
92
-	$errors[ $error_id ] = $error_message;
93
-	Give()->session->set( 'give_errors', $errors );
92
+	$errors[$error_id] = $error_message;
93
+	Give()->session->set('give_errors', $errors);
94 94
 }
95 95
 
96 96
 /**
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
  * @return void
102 102
  */
103 103
 function give_clear_errors() {
104
-	Give()->session->set( 'give_errors', null );
104
+	Give()->session->set('give_errors', null);
105 105
 }
106 106
 
107 107
 /**
@@ -114,11 +114,11 @@  discard block
 block discarded – undo
114 114
  *
115 115
  * @return string
116 116
  */
117
-function give_unset_error( $error_id ) {
117
+function give_unset_error($error_id) {
118 118
 	$errors = give_get_errors();
119
-	if ( $errors ) {
120
-		unset( $errors[ $error_id ] );
121
-		Give()->session->set( 'give_errors', $errors );
119
+	if ($errors) {
120
+		unset($errors[$error_id]);
121
+		Give()->session->set('give_errors', $errors);
122 122
 	}
123 123
 }
124 124
 
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
  * @return void
130 130
  */
131 131
 function _give_die_handler() {
132
-	if ( defined( 'GIVE_UNIT_TESTS' ) ) {
132
+	if (defined('GIVE_UNIT_TESTS')) {
133 133
 		return '_give_die_handler';
134 134
 	} else {
135 135
 		die();
@@ -144,10 +144,10 @@  discard block
 block discarded – undo
144 144
  * @since  1.0
145 145
  * @return void
146 146
  */
147
-function give_die( $message = '', $title = '', $status = 400 ) {
148
-	add_filter( 'wp_die_ajax_handler', '_give_die_handler', 10, 3 );
149
-	add_filter( 'wp_die_handler', '_give_die_handler', 10, 3 );
150
-	wp_die( $message, $title, array( 'response' => $status ) );
147
+function give_die($message = '', $title = '', $status = 400) {
148
+	add_filter('wp_die_ajax_handler', '_give_die_handler', 10, 3);
149
+	add_filter('wp_die_handler', '_give_die_handler', 10, 3);
150
+	wp_die($message, $title, array('response' => $status));
151 151
 }
152 152
 
153 153
 /**
@@ -162,10 +162,10 @@  discard block
 block discarded – undo
162 162
  *
163 163
  * @return   string  $error
164 164
  */
165
-function give_output_error( $message, $echo = true, $error_id = 'warning' ) {
166
-	$error = '<div class="give_errors" id="give_error_' . $error_id . '"><p class="give_error  give_' . $error_id . '">' . $message . '</p></div>';
165
+function give_output_error($message, $echo = true, $error_id = 'warning') {
166
+	$error = '<div class="give_errors" id="give_error_'.$error_id.'"><p class="give_error  give_'.$error_id.'">'.$message.'</p></div>';
167 167
 
168
-	if ( $echo ) {
168
+	if ($echo) {
169 169
 		echo $error;
170 170
 	} else {
171 171
 		return $error;
Please login to merge, or discard this patch.
includes/login-register.php 2 patches
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -33,20 +33,20 @@  discard block
 block discarded – undo
33 33
 		$login_redirect = add_query_arg('give-login-success', 'true', give_get_current_page_url());
34 34
 	}
35 35
 
36
-    if ( empty( $logout_redirect ) ) {
37
-        $logout_redirect = add_query_arg( 'give-logout-success', 'true', give_get_current_page_url() );
38
-    }
36
+	if ( empty( $logout_redirect ) ) {
37
+		$logout_redirect = add_query_arg( 'give-logout-success', 'true', give_get_current_page_url() );
38
+	}
39 39
 
40 40
 
41
-    // Add user_logout action to logout url.
42
-    $logout_redirect = add_query_arg(
43
-        array(
44
-            'give_action'       => 'user_logout',
45
-            'give_logout_nonce' => wp_create_nonce( 'give-logout-nonce' ),
46
-            'give_logout_redirect' => urlencode( $logout_redirect )
47
-        ),
48
-        home_url('/')
49
-    );
41
+	// Add user_logout action to logout url.
42
+	$logout_redirect = add_query_arg(
43
+		array(
44
+			'give_action'       => 'user_logout',
45
+			'give_logout_nonce' => wp_create_nonce( 'give-logout-nonce' ),
46
+			'give_logout_redirect' => urlencode( $logout_redirect )
47
+		),
48
+		home_url('/')
49
+	);
50 50
 
51 51
 	$give_login_redirect = $login_redirect;
52 52
 	$give_logout_redirect = $logout_redirect;
@@ -136,23 +136,23 @@  discard block
 block discarded – undo
136 136
  * @return void
137 137
  */
138 138
 function give_process_user_logout( $data ) {
139
-    if ( wp_verify_nonce( $data['give_logout_nonce'], 'give-logout-nonce' ) && is_user_logged_in() ) {
139
+	if ( wp_verify_nonce( $data['give_logout_nonce'], 'give-logout-nonce' ) && is_user_logged_in() ) {
140 140
 
141
-        // Prevent occurring of any custom action on wp_logout.
142
-        remove_all_actions( 'wp_logout' );
141
+		// Prevent occurring of any custom action on wp_logout.
142
+		remove_all_actions( 'wp_logout' );
143 143
 
144
-        // Before logout give action.
145
-        do_action( 'give_before_user_logout' );
144
+		// Before logout give action.
145
+		do_action( 'give_before_user_logout' );
146 146
 
147
-        // Logout user.
148
-        wp_logout();
147
+		// Logout user.
148
+		wp_logout();
149 149
 
150
-        // After logout give action.
151
-        do_action( 'give_after_user_logout' );
150
+		// After logout give action.
151
+		do_action( 'give_after_user_logout' );
152 152
 
153
-        wp_redirect( $data['give_logout_redirect'] );
154
-        give_die();
155
-    }
153
+		wp_redirect( $data['give_logout_redirect'] );
154
+		give_die();
155
+	}
156 156
 }
157 157
 
158 158
 add_action( 'give_user_logout', 'give_process_user_logout' );
Please login to merge, or discard this patch.
Spacing   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -26,15 +26,15 @@  discard block
 block discarded – undo
26 26
  *
27 27
  * @return string Login form
28 28
  */
29
-function give_login_form( $login_redirect = '', $logout_redirect = '' ) {
30
-	global $give_login_redirect, $give_logout_redirect;;
29
+function give_login_form($login_redirect = '', $logout_redirect = '') {
30
+	global $give_login_redirect, $give_logout_redirect; ;
31 31
 
32
-	if ( empty( $login_redirect ) ) {
32
+	if (empty($login_redirect)) {
33 33
 		$login_redirect = add_query_arg('give-login-success', 'true', give_get_current_page_url());
34 34
 	}
35 35
 
36
-    if ( empty( $logout_redirect ) ) {
37
-        $logout_redirect = add_query_arg( 'give-logout-success', 'true', give_get_current_page_url() );
36
+    if (empty($logout_redirect)) {
37
+        $logout_redirect = add_query_arg('give-logout-success', 'true', give_get_current_page_url());
38 38
     }
39 39
 
40 40
 
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
     $logout_redirect = add_query_arg(
43 43
         array(
44 44
             'give_action'       => 'user_logout',
45
-            'give_logout_nonce' => wp_create_nonce( 'give-logout-nonce' ),
46
-            'give_logout_redirect' => urlencode( $logout_redirect )
45
+            'give_logout_nonce' => wp_create_nonce('give-logout-nonce'),
46
+            'give_logout_redirect' => urlencode($logout_redirect)
47 47
         ),
48 48
         home_url('/')
49 49
     );
@@ -53,9 +53,9 @@  discard block
 block discarded – undo
53 53
 
54 54
 	ob_start();
55 55
 
56
-	give_get_template_part( 'shortcode', 'login' );
56
+	give_get_template_part('shortcode', 'login');
57 57
 
58
-	return apply_filters( 'give_login_form', ob_get_clean() );
58
+	return apply_filters('give_login_form', ob_get_clean());
59 59
 }
60 60
 
61 61
 /**
@@ -69,10 +69,10 @@  discard block
 block discarded – undo
69 69
  *
70 70
  * @return string Register form
71 71
  */
72
-function give_register_form( $redirect = '' ) {
72
+function give_register_form($redirect = '') {
73 73
 	global $give_options, $give_register_redirect;
74 74
 
75
-	if ( empty( $redirect ) ) {
75
+	if (empty($redirect)) {
76 76
 		$redirect = give_get_current_page_url();
77 77
 	}
78 78
 
@@ -80,11 +80,11 @@  discard block
 block discarded – undo
80 80
 
81 81
 	ob_start();
82 82
 
83
-	if ( ! is_user_logged_in() ) {
84
-		give_get_template_part( 'shortcode', 'register' );
83
+	if ( ! is_user_logged_in()) {
84
+		give_get_template_part('shortcode', 'register');
85 85
 	}
86 86
 
87
-	return apply_filters( 'give_register_form', ob_get_clean() );
87
+	return apply_filters('give_register_form', ob_get_clean());
88 88
 }
89 89
 
90 90
 /**
@@ -96,34 +96,34 @@  discard block
 block discarded – undo
96 96
  *
97 97
  * @return void
98 98
  */
99
-function give_process_login_form( $data ) {
100
-	if ( wp_verify_nonce( $data['give_login_nonce'], 'give-login-nonce' ) ) {
101
-		$user_data = get_user_by( 'login', $data['give_user_login'] );
102
-		if ( ! $user_data ) {
103
-			$user_data = get_user_by( 'email', $data['give_user_login'] );
99
+function give_process_login_form($data) {
100
+	if (wp_verify_nonce($data['give_login_nonce'], 'give-login-nonce')) {
101
+		$user_data = get_user_by('login', $data['give_user_login']);
102
+		if ( ! $user_data) {
103
+			$user_data = get_user_by('email', $data['give_user_login']);
104 104
 		}
105
-		if ( $user_data ) {
105
+		if ($user_data) {
106 106
 			$user_ID    = $user_data->ID;
107 107
 			$user_email = $user_data->user_email;
108
-			if ( wp_check_password( $data['give_user_pass'], $user_data->user_pass, $user_data->ID ) ) {
109
-				give_log_user_in( $user_data->ID, $data['give_user_login'], $data['give_user_pass'] );
108
+			if (wp_check_password($data['give_user_pass'], $user_data->user_pass, $user_data->ID)) {
109
+				give_log_user_in($user_data->ID, $data['give_user_login'], $data['give_user_pass']);
110 110
 			} else {
111
-				give_set_error( 'password_incorrect', esc_html__( 'The password you entered is incorrect.', 'give' ) );
111
+				give_set_error('password_incorrect', esc_html__('The password you entered is incorrect.', 'give'));
112 112
 			}
113 113
 		} else {
114
-			give_set_error( 'username_incorrect', esc_html__( 'The username you entered does not exist.', 'give' ) );
114
+			give_set_error('username_incorrect', esc_html__('The username you entered does not exist.', 'give'));
115 115
 		}
116 116
 		// Check for errors and redirect if none present
117 117
 		$errors = give_get_errors();
118
-		if ( ! $errors ) {
119
-			$redirect = apply_filters( 'give_login_redirect', $data['give_login_redirect'], $user_ID );
120
-			wp_redirect( $redirect );
118
+		if ( ! $errors) {
119
+			$redirect = apply_filters('give_login_redirect', $data['give_login_redirect'], $user_ID);
120
+			wp_redirect($redirect);
121 121
 			give_die();
122 122
 		}
123 123
 	}
124 124
 }
125 125
 
126
-add_action( 'give_user_login', 'give_process_login_form' );
126
+add_action('give_user_login', 'give_process_login_form');
127 127
 
128 128
 
129 129
 /**
@@ -135,27 +135,27 @@  discard block
 block discarded – undo
135 135
  *
136 136
  * @return void
137 137
  */
138
-function give_process_user_logout( $data ) {
139
-    if ( wp_verify_nonce( $data['give_logout_nonce'], 'give-logout-nonce' ) && is_user_logged_in() ) {
138
+function give_process_user_logout($data) {
139
+    if (wp_verify_nonce($data['give_logout_nonce'], 'give-logout-nonce') && is_user_logged_in()) {
140 140
 
141 141
         // Prevent occurring of any custom action on wp_logout.
142
-        remove_all_actions( 'wp_logout' );
142
+        remove_all_actions('wp_logout');
143 143
 
144 144
         // Before logout give action.
145
-        do_action( 'give_before_user_logout' );
145
+        do_action('give_before_user_logout');
146 146
 
147 147
         // Logout user.
148 148
         wp_logout();
149 149
 
150 150
         // After logout give action.
151
-        do_action( 'give_after_user_logout' );
151
+        do_action('give_after_user_logout');
152 152
 
153
-        wp_redirect( $data['give_logout_redirect'] );
153
+        wp_redirect($data['give_logout_redirect']);
154 154
         give_die();
155 155
     }
156 156
 }
157 157
 
158
-add_action( 'give_user_logout', 'give_process_user_logout' );
158
+add_action('give_user_logout', 'give_process_user_logout');
159 159
 
160 160
 /**
161 161
  * Log User In
@@ -168,15 +168,15 @@  discard block
 block discarded – undo
168 168
  *
169 169
  * @return void
170 170
  */
171
-function give_log_user_in( $user_id, $user_login, $user_pass ) {
172
-	if ( $user_id < 1 ) {
171
+function give_log_user_in($user_id, $user_login, $user_pass) {
172
+	if ($user_id < 1) {
173 173
 		return;
174 174
 	}
175 175
 
176
-	wp_set_auth_cookie( $user_id );
177
-	wp_set_current_user( $user_id, $user_login );
178
-	do_action( 'wp_login', $user_login, get_userdata( $user_id ) );
179
-	do_action( 'give_log_user_in', $user_id, $user_login, $user_pass );
176
+	wp_set_auth_cookie($user_id);
177
+	wp_set_current_user($user_id, $user_login);
178
+	do_action('wp_login', $user_login, get_userdata($user_id));
179
+	do_action('give_log_user_in', $user_id, $user_login, $user_pass);
180 180
 }
181 181
 
182 182
 
@@ -189,70 +189,70 @@  discard block
 block discarded – undo
189 189
  *
190 190
  * @return void
191 191
  */
192
-function give_process_register_form( $data ) {
192
+function give_process_register_form($data) {
193 193
 
194
-	if ( is_user_logged_in() ) {
194
+	if (is_user_logged_in()) {
195 195
 		return;
196 196
 	}
197 197
 
198
-	if ( empty( $_POST['give_register_submit'] ) ) {
198
+	if (empty($_POST['give_register_submit'])) {
199 199
 		return;
200 200
 	}
201 201
 
202
-	do_action( 'give_pre_process_register_form' );
202
+	do_action('give_pre_process_register_form');
203 203
 
204
-	if ( empty( $data['give_user_login'] ) ) {
205
-		give_set_error( 'empty_username', esc_html__( 'Invalid username.', 'give' ) );
204
+	if (empty($data['give_user_login'])) {
205
+		give_set_error('empty_username', esc_html__('Invalid username.', 'give'));
206 206
 	}
207 207
 
208
-	if ( username_exists( $data['give_user_login'] ) ) {
209
-		give_set_error( 'username_unavailable', esc_html__( 'Username already taken.', 'give' ) );
208
+	if (username_exists($data['give_user_login'])) {
209
+		give_set_error('username_unavailable', esc_html__('Username already taken.', 'give'));
210 210
 	}
211 211
 
212
-	if ( ! validate_username( $data['give_user_login'] ) ) {
213
-		give_set_error( 'username_invalid', esc_html__( 'Invalid username.', 'give' ) );
212
+	if ( ! validate_username($data['give_user_login'])) {
213
+		give_set_error('username_invalid', esc_html__('Invalid username.', 'give'));
214 214
 	}
215 215
 
216
-	if ( email_exists( $data['give_user_email'] ) ) {
217
-		give_set_error( 'email_unavailable', esc_html__( 'Email address already taken.', 'give' ) );
216
+	if (email_exists($data['give_user_email'])) {
217
+		give_set_error('email_unavailable', esc_html__('Email address already taken.', 'give'));
218 218
 	}
219 219
 
220
-	if ( empty( $data['give_user_email'] ) || ! is_email( $data['give_user_email'] ) ) {
221
-		give_set_error( 'email_invalid', esc_html__( 'Invalid email.', 'give' ) );
220
+	if (empty($data['give_user_email']) || ! is_email($data['give_user_email'])) {
221
+		give_set_error('email_invalid', esc_html__('Invalid email.', 'give'));
222 222
 	}
223 223
 
224
-	if ( ! empty( $data['give_payment_email'] ) && $data['give_payment_email'] != $data['give_user_email'] && ! is_email( $data['give_payment_email'] ) ) {
225
-		give_set_error( 'payment_email_invalid', esc_html__( 'Invalid payment email.', 'give' ) );
224
+	if ( ! empty($data['give_payment_email']) && $data['give_payment_email'] != $data['give_user_email'] && ! is_email($data['give_payment_email'])) {
225
+		give_set_error('payment_email_invalid', esc_html__('Invalid payment email.', 'give'));
226 226
 	}
227 227
 
228
-	if ( empty( $_POST['give_user_pass'] ) ) {
229
-		give_set_error( 'empty_password', esc_html__( 'Please enter a password.', 'give' ) );
228
+	if (empty($_POST['give_user_pass'])) {
229
+		give_set_error('empty_password', esc_html__('Please enter a password.', 'give'));
230 230
 	}
231 231
 
232
-	if ( ( ! empty( $_POST['give_user_pass'] ) && empty( $_POST['give_user_pass2'] ) ) || ( $_POST['give_user_pass'] !== $_POST['give_user_pass2'] ) ) {
233
-		give_set_error( 'password_mismatch', esc_html__( 'Passwords don\'t match.', 'give' ) );
232
+	if (( ! empty($_POST['give_user_pass']) && empty($_POST['give_user_pass2'])) || ($_POST['give_user_pass'] !== $_POST['give_user_pass2'])) {
233
+		give_set_error('password_mismatch', esc_html__('Passwords don\'t match.', 'give'));
234 234
 	}
235 235
 
236
-	do_action( 'give_process_register_form' );
236
+	do_action('give_process_register_form');
237 237
 
238 238
 	// Check for errors and redirect if none present
239 239
 	$errors = give_get_errors();
240 240
 
241
-	if ( empty( $errors ) ) {
241
+	if (empty($errors)) {
242 242
 
243
-		$redirect = apply_filters( 'give_register_redirect', $data['give_redirect'] );
243
+		$redirect = apply_filters('give_register_redirect', $data['give_redirect']);
244 244
 
245
-		give_register_and_login_new_user( array(
245
+		give_register_and_login_new_user(array(
246 246
 			'user_login'      => $data['give_user_login'],
247 247
 			'user_pass'       => $data['give_user_pass'],
248 248
 			'user_email'      => $data['give_user_email'],
249
-			'user_registered' => date( 'Y-m-d H:i:s' ),
250
-			'role'            => get_option( 'default_role' )
251
-		) );
249
+			'user_registered' => date('Y-m-d H:i:s'),
250
+			'role'            => get_option('default_role')
251
+		));
252 252
 
253
-		wp_redirect( $redirect );
253
+		wp_redirect($redirect);
254 254
 		give_die();
255 255
 	}
256 256
 }
257 257
 
258
-add_action( 'give_user_register', 'give_process_register_form' );
259 258
\ No newline at end of file
259
+add_action('give_user_register', 'give_process_register_form');
260 260
\ No newline at end of file
Please login to merge, or discard this patch.
includes/shortcodes.php 3 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 
92 92
 		//validate display_style and float_labels value
93 93
 		if ( ( $key == 'display_style' && ! in_array( $value, array( 'onpage', 'reveal', 'modal' ) ) )
94
-		     || ( $key == 'float_labels' && ! in_array( $value, array( 'enabled', 'disabled' ) ) )
94
+			 || ( $key == 'float_labels' && ! in_array( $value, array( 'enabled', 'disabled' ) ) )
95 95
 		) {
96 96
 
97 97
 			$atts[ $key ] = '';
@@ -169,15 +169,15 @@  discard block
 block discarded – undo
169 169
  */
170 170
 function give_login_form_shortcode( $atts, $content = null ) {
171 171
 	$atts = shortcode_atts( array(
172
-        // Add backward compatibility for redirect attribute.
173
-        'redirect'          => '',
172
+		// Add backward compatibility for redirect attribute.
173
+		'redirect'          => '',
174 174
 
175 175
 		'login-redirect'    => '',
176 176
 		'logout-redirect'   => '',
177 177
 	), $atts, 'give_login' );
178 178
 
179
-    // Check login-redirect attribute first, if it empty or not found then check for redirect attribute and add value of this to login-redirect attribute.
180
-    $atts['login-redirect'] = ! empty( $atts['login-redirect'] ) ? $atts['login-redirect'] : ( ! empty( $atts['redirect' ] ) ? $atts['redirect'] : '' );
179
+	// Check login-redirect attribute first, if it empty or not found then check for redirect attribute and add value of this to login-redirect attribute.
180
+	$atts['login-redirect'] = ! empty( $atts['login-redirect'] ) ? $atts['login-redirect'] : ( ! empty( $atts['redirect' ] ) ? $atts['redirect'] : '' );
181 181
 
182 182
 	return give_login_form( $atts['login-redirect'], $atts['logout-redirect'] );
183 183
 }
Please login to merge, or discard this patch.
Spacing   +113 added lines, -113 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,28 +25,28 @@  discard block
 block discarded – undo
25 25
  */
26 26
 function give_donation_history() {
27 27
 
28
-	$email_access = give_get_option( 'email_access' );
28
+	$email_access = give_get_option('email_access');
29 29
 
30 30
 	//Is user logged in? Does a session exist? Does an email-access token exist?
31
-	if ( is_user_logged_in() || Give()->session->get_session_expiration() !== false || ( $email_access == 'on' && Give()->email_access->token_exists ) ) {
31
+	if (is_user_logged_in() || Give()->session->get_session_expiration() !== false || ($email_access == 'on' && Give()->email_access->token_exists)) {
32 32
 		ob_start();
33
-		give_get_template_part( 'history', 'donations' );
33
+		give_get_template_part('history', 'donations');
34 34
 
35 35
 		return ob_get_clean();
36 36
 	} //Is Email-based access enabled?
37
-	elseif ( $email_access == 'on' ) {
37
+	elseif ($email_access == 'on') {
38 38
 
39 39
 		ob_start();
40
-		give_get_template_part( 'email', 'login-form' );
40
+		give_get_template_part('email', 'login-form');
41 41
 
42 42
 		return ob_get_clean();
43 43
 	} else {
44
-		$message = esc_html__( 'You must be logged in to view your donation history. Please login using your account or create an account using the same email you used to donate with.', 'give' );
45
-		echo apply_filters( 'give_donation_history_nonuser_message', give_output_error( $message, false ), $message );
44
+		$message = esc_html__('You must be logged in to view your donation history. Please login using your account or create an account using the same email you used to donate with.', 'give');
45
+		echo apply_filters('give_donation_history_nonuser_message', give_output_error($message, false), $message);
46 46
 	}
47 47
 }
48 48
 
49
-add_shortcode( 'donation_history', 'give_donation_history' );
49
+add_shortcode('donation_history', 'give_donation_history');
50 50
 
51 51
 /**
52 52
  * Donation Form Shortcode
@@ -60,53 +60,53 @@  discard block
 block discarded – undo
60 60
  *
61 61
  * @return string
62 62
  */
63
-function give_form_shortcode( $atts, $content = null ) {
64
-	$atts = shortcode_atts( array(
63
+function give_form_shortcode($atts, $content = null) {
64
+	$atts = shortcode_atts(array(
65 65
 		'id'            => '',
66 66
 		'show_title'    => true,
67 67
 		'show_goal'     => true,
68 68
 		'show_content'  => '',
69 69
 		'float_labels'  => '',
70 70
 		'display_style' => '',
71
-	), $atts, 'give_form' );
71
+	), $atts, 'give_form');
72 72
 
73
-	foreach ( $atts as $key => $value ) {
73
+	foreach ($atts as $key => $value) {
74 74
 		//convert shortcode_atts values to booleans
75
-		if ( $key == 'show_title' ) {
76
-			$atts[ $key ] = filter_var( $atts[ $key ], FILTER_VALIDATE_BOOLEAN );
77
-		} elseif ( $key == 'show_goal' ) {
78
-			$atts[ $key ] = filter_var( $atts[ $key ], FILTER_VALIDATE_BOOLEAN );
75
+		if ($key == 'show_title') {
76
+			$atts[$key] = filter_var($atts[$key], FILTER_VALIDATE_BOOLEAN);
77
+		} elseif ($key == 'show_goal') {
78
+			$atts[$key] = filter_var($atts[$key], FILTER_VALIDATE_BOOLEAN);
79 79
 		}
80 80
 
81 81
 		//validate show_content value
82
-		if ( $key == 'show_content' ) {
83
-			if ( ! in_array( $value, array( 'none', 'above', 'below' ) ) ) {
84
-				$atts[ $key ] = '';
85
-			} else if ( $value == 'above' ) {
86
-				$atts[ $key ] = 'give_pre_form';
87
-			} else if ( $value == 'below' ) {
88
-				$atts[ $key ] = 'give_post_form';
82
+		if ($key == 'show_content') {
83
+			if ( ! in_array($value, array('none', 'above', 'below'))) {
84
+				$atts[$key] = '';
85
+			} else if ($value == 'above') {
86
+				$atts[$key] = 'give_pre_form';
87
+			} else if ($value == 'below') {
88
+				$atts[$key] = 'give_post_form';
89 89
 			}
90 90
 		}
91 91
 
92 92
 		//validate display_style and float_labels value
93
-		if ( ( $key == 'display_style' && ! in_array( $value, array( 'onpage', 'reveal', 'modal' ) ) )
94
-		     || ( $key == 'float_labels' && ! in_array( $value, array( 'enabled', 'disabled' ) ) )
93
+		if (($key == 'display_style' && ! in_array($value, array('onpage', 'reveal', 'modal')))
94
+		     || ($key == 'float_labels' && ! in_array($value, array('enabled', 'disabled')))
95 95
 		) {
96 96
 
97
-			$atts[ $key ] = '';
97
+			$atts[$key] = '';
98 98
 		}
99 99
 	}
100 100
 
101 101
 	//get the Give Form
102 102
 	ob_start();
103
-	give_get_donation_form( $atts );
103
+	give_get_donation_form($atts);
104 104
 	$final_output = ob_get_clean();
105 105
 
106
-	return apply_filters( 'give_donate_form', $final_output, $atts );
106
+	return apply_filters('give_donate_form', $final_output, $atts);
107 107
 }
108 108
 
109
-add_shortcode( 'give_form', 'give_form_shortcode' );
109
+add_shortcode('give_form', 'give_form_shortcode');
110 110
 
111 111
 /**
112 112
  * Donation Form Goal Shortcode.
@@ -120,37 +120,37 @@  discard block
 block discarded – undo
120 120
  *
121 121
  * @return string
122 122
  */
123
-function give_goal_shortcode( $atts, $content = null ) {
124
-	$atts = shortcode_atts( array(
123
+function give_goal_shortcode($atts, $content = null) {
124
+	$atts = shortcode_atts(array(
125 125
 		'id'        => '',
126 126
 		'show_text' => true,
127 127
 		'show_bar'  => true,
128
-	), $atts, 'give_goal' );
128
+	), $atts, 'give_goal');
129 129
 
130 130
 
131 131
 	//get the Give Form.
132 132
 	ob_start();
133 133
 
134 134
 	//Sanity check 1: ensure there is an ID Provided.
135
-	if ( empty( $atts['id'] ) ) {
136
-		give_output_error( esc_html__( 'Error: No Donation form ID for the shortcode provided.', 'give' ), true );
135
+	if (empty($atts['id'])) {
136
+		give_output_error(esc_html__('Error: No Donation form ID for the shortcode provided.', 'give'), true);
137 137
 	}
138 138
 
139 139
 	//Sanity check 2: Check that this form even has Goals enabled.
140
-	$goal_option = get_post_meta( $atts['id'], '_give_goal_option', true );
141
-	if ( empty( $goal_option ) || $goal_option !== 'yes' ) {
142
-		give_output_error( esc_html__( 'Error: This form does not have Goals enabled.', 'give' ), true );
140
+	$goal_option = get_post_meta($atts['id'], '_give_goal_option', true);
141
+	if (empty($goal_option) || $goal_option !== 'yes') {
142
+		give_output_error(esc_html__('Error: This form does not have Goals enabled.', 'give'), true);
143 143
 	} else {
144 144
 		//Passed all sanity checks: output Goal.
145
-		give_show_goal_progress( $atts['id'], $atts );
145
+		give_show_goal_progress($atts['id'], $atts);
146 146
 	}
147 147
 
148 148
 	$final_output = ob_get_clean();
149 149
 
150
-	return apply_filters( 'give_goal_shortcode_output', $final_output, $atts );
150
+	return apply_filters('give_goal_shortcode_output', $final_output, $atts);
151 151
 }
152 152
 
153
-add_shortcode( 'give_goal', 'give_goal_shortcode' );
153
+add_shortcode('give_goal', 'give_goal_shortcode');
154 154
 
155 155
 
156 156
 /**
@@ -167,22 +167,22 @@  discard block
 block discarded – undo
167 167
  * @uses  give_login_form()
168 168
  * @return string
169 169
  */
170
-function give_login_form_shortcode( $atts, $content = null ) {
171
-	$atts = shortcode_atts( array(
170
+function give_login_form_shortcode($atts, $content = null) {
171
+	$atts = shortcode_atts(array(
172 172
         // Add backward compatibility for redirect attribute.
173 173
         'redirect'          => '',
174 174
 
175 175
 		'login-redirect'    => '',
176 176
 		'logout-redirect'   => '',
177
-	), $atts, 'give_login' );
177
+	), $atts, 'give_login');
178 178
 
179 179
     // Check login-redirect attribute first, if it empty or not found then check for redirect attribute and add value of this to login-redirect attribute.
180
-    $atts['login-redirect'] = ! empty( $atts['login-redirect'] ) ? $atts['login-redirect'] : ( ! empty( $atts['redirect' ] ) ? $atts['redirect'] : '' );
180
+    $atts['login-redirect'] = ! empty($atts['login-redirect']) ? $atts['login-redirect'] : ( ! empty($atts['redirect']) ? $atts['redirect'] : '');
181 181
 
182
-	return give_login_form( $atts['login-redirect'], $atts['logout-redirect'] );
182
+	return give_login_form($atts['login-redirect'], $atts['logout-redirect']);
183 183
 }
184 184
 
185
-add_shortcode( 'give_login', 'give_login_form_shortcode' );
185
+add_shortcode('give_login', 'give_login_form_shortcode');
186 186
 
187 187
 /**
188 188
  * Register Shortcode.
@@ -197,15 +197,15 @@  discard block
 block discarded – undo
197 197
  * @uses  give_register_form()
198 198
  * @return string
199 199
  */
200
-function give_register_form_shortcode( $atts, $content = null ) {
201
-	$atts = shortcode_atts( array(
200
+function give_register_form_shortcode($atts, $content = null) {
201
+	$atts = shortcode_atts(array(
202 202
 		'redirect' => '',
203
-	), $atts, 'give_register' );
203
+	), $atts, 'give_register');
204 204
 
205
-	return give_register_form( $atts['redirect'] );
205
+	return give_register_form($atts['redirect']);
206 206
 }
207 207
 
208
-add_shortcode( 'give_register', 'give_register_form_shortcode' );
208
+add_shortcode('give_register', 'give_register_form_shortcode');
209 209
 
210 210
 
211 211
 /**
@@ -220,62 +220,62 @@  discard block
 block discarded – undo
220 220
  *
221 221
  * @return string
222 222
  */
223
-function give_receipt_shortcode( $atts, $content = null ) {
223
+function give_receipt_shortcode($atts, $content = null) {
224 224
 
225 225
 	global $give_receipt_args, $payment;
226 226
 
227
-	$give_receipt_args = shortcode_atts( array(
228
-		'error'          => esc_html__( 'Sorry, you are missing the payment key to view this donation receipt.', 'give' ),
227
+	$give_receipt_args = shortcode_atts(array(
228
+		'error'          => esc_html__('Sorry, you are missing the payment key to view this donation receipt.', 'give'),
229 229
 		'price'          => true,
230 230
 		'donor'          => true,
231 231
 		'date'           => true,
232 232
 		'payment_key'    => false,
233 233
 		'payment_method' => true,
234 234
 		'payment_id'     => true
235
-	), $atts, 'give_receipt' );
235
+	), $atts, 'give_receipt');
236 236
 
237 237
 	//set $session var
238 238
 	$session = give_get_purchase_session();
239 239
 
240 240
 	//set payment key var
241
-	if ( isset( $_GET['payment_key'] ) ) {
242
-		$payment_key = urldecode( $_GET['payment_key'] );
243
-	} elseif ( $session ) {
241
+	if (isset($_GET['payment_key'])) {
242
+		$payment_key = urldecode($_GET['payment_key']);
243
+	} elseif ($session) {
244 244
 		$payment_key = $session['purchase_key'];
245
-	} elseif ( $give_receipt_args['payment_key'] ) {
245
+	} elseif ($give_receipt_args['payment_key']) {
246 246
 		$payment_key = $give_receipt_args['payment_key'];
247 247
 	}
248 248
 
249
-	$email_access = give_get_option( 'email_access' );
249
+	$email_access = give_get_option('email_access');
250 250
 
251 251
 	// No payment_key found & Email Access is Turned on:
252
-	if ( ! isset( $payment_key ) && $email_access == 'on' && ! Give()->email_access->token_exists ) {
252
+	if ( ! isset($payment_key) && $email_access == 'on' && ! Give()->email_access->token_exists) {
253 253
 
254 254
 		ob_start();
255 255
 
256
-		give_get_template_part( 'email-login-form' );
256
+		give_get_template_part('email-login-form');
257 257
 
258 258
 		return ob_get_clean();
259 259
 
260
-	} elseif ( ! isset( $payment_key ) ) {
260
+	} elseif ( ! isset($payment_key)) {
261 261
 
262
-		return give_output_error( $give_receipt_args['error'], false, 'error' );
262
+		return give_output_error($give_receipt_args['error'], false, 'error');
263 263
 
264 264
 	}
265 265
 
266
-	$payment_id    = give_get_purchase_id_by_key( $payment_key );
267
-	$user_can_view = give_can_view_receipt( $payment_key );
266
+	$payment_id    = give_get_purchase_id_by_key($payment_key);
267
+	$user_can_view = give_can_view_receipt($payment_key);
268 268
 
269 269
 	// Key was provided, but user is logged out. Offer them the ability to login and view the receipt.
270
-	if ( ! $user_can_view && $email_access == 'on' && ! Give()->email_access->token_exists ) {
270
+	if ( ! $user_can_view && $email_access == 'on' && ! Give()->email_access->token_exists) {
271 271
 
272 272
 		ob_start();
273 273
 
274
-		give_get_template_part( 'email-login-form' );
274
+		give_get_template_part('email-login-form');
275 275
 
276 276
 		return ob_get_clean();
277 277
 
278
-	} elseif ( ! $user_can_view ) {
278
+	} elseif ( ! $user_can_view) {
279 279
 
280 280
 		global $give_login_redirect;
281 281
 
@@ -283,9 +283,9 @@  discard block
 block discarded – undo
283 283
 
284 284
 		ob_start();
285 285
 
286
-		give_output_error( apply_filters( 'give_must_be_logged_in_error_message', esc_html__( 'You must be logged in to view this donation payment receipt.', 'give' ) ) );
286
+		give_output_error(apply_filters('give_must_be_logged_in_error_message', esc_html__('You must be logged in to view this donation payment receipt.', 'give')));
287 287
 
288
-		give_get_template_part( 'shortcode', 'login' );
288
+		give_get_template_part('shortcode', 'login');
289 289
 
290 290
 		$login_form = ob_get_clean();
291 291
 
@@ -300,13 +300,13 @@  discard block
 block discarded – undo
300 300
 	 * or if user is logged in and the user can view sensitive shop data.
301 301
 	 *
302 302
 	 */
303
-	if ( ! apply_filters( 'give_user_can_view_receipt', $user_can_view, $give_receipt_args ) ) {
304
-		return give_output_error( $give_receipt_args['error'], false, 'error' );
303
+	if ( ! apply_filters('give_user_can_view_receipt', $user_can_view, $give_receipt_args)) {
304
+		return give_output_error($give_receipt_args['error'], false, 'error');
305 305
 	}
306 306
 
307 307
 	ob_start();
308 308
 
309
-	give_get_template_part( 'shortcode', 'receipt' );
309
+	give_get_template_part('shortcode', 'receipt');
310 310
 
311 311
 	$display = ob_get_clean();
312 312
 
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
 
316 316
 }
317 317
 
318
-add_shortcode( 'give_receipt', 'give_receipt_shortcode' );
318
+add_shortcode('give_receipt', 'give_receipt_shortcode');
319 319
 
320 320
 /**
321 321
  * Profile Editor Shortcode.
@@ -335,18 +335,18 @@  discard block
 block discarded – undo
335 335
  *
336 336
  * @return string Output generated from the profile editor
337 337
  */
338
-function give_profile_editor_shortcode( $atts, $content = null ) {
338
+function give_profile_editor_shortcode($atts, $content = null) {
339 339
 
340 340
 	ob_start();
341 341
 
342
-	give_get_template_part( 'shortcode', 'profile-editor' );
342
+	give_get_template_part('shortcode', 'profile-editor');
343 343
 
344 344
 	$display = ob_get_clean();
345 345
 
346 346
 	return $display;
347 347
 }
348 348
 
349
-add_shortcode( 'give_profile_editor', 'give_profile_editor_shortcode' );
349
+add_shortcode('give_profile_editor', 'give_profile_editor_shortcode');
350 350
 
351 351
 /**
352 352
  * Process Profile Updater Form.
@@ -359,30 +359,30 @@  discard block
 block discarded – undo
359 359
  *
360 360
  * @return bool
361 361
  */
362
-function give_process_profile_editor_updates( $data ) {
362
+function give_process_profile_editor_updates($data) {
363 363
 	// Profile field change request
364
-	if ( empty( $_POST['give_profile_editor_submit'] ) && ! is_user_logged_in() ) {
364
+	if (empty($_POST['give_profile_editor_submit']) && ! is_user_logged_in()) {
365 365
 		return false;
366 366
 	}
367 367
 
368 368
 	// Nonce security
369
-	if ( ! wp_verify_nonce( $data['give_profile_editor_nonce'], 'give-profile-editor-nonce' ) ) {
369
+	if ( ! wp_verify_nonce($data['give_profile_editor_nonce'], 'give-profile-editor-nonce')) {
370 370
 		return false;
371 371
 	}
372 372
 
373 373
 	$user_id       = get_current_user_id();
374
-	$old_user_data = get_userdata( $user_id );
375
-
376
-	$display_name = isset( $data['give_display_name'] ) ? sanitize_text_field( $data['give_display_name'] ) : $old_user_data->display_name;
377
-	$first_name   = isset( $data['give_first_name'] ) ? sanitize_text_field( $data['give_first_name'] ) : $old_user_data->first_name;
378
-	$last_name    = isset( $data['give_last_name'] ) ? sanitize_text_field( $data['give_last_name'] ) : $old_user_data->last_name;
379
-	$email        = isset( $data['give_email'] ) ? sanitize_email( $data['give_email'] ) : $old_user_data->user_email;
380
-	$line1        = ( isset( $data['give_address_line1'] ) ? sanitize_text_field( $data['give_address_line1'] ) : '' );
381
-	$line2        = ( isset( $data['give_address_line2'] ) ? sanitize_text_field( $data['give_address_line2'] ) : '' );
382
-	$city         = ( isset( $data['give_address_city'] ) ? sanitize_text_field( $data['give_address_city'] ) : '' );
383
-	$state        = ( isset( $data['give_address_state'] ) ? sanitize_text_field( $data['give_address_state'] ) : '' );
384
-	$zip          = ( isset( $data['give_address_zip'] ) ? sanitize_text_field( $data['give_address_zip'] ) : '' );
385
-	$country      = ( isset( $data['give_address_country'] ) ? sanitize_text_field( $data['give_address_country'] ) : '' );
374
+	$old_user_data = get_userdata($user_id);
375
+
376
+	$display_name = isset($data['give_display_name']) ? sanitize_text_field($data['give_display_name']) : $old_user_data->display_name;
377
+	$first_name   = isset($data['give_first_name']) ? sanitize_text_field($data['give_first_name']) : $old_user_data->first_name;
378
+	$last_name    = isset($data['give_last_name']) ? sanitize_text_field($data['give_last_name']) : $old_user_data->last_name;
379
+	$email        = isset($data['give_email']) ? sanitize_email($data['give_email']) : $old_user_data->user_email;
380
+	$line1        = (isset($data['give_address_line1']) ? sanitize_text_field($data['give_address_line1']) : '');
381
+	$line2        = (isset($data['give_address_line2']) ? sanitize_text_field($data['give_address_line2']) : '');
382
+	$city         = (isset($data['give_address_city']) ? sanitize_text_field($data['give_address_city']) : '');
383
+	$state        = (isset($data['give_address_state']) ? sanitize_text_field($data['give_address_state']) : '');
384
+	$zip          = (isset($data['give_address_zip']) ? sanitize_text_field($data['give_address_zip']) : '');
385
+	$country      = (isset($data['give_address_country']) ? sanitize_text_field($data['give_address_country']) : '');
386 386
 
387 387
 	$userdata = array(
388 388
 		'ID'           => $user_id,
@@ -410,46 +410,46 @@  discard block
 block discarded – undo
410 410
 	 * @param int   $user_id  The ID of the user.
411 411
 	 * @param array $userdata User info, including ID, first name, last name, display name and email.
412 412
 	 */
413
-	do_action( 'give_pre_update_user_profile', $user_id, $userdata );
413
+	do_action('give_pre_update_user_profile', $user_id, $userdata);
414 414
 
415 415
 	// New password
416
-	if ( ! empty( $data['give_new_user_pass1'] ) ) {
417
-		if ( $data['give_new_user_pass1'] !== $data['give_new_user_pass2'] ) {
418
-			give_set_error( 'password_mismatch', esc_html__( 'The passwords you entered do not match. Please try again.', 'give' ) );
416
+	if ( ! empty($data['give_new_user_pass1'])) {
417
+		if ($data['give_new_user_pass1'] !== $data['give_new_user_pass2']) {
418
+			give_set_error('password_mismatch', esc_html__('The passwords you entered do not match. Please try again.', 'give'));
419 419
 		} else {
420 420
 			$userdata['user_pass'] = $data['give_new_user_pass1'];
421 421
 		}
422 422
 	}
423 423
 
424
-	if( empty( $email ) ) {
424
+	if (empty($email)) {
425 425
 		// Make sure email should not be empty.
426
-		give_set_error( 'email_empty', esc_html__( 'The email you entered is empty.', 'give' ) );
426
+		give_set_error('email_empty', esc_html__('The email you entered is empty.', 'give'));
427 427
 
428
-	}else if ( ! is_email( $email ) ){
428
+	} else if ( ! is_email($email)) {
429 429
 		// Make sure email should be valid.
430
-		give_set_error( 'email_not_valid', esc_html__( 'The email you entered is not valid. Please use another', 'give' ) );
430
+		give_set_error('email_not_valid', esc_html__('The email you entered is not valid. Please use another', 'give'));
431 431
 
432
-	}else if ( $email != $old_user_data->user_email ) {
432
+	} else if ($email != $old_user_data->user_email) {
433 433
 		// Make sure the new email doesn't belong to another user
434
-		if ( email_exists( $email ) ) {
435
-			give_set_error( 'email_exists', esc_html__( 'The email you entered belongs to another user. Please use another.', 'give' ) );
434
+		if (email_exists($email)) {
435
+			give_set_error('email_exists', esc_html__('The email you entered belongs to another user. Please use another.', 'give'));
436 436
 		}
437 437
 	}
438 438
 
439 439
 	// Check for errors
440 440
 	$errors = give_get_errors();
441 441
 
442
-	if ( $errors ) {
442
+	if ($errors) {
443 443
 		// Send back to the profile editor if there are errors
444
-		wp_redirect( $data['give_redirect'] );
444
+		wp_redirect($data['give_redirect']);
445 445
 		give_die();
446 446
 	}
447 447
 
448 448
 	// Update the user
449
-	$meta    = update_user_meta( $user_id, '_give_user_address', $address );
450
-	$updated = wp_update_user( $userdata );
449
+	$meta    = update_user_meta($user_id, '_give_user_address', $address);
450
+	$updated = wp_update_user($userdata);
451 451
 
452
-	if ( $updated ) {
452
+	if ($updated) {
453 453
 
454 454
 		/**
455 455
 		 * Fires after updating user profile.
@@ -459,13 +459,13 @@  discard block
 block discarded – undo
459 459
 		 * @param int   $user_id  The ID of the user.
460 460
 		 * @param array $userdata User info, including ID, first name, last name, display name and email.
461 461
 		 */
462
-		do_action( 'give_user_profile_updated', $user_id, $userdata );
463
-		wp_redirect( add_query_arg( 'updated', 'true', $data['give_redirect'] ) );
462
+		do_action('give_user_profile_updated', $user_id, $userdata);
463
+		wp_redirect(add_query_arg('updated', 'true', $data['give_redirect']));
464 464
 		give_die();
465 465
 	}
466 466
 
467 467
 	return false;
468 468
 }
469 469
 
470
-add_action( 'give_edit_user_profile', 'give_process_profile_editor_updates' );
470
+add_action('give_edit_user_profile', 'give_process_profile_editor_updates');
471 471
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -425,11 +425,11 @@
 block discarded – undo
425 425
 		// Make sure email should not be empty.
426 426
 		give_set_error( 'email_empty', esc_html__( 'The email you entered is empty.', 'give' ) );
427 427
 
428
-	}else if ( ! is_email( $email ) ){
428
+	} else if ( ! is_email( $email ) ){
429 429
 		// Make sure email should be valid.
430 430
 		give_set_error( 'email_not_valid', esc_html__( 'The email you entered is not valid. Please use another', 'give' ) );
431 431
 
432
-	}else if ( $email != $old_user_data->user_email ) {
432
+	} else if ( $email != $old_user_data->user_email ) {
433 433
 		// Make sure the new email doesn't belong to another user
434 434
 		if ( email_exists( $email ) ) {
435 435
 			give_set_error( 'email_exists', esc_html__( 'The email you entered belongs to another user. Please use another.', 'give' ) );
Please login to merge, or discard this patch.
includes/price-functions.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -23,13 +23,13 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return bool true if has variable prices, false otherwise
25 25
  */
26
-function give_has_variable_prices( $form_id = 0 ) {
26
+function give_has_variable_prices($form_id = 0) {
27 27
 
28
-	if ( empty( $form_id ) ) {
28
+	if (empty($form_id)) {
29 29
 		return false;
30 30
 	}
31 31
 
32
-	$form = new Give_Donate_Form( $form_id );
32
+	$form = new Give_Donate_Form($form_id);
33 33
 
34 34
 	return $form->has_variable_prices();
35 35
 }
@@ -44,13 +44,13 @@  discard block
 block discarded – undo
44 44
  *
45 45
  * @return array Variable prices
46 46
  */
47
-function give_get_variable_prices( $form_id = 0 ) {
47
+function give_get_variable_prices($form_id = 0) {
48 48
 
49
-	if ( empty( $form_id ) ) {
49
+	if (empty($form_id)) {
50 50
 		return false;
51 51
 	}
52 52
 
53
-	$form = new Give_Donate_Form( $form_id );
53
+	$form = new Give_Donate_Form($form_id);
54 54
 
55 55
 	return $form->prices;
56 56
 
@@ -67,13 +67,13 @@  discard block
 block discarded – undo
67 67
  *
68 68
  * @return string $default_price
69 69
  */
70
-function give_get_default_multilevel_amount( $form_id ) {
70
+function give_get_default_multilevel_amount($form_id) {
71 71
 	$default_price = '1.00';
72
-	$prices        = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id );
72
+	$prices        = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id);
73 73
 
74
-	foreach ( $prices as $price ) {
74
+	foreach ($prices as $price) {
75 75
 
76
-		if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) {
76
+		if (isset($price['_give_default']) && $price['_give_default'] === 'default') {
77 77
 			$default_price = $price['_give_amount'];
78 78
 		}
79 79
 
@@ -94,15 +94,15 @@  discard block
 block discarded – undo
94 94
  * @return string $default_price
95 95
  * @since      1.0
96 96
  */
97
-function give_get_default_form_amount( $form_id ) {
97
+function give_get_default_form_amount($form_id) {
98 98
 
99
-	if ( give_has_variable_prices( $form_id ) ) {
99
+	if (give_has_variable_prices($form_id)) {
100 100
 
101
-		$default_amount = give_get_default_multilevel_amount( $form_id );
101
+		$default_amount = give_get_default_multilevel_amount($form_id);
102 102
 
103 103
 	} else {
104 104
 
105
-		$default_amount = get_post_meta( $form_id, '_give_set_price', true );
105
+		$default_amount = get_post_meta($form_id, '_give_set_price', true);
106 106
 
107 107
 	}
108 108
 
@@ -123,13 +123,13 @@  discard block
 block discarded – undo
123 123
  * 
124 124
  * @return bool
125 125
  */
126
-function give_is_custom_price_mode( $form_id = 0 ) {
126
+function give_is_custom_price_mode($form_id = 0) {
127 127
 
128
-	if ( empty( $form_id ) ) {
128
+	if (empty($form_id)) {
129 129
 		return false;
130 130
 	}
131 131
 
132
-	$form = new Give_Donate_Form( $form_id );
132
+	$form = new Give_Donate_Form($form_id);
133 133
 
134 134
 	return $form->is_custom_price_mode();
135 135
 }
136 136
\ No newline at end of file
Please login to merge, or discard this patch.
includes/forms/functions.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -781,7 +781,7 @@
 block discarded – undo
781 781
 	foreach ( $prices as $price ) {
782 782
 		if ( isset( $price['_give_id']['level_id'] ) && $price['_give_id']['level_id'] == $price_id ) {
783 783
 			$amount = isset( $price['_give_amount'] ) ? $price['_give_amount'] : 0.00;
784
-            break;
784
+			break;
785 785
 		};
786 786
 	}
787 787
 
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
  * Used to redirect a user back to the purchase
157 157
  * page if there are errors present.
158 158
  *
159
- * @param array $args
159
+ * @param string $args
160 160
  *
161 161
  * @access public
162 162
  * @since  1.0
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
  *
391 391
  * @param int $form_id Give Form ID
392 392
  *
393
- * @return int $earnings Earnings for a certain form
393
+ * @return double $earnings Earnings for a certain form
394 394
  */
395 395
 function give_get_form_earnings_stats( $form_id = 0 ) {
396 396
 	$give_form = new Give_Donate_Form( $form_id );
Please login to merge, or discard this patch.
Spacing   +190 added lines, -190 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -23,14 +23,14 @@  discard block
 block discarded – undo
23 23
 
24 24
 	global $typenow;
25 25
 
26
-	if ( $typenow != 'give_forms' ) {
26
+	if ($typenow != 'give_forms') {
27 27
 		return true;
28 28
 	}
29 29
 
30 30
 	return false;
31 31
 }
32 32
 
33
-add_filter( 'give_shortcode_button_condition', 'give_shortcode_button_condition' );
33
+add_filter('give_shortcode_button_condition', 'give_shortcode_button_condition');
34 34
 
35 35
 
36 36
 /**
@@ -40,11 +40,11 @@  discard block
 block discarded – undo
40 40
  *
41 41
  * @return int|false
42 42
  */
43
-function get_form_id_from_args( $args ) {
43
+function get_form_id_from_args($args) {
44 44
 
45
-	if ( isset( $args['form_id'] ) && $args['form_id'] != 0 ) {
45
+	if (isset($args['form_id']) && $args['form_id'] != 0) {
46 46
 
47
-		return intval( $args['form_id'] );
47
+		return intval($args['form_id']);
48 48
 	}
49 49
 
50 50
 	return false;
@@ -59,23 +59,23 @@  discard block
 block discarded – undo
59 59
  *
60 60
  * @return bool
61 61
  */
62
-function give_is_float_labels_enabled( $args ) {
62
+function give_is_float_labels_enabled($args) {
63 63
 
64 64
 	$float_labels = '';
65 65
 
66
-	if ( ! empty( $args['float_labels'] ) ) {
66
+	if ( ! empty($args['float_labels'])) {
67 67
 		$float_labels = $args['float_labels'];
68 68
 	}
69 69
 
70
-	if ( empty( $float_labels ) ) {
71
-		$float_labels = get_post_meta( $args['form_id'], '_give_form_floating_labels', true );
70
+	if (empty($float_labels)) {
71
+		$float_labels = get_post_meta($args['form_id'], '_give_form_floating_labels', true);
72 72
 	}
73 73
 
74
-	if ( empty( $float_labels ) ) {
75
-		$float_labels = give_get_option( 'enable_floatlabels' ) ? 'enabled' : 'disabled';
74
+	if (empty($float_labels)) {
75
+		$float_labels = give_get_option('enable_floatlabels') ? 'enabled' : 'disabled';
76 76
 	}
77 77
 
78
-	return ( $float_labels == 'enabled' ) ? true : false;
78
+	return ($float_labels == 'enabled') ? true : false;
79 79
 }
80 80
 
81 81
 /**
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 
92 92
 	$can_checkout = true;
93 93
 
94
-	return (bool) apply_filters( 'give_can_checkout', $can_checkout );
94
+	return (bool) apply_filters('give_can_checkout', $can_checkout);
95 95
 }
96 96
 
97 97
 /**
@@ -105,9 +105,9 @@  discard block
 block discarded – undo
105 105
 function give_get_success_page_uri() {
106 106
 	global $give_options;
107 107
 
108
-	$success_page = isset( $give_options['success_page'] ) ? get_permalink( absint( $give_options['success_page'] ) ) : get_bloginfo( 'url' );
108
+	$success_page = isset($give_options['success_page']) ? get_permalink(absint($give_options['success_page'])) : get_bloginfo('url');
109 109
 
110
-	return apply_filters( 'give_get_success_page_uri', $success_page );
110
+	return apply_filters('give_get_success_page_uri', $success_page);
111 111
 }
112 112
 
113 113
 /**
@@ -119,9 +119,9 @@  discard block
 block discarded – undo
119 119
  */
120 120
 function give_is_success_page() {
121 121
 	global $give_options;
122
-	$is_success_page = isset( $give_options['success_page'] ) ? is_page( $give_options['success_page'] ) : false;
122
+	$is_success_page = isset($give_options['success_page']) ? is_page($give_options['success_page']) : false;
123 123
 
124
-	return apply_filters( 'give_is_success_page', $is_success_page );
124
+	return apply_filters('give_is_success_page', $is_success_page);
125 125
 }
126 126
 
127 127
 /**
@@ -135,17 +135,17 @@  discard block
 block discarded – undo
135 135
  * @since       1.0
136 136
  * @return      void
137 137
  */
138
-function give_send_to_success_page( $query_string = null ) {
138
+function give_send_to_success_page($query_string = null) {
139 139
 
140 140
 	$redirect = give_get_success_page_uri();
141 141
 
142
-	if ( $query_string ) {
142
+	if ($query_string) {
143 143
 		$redirect .= $query_string;
144 144
 	}
145 145
 
146
-	$gateway = isset( $_REQUEST['give-gateway'] ) ? $_REQUEST['give-gateway'] : '';
146
+	$gateway = isset($_REQUEST['give-gateway']) ? $_REQUEST['give-gateway'] : '';
147 147
 
148
-	wp_redirect( apply_filters( 'give_success_page_redirect', $redirect, $gateway, $query_string ) );
148
+	wp_redirect(apply_filters('give_success_page_redirect', $redirect, $gateway, $query_string));
149 149
 	give_die();
150 150
 }
151 151
 
@@ -162,17 +162,17 @@  discard block
 block discarded – undo
162 162
  * @since  1.0
163 163
  * @return Void
164 164
  */
165
-function give_send_back_to_checkout( $args = array() ) {
165
+function give_send_back_to_checkout($args = array()) {
166 166
 
167
-	if ( isset( $_POST['give-current-url'] ) ) {
168
-		$url = sanitize_text_field( $_POST['give-current-url']);
167
+	if (isset($_POST['give-current-url'])) {
168
+		$url = sanitize_text_field($_POST['give-current-url']);
169 169
 	} else {
170
-		wp_safe_redirect( home_url() );
170
+		wp_safe_redirect(home_url());
171 171
 		give_die();
172 172
 	}
173 173
 
174
-	if ( isset( $_POST['give-form-id'] ) ) {
175
-		$form_id = sanitize_text_field( $_POST['give-form-id']);
174
+	if (isset($_POST['give-form-id'])) {
175
+		$form_id = sanitize_text_field($_POST['give-form-id']);
176 176
 	} else {
177 177
 		$form_id = 0;
178 178
 	}
@@ -182,22 +182,22 @@  discard block
 block discarded – undo
182 182
 	);
183 183
 
184 184
 	// Check for backward compatibility
185
-	if ( is_string( $args ) ) {
186
-		$args = str_replace( '?', '', $args );
185
+	if (is_string($args)) {
186
+		$args = str_replace('?', '', $args);
187 187
 	}
188 188
 
189
-	$args = wp_parse_args( $args, $defaults );
189
+	$args = wp_parse_args($args, $defaults);
190 190
 
191 191
 	// Merge URL query with $args to maintain third-party URL parameters after redirect.
192
-	$url_data = wp_parse_url( $url );
193
-	parse_str( $url_data['query'], $query );
194
-	$new_query = array_merge( $args, $query );
195
-	$new_query_string = http_build_query( $new_query );
192
+	$url_data = wp_parse_url($url);
193
+	parse_str($url_data['query'], $query);
194
+	$new_query = array_merge($args, $query);
195
+	$new_query_string = http_build_query($new_query);
196 196
 
197 197
 	// Assemble URL parts.
198
-	$redirect = home_url( '/' . $url_data['path'] . '?' . $new_query_string . '#give-form-' . $form_id . '-wrap' );
198
+	$redirect = home_url('/'.$url_data['path'].'?'.$new_query_string.'#give-form-'.$form_id.'-wrap');
199 199
 
200
-	wp_safe_redirect( apply_filters( 'give_send_back_to_checkout', $redirect, $args ) );
200
+	wp_safe_redirect(apply_filters('give_send_back_to_checkout', $redirect, $args));
201 201
 	give_die();
202 202
 }
203 203
 
@@ -212,16 +212,16 @@  discard block
 block discarded – undo
212 212
  * @since       1.0
213 213
  * @return      string
214 214
  */
215
-function give_get_success_page_url( $query_string = null ) {
215
+function give_get_success_page_url($query_string = null) {
216 216
 
217
-	$success_page = give_get_option( 'success_page', 0 );
218
-	$success_page = get_permalink( $success_page );
217
+	$success_page = give_get_option('success_page', 0);
218
+	$success_page = get_permalink($success_page);
219 219
 
220
-	if ( $query_string ) {
220
+	if ($query_string) {
221 221
 		$success_page .= $query_string;
222 222
 	}
223 223
 
224
-	return apply_filters( 'give_success_page_url', $success_page );
224
+	return apply_filters('give_success_page_url', $success_page);
225 225
 
226 226
 }
227 227
 
@@ -235,15 +235,15 @@  discard block
 block discarded – undo
235 235
  *
236 236
  * @return mixed|void Full URL to the Transaction Failed page, if present, home page if it doesn't exist
237 237
  */
238
-function give_get_failed_transaction_uri( $extras = false ) {
238
+function give_get_failed_transaction_uri($extras = false) {
239 239
 	global $give_options;
240 240
 
241
-	$uri = ! empty( $give_options['failure_page'] ) ? trailingslashit( get_permalink( $give_options['failure_page'] ) ) : home_url();
242
-	if ( $extras ) {
241
+	$uri = ! empty($give_options['failure_page']) ? trailingslashit(get_permalink($give_options['failure_page'])) : home_url();
242
+	if ($extras) {
243 243
 		$uri .= $extras;
244 244
 	}
245 245
 
246
-	return apply_filters( 'give_get_failed_transaction_uri', $uri );
246
+	return apply_filters('give_get_failed_transaction_uri', $uri);
247 247
 }
248 248
 
249 249
 /**
@@ -254,9 +254,9 @@  discard block
 block discarded – undo
254 254
  */
255 255
 function give_is_failed_transaction_page() {
256 256
 	global $give_options;
257
-	$ret = isset( $give_options['failure_page'] ) ? is_page( $give_options['failure_page'] ) : false;
257
+	$ret = isset($give_options['failure_page']) ? is_page($give_options['failure_page']) : false;
258 258
 
259
-	return apply_filters( 'give_is_failure_page', $ret );
259
+	return apply_filters('give_is_failure_page', $ret);
260 260
 }
261 261
 
262 262
 /**
@@ -268,18 +268,18 @@  discard block
 block discarded – undo
268 268
  */
269 269
 function give_listen_for_failed_payments() {
270 270
 
271
-	$failed_page = give_get_option( 'failure_page', 0 );
271
+	$failed_page = give_get_option('failure_page', 0);
272 272
 
273
-	if ( ! empty( $failed_page ) && is_page( $failed_page ) && ! empty( $_GET['payment-id'] ) ) {
273
+	if ( ! empty($failed_page) && is_page($failed_page) && ! empty($_GET['payment-id'])) {
274 274
 
275
-		$payment_id = absint( $_GET['payment-id'] );
276
-		give_update_payment_status( $payment_id, 'failed' );
275
+		$payment_id = absint($_GET['payment-id']);
276
+		give_update_payment_status($payment_id, 'failed');
277 277
 
278 278
 	}
279 279
 
280 280
 }
281 281
 
282
-add_action( 'template_redirect', 'give_listen_for_failed_payments' );
282
+add_action('template_redirect', 'give_listen_for_failed_payments');
283 283
 
284 284
 
285 285
 /**
@@ -292,11 +292,11 @@  discard block
 block discarded – undo
292 292
  * @since       1.0
293 293
  * @return      bool
294 294
  */
295
-function give_field_is_required( $field = '', $form_id ) {
295
+function give_field_is_required($field = '', $form_id) {
296 296
 
297
-	$required_fields = give_purchase_form_required_fields( $form_id );
297
+	$required_fields = give_purchase_form_required_fields($form_id);
298 298
 
299
-	return array_key_exists( $field, $required_fields );
299
+	return array_key_exists($field, $required_fields);
300 300
 }
301 301
 
302 302
 /**
@@ -314,14 +314,14 @@  discard block
 block discarded – undo
314 314
  *
315 315
  * @return void
316 316
  */
317
-function give_record_sale_in_log( $give_form_id = 0, $payment_id, $price_id = false, $sale_date = null ) {
317
+function give_record_sale_in_log($give_form_id = 0, $payment_id, $price_id = false, $sale_date = null) {
318 318
 	global $give_logs;
319 319
 
320 320
 	$log_data = array(
321 321
 		'post_parent'   => $give_form_id,
322 322
 		'log_type'      => 'sale',
323
-		'post_date'     => isset( $sale_date ) ? $sale_date : null,
324
-		'post_date_gmt' => isset( $sale_date ) ? $sale_date : null
323
+		'post_date'     => isset($sale_date) ? $sale_date : null,
324
+		'post_date_gmt' => isset($sale_date) ? $sale_date : null
325 325
 	);
326 326
 
327 327
 	$log_meta = array(
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
 		'price_id'   => (int) $price_id
330 330
 	);
331 331
 
332
-	$give_logs->insert_log( $log_data, $log_meta );
332
+	$give_logs->insert_log($log_data, $log_meta);
333 333
 }
334 334
 
335 335
 
@@ -343,11 +343,11 @@  discard block
 block discarded – undo
343 343
  *
344 344
  * @return bool|int
345 345
  */
346
-function give_increase_purchase_count( $form_id = 0, $quantity = 1 ) {
346
+function give_increase_purchase_count($form_id = 0, $quantity = 1) {
347 347
 	$quantity = (int) $quantity;
348
-	$form     = new Give_Donate_Form( $form_id );
348
+	$form     = new Give_Donate_Form($form_id);
349 349
 
350
-	return $form->increase_sales( $quantity );
350
+	return $form->increase_sales($quantity);
351 351
 }
352 352
 
353 353
 /**
@@ -360,11 +360,11 @@  discard block
 block discarded – undo
360 360
  *
361 361
  * @return bool|int
362 362
  */
363
-function give_decrease_purchase_count( $form_id = 0, $quantity = 1 ) {
363
+function give_decrease_purchase_count($form_id = 0, $quantity = 1) {
364 364
 	$quantity = (int) $quantity;
365
-	$form     = new Give_Donate_Form( $form_id );
365
+	$form     = new Give_Donate_Form($form_id);
366 366
 
367
-	return $form->decrease_sales( $quantity );
367
+	return $form->decrease_sales($quantity);
368 368
 }
369 369
 
370 370
 /**
@@ -377,10 +377,10 @@  discard block
 block discarded – undo
377 377
  *
378 378
  * @return bool|int
379 379
  */
380
-function give_increase_earnings( $give_form_id = 0, $amount ) {
381
-	$form = new Give_Donate_Form( $give_form_id );
380
+function give_increase_earnings($give_form_id = 0, $amount) {
381
+	$form = new Give_Donate_Form($give_form_id);
382 382
 
383
-	return $form->increase_earnings( $amount );
383
+	return $form->increase_earnings($amount);
384 384
 }
385 385
 
386 386
 /**
@@ -393,10 +393,10 @@  discard block
 block discarded – undo
393 393
  *
394 394
  * @return bool|int
395 395
  */
396
-function give_decrease_earnings( $form_id = 0, $amount ) {
397
-	$form = new Give_Donate_Form( $form_id );
396
+function give_decrease_earnings($form_id = 0, $amount) {
397
+	$form = new Give_Donate_Form($form_id);
398 398
 
399
-	return $form->decrease_earnings( $amount );
399
+	return $form->decrease_earnings($amount);
400 400
 }
401 401
 
402 402
 
@@ -409,8 +409,8 @@  discard block
 block discarded – undo
409 409
  *
410 410
  * @return int $earnings Earnings for a certain form
411 411
  */
412
-function give_get_form_earnings_stats( $form_id = 0 ) {
413
-	$give_form = new Give_Donate_Form( $form_id );
412
+function give_get_form_earnings_stats($form_id = 0) {
413
+	$give_form = new Give_Donate_Form($form_id);
414 414
 
415 415
 	return $give_form->earnings;
416 416
 }
@@ -425,8 +425,8 @@  discard block
 block discarded – undo
425 425
  *
426 426
  * @return int $sales Amount of sales for a certain form
427 427
  */
428
-function give_get_form_sales_stats( $give_form_id = 0 ) {
429
-	$give_form = new Give_Donate_Form( $give_form_id );
428
+function give_get_form_sales_stats($give_form_id = 0) {
429
+	$give_form = new Give_Donate_Form($give_form_id);
430 430
 
431 431
 	return $give_form->sales;
432 432
 }
@@ -441,16 +441,16 @@  discard block
 block discarded – undo
441 441
  *
442 442
  * @return float $sales Average monthly sales
443 443
  */
444
-function give_get_average_monthly_form_sales( $form_id = 0 ) {
445
-	$sales        = give_get_form_sales_stats( $form_id );
446
-	$release_date = get_post_field( 'post_date', $form_id );
444
+function give_get_average_monthly_form_sales($form_id = 0) {
445
+	$sales        = give_get_form_sales_stats($form_id);
446
+	$release_date = get_post_field('post_date', $form_id);
447 447
 
448
-	$diff = abs( current_time( 'timestamp' ) - strtotime( $release_date ) );
448
+	$diff = abs(current_time('timestamp') - strtotime($release_date));
449 449
 
450
-	$months = floor( $diff / ( 30 * 60 * 60 * 24 ) ); // Number of months since publication
450
+	$months = floor($diff / (30 * 60 * 60 * 24)); // Number of months since publication
451 451
 
452
-	if ( $months > 0 ) {
453
-		$sales = ( $sales / $months );
452
+	if ($months > 0) {
453
+		$sales = ($sales / $months);
454 454
 	}
455 455
 
456 456
 	return $sales;
@@ -466,16 +466,16 @@  discard block
 block discarded – undo
466 466
  *
467 467
  * @return float $earnings Average monthly earnings
468 468
  */
469
-function give_get_average_monthly_form_earnings( $form_id = 0 ) {
470
-	$earnings     = give_get_form_earnings_stats( $form_id );
471
-	$release_date = get_post_field( 'post_date', $form_id );
469
+function give_get_average_monthly_form_earnings($form_id = 0) {
470
+	$earnings     = give_get_form_earnings_stats($form_id);
471
+	$release_date = get_post_field('post_date', $form_id);
472 472
 
473
-	$diff = abs( current_time( 'timestamp' ) - strtotime( $release_date ) );
473
+	$diff = abs(current_time('timestamp') - strtotime($release_date));
474 474
 
475
-	$months = floor( $diff / ( 30 * 60 * 60 * 24 ) ); // Number of months since publication
475
+	$months = floor($diff / (30 * 60 * 60 * 24)); // Number of months since publication
476 476
 
477
-	if ( $months > 0 ) {
478
-		$earnings = ( $earnings / $months );
477
+	if ($months > 0) {
478
+		$earnings = ($earnings / $months);
479 479
 	}
480 480
 
481 481
 	return $earnings < 0 ? 0 : $earnings;
@@ -495,25 +495,25 @@  discard block
 block discarded – undo
495 495
  *
496 496
  * @return string $price_name Name of the price option
497 497
  */
498
-function give_get_price_option_name( $form_id = 0, $price_id = 0, $payment_id = 0 ) {
498
+function give_get_price_option_name($form_id = 0, $price_id = 0, $payment_id = 0) {
499 499
 
500
-	$prices     = give_get_variable_prices( $form_id );
500
+	$prices     = give_get_variable_prices($form_id);
501 501
 	$price_name = '';
502 502
 
503
-	foreach ( $prices as $price ) {
503
+	foreach ($prices as $price) {
504 504
 
505
-		if ( intval( $price['_give_id']['level_id'] ) == intval( $price_id ) ) {
505
+		if (intval($price['_give_id']['level_id']) == intval($price_id)) {
506 506
 
507
-			$price_text     = isset( $price['_give_text'] ) ? $price['_give_text'] : '';
508
-			$price_fallback = give_currency_filter( give_format_amount( $price['_give_amount'] ) );
509
-			$price_name     = ! empty( $price_text ) ? $price_text : $price_fallback;
507
+			$price_text     = isset($price['_give_text']) ? $price['_give_text'] : '';
508
+			$price_fallback = give_currency_filter(give_format_amount($price['_give_amount']));
509
+			$price_name     = ! empty($price_text) ? $price_text : $price_fallback;
510 510
 
511 511
 		}
512 512
 
513 513
 	}
514 514
 
515 515
 
516
-	return apply_filters( 'give_get_price_option_name', $price_name, $form_id, $payment_id, $price_id );
516
+	return apply_filters('give_get_price_option_name', $price_name, $form_id, $payment_id, $price_id);
517 517
 }
518 518
 
519 519
 
@@ -526,14 +526,14 @@  discard block
 block discarded – undo
526 526
  *
527 527
  * @return string $range A fully formatted price range
528 528
  */
529
-function give_price_range( $form_id = 0 ) {
530
-	$low   = give_get_lowest_price_option( $form_id );
531
-	$high  = give_get_highest_price_option( $form_id );
532
-	$range = '<span class="give_price_range_low">' . give_currency_filter( give_format_amount( $low ) ) . '</span>';
529
+function give_price_range($form_id = 0) {
530
+	$low   = give_get_lowest_price_option($form_id);
531
+	$high  = give_get_highest_price_option($form_id);
532
+	$range = '<span class="give_price_range_low">'.give_currency_filter(give_format_amount($low)).'</span>';
533 533
 	$range .= '<span class="give_price_range_sep">&nbsp;&ndash;&nbsp;</span>';
534
-	$range .= '<span class="give_price_range_high">' . give_currency_filter( give_format_amount( $high ) ) . '</span>';
534
+	$range .= '<span class="give_price_range_high">'.give_currency_filter(give_format_amount($high)).'</span>';
535 535
 
536
-	return apply_filters( 'give_price_range', $range, $form_id, $low, $high );
536
+	return apply_filters('give_price_range', $range, $form_id, $low, $high);
537 537
 }
538 538
 
539 539
 
@@ -548,36 +548,36 @@  discard block
 block discarded – undo
548 548
  *
549 549
  * @return int ID of the lowest price
550 550
  */
551
-function give_get_lowest_price_id( $form_id = 0 ) {
551
+function give_get_lowest_price_id($form_id = 0) {
552 552
 
553
-	if ( empty( $form_id ) ) {
553
+	if (empty($form_id)) {
554 554
 		$form_id = get_the_ID();
555 555
 	}
556 556
 
557
-	if ( ! give_has_variable_prices( $form_id ) ) {
558
-		return give_get_form_price( $form_id );
557
+	if ( ! give_has_variable_prices($form_id)) {
558
+		return give_get_form_price($form_id);
559 559
 	}
560 560
 
561
-	$prices = give_get_variable_prices( $form_id );
561
+	$prices = give_get_variable_prices($form_id);
562 562
 
563 563
 	$low    = 0.00;
564 564
 	$min_id = 1;
565 565
 
566
-	if ( ! empty( $prices ) ) {
566
+	if ( ! empty($prices)) {
567 567
 
568
-		foreach ( $prices as $key => $price ) {
568
+		foreach ($prices as $key => $price) {
569 569
 
570
-			if ( empty( $price['_give_amount'] ) ) {
570
+			if (empty($price['_give_amount'])) {
571 571
 				continue;
572 572
 			}
573 573
 
574
-			if ( ! isset( $min ) ) {
574
+			if ( ! isset($min)) {
575 575
 				$min = $price['_give_amount'];
576 576
 			} else {
577
-				$min = min( $min, $price['_give_amount'] );
577
+				$min = min($min, $price['_give_amount']);
578 578
 			}
579 579
 
580
-			if ( $price['_give_amount'] == $min ) {
580
+			if ($price['_give_amount'] == $min) {
581 581
 				$min_id = $price['_give_id']['level_id'];
582 582
 			}
583 583
 		}
@@ -595,43 +595,43 @@  discard block
 block discarded – undo
595 595
  *
596 596
  * @return float Amount of the lowest price
597 597
  */
598
-function give_get_lowest_price_option( $form_id = 0 ) {
599
-	if ( empty( $form_id ) ) {
598
+function give_get_lowest_price_option($form_id = 0) {
599
+	if (empty($form_id)) {
600 600
 		$form_id = get_the_ID();
601 601
 	}
602 602
 
603
-	if ( ! give_has_variable_prices( $form_id ) ) {
604
-		return give_get_form_price( $form_id );
603
+	if ( ! give_has_variable_prices($form_id)) {
604
+		return give_get_form_price($form_id);
605 605
 	}
606 606
 
607
-	$prices = give_get_variable_prices( $form_id );
607
+	$prices = give_get_variable_prices($form_id);
608 608
 
609 609
 	$low = 0.00;
610 610
 
611
-	if ( ! empty( $prices ) ) {
611
+	if ( ! empty($prices)) {
612 612
 
613
-		foreach ( $prices as $key => $price ) {
613
+		foreach ($prices as $key => $price) {
614 614
 
615
-			if ( empty( $price['_give_amount'] ) ) {
615
+			if (empty($price['_give_amount'])) {
616 616
 				continue;
617 617
 			}
618 618
 
619
-			if ( ! isset( $min ) ) {
619
+			if ( ! isset($min)) {
620 620
 				$min = $price['_give_amount'];
621 621
 			} else {
622
-				$min = min( $min, give_sanitize_amount( $price['_give_amount'] ) );
622
+				$min = min($min, give_sanitize_amount($price['_give_amount']));
623 623
 			}
624 624
 
625
-			if ( $price['_give_amount'] == $min ) {
625
+			if ($price['_give_amount'] == $min) {
626 626
 				$min_id = $key;
627 627
 			}
628 628
 		}
629 629
 
630
-		$low = $prices[ $min_id ]['_give_amount'];
630
+		$low = $prices[$min_id]['_give_amount'];
631 631
 
632 632
 	}
633 633
 
634
-	return give_sanitize_amount( $low );
634
+	return give_sanitize_amount($low);
635 635
 }
636 636
 
637 637
 /**
@@ -643,41 +643,41 @@  discard block
 block discarded – undo
643 643
  *
644 644
  * @return float Amount of the highest price
645 645
  */
646
-function give_get_highest_price_option( $form_id = 0 ) {
646
+function give_get_highest_price_option($form_id = 0) {
647 647
 
648
-	if ( empty( $form_id ) ) {
648
+	if (empty($form_id)) {
649 649
 		$form_id = get_the_ID();
650 650
 	}
651 651
 
652
-	if ( ! give_has_variable_prices( $form_id ) ) {
653
-		return give_get_form_price( $form_id );
652
+	if ( ! give_has_variable_prices($form_id)) {
653
+		return give_get_form_price($form_id);
654 654
 	}
655 655
 
656
-	$prices = give_get_variable_prices( $form_id );
656
+	$prices = give_get_variable_prices($form_id);
657 657
 
658 658
 	$high = 0.00;
659 659
 
660
-	if ( ! empty( $prices ) ) {
660
+	if ( ! empty($prices)) {
661 661
 
662 662
 		$max = 0;
663 663
 
664
-		foreach ( $prices as $key => $price ) {
665
-			if ( empty( $price['_give_amount'] ) ) {
664
+		foreach ($prices as $key => $price) {
665
+			if (empty($price['_give_amount'])) {
666 666
 				continue;
667 667
 			}
668
-			$give_amount = give_sanitize_amount( $price['_give_amount'] );
668
+			$give_amount = give_sanitize_amount($price['_give_amount']);
669 669
 
670
-			$max = max( $max, $give_amount );
670
+			$max = max($max, $give_amount);
671 671
 
672
-			if ( $give_amount == $max ) {
672
+			if ($give_amount == $max) {
673 673
 				$max_id = $key;
674 674
 			}
675 675
 		}
676 676
 
677
-		$high = $prices[ $max_id ]['_give_amount'];
677
+		$high = $prices[$max_id]['_give_amount'];
678 678
 	}
679 679
 
680
-	return give_sanitize_amount( $high );
680
+	return give_sanitize_amount($high);
681 681
 }
682 682
 
683 683
 /**
@@ -689,15 +689,15 @@  discard block
 block discarded – undo
689 689
  *
690 690
  * @return mixed string|int Price of the form
691 691
  */
692
-function give_get_form_price( $form_id = 0 ) {
692
+function give_get_form_price($form_id = 0) {
693 693
 
694
-	if ( empty( $form_id ) ) {
694
+	if (empty($form_id)) {
695 695
 		return false;
696 696
 	}
697 697
 
698
-	$form = new Give_Donate_Form( $form_id );
698
+	$form = new Give_Donate_Form($form_id);
699 699
 
700
-	return $form->__get( 'price' );
700
+	return $form->__get('price');
701 701
 }
702 702
 
703 703
 /**
@@ -709,15 +709,15 @@  discard block
 block discarded – undo
709 709
  *
710 710
  * @return mixed string|int Minimum price of the form
711 711
  */
712
-function give_get_form_minimum_price( $form_id = 0 ) {
712
+function give_get_form_minimum_price($form_id = 0) {
713 713
 
714
-	if ( empty( $form_id ) ) {
714
+	if (empty($form_id)) {
715 715
 		return false;
716 716
 	}
717 717
 
718
-	$form = new Give_Donate_Form( $form_id );
718
+	$form = new Give_Donate_Form($form_id);
719 719
 
720
-	return $form->__get( 'minimum_price' );
720
+	return $form->__get('minimum_price');
721 721
 
722 722
 }
723 723
 
@@ -732,52 +732,52 @@  discard block
 block discarded – undo
732 732
  *
733 733
  * @return int $formatted_price
734 734
  */
735
-function give_price( $form_id = 0, $echo = true, $price_id = false ) {
735
+function give_price($form_id = 0, $echo = true, $price_id = false) {
736 736
 
737
-	if ( empty( $form_id ) ) {
737
+	if (empty($form_id)) {
738 738
 		$form_id = get_the_ID();
739 739
 	}
740 740
 
741
-	if ( give_has_variable_prices( $form_id ) ) {
741
+	if (give_has_variable_prices($form_id)) {
742 742
 
743
-		$prices = give_get_variable_prices( $form_id );
743
+		$prices = give_get_variable_prices($form_id);
744 744
 
745
-		if ( false !== $price_id ) {
745
+		if (false !== $price_id) {
746 746
 
747 747
 			//loop through multi-prices to see which is default
748
-			foreach ( $prices as $price ) {
748
+			foreach ($prices as $price) {
749 749
 				//this is the default price
750
-				if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) {
750
+				if (isset($price['_give_default']) && $price['_give_default'] === 'default') {
751 751
 					$price = (float) $price['_give_amount'];
752 752
 				};
753 753
 			}
754 754
 
755 755
 		} else {
756 756
 
757
-			$price = give_get_lowest_price_option( $form_id );
757
+			$price = give_get_lowest_price_option($form_id);
758 758
 		}
759 759
 
760
-		$price = give_sanitize_amount( $price );
760
+		$price = give_sanitize_amount($price);
761 761
 
762 762
 	} else {
763 763
 
764
-		$price = give_get_form_price( $form_id );
764
+		$price = give_get_form_price($form_id);
765 765
 
766 766
 	}
767 767
 
768
-	$price           = apply_filters( 'give_form_price', give_sanitize_amount( $price ), $form_id );
769
-	$formatted_price = '<span class="give_price" id="give_price_' . $form_id . '">' . $price . '</span>';
770
-	$formatted_price = apply_filters( 'give_form_price_after_html', $formatted_price, $form_id, $price );
768
+	$price           = apply_filters('give_form_price', give_sanitize_amount($price), $form_id);
769
+	$formatted_price = '<span class="give_price" id="give_price_'.$form_id.'">'.$price.'</span>';
770
+	$formatted_price = apply_filters('give_form_price_after_html', $formatted_price, $form_id, $price);
771 771
 
772
-	if ( $echo ) {
772
+	if ($echo) {
773 773
 		echo $formatted_price;
774 774
 	} else {
775 775
 		return $formatted_price;
776 776
 	}
777 777
 }
778 778
 
779
-add_filter( 'give_form_price', 'give_format_amount', 10 );
780
-add_filter( 'give_form_price', 'give_currency_filter', 20 );
779
+add_filter('give_form_price', 'give_format_amount', 10);
780
+add_filter('give_form_price', 'give_currency_filter', 20);
781 781
 
782 782
 
783 783
 /**
@@ -790,19 +790,19 @@  discard block
 block discarded – undo
790 790
  *
791 791
  * @return float $amount Amount of the price option
792 792
  */
793
-function give_get_price_option_amount( $form_id = 0, $price_id = 0 ) {
794
-	$prices = give_get_variable_prices( $form_id );
793
+function give_get_price_option_amount($form_id = 0, $price_id = 0) {
794
+	$prices = give_get_variable_prices($form_id);
795 795
 
796 796
 	$amount = 0.00;
797 797
 
798
-	foreach ( $prices as $price ) {
799
-		if ( isset( $price['_give_id']['level_id'] ) && $price['_give_id']['level_id'] == $price_id ) {
800
-			$amount = isset( $price['_give_amount'] ) ? $price['_give_amount'] : 0.00;
798
+	foreach ($prices as $price) {
799
+		if (isset($price['_give_id']['level_id']) && $price['_give_id']['level_id'] == $price_id) {
800
+			$amount = isset($price['_give_amount']) ? $price['_give_amount'] : 0.00;
801 801
             break;
802 802
 		};
803 803
 	}
804 804
 
805
-	return apply_filters( 'give_get_price_option_amount', give_sanitize_amount( $amount ), $form_id, $price_id );
805
+	return apply_filters('give_get_price_option_amount', give_sanitize_amount($amount), $form_id, $price_id);
806 806
 }
807 807
 
808 808
 /**
@@ -814,13 +814,13 @@  discard block
 block discarded – undo
814 814
  *
815 815
  * @return mixed string|int Goal of the form
816 816
  */
817
-function give_get_form_goal( $form_id = 0 ) {
817
+function give_get_form_goal($form_id = 0) {
818 818
 
819
-	if ( empty( $form_id ) ) {
819
+	if (empty($form_id)) {
820 820
 		return false;
821 821
 	}
822 822
 
823
-	$form = new Give_Donate_Form( $form_id );
823
+	$form = new Give_Donate_Form($form_id);
824 824
 
825 825
 	return $form->goal;
826 826
 
@@ -836,27 +836,27 @@  discard block
 block discarded – undo
836 836
  *
837 837
  * @return string $formatted_goal
838 838
  */
839
-function give_goal( $form_id = 0, $echo = true ) {
839
+function give_goal($form_id = 0, $echo = true) {
840 840
 
841
-	if ( empty( $form_id ) ) {
841
+	if (empty($form_id)) {
842 842
 		$form_id = get_the_ID();
843 843
 	}
844 844
 
845
-	$goal = give_get_form_goal( $form_id );
845
+	$goal = give_get_form_goal($form_id);
846 846
 
847
-	$goal           = apply_filters( 'give_form_goal', give_sanitize_amount( $goal ), $form_id );
848
-	$formatted_goal = '<span class="give_price" id="give_price_' . $form_id . '">' . $goal . '</span>';
849
-	$formatted_goal = apply_filters( 'give_form_price_after_html', $formatted_goal, $form_id, $goal );
847
+	$goal           = apply_filters('give_form_goal', give_sanitize_amount($goal), $form_id);
848
+	$formatted_goal = '<span class="give_price" id="give_price_'.$form_id.'">'.$goal.'</span>';
849
+	$formatted_goal = apply_filters('give_form_price_after_html', $formatted_goal, $form_id, $goal);
850 850
 
851
-	if ( $echo ) {
851
+	if ($echo) {
852 852
 		echo $formatted_goal;
853 853
 	} else {
854 854
 		return $formatted_goal;
855 855
 	}
856 856
 }
857 857
 
858
-add_filter( 'give_form_goal', 'give_format_amount', 10 );
859
-add_filter( 'give_form_goal', 'give_currency_filter', 20 );
858
+add_filter('give_form_goal', 'give_format_amount', 10);
859
+add_filter('give_form_goal', 'give_currency_filter', 20);
860 860
 
861 861
 
862 862
 /**
@@ -870,13 +870,13 @@  discard block
 block discarded – undo
870 870
  *
871 871
  * @return bool  $ret Whether or not the logged_in_only setting is set
872 872
  */
873
-function give_logged_in_only( $form_id ) {
873
+function give_logged_in_only($form_id) {
874 874
 
875
-	$form_option = get_post_meta( $form_id, '_give_logged_in_only', true );
875
+	$form_option = get_post_meta($form_id, '_give_logged_in_only', true);
876 876
 
877
-	$ret = ! empty( $form_option ) ? $form_option : false;
877
+	$ret = ! empty($form_option) ? $form_option : false;
878 878
 
879
-	return (bool) apply_filters( 'give_logged_in_only', $ret, $form_id );
879
+	return (bool) apply_filters('give_logged_in_only', $ret, $form_id);
880 880
 
881 881
 }
882 882
 
@@ -890,10 +890,10 @@  discard block
 block discarded – undo
890 890
  *
891 891
  * @return string
892 892
  */
893
-function give_show_login_register_option( $form_id ) {
893
+function give_show_login_register_option($form_id) {
894 894
 
895
-	$show_register_form = get_post_meta( $form_id, '_give_show_register_form', true );
895
+	$show_register_form = get_post_meta($form_id, '_give_show_register_form', true);
896 896
 
897
-	return apply_filters( 'give_show_register_form', $show_register_form, $form_id );
897
+	return apply_filters('give_show_register_form', $show_register_form, $form_id);
898 898
 
899 899
 }
900 900
\ No newline at end of file
Please login to merge, or discard this patch.
includes/class-give-customer.php 3 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -544,7 +544,7 @@
 block discarded – undo
544 544
 
545 545
         if( $payment_total_diff > 0 ) {
546 546
             $this->increase_value( $payment_total_diff );
547
-        }else{
547
+        } else{
548 548
             // Pass payment total difference as +ve value to decrease amount from user lifetime stat.
549 549
             $this->decrease_value( -$payment_total_diff );
550 550
         }
Please login to merge, or discard this patch.
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -565,12 +565,12 @@  discard block
 block discarded – undo
565 565
 
566 566
 	/**
567 567
 	 * Decrease/Increase a customer's lifetime value.
568
-     *
569
-     * This function will update donation stat on basis of current amount and new amount donation difference.
570
-     * Difference value can positive or negative. Negative value will decrease user donation stat while positive value increase donation stat.
571
-     *
568
+	 *
569
+	 * This function will update donation stat on basis of current amount and new amount donation difference.
570
+	 * Difference value can positive or negative. Negative value will decrease user donation stat while positive value increase donation stat.
571
+	 *
572 572
 	 * @since  1.0
573
-     * @access public
573
+	 * @access public
574 574
 	 *
575 575
 	 * @param  float $curr_amount Current Donation amount.
576 576
 	 * @param  float $new_amount  New (changed) Donation amount.
@@ -578,35 +578,35 @@  discard block
 block discarded – undo
578 578
 	 * @return mixed              If successful, the new donation stat value, otherwise false.
579 579
 	 */
580 580
 	public function update_donation_value( $curr_amount, $new_amount ) {
581
-        /**
582
-         * Payment total difference value can be:
583
-         *  zero   (in case amount not change)
584
-         *  or -ve (in case amount decrease)
585
-         *  or +ve (in case amount increase)
586
-         */
587
-        $payment_total_diff = $new_amount - $curr_amount;
588
-
589
-        // We do not need to update donation stat if donation did not change.
590
-        if( ! $payment_total_diff ) {
591
-            return false;
592
-        }
593
-
594
-
595
-        if( $payment_total_diff > 0 ) {
596
-            $this->increase_value( $payment_total_diff );
597
-        }else{
598
-            // Pass payment total difference as +ve value to decrease amount from user lifetime stat.
599
-            $this->decrease_value( -$payment_total_diff );
600
-        }
601
-
602
-        return $this->purchase_value;
581
+		/**
582
+		 * Payment total difference value can be:
583
+		 *  zero   (in case amount not change)
584
+		 *  or -ve (in case amount decrease)
585
+		 *  or +ve (in case amount increase)
586
+		 */
587
+		$payment_total_diff = $new_amount - $curr_amount;
588
+
589
+		// We do not need to update donation stat if donation did not change.
590
+		if( ! $payment_total_diff ) {
591
+			return false;
592
+		}
593
+
594
+
595
+		if( $payment_total_diff > 0 ) {
596
+			$this->increase_value( $payment_total_diff );
597
+		}else{
598
+			// Pass payment total difference as +ve value to decrease amount from user lifetime stat.
599
+			$this->decrease_value( -$payment_total_diff );
600
+		}
601
+
602
+		return $this->purchase_value;
603 603
 	}
604 604
 
605 605
 	/**
606 606
 	 * Get the parsed notes for a customer as an array.
607 607
 	 *
608 608
 	 * @since  1.0
609
-     * @access public
609
+	 * @access public
610 610
 	 *
611 611
 	 * @param  integer $length The number of notes to get.
612 612
 	 * @param  integer $paged  What note to start at.
@@ -631,7 +631,7 @@  discard block
 block discarded – undo
631 631
 	 * Get the total number of notes we have after parsing.
632 632
 	 *
633 633
 	 * @since  1.0
634
-     * @access public
634
+	 * @access public
635 635
 	 *
636 636
 	 * @return int The number of notes for the customer.
637 637
 	 */
@@ -648,7 +648,7 @@  discard block
 block discarded – undo
648 648
 	 * Add a note for the customer.
649 649
 	 *
650 650
 	 * @since  1.0
651
-     * @access public
651
+	 * @access public
652 652
 	 *
653 653
 	 * @param  string $note   The note to add. Default is empty.
654 654
 	 *
@@ -690,7 +690,7 @@  discard block
 block discarded – undo
690 690
 	 * Get the notes column for the customer
691 691
 	 *
692 692
 	 * @since  1.0
693
-     * @access private
693
+	 * @access private
694 694
 	 *
695 695
 	 * @return string The Notes for the customer, non-parsed.
696 696
 	 */
@@ -768,7 +768,7 @@  discard block
 block discarded – undo
768 768
 	 * Sanitize the data for update/create
769 769
 	 *
770 770
 	 * @since  1.0
771
-     * @access private
771
+	 * @access private
772 772
 	 *
773 773
 	 * @param  array $data The data to sanitize.
774 774
 	 *
Please login to merge, or discard this patch.
Spacing   +141 added lines, -141 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
 
@@ -134,29 +134,29 @@  discard block
 block discarded – undo
134 134
 	 * @param  bool $_id_or_email 
135 135
 	 * @param  bool $by_user_id
136 136
 	 */
137
-	public function __construct( $_id_or_email = false, $by_user_id = false ) {
137
+	public function __construct($_id_or_email = false, $by_user_id = false) {
138 138
 
139 139
 		$this->db = new Give_DB_Customers;
140 140
 
141
-		if ( false === $_id_or_email || ( is_numeric( $_id_or_email ) && (int) $_id_or_email !== absint( $_id_or_email ) ) ) {
141
+		if (false === $_id_or_email || (is_numeric($_id_or_email) && (int) $_id_or_email !== absint($_id_or_email))) {
142 142
 			return false;
143 143
 		}
144 144
 
145
-		$by_user_id = is_bool( $by_user_id ) ? $by_user_id : false;
145
+		$by_user_id = is_bool($by_user_id) ? $by_user_id : false;
146 146
 
147
-		if ( is_numeric( $_id_or_email ) ) {
147
+		if (is_numeric($_id_or_email)) {
148 148
 			$field = $by_user_id ? 'user_id' : 'id';
149 149
 		} else {
150 150
 			$field = 'email';
151 151
 		}
152 152
 
153
-		$customer = $this->db->get_customer_by( $field, $_id_or_email );
153
+		$customer = $this->db->get_customer_by($field, $_id_or_email);
154 154
 
155
-		if ( empty( $customer ) || ! is_object( $customer ) ) {
155
+		if (empty($customer) || ! is_object($customer)) {
156 156
 			return false;
157 157
 		}
158 158
 
159
-		$this->setup_customer( $customer );
159
+		$this->setup_customer($customer);
160 160
 
161 161
 	}
162 162
 
@@ -172,15 +172,15 @@  discard block
 block discarded – undo
172 172
 	 *
173 173
 	 * @return bool             If the setup was successful or not.
174 174
 	 */
175
-	private function setup_customer( $customer ) {
175
+	private function setup_customer($customer) {
176 176
 
177
-		if ( ! is_object( $customer ) ) {
177
+		if ( ! is_object($customer)) {
178 178
 			return false;
179 179
 		}
180 180
 
181
-		foreach ( $customer as $key => $value ) {
181
+		foreach ($customer as $key => $value) {
182 182
 
183
-			switch ( $key ) {
183
+			switch ($key) {
184 184
 
185 185
 				case 'notes':
186 186
 					$this->$key = $this->get_notes();
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 		}
196 196
 
197 197
 		// Customer ID and email are the only things that are necessary, make sure they exist
198
-		if ( ! empty( $this->id ) && ! empty( $this->email ) ) {
198
+		if ( ! empty($this->id) && ! empty($this->email)) {
199 199
 			return true;
200 200
 		}
201 201
 
@@ -209,16 +209,16 @@  discard block
 block discarded – undo
209 209
 	 * @since  1.0
210 210
 	 * @access public
211 211
 	 */
212
-	public function __get( $key ) {
212
+	public function __get($key) {
213 213
 
214
-		if ( method_exists( $this, 'get_' . $key ) ) {
214
+		if (method_exists($this, 'get_'.$key)) {
215 215
 
216
-			return call_user_func( array( $this, 'get_' . $key ) );
216
+			return call_user_func(array($this, 'get_'.$key));
217 217
 
218 218
 		} else {
219 219
 
220 220
 			/* translators: %s: property key */
221
-			return new WP_Error( 'give-customer-invalid-property', sprintf( esc_html__( 'Can\'t get property %s.', 'give' ), $key ) );
221
+			return new WP_Error('give-customer-invalid-property', sprintf(esc_html__('Can\'t get property %s.', 'give'), $key));
222 222
 
223 223
 		}
224 224
 
@@ -234,9 +234,9 @@  discard block
 block discarded – undo
234 234
 	 *
235 235
 	 * @return mixed       False if not a valid creation, Customer ID if user is found or valid creation.
236 236
 	 */
237
-	public function create( $data = array() ) {
237
+	public function create($data = array()) {
238 238
 
239
-		if ( $this->id != 0 || empty( $data ) ) {
239
+		if ($this->id != 0 || empty($data)) {
240 240
 			return false;
241 241
 		}
242 242
 
@@ -244,34 +244,34 @@  discard block
 block discarded – undo
244 244
 			'payment_ids' => ''
245 245
 		);
246 246
 
247
-		$args = wp_parse_args( $data, $defaults );
248
-		$args = $this->sanitize_columns( $args );
247
+		$args = wp_parse_args($data, $defaults);
248
+		$args = $this->sanitize_columns($args);
249 249
 
250
-		if ( empty( $args['email'] ) || ! is_email( $args['email'] ) ) {
250
+		if (empty($args['email']) || ! is_email($args['email'])) {
251 251
 			return false;
252 252
 		}
253 253
 
254
-		if ( ! empty( $args['payment_ids'] ) && is_array( $args['payment_ids'] ) ) {
255
-			$args['payment_ids'] = implode( ',', array_unique( array_values( $args['payment_ids'] ) ) );
254
+		if ( ! empty($args['payment_ids']) && is_array($args['payment_ids'])) {
255
+			$args['payment_ids'] = implode(',', array_unique(array_values($args['payment_ids'])));
256 256
 		}
257 257
 
258
-		do_action( 'give_customer_pre_create', $args );
258
+		do_action('give_customer_pre_create', $args);
259 259
 
260 260
 		$created = false;
261 261
 
262 262
 		// The DB class 'add' implies an update if the customer being asked to be created already exists
263
-		if ( $this->db->add( $data ) ) {
263
+		if ($this->db->add($data)) {
264 264
 
265 265
 			// We've successfully added/updated the customer, reset the class vars with the new data
266
-			$customer = $this->db->get_customer_by( 'email', $args['email'] );
266
+			$customer = $this->db->get_customer_by('email', $args['email']);
267 267
 
268 268
 			// Setup the customer data with the values from DB
269
-			$this->setup_customer( $customer );
269
+			$this->setup_customer($customer);
270 270
 
271 271
 			$created = $this->id;
272 272
 		}
273 273
 
274
-		do_action( 'give_customer_post_create', $created, $args );
274
+		do_action('give_customer_post_create', $created, $args);
275 275
 
276 276
 		return $created;
277 277
 
@@ -287,27 +287,27 @@  discard block
 block discarded – undo
287 287
 	 *
288 288
 	 * @return bool        If the update was successful or not.
289 289
 	 */
290
-	public function update( $data = array() ) {
290
+	public function update($data = array()) {
291 291
 
292
-		if ( empty( $data ) ) {
292
+		if (empty($data)) {
293 293
 			return false;
294 294
 		}
295 295
 
296
-		$data = $this->sanitize_columns( $data );
296
+		$data = $this->sanitize_columns($data);
297 297
 
298
-		do_action( 'give_customer_pre_update', $this->id, $data );
298
+		do_action('give_customer_pre_update', $this->id, $data);
299 299
 
300 300
 		$updated = false;
301 301
 
302
-		if ( $this->db->update( $this->id, $data ) ) {
302
+		if ($this->db->update($this->id, $data)) {
303 303
 
304
-			$customer = $this->db->get_customer_by( 'id', $this->id );
305
-			$this->setup_customer( $customer );
304
+			$customer = $this->db->get_customer_by('id', $this->id);
305
+			$this->setup_customer($customer);
306 306
 
307 307
 			$updated = true;
308 308
 		}
309 309
 
310
-		do_action( 'give_customer_post_update', $updated, $this->id, $data );
310
+		do_action('give_customer_post_update', $updated, $this->id, $data);
311 311
 
312 312
 		return $updated;
313 313
 	}
@@ -325,44 +325,44 @@  discard block
 block discarded – undo
325 325
 	 *
326 326
 	 * @return bool            If the attachment was successfuly.
327 327
 	 */
328
-	public function attach_payment( $payment_id = 0, $update_stats = true ) {
328
+	public function attach_payment($payment_id = 0, $update_stats = true) {
329 329
 
330
-		if ( empty( $payment_id ) ) {
330
+		if (empty($payment_id)) {
331 331
 			return false;
332 332
 		}
333 333
 
334
-		if ( empty( $this->payment_ids ) ) {
334
+		if (empty($this->payment_ids)) {
335 335
 
336 336
 			$new_payment_ids = $payment_id;
337 337
 
338 338
 		} else {
339 339
 
340
-			$payment_ids = array_map( 'absint', explode( ',', $this->payment_ids ) );
340
+			$payment_ids = array_map('absint', explode(',', $this->payment_ids));
341 341
 
342
-			if ( in_array( $payment_id, $payment_ids ) ) {
342
+			if (in_array($payment_id, $payment_ids)) {
343 343
 				$update_stats = false;
344 344
 			}
345 345
 
346 346
 			$payment_ids[] = $payment_id;
347 347
 
348
-			$new_payment_ids = implode( ',', array_unique( array_values( $payment_ids ) ) );
348
+			$new_payment_ids = implode(',', array_unique(array_values($payment_ids)));
349 349
 
350 350
 		}
351 351
 
352
-		do_action( 'give_customer_pre_attach_payment', $payment_id, $this->id );
352
+		do_action('give_customer_pre_attach_payment', $payment_id, $this->id);
353 353
 
354
-		$payment_added = $this->update( array( 'payment_ids' => $new_payment_ids ) );
354
+		$payment_added = $this->update(array('payment_ids' => $new_payment_ids));
355 355
 
356
-		if ( $payment_added ) {
356
+		if ($payment_added) {
357 357
 
358 358
 			$this->payment_ids = $new_payment_ids;
359 359
 
360 360
 			// We added this payment successfully, increment the stats
361
-			if ( $update_stats ) {
362
-				$payment_amount = give_get_payment_amount( $payment_id );
361
+			if ($update_stats) {
362
+				$payment_amount = give_get_payment_amount($payment_id);
363 363
 
364
-				if ( ! empty( $payment_amount ) ) {
365
-					$this->increase_value( $payment_amount );
364
+				if ( ! empty($payment_amount)) {
365
+					$this->increase_value($payment_amount);
366 366
 				}
367 367
 
368 368
 				$this->increase_purchase_count();
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
 
371 371
 		}
372 372
 
373
-		do_action( 'give_customer_post_attach_payment', $payment_added, $payment_id, $this->id );
373
+		do_action('give_customer_post_attach_payment', $payment_added, $payment_id, $this->id);
374 374
 
375 375
 		return $payment_added;
376 376
 	}
@@ -388,50 +388,50 @@  discard block
 block discarded – undo
388 388
 	 *
389 389
 	 * @return boolean               If the removal was successful.
390 390
 	 */
391
-	public function remove_payment( $payment_id = 0, $update_stats = true ) {
391
+	public function remove_payment($payment_id = 0, $update_stats = true) {
392 392
 
393
-		if ( empty( $payment_id ) ) {
393
+		if (empty($payment_id)) {
394 394
 			return false;
395 395
 		}
396 396
 
397
-		$payment = new Give_Payment( $payment_id );
397
+		$payment = new Give_Payment($payment_id);
398 398
 
399
-		if ( 'publish' !== $payment->status && 'revoked' !== $payment->status ) {
399
+		if ('publish' !== $payment->status && 'revoked' !== $payment->status) {
400 400
 			$update_stats = false;
401 401
 		}
402 402
 
403 403
 		$new_payment_ids = '';
404 404
 
405
-		if ( ! empty( $this->payment_ids ) ) {
405
+		if ( ! empty($this->payment_ids)) {
406 406
 
407
-			$payment_ids = array_map( 'absint', explode( ',', $this->payment_ids ) );
407
+			$payment_ids = array_map('absint', explode(',', $this->payment_ids));
408 408
 
409
-			$pos = array_search( $payment_id, $payment_ids );
410
-			if ( false === $pos ) {
409
+			$pos = array_search($payment_id, $payment_ids);
410
+			if (false === $pos) {
411 411
 				return false;
412 412
 			}
413 413
 
414
-			unset( $payment_ids[ $pos ] );
415
-			$payment_ids = array_filter( $payment_ids );
414
+			unset($payment_ids[$pos]);
415
+			$payment_ids = array_filter($payment_ids);
416 416
 
417
-			$new_payment_ids = implode( ',', array_unique( array_values( $payment_ids ) ) );
417
+			$new_payment_ids = implode(',', array_unique(array_values($payment_ids)));
418 418
 
419 419
 		}
420 420
 
421
-		do_action( 'give_customer_pre_remove_payment', $payment_id, $this->id );
421
+		do_action('give_customer_pre_remove_payment', $payment_id, $this->id);
422 422
 
423
-		$payment_removed = $this->update( array( 'payment_ids' => $new_payment_ids ) );
423
+		$payment_removed = $this->update(array('payment_ids' => $new_payment_ids));
424 424
 
425
-		if ( $payment_removed ) {
425
+		if ($payment_removed) {
426 426
 
427 427
 			$this->payment_ids = $new_payment_ids;
428 428
 
429
-			if ( $update_stats ) {
429
+			if ($update_stats) {
430 430
 				// We removed this payment successfully, decrement the stats
431
-				$payment_amount = give_get_payment_amount( $payment_id );
431
+				$payment_amount = give_get_payment_amount($payment_id);
432 432
 
433
-				if ( ! empty( $payment_amount ) ) {
434
-					$this->decrease_value( $payment_amount );
433
+				if ( ! empty($payment_amount)) {
434
+					$this->decrease_value($payment_amount);
435 435
 				}
436 436
 
437 437
 				$this->decrease_purchase_count();
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
 
440 440
 		}
441 441
 
442
-		do_action( 'give_customer_post_remove_payment', $payment_removed, $payment_id, $this->id );
442
+		do_action('give_customer_post_remove_payment', $payment_removed, $payment_id, $this->id);
443 443
 
444 444
 		return $payment_removed;
445 445
 
@@ -455,22 +455,22 @@  discard block
 block discarded – undo
455 455
 	 *
456 456
 	 * @return int            The purchase count.
457 457
 	 */
458
-	public function increase_purchase_count( $count = 1 ) {
458
+	public function increase_purchase_count($count = 1) {
459 459
 
460 460
 		// Make sure it's numeric and not negative.
461
-		if ( ! is_numeric( $count ) || $count != absint( $count ) ) {
461
+		if ( ! is_numeric($count) || $count != absint($count)) {
462 462
 			return false;
463 463
 		}
464 464
 
465 465
 		$new_total = (int) $this->purchase_count + (int) $count;
466 466
 
467
-		do_action( 'give_customer_pre_increase_purchase_count', $count, $this->id );
467
+		do_action('give_customer_pre_increase_purchase_count', $count, $this->id);
468 468
 
469
-		if ( $this->update( array( 'purchase_count' => $new_total ) ) ) {
469
+		if ($this->update(array('purchase_count' => $new_total))) {
470 470
 			$this->purchase_count = $new_total;
471 471
 		}
472 472
 
473
-		do_action( 'give_customer_post_increase_purchase_count', $this->purchase_count, $count, $this->id );
473
+		do_action('give_customer_post_increase_purchase_count', $this->purchase_count, $count, $this->id);
474 474
 
475 475
 		return $this->purchase_count;
476 476
 	}
@@ -485,26 +485,26 @@  discard block
 block discarded – undo
485 485
 	 *
486 486
 	 * @return mixed          If successful, the new count, otherwise false.
487 487
 	 */
488
-	public function decrease_purchase_count( $count = 1 ) {
488
+	public function decrease_purchase_count($count = 1) {
489 489
 
490 490
 		// Make sure it's numeric and not negative
491
-		if ( ! is_numeric( $count ) || $count != absint( $count ) ) {
491
+		if ( ! is_numeric($count) || $count != absint($count)) {
492 492
 			return false;
493 493
 		}
494 494
 
495 495
 		$new_total = (int) $this->purchase_count - (int) $count;
496 496
 
497
-		if ( $new_total < 0 ) {
497
+		if ($new_total < 0) {
498 498
 			$new_total = 0;
499 499
 		}
500 500
 
501
-		do_action( 'give_customer_pre_decrease_purchase_count', $count, $this->id );
501
+		do_action('give_customer_pre_decrease_purchase_count', $count, $this->id);
502 502
 
503
-		if ( $this->update( array( 'purchase_count' => $new_total ) ) ) {
503
+		if ($this->update(array('purchase_count' => $new_total))) {
504 504
 			$this->purchase_count = $new_total;
505 505
 		}
506 506
 
507
-		do_action( 'give_customer_post_decrease_purchase_count', $this->purchase_count, $count, $this->id );
507
+		do_action('give_customer_post_decrease_purchase_count', $this->purchase_count, $count, $this->id);
508 508
 
509 509
 		return $this->purchase_count;
510 510
 	}
@@ -519,17 +519,17 @@  discard block
 block discarded – undo
519 519
 	 *
520 520
 	 * @return mixed        If successful, the new value, otherwise false.
521 521
 	 */
522
-	public function increase_value( $value = 0.00 ) {
522
+	public function increase_value($value = 0.00) {
523 523
 
524
-		$new_value = floatval( $this->purchase_value ) + $value;
524
+		$new_value = floatval($this->purchase_value) + $value;
525 525
 
526
-		do_action( 'give_customer_pre_increase_value', $value, $this->id );
526
+		do_action('give_customer_pre_increase_value', $value, $this->id);
527 527
 
528
-		if ( $this->update( array( 'purchase_value' => $new_value ) ) ) {
528
+		if ($this->update(array('purchase_value' => $new_value))) {
529 529
 			$this->purchase_value = $new_value;
530 530
 		}
531 531
 
532
-		do_action( 'give_customer_post_increase_value', $this->purchase_value, $value, $this->id );
532
+		do_action('give_customer_post_increase_value', $this->purchase_value, $value, $this->id);
533 533
 
534 534
 		return $this->purchase_value;
535 535
 	}
@@ -544,21 +544,21 @@  discard block
 block discarded – undo
544 544
 	 *
545 545
 	 * @return mixed        If successful, the new value, otherwise false.
546 546
 	 */
547
-	public function decrease_value( $value = 0.00 ) {
547
+	public function decrease_value($value = 0.00) {
548 548
 
549
-		$new_value = floatval( $this->purchase_value ) - $value;
549
+		$new_value = floatval($this->purchase_value) - $value;
550 550
 
551
-		if ( $new_value < 0 ) {
551
+		if ($new_value < 0) {
552 552
 			$new_value = 0.00;
553 553
 		}
554 554
 
555
-		do_action( 'give_customer_pre_decrease_value', $value, $this->id );
555
+		do_action('give_customer_pre_decrease_value', $value, $this->id);
556 556
 
557
-		if ( $this->update( array( 'purchase_value' => $new_value ) ) ) {
557
+		if ($this->update(array('purchase_value' => $new_value))) {
558 558
 			$this->purchase_value = $new_value;
559 559
 		}
560 560
 
561
-		do_action( 'give_customer_post_decrease_value', $this->purchase_value, $value, $this->id );
561
+		do_action('give_customer_post_decrease_value', $this->purchase_value, $value, $this->id);
562 562
 
563 563
 		return $this->purchase_value;
564 564
 	}
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
 	 *
578 578
 	 * @return mixed              If successful, the new donation stat value, otherwise false.
579 579
 	 */
580
-	public function update_donation_value( $curr_amount, $new_amount ) {
580
+	public function update_donation_value($curr_amount, $new_amount) {
581 581
         /**
582 582
          * Payment total difference value can be:
583 583
          *  zero   (in case amount not change)
@@ -587,14 +587,14 @@  discard block
 block discarded – undo
587 587
         $payment_total_diff = $new_amount - $curr_amount;
588 588
 
589 589
         // We do not need to update donation stat if donation did not change.
590
-        if( ! $payment_total_diff ) {
590
+        if ( ! $payment_total_diff) {
591 591
             return false;
592 592
         }
593 593
 
594 594
 
595
-        if( $payment_total_diff > 0 ) {
596
-            $this->increase_value( $payment_total_diff );
597
-        }else{
595
+        if ($payment_total_diff > 0) {
596
+            $this->increase_value($payment_total_diff);
597
+        } else {
598 598
             // Pass payment total difference as +ve value to decrease amount from user lifetime stat.
599 599
             $this->decrease_value( -$payment_total_diff );
600 600
         }
@@ -613,15 +613,15 @@  discard block
 block discarded – undo
613 613
 	 *
614 614
 	 * @return array           The notes requested.
615 615
 	 */
616
-	public function get_notes( $length = 20, $paged = 1 ) {
616
+	public function get_notes($length = 20, $paged = 1) {
617 617
 
618
-		$length = is_numeric( $length ) ? $length : 20;
619
-		$offset = is_numeric( $paged ) && $paged != 1 ? ( ( absint( $paged ) - 1 ) * $length ) : 0;
618
+		$length = is_numeric($length) ? $length : 20;
619
+		$offset = is_numeric($paged) && $paged != 1 ? ((absint($paged) - 1) * $length) : 0;
620 620
 
621 621
 		$all_notes   = $this->get_raw_notes();
622
-		$notes_array = array_reverse( array_filter( explode( "\n\n", $all_notes ) ) );
622
+		$notes_array = array_reverse(array_filter(explode("\n\n", $all_notes)));
623 623
 
624
-		$desired_notes = array_slice( $notes_array, $offset, $length );
624
+		$desired_notes = array_slice($notes_array, $offset, $length);
625 625
 
626 626
 		return $desired_notes;
627 627
 
@@ -638,9 +638,9 @@  discard block
 block discarded – undo
638 638
 	public function get_notes_count() {
639 639
 
640 640
 		$all_notes   = $this->get_raw_notes();
641
-		$notes_array = array_reverse( array_filter( explode( "\n\n", $all_notes ) ) );
641
+		$notes_array = array_reverse(array_filter(explode("\n\n", $all_notes)));
642 642
 
643
-		return count( $notes_array );
643
+		return count($notes_array);
644 644
 
645 645
 	}
646 646
 
@@ -654,32 +654,32 @@  discard block
 block discarded – undo
654 654
 	 *
655 655
 	 * @return string|boolean The new note if added successfully, false otherwise.
656 656
 	 */
657
-	public function add_note( $note = '' ) {
657
+	public function add_note($note = '') {
658 658
 
659
-		$note = trim( $note );
660
-		if ( empty( $note ) ) {
659
+		$note = trim($note);
660
+		if (empty($note)) {
661 661
 			return false;
662 662
 		}
663 663
 
664 664
 		$notes = $this->get_raw_notes();
665 665
 
666
-		if ( empty( $notes ) ) {
666
+		if (empty($notes)) {
667 667
 			$notes = '';
668 668
 		}
669 669
 
670
-		$note_string = date_i18n( 'F j, Y H:i:s', current_time( 'timestamp' ) ) . ' - ' . $note;
671
-		$new_note    = apply_filters( 'give_customer_add_note_string', $note_string );
672
-		$notes .= "\n\n" . $new_note;
670
+		$note_string = date_i18n('F j, Y H:i:s', current_time('timestamp')).' - '.$note;
671
+		$new_note    = apply_filters('give_customer_add_note_string', $note_string);
672
+		$notes .= "\n\n".$new_note;
673 673
 
674
-		do_action( 'give_customer_pre_add_note', $new_note, $this->id );
674
+		do_action('give_customer_pre_add_note', $new_note, $this->id);
675 675
 
676
-		$updated = $this->update( array( 'notes' => $notes ) );
676
+		$updated = $this->update(array('notes' => $notes));
677 677
 
678
-		if ( $updated ) {
678
+		if ($updated) {
679 679
 			$this->notes = $this->get_notes();
680 680
 		}
681 681
 
682
-		do_action( 'give_customer_post_add_note', $this->notes, $new_note, $this->id );
682
+		do_action('give_customer_post_add_note', $this->notes, $new_note, $this->id);
683 683
 
684 684
 		// Return the formatted note, so we can test, as well as update any displays
685 685
 		return $new_note;
@@ -696,7 +696,7 @@  discard block
 block discarded – undo
696 696
 	 */
697 697
 	private function get_raw_notes() {
698 698
 
699
-		$all_notes = $this->db->get_column( 'notes', $this->id );
699
+		$all_notes = $this->db->get_column('notes', $this->id);
700 700
 
701 701
 		return $all_notes;
702 702
 
@@ -713,8 +713,8 @@  discard block
 block discarded – undo
713 713
 	 *
714 714
 	 * @return mixed            Will be an array if $single is false. Will be value of meta data field if $single is true.
715 715
 	 */
716
-	public function get_meta( $meta_key = '', $single = true ) {
717
-		return Give()->customer_meta->get_meta( $this->id, $meta_key, $single );
716
+	public function get_meta($meta_key = '', $single = true) {
717
+		return Give()->customer_meta->get_meta($this->id, $meta_key, $single);
718 718
 	}
719 719
 
720 720
 	/**
@@ -729,8 +729,8 @@  discard block
 block discarded – undo
729 729
 	 *
730 730
 	 * @return bool               False for failure. True for success.
731 731
 	 */
732
-	public function add_meta( $meta_key = '', $meta_value, $unique = false ) {
733
-		return Give()->customer_meta->add_meta( $this->id, $meta_key, $meta_value, $unique );
732
+	public function add_meta($meta_key = '', $meta_value, $unique = false) {
733
+		return Give()->customer_meta->add_meta($this->id, $meta_key, $meta_value, $unique);
734 734
 	}
735 735
 
736 736
 	/**
@@ -745,8 +745,8 @@  discard block
 block discarded – undo
745 745
 	 *
746 746
 	 * @return bool               False on failure, true if success.
747 747
 	 */
748
-	public function update_meta( $meta_key = '', $meta_value, $prev_value = '' ) {
749
-		return Give()->customer_meta->update_meta( $this->id, $meta_key, $meta_value, $prev_value );
748
+	public function update_meta($meta_key = '', $meta_value, $prev_value = '') {
749
+		return Give()->customer_meta->update_meta($this->id, $meta_key, $meta_value, $prev_value);
750 750
 	}
751 751
 
752 752
 	/**
@@ -760,8 +760,8 @@  discard block
 block discarded – undo
760 760
 	 *
761 761
 	 * @return bool               False for failure. True for success.
762 762
 	 */
763
-	public function delete_meta( $meta_key = '', $meta_value = '' ) {
764
-		return Give()->customer_meta->delete_meta( $this->id, $meta_key, $meta_value );
763
+	public function delete_meta($meta_key = '', $meta_value = '') {
764
+		return Give()->customer_meta->delete_meta($this->id, $meta_key, $meta_value);
765 765
 	}
766 766
 
767 767
 	/**
@@ -774,51 +774,51 @@  discard block
 block discarded – undo
774 774
 	 *
775 775
 	 * @return array       The sanitized data, based off column defaults.
776 776
 	 */
777
-	private function sanitize_columns( $data ) {
777
+	private function sanitize_columns($data) {
778 778
 
779 779
 		$columns        = $this->db->get_columns();
780 780
 		$default_values = $this->db->get_column_defaults();
781 781
 
782
-		foreach ( $columns as $key => $type ) {
782
+		foreach ($columns as $key => $type) {
783 783
 
784 784
 			// Only sanitize data that we were provided
785
-			if ( ! array_key_exists( $key, $data ) ) {
785
+			if ( ! array_key_exists($key, $data)) {
786 786
 				continue;
787 787
 			}
788 788
 
789
-			switch ( $type ) {
789
+			switch ($type) {
790 790
 
791 791
 				case '%s':
792
-					if ( 'email' == $key ) {
793
-						$data[ $key ] = sanitize_email( $data[ $key ] );
794
-					} elseif ( 'notes' == $key ) {
795
-						$data[ $key ] = strip_tags( $data[ $key ] );
792
+					if ('email' == $key) {
793
+						$data[$key] = sanitize_email($data[$key]);
794
+					} elseif ('notes' == $key) {
795
+						$data[$key] = strip_tags($data[$key]);
796 796
 					} else {
797
-						$data[ $key ] = sanitize_text_field( $data[ $key ] );
797
+						$data[$key] = sanitize_text_field($data[$key]);
798 798
 					}
799 799
 					break;
800 800
 
801 801
 				case '%d':
802
-					if ( ! is_numeric( $data[ $key ] ) || (int) $data[ $key ] !== absint( $data[ $key ] ) ) {
803
-						$data[ $key ] = $default_values[ $key ];
802
+					if ( ! is_numeric($data[$key]) || (int) $data[$key] !== absint($data[$key])) {
803
+						$data[$key] = $default_values[$key];
804 804
 					} else {
805
-						$data[ $key ] = absint( $data[ $key ] );
805
+						$data[$key] = absint($data[$key]);
806 806
 					}
807 807
 					break;
808 808
 
809 809
 				case '%f':
810 810
 					// Convert what was given to a float
811
-					$value = floatval( $data[ $key ] );
811
+					$value = floatval($data[$key]);
812 812
 
813
-					if ( ! is_float( $value ) ) {
814
-						$data[ $key ] = $default_values[ $key ];
813
+					if ( ! is_float($value)) {
814
+						$data[$key] = $default_values[$key];
815 815
 					} else {
816
-						$data[ $key ] = $value;
816
+						$data[$key] = $value;
817 817
 					}
818 818
 					break;
819 819
 
820 820
 				default:
821
-					$data[ $key ] = sanitize_text_field( $data[ $key ] );
821
+					$data[$key] = sanitize_text_field($data[$key]);
822 822
 					break;
823 823
 
824 824
 			}
Please login to merge, or discard this patch.