Completed
Push — master ( 4562c5...8fef4a )
by Devin
10s
created
includes/admin/payments/class-payments-table.php 1 patch
Spacing   +165 added lines, -165 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
 /**
@@ -120,37 +120,37 @@  discard block
 block discarded – undo
120 120
 		global $status, $page;
121 121
 
122 122
 		// Set parent defaults
123
-		parent::__construct( array(
124
-			'singular' => give_get_forms_label_singular(),    // Singular name of the listed records
125
-			'plural'   => give_get_forms_label_plural(),        // Plural name of the listed records
123
+		parent::__construct(array(
124
+			'singular' => give_get_forms_label_singular(), // Singular name of the listed records
125
+			'plural'   => give_get_forms_label_plural(), // Plural name of the listed records
126 126
 			'ajax'     => false                        // Does this table support ajax?
127
-		) );
127
+		));
128 128
 
129 129
 		$this->get_payment_counts();
130 130
 		$this->process_bulk_action();
131
-		$this->base_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' );
131
+		$this->base_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history');
132 132
 	}
133 133
 
134 134
 	public function advanced_filters() {
135
-		$start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null;
136
-		$end_date   = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : null;
137
-		$status     = isset( $_GET['status'] ) ? $_GET['status'] : '';
135
+		$start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null;
136
+		$end_date   = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : null;
137
+		$status     = isset($_GET['status']) ? $_GET['status'] : '';
138 138
 		?>
139 139
 		<div id="give-payment-filters">
140 140
 			<span id="give-payment-date-filters">
141
-				<label for="start-date" class="give-start-date-label"><?php _e( 'Start Date:', 'give' ); ?></label>
141
+				<label for="start-date" class="give-start-date-label"><?php _e('Start Date:', 'give'); ?></label>
142 142
 				<input type="text" id="start-date" name="start-date" class="give_datepicker" value="<?php echo $start_date; ?>" placeholder="mm/dd/yyyy" />
143
-				<label for="end-date" class="give-end-date-label"><?php _e( 'End Date:', 'give' ); ?></label>
143
+				<label for="end-date" class="give-end-date-label"><?php _e('End Date:', 'give'); ?></label>
144 144
 				<input type="text" id="end-date" name="end-date" class="give_datepicker" value="<?php echo $end_date; ?>" placeholder="mm/dd/yyyy" />
145
-				<input type="submit" class="button-secondary" value="<?php _e( 'Apply', 'give' ); ?>" />
145
+				<input type="submit" class="button-secondary" value="<?php _e('Apply', 'give'); ?>" />
146 146
 			</span>
147
-			<?php if ( ! empty( $status ) ) : ?>
148
-				<input type="hidden" name="status" value="<?php echo esc_attr( $status ); ?>" />
147
+			<?php if ( ! empty($status)) : ?>
148
+				<input type="hidden" name="status" value="<?php echo esc_attr($status); ?>" />
149 149
 			<?php endif; ?>
150
-			<?php if ( ! empty( $start_date ) || ! empty( $end_date ) ) : ?>
151
-				<a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>" class="button-secondary"><?php _e( 'Clear Filter', 'give' ); ?></a>
150
+			<?php if ( ! empty($start_date) || ! empty($end_date)) : ?>
151
+				<a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>" class="button-secondary"><?php _e('Clear Filter', 'give'); ?></a>
152 152
 			<?php endif; ?>
153
-			<?php $this->search_box( __( 'Search', 'give' ), 'give-payments' ); ?>
153
+			<?php $this->search_box(__('Search', 'give'), 'give-payments'); ?>
154 154
 		</div>
155 155
 
156 156
 		<?php
@@ -167,25 +167,25 @@  discard block
 block discarded – undo
167 167
 	 *
168 168
 	 * @return void
169 169
 	 */
170
-	public function search_box( $text, $input_id ) {
171
-		if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) {
170
+	public function search_box($text, $input_id) {
171
+		if (empty($_REQUEST['s']) && ! $this->has_items()) {
172 172
 			return;
173 173
 		}
174 174
 
175
-		$input_id = $input_id . '-search-input';
175
+		$input_id = $input_id.'-search-input';
176 176
 
177
-		if ( ! empty( $_REQUEST['orderby'] ) ) {
178
-			echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />';
177
+		if ( ! empty($_REQUEST['orderby'])) {
178
+			echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />';
179 179
 		}
180
-		if ( ! empty( $_REQUEST['order'] ) ) {
181
-			echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />';
180
+		if ( ! empty($_REQUEST['order'])) {
181
+			echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />';
182 182
 		}
183 183
 		?>
184 184
 		<p class="search-box">
185
-			<?php do_action( 'give_payment_history_search' ); ?>
185
+			<?php do_action('give_payment_history_search'); ?>
186 186
 			<label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label>
187 187
 			<input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>" />
188
-			<?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?><br />
188
+			<?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?><br />
189 189
 		</p>
190 190
 		<?php
191 191
 	}
@@ -199,52 +199,52 @@  discard block
 block discarded – undo
199 199
 	 */
200 200
 	public function get_views() {
201 201
 
202
-		$current         = isset( $_GET['status'] ) ? $_GET['status'] : '';
203
-		$total_count     = '&nbsp;<span class="count">(' . $this->total_count . ')</span>';
204
-		$complete_count  = '&nbsp;<span class="count">(' . $this->complete_count . ')</span>';
205
-		$cancelled_count = '&nbsp;<span class="count">(' . $this->cancelled_count . ')</span>';
206
-		$pending_count   = '&nbsp;<span class="count">(' . $this->pending_count . ')</span>';
207
-		$refunded_count  = '&nbsp;<span class="count">(' . $this->refunded_count . ')</span>';
208
-		$failed_count    = '&nbsp;<span class="count">(' . $this->failed_count . ')</span>';
209
-		$abandoned_count = '&nbsp;<span class="count">(' . $this->abandoned_count . ')</span>';
210
-		$revoked_count   = '&nbsp;<span class="count">(' . $this->revoked_count . ')</span>';
202
+		$current         = isset($_GET['status']) ? $_GET['status'] : '';
203
+		$total_count     = '&nbsp;<span class="count">('.$this->total_count.')</span>';
204
+		$complete_count  = '&nbsp;<span class="count">('.$this->complete_count.')</span>';
205
+		$cancelled_count = '&nbsp;<span class="count">('.$this->cancelled_count.')</span>';
206
+		$pending_count   = '&nbsp;<span class="count">('.$this->pending_count.')</span>';
207
+		$refunded_count  = '&nbsp;<span class="count">('.$this->refunded_count.')</span>';
208
+		$failed_count    = '&nbsp;<span class="count">('.$this->failed_count.')</span>';
209
+		$abandoned_count = '&nbsp;<span class="count">('.$this->abandoned_count.')</span>';
210
+		$revoked_count   = '&nbsp;<span class="count">('.$this->revoked_count.')</span>';
211 211
 
212 212
 		$views = array(
213
-			'all'       => sprintf( '<a href="%s"%s>%s</a>', remove_query_arg( array(
213
+			'all'       => sprintf('<a href="%s"%s>%s</a>', remove_query_arg(array(
214 214
 				'status',
215 215
 				'paged'
216
-			) ), $current === 'all' || $current == '' ? ' class="current"' : '', __( 'All', 'give' ) . $total_count ),
217
-			'publish'   => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
216
+			)), $current === 'all' || $current == '' ? ' class="current"' : '', __('All', 'give').$total_count),
217
+			'publish'   => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
218 218
 				'status' => 'publish',
219 219
 				'paged'  => false
220
-			) ) ), $current === 'publish' ? ' class="current"' : '', __( 'Completed', 'give' ) . $complete_count ),
221
-			'pending'   => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
220
+			))), $current === 'publish' ? ' class="current"' : '', __('Completed', 'give').$complete_count),
221
+			'pending'   => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
222 222
 				'status' => 'pending',
223 223
 				'paged'  => false
224
-			) ) ), $current === 'pending' ? ' class="current"' : '', __( 'Pending', 'give' ) . $pending_count ),
225
-			'refunded'  => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
224
+			))), $current === 'pending' ? ' class="current"' : '', __('Pending', 'give').$pending_count),
225
+			'refunded'  => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
226 226
 				'status' => 'refunded',
227 227
 				'paged'  => false
228
-			) ) ), $current === 'refunded' ? ' class="current"' : '', __( 'Refunded', 'give' ) . $refunded_count ),
229
-			'revoked'   => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
228
+			))), $current === 'refunded' ? ' class="current"' : '', __('Refunded', 'give').$refunded_count),
229
+			'revoked'   => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
230 230
 				'status' => 'revoked',
231 231
 				'paged'  => false
232
-			) ) ), $current === 'revoked' ? ' class="current"' : '', __( 'Revoked', 'give' ) . $revoked_count ),
233
-			'failed'    => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
232
+			))), $current === 'revoked' ? ' class="current"' : '', __('Revoked', 'give').$revoked_count),
233
+			'failed'    => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
234 234
 				'status' => 'failed',
235 235
 				'paged'  => false
236
-			) ) ), $current === 'failed' ? ' class="current"' : '', __( 'Failed', 'give' ) . $failed_count ),
237
-			'cancelled' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
236
+			))), $current === 'failed' ? ' class="current"' : '', __('Failed', 'give').$failed_count),
237
+			'cancelled' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
238 238
 				'status' => 'cancelled',
239 239
 				'paged'  => false
240
-			) ) ), $current === 'cancelled' ? ' class="current"' : '', __( 'Cancelled', 'give' ) . $cancelled_count ),
241
-			'abandoned' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
240
+			))), $current === 'cancelled' ? ' class="current"' : '', __('Cancelled', 'give').$cancelled_count),
241
+			'abandoned' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
242 242
 				'status' => 'abandoned',
243 243
 				'paged'  => false
244
-			) ) ), $current === 'abandoned' ? ' class="current"' : '', __( 'Abandoned', 'give' ) . $abandoned_count )
244
+			))), $current === 'abandoned' ? ' class="current"' : '', __('Abandoned', 'give').$abandoned_count)
245 245
 		);
246 246
 
247
-		return apply_filters( 'give_payments_table_views', $views );
247
+		return apply_filters('give_payments_table_views', $views);
248 248
 	}
249 249
 
250 250
 	/**
@@ -257,16 +257,16 @@  discard block
 block discarded – undo
257 257
 	public function get_columns() {
258 258
 		$columns = array(
259 259
 			'cb'      => '<input type="checkbox" />', //Render a checkbox instead of text
260
-			'email'   => __( 'Email', 'give' ),
261
-			'details' => __( 'Details', 'give' ),
262
-			'amount'  => __( 'Amount', 'give' ),
263
-			'status'  => __( 'Status', 'give' ),
264
-			'date'    => __( 'Date', 'give' ),
265
-			'donor'   => __( 'Donor', 'give' ),
266
-			'ID'      => __( 'ID', 'give' ),
260
+			'email'   => __('Email', 'give'),
261
+			'details' => __('Details', 'give'),
262
+			'amount'  => __('Amount', 'give'),
263
+			'status'  => __('Status', 'give'),
264
+			'date'    => __('Date', 'give'),
265
+			'donor'   => __('Donor', 'give'),
266
+			'ID'      => __('ID', 'give'),
267 267
 		);
268 268
 
269
-		return apply_filters( 'give_payments_table_columns', $columns );
269
+		return apply_filters('give_payments_table_columns', $columns);
270 270
 	}
271 271
 
272 272
 	/**
@@ -278,12 +278,12 @@  discard block
 block discarded – undo
278 278
 	 */
279 279
 	public function get_sortable_columns() {
280 280
 		$columns = array(
281
-			'ID'     => array( 'ID', true ),
282
-			'amount' => array( 'amount', false ),
283
-			'date'   => array( 'date', false )
281
+			'ID'     => array('ID', true),
282
+			'amount' => array('amount', false),
283
+			'date'   => array('date', false)
284 284
 		);
285 285
 
286
-		return apply_filters( 'give_payments_table_sortable_columns', $columns );
286
+		return apply_filters('give_payments_table_sortable_columns', $columns);
287 287
 	}
288 288
 
289 289
 	/**
@@ -297,30 +297,30 @@  discard block
 block discarded – undo
297 297
 	 *
298 298
 	 * @return string Column Name
299 299
 	 */
300
-	public function column_default( $payment, $column_name ) {
301
-		switch ( $column_name ) {
300
+	public function column_default($payment, $column_name) {
301
+		switch ($column_name) {
302 302
 			case 'amount' :
303
-				$amount = ! empty( $payment->total ) ? $payment->total : 0;
304
-				$value  = give_currency_filter( give_format_amount( $amount ), give_get_payment_currency_code( $payment->ID ) );
303
+				$amount = ! empty($payment->total) ? $payment->total : 0;
304
+				$value  = give_currency_filter(give_format_amount($amount), give_get_payment_currency_code($payment->ID));
305 305
 				break;
306 306
 			case 'date' :
307
-				$date  = strtotime( $payment->date );
308
-				$value = date_i18n( get_option( 'date_format' ), $date );
307
+				$date  = strtotime($payment->date);
308
+				$value = date_i18n(get_option('date_format'), $date);
309 309
 				break;
310 310
 			case 'status' :
311
-				$payment = get_post( $payment->ID );
312
-				$value   = '<div class="give-donation-status status-' . sanitize_title( give_get_payment_status( $payment, true ) ) . '"><span class="give-donation-status-icon"></span> ' . give_get_payment_status( $payment, true ) . '</div>';
311
+				$payment = get_post($payment->ID);
312
+				$value   = '<div class="give-donation-status status-'.sanitize_title(give_get_payment_status($payment, true)).'"><span class="give-donation-status-icon"></span> '.give_get_payment_status($payment, true).'</div>';
313 313
 				break;
314 314
 			case 'details' :
315
-				$value = '<div class="give-payment-details-link-wrap"><a href="' . esc_url( add_query_arg( 'id', $payment->ID, admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details' ) ) ) . '" class="give-payment-details-link button button-small">' . __( 'View Donation Details', 'give' ) . '</a></div>';
315
+				$value = '<div class="give-payment-details-link-wrap"><a href="'.esc_url(add_query_arg('id', $payment->ID, admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details'))).'" class="give-payment-details-link button button-small">'.__('View Donation Details', 'give').'</a></div>';
316 316
 				break;
317 317
 			default:
318
-				$value = isset( $payment->$column_name ) ? $payment->$column_name : '';
318
+				$value = isset($payment->$column_name) ? $payment->$column_name : '';
319 319
 				break;
320 320
 
321 321
 		}
322 322
 
323
-		return apply_filters( 'give_payments_table_column', $value, $payment->ID, $column_name );
323
+		return apply_filters('give_payments_table_column', $value, $payment->ID, $column_name);
324 324
 	}
325 325
 
326 326
 	/**
@@ -333,32 +333,32 @@  discard block
 block discarded – undo
333 333
 	 *
334 334
 	 * @return string Data shown in the Email column
335 335
 	 */
336
-	public function column_email( $payment ) {
336
+	public function column_email($payment) {
337 337
 
338 338
 		$row_actions = array();
339 339
 
340
-		if ( give_is_payment_complete( $payment->ID ) ) {
341
-			$row_actions['email_links'] = '<a href="' . add_query_arg( array(
340
+		if (give_is_payment_complete($payment->ID)) {
341
+			$row_actions['email_links'] = '<a href="'.add_query_arg(array(
342 342
 					'give-action' => 'email_links',
343 343
 					'purchase_id' => $payment->ID
344
-				), $this->base_url ) . '">' . __( 'Resend Donation Receipt', 'give' ) . '</a>';
344
+				), $this->base_url).'">'.__('Resend Donation Receipt', 'give').'</a>';
345 345
 
346 346
 		}
347 347
 
348
-		$row_actions['delete'] = '<a href="' . wp_nonce_url( add_query_arg( array(
348
+		$row_actions['delete'] = '<a href="'.wp_nonce_url(add_query_arg(array(
349 349
 				'give-action' => 'delete_payment',
350 350
 				'purchase_id' => $payment->ID
351
-			), $this->base_url ), 'give_payment_nonce' ) . '">' . __( 'Delete', 'give' ) . '</a>';
351
+			), $this->base_url), 'give_payment_nonce').'">'.__('Delete', 'give').'</a>';
352 352
 
353
-		$row_actions = apply_filters( 'give_payment_row_actions', $row_actions, $payment );
353
+		$row_actions = apply_filters('give_payment_row_actions', $row_actions, $payment);
354 354
 
355
-		if ( ! isset( $payment->user_info['email'] ) ) {
356
-			$payment->user_info['email'] = __( '(unknown)', 'give' );
355
+		if ( ! isset($payment->user_info['email'])) {
356
+			$payment->user_info['email'] = __('(unknown)', 'give');
357 357
 		}
358 358
 
359
-		$value = '<span class="give-email-column-value">' . $payment->user_info['email'] . '</span>' . $this->row_actions( $row_actions );
359
+		$value = '<span class="give-email-column-value">'.$payment->user_info['email'].'</span>'.$this->row_actions($row_actions);
360 360
 
361
-		return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'email' );
361
+		return apply_filters('give_payments_table_column', $value, $payment->ID, 'email');
362 362
 	}
363 363
 
364 364
 	/**
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
 	 *
372 372
 	 * @return string Displays a checkbox
373 373
 	 */
374
-	public function column_cb( $payment ) {
374
+	public function column_cb($payment) {
375 375
 		return sprintf(
376 376
 			'<input type="checkbox" name="%1$s[]" value="%2$s" />',
377 377
 			'payment',
@@ -389,8 +389,8 @@  discard block
 block discarded – undo
389 389
 	 *
390 390
 	 * @return string Displays a checkbox
391 391
 	 */
392
-	public function column_ID( $payment ) {
393
-		return '<span class="give-payment-id">' . give_get_payment_number( $payment->ID ) . '</span>';
392
+	public function column_ID($payment) {
393
+		return '<span class="give-payment-id">'.give_get_payment_number($payment->ID).'</span>';
394 394
 	}
395 395
 
396 396
 	/**
@@ -403,18 +403,18 @@  discard block
 block discarded – undo
403 403
 	 *
404 404
 	 * @return string Data shown in the User column
405 405
 	 */
406
-	public function column_donor( $payment ) {
406
+	public function column_donor($payment) {
407 407
 
408 408
 		//		$user_id = give_get_payment_user_id( $payment->ID );
409 409
 
410
-		$customer_id = give_get_payment_customer_id( $payment->ID );
411
-		$customer    = new Give_Customer( $customer_id );
410
+		$customer_id = give_get_payment_customer_id($payment->ID);
411
+		$customer    = new Give_Customer($customer_id);
412 412
 
413
-		$view_url = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer_id );
413
+		$view_url = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer_id);
414 414
 
415
-		$value = '<a href="' . esc_url( $view_url ) . '" data-tooltip="' . __( 'Click here to view this Donor\'s profile', 'give' ) . '">' . $customer->name . '</a>';
415
+		$value = '<a href="'.esc_url($view_url).'" data-tooltip="'.__('Click here to view this Donor\'s profile', 'give').'">'.$customer->name.'</a>';
416 416
 
417
-		return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'donor' );
417
+		return apply_filters('give_payments_table_column', $value, $payment->ID, 'donor');
418 418
 	}
419 419
 
420 420
 	/**
@@ -426,18 +426,18 @@  discard block
 block discarded – undo
426 426
 	 */
427 427
 	public function get_bulk_actions() {
428 428
 		$actions = array(
429
-			'delete'               => __( 'Delete', 'give' ),
430
-			'set-status-publish'   => __( 'Set To Completed', 'give' ),
431
-			'set-status-pending'   => __( 'Set To Pending', 'give' ),
432
-			'set-status-refunded'  => __( 'Set To Refunded', 'give' ),
433
-			'set-status-revoked'   => __( 'Set To Revoked', 'give' ),
434
-			'set-status-failed'    => __( 'Set To Failed', 'give' ),
435
-			'set-status-cancelled' => __( 'Set To Cancelled', 'give' ),
436
-			'set-status-abandoned' => __( 'Set To Abandoned', 'give' ),
437
-			'resend-receipt'       => __( 'Resend Email Receipts', 'give' )
429
+			'delete'               => __('Delete', 'give'),
430
+			'set-status-publish'   => __('Set To Completed', 'give'),
431
+			'set-status-pending'   => __('Set To Pending', 'give'),
432
+			'set-status-refunded'  => __('Set To Refunded', 'give'),
433
+			'set-status-revoked'   => __('Set To Revoked', 'give'),
434
+			'set-status-failed'    => __('Set To Failed', 'give'),
435
+			'set-status-cancelled' => __('Set To Cancelled', 'give'),
436
+			'set-status-abandoned' => __('Set To Abandoned', 'give'),
437
+			'resend-receipt'       => __('Resend Email Receipts', 'give')
438 438
 		);
439 439
 
440
-		return apply_filters( 'give_payments_table_bulk_actions', $actions );
440
+		return apply_filters('give_payments_table_bulk_actions', $actions);
441 441
 	}
442 442
 
443 443
 	/**
@@ -448,57 +448,57 @@  discard block
 block discarded – undo
448 448
 	 * @return void
449 449
 	 */
450 450
 	public function process_bulk_action() {
451
-		$ids    = isset( $_GET['payment'] ) ? $_GET['payment'] : false;
451
+		$ids    = isset($_GET['payment']) ? $_GET['payment'] : false;
452 452
 		$action = $this->current_action();
453 453
 
454
-		if ( ! is_array( $ids ) ) {
455
-			$ids = array( $ids );
454
+		if ( ! is_array($ids)) {
455
+			$ids = array($ids);
456 456
 		}
457 457
 
458
-		if ( empty( $action ) ) {
458
+		if (empty($action)) {
459 459
 			return;
460 460
 		}
461 461
 
462
-		foreach ( $ids as $id ) {
462
+		foreach ($ids as $id) {
463 463
 
464 464
 			// Detect when a bulk action is being triggered...
465
-			if ( 'delete' === $this->current_action() ) {
466
-				give_delete_purchase( $id );
465
+			if ('delete' === $this->current_action()) {
466
+				give_delete_purchase($id);
467 467
 			}
468 468
 
469
-			if ( 'set-status-publish' === $this->current_action() ) {
470
-				give_update_payment_status( $id, 'publish' );
469
+			if ('set-status-publish' === $this->current_action()) {
470
+				give_update_payment_status($id, 'publish');
471 471
 			}
472 472
 
473
-			if ( 'set-status-pending' === $this->current_action() ) {
474
-				give_update_payment_status( $id, 'pending' );
473
+			if ('set-status-pending' === $this->current_action()) {
474
+				give_update_payment_status($id, 'pending');
475 475
 			}
476 476
 
477
-			if ( 'set-status-refunded' === $this->current_action() ) {
478
-				give_update_payment_status( $id, 'refunded' );
477
+			if ('set-status-refunded' === $this->current_action()) {
478
+				give_update_payment_status($id, 'refunded');
479 479
 			}
480 480
 
481
-			if ( 'set-status-revoked' === $this->current_action() ) {
482
-				give_update_payment_status( $id, 'revoked' );
481
+			if ('set-status-revoked' === $this->current_action()) {
482
+				give_update_payment_status($id, 'revoked');
483 483
 			}
484 484
 
485
-			if ( 'set-status-failed' === $this->current_action() ) {
486
-				give_update_payment_status( $id, 'failed' );
485
+			if ('set-status-failed' === $this->current_action()) {
486
+				give_update_payment_status($id, 'failed');
487 487
 			}
488 488
 
489
-			if ( 'set-status-cancelled' === $this->current_action() ) {
490
-				give_update_payment_status( $id, 'cancelled' );
489
+			if ('set-status-cancelled' === $this->current_action()) {
490
+				give_update_payment_status($id, 'cancelled');
491 491
 			}
492 492
 
493
-			if ( 'set-status-abandoned' === $this->current_action() ) {
494
-				give_update_payment_status( $id, 'abandoned' );
493
+			if ('set-status-abandoned' === $this->current_action()) {
494
+				give_update_payment_status($id, 'abandoned');
495 495
 			}
496 496
 
497
-			if ( 'resend-receipt' === $this->current_action() ) {
498
-				give_email_donation_receipt( $id, false );
497
+			if ('resend-receipt' === $this->current_action()) {
498
+				give_email_donation_receipt($id, false);
499 499
 			}
500 500
 
501
-			do_action( 'give_payments_table_do_bulk_action', $id, $this->current_action() );
501
+			do_action('give_payments_table_do_bulk_action', $id, $this->current_action());
502 502
 		}
503 503
 
504 504
 	}
@@ -516,21 +516,21 @@  discard block
 block discarded – undo
516 516
 
517 517
 		$args = array();
518 518
 
519
-		if ( isset( $_GET['user'] ) ) {
520
-			$args['user'] = urldecode( $_GET['user'] );
521
-		} elseif ( isset( $_GET['s'] ) ) {
522
-			$args['s'] = urldecode( $_GET['s'] );
519
+		if (isset($_GET['user'])) {
520
+			$args['user'] = urldecode($_GET['user']);
521
+		} elseif (isset($_GET['s'])) {
522
+			$args['s'] = urldecode($_GET['s']);
523 523
 		}
524 524
 
525
-		if ( ! empty( $_GET['start-date'] ) ) {
526
-			$args['start-date'] = urldecode( $_GET['start-date'] );
525
+		if ( ! empty($_GET['start-date'])) {
526
+			$args['start-date'] = urldecode($_GET['start-date']);
527 527
 		}
528 528
 
529
-		if ( ! empty( $_GET['end-date'] ) ) {
530
-			$args['end-date'] = urldecode( $_GET['end-date'] );
529
+		if ( ! empty($_GET['end-date'])) {
530
+			$args['end-date'] = urldecode($_GET['end-date']);
531 531
 		}
532 532
 
533
-		$payment_count         = give_count_payments( $args );
533
+		$payment_count         = give_count_payments($args);
534 534
 		$this->complete_count  = $payment_count->publish;
535 535
 		$this->pending_count   = $payment_count->pending;
536 536
 		$this->refunded_count  = $payment_count->refunded;
@@ -539,7 +539,7 @@  discard block
 block discarded – undo
539 539
 		$this->cancelled_count = $payment_count->cancelled;
540 540
 		$this->abandoned_count = $payment_count->abandoned;
541 541
 
542
-		foreach ( $payment_count as $count ) {
542
+		foreach ($payment_count as $count) {
543 543
 			$this->total_count += $count;
544 544
 		}
545 545
 	}
@@ -554,26 +554,26 @@  discard block
 block discarded – undo
554 554
 	public function payments_data() {
555 555
 
556 556
 		$per_page   = $this->per_page;
557
-		$orderby    = isset( $_GET['orderby'] ) ? urldecode( $_GET['orderby'] ) : 'ID';
558
-		$order      = isset( $_GET['order'] ) ? $_GET['order'] : 'DESC';
559
-		$user       = isset( $_GET['user'] ) ? $_GET['user'] : null;
560
-		$status     = isset( $_GET['status'] ) ? $_GET['status'] : give_get_payment_status_keys();
561
-		$meta_key   = isset( $_GET['meta_key'] ) ? $_GET['meta_key'] : null;
562
-		$year       = isset( $_GET['year'] ) ? $_GET['year'] : null;
563
-		$month      = isset( $_GET['m'] ) ? $_GET['m'] : null;
564
-		$day        = isset( $_GET['day'] ) ? $_GET['day'] : null;
565
-		$search     = isset( $_GET['s'] ) ? sanitize_text_field( $_GET['s'] ) : null;
566
-		$start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null;
567
-		$end_date   = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : $start_date;
568
-
569
-		if ( ! empty( $search ) ) {
557
+		$orderby    = isset($_GET['orderby']) ? urldecode($_GET['orderby']) : 'ID';
558
+		$order      = isset($_GET['order']) ? $_GET['order'] : 'DESC';
559
+		$user       = isset($_GET['user']) ? $_GET['user'] : null;
560
+		$status     = isset($_GET['status']) ? $_GET['status'] : give_get_payment_status_keys();
561
+		$meta_key   = isset($_GET['meta_key']) ? $_GET['meta_key'] : null;
562
+		$year       = isset($_GET['year']) ? $_GET['year'] : null;
563
+		$month      = isset($_GET['m']) ? $_GET['m'] : null;
564
+		$day        = isset($_GET['day']) ? $_GET['day'] : null;
565
+		$search     = isset($_GET['s']) ? sanitize_text_field($_GET['s']) : null;
566
+		$start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null;
567
+		$end_date   = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : $start_date;
568
+
569
+		if ( ! empty($search)) {
570 570
 			$status = 'any'; // Force all payment statuses when searching
571 571
 		}
572 572
 
573 573
 		$args = array(
574 574
 			'output'     => 'payments',
575 575
 			'number'     => $per_page,
576
-			'page'       => isset( $_GET['paged'] ) ? $_GET['paged'] : null,
576
+			'page'       => isset($_GET['paged']) ? $_GET['paged'] : null,
577 577
 			'orderby'    => $orderby,
578 578
 			'order'      => $order,
579 579
 			'user'       => $user,
@@ -587,14 +587,14 @@  discard block
 block discarded – undo
587 587
 			'end_date'   => $end_date,
588 588
 		);
589 589
 
590
-		if ( is_string( $search ) && false !== strpos( $search, 'txn:' ) ) {
590
+		if (is_string($search) && false !== strpos($search, 'txn:')) {
591 591
 
592 592
 			$args['search_in_notes'] = true;
593
-			$args['s']               = trim( str_replace( 'txn:', '', $args['s'] ) );
593
+			$args['s']               = trim(str_replace('txn:', '', $args['s']));
594 594
 
595 595
 		}
596 596
 
597
-		$p_query = new Give_Payments_Query( $args );
597
+		$p_query = new Give_Payments_Query($args);
598 598
 
599 599
 		return $p_query->get_payments();
600 600
 
@@ -614,17 +614,17 @@  discard block
 block discarded – undo
614 614
 	 */
615 615
 	public function prepare_items() {
616 616
 
617
-		wp_reset_vars( array( 'action', 'payment', 'orderby', 'order', 's' ) );
617
+		wp_reset_vars(array('action', 'payment', 'orderby', 'order', 's'));
618 618
 
619 619
 		$columns  = $this->get_columns();
620 620
 		$hidden   = array(); // No hidden columns
621 621
 		$sortable = $this->get_sortable_columns();
622 622
 		$data     = $this->payments_data();
623
-		$status   = isset( $_GET['status'] ) ? $_GET['status'] : 'any';
623
+		$status   = isset($_GET['status']) ? $_GET['status'] : 'any';
624 624
 
625
-		$this->_column_headers = array( $columns, $hidden, $sortable );
625
+		$this->_column_headers = array($columns, $hidden, $sortable);
626 626
 
627
-		switch ( $status ) {
627
+		switch ($status) {
628 628
 			case 'publish':
629 629
 				$total_items = $this->complete_count;
630 630
 				break;
@@ -651,18 +651,18 @@  discard block
 block discarded – undo
651 651
 				break;
652 652
 			default:
653 653
 				// Retrieve the count of the non-default-Give status
654
-				$count       = wp_count_posts( 'give_payment' );
654
+				$count       = wp_count_posts('give_payment');
655 655
 				$total_items = $count->{$status};
656 656
 		}
657 657
 
658 658
 		$this->items = $data;
659 659
 
660
-		$this->set_pagination_args( array(
660
+		$this->set_pagination_args(array(
661 661
 				'total_items' => $total_items,
662 662
 				// WE have to calculate the total number of items
663 663
 				'per_page'    => $this->per_page,
664 664
 				// WE have to determine how many items to show on a page
665
-				'total_pages' => ceil( $total_items / $this->per_page )
665
+				'total_pages' => ceil($total_items / $this->per_page)
666 666
 				// WE have to calculate the total number of pages
667 667
 			)
668 668
 		);
Please login to merge, or discard this patch.
includes/post-types.php 1 patch
Spacing   +166 added lines, -166 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -23,40 +23,40 @@  discard block
 block discarded – undo
23 23
 function give_setup_post_types() {
24 24
 
25 25
 	/** Give Forms Post Type */
26
-	$give_forms_singular = give_get_option( 'disable_forms_singular' ) !== 'on' ? true : false;
26
+	$give_forms_singular = give_get_option('disable_forms_singular') !== 'on' ? true : false;
27 27
 
28
-	$give_forms_archives = give_get_option( 'disable_forms_archives' ) !== 'on' ? true : false;
28
+	$give_forms_archives = give_get_option('disable_forms_archives') !== 'on' ? true : false;
29 29
 
30
-	$give_forms_slug = defined( 'GIVE_SLUG' ) ? GIVE_SLUG : 'donations';
30
+	$give_forms_slug = defined('GIVE_SLUG') ? GIVE_SLUG : 'donations';
31 31
 	//support for old 'GIVE_FORMS_SLUG' constant
32
-	if ( defined( 'GIVE_FORMS_SLUG' ) ) {
32
+	if (defined('GIVE_FORMS_SLUG')) {
33 33
 		$give_forms_slug = GIVE_FORMS_SLUG;
34 34
 	}
35 35
 
36
-	$give_forms_rewrite = defined( 'GIVE_DISABLE_FORMS_REWRITE' ) && GIVE_DISABLE_FORMS_REWRITE ? false : array(
36
+	$give_forms_rewrite = defined('GIVE_DISABLE_FORMS_REWRITE') && GIVE_DISABLE_FORMS_REWRITE ? false : array(
37 37
 		'slug'       => $give_forms_slug,
38 38
 		'with_front' => false
39 39
 	);
40 40
 
41
-	$give_forms_labels = apply_filters( 'give_forms_labels', array(
42
-		'name'               => __( 'Donation %2$s', 'give' ),
41
+	$give_forms_labels = apply_filters('give_forms_labels', array(
42
+		'name'               => __('Donation %2$s', 'give'),
43 43
 		'singular_name'      => '%1$s',
44
-		'add_new'            => __( 'Add %1$s', 'give' ),
45
-		'add_new_item'       => __( 'Add New Donation %1$s', 'give' ),
46
-		'edit_item'          => __( 'Edit Donation %1$s', 'give' ),
47
-		'new_item'           => __( 'New %1$s', 'give' ),
48
-		'all_items'          => __( 'All %2$s', 'give' ),
49
-		'view_item'          => __( 'View %1$s', 'give' ),
50
-		'search_items'       => __( 'Search %2$s', 'give' ),
51
-		'not_found'          => __( 'No %2$s found', 'give' ),
52
-		'not_found_in_trash' => __( 'No %2$s found in Trash', 'give' ),
44
+		'add_new'            => __('Add %1$s', 'give'),
45
+		'add_new_item'       => __('Add New Donation %1$s', 'give'),
46
+		'edit_item'          => __('Edit Donation %1$s', 'give'),
47
+		'new_item'           => __('New %1$s', 'give'),
48
+		'all_items'          => __('All %2$s', 'give'),
49
+		'view_item'          => __('View %1$s', 'give'),
50
+		'search_items'       => __('Search %2$s', 'give'),
51
+		'not_found'          => __('No %2$s found', 'give'),
52
+		'not_found_in_trash' => __('No %2$s found in Trash', 'give'),
53 53
 		'parent_item_colon'  => '',
54
-		'menu_name'          => apply_filters( 'give_menu_name', __( 'Donations', 'give' ) ),
55
-		'name_admin_bar'     => apply_filters( 'give_name_admin_bar_name', __( 'Donation Form', 'give' ) )
56
-	) );
54
+		'menu_name'          => apply_filters('give_menu_name', __('Donations', 'give')),
55
+		'name_admin_bar'     => apply_filters('give_name_admin_bar_name', __('Donation Form', 'give'))
56
+	));
57 57
 
58
-	foreach ( $give_forms_labels as $key => $value ) {
59
-		$give_forms_labels[ $key ] = sprintf( $value, give_get_forms_label_singular(), give_get_forms_label_plural() );
58
+	foreach ($give_forms_labels as $key => $value) {
59
+		$give_forms_labels[$key] = sprintf($value, give_get_forms_label_singular(), give_get_forms_label_plural());
60 60
 	}
61 61
 
62 62
 	//Default give_forms supports
@@ -69,14 +69,14 @@  discard block
 block discarded – undo
69 69
 	);
70 70
 
71 71
 	//Has the user disabled the excerpt
72
-	if ( give_get_option( 'disable_forms_excerpt' ) === 'on' ) {
73
-		unset( $give_form_supports[2] );
72
+	if (give_get_option('disable_forms_excerpt') === 'on') {
73
+		unset($give_form_supports[2]);
74 74
 	}
75 75
 
76 76
 	//Has user disabled the featured image?
77
-	if ( give_get_option( 'disable_form_featured_img' ) === 'on' ) {
78
-		unset( $give_form_supports[1] );
79
-		remove_action( 'give_before_single_form_summary', 'give_show_form_images' );
77
+	if (give_get_option('disable_form_featured_img') === 'on') {
78
+		unset($give_form_supports[1]);
79
+		remove_action('give_before_single_form_summary', 'give_show_form_images');
80 80
 	}
81 81
 
82 82
 	$give_forms_args = array(
@@ -92,36 +92,36 @@  discard block
 block discarded – undo
92 92
 		'has_archive'        => $give_forms_archives,
93 93
 		'menu_icon'          => 'dashicons-give',
94 94
 		'hierarchical'       => false,
95
-		'supports'           => apply_filters( 'give_forms_supports', $give_form_supports ),
95
+		'supports'           => apply_filters('give_forms_supports', $give_form_supports),
96 96
 	);
97
-	register_post_type( 'give_forms', apply_filters( 'give_forms_post_type_args', $give_forms_args ) );
97
+	register_post_type('give_forms', apply_filters('give_forms_post_type_args', $give_forms_args));
98 98
 
99 99
 
100 100
 	/** Give Campaigns Post Type */
101
-	$give_campaigns_archives = defined( 'GIVE_DISABLE_CAMPAIGNS_ARCHIVE' ) && GIVE_DISABLE_CAMPAIGNS_ARCHIVE ? false : true;
102
-	$give_campaigns_slug     = defined( 'GIVE_CAMPAIGNS_SLUG' ) ? GIVE_CAMPAIGNS_SLUG : 'campaigns';
103
-	$give_campaigns_rewrite  = defined( 'GIVE_DISABLE_CAMPAIGNS_REWRITE' ) && GIVE_DISABLE_CAMPAIGNS_REWRITE ? false : array(
101
+	$give_campaigns_archives = defined('GIVE_DISABLE_CAMPAIGNS_ARCHIVE') && GIVE_DISABLE_CAMPAIGNS_ARCHIVE ? false : true;
102
+	$give_campaigns_slug     = defined('GIVE_CAMPAIGNS_SLUG') ? GIVE_CAMPAIGNS_SLUG : 'campaigns';
103
+	$give_campaigns_rewrite  = defined('GIVE_DISABLE_CAMPAIGNS_REWRITE') && GIVE_DISABLE_CAMPAIGNS_REWRITE ? false : array(
104 104
 		'slug'       => $give_campaigns_slug,
105 105
 		'with_front' => false
106 106
 	);
107 107
 
108
-	$give_campaigns_labels = apply_filters( 'give_campaign_labels', array(
108
+	$give_campaigns_labels = apply_filters('give_campaign_labels', array(
109 109
 		'name'               => '%2$s',
110 110
 		'singular_name'      => '%1$s',
111
-		'add_new'            => __( 'Add %1$s', 'give' ),
112
-		'add_new_item'       => __( 'Add New %1$s', 'give' ),
113
-		'edit_item'          => __( 'Edit %1$s', 'give' ),
114
-		'new_item'           => __( 'New %1$s', 'give' ),
115
-		'all_items'          => __( 'All %2$s', 'give' ),
116
-		'view_item'          => __( 'View %1$s', 'give' ),
117
-		'search_items'       => __( 'Search %2$s', 'give' ),
118
-		'not_found'          => __( 'No %2$s found', 'give' ),
119
-		'not_found_in_trash' => __( 'No %2$s found in Trash', 'give' ),
111
+		'add_new'            => __('Add %1$s', 'give'),
112
+		'add_new_item'       => __('Add New %1$s', 'give'),
113
+		'edit_item'          => __('Edit %1$s', 'give'),
114
+		'new_item'           => __('New %1$s', 'give'),
115
+		'all_items'          => __('All %2$s', 'give'),
116
+		'view_item'          => __('View %1$s', 'give'),
117
+		'search_items'       => __('Search %2$s', 'give'),
118
+		'not_found'          => __('No %2$s found', 'give'),
119
+		'not_found_in_trash' => __('No %2$s found in Trash', 'give'),
120 120
 		'parent_item_colon'  => '',
121
-	) );
121
+	));
122 122
 
123
-	foreach ( $give_campaigns_labels as $key => $value ) {
124
-		$give_campaigns_labels[ $key ] = sprintf( $value, give_get_campaigns_label_singular(), give_get_campaigns_label_plural() );
123
+	foreach ($give_campaigns_labels as $key => $value) {
124
+		$give_campaigns_labels[$key] = sprintf($value, give_get_campaigns_label_singular(), give_get_campaigns_label_plural());
125 125
 	}
126 126
 
127 127
 	$give_campaigns_args = array(
@@ -136,48 +136,48 @@  discard block
 block discarded – undo
136 136
 		'capability_type'    => 'give_campaigns',
137 137
 		'has_archive'        => $give_campaigns_archives,
138 138
 		'hierarchical'       => false,
139
-		'supports'           => apply_filters( 'give_campaigns_supports', array(
139
+		'supports'           => apply_filters('give_campaigns_supports', array(
140 140
 			'title',
141 141
 			'thumbnail',
142 142
 			'excerpt',
143 143
 			'revisions',
144 144
 			'author'
145
-		) ),
145
+		)),
146 146
 	);
147 147
 	//	register_post_type( 'give_campaigns', apply_filters( 'give_campaigns_post_type_args', $give_campaigns_args ) );
148 148
 
149 149
 	/** Payment Post Type */
150 150
 	$payment_labels = array(
151
-		'name'               => _x( 'Donations', 'post type general name', 'give' ),
152
-		'singular_name'      => _x( 'Donation', 'post type singular name', 'give' ),
153
-		'add_new'            => __( 'Add New', 'give' ),
154
-		'add_new_item'       => __( 'Add New Donation', 'give' ),
155
-		'edit_item'          => __( 'Edit Donation', 'give' ),
156
-		'new_item'           => __( 'New Donation', 'give' ),
157
-		'all_items'          => __( 'All Donations', 'give' ),
158
-		'view_item'          => __( 'View Donation', 'give' ),
159
-		'search_items'       => __( 'Search Donations', 'give' ),
160
-		'not_found'          => __( 'No Donations found', 'give' ),
161
-		'not_found_in_trash' => __( 'No Donations found in Trash', 'give' ),
151
+		'name'               => _x('Donations', 'post type general name', 'give'),
152
+		'singular_name'      => _x('Donation', 'post type singular name', 'give'),
153
+		'add_new'            => __('Add New', 'give'),
154
+		'add_new_item'       => __('Add New Donation', 'give'),
155
+		'edit_item'          => __('Edit Donation', 'give'),
156
+		'new_item'           => __('New Donation', 'give'),
157
+		'all_items'          => __('All Donations', 'give'),
158
+		'view_item'          => __('View Donation', 'give'),
159
+		'search_items'       => __('Search Donations', 'give'),
160
+		'not_found'          => __('No Donations found', 'give'),
161
+		'not_found_in_trash' => __('No Donations found in Trash', 'give'),
162 162
 		'parent_item_colon'  => '',
163
-		'menu_name'          => __( 'Transactions', 'give' )
163
+		'menu_name'          => __('Transactions', 'give')
164 164
 	);
165 165
 
166 166
 	$payment_args = array(
167
-		'labels'          => apply_filters( 'give_payment_labels', $payment_labels ),
167
+		'labels'          => apply_filters('give_payment_labels', $payment_labels),
168 168
 		'public'          => false,
169 169
 		'query_var'       => false,
170 170
 		'rewrite'         => false,
171 171
 		'map_meta_cap'    => true,
172 172
 		'capability_type' => 'give_payment',
173
-		'supports'        => array( 'title' ),
173
+		'supports'        => array('title'),
174 174
 		'can_export'      => true
175 175
 	);
176
-	register_post_type( 'give_payment', $payment_args );
176
+	register_post_type('give_payment', $payment_args);
177 177
 
178 178
 }
179 179
 
180
-add_action( 'init', 'give_setup_post_types', 1 );
180
+add_action('init', 'give_setup_post_types', 1);
181 181
 
182 182
 
183 183
 /**
@@ -190,30 +190,30 @@  discard block
 block discarded – undo
190 190
  */
191 191
 function give_setup_taxonomies() {
192 192
 
193
-	$slug = defined( 'GIVE_FORMS_SLUG' ) ? GIVE_FORMS_SLUG : 'donations';
193
+	$slug = defined('GIVE_FORMS_SLUG') ? GIVE_FORMS_SLUG : 'donations';
194 194
 
195 195
 	/** Categories */
196 196
 	$category_labels = array(
197
-		'name'              => sprintf( _x( '%s Categories', 'taxonomy general name', 'give' ), give_get_forms_label_singular() ),
198
-		'singular_name'     => _x( 'Category', 'taxonomy singular name', 'give' ),
199
-		'search_items'      => __( 'Search Categories', 'give' ),
200
-		'all_items'         => __( 'All Categories', 'give' ),
201
-		'parent_item'       => __( 'Parent Category', 'give' ),
202
-		'parent_item_colon' => __( 'Parent Category:', 'give' ),
203
-		'edit_item'         => __( 'Edit Category', 'give' ),
204
-		'update_item'       => __( 'Update Category', 'give' ),
205
-		'add_new_item'      => sprintf( __( 'Add New %s Category', 'give' ), give_get_forms_label_singular() ),
206
-		'new_item_name'     => __( 'New Category Name', 'give' ),
207
-		'menu_name'         => __( 'Categories', 'give' ),
197
+		'name'              => sprintf(_x('%s Categories', 'taxonomy general name', 'give'), give_get_forms_label_singular()),
198
+		'singular_name'     => _x('Category', 'taxonomy singular name', 'give'),
199
+		'search_items'      => __('Search Categories', 'give'),
200
+		'all_items'         => __('All Categories', 'give'),
201
+		'parent_item'       => __('Parent Category', 'give'),
202
+		'parent_item_colon' => __('Parent Category:', 'give'),
203
+		'edit_item'         => __('Edit Category', 'give'),
204
+		'update_item'       => __('Update Category', 'give'),
205
+		'add_new_item'      => sprintf(__('Add New %s Category', 'give'), give_get_forms_label_singular()),
206
+		'new_item_name'     => __('New Category Name', 'give'),
207
+		'menu_name'         => __('Categories', 'give'),
208 208
 	);
209 209
 
210
-	$category_args = apply_filters( 'give_forms_category_args', array(
210
+	$category_args = apply_filters('give_forms_category_args', array(
211 211
 			'hierarchical' => true,
212
-			'labels'       => apply_filters( 'give_forms_category_labels', $category_labels ),
212
+			'labels'       => apply_filters('give_forms_category_labels', $category_labels),
213 213
 			'show_ui'      => true,
214 214
 			'query_var'    => 'give_forms_category',
215 215
 			'rewrite'      => array(
216
-				'slug'         => $slug . '/category',
216
+				'slug'         => $slug.'/category',
217 217
 				'with_front'   => false,
218 218
 				'hierarchical' => true
219 219
 			),
@@ -227,34 +227,34 @@  discard block
 block discarded – undo
227 227
 	);
228 228
 
229 229
 	//Does the user want categories?
230
-	if ( give_get_option( 'enable_categories' ) == 'on' ) {
231
-		register_taxonomy( 'give_forms_category', array( 'give_forms' ), $category_args );
232
-		register_taxonomy_for_object_type( 'give_forms_category', 'give_forms' );
230
+	if (give_get_option('enable_categories') == 'on') {
231
+		register_taxonomy('give_forms_category', array('give_forms'), $category_args);
232
+		register_taxonomy_for_object_type('give_forms_category', 'give_forms');
233 233
 	}
234 234
 
235 235
 
236 236
 	/** Tags */
237 237
 	$tag_labels = array(
238
-		'name'                  => sprintf( _x( '%s Tags', 'taxonomy general name', 'give' ), give_get_forms_label_singular() ),
239
-		'singular_name'         => _x( 'Tag', 'taxonomy singular name', 'give' ),
240
-		'search_items'          => __( 'Search Tags', 'give' ),
241
-		'all_items'             => __( 'All Tags', 'give' ),
242
-		'parent_item'           => __( 'Parent Tag', 'give' ),
243
-		'parent_item_colon'     => __( 'Parent Tag:', 'give' ),
244
-		'edit_item'             => __( 'Edit Tag', 'give' ),
245
-		'update_item'           => __( 'Update Tag', 'give' ),
246
-		'add_new_item'          => __( 'Add New Tag', 'give' ),
247
-		'new_item_name'         => __( 'New Tag Name', 'give' ),
248
-		'menu_name'             => __( 'Tags', 'give' ),
249
-		'choose_from_most_used' => sprintf( __( 'Choose from most used %s tags', 'give' ), give_get_forms_label_singular() ),
238
+		'name'                  => sprintf(_x('%s Tags', 'taxonomy general name', 'give'), give_get_forms_label_singular()),
239
+		'singular_name'         => _x('Tag', 'taxonomy singular name', 'give'),
240
+		'search_items'          => __('Search Tags', 'give'),
241
+		'all_items'             => __('All Tags', 'give'),
242
+		'parent_item'           => __('Parent Tag', 'give'),
243
+		'parent_item_colon'     => __('Parent Tag:', 'give'),
244
+		'edit_item'             => __('Edit Tag', 'give'),
245
+		'update_item'           => __('Update Tag', 'give'),
246
+		'add_new_item'          => __('Add New Tag', 'give'),
247
+		'new_item_name'         => __('New Tag Name', 'give'),
248
+		'menu_name'             => __('Tags', 'give'),
249
+		'choose_from_most_used' => sprintf(__('Choose from most used %s tags', 'give'), give_get_forms_label_singular()),
250 250
 	);
251 251
 
252
-	$tag_args = apply_filters( 'give_forms_tag_args', array(
252
+	$tag_args = apply_filters('give_forms_tag_args', array(
253 253
 			'hierarchical' => false,
254
-			'labels'       => apply_filters( 'give_forms_tag_labels', $tag_labels ),
254
+			'labels'       => apply_filters('give_forms_tag_labels', $tag_labels),
255 255
 			'show_ui'      => true,
256 256
 			'query_var'    => 'give_forms_tag',
257
-			'rewrite'      => array( 'slug' => $slug . '/tag', 'with_front' => false, 'hierarchical' => true ),
257
+			'rewrite'      => array('slug' => $slug.'/tag', 'with_front' => false, 'hierarchical' => true),
258 258
 			'capabilities' => array(
259 259
 				'manage_terms' => 'manage_give_forms_terms',
260 260
 				'edit_terms'   => 'edit_give_forms_terms',
@@ -265,15 +265,15 @@  discard block
 block discarded – undo
265 265
 		)
266 266
 	);
267 267
 
268
-	if ( give_get_option( 'enable_tags' ) == 'on' ) {
269
-		register_taxonomy( 'give_forms_tag', array( 'give_forms' ), $tag_args );
270
-		register_taxonomy_for_object_type( 'give_forms_tag', 'give_forms' );
268
+	if (give_get_option('enable_tags') == 'on') {
269
+		register_taxonomy('give_forms_tag', array('give_forms'), $tag_args);
270
+		register_taxonomy_for_object_type('give_forms_tag', 'give_forms');
271 271
 	}
272 272
 
273 273
 
274 274
 }
275 275
 
276
-add_action( 'init', 'give_setup_taxonomies', 0 );
276
+add_action('init', 'give_setup_taxonomies', 0);
277 277
 
278 278
 
279 279
 /**
@@ -284,11 +284,11 @@  discard block
 block discarded – undo
284 284
  */
285 285
 function give_get_default_form_labels() {
286 286
 	$defaults = array(
287
-		'singular' => __( 'Form', 'give' ),
288
-		'plural'   => __( 'Forms', 'give' )
287
+		'singular' => __('Form', 'give'),
288
+		'plural'   => __('Forms', 'give')
289 289
 	);
290 290
 
291
-	return apply_filters( 'give_default_form_name', $defaults );
291
+	return apply_filters('give_default_form_name', $defaults);
292 292
 }
293 293
 
294 294
 /**
@@ -299,11 +299,11 @@  discard block
 block discarded – undo
299 299
  */
300 300
 function give_get_default_campaign_labels() {
301 301
 	$defaults = array(
302
-		'singular' => __( 'Campaign', 'give' ),
303
-		'plural'   => __( 'Campaigns', 'give' )
302
+		'singular' => __('Campaign', 'give'),
303
+		'plural'   => __('Campaigns', 'give')
304 304
 	);
305 305
 
306
-	return apply_filters( 'give_default_campaign_name', $defaults );
306
+	return apply_filters('give_default_campaign_name', $defaults);
307 307
 }
308 308
 
309 309
 /**
@@ -315,10 +315,10 @@  discard block
 block discarded – undo
315 315
  *
316 316
  * @return string $defaults['singular'] Singular label
317 317
  */
318
-function give_get_forms_label_singular( $lowercase = false ) {
318
+function give_get_forms_label_singular($lowercase = false) {
319 319
 	$defaults = give_get_default_form_labels();
320 320
 
321
-	return ( $lowercase ) ? strtolower( $defaults['singular'] ) : $defaults['singular'];
321
+	return ($lowercase) ? strtolower($defaults['singular']) : $defaults['singular'];
322 322
 }
323 323
 
324 324
 /**
@@ -327,10 +327,10 @@  discard block
 block discarded – undo
327 327
  * @since 1.0
328 328
  * @return string $defaults['plural'] Plural label
329 329
  */
330
-function give_get_forms_label_plural( $lowercase = false ) {
330
+function give_get_forms_label_plural($lowercase = false) {
331 331
 	$defaults = give_get_default_form_labels();
332 332
 
333
-	return ( $lowercase ) ? strtolower( $defaults['plural'] ) : $defaults['plural'];
333
+	return ($lowercase) ? strtolower($defaults['plural']) : $defaults['plural'];
334 334
 }
335 335
 
336 336
 /**
@@ -342,10 +342,10 @@  discard block
 block discarded – undo
342 342
  *
343 343
  * @return string $defaults['singular'] Singular label
344 344
  */
345
-function give_get_campaigns_label_singular( $lowercase = false ) {
345
+function give_get_campaigns_label_singular($lowercase = false) {
346 346
 	$defaults = give_get_default_campaign_labels();
347 347
 
348
-	return ( $lowercase ) ? strtolower( $defaults['singular'] ) : $defaults['singular'];
348
+	return ($lowercase) ? strtolower($defaults['singular']) : $defaults['singular'];
349 349
 }
350 350
 
351 351
 /**
@@ -354,10 +354,10 @@  discard block
 block discarded – undo
354 354
  * @since 1.0
355 355
  * @return string $defaults['plural'] Plural label
356 356
  */
357
-function give_get_campaigns_label_plural( $lowercase = false ) {
357
+function give_get_campaigns_label_plural($lowercase = false) {
358 358
 	$defaults = give_get_default_campaign_labels();
359 359
 
360
-	return ( $lowercase ) ? strtolower( $defaults['plural'] ) : $defaults['plural'];
360
+	return ($lowercase) ? strtolower($defaults['plural']) : $defaults['plural'];
361 361
 }
362 362
 
363 363
 /**
@@ -369,26 +369,26 @@  discard block
 block discarded – undo
369 369
  *
370 370
  * @return string $title New placeholder text
371 371
  */
372
-function give_change_default_title( $title ) {
372
+function give_change_default_title($title) {
373 373
 	// If a frontend plugin uses this filter (check extensions before changing this function)
374
-	if ( ! is_admin() ) {
374
+	if ( ! is_admin()) {
375 375
 		$label = give_get_forms_label_singular();
376
-		$title = sprintf( __( 'Enter %s title here', 'give' ), $label );
376
+		$title = sprintf(__('Enter %s title here', 'give'), $label);
377 377
 
378 378
 		return $title;
379 379
 	}
380 380
 
381 381
 	$screen = get_current_screen();
382 382
 
383
-	if ( 'give_forms' == $screen->post_type ) {
383
+	if ('give_forms' == $screen->post_type) {
384 384
 		$label = give_get_forms_label_singular();
385
-		$title = sprintf( __( 'Enter %s title here', 'give' ), $label );
385
+		$title = sprintf(__('Enter %s title here', 'give'), $label);
386 386
 	}
387 387
 
388 388
 	return $title;
389 389
 }
390 390
 
391
-add_filter( 'enter_title_here', 'give_change_default_title' );
391
+add_filter('enter_title_here', 'give_change_default_title');
392 392
 
393 393
 /**
394 394
  * Registers Custom Post Statuses which are used by the Payments
@@ -398,50 +398,50 @@  discard block
 block discarded – undo
398 398
  */
399 399
 function give_register_post_type_statuses() {
400 400
 	// Payment Statuses
401
-	register_post_status( 'refunded', array(
402
-		'label'                     => _x( 'Refunded', 'Refunded payment status', 'give' ),
401
+	register_post_status('refunded', array(
402
+		'label'                     => _x('Refunded', 'Refunded payment status', 'give'),
403 403
 		'public'                    => true,
404 404
 		'exclude_from_search'       => false,
405 405
 		'show_in_admin_all_list'    => true,
406 406
 		'show_in_admin_status_list' => true,
407
-		'label_count'               => _n_noop( 'Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'give' )
408
-	) );
409
-	register_post_status( 'failed', array(
410
-		'label'                     => _x( 'Failed', 'Failed payment status', 'give' ),
407
+		'label_count'               => _n_noop('Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'give')
408
+	));
409
+	register_post_status('failed', array(
410
+		'label'                     => _x('Failed', 'Failed payment status', 'give'),
411 411
 		'public'                    => true,
412 412
 		'exclude_from_search'       => false,
413 413
 		'show_in_admin_all_list'    => true,
414 414
 		'show_in_admin_status_list' => true,
415
-		'label_count'               => _n_noop( 'Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'give' )
416
-	) );
417
-	register_post_status( 'revoked', array(
418
-		'label'                     => _x( 'Revoked', 'Revoked payment status', 'give' ),
415
+		'label_count'               => _n_noop('Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'give')
416
+	));
417
+	register_post_status('revoked', array(
418
+		'label'                     => _x('Revoked', 'Revoked payment status', 'give'),
419 419
 		'public'                    => true,
420 420
 		'exclude_from_search'       => false,
421 421
 		'show_in_admin_all_list'    => true,
422 422
 		'show_in_admin_status_list' => true,
423
-		'label_count'               => _n_noop( 'Revoked <span class="count">(%s)</span>', 'Revoked <span class="count">(%s)</span>', 'give' )
424
-	) );
425
-	register_post_status( 'cancelled', array(
426
-		'label'                     => _x( 'Cancelled', 'Cancelled payment status', 'give' ),
423
+		'label_count'               => _n_noop('Revoked <span class="count">(%s)</span>', 'Revoked <span class="count">(%s)</span>', 'give')
424
+	));
425
+	register_post_status('cancelled', array(
426
+		'label'                     => _x('Cancelled', 'Cancelled payment status', 'give'),
427 427
 		'public'                    => true,
428 428
 		'exclude_from_search'       => false,
429 429
 		'show_in_admin_all_list'    => true,
430 430
 		'show_in_admin_status_list' => true,
431
-		'label_count'               => _n_noop( 'Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'give' )
432
-	) );
433
-	register_post_status( 'abandoned', array(
434
-		'label'                     => _x( 'Abandoned', 'Abandoned payment status', 'give' ),
431
+		'label_count'               => _n_noop('Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'give')
432
+	));
433
+	register_post_status('abandoned', array(
434
+		'label'                     => _x('Abandoned', 'Abandoned payment status', 'give'),
435 435
 		'public'                    => true,
436 436
 		'exclude_from_search'       => false,
437 437
 		'show_in_admin_all_list'    => true,
438 438
 		'show_in_admin_status_list' => true,
439
-		'label_count'               => _n_noop( 'Abandoned <span class="count">(%s)</span>', 'Abandoned <span class="count">(%s)</span>', 'give' )
440
-	) );
439
+		'label_count'               => _n_noop('Abandoned <span class="count">(%s)</span>', 'Abandoned <span class="count">(%s)</span>', 'give')
440
+	));
441 441
 
442 442
 }
443 443
 
444
-add_action( 'init', 'give_register_post_type_statuses' );
444
+add_action('init', 'give_register_post_type_statuses');
445 445
 
446 446
 /**
447 447
  * Updated Messages
@@ -454,45 +454,45 @@  discard block
 block discarded – undo
454 454
  *
455 455
  * @return array $messages New post updated messages
456 456
  */
457
-function give_updated_messages( $messages ) {
457
+function give_updated_messages($messages) {
458 458
 	global $post, $post_ID;
459 459
 
460
-	$url1 = '<a href="' . get_permalink( $post_ID ) . '">';
460
+	$url1 = '<a href="'.get_permalink($post_ID).'">';
461 461
 	$url2 = give_get_forms_label_singular();
462 462
 	$url3 = '</a>';
463 463
 
464 464
 	$messages['give_forms'] = array(
465
-		1 => sprintf( __( '%2$s updated. %1$sView %2$s%3$s.', 'give' ), $url1, $url2, $url3 ),
466
-		4 => sprintf( __( '%2$s updated. %1$sView %2$s%3$s.', 'give' ), $url1, $url2, $url3 ),
467
-		6 => sprintf( __( '%2$s published. %1$sView %2$s%3$s.', 'give' ), $url1, $url2, $url3 ),
468
-		7 => sprintf( __( '%2$s saved. %1$sView %2$s%3$s.', 'give' ), $url1, $url2, $url3 ),
469
-		8 => sprintf( __( '%2$s submitted. %1$sView %2$s%3$s.', 'give' ), $url1, $url2, $url3 )
465
+		1 => sprintf(__('%2$s updated. %1$sView %2$s%3$s.', 'give'), $url1, $url2, $url3),
466
+		4 => sprintf(__('%2$s updated. %1$sView %2$s%3$s.', 'give'), $url1, $url2, $url3),
467
+		6 => sprintf(__('%2$s published. %1$sView %2$s%3$s.', 'give'), $url1, $url2, $url3),
468
+		7 => sprintf(__('%2$s saved. %1$sView %2$s%3$s.', 'give'), $url1, $url2, $url3),
469
+		8 => sprintf(__('%2$s submitted. %1$sView %2$s%3$s.', 'give'), $url1, $url2, $url3)
470 470
 	);
471 471
 
472 472
 	return $messages;
473 473
 }
474 474
 
475
-add_filter( 'post_updated_messages', 'give_updated_messages' );
475
+add_filter('post_updated_messages', 'give_updated_messages');
476 476
 
477 477
 
478 478
 /**
479 479
  * Setup Post Type Images
480 480
  */
481
-add_action( 'after_setup_theme', 'give_add_thumbnail_support', 10 );
482
-add_action( 'after_setup_theme', 'give_add_image_sizes', 10 );
481
+add_action('after_setup_theme', 'give_add_thumbnail_support', 10);
482
+add_action('after_setup_theme', 'give_add_image_sizes', 10);
483 483
 
484 484
 /**
485 485
  * Ensure post thumbnail support is turned on
486 486
  */
487 487
 function give_add_thumbnail_support() {
488
-	if ( give_get_option( 'disable_form_featured_img' ) === 'on' ) {
488
+	if (give_get_option('disable_form_featured_img') === 'on') {
489 489
 		return;
490 490
 	}
491
-	if ( ! current_theme_supports( 'post-thumbnails' ) ) {
492
-		add_theme_support( 'post-thumbnails' );
491
+	if ( ! current_theme_supports('post-thumbnails')) {
492
+		add_theme_support('post-thumbnails');
493 493
 	}
494
-	add_post_type_support( 'give_forms', 'thumbnail' );
495
-	add_post_type_support( 'give_campaigns', 'thumbnail' );
494
+	add_post_type_support('give_forms', 'thumbnail');
495
+	add_post_type_support('give_campaigns', 'thumbnail');
496 496
 }
497 497
 
498 498
 /**
@@ -501,11 +501,11 @@  discard block
 block discarded – undo
501 501
  * @since 1.0
502 502
  */
503 503
 function give_add_image_sizes() {
504
-	$give_form_thumbnail = give_get_image_size( 'give_form_thumbnail' );
505
-	$give_form_single    = give_get_image_size( 'give_form_single' );
504
+	$give_form_thumbnail = give_get_image_size('give_form_thumbnail');
505
+	$give_form_single    = give_get_image_size('give_form_single');
506 506
 
507
-	add_image_size( 'give_form_thumbnail', $give_form_thumbnail['width'], $give_form_thumbnail['height'], $give_form_thumbnail['crop'] );
508
-	add_image_size( 'give_form_single', $give_form_single['width'], $give_form_single['height'], $give_form_single['crop'] );
507
+	add_image_size('give_form_thumbnail', $give_form_thumbnail['width'], $give_form_thumbnail['height'], $give_form_thumbnail['crop']);
508
+	add_image_size('give_form_single', $give_form_single['width'], $give_form_single['height'], $give_form_single['crop']);
509 509
 }
510 510
 
511 511
 /**
@@ -517,19 +517,19 @@  discard block
 block discarded – undo
517 517
 function give_widgets_init() {
518 518
 
519 519
 	//Single Give Forms (disabled if single turned off in settings)
520
-	if ( give_get_option( 'disable_forms_singular' ) !== 'on' && give_get_option( 'disable_form_sidebar' ) !== 'on' ) {
520
+	if (give_get_option('disable_forms_singular') !== 'on' && give_get_option('disable_form_sidebar') !== 'on') {
521 521
 
522
-		register_sidebar( apply_filters( 'give_forms_single_sidebar', array(
523
-			'name'          => __( 'Give Single Form Sidebar', 'give' ),
522
+		register_sidebar(apply_filters('give_forms_single_sidebar', array(
523
+			'name'          => __('Give Single Form Sidebar', 'give'),
524 524
 			'id'            => 'give-forms-sidebar',
525
-			'description'   => __( 'Widgets in this area will be shown on the single Give forms aside area. This sidebar will not display for embedded forms.', 'give' ),
525
+			'description'   => __('Widgets in this area will be shown on the single Give forms aside area. This sidebar will not display for embedded forms.', 'give'),
526 526
 			'before_widget' => '<div id="%1$s" class="widget %2$s">',
527 527
 			'after_widget'  => '</div>',
528 528
 			'before_title'  => '<h3 class="widgettitle widget-title">',
529 529
 			'after_title'   => '</h3>',
530
-		) ) );
530
+		)));
531 531
 
532 532
 	}
533 533
 }
534 534
 
535
-add_action( 'widgets_init', 'give_widgets_init', 999 );
535
+add_action('widgets_init', 'give_widgets_init', 999);
Please login to merge, or discard this patch.