Completed
Push — master ( 4753ca...040342 )
by Matt
12:05
created
includes/admin/reporting/graphing.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -576,7 +576,7 @@
 block discarded – undo
576 576
  * selected date-range (if any)
577 577
  *
578 578
  * @since 1.0
579
- * @return array
579
+ * @return integer|null
580 580
  */
581 581
 function give_get_report_dates() {
582 582
 	$dates = array();
Please login to merge, or discard this patch.
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Graphing Functions
4
- *
5
- * @package     Give
6
- * @subpackage  Admin/Reports
7
- * @copyright   Copyright (c) 2015, WordImpress
8
- * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
9
- * @since       1.0
10
- */
3
+	 * Graphing Functions
4
+	 *
5
+	 * @package     Give
6
+	 * @subpackage  Admin/Reports
7
+	 * @copyright   Copyright (c) 2015, WordImpress
8
+	 * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
9
+	 * @since       1.0
10
+	 */
11 11
 
12 12
 // Exit if accessed directly
13 13
 if ( ! defined( 'ABSPATH' ) ) {
Please login to merge, or discard this patch.
Spacing   +243 added lines, -243 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,7 +25,7 @@  discard block
 block discarded – undo
25 25
 	$dates = give_get_report_dates();
26 26
 
27 27
 	// Determine graph options
28
-	switch ( $dates['range'] ) :
28
+	switch ($dates['range']) :
29 29
 		case 'today' :
30 30
 		case 'yesterday' :
31 31
 			$day_by_day = true;
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 			$day_by_day = false;
38 38
 			break;
39 39
 		case 'other' :
40
-			if ( $dates['m_end'] - $dates['m_start'] >= 2 || $dates['year_end'] > $dates['year'] && ( $dates['m_start'] != '12' && $dates['m_end'] != '1' ) ) {
40
+			if ($dates['m_end'] - $dates['m_start'] >= 2 || $dates['year_end'] > $dates['year'] && ($dates['m_start'] != '12' && $dates['m_end'] != '1')) {
41 41
 				$day_by_day = false;
42 42
 			} else {
43 43
 				$day_by_day = true;
@@ -49,61 +49,61 @@  discard block
 block discarded – undo
49 49
 	endswitch;
50 50
 
51 51
 	$earnings_totals = 0.00; // Total earnings for time period shown
52
-	$sales_totals    = 0;            // Total sales for time period shown
52
+	$sales_totals    = 0; // Total sales for time period shown
53 53
 
54 54
 	$earnings_data = array();
55 55
 	$sales_data    = array();
56 56
 
57
-	if ( $dates['range'] == 'today' || $dates['range'] == 'yesterday' ) {
57
+	if ($dates['range'] == 'today' || $dates['range'] == 'yesterday') {
58 58
 		// Hour by hour
59 59
 		$hour  = 1;
60
-		$month = date( 'n', current_time( 'timestamp' ) );
61
-		while ( $hour <= 23 ) :
60
+		$month = date('n', current_time('timestamp'));
61
+		while ($hour <= 23) :
62 62
 
63
-			$sales    = give_get_sales_by_date( $dates['day'], $month, $dates['year'], $hour );
64
-			$earnings = give_get_earnings_by_date( $dates['day'], $month, $dates['year'], $hour );
63
+			$sales    = give_get_sales_by_date($dates['day'], $month, $dates['year'], $hour);
64
+			$earnings = give_get_earnings_by_date($dates['day'], $month, $dates['year'], $hour);
65 65
 
66 66
 			$sales_totals += $sales;
67 67
 			$earnings_totals += $earnings;
68 68
 
69
-			$date            = mktime( $hour, 0, 0, $month, $dates['day'], $dates['year'] ) * 1000;
70
-			$sales_data[]    = array( $date, $sales );
71
-			$earnings_data[] = array( $date, $earnings );
69
+			$date            = mktime($hour, 0, 0, $month, $dates['day'], $dates['year']) * 1000;
70
+			$sales_data[]    = array($date, $sales);
71
+			$earnings_data[] = array($date, $earnings);
72 72
 
73
-			$hour ++;
73
+			$hour++;
74 74
 		endwhile;
75 75
 
76
-	} elseif ( $dates['range'] == 'this_week' || $dates['range'] == 'last_week' ) {
76
+	} elseif ($dates['range'] == 'this_week' || $dates['range'] == 'last_week') {
77 77
 
78 78
 		// Day by day
79 79
 		$day     = $dates['day'];
80 80
 		$day_end = $dates['day_end'];
81 81
 		$month   = $dates['m_start'];
82
-		while ( $day <= $day_end ) :
83
-			$sales = give_get_sales_by_date( $day, $month, $dates['year'] );
82
+		while ($day <= $day_end) :
83
+			$sales = give_get_sales_by_date($day, $month, $dates['year']);
84 84
 			$sales_totals += $sales;
85 85
 
86
-			$earnings = give_get_earnings_by_date( $day, $month, $dates['year'] );
86
+			$earnings = give_get_earnings_by_date($day, $month, $dates['year']);
87 87
 			$earnings_totals += $earnings;
88 88
 
89
-			$date            = mktime( 0, 0, 0, $month, $day, $dates['year'] ) * 1000;
90
-			$sales_data[]    = array( $date, $sales );
91
-			$earnings_data[] = array( $date, $earnings );
92
-			$day ++;
89
+			$date            = mktime(0, 0, 0, $month, $day, $dates['year']) * 1000;
90
+			$sales_data[]    = array($date, $sales);
91
+			$earnings_data[] = array($date, $earnings);
92
+			$day++;
93 93
 		endwhile;
94 94
 
95 95
 	} else {
96 96
 
97 97
 		$y = $dates['year'];
98
-		while ( $y <= $dates['year_end'] ) :
98
+		while ($y <= $dates['year_end']) :
99 99
 
100
-			if ( $dates['year'] == $dates['year_end'] ) {
100
+			if ($dates['year'] == $dates['year_end']) {
101 101
 				$month_start = $dates['m_start'];
102 102
 				$month_end   = $dates['m_end'];
103
-			} elseif ( $y == $dates['year'] ) {
103
+			} elseif ($y == $dates['year']) {
104 104
 				$month_start = $dates['m_start'];
105 105
 				$month_end   = 12;
106
-			} elseif ( $y == $dates['year_end'] ) {
106
+			} elseif ($y == $dates['year_end']) {
107 107
 				$month_start = 1;
108 108
 				$month_end   = $dates['m_end'];
109 109
 			} else {
@@ -112,48 +112,48 @@  discard block
 block discarded – undo
112 112
 			}
113 113
 
114 114
 			$i = $month_start;
115
-			while ( $i <= $month_end ) :
115
+			while ($i <= $month_end) :
116 116
 
117
-				if ( $day_by_day ) :
117
+				if ($day_by_day) :
118 118
 
119
-					if ( $i == $month_end ) {
119
+					if ($i == $month_end) {
120 120
 
121 121
 						$num_of_days = $dates['day_end'];
122 122
 
123 123
 					} else {
124 124
 
125
-						$num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y );
125
+						$num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y);
126 126
 
127 127
 					}
128 128
 
129 129
 					$d = $dates['day'];
130 130
 
131
-					while ( $d <= $num_of_days ) :
131
+					while ($d <= $num_of_days) :
132 132
 
133
-						$sales = give_get_sales_by_date( $d, $i, $y );
133
+						$sales = give_get_sales_by_date($d, $i, $y);
134 134
 						$sales_totals += $sales;
135 135
 
136
-						$earnings = give_get_earnings_by_date( $d, $i, $y );
136
+						$earnings = give_get_earnings_by_date($d, $i, $y);
137 137
 						$earnings_totals += $earnings;
138 138
 
139
-						$date            = mktime( 0, 0, 0, $i, $d, $y ) * 1000;
140
-						$sales_data[]    = array( $date, $sales );
141
-						$earnings_data[] = array( $date, $earnings );
142
-						$d ++;
139
+						$date            = mktime(0, 0, 0, $i, $d, $y) * 1000;
140
+						$sales_data[]    = array($date, $sales);
141
+						$earnings_data[] = array($date, $earnings);
142
+						$d++;
143 143
 
144 144
 					endwhile;
145 145
 
146 146
 				else :
147 147
 
148
-					$sales = give_get_sales_by_date( null, $i, $y );
148
+					$sales = give_get_sales_by_date(null, $i, $y);
149 149
 					$sales_totals += $sales;
150 150
 
151
-					$earnings = give_get_earnings_by_date( null, $i, $y );
151
+					$earnings = give_get_earnings_by_date(null, $i, $y);
152 152
 					$earnings_totals += $earnings;
153 153
 
154
-					if ( $i == $month_end ) {
154
+					if ($i == $month_end) {
155 155
 
156
-						$num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y );
156
+						$num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y);
157 157
 
158 158
 					} else {
159 159
 
@@ -161,24 +161,24 @@  discard block
 block discarded – undo
161 161
 
162 162
 					}
163 163
 
164
-					$date            = mktime( 0, 0, 0, $i, $num_of_days, $y ) * 1000;
165
-					$sales_data[]    = array( $date, $sales );
166
-					$earnings_data[] = array( $date, $earnings );
164
+					$date            = mktime(0, 0, 0, $i, $num_of_days, $y) * 1000;
165
+					$sales_data[]    = array($date, $sales);
166
+					$earnings_data[] = array($date, $earnings);
167 167
 
168 168
 				endif;
169 169
 
170
-				$i ++;
170
+				$i++;
171 171
 
172 172
 			endwhile;
173 173
 
174
-			$y ++;
174
+			$y++;
175 175
 		endwhile;
176 176
 
177 177
 	}
178 178
 
179 179
 	$data = array(
180
-		__( 'Income', 'give' )    => $earnings_data,
181
-		__( 'Donations', 'give' ) => $sales_data
180
+		__('Income', 'give')    => $earnings_data,
181
+		__('Donations', 'give') => $sales_data
182 182
 	);
183 183
 
184 184
 	// start our own output buffer
@@ -190,12 +190,12 @@  discard block
 block discarded – undo
190 190
 			<div class="postbox">
191 191
 				<div class="inside">
192 192
 					<?php
193
-					$graph = new Give_Graph( $data );
194
-					$graph->set( 'x_mode', 'time' );
195
-					$graph->set( 'multiple_y_axes', true );
193
+					$graph = new Give_Graph($data);
194
+					$graph->set('x_mode', 'time');
195
+					$graph->set('multiple_y_axes', true);
196 196
 					$graph->display();
197 197
 
198
-					if ( 'this_month' == $dates['range'] ) {
198
+					if ('this_month' == $dates['range']) {
199 199
 						$estimated = give_estimated_monthly_stats();
200 200
 					}
201 201
 					?>
@@ -206,32 +206,32 @@  discard block
 block discarded – undo
206 206
 				<tbody>
207 207
 				<tr>
208 208
 					<td class="row-title">
209
-						<label for="tablecell"><?php _e( 'Total income for period: ', 'give' ); ?></label></td>
210
-					<td><?php echo give_currency_filter( give_format_amount( $earnings_totals ) ); ?></td>
209
+						<label for="tablecell"><?php _e('Total income for period: ', 'give'); ?></label></td>
210
+					<td><?php echo give_currency_filter(give_format_amount($earnings_totals)); ?></td>
211 211
 				</tr>
212 212
 				<tr class="alternate">
213 213
 					<td class="row-title">
214
-						<label for="tablecell"><?php _e( 'Total donations for period shown: ', 'give' ); ?></label>
214
+						<label for="tablecell"><?php _e('Total donations for period shown: ', 'give'); ?></label>
215 215
 					</td>
216
-					<td><?php echo give_format_amount( $sales_totals, false ); ?></td>
216
+					<td><?php echo give_format_amount($sales_totals, false); ?></td>
217 217
 				</tr>
218
-				<?php if ( 'this_month' == $dates['range'] ) : ?>
218
+				<?php if ('this_month' == $dates['range']) : ?>
219 219
 					<tr>
220 220
 						<td class="row-title">
221
-							<label for="tablecell"><?php _e( 'Estimated monthly income: ', 'give' ); ?></label>
221
+							<label for="tablecell"><?php _e('Estimated monthly income: ', 'give'); ?></label>
222 222
 						</td>
223
-						<td><?php echo give_currency_filter( give_format_amount( $estimated['earnings'] ) ); ?></td>
223
+						<td><?php echo give_currency_filter(give_format_amount($estimated['earnings'])); ?></td>
224 224
 					</tr>
225 225
 					<tr class="alternate">
226 226
 						<td class="row-title">
227
-							<label for="tablecell"><?php _e( 'Estimated monthly donations: ', 'give' ); ?></label>
227
+							<label for="tablecell"><?php _e('Estimated monthly donations: ', 'give'); ?></label>
228 228
 						</td>
229
-						<td><?php echo give_format_amount( $estimated['sales'], false ); ?></td>
229
+						<td><?php echo give_format_amount($estimated['sales'], false); ?></td>
230 230
 					</tr>
231 231
 				<?php endif; ?>
232 232
 			</table>
233 233
 
234
-			<?php do_action( 'give_reports_graph_additional_stats' ); ?>
234
+			<?php do_action('give_reports_graph_additional_stats'); ?>
235 235
 
236 236
 		</div>
237 237
 	</div>
@@ -249,12 +249,12 @@  discard block
 block discarded – undo
249 249
  * @since 1.0
250 250
  * @return void
251 251
  */
252
-function give_reports_graph_of_form( $form_id = 0 ) {
252
+function give_reports_graph_of_form($form_id = 0) {
253 253
 	// Retrieve the queried dates
254 254
 	$dates = give_get_report_dates();
255 255
 
256 256
 	// Determine graph options
257
-	switch ( $dates['range'] ) :
257
+	switch ($dates['range']) :
258 258
 		case 'today' :
259 259
 		case 'yesterday' :
260 260
 			$day_by_day = true;
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 			$day_by_day = false;
273 273
 			break;
274 274
 		case 'other' :
275
-			if ( $dates['m_end'] - $dates['m_start'] >= 2 || $dates['year_end'] > $dates['year'] ) {
275
+			if ($dates['m_end'] - $dates['m_start'] >= 2 || $dates['year_end'] > $dates['year']) {
276 276
 				$day_by_day = false;
277 277
 			} else {
278 278
 				$day_by_day = true;
@@ -284,75 +284,75 @@  discard block
 block discarded – undo
284 284
 	endswitch;
285 285
 
286 286
 	$earnings_totals = (float) 0.00; // Total earnings for time period shown
287
-	$sales_totals    = 0;            // Total sales for time period shown
287
+	$sales_totals    = 0; // Total sales for time period shown
288 288
 
289 289
 	$earnings_data = array();
290 290
 	$sales_data    = array();
291 291
 	$stats         = new Give_Payment_Stats;
292 292
 
293
-	if ( $dates['range'] == 'today' || $dates['range'] == 'yesterday' ) {
293
+	if ($dates['range'] == 'today' || $dates['range'] == 'yesterday') {
294 294
 
295 295
 		// Hour by hour
296 296
 		$month  = $dates['m_start'];
297 297
 		$hour   = 1;
298 298
 		$minute = 0;
299 299
 		$second = 0;
300
-		while ( $hour <= 23 ) :
300
+		while ($hour <= 23) :
301 301
 
302
-			if ( $hour == 23 ) {
302
+			if ($hour == 23) {
303 303
 				$minute = $second = 59;
304 304
 			}
305 305
 
306
-			$date     = mktime( $hour, $minute, $second, $month, $dates['day'], $dates['year'] );
307
-			$date_end = mktime( $hour + 1, $minute, $second, $month, $dates['day'], $dates['year'] );
306
+			$date     = mktime($hour, $minute, $second, $month, $dates['day'], $dates['year']);
307
+			$date_end = mktime($hour + 1, $minute, $second, $month, $dates['day'], $dates['year']);
308 308
 
309
-			$sales = $stats->get_sales( $form_id, $date, $date_end );
309
+			$sales = $stats->get_sales($form_id, $date, $date_end);
310 310
 			$sales_totals += $sales;
311 311
 
312
-			$earnings = $stats->get_earnings( $form_id, $date, $date_end );
312
+			$earnings = $stats->get_earnings($form_id, $date, $date_end);
313 313
 			$earnings_totals += $earnings;
314 314
 
315
-			$sales_data[]    = array( $date * 1000, $sales );
316
-			$earnings_data[] = array( $date * 1000, $earnings );
315
+			$sales_data[]    = array($date * 1000, $sales);
316
+			$earnings_data[] = array($date * 1000, $earnings);
317 317
 
318
-			$hour ++;
318
+			$hour++;
319 319
 		endwhile;
320 320
 
321
-	} elseif ( $dates['range'] == 'this_week' || $dates['range'] == 'last_week' ) {
321
+	} elseif ($dates['range'] == 'this_week' || $dates['range'] == 'last_week') {
322 322
 
323 323
 		//Day by day
324 324
 		$day     = $dates['day'];
325 325
 		$day_end = $dates['day_end'];
326 326
 		$month   = $dates['m_start'];
327
-		while ( $day <= $day_end ) :
327
+		while ($day <= $day_end) :
328 328
 
329
-			$date     = mktime( 0, 0, 0, $month, $day, $dates['year'] );
330
-			$date_end = mktime( 0, 0, 0, $month, $day + 1, $dates['year'] );
331
-			$sales    = $stats->get_sales( $form_id, $date, $date_end );
329
+			$date     = mktime(0, 0, 0, $month, $day, $dates['year']);
330
+			$date_end = mktime(0, 0, 0, $month, $day + 1, $dates['year']);
331
+			$sales    = $stats->get_sales($form_id, $date, $date_end);
332 332
 			$sales_totals += $sales;
333 333
 
334
-			$earnings = $stats->get_earnings( $form_id, $date, $date_end );
334
+			$earnings = $stats->get_earnings($form_id, $date, $date_end);
335 335
 			$earnings_totals += $earnings;
336 336
 
337
-			$sales_data[]    = array( $date * 1000, $sales );
338
-			$earnings_data[] = array( $date * 1000, $earnings );
337
+			$sales_data[]    = array($date * 1000, $sales);
338
+			$earnings_data[] = array($date * 1000, $earnings);
339 339
 
340
-			$day ++;
340
+			$day++;
341 341
 		endwhile;
342 342
 
343 343
 	} else {
344 344
 
345 345
 		$y = $dates['year'];
346 346
 
347
-		while ( $y <= $dates['year_end'] ) :
347
+		while ($y <= $dates['year_end']) :
348 348
 
349 349
 			$last_year = false;
350 350
 
351
-			if ( $dates['year'] == $dates['year_end'] ) {
351
+			if ($dates['year'] == $dates['year_end']) {
352 352
 				$month_start = $dates['m_start'];
353 353
 				$month_end   = $dates['m_end'];
354 354
 				$last_year   = true;
355
-			} elseif ( $y == $dates['year'] ) {
355
+			} elseif ($y == $dates['year']) {
356 356
 				$month_start = $dates['m_start'];
357 357
 				$month_end   = 12;
358 358
 			} else {
@@ -361,79 +361,79 @@  discard block
 block discarded – undo
361 361
 			}
362 362
 
363 363
 			$i = $month_start;
364
-			while ( $i <= $month_end ) :
364
+			while ($i <= $month_end) :
365 365
 
366
-				if ( $day_by_day ) :
366
+				if ($day_by_day) :
367 367
 
368
-					if ( $i == $month_end && $last_year ) {
368
+					if ($i == $month_end && $last_year) {
369 369
 
370 370
 						$num_of_days = $dates['day_end'];
371 371
 
372 372
 					} else {
373 373
 
374
-						$num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y );
374
+						$num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y);
375 375
 
376 376
 					}
377 377
 
378 378
 					$d = $dates['day'];
379
-					while ( $d <= $num_of_days ) :
379
+					while ($d <= $num_of_days) :
380 380
 
381
-						$date     = mktime( 0, 0, 0, $i, $d, $y );
382
-						$end_date = mktime( 23, 59, 59, $i, $d, $y );
381
+						$date     = mktime(0, 0, 0, $i, $d, $y);
382
+						$end_date = mktime(23, 59, 59, $i, $d, $y);
383 383
 
384
-						$sales = $stats->get_sales( $form_id, $date, $end_date );
384
+						$sales = $stats->get_sales($form_id, $date, $end_date);
385 385
 						$sales_totals += $sales;
386 386
 
387
-						$earnings = $stats->get_earnings( $form_id, $date, $end_date );
387
+						$earnings = $stats->get_earnings($form_id, $date, $end_date);
388 388
 						$earnings_totals += $earnings;
389 389
 
390
-						$sales_data[]    = array( $date * 1000, $sales );
391
-						$earnings_data[] = array( $date * 1000, $earnings );
392
-						$d ++;
390
+						$sales_data[]    = array($date * 1000, $sales);
391
+						$earnings_data[] = array($date * 1000, $earnings);
392
+						$d++;
393 393
 
394 394
 					endwhile;
395 395
 
396 396
 				else :
397 397
 
398
-					$num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y );
398
+					$num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y);
399 399
 
400
-					$date     = mktime( 0, 0, 0, $i, 1, $y );
401
-					$end_date = mktime( 23, 59, 59, $i, $num_of_days, $y );
400
+					$date     = mktime(0, 0, 0, $i, 1, $y);
401
+					$end_date = mktime(23, 59, 59, $i, $num_of_days, $y);
402 402
 
403
-					$sales = $stats->get_sales( $form_id, $date, $end_date );
403
+					$sales = $stats->get_sales($form_id, $date, $end_date);
404 404
 					$sales_totals += $sales;
405 405
 
406
-					$earnings = $stats->get_earnings( $form_id, $date, $end_date );
406
+					$earnings = $stats->get_earnings($form_id, $date, $end_date);
407 407
 					$earnings_totals += $earnings;
408 408
 
409
-					$sales_data[]    = array( $date * 1000, $sales );
410
-					$earnings_data[] = array( $date * 1000, $earnings );
409
+					$sales_data[]    = array($date * 1000, $sales);
410
+					$earnings_data[] = array($date * 1000, $earnings);
411 411
 				endif;
412 412
 
413
-				$i ++;
413
+				$i++;
414 414
 
415 415
 			endwhile;
416 416
 
417
-			$y ++;
417
+			$y++;
418 418
 		endwhile;
419 419
 
420 420
 	}
421 421
 
422 422
 	$data = array(
423
-		__( 'Income', 'give' )    => $earnings_data,
424
-		__( 'Donations', 'give' ) => $sales_data
423
+		__('Income', 'give')    => $earnings_data,
424
+		__('Donations', 'give') => $sales_data
425 425
 	);
426 426
 
427 427
 	?>
428
-	<h3><span><?php printf( __( 'Income Over Time for %s', 'give' ), get_the_title( $form_id ) ); ?></span></h3>
428
+	<h3><span><?php printf(__('Income Over Time for %s', 'give'), get_the_title($form_id)); ?></span></h3>
429 429
 
430 430
 	<div class="metabox-holder" style="padding-top: 0;">
431 431
 		<div class="postbox">
432 432
 			<div class="inside">
433 433
 				<?php
434
-				$graph = new Give_Graph( $data );
435
-				$graph->set( 'x_mode', 'time' );
436
-				$graph->set( 'multiple_y_axes', true );
434
+				$graph = new Give_Graph($data);
435
+				$graph->set('x_mode', 'time');
436
+				$graph->set('multiple_y_axes', true);
437 437
 				$graph->display();
438 438
 				?>
439 439
 			</div>
@@ -443,26 +443,26 @@  discard block
 block discarded – undo
443 443
 			<tbody>
444 444
 			<tr>
445 445
 				<td class="row-title">
446
-					<label for="tablecell"><?php _e( 'Total income for period: ', 'give' ); ?></label></td>
447
-				<td><?php echo give_currency_filter( give_format_amount( $earnings_totals ) ); ?></td>
446
+					<label for="tablecell"><?php _e('Total income for period: ', 'give'); ?></label></td>
447
+				<td><?php echo give_currency_filter(give_format_amount($earnings_totals)); ?></td>
448 448
 			</tr>
449 449
 			<tr class="alternate">
450 450
 				<td class="row-title">
451
-					<label for="tablecell"><?php _e( 'Total donations for period: ', 'give' ); ?></label>
451
+					<label for="tablecell"><?php _e('Total donations for period: ', 'give'); ?></label>
452 452
 				</td>
453 453
 				<td><?php echo $sales_totals; ?></td>
454 454
 			</tr>
455 455
 			<tr>
456 456
 				<td class="row-title">
457
-					<label for="tablecell"><?php _e( 'Average monthly income: %s', 'give' ); ?></label>
457
+					<label for="tablecell"><?php _e('Average monthly income: %s', 'give'); ?></label>
458 458
 				</td>
459
-				<td><?php echo give_currency_filter( give_format_amount( give_get_average_monthly_form_earnings( $form_id ) ) ); ?></td>
459
+				<td><?php echo give_currency_filter(give_format_amount(give_get_average_monthly_form_earnings($form_id))); ?></td>
460 460
 			</tr>
461 461
 			<tr class="alternate">
462 462
 				<td class="row-title">
463
-					<label for="tablecell"><?php _e( 'Average monthly donations: %s', 'give' ); ?></label>
463
+					<label for="tablecell"><?php _e('Average monthly donations: %s', 'give'); ?></label>
464 464
 				</td>
465
-				<td><?php echo number_format( give_get_average_monthly_form_sales( $form_id ), 0 ); ?></td>
465
+				<td><?php echo number_format(give_get_average_monthly_form_sales($form_id), 0); ?></td>
466 466
 			</tr>
467 467
 			</tbody>
468 468
 		</table>
@@ -479,30 +479,30 @@  discard block
 block discarded – undo
479 479
  * @return void
480 480
  */
481 481
 function give_reports_graph_controls() {
482
-	$date_options = apply_filters( 'give_report_date_options', array(
483
-		'today'        => __( 'Today', 'give' ),
484
-		'yesterday'    => __( 'Yesterday', 'give' ),
485
-		'this_week'    => __( 'This Week', 'give' ),
486
-		'last_week'    => __( 'Last Week', 'give' ),
487
-		'this_month'   => __( 'This Month', 'give' ),
488
-		'last_month'   => __( 'Last Month', 'give' ),
489
-		'this_quarter' => __( 'This Quarter', 'give' ),
490
-		'last_quarter' => __( 'Last Quarter', 'give' ),
491
-		'this_year'    => __( 'This Year', 'give' ),
492
-		'last_year'    => __( 'Last Year', 'give' ),
493
-		'other'        => __( 'Custom', 'give' )
494
-	) );
482
+	$date_options = apply_filters('give_report_date_options', array(
483
+		'today'        => __('Today', 'give'),
484
+		'yesterday'    => __('Yesterday', 'give'),
485
+		'this_week'    => __('This Week', 'give'),
486
+		'last_week'    => __('Last Week', 'give'),
487
+		'this_month'   => __('This Month', 'give'),
488
+		'last_month'   => __('Last Month', 'give'),
489
+		'this_quarter' => __('This Quarter', 'give'),
490
+		'last_quarter' => __('Last Quarter', 'give'),
491
+		'this_year'    => __('This Year', 'give'),
492
+		'last_year'    => __('Last Year', 'give'),
493
+		'other'        => __('Custom', 'give')
494
+	));
495 495
 
496 496
 	$dates   = give_get_report_dates();
497 497
 	$display = $dates['range'] == 'other' ? '' : 'style="display:none;"';
498 498
 	$view    = give_get_reporting_view();
499 499
 
500
-	if ( empty( $dates['day_end'] ) ) {
501
-		$dates['day_end'] = cal_days_in_month( CAL_GREGORIAN, date( 'n' ), date( 'Y' ) );
500
+	if (empty($dates['day_end'])) {
501
+		$dates['day_end'] = cal_days_in_month(CAL_GREGORIAN, date('n'), date('Y'));
502 502
 	}
503 503
 
504 504
 	//echo '<pre>'; print_r( $dates ); echo '</pre>';
505
-	do_action( 'give_report_graph_controls_before' );
505
+	do_action('give_report_graph_controls_before');
506 506
 	?>
507 507
 	<form id="give-graphs-filter" method="get" class="alignright">
508 508
 		<div class="tablenav top alignright">
@@ -510,53 +510,53 @@  discard block
 block discarded – undo
510 510
 
511 511
 				<input type="hidden" name="post_type" value="give_forms" />
512 512
 				<input type="hidden" name="page" value="give-reports" />
513
-				<input type="hidden" name="view" value="<?php echo esc_attr( $view ); ?>" />
513
+				<input type="hidden" name="view" value="<?php echo esc_attr($view); ?>" />
514 514
 
515
-				<?php if ( isset( $_GET['form-id'] ) ) : ?>
516
-					<input type="hidden" name="form-id" value="<?php echo absint( $_GET['form-id'] ); ?>" />
515
+				<?php if (isset($_GET['form-id'])) : ?>
516
+					<input type="hidden" name="form-id" value="<?php echo absint($_GET['form-id']); ?>" />
517 517
 				<?php endif; ?>
518 518
 
519 519
 				<div id="give-graphs-date-options-wrap" class="alignright">
520 520
 					<select id="give-graphs-date-options" name="range">
521
-						<?php foreach ( $date_options as $key => $option ) : ?>
522
-							<option value="<?php echo esc_attr( $key ); ?>"<?php selected( $key, $dates['range'] ); ?>><?php echo esc_html( $option ); ?></option>
521
+						<?php foreach ($date_options as $key => $option) : ?>
522
+							<option value="<?php echo esc_attr($key); ?>"<?php selected($key, $dates['range']); ?>><?php echo esc_html($option); ?></option>
523 523
 						<?php endforeach; ?>
524 524
 					</select>
525 525
 
526
-					<input type="submit" class="button-secondary" value="<?php _e( 'Filter', 'give' ); ?>" />
526
+					<input type="submit" class="button-secondary" value="<?php _e('Filter', 'give'); ?>" />
527 527
 				</div>
528 528
 
529 529
 				<div id="give-date-range-options" <?php echo $display; ?>>
530
-					<span><?php _e( 'From', 'give' ); ?>&nbsp;</span>
530
+					<span><?php _e('From', 'give'); ?>&nbsp;</span>
531 531
 					<select id="give-graphs-month-start" name="m_start">
532
-						<?php for ( $i = 1; $i <= 12; $i ++ ) : ?>
533
-							<option value="<?php echo absint( $i ); ?>" <?php selected( $i, $dates['m_start'] ); ?>><?php echo give_month_num_to_name( $i ); ?></option>
532
+						<?php for ($i = 1; $i <= 12; $i++) : ?>
533
+							<option value="<?php echo absint($i); ?>" <?php selected($i, $dates['m_start']); ?>><?php echo give_month_num_to_name($i); ?></option>
534 534
 						<?php endfor; ?>
535 535
 					</select>
536 536
 					<select id="give-graphs-day-start" name="day">
537
-						<?php for ( $i = 1; $i <= 31; $i ++ ) : ?>
538
-							<option value="<?php echo absint( $i ); ?>" <?php selected( $i, $dates['day'] ); ?>><?php echo $i; ?></option>
537
+						<?php for ($i = 1; $i <= 31; $i++) : ?>
538
+							<option value="<?php echo absint($i); ?>" <?php selected($i, $dates['day']); ?>><?php echo $i; ?></option>
539 539
 						<?php endfor; ?>
540 540
 					</select>
541 541
 					<select id="give-graphs-year-start" name="year">
542
-						<?php for ( $i = 2007; $i <= date( 'Y' ); $i ++ ) : ?>
543
-							<option value="<?php echo absint( $i ); ?>" <?php selected( $i, $dates['year'] ); ?>><?php echo $i; ?></option>
542
+						<?php for ($i = 2007; $i <= date('Y'); $i++) : ?>
543
+							<option value="<?php echo absint($i); ?>" <?php selected($i, $dates['year']); ?>><?php echo $i; ?></option>
544 544
 						<?php endfor; ?>
545 545
 					</select>
546
-					<span><?php _e( 'To', 'give' ); ?>&nbsp;</span>
546
+					<span><?php _e('To', 'give'); ?>&nbsp;</span>
547 547
 					<select id="give-graphs-month-end" name="m_end">
548
-						<?php for ( $i = 1; $i <= 12; $i ++ ) : ?>
549
-							<option value="<?php echo absint( $i ); ?>" <?php selected( $i, $dates['m_end'] ); ?>><?php echo give_month_num_to_name( $i ); ?></option>
548
+						<?php for ($i = 1; $i <= 12; $i++) : ?>
549
+							<option value="<?php echo absint($i); ?>" <?php selected($i, $dates['m_end']); ?>><?php echo give_month_num_to_name($i); ?></option>
550 550
 						<?php endfor; ?>
551 551
 					</select>
552 552
 					<select id="give-graphs-day-end" name="day_end">
553
-						<?php for ( $i = 1; $i <= 31; $i ++ ) : ?>
554
-							<option value="<?php echo absint( $i ); ?>" <?php selected( $i, $dates['day_end'] ); ?>><?php echo $i; ?></option>
553
+						<?php for ($i = 1; $i <= 31; $i++) : ?>
554
+							<option value="<?php echo absint($i); ?>" <?php selected($i, $dates['day_end']); ?>><?php echo $i; ?></option>
555 555
 						<?php endfor; ?>
556 556
 					</select>
557 557
 					<select id="give-graphs-year-end" name="year_end">
558
-						<?php for ( $i = 2007; $i <= date( 'Y' ); $i ++ ) : ?>
559
-							<option value="<?php echo absint( $i ); ?>" <?php selected( $i, $dates['year_end'] ); ?>><?php echo $i; ?></option>
558
+						<?php for ($i = 2007; $i <= date('Y'); $i++) : ?>
559
+							<option value="<?php echo absint($i); ?>" <?php selected($i, $dates['year_end']); ?>><?php echo $i; ?></option>
560 560
 						<?php endfor; ?>
561 561
 					</select>
562 562
 				</div>
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
 		</div>
567 567
 	</form>
568 568
 	<?php
569
-	do_action( 'give_report_graph_controls_after' );
569
+	do_action('give_report_graph_controls_after');
570 570
 }
571 571
 
572 572
 /**
@@ -581,65 +581,65 @@  discard block
 block discarded – undo
581 581
 function give_get_report_dates() {
582 582
 	$dates = array();
583 583
 
584
-	$current_time = current_time( 'timestamp' );
584
+	$current_time = current_time('timestamp');
585 585
 
586
-	$dates['range']    = isset( $_GET['range'] ) ? $_GET['range'] : 'this_month';
587
-	$dates['year']     = isset( $_GET['year'] ) ? $_GET['year'] : date( 'Y' );
588
-	$dates['year_end'] = isset( $_GET['year_end'] ) ? $_GET['year_end'] : date( 'Y' );
589
-	$dates['m_start']  = isset( $_GET['m_start'] ) ? $_GET['m_start'] : 1;
590
-	$dates['m_end']    = isset( $_GET['m_end'] ) ? $_GET['m_end'] : 12;
591
-	$dates['day']      = isset( $_GET['day'] ) ? $_GET['day'] : 1;
592
-	$dates['day_end']  = isset( $_GET['day_end'] ) ? $_GET['day_end'] : cal_days_in_month( CAL_GREGORIAN, $dates['m_end'], $dates['year'] );
586
+	$dates['range']    = isset($_GET['range']) ? $_GET['range'] : 'this_month';
587
+	$dates['year']     = isset($_GET['year']) ? $_GET['year'] : date('Y');
588
+	$dates['year_end'] = isset($_GET['year_end']) ? $_GET['year_end'] : date('Y');
589
+	$dates['m_start']  = isset($_GET['m_start']) ? $_GET['m_start'] : 1;
590
+	$dates['m_end']    = isset($_GET['m_end']) ? $_GET['m_end'] : 12;
591
+	$dates['day']      = isset($_GET['day']) ? $_GET['day'] : 1;
592
+	$dates['day_end']  = isset($_GET['day_end']) ? $_GET['day_end'] : cal_days_in_month(CAL_GREGORIAN, $dates['m_end'], $dates['year']);
593 593
 
594 594
 	// Modify dates based on predefined ranges
595
-	switch ( $dates['range'] ) :
595
+	switch ($dates['range']) :
596 596
 
597 597
 		case 'this_month' :
598
-			$dates['m_start']  = date( 'n', $current_time );
599
-			$dates['m_end']    = date( 'n', $current_time );
598
+			$dates['m_start']  = date('n', $current_time);
599
+			$dates['m_end']    = date('n', $current_time);
600 600
 			$dates['day']      = 1;
601
-			$dates['day_end']  = cal_days_in_month( CAL_GREGORIAN, $dates['m_end'], $dates['year'] );
602
-			$dates['year']     = date( 'Y' );
603
-			$dates['year_end'] = date( 'Y' );
601
+			$dates['day_end']  = cal_days_in_month(CAL_GREGORIAN, $dates['m_end'], $dates['year']);
602
+			$dates['year']     = date('Y');
603
+			$dates['year_end'] = date('Y');
604 604
 			break;
605 605
 
606 606
 		case 'last_month' :
607
-			if ( date( 'n' ) == 1 ) {
607
+			if (date('n') == 1) {
608 608
 				$dates['m_start']  = 12;
609 609
 				$dates['m_end']    = 12;
610
-				$dates['year']     = date( 'Y', $current_time ) - 1;
611
-				$dates['year_end'] = date( 'Y', $current_time ) - 1;
610
+				$dates['year']     = date('Y', $current_time) - 1;
611
+				$dates['year_end'] = date('Y', $current_time) - 1;
612 612
 			} else {
613
-				$dates['m_start']  = date( 'n' ) - 1;
614
-				$dates['m_end']    = date( 'n' ) - 1;
613
+				$dates['m_start']  = date('n') - 1;
614
+				$dates['m_end']    = date('n') - 1;
615 615
 				$dates['year_end'] = $dates['year'];
616 616
 			}
617
-			$dates['day_end'] = cal_days_in_month( CAL_GREGORIAN, $dates['m_end'], $dates['year'] );
617
+			$dates['day_end'] = cal_days_in_month(CAL_GREGORIAN, $dates['m_end'], $dates['year']);
618 618
 			break;
619 619
 
620 620
 		case 'today' :
621
-			$dates['day']     = date( 'd', $current_time );
622
-			$dates['m_start'] = date( 'n', $current_time );
623
-			$dates['m_end']   = date( 'n', $current_time );
624
-			$dates['year']    = date( 'Y', $current_time );
621
+			$dates['day']     = date('d', $current_time);
622
+			$dates['m_start'] = date('n', $current_time);
623
+			$dates['m_end']   = date('n', $current_time);
624
+			$dates['year']    = date('Y', $current_time);
625 625
 			break;
626 626
 
627 627
 		case 'yesterday' :
628 628
 
629
-			$year  = date( 'Y', $current_time );
630
-			$month = date( 'n', $current_time );
631
-			$day   = date( 'd', $current_time );
629
+			$year  = date('Y', $current_time);
630
+			$month = date('n', $current_time);
631
+			$day   = date('d', $current_time);
632 632
 
633
-			if ( $month == 1 && $day == 1 ) {
633
+			if ($month == 1 && $day == 1) {
634 634
 
635 635
 				$year -= 1;
636 636
 				$month = 12;
637
-				$day   = cal_days_in_month( CAL_GREGORIAN, $month, $year );
637
+				$day   = cal_days_in_month(CAL_GREGORIAN, $month, $year);
638 638
 
639
-			} elseif ( $month > 1 && $day == 1 ) {
639
+			} elseif ($month > 1 && $day == 1) {
640 640
 
641 641
 				$month -= 1;
642
-				$day = cal_days_in_month( CAL_GREGORIAN, $month, $year );
642
+				$day = cal_days_in_month(CAL_GREGORIAN, $month, $year);
643 643
 
644 644
 			} else {
645 645
 
@@ -655,91 +655,91 @@  discard block
 block discarded – undo
655 655
 			break;
656 656
 
657 657
 		case 'this_week' :
658
-			$dates['day'] = date( 'd', $current_time - ( date( 'w', $current_time ) - 1 ) * 60 * 60 * 24 ) - 1;
659
-			$dates['day'] += get_option( 'start_of_week' );
658
+			$dates['day'] = date('d', $current_time - (date('w', $current_time) - 1) * 60 * 60 * 24) - 1;
659
+			$dates['day'] += get_option('start_of_week');
660 660
 			$dates['day_end'] = $dates['day'] + 6;
661
-			$dates['m_start'] = date( 'n', $current_time );
662
-			$dates['m_end']   = date( 'n', $current_time );
663
-			$dates['year']    = date( 'Y', $current_time );
661
+			$dates['m_start'] = date('n', $current_time);
662
+			$dates['m_end']   = date('n', $current_time);
663
+			$dates['year']    = date('Y', $current_time);
664 664
 			break;
665 665
 
666 666
 		case 'last_week' :
667
-			$dates['day'] = date( 'd', $current_time - ( date( 'w' ) - 1 ) * 60 * 60 * 24 ) - 8;
668
-			$dates['day'] += get_option( 'start_of_week' );
667
+			$dates['day'] = date('d', $current_time - (date('w') - 1) * 60 * 60 * 24) - 8;
668
+			$dates['day'] += get_option('start_of_week');
669 669
 			$dates['day_end'] = $dates['day'] + 6;
670
-			$dates['year']    = date( 'Y' );
671
-
672
-			if ( date( 'j', $current_time ) <= 7 ) {
673
-				$dates['m_start'] = date( 'n', $current_time ) - 1;
674
-				$dates['m_end']   = date( 'n', $current_time ) - 1;
675
-				if ( $dates['m_start'] <= 1 ) {
676
-					$dates['year']     = date( 'Y', $current_time ) - 1;
677
-					$dates['year_end'] = date( 'Y', $current_time ) - 1;
670
+			$dates['year']    = date('Y');
671
+
672
+			if (date('j', $current_time) <= 7) {
673
+				$dates['m_start'] = date('n', $current_time) - 1;
674
+				$dates['m_end']   = date('n', $current_time) - 1;
675
+				if ($dates['m_start'] <= 1) {
676
+					$dates['year']     = date('Y', $current_time) - 1;
677
+					$dates['year_end'] = date('Y', $current_time) - 1;
678 678
 				}
679 679
 			} else {
680
-				$dates['m_start'] = date( 'n', $current_time );
681
-				$dates['m_end']   = date( 'n', $current_time );
680
+				$dates['m_start'] = date('n', $current_time);
681
+				$dates['m_end']   = date('n', $current_time);
682 682
 			}
683 683
 			break;
684 684
 
685 685
 		case 'this_quarter' :
686
-			$month_now = date( 'n', $current_time );
686
+			$month_now = date('n', $current_time);
687 687
 
688
-			if ( $month_now <= 3 ) {
688
+			if ($month_now <= 3) {
689 689
 
690 690
 				$dates['m_start'] = 1;
691 691
 				$dates['m_end']   = 4;
692
-				$dates['year']    = date( 'Y', $current_time );
692
+				$dates['year']    = date('Y', $current_time);
693 693
 
694
-			} else if ( $month_now <= 6 ) {
694
+			} else if ($month_now <= 6) {
695 695
 
696 696
 				$dates['m_start'] = 4;
697 697
 				$dates['m_end']   = 7;
698
-				$dates['year']    = date( 'Y', $current_time );
698
+				$dates['year']    = date('Y', $current_time);
699 699
 
700
-			} else if ( $month_now <= 9 ) {
700
+			} else if ($month_now <= 9) {
701 701
 
702 702
 				$dates['m_start'] = 7;
703 703
 				$dates['m_end']   = 10;
704
-				$dates['year']    = date( 'Y', $current_time );
704
+				$dates['year']    = date('Y', $current_time);
705 705
 
706 706
 			} else {
707 707
 
708 708
 				$dates['m_start']  = 10;
709 709
 				$dates['m_end']    = 1;
710
-				$dates['year']     = date( 'Y', $current_time );
711
-				$dates['year_end'] = date( 'Y', $current_time ) + 1;
710
+				$dates['year']     = date('Y', $current_time);
711
+				$dates['year_end'] = date('Y', $current_time) + 1;
712 712
 
713 713
 			}
714 714
 			break;
715 715
 
716 716
 		case 'last_quarter' :
717
-			$month_now = date( 'n' );
717
+			$month_now = date('n');
718 718
 
719
-			if ( $month_now <= 3 ) {
719
+			if ($month_now <= 3) {
720 720
 
721 721
 				$dates['m_start']  = 10;
722 722
 				$dates['m_end']    = 12;
723
-				$dates['year']     = date( 'Y', $current_time ) - 1; // Previous year
724
-				$dates['year_end'] = date( 'Y', $current_time ) - 1; // Previous year
723
+				$dates['year']     = date('Y', $current_time) - 1; // Previous year
724
+				$dates['year_end'] = date('Y', $current_time) - 1; // Previous year
725 725
 
726
-			} else if ( $month_now <= 6 ) {
726
+			} else if ($month_now <= 6) {
727 727
 
728 728
 				$dates['m_start'] = 1;
729 729
 				$dates['m_end']   = 3;
730
-				$dates['year']    = date( 'Y', $current_time );
730
+				$dates['year']    = date('Y', $current_time);
731 731
 
732
-			} else if ( $month_now <= 9 ) {
732
+			} else if ($month_now <= 9) {
733 733
 
734 734
 				$dates['m_start'] = 4;
735 735
 				$dates['m_end']   = 6;
736
-				$dates['year']    = date( 'Y', $current_time );
736
+				$dates['year']    = date('Y', $current_time);
737 737
 
738 738
 			} else {
739 739
 
740 740
 				$dates['m_start'] = 7;
741 741
 				$dates['m_end']   = 9;
742
-				$dates['year']    = date( 'Y', $current_time );
742
+				$dates['year']    = date('Y', $current_time);
743 743
 
744 744
 			}
745 745
 			break;
@@ -747,19 +747,19 @@  discard block
 block discarded – undo
747 747
 		case 'this_year' :
748 748
 			$dates['m_start'] = 1;
749 749
 			$dates['m_end']   = 12;
750
-			$dates['year']    = date( 'Y', $current_time );
750
+			$dates['year']    = date('Y', $current_time);
751 751
 			break;
752 752
 
753 753
 		case 'last_year' :
754 754
 			$dates['m_start']  = 1;
755 755
 			$dates['m_end']    = 12;
756
-			$dates['year']     = date( 'Y', $current_time ) - 1;
757
-			$dates['year_end'] = date( 'Y', $current_time ) - 1;
756
+			$dates['year']     = date('Y', $current_time) - 1;
757
+			$dates['year_end'] = date('Y', $current_time) - 1;
758 758
 			break;
759 759
 
760 760
 	endswitch;
761 761
 
762
-	return apply_filters( 'give_report_dates', $dates );
762
+	return apply_filters('give_report_dates', $dates);
763 763
 }
764 764
 
765 765
 /**
@@ -769,17 +769,17 @@  discard block
 block discarded – undo
769 769
  *
770 770
  * @param $data
771 771
  */
772
-function give_parse_report_dates( $data ) {
772
+function give_parse_report_dates($data) {
773 773
 	$dates = give_get_report_dates();
774 774
 
775 775
 	$view = give_get_reporting_view();
776
-	$id   = isset( $_GET['form-id'] ) ? $_GET['form-id'] : null;
776
+	$id   = isset($_GET['form-id']) ? $_GET['form-id'] : null;
777 777
 
778
-	wp_redirect( add_query_arg( $dates, admin_url( 'edit.php?post_type=give_forms&page=give-reports&view=' . esc_attr( $view ) . '&form-id=' . absint( $id ) ) ) );
778
+	wp_redirect(add_query_arg($dates, admin_url('edit.php?post_type=give_forms&page=give-reports&view='.esc_attr($view).'&form-id='.absint($id))));
779 779
 	give_die();
780 780
 }
781 781
 
782
-add_action( 'give_filter_reports', 'give_parse_report_dates' );
782
+add_action('give_filter_reports', 'give_parse_report_dates');
783 783
 
784 784
 
785 785
 /**
@@ -789,16 +789,16 @@  discard block
 block discarded – undo
789 789
  */
790 790
 function give_reports_refresh_button() {
791 791
 
792
-	$url = wp_nonce_url( add_query_arg( array(
792
+	$url = wp_nonce_url(add_query_arg(array(
793 793
 		'give_action'  => 'refresh_reports_transients',
794 794
 		'give-message' => 'refreshed-reports'
795
-	) ), 'give-refresh-reports' );
795
+	)), 'give-refresh-reports');
796 796
 
797
-	echo '<a href="' . $url . '" data-tooltip="' . __( 'Clicking this will clear the reports cache.', 'give' ) . '" data-tooltip-my-position="right center"  data-tooltip-target-position="left center" class="button alignright give-refresh-reports-button give-tooltip">' . __( 'Refresh Reports', 'give' ) . '</a>';
797
+	echo '<a href="'.$url.'" data-tooltip="'.__('Clicking this will clear the reports cache.', 'give').'" data-tooltip-my-position="right center"  data-tooltip-target-position="left center" class="button alignright give-refresh-reports-button give-tooltip">'.__('Refresh Reports', 'give').'</a>';
798 798
 
799 799
 }
800 800
 
801
-add_action( 'give_reports_graph_additional_stats', 'give_reports_refresh_button' );
801
+add_action('give_reports_graph_additional_stats', 'give_reports_refresh_button');
802 802
 
803 803
 /**
804 804
  * Trigger the refresh of reports transients
@@ -809,18 +809,18 @@  discard block
 block discarded – undo
809 809
  *
810 810
  * @return void
811 811
  */
812
-function give_run_refresh_reports_transients( $data ) {
812
+function give_run_refresh_reports_transients($data) {
813 813
 
814
-	if ( ! wp_verify_nonce( $data['_wpnonce'], 'give-refresh-reports' ) ) {
814
+	if ( ! wp_verify_nonce($data['_wpnonce'], 'give-refresh-reports')) {
815 815
 		return;
816 816
 	}
817 817
 
818 818
 	//Delete transients
819
-	delete_transient( 'give_estimated_monthly_stats' );
820
-	delete_transient( 'give_earnings_total' );
821
-	delete_transient( md5( 'give_earnings_this_monththis_month' ) );
822
-	delete_transient( md5( 'give_earnings_todaytoday' ) );
819
+	delete_transient('give_estimated_monthly_stats');
820
+	delete_transient('give_earnings_total');
821
+	delete_transient(md5('give_earnings_this_monththis_month'));
822
+	delete_transient(md5('give_earnings_todaytoday'));
823 823
 
824 824
 }
825 825
 
826
-add_action( 'give_refresh_reports_transients', 'give_run_refresh_reports_transients' );
827 826
\ No newline at end of file
827
+add_action('give_refresh_reports_transients', 'give_run_refresh_reports_transients');
828 828
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -143,9 +143,11 @@  discard block
 block discarded – undo
143 143
 
144 144
 					endwhile;
145 145
 
146
-				else :
146
+				else {
147
+					:
147 148
 
148 149
 					$sales = give_get_sales_by_date( null, $i, $y );
150
+				}
149 151
 					$sales_totals += $sales;
150 152
 
151 153
 					$earnings = give_get_earnings_by_date( null, $i, $y );
@@ -393,9 +395,11 @@  discard block
 block discarded – undo
393 395
 
394 396
 					endwhile;
395 397
 
396
-				else :
398
+				else {
399
+					:
397 400
 
398 401
 					$num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y );
402
+				}
399 403
 
400 404
 					$date     = mktime( 0, 0, 0, $i, 1, $y );
401 405
 					$end_date = mktime( 23, 59, 59, $i, $num_of_days, $y );
Please login to merge, or discard this patch.
includes/admin/shortcodes/abstract-shortcode-generator.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 	/**
105 105
 	 * Define the shortcode attribute fields
106 106
 	 *
107
-	 * @return false|array
107
+	 * @return boolean
108 108
 	 *
109 109
 	 * @since 1.0
110 110
 	 */
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 	/**
117 117
 	 * Generate the shortcode dialog fields
118 118
 	 *
119
-	 * @param array $defined_fields
119
+	 * @param boolean $defined_fields
120 120
 	 *
121 121
 	 * @return array
122 122
 	 *
Please login to merge, or discard this patch.
Spacing   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  * @since       1.3.0
12 12
  */
13 13
 
14
-defined( 'ABSPATH' ) or exit;
14
+defined('ABSPATH') or exit;
15 15
 
16 16
 abstract class Give_Shortcode_Generator {
17 17
 
@@ -57,12 +57,12 @@  discard block
 block discarded – undo
57 57
 	 *
58 58
 	 * @since 1.0
59 59
 	 */
60
-	public function __construct( $shortcode ) {
60
+	public function __construct($shortcode) {
61 61
 
62 62
 
63 63
 		$this->shortcode_tag = $shortcode;
64 64
 
65
-		add_action( 'admin_init', array( $this, 'init' ) );
65
+		add_action('admin_init', array($this, 'init'));
66 66
 
67 67
 	}
68 68
 
@@ -72,9 +72,9 @@  discard block
 block discarded – undo
72 72
 	 */
73 73
 	public function init() {
74 74
 
75
-		if ( $this->shortcode_tag ) {
75
+		if ($this->shortcode_tag) {
76 76
 
77
-			$this->self = get_class( $this );
77
+			$this->self = get_class($this);
78 78
 
79 79
 			$this->errors   = array();
80 80
 			$this->required = array();
@@ -83,16 +83,16 @@  discard block
 block discarded – undo
83 83
 			$fields = $this->get_fields();
84 84
 
85 85
 			$defaults = array(
86
-				'btn_close' => __( 'Close', 'give' ),
87
-				'btn_okay'  => __( 'Insert Shortcode', 'give' ),
86
+				'btn_close' => __('Close', 'give'),
87
+				'btn_okay'  => __('Insert Shortcode', 'give'),
88 88
 				'errors'    => $this->errors,
89 89
 				'fields'    => $fields,
90
-				'label'     => '[' . $this->shortcode_tag . ']',
90
+				'label'     => '['.$this->shortcode_tag.']',
91 91
 				'required'  => $this->required,
92
-				'title'     => __( 'Insert Shortcode', 'give' ),
92
+				'title'     => __('Insert Shortcode', 'give'),
93 93
 			);
94 94
 
95
-			Give_Shortcode_Button::$shortcodes[ $this->shortcode_tag ] = wp_parse_args( $this->shortcode, $defaults );
95
+			Give_Shortcode_Button::$shortcodes[$this->shortcode_tag] = wp_parse_args($this->shortcode, $defaults);
96 96
 
97 97
 			//
98 98
 
@@ -122,13 +122,13 @@  discard block
 block discarded – undo
122 122
 	 *
123 123
 	 * @since 1.0
124 124
 	 */
125
-	protected function generate_fields( $defined_fields ) {
125
+	protected function generate_fields($defined_fields) {
126 126
 
127 127
 		$fields = array();
128 128
 
129
-		if ( is_array( $defined_fields ) ) {
129
+		if (is_array($defined_fields)) {
130 130
 
131
-			foreach ( $defined_fields as $field ) {
131
+			foreach ($defined_fields as $field) {
132 132
 
133 133
 				$defaults = array(
134 134
 					'label'       => false,
@@ -139,14 +139,14 @@  discard block
 block discarded – undo
139 139
 					'type'        => '',
140 140
 				);
141 141
 
142
-				$field  = wp_parse_args( (array) $field, $defaults );
143
-				$method = 'generate_' . strtolower( $field['type'] );
142
+				$field  = wp_parse_args((array) $field, $defaults);
143
+				$method = 'generate_'.strtolower($field['type']);
144 144
 
145
-				if ( method_exists( $this, $method ) ) {
145
+				if (method_exists($this, $method)) {
146 146
 
147
-					$field = call_user_func( array( $this, $method ), $field );
147
+					$field = call_user_func(array($this, $method), $field);
148 148
 
149
-					if ( $field ) {
149
+					if ($field) {
150 150
 						$fields[] = $field;
151 151
 					}
152 152
 				}
@@ -166,22 +166,22 @@  discard block
 block discarded – undo
166 166
 	protected function get_fields() {
167 167
 
168 168
 		$defined_fields   = $this->define_fields();
169
-		$generated_fields = $this->generate_fields( $defined_fields );
169
+		$generated_fields = $this->generate_fields($defined_fields);
170 170
 
171 171
 		$errors = array();
172 172
 
173
-		if ( ! empty( $this->errors ) ) {
174
-			foreach ( $this->required as $name => $alert ) {
175
-				if ( false === array_search( $name, array_column( $generated_fields, 'name' ) ) ) {
173
+		if ( ! empty($this->errors)) {
174
+			foreach ($this->required as $name => $alert) {
175
+				if (false === array_search($name, array_column($generated_fields, 'name'))) {
176 176
 
177
-					$errors[] = $this->errors[ $name ];
177
+					$errors[] = $this->errors[$name];
178 178
 				}
179 179
 			}
180 180
 
181 181
 			$this->errors = $errors;
182 182
 		}
183 183
 
184
-		if ( ! empty( $errors ) ) {
184
+		if ( ! empty($errors)) {
185 185
 
186 186
 			return $errors;
187 187
 		}
@@ -198,9 +198,9 @@  discard block
 block discarded – undo
198 198
 	 *
199 199
 	 * @since 1.0
200 200
 	 */
201
-	protected function generate_container( $field ) {
201
+	protected function generate_container($field) {
202 202
 
203
-		if ( array_key_exists( 'html', $field ) ) {
203
+		if (array_key_exists('html', $field)) {
204 204
 
205 205
 			return array(
206 206
 				'type' => $field['type'],
@@ -220,36 +220,36 @@  discard block
 block discarded – undo
220 220
 	 *
221 221
 	 * @since 1.0
222 222
 	 */
223
-	protected function generate_listbox( $field ) {
223
+	protected function generate_listbox($field) {
224 224
 
225
-		$listbox = shortcode_atts( array(
225
+		$listbox = shortcode_atts(array(
226 226
 			'label'    => '',
227 227
 			'minWidth' => '',
228 228
 			'name'     => false,
229 229
 			'tooltip'  => '',
230 230
 			'type'     => '',
231 231
 			'value'    => '',
232
-		), $field );
232
+		), $field);
233 233
 
234
-		if ( $this->validate( $field ) ) {
234
+		if ($this->validate($field)) {
235 235
 
236 236
 			$new_listbox = array();
237 237
 
238
-			foreach ( $listbox as $key => $value ) {
238
+			foreach ($listbox as $key => $value) {
239 239
 
240
-				if ( $key == 'value' && empty( $value ) ) {
241
-					$new_listbox[ $key ] = $listbox['name'];
242
-				} else if ( $value ) {
243
-					$new_listbox[ $key ] = $value;
240
+				if ($key == 'value' && empty($value)) {
241
+					$new_listbox[$key] = $listbox['name'];
242
+				} else if ($value) {
243
+					$new_listbox[$key] = $value;
244 244
 				}
245 245
 			}
246 246
 
247 247
 			// do not reindex array!
248 248
 			$field['options'] = array(
249
-				                    '' => ( $field['placeholder'] ? $field['placeholder'] : sprintf( '– %s –', __( 'Select', 'give' ) ) ),
249
+				                    '' => ($field['placeholder'] ? $field['placeholder'] : sprintf('– %s –', __('Select', 'give'))),
250 250
 			                    ) + $field['options'];
251 251
 
252
-			foreach ( $field['options'] as $value => $text ) {
252
+			foreach ($field['options'] as $value => $text) {
253 253
 				$new_listbox['values'][] = array(
254 254
 					'text'  => $text,
255 255
 					'value' => $value,
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 	 *
272 272
 	 * @since 1.0
273 273
 	 */
274
-	protected function generate_post( $field ) {
274
+	protected function generate_post($field) {
275 275
 
276 276
 		$args = array(
277 277
 			'post_type'      => 'post',
@@ -280,23 +280,23 @@  discard block
 block discarded – undo
280 280
 			'posts_per_page' => 30,
281 281
 		);
282 282
 
283
-		$args    = wp_parse_args( (array) $field['query_args'], $args );
284
-		$posts   = get_posts( $args );
283
+		$args    = wp_parse_args((array) $field['query_args'], $args);
284
+		$posts   = get_posts($args);
285 285
 		$options = array();
286 286
 
287
-		if ( $posts ) {
288
-			foreach ( $posts as $post ) {
289
-				$options[ absint( $post->ID ) ] = esc_html( $post->post_title );
287
+		if ($posts) {
288
+			foreach ($posts as $post) {
289
+				$options[absint($post->ID)] = esc_html($post->post_title);
290 290
 			}
291 291
 
292 292
 			$field['type']    = 'listbox';
293 293
 			$field['options'] = $options;
294 294
 
295
-			return $this->generate_listbox( $field );
295
+			return $this->generate_listbox($field);
296 296
 		}
297 297
 
298 298
 		// perform validation here before returning false
299
-		$this->validate( $field );
299
+		$this->validate($field);
300 300
 
301 301
 		return false;
302 302
 	}
@@ -310,9 +310,9 @@  discard block
 block discarded – undo
310 310
 	 *
311 311
 	 * @since 1.0
312 312
 	 */
313
-	protected function generate_textbox( $field ) {
313
+	protected function generate_textbox($field) {
314 314
 
315
-		$textbox = shortcode_atts( array(
315
+		$textbox = shortcode_atts(array(
316 316
 			'label'     => '',
317 317
 			'maxLength' => '',
318 318
 			'minHeight' => '',
@@ -322,10 +322,10 @@  discard block
 block discarded – undo
322 322
 			'tooltip'   => '',
323 323
 			'type'      => '',
324 324
 			'value'     => '',
325
-		), $field );
325
+		), $field);
326 326
 
327
-		if ( $this->validate( $field ) ) {
328
-			return array_filter( $textbox, array( $this, 'return_textbox_value' ) );
327
+		if ($this->validate($field)) {
328
+			return array_filter($textbox, array($this, 'return_textbox_value'));
329 329
 		}
330 330
 
331 331
 		return false;
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
 	 *
339 339
 	 * @return bool
340 340
 	 */
341
-	function return_textbox_value( $value ) {
341
+	function return_textbox_value($value) {
342 342
 		return $value !== '';
343 343
 	}
344 344
 
@@ -354,9 +354,9 @@  discard block
 block discarded – undo
354 354
 	 *
355 355
 	 * @since 1.0
356 356
 	 */
357
-	protected function validate( $field ) {
357
+	protected function validate($field) {
358 358
 
359
-		extract( shortcode_atts(
359
+		extract(shortcode_atts(
360 360
 				array(
361 361
 					'name'     => false,
362 362
 					'required' => false,
@@ -364,34 +364,34 @@  discard block
 block discarded – undo
364 364
 				), $field )
365 365
 		);
366 366
 
367
-		if ( $name ) {
367
+		if ($name) {
368 368
 
369
-			if ( isset( $required['error'] ) ) {
369
+			if (isset($required['error'])) {
370 370
 
371 371
 				$error = array(
372 372
 					'type' => 'container',
373 373
 					'html' => $required['error'],
374 374
 				);
375 375
 
376
-				$this->errors[ $name ] = $this->generate_container( $error );
376
+				$this->errors[$name] = $this->generate_container($error);
377 377
 			}
378 378
 
379
-			if ( ! ! $required || is_array( $required ) ) {
379
+			if ( ! ! $required || is_array($required)) {
380 380
 
381
-				$alert = __( 'Some of the Shortcode options are required.', 'give' );
381
+				$alert = __('Some of the Shortcode options are required.', 'give');
382 382
 
383
-				if ( isset( $required['alert'] ) ) {
383
+				if (isset($required['alert'])) {
384 384
 
385 385
 					$alert = $required['alert'];
386 386
 
387
-				} else if ( ! empty( $label ) ) {
387
+				} else if ( ! empty($label)) {
388 388
 
389
-					$alert = sprintf( __( 'The "%s" option is required.', 'give' ),
390
-						str_replace( ':', '', $label )
389
+					$alert = sprintf(__('The "%s" option is required.', 'give'),
390
+						str_replace(':', '', $label)
391 391
 					);
392 392
 				}
393 393
 
394
-				$this->required[ $name ] = $alert;
394
+				$this->required[$name] = $alert;
395 395
 			}
396 396
 
397 397
 			return true;
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -246,8 +246,8 @@
 block discarded – undo
246 246
 
247 247
 			// do not reindex array!
248 248
 			$field['options'] = array(
249
-				                    '' => ( $field['placeholder'] ? $field['placeholder'] : sprintf( '– %s –', __( 'Select', 'give' ) ) ),
250
-			                    ) + $field['options'];
249
+									'' => ( $field['placeholder'] ? $field['placeholder'] : sprintf( '– %s –', __( 'Select', 'give' ) ) ),
250
+								) + $field['options'];
251 251
 
252 252
 			foreach ( $field['options'] as $value => $text ) {
253 253
 				$new_listbox['values'][] = array(
Please login to merge, or discard this patch.
includes/api/class-give-api.php 3 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 	 *
212 212
 	 * @access public
213 213
 	 * @since  1.1
214
-	 * @return array
214
+	 * @return string
215 215
 	 */
216 216
 	public function get_versions() {
217 217
 		return $this->versions;
@@ -662,7 +662,7 @@  discard block
 block discarded – undo
662 662
 	 *
663 663
 	 * @param array $args Arguments to override defaults
664 664
 	 *
665
-	 * @return array $dates
665
+	 * @return integer|null $dates
666 666
 	 */
667 667
 	public function get_dates( $args = array() ) {
668 668
 		$dates = array();
@@ -1712,7 +1712,7 @@  discard block
 block discarded – undo
1712 1712
 	 *
1713 1713
 	 * @param int $user_id User ID of user to revoke key for
1714 1714
 	 *
1715
-	 * @return string
1715
+	 * @return boolean
1716 1716
 	 */
1717 1717
 	public function revoke_api_key( $user_id = 0 ) {
1718 1718
 
Please login to merge, or discard this patch.
Spacing   +468 added lines, -468 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
 
@@ -139,24 +139,24 @@  discard block
 block discarded – undo
139 139
 			'v1' => 'GIVE_API_V1',
140 140
 		);
141 141
 
142
-		foreach ( $this->get_versions() as $version => $class ) {
143
-			require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api-' . $version . '.php';
142
+		foreach ($this->get_versions() as $version => $class) {
143
+			require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api-'.$version.'.php';
144 144
 		}
145 145
 
146
-		add_action( 'init', array( $this, 'add_endpoint' ) );
147
-		add_action( 'template_redirect', array( $this, 'process_query' ), - 1 );
148
-		add_filter( 'query_vars', array( $this, 'query_vars' ) );
149
-		add_action( 'show_user_profile', array( $this, 'user_key_field' ) );
150
-		add_action( 'edit_user_profile', array( $this, 'user_key_field' ) );
151
-		add_action( 'personal_options_update', array( $this, 'update_key' ) );
152
-		add_action( 'edit_user_profile_update', array( $this, 'update_key' ) );
153
-		add_action( 'give_process_api_key', array( $this, 'process_api_key' ) );
146
+		add_action('init', array($this, 'add_endpoint'));
147
+		add_action('template_redirect', array($this, 'process_query'), - 1);
148
+		add_filter('query_vars', array($this, 'query_vars'));
149
+		add_action('show_user_profile', array($this, 'user_key_field'));
150
+		add_action('edit_user_profile', array($this, 'user_key_field'));
151
+		add_action('personal_options_update', array($this, 'update_key'));
152
+		add_action('edit_user_profile_update', array($this, 'update_key'));
153
+		add_action('give_process_api_key', array($this, 'process_api_key'));
154 154
 
155 155
 		// Determine if JSON_PRETTY_PRINT is available
156
-		$this->pretty_print = defined( 'JSON_PRETTY_PRINT' ) ? JSON_PRETTY_PRINT : null;
156
+		$this->pretty_print = defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT : null;
157 157
 
158 158
 		// Allow API request logging to be turned off
159
-		$this->log_requests = apply_filters( 'give_api_log_requests', $this->log_requests );
159
+		$this->log_requests = apply_filters('give_api_log_requests', $this->log_requests);
160 160
 
161 161
 		// Setup Give_Payment_Stats instance
162 162
 		$this->stats = new Give_Payment_Stats;
@@ -172,8 +172,8 @@  discard block
 block discarded – undo
172 172
 	 *
173 173
 	 * @since  1.1
174 174
 	 */
175
-	public function add_endpoint( $rewrite_rules ) {
176
-		add_rewrite_endpoint( 'give-api', EP_ALL );
175
+	public function add_endpoint($rewrite_rules) {
176
+		add_rewrite_endpoint('give-api', EP_ALL);
177 177
 	}
178 178
 
179 179
 	/**
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 	 *
187 187
 	 * @return string[] $vars New query vars
188 188
 	 */
189
-	public function query_vars( $vars ) {
189
+	public function query_vars($vars) {
190 190
 
191 191
 		$vars[] = 'token';
192 192
 		$vars[] = 'key';
@@ -237,11 +237,11 @@  discard block
 block discarded – undo
237 237
 	 */
238 238
 	public function get_default_version() {
239 239
 
240
-		$version = get_option( 'give_default_api_version' );
240
+		$version = get_option('give_default_api_version');
241 241
 
242
-		if ( defined( 'GIVE_API_VERSION' ) ) {
242
+		if (defined('GIVE_API_VERSION')) {
243 243
 			$version = GIVE_API_VERSION;
244
-		} elseif ( ! $version ) {
244
+		} elseif ( ! $version) {
245 245
 			$version = 'v1';
246 246
 		}
247 247
 
@@ -262,14 +262,14 @@  discard block
 block discarded – undo
262 262
 
263 263
 		$version = $wp_query->query_vars['give-api'];
264 264
 
265
-		if ( strpos( $version, '/' ) ) {
265
+		if (strpos($version, '/')) {
266 266
 
267
-			$version = explode( '/', $version );
268
-			$version = strtolower( $version[0] );
267
+			$version = explode('/', $version);
268
+			$version = strtolower($version[0]);
269 269
 
270
-			$wp_query->query_vars['give-api'] = str_replace( $version . '/', '', $wp_query->query_vars['give-api'] );
270
+			$wp_query->query_vars['give-api'] = str_replace($version.'/', '', $wp_query->query_vars['give-api']);
271 271
 
272
-			if ( array_key_exists( $version, $this->versions ) ) {
272
+			if (array_key_exists($version, $this->versions)) {
273 273
 
274 274
 				$this->queried_version = $version;
275 275
 
@@ -306,35 +306,35 @@  discard block
 block discarded – undo
306 306
 		$this->override = false;
307 307
 
308 308
 		// Make sure we have both user and api key
309
-		if ( ! empty( $wp_query->query_vars['give-api'] ) && ( $wp_query->query_vars['give-api'] != 'forms' || ! empty( $wp_query->query_vars['token'] ) ) ) {
309
+		if ( ! empty($wp_query->query_vars['give-api']) && ($wp_query->query_vars['give-api'] != 'forms' || ! empty($wp_query->query_vars['token']))) {
310 310
 
311
-			if ( empty( $wp_query->query_vars['token'] ) || empty( $wp_query->query_vars['key'] ) ) {
311
+			if (empty($wp_query->query_vars['token']) || empty($wp_query->query_vars['key'])) {
312 312
 				$this->missing_auth();
313 313
 			}
314 314
 
315 315
 			// Auth was provided, include the upgrade routine so we can use the fallback api checks
316
-			require GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php';
316
+			require GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php';
317 317
 
318 318
 			// Retrieve the user by public API key and ensure they exist
319
-			if ( ! ( $user = $this->get_user( $wp_query->query_vars['key'] ) ) ) {
319
+			if ( ! ($user = $this->get_user($wp_query->query_vars['key']))) {
320 320
 
321 321
 				$this->invalid_key();
322 322
 
323 323
 			} else {
324 324
 
325
-				$token  = urldecode( $wp_query->query_vars['token'] );
326
-				$secret = $this->get_user_secret_key( $user );
327
-				$public = urldecode( $wp_query->query_vars['key'] );
325
+				$token  = urldecode($wp_query->query_vars['token']);
326
+				$secret = $this->get_user_secret_key($user);
327
+				$public = urldecode($wp_query->query_vars['key']);
328 328
 
329
-				if ( hash_equals( md5( $secret . $public ), $token ) ) {
329
+				if (hash_equals(md5($secret.$public), $token)) {
330 330
 					$this->is_valid_request = true;
331 331
 				} else {
332 332
 					$this->invalid_auth();
333 333
 				}
334 334
 			}
335
-		} elseif ( ! empty( $wp_query->query_vars['give-api'] ) && $wp_query->query_vars['give-api'] == 'forms' ) {
335
+		} elseif ( ! empty($wp_query->query_vars['give-api']) && $wp_query->query_vars['give-api'] == 'forms') {
336 336
 			$this->is_valid_request = true;
337
-			$wp_query->set( 'key', 'public' );
337
+			$wp_query->set('key', 'public');
338 338
 		}
339 339
 	}
340 340
 
@@ -350,25 +350,25 @@  discard block
 block discarded – undo
350 350
 	 *
351 351
 	 * @return bool if user ID is found, false otherwise
352 352
 	 */
353
-	public function get_user( $key = '' ) {
353
+	public function get_user($key = '') {
354 354
 		global $wpdb, $wp_query;
355 355
 
356
-		if ( empty( $key ) ) {
357
-			$key = urldecode( $wp_query->query_vars['key'] );
356
+		if (empty($key)) {
357
+			$key = urldecode($wp_query->query_vars['key']);
358 358
 		}
359 359
 
360
-		if ( empty( $key ) ) {
360
+		if (empty($key)) {
361 361
 			return false;
362 362
 		}
363 363
 
364
-		$user = get_transient( md5( 'give_api_user_' . $key ) );
364
+		$user = get_transient(md5('give_api_user_'.$key));
365 365
 
366
-		if ( false === $user ) {
367
-			$user = $wpdb->get_var( $wpdb->prepare( "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s LIMIT 1", $key ) );
368
-			set_transient( md5( 'give_api_user_' . $key ), $user, DAY_IN_SECONDS );
366
+		if (false === $user) {
367
+			$user = $wpdb->get_var($wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s LIMIT 1", $key));
368
+			set_transient(md5('give_api_user_'.$key), $user, DAY_IN_SECONDS);
369 369
 		}
370 370
 
371
-		if ( $user != null ) {
371
+		if ($user != null) {
372 372
 			$this->user_id = $user;
373 373
 
374 374
 			return $user;
@@ -377,37 +377,37 @@  discard block
 block discarded – undo
377 377
 		return false;
378 378
 	}
379 379
 
380
-	public function get_user_public_key( $user_id = 0 ) {
380
+	public function get_user_public_key($user_id = 0) {
381 381
 		global $wpdb;
382 382
 
383
-		if ( empty( $user_id ) ) {
383
+		if (empty($user_id)) {
384 384
 			return '';
385 385
 		}
386 386
 
387
-		$cache_key       = md5( 'give_api_user_public_key' . $user_id );
388
-		$user_public_key = get_transient( $cache_key );
387
+		$cache_key       = md5('give_api_user_public_key'.$user_id);
388
+		$user_public_key = get_transient($cache_key);
389 389
 
390
-		if ( empty( $user_public_key ) ) {
391
-			$user_public_key = $wpdb->get_var( $wpdb->prepare( "SELECT meta_key FROM $wpdb->usermeta WHERE meta_value = 'give_user_public_key' AND user_id = %d", $user_id ) );
392
-			set_transient( $cache_key, $user_public_key, HOUR_IN_SECONDS );
390
+		if (empty($user_public_key)) {
391
+			$user_public_key = $wpdb->get_var($wpdb->prepare("SELECT meta_key FROM $wpdb->usermeta WHERE meta_value = 'give_user_public_key' AND user_id = %d", $user_id));
392
+			set_transient($cache_key, $user_public_key, HOUR_IN_SECONDS);
393 393
 		}
394 394
 
395 395
 		return $user_public_key;
396 396
 	}
397 397
 
398
-	public function get_user_secret_key( $user_id = 0 ) {
398
+	public function get_user_secret_key($user_id = 0) {
399 399
 		global $wpdb;
400 400
 
401
-		if ( empty( $user_id ) ) {
401
+		if (empty($user_id)) {
402 402
 			return '';
403 403
 		}
404 404
 
405
-		$cache_key       = md5( 'give_api_user_secret_key' . $user_id );
406
-		$user_secret_key = get_transient( $cache_key );
405
+		$cache_key       = md5('give_api_user_secret_key'.$user_id);
406
+		$user_secret_key = get_transient($cache_key);
407 407
 
408
-		if ( empty( $user_secret_key ) ) {
409
-			$user_secret_key = $wpdb->get_var( $wpdb->prepare( "SELECT meta_key FROM $wpdb->usermeta WHERE meta_value = 'give_user_secret_key' AND user_id = %d", $user_id ) );
410
-			set_transient( $cache_key, $user_secret_key, HOUR_IN_SECONDS );
408
+		if (empty($user_secret_key)) {
409
+			$user_secret_key = $wpdb->get_var($wpdb->prepare("SELECT meta_key FROM $wpdb->usermeta WHERE meta_value = 'give_user_secret_key' AND user_id = %d", $user_id));
410
+			set_transient($cache_key, $user_secret_key, HOUR_IN_SECONDS);
411 411
 		}
412 412
 
413 413
 		return $user_secret_key;
@@ -423,10 +423,10 @@  discard block
 block discarded – undo
423 423
 	 */
424 424
 	private function missing_auth() {
425 425
 		$error          = array();
426
-		$error['error'] = __( 'You must specify both a token and API key!', 'give' );
426
+		$error['error'] = __('You must specify both a token and API key!', 'give');
427 427
 
428 428
 		$this->data = $error;
429
-		$this->output( 401 );
429
+		$this->output(401);
430 430
 	}
431 431
 
432 432
 	/**
@@ -440,10 +440,10 @@  discard block
 block discarded – undo
440 440
 	 */
441 441
 	private function invalid_auth() {
442 442
 		$error          = array();
443
-		$error['error'] = __( 'Your request could not be authenticated!', 'give' );
443
+		$error['error'] = __('Your request could not be authenticated!', 'give');
444 444
 
445 445
 		$this->data = $error;
446
-		$this->output( 401 );
446
+		$this->output(401);
447 447
 	}
448 448
 
449 449
 	/**
@@ -457,10 +457,10 @@  discard block
 block discarded – undo
457 457
 	 */
458 458
 	private function invalid_key() {
459 459
 		$error          = array();
460
-		$error['error'] = __( 'Invalid API key!', 'give' );
460
+		$error['error'] = __('Invalid API key!', 'give');
461 461
 
462 462
 		$this->data = $error;
463
-		$this->output( 401 );
463
+		$this->output(401);
464 464
 	}
465 465
 
466 466
 	/**
@@ -473,10 +473,10 @@  discard block
 block discarded – undo
473 473
 	 */
474 474
 	private function invalid_version() {
475 475
 		$error          = array();
476
-		$error['error'] = __( 'Invalid API version!', 'give' );
476
+		$error['error'] = __('Invalid API version!', 'give');
477 477
 
478 478
 		$this->data = $error;
479
-		$this->output( 404 );
479
+		$this->output(404);
480 480
 	}
481 481
 
482 482
 	/**
@@ -492,10 +492,10 @@  discard block
 block discarded – undo
492 492
 		global $wp_query;
493 493
 
494 494
 		// Start logging how long the request takes for logging
495
-		$before = microtime( true );
495
+		$before = microtime(true);
496 496
 
497 497
 		// Check for give-api var. Get out if not present
498
-		if ( empty( $wp_query->query_vars['give-api'] ) ) {
498
+		if (empty($wp_query->query_vars['give-api'])) {
499 499
 			return;
500 500
 		}
501 501
 
@@ -509,44 +509,44 @@  discard block
 block discarded – undo
509 509
 		$this->validate_request();
510 510
 
511 511
 		// Only proceed if no errors have been noted
512
-		if ( ! $this->is_valid_request ) {
512
+		if ( ! $this->is_valid_request) {
513 513
 			return;
514 514
 		}
515 515
 
516
-		if ( ! defined( 'GIVE_DOING_API' ) ) {
517
-			define( 'GIVE_DOING_API', true );
516
+		if ( ! defined('GIVE_DOING_API')) {
517
+			define('GIVE_DOING_API', true);
518 518
 		}
519 519
 
520 520
 		$data         = array();
521 521
 		$this->routes = new $this->versions[$this->get_queried_version()];
522 522
 
523
-		switch ( $this->endpoint ) :
523
+		switch ($this->endpoint) :
524 524
 
525 525
 			case 'stats' :
526 526
 
527
-				$data = $this->routes->get_stats( array(
528
-					'type'      => isset( $wp_query->query_vars['type'] ) ? $wp_query->query_vars['type'] : null,
529
-					'form'      => isset( $wp_query->query_vars['form'] ) ? $wp_query->query_vars['form'] : null,
530
-					'date'      => isset( $wp_query->query_vars['date'] ) ? $wp_query->query_vars['date'] : null,
531
-					'startdate' => isset( $wp_query->query_vars['startdate'] ) ? $wp_query->query_vars['startdate'] : null,
532
-					'enddate'   => isset( $wp_query->query_vars['enddate'] ) ? $wp_query->query_vars['enddate'] : null
533
-				) );
527
+				$data = $this->routes->get_stats(array(
528
+					'type'      => isset($wp_query->query_vars['type']) ? $wp_query->query_vars['type'] : null,
529
+					'form'      => isset($wp_query->query_vars['form']) ? $wp_query->query_vars['form'] : null,
530
+					'date'      => isset($wp_query->query_vars['date']) ? $wp_query->query_vars['date'] : null,
531
+					'startdate' => isset($wp_query->query_vars['startdate']) ? $wp_query->query_vars['startdate'] : null,
532
+					'enddate'   => isset($wp_query->query_vars['enddate']) ? $wp_query->query_vars['enddate'] : null
533
+				));
534 534
 
535 535
 				break;
536 536
 
537 537
 			case 'forms' :
538 538
 
539
-				$form = isset( $wp_query->query_vars['form'] ) ? $wp_query->query_vars['form'] : null;
539
+				$form = isset($wp_query->query_vars['form']) ? $wp_query->query_vars['form'] : null;
540 540
 
541
-				$data = $this->routes->get_forms( $form );
541
+				$data = $this->routes->get_forms($form);
542 542
 
543 543
 				break;
544 544
 
545 545
 			case 'donors' :
546 546
 
547
-				$customer = isset( $wp_query->query_vars['donor'] ) ? $wp_query->query_vars['donor'] : null;
547
+				$customer = isset($wp_query->query_vars['donor']) ? $wp_query->query_vars['donor'] : null;
548 548
 
549
-				$data = $this->routes->get_customers( $customer );
549
+				$data = $this->routes->get_customers($customer);
550 550
 
551 551
 				break;
552 552
 
@@ -559,14 +559,14 @@  discard block
 block discarded – undo
559 559
 		endswitch;
560 560
 
561 561
 		// Allow extensions to setup their own return data
562
-		$this->data = apply_filters( 'give_api_output_data', $data, $this->endpoint, $this );
562
+		$this->data = apply_filters('give_api_output_data', $data, $this->endpoint, $this);
563 563
 
564
-		$after                       = microtime( true );
565
-		$request_time                = ( $after - $before );
564
+		$after                       = microtime(true);
565
+		$request_time                = ($after - $before);
566 566
 		$this->data['request_speed'] = $request_time;
567 567
 
568 568
 		// Log this API request, if enabled. We log it here because we have access to errors.
569
-		$this->log_request( $this->data );
569
+		$this->log_request($this->data);
570 570
 
571 571
 		// Send out data to the output function
572 572
 		$this->output();
@@ -596,21 +596,21 @@  discard block
 block discarded – undo
596 596
 		global $wp_query;
597 597
 
598 598
 		// Whitelist our query options
599
-		$accepted = apply_filters( 'give_api_valid_query_modes', array(
599
+		$accepted = apply_filters('give_api_valid_query_modes', array(
600 600
 			'stats',
601 601
 			'forms',
602 602
 			'donors',
603 603
 			'donations'
604
-		) );
604
+		));
605 605
 
606
-		$query = isset( $wp_query->query_vars['give-api'] ) ? $wp_query->query_vars['give-api'] : null;
607
-		$query = str_replace( $this->queried_version . '/', '', $query );
606
+		$query = isset($wp_query->query_vars['give-api']) ? $wp_query->query_vars['give-api'] : null;
607
+		$query = str_replace($this->queried_version.'/', '', $query);
608 608
 
609 609
 		$error = array();
610 610
 
611 611
 		// Make sure our query is valid
612
-		if ( ! in_array( $query, $accepted ) ) {
613
-			$error['error'] = __( 'Invalid query!', 'give' );
612
+		if ( ! in_array($query, $accepted)) {
613
+			$error['error'] = __('Invalid query!', 'give');
614 614
 
615 615
 			$this->data = $error;
616 616
 			$this->output();
@@ -630,7 +630,7 @@  discard block
 block discarded – undo
630 630
 	public function get_paged() {
631 631
 		global $wp_query;
632 632
 
633
-		return isset( $wp_query->query_vars['page'] ) ? $wp_query->query_vars['page'] : 1;
633
+		return isset($wp_query->query_vars['page']) ? $wp_query->query_vars['page'] : 1;
634 634
 	}
635 635
 
636 636
 
@@ -645,13 +645,13 @@  discard block
 block discarded – undo
645 645
 	public function per_page() {
646 646
 		global $wp_query;
647 647
 
648
-		$per_page = isset( $wp_query->query_vars['number'] ) ? $wp_query->query_vars['number'] : 10;
648
+		$per_page = isset($wp_query->query_vars['number']) ? $wp_query->query_vars['number'] : 10;
649 649
 
650
-		if ( $per_page < 0 && $this->get_query_mode() == 'donors' ) {
650
+		if ($per_page < 0 && $this->get_query_mode() == 'donors') {
651 651
 			$per_page = 99999999;
652 652
 		} // Customers query doesn't support -1
653 653
 
654
-		return apply_filters( 'give_api_results_per_page', $per_page );
654
+		return apply_filters('give_api_results_per_page', $per_page);
655 655
 	}
656 656
 
657 657
 	/**
@@ -664,7 +664,7 @@  discard block
 block discarded – undo
664 664
 	 *
665 665
 	 * @return array $dates
666 666
 	 */
667
-	public function get_dates( $args = array() ) {
667
+	public function get_dates($args = array()) {
668 668
 		$dates = array();
669 669
 
670 670
 		$defaults = array(
@@ -675,60 +675,60 @@  discard block
 block discarded – undo
675 675
 			'enddate'   => null
676 676
 		);
677 677
 
678
-		$args = wp_parse_args( $args, $defaults );
678
+		$args = wp_parse_args($args, $defaults);
679 679
 
680
-		$current_time = current_time( 'timestamp' );
680
+		$current_time = current_time('timestamp');
681 681
 
682
-		if ( 'range' === $args['date'] ) {
683
-			$startdate          = strtotime( $args['startdate'] );
684
-			$enddate            = strtotime( $args['enddate'] );
685
-			$dates['day_start'] = date( 'd', $startdate );
686
-			$dates['day_end']   = date( 'd', $enddate );
687
-			$dates['m_start']   = date( 'n', $startdate );
688
-			$dates['m_end']     = date( 'n', $enddate );
689
-			$dates['year']      = date( 'Y', $startdate );
690
-			$dates['year_end']  = date( 'Y', $enddate );
682
+		if ('range' === $args['date']) {
683
+			$startdate          = strtotime($args['startdate']);
684
+			$enddate            = strtotime($args['enddate']);
685
+			$dates['day_start'] = date('d', $startdate);
686
+			$dates['day_end']   = date('d', $enddate);
687
+			$dates['m_start']   = date('n', $startdate);
688
+			$dates['m_end']     = date('n', $enddate);
689
+			$dates['year']      = date('Y', $startdate);
690
+			$dates['year_end']  = date('Y', $enddate);
691 691
 		} else {
692 692
 			// Modify dates based on predefined ranges
693
-			switch ( $args['date'] ) :
693
+			switch ($args['date']) :
694 694
 
695 695
 				case 'this_month' :
696 696
 					$dates['day']     = null;
697
-					$dates['m_start'] = date( 'n', $current_time );
698
-					$dates['m_end']   = date( 'n', $current_time );
699
-					$dates['year']    = date( 'Y', $current_time );
697
+					$dates['m_start'] = date('n', $current_time);
698
+					$dates['m_end']   = date('n', $current_time);
699
+					$dates['year']    = date('Y', $current_time);
700 700
 					break;
701 701
 
702 702
 				case 'last_month' :
703 703
 					$dates['day']     = null;
704
-					$dates['m_start'] = date( 'n', $current_time ) == 1 ? 12 : date( 'n', $current_time ) - 1;
704
+					$dates['m_start'] = date('n', $current_time) == 1 ? 12 : date('n', $current_time) - 1;
705 705
 					$dates['m_end']   = $dates['m_start'];
706
-					$dates['year']    = date( 'n', $current_time ) == 1 ? date( 'Y', $current_time ) - 1 : date( 'Y', $current_time );
706
+					$dates['year']    = date('n', $current_time) == 1 ? date('Y', $current_time) - 1 : date('Y', $current_time);
707 707
 					break;
708 708
 
709 709
 				case 'today' :
710
-					$dates['day']     = date( 'd', $current_time );
711
-					$dates['m_start'] = date( 'n', $current_time );
712
-					$dates['m_end']   = date( 'n', $current_time );
713
-					$dates['year']    = date( 'Y', $current_time );
710
+					$dates['day']     = date('d', $current_time);
711
+					$dates['m_start'] = date('n', $current_time);
712
+					$dates['m_end']   = date('n', $current_time);
713
+					$dates['year']    = date('Y', $current_time);
714 714
 					break;
715 715
 
716 716
 				case 'yesterday' :
717 717
 
718
-					$year  = date( 'Y', $current_time );
719
-					$month = date( 'n', $current_time );
720
-					$day   = date( 'd', $current_time );
718
+					$year  = date('Y', $current_time);
719
+					$month = date('n', $current_time);
720
+					$day   = date('d', $current_time);
721 721
 
722
-					if ( $month == 1 && $day == 1 ) {
722
+					if ($month == 1 && $day == 1) {
723 723
 
724 724
 						$year -= 1;
725 725
 						$month = 12;
726
-						$day   = cal_days_in_month( CAL_GREGORIAN, $month, $year );
726
+						$day   = cal_days_in_month(CAL_GREGORIAN, $month, $year);
727 727
 
728
-					} elseif ( $month > 1 && $day == 1 ) {
728
+					} elseif ($month > 1 && $day == 1) {
729 729
 
730 730
 						$month -= 1;
731
-						$day = cal_days_in_month( CAL_GREGORIAN, $month, $year );
731
+						$day = cal_days_in_month(CAL_GREGORIAN, $month, $year);
732 732
 
733 733
 					} else {
734 734
 
@@ -744,65 +744,65 @@  discard block
 block discarded – undo
744 744
 					break;
745 745
 
746 746
 				case 'this_quarter' :
747
-					$month_now = date( 'n', $current_time );
747
+					$month_now = date('n', $current_time);
748 748
 
749 749
 					$dates['day'] = null;
750 750
 
751
-					if ( $month_now <= 3 ) {
751
+					if ($month_now <= 3) {
752 752
 
753 753
 						$dates['m_start'] = 1;
754 754
 						$dates['m_end']   = 3;
755
-						$dates['year']    = date( 'Y', $current_time );
755
+						$dates['year']    = date('Y', $current_time);
756 756
 
757
-					} else if ( $month_now <= 6 ) {
757
+					} else if ($month_now <= 6) {
758 758
 
759 759
 						$dates['m_start'] = 4;
760 760
 						$dates['m_end']   = 6;
761
-						$dates['year']    = date( 'Y', $current_time );
761
+						$dates['year']    = date('Y', $current_time);
762 762
 
763
-					} else if ( $month_now <= 9 ) {
763
+					} else if ($month_now <= 9) {
764 764
 
765 765
 						$dates['m_start'] = 7;
766 766
 						$dates['m_end']   = 9;
767
-						$dates['year']    = date( 'Y', $current_time );
767
+						$dates['year']    = date('Y', $current_time);
768 768
 
769 769
 					} else {
770 770
 
771 771
 						$dates['m_start'] = 10;
772 772
 						$dates['m_end']   = 12;
773
-						$dates['year']    = date( 'Y', $current_time );
773
+						$dates['year']    = date('Y', $current_time);
774 774
 
775 775
 					}
776 776
 					break;
777 777
 
778 778
 				case 'last_quarter' :
779
-					$month_now = date( 'n', $current_time );
779
+					$month_now = date('n', $current_time);
780 780
 
781 781
 					$dates['day'] = null;
782 782
 
783
-					if ( $month_now <= 3 ) {
783
+					if ($month_now <= 3) {
784 784
 
785 785
 						$dates['m_start'] = 10;
786 786
 						$dates['m_end']   = 12;
787
-						$dates['year']    = date( 'Y', $current_time ) - 1; // Previous year
787
+						$dates['year']    = date('Y', $current_time) - 1; // Previous year
788 788
 
789
-					} else if ( $month_now <= 6 ) {
789
+					} else if ($month_now <= 6) {
790 790
 
791 791
 						$dates['m_start'] = 1;
792 792
 						$dates['m_end']   = 3;
793
-						$dates['year']    = date( 'Y', $current_time );
793
+						$dates['year']    = date('Y', $current_time);
794 794
 
795
-					} else if ( $month_now <= 9 ) {
795
+					} else if ($month_now <= 9) {
796 796
 
797 797
 						$dates['m_start'] = 4;
798 798
 						$dates['m_end']   = 6;
799
-						$dates['year']    = date( 'Y', $current_time );
799
+						$dates['year']    = date('Y', $current_time);
800 800
 
801 801
 					} else {
802 802
 
803 803
 						$dates['m_start'] = 7;
804 804
 						$dates['m_end']   = 9;
805
-						$dates['year']    = date( 'Y', $current_time );
805
+						$dates['year']    = date('Y', $current_time);
806 806
 
807 807
 					}
808 808
 					break;
@@ -811,14 +811,14 @@  discard block
 block discarded – undo
811 811
 					$dates['day']     = null;
812 812
 					$dates['m_start'] = null;
813 813
 					$dates['m_end']   = null;
814
-					$dates['year']    = date( 'Y', $current_time );
814
+					$dates['year']    = date('Y', $current_time);
815 815
 					break;
816 816
 
817 817
 				case 'last_year' :
818 818
 					$dates['day']     = null;
819 819
 					$dates['m_start'] = null;
820 820
 					$dates['m_end']   = null;
821
-					$dates['year']    = date( 'Y', $current_time ) - 1;
821
+					$dates['year']    = date('Y', $current_time) - 1;
822 822
 					break;
823 823
 
824 824
 			endswitch;
@@ -832,7 +832,7 @@  discard block
 block discarded – undo
832 832
 		 * @param object $dates The dates used for retreiving earnings/donations
833 833
 		 */
834 834
 
835
-		return apply_filters( 'give_api_stat_dates', $dates );
835
+		return apply_filters('give_api_stat_dates', $dates);
836 836
 	}
837 837
 
838 838
 	/**
@@ -847,11 +847,11 @@  discard block
 block discarded – undo
847 847
 	 *
848 848
 	 * @return array $customers Multidimensional array of the customers
849 849
 	 */
850
-	public function get_customers( $customer = null ) {
850
+	public function get_customers($customer = null) {
851 851
 
852 852
 		$customers = array();
853 853
 		$error     = array();
854
-		if ( ! user_can( $this->user_id, 'view_give_sensitive_data' ) && ! $this->override ) {
854
+		if ( ! user_can($this->user_id, 'view_give_sensitive_data') && ! $this->override) {
855 855
 			return $customers;
856 856
 		}
857 857
 
@@ -859,68 +859,68 @@  discard block
 block discarded – undo
859 859
 
860 860
 		$paged    = $this->get_paged();
861 861
 		$per_page = $this->per_page();
862
-		$offset   = $per_page * ( $paged - 1 );
862
+		$offset   = $per_page * ($paged - 1);
863 863
 
864
-		if ( is_numeric( $customer ) ) {
864
+		if (is_numeric($customer)) {
865 865
 			$field = 'id';
866 866
 		} else {
867 867
 			$field = 'email';
868 868
 		}
869 869
 
870
-		$customer_query = Give()->customers->get_customers( array(
870
+		$customer_query = Give()->customers->get_customers(array(
871 871
 			'number' => $per_page,
872 872
 			'offset' => $offset,
873 873
 			$field   => $customer
874
-		) );
874
+		));
875 875
 		$customer_count = 0;
876 876
 
877
-		if ( $customer_query ) {
877
+		if ($customer_query) {
878 878
 
879
-			foreach ( $customer_query as $customer_obj ) {
879
+			foreach ($customer_query as $customer_obj) {
880 880
 
881
-				$names      = explode( ' ', $customer_obj->name );
882
-				$first_name = ! empty( $names[0] ) ? $names[0] : '';
881
+				$names      = explode(' ', $customer_obj->name);
882
+				$first_name = ! empty($names[0]) ? $names[0] : '';
883 883
 				$last_name  = '';
884
-				if ( ! empty( $names[1] ) ) {
885
-					unset( $names[0] );
886
-					$last_name = implode( ' ', $names );
884
+				if ( ! empty($names[1])) {
885
+					unset($names[0]);
886
+					$last_name = implode(' ', $names);
887 887
 				}
888 888
 
889
-				$customers['donors'][ $customer_count ]['info']['user_id']      = '';
890
-				$customers['donors'][ $customer_count ]['info']['username']     = '';
891
-				$customers['donors'][ $customer_count ]['info']['display_name'] = '';
892
-				$customers['donors'][ $customer_count ]['info']['customer_id']  = $customer_obj->id;
893
-				$customers['donors'][ $customer_count ]['info']['first_name']   = $first_name;
894
-				$customers['donors'][ $customer_count ]['info']['last_name']    = $last_name;
895
-				$customers['donors'][ $customer_count ]['info']['email']        = $customer_obj->email;
889
+				$customers['donors'][$customer_count]['info']['user_id']      = '';
890
+				$customers['donors'][$customer_count]['info']['username']     = '';
891
+				$customers['donors'][$customer_count]['info']['display_name'] = '';
892
+				$customers['donors'][$customer_count]['info']['customer_id']  = $customer_obj->id;
893
+				$customers['donors'][$customer_count]['info']['first_name']   = $first_name;
894
+				$customers['donors'][$customer_count]['info']['last_name']    = $last_name;
895
+				$customers['donors'][$customer_count]['info']['email']        = $customer_obj->email;
896 896
 
897
-				if ( ! empty( $customer_obj->user_id ) ) {
897
+				if ( ! empty($customer_obj->user_id)) {
898 898
 
899
-					$user_data = get_userdata( $customer_obj->user_id );
899
+					$user_data = get_userdata($customer_obj->user_id);
900 900
 
901 901
 					// Customer with registered account
902
-					$customers['donors'][ $customer_count ]['info']['user_id']      = $customer_obj->user_id;
903
-					$customers['donors'][ $customer_count ]['info']['username']     = $user_data->user_login;
904
-					$customers['donors'][ $customer_count ]['info']['display_name'] = $user_data->display_name;
902
+					$customers['donors'][$customer_count]['info']['user_id']      = $customer_obj->user_id;
903
+					$customers['donors'][$customer_count]['info']['username']     = $user_data->user_login;
904
+					$customers['donors'][$customer_count]['info']['display_name'] = $user_data->display_name;
905 905
 
906 906
 				}
907 907
 
908
-				$customers['donors'][ $customer_count ]['stats']['total_donations'] = $customer_obj->purchase_count;
909
-				$customers['donors'][ $customer_count ]['stats']['total_spent']     = $customer_obj->purchase_value;
908
+				$customers['donors'][$customer_count]['stats']['total_donations'] = $customer_obj->purchase_count;
909
+				$customers['donors'][$customer_count]['stats']['total_spent']     = $customer_obj->purchase_value;
910 910
 
911
-				$customer_count ++;
911
+				$customer_count++;
912 912
 
913 913
 			}
914 914
 
915
-		} elseif ( $customer ) {
915
+		} elseif ($customer) {
916 916
 
917
-			$error['error'] = sprintf( __( 'Donor %s not found!', 'give' ), $customer );
917
+			$error['error'] = sprintf(__('Donor %s not found!', 'give'), $customer);
918 918
 
919 919
 			return $error;
920 920
 
921 921
 		} else {
922 922
 
923
-			$error['error'] = __( 'No donors found!', 'give' );
923
+			$error['error'] = __('No donors found!', 'give');
924 924
 
925 925
 			return $error;
926 926
 
@@ -939,36 +939,36 @@  discard block
 block discarded – undo
939 939
 	 *
940 940
 	 * @return array $customers Multidimensional array of the forms
941 941
 	 */
942
-	public function get_forms( $form = null ) {
942
+	public function get_forms($form = null) {
943 943
 
944 944
 		$forms = array();
945 945
 		$error = array();
946 946
 
947
-		if ( $form == null ) {
947
+		if ($form == null) {
948 948
 			$forms['forms'] = array();
949 949
 
950
-			$form_list = get_posts( array(
950
+			$form_list = get_posts(array(
951 951
 				'post_type'        => 'give_forms',
952 952
 				'posts_per_page'   => $this->per_page(),
953 953
 				'suppress_filters' => true,
954 954
 				'paged'            => $this->get_paged()
955
-			) );
955
+			));
956 956
 
957
-			if ( $form_list ) {
957
+			if ($form_list) {
958 958
 				$i = 0;
959
-				foreach ( $form_list as $form_info ) {
960
-					$forms['forms'][ $i ] = $this->get_form_data( $form_info );
961
-					$i ++;
959
+				foreach ($form_list as $form_info) {
960
+					$forms['forms'][$i] = $this->get_form_data($form_info);
961
+					$i++;
962 962
 				}
963 963
 			}
964 964
 		} else {
965
-			if ( get_post_type( $form ) == 'give_forms' ) {
966
-				$form_info = get_post( $form );
965
+			if (get_post_type($form) == 'give_forms') {
966
+				$form_info = get_post($form);
967 967
 
968
-				$forms['forms'][0] = $this->get_form_data( $form_info );
968
+				$forms['forms'][0] = $this->get_form_data($form_info);
969 969
 
970 970
 			} else {
971
-				$error['error'] = sprintf( __( 'Form %s not found!', 'give' ), $form );
971
+				$error['error'] = sprintf(__('Form %s not found!', 'give'), $form);
972 972
 
973 973
 				return $error;
974 974
 			}
@@ -986,7 +986,7 @@  discard block
 block discarded – undo
986 986
 	 *
987 987
 	 * @return array                Array of post data to return back in the API
988 988
 	 */
989
-	private function get_form_data( $form_info ) {
989
+	private function get_form_data($form_info) {
990 990
 
991 991
 		$form = array();
992 992
 
@@ -996,45 +996,45 @@  discard block
 block discarded – undo
996 996
 		$form['info']['create_date']   = $form_info->post_date;
997 997
 		$form['info']['modified_date'] = $form_info->post_modified;
998 998
 		$form['info']['status']        = $form_info->post_status;
999
-		$form['info']['link']          = html_entity_decode( $form_info->guid );
1000
-		$form['info']['content']       = get_post_meta( $form_info->ID, '_give_form_content', true );
1001
-		$form['info']['thumbnail']     = wp_get_attachment_url( get_post_thumbnail_id( $form_info->ID ) );
999
+		$form['info']['link']          = html_entity_decode($form_info->guid);
1000
+		$form['info']['content']       = get_post_meta($form_info->ID, '_give_form_content', true);
1001
+		$form['info']['thumbnail']     = wp_get_attachment_url(get_post_thumbnail_id($form_info->ID));
1002 1002
 
1003
-		if ( give_get_option( 'enable_categories' ) == 'on' ) {
1004
-			$form['info']['category'] = get_the_terms( $form_info, 'give_forms_category' );
1005
-			$form['info']['tags']     = get_the_terms( $form_info, 'give_forms_tag' );
1003
+		if (give_get_option('enable_categories') == 'on') {
1004
+			$form['info']['category'] = get_the_terms($form_info, 'give_forms_category');
1005
+			$form['info']['tags']     = get_the_terms($form_info, 'give_forms_tag');
1006 1006
 		}
1007
-		if ( give_get_option( 'enable_tags' ) == 'on' ) {
1008
-			$form['info']['tags'] = get_the_terms( $form_info, 'give_forms_tag' );
1007
+		if (give_get_option('enable_tags') == 'on') {
1008
+			$form['info']['tags'] = get_the_terms($form_info, 'give_forms_tag');
1009 1009
 		}
1010 1010
 
1011
-		if ( user_can( $this->user_id, 'view_give_reports' ) || $this->override ) {
1012
-			$form['stats']['total']['donations']           = give_get_form_sales_stats( $form_info->ID );
1013
-			$form['stats']['total']['earnings']            = give_get_form_earnings_stats( $form_info->ID );
1014
-			$form['stats']['monthly_average']['donations'] = give_get_average_monthly_form_sales( $form_info->ID );
1015
-			$form['stats']['monthly_average']['earnings']  = give_get_average_monthly_form_earnings( $form_info->ID );
1011
+		if (user_can($this->user_id, 'view_give_reports') || $this->override) {
1012
+			$form['stats']['total']['donations']           = give_get_form_sales_stats($form_info->ID);
1013
+			$form['stats']['total']['earnings']            = give_get_form_earnings_stats($form_info->ID);
1014
+			$form['stats']['monthly_average']['donations'] = give_get_average_monthly_form_sales($form_info->ID);
1015
+			$form['stats']['monthly_average']['earnings']  = give_get_average_monthly_form_earnings($form_info->ID);
1016 1016
 		}
1017 1017
 
1018 1018
 		$counter = 0;
1019
-		if ( give_has_variable_prices( $form_info->ID ) ) {
1020
-			foreach ( give_get_variable_prices( $form_info->ID ) as $price ) {
1021
-				$counter ++;
1019
+		if (give_has_variable_prices($form_info->ID)) {
1020
+			foreach (give_get_variable_prices($form_info->ID) as $price) {
1021
+				$counter++;
1022 1022
 				//muli-level item
1023
-				$level = isset( $price['_give_text'] ) ? $price['_give_text'] : 'level-' . $counter;
1024
-				$form['pricing'][ sanitize_key( $level ) ] = $price['_give_amount'];
1023
+				$level = isset($price['_give_text']) ? $price['_give_text'] : 'level-'.$counter;
1024
+				$form['pricing'][sanitize_key($level)] = $price['_give_amount'];
1025 1025
 
1026 1026
 			}
1027 1027
 		} else {
1028
-			$form['pricing']['amount'] = give_get_form_price( $form_info->ID );
1028
+			$form['pricing']['amount'] = give_get_form_price($form_info->ID);
1029 1029
 		}
1030 1030
 
1031
-		if ( user_can( $this->user_id, 'view_give_sensitive_data' ) || $this->override ) {
1031
+		if (user_can($this->user_id, 'view_give_sensitive_data') || $this->override) {
1032 1032
 
1033 1033
 			//Sensitive data here
1034 1034
 
1035 1035
 		}
1036 1036
 
1037
-		return apply_filters( 'give_api_forms_form', $form );
1037
+		return apply_filters('give_api_forms_form', $form);
1038 1038
 		die();
1039 1039
 	}
1040 1040
 
@@ -1049,7 +1049,7 @@  discard block
 block discarded – undo
1049 1049
 	 *
1050 1050
 	 * @return array
1051 1051
 	 */
1052
-	public function get_stats( $args = array() ) {
1052
+	public function get_stats($args = array()) {
1053 1053
 		$defaults = array(
1054 1054
 			'type'      => null,
1055 1055
 			'form'      => null,
@@ -1058,9 +1058,9 @@  discard block
 block discarded – undo
1058 1058
 			'enddate'   => null
1059 1059
 		);
1060 1060
 
1061
-		$args = wp_parse_args( $args, $defaults );
1061
+		$args = wp_parse_args($args, $defaults);
1062 1062
 
1063
-		$dates = $this->get_dates( $args );
1063
+		$dates = $this->get_dates($args);
1064 1064
 
1065 1065
 		$stats     = array();
1066 1066
 		$earnings  = array(
@@ -1071,41 +1071,41 @@  discard block
 block discarded – undo
1071 1071
 		);
1072 1072
 		$error     = array();
1073 1073
 
1074
-		if ( ! user_can( $this->user_id, 'view_give_reports' ) && ! $this->override ) {
1074
+		if ( ! user_can($this->user_id, 'view_give_reports') && ! $this->override) {
1075 1075
 			return $stats;
1076 1076
 		}
1077 1077
 
1078
-		if ( $args['type'] == 'donations' ) {
1078
+		if ($args['type'] == 'donations') {
1079 1079
 
1080
-			if ( $args['form'] == null ) {
1081
-				if ( $args['date'] == null ) {
1080
+			if ($args['form'] == null) {
1081
+				if ($args['date'] == null) {
1082 1082
 					$sales = $this->get_default_sales_stats();
1083
-				} elseif ( $args['date'] === 'range' ) {
1083
+				} elseif ($args['date'] === 'range') {
1084 1084
 					// Return sales for a date range
1085 1085
 
1086 1086
 					// Ensure the end date is later than the start date
1087
-					if ( $args['enddate'] < $args['startdate'] ) {
1088
-						$error['error'] = __( 'The end date must be later than the start date!', 'give' );
1087
+					if ($args['enddate'] < $args['startdate']) {
1088
+						$error['error'] = __('The end date must be later than the start date!', 'give');
1089 1089
 					}
1090 1090
 
1091 1091
 					// Ensure both the start and end date are specified
1092
-					if ( empty( $args['startdate'] ) || empty( $args['enddate'] ) ) {
1093
-						$error['error'] = __( 'Invalid or no date range specified!', 'give' );
1092
+					if (empty($args['startdate']) || empty($args['enddate'])) {
1093
+						$error['error'] = __('Invalid or no date range specified!', 'give');
1094 1094
 					}
1095 1095
 
1096 1096
 					$total = 0;
1097 1097
 
1098 1098
 					// Loop through the years
1099 1099
 					$y = $dates['year'];
1100
-					while ( $y <= $dates['year_end'] ) :
1100
+					while ($y <= $dates['year_end']) :
1101 1101
 
1102
-						if ( $dates['year'] == $dates['year_end'] ) {
1102
+						if ($dates['year'] == $dates['year_end']) {
1103 1103
 							$month_start = $dates['m_start'];
1104 1104
 							$month_end   = $dates['m_end'];
1105
-						} elseif ( $y == $dates['year'] && $dates['year_end'] > $dates['year'] ) {
1105
+						} elseif ($y == $dates['year'] && $dates['year_end'] > $dates['year']) {
1106 1106
 							$month_start = $dates['m_start'];
1107 1107
 							$month_end   = 12;
1108
-						} elseif ( $y == $dates['year_end'] ) {
1108
+						} elseif ($y == $dates['year_end']) {
1109 1109
 							$month_start = 1;
1110 1110
 							$month_end   = $dates['m_end'];
1111 1111
 						} else {
@@ -1114,109 +1114,109 @@  discard block
 block discarded – undo
1114 1114
 						}
1115 1115
 
1116 1116
 						$i = $month_start;
1117
-						while ( $i <= $month_end ) :
1117
+						while ($i <= $month_end) :
1118 1118
 
1119
-							if ( $i == $dates['m_start'] ) {
1119
+							if ($i == $dates['m_start']) {
1120 1120
 								$d = $dates['day_start'];
1121 1121
 							} else {
1122 1122
 								$d = 1;
1123 1123
 							}
1124 1124
 
1125
-							if ( $i == $dates['m_end'] ) {
1125
+							if ($i == $dates['m_end']) {
1126 1126
 								$num_of_days = $dates['day_end'];
1127 1127
 							} else {
1128
-								$num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y );
1128
+								$num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y);
1129 1129
 							}
1130 1130
 
1131
-							while ( $d <= $num_of_days ) :
1132
-								$sale_count = give_get_sales_by_date( $d, $i, $y );
1133
-								$date_key   = date( 'Ymd', strtotime( $y . '/' . $i . '/' . $d ) );
1134
-								if ( ! isset( $sales['sales'][ $date_key ] ) ) {
1135
-									$sales['sales'][ $date_key ] = 0;
1131
+							while ($d <= $num_of_days) :
1132
+								$sale_count = give_get_sales_by_date($d, $i, $y);
1133
+								$date_key   = date('Ymd', strtotime($y.'/'.$i.'/'.$d));
1134
+								if ( ! isset($sales['sales'][$date_key])) {
1135
+									$sales['sales'][$date_key] = 0;
1136 1136
 								}
1137
-								$sales['sales'][ $date_key ] += $sale_count;
1137
+								$sales['sales'][$date_key] += $sale_count;
1138 1138
 								$total += $sale_count;
1139
-								$d ++;
1139
+								$d++;
1140 1140
 							endwhile;
1141
-							$i ++;
1141
+							$i++;
1142 1142
 						endwhile;
1143 1143
 
1144
-						$y ++;
1144
+						$y++;
1145 1145
 					endwhile;
1146 1146
 
1147 1147
 					$sales['totals'] = $total;
1148 1148
 				} else {
1149
-					if ( $args['date'] == 'this_quarter' || $args['date'] == 'last_quarter' ) {
1149
+					if ($args['date'] == 'this_quarter' || $args['date'] == 'last_quarter') {
1150 1150
 						$sales_count = 0;
1151 1151
 
1152 1152
 						// Loop through the months
1153 1153
 						$month = $dates['m_start'];
1154 1154
 
1155
-						while ( $month <= $dates['m_end'] ) :
1156
-							$sales_count += give_get_sales_by_date( null, $month, $dates['year'] );
1157
-							$month ++;
1155
+						while ($month <= $dates['m_end']) :
1156
+							$sales_count += give_get_sales_by_date(null, $month, $dates['year']);
1157
+							$month++;
1158 1158
 						endwhile;
1159 1159
 
1160
-						$sales['donations'][ $args['date'] ] = $sales_count;
1160
+						$sales['donations'][$args['date']] = $sales_count;
1161 1161
 					} else {
1162
-						$sales['donations'][ $args['date'] ] = give_get_sales_by_date( $dates['day'], $dates['m_start'], $dates['year'] );
1162
+						$sales['donations'][$args['date']] = give_get_sales_by_date($dates['day'], $dates['m_start'], $dates['year']);
1163 1163
 					}
1164 1164
 				}
1165
-			} elseif ( $args['form'] == 'all' ) {
1166
-				$forms = get_posts( array( 'post_type' => 'give_forms', 'nopaging' => true ) );
1165
+			} elseif ($args['form'] == 'all') {
1166
+				$forms = get_posts(array('post_type' => 'give_forms', 'nopaging' => true));
1167 1167
 				$i     = 0;
1168
-				foreach ( $forms as $form_info ) {
1169
-					$sales['donations'][ $i ] = array( $form_info->post_name => give_get_form_sales_stats( $form_info->ID ) );
1170
-					$i ++;
1168
+				foreach ($forms as $form_info) {
1169
+					$sales['donations'][$i] = array($form_info->post_name => give_get_form_sales_stats($form_info->ID));
1170
+					$i++;
1171 1171
 				}
1172 1172
 			} else {
1173
-				if ( get_post_type( $args['form'] ) == 'give_forms' ) {
1174
-					$form_info             = get_post( $args['form'] );
1175
-					$sales['donations'][0] = array( $form_info->post_name => give_get_form_sales_stats( $args['form'] ) );
1173
+				if (get_post_type($args['form']) == 'give_forms') {
1174
+					$form_info             = get_post($args['form']);
1175
+					$sales['donations'][0] = array($form_info->post_name => give_get_form_sales_stats($args['form']));
1176 1176
 				} else {
1177
-					$error['error'] = sprintf( __( 'Product %s not found!', 'give' ), $args['form'] );
1177
+					$error['error'] = sprintf(__('Product %s not found!', 'give'), $args['form']);
1178 1178
 				}
1179 1179
 			}
1180 1180
 
1181
-			if ( ! empty( $error ) ) {
1181
+			if ( ! empty($error)) {
1182 1182
 				return $error;
1183 1183
 			}
1184 1184
 
1185 1185
 			return $sales;
1186 1186
 
1187
-		} elseif ( $args['type'] == 'earnings' ) {
1188
-			if ( $args['form'] == null ) {
1189
-				if ( $args['date'] == null ) {
1187
+		} elseif ($args['type'] == 'earnings') {
1188
+			if ($args['form'] == null) {
1189
+				if ($args['date'] == null) {
1190 1190
 					$earnings = $this->get_default_earnings_stats();
1191
-				} elseif ( $args['date'] === 'range' ) {
1191
+				} elseif ($args['date'] === 'range') {
1192 1192
 					// Return sales for a date range
1193 1193
 
1194 1194
 					// Ensure the end date is later than the start date
1195
-					if ( $args['enddate'] < $args['startdate'] ) {
1196
-						$error['error'] = __( 'The end date must be later than the start date!', 'give' );
1195
+					if ($args['enddate'] < $args['startdate']) {
1196
+						$error['error'] = __('The end date must be later than the start date!', 'give');
1197 1197
 					}
1198 1198
 
1199 1199
 					// Ensure both the start and end date are specified
1200
-					if ( empty( $args['startdate'] ) || empty( $args['enddate'] ) ) {
1201
-						$error['error'] = __( 'Invalid or no date range specified!', 'give' );
1200
+					if (empty($args['startdate']) || empty($args['enddate'])) {
1201
+						$error['error'] = __('Invalid or no date range specified!', 'give');
1202 1202
 					}
1203 1203
 
1204 1204
 					$total = (float) 0.00;
1205 1205
 
1206 1206
 					// Loop through the years
1207 1207
 					$y = $dates['year'];
1208
-					if ( ! isset( $earnings['earnings'] ) ) {
1208
+					if ( ! isset($earnings['earnings'])) {
1209 1209
 						$earnings['earnings'] = array();
1210 1210
 					}
1211
-					while ( $y <= $dates['year_end'] ) :
1211
+					while ($y <= $dates['year_end']) :
1212 1212
 
1213
-						if ( $dates['year'] == $dates['year_end'] ) {
1213
+						if ($dates['year'] == $dates['year_end']) {
1214 1214
 							$month_start = $dates['m_start'];
1215 1215
 							$month_end   = $dates['m_end'];
1216
-						} elseif ( $y == $dates['year'] && $dates['year_end'] > $dates['year'] ) {
1216
+						} elseif ($y == $dates['year'] && $dates['year_end'] > $dates['year']) {
1217 1217
 							$month_start = $dates['m_start'];
1218 1218
 							$month_end   = 12;
1219
-						} elseif ( $y == $dates['year_end'] ) {
1219
+						} elseif ($y == $dates['year_end']) {
1220 1220
 							$month_start = 1;
1221 1221
 							$month_end   = $dates['m_end'];
1222 1222
 						} else {
@@ -1225,88 +1225,88 @@  discard block
 block discarded – undo
1225 1225
 						}
1226 1226
 
1227 1227
 						$i = $month_start;
1228
-						while ( $i <= $month_end ) :
1228
+						while ($i <= $month_end) :
1229 1229
 
1230
-							if ( $i == $dates['m_start'] ) {
1230
+							if ($i == $dates['m_start']) {
1231 1231
 								$d = $dates['day_start'];
1232 1232
 							} else {
1233 1233
 								$d = 1;
1234 1234
 							}
1235 1235
 
1236
-							if ( $i == $dates['m_end'] ) {
1236
+							if ($i == $dates['m_end']) {
1237 1237
 								$num_of_days = $dates['day_end'];
1238 1238
 							} else {
1239
-								$num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y );
1239
+								$num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y);
1240 1240
 							}
1241 1241
 
1242
-							while ( $d <= $num_of_days ) :
1243
-								$earnings_stat = give_get_earnings_by_date( $d, $i, $y );
1244
-								$date_key      = date( 'Ymd', strtotime( $y . '/' . $i . '/' . $d ) );
1245
-								if ( ! isset( $earnings['earnings'][ $date_key ] ) ) {
1246
-									$earnings['earnings'][ $date_key ] = 0;
1242
+							while ($d <= $num_of_days) :
1243
+								$earnings_stat = give_get_earnings_by_date($d, $i, $y);
1244
+								$date_key      = date('Ymd', strtotime($y.'/'.$i.'/'.$d));
1245
+								if ( ! isset($earnings['earnings'][$date_key])) {
1246
+									$earnings['earnings'][$date_key] = 0;
1247 1247
 								}
1248
-								$earnings['earnings'][ $date_key ] += $earnings_stat;
1248
+								$earnings['earnings'][$date_key] += $earnings_stat;
1249 1249
 								$total += $earnings_stat;
1250
-								$d ++;
1250
+								$d++;
1251 1251
 							endwhile;
1252 1252
 
1253
-							$i ++;
1253
+							$i++;
1254 1254
 						endwhile;
1255 1255
 
1256
-						$y ++;
1256
+						$y++;
1257 1257
 					endwhile;
1258 1258
 
1259 1259
 					$earnings['totals'] = $total;
1260 1260
 				} else {
1261
-					if ( $args['date'] == 'this_quarter' || $args['date'] == 'last_quarter' ) {
1261
+					if ($args['date'] == 'this_quarter' || $args['date'] == 'last_quarter') {
1262 1262
 						$earnings_count = (float) 0.00;
1263 1263
 
1264 1264
 						// Loop through the months
1265 1265
 						$month = $dates['m_start'];
1266 1266
 
1267
-						while ( $month <= $dates['m_end'] ) :
1268
-							$earnings_count += give_get_earnings_by_date( null, $month, $dates['year'] );
1269
-							$month ++;
1267
+						while ($month <= $dates['m_end']) :
1268
+							$earnings_count += give_get_earnings_by_date(null, $month, $dates['year']);
1269
+							$month++;
1270 1270
 						endwhile;
1271 1271
 
1272
-						$earnings['earnings'][ $args['date'] ] = $earnings_count;
1272
+						$earnings['earnings'][$args['date']] = $earnings_count;
1273 1273
 					} else {
1274
-						$earnings['earnings'][ $args['date'] ] = give_get_earnings_by_date( $dates['day'], $dates['m_start'], $dates['year'] );
1274
+						$earnings['earnings'][$args['date']] = give_get_earnings_by_date($dates['day'], $dates['m_start'], $dates['year']);
1275 1275
 					}
1276 1276
 				}
1277
-			} elseif ( $args['form'] == 'all' ) {
1278
-				$forms = get_posts( array( 'post_type' => 'give_forms', 'nopaging' => true ) );
1277
+			} elseif ($args['form'] == 'all') {
1278
+				$forms = get_posts(array('post_type' => 'give_forms', 'nopaging' => true));
1279 1279
 
1280 1280
 				$i = 0;
1281
-				foreach ( $forms as $form_info ) {
1282
-					$earnings['earnings'][ $i ] = array( $form_info->post_name => give_get_form_earnings_stats( $form_info->ID ) );
1283
-					$i ++;
1281
+				foreach ($forms as $form_info) {
1282
+					$earnings['earnings'][$i] = array($form_info->post_name => give_get_form_earnings_stats($form_info->ID));
1283
+					$i++;
1284 1284
 				}
1285 1285
 			} else {
1286
-				if ( get_post_type( $args['form'] ) == 'give_forms' ) {
1287
-					$form_info               = get_post( $args['form'] );
1288
-					$earnings['earnings'][0] = array( $form_info->post_name => give_get_form_earnings_stats( $args['form'] ) );
1286
+				if (get_post_type($args['form']) == 'give_forms') {
1287
+					$form_info               = get_post($args['form']);
1288
+					$earnings['earnings'][0] = array($form_info->post_name => give_get_form_earnings_stats($args['form']));
1289 1289
 				} else {
1290
-					$error['error'] = sprintf( __( 'Form %s not found!', 'give' ), $args['form'] );
1290
+					$error['error'] = sprintf(__('Form %s not found!', 'give'), $args['form']);
1291 1291
 				}
1292 1292
 			}
1293 1293
 
1294
-			if ( ! empty( $error ) ) {
1294
+			if ( ! empty($error)) {
1295 1295
 				return $error;
1296 1296
 			}
1297 1297
 
1298 1298
 			return $earnings;
1299
-		} elseif ( $args['type'] == 'donors' ) {
1299
+		} elseif ($args['type'] == 'donors') {
1300 1300
 			$customers                          = new Give_DB_Customers();
1301 1301
 			$stats['donations']['total_donors'] = $customers->count();
1302 1302
 
1303 1303
 			return $stats;
1304 1304
 
1305
-		} elseif ( empty( $args['type'] ) ) {
1306
-			$stats = array_merge( $stats, $this->get_default_sales_stats() );
1307
-			$stats = array_merge( $stats, $this->get_default_earnings_stats() );
1305
+		} elseif (empty($args['type'])) {
1306
+			$stats = array_merge($stats, $this->get_default_sales_stats());
1307
+			$stats = array_merge($stats, $this->get_default_earnings_stats());
1308 1308
 
1309
-			return array( 'stats' => $stats );
1309
+			return array('stats' => $stats);
1310 1310
 		}
1311 1311
 	}
1312 1312
 
@@ -1322,71 +1322,71 @@  discard block
 block discarded – undo
1322 1322
 
1323 1323
 		$sales = array();
1324 1324
 
1325
-		if ( ! user_can( $this->user_id, 'view_give_reports' ) && ! $this->override ) {
1325
+		if ( ! user_can($this->user_id, 'view_give_reports') && ! $this->override) {
1326 1326
 			return $sales;
1327 1327
 		}
1328 1328
 
1329
-		if ( isset( $wp_query->query_vars['id'] ) ) {
1329
+		if (isset($wp_query->query_vars['id'])) {
1330 1330
 			$query   = array();
1331
-			$query[] = give_get_payment_by( 'id', $wp_query->query_vars['id'] );
1332
-		} elseif ( isset( $wp_query->query_vars['purchasekey'] ) ) {
1331
+			$query[] = give_get_payment_by('id', $wp_query->query_vars['id']);
1332
+		} elseif (isset($wp_query->query_vars['purchasekey'])) {
1333 1333
 			$query   = array();
1334
-			$query[] = give_get_payment_by( 'key', $wp_query->query_vars['purchasekey'] );
1335
-		} elseif ( isset( $wp_query->query_vars['email'] ) ) {
1336
-			$query = give_get_payments( array(
1334
+			$query[] = give_get_payment_by('key', $wp_query->query_vars['purchasekey']);
1335
+		} elseif (isset($wp_query->query_vars['email'])) {
1336
+			$query = give_get_payments(array(
1337 1337
 				'meta_key'   => '_give_payment_user_email',
1338 1338
 				'meta_value' => $wp_query->query_vars['email'],
1339 1339
 				'number'     => $this->per_page(),
1340 1340
 				'page'       => $this->get_paged(),
1341 1341
 				'status'     => 'publish'
1342
-			) );
1342
+			));
1343 1343
 		} else {
1344
-			$query = give_get_payments( array(
1344
+			$query = give_get_payments(array(
1345 1345
 				'number' => $this->per_page(),
1346 1346
 				'page'   => $this->get_paged(),
1347 1347
 				'status' => 'publish'
1348
-			) );
1348
+			));
1349 1349
 		}
1350 1350
 
1351
-		if ( $query ) {
1351
+		if ($query) {
1352 1352
 			$i = 0;
1353
-			foreach ( $query as $payment ) {
1354
-				$payment_meta = give_get_payment_meta( $payment->ID );
1355
-				$user_info    = give_get_payment_meta_user_info( $payment->ID );
1356
-				$first_name   = isset( $user_info['first_name'] ) ? $user_info['first_name'] : '';
1357
-				$last_name    = isset( $user_info['last_name'] ) ? $user_info['last_name'] : '';
1358
-
1359
-				$sales['donations'][ $i ]['ID']             = give_get_payment_number( $payment->ID );
1360
-				$sales['donations'][ $i ]['transaction_id'] = give_get_payment_transaction_id( $payment->ID );
1361
-				$sales['donations'][ $i ]['key']            = give_get_payment_key( $payment->ID );
1362
-				$sales['donations'][ $i ]['total']          = give_get_payment_amount( $payment->ID );
1363
-				$sales['donations'][ $i ]['gateway']        = give_get_payment_gateway( $payment->ID );
1364
-				$sales['donations'][ $i ]['name']           = $first_name . ' ' . $last_name;
1365
-				$sales['donations'][ $i ]['fname']          = $first_name;
1366
-				$sales['donations'][ $i ]['lname']          = $last_name;
1367
-				$sales['donations'][ $i ]['email']          = give_get_payment_user_email( $payment->ID );
1368
-				$sales['donations'][ $i ]['date']           = $payment->post_date;
1369
-
1370
-				$form_id  = isset( $payment_meta['form_id'] ) ? $payment_meta['form_id'] : $payment_meta;
1371
-				$price    = isset( $payment_meta['form_id'] ) ? give_get_form_price( $payment_meta['form_id'] ) : false;
1372
-				$price_id = isset( $payment_meta['price_id'] ) ? $payment_meta['price_id'] : null;
1373
-
1374
-				$sales['donations'][ $i ]['form']['id']    = $form_id;
1375
-				$sales['donations'][ $i ]['form']['name']  = get_the_title( $payment_meta['form_id'] );
1376
-				$sales['donations'][ $i ]['form']['price'] = $price;
1377
-
1378
-				if ( give_has_variable_prices( $form_id ) ) {
1379
-					if ( isset( $payment_meta['price_id'] ) ) {
1380
-						$price_name                                     = give_get_price_option_name( $form_id, $payment_meta['price_id'], $payment->ID );
1381
-						$sales['donations'][ $i ]['form']['price_name'] = $price_name;
1382
-						$sales['donations'][ $i ]['form']['price_id']   = $price_id;
1383
-						$sales['donations'][ $i ]['form']['price']      = give_get_price_option_amount( $form_id, $price_id );
1353
+			foreach ($query as $payment) {
1354
+				$payment_meta = give_get_payment_meta($payment->ID);
1355
+				$user_info    = give_get_payment_meta_user_info($payment->ID);
1356
+				$first_name   = isset($user_info['first_name']) ? $user_info['first_name'] : '';
1357
+				$last_name    = isset($user_info['last_name']) ? $user_info['last_name'] : '';
1358
+
1359
+				$sales['donations'][$i]['ID']             = give_get_payment_number($payment->ID);
1360
+				$sales['donations'][$i]['transaction_id'] = give_get_payment_transaction_id($payment->ID);
1361
+				$sales['donations'][$i]['key']            = give_get_payment_key($payment->ID);
1362
+				$sales['donations'][$i]['total']          = give_get_payment_amount($payment->ID);
1363
+				$sales['donations'][$i]['gateway']        = give_get_payment_gateway($payment->ID);
1364
+				$sales['donations'][$i]['name']           = $first_name.' '.$last_name;
1365
+				$sales['donations'][$i]['fname']          = $first_name;
1366
+				$sales['donations'][$i]['lname']          = $last_name;
1367
+				$sales['donations'][$i]['email']          = give_get_payment_user_email($payment->ID);
1368
+				$sales['donations'][$i]['date']           = $payment->post_date;
1369
+
1370
+				$form_id  = isset($payment_meta['form_id']) ? $payment_meta['form_id'] : $payment_meta;
1371
+				$price    = isset($payment_meta['form_id']) ? give_get_form_price($payment_meta['form_id']) : false;
1372
+				$price_id = isset($payment_meta['price_id']) ? $payment_meta['price_id'] : null;
1373
+
1374
+				$sales['donations'][$i]['form']['id']    = $form_id;
1375
+				$sales['donations'][$i]['form']['name']  = get_the_title($payment_meta['form_id']);
1376
+				$sales['donations'][$i]['form']['price'] = $price;
1377
+
1378
+				if (give_has_variable_prices($form_id)) {
1379
+					if (isset($payment_meta['price_id'])) {
1380
+						$price_name                                     = give_get_price_option_name($form_id, $payment_meta['price_id'], $payment->ID);
1381
+						$sales['donations'][$i]['form']['price_name'] = $price_name;
1382
+						$sales['donations'][$i]['form']['price_id']   = $price_id;
1383
+						$sales['donations'][$i]['form']['price']      = give_get_price_option_amount($form_id, $price_id);
1384 1384
 
1385 1385
 					}
1386 1386
 				}
1387 1387
 
1388 1388
 				//Add custom meta to API
1389
-				foreach ( $payment_meta as $meta_key => $meta_value ) {
1389
+				foreach ($payment_meta as $meta_key => $meta_value) {
1390 1390
 
1391 1391
 					$exceptions = array(
1392 1392
 						'form_title',
@@ -1399,19 +1399,19 @@  discard block
 block discarded – undo
1399 1399
 					);
1400 1400
 
1401 1401
 					//Don't clutter up results with dupes
1402
-					if ( in_array( $meta_key, $exceptions ) ) {
1402
+					if (in_array($meta_key, $exceptions)) {
1403 1403
 						continue;
1404 1404
 					}
1405 1405
 
1406
-					$sales['donations'][ $i ]['payment_meta'][ $meta_key ] = $meta_value;
1406
+					$sales['donations'][$i]['payment_meta'][$meta_key] = $meta_value;
1407 1407
 
1408 1408
 				}
1409 1409
 
1410
-				$i ++;
1410
+				$i++;
1411 1411
 			}
1412 1412
 		}
1413 1413
 
1414
-		return apply_filters( 'give_api_donations_endpoint', $sales );
1414
+		return apply_filters('give_api_donations_endpoint', $sales);
1415 1415
 	}
1416 1416
 
1417 1417
 	/**
@@ -1426,9 +1426,9 @@  discard block
 block discarded – undo
1426 1426
 	public function get_output_format() {
1427 1427
 		global $wp_query;
1428 1428
 
1429
-		$format = isset( $wp_query->query_vars['format'] ) ? $wp_query->query_vars['format'] : 'json';
1429
+		$format = isset($wp_query->query_vars['format']) ? $wp_query->query_vars['format'] : 'json';
1430 1430
 
1431
-		return apply_filters( 'give_api_output_format', $format );
1431
+		return apply_filters('give_api_output_format', $format);
1432 1432
 	}
1433 1433
 
1434 1434
 
@@ -1444,8 +1444,8 @@  discard block
 block discarded – undo
1444 1444
 	 *
1445 1445
 	 * @return void
1446 1446
 	 */
1447
-	private function log_request( $data = array() ) {
1448
-		if ( ! $this->log_requests ) {
1447
+	private function log_request($data = array()) {
1448
+		if ( ! $this->log_requests) {
1449 1449
 			return;
1450 1450
 		}
1451 1451
 
@@ -1453,36 +1453,36 @@  discard block
 block discarded – undo
1453 1453
 
1454 1454
 		$query = array(
1455 1455
 			'give-api'    => $wp_query->query_vars['give-api'],
1456
-			'key'         => isset( $wp_query->query_vars['key'] ) ? $wp_query->query_vars['key'] : null,
1457
-			'token'       => isset( $wp_query->query_vars['token'] ) ? $wp_query->query_vars['token'] : null,
1458
-			'query'       => isset( $wp_query->query_vars['query'] ) ? $wp_query->query_vars['query'] : null,
1459
-			'type'        => isset( $wp_query->query_vars['type'] ) ? $wp_query->query_vars['type'] : null,
1460
-			'form'        => isset( $wp_query->query_vars['form'] ) ? $wp_query->query_vars['form'] : null,
1461
-			'customer'    => isset( $wp_query->query_vars['customer'] ) ? $wp_query->query_vars['customer'] : null,
1462
-			'date'        => isset( $wp_query->query_vars['date'] ) ? $wp_query->query_vars['date'] : null,
1463
-			'startdate'   => isset( $wp_query->query_vars['startdate'] ) ? $wp_query->query_vars['startdate'] : null,
1464
-			'enddate'     => isset( $wp_query->query_vars['enddate'] ) ? $wp_query->query_vars['enddate'] : null,
1465
-			'id'          => isset( $wp_query->query_vars['id'] ) ? $wp_query->query_vars['id'] : null,
1466
-			'purchasekey' => isset( $wp_query->query_vars['purchasekey'] ) ? $wp_query->query_vars['purchasekey'] : null,
1467
-			'email'       => isset( $wp_query->query_vars['email'] ) ? $wp_query->query_vars['email'] : null,
1456
+			'key'         => isset($wp_query->query_vars['key']) ? $wp_query->query_vars['key'] : null,
1457
+			'token'       => isset($wp_query->query_vars['token']) ? $wp_query->query_vars['token'] : null,
1458
+			'query'       => isset($wp_query->query_vars['query']) ? $wp_query->query_vars['query'] : null,
1459
+			'type'        => isset($wp_query->query_vars['type']) ? $wp_query->query_vars['type'] : null,
1460
+			'form'        => isset($wp_query->query_vars['form']) ? $wp_query->query_vars['form'] : null,
1461
+			'customer'    => isset($wp_query->query_vars['customer']) ? $wp_query->query_vars['customer'] : null,
1462
+			'date'        => isset($wp_query->query_vars['date']) ? $wp_query->query_vars['date'] : null,
1463
+			'startdate'   => isset($wp_query->query_vars['startdate']) ? $wp_query->query_vars['startdate'] : null,
1464
+			'enddate'     => isset($wp_query->query_vars['enddate']) ? $wp_query->query_vars['enddate'] : null,
1465
+			'id'          => isset($wp_query->query_vars['id']) ? $wp_query->query_vars['id'] : null,
1466
+			'purchasekey' => isset($wp_query->query_vars['purchasekey']) ? $wp_query->query_vars['purchasekey'] : null,
1467
+			'email'       => isset($wp_query->query_vars['email']) ? $wp_query->query_vars['email'] : null,
1468 1468
 		);
1469 1469
 
1470 1470
 		$log_data = array(
1471 1471
 			'log_type'     => 'api_request',
1472
-			'post_excerpt' => http_build_query( $query ),
1473
-			'post_content' => ! empty( $data['error'] ) ? $data['error'] : '',
1472
+			'post_excerpt' => http_build_query($query),
1473
+			'post_content' => ! empty($data['error']) ? $data['error'] : '',
1474 1474
 		);
1475 1475
 
1476 1476
 		$log_meta = array(
1477 1477
 			'request_ip' => give_get_ip(),
1478 1478
 			'user'       => $this->user_id,
1479
-			'key'        => isset( $wp_query->query_vars['key'] ) ? $wp_query->query_vars['key'] : null,
1480
-			'token'      => isset( $wp_query->query_vars['token'] ) ? $wp_query->query_vars['token'] : null,
1479
+			'key'        => isset($wp_query->query_vars['key']) ? $wp_query->query_vars['key'] : null,
1480
+			'token'      => isset($wp_query->query_vars['token']) ? $wp_query->query_vars['token'] : null,
1481 1481
 			'time'       => $data['request_speed'],
1482 1482
 			'version'    => $this->get_queried_version()
1483 1483
 		);
1484 1484
 
1485
-		$give_logs->insert_log( $log_data, $log_meta );
1485
+		$give_logs->insert_log($log_data, $log_meta);
1486 1486
 	}
1487 1487
 
1488 1488
 
@@ -1506,32 +1506,32 @@  discard block
 block discarded – undo
1506 1506
 	 *
1507 1507
 	 * @param int $status_code
1508 1508
 	 */
1509
-	public function output( $status_code = 200 ) {
1509
+	public function output($status_code = 200) {
1510 1510
 		global $wp_query;
1511 1511
 
1512 1512
 		$format = $this->get_output_format();
1513 1513
 
1514
-		status_header( $status_code );
1514
+		status_header($status_code);
1515 1515
 
1516
-		do_action( 'give_api_output_before', $this->data, $this, $format );
1516
+		do_action('give_api_output_before', $this->data, $this, $format);
1517 1517
 
1518
-		switch ( $format ) :
1518
+		switch ($format) :
1519 1519
 
1520 1520
 			case 'xml' :
1521 1521
 
1522
-				require_once GIVE_PLUGIN_DIR . 'includes/libraries/array2xml.php';
1523
-				$xml = Array2XML::createXML( 'give', $this->data );
1522
+				require_once GIVE_PLUGIN_DIR.'includes/libraries/array2xml.php';
1523
+				$xml = Array2XML::createXML('give', $this->data);
1524 1524
 				echo $xml->saveXML();
1525 1525
 
1526 1526
 				break;
1527 1527
 
1528 1528
 			case 'json' :
1529 1529
 
1530
-				header( 'Content-Type: application/json' );
1531
-				if ( ! empty( $this->pretty_print ) ) {
1532
-					echo json_encode( $this->data, $this->pretty_print );
1530
+				header('Content-Type: application/json');
1531
+				if ( ! empty($this->pretty_print)) {
1532
+					echo json_encode($this->data, $this->pretty_print);
1533 1533
 				} else {
1534
-					echo json_encode( $this->data );
1534
+					echo json_encode($this->data);
1535 1535
 				}
1536 1536
 
1537 1537
 				break;
@@ -1540,13 +1540,13 @@  discard block
 block discarded – undo
1540 1540
 			default :
1541 1541
 
1542 1542
 				// Allow other formats to be added via extensions
1543
-				do_action( 'give_api_output_' . $format, $this->data, $this );
1543
+				do_action('give_api_output_'.$format, $this->data, $this);
1544 1544
 
1545 1545
 				break;
1546 1546
 
1547 1547
 		endswitch;
1548 1548
 
1549
-		do_action( 'give_api_output_after', $this->data, $this, $format );
1549
+		do_action('give_api_output_after', $this->data, $this, $format);
1550 1550
 
1551 1551
 		give_die();
1552 1552
 	}
@@ -1563,36 +1563,36 @@  discard block
 block discarded – undo
1563 1563
 	 *
1564 1564
 	 * @return void
1565 1565
 	 */
1566
-	function user_key_field( $user ) {
1567
-		if ( ( give_get_option( 'api_allow_user_keys', false ) || current_user_can( 'manage_give_settings' ) ) && current_user_can( 'edit_user', $user->ID ) ) {
1568
-			$user = get_userdata( $user->ID );
1566
+	function user_key_field($user) {
1567
+		if ((give_get_option('api_allow_user_keys', false) || current_user_can('manage_give_settings')) && current_user_can('edit_user', $user->ID)) {
1568
+			$user = get_userdata($user->ID);
1569 1569
 			?>
1570 1570
 			<table class="form-table">
1571 1571
 				<tbody>
1572 1572
 				<tr>
1573 1573
 					<th>
1574
-						<?php _e( 'Give API Keys', 'give' ); ?>
1574
+						<?php _e('Give API Keys', 'give'); ?>
1575 1575
 					</th>
1576 1576
 					<td>
1577 1577
 						<?php
1578
-						$public_key = $this->get_user_public_key( $user->ID );
1579
-						$secret_key = $this->get_user_secret_key( $user->ID );
1578
+						$public_key = $this->get_user_public_key($user->ID);
1579
+						$secret_key = $this->get_user_secret_key($user->ID);
1580 1580
 						?>
1581
-						<?php if ( empty( $user->give_user_public_key ) ) { ?>
1581
+						<?php if (empty($user->give_user_public_key)) { ?>
1582 1582
 							<input name="give_set_api_key" type="checkbox" id="give_set_api_key" value="0" />
1583
-							<span class="description"><?php _e( 'Generate API Key', 'give' ); ?></span>
1583
+							<span class="description"><?php _e('Generate API Key', 'give'); ?></span>
1584 1584
 						<?php } else { ?>
1585
-							<strong style="display:inline-block; width: 125px;"><?php _e( 'Public key:', 'give' ); ?>&nbsp;</strong>
1586
-							<input type="text" disabled="disabled" class="regular-text" id="publickey" value="<?php echo esc_attr( $public_key ); ?>" />
1585
+							<strong style="display:inline-block; width: 125px;"><?php _e('Public key:', 'give'); ?>&nbsp;</strong>
1586
+							<input type="text" disabled="disabled" class="regular-text" id="publickey" value="<?php echo esc_attr($public_key); ?>" />
1587 1587
 							<br />
1588
-							<strong style="display:inline-block; width: 125px;"><?php _e( 'Secret key:', 'give' ); ?>&nbsp;</strong>
1589
-							<input type="text" disabled="disabled" class="regular-text" id="privatekey" value="<?php echo esc_attr( $secret_key ); ?>" />
1588
+							<strong style="display:inline-block; width: 125px;"><?php _e('Secret key:', 'give'); ?>&nbsp;</strong>
1589
+							<input type="text" disabled="disabled" class="regular-text" id="privatekey" value="<?php echo esc_attr($secret_key); ?>" />
1590 1590
 							<br />
1591
-							<strong style="display:inline-block; width: 125px;"><?php _e( 'Token:', 'give' ); ?>&nbsp;</strong>
1592
-							<input type="text" disabled="disabled" class="regular-text" id="token" value="<?php echo esc_attr( $this->get_token( $user->ID ) ); ?>" />
1591
+							<strong style="display:inline-block; width: 125px;"><?php _e('Token:', 'give'); ?>&nbsp;</strong>
1592
+							<input type="text" disabled="disabled" class="regular-text" id="token" value="<?php echo esc_attr($this->get_token($user->ID)); ?>" />
1593 1593
 							<br />
1594 1594
 							<input name="give_set_api_key" type="checkbox" id="give_set_api_key" value="0" />
1595
-							<span class="description"><label for="give_set_api_key"><?php _e( 'Revoke API Keys', 'give' ); ?></label></span>
1595
+							<span class="description"><label for="give_set_api_key"><?php _e('Revoke API Keys', 'give'); ?></label></span>
1596 1596
 						<?php } ?>
1597 1597
 					</td>
1598 1598
 				</tr>
@@ -1611,49 +1611,49 @@  discard block
 block discarded – undo
1611 1611
 	 *
1612 1612
 	 * @return void
1613 1613
 	 */
1614
-	public function process_api_key( $args ) {
1614
+	public function process_api_key($args) {
1615 1615
 
1616
-		if ( ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'give-api-nonce' ) ) {
1616
+		if ( ! wp_verify_nonce($_REQUEST['_wpnonce'], 'give-api-nonce')) {
1617 1617
 
1618
-			wp_die( __( 'Nonce verification failed', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
1618
+			wp_die(__('Nonce verification failed', 'give'), __('Error', 'give'), array('response' => 403));
1619 1619
 
1620 1620
 		}
1621 1621
 
1622
-		if ( is_numeric( $args['user_id'] ) ) {
1623
-			$user_id = isset( $args['user_id'] ) ? absint( $args['user_id'] ) : get_current_user_id();
1622
+		if (is_numeric($args['user_id'])) {
1623
+			$user_id = isset($args['user_id']) ? absint($args['user_id']) : get_current_user_id();
1624 1624
 		} else {
1625
-			$userdata = get_user_by( 'login', $args['user_id'] );
1625
+			$userdata = get_user_by('login', $args['user_id']);
1626 1626
 			$user_id  = $userdata->ID;
1627 1627
 		}
1628
-		$process = isset( $args['give_api_process'] ) ? strtolower( $args['give_api_process'] ) : false;
1628
+		$process = isset($args['give_api_process']) ? strtolower($args['give_api_process']) : false;
1629 1629
 
1630
-		if ( $user_id == get_current_user_id() && ! give_get_option( 'allow_user_api_keys' ) && ! current_user_can( 'manage_give_settings' ) ) {
1631
-			wp_die( sprintf( __( 'You do not have permission to %s API keys for this user', 'give' ), $process ), __( 'Error', 'give' ), array( 'response' => 403 ) );
1632
-		} elseif ( ! current_user_can( 'manage_give_settings' ) ) {
1633
-			wp_die( sprintf( __( 'You do not have permission to %s API keys for this user', 'give' ), $process ), __( 'Error', 'give' ), array( 'response' => 403 ) );
1630
+		if ($user_id == get_current_user_id() && ! give_get_option('allow_user_api_keys') && ! current_user_can('manage_give_settings')) {
1631
+			wp_die(sprintf(__('You do not have permission to %s API keys for this user', 'give'), $process), __('Error', 'give'), array('response' => 403));
1632
+		} elseif ( ! current_user_can('manage_give_settings')) {
1633
+			wp_die(sprintf(__('You do not have permission to %s API keys for this user', 'give'), $process), __('Error', 'give'), array('response' => 403));
1634 1634
 		}
1635 1635
 
1636
-		switch ( $process ) {
1636
+		switch ($process) {
1637 1637
 			case 'generate':
1638
-				if ( $this->generate_api_key( $user_id ) ) {
1639
-					delete_transient( 'give-total-api-keys' );
1640
-					wp_redirect( add_query_arg( 'give-message', 'api-key-generated', 'edit.php?post_type=give_forms&page=give-settings&tab=api' ) );
1638
+				if ($this->generate_api_key($user_id)) {
1639
+					delete_transient('give-total-api-keys');
1640
+					wp_redirect(add_query_arg('give-message', 'api-key-generated', 'edit.php?post_type=give_forms&page=give-settings&tab=api'));
1641 1641
 					exit();
1642 1642
 				} else {
1643
-					wp_redirect( add_query_arg( 'give-message', 'api-key-failed', 'edit.php?post_type=give_forms&page=give-settings&tab=api' ) );
1643
+					wp_redirect(add_query_arg('give-message', 'api-key-failed', 'edit.php?post_type=give_forms&page=give-settings&tab=api'));
1644 1644
 					exit();
1645 1645
 				}
1646 1646
 				break;
1647 1647
 			case 'regenerate':
1648
-				$this->generate_api_key( $user_id, true );
1649
-				delete_transient( 'give-total-api-keys' );
1650
-				wp_redirect( add_query_arg( 'give-message', 'api-key-regenerated', 'edit.php?post_type=give_forms&page=give-settings&tab=api' ) );
1648
+				$this->generate_api_key($user_id, true);
1649
+				delete_transient('give-total-api-keys');
1650
+				wp_redirect(add_query_arg('give-message', 'api-key-regenerated', 'edit.php?post_type=give_forms&page=give-settings&tab=api'));
1651 1651
 				exit();
1652 1652
 				break;
1653 1653
 			case 'revoke':
1654
-				$this->revoke_api_key( $user_id );
1655
-				delete_transient( 'give-total-api-keys' );
1656
-				wp_redirect( add_query_arg( 'give-message', 'api-key-revoked', 'edit.php?post_type=give_forms&page=give-settings&tab=api' ) );
1654
+				$this->revoke_api_key($user_id);
1655
+				delete_transient('give-total-api-keys');
1656
+				wp_redirect(add_query_arg('give-message', 'api-key-revoked', 'edit.php?post_type=give_forms&page=give-settings&tab=api'));
1657 1657
 				exit();
1658 1658
 				break;
1659 1659
 			default;
@@ -1672,34 +1672,34 @@  discard block
 block discarded – undo
1672 1672
 	 *
1673 1673
 	 * @return boolean True if (re)generated succesfully, false otherwise.
1674 1674
 	 */
1675
-	public function generate_api_key( $user_id = 0, $regenerate = false ) {
1675
+	public function generate_api_key($user_id = 0, $regenerate = false) {
1676 1676
 
1677
-		if ( empty( $user_id ) ) {
1677
+		if (empty($user_id)) {
1678 1678
 			return false;
1679 1679
 		}
1680 1680
 
1681
-		$user = get_userdata( $user_id );
1681
+		$user = get_userdata($user_id);
1682 1682
 
1683
-		if ( ! $user ) {
1683
+		if ( ! $user) {
1684 1684
 			return false;
1685 1685
 		}
1686 1686
 
1687
-		$public_key = $this->get_user_public_key( $user_id );
1688
-		$secret_key = $this->get_user_secret_key( $user_id );
1687
+		$public_key = $this->get_user_public_key($user_id);
1688
+		$secret_key = $this->get_user_secret_key($user_id);
1689 1689
 
1690
-		if ( empty( $public_key ) || $regenerate == true ) {
1691
-			$new_public_key = $this->generate_public_key( $user->user_email );
1692
-			$new_secret_key = $this->generate_private_key( $user->ID );
1690
+		if (empty($public_key) || $regenerate == true) {
1691
+			$new_public_key = $this->generate_public_key($user->user_email);
1692
+			$new_secret_key = $this->generate_private_key($user->ID);
1693 1693
 		} else {
1694 1694
 			return false;
1695 1695
 		}
1696 1696
 
1697
-		if ( $regenerate == true ) {
1698
-			$this->revoke_api_key( $user->ID );
1697
+		if ($regenerate == true) {
1698
+			$this->revoke_api_key($user->ID);
1699 1699
 		}
1700 1700
 
1701
-		update_user_meta( $user_id, $new_public_key, 'give_user_public_key' );
1702
-		update_user_meta( $user_id, $new_secret_key, 'give_user_secret_key' );
1701
+		update_user_meta($user_id, $new_public_key, 'give_user_public_key');
1702
+		update_user_meta($user_id, $new_secret_key, 'give_user_secret_key');
1703 1703
 
1704 1704
 		return true;
1705 1705
 	}
@@ -1714,28 +1714,28 @@  discard block
 block discarded – undo
1714 1714
 	 *
1715 1715
 	 * @return string
1716 1716
 	 */
1717
-	public function revoke_api_key( $user_id = 0 ) {
1717
+	public function revoke_api_key($user_id = 0) {
1718 1718
 
1719
-		if ( empty( $user_id ) ) {
1719
+		if (empty($user_id)) {
1720 1720
 			return false;
1721 1721
 		}
1722 1722
 
1723
-		$user = get_userdata( $user_id );
1723
+		$user = get_userdata($user_id);
1724 1724
 
1725
-		if ( ! $user ) {
1725
+		if ( ! $user) {
1726 1726
 			return false;
1727 1727
 		}
1728 1728
 
1729
-		$public_key = $this->get_user_public_key( $user_id );
1730
-		$secret_key = $this->get_user_secret_key( $user_id );
1729
+		$public_key = $this->get_user_public_key($user_id);
1730
+		$secret_key = $this->get_user_secret_key($user_id);
1731 1731
 
1732 1732
 
1733
-		if ( ! empty( $public_key ) ) {
1734
-			delete_transient( md5( 'give_api_user_' . $public_key ) );
1735
-			delete_transient( md5( 'give_api_user_public_key' . $user_id ) );
1736
-			delete_transient( md5( 'give_api_user_secret_key' . $user_id ) );
1737
-			delete_user_meta( $user_id, $public_key );
1738
-			delete_user_meta( $user_id, $secret_key );
1733
+		if ( ! empty($public_key)) {
1734
+			delete_transient(md5('give_api_user_'.$public_key));
1735
+			delete_transient(md5('give_api_user_public_key'.$user_id));
1736
+			delete_transient(md5('give_api_user_secret_key'.$user_id));
1737
+			delete_user_meta($user_id, $public_key);
1738
+			delete_user_meta($user_id, $secret_key);
1739 1739
 		} else {
1740 1740
 			return false;
1741 1741
 		}
@@ -1760,22 +1760,22 @@  discard block
 block discarded – undo
1760 1760
 	 *
1761 1761
 	 * @return void
1762 1762
 	 */
1763
-	public function update_key( $user_id ) {
1764
-		if ( current_user_can( 'edit_user', $user_id ) && isset( $_POST['give_set_api_key'] ) ) {
1763
+	public function update_key($user_id) {
1764
+		if (current_user_can('edit_user', $user_id) && isset($_POST['give_set_api_key'])) {
1765 1765
 
1766
-			$user = get_userdata( $user_id );
1766
+			$user = get_userdata($user_id);
1767 1767
 
1768
-			$public_key = $this->get_user_public_key( $user_id );
1769
-			$secret_key = $this->get_user_secret_key( $user_id );
1768
+			$public_key = $this->get_user_public_key($user_id);
1769
+			$secret_key = $this->get_user_secret_key($user_id);
1770 1770
 
1771
-			if ( empty( $public_key ) ) {
1772
-				$new_public_key = $this->generate_public_key( $user->user_email );
1773
-				$new_secret_key = $this->generate_private_key( $user->ID );
1771
+			if (empty($public_key)) {
1772
+				$new_public_key = $this->generate_public_key($user->user_email);
1773
+				$new_secret_key = $this->generate_private_key($user->ID);
1774 1774
 
1775
-				update_user_meta( $user_id, $new_public_key, 'give_user_public_key' );
1776
-				update_user_meta( $user_id, $new_secret_key, 'give_user_secret_key' );
1775
+				update_user_meta($user_id, $new_public_key, 'give_user_public_key');
1776
+				update_user_meta($user_id, $new_secret_key, 'give_user_secret_key');
1777 1777
 			} else {
1778
-				$this->revoke_api_key( $user_id );
1778
+				$this->revoke_api_key($user_id);
1779 1779
 			}
1780 1780
 		}
1781 1781
 	}
@@ -1790,9 +1790,9 @@  discard block
 block discarded – undo
1790 1790
 	 *
1791 1791
 	 * @return string
1792 1792
 	 */
1793
-	private function generate_public_key( $user_email = '' ) {
1794
-		$auth_key = defined( 'AUTH_KEY' ) ? AUTH_KEY : '';
1795
-		$public   = hash( 'md5', $user_email . $auth_key . date( 'U' ) );
1793
+	private function generate_public_key($user_email = '') {
1794
+		$auth_key = defined('AUTH_KEY') ? AUTH_KEY : '';
1795
+		$public   = hash('md5', $user_email.$auth_key.date('U'));
1796 1796
 
1797 1797
 		return $public;
1798 1798
 	}
@@ -1807,9 +1807,9 @@  discard block
 block discarded – undo
1807 1807
 	 *
1808 1808
 	 * @return string
1809 1809
 	 */
1810
-	private function generate_private_key( $user_id = 0 ) {
1811
-		$auth_key = defined( 'AUTH_KEY' ) ? AUTH_KEY : '';
1812
-		$secret   = hash( 'md5', $user_id . $auth_key . date( 'U' ) );
1810
+	private function generate_private_key($user_id = 0) {
1811
+		$auth_key = defined('AUTH_KEY') ? AUTH_KEY : '';
1812
+		$secret   = hash('md5', $user_id.$auth_key.date('U'));
1813 1813
 
1814 1814
 		return $secret;
1815 1815
 	}
@@ -1824,8 +1824,8 @@  discard block
 block discarded – undo
1824 1824
 	 *
1825 1825
 	 * @return string
1826 1826
 	 */
1827
-	public function get_token( $user_id = 0 ) {
1828
-		return hash( 'md5', $this->get_user_secret_key( $user_id ) . $this->get_user_public_key( $user_id ) );
1827
+	public function get_token($user_id = 0) {
1828
+		return hash('md5', $this->get_user_secret_key($user_id).$this->get_user_public_key($user_id));
1829 1829
 	}
1830 1830
 
1831 1831
 	/**
@@ -1839,9 +1839,9 @@  discard block
 block discarded – undo
1839 1839
 
1840 1840
 		// Default sales return
1841 1841
 		$sales                               = array();
1842
-		$sales['donations']['today']         = $this->stats->get_sales( 0, 'today' );
1843
-		$sales['donations']['current_month'] = $this->stats->get_sales( 0, 'this_month' );
1844
-		$sales['donations']['last_month']    = $this->stats->get_sales( 0, 'last_month' );
1842
+		$sales['donations']['today']         = $this->stats->get_sales(0, 'today');
1843
+		$sales['donations']['current_month'] = $this->stats->get_sales(0, 'this_month');
1844
+		$sales['donations']['last_month']    = $this->stats->get_sales(0, 'last_month');
1845 1845
 		$sales['donations']['totals']        = give_get_total_sales();
1846 1846
 
1847 1847
 		return $sales;
@@ -1858,9 +1858,9 @@  discard block
 block discarded – undo
1858 1858
 
1859 1859
 		// Default earnings return
1860 1860
 		$earnings                              = array();
1861
-		$earnings['earnings']['today']         = $this->stats->get_earnings( 0, 'today' );
1862
-		$earnings['earnings']['current_month'] = $this->stats->get_earnings( 0, 'this_month' );
1863
-		$earnings['earnings']['last_month']    = $this->stats->get_earnings( 0, 'last_month' );
1861
+		$earnings['earnings']['today']         = $this->stats->get_earnings(0, 'today');
1862
+		$earnings['earnings']['current_month'] = $this->stats->get_earnings(0, 'this_month');
1863
+		$earnings['earnings']['last_month']    = $this->stats->get_earnings(0, 'last_month');
1864 1864
 		$earnings['earnings']['totals']        = give_get_total_earnings();
1865 1865
 
1866 1866
 		return $earnings;
Please login to merge, or discard this patch.
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,15 +1,15 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Give API
4
- *
5
- * A front-facing JSON/XML API that makes it possible to query donation data.
6
- *
7
- * @package     Give
8
- * @subpackage  Classes/API
9
- * @copyright   Copyright (c) 2015, WordImpress
10
- * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
11
- * @since       1.1
12
- */
3
+	 * Give API
4
+	 *
5
+	 * A front-facing JSON/XML API that makes it possible to query donation data.
6
+	 *
7
+	 * @package     Give
8
+	 * @subpackage  Classes/API
9
+	 * @copyright   Copyright (c) 2015, WordImpress
10
+	 * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
11
+	 * @since       1.1
12
+	 */
13 13
 
14 14
 // Exit if accessed directly
15 15
 if ( ! defined( 'ABSPATH' ) ) {
Please login to merge, or discard this patch.
includes/class-give-logging.php 4 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 	 * @since 1.0
197 197
 	 * @param array $log_data Log entry data
198 198
 	 * @param array $log_meta Log entry meta
199
-	 * @return bool True if successful, false otherwise
199
+	 * @return boolean|null True if successful, false otherwise
200 200
 	 */
201 201
 	public function update_log( $log_data = array(), $log_meta = array() ) {
202 202
 
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
  * @param string $title
368 368
  * @param string $message
369 369
  * @param int    $parent
370
- * @param null   $type
370
+ * @param string   $type
371 371
  *
372 372
  * @global $give_logs GIVE Logs Object
373 373
  *
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	 * @access public
69 69
 	 * @since 1.0
70 70
 	 * @return void
71
-	*/
71
+	 */
72 72
 	public function register_taxonomy() {
73 73
 		register_taxonomy( 'give_log_type', 'give_log', array( 'public' => false ) );
74 74
 	}
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 	 * @param string $type Log type (default: null)
142 142
 	 * @param int $paged Page number (default: null)
143 143
 	 * @return array Array of the connected logs
144
-	*/
144
+	 */
145 145
 	public function get_logs( $object_id = 0, $type = null, $paged = null ) {
146 146
 		return $this->get_connected_logs( array( 'post_parent' => $object_id, 'paged' => $paged, 'log_type' => $type ) );
147 147
 	}
Please login to merge, or discard this patch.
Spacing   +53 added lines, -53 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' ) ) exit;
13
+if ( ! defined('ABSPATH')) exit;
14 14
 
15 15
 /**
16 16
  * Give_Logging Class
@@ -28,10 +28,10 @@  discard block
 block discarded – undo
28 28
 	 */
29 29
 	public function __construct() {
30 30
 		// Create the log post type
31
-		add_action( 'init', array( $this, 'register_post_type' ), 1 );
31
+		add_action('init', array($this, 'register_post_type'), 1);
32 32
 
33 33
 		// Create types taxonomy and default types
34
-		add_action( 'init', array( $this, 'register_taxonomy' ), 1 );
34
+		add_action('init', array($this, 'register_taxonomy'), 1);
35 35
 
36 36
 	}
37 37
 
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	public function register_post_type() {
46 46
 		/* Logs post type */
47 47
 		$log_args = array(
48
-			'labels'			  => array( 'name' => __( 'Logs', 'give' ) ),
48
+			'labels'			  => array('name' => __('Logs', 'give')),
49 49
 			'public'			  => false,
50 50
 			'exclude_from_search' => true,
51 51
 			'publicly_queryable'  => false,
@@ -53,11 +53,11 @@  discard block
 block discarded – undo
53 53
 			'query_var'			  => false,
54 54
 			'rewrite'			  => false,
55 55
 			'capability_type'	  => 'post',
56
-			'supports'			  => array( 'title', 'editor' ),
56
+			'supports'			  => array('title', 'editor'),
57 57
 			'can_export'		  => true
58 58
 		);
59 59
 
60
-		register_post_type( 'give_log', $log_args );
60
+		register_post_type('give_log', $log_args);
61 61
 	}
62 62
 
63 63
 	/**
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 	 * @return void
71 71
 	*/
72 72
 	public function register_taxonomy() {
73
-		register_taxonomy( 'give_log_type', 'give_log', array( 'public' => false ) );
73
+		register_taxonomy('give_log_type', 'give_log', array('public' => false));
74 74
 	}
75 75
 
76 76
 	/**
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 			'sale', 'gateway_error', 'api_request'
88 88
 		);
89 89
 
90
-		return apply_filters( 'give_log_types', $terms );
90
+		return apply_filters('give_log_types', $terms);
91 91
 	}
92 92
 
93 93
 	/**
@@ -101,8 +101,8 @@  discard block
 block discarded – undo
101 101
 	 * @param string $type Log type
102 102
 	 * @return bool Whether log type is valid
103 103
 	 */
104
-	function valid_type( $type ) {
105
-		return in_array( $type, $this->log_types() );
104
+	function valid_type($type) {
105
+		return in_array($type, $this->log_types());
106 106
 	}
107 107
 
108 108
 	/**
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 	 * @param string $type Log type (default: null)
121 121
 	 * @return int Log ID
122 122
 	 */
123
-	public function add( $title = '', $message = '', $parent = 0, $type = null ) {
123
+	public function add($title = '', $message = '', $parent = 0, $type = null) {
124 124
 		$log_data = array(
125 125
 			'post_title' 	=> $title,
126 126
 			'post_content'	=> $message,
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 			'log_type'		=> $type
129 129
 		);
130 130
 
131
-		return $this->insert_log( $log_data );
131
+		return $this->insert_log($log_data);
132 132
 	}
133 133
 
134 134
 	/**
@@ -142,8 +142,8 @@  discard block
 block discarded – undo
142 142
 	 * @param int $paged Page number (default: null)
143 143
 	 * @return array Array of the connected logs
144 144
 	*/
145
-	public function get_logs( $object_id = 0, $type = null, $paged = null ) {
146
-		return $this->get_connected_logs( array( 'post_parent' => $object_id, 'paged' => $paged, 'log_type' => $type ) );
145
+	public function get_logs($object_id = 0, $type = null, $paged = null) {
146
+		return $this->get_connected_logs(array('post_parent' => $object_id, 'paged' => $paged, 'log_type' => $type));
147 147
 	}
148 148
 
149 149
 	/**
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 	 * @param array $log_meta Log entry meta
157 157
 	 * @return int The ID of the newly created log item
158 158
 	 */
159
-	function insert_log( $log_data = array(), $log_meta = array() ) {
159
+	function insert_log($log_data = array(), $log_meta = array()) {
160 160
 		$defaults = array(
161 161
 			'post_type' 	=> 'give_log',
162 162
 			'post_status'	=> 'publish',
@@ -165,26 +165,26 @@  discard block
 block discarded – undo
165 165
 			'log_type'		=> false
166 166
 		);
167 167
 
168
-		$args = wp_parse_args( $log_data, $defaults );
168
+		$args = wp_parse_args($log_data, $defaults);
169 169
 
170
-		do_action( 'give_pre_insert_log', $log_data, $log_meta );
170
+		do_action('give_pre_insert_log', $log_data, $log_meta);
171 171
 
172 172
 		// Store the log entry
173
-		$log_id = wp_insert_post( $args );
173
+		$log_id = wp_insert_post($args);
174 174
 
175 175
 		// Set the log type, if any
176
-		if ( $log_data['log_type'] && $this->valid_type( $log_data['log_type'] ) ) {
177
-			wp_set_object_terms( $log_id, $log_data['log_type'], 'give_log_type', false );
176
+		if ($log_data['log_type'] && $this->valid_type($log_data['log_type'])) {
177
+			wp_set_object_terms($log_id, $log_data['log_type'], 'give_log_type', false);
178 178
 		}
179 179
 
180 180
 		// Set log meta, if any
181
-		if ( $log_id && ! empty( $log_meta ) ) {
182
-			foreach ( (array) $log_meta as $key => $meta ) {
183
-				update_post_meta( $log_id, '_give_log_' . sanitize_key( $key ), $meta );
181
+		if ($log_id && ! empty($log_meta)) {
182
+			foreach ((array) $log_meta as $key => $meta) {
183
+				update_post_meta($log_id, '_give_log_'.sanitize_key($key), $meta);
184 184
 			}
185 185
 		}
186 186
 
187
-		do_action( 'give_post_insert_log', $log_id, $log_data, $log_meta );
187
+		do_action('give_post_insert_log', $log_id, $log_data, $log_meta);
188 188
 
189 189
 		return $log_id;
190 190
 	}
@@ -198,9 +198,9 @@  discard block
 block discarded – undo
198 198
 	 * @param array $log_meta Log entry meta
199 199
 	 * @return bool True if successful, false otherwise
200 200
 	 */
201
-	public function update_log( $log_data = array(), $log_meta = array() ) {
201
+	public function update_log($log_data = array(), $log_meta = array()) {
202 202
 
203
-		do_action( 'give_pre_update_log', $log_data, $log_meta );
203
+		do_action('give_pre_update_log', $log_data, $log_meta);
204 204
 
205 205
 		$defaults = array(
206 206
 			'post_type' 	=> 'give_log',
@@ -208,19 +208,19 @@  discard block
 block discarded – undo
208 208
 			'post_parent'	=> 0
209 209
 		);
210 210
 
211
-		$args = wp_parse_args( $log_data, $defaults );
211
+		$args = wp_parse_args($log_data, $defaults);
212 212
 
213 213
 		// Store the log entry
214
-		$log_id = wp_update_post( $args );
214
+		$log_id = wp_update_post($args);
215 215
 
216
-		if ( $log_id && ! empty( $log_meta ) ) {
217
-			foreach ( (array) $log_meta as $key => $meta ) {
218
-				if ( ! empty( $meta ) )
219
-					update_post_meta( $log_id, '_give_log_' . sanitize_key( $key ), $meta );
216
+		if ($log_id && ! empty($log_meta)) {
217
+			foreach ((array) $log_meta as $key => $meta) {
218
+				if ( ! empty($meta))
219
+					update_post_meta($log_id, '_give_log_'.sanitize_key($key), $meta);
220 220
 			}
221 221
 		}
222 222
 
223
-		do_action( 'give_post_update_log', $log_id, $log_data, $log_meta );
223
+		do_action('give_post_update_log', $log_id, $log_data, $log_meta);
224 224
 	}
225 225
 
226 226
 	/**
@@ -233,18 +233,18 @@  discard block
 block discarded – undo
233 233
 	 * @param array $args Query arguments
234 234
 	 * @return mixed array if logs were found, false otherwise
235 235
 	 */
236
-	public function get_connected_logs( $args = array() ) {
236
+	public function get_connected_logs($args = array()) {
237 237
 		$defaults = array(
238 238
 			'post_type'      => 'give_log',
239 239
 			'posts_per_page' => 20,
240 240
 			'post_status'    => 'publish',
241
-			'paged'          => get_query_var( 'paged' ),
241
+			'paged'          => get_query_var('paged'),
242 242
 			'log_type'       => false
243 243
 		);
244 244
 
245
-		$query_args = wp_parse_args( $args, $defaults );
245
+		$query_args = wp_parse_args($args, $defaults);
246 246
 
247
-		if ( $query_args['log_type'] && $this->valid_type( $query_args['log_type'] ) ) {
247
+		if ($query_args['log_type'] && $this->valid_type($query_args['log_type'])) {
248 248
 			$query_args['tax_query'] = array(
249 249
 				array(
250 250
 					'taxonomy' 	=> 'give_log_type',
@@ -254,9 +254,9 @@  discard block
 block discarded – undo
254 254
 			);
255 255
 		}
256 256
 
257
-		$logs = get_posts( $query_args );
257
+		$logs = get_posts($query_args);
258 258
 
259
-		if ( $logs )
259
+		if ($logs)
260 260
 			return $logs;
261 261
 
262 262
 		// No logs found
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
 	 * @param array $date_query Log data query (default: null) (since 1.9)
275 275
 	 * @return int Log count
276 276
 	 */
277
-	public function get_log_count( $object_id = 0, $type = null, $meta_query = null, $date_query = null ) {
277
+	public function get_log_count($object_id = 0, $type = null, $meta_query = null, $date_query = null) {
278 278
 		
279 279
 		global $pagenow, $typenow;
280 280
 
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 			'fields'           => 'ids',
287 287
 		);
288 288
 
289
-		if ( ! empty( $type ) && $this->valid_type( $type ) ) {
289
+		if ( ! empty($type) && $this->valid_type($type)) {
290 290
 			$query_args['tax_query'] = array(
291 291
 				array(
292 292
 					'taxonomy' 	=> 'give_log_type',
@@ -296,15 +296,15 @@  discard block
 block discarded – undo
296 296
 			);
297 297
 		}
298 298
 
299
-		if ( ! empty( $meta_query ) ) {
299
+		if ( ! empty($meta_query)) {
300 300
 			$query_args['meta_query'] = $meta_query;
301 301
 		}
302 302
 
303
-		if ( ! empty( $date_query ) ) {
303
+		if ( ! empty($date_query)) {
304 304
 			$query_args['date_query'] = $date_query;
305 305
 		}
306 306
 
307
-		$logs = new WP_Query( $query_args );
307
+		$logs = new WP_Query($query_args);
308 308
 
309 309
 		return (int) $logs->post_count;
310 310
 	}
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 	 * @param array $meta_query Log meta query (default: null)
321 321
 	 * @return void
322 322
 	 */
323
-	public function delete_logs( $object_id = 0, $type = null, $meta_query = null  ) {
323
+	public function delete_logs($object_id = 0, $type = null, $meta_query = null) {
324 324
 		$query_args = array(
325 325
 			'post_parent' 	=> $object_id,
326 326
 			'post_type'		=> 'give_log',
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
 			'fields'        => 'ids'
330 330
 		);
331 331
 
332
-		if ( ! empty( $type ) && $this->valid_type( $type ) ) {
332
+		if ( ! empty($type) && $this->valid_type($type)) {
333 333
 			$query_args['tax_query'] = array(
334 334
 				array(
335 335
 					'taxonomy' 	=> 'give_log_type',
@@ -339,15 +339,15 @@  discard block
 block discarded – undo
339 339
 			);
340 340
 		}
341 341
 
342
-		if ( ! empty( $meta_query ) ) {
342
+		if ( ! empty($meta_query)) {
343 343
 			$query_args['meta_query'] = $meta_query;
344 344
 		}
345 345
 
346
-		$logs = get_posts( $query_args );
346
+		$logs = get_posts($query_args);
347 347
 
348
-		if ( $logs ) {
349
-			foreach ( $logs as $log ) {
350
-				wp_delete_post( $log, true );
348
+		if ($logs) {
349
+			foreach ($logs as $log) {
350
+				wp_delete_post($log, true);
351 351
 			}
352 352
 		}
353 353
 	}
@@ -375,8 +375,8 @@  discard block
 block discarded – undo
375 375
  *
376 376
  * @return mixed ID of the new log entry
377 377
  */
378
-function give_record_log( $title = '', $message = '', $parent = 0, $type = null ) {
378
+function give_record_log($title = '', $message = '', $parent = 0, $type = null) {
379 379
 	global $give_logs;
380
-	$log = $give_logs->add( $title, $message, $parent, $type );
380
+	$log = $give_logs->add($title, $message, $parent, $type);
381 381
 	return $log;
382 382
 }
383 383
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +9 added lines, -5 removed lines patch added patch discarded remove patch
@@ -10,7 +10,9 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) exit;
13
+if ( ! defined( 'ABSPATH' ) ) {
14
+	exit;
15
+}
14 16
 
15 17
 /**
16 18
  * Give_Logging Class
@@ -215,8 +217,9 @@  discard block
 block discarded – undo
215 217
 
216 218
 		if ( $log_id && ! empty( $log_meta ) ) {
217 219
 			foreach ( (array) $log_meta as $key => $meta ) {
218
-				if ( ! empty( $meta ) )
219
-					update_post_meta( $log_id, '_give_log_' . sanitize_key( $key ), $meta );
220
+				if ( ! empty( $meta ) ) {
221
+									update_post_meta( $log_id, '_give_log_' . sanitize_key( $key ), $meta );
222
+				}
220 223
 			}
221 224
 		}
222 225
 
@@ -256,8 +259,9 @@  discard block
 block discarded – undo
256 259
 
257 260
 		$logs = get_posts( $query_args );
258 261
 
259
-		if ( $logs )
260
-			return $logs;
262
+		if ( $logs ) {
263
+					return $logs;
264
+		}
261 265
 
262 266
 		// No logs found
263 267
 		return false;
Please login to merge, or discard this patch.
includes/class-give-session.php 2 patches
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -167,10 +167,10 @@  discard block
 block discarded – undo
167 167
 	 *
168 168
 	 * @since 1.0
169 169
 	 *
170
-	 * @param $key   $_SESSION key
171
-	 * @param $value $_SESSION variable
172 170
 	 *
173
-	 * @return mixed Session variable
171
+	 * @param string $key
172
+	 * @param integer $value
173
+	 * @return string Session variable
174 174
 	 */
175 175
 	public function set( $key, $value ) {
176 176
 
@@ -222,13 +222,13 @@  discard block
 block discarded – undo
222 222
 	/**
223 223
 	 * Starts a new session if one hasn't started yet.
224 224
 	 *
225
-	 * @return null
225
+	 * @return boolean
226 226
 	 * Checks to see if the server supports PHP sessions
227 227
 	 * or if the GIVE_USE_PHP_SESSIONS constant is defined
228 228
 	 *
229 229
 	 * @access public
230 230
 	 * @since  1.0
231
-	 * @return bool $ret True if we are using PHP sessions, false otherwise
231
+	 * @return boolean $ret True if we are using PHP sessions, false otherwise
232 232
 	 */
233 233
 	public function use_php_sessions() {
234 234
 
Please login to merge, or discard this patch.
Spacing   +48 added lines, -48 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
 
@@ -71,44 +71,44 @@  discard block
 block discarded – undo
71 71
 	public function __construct() {
72 72
 
73 73
 		$this->use_php_sessions = $this->use_php_sessions();
74
-		$this->exp_option       = give_get_option( 'session_lifetime' );
74
+		$this->exp_option       = give_get_option('session_lifetime');
75 75
 
76
-		if ( $this->use_php_sessions ) {
76
+		if ($this->use_php_sessions) {
77 77
 
78
-			if ( is_multisite() ) {
78
+			if (is_multisite()) {
79 79
 
80
-				$this->prefix = '_' . get_current_blog_id();
80
+				$this->prefix = '_'.get_current_blog_id();
81 81
 
82 82
 			}
83 83
 
84 84
 			// Use PHP SESSION (must be enabled via the GIVE_USE_PHP_SESSIONS constant)
85
-			add_action( 'init', array( $this, 'maybe_start_session' ), - 2 );
85
+			add_action('init', array($this, 'maybe_start_session'), - 2);
86 86
 
87 87
 		} else {
88 88
 
89 89
 			// Use WP_Session (default)
90
-			if ( ! defined( 'WP_SESSION_COOKIE' ) ) {
91
-				define( 'WP_SESSION_COOKIE', 'give_wp_session' );
90
+			if ( ! defined('WP_SESSION_COOKIE')) {
91
+				define('WP_SESSION_COOKIE', 'give_wp_session');
92 92
 			}
93 93
 
94
-			if ( ! class_exists( 'Recursive_ArrayAccess' ) ) {
95
-				require_once GIVE_PLUGIN_DIR . 'includes/libraries/class-recursive-arrayaccess.php';
94
+			if ( ! class_exists('Recursive_ArrayAccess')) {
95
+				require_once GIVE_PLUGIN_DIR.'includes/libraries/class-recursive-arrayaccess.php';
96 96
 			}
97 97
 
98
-			if ( ! class_exists( 'WP_Session' ) ) {
99
-				require_once GIVE_PLUGIN_DIR . 'includes/libraries/class-wp-session.php';
100
-				require_once GIVE_PLUGIN_DIR . 'includes/libraries/wp-session.php';
98
+			if ( ! class_exists('WP_Session')) {
99
+				require_once GIVE_PLUGIN_DIR.'includes/libraries/class-wp-session.php';
100
+				require_once GIVE_PLUGIN_DIR.'includes/libraries/wp-session.php';
101 101
 			}
102 102
 
103
-			add_filter( 'wp_session_expiration_variant', array( $this, 'set_expiration_variant_time' ), 99999 );
104
-			add_filter( 'wp_session_expiration', array( $this, 'set_expiration_time' ), 99999 );
103
+			add_filter('wp_session_expiration_variant', array($this, 'set_expiration_variant_time'), 99999);
104
+			add_filter('wp_session_expiration', array($this, 'set_expiration_time'), 99999);
105 105
 
106 106
 		}
107 107
 
108
-		if ( empty( $this->session ) && ! $this->use_php_sessions ) {
109
-			add_action( 'plugins_loaded', array( $this, 'init' ), - 1 );
108
+		if (empty($this->session) && ! $this->use_php_sessions) {
109
+			add_action('plugins_loaded', array($this, 'init'), - 1);
110 110
 		} else {
111
-			add_action( 'init', array( $this, 'init' ), - 1 );
111
+			add_action('init', array($this, 'init'), - 1);
112 112
 		}
113 113
 
114 114
 	}
@@ -122,8 +122,8 @@  discard block
 block discarded – undo
122 122
 	 */
123 123
 	public function init() {
124 124
 
125
-		if ( $this->use_php_sessions ) {
126
-			$this->session = isset( $_SESSION[ 'give' . $this->prefix ] ) && is_array( $_SESSION[ 'give' . $this->prefix ] ) ? $_SESSION[ 'give' . $this->prefix ] : array();
125
+		if ($this->use_php_sessions) {
126
+			$this->session = isset($_SESSION['give'.$this->prefix]) && is_array($_SESSION['give'.$this->prefix]) ? $_SESSION['give'.$this->prefix] : array();
127 127
 		} else {
128 128
 			$this->session = WP_Session::get_instance();
129 129
 		}
@@ -155,10 +155,10 @@  discard block
 block discarded – undo
155 155
 	 *
156 156
 	 * @return string Session variable
157 157
 	 */
158
-	public function get( $key ) {
159
-		$key = sanitize_key( $key );
158
+	public function get($key) {
159
+		$key = sanitize_key($key);
160 160
 
161
-		return isset( $this->session[ $key ] ) ? maybe_unserialize( $this->session[ $key ] ) : false;
161
+		return isset($this->session[$key]) ? maybe_unserialize($this->session[$key]) : false;
162 162
 
163 163
 	}
164 164
 
@@ -172,21 +172,21 @@  discard block
 block discarded – undo
172 172
 	 *
173 173
 	 * @return mixed Session variable
174 174
 	 */
175
-	public function set( $key, $value ) {
175
+	public function set($key, $value) {
176 176
 
177
-		$key = sanitize_key( $key );
177
+		$key = sanitize_key($key);
178 178
 
179
-		if ( is_array( $value ) ) {
180
-			$this->session[ $key ] = serialize( $value );
179
+		if (is_array($value)) {
180
+			$this->session[$key] = serialize($value);
181 181
 		} else {
182
-			$this->session[ $key ] = $value;
182
+			$this->session[$key] = $value;
183 183
 		}
184 184
 
185
-		if ( $this->use_php_sessions ) {
186
-			$_SESSION[ 'give' . $this->prefix ] = $this->session;
185
+		if ($this->use_php_sessions) {
186
+			$_SESSION['give'.$this->prefix] = $this->session;
187 187
 		}
188 188
 
189
-		return $this->session[ $key ];
189
+		return $this->session[$key];
190 190
 	}
191 191
 
192 192
 	/**
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 	 */
202 202
 	public function set_expiration_variant_time() {
203 203
 
204
-		return ( ! empty( $this->exp_option ) ? ( intval( $this->exp_option ) - 3600 ) : 30 * 60 * 23 );
204
+		return ( ! empty($this->exp_option) ? (intval($this->exp_option) - 3600) : 30 * 60 * 23);
205 205
 	}
206 206
 
207 207
 	/**
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 	 */
217 217
 	public function set_expiration_time() {
218 218
 
219
-		return ( ! empty( $this->exp_option ) ? intval( $this->exp_option ) : 30 * 60 * 24 );
219
+		return ( ! empty($this->exp_option) ? intval($this->exp_option) : 30 * 60 * 24);
220 220
 	}
221 221
 
222 222
 	/**
@@ -235,21 +235,21 @@  discard block
 block discarded – undo
235 235
 		$ret = false;
236 236
 
237 237
 		// If the database variable is already set, no need to run autodetection
238
-		$give_use_php_sessions = (bool) get_option( 'give_use_php_sessions' );
238
+		$give_use_php_sessions = (bool) get_option('give_use_php_sessions');
239 239
 
240
-		if ( ! $give_use_php_sessions ) {
240
+		if ( ! $give_use_php_sessions) {
241 241
 
242 242
 			// Attempt to detect if the server supports PHP sessions
243
-			if ( function_exists( 'session_start' ) && ! ini_get( 'safe_mode' ) ) {
243
+			if (function_exists('session_start') && ! ini_get('safe_mode')) {
244 244
 
245
-				$this->set( 'give_use_php_sessions', 1 );
245
+				$this->set('give_use_php_sessions', 1);
246 246
 
247
-				if ( $this->get( 'give_use_php_sessions' ) ) {
247
+				if ($this->get('give_use_php_sessions')) {
248 248
 
249 249
 					$ret = true;
250 250
 
251 251
 					// Set the database option
252
-					update_option( 'give_use_php_sessions', true );
252
+					update_option('give_use_php_sessions', true);
253 253
 
254 254
 				}
255 255
 
@@ -260,13 +260,13 @@  discard block
 block discarded – undo
260 260
 		}
261 261
 
262 262
 		// Enable or disable PHP Sessions based on the GIVE_USE_PHP_SESSIONS constant
263
-		if ( defined( 'GIVE_USE_PHP_SESSIONS' ) && GIVE_USE_PHP_SESSIONS ) {
263
+		if (defined('GIVE_USE_PHP_SESSIONS') && GIVE_USE_PHP_SESSIONS) {
264 264
 			$ret = true;
265
-		} else if ( defined( 'GIVE_USE_PHP_SESSIONS' ) && ! GIVE_USE_PHP_SESSIONS ) {
265
+		} else if (defined('GIVE_USE_PHP_SESSIONS') && ! GIVE_USE_PHP_SESSIONS) {
266 266
 			$ret = false;
267 267
 		}
268 268
 
269
-		return (bool) apply_filters( 'give_use_php_sessions', $ret );
269
+		return (bool) apply_filters('give_use_php_sessions', $ret);
270 270
 	}
271 271
 
272 272
 	/**
@@ -279,11 +279,11 @@  discard block
 block discarded – undo
279 279
 
280 280
 //		session_destroy(); //Uncomment for testing ONLY
281 281
 
282
-		if ( ! session_id() && ! headers_sent() ) {
283
-			$lifetime = current_time( 'timestamp' ) + $this->set_expiration_time();
282
+		if ( ! session_id() && ! headers_sent()) {
283
+			$lifetime = current_time('timestamp') + $this->set_expiration_time();
284 284
 			session_start();
285
-			setcookie( session_name(), session_id(), $lifetime ); //
286
-			setcookie( session_name() . '_expiration', $lifetime, $lifetime );
285
+			setcookie(session_name(), session_id(), $lifetime); //
286
+			setcookie(session_name().'_expiration', $lifetime, $lifetime);
287 287
 		}
288 288
 	}
289 289
 
@@ -298,9 +298,9 @@  discard block
 block discarded – undo
298 298
 
299 299
 		$expiration = false;
300 300
 
301
-		if ( session_id() && isset( $_COOKIE[ session_name() . '_expiration' ] ) ) {
301
+		if (session_id() && isset($_COOKIE[session_name().'_expiration'])) {
302 302
 
303
-			$expiration = date( 'D, d M Y h:i:s', intval( $_COOKIE[ session_name() . '_expiration' ] ) );
303
+			$expiration = date('D, d M Y h:i:s', intval($_COOKIE[session_name().'_expiration']));
304 304
 
305 305
 		}
306 306
 
Please login to merge, or discard this patch.
includes/class-give-stats.php 2 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -121,6 +121,7 @@
 block discarded – undo
121 121
 	 *
122 122
 	 * @access public
123 123
 	 * @since  1.0
124
+	 * @param string|boolean $date
124 125
 	 * @return array|WP_Error If the date is invalid, a WP_Error object will be returned
125 126
 	 */
126 127
 	public function convert_date( $date, $end_date = false ) {
Please login to merge, or discard this patch.
Spacing   +102 added lines, -102 removed lines patch added patch discarded remove patch
@@ -76,19 +76,19 @@  discard block
 block discarded – undo
76 76
 	 */
77 77
 	public function get_predefined_dates() {
78 78
 		$predefined = array(
79
-			'today'        => __( 'Today', 'give' ),
80
-			'yesterday'    => __( 'Yesterday', 'give' ),
81
-			'this_week'    => __( 'This Week', 'give' ),
82
-			'last_week'    => __( 'Last Week', 'give' ),
83
-			'this_month'   => __( 'This Month', 'give' ),
84
-			'last_month'   => __( 'Last Month', 'give' ),
85
-			'this_quarter' => __( 'This Quarter', 'give' ),
86
-			'last_quarter' => __( 'Last Quarter', 'give' ),
87
-			'this_year'    => __( 'This Year', 'give' ),
88
-			'last_year'    => __( 'Last Year', 'give' )
79
+			'today'        => __('Today', 'give'),
80
+			'yesterday'    => __('Yesterday', 'give'),
81
+			'this_week'    => __('This Week', 'give'),
82
+			'last_week'    => __('Last Week', 'give'),
83
+			'this_month'   => __('This Month', 'give'),
84
+			'last_month'   => __('Last Month', 'give'),
85
+			'this_quarter' => __('This Quarter', 'give'),
86
+			'last_quarter' => __('Last Quarter', 'give'),
87
+			'this_year'    => __('This Year', 'give'),
88
+			'last_year'    => __('Last Year', 'give')
89 89
 		);
90 90
 
91
-		return apply_filters( 'give_stats_predefined_dates', $predefined );
91
+		return apply_filters('give_stats_predefined_dates', $predefined);
92 92
 	}
93 93
 
94 94
 	/**
@@ -100,20 +100,20 @@  discard block
 block discarded – undo
100 100
 	 * @since  1.0
101 101
 	 * @return void
102 102
 	 */
103
-	public function setup_dates( $_start_date = 'this_month', $_end_date = false ) {
103
+	public function setup_dates($_start_date = 'this_month', $_end_date = false) {
104 104
 
105
-		if ( empty( $_start_date ) ) {
105
+		if (empty($_start_date)) {
106 106
 			$this->start_date = 'this_month';
107 107
 		}
108 108
 
109 109
 		$this->start_date = $_start_date;
110 110
 
111
-		if( empty( $_end_date ) ) {
111
+		if (empty($_end_date)) {
112 112
 			$_end_date = $_start_date;
113 113
 		}
114 114
 
115
-		$this->start_date = $this->convert_date( $_start_date );
116
-		$this->end_date   = $this->convert_date( $_end_date, true );
115
+		$this->start_date = $this->convert_date($_start_date);
116
+		$this->end_date   = $this->convert_date($_end_date, true);
117 117
 	}
118 118
 
119 119
 	/**
@@ -123,26 +123,26 @@  discard block
 block discarded – undo
123 123
 	 * @since  1.0
124 124
 	 * @return array|WP_Error If the date is invalid, a WP_Error object will be returned
125 125
 	 */
126
-	public function convert_date( $date, $end_date = false ) {
126
+	public function convert_date($date, $end_date = false) {
127 127
 
128 128
 		$timestamp = false;
129 129
 		$second    = 0;
130 130
 		$minute    = 0;
131 131
 		$hour      = 0;
132 132
 		$day       = 1;
133
-		$month     = date( 'n', current_time( 'timestamp' ) );
134
-		$year      = date( 'Y', current_time( 'timestamp' ) );
133
+		$month     = date('n', current_time('timestamp'));
134
+		$year      = date('Y', current_time('timestamp'));
135 135
 
136
-		if ( array_key_exists( $date, $this->get_predefined_dates() ) ) {
136
+		if (array_key_exists($date, $this->get_predefined_dates())) {
137 137
 
138 138
 			// This is a predefined date rate, such as last_week
139
-			switch ( $date ) {
139
+			switch ($date) {
140 140
 
141 141
 				case 'this_month' :
142 142
 
143
-					if ( $end_date ) {
143
+					if ($end_date) {
144 144
 
145
-						$day = cal_days_in_month( CAL_GREGORIAN, $month, $year );
145
+						$day = cal_days_in_month(CAL_GREGORIAN, $month, $year);
146 146
 
147 147
 					}
148 148
 
@@ -150,28 +150,28 @@  discard block
 block discarded – undo
150 150
 
151 151
 				case 'last_month' :
152 152
 
153
-					if ( $month == 1 ) {
153
+					if ($month == 1) {
154 154
 
155 155
 						$month = 12;
156
-						$year --;
156
+						$year--;
157 157
 
158 158
 					} else {
159 159
 
160
-						$month --;
160
+						$month--;
161 161
 
162 162
 					}
163 163
 
164
-					if ( $end_date ) {
165
-						$day = cal_days_in_month( CAL_GREGORIAN, $month, $year );
164
+					if ($end_date) {
165
+						$day = cal_days_in_month(CAL_GREGORIAN, $month, $year);
166 166
 					}
167 167
 
168 168
 					break;
169 169
 
170 170
 				case 'today' :
171 171
 
172
-					$day = date( 'd', current_time( 'timestamp' ) );
172
+					$day = date('d', current_time('timestamp'));
173 173
 
174
-					if ( $end_date ) {
174
+					if ($end_date) {
175 175
 						$hour   = 11;
176 176
 						$minute = 59;
177 177
 						$second = 59;
@@ -181,23 +181,23 @@  discard block
 block discarded – undo
181 181
 
182 182
 				case 'yesterday' :
183 183
 
184
-					$day = date( 'd', current_time( 'timestamp' ) ) - 1;
184
+					$day = date('d', current_time('timestamp')) - 1;
185 185
 
186 186
 					// Check if Today is the first day of the month (meaning subtracting one will get us 0)
187
-					if ( $day < 1 ) {
187
+					if ($day < 1) {
188 188
 
189 189
 						// If current month is 1
190
-						if ( 1 == $month ) {
190
+						if (1 == $month) {
191 191
 
192 192
 							$year -= 1; // Today is January 1, so skip back to last day of December
193 193
 							$month = 12;
194
-							$day   = cal_days_in_month( CAL_GREGORIAN, $month, $year );
194
+							$day   = cal_days_in_month(CAL_GREGORIAN, $month, $year);
195 195
 
196 196
 						} else {
197 197
 
198 198
 							// Go back one month and get the last day of the month
199 199
 							$month -= 1;
200
-							$day = cal_days_in_month( CAL_GREGORIAN, $month, $year );
200
+							$day = cal_days_in_month(CAL_GREGORIAN, $month, $year);
201 201
 
202 202
 						}
203 203
 					}
@@ -206,12 +206,12 @@  discard block
 block discarded – undo
206 206
 
207 207
 				case 'this_week' :
208 208
 
209
-					$days_to_week_start = ( date( 'w', current_time( 'timestamp' ) ) - 1 ) * 60 * 60 * 24;
210
-					$today              = date( 'd', current_time( 'timestamp' ) ) * 60 * 60 * 24;
209
+					$days_to_week_start = (date('w', current_time('timestamp')) - 1) * 60 * 60 * 24;
210
+					$today              = date('d', current_time('timestamp')) * 60 * 60 * 24;
211 211
 
212
-					if ( $today < $days_to_week_start ) {
212
+					if ($today < $days_to_week_start) {
213 213
 
214
-						if ( $month > 1 ) {
214
+						if ($month > 1) {
215 215
 							$month -= 1;
216 216
 						} else {
217 217
 							$month = 12;
@@ -219,19 +219,19 @@  discard block
 block discarded – undo
219 219
 
220 220
 					}
221 221
 
222
-					if ( ! $end_date ) {
222
+					if ( ! $end_date) {
223 223
 
224 224
 						// Getting the start day
225 225
 
226
-						$day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 1;
227
-						$day += get_option( 'start_of_week' );
226
+						$day = date('d', current_time('timestamp') - $days_to_week_start) - 1;
227
+						$day += get_option('start_of_week');
228 228
 
229 229
 					} else {
230 230
 
231 231
 						// Getting the end day
232 232
 
233
-						$day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 1;
234
-						$day += get_option( 'start_of_week' ) + 6;
233
+						$day = date('d', current_time('timestamp') - $days_to_week_start) - 1;
234
+						$day += get_option('start_of_week') + 6;
235 235
 
236 236
 					}
237 237
 
@@ -239,12 +239,12 @@  discard block
 block discarded – undo
239 239
 
240 240
 				case 'last_week' :
241 241
 
242
-					$days_to_week_start = ( date( 'w', current_time( 'timestamp' ) ) - 1 ) * 60 * 60 * 24;
243
-					$today              = date( 'd', current_time( 'timestamp' ) ) * 60 * 60 * 24;
242
+					$days_to_week_start = (date('w', current_time('timestamp')) - 1) * 60 * 60 * 24;
243
+					$today              = date('d', current_time('timestamp')) * 60 * 60 * 24;
244 244
 
245
-					if ( $today < $days_to_week_start ) {
245
+					if ($today < $days_to_week_start) {
246 246
 
247
-						if ( $month > 1 ) {
247
+						if ($month > 1) {
248 248
 							$month -= 1;
249 249
 						} else {
250 250
 							$month = 12;
@@ -252,19 +252,19 @@  discard block
 block discarded – undo
252 252
 
253 253
 					}
254 254
 
255
-					if ( ! $end_date ) {
255
+					if ( ! $end_date) {
256 256
 
257 257
 						// Getting the start day
258 258
 
259
-						$day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 8;
260
-						$day += get_option( 'start_of_week' );
259
+						$day = date('d', current_time('timestamp') - $days_to_week_start) - 8;
260
+						$day += get_option('start_of_week');
261 261
 
262 262
 					} else {
263 263
 
264 264
 						// Getting the end day
265 265
 
266
-						$day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 8;
267
-						$day += get_option( 'start_of_week' ) + 6;
266
+						$day = date('d', current_time('timestamp') - $days_to_week_start) - 8;
267
+						$day += get_option('start_of_week') + 6;
268 268
 
269 269
 					}
270 270
 
@@ -272,39 +272,39 @@  discard block
 block discarded – undo
272 272
 
273 273
 				case 'this_quarter' :
274 274
 
275
-					$month_now = date( 'n', current_time( 'timestamp' ) );
275
+					$month_now = date('n', current_time('timestamp'));
276 276
 
277
-					if ( $month_now <= 3 ) {
277
+					if ($month_now <= 3) {
278 278
 
279
-						if ( ! $end_date ) {
279
+						if ( ! $end_date) {
280 280
 							$month = 1;
281 281
 						} else {
282 282
 							$month  = 3;
283
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
283
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
284 284
 							$hour   = 11;
285 285
 							$minute = 59;
286 286
 							$second = 59;
287 287
 						}
288 288
 
289
-					} else if ( $month_now <= 6 ) {
289
+					} else if ($month_now <= 6) {
290 290
 
291
-						if ( ! $end_date ) {
291
+						if ( ! $end_date) {
292 292
 							$month = 4;
293 293
 						} else {
294 294
 							$month  = 6;
295
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
295
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
296 296
 							$hour   = 11;
297 297
 							$minute = 59;
298 298
 							$second = 59;
299 299
 						}
300 300
 
301
-					} else if ( $month_now <= 9 ) {
301
+					} else if ($month_now <= 9) {
302 302
 
303
-						if ( ! $end_date ) {
303
+						if ( ! $end_date) {
304 304
 							$month = 7;
305 305
 						} else {
306 306
 							$month  = 9;
307
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
307
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
308 308
 							$hour   = 11;
309 309
 							$minute = 59;
310 310
 							$second = 59;
@@ -312,11 +312,11 @@  discard block
 block discarded – undo
312 312
 
313 313
 					} else {
314 314
 
315
-						if ( ! $end_date ) {
315
+						if ( ! $end_date) {
316 316
 							$month = 10;
317 317
 						} else {
318 318
 							$month  = 12;
319
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
319
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
320 320
 							$hour   = 11;
321 321
 							$minute = 59;
322 322
 							$second = 59;
@@ -328,40 +328,40 @@  discard block
 block discarded – undo
328 328
 
329 329
 				case 'last_quarter' :
330 330
 
331
-					$month_now = date( 'n', current_time( 'timestamp' ) );
331
+					$month_now = date('n', current_time('timestamp'));
332 332
 
333
-					if ( $month_now <= 3 ) {
333
+					if ($month_now <= 3) {
334 334
 
335
-						if ( ! $end_date ) {
335
+						if ( ! $end_date) {
336 336
 							$month = 10;
337 337
 						} else {
338 338
 							$year -= 1;
339 339
 							$month  = 12;
340
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
340
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
341 341
 							$hour   = 11;
342 342
 							$minute = 59;
343 343
 							$second = 59;
344 344
 						}
345 345
 
346
-					} else if ( $month_now <= 6 ) {
346
+					} else if ($month_now <= 6) {
347 347
 
348
-						if ( ! $end_date ) {
348
+						if ( ! $end_date) {
349 349
 							$month = 1;
350 350
 						} else {
351 351
 							$month  = 3;
352
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
352
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
353 353
 							$hour   = 11;
354 354
 							$minute = 59;
355 355
 							$second = 59;
356 356
 						}
357 357
 
358
-					} else if ( $month_now <= 9 ) {
358
+					} else if ($month_now <= 9) {
359 359
 
360
-						if ( ! $end_date ) {
360
+						if ( ! $end_date) {
361 361
 							$month = 4;
362 362
 						} else {
363 363
 							$month  = 6;
364
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
364
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
365 365
 							$hour   = 11;
366 366
 							$minute = 59;
367 367
 							$second = 59;
@@ -369,11 +369,11 @@  discard block
 block discarded – undo
369 369
 
370 370
 					} else {
371 371
 
372
-						if ( ! $end_date ) {
372
+						if ( ! $end_date) {
373 373
 							$month = 7;
374 374
 						} else {
375 375
 							$month  = 9;
376
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
376
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
377 377
 							$hour   = 11;
378 378
 							$minute = 59;
379 379
 							$second = 59;
@@ -385,11 +385,11 @@  discard block
 block discarded – undo
385 385
 
386 386
 				case 'this_year' :
387 387
 
388
-					if ( ! $end_date ) {
388
+					if ( ! $end_date) {
389 389
 						$month = 1;
390 390
 					} else {
391 391
 						$month  = 12;
392
-						$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
392
+						$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
393 393
 						$hour   = 11;
394 394
 						$minute = 59;
395 395
 						$second = 59;
@@ -400,11 +400,11 @@  discard block
 block discarded – undo
400 400
 				case 'last_year' :
401 401
 
402 402
 					$year -= 1;
403
-					if ( ! $end_date ) {
403
+					if ( ! $end_date) {
404 404
 						$month = 1;
405 405
 					} else {
406 406
 						$month  = 12;
407
-						$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
407
+						$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
408 408
 						$hour   = 11;
409 409
 						$minute = 59;
410 410
 						$second = 59;
@@ -415,30 +415,30 @@  discard block
 block discarded – undo
415 415
 			}
416 416
 
417 417
 
418
-		} else if ( is_numeric( $date ) ) {
418
+		} else if (is_numeric($date)) {
419 419
 
420 420
 			// return $date unchanged since it is a timestamp
421 421
 			$this->timestamp = true;
422 422
 
423
-		} else if ( false !== strtotime( $date ) ) {
423
+		} else if (false !== strtotime($date)) {
424 424
 
425 425
 			$this->timestamp = true;
426
-			$date            = strtotime( $date, current_time( 'timestamp' ) );
426
+			$date            = strtotime($date, current_time('timestamp'));
427 427
 
428 428
 		} else {
429 429
 
430
-			return new WP_Error( 'invalid_date', __( 'Improper date provided.', 'give' ) );
430
+			return new WP_Error('invalid_date', __('Improper date provided.', 'give'));
431 431
 
432 432
 		}
433 433
 
434
-		if ( ! is_wp_error( $date ) && ! $this->timestamp ) {
434
+		if ( ! is_wp_error($date) && ! $this->timestamp) {
435 435
 
436 436
 			// Create an exact timestamp
437
-			$date = mktime( $hour, $minute, $second, $month, $day, $year );
437
+			$date = mktime($hour, $minute, $second, $month, $day, $year);
438 438
 
439 439
 		}
440 440
 
441
-		return apply_filters( 'give_stats_date', $date, $end_date, $this );
441
+		return apply_filters('give_stats_date', $date, $end_date, $this);
442 442
 
443 443
 	}
444 444
 
@@ -449,33 +449,33 @@  discard block
 block discarded – undo
449 449
 	 * @since  1.0
450 450
 	 * @return string
451 451
 	 */
452
-	public function count_where( $where = '' ) {
452
+	public function count_where($where = '') {
453 453
 		// Only get payments in our date range
454 454
 
455 455
 		$start_where = '';
456 456
 		$end_where   = '';
457 457
 
458
-		if ( $this->start_date ) {
458
+		if ($this->start_date) {
459 459
 
460
-			if ( $this->timestamp ) {
460
+			if ($this->timestamp) {
461 461
 				$format = 'Y-m-d H:i:s';
462 462
 			} else {
463 463
 				$format = 'Y-m-d 00:00:00';
464 464
 			}
465 465
 
466
-			$start_date  = date( $format, $this->start_date );
466
+			$start_date  = date($format, $this->start_date);
467 467
 			$start_where = " AND p.post_date >= '{$start_date}'";
468 468
 		}
469 469
 
470
-		if ( $this->end_date ) {
470
+		if ($this->end_date) {
471 471
 
472
-			if ( $this->timestamp ) {
472
+			if ($this->timestamp) {
473 473
 				$format = 'Y-m-d H:i:s';
474 474
 			} else {
475 475
 				$format = 'Y-m-d 23:59:59';
476 476
 			}
477 477
 
478
-			$end_date = date( $format, $this->end_date );
478
+			$end_date = date($format, $this->end_date);
479 479
 
480 480
 			$end_where = " AND p.post_date <= '{$end_date}'";
481 481
 		}
@@ -492,34 +492,34 @@  discard block
 block discarded – undo
492 492
 	 * @since  1.0
493 493
 	 * @return string
494 494
 	 */
495
-	public function payments_where( $where = '' ) {
495
+	public function payments_where($where = '') {
496 496
 
497 497
 		global $wpdb;
498 498
 
499 499
 		$start_where = '';
500 500
 		$end_where   = '';
501 501
 
502
-		if ( $this->start_date ) {
502
+		if ($this->start_date) {
503 503
 
504
-			if ( $this->timestamp ) {
504
+			if ($this->timestamp) {
505 505
 				$format = 'Y-m-d H:i:s';
506 506
 			} else {
507 507
 				$format = 'Y-m-d 00:00:00';
508 508
 			}
509 509
 
510
-			$start_date  = date( $format, $this->start_date );
510
+			$start_date  = date($format, $this->start_date);
511 511
 			$start_where = " AND $wpdb->posts.post_date >= '{$start_date}'";
512 512
 		}
513 513
 
514
-		if ( $this->end_date ) {
514
+		if ($this->end_date) {
515 515
 
516
-			if ( $this->timestamp ) {
516
+			if ($this->timestamp) {
517 517
 				$format = 'Y-m-d H:i:s';
518 518
 			} else {
519 519
 				$format = 'Y-m-d 23:59:59';
520 520
 			}
521 521
 
522
-			$end_date = date( $format, $this->end_date );
522
+			$end_date = date($format, $this->end_date);
523 523
 
524 524
 			$end_where = " AND $wpdb->posts.post_date <= '{$end_date}'";
525 525
 		}
Please login to merge, or discard this patch.
includes/emails/class-give-email-tags.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -477,7 +477,7 @@
 block discarded – undo
477 477
  *
478 478
  * @param int $payment_id
479 479
  *
480
- * @return int payment_id
480
+ * @return string payment_id
481 481
  */
482 482
 function give_email_tag_payment_id( $payment_id ) {
483 483
 	return give_get_payment_number( $payment_id );
Please login to merge, or discard this patch.
Spacing   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  */
24 24
 
25 25
 // Exit if accessed directly
26
-if ( ! defined( 'ABSPATH' ) ) {
26
+if ( ! defined('ABSPATH')) {
27 27
 	exit;
28 28
 }
29 29
 
@@ -51,9 +51,9 @@  discard block
 block discarded – undo
51 51
 	 * @param string   $tag  Email tag to be replace in email
52 52
 	 * @param callable $func Hook to run when email tag is found
53 53
 	 */
54
-	public function add( $tag, $description, $func ) {
55
-		if ( is_callable( $func ) ) {
56
-			$this->tags[ $tag ] = array(
54
+	public function add($tag, $description, $func) {
55
+		if (is_callable($func)) {
56
+			$this->tags[$tag] = array(
57 57
 				'tag'         => $tag,
58 58
 				'description' => $description,
59 59
 				'func'        => $func
@@ -68,8 +68,8 @@  discard block
 block discarded – undo
68 68
 	 *
69 69
 	 * @param string $tag Email tag to remove hook from
70 70
 	 */
71
-	public function remove( $tag ) {
72
-		unset( $this->tags[ $tag ] );
71
+	public function remove($tag) {
72
+		unset($this->tags[$tag]);
73 73
 	}
74 74
 
75 75
 	/**
@@ -81,8 +81,8 @@  discard block
 block discarded – undo
81 81
 	 *
82 82
 	 * @return bool
83 83
 	 */
84
-	public function email_tag_exists( $tag ) {
85
-		return array_key_exists( $tag, $this->tags );
84
+	public function email_tag_exists($tag) {
85
+		return array_key_exists($tag, $this->tags);
86 86
 	}
87 87
 
88 88
 	/**
@@ -106,16 +106,16 @@  discard block
 block discarded – undo
106 106
 	 *
107 107
 	 * @return string Content with email tags filtered out.
108 108
 	 */
109
-	public function do_tags( $content, $payment_id ) {
109
+	public function do_tags($content, $payment_id) {
110 110
 
111 111
 		// Check if there is atleast one tag added
112
-		if ( empty( $this->tags ) || ! is_array( $this->tags ) ) {
112
+		if (empty($this->tags) || ! is_array($this->tags)) {
113 113
 			return $content;
114 114
 		}
115 115
 
116 116
 		$this->payment_id = $payment_id;
117 117
 
118
-		$new_content = preg_replace_callback( "/{([A-z0-9\-\_]+)}/s", array( $this, 'do_tag' ), $content );
118
+		$new_content = preg_replace_callback("/{([A-z0-9\-\_]+)}/s", array($this, 'do_tag'), $content);
119 119
 
120 120
 		$this->payment_id = null;
121 121
 
@@ -131,17 +131,17 @@  discard block
 block discarded – undo
131 131
 	 *
132 132
 	 * @return mixed
133 133
 	 */
134
-	public function do_tag( $m ) {
134
+	public function do_tag($m) {
135 135
 
136 136
 		// Get tag
137 137
 		$tag = $m[1];
138 138
 
139 139
 		// Return tag if tag not set
140
-		if ( ! $this->email_tag_exists( $tag ) ) {
140
+		if ( ! $this->email_tag_exists($tag)) {
141 141
 			return $m[0];
142 142
 		}
143 143
 
144
-		return call_user_func( $this->tags[ $tag ]['func'], $this->payment_id, $tag );
144
+		return call_user_func($this->tags[$tag]['func'], $this->payment_id, $tag);
145 145
 	}
146 146
 
147 147
 }
@@ -155,8 +155,8 @@  discard block
 block discarded – undo
155 155
  * @param string $description Description of the email tag added
156 156
  * @param callable $func Hook to run when email tag is found
157 157
  */
158
-function give_add_email_tag( $tag, $description, $func ) {
159
-	Give()->email_tags->add( $tag, $description, $func );
158
+function give_add_email_tag($tag, $description, $func) {
159
+	Give()->email_tags->add($tag, $description, $func);
160 160
 }
161 161
 
162 162
 /**
@@ -166,8 +166,8 @@  discard block
 block discarded – undo
166 166
  *
167 167
  * @param string $tag Email tag to remove hook from
168 168
  */
169
-function give_remove_email_tag( $tag ) {
170
-	Give()->email_tags->remove( $tag );
169
+function give_remove_email_tag($tag) {
170
+	Give()->email_tags->remove($tag);
171 171
 }
172 172
 
173 173
 /**
@@ -179,8 +179,8 @@  discard block
 block discarded – undo
179 179
  *
180 180
  * @return bool
181 181
  */
182
-function give_email_tag_exists( $tag ) {
183
-	return Give()->email_tags->email_tag_exists( $tag );
182
+function give_email_tag_exists($tag) {
183
+	return Give()->email_tags->email_tag_exists($tag);
184 184
 }
185 185
 
186 186
 /**
@@ -209,13 +209,13 @@  discard block
 block discarded – undo
209 209
 	$email_tags = give_get_email_tags();
210 210
 
211 211
 	// Check
212
-	if ( count( $email_tags ) > 0 ) {
212
+	if (count($email_tags) > 0) {
213 213
 
214 214
 		// Loop
215
-		foreach ( $email_tags as $email_tag ) {
215
+		foreach ($email_tags as $email_tag) {
216 216
 
217 217
 			// Add email tag to list
218
-			$list .= '<code>{' . $email_tag['tag'] . '}</code> - ' . $email_tag['description'] . '<br/>';
218
+			$list .= '<code>{'.$email_tag['tag'].'}</code> - '.$email_tag['description'].'<br/>';
219 219
 
220 220
 		}
221 221
 
@@ -235,13 +235,13 @@  discard block
 block discarded – undo
235 235
  *
236 236
  * @return string Content with email tags filtered out.
237 237
  */
238
-function give_do_email_tags( $content, $payment_id ) {
238
+function give_do_email_tags($content, $payment_id) {
239 239
 
240 240
 	// Replace all tags
241
-	$content = Give()->email_tags->do_tags( $content, $payment_id );
241
+	$content = Give()->email_tags->do_tags($content, $payment_id);
242 242
 
243 243
 	// Maintaining backwards compatibility
244
-	$content = apply_filters( 'give_email_template_tags', $content, give_get_payment_meta( $payment_id ), $payment_id );
244
+	$content = apply_filters('give_email_template_tags', $content, give_get_payment_meta($payment_id), $payment_id);
245 245
 
246 246
 	// Return content
247 247
 	return $content;
@@ -253,10 +253,10 @@  discard block
 block discarded – undo
253 253
  * @since 1.0
254 254
  */
255 255
 function give_load_email_tags() {
256
-	do_action( 'give_add_email_tags' );
256
+	do_action('give_add_email_tags');
257 257
 }
258 258
 
259
-add_action( 'init', 'give_load_email_tags', - 999 );
259
+add_action('init', 'give_load_email_tags', - 999);
260 260
 
261 261
 /**
262 262
  * Add default Give email template tags
@@ -269,82 +269,82 @@  discard block
 block discarded – undo
269 269
 	$email_tags = array(
270 270
 		array(
271 271
 			'tag'         => 'donation',
272
-			'description' => __( "The name of completed donation form.", 'give' ),
272
+			'description' => __("The name of completed donation form.", 'give'),
273 273
 			'function'    => 'give_email_tag_donation'
274 274
 		),
275 275
 		array(
276 276
 			'tag'         => 'name',
277
-			'description' => __( "The donor's first name", 'give' ),
277
+			'description' => __("The donor's first name", 'give'),
278 278
 			'function'    => 'give_email_tag_first_name'
279 279
 		),
280 280
 		array(
281 281
 			'tag'         => 'fullname',
282
-			'description' => __( "The donor's full name, first and last", 'give' ),
282
+			'description' => __("The donor's full name, first and last", 'give'),
283 283
 			'function'    => 'give_email_tag_fullname'
284 284
 		),
285 285
 		array(
286 286
 			'tag'         => 'username',
287
-			'description' => __( "The donor's user name on the site, if they registered an account", 'give' ),
287
+			'description' => __("The donor's user name on the site, if they registered an account", 'give'),
288 288
 			'function'    => 'give_email_tag_username'
289 289
 		),
290 290
 		array(
291 291
 			'tag'         => 'user_email',
292
-			'description' => __( "The donor's email address", 'give' ),
292
+			'description' => __("The donor's email address", 'give'),
293 293
 			'function'    => 'give_email_tag_user_email'
294 294
 		),
295 295
 		array(
296 296
 			'tag'         => 'billing_address',
297
-			'description' => __( 'The donor\'s billing address', 'give' ),
297
+			'description' => __('The donor\'s billing address', 'give'),
298 298
 			'function'    => 'give_email_tag_billing_address'
299 299
 		),
300 300
 		array(
301 301
 			'tag'         => 'date',
302
-			'description' => __( 'The date of the donation', 'give' ),
302
+			'description' => __('The date of the donation', 'give'),
303 303
 			'function'    => 'give_email_tag_date'
304 304
 		),
305 305
 		array(
306 306
 			'tag'         => 'price',
307
-			'description' => __( 'The total price of the donation', 'give' ),
307
+			'description' => __('The total price of the donation', 'give'),
308 308
 			'function'    => 'give_email_tag_price'
309 309
 		),
310 310
 		array(
311 311
 			'tag'         => 'payment_id',
312
-			'description' => __( 'The unique ID number for this donation', 'give' ),
312
+			'description' => __('The unique ID number for this donation', 'give'),
313 313
 			'function'    => 'give_email_tag_payment_id'
314 314
 		),
315 315
 		array(
316 316
 			'tag'         => 'receipt_id',
317
-			'description' => __( 'The unique ID number for this donation receipt', 'give' ),
317
+			'description' => __('The unique ID number for this donation receipt', 'give'),
318 318
 			'function'    => 'give_email_tag_receipt_id'
319 319
 		),
320 320
 		array(
321 321
 			'tag'         => 'payment_method',
322
-			'description' => __( 'The method of payment used for this donation', 'give' ),
322
+			'description' => __('The method of payment used for this donation', 'give'),
323 323
 			'function'    => 'give_email_tag_payment_method'
324 324
 		),
325 325
 		array(
326 326
 			'tag'         => 'sitename',
327
-			'description' => __( 'Your site name', 'give' ),
327
+			'description' => __('Your site name', 'give'),
328 328
 			'function'    => 'give_email_tag_sitename'
329 329
 		),
330 330
 		array(
331 331
 			'tag'         => 'receipt_link',
332
-			'description' => __( 'Adds a link so users can view their receipt directly on your website if they are unable to view it in the browser correctly.', 'give' ),
332
+			'description' => __('Adds a link so users can view their receipt directly on your website if they are unable to view it in the browser correctly.', 'give'),
333 333
 			'function'    => 'give_email_tag_receipt_link'
334 334
 		),
335 335
 	);
336 336
 
337 337
 	// Apply give_email_tags filter
338
-	$email_tags = apply_filters( 'give_email_tags', $email_tags );
338
+	$email_tags = apply_filters('give_email_tags', $email_tags);
339 339
 
340 340
 	// Add email tags
341
-	foreach ( $email_tags as $email_tag ) {
342
-		give_add_email_tag( $email_tag['tag'], $email_tag['description'], $email_tag['function'] );
341
+	foreach ($email_tags as $email_tag) {
342
+		give_add_email_tag($email_tag['tag'], $email_tag['description'], $email_tag['function']);
343 343
 	}
344 344
 
345 345
 }
346 346
 
347
-add_action( 'give_add_email_tags', 'give_setup_email_tags' );
347
+add_action('give_add_email_tags', 'give_setup_email_tags');
348 348
 
349 349
 
350 350
 /**
@@ -355,12 +355,12 @@  discard block
 block discarded – undo
355 355
  *
356 356
  * @return string name
357 357
  */
358
-function give_email_tag_first_name( $payment_id ) {
359
-	$payment_data = give_get_payment_meta( $payment_id );
360
-	if ( empty( $payment_data['user_info'] ) ) {
358
+function give_email_tag_first_name($payment_id) {
359
+	$payment_data = give_get_payment_meta($payment_id);
360
+	if (empty($payment_data['user_info'])) {
361 361
 		return '';
362 362
 	}
363
-	$email_name = give_get_email_names( $payment_data['user_info'] );
363
+	$email_name = give_get_email_names($payment_data['user_info']);
364 364
 
365 365
 	return $email_name['name'];
366 366
 }
@@ -373,12 +373,12 @@  discard block
 block discarded – undo
373 373
  *
374 374
  * @return string fullname
375 375
  */
376
-function give_email_tag_fullname( $payment_id ) {
377
-	$payment_data = give_get_payment_meta( $payment_id );
378
-	if ( empty( $payment_data['user_info'] ) ) {
376
+function give_email_tag_fullname($payment_id) {
377
+	$payment_data = give_get_payment_meta($payment_id);
378
+	if (empty($payment_data['user_info'])) {
379 379
 		return '';
380 380
 	}
381
-	$email_name = give_get_email_names( $payment_data['user_info'] );
381
+	$email_name = give_get_email_names($payment_data['user_info']);
382 382
 
383 383
 	return $email_name['fullname'];
384 384
 }
@@ -391,12 +391,12 @@  discard block
 block discarded – undo
391 391
  *
392 392
  * @return string username
393 393
  */
394
-function give_email_tag_username( $payment_id ) {
395
-	$payment_data = give_get_payment_meta( $payment_id );
396
-	if ( empty( $payment_data['user_info'] ) ) {
394
+function give_email_tag_username($payment_id) {
395
+	$payment_data = give_get_payment_meta($payment_id);
396
+	if (empty($payment_data['user_info'])) {
397 397
 		return '';
398 398
 	}
399
-	$email_name = give_get_email_names( $payment_data['user_info'] );
399
+	$email_name = give_get_email_names($payment_data['user_info']);
400 400
 
401 401
 	return $email_name['username'];
402 402
 }
@@ -409,8 +409,8 @@  discard block
 block discarded – undo
409 409
  *
410 410
  * @return string user_email
411 411
  */
412
-function give_email_tag_user_email( $payment_id ) {
413
-	return give_get_payment_user_email( $payment_id );
412
+function give_email_tag_user_email($payment_id) {
413
+	return give_get_payment_user_email($payment_id);
414 414
 }
415 415
 
416 416
 /**
@@ -421,10 +421,10 @@  discard block
 block discarded – undo
421 421
  *
422 422
  * @return string billing_address
423 423
  */
424
-function give_email_tag_billing_address( $payment_id ) {
424
+function give_email_tag_billing_address($payment_id) {
425 425
 
426
-	$user_info    = give_get_payment_meta_user_info( $payment_id );
427
-	$user_address = ! empty( $user_info['address'] ) ? $user_info['address'] : array(
426
+	$user_info    = give_get_payment_meta_user_info($payment_id);
427
+	$user_address = ! empty($user_info['address']) ? $user_info['address'] : array(
428 428
 		'line1'   => '',
429 429
 		'line2'   => '',
430 430
 		'city'    => '',
@@ -433,11 +433,11 @@  discard block
 block discarded – undo
433 433
 		'zip'     => ''
434 434
 	);
435 435
 
436
-	$return = $user_address['line1'] . "\n";
437
-	if ( ! empty( $user_address['line2'] ) ) {
438
-		$return .= $user_address['line2'] . "\n";
436
+	$return = $user_address['line1']."\n";
437
+	if ( ! empty($user_address['line2'])) {
438
+		$return .= $user_address['line2']."\n";
439 439
 	}
440
-	$return .= $user_address['city'] . ' ' . $user_address['zip'] . ' ' . $user_address['state'] . "\n";
440
+	$return .= $user_address['city'].' '.$user_address['zip'].' '.$user_address['state']."\n";
441 441
 	$return .= $user_address['country'];
442 442
 
443 443
 	return $return;
@@ -451,10 +451,10 @@  discard block
 block discarded – undo
451 451
  *
452 452
  * @return string date
453 453
  */
454
-function give_email_tag_date( $payment_id ) {
455
-	$payment_data = give_get_payment_meta( $payment_id );
454
+function give_email_tag_date($payment_id) {
455
+	$payment_data = give_get_payment_meta($payment_id);
456 456
 
457
-	return date_i18n( get_option( 'date_format' ), strtotime( $payment_data['date'] ) );
457
+	return date_i18n(get_option('date_format'), strtotime($payment_data['date']));
458 458
 }
459 459
 
460 460
 /**
@@ -465,10 +465,10 @@  discard block
 block discarded – undo
465 465
  *
466 466
  * @return string price
467 467
  */
468
-function give_email_tag_price( $payment_id ) {
469
-	$price = give_currency_filter( give_format_amount( give_get_payment_amount( $payment_id ) ), give_get_payment_currency_code( $payment_id ) );
468
+function give_email_tag_price($payment_id) {
469
+	$price = give_currency_filter(give_format_amount(give_get_payment_amount($payment_id)), give_get_payment_currency_code($payment_id));
470 470
 
471
-	return html_entity_decode( $price, ENT_COMPAT, 'UTF-8' );
471
+	return html_entity_decode($price, ENT_COMPAT, 'UTF-8');
472 472
 }
473 473
 
474 474
 /**
@@ -479,8 +479,8 @@  discard block
 block discarded – undo
479 479
  *
480 480
  * @return int payment_id
481 481
  */
482
-function give_email_tag_payment_id( $payment_id ) {
483
-	return give_get_payment_number( $payment_id );
482
+function give_email_tag_payment_id($payment_id) {
483
+	return give_get_payment_number($payment_id);
484 484
 }
485 485
 
486 486
 /**
@@ -491,8 +491,8 @@  discard block
 block discarded – undo
491 491
  *
492 492
  * @return string receipt_id
493 493
  */
494
-function give_email_tag_receipt_id( $payment_id ) {
495
-	return give_get_payment_key( $payment_id );
494
+function give_email_tag_receipt_id($payment_id) {
495
+	return give_get_payment_key($payment_id);
496 496
 }
497 497
 
498 498
 /**
@@ -503,9 +503,9 @@  discard block
 block discarded – undo
503 503
  *
504 504
  * @return string $form_title
505 505
  */
506
-function give_email_tag_donation( $payment_id ) {
507
-	$payment_data = give_get_payment_meta( $payment_id );
508
-	$form_title   = ( ! empty( $payment_data['form_title'] ) ? $payment_data['form_title'] : __( 'There was an error retrieving this donation title', 'give' ) );
506
+function give_email_tag_donation($payment_id) {
507
+	$payment_data = give_get_payment_meta($payment_id);
508
+	$form_title   = ( ! empty($payment_data['form_title']) ? $payment_data['form_title'] : __('There was an error retrieving this donation title', 'give'));
509 509
 
510 510
 	return $form_title;
511 511
 }
@@ -518,8 +518,8 @@  discard block
 block discarded – undo
518 518
  *
519 519
  * @return string gateway
520 520
  */
521
-function give_email_tag_payment_method( $payment_id ) {
522
-	return give_get_gateway_checkout_label( give_get_payment_gateway( $payment_id ) );
521
+function give_email_tag_payment_method($payment_id) {
522
+	return give_get_gateway_checkout_label(give_get_payment_gateway($payment_id));
523 523
 }
524 524
 
525 525
 /**
@@ -530,8 +530,8 @@  discard block
 block discarded – undo
530 530
  *
531 531
  * @return string sitename
532 532
  */
533
-function give_email_tag_sitename( $payment_id ) {
534
-	return wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES );
533
+function give_email_tag_sitename($payment_id) {
534
+	return wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES);
535 535
 }
536 536
 
537 537
 /**
@@ -542,9 +542,9 @@  discard block
 block discarded – undo
542 542
  *
543 543
  * @return string receipt_link
544 544
  */
545
-function give_email_tag_receipt_link( $payment_id ) {
546
-	return sprintf( __( '%1$sView it in your browser.%2$s', 'give' ), '<a href="' . esc_url( add_query_arg( array(
547
-			'payment_key' => give_get_payment_key( $payment_id ),
545
+function give_email_tag_receipt_link($payment_id) {
546
+	return sprintf(__('%1$sView it in your browser.%2$s', 'give'), '<a href="'.esc_url(add_query_arg(array(
547
+			'payment_key' => give_get_payment_key($payment_id),
548 548
 			'give_action' => 'view_receipt'
549
-		), home_url() ) ) . '">', '</a>' );
549
+		), home_url())).'">', '</a>');
550 550
 }
551 551
\ No newline at end of file
Please login to merge, or discard this patch.
includes/forms/functions.php 2 patches
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
  * Used to redirect a user back to the purchase
155 155
  * page if there are errors present.
156 156
  *
157
- * @param array $args
157
+ * @param string $args
158 158
  *
159 159
  * @access public
160 160
  * @since  1.0
@@ -659,7 +659,7 @@  discard block
 block discarded – undo
659 659
  *
660 660
  * @param int $form_id ID of the form
661 661
  *
662
- * @return float Amount of the lowest price
662
+ * @return string Amount of the lowest price
663 663
  */
664 664
 function give_get_lowest_price_option( $form_id = 0 ) {
665 665
 	if ( empty( $form_id ) ) {
@@ -707,7 +707,7 @@  discard block
 block discarded – undo
707 707
  *
708 708
  * @param int $form_id ID of the form
709 709
  *
710
- * @return float Amount of the highest price
710
+ * @return string Amount of the highest price
711 711
  */
712 712
 function give_get_highest_price_option( $form_id = 0 ) {
713 713
 
@@ -753,7 +753,7 @@  discard block
 block discarded – undo
753 753
  *
754 754
  * @param int $form_id ID number of the form to retrieve a price for
755 755
  *
756
- * @return mixed string|int Price of the form
756
+ * @return string string|int Price of the form
757 757
  */
758 758
 function give_get_form_price( $form_id = 0 ) {
759 759
 
@@ -858,7 +858,7 @@  discard block
 block discarded – undo
858 858
  *
859 859
  * @param int $form_id ID number of the form to retrieve a goal for
860 860
  *
861
- * @return mixed string|int Goal of the form
861
+ * @return string string|int Goal of the form
862 862
  */
863 863
 function give_get_form_goal( $form_id = 0 ) {
864 864
 
Please login to merge, or discard this patch.
Spacing   +174 added lines, -174 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' && $typenow != 'give_campaigns' ) {
26
+	if ($typenow != 'give_forms' && $typenow != 'give_campaigns') {
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
 /**
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 
91 91
 	$can_checkout = true; // Always true for now
92 92
 
93
-	return (bool) apply_filters( 'give_can_checkout', $can_checkout );
93
+	return (bool) apply_filters('give_can_checkout', $can_checkout);
94 94
 }
95 95
 
96 96
 /**
@@ -103,9 +103,9 @@  discard block
 block discarded – undo
103 103
 function give_get_success_page_uri() {
104 104
 	global $give_options;
105 105
 
106
-	$success_page = isset( $give_options['success_page'] ) ? get_permalink( absint( $give_options['success_page'] ) ) : get_bloginfo( 'url' );
106
+	$success_page = isset($give_options['success_page']) ? get_permalink(absint($give_options['success_page'])) : get_bloginfo('url');
107 107
 
108
-	return apply_filters( 'give_get_success_page_uri', $success_page );
108
+	return apply_filters('give_get_success_page_uri', $success_page);
109 109
 }
110 110
 
111 111
 /**
@@ -116,9 +116,9 @@  discard block
 block discarded – undo
116 116
  */
117 117
 function give_is_success_page() {
118 118
 	global $give_options;
119
-	$is_success_page = isset( $give_options['success_page'] ) ? is_page( $give_options['success_page'] ) : false;
119
+	$is_success_page = isset($give_options['success_page']) ? is_page($give_options['success_page']) : false;
120 120
 
121
-	return apply_filters( 'give_is_success_page', $is_success_page );
121
+	return apply_filters('give_is_success_page', $is_success_page);
122 122
 }
123 123
 
124 124
 /**
@@ -132,18 +132,18 @@  discard block
 block discarded – undo
132 132
  * @since       1.0
133 133
  * @return      void
134 134
  */
135
-function give_send_to_success_page( $query_string = null ) {
135
+function give_send_to_success_page($query_string = null) {
136 136
 	global $give_options;
137 137
 
138 138
 	$redirect = give_get_success_page_uri();
139 139
 
140
-	if ( $query_string ) {
140
+	if ($query_string) {
141 141
 		$redirect .= $query_string;
142 142
 	}
143 143
 
144
-	$gateway = isset( $_REQUEST['give-gateway'] ) ? $_REQUEST['give-gateway'] : '';
144
+	$gateway = isset($_REQUEST['give-gateway']) ? $_REQUEST['give-gateway'] : '';
145 145
 
146
-	wp_redirect( apply_filters( 'give_success_page_redirect', $redirect, $gateway, $query_string ) );
146
+	wp_redirect(apply_filters('give_success_page_redirect', $redirect, $gateway, $query_string));
147 147
 	give_die();
148 148
 }
149 149
 
@@ -160,25 +160,25 @@  discard block
 block discarded – undo
160 160
  * @since  1.0
161 161
  * @return Void
162 162
  */
163
-function give_send_back_to_checkout( $args = array() ) {
163
+function give_send_back_to_checkout($args = array()) {
164 164
 
165
-	$redirect = ( isset( $_POST['give-current-url'] ) ) ? $_POST['give-current-url'] : '';
166
-	$form_id  = isset( $_POST['give-form-id'] ) ? $_POST['give-form-id'] : 0;
165
+	$redirect = (isset($_POST['give-current-url'])) ? $_POST['give-current-url'] : '';
166
+	$form_id  = isset($_POST['give-form-id']) ? $_POST['give-form-id'] : 0;
167 167
 
168 168
 	$defaults = array(
169 169
 		'form-id' => (int) $form_id
170 170
 	);
171 171
 
172 172
 	// Check for backward compatibility
173
-	if ( is_string( $args ) ) {
174
-		$args = str_replace( '?', '', $args );
173
+	if (is_string($args)) {
174
+		$args = str_replace('?', '', $args);
175 175
 	}
176 176
 
177
-	$args = wp_parse_args( $args, $defaults );
177
+	$args = wp_parse_args($args, $defaults);
178 178
 
179
-	$redirect = add_query_arg( $args, $redirect ) . '#give-form-' . $form_id . '-wrap';
179
+	$redirect = add_query_arg($args, $redirect).'#give-form-'.$form_id.'-wrap';
180 180
 
181
-	wp_redirect( apply_filters( 'give_send_back_to_checkout', $redirect, $args ) );
181
+	wp_redirect(apply_filters('give_send_back_to_checkout', $redirect, $args));
182 182
 	give_die();
183 183
 }
184 184
 
@@ -193,15 +193,15 @@  discard block
 block discarded – undo
193 193
  * @since       1.0
194 194
  * @return      string
195 195
  */
196
-function give_get_success_page_url( $query_string = null ) {
196
+function give_get_success_page_url($query_string = null) {
197 197
 	global $give_options;
198 198
 
199
-	$success_page = get_permalink( $give_options['success_page'] );
200
-	if ( $query_string ) {
199
+	$success_page = get_permalink($give_options['success_page']);
200
+	if ($query_string) {
201 201
 		$success_page .= $query_string;
202 202
 	}
203 203
 
204
-	return apply_filters( 'give_success_page_url', $success_page );
204
+	return apply_filters('give_success_page_url', $success_page);
205 205
 }
206 206
 
207 207
 /**
@@ -214,15 +214,15 @@  discard block
 block discarded – undo
214 214
  *
215 215
  * @return mixed|void Full URL to the Transaction Failed page, if present, home page if it doesn't exist
216 216
  */
217
-function give_get_failed_transaction_uri( $extras = false ) {
217
+function give_get_failed_transaction_uri($extras = false) {
218 218
 	global $give_options;
219 219
 
220
-	$uri = ! empty( $give_options['failure_page'] ) ? trailingslashit( get_permalink( $give_options['failure_page'] ) ) : home_url();
221
-	if ( $extras ) {
220
+	$uri = ! empty($give_options['failure_page']) ? trailingslashit(get_permalink($give_options['failure_page'])) : home_url();
221
+	if ($extras) {
222 222
 		$uri .= $extras;
223 223
 	}
224 224
 
225
-	return apply_filters( 'give_get_failed_transaction_uri', $uri );
225
+	return apply_filters('give_get_failed_transaction_uri', $uri);
226 226
 }
227 227
 
228 228
 /**
@@ -233,9 +233,9 @@  discard block
 block discarded – undo
233 233
  */
234 234
 function give_is_failed_transaction_page() {
235 235
 	global $give_options;
236
-	$ret = isset( $give_options['failure_page'] ) ? is_page( $give_options['failure_page'] ) : false;
236
+	$ret = isset($give_options['failure_page']) ? is_page($give_options['failure_page']) : false;
237 237
 
238
-	return apply_filters( 'give_is_failure_page', $ret );
238
+	return apply_filters('give_is_failure_page', $ret);
239 239
 }
240 240
 
241 241
 /**
@@ -247,18 +247,18 @@  discard block
 block discarded – undo
247 247
  */
248 248
 function give_listen_for_failed_payments() {
249 249
 
250
-	$failed_page = give_get_option( 'failure_page', 0 );
250
+	$failed_page = give_get_option('failure_page', 0);
251 251
 
252
-	if ( ! empty( $failed_page ) && is_page( $failed_page ) && ! empty( $_GET['payment-id'] ) ) {
252
+	if ( ! empty($failed_page) && is_page($failed_page) && ! empty($_GET['payment-id'])) {
253 253
 
254
-		$payment_id = absint( $_GET['payment-id'] );
255
-		give_update_payment_status( $payment_id, 'failed' );
254
+		$payment_id = absint($_GET['payment-id']);
255
+		give_update_payment_status($payment_id, 'failed');
256 256
 
257 257
 	}
258 258
 
259 259
 }
260 260
 
261
-add_action( 'template_redirect', 'give_listen_for_failed_payments' );
261
+add_action('template_redirect', 'give_listen_for_failed_payments');
262 262
 
263 263
 
264 264
 /**
@@ -271,11 +271,11 @@  discard block
 block discarded – undo
271 271
  * @since       1.0
272 272
  * @return      bool
273 273
  */
274
-function give_field_is_required( $field = '', $form_id ) {
274
+function give_field_is_required($field = '', $form_id) {
275 275
 
276
-	$required_fields = give_purchase_form_required_fields( $form_id );
276
+	$required_fields = give_purchase_form_required_fields($form_id);
277 277
 
278
-	return array_key_exists( $field, $required_fields );
278
+	return array_key_exists($field, $required_fields);
279 279
 }
280 280
 
281 281
 /**
@@ -285,9 +285,9 @@  discard block
 block discarded – undo
285 285
  * @return      array
286 286
  */
287 287
 function give_get_banned_emails() {
288
-	$emails = array_map( 'trim', give_get_option( 'banned_emails', array() ) );
288
+	$emails = array_map('trim', give_get_option('banned_emails', array()));
289 289
 
290
-	return apply_filters( 'give_get_banned_emails', $emails );
290
+	return apply_filters('give_get_banned_emails', $emails);
291 291
 }
292 292
 
293 293
 /**
@@ -296,15 +296,15 @@  discard block
 block discarded – undo
296 296
  * @since       2.0
297 297
  * @return      bool
298 298
  */
299
-function give_is_email_banned( $email = '' ) {
299
+function give_is_email_banned($email = '') {
300 300
 
301
-	if ( empty( $email ) ) {
301
+	if (empty($email)) {
302 302
 		return false;
303 303
 	}
304 304
 
305
-	$ret = in_array( trim( $email ), give_get_banned_emails() );
305
+	$ret = in_array(trim($email), give_get_banned_emails());
306 306
 
307
-	return apply_filters( 'give_is_email_banned', $ret, $email );
307
+	return apply_filters('give_is_email_banned', $ret, $email);
308 308
 }
309 309
 
310 310
 /**
@@ -314,9 +314,9 @@  discard block
 block discarded – undo
314 314
  * @return      bool True if enforce SSL is enabled, false otherwise
315 315
  */
316 316
 function give_is_ssl_enforced() {
317
-	$ssl_enforced = give_get_option( 'enforce_ssl', false );
317
+	$ssl_enforced = give_get_option('enforce_ssl', false);
318 318
 
319
-	return (bool) apply_filters( 'give_is_ssl_enforced', $ssl_enforced );
319
+	return (bool) apply_filters('give_is_ssl_enforced', $ssl_enforced);
320 320
 }
321 321
 
322 322
 /**
@@ -327,17 +327,17 @@  discard block
 block discarded – undo
327 327
  * @return void
328 328
  */
329 329
 function give_enforced_ssl_redirect_handler() {
330
-	if ( ! give_is_ssl_enforced() || is_admin() || is_ssl() ) {
330
+	if ( ! give_is_ssl_enforced() || is_admin() || is_ssl()) {
331 331
 		return;
332 332
 	}
333 333
 
334
-	if ( isset( $_SERVER["HTTPS"] ) && $_SERVER["HTTPS"] == "on" ) {
334
+	if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") {
335 335
 		return;
336 336
 	}
337 337
 
338
-	$uri = 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
338
+	$uri = 'https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
339 339
 
340
-	wp_safe_redirect( $uri );
340
+	wp_safe_redirect($uri);
341 341
 	exit;
342 342
 }
343 343
 
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
  * @return void
351 351
  */
352 352
 function give_enforced_ssl_asset_handler() {
353
-	if ( ! give_is_ssl_enforced() || is_admin() ) {
353
+	if ( ! give_is_ssl_enforced() || is_admin()) {
354 354
 		return;
355 355
 	}
356 356
 
@@ -368,10 +368,10 @@  discard block
 block discarded – undo
368 368
 		'site_url'
369 369
 	);
370 370
 
371
-	$filters = apply_filters( 'give_enforced_ssl_asset_filters', $filters );
371
+	$filters = apply_filters('give_enforced_ssl_asset_filters', $filters);
372 372
 
373
-	foreach ( $filters as $filter ) {
374
-		add_filter( $filter, 'give_enforced_ssl_asset_filter', 1 );
373
+	foreach ($filters as $filter) {
374
+		add_filter($filter, 'give_enforced_ssl_asset_filter', 1);
375 375
 	}
376 376
 }
377 377
 
@@ -386,11 +386,11 @@  discard block
 block discarded – undo
386 386
  *
387 387
  * @return mixed
388 388
  */
389
-function give_enforced_ssl_asset_filter( $content ) {
389
+function give_enforced_ssl_asset_filter($content) {
390 390
 
391
-	if ( is_array( $content ) ) {
391
+	if (is_array($content)) {
392 392
 
393
-		$content = array_map( 'give_enforced_ssl_asset_filter', $content );
393
+		$content = array_map('give_enforced_ssl_asset_filter', $content);
394 394
 
395 395
 	} else {
396 396
 
@@ -437,14 +437,14 @@  discard block
 block discarded – undo
437 437
  *
438 438
  * @return void
439 439
  */
440
-function give_record_sale_in_log( $give_form_id = 0, $payment_id, $price_id = false, $sale_date = null ) {
440
+function give_record_sale_in_log($give_form_id = 0, $payment_id, $price_id = false, $sale_date = null) {
441 441
 	global $give_logs;
442 442
 
443 443
 	$log_data = array(
444 444
 		'post_parent'   => $give_form_id,
445 445
 		'log_type'      => 'sale',
446
-		'post_date'     => isset( $sale_date ) ? $sale_date : null,
447
-		'post_date_gmt' => isset( $sale_date ) ? $sale_date : null
446
+		'post_date'     => isset($sale_date) ? $sale_date : null,
447
+		'post_date_gmt' => isset($sale_date) ? $sale_date : null
448 448
 	);
449 449
 
450 450
 	$log_meta = array(
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
 		'price_id'   => (int) $price_id
453 453
 	);
454 454
 
455
-	$give_logs->insert_log( $log_data, $log_meta );
455
+	$give_logs->insert_log($log_data, $log_meta);
456 456
 }
457 457
 
458 458
 
@@ -465,8 +465,8 @@  discard block
 block discarded – undo
465 465
  *
466 466
  * @return bool|int
467 467
  */
468
-function give_increase_purchase_count( $give_form_id = 0 ) {
469
-	$form = new Give_Donate_Form( $give_form_id );
468
+function give_increase_purchase_count($give_form_id = 0) {
469
+	$form = new Give_Donate_Form($give_form_id);
470 470
 
471 471
 	return $form->increase_sales();
472 472
 }
@@ -480,8 +480,8 @@  discard block
 block discarded – undo
480 480
  *
481 481
  * @return bool|int
482 482
  */
483
-function give_decrease_purchase_count( $give_form_id = 0 ) {
484
-	$form = new Give_Donate_Form( $give_form_id );
483
+function give_decrease_purchase_count($give_form_id = 0) {
484
+	$form = new Give_Donate_Form($give_form_id);
485 485
 
486 486
 	return $form->decrease_sales();
487 487
 }
@@ -496,10 +496,10 @@  discard block
 block discarded – undo
496 496
  *
497 497
  * @return bool|int
498 498
  */
499
-function give_increase_earnings( $give_form_id = 0, $amount ) {
500
-	$form = new Give_Donate_Form( $give_form_id );
499
+function give_increase_earnings($give_form_id = 0, $amount) {
500
+	$form = new Give_Donate_Form($give_form_id);
501 501
 
502
-	return $form->increase_earnings( $amount );
502
+	return $form->increase_earnings($amount);
503 503
 }
504 504
 
505 505
 /**
@@ -512,10 +512,10 @@  discard block
 block discarded – undo
512 512
  *
513 513
  * @return bool|int
514 514
  */
515
-function give_decrease_earnings( $give_form_id = 0, $amount ) {
516
-	$form = new Give_Donate_Form( $give_form_id );
515
+function give_decrease_earnings($give_form_id = 0, $amount) {
516
+	$form = new Give_Donate_Form($give_form_id);
517 517
 
518
-	return $form->decrease_earnings( $amount );
518
+	return $form->decrease_earnings($amount);
519 519
 }
520 520
 
521 521
 
@@ -528,8 +528,8 @@  discard block
 block discarded – undo
528 528
  *
529 529
  * @return int $earnings Earnings for a certain form
530 530
  */
531
-function give_get_form_earnings_stats( $give_form_id = 0 ) {
532
-	$give_form = new Give_Donate_Form( $give_form_id );
531
+function give_get_form_earnings_stats($give_form_id = 0) {
532
+	$give_form = new Give_Donate_Form($give_form_id);
533 533
 
534 534
 	return $give_form->earnings;
535 535
 }
@@ -544,8 +544,8 @@  discard block
 block discarded – undo
544 544
  *
545 545
  * @return int $sales Amount of sales for a certain form
546 546
  */
547
-function give_get_form_sales_stats( $give_form_id = 0 ) {
548
-	$give_form = new Give_Donate_Form( $give_form_id );
547
+function give_get_form_sales_stats($give_form_id = 0) {
548
+	$give_form = new Give_Donate_Form($give_form_id);
549 549
 
550 550
 	return $give_form->sales;
551 551
 }
@@ -560,16 +560,16 @@  discard block
 block discarded – undo
560 560
  *
561 561
  * @return float $sales Average monthly sales
562 562
  */
563
-function give_get_average_monthly_form_sales( $form_id = 0 ) {
564
-	$sales        = give_get_form_sales_stats( $form_id );
565
-	$release_date = get_post_field( 'post_date', $form_id );
563
+function give_get_average_monthly_form_sales($form_id = 0) {
564
+	$sales        = give_get_form_sales_stats($form_id);
565
+	$release_date = get_post_field('post_date', $form_id);
566 566
 
567
-	$diff = abs( current_time( 'timestamp' ) - strtotime( $release_date ) );
567
+	$diff = abs(current_time('timestamp') - strtotime($release_date));
568 568
 
569
-	$months = floor( $diff / ( 30 * 60 * 60 * 24 ) ); // Number of months since publication
569
+	$months = floor($diff / (30 * 60 * 60 * 24)); // Number of months since publication
570 570
 
571
-	if ( $months > 0 ) {
572
-		$sales = ( $sales / $months );
571
+	if ($months > 0) {
572
+		$sales = ($sales / $months);
573 573
 	}
574 574
 
575 575
 	return $sales;
@@ -585,16 +585,16 @@  discard block
 block discarded – undo
585 585
  *
586 586
  * @return float $earnings Average monthly earnings
587 587
  */
588
-function give_get_average_monthly_form_earnings( $form_id = 0 ) {
589
-	$earnings     = give_get_form_earnings_stats( $form_id );
590
-	$release_date = get_post_field( 'post_date', $form_id );
588
+function give_get_average_monthly_form_earnings($form_id = 0) {
589
+	$earnings     = give_get_form_earnings_stats($form_id);
590
+	$release_date = get_post_field('post_date', $form_id);
591 591
 
592
-	$diff = abs( current_time( 'timestamp' ) - strtotime( $release_date ) );
592
+	$diff = abs(current_time('timestamp') - strtotime($release_date));
593 593
 
594
-	$months = floor( $diff / ( 30 * 60 * 60 * 24 ) ); // Number of months since publication
594
+	$months = floor($diff / (30 * 60 * 60 * 24)); // Number of months since publication
595 595
 
596
-	if ( $months > 0 ) {
597
-		$earnings = ( $earnings / $months );
596
+	if ($months > 0) {
597
+		$earnings = ($earnings / $months);
598 598
 	}
599 599
 
600 600
 	return $earnings < 0 ? 0 : $earnings;
@@ -614,21 +614,21 @@  discard block
 block discarded – undo
614 614
  *
615 615
  * @return string $price_name Name of the price option
616 616
  */
617
-function give_get_price_option_name( $form_id = 0, $price_id = 0, $payment_id = 0 ) {
617
+function give_get_price_option_name($form_id = 0, $price_id = 0, $payment_id = 0) {
618 618
 
619
-	$prices     = give_get_variable_prices( $form_id );
619
+	$prices     = give_get_variable_prices($form_id);
620 620
 	$price_name = '';
621 621
 
622
-	foreach ( $prices as $price ) {
622
+	foreach ($prices as $price) {
623 623
 
624
-		if ( intval( $price['_give_id']['level_id'] ) == intval( $price_id ) ) {
625
-			$price_name = isset( $price['_give_text'] ) ? $price['_give_text'] : '';
624
+		if (intval($price['_give_id']['level_id']) == intval($price_id)) {
625
+			$price_name = isset($price['_give_text']) ? $price['_give_text'] : '';
626 626
 		}
627 627
 
628 628
 	}
629 629
 
630 630
 
631
-	return apply_filters( 'give_get_price_option_name', $price_name, $form_id, $payment_id, $price_id );
631
+	return apply_filters('give_get_price_option_name', $price_name, $form_id, $payment_id, $price_id);
632 632
 }
633 633
 
634 634
 
@@ -641,14 +641,14 @@  discard block
 block discarded – undo
641 641
  *
642 642
  * @return string $range A fully formatted price range
643 643
  */
644
-function give_price_range( $form_id = 0 ) {
645
-	$low   = give_get_lowest_price_option( $form_id );
646
-	$high  = give_get_highest_price_option( $form_id );
647
-	$range = '<span class="give_price_range_low">' . give_currency_filter( give_format_amount( $low ) ) . '</span>';
644
+function give_price_range($form_id = 0) {
645
+	$low   = give_get_lowest_price_option($form_id);
646
+	$high  = give_get_highest_price_option($form_id);
647
+	$range = '<span class="give_price_range_low">'.give_currency_filter(give_format_amount($low)).'</span>';
648 648
 	$range .= '<span class="give_price_range_sep">&nbsp;&ndash;&nbsp;</span>';
649
-	$range .= '<span class="give_price_range_high">' . give_currency_filter( give_format_amount( $high ) ) . '</span>';
649
+	$range .= '<span class="give_price_range_high">'.give_currency_filter(give_format_amount($high)).'</span>';
650 650
 
651
-	return apply_filters( 'give_price_range', $range, $form_id, $low, $high );
651
+	return apply_filters('give_price_range', $range, $form_id, $low, $high);
652 652
 }
653 653
 
654 654
 
@@ -661,43 +661,43 @@  discard block
 block discarded – undo
661 661
  *
662 662
  * @return float Amount of the lowest price
663 663
  */
664
-function give_get_lowest_price_option( $form_id = 0 ) {
665
-	if ( empty( $form_id ) ) {
664
+function give_get_lowest_price_option($form_id = 0) {
665
+	if (empty($form_id)) {
666 666
 		$form_id = get_the_ID();
667 667
 	}
668 668
 
669
-	if ( ! give_has_variable_prices( $form_id ) ) {
670
-		return give_get_form_price( $form_id );
669
+	if ( ! give_has_variable_prices($form_id)) {
670
+		return give_get_form_price($form_id);
671 671
 	}
672 672
 
673
-	$prices = give_get_variable_prices( $form_id );
673
+	$prices = give_get_variable_prices($form_id);
674 674
 
675 675
 	$low = 0.00;
676 676
 
677
-	if ( ! empty( $prices ) ) {
677
+	if ( ! empty($prices)) {
678 678
 
679
-		foreach ( $prices as $key => $price ) {
679
+		foreach ($prices as $key => $price) {
680 680
 
681
-			if ( empty( $price['_give_amount'] ) ) {
681
+			if (empty($price['_give_amount'])) {
682 682
 				continue;
683 683
 			}
684 684
 
685
-			if ( ! isset( $min ) ) {
685
+			if ( ! isset($min)) {
686 686
 				$min = $price['_give_amount'];
687 687
 			} else {
688
-				$min = min( $min, give_sanitize_amount( $price['_give_amount'] ) );
688
+				$min = min($min, give_sanitize_amount($price['_give_amount']));
689 689
 			}
690 690
 
691
-			if ( $price['_give_amount'] == $min ) {
691
+			if ($price['_give_amount'] == $min) {
692 692
 				$min_id = $key;
693 693
 			}
694 694
 		}
695 695
 
696
-		$low = $prices[ $min_id ]['_give_amount'];
696
+		$low = $prices[$min_id]['_give_amount'];
697 697
 
698 698
 	}
699 699
 
700
-	return give_sanitize_amount( $low );
700
+	return give_sanitize_amount($low);
701 701
 }
702 702
 
703 703
 /**
@@ -709,41 +709,41 @@  discard block
 block discarded – undo
709 709
  *
710 710
  * @return float Amount of the highest price
711 711
  */
712
-function give_get_highest_price_option( $form_id = 0 ) {
712
+function give_get_highest_price_option($form_id = 0) {
713 713
 
714
-	if ( empty( $form_id ) ) {
714
+	if (empty($form_id)) {
715 715
 		$form_id = get_the_ID();
716 716
 	}
717 717
 
718
-	if ( ! give_has_variable_prices( $form_id ) ) {
719
-		return give_get_form_price( $form_id );
718
+	if ( ! give_has_variable_prices($form_id)) {
719
+		return give_get_form_price($form_id);
720 720
 	}
721 721
 
722
-	$prices = give_get_variable_prices( $form_id );
722
+	$prices = give_get_variable_prices($form_id);
723 723
 
724 724
 	$high = 0.00;
725 725
 
726
-	if ( ! empty( $prices ) ) {
726
+	if ( ! empty($prices)) {
727 727
 
728 728
 		$max = 0;
729 729
 
730
-		foreach ( $prices as $key => $price ) {
731
-			if ( empty( $price['_give_amount'] ) ) {
730
+		foreach ($prices as $key => $price) {
731
+			if (empty($price['_give_amount'])) {
732 732
 				continue;
733 733
 			}
734
-			$give_amount = give_sanitize_amount( $price['_give_amount'] );
734
+			$give_amount = give_sanitize_amount($price['_give_amount']);
735 735
 
736
-			$max = max( $max, $give_amount );
736
+			$max = max($max, $give_amount);
737 737
 
738
-			if ( $give_amount == $max ) {
738
+			if ($give_amount == $max) {
739 739
 				$max_id = $key;
740 740
 			}
741 741
 		}
742 742
 
743
-		$high = $prices[ $max_id ]['_give_amount'];
743
+		$high = $prices[$max_id]['_give_amount'];
744 744
 	}
745 745
 
746
-	return give_sanitize_amount( $high );
746
+	return give_sanitize_amount($high);
747 747
 }
748 748
 
749 749
 /**
@@ -755,13 +755,13 @@  discard block
 block discarded – undo
755 755
  *
756 756
  * @return mixed string|int Price of the form
757 757
  */
758
-function give_get_form_price( $form_id = 0 ) {
758
+function give_get_form_price($form_id = 0) {
759 759
 
760
-	if ( empty( $form_id ) ) {
760
+	if (empty($form_id)) {
761 761
 		return false;
762 762
 	}
763 763
 
764
-	$form = new Give_Donate_Form( $form_id );
764
+	$form = new Give_Donate_Form($form_id);
765 765
 
766 766
 	return $form->price;
767 767
 }
@@ -778,52 +778,52 @@  discard block
 block discarded – undo
778 778
  *
779 779
  * @return int $formatted_price
780 780
  */
781
-function give_price( $form_id = 0, $echo = true, $price_id = false ) {
781
+function give_price($form_id = 0, $echo = true, $price_id = false) {
782 782
 
783
-	if ( empty( $form_id ) ) {
783
+	if (empty($form_id)) {
784 784
 		$form_id = get_the_ID();
785 785
 	}
786 786
 
787
-	if ( give_has_variable_prices( $form_id ) ) {
787
+	if (give_has_variable_prices($form_id)) {
788 788
 
789
-		$prices = give_get_variable_prices( $form_id );
789
+		$prices = give_get_variable_prices($form_id);
790 790
 
791
-		if ( false !== $price_id ) {
791
+		if (false !== $price_id) {
792 792
 
793 793
 			//loop through multi-prices to see which is default
794
-			foreach ( $prices as $price ) {
794
+			foreach ($prices as $price) {
795 795
 				//this is the default price
796
-				if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) {
796
+				if (isset($price['_give_default']) && $price['_give_default'] === 'default') {
797 797
 					$price = (float) $price['_give_amount'];
798 798
 				};
799 799
 			}
800 800
 
801 801
 		} else {
802 802
 
803
-			$price = give_get_lowest_price_option( $form_id );
803
+			$price = give_get_lowest_price_option($form_id);
804 804
 		}
805 805
 
806
-		$price = give_sanitize_amount( $price );
806
+		$price = give_sanitize_amount($price);
807 807
 
808 808
 	} else {
809 809
 
810
-		$price = give_get_form_price( $form_id );
810
+		$price = give_get_form_price($form_id);
811 811
 
812 812
 	}
813 813
 
814
-	$price           = apply_filters( 'give_form_price', give_sanitize_amount( $price ), $form_id );
815
-	$formatted_price = '<span class="give_price" id="give_price_' . $form_id . '">' . $price . '</span>';
816
-	$formatted_price = apply_filters( 'give_form_price_after_html', $formatted_price, $form_id, $price );
814
+	$price           = apply_filters('give_form_price', give_sanitize_amount($price), $form_id);
815
+	$formatted_price = '<span class="give_price" id="give_price_'.$form_id.'">'.$price.'</span>';
816
+	$formatted_price = apply_filters('give_form_price_after_html', $formatted_price, $form_id, $price);
817 817
 
818
-	if ( $echo ) {
818
+	if ($echo) {
819 819
 		echo $formatted_price;
820 820
 	} else {
821 821
 		return $formatted_price;
822 822
 	}
823 823
 }
824 824
 
825
-add_filter( 'give_form_price', 'give_format_amount', 10 );
826
-add_filter( 'give_form_price', 'give_currency_filter', 20 );
825
+add_filter('give_form_price', 'give_format_amount', 10);
826
+add_filter('give_form_price', 'give_currency_filter', 20);
827 827
 
828 828
 
829 829
 /**
@@ -837,18 +837,18 @@  discard block
 block discarded – undo
837 837
  *
838 838
  * @return float $amount Amount of the price option
839 839
  */
840
-function give_get_price_option_amount( $form_id = 0, $price_id = 0 ) {
841
-	$prices = give_get_variable_prices( $form_id );
840
+function give_get_price_option_amount($form_id = 0, $price_id = 0) {
841
+	$prices = give_get_variable_prices($form_id);
842 842
 
843 843
 	$amount = 0.00;
844 844
 
845
-	foreach ( $prices as $price ) {
846
-		if ( isset( $price['_give_id']['level_id'] ) && $price['_give_id']['level_id'] === $price_id ) {
847
-			$amount = isset( $price['_give_amount'] ) ? $price['_give_amount'] : 0.00;
845
+	foreach ($prices as $price) {
846
+		if (isset($price['_give_id']['level_id']) && $price['_give_id']['level_id'] === $price_id) {
847
+			$amount = isset($price['_give_amount']) ? $price['_give_amount'] : 0.00;
848 848
 		};
849 849
 	}
850 850
 
851
-	return apply_filters( 'give_get_price_option_amount', give_sanitize_amount( $amount ), $form_id, $price_id );
851
+	return apply_filters('give_get_price_option_amount', give_sanitize_amount($amount), $form_id, $price_id);
852 852
 }
853 853
 
854 854
 /**
@@ -860,13 +860,13 @@  discard block
 block discarded – undo
860 860
  *
861 861
  * @return mixed string|int Goal of the form
862 862
  */
863
-function give_get_form_goal( $form_id = 0 ) {
863
+function give_get_form_goal($form_id = 0) {
864 864
 
865
-	if ( empty( $form_id ) ) {
865
+	if (empty($form_id)) {
866 866
 		return false;
867 867
 	}
868 868
 
869
-	$form = new Give_Donate_Form( $form_id );
869
+	$form = new Give_Donate_Form($form_id);
870 870
 
871 871
 	return $form->goal;
872 872
 
@@ -882,24 +882,24 @@  discard block
 block discarded – undo
882 882
  *
883 883
  * @return string $formatted_goal
884 884
  */
885
-function give_goal( $form_id = 0, $echo = true ) {
885
+function give_goal($form_id = 0, $echo = true) {
886 886
 
887
-	if ( empty( $form_id ) ) {
887
+	if (empty($form_id)) {
888 888
 		$form_id = get_the_ID();
889 889
 	}
890 890
 
891
-	$goal = give_get_form_goal( $form_id );
891
+	$goal = give_get_form_goal($form_id);
892 892
 
893
-	$goal           = apply_filters( 'give_form_goal', give_sanitize_amount( $goal ), $form_id );
894
-	$formatted_goal = '<span class="give_price" id="give_price_' . $form_id . '">' . $goal . '</span>';
895
-	$formatted_goal = apply_filters( 'give_form_price_after_html', $formatted_goal, $form_id, $goal );
893
+	$goal           = apply_filters('give_form_goal', give_sanitize_amount($goal), $form_id);
894
+	$formatted_goal = '<span class="give_price" id="give_price_'.$form_id.'">'.$goal.'</span>';
895
+	$formatted_goal = apply_filters('give_form_price_after_html', $formatted_goal, $form_id, $goal);
896 896
 
897
-	if ( $echo ) {
897
+	if ($echo) {
898 898
 		echo $formatted_goal;
899 899
 	} else {
900 900
 		return $formatted_goal;
901 901
 	}
902 902
 }
903 903
 
904
-add_filter( 'give_form_goal', 'give_format_amount', 10 );
905
-add_filter( 'give_form_goal', 'give_currency_filter', 20 );
904
+add_filter('give_form_goal', 'give_format_amount', 10);
905
+add_filter('give_form_goal', 'give_currency_filter', 20);
Please login to merge, or discard this patch.
includes/forms/template.php 4 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
  *
22 22
  * @param array $args Arguments for display
23 23
  *
24
- * @return string $purchase_form
24
+ * @return false|null $purchase_form
25 25
  */
26 26
 function give_get_donation_form( $args = array() ) {
27 27
 
@@ -1150,7 +1150,7 @@  discard block
 block discarded – undo
1150 1150
  * @param int   $form_id
1151 1151
  * @param array $args
1152 1152
  *
1153
- * @return mixed
1153
+ * @return boolean
1154 1154
  */
1155 1155
 
1156 1156
 function give_show_goal_progress( $form_id, $args ) {
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -716,8 +716,11 @@
 block discarded – undo
716 716
 					}
717 717
 					?>
718 718
 				</select>
719
-			<?php else : ?>
720
-				<input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php _e( 'State / Province', 'give' ); ?>" />
719
+			<?php else {
720
+	: ?>
721
+				<input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php _e( 'State / Province', 'give' );
722
+}
723
+?>" />
721 724
 			<?php endif; ?>
722 725
 		</p>
723 726
 		<?php do_action( 'give_cc_billing_bottom' ); ?>
Please login to merge, or discard this patch.
Spacing   +359 added lines, -359 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,56 +23,56 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return string $purchase_form
25 25
  */
26
-function give_get_donation_form( $args = array() ) {
26
+function give_get_donation_form($args = array()) {
27 27
 
28 28
 	global $post;
29 29
 
30
-	$post_id = is_object( $post ) ? $post->ID : 0;
30
+	$post_id = is_object($post) ? $post->ID : 0;
31 31
 
32
-	if ( isset( $args['id'] ) ) {
32
+	if (isset($args['id'])) {
33 33
 		$post_id = $args['id'];
34 34
 	}
35 35
 
36
-	$defaults = apply_filters( 'give_form_args_defaults', array(
36
+	$defaults = apply_filters('give_form_args_defaults', array(
37 37
 		'form_id' => $post_id
38
-	) );
38
+	));
39 39
 
40
-	$args = wp_parse_args( $args, $defaults );
40
+	$args = wp_parse_args($args, $defaults);
41 41
 
42
-	$form = new Give_Donate_Form( $args['form_id'] );
42
+	$form = new Give_Donate_Form($args['form_id']);
43 43
 
44 44
 	//bail if no form ID
45
-	if ( empty( $form->ID ) ) {
45
+	if (empty($form->ID)) {
46 46
 		return false;
47 47
 	}
48 48
 
49
-	$payment_mode = give_get_chosen_gateway( $form->ID );
49
+	$payment_mode = give_get_chosen_gateway($form->ID);
50 50
 
51
-	$form_action = esc_url( add_query_arg( apply_filters( 'give_form_action_args', array(
51
+	$form_action = esc_url(add_query_arg(apply_filters('give_form_action_args', array(
52 52
 		'payment-mode' => $payment_mode,
53
-	) ),
53
+	)),
54 54
 		get_permalink()
55
-	) );
55
+	));
56 56
 
57
-	if ( 'publish' !== $form->post_status && ! current_user_can( 'edit_product', $form->ID ) ) {
57
+	if ('publish' !== $form->post_status && ! current_user_can('edit_product', $form->ID)) {
58 58
 		return false; // Product not published or user doesn't have permission to view drafts
59 59
 	}
60 60
 
61
-	$display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) )
61
+	$display_option = (isset($args['display_style']) && ! empty($args['display_style']))
62 62
 		? $args['display_style']
63
-		: get_post_meta( $form->ID, '_give_payment_display', true );
63
+		: get_post_meta($form->ID, '_give_payment_display', true);
64 64
 
65
-	$float_labels_option = give_is_float_labels_enabled( $args )
65
+	$float_labels_option = give_is_float_labels_enabled($args)
66 66
 		? ' float-labels-enabled'
67 67
 		: '';
68 68
 
69 69
 
70
-	$form_classes_array = apply_filters( 'give_form_classes', array(
70
+	$form_classes_array = apply_filters('give_form_classes', array(
71 71
 		'give-form-wrap',
72
-		'give-display-' . $display_option
73
-	), $form->ID, $args );
72
+		'give-display-'.$display_option
73
+	), $form->ID, $args);
74 74
 
75
-	$form_classes = implode( ' ', $form_classes_array );
75
+	$form_classes = implode(' ', $form_classes_array);
76 76
 
77 77
 	ob_start();
78 78
 
@@ -84,33 +84,33 @@  discard block
 block discarded – undo
84 84
 	 * @param int   $form ->ID The current form ID
85 85
 	 * @param array $args An array of form args
86 86
 	 */
87
-	do_action( 'give_pre_form_output', $form->ID, $args ); ?>
87
+	do_action('give_pre_form_output', $form->ID, $args); ?>
88 88
 
89 89
 	<div id="give-form-<?php echo $form->ID; ?>-wrap" class="<?php echo $form_classes; ?>">
90 90
 
91 91
 		<?php
92
-		if ( isset( $args['show_title'] ) && $args['show_title'] == true ) {
92
+		if (isset($args['show_title']) && $args['show_title'] == true) {
93 93
 
94
-			echo apply_filters( 'give_form_title', '<h2  class="give-form-title">' . get_the_title( $post_id ) . '</h2>' );
94
+			echo apply_filters('give_form_title', '<h2  class="give-form-title">'.get_the_title($post_id).'</h2>');
95 95
 
96 96
 		} ?>
97 97
 
98
-		<?php do_action( 'give_pre_form', $form->ID, $args ); ?>
98
+		<?php do_action('give_pre_form', $form->ID, $args); ?>
99 99
 
100
-		<form id="give-form-<?php echo $post_id; ?>" class="give-form give-form-<?php echo absint( $form->ID ); ?><?php echo $float_labels_option; ?>" action="<?php echo $form_action; ?>" method="post">
100
+		<form id="give-form-<?php echo $post_id; ?>" class="give-form give-form-<?php echo absint($form->ID); ?><?php echo $float_labels_option; ?>" action="<?php echo $form_action; ?>" method="post">
101 101
 			<input type="hidden" name="give-form-id" value="<?php echo $form->ID; ?>" />
102
-			<input type="hidden" name="give-form-title" value="<?php echo htmlentities( $form->post_title ); ?>" />
103
-			<input type="hidden" name="give-current-url" value="<?php echo htmlspecialchars( get_permalink() ); ?>" />
104
-			<input type="hidden" name="give-form-url" value="<?php echo htmlspecialchars( get_permalink( $post_id ) ); ?>" />
102
+			<input type="hidden" name="give-form-title" value="<?php echo htmlentities($form->post_title); ?>" />
103
+			<input type="hidden" name="give-current-url" value="<?php echo htmlspecialchars(get_permalink()); ?>" />
104
+			<input type="hidden" name="give-form-url" value="<?php echo htmlspecialchars(get_permalink($post_id)); ?>" />
105 105
 			<?php
106 106
 			//Price ID hidden field for variable (mult-level) donation forms
107
-			if ( give_has_variable_prices( $post_id ) ) {
107
+			if (give_has_variable_prices($post_id)) {
108 108
 				//get default selected price ID
109
-				$prices   = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $post_id ), $post_id );
109
+				$prices   = apply_filters('give_form_variable_prices', give_get_variable_prices($post_id), $post_id);
110 110
 				$price_id = 0;
111 111
 				//loop through prices
112
-				foreach ( $prices as $price ) {
113
-					if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) {
112
+				foreach ($prices as $price) {
113
+					if (isset($price['_give_default']) && $price['_give_default'] === 'default') {
114 114
 						$price_id = $price['_give_id']['level_id'];
115 115
 					};
116 116
 				}
@@ -118,19 +118,19 @@  discard block
 block discarded – undo
118 118
 				<input type="hidden" name="give-price-id" value="<?php echo $price_id; ?>" />
119 119
 			<?php }
120 120
 
121
-			do_action( 'give_checkout_form_top', $form->ID, $args );
121
+			do_action('give_checkout_form_top', $form->ID, $args);
122 122
 
123
-			do_action( 'give_payment_mode_select', $form->ID, $args );
123
+			do_action('give_payment_mode_select', $form->ID, $args);
124 124
 
125
-			do_action( 'give_checkout_form_bottom', $form->ID, $args );
125
+			do_action('give_checkout_form_bottom', $form->ID, $args);
126 126
 
127 127
 			?>
128 128
 
129 129
 		</form>
130 130
 
131
-		<?php do_action( 'give_post_form', $form->ID, $args ); ?>
131
+		<?php do_action('give_post_form', $form->ID, $args); ?>
132 132
 
133
-		<!--end #give-form-<?php echo absint( $form->ID ); ?>--></div>
133
+		<!--end #give-form-<?php echo absint($form->ID); ?>--></div>
134 134
 	<?php
135 135
 
136 136
 	/**
@@ -141,11 +141,11 @@  discard block
 block discarded – undo
141 141
 	 * @param int   $form ->ID The current form ID
142 142
 	 * @param array $args An array of form args
143 143
 	 */
144
-	do_action( 'give_post_form_output', $form->ID, $args );
144
+	do_action('give_post_form_output', $form->ID, $args);
145 145
 
146 146
 	$final_output = ob_get_clean();
147 147
 
148
-	echo apply_filters( 'give_donate_form', $final_output, $args );
148
+	echo apply_filters('give_donate_form', $final_output, $args);
149 149
 }
150 150
 
151 151
 
@@ -165,57 +165,57 @@  discard block
 block discarded – undo
165 165
  * @global    $give_options Array of all the Give options
166 166
  * @return string
167 167
  */
168
-function give_show_purchase_form( $form_id ) {
168
+function give_show_purchase_form($form_id) {
169 169
 
170
-	$payment_mode = give_get_chosen_gateway( $form_id );
170
+	$payment_mode = give_get_chosen_gateway($form_id);
171 171
 
172
-	if ( ! isset( $form_id ) && isset( $_POST['give_form_id'] ) ) {
172
+	if ( ! isset($form_id) && isset($_POST['give_form_id'])) {
173 173
 		$form_id = $_POST['give_form_id'];
174 174
 	}
175 175
 
176
-	do_action( 'give_purchase_form_top', $form_id );
176
+	do_action('give_purchase_form_top', $form_id);
177 177
 
178
-	if ( give_can_checkout() && isset( $form_id ) ) {
178
+	if (give_can_checkout() && isset($form_id)) {
179 179
 
180
-		do_action( 'give_purchase_form_before_register_login', $form_id );
180
+		do_action('give_purchase_form_before_register_login', $form_id);
181 181
 
182
-		$show_register_form = apply_filters( 'give_show_register_form', get_post_meta( $form_id, '_give_show_register_form', true ) );
182
+		$show_register_form = apply_filters('give_show_register_form', get_post_meta($form_id, '_give_show_register_form', true));
183 183
 
184
-		if ( ( $show_register_form === 'registration' || ( $show_register_form === 'both' && ! isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : ?>
184
+		if (($show_register_form === 'registration' || ($show_register_form === 'both' && ! isset($_GET['login']))) && ! is_user_logged_in()) : ?>
185 185
 			<div id="give_checkout_login_register">
186
-				<?php do_action( 'give_purchase_form_register_fields', $form_id ); ?>
186
+				<?php do_action('give_purchase_form_register_fields', $form_id); ?>
187 187
 			</div>
188
-		<?php elseif ( ( $show_register_form === 'login' || ( $show_register_form === 'both' && isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : ?>
188
+		<?php elseif (($show_register_form === 'login' || ($show_register_form === 'both' && isset($_GET['login']))) && ! is_user_logged_in()) : ?>
189 189
 			<div id="give_checkout_login_register">
190
-				<?php do_action( 'give_purchase_form_login_fields', $form_id ); ?>
190
+				<?php do_action('give_purchase_form_login_fields', $form_id); ?>
191 191
 			</div>
192 192
 		<?php endif; ?>
193 193
 
194
-		<?php if ( ( ! isset( $_GET['login'] ) && is_user_logged_in() ) || ! isset( $show_register_form ) || 'none' === $show_register_form ) {
195
-			do_action( 'give_purchase_form_after_user_info', $form_id );
194
+		<?php if (( ! isset($_GET['login']) && is_user_logged_in()) || ! isset($show_register_form) || 'none' === $show_register_form) {
195
+			do_action('give_purchase_form_after_user_info', $form_id);
196 196
 		}
197 197
 
198
-		do_action( 'give_purchase_form_before_cc_form', $form_id );
198
+		do_action('give_purchase_form_before_cc_form', $form_id);
199 199
 
200 200
 		// Load the credit card form and allow gateways to load their own if they wish
201
-		if ( has_action( 'give_' . $payment_mode . '_cc_form' ) ) {
202
-			do_action( 'give_' . $payment_mode . '_cc_form', $form_id );
201
+		if (has_action('give_'.$payment_mode.'_cc_form')) {
202
+			do_action('give_'.$payment_mode.'_cc_form', $form_id);
203 203
 		} else {
204
-			do_action( 'give_cc_form', $form_id );
204
+			do_action('give_cc_form', $form_id);
205 205
 		}
206 206
 
207
-		do_action( 'give_purchase_form_after_cc_form', $form_id );
207
+		do_action('give_purchase_form_after_cc_form', $form_id);
208 208
 
209 209
 	} else {
210 210
 		// Can't checkout
211
-		do_action( 'give_purchase_form_no_access', $form_id );
211
+		do_action('give_purchase_form_no_access', $form_id);
212 212
 
213 213
 	}
214 214
 
215
-	do_action( 'give_purchase_form_bottom', $form_id );
215
+	do_action('give_purchase_form_bottom', $form_id);
216 216
 }
217 217
 
218
-add_action( 'give_purchase_form', 'give_show_purchase_form' );
218
+add_action('give_purchase_form', 'give_show_purchase_form');
219 219
 
220 220
 /**
221 221
  * Donation Amount Field
@@ -229,30 +229,30 @@  discard block
 block discarded – undo
229 229
  *
230 230
  * @return void
231 231
  */
232
-function give_output_donation_amount_top( $form_id = 0, $args = array() ) {
232
+function give_output_donation_amount_top($form_id = 0, $args = array()) {
233 233
 
234 234
 	global $give_options;
235 235
 
236 236
 
237
-	$variable_pricing    = give_has_variable_prices( $form_id );
238
-	$allow_custom_amount = get_post_meta( $form_id, '_give_custom_amount', true );
239
-	$currency_position   = isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before';
240
-	$symbol              = isset( $give_options['currency'] ) ? give_currency_symbol( $give_options['currency'] ) : '$';
241
-	$currency_output     = '<span class="give-currency-symbol give-currency-position-' . $currency_position . '">' . $symbol . '</span>';
242
-	$default_amount      = give_format_amount( give_get_default_form_amount( $form_id ) );
243
-	$custom_amount_text  = get_post_meta( $form_id, '_give_custom_amount_text', true );
237
+	$variable_pricing    = give_has_variable_prices($form_id);
238
+	$allow_custom_amount = get_post_meta($form_id, '_give_custom_amount', true);
239
+	$currency_position   = isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before';
240
+	$symbol              = isset($give_options['currency']) ? give_currency_symbol($give_options['currency']) : '$';
241
+	$currency_output     = '<span class="give-currency-symbol give-currency-position-'.$currency_position.'">'.$symbol.'</span>';
242
+	$default_amount      = give_format_amount(give_get_default_form_amount($form_id));
243
+	$custom_amount_text  = get_post_meta($form_id, '_give_custom_amount_text', true);
244 244
 
245
-	do_action( 'give_before_donation_levels', $form_id );
245
+	do_action('give_before_donation_levels', $form_id);
246 246
 
247 247
 	//Set Price, No Custom Amount Allowed means hidden price field
248
-	if ( $allow_custom_amount == 'no' ) {
248
+	if ($allow_custom_amount == 'no') {
249 249
 		?>
250 250
 
251 251
 		<label class="give-hidden" for="give-amount-hidden"><?php echo __('Donation Amount:', 'give'); ?></label>
252 252
 		<input id="give-amount" class="give-amount-hidden" type="hidden" name="give-amount" value="<?php echo $default_amount; ?>" required>
253 253
 		<p class="set-price give-donation-amount form-row-wide">
254 254
 			<?php
255
-			if ( $currency_position == 'before' ) {
255
+			if ($currency_position == 'before') {
256 256
 				echo $currency_output;
257 257
 			}
258 258
 			?>
@@ -266,37 +266,37 @@  discard block
 block discarded – undo
266 266
 			<div class="give-donation-amount form-row-wide">
267 267
 				<?php
268 268
 
269
-				if ( $currency_position == 'before' ) {
269
+				if ($currency_position == 'before') {
270 270
 					echo $currency_output;
271 271
 				}
272 272
 				?>
273 273
 				<label class="give-hidden" for="give-amount"><?php echo __('Donation Amount:', 'give'); ?></label>
274 274
 				<input class="give-text-input give-amount-top" id="give-amount" name="give-amount" type="tel" placeholder="" value="<?php echo $default_amount; ?>" autocomplete="off">
275 275
 
276
-				<?php if ( $currency_position == 'after' ) {
276
+				<?php if ($currency_position == 'after') {
277 277
 					echo $currency_output;
278 278
 				} ?>
279 279
 
280 280
 				<p class="give-loading-text give-updating-price-loader" style="display: none;">
281
-					<span class="give-loading-animation"></span> <?php _e( 'Updating Amount', 'give' ); ?>
281
+					<span class="give-loading-animation"></span> <?php _e('Updating Amount', 'give'); ?>
282 282
 					<span class="elipsis">.</span><span class="elipsis">.</span><span class="elipsis">.</span></p>
283 283
 			</div>
284 284
 		</div>
285 285
 	<?php }
286 286
 
287 287
 	//Custom Amount Text
288
-	if ( ! empty( $custom_amount_text ) && ! $variable_pricing && $allow_custom_amount == 'yes' ) { ?>
288
+	if ( ! empty($custom_amount_text) && ! $variable_pricing && $allow_custom_amount == 'yes') { ?>
289 289
 		<p class="give-custom-amount-text"><?php echo $custom_amount_text; ?></p>
290 290
 	<?php }
291 291
 
292 292
 	//Output Variable Pricing Levels
293
-	if ( $variable_pricing ) {
294
-		give_output_levels( $form_id );
293
+	if ($variable_pricing) {
294
+		give_output_levels($form_id);
295 295
 	}
296
-	do_action( 'give_after_donation_levels', $form_id, $args );
296
+	do_action('give_after_donation_levels', $form_id, $args);
297 297
 }
298 298
 
299
-add_action( 'give_checkout_form_top', 'give_output_donation_amount_top', 10, 2 );
299
+add_action('give_checkout_form_top', 'give_output_donation_amount_top', 10, 2);
300 300
 
301 301
 
302 302
 /**
@@ -308,27 +308,27 @@  discard block
 block discarded – undo
308 308
  *
309 309
  * @return string
310 310
  */
311
-function give_output_levels( $form_id ) {
311
+function give_output_levels($form_id) {
312 312
 
313 313
 	//Get variable pricing
314
-	$prices             = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id );
315
-	$display_style      = get_post_meta( $form_id, '_give_display_style', true );
316
-	$custom_amount      = get_post_meta( $form_id, '_give_custom_amount', true );
317
-	$custom_amount_text = apply_filters( '', get_post_meta( $form_id, '_give_custom_amount_text', true ) );
314
+	$prices             = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id);
315
+	$display_style      = get_post_meta($form_id, '_give_display_style', true);
316
+	$custom_amount      = get_post_meta($form_id, '_give_custom_amount', true);
317
+	$custom_amount_text = apply_filters('', get_post_meta($form_id, '_give_custom_amount_text', true));
318 318
 	$output             = '';
319 319
 	$counter            = 0;
320 320
 
321
-	switch ( $display_style ) {
321
+	switch ($display_style) {
322 322
 		case 'buttons':
323 323
 
324 324
 			$output .= '<ul id="give-donation-level-button-wrap" class="give-donation-levels-wrap give-list-inline">';
325 325
 
326
-			foreach ( $prices as $price ) {
327
-				$counter ++;
328
-				$level_text = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price );
326
+			foreach ($prices as $price) {
327
+				$counter++;
328
+				$level_text = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price);
329 329
 
330 330
 				$output .= '<li>';
331
-				$output .= '<button type="button" data-price-id="' . $price['_give_id']['level_id'] . '" class="give-donation-level-btn give-btn give-btn-level-' . $counter . ' ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'give-default-level' : '' ) . '" value="' . give_format_amount( $price['_give_amount'] ) . '">';
331
+				$output .= '<button type="button" data-price-id="'.$price['_give_id']['level_id'].'" class="give-donation-level-btn give-btn give-btn-level-'.$counter.' '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'give-default-level' : '').'" value="'.give_format_amount($price['_give_amount']).'">';
332 332
 				$output .= $level_text;
333 333
 				$output .= '</button>';
334 334
 				$output .= '</li>';
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
 			}
337 337
 
338 338
 			//Custom Amount
339
-			if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) {
339
+			if ($custom_amount === 'yes' && ! empty($custom_amount_text)) {
340 340
 				$output .= '<li>';
341 341
 				$output .= '<button type="button" data-price-id="custom" class="give-donation-level-btn give-btn give-btn-level-custom" value="custom">';
342 342
 				$output .= $custom_amount_text;
@@ -352,24 +352,24 @@  discard block
 block discarded – undo
352 352
 
353 353
 			$output .= '<ul id="give-donation-level-radio-list" class="give-donation-levels-wrap">';
354 354
 
355
-			foreach ( $prices as $price ) {
356
-				$counter ++;
357
-				$level_text = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price );
355
+			foreach ($prices as $price) {
356
+				$counter++;
357
+				$level_text = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price);
358 358
 
359 359
 				$output .= '<li>';
360
-				$output .= '<input type="radio" data-price-id="' . $price['_give_id']['level_id'] . '" class="give-radio-input give-radio-input-level give-radio-level-' . $counter . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ) . '" name="give-radio-donation-level" id="give-radio-level-' . $counter . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'checked="checked"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'] ) . '">';
360
+				$output .= '<input type="radio" data-price-id="'.$price['_give_id']['level_id'].'" class="give-radio-input give-radio-input-level give-radio-level-'.$counter.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : '').'" name="give-radio-donation-level" id="give-radio-level-'.$counter.'" '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'checked="checked"' : '').' value="'.give_format_amount($price['_give_amount']).'">';
361 361
 
362
-				$output .= '<label for="give-radio-level-' . $counter . '">' . $level_text . '</label>';
362
+				$output .= '<label for="give-radio-level-'.$counter.'">'.$level_text.'</label>';
363 363
 
364 364
 				$output .= '</li>';
365 365
 
366 366
 			}
367 367
 
368 368
 			//Custom Amount
369
-			if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) {
369
+			if ($custom_amount === 'yes' && ! empty($custom_amount_text)) {
370 370
 				$output .= '<li>';
371 371
 				$output .= '<input type="radio" data-price-id="custom" class="give-radio-input give-radio-input-level give-radio-level-custom" name="give-radio-donation-level" id="give-radio-level-custom" value="custom">';
372
-				$output .= '<label for="give-radio-level-custom">' . $custom_amount_text . '</label>';
372
+				$output .= '<label for="give-radio-level-custom">'.$custom_amount_text.'</label>';
373 373
 				$output .= '</li>';
374 374
 			}
375 375
 
@@ -379,22 +379,22 @@  discard block
 block discarded – undo
379 379
 
380 380
 		case 'dropdown':
381 381
 
382
-			$output .= '<label for="give-donation-level" class="give-hidden">' . __( 'Choose your Donation Amount', 'give' ) . ':</label>';
383
-			$output .= '<select id="give-donation-level-' . $form_id . '" class="give-select give-select-level">';
382
+			$output .= '<label for="give-donation-level" class="give-hidden">'.__('Choose your Donation Amount', 'give').':</label>';
383
+			$output .= '<select id="give-donation-level-'.$form_id.'" class="give-select give-select-level">';
384 384
 
385 385
 			//first loop through prices
386
-			foreach ( $prices as $price ) {
387
-				$level_text = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price );
386
+			foreach ($prices as $price) {
387
+				$level_text = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price);
388 388
 
389
-				$output .= '<option data-price-id="' . $price['_give_id']['level_id'] . '" class="give-donation-level-' . $form_id . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'selected="selected"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'] ) . '">';
389
+				$output .= '<option data-price-id="'.$price['_give_id']['level_id'].'" class="give-donation-level-'.$form_id.'" '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'selected="selected"' : '').' value="'.give_format_amount($price['_give_amount']).'">';
390 390
 				$output .= $level_text;
391 391
 				$output .= '</option>';
392 392
 
393 393
 			}
394 394
 
395 395
 			//Custom Amount
396
-			if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) {
397
-				$output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">' . $custom_amount_text . '</option>';
396
+			if ($custom_amount === 'yes' && ! empty($custom_amount_text)) {
397
+				$output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">'.$custom_amount_text.'</option>';
398 398
 			}
399 399
 
400 400
 			$output .= '</select>';
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
 			break;
403 403
 	}
404 404
 
405
-	echo apply_filters( 'give_form_level_output', $output, $form_id );
405
+	echo apply_filters('give_form_level_output', $output, $form_id);
406 406
 }
407 407
 
408 408
 
@@ -415,26 +415,26 @@  discard block
 block discarded – undo
415 415
  * @param array $args
416 416
  *
417 417
  */
418
-function give_display_checkout_button( $form_id, $args ) {
418
+function give_display_checkout_button($form_id, $args) {
419 419
 
420
-	$display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) )
420
+	$display_option = (isset($args['display_style']) && ! empty($args['display_style']))
421 421
 		? $args['display_style']
422
-		: get_post_meta( $form_id, '_give_payment_display', true );
422
+		: get_post_meta($form_id, '_give_payment_display', true);
423 423
 
424 424
 	//no btn for onpage
425
-	if ( $display_option === 'onpage' ) {
425
+	if ($display_option === 'onpage') {
426 426
 		return;
427 427
 	}
428 428
 
429
-	$display_label_field = get_post_meta( $form_id, '_give_reveal_label', true );
430
-	$display_label       = ( ! empty( $display_label_field ) ? $display_label_field : __( 'Donate Now', 'give' ) );
429
+	$display_label_field = get_post_meta($form_id, '_give_reveal_label', true);
430
+	$display_label       = ( ! empty($display_label_field) ? $display_label_field : __('Donate Now', 'give'));
431 431
 
432
-	$output = '<button type="button" class="give-btn give-btn-' . $display_option . '">' . $display_label . '</button>';
432
+	$output = '<button type="button" class="give-btn give-btn-'.$display_option.'">'.$display_label.'</button>';
433 433
 
434
-	echo apply_filters( 'give_display_checkout_button', $output );
434
+	echo apply_filters('give_display_checkout_button', $output);
435 435
 }
436 436
 
437
-add_action( 'give_after_donation_levels', 'give_display_checkout_button', 10, 2 );
437
+add_action('give_after_donation_levels', 'give_display_checkout_button', 10, 2);
438 438
 
439 439
 /**
440 440
  * Shows the User Info fields in the Personal Info box, more fields can be added
@@ -446,63 +446,63 @@  discard block
 block discarded – undo
446 446
  *
447 447
  * @return void
448 448
  */
449
-function give_user_info_fields( $form_id ) {
449
+function give_user_info_fields($form_id) {
450 450
 
451
-	if ( is_user_logged_in() ) :
452
-		$user_data = get_userdata( get_current_user_id() );
451
+	if (is_user_logged_in()) :
452
+		$user_data = get_userdata(get_current_user_id());
453 453
 	endif;
454 454
 
455
-	do_action( 'give_purchase_form_before_personal_info', $form_id );
455
+	do_action('give_purchase_form_before_personal_info', $form_id);
456 456
 	?>
457 457
 	<fieldset id="give_checkout_user_info">
458
-		<legend><?php echo apply_filters( 'give_checkout_personal_info_text', __( 'Personal Info', 'give' ) ); ?></legend>
458
+		<legend><?php echo apply_filters('give_checkout_personal_info_text', __('Personal Info', 'give')); ?></legend>
459 459
 		<p id="give-first-name-wrap" class="form-row form-row-first">
460 460
 			<label class="give-label" for="give-first">
461
-				<?php _e( 'First Name', 'give' ); ?>
462
-				<?php if ( give_field_is_required( 'give_first', $form_id ) ) { ?>
461
+				<?php _e('First Name', 'give'); ?>
462
+				<?php if (give_field_is_required('give_first', $form_id)) { ?>
463 463
 					<span class="give-required-indicator">*</span>
464 464
 				<?php } ?>
465
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'We will use this to personalize your account experience.', 'give' ); ?>"></span>
465
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('We will use this to personalize your account experience.', 'give'); ?>"></span>
466 466
 			</label>
467
-			<input class="give-input required" type="text" name="give_first" placeholder="<?php _e( 'First name', 'give' ); ?>" id="give-first" value="<?php echo is_user_logged_in() ? $user_data->first_name : ''; ?>"<?php if ( give_field_is_required( 'give_first', $form_id ) ) { echo ' required '; } ?>/>
467
+			<input class="give-input required" type="text" name="give_first" placeholder="<?php _e('First name', 'give'); ?>" id="give-first" value="<?php echo is_user_logged_in() ? $user_data->first_name : ''; ?>"<?php if (give_field_is_required('give_first', $form_id)) { echo ' required '; } ?>/>
468 468
 		</p>
469 469
 
470 470
 		<p id="give-last-name-wrap" class="form-row form-row-last">
471 471
 			<label class="give-label" for="give-last">
472
-				<?php _e( 'Last Name', 'give' ); ?>
473
-				<?php if ( give_field_is_required( 'give_last', $form_id ) ) { ?>
472
+				<?php _e('Last Name', 'give'); ?>
473
+				<?php if (give_field_is_required('give_last', $form_id)) { ?>
474 474
 					<span class="give-required-indicator">*</span>
475 475
 				<?php } ?>
476
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'We will use this as well to personalize your account experience.', 'give' ); ?>"></span>
476
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('We will use this as well to personalize your account experience.', 'give'); ?>"></span>
477 477
 			</label>
478 478
 
479
-			<input class="give-input<?php if ( give_field_is_required( 'give_last', $form_id ) ) { echo ' required'; } ?>" type="text" name="give_last" id="give-last" placeholder="<?php _e( 'Last name', 'give' ); ?>" value="<?php echo is_user_logged_in() ? $user_data->last_name : ''; ?>"<?php if ( give_field_is_required( 'give_last', $form_id ) ) { echo ' required '; } ?> />
479
+			<input class="give-input<?php if (give_field_is_required('give_last', $form_id)) { echo ' required'; } ?>" type="text" name="give_last" id="give-last" placeholder="<?php _e('Last name', 'give'); ?>" value="<?php echo is_user_logged_in() ? $user_data->last_name : ''; ?>"<?php if (give_field_is_required('give_last', $form_id)) { echo ' required '; } ?> />
480 480
 		</p>
481 481
 
482
-		<?php do_action( 'give_purchase_form_before_email', $form_id ); ?>
482
+		<?php do_action('give_purchase_form_before_email', $form_id); ?>
483 483
 		<p id="give-email-wrap" class="form-row form-row-wide">
484 484
 			<label class="give-label" for="give-email">
485
-				<?php _e( 'Email Address', 'give' ); ?>
486
-				<?php if ( give_field_is_required( 'give_email', $form_id ) ) { ?>
485
+				<?php _e('Email Address', 'give'); ?>
486
+				<?php if (give_field_is_required('give_email', $form_id)) { ?>
487 487
 					<span class="give-required-indicator">*</span>
488 488
 				<?php } ?>
489
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'We will send the purchase receipt to this address.', 'give' ); ?>"></span>
489
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('We will send the purchase receipt to this address.', 'give'); ?>"></span>
490 490
 			</label>
491 491
 
492
-			<input class="give-input required" type="email" name="give_email" placeholder="<?php _e( 'Email address', 'give' ); ?>" id="give-email" value="<?php echo is_user_logged_in() ? $user_data->user_email : ''; ?>"<?php if ( give_field_is_required( 'give_email', $form_id ) ) { echo ' required '; } ?>/>
492
+			<input class="give-input required" type="email" name="give_email" placeholder="<?php _e('Email address', 'give'); ?>" id="give-email" value="<?php echo is_user_logged_in() ? $user_data->user_email : ''; ?>"<?php if (give_field_is_required('give_email', $form_id)) { echo ' required '; } ?>/>
493 493
 
494 494
 		</p>
495
-		<?php do_action( 'give_purchase_form_after_email', $form_id ); ?>
495
+		<?php do_action('give_purchase_form_after_email', $form_id); ?>
496 496
 
497
-		<?php do_action( 'give_purchase_form_user_info', $form_id ); ?>
497
+		<?php do_action('give_purchase_form_user_info', $form_id); ?>
498 498
 	</fieldset>
499 499
 	<?php
500
-	do_action( 'give_purchase_form_after_personal_info', $form_id );
500
+	do_action('give_purchase_form_after_personal_info', $form_id);
501 501
 
502 502
 }
503 503
 
504
-add_action( 'give_purchase_form_after_user_info', 'give_user_info_fields' );
505
-add_action( 'give_register_fields_before', 'give_user_info_fields' );
504
+add_action('give_purchase_form_after_user_info', 'give_user_info_fields');
505
+add_action('give_register_fields_before', 'give_user_info_fields');
506 506
 
507 507
 /**
508 508
  * Renders the credit card info form.
@@ -513,73 +513,73 @@  discard block
 block discarded – undo
513 513
  *
514 514
  * @return void
515 515
  */
516
-function give_get_cc_form( $form_id ) {
516
+function give_get_cc_form($form_id) {
517 517
 
518 518
 	ob_start();
519 519
 
520
-	do_action( 'give_before_cc_fields', $form_id ); ?>
520
+	do_action('give_before_cc_fields', $form_id); ?>
521 521
 
522 522
 	<fieldset id="give_cc_fields-<?php echo $form_id ?>" class="give-do-validate">
523
-		<legend><?php _e( 'Credit Card Info', 'give' ); ?></legend>
524
-		<?php if ( is_ssl() ) : ?>
523
+		<legend><?php _e('Credit Card Info', 'give'); ?></legend>
524
+		<?php if (is_ssl()) : ?>
525 525
 			<div id="give_secure_site_wrapper-<?php echo $form_id ?>">
526 526
 				<span class="give-icon padlock"></span>
527
-				<span><?php _e( 'This is a secure SSL encrypted payment.', 'give' ); ?></span>
527
+				<span><?php _e('This is a secure SSL encrypted payment.', 'give'); ?></span>
528 528
 			</div>
529 529
 		<?php endif; ?>
530 530
 		<p id="give-card-number-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds">
531 531
 			<label for="card_number" class="give-label">
532
-				<?php _e( 'Card Number', 'give' ); ?>
532
+				<?php _e('Card Number', 'give'); ?>
533 533
 				<span class="give-required-indicator">*</span>
534
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The (typically) 16 digits on the front of your credit card.', 'give' ); ?>"></span>
534
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The (typically) 16 digits on the front of your credit card.', 'give'); ?>"></span>
535 535
 				<span class="card-type"></span>
536 536
 			</label>
537 537
 
538
-			<input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>" class="card-number give-input required" placeholder="<?php _e( 'Card number', 'give' ); ?>" required/>
538
+			<input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>" class="card-number give-input required" placeholder="<?php _e('Card number', 'give'); ?>" required/>
539 539
 		</p>
540 540
 
541 541
 		<p id="give-card-cvc-wrap-<?php echo $form_id ?>" class="form-row form-row-one-third">
542 542
 			<label for="card_cvc" class="give-label">
543
-				<?php _e( 'CVC', 'give' ); ?>
543
+				<?php _e('CVC', 'give'); ?>
544 544
 				<span class="give-required-indicator">*</span>
545
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The 3 digit (back) or 4 digit (front) value on your card.', 'give' ); ?>"></span>
545
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The 3 digit (back) or 4 digit (front) value on your card.', 'give'); ?>"></span>
546 546
 			</label>
547 547
 
548
-			<input type="tel" size="4" autocomplete="off" name="card_cvc" id="card_cvc-<?php echo $form_id ?>" class="card-cvc give-input required" placeholder="<?php _e( 'Security code', 'give' ); ?>" required />
548
+			<input type="tel" size="4" autocomplete="off" name="card_cvc" id="card_cvc-<?php echo $form_id ?>" class="card-cvc give-input required" placeholder="<?php _e('Security code', 'give'); ?>" required />
549 549
 		</p>
550 550
 
551 551
 		<p id="give-card-name-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds">
552 552
 			<label for="card_name" class="give-label">
553
-				<?php _e( 'Name on the Card', 'give' ); ?>
553
+				<?php _e('Name on the Card', 'give'); ?>
554 554
 				<span class="give-required-indicator">*</span>
555
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The name printed on the front of your credit card.', 'give' ); ?>"></span>
555
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The name printed on the front of your credit card.', 'give'); ?>"></span>
556 556
 			</label>
557 557
 
558
-			<input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>" class="card-name give-input required" placeholder="<?php _e( 'Card name', 'give' ); ?>" required />
558
+			<input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>" class="card-name give-input required" placeholder="<?php _e('Card name', 'give'); ?>" required />
559 559
 		</p>
560
-		<?php do_action( 'give_before_cc_expiration' ); ?>
560
+		<?php do_action('give_before_cc_expiration'); ?>
561 561
 		<p class="card-expiration form-row form-row-one-third">
562 562
 			<label for="card_expiry-<?php echo $form_id ?>" class="give-label">
563
-				<?php _e( 'Expiration', 'give' ); ?>
563
+				<?php _e('Expiration', 'give'); ?>
564 564
 				<span class="give-required-indicator">*</span>
565
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The date your credit card expires, typically on the front of the card.', 'give' ); ?>"></span>
565
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The date your credit card expires, typically on the front of the card.', 'give'); ?>"></span>
566 566
 			</label>
567 567
 
568 568
 			<input type="hidden" id="card_exp_month-<?php echo $form_id ?>" name="card_exp_month" class="card-expiry-month" />
569 569
 			<input type="hidden" id="card_exp_year-<?php echo $form_id ?>" name="card_exp_year" class="card-expiry-year" />
570 570
 
571
-			<input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>" class="card-expiry give-input required" placeholder="<?php _e( 'MM / YY', 'give' ); ?>" required />
571
+			<input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>" class="card-expiry give-input required" placeholder="<?php _e('MM / YY', 'give'); ?>" required />
572 572
 		</p>
573
-		<?php do_action( 'give_after_cc_expiration', $form_id ); ?>
573
+		<?php do_action('give_after_cc_expiration', $form_id); ?>
574 574
 
575 575
 	</fieldset>
576 576
 	<?php
577
-	do_action( 'give_after_cc_fields', $form_id );
577
+	do_action('give_after_cc_fields', $form_id);
578 578
 
579 579
 	echo ob_get_clean();
580 580
 }
581 581
 
582
-add_action( 'give_cc_form', 'give_get_cc_form' );
582
+add_action('give_cc_form', 'give_get_cc_form');
583 583
 
584 584
 /**
585 585
  * Outputs the default credit card address fields
@@ -590,100 +590,100 @@  discard block
 block discarded – undo
590 590
  *
591 591
  * @return void
592 592
  */
593
-function give_default_cc_address_fields( $form_id ) {
593
+function give_default_cc_address_fields($form_id) {
594 594
 
595 595
 	$logged_in = is_user_logged_in();
596 596
 
597
-	if ( $logged_in ) {
598
-		$user_address = get_user_meta( get_current_user_id(), '_give_user_address', true );
597
+	if ($logged_in) {
598
+		$user_address = get_user_meta(get_current_user_id(), '_give_user_address', true);
599 599
 	}
600
-	$line1 = $logged_in && ! empty( $user_address['line1'] ) ? $user_address['line1'] : '';
601
-	$line2 = $logged_in && ! empty( $user_address['line2'] ) ? $user_address['line2'] : '';
602
-	$city  = $logged_in && ! empty( $user_address['city'] ) ? $user_address['city'] : '';
603
-	$zip   = $logged_in && ! empty( $user_address['zip'] ) ? $user_address['zip'] : '';
600
+	$line1 = $logged_in && ! empty($user_address['line1']) ? $user_address['line1'] : '';
601
+	$line2 = $logged_in && ! empty($user_address['line2']) ? $user_address['line2'] : '';
602
+	$city  = $logged_in && ! empty($user_address['city']) ? $user_address['city'] : '';
603
+	$zip   = $logged_in && ! empty($user_address['zip']) ? $user_address['zip'] : '';
604 604
 	ob_start(); ?>
605 605
 	<fieldset id="give_cc_address" class="cc-address">
606
-		<legend><?php _e( 'Billing Details', 'give' ); ?></legend>
607
-		<?php do_action( 'give_cc_billing_top' ); ?>
606
+		<legend><?php _e('Billing Details', 'give'); ?></legend>
607
+		<?php do_action('give_cc_billing_top'); ?>
608 608
 		<p id="give-card-address-wrap" class="form-row form-row-two-thirds">
609 609
 			<label for="card_address" class="give-label">
610
-				<?php _e( 'Address', 'give' ); ?>
610
+				<?php _e('Address', 'give'); ?>
611 611
 				<?php
612
-				if ( give_field_is_required( 'card_address', $form_id ) ) { ?>
612
+				if (give_field_is_required('card_address', $form_id)) { ?>
613 613
 					<span class="give-required-indicator">*</span>
614 614
 				<?php } ?>
615
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The primary billing address for your credit card.', 'give' ); ?>"></span>
615
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The primary billing address for your credit card.', 'give'); ?>"></span>
616 616
 			</label>
617 617
 
618
-			<input type="text" id="card_address" name="card_address" class="card-address give-input<?php if ( give_field_is_required( 'card_address', $form_id ) ) {
618
+			<input type="text" id="card_address" name="card_address" class="card-address give-input<?php if (give_field_is_required('card_address', $form_id)) {
619 619
 				echo ' required';
620
-			} ?>" placeholder="<?php _e( 'Address line 1', 'give' ); ?>" value="<?php echo $line1; ?>"<?php if ( give_field_is_required( 'card_address', $form_id ) ) { echo '  required '; } ?>/>
620
+			} ?>" placeholder="<?php _e('Address line 1', 'give'); ?>" value="<?php echo $line1; ?>"<?php if (give_field_is_required('card_address', $form_id)) { echo '  required '; } ?>/>
621 621
 		</p>
622 622
 
623 623
 		<p id="give-card-address-2-wrap" class="form-row form-row-one-third">
624 624
 			<label for="card_address_2" class="give-label">
625
-				<?php _e( 'Address Line 2', 'give' ); ?>
626
-				<?php if ( give_field_is_required( 'card_address_2', $form_id ) ) { ?>
625
+				<?php _e('Address Line 2', 'give'); ?>
626
+				<?php if (give_field_is_required('card_address_2', $form_id)) { ?>
627 627
 					<span class="give-required-indicator">*</span>
628 628
 				<?php } ?>
629
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( '(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give' ); ?>"></span>
629
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give'); ?>"></span>
630 630
 			</label>
631 631
 
632
-			<input type="text" id="card_address_2" name="card_address_2" class="card-address-2 give-input<?php if ( give_field_is_required( 'card_address_2', $form_id ) ) {
632
+			<input type="text" id="card_address_2" name="card_address_2" class="card-address-2 give-input<?php if (give_field_is_required('card_address_2', $form_id)) {
633 633
 				echo ' required';
634
-			} ?>" placeholder="<?php _e( 'Address line 2', 'give' ); ?>" value="<?php echo $line2; ?>"<?php if ( give_field_is_required( 'card_address_2', $form_id ) ) { echo ' required '; } ?>/>
634
+			} ?>" placeholder="<?php _e('Address line 2', 'give'); ?>" value="<?php echo $line2; ?>"<?php if (give_field_is_required('card_address_2', $form_id)) { echo ' required '; } ?>/>
635 635
 		</p>
636 636
 
637 637
 		<p id="give-card-city-wrap" class="form-row form-row-two-thirds">
638 638
 			<label for="card_city" class="give-label">
639
-				<?php _e( 'City', 'give' ); ?>
640
-				<?php if ( give_field_is_required( 'card_city', $form_id ) ) { ?>
639
+				<?php _e('City', 'give'); ?>
640
+				<?php if (give_field_is_required('card_city', $form_id)) { ?>
641 641
 					<span class="give-required-indicator">*</span>
642 642
 				<?php } ?>
643
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The city for your billing address.', 'give' ); ?>"></span>
643
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The city for your billing address.', 'give'); ?>"></span>
644 644
 			</label>
645
-			<input type="text" id="card_city" name="card_city" class="card-city give-input<?php if ( give_field_is_required( 'card_city', $form_id ) ) {
645
+			<input type="text" id="card_city" name="card_city" class="card-city give-input<?php if (give_field_is_required('card_city', $form_id)) {
646 646
 				echo ' required';
647
-			} ?>" placeholder="<?php _e( 'City', 'give' ); ?>" value="<?php echo $city; ?>"<?php if ( give_field_is_required( 'card_city', $form_id ) ) { echo ' required '; } ?>/>
647
+			} ?>" placeholder="<?php _e('City', 'give'); ?>" value="<?php echo $city; ?>"<?php if (give_field_is_required('card_city', $form_id)) { echo ' required '; } ?>/>
648 648
 		</p>
649 649
 
650 650
 		<p id="give-card-zip-wrap" class="form-row form-row-one-third">
651 651
 			<label for="card_zip" class="give-label">
652
-				<?php _e( 'Zip / Postal Code', 'give' ); ?>
653
-				<?php if ( give_field_is_required( 'card_zip', $form_id ) ) { ?>
652
+				<?php _e('Zip / Postal Code', 'give'); ?>
653
+				<?php if (give_field_is_required('card_zip', $form_id)) { ?>
654 654
 					<span class="give-required-indicator">*</span>
655 655
 				<?php } ?>
656
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The zip or postal code for your billing address.', 'give' ); ?>"></span>
656
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The zip or postal code for your billing address.', 'give'); ?>"></span>
657 657
 			</label>
658 658
 
659
-			<input type="text" size="4" id="card_zip" name="card_zip" class="card-zip give-input<?php if ( give_field_is_required( 'card_zip', $form_id ) ) {
659
+			<input type="text" size="4" id="card_zip" name="card_zip" class="card-zip give-input<?php if (give_field_is_required('card_zip', $form_id)) {
660 660
 				echo ' required';
661
-			} ?>" placeholder="<?php _e( 'Zip / Postal code', 'give' ); ?>" value="<?php echo $zip; ?>" <?php if ( give_field_is_required( 'card_zip', $form_id ) ) { echo ' required '; } ?>/>
661
+			} ?>" placeholder="<?php _e('Zip / Postal code', 'give'); ?>" value="<?php echo $zip; ?>" <?php if (give_field_is_required('card_zip', $form_id)) { echo ' required '; } ?>/>
662 662
 		</p>
663 663
 
664 664
 		<p id="give-card-country-wrap" class="form-row form-row-first">
665 665
 			<label for="billing_country" class="give-label">
666
-				<?php _e( 'Country', 'give' ); ?>
667
-				<?php if ( give_field_is_required( 'billing_country', $form_id ) ) { ?>
666
+				<?php _e('Country', 'give'); ?>
667
+				<?php if (give_field_is_required('billing_country', $form_id)) { ?>
668 668
 					<span class="give-required-indicator">*</span>
669 669
 				<?php } ?>
670
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The country for your billing address.', 'give' ); ?>"></span>
670
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The country for your billing address.', 'give'); ?>"></span>
671 671
 			</label>
672 672
 
673
-			<select name="billing_country" id="billing_country" class="billing-country billing_country give-select<?php if ( give_field_is_required( 'billing_country', $form_id ) ) {
673
+			<select name="billing_country" id="billing_country" class="billing-country billing_country give-select<?php if (give_field_is_required('billing_country', $form_id)) {
674 674
 				echo ' required';
675
-			} ?>"<?php if ( give_field_is_required( 'billing_country', $form_id ) ) { echo ' required '; } ?>>
675
+			} ?>"<?php if (give_field_is_required('billing_country', $form_id)) { echo ' required '; } ?>>
676 676
 				<?php
677 677
 
678 678
 				$selected_country = give_get_country();
679 679
 
680
-				if ( $logged_in && ! empty( $user_address['country'] ) && '*' !== $user_address['country'] ) {
680
+				if ($logged_in && ! empty($user_address['country']) && '*' !== $user_address['country']) {
681 681
 					$selected_country = $user_address['country'];
682 682
 				}
683 683
 
684 684
 				$countries = give_get_country_list();
685
-				foreach ( $countries as $country_code => $country ) {
686
-					echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>';
685
+				foreach ($countries as $country_code => $country) {
686
+					echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>';
687 687
 				}
688 688
 				?>
689 689
 			</select>
@@ -691,42 +691,42 @@  discard block
 block discarded – undo
691 691
 
692 692
 		<p id="give-card-state-wrap" class="form-row form-row-last">
693 693
 			<label for="card_state" class="give-label">
694
-				<?php _e( 'State / Province', 'give' ); ?>
695
-				<?php if ( give_field_is_required( 'card_state', $form_id ) ) { ?>
694
+				<?php _e('State / Province', 'give'); ?>
695
+				<?php if (give_field_is_required('card_state', $form_id)) { ?>
696 696
 					<span class="give-required-indicator">*</span>
697 697
 				<?php } ?>
698
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The state or province for your billing address.', 'give' ); ?>"></span>
698
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The state or province for your billing address.', 'give'); ?>"></span>
699 699
 			</label>
700 700
 
701 701
 			<?php
702 702
 			$selected_state = give_get_state();
703
-			$states         = give_get_states( $selected_country );
703
+			$states         = give_get_states($selected_country);
704 704
 
705
-			if ( $logged_in && ! empty( $user_address['state'] ) ) {
705
+			if ($logged_in && ! empty($user_address['state'])) {
706 706
 				$selected_state = $user_address['state'];
707 707
 			}
708 708
 
709
-			if ( ! empty( $states ) ) : ?>
710
-				<select name="card_state" id="card_state" class="card_state give-select<?php if ( give_field_is_required( 'card_state', $form_id ) ) {
709
+			if ( ! empty($states)) : ?>
710
+				<select name="card_state" id="card_state" class="card_state give-select<?php if (give_field_is_required('card_state', $form_id)) {
711 711
 					echo ' required';
712
-				} ?>"<?php if ( give_field_is_required( 'card_state', $form_id ) ) { echo ' required '; } ?>>
712
+				} ?>"<?php if (give_field_is_required('card_state', $form_id)) { echo ' required '; } ?>>
713 713
 					<?php
714
-					foreach ( $states as $state_code => $state ) {
715
-						echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>';
714
+					foreach ($states as $state_code => $state) {
715
+						echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>';
716 716
 					}
717 717
 					?>
718 718
 				</select>
719 719
 			<?php else : ?>
720
-				<input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php _e( 'State / Province', 'give' ); ?>" />
720
+				<input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php _e('State / Province', 'give'); ?>" />
721 721
 			<?php endif; ?>
722 722
 		</p>
723
-		<?php do_action( 'give_cc_billing_bottom' ); ?>
723
+		<?php do_action('give_cc_billing_bottom'); ?>
724 724
 	</fieldset>
725 725
 	<?php
726 726
 	echo ob_get_clean();
727 727
 }
728 728
 
729
-add_action( 'give_after_cc_fields', 'give_default_cc_address_fields' );
729
+add_action('give_after_cc_fields', 'give_default_cc_address_fields');
730 730
 
731 731
 
732 732
 /**
@@ -740,96 +740,96 @@  discard block
 block discarded – undo
740 740
  *
741 741
  * @return string
742 742
  */
743
-function give_get_register_fields( $form_id ) {
743
+function give_get_register_fields($form_id) {
744 744
 
745 745
 	global $give_options;
746 746
 	global $user_ID;
747 747
 
748
-	if ( is_user_logged_in() ) {
749
-		$user_data = get_userdata( $user_ID );
748
+	if (is_user_logged_in()) {
749
+		$user_data = get_userdata($user_ID);
750 750
 	}
751 751
 
752
-	$show_register_form = apply_filters( 'give_show_register_form', get_post_meta( $form_id, '_give_show_register_form', true ) );
752
+	$show_register_form = apply_filters('give_show_register_form', get_post_meta($form_id, '_give_show_register_form', true));
753 753
 
754 754
 	ob_start(); ?>
755 755
 	<fieldset id="give_register_fields">
756 756
 
757
-		<?php if ( $show_register_form == 'both' ) { ?>
757
+		<?php if ($show_register_form == 'both') { ?>
758 758
 			<div id="give-login-account-wrap">
759
-				<p class="give-login-message"><?php _e( 'Already have an account?', 'give' ); ?>&nbsp;
760
-					<a href="<?php echo esc_url( add_query_arg( 'login', 1 ) ); ?>" class="give_checkout_register_login" data-action="give_checkout_login"><?php _e( 'Login', 'give' ); ?></a>
759
+				<p class="give-login-message"><?php _e('Already have an account?', 'give'); ?>&nbsp;
760
+					<a href="<?php echo esc_url(add_query_arg('login', 1)); ?>" class="give_checkout_register_login" data-action="give_checkout_login"><?php _e('Login', 'give'); ?></a>
761 761
 				</p>
762 762
 
763 763
 				<p class="give-loading-text">
764
-					<span class="give-loading-animation"></span> <?php _e( 'Loading', 'give' ); ?>
764
+					<span class="give-loading-animation"></span> <?php _e('Loading', 'give'); ?>
765 765
 					<span class="elipsis">.</span><span class="elipsis">.</span><span class="elipsis">.</span></p>
766 766
 			</div>
767 767
 		<?php } ?>
768 768
 
769
-		<?php do_action( 'give_register_fields_before' ); ?>
769
+		<?php do_action('give_register_fields_before'); ?>
770 770
 
771 771
 		<fieldset id="give_register_account_fields">
772
-			<legend><?php _e( 'Create an account', 'give' );
773
-				if ( ! give_no_guest_checkout( $form_id ) ) {
774
-					echo ' <span class="sub-text">' . __( '(optional)', 'give' ) . '</span>';
772
+			<legend><?php _e('Create an account', 'give');
773
+				if ( ! give_no_guest_checkout($form_id)) {
774
+					echo ' <span class="sub-text">'.__('(optional)', 'give').'</span>';
775 775
 				} ?></legend>
776
-			<?php do_action( 'give_register_account_fields_before' ); ?>
776
+			<?php do_action('give_register_account_fields_before'); ?>
777 777
 			<p id="give-user-login-wrap" class="form-row form-row-one-third form-row-first">
778 778
 				<label for="give_user_login">
779
-					<?php _e( 'Username', 'give' ); ?>
780
-					<?php if ( give_no_guest_checkout( $form_id ) ) { ?>
779
+					<?php _e('Username', 'give'); ?>
780
+					<?php if (give_no_guest_checkout($form_id)) { ?>
781 781
 						<span class="give-required-indicator">*</span>
782 782
 					<?php } ?>
783
-					<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The username you will use to log into your account.', 'give' ); ?>"></span>
783
+					<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The username you will use to log into your account.', 'give'); ?>"></span>
784 784
 				</label>
785 785
 
786
-				<input name="give_user_login" id="give_user_login" class="<?php if ( give_no_guest_checkout( $form_id ) ) {
786
+				<input name="give_user_login" id="give_user_login" class="<?php if (give_no_guest_checkout($form_id)) {
787 787
 					echo 'required ';
788
-				} ?>give-input" type="text" placeholder="<?php _e( 'Username', 'give' ); ?>" title="<?php _e( 'Username', 'give' ); ?>" />
788
+				} ?>give-input" type="text" placeholder="<?php _e('Username', 'give'); ?>" title="<?php _e('Username', 'give'); ?>" />
789 789
 			</p>
790 790
 
791 791
 			<p id="give-user-pass-wrap" class="form-row form-row-one-third">
792 792
 				<label for="password">
793
-					<?php _e( 'Password', 'give' ); ?>
794
-					<?php if ( give_no_guest_checkout( $form_id ) ) { ?>
793
+					<?php _e('Password', 'give'); ?>
794
+					<?php if (give_no_guest_checkout($form_id)) { ?>
795 795
 						<span class="give-required-indicator">*</span>
796 796
 					<?php } ?>
797
-					<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The password used to access your account.', 'give' ); ?>"></span>
797
+					<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The password used to access your account.', 'give'); ?>"></span>
798 798
 				</label>
799 799
 
800
-				<input name="give_user_pass" id="give_user_pass" class="<?php if ( give_no_guest_checkout( $form_id ) ) {
800
+				<input name="give_user_pass" id="give_user_pass" class="<?php if (give_no_guest_checkout($form_id)) {
801 801
 					echo 'required ';
802
-				} ?>give-input" placeholder="<?php _e( 'Password', 'give' ); ?>" type="password" />
802
+				} ?>give-input" placeholder="<?php _e('Password', 'give'); ?>" type="password" />
803 803
 			</p>
804 804
 
805 805
 			<p id="give-user-pass-confirm-wrap" class="give_register_password form-row form-row-one-third">
806 806
 				<label for="password_again">
807
-					<?php _e( 'Password Again', 'give' ); ?>
808
-					<?php if ( give_no_guest_checkout( $form_id ) ) { ?>
807
+					<?php _e('Password Again', 'give'); ?>
808
+					<?php if (give_no_guest_checkout($form_id)) { ?>
809 809
 						<span class="give-required-indicator">*</span>
810 810
 					<?php } ?>
811
-					<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'Confirm your password.', 'give' ); ?>"></span>
811
+					<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('Confirm your password.', 'give'); ?>"></span>
812 812
 				</label>
813 813
 
814
-				<input name="give_user_pass_confirm" id="give_user_pass_confirm" class="<?php if ( give_no_guest_checkout( $form_id ) ) {
814
+				<input name="give_user_pass_confirm" id="give_user_pass_confirm" class="<?php if (give_no_guest_checkout($form_id)) {
815 815
 					echo 'required ';
816
-				} ?>give-input" placeholder="<?php _e( 'Confirm password', 'give' ); ?>" type="password" />
816
+				} ?>give-input" placeholder="<?php _e('Confirm password', 'give'); ?>" type="password" />
817 817
 			</p>
818
-			<?php do_action( 'give_register_account_fields_after', $form_id ); ?>
818
+			<?php do_action('give_register_account_fields_after', $form_id); ?>
819 819
 		</fieldset>
820 820
 
821
-		<?php do_action( 'give_register_fields_after', $form_id ); ?>
821
+		<?php do_action('give_register_fields_after', $form_id); ?>
822 822
 
823 823
 		<input type="hidden" name="give-purchase-var" value="needs-to-register" />
824 824
 
825
-		<?php do_action( 'give_purchase_form_user_info', $form_id ); ?>
825
+		<?php do_action('give_purchase_form_user_info', $form_id); ?>
826 826
 
827 827
 	</fieldset>
828 828
 	<?php
829 829
 	echo ob_get_clean();
830 830
 }
831 831
 
832
-add_action( 'give_purchase_form_register_fields', 'give_get_register_fields' );
832
+add_action('give_purchase_form_register_fields', 'give_get_register_fields');
833 833
 
834 834
 /**
835 835
  * Gets the login fields for the login form on the checkout. This function hooks
@@ -842,59 +842,59 @@  discard block
 block discarded – undo
842 842
  *
843 843
  * @return string
844 844
  */
845
-function give_get_login_fields( $form_id ) {
845
+function give_get_login_fields($form_id) {
846 846
 
847 847
 	global $give_options;
848 848
 
849
-	$color              = isset( $give_options['checkout_color'] ) ? $give_options['checkout_color'] : 'gray';
850
-	$color              = ( $color == 'inherit' ) ? '' : $color;
851
-	$show_register_form = give_get_option( 'show_register_form', 'none' );
849
+	$color              = isset($give_options['checkout_color']) ? $give_options['checkout_color'] : 'gray';
850
+	$color              = ($color == 'inherit') ? '' : $color;
851
+	$show_register_form = give_get_option('show_register_form', 'none');
852 852
 
853 853
 	ob_start();
854 854
 	?>
855 855
 	<fieldset id="give_login_fields">
856
-		<legend><?php _e( 'Login to Your Account', 'give' );
857
-			if ( ! give_no_guest_checkout( $form_id ) ) {
858
-				echo ' <span class="sub-text">' . __( '(optional)', 'give' ) . '</span>';
856
+		<legend><?php _e('Login to Your Account', 'give');
857
+			if ( ! give_no_guest_checkout($form_id)) {
858
+				echo ' <span class="sub-text">'.__('(optional)', 'give').'</span>';
859 859
 			} ?></legend>
860
-		<?php if ( $show_register_form == 'both' ) { ?>
860
+		<?php if ($show_register_form == 'both') { ?>
861 861
 			<p id="give-new-account-wrap">
862
-				<?php _e( 'Need to create an account?', 'give' ); ?>&nbsp;
863
-				<a href="<?php echo remove_query_arg( 'login' ); ?>" class="give_checkout_register_login" data-action="checkout_register">
864
-					<?php _e( 'Register', 'give' );
865
-					if ( ! give_no_guest_checkout( $form_id ) ) {
866
-						echo ' ' . __( 'or checkout as a guest.', 'give' );
862
+				<?php _e('Need to create an account?', 'give'); ?>&nbsp;
863
+				<a href="<?php echo remove_query_arg('login'); ?>" class="give_checkout_register_login" data-action="checkout_register">
864
+					<?php _e('Register', 'give');
865
+					if ( ! give_no_guest_checkout($form_id)) {
866
+						echo ' '.__('or checkout as a guest.', 'give');
867 867
 					} ?>
868 868
 				</a>
869 869
 			</p>
870 870
 		<?php } ?>
871
-		<?php do_action( 'give_checkout_login_fields_before', $form_id ); ?>
871
+		<?php do_action('give_checkout_login_fields_before', $form_id); ?>
872 872
 		<p id="give-user-login-wrap" class="form-row form-row-first">
873
-			<label class="give-label" for="give-username"><?php _e( 'Username', 'give' ); ?></label>
874
-			<input class="<?php if ( give_no_guest_checkout( $form_id ) ) {
873
+			<label class="give-label" for="give-username"><?php _e('Username', 'give'); ?></label>
874
+			<input class="<?php if (give_no_guest_checkout($form_id)) {
875 875
 				echo 'required ';
876
-			} ?>give-input" type="text" name="give_user_login" id="give_user_login" value="" placeholder="<?php _e( 'Your username', 'give' ); ?>" />
876
+			} ?>give-input" type="text" name="give_user_login" id="give_user_login" value="" placeholder="<?php _e('Your username', 'give'); ?>" />
877 877
 		</p>
878 878
 
879 879
 		<p id="give-user-pass-wrap" class="give_login_password form-row form-row-last">
880
-			<label class="give-label" for="give-password"><?php _e( 'Password', 'give' ); ?></label>
881
-			<input class="<?php if ( give_no_guest_checkout( $form_id ) ) {
880
+			<label class="give-label" for="give-password"><?php _e('Password', 'give'); ?></label>
881
+			<input class="<?php if (give_no_guest_checkout($form_id)) {
882 882
 				echo 'required ';
883
-			} ?>give-input" type="password" name="give_user_pass" id="give_user_pass" placeholder="<?php _e( 'Your password', 'give' ); ?>" />
883
+			} ?>give-input" type="password" name="give_user_pass" id="give_user_pass" placeholder="<?php _e('Your password', 'give'); ?>" />
884 884
 			<input type="hidden" name="give-purchase-var" value="needs-to-login" />
885 885
 		</p>
886 886
 
887 887
 		<p id="give-user-login-submit" class="give-clearfix">
888
-			<input type="submit" class="give-submit give-btn button <?php echo $color; ?>" name="give_login_submit" value="<?php _e( 'Login', 'give' ); ?>" />
888
+			<input type="submit" class="give-submit give-btn button <?php echo $color; ?>" name="give_login_submit" value="<?php _e('Login', 'give'); ?>" />
889 889
 			<span class="give-loading-animation"></span>
890 890
 		</p>
891
-		<?php do_action( 'give_checkout_login_fields_after' ); ?>
891
+		<?php do_action('give_checkout_login_fields_after'); ?>
892 892
 	</fieldset><!--end #give_login_fields-->
893 893
 	<?php
894 894
 	echo ob_get_clean();
895 895
 }
896 896
 
897
-add_action( 'give_purchase_form_login_fields', 'give_get_login_fields', 10, 1 );
897
+add_action('give_purchase_form_login_fields', 'give_get_login_fields', 10, 1);
898 898
 
899 899
 /**
900 900
  * Payment Mode Select
@@ -910,49 +910,49 @@  discard block
 block discarded – undo
910 910
  *
911 911
  * @return void
912 912
  */
913
-function give_payment_mode_select( $form_id ) {
913
+function give_payment_mode_select($form_id) {
914 914
 
915 915
 	$gateways = give_get_enabled_payment_gateways();
916 916
 
917
-	do_action( 'give_payment_mode_top', $form_id ); ?>
917
+	do_action('give_payment_mode_top', $form_id); ?>
918 918
 
919 919
 	<fieldset id="give-payment-mode-select">
920
-		<?php do_action( 'give_payment_mode_before_gateways_wrap' ); ?>
920
+		<?php do_action('give_payment_mode_before_gateways_wrap'); ?>
921 921
 		<div id="give-payment-mode-wrap">
922
-			<legend class="give-payment-mode-label"><?php echo apply_filters( 'give_checkout_payment_method_text', __( 'Select Payment Method', 'give' ) ); ?></legend>
922
+			<legend class="give-payment-mode-label"><?php echo apply_filters('give_checkout_payment_method_text', __('Select Payment Method', 'give')); ?></legend>
923 923
 			<?php
924 924
 
925
-			do_action( 'give_payment_mode_before_gateways' ) ?>
925
+			do_action('give_payment_mode_before_gateways') ?>
926 926
 
927 927
 			<ul id="give-gateway-radio-list">
928
-				<?php foreach ( $gateways as $gateway_id => $gateway ) :
929
-					$checked       = checked( $gateway_id, give_get_default_gateway( $form_id ), false );
928
+				<?php foreach ($gateways as $gateway_id => $gateway) :
929
+					$checked       = checked($gateway_id, give_get_default_gateway($form_id), false);
930 930
 					$checked_class = $checked ? ' give-gateway-option-selected' : '';
931
-					echo '<li><label for="give-gateway-' . esc_attr( $gateway_id ) . '-' . $form_id . '" class="give-gateway-option' . $checked_class . '" id="give-gateway-option-' . esc_attr( $gateway_id ) . '">';
932
-					echo '<input type="radio" name="payment-mode" class="give-gateway" id="give-gateway-' . esc_attr( $gateway_id ) . '-' . $form_id . '" value="' . esc_attr( $gateway_id ) . '"' . $checked . '>' . esc_html( $gateway['checkout_label'] );
931
+					echo '<li><label for="give-gateway-'.esc_attr($gateway_id).'-'.$form_id.'" class="give-gateway-option'.$checked_class.'" id="give-gateway-option-'.esc_attr($gateway_id).'">';
932
+					echo '<input type="radio" name="payment-mode" class="give-gateway" id="give-gateway-'.esc_attr($gateway_id).'-'.$form_id.'" value="'.esc_attr($gateway_id).'"'.$checked.'>'.esc_html($gateway['checkout_label']);
933 933
 					echo '</label></li>';
934 934
 				endforeach; ?>
935 935
 			</ul>
936
-			<?php do_action( 'give_payment_mode_after_gateways' ); ?>
937
-			<p class="give-loading-text"><span class="give-loading-animation"></span> <?php _e( 'Loading', 'give' ); ?>
936
+			<?php do_action('give_payment_mode_after_gateways'); ?>
937
+			<p class="give-loading-text"><span class="give-loading-animation"></span> <?php _e('Loading', 'give'); ?>
938 938
 				<span class="elipsis">.</span><span class="elipsis">.</span><span class="elipsis">.</span></p>
939 939
 		</div>
940
-		<?php do_action( 'give_payment_mode_after_gateways_wrap' ); ?>
940
+		<?php do_action('give_payment_mode_after_gateways_wrap'); ?>
941 941
 	</fieldset>
942 942
 
943
-	<?php do_action( 'give_payment_mode_bottom', $form_id ); ?>
943
+	<?php do_action('give_payment_mode_bottom', $form_id); ?>
944 944
 
945 945
 	<div id="give_purchase_form_wrap">
946 946
 
947
-		<?php do_action( 'give_purchase_form', $form_id ); ?>
947
+		<?php do_action('give_purchase_form', $form_id); ?>
948 948
 
949 949
 	</div><!-- the checkout fields are loaded into this-->
950 950
 
951
-	<?php do_action( 'give_purchase_form_wrap_bottom', $form_id );
951
+	<?php do_action('give_purchase_form_wrap_bottom', $form_id);
952 952
 
953 953
 }
954 954
 
955
-add_action( 'give_payment_mode_select', 'give_payment_mode_select' );
955
+add_action('give_payment_mode_select', 'give_payment_mode_select');
956 956
 
957 957
 
958 958
 /**
@@ -967,36 +967,36 @@  discard block
 block discarded – undo
967 967
  *
968 968
  * @return void
969 969
  */
970
-function give_terms_agreement( $form_id ) {
970
+function give_terms_agreement($form_id) {
971 971
 
972
-	$form_option = get_post_meta( $form_id, '_give_terms_option', true );
973
-	$label       = get_post_meta( $form_id, '_give_agree_label', true );
974
-	$terms       = get_post_meta( $form_id, '_give_agree_text', true );
972
+	$form_option = get_post_meta($form_id, '_give_terms_option', true);
973
+	$label       = get_post_meta($form_id, '_give_agree_label', true);
974
+	$terms       = get_post_meta($form_id, '_give_agree_text', true);
975 975
 
976
-	if ( $form_option === 'yes' && ! empty( $terms ) ) {
976
+	if ($form_option === 'yes' && ! empty($terms)) {
977 977
 
978 978
 		?>
979 979
 		<fieldset id="give_terms_agreement">
980 980
 			<div id="give_terms" style="display:none;">
981 981
 				<?php
982
-				do_action( 'give_before_terms' );
983
-				echo wpautop( stripslashes( $terms ) );
984
-				do_action( 'give_after_terms' );
982
+				do_action('give_before_terms');
983
+				echo wpautop(stripslashes($terms));
984
+				do_action('give_after_terms');
985 985
 				?>
986 986
 			</div>
987 987
 			<div id="give_show_terms">
988
-				<a href="#" class="give_terms_links"><?php _e( 'Show Terms', 'give' ); ?></a>
989
-				<a href="#" class="give_terms_links" style="display:none;"><?php _e( 'Hide Terms', 'give' ); ?></a>
988
+				<a href="#" class="give_terms_links"><?php _e('Show Terms', 'give'); ?></a>
989
+				<a href="#" class="give_terms_links" style="display:none;"><?php _e('Hide Terms', 'give'); ?></a>
990 990
 			</div>
991 991
 
992
-			<label for="give_agree_to_terms"><?php echo ! empty( $label ) ? stripslashes( $label ) : __( 'Agree to Terms?', 'give' ); ?></label>
992
+			<label for="give_agree_to_terms"><?php echo ! empty($label) ? stripslashes($label) : __('Agree to Terms?', 'give'); ?></label>
993 993
 			<input name="give_agree_to_terms" class="required" type="checkbox" id="give_agree_to_terms" value="1" />
994 994
 		</fieldset>
995 995
 		<?php
996 996
 	}
997 997
 }
998 998
 
999
-add_action( 'give_purchase_form_before_submit', 'give_terms_agreement', 10, 1 );
999
+add_action('give_purchase_form_before_submit', 'give_terms_agreement', 10, 1);
1000 1000
 
1001 1001
 /**
1002 1002
  * Checkout Final Total
@@ -1008,27 +1008,27 @@  discard block
 block discarded – undo
1008 1008
  * @since      1.0
1009 1009
  * @return void
1010 1010
  */
1011
-function give_checkout_final_total( $form_id ) {
1011
+function give_checkout_final_total($form_id) {
1012 1012
 
1013
-	if ( isset( $_POST['give_total'] ) ) {
1014
-		$total = apply_filters( 'give_donation_total', $_POST['give_total'] );
1013
+	if (isset($_POST['give_total'])) {
1014
+		$total = apply_filters('give_donation_total', $_POST['give_total']);
1015 1015
 	} else {
1016 1016
 		//default total
1017
-		$total = give_get_default_form_amount( $form_id );
1017
+		$total = give_get_default_form_amount($form_id);
1018 1018
 	}
1019 1019
 	//Only proceed if give_total available
1020
-	if ( empty( $total ) ) {
1020
+	if (empty($total)) {
1021 1021
 		return;
1022 1022
 	}
1023 1023
 	?>
1024 1024
 	<p id="give-final-total-wrap" class="form-wrap ">
1025
-		<span class="give-donation-total-label"><?php echo apply_filters( 'give_donation_total_label', __( 'Donation Total:', 'give' ) ); ?></span>
1026
-		<span class="give-final-total-amount" data-total="<?php echo give_format_amount( $total ); ?>"><?php echo give_currency_filter( give_format_amount( $total ) ); ?></span>
1025
+		<span class="give-donation-total-label"><?php echo apply_filters('give_donation_total_label', __('Donation Total:', 'give')); ?></span>
1026
+		<span class="give-final-total-amount" data-total="<?php echo give_format_amount($total); ?>"><?php echo give_currency_filter(give_format_amount($total)); ?></span>
1027 1027
 	</p>
1028 1028
 	<?php
1029 1029
 }
1030 1030
 
1031
-add_action( 'give_purchase_form_before_submit', 'give_checkout_final_total', 999 );
1031
+add_action('give_purchase_form_before_submit', 'give_checkout_final_total', 999);
1032 1032
 
1033 1033
 
1034 1034
 /**
@@ -1040,22 +1040,22 @@  discard block
 block discarded – undo
1040 1040
  *
1041 1041
  * @return void
1042 1042
  */
1043
-function give_checkout_submit( $form_id ) {
1043
+function give_checkout_submit($form_id) {
1044 1044
 	?>
1045 1045
 	<fieldset id="give_purchase_submit">
1046
-		<?php do_action( 'give_purchase_form_before_submit', $form_id ); ?>
1046
+		<?php do_action('give_purchase_form_before_submit', $form_id); ?>
1047 1047
 
1048
-		<?php give_checkout_hidden_fields( $form_id ); ?>
1048
+		<?php give_checkout_hidden_fields($form_id); ?>
1049 1049
 
1050
-		<?php echo give_checkout_button_purchase( $form_id ); ?>
1050
+		<?php echo give_checkout_button_purchase($form_id); ?>
1051 1051
 
1052
-		<?php do_action( 'give_purchase_form_after_submit', $form_id ); ?>
1052
+		<?php do_action('give_purchase_form_after_submit', $form_id); ?>
1053 1053
 
1054 1054
 	</fieldset>
1055 1055
 	<?php
1056 1056
 }
1057 1057
 
1058
-add_action( 'give_purchase_form_after_cc_form', 'give_checkout_submit', 9999 );
1058
+add_action('give_purchase_form_after_cc_form', 'give_checkout_submit', 9999);
1059 1059
 
1060 1060
 
1061 1061
 /**
@@ -1068,10 +1068,10 @@  discard block
 block discarded – undo
1068 1068
  *
1069 1069
  * @return string
1070 1070
  */
1071
-function give_checkout_button_purchase( $form_id ) {
1071
+function give_checkout_button_purchase($form_id) {
1072 1072
 
1073
-	$display_label_field = get_post_meta( $form_id, '_give_checkout_label', true );
1074
-	$display_label       = ( ! empty( $display_label_field ) ? $display_label_field : __( 'Donate Now', 'give' ) );
1073
+	$display_label_field = get_post_meta($form_id, '_give_checkout_label', true);
1074
+	$display_label       = ( ! empty($display_label_field) ? $display_label_field : __('Donate Now', 'give'));
1075 1075
 
1076 1076
 	ob_start();
1077 1077
 
@@ -1082,7 +1082,7 @@  discard block
 block discarded – undo
1082 1082
 		<span class="give-loading-animation"></span>
1083 1083
 	</div>
1084 1084
 	<?php
1085
-	return apply_filters( 'give_checkout_button_purchase', ob_get_clean(), $form_id );
1085
+	return apply_filters('give_checkout_button_purchase', ob_get_clean(), $form_id);
1086 1086
 }
1087 1087
 
1088 1088
 /**
@@ -1096,11 +1096,11 @@  discard block
 block discarded – undo
1096 1096
  *
1097 1097
  * @return void
1098 1098
  */
1099
-function give_agree_to_terms_js( $form_id ) {
1099
+function give_agree_to_terms_js($form_id) {
1100 1100
 
1101
-	$form_option = get_post_meta( $form_id, '_give_terms_option', true );
1101
+	$form_option = get_post_meta($form_id, '_give_terms_option', true);
1102 1102
 
1103
-	if ( $form_option === 'yes' ) {
1103
+	if ($form_option === 'yes') {
1104 1104
 		?>
1105 1105
 		<script type="text/javascript">
1106 1106
 			jQuery( document ).ready( function ( $ ) {
@@ -1116,7 +1116,7 @@  discard block
 block discarded – undo
1116 1116
 	}
1117 1117
 }
1118 1118
 
1119
-add_action( 'give_checkout_form_top', 'give_agree_to_terms_js', 10, 2 );
1119
+add_action('give_checkout_form_top', 'give_agree_to_terms_js', 10, 2);
1120 1120
 
1121 1121
 
1122 1122
 /**
@@ -1129,19 +1129,19 @@  discard block
 block discarded – undo
1129 1129
  *
1130 1130
  * @return void
1131 1131
  */
1132
-function give_form_content( $form_id, $args ) {
1132
+function give_form_content($form_id, $args) {
1133 1133
 
1134
-	$show_content = ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) )
1134
+	$show_content = (isset($args['show_content']) && ! empty($args['show_content']))
1135 1135
 		? $args['show_content']
1136
-		: get_post_meta( $form_id, '_give_content_option', true );
1136
+		: get_post_meta($form_id, '_give_content_option', true);
1137 1137
 
1138
-	if ( $show_content !== 'none' ) {
1138
+	if ($show_content !== 'none') {
1139 1139
 		//add action according to value
1140
-		add_action( $show_content, 'give_form_display_content' );
1140
+		add_action($show_content, 'give_form_display_content');
1141 1141
 	}
1142 1142
 }
1143 1143
 
1144
-add_action( 'give_pre_form_output', 'give_form_content', 10, 2 );
1144
+add_action('give_pre_form_output', 'give_form_content', 10, 2);
1145 1145
 
1146 1146
 /**
1147 1147
  * Show Give Goals
@@ -1153,24 +1153,24 @@  discard block
 block discarded – undo
1153 1153
  * @return mixed
1154 1154
  */
1155 1155
 
1156
-function give_show_goal_progress( $form_id, $args ) {
1156
+function give_show_goal_progress($form_id, $args) {
1157 1157
 
1158
-	$goal_option = get_post_meta( $form_id, '_give_goal_option', true );
1159
-	$form        = new Give_Donate_Form( $form_id );
1158
+	$goal_option = get_post_meta($form_id, '_give_goal_option', true);
1159
+	$form        = new Give_Donate_Form($form_id);
1160 1160
 	$goal        = $form->goal;
1161 1161
 	$income      = $form->get_earnings();
1162
-	$color       = get_post_meta( $form_id, '_give_goal_color', true );
1163
-	$show_text   = (bool) isset( $args['show_text'] ) ? filter_var( $args['show_text'], FILTER_VALIDATE_BOOLEAN ) : true;
1164
-	$show_bar    = (bool) isset( $args['show_bar'] ) ? filter_var( $args['show_bar'], FILTER_VALIDATE_BOOLEAN ) : true;
1162
+	$color       = get_post_meta($form_id, '_give_goal_color', true);
1163
+	$show_text   = (bool) isset($args['show_text']) ? filter_var($args['show_text'], FILTER_VALIDATE_BOOLEAN) : true;
1164
+	$show_bar    = (bool) isset($args['show_bar']) ? filter_var($args['show_bar'], FILTER_VALIDATE_BOOLEAN) : true;
1165 1165
 
1166 1166
 	//Sanity check - respect shortcode args
1167
-	if(isset($args['show_goal']) && $args['show_goal'] === false) {
1167
+	if (isset($args['show_goal']) && $args['show_goal'] === false) {
1168 1168
 		return false;
1169 1169
 	}
1170 1170
 
1171 1171
 	//Sanity check - ensure form has goal set to output
1172
-	if ( empty( $form->ID )
1173
-	     || ( is_singular( 'give_forms' ) && $goal_option !== 'yes' )
1172
+	if (empty($form->ID)
1173
+	     || (is_singular('give_forms') && $goal_option !== 'yes')
1174 1174
 	     || $goal_option !== 'yes'
1175 1175
 	     || $goal == 0
1176 1176
 	) {
@@ -1178,26 +1178,26 @@  discard block
 block discarded – undo
1178 1178
 		return false;
1179 1179
 	}
1180 1180
 
1181
-	$progress = round( ( $income / $goal ) * 100, 2 );
1181
+	$progress = round(($income / $goal) * 100, 2);
1182 1182
 
1183
-	if ( $income > $goal ) {
1183
+	if ($income > $goal) {
1184 1184
 		$progress = 100;
1185 1185
 	}
1186 1186
 
1187 1187
 	$output = '<div class="goal-progress">';
1188 1188
 
1189 1189
 	//Goal Progress Text
1190
-	if ( ! empty( $show_text ) ) {
1190
+	if ( ! empty($show_text)) {
1191 1191
 		$output .= '<div class="raised">';
1192
-		$output .= sprintf( _x( '%s of %s raised', 'This text displays the amount of income raised compared to the goal.', 'give' ), '<span class="income">' . give_currency_filter( give_format_amount( $income ) ) . '</span>', '<span class="goal-text">' . give_currency_filter( give_format_amount( $goal ) ) ) . '</span>';
1192
+		$output .= sprintf(_x('%s of %s raised', 'This text displays the amount of income raised compared to the goal.', 'give'), '<span class="income">'.give_currency_filter(give_format_amount($income)).'</span>', '<span class="goal-text">'.give_currency_filter(give_format_amount($goal))).'</span>';
1193 1193
 		$output .= '</div>';
1194 1194
 	}
1195 1195
 	//Goal Progress Bar
1196
-	if ( ! empty( $show_bar ) ) {
1196
+	if ( ! empty($show_bar)) {
1197 1197
 		$output .= '<div class="progress-bar">';
1198
-		$output .= '<span style="width: ' . esc_attr( $progress ) . '%;';
1199
-		if ( ! empty( $color ) ) {
1200
-			$output .= 'background-color:' . $color;
1198
+		$output .= '<span style="width: '.esc_attr($progress).'%;';
1199
+		if ( ! empty($color)) {
1200
+			$output .= 'background-color:'.$color;
1201 1201
 		}
1202 1202
 		$output .= '"></span>';
1203 1203
 		$output .= '</div><!-- /.progress-bar -->';
@@ -1205,13 +1205,13 @@  discard block
 block discarded – undo
1205 1205
 
1206 1206
 	$output .= '</div><!-- /.goal-progress -->';
1207 1207
 
1208
-	echo apply_filters( 'give_goal_output', $output );
1208
+	echo apply_filters('give_goal_output', $output);
1209 1209
 
1210 1210
 	return false;
1211 1211
 
1212 1212
 }
1213 1213
 
1214
-add_action( 'give_pre_form', 'give_show_goal_progress', 10, 2 );
1214
+add_action('give_pre_form', 'give_show_goal_progress', 10, 2);
1215 1215
 
1216 1216
 /**
1217 1217
  * Renders Post Form Content
@@ -1223,17 +1223,17 @@  discard block
 block discarded – undo
1223 1223
  * @return void
1224 1224
  * @since      1.0
1225 1225
  */
1226
-function give_form_display_content( $form_id ) {
1226
+function give_form_display_content($form_id) {
1227 1227
 
1228
-	$content = wpautop( get_post_meta( $form_id, '_give_form_content', true ) );
1228
+	$content = wpautop(get_post_meta($form_id, '_give_form_content', true));
1229 1229
 
1230
-	if ( give_get_option( 'disable_the_content_filter' ) !== 'on' ) {
1231
-		$content = apply_filters( 'the_content', $content );
1230
+	if (give_get_option('disable_the_content_filter') !== 'on') {
1231
+		$content = apply_filters('the_content', $content);
1232 1232
 	}
1233 1233
 
1234
-	$output = '<div id="give-form-content-' . $form_id . '" class="give-form-content-wrap" >' . $content . '</div>';
1234
+	$output = '<div id="give-form-content-'.$form_id.'" class="give-form-content-wrap" >'.$content.'</div>';
1235 1235
 
1236
-	echo apply_filters( 'give_form_content_output', $output );
1236
+	echo apply_filters('give_form_content_output', $output);
1237 1237
 }
1238 1238
 
1239 1239
 
@@ -1246,16 +1246,16 @@  discard block
 block discarded – undo
1246 1246
  *
1247 1247
  * @return void
1248 1248
  */
1249
-function give_checkout_hidden_fields( $form_id ) {
1249
+function give_checkout_hidden_fields($form_id) {
1250 1250
 
1251
-	do_action( 'give_hidden_fields_before', $form_id );
1252
-	if ( is_user_logged_in() ) { ?>
1251
+	do_action('give_hidden_fields_before', $form_id);
1252
+	if (is_user_logged_in()) { ?>
1253 1253
 		<input type="hidden" name="give-user-id" value="<?php echo get_current_user_id(); ?>" />
1254 1254
 	<?php } ?>
1255 1255
 	<input type="hidden" name="give_action" value="purchase" />
1256
-	<input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway( $form_id ); ?>" />
1256
+	<input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway($form_id); ?>" />
1257 1257
 	<?php
1258
-	do_action( 'give_hidden_fields_after', $form_id );
1258
+	do_action('give_hidden_fields_after', $form_id);
1259 1259
 
1260 1260
 }
1261 1261
 
@@ -1270,20 +1270,20 @@  discard block
 block discarded – undo
1270 1270
  *
1271 1271
  * @return string $content Filtered content
1272 1272
  */
1273
-function give_filter_success_page_content( $content ) {
1273
+function give_filter_success_page_content($content) {
1274 1274
 
1275 1275
 	global $give_options;
1276 1276
 
1277
-	if ( isset( $give_options['success_page'] ) && isset( $_GET['payment-confirmation'] ) && is_page( $give_options['success_page'] ) ) {
1278
-		if ( has_filter( 'give_payment_confirm_' . $_GET['payment-confirmation'] ) ) {
1279
-			$content = apply_filters( 'give_payment_confirm_' . $_GET['payment-confirmation'], $content );
1277
+	if (isset($give_options['success_page']) && isset($_GET['payment-confirmation']) && is_page($give_options['success_page'])) {
1278
+		if (has_filter('give_payment_confirm_'.$_GET['payment-confirmation'])) {
1279
+			$content = apply_filters('give_payment_confirm_'.$_GET['payment-confirmation'], $content);
1280 1280
 		}
1281 1281
 	}
1282 1282
 
1283 1283
 	return $content;
1284 1284
 }
1285 1285
 
1286
-add_filter( 'the_content', 'give_filter_success_page_content' );
1286
+add_filter('the_content', 'give_filter_success_page_content');
1287 1287
 
1288 1288
 
1289 1289
 /**
@@ -1295,11 +1295,11 @@  discard block
 block discarded – undo
1295 1295
 
1296 1296
 function give_test_mode_frontend_warning() {
1297 1297
 
1298
-	$test_mode = give_get_option( 'test_mode' );
1298
+	$test_mode = give_get_option('test_mode');
1299 1299
 
1300
-	if ( $test_mode == 'on' ) {
1301
-		echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>' . __( 'Notice', 'give' ) . '</strong>: ' . __( 'Test mode is enabled. While in test mode no live transactions are processed.', 'give' ) . '</p></div>';
1300
+	if ($test_mode == 'on') {
1301
+		echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>'.__('Notice', 'give').'</strong>: '.__('Test mode is enabled. While in test mode no live transactions are processed.', 'give').'</p></div>';
1302 1302
 	}
1303 1303
 }
1304 1304
 
1305
-add_action( 'give_pre_form', 'give_test_mode_frontend_warning', 10 );
1305
+add_action('give_pre_form', 'give_test_mode_frontend_warning', 10);
Please login to merge, or discard this patch.
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Give Form Template
4
- *
5
- * @package     Give
6
- * @subpackage  Forms
7
- * @copyright   Copyright (c) 2015, WordImpress
8
- * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
9
- * @since       1.0
10
- */
3
+	 * Give Form Template
4
+	 *
5
+	 * @package     Give
6
+	 * @subpackage  Forms
7
+	 * @copyright   Copyright (c) 2015, WordImpress
8
+	 * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
9
+	 * @since       1.0
10
+	 */
11 11
 
12 12
 // Exit if accessed directly
13 13
 if ( ! defined( 'ABSPATH' ) ) {
@@ -1170,9 +1170,9 @@  discard block
 block discarded – undo
1170 1170
 
1171 1171
 	//Sanity check - ensure form has goal set to output
1172 1172
 	if ( empty( $form->ID )
1173
-	     || ( is_singular( 'give_forms' ) && $goal_option !== 'yes' )
1174
-	     || $goal_option !== 'yes'
1175
-	     || $goal == 0
1173
+		 || ( is_singular( 'give_forms' ) && $goal_option !== 'yes' )
1174
+		 || $goal_option !== 'yes'
1175
+		 || $goal == 0
1176 1176
 	) {
1177 1177
 		//not this form, bail
1178 1178
 		return false;
Please login to merge, or discard this patch.