Test Failed
Push — master ( cd44a0...d8bbfb )
by Devin
01:14
created
includes/admin/payments/payments-history.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -24,10 +24,10 @@  discard block
 block discarded – undo
24 24
  * @return      void
25 25
 */
26 26
 function give_payment_history_page() {
27
-	if ( isset( $_GET['view'] ) && 'view-payment-details' == $_GET['view'] ) {
28
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/view-payment-details.php';
27
+	if (isset($_GET['view']) && 'view-payment-details' == $_GET['view']) {
28
+		require_once GIVE_PLUGIN_DIR.'includes/admin/payments/view-payment-details.php';
29 29
 	} else {
30
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/class-payments-table.php';
30
+		require_once GIVE_PLUGIN_DIR.'includes/admin/payments/class-payments-table.php';
31 31
 		$payments_table = new Give_Payment_History_Table();
32 32
 		$payments_table->prepare_items();
33 33
 	?>
@@ -41,23 +41,23 @@  discard block
 block discarded – undo
41 41
 		 *
42 42
 		 * @since 1.7
43 43
 		 */
44
-		do_action( 'give_payments_page_top' );
44
+		do_action('give_payments_page_top');
45 45
 		?>
46 46
 		<hr class="wp-header-end">
47 47
 
48
-		<form id="give-payments-advanced-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>">
48
+		<form id="give-payments-advanced-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>">
49 49
 			<input type="hidden" name="post_type" value="give_forms" />
50 50
 			<input type="hidden" name="page" value="give-payment-history" />
51 51
 			<?php $payments_table->views() ?>
52 52
 			<?php $payments_table->advanced_filters(); ?>
53 53
 		</form>
54 54
 
55
-		<form id="give-payments-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>">
55
+		<form id="give-payments-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>">
56 56
 			<input type="hidden" name="post_type" value="give_forms" />
57 57
 			<input type="hidden" name="page" value="give-payment-history" />
58 58
 			<?php
59
-			if ( ! empty( $_GET['donor'] ) ) {
60
-				echo sprintf( '<input type="hidden" name="donor" value="%s"/>', absint( $_GET['donor'] ) );
59
+			if ( ! empty($_GET['donor'])) {
60
+				echo sprintf('<input type="hidden" name="donor" value="%s"/>', absint($_GET['donor']));
61 61
 			}
62 62
 
63 63
 			$payments_table->display();
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 		 *
71 71
 		 * @since 1.7
72 72
 		 */
73
-		do_action( 'give_payments_page_bottom' );
73
+		do_action('give_payments_page_bottom');
74 74
 		?>
75 75
 
76 76
 	</div>
@@ -87,29 +87,29 @@  discard block
 block discarded – undo
87 87
  * @param $title
88 88
  * @return string
89 89
  */
90
-function give_view_order_details_title( $admin_title, $title ) {
90
+function give_view_order_details_title($admin_title, $title) {
91 91
 
92
-	if ( 'give_forms_page_give-payment-history' != get_current_screen()->base ) {
92
+	if ('give_forms_page_give-payment-history' != get_current_screen()->base) {
93 93
 		return $admin_title;
94 94
 	}
95 95
 
96
-	if( ! isset( $_GET['give-action'] ) ) {
96
+	if ( ! isset($_GET['give-action'])) {
97 97
 		return $admin_title;
98 98
 	}
99 99
 
100
-	switch( $_GET['give-action'] ) :
100
+	switch ($_GET['give-action']) :
101 101
 
102 102
 		case 'view-payment-details' :
103 103
 			$title = sprintf(
104 104
 				/* translators: %s: admin title */
105
-				esc_html__( 'View Donation Details - %s', 'give' ),
105
+				esc_html__('View Donation Details - %s', 'give'),
106 106
 				$admin_title
107 107
 			);
108 108
 			break;
109 109
 		case 'edit-payment' :
110 110
 			$title = sprintf(
111 111
 				/* translators: %s: admin title */
112
-				esc_html__( 'Edit Donation - %s', 'give' ),
112
+				esc_html__('Edit Donation - %s', 'give'),
113 113
 				$admin_title
114 114
 			);
115 115
 			break;
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 
121 121
 	return $title;
122 122
 }
123
-add_filter( 'admin_title', 'give_view_order_details_title', 10, 2 );
123
+add_filter('admin_title', 'give_view_order_details_title', 10, 2);
124 124
 
125 125
 /**
126 126
  * Intercept default Edit post links for Give payments and rewrite them to the View Order Details screen.
@@ -132,20 +132,20 @@  discard block
 block discarded – undo
132 132
  * @param $context
133 133
  * @return string
134 134
  */
135
-function give_override_edit_post_for_payment_link( $url, $post_id = 0, $context ) {
135
+function give_override_edit_post_for_payment_link($url, $post_id = 0, $context) {
136 136
 
137
-	$post = get_post( $post_id );
137
+	$post = get_post($post_id);
138 138
 
139
-	if( ! $post ) {
139
+	if ( ! $post) {
140 140
 		return $url;
141 141
 	}
142 142
 
143
-	if( 'give_payment' != $post->post_type ) {
143
+	if ('give_payment' != $post->post_type) {
144 144
 		return $url;
145 145
 	}
146 146
 
147
-	$url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $post_id );
147
+	$url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id='.$post_id);
148 148
 
149 149
 	return $url;
150 150
 }
151
-add_filter( 'get_edit_post_link', 'give_override_edit_post_for_payment_link', 10, 3 );
151
+add_filter('get_edit_post_link', 'give_override_edit_post_for_payment_link', 10, 3);
Please login to merge, or discard this patch.
includes/admin/payments/class-payments-table.php 1 patch
Spacing   +214 added lines, -215 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
 /**
@@ -136,15 +136,15 @@  discard block
 block discarded – undo
136 136
 		// Set parent defaults.
137 137
 		parent::__construct(
138 138
 			array(
139
-				'singular' => give_get_forms_label_singular(),    // Singular name of the listed records.
140
-				'plural'   => give_get_forms_label_plural(),      // Plural name of the listed records.
141
-				'ajax'     => false,                              // Does this table support ajax?
139
+				'singular' => give_get_forms_label_singular(), // Singular name of the listed records.
140
+				'plural'   => give_get_forms_label_plural(), // Plural name of the listed records.
141
+				'ajax'     => false, // Does this table support ajax?
142 142
 			)
143 143
 		);
144 144
 
145 145
 		$this->process_bulk_action();
146 146
 		$this->get_payment_counts();
147
-		$this->base_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' );
147
+		$this->base_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history');
148 148
 	}
149 149
 
150 150
 	/**
@@ -153,31 +153,31 @@  discard block
 block discarded – undo
153 153
 	 * @return void
154 154
 	 */
155 155
 	public function advanced_filters() {
156
-		$start_date = isset( $_GET['start-date'] ) ? give_clean( $_GET['start-date'] ) : null;
157
-		$end_date   = isset( $_GET['end-date'] ) ? give_clean( $_GET['end-date'] ) : null;
158
-		$status     = isset( $_GET['status'] ) ? give_clean( $_GET['status'] ) : '';
159
-		$donor      = isset( $_GET['donor'] ) ? absint( $_GET['donor'] ) : '';
160
-		$search     = isset( $_GET['s'] ) ? give_clean( $_GET['s'] ) : '';
161
-		$form_id    = ! empty( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : 0;
156
+		$start_date = isset($_GET['start-date']) ? give_clean($_GET['start-date']) : null;
157
+		$end_date   = isset($_GET['end-date']) ? give_clean($_GET['end-date']) : null;
158
+		$status     = isset($_GET['status']) ? give_clean($_GET['status']) : '';
159
+		$donor      = isset($_GET['donor']) ? absint($_GET['donor']) : '';
160
+		$search     = isset($_GET['s']) ? give_clean($_GET['s']) : '';
161
+		$form_id    = ! empty($_GET['form_id']) ? absint($_GET['form_id']) : 0;
162 162
 		?>
163 163
 		<div id="give-payment-filters" class="give-filters">
164
-			<?php $this->search_box( __( 'Search', 'give' ), 'give-payments' ); ?>
164
+			<?php $this->search_box(__('Search', 'give'), 'give-payments'); ?>
165 165
 			<div id="give-payment-date-filters">
166 166
 				<div class="give-filter give-filter-half">
167 167
 					<label for="start-date"
168
-					       class="give-start-date-label"><?php _e( 'Start Date', 'give' ); ?></label>
168
+					       class="give-start-date-label"><?php _e('Start Date', 'give'); ?></label>
169 169
 					<input type="text" id="start-date" name="start-date" class="give_datepicker"
170 170
 					       value="<?php echo $start_date; ?>" placeholder="mm/dd/yyyy"/>
171 171
 				</div>
172 172
 				<div class="give-filter give-filter-half">
173
-					<label for="end-date" class="give-end-date-label"><?php _e( 'End Date', 'give' ); ?></label>
173
+					<label for="end-date" class="give-end-date-label"><?php _e('End Date', 'give'); ?></label>
174 174
 					<input type="text" id="end-date" name="end-date" class="give_datepicker"
175 175
 					       value="<?php echo $end_date; ?>" placeholder="mm/dd/yyyy"/>
176 176
 				</div>
177 177
 			</div>
178 178
 			<div id="give-payment-form-filter" class="give-filter">
179 179
 				<label for="give-donation-forms-filter"
180
-				       class="give-donation-forms-filter-label"><?php _e( 'Form', 'give' ); ?></label>
180
+				       class="give-donation-forms-filter-label"><?php _e('Form', 'give'); ?></label>
181 181
 				<?php
182 182
 				// Filter Donations by Donation Forms.
183 183
 				echo Give()->html->forms_dropdown(
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 						'class'    => 'give-donation-forms-filter',
188 188
 						'selected' => $form_id, // Make sure to have $form_id set to 0, if there is no selection.
189 189
 						'chosen'   => true,
190
-						'number'   => - 1,
190
+						'number'   => -1,
191 191
 					)
192 192
 				);
193 193
 				?>
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 			 *
200 200
 			 * @since 1.8.18
201 201
 			 */
202
-			do_action( 'give_payment_table_advanced_filters' );
202
+			do_action('give_payment_table_advanced_filters');
203 203
 
204 204
 			?>
205 205
 
@@ -207,13 +207,13 @@  discard block
 block discarded – undo
207 207
 			<input type="hidden" name="donor" value="<?php echo $donor; ?>"/>
208 208
 
209 209
 			<div class="give-filter">
210
-				<?php submit_button( __( 'Apply', 'give' ), 'secondary', '', false ); ?>
210
+				<?php submit_button(__('Apply', 'give'), 'secondary', '', false); ?>
211 211
 				<?php
212 212
 				// Clear active filters button.
213
-				if ( ! empty( $start_date ) || ! empty( $end_date ) || ! empty( $donor ) || ! empty( $search ) || ! empty( $status ) || ! empty( $form_id ) ) :
213
+				if ( ! empty($start_date) || ! empty($end_date) || ! empty($donor) || ! empty($search) || ! empty($status) || ! empty($form_id)) :
214 214
 					?>
215
-					<a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>"
216
-					   class="button give-clear-filters-button"><?php _e( 'Clear Filters', 'give' ); ?></a>
215
+					<a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>"
216
+					   class="button give-clear-filters-button"><?php _e('Clear Filters', 'give'); ?></a>
217 217
 				<?php endif; ?>
218 218
 			</div>
219 219
 		</div>
@@ -232,18 +232,18 @@  discard block
 block discarded – undo
232 232
 	 *
233 233
 	 * @return void
234 234
 	 */
235
-	public function search_box( $text, $input_id ) {
236
-		if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) {
235
+	public function search_box($text, $input_id) {
236
+		if (empty($_REQUEST['s']) && ! $this->has_items()) {
237 237
 			return;
238 238
 		}
239 239
 
240
-		$input_id = $input_id . '-search-input';
240
+		$input_id = $input_id.'-search-input';
241 241
 
242
-		if ( ! empty( $_REQUEST['orderby'] ) ) {
243
-			echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />';
242
+		if ( ! empty($_REQUEST['orderby'])) {
243
+			echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />';
244 244
 		}
245
-		if ( ! empty( $_REQUEST['order'] ) ) {
246
-			echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />';
245
+		if ( ! empty($_REQUEST['order'])) {
246
+			echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />';
247 247
 		}
248 248
 		?>
249 249
 		<div class="give-filter give-filter-search" role="search">
@@ -255,13 +255,13 @@  discard block
 block discarded – undo
255 255
 			 *
256 256
 			 * @since 1.7
257 257
 			 */
258
-			do_action( 'give_payment_history_search' );
258
+			do_action('give_payment_history_search');
259 259
 			?>
260 260
 			<label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label>
261 261
 			<input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>"/>
262
-			<?php submit_button( $text, 'button', false, false, array(
262
+			<?php submit_button($text, 'button', false, false, array(
263 263
 				'ID' => 'search-submit',
264
-			) ); ?><br/>
264
+			)); ?><br/>
265 265
 		</div>
266 266
 		<?php
267 267
 	}
@@ -276,48 +276,48 @@  discard block
 block discarded – undo
276 276
 	 */
277 277
 	public function get_views() {
278 278
 
279
-		$current = isset( $_GET['status'] ) ? $_GET['status'] : '';
279
+		$current = isset($_GET['status']) ? $_GET['status'] : '';
280 280
 		$views   = array();
281 281
 		$tabs    = array(
282 282
 			'all'         => array(
283 283
 				'total_count',
284
-				__( 'All', 'give' ),
284
+				__('All', 'give'),
285 285
 			),
286 286
 			'publish'     => array(
287 287
 				'complete_count',
288
-				__( 'Completed', 'give' ),
288
+				__('Completed', 'give'),
289 289
 			),
290 290
 			'pending'     => array(
291 291
 				'pending_count',
292
-				__( 'Pending', 'give' ),
292
+				__('Pending', 'give'),
293 293
 			),
294 294
 			'processing'  => array(
295 295
 				'processing_count',
296
-				__( 'Processing', 'give' ),
296
+				__('Processing', 'give'),
297 297
 			),
298 298
 			'refunded'    => array(
299 299
 				'refunded_count',
300
-				__( 'Refunded', 'give' ),
300
+				__('Refunded', 'give'),
301 301
 			),
302 302
 			'revoked'     => array(
303 303
 				'revoked_count',
304
-				__( 'Revoked', 'give' ),
304
+				__('Revoked', 'give'),
305 305
 			),
306 306
 			'failed'      => array(
307 307
 				'failed_count',
308
-				__( 'Failed', 'give' ),
308
+				__('Failed', 'give'),
309 309
 			),
310 310
 			'cancelled'   => array(
311 311
 				'cancelled_count',
312
-				__( 'Cancelled', 'give' ),
312
+				__('Cancelled', 'give'),
313 313
 			),
314 314
 			'abandoned'   => array(
315 315
 				'abandoned_count',
316
-				__( 'Abandoned', 'give' ),
316
+				__('Abandoned', 'give'),
317 317
 			),
318 318
 			'preapproval' => array(
319 319
 				'preapproval_count',
320
-				__( 'Preapproval Pending', 'give' ),
320
+				__('Preapproval Pending', 'give'),
321 321
 			),
322 322
 		);
323 323
 
@@ -326,12 +326,12 @@  discard block
 block discarded – undo
326 326
 		 *
327 327
 		 * @since 1.8.18
328 328
 		 */
329
-		$args = (array) apply_filters( 'give_payments_table_status_remove_query_arg', array( 'paged', '_wpnonce', '_wp_http_referer' ) );
329
+		$args = (array) apply_filters('give_payments_table_status_remove_query_arg', array('paged', '_wpnonce', '_wp_http_referer'));
330 330
 
331 331
 		// Build URL.
332
-		$staus_url = remove_query_arg( $args );
332
+		$staus_url = remove_query_arg($args);
333 333
 
334
-		foreach ( $tabs as $key => $tab ) {
334
+		foreach ($tabs as $key => $tab) {
335 335
 			$count_key = $tab[0];
336 336
 			$name      = $tab[1];
337 337
 			$count     = $this->$count_key;
@@ -346,16 +346,15 @@  discard block
 block discarded – undo
346 346
 			 *
347 347
 			 * @since 1.8.12
348 348
 			 */
349
-			if ( 'all' === $key || $key === $current || apply_filters( 'give_payments_table_show_all_status', 0 < $count, $key, $count ) ) {
349
+			if ('all' === $key || $key === $current || apply_filters('give_payments_table_show_all_status', 0 < $count, $key, $count)) {
350 350
 
351 351
 				$staus_url = 'all' === $key ?
352
-					add_query_arg( array( 'status' => false ), $staus_url ) :
353
-					add_query_arg( array( 'status' => $key ), $staus_url );
352
+					add_query_arg(array('status' => false), $staus_url) : add_query_arg(array('status' => $key), $staus_url);
354 353
 
355
-				$views[ $key ] = sprintf(
354
+				$views[$key] = sprintf(
356 355
 					'<a href="%s"%s>%s&nbsp;<span class="count">(%s)</span></a>',
357
-					esc_url( $staus_url ),
358
-					( ( 'all' === $key && empty( $current ) ) ) ? ' class="current"' : ( $current == $key ? 'class="current"' : '' ),
356
+					esc_url($staus_url),
357
+					(('all' === $key && empty($current))) ? ' class="current"' : ($current == $key ? 'class="current"' : ''),
359 358
 					$name,
360 359
 					$count
361 360
 				);
@@ -370,7 +369,7 @@  discard block
 block discarded – undo
370 369
 		 * @param array $views
371 370
 		 * @param Give_Payment_History_Table
372 371
 		 */
373
-		return apply_filters( 'give_payments_table_views', $views, $this );
372
+		return apply_filters('give_payments_table_views', $views, $this);
374 373
 	}
375 374
 
376 375
 	/**
@@ -384,18 +383,18 @@  discard block
 block discarded – undo
384 383
 	public function get_columns() {
385 384
 		$columns = array(
386 385
 			'cb'            => '<input type="checkbox" />', // Render a checkbox instead of text.
387
-			'donation'      => __( 'Donation', 'give' ),
388
-			'donation_form' => __( 'Donation Form', 'give' ),
389
-			'status'        => __( 'Status', 'give' ),
390
-			'date'          => __( 'Date', 'give' ),
391
-			'amount'        => __( 'Amount', 'give' ),
386
+			'donation'      => __('Donation', 'give'),
387
+			'donation_form' => __('Donation Form', 'give'),
388
+			'status'        => __('Status', 'give'),
389
+			'date'          => __('Date', 'give'),
390
+			'amount'        => __('Amount', 'give'),
392 391
 		);
393 392
 
394
-		if ( current_user_can( 'view_give_payments' ) ) {
395
-			$columns['details'] = __( 'Details', 'give' );
393
+		if (current_user_can('view_give_payments')) {
394
+			$columns['details'] = __('Details', 'give');
396 395
 		}
397 396
 
398
-		return apply_filters( 'give_payments_table_columns', $columns );
397
+		return apply_filters('give_payments_table_columns', $columns);
399 398
 	}
400 399
 
401 400
 	/**
@@ -408,14 +407,14 @@  discard block
 block discarded – undo
408 407
 	 */
409 408
 	public function get_sortable_columns() {
410 409
 		$columns = array(
411
-			'donation'      => array( 'ID', true ),
412
-			'donation_form' => array( 'donation_form', false ),
413
-			'status'        => array( 'status', false ),
414
-			'amount'        => array( 'amount', false ),
415
-			'date'          => array( 'date', false ),
410
+			'donation'      => array('ID', true),
411
+			'donation_form' => array('donation_form', false),
412
+			'status'        => array('status', false),
413
+			'amount'        => array('amount', false),
414
+			'date'          => array('date', false),
416 415
 		);
417 416
 
418
-		return apply_filters( 'give_payments_table_sortable_columns', $columns );
417
+		return apply_filters('give_payments_table_sortable_columns', $columns);
419 418
 	}
420 419
 
421 420
 	/**
@@ -441,43 +440,43 @@  discard block
 block discarded – undo
441 440
 	 *
442 441
 	 * @return string Column Name
443 442
 	 */
444
-	public function column_default( $payment, $column_name ) {
443
+	public function column_default($payment, $column_name) {
445 444
 
446
-		$single_donation_url = esc_url( add_query_arg( 'id', $payment->ID, admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details' ) ) );
447
-		$row_actions         = $this->get_row_actions( $payment );
445
+		$single_donation_url = esc_url(add_query_arg('id', $payment->ID, admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details')));
446
+		$row_actions         = $this->get_row_actions($payment);
448 447
 		$value               = '';
449 448
 
450
-		switch ( $column_name ) {
449
+		switch ($column_name) {
451 450
 			case 'donation' :
452
-				if ( current_user_can( 'view_give_payments' ) ) {
453
-					$value = Give()->tooltips->render_link( array(
454
-						'label'       => sprintf( __( 'View Donation #%s', 'give' ), $payment->ID ),
451
+				if (current_user_can('view_give_payments')) {
452
+					$value = Give()->tooltips->render_link(array(
453
+						'label'       => sprintf(__('View Donation #%s', 'give'), $payment->ID),
455 454
 						'tag_content' => "#$payment->ID",
456 455
 						'link'        => $single_donation_url,
457
-					) );
456
+					));
458 457
 				} else {
459 458
 					$value = "#{$payment->ID}";
460 459
 				}
461 460
 
462 461
 				$value .= sprintf(
463 462
 					'&nbsp;%1$s&nbsp;%2$s<br>',
464
-					__( 'by', 'give' ),
465
-					$this->get_donor( $payment )
463
+					__('by', 'give'),
464
+					$this->get_donor($payment)
466 465
 				);
467 466
 
468
-				$value .= $this->get_donor_email( $payment );
469
-				$value .= $this->row_actions( $row_actions );
467
+				$value .= $this->get_donor_email($payment);
468
+				$value .= $this->row_actions($row_actions);
470 469
 				break;
471 470
 
472 471
 			case 'amount':
473
-				$amount = ! empty( $payment->total ) ? $payment->total : 0;
474
-				$value  = give_donation_amount( $payment, true );
475
-				$value .= sprintf( '<br><small>%1$s %2$s</small>', __( 'via', 'give' ), give_get_gateway_admin_label( $payment->gateway ) );
472
+				$amount = ! empty($payment->total) ? $payment->total : 0;
473
+				$value  = give_donation_amount($payment, true);
474
+				$value .= sprintf('<br><small>%1$s %2$s</small>', __('via', 'give'), give_get_gateway_admin_label($payment->gateway));
476 475
 				break;
477 476
 
478 477
 			case 'donation_form':
479
-				$form_title = empty( $payment->form_title ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $payment->form_id ) : $payment->form_title;
480
-				$value      = '<a href="' . admin_url( 'post.php?post=' . $payment->form_id . '&action=edit' ) . '">' . $form_title . '</a>';
478
+				$form_title = empty($payment->form_title) ? sprintf(__('Untitled (#%s)', 'give'), $payment->form_id) : $payment->form_title;
479
+				$value      = '<a href="'.admin_url('post.php?post='.$payment->form_id.'&action=edit').'">'.$form_title.'</a>';
481 480
 				$level      = give_get_donation_form_title(
482 481
 					$payment,
483 482
 					array(
@@ -485,44 +484,44 @@  discard block
 block discarded – undo
485 484
 					)
486 485
 				);
487 486
 
488
-				if ( ! empty( $level ) ) {
487
+				if ( ! empty($level)) {
489 488
 					$value .= $level;
490 489
 				}
491 490
 
492 491
 				break;
493 492
 
494 493
 			case 'date':
495
-				$date  = strtotime( $payment->date );
496
-				$value = date_i18n( give_date_format(), $date );
494
+				$date  = strtotime($payment->date);
495
+				$value = date_i18n(give_date_format(), $date);
497 496
 				break;
498 497
 
499 498
 			case 'status':
500
-				$value = $this->get_payment_status( $payment );
499
+				$value = $this->get_payment_status($payment);
501 500
 				break;
502 501
 
503 502
 
504 503
 			case 'details' :
505
-				if ( current_user_can( 'view_give_payments' ) ) {
506
-					$value = Give()->tooltips->render_link( array(
507
-						'label'       => sprintf( __( 'View Donation #%s', 'give' ), $payment->ID ),
504
+				if (current_user_can('view_give_payments')) {
505
+					$value = Give()->tooltips->render_link(array(
506
+						'label'       => sprintf(__('View Donation #%s', 'give'), $payment->ID),
508 507
 						'tag_content' => '<span class="dashicons dashicons-visibility"></span>',
509 508
 						'link'        => $single_donation_url,
510 509
 						'attributes'  => array(
511 510
 							'class' => 'give-payment-details-link button button-small',
512 511
 						),
513
-					) );
512
+					));
514 513
 
515 514
 					$value = "<div class=\"give-payment-details-link-wrap\">{$value}</div>";
516 515
 				}
517 516
 				break;
518 517
 
519 518
 			default:
520
-				$value = isset( $payment->$column_name ) ? $payment->$column_name : '';
519
+				$value = isset($payment->$column_name) ? $payment->$column_name : '';
521 520
 				break;
522 521
 
523 522
 		}// End switch().
524 523
 
525
-		return apply_filters( 'give_payments_table_column', $value, $payment->ID, $column_name );
524
+		return apply_filters('give_payments_table_column', $value, $payment->ID, $column_name);
526 525
 	}
527 526
 
528 527
 	/**
@@ -535,22 +534,22 @@  discard block
 block discarded – undo
535 534
 	 *
536 535
 	 * @return string Data shown in the Email column
537 536
 	 */
538
-	public function get_donor_email( $payment ) {
537
+	public function get_donor_email($payment) {
539 538
 
540
-		$email = give_get_payment_user_email( $payment->ID );
539
+		$email = give_get_payment_user_email($payment->ID);
541 540
 
542
-		if ( empty( $email ) ) {
543
-			$email = __( '(unknown)', 'give' );
541
+		if (empty($email)) {
542
+			$email = __('(unknown)', 'give');
544 543
 		}
545 544
 
546 545
 
547
-		$value = Give()->tooltips->render_link( array(
546
+		$value = Give()->tooltips->render_link(array(
548 547
 			'link'        => "mailto:{$email}",
549
-			'label'       => __( 'Email donor', 'give' ),
548
+			'label'       => __('Email donor', 'give'),
550 549
 			'tag_content' => $email,
551
-		) );
550
+		));
552 551
 
553
-		return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'email' );
552
+		return apply_filters('give_payments_table_column', $value, $payment->ID, 'email');
554 553
 	}
555 554
 
556 555
 	/**
@@ -562,18 +561,18 @@  discard block
 block discarded – undo
562 561
 	 *
563 562
 	 * @return array $actions
564 563
 	 */
565
-	function get_row_actions( $payment ) {
564
+	function get_row_actions($payment) {
566 565
 
567 566
 		$actions = array();
568
-		$email   = give_get_payment_user_email( $payment->ID );
567
+		$email   = give_get_payment_user_email($payment->ID);
569 568
 
570 569
 		// Add search term string back to base URL.
571
-		$search_terms = ( isset( $_GET['s'] ) ? trim( $_GET['s'] ) : '' );
572
-		if ( ! empty( $search_terms ) ) {
573
-			$this->base_url = add_query_arg( 's', $search_terms, $this->base_url );
570
+		$search_terms = (isset($_GET['s']) ? trim($_GET['s']) : '');
571
+		if ( ! empty($search_terms)) {
572
+			$this->base_url = add_query_arg('s', $search_terms, $this->base_url);
574 573
 		}
575 574
 
576
-		if ( give_is_payment_complete( $payment->ID ) && ! empty( $email ) ) {
575
+		if (give_is_payment_complete($payment->ID) && ! empty($email)) {
577 576
 
578 577
 			$actions['email_links'] = sprintf(
579 578
 				'<a class="resend-single-donation-receipt" href="%1$s" aria-label="%2$s">%3$s</a>', wp_nonce_url(
@@ -583,12 +582,12 @@  discard block
 block discarded – undo
583 582
 						'purchase_id' => $payment->ID,
584 583
 					), $this->base_url
585 584
 				), 'give_payment_nonce'
586
-			), sprintf( __( 'Resend Donation %s Receipt', 'give' ), $payment->ID ), __( 'Resend Receipt', 'give' )
585
+			), sprintf(__('Resend Donation %s Receipt', 'give'), $payment->ID), __('Resend Receipt', 'give')
587 586
 			);
588 587
 
589 588
 		}
590 589
 
591
-		if ( current_user_can( 'view_give_payments' ) ) {
590
+		if (current_user_can('view_give_payments')) {
592 591
 			$actions['delete'] = sprintf(
593 592
 				'<a class="delete-single-donation" href="%1$s" aria-label="%2$s">%3$s</a>',
594 593
 				wp_nonce_url(
@@ -598,11 +597,11 @@  discard block
 block discarded – undo
598 597
 							'purchase_id' => $payment->ID,
599 598
 						), $this->base_url
600 599
 					), 'give_donation_nonce'
601
-				), sprintf( __( 'Delete Donation %s', 'give' ), $payment->ID ), __( 'Delete', 'give' )
600
+				), sprintf(__('Delete Donation %s', 'give'), $payment->ID), __('Delete', 'give')
602 601
 			);
603 602
 		}
604 603
 
605
-		return apply_filters( 'give_payment_row_actions', $actions, $payment );
604
+		return apply_filters('give_payment_row_actions', $actions, $payment);
606 605
 	}
607 606
 
608 607
 
@@ -616,30 +615,30 @@  discard block
 block discarded – undo
616 615
 	 *
617 616
 	 * @return string Data shown in the Email column
618 617
 	 */
619
-	function get_payment_status( $payment ) {
618
+	function get_payment_status($payment) {
620 619
 		$value = sprintf(
621 620
 			'<div class="give-donation-status status-%1$s"><span class="give-donation-status-icon"></span>&nbsp;%2$s</div>',
622
-			sanitize_title( give_get_payment_status( $payment, true ) ),
623
-			give_get_payment_status( $payment, true )
621
+			sanitize_title(give_get_payment_status($payment, true)),
622
+			give_get_payment_status($payment, true)
624 623
 		);
625 624
 
626
-		if ( $payment->mode == 'test' ) {
627
-			$value .= Give()->tooltips->render_span( array(
628
-				'label'       => __( 'This donation was made in test mode.', 'give' ),
629
-				'tag_content' => __( 'Test', 'give' ),
625
+		if ($payment->mode == 'test') {
626
+			$value .= Give()->tooltips->render_span(array(
627
+				'label'       => __('This donation was made in test mode.', 'give'),
628
+				'tag_content' => __('Test', 'give'),
630 629
 				'attributes'  => array(
631 630
 					'class' => 'give-item-label give-item-label-orange give-test-mode-transactions-label',
632 631
 				),
633 632
 
634 633
 
635
-			) );
634
+			));
636 635
 		}
637 636
 
638
-		if ( true === $payment->import && true === (bool) apply_filters( 'give_payment_show_importer_label', false ) ) {
637
+		if (true === $payment->import && true === (bool) apply_filters('give_payment_show_importer_label', false)) {
639 638
 			$value .= sprintf(
640 639
 				'&nbsp;<span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="%1$s">%2$s</span>',
641
-				__( 'This donation was imported.', 'give' ),
642
-				__( 'Import', 'give' )
640
+				__('This donation was imported.', 'give'),
641
+				__('Import', 'give')
643 642
 			);
644 643
 		}
645 644
 
@@ -656,8 +655,8 @@  discard block
 block discarded – undo
656 655
 	 *
657 656
 	 * @return string Displays a checkbox.
658 657
 	 */
659
-	public function column_cb( $payment ) {
660
-		return sprintf( '<input type="checkbox" name="%1$s[]" value="%2$s" />', 'payment', $payment->ID );
658
+	public function column_cb($payment) {
659
+		return sprintf('<input type="checkbox" name="%1$s[]" value="%2$s" />', 'payment', $payment->ID);
661 660
 	}
662 661
 
663 662
 	/**
@@ -670,8 +669,8 @@  discard block
 block discarded – undo
670 669
 	 *
671 670
 	 * @return string Displays a checkbox.
672 671
 	 */
673
-	public function get_payment_id( $payment ) {
674
-		return '<span class="give-payment-id">' . give_get_payment_number( $payment->ID ) . '</span>';
672
+	public function get_payment_id($payment) {
673
+		return '<span class="give-payment-id">'.give_get_payment_number($payment->ID).'</span>';
675 674
 	}
676 675
 
677 676
 	/**
@@ -684,32 +683,32 @@  discard block
 block discarded – undo
684 683
 	 *
685 684
 	 * @return string Data shown in the User column
686 685
 	 */
687
-	public function get_donor( $payment ) {
686
+	public function get_donor($payment) {
688 687
 
689
-		$donor_id           = give_get_payment_donor_id( $payment->ID );
690
-		$donor_billing_name = give_get_donor_name_by( $payment->ID, 'donation' );
691
-		$donor_name         = give_get_donor_name_by( $donor_id, 'donor' );
688
+		$donor_id           = give_get_payment_donor_id($payment->ID);
689
+		$donor_billing_name = give_get_donor_name_by($payment->ID, 'donation');
690
+		$donor_name         = give_get_donor_name_by($donor_id, 'donor');
692 691
 
693 692
 		$value = '';
694
-		if ( ! empty( $donor_id ) ) {
693
+		if ( ! empty($donor_id)) {
695 694
 
696 695
 			// Check whether the donor name and WP_User name is same or not.
697
-			if ( sanitize_title( $donor_billing_name ) !== sanitize_title( $donor_name ) ) {
698
-				$value .= $donor_billing_name . ' (';
696
+			if (sanitize_title($donor_billing_name) !== sanitize_title($donor_name)) {
697
+				$value .= $donor_billing_name.' (';
699 698
 			}
700 699
 
701
-			$value .= '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id" ) ) . '">' . $donor_name . '</a>';
700
+			$value .= '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id")).'">'.$donor_name.'</a>';
702 701
 
703 702
 			// Check whether the donor name and WP_User name is same or not.
704
-			if ( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ) {
703
+			if (sanitize_title($donor_billing_name) != sanitize_title($donor_name)) {
705 704
 				$value .= ')';
706 705
 			}
707 706
 		} else {
708
-			$email  = give_get_payment_user_email( $payment->ID );
709
-			$value .= '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-payment-history&s=$email" ) ) . '">' . __( '(donor missing)', 'give' ) . '</a>';
707
+			$email  = give_get_payment_user_email($payment->ID);
708
+			$value .= '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-payment-history&s=$email")).'">'.__('(donor missing)', 'give').'</a>';
710 709
 		}
711 710
 
712
-		return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'donor' );
711
+		return apply_filters('give_payments_table_column', $value, $payment->ID, 'donor');
713 712
 	}
714 713
 
715 714
 	/**
@@ -722,20 +721,20 @@  discard block
 block discarded – undo
722 721
 	 */
723 722
 	public function get_bulk_actions() {
724 723
 		$actions = array(
725
-			'delete'                 => __( 'Delete', 'give' ),
726
-			'set-status-publish'     => __( 'Set To Completed', 'give' ),
727
-			'set-status-pending'     => __( 'Set To Pending', 'give' ),
728
-			'set-status-processing'  => __( 'Set To Processing', 'give' ),
729
-			'set-status-refunded'    => __( 'Set To Refunded', 'give' ),
730
-			'set-status-revoked'     => __( 'Set To Revoked', 'give' ),
731
-			'set-status-failed'      => __( 'Set To Failed', 'give' ),
732
-			'set-status-cancelled'   => __( 'Set To Cancelled', 'give' ),
733
-			'set-status-abandoned'   => __( 'Set To Abandoned', 'give' ),
734
-			'set-status-preapproval' => __( 'Set To Preapproval', 'give' ),
735
-			'resend-receipt'         => __( 'Resend Email Receipts', 'give' ),
724
+			'delete'                 => __('Delete', 'give'),
725
+			'set-status-publish'     => __('Set To Completed', 'give'),
726
+			'set-status-pending'     => __('Set To Pending', 'give'),
727
+			'set-status-processing'  => __('Set To Processing', 'give'),
728
+			'set-status-refunded'    => __('Set To Refunded', 'give'),
729
+			'set-status-revoked'     => __('Set To Revoked', 'give'),
730
+			'set-status-failed'      => __('Set To Failed', 'give'),
731
+			'set-status-cancelled'   => __('Set To Cancelled', 'give'),
732
+			'set-status-abandoned'   => __('Set To Abandoned', 'give'),
733
+			'set-status-preapproval' => __('Set To Preapproval', 'give'),
734
+			'resend-receipt'         => __('Resend Email Receipts', 'give'),
736 735
 		);
737 736
 
738
-		return apply_filters( 'give_payments_table_bulk_actions', $actions );
737
+		return apply_filters('give_payments_table_bulk_actions', $actions);
739 738
 	}
740 739
 
741 740
 	/**
@@ -747,59 +746,59 @@  discard block
 block discarded – undo
747 746
 	 * @return void
748 747
 	 */
749 748
 	public function process_bulk_action() {
750
-		$ids    = isset( $_GET['payment'] ) ? $_GET['payment'] : false;
749
+		$ids    = isset($_GET['payment']) ? $_GET['payment'] : false;
751 750
 		$action = $this->current_action();
752 751
 
753
-		if ( ! is_array( $ids ) ) {
754
-			$ids = array( $ids );
752
+		if ( ! is_array($ids)) {
753
+			$ids = array($ids);
755 754
 		}
756 755
 
757
-		if ( empty( $action ) ) {
756
+		if (empty($action)) {
758 757
 			return;
759 758
 		}
760 759
 
761
-		foreach ( $ids as $id ) {
760
+		foreach ($ids as $id) {
762 761
 
763 762
 			// Detect when a bulk action is being triggered.
764
-			switch ( $this->current_action() ) {
763
+			switch ($this->current_action()) {
765 764
 
766 765
 				case 'delete':
767
-					give_delete_donation( $id );
766
+					give_delete_donation($id);
768 767
 					break;
769 768
 
770 769
 				case 'set-status-publish':
771
-					give_update_payment_status( $id, 'publish' );
770
+					give_update_payment_status($id, 'publish');
772 771
 					break;
773 772
 
774 773
 				case 'set-status-pending':
775
-					give_update_payment_status( $id, 'pending' );
774
+					give_update_payment_status($id, 'pending');
776 775
 					break;
777 776
 
778 777
 				case 'set-status-processing':
779
-					give_update_payment_status( $id, 'processing' );
778
+					give_update_payment_status($id, 'processing');
780 779
 					break;
781 780
 
782 781
 				case 'set-status-refunded':
783
-					give_update_payment_status( $id, 'refunded' );
782
+					give_update_payment_status($id, 'refunded');
784 783
 					break;
785 784
 				case 'set-status-revoked':
786
-					give_update_payment_status( $id, 'revoked' );
785
+					give_update_payment_status($id, 'revoked');
787 786
 					break;
788 787
 
789 788
 				case 'set-status-failed':
790
-					give_update_payment_status( $id, 'failed' );
789
+					give_update_payment_status($id, 'failed');
791 790
 					break;
792 791
 
793 792
 				case 'set-status-cancelled':
794
-					give_update_payment_status( $id, 'cancelled' );
793
+					give_update_payment_status($id, 'cancelled');
795 794
 					break;
796 795
 
797 796
 				case 'set-status-abandoned':
798
-					give_update_payment_status( $id, 'abandoned' );
797
+					give_update_payment_status($id, 'abandoned');
799 798
 					break;
800 799
 
801 800
 				case 'set-status-preapproval':
802
-					give_update_payment_status( $id, 'preapproval' );
801
+					give_update_payment_status($id, 'preapproval');
803 802
 					break;
804 803
 
805 804
 				case 'resend-receipt':
@@ -808,7 +807,7 @@  discard block
 block discarded – undo
808 807
 					 *
809 808
 					 * @since 2.0
810 809
 					 */
811
-					do_action( 'give_donation-receipt_email_notification', $id );
810
+					do_action('give_donation-receipt_email_notification', $id);
812 811
 					break;
813 812
 			}// End switch().
814 813
 
@@ -820,7 +819,7 @@  discard block
 block discarded – undo
820 819
 			 *
821 820
 			 * @since 1.7
822 821
 			 */
823
-			do_action( 'give_payments_table_do_bulk_action', $id, $this->current_action() );
822
+			do_action('give_payments_table_do_bulk_action', $id, $this->current_action());
824 823
 		}// End foreach().
825 824
 
826 825
 	}
@@ -837,32 +836,32 @@  discard block
 block discarded – undo
837 836
 
838 837
 		$args = array();
839 838
 
840
-		if ( isset( $_GET['user'] ) ) {
841
-			$args['user'] = urldecode( $_GET['user'] );
842
-		} elseif ( isset( $_GET['donor'] ) ) {
843
-			$args['donor'] = absint( $_GET['donor'] );
844
-		} elseif ( isset( $_GET['s'] ) ) {
845
-			$is_user = strpos( $_GET['s'], strtolower( 'user:' ) ) !== false;
846
-			if ( $is_user ) {
847
-				$args['user'] = absint( trim( str_replace( 'user:', '', strtolower( $_GET['s'] ) ) ) );
848
-				unset( $args['s'] );
839
+		if (isset($_GET['user'])) {
840
+			$args['user'] = urldecode($_GET['user']);
841
+		} elseif (isset($_GET['donor'])) {
842
+			$args['donor'] = absint($_GET['donor']);
843
+		} elseif (isset($_GET['s'])) {
844
+			$is_user = strpos($_GET['s'], strtolower('user:')) !== false;
845
+			if ($is_user) {
846
+				$args['user'] = absint(trim(str_replace('user:', '', strtolower($_GET['s']))));
847
+				unset($args['s']);
849 848
 			} else {
850
-				$args['s'] = sanitize_text_field( $_GET['s'] );
849
+				$args['s'] = sanitize_text_field($_GET['s']);
851 850
 			}
852 851
 		}
853 852
 
854
-		if ( ! empty( $_GET['start-date'] ) ) {
855
-			$args['start-date'] = urldecode( $_GET['start-date'] );
853
+		if ( ! empty($_GET['start-date'])) {
854
+			$args['start-date'] = urldecode($_GET['start-date']);
856 855
 		}
857 856
 
858
-		if ( ! empty( $_GET['end-date'] ) ) {
859
-			$args['end-date'] = urldecode( $_GET['end-date'] );
857
+		if ( ! empty($_GET['end-date'])) {
858
+			$args['end-date'] = urldecode($_GET['end-date']);
860 859
 		}
861 860
 
862
-		$args['form_id'] = ! empty( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : null;
863
-		$args['gateway'] = ! empty( $_GET['gateway'] ) ? give_clean( $_GET['gateway'] ) : null;
861
+		$args['form_id'] = ! empty($_GET['form_id']) ? absint($_GET['form_id']) : null;
862
+		$args['gateway'] = ! empty($_GET['gateway']) ? give_clean($_GET['gateway']) : null;
864 863
 
865
-		$payment_count           = give_count_payments( $args );
864
+		$payment_count           = give_count_payments($args);
866 865
 		$this->complete_count    = $payment_count->publish;
867 866
 		$this->pending_count     = $payment_count->pending;
868 867
 		$this->processing_count  = $payment_count->processing;
@@ -873,7 +872,7 @@  discard block
 block discarded – undo
873 872
 		$this->abandoned_count   = $payment_count->abandoned;
874 873
 		$this->preapproval_count = $payment_count->preapproval;
875 874
 
876
-		foreach ( $payment_count as $count ) {
875
+		foreach ($payment_count as $count) {
877 876
 			$this->total_count += $count;
878 877
 		}
879 878
 
@@ -891,25 +890,25 @@  discard block
 block discarded – undo
891 890
 	public function payments_data() {
892 891
 
893 892
 		$per_page   = $this->per_page;
894
-		$orderby    = isset( $_GET['orderby'] ) ? urldecode( $_GET['orderby'] ) : 'ID';
895
-		$order      = isset( $_GET['order'] ) ? $_GET['order'] : 'DESC';
896
-		$user       = isset( $_GET['user'] ) ? $_GET['user'] : null;
897
-		$donor      = isset( $_GET['donor'] ) ? $_GET['donor'] : null;
898
-		$status     = isset( $_GET['status'] ) ? $_GET['status'] : give_get_payment_status_keys();
899
-		$meta_key   = isset( $_GET['meta_key'] ) ? $_GET['meta_key'] : null;
900
-		$year       = isset( $_GET['year'] ) ? $_GET['year'] : null;
901
-		$month      = isset( $_GET['m'] ) ? $_GET['m'] : null;
902
-		$day        = isset( $_GET['day'] ) ? $_GET['day'] : null;
903
-		$search     = isset( $_GET['s'] ) ? sanitize_text_field( $_GET['s'] ) : null;
904
-		$start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null;
905
-		$end_date   = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : $start_date;
906
-		$form_id    = ! empty( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : null;
907
-		$gateway    = ! empty( $_GET['gateway'] ) ? give_clean( $_GET['gateway'] ) : null;
893
+		$orderby    = isset($_GET['orderby']) ? urldecode($_GET['orderby']) : 'ID';
894
+		$order      = isset($_GET['order']) ? $_GET['order'] : 'DESC';
895
+		$user       = isset($_GET['user']) ? $_GET['user'] : null;
896
+		$donor      = isset($_GET['donor']) ? $_GET['donor'] : null;
897
+		$status     = isset($_GET['status']) ? $_GET['status'] : give_get_payment_status_keys();
898
+		$meta_key   = isset($_GET['meta_key']) ? $_GET['meta_key'] : null;
899
+		$year       = isset($_GET['year']) ? $_GET['year'] : null;
900
+		$month      = isset($_GET['m']) ? $_GET['m'] : null;
901
+		$day        = isset($_GET['day']) ? $_GET['day'] : null;
902
+		$search     = isset($_GET['s']) ? sanitize_text_field($_GET['s']) : null;
903
+		$start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null;
904
+		$end_date   = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : $start_date;
905
+		$form_id    = ! empty($_GET['form_id']) ? absint($_GET['form_id']) : null;
906
+		$gateway    = ! empty($_GET['gateway']) ? give_clean($_GET['gateway']) : null;
908 907
 
909 908
 		$args = array(
910 909
 			'output'     => 'payments',
911 910
 			'number'     => $per_page,
912
-			'page'       => isset( $_GET['paged'] ) ? $_GET['paged'] : null,
911
+			'page'       => isset($_GET['paged']) ? $_GET['paged'] : null,
913 912
 			'orderby'    => $orderby,
914 913
 			'order'      => $order,
915 914
 			'user'       => $user,
@@ -926,9 +925,9 @@  discard block
 block discarded – undo
926 925
 			'give_forms' => $form_id,
927 926
 		);
928 927
 
929
-		if ( is_string( $search ) && false !== strpos( $search, 'txn:' ) ) {
928
+		if (is_string($search) && false !== strpos($search, 'txn:')) {
930 929
 			$args['search_in_notes'] = true;
931
-			$args['s']               = trim( str_replace( 'txn:', '', $args['s'] ) );
930
+			$args['s']               = trim(str_replace('txn:', '', $args['s']));
932 931
 		}
933 932
 
934 933
 		/**
@@ -936,9 +935,9 @@  discard block
 block discarded – undo
936 935
 		 *
937 936
 		 * @since 1.8.18
938 937
 		 */
939
-		$args = (array) apply_filters( 'give_payment_table_payments_query', $args );
938
+		$args = (array) apply_filters('give_payment_table_payments_query', $args);
940 939
 
941
-		$p_query = new Give_Payments_Query( $args );
940
+		$p_query = new Give_Payments_Query($args);
942 941
 
943 942
 		return $p_query->get_payments();
944 943
 
@@ -959,17 +958,17 @@  discard block
 block discarded – undo
959 958
 	 */
960 959
 	public function prepare_items() {
961 960
 
962
-		wp_reset_vars( array( 'action', 'payment', 'orderby', 'order', 's' ) );
961
+		wp_reset_vars(array('action', 'payment', 'orderby', 'order', 's'));
963 962
 
964 963
 		$columns  = $this->get_columns();
965 964
 		$hidden   = array(); // No hidden columns.
966 965
 		$sortable = $this->get_sortable_columns();
967 966
 		$data     = $this->payments_data();
968
-		$status   = isset( $_GET['status'] ) ? $_GET['status'] : 'any';
967
+		$status   = isset($_GET['status']) ? $_GET['status'] : 'any';
969 968
 
970
-		$this->_column_headers = array( $columns, $hidden, $sortable );
969
+		$this->_column_headers = array($columns, $hidden, $sortable);
971 970
 
972
-		switch ( $status ) {
971
+		switch ($status) {
973 972
 			case 'publish':
974 973
 				$total_items = $this->complete_count;
975 974
 				break;
@@ -1002,8 +1001,8 @@  discard block
 block discarded – undo
1002 1001
 				break;
1003 1002
 			default:
1004 1003
 				// Retrieve the count of the non-default-Give status.
1005
-				$count       = wp_count_posts( 'give_payment' );
1006
-				$total_items = isset( $count->{$status} ) ? $count->{$status} : 0;
1004
+				$count       = wp_count_posts('give_payment');
1005
+				$total_items = isset($count->{$status} ) ? $count->{$status} : 0;
1007 1006
 				break;
1008 1007
 		}
1009 1008
 
@@ -1014,7 +1013,7 @@  discard block
 block discarded – undo
1014 1013
 		 *
1015 1014
 		 * @since 1.8.19
1016 1015
 		 */
1017
-		$total_items = (int) apply_filters( 'give_payment_table_pagination_total_count', $total_items, $this );
1016
+		$total_items = (int) apply_filters('give_payment_table_pagination_total_count', $total_items, $this);
1018 1017
 
1019 1018
 		$this->set_pagination_args(
1020 1019
 			array(
@@ -1022,7 +1021,7 @@  discard block
 block discarded – undo
1022 1021
 				// We have to calculate the total number of items.
1023 1022
 				'per_page'    => $this->per_page,
1024 1023
 				// We have to determine how many items to show on a page.
1025
-				'total_pages' => ceil( $total_items / $this->per_page ),
1024
+				'total_pages' => ceil($total_items / $this->per_page),
1026 1025
 				// We have to calculate the total number of pages.
1027 1026
 			)
1028 1027
 		);
Please login to merge, or discard this patch.
includes/class-give-cache.php 1 patch
Spacing   +124 added lines, -124 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if accessed directly.
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	 * @return static
54 54
 	 */
55 55
 	public static function get_instance() {
56
-		if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Give_Cache ) ) {
56
+		if ( ! isset(self::$instance) && ! (self::$instance instanceof Give_Cache)) {
57 57
 			self::$instance = new Give_Cache();
58 58
 		}
59 59
 
@@ -68,17 +68,17 @@  discard block
 block discarded – undo
68 68
 	 */
69 69
 	public function setup() {
70 70
 		// Currently enable cache only for backend.
71
-		self::$instance->is_cache = ( defined( 'GIVE_CACHE' ) ? GIVE_CACHE : give_is_setting_enabled( give_get_option( 'cache', 'enabled' ) ) ) && is_admin();
71
+		self::$instance->is_cache = (defined('GIVE_CACHE') ? GIVE_CACHE : give_is_setting_enabled(give_get_option('cache', 'enabled'))) && is_admin();
72 72
 
73 73
 		// weekly delete all expired cache.
74
-		Give_Cron::add_weekly_event( array( $this, 'delete_all_expired' ) );
74
+		Give_Cron::add_weekly_event(array($this, 'delete_all_expired'));
75 75
 
76
-		add_action( 'save_post_give_forms', array( $this, 'delete_form_related_cache' ) );
77
-		add_action( 'save_post_give_payment', array( $this, 'delete_payment_related_cache' ) );
78
-		add_action( 'give_deleted_give-donors_cache', array( $this, 'delete_donor_related_cache' ), 10, 3 );
79
-		add_action( 'give_deleted_give-donations_cache', array( $this, 'delete_donations_related_cache' ), 10, 3 );
76
+		add_action('save_post_give_forms', array($this, 'delete_form_related_cache'));
77
+		add_action('save_post_give_payment', array($this, 'delete_payment_related_cache'));
78
+		add_action('give_deleted_give-donors_cache', array($this, 'delete_donor_related_cache'), 10, 3);
79
+		add_action('give_deleted_give-donations_cache', array($this, 'delete_donations_related_cache'), 10, 3);
80 80
 
81
-		add_action( 'give_save_settings_give_settings', array( $this, 'flush_cache' ) );
81
+		add_action('give_save_settings_give_settings', array($this, 'flush_cache'));
82 82
 	}
83 83
 
84 84
 	/**
@@ -92,18 +92,18 @@  discard block
 block discarded – undo
92 92
 	 *
93 93
 	 * @return string
94 94
 	 */
95
-	public static function get_key( $action, $query_args = null, $is_prefix = true ) {
95
+	public static function get_key($action, $query_args = null, $is_prefix = true) {
96 96
 		// Bailout.
97
-		if ( empty( $action ) ) {
98
-			return new WP_Error( 'give_invalid_cache_key_action', __( 'Do not pass empty action to generate cache key.', 'give' ) );
97
+		if (empty($action)) {
98
+			return new WP_Error('give_invalid_cache_key_action', __('Do not pass empty action to generate cache key.', 'give'));
99 99
 		}
100 100
 
101 101
 		// Set cache key.
102 102
 		$cache_key = $is_prefix ? "give_cache_{$action}" : $action;
103 103
 
104 104
 		// Bailout.
105
-		if ( ! empty( $query_args ) ) {
106
-			$cache_key = "{$cache_key}_" . substr( md5( serialize( $query_args ) ), 0, 15 );
105
+		if ( ! empty($query_args)) {
106
+			$cache_key = "{$cache_key}_".substr(md5(serialize($query_args)), 0, 15);
107 107
 		}
108 108
 
109 109
 		/**
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 		 *
112 112
 		 * @since 2.0
113 113
 		 */
114
-		return apply_filters( 'give_get_cache_key', $cache_key, $action, $query_args );
114
+		return apply_filters('give_get_cache_key', $cache_key, $action, $query_args);
115 115
 	}
116 116
 
117 117
 	/**
@@ -125,26 +125,26 @@  discard block
 block discarded – undo
125 125
 	 *
126 126
 	 * @return mixed
127 127
 	 */
128
-	public static function get( $cache_key, $custom_key = false, $query_args = array() ) {
129
-		if ( ! self::is_valid_cache_key( $cache_key ) ) {
130
-			if ( ! $custom_key ) {
131
-				return new WP_Error( 'give_invalid_cache_key', __( 'Cache key format should be give_cache_*', 'give' ) );
128
+	public static function get($cache_key, $custom_key = false, $query_args = array()) {
129
+		if ( ! self::is_valid_cache_key($cache_key)) {
130
+			if ( ! $custom_key) {
131
+				return new WP_Error('give_invalid_cache_key', __('Cache key format should be give_cache_*', 'give'));
132 132
 			}
133 133
 
134
-			$cache_key = self::get_key( $cache_key, $query_args );
134
+			$cache_key = self::get_key($cache_key, $query_args);
135 135
 		}
136 136
 
137
-		$option = get_option( $cache_key );
137
+		$option = get_option($cache_key);
138 138
 
139 139
 		// Backward compatibility (<1.8.7).
140
-		if ( ! is_array( $option ) || empty( $option ) || ! array_key_exists( 'expiration', $option ) ) {
140
+		if ( ! is_array($option) || empty($option) || ! array_key_exists('expiration', $option)) {
141 141
 			return $option;
142 142
 		}
143 143
 
144 144
 		// Get current time.
145
-		$current_time = current_time( 'timestamp', 1 );
145
+		$current_time = current_time('timestamp', 1);
146 146
 
147
-		if ( empty( $option['expiration'] ) || ( $current_time < $option['expiration'] ) ) {
147
+		if (empty($option['expiration']) || ($current_time < $option['expiration'])) {
148 148
 			$option = $option['data'];
149 149
 		} else {
150 150
 			$option = false;
@@ -166,23 +166,23 @@  discard block
 block discarded – undo
166 166
 	 *
167 167
 	 * @return mixed
168 168
 	 */
169
-	public static function set( $cache_key, $data, $expiration = null, $custom_key = false, $query_args = array() ) {
170
-		if ( ! self::is_valid_cache_key( $cache_key ) ) {
171
-			if ( ! $custom_key ) {
172
-				return new WP_Error( 'give_invalid_cache_key', __( 'Cache key format should be give_cache_*', 'give' ) );
169
+	public static function set($cache_key, $data, $expiration = null, $custom_key = false, $query_args = array()) {
170
+		if ( ! self::is_valid_cache_key($cache_key)) {
171
+			if ( ! $custom_key) {
172
+				return new WP_Error('give_invalid_cache_key', __('Cache key format should be give_cache_*', 'give'));
173 173
 			}
174 174
 
175
-			$cache_key = self::get_key( $cache_key, $query_args );
175
+			$cache_key = self::get_key($cache_key, $query_args);
176 176
 		}
177 177
 
178 178
 		$option_value = array(
179 179
 			'data'       => $data,
180
-			'expiration' => ! is_null( $expiration )
181
-				? ( $expiration + current_time( 'timestamp', 1 ) )
180
+			'expiration' => ! is_null($expiration)
181
+				? ($expiration + current_time('timestamp', 1))
182 182
 				: null,
183 183
 		);
184 184
 
185
-		$result = update_option( $cache_key, $option_value, 'no' );
185
+		$result = update_option($cache_key, $option_value, 'no');
186 186
 
187 187
 		return $result;
188 188
 	}
@@ -198,27 +198,27 @@  discard block
 block discarded – undo
198 198
 	 *
199 199
 	 * @return bool|WP_Error
200 200
 	 */
201
-	public static function delete( $cache_keys ) {
201
+	public static function delete($cache_keys) {
202 202
 		$result       = true;
203 203
 		$invalid_keys = array();
204 204
 
205
-		if ( ! empty( $cache_keys ) ) {
206
-			$cache_keys = is_array( $cache_keys ) ? $cache_keys : array( $cache_keys );
205
+		if ( ! empty($cache_keys)) {
206
+			$cache_keys = is_array($cache_keys) ? $cache_keys : array($cache_keys);
207 207
 
208
-			foreach ( $cache_keys as $cache_key ) {
209
-				if ( ! self::is_valid_cache_key( $cache_key ) ) {
208
+			foreach ($cache_keys as $cache_key) {
209
+				if ( ! self::is_valid_cache_key($cache_key)) {
210 210
 					$invalid_keys[] = $cache_key;
211 211
 					$result         = false;
212 212
 				}
213 213
 
214
-				delete_option( $cache_key );
214
+				delete_option($cache_key);
215 215
 			}
216 216
 		}
217 217
 
218
-		if ( ! $result ) {
218
+		if ( ! $result) {
219 219
 			$result = new WP_Error(
220 220
 				'give_invalid_cache_key',
221
-				__( 'Cache key format should be give_cache_*', 'give' ),
221
+				__('Cache key format should be give_cache_*', 'give'),
222 222
 				$invalid_keys
223 223
 			);
224 224
 		}
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 	 *
240 240
 	 * @return bool
241 241
 	 */
242
-	public static function delete_all_expired( $force = false ) {
242
+	public static function delete_all_expired($force = false) {
243 243
 		global $wpdb;
244 244
 		$options = $wpdb->get_results(
245 245
 			$wpdb->prepare(
@@ -253,30 +253,30 @@  discard block
 block discarded – undo
253 253
 		);
254 254
 
255 255
 		// Bailout.
256
-		if ( empty( $options ) ) {
256
+		if (empty($options)) {
257 257
 			return false;
258 258
 		}
259 259
 
260
-		$current_time = current_time( 'timestamp', 1 );
260
+		$current_time = current_time('timestamp', 1);
261 261
 
262 262
 		// Delete log cache.
263
-		foreach ( $options as $option ) {
264
-			$option['option_value'] = maybe_unserialize( $option['option_value'] );
263
+		foreach ($options as $option) {
264
+			$option['option_value'] = maybe_unserialize($option['option_value']);
265 265
 
266 266
 			if (
267 267
 				(
268
-					! self::is_valid_cache_key( $option['option_name'] )
269
-					|| ! is_array( $option['option_value'] ) // Backward compatibility (<1.8.7).
270
-					|| ! array_key_exists( 'expiration', $option['option_value'] ) // Backward compatibility (<1.8.7).
271
-					|| empty( $option['option_value']['expiration'] )
272
-					|| ( $current_time < $option['option_value']['expiration'] )
268
+					! self::is_valid_cache_key($option['option_name'])
269
+					|| ! is_array($option['option_value']) // Backward compatibility (<1.8.7).
270
+					|| ! array_key_exists('expiration', $option['option_value']) // Backward compatibility (<1.8.7).
271
+					|| empty($option['option_value']['expiration'])
272
+					|| ($current_time < $option['option_value']['expiration'])
273 273
 				)
274 274
 				&& ! $force
275 275
 			) {
276 276
 				continue;
277 277
 			}
278 278
 
279
-			self::delete( $option['option_name'] );
279
+			self::delete($option['option_name']);
280 280
 		}
281 281
 	}
282 282
 
@@ -294,12 +294,12 @@  discard block
 block discarded – undo
294 294
 	 *
295 295
 	 * @return array
296 296
 	 */
297
-	public static function get_options_like( $option_name, $fields = false ) {
297
+	public static function get_options_like($option_name, $fields = false) {
298 298
 		global $wpdb;
299 299
 
300 300
 		$field_names = $fields ? 'option_name, option_value' : 'option_name';
301 301
 
302
-		if ( $fields ) {
302
+		if ($fields) {
303 303
 			$options = $wpdb->get_results(
304 304
 				$wpdb->prepare(
305 305
 					"SELECT {$field_names }
@@ -323,10 +323,10 @@  discard block
 block discarded – undo
323 323
 			);
324 324
 		}
325 325
 
326
-		if ( ! empty( $options ) && $fields ) {
327
-			foreach ( $options as $index => $option ) {
328
-				$option['option_value'] = maybe_unserialize( $option['option_value'] );
329
-				$options[ $index ]      = $option;
326
+		if ( ! empty($options) && $fields) {
327
+			foreach ($options as $index => $option) {
328
+				$option['option_value'] = maybe_unserialize($option['option_value']);
329
+				$options[$index]      = $option;
330 330
 			}
331 331
 		}
332 332
 
@@ -343,8 +343,8 @@  discard block
 block discarded – undo
343 343
 	 *
344 344
 	 * @return bool
345 345
 	 */
346
-	public static function is_valid_cache_key( $cache_key ) {
347
-		$is_valid = ( false !== strpos( $cache_key, 'give_cache_' ) );
346
+	public static function is_valid_cache_key($cache_key) {
347
+		$is_valid = (false !== strpos($cache_key, 'give_cache_'));
348 348
 
349 349
 
350 350
 		/**
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 		 *
353 353
 		 * @since 2.0
354 354
 		 */
355
-		return apply_filters( 'give_is_valid_cache_key', $is_valid, $cache_key );
355
+		return apply_filters('give_is_valid_cache_key', $is_valid, $cache_key);
356 356
 	}
357 357
 
358 358
 
@@ -367,14 +367,14 @@  discard block
 block discarded – undo
367 367
 	 *
368 368
 	 * @return mixed
369 369
 	 */
370
-	public static function get_group( $id, $group = '' ) {
370
+	public static function get_group($id, $group = '') {
371 371
 		$cached_data = null;
372 372
 
373 373
 		// Bailout.
374
-		if ( self::$instance->is_cache && ! empty( $id ) ) {
375
-			$group = self::$instance->filter_group_name( $group );
374
+		if (self::$instance->is_cache && ! empty($id)) {
375
+			$group = self::$instance->filter_group_name($group);
376 376
 
377
-			$cached_data = wp_cache_get( $id, $group );
377
+			$cached_data = wp_cache_get($id, $group);
378 378
 			$cached_data = false !== $cached_data ? $cached_data : null;
379 379
 		}
380 380
 
@@ -394,17 +394,17 @@  discard block
 block discarded – undo
394 394
 	 *
395 395
 	 * @return bool
396 396
 	 */
397
-	public static function set_group( $id, $data, $group = '', $expire = 0 ) {
397
+	public static function set_group($id, $data, $group = '', $expire = 0) {
398 398
 		$status = false;
399 399
 
400 400
 		// Bailout.
401
-		if ( ! self::$instance->is_cache || empty( $id ) ) {
401
+		if ( ! self::$instance->is_cache || empty($id)) {
402 402
 			return $status;
403 403
 		}
404 404
 
405
-		$group = self::$instance->filter_group_name( $group );
405
+		$group = self::$instance->filter_group_name($group);
406 406
 
407
-		$status = wp_cache_set( $id, $data, $group, $expire );
407
+		$status = wp_cache_set($id, $data, $group, $expire);
408 408
 
409 409
 		return $status;
410 410
 	}
@@ -420,15 +420,15 @@  discard block
 block discarded – undo
420 420
 	 *
421 421
 	 * @return bool
422 422
 	 */
423
-	public static function set_db_query( $id, $data ) {
423
+	public static function set_db_query($id, $data) {
424 424
 		$status = false;
425 425
 
426 426
 		// Bailout.
427
-		if ( ! self::$instance->is_cache || empty( $id ) ) {
427
+		if ( ! self::$instance->is_cache || empty($id)) {
428 428
 			return $status;
429 429
 		}
430 430
 
431
-		return self::set_group( $id, $data, 'give-db-queries', 0 );
431
+		return self::set_group($id, $data, 'give-db-queries', 0);
432 432
 	}
433 433
 
434 434
 	/**
@@ -441,8 +441,8 @@  discard block
 block discarded – undo
441 441
 	 *
442 442
 	 * @return mixed
443 443
 	 */
444
-	public static function get_db_query( $id ) {
445
-		return self::get_group( $id, 'give-db-queries' );
444
+	public static function get_db_query($id) {
445
+		return self::get_group($id, 'give-db-queries');
446 446
 	}
447 447
 
448 448
 	/**
@@ -457,20 +457,20 @@  discard block
 block discarded – undo
457 457
 	 *
458 458
 	 * @return bool
459 459
 	 */
460
-	public static function delete_group( $ids, $group = '', $expire = 0 ) {
460
+	public static function delete_group($ids, $group = '', $expire = 0) {
461 461
 		$status = false;
462 462
 
463 463
 		// Bailout.
464
-		if ( ! self::$instance->is_cache || empty( $ids ) ) {
464
+		if ( ! self::$instance->is_cache || empty($ids)) {
465 465
 			return $status;
466 466
 		}
467 467
 
468
-		$group = self::$instance->filter_group_name( $group );
468
+		$group = self::$instance->filter_group_name($group);
469 469
 
470 470
 		// Delete single or multiple cache items from cache.
471
-		if ( ! is_array( $ids ) ) {
472
-			$status = wp_cache_delete( $ids, $group, $expire );
473
-			self::$instance->get_incrementer( true );
471
+		if ( ! is_array($ids)) {
472
+			$status = wp_cache_delete($ids, $group, $expire);
473
+			self::$instance->get_incrementer(true);
474 474
 
475 475
 			/**
476 476
 			 * Fire action when cache deleted for specific id.
@@ -481,12 +481,12 @@  discard block
 block discarded – undo
481 481
 			 * @param string $group
482 482
 			 * @param int    $expire
483 483
 			 */
484
-			do_action( "give_deleted_{$group}_cache", $ids, $group, $expire, $status );
484
+			do_action("give_deleted_{$group}_cache", $ids, $group, $expire, $status);
485 485
 
486 486
 		} else {
487
-			foreach ( $ids as $id ) {
488
-				$status = wp_cache_delete( $id, $group, $expire );
489
-				self::$instance->get_incrementer( true );
487
+			foreach ($ids as $id) {
488
+				$status = wp_cache_delete($id, $group, $expire);
489
+				self::$instance->get_incrementer(true);
490 490
 
491 491
 				/**
492 492
 				 * Fire action when cache deleted for specific id .
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
 				 * @param string $group
498 498
 				 * @param int    $expire
499 499
 				 */
500
-				do_action( "give_deleted_{$group}_cache", $id, $group, $expire, $status );
500
+				do_action("give_deleted_{$group}_cache", $id, $group, $expire, $status);
501 501
 			}
502 502
 		}
503 503
 
@@ -514,30 +514,30 @@  discard block
 block discarded – undo
514 514
 	 *
515 515
 	 * @param int $form_id
516 516
 	 */
517
-	public function delete_form_related_cache( $form_id ) {
517
+	public function delete_form_related_cache($form_id) {
518 518
 		// If this is just a revision, don't send the email.
519
-		if ( wp_is_post_revision( $form_id ) ) {
519
+		if (wp_is_post_revision($form_id)) {
520 520
 			return;
521 521
 		}
522 522
 
523 523
 		$donation_query = new Give_Payments_Query(
524 524
 			array(
525
-				'number'     => - 1,
525
+				'number'     => -1,
526 526
 				'give_forms' => $form_id,
527 527
 			)
528 528
 		);
529 529
 
530 530
 		$donations = $donation_query->get_payments();
531 531
 
532
-		if ( ! empty( $donations ) ) {
532
+		if ( ! empty($donations)) {
533 533
 			/* @var Give_Payment $donation */
534
-			foreach ( $donations as $donation ) {
535
-				wp_cache_delete( $donation->ID, $this->filter_group_name( 'give-donations' ) );
536
-				wp_cache_delete( $donation->donor_id, $this->filter_group_name( 'give-donors' ) );
534
+			foreach ($donations as $donation) {
535
+				wp_cache_delete($donation->ID, $this->filter_group_name('give-donations'));
536
+				wp_cache_delete($donation->donor_id, $this->filter_group_name('give-donors'));
537 537
 			}
538 538
 		}
539 539
 
540
-		self::$instance->get_incrementer( true );
540
+		self::$instance->get_incrementer(true);
541 541
 	}
542 542
 
543 543
 	/**
@@ -549,22 +549,22 @@  discard block
 block discarded – undo
549 549
 	 *
550 550
 	 * @param int $donation_id
551 551
 	 */
552
-	public function delete_payment_related_cache( $donation_id ) {
552
+	public function delete_payment_related_cache($donation_id) {
553 553
 		// If this is just a revision, don't send the email.
554
-		if ( wp_is_post_revision( $donation_id ) ) {
554
+		if (wp_is_post_revision($donation_id)) {
555 555
 			return;
556 556
 		}
557 557
 
558 558
 		/* @var Give_Payment $donation */
559
-		$donation = new Give_Payment( $donation_id );
559
+		$donation = new Give_Payment($donation_id);
560 560
 
561
-		if ( $donation && $donation->donor_id ) {
562
-			wp_cache_delete( $donation->donor_id, $this->filter_group_name( 'give-donors' ) );
561
+		if ($donation && $donation->donor_id) {
562
+			wp_cache_delete($donation->donor_id, $this->filter_group_name('give-donors'));
563 563
 		}
564 564
 
565
-		wp_cache_delete( $donation->ID, $this->filter_group_name( 'give-donations' ) );
565
+		wp_cache_delete($donation->ID, $this->filter_group_name('give-donations'));
566 566
 
567
-		self::$instance->get_incrementer( true );
567
+		self::$instance->get_incrementer(true);
568 568
 	}
569 569
 
570 570
 	/**
@@ -578,17 +578,17 @@  discard block
 block discarded – undo
578 578
 	 * @param string $group
579 579
 	 * @param int    $expire
580 580
 	 */
581
-	public function delete_donor_related_cache( $id, $group, $expire ) {
582
-		$donor        = new Give_Donor( $id );
583
-		$donation_ids = array_map( 'trim', (array) explode( ',', trim( $donor->payment_ids ) ) );
581
+	public function delete_donor_related_cache($id, $group, $expire) {
582
+		$donor        = new Give_Donor($id);
583
+		$donation_ids = array_map('trim', (array) explode(',', trim($donor->payment_ids)));
584 584
 
585
-		if ( ! empty( $donation_ids ) ) {
586
-			foreach ( $donation_ids as $donation ) {
587
-				wp_cache_delete( $donation, $this->filter_group_name( 'give-donations' ) );
585
+		if ( ! empty($donation_ids)) {
586
+			foreach ($donation_ids as $donation) {
587
+				wp_cache_delete($donation, $this->filter_group_name('give-donations'));
588 588
 			}
589 589
 		}
590 590
 
591
-		self::$instance->get_incrementer( true );
591
+		self::$instance->get_incrementer(true);
592 592
 	}
593 593
 
594 594
 	/**
@@ -602,15 +602,15 @@  discard block
 block discarded – undo
602 602
 	 * @param string $group
603 603
 	 * @param int    $expire
604 604
 	 */
605
-	public function delete_donations_related_cache( $id, $group, $expire ) {
605
+	public function delete_donations_related_cache($id, $group, $expire) {
606 606
 		/* @var Give_Payment $donation */
607
-		$donation = new Give_Payment( $id );
607
+		$donation = new Give_Payment($id);
608 608
 
609
-		if ( $donation && $donation->donor_id ) {
610
-			wp_cache_delete( $donation->donor_id, $this->filter_group_name( 'give-donors' ) );
609
+		if ($donation && $donation->donor_id) {
610
+			wp_cache_delete($donation->donor_id, $this->filter_group_name('give-donors'));
611 611
 		}
612 612
 
613
-		self::$instance->get_incrementer( true );
613
+		self::$instance->get_incrementer(true);
614 614
 	}
615 615
 
616 616
 
@@ -628,12 +628,12 @@  discard block
 block discarded – undo
628 628
 	 *
629 629
 	 * @return string
630 630
 	 */
631
-	private function get_incrementer( $refresh = false, $incrementer_key = 'give-cache-incrementer-db-queries' ) {
632
-		$incrementer_value = wp_cache_get( $incrementer_key );
631
+	private function get_incrementer($refresh = false, $incrementer_key = 'give-cache-incrementer-db-queries') {
632
+		$incrementer_value = wp_cache_get($incrementer_key);
633 633
 
634
-		if ( false === $incrementer_value || true === $refresh ) {
635
-			$incrementer_value = microtime( true );
636
-			wp_cache_set( $incrementer_key, $incrementer_value );
634
+		if (false === $incrementer_value || true === $refresh) {
635
+			$incrementer_value = microtime(true);
636
+			wp_cache_set($incrementer_key, $incrementer_value);
637 637
 		}
638 638
 
639 639
 		return $incrementer_value;
@@ -650,11 +650,11 @@  discard block
 block discarded – undo
650 650
 	public function flush_cache() {
651 651
 		if (
652 652
 			Give_Admin_Settings::is_saving_settings() &&
653
-			isset( $_POST['cache'] ) &&
654
-			give_is_setting_enabled( give_clean( $_POST['cache'] ) )
653
+			isset($_POST['cache']) &&
654
+			give_is_setting_enabled(give_clean($_POST['cache']))
655 655
 		) {
656
-			$this->get_incrementer( true );
657
-			$this->get_incrementer( true, 'give-cache-incrementer' );
656
+			$this->get_incrementer(true);
657
+			$this->get_incrementer(true, 'give-cache-incrementer');
658 658
 		}
659 659
 	}
660 660
 
@@ -669,11 +669,11 @@  discard block
 block discarded – undo
669 669
 	 *
670 670
 	 * @return mixed
671 671
 	 */
672
-	private function filter_group_name( $group ) {
673
-		if ( ! empty( $group ) ) {
674
-			$incrementer = self::$instance->get_incrementer( false, 'give-cache-incrementer' );
672
+	private function filter_group_name($group) {
673
+		if ( ! empty($group)) {
674
+			$incrementer = self::$instance->get_incrementer(false, 'give-cache-incrementer');
675 675
 
676
-			if ( 'give-db-queries' === $group ) {
676
+			if ('give-db-queries' === $group) {
677 677
 				$incrementer = self::$instance->get_incrementer();
678 678
 			}
679 679
 
Please login to merge, or discard this patch.
includes/payments/class-give-payment.php 1 patch
Spacing   +268 added lines, -269 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
 
@@ -395,13 +395,13 @@  discard block
 block discarded – undo
395 395
 	 *
396 396
 	 * @return mixed void|false
397 397
 	 */
398
-	public function __construct( $payment_id = false ) {
398
+	public function __construct($payment_id = false) {
399 399
 
400
-		if ( empty( $payment_id ) ) {
400
+		if (empty($payment_id)) {
401 401
 			return false;
402 402
 		}
403 403
 
404
-		$this->setup_payment( $payment_id );
404
+		$this->setup_payment($payment_id);
405 405
 	}
406 406
 
407 407
 	/**
@@ -414,11 +414,11 @@  discard block
 block discarded – undo
414 414
 	 *
415 415
 	 * @return mixed        The value.
416 416
 	 */
417
-	public function __get( $key ) {
417
+	public function __get($key) {
418 418
 
419
-		if ( method_exists( $this, 'get_' . $key ) ) {
419
+		if (method_exists($this, 'get_'.$key)) {
420 420
 
421
-			$value = call_user_func( array( $this, 'get_' . $key ) );
421
+			$value = call_user_func(array($this, 'get_'.$key));
422 422
 
423 423
 		} else {
424 424
 
@@ -440,18 +440,18 @@  discard block
 block discarded – undo
440 440
 	 * @param  string $key   The property name
441 441
 	 * @param  mixed  $value The value of the property
442 442
 	 */
443
-	public function __set( $key, $value ) {
444
-		$ignore = array( '_ID' );
443
+	public function __set($key, $value) {
444
+		$ignore = array('_ID');
445 445
 
446
-		if ( 'status' === $key ) {
446
+		if ('status' === $key) {
447 447
 			$this->old_status = $this->status;
448 448
 		}
449 449
 
450
-		if ( ! in_array( $key, $ignore ) ) {
451
-			$this->pending[ $key ] = $value;
450
+		if ( ! in_array($key, $ignore)) {
451
+			$this->pending[$key] = $value;
452 452
 		}
453 453
 
454
-		if ( '_ID' !== $key ) {
454
+		if ('_ID' !== $key) {
455 455
 			$this->$key = $value;
456 456
 		}
457 457
 	}
@@ -466,9 +466,9 @@  discard block
 block discarded – undo
466 466
 	 *
467 467
 	 * @return boolean|null       If the item is set or not
468 468
 	 */
469
-	public function __isset( $name ) {
470
-		if ( property_exists( $this, $name ) ) {
471
-			return false === empty( $this->$name );
469
+	public function __isset($name) {
470
+		if (property_exists($this, $name)) {
471
+			return false === empty($this->$name);
472 472
 		} else {
473 473
 			return null;
474 474
 		}
@@ -484,20 +484,20 @@  discard block
 block discarded – undo
484 484
 	 *
485 485
 	 * @return bool            If the setup was successful or not
486 486
 	 */
487
-	private function setup_payment( $payment_id ) {
487
+	private function setup_payment($payment_id) {
488 488
 		$this->pending = array();
489 489
 
490
-		if ( empty( $payment_id ) ) {
490
+		if (empty($payment_id)) {
491 491
 			return false;
492 492
 		}
493 493
 
494
-		$payment = get_post( absint( $payment_id ) );
494
+		$payment = get_post(absint($payment_id));
495 495
 
496
-		if ( ! $payment || is_wp_error( $payment ) ) {
496
+		if ( ! $payment || is_wp_error($payment)) {
497 497
 			return false;
498 498
 		}
499 499
 
500
-		if ( 'give_payment' !== $payment->post_type ) {
500
+		if ('give_payment' !== $payment->post_type) {
501 501
 			return false;
502 502
 		}
503 503
 
@@ -511,17 +511,17 @@  discard block
 block discarded – undo
511 511
 		 * @param Give_Payment $this       Payment object.
512 512
 		 * @param int          $payment_id The ID of the payment.
513 513
 		 */
514
-		do_action( 'give_pre_setup_payment', $this, $payment_id );
514
+		do_action('give_pre_setup_payment', $this, $payment_id);
515 515
 
516 516
 		// Get payment from cache.
517
-		$donation_vars = Give_Cache::get_group( $payment_id, 'give-donations' );
517
+		$donation_vars = Give_Cache::get_group($payment_id, 'give-donations');
518 518
 
519
-		if ( is_null( $donation_vars ) ) {
519
+		if (is_null($donation_vars)) {
520 520
 			// Primary Identifier.
521
-			$this->ID = absint( $payment_id );
521
+			$this->ID = absint($payment_id);
522 522
 
523 523
 			// Protected ID that can never be changed.
524
-			$this->_ID = absint( $payment_id );
524
+			$this->_ID = absint($payment_id);
525 525
 
526 526
 			// We have a payment, get the generic payment_meta item to reduce calls to it.
527 527
 			$this->payment_meta = $this->get_meta();
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
 			$this->parent_payment = $payment->post_parent;
538 538
 
539 539
 			$all_payment_statuses  = give_get_payment_statuses();
540
-			$this->status_nicename = array_key_exists( $this->status, $all_payment_statuses ) ? $all_payment_statuses[ $this->status ] : ucfirst( $this->status );
540
+			$this->status_nicename = array_key_exists($this->status, $all_payment_statuses) ? $all_payment_statuses[$this->status] : ucfirst($this->status);
541 541
 
542 542
 			// Currency Based.
543 543
 			$this->total    = $this->setup_total();
@@ -566,10 +566,10 @@  discard block
 block discarded – undo
566 566
 			$this->key        = $this->setup_payment_key();
567 567
 			$this->number     = $this->setup_payment_number();
568 568
 
569
-			Give_Cache::set_group( $this->ID, get_object_vars( $this ), 'give-donations' );
569
+			Give_Cache::set_group($this->ID, get_object_vars($this), 'give-donations');
570 570
 		} else {
571 571
 
572
-			foreach ( $donation_vars as $donation_var => $value ) {
572
+			foreach ($donation_vars as $donation_var => $value) {
573 573
 				$this->$donation_var = $value;
574 574
 			}
575 575
 		}
@@ -584,7 +584,7 @@  discard block
 block discarded – undo
584 584
 		 * @param Give_Payment $this       Payment object.
585 585
 		 * @param int          $payment_id The ID of the payment.
586 586
 		 */
587
-		do_action( 'give_setup_payment', $this, $payment_id );
587
+		do_action('give_setup_payment', $this, $payment_id);
588 588
 
589 589
 		return true;
590 590
 	}
@@ -603,11 +603,11 @@  discard block
 block discarded – undo
603 603
 	 *
604 604
 	 * @return void
605 605
 	 */
606
-	public function update_payment_setup( $payment_id ) {
606
+	public function update_payment_setup($payment_id) {
607 607
 		// Delete cache.
608
-		Give_Cache::delete_group( $this->ID,'give-donations' );
608
+		Give_Cache::delete_group($this->ID, 'give-donations');
609 609
 
610
-		$this->setup_payment( $payment_id );
610
+		$this->setup_payment($payment_id);
611 611
 	}
612 612
 
613 613
 	/**
@@ -622,24 +622,24 @@  discard block
 block discarded – undo
622 622
 
623 623
 		// Construct the payment title.
624 624
 		$payment_title = '';
625
-		if ( ! empty( $this->first_name ) && ! empty( $this->last_name ) ) {
626
-			$payment_title = $this->first_name . ' ' . $this->last_name;
627
-		} elseif ( ! empty( $this->first_name ) && empty( $this->last_name ) ) {
625
+		if ( ! empty($this->first_name) && ! empty($this->last_name)) {
626
+			$payment_title = $this->first_name.' '.$this->last_name;
627
+		} elseif ( ! empty($this->first_name) && empty($this->last_name)) {
628 628
 			$payment_title = $this->first_name;
629
-		} elseif ( ! empty( $this->email ) && is_email( $this->email ) ) {
629
+		} elseif ( ! empty($this->email) && is_email($this->email)) {
630 630
 			$payment_title = $this->email;
631 631
 		}
632 632
 
633 633
 		// Set Key.
634
-		if ( empty( $this->key ) ) {
634
+		if (empty($this->key)) {
635 635
 
636
-			$auth_key             = defined( 'AUTH_KEY' ) ? AUTH_KEY : '';
637
-			$this->key            = strtolower( md5( $this->email . date( 'Y-m-d H:i:s' ) . $auth_key . uniqid( 'give', true ) ) );  // Unique key
636
+			$auth_key             = defined('AUTH_KEY') ? AUTH_KEY : '';
637
+			$this->key            = strtolower(md5($this->email.date('Y-m-d H:i:s').$auth_key.uniqid('give', true))); // Unique key
638 638
 			$this->pending['key'] = $this->key;
639 639
 		}
640 640
 
641 641
 		// Set IP.
642
-		if ( empty( $this->ip ) ) {
642
+		if (empty($this->ip)) {
643 643
 
644 644
 			$this->ip            = give_get_ip();
645 645
 			$this->pending['ip'] = $this->ip;
@@ -668,19 +668,19 @@  discard block
 block discarded – undo
668 668
 			'status'       => $this->status,
669 669
 		);
670 670
 
671
-		$args = apply_filters( 'give_insert_payment_args', array(
671
+		$args = apply_filters('give_insert_payment_args', array(
672 672
 			'post_title'    => $payment_title,
673 673
 			'post_status'   => $this->status,
674 674
 			'post_type'     => 'give_payment',
675
-			'post_date'     => ! empty( $this->date ) ? $this->date : null,
676
-			'post_date_gmt' => ! empty( $this->date ) ? get_gmt_from_date( $this->date ) : null,
675
+			'post_date'     => ! empty($this->date) ? $this->date : null,
676
+			'post_date_gmt' => ! empty($this->date) ? get_gmt_from_date($this->date) : null,
677 677
 			'post_parent'   => $this->parent_payment,
678
-		), $payment_data );
678
+		), $payment_data);
679 679
 
680 680
 		// Create a blank payment
681
-		$payment_id = wp_insert_post( $args );
681
+		$payment_id = wp_insert_post($args);
682 682
 
683
-		if ( ! empty( $payment_id ) ) {
683
+		if ( ! empty($payment_id)) {
684 684
 
685 685
 			$this->ID  = $payment_id;
686 686
 			$this->_ID = $payment_id;
@@ -692,42 +692,42 @@  discard block
 block discarded – undo
692 692
 			 *
693 693
 			 * @since 1.8.13
694 694
 			 */
695
-			$donor = apply_filters( 'give_update_donor_information', $donor, $payment_id, $payment_data, $args );
695
+			$donor = apply_filters('give_update_donor_information', $donor, $payment_id, $payment_data, $args);
696 696
 
697
-			if ( did_action( 'give_pre_process_donation' ) && is_user_logged_in() ) {
698
-				$donor = new Give_Donor( get_current_user_id(), true );
697
+			if (did_action('give_pre_process_donation') && is_user_logged_in()) {
698
+				$donor = new Give_Donor(get_current_user_id(), true);
699 699
 
700 700
 				// Donor is logged in but used a different email to purchase with so assign to their donor record.
701
-				if ( ! empty( $donor->id ) && $this->email !== $donor->email ) {
702
-					$donor->add_email( $this->email );
701
+				if ( ! empty($donor->id) && $this->email !== $donor->email) {
702
+					$donor->add_email($this->email);
703 703
 				}
704 704
 			}
705 705
 
706
-			if ( empty( $donor->id ) ) {
707
-				$donor = new Give_Donor( $this->email );
706
+			if (empty($donor->id)) {
707
+				$donor = new Give_Donor($this->email);
708 708
 			}
709 709
 
710
-			if ( empty( $donor->id ) ) {
710
+			if (empty($donor->id)) {
711 711
 
712 712
 				$donor_data = array(
713
-					'name'    => ! is_email( $payment_title ) ? $this->first_name . ' ' . $this->last_name : '',
713
+					'name'    => ! is_email($payment_title) ? $this->first_name.' '.$this->last_name : '',
714 714
 					'email'   => $this->email,
715 715
 					'user_id' => $this->user_id,
716 716
 				);
717 717
 
718
-				$donor->create( $donor_data );
718
+				$donor->create($donor_data);
719 719
 
720 720
 			}
721 721
 
722 722
 			// Update Donor Meta once donor is created.
723
-			$donor->update_meta( '_give_donor_first_name', $this->first_name );
724
-			$donor->update_meta( '_give_donor_last_name', $this->last_name );
723
+			$donor->update_meta('_give_donor_first_name', $this->first_name);
724
+			$donor->update_meta('_give_donor_last_name', $this->last_name);
725 725
 
726 726
 			$this->customer_id            = $donor->id;
727 727
 			$this->pending['customer_id'] = $this->customer_id;
728
-			$donor->attach_payment( $this->ID, false );
728
+			$donor->attach_payment($this->ID, false);
729 729
 
730
-			$this->payment_meta = apply_filters( 'give_payment_meta', $this->payment_meta, $payment_data );
730
+			$this->payment_meta = apply_filters('give_payment_meta', $this->payment_meta, $payment_data);
731 731
 
732 732
 			/*
733 733
 			 * _give_payment_meta backward compatibility.
@@ -735,14 +735,14 @@  discard block
 block discarded – undo
735 735
 			 * @since 2.0.1
736 736
 			 */
737 737
 			$custom_payment_meta = array_diff(
738
-				array_map( 'maybe_serialize', $this->payment_meta ),
739
-				array_map( 'maybe_serialize', $payment_data )
738
+				array_map('maybe_serialize', $this->payment_meta),
739
+				array_map('maybe_serialize', $payment_data)
740 740
 			);
741 741
 
742
-			if( ! empty( $custom_payment_meta ) ) {
743
-				give_doing_it_wrong( '_give_payment_meta', __( 'This custom meta key deprecated. We are not using this meta key for storing payment meta but your custom meta data will be store because we added backward compatibility. Please change your logic because in future we can remove it.', 'give' ), '2.0.0' );
742
+			if ( ! empty($custom_payment_meta)) {
743
+				give_doing_it_wrong('_give_payment_meta', __('This custom meta key deprecated. We are not using this meta key for storing payment meta but your custom meta data will be store because we added backward compatibility. Please change your logic because in future we can remove it.', 'give'), '2.0.0');
744 744
 
745
-				$this->update_meta( '_give_payment_meta', array_map( 'maybe_unserialize', $custom_payment_meta ) );
745
+				$this->update_meta('_give_payment_meta', array_map('maybe_unserialize', $custom_payment_meta));
746 746
 			}
747 747
 
748 748
 			$this->new = true;
@@ -765,11 +765,11 @@  discard block
 block discarded – undo
765 765
 		$saved = false;
766 766
 
767 767
 		// Must have an ID.
768
-		if ( empty( $this->ID ) ) {
768
+		if (empty($this->ID)) {
769 769
 
770 770
 			$payment_id = $this->insert_payment();
771 771
 
772
-			if ( false === $payment_id ) {
772
+			if (false === $payment_id) {
773 773
 				$saved = false;
774 774
 			} else {
775 775
 				$this->ID = $payment_id;
@@ -777,42 +777,42 @@  discard block
 block discarded – undo
777 777
 		}
778 778
 
779 779
 		// Set ID if not matching.
780
-		if ( $this->ID !== $this->_ID ) {
780
+		if ($this->ID !== $this->_ID) {
781 781
 			$this->ID = $this->_ID;
782 782
 		}
783 783
 
784 784
 		// If we have something pending, let's save it.
785
-		if ( ! empty( $this->pending ) ) {
785
+		if ( ! empty($this->pending)) {
786 786
 
787 787
 			$total_increase = 0;
788 788
 			$total_decrease = 0;
789 789
 
790
-			foreach ( $this->pending as $key => $value ) {
790
+			foreach ($this->pending as $key => $value) {
791 791
 
792
-				switch ( $key ) {
792
+				switch ($key) {
793 793
 
794 794
 					case 'donations':
795 795
 						// Update totals for pending donations.
796
-						foreach ( $this->pending[ $key ] as $item ) {
796
+						foreach ($this->pending[$key] as $item) {
797 797
 
798
-							$quantity = isset( $item['quantity'] ) ? $item['quantity'] : 1;
799
-							$price_id = isset( $item['price_id'] ) ? $item['price_id'] : 0;
798
+							$quantity = isset($item['quantity']) ? $item['quantity'] : 1;
799
+							$price_id = isset($item['price_id']) ? $item['price_id'] : 0;
800 800
 
801
-							switch ( $item['action'] ) {
801
+							switch ($item['action']) {
802 802
 
803 803
 								case 'add':
804 804
 
805 805
 									$price = $item['price'];
806 806
 
807
-									if ( 'publish' === $this->status || 'complete' === $this->status ) {
807
+									if ('publish' === $this->status || 'complete' === $this->status) {
808 808
 
809 809
 										// Add donation to logs.
810
-										$log_date = date_i18n( 'Y-m-d G:i:s', current_time( 'timestamp' ) );
811
-										give_record_donation_in_log( $item['id'], $this->ID, $price_id, $log_date );
810
+										$log_date = date_i18n('Y-m-d G:i:s', current_time('timestamp'));
811
+										give_record_donation_in_log($item['id'], $this->ID, $price_id, $log_date);
812 812
 
813
-										$form = new Give_Donate_Form( $item['id'] );
814
-										$form->increase_sales( $quantity );
815
-										$form->increase_earnings( $price );
813
+										$form = new Give_Donate_Form($item['id']);
814
+										$form->increase_sales($quantity);
815
+										$form->increase_earnings($price);
816 816
 
817 817
 										$total_increase += $price;
818 818
 									}
@@ -820,10 +820,10 @@  discard block
 block discarded – undo
820 820
 
821 821
 								case 'remove':
822 822
 									$this->delete_sales_logs();
823
-									if ( 'publish' === $this->status || 'complete' === $this->status ) {
824
-										$form = new Give_Donate_Form( $item['id'] );
825
-										$form->decrease_sales( $quantity );
826
-										$form->decrease_earnings( $item['amount'] );
823
+									if ('publish' === $this->status || 'complete' === $this->status) {
824
+										$form = new Give_Donate_Form($item['id']);
825
+										$form->decrease_sales($quantity);
826
+										$form->decrease_earnings($item['amount']);
827 827
 
828 828
 										$total_decrease += $item['amount'];
829 829
 									}
@@ -834,27 +834,27 @@  discard block
 block discarded – undo
834 834
 						break;
835 835
 
836 836
 					case 'status':
837
-						$this->update_status( $this->status );
837
+						$this->update_status($this->status);
838 838
 						break;
839 839
 
840 840
 					case 'gateway':
841
-						$this->update_meta( '_give_payment_gateway', $this->gateway );
841
+						$this->update_meta('_give_payment_gateway', $this->gateway);
842 842
 						break;
843 843
 
844 844
 					case 'mode':
845
-						$this->update_meta( '_give_payment_mode', $this->mode );
845
+						$this->update_meta('_give_payment_mode', $this->mode);
846 846
 						break;
847 847
 
848 848
 					case 'transaction_id':
849
-						$this->update_meta( '_give_payment_transaction_id', $this->transaction_id );
849
+						$this->update_meta('_give_payment_transaction_id', $this->transaction_id);
850 850
 						break;
851 851
 
852 852
 					case 'ip':
853
-						$this->update_meta( '_give_payment_donor_ip', $this->ip );
853
+						$this->update_meta('_give_payment_donor_ip', $this->ip);
854 854
 						break;
855 855
 
856 856
 					case 'customer_id':
857
-						$this->update_meta( '_give_payment_donor_id', $this->customer_id );
857
+						$this->update_meta('_give_payment_donor_id', $this->customer_id);
858 858
 						break;
859 859
 
860 860
 					// case 'user_id':
@@ -862,58 +862,58 @@  discard block
 block discarded – undo
862 862
 					// 	break;
863 863
 
864 864
 					case 'form_title':
865
-						$this->update_meta( '_give_payment_form_title', $this->form_title );
865
+						$this->update_meta('_give_payment_form_title', $this->form_title);
866 866
 						break;
867 867
 
868 868
 					case 'form_id':
869
-						$this->update_meta( '_give_payment_form_id', $this->form_id );
869
+						$this->update_meta('_give_payment_form_id', $this->form_id);
870 870
 						break;
871 871
 
872 872
 					case 'price_id':
873
-						$this->update_meta( '_give_payment_price_id', $this->price_id );
873
+						$this->update_meta('_give_payment_price_id', $this->price_id);
874 874
 						break;
875 875
 
876 876
 					case 'first_name':
877
-						$this->update_meta( '_give_donor_billing_first_name', $this->first_name );
877
+						$this->update_meta('_give_donor_billing_first_name', $this->first_name);
878 878
 						break;
879 879
 
880 880
 					case 'last_name':
881
-						$this->update_meta( '_give_donor_billing_last_name', $this->last_name );
881
+						$this->update_meta('_give_donor_billing_last_name', $this->last_name);
882 882
 						break;
883 883
 
884 884
 					case 'currency':
885
-						$this->update_meta( '_give_payment_currency', $this->currency );
885
+						$this->update_meta('_give_payment_currency', $this->currency);
886 886
 						break;
887 887
 
888 888
 					case 'address':
889
-						if ( ! empty( $this->address ) ) {
890
-							foreach ( $this->address as $address_name => $address ) {
891
-								switch ( $address_name ) {
889
+						if ( ! empty($this->address)) {
890
+							foreach ($this->address as $address_name => $address) {
891
+								switch ($address_name) {
892 892
 									case 'line1':
893
-										$this->update_meta( '_give_donor_billing_address1', $address );
893
+										$this->update_meta('_give_donor_billing_address1', $address);
894 894
 										break;
895 895
 
896 896
 									case 'line2':
897
-										$this->update_meta( '_give_donor_billing_address2', $address );
897
+										$this->update_meta('_give_donor_billing_address2', $address);
898 898
 										break;
899 899
 
900 900
 									default:
901
-										$this->update_meta( "_give_donor_billing_{$address_name}", $address );
901
+										$this->update_meta("_give_donor_billing_{$address_name}", $address);
902 902
 								}
903 903
 							}
904 904
 						}
905 905
 						break;
906 906
 
907 907
 					case 'email':
908
-						$this->update_meta( '_give_payment_donor_email', $this->email );
908
+						$this->update_meta('_give_payment_donor_email', $this->email);
909 909
 						break;
910 910
 
911 911
 					case 'key':
912
-						$this->update_meta( '_give_payment_purchase_key', $this->key );
912
+						$this->update_meta('_give_payment_purchase_key', $this->key);
913 913
 						break;
914 914
 
915 915
 					case 'number':
916
-						$this->update_meta( '_give_payment_number', $this->number );
916
+						$this->update_meta('_give_payment_number', $this->number);
917 917
 						break;
918 918
 
919 919
 					case 'date':
@@ -923,11 +923,11 @@  discard block
 block discarded – undo
923 923
 							'edit_date' => true,
924 924
 						);
925 925
 
926
-						wp_update_post( $args );
926
+						wp_update_post($args);
927 927
 						break;
928 928
 
929 929
 					case 'completed_date':
930
-						$this->update_meta( '_give_completed_date', $this->completed_date );
930
+						$this->update_meta('_give_completed_date', $this->completed_date);
931 931
 						break;
932 932
 
933 933
 					case 'parent_payment':
@@ -936,7 +936,7 @@  discard block
 block discarded – undo
936 936
 							'post_parent' => $this->parent_payment,
937 937
 						);
938 938
 
939
-						wp_update_post( $args );
939
+						wp_update_post($args);
940 940
 						break;
941 941
 
942 942
 					default:
@@ -947,40 +947,40 @@  discard block
 block discarded – undo
947 947
 						 *
948 948
 						 * @param Give_Payment $this Payment object.
949 949
 						 */
950
-						do_action( 'give_payment_save', $this, $key );
950
+						do_action('give_payment_save', $this, $key);
951 951
 						break;
952 952
 				}// End switch().
953 953
 			}// End foreach().
954 954
 
955
-			if ( 'pending' !== $this->status ) {
955
+			if ('pending' !== $this->status) {
956 956
 
957
-				$donor = new Give_Donor( $this->customer_id );
957
+				$donor = new Give_Donor($this->customer_id);
958 958
 
959 959
 				$total_change = $total_increase - $total_decrease;
960
-				if ( $total_change < 0 ) {
960
+				if ($total_change < 0) {
961 961
 
962
-					$total_change = - ( $total_change );
962
+					$total_change = - ($total_change);
963 963
 					// Decrease the donor's donation stats.
964
-					$donor->decrease_value( $total_change );
965
-					give_decrease_total_earnings( $total_change );
964
+					$donor->decrease_value($total_change);
965
+					give_decrease_total_earnings($total_change);
966 966
 
967
-				} elseif ( $total_change > 0 ) {
967
+				} elseif ($total_change > 0) {
968 968
 
969 969
 					// Increase the donor's donation stats.
970
-					$donor->increase_value( $total_change );
971
-					give_increase_total_earnings( $total_change );
970
+					$donor->increase_value($total_change);
971
+					give_increase_total_earnings($total_change);
972 972
 
973 973
 				}
974 974
 			}
975 975
 
976
-			$this->update_meta( '_give_payment_total', give_sanitize_amount_for_db( $this->total ) );
976
+			$this->update_meta('_give_payment_total', give_sanitize_amount_for_db($this->total));
977 977
 
978 978
 			$this->pending = array();
979 979
 			$saved         = true;
980 980
 		}// End if().
981 981
 
982
-		if ( true === $saved ) {
983
-			$this->setup_payment( $this->ID );
982
+		if (true === $saved) {
983
+			$this->setup_payment($this->ID);
984 984
 		}
985 985
 
986 986
 		return $saved;
@@ -998,12 +998,12 @@  discard block
 block discarded – undo
998 998
 	 *
999 999
 	 * @return bool           True when successful, false otherwise
1000 1000
 	 */
1001
-	public function add_donation( $form_id = 0, $args = array(), $options = array() ) {
1001
+	public function add_donation($form_id = 0, $args = array(), $options = array()) {
1002 1002
 
1003
-		$donation = new Give_Donate_Form( $form_id );
1003
+		$donation = new Give_Donate_Form($form_id);
1004 1004
 
1005 1005
 		// Bail if this post isn't a give donation form.
1006
-		if ( ! $donation || $donation->post_type !== 'give_forms' ) {
1006
+		if ( ! $donation || $donation->post_type !== 'give_forms') {
1007 1007
 			return false;
1008 1008
 		}
1009 1009
 
@@ -1013,59 +1013,59 @@  discard block
 block discarded – undo
1013 1013
 			'price_id' => false,
1014 1014
 		);
1015 1015
 
1016
-		$args = wp_parse_args( apply_filters( 'give_payment_add_donation_args', $args, $donation->ID ), $defaults );
1016
+		$args = wp_parse_args(apply_filters('give_payment_add_donation_args', $args, $donation->ID), $defaults);
1017 1017
 
1018 1018
 		// Allow overriding the price.
1019
-		if ( false !== $args['price'] ) {
1019
+		if (false !== $args['price']) {
1020 1020
 			$donation_amount = $args['price'];
1021 1021
 		} else {
1022 1022
 
1023 1023
 			// Deal with variable pricing.
1024
-			if ( give_has_variable_prices( $donation->ID ) ) {
1025
-				$prices          = give_get_meta( $form_id, '_give_donation_levels', true );
1024
+			if (give_has_variable_prices($donation->ID)) {
1025
+				$prices          = give_get_meta($form_id, '_give_donation_levels', true);
1026 1026
 				$donation_amount = '';
1027 1027
 				// Loop through prices.
1028
-				foreach ( $prices as $price ) {
1028
+				foreach ($prices as $price) {
1029 1029
 					// Find a match between price_id and level_id.
1030 1030
 					// First verify array keys exists THEN make the match.
1031
-					if ( ( isset( $args['price_id'] ) && isset( $price['_give_id']['level_id'] ) )
1031
+					if ((isset($args['price_id']) && isset($price['_give_id']['level_id']))
1032 1032
 					     && $args['price_id'] == $price['_give_id']['level_id']
1033 1033
 					) {
1034 1034
 						$donation_amount = $price['_give_amount'];
1035 1035
 					}
1036 1036
 				}
1037 1037
 				// Fallback to the lowest price point.
1038
-				if ( $donation_amount == '' ) {
1039
-					$donation_amount  = give_get_lowest_price_option( $donation->ID );
1040
-					$args['price_id'] = give_get_lowest_price_id( $donation->ID );
1038
+				if ($donation_amount == '') {
1039
+					$donation_amount  = give_get_lowest_price_option($donation->ID);
1040
+					$args['price_id'] = give_get_lowest_price_id($donation->ID);
1041 1041
 				}
1042 1042
 			} else {
1043 1043
 				// Simple form price.
1044
-				$donation_amount = give_get_form_price( $donation->ID );
1044
+				$donation_amount = give_get_form_price($donation->ID);
1045 1045
 			}
1046 1046
 		}
1047 1047
 
1048 1048
 		// Sanitizing the price here so we don't have a dozen calls later.
1049
-		$donation_amount = give_maybe_sanitize_amount( $donation_amount );
1050
-		$total           = round( $donation_amount, give_get_price_decimals( $this->ID ) );
1049
+		$donation_amount = give_maybe_sanitize_amount($donation_amount);
1050
+		$total           = round($donation_amount, give_get_price_decimals($this->ID));
1051 1051
 
1052 1052
 		// Add Options.
1053 1053
 		$default_options = array();
1054
-		if ( false !== $args['price_id'] ) {
1054
+		if (false !== $args['price_id']) {
1055 1055
 			$default_options['price_id'] = (int) $args['price_id'];
1056 1056
 		}
1057
-		$options = wp_parse_args( $options, $default_options );
1057
+		$options = wp_parse_args($options, $default_options);
1058 1058
 
1059 1059
 		// Do not allow totals to go negative.
1060
-		if ( $total < 0 ) {
1060
+		if ($total < 0) {
1061 1061
 			$total = 0;
1062 1062
 		}
1063 1063
 
1064 1064
 		$donation = array(
1065 1065
 			'name'     => $donation->post_title,
1066 1066
 			'id'       => $donation->ID,
1067
-			'price'    => round( $total, give_get_price_decimals( $this->ID ) ),
1068
-			'subtotal' => round( $total, give_get_price_decimals( $this->ID ) ),
1067
+			'price'    => round($total, give_get_price_decimals($this->ID)),
1068
+			'subtotal' => round($total, give_get_price_decimals($this->ID)),
1069 1069
 			'price_id' => $args['price_id'],
1070 1070
 			'action'   => 'add',
1071 1071
 			'options'  => $options,
@@ -1073,7 +1073,7 @@  discard block
 block discarded – undo
1073 1073
 
1074 1074
 		$this->pending['donations'][] = $donation;
1075 1075
 
1076
-		$this->increase_subtotal( $total );
1076
+		$this->increase_subtotal($total);
1077 1077
 
1078 1078
 		return true;
1079 1079
 
@@ -1090,7 +1090,7 @@  discard block
 block discarded – undo
1090 1090
 	 *
1091 1091
 	 * @return bool           If the item was removed or not
1092 1092
 	 */
1093
-	public function remove_donation( $form_id, $args = array() ) {
1093
+	public function remove_donation($form_id, $args = array()) {
1094 1094
 
1095 1095
 		// Set some defaults.
1096 1096
 		$defaults = array(
@@ -1098,12 +1098,12 @@  discard block
 block discarded – undo
1098 1098
 			'price'    => false,
1099 1099
 			'price_id' => false,
1100 1100
 		);
1101
-		$args     = wp_parse_args( $args, $defaults );
1101
+		$args = wp_parse_args($args, $defaults);
1102 1102
 
1103
-		$form = new Give_Donate_Form( $form_id );
1103
+		$form = new Give_Donate_Form($form_id);
1104 1104
 
1105 1105
 		// Bail if this post isn't a valid give donation form.
1106
-		if ( ! $form || $form->post_type !== 'give_forms' ) {
1106
+		if ( ! $form || $form->post_type !== 'give_forms') {
1107 1107
 			return false;
1108 1108
 		}
1109 1109
 
@@ -1116,7 +1116,7 @@  discard block
 block discarded – undo
1116 1116
 
1117 1117
 		$this->pending['donations'][] = $pending_args;
1118 1118
 
1119
-		$this->decrease_subtotal( $this->total );
1119
+		$this->decrease_subtotal($this->total);
1120 1120
 
1121 1121
 		return true;
1122 1122
 	}
@@ -1132,13 +1132,13 @@  discard block
 block discarded – undo
1132 1132
 	 *
1133 1133
 	 * @return bool           If the note was specified or not
1134 1134
 	 */
1135
-	public function add_note( $note = false ) {
1135
+	public function add_note($note = false) {
1136 1136
 		// Bail if no note specified.
1137
-		if ( ! $note ) {
1137
+		if ( ! $note) {
1138 1138
 			return false;
1139 1139
 		}
1140 1140
 
1141
-		give_insert_payment_note( $this->ID, $note );
1141
+		give_insert_payment_note($this->ID, $note);
1142 1142
 	}
1143 1143
 
1144 1144
 	/**
@@ -1151,8 +1151,8 @@  discard block
 block discarded – undo
1151 1151
 	 *
1152 1152
 	 * @return void
1153 1153
 	 */
1154
-	private function increase_subtotal( $amount = 0.00 ) {
1155
-		$amount         = (float) $amount;
1154
+	private function increase_subtotal($amount = 0.00) {
1155
+		$amount = (float) $amount;
1156 1156
 		$this->subtotal += $amount;
1157 1157
 
1158 1158
 		$this->recalculate_total();
@@ -1168,11 +1168,11 @@  discard block
 block discarded – undo
1168 1168
 	 *
1169 1169
 	 * @return void
1170 1170
 	 */
1171
-	private function decrease_subtotal( $amount = 0.00 ) {
1172
-		$amount         = (float) $amount;
1171
+	private function decrease_subtotal($amount = 0.00) {
1172
+		$amount = (float) $amount;
1173 1173
 		$this->subtotal -= $amount;
1174 1174
 
1175
-		if ( $this->subtotal < 0 ) {
1175
+		if ($this->subtotal < 0) {
1176 1176
 			$this->subtotal = 0;
1177 1177
 		}
1178 1178
 
@@ -1201,24 +1201,24 @@  discard block
 block discarded – undo
1201 1201
 	 *
1202 1202
 	 * @return bool   $updated Returns if the status was successfully updated.
1203 1203
 	 */
1204
-	public function update_status( $status = false ) {
1204
+	public function update_status($status = false) {
1205 1205
 
1206 1206
 		// standardize the 'complete(d)' status.
1207
-		if ( $status == 'completed' || $status == 'complete' ) {
1207
+		if ($status == 'completed' || $status == 'complete') {
1208 1208
 			$status = 'publish';
1209 1209
 		}
1210 1210
 
1211
-		$old_status = ! empty( $this->old_status ) ? $this->old_status : false;
1211
+		$old_status = ! empty($this->old_status) ? $this->old_status : false;
1212 1212
 
1213
-		if ( $old_status === $status ) {
1213
+		if ($old_status === $status) {
1214 1214
 			return false; // Don't permit status changes that aren't changes.
1215 1215
 		}
1216 1216
 
1217
-		$do_change = apply_filters( 'give_should_update_payment_status', true, $this->ID, $status, $old_status );
1217
+		$do_change = apply_filters('give_should_update_payment_status', true, $this->ID, $status, $old_status);
1218 1218
 
1219 1219
 		$updated = false;
1220 1220
 
1221
-		if ( $do_change ) {
1221
+		if ($do_change) {
1222 1222
 
1223 1223
 			/**
1224 1224
 			 * Fires before changing payment status.
@@ -1229,21 +1229,21 @@  discard block
 block discarded – undo
1229 1229
 			 * @param string $status     The new status.
1230 1230
 			 * @param string $old_status The old status.
1231 1231
 			 */
1232
-			do_action( 'give_before_payment_status_change', $this->ID, $status, $old_status );
1232
+			do_action('give_before_payment_status_change', $this->ID, $status, $old_status);
1233 1233
 
1234 1234
 			$update_fields = array(
1235 1235
 				'ID'          => $this->ID,
1236 1236
 				'post_status' => $status,
1237
-				'edit_date'   => current_time( 'mysql' ),
1237
+				'edit_date'   => current_time('mysql'),
1238 1238
 			);
1239 1239
 
1240
-			$updated = wp_update_post( apply_filters( 'give_update_payment_status_fields', $update_fields ) );
1240
+			$updated = wp_update_post(apply_filters('give_update_payment_status_fields', $update_fields));
1241 1241
 
1242 1242
 			$all_payment_statuses  = give_get_payment_statuses();
1243
-			$this->status_nicename = array_key_exists( $status, $all_payment_statuses ) ? $all_payment_statuses[ $status ] : ucfirst( $status );
1243
+			$this->status_nicename = array_key_exists($status, $all_payment_statuses) ? $all_payment_statuses[$status] : ucfirst($status);
1244 1244
 
1245 1245
 			// Process any specific status functions.
1246
-			$this->process_status( $status );
1246
+			$this->process_status($status);
1247 1247
 
1248 1248
 			/**
1249 1249
 			 * Fires after changing payment status.
@@ -1254,7 +1254,7 @@  discard block
 block discarded – undo
1254 1254
 			 * @param string $status     The new status.
1255 1255
 			 * @param string $old_status The old status.
1256 1256
 			 */
1257
-			do_action( 'give_update_payment_status', $this->ID, $status, $old_status );
1257
+			do_action('give_update_payment_status', $this->ID, $status, $old_status);
1258 1258
 
1259 1259
 		}// End if().
1260 1260
 
@@ -1289,24 +1289,24 @@  discard block
 block discarded – undo
1289 1289
 	 *
1290 1290
 	 * @return mixed             The value from the post meta
1291 1291
 	 */
1292
-	public function get_meta( $meta_key = '_give_payment_meta', $single = true ) {
1293
-		if( ! has_filter( 'get_post_metadata', 'give_bc_v20_get_payment_meta' ) && ! doing_filter( 'get_post_metadata' ) ) {
1294
-			add_filter( 'get_post_metadata', 'give_bc_v20_get_payment_meta', 999, 4 );
1292
+	public function get_meta($meta_key = '_give_payment_meta', $single = true) {
1293
+		if ( ! has_filter('get_post_metadata', 'give_bc_v20_get_payment_meta') && ! doing_filter('get_post_metadata')) {
1294
+			add_filter('get_post_metadata', 'give_bc_v20_get_payment_meta', 999, 4);
1295 1295
 		}
1296 1296
 
1297
-		$meta = give_get_meta( $this->ID, $meta_key, $single );
1297
+		$meta = give_get_meta($this->ID, $meta_key, $single);
1298 1298
 
1299 1299
 		/**
1300 1300
 		 * Filter the specific meta key value.
1301 1301
 		 *
1302 1302
 		 * @since 1.5
1303 1303
 		 */
1304
-		$meta = apply_filters( "give_get_payment_meta_{$meta_key}", $meta, $this->ID );
1304
+		$meta = apply_filters("give_get_payment_meta_{$meta_key}", $meta, $this->ID);
1305 1305
 
1306 1306
 		// Security check.
1307
-		if ( is_serialized( $meta ) ) {
1308
-			preg_match( '/[oO]\s*:\s*\d+\s*:\s*"\s*(?!(?i)(stdClass))/', $meta, $matches );
1309
-			if ( ! empty( $matches ) ) {
1307
+		if (is_serialized($meta)) {
1308
+			preg_match('/[oO]\s*:\s*\d+\s*:\s*"\s*(?!(?i)(stdClass))/', $meta, $matches);
1309
+			if ( ! empty($matches)) {
1310 1310
 				$meta = array();
1311 1311
 			}
1312 1312
 		}
@@ -1316,7 +1316,7 @@  discard block
 block discarded – undo
1316 1316
 		 *
1317 1317
 		 * @since 1.5
1318 1318
 		 */
1319
-		return apply_filters( 'give_get_payment_meta', $meta, $this->ID, $meta_key );
1319
+		return apply_filters('give_get_payment_meta', $meta, $this->ID, $meta_key);
1320 1320
 	}
1321 1321
 
1322 1322
 	/**
@@ -1331,8 +1331,8 @@  discard block
 block discarded – undo
1331 1331
 	 *
1332 1332
 	 * @return int|bool           Meta ID if the key didn't exist, true on successful update, false on failure
1333 1333
 	 */
1334
-	public function update_meta( $meta_key = '', $meta_value = '', $prev_value = '' ) {
1335
-		if ( empty( $meta_key ) ) {
1334
+	public function update_meta($meta_key = '', $meta_value = '', $prev_value = '') {
1335
+		if (empty($meta_key)) {
1336 1336
 			return false;
1337 1337
 		}
1338 1338
 
@@ -1342,9 +1342,9 @@  discard block
 block discarded – undo
1342 1342
 		 *
1343 1343
 		 * @since 1.5
1344 1344
 		 */
1345
-		$meta_value = apply_filters( "give_update_payment_meta_{$meta_key}", $meta_value, $this->ID );
1345
+		$meta_value = apply_filters("give_update_payment_meta_{$meta_key}", $meta_value, $this->ID);
1346 1346
 
1347
-		return give_update_meta( $this->ID, $meta_key, $meta_value, $prev_value );
1347
+		return give_update_meta($this->ID, $meta_key, $meta_value, $prev_value);
1348 1348
 	}
1349 1349
 
1350 1350
 	/**
@@ -1357,7 +1357,7 @@  discard block
 block discarded – undo
1357 1357
 	 *
1358 1358
 	 * @return void
1359 1359
 	 */
1360
-	private function process_status( $status ) {
1360
+	private function process_status($status) {
1361 1361
 		$process = true;
1362 1362
 
1363 1363
 		// Bailout, if changed from completed to preapproval/processing.
@@ -1372,9 +1372,9 @@  discard block
 block discarded – undo
1372 1372
 		}
1373 1373
 
1374 1374
 		// Allow extensions to filter for their own payment types, Example: Recurring Payments.
1375
-		$process = apply_filters( "give_should_process_{$status}", $process, $this );
1375
+		$process = apply_filters("give_should_process_{$status}", $process, $this);
1376 1376
 
1377
-		if ( false === $process ) {
1377
+		if (false === $process) {
1378 1378
 			return;
1379 1379
 		}
1380 1380
 
@@ -1385,13 +1385,13 @@  discard block
 block discarded – undo
1385 1385
 		 *
1386 1386
 		 * @since 1.5
1387 1387
 		 */
1388
-		do_action( "give_pre_{$status}_payment", $this );
1388
+		do_action("give_pre_{$status}_payment", $this);
1389 1389
 
1390
-		$decrease_earnings       = apply_filters( "give_decrease_earnings_on_{$status}", true, $this );
1391
-		$decrease_donor_value    = apply_filters( "give_decrease_donor_value_on_{$status}", true, $this );
1392
-		$decrease_donation_count = apply_filters( "give_decrease_donors_donation_count_on_{$status}", true, $this );
1390
+		$decrease_earnings       = apply_filters("give_decrease_earnings_on_{$status}", true, $this);
1391
+		$decrease_donor_value    = apply_filters("give_decrease_donor_value_on_{$status}", true, $this);
1392
+		$decrease_donation_count = apply_filters("give_decrease_donors_donation_count_on_{$status}", true, $this);
1393 1393
 
1394
-		$this->maybe_alter_stats( $decrease_earnings, $decrease_donor_value, $decrease_donation_count );
1394
+		$this->maybe_alter_stats($decrease_earnings, $decrease_donor_value, $decrease_donation_count);
1395 1395
 		$this->delete_sales_logs();
1396 1396
 
1397 1397
 		// @todo: Refresh only range related stat cache
@@ -1404,7 +1404,7 @@  discard block
 block discarded – undo
1404 1404
 		 *
1405 1405
 		 * @since 1.5
1406 1406
 		 */
1407
-		do_action( "give_post_{$status}_payment", $this );
1407
+		do_action("give_post_{$status}_payment", $this);
1408 1408
 	}
1409 1409
 
1410 1410
 	/**
@@ -1419,25 +1419,25 @@  discard block
 block discarded – undo
1419 1419
 	 *
1420 1420
 	 * @return void
1421 1421
 	 */
1422
-	private function maybe_alter_stats( $alter_store_earnings, $alter_customer_value, $alter_customer_purchase_count ) {
1422
+	private function maybe_alter_stats($alter_store_earnings, $alter_customer_value, $alter_customer_purchase_count) {
1423 1423
 
1424
-		give_undo_donation( $this->ID );
1424
+		give_undo_donation($this->ID);
1425 1425
 
1426 1426
 		// Decrease store earnings.
1427
-		if ( true === $alter_store_earnings ) {
1428
-			give_decrease_total_earnings( $this->total );
1427
+		if (true === $alter_store_earnings) {
1428
+			give_decrease_total_earnings($this->total);
1429 1429
 		}
1430 1430
 
1431 1431
 		// Decrement the stats for the donor.
1432
-		if ( ! empty( $this->customer_id ) ) {
1432
+		if ( ! empty($this->customer_id)) {
1433 1433
 
1434
-			$donor = new Give_Donor( $this->customer_id );
1434
+			$donor = new Give_Donor($this->customer_id);
1435 1435
 
1436
-			if ( true === $alter_customer_value ) {
1437
-				$donor->decrease_value( $this->total );
1436
+			if (true === $alter_customer_value) {
1437
+				$donor->decrease_value($this->total);
1438 1438
 			}
1439 1439
 
1440
-			if ( true === $alter_customer_purchase_count ) {
1440
+			if (true === $alter_customer_purchase_count) {
1441 1441
 				$donor->decrease_donation_count();
1442 1442
 			}
1443 1443
 		}
@@ -1454,7 +1454,7 @@  discard block
 block discarded – undo
1454 1454
 	 */
1455 1455
 	private function delete_sales_logs() {
1456 1456
 		// Remove related sale log entries.
1457
-		Give()->logs->delete_logs( $this->ID );
1457
+		Give()->logs->delete_logs($this->ID);
1458 1458
 	}
1459 1459
 
1460 1460
 	/**
@@ -1475,13 +1475,13 @@  discard block
 block discarded – undo
1475 1475
 	 * @return string The date the payment was completed
1476 1476
 	 */
1477 1477
 	private function setup_completed_date() {
1478
-		$payment = get_post( $this->ID );
1478
+		$payment = get_post($this->ID);
1479 1479
 
1480
-		if ( 'pending' == $payment->post_status || 'preapproved' == $payment->post_status ) {
1480
+		if ('pending' == $payment->post_status || 'preapproved' == $payment->post_status) {
1481 1481
 			return false; // This payment was never completed.
1482 1482
 		}
1483 1483
 
1484
-		$date = ( $date = $this->get_meta( '_give_completed_date', true ) ) ? $date : $payment->modified_date;
1484
+		$date = ($date = $this->get_meta('_give_completed_date', true)) ? $date : $payment->modified_date;
1485 1485
 
1486 1486
 		return $date;
1487 1487
 	}
@@ -1495,7 +1495,7 @@  discard block
 block discarded – undo
1495 1495
 	 * @return string The payment mode
1496 1496
 	 */
1497 1497
 	private function setup_mode() {
1498
-		return $this->get_meta( '_give_payment_mode' );
1498
+		return $this->get_meta('_give_payment_mode');
1499 1499
 	}
1500 1500
 
1501 1501
 	/**
@@ -1507,7 +1507,7 @@  discard block
 block discarded – undo
1507 1507
 	 * @return bool The payment import
1508 1508
 	 */
1509 1509
 	private function setup_import() {
1510
-		return (bool) $this->get_meta( '_give_payment_import' );
1510
+		return (bool) $this->get_meta('_give_payment_import');
1511 1511
 	}
1512 1512
 
1513 1513
 	/**
@@ -1519,9 +1519,9 @@  discard block
 block discarded – undo
1519 1519
 	 * @return float The payment total
1520 1520
 	 */
1521 1521
 	private function setup_total() {
1522
-		$amount = $this->get_meta( '_give_payment_total', true );
1522
+		$amount = $this->get_meta('_give_payment_total', true);
1523 1523
 
1524
-		return round( floatval( $amount ), give_get_price_decimals( $this->ID ) );
1524
+		return round(floatval($amount), give_get_price_decimals($this->ID));
1525 1525
 	}
1526 1526
 
1527 1527
 	/**
@@ -1548,17 +1548,16 @@  discard block
 block discarded – undo
1548 1548
 	 * @return string The currency for the payment
1549 1549
 	 */
1550 1550
 	private function setup_currency() {
1551
-		$currency = $this->get_meta( '_give_payment_currency', true );
1552
-		$currency = ! empty( $currency ) ?
1553
-			$currency :
1554
-			/**
1551
+		$currency = $this->get_meta('_give_payment_currency', true);
1552
+		$currency = ! empty($currency) ?
1553
+			$currency : /**
1555 1554
 			 * Filter the default donation currency
1556 1555
 			 *
1557 1556
 			 * @since 1.5
1558 1557
 			 */
1559 1558
 			apply_filters(
1560 1559
 				'give_payment_currency_default',
1561
-				give_get_currency( $this->form_id, $this ),
1560
+				give_get_currency($this->form_id, $this),
1562 1561
 				$this
1563 1562
 			);
1564 1563
 
@@ -1574,7 +1573,7 @@  discard block
 block discarded – undo
1574 1573
 	 * @return string The gateway
1575 1574
 	 */
1576 1575
 	private function setup_gateway() {
1577
-		$gateway = $this->get_meta( '_give_payment_gateway', true );
1576
+		$gateway = $this->get_meta('_give_payment_gateway', true);
1578 1577
 
1579 1578
 		return $gateway;
1580 1579
 	}
@@ -1588,11 +1587,11 @@  discard block
 block discarded – undo
1588 1587
 	 * @return string The donation ID
1589 1588
 	 */
1590 1589
 	private function setup_transaction_id() {
1591
-		$transaction_id = $this->get_meta( '_give_payment_transaction_id', true );
1590
+		$transaction_id = $this->get_meta('_give_payment_transaction_id', true);
1592 1591
 
1593
-		if ( empty( $transaction_id ) ) {
1592
+		if (empty($transaction_id)) {
1594 1593
 			$gateway        = $this->gateway;
1595
-			$transaction_id = apply_filters( "give_get_payment_transaction_id-{$gateway}", $this->ID );
1594
+			$transaction_id = apply_filters("give_get_payment_transaction_id-{$gateway}", $this->ID);
1596 1595
 		}
1597 1596
 
1598 1597
 		return $transaction_id;
@@ -1608,7 +1607,7 @@  discard block
 block discarded – undo
1608 1607
 	 * @return string The IP address for the payment
1609 1608
 	 */
1610 1609
 	private function setup_ip() {
1611
-		$ip = $this->get_meta( '_give_payment_donor_ip', true );
1610
+		$ip = $this->get_meta('_give_payment_donor_ip', true);
1612 1611
 
1613 1612
 		return $ip;
1614 1613
 	}
@@ -1623,7 +1622,7 @@  discard block
 block discarded – undo
1623 1622
 	 * @return int The Donor ID.
1624 1623
 	 */
1625 1624
 	private function setup_donor_id() {
1626
-		$donor_id = $this->get_meta( '_give_payment_donor_id', true );
1625
+		$donor_id = $this->get_meta('_give_payment_donor_id', true);
1627 1626
 
1628 1627
 		return $donor_id;
1629 1628
 	}
@@ -1640,8 +1639,8 @@  discard block
 block discarded – undo
1640 1639
 	 */
1641 1640
 	private function setup_user_id() {
1642 1641
 
1643
-		$donor   = Give()->customers->get_customer_by( 'id', $this->customer_id );
1644
-		$user_id = $donor ? absint( $donor->user_id ) : 0;
1642
+		$donor   = Give()->customers->get_customer_by('id', $this->customer_id);
1643
+		$user_id = $donor ? absint($donor->user_id) : 0;
1645 1644
 
1646 1645
 
1647 1646
 		return $user_id;
@@ -1658,10 +1657,10 @@  discard block
 block discarded – undo
1658 1657
 	 * @return string The email address for the payment.
1659 1658
 	 */
1660 1659
 	private function setup_email() {
1661
-		$email = $this->get_meta( '_give_payment_donor_email', true );
1660
+		$email = $this->get_meta('_give_payment_donor_email', true);
1662 1661
 
1663
-		if ( empty( $email ) && $this->customer_id ) {
1664
-			$email = Give()->donors->get_column( 'email', $this->customer_id );
1662
+		if (empty($email) && $this->customer_id) {
1663
+			$email = Give()->donors->get_column('email', $this->customer_id);
1665 1664
 		}
1666 1665
 
1667 1666
 		return $email;
@@ -1681,22 +1680,22 @@  discard block
 block discarded – undo
1681 1680
 			'last_name'  => $this->last_name,
1682 1681
 		);
1683 1682
 
1684
-		$user_info = isset( $this->payment_meta['user_info'] ) ? $this->payment_meta['user_info'] : array();
1683
+		$user_info = isset($this->payment_meta['user_info']) ? $this->payment_meta['user_info'] : array();
1685 1684
 
1686
-		if ( is_serialized( $user_info ) ) {
1687
-			preg_match( '/[oO]\s*:\s*\d+\s*:\s*"\s*(?!(?i)(stdClass))/', $user_info, $matches );
1688
-			if ( ! empty( $matches ) ) {
1685
+		if (is_serialized($user_info)) {
1686
+			preg_match('/[oO]\s*:\s*\d+\s*:\s*"\s*(?!(?i)(stdClass))/', $user_info, $matches);
1687
+			if ( ! empty($matches)) {
1689 1688
 				$user_info = array();
1690 1689
 			}
1691 1690
 		}
1692 1691
 
1693
-		$user_info = wp_parse_args( $user_info, $defaults );
1692
+		$user_info = wp_parse_args($user_info, $defaults);
1694 1693
 
1695
-		if ( empty( $user_info ) ) {
1694
+		if (empty($user_info)) {
1696 1695
 			// Get the donor, but only if it's been created.
1697
-			$donor = new Give_Donor( $this->customer_id );
1696
+			$donor = new Give_Donor($this->customer_id);
1698 1697
 
1699
-			if ( $donor->id > 0 ) {
1698
+			if ($donor->id > 0) {
1700 1699
 				$user_info = array(
1701 1700
 					'first_name' => $donor->get_first_name(),
1702 1701
 					'last_name'  => $donor->get_last_name(),
@@ -1706,25 +1705,25 @@  discard block
 block discarded – undo
1706 1705
 			}
1707 1706
 		} else {
1708 1707
 			// Get the donor, but only if it's been created.
1709
-			$donor = new Give_Donor( $this->customer_id );
1708
+			$donor = new Give_Donor($this->customer_id);
1710 1709
 
1711
-			if ( $donor->id > 0 ) {
1712
-				foreach ( $user_info as $key => $value ) {
1713
-					if ( ! empty( $value ) ) {
1710
+			if ($donor->id > 0) {
1711
+				foreach ($user_info as $key => $value) {
1712
+					if ( ! empty($value)) {
1714 1713
 						continue;
1715 1714
 					}
1716 1715
 
1717
-					switch ( $key ) {
1716
+					switch ($key) {
1718 1717
 						case 'first_name':
1719
-							$user_info[ $key ] = $donor->get_first_name();
1718
+							$user_info[$key] = $donor->get_first_name();
1720 1719
 							break;
1721 1720
 
1722 1721
 						case 'last_name':
1723
-							$user_info[ $key ] = $donor->get_last_name();
1722
+							$user_info[$key] = $donor->get_last_name();
1724 1723
 							break;
1725 1724
 
1726 1725
 						case 'email':
1727
-							$user_info[ $key ] = $donor->email;
1726
+							$user_info[$key] = $donor->email;
1728 1727
 							break;
1729 1728
 					}
1730 1729
 				}
@@ -1744,12 +1743,12 @@  discard block
 block discarded – undo
1744 1743
 	 * @return array The Address information for the payment.
1745 1744
 	 */
1746 1745
 	private function setup_address() {
1747
-		$address['line1']   = give_get_meta( $this->ID, '_give_donor_billing_address1', true, '' );
1748
-		$address['line2']   = give_get_meta( $this->ID, '_give_donor_billing_address2', true, '' );
1749
-		$address['city']    = give_get_meta( $this->ID, '_give_donor_billing_city', true, '' );
1750
-		$address['state']   = give_get_meta( $this->ID, '_give_donor_billing_state', true, '' );
1751
-		$address['zip']     = give_get_meta( $this->ID, '_give_donor_billing_zip', true, '' );
1752
-		$address['country'] = give_get_meta( $this->ID, '_give_donor_billing_country', true, '' );
1746
+		$address['line1']   = give_get_meta($this->ID, '_give_donor_billing_address1', true, '');
1747
+		$address['line2']   = give_get_meta($this->ID, '_give_donor_billing_address2', true, '');
1748
+		$address['city']    = give_get_meta($this->ID, '_give_donor_billing_city', true, '');
1749
+		$address['state']   = give_get_meta($this->ID, '_give_donor_billing_state', true, '');
1750
+		$address['zip']     = give_get_meta($this->ID, '_give_donor_billing_zip', true, '');
1751
+		$address['country'] = give_get_meta($this->ID, '_give_donor_billing_country', true, '');
1753 1752
 
1754 1753
 		return $address;
1755 1754
 	}
@@ -1764,7 +1763,7 @@  discard block
 block discarded – undo
1764 1763
 	 */
1765 1764
 	private function setup_form_title() {
1766 1765
 
1767
-		$form_id = $this->get_meta( '_give_payment_form_title', true );
1766
+		$form_id = $this->get_meta('_give_payment_form_title', true);
1768 1767
 
1769 1768
 		return $form_id;
1770 1769
 	}
@@ -1779,7 +1778,7 @@  discard block
 block discarded – undo
1779 1778
 	 */
1780 1779
 	private function setup_form_id() {
1781 1780
 
1782
-		$form_id = $this->get_meta( '_give_payment_form_id', true );
1781
+		$form_id = $this->get_meta('_give_payment_form_id', true);
1783 1782
 
1784 1783
 		return $form_id;
1785 1784
 	}
@@ -1793,7 +1792,7 @@  discard block
 block discarded – undo
1793 1792
 	 * @return int The Form Price ID.
1794 1793
 	 */
1795 1794
 	private function setup_price_id() {
1796
-		$price_id = $this->get_meta( '_give_payment_price_id', true );
1795
+		$price_id = $this->get_meta('_give_payment_price_id', true);
1797 1796
 
1798 1797
 		return $price_id;
1799 1798
 	}
@@ -1807,7 +1806,7 @@  discard block
 block discarded – undo
1807 1806
 	 * @return string The Payment Key.
1808 1807
 	 */
1809 1808
 	private function setup_payment_key() {
1810
-		$key = $this->get_meta( '_give_payment_purchase_key', true );
1809
+		$key = $this->get_meta('_give_payment_purchase_key', true);
1811 1810
 
1812 1811
 		return $key;
1813 1812
 	}
@@ -1823,11 +1822,11 @@  discard block
 block discarded – undo
1823 1822
 	private function setup_payment_number() {
1824 1823
 		$number = $this->ID;
1825 1824
 
1826
-		if ( give_get_option( 'enable_sequential' ) ) {
1825
+		if (give_get_option('enable_sequential')) {
1827 1826
 
1828
-			$number = $this->get_meta( '_give_payment_number', true );
1827
+			$number = $this->get_meta('_give_payment_number', true);
1829 1828
 
1830
-			if ( ! $number ) {
1829
+			if ( ! $number) {
1831 1830
 
1832 1831
 				$number = $this->ID;
1833 1832
 
@@ -1845,7 +1844,7 @@  discard block
 block discarded – undo
1845 1844
 	 * @return array The payment object as an array.
1846 1845
 	 */
1847 1846
 	public function array_convert() {
1848
-		return get_object_vars( $this );
1847
+		return get_object_vars($this);
1849 1848
 	}
1850 1849
 
1851 1850
 
@@ -1858,7 +1857,7 @@  discard block
 block discarded – undo
1858 1857
 	 * @return bool
1859 1858
 	 */
1860 1859
 	public function is_completed() {
1861
-		return ( 'publish' === $this->status && $this->completed_date );
1860
+		return ('publish' === $this->status && $this->completed_date);
1862 1861
 	}
1863 1862
 
1864 1863
 	/**
@@ -1870,7 +1869,7 @@  discard block
 block discarded – undo
1870 1869
 	 * @return string Date payment was completed.
1871 1870
 	 */
1872 1871
 	private function get_completed_date() {
1873
-		return apply_filters( 'give_payment_completed_date', $this->completed_date, $this->ID, $this );
1872
+		return apply_filters('give_payment_completed_date', $this->completed_date, $this->ID, $this);
1874 1873
 	}
1875 1874
 
1876 1875
 	/**
@@ -1882,7 +1881,7 @@  discard block
 block discarded – undo
1882 1881
 	 * @return float Payment subtotal.
1883 1882
 	 */
1884 1883
 	private function get_subtotal() {
1885
-		return apply_filters( 'give_get_payment_subtotal', $this->subtotal, $this->ID, $this );
1884
+		return apply_filters('give_get_payment_subtotal', $this->subtotal, $this->ID, $this);
1886 1885
 	}
1887 1886
 
1888 1887
 	/**
@@ -1894,7 +1893,7 @@  discard block
 block discarded – undo
1894 1893
 	 * @return string Payment currency code.
1895 1894
 	 */
1896 1895
 	private function get_currency() {
1897
-		return apply_filters( 'give_payment_currency_code', $this->currency, $this->ID, $this );
1896
+		return apply_filters('give_payment_currency_code', $this->currency, $this->ID, $this);
1898 1897
 	}
1899 1898
 
1900 1899
 	/**
@@ -1906,7 +1905,7 @@  discard block
 block discarded – undo
1906 1905
 	 * @return string Gateway used.
1907 1906
 	 */
1908 1907
 	private function get_gateway() {
1909
-		return apply_filters( 'give_payment_gateway', $this->gateway, $this->ID, $this );
1908
+		return apply_filters('give_payment_gateway', $this->gateway, $this->ID, $this);
1910 1909
 	}
1911 1910
 
1912 1911
 	/**
@@ -1918,7 +1917,7 @@  discard block
 block discarded – undo
1918 1917
 	 * @return string Donation ID from merchant processor.
1919 1918
 	 */
1920 1919
 	private function get_transaction_id() {
1921
-		return apply_filters( 'give_get_payment_transaction_id', $this->transaction_id, $this->ID, $this );
1920
+		return apply_filters('give_get_payment_transaction_id', $this->transaction_id, $this->ID, $this);
1922 1921
 	}
1923 1922
 
1924 1923
 	/**
@@ -1930,7 +1929,7 @@  discard block
 block discarded – undo
1930 1929
 	 * @return string Payment IP address
1931 1930
 	 */
1932 1931
 	private function get_ip() {
1933
-		return apply_filters( 'give_payment_user_ip', $this->ip, $this->ID, $this );
1932
+		return apply_filters('give_payment_user_ip', $this->ip, $this->ID, $this);
1934 1933
 	}
1935 1934
 
1936 1935
 	/**
@@ -1942,7 +1941,7 @@  discard block
 block discarded – undo
1942 1941
 	 * @return int Payment donor ID.
1943 1942
 	 */
1944 1943
 	private function get_donor_id() {
1945
-		return apply_filters( 'give_payment_customer_id', $this->customer_id, $this->ID, $this );
1944
+		return apply_filters('give_payment_customer_id', $this->customer_id, $this->ID, $this);
1946 1945
 	}
1947 1946
 
1948 1947
 	/**
@@ -1954,7 +1953,7 @@  discard block
 block discarded – undo
1954 1953
 	 * @return int Payment user ID.
1955 1954
 	 */
1956 1955
 	private function get_user_id() {
1957
-		return apply_filters( 'give_payment_user_id', $this->user_id, $this->ID, $this );
1956
+		return apply_filters('give_payment_user_id', $this->user_id, $this->ID, $this);
1958 1957
 	}
1959 1958
 
1960 1959
 	/**
@@ -1966,7 +1965,7 @@  discard block
 block discarded – undo
1966 1965
 	 * @return string Payment donor email.
1967 1966
 	 */
1968 1967
 	private function get_email() {
1969
-		return apply_filters( 'give_payment_user_email', $this->email, $this->ID, $this );
1968
+		return apply_filters('give_payment_user_email', $this->email, $this->ID, $this);
1970 1969
 	}
1971 1970
 
1972 1971
 	/**
@@ -1978,7 +1977,7 @@  discard block
 block discarded – undo
1978 1977
 	 * @return array Payment user info.
1979 1978
 	 */
1980 1979
 	private function get_user_info() {
1981
-		return apply_filters( 'give_payment_meta_user_info', $this->user_info, $this->ID, $this );
1980
+		return apply_filters('give_payment_meta_user_info', $this->user_info, $this->ID, $this);
1982 1981
 	}
1983 1982
 
1984 1983
 	/**
@@ -1990,7 +1989,7 @@  discard block
 block discarded – undo
1990 1989
 	 * @return array Payment billing address.
1991 1990
 	 */
1992 1991
 	private function get_address() {
1993
-		return apply_filters( 'give_payment_address', $this->address, $this->ID, $this );
1992
+		return apply_filters('give_payment_address', $this->address, $this->ID, $this);
1994 1993
 	}
1995 1994
 
1996 1995
 	/**
@@ -2002,7 +2001,7 @@  discard block
 block discarded – undo
2002 2001
 	 * @return string Payment key.
2003 2002
 	 */
2004 2003
 	private function get_key() {
2005
-		return apply_filters( 'give_payment_key', $this->key, $this->ID, $this );
2004
+		return apply_filters('give_payment_key', $this->key, $this->ID, $this);
2006 2005
 	}
2007 2006
 
2008 2007
 	/**
@@ -2014,7 +2013,7 @@  discard block
 block discarded – undo
2014 2013
 	 * @return string Payment form id
2015 2014
 	 */
2016 2015
 	private function get_form_id() {
2017
-		return apply_filters( 'give_payment_form_id', $this->form_id, $this->ID, $this );
2016
+		return apply_filters('give_payment_form_id', $this->form_id, $this->ID, $this);
2018 2017
 	}
2019 2018
 
2020 2019
 	/**
@@ -2026,6 +2025,6 @@  discard block
 block discarded – undo
2026 2025
 	 * @return int|string Payment number
2027 2026
 	 */
2028 2027
 	private function get_number() {
2029
-		return apply_filters( 'give_payment_number', $this->number, $this->ID, $this );
2028
+		return apply_filters('give_payment_number', $this->number, $this->ID, $this);
2030 2029
 	}
2031 2030
 }
Please login to merge, or discard this patch.
give.php 1 patch
Spacing   +174 added lines, -174 removed lines patch added patch discarded remove patch
@@ -39,11 +39,11 @@  discard block
 block discarded – undo
39 39
  */
40 40
 
41 41
 // Exit if accessed directly.
42
-if ( ! defined( 'ABSPATH' ) ) {
42
+if ( ! defined('ABSPATH')) {
43 43
 	exit;
44 44
 }
45 45
 
46
-if ( ! class_exists( 'Give' ) ) :
46
+if ( ! class_exists('Give')) :
47 47
 
48 48
 	/**
49 49
 	 * Main Give Class
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 		 * @return    Give
238 238
 		 */
239 239
 		public static function instance() {
240
-			if ( is_null( self::$_instance ) ) {
240
+			if (is_null(self::$_instance)) {
241 241
 				self::$_instance = new self();
242 242
 			}
243 243
 
@@ -249,13 +249,13 @@  discard block
 block discarded – undo
249 249
 		 */
250 250
 		public function __construct() {
251 251
 			// PHP version
252
-			if ( ! defined( 'GIVE_REQUIRED_PHP_VERSION' ) ) {
253
-				define( 'GIVE_REQUIRED_PHP_VERSION', '5.3' );
252
+			if ( ! defined('GIVE_REQUIRED_PHP_VERSION')) {
253
+				define('GIVE_REQUIRED_PHP_VERSION', '5.3');
254 254
 			}
255 255
 
256 256
 			// Bailout: Need minimum php version to load plugin.
257
-			if ( function_exists( 'phpversion' ) && version_compare( GIVE_REQUIRED_PHP_VERSION, phpversion(), '>' ) ) {
258
-				add_action( 'admin_notices', array( $this, 'minmum_phpversion_notice' ) );
257
+			if (function_exists('phpversion') && version_compare(GIVE_REQUIRED_PHP_VERSION, phpversion(), '>')) {
258
+				add_action('admin_notices', array($this, 'minmum_phpversion_notice'));
259 259
 
260 260
 				return;
261 261
 			}
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 			$this->includes();
266 266
 			$this->init_hooks();
267 267
 
268
-			do_action( 'give_loaded' );
268
+			do_action('give_loaded');
269 269
 		}
270 270
 
271 271
 		/**
@@ -274,8 +274,8 @@  discard block
 block discarded – undo
274 274
 		 * @since  1.8.9
275 275
 		 */
276 276
 		private function init_hooks() {
277
-			register_activation_hook( GIVE_PLUGIN_FILE, 'give_install' );
278
-			add_action( 'plugins_loaded', array( $this, 'init' ), 0 );
277
+			register_activation_hook(GIVE_PLUGIN_FILE, 'give_install');
278
+			add_action('plugins_loaded', array($this, 'init'), 0);
279 279
 		}
280 280
 
281 281
 		/**
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
 			 *
291 291
 			 * @since 1.8.9
292 292
 			 */
293
-			do_action( 'before_give_init' );
293
+			do_action('before_give_init');
294 294
 
295 295
 			// Set up localization.
296 296
 			$this->load_textdomain();
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 			 *
321 321
 			 * @since 1.8.7
322 322
 			 */
323
-			do_action( 'give_init', $this );
323
+			do_action('give_init', $this);
324 324
 
325 325
 		}
326 326
 
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 		 */
338 338
 		public function __clone() {
339 339
 			// Cloning instances of the class is forbidden.
340
-			give_doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'give' ), '1.0' );
340
+			give_doing_it_wrong(__FUNCTION__, __('Cheatin&#8217; huh?', 'give'), '1.0');
341 341
 		}
342 342
 
343 343
 		/**
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 		 */
351 351
 		public function __wakeup() {
352 352
 			// Unserializing instances of the class is forbidden.
353
-			give_doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'give' ), '1.0' );
353
+			give_doing_it_wrong(__FUNCTION__, __('Cheatin&#8217; huh?', 'give'), '1.0');
354 354
 		}
355 355
 
356 356
 		/**
@@ -364,33 +364,33 @@  discard block
 block discarded – undo
364 364
 		private function setup_constants() {
365 365
 
366 366
 			// Plugin version
367
-			if ( ! defined( 'GIVE_VERSION' ) ) {
368
-				define( 'GIVE_VERSION', '2.0.2' );
367
+			if ( ! defined('GIVE_VERSION')) {
368
+				define('GIVE_VERSION', '2.0.2');
369 369
 			}
370 370
 
371 371
 			// Plugin Root File
372
-			if ( ! defined( 'GIVE_PLUGIN_FILE' ) ) {
373
-				define( 'GIVE_PLUGIN_FILE', __FILE__ );
372
+			if ( ! defined('GIVE_PLUGIN_FILE')) {
373
+				define('GIVE_PLUGIN_FILE', __FILE__);
374 374
 			}
375 375
 
376 376
 			// Plugin Folder Path
377
-			if ( ! defined( 'GIVE_PLUGIN_DIR' ) ) {
378
-				define( 'GIVE_PLUGIN_DIR', plugin_dir_path( GIVE_PLUGIN_FILE ) );
377
+			if ( ! defined('GIVE_PLUGIN_DIR')) {
378
+				define('GIVE_PLUGIN_DIR', plugin_dir_path(GIVE_PLUGIN_FILE));
379 379
 			}
380 380
 
381 381
 			// Plugin Folder URL
382
-			if ( ! defined( 'GIVE_PLUGIN_URL' ) ) {
383
-				define( 'GIVE_PLUGIN_URL', plugin_dir_url( GIVE_PLUGIN_FILE ) );
382
+			if ( ! defined('GIVE_PLUGIN_URL')) {
383
+				define('GIVE_PLUGIN_URL', plugin_dir_url(GIVE_PLUGIN_FILE));
384 384
 			}
385 385
 
386 386
 			// Plugin Basename aka: "give/give.php"
387
-			if ( ! defined( 'GIVE_PLUGIN_BASENAME' ) ) {
388
-				define( 'GIVE_PLUGIN_BASENAME', plugin_basename( GIVE_PLUGIN_FILE ) );
387
+			if ( ! defined('GIVE_PLUGIN_BASENAME')) {
388
+				define('GIVE_PLUGIN_BASENAME', plugin_basename(GIVE_PLUGIN_FILE));
389 389
 			}
390 390
 
391 391
 			// Make sure CAL_GREGORIAN is defined
392
-			if ( ! defined( 'CAL_GREGORIAN' ) ) {
393
-				define( 'CAL_GREGORIAN', 1 );
392
+			if ( ! defined('CAL_GREGORIAN')) {
393
+				define('CAL_GREGORIAN', 1);
394 394
 			}
395 395
 		}
396 396
 
@@ -408,152 +408,152 @@  discard block
 block discarded – undo
408 408
 			/**
409 409
 			 * Load libraries.
410 410
 			 */
411
-			if ( ! class_exists( 'WP_Async_Request' ) ) {
412
-				include_once( GIVE_PLUGIN_DIR . 'includes/libraries/wp-async-request.php' );
411
+			if ( ! class_exists('WP_Async_Request')) {
412
+				include_once(GIVE_PLUGIN_DIR.'includes/libraries/wp-async-request.php');
413 413
 			}
414 414
 
415
-			if ( ! class_exists( 'WP_Background_Process' ) ) {
416
-				include_once( GIVE_PLUGIN_DIR . 'includes/libraries/wp-background-process.php' );
415
+			if ( ! class_exists('WP_Background_Process')) {
416
+				include_once(GIVE_PLUGIN_DIR.'includes/libraries/wp-background-process.php');
417 417
 			}
418 418
 
419 419
 			/**
420 420
 			 * Load plugin files
421 421
 			 */
422
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-settings.php';
423
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/class-give-settings.php';
422
+			require_once GIVE_PLUGIN_DIR.'includes/admin/class-admin-settings.php';
423
+			require_once GIVE_PLUGIN_DIR.'includes/admin/class-give-settings.php';
424 424
 			$give_options = give_get_settings();
425 425
 
426
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-cron.php';
427
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-async-process.php';
428
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/give-metabox-functions.php';
429
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-cache.php';
430
-			require_once GIVE_PLUGIN_DIR . 'includes/post-types.php';
431
-			require_once GIVE_PLUGIN_DIR . 'includes/scripts.php';
432
-			require_once GIVE_PLUGIN_DIR . 'includes/ajax-functions.php';
433
-			require_once GIVE_PLUGIN_DIR . 'includes/actions.php';
434
-			require_once GIVE_PLUGIN_DIR . 'includes/filters.php';
435
-			require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api.php';
436
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-tooltips.php';
437
-			require_once GIVE_PLUGIN_DIR . 'includes/class-notices.php';
438
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-translation.php';
439
-
440
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-roles.php';
441
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-template-loader.php';
442
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-donate-form.php';
443
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db.php';
444
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-meta.php';
445
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-donors.php';
446
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-donor-meta.php';
447
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-donor.php';
448
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-stats.php';
449
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-session.php';
450
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-html-elements.php';
451
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-logging.php';
452
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-license-handler.php';
453
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-email-access.php';
454
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-payment-meta.php';
455
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-form-meta.php';
456
-
457
-			require_once GIVE_PLUGIN_DIR . 'includes/country-functions.php';
458
-			require_once GIVE_PLUGIN_DIR . 'includes/template-functions.php';
459
-			require_once GIVE_PLUGIN_DIR . 'includes/misc-functions.php';
460
-			require_once GIVE_PLUGIN_DIR . 'includes/import-functions.php';
461
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/functions.php';
462
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/template.php';
463
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/widget.php';
464
-			require_once GIVE_PLUGIN_DIR . 'includes/shortcodes.php';
465
-			require_once GIVE_PLUGIN_DIR . 'includes/formatting.php';
466
-			require_once GIVE_PLUGIN_DIR . 'includes/currency-functions.php';
467
-			require_once GIVE_PLUGIN_DIR . 'includes/price-functions.php';
468
-			require_once GIVE_PLUGIN_DIR . 'includes/error-tracking.php';
469
-			require_once GIVE_PLUGIN_DIR . 'includes/process-donation.php';
470
-			require_once GIVE_PLUGIN_DIR . 'includes/login-register.php';
471
-			require_once GIVE_PLUGIN_DIR . 'includes/user-functions.php';
472
-			require_once GIVE_PLUGIN_DIR . 'includes/plugin-compatibility.php';
473
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-classes.php';
474
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-functions.php';
475
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-actions.php';
476
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-filters.php';
477
-
478
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/backward-compatibility.php';
479
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/functions.php';
480
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/actions.php';
481
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payment-stats.php';
482
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payments-query.php';
483
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-give-payment.php';
484
-
485
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/functions.php';
486
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/actions.php';
487
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/paypal-standard.php';
488
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/offline-donations.php';
489
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/manual.php';
490
-
491
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-emails.php';
492
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-email-tags.php';
493
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/emails/class-email-notifications.php';
494
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/functions.php';
495
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php';
496
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php';
497
-
498
-			require_once GIVE_PLUGIN_DIR . 'includes/donors/class-give-donors-query.php';
499
-			require_once GIVE_PLUGIN_DIR . 'includes/donors/backward-compatibility.php';
500
-
501
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/class-give-updates.php';
502
-
503
-			if ( defined( 'WP_CLI' ) && WP_CLI ) {
504
-				require_once GIVE_PLUGIN_DIR . 'includes/class-give-cli-commands.php';
426
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-cron.php';
427
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-async-process.php';
428
+			require_once GIVE_PLUGIN_DIR.'includes/admin/give-metabox-functions.php';
429
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-cache.php';
430
+			require_once GIVE_PLUGIN_DIR.'includes/post-types.php';
431
+			require_once GIVE_PLUGIN_DIR.'includes/scripts.php';
432
+			require_once GIVE_PLUGIN_DIR.'includes/ajax-functions.php';
433
+			require_once GIVE_PLUGIN_DIR.'includes/actions.php';
434
+			require_once GIVE_PLUGIN_DIR.'includes/filters.php';
435
+			require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api.php';
436
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-tooltips.php';
437
+			require_once GIVE_PLUGIN_DIR.'includes/class-notices.php';
438
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-translation.php';
439
+
440
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-roles.php';
441
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-template-loader.php';
442
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-donate-form.php';
443
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db.php';
444
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-meta.php';
445
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-donors.php';
446
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-donor-meta.php';
447
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-donor.php';
448
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-stats.php';
449
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-session.php';
450
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-html-elements.php';
451
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-logging.php';
452
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-license-handler.php';
453
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-email-access.php';
454
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-payment-meta.php';
455
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-form-meta.php';
456
+
457
+			require_once GIVE_PLUGIN_DIR.'includes/country-functions.php';
458
+			require_once GIVE_PLUGIN_DIR.'includes/template-functions.php';
459
+			require_once GIVE_PLUGIN_DIR.'includes/misc-functions.php';
460
+			require_once GIVE_PLUGIN_DIR.'includes/import-functions.php';
461
+			require_once GIVE_PLUGIN_DIR.'includes/forms/functions.php';
462
+			require_once GIVE_PLUGIN_DIR.'includes/forms/template.php';
463
+			require_once GIVE_PLUGIN_DIR.'includes/forms/widget.php';
464
+			require_once GIVE_PLUGIN_DIR.'includes/shortcodes.php';
465
+			require_once GIVE_PLUGIN_DIR.'includes/formatting.php';
466
+			require_once GIVE_PLUGIN_DIR.'includes/currency-functions.php';
467
+			require_once GIVE_PLUGIN_DIR.'includes/price-functions.php';
468
+			require_once GIVE_PLUGIN_DIR.'includes/error-tracking.php';
469
+			require_once GIVE_PLUGIN_DIR.'includes/process-donation.php';
470
+			require_once GIVE_PLUGIN_DIR.'includes/login-register.php';
471
+			require_once GIVE_PLUGIN_DIR.'includes/user-functions.php';
472
+			require_once GIVE_PLUGIN_DIR.'includes/plugin-compatibility.php';
473
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-classes.php';
474
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-functions.php';
475
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-actions.php';
476
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-filters.php';
477
+
478
+			require_once GIVE_PLUGIN_DIR.'includes/payments/backward-compatibility.php';
479
+			require_once GIVE_PLUGIN_DIR.'includes/payments/functions.php';
480
+			require_once GIVE_PLUGIN_DIR.'includes/payments/actions.php';
481
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-payment-stats.php';
482
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-payments-query.php';
483
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-give-payment.php';
484
+
485
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/functions.php';
486
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/actions.php';
487
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/paypal-standard.php';
488
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/offline-donations.php';
489
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/manual.php';
490
+
491
+			require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-emails.php';
492
+			require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-email-tags.php';
493
+			require_once GIVE_PLUGIN_DIR.'includes/admin/emails/class-email-notifications.php';
494
+			require_once GIVE_PLUGIN_DIR.'includes/emails/functions.php';
495
+			require_once GIVE_PLUGIN_DIR.'includes/emails/template.php';
496
+			require_once GIVE_PLUGIN_DIR.'includes/emails/actions.php';
497
+
498
+			require_once GIVE_PLUGIN_DIR.'includes/donors/class-give-donors-query.php';
499
+			require_once GIVE_PLUGIN_DIR.'includes/donors/backward-compatibility.php';
500
+
501
+			require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/class-give-updates.php';
502
+
503
+			if (defined('WP_CLI') && WP_CLI) {
504
+				require_once GIVE_PLUGIN_DIR.'includes/class-give-cli-commands.php';
505 505
 			}
506 506
 
507
-			if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
508
-
509
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-footer.php';
510
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/welcome.php';
511
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-pages.php';
512
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php';
513
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-i18n-module.php';
514
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-actions.php';
515
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-filters.php';
516
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/add-ons.php';
517
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/plugins.php';
518
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/dashboard-widgets.php';
519
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-blank-slate.php';
520
-
521
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/actions.php';
522
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/payments-history.php';
523
-
524
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donors.php';
525
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donor-functions.php';
526
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donor-actions.php';
527
-
528
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/metabox.php';
529
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/class-metabox-form-data.php';
530
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/dashboard-columns.php';
531
-
532
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/export-functions.php';
533
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-export.php';
534
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/export-actions.php';
535
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/pdf-reports.php';
536
-
537
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/reports.php';
538
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/class-give-graph.php';
539
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/graphing.php';
540
-
541
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/logs.php';
542
-
543
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/data/tools-actions.php';
544
-
545
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/abstract-shortcode-generator.php';
546
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/class-shortcode-button.php';
547
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-form.php';
548
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-goal.php';
549
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-login.php';
550
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-register.php';
551
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-profile-editor.php';
552
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-history.php';
553
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-receipt.php';
507
+			if (is_admin() || (defined('WP_CLI') && WP_CLI)) {
508
+
509
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-footer.php';
510
+				require_once GIVE_PLUGIN_DIR.'includes/admin/welcome.php';
511
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-pages.php';
512
+				require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php';
513
+				require_once GIVE_PLUGIN_DIR.'includes/admin/class-i18n-module.php';
514
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-actions.php';
515
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-filters.php';
516
+				require_once GIVE_PLUGIN_DIR.'includes/admin/add-ons.php';
517
+				require_once GIVE_PLUGIN_DIR.'includes/admin/plugins.php';
518
+				require_once GIVE_PLUGIN_DIR.'includes/admin/dashboard-widgets.php';
519
+				require_once GIVE_PLUGIN_DIR.'includes/admin/class-blank-slate.php';
520
+
521
+				require_once GIVE_PLUGIN_DIR.'includes/admin/payments/actions.php';
522
+				require_once GIVE_PLUGIN_DIR.'includes/admin/payments/payments-history.php';
523
+
524
+				require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donors.php';
525
+				require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donor-functions.php';
526
+				require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donor-actions.php';
527
+
528
+				require_once GIVE_PLUGIN_DIR.'includes/admin/forms/metabox.php';
529
+				require_once GIVE_PLUGIN_DIR.'includes/admin/forms/class-metabox-form-data.php';
530
+				require_once GIVE_PLUGIN_DIR.'includes/admin/forms/dashboard-columns.php';
531
+
532
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/export-functions.php';
533
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-export.php';
534
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/export-actions.php';
535
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/pdf-reports.php';
536
+
537
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reports/reports.php';
538
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reports/class-give-graph.php';
539
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reports/graphing.php';
540
+
541
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/logs/logs.php';
542
+
543
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/data/tools-actions.php';
544
+
545
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/abstract-shortcode-generator.php';
546
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/class-shortcode-button.php';
547
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-form.php';
548
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-goal.php';
549
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-login.php';
550
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-register.php';
551
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-profile-editor.php';
552
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-history.php';
553
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-receipt.php';
554 554
 			}// End if().
555 555
 
556
-			require_once GIVE_PLUGIN_DIR . 'includes/install.php';
556
+			require_once GIVE_PLUGIN_DIR.'includes/install.php';
557 557
 
558 558
 		}
559 559
 
@@ -568,16 +568,16 @@  discard block
 block discarded – undo
568 568
 		public function load_textdomain() {
569 569
 
570 570
 			// Set filter for Give's languages directory
571
-			$give_lang_dir = dirname( plugin_basename( GIVE_PLUGIN_FILE ) ) . '/languages/';
572
-			$give_lang_dir = apply_filters( 'give_languages_directory', $give_lang_dir );
571
+			$give_lang_dir = dirname(plugin_basename(GIVE_PLUGIN_FILE)).'/languages/';
572
+			$give_lang_dir = apply_filters('give_languages_directory', $give_lang_dir);
573 573
 
574 574
 			// Traditional WordPress plugin locale filter.
575
-			$locale = is_admin() && function_exists( 'get_user_locale' ) ? get_user_locale() : get_locale();
576
-			$locale = apply_filters( 'plugin_locale', $locale, 'give' );
575
+			$locale = is_admin() && function_exists('get_user_locale') ? get_user_locale() : get_locale();
576
+			$locale = apply_filters('plugin_locale', $locale, 'give');
577 577
 
578
-			unload_textdomain( 'give' );
579
-			load_textdomain( 'give', WP_LANG_DIR . '/give/give-' . $locale . '.mo' );
580
-			load_plugin_textdomain( 'give', false, $give_lang_dir );
578
+			unload_textdomain('give');
579
+			load_textdomain('give', WP_LANG_DIR.'/give/give-'.$locale.'.mo');
580
+			load_plugin_textdomain('give', false, $give_lang_dir);
581 581
 
582 582
 		}
583 583
 
@@ -590,17 +590,17 @@  discard block
 block discarded – undo
590 590
 		 */
591 591
 		public function minmum_phpversion_notice() {
592 592
 			// Bailout.
593
-			if ( ! is_admin() ) {
593
+			if ( ! is_admin()) {
594 594
 				return;
595 595
 			}
596 596
 
597
-			$notice_desc = '<p><strong>' . __( 'Your site could be faster and more secure with a newer PHP version.', 'give' ) . '</strong></p>';
598
-			$notice_desc .= '<p>' . __( 'Hey, we\'ve noticed that you\'re running an outdated version of PHP. PHP is the programming language that WordPress and Give are built on. The version that is currently used for your site is no longer supported. Newer versions of PHP are both faster and more secure. In fact, your version of PHP no longer receives security updates, which is why we\'re sending you this notice.', 'give' ) . '</p>';
599
-			$notice_desc .= '<p>' . __( 'Hosts have the ability to update your PHP version, but sometimes they don\'t dare to do that because they\'re afraid they\'ll break your site.', 'give' ) . '</p>';
600
-			$notice_desc .= '<p><strong>' . __( 'To which version should I update?', 'give' ) . '</strong></p>';
601
-			$notice_desc .= '<p>' . __( 'You should update your PHP version to either 5.6 or to 7.0 or 7.1. On a normal WordPress site, switching to PHP 5.6 should never cause issues. We would however actually recommend you switch to PHP7. There are some plugins that are not ready for PHP7 though, so do some testing first. PHP7 is much faster than PHP 5.6. It\'s also the only PHP version still in active development and therefore the better option for your site in the long run.', 'give' ) . '</p>';
602
-			$notice_desc .= '<p><strong>' . __( 'Can\'t update? Ask your host!', 'give' ) . '</strong></p>';
603
-			$notice_desc .= '<p>' . sprintf( __( 'If you cannot upgrade your PHP version yourself, you can send an email to your host. If they don\'t want to upgrade your PHP version, we would suggest you switch hosts. Have a look at one of the recommended %1$sWordPress hosting partners%2$s.', 'give' ), sprintf( '<a href="%1$s" target="_blank">', esc_url( 'https://wordpress.org/hosting/' ) ), '</a>' ) . '</p>';
597
+			$notice_desc = '<p><strong>'.__('Your site could be faster and more secure with a newer PHP version.', 'give').'</strong></p>';
598
+			$notice_desc .= '<p>'.__('Hey, we\'ve noticed that you\'re running an outdated version of PHP. PHP is the programming language that WordPress and Give are built on. The version that is currently used for your site is no longer supported. Newer versions of PHP are both faster and more secure. In fact, your version of PHP no longer receives security updates, which is why we\'re sending you this notice.', 'give').'</p>';
599
+			$notice_desc .= '<p>'.__('Hosts have the ability to update your PHP version, but sometimes they don\'t dare to do that because they\'re afraid they\'ll break your site.', 'give').'</p>';
600
+			$notice_desc .= '<p><strong>'.__('To which version should I update?', 'give').'</strong></p>';
601
+			$notice_desc .= '<p>'.__('You should update your PHP version to either 5.6 or to 7.0 or 7.1. On a normal WordPress site, switching to PHP 5.6 should never cause issues. We would however actually recommend you switch to PHP7. There are some plugins that are not ready for PHP7 though, so do some testing first. PHP7 is much faster than PHP 5.6. It\'s also the only PHP version still in active development and therefore the better option for your site in the long run.', 'give').'</p>';
602
+			$notice_desc .= '<p><strong>'.__('Can\'t update? Ask your host!', 'give').'</strong></p>';
603
+			$notice_desc .= '<p>'.sprintf(__('If you cannot upgrade your PHP version yourself, you can send an email to your host. If they don\'t want to upgrade your PHP version, we would suggest you switch hosts. Have a look at one of the recommended %1$sWordPress hosting partners%2$s.', 'give'), sprintf('<a href="%1$s" target="_blank">', esc_url('https://wordpress.org/hosting/')), '</a>').'</p>';
604 604
 
605 605
 			echo sprintf(
606 606
 				'<div class="notice notice-error">%1$s</div>',
Please login to merge, or discard this patch.