Test Failed
Pull Request — master (#1937)
by
unknown
05:41
created
includes/admin/payments/class-payments-table.php 1 patch
Spacing   +199 added lines, -199 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
 /**
@@ -126,15 +126,15 @@  discard block
 block discarded – undo
126 126
 	public function __construct() {
127 127
 
128 128
 		// Set parent defaults.
129
-		parent::__construct( array(
130
-			'singular' => give_get_forms_label_singular(),    // Singular name of the listed records.
131
-			'plural'   => give_get_forms_label_plural(),      // Plural name of the listed records.
132
-			'ajax'     => false,                              // Does this table support ajax?
133
-		) );
129
+		parent::__construct(array(
130
+			'singular' => give_get_forms_label_singular(), // Singular name of the listed records.
131
+			'plural'   => give_get_forms_label_plural(), // Plural name of the listed records.
132
+			'ajax'     => false, // Does this table support ajax?
133
+		));
134 134
 
135 135
 		$this->process_bulk_action();
136 136
 		$this->get_payment_counts();
137
-		$this->base_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' );
137
+		$this->base_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history');
138 138
 	}
139 139
 
140 140
 	/**
@@ -143,54 +143,54 @@  discard block
 block discarded – undo
143 143
 	 * @return void
144 144
 	 */
145 145
 	public function advanced_filters() {
146
-		$start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null;
147
-		$end_date   = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : null;
148
-		$status     = isset( $_GET['status'] ) ? sanitize_text_field( $_GET['status'] ) : '';
149
-		$donor      = isset( $_GET['donor'] ) ? sanitize_text_field( $_GET['donor'] ) : '';
150
-		$search     = isset( $_GET['s'] ) ? sanitize_text_field( $_GET['s'] ) : '';
151
-		$form_id    = ! empty( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : 0;
146
+		$start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null;
147
+		$end_date   = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : null;
148
+		$status     = isset($_GET['status']) ? sanitize_text_field($_GET['status']) : '';
149
+		$donor      = isset($_GET['donor']) ? sanitize_text_field($_GET['donor']) : '';
150
+		$search     = isset($_GET['s']) ? sanitize_text_field($_GET['s']) : '';
151
+		$form_id    = ! empty($_GET['form_id']) ? absint($_GET['form_id']) : 0;
152 152
 		?>
153 153
 		<div id="give-payment-filters" class="give-filters">
154
-			<?php $this->search_box( esc_html__( 'Search', 'give' ), 'give-payments' ); ?>
154
+			<?php $this->search_box(esc_html__('Search', 'give'), 'give-payments'); ?>
155 155
 			<div id="give-payment-date-filters">
156 156
 				<div class="give-filter give-filter-half">
157 157
 					<label for="start-date"
158
-					       class="give-start-date-label"><?php esc_html_e( 'Start Date', 'give' ); ?></label>
158
+					       class="give-start-date-label"><?php esc_html_e('Start Date', 'give'); ?></label>
159 159
 					<input type="text" id="start-date" name="start-date" class="give_datepicker"
160 160
 				       value="<?php echo $start_date; ?>" placeholder="mm/dd/yyyy" />
161 161
 				</div>
162 162
 				<div class="give-filter give-filter-half">
163
-					<label for="end-date" class="give-end-date-label"><?php esc_html_e( 'End Date', 'give' ); ?></label>
163
+					<label for="end-date" class="give-end-date-label"><?php esc_html_e('End Date', 'give'); ?></label>
164 164
 					<input type="text" id="end-date" name="end-date" class="give_datepicker"
165 165
 				       value="<?php echo $end_date; ?>" placeholder="mm/dd/yyyy" />
166 166
 		       </div>
167 167
 			</div>
168 168
 			<div id="give-payment-form-filter" class="give-filter">
169 169
 				<label for="-date"
170
-				       class="give-start-date-label"><?php esc_html_e( 'Form', 'give' ); ?></label>
170
+				       class="give-start-date-label"><?php esc_html_e('Form', 'give'); ?></label>
171 171
 				<?php
172 172
 				// Filter Donations by Donation Forms.
173
-				echo Give()->html->forms_dropdown( array(
173
+				echo Give()->html->forms_dropdown(array(
174 174
 					'name'     => 'form_id',
175 175
 					'class'    => 'give-donation-forms-filter',
176 176
 					'selected' => $form_id, // Make sure to have $form_id set to 0, if there is no selection.
177 177
 					'chosen'   => true,
178
-					'number'   => - 1,
179
-				) );
178
+					'number'   => -1,
179
+				));
180 180
 				?>
181 181
 			</div>
182 182
 
183
-			<?php if ( ! empty( $status ) ) : ?>
184
-				<input type="hidden" name="status" value="<?php echo esc_attr( $status ); ?>" />
183
+			<?php if ( ! empty($status)) : ?>
184
+				<input type="hidden" name="status" value="<?php echo esc_attr($status); ?>" />
185 185
 			<?php endif; ?>
186 186
 
187 187
 			<div class="give-filter">
188
-				<?php submit_button( __( 'Apply', 'give' ), 'secondary', '', false ); ?>
188
+				<?php submit_button(__('Apply', 'give'), 'secondary', '', false); ?>
189 189
 				<?php
190 190
 				// Clear active filters button.
191
-				if ( ! empty( $start_date ) || ! empty( $end_date ) || ! empty( $donor ) || ! empty( $search ) || ! empty( $status ) || ! empty( $form_id ) ) : ?>
192
-					<a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>"
193
-					   class="button give-clear-filters-button"><?php esc_html_e( 'Clear Filters', 'give' ); ?></a>
191
+				if ( ! empty($start_date) || ! empty($end_date) || ! empty($donor) || ! empty($search) || ! empty($status) || ! empty($form_id)) : ?>
192
+					<a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>"
193
+					   class="button give-clear-filters-button"><?php esc_html_e('Clear Filters', 'give'); ?></a>
194 194
 				<?php endif; ?>
195 195
 			</div>
196 196
 		</div>
@@ -209,18 +209,18 @@  discard block
 block discarded – undo
209 209
 	 *
210 210
 	 * @return void
211 211
 	 */
212
-	public function search_box( $text, $input_id ) {
213
-		if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) {
212
+	public function search_box($text, $input_id) {
213
+		if (empty($_REQUEST['s']) && ! $this->has_items()) {
214 214
 			return;
215 215
 		}
216 216
 
217
-		$input_id = $input_id . '-search-input';
217
+		$input_id = $input_id.'-search-input';
218 218
 
219
-		if ( ! empty( $_REQUEST['orderby'] ) ) {
220
-			echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />';
219
+		if ( ! empty($_REQUEST['orderby'])) {
220
+			echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />';
221 221
 		}
222
-		if ( ! empty( $_REQUEST['order'] ) ) {
223
-			echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />';
222
+		if ( ! empty($_REQUEST['order'])) {
223
+			echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />';
224 224
 		}
225 225
 		?>
226 226
 		<div class="give-filter give-filter-search" role="search">
@@ -232,13 +232,13 @@  discard block
 block discarded – undo
232 232
 			 *
233 233
 			 * @since 1.7
234 234
 			 */
235
-			do_action( 'give_payment_history_search' );
235
+			do_action('give_payment_history_search');
236 236
 			?>
237 237
 			<label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label>
238 238
 			<input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>" />
239
-			<?php submit_button( $text, 'button', false, false, array(
239
+			<?php submit_button($text, 'button', false, false, array(
240 240
 				'ID' => 'search-submit',
241
-			) ); ?><br />
241
+			)); ?><br />
242 242
 		</div>
243 243
 		<?php
244 244
 	}
@@ -252,48 +252,48 @@  discard block
 block discarded – undo
252 252
 	 */
253 253
 	public function get_views() {
254 254
 
255
-		$current = isset( $_GET['status'] ) ? $_GET['status'] : '';
255
+		$current = isset($_GET['status']) ? $_GET['status'] : '';
256 256
 		$views   = array();
257 257
 		$tabs    = array(
258 258
 			'all'        => array(
259 259
 				'total_count',
260
-				esc_html__( 'All', 'give' ),
260
+				esc_html__('All', 'give'),
261 261
 			),
262 262
 			'publish'    => array(
263 263
 				'complete_count',
264
-				esc_html__( 'Completed', 'give' ),
264
+				esc_html__('Completed', 'give'),
265 265
 			),
266 266
 			'pending'    => array(
267 267
 				'pending_count',
268
-				esc_html__( 'Pending', 'give' ),
268
+				esc_html__('Pending', 'give'),
269 269
 			),
270 270
 			'processing' => array(
271 271
 				'processing_count',
272
-				esc_html__( 'Processing', 'give' ),
272
+				esc_html__('Processing', 'give'),
273 273
 			),
274 274
 			'refunded'   => array(
275 275
 				'refunded_count',
276
-				esc_html__( 'Refunded', 'give' ),
276
+				esc_html__('Refunded', 'give'),
277 277
 			),
278 278
 			'revoked'    => array(
279 279
 				'revoked_count',
280
-				esc_html__( 'Revoked', 'give' ),
280
+				esc_html__('Revoked', 'give'),
281 281
 			),
282 282
 			'failed'     => array(
283 283
 				'failed_count',
284
-				esc_html__( 'Failed', 'give' ),
284
+				esc_html__('Failed', 'give'),
285 285
 			),
286 286
 			'cancelled'  => array(
287 287
 				'cancelled_count',
288
-				esc_html__( 'Cancelled', 'give' ),
288
+				esc_html__('Cancelled', 'give'),
289 289
 			),
290 290
 			'abandoned'  => array(
291 291
 				'abandoned_count',
292
-				esc_html__( 'Abandoned', 'give' ),
292
+				esc_html__('Abandoned', 'give'),
293 293
 			),
294 294
 		);
295 295
 
296
-		foreach ( $tabs as $key => $tab ) {
296
+		foreach ($tabs as $key => $tab) {
297 297
 			$count_key = $tab[0];
298 298
 			$name      = $tab[1];
299 299
 			$count     = $this->$count_key;
@@ -308,19 +308,19 @@  discard block
 block discarded – undo
308 308
 			 * @param string $key   Current view tab value.
309 309
 			 * @param int    $count Number of donation inside the tab.
310 310
 			 */
311
-			if ( 'all' === $key || $key === $current || apply_filters( 'give_payments_table_show_all_status', 0 < $count, $key, $count ) ) {
311
+			if ('all' === $key || $key === $current || apply_filters('give_payments_table_show_all_status', 0 < $count, $key, $count)) {
312 312
 
313
-				$views[ $key ] = sprintf(
313
+				$views[$key] = sprintf(
314 314
 					'<a href="%s" %s >%s&nbsp;<span class="count">(%s)</span></a>',
315
-					esc_url( ( 'all' === (string) $key ) ? remove_query_arg( array( 'status', 'paged' ) ) : add_query_arg( array( 'status' => $key, 'paged' => false ) ) ),
316
-					( ( 'all' === $key && empty( $current ) ) ) ? 'class="current"' : ( $current == $key ) ? 'class="current"' : '',
315
+					esc_url(('all' === (string) $key) ? remove_query_arg(array('status', 'paged')) : add_query_arg(array('status' => $key, 'paged' => false))),
316
+					(('all' === $key && empty($current))) ? 'class="current"' : ($current == $key) ? 'class="current"' : '',
317 317
 					$name,
318 318
 					$count
319 319
 				);
320 320
 			}
321 321
 		}
322 322
 
323
-		return apply_filters( 'give_payments_table_views', $views );
323
+		return apply_filters('give_payments_table_views', $views);
324 324
 	}
325 325
 
326 326
 	/**
@@ -333,15 +333,15 @@  discard block
 block discarded – undo
333 333
 	public function get_columns() {
334 334
 		$columns = array(
335 335
 			'cb'            => '<input type="checkbox" />', // Render a checkbox instead of text.
336
-			'donation'      => esc_html__( 'Donation', 'give' ),
337
-			'donation_form' => esc_html__( 'Donation Form', 'give' ),
338
-			'status'        => esc_html__( 'Status', 'give' ),
339
-			'date'          => esc_html__( 'Date', 'give' ),
340
-			'amount'        => esc_html__( 'Amount', 'give' ),
341
-			'details'       => esc_html__( 'Details', 'give' ),
336
+			'donation'      => esc_html__('Donation', 'give'),
337
+			'donation_form' => esc_html__('Donation Form', 'give'),
338
+			'status'        => esc_html__('Status', 'give'),
339
+			'date'          => esc_html__('Date', 'give'),
340
+			'amount'        => esc_html__('Amount', 'give'),
341
+			'details'       => esc_html__('Details', 'give'),
342 342
 		);
343 343
 
344
-		return apply_filters( 'give_payments_table_columns', $columns );
344
+		return apply_filters('give_payments_table_columns', $columns);
345 345
 	}
346 346
 
347 347
 	/**
@@ -353,14 +353,14 @@  discard block
 block discarded – undo
353 353
 	 */
354 354
 	public function get_sortable_columns() {
355 355
 		$columns = array(
356
-			'donation'      => array( 'ID', true ),
357
-			'donation_form' => array( 'donation_form', false ),
358
-			'status'        => array( 'status', false ),
359
-			'amount'        => array( 'amount', false ),
360
-			'date'          => array( 'date', false ),
356
+			'donation'      => array('ID', true),
357
+			'donation_form' => array('donation_form', false),
358
+			'status'        => array('status', false),
359
+			'amount'        => array('amount', false),
360
+			'date'          => array('date', false),
361 361
 		);
362 362
 
363
-		return apply_filters( 'give_payments_table_sortable_columns', $columns );
363
+		return apply_filters('give_payments_table_sortable_columns', $columns);
364 364
 	}
365 365
 
366 366
 	/**
@@ -386,55 +386,55 @@  discard block
 block discarded – undo
386 386
 	 *
387 387
 	 * @return string Column Name
388 388
 	 */
389
-	public function column_default( $payment, $column_name ) {
389
+	public function column_default($payment, $column_name) {
390 390
 
391
-		$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' ) ) );
392
-		$row_actions         = $this->get_row_actions( $payment );
391
+		$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')));
392
+		$row_actions         = $this->get_row_actions($payment);
393 393
 
394
-		switch ( $column_name ) {
394
+		switch ($column_name) {
395 395
 			case 'donation' :
396
-				$value = sprintf( '<a href="%1$s" data-tooltip="%2$s">#%3$s</a>&nbsp;%4$s&nbsp;%5$s<br>', $single_donation_url, sprintf( esc_attr__( 'View Donation #%s', 'give' ), $payment->ID ), $payment->ID, esc_html__( 'by', 'give' ), $this->get_donor( $payment ) );
397
-				$value .= $this->get_donor_email( $payment );
398
-				$value .= $this->row_actions( $row_actions );
396
+				$value = sprintf('<a href="%1$s" data-tooltip="%2$s">#%3$s</a>&nbsp;%4$s&nbsp;%5$s<br>', $single_donation_url, sprintf(esc_attr__('View Donation #%s', 'give'), $payment->ID), $payment->ID, esc_html__('by', 'give'), $this->get_donor($payment));
397
+				$value .= $this->get_donor_email($payment);
398
+				$value .= $this->row_actions($row_actions);
399 399
 				break;
400 400
 
401 401
 			case 'amount' :
402
-				$amount = ! empty( $payment->total ) ? $payment->total : 0;
403
-				$value  = give_currency_filter( give_format_amount( $amount, array( 'sanitize' => false ) ), give_get_payment_currency_code( $payment->ID ) );
404
-				$value  .= sprintf( '<br><small>%1$s %2$s</small>', __( 'via', 'give' ), give_get_gateway_admin_label( $payment->gateway ) );
402
+				$amount = ! empty($payment->total) ? $payment->total : 0;
403
+				$value  = give_currency_filter(give_format_amount($amount, array('sanitize' => false)), give_get_payment_currency_code($payment->ID));
404
+				$value .= sprintf('<br><small>%1$s %2$s</small>', __('via', 'give'), give_get_gateway_admin_label($payment->gateway));
405 405
 				break;
406 406
 
407 407
 			case 'donation_form' :
408
-				$form_title = empty( $payment->form_title ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $payment->form_id ) : $payment->form_title;
409
-				$value      = '<a href="' . admin_url( 'post.php?post=' . $payment->form_id . '&action=edit' ) . '">' . $form_title . '</a>';
410
-				$level      = give_get_payment_form_title( $payment->meta, true );
408
+				$form_title = empty($payment->form_title) ? sprintf(__('Untitled (#%s)', 'give'), $payment->form_id) : $payment->form_title;
409
+				$value      = '<a href="'.admin_url('post.php?post='.$payment->form_id.'&action=edit').'">'.$form_title.'</a>';
410
+				$level      = give_get_payment_form_title($payment->meta, true);
411 411
 
412
-				if ( ! empty( $level ) ) {
412
+				if ( ! empty($level)) {
413 413
 					$value .= $level;
414 414
 				}
415 415
 
416 416
 				break;
417 417
 
418 418
 			case 'date' :
419
-				$date  = strtotime( $payment->date );
420
-				$value = date_i18n( give_date_format(), $date );
419
+				$date  = strtotime($payment->date);
420
+				$value = date_i18n(give_date_format(), $date);
421 421
 				break;
422 422
 
423 423
 			case 'status' :
424
-				$value = $this->get_payment_status( $payment );
424
+				$value = $this->get_payment_status($payment);
425 425
 				break;
426 426
 
427 427
 			case 'details' :
428
-				$value = sprintf( '<div class="give-payment-details-link-wrap"><a href="%1$s" class="give-payment-details-link button button-small" data-tooltip="%2$s" aria-label="%2$s"><span class="dashicons dashicons-visibility"></span></a></div>', $single_donation_url, sprintf( esc_attr__( 'View Donation #%s', 'give' ), $payment->ID ) );
428
+				$value = sprintf('<div class="give-payment-details-link-wrap"><a href="%1$s" class="give-payment-details-link button button-small" data-tooltip="%2$s" aria-label="%2$s"><span class="dashicons dashicons-visibility"></span></a></div>', $single_donation_url, sprintf(esc_attr__('View Donation #%s', 'give'), $payment->ID));
429 429
 				break;
430 430
 
431 431
 			default:
432
-				$value = isset( $payment->$column_name ) ? $payment->$column_name : '';
432
+				$value = isset($payment->$column_name) ? $payment->$column_name : '';
433 433
 				break;
434 434
 
435 435
 		}// End switch().
436 436
 
437
-		return apply_filters( 'give_payments_table_column', $value, $payment->ID, $column_name );
437
+		return apply_filters('give_payments_table_column', $value, $payment->ID, $column_name);
438 438
 	}
439 439
 
440 440
 	/**
@@ -447,17 +447,17 @@  discard block
 block discarded – undo
447 447
 	 *
448 448
 	 * @return string                Data shown in the Email column
449 449
 	 */
450
-	public function get_donor_email( $payment ) {
450
+	public function get_donor_email($payment) {
451 451
 
452
-		$email = give_get_payment_user_email( $payment->ID );
452
+		$email = give_get_payment_user_email($payment->ID);
453 453
 
454
-		if ( empty( $email ) ) {
455
-			$email = esc_html__( '(unknown)', 'give' );
454
+		if (empty($email)) {
455
+			$email = esc_html__('(unknown)', 'give');
456 456
 		}
457 457
 
458
-		$value = '<a href="mailto:' . $email . '" data-tooltip="' . esc_attr__( 'Email donor', 'give' ) . '">' . $email . '</a>';
458
+		$value = '<a href="mailto:'.$email.'" data-tooltip="'.esc_attr__('Email donor', 'give').'">'.$email.'</a>';
459 459
 
460
-		return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'email' );
460
+		return apply_filters('give_payments_table_column', $value, $payment->ID, 'email');
461 461
 	}
462 462
 
463 463
 	/**
@@ -469,32 +469,32 @@  discard block
 block discarded – undo
469 469
 	 *
470 470
 	 * @return array $actions
471 471
 	 */
472
-	function get_row_actions( $payment ) {
472
+	function get_row_actions($payment) {
473 473
 
474 474
 		$actions = array();
475
-		$email   = give_get_payment_user_email( $payment->ID );
475
+		$email   = give_get_payment_user_email($payment->ID);
476 476
 
477 477
 		// Add search term string back to base URL.
478
-		$search_terms = ( isset( $_GET['s'] ) ? trim( $_GET['s'] ) : '' );
479
-		if ( ! empty( $search_terms ) ) {
480
-			$this->base_url = add_query_arg( 's', $search_terms, $this->base_url );
478
+		$search_terms = (isset($_GET['s']) ? trim($_GET['s']) : '');
479
+		if ( ! empty($search_terms)) {
480
+			$this->base_url = add_query_arg('s', $search_terms, $this->base_url);
481 481
 		}
482 482
 
483
-		if ( give_is_payment_complete( $payment->ID ) && ! empty( $email ) ) {
483
+		if (give_is_payment_complete($payment->ID) && ! empty($email)) {
484 484
 
485
-			$actions['email_links'] = sprintf( '<a class="resend-single-donation-receipt" href="%1$s" aria-label="%2$s">%3$s</a>', wp_nonce_url( add_query_arg( array(
485
+			$actions['email_links'] = sprintf('<a class="resend-single-donation-receipt" href="%1$s" aria-label="%2$s">%3$s</a>', wp_nonce_url(add_query_arg(array(
486 486
 				'give-action' => 'email_links',
487 487
 				'purchase_id' => $payment->ID,
488
-			), $this->base_url ), 'give_payment_nonce' ), sprintf( esc_attr__( 'Resend Donation %s Receipt', 'give' ), $payment->ID ), esc_html__( 'Resend Receipt', 'give' ) );
488
+			), $this->base_url), 'give_payment_nonce'), sprintf(esc_attr__('Resend Donation %s Receipt', 'give'), $payment->ID), esc_html__('Resend Receipt', 'give'));
489 489
 
490 490
 		}
491 491
 
492
-		$actions['delete'] = sprintf( '<a class="delete-single-donation" href="%1$s" aria-label="%2$s">%3$s</a>', wp_nonce_url( add_query_arg( array(
492
+		$actions['delete'] = sprintf('<a class="delete-single-donation" href="%1$s" aria-label="%2$s">%3$s</a>', wp_nonce_url(add_query_arg(array(
493 493
 			'give-action' => 'delete_payment',
494 494
 			'purchase_id' => $payment->ID,
495
-		), $this->base_url ), 'give_donation_nonce' ), sprintf( esc_attr__( 'Delete Donation %s', 'give' ), $payment->ID ), esc_html__( 'Delete', 'give' ) );
495
+		), $this->base_url), 'give_donation_nonce'), sprintf(esc_attr__('Delete Donation %s', 'give'), $payment->ID), esc_html__('Delete', 'give'));
496 496
 
497
-		return apply_filters( 'give_payment_row_actions', $actions, $payment );
497
+		return apply_filters('give_payment_row_actions', $actions, $payment);
498 498
 	}
499 499
 
500 500
 
@@ -508,10 +508,10 @@  discard block
 block discarded – undo
508 508
 	 *
509 509
 	 * @return string                Data shown in the Email column
510 510
 	 */
511
-	function get_payment_status( $payment ) {
512
-		$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>';
513
-		if ( $payment->mode == 'test' ) {
514
-			$value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="' . esc_attr__( 'This donation was made in test mode.', 'give' ) . '">' . esc_html__( 'Test', 'give' ) . '</span>';
511
+	function get_payment_status($payment) {
512
+		$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>';
513
+		if ($payment->mode == 'test') {
514
+			$value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="'.esc_attr__('This donation was made in test mode.', 'give').'">'.esc_html__('Test', 'give').'</span>';
515 515
 		}
516 516
 
517 517
 		return $value;
@@ -527,8 +527,8 @@  discard block
 block discarded – undo
527 527
 	 *
528 528
 	 * @return string Displays a checkbox.
529 529
 	 */
530
-	public function column_cb( $payment ) {
531
-		return sprintf( '<input type="checkbox" name="%1$s[]" value="%2$s" />', 'payment', $payment->ID );
530
+	public function column_cb($payment) {
531
+		return sprintf('<input type="checkbox" name="%1$s[]" value="%2$s" />', 'payment', $payment->ID);
532 532
 	}
533 533
 
534 534
 	/**
@@ -541,8 +541,8 @@  discard block
 block discarded – undo
541 541
 	 *
542 542
 	 * @return string Displays a checkbox.
543 543
 	 */
544
-	public function get_payment_id( $payment ) {
545
-		return '<span class="give-payment-id">' . give_get_payment_number( $payment->ID ) . '</span>';
544
+	public function get_payment_id($payment) {
545
+		return '<span class="give-payment-id">'.give_get_payment_number($payment->ID).'</span>';
546 546
 	}
547 547
 
548 548
 	/**
@@ -555,32 +555,32 @@  discard block
 block discarded – undo
555 555
 	 *
556 556
 	 * @return string Data shown in the User column
557 557
 	 */
558
-	public function get_donor( $payment ) {
558
+	public function get_donor($payment) {
559 559
 
560
-		$donor_id           = give_get_payment_donor_id( $payment->ID );
561
-		$donor_billing_name = give_get_donor_name_by( $payment->ID, 'donation' );
562
-		$donor_name         = give_get_donor_name_by( $donor_id, 'donor' );
560
+		$donor_id           = give_get_payment_donor_id($payment->ID);
561
+		$donor_billing_name = give_get_donor_name_by($payment->ID, 'donation');
562
+		$donor_name         = give_get_donor_name_by($donor_id, 'donor');
563 563
 
564 564
 		$value = '';
565
-		if ( ! empty( $donor_id ) ) {
565
+		if ( ! empty($donor_id)) {
566 566
 
567 567
 			// Check whether the donor name and WP_User name is same or not.
568
-			if ( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ) {
569
-				$value .= $donor_billing_name . ' (';
568
+			if (sanitize_title($donor_billing_name) != sanitize_title($donor_name)) {
569
+				$value .= $donor_billing_name.' (';
570 570
 			}
571 571
 
572
-			$value .= '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id" ) ) . '">' . $donor_name . '</a>';
572
+			$value .= '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id")).'">'.$donor_name.'</a>';
573 573
 
574 574
 			// Check whether the donor name and WP_User name is same or not.
575
-			if ( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ) {
575
+			if (sanitize_title($donor_billing_name) != sanitize_title($donor_name)) {
576 576
 				$value .= ')';
577 577
 			}
578 578
 		} else {
579
-			$email = give_get_payment_user_email( $payment->ID );
580
-			$value .= '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-payment-history&s=$email" ) ) . '">' . esc_html__( '(donor missing)', 'give' ) . '</a>';
579
+			$email = give_get_payment_user_email($payment->ID);
580
+			$value .= '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-payment-history&s=$email")).'">'.esc_html__('(donor missing)', 'give').'</a>';
581 581
 		}
582 582
 
583
-		return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'donor' );
583
+		return apply_filters('give_payments_table_column', $value, $payment->ID, 'donor');
584 584
 	}
585 585
 
586 586
 	/**
@@ -592,20 +592,20 @@  discard block
 block discarded – undo
592 592
 	 */
593 593
 	public function get_bulk_actions() {
594 594
 		$actions = array(
595
-			'delete'                 => __( 'Delete', 'give' ),
596
-			'set-status-publish'     => __( 'Set To Completed', 'give' ),
597
-			'set-status-pending'     => __( 'Set To Pending', 'give' ),
598
-			'set-status-processing'  => __( 'Set To Processing', 'give' ),
599
-			'set-status-refunded'    => __( 'Set To Refunded', 'give' ),
600
-			'set-status-revoked'     => __( 'Set To Revoked', 'give' ),
601
-			'set-status-failed'      => __( 'Set To Failed', 'give' ),
602
-			'set-status-cancelled'   => __( 'Set To Cancelled', 'give' ),
603
-			'set-status-abandoned'   => __( 'Set To Abandoned', 'give' ),
604
-			'set-status-preapproval' => __( 'Set To Preapproval', 'give' ),
605
-			'resend-receipt'         => __( 'Resend Email Receipts', 'give' ),
595
+			'delete'                 => __('Delete', 'give'),
596
+			'set-status-publish'     => __('Set To Completed', 'give'),
597
+			'set-status-pending'     => __('Set To Pending', 'give'),
598
+			'set-status-processing'  => __('Set To Processing', 'give'),
599
+			'set-status-refunded'    => __('Set To Refunded', 'give'),
600
+			'set-status-revoked'     => __('Set To Revoked', 'give'),
601
+			'set-status-failed'      => __('Set To Failed', 'give'),
602
+			'set-status-cancelled'   => __('Set To Cancelled', 'give'),
603
+			'set-status-abandoned'   => __('Set To Abandoned', 'give'),
604
+			'set-status-preapproval' => __('Set To Preapproval', 'give'),
605
+			'resend-receipt'         => __('Resend Email Receipts', 'give'),
606 606
 		);
607 607
 
608
-		return apply_filters( 'give_payments_table_bulk_actions', $actions );
608
+		return apply_filters('give_payments_table_bulk_actions', $actions);
609 609
 	}
610 610
 
611 611
 	/**
@@ -616,63 +616,63 @@  discard block
 block discarded – undo
616 616
 	 * @return void
617 617
 	 */
618 618
 	public function process_bulk_action() {
619
-		$ids    = isset( $_GET['payment'] ) ? $_GET['payment'] : false;
619
+		$ids    = isset($_GET['payment']) ? $_GET['payment'] : false;
620 620
 		$action = $this->current_action();
621 621
 
622
-		if ( ! is_array( $ids ) ) {
623
-			$ids = array( $ids );
622
+		if ( ! is_array($ids)) {
623
+			$ids = array($ids);
624 624
 		}
625 625
 
626
-		if ( empty( $action ) ) {
626
+		if (empty($action)) {
627 627
 			return;
628 628
 		}
629 629
 
630
-		foreach ( $ids as $id ) {
630
+		foreach ($ids as $id) {
631 631
 
632 632
 			// Detect when a bulk action is being triggered.
633
-			switch ( $this->current_action() ) {
633
+			switch ($this->current_action()) {
634 634
 
635 635
 				case'delete':
636
-					give_delete_donation( $id );
636
+					give_delete_donation($id);
637 637
 					break;
638 638
 
639 639
 				case 'set-status-publish':
640
-					give_update_payment_status( $id, 'publish' );
640
+					give_update_payment_status($id, 'publish');
641 641
 					break;
642 642
 
643 643
 				case 'set-status-pending':
644
-					give_update_payment_status( $id, 'pending' );
644
+					give_update_payment_status($id, 'pending');
645 645
 					break;
646 646
 
647 647
 				case 'set-status-processing':
648
-					give_update_payment_status( $id, 'processing' );
648
+					give_update_payment_status($id, 'processing');
649 649
 					break;
650 650
 
651 651
 				case 'set-status-refunded':
652
-					give_update_payment_status( $id, 'refunded' );
652
+					give_update_payment_status($id, 'refunded');
653 653
 					break;
654 654
 				case 'set-status-revoked':
655
-					give_update_payment_status( $id, 'revoked' );
655
+					give_update_payment_status($id, 'revoked');
656 656
 					break;
657 657
 
658 658
 				case 'set-status-failed':
659
-					give_update_payment_status( $id, 'failed' );
659
+					give_update_payment_status($id, 'failed');
660 660
 					break;
661 661
 
662 662
 				case 'set-status-cancelled':
663
-					give_update_payment_status( $id, 'cancelled' );
663
+					give_update_payment_status($id, 'cancelled');
664 664
 					break;
665 665
 
666 666
 				case 'set-status-abandoned':
667
-					give_update_payment_status( $id, 'abandoned' );
667
+					give_update_payment_status($id, 'abandoned');
668 668
 					break;
669 669
 
670 670
 				case 'set-status-preapproval':
671
-					give_update_payment_status( $id, 'preapproval' );
671
+					give_update_payment_status($id, 'preapproval');
672 672
 					break;
673 673
 
674 674
 				case 'resend-receipt':
675
-					give_email_donation_receipt( $id, false );
675
+					give_email_donation_receipt($id, false);
676 676
 					break;
677 677
 			}// End switch().
678 678
 
@@ -684,7 +684,7 @@  discard block
 block discarded – undo
684 684
 			 * @param int    $id             The ID of the payment.
685 685
 			 * @param string $current_action The action that is being triggered.
686 686
 			 */
687
-			do_action( 'give_payments_table_do_bulk_action', $id, $this->current_action() );
687
+			do_action('give_payments_table_do_bulk_action', $id, $this->current_action());
688 688
 		}// End foreach().
689 689
 
690 690
 	}
@@ -700,31 +700,31 @@  discard block
 block discarded – undo
700 700
 
701 701
 		$args = array();
702 702
 
703
-		if ( isset( $_GET['user'] ) ) {
704
-			$args['user'] = urldecode( $_GET['user'] );
705
-		} elseif ( isset( $_GET['donor'] ) ) {
706
-			$args['donor'] = absint( $_GET['donor'] );
707
-		} elseif ( isset( $_GET['s'] ) ) {
708
-			$is_user = strpos( $_GET['s'], strtolower( 'user:' ) ) !== false;
709
-			if ( $is_user ) {
710
-				$args['user'] = absint( trim( str_replace( 'user:', '', strtolower( $_GET['s'] ) ) ) );
711
-				unset( $args['s'] );
703
+		if (isset($_GET['user'])) {
704
+			$args['user'] = urldecode($_GET['user']);
705
+		} elseif (isset($_GET['donor'])) {
706
+			$args['donor'] = absint($_GET['donor']);
707
+		} elseif (isset($_GET['s'])) {
708
+			$is_user = strpos($_GET['s'], strtolower('user:')) !== false;
709
+			if ($is_user) {
710
+				$args['user'] = absint(trim(str_replace('user:', '', strtolower($_GET['s']))));
711
+				unset($args['s']);
712 712
 			} else {
713
-				$args['s'] = sanitize_text_field( $_GET['s'] );
713
+				$args['s'] = sanitize_text_field($_GET['s']);
714 714
 			}
715 715
 		}
716 716
 
717
-		if ( ! empty( $_GET['start-date'] ) ) {
718
-			$args['start-date'] = urldecode( $_GET['start-date'] );
717
+		if ( ! empty($_GET['start-date'])) {
718
+			$args['start-date'] = urldecode($_GET['start-date']);
719 719
 		}
720 720
 
721
-		if ( ! empty( $_GET['end-date'] ) ) {
722
-			$args['end-date'] = urldecode( $_GET['end-date'] );
721
+		if ( ! empty($_GET['end-date'])) {
722
+			$args['end-date'] = urldecode($_GET['end-date']);
723 723
 		}
724 724
 
725
-		$args['form_id'] = ! empty( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : null;
725
+		$args['form_id'] = ! empty($_GET['form_id']) ? absint($_GET['form_id']) : null;
726 726
 
727
-		$payment_count          = give_count_payments( $args );
727
+		$payment_count          = give_count_payments($args);
728 728
 		$this->complete_count   = $payment_count->publish;
729 729
 		$this->pending_count    = $payment_count->pending;
730 730
 		$this->processing_count = $payment_count->processing;
@@ -734,7 +734,7 @@  discard block
 block discarded – undo
734 734
 		$this->cancelled_count  = $payment_count->cancelled;
735 735
 		$this->abandoned_count  = $payment_count->abandoned;
736 736
 
737
-		foreach ( $payment_count as $count ) {
737
+		foreach ($payment_count as $count) {
738 738
 			$this->total_count += $count;
739 739
 		}
740 740
 	}
@@ -749,28 +749,28 @@  discard block
 block discarded – undo
749 749
 	public function payments_data() {
750 750
 
751 751
 		$per_page   = $this->per_page;
752
-		$orderby    = isset( $_GET['orderby'] ) ? urldecode( $_GET['orderby'] ) : 'ID';
753
-		$order      = isset( $_GET['order'] ) ? $_GET['order'] : 'DESC';
754
-		$user       = isset( $_GET['user'] ) ? $_GET['user'] : null;
755
-		$donor      = isset( $_GET['donor'] ) ? $_GET['donor'] : null;
756
-		$status     = isset( $_GET['status'] ) ? $_GET['status'] : give_get_payment_status_keys();
757
-		$meta_key   = isset( $_GET['meta_key'] ) ? $_GET['meta_key'] : null;
758
-		$year       = isset( $_GET['year'] ) ? $_GET['year'] : null;
759
-		$month      = isset( $_GET['m'] ) ? $_GET['m'] : null;
760
-		$day        = isset( $_GET['day'] ) ? $_GET['day'] : null;
761
-		$search     = isset( $_GET['s'] ) ? sanitize_text_field( $_GET['s'] ) : null;
762
-		$start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null;
763
-		$end_date   = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : $start_date;
764
-		$form_id    = ! empty( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : null;
765
-
766
-		if ( ! empty( $search ) ) {
752
+		$orderby    = isset($_GET['orderby']) ? urldecode($_GET['orderby']) : 'ID';
753
+		$order      = isset($_GET['order']) ? $_GET['order'] : 'DESC';
754
+		$user       = isset($_GET['user']) ? $_GET['user'] : null;
755
+		$donor      = isset($_GET['donor']) ? $_GET['donor'] : null;
756
+		$status     = isset($_GET['status']) ? $_GET['status'] : give_get_payment_status_keys();
757
+		$meta_key   = isset($_GET['meta_key']) ? $_GET['meta_key'] : null;
758
+		$year       = isset($_GET['year']) ? $_GET['year'] : null;
759
+		$month      = isset($_GET['m']) ? $_GET['m'] : null;
760
+		$day        = isset($_GET['day']) ? $_GET['day'] : null;
761
+		$search     = isset($_GET['s']) ? sanitize_text_field($_GET['s']) : null;
762
+		$start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null;
763
+		$end_date   = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : $start_date;
764
+		$form_id    = ! empty($_GET['form_id']) ? absint($_GET['form_id']) : null;
765
+
766
+		if ( ! empty($search)) {
767 767
 			$status = 'any'; // Force all payment statuses when searching.
768 768
 		}
769 769
 
770 770
 		$args = array(
771 771
 			'output'     => 'payments',
772 772
 			'number'     => $per_page,
773
-			'page'       => isset( $_GET['paged'] ) ? $_GET['paged'] : null,
773
+			'page'       => isset($_GET['paged']) ? $_GET['paged'] : null,
774 774
 			'orderby'    => $orderby,
775 775
 			'order'      => $order,
776 776
 			'user'       => $user,
@@ -786,12 +786,12 @@  discard block
 block discarded – undo
786 786
 			'give_forms' => $form_id,
787 787
 		);
788 788
 
789
-		if ( is_string( $search ) && false !== strpos( $search, 'txn:' ) ) {
789
+		if (is_string($search) && false !== strpos($search, 'txn:')) {
790 790
 			$args['search_in_notes'] = true;
791
-			$args['s']               = trim( str_replace( 'txn:', '', $args['s'] ) );
791
+			$args['s']               = trim(str_replace('txn:', '', $args['s']));
792 792
 		}
793 793
 
794
-		$p_query = new Give_Payments_Query( $args );
794
+		$p_query = new Give_Payments_Query($args);
795 795
 
796 796
 		return $p_query->get_payments();
797 797
 
@@ -811,17 +811,17 @@  discard block
 block discarded – undo
811 811
 	 */
812 812
 	public function prepare_items() {
813 813
 
814
-		wp_reset_vars( array( 'action', 'payment', 'orderby', 'order', 's' ) );
814
+		wp_reset_vars(array('action', 'payment', 'orderby', 'order', 's'));
815 815
 
816 816
 		$columns  = $this->get_columns();
817 817
 		$hidden   = array(); // No hidden columns.
818 818
 		$sortable = $this->get_sortable_columns();
819 819
 		$data     = $this->payments_data();
820
-		$status   = isset( $_GET['status'] ) ? $_GET['status'] : 'any';
820
+		$status   = isset($_GET['status']) ? $_GET['status'] : 'any';
821 821
 
822
-		$this->_column_headers = array( $columns, $hidden, $sortable );
822
+		$this->_column_headers = array($columns, $hidden, $sortable);
823 823
 
824
-		switch ( $status ) {
824
+		switch ($status) {
825 825
 			case 'publish':
826 826
 				$total_items = $this->complete_count;
827 827
 				break;
@@ -851,20 +851,20 @@  discard block
 block discarded – undo
851 851
 				break;
852 852
 			default:
853 853
 				// Retrieve the count of the non-default-Give status.
854
-				$count       = wp_count_posts( 'give_payment' );
855
-				$total_items = isset( $count->{$status} ) ? $count->{$status} : 0;
854
+				$count       = wp_count_posts('give_payment');
855
+				$total_items = isset($count->{$status} ) ? $count->{$status} : 0;
856 856
 				break;
857 857
 		}
858 858
 
859 859
 		$this->items = $data;
860 860
 
861
-		$this->set_pagination_args( array(
861
+		$this->set_pagination_args(array(
862 862
 			'total_items' => $total_items,
863 863
 			// We have to calculate the total number of items.
864 864
 			'per_page'    => $this->per_page,
865 865
 			// We have to determine how many items to show on a page.
866
-			'total_pages' => ceil( $total_items / $this->per_page ),
866
+			'total_pages' => ceil($total_items / $this->per_page),
867 867
 			// We have to calculate the total number of pages.
868
-		) );
868
+		));
869 869
 	}
870 870
 }
Please login to merge, or discard this patch.
includes/admin/admin-filters.php 1 patch
Spacing   +17 added lines, -17 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
 
@@ -27,30 +27,30 @@  discard block
 block discarded – undo
27 27
  *
28 28
  * @return  mixed
29 29
  */
30
-function __give_sanitize_number_decimals_setting_field( $value ) {
30
+function __give_sanitize_number_decimals_setting_field($value) {
31 31
 	$value_changed = false;
32 32
 	$old_value     = $value;
33 33
 
34
-	if ( isset( $_POST['decimal_separator'] ) ) {
35
-		$value         = ! empty( $_POST['decimal_separator'] ) ? $value : 0;
34
+	if (isset($_POST['decimal_separator'])) {
35
+		$value         = ! empty($_POST['decimal_separator']) ? $value : 0;
36 36
 		$value_changed = true;
37 37
 	}
38 38
 
39
-	if ( $value_changed && ( $old_value != $value ) ) {
40
-		Give_Admin_Settings::add_error( 'give-number-decimal', __( 'The \'Number of Decimals\' option has been automatically set to zero because the \'Decimal Separator\' is not set.', 'give' ) );
39
+	if ($value_changed && ($old_value != $value)) {
40
+		Give_Admin_Settings::add_error('give-number-decimal', __('The \'Number of Decimals\' option has been automatically set to zero because the \'Decimal Separator\' is not set.', 'give'));
41 41
 	}
42 42
 
43
-	$value = absint( $value );
43
+	$value = absint($value);
44 44
 
45
-	if( 6 <= $value ) {
45
+	if (6 <= $value) {
46 46
 		$value = 5;
47
-		Give_Admin_Settings::add_error( 'give-number-decimal', __( 'The \'Number of Decimals\' option has been automatically set to 5 because you entered a number higher than the maximum allowed.', 'give' ) );
47
+		Give_Admin_Settings::add_error('give-number-decimal', __('The \'Number of Decimals\' option has been automatically set to 5 because you entered a number higher than the maximum allowed.', 'give'));
48 48
 	}
49 49
 
50
-	return absint( $value );
50
+	return absint($value);
51 51
 }
52 52
 
53
-add_filter( 'give_admin_settings_sanitize_option_number_decimals', '__give_sanitize_number_decimals_setting_field', 10 );
53
+add_filter('give_admin_settings_sanitize_option_number_decimals', '__give_sanitize_number_decimals_setting_field', 10);
54 54
 
55 55
 
56 56
 /**
@@ -66,17 +66,17 @@  discard block
 block discarded – undo
66 66
  *
67 67
  * @return  mixed
68 68
  */
69
-function __give_validate_decimal_separator_setting_field( $value ) {
70
-	$thousand_separator = give_clean( $_POST['thousands_separator'] );
71
-	$decimal_separator  = give_clean( $_POST['decimal_separator'] );
69
+function __give_validate_decimal_separator_setting_field($value) {
70
+	$thousand_separator = give_clean($_POST['thousands_separator']);
71
+	$decimal_separator  = give_clean($_POST['decimal_separator']);
72 72
 
73
-	if ( $decimal_separator === $thousand_separator ) {
73
+	if ($decimal_separator === $thousand_separator) {
74 74
 		$value                    = '';
75 75
 		$_POST['number_decimals'] = 0;
76
-		Give_Admin_Settings::add_error( 'give-decimal-separator', __( 'The \'Decimal Separator\' option has automatically been set to empty because it can not be equal to the \'Thousand Separator\'', 'give' ) );
76
+		Give_Admin_Settings::add_error('give-decimal-separator', __('The \'Decimal Separator\' option has automatically been set to empty because it can not be equal to the \'Thousand Separator\'', 'give'));
77 77
 	}
78 78
 
79 79
 	return $value;
80 80
 }
81 81
 
82
-add_filter( 'give_admin_settings_sanitize_option_decimal_separator', '__give_validate_decimal_separator_setting_field', 10 );
83 82
\ No newline at end of file
83
+add_filter('give_admin_settings_sanitize_option_decimal_separator', '__give_validate_decimal_separator_setting_field', 10);
84 84
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/shortcodes/shortcode-give-goal.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  */
10 10
 
11 11
 // Exit if accessed directly.
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit;
14 14
 }
15 15
 
@@ -23,10 +23,10 @@  discard block
 block discarded – undo
23 23
 	 */
24 24
 	public function __construct() {
25 25
 
26
-		$this->shortcode['title'] = esc_html__( 'Donation Form Goal', 'give' );
27
-		$this->shortcode['label'] = esc_html__( 'Donation Form Goal', 'give' );
26
+		$this->shortcode['title'] = esc_html__('Donation Form Goal', 'give');
27
+		$this->shortcode['label'] = esc_html__('Donation Form Goal', 'give');
28 28
 
29
-		parent::__construct( 'give_goal' );
29
+		parent::__construct('give_goal');
30 30
 	}
31 31
 
32 32
 	/**
@@ -38,8 +38,8 @@  discard block
 block discarded – undo
38 38
 
39 39
 		$create_form_link = sprintf(
40 40
 		/* translators: %s: create new form URL */
41
-			__( '<a href="%s">Create</a> a new Donation Form.', 'give' ),
42
-			admin_url( 'post-new.php?post_type=give_forms' )
41
+			__('<a href="%s">Create</a> a new Donation Form.', 'give'),
42
+			admin_url('post-new.php?post_type=give_forms')
43 43
 		);
44 44
 
45 45
 		return array(
@@ -51,35 +51,35 @@  discard block
 block discarded – undo
51 51
 					'meta_value' => 'enabled',
52 52
 				),
53 53
 				'name'        => 'id',
54
-				'tooltip'     => esc_attr__( 'Select a Donation Form', 'give' ),
55
-				'placeholder' => '- ' . esc_attr__( 'Select a Donation Form', 'give' ) . ' -',
54
+				'tooltip'     => esc_attr__('Select a Donation Form', 'give'),
55
+				'placeholder' => '- '.esc_attr__('Select a Donation Form', 'give').' -',
56 56
 				'required'    => array(
57
-					'alert' => esc_html__( 'You must first select a Form!', 'give' ),
58
-					'error' => sprintf( '<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__( 'No forms found.', 'give' ), $create_form_link ),
57
+					'alert' => esc_html__('You must first select a Form!', 'give'),
58
+					'error' => sprintf('<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__('No forms found.', 'give'), $create_form_link),
59 59
 				),
60 60
 			),
61 61
 			array(
62 62
 				'type' => 'container',
63
-				'html' => sprintf( '<p class="strong margin-top">%s</p>', esc_html__( 'Optional settings', 'give' ) ),
63
+				'html' => sprintf('<p class="strong margin-top">%s</p>', esc_html__('Optional settings', 'give')),
64 64
 			),
65 65
 			array(
66 66
 				'type'    => 'listbox',
67 67
 				'name'    => 'show_text',
68
-				'label'   => esc_attr__( 'Show Text:', 'give' ),
69
-				'tooltip' => esc_attr__( 'This text displays the amount of income raised compared to the goal.', 'give' ),
68
+				'label'   => esc_attr__('Show Text:', 'give'),
69
+				'tooltip' => esc_attr__('This text displays the amount of income raised compared to the goal.', 'give'),
70 70
 				'options' => array(
71
-					'true'  => esc_html__( 'Show', 'give' ),
72
-					'false' => esc_html__( 'Hide', 'give' ),
71
+					'true'  => esc_html__('Show', 'give'),
72
+					'false' => esc_html__('Hide', 'give'),
73 73
 				),
74 74
 			),
75 75
 			array(
76 76
 				'type'    => 'listbox',
77 77
 				'name'    => 'show_bar',
78
-				'label'   => esc_attr__( 'Show Progress Bar:', 'give' ),
79
-				'tooltip' => esc_attr__( 'Do you want to display the goal\'s progress bar?', 'give' ),
78
+				'label'   => esc_attr__('Show Progress Bar:', 'give'),
79
+				'tooltip' => esc_attr__('Do you want to display the goal\'s progress bar?', 'give'),
80 80
 				'options' => array(
81
-					'true'  => esc_html__( 'Show', 'give' ),
82
-					'false' => esc_html__( 'Hide', 'give' ),
81
+					'true'  => esc_html__('Show', 'give'),
82
+					'false' => esc_html__('Hide', 'give'),
83 83
 				),
84 84
 			),
85 85
 		);
Please login to merge, or discard this patch.
includes/gateways/offline-donations.php 1 patch
Spacing   +153 added lines, -153 removed lines patch added patch discarded remove patch
@@ -18,17 +18,17 @@  discard block
 block discarded – undo
18 18
  *
19 19
  * @return array
20 20
  */
21
-function give_offline_register_gateway( $gateways ) {
21
+function give_offline_register_gateway($gateways) {
22 22
 	// Format: ID => Name
23 23
 	$gateways['offline'] = array(
24
-		'admin_label'    => esc_attr__( 'Offline Donation', 'give' ),
25
-		'checkout_label' => esc_attr__( 'Offline Donation', 'give' )
24
+		'admin_label'    => esc_attr__('Offline Donation', 'give'),
25
+		'checkout_label' => esc_attr__('Offline Donation', 'give')
26 26
 	);
27 27
 
28 28
 	return $gateways;
29 29
 }
30 30
 
31
-add_filter( 'give_payment_gateways', 'give_offline_register_gateway', 1 );
31
+add_filter('give_payment_gateways', 'give_offline_register_gateway', 1);
32 32
 
33 33
 
34 34
 /**
@@ -40,9 +40,9 @@  discard block
 block discarded – undo
40 40
  *
41 41
  * @return void
42 42
  */
43
-function give_offline_payment_cc_form( $form_id ) {
43
+function give_offline_payment_cc_form($form_id) {
44 44
 	// Get offline payment instruction.
45
-	$offline_instructions = give_get_offline_payment_instruction( $form_id, true );
45
+	$offline_instructions = give_get_offline_payment_instruction($form_id, true);
46 46
 
47 47
 	ob_start();
48 48
 
@@ -53,10 +53,10 @@  discard block
 block discarded – undo
53 53
 	 *
54 54
 	 * @param int $form_id Give form id.
55 55
 	 */
56
-	do_action( 'give_before_offline_info_fields', $form_id );
56
+	do_action('give_before_offline_info_fields', $form_id);
57 57
 	?>
58 58
     <fieldset id="give_offline_payment_info">
59
-		<?php echo stripslashes( $offline_instructions ); ?>
59
+		<?php echo stripslashes($offline_instructions); ?>
60 60
     </fieldset>
61 61
 	<?php
62 62
 	/**
@@ -66,35 +66,35 @@  discard block
 block discarded – undo
66 66
 	 *
67 67
 	 * @param int $form_id Give form id.
68 68
 	 */
69
-	do_action( 'give_after_offline_info_fields', $form_id );
69
+	do_action('give_after_offline_info_fields', $form_id);
70 70
 
71 71
 	echo ob_get_clean();
72 72
 }
73 73
 
74
-add_action( 'give_offline_cc_form', 'give_offline_payment_cc_form' );
74
+add_action('give_offline_cc_form', 'give_offline_payment_cc_form');
75 75
 
76 76
 /**
77 77
  * Give Offline Billing Field
78 78
  *
79 79
  * @param $form_id
80 80
  */
81
-function give_offline_billing_fields( $form_id ) {
81
+function give_offline_billing_fields($form_id) {
82 82
 	//Enable Default CC fields (billing info)
83
-	$post_offline_cc_fields        = give_get_meta( $form_id, '_give_offline_donation_enable_billing_fields_single', true );
84
-	$post_offline_customize_option = give_get_meta( $form_id, '_give_customize_offline_donations', true );
83
+	$post_offline_cc_fields        = give_get_meta($form_id, '_give_offline_donation_enable_billing_fields_single', true);
84
+	$post_offline_customize_option = give_get_meta($form_id, '_give_customize_offline_donations', true);
85 85
 
86
-	$global_offline_cc_fields = give_get_option( 'give_offline_donation_enable_billing_fields' );
86
+	$global_offline_cc_fields = give_get_option('give_offline_donation_enable_billing_fields');
87 87
 
88 88
 	//Output CC Address fields if global option is on and user hasn't elected to customize this form's offline donation options
89 89
 	if (
90
-		( give_is_setting_enabled( $post_offline_customize_option, 'global' ) && give_is_setting_enabled( $global_offline_cc_fields ) )
91
-		|| ( give_is_setting_enabled( $post_offline_customize_option, 'enabled' ) && give_is_setting_enabled( $post_offline_cc_fields ) )
90
+		(give_is_setting_enabled($post_offline_customize_option, 'global') && give_is_setting_enabled($global_offline_cc_fields))
91
+		|| (give_is_setting_enabled($post_offline_customize_option, 'enabled') && give_is_setting_enabled($post_offline_cc_fields))
92 92
 	) {
93
-		give_default_cc_address_fields( $form_id );
93
+		give_default_cc_address_fields($form_id);
94 94
 	}
95 95
 }
96 96
 
97
-add_action( 'give_before_offline_info_fields', 'give_offline_billing_fields', 10, 1 );
97
+add_action('give_before_offline_info_fields', 'give_offline_billing_fields', 10, 1);
98 98
 
99 99
 /**
100 100
  * Process the payment
@@ -105,14 +105,14 @@  discard block
 block discarded – undo
105 105
  *
106 106
  * @return void
107 107
  */
108
-function give_offline_process_payment( $purchase_data ) {
108
+function give_offline_process_payment($purchase_data) {
109 109
 
110 110
 	// Setup the payment details.
111 111
 	$payment_data = array(
112 112
 		'price'           => $purchase_data['price'],
113 113
 		'give_form_title' => $purchase_data['post_data']['give-form-title'],
114
-		'give_form_id'    => intval( $purchase_data['post_data']['give-form-id'] ),
115
-		'give_price_id'   => isset( $purchase_data['post_data']['give-price-id'] ) ? $purchase_data['post_data']['give-price-id'] : '',
114
+		'give_form_id'    => intval($purchase_data['post_data']['give-form-id']),
115
+		'give_price_id'   => isset($purchase_data['post_data']['give-price-id']) ? $purchase_data['post_data']['give-price-id'] : '',
116 116
 		'date'            => $purchase_data['date'],
117 117
 		'user_email'      => $purchase_data['user_email'],
118 118
 		'purchase_key'    => $purchase_data['purchase_key'],
@@ -124,20 +124,20 @@  discard block
 block discarded – undo
124 124
 
125 125
 
126 126
 	// record the pending payment
127
-	$payment = give_insert_payment( $payment_data );
127
+	$payment = give_insert_payment($payment_data);
128 128
 
129
-	if ( $payment ) {
130
-		give_offline_send_admin_notice( $payment );
131
-		give_offline_send_donor_instructions( $payment );
129
+	if ($payment) {
130
+		give_offline_send_admin_notice($payment);
131
+		give_offline_send_donor_instructions($payment);
132 132
 		give_send_to_success_page();
133 133
 	} else {
134 134
 		// if errors are present, send the user back to the donation form so they can be corrected
135
-		give_send_back_to_checkout( '?payment-mode=' . $purchase_data['post_data']['give-gateway'] );
135
+		give_send_back_to_checkout('?payment-mode='.$purchase_data['post_data']['give-gateway']);
136 136
 	}
137 137
 
138 138
 }
139 139
 
140
-add_action( 'give_gateway_offline', 'give_offline_process_payment' );
140
+add_action('give_gateway_offline', 'give_offline_process_payment');
141 141
 
142 142
 
143 143
 /**
@@ -150,59 +150,59 @@  discard block
 block discarded – undo
150 150
  * @since       1.0
151 151
  * @return void
152 152
  */
153
-function give_offline_send_donor_instructions( $payment_id = 0 ) {
153
+function give_offline_send_donor_instructions($payment_id = 0) {
154 154
 
155
-	$payment_data                      = give_get_payment_meta( $payment_id );
156
-	$post_offline_customization_option = give_get_meta( $payment_data['form_id'], '_give_customize_offline_donations', true );
155
+	$payment_data                      = give_get_payment_meta($payment_id);
156
+	$post_offline_customization_option = give_get_meta($payment_data['form_id'], '_give_customize_offline_donations', true);
157 157
 
158 158
 	//Customize email content depending on whether the single form has been customized
159
-	$email_content = give_get_option( 'global_offline_donation_email' );
159
+	$email_content = give_get_option('global_offline_donation_email');
160 160
 
161
-	if ( give_is_setting_enabled( $post_offline_customization_option, 'enabled' ) ) {
162
-		$email_content = give_get_meta( $payment_data['form_id'], '_give_offline_donation_email', true );
161
+	if (give_is_setting_enabled($post_offline_customization_option, 'enabled')) {
162
+		$email_content = give_get_meta($payment_data['form_id'], '_give_offline_donation_email', true);
163 163
 	}
164 164
 
165
-	$from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) );
165
+	$from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES));
166 166
 
167 167
 	/**
168 168
 	 * Filters the from name.
169 169
 	 *
170 170
 	 * @since 1.7
171 171
 	 */
172
-	$from_name = apply_filters( 'give_donation_from_name', $from_name, $payment_id, $payment_data );
172
+	$from_name = apply_filters('give_donation_from_name', $from_name, $payment_id, $payment_data);
173 173
 
174
-	$from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) );
174
+	$from_email = give_get_option('from_email', get_bloginfo('admin_email'));
175 175
 
176 176
 	/**
177 177
 	 * Filters the from email.
178 178
 	 *
179 179
 	 * @since 1.7
180 180
 	 */
181
-	$from_email = apply_filters( 'give_donation_from_address', $from_email, $payment_id, $payment_data );
181
+	$from_email = apply_filters('give_donation_from_address', $from_email, $payment_id, $payment_data);
182 182
 
183
-	$to_email = give_get_payment_user_email( $payment_id );
183
+	$to_email = give_get_payment_user_email($payment_id);
184 184
 
185
-	$subject = give_get_option( 'offline_donation_subject', __( 'Offline Donation Instructions', 'give' ) );
186
-	if ( give_is_setting_enabled( $post_offline_customization_option, 'enabled' ) ) {
187
-		$subject = give_get_meta( $payment_data['form_id'], '_give_offline_donation_subject', true );
185
+	$subject = give_get_option('offline_donation_subject', __('Offline Donation Instructions', 'give'));
186
+	if (give_is_setting_enabled($post_offline_customization_option, 'enabled')) {
187
+		$subject = give_get_meta($payment_data['form_id'], '_give_offline_donation_subject', true);
188 188
 	}
189 189
 
190
-	$subject = apply_filters( 'give_offline_donation_subject', wp_strip_all_tags( $subject ), $payment_id );
191
-	$subject = give_do_email_tags( $subject, $payment_id );
190
+	$subject = apply_filters('give_offline_donation_subject', wp_strip_all_tags($subject), $payment_id);
191
+	$subject = give_do_email_tags($subject, $payment_id);
192 192
 
193
-	$attachments = apply_filters( 'give_offline_donation_attachments', array(), $payment_id, $payment_data );
194
-	$message     = give_do_email_tags( $email_content, $payment_id );
193
+	$attachments = apply_filters('give_offline_donation_attachments', array(), $payment_id, $payment_data);
194
+	$message     = give_do_email_tags($email_content, $payment_id);
195 195
 
196 196
 	$emails = Give()->emails;
197 197
 
198
-	$emails->__set( 'from_name', $from_name );
199
-	$emails->__set( 'from_email', $from_email );
200
-	$emails->__set( 'heading', __( 'Offline Donation Instructions', 'give' ) );
198
+	$emails->__set('from_name', $from_name);
199
+	$emails->__set('from_email', $from_email);
200
+	$emails->__set('heading', __('Offline Donation Instructions', 'give'));
201 201
 
202
-	$headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data );
203
-	$emails->__set( 'headers', $headers );
202
+	$headers = apply_filters('give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data);
203
+	$emails->__set('headers', $headers);
204 204
 
205
-	$emails->send( $to_email, $subject, $message, $attachments );
205
+	$emails->send($to_email, $subject, $message, $attachments);
206 206
 
207 207
 }
208 208
 
@@ -219,54 +219,54 @@  discard block
 block discarded – undo
219 219
  * @return void
220 220
  *
221 221
  */
222
-function give_offline_send_admin_notice( $payment_id = 0 ) {
222
+function give_offline_send_admin_notice($payment_id = 0) {
223 223
 
224 224
 	/* Send an email notification to the admin */
225 225
 	$admin_email = give_get_admin_notice_emails();
226
-	$user_info   = give_get_payment_meta_user_info( $payment_id );
226
+	$user_info   = give_get_payment_meta_user_info($payment_id);
227 227
 
228
-	if ( isset( $user_info['id'] ) && $user_info['id'] > 0 ) {
229
-		$user_data = get_userdata( $user_info['id'] );
228
+	if (isset($user_info['id']) && $user_info['id'] > 0) {
229
+		$user_data = get_userdata($user_info['id']);
230 230
 		$name      = $user_data->display_name;
231
-	} elseif ( isset( $user_info['first_name'] ) && isset( $user_info['last_name'] ) ) {
232
-		$name = $user_info['first_name'] . ' ' . $user_info['last_name'];
231
+	} elseif (isset($user_info['first_name']) && isset($user_info['last_name'])) {
232
+		$name = $user_info['first_name'].' '.$user_info['last_name'];
233 233
 	} else {
234 234
 		$name = $user_info['email'];
235 235
 	}
236 236
 
237
-	$amount = give_currency_filter( give_format_amount( give_get_payment_amount( $payment_id ), array( 'sanitize' => false ) ) );
237
+	$amount = give_currency_filter(give_format_amount(give_get_payment_amount($payment_id), array('sanitize' => false)));
238 238
 
239
-	$admin_subject = apply_filters( 'give_offline_admin_donation_notification_subject', __( 'New Pending Donation', 'give' ), $payment_id );
239
+	$admin_subject = apply_filters('give_offline_admin_donation_notification_subject', __('New Pending Donation', 'give'), $payment_id);
240 240
 
241
-	$admin_message = __( 'Dear Admin,', 'give' ) . "\n\n";
242
-	$admin_message .= sprintf(__( 'A new offline donation has been made on your website for %s.', 'give' ), $amount) . "\n\n";
243
-	$admin_message .= __( 'The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give' ) . "\n\n";
241
+	$admin_message = __('Dear Admin,', 'give')."\n\n";
242
+	$admin_message .= sprintf(__('A new offline donation has been made on your website for %s.', 'give'), $amount)."\n\n";
243
+	$admin_message .= __('The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give')."\n\n";
244 244
 
245 245
 
246
-	$admin_message .= '<strong>' . __( 'Donor:', 'give' ) . '</strong> {fullname}' . "\n";
247
-	$admin_message .= '<strong>' . __( 'Amount:', 'give' ) . '</strong> {amount}' . "\n\n";
246
+	$admin_message .= '<strong>'.__('Donor:', 'give').'</strong> {fullname}'."\n";
247
+	$admin_message .= '<strong>'.__('Amount:', 'give').'</strong> {amount}'."\n\n";
248 248
 
249 249
 	$admin_message .= sprintf(
250 250
 		                  '<a href="%1$s">%2$s</a>',
251
-		                  admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $payment_id ),
252
-		                  __( 'View Donation Details &raquo;', 'give' )
253
-	                  ) . "\n\n";
251
+		                  admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id='.$payment_id),
252
+		                  __('View Donation Details &raquo;', 'give')
253
+	                  )."\n\n";
254 254
 
255
-	$admin_message = apply_filters( 'give_offline_admin_donation_notification', $admin_message, $payment_id );
256
-	$admin_message = give_do_email_tags( $admin_message, $payment_id );
255
+	$admin_message = apply_filters('give_offline_admin_donation_notification', $admin_message, $payment_id);
256
+	$admin_message = give_do_email_tags($admin_message, $payment_id);
257 257
 
258
-	$attachments   = apply_filters( 'give_offline_admin_donation_notification_attachments', array(), $payment_id );
259
-	$admin_headers = apply_filters( 'give_offline_admin_donation_notification_headers', array(), $payment_id );
258
+	$attachments   = apply_filters('give_offline_admin_donation_notification_attachments', array(), $payment_id);
259
+	$admin_headers = apply_filters('give_offline_admin_donation_notification_headers', array(), $payment_id);
260 260
 
261 261
 	//Send Email
262 262
 	$emails = Give()->emails;
263
-	$emails->__set( 'heading', __( 'New Offline Donation', 'give' ) );
263
+	$emails->__set('heading', __('New Offline Donation', 'give'));
264 264
 
265
-	if ( ! empty( $admin_headers ) ) {
266
-		$emails->__set( 'headers', $admin_headers );
265
+	if ( ! empty($admin_headers)) {
266
+		$emails->__set('headers', $admin_headers);
267 267
 	}
268 268
 
269
-	$emails->send( $admin_email, $admin_subject, $admin_message, $attachments );
269
+	$emails->send($admin_email, $admin_subject, $admin_message, $attachments);
270 270
 
271 271
 }
272 272
 
@@ -278,20 +278,20 @@  discard block
 block discarded – undo
278 278
  *
279 279
  * @return array
280 280
  */
281
-function give_offline_add_settings( $settings ) {
281
+function give_offline_add_settings($settings) {
282 282
 
283 283
 	// Bailout: Do not show offline gateways setting in to metabox if its disabled globally.
284
-	if ( in_array( 'offline', give_get_option( 'gateways' ) ) ) {
284
+	if (in_array('offline', give_get_option('gateways'))) {
285 285
 		return $settings;
286 286
 	}
287 287
 
288 288
 	//Vars
289 289
 	$prefix = '_give_';
290 290
 
291
-	$is_gateway_active = give_is_gateway_active( 'offline' );
291
+	$is_gateway_active = give_is_gateway_active('offline');
292 292
 
293 293
 	//this gateway isn't active
294
-	if ( ! $is_gateway_active ) {
294
+	if ( ! $is_gateway_active) {
295 295
 		//return settings and bounce
296 296
 		return $settings;
297 297
 	}
@@ -300,34 +300,34 @@  discard block
 block discarded – undo
300 300
 	$check_settings = array(
301 301
 
302 302
 		array(
303
-			'name'    => __( 'Offline Donations', 'give' ),
304
-			'desc'    => __( 'Do you want to customize the donation instructions for this form?', 'give' ),
305
-			'id'      => $prefix . 'customize_offline_donations',
303
+			'name'    => __('Offline Donations', 'give'),
304
+			'desc'    => __('Do you want to customize the donation instructions for this form?', 'give'),
305
+			'id'      => $prefix.'customize_offline_donations',
306 306
 			'type'    => 'radio_inline',
307 307
 			'default' => 'global',
308
-			'options' => apply_filters( 'give_forms_content_options_select', array(
309
-					'global'   => __( 'Global Option', 'give' ),
310
-					'enabled'  => __( 'Customize', 'give' ),
311
-					'disabled' => __( 'Disable', 'give' ),
308
+			'options' => apply_filters('give_forms_content_options_select', array(
309
+					'global'   => __('Global Option', 'give'),
310
+					'enabled'  => __('Customize', 'give'),
311
+					'disabled' => __('Disable', 'give'),
312 312
 				)
313 313
 			),
314 314
 		),
315 315
 		array(
316
-			'name'        => __( 'Billing Fields', 'give' ),
317
-			'desc'        => __( 'This option will enable the billing details section for this form\'s offline donation payment gateway. The fieldset will appear above the offline donation instructions.', 'give' ),
318
-			'id'          => $prefix . 'offline_donation_enable_billing_fields_single',
316
+			'name'        => __('Billing Fields', 'give'),
317
+			'desc'        => __('This option will enable the billing details section for this form\'s offline donation payment gateway. The fieldset will appear above the offline donation instructions.', 'give'),
318
+			'id'          => $prefix.'offline_donation_enable_billing_fields_single',
319 319
 			'row_classes' => 'give-subfield',
320 320
 			'type'        => 'radio_inline',
321 321
 			'default'     => 'disabled',
322 322
 			'options'     => array(
323
-				'enabled'  => __( 'Enabled', 'give' ),
324
-				'disabled' => __( 'Disabled', 'give' ),
323
+				'enabled'  => __('Enabled', 'give'),
324
+				'disabled' => __('Disabled', 'give'),
325 325
 			),
326 326
 		),
327 327
 		array(
328
-			'id'          => $prefix . 'offline_checkout_notes',
329
-			'name'        => __( 'Donation Instructions', 'give' ),
330
-			'desc'        => __( 'Enter the instructions you want to display to the donor during the donation process. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ),
328
+			'id'          => $prefix.'offline_checkout_notes',
329
+			'name'        => __('Donation Instructions', 'give'),
330
+			'desc'        => __('Enter the instructions you want to display to the donor during the donation process. Most likely this would include important information like mailing address and who to make the check out to.', 'give'),
331 331
 			'default'     => give_get_default_offline_donation_content(),
332 332
 			'type'        => 'wysiwyg',
333 333
 			'row_classes' => 'give-subfield',
@@ -336,17 +336,17 @@  discard block
 block discarded – undo
336 336
 			)
337 337
 		),
338 338
 		array(
339
-			'id'          => $prefix . 'offline_donation_subject',
340
-			'name'        => __( 'Email Subject', 'give' ),
341
-			'desc'        => __( 'Enter the subject line for the donation receipt email.', 'give' ),
342
-			'default'     => __( '{form_title} - Offline Donation Instructions', 'give' ),
339
+			'id'          => $prefix.'offline_donation_subject',
340
+			'name'        => __('Email Subject', 'give'),
341
+			'desc'        => __('Enter the subject line for the donation receipt email.', 'give'),
342
+			'default'     => __('{form_title} - Offline Donation Instructions', 'give'),
343 343
 			'row_classes' => 'give-subfield',
344 344
 			'type'        => 'text'
345 345
 		),
346 346
 		array(
347
-			'id'          => $prefix . 'offline_donation_email',
348
-			'name'        => __( 'Email Instructions', 'give' ),
349
-			'desc'        => __( 'Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ) . ' ' . __( 'Available template tags:', 'give' ) . give_get_emails_tags_list(),
347
+			'id'          => $prefix.'offline_donation_email',
348
+			'name'        => __('Email Instructions', 'give'),
349
+			'desc'        => __('Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give').' '.__('Available template tags:', 'give').give_get_emails_tags_list(),
350 350
 			'default'     => give_get_default_offline_donation_email_content(),
351 351
 			'type'        => 'wysiwyg',
352 352
 			'row_classes' => 'give-subfield',
@@ -358,14 +358,14 @@  discard block
 block discarded – undo
358 358
 			'name'  => 'offline_docs',
359 359
 			'type'  => 'docs_link',
360 360
 			'url'   => 'http://docs.givewp.com/settings-gateway-offline-donations',
361
-			'title' => __( 'Offline Donations', 'give' ),
361
+			'title' => __('Offline Donations', 'give'),
362 362
 		),
363 363
 	);
364 364
 
365
-	return array_merge( $settings, $check_settings );
365
+	return array_merge($settings, $check_settings);
366 366
 }
367 367
 
368
-add_filter( 'give_forms_offline_donations_metabox_fields', 'give_offline_add_settings' );
368
+add_filter('give_forms_offline_donations_metabox_fields', 'give_offline_add_settings');
369 369
 
370 370
 
371 371
 /**
@@ -377,32 +377,32 @@  discard block
 block discarded – undo
377 377
  */
378 378
 function give_get_default_offline_donation_content() {
379 379
 
380
-	$sitename = get_bloginfo( 'sitename' );
380
+	$sitename = get_bloginfo('sitename');
381 381
 
382
-	$default_text = '<p>' . __( 'In order to make an offline donation we ask that you please follow these instructions', 'give' ) . ': </p>';
382
+	$default_text = '<p>'.__('In order to make an offline donation we ask that you please follow these instructions', 'give').': </p>';
383 383
 	$default_text .= '<ol>';
384 384
 	$default_text .= '<li>';
385 385
 	$default_text .= sprintf(
386 386
 	/* translators: %s: site name */
387
-		__( 'Make a check payable to "%s"', 'give' ),
387
+		__('Make a check payable to "%s"', 'give'),
388 388
 		$sitename
389 389
 	);
390 390
 	$default_text .= '</li>';
391 391
 	$default_text .= '<li>';
392 392
 	$default_text .= sprintf(
393 393
 	/* translators: %s: site name */
394
-		__( 'On the memo line of the check, please indicate that the donation is for "%s"', 'give' ),
394
+		__('On the memo line of the check, please indicate that the donation is for "%s"', 'give'),
395 395
 		$sitename
396 396
 	);
397 397
 	$default_text .= '</li>';
398
-	$default_text .= '<li>' . __( 'Please mail your check to:', 'give' ) . '</li>';
398
+	$default_text .= '<li>'.__('Please mail your check to:', 'give').'</li>';
399 399
 	$default_text .= '</ol>';
400
-	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>' . $sitename . '</em><br>';
400
+	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>'.$sitename.'</em><br>';
401 401
 	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>111 Not A Real St.</em><br>';
402 402
 	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>Anytown, CA 12345 </em><br>';
403
-	$default_text .= '<p>' . __( 'All contributions will be gratefully acknowledged and are tax deductible.', 'give' ) . '</p>';
403
+	$default_text .= '<p>'.__('All contributions will be gratefully acknowledged and are tax deductible.', 'give').'</p>';
404 404
 
405
-	return apply_filters( 'give_default_offline_donation_content', $default_text );
405
+	return apply_filters('give_default_offline_donation_content', $default_text);
406 406
 
407 407
 }
408 408
 
@@ -415,34 +415,34 @@  discard block
 block discarded – undo
415 415
  */
416 416
 function give_get_default_offline_donation_email_content() {
417 417
 
418
-	$sitename     = get_bloginfo( 'sitename' );
419
-	$default_text = '<p>' . __( 'Dear {name},', 'give' ) . '</p>';
420
-	$default_text .= '<p>' . __( 'Thank you for your offline donation request! Your generosity is greatly appreciated. In order to make an offline donation we ask that you please follow these instructions:', 'give' ) . '</p>';
418
+	$sitename     = get_bloginfo('sitename');
419
+	$default_text = '<p>'.__('Dear {name},', 'give').'</p>';
420
+	$default_text .= '<p>'.__('Thank you for your offline donation request! Your generosity is greatly appreciated. In order to make an offline donation we ask that you please follow these instructions:', 'give').'</p>';
421 421
 	$default_text .= '<ol>';
422 422
 	$default_text .= '<li>';
423 423
 	$default_text .= sprintf(
424 424
 	/* translators: %s: site name */
425
-		__( 'Make a check payable to "%s"', 'give' ),
425
+		__('Make a check payable to "%s"', 'give'),
426 426
 		$sitename
427 427
 	);
428 428
 	$default_text .= '</li>';
429 429
 	$default_text .= '<li>';
430 430
 	$default_text .= sprintf(
431 431
 	/* translators: %s: site name */
432
-		__( 'On the memo line of the check, please indicate that the donation is for "%s"', 'give' ),
432
+		__('On the memo line of the check, please indicate that the donation is for "%s"', 'give'),
433 433
 		$sitename
434 434
 	);
435 435
 	$default_text .= '</li>';
436
-	$default_text .= '<li>' . __( 'Please mail your check to:', 'give' ) . '</li>';
436
+	$default_text .= '<li>'.__('Please mail your check to:', 'give').'</li>';
437 437
 	$default_text .= '</ol>';
438
-	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>' . $sitename . '</em><br>';
438
+	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>'.$sitename.'</em><br>';
439 439
 	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>111 Not A Real St.</em><br>';
440 440
 	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>Anytown, CA 12345 </em><br>';
441
-	$default_text .= '<p>' . __( 'Once your donation has been received we will mark it as complete and you will receive an email receipt for your records. Please contact us with any questions you may have!', 'give' ) . '</p>';
442
-	$default_text .= '<p>' . __( 'Sincerely,', 'give' ) . '</p>';
443
-	$default_text .= '<p>' . $sitename . '</p>';
441
+	$default_text .= '<p>'.__('Once your donation has been received we will mark it as complete and you will receive an email receipt for your records. Please contact us with any questions you may have!', 'give').'</p>';
442
+	$default_text .= '<p>'.__('Sincerely,', 'give').'</p>';
443
+	$default_text .= '<p>'.$sitename.'</p>';
444 444
 
445
-	return apply_filters( 'give_default_offline_donation_content', $default_text );
445
+	return apply_filters('give_default_offline_donation_content', $default_text);
446 446
 
447 447
 }
448 448
 
@@ -456,17 +456,17 @@  discard block
 block discarded – undo
456 456
  *
457 457
  * @return string
458 458
  */
459
-function give_offline_donation_receipt_status_notice( $notice, $id ) {
460
-	$payment = new Give_Payment( $id );
459
+function give_offline_donation_receipt_status_notice($notice, $id) {
460
+	$payment = new Give_Payment($id);
461 461
 
462
-	if ( 'offline' !== $payment->gateway || $payment->is_completed() ) {
462
+	if ('offline' !== $payment->gateway || $payment->is_completed()) {
463 463
 		return $notice;
464 464
 	}
465 465
 
466
-	return Give()->notices->print_frontend_notice( __( 'Payment Pending: Please follow the instructions below to complete your donation.', 'give' ), false, 'warning' );
466
+	return Give()->notices->print_frontend_notice(__('Payment Pending: Please follow the instructions below to complete your donation.', 'give'), false, 'warning');
467 467
 }
468 468
 
469
-add_filter( 'give_receipt_status_notice', 'give_offline_donation_receipt_status_notice', 10, 2 );
469
+add_filter('give_receipt_status_notice', 'give_offline_donation_receipt_status_notice', 10, 2);
470 470
 
471 471
 /**
472 472
  * Add offline payment instruction on payment receipt.
@@ -477,26 +477,26 @@  discard block
 block discarded – undo
477 477
  *
478 478
  * @return mixed
479 479
  */
480
-function give_offline_payment_receipt_after( $payment ) {
480
+function give_offline_payment_receipt_after($payment) {
481 481
 	// Get payment object.
482
-	$payment = new Give_Payment( $payment->ID );
482
+	$payment = new Give_Payment($payment->ID);
483 483
 
484 484
 	// Bailout.
485
-	if ( 'offline' !== $payment->gateway ) {
485
+	if ('offline' !== $payment->gateway) {
486 486
 		return false;
487 487
 	}
488 488
 
489 489
 	?>
490 490
     <tr>
491
-        <td scope="row"><strong><?php esc_html_e( 'Offline Donations Instructions', 'give' ); ?></strong></td>
491
+        <td scope="row"><strong><?php esc_html_e('Offline Donations Instructions', 'give'); ?></strong></td>
492 492
         <td>
493
-			<?php echo give_get_offline_payment_instruction( $payment->form_id, true ); ?>
493
+			<?php echo give_get_offline_payment_instruction($payment->form_id, true); ?>
494 494
         </td>
495 495
     </tr>
496 496
 	<?php
497 497
 }
498 498
 
499
-add_filter( 'give_payment_receipt_after', 'give_offline_payment_receipt_after' );
499
+add_filter('give_payment_receipt_after', 'give_offline_payment_receipt_after');
500 500
 
501 501
 /**
502 502
  * Get offline payment instructions.
@@ -508,27 +508,27 @@  discard block
 block discarded – undo
508 508
  *
509 509
  * @return string
510 510
  */
511
-function give_get_offline_payment_instruction( $form_id, $wpautop = false ) {
511
+function give_get_offline_payment_instruction($form_id, $wpautop = false) {
512 512
 	// Bailout.
513
-	if ( ! $form_id ) {
513
+	if ( ! $form_id) {
514 514
 		return '';
515 515
 	}
516 516
 
517
-	$post_offline_customization_option = give_get_meta( $form_id, '_give_customize_offline_donations', true );
518
-	$post_offline_instructions         = give_get_meta( $form_id, '_give_offline_checkout_notes', true );
519
-	$global_offline_instruction        = give_get_option( 'global_offline_donation_content' );
517
+	$post_offline_customization_option = give_get_meta($form_id, '_give_customize_offline_donations', true);
518
+	$post_offline_instructions         = give_get_meta($form_id, '_give_offline_checkout_notes', true);
519
+	$global_offline_instruction        = give_get_option('global_offline_donation_content');
520 520
 	$offline_instructions              = $global_offline_instruction;
521 521
 
522
-	if ( give_is_setting_enabled( $post_offline_customization_option ) ) {
522
+	if (give_is_setting_enabled($post_offline_customization_option)) {
523 523
 		$offline_instructions = $post_offline_instructions;
524 524
 	}
525 525
 
526
-	$settings_url = admin_url( 'post.php?post=' . $form_id . '&action=edit&message=1' );
526
+	$settings_url = admin_url('post.php?post='.$form_id.'&action=edit&message=1');
527 527
 
528 528
 	/* translators: %s: form settings url */
529
-	$offline_instructions = ! empty( $offline_instructions ) ? $offline_instructions : sprintf( __( 'Please enter offline donation instructions in <a href="%s">this form\'s settings</a>.', 'give' ), $settings_url );
529
+	$offline_instructions = ! empty($offline_instructions) ? $offline_instructions : sprintf(__('Please enter offline donation instructions in <a href="%s">this form\'s settings</a>.', 'give'), $settings_url);
530 530
 
531
-	return ( $wpautop ? wpautop( $offline_instructions ) : $offline_instructions );
531
+	return ($wpautop ? wpautop($offline_instructions) : $offline_instructions);
532 532
 }
533 533
 
534 534
 
@@ -542,24 +542,24 @@  discard block
 block discarded – undo
542 542
  *
543 543
  * @return array
544 544
  */
545
-function give_filter_offline_gateway( $gateway_list, $form_id ) {
545
+function give_filter_offline_gateway($gateway_list, $form_id) {
546 546
 	if (
547 547
 		// Show offline payment gateway if enable for new donation form.
548
-		( false === strpos( $_SERVER['REQUEST_URI'], '/wp-admin/post-new.php?post_type=give_forms' ) )
548
+		(false === strpos($_SERVER['REQUEST_URI'], '/wp-admin/post-new.php?post_type=give_forms'))
549 549
 		&& $form_id
550
-		&& ! give_is_setting_enabled( give_get_meta( $form_id, '_give_customize_offline_donations', true ), array(
550
+		&& ! give_is_setting_enabled(give_get_meta($form_id, '_give_customize_offline_donations', true), array(
551 551
 			'enabled',
552 552
 			'global',
553
-		) )
553
+		))
554 554
 	) {
555
-		unset( $gateway_list['offline'] );
555
+		unset($gateway_list['offline']);
556 556
 	}
557 557
 
558 558
 	// Output.
559 559
 	return $gateway_list;
560 560
 }
561 561
 
562
-add_filter( 'give_enabled_payment_gateways', 'give_filter_offline_gateway', 10, 2 );
562
+add_filter('give_enabled_payment_gateways', 'give_filter_offline_gateway', 10, 2);
563 563
 
564 564
 /**
565 565
  * Set default gateway to global default payment gateway
@@ -573,10 +573,10 @@  discard block
 block discarded – undo
573 573
  *
574 574
  * @return void
575 575
  */
576
-function _give_customize_offline_donations_on_save_callback( $meta_key, $meta_value, $postid ) {
577
-	if ( ! give_is_setting_enabled( $meta_value ) && ( 'offline' === give_get_meta( $postid, '_give_default_gateway', true ) ) ) {
578
-		give_update_meta( $postid, '_give_default_gateway', 'global' );
576
+function _give_customize_offline_donations_on_save_callback($meta_key, $meta_value, $postid) {
577
+	if ( ! give_is_setting_enabled($meta_value) && ('offline' === give_get_meta($postid, '_give_default_gateway', true))) {
578
+		give_update_meta($postid, '_give_default_gateway', 'global');
579 579
 	}
580 580
 }
581 581
 
582
-add_filter( 'give_save__give_customize_offline_donations', '_give_customize_offline_donations_on_save_callback', 10, 3 );
582
+add_filter('give_save__give_customize_offline_donations', '_give_customize_offline_donations_on_save_callback', 10, 3);
Please login to merge, or discard this patch.
includes/gateways/paypal-standard.php 1 patch
Spacing   +173 added lines, -173 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  * @since       1.0
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit;
14 14
 }
15 15
 
@@ -22,10 +22,10 @@  discard block
 block discarded – undo
22 22
  *
23 23
  * @return bool
24 24
  */
25
-function give_paypal_standard_billing_fields( $form_id ) {
25
+function give_paypal_standard_billing_fields($form_id) {
26 26
 
27
-	if ( give_is_setting_enabled( give_get_option( 'paypal_standard_billing_details' ) ) ) {
28
-		give_default_cc_address_fields( $form_id );
27
+	if (give_is_setting_enabled(give_get_option('paypal_standard_billing_details'))) {
28
+		give_default_cc_address_fields($form_id);
29 29
 
30 30
 		return true;
31 31
 	}
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 
35 35
 }
36 36
 
37
-add_action( 'give_paypal_cc_form', 'give_paypal_standard_billing_fields' );
37
+add_action('give_paypal_cc_form', 'give_paypal_standard_billing_fields');
38 38
 
39 39
 /**
40 40
  * Process PayPal Payment.
@@ -45,27 +45,27 @@  discard block
 block discarded – undo
45 45
  *
46 46
  * @return void
47 47
  */
48
-function give_process_paypal_payment( $payment_data ) {
48
+function give_process_paypal_payment($payment_data) {
49 49
 
50 50
 	// Validate nonce.
51
-	give_validate_nonce( $payment_data['gateway_nonce'], 'give-gateway' );
52
-	$payment_id = give_create_payment( $payment_data );
51
+	give_validate_nonce($payment_data['gateway_nonce'], 'give-gateway');
52
+	$payment_id = give_create_payment($payment_data);
53 53
 
54 54
 	// Check payment.
55
-	if ( empty( $payment_id ) ) {
55
+	if (empty($payment_id)) {
56 56
 		// Record the error.
57
-		give_record_gateway_error( __( 'Payment Error', 'give' ), sprintf( /* translators: %s: payment data */
58
-		__( 'Payment creation failed before sending donor to PayPal. Payment data: %s', 'give' ), json_encode( $payment_data ) ), $payment_id );
57
+		give_record_gateway_error(__('Payment Error', 'give'), sprintf( /* translators: %s: payment data */
58
+		__('Payment creation failed before sending donor to PayPal. Payment data: %s', 'give'), json_encode($payment_data) ), $payment_id);
59 59
 		// Problems? Send back.
60
-		give_send_back_to_checkout( '?payment-mode=' . $payment_data['post_data']['give-gateway'] );
60
+		give_send_back_to_checkout('?payment-mode='.$payment_data['post_data']['give-gateway']);
61 61
 	}
62 62
 
63 63
 	// Redirect to PayPal.
64
-	wp_redirect( give_build_paypal_url( $payment_id, $payment_data ) );
64
+	wp_redirect(give_build_paypal_url($payment_id, $payment_data));
65 65
 	exit;
66 66
 }
67 67
 
68
-add_action( 'give_gateway_paypal', 'give_process_paypal_payment' );
68
+add_action('give_gateway_paypal', 'give_process_paypal_payment');
69 69
 
70 70
 /**
71 71
  * Listens for a PayPal IPN requests and then sends to the processing function.
@@ -75,17 +75,17 @@  discard block
 block discarded – undo
75 75
  */
76 76
 function give_listen_for_paypal_ipn() {
77 77
 	// Regular PayPal IPN
78
-	if ( isset( $_GET['give-listener'] ) && $_GET['give-listener'] == 'IPN' ) {
78
+	if (isset($_GET['give-listener']) && $_GET['give-listener'] == 'IPN') {
79 79
 		/**
80 80
 		 * Fires while verifying PayPal IPN
81 81
 		 *
82 82
 		 * @since 1.0
83 83
 		 */
84
-		do_action( 'give_verify_paypal_ipn' );
84
+		do_action('give_verify_paypal_ipn');
85 85
 	}
86 86
 }
87 87
 
88
-add_action( 'init', 'give_listen_for_paypal_ipn' );
88
+add_action('init', 'give_listen_for_paypal_ipn');
89 89
 
90 90
 /**
91 91
  * Process PayPal IPN
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 function give_process_paypal_ipn() {
97 97
 
98 98
 	// Check the request method is POST.
99
-	if ( isset( $_SERVER['REQUEST_METHOD'] ) && 'POST' !== $_SERVER['REQUEST_METHOD'] ) {
99
+	if (isset($_SERVER['REQUEST_METHOD']) && 'POST' !== $_SERVER['REQUEST_METHOD']) {
100 100
 		return;
101 101
 	}
102 102
 
@@ -104,11 +104,11 @@  discard block
 block discarded – undo
104 104
 	$post_data = '';
105 105
 
106 106
 	// Fallback just in case post_max_size is lower than needed.
107
-	if ( ini_get( 'allow_url_fopen' ) ) {
108
-		$post_data = file_get_contents( 'php://input' );
107
+	if (ini_get('allow_url_fopen')) {
108
+		$post_data = file_get_contents('php://input');
109 109
 	} else {
110 110
 		// If allow_url_fopen is not enabled, then make sure that post_max_size is large enough.
111
-		ini_set( 'post_max_size', '12M' );
111
+		ini_set('post_max_size', '12M');
112 112
 	}
113 113
 	// Start the encoded data collection with notification command.
114 114
 	$encoded_data = 'cmd=_notify-validate';
@@ -117,39 +117,39 @@  discard block
 block discarded – undo
117 117
 	$arg_separator = give_get_php_arg_separator_output();
118 118
 
119 119
 	// Verify there is a post_data.
120
-	if ( $post_data || strlen( $post_data ) > 0 ) {
120
+	if ($post_data || strlen($post_data) > 0) {
121 121
 		// Append the data.
122
-		$encoded_data .= $arg_separator . $post_data;
122
+		$encoded_data .= $arg_separator.$post_data;
123 123
 	} else {
124 124
 		// Check if POST is empty.
125
-		if ( empty( $_POST ) ) {
125
+		if (empty($_POST)) {
126 126
 			// Nothing to do.
127 127
 			return;
128 128
 		} else {
129 129
 			// Loop through each POST.
130
-			foreach ( $_POST as $key => $value ) {
130
+			foreach ($_POST as $key => $value) {
131 131
 				// Encode the value and append the data.
132
-				$encoded_data .= $arg_separator . "$key=" . urlencode( $value );
132
+				$encoded_data .= $arg_separator."$key=".urlencode($value);
133 133
 			}
134 134
 		}
135 135
 	}
136 136
 
137 137
 	// Convert collected post data to an array.
138
-	parse_str( $encoded_data, $encoded_data_array );
138
+	parse_str($encoded_data, $encoded_data_array);
139 139
 
140
-	foreach ( $encoded_data_array as $key => $value ) {
140
+	foreach ($encoded_data_array as $key => $value) {
141 141
 
142
-		if ( false !== strpos( $key, 'amp;' ) ) {
143
-			$new_key = str_replace( '&amp;', '&', $key );
144
-			$new_key = str_replace( 'amp;', '&', $new_key );
142
+		if (false !== strpos($key, 'amp;')) {
143
+			$new_key = str_replace('&amp;', '&', $key);
144
+			$new_key = str_replace('amp;', '&', $new_key);
145 145
 
146
-			unset( $encoded_data_array[ $key ] );
147
-			$encoded_data_array[ $new_key ] = $value;
146
+			unset($encoded_data_array[$key]);
147
+			$encoded_data_array[$new_key] = $value;
148 148
 		}
149 149
 	}
150 150
 
151 151
 	// Validate IPN request w/ PayPal if user hasn't disabled this security measure.
152
-	if ( give_is_setting_enabled( give_get_option( 'paypal_verification' ) ) ) {
152
+	if (give_is_setting_enabled(give_get_option('paypal_verification'))) {
153 153
 
154 154
 		$remote_post_vars = array(
155 155
 			'method'      => 'POST',
@@ -169,25 +169,25 @@  discard block
 block discarded – undo
169 169
 		);
170 170
 
171 171
 		// Validate the IPN.
172
-		$api_response = wp_remote_post( give_get_paypal_redirect(), $remote_post_vars );
172
+		$api_response = wp_remote_post(give_get_paypal_redirect(), $remote_post_vars);
173 173
 
174
-		if ( is_wp_error( $api_response ) ) {
175
-			give_record_gateway_error( __( 'IPN Error', 'give' ), sprintf( /* translators: %s: Paypal IPN response */
176
-			__( 'Invalid IPN verification response. IPN data: %s', 'give' ), json_encode( $api_response ) ) );
174
+		if (is_wp_error($api_response)) {
175
+			give_record_gateway_error(__('IPN Error', 'give'), sprintf( /* translators: %s: Paypal IPN response */
176
+			__('Invalid IPN verification response. IPN data: %s', 'give'), json_encode($api_response) ));
177 177
 
178 178
 			return; // Something went wrong
179 179
 		}
180 180
 
181
-		if ( 'VERIFIED' !== $api_response['body'] ) {
182
-			give_record_gateway_error( __( 'IPN Error', 'give' ), sprintf( /* translators: %s: Paypal IPN response */
183
-			__( 'Invalid IPN verification response. IPN data: %s', 'give' ), json_encode( $api_response ) ) );
181
+		if ('VERIFIED' !== $api_response['body']) {
182
+			give_record_gateway_error(__('IPN Error', 'give'), sprintf( /* translators: %s: Paypal IPN response */
183
+			__('Invalid IPN verification response. IPN data: %s', 'give'), json_encode($api_response) ));
184 184
 
185 185
 			return; // Response not okay.
186 186
 		}
187 187
 	}// End if().
188 188
 
189 189
 	// Check if $post_data_array has been populated.
190
-	if ( ! is_array( $encoded_data_array ) && ! empty( $encoded_data_array ) ) {
190
+	if ( ! is_array($encoded_data_array) && ! empty($encoded_data_array)) {
191 191
 		return;
192 192
 	}
193 193
 
@@ -196,28 +196,28 @@  discard block
 block discarded – undo
196 196
 		'payment_status' => '',
197 197
 	);
198 198
 
199
-	$encoded_data_array = wp_parse_args( $encoded_data_array, $defaults );
199
+	$encoded_data_array = wp_parse_args($encoded_data_array, $defaults);
200 200
 
201
-	$payment_id = isset( $encoded_data_array['custom'] ) ? absint( $encoded_data_array['custom'] ) : 0;
201
+	$payment_id = isset($encoded_data_array['custom']) ? absint($encoded_data_array['custom']) : 0;
202 202
 	$txn_type   = $encoded_data_array['txn_type'];
203 203
 
204 204
 	// Check for PayPal IPN Notifications and update data based on it.
205
-	$current_timestamp = current_time( 'timestamp' );
205
+	$current_timestamp = current_time('timestamp');
206 206
 	$paypal_ipn_vars = array(
207
-		'auth_status'    => ( $api_response['body'] ) ? $api_response['body'] : 'N/A',
207
+		'auth_status'    => ($api_response['body']) ? $api_response['body'] : 'N/A',
208 208
 		'transaction_id' => $encoded_data_array['txn_id'],
209 209
 		'payment_id'     => $payment_id,
210 210
 	);
211
-	update_option( 'give_last_paypal_ipn_received', $paypal_ipn_vars );
212
-	give_insert_payment_note( $payment_id, sprintf(
213
-				__( 'Last IPN received on %s at %s', 'give' ),
214
-				date_i18n( 'm/d/Y', $current_timestamp ),
215
-				date_i18n( 'H:i', $current_timestamp )
211
+	update_option('give_last_paypal_ipn_received', $paypal_ipn_vars);
212
+	give_insert_payment_note($payment_id, sprintf(
213
+				__('Last IPN received on %s at %s', 'give'),
214
+				date_i18n('m/d/Y', $current_timestamp),
215
+				date_i18n('H:i', $current_timestamp)
216 216
 			)
217 217
 	);
218
-	give_update_meta( $payment_id, 'give_last_paypal_ipn_received', $current_timestamp );
218
+	give_update_meta($payment_id, 'give_last_paypal_ipn_received', $current_timestamp);
219 219
 
220
-	if ( has_action( 'give_paypal_' . $txn_type ) ) {
220
+	if (has_action('give_paypal_'.$txn_type)) {
221 221
 		/**
222 222
 		 * Fires while processing PayPal IPN $txn_type.
223 223
 		 *
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 		 * @param array $encoded_data_array Encoded data.
229 229
 		 * @param int   $payment_id         Payment id.
230 230
 		 */
231
-		do_action( "give_paypal_{$txn_type}", $encoded_data_array, $payment_id );
231
+		do_action("give_paypal_{$txn_type}", $encoded_data_array, $payment_id);
232 232
 	} else {
233 233
 		/**
234 234
 		 * Fires while process PayPal IPN.
@@ -240,12 +240,12 @@  discard block
 block discarded – undo
240 240
 		 * @param array $encoded_data_array Encoded data.
241 241
 		 * @param int   $payment_id         Payment id.
242 242
 		 */
243
-		do_action( 'give_paypal_web_accept', $encoded_data_array, $payment_id );
243
+		do_action('give_paypal_web_accept', $encoded_data_array, $payment_id);
244 244
 	}
245 245
 	exit;
246 246
 }
247 247
 
248
-add_action( 'give_verify_paypal_ipn', 'give_process_paypal_ipn' );
248
+add_action('give_verify_paypal_ipn', 'give_process_paypal_ipn');
249 249
 
250 250
 /**
251 251
  * Process web accept (one time) payment IPNs.
@@ -257,99 +257,99 @@  discard block
 block discarded – undo
257 257
  *
258 258
  * @return void
259 259
  */
260
-function give_process_paypal_web_accept( $data, $payment_id ) {
260
+function give_process_paypal_web_accept($data, $payment_id) {
261 261
 
262 262
 	// Only allow through these transaction types.
263
-	if ( 'web_accept' !== $data['txn_type'] && 'cart' !== $data['txn_type'] && 'refunded' !== strtolower( $data['payment_status'] ) ) {
263
+	if ('web_accept' !== $data['txn_type'] && 'cart' !== $data['txn_type'] && 'refunded' !== strtolower($data['payment_status'])) {
264 264
 		return;
265 265
 	}
266 266
 
267 267
 	// Need $payment_id to continue.
268
-	if ( empty( $payment_id ) ) {
268
+	if (empty($payment_id)) {
269 269
 		return;
270 270
 	}
271 271
 
272 272
 	// Collect donation payment details.
273 273
 	$paypal_amount  = $data['mc_gross'];
274
-	$payment_status = strtolower( $data['payment_status'] );
275
-	$currency_code  = strtolower( $data['mc_currency'] );
276
-	$business_email = isset( $data['business'] ) && is_email( $data['business'] ) ? trim( $data['business'] ) : trim( $data['receiver_email'] );
277
-	$payment_meta   = give_get_payment_meta( $payment_id );
274
+	$payment_status = strtolower($data['payment_status']);
275
+	$currency_code  = strtolower($data['mc_currency']);
276
+	$business_email = isset($data['business']) && is_email($data['business']) ? trim($data['business']) : trim($data['receiver_email']);
277
+	$payment_meta   = give_get_payment_meta($payment_id);
278 278
 
279 279
 	// Must be a PayPal standard IPN.
280
-	if ( 'paypal' !== give_get_payment_gateway( $payment_id ) ) {
280
+	if ('paypal' !== give_get_payment_gateway($payment_id)) {
281 281
 		return;
282 282
 	}
283 283
 
284 284
 	// Verify payment recipient
285
-	if ( strcasecmp( $business_email, trim( give_get_option( 'paypal_email' ) ) ) !== 0 ) {
285
+	if (strcasecmp($business_email, trim(give_get_option('paypal_email'))) !== 0) {
286 286
 
287
-		give_record_gateway_error( __( 'IPN Error', 'give' ), sprintf( /* translators: %s: Paypal IPN response */
288
-		__( 'Invalid business email in IPN response. IPN data: %s', 'give' ), json_encode( $data ) ), $payment_id );
289
-		give_update_payment_status( $payment_id, 'failed' );
290
-		give_insert_payment_note( $payment_id, __( 'Payment failed due to invalid PayPal business email.', 'give' ) );
287
+		give_record_gateway_error(__('IPN Error', 'give'), sprintf( /* translators: %s: Paypal IPN response */
288
+		__('Invalid business email in IPN response. IPN data: %s', 'give'), json_encode($data) ), $payment_id);
289
+		give_update_payment_status($payment_id, 'failed');
290
+		give_insert_payment_note($payment_id, __('Payment failed due to invalid PayPal business email.', 'give'));
291 291
 
292 292
 		return;
293 293
 	}
294 294
 
295 295
 	// Verify payment currency.
296
-	if ( $currency_code !== strtolower( $payment_meta['currency'] ) ) {
296
+	if ($currency_code !== strtolower($payment_meta['currency'])) {
297 297
 
298
-		give_record_gateway_error( __( 'IPN Error', 'give' ), sprintf( /* translators: %s: Paypal IPN response */
299
-		__( 'Invalid currency in IPN response. IPN data: %s', 'give' ), json_encode( $data ) ), $payment_id );
300
-		give_update_payment_status( $payment_id, 'failed' );
301
-		give_insert_payment_note( $payment_id, __( 'Payment failed due to invalid currency in PayPal IPN.', 'give' ) );
298
+		give_record_gateway_error(__('IPN Error', 'give'), sprintf( /* translators: %s: Paypal IPN response */
299
+		__('Invalid currency in IPN response. IPN data: %s', 'give'), json_encode($data) ), $payment_id);
300
+		give_update_payment_status($payment_id, 'failed');
301
+		give_insert_payment_note($payment_id, __('Payment failed due to invalid currency in PayPal IPN.', 'give'));
302 302
 
303 303
 		return;
304 304
 	}
305 305
 
306 306
 	// Process refunds & reversed.
307
-	if ( 'refunded' === $payment_status || 'reversed' === $payment_status ) {
308
-		give_process_paypal_refund( $data, $payment_id );
307
+	if ('refunded' === $payment_status || 'reversed' === $payment_status) {
308
+		give_process_paypal_refund($data, $payment_id);
309 309
 
310 310
 		return;
311 311
 	}
312 312
 
313 313
 	// Only complete payments once.
314
-	if ( 'publish' === get_post_status( $payment_id ) ) {
314
+	if ('publish' === get_post_status($payment_id)) {
315 315
 		return;
316 316
 	}
317 317
 
318 318
 	// Retrieve the total donation amount (before PayPal).
319
-	$payment_amount = give_get_payment_amount( $payment_id );
319
+	$payment_amount = give_get_payment_amount($payment_id);
320 320
 
321 321
 	// Check that the donation PP and local db amounts match.
322
-	if ( number_format( (float) $paypal_amount, 2 ) < number_format( (float) $payment_amount, 2 ) ) {
322
+	if (number_format((float) $paypal_amount, 2) < number_format((float) $payment_amount, 2)) {
323 323
 		// The prices don't match
324
-		give_record_gateway_error( __( 'IPN Error', 'give' ), sprintf( /* translators: %s: Paypal IPN response */
325
-		__( 'Invalid payment amount in IPN response. IPN data: %s', 'give' ), json_encode( $data ) ), $payment_id );
326
-		give_update_payment_status( $payment_id, 'failed' );
327
-		give_insert_payment_note( $payment_id, __( 'Payment failed due to invalid amount in PayPal IPN.', 'give' ) );
324
+		give_record_gateway_error(__('IPN Error', 'give'), sprintf( /* translators: %s: Paypal IPN response */
325
+		__('Invalid payment amount in IPN response. IPN data: %s', 'give'), json_encode($data) ), $payment_id);
326
+		give_update_payment_status($payment_id, 'failed');
327
+		give_insert_payment_note($payment_id, __('Payment failed due to invalid amount in PayPal IPN.', 'give'));
328 328
 
329 329
 		return;
330 330
 	}
331 331
 
332 332
 	// Process completed donations.
333
-	if ( 'completed' === $payment_status || give_is_test_mode() ) {
333
+	if ('completed' === $payment_status || give_is_test_mode()) {
334 334
 
335
-		give_insert_payment_note( $payment_id, sprintf( /* translators: %s: Paypal transaction ID */
336
-		__( 'PayPal Transaction ID: %s', 'give' ), $data['txn_id'] ) );
337
-		give_set_payment_transaction_id( $payment_id, $data['txn_id'] );
338
-		give_update_payment_status( $payment_id, 'publish' );
335
+		give_insert_payment_note($payment_id, sprintf( /* translators: %s: Paypal transaction ID */
336
+		__('PayPal Transaction ID: %s', 'give'), $data['txn_id'] ));
337
+		give_set_payment_transaction_id($payment_id, $data['txn_id']);
338
+		give_update_payment_status($payment_id, 'publish');
339 339
 
340
-	} elseif ( 'pending' === $payment_status && isset( $data['pending_reason'] ) ) {
340
+	} elseif ('pending' === $payment_status && isset($data['pending_reason'])) {
341 341
 
342 342
 		// Look for possible pending reasons, such as an echeck.
343
-		$note = give_paypal_get_pending_donation_note( strtolower( $data['pending_reason'] ) );
343
+		$note = give_paypal_get_pending_donation_note(strtolower($data['pending_reason']));
344 344
 
345
-		if ( ! empty( $note ) ) {
346
-			give_insert_payment_note( $payment_id, $note );
345
+		if ( ! empty($note)) {
346
+			give_insert_payment_note($payment_id, $note);
347 347
 		}
348 348
 	}
349 349
 
350 350
 }
351 351
 
352
-add_action( 'give_paypal_web_accept', 'give_process_paypal_web_accept', 10, 2 );
352
+add_action('give_paypal_web_accept', 'give_process_paypal_web_accept', 10, 2);
353 353
 
354 354
 /**
355 355
  * Process PayPal IPN Refunds
@@ -361,35 +361,35 @@  discard block
 block discarded – undo
361 361
  *
362 362
  * @return void
363 363
  */
364
-function give_process_paypal_refund( $data, $payment_id = 0 ) {
364
+function give_process_paypal_refund($data, $payment_id = 0) {
365 365
 
366 366
 	// Collect payment details.
367
-	if ( empty( $payment_id ) ) {
367
+	if (empty($payment_id)) {
368 368
 		return;
369 369
 	}
370 370
 
371 371
 	// Only refund payments once.
372
-	if ( 'refunded' === get_post_status( $payment_id ) ) {
372
+	if ('refunded' === get_post_status($payment_id)) {
373 373
 		return;
374 374
 	}
375 375
 
376
-	$payment_amount = give_get_payment_amount( $payment_id );
376
+	$payment_amount = give_get_payment_amount($payment_id);
377 377
 	$refund_amount  = $data['payment_gross'] * - 1;
378 378
 
379
-	if ( number_format( (float) $refund_amount, 2 ) < number_format( (float) $payment_amount, 2 ) ) {
379
+	if (number_format((float) $refund_amount, 2) < number_format((float) $payment_amount, 2)) {
380 380
 
381
-		give_insert_payment_note( $payment_id, sprintf( /* translators: %s: Paypal parent transaction ID */
382
-		__( 'Partial PayPal refund processed: %s', 'give' ), $data['parent_txn_id'] ) );
381
+		give_insert_payment_note($payment_id, sprintf( /* translators: %s: Paypal parent transaction ID */
382
+		__('Partial PayPal refund processed: %s', 'give'), $data['parent_txn_id'] ));
383 383
 
384 384
 		return; // This is a partial refund
385 385
 
386 386
 	}
387 387
 
388
-	give_insert_payment_note( $payment_id, sprintf( /* translators: 1: Paypal parent transaction ID 2. Paypal reason code */
389
-	__( 'PayPal Payment #%1$s Refunded for reason: %2$s', 'give' ), $data['parent_txn_id'], $data['reason_code'] ) );
390
-	give_insert_payment_note( $payment_id, sprintf( /* translators: %s: Paypal transaction ID */
391
-	__( 'PayPal Refund Transaction ID: %s', 'give' ), $data['txn_id'] ) );
392
-	give_update_payment_status( $payment_id, 'refunded' );
388
+	give_insert_payment_note($payment_id, sprintf( /* translators: 1: Paypal parent transaction ID 2. Paypal reason code */
389
+	__('PayPal Payment #%1$s Refunded for reason: %2$s', 'give'), $data['parent_txn_id'], $data['reason_code'] ));
390
+	give_insert_payment_note($payment_id, sprintf( /* translators: %s: Paypal transaction ID */
391
+	__('PayPal Refund Transaction ID: %s', 'give'), $data['txn_id'] ));
392
+	give_update_payment_status($payment_id, 'refunded');
393 393
 }
394 394
 
395 395
 /**
@@ -401,24 +401,24 @@  discard block
 block discarded – undo
401 401
  *
402 402
  * @return string
403 403
  */
404
-function give_get_paypal_redirect( $ssl_check = false ) {
404
+function give_get_paypal_redirect($ssl_check = false) {
405 405
 
406
-	if ( is_ssl() || ! $ssl_check ) {
406
+	if (is_ssl() || ! $ssl_check) {
407 407
 		$protocol = 'https://';
408 408
 	} else {
409 409
 		$protocol = 'http://';
410 410
 	}
411 411
 
412 412
 	// Check the current payment mode
413
-	if ( give_is_test_mode() ) {
413
+	if (give_is_test_mode()) {
414 414
 		// Test mode
415
-		$paypal_uri = $protocol . 'www.sandbox.paypal.com/cgi-bin/webscr';
415
+		$paypal_uri = $protocol.'www.sandbox.paypal.com/cgi-bin/webscr';
416 416
 	} else {
417 417
 		// Live mode
418
-		$paypal_uri = $protocol . 'www.paypal.com/cgi-bin/webscr';
418
+		$paypal_uri = $protocol.'www.paypal.com/cgi-bin/webscr';
419 419
 	}
420 420
 
421
-	return apply_filters( 'give_paypal_uri', $paypal_uri );
421
+	return apply_filters('give_paypal_uri', $paypal_uri);
422 422
 }
423 423
 
424 424
 /**
@@ -428,9 +428,9 @@  discard block
 block discarded – undo
428 428
  * @return string
429 429
  */
430 430
 function give_get_paypal_page_style() {
431
-	$page_style = trim( give_get_option( 'paypal_page_style', 'PayPal' ) );
431
+	$page_style = trim(give_get_option('paypal_page_style', 'PayPal'));
432 432
 
433
-	return apply_filters( 'give_paypal_page_style', $page_style );
433
+	return apply_filters('give_paypal_page_style', $page_style);
434 434
 }
435 435
 
436 436
 /**
@@ -444,26 +444,26 @@  discard block
 block discarded – undo
444 444
  *
445 445
  * @return string
446 446
  */
447
-function give_paypal_success_page_content( $content ) {
447
+function give_paypal_success_page_content($content) {
448 448
 
449
-	if ( ! isset( $_GET['payment-id'] ) && ! give_get_purchase_session() ) {
449
+	if ( ! isset($_GET['payment-id']) && ! give_get_purchase_session()) {
450 450
 		return $content;
451 451
 	}
452 452
 
453
-	$payment_id = isset( $_GET['payment-id'] ) ? absint( $_GET['payment-id'] ) : false;
453
+	$payment_id = isset($_GET['payment-id']) ? absint($_GET['payment-id']) : false;
454 454
 
455
-	if ( ! $payment_id ) {
455
+	if ( ! $payment_id) {
456 456
 		$session    = give_get_purchase_session();
457
-		$payment_id = give_get_purchase_id_by_key( $session['purchase_key'] );
457
+		$payment_id = give_get_purchase_id_by_key($session['purchase_key']);
458 458
 	}
459 459
 
460
-	$payment = get_post( $payment_id );
461
-	if ( $payment && 'pending' === $payment->post_status ) {
460
+	$payment = get_post($payment_id);
461
+	if ($payment && 'pending' === $payment->post_status) {
462 462
 
463 463
 		// Payment is still pending so show processing indicator to fix the race condition.
464 464
 		ob_start();
465 465
 
466
-		give_get_template_part( 'payment', 'processing' );
466
+		give_get_template_part('payment', 'processing');
467 467
 
468 468
 		$content = ob_get_clean();
469 469
 
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
 
474 474
 }
475 475
 
476
-add_filter( 'give_payment_confirm_paypal', 'give_paypal_success_page_content' );
476
+add_filter('give_payment_confirm_paypal', 'give_paypal_success_page_content');
477 477
 
478 478
 /**
479 479
  * Given a Payment ID, extract the transaction ID
@@ -484,22 +484,22 @@  discard block
 block discarded – undo
484 484
  *
485 485
  * @return string                   Transaction ID
486 486
  */
487
-function give_paypal_get_payment_transaction_id( $payment_id ) {
487
+function give_paypal_get_payment_transaction_id($payment_id) {
488 488
 
489 489
 	$transaction_id = '';
490
-	$notes          = give_get_payment_notes( $payment_id );
490
+	$notes          = give_get_payment_notes($payment_id);
491 491
 
492
-	foreach ( $notes as $note ) {
493
-		if ( preg_match( '/^PayPal Transaction ID: ([^\s]+)/', $note->comment_content, $match ) ) {
492
+	foreach ($notes as $note) {
493
+		if (preg_match('/^PayPal Transaction ID: ([^\s]+)/', $note->comment_content, $match)) {
494 494
 			$transaction_id = $match[1];
495 495
 			continue;
496 496
 		}
497 497
 	}
498 498
 
499
-	return apply_filters( 'give_paypal_set_payment_transaction_id', $transaction_id, $payment_id );
499
+	return apply_filters('give_paypal_set_payment_transaction_id', $transaction_id, $payment_id);
500 500
 }
501 501
 
502
-add_filter( 'give_get_payment_transaction_id-paypal', 'give_paypal_get_payment_transaction_id', 10, 1 );
502
+add_filter('give_get_payment_transaction_id-paypal', 'give_paypal_get_payment_transaction_id', 10, 1);
503 503
 
504 504
 /**
505 505
  * Given a transaction ID, generate a link to the PayPal transaction ID details
@@ -511,16 +511,16 @@  discard block
 block discarded – undo
511 511
  *
512 512
  * @return string                 A link to the PayPal transaction details
513 513
  */
514
-function give_paypal_link_transaction_id( $transaction_id, $payment_id ) {
514
+function give_paypal_link_transaction_id($transaction_id, $payment_id) {
515 515
 
516 516
 	$paypal_base_url = 'https://history.paypal.com/cgi-bin/webscr?cmd=_history-details-from-hub&id=';
517
-	$transaction_url = '<a href="' . esc_url( $paypal_base_url . $transaction_id ) . '" target="_blank">' . $transaction_id . '</a>';
517
+	$transaction_url = '<a href="'.esc_url($paypal_base_url.$transaction_id).'" target="_blank">'.$transaction_id.'</a>';
518 518
 
519
-	return apply_filters( 'give_paypal_link_payment_details_transaction_id', $transaction_url );
519
+	return apply_filters('give_paypal_link_payment_details_transaction_id', $transaction_url);
520 520
 
521 521
 }
522 522
 
523
-add_filter( 'give_payment_details_transaction_id-paypal', 'give_paypal_link_transaction_id', 10, 2 );
523
+add_filter('give_payment_details_transaction_id-paypal', 'give_paypal_link_transaction_id', 10, 2);
524 524
 
525 525
 
526 526
 /**
@@ -532,64 +532,64 @@  discard block
 block discarded – undo
532 532
  *
533 533
  * @return string
534 534
  */
535
-function give_paypal_get_pending_donation_note( $pending_reason ) {
535
+function give_paypal_get_pending_donation_note($pending_reason) {
536 536
 
537 537
 	$note = '';
538 538
 
539
-	switch ( $pending_reason ) {
539
+	switch ($pending_reason) {
540 540
 
541 541
 		case 'echeck' :
542 542
 
543
-			$note = __( 'Payment made via eCheck and will clear automatically in 5-8 days.', 'give' );
543
+			$note = __('Payment made via eCheck and will clear automatically in 5-8 days.', 'give');
544 544
 
545 545
 			break;
546 546
 
547 547
 		case 'address' :
548 548
 
549
-			$note = __( 'Payment requires a confirmed donor address and must be accepted manually through PayPal.', 'give' );
549
+			$note = __('Payment requires a confirmed donor address and must be accepted manually through PayPal.', 'give');
550 550
 
551 551
 			break;
552 552
 
553 553
 		case 'intl' :
554 554
 
555
-			$note = __( 'Payment must be accepted manually through PayPal due to international account regulations.', 'give' );
555
+			$note = __('Payment must be accepted manually through PayPal due to international account regulations.', 'give');
556 556
 
557 557
 			break;
558 558
 
559 559
 		case 'multi-currency' :
560 560
 
561
-			$note = __( 'Payment received in non-shop currency and must be accepted manually through PayPal.', 'give' );
561
+			$note = __('Payment received in non-shop currency and must be accepted manually through PayPal.', 'give');
562 562
 
563 563
 			break;
564 564
 
565 565
 		case 'paymentreview' :
566 566
 		case 'regulatory_review' :
567 567
 
568
-			$note = __( 'Payment is being reviewed by PayPal staff as high-risk or in possible violation of government regulations.', 'give' );
568
+			$note = __('Payment is being reviewed by PayPal staff as high-risk or in possible violation of government regulations.', 'give');
569 569
 
570 570
 			break;
571 571
 
572 572
 		case 'unilateral' :
573 573
 
574
-			$note = __( 'Payment was sent to non-confirmed or non-registered email address.', 'give' );
574
+			$note = __('Payment was sent to non-confirmed or non-registered email address.', 'give');
575 575
 
576 576
 			break;
577 577
 
578 578
 		case 'upgrade' :
579 579
 
580
-			$note = __( 'PayPal account must be upgraded before this payment can be accepted.', 'give' );
580
+			$note = __('PayPal account must be upgraded before this payment can be accepted.', 'give');
581 581
 
582 582
 			break;
583 583
 
584 584
 		case 'verify' :
585 585
 
586
-			$note = __( 'PayPal account is not verified. Verify account in order to accept this donation.', 'give' );
586
+			$note = __('PayPal account is not verified. Verify account in order to accept this donation.', 'give');
587 587
 
588 588
 			break;
589 589
 
590 590
 		case 'other' :
591 591
 
592
-			$note = __( 'Payment is pending for unknown reasons. Contact PayPal support for assistance.', 'give' );
592
+			$note = __('Payment is pending for unknown reasons. Contact PayPal support for assistance.', 'give');
593 593
 
594 594
 			break;
595 595
 
@@ -607,49 +607,49 @@  discard block
 block discarded – undo
607 607
  *
608 608
  * @return mixed|string
609 609
  */
610
-function give_build_paypal_url( $payment_id, $payment_data ) {
610
+function give_build_paypal_url($payment_id, $payment_data) {
611 611
 	// Only send to PayPal if the pending payment is created successfully.
612
-	$listener_url = add_query_arg( 'give-listener', 'IPN', home_url( 'index.php' ) );
612
+	$listener_url = add_query_arg('give-listener', 'IPN', home_url('index.php'));
613 613
 
614 614
 	// Get the success url.
615
-	$return_url = add_query_arg( array(
615
+	$return_url = add_query_arg(array(
616 616
 		'payment-confirmation' => 'paypal',
617 617
 		'payment-id'           => $payment_id,
618 618
 
619
-	), get_permalink( give_get_option( 'success_page' ) ) );
619
+	), get_permalink(give_get_option('success_page')));
620 620
 
621 621
 	// Get the PayPal redirect uri.
622
-	$paypal_redirect = trailingslashit( give_get_paypal_redirect() ) . '?';
622
+	$paypal_redirect = trailingslashit(give_get_paypal_redirect()).'?';
623 623
 
624 624
 	// Item name.
625
-	$item_name = give_build_paypal_item_title( $payment_data );
625
+	$item_name = give_build_paypal_item_title($payment_data);
626 626
 
627 627
 	// Setup PayPal API params.
628 628
 	$paypal_args = array(
629
-		'business'      => give_get_option( 'paypal_email', false ),
629
+		'business'      => give_get_option('paypal_email', false),
630 630
 		'first_name'    => $payment_data['user_info']['first_name'],
631 631
 		'last_name'     => $payment_data['user_info']['last_name'],
632 632
 		'email'         => $payment_data['user_email'],
633 633
 		'invoice'       => $payment_data['purchase_key'],
634 634
 		'amount'        => $payment_data['price'],
635
-		'item_name'     => stripslashes( $item_name ),
635
+		'item_name'     => stripslashes($item_name),
636 636
 		'no_shipping'   => '1',
637 637
 		'shipping'      => '0',
638 638
 		'no_note'       => '1',
639 639
 		'currency_code' => give_get_currency(),
640
-		'charset'       => get_bloginfo( 'charset' ),
640
+		'charset'       => get_bloginfo('charset'),
641 641
 		'custom'        => $payment_id,
642 642
 		'rm'            => '2',
643 643
 		'return'        => $return_url,
644
-		'cancel_return' => give_get_failed_transaction_uri( '?payment-id=' . $payment_id ),
644
+		'cancel_return' => give_get_failed_transaction_uri('?payment-id='.$payment_id),
645 645
 		'notify_url'    => $listener_url,
646 646
 		'page_style'    => give_get_paypal_page_style(),
647
-		'cbt'           => get_bloginfo( 'name' ),
647
+		'cbt'           => get_bloginfo('name'),
648 648
 		'bn'            => 'givewp_SP',
649 649
 	);
650 650
 
651 651
 	// Add user address if present.
652
-	if ( ! empty( $payment_data['user_info']['address'] ) ) {
652
+	if ( ! empty($payment_data['user_info']['address'])) {
653 653
 		$default_address = array(
654 654
 			'line1'   => '',
655 655
 			'line2'   => '',
@@ -659,7 +659,7 @@  discard block
 block discarded – undo
659 659
 			'country' => '',
660 660
 		);
661 661
 
662
-		$address = wp_parse_args( $payment_data['user_info']['address'], $default_address );
662
+		$address = wp_parse_args($payment_data['user_info']['address'], $default_address);
663 663
 
664 664
 		$paypal_args['address1'] = $address['line1'];
665 665
 		$paypal_args['address2'] = $address['line2'];
@@ -680,13 +680,13 @@  discard block
 block discarded – undo
680 680
 	 * @param array $paypal_args
681 681
 	 * @param array $payment_data
682 682
 	 */
683
-	$paypal_args = apply_filters( 'give_paypal_redirect_args', $paypal_args, $payment_data );
683
+	$paypal_args = apply_filters('give_paypal_redirect_args', $paypal_args, $payment_data);
684 684
 
685 685
 	// Build query.
686
-	$paypal_redirect .= http_build_query( $paypal_args );
686
+	$paypal_redirect .= http_build_query($paypal_args);
687 687
 
688 688
 	// Fix for some sites that encode the entities.
689
-	$paypal_redirect = str_replace( '&amp;', '&', $paypal_redirect );
689
+	$paypal_redirect = str_replace('&amp;', '&', $paypal_redirect);
690 690
 
691 691
 	return $paypal_redirect;
692 692
 }
@@ -701,7 +701,7 @@  discard block
 block discarded – undo
701 701
 function give_get_paypal_button_type() {
702 702
 	// paypal_button_type can be donation or standard.
703 703
 	$paypal_button_type = '_donations';
704
-	if ( 'standard' === give_get_option( 'paypal_button_type' ) ) {
704
+	if ('standard' === give_get_option('paypal_button_type')) {
705 705
 		$paypal_button_type = '_xclick';
706 706
 	}
707 707
 
@@ -718,30 +718,30 @@  discard block
 block discarded – undo
718 718
  *
719 719
  * @return string
720 720
  */
721
-function give_build_paypal_item_title( $payment_data ) {
722
-	$form_id   = intval( $payment_data['post_data']['give-form-id'] );
721
+function give_build_paypal_item_title($payment_data) {
722
+	$form_id   = intval($payment_data['post_data']['give-form-id']);
723 723
 	$item_name = $payment_data['post_data']['give-form-title'];
724 724
 
725 725
 	// Verify has variable prices.
726
-	if ( give_has_variable_prices( $form_id ) && isset( $payment_data['post_data']['give-price-id'] ) ) {
726
+	if (give_has_variable_prices($form_id) && isset($payment_data['post_data']['give-price-id'])) {
727 727
 
728
-		$item_price_level_text = give_get_price_option_name( $form_id, $payment_data['post_data']['give-price-id'] );
729
-		$price_level_amount    = give_get_price_option_amount( $form_id, $payment_data['post_data']['give-price-id'] );
728
+		$item_price_level_text = give_get_price_option_name($form_id, $payment_data['post_data']['give-price-id']);
729
+		$price_level_amount    = give_get_price_option_amount($form_id, $payment_data['post_data']['give-price-id']);
730 730
 
731 731
 		// Donation given doesn't match selected level (must be a custom amount).
732
-		if ( $price_level_amount != give_maybe_sanitize_amount( $payment_data['price'] ) ) {
733
-			$custom_amount_text = give_get_meta( $form_id, '_give_custom_amount_text', true );
732
+		if ($price_level_amount != give_maybe_sanitize_amount($payment_data['price'])) {
733
+			$custom_amount_text = give_get_meta($form_id, '_give_custom_amount_text', true);
734 734
 			// user custom amount text if any, fallback to default if not.
735
-			$item_name .= ' - ' . give_check_variable( $custom_amount_text, 'empty', __( 'Custom Amount', 'give' ) );
735
+			$item_name .= ' - '.give_check_variable($custom_amount_text, 'empty', __('Custom Amount', 'give'));
736 736
 
737
-		} elseif ( ! empty( $item_price_level_text ) ) {
738
-			$item_name .= ' - ' . $item_price_level_text;
737
+		} elseif ( ! empty($item_price_level_text)) {
738
+			$item_name .= ' - '.$item_price_level_text;
739 739
 		}
740 740
 	} // End if().
741
-	elseif ( give_get_form_price( $form_id ) !== give_maybe_sanitize_amount( $payment_data['price'] ) ) {
742
-		$custom_amount_text = give_get_meta( $form_id, '_give_custom_amount_text', true );
741
+	elseif (give_get_form_price($form_id) !== give_maybe_sanitize_amount($payment_data['price'])) {
742
+		$custom_amount_text = give_get_meta($form_id, '_give_custom_amount_text', true);
743 743
 		// user custom amount text if any, fallback to default if not.
744
-		$item_name .= ' - ' . give_check_variable( $custom_amount_text, 'empty', __( 'Custom Amount', 'give' ) );
744
+		$item_name .= ' - '.give_check_variable($custom_amount_text, 'empty', __('Custom Amount', 'give'));
745 745
 	}
746 746
 
747 747
 	return $item_name;
Please login to merge, or discard this patch.
includes/class-give-db-donors.php 1 patch
Spacing   +138 added lines, -138 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
 
@@ -35,14 +35,14 @@  discard block
 block discarded – undo
35 35
 		/* @var WPDB $wpdb */
36 36
 		global $wpdb;
37 37
 
38
-		$this->table_name  = $wpdb->prefix . 'give_customers';
38
+		$this->table_name  = $wpdb->prefix.'give_customers';
39 39
 		$this->primary_key = 'id';
40 40
 		$this->version     = '1.0';
41 41
 
42 42
 		// Set hooks and register table only if instance loading first time.
43
-		if( ! ( Give()->donors instanceof Give_DB_Donors ) ) {
43
+		if ( ! (Give()->donors instanceof Give_DB_Donors)) {
44 44
 			// Setup hook.
45
-			add_action( 'profile_update', array( $this, 'update_donor_email_on_user_update' ), 10, 2 );
45
+			add_action('profile_update', array($this, 'update_donor_email_on_user_update'), 10, 2);
46 46
 
47 47
 			// Install table.
48 48
 			$this->register_table();
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 			'purchase_value' => 0.00,
90 90
 			'purchase_count' => 0,
91 91
 			'notes'          => '',
92
-			'date_created'   => date( 'Y-m-d H:i:s' ),
92
+			'date_created'   => date('Y-m-d H:i:s'),
93 93
 		);
94 94
 	}
95 95
 
@@ -103,40 +103,40 @@  discard block
 block discarded – undo
103 103
 	 *
104 104
 	 * @return int|bool
105 105
 	 */
106
-	public function add( $data = array() ) {
106
+	public function add($data = array()) {
107 107
 
108 108
 		$defaults = array(
109 109
 			'payment_ids' => ''
110 110
 		);
111 111
 
112
-		$args = wp_parse_args( $data, $defaults );
112
+		$args = wp_parse_args($data, $defaults);
113 113
 
114
-		if ( empty( $args['email'] ) ) {
114
+		if (empty($args['email'])) {
115 115
 			return false;
116 116
 		}
117 117
 
118
-		if ( ! empty( $args['payment_ids'] ) && is_array( $args['payment_ids'] ) ) {
119
-			$args['payment_ids'] = implode( ',', array_unique( array_values( $args['payment_ids'] ) ) );
118
+		if ( ! empty($args['payment_ids']) && is_array($args['payment_ids'])) {
119
+			$args['payment_ids'] = implode(',', array_unique(array_values($args['payment_ids'])));
120 120
 		}
121 121
 
122
-		$donor = $this->get_donor_by( 'email', $args['email'] );
122
+		$donor = $this->get_donor_by('email', $args['email']);
123 123
 
124 124
 		// update an existing donor.
125
-		if ( $donor ) {
125
+		if ($donor) {
126 126
 
127 127
 			// Update the payment IDs attached to the donor
128
-			if ( ! empty( $args['payment_ids'] ) ) {
128
+			if ( ! empty($args['payment_ids'])) {
129 129
 
130
-				if ( empty( $donor->payment_ids ) ) {
130
+				if (empty($donor->payment_ids)) {
131 131
 
132 132
 					$donor->payment_ids = $args['payment_ids'];
133 133
 
134 134
 				} else {
135 135
 
136
-					$existing_ids          = array_map( 'absint', explode( ',', $donor->payment_ids ) );
137
-					$payment_ids           = array_map( 'absint', explode( ',', $args['payment_ids'] ) );
138
-					$payment_ids           = array_merge( $payment_ids, $existing_ids );
139
-					$donor->payment_ids = implode( ',', array_unique( array_values( $payment_ids ) ) );
136
+					$existing_ids          = array_map('absint', explode(',', $donor->payment_ids));
137
+					$payment_ids           = array_map('absint', explode(',', $args['payment_ids']));
138
+					$payment_ids           = array_merge($payment_ids, $existing_ids);
139
+					$donor->payment_ids = implode(',', array_unique(array_values($payment_ids)));
140 140
 
141 141
 				}
142 142
 
@@ -144,13 +144,13 @@  discard block
 block discarded – undo
144 144
 
145 145
 			}
146 146
 
147
-			$this->update( $donor->id, $args );
147
+			$this->update($donor->id, $args);
148 148
 
149 149
 			return $donor->id;
150 150
 
151 151
 		} else {
152 152
 
153
-			return $this->insert( $args, 'donor' );
153
+			return $this->insert($args, 'donor');
154 154
 
155 155
 		}
156 156
 
@@ -169,20 +169,20 @@  discard block
 block discarded – undo
169 169
 	 *
170 170
 	 * @return bool|int
171 171
 	 */
172
-	public function delete( $_id_or_email = false ) {
172
+	public function delete($_id_or_email = false) {
173 173
 
174
-		if ( empty( $_id_or_email ) ) {
174
+		if (empty($_id_or_email)) {
175 175
 			return false;
176 176
 		}
177 177
 
178
-		$column   = is_email( $_id_or_email ) ? 'email' : 'id';
179
-		$donor = $this->get_donor_by( $column, $_id_or_email );
178
+		$column = is_email($_id_or_email) ? 'email' : 'id';
179
+		$donor = $this->get_donor_by($column, $_id_or_email);
180 180
 
181
-		if ( $donor->id > 0 ) {
181
+		if ($donor->id > 0) {
182 182
 
183 183
 			global $wpdb;
184 184
 
185
-			return $wpdb->delete( $this->table_name, array( 'id' => $donor->id ), array( '%d' ) );
185
+			return $wpdb->delete($this->table_name, array('id' => $donor->id), array('%d'));
186 186
 
187 187
 		} else {
188 188
 			return false;
@@ -203,14 +203,14 @@  discard block
 block discarded – undo
203 203
 	 *
204 204
 	 * @return bool|int
205 205
 	 */
206
-	public function delete_by_user_id( $user_id = false ) {
206
+	public function delete_by_user_id($user_id = false) {
207 207
 
208
-		if ( empty( $user_id ) ) {
208
+		if (empty($user_id)) {
209 209
 			return false;
210 210
 		}
211 211
 		global $wpdb;
212 212
 
213
-		return $wpdb->delete( $this->table_name, array( 'user_id' => $user_id ), array( '%d' ) );
213
+		return $wpdb->delete($this->table_name, array('user_id' => $user_id), array('%d'));
214 214
 	}
215 215
 
216 216
 	/**
@@ -224,14 +224,14 @@  discard block
 block discarded – undo
224 224
 	 *
225 225
 	 * @return bool          True is exists, false otherwise.
226 226
 	 */
227
-	public function exists( $value = '', $field = 'email' ) {
227
+	public function exists($value = '', $field = 'email') {
228 228
 		
229 229
 		$columns = $this->get_columns();
230
-		if ( ! array_key_exists( $field, $columns ) ) {
230
+		if ( ! array_key_exists($field, $columns)) {
231 231
 			return false;
232 232
 		}
233 233
 
234
-		return (bool) $this->get_column_by( 'id', $field, $value );
234
+		return (bool) $this->get_column_by('id', $field, $value);
235 235
 
236 236
 	}
237 237
 
@@ -246,16 +246,16 @@  discard block
 block discarded – undo
246 246
 	 *
247 247
 	 * @return bool
248 248
 	 */
249
-	public function attach_payment( $donor_id = 0, $payment_id = 0 ) {
249
+	public function attach_payment($donor_id = 0, $payment_id = 0) {
250 250
 
251
-		$donor = new Give_Donor( $donor_id );
251
+		$donor = new Give_Donor($donor_id);
252 252
 
253
-		if ( empty( $donor->id ) ) {
253
+		if (empty($donor->id)) {
254 254
 			return false;
255 255
 		}
256 256
 
257 257
 		// Attach the payment, but don't increment stats, as this function previously did not
258
-		return $donor->attach_payment( $payment_id, false );
258
+		return $donor->attach_payment($payment_id, false);
259 259
 
260 260
 	}
261 261
 
@@ -270,16 +270,16 @@  discard block
 block discarded – undo
270 270
 	 *
271 271
 	 * @return bool
272 272
 	 */
273
-	public function remove_payment( $donor_id = 0, $payment_id = 0 ) {
273
+	public function remove_payment($donor_id = 0, $payment_id = 0) {
274 274
 
275
-		$donor = new Give_Donor( $donor_id );
275
+		$donor = new Give_Donor($donor_id);
276 276
 
277
-		if ( ! $donor ) {
277
+		if ( ! $donor) {
278 278
 			return false;
279 279
 		}
280 280
 
281 281
 		// Remove the payment, but don't decrease stats, as this function previously did not
282
-		return $donor->remove_payment( $payment_id, false );
282
+		return $donor->remove_payment($payment_id, false);
283 283
 
284 284
 	}
285 285
 
@@ -293,18 +293,18 @@  discard block
 block discarded – undo
293 293
 	 *
294 294
 	 * @return bool
295 295
 	 */
296
-	public function increment_stats( $donor_id = 0, $amount = 0.00 ) {
296
+	public function increment_stats($donor_id = 0, $amount = 0.00) {
297 297
 
298
-		$donor = new Give_Donor( $donor_id );
298
+		$donor = new Give_Donor($donor_id);
299 299
 
300
-		if ( empty( $donor->id ) ) {
300
+		if (empty($donor->id)) {
301 301
 			return false;
302 302
 		}
303 303
 
304 304
 		$increased_count = $donor->increase_purchase_count();
305
-		$increased_value = $donor->increase_value( $amount );
305
+		$increased_value = $donor->increase_value($amount);
306 306
 
307
-		return ( $increased_count && $increased_value ) ? true : false;
307
+		return ($increased_count && $increased_value) ? true : false;
308 308
 
309 309
 	}
310 310
 
@@ -319,18 +319,18 @@  discard block
 block discarded – undo
319 319
 	 *
320 320
 	 * @return bool
321 321
 	 */
322
-	public function decrement_stats( $donor_id = 0, $amount = 0.00 ) {
322
+	public function decrement_stats($donor_id = 0, $amount = 0.00) {
323 323
 
324
-		$donor = new Give_Donor( $donor_id );
324
+		$donor = new Give_Donor($donor_id);
325 325
 
326
-		if ( ! $donor ) {
326
+		if ( ! $donor) {
327 327
 			return false;
328 328
 		}
329 329
 
330 330
 		$decreased_count = $donor->decrease_donation_count();
331
-		$decreased_value = $donor->decrease_value( $amount );
331
+		$decreased_value = $donor->decrease_value($amount);
332 332
 
333
-		return ( $decreased_count && $decreased_value ) ? true : false;
333
+		return ($decreased_count && $decreased_value) ? true : false;
334 334
 
335 335
 	}
336 336
 
@@ -345,31 +345,31 @@  discard block
 block discarded – undo
345 345
 	 *
346 346
 	 * @return bool
347 347
 	 */
348
-	public function update_donor_email_on_user_update( $user_id = 0, $old_user_data = false ) {
348
+	public function update_donor_email_on_user_update($user_id = 0, $old_user_data = false) {
349 349
 
350
-		$donor = new Give_Donor( $user_id, true );
350
+		$donor = new Give_Donor($user_id, true);
351 351
 
352
-		if( ! $donor ) {
352
+		if ( ! $donor) {
353 353
 			return false;
354 354
 		}
355 355
 
356
-		$user = get_userdata( $user_id );
356
+		$user = get_userdata($user_id);
357 357
 
358
-		if( ! empty( $user ) && $user->user_email !== $donor->email ) {
358
+		if ( ! empty($user) && $user->user_email !== $donor->email) {
359 359
 
360
-			if( ! $this->get_donor_by( 'email', $user->user_email ) ) {
360
+			if ( ! $this->get_donor_by('email', $user->user_email)) {
361 361
 
362
-				$success = $this->update( $donor->id, array( 'email' => $user->user_email ) );
362
+				$success = $this->update($donor->id, array('email' => $user->user_email));
363 363
 
364
-				if( $success ) {
364
+				if ($success) {
365 365
 					// Update some payment meta if we need to
366
-					$payments_array = explode( ',', $donor->payment_ids );
366
+					$payments_array = explode(',', $donor->payment_ids);
367 367
 
368
-					if( ! empty( $payments_array ) ) {
368
+					if ( ! empty($payments_array)) {
369 369
 
370
-						foreach ( $payments_array as $payment_id ) {
370
+						foreach ($payments_array as $payment_id) {
371 371
 
372
-							give_update_payment_meta( $payment_id, 'email', $user->user_email );
372
+							give_update_payment_meta($payment_id, 'email', $user->user_email);
373 373
 
374 374
 						}
375 375
 
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
 					 * @param  WP_User       $user     WordPress User object.
384 384
 					 * @param  Give_Donor $donor Give donor object.
385 385
 					 */
386
-					do_action( 'give_update_donor_email_on_user_update', $user, $donor );
386
+					do_action('give_update_donor_email_on_user_update', $user, $donor);
387 387
 
388 388
 				}
389 389
 
@@ -404,46 +404,46 @@  discard block
 block discarded – undo
404 404
 	 *
405 405
 	 * @return mixed         Upon success, an object of the donor. Upon failure, NULL
406 406
 	 */
407
-	public function get_donor_by( $field = 'id', $value = 0 ) {
407
+	public function get_donor_by($field = 'id', $value = 0) {
408 408
 		/* @var WPDB $wpdb */
409 409
 		global $wpdb;
410 410
 
411
-		if ( empty( $field ) || empty( $value ) ) {
411
+		if (empty($field) || empty($value)) {
412 412
 			return null;
413 413
 		}
414 414
 
415
-		if ( 'id' == $field || 'user_id' == $field ) {
415
+		if ('id' == $field || 'user_id' == $field) {
416 416
 			// Make sure the value is numeric to avoid casting objects, for example,
417 417
 			// to int 1.
418
-			if ( ! is_numeric( $value ) ) {
418
+			if ( ! is_numeric($value)) {
419 419
 				return false;
420 420
 			}
421 421
 
422
-			$value = intval( $value );
422
+			$value = intval($value);
423 423
 
424
-			if ( $value < 1 ) {
424
+			if ($value < 1) {
425 425
 				return false;
426 426
 			}
427 427
 
428
-		} elseif ( 'email' === $field ) {
428
+		} elseif ('email' === $field) {
429 429
 
430
-			if ( ! is_email( $value ) ) {
430
+			if ( ! is_email($value)) {
431 431
 				return false;
432 432
 			}
433 433
 
434
-			$value = trim( $value );
434
+			$value = trim($value);
435 435
 		}
436 436
 
437
-		if ( ! $value ) {
437
+		if ( ! $value) {
438 438
 			return false;
439 439
 		}
440 440
 
441
-		switch ( $field ) {
441
+		switch ($field) {
442 442
 			case 'id':
443 443
 				$db_field = 'id';
444 444
 				break;
445 445
 			case 'email':
446
-				$value    = sanitize_text_field( $value );
446
+				$value    = sanitize_text_field($value);
447 447
 				$db_field = 'email';
448 448
 				break;
449 449
 			case 'user_id':
@@ -453,15 +453,15 @@  discard block
 block discarded – undo
453 453
 				return false;
454 454
 		}
455 455
 
456
-		if ( ! $donor = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->table_name WHERE $db_field = %s LIMIT 1", $value ) ) ) {
456
+		if ( ! $donor = $wpdb->get_row($wpdb->prepare("SELECT * FROM $this->table_name WHERE $db_field = %s LIMIT 1", $value))) {
457 457
 
458 458
 			// Look for donor from an additional email.
459
-			if( 'email' === $field ) {
460
-				$meta_table  = Give()->donor_meta->table_name;
461
-				$donor_id = $wpdb->get_var( $wpdb->prepare( "SELECT customer_id FROM {$meta_table} WHERE meta_key = 'additional_email' AND meta_value = %s LIMIT 1", $value ) );
459
+			if ('email' === $field) {
460
+				$meta_table = Give()->donor_meta->table_name;
461
+				$donor_id = $wpdb->get_var($wpdb->prepare("SELECT customer_id FROM {$meta_table} WHERE meta_key = 'additional_email' AND meta_value = %s LIMIT 1", $value));
462 462
 
463
-				if( ! empty( $donor_id ) ) {
464
-					return $this->get( $donor_id );
463
+				if ( ! empty($donor_id)) {
464
+					return $this->get($donor_id);
465 465
  				}
466 466
  			}
467 467
 
@@ -481,7 +481,7 @@  discard block
 block discarded – undo
481 481
      *
482 482
      * @return array|object|null Customers array or object. Null if not found.
483 483
 	 */
484
-	public function get_donors( $args = array() ) {
484
+	public function get_donors($args = array()) {
485 485
         /* @var WPDB $wpdb */
486 486
 		global $wpdb;
487 487
 
@@ -493,21 +493,21 @@  discard block
 block discarded – undo
493 493
 			'order'   => 'DESC'
494 494
 		);
495 495
 
496
-		$args = wp_parse_args( $args, $defaults );
496
+		$args = wp_parse_args($args, $defaults);
497 497
 
498
-		if ( $args['number'] < 1 ) {
498
+		if ($args['number'] < 1) {
499 499
 			$args['number'] = 999999999999;
500 500
 		}
501 501
 
502 502
 		$where = ' WHERE 1=1 ';
503 503
 
504 504
 		// specific donors.
505
-		if ( ! empty( $args['id'] ) ) {
505
+		if ( ! empty($args['id'])) {
506 506
 
507
-			if ( is_array( $args['id'] ) ) {
508
-				$ids = implode( ',', array_map( 'intval', $args['id'] ) );
507
+			if (is_array($args['id'])) {
508
+				$ids = implode(',', array_map('intval', $args['id']));
509 509
 			} else {
510
-				$ids = intval( $args['id'] );
510
+				$ids = intval($args['id']);
511 511
 			}
512 512
 
513 513
 			$where .= " AND `id` IN( {$ids} ) ";
@@ -515,12 +515,12 @@  discard block
 block discarded – undo
515 515
 		}
516 516
 
517 517
 		// donors for specific user accounts
518
-		if ( ! empty( $args['user_id'] ) ) {
518
+		if ( ! empty($args['user_id'])) {
519 519
 
520
-			if ( is_array( $args['user_id'] ) ) {
521
-				$user_ids = implode( ',', array_map( 'intval', $args['user_id'] ) );
520
+			if (is_array($args['user_id'])) {
521
+				$user_ids = implode(',', array_map('intval', $args['user_id']));
522 522
 			} else {
523
-				$user_ids = intval( $args['user_id'] );
523
+				$user_ids = intval($args['user_id']);
524 524
 			}
525 525
 
526 526
 			$where .= " AND `user_id` IN( {$user_ids} ) ";
@@ -528,41 +528,41 @@  discard block
 block discarded – undo
528 528
 		}
529 529
 
530 530
 		//specific donors by email
531
-		if( ! empty( $args['email'] ) ) {
531
+		if ( ! empty($args['email'])) {
532 532
 
533
-			if( is_array( $args['email'] ) ) {
533
+			if (is_array($args['email'])) {
534 534
 
535
-				$emails_count       = count( $args['email'] );
536
-				$emails_placeholder = array_fill( 0, $emails_count, '%s' );
537
-				$emails             = implode( ', ', $emails_placeholder );
535
+				$emails_count       = count($args['email']);
536
+				$emails_placeholder = array_fill(0, $emails_count, '%s');
537
+				$emails             = implode(', ', $emails_placeholder);
538 538
 
539
-				$where .= $wpdb->prepare( " AND `email` IN( $emails ) ", $args['email'] );
539
+				$where .= $wpdb->prepare(" AND `email` IN( $emails ) ", $args['email']);
540 540
 			} else {
541
-				$where .= $wpdb->prepare( " AND `email` = %s ", $args['email'] );
541
+				$where .= $wpdb->prepare(" AND `email` = %s ", $args['email']);
542 542
 			}
543 543
 		}
544 544
 
545 545
 		// specific donors by name
546
-		if( ! empty( $args['name'] ) ) {
547
-			$where .= $wpdb->prepare( " AND `name` LIKE '%%%%" . '%s' . "%%%%' ", $args['name'] );
546
+		if ( ! empty($args['name'])) {
547
+			$where .= $wpdb->prepare(" AND `name` LIKE '%%%%".'%s'."%%%%' ", $args['name']);
548 548
 		}
549 549
 
550 550
 		// Donors created for a specific date or in a date range
551
-		if ( ! empty( $args['date'] ) ) {
551
+		if ( ! empty($args['date'])) {
552 552
 
553
-			if ( is_array( $args['date'] ) ) {
553
+			if (is_array($args['date'])) {
554 554
 
555
-				if ( ! empty( $args['date']['start'] ) ) {
555
+				if ( ! empty($args['date']['start'])) {
556 556
 
557
-					$start = date( 'Y-m-d H:i:s', strtotime( $args['date']['start'] ) );
557
+					$start = date('Y-m-d H:i:s', strtotime($args['date']['start']));
558 558
 
559 559
 					$where .= " AND `date_created` >= '{$start}'";
560 560
 
561 561
 				}
562 562
 
563
-				if ( ! empty( $args['date']['end'] ) ) {
563
+				if ( ! empty($args['date']['end'])) {
564 564
 
565
-					$end = date( 'Y-m-d H:i:s', strtotime( $args['date']['end'] ) );
565
+					$end = date('Y-m-d H:i:s', strtotime($args['date']['end']));
566 566
 
567 567
 					$where .= " AND `date_created` <= '{$end}'";
568 568
 
@@ -570,31 +570,31 @@  discard block
 block discarded – undo
570 570
 
571 571
 			} else {
572 572
 
573
-				$year  = date( 'Y', strtotime( $args['date'] ) );
574
-				$month = date( 'm', strtotime( $args['date'] ) );
575
-				$day   = date( 'd', strtotime( $args['date'] ) );
573
+				$year  = date('Y', strtotime($args['date']));
574
+				$month = date('m', strtotime($args['date']));
575
+				$day   = date('d', strtotime($args['date']));
576 576
 
577 577
 				$where .= " AND $year = YEAR ( date_created ) AND $month = MONTH ( date_created ) AND $day = DAY ( date_created )";
578 578
 			}
579 579
 
580 580
 		}
581 581
 
582
-		$args['orderby'] = ! array_key_exists( $args['orderby'], $this->get_columns() ) ? 'id' : $args['orderby'];
582
+		$args['orderby'] = ! array_key_exists($args['orderby'], $this->get_columns()) ? 'id' : $args['orderby'];
583 583
 
584
-		if ( 'purchase_value' == $args['orderby'] ) {
584
+		if ('purchase_value' == $args['orderby']) {
585 585
 			$args['orderby'] = 'purchase_value+0';
586 586
 		}
587 587
 
588
-		$cache_key = md5( 'give_donors_' . serialize( $args ) );
588
+		$cache_key = md5('give_donors_'.serialize($args));
589 589
 
590
-		$donors = wp_cache_get( $cache_key, 'donors' );
590
+		$donors = wp_cache_get($cache_key, 'donors');
591 591
 
592
-		$args['orderby'] = esc_sql( $args['orderby'] );
593
-		$args['order']   = esc_sql( $args['order'] );
592
+		$args['orderby'] = esc_sql($args['orderby']);
593
+		$args['order']   = esc_sql($args['order']);
594 594
 
595
-		if ( $donors === false ) {
596
-			$donors = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM  $this->table_name $where ORDER BY {$args['orderby']} {$args['order']} LIMIT %d,%d;", absint( $args['offset'] ), absint( $args['number'] ) ) );
597
-			wp_cache_set( $cache_key, $donors, 'donors', 3600 );
595
+		if ($donors === false) {
596
+			$donors = $wpdb->get_results($wpdb->prepare("SELECT * FROM  $this->table_name $where ORDER BY {$args['orderby']} {$args['order']} LIMIT %d,%d;", absint($args['offset']), absint($args['number'])));
597
+			wp_cache_set($cache_key, $donors, 'donors', 3600);
598 598
 		}
599 599
 
600 600
 		return $donors;
@@ -612,26 +612,26 @@  discard block
 block discarded – undo
612 612
      *
613 613
      * @return int         Total number of donors.
614 614
 	 */
615
-	public function count( $args = array() ) {
615
+	public function count($args = array()) {
616 616
         /* @var WPDB $wpdb */
617 617
 		global $wpdb;
618 618
 
619 619
 		$where = ' WHERE 1=1 ';
620 620
 
621
-		if ( ! empty( $args['date'] ) ) {
621
+		if ( ! empty($args['date'])) {
622 622
 
623
-			if ( is_array( $args['date'] ) ) {
623
+			if (is_array($args['date'])) {
624 624
 
625
-				$start = date( 'Y-m-d H:i:s', strtotime( $args['date']['start'] ) );
626
-				$end   = date( 'Y-m-d H:i:s', strtotime( $args['date']['end'] ) );
625
+				$start = date('Y-m-d H:i:s', strtotime($args['date']['start']));
626
+				$end   = date('Y-m-d H:i:s', strtotime($args['date']['end']));
627 627
 
628 628
 				$where .= " AND `date_created` >= '{$start}' AND `date_created` <= '{$end}'";
629 629
 
630 630
 			} else {
631 631
 
632
-				$year  = date( 'Y', strtotime( $args['date'] ) );
633
-				$month = date( 'm', strtotime( $args['date'] ) );
634
-				$day   = date( 'd', strtotime( $args['date'] ) );
632
+				$year  = date('Y', strtotime($args['date']));
633
+				$month = date('m', strtotime($args['date']));
634
+				$day   = date('d', strtotime($args['date']));
635 635
 
636 636
 				$where .= " AND $year = YEAR ( date_created ) AND $month = MONTH ( date_created ) AND $day = DAY ( date_created )";
637 637
 			}
@@ -639,16 +639,16 @@  discard block
 block discarded – undo
639 639
 		}
640 640
 
641 641
 
642
-		$cache_key = md5( 'give_donors_count' . serialize( $args ) );
642
+		$cache_key = md5('give_donors_count'.serialize($args));
643 643
 
644
-		$count = wp_cache_get( $cache_key, 'donors' );
644
+		$count = wp_cache_get($cache_key, 'donors');
645 645
 
646
-		if ( $count === false ) {
647
-			$count = $wpdb->get_var( "SELECT COUNT($this->primary_key) FROM " . $this->table_name . "{$where};" );
648
-			wp_cache_set( $cache_key, $count, 'donors', 3600 );
646
+		if ($count === false) {
647
+			$count = $wpdb->get_var("SELECT COUNT($this->primary_key) FROM ".$this->table_name."{$where};");
648
+			wp_cache_set($cache_key, $count, 'donors', 3600);
649 649
 		}
650 650
 
651
-		return absint( $count );
651
+		return absint($count);
652 652
 
653 653
 	}
654 654
 
@@ -662,9 +662,9 @@  discard block
 block discarded – undo
662 662
 	 */
663 663
 	public function create_table() {
664 664
 
665
-		require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
665
+		require_once(ABSPATH.'wp-admin/includes/upgrade.php');
666 666
 
667
-		$sql = "CREATE TABLE " . $this->table_name . " (
667
+		$sql = "CREATE TABLE ".$this->table_name." (
668 668
 		id bigint(20) NOT NULL AUTO_INCREMENT,
669 669
 		user_id bigint(20) NOT NULL,
670 670
 		email varchar(50) NOT NULL,
@@ -679,9 +679,9 @@  discard block
 block discarded – undo
679 679
 		KEY user (user_id)
680 680
 		) CHARACTER SET utf8 COLLATE utf8_general_ci;";
681 681
 
682
-		dbDelta( $sql );
682
+		dbDelta($sql);
683 683
 
684
-		update_option( $this->table_name . '_db_version', $this->version );
684
+		update_option($this->table_name.'_db_version', $this->version);
685 685
 	}
686 686
 	
687 687
 	/**
@@ -693,7 +693,7 @@  discard block
 block discarded – undo
693 693
 	 * @return bool Returns if the donors table was installed and upgrade routine run.
694 694
 	 */
695 695
 	public function installed() {
696
-		return $this->table_exists( $this->table_name );
696
+		return $this->table_exists($this->table_name);
697 697
 	}
698 698
 
699 699
 }
Please login to merge, or discard this patch.
templates/shortcode-goal.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -3,24 +3,24 @@  discard block
 block discarded – undo
3 3
  * This template is used to display the goal with [give_goal]
4 4
  */
5 5
 
6
-$form        = new Give_Donate_Form( $form_id );
7
-$goal_option = give_get_meta( $form->ID, '_give_goal_option', true );
6
+$form        = new Give_Donate_Form($form_id);
7
+$goal_option = give_get_meta($form->ID, '_give_goal_option', true);
8 8
 
9 9
 //Sanity check - ensure form has pass all condition to show goal.
10 10
 if (
11
-	( isset( $args['show_goal'] ) &&  ! filter_var( $args['show_goal'], FILTER_VALIDATE_BOOLEAN ) )
12
-	|| empty( $form->ID )
13
-	|| ( is_singular( 'give_forms' ) && ! give_is_setting_enabled( $goal_option ) )
14
-	|| ! give_is_setting_enabled( $goal_option )
11
+	(isset($args['show_goal']) && ! filter_var($args['show_goal'], FILTER_VALIDATE_BOOLEAN))
12
+	|| empty($form->ID)
13
+	|| (is_singular('give_forms') && ! give_is_setting_enabled($goal_option))
14
+	|| ! give_is_setting_enabled($goal_option)
15 15
 	|| 0 === $form->goal
16 16
 ) {
17 17
 	return false;
18 18
 }
19 19
 
20
-$goal_format = give_get_meta( $form_id, '_give_goal_format', true );
21
-$color       = give_get_meta( $form_id, '_give_goal_color', true );
22
-$show_text   = isset( $args['show_text'] ) ? filter_var( $args['show_text'], FILTER_VALIDATE_BOOLEAN ) : true;
23
-$show_bar    = isset( $args['show_bar'] ) ? filter_var( $args['show_bar'], FILTER_VALIDATE_BOOLEAN ) : true;
20
+$goal_format = give_get_meta($form_id, '_give_goal_format', true);
21
+$color       = give_get_meta($form_id, '_give_goal_color', true);
22
+$show_text   = isset($args['show_text']) ? filter_var($args['show_text'], FILTER_VALIDATE_BOOLEAN) : true;
23
+$show_bar    = isset($args['show_bar']) ? filter_var($args['show_bar'], FILTER_VALIDATE_BOOLEAN) : true;
24 24
 
25 25
 
26 26
 /**
@@ -28,14 +28,14 @@  discard block
 block discarded – undo
28 28
  *
29 29
  * @since 1.8.8
30 30
  */
31
-$income = apply_filters( 'give_goal_amount_raised_output', $form->get_earnings(), $form_id, $form );
31
+$income = apply_filters('give_goal_amount_raised_output', $form->get_earnings(), $form_id, $form);
32 32
 
33 33
 /**
34 34
  * Filter the form
35 35
  *
36 36
  * @since 1.8.8
37 37
  */
38
-$goal = apply_filters( 'give_goal_amount_target_output', $form->goal, $form_id, $form );
38
+$goal = apply_filters('give_goal_amount_target_output', $form->goal, $form_id, $form);
39 39
 
40 40
 
41 41
 /**
@@ -43,39 +43,39 @@  discard block
 block discarded – undo
43 43
  *
44 44
  * @since 1.8.8
45 45
  */
46
-$progress = apply_filters( 'give_goal_amount_funded_percentage_output', round( ( $income / $goal ) * 100, 2 ), $form_id, $form );
46
+$progress = apply_filters('give_goal_amount_funded_percentage_output', round(($income / $goal) * 100, 2), $form_id, $form);
47 47
 
48 48
 
49 49
 // Set progress to 100 percentage if income > goal.
50
-if ( $income >= $goal ) {
50
+if ($income >= $goal) {
51 51
 	$progress = 100;
52 52
 }
53 53
 
54 54
 ?>
55 55
 <div class="give-goal-progress">
56
-	<?php if ( ! empty( $show_text ) ) : ?>
56
+	<?php if ( ! empty($show_text)) : ?>
57 57
 		<div class="raised">
58 58
 			<?php
59
-			if ( $goal_format !== 'percentage' ) :
59
+			if ($goal_format !== 'percentage') :
60 60
 
61 61
 				// Get formatted amount.
62
-				$income = give_human_format_large_amount( give_format_amount( $income, array( 'sanitize' => false ) ) );
63
-				$goal   = give_human_format_large_amount( give_format_amount( $goal, array( 'sanitize' => false ) ) );
62
+				$income = give_human_format_large_amount(give_format_amount($income, array('sanitize' => false)));
63
+				$goal   = give_human_format_large_amount(give_format_amount($goal, array('sanitize' => false)));
64 64
 
65 65
 				echo sprintf(
66 66
 				/* translators: 1: amount of income raised 2: goal target ammount */
67
-					__( '%1$s of %2$s raised', 'give' ),
68
-					'<span class="income">' . give_currency_filter( $income ) . '</span>',
69
-					'<span class="goal-text">' . give_currency_filter( $goal ) . '</span>'
67
+					__('%1$s of %2$s raised', 'give'),
68
+					'<span class="income">'.give_currency_filter($income).'</span>',
69
+					'<span class="goal-text">'.give_currency_filter($goal).'</span>'
70 70
 				);
71 71
 
72 72
 
73
-			elseif ( $goal_format == 'percentage' ) :
73
+			elseif ($goal_format == 'percentage') :
74 74
 
75 75
 				echo sprintf(
76 76
 				/* translators: %s: percentage of the amount raised compared to the goal target */
77
-					__( '%s%% funded', 'give' ),
78
-					'<span class="give-percentage">' . round( $progress ) . '</span>'
77
+					__('%s%% funded', 'give'),
78
+					'<span class="give-percentage">'.round($progress).'</span>'
79 79
 				);
80 80
 
81 81
 			endif;
@@ -84,10 +84,10 @@  discard block
 block discarded – undo
84 84
 	<?php endif; ?>
85 85
 
86 86
 
87
-	<?php if ( ! empty( $show_bar ) ) : ?>
88
-		<div class="give-progress-bar" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="<?php echo esc_attr( $progress ); ?>">
89
-			<span style="width: <?php echo esc_attr( $progress ); ?>%;<?php if ( ! empty( $color ) ) {
90
-				echo 'background-color:' . $color;
87
+	<?php if ( ! empty($show_bar)) : ?>
88
+		<div class="give-progress-bar" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="<?php echo esc_attr($progress); ?>">
89
+			<span style="width: <?php echo esc_attr($progress); ?>%;<?php if ( ! empty($color)) {
90
+				echo 'background-color:'.$color;
91 91
 			} ?>"></span>
92 92
 		</div><!-- /.give-progress-bar -->
93 93
 	<?php endif; ?>
Please login to merge, or discard this patch.
templates/history-donations.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@
 block discarded – undo
71 71
 					<?php
72 72
 					// Display View Receipt or
73 73
 					if ( 'publish' !== $post->post_status
74
-					     && 'subscription' !== $post->post_status
74
+						 && 'subscription' !== $post->post_status
75 75
 					) : ?>
76 76
                         <a href="<?php echo esc_url( add_query_arg( 'payment_key', give_get_payment_key( $post->ID ), give_get_history_page_uri() ) ); ?>"><span
77 77
                                     class="give-donation-status <?php echo $post->post_status; ?>"><?php echo esc_html__( 'View', 'give' ) . ' ' . give_get_payment_status( $post, true ) . ' &raquo;'; ?></span></a>
Please login to merge, or discard this patch.
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -4,18 +4,18 @@  discard block
 block discarded – undo
4 4
  */
5 5
 
6 6
 // User's Donations
7
-if ( is_user_logged_in() ) {
8
-	$donations = give_get_users_donations( get_current_user_id(), 20, true, 'any' );
9
-} elseif ( Give()->email_access->token_exists ) {
7
+if (is_user_logged_in()) {
8
+	$donations = give_get_users_donations(get_current_user_id(), 20, true, 'any');
9
+} elseif (Give()->email_access->token_exists) {
10 10
 	// Email Access Token?
11
-	$donations = give_get_users_donations( 0, 20, true, 'any' );
12
-} elseif ( Give()->session->get_session_expiration() !== false ) {
11
+	$donations = give_get_users_donations(0, 20, true, 'any');
12
+} elseif (Give()->session->get_session_expiration() !== false) {
13 13
 	// Session active?
14
-	$email     = Give()->session->get( 'give_email' );
15
-	$donations = give_get_users_donations( $email, 20, true, 'any' );
14
+	$email     = Give()->session->get('give_email');
15
+	$donations = give_get_users_donations($email, 20, true, 'any');
16 16
 }
17 17
 
18
-if ( $donations ) : ?>
18
+if ($donations) : ?>
19 19
     <table id="give_user_history" class="give-table">
20 20
         <thead>
21 21
         <tr class="give-donation-row">
@@ -27,12 +27,12 @@  discard block
 block discarded – undo
27 27
 			 *
28 28
 			 * @since 1.7
29 29
 			 */
30
-			do_action( 'give_donation_history_header_before' );
30
+			do_action('give_donation_history_header_before');
31 31
 			?>
32
-            <th scope="col" class="give-donation-id"><?php esc_html_e( 'ID', 'give' ); ?></th>
33
-            <th scope="col" class="give-donation-date"><?php esc_html_e( 'Date', 'give' ); ?></th>
34
-            <th scope="col" class="give-donation-amount"><?php esc_html_e( 'Amount', 'give' ); ?></th>
35
-            <th scope="col" class="give-donation-details"><?php esc_html_e( 'Details', 'give' ); ?></th>
32
+            <th scope="col" class="give-donation-id"><?php esc_html_e('ID', 'give'); ?></th>
33
+            <th scope="col" class="give-donation-date"><?php esc_html_e('Date', 'give'); ?></th>
34
+            <th scope="col" class="give-donation-amount"><?php esc_html_e('Amount', 'give'); ?></th>
35
+            <th scope="col" class="give-donation-details"><?php esc_html_e('Details', 'give'); ?></th>
36 36
 			<?php
37 37
 			/**
38 38
 			 * Fires in current user donation history table, after the header row ends.
@@ -41,13 +41,13 @@  discard block
 block discarded – undo
41 41
 			 *
42 42
 			 * @since 1.7
43 43
 			 */
44
-			do_action( 'give_donation_history_header_after' );
44
+			do_action('give_donation_history_header_after');
45 45
 			?>
46 46
         </tr>
47 47
         </thead>
48
-		<?php foreach ( $donations as $post ) :
49
-			setup_postdata( $post );
50
-			$donation_data = give_get_payment_meta( $post->ID ); ?>
48
+		<?php foreach ($donations as $post) :
49
+			setup_postdata($post);
50
+			$donation_data = give_get_payment_meta($post->ID); ?>
51 51
             <tr class="give-donation-row">
52 52
 				<?php
53 53
 				/**
@@ -60,23 +60,23 @@  discard block
 block discarded – undo
60 60
 				 * @param int   $post_id       The ID of the post.
61 61
 				 * @param mixed $donation_data Payment meta data.
62 62
 				 */
63
-				do_action( 'give_donation_history_row_start', $post->ID, $donation_data );
63
+				do_action('give_donation_history_row_start', $post->ID, $donation_data);
64 64
 				?>
65
-                <td class="give-donation-id">#<?php echo give_get_payment_number( $post->ID ); ?></td>
66
-                <td class="give-donation-date"><?php echo date_i18n( give_date_format(), strtotime( get_post_field( 'post_date', $post->ID ) ) ); ?></td>
65
+                <td class="give-donation-id">#<?php echo give_get_payment_number($post->ID); ?></td>
66
+                <td class="give-donation-date"><?php echo date_i18n(give_date_format(), strtotime(get_post_field('post_date', $post->ID))); ?></td>
67 67
                 <td class="give-donation-amount">
68
-                    <span class="give-donation-amount"><?php echo give_currency_filter( give_format_amount( give_get_payment_amount( $post->ID ), array( 'sanitize' => false ) ) ); ?></span>
68
+                    <span class="give-donation-amount"><?php echo give_currency_filter(give_format_amount(give_get_payment_amount($post->ID), array('sanitize' => false))); ?></span>
69 69
                 </td>
70 70
                 <td class="give-donation-details">
71 71
 					<?php
72 72
 					// Display View Receipt or
73
-					if ( 'publish' !== $post->post_status
73
+					if ('publish' !== $post->post_status
74 74
 					     && 'subscription' !== $post->post_status
75 75
 					) : ?>
76
-                        <a href="<?php echo esc_url( add_query_arg( 'payment_key', give_get_payment_key( $post->ID ), give_get_history_page_uri() ) ); ?>"><span
77
-                                    class="give-donation-status <?php echo $post->post_status; ?>"><?php echo esc_html__( 'View', 'give' ) . ' ' . give_get_payment_status( $post, true ) . ' &raquo;'; ?></span></a>
76
+                        <a href="<?php echo esc_url(add_query_arg('payment_key', give_get_payment_key($post->ID), give_get_history_page_uri())); ?>"><span
77
+                                    class="give-donation-status <?php echo $post->post_status; ?>"><?php echo esc_html__('View', 'give').' '.give_get_payment_status($post, true).' &raquo;'; ?></span></a>
78 78
 					<?php else : ?>
79
-                        <a href="<?php echo esc_url( add_query_arg( 'payment_key', give_get_payment_key( $post->ID ), give_get_history_page_uri() ) ); ?>"><?php esc_html_e( 'View Receipt &raquo;', 'give' ); ?></a>
79
+                        <a href="<?php echo esc_url(add_query_arg('payment_key', give_get_payment_key($post->ID), give_get_history_page_uri())); ?>"><?php esc_html_e('View Receipt &raquo;', 'give'); ?></a>
80 80
 					<?php endif; ?>
81 81
                 </td>
82 82
 				<?php
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 				 * @param int   $post_id       The ID of the post.
91 91
 				 * @param mixed $donation_data Payment meta data.
92 92
 				 */
93
-				do_action( 'give_donation_history_row_end', $post->ID, $donation_data );
93
+				do_action('give_donation_history_row_end', $post->ID, $donation_data);
94 94
 				?>
95 95
             </tr>
96 96
 		<?php endforeach; ?>
@@ -98,15 +98,15 @@  discard block
 block discarded – undo
98 98
     <div id="give-donation-history-pagination" class="give_pagination navigation">
99 99
 		<?php
100 100
 		$big = 999999;
101
-		echo paginate_links( array(
102
-			'base'    => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
101
+		echo paginate_links(array(
102
+			'base'    => str_replace($big, '%#%', esc_url(get_pagenum_link($big))),
103 103
 			'format'  => '?paged=%#%',
104
-			'current' => max( 1, get_query_var( 'paged' ) ),
105
-			'total'   => ceil( give_count_donations_of_donor() / 20 ) // 20 items per page
106
-		) );
104
+			'current' => max(1, get_query_var('paged')),
105
+			'total'   => ceil(give_count_donations_of_donor() / 20) // 20 items per page
106
+		));
107 107
 		?>
108 108
     </div>
109 109
 	<?php wp_reset_postdata(); ?>
110 110
 <?php else : ?>
111
-	<?php Give()->notices->print_frontend_notice( esc_html__( 'It looks like you haven\'t made any donations.', 'give' ), true, 'success' ); ?>
111
+	<?php Give()->notices->print_frontend_notice(esc_html__('It looks like you haven\'t made any donations.', 'give'), true, 'success'); ?>
112 112
 <?php endif;
Please login to merge, or discard this patch.
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -75,8 +75,11 @@  discard block
 block discarded – undo
75 75
 					) : ?>
76 76
                         <a href="<?php echo esc_url( add_query_arg( 'payment_key', give_get_payment_key( $post->ID ), give_get_history_page_uri() ) ); ?>"><span
77 77
                                     class="give-donation-status <?php echo $post->post_status; ?>"><?php echo esc_html__( 'View', 'give' ) . ' ' . give_get_payment_status( $post, true ) . ' &raquo;'; ?></span></a>
78
-					<?php else : ?>
79
-                        <a href="<?php echo esc_url( add_query_arg( 'payment_key', give_get_payment_key( $post->ID ), give_get_history_page_uri() ) ); ?>"><?php esc_html_e( 'View Receipt &raquo;', 'give' ); ?></a>
78
+					<?php else {
79
+	: ?>
80
+                        <a href="<?php echo esc_url( add_query_arg( 'payment_key', give_get_payment_key( $post->ID ), give_get_history_page_uri() ) );
81
+}
82
+?>"><?php esc_html_e( 'View Receipt &raquo;', 'give' ); ?></a>
80 83
 					<?php endif; ?>
81 84
                 </td>
82 85
 				<?php
@@ -107,6 +110,9 @@  discard block
 block discarded – undo
107 110
 		?>
108 111
     </div>
109 112
 	<?php wp_reset_postdata(); ?>
110
-<?php else : ?>
111
-	<?php Give()->notices->print_frontend_notice( esc_html__( 'It looks like you haven\'t made any donations.', 'give' ), true, 'success' ); ?>
113
+<?php else {
114
+	: ?>
115
+	<?php Give()->notices->print_frontend_notice( esc_html__( 'It looks like you haven\'t made any donations.', 'give' ), true, 'success' );
116
+}
117
+?>
112 118
 <?php endif;
Please login to merge, or discard this patch.
templates/shortcode-profile-editor.php 2 patches
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -7,22 +7,22 @@  discard block
 block discarded – undo
7 7
  * @copyright    Copyright (c) 2016, WordImpress
8 8
  * @license      https://opensource.org/licenses/gpl-license GNU Public License
9 9
  */
10
-$current_user     = wp_get_current_user();
10
+$current_user = wp_get_current_user();
11 11
 
12
-if ( is_user_logged_in() ):
12
+if (is_user_logged_in()):
13 13
 	$user_id = get_current_user_id();
14
-	$first_name   = get_user_meta( $user_id, 'first_name', true );
15
-	$last_name    = get_user_meta( $user_id, 'last_name', true );
14
+	$first_name   = get_user_meta($user_id, 'first_name', true);
15
+	$last_name    = get_user_meta($user_id, 'last_name', true);
16 16
 	$display_name = $current_user->display_name;
17
-	$address      = give_get_donor_address( $user_id );
17
+	$address      = give_get_donor_address($user_id);
18 18
 
19
-	if ( isset( $_GET['updated'] ) && $_GET['updated'] == true && ! give_get_errors() ): ?>
19
+	if (isset($_GET['updated']) && $_GET['updated'] == true && ! give_get_errors()): ?>
20 20
 		<p class="give_success">
21
-			<strong><?php esc_html_e( 'Success:', 'give' ); ?></strong> <?php esc_html_e( 'Your profile has been updated.', 'give' ); ?>
21
+			<strong><?php esc_html_e('Success:', 'give'); ?></strong> <?php esc_html_e('Your profile has been updated.', 'give'); ?>
22 22
 		</p>
23 23
 	<?php endif; ?>
24 24
 
25
-	<?php Give()->notices->render_frontend_notices( 0 ); ?>
25
+	<?php Give()->notices->render_frontend_notices(0); ?>
26 26
 
27 27
 	<?php
28 28
 	/**
@@ -32,38 +32,38 @@  discard block
 block discarded – undo
32 32
 	 *
33 33
 	 * @since 1.0
34 34
 	 */
35
-	do_action( 'give_profile_editor_before' );
35
+	do_action('give_profile_editor_before');
36 36
 	?>
37 37
 
38 38
 	<form id="give_profile_editor_form" class="give-form" action="<?php echo give_get_current_page_url(); ?>" method="post">
39 39
 
40 40
 		<fieldset>
41 41
 
42
-			<legend id="give_profile_name_label"><?php esc_html_e( 'Change your Name', 'give' ); ?></legend>
42
+			<legend id="give_profile_name_label"><?php esc_html_e('Change your Name', 'give'); ?></legend>
43 43
 
44 44
 			<p id="give_profile_first_name_wrap" class="form-row form-row-first form-row-responsive">
45
-				<label for="give_first_name"><?php esc_html_e( 'First Name', 'give' ); ?></label>
46
-				<input name="give_first_name" id="give_first_name" class="text give-input" type="text" value="<?php echo esc_attr( $first_name ); ?>"/>
45
+				<label for="give_first_name"><?php esc_html_e('First Name', 'give'); ?></label>
46
+				<input name="give_first_name" id="give_first_name" class="text give-input" type="text" value="<?php echo esc_attr($first_name); ?>"/>
47 47
 			</p>
48 48
 
49 49
 			<p id="give_profile_last_name_wrap" class="form-row form-row-last form-row-responsive">
50
-				<label for="give_last_name"><?php esc_html_e( 'Last Name', 'give' ); ?></label>
51
-				<input name="give_last_name" id="give_last_name" class="text give-input" type="text" value="<?php echo esc_attr( $last_name ); ?>"/>
50
+				<label for="give_last_name"><?php esc_html_e('Last Name', 'give'); ?></label>
51
+				<input name="give_last_name" id="give_last_name" class="text give-input" type="text" value="<?php echo esc_attr($last_name); ?>"/>
52 52
 			</p>
53 53
 
54 54
 			<p id="give_profile_display_name_wrap" class="form-row form-row-first form-row-responsive">
55
-				<label for="give_display_name"><?php esc_html_e( 'Display Name', 'give' ); ?></label>
55
+				<label for="give_display_name"><?php esc_html_e('Display Name', 'give'); ?></label>
56 56
 				<select name="give_display_name" id="give_display_name" class="select give-select">
57
-					<?php if ( ! empty( $current_user->first_name ) ): ?>
58
-						<option <?php selected( $display_name, $current_user->first_name ); ?> value="<?php echo esc_attr( $current_user->first_name ); ?>"><?php echo esc_html( $current_user->first_name ); ?></option>
57
+					<?php if ( ! empty($current_user->first_name)): ?>
58
+						<option <?php selected($display_name, $current_user->first_name); ?> value="<?php echo esc_attr($current_user->first_name); ?>"><?php echo esc_html($current_user->first_name); ?></option>
59 59
 					<?php endif; ?>
60
-					<option <?php selected( $display_name, $current_user->user_nicename ); ?> value="<?php echo esc_attr( $current_user->user_nicename ); ?>"><?php echo esc_html( $current_user->user_nicename ); ?></option>
61
-					<?php if ( ! empty( $current_user->last_name ) ): ?>
62
-						<option <?php selected( $display_name, $current_user->last_name ); ?> value="<?php echo esc_attr( $current_user->last_name ); ?>"><?php echo esc_html( $current_user->last_name ); ?></option>
60
+					<option <?php selected($display_name, $current_user->user_nicename); ?> value="<?php echo esc_attr($current_user->user_nicename); ?>"><?php echo esc_html($current_user->user_nicename); ?></option>
61
+					<?php if ( ! empty($current_user->last_name)): ?>
62
+						<option <?php selected($display_name, $current_user->last_name); ?> value="<?php echo esc_attr($current_user->last_name); ?>"><?php echo esc_html($current_user->last_name); ?></option>
63 63
 					<?php endif; ?>
64
-					<?php if ( ! empty( $current_user->first_name ) && ! empty( $current_user->last_name ) ): ?>
65
-						<option <?php selected( $display_name, $current_user->first_name . ' ' . $current_user->last_name ); ?> value="<?php echo esc_attr( $current_user->first_name . ' ' . $current_user->last_name ); ?>"><?php echo esc_html( $current_user->first_name . ' ' . $current_user->last_name ); ?></option>
66
-						<option <?php selected( $display_name, $current_user->last_name . ' ' . $current_user->first_name ); ?> value="<?php echo esc_attr( $current_user->last_name . ' ' . $current_user->first_name ); ?>"><?php echo esc_html( $current_user->last_name . ' ' . $current_user->first_name ); ?></option>
64
+					<?php if ( ! empty($current_user->first_name) && ! empty($current_user->last_name)): ?>
65
+						<option <?php selected($display_name, $current_user->first_name.' '.$current_user->last_name); ?> value="<?php echo esc_attr($current_user->first_name.' '.$current_user->last_name); ?>"><?php echo esc_html($current_user->first_name.' '.$current_user->last_name); ?></option>
66
+						<option <?php selected($display_name, $current_user->last_name.' '.$current_user->first_name); ?> value="<?php echo esc_attr($current_user->last_name.' '.$current_user->first_name); ?>"><?php echo esc_html($current_user->last_name.' '.$current_user->first_name); ?></option>
67 67
 					<?php endif; ?>
68 68
 				</select>
69 69
 				<?php
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 				 *
75 75
 				 * @since 1.0
76 76
 				 */
77
-				do_action( 'give_profile_editor_name' );
77
+				do_action('give_profile_editor_name');
78 78
 				?>
79 79
 			</p>
80 80
 
@@ -86,12 +86,12 @@  discard block
 block discarded – undo
86 86
 			 *
87 87
 			 * @since 1.0
88 88
 			 */
89
-			do_action( 'give_profile_editor_after_name' );
89
+			do_action('give_profile_editor_after_name');
90 90
 			?>
91 91
 
92 92
 			<p class="form-row form-row-last form-row-responsive">
93
-				<label for="give_email"><?php esc_html_e( 'Email Address', 'give' ); ?></label>
94
-				<input name="give_email" id="give_email" class="text give-input required" type="email" value="<?php echo esc_attr( $current_user->user_email ); ?>" required aria-required="true"/>
93
+				<label for="give_email"><?php esc_html_e('Email Address', 'give'); ?></label>
94
+				<input name="give_email" id="give_email" class="text give-input required" type="email" value="<?php echo esc_attr($current_user->user_email); ?>" required aria-required="true"/>
95 95
 				<?php
96 96
 				/**
97 97
 				 * Fires in the profile editor shortcode, to the email section.
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 				 *
101 101
 				 * @since 1.0
102 102
 				 */
103
-				do_action( 'give_profile_editor_email' );
103
+				do_action('give_profile_editor_email');
104 104
 				?>
105 105
 			</p>
106 106
 
@@ -112,45 +112,45 @@  discard block
 block discarded – undo
112 112
 			 *
113 113
 			 * @since 1.0
114 114
 			 */
115
-			do_action( 'give_profile_editor_after_email' );
115
+			do_action('give_profile_editor_after_email');
116 116
 			?>
117 117
 
118
-			<legend id="give_profile_billing_address_label"><?php esc_html_e( 'Change your Billing Address', 'give' ); ?></legend>
118
+			<legend id="give_profile_billing_address_label"><?php esc_html_e('Change your Billing Address', 'give'); ?></legend>
119 119
 
120 120
 			<div id="give_profile_billing_address_wrap">
121 121
 
122 122
 				<p id="give-card-address-wrap" class="form-row form-row-first form-row-responsive">
123
-					<label for="give_address_line1"><?php esc_html_e( 'Address 1', 'give' ); ?></label>
124
-					<input name="give_address_line1" id="give_address_line1" class="text give-input" type="text" value="<?php echo esc_attr( $address['line1'] ); ?>"/>
123
+					<label for="give_address_line1"><?php esc_html_e('Address 1', 'give'); ?></label>
124
+					<input name="give_address_line1" id="give_address_line1" class="text give-input" type="text" value="<?php echo esc_attr($address['line1']); ?>"/>
125 125
 				</p>
126 126
 
127 127
 				<p id="give-card-address-2-wrap" class="form-row form-row-last form-row-responsive">
128
-					<label for="give_address_line2"><?php esc_html_e( 'Address 2', 'give' ); ?></label>
129
-					<input name="give_address_line2" id="give_address_line2" class="text give-input" type="text" value="<?php echo esc_attr( $address['line2'] ); ?>"/>
128
+					<label for="give_address_line2"><?php esc_html_e('Address 2', 'give'); ?></label>
129
+					<input name="give_address_line2" id="give_address_line2" class="text give-input" type="text" value="<?php echo esc_attr($address['line2']); ?>"/>
130 130
 				</p>
131 131
 
132 132
 				<p id="give-card-city-wrap" class="form-row form-row-first form-row-responsive">
133
-					<label for="give_address_city"><?php esc_html_e( 'City', 'give' ); ?></label>
134
-					<input name="give_address_city" id="give_address_city" class="text give-input" type="text" value="<?php echo esc_attr( $address['city'] ); ?>"/>
133
+					<label for="give_address_city"><?php esc_html_e('City', 'give'); ?></label>
134
+					<input name="give_address_city" id="give_address_city" class="text give-input" type="text" value="<?php echo esc_attr($address['city']); ?>"/>
135 135
 				</p>
136 136
 
137 137
 				<p id="give-card-zip-wrap" class="form-row form-row-last form-row-responsive">
138
-					<label for="give_address_zip"><?php esc_html_e( 'Zip / Postal Code', 'give' ); ?></label>
139
-					<input name="give_address_zip" id="give_address_zip" class="text give-input" type="text" value="<?php echo esc_attr( $address['zip'] ); ?>"/>
138
+					<label for="give_address_zip"><?php esc_html_e('Zip / Postal Code', 'give'); ?></label>
139
+					<input name="give_address_zip" id="give_address_zip" class="text give-input" type="text" value="<?php echo esc_attr($address['zip']); ?>"/>
140 140
 				</p>
141 141
 
142 142
 				<p id="give-card-country-wrap" class="form-row form-row-first form-row-responsive">
143
-					<label for="give_address_country"><?php esc_html_e( 'Country', 'give' ); ?></label>
143
+					<label for="give_address_country"><?php esc_html_e('Country', 'give'); ?></label>
144 144
 					<select name="give_address_country" id="give_address_country" class="select give-select">
145
-						<?php foreach ( give_get_country_list() as $key => $country ) : ?>
146
-							<option value="<?php echo $key; ?>"<?php selected( $address['country'], $key ); ?>><?php echo esc_html( $country ); ?></option>
145
+						<?php foreach (give_get_country_list() as $key => $country) : ?>
146
+							<option value="<?php echo $key; ?>"<?php selected($address['country'], $key); ?>><?php echo esc_html($country); ?></option>
147 147
 						<?php endforeach; ?>
148 148
 					</select>
149 149
 				</p>
150 150
 
151 151
 				<p id="give-card-state-wrap" class="form-row form-row-last form-row-responsive">
152
-					<label for="give_address_state"><?php esc_html_e( 'State / Province / County', 'give' ); ?></label>
153
-					<input name="give_address_state" id="give_address_state" class="text give-input" type="text" value="<?php echo esc_attr( $address['state'] ); ?>"/>
152
+					<label for="give_address_state"><?php esc_html_e('State / Province / County', 'give'); ?></label>
153
+					<input name="give_address_state" id="give_address_state" class="text give-input" type="text" value="<?php echo esc_attr($address['state']); ?>"/>
154 154
 				</p>
155 155
 
156 156
 				<?php
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 				 *
162 162
 				 * @since 1.0
163 163
 				 */
164
-				do_action( 'give_profile_editor_address' );
164
+				do_action('give_profile_editor_address');
165 165
 				?>
166 166
 
167 167
 			</div>
@@ -174,19 +174,19 @@  discard block
 block discarded – undo
174 174
 			 *
175 175
 			 * @since 1.0
176 176
 			 */
177
-			do_action( 'give_profile_editor_after_address' );
177
+			do_action('give_profile_editor_after_address');
178 178
 			?>
179 179
 
180
-			<legend id="give_profile_password_label"><?php esc_html_e( 'Change your Password', 'give' ); ?></legend>
180
+			<legend id="give_profile_password_label"><?php esc_html_e('Change your Password', 'give'); ?></legend>
181 181
 
182 182
 			<div id="give_profile_password_wrap" class="give-clearfix">
183 183
 				<p id="give_profile_password_wrap_1" class="form-row form-row-first form-row-responsive">
184
-					<label for="give_new_user_pass1"><?php esc_html_e( 'New Password', 'give' ); ?></label>
184
+					<label for="give_new_user_pass1"><?php esc_html_e('New Password', 'give'); ?></label>
185 185
 					<input name="give_new_user_pass1" id="give_new_user_pass1" class="password give-input" type="password"/>
186 186
 				</p>
187 187
 
188 188
 				<p id="give_profile_password_wrap_2" class="form-row form-row-last form-row-responsive">
189
-					<label for="give_new_user_pass2"><?php esc_html_e( 'Re-enter Password', 'give' ); ?></label>
189
+					<label for="give_new_user_pass2"><?php esc_html_e('Re-enter Password', 'give'); ?></label>
190 190
 					<input name="give_new_user_pass2" id="give_new_user_pass2" class="password give-input" type="password"/>
191 191
 					<?php
192 192
 					/**
@@ -196,12 +196,12 @@  discard block
 block discarded – undo
196 196
 					 *
197 197
 					 * @since 1.0
198 198
 					 */
199
-					do_action( 'give_profile_editor_password' );
199
+					do_action('give_profile_editor_password');
200 200
 					?>
201 201
 				</p>
202 202
 			</div>
203 203
 
204
-			<p class="give_password_change_notice"><?php esc_html_e( 'Please note after changing your password, you must log back in.', 'give' ); ?></p>
204
+			<p class="give_password_change_notice"><?php esc_html_e('Please note after changing your password, you must log back in.', 'give'); ?></p>
205 205
 
206 206
 			<?php
207 207
 			/**
@@ -211,14 +211,14 @@  discard block
 block discarded – undo
211 211
 			 *
212 212
 			 * @since 1.0
213 213
 			 */
214
-			do_action( 'give_profile_editor_after_password' );
214
+			do_action('give_profile_editor_after_password');
215 215
 			?>
216 216
 
217 217
 			<p id="give_profile_submit_wrap">
218
-				<input type="hidden" name="give_profile_editor_nonce" value="<?php echo wp_create_nonce( 'give-profile-editor-nonce' ); ?>"/>
218
+				<input type="hidden" name="give_profile_editor_nonce" value="<?php echo wp_create_nonce('give-profile-editor-nonce'); ?>"/>
219 219
 				<input type="hidden" name="give_action" value="edit_user_profile"/>
220
-				<input type="hidden" name="give_redirect" value="<?php echo esc_url( give_get_current_page_url() ); ?>"/>
221
-				<input name="give_profile_editor_submit" id="give_profile_editor_submit" type="submit" class="give_submit" value="<?php esc_attr_e( 'Save Changes', 'give' ); ?>"/>
220
+				<input type="hidden" name="give_redirect" value="<?php echo esc_url(give_get_current_page_url()); ?>"/>
221
+				<input name="give_profile_editor_submit" id="give_profile_editor_submit" type="submit" class="give_submit" value="<?php esc_attr_e('Save Changes', 'give'); ?>"/>
222 222
 			</p>
223 223
 
224 224
 		</fieldset>
@@ -233,11 +233,11 @@  discard block
 block discarded – undo
233 233
 	 *
234 234
 	 * @since 1.0
235 235
 	 */
236
-	do_action( 'give_profile_editor_after' );
236
+	do_action('give_profile_editor_after');
237 237
 	?>
238 238
 
239 239
 	<?php
240 240
 else:
241
-	esc_html_e( 'You need to login to edit your profile.', 'give' );
241
+	esc_html_e('You need to login to edit your profile.', 'give');
242 242
 	echo give_login_form();
243 243
 endif;
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -237,7 +237,9 @@
 block discarded – undo
237 237
 	?>
238 238
 
239 239
 	<?php
240
-else:
240
+else {
241
+	:
241 242
 	esc_html_e( 'You need to login to edit your profile.', 'give' );
243
+}
242 244
 	echo give_login_form();
243 245
 endif;
Please login to merge, or discard this patch.