Completed
Pull Request — master (#1201)
by Ravinder
23:20
created
includes/admin/reporting/graphing.php 1 patch
Spacing   +243 added lines, -243 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 	$dates = give_get_report_dates();
26 26
 
27 27
 	// Determine graph options
28
-	switch ( $dates['range'] ) :
28
+	switch ($dates['range']) :
29 29
 		case 'today' :
30 30
 		case 'yesterday' :
31 31
 			$day_by_day = true;
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 			$day_by_day = false;
38 38
 			break;
39 39
 		case 'other' :
40
-			if ( $dates['m_end'] - $dates['m_start'] >= 2 || $dates['year_end'] > $dates['year'] && ( $dates['m_start'] != '12' && $dates['m_end'] != '1' ) ) {
40
+			if ($dates['m_end'] - $dates['m_start'] >= 2 || $dates['year_end'] > $dates['year'] && ($dates['m_start'] != '12' && $dates['m_end'] != '1')) {
41 41
 				$day_by_day = false;
42 42
 			} else {
43 43
 				$day_by_day = true;
@@ -49,61 +49,61 @@  discard block
 block discarded – undo
49 49
 	endswitch;
50 50
 
51 51
 	$earnings_totals = 0.00; // Total earnings for time period shown
52
-	$sales_totals    = 0;            // Total sales for time period shown
52
+	$sales_totals    = 0; // Total sales for time period shown
53 53
 
54 54
 	$earnings_data = array();
55 55
 	$sales_data    = array();
56 56
 
57
-	if ( $dates['range'] == 'today' || $dates['range'] == 'yesterday' ) {
57
+	if ($dates['range'] == 'today' || $dates['range'] == 'yesterday') {
58 58
 		// Hour by hour
59 59
 		$hour  = 1;
60
-		$month = date( 'n', current_time( 'timestamp' ) );
61
-		while ( $hour <= 23 ) :
60
+		$month = date('n', current_time('timestamp'));
61
+		while ($hour <= 23) :
62 62
 
63
-			$sales    = give_get_sales_by_date( $dates['day'], $month, $dates['year'], $hour );
64
-			$earnings = give_get_earnings_by_date( $dates['day'], $month, $dates['year'], $hour );
63
+			$sales    = give_get_sales_by_date($dates['day'], $month, $dates['year'], $hour);
64
+			$earnings = give_get_earnings_by_date($dates['day'], $month, $dates['year'], $hour);
65 65
 
66 66
 			$sales_totals += $sales;
67 67
 			$earnings_totals += $earnings;
68 68
 
69
-			$date            = mktime( $hour, 0, 0, $month, $dates['day'], $dates['year'] ) * 1000;
70
-			$sales_data[]    = array( $date, $sales );
71
-			$earnings_data[] = array( $date, $earnings );
69
+			$date            = mktime($hour, 0, 0, $month, $dates['day'], $dates['year']) * 1000;
70
+			$sales_data[]    = array($date, $sales);
71
+			$earnings_data[] = array($date, $earnings);
72 72
 
73
-			$hour ++;
73
+			$hour++;
74 74
 		endwhile;
75 75
 
76
-	} elseif ( $dates['range'] == 'this_week' || $dates['range'] == 'last_week' ) {
76
+	} elseif ($dates['range'] == 'this_week' || $dates['range'] == 'last_week') {
77 77
 
78 78
 		// Day by day
79 79
 		$day     = $dates['day'];
80 80
 		$day_end = $dates['day_end'];
81 81
 		$month   = $dates['m_start'];
82
-		while ( $day <= $day_end ) :
83
-			$sales = give_get_sales_by_date( $day, $month, $dates['year'] );
82
+		while ($day <= $day_end) :
83
+			$sales = give_get_sales_by_date($day, $month, $dates['year']);
84 84
 			$sales_totals += $sales;
85 85
 
86
-			$earnings = give_get_earnings_by_date( $day, $month, $dates['year'] );
86
+			$earnings = give_get_earnings_by_date($day, $month, $dates['year']);
87 87
 			$earnings_totals += $earnings;
88 88
 
89
-			$date            = mktime( 0, 0, 0, $month, $day, $dates['year'] ) * 1000;
90
-			$sales_data[]    = array( $date, $sales );
91
-			$earnings_data[] = array( $date, $earnings );
92
-			$day ++;
89
+			$date            = mktime(0, 0, 0, $month, $day, $dates['year']) * 1000;
90
+			$sales_data[]    = array($date, $sales);
91
+			$earnings_data[] = array($date, $earnings);
92
+			$day++;
93 93
 		endwhile;
94 94
 
95 95
 	} else {
96 96
 
97 97
 		$y = $dates['year'];
98
-		while ( $y <= $dates['year_end'] ) :
98
+		while ($y <= $dates['year_end']) :
99 99
 
100
-			if ( $dates['year'] == $dates['year_end'] ) {
100
+			if ($dates['year'] == $dates['year_end']) {
101 101
 				$month_start = $dates['m_start'];
102 102
 				$month_end   = $dates['m_end'];
103
-			} elseif ( $y == $dates['year'] ) {
103
+			} elseif ($y == $dates['year']) {
104 104
 				$month_start = $dates['m_start'];
105 105
 				$month_end   = 12;
106
-			} elseif ( $y == $dates['year_end'] ) {
106
+			} elseif ($y == $dates['year_end']) {
107 107
 				$month_start = 1;
108 108
 				$month_end   = $dates['m_end'];
109 109
 			} else {
@@ -112,48 +112,48 @@  discard block
 block discarded – undo
112 112
 			}
113 113
 
114 114
 			$i = $month_start;
115
-			while ( $i <= $month_end ) :
115
+			while ($i <= $month_end) :
116 116
 
117
-				if ( $day_by_day ) {
117
+				if ($day_by_day) {
118 118
 
119
-					if ( $i == $month_end ) {
119
+					if ($i == $month_end) {
120 120
 
121 121
 						$num_of_days = $dates['day_end'];
122 122
 
123 123
 					} else {
124 124
 
125
-						$num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y );
125
+						$num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y);
126 126
 
127 127
 					}
128 128
 
129 129
 					$d = $dates['day'];
130 130
 
131
-					while ( $d <= $num_of_days ) :
131
+					while ($d <= $num_of_days) :
132 132
 
133
-						$sales = give_get_sales_by_date( $d, $i, $y );
133
+						$sales = give_get_sales_by_date($d, $i, $y);
134 134
 						$sales_totals += $sales;
135 135
 
136
-						$earnings = give_get_earnings_by_date( $d, $i, $y );
136
+						$earnings = give_get_earnings_by_date($d, $i, $y);
137 137
 						$earnings_totals += $earnings;
138 138
 
139
-						$date            = mktime( 0, 0, 0, $i, $d, $y ) * 1000;
140
-						$sales_data[]    = array( $date, $sales );
141
-						$earnings_data[] = array( $date, $earnings );
142
-						$d ++;
139
+						$date            = mktime(0, 0, 0, $i, $d, $y) * 1000;
140
+						$sales_data[]    = array($date, $sales);
141
+						$earnings_data[] = array($date, $earnings);
142
+						$d++;
143 143
 
144 144
 					endwhile;
145 145
 
146 146
 				} else {
147 147
 
148
-					$sales = give_get_sales_by_date( null, $i, $y );
148
+					$sales = give_get_sales_by_date(null, $i, $y);
149 149
 					$sales_totals += $sales;
150 150
 
151
-					$earnings = give_get_earnings_by_date( null, $i, $y );
151
+					$earnings = give_get_earnings_by_date(null, $i, $y);
152 152
 					$earnings_totals += $earnings;
153 153
 
154
-					if ( $i == $month_end ) {
154
+					if ($i == $month_end) {
155 155
 
156
-						$num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y );
156
+						$num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y);
157 157
 
158 158
 					} else {
159 159
 
@@ -161,24 +161,24 @@  discard block
 block discarded – undo
161 161
 
162 162
 					}
163 163
 
164
-					$date            = mktime( 0, 0, 0, $i, $num_of_days, $y ) * 1000;
165
-					$sales_data[]    = array( $date, $sales );
166
-					$earnings_data[] = array( $date, $earnings );
164
+					$date            = mktime(0, 0, 0, $i, $num_of_days, $y) * 1000;
165
+					$sales_data[]    = array($date, $sales);
166
+					$earnings_data[] = array($date, $earnings);
167 167
 
168 168
 				}
169 169
 
170
-				$i ++;
170
+				$i++;
171 171
 
172 172
 			endwhile;
173 173
 
174
-			$y ++;
174
+			$y++;
175 175
 		endwhile;
176 176
 
177 177
 	}
178 178
 
179 179
 	$data = array(
180
-		esc_html__( 'Income', 'give' )    => $earnings_data,
181
-		esc_html__( 'Donations', 'give' ) => $sales_data
180
+		esc_html__('Income', 'give')    => $earnings_data,
181
+		esc_html__('Donations', 'give') => $sales_data
182 182
 	);
183 183
 
184 184
 	// start our own output buffer
@@ -190,12 +190,12 @@  discard block
 block discarded – undo
190 190
 			<div class="postbox">
191 191
 				<div class="inside">
192 192
 					<?php
193
-					$graph = new Give_Graph( $data );
194
-					$graph->set( 'x_mode', 'time' );
195
-					$graph->set( 'multiple_y_axes', true );
193
+					$graph = new Give_Graph($data);
194
+					$graph->set('x_mode', 'time');
195
+					$graph->set('multiple_y_axes', true);
196 196
 					$graph->display();
197 197
 
198
-					if ( 'this_month' == $dates['range'] ) {
198
+					if ('this_month' == $dates['range']) {
199 199
 						$estimated = give_estimated_monthly_stats();
200 200
 					}
201 201
 					?>
@@ -205,21 +205,21 @@  discard block
 block discarded – undo
205 205
 			<table class="widefat reports-table alignleft" style="max-width:450px">
206 206
 				<tbody>
207 207
 				<tr>
208
-					<th scope="row"><strong><?php esc_html_e( 'Total income for period:', 'give' ); ?></strong></th>
209
-					<td><?php echo give_currency_filter( give_format_amount( $earnings_totals ) ); ?></td>
208
+					<th scope="row"><strong><?php esc_html_e('Total income for period:', 'give'); ?></strong></th>
209
+					<td><?php echo give_currency_filter(give_format_amount($earnings_totals)); ?></td>
210 210
 				</tr>
211 211
 				<tr class="alternate">
212
-					<th scope="row"><strong><?php esc_html_e( 'Total donations for period:', 'give' ); ?><strong></th>
212
+					<th scope="row"><strong><?php esc_html_e('Total donations for period:', 'give'); ?><strong></th>
213 213
 					<td><?php echo $sales_totals; ?></td>
214 214
 				</tr>
215
-				<?php if ( 'this_month' == $dates['range'] ) : ?>
215
+				<?php if ('this_month' == $dates['range']) : ?>
216 216
 					<tr>
217
-						<th scope="row"><strong><?php esc_html_e( 'Estimated monthly income:', 'give' ); ?></strong></th>
218
-						<td><?php echo give_currency_filter( give_format_amount( $estimated['earnings'] ) ); ?></td>
217
+						<th scope="row"><strong><?php esc_html_e('Estimated monthly income:', 'give'); ?></strong></th>
218
+						<td><?php echo give_currency_filter(give_format_amount($estimated['earnings'])); ?></td>
219 219
 					</tr>
220 220
 					<tr class="alternate">
221
-						<th scope="row"><strong><?php esc_html_e( 'Estimated monthly donations:', 'give' ); ?></strong></th>
222
-						<td><?php echo floor( $estimated['sales'] ); ?></td>
221
+						<th scope="row"><strong><?php esc_html_e('Estimated monthly donations:', 'give'); ?></strong></th>
222
+						<td><?php echo floor($estimated['sales']); ?></td>
223 223
 					</tr>
224 224
 				<?php endif; ?>
225 225
 			</table>
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 			 *
233 233
 			 * @since 1.0
234 234
 			 */
235
-			do_action( 'give_reports_graph_additional_stats' );
235
+			do_action('give_reports_graph_additional_stats');
236 236
 			?>
237 237
 
238 238
 		</div>
@@ -251,12 +251,12 @@  discard block
 block discarded – undo
251 251
  * @since 1.0
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   = 1;
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
-		esc_html__( 'Income', 'give' )    => $earnings_data,
427
-		esc_html__( 'Donations', 'give' ) => $sales_data
426
+		esc_html__('Income', 'give')    => $earnings_data,
427
+		esc_html__('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 Over Time for %s', 'give' ),
435
-			get_the_title( $form_id )
434
+			esc_html__('Income Over Time for %s', 'give'),
435
+			get_the_title($form_id)
436 436
 		);
437 437
 	?></span></h3>
438 438
 
@@ -440,9 +440,9 @@  discard block
 block discarded – undo
440 440
 		<div class="postbox">
441 441
 			<div class="inside">
442 442
 				<?php
443
-				$graph = new Give_Graph( $data );
444
-				$graph->set( 'x_mode', 'time' );
445
-				$graph->set( 'multiple_y_axes', true );
443
+				$graph = new Give_Graph($data);
444
+				$graph->set('x_mode', 'time');
445
+				$graph->set('multiple_y_axes', true);
446 446
 				$graph->display();
447 447
 				?>
448 448
 			</div>
@@ -451,20 +451,20 @@  discard block
 block discarded – undo
451 451
 		<table class="widefat reports-table alignleft" style="max-width:450px">
452 452
 			<tbody>
453 453
 			<tr>
454
-				<th scope="row"><strong><?php esc_html_e( 'Total income for period:', 'give' ); ?></strong></th>
455
-				<td><?php echo give_currency_filter( give_format_amount( $earnings_totals ) ); ?></td>
454
+				<th scope="row"><strong><?php esc_html_e('Total income for period:', 'give'); ?></strong></th>
455
+				<td><?php echo give_currency_filter(give_format_amount($earnings_totals)); ?></td>
456 456
 			</tr>
457 457
 			<tr class="alternate">
458
-				<th scope="row"><strong><?php esc_html_e( 'Total donations for period:', 'give' ); ?></strong></th>
458
+				<th scope="row"><strong><?php esc_html_e('Total donations for period:', 'give'); ?></strong></th>
459 459
 				<td><?php echo $sales_totals; ?></td>
460 460
 			</tr>
461 461
 			<tr>
462
-				<th scope="row"><strong><?php esc_html_e( 'Average monthly income:', 'give' ); ?></strong></th>
463
-				<td><?php echo give_currency_filter( give_format_amount( give_get_average_monthly_form_earnings( $form_id ) ) ); ?></td>
462
+				<th scope="row"><strong><?php esc_html_e('Average monthly income:', 'give'); ?></strong></th>
463
+				<td><?php echo give_currency_filter(give_format_amount(give_get_average_monthly_form_earnings($form_id))); ?></td>
464 464
 			</tr>
465 465
 			<tr class="alternate">
466
-				<th scope="row"><strong><?php esc_html_e( 'Average monthly donations:', 'give' ); ?></strong></th>
467
-				<td><?php echo number_format( give_get_average_monthly_form_sales( $form_id ), 0 ); ?></td>
466
+				<th scope="row"><strong><?php esc_html_e('Average monthly donations:', 'give'); ?></strong></th>
467
+				<td><?php echo number_format(give_get_average_monthly_form_sales($form_id), 0); ?></td>
468 468
 			</tr>
469 469
 			</tbody>
470 470
 		</table>
@@ -481,26 +481,26 @@  discard block
 block discarded – undo
481 481
  * @return void
482 482
  */
483 483
 function give_reports_graph_controls() {
484
-	$date_options = apply_filters( 'give_report_date_options', array(
485
-		'today'        => esc_html__( 'Today', 'give' ),
486
-		'yesterday'    => esc_html__( 'Yesterday', 'give' ),
487
-		'this_week'    => esc_html__( 'This Week', 'give' ),
488
-		'last_week'    => esc_html__( 'Last Week', 'give' ),
489
-		'this_month'   => esc_html__( 'This Month', 'give' ),
490
-		'last_month'   => esc_html__( 'Last Month', 'give' ),
491
-		'this_quarter' => esc_html__( 'This Quarter', 'give' ),
492
-		'last_quarter' => esc_html__( 'Last Quarter', 'give' ),
493
-		'this_year'    => esc_html__( 'This Year', 'give' ),
494
-		'last_year'    => esc_html__( 'Last Year', 'give' ),
495
-		'other'        => esc_html__( 'Custom', 'give' )
496
-	) );
484
+	$date_options = apply_filters('give_report_date_options', array(
485
+		'today'        => esc_html__('Today', 'give'),
486
+		'yesterday'    => esc_html__('Yesterday', 'give'),
487
+		'this_week'    => esc_html__('This Week', 'give'),
488
+		'last_week'    => esc_html__('Last Week', 'give'),
489
+		'this_month'   => esc_html__('This Month', 'give'),
490
+		'last_month'   => esc_html__('Last Month', 'give'),
491
+		'this_quarter' => esc_html__('This Quarter', 'give'),
492
+		'last_quarter' => esc_html__('Last Quarter', 'give'),
493
+		'this_year'    => esc_html__('This Year', 'give'),
494
+		'last_year'    => esc_html__('Last Year', 'give'),
495
+		'other'        => esc_html__('Custom', 'give')
496
+	));
497 497
 
498 498
 	$dates   = give_get_report_dates();
499 499
 	$display = $dates['range'] == 'other' ? '' : 'style="display:none;"';
500 500
 	$view    = give_get_reporting_view();
501 501
 
502
-	if ( empty( $dates['day_end'] ) ) {
503
-		$dates['day_end'] = cal_days_in_month( CAL_GREGORIAN, date( 'n' ), date( 'Y' ) );
502
+	if (empty($dates['day_end'])) {
503
+		$dates['day_end'] = cal_days_in_month(CAL_GREGORIAN, date('n'), date('Y'));
504 504
 	}
505 505
 
506 506
 	/**
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
 	 *
509 509
 	 * @since 1.0
510 510
 	 */
511
-	do_action( 'give_report_graph_controls_before' );
511
+	do_action('give_report_graph_controls_before');
512 512
 	?>
513 513
 	<form id="give-graphs-filter" method="get" class="alignright">
514 514
 		<div class="tablenav top alignright">
@@ -516,53 +516,53 @@  discard block
 block discarded – undo
516 516
 
517 517
 				<input type="hidden" name="post_type" value="give_forms" />
518 518
 				<input type="hidden" name="page" value="give-reports" />
519
-				<input type="hidden" name="view" value="<?php echo esc_attr( $view ); ?>" />
519
+				<input type="hidden" name="view" value="<?php echo esc_attr($view); ?>" />
520 520
 
521
-				<?php if ( isset( $_GET['form-id'] ) ) : ?>
522
-					<input type="hidden" name="form-id" value="<?php echo absint( $_GET['form-id'] ); ?>" />
521
+				<?php if (isset($_GET['form-id'])) : ?>
522
+					<input type="hidden" name="form-id" value="<?php echo absint($_GET['form-id']); ?>" />
523 523
 				<?php endif; ?>
524 524
 
525 525
 				<div id="give-graphs-date-options-wrap" class="alignright">
526 526
 					<select id="give-graphs-date-options" name="range">
527
-						<?php foreach ( $date_options as $key => $option ) : ?>
528
-							<option value="<?php echo esc_attr( $key ); ?>"<?php selected( $key, $dates['range'] ); ?>><?php echo esc_html( $option ); ?></option>
527
+						<?php foreach ($date_options as $key => $option) : ?>
528
+							<option value="<?php echo esc_attr($key); ?>"<?php selected($key, $dates['range']); ?>><?php echo esc_html($option); ?></option>
529 529
 						<?php endforeach; ?>
530 530
 					</select>
531 531
 
532
-					<input type="submit" class="button-secondary" value="<?php esc_attr_e( 'Filter', 'give' ); ?>" />
532
+					<input type="submit" class="button-secondary" value="<?php esc_attr_e('Filter', 'give'); ?>" />
533 533
 				</div>
534 534
 
535 535
 				<div id="give-date-range-options" <?php echo $display; ?>>
536
-					<span><?php esc_html_e( 'From', 'give' ); ?>&nbsp;</span>
536
+					<span><?php esc_html_e('From', 'give'); ?>&nbsp;</span>
537 537
 					<select id="give-graphs-month-start" name="m_start">
538
-						<?php for ( $i = 1; $i <= 12; $i ++ ) : ?>
539
-							<option value="<?php echo absint( $i ); ?>" <?php selected( $i, $dates['m_start'] ); ?>><?php echo give_month_num_to_name( $i ); ?></option>
538
+						<?php for ($i = 1; $i <= 12; $i++) : ?>
539
+							<option value="<?php echo absint($i); ?>" <?php selected($i, $dates['m_start']); ?>><?php echo give_month_num_to_name($i); ?></option>
540 540
 						<?php endfor; ?>
541 541
 					</select>
542 542
 					<select id="give-graphs-day-start" name="day">
543
-						<?php for ( $i = 1; $i <= 31; $i ++ ) : ?>
544
-							<option value="<?php echo absint( $i ); ?>" <?php selected( $i, $dates['day'] ); ?>><?php echo $i; ?></option>
543
+						<?php for ($i = 1; $i <= 31; $i++) : ?>
544
+							<option value="<?php echo absint($i); ?>" <?php selected($i, $dates['day']); ?>><?php echo $i; ?></option>
545 545
 						<?php endfor; ?>
546 546
 					</select>
547 547
 					<select id="give-graphs-year-start" name="year">
548
-						<?php for ( $i = 2007; $i <= date( 'Y' ); $i ++ ) : ?>
549
-							<option value="<?php echo absint( $i ); ?>" <?php selected( $i, $dates['year'] ); ?>><?php echo $i; ?></option>
548
+						<?php for ($i = 2007; $i <= date('Y'); $i++) : ?>
549
+							<option value="<?php echo absint($i); ?>" <?php selected($i, $dates['year']); ?>><?php echo $i; ?></option>
550 550
 						<?php endfor; ?>
551 551
 					</select>
552
-					<span><?php esc_html_e( 'To', 'give' ); ?>&nbsp;</span>
552
+					<span><?php esc_html_e('To', 'give'); ?>&nbsp;</span>
553 553
 					<select id="give-graphs-month-end" name="m_end">
554
-						<?php for ( $i = 1; $i <= 12; $i ++ ) : ?>
555
-							<option value="<?php echo absint( $i ); ?>" <?php selected( $i, $dates['m_end'] ); ?>><?php echo give_month_num_to_name( $i ); ?></option>
554
+						<?php for ($i = 1; $i <= 12; $i++) : ?>
555
+							<option value="<?php echo absint($i); ?>" <?php selected($i, $dates['m_end']); ?>><?php echo give_month_num_to_name($i); ?></option>
556 556
 						<?php endfor; ?>
557 557
 					</select>
558 558
 					<select id="give-graphs-day-end" name="day_end">
559
-						<?php for ( $i = 1; $i <= 31; $i ++ ) : ?>
560
-							<option value="<?php echo absint( $i ); ?>" <?php selected( $i, $dates['day_end'] ); ?>><?php echo $i; ?></option>
559
+						<?php for ($i = 1; $i <= 31; $i++) : ?>
560
+							<option value="<?php echo absint($i); ?>" <?php selected($i, $dates['day_end']); ?>><?php echo $i; ?></option>
561 561
 						<?php endfor; ?>
562 562
 					</select>
563 563
 					<select id="give-graphs-year-end" name="year_end">
564
-						<?php for ( $i = 2007; $i <= date( 'Y' ); $i ++ ) : ?>
565
-							<option value="<?php echo absint( $i ); ?>" <?php selected( $i, $dates['year_end'] ); ?>><?php echo $i; ?></option>
564
+						<?php for ($i = 2007; $i <= date('Y'); $i++) : ?>
565
+							<option value="<?php echo absint($i); ?>" <?php selected($i, $dates['year_end']); ?>><?php echo $i; ?></option>
566 566
 						<?php endfor; ?>
567 567
 					</select>
568 568
 				</div>
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
 	 *
578 578
 	 * @since 1.0
579 579
 	 */
580
-	do_action( 'give_report_graph_controls_after' );
580
+	do_action('give_report_graph_controls_after');
581 581
 }
582 582
 
583 583
 /**
@@ -592,65 +592,65 @@  discard block
 block discarded – undo
592 592
 function give_get_report_dates() {
593 593
 	$dates = array();
594 594
 
595
-	$current_time = current_time( 'timestamp' );
595
+	$current_time = current_time('timestamp');
596 596
 
597
-	$dates['range']    = isset( $_GET['range'] ) ? $_GET['range'] : 'this_month';
598
-	$dates['year']     = isset( $_GET['year'] ) ? $_GET['year'] : date( 'Y' );
599
-	$dates['year_end'] = isset( $_GET['year_end'] ) ? $_GET['year_end'] : date( 'Y' );
600
-	$dates['m_start']  = isset( $_GET['m_start'] ) ? $_GET['m_start'] : 1;
601
-	$dates['m_end']    = isset( $_GET['m_end'] ) ? $_GET['m_end'] : 12;
602
-	$dates['day']      = isset( $_GET['day'] ) ? $_GET['day'] : 1;
603
-	$dates['day_end']  = isset( $_GET['day_end'] ) ? $_GET['day_end'] : cal_days_in_month( CAL_GREGORIAN, $dates['m_end'], $dates['year'] );
597
+	$dates['range']    = isset($_GET['range']) ? $_GET['range'] : 'this_month';
598
+	$dates['year']     = isset($_GET['year']) ? $_GET['year'] : date('Y');
599
+	$dates['year_end'] = isset($_GET['year_end']) ? $_GET['year_end'] : date('Y');
600
+	$dates['m_start']  = isset($_GET['m_start']) ? $_GET['m_start'] : 1;
601
+	$dates['m_end']    = isset($_GET['m_end']) ? $_GET['m_end'] : 12;
602
+	$dates['day']      = isset($_GET['day']) ? $_GET['day'] : 1;
603
+	$dates['day_end']  = isset($_GET['day_end']) ? $_GET['day_end'] : cal_days_in_month(CAL_GREGORIAN, $dates['m_end'], $dates['year']);
604 604
 
605 605
 	// Modify dates based on predefined ranges
606
-	switch ( $dates['range'] ) :
606
+	switch ($dates['range']) :
607 607
 
608 608
 		case 'this_month' :
609
-			$dates['m_start']  = date( 'n', $current_time );
610
-			$dates['m_end']    = date( 'n', $current_time );
609
+			$dates['m_start']  = date('n', $current_time);
610
+			$dates['m_end']    = date('n', $current_time);
611 611
 			$dates['day']      = 1;
612
-			$dates['day_end']  = cal_days_in_month( CAL_GREGORIAN, $dates['m_end'], $dates['year'] );
613
-			$dates['year']     = date( 'Y' );
614
-			$dates['year_end'] = date( 'Y' );
612
+			$dates['day_end']  = cal_days_in_month(CAL_GREGORIAN, $dates['m_end'], $dates['year']);
613
+			$dates['year']     = date('Y');
614
+			$dates['year_end'] = date('Y');
615 615
 			break;
616 616
 
617 617
 		case 'last_month' :
618
-			if ( date( 'n' ) == 1 ) {
618
+			if (date('n') == 1) {
619 619
 				$dates['m_start']  = 12;
620 620
 				$dates['m_end']    = 12;
621
-				$dates['year']     = date( 'Y', $current_time ) - 1;
622
-				$dates['year_end'] = date( 'Y', $current_time ) - 1;
621
+				$dates['year']     = date('Y', $current_time) - 1;
622
+				$dates['year_end'] = date('Y', $current_time) - 1;
623 623
 			} else {
624
-				$dates['m_start']  = date( 'n' ) - 1;
625
-				$dates['m_end']    = date( 'n' ) - 1;
624
+				$dates['m_start']  = date('n') - 1;
625
+				$dates['m_end']    = date('n') - 1;
626 626
 				$dates['year_end'] = $dates['year'];
627 627
 			}
628
-			$dates['day_end'] = cal_days_in_month( CAL_GREGORIAN, $dates['m_end'], $dates['year'] );
628
+			$dates['day_end'] = cal_days_in_month(CAL_GREGORIAN, $dates['m_end'], $dates['year']);
629 629
 			break;
630 630
 
631 631
 		case 'today' :
632
-			$dates['day']     = date( 'd', $current_time );
633
-			$dates['m_start'] = date( 'n', $current_time );
634
-			$dates['m_end']   = date( 'n', $current_time );
635
-			$dates['year']    = date( 'Y', $current_time );
632
+			$dates['day']     = date('d', $current_time);
633
+			$dates['m_start'] = date('n', $current_time);
634
+			$dates['m_end']   = date('n', $current_time);
635
+			$dates['year']    = date('Y', $current_time);
636 636
 			break;
637 637
 
638 638
 		case 'yesterday' :
639 639
 
640
-			$year  = date( 'Y', $current_time );
641
-			$month = date( 'n', $current_time );
642
-			$day   = date( 'd', $current_time );
640
+			$year  = date('Y', $current_time);
641
+			$month = date('n', $current_time);
642
+			$day   = date('d', $current_time);
643 643
 
644
-			if ( $month == 1 && $day == 1 ) {
644
+			if ($month == 1 && $day == 1) {
645 645
 
646 646
 				$year -= 1;
647 647
 				$month = 12;
648
-				$day   = cal_days_in_month( CAL_GREGORIAN, $month, $year );
648
+				$day   = cal_days_in_month(CAL_GREGORIAN, $month, $year);
649 649
 
650
-			} elseif ( $month > 1 && $day == 1 ) {
650
+			} elseif ($month > 1 && $day == 1) {
651 651
 
652 652
 				$month -= 1;
653
-				$day = cal_days_in_month( CAL_GREGORIAN, $month, $year );
653
+				$day = cal_days_in_month(CAL_GREGORIAN, $month, $year);
654 654
 
655 655
 			} else {
656 656
 
@@ -666,91 +666,91 @@  discard block
 block discarded – undo
666 666
 			break;
667 667
 
668 668
 		case 'this_week' :
669
-			$dates['day'] = date( 'd', $current_time - ( date( 'w', $current_time ) - 1 ) * 60 * 60 * 24 ) - 1;
670
-			$dates['day'] += get_option( 'start_of_week' );
669
+			$dates['day'] = date('d', $current_time - (date('w', $current_time) - 1) * 60 * 60 * 24) - 1;
670
+			$dates['day'] += get_option('start_of_week');
671 671
 			$dates['day_end'] = $dates['day'] + 6;
672
-			$dates['m_start'] = date( 'n', $current_time );
673
-			$dates['m_end']   = date( 'n', $current_time );
674
-			$dates['year']    = date( 'Y', $current_time );
672
+			$dates['m_start'] = date('n', $current_time);
673
+			$dates['m_end']   = date('n', $current_time);
674
+			$dates['year']    = date('Y', $current_time);
675 675
 			break;
676 676
 
677 677
 		case 'last_week' :
678
-			$dates['day'] = date( 'd', $current_time - ( date( 'w' ) - 1 ) * 60 * 60 * 24 ) - 8;
679
-			$dates['day'] += get_option( 'start_of_week' );
678
+			$dates['day'] = date('d', $current_time - (date('w') - 1) * 60 * 60 * 24) - 8;
679
+			$dates['day'] += get_option('start_of_week');
680 680
 			$dates['day_end'] = $dates['day'] + 6;
681
-			$dates['year']    = date( 'Y' );
682
-
683
-			if ( date( 'j', $current_time ) <= 7 ) {
684
-				$dates['m_start'] = date( 'n', $current_time ) - 1;
685
-				$dates['m_end']   = date( 'n', $current_time ) - 1;
686
-				if ( $dates['m_start'] <= 1 ) {
687
-					$dates['year']     = date( 'Y', $current_time ) - 1;
688
-					$dates['year_end'] = date( 'Y', $current_time ) - 1;
681
+			$dates['year']    = date('Y');
682
+
683
+			if (date('j', $current_time) <= 7) {
684
+				$dates['m_start'] = date('n', $current_time) - 1;
685
+				$dates['m_end']   = date('n', $current_time) - 1;
686
+				if ($dates['m_start'] <= 1) {
687
+					$dates['year']     = date('Y', $current_time) - 1;
688
+					$dates['year_end'] = date('Y', $current_time) - 1;
689 689
 				}
690 690
 			} else {
691
-				$dates['m_start'] = date( 'n', $current_time );
692
-				$dates['m_end']   = date( 'n', $current_time );
691
+				$dates['m_start'] = date('n', $current_time);
692
+				$dates['m_end']   = date('n', $current_time);
693 693
 			}
694 694
 			break;
695 695
 
696 696
 		case 'this_quarter' :
697
-			$month_now = date( 'n', $current_time );
697
+			$month_now = date('n', $current_time);
698 698
 
699
-			if ( $month_now <= 3 ) {
699
+			if ($month_now <= 3) {
700 700
 
701 701
 				$dates['m_start'] = 1;
702 702
 				$dates['m_end']   = 4;
703
-				$dates['year']    = date( 'Y', $current_time );
703
+				$dates['year']    = date('Y', $current_time);
704 704
 
705
-			} else if ( $month_now <= 6 ) {
705
+			} else if ($month_now <= 6) {
706 706
 
707 707
 				$dates['m_start'] = 4;
708 708
 				$dates['m_end']   = 7;
709
-				$dates['year']    = date( 'Y', $current_time );
709
+				$dates['year']    = date('Y', $current_time);
710 710
 
711
-			} else if ( $month_now <= 9 ) {
711
+			} else if ($month_now <= 9) {
712 712
 
713 713
 				$dates['m_start'] = 7;
714 714
 				$dates['m_end']   = 10;
715
-				$dates['year']    = date( 'Y', $current_time );
715
+				$dates['year']    = date('Y', $current_time);
716 716
 
717 717
 			} else {
718 718
 
719 719
 				$dates['m_start']  = 10;
720 720
 				$dates['m_end']    = 1;
721
-				$dates['year']     = date( 'Y', $current_time );
722
-				$dates['year_end'] = date( 'Y', $current_time ) + 1;
721
+				$dates['year']     = date('Y', $current_time);
722
+				$dates['year_end'] = date('Y', $current_time) + 1;
723 723
 
724 724
 			}
725 725
 			break;
726 726
 
727 727
 		case 'last_quarter' :
728
-			$month_now = date( 'n' );
728
+			$month_now = date('n');
729 729
 
730
-			if ( $month_now <= 3 ) {
730
+			if ($month_now <= 3) {
731 731
 
732 732
 				$dates['m_start']  = 10;
733 733
 				$dates['m_end']    = 12;
734
-				$dates['year']     = date( 'Y', $current_time ) - 1; // Previous year
735
-				$dates['year_end'] = date( 'Y', $current_time ) - 1; // Previous year
734
+				$dates['year']     = date('Y', $current_time) - 1; // Previous year
735
+				$dates['year_end'] = date('Y', $current_time) - 1; // Previous year
736 736
 
737
-			} else if ( $month_now <= 6 ) {
737
+			} else if ($month_now <= 6) {
738 738
 
739 739
 				$dates['m_start'] = 1;
740 740
 				$dates['m_end']   = 3;
741
-				$dates['year']    = date( 'Y', $current_time );
741
+				$dates['year']    = date('Y', $current_time);
742 742
 
743
-			} else if ( $month_now <= 9 ) {
743
+			} else if ($month_now <= 9) {
744 744
 
745 745
 				$dates['m_start'] = 4;
746 746
 				$dates['m_end']   = 6;
747
-				$dates['year']    = date( 'Y', $current_time );
747
+				$dates['year']    = date('Y', $current_time);
748 748
 
749 749
 			} else {
750 750
 
751 751
 				$dates['m_start'] = 7;
752 752
 				$dates['m_end']   = 9;
753
-				$dates['year']    = date( 'Y', $current_time );
753
+				$dates['year']    = date('Y', $current_time);
754 754
 
755 755
 			}
756 756
 			break;
@@ -758,19 +758,19 @@  discard block
 block discarded – undo
758 758
 		case 'this_year' :
759 759
 			$dates['m_start'] = 1;
760 760
 			$dates['m_end']   = 12;
761
-			$dates['year']    = date( 'Y', $current_time );
761
+			$dates['year']    = date('Y', $current_time);
762 762
 			break;
763 763
 
764 764
 		case 'last_year' :
765 765
 			$dates['m_start']  = 1;
766 766
 			$dates['m_end']    = 12;
767
-			$dates['year']     = date( 'Y', $current_time ) - 1;
768
-			$dates['year_end'] = date( 'Y', $current_time ) - 1;
767
+			$dates['year']     = date('Y', $current_time) - 1;
768
+			$dates['year_end'] = date('Y', $current_time) - 1;
769 769
 			break;
770 770
 
771 771
 	endswitch;
772 772
 
773
-	return apply_filters( 'give_report_dates', $dates );
773
+	return apply_filters('give_report_dates', $dates);
774 774
 }
775 775
 
776 776
 /**
@@ -780,17 +780,17 @@  discard block
 block discarded – undo
780 780
  *
781 781
  * @param $data
782 782
  */
783
-function give_parse_report_dates( $data ) {
783
+function give_parse_report_dates($data) {
784 784
 	$dates = give_get_report_dates();
785 785
 
786 786
 	$view = give_get_reporting_view();
787
-	$id   = isset( $_GET['form-id'] ) ? $_GET['form-id'] : null;
787
+	$id   = isset($_GET['form-id']) ? $_GET['form-id'] : null;
788 788
 
789
-	wp_redirect( add_query_arg( $dates, admin_url( 'edit.php?post_type=give_forms&page=give-reports&view=' . esc_attr( $view ) . '&form-id=' . absint( $id ) ) ) );
789
+	wp_redirect(add_query_arg($dates, admin_url('edit.php?post_type=give_forms&page=give-reports&view='.esc_attr($view).'&form-id='.absint($id))));
790 790
 	give_die();
791 791
 }
792 792
 
793
-add_action( 'give_filter_reports', 'give_parse_report_dates' );
793
+add_action('give_filter_reports', 'give_parse_report_dates');
794 794
 
795 795
 
796 796
 /**
@@ -802,16 +802,16 @@  discard block
 block discarded – undo
802 802
  */
803 803
 function give_reports_refresh_button() {
804 804
 
805
-	$url = wp_nonce_url( add_query_arg( array(
805
+	$url = wp_nonce_url(add_query_arg(array(
806 806
 		'give_action'  => 'refresh_reports_transients',
807 807
 		'give-message' => 'refreshed-reports'
808
-	) ), 'give-refresh-reports' );
808
+	)), 'give-refresh-reports');
809 809
 
810
-	echo '<a href="' . $url . '" data-tooltip="' . esc_attr__( 'Clicking this will clear the reports cache.', 'give' ) . '" data-tooltip-my-position="right center"  data-tooltip-target-position="left center" class="button alignright give-refresh-reports-button give-tooltip">' . esc_html__( 'Refresh Reports', 'give' ) . '</a>';
810
+	echo '<a href="'.$url.'" data-tooltip="'.esc_attr__('Clicking this will clear the reports cache.', 'give').'" data-tooltip-my-position="right center"  data-tooltip-target-position="left center" class="button alignright give-refresh-reports-button give-tooltip">'.esc_html__('Refresh Reports', 'give').'</a>';
811 811
 
812 812
 }
813 813
 
814
-add_action( 'give_reports_graph_additional_stats', 'give_reports_refresh_button' );
814
+add_action('give_reports_graph_additional_stats', 'give_reports_refresh_button');
815 815
 
816 816
 /**
817 817
  * Trigger the refresh of reports transients
@@ -822,18 +822,18 @@  discard block
 block discarded – undo
822 822
  *
823 823
  * @return void
824 824
  */
825
-function give_run_refresh_reports_transients( $data ) {
825
+function give_run_refresh_reports_transients($data) {
826 826
 
827
-	if ( ! wp_verify_nonce( $data['_wpnonce'], 'give-refresh-reports' ) ) {
827
+	if ( ! wp_verify_nonce($data['_wpnonce'], 'give-refresh-reports')) {
828 828
 		return;
829 829
 	}
830 830
 
831 831
 	//Delete transients
832
-	delete_transient( 'give_estimated_monthly_stats' );
833
-	delete_transient( 'give_earnings_total' );
834
-	delete_transient( md5( 'give_earnings_this_monththis_month' ) );
835
-	delete_transient( md5( 'give_earnings_todaytoday' ) );
832
+	delete_transient('give_estimated_monthly_stats');
833
+	delete_transient('give_earnings_total');
834
+	delete_transient(md5('give_earnings_this_monththis_month'));
835
+	delete_transient(md5('give_earnings_todaytoday'));
836 836
 
837 837
 }
838 838
 
839
-add_action( 'give_refresh_reports_transients', 'give_run_refresh_reports_transients' );
840 839
\ No newline at end of file
840
+add_action('give_refresh_reports_transients', 'give_run_refresh_reports_transients');
841 841
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/reporting/pdf-reports.php 1 patch
Spacing   +146 added lines, -146 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,82 +25,82 @@  discard block
 block discarded – undo
25 25
  *
26 26
  * @uses   give_pdf
27 27
  */
28
-function give_generate_pdf( $data ) {
28
+function give_generate_pdf($data) {
29 29
 
30
-	if ( ! current_user_can( 'view_give_reports' ) ) {
31
-		wp_die( esc_html__( 'You do not have permission to generate PDF sales reports.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
30
+	if ( ! current_user_can('view_give_reports')) {
31
+		wp_die(esc_html__('You do not have permission to generate PDF sales reports.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
32 32
 	}
33 33
 
34
-	if ( ! wp_verify_nonce( $_GET['_wpnonce'], 'give_generate_pdf' ) ) {
35
-		wp_die( esc_html__( 'Nonce verification failed.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
34
+	if ( ! wp_verify_nonce($_GET['_wpnonce'], 'give_generate_pdf')) {
35
+		wp_die(esc_html__('Nonce verification failed.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
36 36
 	}
37 37
 
38
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/fpdf/fpdf.php';
39
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/fpdf/give_pdf.php';
38
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/fpdf/fpdf.php';
39
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/fpdf/give_pdf.php';
40 40
 
41 41
 	$daterange = utf8_decode(
42 42
 		sprintf(
43 43
 		/* translators: 1: start date 2: end date */
44
-			esc_html__( '%1$s to %2$s', 'give' ),
45
-			date_i18n( give_date_format(), mktime( 0, 0, 0, 1, 1, date( 'Y' ) ) ),
46
-			date_i18n( give_date_format() )
44
+			esc_html__('%1$s to %2$s', 'give'),
45
+			date_i18n(give_date_format(), mktime(0, 0, 0, 1, 1, date('Y'))),
46
+			date_i18n(give_date_format())
47 47
 		)
48 48
 	);
49 49
 
50 50
 	$pdf = new give_pdf();
51
-	$pdf->AddPage( 'L', 'A4' );
51
+	$pdf->AddPage('L', 'A4');
52 52
 
53
-	$pdf->SetTitle( utf8_decode( __( 'Donation report for the current year for all forms', 'give' ) ) );
54
-	$pdf->SetAuthor( utf8_decode( __( 'Give - Democratizing Generosity', 'give' ) ) );
55
-	$pdf->SetCreator( utf8_decode( __( 'Give - Democratizing Generosity', 'give' ) ) );
53
+	$pdf->SetTitle(utf8_decode(__('Donation report for the current year for all forms', 'give')));
54
+	$pdf->SetAuthor(utf8_decode(__('Give - Democratizing Generosity', 'give')));
55
+	$pdf->SetCreator(utf8_decode(__('Give - Democratizing Generosity', 'give')));
56 56
 
57
-	$pdf->Image( apply_filters( 'give_pdf_export_logo', GIVE_PLUGIN_URL . 'assets/images/give-logo-small.png' ), 247, 8 );
57
+	$pdf->Image(apply_filters('give_pdf_export_logo', GIVE_PLUGIN_URL.'assets/images/give-logo-small.png'), 247, 8);
58 58
 
59
-	$pdf->SetMargins( 8, 8, 8 );
60
-	$pdf->SetX( 8 );
59
+	$pdf->SetMargins(8, 8, 8);
60
+	$pdf->SetX(8);
61 61
 
62
-	$pdf->SetFont( 'Helvetica', '', 16 );
63
-	$pdf->SetTextColor( 50, 50, 50 );
64
-	$pdf->Cell( 0, 3, utf8_decode( __( 'Donation report for the current year for all forms', 'give' ) ), 0, 2, 'L', false );
62
+	$pdf->SetFont('Helvetica', '', 16);
63
+	$pdf->SetTextColor(50, 50, 50);
64
+	$pdf->Cell(0, 3, utf8_decode(__('Donation report for the current year for all forms', 'give')), 0, 2, 'L', false);
65 65
 
66
-	$pdf->SetFont( 'Helvetica', '', 13 );
66
+	$pdf->SetFont('Helvetica', '', 13);
67 67
 	$pdf->Ln();
68
-	$pdf->SetTextColor( 150, 150, 150 );
69
-	$pdf->Cell( 0, 6, utf8_decode( __( 'Date Range: ', 'give' ) ) . $daterange, 0, 2, 'L', false );
68
+	$pdf->SetTextColor(150, 150, 150);
69
+	$pdf->Cell(0, 6, utf8_decode(__('Date Range: ', 'give')).$daterange, 0, 2, 'L', false);
70 70
 	$pdf->Ln();
71
-	$pdf->SetTextColor( 50, 50, 50 );
72
-	$pdf->SetFont( 'Helvetica', '', 14 );
73
-	$pdf->Cell( 0, 10, utf8_decode( __( 'Table View', 'give' ) ), 0, 2, 'L', false );
74
-	$pdf->SetFont( 'Helvetica', '', 12 );
71
+	$pdf->SetTextColor(50, 50, 50);
72
+	$pdf->SetFont('Helvetica', '', 14);
73
+	$pdf->Cell(0, 10, utf8_decode(__('Table View', 'give')), 0, 2, 'L', false);
74
+	$pdf->SetFont('Helvetica', '', 12);
75 75
 
76
-	$pdf->SetFillColor( 238, 238, 238 );
77
-	$pdf->Cell( 70, 6, utf8_decode( __( 'Form Name', 'give' ) ), 1, 0, 'L', true );
78
-	$pdf->Cell( 30, 6, utf8_decode( __( 'Price', 'give' ) ), 1, 0, 'L', true );
79
-	$pdf->Cell( 50, 6, utf8_decode( __( 'Categories', 'give' ) ), 1, 0, 'L', true );
80
-	$pdf->Cell( 50, 6, utf8_decode( __( 'Tags', 'give' ) ), 1, 0, 'L', true );
81
-	$pdf->Cell( 45, 6, utf8_decode( __( 'Number of Donations', 'give' ) ), 1, 0, 'L', true );
82
-	$pdf->Cell( 35, 6, utf8_decode( __( 'Income to Date', 'give' ) ), 1, 1, 'L', true );
76
+	$pdf->SetFillColor(238, 238, 238);
77
+	$pdf->Cell(70, 6, utf8_decode(__('Form Name', 'give')), 1, 0, 'L', true);
78
+	$pdf->Cell(30, 6, utf8_decode(__('Price', 'give')), 1, 0, 'L', true);
79
+	$pdf->Cell(50, 6, utf8_decode(__('Categories', 'give')), 1, 0, 'L', true);
80
+	$pdf->Cell(50, 6, utf8_decode(__('Tags', 'give')), 1, 0, 'L', true);
81
+	$pdf->Cell(45, 6, utf8_decode(__('Number of Donations', 'give')), 1, 0, 'L', true);
82
+	$pdf->Cell(35, 6, utf8_decode(__('Income to Date', 'give')), 1, 1, 'L', true);
83 83
 
84
-	$year       = date( 'Y' );
85
-	$give_forms = get_posts( array( 'post_type' => 'give_forms', 'year' => $year, 'posts_per_page' => - 1 ) );
84
+	$year       = date('Y');
85
+	$give_forms = get_posts(array('post_type' => 'give_forms', 'year' => $year, 'posts_per_page' => -1));
86 86
 
87
-	if ( $give_forms ) {
88
-		$pdf->SetWidths( array( 70, 30, 50, 50, 45, 35 ) );
87
+	if ($give_forms) {
88
+		$pdf->SetWidths(array(70, 30, 50, 50, 45, 35));
89 89
 
90
-		foreach ( $give_forms as $form ):
91
-			$pdf->SetFillColor( 255, 255, 255 );
90
+		foreach ($give_forms as $form):
91
+			$pdf->SetFillColor(255, 255, 255);
92 92
 
93 93
 			$title = $form->post_title;
94 94
 
95
-			if ( give_has_variable_prices( $form->ID ) ) {
95
+			if (give_has_variable_prices($form->ID)) {
96 96
 
97
-				$prices = give_get_variable_prices( $form->ID );
97
+				$prices = give_get_variable_prices($form->ID);
98 98
 
99 99
 				$first = $prices[0]['_give_amount'];
100
-				$last  = array_pop( $prices );
100
+				$last  = array_pop($prices);
101 101
 				$last  = $last['_give_amount'];
102 102
 
103
-				if ( $first < $last ) {
103
+				if ($first < $last) {
104 104
 					$min = $first;
105 105
 					$max = $last;
106 106
 				} else {
@@ -108,51 +108,51 @@  discard block
 block discarded – undo
108 108
 					$max = $first;
109 109
 				}
110 110
 
111
-				$price = html_entity_decode( give_currency_filter( give_format_amount( $min ) ) . ' - ' . give_currency_filter( give_format_amount( $max ) ) );
111
+				$price = html_entity_decode(give_currency_filter(give_format_amount($min)).' - '.give_currency_filter(give_format_amount($max)));
112 112
 			} else {
113
-				$price = html_entity_decode( give_currency_filter( give_get_form_price( $form->ID ) ) );
113
+				$price = html_entity_decode(give_currency_filter(give_get_form_price($form->ID)));
114 114
 			}
115 115
 
116
-			$categories = get_the_term_list( $form->ID, 'give_forms_category', '', ', ', '' );
117
-			$categories = ! is_wp_error( $categories ) ? strip_tags( $categories ) : '';
116
+			$categories = get_the_term_list($form->ID, 'give_forms_category', '', ', ', '');
117
+			$categories = ! is_wp_error($categories) ? strip_tags($categories) : '';
118 118
 
119
-			$tags = get_the_term_list( $form->ID, 'give_forms_tag', '', ', ', '' );
120
-			$tags = ! is_wp_error( $tags ) ? strip_tags( $tags ) : '';
119
+			$tags = get_the_term_list($form->ID, 'give_forms_tag', '', ', ', '');
120
+			$tags = ! is_wp_error($tags) ? strip_tags($tags) : '';
121 121
 
122
-			$sales    = give_get_form_sales_stats( $form->ID );
123
-			$link     = get_permalink( $form->ID );
124
-			$earnings = html_entity_decode( give_currency_filter( give_get_form_earnings_stats( $form->ID ) ) );
122
+			$sales    = give_get_form_sales_stats($form->ID);
123
+			$link     = get_permalink($form->ID);
124
+			$earnings = html_entity_decode(give_currency_filter(give_get_form_earnings_stats($form->ID)));
125 125
 
126
-			if ( function_exists( 'iconv' ) ) {
126
+			if (function_exists('iconv')) {
127 127
 				// Ensure characters like euro; are properly converted.
128
-				$price    = iconv( 'UTF-8', 'windows-1252', utf8_encode( $price ) );
129
-				$earnings = iconv( 'UTF-8', 'windows-1252', utf8_encode( $earnings ) );
128
+				$price    = iconv('UTF-8', 'windows-1252', utf8_encode($price));
129
+				$earnings = iconv('UTF-8', 'windows-1252', utf8_encode($earnings));
130 130
 			}
131 131
 
132
-			$pdf->Row( array( $title, $price, $categories, $tags, $sales, $earnings ) );
132
+			$pdf->Row(array($title, $price, $categories, $tags, $sales, $earnings));
133 133
 		endforeach;
134 134
 	} else {
135
-		$pdf->SetWidths( array( 280 ) );
136
-		$title = utf8_decode( esc_html__( 'No forms found.', 'give' ) );
137
-		$pdf->Row( array( $title ) );
135
+		$pdf->SetWidths(array(280));
136
+		$title = utf8_decode(esc_html__('No forms found.', 'give'));
137
+		$pdf->Row(array($title));
138 138
 	}
139 139
 
140 140
 	$pdf->Ln();
141
-	$pdf->SetTextColor( 50, 50, 50 );
142
-	$pdf->SetFont( 'Helvetica', '', 14 );
143
-	$pdf->Cell( 0, 10, utf8_decode( __( 'Graph View', 'give' ) ), 0, 2, 'L', false );
144
-	$pdf->SetFont( 'Helvetica', '', 12 );
145
-
146
-	$image = html_entity_decode( urldecode( give_draw_chart_image() ) );
147
-	$image = str_replace( ' ', '%20', $image );
148
-
149
-	$pdf->SetX( 25 );
150
-	$pdf->Image( $image . '&file=.png' );
151
-	$pdf->Ln( 7 );
152
-	$pdf->Output( apply_filters( 'give_sales_earnings_pdf_export_filename', 'give-report-' . date_i18n( 'Y-m-d' ) ) . '.pdf', 'D' );
141
+	$pdf->SetTextColor(50, 50, 50);
142
+	$pdf->SetFont('Helvetica', '', 14);
143
+	$pdf->Cell(0, 10, utf8_decode(__('Graph View', 'give')), 0, 2, 'L', false);
144
+	$pdf->SetFont('Helvetica', '', 12);
145
+
146
+	$image = html_entity_decode(urldecode(give_draw_chart_image()));
147
+	$image = str_replace(' ', '%20', $image);
148
+
149
+	$pdf->SetX(25);
150
+	$pdf->Image($image.'&file=.png');
151
+	$pdf->Ln(7);
152
+	$pdf->Output(apply_filters('give_sales_earnings_pdf_export_filename', 'give-report-'.date_i18n('Y-m-d')).'.pdf', 'D');
153 153
 }
154 154
 
155
-add_action( 'give_generate_pdf', 'give_generate_pdf' );
155
+add_action('give_generate_pdf', 'give_generate_pdf');
156 156
 
157 157
 /**
158 158
  * Draws Chart for PDF Report.
@@ -169,38 +169,38 @@  discard block
 block discarded – undo
169 169
  * @return string $chart->getUrl() URL for the Google Chart
170 170
  */
171 171
 function give_draw_chart_image() {
172
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/GoogleChart.php';
173
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/markers/GoogleChartShapeMarker.php';
174
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/markers/GoogleChartTextMarker.php';
172
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/GoogleChart.php';
173
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/markers/GoogleChartShapeMarker.php';
174
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/markers/GoogleChartTextMarker.php';
175 175
 
176
-	$chart = new GoogleChart( 'lc', 900, 330 );
176
+	$chart = new GoogleChart('lc', 900, 330);
177 177
 
178 178
 	$i        = 1;
179 179
 	$earnings = "";
180 180
 	$sales    = "";
181 181
 
182
-	while ( $i <= 12 ) :
183
-		$earnings .= give_get_earnings_by_date( null, $i, date( 'Y' ) ) . ",";
184
-		$sales .= give_get_sales_by_date( null, $i, date( 'Y' ) ) . ",";
185
-		$i ++;
182
+	while ($i <= 12) :
183
+		$earnings .= give_get_earnings_by_date(null, $i, date('Y')).",";
184
+		$sales .= give_get_sales_by_date(null, $i, date('Y')).",";
185
+		$i++;
186 186
 	endwhile;
187 187
 
188
-	$earnings_array = explode( ",", $earnings );
189
-	$sales_array    = explode( ",", $sales );
188
+	$earnings_array = explode(",", $earnings);
189
+	$sales_array    = explode(",", $sales);
190 190
 
191 191
 	$i = 0;
192
-	while ( $i <= 11 ) {
193
-		if ( empty( $sales_array[ $i ] ) ) {
194
-			$sales_array[ $i ] = 0;
192
+	while ($i <= 11) {
193
+		if (empty($sales_array[$i])) {
194
+			$sales_array[$i] = 0;
195 195
 		}
196
-		$i ++;
196
+		$i++;
197 197
 	}
198 198
 
199 199
 	$min_earnings   = 0;
200
-	$max_earnings   = max( $earnings_array );
201
-	$earnings_scale = round( $max_earnings, - 1 );
200
+	$max_earnings   = max($earnings_array);
201
+	$earnings_scale = round($max_earnings, - 1);
202 202
 
203
-	$data = new GoogleChartData( array(
203
+	$data = new GoogleChartData(array(
204 204
 		$earnings_array[0],
205 205
 		$earnings_array[1],
206 206
 		$earnings_array[2],
@@ -213,25 +213,25 @@  discard block
 block discarded – undo
213 213
 		$earnings_array[9],
214 214
 		$earnings_array[10],
215 215
 		$earnings_array[11]
216
-	) );
216
+	));
217 217
 
218
-	$data->setLegend( esc_html__( 'Income', 'give' ) );
219
-	$data->setColor( '1b58a3' );
220
-	$chart->addData( $data );
218
+	$data->setLegend(esc_html__('Income', 'give'));
219
+	$data->setColor('1b58a3');
220
+	$chart->addData($data);
221 221
 
222
-	$shape_marker = new GoogleChartShapeMarker( GoogleChartShapeMarker::CIRCLE );
223
-	$shape_marker->setColor( '000000' );
224
-	$shape_marker->setSize( 7 );
225
-	$shape_marker->setBorder( 2 );
226
-	$shape_marker->setData( $data );
227
-	$chart->addMarker( $shape_marker );
222
+	$shape_marker = new GoogleChartShapeMarker(GoogleChartShapeMarker::CIRCLE);
223
+	$shape_marker->setColor('000000');
224
+	$shape_marker->setSize(7);
225
+	$shape_marker->setBorder(2);
226
+	$shape_marker->setData($data);
227
+	$chart->addMarker($shape_marker);
228 228
 
229
-	$value_marker = new GoogleChartTextMarker( GoogleChartTextMarker::VALUE );
230
-	$value_marker->setColor( '000000' );
231
-	$value_marker->setData( $data );
232
-	$chart->addMarker( $value_marker );
229
+	$value_marker = new GoogleChartTextMarker(GoogleChartTextMarker::VALUE);
230
+	$value_marker->setColor('000000');
231
+	$value_marker->setData($data);
232
+	$chart->addMarker($value_marker);
233 233
 
234
-	$data = new GoogleChartData( array(
234
+	$data = new GoogleChartData(array(
235 235
 		$sales_array[0],
236 236
 		$sales_array[1],
237 237
 		$sales_array[2],
@@ -244,46 +244,46 @@  discard block
 block discarded – undo
244 244
 		$sales_array[9],
245 245
 		$sales_array[10],
246 246
 		$sales_array[11]
247
-	) );
248
-	$data->setLegend( esc_html__( 'Donations', 'give' ) );
249
-	$data->setColor( 'ff6c1c' );
250
-	$chart->addData( $data );
251
-
252
-	$chart->setTitle( esc_html__( 'Donations by Month for all Give Forms', 'give' ), '336699', 18 );
253
-
254
-	$chart->setScale( 0, $max_earnings );
255
-
256
-	$y_axis = new GoogleChartAxis( 'y' );
257
-	$y_axis->setDrawTickMarks( true )->setLabels( array( 0, $max_earnings ) );
258
-	$chart->addAxis( $y_axis );
259
-
260
-	$x_axis = new GoogleChartAxis( 'x' );
261
-	$x_axis->setTickMarks( 5 );
262
-	$x_axis->setLabels( array(
263
-		esc_html__( 'Jan', 'give' ),
264
-		esc_html__( 'Feb', 'give' ),
265
-		esc_html__( 'Mar', 'give' ),
266
-		esc_html__( 'Apr', 'give' ),
267
-		esc_html__( 'May', 'give' ),
268
-		esc_html__( 'June', 'give' ),
269
-		esc_html__( 'July', 'give' ),
270
-		esc_html__( 'Aug', 'give' ),
271
-		esc_html__( 'Sept', 'give' ),
272
-		esc_html__( 'Oct', 'give' ),
273
-		esc_html__( 'Nov', 'give' ),
274
-		esc_html__( 'Dec', 'give' )
275
-	) );
276
-	$chart->addAxis( $x_axis );
277
-
278
-	$shape_marker = new GoogleChartShapeMarker( GoogleChartShapeMarker::CIRCLE );
279
-	$shape_marker->setSize( 6 );
280
-	$shape_marker->setBorder( 2 );
281
-	$shape_marker->setData( $data );
282
-	$chart->addMarker( $shape_marker );
283
-
284
-	$value_marker = new GoogleChartTextMarker( GoogleChartTextMarker::VALUE );
285
-	$value_marker->setData( $data );
286
-	$chart->addMarker( $value_marker );
247
+	));
248
+	$data->setLegend(esc_html__('Donations', 'give'));
249
+	$data->setColor('ff6c1c');
250
+	$chart->addData($data);
251
+
252
+	$chart->setTitle(esc_html__('Donations by Month for all Give Forms', 'give'), '336699', 18);
253
+
254
+	$chart->setScale(0, $max_earnings);
255
+
256
+	$y_axis = new GoogleChartAxis('y');
257
+	$y_axis->setDrawTickMarks(true)->setLabels(array(0, $max_earnings));
258
+	$chart->addAxis($y_axis);
259
+
260
+	$x_axis = new GoogleChartAxis('x');
261
+	$x_axis->setTickMarks(5);
262
+	$x_axis->setLabels(array(
263
+		esc_html__('Jan', 'give'),
264
+		esc_html__('Feb', 'give'),
265
+		esc_html__('Mar', 'give'),
266
+		esc_html__('Apr', 'give'),
267
+		esc_html__('May', 'give'),
268
+		esc_html__('June', 'give'),
269
+		esc_html__('July', 'give'),
270
+		esc_html__('Aug', 'give'),
271
+		esc_html__('Sept', 'give'),
272
+		esc_html__('Oct', 'give'),
273
+		esc_html__('Nov', 'give'),
274
+		esc_html__('Dec', 'give')
275
+	));
276
+	$chart->addAxis($x_axis);
277
+
278
+	$shape_marker = new GoogleChartShapeMarker(GoogleChartShapeMarker::CIRCLE);
279
+	$shape_marker->setSize(6);
280
+	$shape_marker->setBorder(2);
281
+	$shape_marker->setData($data);
282
+	$chart->addMarker($shape_marker);
283
+
284
+	$value_marker = new GoogleChartTextMarker(GoogleChartTextMarker::VALUE);
285
+	$value_marker->setData($data);
286
+	$chart->addMarker($value_marker);
287 287
 
288 288
 	return $chart->getUrl();
289 289
 }
Please login to merge, or discard this patch.
includes/admin/reporting/tools.php 1 patch
Spacing   +27 added lines, -27 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
 
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
  */
23 23
 function give_tools_recount_stats_display() {
24 24
 
25
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
25
+	if ( ! current_user_can('manage_give_settings')) {
26 26
 		return;
27 27
 	}
28 28
 
@@ -31,27 +31,27 @@  discard block
 block discarded – undo
31 31
 	 *
32 32
 	 * @since 1.5
33 33
 	 */
34
-	do_action( 'give_tools_recount_stats_before' );
34
+	do_action('give_tools_recount_stats_before');
35 35
 	?>
36 36
 	<div id="poststuff">
37 37
 		<div class="postbox">
38 38
 
39
-			<h2 class="hndle ui-sortable-handle"><span><?php esc_html_e( 'Recount Stats', 'give' ); ?></span></h2>
39
+			<h2 class="hndle ui-sortable-handle"><span><?php esc_html_e('Recount Stats', 'give'); ?></span></h2>
40 40
 
41 41
 			<div class="inside recount-stats-controls">
42
-				<p><?php esc_html_e( 'Use these tools to recount stats, delete test transactions, or reset stats.', 'give' ); ?></p>
42
+				<p><?php esc_html_e('Use these tools to recount stats, delete test transactions, or reset stats.', 'give'); ?></p>
43 43
 				<form method="post" id="give-tools-recount-form" class="give-export-form">
44 44
 
45
-					<?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?>
45
+					<?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?>
46 46
 
47 47
 					<select name="give-export-class" id="recount-stats-type">
48
-						<option value="0" selected="selected" disabled="disabled"><?php esc_html_e( 'Please select an option', 'give' ); ?></option>
49
-						<option data-type="recount-stats" value="Give_Tools_Recount_Income"><?php esc_html_e( 'Recalculate Total Donation Income Amount', 'give' ); ?></option>
50
-						<option data-type="recount-form" value="Give_Tools_Recount_Form_Stats"><?php esc_html_e( 'Recalculate Income Amount and Donation Counts for a Form', 'give' ); ?></option>
51
-						<option data-type="recount-all" value="Give_Tools_Recount_All_Stats"><?php esc_html_e( 'Recalculate Income Amount and Donation Counts for All Forms', 'give' ); ?></option>
52
-						<option data-type="recount-customer-stats" value="Give_Tools_Recount_Customer_Stats"><?php esc_html_e( 'Recalculate Donor Statistics', 'give' ); ?></option>
53
-						<option data-type="delete-test-transactions" value="Give_Tools_Delete_Test_Transactions"><?php esc_html_e( 'Delete Test Transactions', 'give' ); ?></option>
54
-						<option data-type="reset-stats" value="Give_Tools_Reset_Stats"><?php esc_html_e( 'Delete All Data', 'give' ); ?></option>
48
+						<option value="0" selected="selected" disabled="disabled"><?php esc_html_e('Please select an option', 'give'); ?></option>
49
+						<option data-type="recount-stats" value="Give_Tools_Recount_Income"><?php esc_html_e('Recalculate Total Donation Income Amount', 'give'); ?></option>
50
+						<option data-type="recount-form" value="Give_Tools_Recount_Form_Stats"><?php esc_html_e('Recalculate Income Amount and Donation Counts for a Form', 'give'); ?></option>
51
+						<option data-type="recount-all" value="Give_Tools_Recount_All_Stats"><?php esc_html_e('Recalculate Income Amount and Donation Counts for All Forms', 'give'); ?></option>
52
+						<option data-type="recount-customer-stats" value="Give_Tools_Recount_Customer_Stats"><?php esc_html_e('Recalculate Donor Statistics', 'give'); ?></option>
53
+						<option data-type="delete-test-transactions" value="Give_Tools_Delete_Test_Transactions"><?php esc_html_e('Delete Test Transactions', 'give'); ?></option>
54
+						<option data-type="reset-stats" value="Give_Tools_Reset_Stats"><?php esc_html_e('Delete All Data', 'give'); ?></option>
55 55
 						<?php
56 56
 						/**
57 57
 						 * Fires in the recount stats selectbox.
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 						 *
61 61
 						 * @since 1.5
62 62
 						 */
63
-						do_action( 'give_recount_tool_options' );
63
+						do_action('give_recount_tool_options');
64 64
 						?>
65 65
 					</select>
66 66
 
@@ -68,22 +68,22 @@  discard block
 block discarded – undo
68 68
 						<?php
69 69
 						$args = array(
70 70
 							'name'   => 'form_id',
71
-							'number' => - 1,
71
+							'number' => -1,
72 72
 							'chosen' => true,
73 73
 						);
74
-						echo Give()->html->forms_dropdown( $args );
74
+						echo Give()->html->forms_dropdown($args);
75 75
 						?>
76 76
 					</span>
77 77
 
78
-					<input type="submit" id="recount-stats-submit" value="<?php esc_attr_e( 'Submit', 'give' ); ?>" class="button-secondary"/>
78
+					<input type="submit" id="recount-stats-submit" value="<?php esc_attr_e('Submit', 'give'); ?>" class="button-secondary"/>
79 79
 
80 80
 					<br/>
81 81
 
82 82
 					<span class="give-recount-stats-descriptions">
83
-						<span id="recount-stats"><?php esc_html_e( 'Recalculates the overall donation income amount.', 'give' ); ?></span>
84
-						<span id="recount-form"><?php esc_html_e( 'Recalculates the donation and income stats for a specific form.', 'give' ); ?></span>
85
-						<span id="recount-all"><?php esc_html_e( 'Recalculates the earnings and sales stats for all forms.', 'give' ); ?></span>
86
-						<span id="recount-customer-stats"><?php esc_html_e( 'Recalculates the lifetime value and donation counts for all donors.', 'give' ); ?></span>
83
+						<span id="recount-stats"><?php esc_html_e('Recalculates the overall donation income amount.', 'give'); ?></span>
84
+						<span id="recount-form"><?php esc_html_e('Recalculates the donation and income stats for a specific form.', 'give'); ?></span>
85
+						<span id="recount-all"><?php esc_html_e('Recalculates the earnings and sales stats for all forms.', 'give'); ?></span>
86
+						<span id="recount-customer-stats"><?php esc_html_e('Recalculates the lifetime value and donation counts for all donors.', 'give'); ?></span>
87 87
 						<?php
88 88
 						/**
89 89
 						 * Fires in the recount stats description area.
@@ -92,10 +92,10 @@  discard block
 block discarded – undo
92 92
 						 *
93 93
 						 * @since 1.5
94 94
 						 */
95
-						do_action( 'give_recount_tool_descriptions' );
95
+						do_action('give_recount_tool_descriptions');
96 96
 						?>
97
-						<span id="delete-test-transactions"><?php _e( '<strong>Deletes</strong> all TEST donations, donors, and related log entries.', 'give' ); ?></span>
98
-						<span id="reset-stats"><?php _e( '<strong>Deletes</strong> ALL donations, donors, and related log entries regardless of test or live mode.', 'give' ); ?></span>
97
+						<span id="delete-test-transactions"><?php _e('<strong>Deletes</strong> all TEST donations, donors, and related log entries.', 'give'); ?></span>
98
+						<span id="reset-stats"><?php _e('<strong>Deletes</strong> ALL donations, donors, and related log entries regardless of test or live mode.', 'give'); ?></span>
99 99
 					</span>
100 100
 
101 101
 					<span class="spinner"></span>
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 				 *
110 110
 				 * @since 1.5
111 111
 				 */
112
-				do_action( 'give_tools_recount_forms' );
112
+				do_action('give_tools_recount_forms');
113 113
 				?>
114 114
 			</div><!-- .inside -->
115 115
 		</div><!-- .postbox -->
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 	 *
121 121
 	 * @since 1.5
122 122
 	 */
123
-	do_action( 'give_tools_recount_stats_after' );
123
+	do_action('give_tools_recount_stats_after');
124 124
 }
125 125
 
126
-add_action( 'give_reports_tab_tools', 'give_tools_recount_stats_display' );
126
+add_action('give_reports_tab_tools', 'give_tools_recount_stats_display');
Please login to merge, or discard this patch.
includes/admin/reporting/export/class-batch-export.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -106,14 +106,14 @@  discard block
 block discarded – undo
106 106
 	 * @param $_step int The step to process
107 107
 	 * @since 1.5
108 108
 	 */
109
-	public function __construct( $_step = 1 ) {
109
+	public function __construct($_step = 1) {
110 110
 
111 111
 		$upload_dir       = wp_upload_dir();
112 112
 		$this->filetype   = '.csv';
113
-		$this->filename   = 'give-' . $this->export_type . $this->filetype;
114
-		$this->file       = trailingslashit( $upload_dir['basedir'] ) . $this->filename;
113
+		$this->filename   = 'give-'.$this->export_type.$this->filetype;
114
+		$this->file       = trailingslashit($upload_dir['basedir']).$this->filename;
115 115
 
116
-		if ( ! is_writeable( $upload_dir['basedir'] ) ) {
116
+		if ( ! is_writeable($upload_dir['basedir'])) {
117 117
 			$this->is_writable = false;
118 118
 		}
119 119
 
@@ -129,20 +129,20 @@  discard block
 block discarded – undo
129 129
 	 */
130 130
 	public function process_step() {
131 131
 
132
-		if ( ! $this->can_export() ) {
133
-			wp_die( esc_html__( 'You do not have permission to export data.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
132
+		if ( ! $this->can_export()) {
133
+			wp_die(esc_html__('You do not have permission to export data.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
134 134
 		}
135 135
 
136
-		if( $this->step < 2 ) {
136
+		if ($this->step < 2) {
137 137
 
138 138
 			// Make sure we start with a fresh file on step 1
139
-			@unlink( $this->file );
139
+			@unlink($this->file);
140 140
 			$this->print_csv_cols();
141 141
 		}
142 142
 
143 143
 		$rows = $this->print_csv_rows();
144 144
 
145
-		if( $rows ) {
145
+		if ($rows) {
146 146
 			return true;
147 147
 		} else {
148 148
 			return false;
@@ -162,14 +162,14 @@  discard block
 block discarded – undo
162 162
 		$col_data = '';
163 163
 		$cols = $this->get_csv_cols();
164 164
 		$i = 1;
165
-		foreach( $cols as $col_id => $column ) {
166
-			$col_data .= '"' . addslashes( $column ) . '"';
167
-			$col_data .= $i == count( $cols ) ? '' : ',';
165
+		foreach ($cols as $col_id => $column) {
166
+			$col_data .= '"'.addslashes($column).'"';
167
+			$col_data .= $i == count($cols) ? '' : ',';
168 168
 			$i++;
169 169
 		}
170 170
 		$col_data .= "\r\n";
171 171
 
172
-		$this->stash_step_data( $col_data );
172
+		$this->stash_step_data($col_data);
173 173
 
174 174
 		return $col_data;
175 175
 
@@ -188,23 +188,23 @@  discard block
 block discarded – undo
188 188
 		$data     = $this->get_data();
189 189
 		$cols     = $this->get_csv_cols();
190 190
 
191
-		if( $data ) {
191
+		if ($data) {
192 192
 
193 193
 			// Output each row
194
-			foreach ( $data as $row ) {
194
+			foreach ($data as $row) {
195 195
 				$i = 1;
196
-				foreach ( $row as $col_id => $column ) {
196
+				foreach ($row as $col_id => $column) {
197 197
 					// Make sure the column is valid
198
-					if ( array_key_exists( $col_id, $cols ) ) {
199
-						$row_data .= '"' . addslashes( preg_replace( "/\"/","'", $column ) ) . '"';
200
-						$row_data .= $i == count( $cols ) ? '' : ',';
198
+					if (array_key_exists($col_id, $cols)) {
199
+						$row_data .= '"'.addslashes(preg_replace("/\"/", "'", $column)).'"';
200
+						$row_data .= $i == count($cols) ? '' : ',';
201 201
 						$i++;
202 202
 					}
203 203
 				}
204 204
 				$row_data .= "\r\n";
205 205
 			}
206 206
 
207
-			$this->stash_step_data( $row_data );
207
+			$this->stash_step_data($row_data);
208 208
 
209 209
 			return $row_data;
210 210
 		}
@@ -232,18 +232,18 @@  discard block
 block discarded – undo
232 232
 
233 233
 		$file = '';
234 234
 
235
-		if ( @file_exists( $this->file ) ) {
235
+		if (@file_exists($this->file)) {
236 236
 
237
-			if ( ! is_writeable( $this->file ) ) {
237
+			if ( ! is_writeable($this->file)) {
238 238
 				$this->is_writable = false;
239 239
 			}
240 240
 
241
-			$file = @file_get_contents( $this->file );
241
+			$file = @file_get_contents($this->file);
242 242
 
243 243
 		} else {
244 244
 
245
-			@file_put_contents( $this->file, '' );
246
-			@chmod( $this->file, 0664 );
245
+			@file_put_contents($this->file, '');
246
+			@chmod($this->file, 0664);
247 247
 
248 248
 		}
249 249
 
@@ -257,18 +257,18 @@  discard block
 block discarded – undo
257 257
 	 * @param $data string The data to add to the file
258 258
 	 * @return void
259 259
 	 */
260
-	protected function stash_step_data( $data = '' ) {
260
+	protected function stash_step_data($data = '') {
261 261
 
262 262
 		$file = $this->get_file();
263 263
 		$file .= $data;
264
-		@file_put_contents( $this->file, $file );
264
+		@file_put_contents($this->file, $file);
265 265
 
266 266
 		// If we have no rows after this step, mark it as an empty export
267
-		$file_rows    = file( $this->file, FILE_SKIP_EMPTY_LINES);
267
+		$file_rows    = file($this->file, FILE_SKIP_EMPTY_LINES);
268 268
 		$default_cols = $this->get_csv_cols();
269
-		$default_cols = empty( $default_cols ) ? 0 : 1;
269
+		$default_cols = empty($default_cols) ? 0 : 1;
270 270
 
271
-		$this->is_empty = count( $file_rows ) == $default_cols ? true : false;
271
+		$this->is_empty = count($file_rows) == $default_cols ? true : false;
272 272
 
273 273
 	}
274 274
 
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 
287 287
 		$file = $this->get_file();
288 288
 
289
-		@unlink( $this->file );
289
+		@unlink($this->file);
290 290
 
291 291
 		echo $file;
292 292
 
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 	 * @since 1.5
300 300
 	 * @param array $request The Form Data passed into the batch processing
301 301
 	 */
302
-	public function set_properties( $request ) {}
302
+	public function set_properties($request) {}
303 303
 
304 304
 	/**
305 305
 	 * Allow for prefetching of data for the remainder of the exporter
Please login to merge, or discard this patch.
includes/admin/reporting/export/class-batch-export-customers.php 1 patch
Spacing   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -46,16 +46,16 @@  discard block
 block discarded – undo
46 46
 	 *
47 47
 	 * @param array $request The Form Data passed into the batch processing
48 48
 	 */
49
-	public function set_properties( $request ) {
49
+	public function set_properties($request) {
50 50
 
51 51
 		//Set data from form submission
52
-		if ( isset( $_POST['form'] ) ) {
53
-			parse_str( $_POST['form'], $this->data );
52
+		if (isset($_POST['form'])) {
53
+			parse_str($_POST['form'], $this->data);
54 54
 		}
55 55
 
56 56
 		$this->form = $this->data['forms'];
57 57
 
58
-		$this->price_id = ! empty( $request['give_price_option'] ) && 0 !== $request['give_price_option'] ? absint( $request['give_price_option'] ) : null;
58
+		$this->price_id = ! empty($request['give_price_option']) && 0 !== $request['give_price_option'] ? absint($request['give_price_option']) : null;
59 59
 
60 60
 	}
61 61
 
@@ -70,14 +70,14 @@  discard block
 block discarded – undo
70 70
 
71 71
 		$cols = array();
72 72
 
73
-		$columns = isset( $this->data['give_export_option'] ) ? $this->data['give_export_option'] : array();
73
+		$columns = isset($this->data['give_export_option']) ? $this->data['give_export_option'] : array();
74 74
 
75 75
 		//We need columns.
76
-		if ( empty( $columns ) ) {
76
+		if (empty($columns)) {
77 77
 			return false;
78 78
 		}
79 79
 
80
-		$cols = $this->get_cols( $columns );
80
+		$cols = $this->get_cols($columns);
81 81
 
82 82
 		return $cols;
83 83
 	}
@@ -85,38 +85,38 @@  discard block
 block discarded – undo
85 85
 	/**
86 86
 	 * @param $column
87 87
 	 */
88
-	private function get_cols( $columns ) {
88
+	private function get_cols($columns) {
89 89
 
90 90
 		$cols = array();
91 91
 
92
-		foreach ( $columns as $key => $value ) {
92
+		foreach ($columns as $key => $value) {
93 93
 
94
-			switch ( $key ) {
94
+			switch ($key) {
95 95
 				case 'full_name' :
96
-					$cols['full_name'] = esc_html__( 'Full Name', 'give' );
96
+					$cols['full_name'] = esc_html__('Full Name', 'give');
97 97
 					break;
98 98
 				case 'email' :
99
-					$cols['email'] = esc_html__( 'Email Address', 'give' );
99
+					$cols['email'] = esc_html__('Email Address', 'give');
100 100
 					break;
101 101
 				case 'address' :
102
-					$cols['address_line1']   = esc_html__( 'Address', 'give' );
103
-					$cols['address_line2']   = esc_html__( 'Address 2', 'give' );
104
-					$cols['address_city']    = esc_html__( 'City', 'give' );
105
-					$cols['address_state']   = esc_html__( 'State', 'give' );
106
-					$cols['address_zip']     = esc_html__( 'Zip', 'give' );
107
-					$cols['address_country'] = esc_html__( 'Country', 'give' );
102
+					$cols['address_line1']   = esc_html__('Address', 'give');
103
+					$cols['address_line2']   = esc_html__('Address 2', 'give');
104
+					$cols['address_city']    = esc_html__('City', 'give');
105
+					$cols['address_state']   = esc_html__('State', 'give');
106
+					$cols['address_zip']     = esc_html__('Zip', 'give');
107
+					$cols['address_country'] = esc_html__('Country', 'give');
108 108
 					break;
109 109
 				case 'userid' :
110
-					$cols['userid'] = esc_html__( 'User ID', 'give' );
110
+					$cols['userid'] = esc_html__('User ID', 'give');
111 111
 					break;
112 112
 				case 'date_first_donated' :
113
-					$cols['date_first_donated'] = esc_html__( 'First Donation Date', 'give' );
113
+					$cols['date_first_donated'] = esc_html__('First Donation Date', 'give');
114 114
 					break;
115 115
 				case 'donations' :
116
-					$cols['donations'] = esc_html__( 'Number of Donations', 'give' );
116
+					$cols['donations'] = esc_html__('Number of Donations', 'give');
117 117
 					break;
118 118
 				case 'donation_sum' :
119
-					$cols['donation_sum'] = esc_html__( 'Sum of Donations', 'give' );
119
+					$cols['donation_sum'] = esc_html__('Sum of Donations', 'give');
120 120
 					break;
121 121
 			}
122 122
 		}
@@ -139,20 +139,20 @@  discard block
 block discarded – undo
139 139
 
140 140
 		$i = 0;
141 141
 
142
-		if ( ! empty( $this->form ) ) {
142
+		if ( ! empty($this->form)) {
143 143
 
144 144
 			// Export donors of a specific product
145 145
 			global $give_logs;
146 146
 
147 147
 			$args = array(
148
-				'post_parent'    => absint( $this->form ),
148
+				'post_parent'    => absint($this->form),
149 149
 				'log_type'       => 'sale',
150 150
 				'posts_per_page' => 30,
151 151
 				'paged'          => $this->step
152 152
 			);
153 153
 
154 154
 			//Check for price option
155
-			if ( null !== $this->price_id ) {
155
+			if (null !== $this->price_id) {
156 156
 				$args['meta_query'] = array(
157 157
 					array(
158 158
 						'key'   => '_give_log_price_id',
@@ -161,33 +161,33 @@  discard block
 block discarded – undo
161 161
 				);
162 162
 			}
163 163
 
164
-			$logs = $give_logs->get_connected_logs( $args );
164
+			$logs = $give_logs->get_connected_logs($args);
165 165
 
166
-			if ( $logs ) {
167
-				foreach ( $logs as $log ) {
168
-					$payment_id = get_post_meta( $log->ID, '_give_log_payment_id', true );
169
-					$payment    = new Give_Payment( $payment_id );
170
-					$donor      = Give()->customers->get_customer_by( 'id', $payment->customer_id );
171
-					$data[]     = $this->set_donor_data( $i, $data, $donor );
172
-					$i ++;
166
+			if ($logs) {
167
+				foreach ($logs as $log) {
168
+					$payment_id = get_post_meta($log->ID, '_give_log_payment_id', true);
169
+					$payment    = new Give_Payment($payment_id);
170
+					$donor      = Give()->customers->get_customer_by('id', $payment->customer_id);
171
+					$data[]     = $this->set_donor_data($i, $data, $donor);
172
+					$i++;
173 173
 				}
174 174
 			}
175 175
 
176 176
 		} else {
177 177
 
178 178
 			// Export all customers
179
-			$offset = 30 * ( $this->step - 1 );
180
-			$donors = Give()->customers->get_customers( array( 'number' => 30, 'offset' => $offset ) );
179
+			$offset = 30 * ($this->step - 1);
180
+			$donors = Give()->customers->get_customers(array('number' => 30, 'offset' => $offset));
181 181
 
182
-			foreach ( $donors as $donor ) {
182
+			foreach ($donors as $donor) {
183 183
 
184
-				$data[] = $this->set_donor_data( $i, $data, $donor );
185
-				$i ++;
184
+				$data[] = $this->set_donor_data($i, $data, $donor);
185
+				$i++;
186 186
 			}
187 187
 		}
188 188
 
189
-		$data = apply_filters( 'give_export_get_data', $data );
190
-		$data = apply_filters( "give_export_get_data_{$this->export_type}", $data );
189
+		$data = apply_filters('give_export_get_data', $data);
190
+		$data = apply_filters("give_export_get_data_{$this->export_type}", $data);
191 191
 
192 192
 		return $data;
193 193
 	}
@@ -203,19 +203,19 @@  discard block
 block discarded – undo
203 203
 		$percentage = 0;
204 204
 
205 205
 		// We can't count the number when getting them for a specific form
206
-		if ( empty( $this->form ) ) {
206
+		if (empty($this->form)) {
207 207
 
208 208
 			$total = Give()->customers->count();
209 209
 
210
-			if ( $total > 0 ) {
210
+			if ($total > 0) {
211 211
 
212
-				$percentage = ( ( 30 * $this->step ) / $total ) * 100;
212
+				$percentage = ((30 * $this->step) / $total) * 100;
213 213
 
214 214
 			}
215 215
 
216 216
 		}
217 217
 
218
-		if ( $percentage > 100 ) {
218
+		if ($percentage > 100) {
219 219
 			$percentage = 100;
220 220
 		}
221 221
 
@@ -227,46 +227,46 @@  discard block
 block discarded – undo
227 227
 	 *
228 228
 	 * @param $donor
229 229
 	 */
230
-	private function set_donor_data( $i, $data, $donor ) {
230
+	private function set_donor_data($i, $data, $donor) {
231 231
 
232 232
 		$columns = $this->csv_cols();
233 233
 
234 234
 		//Set address variable
235 235
 		$address = '';
236
-		if ( isset( $donor->user_id ) && $donor->user_id > 0 ) {
237
-			$address = give_get_donor_address( $donor->user_id );
236
+		if (isset($donor->user_id) && $donor->user_id > 0) {
237
+			$address = give_get_donor_address($donor->user_id);
238 238
 		}
239 239
 
240 240
 		//Set columns
241
-		if ( ! empty( $columns['full_name'] ) ) {
242
-			$data[ $i ]['full_name'] = $donor->name;
241
+		if ( ! empty($columns['full_name'])) {
242
+			$data[$i]['full_name'] = $donor->name;
243 243
 		}
244
-		if ( ! empty( $columns['email'] ) ) {
245
-			$data[ $i ]['email'] = $donor->email;
244
+		if ( ! empty($columns['email'])) {
245
+			$data[$i]['email'] = $donor->email;
246 246
 		}
247
-		if ( ! empty( $columns['address_line1'] ) ) {
248
-
249
-			$data[ $i ]['address_line1']   = isset( $address['line1'] ) ? $address['line1'] : '';
250
-			$data[ $i ]['address_line2']   = isset( $address['line2'] ) ? $address['line2'] : '';
251
-			$data[ $i ]['address_city']    = isset( $address['city'] ) ? $address['city'] : '';
252
-			$data[ $i ]['address_state']   = isset( $address['state'] ) ? $address['state'] : '';
253
-			$data[ $i ]['address_zip']     = isset( $address['zip'] ) ? $address['zip'] : '';
254
-			$data[ $i ]['address_country'] = isset( $address['country'] ) ? $address['country'] : '';
247
+		if ( ! empty($columns['address_line1'])) {
248
+
249
+			$data[$i]['address_line1']   = isset($address['line1']) ? $address['line1'] : '';
250
+			$data[$i]['address_line2']   = isset($address['line2']) ? $address['line2'] : '';
251
+			$data[$i]['address_city']    = isset($address['city']) ? $address['city'] : '';
252
+			$data[$i]['address_state']   = isset($address['state']) ? $address['state'] : '';
253
+			$data[$i]['address_zip']     = isset($address['zip']) ? $address['zip'] : '';
254
+			$data[$i]['address_country'] = isset($address['country']) ? $address['country'] : '';
255 255
 		}
256
-		if ( ! empty( $columns['userid'] ) ) {
257
-			$data[ $i ]['userid'] = ! empty( $donor->user_id ) ? $donor->user_id : '';
256
+		if ( ! empty($columns['userid'])) {
257
+			$data[$i]['userid'] = ! empty($donor->user_id) ? $donor->user_id : '';
258 258
 		}
259
-		if ( ! empty( $columns['date_first_donated'] ) ) {
260
-			$data[ $i ]['date_first_donated'] = date_i18n( give_date_format(), strtotime( $donor->date_created ) );
259
+		if ( ! empty($columns['date_first_donated'])) {
260
+			$data[$i]['date_first_donated'] = date_i18n(give_date_format(), strtotime($donor->date_created));
261 261
 		}
262
-		if ( ! empty( $columns['donations'] ) ) {
263
-			$data[ $i ]['donations'] = $donor->purchase_count;
262
+		if ( ! empty($columns['donations'])) {
263
+			$data[$i]['donations'] = $donor->purchase_count;
264 264
 		}
265
-		if ( ! empty( $columns['donation_sum'] ) ) {
266
-			$data[ $i ]['donation_sum'] = give_format_amount( $donor->purchase_value );
265
+		if ( ! empty($columns['donation_sum'])) {
266
+			$data[$i]['donation_sum'] = give_format_amount($donor->purchase_value);
267 267
 		}
268 268
 
269
-		return $data[ $i ];
269
+		return $data[$i];
270 270
 
271 271
 	}
272 272
 
Please login to merge, or discard this patch.
includes/admin/shortcodes/shortcode-give-form.php 1 patch
Spacing   +33 added lines, -33 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
 
@@ -24,10 +24,10 @@  discard block
 block discarded – undo
24 24
 	 */
25 25
 	public function __construct() {
26 26
 
27
-		$this->shortcode['title']   = esc_html__( 'Donation Form', 'give' );
28
-		$this->shortcode['label']   = esc_html__( 'Donation Form', 'give' );
27
+		$this->shortcode['title']   = esc_html__('Donation Form', 'give');
28
+		$this->shortcode['label']   = esc_html__('Donation Form', 'give');
29 29
 
30
-		parent::__construct( 'give_form' );
30
+		parent::__construct('give_form');
31 31
 	}
32 32
 
33 33
 	/**
@@ -39,8 +39,8 @@  discard block
 block discarded – undo
39 39
 
40 40
 		$create_form_link = sprintf(
41 41
 			/* translators: %s: create new form URL */
42
-			__( '<a href="%s">Create</a> a new Donation Form.', 'give' ),
43
-			admin_url( 'post-new.php?post_type=give_forms' )
42
+			__('<a href="%s">Create</a> a new Donation Form.', 'give'),
43
+			admin_url('post-new.php?post_type=give_forms')
44 44
 		);
45 45
 
46 46
 		return array(
@@ -50,68 +50,68 @@  discard block
 block discarded – undo
50 50
 					'post_type' => 'give_forms',
51 51
 				),
52 52
 				'name'        => 'id',
53
-				'tooltip'     => esc_attr__( 'Select a Donation Form', 'give' ),
54
-				'placeholder' => esc_attr__( '- Select a Form -', 'give' ),
53
+				'tooltip'     => esc_attr__('Select a Donation Form', 'give'),
54
+				'placeholder' => esc_attr__('- Select a Form -', 'give'),
55 55
 				'required'    => array(
56
-					'alert' => esc_html__( 'You must first select a Form!', 'give' ),
57
-					'error' => sprintf( '<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__( 'No forms found.', 'give' ), $create_form_link ),
56
+					'alert' => esc_html__('You must first select a Form!', 'give'),
57
+					'error' => sprintf('<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__('No forms found.', 'give'), $create_form_link),
58 58
 				),
59 59
 			),
60 60
 			array(
61 61
 				'type' => 'container',
62
-				'html' => sprintf( '<p class="strong margin-top">%s</p>', esc_html__( 'Optional settings', 'give' ) ),
62
+				'html' => sprintf('<p class="strong margin-top">%s</p>', esc_html__('Optional settings', 'give')),
63 63
 			),
64 64
 			array(
65 65
 				'type'    => 'listbox',
66 66
 				'name'    => 'show_title',
67
-				'label'   => esc_attr__( 'Show Title:', 'give' ),
68
-				'tooltip' => esc_attr__( 'Do you want to display the form title?', 'give' ),
67
+				'label'   => esc_attr__('Show Title:', 'give'),
68
+				'tooltip' => esc_attr__('Do you want to display the form title?', 'give'),
69 69
 				'options' => array(
70
-					'true'  => esc_html__( 'Show', 'give' ),
71
-					'false' => esc_html__( 'Hide', 'give' ),
70
+					'true'  => esc_html__('Show', 'give'),
71
+					'false' => esc_html__('Hide', 'give'),
72 72
 				),
73 73
 			),
74 74
 			array(
75 75
 				'type'    => 'listbox',
76 76
 				'name'    => 'show_goal',
77
-				'label'   => esc_attr__( 'Show Goal:', 'give' ),
78
-				'tooltip' => esc_attr__( 'Do you want to display the donation goal?', 'give' ),
77
+				'label'   => esc_attr__('Show Goal:', 'give'),
78
+				'tooltip' => esc_attr__('Do you want to display the donation goal?', 'give'),
79 79
 				'options' => array(
80
-					'true'  => esc_html__( 'Show', 'give' ),
81
-					'false' => esc_html__( 'Hide', 'give' ),
80
+					'true'  => esc_html__('Show', 'give'),
81
+					'false' => esc_html__('Hide', 'give'),
82 82
 				),
83 83
 			),
84 84
 			array(
85 85
 				'type'    => 'listbox',
86 86
 				'name'    => 'show_content',
87 87
 				'minWidth' => 240,
88
-				'label'   => esc_attr__( 'Display Content:', 'give' ),
89
-				'tooltip' => esc_attr__( 'Do you want to display the form content?', 'give' ),
88
+				'label'   => esc_attr__('Display Content:', 'give'),
89
+				'tooltip' => esc_attr__('Do you want to display the form content?', 'give'),
90 90
 				'options' => array(
91
-					'none'  => esc_html__( 'No Content', 'give' ),
92
-					'above' => esc_html__( 'Display content ABOVE the fields', 'give' ),
93
-					'below' => esc_html__( 'Display content BELOW the fields', 'give' ),
91
+					'none'  => esc_html__('No Content', 'give'),
92
+					'above' => esc_html__('Display content ABOVE the fields', 'give'),
93
+					'below' => esc_html__('Display content BELOW the fields', 'give'),
94 94
 				),
95 95
 			),
96 96
 			array(
97 97
 				'type'    => 'listbox',
98 98
 				'name'    => 'display_style',
99
-				'label'   => esc_attr__( 'Donation Fields:', 'give' ),
100
-				'tooltip' => esc_attr__( 'How would you like to display donation information?', 'give' ),
99
+				'label'   => esc_attr__('Donation Fields:', 'give'),
100
+				'tooltip' => esc_attr__('How would you like to display donation information?', 'give'),
101 101
 				'options' => array(
102
-					'onpage' => esc_html__( 'Show on Page', 'give' ),
103
-					'reveal' => esc_html__( 'Reveal Upon Click', 'give' ),
104
-					'modal'  => esc_html__( 'Modal Window Upon Click', 'give' ),
102
+					'onpage' => esc_html__('Show on Page', 'give'),
103
+					'reveal' => esc_html__('Reveal Upon Click', 'give'),
104
+					'modal'  => esc_html__('Modal Window Upon Click', 'give'),
105 105
 				),
106 106
 			),
107 107
 			array(
108 108
 				'type'    => 'listbox',
109 109
 				'name'    => 'float_labels',
110
-				'label'   => esc_attr__( 'Floating Labels:', 'give' ),
111
-				'tooltip' => esc_attr__( 'Override the default floating labels setting for this form.', 'give' ),
110
+				'label'   => esc_attr__('Floating Labels:', 'give'),
111
+				'tooltip' => esc_attr__('Override the default floating labels setting for this form.', 'give'),
112 112
 				'options' => array(
113
-					'enabled'  => esc_html__( 'Enabled', 'give' ),
114
-					'disabled' => esc_html__( 'Disabled', 'give' ),
113
+					'enabled'  => esc_html__('Enabled', 'give'),
114
+					'disabled' => esc_html__('Disabled', 'give'),
115 115
 				),
116 116
 			),
117 117
 		);
Please login to merge, or discard this patch.
includes/admin/shortcodes/abstract-shortcode-generator.php 1 patch
Spacing   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if accessed directly
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
@@ -62,12 +62,12 @@  discard block
 block discarded – undo
62 62
 	 *
63 63
 	 * @since 1.0
64 64
 	 */
65
-	public function __construct( $shortcode ) {
65
+	public function __construct($shortcode) {
66 66
 
67 67
 
68 68
 		$this->shortcode_tag = $shortcode;
69 69
 
70
-		add_action( 'admin_init', array( $this, 'init' ) );
70
+		add_action('admin_init', array($this, 'init'));
71 71
 
72 72
 	}
73 73
 
@@ -78,9 +78,9 @@  discard block
 block discarded – undo
78 78
 	 */
79 79
 	public function init() {
80 80
 
81
-		if ( $this->shortcode_tag ) {
81
+		if ($this->shortcode_tag) {
82 82
 
83
-			$this->self = get_class( $this );
83
+			$this->self = get_class($this);
84 84
 
85 85
 			$this->errors   = array();
86 86
 			$this->required = array();
@@ -89,18 +89,18 @@  discard block
 block discarded – undo
89 89
 			$fields = $this->get_fields();
90 90
 
91 91
 			$defaults = array(
92
-				'btn_close' => esc_html__( 'Close', 'give' ),
93
-				'btn_okay'  => esc_html__( 'Insert Shortcode', 'give' ),
92
+				'btn_close' => esc_html__('Close', 'give'),
93
+				'btn_okay'  => esc_html__('Insert Shortcode', 'give'),
94 94
 				'errors'    => $this->errors,
95 95
 				'fields'    => $fields,
96
-				'label'     => '[' . $this->shortcode_tag . ']',
96
+				'label'     => '['.$this->shortcode_tag.']',
97 97
 				'required'  => $this->required,
98
-				'title'     => esc_html__( 'Insert Shortcode', 'give' ),
98
+				'title'     => esc_html__('Insert Shortcode', 'give'),
99 99
 			);
100 100
 
101
-			if ( user_can_richedit() ) {
101
+			if (user_can_richedit()) {
102 102
 
103
-				Give_Shortcode_Button::$shortcodes[ $this->shortcode_tag ] = wp_parse_args( $this->shortcode, $defaults );
103
+				Give_Shortcode_Button::$shortcodes[$this->shortcode_tag] = wp_parse_args($this->shortcode, $defaults);
104 104
 
105 105
 			}
106 106
 		}
@@ -129,13 +129,13 @@  discard block
 block discarded – undo
129 129
 	 *
130 130
 	 * @since 1.0
131 131
 	 */
132
-	protected function generate_fields( $defined_fields ) {
132
+	protected function generate_fields($defined_fields) {
133 133
 
134 134
 		$fields = array();
135 135
 
136
-		if ( is_array( $defined_fields ) ) {
136
+		if (is_array($defined_fields)) {
137 137
 
138
-			foreach ( $defined_fields as $field ) {
138
+			foreach ($defined_fields as $field) {
139 139
 
140 140
 				$defaults = array(
141 141
 					'label'       => false,
@@ -146,14 +146,14 @@  discard block
 block discarded – undo
146 146
 					'type'        => '',
147 147
 				);
148 148
 
149
-				$field  = wp_parse_args( (array) $field, $defaults );
150
-				$method = 'generate_' . strtolower( $field['type'] );
149
+				$field  = wp_parse_args((array) $field, $defaults);
150
+				$method = 'generate_'.strtolower($field['type']);
151 151
 
152
-				if ( method_exists( $this, $method ) ) {
152
+				if (method_exists($this, $method)) {
153 153
 
154
-					$field = call_user_func( array( $this, $method ), $field );
154
+					$field = call_user_func(array($this, $method), $field);
155 155
 
156
-					if ( $field ) {
156
+					if ($field) {
157 157
 						$fields[] = $field;
158 158
 					}
159 159
 				}
@@ -173,22 +173,22 @@  discard block
 block discarded – undo
173 173
 	protected function get_fields() {
174 174
 
175 175
 		$defined_fields   = $this->define_fields();
176
-		$generated_fields = $this->generate_fields( $defined_fields );
176
+		$generated_fields = $this->generate_fields($defined_fields);
177 177
 
178 178
 		$errors = array();
179 179
 
180
-		if ( ! empty( $this->errors ) ) {
181
-			foreach ( $this->required as $name => $alert ) {
182
-				if ( false === array_search( $name, array_column( $generated_fields, 'name' ) ) ) {
180
+		if ( ! empty($this->errors)) {
181
+			foreach ($this->required as $name => $alert) {
182
+				if (false === array_search($name, array_column($generated_fields, 'name'))) {
183 183
 
184
-					$errors[] = $this->errors[ $name ];
184
+					$errors[] = $this->errors[$name];
185 185
 				}
186 186
 			}
187 187
 
188 188
 			$this->errors = $errors;
189 189
 		}
190 190
 
191
-		if ( ! empty( $errors ) ) {
191
+		if ( ! empty($errors)) {
192 192
 
193 193
 			return $errors;
194 194
 		}
@@ -205,9 +205,9 @@  discard block
 block discarded – undo
205 205
 	 *
206 206
 	 * @since 1.0
207 207
 	 */
208
-	protected function generate_container( $field ) {
208
+	protected function generate_container($field) {
209 209
 
210
-		if ( array_key_exists( 'html', $field ) ) {
210
+		if (array_key_exists('html', $field)) {
211 211
 
212 212
 			return array(
213 213
 				'type' => $field['type'],
@@ -227,36 +227,36 @@  discard block
 block discarded – undo
227 227
 	 *
228 228
 	 * @since 1.0
229 229
 	 */
230
-	protected function generate_listbox( $field ) {
230
+	protected function generate_listbox($field) {
231 231
 
232
-		$listbox = shortcode_atts( array(
232
+		$listbox = shortcode_atts(array(
233 233
 			'label'    => '',
234 234
 			'minWidth' => '',
235 235
 			'name'     => false,
236 236
 			'tooltip'  => '',
237 237
 			'type'     => '',
238 238
 			'value'    => '',
239
-		), $field );
239
+		), $field);
240 240
 
241
-		if ( $this->validate( $field ) ) {
241
+		if ($this->validate($field)) {
242 242
 
243 243
 			$new_listbox = array();
244 244
 
245
-			foreach ( $listbox as $key => $value ) {
245
+			foreach ($listbox as $key => $value) {
246 246
 
247
-				if ( $key == 'value' && empty( $value ) ) {
248
-					$new_listbox[ $key ] = $listbox['name'];
249
-				} else if ( $value ) {
250
-					$new_listbox[ $key ] = $value;
247
+				if ($key == 'value' && empty($value)) {
248
+					$new_listbox[$key] = $listbox['name'];
249
+				} else if ($value) {
250
+					$new_listbox[$key] = $value;
251 251
 				}
252 252
 			}
253 253
 
254 254
 			// do not reindex array!
255 255
 			$field['options'] = array(
256
-				                    '' => ( $field['placeholder'] ? $field['placeholder'] : esc_attr__( '- Select -', 'give' ) ),
256
+				                    '' => ($field['placeholder'] ? $field['placeholder'] : esc_attr__('- Select -', 'give')),
257 257
 			                    ) + $field['options'];
258 258
 
259
-			foreach ( $field['options'] as $value => $text ) {
259
+			foreach ($field['options'] as $value => $text) {
260 260
 				$new_listbox['values'][] = array(
261 261
 					'text'  => $text,
262 262
 					'value' => $value,
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 	 *
279 279
 	 * @since 1.0
280 280
 	 */
281
-	protected function generate_post( $field ) {
281
+	protected function generate_post($field) {
282 282
 
283 283
 		$args = array(
284 284
 			'post_type'      => 'post',
@@ -287,23 +287,23 @@  discard block
 block discarded – undo
287 287
 			'posts_per_page' => 30,
288 288
 		);
289 289
 
290
-		$args    = wp_parse_args( (array) $field['query_args'], $args );
291
-		$posts   = get_posts( $args );
290
+		$args    = wp_parse_args((array) $field['query_args'], $args);
291
+		$posts   = get_posts($args);
292 292
 		$options = array();
293 293
 
294
-		if ( $posts ) {
295
-			foreach ( $posts as $post ) {
296
-				$options[ absint( $post->ID ) ] = $post->post_title;
294
+		if ($posts) {
295
+			foreach ($posts as $post) {
296
+				$options[absint($post->ID)] = $post->post_title;
297 297
 			}
298 298
 
299 299
 			$field['type']    = 'listbox';
300 300
 			$field['options'] = $options;
301 301
 
302
-			return $this->generate_listbox( $field );
302
+			return $this->generate_listbox($field);
303 303
 		}
304 304
 
305 305
 		// perform validation here before returning false
306
-		$this->validate( $field );
306
+		$this->validate($field);
307 307
 
308 308
 		return false;
309 309
 	}
@@ -317,9 +317,9 @@  discard block
 block discarded – undo
317 317
 	 *
318 318
 	 * @since 1.0
319 319
 	 */
320
-	protected function generate_textbox( $field ) {
320
+	protected function generate_textbox($field) {
321 321
 
322
-		$textbox = shortcode_atts( array(
322
+		$textbox = shortcode_atts(array(
323 323
 			'label'     => '',
324 324
 			'maxLength' => '',
325 325
 			'minHeight' => '',
@@ -329,10 +329,10 @@  discard block
 block discarded – undo
329 329
 			'tooltip'   => '',
330 330
 			'type'      => '',
331 331
 			'value'     => '',
332
-		), $field );
332
+		), $field);
333 333
 
334
-		if ( $this->validate( $field ) ) {
335
-			return array_filter( $textbox, array( $this, 'return_textbox_value' ) );
334
+		if ($this->validate($field)) {
335
+			return array_filter($textbox, array($this, 'return_textbox_value'));
336 336
 		}
337 337
 
338 338
 		return false;
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
 	 *
346 346
 	 * @return bool
347 347
 	 */
348
-	function return_textbox_value( $value ) {
348
+	function return_textbox_value($value) {
349 349
 		return $value !== '';
350 350
 	}
351 351
 
@@ -361,9 +361,9 @@  discard block
 block discarded – undo
361 361
 	 *
362 362
 	 * @since 1.0
363 363
 	 */
364
-	protected function validate( $field ) {
364
+	protected function validate($field) {
365 365
 
366
-		extract( shortcode_atts(
366
+		extract(shortcode_atts(
367 367
 				array(
368 368
 					'name'     => false,
369 369
 					'required' => false,
@@ -371,36 +371,36 @@  discard block
 block discarded – undo
371 371
 				), $field )
372 372
 		);
373 373
 
374
-		if ( $name ) {
374
+		if ($name) {
375 375
 
376
-			if ( isset( $required['error'] ) ) {
376
+			if (isset($required['error'])) {
377 377
 
378 378
 				$error = array(
379 379
 					'type' => 'container',
380 380
 					'html' => $required['error'],
381 381
 				);
382 382
 
383
-				$this->errors[ $name ] = $this->generate_container( $error );
383
+				$this->errors[$name] = $this->generate_container($error);
384 384
 			}
385 385
 
386
-			if ( ! ! $required || is_array( $required ) ) {
386
+			if ( ! ! $required || is_array($required)) {
387 387
 
388
-				$alert = esc_html__( 'Some of the shortcode options are required.', 'give' );
388
+				$alert = esc_html__('Some of the shortcode options are required.', 'give');
389 389
 
390
-				if ( isset( $required['alert'] ) ) {
390
+				if (isset($required['alert'])) {
391 391
 
392 392
 					$alert = $required['alert'];
393 393
 
394
-				} else if ( ! empty( $label ) ) {
394
+				} else if ( ! empty($label)) {
395 395
 
396 396
 					$alert = sprintf(
397 397
 					/* translators: %s: option label */
398
-						esc_html__( 'The "%s" option is required.', 'give' ),
399
-						str_replace( ':', '', $label )
398
+						esc_html__('The "%s" option is required.', 'give'),
399
+						str_replace(':', '', $label)
400 400
 					);
401 401
 				}
402 402
 
403
-				$this->required[ $name ] = $alert;
403
+				$this->required[$name] = $alert;
404 404
 			}
405 405
 
406 406
 			return true;
Please login to merge, or discard this patch.
includes/admin/shortcodes/shortcode-give-donation-history.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -21,9 +21,9 @@  discard block
 block discarded – undo
21 21
 	 */
22 22
 	public function __construct() {
23 23
 
24
-		$this->shortcode['label'] = esc_html__( 'Donation History', 'give' );
24
+		$this->shortcode['label'] = esc_html__('Donation History', 'give');
25 25
 
26
-		parent::__construct( 'donation_history' );
26
+		parent::__construct('donation_history');
27 27
 	}
28 28
 }
29 29
 
Please login to merge, or discard this patch.
includes/admin/shortcodes/shortcode-give-register.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -21,10 +21,10 @@  discard block
 block discarded – undo
21 21
 	 */
22 22
 	public function __construct() {
23 23
 
24
-		$this->shortcode['title'] = esc_html__( 'Register', 'give' );
25
-		$this->shortcode['label'] = esc_html__( 'Register', 'give' );
24
+		$this->shortcode['title'] = esc_html__('Register', 'give');
25
+		$this->shortcode['label'] = esc_html__('Register', 'give');
26 26
 
27
-		parent::__construct( 'give_register' );
27
+		parent::__construct('give_register');
28 28
 	}
29 29
 
30 30
 	/**
@@ -37,13 +37,13 @@  discard block
 block discarded – undo
37 37
 		return array(
38 38
 			array(
39 39
 				'type' => 'container',
40
-				'html' => sprintf( '<p class="no-margin">%s</p>', esc_html__( 'Redirect URL (optional):', 'give' ) ),
40
+				'html' => sprintf('<p class="no-margin">%s</p>', esc_html__('Redirect URL (optional):', 'give')),
41 41
 			),
42 42
 			array(
43 43
 				'type'     => 'textbox',
44 44
 				'name'     => 'redirect',
45 45
 				'minWidth' => 320,
46
-				'tooltip'  => esc_attr__( 'Enter an URL here to redirect to after registering.', 'give' ),
46
+				'tooltip'  => esc_attr__('Enter an URL here to redirect to after registering.', 'give'),
47 47
 			),
48 48
 		);
49 49
 	}
Please login to merge, or discard this patch.