Completed
Push — master ( 43a8e8...650f94 )
by Devin
11s
created
includes/admin/reporting/reports.php 1 patch
Spacing   +108 added lines, -108 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  */
17 17
 
18 18
 // Exit if accessed directly
19
-if ( ! defined( 'ABSPATH' ) ) {
19
+if ( ! defined('ABSPATH')) {
20 20
 	exit;
21 21
 }
22 22
 
@@ -29,39 +29,39 @@  discard block
 block discarded – undo
29 29
  * @return void
30 30
  */
31 31
 function give_reports_page() {
32
-	$current_page = admin_url( 'edit.php?post_type=give_forms&page=give-reports' );
33
-	$active_tab   = isset( $_GET['tab'] ) ? $_GET['tab'] : 'reports';
32
+	$current_page = admin_url('edit.php?post_type=give_forms&page=give-reports');
33
+	$active_tab   = isset($_GET['tab']) ? $_GET['tab'] : 'reports';
34 34
 	?>
35 35
 	<div class="wrap">
36 36
 
37
-		<h1 class="screen-reader-text"><?php esc_html_e( 'Give Reports', 'give' ); ?></h1>
37
+		<h1 class="screen-reader-text"><?php esc_html_e('Give Reports', 'give'); ?></h1>
38 38
 
39 39
 		<h2 class="nav-tab-wrapper">
40
-			<a href="<?php echo esc_url( add_query_arg( array(
40
+			<a href="<?php echo esc_url(add_query_arg(array(
41 41
 				'tab'              => 'reports',
42 42
 				'settings-updated' => false
43
-			), $current_page ) ); ?>" class="nav-tab <?php echo $active_tab == 'reports' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e( 'Reports', 'give' ); ?></a>
44
-			<?php if ( current_user_can( 'export_give_reports' ) ) { ?>
45
-				<a href="<?php echo esc_url( add_query_arg( array(
43
+			), $current_page)); ?>" class="nav-tab <?php echo $active_tab == 'reports' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e('Reports', 'give'); ?></a>
44
+			<?php if (current_user_can('export_give_reports')) { ?>
45
+				<a href="<?php echo esc_url(add_query_arg(array(
46 46
 					'tab'              => 'export',
47 47
 					'settings-updated' => false
48
-				), $current_page ) ); ?>" class="nav-tab <?php echo $active_tab == 'export' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e( 'Export', 'give' ); ?></a>
48
+				), $current_page)); ?>" class="nav-tab <?php echo $active_tab == 'export' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e('Export', 'give'); ?></a>
49 49
 			<?php } ?>
50
-			<a href="<?php echo esc_url( add_query_arg( array(
50
+			<a href="<?php echo esc_url(add_query_arg(array(
51 51
 				'tab'              => 'logs',
52 52
 				'settings-updated' => false
53
-			), $current_page ) ); ?>" class="nav-tab <?php echo $active_tab == 'logs' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e( 'Logs', 'give' ); ?></a>
54
-			<a href="<?php echo esc_url( add_query_arg( array(
53
+			), $current_page)); ?>" class="nav-tab <?php echo $active_tab == 'logs' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e('Logs', 'give'); ?></a>
54
+			<a href="<?php echo esc_url(add_query_arg(array(
55 55
 				'tab'              => 'tools',
56 56
 				'settings-updated' => false
57
-			), $current_page ) ); ?>" class="nav-tab <?php echo $active_tab == 'tools' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e( 'Tools', 'give' ); ?></a>
58
-			<?php do_action( 'give_reports_tabs' ); ?>
57
+			), $current_page)); ?>" class="nav-tab <?php echo $active_tab == 'tools' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e('Tools', 'give'); ?></a>
58
+			<?php do_action('give_reports_tabs'); ?>
59 59
 		</h2>
60 60
 
61 61
 		<?php
62
-		do_action( 'give_reports_page_top' );
63
-		do_action( 'give_reports_tab_' . $active_tab );
64
-		do_action( 'give_reports_page_bottom' );
62
+		do_action('give_reports_page_top');
63
+		do_action('give_reports_tab_'.$active_tab);
64
+		do_action('give_reports_page_bottom');
65 65
 		?>
66 66
 	</div><!-- .wrap -->
67 67
 	<?php
@@ -75,13 +75,13 @@  discard block
 block discarded – undo
75 75
  */
76 76
 function give_reports_default_views() {
77 77
 	$views = array(
78
-		'earnings' => esc_html__( 'Income', 'give' ),
78
+		'earnings' => esc_html__('Income', 'give'),
79 79
 		'forms'    => give_get_forms_label_plural(),
80
-		'donors'   => esc_html__( 'Donors', 'give' ),
81
-		'gateways' => esc_html__( 'Payment Methods', 'give' )
80
+		'donors'   => esc_html__('Donors', 'give'),
81
+		'gateways' => esc_html__('Payment Methods', 'give')
82 82
 	);
83 83
 
84
-	$views = apply_filters( 'give_report_views', $views );
84
+	$views = apply_filters('give_report_views', $views);
85 85
 
86 86
 	return $views;
87 87
 }
@@ -97,15 +97,15 @@  discard block
 block discarded – undo
97 97
  * @return string $view Report View
98 98
  *
99 99
  */
100
-function give_get_reporting_view( $default = 'earnings' ) {
100
+function give_get_reporting_view($default = 'earnings') {
101 101
 
102
-	if ( ! isset( $_GET['view'] ) || ! in_array( $_GET['view'], array_keys( give_reports_default_views() ) ) ) {
102
+	if ( ! isset($_GET['view']) || ! in_array($_GET['view'], array_keys(give_reports_default_views()))) {
103 103
 		$view = $default;
104 104
 	} else {
105 105
 		$view = $_GET['view'];
106 106
 	}
107 107
 
108
-	return apply_filters( 'give_get_reporting_view', $view );
108
+	return apply_filters('give_get_reporting_view', $view);
109 109
 }
110 110
 
111 111
 /**
@@ -118,14 +118,14 @@  discard block
 block discarded – undo
118 118
 	$current_view = 'earnings';
119 119
 	$views        = give_reports_default_views();
120 120
 
121
-	if ( isset( $_GET['view'] ) && array_key_exists( $_GET['view'], $views ) ) {
121
+	if (isset($_GET['view']) && array_key_exists($_GET['view'], $views)) {
122 122
 		$current_view = $_GET['view'];
123 123
 	}
124 124
 
125
-	do_action( 'give_reports_view_' . $current_view );
125
+	do_action('give_reports_view_'.$current_view);
126 126
 }
127 127
 
128
-add_action( 'give_reports_tab_reports', 'give_reports_tab_reports' );
128
+add_action('give_reports_tab_reports', 'give_reports_tab_reports');
129 129
 
130 130
 /**
131 131
  * Renders the Reports Page Views Drop Downs
@@ -135,25 +135,25 @@  discard block
 block discarded – undo
135 135
  */
136 136
 function give_report_views() {
137 137
 	$views        = give_reports_default_views();
138
-	$current_view = isset( $_GET['view'] ) ? $_GET['view'] : 'earnings';
139
-	do_action( 'give_report_view_actions_before' );
138
+	$current_view = isset($_GET['view']) ? $_GET['view'] : 'earnings';
139
+	do_action('give_report_view_actions_before');
140 140
 	?>
141 141
 	<form id="give-reports-filter" method="get">
142 142
 		<select id="give-reports-view" name="view">
143
-			<option value="-1"><?php esc_html_e( 'Report Type', 'give' ); ?></option>
144
-			<?php foreach ( $views as $view_id => $label ) : ?>
145
-				<option value="<?php echo esc_attr( $view_id ); ?>" <?php selected( $view_id, $current_view ); ?>><?php echo $label; ?></option>
143
+			<option value="-1"><?php esc_html_e('Report Type', 'give'); ?></option>
144
+			<?php foreach ($views as $view_id => $label) : ?>
145
+				<option value="<?php echo esc_attr($view_id); ?>" <?php selected($view_id, $current_view); ?>><?php echo $label; ?></option>
146 146
 			<?php endforeach; ?>
147 147
 		</select>
148 148
 
149
-		<?php do_action( 'give_report_view_actions' ); ?>
149
+		<?php do_action('give_report_view_actions'); ?>
150 150
 
151 151
 		<input type="hidden" name="post_type" value="give_forms"/>
152 152
 		<input type="hidden" name="page" value="give-reports"/>
153
-		<?php submit_button( esc_html__( 'Show', 'give' ), 'secondary', 'submit', false ); ?>
153
+		<?php submit_button(esc_html__('Show', 'give'), 'secondary', 'submit', false); ?>
154 154
 	</form>
155 155
 	<?php
156
-	do_action( 'give_report_view_actions_after' );
156
+	do_action('give_report_view_actions_after');
157 157
 }
158 158
 
159 159
 /**
@@ -166,18 +166,18 @@  discard block
 block discarded – undo
166 166
  */
167 167
 function give_reports_forms_table() {
168 168
 
169
-	if ( isset( $_GET['form-id'] ) ) {
169
+	if (isset($_GET['form-id'])) {
170 170
 		return;
171 171
 	}
172 172
 
173
-	include( dirname( __FILE__ ) . '/class-form-reports-table.php' );
173
+	include(dirname(__FILE__).'/class-form-reports-table.php');
174 174
 
175 175
 	$give_table = new Give_Form_Reports_Table();
176 176
 	$give_table->prepare_items();
177 177
 	$give_table->display();
178 178
 }
179 179
 
180
-add_action( 'give_reports_view_forms', 'give_reports_forms_table' );
180
+add_action('give_reports_view_forms', 'give_reports_forms_table');
181 181
 
182 182
 /**
183 183
  * Renders the detailed report for a specific give form
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
  * @return void
187 187
  */
188 188
 function give_reports_form_details() {
189
-	if ( ! isset( $_GET['form-id'] ) ) {
189
+	if ( ! isset($_GET['form-id'])) {
190 190
 		return;
191 191
 	}
192 192
 	?>
@@ -194,14 +194,14 @@  discard block
 block discarded – undo
194 194
 		<div class="actions bulkactions">
195 195
 			<?php give_report_views(); ?>
196 196
 			&nbsp;
197
-			<button onclick="history.go(-1);" class="button-secondary"><?php esc_html_e( 'Go Back', 'give' ); ?></button>
197
+			<button onclick="history.go(-1);" class="button-secondary"><?php esc_html_e('Go Back', 'give'); ?></button>
198 198
 		</div>
199 199
 	</div>
200 200
 	<?php
201
-	give_reports_graph_of_form( absint( $_GET['form-id'] ) );
201
+	give_reports_graph_of_form(absint($_GET['form-id']));
202 202
 }
203 203
 
204
-add_action( 'give_reports_view_forms', 'give_reports_form_details' );
204
+add_action('give_reports_view_forms', 'give_reports_form_details');
205 205
 
206 206
 /**
207 207
  * Renders the Reports Donors Table
@@ -212,28 +212,28 @@  discard block
 block discarded – undo
212 212
  * @return void
213 213
  */
214 214
 function give_reports_donors_table() {
215
-	include( dirname( __FILE__ ) . '/class-donor-reports-table.php' );
215
+	include(dirname(__FILE__).'/class-donor-reports-table.php');
216 216
 
217 217
 	$give_table = new Give_Donor_Reports_Table();
218 218
 	$give_table->prepare_items();
219 219
 	?>
220 220
 	<div class="wrap give-reports-donors-wrap">
221
-		<?php do_action( 'give_logs_donors_table_top' ); ?>
222
-		<form id="give-donors-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-reports&view=donors' ); ?>">
221
+		<?php do_action('give_logs_donors_table_top'); ?>
222
+		<form id="give-donors-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-reports&view=donors'); ?>">
223 223
 			<?php
224
-			$give_table->search_box( esc_html__( 'Search', 'give' ), 'give-donors' );
224
+			$give_table->search_box(esc_html__('Search', 'give'), 'give-donors');
225 225
 			$give_table->display();
226 226
 			?>
227 227
 			<input type="hidden" name="post_type" value="give_forms"/>
228 228
 			<input type="hidden" name="page" value="give-reports"/>
229 229
 			<input type="hidden" name="view" value="donors"/>
230 230
 		</form>
231
-		<?php do_action( 'give_logs_donors_table_bottom' ); ?>
231
+		<?php do_action('give_logs_donors_table_bottom'); ?>
232 232
 	</div>
233 233
 	<?php
234 234
 }
235 235
 
236
-add_action( 'give_reports_view_donors', 'give_reports_donors_table' );
236
+add_action('give_reports_view_donors', 'give_reports_donors_table');
237 237
 
238 238
 
239 239
 /**
@@ -245,14 +245,14 @@  discard block
 block discarded – undo
245 245
  * @return void
246 246
  */
247 247
 function give_reports_gateways_table() {
248
-	include( dirname( __FILE__ ) . '/class-gateways-reports-table.php' );
248
+	include(dirname(__FILE__).'/class-gateways-reports-table.php');
249 249
 
250 250
 	$give_table = new Give_Gateawy_Reports_Table();
251 251
 	$give_table->prepare_items();
252 252
 	$give_table->display();
253 253
 }
254 254
 
255
-add_action( 'give_reports_view_gateways', 'give_reports_gateways_table' );
255
+add_action('give_reports_view_gateways', 'give_reports_gateways_table');
256 256
 
257 257
 
258 258
 /**
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 function give_reports_earnings() {
265 265
 	?>
266 266
 	<div class="tablenav top reports-table-nav">
267
-		<h3 class="alignleft reports-earnings-title"><span><?php esc_html_e( 'Income Over Time', 'give' ); ?></span></h3>
267
+		<h3 class="alignleft reports-earnings-title"><span><?php esc_html_e('Income Over Time', 'give'); ?></span></h3>
268 268
 
269 269
 		<div class="alignright actions reports-views-wrap"><?php give_report_views(); ?></div>
270 270
 	</div>
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 	give_reports_graph();
273 273
 }
274 274
 
275
-add_action( 'give_reports_view_earnings', 'give_reports_earnings' );
275
+add_action('give_reports_view_earnings', 'give_reports_earnings');
276 276
 
277 277
 
278 278
 /**
@@ -287,53 +287,53 @@  discard block
 block discarded – undo
287 287
 		<div id="post-body">
288 288
 			<div id="post-body-content">
289 289
 
290
-				<?php do_action( 'give_reports_tab_export_content_top' ); ?>
290
+				<?php do_action('give_reports_tab_export_content_top'); ?>
291 291
 
292 292
 				<table class="widefat export-options-table give-table">
293 293
 					<thead>
294 294
 					<tr>
295
-						<th class="row-title"><?php esc_html_e( 'Export Type', 'give' ); ?></th>
296
-						<th><?php esc_html_e( 'Export Options', 'give' ); ?></th>
295
+						<th class="row-title"><?php esc_html_e('Export Type', 'give'); ?></th>
296
+						<th><?php esc_html_e('Export Options', 'give'); ?></th>
297 297
 					</tr>
298 298
 					</thead>
299 299
 					<tbody>
300
-					<?php do_action( 'give_reports_tab_export_table_top' ); ?>
300
+					<?php do_action('give_reports_tab_export_table_top'); ?>
301 301
 					<tr class="give-export-pdf-sales-earnings">
302 302
 						<td class="row-title">
303
-							<h3><span><?php esc_html_e( 'Export PDF of Donations and Income', 'give' ); ?></span></h3>
303
+							<h3><span><?php esc_html_e('Export PDF of Donations and Income', 'give'); ?></span></h3>
304 304
 
305
-							<p><?php esc_html_e( 'Download a PDF of Donations and Income reports for all forms for the current year.', 'give' ); ?></p>
305
+							<p><?php esc_html_e('Download a PDF of Donations and Income reports for all forms for the current year.', 'give'); ?></p>
306 306
 						</td>
307 307
 						<td>
308
-							<a class="button" href="<?php echo wp_nonce_url( add_query_arg( array( 'give-action' => 'generate_pdf' ) ), 'give_generate_pdf' ); ?>"><?php esc_html_e( 'Generate PDF', 'give' ); ?></a>
308
+							<a class="button" href="<?php echo wp_nonce_url(add_query_arg(array('give-action' => 'generate_pdf')), 'give_generate_pdf'); ?>"><?php esc_html_e('Generate PDF', 'give'); ?></a>
309 309
 						</td>
310 310
 					</tr>
311 311
 					<tr class="alternate give-export-sales-earnings">
312 312
 						<td class="row-title">
313
-							<h3><span><?php esc_html_e( 'Export Income and Donation Stats', 'give' ); ?></span></h3>
313
+							<h3><span><?php esc_html_e('Export Income and Donation Stats', 'give'); ?></span></h3>
314 314
 
315
-							<p><?php esc_html_e( 'Download a CSV of income and donations over time.', 'give' ); ?></p>
315
+							<p><?php esc_html_e('Download a CSV of income and donations over time.', 'give'); ?></p>
316 316
 						</td>
317 317
 						<td>
318 318
 							<form method="post">
319 319
 								<?php
320 320
 									printf(
321 321
 										/* translators: 1: start date dropdown 2: end date dropdown */
322
-										esc_html__( '%1$s to %2$s', 'give' ),
323
-										Give()->html->year_dropdown( 'start_year' ) . ' ' . Give()->html->month_dropdown( 'start_month' ),
324
-										Give()->html->year_dropdown( 'end_year' )   . ' ' . Give()->html->month_dropdown( 'end_month' )
322
+										esc_html__('%1$s to %2$s', 'give'),
323
+										Give()->html->year_dropdown('start_year').' '.Give()->html->month_dropdown('start_month'),
324
+										Give()->html->year_dropdown('end_year').' '.Give()->html->month_dropdown('end_month')
325 325
 									);
326 326
 								?>
327 327
 								<input type="hidden" name="give-action" value="earnings_export"/>
328
-								<input type="submit" value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>" class="button-secondary"/>
328
+								<input type="submit" value="<?php esc_attr_e('Generate CSV', 'give'); ?>" class="button-secondary"/>
329 329
 							</form>
330 330
 						</td>
331 331
 					</tr>
332 332
 					<tr class="give-export-payment-history">
333 333
 						<td class="row-title">
334
-							<h3><span><?php esc_html_e( 'Export Donation History', 'give' ); ?></span></h3>
334
+							<h3><span><?php esc_html_e('Export Donation History', 'give'); ?></span></h3>
335 335
 
336
-							<p><?php esc_html_e( 'Download a CSV of all donations recorded.', 'give' ); ?></p>
336
+							<p><?php esc_html_e('Download a CSV of all donations recorded.', 'give'); ?></p>
337 337
 						</td>
338 338
 						<td>
339 339
 							<form id="give-export-payments" class="give-export-form" method="post">
@@ -341,29 +341,29 @@  discard block
 block discarded – undo
341 341
 								$args = array(
342 342
 									'id'          => 'give-payment-export-start',
343 343
 									'name'        => 'start',
344
-									'placeholder' => esc_attr__( 'Start date', 'give' )
344
+									'placeholder' => esc_attr__('Start date', 'give')
345 345
 								);
346
-								echo Give()->html->date_field( $args ); ?>
346
+								echo Give()->html->date_field($args); ?>
347 347
 								<?php
348 348
 								$args = array(
349 349
 									'id'          => 'give-payment-export-end',
350 350
 									'name'        => 'end',
351
-									'placeholder' => esc_attr__( 'End date', 'give' )
351
+									'placeholder' => esc_attr__('End date', 'give')
352 352
 								);
353
-								echo Give()->html->date_field( $args ); ?>
353
+								echo Give()->html->date_field($args); ?>
354 354
 								<select name="status">
355
-									<option value="any"><?php esc_html_e( 'All Statuses', 'give' ); ?></option>
355
+									<option value="any"><?php esc_html_e('All Statuses', 'give'); ?></option>
356 356
 									<?php
357 357
 									$statuses = give_get_payment_statuses();
358
-									foreach ( $statuses as $status => $label ) {
359
-										echo '<option value="' . $status . '">' . $label . '</option>';
358
+									foreach ($statuses as $status => $label) {
359
+										echo '<option value="'.$status.'">'.$label.'</option>';
360 360
 									}
361 361
 									?>
362 362
 								</select>
363
-								<?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?>
363
+								<?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?>
364 364
 								<input type="hidden" name="give-export-class" value="Give_Batch_Payments_Export"/>
365 365
 								<span>
366
-									<input type="submit" value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>" class="button-secondary"/>
366
+									<input type="submit" value="<?php esc_attr_e('Generate CSV', 'give'); ?>" class="button-secondary"/>
367 367
 									<span class="spinner"></span>
368 368
 								</span>
369 369
 							</form>
@@ -372,9 +372,9 @@  discard block
 block discarded – undo
372 372
 					</tr>
373 373
 					<tr class="alternate give-export-donors">
374 374
 						<td class="row-title">
375
-							<h3><span><?php esc_html_e( 'Export Donors in CSV', 'give' ); ?></span></h3>
375
+							<h3><span><?php esc_html_e('Export Donors in CSV', 'give'); ?></span></h3>
376 376
 
377
-							<p><?php esc_html_e( 'Download an export of donors for all donation forms or only those who have given to a particular form.', 'give' ); ?></p>
377
+							<p><?php esc_html_e('Download an export of donors for all donation forms or only those who have given to a particular form.', 'give'); ?></p>
378 378
 						</td>
379 379
 						<td>
380 380
 							<form method="post" id="give_donor_export" class="give-export-form">
@@ -385,54 +385,54 @@  discard block
 block discarded – undo
385 385
 										'id'     => 'give_customer_export_form',
386 386
 										'chosen' => true
387 387
 									);
388
-									echo Give()->html->forms_dropdown( $args ); ?>
388
+									echo Give()->html->forms_dropdown($args); ?>
389 389
 								
390
-								<input type="submit" value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>" class="button-secondary"/>
390
+								<input type="submit" value="<?php esc_attr_e('Generate CSV', 'give'); ?>" class="button-secondary"/>
391 391
 
392 392
 								<div id="export-donor-options-wrap" class="give-clearfix">
393
-									<p><?php esc_html_e( 'Export Columns', 'give' ); ?>:</p>
393
+									<p><?php esc_html_e('Export Columns', 'give'); ?>:</p>
394 394
 									<ul id="give-export-option-ul">
395 395
 										<li>
396
-											<label for="give-export-fullname"><input type="checkbox" checked name="give_export_option[full_name]" id="give-export-fullname"><?php esc_html_e( 'Name', 'give' ); ?>
396
+											<label for="give-export-fullname"><input type="checkbox" checked name="give_export_option[full_name]" id="give-export-fullname"><?php esc_html_e('Name', 'give'); ?>
397 397
 											</label>
398 398
 										</li>
399 399
 										<li>
400
-											<label for="give-export-email"><input type="checkbox" checked name="give_export_option[email]" id="give-export-email"><?php esc_html_e( 'Email', 'give' ); ?>
400
+											<label for="give-export-email"><input type="checkbox" checked name="give_export_option[email]" id="give-export-email"><?php esc_html_e('Email', 'give'); ?>
401 401
 											</label>
402 402
 										</li>
403 403
 										<li>
404
-											<label for="give-export-address"><input type="checkbox" checked name="give_export_option[address]" id="give-export-address"><?php esc_html_e( 'Address', 'give' ); ?>
404
+											<label for="give-export-address"><input type="checkbox" checked name="give_export_option[address]" id="give-export-address"><?php esc_html_e('Address', 'give'); ?>
405 405
 											</label>
406 406
 										</li>
407 407
 										<li>
408
-											<label for="give-export-userid"><input type="checkbox" checked name="give_export_option[userid]" id="give-export-userid"><?php esc_html_e( 'User ID', 'give' ); ?>
408
+											<label for="give-export-userid"><input type="checkbox" checked name="give_export_option[userid]" id="give-export-userid"><?php esc_html_e('User ID', 'give'); ?>
409 409
 											</label>
410 410
 										</li>
411 411
 										<li>
412
-											<label for="give-export-first-donation-date"><input type="checkbox" checked name="give_export_option[date_first_donated]" id="give-export-first-donation-date"><?php esc_html_e( 'First Donation Date', 'give' ); ?>
412
+											<label for="give-export-first-donation-date"><input type="checkbox" checked name="give_export_option[date_first_donated]" id="give-export-first-donation-date"><?php esc_html_e('First Donation Date', 'give'); ?>
413 413
 											</label>
414 414
 										</li>
415 415
 										<li>
416
-											<label for="give-export-donation-number"><input type="checkbox" checked name="give_export_option[donations]" id="give-export-donation-number"><?php esc_html_e( 'Number of Donations', 'give' ); ?>
416
+											<label for="give-export-donation-number"><input type="checkbox" checked name="give_export_option[donations]" id="give-export-donation-number"><?php esc_html_e('Number of Donations', 'give'); ?>
417 417
 											</label>
418 418
 										</li>
419 419
 										<li>
420
-											<label for="give-export-donation-sum"><input type="checkbox" checked name="give_export_option[donation_sum]" id="give-export-donation-sum"><?php esc_html_e( 'Total Donated', 'give' ); ?>
420
+											<label for="give-export-donation-sum"><input type="checkbox" checked name="give_export_option[donation_sum]" id="give-export-donation-sum"><?php esc_html_e('Total Donated', 'give'); ?>
421 421
 											</label>
422 422
 										</li>
423 423
 									</ul>
424 424
 								</div>
425
-								<?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?>
425
+								<?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?>
426 426
 								<input type="hidden" name="give-export-class" value="Give_Batch_Customers_Export"/>
427 427
 								<input type="hidden" name="give-action" value="email_export"/>
428 428
 							</form>
429 429
 						</td>
430 430
 					</tr>
431
-					<?php do_action( 'give_reports_tab_export_table_bottom' ); ?>
431
+					<?php do_action('give_reports_tab_export_table_bottom'); ?>
432 432
 					</tbody>
433 433
 				</table>
434 434
 
435
-				<?php do_action( 'give_reports_tab_export_content_bottom' ); ?>
435
+				<?php do_action('give_reports_tab_export_content_bottom'); ?>
436 436
 
437 437
 			</div>
438 438
 			<!-- .post-body-content -->
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
 	<?php
443 443
 }
444 444
 
445
-add_action( 'give_reports_tab_export', 'give_reports_tab_export' );
445
+add_action('give_reports_tab_export', 'give_reports_tab_export');
446 446
 
447 447
 /**
448 448
  * Renders the Reports page
@@ -452,19 +452,19 @@  discard block
 block discarded – undo
452 452
  */
453 453
 function give_reports_tab_logs() {
454 454
 
455
-	require( GIVE_PLUGIN_DIR . 'includes/admin/reporting/logs.php' );
455
+	require(GIVE_PLUGIN_DIR.'includes/admin/reporting/logs.php');
456 456
 
457 457
 	$current_view = 'sales';
458 458
 	$log_views    = give_log_default_views();
459 459
 
460
-	if ( isset( $_GET['view'] ) && array_key_exists( $_GET['view'], $log_views ) ) {
460
+	if (isset($_GET['view']) && array_key_exists($_GET['view'], $log_views)) {
461 461
 		$current_view = $_GET['view'];
462 462
 	}
463 463
 
464
-	do_action( 'give_logs_view_' . $current_view );
464
+	do_action('give_logs_view_'.$current_view);
465 465
 }
466 466
 
467
-add_action( 'give_reports_tab_logs', 'give_reports_tab_logs' );
467
+add_action('give_reports_tab_logs', 'give_reports_tab_logs');
468 468
 
469 469
 /**
470 470
  * Retrieves estimated monthly earnings and sales
@@ -474,9 +474,9 @@  discard block
 block discarded – undo
474 474
  */
475 475
 function give_estimated_monthly_stats() {
476 476
 
477
-	$estimated = get_transient( 'give_estimated_monthly_stats' );
477
+	$estimated = get_transient('give_estimated_monthly_stats');
478 478
 
479
-	if ( false === $estimated ) {
479
+	if (false === $estimated) {
480 480
 
481 481
 		$estimated = array(
482 482
 			'earnings' => 0,
@@ -485,20 +485,20 @@  discard block
 block discarded – undo
485 485
 
486 486
 		$stats = new Give_Payment_Stats;
487 487
 
488
-		$to_date_earnings = $stats->get_earnings( 0, 'this_month' );
489
-		$to_date_sales    = $stats->get_sales( 0, 'this_month' );
488
+		$to_date_earnings = $stats->get_earnings(0, 'this_month');
489
+		$to_date_sales    = $stats->get_sales(0, 'this_month');
490 490
 
491
-		$current_day   = date( 'd', current_time( 'timestamp' ) );
492
-		$current_month = date( 'n', current_time( 'timestamp' ) );
493
-		$current_year  = date( 'Y', current_time( 'timestamp' ) );
494
-		$days_in_month = cal_days_in_month( CAL_GREGORIAN, $current_month, $current_year );
491
+		$current_day   = date('d', current_time('timestamp'));
492
+		$current_month = date('n', current_time('timestamp'));
493
+		$current_year  = date('Y', current_time('timestamp'));
494
+		$days_in_month = cal_days_in_month(CAL_GREGORIAN, $current_month, $current_year);
495 495
 
496
-		$estimated['earnings'] = ( $to_date_earnings / $current_day ) * $days_in_month;
497
-		$estimated['sales']    = ( $to_date_sales / $current_day ) * $days_in_month;
496
+		$estimated['earnings'] = ($to_date_earnings / $current_day) * $days_in_month;
497
+		$estimated['sales']    = ($to_date_sales / $current_day) * $days_in_month;
498 498
 
499 499
 		// Cache for one day
500
-		set_transient( 'give_estimated_monthly_stats', $estimated, 86400 );
500
+		set_transient('give_estimated_monthly_stats', $estimated, 86400);
501 501
 	}
502 502
 
503
-	return maybe_unserialize( $estimated );
503
+	return maybe_unserialize($estimated);
504 504
 }
Please login to merge, or discard this patch.
includes/admin/reporting/export/class-batch-export-payments.php 1 patch
Spacing   +63 added lines, -63 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
 
@@ -39,30 +39,30 @@  discard block
 block discarded – undo
39 39
 	 */
40 40
 	public function csv_cols() {
41 41
 		$cols = array(
42
-			'id'        => esc_html__( 'ID', 'give' ), // unaltered payment ID (use for querying).
43
-			'seq_id'    => esc_html__( 'Payment Number', 'give' ), // sequential payment ID.
44
-			'email'     => esc_html__( 'Email', 'give' ),
45
-			'first'     => esc_html__( 'First Name', 'give' ),
46
-			'last'      => esc_html__( 'Last Name', 'give' ),
47
-			'address1'  => esc_html__( 'Address', 'give' ),
48
-			'address2'  => esc_html__( 'Address (Line 2)', 'give' ),
49
-			'city'      => esc_html__( 'City', 'give' ),
50
-			'state'     => esc_html__( 'State', 'give' ),
51
-			'country'   => esc_html__( 'Country', 'give' ),
52
-			'zip'       => esc_html__( 'Zip / Postal Code', 'give' ),
53
-			'form_id'   => esc_html__( 'Form ID', 'give' ),
54
-			'form_name' => esc_html__( 'Form Name', 'give' ),
55
-			'amount'    => esc_html__( 'Amount', 'give' ) . ' (' . html_entity_decode( give_currency_filter( '' ) ) . ')',
56
-			'gateway'   => esc_html__( 'Payment Method', 'give' ),
57
-			'trans_id'  => esc_html__( 'Transaction ID', 'give' ),
58
-			'key'       => esc_html__( 'Purchase Key', 'give' ),
59
-			'date'      => esc_html__( 'Date', 'give' ),
60
-			'user'      => esc_html__( 'User', 'give' ),
61
-			'status'    => esc_html__( 'Status', 'give' )
42
+			'id'        => esc_html__('ID', 'give'), // unaltered payment ID (use for querying).
43
+			'seq_id'    => esc_html__('Payment Number', 'give'), // sequential payment ID.
44
+			'email'     => esc_html__('Email', 'give'),
45
+			'first'     => esc_html__('First Name', 'give'),
46
+			'last'      => esc_html__('Last Name', 'give'),
47
+			'address1'  => esc_html__('Address', 'give'),
48
+			'address2'  => esc_html__('Address (Line 2)', 'give'),
49
+			'city'      => esc_html__('City', 'give'),
50
+			'state'     => esc_html__('State', 'give'),
51
+			'country'   => esc_html__('Country', 'give'),
52
+			'zip'       => esc_html__('Zip / Postal Code', 'give'),
53
+			'form_id'   => esc_html__('Form ID', 'give'),
54
+			'form_name' => esc_html__('Form Name', 'give'),
55
+			'amount'    => esc_html__('Amount', 'give').' ('.html_entity_decode(give_currency_filter('')).')',
56
+			'gateway'   => esc_html__('Payment Method', 'give'),
57
+			'trans_id'  => esc_html__('Transaction ID', 'give'),
58
+			'key'       => esc_html__('Purchase Key', 'give'),
59
+			'date'      => esc_html__('Date', 'give'),
60
+			'user'      => esc_html__('User', 'give'),
61
+			'status'    => esc_html__('Status', 'give')
62 62
 		);
63 63
 
64
-		if ( ! give_get_option( 'enable_sequential' ) ) {
65
-			unset( $cols['seq_id'] );
64
+		if ( ! give_get_option('enable_sequential')) {
65
+			unset($cols['seq_id']);
66 66
 		}
67 67
 
68 68
 		return $cols;
@@ -87,12 +87,12 @@  discard block
 block discarded – undo
87 87
 			'status' => $this->status
88 88
 		);
89 89
 
90
-		if ( ! empty( $this->start ) || ! empty( $this->end ) ) {
90
+		if ( ! empty($this->start) || ! empty($this->end)) {
91 91
 
92 92
 			$args['date_query'] = array(
93 93
 				array(
94
-					'after'     => date( 'Y-n-d 00:00:00', strtotime( $this->start ) ),
95
-					'before'    => date( 'Y-n-d 23:59:59', strtotime( $this->end ) ),
94
+					'after'     => date('Y-n-d 00:00:00', strtotime($this->start)),
95
+					'before'    => date('Y-n-d 23:59:59', strtotime($this->end)),
96 96
 					'inclusive' => true
97 97
 				)
98 98
 			);
@@ -101,52 +101,52 @@  discard block
 block discarded – undo
101 101
 
102 102
 		//echo json_encode($args ); exit;
103 103
 
104
-		$payments = give_get_payments( $args );
104
+		$payments = give_get_payments($args);
105 105
 
106
-		if ( $payments ) {
106
+		if ($payments) {
107 107
 
108
-			foreach ( $payments as $payment ) {
109
-				$payment_meta = give_get_payment_meta( $payment->ID );
110
-				$user_info    = give_get_payment_meta_user_info( $payment->ID );
111
-				$total        = give_get_payment_amount( $payment->ID );
112
-				$user_id      = isset( $user_info['id'] ) && $user_info['id'] != - 1 ? $user_info['id'] : $user_info['email'];
108
+			foreach ($payments as $payment) {
109
+				$payment_meta = give_get_payment_meta($payment->ID);
110
+				$user_info    = give_get_payment_meta_user_info($payment->ID);
111
+				$total        = give_get_payment_amount($payment->ID);
112
+				$user_id      = isset($user_info['id']) && $user_info['id'] != - 1 ? $user_info['id'] : $user_info['email'];
113 113
 				$products     = '';
114 114
 				$skus         = '';
115 115
 
116
-				if ( is_numeric( $user_id ) ) {
117
-					$user = get_userdata( $user_id );
116
+				if (is_numeric($user_id)) {
117
+					$user = get_userdata($user_id);
118 118
 				} else {
119 119
 					$user = false;
120 120
 				}
121 121
 
122 122
 				$data[] = array(
123 123
 					'id'        => $payment->ID,
124
-					'seq_id'    => give_get_payment_number( $payment->ID ),
124
+					'seq_id'    => give_get_payment_number($payment->ID),
125 125
 					'email'     => $payment_meta['email'],
126 126
 					'first'     => $user_info['first_name'],
127 127
 					'last'      => $user_info['last_name'],
128
-					'address1'  => isset( $user_info['address']['line1'] ) ? $user_info['address']['line1'] : '',
129
-					'address2'  => isset( $user_info['address']['line2'] ) ? $user_info['address']['line2'] : '',
130
-					'city'      => isset( $user_info['address']['city'] ) ? $user_info['address']['city'] : '',
131
-					'state'     => isset( $user_info['address']['state'] ) ? $user_info['address']['state'] : '',
132
-					'country'   => isset( $user_info['address']['country'] ) ? $user_info['address']['country'] : '',
133
-					'zip'       => isset( $user_info['address']['zip'] ) ? $user_info['address']['zip'] : '',
134
-					'form_id'   => isset( $payment_meta['form_id'] ) ? $payment_meta['form_id'] : '',
135
-					'form_name' => isset( $payment_meta['form_title'] ) ? $payment_meta['form_title'] : '',
128
+					'address1'  => isset($user_info['address']['line1']) ? $user_info['address']['line1'] : '',
129
+					'address2'  => isset($user_info['address']['line2']) ? $user_info['address']['line2'] : '',
130
+					'city'      => isset($user_info['address']['city']) ? $user_info['address']['city'] : '',
131
+					'state'     => isset($user_info['address']['state']) ? $user_info['address']['state'] : '',
132
+					'country'   => isset($user_info['address']['country']) ? $user_info['address']['country'] : '',
133
+					'zip'       => isset($user_info['address']['zip']) ? $user_info['address']['zip'] : '',
134
+					'form_id'   => isset($payment_meta['form_id']) ? $payment_meta['form_id'] : '',
135
+					'form_name' => isset($payment_meta['form_title']) ? $payment_meta['form_title'] : '',
136 136
 					'skus'      => $skus,
137
-					'amount'    => html_entity_decode( give_format_amount( $total ) ),
138
-					'gateway'   => give_get_gateway_admin_label( get_post_meta( $payment->ID, '_give_payment_gateway', true ) ),
139
-					'trans_id'  => give_get_payment_transaction_id( $payment->ID ),
137
+					'amount'    => html_entity_decode(give_format_amount($total)),
138
+					'gateway'   => give_get_gateway_admin_label(get_post_meta($payment->ID, '_give_payment_gateway', true)),
139
+					'trans_id'  => give_get_payment_transaction_id($payment->ID),
140 140
 					'key'       => $payment_meta['key'],
141 141
 					'date'      => $payment->post_date,
142
-					'user'      => $user ? $user->display_name : __( 'guest', 'give' ),
143
-					'status'    => give_get_payment_status( $payment, true )
142
+					'user'      => $user ? $user->display_name : __('guest', 'give'),
143
+					'status'    => give_get_payment_status($payment, true)
144 144
 				);
145 145
 
146 146
 			}
147 147
 
148
-			$data = apply_filters( 'give_export_get_data', $data );
149
-			$data = apply_filters( 'give_export_get_data_' . $this->export_type, $data );
148
+			$data = apply_filters('give_export_get_data', $data);
149
+			$data = apply_filters('give_export_get_data_'.$this->export_type, $data);
150 150
 
151 151
 			return $data;
152 152
 
@@ -166,27 +166,27 @@  discard block
 block discarded – undo
166 166
 
167 167
 		$status = $this->status;
168 168
 		$args   = array(
169
-			'start-date' => date( 'n/d/Y', strtotime( $this->start ) ),
170
-			'end-date'   => date( 'n/d/Y', strtotime( $this->end ) ),
169
+			'start-date' => date('n/d/Y', strtotime($this->start)),
170
+			'end-date'   => date('n/d/Y', strtotime($this->end)),
171 171
 		);
172 172
 
173
-		if ( 'any' == $status ) {
173
+		if ('any' == $status) {
174 174
 
175
-			$total = array_sum( (array) give_count_payments( $args ) );
175
+			$total = array_sum((array) give_count_payments($args));
176 176
 
177 177
 		} else {
178 178
 
179
-			$total = give_count_payments( $args )->$status;
179
+			$total = give_count_payments($args)->$status;
180 180
 
181 181
 		}
182 182
 
183 183
 		$percentage = 100;
184 184
 
185
-		if ( $total > 0 ) {
186
-			$percentage = ( ( 30 * $this->step ) / $total ) * 100;
185
+		if ($total > 0) {
186
+			$percentage = ((30 * $this->step) / $total) * 100;
187 187
 		}
188 188
 
189
-		if ( $percentage > 100 ) {
189
+		if ($percentage > 100) {
190 190
 			$percentage = 100;
191 191
 		}
192 192
 
@@ -200,9 +200,9 @@  discard block
 block discarded – undo
200 200
 	 *
201 201
 	 * @param array $request The Form Data passed into the batch processing.
202 202
 	 */
203
-	public function set_properties( $request ) {
204
-		$this->start  = isset( $request['start'] ) ? sanitize_text_field( $request['start'] ) : '';
205
-		$this->end    = isset( $request['end'] ) ? sanitize_text_field( $request['end'] ) : '';
206
-		$this->status = isset( $request['status'] ) ? sanitize_text_field( $request['status'] ) : 'complete';
203
+	public function set_properties($request) {
204
+		$this->start  = isset($request['start']) ? sanitize_text_field($request['start']) : '';
205
+		$this->end    = isset($request['end']) ? sanitize_text_field($request['end']) : '';
206
+		$this->status = isset($request['status']) ? sanitize_text_field($request['status']) : 'complete';
207 207
 	}
208 208
 }
Please login to merge, or discard this patch.
includes/admin/reporting/class-gateways-reports-table.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
17 17
 // Load WP_List_Table if not loaded
18
-if ( ! class_exists( 'WP_List_Table' ) ) {
19
-	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
18
+if ( ! class_exists('WP_List_Table')) {
19
+	require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php';
20 20
 }
21 21
 
22 22
 /**
@@ -45,11 +45,11 @@  discard block
 block discarded – undo
45 45
 		global $status, $page;
46 46
 
47 47
 		// Set parent defaults
48
-		parent::__construct( array(
49
-			'singular' => give_get_forms_label_singular(),    // Singular name of the listed records
50
-			'plural'   => give_get_forms_label_plural(),        // Plural name of the listed records
48
+		parent::__construct(array(
49
+			'singular' => give_get_forms_label_singular(), // Singular name of the listed records
50
+			'plural'   => give_get_forms_label_plural(), // Plural name of the listed records
51 51
 			'ajax'     => false                        // Does this table support ajax?
52
-		) );
52
+		));
53 53
 
54 54
 	}
55 55
 
@@ -64,10 +64,10 @@  discard block
 block discarded – undo
64 64
 	 *
65 65
 	 * @return string Column Name
66 66
 	 */
67
-	public function column_default( $item, $column_name ) {
68
-		switch ( $column_name ) {
67
+	public function column_default($item, $column_name) {
68
+		switch ($column_name) {
69 69
 			default:
70
-				return $item[ $column_name ];
70
+				return $item[$column_name];
71 71
 		}
72 72
 	}
73 73
 
@@ -80,11 +80,11 @@  discard block
 block discarded – undo
80 80
 	 */
81 81
 	public function get_columns() {
82 82
 		$columns = array(
83
-			'label'           => esc_attr__( 'Gateway', 'give' ),
84
-			'complete_sales'  => esc_attr__( 'Complete Transactions', 'give' ),
85
-			'pending_sales'   => esc_attr__( 'Pending / Failed Transactions', 'give' ),
86
-			'total_sales'     => esc_attr__( 'Total Transactions', 'give' ),
87
-			'total_donations' => esc_attr__( 'Total Donations', 'give' )
83
+			'label'           => esc_attr__('Gateway', 'give'),
84
+			'complete_sales'  => esc_attr__('Complete Transactions', 'give'),
85
+			'pending_sales'   => esc_attr__('Pending / Failed Transactions', 'give'),
86
+			'total_sales'     => esc_attr__('Total Transactions', 'give'),
87
+			'total_donations' => esc_attr__('Total Donations', 'give')
88 88
 		);
89 89
 
90 90
 		return $columns;
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 	 * @return int Current page number
100 100
 	 */
101 101
 	public function get_paged() {
102
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
102
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
103 103
 	}
104 104
 
105 105
 
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 	 * @since  1.0
111 111
 	 * @return void
112 112
 	 */
113
-	public function bulk_actions( $which = '' ) {
113
+	public function bulk_actions($which = '') {
114 114
 		// These aren't really bulk actions but this outputs the markup in the right place
115 115
 		give_report_views();
116 116
 	}
@@ -123,23 +123,23 @@  discard block
 block discarded – undo
123 123
 	 *
124 124
 	 * @param string $which
125 125
 	 */
126
-	protected function display_tablenav( $which ) {
126
+	protected function display_tablenav($which) {
127 127
 
128
-		if ( 'top' == $which ) {
129
-			wp_nonce_field( 'bulk-' . $this->_args['plural'] );
128
+		if ('top' == $which) {
129
+			wp_nonce_field('bulk-'.$this->_args['plural']);
130 130
 		}
131 131
 		?>
132
-		<div class="tablenav gateways-report-tablenav give-clearfix <?php echo esc_attr( $which ); ?>">
132
+		<div class="tablenav gateways-report-tablenav give-clearfix <?php echo esc_attr($which); ?>">
133 133
 
134
-			<h3 class="alignleft reports-earnings-title"><span><?php esc_html_e( 'Payment Methods Report', 'give' ); ?></span></h3>
134
+			<h3 class="alignleft reports-earnings-title"><span><?php esc_html_e('Payment Methods Report', 'give'); ?></span></h3>
135 135
 
136 136
 			<div class="alignright tablenav-right">
137 137
 				<div class="actions bulkactions">
138
-					<?php $this->bulk_actions( $which ); ?>
138
+					<?php $this->bulk_actions($which); ?>
139 139
 				</div>
140 140
 				<?php
141
-				$this->extra_tablenav( $which );
142
-				$this->pagination( $which );
141
+				$this->extra_tablenav($which);
142
+				$this->pagination($which);
143 143
 				?>
144 144
 			</div>
145 145
 
@@ -164,18 +164,18 @@  discard block
 block discarded – undo
164 164
 		$gateways     = give_get_payment_gateways();
165 165
 		$stats        = new Give_Payment_Stats();
166 166
 
167
-		foreach ( $gateways as $gateway_id => $gateway ) {
167
+		foreach ($gateways as $gateway_id => $gateway) {
168 168
 
169
-			$complete_count = give_count_sales_by_gateway( $gateway_id, 'publish' );
170
-			$pending_count  = give_count_sales_by_gateway( $gateway_id, array( 'pending', 'failed' ) );
169
+			$complete_count = give_count_sales_by_gateway($gateway_id, 'publish');
170
+			$pending_count  = give_count_sales_by_gateway($gateway_id, array('pending', 'failed'));
171 171
 
172 172
 			$reports_data[] = array(
173 173
 				'ID'              => $gateway_id,
174 174
 				'label'           => $gateway['admin_label'],
175
-				'complete_sales'  => give_format_amount( $complete_count, false ),
176
-				'pending_sales'   => give_format_amount( $pending_count, false ),
177
-				'total_sales'     => give_format_amount( $complete_count + $pending_count, false ),
178
-				'total_donations' => give_currency_filter( give_format_amount( $stats->get_earnings( 0, 0, 0, $gateway_id ) ) )
175
+				'complete_sales'  => give_format_amount($complete_count, false),
176
+				'pending_sales'   => give_format_amount($pending_count, false),
177
+				'total_sales'     => give_format_amount($complete_count + $pending_count, false),
178
+				'total_donations' => give_currency_filter(give_format_amount($stats->get_earnings(0, 0, 0, $gateway_id)))
179 179
 			);
180 180
 		}
181 181
 
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 		$columns               = $this->get_columns();
198 198
 		$hidden                = array(); // No hidden columns
199 199
 		$sortable              = $this->get_sortable_columns();
200
-		$this->_column_headers = array( $columns, $hidden, $sortable );
200
+		$this->_column_headers = array($columns, $hidden, $sortable);
201 201
 		$this->items           = $this->reports_data();
202 202
 
203 203
 	}
Please login to merge, or discard this patch.
includes/admin/reporting/logs.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  * @return void
24 24
  */
25 25
 function give_logs_view_sales() {
26
-	include( dirname( __FILE__ ) . '/class-sales-logs-list-table.php' );
26
+	include(dirname(__FILE__).'/class-sales-logs-list-table.php');
27 27
 
28 28
 	$logs_table = new Give_Sales_Log_Table();
29 29
 	$logs_table->prepare_items();
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 
32 32
 }
33 33
 
34
-add_action( 'give_logs_view_sales', 'give_logs_view_sales' );
34
+add_action('give_logs_view_sales', 'give_logs_view_sales');
35 35
 
36 36
 
37 37
 /**
@@ -43,14 +43,14 @@  discard block
 block discarded – undo
43 43
  * @return void
44 44
  */
45 45
 function give_logs_view_gateway_errors() {
46
-	include( dirname( __FILE__ ) . '/class-gateway-error-logs-list-table.php' );
46
+	include(dirname(__FILE__).'/class-gateway-error-logs-list-table.php');
47 47
 
48 48
 	$logs_table = new Give_Gateway_Error_Log_Table();
49 49
 	$logs_table->prepare_items();
50 50
 	$logs_table->display();
51 51
 }
52 52
 
53
-add_action( 'give_logs_view_gateway_errors', 'give_logs_view_gateway_errors' );
53
+add_action('give_logs_view_gateway_errors', 'give_logs_view_gateway_errors');
54 54
 
55 55
 /**
56 56
  * API Request Logs
@@ -62,31 +62,31 @@  discard block
 block discarded – undo
62 62
  * @return void
63 63
  */
64 64
 function give_logs_view_api_requests() {
65
-	include( dirname( __FILE__ ) . '/class-api-requests-logs-list-table.php' );
65
+	include(dirname(__FILE__).'/class-api-requests-logs-list-table.php');
66 66
 
67 67
 	$logs_table = new Give_API_Request_Log_Table();
68 68
 	$logs_table->prepare_items();
69 69
 	?>
70 70
 	<div class="wrap">
71 71
 
72
-		<?php do_action( 'give_logs_api_requests_top' ); ?>
72
+		<?php do_action('give_logs_api_requests_top'); ?>
73 73
 
74
-		<form id="give-logs-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-reports&tab=logs' ); ?>">
74
+		<form id="give-logs-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-reports&tab=logs'); ?>">
75 75
 			<?php
76
-			$logs_table->search_box( esc_html__( 'Search', 'give' ), 'give-api-requests' );
76
+			$logs_table->search_box(esc_html__('Search', 'give'), 'give-api-requests');
77 77
 			$logs_table->display();
78 78
 			?>
79 79
 			<input type="hidden" name="post_type" value="give_forms"/>
80 80
 			<input type="hidden" name="page" value="give-reports"/>
81 81
 			<input type="hidden" name="tab" value="logs"/>
82 82
 		</form>
83
-		<?php do_action( 'give_logs_api_requests_bottom' ); ?>
83
+		<?php do_action('give_logs_api_requests_bottom'); ?>
84 84
 
85 85
 	</div>
86 86
 	<?php
87 87
 }
88 88
 
89
-add_action( 'give_logs_view_api_requests', 'give_logs_view_api_requests' );
89
+add_action('give_logs_view_api_requests', 'give_logs_view_api_requests');
90 90
 
91 91
 
92 92
 /**
@@ -97,12 +97,12 @@  discard block
 block discarded – undo
97 97
  */
98 98
 function give_log_default_views() {
99 99
 	$views = array(
100
-		'sales'          => esc_html__( 'Donations', 'give' ),
101
-		'gateway_errors' => esc_html__( 'Payment Errors', 'give' ),
102
-		'api_requests'   => esc_html__( 'API Requests', 'give' )
100
+		'sales'          => esc_html__('Donations', 'give'),
101
+		'gateway_errors' => esc_html__('Payment Errors', 'give'),
102
+		'api_requests'   => esc_html__('API Requests', 'give')
103 103
 	);
104 104
 
105
-	$views = apply_filters( 'give_log_views', $views );
105
+	$views = apply_filters('give_log_views', $views);
106 106
 
107 107
 	return $views;
108 108
 }
@@ -115,24 +115,24 @@  discard block
 block discarded – undo
115 115
  */
116 116
 function give_log_views() {
117 117
 	$views        = give_log_default_views();
118
-	$current_view = isset( $_GET['view'] ) && array_key_exists( $_GET['view'], give_log_default_views() ) ? sanitize_text_field( $_GET['view'] ) : 'sales';
118
+	$current_view = isset($_GET['view']) && array_key_exists($_GET['view'], give_log_default_views()) ? sanitize_text_field($_GET['view']) : 'sales';
119 119
 	?>
120 120
 	<form id="give-logs-filter" method="get" action="edit.php">
121 121
 		<select id="give-logs-view" name="view">
122 122
 			<optgroup label="Log Type:">
123
-				<?php foreach ( $views as $view_id => $label ): ?>
124
-					<option value="<?php echo esc_attr( $view_id ); ?>" <?php selected( $view_id, $current_view ); ?>><?php echo $label; ?></option>
123
+				<?php foreach ($views as $view_id => $label): ?>
124
+					<option value="<?php echo esc_attr($view_id); ?>" <?php selected($view_id, $current_view); ?>><?php echo $label; ?></option>
125 125
 				<?php endforeach; ?>
126 126
 			</optgroup>
127 127
 		</select>
128 128
 
129
-		<?php do_action( 'give_log_view_actions' ); ?>
129
+		<?php do_action('give_log_view_actions'); ?>
130 130
 
131 131
 		<input type="hidden" name="post_type" value="give_forms"/>
132 132
 		<input type="hidden" name="page" value="give-reports"/>
133 133
 		<input type="hidden" name="tab" value="logs"/>
134 134
 
135
-		<?php submit_button( esc_html__( 'Apply', 'give' ), 'secondary', 'submit', false ); ?>
135
+		<?php submit_button(esc_html__('Apply', 'give'), 'secondary', 'submit', false); ?>
136 136
 	</form>
137 137
 	<?php
138 138
 }
139 139
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/upgrades/upgrade-functions.php 1 patch
Spacing   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
  */
14 14
 
15 15
 // Exit if accessed directly
16
-if ( ! defined( 'ABSPATH' ) ) {
16
+if ( ! defined('ABSPATH')) {
17 17
 	exit;
18 18
 }
19 19
 
@@ -26,17 +26,17 @@  discard block
 block discarded – undo
26 26
  */
27 27
 function give_do_automatic_upgrades() {
28 28
 	$did_upgrade  = false;
29
-	$give_version = preg_replace( '/[^0-9.].*/', '', get_option( 'give_version' ) );
30
-	if ( version_compare( $give_version, GIVE_VERSION, '<' ) ) {
29
+	$give_version = preg_replace('/[^0-9.].*/', '', get_option('give_version'));
30
+	if (version_compare($give_version, GIVE_VERSION, '<')) {
31 31
 		give_v16_upgrades();
32 32
 		$did_upgrade = true;
33 33
 	}
34
-	if ( $did_upgrade ) {
35
-		update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
34
+	if ($did_upgrade) {
35
+		update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
36 36
 	}
37 37
 }
38 38
 
39
-add_action( 'admin_init', 'give_do_automatic_upgrades' );
39
+add_action('admin_init', 'give_do_automatic_upgrades');
40 40
 
41 41
 /**
42 42
  * Display Upgrade Notices
@@ -46,18 +46,18 @@  discard block
 block discarded – undo
46 46
  */
47 47
 function give_show_upgrade_notices() {
48 48
 
49
-	if ( isset( $_GET['page'] ) && $_GET['page'] == 'give-upgrades' ) {
49
+	if (isset($_GET['page']) && $_GET['page'] == 'give-upgrades') {
50 50
 		return;
51 51
 	} // Don't show notices on the upgrades page
52 52
 
53
-	$give_version = get_option( 'give_version' );
53
+	$give_version = get_option('give_version');
54 54
 
55
-	if ( ! $give_version ) {
55
+	if ( ! $give_version) {
56 56
 		// 1.0 is the first version to use this option so we must add it
57 57
 		$give_version = '1.0';
58 58
 	}
59 59
 
60
-	$give_version = preg_replace( '/[^0-9.].*/', '', $give_version );
60
+	$give_version = preg_replace('/[^0-9.].*/', '', $give_version);
61 61
 
62 62
 	/*
63 63
 	 *  NOTICE:
@@ -68,20 +68,20 @@  discard block
 block discarded – undo
68 68
 	 */
69 69
 
70 70
 	//v1.3.2 Upgrades
71
-	if ( version_compare( $give_version, '1.3.2', '<' ) || ! give_has_upgrade_completed( 'upgrade_give_payment_customer_id' ) ) {
71
+	if (version_compare($give_version, '1.3.2', '<') || ! give_has_upgrade_completed('upgrade_give_payment_customer_id')) {
72 72
 		printf(
73 73
 		/* translators: %s: upgrade URL */
74
-			'<div class="updated"><p>' . __( 'Give needs to upgrade the donor database, click <a href="%s">here</a> to start the upgrade.', 'give' ) . '</p></div>',
75
-			esc_url( admin_url( 'index.php?page=give-upgrades&give-upgrade=upgrade_give_payment_customer_id' ) )
74
+			'<div class="updated"><p>'.__('Give needs to upgrade the donor database, click <a href="%s">here</a> to start the upgrade.', 'give').'</p></div>',
75
+			esc_url(admin_url('index.php?page=give-upgrades&give-upgrade=upgrade_give_payment_customer_id'))
76 76
 		);
77 77
 	}
78 78
 
79 79
 	//v1.3.4 Upgrades //ensure the user has gone through 1.3.4
80
-	if ( version_compare( $give_version, '1.3.4', '<' ) || ( ! give_has_upgrade_completed( 'upgrade_give_offline_status' ) && give_has_upgrade_completed( 'upgrade_give_payment_customer_id' ) ) ) {
80
+	if (version_compare($give_version, '1.3.4', '<') || ( ! give_has_upgrade_completed('upgrade_give_offline_status') && give_has_upgrade_completed('upgrade_give_payment_customer_id'))) {
81 81
 		printf(
82 82
 		/* translators: %s: upgrade URL */
83
-			'<div class="updated"><p>' . __( 'Give needs to upgrade the transaction database, click <a href="%s">here</a> to start the upgrade.', 'give' ) . '</p></div>',
84
-			esc_url( admin_url( 'index.php?page=give-upgrades&give-upgrade=upgrade_give_offline_status' ) )
83
+			'<div class="updated"><p>'.__('Give needs to upgrade the transaction database, click <a href="%s">here</a> to start the upgrade.', 'give').'</p></div>',
84
+			esc_url(admin_url('index.php?page=give-upgrades&give-upgrade=upgrade_give_offline_status'))
85 85
 		);
86 86
 	}
87 87
 
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 
92 92
 }
93 93
 
94
-add_action( 'admin_notices', 'give_show_upgrade_notices' );
94
+add_action('admin_notices', 'give_show_upgrade_notices');
95 95
 
96 96
 /**
97 97
  * Triggers all upgrade functions
@@ -103,26 +103,26 @@  discard block
 block discarded – undo
103 103
  */
104 104
 function give_trigger_upgrades() {
105 105
 
106
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
107
-		wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
106
+	if ( ! current_user_can('manage_give_settings')) {
107
+		wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
108 108
 	}
109 109
 
110
-	$give_version = get_option( 'give_version' );
110
+	$give_version = get_option('give_version');
111 111
 
112
-	if ( ! $give_version ) {
112
+	if ( ! $give_version) {
113 113
 		// 1.0 is the first version to use this option so we must add it
114 114
 		$give_version = '1.0';
115
-		add_option( 'give_version', $give_version );
115
+		add_option('give_version', $give_version);
116 116
 	}
117 117
 
118
-	update_option( 'give_version', GIVE_VERSION );
118
+	update_option('give_version', GIVE_VERSION);
119 119
 
120
-	if ( DOING_AJAX ) {
121
-		die( 'complete' );
120
+	if (DOING_AJAX) {
121
+		die('complete');
122 122
 	} // Let AJAX know that the upgrade is complete
123 123
 }
124 124
 
125
-add_action( 'wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades' );
125
+add_action('wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades');
126 126
 
127 127
 /**
128 128
  * Check if the upgrade routine has been run for a specific action
@@ -133,15 +133,15 @@  discard block
 block discarded – undo
133 133
  *
134 134
  * @return bool                   If the action has been added to the completed actions array
135 135
  */
136
-function give_has_upgrade_completed( $upgrade_action = '' ) {
136
+function give_has_upgrade_completed($upgrade_action = '') {
137 137
 
138
-	if ( empty( $upgrade_action ) ) {
138
+	if (empty($upgrade_action)) {
139 139
 		return false;
140 140
 	}
141 141
 
142 142
 	$completed_upgrades = give_get_completed_upgrades();
143 143
 
144
-	return in_array( $upgrade_action, $completed_upgrades );
144
+	return in_array($upgrade_action, $completed_upgrades);
145 145
 
146 146
 }
147 147
 
@@ -154,9 +154,9 @@  discard block
 block discarded – undo
154 154
  *
155 155
  * @return bool                   If the function was successfully added
156 156
  */
157
-function give_set_upgrade_complete( $upgrade_action = '' ) {
157
+function give_set_upgrade_complete($upgrade_action = '') {
158 158
 
159
-	if ( empty( $upgrade_action ) ) {
159
+	if (empty($upgrade_action)) {
160 160
 		return false;
161 161
 	}
162 162
 
@@ -164,9 +164,9 @@  discard block
 block discarded – undo
164 164
 	$completed_upgrades[] = $upgrade_action;
165 165
 
166 166
 	// Remove any blanks, and only show uniques
167
-	$completed_upgrades = array_unique( array_values( $completed_upgrades ) );
167
+	$completed_upgrades = array_unique(array_values($completed_upgrades));
168 168
 
169
-	return update_option( 'give_completed_upgrades', $completed_upgrades );
169
+	return update_option('give_completed_upgrades', $completed_upgrades);
170 170
 }
171 171
 
172 172
 /**
@@ -177,9 +177,9 @@  discard block
 block discarded – undo
177 177
  */
178 178
 function give_get_completed_upgrades() {
179 179
 
180
-	$completed_upgrades = get_option( 'give_completed_upgrades' );
180
+	$completed_upgrades = get_option('give_completed_upgrades');
181 181
 
182
-	if ( false === $completed_upgrades ) {
182
+	if (false === $completed_upgrades) {
183 183
 		$completed_upgrades = array();
184 184
 	}
185 185
 
@@ -197,30 +197,30 @@  discard block
 block discarded – undo
197 197
  */
198 198
 function give_v132_upgrade_give_payment_customer_id() {
199 199
 	global $wpdb;
200
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
201
-		wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
200
+	if ( ! current_user_can('manage_give_settings')) {
201
+		wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
202 202
 	}
203 203
 
204
-	ignore_user_abort( true );
204
+	ignore_user_abort(true);
205 205
 
206
-	if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
207
-		@set_time_limit( 0 );
206
+	if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
207
+		@set_time_limit(0);
208 208
 	}
209 209
 
210 210
 	//UPDATE DB METAKEYS
211 211
 	$sql   = "UPDATE $wpdb->postmeta SET meta_key = '_give_payment_customer_id' WHERE meta_key = '_give_payment_donor_id'";
212
-	$query = $wpdb->query( $sql );
212
+	$query = $wpdb->query($sql);
213 213
 
214
-	update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
215
-	give_set_upgrade_complete( 'upgrade_give_payment_customer_id' );
216
-	delete_option( 'give_doing_upgrade' );
217
-	wp_redirect( admin_url() );
214
+	update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
215
+	give_set_upgrade_complete('upgrade_give_payment_customer_id');
216
+	delete_option('give_doing_upgrade');
217
+	wp_redirect(admin_url());
218 218
 	exit;
219 219
 
220 220
 
221 221
 }
222 222
 
223
-add_action( 'give_upgrade_give_payment_customer_id', 'give_v132_upgrade_give_payment_customer_id' );
223
+add_action('give_upgrade_give_payment_customer_id', 'give_v132_upgrade_give_payment_customer_id');
224 224
 
225 225
 /**
226 226
  * Upgrades the Offline Status
@@ -234,14 +234,14 @@  discard block
 block discarded – undo
234 234
 
235 235
 	global $wpdb;
236 236
 
237
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
238
-		wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
237
+	if ( ! current_user_can('manage_give_settings')) {
238
+		wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
239 239
 	}
240 240
 
241
-	ignore_user_abort( true );
241
+	ignore_user_abort(true);
242 242
 
243
-	if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
244
-		@set_time_limit( 0 );
243
+	if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
244
+		@set_time_limit(0);
245 245
 	}
246 246
 
247 247
 	// Get abandoned offline payments
@@ -251,35 +251,35 @@  discard block
 block discarded – undo
251 251
 	$where .= "AND ( p.post_status = 'abandoned' )";
252 252
 	$where .= "AND ( m.meta_key = '_give_payment_gateway' AND m.meta_value = 'offline' )";
253 253
 
254
-	$sql            = $select . $join . $where;
255
-	$found_payments = $wpdb->get_col( $sql );
254
+	$sql            = $select.$join.$where;
255
+	$found_payments = $wpdb->get_col($sql);
256 256
 
257 257
 
258
-	foreach ( $found_payments as $payment ) {
258
+	foreach ($found_payments as $payment) {
259 259
 
260 260
 		//Only change ones marked abandoned since our release last week
261 261
 		//because the admin may have marked some abandoned themselves
262
-		$modified_time = get_post_modified_time( 'U', false, $payment );
262
+		$modified_time = get_post_modified_time('U', false, $payment);
263 263
 
264 264
 		//1450124863 =  12/10/2015 20:42:25
265
-		if ( $modified_time >= 1450124863 ) {
265
+		if ($modified_time >= 1450124863) {
266 266
 
267
-			give_update_payment_status( $payment, 'pending' );
267
+			give_update_payment_status($payment, 'pending');
268 268
 
269 269
 		}
270 270
 
271 271
 	}
272 272
 
273
-	update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
274
-	give_set_upgrade_complete( 'upgrade_give_offline_status' );
275
-	delete_option( 'give_doing_upgrade' );
276
-	wp_redirect( admin_url() );
273
+	update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
274
+	give_set_upgrade_complete('upgrade_give_offline_status');
275
+	delete_option('give_doing_upgrade');
276
+	wp_redirect(admin_url());
277 277
 	exit;
278 278
 
279 279
 
280 280
 }
281 281
 
282
-add_action( 'give_upgrade_give_offline_status', 'give_v134_upgrade_give_offline_status' );
282
+add_action('give_upgrade_give_offline_status', 'give_v134_upgrade_give_offline_status');
283 283
 
284 284
 /**
285 285
  * Cleanup User Roles
@@ -290,17 +290,17 @@  discard block
 block discarded – undo
290 290
  */
291 291
 function give_v152_cleanup_users() {
292 292
 
293
-	$give_version = get_option( 'give_version' );
293
+	$give_version = get_option('give_version');
294 294
 
295
-	if ( ! $give_version ) {
295
+	if ( ! $give_version) {
296 296
 		// 1.0 is the first version to use this option so we must add it
297 297
 		$give_version = '1.0';
298 298
 	}
299 299
 
300
-	$give_version = preg_replace( '/[^0-9.].*/', '', $give_version );
300
+	$give_version = preg_replace('/[^0-9.].*/', '', $give_version);
301 301
 
302 302
 	//v1.5.2 Upgrades
303
-	if ( version_compare( $give_version, '1.5.2', '<' ) || ! give_has_upgrade_completed( 'upgrade_give_user_caps_cleanup' ) ) {
303
+	if (version_compare($give_version, '1.5.2', '<') || ! give_has_upgrade_completed('upgrade_give_user_caps_cleanup')) {
304 304
 
305 305
 		//Delete all caps with "ss"
306 306
 		//Also delete all unused "campaign" roles
@@ -347,9 +347,9 @@  discard block
 block discarded – undo
347 347
 		);
348 348
 
349 349
 		global $wp_roles;
350
-		foreach ( $delete_caps as $cap ) {
351
-			foreach ( array_keys( $wp_roles->roles ) as $role ) {
352
-				$wp_roles->remove_cap( $role, $cap );
350
+		foreach ($delete_caps as $cap) {
351
+			foreach (array_keys($wp_roles->roles) as $role) {
352
+				$wp_roles->remove_cap($role, $cap);
353 353
 			}
354 354
 		}
355 355
 
@@ -359,15 +359,15 @@  discard block
 block discarded – undo
359 359
 		$roles->add_caps();
360 360
 
361 361
 		//The Update Ran
362
-		update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
363
-		give_set_upgrade_complete( 'upgrade_give_user_caps_cleanup' );
364
-		delete_option( 'give_doing_upgrade' );
362
+		update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
363
+		give_set_upgrade_complete('upgrade_give_user_caps_cleanup');
364
+		delete_option('give_doing_upgrade');
365 365
 
366 366
 	}
367 367
 
368 368
 }
369 369
 
370
-add_action( 'admin_init', 'give_v152_cleanup_users' );
370
+add_action('admin_init', 'give_v152_cleanup_users');
371 371
 
372 372
 /**
373 373
  * 1.6 Upgrade routine to create the customer meta table.
Please login to merge, or discard this patch.
includes/admin/add-ons.php 1 patch
Spacing   +12 added lines, -12 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,12 +25,12 @@  discard block
 block discarded – undo
25 25
 function give_add_ons_page() {
26 26
 	ob_start(); ?>
27 27
 	<div class="wrap" id="give-add-ons">
28
-		<h1><?php esc_html_e( 'Give Add-ons', 'give' ); ?>
29
-			&nbsp;&mdash;&nbsp;<a href="https://givewp.com/addons/" class="button-primary give-view-addons-all" title="<?php esc_attr_e( 'Browse All Add-ons', 'give' ); ?>" target="_blank"><?php esc_html_e( 'View All Add-ons', 'give' ); ?>
28
+		<h1><?php esc_html_e('Give Add-ons', 'give'); ?>
29
+			&nbsp;&mdash;&nbsp;<a href="https://givewp.com/addons/" class="button-primary give-view-addons-all" title="<?php esc_attr_e('Browse All Add-ons', 'give'); ?>" target="_blank"><?php esc_html_e('View All Add-ons', 'give'); ?>
30 30
 				<span class="dashicons dashicons-external"></span></a>
31 31
 		</h1>
32 32
 
33
-		<p><?php esc_html_e( 'The following Add-ons extend the functionality of Give.', 'give' ); ?></p>
33
+		<p><?php esc_html_e('The following Add-ons extend the functionality of Give.', 'give'); ?></p>
34 34
 		<?php echo give_add_ons_get_feed(); ?>
35 35
 	</div>
36 36
 	<?php
@@ -48,18 +48,18 @@  discard block
 block discarded – undo
48 48
 function give_add_ons_get_feed() {
49 49
 
50 50
 	$addons_debug = false; //set to true to debug
51
-	$cache        = get_transient( 'give_add_ons_feed' );
51
+	$cache        = get_transient('give_add_ons_feed');
52 52
 
53
-	if ( $cache === false || $addons_debug === true && WP_DEBUG === true ) {
54
-		$feed = wp_remote_get( 'https://givewp.com/downloads/feed/', array( 'sslverify' => false ) );
53
+	if ($cache === false || $addons_debug === true && WP_DEBUG === true) {
54
+		$feed = wp_remote_get('https://givewp.com/downloads/feed/', array('sslverify' => false));
55 55
 
56
-		if ( ! is_wp_error( $feed ) ) {
57
-			if ( isset( $feed['body'] ) && strlen( $feed['body'] ) > 0 ) {
58
-				$cache = wp_remote_retrieve_body( $feed );
59
-				set_transient( 'give_add_ons_feed', $cache, 3600 );
56
+		if ( ! is_wp_error($feed)) {
57
+			if (isset($feed['body']) && strlen($feed['body']) > 0) {
58
+				$cache = wp_remote_retrieve_body($feed);
59
+				set_transient('give_add_ons_feed', $cache, 3600);
60 60
 			}
61 61
 		} else {
62
-			$cache = '<div class="error"><p>' . esc_html__( 'There was an error retrieving the Give Add-ons list from the server. Please try again later.', 'give' ) . '</div>';
62
+			$cache = '<div class="error"><p>'.esc_html__('There was an error retrieving the Give Add-ons list from the server. Please try again later.', 'give').'</div>';
63 63
 		}
64 64
 	}
65 65
 
Please login to merge, or discard this patch.
includes/admin/shortcodes/shortcode-give-goal.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  * @since       1.3.0
10 10
  */
11 11
 
12
-defined( 'ABSPATH' ) or exit;
12
+defined('ABSPATH') or exit;
13 13
 
14 14
 class Give_Shortcode_Donation_Form_Goal extends Give_Shortcode_Generator {
15 15
 
@@ -18,10 +18,10 @@  discard block
 block discarded – undo
18 18
 	 */
19 19
 	public function __construct() {
20 20
 
21
-		$this->shortcode['title'] = esc_html__( 'Donation Form Goal', 'give' );
22
-		$this->shortcode['label'] = esc_html__( 'Donation Form Goal', 'give' );
21
+		$this->shortcode['title'] = esc_html__('Donation Form Goal', 'give');
22
+		$this->shortcode['label'] = esc_html__('Donation Form Goal', 'give');
23 23
 
24
-		parent::__construct( 'give_goal' );
24
+		parent::__construct('give_goal');
25 25
 	}
26 26
 
27 27
 	/**
@@ -33,8 +33,8 @@  discard block
 block discarded – undo
33 33
 
34 34
 		$create_form_link = sprintf(
35 35
 			/* translators: %s: create new form URL */
36
-			__( '<a href="%s">Create</a> a new Donation Form.', 'give' ),
37
-			admin_url( 'post-new.php?post_type=give_forms' )
36
+			__('<a href="%s">Create</a> a new Donation Form.', 'give'),
37
+			admin_url('post-new.php?post_type=give_forms')
38 38
 		);
39 39
 
40 40
 		return array(
@@ -44,35 +44,35 @@  discard block
 block discarded – undo
44 44
 					'post_type' => 'give_forms',
45 45
 				),
46 46
 				'name'        => 'id',
47
-				'tooltip'     => esc_attr__( 'Select a Donation Form', 'give' ),
48
-				'placeholder' => esc_attr__( '- Select a Form -', 'give' ),
47
+				'tooltip'     => esc_attr__('Select a Donation Form', 'give'),
48
+				'placeholder' => esc_attr__('- Select a Form -', 'give'),
49 49
 				'required'    => array(
50
-					'alert' => esc_html__( 'You must first select a Form!', 'give' ),
51
-					'error' => sprintf( '<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__( 'No donation forms were found!', 'give' ), $create_form_link ),
50
+					'alert' => esc_html__('You must first select a Form!', 'give'),
51
+					'error' => sprintf('<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__('No donation forms were found!', 'give'), $create_form_link),
52 52
 				),
53 53
 			),
54 54
 			array(
55 55
 				'type' => 'container',
56
-				'html' => sprintf( '<p class="strong margin-top">%s</p>', esc_html__( 'Optional settings', 'give' ) ),
56
+				'html' => sprintf('<p class="strong margin-top">%s</p>', esc_html__('Optional settings', 'give')),
57 57
 			),
58 58
 			array(
59 59
 				'type'    => 'listbox',
60 60
 				'name'    => 'show_text',
61
-				'label'   => esc_attr__( 'Show Text:', 'give' ),
62
-				'tooltip' => esc_attr__( 'This text displays the amount of income raised compared to the goal.', 'give' ),
61
+				'label'   => esc_attr__('Show Text:', 'give'),
62
+				'tooltip' => esc_attr__('This text displays the amount of income raised compared to the goal.', 'give'),
63 63
 				'options' => array(
64
-					'true'  => esc_html__( 'Show', 'give' ),
65
-					'false' => esc_html__( 'Hide', 'give' ),
64
+					'true'  => esc_html__('Show', 'give'),
65
+					'false' => esc_html__('Hide', 'give'),
66 66
 				),
67 67
 			),
68 68
 			array(
69 69
 				'type'    => 'listbox',
70 70
 				'name'    => 'show_bar',
71
-				'label'   => esc_attr__( 'Show Progress Bar:', 'give' ),
72
-				'tooltip' => esc_attr__( 'Do you want to display the goal\'s progress bar?', 'give' ),
71
+				'label'   => esc_attr__('Show Progress Bar:', 'give'),
72
+				'tooltip' => esc_attr__('Do you want to display the goal\'s progress bar?', 'give'),
73 73
 				'options' => array(
74
-					'true'  => esc_html__( 'Show', 'give' ),
75
-					'false' => esc_html__( 'Hide', 'give' ),
74
+					'true'  => esc_html__('Show', 'give'),
75
+					'false' => esc_html__('Hide', 'give'),
76 76
 				),
77 77
 			),
78 78
 		);
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
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  * @since       1.3.0
10 10
  */
11 11
 
12
-defined( 'ABSPATH' ) or exit;
12
+defined('ABSPATH') or exit;
13 13
 
14 14
 /**
15 15
  * Class Give_Shortcode_Donation_Form
@@ -21,10 +21,10 @@  discard block
 block discarded – undo
21 21
 	 */
22 22
 	public function __construct() {
23 23
 
24
-		$this->shortcode['title']   = esc_html__( 'Donation Form', 'give' );
25
-		$this->shortcode['label']   = esc_html__( 'Donation Form', 'give' );
24
+		$this->shortcode['title']   = esc_html__('Donation Form', 'give');
25
+		$this->shortcode['label']   = esc_html__('Donation Form', 'give');
26 26
 
27
-		parent::__construct( 'give_form' );
27
+		parent::__construct('give_form');
28 28
 	}
29 29
 
30 30
 	/**
@@ -36,8 +36,8 @@  discard block
 block discarded – undo
36 36
 
37 37
 		$create_form_link = sprintf(
38 38
 			/* translators: %s: create new form URL */
39
-			__( '<a href="%s">Create</a> a new Donation Form.', 'give' ),
40
-			admin_url( 'post-new.php?post_type=give_forms' )
39
+			__('<a href="%s">Create</a> a new Donation Form.', 'give'),
40
+			admin_url('post-new.php?post_type=give_forms')
41 41
 		);
42 42
 
43 43
 		return array(
@@ -47,68 +47,68 @@  discard block
 block discarded – undo
47 47
 					'post_type' => 'give_forms',
48 48
 				),
49 49
 				'name'        => 'id',
50
-				'tooltip'     => esc_attr__( 'Select a Donation Form', 'give' ),
51
-				'placeholder' => esc_attr__( '- Select a Form -', 'give' ),
50
+				'tooltip'     => esc_attr__('Select a Donation Form', 'give'),
51
+				'placeholder' => esc_attr__('- Select a Form -', 'give'),
52 52
 				'required'    => array(
53
-					'alert' => esc_html__( 'You must first select a Form!', 'give' ),
54
-					'error' => sprintf( '<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__( 'No donation forms were found!', 'give' ), $create_form_link ),
53
+					'alert' => esc_html__('You must first select a Form!', 'give'),
54
+					'error' => sprintf('<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__('No donation forms were found!', 'give'), $create_form_link),
55 55
 				),
56 56
 			),
57 57
 			array(
58 58
 				'type' => 'container',
59
-				'html' => sprintf( '<p class="strong margin-top">%s</p>', esc_html__( 'Optional form settings', 'give' ) ),
59
+				'html' => sprintf('<p class="strong margin-top">%s</p>', esc_html__('Optional form settings', 'give')),
60 60
 			),
61 61
 			array(
62 62
 				'type'    => 'listbox',
63 63
 				'name'    => 'show_title',
64
-				'label'   => esc_attr__( 'Show Title:', 'give' ),
65
-				'tooltip' => esc_attr__( 'Do you want to display the form title?', 'give' ),
64
+				'label'   => esc_attr__('Show Title:', 'give'),
65
+				'tooltip' => esc_attr__('Do you want to display the form title?', 'give'),
66 66
 				'options' => array(
67
-					'true'  => esc_html__( 'Show', 'give' ),
68
-					'false' => esc_html__( 'Hide', 'give' ),
67
+					'true'  => esc_html__('Show', 'give'),
68
+					'false' => esc_html__('Hide', 'give'),
69 69
 				),
70 70
 			),
71 71
 			array(
72 72
 				'type'    => 'listbox',
73 73
 				'name'    => 'show_goal',
74
-				'label'   => esc_attr__( 'Show Goal:', 'give' ),
75
-				'tooltip' => esc_attr__( 'Do you want to display the donation goal?', 'give' ),
74
+				'label'   => esc_attr__('Show Goal:', 'give'),
75
+				'tooltip' => esc_attr__('Do you want to display the donation goal?', 'give'),
76 76
 				'options' => array(
77
-					'true'  => esc_html__( 'Show', 'give' ),
78
-					'false' => esc_html__( 'Hide', 'give' ),
77
+					'true'  => esc_html__('Show', 'give'),
78
+					'false' => esc_html__('Hide', 'give'),
79 79
 				),
80 80
 			),
81 81
 			array(
82 82
 				'type'    => 'listbox',
83 83
 				'name'    => 'show_content',
84 84
 				'minWidth' => 240,
85
-				'label'   => esc_attr__( 'Display Content:', 'give' ),
86
-				'tooltip' => esc_attr__( 'Do you want to display the form content?', 'give' ),
85
+				'label'   => esc_attr__('Display Content:', 'give'),
86
+				'tooltip' => esc_attr__('Do you want to display the form content?', 'give'),
87 87
 				'options' => array(
88
-					'none'  => esc_html__( 'No Content', 'give' ),
89
-					'above' => esc_html__( 'Display above the form fields', 'give' ),
90
-					'below' => esc_html__( 'Display below the form fields', 'give' ),
88
+					'none'  => esc_html__('No Content', 'give'),
89
+					'above' => esc_html__('Display above the form fields', 'give'),
90
+					'below' => esc_html__('Display below the form fields', 'give'),
91 91
 				),
92 92
 			),
93 93
 			array(
94 94
 				'type'    => 'listbox',
95 95
 				'name'    => 'display_style',
96
-				'label'   => esc_attr__( 'Payment Fields:', 'give' ),
97
-				'tooltip' => esc_attr__( 'How would you like to display payment information?', 'give' ),
96
+				'label'   => esc_attr__('Payment Fields:', 'give'),
97
+				'tooltip' => esc_attr__('How would you like to display payment information?', 'give'),
98 98
 				'options' => array(
99
-					'onpage' => esc_html__( 'Show on Page', 'give' ),
100
-					'reveal' => esc_html__( 'Reveal Upon Click', 'give' ),
101
-					'modal'  => esc_html__( 'Modal Window Upon Click', 'give' ),
99
+					'onpage' => esc_html__('Show on Page', 'give'),
100
+					'reveal' => esc_html__('Reveal Upon Click', 'give'),
101
+					'modal'  => esc_html__('Modal Window Upon Click', 'give'),
102 102
 				),
103 103
 			),
104 104
 			array(
105 105
 				'type'    => 'listbox',
106 106
 				'name'    => 'float_labels',
107
-				'label'   => esc_attr__( 'Floating Labels:', 'give' ),
108
-				'tooltip' => esc_attr__( 'Override the default floating labels setting for this form?', 'give' ),
107
+				'label'   => esc_attr__('Floating Labels:', 'give'),
108
+				'tooltip' => esc_attr__('Override the default floating labels setting for this form?', 'give'),
109 109
 				'options' => array(
110
-					'enabled'  => esc_html__( 'Enabled', 'give' ),
111
-					'disabled' => esc_html__( 'Disabled', 'give' ),
110
+					'enabled'  => esc_html__('Enabled', 'give'),
111
+					'disabled' => esc_html__('Disabled', 'give'),
112 112
 				),
113 113
 			),
114 114
 		);
Please login to merge, or discard this patch.
includes/class-give-donate-form.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
 	 * @param  bool  $_id   Post id. Default is false.
330 330
 	 * @param  array $_args Arguments passed.
331 331
 	 *
332
-	 * @return void
332
+	 * @return boolean
333 333
 	 */
334 334
 	public function __construct( $_id = false, $_args = array() ) {
335 335
 
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
 	 *
413 413
 	 * @param  array $data Array of attributes for a donation form.
414 414
 	 *
415
-	 * @return mixed       False if data isn't passed and class not instantiated for creation, or New Form ID.
415
+	 * @return boolean       False if data isn't passed and class not instantiated for creation, or New Form ID.
416 416
 	 */
417 417
 	public function create( $data = array() ) {
418 418
 
Please login to merge, or discard this patch.
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -770,12 +770,12 @@  discard block
 block discarded – undo
770 770
 
771 771
 	}
772 772
 
773
-    /**
774
-     * Get if form type set or not.
775
-     *
776
-     * @since  1.6
773
+	/**
774
+	 * Get if form type set or not.
775
+	 *
776
+	 * @since  1.6
777 777
 	 * @access public
778
-     *
778
+	 *
779 779
 	 * @return bool
780 780
 	 *
781 781
 	public function is_set_type_donation_form() {
@@ -1023,10 +1023,10 @@  discard block
 block discarded – undo
1023 1023
 	 */
1024 1024
 	public function is_close_donation_form() {
1025 1025
 		return (
1026
-			       'yes' === get_post_meta( $this->ID, '_give_goal_option', true ) )
1027
-		       && ( 'yes' === get_post_meta( $this->ID, '_give_close_form_when_goal_achieved', true ) )
1028
-		       && ( $this->get_goal() <= $this->get_earnings()
1029
-		       );
1026
+				   'yes' === get_post_meta( $this->ID, '_give_goal_option', true ) )
1027
+			   && ( 'yes' === get_post_meta( $this->ID, '_give_close_form_when_goal_achieved', true ) )
1028
+			   && ( $this->get_goal() <= $this->get_earnings()
1029
+			   );
1030 1030
 	}
1031 1031
 
1032 1032
 	/**
Please login to merge, or discard this patch.
Spacing   +117 added lines, -117 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
 
@@ -331,11 +331,11 @@  discard block
 block discarded – undo
331 331
 	 *
332 332
 	 * @return void
333 333
 	 */
334
-	public function __construct( $_id = false, $_args = array() ) {
334
+	public function __construct($_id = false, $_args = array()) {
335 335
 
336
-		$donation_form = WP_Post::get_instance( $_id );
336
+		$donation_form = WP_Post::get_instance($_id);
337 337
 
338
-		return $this->setup_donation_form( $donation_form );
338
+		return $this->setup_donation_form($donation_form);
339 339
 	}
340 340
 
341 341
 	/**
@@ -348,23 +348,23 @@  discard block
 block discarded – undo
348 348
 	 *
349 349
 	 * @return bool                   If the setup was successful or not.
350 350
 	 */
351
-	private function setup_donation_form( $donation_form ) {
351
+	private function setup_donation_form($donation_form) {
352 352
 
353
-		if ( ! is_object( $donation_form ) ) {
353
+		if ( ! is_object($donation_form)) {
354 354
 			return false;
355 355
 		}
356 356
 
357
-		if ( ! is_a( $donation_form, 'WP_Post' ) ) {
357
+		if ( ! is_a($donation_form, 'WP_Post')) {
358 358
 			return false;
359 359
 		}
360 360
 
361
-		if ( 'give_forms' !== $donation_form->post_type ) {
361
+		if ('give_forms' !== $donation_form->post_type) {
362 362
 			return false;
363 363
 		}
364 364
 
365
-		foreach ( $donation_form as $key => $value ) {
365
+		foreach ($donation_form as $key => $value) {
366 366
 
367
-			switch ( $key ) {
367
+			switch ($key) {
368 368
 
369 369
 				default:
370 370
 					$this->$key = $value;
@@ -389,16 +389,16 @@  discard block
 block discarded – undo
389 389
 	 * @return mixed
390 390
 	 * @throws Exception
391 391
 	 */
392
-	public function __get( $key ) {
392
+	public function __get($key) {
393 393
 
394
-		if ( method_exists( $this, 'get_' . $key ) ) {
394
+		if (method_exists($this, 'get_'.$key)) {
395 395
 
396
-			return call_user_func( array( $this, 'get_' . $key ) );
396
+			return call_user_func(array($this, 'get_'.$key));
397 397
 
398 398
 		} else {
399 399
 
400 400
 			/* translators: %s: property key */
401
-			return new WP_Error( 'give-form-invalid-property', sprintf( esc_html__( 'Can\'t get property %s.', 'give' ), $key ) );
401
+			return new WP_Error('give-form-invalid-property', sprintf(esc_html__('Can\'t get property %s.', 'give'), $key));
402 402
 
403 403
 		}
404 404
 
@@ -414,30 +414,30 @@  discard block
 block discarded – undo
414 414
 	 *
415 415
 	 * @return mixed       False if data isn't passed and class not instantiated for creation, or New Form ID.
416 416
 	 */
417
-	public function create( $data = array() ) {
417
+	public function create($data = array()) {
418 418
 
419
-		if ( $this->id != 0 ) {
419
+		if ($this->id != 0) {
420 420
 			return false;
421 421
 		}
422 422
 
423 423
 		$defaults = array(
424 424
 			'post_type'   => 'give_forms',
425 425
 			'post_status' => 'draft',
426
-			'post_title'  => esc_html__( 'New Donation Form', 'give' )
426
+			'post_title'  => esc_html__('New Donation Form', 'give')
427 427
 		);
428 428
 
429
-		$args = wp_parse_args( $data, $defaults );
429
+		$args = wp_parse_args($data, $defaults);
430 430
 
431 431
 		/**
432 432
 		 * Fired before a donation form is created
433 433
 		 *
434 434
 		 * @param array $args The post object arguments used for creation.
435 435
 		 */
436
-		do_action( 'give_form_pre_create', $args );
436
+		do_action('give_form_pre_create', $args);
437 437
 
438
-		$id = wp_insert_post( $args, true );
438
+		$id = wp_insert_post($args, true);
439 439
 
440
-		$donation_form = WP_Post::get_instance( $id );
440
+		$donation_form = WP_Post::get_instance($id);
441 441
 
442 442
 		/**
443 443
 		 * Fired after a donation form is created
@@ -445,9 +445,9 @@  discard block
 block discarded – undo
445 445
 		 * @param int   $id   The post ID of the created item.
446 446
 		 * @param array $args The post object arguments used for creation.
447 447
 		 */
448
-		do_action( 'give_form_post_create', $id, $args );
448
+		do_action('give_form_post_create', $id, $args);
449 449
 
450
-		return $this->setup_donation_form( $donation_form );
450
+		return $this->setup_donation_form($donation_form);
451 451
 
452 452
 	}
453 453
 
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
 	 * @return string Donation form name.
473 473
 	 */
474 474
 	public function get_name() {
475
-		return get_the_title( $this->ID );
475
+		return get_the_title($this->ID);
476 476
 	}
477 477
 
478 478
 	/**
@@ -485,13 +485,13 @@  discard block
 block discarded – undo
485 485
 	 */
486 486
 	public function get_price() {
487 487
 
488
-		if ( ! isset( $this->price ) ) {
488
+		if ( ! isset($this->price)) {
489 489
 
490
-			$this->price = get_post_meta( $this->ID, '_give_set_price', true );
490
+			$this->price = get_post_meta($this->ID, '_give_set_price', true);
491 491
 
492
-			if ( $this->price ) {
492
+			if ($this->price) {
493 493
 
494
-				$this->price = give_sanitize_amount( $this->price );
494
+				$this->price = give_sanitize_amount($this->price);
495 495
 
496 496
 			} else {
497 497
 
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
 		 * @param string     $price The donation form price.
510 510
 		 * @param string|int $id    The form ID.
511 511
 		 */
512
-		return apply_filters( 'give_get_set_price', $this->price, $this->ID );
512
+		return apply_filters('give_get_set_price', $this->price, $this->ID);
513 513
 	}
514 514
 
515 515
 	/**
@@ -522,14 +522,14 @@  discard block
 block discarded – undo
522 522
 	 */
523 523
 	public function get_minimum_price() {
524 524
 
525
-		if ( ! isset( $this->minimum_price ) ) {
525
+		if ( ! isset($this->minimum_price)) {
526 526
 
527
-			$allow_custom_amount = get_post_meta( $this->ID, '_give_custom_amount', true );
528
-			$this->minimum_price = get_post_meta( $this->ID, '_give_custom_amount_minimum', true );
527
+			$allow_custom_amount = get_post_meta($this->ID, '_give_custom_amount', true);
528
+			$this->minimum_price = get_post_meta($this->ID, '_give_custom_amount_minimum', true);
529 529
 
530
-			if ( $allow_custom_amount != 'no' && $this->minimum_price ) {
530
+			if ($allow_custom_amount != 'no' && $this->minimum_price) {
531 531
 
532
-				$this->minimum_price = give_sanitize_amount( $this->minimum_price );
532
+				$this->minimum_price = give_sanitize_amount($this->minimum_price);
533 533
 
534 534
 			} else {
535 535
 
@@ -539,7 +539,7 @@  discard block
 block discarded – undo
539 539
 
540 540
 		}
541 541
 
542
-		return apply_filters( 'give_get_set_minimum_price', $this->minimum_price, $this->ID );
542
+		return apply_filters('give_get_set_minimum_price', $this->minimum_price, $this->ID);
543 543
 	}
544 544
 
545 545
 	/**
@@ -552,9 +552,9 @@  discard block
 block discarded – undo
552 552
 	 */
553 553
 	public function get_prices() {
554 554
 
555
-		if ( ! isset( $this->prices ) ) {
555
+		if ( ! isset($this->prices)) {
556 556
 
557
-			$this->prices = get_post_meta( $this->ID, '_give_donation_levels', true );
557
+			$this->prices = get_post_meta($this->ID, '_give_donation_levels', true);
558 558
 
559 559
 		}
560 560
 
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
 		 * @param array $prices The array of mulit-level prices.
567 567
 		 * @param int|string The ID of the form.
568 568
 		 */
569
-		return apply_filters( 'give_get_donation_levels', $this->prices, $this->ID );
569
+		return apply_filters('give_get_donation_levels', $this->prices, $this->ID);
570 570
 
571 571
 	}
572 572
 
@@ -580,13 +580,13 @@  discard block
 block discarded – undo
580 580
 	 */
581 581
 	public function get_goal() {
582 582
 
583
-		if ( ! isset( $this->goal ) ) {
583
+		if ( ! isset($this->goal)) {
584 584
 
585
-			$this->goal = get_post_meta( $this->ID, '_give_set_goal', true );
585
+			$this->goal = get_post_meta($this->ID, '_give_set_goal', true);
586 586
 
587
-			if ( $this->goal ) {
587
+			if ($this->goal) {
588 588
 
589
-				$this->goal = give_sanitize_amount( $this->goal );
589
+				$this->goal = give_sanitize_amount($this->goal);
590 590
 
591 591
 			} else {
592 592
 
@@ -596,7 +596,7 @@  discard block
 block discarded – undo
596 596
 
597 597
 		}
598 598
 
599
-		return apply_filters( 'give_get_set_goal', $this->goal, $this->ID );
599
+		return apply_filters('give_get_set_goal', $this->goal, $this->ID);
600 600
 
601 601
 	}
602 602
 
@@ -610,10 +610,10 @@  discard block
 block discarded – undo
610 610
 	 */
611 611
 	public function is_single_price_mode() {
612 612
 
613
-		$option = get_post_meta( $this->ID, '_give_price_options_mode', true );
613
+		$option = get_post_meta($this->ID, '_give_price_options_mode', true);
614 614
 		$ret    = 0;
615 615
 
616
-		if ( empty( $option ) || $option === 'set' ) {
616
+		if (empty($option) || $option === 'set') {
617 617
 			$ret = 1;
618 618
 		}
619 619
 
@@ -625,7 +625,7 @@  discard block
 block discarded – undo
625 625
 		 * @param bool $ret Is donation form in single price mode?
626 626
 		 * @param int|string The ID of the donation form.
627 627
 		 */
628
-		return (bool) apply_filters( 'give_single_price_option_mode', $ret, $this->ID );
628
+		return (bool) apply_filters('give_single_price_option_mode', $ret, $this->ID);
629 629
 
630 630
 	}
631 631
 
@@ -639,10 +639,10 @@  discard block
 block discarded – undo
639 639
 	 */
640 640
 	public function is_custom_price_mode() {
641 641
 
642
-		$option = get_post_meta( $this->ID, '_give_custom_amount', true );
642
+		$option = get_post_meta($this->ID, '_give_custom_amount', true);
643 643
 		$ret    = 0;
644 644
 
645
-		if ( $option === 'yes' ) {
645
+		if ($option === 'yes') {
646 646
 			$ret = 1;
647 647
 		}
648 648
 
@@ -654,7 +654,7 @@  discard block
 block discarded – undo
654 654
 		 * @param bool $ret Is donation form in custom price mode?
655 655
 		 * @param int|string The ID of the donation form.
656 656
 		 */
657
-		return (bool) apply_filters( 'give_custom_price_option_mode', $ret, $this->ID );
657
+		return (bool) apply_filters('give_custom_price_option_mode', $ret, $this->ID);
658 658
 
659 659
 	}
660 660
 
@@ -670,10 +670,10 @@  discard block
 block discarded – undo
670 670
 	 */
671 671
 	public function has_variable_prices() {
672 672
 
673
-		$option = get_post_meta( $this->ID, '_give_price_option', true );
673
+		$option = get_post_meta($this->ID, '_give_price_option', true);
674 674
 		$ret    = 0;
675 675
 
676
-		if ( $option === 'multi' ) {
676
+		if ($option === 'multi') {
677 677
 			$ret = 1;
678 678
 		}
679 679
 
@@ -683,7 +683,7 @@  discard block
 block discarded – undo
683 683
 		 * @param bool $ret Does donation form have variable prices?
684 684
 		 * @param int|string The ID of the donation form.
685 685
 		 */
686
-		return (bool) apply_filters( 'give_has_variable_prices', $ret, $this->ID );
686
+		return (bool) apply_filters('give_has_variable_prices', $ret, $this->ID);
687 687
 
688 688
 	}
689 689
 
@@ -697,17 +697,17 @@  discard block
 block discarded – undo
697 697
 	 */
698 698
 	public function get_type() {
699 699
 
700
-		if ( ! isset( $this->type ) ) {
700
+		if ( ! isset($this->type)) {
701 701
 
702
-			$this->type = get_post_meta( $this->ID, '_give_price_option', true );
702
+			$this->type = get_post_meta($this->ID, '_give_price_option', true);
703 703
 
704
-			if ( empty( $this->type ) ) {
704
+			if (empty($this->type)) {
705 705
 				$this->type = 'set';
706 706
 			}
707 707
 
708 708
 		}
709 709
 
710
-		return apply_filters( 'give_get_form_type', $this->type, $this->ID );
710
+		return apply_filters('give_get_form_type', $this->type, $this->ID);
711 711
 
712 712
 	}
713 713
 
@@ -723,23 +723,23 @@  discard block
 block discarded – undo
723 723
 	 *
724 724
 	 * @return string
725 725
 	 */
726
-	public function get_form_classes( $args ) {
726
+	public function get_form_classes($args) {
727 727
 
728
-		$float_labels_option = give_is_float_labels_enabled( $args )
728
+		$float_labels_option = give_is_float_labels_enabled($args)
729 729
 			? 'float-labels-enabled'
730 730
 			: '';
731 731
 
732
-		$form_classes_array = apply_filters( 'give_form_classes', array(
732
+		$form_classes_array = apply_filters('give_form_classes', array(
733 733
 			'give-form',
734
-			'give-form-' . $this->ID,
735
-			'give-form-type-' . $this->get_type(),
734
+			'give-form-'.$this->ID,
735
+			'give-form-type-'.$this->get_type(),
736 736
 			$float_labels_option
737
-		), $this->ID, $args );
737
+		), $this->ID, $args);
738 738
 
739 739
 		// Remove empty class names.
740
-		$form_classes_array = array_filter( $form_classes_array );
740
+		$form_classes_array = array_filter($form_classes_array);
741 741
 
742
-		return implode( ' ', $form_classes_array );
742
+		return implode(' ', $form_classes_array);
743 743
 
744 744
 	}
745 745
 
@@ -754,19 +754,19 @@  discard block
 block discarded – undo
754 754
 	 *
755 755
 	 * @return string
756 756
 	 */
757
-	public function get_form_wrap_classes( $args ) {
757
+	public function get_form_wrap_classes($args) {
758 758
 
759
-		$display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) )
759
+		$display_option = (isset($args['display_style']) && ! empty($args['display_style']))
760 760
 			? $args['display_style']
761
-			: get_post_meta( $this->ID, '_give_payment_display', true );
761
+			: get_post_meta($this->ID, '_give_payment_display', true);
762 762
 
763
-		$form_wrap_classes_array = apply_filters( 'give_form_wrap_classes', array(
763
+		$form_wrap_classes_array = apply_filters('give_form_wrap_classes', array(
764 764
 			'give-form-wrap',
765
-			'give-display-' . $display_option
766
-		), $this->ID, $args );
765
+			'give-display-'.$display_option
766
+		), $this->ID, $args);
767 767
 
768 768
 
769
-		return implode( ' ', $form_wrap_classes_array );
769
+		return implode(' ', $form_wrap_classes_array);
770 770
 
771 771
 	}
772 772
 
@@ -796,7 +796,7 @@  discard block
 block discarded – undo
796 796
 	public function is_multi_type_donation_form() {
797 797
 		$form_type = $this->get_type();
798 798
 
799
-		return ( 'multi' === $form_type ? true : false );
799
+		return ('multi' === $form_type ? true : false);
800 800
 
801 801
 	}
802 802
 
@@ -810,15 +810,15 @@  discard block
 block discarded – undo
810 810
 	 */
811 811
 	public function get_sales() {
812 812
 
813
-		if ( ! isset( $this->sales ) ) {
813
+		if ( ! isset($this->sales)) {
814 814
 
815
-			if ( '' == get_post_meta( $this->ID, '_give_form_sales', true ) ) {
816
-				add_post_meta( $this->ID, '_give_form_sales', 0 );
815
+			if ('' == get_post_meta($this->ID, '_give_form_sales', true)) {
816
+				add_post_meta($this->ID, '_give_form_sales', 0);
817 817
 			} // End if
818 818
 
819
-			$this->sales = get_post_meta( $this->ID, '_give_form_sales', true );
819
+			$this->sales = get_post_meta($this->ID, '_give_form_sales', true);
820 820
 
821
-			if ( $this->sales < 0 ) {
821
+			if ($this->sales < 0) {
822 822
 				// Never let sales be less than zero
823 823
 				$this->sales = 0;
824 824
 			}
@@ -839,13 +839,13 @@  discard block
 block discarded – undo
839 839
 	 *
840 840
 	 * @return int|false     New number of total sales.
841 841
 	 */
842
-	public function increase_sales( $quantity = 1 ) {
842
+	public function increase_sales($quantity = 1) {
843 843
 
844
-		$sales       = give_get_form_sales_stats( $this->ID );
845
-		$quantity    = absint( $quantity );
844
+		$sales       = give_get_form_sales_stats($this->ID);
845
+		$quantity    = absint($quantity);
846 846
 		$total_sales = $sales + $quantity;
847 847
 
848
-		if ( $this->update_meta( '_give_form_sales', $total_sales ) ) {
848
+		if ($this->update_meta('_give_form_sales', $total_sales)) {
849 849
 
850 850
 			$this->sales = $total_sales;
851 851
 
@@ -866,17 +866,17 @@  discard block
 block discarded – undo
866 866
 	 *
867 867
 	 * @return int|false     New number of total sales.
868 868
 	 */
869
-	public function decrease_sales( $quantity = 1 ) {
869
+	public function decrease_sales($quantity = 1) {
870 870
 
871
-		$sales = give_get_form_sales_stats( $this->ID );
871
+		$sales = give_get_form_sales_stats($this->ID);
872 872
 
873 873
 		// Only decrease if not already zero
874
-		if ( $sales > 0 ) {
874
+		if ($sales > 0) {
875 875
 
876
-			$quantity    = absint( $quantity );
876
+			$quantity    = absint($quantity);
877 877
 			$total_sales = $sales - $quantity;
878 878
 
879
-			if ( $this->update_meta( '_give_form_sales', $total_sales ) ) {
879
+			if ($this->update_meta('_give_form_sales', $total_sales)) {
880 880
 
881 881
 				$this->sales = $sales;
882 882
 
@@ -900,15 +900,15 @@  discard block
 block discarded – undo
900 900
 	 */
901 901
 	public function get_earnings() {
902 902
 
903
-		if ( ! isset( $this->earnings ) ) {
903
+		if ( ! isset($this->earnings)) {
904 904
 
905
-			if ( '' == get_post_meta( $this->ID, '_give_form_earnings', true ) ) {
906
-				add_post_meta( $this->ID, '_give_form_earnings', 0 );
905
+			if ('' == get_post_meta($this->ID, '_give_form_earnings', true)) {
906
+				add_post_meta($this->ID, '_give_form_earnings', 0);
907 907
 			}
908 908
 
909
-			$this->earnings = get_post_meta( $this->ID, '_give_form_earnings', true );
909
+			$this->earnings = get_post_meta($this->ID, '_give_form_earnings', true);
910 910
 
911
-			if ( $this->earnings < 0 ) {
911
+			if ($this->earnings < 0) {
912 912
 				// Never let earnings be less than zero
913 913
 				$this->earnings = 0;
914 914
 			}
@@ -929,12 +929,12 @@  discard block
 block discarded – undo
929 929
 	 *
930 930
 	 * @return float|false
931 931
 	 */
932
-	public function increase_earnings( $amount = 0 ) {
932
+	public function increase_earnings($amount = 0) {
933 933
 
934
-		$earnings   = give_get_form_earnings_stats( $this->ID );
934
+		$earnings   = give_get_form_earnings_stats($this->ID);
935 935
 		$new_amount = $earnings + (float) $amount;
936 936
 
937
-		if ( $this->update_meta( '_give_form_earnings', $new_amount ) ) {
937
+		if ($this->update_meta('_give_form_earnings', $new_amount)) {
938 938
 
939 939
 			$this->earnings = $new_amount;
940 940
 
@@ -956,16 +956,16 @@  discard block
 block discarded – undo
956 956
 	 * 
957 957
 	 * @return float|false
958 958
 	 */
959
-	public function decrease_earnings( $amount ) {
959
+	public function decrease_earnings($amount) {
960 960
 
961
-		$earnings = give_get_form_earnings_stats( $this->ID );
961
+		$earnings = give_get_form_earnings_stats($this->ID);
962 962
 
963
-		if ( $earnings > 0 ) {
963
+		if ($earnings > 0) {
964 964
 			// Only decrease if greater than zero
965 965
 			$new_amount = $earnings - (float) $amount;
966 966
 
967 967
 
968
-			if ( $this->update_meta( '_give_form_earnings', $new_amount ) ) {
968
+			if ($this->update_meta('_give_form_earnings', $new_amount)) {
969 969
 
970 970
 				$this->earnings = $new_amount;
971 971
 
@@ -989,22 +989,22 @@  discard block
 block discarded – undo
989 989
 	 *
990 990
 	 * @return bool
991 991
 	 */
992
-	public function is_free( $price_id = false ) {
992
+	public function is_free($price_id = false) {
993 993
 
994 994
 		$is_free          = false;
995
-		$variable_pricing = give_has_variable_prices( $this->ID );
995
+		$variable_pricing = give_has_variable_prices($this->ID);
996 996
 
997
-		if ( $variable_pricing && ! is_null( $price_id ) && $price_id !== false ) {
998
-			$price = give_get_price_option_amount( $this->ID, $price_id );
999
-		} elseif ( ! $variable_pricing ) {
1000
-			$price = get_post_meta( $this->ID, '_give_set_price', true );
997
+		if ($variable_pricing && ! is_null($price_id) && $price_id !== false) {
998
+			$price = give_get_price_option_amount($this->ID, $price_id);
999
+		} elseif ( ! $variable_pricing) {
1000
+			$price = get_post_meta($this->ID, '_give_set_price', true);
1001 1001
 		}
1002 1002
 
1003
-		if ( isset( $price ) && (float) $price == 0 ) {
1003
+		if (isset($price) && (float) $price == 0) {
1004 1004
 			$is_free = true;
1005 1005
 		}
1006 1006
 
1007
-		return (bool) apply_filters( 'give_is_free_donation', $is_free, $this->ID, $price_id );
1007
+		return (bool) apply_filters('give_is_free_donation', $is_free, $this->ID, $price_id);
1008 1008
 
1009 1009
 	}
1010 1010
 
@@ -1023,9 +1023,9 @@  discard block
 block discarded – undo
1023 1023
 	 */
1024 1024
 	public function is_close_donation_form() {
1025 1025
 		return (
1026
-			       'yes' === get_post_meta( $this->ID, '_give_goal_option', true ) )
1027
-		       && ( 'yes' === get_post_meta( $this->ID, '_give_close_form_when_goal_achieved', true ) )
1028
-		       && ( $this->get_goal() <= $this->get_earnings()
1026
+			       'yes' === get_post_meta($this->ID, '_give_goal_option', true) )
1027
+		       && ('yes' === get_post_meta($this->ID, '_give_close_form_when_goal_achieved', true))
1028
+		       && ($this->get_goal() <= $this->get_earnings()
1029 1029
 		       );
1030 1030
 	}
1031 1031
 
@@ -1040,29 +1040,29 @@  discard block
 block discarded – undo
1040 1040
 	 *
1041 1041
 	 * @return bool                            The result of the update query.
1042 1042
 	 */
1043
-	private function update_meta( $meta_key = '', $meta_value = '' ) {
1043
+	private function update_meta($meta_key = '', $meta_value = '') {
1044 1044
 
1045 1045
 		/* @var WPDB $wpdb */
1046 1046
 		global $wpdb;
1047 1047
 
1048
-		if ( empty( $meta_key ) ) {
1048
+		if (empty($meta_key)) {
1049 1049
 			return false;
1050 1050
 		}
1051 1051
 
1052 1052
 		// Make sure if it needs to be serialized, we do
1053
-		$meta_value = maybe_serialize( $meta_value );
1053
+		$meta_value = maybe_serialize($meta_value);
1054 1054
 
1055
-		if ( is_numeric( $meta_value ) ) {
1056
-			$value_type = is_float( $meta_value ) ? '%f' : '%d';
1055
+		if (is_numeric($meta_value)) {
1056
+			$value_type = is_float($meta_value) ? '%f' : '%d';
1057 1057
 		} else {
1058 1058
 			$value_type = "'%s'";
1059 1059
 		}
1060 1060
 
1061
-		$sql = $wpdb->prepare( "UPDATE $wpdb->postmeta SET meta_value = $value_type WHERE post_id = $this->ID AND meta_key = '%s'", $meta_value, $meta_key );
1061
+		$sql = $wpdb->prepare("UPDATE $wpdb->postmeta SET meta_value = $value_type WHERE post_id = $this->ID AND meta_key = '%s'", $meta_value, $meta_key);
1062 1062
 
1063
-		if ( $wpdb->query( $sql ) ) {
1063
+		if ($wpdb->query($sql)) {
1064 1064
 
1065
-			clean_post_cache( $this->ID );
1065
+			clean_post_cache($this->ID);
1066 1066
 
1067 1067
 			return true;
1068 1068
 
Please login to merge, or discard this patch.