Test Failed
Pull Request — master (#2668)
by Devin
07:48
created
includes/admin/reports/graphing.php 1 patch
Spacing   +246 added lines, -246 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	$dates          = give_get_report_dates();
27 27
 
28 28
 	// Determine graph options.
29
-	switch ( $dates['range'] ) :
29
+	switch ($dates['range']) :
30 30
 		case 'today' :
31 31
 		case 'yesterday' :
32 32
 			$day_by_day = true;
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 			$day_by_day = false;
39 39
 			break;
40 40
 		case 'other' :
41
-			if ( $dates['m_end'] - $dates['m_start'] >= 2 || $dates['year_end'] > $dates['year'] && ( $dates['m_start'] != '12' && $dates['m_end'] != '1' ) ) {
41
+			if ($dates['m_end'] - $dates['m_start'] >= 2 || $dates['year_end'] > $dates['year'] && ($dates['m_start'] != '12' && $dates['m_end'] != '1')) {
42 42
 				$day_by_day = false;
43 43
 			} else {
44 44
 				$day_by_day = true;
@@ -55,60 +55,60 @@  discard block
 block discarded – undo
55 55
 	$earnings_data = array();
56 56
 	$sales_data    = array();
57 57
 
58
-	if ( 'today' === $dates['range'] || 'yesterday' === $dates['range'] ) {
58
+	if ('today' === $dates['range'] || 'yesterday' === $dates['range']) {
59 59
 
60 60
 		// Hour by hour.
61 61
 		$hour  = 0;
62
-		$month = date( 'n', current_time( 'timestamp' ) );
63
-		while ( $hour <= 23 ) :
62
+		$month = date('n', current_time('timestamp'));
63
+		while ($hour <= 23) :
64 64
 
65
-			$start_date = mktime( $hour, 0, 0, $month, $dates['day'], $dates['year'] );
66
-			$end_date   = mktime( $hour, 59, 59, $month, $dates['day'], $dates['year'] );
67
-			$sales      = $donation_stats->get_sales( 0, $start_date, $end_date );
68
-			$earnings   = $donation_stats->get_earnings( 0, $start_date, $end_date );
65
+			$start_date = mktime($hour, 0, 0, $month, $dates['day'], $dates['year']);
66
+			$end_date   = mktime($hour, 59, 59, $month, $dates['day'], $dates['year']);
67
+			$sales      = $donation_stats->get_sales(0, $start_date, $end_date);
68
+			$earnings   = $donation_stats->get_earnings(0, $start_date, $end_date);
69 69
 
70 70
 			$sales_totals    += $sales;
71 71
 			$earnings_totals += $earnings;
72 72
 
73
-			$sales_data[]    = array( $start_date * 1000, $sales );
74
-			$earnings_data[] = array( $start_date * 1000, $earnings );
73
+			$sales_data[]    = array($start_date * 1000, $sales);
74
+			$earnings_data[] = array($start_date * 1000, $earnings);
75 75
 
76
-			$hour ++;
76
+			$hour++;
77 77
 		endwhile;
78 78
 
79
-	} elseif ( 'this_week' === $dates['range'] || 'last_week' === $dates['range'] ) {
79
+	} elseif ('this_week' === $dates['range'] || 'last_week' === $dates['range']) {
80 80
 
81 81
 		// Day by day.
82 82
 		$day     = $dates['day'];
83 83
 		$day_end = $dates['day_end'];
84 84
 		$month   = $dates['m_start'];
85
-		while ( $day <= $day_end ) :
85
+		while ($day <= $day_end) :
86 86
 
87
-			$start_date = mktime( 0, 0, 0, $month, $day, $dates['year'] );
88
-			$end_date   = mktime( 23, 59, 59, $month, $day, $dates['year'] );
89
-			$sales      = $donation_stats->get_sales( 0, $start_date, $end_date );
90
-			$earnings   = $donation_stats->get_earnings( 0, $start_date, $end_date );
87
+			$start_date = mktime(0, 0, 0, $month, $day, $dates['year']);
88
+			$end_date   = mktime(23, 59, 59, $month, $day, $dates['year']);
89
+			$sales      = $donation_stats->get_sales(0, $start_date, $end_date);
90
+			$earnings   = $donation_stats->get_earnings(0, $start_date, $end_date);
91 91
 
92 92
 			$sales_totals    += $sales;
93 93
 			$earnings_totals += $earnings;
94 94
 
95
-			$sales_data[]    = array( $start_date * 1000, $sales );
96
-			$earnings_data[] = array( $start_date * 1000, $earnings );
97
-			$day ++;
95
+			$sales_data[]    = array($start_date * 1000, $sales);
96
+			$earnings_data[] = array($start_date * 1000, $earnings);
97
+			$day++;
98 98
 		endwhile;
99 99
 
100 100
 	} else {
101 101
 
102 102
 		$y = $dates['year'];
103
-		while ( $y <= $dates['year_end'] ) :
103
+		while ($y <= $dates['year_end']) :
104 104
 
105
-			if ( $dates['year'] === $dates['year_end'] ) {
105
+			if ($dates['year'] === $dates['year_end']) {
106 106
 				$month_start = $dates['m_start'];
107 107
 				$month_end   = $dates['m_end'];
108
-			} elseif ( $y === $dates['year'] ) {
108
+			} elseif ($y === $dates['year']) {
109 109
 				$month_start = $dates['m_start'];
110 110
 				$month_end   = 12;
111
-			} elseif ( $y === $dates['year_end'] ) {
111
+			} elseif ($y === $dates['year_end']) {
112 112
 				$month_start = 1;
113 113
 				$month_end   = $dates['m_end'];
114 114
 			} else {
@@ -117,67 +117,67 @@  discard block
 block discarded – undo
117 117
 			}
118 118
 
119 119
 			$i = $month_start;
120
-			while ( $i <= $month_end ) :
120
+			while ($i <= $month_end) :
121 121
 
122
-				if ( $day_by_day ) {
122
+				if ($day_by_day) {
123 123
 
124
-					if ( $i === $month_end ) {
124
+					if ($i === $month_end) {
125 125
 
126 126
 						$num_of_days = $dates['day_end'];
127 127
 
128 128
 					} else {
129 129
 
130
-						$num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y );
130
+						$num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y);
131 131
 
132 132
 					}
133 133
 
134 134
 					$d = $dates['day'];
135 135
 
136
-					while ( $d <= $num_of_days ) :
136
+					while ($d <= $num_of_days) :
137 137
 
138
-						$start_date = mktime( 0, 0, 0, $i, $d, $y );
139
-						$end_date   = mktime( 23, 59, 59, $i, $d, $y );
140
-						$sales      = $donation_stats->get_sales( 0, $start_date, $end_date );
141
-						$earnings   = $donation_stats->get_earnings( 0, $start_date, $end_date );
138
+						$start_date = mktime(0, 0, 0, $i, $d, $y);
139
+						$end_date   = mktime(23, 59, 59, $i, $d, $y);
140
+						$sales      = $donation_stats->get_sales(0, $start_date, $end_date);
141
+						$earnings   = $donation_stats->get_earnings(0, $start_date, $end_date);
142 142
 
143 143
 						$sales_totals    += $sales;
144 144
 						$earnings_totals += $earnings;
145 145
 
146
-						$sales_data[]    = array( $start_date * 1000, $sales );
147
-						$earnings_data[] = array( $start_date * 1000, $earnings );
146
+						$sales_data[]    = array($start_date * 1000, $sales);
147
+						$earnings_data[] = array($start_date * 1000, $earnings);
148 148
 
149
-						$d ++;
149
+						$d++;
150 150
 
151 151
 					endwhile;
152 152
 
153 153
 				} else {
154 154
 
155 155
 					// This Quarter, Last Quarter, This Year, Last Year.
156
-					$start_date = mktime( 0, 0, 0, $i, 1, $y );
157
-					$end_date   = mktime( 23, 59, 59, $i + 1, 0, $y );
158
-					$sales      = $donation_stats->get_sales( 0, $start_date, $end_date );
159
-					$earnings   = $donation_stats->get_earnings( 0, $start_date, $end_date );
156
+					$start_date = mktime(0, 0, 0, $i, 1, $y);
157
+					$end_date   = mktime(23, 59, 59, $i + 1, 0, $y);
158
+					$sales      = $donation_stats->get_sales(0, $start_date, $end_date);
159
+					$earnings   = $donation_stats->get_earnings(0, $start_date, $end_date);
160 160
 
161 161
 					$sales_totals    += $sales;
162 162
 					$earnings_totals += $earnings;
163 163
 
164
-					$sales_data[]    = array( $start_date * 1000, $sales );
165
-					$earnings_data[] = array( $start_date * 1000, $earnings );
164
+					$sales_data[]    = array($start_date * 1000, $sales);
165
+					$earnings_data[] = array($start_date * 1000, $earnings);
166 166
 
167 167
 				}
168 168
 
169
-				$i ++;
169
+				$i++;
170 170
 
171 171
 			endwhile;
172 172
 
173
-			$y ++;
173
+			$y++;
174 174
 		endwhile;
175 175
 
176 176
 	}
177 177
 
178 178
 	$data = array(
179
-		__( 'Income', 'give' )    => $earnings_data,
180
-		__( 'Donations', 'give' ) => $sales_data
179
+		__('Income', 'give')    => $earnings_data,
180
+		__('Donations', 'give') => $sales_data
181 181
 	);
182 182
 
183 183
 	// start our own output buffer.
@@ -190,12 +190,12 @@  discard block
 block discarded – undo
190 190
 				<div class="inside">
191 191
 					<?php give_reports_graph_controls(); ?>
192 192
 					<?php
193
-					$graph = new Give_Graph( $data, array( 'dataType' => array( 'amount', 'count' ) ) );
194
-					$graph->set( 'x_mode', 'time' );
195
-					$graph->set( 'multiple_y_axes', true );
193
+					$graph = new Give_Graph($data, array('dataType' => array('amount', 'count')));
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
 					?>
@@ -204,21 +204,21 @@  discard block
 block discarded – undo
204 204
 			<table class="widefat reports-table alignleft" style="max-width:450px">
205 205
 				<tbody>
206 206
 				<tr>
207
-					<th scope="row"><strong><?php _e( 'Total income for period:', 'give' ); ?></strong></th>
208
-					<td><?php echo give_currency_filter( give_format_amount( $earnings_totals, array( 'sanitize' => false ) ) ); ?></td>
207
+					<th scope="row"><strong><?php _e('Total income for period:', 'give'); ?></strong></th>
208
+					<td><?php echo give_currency_filter(give_format_amount($earnings_totals, array('sanitize' => false))); ?></td>
209 209
 				</tr>
210 210
 				<tr class="alternate">
211
-					<th scope="row"><strong><?php _e( 'Total donations for period:', 'give' ); ?><strong></th>
211
+					<th scope="row"><strong><?php _e('Total donations for period:', 'give'); ?><strong></th>
212 212
 					<td><?php echo $sales_totals; ?></td>
213 213
 				</tr>
214
-				<?php if ( 'this_month' === $dates['range'] ) : ?>
214
+				<?php if ('this_month' === $dates['range']) : ?>
215 215
 					<tr>
216
-						<th scope="row"><strong><?php _e( 'Estimated monthly income:', 'give' ); ?></strong></th>
217
-						<td><?php echo give_currency_filter( give_format_amount( $estimated['earnings'], array( 'sanitize' => false ) ) ); ?></td>
216
+						<th scope="row"><strong><?php _e('Estimated monthly income:', 'give'); ?></strong></th>
217
+						<td><?php echo give_currency_filter(give_format_amount($estimated['earnings'], array('sanitize' => false))); ?></td>
218 218
 					</tr>
219 219
 					<tr class="alternate">
220
-						<th scope="row"><strong><?php _e( 'Estimated monthly donations:', 'give' ); ?></strong></th>
221
-						<td><?php echo floor( $estimated['sales'] ); ?></td>
220
+						<th scope="row"><strong><?php _e('Estimated monthly donations:', 'give'); ?></strong></th>
221
+						<td><?php echo floor($estimated['sales']); ?></td>
222 222
 					</tr>
223 223
 				<?php endif; ?>
224 224
 			</table>
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 			 *
232 232
 			 * @since 1.0
233 233
 			 */
234
-			do_action( 'give_reports_graph_additional_stats' );
234
+			do_action('give_reports_graph_additional_stats');
235 235
 			?>
236 236
 
237 237
 		</div>
@@ -251,12 +251,12 @@  discard block
 block discarded – undo
251 251
  *
252 252
  * @return void
253 253
  */
254
-function give_reports_graph_of_form( $form_id = 0 ) {
254
+function give_reports_graph_of_form($form_id = 0) {
255 255
 	// Retrieve the queried dates.
256 256
 	$dates = give_get_report_dates();
257 257
 
258 258
 	// Determine graph options.
259
-	switch ( $dates['range'] ) :
259
+	switch ($dates['range']) :
260 260
 		case 'today' :
261 261
 		case 'yesterday' :
262 262
 			$day_by_day = true;
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
 			$day_by_day = false;
275 275
 			break;
276 276
 		case 'other' :
277
-			if ( $dates['m_end'] - $dates['m_start'] >= 2 || $dates['year_end'] > $dates['year'] ) {
277
+			if ($dates['m_end'] - $dates['m_start'] >= 2 || $dates['year_end'] > $dates['year']) {
278 278
 				$day_by_day = false;
279 279
 			} else {
280 280
 				$day_by_day = true;
@@ -286,75 +286,75 @@  discard block
 block discarded – undo
286 286
 	endswitch;
287 287
 
288 288
 	$earnings_totals = (float) 0.00; // Total earnings for time period shown.
289
-	$sales_totals    = 0;            // Total sales for time period shown.
289
+	$sales_totals    = 0; // Total sales for time period shown.
290 290
 
291 291
 	$earnings_data = array();
292 292
 	$sales_data    = array();
293 293
 	$stats         = new Give_Payment_Stats;
294 294
 
295
-	if ( $dates['range'] == 'today' || $dates['range'] == 'yesterday' ) {
295
+	if ($dates['range'] == 'today' || $dates['range'] == 'yesterday') {
296 296
 
297 297
 		// Hour by hour
298 298
 		$month  = $dates['m_start'];
299 299
 		$hour   = 0;
300 300
 		$minute = 0;
301 301
 		$second = 0;
302
-		while ( $hour <= 23 ) :
302
+		while ($hour <= 23) :
303 303
 
304
-			if ( $hour == 23 ) {
304
+			if ($hour == 23) {
305 305
 				$minute = $second = 59;
306 306
 			}
307 307
 
308
-			$date     = mktime( $hour, $minute, $second, $month, $dates['day'], $dates['year'] );
309
-			$date_end = mktime( $hour + 1, $minute, $second, $month, $dates['day'], $dates['year'] );
308
+			$date     = mktime($hour, $minute, $second, $month, $dates['day'], $dates['year']);
309
+			$date_end = mktime($hour + 1, $minute, $second, $month, $dates['day'], $dates['year']);
310 310
 
311
-			$sales = $stats->get_sales( $form_id, $date, $date_end );
311
+			$sales = $stats->get_sales($form_id, $date, $date_end);
312 312
 			$sales_totals += $sales;
313 313
 
314
-			$earnings = $stats->get_earnings( $form_id, $date, $date_end );
314
+			$earnings = $stats->get_earnings($form_id, $date, $date_end);
315 315
 			$earnings_totals += $earnings;
316 316
 
317
-			$sales_data[]    = array( $date * 1000, $sales );
318
-			$earnings_data[] = array( $date * 1000, $earnings );
317
+			$sales_data[]    = array($date * 1000, $sales);
318
+			$earnings_data[] = array($date * 1000, $earnings);
319 319
 
320
-			$hour ++;
320
+			$hour++;
321 321
 		endwhile;
322 322
 
323
-	} elseif ( $dates['range'] == 'this_week' || $dates['range'] == 'last_week' ) {
323
+	} elseif ($dates['range'] == 'this_week' || $dates['range'] == 'last_week') {
324 324
 
325 325
 		//Day by day.
326 326
 		$day     = $dates['day'];
327 327
 		$day_end = $dates['day_end'];
328 328
 		$month   = $dates['m_start'];
329
-		while ( $day <= $day_end ) :
329
+		while ($day <= $day_end) :
330 330
 
331
-			$date     = mktime( 0, 0, 0, $month, $day, $dates['year'] );
332
-			$date_end = mktime( 0, 0, 0, $month, $day + 1, $dates['year'] );
333
-			$sales    = $stats->get_sales( $form_id, $date, $date_end );
331
+			$date     = mktime(0, 0, 0, $month, $day, $dates['year']);
332
+			$date_end = mktime(0, 0, 0, $month, $day + 1, $dates['year']);
333
+			$sales    = $stats->get_sales($form_id, $date, $date_end);
334 334
 			$sales_totals += $sales;
335 335
 
336
-			$earnings = $stats->get_earnings( $form_id, $date, $date_end );
336
+			$earnings = $stats->get_earnings($form_id, $date, $date_end);
337 337
 			$earnings_totals += $earnings;
338 338
 
339
-			$sales_data[]    = array( $date * 1000, $sales );
340
-			$earnings_data[] = array( $date * 1000, $earnings );
339
+			$sales_data[]    = array($date * 1000, $sales);
340
+			$earnings_data[] = array($date * 1000, $earnings);
341 341
 
342
-			$day ++;
342
+			$day++;
343 343
 		endwhile;
344 344
 
345 345
 	} else {
346 346
 
347 347
 		$y = $dates['year'];
348 348
 
349
-		while ( $y <= $dates['year_end'] ) :
349
+		while ($y <= $dates['year_end']) :
350 350
 
351 351
 			$last_year = false;
352 352
 
353
-			if ( $dates['year'] == $dates['year_end'] ) {
353
+			if ($dates['year'] == $dates['year_end']) {
354 354
 				$month_start = $dates['m_start'];
355 355
 				$month_end   = $dates['m_end'];
356 356
 				$last_year   = true;
357
-			} elseif ( $y == $dates['year'] ) {
357
+			} elseif ($y == $dates['year']) {
358 358
 				$month_start = $dates['m_start'];
359 359
 				$month_end   = 12;
360 360
 			} else {
@@ -363,76 +363,76 @@  discard block
 block discarded – undo
363 363
 			}
364 364
 
365 365
 			$i = $month_start;
366
-			while ( $i <= $month_end ) :
366
+			while ($i <= $month_end) :
367 367
 
368
-				if ( $day_by_day ) {
368
+				if ($day_by_day) {
369 369
 
370
-					if ( $i == $month_end && $last_year ) {
370
+					if ($i == $month_end && $last_year) {
371 371
 
372 372
 						$num_of_days = $dates['day_end'];
373 373
 
374 374
 					} else {
375 375
 
376
-						$num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y );
376
+						$num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y);
377 377
 
378 378
 					}
379 379
 
380 380
 					$d = $dates['day'];
381
-					while ( $d <= $num_of_days ) :
381
+					while ($d <= $num_of_days) :
382 382
 
383
-						$date     = mktime( 0, 0, 0, $i, $d, $y );
384
-						$end_date = mktime( 23, 59, 59, $i, $d, $y );
383
+						$date     = mktime(0, 0, 0, $i, $d, $y);
384
+						$end_date = mktime(23, 59, 59, $i, $d, $y);
385 385
 
386
-						$sales = $stats->get_sales( $form_id, $date, $end_date );
386
+						$sales = $stats->get_sales($form_id, $date, $end_date);
387 387
 						$sales_totals += $sales;
388 388
 
389
-						$earnings = $stats->get_earnings( $form_id, $date, $end_date );
389
+						$earnings = $stats->get_earnings($form_id, $date, $end_date);
390 390
 						$earnings_totals += $earnings;
391 391
 
392
-						$sales_data[]    = array( $date * 1000, $sales );
393
-						$earnings_data[] = array( $date * 1000, $earnings );
394
-						$d ++;
392
+						$sales_data[]    = array($date * 1000, $sales);
393
+						$earnings_data[] = array($date * 1000, $earnings);
394
+						$d++;
395 395
 
396 396
 					endwhile;
397 397
 
398 398
 				} else {
399 399
 
400
-					$num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y );
400
+					$num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y);
401 401
 
402
-					$date     = mktime( 0, 0, 0, $i, 1, $y );
403
-					$end_date = mktime( 23, 59, 59, $i, $num_of_days, $y );
402
+					$date     = mktime(0, 0, 0, $i, 1, $y);
403
+					$end_date = mktime(23, 59, 59, $i, $num_of_days, $y);
404 404
 
405
-					$sales = $stats->get_sales( $form_id, $date, $end_date );
405
+					$sales = $stats->get_sales($form_id, $date, $end_date);
406 406
 					$sales_totals += $sales;
407 407
 
408
-					$earnings = $stats->get_earnings( $form_id, $date, $end_date );
408
+					$earnings = $stats->get_earnings($form_id, $date, $end_date);
409 409
 					$earnings_totals += $earnings;
410 410
 
411
-					$sales_data[]    = array( $date * 1000, $sales );
412
-					$earnings_data[] = array( $date * 1000, $earnings );
411
+					$sales_data[]    = array($date * 1000, $sales);
412
+					$earnings_data[] = array($date * 1000, $earnings);
413 413
 
414 414
 				}
415 415
 
416
-				$i ++;
416
+				$i++;
417 417
 
418 418
 			endwhile;
419 419
 
420
-			$y ++;
420
+			$y++;
421 421
 		endwhile;
422 422
 
423 423
 	}
424 424
 
425 425
 	$data = array(
426
-		__( 'Income', 'give' )    => $earnings_data,
427
-		__( 'Donations', 'give' ) => $sales_data
426
+		__('Income', 'give')    => $earnings_data,
427
+		__('Donations', 'give') => $sales_data
428 428
 	);
429 429
 
430 430
 	?>
431 431
 	<h3><span><?php
432 432
 			printf(
433 433
 			/* translators: %s: form title */
434
-				esc_html__( 'Income Report for %s', 'give' ),
435
-				get_the_title( $form_id )
434
+				esc_html__('Income Report for %s', 'give'),
435
+				get_the_title($form_id)
436 436
 			);
437 437
 			?></span></h3>
438 438
 	<div id="give-dashboard-widgets-wrap">
@@ -441,9 +441,9 @@  discard block
 block discarded – undo
441 441
 				<div class="inside">
442 442
 					<?php give_reports_graph_controls(); ?>
443 443
 					<?php
444
-					$graph = new Give_Graph( $data, array( 'dataType' => array( 'amount', 'count' ) ) );
445
-					$graph->set( 'x_mode', 'time' );
446
-					$graph->set( 'multiple_y_axes', true );
444
+					$graph = new Give_Graph($data, array('dataType' => array('amount', 'count')));
445
+					$graph->set('x_mode', 'time');
446
+					$graph->set('multiple_y_axes', true);
447 447
 					$graph->display();
448 448
 					?>
449 449
 				</div>
@@ -452,20 +452,20 @@  discard block
 block discarded – undo
452 452
 			<table class="widefat reports-table alignleft" style="max-width:450px">
453 453
 				<tbody>
454 454
 				<tr>
455
-					<th scope="row"><strong><?php _e( 'Total income for period:', 'give' ); ?></strong></th>
456
-					<td><?php echo give_currency_filter( give_format_amount( $earnings_totals, array( 'sanitize' => false ) ) ); ?></td>
455
+					<th scope="row"><strong><?php _e('Total income for period:', 'give'); ?></strong></th>
456
+					<td><?php echo give_currency_filter(give_format_amount($earnings_totals, array('sanitize' => false))); ?></td>
457 457
 				</tr>
458 458
 				<tr class="alternate">
459
-					<th scope="row"><strong><?php _e( 'Total donations for period:', 'give' ); ?></strong></th>
459
+					<th scope="row"><strong><?php _e('Total donations for period:', 'give'); ?></strong></th>
460 460
 					<td><?php echo $sales_totals; ?></td>
461 461
 				</tr>
462 462
 				<tr>
463
-					<th scope="row"><strong><?php _e( 'Average monthly income:', 'give' ); ?></strong></th>
464
-					<td><?php echo give_currency_filter( give_format_amount( give_get_average_monthly_form_earnings( $form_id ), array( 'sanitize' => false ) ) ); ?></td>
463
+					<th scope="row"><strong><?php _e('Average monthly income:', 'give'); ?></strong></th>
464
+					<td><?php echo give_currency_filter(give_format_amount(give_get_average_monthly_form_earnings($form_id), array('sanitize' => false))); ?></td>
465 465
 				</tr>
466 466
 				<tr class="alternate">
467
-					<th scope="row"><strong><?php _e( 'Average monthly donations:', 'give' ); ?></strong></th>
468
-					<td><?php echo number_format( give_get_average_monthly_form_sales( $form_id ), 0 ); ?></td>
467
+					<th scope="row"><strong><?php _e('Average monthly donations:', 'give'); ?></strong></th>
468
+					<td><?php echo number_format(give_get_average_monthly_form_sales($form_id), 0); ?></td>
469 469
 				</tr>
470 470
 				</tbody>
471 471
 			</table>
@@ -484,26 +484,26 @@  discard block
 block discarded – undo
484 484
  * @return void
485 485
  */
486 486
 function give_reports_graph_controls() {
487
-	$date_options = apply_filters( 'give_report_date_options', array(
488
-		'today'        => __( 'Today', 'give' ),
489
-		'yesterday'    => __( 'Yesterday', 'give' ),
490
-		'this_week'    => __( 'This Week', 'give' ),
491
-		'last_week'    => __( 'Last Week', 'give' ),
492
-		'this_month'   => __( 'This Month', 'give' ),
493
-		'last_month'   => __( 'Last Month', 'give' ),
494
-		'this_quarter' => __( 'This Quarter', 'give' ),
495
-		'last_quarter' => __( 'Last Quarter', 'give' ),
496
-		'this_year'    => __( 'This Year', 'give' ),
497
-		'last_year'    => __( 'Last Year', 'give' ),
498
-		'other'        => __( 'Custom', 'give' )
499
-	) );
487
+	$date_options = apply_filters('give_report_date_options', array(
488
+		'today'        => __('Today', 'give'),
489
+		'yesterday'    => __('Yesterday', 'give'),
490
+		'this_week'    => __('This Week', 'give'),
491
+		'last_week'    => __('Last Week', 'give'),
492
+		'this_month'   => __('This Month', 'give'),
493
+		'last_month'   => __('Last Month', 'give'),
494
+		'this_quarter' => __('This Quarter', 'give'),
495
+		'last_quarter' => __('Last Quarter', 'give'),
496
+		'this_year'    => __('This Year', 'give'),
497
+		'last_year'    => __('Last Year', 'give'),
498
+		'other'        => __('Custom', 'give')
499
+	));
500 500
 
501 501
 	$dates   = give_get_report_dates();
502 502
 	$display = $dates['range'] == 'other' ? '' : 'display: none;';
503
-	$tab     = isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : 'earnings';
503
+	$tab     = isset($_GET['tab']) ? sanitize_text_field($_GET['tab']) : 'earnings';
504 504
 
505
-	if ( empty( $dates['day_end'] ) ) {
506
-		$dates['day_end'] = cal_days_in_month( CAL_GREGORIAN, date( 'n' ), date( 'Y' ) );
505
+	if (empty($dates['day_end'])) {
506
+		$dates['day_end'] = cal_days_in_month(CAL_GREGORIAN, date('n'), date('Y'));
507 507
 	}
508 508
 
509 509
 	/**
@@ -511,7 +511,7 @@  discard block
 block discarded – undo
511 511
 	 *
512 512
 	 * @since 1.0
513 513
 	 */
514
-	do_action( 'give_report_graph_controls_before' );
514
+	do_action('give_report_graph_controls_before');
515 515
 	?>
516 516
 	<form id="give-graphs-filter" method="get">
517 517
 		<div class="tablenav top">
@@ -519,56 +519,56 @@  discard block
 block discarded – undo
519 519
 
520 520
 				<input type="hidden" name="post_type" value="give_forms" />
521 521
 				<input type="hidden" name="page" value="give-reports" />
522
-				<input type="hidden" name="tab" value="<?php echo esc_attr( $tab ); ?>" />
522
+				<input type="hidden" name="tab" value="<?php echo esc_attr($tab); ?>" />
523 523
 
524
-				<?php if ( isset( $_GET['form-id'] ) ) : ?>
525
-					<input type="hidden" name="form-id" value="<?php echo absint( $_GET['form-id'] ); ?>" />
524
+				<?php if (isset($_GET['form-id'])) : ?>
525
+					<input type="hidden" name="form-id" value="<?php echo absint($_GET['form-id']); ?>" />
526 526
 				<?php endif; ?>
527 527
 
528 528
 				<div id="give-graphs-date-options-wrap">
529 529
 					<select id="give-graphs-date-options" name="range">
530
-						<?php foreach ( $date_options as $key => $option ) : ?>
531
-							<option value="<?php echo esc_attr( $key ); ?>"<?php selected( $key, $dates['range'] ); ?>><?php echo esc_html( $option ); ?></option>
530
+						<?php foreach ($date_options as $key => $option) : ?>
531
+							<option value="<?php echo esc_attr($key); ?>"<?php selected($key, $dates['range']); ?>><?php echo esc_html($option); ?></option>
532 532
 						<?php endforeach; ?>
533 533
 					</select>
534 534
 
535
-					<div id="give-date-range-options" style="<?php echo esc_attr( $display ); ?>">
536
-						<span class="screen-reader-text"><?php _e( 'From', 'give' ); ?>&nbsp;</span>
535
+					<div id="give-date-range-options" style="<?php echo esc_attr($display); ?>">
536
+						<span class="screen-reader-text"><?php _e('From', 'give'); ?>&nbsp;</span>
537 537
 						<select id="give-graphs-month-start" name="m_start" aria-label="Start Month">
538
-							<?php for ( $i = 1; $i <= 12; $i ++ ) : ?>
539
-								<option value="<?php echo absint( $i ); ?>" <?php echo esc_attr( selected( $i, $dates['m_start'] ) ); ?>><?php echo esc_html( give_month_num_to_name( $i ) ); ?></option>
538
+							<?php for ($i = 1; $i <= 12; $i++) : ?>
539
+								<option value="<?php echo absint($i); ?>" <?php echo esc_attr(selected($i, $dates['m_start'])); ?>><?php echo esc_html(give_month_num_to_name($i)); ?></option>
540 540
 							<?php endfor; ?>
541 541
 						</select>
542 542
 						<select id="give-graphs-day-start" name="day" aria-label="Start Day">
543
-							<?php for ( $i = 1; $i <= 31; $i ++ ) : ?>
544
-								<option value="<?php echo absint( $i ); ?>" <?php echo esc_attr( selected( $i, $dates['day'] ) ); ?>><?php echo esc_html( $i ); ?></option>
543
+							<?php for ($i = 1; $i <= 31; $i++) : ?>
544
+								<option value="<?php echo absint($i); ?>" <?php echo esc_attr(selected($i, $dates['day'])); ?>><?php echo esc_html($i); ?></option>
545 545
 							<?php endfor; ?>
546 546
 						</select>
547 547
 						<select id="give-graphs-year-start" name="year" aria-label="Start Year">
548
-							<?php for ( $i = 2007; $i <= date( 'Y' ); $i ++ ) : ?>
549
-								<option value="<?php echo absint( $i ); ?>" <?php echo esc_attr( selected( $i, $dates['year'] ) ); ?>><?php echo esc_html( $i ); ?></option>
548
+							<?php for ($i = 2007; $i <= date('Y'); $i++) : ?>
549
+								<option value="<?php echo absint($i); ?>" <?php echo esc_attr(selected($i, $dates['year'])); ?>><?php echo esc_html($i); ?></option>
550 550
 							<?php endfor; ?>
551 551
 						</select>
552
-						<span class="screen-reader-text"><?php esc_html_e( 'To', 'give' ); ?>&nbsp;</span>
552
+						<span class="screen-reader-text"><?php esc_html_e('To', 'give'); ?>&nbsp;</span>
553 553
 						<span>&ndash;</span>
554 554
 						<select id="give-graphs-month-end" name="m_end" aria-label="End Month">
555
-							<?php for ( $i = 1; $i <= 12; $i ++ ) : ?>
556
-								<option value="<?php echo absint( $i ); ?>" <?php echo esc_attr( selected( $i, $dates['m_end'] ) ); ?>><?php echo esc_html( give_month_num_to_name( $i ) ); ?></option>
555
+							<?php for ($i = 1; $i <= 12; $i++) : ?>
556
+								<option value="<?php echo absint($i); ?>" <?php echo esc_attr(selected($i, $dates['m_end'])); ?>><?php echo esc_html(give_month_num_to_name($i)); ?></option>
557 557
 							<?php endfor; ?>
558 558
 						</select>
559 559
 						<select id="give-graphs-day-end" name="day_end" aria-label="End Day">
560
-							<?php for ( $i = 1; $i <= 31; $i ++ ) : ?>
561
-								<option value="<?php echo absint( $i ); ?>" <?php echo esc_attr( selected( $i, $dates['day_end'] ) ); ?>><?php echo esc_html( $i ); ?></option>
560
+							<?php for ($i = 1; $i <= 31; $i++) : ?>
561
+								<option value="<?php echo absint($i); ?>" <?php echo esc_attr(selected($i, $dates['day_end'])); ?>><?php echo esc_html($i); ?></option>
562 562
 							<?php endfor; ?>
563 563
 						</select>
564 564
 						<select id="give-graphs-year-end" name="year_end" aria-label="End Year">
565
-							<?php for ( $i = 2007; $i <= date( 'Y' ); $i ++ ) : ?>
566
-								<option value="<?php echo absint( $i ); ?>" <?php echo esc_attr( selected( $i, $dates['year_end'] ) ); ?>><?php echo esc_html( $i ); ?></option>
565
+							<?php for ($i = 2007; $i <= date('Y'); $i++) : ?>
566
+								<option value="<?php echo absint($i); ?>" <?php echo esc_attr(selected($i, $dates['year_end'])); ?>><?php echo esc_html($i); ?></option>
567 567
 							<?php endfor; ?>
568 568
 						</select>
569 569
 					</div>
570 570
 
571
-					<input type="submit" class="button-secondary" value="<?php _e( 'Filter', 'give' ); ?>" />
571
+					<input type="submit" class="button-secondary" value="<?php _e('Filter', 'give'); ?>" />
572 572
 				</div>
573 573
 
574 574
 				<input type="hidden" name="give_action" value="filter_reports" />
@@ -581,7 +581,7 @@  discard block
 block discarded – undo
581 581
 	 *
582 582
 	 * @since 1.0
583 583
 	 */
584
-	do_action( 'give_report_graph_controls_after' );
584
+	do_action('give_report_graph_controls_after');
585 585
 }
586 586
 
587 587
 /**
@@ -597,67 +597,67 @@  discard block
 block discarded – undo
597 597
 function give_get_report_dates() {
598 598
 	$dates = array();
599 599
 
600
-	$current_time = current_time( 'timestamp' );
600
+	$current_time = current_time('timestamp');
601 601
 
602
-	$dates['range']    = isset( $_GET['range'] ) ? $_GET['range'] : 'this_month';
603
-	$dates['year']     = isset( $_GET['year'] ) ? $_GET['year'] : date( 'Y' );
604
-	$dates['year_end'] = isset( $_GET['year_end'] ) ? $_GET['year_end'] : date( 'Y' );
605
-	$dates['m_start']  = isset( $_GET['m_start'] ) ? $_GET['m_start'] : 1;
606
-	$dates['m_end']    = isset( $_GET['m_end'] ) ? $_GET['m_end'] : 12;
607
-	$dates['day']      = isset( $_GET['day'] ) ? $_GET['day'] : 1;
608
-	$dates['day_end']  = isset( $_GET['day_end'] ) ? $_GET['day_end'] : cal_days_in_month( CAL_GREGORIAN, $dates['m_end'], $dates['year'] );
602
+	$dates['range']    = isset($_GET['range']) ? $_GET['range'] : 'this_month';
603
+	$dates['year']     = isset($_GET['year']) ? $_GET['year'] : date('Y');
604
+	$dates['year_end'] = isset($_GET['year_end']) ? $_GET['year_end'] : date('Y');
605
+	$dates['m_start']  = isset($_GET['m_start']) ? $_GET['m_start'] : 1;
606
+	$dates['m_end']    = isset($_GET['m_end']) ? $_GET['m_end'] : 12;
607
+	$dates['day']      = isset($_GET['day']) ? $_GET['day'] : 1;
608
+	$dates['day_end']  = isset($_GET['day_end']) ? $_GET['day_end'] : cal_days_in_month(CAL_GREGORIAN, $dates['m_end'], $dates['year']);
609 609
 
610 610
 	// Modify dates based on predefined ranges.
611
-	switch ( $dates['range'] ) :
611
+	switch ($dates['range']) :
612 612
 
613 613
 		case 'this_month' :
614
-			$dates['m_start']  = date( 'n', $current_time );
615
-			$dates['m_end']    = date( 'n', $current_time );
614
+			$dates['m_start']  = date('n', $current_time);
615
+			$dates['m_end']    = date('n', $current_time);
616 616
 			$dates['day']      = 1;
617
-			$dates['day_end']  = cal_days_in_month( CAL_GREGORIAN, $dates['m_end'], $dates['year'] );
618
-			$dates['year']     = date( 'Y' );
619
-			$dates['year_end'] = date( 'Y' );
617
+			$dates['day_end']  = cal_days_in_month(CAL_GREGORIAN, $dates['m_end'], $dates['year']);
618
+			$dates['year']     = date('Y');
619
+			$dates['year_end'] = date('Y');
620 620
 			break;
621 621
 
622 622
 		case 'last_month' :
623
-			if ( date( 'n' ) == 1 ) {
623
+			if (date('n') == 1) {
624 624
 				$dates['m_start']  = 12;
625 625
 				$dates['m_end']    = 12;
626
-				$dates['year']     = date( 'Y', $current_time ) - 1;
627
-				$dates['year_end'] = date( 'Y', $current_time ) - 1;
626
+				$dates['year']     = date('Y', $current_time) - 1;
627
+				$dates['year_end'] = date('Y', $current_time) - 1;
628 628
 			} else {
629
-				$dates['m_start']  = date( 'n' ) - 1;
630
-				$dates['m_end']    = date( 'n' ) - 1;
629
+				$dates['m_start']  = date('n') - 1;
630
+				$dates['m_end']    = date('n') - 1;
631 631
 				$dates['year_end'] = $dates['year'];
632 632
 			}
633
-			$dates['day_end'] = cal_days_in_month( CAL_GREGORIAN, $dates['m_end'], $dates['year'] );
633
+			$dates['day_end'] = cal_days_in_month(CAL_GREGORIAN, $dates['m_end'], $dates['year']);
634 634
 			break;
635 635
 
636 636
 		case 'today' :
637
-			$dates['day']      = date( 'd', $current_time );
638
-			$dates['day_end']  = date( 'd', $current_time );
639
-			$dates['m_start']  = date( 'n', $current_time );
640
-			$dates['m_end']    = date( 'n', $current_time );
641
-			$dates['year']     = date( 'Y', $current_time );
642
-			$dates['year_end'] = date( 'Y', $current_time );
637
+			$dates['day']      = date('d', $current_time);
638
+			$dates['day_end']  = date('d', $current_time);
639
+			$dates['m_start']  = date('n', $current_time);
640
+			$dates['m_end']    = date('n', $current_time);
641
+			$dates['year']     = date('Y', $current_time);
642
+			$dates['year_end'] = date('Y', $current_time);
643 643
 			break;
644 644
 
645 645
 		case 'yesterday' :
646 646
 
647
-			$year  = date( 'Y', $current_time );
648
-			$month = date( 'n', $current_time );
649
-			$day   = date( 'd', $current_time );
647
+			$year  = date('Y', $current_time);
648
+			$month = date('n', $current_time);
649
+			$day   = date('d', $current_time);
650 650
 
651
-			if ( $month == 1 && $day == 1 ) {
651
+			if ($month == 1 && $day == 1) {
652 652
 
653 653
 				$year -= 1;
654 654
 				$month = 12;
655
-				$day   = cal_days_in_month( CAL_GREGORIAN, $month, $year );
655
+				$day   = cal_days_in_month(CAL_GREGORIAN, $month, $year);
656 656
 
657
-			} elseif ( $month > 1 && $day == 1 ) {
657
+			} elseif ($month > 1 && $day == 1) {
658 658
 
659 659
 				$month -= 1;
660
-				$day = cal_days_in_month( CAL_GREGORIAN, $month, $year );
660
+				$day = cal_days_in_month(CAL_GREGORIAN, $month, $year);
661 661
 
662 662
 			} else {
663 663
 
@@ -673,48 +673,48 @@  discard block
 block discarded – undo
673 673
 			break;
674 674
 
675 675
 		case 'this_week' :
676
-			$dates['day'] = date( 'd', $current_time - ( date( 'w', $current_time ) - 1 ) * 60 * 60 * 24 ) - 1;
677
-			$dates['day'] += get_option( 'start_of_week' );
676
+			$dates['day'] = date('d', $current_time - (date('w', $current_time) - 1) * 60 * 60 * 24) - 1;
677
+			$dates['day'] += get_option('start_of_week');
678 678
 			$dates['day_end'] = $dates['day'] + 6;
679
-			$dates['m_start'] = date( 'n', $current_time );
680
-			$dates['m_end']   = date( 'n', $current_time );
681
-			$dates['year']    = date( 'Y', $current_time );
679
+			$dates['m_start'] = date('n', $current_time);
680
+			$dates['m_end']   = date('n', $current_time);
681
+			$dates['year']    = date('Y', $current_time);
682 682
 			break;
683 683
 
684 684
 		case 'last_week' :
685
-			$dates['day'] = date( 'd', $current_time - ( date( 'w' ) - 1 ) * 60 * 60 * 24 ) - 8;
686
-			$dates['day'] += get_option( 'start_of_week' );
685
+			$dates['day'] = date('d', $current_time - (date('w') - 1) * 60 * 60 * 24) - 8;
686
+			$dates['day'] += get_option('start_of_week');
687 687
 			$dates['day_end'] = $dates['day'] + 6;
688
-			$dates['year']    = date( 'Y' );
689
-
690
-			if ( date( 'j', $current_time ) <= 7 ) {
691
-				$dates['m_start'] = date( 'n', $current_time ) - 1;
692
-				$dates['m_end']   = date( 'n', $current_time ) - 1;
693
-				if ( $dates['m_start'] <= 1 ) {
694
-					$dates['year']     = date( 'Y', $current_time ) - 1;
695
-					$dates['year_end'] = date( 'Y', $current_time ) - 1;
688
+			$dates['year']    = date('Y');
689
+
690
+			if (date('j', $current_time) <= 7) {
691
+				$dates['m_start'] = date('n', $current_time) - 1;
692
+				$dates['m_end']   = date('n', $current_time) - 1;
693
+				if ($dates['m_start'] <= 1) {
694
+					$dates['year']     = date('Y', $current_time) - 1;
695
+					$dates['year_end'] = date('Y', $current_time) - 1;
696 696
 				}
697 697
 			} else {
698
-				$dates['m_start'] = date( 'n', $current_time );
699
-				$dates['m_end']   = date( 'n', $current_time );
698
+				$dates['m_start'] = date('n', $current_time);
699
+				$dates['m_end']   = date('n', $current_time);
700 700
 			}
701 701
 			break;
702 702
 
703 703
 		case 'this_quarter' :
704
-			$month_now     = date( 'n', $current_time );
705
-			$dates['year'] = date( 'Y', $current_time );
704
+			$month_now     = date('n', $current_time);
705
+			$dates['year'] = date('Y', $current_time);
706 706
 
707
-			if ( $month_now <= 3 ) {
707
+			if ($month_now <= 3) {
708 708
 
709 709
 				$dates['m_start'] = 1;
710 710
 				$dates['m_end']   = 4;
711 711
 
712
-			} else if ( $month_now <= 6 ) {
712
+			} else if ($month_now <= 6) {
713 713
 
714 714
 				$dates['m_start'] = 4;
715 715
 				$dates['m_end']   = 7;
716 716
 
717
-			} else if ( $month_now <= 9 ) {
717
+			} else if ($month_now <= 9) {
718 718
 
719 719
 				$dates['m_start'] = 7;
720 720
 				$dates['m_end']   = 10;
@@ -723,28 +723,28 @@  discard block
 block discarded – undo
723 723
 
724 724
 				$dates['m_start']  = 10;
725 725
 				$dates['m_end']    = 1;
726
-				$dates['year_end'] = date( 'Y', $current_time ) + 1;
726
+				$dates['year_end'] = date('Y', $current_time) + 1;
727 727
 
728 728
 			}
729 729
 			break;
730 730
 
731 731
 		case 'last_quarter' :
732
-			$month_now         = date( 'n', $current_time );
733
-			$dates['year']     = date( 'Y', $current_time );
734
-			$dates['year_end'] = date( 'Y', $current_time );
732
+			$month_now         = date('n', $current_time);
733
+			$dates['year']     = date('Y', $current_time);
734
+			$dates['year_end'] = date('Y', $current_time);
735 735
 
736
-			if ( $month_now <= 3 ) {
736
+			if ($month_now <= 3) {
737 737
 
738 738
 				$dates['m_start'] = 10;
739 739
 				$dates['m_end']   = 1;
740
-				$dates['year']    = date( 'Y', $current_time ) - 1; // Previous year.
740
+				$dates['year']    = date('Y', $current_time) - 1; // Previous year.
741 741
 
742
-			} else if ( $month_now <= 6 ) {
742
+			} else if ($month_now <= 6) {
743 743
 
744 744
 				$dates['m_start'] = 1;
745 745
 				$dates['m_end']   = 4;
746 746
 
747
-			} else if ( $month_now <= 9 ) {
747
+			} else if ($month_now <= 9) {
748 748
 
749 749
 				$dates['m_start'] = 4;
750 750
 				$dates['m_end']   = 7;
@@ -760,20 +760,20 @@  discard block
 block discarded – undo
760 760
 		case 'this_year' :
761 761
 			$dates['m_start']  = 1;
762 762
 			$dates['m_end']    = 12;
763
-			$dates['year']     = date( 'Y', $current_time );
764
-			$dates['year_end'] = date( 'Y', $current_time );
763
+			$dates['year']     = date('Y', $current_time);
764
+			$dates['year_end'] = date('Y', $current_time);
765 765
 			break;
766 766
 
767 767
 		case 'last_year' :
768 768
 			$dates['m_start']  = 1;
769 769
 			$dates['m_end']    = 12;
770
-			$dates['year']     = date( 'Y', $current_time ) - 1;
771
-			$dates['year_end'] = date( 'Y', $current_time ) - 1;
770
+			$dates['year']     = date('Y', $current_time) - 1;
771
+			$dates['year_end'] = date('Y', $current_time) - 1;
772 772
 			break;
773 773
 
774 774
 	endswitch;
775 775
 
776
-	return apply_filters( 'give_report_dates', $dates );
776
+	return apply_filters('give_report_dates', $dates);
777 777
 }
778 778
 
779 779
 /**
@@ -784,18 +784,18 @@  discard block
 block discarded – undo
784 784
  *
785 785
  * @param $data
786 786
  */
787
-function give_parse_report_dates( $data ) {
787
+function give_parse_report_dates($data) {
788 788
 	$dates = give_get_report_dates();
789 789
 
790 790
 	$view = give_get_reporting_view();
791
-	$tab  = isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : 'earnings';
792
-	$id   = isset( $_GET['form-id'] ) ? $_GET['form-id'] : null;
791
+	$tab  = isset($_GET['tab']) ? sanitize_text_field($_GET['tab']) : 'earnings';
792
+	$id   = isset($_GET['form-id']) ? $_GET['form-id'] : null;
793 793
 
794
-	wp_redirect( add_query_arg( $dates, admin_url( 'edit.php?post_type=give_forms&page=give-reports&tab=' . esc_attr( $tab ) . '&view=' . esc_attr( $view ) . '&form-id=' . absint( $id ) ) ) );
794
+	wp_redirect(add_query_arg($dates, admin_url('edit.php?post_type=give_forms&page=give-reports&tab='.esc_attr($tab).'&view='.esc_attr($view).'&form-id='.absint($id))));
795 795
 	give_die();
796 796
 }
797 797
 
798
-add_action( 'give_filter_reports', 'give_parse_report_dates' );
798
+add_action('give_filter_reports', 'give_parse_report_dates');
799 799
 
800 800
 
801 801
 /**
@@ -807,23 +807,23 @@  discard block
 block discarded – undo
807 807
  */
808 808
 function give_reports_refresh_button() {
809 809
 
810
-	$url = wp_nonce_url( add_query_arg( array(
810
+	$url = wp_nonce_url(add_query_arg(array(
811 811
 		'give_action'  => 'refresh_reports_transients',
812 812
 		'give-message' => 'refreshed-reports'
813
-	) ), 'give-refresh-reports' );
813
+	)), 'give-refresh-reports');
814 814
 
815
-	echo Give()->tooltips->render_link( array(
816
-		'label'       => esc_attr__( 'Clicking this will clear the reports cache.', 'give' ),
817
-		'tag_content' => '<span class="give-admin-button-icon give-admin-button-icon-update"></span>' . esc_html__( 'Refresh Report Data', 'give' ),
815
+	echo Give()->tooltips->render_link(array(
816
+		'label'       => esc_attr__('Clicking this will clear the reports cache.', 'give'),
817
+		'tag_content' => '<span class="give-admin-button-icon give-admin-button-icon-update"></span>'.esc_html__('Refresh Report Data', 'give'),
818 818
 		'link'        => $url,
819 819
 		'position'    => 'left',
820 820
 		'attributes'  => array(
821 821
 			'class' => 'button alignright give-admin-button'
822 822
 		)
823
-	) );
823
+	));
824 824
 }
825 825
 
826
-add_action( 'give_reports_graph_additional_stats', 'give_reports_refresh_button' );
826
+add_action('give_reports_graph_additional_stats', 'give_reports_refresh_button');
827 827
 
828 828
 /**
829 829
  * Trigger the refresh of reports transients
@@ -834,20 +834,20 @@  discard block
 block discarded – undo
834 834
  *
835 835
  * @return void
836 836
  */
837
-function give_run_refresh_reports_transients( $data ) {
837
+function give_run_refresh_reports_transients($data) {
838 838
 
839
-	if ( ! wp_verify_nonce( $data['_wpnonce'], 'give-refresh-reports' ) ) {
839
+	if ( ! wp_verify_nonce($data['_wpnonce'], 'give-refresh-reports')) {
840 840
 		return;
841 841
 	}
842 842
 
843 843
 	// Monthly stats.
844
-	Give_Cache::delete( Give_Cache::get_key( 'give_estimated_monthly_stats' ) );
844
+	Give_Cache::delete(Give_Cache::get_key('give_estimated_monthly_stats'));
845 845
 
846 846
 	// Total earning.
847
-	delete_option( 'give_earnings_total' );
847
+	delete_option('give_earnings_total');
848 848
 
849 849
 	// @todo: Refresh only range related stat cache
850 850
 	give_delete_donation_stats();
851 851
 }
852 852
 
853
-add_action( 'give_refresh_reports_transients', 'give_run_refresh_reports_transients' );
854 853
\ No newline at end of file
854
+add_action('give_refresh_reports_transients', 'give_run_refresh_reports_transients');
855 855
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/class-admin-settings.php 2 patches
Spacing   +239 added lines, -239 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@  discard block
 block discarded – undo
9 9
  * @since       1.8
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit;
14 14
 }
15 15
 
16
-if ( ! class_exists( 'Give_Admin_Settings' ) ) :
16
+if ( ! class_exists('Give_Admin_Settings')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Admin_Settings Class.
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 			 *
73 73
 			 * @param array $settings Array of settings class object.
74 74
 			 */
75
-			self::$settings = apply_filters( self::$setting_filter_prefix . '_get_settings_pages', array() );
75
+			self::$settings = apply_filters(self::$setting_filter_prefix.'_get_settings_pages', array());
76 76
 
77 77
 			return self::$settings;
78 78
 		}
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 		 * @return bool
87 87
 		 */
88 88
 		public static function verify_nonce() {
89
-			if ( empty( $_REQUEST['_give-save-settings'] ) || ! wp_verify_nonce( $_REQUEST['_give-save-settings'], 'give-save-settings' ) ) {
89
+			if (empty($_REQUEST['_give-save-settings']) || ! wp_verify_nonce($_REQUEST['_give-save-settings'], 'give-save-settings')) {
90 90
 				return false;
91 91
 			}
92 92
 
@@ -102,17 +102,17 @@  discard block
 block discarded – undo
102 102
 		public static function save() {
103 103
 			$current_tab = give_get_current_setting_tab();
104 104
 
105
-			if ( ! self::verify_nonce() ) {
106
-				echo '<div class="notice error"><p>' . __( 'Action failed. Please refresh the page and retry.', 'give' ) . '</p></div>';
105
+			if ( ! self::verify_nonce()) {
106
+				echo '<div class="notice error"><p>'.__('Action failed. Please refresh the page and retry.', 'give').'</p></div>';
107 107
 				die();
108 108
 			}
109 109
 
110 110
 			// Show error message if Akismet not configured and Admin try to save 'enabled' option.
111
-			if ( isset( $_POST['akismet_spam_protection'] )
112
-			     && give_is_setting_enabled( $_POST['akismet_spam_protection'] )
111
+			if (isset($_POST['akismet_spam_protection'])
112
+			     && give_is_setting_enabled($_POST['akismet_spam_protection'])
113 113
 			     && ! give_check_akismet_key()
114 114
 			) {
115
-				self::add_error( 'give-akismet-protection', __( 'Please properly configure Akismet to enable SPAM protection.', 'give' ) );
115
+				self::add_error('give-akismet-protection', __('Please properly configure Akismet to enable SPAM protection.', 'give'));
116 116
 
117 117
 				return;
118 118
 			}
@@ -126,9 +126,9 @@  discard block
 block discarded – undo
126 126
 			 *
127 127
 			 * @since 1.8
128 128
 			 */
129
-			do_action( self::$setting_filter_prefix . '_save_' . $current_tab );
129
+			do_action(self::$setting_filter_prefix.'_save_'.$current_tab);
130 130
 
131
-			self::add_message( 'give-setting-updated', __( 'Your settings have been saved.', 'give' ) );
131
+			self::add_message('give-setting-updated', __('Your settings have been saved.', 'give'));
132 132
 
133 133
 			/**
134 134
 			 * Trigger Action.
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 			 *
140 140
 			 * @since 1.8
141 141
 			 */
142
-			do_action( self::$setting_filter_prefix . '_saved' );
142
+			do_action(self::$setting_filter_prefix.'_saved');
143 143
 		}
144 144
 
145 145
 		/**
@@ -152,8 +152,8 @@  discard block
 block discarded – undo
152 152
 		 *
153 153
 		 * @return void
154 154
 		 */
155
-		public static function add_message( $code, $message ) {
156
-			self::$messages[ $code ] = $message;
155
+		public static function add_message($code, $message) {
156
+			self::$messages[$code] = $message;
157 157
 		}
158 158
 
159 159
 		/**
@@ -166,8 +166,8 @@  discard block
 block discarded – undo
166 166
 		 *
167 167
 		 * @return void
168 168
 		 */
169
-		public static function add_error( $code, $message ) {
170
-			self::$errors[ $code ] = $message;
169
+		public static function add_error($code, $message) {
170
+			self::$errors[$code] = $message;
171 171
 		}
172 172
 
173 173
 		/**
@@ -180,18 +180,18 @@  discard block
 block discarded – undo
180 180
 			$notice_html = '';
181 181
 			$classes     = 'give-notice settings-error notice is-dismissible';
182 182
 
183
-			self::$errors   = apply_filters( self::$setting_filter_prefix . '_error_notices', self::$errors );
184
-			self::$messages = apply_filters( self::$setting_filter_prefix . '_update_notices', self::$messages );
183
+			self::$errors   = apply_filters(self::$setting_filter_prefix.'_error_notices', self::$errors);
184
+			self::$messages = apply_filters(self::$setting_filter_prefix.'_update_notices', self::$messages);
185 185
 
186
-			if ( 0 < count( self::$errors ) ) {
187
-				foreach ( self::$errors as $code => $message ) {
188
-					$notice_html .= '<div id="setting-error-' . $code . '" class="' . $classes . ' error"><p><strong>' . $message . '</strong></p></div>';
186
+			if (0 < count(self::$errors)) {
187
+				foreach (self::$errors as $code => $message) {
188
+					$notice_html .= '<div id="setting-error-'.$code.'" class="'.$classes.' error"><p><strong>'.$message.'</strong></p></div>';
189 189
 				}
190 190
 			}
191 191
 
192
-			if ( 0 < count( self::$messages ) ) {
193
-				foreach ( self::$messages as $code => $message ) {
194
-					$notice_html .= '<div id="setting-error-' . $code . '" class="' . $classes . ' updated"><p><strong>' . $message . '</strong></p></div>';
192
+			if (0 < count(self::$messages)) {
193
+				foreach (self::$messages as $code => $message) {
194
+					$notice_html .= '<div id="setting-error-'.$code.'" class="'.$classes.' updated"><p><strong>'.$message.'</strong></p></div>';
195 195
 				}
196 196
 			}
197 197
 
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 			self::$setting_filter_prefix = give_get_current_setting_page();
212 212
 
213 213
 			// Bailout: Exit if setting page is not defined.
214
-			if ( empty( self::$setting_filter_prefix ) ) {
214
+			if (empty(self::$setting_filter_prefix)) {
215 215
 				return false;
216 216
 			}
217 217
 
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 			 *
225 225
 			 * @since 1.8
226 226
 			 */
227
-			do_action( self::$setting_filter_prefix . '_start' );
227
+			do_action(self::$setting_filter_prefix.'_start');
228 228
 
229 229
 			$current_tab = give_get_current_setting_tab();
230 230
 
@@ -234,9 +234,9 @@  discard block
 block discarded – undo
234 234
 			/* @var object $current_setting_obj */
235 235
 			$current_setting_obj = new StdClass;
236 236
 
237
-			foreach ( $all_setting as $setting ) {
237
+			foreach ($all_setting as $setting) {
238 238
 				if (
239
-					method_exists( $setting, 'get_id' ) &&
239
+					method_exists($setting, 'get_id') &&
240 240
 					$current_tab === $setting->get_id()
241 241
 				) {
242 242
 					$current_setting_obj = $setting;
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 			}
246 246
 
247 247
 			// Save settings if data has been posted.
248
-			if ( ! empty( $_POST ) ) {
248
+			if ( ! empty($_POST)) {
249 249
 				self::save();
250 250
 			}
251 251
 
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 			 *
259 259
 			 * @since 1.8
260 260
 			 */
261
-			$tabs = apply_filters( self::$setting_filter_prefix . '_tabs_array', array() );
261
+			$tabs = apply_filters(self::$setting_filter_prefix.'_tabs_array', array());
262 262
 
263 263
 			include 'views/html-admin-settings.php';
264 264
 
@@ -276,25 +276,25 @@  discard block
 block discarded – undo
276 276
 		 *
277 277
 		 * @return string|bool
278 278
 		 */
279
-		public static function get_option( $option_name = '', $field_id = '', $default = false ) {
279
+		public static function get_option($option_name = '', $field_id = '', $default = false) {
280 280
 			// Bailout.
281
-			if ( empty( $option_name ) && empty( $field_id ) ) {
281
+			if (empty($option_name) && empty($field_id)) {
282 282
 				return false;
283 283
 			}
284 284
 
285
-			if ( ! empty( $field_id ) && ! empty( $option_name ) ) {
285
+			if ( ! empty($field_id) && ! empty($option_name)) {
286 286
 				// Get field value if any.
287
-				$option_value = get_option( $option_name );
287
+				$option_value = get_option($option_name);
288 288
 
289
-				$option_value = ( is_array( $option_value ) && array_key_exists( $field_id, $option_value ) )
290
-					? $option_value[ $field_id ]
289
+				$option_value = (is_array($option_value) && array_key_exists($field_id, $option_value))
290
+					? $option_value[$field_id]
291 291
 					: $default;
292 292
 			} else {
293 293
 				// If option name is empty but not field name then this means, setting is direct store to option table under there field name.
294 294
 				$option_name = ! $option_name ? $field_id : $option_name;
295 295
 
296 296
 				// Get option value if any.
297
-				$option_value = get_option( $option_name, $default );
297
+				$option_value = get_option($option_name, $default);
298 298
 			}
299 299
 
300 300
 			return $option_value;
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 		 *
314 314
 		 * @return void
315 315
 		 */
316
-		public static function output_fields( $options, $option_name = '' ) {
316
+		public static function output_fields($options, $option_name = '') {
317 317
 			$current_tab = give_get_current_setting_tab();
318 318
 
319 319
 			// Field Default values.
@@ -325,61 +325,61 @@  discard block
 block discarded – undo
325 325
 				'desc'             => '',
326 326
 				'table_html'       => true,
327 327
 				'repeat'           => false,
328
-				'repeat_btn_title' => __( 'Add Field', 'give' ),
328
+				'repeat_btn_title' => __('Add Field', 'give'),
329 329
 			);
330 330
 
331
-			foreach ( $options as $value ) {
332
-				if ( ! isset( $value['type'] ) ) {
331
+			foreach ($options as $value) {
332
+				if ( ! isset($value['type'])) {
333 333
 					continue;
334 334
 				}
335 335
 
336 336
 				// Set title.
337
-				$defaults['title'] = isset( $value['name'] ) ? $value['name'] : '';
337
+				$defaults['title'] = isset($value['name']) ? $value['name'] : '';
338 338
 
339 339
 				// Set default setting.
340
-				$value = wp_parse_args( $value, $defaults );
340
+				$value = wp_parse_args($value, $defaults);
341 341
 
342 342
 				// Colorpicker field.
343
-				$value['class'] = ( 'colorpicker' === $value['type'] ? trim( $value['class'] ) . ' give-colorpicker' : $value['class'] );
344
-				$value['type']  = ( 'colorpicker' === $value['type'] ? 'text' : $value['type'] );
343
+				$value['class'] = ('colorpicker' === $value['type'] ? trim($value['class']).' give-colorpicker' : $value['class']);
344
+				$value['type']  = ('colorpicker' === $value['type'] ? 'text' : $value['type']);
345 345
 
346 346
 
347 347
 				// Custom attribute handling.
348 348
 				$custom_attributes = array();
349 349
 
350
-				if ( ! empty( $value['attributes'] ) && is_array( $value['attributes'] ) ) {
351
-					foreach ( $value['attributes'] as $attribute => $attribute_value ) {
352
-						$custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"';
350
+				if ( ! empty($value['attributes']) && is_array($value['attributes'])) {
351
+					foreach ($value['attributes'] as $attribute => $attribute_value) {
352
+						$custom_attributes[] = esc_attr($attribute).'="'.esc_attr($attribute_value).'"';
353 353
 					}
354 354
 				}
355 355
 
356 356
 				// Description handling.
357
-				$description          = self::get_field_description( $value );
357
+				$description = self::get_field_description($value);
358 358
 
359 359
 				// Switch based on type.
360
-				switch ( $value['type'] ) {
360
+				switch ($value['type']) {
361 361
 
362 362
 					// Section Titles
363 363
 					case 'title':
364
-						if ( ! empty( $value['title'] ) || ! empty( $value['desc'] ) ) {
364
+						if ( ! empty($value['title']) || ! empty($value['desc'])) {
365 365
 							?>
366 366
 							<div class="give-setting-tab-header give-setting-tab-header-<?php echo $current_tab; ?>">
367
-								<?php if ( ! empty( $value['title'] ) ) : ?>
368
-									<h2><?php echo self::get_field_title( $value ); ?></h2><hr>
367
+								<?php if ( ! empty($value['title'])) : ?>
368
+									<h2><?php echo self::get_field_title($value); ?></h2><hr>
369 369
 								<?php endif; ?>
370 370
 
371
-								<?php if ( ! empty( $value['desc'] ) ) : ?>
372
-									<?php echo wpautop( wptexturize( wp_kses_post( $value['desc'] ) ) ); ?>
371
+								<?php if ( ! empty($value['desc'])) : ?>
372
+									<?php echo wpautop(wptexturize(wp_kses_post($value['desc']))); ?>
373 373
 								<?php endif; ?>
374 374
 							</div>
375 375
 							<?php
376 376
 						}
377 377
 
378
-						if ( $value['table_html'] ) {
379
-							echo '<table class="form-table give-setting-tab-body give-setting-tab-body-' . $current_tab . '">' . "\n\n";
378
+						if ($value['table_html']) {
379
+							echo '<table class="form-table give-setting-tab-body give-setting-tab-body-'.$current_tab.'">'."\n\n";
380 380
 						}
381 381
 
382
-						if ( ! empty( $value['id'] ) ) {
382
+						if ( ! empty($value['id'])) {
383 383
 
384 384
 							/**
385 385
 							 * Trigger Action.
@@ -388,14 +388,14 @@  discard block
 block discarded – undo
388 388
 							 *
389 389
 							 * @since 1.8
390 390
 							 */
391
-							do_action( 'give_settings_' . sanitize_title( $value['id'] ) );
391
+							do_action('give_settings_'.sanitize_title($value['id']));
392 392
 						}
393 393
 
394 394
 						break;
395 395
 
396 396
 					// Section Ends.
397 397
 					case 'sectionend':
398
-						if ( ! empty( $value['id'] ) ) {
398
+						if ( ! empty($value['id'])) {
399 399
 
400 400
 							/**
401 401
 							 * Trigger Action.
@@ -404,14 +404,14 @@  discard block
 block discarded – undo
404 404
 							 *
405 405
 							 * @since 1.8
406 406
 							 */
407
-							do_action( 'give_settings_' . sanitize_title( $value['id'] ) . '_end' );
407
+							do_action('give_settings_'.sanitize_title($value['id']).'_end');
408 408
 						}
409 409
 
410
-						if ( $value['table_html'] ) {
410
+						if ($value['table_html']) {
411 411
 							echo '</table>';
412 412
 						}
413 413
 
414
-						if ( ! empty( $value['id'] ) ) {
414
+						if ( ! empty($value['id'])) {
415 415
 
416 416
 							/**
417 417
 							 * Trigger Action.
@@ -420,7 +420,7 @@  discard block
 block discarded – undo
420 420
 							 *
421 421
 							 * @since 1.8
422 422
 							 */
423
-							do_action( 'give_settings_' . sanitize_title( $value['id'] ) . '_after' );
423
+							do_action('give_settings_'.sanitize_title($value['id']).'_after');
424 424
 						}
425 425
 
426 426
 						break;
@@ -428,48 +428,48 @@  discard block
 block discarded – undo
428 428
 					// Standard text inputs and subtypes like 'number'.
429 429
 					case 'colorpicker':
430 430
 					case 'hidden' :
431
-						$value['wrapper_class'] = empty( $value['wrapper_class'] ) ? 'give-hidden' : trim( $value['wrapper_class'] ) . ' give-hidden';
431
+						$value['wrapper_class'] = empty($value['wrapper_class']) ? 'give-hidden' : trim($value['wrapper_class']).' give-hidden';
432 432
 					case 'text':
433 433
 					case 'email':
434 434
 					case 'number':
435 435
 					case 'password' :
436 436
 						$type = $value['type'];
437
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
437
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
438 438
 
439 439
 						// Set default value for repeater field if not any value set yet.
440
-						if( $value['repeat'] && is_string( $option_value ) ) {
441
-							$option_value = array( $value['default'] );
440
+						if ($value['repeat'] && is_string($option_value)) {
441
+							$option_value = array($value['default']);
442 442
 						}
443 443
 						?>
444
-						<tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
444
+						<tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
445 445
 							<th scope="row" class="titledesc">
446
-								<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
446
+								<label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
447 447
 							</th>
448
-							<td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>">
449
-								<?php if ( $value['repeat'] ) : ?>
450
-									<?php foreach ( $option_value as $index => $field_value ) : ?>
448
+							<td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>">
449
+								<?php if ($value['repeat']) : ?>
450
+									<?php foreach ($option_value as $index => $field_value) : ?>
451 451
 										<p>
452 452
 											<input
453
-													name="<?php echo esc_attr( $value['id'] ); ?>[]"
454
-													type="<?php echo esc_attr( $type ); ?>"
455
-													style="<?php echo esc_attr( $value['css'] ); ?>"
456
-													value="<?php echo esc_attr( $field_value ); ?>"
457
-													class="give-input-field<?php echo( empty( $value['class'] ) ? '' : ' ' . esc_attr( $value['class'] ) ); ?> <?php echo esc_attr( $value['id'] ); ?>"
458
-												<?php echo implode( ' ', $custom_attributes ); ?>
453
+													name="<?php echo esc_attr($value['id']); ?>[]"
454
+													type="<?php echo esc_attr($type); ?>"
455
+													style="<?php echo esc_attr($value['css']); ?>"
456
+													value="<?php echo esc_attr($field_value); ?>"
457
+													class="give-input-field<?php echo(empty($value['class']) ? '' : ' '.esc_attr($value['class'])); ?> <?php echo esc_attr($value['id']); ?>"
458
+												<?php echo implode(' ', $custom_attributes); ?>
459 459
 											/>
460
-											<span class="give-remove-setting-field" title="<?php esc_html_e( 'Remove setting field', 'give' ); ?>">-</span>
460
+											<span class="give-remove-setting-field" title="<?php esc_html_e('Remove setting field', 'give'); ?>">-</span>
461 461
 										</p>
462 462
 									<?php endforeach; ?>
463 463
 									<a href="#" data-id="<?php echo $value['id']; ?>" class="give-repeat-setting-field button-secondary"><?php echo $value['repeat_btn_title']; ?></a>
464 464
 								<?php else : ?>
465 465
 									<input
466
-											name="<?php echo esc_attr( $value['id'] ); ?>"
467
-											id="<?php echo esc_attr( $value['id'] ); ?>"
468
-											type="<?php echo esc_attr( $type ); ?>"
469
-											style="<?php echo esc_attr( $value['css'] ); ?>"
470
-											value="<?php echo esc_attr( $option_value ); ?>"
471
-											class="give-input-field<?php echo( empty( $value['class'] ) ? '' : ' ' . esc_attr( $value['class'] ) ); ?>"
472
-										<?php echo implode( ' ', $custom_attributes ); ?>
466
+											name="<?php echo esc_attr($value['id']); ?>"
467
+											id="<?php echo esc_attr($value['id']); ?>"
468
+											type="<?php echo esc_attr($type); ?>"
469
+											style="<?php echo esc_attr($value['css']); ?>"
470
+											value="<?php echo esc_attr($option_value); ?>"
471
+											class="give-input-field<?php echo(empty($value['class']) ? '' : ' '.esc_attr($value['class'])); ?>"
472
+										<?php echo implode(' ', $custom_attributes); ?>
473 473
 									/>
474 474
 								<?php endif; ?>
475 475
 								<?php echo $description; ?>
@@ -480,23 +480,23 @@  discard block
 block discarded – undo
480 480
 					// Textarea.
481 481
 					case 'textarea':
482 482
 
483
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
483
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
484 484
 
485 485
 						?>
486
-					<tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
486
+					<tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
487 487
 						<th scope="row" class="titledesc">
488
-							<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
488
+							<label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
489 489
 						</th>
490
-						<td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>">
490
+						<td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>">
491 491
 								<textarea
492
-										name="<?php echo esc_attr( $value['id'] ); ?>"
493
-										id="<?php echo esc_attr( $value['id'] ); ?>"
494
-										style="<?php echo esc_attr( $value['css'] ); ?>"
495
-										class="<?php echo esc_attr( $value['class'] ); ?>"
492
+										name="<?php echo esc_attr($value['id']); ?>"
493
+										id="<?php echo esc_attr($value['id']); ?>"
494
+										style="<?php echo esc_attr($value['css']); ?>"
495
+										class="<?php echo esc_attr($value['class']); ?>"
496 496
 										rows="10"
497 497
 										cols="60"
498
-									<?php echo implode( ' ', $custom_attributes ); ?>
499
-								><?php echo esc_textarea( $option_value ); ?></textarea>
498
+									<?php echo implode(' ', $custom_attributes); ?>
499
+								><?php echo esc_textarea($option_value); ?></textarea>
500 500
 							<?php echo $description; ?>
501 501
 						</td>
502 502
 						</tr><?php
@@ -506,35 +506,35 @@  discard block
 block discarded – undo
506 506
 					case 'select' :
507 507
 					case 'multiselect' :
508 508
 
509
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
509
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
510 510
 
511 511
 						?>
512
-					<tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
512
+					<tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
513 513
 						<th scope="row" class="titledesc">
514
-							<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
514
+							<label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
515 515
 						</th>
516
-						<td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>">
516
+						<td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>">
517 517
 							<select
518
-									name="<?php echo esc_attr( $value['id'] ); ?><?php if ( $value['type'] == 'multiselect' ) {
518
+									name="<?php echo esc_attr($value['id']); ?><?php if ($value['type'] == 'multiselect') {
519 519
 										echo '[]';
520 520
 									} ?>"
521
-									id="<?php echo esc_attr( $value['id'] ); ?>"
522
-									style="<?php echo esc_attr( $value['css'] ); ?>"
523
-									class="<?php echo esc_attr( $value['class'] ); ?>"
524
-								<?php echo implode( ' ', $custom_attributes ); ?>
525
-								<?php echo ( 'multiselect' == $value['type'] ) ? 'multiple="multiple"' : ''; ?>
521
+									id="<?php echo esc_attr($value['id']); ?>"
522
+									style="<?php echo esc_attr($value['css']); ?>"
523
+									class="<?php echo esc_attr($value['class']); ?>"
524
+								<?php echo implode(' ', $custom_attributes); ?>
525
+								<?php echo ('multiselect' == $value['type']) ? 'multiple="multiple"' : ''; ?>
526 526
 							>
527 527
 
528 528
 								<?php
529
-								if ( ! empty( $value['options'] ) ) {
530
-									foreach ( $value['options'] as $key => $val ) {
529
+								if ( ! empty($value['options'])) {
530
+									foreach ($value['options'] as $key => $val) {
531 531
 										?>
532
-										<option value="<?php echo esc_attr( $key ); ?>" <?php
532
+										<option value="<?php echo esc_attr($key); ?>" <?php
533 533
 
534
-										if ( is_array( $option_value ) ) {
535
-											selected( in_array( $key, $option_value ), true );
534
+										if (is_array($option_value)) {
535
+											selected(in_array($key, $option_value), true);
536 536
 										} else {
537
-											selected( $option_value, $key );
537
+											selected($option_value, $key);
538 538
 										}
539 539
 
540 540
 										?>><?php echo $val ?></option>
@@ -550,28 +550,28 @@  discard block
 block discarded – undo
550 550
 
551 551
 					// Radio inputs.
552 552
 					case 'radio_inline' :
553
-						$value['class'] = empty( $value['class'] ) ? 'give-radio-inline' : $value['class'] . ' give-radio-inline';
553
+						$value['class'] = empty($value['class']) ? 'give-radio-inline' : $value['class'].' give-radio-inline';
554 554
 					case 'radio' :
555
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
555
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
556 556
 						?>
557
-					<tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
557
+					<tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
558 558
 						<th scope="row" class="titledesc">
559
-							<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
559
+							<label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
560 560
 						</th>
561
-						<td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?> <?php echo( ! empty( $value['class'] ) ? $value['class'] : '' ); ?>">
561
+						<td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?> <?php echo( ! empty($value['class']) ? $value['class'] : ''); ?>">
562 562
 							<fieldset>
563 563
 								<ul>
564 564
 									<?php
565
-									foreach ( $value['options'] as $key => $val ) {
565
+									foreach ($value['options'] as $key => $val) {
566 566
 										?>
567 567
 										<li>
568 568
 											<label><input
569
-														name="<?php echo esc_attr( $value['id'] ); ?>"
569
+														name="<?php echo esc_attr($value['id']); ?>"
570 570
 														value="<?php echo $key; ?>"
571 571
 														type="radio"
572
-														style="<?php echo esc_attr( $value['css'] ); ?>"
573
-													<?php echo implode( ' ', $custom_attributes ); ?>
574
-													<?php checked( $key, $option_value ); ?>
572
+														style="<?php echo esc_attr($value['css']); ?>"
573
+													<?php echo implode(' ', $custom_attributes); ?>
574
+													<?php checked($key, $option_value); ?>
575 575
 												/> <?php echo $val ?></label>
576 576
 										</li>
577 577
 										<?php
@@ -585,21 +585,21 @@  discard block
 block discarded – undo
585 585
 
586 586
 					// Checkbox input.
587 587
 					case 'checkbox' :
588
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
588
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
589 589
 						?>
590
-						<tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
590
+						<tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
591 591
 							<th scope="row" class="titledesc">
592
-								<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
592
+								<label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
593 593
 							</th>
594 594
 							<td class="give-forminp">
595 595
 								<input
596
-										name="<?php echo esc_attr( $value['id'] ); ?>"
597
-										id="<?php echo esc_attr( $value['id'] ); ?>"
596
+										name="<?php echo esc_attr($value['id']); ?>"
597
+										id="<?php echo esc_attr($value['id']); ?>"
598 598
 										type="checkbox"
599
-										class="<?php echo esc_attr( isset( $value['class'] ) ? $value['class'] : '' ); ?>"
599
+										class="<?php echo esc_attr(isset($value['class']) ? $value['class'] : ''); ?>"
600 600
 										value="1"
601
-									<?php checked( $option_value, 'on' ); ?>
602
-									<?php echo implode( ' ', $custom_attributes ); ?>
601
+									<?php checked($option_value, 'on'); ?>
602
+									<?php echo implode(' ', $custom_attributes); ?>
603 603
 								/>
604 604
 								<?php echo $description; ?>
605 605
 							</td>
@@ -609,28 +609,28 @@  discard block
 block discarded – undo
609 609
 
610 610
 					// Multi Checkbox input.
611 611
 					case 'multicheck' :
612
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
613
-						$option_value = is_array( $option_value ) ? $option_value : array();
612
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
613
+						$option_value = is_array($option_value) ? $option_value : array();
614 614
 						?>
615
-						<tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
615
+						<tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
616 616
 							<th scope="row" class="titledesc">
617
-								<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
617
+								<label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
618 618
 							</th>
619
-							<td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?> <?php echo( ! empty( $value['class'] ) ? $value['class'] : '' ); ?>">
619
+							<td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?> <?php echo( ! empty($value['class']) ? $value['class'] : ''); ?>">
620 620
 								<fieldset>
621 621
 									<ul>
622 622
 										<?php
623
-										foreach ( $value['options'] as $key => $val ) {
623
+										foreach ($value['options'] as $key => $val) {
624 624
 											?>
625 625
 											<li>
626 626
 												<label>
627 627
 													<input
628
-															name="<?php echo esc_attr( $value['id'] ); ?>[]"
628
+															name="<?php echo esc_attr($value['id']); ?>[]"
629 629
 															value="<?php echo $key; ?>"
630 630
 															type="checkbox"
631
-															style="<?php echo esc_attr( $value['css'] ); ?>"
632
-														<?php echo implode( ' ', $custom_attributes ); ?>
633
-														<?php if ( in_array( $key, $option_value ) ) {
631
+															style="<?php echo esc_attr($value['css']); ?>"
632
+														<?php echo implode(' ', $custom_attributes); ?>
633
+														<?php if (in_array($key, $option_value)) {
634 634
 															echo 'checked="checked"';
635 635
 														} ?>
636 636
 													/> <?php echo $val ?>
@@ -649,30 +649,30 @@  discard block
 block discarded – undo
649 649
 					// File input field.
650 650
 					case 'file' :
651 651
 					case 'media' :
652
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
653
-						$button_label = esc_html__( sprintf( 'Add or Upload %s', ( 'file' === $value['type'] ? 'File' : 'Image' ) ), 'give' );
654
-						$fvalue       = empty( $value['fvalue'] ) ? 'url' : $value['fvalue'];
655
-
656
-						$allow_media_preview_tags = array( 'jpg', 'jpeg', 'png', 'gif', 'ico' );
657
-						$preview_image_src        = $option_value ? ( 'id' === $fvalue ? wp_get_attachment_url( $option_value ) : $option_value ) : '';
658
-						$preview_image_extension  = $preview_image_src ? pathinfo( $preview_image_src, PATHINFO_EXTENSION ) : '';
659
-						$is_show_preview          = in_array( $preview_image_extension, $allow_media_preview_tags );
652
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
653
+						$button_label = esc_html__(sprintf('Add or Upload %s', ('file' === $value['type'] ? 'File' : 'Image')), 'give');
654
+						$fvalue       = empty($value['fvalue']) ? 'url' : $value['fvalue'];
655
+
656
+						$allow_media_preview_tags = array('jpg', 'jpeg', 'png', 'gif', 'ico');
657
+						$preview_image_src        = $option_value ? ('id' === $fvalue ? wp_get_attachment_url($option_value) : $option_value) : '';
658
+						$preview_image_extension  = $preview_image_src ? pathinfo($preview_image_src, PATHINFO_EXTENSION) : '';
659
+						$is_show_preview          = in_array($preview_image_extension, $allow_media_preview_tags);
660 660
 						?>
661
-						<tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
661
+						<tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
662 662
 							<th scope="row" class="titledesc">
663
-								<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
663
+								<label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
664 664
 							</th>
665 665
 							<td class="give-forminp">
666 666
 								<div class="give-field-wrap">
667 667
 									<label for="<?php echo $value['id'] ?>">
668 668
 										<input
669
-												name="<?php echo esc_attr( $value['id'] ); ?>"
670
-												id="<?php echo esc_attr( $value['id'] ); ?>"
669
+												name="<?php echo esc_attr($value['id']); ?>"
670
+												id="<?php echo esc_attr($value['id']); ?>"
671 671
 												type="text"
672
-												class="give-input-field<?php echo esc_attr( isset( $value['class'] ) ? ' ' . $value['class'] : '' ); ?>"
672
+												class="give-input-field<?php echo esc_attr(isset($value['class']) ? ' '.$value['class'] : ''); ?>"
673 673
 												value="<?php echo $option_value; ?>"
674
-												style="<?php echo esc_attr( $value['css'] ); ?>"
675
-											<?php echo implode( ' ', $custom_attributes ); ?>
674
+												style="<?php echo esc_attr($value['css']); ?>"
675
+											<?php echo implode(' ', $custom_attributes); ?>
676 676
 										/>&nbsp;&nbsp;&nbsp;&nbsp;<input class="give-upload-button button" type="button" data-fvalue="<?php echo $fvalue; ?>" data-field-type="<?php echo $value['type']; ?>" value="<?php echo $button_label; ?>">
677 677
 										<?php echo $description ?>
678 678
 										<div class="give-image-thumb<?php echo ! $option_value || ! $is_show_preview ? ' give-hidden' : ''; ?>">
@@ -689,17 +689,17 @@  discard block
 block discarded – undo
689 689
 					// WordPress Editor.
690 690
 					case 'wysiwyg' :
691 691
 						// Get option value.
692
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
692
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
693 693
 
694 694
 						// Get editor settings.
695
-						$editor_settings = ! empty( $value['options'] ) ? $value['options'] : array();
695
+						$editor_settings = ! empty($value['options']) ? $value['options'] : array();
696 696
 						?>
697
-					<tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
697
+					<tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
698 698
 						<th scope="row" class="titledesc">
699
-							<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
699
+							<label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
700 700
 						</th>
701 701
 						<td class="give-forminp">
702
-							<?php wp_editor( $option_value, $value['id'], $editor_settings ); ?>
702
+							<?php wp_editor($option_value, $value['id'], $editor_settings); ?>
703 703
 							<?php echo $description; ?>
704 704
 						</td>
705 705
 						</tr><?php
@@ -708,9 +708,9 @@  discard block
 block discarded – undo
708 708
 					// Custom: System setting field.
709 709
 					case 'system_info' :
710 710
 						?>
711
-					<tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
711
+					<tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
712 712
 						<th scope="row" class="titledesc">
713
-							<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
713
+							<label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
714 714
 						</th>
715 715
 						<td class="give-forminp">
716 716
 							<?php give_system_info_callback(); ?>
@@ -721,14 +721,14 @@  discard block
 block discarded – undo
721 721
 
722 722
 					// Custom: Default gateways setting field.
723 723
 					case 'default_gateway' :
724
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
724
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
725 725
 						?>
726
-					<tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
726
+					<tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
727 727
 						<th scope="row" class="titledesc">
728
-							<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
728
+							<label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
729 729
 						</th>
730 730
 						<td class="give-forminp">
731
-							<?php give_default_gateway_callback( $value, $option_value ); ?>
731
+							<?php give_default_gateway_callback($value, $option_value); ?>
732 732
 							<?php echo $description; ?>
733 733
 						</td>
734 734
 						</tr><?php
@@ -736,14 +736,14 @@  discard block
 block discarded – undo
736 736
 
737 737
 					// Custom: Enable gateways setting field.
738 738
 					case 'enabled_gateways' :
739
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
739
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
740 740
 						?>
741
-					<tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
741
+					<tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
742 742
 						<th scope="row" class="titledesc">
743
-							<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
743
+							<label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
744 744
 						</th>
745 745
 						<td class="give-forminp">
746
-							<?php give_enabled_gateways_callback( $value, $option_value ); ?>
746
+							<?php give_enabled_gateways_callback($value, $option_value); ?>
747 747
 							<?php echo $description; ?>
748 748
 						</td>
749 749
 						</tr><?php
@@ -752,12 +752,12 @@  discard block
 block discarded – undo
752 752
 					// Custom: Email preview buttons field.
753 753
 					case 'email_preview_buttons' :
754 754
 						?>
755
-						<tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
755
+						<tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
756 756
 						<th scope="row" class="titledesc">
757
-							<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
757
+							<label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
758 758
 						</th>
759 759
 						<td class="give-forminp">
760
-							<?php give_email_preview_buttons_callback( $value ); ?>
760
+							<?php give_email_preview_buttons_callback($value); ?>
761 761
 							<?php echo $description; ?>
762 762
 						</td>
763 763
 						</tr><?php
@@ -771,22 +771,22 @@  discard block
 block discarded – undo
771 771
 
772 772
 					// Custom: Gateway API key.
773 773
 					case 'api_key' :
774
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
775
-						$type         = ! empty( $option_value ) ? 'password' : 'text';
774
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
775
+						$type         = ! empty($option_value) ? 'password' : 'text';
776 776
 						?>
777
-					<tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
777
+					<tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
778 778
 						<th scope="row" class="titledesc">
779
-							<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
779
+							<label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
780 780
 						</th>
781
-						<td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>">
781
+						<td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>">
782 782
 							<input
783
-									name="<?php echo esc_attr( $value['id'] ); ?>"
784
-									id="<?php echo esc_attr( $value['id'] ); ?>"
785
-									type="<?php echo esc_attr( $type ); ?>"
786
-									style="<?php echo esc_attr( $value['css'] ); ?>"
787
-									value="<?php echo esc_attr( trim( $option_value ) ); ?>"
788
-									class="give-input-field<?php echo( empty( $value['class'] ) ? '' : ' ' . esc_attr( $value['class'] ) ); ?>"
789
-								<?php echo implode( ' ', $custom_attributes ); ?>
783
+									name="<?php echo esc_attr($value['id']); ?>"
784
+									id="<?php echo esc_attr($value['id']); ?>"
785
+									type="<?php echo esc_attr($type); ?>"
786
+									style="<?php echo esc_attr($value['css']); ?>"
787
+									value="<?php echo esc_attr(trim($option_value)); ?>"
788
+									class="give-input-field<?php echo(empty($value['class']) ? '' : ' '.esc_attr($value['class'])); ?>"
789
+								<?php echo implode(' ', $custom_attributes); ?>
790 790
 							/> <?php echo $description; ?>
791 791
 						</td>
792 792
 						</tr><?php
@@ -803,7 +803,7 @@  discard block
 block discarded – undo
803 803
 						 *
804 804
 						 * @since 1.0
805 805
 						 */
806
-						do_action( "give_logs_view_{$current_section}" );
806
+						do_action("give_logs_view_{$current_section}");
807 807
 
808 808
 						echo $description;
809 809
 						break;
@@ -811,7 +811,7 @@  discard block
 block discarded – undo
811 811
 					// Custom: Data field.
812 812
 					case 'data' :
813 813
 
814
-						include GIVE_PLUGIN_DIR . 'includes/admin/tools/views/html-admin-page-data.php';
814
+						include GIVE_PLUGIN_DIR.'includes/admin/tools/views/html-admin-page-data.php';
815 815
 
816 816
 						echo $description;
817 817
 						break;
@@ -819,12 +819,12 @@  discard block
 block discarded – undo
819 819
 					// Custom: Give Docs Link field type.
820 820
 					case 'give_docs_link' :
821 821
 						?>
822
-					<tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
822
+					<tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
823 823
 						<td class="give-docs-link" colspan="2">
824 824
 							<?php
825
-							echo '<p class="give-docs-link"><a href="' . esc_url( $value['url'] )
825
+							echo '<p class="give-docs-link"><a href="'.esc_url($value['url'])
826 826
 							     . '" target="_blank">'
827
-							     . sprintf( esc_html__( 'Need Help? See docs on "%s"', 'give' ), $value['title'] )
827
+							     . sprintf(esc_html__('Need Help? See docs on "%s"', 'give'), $value['title'])
828 828
 							     . '<span class="dashicons dashicons-editor-help"></span></a></p>';
829 829
 							?>
830 830
 						</td>
@@ -835,8 +835,8 @@  discard block
 block discarded – undo
835 835
 					// You can add or handle your custom field action.
836 836
 					default:
837 837
 						// Get option value.
838
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
839
-						do_action( 'give_admin_field_' . $value['type'], $value, $option_value );
838
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
839
+						do_action('give_admin_field_'.$value['type'], $value, $option_value);
840 840
 						break;
841 841
 				}
842 842
 			}
@@ -852,15 +852,15 @@  discard block
 block discarded – undo
852 852
 		 *
853 853
 		 * @return string The HTML description of the field.
854 854
 		 */
855
-		public static function get_field_description( $value ) {
855
+		public static function get_field_description($value) {
856 856
 			$description = '';
857 857
 
858 858
 			// Support for both 'description' and 'desc' args.
859
-			$description_key = isset( $value['description'] ) ? 'description' : 'desc';
860
-			$value           = ( isset( $value[ $description_key ] ) && ! empty( $value[ $description_key ] ) ) ? $value[ $description_key ] : '';
859
+			$description_key = isset($value['description']) ? 'description' : 'desc';
860
+			$value           = (isset($value[$description_key]) && ! empty($value[$description_key])) ? $value[$description_key] : '';
861 861
 
862
-			if ( ! empty( $value ) ) {
863
-				$description = '<p class="give-field-description">' . wp_kses_post( $value ) . '</p>';
862
+			if ( ! empty($value)) {
863
+				$description = '<p class="give-field-description">'.wp_kses_post($value).'</p>';
864 864
 			}
865 865
 
866 866
 			return $description;
@@ -877,11 +877,11 @@  discard block
 block discarded – undo
877 877
 		 *
878 878
 		 * @return array The description and tip as a 2 element array
879 879
 		 */
880
-		public static function get_field_title( $value ) {
881
-			$title = esc_html( $value['title'] );
880
+		public static function get_field_title($value) {
881
+			$title = esc_html($value['title']);
882 882
 
883 883
 			// If html tag detected then allow them to print.
884
-			if ( strip_tags( $title ) ) {
884
+			if (strip_tags($title)) {
885 885
 				$title = $value['title'];
886 886
 			}
887 887
 
@@ -900,8 +900,8 @@  discard block
 block discarded – undo
900 900
 		 *
901 901
 		 * @return bool
902 902
 		 */
903
-		public static function save_fields( $options, $option_name = '' ) {
904
-			if ( empty( $_POST ) ) {
903
+		public static function save_fields($options, $option_name = '') {
904
+			if (empty($_POST)) {
905 905
 				return false;
906 906
 			}
907 907
 
@@ -909,37 +909,37 @@  discard block
 block discarded – undo
909 909
 			$update_options = array();
910 910
 
911 911
 			// Loop options and get values to save.
912
-			foreach ( $options as $option ) {
913
-				if ( ! isset( $option['id'] ) || ! isset( $option['type'] ) ) {
912
+			foreach ($options as $option) {
913
+				if ( ! isset($option['id']) || ! isset($option['type'])) {
914 914
 					continue;
915 915
 				}
916 916
 
917 917
 				// Get posted value.
918
-				if ( strstr( $option['id'], '[' ) ) {
919
-					parse_str( $option['id'], $option_name_array );
920
-					$field_option_name = current( array_keys( $option_name_array ) );
921
-					$setting_name      = key( $option_name_array[ $field_option_name ] );
922
-					$raw_value         = isset( $_POST[ $field_option_name ][ $setting_name ] ) ? wp_unslash( $_POST[ $field_option_name ][ $setting_name ] ) : null;
918
+				if (strstr($option['id'], '[')) {
919
+					parse_str($option['id'], $option_name_array);
920
+					$field_option_name = current(array_keys($option_name_array));
921
+					$setting_name      = key($option_name_array[$field_option_name]);
922
+					$raw_value         = isset($_POST[$field_option_name][$setting_name]) ? wp_unslash($_POST[$field_option_name][$setting_name]) : null;
923 923
 				} else {
924 924
 					$field_option_name = $option['id'];
925 925
 					$setting_name      = '';
926
-					$raw_value         = isset( $_POST[ $option['id'] ] ) ? wp_unslash( $_POST[ $option['id'] ] ) : null;
926
+					$raw_value         = isset($_POST[$option['id']]) ? wp_unslash($_POST[$option['id']]) : null;
927 927
 				}
928 928
 
929 929
 				// Format the value based on option type.
930
-				switch ( $option['type'] ) {
930
+				switch ($option['type']) {
931 931
 					case 'checkbox' :
932
-						$value = is_null( $raw_value ) ? '' : 'on';
932
+						$value = is_null($raw_value) ? '' : 'on';
933 933
 						break;
934 934
 					case 'wysiwyg'  :
935 935
 					case 'textarea' :
936
-						$value = wp_kses_post( trim( $raw_value ) );
936
+						$value = wp_kses_post(trim($raw_value));
937 937
 						break;
938 938
 					case 'multiselect' :
939
-						$value = array_filter( array_map( 'give_clean', (array) $raw_value ) );
939
+						$value = array_filter(array_map('give_clean', (array) $raw_value));
940 940
 						break;
941 941
 					default :
942
-						$value = give_clean( $raw_value );
942
+						$value = give_clean($raw_value);
943 943
 						break;
944 944
 				}
945 945
 
@@ -948,37 +948,37 @@  discard block
 block discarded – undo
948 948
 				 *
949 949
 				 * @since 1.8
950 950
 				 */
951
-				$value = apply_filters( 'give_admin_settings_sanitize_option', $value, $option, $raw_value );
951
+				$value = apply_filters('give_admin_settings_sanitize_option', $value, $option, $raw_value);
952 952
 
953 953
 				/**
954 954
 				 * Sanitize the value of an option by option name.
955 955
 				 *
956 956
 				 * @since 1.8
957 957
 				 */
958
-				$value = apply_filters( "give_admin_settings_sanitize_option_{$field_option_name}", $value, $option, $raw_value );
958
+				$value = apply_filters("give_admin_settings_sanitize_option_{$field_option_name}", $value, $option, $raw_value);
959 959
 
960
-				if ( is_null( $value ) ) {
960
+				if (is_null($value)) {
961 961
 					continue;
962 962
 				}
963 963
 
964 964
 				// Check if option is an array and handle that differently to single values.
965
-				if ( $field_option_name && $setting_name ) {
966
-					if ( ! isset( $update_options[ $field_option_name ] ) ) {
967
-						$update_options[ $field_option_name ] = get_option( $field_option_name, array() );
965
+				if ($field_option_name && $setting_name) {
966
+					if ( ! isset($update_options[$field_option_name])) {
967
+						$update_options[$field_option_name] = get_option($field_option_name, array());
968 968
 					}
969
-					if ( ! is_array( $update_options[ $field_option_name ] ) ) {
970
-						$update_options[ $field_option_name ] = array();
969
+					if ( ! is_array($update_options[$field_option_name])) {
970
+						$update_options[$field_option_name] = array();
971 971
 					}
972
-					$update_options[ $field_option_name ][ $setting_name ] = $value;
972
+					$update_options[$field_option_name][$setting_name] = $value;
973 973
 				} else {
974
-					$update_options[ $field_option_name ] = $value;
974
+					$update_options[$field_option_name] = $value;
975 975
 				}
976 976
 			}
977 977
 
978 978
 			// Save all options in our array or there own option name i.e. option id.
979
-			if ( empty( $option_name ) ) {
980
-				foreach ( $update_options as $name => $value ) {
981
-					update_option( $name, $value );
979
+			if (empty($option_name)) {
980
+				foreach ($update_options as $name => $value) {
981
+					update_option($name, $value);
982 982
 
983 983
 					/**
984 984
 					 * Trigger action.
@@ -987,13 +987,13 @@  discard block
 block discarded – undo
987 987
 					 *
988 988
 					 * @since 1.8
989 989
 					 */
990
-					do_action( "give_save_option_{$name}", $value, $name );
990
+					do_action("give_save_option_{$name}", $value, $name);
991 991
 				}
992 992
 			} else {
993
-				$old_options    = ( $old_options = get_option( $option_name ) ) ? $old_options : array();
994
-				$update_options = array_merge( $old_options, $update_options );
993
+				$old_options    = ($old_options = get_option($option_name)) ? $old_options : array();
994
+				$update_options = array_merge($old_options, $update_options);
995 995
 
996
-				update_option( $option_name, $update_options );
996
+				update_option($option_name, $update_options);
997 997
 
998 998
 				/**
999 999
 				 * Trigger action.
@@ -1002,7 +1002,7 @@  discard block
 block discarded – undo
1002 1002
 				 *
1003 1003
 				 * @since 1.8
1004 1004
 				 */
1005
-				do_action( "give_save_settings_{$option_name}", $update_options, $option_name );
1005
+				do_action("give_save_settings_{$option_name}", $update_options, $option_name);
1006 1006
 			}
1007 1007
 
1008 1008
 			return true;
@@ -1031,17 +1031,17 @@  discard block
 block discarded – undo
1031 1031
 		 *
1032 1032
 		 * @return bool
1033 1033
 		 */
1034
-		public static function is_setting_page( $tab = '', $section = '' ) {
1034
+		public static function is_setting_page($tab = '', $section = '') {
1035 1035
 			$is_setting_page = false;
1036 1036
 
1037 1037
 			// Check fo setting tab.
1038
-			if ( ! empty( $tab ) ) {
1039
-				$is_setting_page = ( $tab === give_get_current_setting_tab() );
1038
+			if ( ! empty($tab)) {
1039
+				$is_setting_page = ($tab === give_get_current_setting_tab());
1040 1040
 			}
1041 1041
 
1042 1042
 			// Check fo setting section.
1043
-			if ( ! empty( $section ) ) {
1044
-				$is_setting_page = ( $section === give_get_current_setting_section() );
1043
+			if ( ! empty($section)) {
1044
+				$is_setting_page = ($section === give_get_current_setting_section());
1045 1045
 			}
1046 1046
 
1047 1047
 			return $is_setting_page;
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -461,9 +461,12 @@
 block discarded – undo
461 461
 										</p>
462 462
 									<?php endforeach; ?>
463 463
 									<a href="#" data-id="<?php echo $value['id']; ?>" class="give-repeat-setting-field button-secondary"><?php echo $value['repeat_btn_title']; ?></a>
464
-								<?php else : ?>
464
+								<?php else {
465
+	: ?>
465 466
 									<input
466
-											name="<?php echo esc_attr( $value['id'] ); ?>"
467
+											name="<?php echo esc_attr( $value['id'] );
468
+}
469
+?>"
467 470
 											id="<?php echo esc_attr( $value['id'] ); ?>"
468 471
 											type="<?php echo esc_attr( $type ); ?>"
469 472
 											style="<?php echo esc_attr( $value['css'] ); ?>"
Please login to merge, or discard this patch.
includes/admin/forms/class-metabox-form-data.php 2 patches
Spacing   +300 added lines, -304 removed lines patch added patch discarded remove patch
@@ -46,24 +46,24 @@  discard block
 block discarded – undo
46 46
 	 */
47 47
 	function __construct() {
48 48
 		$this->metabox_id    = 'give-metabox-form-data';
49
-		$this->metabox_label = __( 'Donation Form Options', 'give' );
49
+		$this->metabox_label = __('Donation Form Options', 'give');
50 50
 
51 51
 		// Setup.
52
-		add_action( 'admin_init', array( $this, 'setup' ) );
52
+		add_action('admin_init', array($this, 'setup'));
53 53
 
54 54
 		// Add metabox.
55
-		add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ), 10 );
55
+		add_action('add_meta_boxes', array($this, 'add_meta_box'), 10);
56 56
 
57 57
 		// Save form meta.
58
-		add_action( 'save_post_give_forms', array( $this, 'save' ), 10, 2 );
58
+		add_action('save_post_give_forms', array($this, 'save'), 10, 2);
59 59
 
60 60
 		// cmb2 old setting loaders.
61 61
 		// add_filter( 'give_metabox_form_data_settings', array( $this, 'cmb2_metabox_settings' ) );
62 62
 		// Add offline donations options.
63
-		add_filter( 'give_metabox_form_data_settings', array( $this, 'add_offline_donations_setting_tab' ), 0, 1 );
63
+		add_filter('give_metabox_form_data_settings', array($this, 'add_offline_donations_setting_tab'), 0, 1);
64 64
 
65 65
 		// Maintain active tab query parameter after save.
66
-		add_filter( 'redirect_post_location', array( $this, 'maintain_active_tab' ), 10, 2 );
66
+		add_filter('redirect_post_location', array($this, 'maintain_active_tab'), 10, 2);
67 67
 	}
68 68
 
69 69
 	/**
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 	 */
88 88
 	function get_settings() {
89 89
 		$post_id           = give_get_admin_post_id();
90
-		$price_placeholder = give_format_decimal( '1.00', false, false );
90
+		$price_placeholder = give_format_decimal('1.00', false, false);
91 91
 
92 92
 		// Start with an underscore to hide fields from custom fields list
93 93
 		$prefix = '_give_';
@@ -96,27 +96,27 @@  discard block
 block discarded – undo
96 96
 			/**
97 97
 			 * Repeatable Field Groups
98 98
 			 */
99
-			'form_field_options'    => apply_filters( 'give_forms_field_options', array(
99
+			'form_field_options'    => apply_filters('give_forms_field_options', array(
100 100
 				'id'        => 'form_field_options',
101
-				'title'     => __( 'Donation Options', 'give' ),
101
+				'title'     => __('Donation Options', 'give'),
102 102
 				'icon-html' => '<span class="give-icon give-icon-heart"></span>',
103
-				'fields'    => apply_filters( 'give_forms_donation_form_metabox_fields', array(
103
+				'fields'    => apply_filters('give_forms_donation_form_metabox_fields', array(
104 104
 					// Donation Option.
105 105
 					array(
106
-						'name'        => __( 'Donation Option', 'give' ),
107
-						'description' => __( 'Do you want this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give' ),
108
-						'id'          => $prefix . 'price_option',
106
+						'name'        => __('Donation Option', 'give'),
107
+						'description' => __('Do you want this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give'),
108
+						'id'          => $prefix.'price_option',
109 109
 						'type'        => 'radio_inline',
110 110
 						'default'     => 'multi',
111
-						'options'     => apply_filters( 'give_forms_price_options', array(
112
-							'multi' => __( 'Multi-level Donation', 'give' ),
113
-							'set'   => __( 'Set Donation', 'give' ),
114
-						) ),
111
+						'options'     => apply_filters('give_forms_price_options', array(
112
+							'multi' => __('Multi-level Donation', 'give'),
113
+							'set'   => __('Set Donation', 'give'),
114
+						)),
115 115
 					),
116 116
 					array(
117
-						'name'        => __( 'Set Donation', 'give' ),
118
-						'description' => __( 'This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give' ),
119
-						'id'          => $prefix . 'set_price',
117
+						'name'        => __('Set Donation', 'give'),
118
+						'description' => __('This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give'),
119
+						'id'          => $prefix.'set_price',
120 120
 						'type'        => 'text_small',
121 121
 						'data_type'   => 'price',
122 122
 						'attributes'  => array(
@@ -126,34 +126,34 @@  discard block
 block discarded – undo
126 126
 					),
127 127
 					// Display Style.
128 128
 					array(
129
-						'name'          => __( 'Display Style', 'give' ),
130
-						'description'   => __( 'Set how the donations levels will display on the form.', 'give' ),
131
-						'id'            => $prefix . 'display_style',
129
+						'name'          => __('Display Style', 'give'),
130
+						'description'   => __('Set how the donations levels will display on the form.', 'give'),
131
+						'id'            => $prefix.'display_style',
132 132
 						'type'          => 'radio_inline',
133 133
 						'default'       => 'buttons',
134 134
 						'options'       => array(
135
-							'buttons'  => __( 'Buttons', 'give' ),
136
-							'radios'   => __( 'Radios', 'give' ),
137
-							'dropdown' => __( 'Dropdown', 'give' ),
135
+							'buttons'  => __('Buttons', 'give'),
136
+							'radios'   => __('Radios', 'give'),
137
+							'dropdown' => __('Dropdown', 'give'),
138 138
 						),
139 139
 						'wrapper_class' => 'give-hidden',
140 140
 					),
141 141
 					// Custom Amount.
142 142
 					array(
143
-						'name'        => __( 'Custom Amount', 'give' ),
144
-						'description' => __( 'Do you want the user to be able to input their own donation amount?', 'give' ),
145
-						'id'          => $prefix . 'custom_amount',
143
+						'name'        => __('Custom Amount', 'give'),
144
+						'description' => __('Do you want the user to be able to input their own donation amount?', 'give'),
145
+						'id'          => $prefix.'custom_amount',
146 146
 						'type'        => 'radio_inline',
147 147
 						'default'     => 'disabled',
148 148
 						'options'     => array(
149
-							'enabled'  => __( 'Enabled', 'give' ),
150
-							'disabled' => __( 'Disabled', 'give' ),
149
+							'enabled'  => __('Enabled', 'give'),
150
+							'disabled' => __('Disabled', 'give'),
151 151
 						),
152 152
 					),
153 153
 					array(
154
-						'name'          => __( 'Minimum Amount', 'give' ),
155
-						'description'   => __( 'Enter the minimum custom donation amount.', 'give' ),
156
-						'id'            => $prefix . 'custom_amount_minimum',
154
+						'name'          => __('Minimum Amount', 'give'),
155
+						'description'   => __('Enter the minimum custom donation amount.', 'give'),
156
+						'id'            => $prefix.'custom_amount_minimum',
157 157
 						'type'          => 'text_small',
158 158
 						'data_type'     => 'price',
159 159
 						'attributes'    => array(
@@ -163,37 +163,37 @@  discard block
 block discarded – undo
163 163
 						'wrapper_class' => 'give-hidden',
164 164
 					),
165 165
 					array(
166
-						'name'          => __( 'Custom Amount Text', 'give' ),
167
-						'description'   => __( 'This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give' ),
168
-						'id'            => $prefix . 'custom_amount_text',
166
+						'name'          => __('Custom Amount Text', 'give'),
167
+						'description'   => __('This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give'),
168
+						'id'            => $prefix.'custom_amount_text',
169 169
 						'type'          => 'text_medium',
170 170
 						'attributes'    => array(
171 171
 							'rows'        => 3,
172
-							'placeholder' => __( 'Give a Custom Amount', 'give' ),
172
+							'placeholder' => __('Give a Custom Amount', 'give'),
173 173
 						),
174 174
 						'wrapper_class' => 'give-hidden',
175 175
 					),
176 176
 					// Donation Levels.
177 177
 					array(
178
-						'id'            => $prefix . 'donation_levels',
178
+						'id'            => $prefix.'donation_levels',
179 179
 						'type'          => 'group',
180 180
 						'options'       => array(
181
-							'add_button'    => __( 'Add Level', 'give' ),
182
-							'header_title'  => __( 'Donation Level', 'give' ),
181
+							'add_button'    => __('Add Level', 'give'),
182
+							'header_title'  => __('Donation Level', 'give'),
183 183
 							'remove_button' => '<span class="dashicons dashicons-no"></span>',
184 184
 						),
185 185
 						'wrapper_class' => 'give-hidden',
186 186
 						// Fields array works the same, except id's only need to be unique for this group.
187 187
 						// Prefix is not needed.
188
-						'fields'        => apply_filters( 'give_donation_levels_table_row', array(
188
+						'fields'        => apply_filters('give_donation_levels_table_row', array(
189 189
 							array(
190
-								'name' => __( 'ID', 'give' ),
191
-								'id'   => $prefix . 'id',
190
+								'name' => __('ID', 'give'),
191
+								'id'   => $prefix.'id',
192 192
 								'type' => 'levels_id',
193 193
 							),
194 194
 							array(
195
-								'name'       => __( 'Amount', 'give' ),
196
-								'id'         => $prefix . 'amount',
195
+								'name'       => __('Amount', 'give'),
196
+								'id'         => $prefix.'amount',
197 197
 								'type'       => 'text_small',
198 198
 								'data_type'  => 'price',
199 199
 								'attributes' => array(
@@ -202,112 +202,112 @@  discard block
 block discarded – undo
202 202
 								),
203 203
 							),
204 204
 							array(
205
-								'name'       => __( 'Text', 'give' ),
206
-								'id'         => $prefix . 'text',
205
+								'name'       => __('Text', 'give'),
206
+								'id'         => $prefix.'text',
207 207
 								'type'       => 'text',
208 208
 								'attributes' => array(
209
-									'placeholder' => __( 'Donation Level', 'give' ),
209
+									'placeholder' => __('Donation Level', 'give'),
210 210
 									'class'       => 'give-multilevel-text-field',
211 211
 								),
212 212
 							),
213 213
 							array(
214
-								'name' => __( 'Default', 'give' ),
215
-								'id'   => $prefix . 'default',
214
+								'name' => __('Default', 'give'),
215
+								'id'   => $prefix.'default',
216 216
 								'type' => 'give_default_radio_inline',
217 217
 							),
218
-						) ),
218
+						)),
219 219
 					),
220 220
 					array(
221 221
 						'name'  => 'donation_options_docs',
222 222
 						'type'  => 'docs_link',
223 223
 						'url'   => 'http://docs.givewp.com/form-donation-options',
224
-						'title' => __( 'Donation Options', 'give' ),
224
+						'title' => __('Donation Options', 'give'),
225 225
 					),
226 226
 				),
227 227
 					$post_id
228 228
 				),
229
-			) ),
229
+			)),
230 230
 
231 231
 			/**
232 232
 			 * Display Options
233 233
 			 */
234
-			'form_display_options'  => apply_filters( 'give_form_display_options', array(
234
+			'form_display_options'  => apply_filters('give_form_display_options', array(
235 235
 					'id'        => 'form_display_options',
236
-					'title'     => __( 'Form Display', 'give' ),
236
+					'title'     => __('Form Display', 'give'),
237 237
 					'icon-html' => '<span class="give-icon give-icon-display"></span>',
238
-					'fields'    => apply_filters( 'give_forms_display_options_metabox_fields', array(
238
+					'fields'    => apply_filters('give_forms_display_options_metabox_fields', array(
239 239
 						array(
240
-							'name'    => __( 'Display Options', 'give' ),
241
-							'desc'    => sprintf( __( 'How would you like to display donation information for this form?', 'give' ), '#' ),
242
-							'id'      => $prefix . 'payment_display',
240
+							'name'    => __('Display Options', 'give'),
241
+							'desc'    => sprintf(__('How would you like to display donation information for this form?', 'give'), '#'),
242
+							'id'      => $prefix.'payment_display',
243 243
 							'type'    => 'radio_inline',
244 244
 							'options' => array(
245
-								'onpage' => __( 'All Fields', 'give' ),
246
-								'modal'  => __( 'Modal', 'give' ),
247
-								'reveal' => __( 'Reveal', 'give' ),
248
-								'button' => __( 'Button', 'give' ),
245
+								'onpage' => __('All Fields', 'give'),
246
+								'modal'  => __('Modal', 'give'),
247
+								'reveal' => __('Reveal', 'give'),
248
+								'button' => __('Button', 'give'),
249 249
 							),
250 250
 							'default' => 'onpage',
251 251
 						),
252 252
 						array(
253
-							'id'            => $prefix . 'reveal_label',
254
-							'name'          => __( 'Continue Button', 'give' ),
255
-							'desc'          => __( 'The button label for displaying the additional payment fields.', 'give' ),
253
+							'id'            => $prefix.'reveal_label',
254
+							'name'          => __('Continue Button', 'give'),
255
+							'desc'          => __('The button label for displaying the additional payment fields.', 'give'),
256 256
 							'type'          => 'text_small',
257 257
 							'attributes'    => array(
258
-								'placeholder' => __( 'Donate Now', 'give' ),
258
+								'placeholder' => __('Donate Now', 'give'),
259 259
 							),
260 260
 							'wrapper_class' => 'give-hidden',
261 261
 						),
262 262
 						array(
263
-							'id'         => $prefix . 'checkout_label',
264
-							'name'       => __( 'Submit Button', 'give' ),
265
-							'desc'       => __( 'The button label for completing a donation.', 'give' ),
263
+							'id'         => $prefix.'checkout_label',
264
+							'name'       => __('Submit Button', 'give'),
265
+							'desc'       => __('The button label for completing a donation.', 'give'),
266 266
 							'type'       => 'text_small',
267 267
 							'attributes' => array(
268
-								'placeholder' => __( 'Donate Now', 'give' ),
268
+								'placeholder' => __('Donate Now', 'give'),
269 269
 							),
270 270
 						),
271 271
 						array(
272
-							'name' => __( 'Default Gateway', 'give' ),
273
-							'desc' => __( 'By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give' ),
274
-							'id'   => $prefix . 'default_gateway',
272
+							'name' => __('Default Gateway', 'give'),
273
+							'desc' => __('By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give'),
274
+							'id'   => $prefix.'default_gateway',
275 275
 							'type' => 'default_gateway',
276 276
 						),
277 277
 						array(
278
-							'name'    => __( 'Guest Donations', 'give' ),
279
-							'desc'    => __( 'Do you want to allow non-logged-in users to make donations?', 'give' ),
280
-							'id'      => $prefix . 'logged_in_only',
278
+							'name'    => __('Guest Donations', 'give'),
279
+							'desc'    => __('Do you want to allow non-logged-in users to make donations?', 'give'),
280
+							'id'      => $prefix.'logged_in_only',
281 281
 							'type'    => 'radio_inline',
282 282
 							'default' => 'enabled',
283 283
 							'options' => array(
284
-								'enabled'  => __( 'Enabled', 'give' ),
285
-								'disabled' => __( 'Disabled', 'give' ),
284
+								'enabled'  => __('Enabled', 'give'),
285
+								'disabled' => __('Disabled', 'give'),
286 286
 							),
287 287
 						),
288 288
 						array(
289
-							'name'    => __( 'Registration', 'give' ),
290
-							'desc'    => __( 'Display the registration and login forms in the payment section for non-logged-in users.', 'give' ),
291
-							'id'      => $prefix . 'show_register_form',
289
+							'name'    => __('Registration', 'give'),
290
+							'desc'    => __('Display the registration and login forms in the payment section for non-logged-in users.', 'give'),
291
+							'id'      => $prefix.'show_register_form',
292 292
 							'type'    => 'radio',
293 293
 							'options' => array(
294
-								'none'         => __( 'None', 'give' ),
295
-								'registration' => __( 'Registration', 'give' ),
296
-								'login'        => __( 'Login', 'give' ),
297
-								'both'         => __( 'Registration + Login', 'give' ),
294
+								'none'         => __('None', 'give'),
295
+								'registration' => __('Registration', 'give'),
296
+								'login'        => __('Login', 'give'),
297
+								'both'         => __('Registration + Login', 'give'),
298 298
 							),
299 299
 							'default' => 'none',
300 300
 						),
301 301
 						array(
302
-							'name'    => __( 'Floating Labels', 'give' ),
302
+							'name'    => __('Floating Labels', 'give'),
303 303
 							/* translators: %s: forms http://docs.givewp.com/form-floating-labels */
304
-							'desc'    => sprintf( __( 'Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form. Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give' ), esc_url( 'http://docs.givewp.com/form-floating-labels' ) ),
305
-							'id'      => $prefix . 'form_floating_labels',
304
+							'desc'    => sprintf(__('Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form. Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give'), esc_url('http://docs.givewp.com/form-floating-labels')),
305
+							'id'      => $prefix.'form_floating_labels',
306 306
 							'type'    => 'radio_inline',
307 307
 							'options' => array(
308
-								'global'   => __( 'Global Option', 'give' ),
309
-								'enabled'  => __( 'Enabled', 'give' ),
310
-								'disabled' => __( 'Disabled', 'give' ),
308
+								'global'   => __('Global Option', 'give'),
309
+								'enabled'  => __('Enabled', 'give'),
310
+								'disabled' => __('Disabled', 'give'),
311 311
 							),
312 312
 							'default' => 'global',
313 313
 						),
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
 							'name'  => 'form_display_docs',
316 316
 							'type'  => 'docs_link',
317 317
 							'url'   => 'http://docs.givewp.com/form-display-options',
318
-							'title' => __( 'Form Display', 'give' ),
318
+							'title' => __('Form Display', 'give'),
319 319
 						),
320 320
 					),
321 321
 						$post_id
@@ -326,41 +326,41 @@  discard block
 block discarded – undo
326 326
 			/**
327 327
 			 * Donation Goals
328 328
 			 */
329
-			'donation_goal_options' => apply_filters( 'give_donation_goal_options', array(
329
+			'donation_goal_options' => apply_filters('give_donation_goal_options', array(
330 330
 				'id'        => 'donation_goal_options',
331
-				'title'     => __( 'Donation Goal', 'give' ),
331
+				'title'     => __('Donation Goal', 'give'),
332 332
 				'icon-html' => '<span class="give-icon give-icon-target"></span>',
333
-				'fields'    => apply_filters( 'give_forms_donation_goal_metabox_fields', array(
333
+				'fields'    => apply_filters('give_forms_donation_goal_metabox_fields', array(
334 334
 					// Goals
335 335
 					array(
336
-						'name'        => __( 'Donation Goal', 'give' ),
337
-						'description' => __( 'Do you want to set a donation goal for this form?', 'give' ),
338
-						'id'          => $prefix . 'goal_option',
336
+						'name'        => __('Donation Goal', 'give'),
337
+						'description' => __('Do you want to set a donation goal for this form?', 'give'),
338
+						'id'          => $prefix.'goal_option',
339 339
 						'type'        => 'radio_inline',
340 340
 						'default'     => 'disabled',
341 341
 						'options'     => array(
342
-							'enabled'  => __( 'Enabled', 'give' ),
343
-							'disabled' => __( 'Disabled', 'give' ),
342
+							'enabled'  => __('Enabled', 'give'),
343
+							'disabled' => __('Disabled', 'give'),
344 344
 						),
345 345
 					),
346 346
 
347 347
 					array(
348
-						'name'        => __( 'Goal Format', 'give' ),
349
-						'description' => __( 'Do you want to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded" or "1 of 5 donations".', 'give' ),
350
-						'id'          => $prefix . 'goal_format',
348
+						'name'        => __('Goal Format', 'give'),
349
+						'description' => __('Do you want to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded" or "1 of 5 donations".', 'give'),
350
+						'id'          => $prefix.'goal_format',
351 351
 						'type'        => 'radio_inline',
352 352
 						'default'     => 'amount',
353 353
 						'options'     => array(
354
-							'amount'     => __( 'Amount', 'give' ),
355
-							'percentage' => __( 'Percentage', 'give' ),
356
-							'donation'   => __( 'Number of Donations', 'give' ),
354
+							'amount'     => __('Amount', 'give'),
355
+							'percentage' => __('Percentage', 'give'),
356
+							'donation'   => __('Number of Donations', 'give'),
357 357
 						),
358 358
 					),
359 359
 
360 360
 					array(
361
-						'name'          => __( 'Goal Amount', 'give' ),
362
-						'description'   => __( 'This is the monetary goal amount you want to reach for this form.', 'give' ),
363
-						'id'            => $prefix . 'set_goal',
361
+						'name'          => __('Goal Amount', 'give'),
362
+						'description'   => __('This is the monetary goal amount you want to reach for this form.', 'give'),
363
+						'id'            => $prefix.'set_goal',
364 364
 						'type'          => 'text_small',
365 365
 						'data_type'     => 'price',
366 366
 						'attributes'    => array(
@@ -371,9 +371,9 @@  discard block
 block discarded – undo
371 371
 					),
372 372
 
373 373
 					array(
374
-						'id'         => $prefix . 'number_of_donation_goal',
375
-						'name'       => __( 'Donation Goal', 'give' ),
376
-						'desc'       => __( 'Set total number of donations as a goal.', 'give' ),
374
+						'id'         => $prefix.'number_of_donation_goal',
375
+						'name'       => __('Donation Goal', 'give'),
376
+						'desc'       => __('Set total number of donations as a goal.', 'give'),
377 377
 						'type'       => 'number',
378 378
 						'default'    => 1,
379 379
 						'attributes' => array(
@@ -382,85 +382,85 @@  discard block
 block discarded – undo
382 382
 					),
383 383
 
384 384
 					array(
385
-						'name'          => __( 'Progress Bar Color', 'give' ),
386
-						'desc'          => __( 'Customize the color of the goal progress bar.', 'give' ),
387
-						'id'            => $prefix . 'goal_color',
385
+						'name'          => __('Progress Bar Color', 'give'),
386
+						'desc'          => __('Customize the color of the goal progress bar.', 'give'),
387
+						'id'            => $prefix.'goal_color',
388 388
 						'type'          => 'colorpicker',
389 389
 						'default'       => '#2bc253',
390 390
 						'wrapper_class' => 'give-hidden',
391 391
 					),
392 392
 
393 393
 					array(
394
-						'name'          => __( 'Close Form', 'give' ),
395
-						'desc'          => __( 'Do you want to close the donation forms and stop accepting donations once this goal has been met?', 'give' ),
396
-						'id'            => $prefix . 'close_form_when_goal_achieved',
394
+						'name'          => __('Close Form', 'give'),
395
+						'desc'          => __('Do you want to close the donation forms and stop accepting donations once this goal has been met?', 'give'),
396
+						'id'            => $prefix.'close_form_when_goal_achieved',
397 397
 						'type'          => 'radio_inline',
398 398
 						'default'       => 'disabled',
399 399
 						'options'       => array(
400
-							'enabled'  => __( 'Enabled', 'give' ),
401
-							'disabled' => __( 'Disabled', 'give' ),
400
+							'enabled'  => __('Enabled', 'give'),
401
+							'disabled' => __('Disabled', 'give'),
402 402
 						),
403 403
 						'wrapper_class' => 'give-hidden',
404 404
 					),
405 405
 					array(
406
-						'name'          => __( 'Goal Achieved Message', 'give' ),
407
-						'desc'          => __( 'Do you want to display a custom message when the goal is closed?', 'give' ),
408
-						'id'            => $prefix . 'form_goal_achieved_message',
406
+						'name'          => __('Goal Achieved Message', 'give'),
407
+						'desc'          => __('Do you want to display a custom message when the goal is closed?', 'give'),
408
+						'id'            => $prefix.'form_goal_achieved_message',
409 409
 						'type'          => 'wysiwyg',
410
-						'default'       => __( 'Thank you to all our donors, we have met our fundraising goal.', 'give' ),
410
+						'default'       => __('Thank you to all our donors, we have met our fundraising goal.', 'give'),
411 411
 						'wrapper_class' => 'give-hidden',
412 412
 					),
413 413
 					array(
414 414
 						'name'  => 'donation_goal_docs',
415 415
 						'type'  => 'docs_link',
416 416
 						'url'   => 'http://docs.givewp.com/form-donation-goal',
417
-						'title' => __( 'Donation Goal', 'give' ),
417
+						'title' => __('Donation Goal', 'give'),
418 418
 					),
419 419
 				),
420 420
 					$post_id
421 421
 				),
422
-			) ),
422
+			)),
423 423
 
424 424
 			/**
425 425
 			 * Content Field
426 426
 			 */
427
-			'form_content_options'  => apply_filters( 'give_forms_content_options', array(
427
+			'form_content_options'  => apply_filters('give_forms_content_options', array(
428 428
 				'id'        => 'form_content_options',
429
-				'title'     => __( 'Form Content', 'give' ),
429
+				'title'     => __('Form Content', 'give'),
430 430
 				'icon-html' => '<span class="give-icon give-icon-edit"></span>',
431
-				'fields'    => apply_filters( 'give_forms_content_options_metabox_fields', array(
431
+				'fields'    => apply_filters('give_forms_content_options_metabox_fields', array(
432 432
 
433 433
 					// Donation content.
434 434
 					array(
435
-						'name'        => __( 'Display Content', 'give' ),
436
-						'description' => __( 'Do you want to add custom content to this form?', 'give' ),
437
-						'id'          => $prefix . 'display_content',
435
+						'name'        => __('Display Content', 'give'),
436
+						'description' => __('Do you want to add custom content to this form?', 'give'),
437
+						'id'          => $prefix.'display_content',
438 438
 						'type'        => 'radio_inline',
439 439
 						'options'     => array(
440
-							'enabled'  => __( 'Enabled', 'give' ),
441
-							'disabled' => __( 'Disabled', 'give' ),
440
+							'enabled'  => __('Enabled', 'give'),
441
+							'disabled' => __('Disabled', 'give'),
442 442
 						),
443 443
 						'default'     => 'disabled',
444 444
 					),
445 445
 
446 446
 					// Content placement.
447 447
 					array(
448
-						'name'          => __( 'Content Placement', 'give' ),
449
-						'description'   => __( 'This option controls where the content appears within the donation form.', 'give' ),
450
-						'id'            => $prefix . 'content_placement',
448
+						'name'          => __('Content Placement', 'give'),
449
+						'description'   => __('This option controls where the content appears within the donation form.', 'give'),
450
+						'id'            => $prefix.'content_placement',
451 451
 						'type'          => 'radio_inline',
452
-						'options'       => apply_filters( 'give_forms_content_options_select', array(
453
-								'give_pre_form'  => __( 'Above fields', 'give' ),
454
-								'give_post_form' => __( 'Below fields', 'give' ),
452
+						'options'       => apply_filters('give_forms_content_options_select', array(
453
+								'give_pre_form'  => __('Above fields', 'give'),
454
+								'give_post_form' => __('Below fields', 'give'),
455 455
 							)
456 456
 						),
457 457
 						'default'       => 'give_pre_form',
458 458
 						'wrapper_class' => 'give-hidden',
459 459
 					),
460 460
 					array(
461
-						'name'          => __( 'Content', 'give' ),
462
-						'description'   => __( 'This content will display on the single give form page.', 'give' ),
463
-						'id'            => $prefix . 'form_content',
461
+						'name'          => __('Content', 'give'),
462
+						'description'   => __('This content will display on the single give form page.', 'give'),
463
+						'id'            => $prefix.'form_content',
464 464
 						'type'          => 'wysiwyg',
465 465
 						'wrapper_class' => 'give-hidden',
466 466
 					),
@@ -468,51 +468,51 @@  discard block
 block discarded – undo
468 468
 						'name'  => 'form_content_docs',
469 469
 						'type'  => 'docs_link',
470 470
 						'url'   => 'http://docs.givewp.com/form-content',
471
-						'title' => __( 'Form Content', 'give' ),
471
+						'title' => __('Form Content', 'give'),
472 472
 					),
473 473
 				),
474 474
 					$post_id
475 475
 				),
476
-			) ),
476
+			)),
477 477
 
478 478
 			/**
479 479
 			 * Terms & Conditions
480 480
 			 */
481
-			'form_terms_options'    => apply_filters( 'give_forms_terms_options', array(
481
+			'form_terms_options'    => apply_filters('give_forms_terms_options', array(
482 482
 				'id'        => 'form_terms_options',
483
-				'title'     => __( 'Terms & Conditions', 'give' ),
483
+				'title'     => __('Terms & Conditions', 'give'),
484 484
 				'icon-html' => '<span class="give-icon give-icon-checklist"></span>',
485
-				'fields'    => apply_filters( 'give_forms_terms_options_metabox_fields', array(
485
+				'fields'    => apply_filters('give_forms_terms_options_metabox_fields', array(
486 486
 					// Donation Option
487 487
 					array(
488
-						'name'        => __( 'Terms and Conditions', 'give' ),
489
-						'description' => __( 'Do you want to require the donor to accept terms prior to being able to complete their donation?', 'give' ),
490
-						'id'          => $prefix . 'terms_option',
488
+						'name'        => __('Terms and Conditions', 'give'),
489
+						'description' => __('Do you want to require the donor to accept terms prior to being able to complete their donation?', 'give'),
490
+						'id'          => $prefix.'terms_option',
491 491
 						'type'        => 'radio_inline',
492
-						'options'     => apply_filters( 'give_forms_content_options_select', array(
493
-								'global'   => __( 'Global Option', 'give' ),
494
-								'enabled'  => __( 'Customize', 'give' ),
495
-								'disabled' => __( 'Disable', 'give' ),
492
+						'options'     => apply_filters('give_forms_content_options_select', array(
493
+								'global'   => __('Global Option', 'give'),
494
+								'enabled'  => __('Customize', 'give'),
495
+								'disabled' => __('Disable', 'give'),
496 496
 							)
497 497
 						),
498 498
 						'default'     => 'global',
499 499
 					),
500 500
 					array(
501
-						'id'            => $prefix . 'agree_label',
502
-						'name'          => __( 'Agreement Label', 'give' ),
503
-						'desc'          => __( 'The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give' ),
501
+						'id'            => $prefix.'agree_label',
502
+						'name'          => __('Agreement Label', 'give'),
503
+						'desc'          => __('The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give'),
504 504
 						'type'          => 'text',
505 505
 						'size'          => 'regular',
506 506
 						'attributes'    => array(
507
-							'placeholder' => __( 'Agree to Terms?', 'give' ),
507
+							'placeholder' => __('Agree to Terms?', 'give'),
508 508
 						),
509 509
 						'wrapper_class' => 'give-hidden',
510 510
 					),
511 511
 					array(
512
-						'id'            => $prefix . 'agree_text',
513
-						'name'          => __( 'Agreement Text', 'give' ),
514
-						'desc'          => __( 'This is the actual text which the user will have to agree to in order to make a donation.', 'give' ),
515
-						'default'       => give_get_option( 'agreement_text' ),
512
+						'id'            => $prefix.'agree_text',
513
+						'name'          => __('Agreement Text', 'give'),
514
+						'desc'          => __('This is the actual text which the user will have to agree to in order to make a donation.', 'give'),
515
+						'default'       => give_get_option('agreement_text'),
516 516
 						'type'          => 'wysiwyg',
517 517
 						'wrapper_class' => 'give-hidden',
518 518
 					),
@@ -520,18 +520,18 @@  discard block
 block discarded – undo
520 520
 						'name'  => 'terms_docs',
521 521
 						'type'  => 'docs_link',
522 522
 						'url'   => 'http://docs.givewp.com/form-terms',
523
-						'title' => __( 'Terms and Conditions', 'give' ),
523
+						'title' => __('Terms and Conditions', 'give'),
524 524
 					),
525 525
 				),
526 526
 					$post_id
527 527
 				),
528
-			) ),
528
+			)),
529 529
 		);
530 530
 
531 531
 		/**
532 532
 		 * Filter the metabox tabbed panel settings.
533 533
 		 */
534
-		$settings = apply_filters( 'give_metabox_form_data_settings', $settings, $post_id );
534
+		$settings = apply_filters('give_metabox_form_data_settings', $settings, $post_id);
535 535
 
536 536
 		// Output.
537 537
 		return $settings;
@@ -548,8 +548,8 @@  discard block
 block discarded – undo
548 548
 		add_meta_box(
549 549
 			$this->get_metabox_ID(),
550 550
 			$this->get_metabox_label(),
551
-			array( $this, 'output' ),
552
-			array( 'give_forms' ),
551
+			array($this, 'output'),
552
+			array('give_forms'),
553 553
 			'normal',
554 554
 			'high'
555 555
 		);
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
 	function enqueue_script() {
567 567
 		global $post;
568 568
 
569
-		if ( is_object( $post ) && 'give_forms' === $post->post_type ) {
569
+		if (is_object($post) && 'give_forms' === $post->post_type) {
570 570
 
571 571
 		}
572 572
 	}
@@ -604,32 +604,32 @@  discard block
 block discarded – undo
604 604
 	public function get_tabs() {
605 605
 		$tabs = array();
606 606
 
607
-		if ( ! empty( $this->settings ) ) {
608
-			foreach ( $this->settings as $setting ) {
609
-				if ( ! isset( $setting['id'] ) || ! isset( $setting['title'] ) ) {
607
+		if ( ! empty($this->settings)) {
608
+			foreach ($this->settings as $setting) {
609
+				if ( ! isset($setting['id']) || ! isset($setting['title'])) {
610 610
 					continue;
611 611
 				}
612 612
 				$tab = array(
613 613
 					'id'        => $setting['id'],
614 614
 					'label'     => $setting['title'],
615
-					'icon-html' => ( ! empty( $setting['icon-html'] ) ? $setting['icon-html'] : '' ),
615
+					'icon-html' => ( ! empty($setting['icon-html']) ? $setting['icon-html'] : ''),
616 616
 				);
617 617
 
618
-				if ( $this->has_sub_tab( $setting ) ) {
619
-					if ( empty( $setting['sub-fields'] ) ) {
618
+				if ($this->has_sub_tab($setting)) {
619
+					if (empty($setting['sub-fields'])) {
620 620
 						$tab = array();
621 621
 					} else {
622
-						foreach ( $setting['sub-fields'] as $sub_fields ) {
622
+						foreach ($setting['sub-fields'] as $sub_fields) {
623 623
 							$tab['sub-fields'][] = array(
624 624
 								'id'        => $sub_fields['id'],
625 625
 								'label'     => $sub_fields['title'],
626
-								'icon-html' => ( ! empty( $sub_fields['icon-html'] ) ? $sub_fields['icon-html'] : '' ),
626
+								'icon-html' => ( ! empty($sub_fields['icon-html']) ? $sub_fields['icon-html'] : ''),
627 627
 							);
628 628
 						}
629 629
 					}
630 630
 				}
631 631
 
632
-				if ( ! empty( $tab ) ) {
632
+				if ( ! empty($tab)) {
633 633
 					$tabs[] = $tab;
634 634
 				}
635 635
 			}
@@ -647,33 +647,33 @@  discard block
 block discarded – undo
647 647
 	 */
648 648
 	public function output() {
649 649
 		// Bailout.
650
-		if ( $form_data_tabs = $this->get_tabs() ) :
651
-			$active_tab = ! empty( $_GET['give_tab'] ) ? give_clean( $_GET['give_tab'] ) : 'form_field_options';
652
-			wp_nonce_field( 'give_save_form_meta', 'give_form_meta_nonce' );
650
+		if ($form_data_tabs = $this->get_tabs()) :
651
+			$active_tab = ! empty($_GET['give_tab']) ? give_clean($_GET['give_tab']) : 'form_field_options';
652
+			wp_nonce_field('give_save_form_meta', 'give_form_meta_nonce');
653 653
 			?>
654 654
 			<input id="give_form_active_tab" type="hidden" name="give_form_active_tab">
655 655
 			<div class="give-metabox-panel-wrap">
656 656
 				<ul class="give-form-data-tabs give-metabox-tabs">
657
-					<?php foreach ( $form_data_tabs as $index => $form_data_tab ) : ?>
657
+					<?php foreach ($form_data_tabs as $index => $form_data_tab) : ?>
658 658
 						<?php
659 659
 						// Determine if current tab is active.
660 660
 						$is_active = $active_tab === $form_data_tab['id'] ? true : false;
661 661
 						?>
662
-						<li class="<?php echo "{$form_data_tab['id']}_tab" . ( $is_active ? ' active' : '' ) . ( $this->has_sub_tab( $form_data_tab ) ? ' has-sub-fields' : '' ); ?>">
662
+						<li class="<?php echo "{$form_data_tab['id']}_tab".($is_active ? ' active' : '').($this->has_sub_tab($form_data_tab) ? ' has-sub-fields' : ''); ?>">
663 663
 							<a href="#<?php echo $form_data_tab['id']; ?>" data-tab-id="<?php echo $form_data_tab['id']; ?>">
664
-								<?php if ( ! empty( $form_data_tab['icon-html'] ) ) : ?>
664
+								<?php if ( ! empty($form_data_tab['icon-html'])) : ?>
665 665
 									<?php echo $form_data_tab['icon-html']; ?>
666 666
 								<?php else : ?>
667 667
 									<span class="give-icon give-icon-default"></span>
668 668
 								<?php endif; ?>
669 669
 								<span class="give-label"><?php echo $form_data_tab['label']; ?></span>
670 670
 							</a>
671
-							<?php if ( $this->has_sub_tab( $form_data_tab ) ) : ?>
671
+							<?php if ($this->has_sub_tab($form_data_tab)) : ?>
672 672
 								<ul class="give-metabox-sub-tabs give-hidden">
673
-									<?php foreach ( $form_data_tab['sub-fields'] as $sub_tab ) : ?>
673
+									<?php foreach ($form_data_tab['sub-fields'] as $sub_tab) : ?>
674 674
 										<li class="<?php echo "{$sub_tab['id']}_tab"; ?>">
675 675
 											<a href="#<?php echo $sub_tab['id']; ?>" data-tab-id="<?php echo $sub_tab['id']; ?>">
676
-												<?php if ( ! empty( $sub_tab['icon-html'] ) ) : ?>
676
+												<?php if ( ! empty($sub_tab['icon-html'])) : ?>
677 677
 													<?php echo $sub_tab['icon-html']; ?>
678 678
 												<?php else : ?>
679 679
 													<span class="give-icon give-icon-default"></span>
@@ -688,29 +688,29 @@  discard block
 block discarded – undo
688 688
 					<?php endforeach; ?>
689 689
 				</ul>
690 690
 
691
-				<?php foreach ( $this->settings as $setting ) : ?>
692
-					<?php do_action( "give_before_{$setting['id']}_settings" ); ?>
691
+				<?php foreach ($this->settings as $setting) : ?>
692
+					<?php do_action("give_before_{$setting['id']}_settings"); ?>
693 693
 					<?php
694 694
 					// Determine if current panel is active.
695 695
 					$is_active = $active_tab === $setting['id'] ? true : false;
696 696
 					?>
697
-					<div id="<?php echo $setting['id']; ?>" class="panel give_options_panel<?php echo( $is_active ? ' active' : '' ); ?>">
698
-						<?php if ( ! empty( $setting['fields'] ) ) : ?>
699
-							<?php foreach ( $setting['fields'] as $field ) : ?>
700
-								<?php give_render_field( $field ); ?>
697
+					<div id="<?php echo $setting['id']; ?>" class="panel give_options_panel<?php echo($is_active ? ' active' : ''); ?>">
698
+						<?php if ( ! empty($setting['fields'])) : ?>
699
+							<?php foreach ($setting['fields'] as $field) : ?>
700
+								<?php give_render_field($field); ?>
701 701
 							<?php endforeach; ?>
702 702
 						<?php endif; ?>
703 703
 					</div>
704
-					<?php do_action( "give_after_{$setting['id']}_settings" ); ?>
704
+					<?php do_action("give_after_{$setting['id']}_settings"); ?>
705 705
 
706 706
 
707
-					<?php if ( $this->has_sub_tab( $setting ) ) : ?>
708
-						<?php if ( ! empty( $setting['sub-fields'] ) ) : ?>
709
-							<?php foreach ( $setting['sub-fields'] as $index => $sub_fields ) : ?>
707
+					<?php if ($this->has_sub_tab($setting)) : ?>
708
+						<?php if ( ! empty($setting['sub-fields'])) : ?>
709
+							<?php foreach ($setting['sub-fields'] as $index => $sub_fields) : ?>
710 710
 								<div id="<?php echo $sub_fields['id']; ?>" class="panel give_options_panel give-hidden">
711
-									<?php if ( ! empty( $sub_fields['fields'] ) ) : ?>
712
-										<?php foreach ( $sub_fields['fields'] as $sub_field ) : ?>
713
-											<?php give_render_field( $sub_field ); ?>
711
+									<?php if ( ! empty($sub_fields['fields'])) : ?>
712
+										<?php foreach ($sub_fields['fields'] as $sub_field) : ?>
713
+											<?php give_render_field($sub_field); ?>
714 714
 										<?php endforeach; ?>
715 715
 									<?php endif; ?>
716 716
 								</div>
@@ -733,9 +733,9 @@  discard block
 block discarded – undo
733 733
 	 *
734 734
 	 * @return bool
735 735
 	 */
736
-	private function has_sub_tab( $field_setting ) {
736
+	private function has_sub_tab($field_setting) {
737 737
 		$has_sub_tab = false;
738
-		if ( array_key_exists( 'sub-fields', $field_setting ) ) {
738
+		if (array_key_exists('sub-fields', $field_setting)) {
739 739
 			$has_sub_tab = true;
740 740
 		}
741 741
 
@@ -750,13 +750,13 @@  discard block
 block discarded – undo
750 750
 	 * @return array
751 751
 	 */
752 752
 	function cmb2_metabox_settings() {
753
-		$all_cmb2_settings   = apply_filters( 'cmb2_meta_boxes', array() );
753
+		$all_cmb2_settings   = apply_filters('cmb2_meta_boxes', array());
754 754
 		$give_forms_settings = $all_cmb2_settings;
755 755
 
756 756
 		// Filter settings: Use only give forms related settings.
757
-		foreach ( $all_cmb2_settings as $index => $setting ) {
758
-			if ( ! in_array( 'give_forms', $setting['object_types'] ) ) {
759
-				unset( $give_forms_settings[ $index ] );
757
+		foreach ($all_cmb2_settings as $index => $setting) {
758
+			if ( ! in_array('give_forms', $setting['object_types'])) {
759
+				unset($give_forms_settings[$index]);
760 760
 			}
761 761
 		}
762 762
 
@@ -774,96 +774,96 @@  discard block
 block discarded – undo
774 774
 	 *
775 775
 	 * @return void
776 776
 	 */
777
-	public function save( $post_id, $post ) {
777
+	public function save($post_id, $post) {
778 778
 
779 779
 		// $post_id and $post are required.
780
-		if ( empty( $post_id ) || empty( $post ) ) {
780
+		if (empty($post_id) || empty($post)) {
781 781
 			return;
782 782
 		}
783 783
 
784 784
 		// Don't save meta boxes for revisions or autosaves.
785
-		if ( defined( 'DOING_AUTOSAVE' ) || is_int( wp_is_post_revision( $post ) ) || is_int( wp_is_post_autosave( $post ) ) ) {
785
+		if (defined('DOING_AUTOSAVE') || is_int(wp_is_post_revision($post)) || is_int(wp_is_post_autosave($post))) {
786 786
 			return;
787 787
 		}
788 788
 
789 789
 		// Check the nonce.
790
-		if ( empty( $_POST['give_form_meta_nonce'] ) || ! wp_verify_nonce( $_POST['give_form_meta_nonce'], 'give_save_form_meta' ) ) {
790
+		if (empty($_POST['give_form_meta_nonce']) || ! wp_verify_nonce($_POST['give_form_meta_nonce'], 'give_save_form_meta')) {
791 791
 			return;
792 792
 		}
793 793
 
794 794
 		// Check the post being saved == the $post_id to prevent triggering this call for other save_post events.
795
-		if ( empty( $_POST['post_ID'] ) || $_POST['post_ID'] != $post_id ) {
795
+		if (empty($_POST['post_ID']) || $_POST['post_ID'] != $post_id) {
796 796
 			return;
797 797
 		}
798 798
 
799 799
 		// Check user has permission to edit.
800
-		if ( ! current_user_can( 'edit_post', $post_id ) ) {
800
+		if ( ! current_user_can('edit_post', $post_id)) {
801 801
 			return;
802 802
 		}
803 803
 
804 804
 		// Fire action before saving form meta.
805
-		do_action( 'give_pre_process_give_forms_meta', $post_id, $post );
805
+		do_action('give_pre_process_give_forms_meta', $post_id, $post);
806 806
 
807 807
 		/**
808 808
 		 * Filter the meta key to save.
809 809
 		 * Third party addon developer can remove there meta keys from this array to handle saving data on there own.
810 810
 		 */
811
-		$form_meta_keys = apply_filters( 'give_process_form_meta_keys', $this->get_meta_keys_from_settings() );
811
+		$form_meta_keys = apply_filters('give_process_form_meta_keys', $this->get_meta_keys_from_settings());
812 812
 
813 813
 		// Save form meta data.
814
-		if ( ! empty( $form_meta_keys ) ) {
815
-			foreach ( $form_meta_keys as $form_meta_key ) {
814
+		if ( ! empty($form_meta_keys)) {
815
+			foreach ($form_meta_keys as $form_meta_key) {
816 816
 
817 817
 				// Set default value for checkbox fields.
818 818
 				if (
819
-					! isset( $_POST[ $form_meta_key ] )
820
-					&& ( 'checkbox' === $this->get_field_type( $form_meta_key ) )
819
+					! isset($_POST[$form_meta_key])
820
+					&& ('checkbox' === $this->get_field_type($form_meta_key))
821 821
 				) {
822
-					$_POST[ $form_meta_key ] = '';
822
+					$_POST[$form_meta_key] = '';
823 823
 				}
824 824
 
825
-				if ( isset( $_POST[ $form_meta_key ] ) ) {
826
-					$setting_field = $this->get_setting_field( $form_meta_key );
827
-					if ( ! empty( $setting_field['type'] ) ) {
828
-						switch ( $setting_field['type'] ) {
825
+				if (isset($_POST[$form_meta_key])) {
826
+					$setting_field = $this->get_setting_field($form_meta_key);
827
+					if ( ! empty($setting_field['type'])) {
828
+						switch ($setting_field['type']) {
829 829
 							case 'textarea':
830 830
 							case 'wysiwyg':
831
-								$form_meta_value = wp_kses_post( $_POST[ $form_meta_key ] );
831
+								$form_meta_value = wp_kses_post($_POST[$form_meta_key]);
832 832
 								break;
833 833
 
834 834
 							case 'group':
835 835
 								$form_meta_value = array();
836 836
 
837
-								foreach ( $_POST[ $form_meta_key ] as $index => $group ) {
837
+								foreach ($_POST[$form_meta_key] as $index => $group) {
838 838
 
839 839
 									// Do not save template input field values.
840
-									if ( '{{row-count-placeholder}}' === $index ) {
840
+									if ('{{row-count-placeholder}}' === $index) {
841 841
 										continue;
842 842
 									}
843 843
 
844 844
 									$group_meta_value = array();
845
-									foreach ( $group as $field_id => $field_value ) {
846
-										switch ( $this->get_field_type( $field_id, $form_meta_key ) ) {
845
+									foreach ($group as $field_id => $field_value) {
846
+										switch ($this->get_field_type($field_id, $form_meta_key)) {
847 847
 											case 'wysiwyg':
848
-												$group_meta_value[ $field_id ] = wp_kses_post( $field_value );
848
+												$group_meta_value[$field_id] = wp_kses_post($field_value);
849 849
 												break;
850 850
 
851 851
 											default:
852
-												$group_meta_value[ $field_id ] = give_clean( $field_value );
852
+												$group_meta_value[$field_id] = give_clean($field_value);
853 853
 										}
854 854
 									}
855 855
 
856
-									if ( ! empty( $group_meta_value ) ) {
857
-										$form_meta_value[ $index ] = $group_meta_value;
856
+									if ( ! empty($group_meta_value)) {
857
+										$form_meta_value[$index] = $group_meta_value;
858 858
 									}
859 859
 								}
860 860
 
861 861
 								// Arrange repeater field keys in order.
862
-								$form_meta_value = array_values( $form_meta_value );
862
+								$form_meta_value = array_values($form_meta_value);
863 863
 								break;
864 864
 
865 865
 							default:
866
-								$form_meta_value = give_clean( $_POST[ $form_meta_key ] );
866
+								$form_meta_value = give_clean($_POST[$form_meta_key]);
867 867
 						}// End switch().
868 868
 
869 869
 						/**
@@ -873,24 +873,24 @@  discard block
 block discarded – undo
873 873
 						 */
874 874
 						$form_meta_value = apply_filters(
875 875
 							'give_pre_save_form_meta_value',
876
-							$this->sanitize_form_meta( $form_meta_value, $setting_field ),
876
+							$this->sanitize_form_meta($form_meta_value, $setting_field),
877 877
 							$form_meta_key,
878 878
 							$this,
879 879
 							$post_id
880 880
 						);
881 881
 
882 882
 						// Save data.
883
-						give_update_meta( $post_id, $form_meta_key, $form_meta_value );
883
+						give_update_meta($post_id, $form_meta_key, $form_meta_value);
884 884
 
885 885
 						// Fire after saving form meta key.
886
-						do_action( "give_save_{$form_meta_key}", $form_meta_key, $form_meta_value, $post_id, $post );
886
+						do_action("give_save_{$form_meta_key}", $form_meta_key, $form_meta_value, $post_id, $post);
887 887
 					}// End if().
888 888
 				}// End if().
889 889
 			}// End foreach().
890 890
 		}// End if().
891 891
 
892 892
 		// Fire action after saving form meta.
893
-		do_action( 'give_post_process_give_forms_meta', $post_id, $post );
893
+		do_action('give_post_process_give_forms_meta', $post_id, $post);
894 894
 	}
895 895
 
896 896
 
@@ -903,10 +903,10 @@  discard block
 block discarded – undo
903 903
 	 *
904 904
 	 * @return string
905 905
 	 */
906
-	private function get_field_id( $field ) {
906
+	private function get_field_id($field) {
907 907
 		$field_id = '';
908 908
 
909
-		if ( array_key_exists( 'id', $field ) ) {
909
+		if (array_key_exists('id', $field)) {
910 910
 			$field_id = $field['id'];
911 911
 
912 912
 		}
@@ -923,12 +923,12 @@  discard block
 block discarded – undo
923 923
 	 *
924 924
 	 * @return array
925 925
 	 */
926
-	private function get_fields_id( $setting ) {
926
+	private function get_fields_id($setting) {
927 927
 		$meta_keys = array();
928 928
 
929
-		if ( ! empty( $setting ) ) {
930
-			foreach ( $setting['fields'] as $field ) {
931
-				if ( $field_id = $this->get_field_id( $field ) ) {
929
+		if ( ! empty($setting)) {
930
+			foreach ($setting['fields'] as $field) {
931
+				if ($field_id = $this->get_field_id($field)) {
932 932
 					$meta_keys[] = $field_id;
933 933
 				}
934 934
 			}
@@ -946,14 +946,14 @@  discard block
 block discarded – undo
946 946
 	 *
947 947
 	 * @return array
948 948
 	 */
949
-	private function get_sub_fields_id( $setting ) {
949
+	private function get_sub_fields_id($setting) {
950 950
 		$meta_keys = array();
951 951
 
952
-		if ( $this->has_sub_tab( $setting ) && ! empty( $setting['sub-fields'] ) ) {
953
-			foreach ( $setting['sub-fields'] as $fields ) {
954
-				if ( ! empty( $fields['fields'] ) ) {
955
-					foreach ( $fields['fields'] as $field ) {
956
-						if ( $field_id = $this->get_field_id( $field ) ) {
952
+		if ($this->has_sub_tab($setting) && ! empty($setting['sub-fields'])) {
953
+			foreach ($setting['sub-fields'] as $fields) {
954
+				if ( ! empty($fields['fields'])) {
955
+					foreach ($fields['fields'] as $field) {
956
+						if ($field_id = $this->get_field_id($field)) {
957 957
 							$meta_keys[] = $field_id;
958 958
 						}
959 959
 					}
@@ -975,14 +975,14 @@  discard block
 block discarded – undo
975 975
 	private function get_meta_keys_from_settings() {
976 976
 		$meta_keys = array();
977 977
 
978
-		foreach ( $this->settings as $setting ) {
979
-			$meta_key = $this->get_fields_id( $setting );
978
+		foreach ($this->settings as $setting) {
979
+			$meta_key = $this->get_fields_id($setting);
980 980
 
981
-			if ( $this->has_sub_tab( $setting ) ) {
982
-				$meta_key = array_merge( $meta_key, $this->get_sub_fields_id( $setting ) );
981
+			if ($this->has_sub_tab($setting)) {
982
+				$meta_key = array_merge($meta_key, $this->get_sub_fields_id($setting));
983 983
 			}
984 984
 
985
-			$meta_keys = array_merge( $meta_keys, $meta_key );
985
+			$meta_keys = array_merge($meta_keys, $meta_key);
986 986
 		}
987 987
 
988 988
 		return $meta_keys;
@@ -999,10 +999,10 @@  discard block
 block discarded – undo
999 999
 	 *
1000 1000
 	 * @return string
1001 1001
 	 */
1002
-	function get_field_type( $field_id, $group_id = '' ) {
1003
-		$field = $this->get_setting_field( $field_id, $group_id );
1002
+	function get_field_type($field_id, $group_id = '') {
1003
+		$field = $this->get_setting_field($field_id, $group_id);
1004 1004
 
1005
-		$type = array_key_exists( 'type', $field )
1005
+		$type = array_key_exists('type', $field)
1006 1006
 			? $field['type']
1007 1007
 			: '';
1008 1008
 
@@ -1020,12 +1020,12 @@  discard block
 block discarded – undo
1020 1020
 	 *
1021 1021
 	 * @return array
1022 1022
 	 */
1023
-	private function get_field( $setting, $field_id ) {
1023
+	private function get_field($setting, $field_id) {
1024 1024
 		$setting_field = array();
1025 1025
 
1026
-		if ( ! empty( $setting['fields'] ) ) {
1027
-			foreach ( $setting['fields'] as $field ) {
1028
-				if ( array_key_exists( 'id', $field ) && $field['id'] === $field_id ) {
1026
+		if ( ! empty($setting['fields'])) {
1027
+			foreach ($setting['fields'] as $field) {
1028
+				if (array_key_exists('id', $field) && $field['id'] === $field_id) {
1029 1029
 					$setting_field = $field;
1030 1030
 					break;
1031 1031
 				}
@@ -1045,12 +1045,12 @@  discard block
 block discarded – undo
1045 1045
 	 *
1046 1046
 	 * @return array
1047 1047
 	 */
1048
-	private function get_sub_field( $setting, $field_id ) {
1048
+	private function get_sub_field($setting, $field_id) {
1049 1049
 		$setting_field = array();
1050 1050
 
1051
-		if ( ! empty( $setting['sub-fields'] ) ) {
1052
-			foreach ( $setting['sub-fields'] as $fields ) {
1053
-				if ( $field = $this->get_field( $fields, $field_id ) ) {
1051
+		if ( ! empty($setting['sub-fields'])) {
1052
+			foreach ($setting['sub-fields'] as $fields) {
1053
+				if ($field = $this->get_field($fields, $field_id)) {
1054 1054
 					$setting_field = $field;
1055 1055
 					break;
1056 1056
 				}
@@ -1070,17 +1070,17 @@  discard block
 block discarded – undo
1070 1070
 	 *
1071 1071
 	 * @return array
1072 1072
 	 */
1073
-	function get_setting_field( $field_id, $group_id = '' ) {
1073
+	function get_setting_field($field_id, $group_id = '') {
1074 1074
 		$setting_field = array();
1075 1075
 
1076 1076
 		$_field_id = $field_id;
1077
-		$field_id  = empty( $group_id ) ? $field_id : $group_id;
1077
+		$field_id  = empty($group_id) ? $field_id : $group_id;
1078 1078
 
1079
-		if ( ! empty( $this->settings ) ) {
1080
-			foreach ( $this->settings as $setting ) {
1079
+		if ( ! empty($this->settings)) {
1080
+			foreach ($this->settings as $setting) {
1081 1081
 				if (
1082
-					( $this->has_sub_tab( $setting ) && ( $setting_field = $this->get_sub_field( $setting, $field_id ) ) )
1083
-					|| ( $setting_field = $this->get_field( $setting, $field_id ) )
1082
+					($this->has_sub_tab($setting) && ($setting_field = $this->get_sub_field($setting, $field_id)))
1083
+					|| ($setting_field = $this->get_field($setting, $field_id))
1084 1084
 				) {
1085 1085
 					break;
1086 1086
 				}
@@ -1088,9 +1088,9 @@  discard block
 block discarded – undo
1088 1088
 		}
1089 1089
 
1090 1090
 		// Get field from group.
1091
-		if ( ! empty( $group_id ) ) {
1092
-			foreach ( $setting_field['fields'] as $field ) {
1093
-				if ( array_key_exists( 'id', $field ) && $field['id'] === $_field_id ) {
1091
+		if ( ! empty($group_id)) {
1092
+			foreach ($setting_field['fields'] as $field) {
1093
+				if (array_key_exists('id', $field) && $field['id'] === $_field_id) {
1094 1094
 					$setting_field = $field;
1095 1095
 				}
1096 1096
 			}
@@ -1109,14 +1109,14 @@  discard block
 block discarded – undo
1109 1109
 	 *
1110 1110
 	 * @return mixed
1111 1111
 	 */
1112
-	function add_offline_donations_setting_tab( $settings ) {
1113
-		if ( give_is_gateway_active( 'offline' ) ) {
1114
-			$settings['offline_donations_options'] = apply_filters( 'give_forms_offline_donations_options', array(
1112
+	function add_offline_donations_setting_tab($settings) {
1113
+		if (give_is_gateway_active('offline')) {
1114
+			$settings['offline_donations_options'] = apply_filters('give_forms_offline_donations_options', array(
1115 1115
 				'id'        => 'offline_donations_options',
1116
-				'title'     => __( 'Offline Donations', 'give' ),
1116
+				'title'     => __('Offline Donations', 'give'),
1117 1117
 				'icon-html' => '<span class="give-icon give-icon-purse"></span>',
1118
-				'fields'    => apply_filters( 'give_forms_offline_donations_metabox_fields', array() ),
1119
-			) );
1118
+				'fields'    => apply_filters('give_forms_offline_donations_metabox_fields', array()),
1119
+			));
1120 1120
 		}
1121 1121
 
1122 1122
 		return $settings;
@@ -1134,37 +1134,33 @@  discard block
 block discarded – undo
1134 1134
 	 *
1135 1135
 	 * @return mixed
1136 1136
 	 */
1137
-	function sanitize_form_meta( $meta_value, $setting_field ) {
1138
-		switch ( $setting_field['type'] ) {
1137
+	function sanitize_form_meta($meta_value, $setting_field) {
1138
+		switch ($setting_field['type']) {
1139 1139
 			case 'group':
1140
-				if ( ! empty( $setting_field['fields'] ) ) {
1141
-					foreach ( $setting_field['fields'] as $field ) {
1142
-						if ( empty( $field['data_type'] ) || 'price' !== $field['data_type'] ) {
1140
+				if ( ! empty($setting_field['fields'])) {
1141
+					foreach ($setting_field['fields'] as $field) {
1142
+						if (empty($field['data_type']) || 'price' !== $field['data_type']) {
1143 1143
 							continue;
1144 1144
 						}
1145 1145
 
1146
-						foreach ( $meta_value as $index => $meta_data ) {
1147
-							if ( ! isset( $meta_value[ $index ][ $field['id'] ] ) ) {
1146
+						foreach ($meta_value as $index => $meta_data) {
1147
+							if ( ! isset($meta_value[$index][$field['id']])) {
1148 1148
 								continue;
1149 1149
 							}
1150 1150
 
1151
-							$meta_value[ $index ][ $field['id'] ] = ! empty( $meta_value[ $index ][ $field['id'] ] ) ?
1152
-								give_sanitize_amount_for_db( $meta_value[ $index ][ $field['id'] ] ) :
1153
-								( ( '_give_amount' === $field['id'] && empty( $field_value ) ) ?
1154
-									give_sanitize_amount_for_db( '1.00' ) :
1155
-									0 );
1151
+							$meta_value[$index][$field['id']] = ! empty($meta_value[$index][$field['id']]) ?
1152
+								give_sanitize_amount_for_db($meta_value[$index][$field['id']]) : (('_give_amount' === $field['id'] && empty($field_value)) ?
1153
+									give_sanitize_amount_for_db('1.00') : 0);
1156 1154
 						}
1157 1155
 					}
1158 1156
 				}
1159 1157
 				break;
1160 1158
 
1161 1159
 			default:
1162
-				if ( ! empty( $setting_field['data_type'] ) && 'price' === $setting_field['data_type'] ) {
1160
+				if ( ! empty($setting_field['data_type']) && 'price' === $setting_field['data_type']) {
1163 1161
 					$meta_value = $meta_value ?
1164
-						give_sanitize_amount_for_db( $meta_value ) :
1165
-						( in_array( $setting_field['id'], array( '_give_set_price', '_give_custom_amount_minimum', '_give_set_goal' ) ) ?
1166
-							give_sanitize_amount_for_db( '1.00' ) :
1167
-							0 );
1162
+						give_sanitize_amount_for_db($meta_value) : (in_array($setting_field['id'], array('_give_set_price', '_give_custom_amount_minimum', '_give_set_goal')) ?
1163
+							give_sanitize_amount_for_db('1.00') : 0);
1168 1164
 				}
1169 1165
 		}
1170 1166
 
@@ -1182,12 +1178,12 @@  discard block
 block discarded – undo
1182 1178
 	 *
1183 1179
 	 * @return string The URL after redirect.
1184 1180
 	 */
1185
-	public function maintain_active_tab( $location, $post_id ) {
1181
+	public function maintain_active_tab($location, $post_id) {
1186 1182
 		if (
1187
-			'give_forms' === get_post_type( $post_id ) &&
1188
-			! empty( $_POST['give_form_active_tab'] )
1183
+			'give_forms' === get_post_type($post_id) &&
1184
+			! empty($_POST['give_form_active_tab'])
1189 1185
 		) {
1190
-			$location = add_query_arg( 'give_tab', give_clean( $_POST['give_form_active_tab'] ), $location );
1186
+			$location = add_query_arg('give_tab', give_clean($_POST['give_form_active_tab']), $location);
1191 1187
 		}
1192 1188
 
1193 1189
 		return $location;
Please login to merge, or discard this patch.
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -663,9 +663,12 @@  discard block
 block discarded – undo
663 663
 							<a href="#<?php echo $form_data_tab['id']; ?>" data-tab-id="<?php echo $form_data_tab['id']; ?>">
664 664
 								<?php if ( ! empty( $form_data_tab['icon-html'] ) ) : ?>
665 665
 									<?php echo $form_data_tab['icon-html']; ?>
666
-								<?php else : ?>
666
+								<?php else {
667
+	: ?>
667 668
 									<span class="give-icon give-icon-default"></span>
668
-								<?php endif; ?>
669
+								<?php endif;
670
+}
671
+?>
669 672
 								<span class="give-label"><?php echo $form_data_tab['label']; ?></span>
670 673
 							</a>
671 674
 							<?php if ( $this->has_sub_tab( $form_data_tab ) ) : ?>
@@ -675,9 +678,12 @@  discard block
 block discarded – undo
675 678
 											<a href="#<?php echo $sub_tab['id']; ?>" data-tab-id="<?php echo $sub_tab['id']; ?>">
676 679
 												<?php if ( ! empty( $sub_tab['icon-html'] ) ) : ?>
677 680
 													<?php echo $sub_tab['icon-html']; ?>
678
-												<?php else : ?>
681
+												<?php else {
682
+	: ?>
679 683
 													<span class="give-icon give-icon-default"></span>
680
-												<?php endif; ?>
684
+												<?php endif;
685
+}
686
+?>
681 687
 												<span class="give-label"><?php echo $sub_tab['label']; ?></span>
682 688
 											</a>
683 689
 										</li>
Please login to merge, or discard this patch.
includes/admin/payments/view-payment-details.php 1 patch
Spacing   +143 added lines, -143 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  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
 
17
-if ( ! current_user_can( 'view_give_payments' ) ) {
17
+if ( ! current_user_can('view_give_payments')) {
18 18
 	wp_die(
19
-		__( 'Sorry, you are not allowed to access this page.', 'give' ), __( 'Error', 'give' ), array(
19
+		__('Sorry, you are not allowed to access this page.', 'give'), __('Error', 'give'), array(
20 20
 			'response' => 403,
21 21
 		)
22 22
 	);
@@ -28,27 +28,27 @@  discard block
 block discarded – undo
28 28
  * @since 1.0
29 29
  * @return void
30 30
  */
31
-if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) {
32
-	wp_die( __( 'Donation ID not supplied. Please try again.', 'give' ), __( 'Error', 'give' ), array( 'response' => 400 ) );
31
+if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) {
32
+	wp_die(__('Donation ID not supplied. Please try again.', 'give'), __('Error', 'give'), array('response' => 400));
33 33
 }
34 34
 
35 35
 // Setup the variables
36
-$payment_id = absint( $_GET['id'] );
37
-$payment    = new Give_Payment( $payment_id );
36
+$payment_id = absint($_GET['id']);
37
+$payment    = new Give_Payment($payment_id);
38 38
 
39 39
 // Sanity check... fail if donation ID is invalid
40 40
 $payment_exists = $payment->ID;
41
-if ( empty( $payment_exists ) ) {
42
-	wp_die( __( 'The specified ID does not belong to a donation. Please try again.', 'give' ), __( 'Error', 'give' ), array( 'response' => 400 ) );
41
+if (empty($payment_exists)) {
42
+	wp_die(__('The specified ID does not belong to a donation. Please try again.', 'give'), __('Error', 'give'), array('response' => 400));
43 43
 }
44 44
 
45 45
 $number         = $payment->number;
46 46
 $payment_meta   = $payment->get_meta();
47
-$transaction_id = esc_attr( $payment->transaction_id );
47
+$transaction_id = esc_attr($payment->transaction_id);
48 48
 $user_id        = $payment->user_id;
49 49
 $donor_id       = $payment->customer_id;
50
-$payment_date   = strtotime( $payment->date );
51
-$user_info      = give_get_payment_meta_user_info( $payment_id );
50
+$payment_date   = strtotime($payment->date);
51
+$user_info      = give_get_payment_meta_user_info($payment_id);
52 52
 $address        = $payment->address;
53 53
 $currency_code  = $payment->currency;
54 54
 $gateway        = $payment->gateway;
@@ -61,13 +61,13 @@  discard block
 block discarded – undo
61 61
 	<?php
62 62
 		printf(
63 63
 			/* translators: %s: donation number */
64
-			esc_html__( 'Donation %s', 'give' ),
64
+			esc_html__('Donation %s', 'give'),
65 65
 			$number
66 66
 		);
67
-		if ( $payment_mode == 'test' ) {
67
+		if ($payment_mode == 'test') {
68 68
 			echo Give()->tooltips->render_span(array(
69
-				'label' => __( 'This donation was made in test mode.', 'give' ),
70
-				'tag_content' => __( 'Test Donation', 'give' ),
69
+				'label' => __('This donation was made in test mode.', 'give'),
70
+				'tag_content' => __('Test Donation', 'give'),
71 71
 				'position'=> 'right',
72 72
 				'attributes' => array(
73 73
 					'id' => 'test-payment-label',
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	 *
87 87
 	 * @param int $payment_id Payment id.
88 88
 	 */
89
-	do_action( 'give_view_order_details_before', $payment_id );
89
+	do_action('give_view_order_details_before', $payment_id);
90 90
 	?>
91 91
 
92 92
 	<hr class="wp-header-end">
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 		 *
101 101
 		 * @param int $payment_id Payment id.
102 102
 		 */
103
-		do_action( 'give_view_order_details_form_top', $payment_id );
103
+		do_action('give_view_order_details_form_top', $payment_id);
104 104
 		?>
105 105
 		<div id="poststuff">
106 106
 			<div id="give-dashboard-widgets-wrap">
@@ -116,12 +116,12 @@  discard block
 block discarded – undo
116 116
 							 *
117 117
 							 * @param int $payment_id Payment id.
118 118
 							 */
119
-							do_action( 'give_view_order_details_sidebar_before', $payment_id );
119
+							do_action('give_view_order_details_sidebar_before', $payment_id);
120 120
 							?>
121 121
 
122 122
 							<div id="give-order-update" class="postbox give-order-data">
123 123
 
124
-								<h3 class="hndle"><?php _e( 'Update Donation', 'give' ); ?></h3>
124
+								<h3 class="hndle"><?php _e('Update Donation', 'give'); ?></h3>
125 125
 
126 126
 								<div class="inside">
127 127
 									<div class="give-admin-box">
@@ -134,33 +134,33 @@  discard block
 block discarded – undo
134 134
 										 *
135 135
 										 * @param int $payment_id Payment id.
136 136
 										 */
137
-										do_action( 'give_view_order_details_totals_before', $payment_id );
137
+										do_action('give_view_order_details_totals_before', $payment_id);
138 138
 										?>
139 139
 
140 140
 										<div class="give-admin-box-inside">
141 141
 											<p>
142
-												<label for="give-payment-status" class="strong"><?php _e( 'Status:', 'give' ); ?></label>&nbsp;
142
+												<label for="give-payment-status" class="strong"><?php _e('Status:', 'give'); ?></label>&nbsp;
143 143
 												<select id="give-payment-status" name="give-payment-status" class="medium-text">
144
-													<?php foreach ( give_get_payment_statuses() as $key => $status ) : ?>
145
-														<option value="<?php echo esc_attr( $key ); ?>"<?php selected( $payment->status, $key, true ); ?>><?php echo esc_html( $status ); ?></option>
144
+													<?php foreach (give_get_payment_statuses() as $key => $status) : ?>
145
+														<option value="<?php echo esc_attr($key); ?>"<?php selected($payment->status, $key, true); ?>><?php echo esc_html($status); ?></option>
146 146
 													<?php endforeach; ?>
147 147
 												</select>
148
-												<span class="give-donation-status status-<?php echo sanitize_title( $payment->status ); ?>"><span class="give-donation-status-icon"></span></span>
148
+												<span class="give-donation-status status-<?php echo sanitize_title($payment->status); ?>"><span class="give-donation-status-icon"></span></span>
149 149
 											</p>
150 150
 										</div>
151 151
 
152 152
 										<div class="give-admin-box-inside">
153 153
 											<p>
154
-												<label for="give-payment-date" class="strong"><?php _e( 'Date:', 'give' ); ?></label>&nbsp;
155
-												<input type="text" id="give-payment-date" name="give-payment-date" value="<?php echo esc_attr( date( 'm/d/Y', $payment_date ) ); ?>" class="medium-text give_datepicker"/>
154
+												<label for="give-payment-date" class="strong"><?php _e('Date:', 'give'); ?></label>&nbsp;
155
+												<input type="text" id="give-payment-date" name="give-payment-date" value="<?php echo esc_attr(date('m/d/Y', $payment_date)); ?>" class="medium-text give_datepicker"/>
156 156
 											</p>
157 157
 										</div>
158 158
 
159 159
 										<div class="give-admin-box-inside">
160 160
 											<p>
161
-												<label for="give-payment-time-hour" class="strong"><?php _e( 'Time:', 'give' ); ?></label>&nbsp;
162
-												<input type="number" step="1" max="24" id="give-payment-time-hour" name="give-payment-time-hour" value="<?php echo esc_attr( date_i18n( 'H', $payment_date ) ); ?>" class="small-text give-payment-time-hour"/>&nbsp;:&nbsp;
163
-												<input type="number" step="1" max="59" id="give-payment-time-min" name="give-payment-time-min" value="<?php echo esc_attr( date( 'i', $payment_date ) ); ?>" class="small-text give-payment-time-min"/>
161
+												<label for="give-payment-time-hour" class="strong"><?php _e('Time:', 'give'); ?></label>&nbsp;
162
+												<input type="number" step="1" max="24" id="give-payment-time-hour" name="give-payment-time-hour" value="<?php echo esc_attr(date_i18n('H', $payment_date)); ?>" class="small-text give-payment-time-hour"/>&nbsp;:&nbsp;
163
+												<input type="number" step="1" max="59" id="give-payment-time-min" name="give-payment-time-min" value="<?php echo esc_attr(date('i', $payment_date)); ?>" class="small-text give-payment-time-min"/>
164 164
 											</p>
165 165
 										</div>
166 166
 
@@ -174,14 +174,14 @@  discard block
 block discarded – undo
174 174
 										 *
175 175
 										 * @param int $payment_id Payment id.
176 176
 										 */
177
-										do_action( 'give_view_order_details_update_inner', $payment_id );
177
+										do_action('give_view_order_details_update_inner', $payment_id);
178 178
 										?>
179 179
 
180 180
 										<div class="give-order-payment give-admin-box-inside">
181 181
 											<p>
182
-												<label for="give-payment-total" class="strong"><?php _e( 'Total Donation:', 'give' ); ?></label>&nbsp;
183
-												<?php echo give_currency_symbol( $payment->currency ); ?>
184
-												&nbsp;<input id="give-payment-total" name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr( give_format_decimal( give_donation_amount( $payment_id ), false, false ) ); ?>"/>
182
+												<label for="give-payment-total" class="strong"><?php _e('Total Donation:', 'give'); ?></label>&nbsp;
183
+												<?php echo give_currency_symbol($payment->currency); ?>
184
+												&nbsp;<input id="give-payment-total" name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr(give_format_decimal(give_donation_amount($payment_id), false, false)); ?>"/>
185 185
 											</p>
186 186
 										</div>
187 187
 
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 										 *
194 194
 										 * @param int $payment_id Payment id.
195 195
 										 */
196
-										do_action( 'give_view_order_details_totals_after', $payment_id );
196
+										do_action('give_view_order_details_totals_after', $payment_id);
197 197
 										?>
198 198
 
199 199
 									</div>
@@ -211,14 +211,14 @@  discard block
 block discarded – undo
211 211
 									 *
212 212
 									 * @param int $payment_id Payment id.
213 213
 									 */
214
-									do_action( 'give_view_order_details_update_before', $payment_id );
214
+									do_action('give_view_order_details_update_before', $payment_id);
215 215
 									?>
216 216
 
217 217
 									<div id="major-publishing-actions">
218 218
 										<div id="publishing-action">
219
-											<input type="submit" class="button button-primary right" value="<?php esc_attr_e( 'Save Donation', 'give' ); ?>"/>
219
+											<input type="submit" class="button button-primary right" value="<?php esc_attr_e('Save Donation', 'give'); ?>"/>
220 220
 											<?php
221
-											if ( give_is_payment_complete( $payment_id ) ) {
221
+											if (give_is_payment_complete($payment_id)) {
222 222
 												echo sprintf(
223 223
 													'<a href="%1$s" id="give-resend-receipt" class="button-secondary right">%2$s</a>',
224 224
 													esc_url(
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 															)
230 230
 														)
231 231
 													),
232
-													__( 'Resend Receipt', 'give' )
232
+													__('Resend Receipt', 'give')
233 233
 												);
234 234
 											}
235 235
 											?>
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 									 *
246 246
 									 * @param int $payment_id Payment id.
247 247
 									 */
248
-									do_action( 'give_view_order_details_update_after', $payment_id );
248
+									do_action('give_view_order_details_update_after', $payment_id);
249 249
 									?>
250 250
 
251 251
 								</div>
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 
257 257
 							<div id="give-order-details" class="postbox give-order-data">
258 258
 
259
-								<h3 class="hndle"><?php _e( 'Donation Meta', 'give' ); ?></h3>
259
+								<h3 class="hndle"><?php _e('Donation Meta', 'give'); ?></h3>
260 260
 
261 261
 								<div class="inside">
262 262
 									<div class="give-admin-box">
@@ -269,45 +269,45 @@  discard block
 block discarded – undo
269 269
 										 *
270 270
 										 * @param int $payment_id Payment id.
271 271
 										 */
272
-										do_action( 'give_view_order_details_payment_meta_before', $payment_id );
272
+										do_action('give_view_order_details_payment_meta_before', $payment_id);
273 273
 
274
-										$gateway = give_get_payment_gateway( $payment_id );
275
-										if ( $gateway ) :
274
+										$gateway = give_get_payment_gateway($payment_id);
275
+										if ($gateway) :
276 276
 										?>
277 277
 											<div class="give-order-gateway give-admin-box-inside">
278 278
 												<p>
279
-													<strong><?php _e( 'Gateway:', 'give' ); ?></strong>&nbsp;
280
-													<?php echo give_get_gateway_admin_label( $gateway ); ?>
279
+													<strong><?php _e('Gateway:', 'give'); ?></strong>&nbsp;
280
+													<?php echo give_get_gateway_admin_label($gateway); ?>
281 281
 												</p>
282 282
 											</div>
283 283
 										<?php endif; ?>
284 284
 
285 285
 										<div class="give-order-payment-key give-admin-box-inside">
286 286
 											<p>
287
-												<strong><?php _e( 'Key:', 'give' ); ?></strong>&nbsp;
288
-												<?php echo give_get_payment_key( $payment_id ); ?>
287
+												<strong><?php _e('Key:', 'give'); ?></strong>&nbsp;
288
+												<?php echo give_get_payment_key($payment_id); ?>
289 289
 											</p>
290 290
 										</div>
291 291
 
292 292
 										<div class="give-order-ip give-admin-box-inside">
293 293
 											<p>
294
-												<strong><?php _e( 'IP:', 'give' ); ?></strong>&nbsp;
295
-												<?php echo esc_html( give_get_payment_user_ip( $payment_id ) ); ?>
294
+												<strong><?php _e('IP:', 'give'); ?></strong>&nbsp;
295
+												<?php echo esc_html(give_get_payment_user_ip($payment_id)); ?>
296 296
 											</p>
297 297
 										</div>
298 298
 
299
-										<?php if ( $transaction_id ) : ?>
299
+										<?php if ($transaction_id) : ?>
300 300
 											<div class="give-order-tx-id give-admin-box-inside">
301 301
 												<p>
302
-													<strong><?php _e( 'Donation ID:', 'give' ); ?></strong>&nbsp;
303
-													<?php echo apply_filters( "give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id ); ?>
302
+													<strong><?php _e('Donation ID:', 'give'); ?></strong>&nbsp;
303
+													<?php echo apply_filters("give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id); ?>
304 304
 												</p>
305 305
 											</div>
306 306
 										<?php endif; ?>
307 307
 
308 308
 										<div class="give-admin-box-inside">
309
-											<p><?php $purchase_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&donor=' . absint( give_get_payment_donor_id( $payment_id ) ) ); ?>
310
-												<a href="<?php echo $purchase_url; ?>"><?php _e( 'View all donations for this donor &raquo;', 'give' ); ?></a>
309
+											<p><?php $purchase_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&donor='.absint(give_get_payment_donor_id($payment_id))); ?>
310
+												<a href="<?php echo $purchase_url; ?>"><?php _e('View all donations for this donor &raquo;', 'give'); ?></a>
311 311
 											</p>
312 312
 										</div>
313 313
 
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 										 *
320 320
 										 * @param int $payment_id Payment id.
321 321
 										 */
322
-										do_action( 'give_view_order_details_payment_meta_after', $payment_id );
322
+										do_action('give_view_order_details_payment_meta_after', $payment_id);
323 323
 										?>
324 324
 
325 325
 									</div>
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
 							 *
340 340
 							 * @param int $payment_id Payment id.
341 341
 							 */
342
-							do_action( 'give_view_order_details_sidebar_after', $payment_id );
342
+							do_action('give_view_order_details_sidebar_after', $payment_id);
343 343
 							?>
344 344
 
345 345
 						</div>
@@ -359,31 +359,31 @@  discard block
 block discarded – undo
359 359
 							 *
360 360
 							 * @param int $payment_id Payment id.
361 361
 							 */
362
-							do_action( 'give_view_order_details_main_before', $payment_id );
362
+							do_action('give_view_order_details_main_before', $payment_id);
363 363
 							?>
364 364
 
365 365
 							<?php $column_count = 'columns-3'; ?>
366 366
 							<div id="give-donation-overview" class="postbox <?php echo $column_count; ?>">
367
-								<h3 class="hndle"><?php _e( 'Donation Information', 'give' ); ?></h3>
367
+								<h3 class="hndle"><?php _e('Donation Information', 'give'); ?></h3>
368 368
 
369 369
 								<div class="inside">
370 370
 
371 371
 									<div class="column-container">
372 372
 										<div class="column">
373 373
 											<p>
374
-												<strong><?php _e( 'Donation Form ID:', 'give' ); ?></strong><br>
374
+												<strong><?php _e('Donation Form ID:', 'give'); ?></strong><br>
375 375
 												<?php
376
-												if ( $payment_meta['form_id'] ) :
376
+												if ($payment_meta['form_id']) :
377 377
 													printf(
378 378
 														'<a href="%1$s">#%2$s</a>',
379
-														admin_url( 'post.php?action=edit&post=' . $payment_meta['form_id'] ),
379
+														admin_url('post.php?action=edit&post='.$payment_meta['form_id']),
380 380
 														$payment_meta['form_id']
381 381
 													);
382 382
 												endif;
383 383
 												?>
384 384
 											</p>
385 385
 											<p>
386
-												<strong><?php esc_html_e( 'Donation Form Title:', 'give' ); ?></strong><br>
386
+												<strong><?php esc_html_e('Donation Form Title:', 'give'); ?></strong><br>
387 387
 												<?php
388 388
 												echo Give()->html->forms_dropdown(
389 389
 													array(
@@ -399,21 +399,21 @@  discard block
 block discarded – undo
399 399
 										</div>
400 400
 										<div class="column">
401 401
 											<p>
402
-												<strong><?php _e( 'Donation Date:', 'give' ); ?></strong><br>
403
-												<?php echo date_i18n( give_date_format(), $payment_date ); ?>
402
+												<strong><?php _e('Donation Date:', 'give'); ?></strong><br>
403
+												<?php echo date_i18n(give_date_format(), $payment_date); ?>
404 404
 											</p>
405 405
 											<p>
406
-												<strong><?php _e( 'Donation Level:', 'give' ); ?></strong><br>
406
+												<strong><?php _e('Donation Level:', 'give'); ?></strong><br>
407 407
 												<span class="give-donation-level">
408 408
 													<?php
409
-													$var_prices = give_has_variable_prices( $payment_meta['form_id'] );
410
-													if ( empty( $var_prices ) ) {
411
-														_e( 'n/a', 'give' );
409
+													$var_prices = give_has_variable_prices($payment_meta['form_id']);
410
+													if (empty($var_prices)) {
411
+														_e('n/a', 'give');
412 412
 													} else {
413 413
 														$prices_atts = array();
414
-														if ( $variable_prices = give_get_variable_prices( $payment_meta['form_id'] ) ) {
415
-															foreach ( $variable_prices as $variable_price ) {
416
-																$prices_atts[ $variable_price['_give_id']['level_id'] ] = give_format_amount( $variable_price['_give_amount'], array( 'sanitize' => false ) );
414
+														if ($variable_prices = give_get_variable_prices($payment_meta['form_id'])) {
415
+															foreach ($variable_prices as $variable_price) {
416
+																$prices_atts[$variable_price['_give_id']['level_id']] = give_format_amount($variable_price['_give_amount'], array('sanitize' => false));
417 417
 															}
418 418
 														}
419 419
 														// Variable price dropdown options.
@@ -422,12 +422,12 @@  discard block
 block discarded – undo
422 422
 															'name'             => 'give-variable-price',
423 423
 															'chosen'           => true,
424 424
 															'show_option_all'  => '',
425
-															'show_option_none' => ( '' === get_post_meta( $payment_id, '_give_payment_price_id', true ) ? __( 'None', 'give' ) : '' ),
426
-															'select_atts'      => 'data-prices=' . esc_attr( wp_json_encode( $prices_atts ) ),
425
+															'show_option_none' => ('' === get_post_meta($payment_id, '_give_payment_price_id', true) ? __('None', 'give') : ''),
426
+															'select_atts'      => 'data-prices='.esc_attr(wp_json_encode($prices_atts)),
427 427
 															'selected'         => $payment_meta['price_id'],
428 428
 														);
429 429
 														// Render variable prices select tag html.
430
-														give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true );
430
+														give_get_form_variable_price_dropdown($variable_price_dropdown_option, true);
431 431
 													}
432 432
 													?>
433 433
 												</span>
@@ -435,8 +435,8 @@  discard block
 block discarded – undo
435 435
 										</div>
436 436
 										<div class="column">
437 437
 											<p>
438
-												<strong><?php esc_html_e( 'Total Donation:', 'give' ); ?></strong><br>
439
-												<?php echo give_donation_amount( $payment, true ); ?>
438
+												<strong><?php esc_html_e('Total Donation:', 'give'); ?></strong><br>
439
+												<?php echo give_donation_amount($payment, true); ?>
440 440
 											</p>
441 441
 											<p>
442 442
 												<?php
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
 												 *
450 450
 												 * @param int $payment_id Payment id.
451 451
 												 */
452
-												do_action( 'give_donation_details_thead_before', $payment_id );
452
+												do_action('give_donation_details_thead_before', $payment_id);
453 453
 
454 454
 
455 455
 												/**
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
 												 *
462 462
 												 * @param int $payment_id Payment id.
463 463
 												 */
464
-												do_action( 'give_donation_details_thead_after', $payment_id );
464
+												do_action('give_donation_details_thead_after', $payment_id);
465 465
 
466 466
 												/**
467 467
 												 * Fires in order details page, in the donation-information metabox, before the body elements.
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
 												 *
473 473
 												 * @param int $payment_id Payment id.
474 474
 												 */
475
-												do_action( 'give_donation_details_tbody_before', $payment_id );
475
+												do_action('give_donation_details_tbody_before', $payment_id);
476 476
 
477 477
 												/**
478 478
 												 * Fires in order details page, in the donation-information metabox, after the body elements.
@@ -483,7 +483,7 @@  discard block
 block discarded – undo
483 483
 												 *
484 484
 												 * @param int $payment_id Payment id.
485 485
 												 */
486
-												do_action( 'give_donation_details_tbody_after', $payment_id );
486
+												do_action('give_donation_details_tbody_after', $payment_id);
487 487
 												?>
488 488
 											</p>
489 489
 										</div>
@@ -503,58 +503,58 @@  discard block
 block discarded – undo
503 503
 							 *
504 504
 							 * @param int $payment_id Payment id.
505 505
 							 */
506
-							do_action( 'give_view_order_details_files_after', $payment_id );
506
+							do_action('give_view_order_details_files_after', $payment_id);
507 507
 							?>
508 508
 
509 509
 							<div id="give-donor-details" class="postbox">
510
-								<h3 class="hndle"><?php _e( 'Donor Details', 'give' ); ?></h3>
510
+								<h3 class="hndle"><?php _e('Donor Details', 'give'); ?></h3>
511 511
 
512 512
 								<div class="inside">
513 513
 
514
-									<?php $donor = new Give_Donor( $donor_id ); ?>
514
+									<?php $donor = new Give_Donor($donor_id); ?>
515 515
 
516 516
 									<div class="column-container donor-info">
517 517
 										<div class="column">
518 518
 											<p>
519
-												<strong><?php _e( 'Donor ID:', 'give' ); ?></strong><br>
519
+												<strong><?php _e('Donor ID:', 'give'); ?></strong><br>
520 520
 												<?php
521
-												if ( ! empty( $donor->id ) ) {
521
+												if ( ! empty($donor->id)) {
522 522
 													printf(
523 523
 														'<a href="%1$s">#%2$s</a>',
524
-														admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ),
524
+														admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id),
525 525
 														$donor->id
526 526
 													);
527 527
 												}
528 528
 												?>
529 529
 											</p>
530 530
 											<p>
531
-												<strong><?php _e( 'Donor Since:', 'give' ); ?></strong><br>
532
-												<?php echo date_i18n( give_date_format(), strtotime( $donor->date_created ) ) ?>
531
+												<strong><?php _e('Donor Since:', 'give'); ?></strong><br>
532
+												<?php echo date_i18n(give_date_format(), strtotime($donor->date_created)) ?>
533 533
 											</p>
534 534
 										</div>
535 535
 										<div class="column">
536 536
 											<p>
537
-												<strong><?php _e( 'Donor Name:', 'give' ); ?></strong><br>
537
+												<strong><?php _e('Donor Name:', 'give'); ?></strong><br>
538 538
 												<?php
539
-												$donor_billing_name = give_get_donor_name_by( $payment_id, 'donation' );
540
-												$donor_name         = give_get_donor_name_by( $donor_id, 'donor' );
539
+												$donor_billing_name = give_get_donor_name_by($payment_id, 'donation');
540
+												$donor_name         = give_get_donor_name_by($donor_id, 'donor');
541 541
 
542 542
 												// Check whether the donor name and WP_User name is same or not.
543
-												if ( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ) {
544
-													echo $donor_billing_name . ' (<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id" ) ) . '">' . $donor_name . '</a>)';
543
+												if (sanitize_title($donor_billing_name) != sanitize_title($donor_name)) {
544
+													echo $donor_billing_name.' (<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id")).'">'.$donor_name.'</a>)';
545 545
 												} else {
546 546
 													echo $donor_name;
547 547
 												}
548 548
 												?>
549 549
 											</p>
550 550
 											<p>
551
-												<strong><?php _e( 'Donor Email:', 'give' ); ?></strong><br>
551
+												<strong><?php _e('Donor Email:', 'give'); ?></strong><br>
552 552
 												<?php echo $donor->email; ?>
553 553
 											</p>
554 554
 										</div>
555 555
 										<div class="column">
556 556
 											<p>
557
-												<strong><?php _e( 'Change Donor:', 'give' ); ?></strong><br>
557
+												<strong><?php _e('Change Donor:', 'give'); ?></strong><br>
558 558
 												<?php
559 559
 												echo Give()->html->donor_dropdown(
560 560
 													array(
@@ -565,7 +565,7 @@  discard block
 block discarded – undo
565 565
 												?>
566 566
 											</p>
567 567
 											<p>
568
-												<a href="#new" class="give-payment-new-donor"><?php _e( 'Create New Donor', 'give' ); ?></a>
568
+												<a href="#new" class="give-payment-new-donor"><?php _e('Create New Donor', 'give'); ?></a>
569 569
 											</p>
570 570
 										</div>
571 571
 									</div>
@@ -573,19 +573,19 @@  discard block
 block discarded – undo
573 573
 									<div class="column-container new-donor" style="display: none">
574 574
 										<div class="column">
575 575
 											<p>
576
-												<label for="give-new-donor-first-name"><?php _e( 'New Donor First Name:', 'give' ); ?></label>
576
+												<label for="give-new-donor-first-name"><?php _e('New Donor First Name:', 'give'); ?></label>
577 577
 												<input id="give-new-donor-first-name" type="text" name="give-new-donor-first-name" value="" class="medium-text"/>
578 578
 											</p>
579 579
 										</div>
580 580
 										<div class="column">
581 581
 											<p>
582
-												<label for="give-new-donor-last-name"><?php _e( 'New Donor Last Name:', 'give' ); ?></label>
582
+												<label for="give-new-donor-last-name"><?php _e('New Donor Last Name:', 'give'); ?></label>
583 583
 												<input id="give-new-donor-last-name" type="text" name="give-new-donor-last-name" value="" class="medium-text"/>
584 584
 											</p>
585 585
 										</div>
586 586
 										<div class="column">
587 587
 											<p>
588
-												<label for="give-new-donor-email"><?php _e( 'New Donor Email:', 'give' ); ?></label>
588
+												<label for="give-new-donor-email"><?php _e('New Donor Email:', 'give'); ?></label>
589 589
 												<input id="give-new-donor-email" type="email" name="give-new-donor-email" value="" class="medium-text"/>
590 590
 											</p>
591 591
 										</div>
@@ -593,9 +593,9 @@  discard block
 block discarded – undo
593 593
 											<p>
594 594
 												<input type="hidden" name="give-current-donor" value="<?php echo $donor->id; ?>"/>
595 595
 												<input type="hidden" id="give-new-donor" name="give-new-donor" value="0"/>
596
-												<a href="#cancel" class="give-payment-new-donor-cancel give-delete"><?php _e( 'Cancel', 'give' ); ?></a>
596
+												<a href="#cancel" class="give-payment-new-donor-cancel give-delete"><?php _e('Cancel', 'give'); ?></a>
597 597
 												<br>
598
-												<em><?php _e( 'Click "Save Donation" to create new donor.', 'give' ); ?></em>
598
+												<em><?php _e('Click "Save Donation" to create new donor.', 'give'); ?></em>
599 599
 											</p>
600 600
 										</div>
601 601
 									</div>
@@ -611,7 +611,7 @@  discard block
 block discarded – undo
611 611
 									 * @param array $payment_meta Payment meta.
612 612
 									 * @param array $user_info    User information.
613 613
 									 */
614
-									do_action( 'give_payment_personal_details_list', $payment_meta, $user_info );
614
+									do_action('give_payment_personal_details_list', $payment_meta, $user_info);
615 615
 
616 616
 									/**
617 617
 									 * Fires on the donation details page, in the donor-details metabox.
@@ -620,7 +620,7 @@  discard block
 block discarded – undo
620 620
 									 *
621 621
 									 * @param int $payment_id Payment id.
622 622
 									 */
623
-									do_action( 'give_payment_view_details', $payment_id );
623
+									do_action('give_payment_view_details', $payment_id);
624 624
 									?>
625 625
 
626 626
 								</div>
@@ -636,11 +636,11 @@  discard block
 block discarded – undo
636 636
 							 *
637 637
 							 * @param int $payment_id Payment id.
638 638
 							 */
639
-							do_action( 'give_view_order_details_billing_before', $payment_id );
639
+							do_action('give_view_order_details_billing_before', $payment_id);
640 640
 							?>
641 641
 
642 642
 							<div id="give-billing-details" class="postbox">
643
-								<h3 class="hndle"><?php _e( 'Billing Address', 'give' ); ?></h3>
643
+								<h3 class="hndle"><?php _e('Billing Address', 'give'); ?></h3>
644 644
 
645 645
 								<div class="inside">
646 646
 
@@ -650,9 +650,9 @@  discard block
 block discarded – undo
650 650
 											<div class="data column-container">
651 651
 
652 652
 												<?php
653
-												$address['country'] = ( ! empty( $address['country'] ) ? $address['country'] : give_get_country() );
653
+												$address['country'] = ( ! empty($address['country']) ? $address['country'] : give_get_country());
654 654
 
655
-												$address['state'] = ( ! empty( $address['state'] ) ? $address['state'] : '' );
655
+												$address['state'] = ( ! empty($address['state']) ? $address['state'] : '');
656 656
 
657 657
 												// Get the country list that does not have any states init.
658 658
 												$no_states_country = give_no_states_country_list();
@@ -660,7 +660,7 @@  discard block
 block discarded – undo
660 660
 
661 661
 												<div class="row">
662 662
 													<div id="give-order-address-country-wrap">
663
-														<label class="order-data-address-line"><?php _e( 'Country:', 'give' ); ?></label>
663
+														<label class="order-data-address-line"><?php _e('Country:', 'give'); ?></label>
664 664
 														<?php
665 665
 														echo Give()->html->select(
666 666
 															array(
@@ -670,8 +670,8 @@  discard block
 block discarded – undo
670 670
 																'show_option_all'  => false,
671 671
 																'show_option_none' => false,
672 672
 																'chosen'           => true,
673
-																'placeholder'      => esc_attr__( 'Select a country', 'give' ),
674
-																'data'             => array( 'search-type' => 'no_ajax' ),
673
+																'placeholder'      => esc_attr__('Select a country', 'give'),
674
+																'data'             => array('search-type' => 'no_ajax'),
675 675
 															)
676 676
 														);
677 677
 														?>
@@ -680,35 +680,35 @@  discard block
 block discarded – undo
680 680
 
681 681
 												<div class="row">
682 682
 													<div class="give-wrap-address-line1">
683
-														<label for="give-payment-address-line1" class="order-data-address"><?php _e( 'Address 1:', 'give' ); ?></label>
684
-														<input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr( $address['line1'] ); ?>" class="medium-text"/>
683
+														<label for="give-payment-address-line1" class="order-data-address"><?php _e('Address 1:', 'give'); ?></label>
684
+														<input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr($address['line1']); ?>" class="medium-text"/>
685 685
 													</div>
686 686
 												</div>
687 687
 
688 688
 												<div class="row">
689 689
 													<div class="give-wrap-address-line2">
690
-														<label for="give-payment-address-line2" class="order-data-address-line"><?php _e( 'Address 2:', 'give' ); ?></label>
691
-														<input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr( $address['line2'] ); ?>" class="medium-text"/>
690
+														<label for="give-payment-address-line2" class="order-data-address-line"><?php _e('Address 2:', 'give'); ?></label>
691
+														<input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr($address['line2']); ?>" class="medium-text"/>
692 692
 													</div>
693 693
 												</div>
694 694
 
695 695
 												<div class="row">
696 696
 													<div class="give-wrap-address-city">
697
-														<label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e( 'City:', 'give' ); ?></label>
698
-														<input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr( $address['city'] ); ?>" class="medium-text"/>
697
+														<label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e('City:', 'give'); ?></label>
698
+														<input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr($address['city']); ?>" class="medium-text"/>
699 699
 													</div>
700 700
 												</div>
701 701
 
702 702
 												<?php
703
-												$state_exists = ( ! empty( $address['country'] ) && array_key_exists( $address['country'], $no_states_country ) ? true : false );
703
+												$state_exists = ( ! empty($address['country']) && array_key_exists($address['country'], $no_states_country) ? true : false);
704 704
 												?>
705 705
 												<div class="row">
706
-													<div class="<?php echo( ! empty( $state_exists ) ? 'column-full' : 'column' ); ?> give-column give-column-state">
707
-														<div id="give-order-address-state-wrap" class="<?php echo( ! empty( $state_exists ) ? 'give-hidden' : '' ); ?>">
708
-															<label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e( 'State / Province / County:', 'give' ); ?></label>
706
+													<div class="<?php echo( ! empty($state_exists) ? 'column-full' : 'column'); ?> give-column give-column-state">
707
+														<div id="give-order-address-state-wrap" class="<?php echo( ! empty($state_exists) ? 'give-hidden' : ''); ?>">
708
+															<label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e('State / Province / County:', 'give'); ?></label>
709 709
 															<?php
710
-															$states = give_get_states( $address['country'] );
711
-															if ( ! empty( $states ) ) {
710
+															$states = give_get_states($address['country']);
711
+															if ( ! empty($states)) {
712 712
 																echo Give()->html->select(
713 713
 																	array(
714 714
 																		'options'          => $states,
@@ -717,23 +717,23 @@  discard block
 block discarded – undo
717 717
 																		'show_option_all'  => false,
718 718
 																		'show_option_none' => false,
719 719
 																		'chosen'           => true,
720
-																		'placeholder'      => esc_attr__( 'Select a state', 'give' ),
721
-																		'data'             => array( 'search-type' => 'no_ajax' ),
720
+																		'placeholder'      => esc_attr__('Select a state', 'give'),
721
+																		'data'             => array('search-type' => 'no_ajax'),
722 722
 																	)
723 723
 																);
724 724
 															} else {
725 725
 																?>
726
-																<input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr( $address['state'] ); ?>" class="medium-text"/>
726
+																<input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr($address['state']); ?>" class="medium-text"/>
727 727
 																<?php
728 728
 															}
729 729
 															?>
730 730
 														</div>
731 731
 													</div>
732 732
 
733
-													<div class="<?php echo( ! empty( $state_exists ) ? 'column-full' : 'column' ); ?> give-column give-column-zip">
733
+													<div class="<?php echo( ! empty($state_exists) ? 'column-full' : 'column'); ?> give-column give-column-zip">
734 734
 														<div class="give-wrap-address-zip">
735
-															<label for="give-payment-address-zip" class="order-data-address-line"><?php _e( 'Zip / Postal Code:', 'give' ); ?></label>
736
-															<input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr( $address['zip'] ); ?>" class="medium-text"/>
735
+															<label for="give-payment-address-zip" class="order-data-address-line"><?php _e('Zip / Postal Code:', 'give'); ?></label>
736
+															<input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr($address['zip']); ?>" class="medium-text"/>
737 737
 														</div>
738 738
 													</div>
739 739
 												</div>
@@ -752,7 +752,7 @@  discard block
 block discarded – undo
752 752
 									 *
753 753
 									 * @param int $payment_id Payment id.
754 754
 									 */
755
-									do_action( 'give_payment_billing_details', $payment_id );
755
+									do_action('give_payment_billing_details', $payment_id);
756 756
 									?>
757 757
 
758 758
 								</div>
@@ -768,34 +768,34 @@  discard block
 block discarded – undo
768 768
 							 *
769 769
 							 * @param int $payment_id Payment id.
770 770
 							 */
771
-							do_action( 'give_view_order_details_billing_after', $payment_id );
771
+							do_action('give_view_order_details_billing_after', $payment_id);
772 772
 							?>
773 773
 
774 774
 							<div id="give-payment-notes" class="postbox">
775
-								<h3 class="hndle"><?php _e( 'Donation Notes', 'give' ); ?></h3>
775
+								<h3 class="hndle"><?php _e('Donation Notes', 'give'); ?></h3>
776 776
 
777 777
 								<div class="inside">
778 778
 									<div id="give-payment-notes-inner">
779 779
 										<?php
780
-										$notes = give_get_payment_notes( $payment_id );
781
-										if ( ! empty( $notes ) ) {
780
+										$notes = give_get_payment_notes($payment_id);
781
+										if ( ! empty($notes)) {
782 782
 											$no_notes_display = ' style="display:none;"';
783
-											foreach ( $notes as $note ) :
783
+											foreach ($notes as $note) :
784 784
 
785
-												echo give_get_payment_note_html( $note, $payment_id );
785
+												echo give_get_payment_note_html($note, $payment_id);
786 786
 
787 787
 											endforeach;
788 788
 										} else {
789 789
 											$no_notes_display = '';
790 790
 										}
791 791
 
792
-										echo '<p class="give-no-payment-notes"' . $no_notes_display . '>' . esc_html__( 'No donation notes.', 'give' ) . '</p>';
792
+										echo '<p class="give-no-payment-notes"'.$no_notes_display.'>'.esc_html__('No donation notes.', 'give').'</p>';
793 793
 										?>
794 794
 									</div>
795 795
 									<textarea name="give-payment-note" id="give-payment-note" class="large-text"></textarea>
796 796
 
797 797
 									<div class="give-clearfix">
798
-										<button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint( $payment_id ); ?>"><?php _e( 'Add Note', 'give' ); ?></button>
798
+										<button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint($payment_id); ?>"><?php _e('Add Note', 'give'); ?></button>
799 799
 									</div>
800 800
 
801 801
 								</div>
@@ -811,7 +811,7 @@  discard block
 block discarded – undo
811 811
 							 *
812 812
 							 * @param int $payment_id Payment id.
813 813
 							 */
814
-							do_action( 'give_view_order_details_main_after', $payment_id );
814
+							do_action('give_view_order_details_main_after', $payment_id);
815 815
 							?>
816 816
 
817 817
 						</div>
@@ -833,11 +833,11 @@  discard block
 block discarded – undo
833 833
 		 *
834 834
 		 * @param int $payment_id Payment id.
835 835
 		 */
836
-		do_action( 'give_view_order_details_form_bottom', $payment_id );
836
+		do_action('give_view_order_details_form_bottom', $payment_id);
837 837
 
838
-		wp_nonce_field( 'give_update_payment_details_nonce' );
838
+		wp_nonce_field('give_update_payment_details_nonce');
839 839
 		?>
840
-		<input type="hidden" name="give_payment_id" value="<?php echo esc_attr( $payment_id ); ?>"/>
840
+		<input type="hidden" name="give_payment_id" value="<?php echo esc_attr($payment_id); ?>"/>
841 841
 		<input type="hidden" name="give_action" value="update_payment_details"/>
842 842
 	</form>
843 843
 	<?php
@@ -848,6 +848,6 @@  discard block
 block discarded – undo
848 848
 	 *
849 849
 	 * @param int $payment_id Payment id.
850 850
 	 */
851
-	do_action( 'give_view_order_details_after', $payment_id );
851
+	do_action('give_view_order_details_after', $payment_id);
852 852
 	?>
853 853
 </div><!-- /.wrap -->
Please login to merge, or discard this patch.
includes/admin/payments/actions.php 1 patch
Spacing   +124 added lines, -124 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,48 +25,48 @@  discard block
 block discarded – undo
25 25
  *
26 26
  * @return      void
27 27
  */
28
-function give_update_payment_details( $data ) {
28
+function give_update_payment_details($data) {
29 29
 
30
-	if ( ! current_user_can( 'edit_give_payments', $data['give_payment_id'] ) ) {
31
-		wp_die( __( 'You do not have permission to edit payments.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
30
+	if ( ! current_user_can('edit_give_payments', $data['give_payment_id'])) {
31
+		wp_die(__('You do not have permission to edit payments.', 'give'), __('Error', 'give'), array('response' => 403));
32 32
 	}
33 33
 
34
-	check_admin_referer( 'give_update_payment_details_nonce' );
34
+	check_admin_referer('give_update_payment_details_nonce');
35 35
 
36 36
 	// Retrieve the payment ID.
37
-	$payment_id = absint( $data['give_payment_id'] );
37
+	$payment_id = absint($data['give_payment_id']);
38 38
 
39 39
 	/* @var Give_Payment $payment */
40
-	$payment = new Give_Payment( $payment_id );
40
+	$payment = new Give_Payment($payment_id);
41 41
 
42 42
 	$status = $data['give-payment-status'];
43
-	$date   = sanitize_text_field( $data['give-payment-date'] );
44
-	$hour   = sanitize_text_field( $data['give-payment-time-hour'] );
43
+	$date   = sanitize_text_field($data['give-payment-date']);
44
+	$hour   = sanitize_text_field($data['give-payment-time-hour']);
45 45
 
46 46
 	// Restrict to our high and low.
47
-	if ( $hour > 23 ) {
47
+	if ($hour > 23) {
48 48
 		$hour = 23;
49
-	} elseif ( $hour < 0 ) {
49
+	} elseif ($hour < 0) {
50 50
 		$hour = 00;
51 51
 	}
52 52
 
53
-	$minute = sanitize_text_field( $data['give-payment-time-min'] );
53
+	$minute = sanitize_text_field($data['give-payment-time-min']);
54 54
 
55 55
 	// Restrict to our high and low.
56
-	if ( $minute > 59 ) {
56
+	if ($minute > 59) {
57 57
 		$minute = 59;
58
-	} elseif ( $minute < 0 ) {
58
+	} elseif ($minute < 0) {
59 59
 		$minute = 00;
60 60
 	}
61 61
 
62
-	$address = give_clean( $data['give-payment-address'][0] );
62
+	$address = give_clean($data['give-payment-address'][0]);
63 63
 
64 64
 	$curr_total = $payment->total;
65
-	$new_total  = give_maybe_sanitize_amount( ( ! empty( $data['give-payment-total'] ) ? $data['give-payment-total'] : 0 ) );
66
-	$date       = date( 'Y-m-d', strtotime( $date ) ) . ' ' . $hour . ':' . $minute . ':00';
65
+	$new_total  = give_maybe_sanitize_amount(( ! empty($data['give-payment-total']) ? $data['give-payment-total'] : 0));
66
+	$date       = date('Y-m-d', strtotime($date)).' '.$hour.':'.$minute.':00';
67 67
 
68
-	$curr_donor_id = sanitize_text_field( $data['give-current-donor'] );
69
-	$new_donor_id  = sanitize_text_field( $data['donor-id'] );
68
+	$curr_donor_id = sanitize_text_field($data['give-current-donor']);
69
+	$new_donor_id  = sanitize_text_field($data['donor-id']);
70 70
 
71 71
 	/**
72 72
 	 * Fires before updating edited donation.
@@ -76,71 +76,71 @@  discard block
 block discarded – undo
76 76
 	 *
77 77
 	 * @param int $payment_id The ID of the payment.
78 78
 	 */
79
-	do_action( 'give_update_edited_donation', $payment_id );
79
+	do_action('give_update_edited_donation', $payment_id);
80 80
 
81 81
 	$payment->date = $date;
82 82
 	$updated       = $payment->save();
83 83
 
84
-	if ( 0 === $updated ) {
85
-		wp_die( __( 'Error Updating Donation.', 'give' ), __( 'Error', 'give' ), array( 'response' => 400 ) );
84
+	if (0 === $updated) {
85
+		wp_die(__('Error Updating Donation.', 'give'), __('Error', 'give'), array('response' => 400));
86 86
 	}
87 87
 
88 88
 	$donor_changed = false;
89 89
 
90
-	if ( isset( $data['give-new-donor'] ) && $data['give-new-donor'] == '1' ) {
90
+	if (isset($data['give-new-donor']) && $data['give-new-donor'] == '1') {
91 91
 
92
-		$email      = ! empty( $data['give-new-donor-email'] ) ? sanitize_text_field( $data['give-new-donor-email'] ) : '';
93
-		$first_name = ! empty( $data['give-new-donor-first-name'] ) ? sanitize_text_field( $data['give-new-donor-first-name'] ) : '';
94
-		$last_name  = ! empty( $data['give-new-donor-last-name'] ) ? sanitize_text_field( $data['give-new-donor-last-name'] ) : '';
95
-		$names      = strip_tags( wp_unslash( trim( "{$first_name} {$last_name}" ) ) );
92
+		$email      = ! empty($data['give-new-donor-email']) ? sanitize_text_field($data['give-new-donor-email']) : '';
93
+		$first_name = ! empty($data['give-new-donor-first-name']) ? sanitize_text_field($data['give-new-donor-first-name']) : '';
94
+		$last_name  = ! empty($data['give-new-donor-last-name']) ? sanitize_text_field($data['give-new-donor-last-name']) : '';
95
+		$names      = strip_tags(wp_unslash(trim("{$first_name} {$last_name}")));
96 96
 
97
-		if ( empty( $email ) || empty( $first_name ) ) {
98
-			wp_die( __( 'New Donor requires first name and email address.', 'give' ), __( 'Error', 'give' ), array( 'response' => 400 ) );
97
+		if (empty($email) || empty($first_name)) {
98
+			wp_die(__('New Donor requires first name and email address.', 'give'), __('Error', 'give'), array('response' => 400));
99 99
 		}
100 100
 
101
-		$donor = new Give_Donor( $email );
102
-		if ( empty( $donor->id ) ) {
103
-			$donor_data = array( 'name' => $names, 'email' => $email );
104
-			$user_id       = email_exists( $email );
105
-			if ( false !== $user_id ) {
101
+		$donor = new Give_Donor($email);
102
+		if (empty($donor->id)) {
103
+			$donor_data = array('name' => $names, 'email' => $email);
104
+			$user_id = email_exists($email);
105
+			if (false !== $user_id) {
106 106
 				$donor_data['user_id'] = $user_id;
107 107
 			}
108 108
 
109
-			if ( ! $donor->create( $donor_data ) ) {
109
+			if ( ! $donor->create($donor_data)) {
110 110
 				// Failed to create the new donor, assume the previous donor.
111 111
 				$donor_changed = false;
112
-				$donor         = new Give_Donor( $curr_donor_id );
113
-				give_set_error( 'give-payment-new-donor-fail', __( 'Error creating new donor.', 'give' ) );
112
+				$donor         = new Give_Donor($curr_donor_id);
113
+				give_set_error('give-payment-new-donor-fail', __('Error creating new donor.', 'give'));
114 114
 			}
115 115
 		}
116 116
 
117 117
 		// Create and Update Donor First Name and Last Name in Meta Fields.
118
-		$donor->update_meta( '_give_donor_first_name', $first_name );
119
-		$donor->update_meta( '_give_donor_last_name', $last_name );
118
+		$donor->update_meta('_give_donor_first_name', $first_name);
119
+		$donor->update_meta('_give_donor_last_name', $last_name);
120 120
 
121 121
 		$new_donor_id = $donor->id;
122 122
 
123
-		$previous_donor = new Give_Donor( $curr_donor_id );
123
+		$previous_donor = new Give_Donor($curr_donor_id);
124 124
 
125 125
 		$donor_changed = true;
126 126
 
127
-	} elseif ( $curr_donor_id !== $new_donor_id ) {
127
+	} elseif ($curr_donor_id !== $new_donor_id) {
128 128
 
129
-		$donor = new Give_Donor( $new_donor_id );
129
+		$donor = new Give_Donor($new_donor_id);
130 130
 		$email    = $donor->email;
131 131
 		$names    = $donor->name;
132 132
 
133
-		$previous_donor = new Give_Donor( $curr_donor_id );
133
+		$previous_donor = new Give_Donor($curr_donor_id);
134 134
 
135 135
 		$donor_changed = true;
136 136
 
137 137
 	} else {
138
-		$donor = new Give_Donor( $curr_donor_id );
138
+		$donor = new Give_Donor($curr_donor_id);
139 139
 		$email    = $donor->email;
140 140
 		$names    = $donor->name;
141 141
 	}
142 142
 
143
-	if ( $donor_changed ) {
143
+	if ($donor_changed) {
144 144
 
145 145
 		// Setup first and last name from input values.
146 146
 		$first_name = $donor->get_first_name();
@@ -150,26 +150,26 @@  discard block
 block discarded – undo
150 150
 		$payment->last_name  = $last_name;
151 151
 
152 152
 		// Remove the stats and payment from the previous donor and attach it to the new donor.
153
-		$previous_donor->remove_payment( $payment_id, false );
154
-		$donor->attach_payment( $payment_id, false );
153
+		$previous_donor->remove_payment($payment_id, false);
154
+		$donor->attach_payment($payment_id, false);
155 155
 
156
-		if ( 'publish' == $status ) {
156
+		if ('publish' == $status) {
157 157
 
158 158
 			// Reduce previous user donation count and amount.
159 159
 			$previous_donor->decrease_donation_count();
160
-			$previous_donor->decrease_value( $curr_total );
160
+			$previous_donor->decrease_value($curr_total);
161 161
 
162 162
 			// If donation was completed adjust stats of new donors.
163 163
 			$donor->increase_purchase_count();
164
-			$donor->increase_value( $new_total );
164
+			$donor->increase_value($new_total);
165 165
 		}
166 166
 
167 167
 		$payment->customer_id = $donor->id;
168 168
 	} else {
169 169
 
170
-		if ( 'publish' === $status ) {
170
+		if ('publish' === $status) {
171 171
 			// Update user donation stat.
172
-			$donor->update_donation_value( $curr_total, $new_total );
172
+			$donor->update_donation_value($curr_total, $new_total);
173 173
 		}
174 174
 	}
175 175
 
@@ -180,10 +180,10 @@  discard block
 block discarded – undo
180 180
 	$payment->total      = $new_total;
181 181
 
182 182
 	// Check for payment notes.
183
-	if ( ! empty( $data['give-payment-note'] ) ) {
183
+	if ( ! empty($data['give-payment-note'])) {
184 184
 
185
-		$note = wp_kses( $data['give-payment-note'], array() );
186
-		give_insert_payment_note( $payment_id, $note );
185
+		$note = wp_kses($data['give-payment-note'], array());
186
+		give_insert_payment_note($payment_id, $note);
187 187
 
188 188
 	}
189 189
 
@@ -191,17 +191,17 @@  discard block
 block discarded – undo
191 191
 	$payment->status = $status;
192 192
 
193 193
 	// Adjust total store earnings if the payment total has been changed.
194
-	if ( $new_total !== $curr_total && 'publish' == $status ) {
194
+	if ($new_total !== $curr_total && 'publish' == $status) {
195 195
 
196
-		if ( $new_total > $curr_total ) {
196
+		if ($new_total > $curr_total) {
197 197
 			// Increase if our new total is higher.
198 198
 			$difference = $new_total - $curr_total;
199
-			give_increase_total_earnings( $difference );
199
+			give_increase_total_earnings($difference);
200 200
 
201
-		} elseif ( $curr_total > $new_total ) {
201
+		} elseif ($curr_total > $new_total) {
202 202
 			// Decrease if our new total is lower.
203 203
 			$difference = $curr_total - $new_total;
204
-			give_decrease_total_earnings( $difference );
204
+			give_decrease_total_earnings($difference);
205 205
 
206 206
 		}
207 207
 	}
@@ -209,55 +209,55 @@  discard block
 block discarded – undo
209 209
 	$payment->save();
210 210
 
211 211
 	// Get new give form ID.
212
-	$new_form_id     = absint( $data['give-payment-form-select'] );
213
-	$current_form_id = absint( $payment->get_meta( '_give_payment_form_id' ) );
212
+	$new_form_id     = absint($data['give-payment-form-select']);
213
+	$current_form_id = absint($payment->get_meta('_give_payment_form_id'));
214 214
 
215 215
 	// We are adding payment transfer code in last to remove any conflict with above functionality.
216 216
 	// For example: above code will automatically handle form stat (increase/decrease) when payment status changes.
217 217
 	// Check if user want to transfer current payment to new give form id.
218
-	if ( $new_form_id && $new_form_id != $current_form_id ) {
218
+	if ($new_form_id && $new_form_id != $current_form_id) {
219 219
 
220 220
 		// Get new give form title.
221
-		$new_form_title = get_the_title( $new_form_id );
221
+		$new_form_title = get_the_title($new_form_id);
222 222
 
223 223
 		// Update payment give form meta data.
224
-		$payment->update_meta( '_give_payment_form_id', $new_form_id );
225
-		$payment->update_meta( '_give_payment_form_title', $new_form_title );
224
+		$payment->update_meta('_give_payment_form_id', $new_form_id);
225
+		$payment->update_meta('_give_payment_form_title', $new_form_title);
226 226
 
227 227
 		// Update price id payment metadata.
228
-		if ( ! give_has_variable_prices( $new_form_id ) ) {
229
-			$payment->update_meta( '_give_payment_price_id', '' );
228
+		if ( ! give_has_variable_prices($new_form_id)) {
229
+			$payment->update_meta('_give_payment_price_id', '');
230 230
 		}
231 231
 
232 232
 		// If donation was completed, adjust stats of forms.
233
-		if ( 'publish' == $status ) {
233
+		if ('publish' == $status) {
234 234
 
235 235
 			// Decrease sale of old give form. For other payment status.
236
-			$current_form = new Give_Donate_Form( $current_form_id );
236
+			$current_form = new Give_Donate_Form($current_form_id);
237 237
 			$current_form->decrease_sales();
238
-			$current_form->decrease_earnings( $curr_total );
238
+			$current_form->decrease_earnings($curr_total);
239 239
 
240 240
 			// Increase sale of new give form.
241
-			$new_form = new Give_Donate_Form( $new_form_id );
241
+			$new_form = new Give_Donate_Form($new_form_id);
242 242
 			$new_form->increase_sales();
243
-			$new_form->increase_earnings( $new_total );
243
+			$new_form->increase_earnings($new_total);
244 244
 		}
245 245
 
246 246
 		// Re setup payment to update new meta value in object.
247
-		$payment->update_payment_setup( $payment->ID );
247
+		$payment->update_payment_setup($payment->ID);
248 248
 
249 249
 		// Update form id in payment logs.
250
-		Give()->async_process->data( array(
251
-			'data' => array( $new_form_id, $payment_id ),
250
+		Give()->async_process->data(array(
251
+			'data' => array($new_form_id, $payment_id),
252 252
 			'hook' => 'give_update_log_form_id',
253
-		) )->dispatch();
253
+		))->dispatch();
254 254
 	}
255 255
 
256 256
 	// Update price id if current form is variable form.
257 257
 	/* @var Give_Donate_Form $form */
258
-	$form = new Give_Donate_Form( $payment->form_id );
258
+	$form = new Give_Donate_Form($payment->form_id);
259 259
 
260
-	if ( isset( $data['give-variable-price'] ) && $form->has_variable_prices() ) {
260
+	if (isset($data['give-variable-price']) && $form->has_variable_prices()) {
261 261
 
262 262
 		// Get payment meta data.
263 263
 		$payment_meta = $payment->get_meta();
@@ -266,9 +266,9 @@  discard block
 block discarded – undo
266 266
 		$price_id = '';
267 267
 
268 268
 		// Get price info
269
-		if( 0 <= $data['give-variable-price'] ) {
270
-			foreach ( $form->prices as $variable_price ) {
271
-				if( $new_total === give_maybe_sanitize_amount( $variable_price['_give_amount'] ) ) {
269
+		if (0 <= $data['give-variable-price']) {
270
+			foreach ($form->prices as $variable_price) {
271
+				if ($new_total === give_maybe_sanitize_amount($variable_price['_give_amount'])) {
272 272
 					$price_info = $variable_price;
273 273
 					break;
274 274
 				}
@@ -276,15 +276,15 @@  discard block
 block discarded – undo
276 276
 		}
277 277
 
278 278
 		// Set price id.
279
-		if( ! empty( $price_info ) ) {
279
+		if ( ! empty($price_info)) {
280 280
 			$price_id = $data['give-variable-price'];
281 281
 
282
-			if( $data['give-variable-price'] !== $price_info['_give_id']['level_id'] ) {
282
+			if ($data['give-variable-price'] !== $price_info['_give_id']['level_id']) {
283 283
 				// Set price id to amount match.
284 284
 				$price_id = $price_info['_give_id']['level_id'];
285 285
 			}
286 286
 
287
-		} elseif( $form->is_custom_price_mode() ){
287
+		} elseif ($form->is_custom_price_mode()) {
288 288
 			$price_id = 'custom';
289 289
 		}
290 290
 
@@ -292,11 +292,11 @@  discard block
 block discarded – undo
292 292
 		$payment_meta['price_id'] = $price_id;
293 293
 
294 294
 		// Update payment give form meta data.
295
-		$payment->update_meta( '_give_payment_price_id', $price_id );
296
-		$payment->update_meta( '_give_payment_meta', $payment_meta );
295
+		$payment->update_meta('_give_payment_price_id', $price_id);
296
+		$payment->update_meta('_give_payment_meta', $payment_meta);
297 297
 
298 298
 		// Re setup payment to update new meta value in object.
299
-		$payment->update_payment_setup( $payment->ID );
299
+		$payment->update_payment_setup($payment->ID);
300 300
 	}
301 301
 
302 302
 	/**
@@ -307,13 +307,13 @@  discard block
 block discarded – undo
307 307
 	 *
308 308
 	 * @param int $payment_id The ID of the payment.
309 309
 	 */
310
-	do_action( 'give_updated_edited_donation', $payment_id );
310
+	do_action('give_updated_edited_donation', $payment_id);
311 311
 
312
-	wp_safe_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-message=payment-updated&id=' . $payment_id ) );
312
+	wp_safe_redirect(admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-message=payment-updated&id='.$payment_id));
313 313
 	exit;
314 314
 }
315 315
 
316
-add_action( 'give_update_payment_details', 'give_update_payment_details' );
316
+add_action('give_update_payment_details', 'give_update_payment_details');
317 317
 
318 318
 /**
319 319
  * Trigger a Donation Deletion.
@@ -324,48 +324,48 @@  discard block
 block discarded – undo
324 324
  *
325 325
  * @return void
326 326
  */
327
-function give_trigger_donation_delete( $data ) {
328
-	if ( wp_verify_nonce( $data['_wpnonce'], 'give_donation_nonce' ) ) {
327
+function give_trigger_donation_delete($data) {
328
+	if (wp_verify_nonce($data['_wpnonce'], 'give_donation_nonce')) {
329 329
 
330
-		$payment_id = absint( $data['purchase_id'] );
330
+		$payment_id = absint($data['purchase_id']);
331 331
 
332
-		if ( ! current_user_can( 'edit_give_payments', $payment_id ) ) {
333
-			wp_die( __( 'You do not have permission to edit payments.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
332
+		if ( ! current_user_can('edit_give_payments', $payment_id)) {
333
+			wp_die(__('You do not have permission to edit payments.', 'give'), __('Error', 'give'), array('response' => 403));
334 334
 		}
335 335
 
336
-		give_delete_donation( $payment_id );
337
-		wp_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&give-message=donation_deleted' ) );
336
+		give_delete_donation($payment_id);
337
+		wp_redirect(admin_url('edit.php?post_type=give_forms&page=give-payment-history&give-message=donation_deleted'));
338 338
 		give_die();
339 339
 	}
340 340
 }
341 341
 
342
-add_action( 'give_delete_payment', 'give_trigger_donation_delete' );
342
+add_action('give_delete_payment', 'give_trigger_donation_delete');
343 343
 
344 344
 /**
345 345
  * AJAX Store Donation Note
346 346
  */
347 347
 function give_ajax_store_payment_note() {
348 348
 
349
-	$payment_id = absint( $_POST['payment_id'] );
350
-	$note       = wp_kses( $_POST['note'], array() );
349
+	$payment_id = absint($_POST['payment_id']);
350
+	$note       = wp_kses($_POST['note'], array());
351 351
 
352
-	if ( ! current_user_can( 'edit_give_payments', $payment_id ) ) {
353
-		wp_die( __( 'You do not have permission to edit payments.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
352
+	if ( ! current_user_can('edit_give_payments', $payment_id)) {
353
+		wp_die(__('You do not have permission to edit payments.', 'give'), __('Error', 'give'), array('response' => 403));
354 354
 	}
355 355
 
356
-	if ( empty( $payment_id ) ) {
357
-		die( '-1' );
356
+	if (empty($payment_id)) {
357
+		die('-1');
358 358
 	}
359 359
 
360
-	if ( empty( $note ) ) {
361
-		die( '-1' );
360
+	if (empty($note)) {
361
+		die('-1');
362 362
 	}
363 363
 
364
-	$note_id = give_insert_payment_note( $payment_id, $note );
365
-	die( give_get_payment_note_html( $note_id ) );
364
+	$note_id = give_insert_payment_note($payment_id, $note);
365
+	die(give_get_payment_note_html($note_id));
366 366
 }
367 367
 
368
-add_action( 'wp_ajax_give_insert_payment_note', 'give_ajax_store_payment_note' );
368
+add_action('wp_ajax_give_insert_payment_note', 'give_ajax_store_payment_note');
369 369
 
370 370
 /**
371 371
  * Triggers a donation note deletion without ajax
@@ -376,24 +376,24 @@  discard block
 block discarded – undo
376 376
  *
377 377
  * @return void
378 378
  */
379
-function give_trigger_payment_note_deletion( $data ) {
379
+function give_trigger_payment_note_deletion($data) {
380 380
 
381
-	if ( ! wp_verify_nonce( $data['_wpnonce'], 'give_delete_payment_note_' . $data['note_id'] ) ) {
381
+	if ( ! wp_verify_nonce($data['_wpnonce'], 'give_delete_payment_note_'.$data['note_id'])) {
382 382
 		return;
383 383
 	}
384 384
 
385
-	if ( ! current_user_can( 'edit_give_payments', $data['payment_id'] ) ) {
386
-		wp_die( __( 'You do not have permission to edit payments.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
385
+	if ( ! current_user_can('edit_give_payments', $data['payment_id'])) {
386
+		wp_die(__('You do not have permission to edit payments.', 'give'), __('Error', 'give'), array('response' => 403));
387 387
 	}
388 388
 
389
-	$edit_order_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-message=donation-note-deleted&id=' . absint( $data['payment_id'] ) );
389
+	$edit_order_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-message=donation-note-deleted&id='.absint($data['payment_id']));
390 390
 
391
-	give_delete_payment_note( $data['note_id'], $data['payment_id'] );
391
+	give_delete_payment_note($data['note_id'], $data['payment_id']);
392 392
 
393
-	wp_redirect( $edit_order_url );
393
+	wp_redirect($edit_order_url);
394 394
 }
395 395
 
396
-add_action( 'give_delete_payment_note', 'give_trigger_payment_note_deletion' );
396
+add_action('give_delete_payment_note', 'give_trigger_payment_note_deletion');
397 397
 
398 398
 /**
399 399
  * Delete a payment note deletion with ajax
@@ -404,16 +404,16 @@  discard block
 block discarded – undo
404 404
  */
405 405
 function give_ajax_delete_payment_note() {
406 406
 
407
-	if ( ! current_user_can( 'edit_give_payments', $_POST['payment_id'] ) ) {
408
-		wp_die( __( 'You do not have permission to edit payments.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
407
+	if ( ! current_user_can('edit_give_payments', $_POST['payment_id'])) {
408
+		wp_die(__('You do not have permission to edit payments.', 'give'), __('Error', 'give'), array('response' => 403));
409 409
 	}
410 410
 
411
-	if ( give_delete_payment_note( $_POST['note_id'], $_POST['payment_id'] ) ) {
412
-		die( '1' );
411
+	if (give_delete_payment_note($_POST['note_id'], $_POST['payment_id'])) {
412
+		die('1');
413 413
 	} else {
414
-		die( '-1' );
414
+		die('-1');
415 415
 	}
416 416
 
417 417
 }
418 418
 
419
-add_action( 'wp_ajax_give_delete_payment_note', 'give_ajax_delete_payment_note' );
419
+add_action('wp_ajax_give_delete_payment_note', 'give_ajax_delete_payment_note');
Please login to merge, or discard this patch.
includes/admin/upgrades/upgrade-functions.php 1 patch
Spacing   +357 added lines, -357 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
  */
14 14
 
15 15
 // Exit if accessed directly.
16
-if ( ! defined( 'ABSPATH' ) ) {
16
+if ( ! defined('ABSPATH')) {
17 17
 	exit;
18 18
 }
19 19
 
@@ -25,67 +25,67 @@  discard block
 block discarded – undo
25 25
  */
26 26
 function give_do_automatic_upgrades() {
27 27
 	$did_upgrade  = false;
28
-	$give_version = preg_replace( '/[^0-9.].*/', '', get_option( 'give_version' ) );
28
+	$give_version = preg_replace('/[^0-9.].*/', '', get_option('give_version'));
29 29
 
30
-	if ( ! $give_version ) {
30
+	if ( ! $give_version) {
31 31
 		// 1.0 is the first version to use this option so we must add it.
32 32
 		$give_version = '1.0';
33 33
 	}
34 34
 
35
-	switch ( true ) {
35
+	switch (true) {
36 36
 
37
-		case version_compare( $give_version, '1.6', '<' ) :
37
+		case version_compare($give_version, '1.6', '<') :
38 38
 			give_v16_upgrades();
39 39
 			$did_upgrade = true;
40 40
 
41
-		case version_compare( $give_version, '1.7', '<' ) :
41
+		case version_compare($give_version, '1.7', '<') :
42 42
 			give_v17_upgrades();
43 43
 			$did_upgrade = true;
44 44
 
45
-		case version_compare( $give_version, '1.8', '<' ) :
45
+		case version_compare($give_version, '1.8', '<') :
46 46
 			give_v18_upgrades();
47 47
 			$did_upgrade = true;
48 48
 
49
-		case version_compare( $give_version, '1.8.7', '<' ) :
49
+		case version_compare($give_version, '1.8.7', '<') :
50 50
 			give_v187_upgrades();
51 51
 			$did_upgrade = true;
52 52
 
53
-		case version_compare( $give_version, '1.8.8', '<' ) :
53
+		case version_compare($give_version, '1.8.8', '<') :
54 54
 			give_v188_upgrades();
55 55
 			$did_upgrade = true;
56 56
 
57
-		case version_compare( $give_version, '1.8.9', '<' ) :
57
+		case version_compare($give_version, '1.8.9', '<') :
58 58
 			give_v189_upgrades();
59 59
 			$did_upgrade = true;
60 60
 
61
-		case version_compare( $give_version, '1.8.12', '<' ) :
61
+		case version_compare($give_version, '1.8.12', '<') :
62 62
 			give_v1812_upgrades();
63 63
 			$did_upgrade = true;
64 64
 
65
-		case version_compare( $give_version, '1.8.13', '<' ) :
65
+		case version_compare($give_version, '1.8.13', '<') :
66 66
 			give_v1813_upgrades();
67 67
 			$did_upgrade = true;
68 68
 
69
-		case version_compare( $give_version, '1.8.17', '<' ) :
69
+		case version_compare($give_version, '1.8.17', '<') :
70 70
 			give_v1817_upgrades();
71 71
 			$did_upgrade = true;
72 72
 
73
-		case version_compare( $give_version, '1.8.18', '<' ) :
73
+		case version_compare($give_version, '1.8.18', '<') :
74 74
 			give_v1818_upgrades();
75 75
 			$did_upgrade = true;
76 76
 
77
-		case version_compare( $give_version, '2.0', '<' ) :
77
+		case version_compare($give_version, '2.0', '<') :
78 78
 			give_v20_upgrades();
79 79
 			$did_upgrade = true;
80 80
 	}
81 81
 
82
-	if ( $did_upgrade ) {
83
-		update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
82
+	if ($did_upgrade) {
83
+		update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
84 84
 	}
85 85
 }
86 86
 
87
-add_action( 'admin_init', 'give_do_automatic_upgrades' );
88
-add_action( 'give_upgrades', 'give_do_automatic_upgrades' );
87
+add_action('admin_init', 'give_do_automatic_upgrades');
88
+add_action('give_upgrades', 'give_do_automatic_upgrades');
89 89
 
90 90
 /**
91 91
  * Display Upgrade Notices.
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
  *
100 100
  * @return void
101 101
  */
102
-function give_show_upgrade_notices( $give_updates ) {
102
+function give_show_upgrade_notices($give_updates) {
103 103
 	// v1.3.2 Upgrades
104 104
 	$give_updates->register(
105 105
 		array(
@@ -165,32 +165,32 @@  discard block
 block discarded – undo
165 165
 	);
166 166
 
167 167
 	// v1.8.17 Upgrades for donations.
168
-	$give_updates->register( array(
168
+	$give_updates->register(array(
169 169
 		'id'       => 'v1817_update_donation_iranian_currency_code',
170 170
 		'version'  => '1.8.17',
171 171
 		'callback' => 'give_v1817_update_donation_iranian_currency_code',
172
-	) );
172
+	));
173 173
 
174 174
 	// v1.8.17 Upgrades for cleanup of user roles.
175
-	$give_updates->register( array(
175
+	$give_updates->register(array(
176 176
 		'id'       => 'v1817_cleanup_user_roles',
177 177
 		'version'  => '1.8.17',
178 178
 		'callback' => 'give_v1817_cleanup_user_roles',
179
-	) );
179
+	));
180 180
 
181 181
 	// v1.8.18 Upgrades for assigning custom amount to existing set donations.
182
-	$give_updates->register( array(
182
+	$give_updates->register(array(
183 183
 		'id'       => 'v1818_assign_custom_amount_set_donation',
184 184
 		'version'  => '1.8.18',
185 185
 		'callback' => 'give_v1818_assign_custom_amount_set_donation',
186
-	) );
186
+	));
187 187
 
188 188
 	// v1.8.18 Cleanup the Give Worker Role Caps.
189
-	$give_updates->register( array(
189
+	$give_updates->register(array(
190 190
 		'id'       => 'v1818_give_worker_role_cleanup',
191 191
 		'version'  => '1.8.18',
192 192
 		'callback' => 'give_v1818_give_worker_role_cleanup',
193
-	) );
193
+	));
194 194
 
195 195
 	// v2.0.0 Upgrades
196 196
 	$give_updates->register(
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 			'id'       => 'v20_move_metadata_into_new_table',
245 245
 			'version'  => '2.0.0',
246 246
 			'callback' => 'give_v20_move_metadata_into_new_table_callback',
247
-			'depend'   => array( 'v20_upgrades_payment_metadata', 'v20_upgrades_form_metadata' ),
247
+			'depend'   => array('v20_upgrades_payment_metadata', 'v20_upgrades_form_metadata'),
248 248
 		)
249 249
 	);
250 250
 
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 	);
267 267
 }
268 268
 
269
-add_action( 'give_register_updates', 'give_show_upgrade_notices' );
269
+add_action('give_register_updates', 'give_show_upgrade_notices');
270 270
 
271 271
 /**
272 272
  * Triggers all upgrade functions
@@ -278,29 +278,29 @@  discard block
 block discarded – undo
278 278
  */
279 279
 function give_trigger_upgrades() {
280 280
 
281
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
282
-		wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array(
281
+	if ( ! current_user_can('manage_give_settings')) {
282
+		wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array(
283 283
 			'response' => 403,
284
-		) );
284
+		));
285 285
 	}
286 286
 
287
-	$give_version = get_option( 'give_version' );
287
+	$give_version = get_option('give_version');
288 288
 
289
-	if ( ! $give_version ) {
289
+	if ( ! $give_version) {
290 290
 		// 1.0 is the first version to use this option so we must add it.
291 291
 		$give_version = '1.0';
292
-		add_option( 'give_version', $give_version );
292
+		add_option('give_version', $give_version);
293 293
 	}
294 294
 
295
-	update_option( 'give_version', GIVE_VERSION );
296
-	delete_option( 'give_doing_upgrade' );
295
+	update_option('give_version', GIVE_VERSION);
296
+	delete_option('give_doing_upgrade');
297 297
 
298
-	if ( DOING_AJAX ) {
299
-		die( 'complete' );
298
+	if (DOING_AJAX) {
299
+		die('complete');
300 300
 	} // End if().
301 301
 }
302 302
 
303
-add_action( 'wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades' );
303
+add_action('wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades');
304 304
 
305 305
 
306 306
 /**
@@ -316,20 +316,20 @@  discard block
 block discarded – undo
316 316
 	/* @var Give_Updates $give_updates */
317 317
 	$give_updates = Give_Updates::get_instance();
318 318
 
319
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
320
-		wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array(
319
+	if ( ! current_user_can('manage_give_settings')) {
320
+		wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array(
321 321
 			'response' => 403,
322
-		) );
322
+		));
323 323
 	}
324 324
 
325 325
 	give_ignore_user_abort();
326 326
 
327 327
 	// UPDATE DB METAKEYS.
328 328
 	$sql   = "UPDATE $wpdb->postmeta SET meta_key = '_give_payment_customer_id' WHERE meta_key = '_give_payment_donor_id'";
329
-	$query = $wpdb->query( $sql );
329
+	$query = $wpdb->query($sql);
330 330
 
331 331
 	$give_updates->percentage = 100;
332
-	give_set_upgrade_complete( 'upgrade_give_payment_customer_id' );
332
+	give_set_upgrade_complete('upgrade_give_payment_customer_id');
333 333
 }
334 334
 
335 335
 
@@ -353,24 +353,24 @@  discard block
 block discarded – undo
353 353
 	$where  .= "AND ( p.post_status = 'abandoned' )";
354 354
 	$where  .= "AND ( m.meta_key = '_give_payment_gateway' AND m.meta_value = 'offline' )";
355 355
 
356
-	$sql            = $select . $join . $where;
357
-	$found_payments = $wpdb->get_col( $sql );
356
+	$sql            = $select.$join.$where;
357
+	$found_payments = $wpdb->get_col($sql);
358 358
 
359
-	foreach ( $found_payments as $payment ) {
359
+	foreach ($found_payments as $payment) {
360 360
 
361 361
 		// Only change ones marked abandoned since our release last week because the admin may have marked some abandoned themselves.
362
-		$modified_time = get_post_modified_time( 'U', false, $payment );
362
+		$modified_time = get_post_modified_time('U', false, $payment);
363 363
 
364 364
 		// 1450124863 =  12/10/2015 20:42:25.
365
-		if ( $modified_time >= 1450124863 ) {
365
+		if ($modified_time >= 1450124863) {
366 366
 
367
-			give_update_payment_status( $payment, 'pending' );
367
+			give_update_payment_status($payment, 'pending');
368 368
 
369 369
 		}
370 370
 	}
371 371
 
372 372
 	$give_updates->percentage = 100;
373
-	give_set_upgrade_complete( 'upgrade_give_offline_status' );
373
+	give_set_upgrade_complete('upgrade_give_offline_status');
374 374
 }
375 375
 
376 376
 
@@ -383,17 +383,17 @@  discard block
 block discarded – undo
383 383
  */
384 384
 function give_v152_cleanup_users() {
385 385
 
386
-	$give_version = get_option( 'give_version' );
386
+	$give_version = get_option('give_version');
387 387
 
388
-	if ( ! $give_version ) {
388
+	if ( ! $give_version) {
389 389
 		// 1.0 is the first version to use this option so we must add it.
390 390
 		$give_version = '1.0';
391 391
 	}
392 392
 
393
-	$give_version = preg_replace( '/[^0-9.].*/', '', $give_version );
393
+	$give_version = preg_replace('/[^0-9.].*/', '', $give_version);
394 394
 
395 395
 	// v1.5.2 Upgrades
396
-	if ( version_compare( $give_version, '1.5.2', '<' ) || ! give_has_upgrade_completed( 'upgrade_give_user_caps_cleanup' ) ) {
396
+	if (version_compare($give_version, '1.5.2', '<') || ! give_has_upgrade_completed('upgrade_give_user_caps_cleanup')) {
397 397
 
398 398
 		// Delete all caps with "ss".
399 399
 		// Also delete all unused "campaign" roles.
@@ -440,9 +440,9 @@  discard block
 block discarded – undo
440 440
 		);
441 441
 
442 442
 		global $wp_roles;
443
-		foreach ( $delete_caps as $cap ) {
444
-			foreach ( array_keys( $wp_roles->roles ) as $role ) {
445
-				$wp_roles->remove_cap( $role, $cap );
443
+		foreach ($delete_caps as $cap) {
444
+			foreach (array_keys($wp_roles->roles) as $role) {
445
+				$wp_roles->remove_cap($role, $cap);
446 446
 			}
447 447
 		}
448 448
 
@@ -452,15 +452,15 @@  discard block
 block discarded – undo
452 452
 		$roles->add_caps();
453 453
 
454 454
 		// The Update Ran.
455
-		update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
456
-		give_set_upgrade_complete( 'upgrade_give_user_caps_cleanup' );
457
-		delete_option( 'give_doing_upgrade' );
455
+		update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
456
+		give_set_upgrade_complete('upgrade_give_user_caps_cleanup');
457
+		delete_option('give_doing_upgrade');
458 458
 
459 459
 	}// End if().
460 460
 
461 461
 }
462 462
 
463
-add_action( 'admin_init', 'give_v152_cleanup_users' );
463
+add_action('admin_init', 'give_v152_cleanup_users');
464 464
 
465 465
 /**
466 466
  * 1.6 Upgrade routine to create the customer meta table.
@@ -503,53 +503,53 @@  discard block
 block discarded – undo
503 503
 
504 504
 	// Get addons license key.
505 505
 	$addons = array();
506
-	foreach ( $give_options as $key => $value ) {
507
-		if ( false !== strpos( $key, '_license_key' ) ) {
508
-			$addons[ $key ] = $value;
506
+	foreach ($give_options as $key => $value) {
507
+		if (false !== strpos($key, '_license_key')) {
508
+			$addons[$key] = $value;
509 509
 		}
510 510
 	}
511 511
 
512 512
 	// Bailout: We do not have any addon license data to upgrade.
513
-	if ( empty( $addons ) ) {
513
+	if (empty($addons)) {
514 514
 		return false;
515 515
 	}
516 516
 
517
-	foreach ( $addons as $key => $addon_license ) {
517
+	foreach ($addons as $key => $addon_license) {
518 518
 
519 519
 		// Get addon shortname.
520
-		$shortname = str_replace( '_license_key', '', $key );
520
+		$shortname = str_replace('_license_key', '', $key);
521 521
 
522 522
 		// Addon license option name.
523
-		$addon_license_option_name = $shortname . '_license_active';
523
+		$addon_license_option_name = $shortname.'_license_active';
524 524
 
525 525
 		// bailout if license is empty.
526
-		if ( empty( $addon_license ) ) {
527
-			delete_option( $addon_license_option_name );
526
+		if (empty($addon_license)) {
527
+			delete_option($addon_license_option_name);
528 528
 			continue;
529 529
 		}
530 530
 
531 531
 		// Get addon name.
532 532
 		$addon_name       = array();
533
-		$addon_name_parts = explode( '_', str_replace( 'give_', '', $shortname ) );
534
-		foreach ( $addon_name_parts as $name_part ) {
533
+		$addon_name_parts = explode('_', str_replace('give_', '', $shortname));
534
+		foreach ($addon_name_parts as $name_part) {
535 535
 
536 536
 			// Fix addon name
537
-			switch ( $name_part ) {
537
+			switch ($name_part) {
538 538
 				case 'authorizenet' :
539 539
 					$name_part = 'authorize.net';
540 540
 					break;
541 541
 			}
542 542
 
543
-			$addon_name[] = ucfirst( $name_part );
543
+			$addon_name[] = ucfirst($name_part);
544 544
 		}
545 545
 
546
-		$addon_name = implode( ' ', $addon_name );
546
+		$addon_name = implode(' ', $addon_name);
547 547
 
548 548
 		// Data to send to the API.
549 549
 		$api_params = array(
550 550
 			'edd_action' => 'activate_license', // never change from "edd_" to "give_"!
551 551
 			'license'    => $addon_license,
552
-			'item_name'  => urlencode( $addon_name ),
552
+			'item_name'  => urlencode($addon_name),
553 553
 			'url'        => home_url(),
554 554
 		);
555 555
 
@@ -564,17 +564,17 @@  discard block
 block discarded – undo
564 564
 		);
565 565
 
566 566
 		// Make sure there are no errors.
567
-		if ( is_wp_error( $response ) ) {
568
-			delete_option( $addon_license_option_name );
567
+		if (is_wp_error($response)) {
568
+			delete_option($addon_license_option_name);
569 569
 			continue;
570 570
 		}
571 571
 
572 572
 		// Tell WordPress to look for updates.
573
-		set_site_transient( 'update_plugins', null );
573
+		set_site_transient('update_plugins', null);
574 574
 
575 575
 		// Decode license data.
576
-		$license_data = json_decode( wp_remote_retrieve_body( $response ) );
577
-		update_option( $addon_license_option_name, $license_data );
576
+		$license_data = json_decode(wp_remote_retrieve_body($response));
577
+		update_option($addon_license_option_name, $license_data);
578 578
 	}// End foreach().
579 579
 }
580 580
 
@@ -604,9 +604,9 @@  discard block
 block discarded – undo
604 604
 	);
605 605
 
606 606
 	global $wp_roles;
607
-	foreach ( $delete_caps as $cap ) {
608
-		foreach ( array_keys( $wp_roles->roles ) as $role ) {
609
-			$wp_roles->remove_cap( $role, $cap );
607
+	foreach ($delete_caps as $cap) {
608
+		foreach (array_keys($wp_roles->roles) as $role) {
609
+			$wp_roles->remove_cap($role, $cap);
610 610
 		}
611 611
 	}
612 612
 
@@ -640,7 +640,7 @@  discard block
 block discarded – undo
640 640
 function give_v18_upgrades_core_setting() {
641 641
 	// Core settings which changes from checkbox to radio.
642 642
 	$core_setting_names = array_merge(
643
-		array_keys( give_v18_renamed_core_settings() ),
643
+		array_keys(give_v18_renamed_core_settings()),
644 644
 		array(
645 645
 			'uninstall_on_delete',
646 646
 			'scripts_footer',
@@ -652,48 +652,48 @@  discard block
 block discarded – undo
652 652
 	);
653 653
 
654 654
 	// Bailout: If not any setting define.
655
-	if ( $give_settings = get_option( 'give_settings' ) ) {
655
+	if ($give_settings = get_option('give_settings')) {
656 656
 
657 657
 		$setting_changed = false;
658 658
 
659 659
 		// Loop: check each setting field.
660
-		foreach ( $core_setting_names as $setting_name ) {
660
+		foreach ($core_setting_names as $setting_name) {
661 661
 			// New setting name.
662
-			$new_setting_name = preg_replace( '/^(enable_|disable_)/', '', $setting_name );
662
+			$new_setting_name = preg_replace('/^(enable_|disable_)/', '', $setting_name);
663 663
 
664 664
 			// Continue: If setting already set.
665 665
 			if (
666
-				array_key_exists( $new_setting_name, $give_settings )
667
-				&& in_array( $give_settings[ $new_setting_name ], array( 'enabled', 'disabled' ) )
666
+				array_key_exists($new_setting_name, $give_settings)
667
+				&& in_array($give_settings[$new_setting_name], array('enabled', 'disabled'))
668 668
 			) {
669 669
 				continue;
670 670
 			}
671 671
 
672 672
 			// Set checkbox value to radio value.
673
-			$give_settings[ $setting_name ] = ( ! empty( $give_settings[ $setting_name ] ) && 'on' === $give_settings[ $setting_name ] ? 'enabled' : 'disabled' );
673
+			$give_settings[$setting_name] = ( ! empty($give_settings[$setting_name]) && 'on' === $give_settings[$setting_name] ? 'enabled' : 'disabled');
674 674
 
675 675
 			// @see https://github.com/WordImpress/Give/issues/1063.
676
-			if ( false !== strpos( $setting_name, 'disable_' ) ) {
676
+			if (false !== strpos($setting_name, 'disable_')) {
677 677
 
678
-				$give_settings[ $new_setting_name ] = ( give_is_setting_enabled( $give_settings[ $setting_name ] ) ? 'disabled' : 'enabled' );
679
-			} elseif ( false !== strpos( $setting_name, 'enable_' ) ) {
678
+				$give_settings[$new_setting_name] = (give_is_setting_enabled($give_settings[$setting_name]) ? 'disabled' : 'enabled');
679
+			} elseif (false !== strpos($setting_name, 'enable_')) {
680 680
 
681
-				$give_settings[ $new_setting_name ] = ( give_is_setting_enabled( $give_settings[ $setting_name ] ) ? 'enabled' : 'disabled' );
681
+				$give_settings[$new_setting_name] = (give_is_setting_enabled($give_settings[$setting_name]) ? 'enabled' : 'disabled');
682 682
 			}
683 683
 
684 684
 			// Tell bot to update core setting to db.
685
-			if ( ! $setting_changed ) {
685
+			if ( ! $setting_changed) {
686 686
 				$setting_changed = true;
687 687
 			}
688 688
 		}
689 689
 
690 690
 		// Update setting only if they changed.
691
-		if ( $setting_changed ) {
692
-			update_option( 'give_settings', $give_settings );
691
+		if ($setting_changed) {
692
+			update_option('give_settings', $give_settings);
693 693
 		}
694 694
 	}// End if().
695 695
 
696
-	give_set_upgrade_complete( 'v18_upgrades_core_setting' );
696
+	give_set_upgrade_complete('v18_upgrades_core_setting');
697 697
 }
698 698
 
699 699
 /**
@@ -707,7 +707,7 @@  discard block
 block discarded – undo
707 707
 	$give_updates = Give_Updates::get_instance();
708 708
 
709 709
 	// form query
710
-	$forms = new WP_Query( array(
710
+	$forms = new WP_Query(array(
711 711
 			'paged'          => $give_updates->step,
712 712
 			'status'         => 'any',
713 713
 			'order'          => 'ASC',
@@ -716,41 +716,41 @@  discard block
 block discarded – undo
716 716
 		)
717 717
 	);
718 718
 
719
-	if ( $forms->have_posts() ) {
720
-		$give_updates->set_percentage( $forms->found_posts, ( $give_updates->step * 20 ) );
719
+	if ($forms->have_posts()) {
720
+		$give_updates->set_percentage($forms->found_posts, ($give_updates->step * 20));
721 721
 
722
-		while ( $forms->have_posts() ) {
722
+		while ($forms->have_posts()) {
723 723
 			$forms->the_post();
724 724
 
725 725
 			// Form content.
726 726
 			// Note in version 1.8 display content setting split into display content and content placement setting.
727 727
 			// You can delete _give_content_option in future.
728
-			$show_content = give_get_meta( get_the_ID(), '_give_content_option', true );
729
-			if ( $show_content && ! give_get_meta( get_the_ID(), '_give_display_content', true ) ) {
730
-				$field_value = ( 'none' !== $show_content ? 'enabled' : 'disabled' );
731
-				give_update_meta( get_the_ID(), '_give_display_content', $field_value );
728
+			$show_content = give_get_meta(get_the_ID(), '_give_content_option', true);
729
+			if ($show_content && ! give_get_meta(get_the_ID(), '_give_display_content', true)) {
730
+				$field_value = ('none' !== $show_content ? 'enabled' : 'disabled');
731
+				give_update_meta(get_the_ID(), '_give_display_content', $field_value);
732 732
 
733
-				$field_value = ( 'none' !== $show_content ? $show_content : 'give_pre_form' );
734
-				give_update_meta( get_the_ID(), '_give_content_placement', $field_value );
733
+				$field_value = ('none' !== $show_content ? $show_content : 'give_pre_form');
734
+				give_update_meta(get_the_ID(), '_give_content_placement', $field_value);
735 735
 			}
736 736
 
737 737
 			// "Disable" Guest Donation. Checkbox.
738 738
 			// See: https://github.com/WordImpress/Give/issues/1470.
739
-			$guest_donation        = give_get_meta( get_the_ID(), '_give_logged_in_only', true );
740
-			$guest_donation_newval = ( in_array( $guest_donation, array( 'yes', 'on' ) ) ? 'disabled' : 'enabled' );
741
-			give_update_meta( get_the_ID(), '_give_logged_in_only', $guest_donation_newval );
739
+			$guest_donation        = give_get_meta(get_the_ID(), '_give_logged_in_only', true);
740
+			$guest_donation_newval = (in_array($guest_donation, array('yes', 'on')) ? 'disabled' : 'enabled');
741
+			give_update_meta(get_the_ID(), '_give_logged_in_only', $guest_donation_newval);
742 742
 
743 743
 			// Offline Donations.
744 744
 			// See: https://github.com/WordImpress/Give/issues/1579.
745
-			$offline_donation = give_get_meta( get_the_ID(), '_give_customize_offline_donations', true );
746
-			if ( 'no' === $offline_donation ) {
745
+			$offline_donation = give_get_meta(get_the_ID(), '_give_customize_offline_donations', true);
746
+			if ('no' === $offline_donation) {
747 747
 				$offline_donation_newval = 'global';
748
-			} elseif ( 'yes' === $offline_donation ) {
748
+			} elseif ('yes' === $offline_donation) {
749 749
 				$offline_donation_newval = 'enabled';
750 750
 			} else {
751 751
 				$offline_donation_newval = 'disabled';
752 752
 			}
753
-			give_update_meta( get_the_ID(), '_give_customize_offline_donations', $offline_donation_newval );
753
+			give_update_meta(get_the_ID(), '_give_customize_offline_donations', $offline_donation_newval);
754 754
 
755 755
 			// Convert yes/no setting field to enabled/disabled.
756 756
 			$form_radio_settings = array(
@@ -770,15 +770,15 @@  discard block
 block discarded – undo
770 770
 				'_give_offline_donation_enable_billing_fields_single',
771 771
 			);
772 772
 
773
-			foreach ( $form_radio_settings as $meta_key ) {
773
+			foreach ($form_radio_settings as $meta_key) {
774 774
 				// Get value.
775
-				$field_value = give_get_meta( get_the_ID(), $meta_key, true );
775
+				$field_value = give_get_meta(get_the_ID(), $meta_key, true);
776 776
 
777 777
 				// Convert meta value only if it is in yes/no/none.
778
-				if ( in_array( $field_value, array( 'yes', 'on', 'no', 'none' ) ) ) {
778
+				if (in_array($field_value, array('yes', 'on', 'no', 'none'))) {
779 779
 
780
-					$field_value = ( in_array( $field_value, array( 'yes', 'on' ) ) ? 'enabled' : 'disabled' );
781
-					give_update_meta( get_the_ID(), $meta_key, $field_value );
780
+					$field_value = (in_array($field_value, array('yes', 'on')) ? 'enabled' : 'disabled');
781
+					give_update_meta(get_the_ID(), $meta_key, $field_value);
782 782
 				}
783 783
 			}
784 784
 		}// End while().
@@ -787,7 +787,7 @@  discard block
 block discarded – undo
787 787
 
788 788
 	} else {
789 789
 		// No more forms found, finish up.
790
-		give_set_upgrade_complete( 'v18_upgrades_form_metadata' );
790
+		give_set_upgrade_complete('v18_upgrades_form_metadata');
791 791
 	}
792 792
 }
793 793
 
@@ -854,7 +854,7 @@  discard block
 block discarded – undo
854 854
 				'%_transient_give_stats_%',
855 855
 				'give_cache%',
856 856
 				'%_transient_give_add_ons_feed%',
857
-				'%_transient__give_ajax_works' .
857
+				'%_transient__give_ajax_works'.
858 858
 				'%_transient_give_total_api_keys%',
859 859
 				'%_transient_give_i18n_give_promo_hide%',
860 860
 				'%_transient_give_contributors%',
@@ -881,24 +881,24 @@  discard block
 block discarded – undo
881 881
 		ARRAY_A
882 882
 	);
883 883
 
884
-	if ( ! empty( $user_apikey_options ) ) {
885
-		foreach ( $user_apikey_options as $user ) {
886
-			$cached_options[] = '_transient_' . md5( 'give_api_user_' . $user['meta_key'] );
887
-			$cached_options[] = '_transient_' . md5( 'give_api_user_public_key' . $user['user_id'] );
888
-			$cached_options[] = '_transient_' . md5( 'give_api_user_secret_key' . $user['user_id'] );
884
+	if ( ! empty($user_apikey_options)) {
885
+		foreach ($user_apikey_options as $user) {
886
+			$cached_options[] = '_transient_'.md5('give_api_user_'.$user['meta_key']);
887
+			$cached_options[] = '_transient_'.md5('give_api_user_public_key'.$user['user_id']);
888
+			$cached_options[] = '_transient_'.md5('give_api_user_secret_key'.$user['user_id']);
889 889
 		}
890 890
 	}
891 891
 
892
-	if ( ! empty( $cached_options ) ) {
893
-		foreach ( $cached_options as $option ) {
894
-			switch ( true ) {
895
-				case ( false !== strpos( $option, 'transient' ) ):
896
-					$option = str_replace( '_transient_', '', $option );
897
-					delete_transient( $option );
892
+	if ( ! empty($cached_options)) {
893
+		foreach ($cached_options as $option) {
894
+			switch (true) {
895
+				case (false !== strpos($option, 'transient')):
896
+					$option = str_replace('_transient_', '', $option);
897
+					delete_transient($option);
898 898
 					break;
899 899
 
900 900
 				default:
901
-					delete_option( $option );
901
+					delete_option($option);
902 902
 			}
903 903
 		}
904 904
 	}
@@ -916,7 +916,7 @@  discard block
 block discarded – undo
916 916
 	global $wp_roles;
917 917
 
918 918
 	// Get the role object.
919
-	$give_worker = get_role( 'give_worker' );
919
+	$give_worker = get_role('give_worker');
920 920
 
921 921
 	// A list of capabilities to add for give workers.
922 922
 	$caps_to_add = array(
@@ -924,9 +924,9 @@  discard block
 block discarded – undo
924 924
 		'edit_pages',
925 925
 	);
926 926
 
927
-	foreach ( $caps_to_add as $cap ) {
927
+	foreach ($caps_to_add as $cap) {
928 928
 		// Add the capability.
929
-		$give_worker->add_cap( $cap );
929
+		$give_worker->add_cap($cap);
930 930
 	}
931 931
 
932 932
 }
@@ -943,7 +943,7 @@  discard block
 block discarded – undo
943 943
 	$give_updates = Give_Updates::get_instance();
944 944
 
945 945
 	// form query.
946
-	$donation_forms = new WP_Query( array(
946
+	$donation_forms = new WP_Query(array(
947 947
 			'paged'          => $give_updates->step,
948 948
 			'status'         => 'any',
949 949
 			'order'          => 'ASC',
@@ -952,10 +952,10 @@  discard block
 block discarded – undo
952 952
 		)
953 953
 	);
954 954
 
955
-	if ( $donation_forms->have_posts() ) {
956
-		$give_updates->set_percentage( $donation_forms->found_posts, ( $give_updates->step * 20 ) );
955
+	if ($donation_forms->have_posts()) {
956
+		$give_updates->set_percentage($donation_forms->found_posts, ($give_updates->step * 20));
957 957
 
958
-		while ( $donation_forms->have_posts() ) {
958
+		while ($donation_forms->have_posts()) {
959 959
 			$donation_forms->the_post();
960 960
 			$form_id = get_the_ID();
961 961
 
@@ -963,41 +963,41 @@  discard block
 block discarded – undo
963 963
 			update_post_meta(
964 964
 				$form_id,
965 965
 				'_give_set_price',
966
-				give_sanitize_amount( get_post_meta( $form_id, '_give_set_price', true ) )
966
+				give_sanitize_amount(get_post_meta($form_id, '_give_set_price', true))
967 967
 			);
968 968
 
969 969
 			// Remove formatting from _give_custom_amount_minimum.
970 970
 			update_post_meta(
971 971
 				$form_id,
972 972
 				'_give_custom_amount_minimum',
973
-				give_sanitize_amount( get_post_meta( $form_id, '_give_custom_amount_minimum', true ) )
973
+				give_sanitize_amount(get_post_meta($form_id, '_give_custom_amount_minimum', true))
974 974
 			);
975 975
 
976 976
 			// Bailout.
977
-			if ( 'set' === get_post_meta( $form_id, '_give_price_option', true ) ) {
977
+			if ('set' === get_post_meta($form_id, '_give_price_option', true)) {
978 978
 				continue;
979 979
 			}
980 980
 
981
-			$donation_levels = get_post_meta( $form_id, '_give_donation_levels', true );
981
+			$donation_levels = get_post_meta($form_id, '_give_donation_levels', true);
982 982
 
983
-			if ( ! empty( $donation_levels ) ) {
983
+			if ( ! empty($donation_levels)) {
984 984
 
985
-				foreach ( $donation_levels as $index => $donation_level ) {
986
-					if ( isset( $donation_level['_give_amount'] ) ) {
987
-						$donation_levels[ $index ]['_give_amount'] = give_sanitize_amount( $donation_level['_give_amount'] );
985
+				foreach ($donation_levels as $index => $donation_level) {
986
+					if (isset($donation_level['_give_amount'])) {
987
+						$donation_levels[$index]['_give_amount'] = give_sanitize_amount($donation_level['_give_amount']);
988 988
 					}
989 989
 				}
990 990
 
991
-				update_post_meta( $form_id, '_give_donation_levels', $donation_levels );
991
+				update_post_meta($form_id, '_give_donation_levels', $donation_levels);
992 992
 
993
-				$donation_levels_amounts = wp_list_pluck( $donation_levels, '_give_amount' );
993
+				$donation_levels_amounts = wp_list_pluck($donation_levels, '_give_amount');
994 994
 
995
-				$min_amount = min( $donation_levels_amounts );
996
-				$max_amount = max( $donation_levels_amounts );
995
+				$min_amount = min($donation_levels_amounts);
996
+				$max_amount = max($donation_levels_amounts);
997 997
 
998 998
 				// Set Minimum and Maximum amount for Multi Level Donation Forms
999
-				give_update_meta( $form_id, '_give_levels_minimum_amount', $min_amount ? give_sanitize_amount( $min_amount ) : 0 );
1000
-				give_update_meta( $form_id, '_give_levels_maximum_amount', $max_amount ? give_sanitize_amount( $max_amount ) : 0 );
999
+				give_update_meta($form_id, '_give_levels_minimum_amount', $min_amount ? give_sanitize_amount($min_amount) : 0);
1000
+				give_update_meta($form_id, '_give_levels_maximum_amount', $max_amount ? give_sanitize_amount($max_amount) : 0);
1001 1001
 			}
1002 1002
 
1003 1003
 		}
@@ -1006,7 +1006,7 @@  discard block
 block discarded – undo
1006 1006
 		wp_reset_postdata();
1007 1007
 	} else {
1008 1008
 		// The Update Ran.
1009
-		give_set_upgrade_complete( 'v189_upgrades_levels_post_meta' );
1009
+		give_set_upgrade_complete('v189_upgrades_levels_post_meta');
1010 1010
 	}
1011 1011
 
1012 1012
 }
@@ -1056,7 +1056,7 @@  discard block
 block discarded – undo
1056 1056
  */
1057 1057
 function give_v20_upgrades() {
1058 1058
 	// Update cache setting.
1059
-	give_update_option( 'cache', 'enabled' );
1059
+	give_update_option('cache', 'enabled');
1060 1060
 
1061 1061
 	// Upgrade email settings.
1062 1062
 	give_v20_upgrades_email_setting();
@@ -1075,7 +1075,7 @@  discard block
 block discarded – undo
1075 1075
 	$all_setting = give_get_settings();
1076 1076
 
1077 1077
 	// Bailout on fresh install.
1078
-	if ( empty( $all_setting ) ) {
1078
+	if (empty($all_setting)) {
1079 1079
 		return;
1080 1080
 	}
1081 1081
 
@@ -1094,19 +1094,19 @@  discard block
 block discarded – undo
1094 1094
 		'admin_notices'                 => 'new-donation_notification',
1095 1095
 	);
1096 1096
 
1097
-	foreach ( $settings as $old_setting => $new_setting ) {
1097
+	foreach ($settings as $old_setting => $new_setting) {
1098 1098
 		// Do not update already modified
1099
-		if ( ! is_array( $new_setting ) ) {
1100
-			if ( array_key_exists( $new_setting, $all_setting ) || ! array_key_exists( $old_setting, $all_setting ) ) {
1099
+		if ( ! is_array($new_setting)) {
1100
+			if (array_key_exists($new_setting, $all_setting) || ! array_key_exists($old_setting, $all_setting)) {
1101 1101
 				continue;
1102 1102
 			}
1103 1103
 		}
1104 1104
 
1105
-		switch ( $old_setting ) {
1105
+		switch ($old_setting) {
1106 1106
 			case 'admin_notices':
1107
-				$notification_status = give_get_option( $old_setting, 'enabled' );
1107
+				$notification_status = give_get_option($old_setting, 'enabled');
1108 1108
 
1109
-				give_update_option( $new_setting, $notification_status );
1109
+				give_update_option($new_setting, $notification_status);
1110 1110
 
1111 1111
 				// @todo: Delete this option later ( version > 2.0 ), We need this for per form email addon.
1112 1112
 				// give_delete_option( $old_setting );
@@ -1117,19 +1117,19 @@  discard block
 block discarded – undo
1117 1117
 			case 'admin_notice_emails':
1118 1118
 				$recipients = give_get_admin_notice_emails();
1119 1119
 
1120
-				foreach ( $new_setting as $setting ) {
1120
+				foreach ($new_setting as $setting) {
1121 1121
 					// bailout if setting already exist.
1122
-					if ( array_key_exists( $setting, $all_setting ) ) {
1122
+					if (array_key_exists($setting, $all_setting)) {
1123 1123
 						continue;
1124 1124
 					}
1125 1125
 
1126
-					give_update_option( $setting, $recipients );
1126
+					give_update_option($setting, $recipients);
1127 1127
 				}
1128 1128
 				break;
1129 1129
 
1130 1130
 			default:
1131
-				give_update_option( $new_setting, give_get_option( $old_setting ) );
1132
-				give_delete_option( $old_setting );
1131
+				give_update_option($new_setting, give_get_option($old_setting));
1132
+				give_delete_option($old_setting);
1133 1133
 		}
1134 1134
 	}
1135 1135
 }
@@ -1146,22 +1146,22 @@  discard block
 block discarded – undo
1146 1146
 	$give_settings        = give_get_settings();
1147 1147
 	$give_setting_updated = false;
1148 1148
 
1149
-	if ( $give_settings['thousands_separator'] === $give_settings['decimal_separator'] ) {
1149
+	if ($give_settings['thousands_separator'] === $give_settings['decimal_separator']) {
1150 1150
 		$give_settings['number_decimals']   = 0;
1151 1151
 		$give_settings['decimal_separator'] = '';
1152 1152
 		$give_setting_updated               = true;
1153 1153
 
1154
-	} elseif ( empty( $give_settings['decimal_separator'] ) ) {
1154
+	} elseif (empty($give_settings['decimal_separator'])) {
1155 1155
 		$give_settings['number_decimals'] = 0;
1156 1156
 		$give_setting_updated             = true;
1157 1157
 
1158
-	} elseif ( 6 < absint( $give_settings['number_decimals'] ) ) {
1158
+	} elseif (6 < absint($give_settings['number_decimals'])) {
1159 1159
 		$give_settings['number_decimals'] = 5;
1160 1160
 		$give_setting_updated             = true;
1161 1161
 	}
1162 1162
 
1163
-	if ( $give_setting_updated ) {
1164
-		update_option( 'give_settings', $give_settings );
1163
+	if ($give_setting_updated) {
1164
+		update_option('give_settings', $give_settings);
1165 1165
 	}
1166 1166
 }
1167 1167
 
@@ -1180,69 +1180,69 @@  discard block
 block discarded – undo
1180 1180
 	$give_updates = Give_Updates::get_instance();
1181 1181
 
1182 1182
 	// form query.
1183
-	$donation_forms = new WP_Query( array(
1183
+	$donation_forms = new WP_Query(array(
1184 1184
 			'paged'          => $give_updates->step,
1185 1185
 			'status'         => 'any',
1186 1186
 			'order'          => 'ASC',
1187
-			'post_type'      => array( 'give_forms', 'give_payment' ),
1187
+			'post_type'      => array('give_forms', 'give_payment'),
1188 1188
 			'posts_per_page' => 20,
1189 1189
 		)
1190 1190
 	);
1191
-	if ( $donation_forms->have_posts() ) {
1192
-		$give_updates->set_percentage( $donation_forms->found_posts, ( $give_updates->step * 20 ) );
1191
+	if ($donation_forms->have_posts()) {
1192
+		$give_updates->set_percentage($donation_forms->found_posts, ($give_updates->step * 20));
1193 1193
 
1194
-		while ( $donation_forms->have_posts() ) {
1194
+		while ($donation_forms->have_posts()) {
1195 1195
 			$donation_forms->the_post();
1196 1196
 			global $post;
1197 1197
 
1198
-			$meta = get_post_meta( $post->ID );
1198
+			$meta = get_post_meta($post->ID);
1199 1199
 
1200
-			switch ( $post->post_type ) {
1200
+			switch ($post->post_type) {
1201 1201
 				case 'give_forms':
1202 1202
 					// _give_set_price.
1203
-					if ( ! empty( $meta['_give_set_price'][0] ) ) {
1204
-						update_post_meta( $post->ID, '_give_set_price', give_sanitize_amount_for_db( $meta['_give_set_price'][0] ) );
1203
+					if ( ! empty($meta['_give_set_price'][0])) {
1204
+						update_post_meta($post->ID, '_give_set_price', give_sanitize_amount_for_db($meta['_give_set_price'][0]));
1205 1205
 					}
1206 1206
 
1207 1207
 					// _give_custom_amount_minimum.
1208
-					if ( ! empty( $meta['_give_custom_amount_minimum'][0] ) ) {
1209
-						update_post_meta( $post->ID, '_give_custom_amount_minimum', give_sanitize_amount_for_db( $meta['_give_custom_amount_minimum'][0] ) );
1208
+					if ( ! empty($meta['_give_custom_amount_minimum'][0])) {
1209
+						update_post_meta($post->ID, '_give_custom_amount_minimum', give_sanitize_amount_for_db($meta['_give_custom_amount_minimum'][0]));
1210 1210
 					}
1211 1211
 
1212 1212
 					// _give_levels_minimum_amount.
1213
-					if ( ! empty( $meta['_give_levels_minimum_amount'][0] ) ) {
1214
-						update_post_meta( $post->ID, '_give_levels_minimum_amount', give_sanitize_amount_for_db( $meta['_give_levels_minimum_amount'][0] ) );
1213
+					if ( ! empty($meta['_give_levels_minimum_amount'][0])) {
1214
+						update_post_meta($post->ID, '_give_levels_minimum_amount', give_sanitize_amount_for_db($meta['_give_levels_minimum_amount'][0]));
1215 1215
 					}
1216 1216
 
1217 1217
 					// _give_levels_maximum_amount.
1218
-					if ( ! empty( $meta['_give_levels_maximum_amount'][0] ) ) {
1219
-						update_post_meta( $post->ID, '_give_levels_maximum_amount', give_sanitize_amount_for_db( $meta['_give_levels_maximum_amount'][0] ) );
1218
+					if ( ! empty($meta['_give_levels_maximum_amount'][0])) {
1219
+						update_post_meta($post->ID, '_give_levels_maximum_amount', give_sanitize_amount_for_db($meta['_give_levels_maximum_amount'][0]));
1220 1220
 					}
1221 1221
 
1222 1222
 					// _give_set_goal.
1223
-					if ( ! empty( $meta['_give_set_goal'][0] ) ) {
1224
-						update_post_meta( $post->ID, '_give_set_goal', give_sanitize_amount_for_db( $meta['_give_set_goal'][0] ) );
1223
+					if ( ! empty($meta['_give_set_goal'][0])) {
1224
+						update_post_meta($post->ID, '_give_set_goal', give_sanitize_amount_for_db($meta['_give_set_goal'][0]));
1225 1225
 					}
1226 1226
 
1227 1227
 					// _give_form_earnings.
1228
-					if ( ! empty( $meta['_give_form_earnings'][0] ) ) {
1229
-						update_post_meta( $post->ID, '_give_form_earnings', give_sanitize_amount_for_db( $meta['_give_form_earnings'][0] ) );
1228
+					if ( ! empty($meta['_give_form_earnings'][0])) {
1229
+						update_post_meta($post->ID, '_give_form_earnings', give_sanitize_amount_for_db($meta['_give_form_earnings'][0]));
1230 1230
 					}
1231 1231
 
1232 1232
 					// _give_custom_amount_minimum.
1233
-					if ( ! empty( $meta['_give_donation_levels'][0] ) ) {
1234
-						$donation_levels = unserialize( $meta['_give_donation_levels'][0] );
1233
+					if ( ! empty($meta['_give_donation_levels'][0])) {
1234
+						$donation_levels = unserialize($meta['_give_donation_levels'][0]);
1235 1235
 
1236
-						foreach ( $donation_levels as $index => $level ) {
1237
-							if ( empty( $level['_give_amount'] ) ) {
1236
+						foreach ($donation_levels as $index => $level) {
1237
+							if (empty($level['_give_amount'])) {
1238 1238
 								continue;
1239 1239
 							}
1240 1240
 
1241
-							$donation_levels[ $index ]['_give_amount'] = give_sanitize_amount_for_db( $level['_give_amount'] );
1241
+							$donation_levels[$index]['_give_amount'] = give_sanitize_amount_for_db($level['_give_amount']);
1242 1242
 						}
1243 1243
 
1244 1244
 						$meta['_give_donation_levels'] = $donation_levels;
1245
-						update_post_meta( $post->ID, '_give_donation_levels', $meta['_give_donation_levels'] );
1245
+						update_post_meta($post->ID, '_give_donation_levels', $meta['_give_donation_levels']);
1246 1246
 					}
1247 1247
 
1248 1248
 
@@ -1250,8 +1250,8 @@  discard block
 block discarded – undo
1250 1250
 
1251 1251
 				case 'give_payment':
1252 1252
 					// _give_payment_total.
1253
-					if ( ! empty( $meta['_give_payment_total'][0] ) ) {
1254
-						update_post_meta( $post->ID, '_give_payment_total', give_sanitize_amount_for_db( $meta['_give_payment_total'][0] ) );
1253
+					if ( ! empty($meta['_give_payment_total'][0])) {
1254
+						update_post_meta($post->ID, '_give_payment_total', give_sanitize_amount_for_db($meta['_give_payment_total'][0]));
1255 1255
 					}
1256 1256
 
1257 1257
 					break;
@@ -1262,7 +1262,7 @@  discard block
 block discarded – undo
1262 1262
 		wp_reset_postdata();
1263 1263
 	} else {
1264 1264
 		// The Update Ran.
1265
-		give_set_upgrade_complete( 'v1812_update_amount_values' );
1265
+		give_set_upgrade_complete('v1812_update_amount_values');
1266 1266
 	}
1267 1267
 }
1268 1268
 
@@ -1282,22 +1282,22 @@  discard block
 block discarded – undo
1282 1282
 	$offset       = 1 === $give_updates->step ? 0 : $give_updates->step * 20;
1283 1283
 
1284 1284
 	// form query.
1285
-	$donors = Give()->donors->get_donors( array(
1285
+	$donors = Give()->donors->get_donors(array(
1286 1286
 			'number' => 20,
1287 1287
 			'offset' => $offset,
1288 1288
 		)
1289 1289
 	);
1290 1290
 
1291
-	if ( ! empty( $donors ) ) {
1292
-		$give_updates->set_percentage( Give()->donors->count(), $offset );
1291
+	if ( ! empty($donors)) {
1292
+		$give_updates->set_percentage(Give()->donors->count(), $offset);
1293 1293
 
1294 1294
 		/* @var Object $donor */
1295
-		foreach ( $donors as $donor ) {
1296
-			Give()->donors->update( $donor->id, array( 'purchase_value' => give_sanitize_amount_for_db( $donor->purchase_value ) ) );
1295
+		foreach ($donors as $donor) {
1296
+			Give()->donors->update($donor->id, array('purchase_value' => give_sanitize_amount_for_db($donor->purchase_value)));
1297 1297
 		}
1298 1298
 	} else {
1299 1299
 		// The Update Ran.
1300
-		give_set_upgrade_complete( 'v1812_update_donor_purchase_values' );
1300
+		give_set_upgrade_complete('v1812_update_donor_purchase_values');
1301 1301
 	}
1302 1302
 }
1303 1303
 
@@ -1312,25 +1312,25 @@  discard block
 block discarded – undo
1312 1312
 	$offset       = 1 === $give_updates->step ? 0 : $give_updates->step * 20;
1313 1313
 
1314 1314
 	// Fetch all the existing donors.
1315
-	$donors = Give()->donors->get_donors( array(
1315
+	$donors = Give()->donors->get_donors(array(
1316 1316
 			'number' => 20,
1317 1317
 			'offset' => $offset,
1318 1318
 		)
1319 1319
 	);
1320 1320
 
1321
-	if ( ! empty( $donors ) ) {
1322
-		$give_updates->set_percentage( Give()->donors->count(), ( $give_updates->step * 20 ) );
1321
+	if ( ! empty($donors)) {
1322
+		$give_updates->set_percentage(Give()->donors->count(), ($give_updates->step * 20));
1323 1323
 
1324 1324
 		/* @var Object $donor */
1325
-		foreach ( $donors as $donor ) {
1325
+		foreach ($donors as $donor) {
1326 1326
 			$user_id = $donor->user_id;
1327 1327
 
1328 1328
 			// Proceed, if donor is attached with user.
1329
-			if ( $user_id ) {
1330
-				$user = get_userdata( $user_id );
1329
+			if ($user_id) {
1330
+				$user = get_userdata($user_id);
1331 1331
 
1332 1332
 				// Update user role, if user has subscriber role.
1333
-				if ( is_array( $user->roles ) && in_array( 'subscriber', $user->roles ) ) {
1333
+				if (is_array($user->roles) && in_array('subscriber', $user->roles)) {
1334 1334
 					wp_update_user(
1335 1335
 						array(
1336 1336
 							'ID'   => $user_id,
@@ -1342,7 +1342,7 @@  discard block
 block discarded – undo
1342 1342
 		}
1343 1343
 	} else {
1344 1344
 		// The Update Ran.
1345
-		give_set_upgrade_complete( 'v1813_update_donor_user_roles' );
1345
+		give_set_upgrade_complete('v1813_update_donor_user_roles');
1346 1346
 	}
1347 1347
 }
1348 1348
 
@@ -1354,7 +1354,7 @@  discard block
 block discarded – undo
1354 1354
  */
1355 1355
 function give_v1813_upgrades() {
1356 1356
 	// Update admin setting.
1357
-	give_update_option( 'donor_default_user_role', 'give_donor' );
1357
+	give_update_option('donor_default_user_role', 'give_donor');
1358 1358
 
1359 1359
 	// Update Give roles.
1360 1360
 	$roles = new Give_Roles();
@@ -1372,33 +1372,33 @@  discard block
 block discarded – undo
1372 1372
 	$give_updates = Give_Updates::get_instance();
1373 1373
 
1374 1374
 	// form query.
1375
-	$payments = new WP_Query( array(
1375
+	$payments = new WP_Query(array(
1376 1376
 			'paged'          => $give_updates->step,
1377 1377
 			'status'         => 'any',
1378 1378
 			'order'          => 'ASC',
1379
-			'post_type'      => array( 'give_payment' ),
1379
+			'post_type'      => array('give_payment'),
1380 1380
 			'posts_per_page' => 100,
1381 1381
 		)
1382 1382
 	);
1383 1383
 
1384
-	if ( $payments->have_posts() ) {
1385
-		$give_updates->set_percentage( $payments->found_posts, ( $give_updates->step * 100 ) );
1384
+	if ($payments->have_posts()) {
1385
+		$give_updates->set_percentage($payments->found_posts, ($give_updates->step * 100));
1386 1386
 
1387
-		while ( $payments->have_posts() ) {
1387
+		while ($payments->have_posts()) {
1388 1388
 			$payments->the_post();
1389 1389
 
1390
-			$payment_meta = give_get_payment_meta( get_the_ID() );
1390
+			$payment_meta = give_get_payment_meta(get_the_ID());
1391 1391
 
1392
-			if ( 'RIAL' === $payment_meta['currency'] ) {
1392
+			if ('RIAL' === $payment_meta['currency']) {
1393 1393
 				$payment_meta['currency'] = 'IRR';
1394
-				give_update_meta( get_the_ID(), '_give_payment_meta', $payment_meta );
1394
+				give_update_meta(get_the_ID(), '_give_payment_meta', $payment_meta);
1395 1395
 			}
1396 1396
 
1397 1397
 		}
1398 1398
 
1399 1399
 	} else {
1400 1400
 		// The Update Ran.
1401
-		give_set_upgrade_complete( 'v1817_update_donation_iranian_currency_code' );
1401
+		give_set_upgrade_complete('v1817_update_donation_iranian_currency_code');
1402 1402
 	}
1403 1403
 }
1404 1404
 
@@ -1411,9 +1411,9 @@  discard block
 block discarded – undo
1411 1411
 function give_v1817_upgrades() {
1412 1412
 	$give_settings = give_get_settings();
1413 1413
 
1414
-	if ( 'RIAL' === $give_settings['currency'] ) {
1414
+	if ('RIAL' === $give_settings['currency']) {
1415 1415
 		$give_settings['currency'] = 'IRR';
1416
-		update_option( 'give_settings', $give_settings );
1416
+		update_option('give_settings', $give_settings);
1417 1417
 	}
1418 1418
 }
1419 1419
 
@@ -1426,7 +1426,7 @@  discard block
 block discarded – undo
1426 1426
 
1427 1427
 	global $wp_roles;
1428 1428
 
1429
-	if( ! ( $wp_roles instanceof  WP_Roles ) ) {
1429
+	if ( ! ($wp_roles instanceof  WP_Roles)) {
1430 1430
 		return;
1431 1431
 	}
1432 1432
 
@@ -1450,15 +1450,15 @@  discard block
 block discarded – undo
1450 1450
 		),
1451 1451
 	);
1452 1452
 
1453
-	foreach ( $add_caps as $role => $caps ) {
1454
-		foreach ( $caps as $cap ) {
1455
-			$wp_roles->add_cap( $role, $cap );
1453
+	foreach ($add_caps as $role => $caps) {
1454
+		foreach ($caps as $cap) {
1455
+			$wp_roles->add_cap($role, $cap);
1456 1456
 		}
1457 1457
 	}
1458 1458
 
1459
-	foreach ( $remove_caps as $role => $caps ) {
1460
-		foreach ( $caps as $cap ) {
1461
-			$wp_roles->remove_cap( $role, $cap );
1459
+	foreach ($remove_caps as $role => $caps) {
1460
+		foreach ($caps as $cap) {
1461
+			$wp_roles->remove_cap($role, $cap);
1462 1462
 		}
1463 1463
 	}
1464 1464
 
@@ -1482,7 +1482,7 @@  discard block
 block discarded – undo
1482 1482
 	$roles->add_roles();
1483 1483
 	$roles->add_caps();
1484 1484
 
1485
-	give_set_upgrade_complete( 'v1817_cleanup_user_roles' );
1485
+	give_set_upgrade_complete('v1817_cleanup_user_roles');
1486 1486
 }
1487 1487
 
1488 1488
 /**
@@ -1493,7 +1493,7 @@  discard block
 block discarded – undo
1493 1493
 function give_v1818_upgrades() {
1494 1494
 
1495 1495
 	// Remove email_access_installed from give_settings.
1496
-	give_delete_option( 'email_access_installed' );
1496
+	give_delete_option('email_access_installed');
1497 1497
 }
1498 1498
 
1499 1499
 /**
@@ -1504,25 +1504,25 @@  discard block
 block discarded – undo
1504 1504
 function give_v1818_assign_custom_amount_set_donation() {
1505 1505
 
1506 1506
 	/* @var Give_Updates $give_updates */
1507
-	$give_updates   = Give_Updates::get_instance();
1507
+	$give_updates = Give_Updates::get_instance();
1508 1508
 
1509
-	$donations = new WP_Query( array(
1509
+	$donations = new WP_Query(array(
1510 1510
 			'paged'          => $give_updates->step,
1511 1511
 			'status'         => 'any',
1512 1512
 			'order'          => 'ASC',
1513
-			'post_type'      => array( 'give_payment' ),
1513
+			'post_type'      => array('give_payment'),
1514 1514
 			'posts_per_page' => 100,
1515 1515
 		)
1516 1516
 	);
1517 1517
 
1518
-	if ( $donations->have_posts() ) {
1519
-		$give_updates->set_percentage( $donations->found_posts, $give_updates->step * 100 );
1518
+	if ($donations->have_posts()) {
1519
+		$give_updates->set_percentage($donations->found_posts, $give_updates->step * 100);
1520 1520
 
1521
-		while ( $donations->have_posts() ) {
1521
+		while ($donations->have_posts()) {
1522 1522
 			$donations->the_post();
1523 1523
 
1524
-			$form          = new Give_Donate_Form( give_get_meta( get_the_ID(), '_give_payment_form_id', true ) );
1525
-			$donation_meta = give_get_payment_meta( get_the_ID() );
1524
+			$form          = new Give_Donate_Form(give_get_meta(get_the_ID(), '_give_payment_form_id', true));
1525
+			$donation_meta = give_get_payment_meta(get_the_ID());
1526 1526
 
1527 1527
 			// Update Donation meta with price_id set as custom, only if it is:
1528 1528
 			// 1. Donation Type = Set Donation.
@@ -1531,19 +1531,19 @@  discard block
 block discarded – undo
1531 1531
 			if (
1532 1532
 				$form->ID &&
1533 1533
 				$form->is_set_type_donation_form() &&
1534
-				( 'custom' !== $donation_meta['price_id'] ) &&
1535
-				$form->is_custom_price( give_get_meta( get_the_ID(), '_give_payment_total', true ) )
1534
+				('custom' !== $donation_meta['price_id']) &&
1535
+				$form->is_custom_price(give_get_meta(get_the_ID(), '_give_payment_total', true))
1536 1536
 			) {
1537 1537
 				$donation_meta['price_id'] = 'custom';
1538
-				give_update_meta( get_the_ID(), '_give_payment_meta', $donation_meta );
1539
-				give_update_meta( get_the_ID(), '_give_payment_price_id', 'custom' );
1538
+				give_update_meta(get_the_ID(), '_give_payment_meta', $donation_meta);
1539
+				give_update_meta(get_the_ID(), '_give_payment_price_id', 'custom');
1540 1540
 			}
1541 1541
 		}
1542 1542
 
1543 1543
 		wp_reset_postdata();
1544 1544
 	} else {
1545 1545
 		// Update Ran Successfully.
1546
-		give_set_upgrade_complete( 'v1818_assign_custom_amount_set_donation' );
1546
+		give_set_upgrade_complete('v1818_assign_custom_amount_set_donation');
1547 1547
 	}
1548 1548
 }
1549 1549
 
@@ -1554,14 +1554,14 @@  discard block
 block discarded – undo
1554 1554
  *
1555 1555
  * @since 1.8.18
1556 1556
  */
1557
-function give_v1818_give_worker_role_cleanup(){
1557
+function give_v1818_give_worker_role_cleanup() {
1558 1558
 
1559 1559
 	/* @var Give_Updates $give_updates */
1560 1560
 	$give_updates = Give_Updates::get_instance();
1561 1561
 
1562 1562
 	global $wp_roles;
1563 1563
 
1564
-	if( ! ( $wp_roles instanceof  WP_Roles ) ) {
1564
+	if ( ! ($wp_roles instanceof  WP_Roles)) {
1565 1565
 		return;
1566 1566
 	}
1567 1567
 
@@ -1579,9 +1579,9 @@  discard block
 block discarded – undo
1579 1579
 		),
1580 1580
 	);
1581 1581
 
1582
-	foreach ( $remove_caps as $role => $caps ) {
1583
-		foreach( $caps as $cap ) {
1584
-			$wp_roles->remove_cap( $role, $cap );
1582
+	foreach ($remove_caps as $role => $caps) {
1583
+		foreach ($caps as $cap) {
1584
+			$wp_roles->remove_cap($role, $cap);
1585 1585
 		}
1586 1586
 	}
1587 1587
 
@@ -1592,7 +1592,7 @@  discard block
 block discarded – undo
1592 1592
 	$roles->add_roles();
1593 1593
 	$roles->add_caps();
1594 1594
 
1595
-	give_set_upgrade_complete( 'v1818_give_worker_role_cleanup' );
1595
+	give_set_upgrade_complete('v1818_give_worker_role_cleanup');
1596 1596
 }
1597 1597
 
1598 1598
 /**
@@ -1606,7 +1606,7 @@  discard block
 block discarded – undo
1606 1606
 	$give_updates = Give_Updates::get_instance();
1607 1607
 
1608 1608
 	// form query
1609
-	$forms = new WP_Query( array(
1609
+	$forms = new WP_Query(array(
1610 1610
 			'paged'          => $give_updates->step,
1611 1611
 			'status'         => 'any',
1612 1612
 			'order'          => 'ASC',
@@ -1615,22 +1615,22 @@  discard block
 block discarded – undo
1615 1615
 		)
1616 1616
 	);
1617 1617
 
1618
-	if ( $forms->have_posts() ) {
1619
-		$give_updates->set_percentage( $forms->found_posts, ( $give_updates->step * 100 ) );
1618
+	if ($forms->have_posts()) {
1619
+		$give_updates->set_percentage($forms->found_posts, ($give_updates->step * 100));
1620 1620
 
1621
-		while ( $forms->have_posts() ) {
1621
+		while ($forms->have_posts()) {
1622 1622
 			$forms->the_post();
1623 1623
 			global $post;
1624 1624
 
1625 1625
 			// Update offline instruction email notification status.
1626
-			$offline_instruction_notification_status = get_post_meta( get_the_ID(), '_give_customize_offline_donations', true );
1627
-			$offline_instruction_notification_status = give_is_setting_enabled( $offline_instruction_notification_status, array(
1626
+			$offline_instruction_notification_status = get_post_meta(get_the_ID(), '_give_customize_offline_donations', true);
1627
+			$offline_instruction_notification_status = give_is_setting_enabled($offline_instruction_notification_status, array(
1628 1628
 				'enabled',
1629 1629
 				'global',
1630
-			) )
1630
+			))
1631 1631
 				? $offline_instruction_notification_status
1632 1632
 				: 'global';
1633
-			update_post_meta( get_the_ID(), '_give_offline-donation-instruction_notification', $offline_instruction_notification_status );
1633
+			update_post_meta(get_the_ID(), '_give_offline-donation-instruction_notification', $offline_instruction_notification_status);
1634 1634
 
1635 1635
 			// Update offline instruction email message.
1636 1636
 			update_post_meta(
@@ -1662,7 +1662,7 @@  discard block
 block discarded – undo
1662 1662
 		wp_reset_postdata();
1663 1663
 	} else {
1664 1664
 		// No more forms found, finish up.
1665
-		give_set_upgrade_complete( 'v20_upgrades_form_metadata' );
1665
+		give_set_upgrade_complete('v20_upgrades_form_metadata');
1666 1666
 	}
1667 1667
 }
1668 1668
 
@@ -1679,7 +1679,7 @@  discard block
 block discarded – undo
1679 1679
 	$give_updates = Give_Updates::get_instance();
1680 1680
 
1681 1681
 	// form query
1682
-	$forms = new WP_Query( array(
1682
+	$forms = new WP_Query(array(
1683 1683
 			'paged'          => $give_updates->step,
1684 1684
 			'status'         => 'any',
1685 1685
 			'order'          => 'ASC',
@@ -1688,19 +1688,19 @@  discard block
 block discarded – undo
1688 1688
 		)
1689 1689
 	);
1690 1690
 
1691
-	if ( $forms->have_posts() ) {
1692
-		$give_updates->set_percentage( $forms->found_posts, ( $give_updates->step * 100 ) );
1691
+	if ($forms->have_posts()) {
1692
+		$give_updates->set_percentage($forms->found_posts, ($give_updates->step * 100));
1693 1693
 
1694
-		while ( $forms->have_posts() ) {
1694
+		while ($forms->have_posts()) {
1695 1695
 			$forms->the_post();
1696 1696
 			global $post;
1697 1697
 
1698 1698
 			// Split _give_payment_meta meta.
1699 1699
 			// @todo Remove _give_payment_meta after releases 2.0
1700
-			$payment_meta = give_get_meta( $post->ID, '_give_payment_meta', true );
1700
+			$payment_meta = give_get_meta($post->ID, '_give_payment_meta', true);
1701 1701
 
1702
-			if ( ! empty( $payment_meta ) ) {
1703
-				_give_20_bc_split_and_save_give_payment_meta( $post->ID, $payment_meta );
1702
+			if ( ! empty($payment_meta)) {
1703
+				_give_20_bc_split_and_save_give_payment_meta($post->ID, $payment_meta);
1704 1704
 			}
1705 1705
 
1706 1706
 			$deprecated_meta_keys = array(
@@ -1709,9 +1709,9 @@  discard block
 block discarded – undo
1709 1709
 				'_give_payment_user_ip'     => '_give_payment_donor_ip',
1710 1710
 			);
1711 1711
 
1712
-			foreach ( $deprecated_meta_keys as $old_meta_key => $new_meta_key ) {
1712
+			foreach ($deprecated_meta_keys as $old_meta_key => $new_meta_key) {
1713 1713
 				// Do not add new meta key if already exist.
1714
-				if ( $wpdb->get_var( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key=%s", $post->ID, $new_meta_key ) ) ) {
1714
+				if ($wpdb->get_var($wpdb->prepare("SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key=%s", $post->ID, $new_meta_key))) {
1715 1715
 					continue;
1716 1716
 				}
1717 1717
 
@@ -1720,25 +1720,25 @@  discard block
 block discarded – undo
1720 1720
 					array(
1721 1721
 						'post_id' => $post->ID,
1722 1722
 						'meta_key' => $new_meta_key,
1723
-						'meta_value' => give_get_meta( $post->ID, $old_meta_key, true )
1723
+						'meta_value' => give_get_meta($post->ID, $old_meta_key, true)
1724 1724
 					)
1725 1725
 				);
1726 1726
 			}
1727 1727
 
1728 1728
 			// Bailout
1729
-			if ( $donor_id = give_get_meta( $post->ID, '_give_payment_donor_id', true ) ) {
1729
+			if ($donor_id = give_get_meta($post->ID, '_give_payment_donor_id', true)) {
1730 1730
 				/* @var Give_Donor $donor */
1731
-				$donor = new Give_Donor( $donor_id );
1731
+				$donor = new Give_Donor($donor_id);
1732 1732
 
1733
-				$address['line1']   = give_get_meta( $post->ID, '_give_donor_billing_address1', true, '' );
1734
-				$address['line2']   = give_get_meta( $post->ID, '_give_donor_billing_address2', true, '' );
1735
-				$address['city']    = give_get_meta( $post->ID, '_give_donor_billing_city', true, '' );
1736
-				$address['state']   = give_get_meta( $post->ID, '_give_donor_billing_state', true, '' );
1737
-				$address['zip']     = give_get_meta( $post->ID, '_give_donor_billing_zip', true, '' );
1738
-				$address['country'] = give_get_meta( $post->ID, '_give_donor_billing_country', true, '' );
1733
+				$address['line1']   = give_get_meta($post->ID, '_give_donor_billing_address1', true, '');
1734
+				$address['line2']   = give_get_meta($post->ID, '_give_donor_billing_address2', true, '');
1735
+				$address['city']    = give_get_meta($post->ID, '_give_donor_billing_city', true, '');
1736
+				$address['state']   = give_get_meta($post->ID, '_give_donor_billing_state', true, '');
1737
+				$address['zip']     = give_get_meta($post->ID, '_give_donor_billing_zip', true, '');
1738
+				$address['country'] = give_get_meta($post->ID, '_give_donor_billing_country', true, '');
1739 1739
 
1740 1740
 				// Save address.
1741
-				$donor->add_address( 'billing[]', $address );
1741
+				$donor->add_address('billing[]', $address);
1742 1742
 			}
1743 1743
 
1744 1744
 		}// End while().
@@ -1749,7 +1749,7 @@  discard block
 block discarded – undo
1749 1749
 		// $wpdb->get_var( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE meta_key=%s", '_give_payment_user_id' ) );
1750 1750
 
1751 1751
 		// No more forms found, finish up.
1752
-		give_set_upgrade_complete( 'v20_upgrades_payment_metadata' );
1752
+		give_set_upgrade_complete('v20_upgrades_payment_metadata');
1753 1753
 	}
1754 1754
 }
1755 1755
 
@@ -1765,7 +1765,7 @@  discard block
 block discarded – undo
1765 1765
 	$give_updates = Give_Updates::get_instance();
1766 1766
 
1767 1767
 	// form query
1768
-	$forms = new WP_Query( array(
1768
+	$forms = new WP_Query(array(
1769 1769
 			'paged'          => $give_updates->step,
1770 1770
 			'order'          => 'DESC',
1771 1771
 			'post_type'      => 'give_log',
@@ -1774,20 +1774,20 @@  discard block
 block discarded – undo
1774 1774
 		)
1775 1775
 	);
1776 1776
 
1777
-	if ( $forms->have_posts() ) {
1778
-		$give_updates->set_percentage( $forms->found_posts, $give_updates->step * 100 );
1777
+	if ($forms->have_posts()) {
1778
+		$give_updates->set_percentage($forms->found_posts, $give_updates->step * 100);
1779 1779
 
1780
-		while ( $forms->have_posts() ) {
1780
+		while ($forms->have_posts()) {
1781 1781
 			$forms->the_post();
1782 1782
 			global $post;
1783 1783
 
1784
-			if( $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_logs WHERE ID=%d", $post->ID ) ) ) {
1784
+			if ($wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_logs WHERE ID=%d", $post->ID))) {
1785 1785
 				continue;
1786 1786
 			}
1787 1787
 
1788
-			$term      = get_the_terms( $post->ID, 'give_log_type' );
1789
-			$term      = ! is_wp_error( $term ) && ! empty( $term ) ? $term[0] : array();
1790
-			$term_name = ! empty( $term ) ? $term->slug : '';
1788
+			$term      = get_the_terms($post->ID, 'give_log_type');
1789
+			$term      = ! is_wp_error($term) && ! empty($term) ? $term[0] : array();
1790
+			$term_name = ! empty($term) ? $term->slug : '';
1791 1791
 
1792 1792
 			$log_data = array(
1793 1793
 				'ID'           => $post->ID,
@@ -1800,29 +1800,29 @@  discard block
 block discarded – undo
1800 1800
 			);
1801 1801
 			$log_meta = array();
1802 1802
 
1803
-			if ( $old_log_meta = get_post_meta( $post->ID ) ) {
1804
-				foreach ( $old_log_meta as $meta_key => $meta_value ) {
1805
-					switch ( $meta_key ) {
1803
+			if ($old_log_meta = get_post_meta($post->ID)) {
1804
+				foreach ($old_log_meta as $meta_key => $meta_value) {
1805
+					switch ($meta_key) {
1806 1806
 						case '_give_log_payment_id':
1807
-							$log_data['log_parent']        = current( $meta_value );
1807
+							$log_data['log_parent']        = current($meta_value);
1808 1808
 							$log_meta['_give_log_form_id'] = $post->post_parent;
1809 1809
 							break;
1810 1810
 
1811 1811
 						default:
1812
-							$log_meta[ $meta_key ] = current( $meta_value );
1812
+							$log_meta[$meta_key] = current($meta_value);
1813 1813
 					}
1814 1814
 				}
1815 1815
 			}
1816 1816
 
1817
-			if ( 'api_request' === $term_name ) {
1817
+			if ('api_request' === $term_name) {
1818 1818
 				$log_meta['_give_log_api_query'] = $post->post_excerpt;
1819 1819
 			}
1820 1820
 
1821
-			$wpdb->insert( "{$wpdb->prefix}give_logs", $log_data );
1821
+			$wpdb->insert("{$wpdb->prefix}give_logs", $log_data);
1822 1822
 
1823
-			if ( ! empty( $log_meta ) ) {
1824
-				foreach ( $log_meta as $meta_key => $meta_value ) {
1825
-					Give()->logs->logmeta_db->update_meta( $post->ID, $meta_key, $meta_value );
1823
+			if ( ! empty($log_meta)) {
1824
+				foreach ($log_meta as $meta_key => $meta_value) {
1825
+					Give()->logs->logmeta_db->update_meta($post->ID, $meta_key, $meta_value);
1826 1826
 				}
1827 1827
 			}
1828 1828
 
@@ -1864,7 +1864,7 @@  discard block
 block discarded – undo
1864 1864
 		Give()->logs->delete_cache();
1865 1865
 
1866 1866
 		// No more forms found, finish up.
1867
-		give_set_upgrade_complete( 'v20_logs_upgrades' );
1867
+		give_set_upgrade_complete('v20_logs_upgrades');
1868 1868
 	}
1869 1869
 }
1870 1870
 
@@ -1880,19 +1880,19 @@  discard block
 block discarded – undo
1880 1880
 	$give_updates = Give_Updates::get_instance();
1881 1881
 
1882 1882
 	// form query
1883
-	$payments = new WP_Query( array(
1883
+	$payments = new WP_Query(array(
1884 1884
 			'paged'          => $give_updates->step,
1885 1885
 			'status'         => 'any',
1886 1886
 			'order'          => 'ASC',
1887
-			'post_type'      => array( 'give_forms', 'give_payment' ),
1887
+			'post_type'      => array('give_forms', 'give_payment'),
1888 1888
 			'posts_per_page' => 100,
1889 1889
 		)
1890 1890
 	);
1891 1891
 
1892
-	if ( $payments->have_posts() ) {
1893
-		$give_updates->set_percentage( $payments->found_posts, $give_updates->step * 100 );
1892
+	if ($payments->have_posts()) {
1893
+		$give_updates->set_percentage($payments->found_posts, $give_updates->step * 100);
1894 1894
 
1895
-		while ( $payments->have_posts() ) {
1895
+		while ($payments->have_posts()) {
1896 1896
 			$payments->the_post();
1897 1897
 			global $post;
1898 1898
 
@@ -1904,19 +1904,19 @@  discard block
 block discarded – undo
1904 1904
 				ARRAY_A
1905 1905
 			);
1906 1906
 
1907
-			if ( ! empty( $meta_data ) ) {
1908
-				foreach ( $meta_data as $index => $data ) {
1907
+			if ( ! empty($meta_data)) {
1908
+				foreach ($meta_data as $index => $data) {
1909 1909
 					// Check for duplicate meta values.
1910
-					if( $result = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM " . ( 'give_forms' === $post->post_type ? $wpdb->formmeta : $wpdb->paymentmeta ) .  " WHERE meta_id=%d", $data['meta_id'] ), ARRAY_A ) ) {
1910
+					if ($result = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".('give_forms' === $post->post_type ? $wpdb->formmeta : $wpdb->paymentmeta)." WHERE meta_id=%d", $data['meta_id']), ARRAY_A)) {
1911 1911
 						continue;
1912 1912
 					}
1913 1913
 					
1914
-					switch ( $post->post_type ) {
1914
+					switch ($post->post_type) {
1915 1915
 						case 'give_forms':
1916 1916
 							$data['form_id'] = $data['post_id'];
1917
-							unset( $data['post_id'] );
1917
+							unset($data['post_id']);
1918 1918
 
1919
-							Give()->form_meta->insert( $data );
1919
+							Give()->form_meta->insert($data);
1920 1920
 							// @todo: delete form meta from post meta table after releases 2.0.
1921 1921
 							/*delete_post_meta( get_the_ID(), $data['meta_key'] );*/
1922 1922
 
@@ -1924,9 +1924,9 @@  discard block
 block discarded – undo
1924 1924
 
1925 1925
 						case 'give_payment':
1926 1926
 							$data['payment_id'] = $data['post_id'];
1927
-							unset( $data['post_id'] );
1927
+							unset($data['post_id']);
1928 1928
 
1929
-							Give()->payment_meta->insert( $data );
1929
+							Give()->payment_meta->insert($data);
1930 1930
 
1931 1931
 							// @todo: delete donation meta from post meta table after releases 2.0.
1932 1932
 							/*delete_post_meta( get_the_ID(), $data['meta_key'] );*/
@@ -1941,7 +1941,7 @@  discard block
 block discarded – undo
1941 1941
 		wp_reset_postdata();
1942 1942
 	} else {
1943 1943
 		// No more forms found, finish up.
1944
-		give_set_upgrade_complete( 'v20_move_metadata_into_new_table' );
1944
+		give_set_upgrade_complete('v20_move_metadata_into_new_table');
1945 1945
 	}
1946 1946
 
1947 1947
 }
@@ -1957,44 +1957,44 @@  discard block
 block discarded – undo
1957 1957
 	/* @var Give_Updates $give_updates */
1958 1958
 	$give_updates = Give_Updates::get_instance();
1959 1959
 
1960
-	$donors = Give()->donors->get_donors( array(
1960
+	$donors = Give()->donors->get_donors(array(
1961 1961
 		'paged'  => $give_updates->step,
1962 1962
 		'number' => 100,
1963
-	) );
1963
+	));
1964 1964
 
1965
-	if ( $donors ) {
1966
-		$give_updates->set_percentage( count( $donors ), $give_updates->step * 100 );
1965
+	if ($donors) {
1966
+		$give_updates->set_percentage(count($donors), $give_updates->step * 100);
1967 1967
 		// Loop through Donors
1968
-		foreach ( $donors as $donor ) {
1968
+		foreach ($donors as $donor) {
1969 1969
 
1970
-			$donor_name       = explode( ' ', $donor->name, 2 );
1971
-			$donor_first_name = Give()->donor_meta->get_meta( $donor->id, '_give_donor_first_name' );
1972
-			$donor_last_name  = Give()->donor_meta->get_meta( $donor->id, '_give_donor_last_name' );
1970
+			$donor_name       = explode(' ', $donor->name, 2);
1971
+			$donor_first_name = Give()->donor_meta->get_meta($donor->id, '_give_donor_first_name');
1972
+			$donor_last_name  = Give()->donor_meta->get_meta($donor->id, '_give_donor_last_name');
1973 1973
 
1974 1974
 			// If first name meta of donor is not created, then create it.
1975
-			if ( ! $donor_first_name && isset( $donor_name[0] ) ) {
1976
-				Give()->donor_meta->add_meta( $donor->id, '_give_donor_first_name', $donor_name[0] );
1975
+			if ( ! $donor_first_name && isset($donor_name[0])) {
1976
+				Give()->donor_meta->add_meta($donor->id, '_give_donor_first_name', $donor_name[0]);
1977 1977
 			}
1978 1978
 
1979 1979
 			// If last name meta of donor is not created, then create it.
1980
-			if ( ! $donor_last_name && isset( $donor_name[1] ) ) {
1981
-				Give()->donor_meta->add_meta( $donor->id, '_give_donor_last_name', $donor_name[1] );
1980
+			if ( ! $donor_last_name && isset($donor_name[1])) {
1981
+				Give()->donor_meta->add_meta($donor->id, '_give_donor_last_name', $donor_name[1]);
1982 1982
 			}
1983 1983
 
1984 1984
 			// If Donor is connected with WP User then update user meta.
1985
-			if ( $donor->user_id ) {
1986
-				if ( isset( $donor_name[0] ) ) {
1987
-					update_user_meta( $donor->user_id, 'first_name', $donor_name[0] );
1985
+			if ($donor->user_id) {
1986
+				if (isset($donor_name[0])) {
1987
+					update_user_meta($donor->user_id, 'first_name', $donor_name[0]);
1988 1988
 				}
1989
-				if ( isset( $donor_name[1] ) ) {
1990
-					update_user_meta( $donor->user_id, 'last_name', $donor_name[1] );
1989
+				if (isset($donor_name[1])) {
1990
+					update_user_meta($donor->user_id, 'last_name', $donor_name[1]);
1991 1991
 				}
1992 1992
 			}
1993 1993
 		}
1994 1994
 
1995 1995
 	} else {
1996 1996
 		// The Update Ran.
1997
-		give_set_upgrade_complete( 'v20_upgrades_donor_name' );
1997
+		give_set_upgrade_complete('v20_upgrades_donor_name');
1998 1998
 	}
1999 1999
 
2000 2000
 }
@@ -2023,15 +2023,15 @@  discard block
 block discarded – undo
2023 2023
 
2024 2024
 	$users = $user_query->get_results();
2025 2025
 
2026
-	if ( $users ) {
2027
-		$give_updates->set_percentage( $user_query->get_total(), $give_updates->step * 100 );
2026
+	if ($users) {
2027
+		$give_updates->set_percentage($user_query->get_total(), $give_updates->step * 100);
2028 2028
 
2029 2029
 		// Loop through Donors
2030
-		foreach ( $users as $user ) {
2030
+		foreach ($users as $user) {
2031 2031
 			/* @var Give_Donor $donor */
2032
-			$donor = new Give_Donor( $user->ID, true );
2032
+			$donor = new Give_Donor($user->ID, true);
2033 2033
 
2034
-			if ( ! $donor->id ) {
2034
+			if ( ! $donor->id) {
2035 2035
 				continue;
2036 2036
 			}
2037 2037
 
@@ -2047,10 +2047,10 @@  discard block
 block discarded – undo
2047 2047
 				)
2048 2048
 			);
2049 2049
 
2050
-			if ( ! empty( $address ) ) {
2051
-				$address = maybe_unserialize( $address );
2052
-				$donor->add_address( 'personal', $address );
2053
-				$donor->add_address( 'billing[]', $address );
2050
+			if ( ! empty($address)) {
2051
+				$address = maybe_unserialize($address);
2052
+				$donor->add_address('personal', $address);
2053
+				$donor->add_address('billing[]', $address);
2054 2054
 
2055 2055
 
2056 2056
 				// @todo: delete _give_user_address from user meta after releases 2.0.
@@ -2060,7 +2060,7 @@  discard block
 block discarded – undo
2060 2060
 
2061 2061
 	} else {
2062 2062
 		// The Update Ran.
2063
-		give_set_upgrade_complete( 'v20_upgrades_user_address' );
2063
+		give_set_upgrade_complete('v20_upgrades_user_address');
2064 2064
 	}
2065 2065
 
2066 2066
 }
@@ -2084,15 +2084,15 @@  discard block
 block discarded – undo
2084 2084
 	);
2085 2085
 
2086 2086
 	// Alter customer table
2087
-	foreach ( $tables as $old_table => $new_table ) {
2087
+	foreach ($tables as $old_table => $new_table) {
2088 2088
 		if (
2089
-			$wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", $old_table ) ) &&
2090
-			! $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", $new_table ) )
2089
+			$wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", $old_table)) &&
2090
+			! $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", $new_table))
2091 2091
 		) {
2092
-			$wpdb->query( "ALTER TABLE {$old_table} RENAME TO {$new_table}" );
2092
+			$wpdb->query("ALTER TABLE {$old_table} RENAME TO {$new_table}");
2093 2093
 
2094
-			if ( "{$wpdb->prefix}give_donormeta" === $new_table ) {
2095
-				$wpdb->query( "ALTER TABLE {$new_table} CHANGE COLUMN customer_id donor_id bigint(20)" );
2094
+			if ("{$wpdb->prefix}give_donormeta" === $new_table) {
2095
+				$wpdb->query("ALTER TABLE {$new_table} CHANGE COLUMN customer_id donor_id bigint(20)");
2096 2096
 			}
2097 2097
 		}
2098 2098
 	}
@@ -2100,7 +2100,7 @@  discard block
 block discarded – undo
2100 2100
 	$give_updates->percentage = 100;
2101 2101
 
2102 2102
 	// No more forms found, finish up.
2103
-	give_set_upgrade_complete( 'v20_rename_donor_tables' );
2103
+	give_set_upgrade_complete('v20_rename_donor_tables');
2104 2104
 
2105 2105
 	// Re initiate donor classes.
2106 2106
 	Give()->donors     = new Give_DB_Donors();
Please login to merge, or discard this patch.
includes/admin/upgrades/class-give-updates.php 1 patch
Spacing   +132 added lines, -138 removed lines patch added patch discarded remove patch
@@ -80,34 +80,34 @@  discard block
 block discarded – undo
80 80
 	 *
81 81
 	 * @param array $args
82 82
 	 */
83
-	public function register( $args ) {
83
+	public function register($args) {
84 84
 		$args_default = array(
85 85
 			'id'       => '',
86 86
 			'version'  => '',
87 87
 			'callback' => '',
88 88
 		);
89 89
 
90
-		$args = wp_parse_args( $args, $args_default );
90
+		$args = wp_parse_args($args, $args_default);
91 91
 
92 92
 		// You can only register database upgrade.
93 93
 		$args['type'] = 'database';
94 94
 
95 95
 		// Bailout.
96 96
 		if (
97
-			empty( $args['id'] ) ||
98
-			empty( $args['version'] ) ||
99
-			empty( $args['callback'] ) ||
100
-			! is_callable( $args['callback'] )
97
+			empty($args['id']) ||
98
+			empty($args['version']) ||
99
+			empty($args['callback']) ||
100
+			! is_callable($args['callback'])
101 101
 		) {
102 102
 			return;
103 103
 		}
104 104
 
105 105
 		// Change depend param to array.
106
-		if ( isset( $args['depend'] ) && is_string( $args['depend'] ) ) {
107
-			$args['depend'] = array( $args['depend'] );
106
+		if (isset($args['depend']) && is_string($args['depend'])) {
107
+			$args['depend'] = array($args['depend']);
108 108
 		}
109 109
 
110
-		$this->updates[ $args['type'] ][] = $args;
110
+		$this->updates[$args['type']][] = $args;
111 111
 	}
112 112
 
113 113
 	/**
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 	 * @return static
119 119
 	 */
120 120
 	static function get_instance() {
121
-		if ( is_null( self::$instance ) ) {
121
+		if (is_null(self::$instance)) {
122 122
 			self::$instance = new self();
123 123
 		}
124 124
 
@@ -136,24 +136,24 @@  discard block
 block discarded – undo
136 136
 		/**
137 137
 		 * Load file
138 138
 		 */
139
-		require_once GIVE_PLUGIN_DIR . 'includes/class-give-background-updater.php';
140
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php';
139
+		require_once GIVE_PLUGIN_DIR.'includes/class-give-background-updater.php';
140
+		require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php';
141 141
 
142 142
 		self::$background_updater = new Give_Background_Updater();
143 143
 
144 144
 		/**
145 145
 		 * Setup hooks.
146 146
 		 */
147
-		add_action( 'init', array( $this, '__register_upgrade' ), 9999 );
148
-		add_action( 'give_set_upgrade_completed', array( $this, '__flush_resume_updates' ), 9999 );
149
-		add_action( 'wp_ajax_give_db_updates_info', array( $this, '__give_db_updates_info' ) );
150
-		add_action( 'wp_ajax_give_run_db_updates', array( $this, '__give_start_updating' ) );
151
-		add_action( 'admin_init', array( $this, '__redirect_admin' ) );
152
-		add_action( 'admin_notices', array( $this, '__show_notice' ) );
153
-
154
-		if ( is_admin() ) {
155
-			add_action( 'admin_init', array( $this, '__change_donations_label' ), 9999 );
156
-			add_action( 'admin_menu', array( $this, '__register_menu' ), 9999 );
147
+		add_action('init', array($this, '__register_upgrade'), 9999);
148
+		add_action('give_set_upgrade_completed', array($this, '__flush_resume_updates'), 9999);
149
+		add_action('wp_ajax_give_db_updates_info', array($this, '__give_db_updates_info'));
150
+		add_action('wp_ajax_give_run_db_updates', array($this, '__give_start_updating'));
151
+		add_action('admin_init', array($this, '__redirect_admin'));
152
+		add_action('admin_notices', array($this, '__show_notice'));
153
+
154
+		if (is_admin()) {
155
+			add_action('admin_init', array($this, '__change_donations_label'), 9999);
156
+			add_action('admin_menu', array($this, '__register_menu'), 9999);
157 157
 		}
158 158
 	}
159 159
 
@@ -167,12 +167,12 @@  discard block
 block discarded – undo
167 167
 		$addons         = give_get_plugins();
168 168
 		$plugin_updates = get_plugin_updates();
169 169
 
170
-		foreach ( $addons as $key => $info ) {
171
-			if ( 'active' != $info['Status'] || 'add-on' != $info['Type'] || empty( $plugin_updates[ $key ] ) ) {
170
+		foreach ($addons as $key => $info) {
171
+			if ('active' != $info['Status'] || 'add-on' != $info['Type'] || empty($plugin_updates[$key])) {
172 172
 				continue;
173 173
 			}
174 174
 
175
-			$this->updates['plugin'][] = array_merge( $info, (array) $plugin_updates[ $key ] );
175
+			$this->updates['plugin'][] = array_merge($info, (array) $plugin_updates[$key]);
176 176
 		}
177 177
 	}
178 178
 
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 	 * @access public
185 185
 	 */
186 186
 	public function __register_upgrade() {
187
-		if ( ! is_admin() ) {
187
+		if ( ! is_admin()) {
188 188
 			return;
189 189
 		}
190 190
 
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 		 *
194 194
 		 * @since 1.8.12
195 195
 		 */
196
-		do_action( 'give_register_updates', $this );
196
+		do_action('give_register_updates', $this);
197 197
 	}
198 198
 
199 199
 	/**
@@ -206,21 +206,20 @@  discard block
 block discarded – undo
206 206
 		global $menu;
207 207
 
208 208
 		// Bailout.
209
-		if ( empty( $menu ) || ! $this->get_total_update_count() ) {
209
+		if (empty($menu) || ! $this->get_total_update_count()) {
210 210
 			return;
211 211
 		}
212 212
 
213
-		foreach ( $menu as $index => $menu_item ) {
214
-			if ( 'edit.php?post_type=give_forms' !== $menu_item[2] ) {
213
+		foreach ($menu as $index => $menu_item) {
214
+			if ('edit.php?post_type=give_forms' !== $menu_item[2]) {
215 215
 				continue;
216 216
 			}
217 217
 
218
-			$menu[ $index ][0] = sprintf(
218
+			$menu[$index][0] = sprintf(
219 219
 				'%1$s <span class="update-plugins"><span class="plugin-count give-update-progress-count">%2$s%3$s</span></span>',
220
-				__( 'Donations', 'give' ),
220
+				__('Donations', 'give'),
221 221
 				$this->is_doing_updates() ?
222
-					$this->get_db_update_processing_percentage() :
223
-					$this->get_total_update_count(),
222
+					$this->get_db_update_processing_percentage() : $this->get_total_update_count(),
224 223
 				$this->is_doing_updates() ? '%' : ''
225 224
 			);
226 225
 
@@ -236,7 +235,7 @@  discard block
 block discarded – undo
236 235
 	 */
237 236
 	public function __register_menu() {
238 237
 		// Bailout.
239
-		if( ! give_test_ajax_works() ) {
238
+		if ( ! give_test_ajax_works()) {
240 239
 			return;
241 240
 		}
242 241
 
@@ -244,17 +243,17 @@  discard block
 block discarded – undo
244 243
 		$this->__register_plugin_addon_updates();
245 244
 
246 245
 		// Bailout.
247
-		if ( ! $this->get_total_update_count() ) {
246
+		if ( ! $this->get_total_update_count()) {
248 247
 			// Show complete update message if still on update setting page.
249
-			if ( isset( $_GET['page'] ) && 'give-updates' === $_GET['page'] ) {
248
+			if (isset($_GET['page']) && 'give-updates' === $_GET['page']) {
250 249
 				// Upgrades
251 250
 				add_submenu_page(
252 251
 					'edit.php?post_type=give_forms',
253
-					esc_html__( 'Give Updates Complete', 'give' ),
254
-					__( 'Updates', 'give' ),
252
+					esc_html__('Give Updates Complete', 'give'),
253
+					__('Updates', 'give'),
255 254
 					'manage_give_settings',
256 255
 					'give-updates',
257
-					array( $this, 'render_complete_page' )
256
+					array($this, 'render_complete_page')
258 257
 				);
259 258
 			}
260 259
 
@@ -264,18 +263,17 @@  discard block
 block discarded – undo
264 263
 		// Upgrades
265 264
 		add_submenu_page(
266 265
 			'edit.php?post_type=give_forms',
267
-			esc_html__( 'Give Updates', 'give' ),
266
+			esc_html__('Give Updates', 'give'),
268 267
 			sprintf(
269 268
 				'%1$s <span class="update-plugins"><span class="plugin-count give-update-progress-count">%2$s%3$s</span></span>',
270
-				__( 'Updates', 'give' ),
269
+				__('Updates', 'give'),
271 270
 				$this->is_doing_updates() ?
272
-					$this->get_db_update_processing_percentage() :
273
-					$this->get_total_update_count(),
271
+					$this->get_db_update_processing_percentage() : $this->get_total_update_count(),
274 272
 				$this->is_doing_updates() ? '%' : ''
275 273
 			),
276 274
 			'manage_give_settings',
277 275
 			'give-updates',
278
-			array( $this, 'render_page' )
276
+			array($this, 'render_page')
279 277
 		);
280 278
 	}
281 279
 
@@ -290,13 +288,13 @@  discard block
 block discarded – undo
290 288
 		// Show db upgrade completed notice.
291 289
 		if (
292 290
 			! wp_doing_ajax() &&
293
-			current_user_can( 'manage_give_settings' ) &&
294
-			get_option( 'give_show_db_upgrade_complete_notice' ) &&
295
-			! isset( $_GET['give-db-update-completed'] )
291
+			current_user_can('manage_give_settings') &&
292
+			get_option('give_show_db_upgrade_complete_notice') &&
293
+			! isset($_GET['give-db-update-completed'])
296 294
 		) {
297
-			delete_option( 'give_show_db_upgrade_complete_notice' );
295
+			delete_option('give_show_db_upgrade_complete_notice');
298 296
 
299
-			wp_redirect( add_query_arg( array( 'give-db-update-completed' => 'give_db_upgrade_completed' ) ) );
297
+			wp_redirect(add_query_arg(array('give-db-update-completed' => 'give_db_upgrade_completed')));
300 298
 			exit();
301 299
 		}
302 300
 	}
@@ -310,28 +308,28 @@  discard block
 block discarded – undo
310 308
 	 */
311 309
 	public function __show_notice() {
312 310
 		// Bailout.
313
-		if ( ! current_user_can( 'manage_give_settings' ) || $this->is_doing_updates() ) {
311
+		if ( ! current_user_can('manage_give_settings') || $this->is_doing_updates()) {
314 312
 			return;
315 313
 		}
316 314
 
317 315
 		// Run DB updates.
318
-		if ( ! empty( $_GET['give-run-db-update'] ) ) {
316
+		if ( ! empty($_GET['give-run-db-update'])) {
319 317
 			$this->run_db_update();
320 318
 		}
321 319
 
322 320
 
323 321
 		// Bailout.
324
-		if ( isset( $_GET['page'] ) && 'give-updates' === $_GET['page'] ) {
322
+		if (isset($_GET['page']) && 'give-updates' === $_GET['page']) {
325 323
 			return;
326 324
 		}
327 325
 
328 326
 		// Show notice if ajax is not working.
329
-		if ( ! give_test_ajax_works() ) {
327
+		if ( ! give_test_ajax_works()) {
330 328
 			Give()->notices->register_notice(
331 329
 				array(
332 330
 					'id'          => 'give_db_upgrade_ajax_inaccessible',
333 331
 					'type'        => 'error',
334
-					'description' => __( 'Give needs to upgrade the database but cannot because AJAX is not functioning properly. Please contact your host and ask them to ensure admin-ajax.php is accessible.', 'give' ),
332
+					'description' => __('Give needs to upgrade the database but cannot because AJAX is not functioning properly. Please contact your host and ask them to ensure admin-ajax.php is accessible.', 'give'),
335 333
 					'show'        => true,
336 334
 				)
337 335
 			);
@@ -340,46 +338,46 @@  discard block
 block discarded – undo
340 338
 		}
341 339
 
342 340
 		// Show db upgrade completed notice.
343
-		if ( ! empty( $_GET['give-db-update-completed'] ) ) {
344
-			Give()->notices->register_notice( array(
341
+		if ( ! empty($_GET['give-db-update-completed'])) {
342
+			Give()->notices->register_notice(array(
345 343
 				'id'          => 'give_db_upgrade_completed',
346 344
 				'type'        => 'updated',
347
-				'description' => __( 'Give database updates completed successfully. Thank you for updating to the latest version!', 'give' ),
345
+				'description' => __('Give database updates completed successfully. Thank you for updating to the latest version!', 'give'),
348 346
 				'show'        => true,
349
-			) );
347
+			));
350 348
 
351 349
 			// Start update.
352
-		} elseif ( ! empty( $_GET['give-run-db-update'] ) ) {
350
+		} elseif ( ! empty($_GET['give-run-db-update'])) {
353 351
 			$this->run_db_update();
354 352
 
355 353
 			// Show run the update notice.
356
-		} elseif ( $this->get_total_new_db_update_count() ) {
354
+		} elseif ($this->get_total_new_db_update_count()) {
357 355
 			ob_start();
358 356
 			?>
359 357
 			<p>
360
-				<strong><?php _e( 'Database Update', 'give' ); ?></strong>
361
-				&nbsp;&#8211;&nbsp;<?php _e( 'GiveWP needs to update your database to the latest version. The following process will make updates to your site\'s database. Please create a complete backup before proceeding.', 'give' ); ?>
358
+				<strong><?php _e('Database Update', 'give'); ?></strong>
359
+				&nbsp;&#8211;&nbsp;<?php _e('GiveWP needs to update your database to the latest version. The following process will make updates to your site\'s database. Please create a complete backup before proceeding.', 'give'); ?>
362 360
 			</p>
363 361
 			<p class="submit">
364
-				<a href="<?php echo esc_url( add_query_arg( array( 'give-run-db-update' => 1 ), admin_url( 'edit.php?post_type=give_forms&page=give-updates' ) ) ); ?>" class="button button-primary give-run-update-now">
365
-					<?php _e( 'Run the updater', 'woocommerce' ); ?>
362
+				<a href="<?php echo esc_url(add_query_arg(array('give-run-db-update' => 1), admin_url('edit.php?post_type=give_forms&page=give-updates'))); ?>" class="button button-primary give-run-update-now">
363
+					<?php _e('Run the updater', 'woocommerce'); ?>
366 364
 				</a>
367 365
 			</p>
368 366
 			<script type="text/javascript">
369 367
 				jQuery('.give-run-update-now').click('click', function () {
370
-					return window.confirm('<?php echo esc_js( __( 'It is strongly recommended that you backup your database before proceeding. Do you want to run the update now?', 'give' ) ); ?>'); // jshint ignore:line
368
+					return window.confirm('<?php echo esc_js(__('It is strongly recommended that you backup your database before proceeding. Do you want to run the update now?', 'give')); ?>'); // jshint ignore:line
371 369
 				});
372 370
 			</script>
373 371
 			<?php
374 372
 			$desc_html = ob_get_clean();
375 373
 
376 374
 
377
-			Give()->notices->register_notice( array(
375
+			Give()->notices->register_notice(array(
378 376
 				'id'          => 'give_upgrade_db',
379 377
 				'type'        => 'updated',
380 378
 				'dismissible' => false,
381 379
 				'description' => $desc_html,
382
-			) );
380
+			));
383 381
 		}
384 382
 	}
385 383
 
@@ -390,7 +388,7 @@  discard block
 block discarded – undo
390 388
 	 * @access public
391 389
 	 */
392 390
 	public function render_complete_page() {
393
-		include_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/views/upgrades-complete.php';
391
+		include_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/views/upgrades-complete.php';
394 392
 	}
395 393
 
396 394
 	/**
@@ -400,7 +398,7 @@  discard block
 block discarded – undo
400 398
 	 * @access public
401 399
 	 */
402 400
 	public function render_page() {
403
-		include_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/views/upgrades.php';
401
+		include_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/views/upgrades.php';
404 402
 	}
405 403
 
406 404
 	/**
@@ -411,26 +409,26 @@  discard block
 block discarded – undo
411 409
 	 */
412 410
 	private function run_db_update() {
413 411
 		// Bailout.
414
-		if ( $this->is_doing_updates() || ! $this->get_total_new_db_update_count() ) {
412
+		if ($this->is_doing_updates() || ! $this->get_total_new_db_update_count()) {
415 413
 			return;
416 414
 		}
417 415
 
418
-		$updates = $this->get_updates( 'database', 'new' );
416
+		$updates = $this->get_updates('database', 'new');
419 417
 
420
-		foreach ( $updates as $update ) {
421
-			self::$background_updater->push_to_queue( $update );
418
+		foreach ($updates as $update) {
419
+			self::$background_updater->push_to_queue($update);
422 420
 		}
423 421
 
424
-		add_option( 'give_db_update_count', count( $updates ), '', 'no' );
422
+		add_option('give_db_update_count', count($updates), '', 'no');
425 423
 
426
-		add_option( 'give_doing_upgrade', array(
424
+		add_option('give_doing_upgrade', array(
427 425
 			'update_info' => $updates[0],
428 426
 			'step'        => 1,
429 427
 			'update'      => 1,
430
-			'heading'     => sprintf( 'Update %s of %s', 1, count( $updates ) ),
428
+			'heading'     => sprintf('Update %s of %s', 1, count($updates)),
431 429
 			'percentage'  => 0,
432 430
 			'total_percentage'  => 0,
433
-		), '', 'no' );
431
+		), '', 'no');
434 432
 
435 433
 		self::$background_updater->save()->dispatch();
436 434
 	}
@@ -444,11 +442,11 @@  discard block
 block discarded – undo
444 442
 	 */
445 443
 	public function __flush_resume_updates() {
446 444
 		//delete_option( 'give_doing_upgrade' );
447
-		update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
445
+		update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
448 446
 
449 447
 		// Reset counter.
450 448
 		$this->step = $this->percentage = 0;
451
-		++ $this->update;
449
+		++$this->update;
452 450
 	}
453 451
 
454 452
 
@@ -463,7 +461,7 @@  discard block
 block discarded – undo
463 461
 	public function __give_start_updating() {
464 462
 		// Check permission.
465 463
 		if (
466
-			! current_user_can( 'manage_give_settings' ) ||
464
+			! current_user_can('manage_give_settings') ||
467 465
 			$this->is_doing_updates()
468 466
 		) {
469 467
 			wp_send_json_error();
@@ -471,7 +469,7 @@  discard block
 block discarded – undo
471 469
 
472 470
 		// @todo: validate nonce
473 471
 		// @todo: set http method to post
474
-		if ( empty( $_POST['run_db_update'] ) ) {
472
+		if (empty($_POST['run_db_update'])) {
475 473
 			wp_send_json_error();
476 474
 		}
477 475
 
@@ -490,21 +488,21 @@  discard block
 block discarded – undo
490 488
 	 * @return string
491 489
 	 */
492 490
 	public function __give_db_updates_info() {
493
-		$update_info   = get_option( 'give_doing_upgrade' );
491
+		$update_info   = get_option('give_doing_upgrade');
494 492
 		$response_type = '';
495 493
 
496
-		if ( empty( $update_info ) && ! $this->get_pending_db_update_count() ) {
497
-			$update_info   = array(
498
-				'message'    => __( 'Give database updates completed successfully. Thank you for updating to the latest version!', 'give' ),
499
-				'heading'    => __( 'Updates Completed.', 'give' ),
494
+		if (empty($update_info) && ! $this->get_pending_db_update_count()) {
495
+			$update_info = array(
496
+				'message'    => __('Give database updates completed successfully. Thank you for updating to the latest version!', 'give'),
497
+				'heading'    => __('Updates Completed.', 'give'),
500 498
 				'percentage' => 0,
501 499
 			);
502 500
 			$response_type = 'success';
503 501
 
504
-			delete_option( 'give_show_db_upgrade_complete_notice' );
502
+			delete_option('give_show_db_upgrade_complete_notice');
505 503
 		}
506 504
 
507
-		$this->send_ajax_response( $update_info, $response_type );
505
+		$this->send_ajax_response($update_info, $response_type);
508 506
 	}
509 507
 
510 508
 	/**
@@ -516,7 +514,7 @@  discard block
 block discarded – undo
516 514
 	 * @param        $data
517 515
 	 * @param string $type
518 516
 	 */
519
-	public function send_ajax_response( $data, $type = '' ) {
517
+	public function send_ajax_response($data, $type = '') {
520 518
 		$default = array(
521 519
 			'message'    => '',
522 520
 			'heading'    => '',
@@ -526,24 +524,24 @@  discard block
 block discarded – undo
526 524
 		);
527 525
 
528 526
 		// Set data.
529
-		$data = wp_parse_args( $data, $default );
527
+		$data = wp_parse_args($data, $default);
530 528
 
531 529
 		// Enable cache.
532 530
 		Give_Cache::enable();
533 531
 
534
-		switch ( $type ) {
532
+		switch ($type) {
535 533
 			case 'success':
536
-				wp_send_json_success( $data );
534
+				wp_send_json_success($data);
537 535
 				break;
538 536
 
539 537
 			case 'error':
540
-				wp_send_json_error( $data );
538
+				wp_send_json_error($data);
541 539
 				break;
542 540
 
543 541
 			default:
544
-				wp_send_json( array(
542
+				wp_send_json(array(
545 543
 					'data' => $data,
546
-				) );
544
+				));
547 545
 				break;
548 546
 		}
549 547
 	}
@@ -557,12 +555,12 @@  discard block
 block discarded – undo
557 555
 	 * @param $total
558 556
 	 * @param $current_total
559 557
 	 */
560
-	public function set_percentage( $total, $current_total ) {
558
+	public function set_percentage($total, $current_total) {
561 559
 		// Set percentage.
562
-		$this->percentage = $total ? ( ( $current_total ) / $total ) * 100 : 0;
560
+		$this->percentage = $total ? (($current_total) / $total) * 100 : 0;
563 561
 
564 562
 		// Verify percentage.
565
-		$this->percentage = ( 100 < $this->percentage ) ? 100 : $this->percentage;
563
+		$this->percentage = (100 < $this->percentage) ? 100 : $this->percentage;
566 564
 	}
567 565
 
568 566
 	/**
@@ -575,22 +573,22 @@  discard block
 block discarded – undo
575 573
 	 *
576 574
 	 * @return bool|null
577 575
 	 */
578
-	public function is_parent_updates_completed( $update ) {
576
+	public function is_parent_updates_completed($update) {
579 577
 		// Bailout.
580
-		if ( empty( $update['depend'] ) ) {
578
+		if (empty($update['depend'])) {
581 579
 			return true;
582 580
 		}
583 581
 
584 582
 		// Check if dependency is valid or not.
585
-		if ( ! $this->has_valid_dependency( $update ) ) {
583
+		if ( ! $this->has_valid_dependency($update)) {
586 584
 			return null;
587 585
 		}
588 586
 
589 587
 		$is_dependency_completed = true;
590 588
 
591
-		foreach ( $update['depend'] as $depend ) {
589
+		foreach ($update['depend'] as $depend) {
592 590
 
593
-			if ( ! give_has_upgrade_completed( $depend ) ) {
591
+			if ( ! give_has_upgrade_completed($depend)) {
594 592
 				$is_dependency_completed = false;
595 593
 				break;
596 594
 			}
@@ -607,7 +605,7 @@  discard block
 block discarded – undo
607 605
 	 * @return bool
608 606
 	 */
609 607
 	public function is_doing_updates() {
610
-		return (bool) get_option( 'give_doing_upgrade' );
608
+		return (bool) get_option('give_doing_upgrade');
611 609
 	}
612 610
 
613 611
 
@@ -621,13 +619,13 @@  discard block
 block discarded – undo
621 619
 	 *
622 620
 	 * @return bool
623 621
 	 */
624
-	public function has_valid_dependency( $update ) {
622
+	public function has_valid_dependency($update) {
625 623
 		$is_valid_dependency = true;
626
-		$update_ids          = wp_list_pluck( $this->get_updates( 'database' ), 'id' );
624
+		$update_ids          = wp_list_pluck($this->get_updates('database'), 'id');
627 625
 
628
-		foreach ( $update['depend'] as $depend ) {
626
+		foreach ($update['depend'] as $depend) {
629 627
 			// Check if dependency is valid or not.
630
-			if ( ! in_array( $depend, $update_ids ) ) {
628
+			if ( ! in_array($depend, $update_ids)) {
631 629
 				$is_valid_dependency = false;
632 630
 				break;
633 631
 			}
@@ -647,32 +645,32 @@  discard block
 block discarded – undo
647 645
 	 *
648 646
 	 * @return array
649 647
 	 */
650
-	public function get_updates( $update_type = '', $status = 'all' ) {
648
+	public function get_updates($update_type = '', $status = 'all') {
651 649
 		// return all updates.
652
-		if ( empty( $update_type ) ) {
650
+		if (empty($update_type)) {
653 651
 			return $this->updates;
654 652
 		}
655 653
 
656 654
 		// Get specific update.
657
-		$updates = ! empty( $this->updates[ $update_type ] ) ? $this->updates[ $update_type ] : array();
655
+		$updates = ! empty($this->updates[$update_type]) ? $this->updates[$update_type] : array();
658 656
 
659 657
 		// Bailout.
660
-		if ( empty( $updates ) ) {
658
+		if (empty($updates)) {
661 659
 			return $updates;
662 660
 		}
663 661
 
664
-		switch ( $status ) {
662
+		switch ($status) {
665 663
 			case 'new':
666 664
 				// Remove already completed updates.
667 665
 				$completed_updates = give_get_completed_upgrades();
668 666
 
669
-				if ( ! empty( $completed_updates ) ) {
670
-					foreach ( $updates as $index => $update ) {
671
-						if ( in_array( $update['id'], $completed_updates ) ) {
672
-							unset( $updates[ $index ] );
667
+				if ( ! empty($completed_updates)) {
668
+					foreach ($updates as $index => $update) {
669
+						if (in_array($update['id'], $completed_updates)) {
670
+							unset($updates[$index]);
673 671
 						}
674 672
 					}
675
-					$updates = array_values( $updates );
673
+					$updates = array_values($updates);
676 674
 				}
677 675
 
678 676
 				break;
@@ -689,7 +687,7 @@  discard block
 block discarded – undo
689 687
 	 * @return int
690 688
 	 */
691 689
 	public function get_total_plugin_update_count() {
692
-		return count( $this->get_updates( 'plugin' ) );
690
+		return count($this->get_updates('plugin'));
693 691
 	}
694 692
 
695 693
 	/**
@@ -704,7 +702,7 @@  discard block
 block discarded – undo
704 702
 		$db_update_count     = $this->get_pending_db_update_count();
705 703
 		$plugin_update_count = $this->get_total_plugin_update_count();
706 704
 
707
-		return ( $db_update_count + $plugin_update_count );
705
+		return ($db_update_count + $plugin_update_count);
708 706
 	}
709 707
 
710 708
 	/**
@@ -716,7 +714,7 @@  discard block
 block discarded – undo
716 714
 	 * @return int
717 715
 	 */
718 716
 	public function get_pending_db_update_count() {
719
-		return count( $this->get_updates( 'database', 'new' ) );
717
+		return count($this->get_updates('database', 'new'));
720 718
 	}
721 719
 
722 720
 	/**
@@ -728,7 +726,7 @@  discard block
 block discarded – undo
728 726
 	 * @return int
729 727
 	 */
730 728
 	public function get_total_db_update_count() {
731
-		return count( $this->get_updates( 'database', 'all' ) );
729
+		return count($this->get_updates('database', 'all'));
732 730
 	}
733 731
 
734 732
 	/**
@@ -741,8 +739,7 @@  discard block
 block discarded – undo
741 739
 	 */
742 740
 	public function get_total_new_db_update_count() {
743 741
 		return $this->is_doing_updates() ?
744
-			get_option( 'give_db_update_count' ) :
745
-			$this->get_pending_db_update_count();
742
+			get_option('give_db_update_count') : $this->get_pending_db_update_count();
746 743
 	}
747 744
 
748 745
 	/**
@@ -754,11 +751,10 @@  discard block
 block discarded – undo
754 751
 	 * @return int
755 752
 	 */
756 753
 	public function get_running_db_update() {
757
-		$current_update = get_option( 'give_doing_upgrade' );
754
+		$current_update = get_option('give_doing_upgrade');
758 755
 
759 756
 		return $this->is_doing_updates() ?
760
-			$current_update['update'] :
761
-			1;
757
+			$current_update['update'] : 1;
762 758
 	}
763 759
 
764 760
 	/**
@@ -770,23 +766,21 @@  discard block
 block discarded – undo
770 766
 	 */
771 767
 	public function get_db_update_processing_percentage() {
772 768
 		// Bailout.
773
-		if ( ! $this->get_total_new_db_update_count() ) {
769
+		if ( ! $this->get_total_new_db_update_count()) {
774 770
 			return 0;
775 771
 		}
776 772
 
777
-		$resume_update            = get_option( 'give_doing_upgrade' );
778
-		$update_count_percentages = ( ( $this->get_running_db_update() - 1 ) / $this->get_total_new_db_update_count() ) * 100;
779
-		$update_percentage_share  = ( 1 / $this->get_total_new_db_update_count() ) * 100;
780
-		$upgrade_percentage       = ( ( $resume_update['percentage'] * $update_percentage_share ) / 100 );
773
+		$resume_update            = get_option('give_doing_upgrade');
774
+		$update_count_percentages = (($this->get_running_db_update() - 1) / $this->get_total_new_db_update_count()) * 100;
775
+		$update_percentage_share  = (1 / $this->get_total_new_db_update_count()) * 100;
776
+		$upgrade_percentage       = (($resume_update['percentage'] * $update_percentage_share) / 100);
781 777
 
782 778
 		$final_percentage = $update_count_percentages + $upgrade_percentage;
783 779
 
784 780
 		return $this->is_doing_updates() ?
785
-			( absint( $final_percentage ) ?
786
-				absint( $final_percentage ) :
787
-				round( $final_percentage, 2 )
788
-			) :
789
-			0;
781
+			(absint($final_percentage) ?
782
+				absint($final_percentage) : round($final_percentage, 2)
783
+			) : 0;
790 784
 	}
791 785
 }
792 786
 
Please login to merge, or discard this patch.
includes/admin/upgrades/views/upgrades.php 1 patch
Spacing   +21 added lines, -22 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
 
@@ -18,36 +18,35 @@  discard block
 block discarded – undo
18 18
 ?>
19 19
 <div class="wrap" id="poststuff">
20 20
 	<div id="give-updates">
21
-		<h1 id="give-updates-h1"><?php esc_html_e( 'Give - Updates', 'give' ); ?></h1>
21
+		<h1 id="give-updates-h1"><?php esc_html_e('Give - Updates', 'give'); ?></h1>
22 22
 		<hr class="wp-header-end">
23 23
 
24 24
 		<div class="give-update-panel-content">
25
-			<p><?php printf( __( 'Give regularly receives new features, bug fixes, and enhancements. It is important to always stay up-to-date with latest version of Give core and its add-ons.  Please create a backup of your site before updating. To update add-ons be sure your <a href="%1$s">license keys</a> are activated.', 'give' ), 'https://givewp.com/my-account/' ); ?></p>
25
+			<p><?php printf(__('Give regularly receives new features, bug fixes, and enhancements. It is important to always stay up-to-date with latest version of Give core and its add-ons.  Please create a backup of your site before updating. To update add-ons be sure your <a href="%1$s">license keys</a> are activated.', 'give'), 'https://givewp.com/my-account/'); ?></p>
26 26
 		</div>
27 27
 
28 28
 		<?php $db_updates = $give_updates->get_pending_db_update_count(); ?>
29
-		<?php if ( ! empty( $db_updates ) ) : ?>
29
+		<?php if ( ! empty($db_updates)) : ?>
30 30
 			<?php
31 31
 			$is_doing_updates = $give_updates->is_doing_updates();
32
-			$db_update_url    = add_query_arg( array( 'type' => 'database', ) );
33
-			$resume_updates   = get_option( 'give_doing_upgrade' );
34
-			$width            = ! empty( $resume_updates ) ? $resume_updates['percentage'] : 0;
32
+			$db_update_url    = add_query_arg(array('type' => 'database',));
33
+			$resume_updates   = get_option('give_doing_upgrade');
34
+			$width            = ! empty($resume_updates) ? $resume_updates['percentage'] : 0;
35 35
 			?>
36
-			<div id="give-db-updates" data-resume-update="<?php echo absint( $give_updates->is_doing_updates() ); ?>">
36
+			<div id="give-db-updates" data-resume-update="<?php echo absint($give_updates->is_doing_updates()); ?>">
37 37
 				<div class="postbox-container">
38 38
 					<div class="postbox">
39
-						<h2 class="hndle"><?php _e( 'Database Updates', 'give' ); ?></h2>
39
+						<h2 class="hndle"><?php _e('Database Updates', 'give'); ?></h2>
40 40
 						<div class="inside">
41 41
 							<div class="panel-content">
42 42
 								<p class="give-update-button">
43 43
 									<?php echo sprintf(
44
-										__( '%1$s <a href="%2$s" class="%3$s">%4$s</a>', 'give' ),
44
+										__('%1$s <a href="%2$s" class="%3$s">%4$s</a>', 'give'),
45 45
 										$is_doing_updates ?
46
-											__( 'Give is currently updating the database in the background.', 'give' ) :
47
-											__( 'Give needs to update the database.', 'give' ),
46
+											__('Give is currently updating the database in the background.', 'give') : __('Give needs to update the database.', 'give'),
48 47
 										$db_update_url,
49
-										( $is_doing_updates ? 'give-hidden' : '' ),
50
-										__( 'Update now', 'give' )
48
+										($is_doing_updates ? 'give-hidden' : ''),
49
+										__('Update now', 'give')
51 50
 									);
52 51
 									?>
53 52
 								</p>
@@ -57,7 +56,7 @@  discard block
 block discarded – undo
57 56
 									<strong>
58 57
 										<?php
59 58
 										echo sprintf(
60
-											__( 'Update %s of %s', 'give' ),
59
+											__('Update %s of %s', 'give'),
61 60
 											$give_updates->get_running_db_update(),
62 61
 											$give_updates->get_total_new_db_update_count()
63 62
 										);
@@ -65,7 +64,7 @@  discard block
 block discarded – undo
65 64
 									</strong>
66 65
 								</p>
67 66
 								<div class="progress-content">
68
-									<?php if ( $is_doing_updates ) : ?>
67
+									<?php if ($is_doing_updates) : ?>
69 68
 										<div class="notice-wrap give-clearfix">
70 69
 											<span class="spinner is-active"></span>
71 70
 											<div class="give-progress">
@@ -76,7 +75,7 @@  discard block
 block discarded – undo
76 75
 								</div>
77 76
 							</div>
78 77
 
79
-							<?php if( ! $is_doing_updates ) : ?>
78
+							<?php if ( ! $is_doing_updates) : ?>
80 79
 								<div class="give-run-database-update"></div>
81 80
 							<?php endif; ?>
82 81
 						</div>
@@ -87,17 +86,17 @@  discard block
 block discarded – undo
87 86
 		<?php endif; ?>
88 87
 
89 88
 		<?php $plugin_updates = $give_updates->get_total_plugin_update_count(); ?>
90
-		<?php if ( ! empty( $plugin_updates ) ) : ?>
91
-			<?php $plugin_update_url = add_query_arg( array(
89
+		<?php if ( ! empty($plugin_updates)) : ?>
90
+			<?php $plugin_update_url = add_query_arg(array(
92 91
 				's' => 'Give',
93
-			), admin_url( '/plugins.php' ) ); ?>
92
+			), admin_url('/plugins.php')); ?>
94 93
 			<div id="give-plugin-updates">
95 94
 				<div class="postbox-container">
96 95
 					<div class="postbox">
97
-						<h2 class="hndle"><?php _e( 'Add-on Updates', 'give' ); ?></h2>
96
+						<h2 class="hndle"><?php _e('Add-on Updates', 'give'); ?></h2>
98 97
 						<div class="inside">
99 98
 							<div class="panel-content">
100
-								<p><?php echo sprintf( __( 'There %1$s %2$s Give %3$s that %4$s to be updated. <a href="%5$s">Update now</a>', 'give' ), _n( 'is', 'are', $plugin_updates, 'give' ), $plugin_updates, _n( 'add-on', 'add-ons', $plugin_updates, 'give' ), _n( 'needs', 'need', $plugin_updates, 'give' ), $plugin_update_url ); ?></p>
99
+								<p><?php echo sprintf(__('There %1$s %2$s Give %3$s that %4$s to be updated. <a href="%5$s">Update now</a>', 'give'), _n('is', 'are', $plugin_updates, 'give'), $plugin_updates, _n('add-on', 'add-ons', $plugin_updates, 'give'), _n('needs', 'need', $plugin_updates, 'give'), $plugin_update_url); ?></p>
101 100
 								<?php include_once 'plugins-update-section.php'; ?>
102 101
 							</div>
103 102
 						</div>
Please login to merge, or discard this patch.
includes/admin/views/html-admin-settings.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -2,12 +2,12 @@  discard block
 block discarded – undo
2 2
 /**
3 3
  * Admin View: Settings
4 4
  */
5
-if ( ! defined( 'ABSPATH' ) ) {
5
+if ( ! defined('ABSPATH')) {
6 6
 	exit;
7 7
 }
8 8
 
9 9
 // Bailout: Do not output anything if setting tab is not defined.
10
-if ( ! empty( $tabs ) && array_key_exists( give_get_current_setting_tab(), $tabs ) ) :
10
+if ( ! empty($tabs) && array_key_exists(give_get_current_setting_tab(), $tabs)) :
11 11
 	/**
12 12
 	 * Filter the form action.
13 13
 	 *
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 	 *
18 18
 	 * @since 1.8
19 19
 	 */
20
-	$form_method = apply_filters( self::$setting_filter_prefix . '_form_method_tab_' . $current_tab, 'post' );
20
+	$form_method = apply_filters(self::$setting_filter_prefix.'_form_method_tab_'.$current_tab, 'post');
21 21
 
22 22
 	/**
23 23
 	 * Filter the main form tab.
@@ -29,14 +29,14 @@  discard block
 block discarded – undo
29 29
 	 *
30 30
 	 * @since 1.8
31 31
 	 */
32
-	$form_open_tag  = apply_filters( self::$setting_filter_prefix . '_open_form', '<form method="' . $form_method . '" id="give-mainform" action="" enctype="multipart/form-data">' );
33
-	$form_close_tag = apply_filters( self::$setting_filter_prefix . '_close_form', '</form>' );
32
+	$form_open_tag  = apply_filters(self::$setting_filter_prefix.'_open_form', '<form method="'.$form_method.'" id="give-mainform" action="" enctype="multipart/form-data">');
33
+	$form_close_tag = apply_filters(self::$setting_filter_prefix.'_close_form', '</form>');
34 34
 
35
-	$wrapper_class = implode( ' ',
35
+	$wrapper_class = implode(' ',
36 36
 		array(
37
-			self::$setting_filter_prefix . '-setting-page',
38
-			self::$setting_filter_prefix . '-' . give_get_current_setting_section() . '-section',
39
-			self::$setting_filter_prefix . '-' . give_get_current_setting_tab() . '-tab',
37
+			self::$setting_filter_prefix.'-setting-page',
38
+			self::$setting_filter_prefix.'-'.give_get_current_setting_section().'-section',
39
+			self::$setting_filter_prefix.'-'.give_get_current_setting_tab().'-tab',
40 40
 		)
41 41
 	);
42 42
 	?>
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
 
47 47
 		/* @var Give_Settings_Page $current_setting_obj */
48 48
 		if (
49
-			! empty( $current_setting_obj ) &&
50
-			method_exists( $current_setting_obj, 'get_heading_html' )
49
+			! empty($current_setting_obj) &&
50
+			method_exists($current_setting_obj, 'get_heading_html')
51 51
 		) {
52 52
 			echo $current_setting_obj->get_heading_html();
53 53
 		} else {
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 			// Backward compatibility.
56 56
 			echo sprintf(
57 57
 				'<h1 class="wp-heading-inline">%s</h1><hr class="wp-header-end">',
58
-				esc_html( $tabs[ $current_tab ] )
58
+				esc_html($tabs[$current_tab])
59 59
 			);
60 60
 		}
61 61
 
@@ -63,8 +63,8 @@  discard block
 block discarded – undo
63 63
 		?>
64 64
 		<div class="nav-tab-wrapper give-nav-tab-wrapper">
65 65
 			<?php
66
-			foreach ( $tabs as $name => $label ) {
67
-				echo '<a href="' . admin_url( "edit.php?post_type=give_forms&page=" . self::$setting_filter_prefix . "&tab={$name}" ) . '" class="nav-tab ' . ( $current_tab === $name ? 'nav-tab-active' : 'give-mobile-hidden' ) . '">' . $label . '</a>';
66
+			foreach ($tabs as $name => $label) {
67
+				echo '<a href="'.admin_url("edit.php?post_type=give_forms&page=".self::$setting_filter_prefix."&tab={$name}").'" class="nav-tab '.($current_tab === $name ? 'nav-tab-active' : 'give-mobile-hidden').'">'.$label.'</a>';
68 68
 			}
69 69
 
70 70
 			/**
@@ -76,10 +76,10 @@  discard block
 block discarded – undo
76 76
 			 *
77 77
 			 * @since 1.8
78 78
 			 */
79
-			do_action( self::$setting_filter_prefix . '_tabs' );
79
+			do_action(self::$setting_filter_prefix.'_tabs');
80 80
 			?>
81 81
 			<div class="give-sub-nav-tab-wrapper">
82
-				<a href="#" id="give-show-sub-nav" class="nav-tab give-not-tab" title="<?php _e( 'View remaining setting tabs', 'give' ); ?>"><span class="dashicons dashicons-arrow-down-alt2"></span></span>
82
+				<a href="#" id="give-show-sub-nav" class="nav-tab give-not-tab" title="<?php _e('View remaining setting tabs', 'give'); ?>"><span class="dashicons dashicons-arrow-down-alt2"></span></span>
83 83
 				</a>
84 84
 				<nav class="give-sub-nav-tab give-hidden"></nav>
85 85
 			</div>
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 		 *
96 96
 		 * @since 1.8
97 97
 		 */
98
-		do_action( self::$setting_filter_prefix . "_sections_{$current_tab}_page" );
98
+		do_action(self::$setting_filter_prefix."_sections_{$current_tab}_page");
99 99
 
100 100
 		/**
101 101
 		 * Trigger Action.
@@ -106,15 +106,15 @@  discard block
 block discarded – undo
106 106
 		 *
107 107
 		 * @since 1.8
108 108
 		 */
109
-		do_action( self::$setting_filter_prefix . "_settings_{$current_tab}_page" );
109
+		do_action(self::$setting_filter_prefix."_settings_{$current_tab}_page");
110 110
 
111
-		if ( empty( $GLOBALS['give_hide_save_button'] ) ) : ?>
111
+		if (empty($GLOBALS['give_hide_save_button'])) : ?>
112 112
 			<div class="give-submit-wrap">
113
-				<?php wp_nonce_field( 'give-save-settings', '_give-save-settings' ); ?>
114
-				<input name="save" class="button-primary give-save-button" type="submit" value="<?php _e( 'Save changes', 'give' ); ?>"/>
113
+				<?php wp_nonce_field('give-save-settings', '_give-save-settings'); ?>
114
+				<input name="save" class="button-primary give-save-button" type="submit" value="<?php _e('Save changes', 'give'); ?>"/>
115 115
 			</div>
116 116
 		<?php endif; ?>
117 117
 		<?php echo $form_close_tag; ?>
118 118
 	</div>
119
-<?php else : echo '<div class="error"><p>' . __( 'Oops, this settings page does not exist.', 'give' ) . '</p></div>'; ?>
119
+<?php else : echo '<div class="error"><p>'.__('Oops, this settings page does not exist.', 'give').'</p></div>'; ?>
120 120
 <?php endif; ?>
121 121
\ No newline at end of file
Please login to merge, or discard this patch.