Test Failed
Push — master ( 966cf3...fe1ced )
by Devin
13:57 queued 06:53
created
includes/template-functions.php 1 patch
Spacing   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
  * @return string
22 22
  */
23 23
 function give_get_templates_dir() {
24
-	return GIVE_PLUGIN_DIR . 'templates';
24
+	return GIVE_PLUGIN_DIR.'templates';
25 25
 }
26 26
 
27 27
 /**
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
  * @return string
32 32
  */
33 33
 function give_get_templates_url() {
34
-	return GIVE_PLUGIN_URL . 'templates';
34
+	return GIVE_PLUGIN_URL.'templates';
35 35
 }
36 36
 
37 37
 /**
@@ -44,24 +44,24 @@  discard block
 block discarded – undo
44 44
  * @param string $template_path Template file path. Default is empty.
45 45
  * @param string $default_path  Default path. Default is empty.
46 46
  */
47
-function give_get_template( $template_name, $args = array(), $template_path = '', $default_path = '' ) {
48
-	if ( ! empty( $args ) && is_array( $args ) ) {
49
-		extract( $args );
47
+function give_get_template($template_name, $args = array(), $template_path = '', $default_path = '') {
48
+	if ( ! empty($args) && is_array($args)) {
49
+		extract($args);
50 50
 	}
51 51
 
52
-	$template_names = array( $template_name . '.php' );
52
+	$template_names = array($template_name.'.php');
53 53
 
54
-	$located = give_locate_template( $template_names, $template_path, $default_path );
54
+	$located = give_locate_template($template_names, $template_path, $default_path);
55 55
 
56
-	if ( ! file_exists( $located ) ) {
56
+	if ( ! file_exists($located)) {
57 57
 		/* translators: %s: the template */
58
-		Give()->notices->print_frontend_notice( sprintf( __( 'The %s template was not found.', 'give' ), $located ), true );
58
+		Give()->notices->print_frontend_notice(sprintf(__('The %s template was not found.', 'give'), $located), true);
59 59
 
60 60
 		return;
61 61
 	}
62 62
 
63 63
 	// Allow 3rd party plugin filter template file from their plugin.
64
-	$located = apply_filters( 'give_get_template', $located, $template_name, $args, $template_path, $default_path );
64
+	$located = apply_filters('give_get_template', $located, $template_name, $args, $template_path, $default_path);
65 65
 
66 66
 	/**
67 67
 	 * Fires in give template, before the file is included.
@@ -75,9 +75,9 @@  discard block
 block discarded – undo
75 75
 	 * @param string $located       Template file filter by 3rd party plugin.
76 76
 	 * @param array  $args          Passed arguments.
77 77
 	 */
78
-	do_action( 'give_before_template_part', $template_name, $template_path, $located, $args );
78
+	do_action('give_before_template_part', $template_name, $template_path, $located, $args);
79 79
 
80
-	include( $located );
80
+	include($located);
81 81
 
82 82
 	/**
83 83
 	 * Fires in give template, after the file is included.
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 	 * @param string $located       Template file filter by 3rd party plugin.
92 92
 	 * @param array  $args          Passed arguments.
93 93
 	 */
94
-	do_action( 'give_after_template_part', $template_name, $template_path, $located, $args );
94
+	do_action('give_after_template_part', $template_name, $template_path, $located, $args);
95 95
 }
96 96
 
97 97
 /**
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
  *
108 108
  * @return string
109 109
  */
110
-function give_get_template_part( $slug, $name = null, $load = true ) {
110
+function give_get_template_part($slug, $name = null, $load = true) {
111 111
 
112 112
 	/**
113 113
 	 * Fires in give template part, before the template part is retrieved.
@@ -119,20 +119,20 @@  discard block
 block discarded – undo
119 119
 	 * @param string $slug Template part file slug {slug}.php.
120 120
 	 * @param string $name Template part file name {slug}-{name}.php.
121 121
 	 */
122
-	do_action( "get_template_part_{$slug}", $slug, $name );
122
+	do_action("get_template_part_{$slug}", $slug, $name);
123 123
 
124 124
 	// Setup possible parts
125 125
 	$templates = array();
126
-	if ( isset( $name ) ) {
127
-		$templates[] = $slug . '-' . $name . '.php';
126
+	if (isset($name)) {
127
+		$templates[] = $slug.'-'.$name.'.php';
128 128
 	}
129
-	$templates[] = $slug . '.php';
129
+	$templates[] = $slug.'.php';
130 130
 
131 131
 	// Allow template parts to be filtered
132
-	$templates = apply_filters( 'give_get_template_part', $templates, $slug, $name );
132
+	$templates = apply_filters('give_get_template_part', $templates, $slug, $name);
133 133
 
134 134
 	// Return the part that is found
135
-	return give_locate_template( $templates, $load, false );
135
+	return give_locate_template($templates, $load, false);
136 136
 }
137 137
 
138 138
 /**
@@ -153,37 +153,37 @@  discard block
 block discarded – undo
153 153
  *
154 154
  * @return string The template filename if one is located.
155 155
  */
156
-function give_locate_template( $template_names, $load = false, $require_once = true ) {
156
+function give_locate_template($template_names, $load = false, $require_once = true) {
157 157
 	// No file found yet
158 158
 	$located = false;
159 159
 
160 160
 	// Try to find a template file
161
-	foreach ( (array) $template_names as $template_name ) {
161
+	foreach ((array) $template_names as $template_name) {
162 162
 
163 163
 		// Continue if template is empty
164
-		if ( empty( $template_name ) ) {
164
+		if (empty($template_name)) {
165 165
 			continue;
166 166
 		}
167 167
 
168 168
 		// Trim off any slashes from the template name
169
-		$template_name = ltrim( $template_name, '/' );
169
+		$template_name = ltrim($template_name, '/');
170 170
 
171 171
 		// try locating this template file by looping through the template paths
172
-		foreach ( give_get_theme_template_paths() as $template_path ) {
172
+		foreach (give_get_theme_template_paths() as $template_path) {
173 173
 
174
-			if ( file_exists( $template_path . $template_name ) ) {
175
-				$located = $template_path . $template_name;
174
+			if (file_exists($template_path.$template_name)) {
175
+				$located = $template_path.$template_name;
176 176
 				break;
177 177
 			}
178 178
 		}
179 179
 
180
-		if ( $located ) {
180
+		if ($located) {
181 181
 			break;
182 182
 		}
183 183
 	}
184 184
 
185
-	if ( ( true == $load ) && ! empty( $located ) ) {
186
-		load_template( $located, $require_once );
185
+	if ((true == $load) && ! empty($located)) {
186
+		load_template($located, $require_once);
187 187
 	}
188 188
 
189 189
 	return $located;
@@ -200,17 +200,17 @@  discard block
 block discarded – undo
200 200
 	$template_dir = give_get_theme_template_dir_name();
201 201
 
202 202
 	$file_paths = array(
203
-		1   => trailingslashit( get_stylesheet_directory() ) . $template_dir,
204
-		10  => trailingslashit( get_template_directory() ) . $template_dir,
203
+		1   => trailingslashit(get_stylesheet_directory()).$template_dir,
204
+		10  => trailingslashit(get_template_directory()).$template_dir,
205 205
 		100 => give_get_templates_dir(),
206 206
 	);
207 207
 
208
-	$file_paths = apply_filters( 'give_template_paths', $file_paths );
208
+	$file_paths = apply_filters('give_template_paths', $file_paths);
209 209
 
210 210
 	// sort the file paths based on priority
211
-	ksort( $file_paths, SORT_NUMERIC );
211
+	ksort($file_paths, SORT_NUMERIC);
212 212
 
213
-	return array_map( 'trailingslashit', $file_paths );
213
+	return array_map('trailingslashit', $file_paths);
214 214
 }
215 215
 
216 216
 /**
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
  * @return string
223 223
  */
224 224
 function give_get_theme_template_dir_name() {
225
-	return trailingslashit( apply_filters( 'give_templates_dir', 'give' ) );
225
+	return trailingslashit(apply_filters('give_templates_dir', 'give'));
226 226
 }
227 227
 
228 228
 /**
@@ -232,10 +232,10 @@  discard block
 block discarded – undo
232 232
  * @return void
233 233
  */
234 234
 function give_version_in_header() {
235
-	echo '<meta name="generator" content="Give v' . GIVE_VERSION . '" />' . "\n";
235
+	echo '<meta name="generator" content="Give v'.GIVE_VERSION.'" />'."\n";
236 236
 }
237 237
 
238
-add_action( 'wp_head', 'give_version_in_header' );
238
+add_action('wp_head', 'give_version_in_header');
239 239
 
240 240
 /**
241 241
  * Determines if we're currently on the Donations History page.
@@ -245,9 +245,9 @@  discard block
 block discarded – undo
245 245
  */
246 246
 function give_is_donation_history_page() {
247 247
 
248
-	$ret = is_page( give_get_option( 'history_page' ) );
248
+	$ret = is_page(give_get_option('history_page'));
249 249
 
250
-	return apply_filters( 'give_is_donation_history_page', $ret );
250
+	return apply_filters('give_is_donation_history_page', $ret);
251 251
 }
252 252
 
253 253
 /**
@@ -259,25 +259,25 @@  discard block
 block discarded – undo
259 259
  *
260 260
  * @return array Modified array of classes
261 261
  */
262
-function give_add_body_classes( $class ) {
262
+function give_add_body_classes($class) {
263 263
 	$classes = (array) $class;
264 264
 
265
-	if ( give_is_success_page() ) {
265
+	if (give_is_success_page()) {
266 266
 		$classes[] = 'give-success';
267 267
 		$classes[] = 'give-page';
268 268
 	}
269 269
 
270
-	if ( give_is_failed_transaction_page() ) {
270
+	if (give_is_failed_transaction_page()) {
271 271
 		$classes[] = 'give-failed-transaction';
272 272
 		$classes[] = 'give-page';
273 273
 	}
274 274
 
275
-	if ( give_is_donation_history_page() ) {
275
+	if (give_is_donation_history_page()) {
276 276
 		$classes[] = 'give-donation-history';
277 277
 		$classes[] = 'give-page';
278 278
 	}
279 279
 
280
-	if ( give_is_test_mode() ) {
280
+	if (give_is_test_mode()) {
281 281
 		$classes[] = 'give-test-mode';
282 282
 		$classes[] = 'give-page';
283 283
 	}
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 	/* @var WP_Theme $current_theme */
287 287
 	$current_theme = wp_get_theme();
288 288
 
289
-	switch ( $current_theme->get_template() ) {
289
+	switch ($current_theme->get_template()) {
290 290
 
291 291
 		case 'Divi':
292 292
 			$classes[] = 'give-divi';
@@ -303,10 +303,10 @@  discard block
 block discarded – undo
303 303
 
304 304
 	}
305 305
 
306
-	return array_unique( $classes );
306
+	return array_unique($classes);
307 307
 }
308 308
 
309
-add_filter( 'body_class', 'give_add_body_classes' );
309
+add_filter('body_class', 'give_add_body_classes');
310 310
 
311 311
 
312 312
 /**
@@ -322,22 +322,22 @@  discard block
 block discarded – undo
322 322
  *
323 323
  * @return array
324 324
  */
325
-function give_add_post_class( $classes, $class = '', $post_id = '' ) {
326
-	if ( ! $post_id || 'give_forms' !== get_post_type( $post_id ) ) {
325
+function give_add_post_class($classes, $class = '', $post_id = '') {
326
+	if ( ! $post_id || 'give_forms' !== get_post_type($post_id)) {
327 327
 		return $classes;
328 328
 	}
329 329
 
330 330
 	//@TODO: Add classes for custom taxonomy and form configurations (multi vs single donations, etc).
331 331
 
332
-	if ( false !== ( $key = array_search( 'hentry', $classes ) ) ) {
333
-		unset( $classes[ $key ] );
332
+	if (false !== ($key = array_search('hentry', $classes))) {
333
+		unset($classes[$key]);
334 334
 	}
335 335
 
336 336
 	return $classes;
337 337
 }
338 338
 
339 339
 
340
-add_filter( 'post_class', 'give_add_post_class', 20, 3 );
340
+add_filter('post_class', 'give_add_post_class', 20, 3);
341 341
 
342 342
 /**
343 343
  * Get the placeholder image URL for forms etc
@@ -347,74 +347,74 @@  discard block
 block discarded – undo
347 347
  */
348 348
 function give_get_placeholder_img_src() {
349 349
 
350
-	$placeholder_url = '//placehold.it/600x600&text=' . urlencode( esc_attr__( 'Give Placeholder Image', 'give' ) );
350
+	$placeholder_url = '//placehold.it/600x600&text='.urlencode(esc_attr__('Give Placeholder Image', 'give'));
351 351
 
352
-	return apply_filters( 'give_placeholder_img_src', $placeholder_url );
352
+	return apply_filters('give_placeholder_img_src', $placeholder_url);
353 353
 }
354 354
 
355 355
 
356 356
 /**
357 357
  * Global
358 358
  */
359
-if ( ! function_exists( 'give_output_content_wrapper' ) ) {
359
+if ( ! function_exists('give_output_content_wrapper')) {
360 360
 
361 361
 	/**
362 362
 	 * Output the start of the page wrapper.
363 363
 	 */
364 364
 	function give_output_content_wrapper() {
365
-		give_get_template_part( 'global/wrapper-start' );
365
+		give_get_template_part('global/wrapper-start');
366 366
 	}
367 367
 }
368
-if ( ! function_exists( 'give_output_content_wrapper_end' ) ) {
368
+if ( ! function_exists('give_output_content_wrapper_end')) {
369 369
 
370 370
 	/**
371 371
 	 * Output the end of the page wrapper.
372 372
 	 */
373 373
 	function give_output_content_wrapper_end() {
374
-		give_get_template_part( 'global/wrapper-end' );
374
+		give_get_template_part('global/wrapper-end');
375 375
 	}
376 376
 }
377 377
 
378 378
 /**
379 379
  * Single Give Form
380 380
  */
381
-if ( ! function_exists( 'give_left_sidebar_pre_wrap' ) ) {
381
+if ( ! function_exists('give_left_sidebar_pre_wrap')) {
382 382
 	function give_left_sidebar_pre_wrap() {
383
-		echo apply_filters( 'give_left_sidebar_pre_wrap', '<div id="give-sidebar-left" class="give-sidebar give-single-form-sidebar-left">' );
383
+		echo apply_filters('give_left_sidebar_pre_wrap', '<div id="give-sidebar-left" class="give-sidebar give-single-form-sidebar-left">');
384 384
 	}
385 385
 }
386 386
 
387
-if ( ! function_exists( 'give_left_sidebar_post_wrap' ) ) {
387
+if ( ! function_exists('give_left_sidebar_post_wrap')) {
388 388
 	function give_left_sidebar_post_wrap() {
389
-		echo apply_filters( 'give_left_sidebar_post_wrap', '</div>' );
389
+		echo apply_filters('give_left_sidebar_post_wrap', '</div>');
390 390
 	}
391 391
 }
392 392
 
393
-if ( ! function_exists( 'give_get_forms_sidebar' ) ) {
393
+if ( ! function_exists('give_get_forms_sidebar')) {
394 394
 	function give_get_forms_sidebar() {
395
-		give_get_template_part( 'single-give-form/sidebar' );
395
+		give_get_template_part('single-give-form/sidebar');
396 396
 	}
397 397
 }
398 398
 
399
-if ( ! function_exists( 'give_show_form_images' ) ) {
399
+if ( ! function_exists('give_show_form_images')) {
400 400
 
401 401
 	/**
402 402
 	 * Output the donation form featured image.
403 403
 	 */
404 404
 	function give_show_form_images() {
405
-		if ( give_is_setting_enabled( give_get_option( 'form_featured_img' ) ) ) {
406
-			give_get_template_part( 'single-give-form/featured-image' );
405
+		if (give_is_setting_enabled(give_get_option('form_featured_img'))) {
406
+			give_get_template_part('single-give-form/featured-image');
407 407
 		}
408 408
 	}
409 409
 }
410 410
 
411
-if ( ! function_exists( 'give_template_single_title' ) ) {
411
+if ( ! function_exists('give_template_single_title')) {
412 412
 
413 413
 	/**
414 414
 	 * Output the form title.
415 415
 	 */
416 416
 	function give_template_single_title() {
417
-		give_get_template_part( 'single-give-form/title' );
417
+		give_get_template_part('single-give-form/title');
418 418
 	}
419 419
 }
420 420
 
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
  * Conditional Functions
423 423
  */
424 424
 
425
-if ( ! function_exists( 'is_give_form' ) ) {
425
+if ( ! function_exists('is_give_form')) {
426 426
 
427 427
 	/**
428 428
 	 * is_give_form
@@ -434,11 +434,11 @@  discard block
 block discarded – undo
434 434
 	 * @return bool
435 435
 	 */
436 436
 	function is_give_form() {
437
-		return is_singular( array( 'give_form' ) );
437
+		return is_singular(array('give_form'));
438 438
 	}
439 439
 }
440 440
 
441
-if ( ! function_exists( 'is_give_category' ) ) {
441
+if ( ! function_exists('is_give_category')) {
442 442
 
443 443
 	/**
444 444
 	 * is_give_category
@@ -453,12 +453,12 @@  discard block
 block discarded – undo
453 453
 	 *
454 454
 	 * @return bool
455 455
 	 */
456
-	function is_give_category( $term = '' ) {
457
-		return is_tax( 'give_forms_category', $term );
456
+	function is_give_category($term = '') {
457
+		return is_tax('give_forms_category', $term);
458 458
 	}
459 459
 }
460 460
 
461
-if ( ! function_exists( 'is_give_tag' ) ) {
461
+if ( ! function_exists('is_give_tag')) {
462 462
 
463 463
 	/**
464 464
 	 * is_give_tag
@@ -473,12 +473,12 @@  discard block
 block discarded – undo
473 473
 	 *
474 474
 	 * @return bool
475 475
 	 */
476
-	function is_give_tag( $term = '' ) {
477
-		return is_tax( 'give_forms_tag', $term );
476
+	function is_give_tag($term = '') {
477
+		return is_tax('give_forms_tag', $term);
478 478
 	}
479 479
 }
480 480
 
481
-if ( ! function_exists( 'is_give_taxonomy' ) ) {
481
+if ( ! function_exists('is_give_taxonomy')) {
482 482
 
483 483
 	/**
484 484
 	 * is_give_taxonomy
@@ -490,6 +490,6 @@  discard block
 block discarded – undo
490 490
 	 * @return bool
491 491
 	 */
492 492
 	function is_give_taxonomy() {
493
-		return is_tax( get_object_taxonomies( 'give_form' ) );
493
+		return is_tax(get_object_taxonomies('give_form'));
494 494
 	}
495 495
 }
Please login to merge, or discard this patch.
includes/admin/reports/class-give-graph.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly.
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -81,15 +81,15 @@  discard block
 block discarded – undo
81 81
 	 * @param array $_data
82 82
 	 * @param array $options
83 83
 	 */
84
-	public function __construct( $_data, $options = array() ) {
84
+	public function __construct($_data, $options = array()) {
85 85
 
86
-		$this->data      = $_data;
86
+		$this->data = $_data;
87 87
 
88 88
 		// Generate unique ID
89
-		$this->id = md5( rand() );
89
+		$this->id = md5(rand());
90 90
 
91 91
 		// Setup default options;
92
-		$this->options = apply_filters( 'give_graph_args', array(
92
+		$this->options = apply_filters('give_graph_args', array(
93 93
 			'y_mode'          => null,
94 94
 			'x_mode'          => null,
95 95
 			'y_decimals'      => 0,
@@ -107,9 +107,9 @@  discard block
 block discarded – undo
107 107
 			'lines'           => false,
108 108
 			'points'          => true,
109 109
 			'dataType'        => array()
110
-		) );
110
+		));
111 111
 
112
-		$this->options = wp_parse_args( $options, $this->options );
112
+		$this->options = wp_parse_args($options, $this->options);
113 113
 	}
114 114
 
115 115
 	/**
@@ -120,8 +120,8 @@  discard block
 block discarded – undo
120 120
 	 *
121 121
 	 * @since 1.0
122 122
 	 */
123
-	public function set( $key, $value ) {
124
-		$this->options[ $key ] = $value;
123
+	public function set($key, $value) {
124
+		$this->options[$key] = $value;
125 125
 	}
126 126
 
127 127
 	/**
@@ -131,8 +131,8 @@  discard block
 block discarded – undo
131 131
 	 *
132 132
 	 * @since 1.0
133 133
 	 */
134
-	public function get( $key ) {
135
-		return isset( $this->options[ $key ] ) ? $this->options[ $key ] : false;
134
+	public function get($key) {
135
+		return isset($this->options[$key]) ? $this->options[$key] : false;
136 136
 	}
137 137
 
138 138
 	/**
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 	 * @since 1.0
142 142
 	 */
143 143
 	public function get_data() {
144
-		return apply_filters( 'give_get_graph_data', $this->data, $this );
144
+		return apply_filters('give_get_graph_data', $this->data, $this);
145 145
 	}
146 146
 
147 147
 	/**
@@ -151,19 +151,19 @@  discard block
 block discarded – undo
151 151
 	 */
152 152
 	public function load_scripts() {
153 153
 		// Use minified libraries if SCRIPT_DEBUG is turned off
154
-		$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
154
+		$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
155 155
 
156
-		wp_register_script( 'jquery-flot-orderbars', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot.orderBars' . $suffix . '.js', array('jquery-flot'), GIVE_VERSION );
157
-		wp_enqueue_script( 'jquery-flot-orderbars' );
156
+		wp_register_script('jquery-flot-orderbars', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot.orderBars'.$suffix.'.js', array('jquery-flot'), GIVE_VERSION);
157
+		wp_enqueue_script('jquery-flot-orderbars');
158 158
 
159
-		wp_register_script( 'jquery-flot-time', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot.time' . $suffix . '.js', array('jquery-flot'), GIVE_VERSION );
160
-		wp_enqueue_script( 'jquery-flot-time' );
159
+		wp_register_script('jquery-flot-time', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot.time'.$suffix.'.js', array('jquery-flot'), GIVE_VERSION);
160
+		wp_enqueue_script('jquery-flot-time');
161 161
 
162
-		wp_register_script( 'jquery-flot-resize', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot.resize' . $suffix . '.js', array('jquery-flot'), GIVE_VERSION );
163
-		wp_enqueue_script( 'jquery-flot-resize' );
162
+		wp_register_script('jquery-flot-resize', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot.resize'.$suffix.'.js', array('jquery-flot'), GIVE_VERSION);
163
+		wp_enqueue_script('jquery-flot-resize');
164 164
 
165
-		wp_register_script( 'jquery-flot', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot' . $suffix . '.js', false, GIVE_VERSION );
166
-		wp_enqueue_script( 'jquery-flot' );
165
+		wp_register_script('jquery-flot', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot'.$suffix.'.js', false, GIVE_VERSION);
166
+		wp_enqueue_script('jquery-flot');
167 167
 
168 168
 	}
169 169
 
@@ -190,14 +190,14 @@  discard block
 block discarded – undo
190 190
 					[
191 191
 						<?php
192 192
 							$order = 0;
193
-							foreach( $this->get_data() as $label => $data ) :
193
+							foreach ($this->get_data() as $label => $data) :
194 194
 						?>
195 195
 						{
196
-							label : "<?php echo esc_attr( $label ); ?>",
197
-							id    : "<?php echo sanitize_key( $label ); ?>",
198
-							dataType  : '<?php echo ( ! empty( $this->options['dataType'][$order] ) ? $this->options['dataType'][$order] : 'count' ); ?>',
196
+							label : "<?php echo esc_attr($label); ?>",
197
+							id    : "<?php echo sanitize_key($label); ?>",
198
+							dataType  : '<?php echo ( ! empty($this->options['dataType'][$order]) ? $this->options['dataType'][$order] : 'count'); ?>',
199 199
 							// data format is: [ point on x, value on y ]
200
-							data  : [<?php foreach( $data as $point ) { echo '[' . implode( ',', $point ) . '],'; } ?>],
200
+							data  : [<?php foreach ($data as $point) { echo '['.implode(',', $point).'],'; } ?>],
201 201
 							points: {
202 202
 								show: <?php echo $this->options['points'] ? 'true' : 'false'; ?>,
203 203
 							},
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 								fill     : true,
213 213
 								fillColor: {colors: [{opacity: 0.4}, {opacity: 0.1}]}
214 214
 							},
215
-							<?php if( $this->options[ 'multiple_y_axes' ] ) : ?>
215
+							<?php if ($this->options['multiple_y_axes']) : ?>
216 216
 							yaxis : <?php echo $yaxis_count; ?>
217 217
 							<?php endif; ?>
218 218
 
@@ -226,10 +226,10 @@  discard block
 block discarded – undo
226 226
 						grid: {
227 227
 							show           : true,
228 228
 							aboveData      : false,
229
-							color          : "<?php echo $this->options[ 'color' ]; ?>",
230
-							backgroundColor: "<?php echo $this->options[ 'bgcolor' ]; ?>",
231
-							borderColor    : "<?php echo $this->options[ 'bordercolor' ]; ?>",
232
-							borderWidth    : <?php echo absint( $this->options[ 'borderwidth' ] ); ?>,
229
+							color          : "<?php echo $this->options['color']; ?>",
230
+							backgroundColor: "<?php echo $this->options['bgcolor']; ?>",
231
+							borderColor    : "<?php echo $this->options['bordercolor']; ?>",
232
+							borderWidth    : <?php echo absint($this->options['borderwidth']); ?>,
233 233
 							clickable      : false,
234 234
 							hoverable      : true
235 235
 						},
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 							mode        : "<?php echo $this->options['x_mode']; ?>",
241 241
 							timeFormat  : "<?php echo $this->options['x_mode'] == 'time' ? $this->options['time_format'] : ''; ?>",
242 242
 							tickSize    : "<?php echo $this->options['x_mode'] == 'time' ? '' : 1; ?>",
243
-							<?php if( $this->options['x_mode'] != 'time' ) : ?>
243
+							<?php if ($this->options['x_mode'] != 'time') : ?>
244 244
 							tickDecimals: <?php echo $this->options['x_decimals']; ?>
245 245
 							<?php endif; ?>
246 246
 						},
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 							min         : 0,
250 250
 							mode        : "<?php echo $this->options['y_mode']; ?>",
251 251
 							timeFormat  : "<?php echo $this->options['y_mode'] == 'time' ? $this->options['time_format'] : ''; ?>",
252
-							<?php if( $this->options['y_mode'] != 'time' ) : ?>
252
+							<?php if ($this->options['y_mode'] != 'time') : ?>
253 253
 							tickDecimals: <?php echo $this->options['y_decimals']; ?>,
254 254
 							<?php endif; ?>
255 255
 							tickFormatter: function(val) {
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 		 *
324 324
 		 * @param Give_Graph $this Graph object.
325 325
 		 */
326
-		do_action( 'give_before_graph', $this );
326
+		do_action('give_before_graph', $this);
327 327
 
328 328
 		// Build the graph.
329 329
 		echo $this->build_graph();
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
 		 *
336 336
 		 * @param Give_Graph $this Graph object.
337 337
 		 */
338
-		do_action( 'give_after_graph', $this );
338
+		do_action('give_after_graph', $this);
339 339
 	}
340 340
 
341 341
 }
Please login to merge, or discard this patch.
includes/admin/admin-filters.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@
 block discarded – undo
64 64
  *
65 65
  * @param   string $value
66 66
  *
67
- * @return  mixed
67
+ * @return  string
68 68
  */
69 69
 function __give_validate_decimal_separator_setting_field( $value ) {
70 70
 	$thousand_separator = give_clean( $_POST['thousands_separator'] );
Please login to merge, or discard this patch.
Spacing   +58 added lines, -58 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,20 +66,20 @@  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 );
82
+add_filter('give_admin_settings_sanitize_option_decimal_separator', '__give_validate_decimal_separator_setting_field', 10);
83 83
 
84 84
 /**
85 85
  * Change $delimiter text to symbol.
@@ -90,16 +90,16 @@  discard block
 block discarded – undo
90 90
  *
91 91
  * @return string $delimiter.
92 92
  */
93
-function __give_import_delimiter_set_callback( $delimiter ) {
93
+function __give_import_delimiter_set_callback($delimiter) {
94 94
 	$delimite_type = array(
95 95
 		'csv'                  => ",",
96 96
 		'tab-separated-values' => "\t",
97 97
 	);
98 98
 
99
-	return ( array_key_exists( $delimiter, $delimite_type ) ? $delimite_type[ $delimiter ] : "," );
99
+	return (array_key_exists($delimiter, $delimite_type) ? $delimite_type[$delimiter] : ",");
100 100
 }
101 101
 
102
-add_filter( 'give_import_delimiter_set', '__give_import_delimiter_set_callback', 10 );
102
+add_filter('give_import_delimiter_set', '__give_import_delimiter_set_callback', 10);
103 103
 
104 104
 /**
105 105
  * Give unset the page id from the core setting data from the json files.
@@ -111,17 +111,17 @@  discard block
 block discarded – undo
111 111
  *
112 112
  * @return array $json_to_array
113 113
  */
114
-function give_import_core_settings_merge_pages( $json_to_array, $type ) {
115
-	if ( 'merge' === $type ) {
116
-		unset( $json_to_array['success_page'] );
117
-		unset( $json_to_array['failure_page'] );
118
-		unset( $json_to_array['history_page'] );
114
+function give_import_core_settings_merge_pages($json_to_array, $type) {
115
+	if ('merge' === $type) {
116
+		unset($json_to_array['success_page']);
117
+		unset($json_to_array['failure_page']);
118
+		unset($json_to_array['history_page']);
119 119
 	}
120 120
 
121 121
 	return $json_to_array;
122 122
 }
123 123
 
124
-add_filter( 'give_import_core_settings_data', 'give_import_core_settings_merge_pages', 11, 2 );
124
+add_filter('give_import_core_settings_data', 'give_import_core_settings_merge_pages', 11, 2);
125 125
 
126 126
 /**
127 127
  * Give check the image size from the core setting data from the json files.
@@ -133,14 +133,14 @@  discard block
 block discarded – undo
133 133
  *
134 134
  * @return array $json_to_array
135 135
  */
136
-function give_import_core_settings_merge_image_size( $json_to_array, $type ) {
137
-	if ( 'merge' === $type ) {
136
+function give_import_core_settings_merge_image_size($json_to_array, $type) {
137
+	if ('merge' === $type) {
138 138
 		// Featured image sizes import under Display Options > Post Types > Featured Image Size.
139
-		if ( 'enabled' === $json_to_array['form_featured_img'] ) {
139
+		if ('enabled' === $json_to_array['form_featured_img']) {
140 140
 			$images_sizes = get_intermediate_image_sizes();
141 141
 
142
-			if ( ! in_array( $json_to_array['featured_image_size'], $images_sizes ) ) {
143
-				unset( $json_to_array['featured_image_size'] );
142
+			if ( ! in_array($json_to_array['featured_image_size'], $images_sizes)) {
143
+				unset($json_to_array['featured_image_size']);
144 144
 			}
145 145
 		}
146 146
 	}
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 	return $json_to_array;
149 149
 }
150 150
 
151
-add_filter( 'give_import_core_settings_data', 'give_import_core_settings_merge_image_size', 12, 2 );
151
+add_filter('give_import_core_settings_data', 'give_import_core_settings_merge_image_size', 12, 2);
152 152
 
153 153
 /**
154 154
  * Give upload the image logo from the core setting data from the json files.
@@ -160,24 +160,24 @@  discard block
 block discarded – undo
160 160
  *
161 161
  * @return array $json_to_array
162 162
  */
163
-function give_import_core_settings_merge_upload_image( $json_to_array, $type ) {
164
-	if ( 'merge' === $type ) {
163
+function give_import_core_settings_merge_upload_image($json_to_array, $type) {
164
+	if ('merge' === $type) {
165 165
 		// Emails > Email Settings > Logo.
166
-		if ( ! empty( $json_to_array['email_logo'] ) ) {
166
+		if ( ! empty($json_to_array['email_logo'])) {
167 167
 
168 168
 			// Need to require these files.
169
-			if ( ! function_exists( 'media_handle_upload' ) ) {
170
-				require_once( ABSPATH . 'wp-admin/includes/image.php' );
171
-				require_once( ABSPATH . 'wp-admin/includes/file.php' );
172
-				require_once( ABSPATH . 'wp-admin/includes/media.php' );
169
+			if ( ! function_exists('media_handle_upload')) {
170
+				require_once(ABSPATH.'wp-admin/includes/image.php');
171
+				require_once(ABSPATH.'wp-admin/includes/file.php');
172
+				require_once(ABSPATH.'wp-admin/includes/media.php');
173 173
 			}
174 174
 
175 175
 			$url     = $json_to_array['email_logo'];
176
-			$new_url = media_sideload_image( $url, 0, null, 'src' );
177
-			if ( ! is_wp_error( $new_url ) ) {
176
+			$new_url = media_sideload_image($url, 0, null, 'src');
177
+			if ( ! is_wp_error($new_url)) {
178 178
 				$json_to_array['email_logo'] = $new_url;
179 179
 			} else {
180
-				unset( $json_to_array['email_logo'] );
180
+				unset($json_to_array['email_logo']);
181 181
 			}
182 182
 		}
183 183
 	}
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 	return $json_to_array;
186 186
 }
187 187
 
188
-add_filter( 'give_import_core_settings_data', 'give_import_core_settings_merge_upload_image', 13, 2 );
188
+add_filter('give_import_core_settings_data', 'give_import_core_settings_merge_upload_image', 13, 2);
189 189
 
190 190
 /**
191 191
  * Give unset the license key from the core setting data from the json files.
@@ -197,12 +197,12 @@  discard block
 block discarded – undo
197 197
  *
198 198
  * @return array $json_to_array
199 199
  */
200
-function give_import_core_settings_merge_license_key( $json_to_array, $type ) {
201
-	if ( 'merge' === $type ) {
202
-		foreach ( $json_to_array as $key => $value ) {
203
-			$is_license_key = strpos( '_license_key', $key );
204
-			if ( ! empty( $is_license_key ) ) {
205
-				unset( $json_to_array[ $key ] );
200
+function give_import_core_settings_merge_license_key($json_to_array, $type) {
201
+	if ('merge' === $type) {
202
+		foreach ($json_to_array as $key => $value) {
203
+			$is_license_key = strpos('_license_key', $key);
204
+			if ( ! empty($is_license_key)) {
205
+				unset($json_to_array[$key]);
206 206
 			}
207 207
 		}
208 208
 	}
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 	return $json_to_array;
211 211
 }
212 212
 
213
-add_filter( 'give_import_core_settings_data', 'give_import_core_settings_merge_license_key', 14, 2 );
213
+add_filter('give_import_core_settings_data', 'give_import_core_settings_merge_license_key', 14, 2);
214 214
 
215 215
 /**
216 216
  * Give merge the json data and setting data.
@@ -223,16 +223,16 @@  discard block
 block discarded – undo
223 223
  *
224 224
  * @return array $json_to_array
225 225
  */
226
-function give_import_core_settings_merge_data( $json_to_array, $type, $host_give_options ) {
227
-	if ( 'merge' === $type ) {
228
-		$json_to_array_merge = array_merge( $host_give_options, $json_to_array );
226
+function give_import_core_settings_merge_data($json_to_array, $type, $host_give_options) {
227
+	if ('merge' === $type) {
228
+		$json_to_array_merge = array_merge($host_give_options, $json_to_array);
229 229
 		$json_to_array       = $json_to_array_merge;
230 230
 	}
231 231
 
232 232
 	return $json_to_array;
233 233
 }
234 234
 
235
-add_filter( 'give_import_core_settings_data', 'give_import_core_settings_merge_data', 1000, 3 );
235
+add_filter('give_import_core_settings_data', 'give_import_core_settings_merge_data', 1000, 3);
236 236
 
237 237
 /**
238 238
  * Backward Compatibility - Cleanup User Roles.
@@ -243,11 +243,11 @@  discard block
 block discarded – undo
243 243
  *
244 244
  * @return mixed
245 245
  */
246
-function give_bc_1817_cleanup_user_roles( $caps ){
246
+function give_bc_1817_cleanup_user_roles($caps) {
247 247
 
248 248
 	if (
249
-		! give_has_upgrade_completed( 'v1817_cleanup_user_roles' ) &&
250
-		! isset( $caps['view_give_payments'] )
249
+		! give_has_upgrade_completed('v1817_cleanup_user_roles') &&
250
+		! isset($caps['view_give_payments'])
251 251
 	) {
252 252
 		give_v1817_process_cleanup_user_roles();
253 253
 	}
@@ -255,4 +255,4 @@  discard block
 block discarded – undo
255 255
 	return $caps;
256 256
 }
257 257
 
258
-add_filter( 'user_has_cap', 'give_bc_1817_cleanup_user_roles' );
259 258
\ No newline at end of file
259
+add_filter('user_has_cap', 'give_bc_1817_cleanup_user_roles');
260 260
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/tools/import/class-give-import-donations.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
 
455 455
 		/**
456 456
 		 * @param $option_value
457
-		 * @param $value
457
+		 * @param boolean $value
458 458
 		 *
459 459
 		 * @return string
460 460
 		 */
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
544 544
 		 *
545 545
 		 * @since 1.8.14
546 546
 		 *
547
-		 * @param $file_id
547
+		 * @param integer $file_id
548 548
 		 *
549 549
 		 * @return bool|int
550 550
 		 */
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -871,8 +871,8 @@
 block discarded – undo
871 871
 		 */
872 872
 		private function is_donations_import_page() {
873 873
 			return 'import' === give_get_current_setting_tab() &&
874
-			       isset( $_GET['importer-type'] ) &&
875
-			       $this->importer_type === give_clean( $_GET['importer-type'] );
874
+				   isset( $_GET['importer-type'] ) &&
875
+				   $this->importer_type === give_clean( $_GET['importer-type'] );
876 876
 		}
877 877
 	}
878 878
 
Please login to merge, or discard this patch.
Spacing   +189 added lines, -195 removed lines patch added patch discarded remove patch
@@ -11,11 +11,11 @@  discard block
 block discarded – undo
11 11
  * @since       1.8.14
12 12
  */
13 13
 
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit; // Exit if accessed directly
16 16
 }
17 17
 
18
-if ( ! class_exists( 'Give_Import_Donations' ) ) {
18
+if ( ! class_exists('Give_Import_Donations')) {
19 19
 
20 20
 	/**
21 21
 	 * Give_Import_Donations.
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 		 * @access private
58 58
 		 */
59 59
 		private function __construct() {
60
-			self::$per_page  = ! empty( $_GET['per_page'] ) ? absint( $_GET['per_page'] ) : self::$per_page;
60
+			self::$per_page = ! empty($_GET['per_page']) ? absint($_GET['per_page']) : self::$per_page;
61 61
 		}
62 62
 
63 63
 		/**
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 		 * @return static
70 70
 		 */
71 71
 		public static function get_instance() {
72
-			if ( null === static::$instance ) {
72
+			if (null === static::$instance) {
73 73
 				self::$instance = new static();
74 74
 			}
75 75
 
@@ -96,27 +96,27 @@  discard block
 block discarded – undo
96 96
 		 * @return void
97 97
 		 */
98 98
 		private function setup_hooks() {
99
-			if ( ! $this->is_donations_import_page() ) {
99
+			if ( ! $this->is_donations_import_page()) {
100 100
 				return;
101 101
 			}
102 102
 
103 103
 			// Do not render main import tools page.
104
-			remove_action( 'give_admin_field_tools_import', array( 'Give_Settings_Import', 'render_import_field', ) );
104
+			remove_action('give_admin_field_tools_import', array('Give_Settings_Import', 'render_import_field',));
105 105
 
106 106
 
107 107
 			// Render donation import page
108
-			add_action( 'give_admin_field_tools_import', array( $this, 'render_page' ) );
108
+			add_action('give_admin_field_tools_import', array($this, 'render_page'));
109 109
 
110 110
 			// Print the HTML.
111
-			add_action( 'give_tools_import_donations_form_start', array( $this, 'html' ), 10 );
111
+			add_action('give_tools_import_donations_form_start', array($this, 'html'), 10);
112 112
 
113 113
 			// Run when form submit.
114
-			add_action( 'give-tools_save_import', array( $this, 'save' ) );
114
+			add_action('give-tools_save_import', array($this, 'save'));
115 115
 
116
-			add_action( 'give-tools_update_notices', array( $this, 'update_notices' ), 11, 1 );
116
+			add_action('give-tools_update_notices', array($this, 'update_notices'), 11, 1);
117 117
 
118 118
 			// Used to add submit button.
119
-			add_action( 'give_tools_import_donations_form_end', array( $this, 'submit' ), 10 );
119
+			add_action('give_tools_import_donations_form_end', array($this, 'submit'), 10);
120 120
 		}
121 121
 
122 122
 		/**
@@ -128,9 +128,9 @@  discard block
 block discarded – undo
128 128
 		 *
129 129
 		 * @return mixed
130 130
 		 */
131
-		public function update_notices( $messages ) {
132
-			if ( ! empty( $_GET['tab'] ) && 'import' === give_clean( $_GET['tab'] ) ) {
133
-				unset( $messages['give-setting-updated'] );
131
+		public function update_notices($messages) {
132
+			if ( ! empty($_GET['tab']) && 'import' === give_clean($_GET['tab'])) {
133
+				unset($messages['give-setting-updated']);
134 134
 			}
135 135
 
136 136
 			return $messages;
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 		 * @since 1.8.14
143 143
 		 */
144 144
 		public function submit() {
145
-			wp_nonce_field( 'give-save-settings', '_give-save-settings' );
145
+			wp_nonce_field('give-save-settings', '_give-save-settings');
146 146
 			?>
147 147
 			<input type="hidden" class="import-step" id="import-step" name="step" value="<?php echo $this->get_step(); ?>"/>
148 148
 			<input type="hidden" class="importer-type" value="<?php echo $this->importer_type; ?>"/>
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 				<table class="widefat export-options-table give-table <?php echo "step-{$step}"; ?>" id="<?php echo "step-{$step}"; ?>">
165 165
 					<tbody>
166 166
 						<?php
167
-						switch ( $this->get_step() ) {
167
+						switch ($this->get_step()) {
168 168
 							case 1:
169 169
 								$this->render_media_csv();
170 170
 								break;
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 								$this->import_success();
182 182
 						}
183 183
 
184
-						if ( false === $this->check_for_dropdown_or_import() ) {
184
+						if (false === $this->check_for_dropdown_or_import()) {
185 185
 							?>
186 186
 							<tr valign="top">
187 187
 								<th></th>
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 									<input type="submit"
190 190
 										   class="button button-primary button-large button-secondary <?php echo "step-{$step}"; ?>"
191 191
 										   id="recount-stats-submit"
192
-										   value="<?php esc_attr_e( 'Submit', 'give' ); ?>"/>
192
+										   value="<?php esc_attr_e('Submit', 'give'); ?>"/>
193 193
 								</th>
194 194
 							</tr>
195 195
 							<?php
@@ -208,56 +208,56 @@  discard block
 block discarded – undo
208 208
 		 */
209 209
 		public function import_success() {
210 210
 
211
-			$delete_csv = ( ! empty( $_GET['delete_csv'] ) ? absint( $_GET['delete_csv'] ) : false );
212
-			$csv        = ( ! empty( $_GET['csv'] ) ? absint( $_GET['csv'] ) : false );
213
-			if ( ! empty( $delete_csv ) && ! empty( $csv ) ) {
214
-				wp_delete_attachment( $csv, true );
211
+			$delete_csv = ( ! empty($_GET['delete_csv']) ? absint($_GET['delete_csv']) : false);
212
+			$csv        = ( ! empty($_GET['csv']) ? absint($_GET['csv']) : false);
213
+			if ( ! empty($delete_csv) && ! empty($csv)) {
214
+				wp_delete_attachment($csv, true);
215 215
 			}
216 216
 
217 217
 			$report      = give_import_donation_report();
218 218
 			$report_html = array(
219 219
 				'duplicate_donor'    => array(
220
-					__( '%s duplicate %s detected', 'give' ),
221
-					__( 'donor', 'give' ),
222
-					__( 'donors', 'give' ),
220
+					__('%s duplicate %s detected', 'give'),
221
+					__('donor', 'give'),
222
+					__('donors', 'give'),
223 223
 				),
224 224
 				'create_donor'       => array(
225
-					__( '%s %s created', 'give' ),
226
-					__( 'donor', 'give' ),
227
-					__( 'donors', 'give' ),
225
+					__('%s %s created', 'give'),
226
+					__('donor', 'give'),
227
+					__('donors', 'give'),
228 228
 				),
229 229
 				'create_form'        => array(
230
-					__( '%s donation %s created', 'give' ),
231
-					__( 'form', 'give' ),
232
-					__( 'forms', 'give' ),
230
+					__('%s donation %s created', 'give'),
231
+					__('form', 'give'),
232
+					__('forms', 'give'),
233 233
 				),
234 234
 				'duplicate_donation' => array(
235
-					__( '%s duplicate %s detected', 'give' ),
236
-					__( 'donation', 'give' ),
237
-					__( 'donations', 'give' ),
235
+					__('%s duplicate %s detected', 'give'),
236
+					__('donation', 'give'),
237
+					__('donations', 'give'),
238 238
 				),
239 239
 				'create_donation'    => array(
240
-					__( '%s %s imported', 'give' ),
241
-					__( 'donation', 'give' ),
242
-					__( 'donations', 'give' ),
240
+					__('%s %s imported', 'give'),
241
+					__('donation', 'give'),
242
+					__('donations', 'give'),
243 243
 				),
244 244
 			);
245
-			$total       = (int) $_GET['total'];
246
-			-- $total;
245
+			$total = (int) $_GET['total'];
246
+			--$total;
247 247
 			$success = (bool) $_GET['success'];
248 248
 			?>
249 249
 			<tr valign="top" class="give-import-dropdown">
250 250
 				<th colspan="2">
251 251
 					<h2>
252 252
 						<?php
253
-						if ( $success ) {
253
+						if ($success) {
254 254
 							echo sprintf(
255
-								__( 'Import complete! %s donations processed', 'give' ),
255
+								__('Import complete! %s donations processed', 'give'),
256 256
 								"<strong>{$total}</strong>"
257 257
 							);
258 258
 						} else {
259 259
 							echo sprintf(
260
-								__( 'Failed to import %s donations', 'give' ),
260
+								__('Failed to import %s donations', 'give'),
261 261
 								"<strong>{$total}</strong>"
262 262
 							);
263 263
 						}
@@ -265,25 +265,25 @@  discard block
 block discarded – undo
265 265
 					</h2>
266 266
 
267 267
 					<?php
268
-					$text      = __( 'Import Donation', 'give' );
268
+					$text      = __('Import Donation', 'give');
269 269
 					$query_arg = array(
270 270
 						'post_type' => 'give_forms',
271 271
 						'page'      => 'give-tools',
272 272
 						'tab'       => 'import',
273 273
 					);
274
-					if ( $success ) {
274
+					if ($success) {
275 275
 						$query_arg = array(
276 276
 							'post_type' => 'give_forms',
277 277
 							'page'      => 'give-payment-history',
278 278
 						);
279
-						$text      = __( 'View Donations', 'give' );
279
+						$text = __('View Donations', 'give');
280 280
 					}
281 281
 
282
-					foreach ( $report as $key => $value ) {
283
-						if ( array_key_exists( $key, $report_html ) && ! empty( $value ) ) {
282
+					foreach ($report as $key => $value) {
283
+						if (array_key_exists($key, $report_html) && ! empty($value)) {
284 284
 							?>
285 285
 							<p>
286
-								<?php echo esc_html( wp_sprintf( $report_html[ $key ][0], $value, _n( $report_html[ $key ][1], $report_html[ $key ][2], $value, 'give' ) ) ); ?>
286
+								<?php echo esc_html(wp_sprintf($report_html[$key][0], $value, _n($report_html[$key][1], $report_html[$key][2], $value, 'give'))); ?>
287 287
 							</p>
288 288
 							<?php
289 289
 						}
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
 					?>
292 292
 
293 293
 					<p>
294
-						<a class="button button-large button-secondary" href="<?php echo add_query_arg( $query_arg, admin_url( 'edit.php' ) ); ?>"><?php echo $text; ?></a>
294
+						<a class="button button-large button-secondary" href="<?php echo add_query_arg($query_arg, admin_url('edit.php')); ?>"><?php echo $text; ?></a>
295 295
 					</p>
296 296
 				</th>
297 297
 			</tr>
@@ -308,26 +308,26 @@  discard block
 block discarded – undo
308 308
 			give_import_donation_report_reset();
309 309
 
310 310
 			$csv         = (int) $_REQUEST['csv'];
311
-			$delimiter   = ( ! empty( $_REQUEST['delimiter'] ) ? give_clean( $_REQUEST['delimiter'] ) : 'csv' );
311
+			$delimiter   = ( ! empty($_REQUEST['delimiter']) ? give_clean($_REQUEST['delimiter']) : 'csv');
312 312
 			$index_start = 1;
313 313
 			$index_end   = 1;
314 314
 			$next        = true;
315
-			$total       = self::get_csv_total( $csv );
316
-			if ( self::$per_page < $total ) {
317
-				$total_ajax = ceil( $total / self::$per_page );
315
+			$total       = self::get_csv_total($csv);
316
+			if (self::$per_page < $total) {
317
+				$total_ajax = ceil($total / self::$per_page);
318 318
 				$index_end  = self::$per_page;
319 319
 			} else {
320 320
 				$total_ajax = 1;
321 321
 				$index_end  = $total;
322 322
 				$next       = false;
323 323
 			}
324
-			$current_percentage = 100 / ( $total_ajax + 1 );
324
+			$current_percentage = 100 / ($total_ajax + 1);
325 325
 
326 326
 			?>
327 327
 			<tr valign="top" class="give-import-dropdown">
328 328
 				<th colspan="2">
329
-					<h2 id="give-import-title"><?php esc_html_e( 'Importing', 'give' ) ?></h2>
330
-					<p class="give-field-description"><?php esc_html_e( 'Your donations are now being imported...', 'give' ) ?></p>
329
+					<h2 id="give-import-title"><?php esc_html_e('Importing', 'give') ?></h2>
330
+					<p class="give-field-description"><?php esc_html_e('Your donations are now being imported...', 'give') ?></p>
331 331
 				</th>
332 332
 			</tr>
333 333
 
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
 						<div style="width: <?php echo $current_percentage; ?>%"></div>
347 347
 					</div>
348 348
 					<input type="hidden" value="3" name="step">
349
-					<input type="hidden" value='<?php echo maybe_serialize( $_REQUEST['mapto'] ); ?>' name="mapto"
349
+					<input type="hidden" value='<?php echo maybe_serialize($_REQUEST['mapto']); ?>' name="mapto"
350 350
 						   class="mapto">
351 351
 					<input type="hidden" value="<?php echo $_REQUEST['csv']; ?>" name="csv" class="csv">
352 352
 					<input type="hidden" value="<?php echo $_REQUEST['mode']; ?>" name="mode" class="mode">
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
 					<input type="hidden" value="<?php echo $_REQUEST['delete_csv']; ?>" name="delete_csv"
356 356
 						   class="delete_csv">
357 357
 					<input type="hidden" value="<?php echo $delimiter; ?>" name="delimiter">
358
-					<input type="hidden" value='<?php echo maybe_serialize( self::get_importer( $csv, 0, $delimiter ) ); ?>'
358
+					<input type="hidden" value='<?php echo maybe_serialize(self::get_importer($csv, 0, $delimiter)); ?>'
359 359
 						   name="main_key"
360 360
 						   class="main_key">
361 361
 				</th>
@@ -376,20 +376,20 @@  discard block
 block discarded – undo
376 376
 		 */
377 377
 		public function check_for_dropdown_or_import() {
378 378
 			$return = true;
379
-			if ( isset( $_REQUEST['mapto'] ) ) {
379
+			if (isset($_REQUEST['mapto'])) {
380 380
 				$mapto = (array) $_REQUEST['mapto'];
381
-				if ( false === in_array( 'form_title', $mapto ) && false === in_array( 'form_id', $mapto ) ) {
382
-					Give_Admin_Settings::add_error( 'give-import-csv-form', __( 'In order to import donations, a column must be mapped to either the "Donation Form Title" or "Donation Form ID" field. Please map a column to one of those fields.', 'give' ) );
381
+				if (false === in_array('form_title', $mapto) && false === in_array('form_id', $mapto)) {
382
+					Give_Admin_Settings::add_error('give-import-csv-form', __('In order to import donations, a column must be mapped to either the "Donation Form Title" or "Donation Form ID" field. Please map a column to one of those fields.', 'give'));
383 383
 					$return = false;
384 384
 				}
385 385
 
386
-				if ( false === in_array( 'amount', $mapto ) ) {
387
-					Give_Admin_Settings::add_error( 'give-import-csv-amount', __( 'In order to import donations, a column must be mapped to the "Amount" field. Please map a column to that field.', 'give' ) );
386
+				if (false === in_array('amount', $mapto)) {
387
+					Give_Admin_Settings::add_error('give-import-csv-amount', __('In order to import donations, a column must be mapped to the "Amount" field. Please map a column to that field.', 'give'));
388 388
 					$return = false;
389 389
 				}
390 390
 
391
-				if ( false === in_array( 'email', $mapto ) && false === in_array( 'donor_id', $mapto ) ) {
392
-					Give_Admin_Settings::add_error( 'give-import-csv-donor', __( 'In order to import donations, a column must be mapped to either the "Donor Email" or "Donor ID" field. Please map a column to that field.', 'give' ) );
391
+				if (false === in_array('email', $mapto) && false === in_array('donor_id', $mapto)) {
392
+					Give_Admin_Settings::add_error('give-import-csv-donor', __('In order to import donations, a column must be mapped to either the "Donor Email" or "Donor ID" field. Please map a column to that field.', 'give'));
393 393
 					$return = false;
394 394
 				}
395 395
 			} else {
@@ -406,10 +406,10 @@  discard block
 block discarded – undo
406 406
 		 */
407 407
 		public function render_dropdown() {
408 408
 			$csv       = (int) $_GET['csv'];
409
-			$delimiter = ( ! empty( $_GET['delimiter'] ) ? give_clean( $_GET['delimiter'] ) : 'csv' );
409
+			$delimiter = ( ! empty($_GET['delimiter']) ? give_clean($_GET['delimiter']) : 'csv');
410 410
 
411 411
 			// TO check if the CSV files that is being add is valid or not if not then redirect to first step again
412
-			if ( ! $this->is_valid_csv( $csv ) ) {
412
+			if ( ! $this->is_valid_csv($csv)) {
413 413
 				$url = give_import_page_url();
414 414
 				?>
415 415
 				<script type="text/javascript">
@@ -420,27 +420,27 @@  discard block
 block discarded – undo
420 420
 				?>
421 421
 				<tr valign="top" class="give-import-dropdown">
422 422
 					<th colspan="2">
423
-						<h2 id="give-import-title"><?php esc_html_e( 'Map CSV fields to donations', 'give' ) ?></h2>
424
-						<p class="give-field-description"><?php esc_html_e( 'Select fields from your CSV file to map against donations fields or to ignore during import.', 'give' ) ?></p>
423
+						<h2 id="give-import-title"><?php esc_html_e('Map CSV fields to donations', 'give') ?></h2>
424
+						<p class="give-field-description"><?php esc_html_e('Select fields from your CSV file to map against donations fields or to ignore during import.', 'give') ?></p>
425 425
 					</th>
426 426
 				</tr>
427 427
 
428 428
 				<tr valign="top" class="give-import-dropdown">
429
-					<th><b><?php esc_html_e( 'Column name', 'give' ); ?></b></th>
430
-					<th><b><?php esc_html_e( 'Map to field', 'give' ); ?></b></th>
429
+					<th><b><?php esc_html_e('Column name', 'give'); ?></b></th>
430
+					<th><b><?php esc_html_e('Map to field', 'give'); ?></b></th>
431 431
 				</tr>
432 432
 
433 433
 				<?php
434
-				$raw_key   = $this->get_importer( $csv, 0, $delimiter );
435
-				$mapto     = (array) ( isset( $_REQUEST['mapto'] ) ? $_REQUEST['mapto'] : array() );
434
+				$raw_key   = $this->get_importer($csv, 0, $delimiter);
435
+				$mapto     = (array) (isset($_REQUEST['mapto']) ? $_REQUEST['mapto'] : array());
436 436
 
437
-				foreach ( $raw_key as $index => $value ) {
437
+				foreach ($raw_key as $index => $value) {
438 438
 					?>
439 439
 					<tr valign="top" class="give-import-option">
440 440
 						<th><?php echo $value; ?></th>
441 441
 						<th>
442 442
 							<?php
443
-							$this->get_columns( $index, $value, $mapto );
443
+							$this->get_columns($index, $value, $mapto);
444 444
 							?>
445 445
 						</th>
446 446
 					</tr>
@@ -455,14 +455,14 @@  discard block
 block discarded – undo
455 455
 		 *
456 456
 		 * @return string
457 457
 		 */
458
-		public function selected( $option_value, $value ) {
459
-			$option_value = strtolower( $option_value );
460
-			$value = strtolower( $value );
458
+		public function selected($option_value, $value) {
459
+			$option_value = strtolower($option_value);
460
+			$value = strtolower($value);
461 461
 
462 462
 			$selected = '';
463
-			if ( stristr( $value, $option_value ) ) {
463
+			if (stristr($value, $option_value)) {
464 464
 				$selected = 'selected';
465
-			} elseif ( strrpos( $value, '_' ) && stristr( $option_value, __( 'Import as Meta', 'give' ) ) ) {
465
+			} elseif (strrpos($value, '_') && stristr($option_value, __('Import as Meta', 'give'))) {
466 466
 				$selected = 'selected';
467 467
 			}
468 468
 
@@ -481,28 +481,28 @@  discard block
 block discarded – undo
481 481
 		 *
482 482
 		 * @return void
483 483
 		 */
484
-		private function get_columns( $index, $value = false, $mapto = array() ) {
484
+		private function get_columns($index, $value = false, $mapto = array()) {
485 485
 			$default       = give_import_default_options();
486
-			$current_mapto = (string) ( ! empty( $mapto[ $index ] ) ? $mapto[ $index ] : '' );
486
+			$current_mapto = (string) ( ! empty($mapto[$index]) ? $mapto[$index] : '');
487 487
 			?>
488 488
 			<select name="mapto[<?php echo $index; ?>]">
489
-				<?php $this->get_dropdown_option_html( $default, $current_mapto, $value ); ?>
489
+				<?php $this->get_dropdown_option_html($default, $current_mapto, $value); ?>
490 490
 
491
-				<optgroup label="<?php _e( 'Donations', 'give' ); ?>">
491
+				<optgroup label="<?php _e('Donations', 'give'); ?>">
492 492
 					<?php
493
-					$this->get_dropdown_option_html( give_import_donations_options(), $current_mapto, $value );
493
+					$this->get_dropdown_option_html(give_import_donations_options(), $current_mapto, $value);
494 494
 					?>
495 495
 				</optgroup>
496 496
 
497
-				<optgroup label="<?php _e( 'Donors', 'give' ); ?>">
497
+				<optgroup label="<?php _e('Donors', 'give'); ?>">
498 498
 					<?php
499
-					$this->get_dropdown_option_html( give_import_donor_options(), $current_mapto, $value );
499
+					$this->get_dropdown_option_html(give_import_donor_options(), $current_mapto, $value);
500 500
 					?>
501 501
 				</optgroup>
502 502
 
503
-				<optgroup label="<?php _e( 'Forms', 'give' ); ?>">
503
+				<optgroup label="<?php _e('Forms', 'give'); ?>">
504 504
 					<?php
505
-					$this->get_dropdown_option_html( give_import_donation_form_options(), $current_mapto, $value );
505
+					$this->get_dropdown_option_html(give_import_donation_form_options(), $current_mapto, $value);
506 506
 					?>
507 507
 				</optgroup>
508 508
 
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
 				 *
514 514
 				 * @since 1.8.15
515 515
 				 */
516
-				do_action( 'give_import_dropdown_option', $index, $value, $mapto, $current_mapto );
516
+				do_action('give_import_dropdown_option', $index, $value, $mapto, $current_mapto);
517 517
 				?>
518 518
 			</select>
519 519
 			<?php
@@ -531,16 +531,16 @@  discard block
 block discarded – undo
531 531
 		 *
532 532
 		 * @return void
533 533
 		 */
534
-		public function get_dropdown_option_html( $options, $current_mapto, $value = false ) {
535
-			foreach ( $options as $option => $option_value ) {
534
+		public function get_dropdown_option_html($options, $current_mapto, $value = false) {
535
+			foreach ($options as $option => $option_value) {
536 536
 				$option_value_texts = (array) $option_value;
537 537
 				$option_text = $option_value_texts[0];
538 538
 
539
-				$checked = ( ( $current_mapto === $option ) ? 'selected' : false );
540
-				if ( empty( $checked ) ) {
541
-					foreach ( $option_value_texts as $option_value_text ) {
542
-						$checked = $this->selected( $option_value_text, $value );
543
-						if ( $checked ) {
539
+				$checked = (($current_mapto === $option) ? 'selected' : false);
540
+				if (empty($checked)) {
541
+					foreach ($option_value_texts as $option_value_text) {
542
+						$checked = $this->selected($option_value_text, $value);
543
+						if ($checked) {
544 544
 							break;
545 545
 						}
546 546
 					}
@@ -564,13 +564,13 @@  discard block
 block discarded – undo
564 564
 		 *
565 565
 		 * @return bool|int
566 566
 		 */
567
-		public function get_csv_total( $file_id ) {
567
+		public function get_csv_total($file_id) {
568 568
 			$total = false;
569
-			if ( $file_id ) {
570
-				$file_dir = get_attached_file( $file_id );
571
-				if ( $file_dir ) {
572
-					$file = new SplFileObject( $file_dir, 'r' );
573
-					$file->seek( PHP_INT_MAX );
569
+			if ($file_id) {
570
+				$file_dir = get_attached_file($file_id);
571
+				if ($file_dir) {
572
+					$file = new SplFileObject($file_dir, 'r');
573
+					$file->seek(PHP_INT_MAX);
574 574
 					$total = $file->key() + 1;
575 575
 				}
576 576
 			}
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
 		 *
590 590
 		 * @return array|bool $raw_data title of the CSV file fields
591 591
 		 */
592
-		public function get_importer( $file_id, $index = 0, $delimiter = 'csv' ) {
592
+		public function get_importer($file_id, $index = 0, $delimiter = 'csv') {
593 593
 			/**
594 594
 			 * Filter to modify delimiter of Import.
595 595
 			 *
@@ -597,16 +597,16 @@  discard block
 block discarded – undo
597 597
 			 *
598 598
 			 * Return string $delimiter.
599 599
 			 */
600
-			$delimiter = (string) apply_filters( 'give_import_delimiter_set', $delimiter );
600
+			$delimiter = (string) apply_filters('give_import_delimiter_set', $delimiter);
601 601
 
602 602
 			$raw_data = false;
603
-			$file_dir = get_attached_file( $file_id );
604
-			if ( $file_dir ) {
605
-				if ( false !== ( $handle = fopen( $file_dir, 'r' ) ) ) {
606
-					$raw_data = fgetcsv( $handle, $index, $delimiter );
603
+			$file_dir = get_attached_file($file_id);
604
+			if ($file_dir) {
605
+				if (false !== ($handle = fopen($file_dir, 'r'))) {
606
+					$raw_data = fgetcsv($handle, $index, $delimiter);
607 607
 					// Remove BOM signature from the first item.
608
-					if ( isset( $raw_data[0] ) ) {
609
-						$raw_data[0] = $this->remove_utf8_bom( $raw_data[0] );
608
+					if (isset($raw_data[0])) {
609
+						$raw_data[0] = $this->remove_utf8_bom($raw_data[0]);
610 610
 					}
611 611
 				}
612 612
 			}
@@ -623,9 +623,9 @@  discard block
 block discarded – undo
623 623
 		 *
624 624
 		 * @return string
625 625
 		 */
626
-		public function remove_utf8_bom( $string ) {
627
-			if ( 'efbbbf' === substr( bin2hex( $string ), 0, 6 ) ) {
628
-				$string = substr( $string, 3 );
626
+		public function remove_utf8_bom($string) {
627
+			if ('efbbbf' === substr(bin2hex($string), 0, 6)) {
628
+				$string = substr($string, 3);
629 629
 			}
630 630
 
631 631
 			return $string;
@@ -641,17 +641,17 @@  discard block
 block discarded – undo
641 641
 			$step = $this->get_step();
642 642
 			?>
643 643
 			<ol class="give-progress-steps">
644
-				<li class="<?php echo( 1 === $step ? 'active' : '' ); ?>">
645
-					<?php esc_html_e( 'Upload CSV file', 'give' ); ?>
644
+				<li class="<?php echo(1 === $step ? 'active' : ''); ?>">
645
+					<?php esc_html_e('Upload CSV file', 'give'); ?>
646 646
 				</li>
647
-				<li class="<?php echo( 2 === $step ? 'active' : '' ); ?>">
648
-					<?php esc_html_e( 'Column mapping', 'give' ); ?>
647
+				<li class="<?php echo(2 === $step ? 'active' : ''); ?>">
648
+					<?php esc_html_e('Column mapping', 'give'); ?>
649 649
 				</li>
650
-				<li class="<?php echo( 3 === $step ? 'active' : '' ); ?>">
651
-					<?php esc_html_e( 'Import', 'give' ); ?>
650
+				<li class="<?php echo(3 === $step ? 'active' : ''); ?>">
651
+					<?php esc_html_e('Import', 'give'); ?>
652 652
 				</li>
653
-				<li class="<?php echo( 4 === $step ? 'active' : '' ); ?>">
654
-					<?php esc_html_e( 'Done!', 'give' ); ?>
653
+				<li class="<?php echo(4 === $step ? 'active' : ''); ?>">
654
+					<?php esc_html_e('Done!', 'give'); ?>
655 655
 				</li>
656 656
 			</ol>
657 657
 			<?php
@@ -665,16 +665,16 @@  discard block
 block discarded – undo
665 665
 		 * @return int $step on which step doest the import is on.
666 666
 		 */
667 667
 		public function get_step() {
668
-			$step    = (int) ( isset( $_REQUEST['step'] ) ? give_clean( $_REQUEST['step'] ) : 0 );
668
+			$step    = (int) (isset($_REQUEST['step']) ? give_clean($_REQUEST['step']) : 0);
669 669
 			$on_step = 1;
670 670
 
671
-			if ( empty( $step ) || 1 === $step ) {
671
+			if (empty($step) || 1 === $step) {
672 672
 				$on_step = 1;
673
-			} elseif ( $this->check_for_dropdown_or_import() ) {
673
+			} elseif ($this->check_for_dropdown_or_import()) {
674 674
 				$on_step = 3;
675
-			} elseif ( 2 === $step ) {
675
+			} elseif (2 === $step) {
676 676
 				$on_step = 2;
677
-			} elseif ( 4 === $step ) {
677
+			} elseif (4 === $step) {
678 678
 				$on_step = 4;
679 679
 			}
680 680
 
@@ -687,7 +687,7 @@  discard block
 block discarded – undo
687 687
 		 * @since 1.8.14
688 688
 		 */
689 689
 		public function render_page() {
690
-			include_once GIVE_PLUGIN_DIR . 'includes/admin/tools/views/html-admin-page-import-donations.php';
690
+			include_once GIVE_PLUGIN_DIR.'includes/admin/tools/views/html-admin-page-import-donations.php';
691 691
 		}
692 692
 
693 693
 		/**
@@ -702,37 +702,34 @@  discard block
 block discarded – undo
702 702
 			?>
703 703
 			<tr valign="top">
704 704
 				<th colspan="2">
705
-					<h2 id="give-import-title"><?php esc_html_e( 'Import donations from a CSV file', 'give' ) ?></h2>
706
-					<p class="give-field-description"><?php esc_html_e( 'This tool allows you to import or add donation data to your give form(s) via a CSV file.', 'give' ) ?></p>
705
+					<h2 id="give-import-title"><?php esc_html_e('Import donations from a CSV file', 'give') ?></h2>
706
+					<p class="give-field-description"><?php esc_html_e('This tool allows you to import or add donation data to your give form(s) via a CSV file.', 'give') ?></p>
707 707
 				</th>
708 708
 			</tr>
709 709
 			<?php
710
-			$csv         = ( isset( $_POST['csv'] ) ? give_clean( $_POST['csv'] ) : '' );
711
-			$csv_id      = ( isset( $_POST['csv_id'] ) ? give_clean( $_POST['csv_id'] ) : '' );
712
-			$delimiter   = ( isset( $_POST['delimiter'] ) ? give_clean( $_POST['delimiter'] ) : 'csv' );
713
-			$mode        = empty( $_POST['mode'] ) ?
714
-				'disabled' :
715
-				( give_is_setting_enabled( give_clean( $_POST['mode'] ) ) ? 'enabled' : 'disabled' );
716
-			$create_user = empty( $_POST['create_user'] ) ?
717
-				'enabled' :
718
-				( give_is_setting_enabled( give_clean( $_POST['create_user'] ) ) ? 'enabled' : 'disabled' );
719
-			$delete_csv  = empty( $_POST['delete_csv'] ) ?
720
-				'enabled' :
721
-				( give_is_setting_enabled( give_clean( $_POST['delete_csv'] ) ) ? 'enabled' : 'disabled' );
710
+			$csv         = (isset($_POST['csv']) ? give_clean($_POST['csv']) : '');
711
+			$csv_id      = (isset($_POST['csv_id']) ? give_clean($_POST['csv_id']) : '');
712
+			$delimiter   = (isset($_POST['delimiter']) ? give_clean($_POST['delimiter']) : 'csv');
713
+			$mode        = empty($_POST['mode']) ?
714
+				'disabled' : (give_is_setting_enabled(give_clean($_POST['mode'])) ? 'enabled' : 'disabled');
715
+			$create_user = empty($_POST['create_user']) ?
716
+				'enabled' : (give_is_setting_enabled(give_clean($_POST['create_user'])) ? 'enabled' : 'disabled');
717
+			$delete_csv  = empty($_POST['delete_csv']) ?
718
+				'enabled' : (give_is_setting_enabled(give_clean($_POST['delete_csv'])) ? 'enabled' : 'disabled');
722 719
 
723 720
 			// Reset csv and csv_id if csv
724
-			if ( empty( $csv_id ) || ! $this->is_valid_csv( $csv_id, $csv ) ) {
721
+			if (empty($csv_id) || ! $this->is_valid_csv($csv_id, $csv)) {
725 722
 				$csv_id = $csv = '';
726 723
 			}
727
-			$per_page = isset( $_POST['per_page'] ) ? absint( $_POST['per_page'] ) : self::$per_page;
724
+			$per_page = isset($_POST['per_page']) ? absint($_POST['per_page']) : self::$per_page;
728 725
 
729 726
 			$settings = array(
730 727
 				array(
731 728
 					'id'          => 'csv',
732
-					'name'        => __( 'Choose a CSV file:', 'give' ),
729
+					'name'        => __('Choose a CSV file:', 'give'),
733 730
 					'type'        => 'file',
734
-					'attributes'  => array( 'editing' => 'false', 'library' => 'text' ),
735
-					'description' => __( 'The file must be a Comma Seperated Version (CSV) file type only.', 'give' ),
731
+					'attributes'  => array('editing' => 'false', 'library' => 'text'),
732
+					'description' => __('The file must be a Comma Seperated Version (CSV) file type only.', 'give'),
736 733
 					'fvalue'      => 'url',
737 734
 					'default'     => $csv,
738 735
 				),
@@ -743,61 +740,61 @@  discard block
 block discarded – undo
743 740
 				),
744 741
 				array(
745 742
 					'id'          => 'delimiter',
746
-					'name'        => __( 'CSV Delimiter:', 'give' ),
747
-					'description' => __( 'In case your CSV file supports a different type of separator (or delimiter) -- like a tab or space -- you can set that here.', 'give' ),
743
+					'name'        => __('CSV Delimiter:', 'give'),
744
+					'description' => __('In case your CSV file supports a different type of separator (or delimiter) -- like a tab or space -- you can set that here.', 'give'),
748 745
 					'default'     => $delimiter,
749 746
 					'type'        => 'select',
750 747
 					'options'     => array(
751
-						'csv'                  => esc_html__( 'Comma', 'give' ),
752
-						'tab-separated-values' => esc_html__( 'Tab', 'give' ),
748
+						'csv'                  => esc_html__('Comma', 'give'),
749
+						'tab-separated-values' => esc_html__('Tab', 'give'),
753 750
 					),
754 751
 				),
755 752
 				array(
756 753
 					'id'          => 'mode',
757
-					'name'        => __( 'Test Mode:', 'give' ),
758
-					'description' => __( 'Test mode allows you to preview what this import would look like without making any actual changes to your site or your database.', 'give' ),
754
+					'name'        => __('Test Mode:', 'give'),
755
+					'description' => __('Test mode allows you to preview what this import would look like without making any actual changes to your site or your database.', 'give'),
759 756
 					'default'     => $mode,
760 757
 					'type'        => 'radio_inline',
761 758
 					'options'     => array(
762
-						'enabled'  => __( 'Enabled', 'give' ),
763
-						'disabled' => __( 'Disabled', 'give' ),
759
+						'enabled'  => __('Enabled', 'give'),
760
+						'disabled' => __('Disabled', 'give'),
764 761
 					),
765 762
 				),
766 763
 				array(
767 764
 					'id'          => 'create_user',
768
-					'name'        => __( 'Create WP users for new donors:', 'give' ),
769
-					'description' => __( 'The importer can create WordPress user accounts based on the names and email addresses of the donations in your CSV file. Enable this option if you\'d like the importer to do that.', 'give' ),
765
+					'name'        => __('Create WP users for new donors:', 'give'),
766
+					'description' => __('The importer can create WordPress user accounts based on the names and email addresses of the donations in your CSV file. Enable this option if you\'d like the importer to do that.', 'give'),
770 767
 					'default'     => $create_user,
771 768
 					'type'        => 'radio_inline',
772 769
 					'options'     => array(
773
-						'enabled'  => __( 'Enabled', 'give' ),
774
-						'disabled' => __( 'Disabled', 'give' ),
770
+						'enabled'  => __('Enabled', 'give'),
771
+						'disabled' => __('Disabled', 'give'),
775 772
 					),
776 773
 				),
777 774
 				array(
778 775
 					'id'          => 'delete_csv',
779
-					'name'        => __( 'Delete CSV after import:', 'give' ),
780
-					'description' => __( 'Your CSV file will be uploaded via the WordPress Media Library. It\'s a good idea to delete it after the import is finished so that your sensitive data is not accessible on the web. Disable this only if you plan to delete the file manually later.', 'give' ),
776
+					'name'        => __('Delete CSV after import:', 'give'),
777
+					'description' => __('Your CSV file will be uploaded via the WordPress Media Library. It\'s a good idea to delete it after the import is finished so that your sensitive data is not accessible on the web. Disable this only if you plan to delete the file manually later.', 'give'),
781 778
 					'default'     => $delete_csv,
782 779
 					'type'        => 'radio_inline',
783 780
 					'options'     => array(
784
-						'enabled'  => __( 'Enabled', 'give' ),
785
-						'disabled' => __( 'Disabled', 'give' ),
781
+						'enabled'  => __('Enabled', 'give'),
782
+						'disabled' => __('Disabled', 'give'),
786 783
 					),
787 784
 				),
788 785
 				array(
789 786
 					'id'          => 'per_page',
790
-					'name'        => __( 'Process Rows Per Batch:', 'give' ),
787
+					'name'        => __('Process Rows Per Batch:', 'give'),
791 788
 					'type'        => 'number',
792
-					'description' => __( 'Determine how many rows you would like to import per cycle.', 'give' ),
789
+					'description' => __('Determine how many rows you would like to import per cycle.', 'give'),
793 790
 					'default'     => $per_page,
794 791
 					'class'       => 'give-text-small',
795 792
 				),
796 793
 			);
797 794
 
798
-			$settings = apply_filters( 'give_import_file_upload_html', $settings );
795
+			$settings = apply_filters('give_import_file_upload_html', $settings);
799 796
 
800
-			Give_Admin_Settings::output_fields( $settings, 'give_settings' );
797
+			Give_Admin_Settings::output_fields($settings, 'give_settings');
801 798
 		}
802 799
 
803 800
 		/**
@@ -810,27 +807,24 @@  discard block
 block discarded – undo
810 807
 			$step = $this->get_step();
811 808
 
812 809
 			// Validation for first step.
813
-			if ( 1 === $step ) {
814
-				$csv_id = absint( $_POST['csv_id'] );
810
+			if (1 === $step) {
811
+				$csv_id = absint($_POST['csv_id']);
815 812
 
816
-				if ( $this->is_valid_csv( $csv_id, esc_url( $_POST['csv'] ) ) ) {
813
+				if ($this->is_valid_csv($csv_id, esc_url($_POST['csv']))) {
817 814
 
818
-					$url = give_import_page_url( (array) apply_filters( 'give_import_step_two_url', array(
815
+					$url = give_import_page_url((array) apply_filters('give_import_step_two_url', array(
819 816
 						'step'          => '2',
820 817
 						'importer-type' => $this->importer_type,
821 818
 						'csv'           => $csv_id,
822
-						'delimiter'     => isset( $_REQUEST['delimiter'] ) ? give_clean( $_REQUEST['delimiter'] ) : 'csv',
823
-						'mode'          => empty( $_POST['mode'] ) ?
824
-							'0' :
825
-							( give_is_setting_enabled( give_clean( $_POST['mode'] ) ) ? '1' : '0' ),
826
-						'create_user'   => empty( $_POST['create_user'] ) ?
827
-							'0' :
828
-							( give_is_setting_enabled( give_clean( $_POST['create_user'] ) ) ? '1' : '0' ),
829
-						'delete_csv'    => empty( $_POST['delete_csv'] ) ?
830
-							'1' :
831
-							( give_is_setting_enabled( give_clean( $_POST['delete_csv'] ) ) ? '1' : '0' ),
832
-						'per_page'      => isset( $_POST['per_page'] ) ? absint( $_POST['per_page'] ) : self::$per_page,
833
-					) ) );
819
+						'delimiter'     => isset($_REQUEST['delimiter']) ? give_clean($_REQUEST['delimiter']) : 'csv',
820
+						'mode'          => empty($_POST['mode']) ?
821
+							'0' : (give_is_setting_enabled(give_clean($_POST['mode'])) ? '1' : '0'),
822
+						'create_user'   => empty($_POST['create_user']) ?
823
+							'0' : (give_is_setting_enabled(give_clean($_POST['create_user'])) ? '1' : '0'),
824
+						'delete_csv'    => empty($_POST['delete_csv']) ?
825
+							'1' : (give_is_setting_enabled(give_clean($_POST['delete_csv'])) ? '1' : '0'),
826
+						'per_page'      => isset($_POST['per_page']) ? absint($_POST['per_page']) : self::$per_page,
827
+					)));
834 828
 					?>
835 829
 					<script type="text/javascript">
836 830
 						window.location = "<?php echo $url; ?>"
@@ -851,25 +845,25 @@  discard block
 block discarded – undo
851 845
 		 *
852 846
 		 * @return bool $has_error CSV is valid or not.
853 847
 		 */
854
-		private function is_valid_csv( $csv = false, $match_url = '' ) {
848
+		private function is_valid_csv($csv = false, $match_url = '') {
855 849
 			$is_valid_csv = true;
856 850
 
857
-			if ( $csv ) {
858
-				$csv_url = wp_get_attachment_url( $csv );
851
+			if ($csv) {
852
+				$csv_url = wp_get_attachment_url($csv);
859 853
 
860
-				$delimiter = ( ! empty( $_REQUEST['delimiter'] ) ? give_clean( $_REQUEST['delimiter'] ) : 'csv' );
854
+				$delimiter = ( ! empty($_REQUEST['delimiter']) ? give_clean($_REQUEST['delimiter']) : 'csv');
861 855
 
862 856
 				if (
863 857
 					! $csv_url ||
864
-					( ! empty( $match_url ) && ( $csv_url !== $match_url ) ) ||
865
-					( ( $mime_type = get_post_mime_type( $csv ) ) && ! strpos( $mime_type, $delimiter ) )
858
+					( ! empty($match_url) && ($csv_url !== $match_url)) ||
859
+					(($mime_type = get_post_mime_type($csv)) && ! strpos($mime_type, $delimiter))
866 860
 				) {
867 861
 					$is_valid_csv = false;
868
-					Give_Admin_Settings::add_error( 'give-import-csv', __( 'Please upload or provide a valid CSV file.', 'give' ) );
862
+					Give_Admin_Settings::add_error('give-import-csv', __('Please upload or provide a valid CSV file.', 'give'));
869 863
 				}
870 864
 			} else {
871 865
 				$is_valid_csv = false;
872
-				Give_Admin_Settings::add_error( 'give-import-csv', __( 'Please upload or provide a valid CSV file.', 'give' ) );
866
+				Give_Admin_Settings::add_error('give-import-csv', __('Please upload or provide a valid CSV file.', 'give'));
873 867
 			}
874 868
 
875 869
 			return $is_valid_csv;
@@ -885,8 +879,8 @@  discard block
 block discarded – undo
885 879
 		 * @param $field
886 880
 		 * @param $option_value
887 881
 		 */
888
-		public function render_import_field( $field, $option_value ) {
889
-			include_once GIVE_PLUGIN_DIR . 'includes/admin/tools/views/html-admin-page-imports.php';
882
+		public function render_import_field($field, $option_value) {
883
+			include_once GIVE_PLUGIN_DIR.'includes/admin/tools/views/html-admin-page-imports.php';
890 884
 		}
891 885
 
892 886
 		/**
@@ -897,8 +891,8 @@  discard block
 block discarded – undo
897 891
 		 */
898 892
 		private function is_donations_import_page() {
899 893
 			return 'import' === give_get_current_setting_tab() &&
900
-			       isset( $_GET['importer-type'] ) &&
901
-			       $this->importer_type === give_clean( $_GET['importer-type'] );
894
+			       isset($_GET['importer-type']) &&
895
+			       $this->importer_type === give_clean($_GET['importer-type']);
902 896
 		}
903 897
 	}
904 898
 
Please login to merge, or discard this patch.
includes/admin/payments/payments-history.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -25,12 +25,12 @@  discard block
 block discarded – undo
25 25
 */
26 26
 function give_payment_history_page() {
27 27
 
28
-	$give_payment = get_post_type_object( 'give_payment' );
28
+	$give_payment = get_post_type_object('give_payment');
29 29
 
30
-	if ( isset( $_GET['view'] ) && 'view-payment-details' == $_GET['view'] ) {
31
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/view-payment-details.php';
30
+	if (isset($_GET['view']) && 'view-payment-details' == $_GET['view']) {
31
+		require_once GIVE_PLUGIN_DIR.'includes/admin/payments/view-payment-details.php';
32 32
 	} else {
33
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/class-payments-table.php';
33
+		require_once GIVE_PLUGIN_DIR.'includes/admin/payments/class-payments-table.php';
34 34
 		$payments_table = new Give_Payment_History_Table();
35 35
 		$payments_table->prepare_items();
36 36
 	?>
@@ -44,18 +44,18 @@  discard block
 block discarded – undo
44 44
 		 *
45 45
 		 * @since 1.7
46 46
 		 */
47
-		do_action( 'give_payments_page_top' );
47
+		do_action('give_payments_page_top');
48 48
 		?>
49 49
 		<hr class="wp-header-end">
50 50
 
51
-		<form id="give-payments-advanced-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>">
51
+		<form id="give-payments-advanced-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>">
52 52
 			<input type="hidden" name="post_type" value="give_forms" />
53 53
 			<input type="hidden" name="page" value="give-payment-history" />
54 54
 			<?php $payments_table->views() ?>
55 55
 			<?php $payments_table->advanced_filters(); ?>
56 56
 		</form>
57 57
 
58
-		<form id="give-payments-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>">
58
+		<form id="give-payments-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>">
59 59
 			<input type="hidden" name="post_type" value="give_forms" />
60 60
 			<input type="hidden" name="page" value="give-payment-history" />
61 61
 			<?php $payments_table->display() ?>
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 		 *
68 68
 		 * @since 1.7
69 69
 		 */
70
-		do_action( 'give_payments_page_bottom' );
70
+		do_action('give_payments_page_bottom');
71 71
 		?>
72 72
 
73 73
 	</div>
@@ -84,29 +84,29 @@  discard block
 block discarded – undo
84 84
  * @param $title
85 85
  * @return string
86 86
  */
87
-function give_view_order_details_title( $admin_title, $title ) {
87
+function give_view_order_details_title($admin_title, $title) {
88 88
 
89
-	if ( 'give_forms_page_give-payment-history' != get_current_screen()->base ) {
89
+	if ('give_forms_page_give-payment-history' != get_current_screen()->base) {
90 90
 		return $admin_title;
91 91
 	}
92 92
 
93
-	if( ! isset( $_GET['give-action'] ) ) {
93
+	if ( ! isset($_GET['give-action'])) {
94 94
 		return $admin_title;
95 95
 	}
96 96
 
97
-	switch( $_GET['give-action'] ) :
97
+	switch ($_GET['give-action']) :
98 98
 
99 99
 		case 'view-payment-details' :
100 100
 			$title = sprintf(
101 101
 				/* translators: %s: admin title */
102
-				esc_html__( 'View Donation Details - %s', 'give' ),
102
+				esc_html__('View Donation Details - %s', 'give'),
103 103
 				$admin_title
104 104
 			);
105 105
 			break;
106 106
 		case 'edit-payment' :
107 107
 			$title = sprintf(
108 108
 				/* translators: %s: admin title */
109
-				esc_html__( 'Edit Donation - %s', 'give' ),
109
+				esc_html__('Edit Donation - %s', 'give'),
110 110
 				$admin_title
111 111
 			);
112 112
 			break;
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 
118 118
 	return $title;
119 119
 }
120
-add_filter( 'admin_title', 'give_view_order_details_title', 10, 2 );
120
+add_filter('admin_title', 'give_view_order_details_title', 10, 2);
121 121
 
122 122
 /**
123 123
  * Intercept default Edit post links for Give payments and rewrite them to the View Order Details screen.
@@ -129,20 +129,20 @@  discard block
 block discarded – undo
129 129
  * @param $context
130 130
  * @return string
131 131
  */
132
-function give_override_edit_post_for_payment_link( $url, $post_id = 0, $context ) {
132
+function give_override_edit_post_for_payment_link($url, $post_id = 0, $context) {
133 133
 
134
-	$post = get_post( $post_id );
134
+	$post = get_post($post_id);
135 135
 
136
-	if( ! $post ) {
136
+	if ( ! $post) {
137 137
 		return $url;
138 138
 	}
139 139
 
140
-	if( 'give_payment' != $post->post_type ) {
140
+	if ('give_payment' != $post->post_type) {
141 141
 		return $url;
142 142
 	}
143 143
 
144
-	$url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $post_id );
144
+	$url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id='.$post_id);
145 145
 
146 146
 	return $url;
147 147
 }
148
-add_filter( 'get_edit_post_link', 'give_override_edit_post_for_payment_link', 10, 3 );
148
+add_filter('get_edit_post_link', 'give_override_edit_post_for_payment_link', 10, 3);
Please login to merge, or discard this patch.
includes/admin/add-ons.php 1 patch
Spacing   +11 added lines, -11 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
 
@@ -26,13 +26,13 @@  discard block
 block discarded – undo
26 26
 	ob_start(); ?>
27 27
 	<div class="wrap" id="give-add-ons">
28 28
 		<h1><?php echo get_admin_page_title(); ?>
29
-			&nbsp;&mdash;&nbsp;<a href="https://givewp.com/addons/" class="button-primary give-view-addons-all" target="_blank"><?php esc_html_e( 'View All Add-ons', 'give' ); ?>
29
+			&nbsp;&mdash;&nbsp;<a href="https://givewp.com/addons/" class="button-primary give-view-addons-all" target="_blank"><?php esc_html_e('View All Add-ons', 'give'); ?>
30 30
 				<span class="dashicons dashicons-external"></span></a>
31 31
 		</h1>
32 32
 
33 33
 		<hr class="wp-header-end">
34 34
 
35
-		<p><?php esc_html_e( 'The following Add-ons extend the functionality of Give.', 'give' ); ?></p>
35
+		<p><?php esc_html_e('The following Add-ons extend the functionality of Give.', 'give'); ?></p>
36 36
 		<?php echo give_add_ons_get_feed(); ?>
37 37
 	</div>
38 38
 	<?php
@@ -50,20 +50,20 @@  discard block
 block discarded – undo
50 50
 function give_add_ons_get_feed() {
51 51
 
52 52
 	$addons_debug = false; //set to true to debug
53
-	$cache        = Give_Cache::get( 'give_add_ons_feed', true );
53
+	$cache        = Give_Cache::get('give_add_ons_feed', true);
54 54
 
55
-	if ( $cache === false || $addons_debug === true && WP_DEBUG === true ) {
56
-		$feed = wp_remote_get( 'https://givewp.com/downloads/feed/', array( 'sslverify' => false ) );
55
+	if ($cache === false || $addons_debug === true && WP_DEBUG === true) {
56
+		$feed = wp_remote_get('https://givewp.com/downloads/feed/', array('sslverify' => false));
57 57
 
58
-		if ( ! is_wp_error( $feed ) ) {
59
-			if ( isset( $feed['body'] ) && strlen( $feed['body'] ) > 0 ) {
60
-				$cache = wp_remote_retrieve_body( $feed );
61
-				Give_Cache::set( 'give_add_ons_feed', $cache, HOUR_IN_SECONDS, true );
58
+		if ( ! is_wp_error($feed)) {
59
+			if (isset($feed['body']) && strlen($feed['body']) > 0) {
60
+				$cache = wp_remote_retrieve_body($feed);
61
+				Give_Cache::set('give_add_ons_feed', $cache, HOUR_IN_SECONDS, true);
62 62
 			}
63 63
 		} else {
64 64
 			$cache = sprintf(
65 65
 				'<div class="error"><p>%s</p></div>',
66
-				esc_html__( 'There was an error retrieving the Give Add-ons list from the server. Please try again later.', 'give' )
66
+				esc_html__('There was an error retrieving the Give Add-ons list from the server. Please try again later.', 'give')
67 67
 			);
68 68
 		}
69 69
 	}
Please login to merge, or discard this patch.
includes/price-functions.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -23,13 +23,13 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return bool true if has variable prices, false otherwise
25 25
  */
26
-function give_has_variable_prices( $form_id = 0 ) {
26
+function give_has_variable_prices($form_id = 0) {
27 27
 
28
-	if ( empty( $form_id ) ) {
28
+	if (empty($form_id)) {
29 29
 		return false;
30 30
 	}
31 31
 
32
-	$form = new Give_Donate_Form( $form_id );
32
+	$form = new Give_Donate_Form($form_id);
33 33
 
34 34
 	return $form->has_variable_prices();
35 35
 }
@@ -44,13 +44,13 @@  discard block
 block discarded – undo
44 44
  *
45 45
  * @return array|bool Variable prices
46 46
  */
47
-function give_get_variable_prices( $form_id = 0 ) {
47
+function give_get_variable_prices($form_id = 0) {
48 48
 
49
-	if ( empty( $form_id ) ) {
49
+	if (empty($form_id)) {
50 50
 		return false;
51 51
 	}
52 52
 
53
-	$form = new Give_Donate_Form( $form_id );
53
+	$form = new Give_Donate_Form($form_id);
54 54
 
55 55
 	return $form->prices;
56 56
 
@@ -65,13 +65,13 @@  discard block
 block discarded – undo
65 65
  *
66 66
  * @return array Variable prices
67 67
  */
68
-function give_get_variable_price_ids( $form_id = 0 ) {
69
-	if( ! ( $prices = give_get_variable_prices( $form_id ) ) ) {
68
+function give_get_variable_price_ids($form_id = 0) {
69
+	if ( ! ($prices = give_get_variable_prices($form_id))) {
70 70
 		return array();
71 71
 	}
72 72
 
73 73
 	$price_ids = array();
74
-	foreach ( $prices as $price ){
74
+	foreach ($prices as $price) {
75 75
 		$price_ids[] = $price['_give_id']['level_id'];
76 76
 	}
77 77
 
@@ -89,13 +89,13 @@  discard block
 block discarded – undo
89 89
  *
90 90
  * @return string $default_price
91 91
  */
92
-function give_get_default_multilevel_amount( $form_id ) {
92
+function give_get_default_multilevel_amount($form_id) {
93 93
 	$default_price = '1.00';
94
-	$prices        = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id );
94
+	$prices        = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id);
95 95
 
96
-	foreach ( $prices as $price ) {
96
+	foreach ($prices as $price) {
97 97
 
98
-		if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) {
98
+		if (isset($price['_give_default']) && $price['_give_default'] === 'default') {
99 99
 			$default_price = $price['_give_amount'];
100 100
 		}
101 101
 
@@ -116,19 +116,19 @@  discard block
 block discarded – undo
116 116
  * @return string $default_price
117 117
  * @since      1.0
118 118
  */
119
-function give_get_default_form_amount( $form_id ) {
119
+function give_get_default_form_amount($form_id) {
120 120
 
121
-	if ( give_has_variable_prices( $form_id ) ) {
121
+	if (give_has_variable_prices($form_id)) {
122 122
 
123
-		$default_amount = give_get_default_multilevel_amount( $form_id );
123
+		$default_amount = give_get_default_multilevel_amount($form_id);
124 124
 
125 125
 	} else {
126 126
 
127
-		$default_amount = give_get_meta( $form_id, '_give_set_price', true );
127
+		$default_amount = give_get_meta($form_id, '_give_set_price', true);
128 128
 
129 129
 	}
130 130
 
131
-	return apply_filters( 'give_default_form_amount', $default_amount, $form_id );
131
+	return apply_filters('give_default_form_amount', $default_amount, $form_id);
132 132
 
133 133
 }
134 134
 
@@ -146,13 +146,13 @@  discard block
 block discarded – undo
146 146
  *
147 147
  * @return bool
148 148
  */
149
-function give_is_custom_price_mode( $form_id = 0 ) {
149
+function give_is_custom_price_mode($form_id = 0) {
150 150
 
151
-	if ( empty( $form_id ) ) {
151
+	if (empty($form_id)) {
152 152
 		return false;
153 153
 	}
154 154
 
155
-	$form = new Give_Donate_Form( $form_id );
155
+	$form = new Give_Donate_Form($form_id);
156 156
 
157 157
 	return $form->is_custom_price_mode();
158 158
 }
159 159
\ No newline at end of file
Please login to merge, or discard this patch.
includes/forms/template.php 4 patches
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1020,9 +1020,12 @@
 block discarded – undo
1020 1020
 				    }
1021 1021
 				    ?>
1022 1022
 			    </select>
1023
-		    <?php else : ?>
1023
+		    <?php else {
1024
+	: ?>
1024 1025
 			    <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input"
1025
-			           placeholder="<?php echo $label; ?>" value="<?php echo $selected_state; ?>"/>
1026
+			           placeholder="<?php echo $label;
1027
+}
1028
+?>" value="<?php echo $selected_state; ?>"/>
1026 1029
 		    <?php endif; ?>
1027 1030
 	    </p>
1028 1031
 
Please login to merge, or discard this patch.
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
  *
22 22
  * @since 1.0
23 23
  *
24
- * @return string Donation form.
24
+ * @return false|null Donation form.
25 25
  */
26 26
 function give_get_donation_form( $args = array() ) {
27 27
 
@@ -1443,7 +1443,7 @@  discard block
 block discarded – undo
1443 1443
  *
1444 1444
  * @param  int $form_id The form ID.
1445 1445
  *
1446
- * @return bool
1446
+ * @return false|null
1447 1447
  */
1448 1448
 function give_terms_agreement( $form_id ) {
1449 1449
 	$form_option = give_get_meta( $form_id, '_give_terms_option', true );
@@ -1621,7 +1621,7 @@  discard block
 block discarded – undo
1621 1621
  * @param  int   $form_id The form ID.
1622 1622
  * @param  array $args    An array of form arguments.
1623 1623
  *
1624
- * @return mixed
1624
+ * @return boolean
1625 1625
  */
1626 1626
 function give_show_goal_progress( $form_id, $args ) {
1627 1627
 
@@ -1646,7 +1646,7 @@  discard block
 block discarded – undo
1646 1646
  *
1647 1647
  * @since  1.8
1648 1648
  *
1649
- * @param  $form_id
1649
+ * @param  integer $form_id
1650 1650
  * @param  $args
1651 1651
  *
1652 1652
  * @return mixed|string
@@ -1687,7 +1687,7 @@  discard block
 block discarded – undo
1687 1687
  * @param  int   $form_id The form ID.
1688 1688
  * @param  array $args    An array of form arguments.
1689 1689
  *
1690
- * @return void|bool
1690
+ * @return false|null
1691 1691
  */
1692 1692
 function give_form_content( $form_id, $args ) {
1693 1693
 
Please login to merge, or discard this patch.
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -928,10 +928,10 @@  discard block
 block discarded – undo
928 928
 			    <?php echo( give_field_is_required( 'billing_country', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
929 929
 		    >
930 930
 			    <?php
931
-			    foreach ( $countries as $country_code => $country ) {
932
-				    echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>';
933
-			    }
934
-			    ?>
931
+				foreach ( $countries as $country_code => $country ) {
932
+					echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>';
933
+				}
934
+				?>
935 935
 		    </select>
936 936
 	    </p>
937 937
 
@@ -1000,7 +1000,7 @@  discard block
 block discarded – undo
1000 1000
 		    <label for="card_state" class="give-label">
1001 1001
 			    <span class="state-label-text"><?php echo $label; ?></span>
1002 1002
 			    <?php if ( give_field_is_required( 'card_state', $form_id ) ) :
1003
-				    ?>
1003
+					?>
1004 1004
 				    <span class="give-required-indicator <?php echo( array_key_exists( $selected_country, $states_not_required_country_list ) ? 'give-hidden' : '' ) ?> ">*</span>
1005 1005
 			    <?php endif; ?>
1006 1006
 			    <span class="give-tooltip give-icon give-icon-question"
@@ -1008,17 +1008,17 @@  discard block
 block discarded – undo
1008 1008
 		    </label>
1009 1009
 		    <?php
1010 1010
 
1011
-		    if ( ! empty( $states ) ) : ?>
1011
+			if ( ! empty( $states ) ) : ?>
1012 1012
 			    <select
1013 1013
 					    name="card_state"
1014 1014
 					    id="card_state"
1015 1015
 					    class="card_state give-select<?php echo( give_field_is_required( 'card_state', $form_id ) ? ' required' : '' ); ?>"
1016 1016
 				    <?php echo( give_field_is_required( 'card_state', $form_id ) ? ' required aria-required="true" ' : '' ); ?>>
1017 1017
 				    <?php
1018
-				    foreach ( $states as $state_code => $state ) {
1019
-					    echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>';
1020
-				    }
1021
-				    ?>
1018
+					foreach ( $states as $state_code => $state ) {
1019
+						echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>';
1020
+					}
1021
+					?>
1022 1022
 			    </select>
1023 1023
 		    <?php else : ?>
1024 1024
 			    <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input"
Please login to merge, or discard this patch.
Spacing   +401 added lines, -402 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -23,50 +23,50 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return string Donation form.
25 25
  */
26
-function give_get_donation_form( $args = array() ) {
26
+function give_get_donation_form($args = array()) {
27 27
 
28 28
 	global $post;
29 29
 
30
-	$form_id = is_object( $post ) ? $post->ID : 0;
30
+	$form_id = is_object($post) ? $post->ID : 0;
31 31
 
32
-	if ( isset( $args['id'] ) ) {
32
+	if (isset($args['id'])) {
33 33
 		$form_id = $args['id'];
34 34
 	}
35 35
 
36
-	$defaults = apply_filters( 'give_form_args_defaults', array(
36
+	$defaults = apply_filters('give_form_args_defaults', array(
37 37
 		'form_id' => $form_id,
38
-	) );
38
+	));
39 39
 
40
-	$args = wp_parse_args( $args, $defaults );
40
+	$args = wp_parse_args($args, $defaults);
41 41
 
42
-	$form = new Give_Donate_Form( $args['form_id'] );
42
+	$form = new Give_Donate_Form($args['form_id']);
43 43
 
44 44
 	//bail if no form ID.
45
-	if ( empty( $form->ID ) ) {
45
+	if (empty($form->ID)) {
46 46
 		return false;
47 47
 	}
48 48
 
49
-	$payment_mode = give_get_chosen_gateway( $form->ID );
49
+	$payment_mode = give_get_chosen_gateway($form->ID);
50 50
 
51
-	$form_action = add_query_arg( apply_filters( 'give_form_action_args', array(
51
+	$form_action = add_query_arg(apply_filters('give_form_action_args', array(
52 52
 		'payment-mode' => $payment_mode,
53
-	) ),
53
+	)),
54 54
 		give_get_current_page_url()
55 55
 	);
56 56
 
57 57
 	//Sanity Check: Donation form not published or user doesn't have permission to view drafts.
58 58
 	if (
59
-		( 'publish' !== $form->post_status && ! current_user_can( 'edit_give_forms', $form->ID ) )
60
-		|| ( 'trash' === $form->post_status )
59
+		('publish' !== $form->post_status && ! current_user_can('edit_give_forms', $form->ID))
60
+		|| ('trash' === $form->post_status)
61 61
 	) {
62 62
 		return false;
63 63
 	}
64 64
 
65 65
 	//Get the form wrap CSS classes.
66
-	$form_wrap_classes = $form->get_form_wrap_classes( $args );
66
+	$form_wrap_classes = $form->get_form_wrap_classes($args);
67 67
 
68 68
 	//Get the <form> tag wrap CSS classes.
69
-	$form_classes = $form->get_form_classes( $args );
69
+	$form_classes = $form->get_form_classes($args);
70 70
 
71 71
 	ob_start();
72 72
 
@@ -78,19 +78,19 @@  discard block
 block discarded – undo
78 78
 	 * @param int   $form_id The form ID.
79 79
 	 * @param array $args    An array of form arguments.
80 80
 	 */
81
-	do_action( 'give_pre_form_output', $form->ID, $args, $form );
81
+	do_action('give_pre_form_output', $form->ID, $args, $form);
82 82
 
83 83
 	?>
84 84
 	<div id="give-form-<?php echo $form->ID; ?>-wrap" class="<?php echo $form_wrap_classes; ?>">
85 85
 
86
-		<?php if ( $form->is_close_donation_form() ) {
86
+		<?php if ($form->is_close_donation_form()) {
87 87
 
88 88
 			// Get Goal thank you message.
89
-			$goal_achieved_message = get_post_meta( $form->ID, '_give_form_goal_achieved_message', true );
90
-			$goal_achieved_message = ! empty( $goal_achieved_message ) ? apply_filters( 'the_content', $goal_achieved_message ) : '';
89
+			$goal_achieved_message = get_post_meta($form->ID, '_give_form_goal_achieved_message', true);
90
+			$goal_achieved_message = ! empty($goal_achieved_message) ? apply_filters('the_content', $goal_achieved_message) : '';
91 91
 
92 92
 			// Print thank you message.
93
-			echo apply_filters( 'give_goal_closed_output', $goal_achieved_message, $form->ID, $form );
93
+			echo apply_filters('give_goal_closed_output', $goal_achieved_message, $form->ID, $form);
94 94
 
95 95
 		} else {
96 96
 			/**
@@ -98,13 +98,13 @@  discard block
 block discarded – undo
98 98
 			 * 1. if show_title params set to true
99 99
 			 * 2. if admin set form display_style to button
100 100
 			 */
101
-			$form_title = apply_filters( 'give_form_title', '<h2 class="give-form-title">' . get_the_title( $form_id ) . '</h2>' );
101
+			$form_title = apply_filters('give_form_title', '<h2 class="give-form-title">'.get_the_title($form_id).'</h2>');
102 102
 			if (
103 103
 				(
104
-					( isset( $args['show_title'] ) && $args['show_title'] == true )
105
-					|| ( 'button' === get_post_meta( $form_id, '_give_payment_display', true ) )
104
+					(isset($args['show_title']) && $args['show_title'] == true)
105
+					|| ('button' === get_post_meta($form_id, '_give_payment_display', true))
106 106
 				)
107
-				&& ! doing_action( 'give_single_form_summary' )
107
+				&& ! doing_action('give_single_form_summary')
108 108
 			) {
109 109
 				echo $form_title;
110 110
 			}
@@ -118,13 +118,13 @@  discard block
 block discarded – undo
118 118
 			 * @param array            $args    An array of form arguments.
119 119
 			 * @param Give_Donate_Form $form    Form object.
120 120
 			 */
121
-			do_action( 'give_pre_form', $form->ID, $args, $form );
121
+			do_action('give_pre_form', $form->ID, $args, $form);
122 122
 
123 123
 			// Set form html tags.
124 124
 			$form_html_tags = array(
125 125
 				'id'     => "give-form-{$form_id}",
126 126
 				'class'  => $form_classes,
127
-				'action' => esc_url_raw( $form_action ),
127
+				'action' => esc_url_raw($form_action),
128 128
 			);
129 129
 
130 130
 			/**
@@ -135,9 +135,9 @@  discard block
 block discarded – undo
135 135
 			 * @param array            $form_html_tags Array of form html tags.
136 136
 			 * @param Give_Donate_Form $form           Form object.
137 137
 			 */
138
-			$form_html_tags = apply_filters( 'give_form_html_tags', (array) $form_html_tags, $form );
138
+			$form_html_tags = apply_filters('give_form_html_tags', (array) $form_html_tags, $form);
139 139
 			?>
140
-			<form <?php echo give_get_attribute_str( $form_html_tags ); ?> method="post">
140
+			<form <?php echo give_get_attribute_str($form_html_tags); ?> method="post">
141 141
 
142 142
 				<!-- The following field is for robots only, invisible to humans: -->
143 143
 				<span class="give-hidden" style="display: none !important;">
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 				 * @param array            $args    An array of form arguments.
157 157
 				 * @param Give_Donate_Form $form    Form object.
158 158
 				 */
159
-				do_action( 'give_donation_form_top', $form->ID, $args, $form );
159
+				do_action('give_donation_form_top', $form->ID, $args, $form);
160 160
 
161 161
 				/**
162 162
 				 * Fires while outputting donation form, for payment gateway fields.
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 				 * @param array            $args    An array of form arguments.
168 168
 				 * @param Give_Donate_Form $form    Form object.
169 169
 				 */
170
-				do_action( 'give_payment_mode_select', $form->ID, $args, $form );
170
+				do_action('give_payment_mode_select', $form->ID, $args, $form);
171 171
 
172 172
 				/**
173 173
 				 * Fires while outputting donation form, after all other fields.
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 				 * @param array            $args    An array of form arguments.
179 179
 				 * @param Give_Donate_Form $form    Form object.
180 180
 				 */
181
-				do_action( 'give_donation_form_bottom', $form->ID, $args, $form );
181
+				do_action('give_donation_form_bottom', $form->ID, $args, $form);
182 182
 
183 183
 				?>
184 184
 			</form>
@@ -193,12 +193,12 @@  discard block
 block discarded – undo
193 193
 			 * @param array            $args    An array of form arguments.
194 194
 			 * @param Give_Donate_Form $form    Form object.
195 195
 			 */
196
-			do_action( 'give_post_form', $form->ID, $args, $form );
196
+			do_action('give_post_form', $form->ID, $args, $form);
197 197
 
198 198
 		}
199 199
 		?>
200 200
 
201
-	</div><!--end #give-form-<?php echo absint( $form->ID ); ?>-->
201
+	</div><!--end #give-form-<?php echo absint($form->ID); ?>-->
202 202
 	<?php
203 203
 
204 204
 	/**
@@ -209,11 +209,11 @@  discard block
 block discarded – undo
209 209
 	 * @param int   $form_id The form ID.
210 210
 	 * @param array $args    An array of form arguments.
211 211
 	 */
212
-	do_action( 'give_post_form_output', $form->ID, $args );
212
+	do_action('give_post_form_output', $form->ID, $args);
213 213
 
214 214
 	$final_output = ob_get_clean();
215 215
 
216
-	echo apply_filters( 'give_donate_form', $final_output, $args );
216
+	echo apply_filters('give_donate_form', $final_output, $args);
217 217
 }
218 218
 
219 219
 /**
@@ -230,11 +230,11 @@  discard block
 block discarded – undo
230 230
  *
231 231
  * @return string
232 232
  */
233
-function give_show_purchase_form( $form_id ) {
233
+function give_show_purchase_form($form_id) {
234 234
 
235
-	$payment_mode = give_get_chosen_gateway( $form_id );
235
+	$payment_mode = give_get_chosen_gateway($form_id);
236 236
 
237
-	if ( ! isset( $form_id ) && isset( $_POST['give_form_id'] ) ) {
237
+	if ( ! isset($form_id) && isset($_POST['give_form_id'])) {
238 238
 		$form_id = $_POST['give_form_id'];
239 239
 	}
240 240
 
@@ -243,33 +243,33 @@  discard block
 block discarded – undo
243 243
 	 *
244 244
 	 * @since 1.7
245 245
 	 */
246
-	do_action( 'give_payment_fields_top', $form_id );
246
+	do_action('give_payment_fields_top', $form_id);
247 247
 
248
-	if ( give_can_checkout() && isset( $form_id ) ) {
248
+	if (give_can_checkout() && isset($form_id)) {
249 249
 
250 250
 		/**
251 251
 		 * Fires while displaying donation form, before registration login.
252 252
 		 *
253 253
 		 * @since 1.7
254 254
 		 */
255
-		do_action( 'give_donation_form_before_register_login', $form_id );
255
+		do_action('give_donation_form_before_register_login', $form_id);
256 256
 
257 257
 		/**
258 258
 		 * Fire when register/login form fields render.
259 259
 		 *
260 260
 		 * @since 1.7
261 261
 		 */
262
-		do_action( 'give_donation_form_register_login_fields', $form_id );
262
+		do_action('give_donation_form_register_login_fields', $form_id);
263 263
 
264 264
 		/**
265 265
 		 * Fire when credit card form fields render.
266 266
 		 *
267 267
 		 * @since 1.7
268 268
 		 */
269
-		do_action( 'give_donation_form_before_cc_form', $form_id );
269
+		do_action('give_donation_form_before_cc_form', $form_id);
270 270
 
271 271
 		// Load the credit card form and allow gateways to load their own if they wish.
272
-		if ( has_action( 'give_' . $payment_mode . '_cc_form' ) ) {
272
+		if (has_action('give_'.$payment_mode.'_cc_form')) {
273 273
 			/**
274 274
 			 * Fires while displaying donation form, credit card form fields for a given gateway.
275 275
 			 *
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 			 *
278 278
 			 * @param int $form_id The form ID.
279 279
 			 */
280
-			do_action( "give_{$payment_mode}_cc_form", $form_id );
280
+			do_action("give_{$payment_mode}_cc_form", $form_id);
281 281
 		} else {
282 282
 			/**
283 283
 			 * Fires while displaying donation form, credit card form fields.
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 			 *
287 287
 			 * @param int $form_id The form ID.
288 288
 			 */
289
-			do_action( 'give_cc_form', $form_id );
289
+			do_action('give_cc_form', $form_id);
290 290
 		}
291 291
 
292 292
 		/**
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
 		 *
295 295
 		 * @since 1.7
296 296
 		 */
297
-		do_action( 'give_donation_form_after_cc_form', $form_id );
297
+		do_action('give_donation_form_after_cc_form', $form_id);
298 298
 
299 299
 	} else {
300 300
 		/**
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 		 *
303 303
 		 * @since 1.7
304 304
 		 */
305
-		do_action( 'give_donation_form_no_access', $form_id );
305
+		do_action('give_donation_form_no_access', $form_id);
306 306
 
307 307
 	}
308 308
 
@@ -311,10 +311,10 @@  discard block
 block discarded – undo
311 311
 	 *
312 312
 	 * @since 1.7
313 313
 	 */
314
-	do_action( 'give_payment_fields_bottom', $form_id );
314
+	do_action('give_payment_fields_bottom', $form_id);
315 315
 }
316 316
 
317
-add_action( 'give_donation_form', 'give_show_purchase_form' );
317
+add_action('give_donation_form', 'give_show_purchase_form');
318 318
 
319 319
 /**
320 320
  * Give Show Login/Register Form Fields.
@@ -325,11 +325,11 @@  discard block
 block discarded – undo
325 325
  *
326 326
  * @return void
327 327
  */
328
-function give_show_register_login_fields( $form_id ) {
328
+function give_show_register_login_fields($form_id) {
329 329
 
330
-	$show_register_form = give_show_login_register_option( $form_id );
330
+	$show_register_form = give_show_login_register_option($form_id);
331 331
 
332
-	if ( ( $show_register_form === 'registration' || ( $show_register_form === 'both' && ! isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) :
332
+	if (($show_register_form === 'registration' || ($show_register_form === 'both' && ! isset($_GET['login']))) && ! is_user_logged_in()) :
333 333
 		?>
334 334
 		<div id="give-checkout-login-register-<?php echo $form_id; ?>">
335 335
 			<?php
@@ -338,11 +338,11 @@  discard block
 block discarded – undo
338 338
 			 *
339 339
 			 * @since 1.7
340 340
 			 */
341
-			do_action( 'give_donation_form_register_fields', $form_id );
341
+			do_action('give_donation_form_register_fields', $form_id);
342 342
 			?>
343 343
 		</div>
344 344
 		<?php
345
-	elseif ( ( $show_register_form === 'login' || ( $show_register_form === 'both' && isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) :
345
+	elseif (($show_register_form === 'login' || ($show_register_form === 'both' && isset($_GET['login']))) && ! is_user_logged_in()) :
346 346
 		?>
347 347
 		<div id="give-checkout-login-register-<?php echo $form_id; ?>">
348 348
 			<?php
@@ -351,23 +351,23 @@  discard block
 block discarded – undo
351 351
 			 *
352 352
 			 * @since 1.7
353 353
 			 */
354
-			do_action( 'give_donation_form_login_fields', $form_id );
354
+			do_action('give_donation_form_login_fields', $form_id);
355 355
 			?>
356 356
 		</div>
357 357
 		<?php
358 358
 	endif;
359 359
 
360
-	if ( ( ! isset( $_GET['login'] ) && is_user_logged_in() ) || ! isset( $show_register_form ) || 'none' === $show_register_form || 'login' === $show_register_form ) {
360
+	if (( ! isset($_GET['login']) && is_user_logged_in()) || ! isset($show_register_form) || 'none' === $show_register_form || 'login' === $show_register_form) {
361 361
 		/**
362 362
 		 * Fire when user info render.
363 363
 		 *
364 364
 		 * @since 1.7
365 365
 		 */
366
-		do_action( 'give_donation_form_after_user_info', $form_id );
366
+		do_action('give_donation_form_after_user_info', $form_id);
367 367
 	}
368 368
 }
369 369
 
370
-add_action( 'give_donation_form_register_login_fields', 'give_show_register_login_fields' );
370
+add_action('give_donation_form_register_login_fields', 'give_show_register_login_fields');
371 371
 
372 372
 /**
373 373
  * Donation Amount Field.
@@ -382,16 +382,16 @@  discard block
 block discarded – undo
382 382
  *
383 383
  * @return void
384 384
  */
385
-function give_output_donation_amount_top( $form_id = 0, $args = array() ) {
385
+function give_output_donation_amount_top($form_id = 0, $args = array()) {
386 386
 
387 387
 	$give_options        = give_get_settings();
388
-	$variable_pricing    = give_has_variable_prices( $form_id );
389
-	$allow_custom_amount = give_get_meta( $form_id, '_give_custom_amount', true );
390
-	$currency_position   = isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before';
391
-	$symbol              = give_currency_symbol( give_get_currency( $form_id, $args ) );
392
-	$currency_output     = '<span class="give-currency-symbol give-currency-position-' . $currency_position . '">' . $symbol . '</span>';
393
-	$default_amount      = give_format_amount( give_get_default_form_amount( $form_id ), array( 'sanitize' => false, 'currency' => give_get_currency( $form_id ) ) );
394
-	$custom_amount_text  = give_get_meta( $form_id, '_give_custom_amount_text', true );
388
+	$variable_pricing    = give_has_variable_prices($form_id);
389
+	$allow_custom_amount = give_get_meta($form_id, '_give_custom_amount', true);
390
+	$currency_position   = isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before';
391
+	$symbol              = give_currency_symbol(give_get_currency($form_id, $args));
392
+	$currency_output     = '<span class="give-currency-symbol give-currency-position-'.$currency_position.'">'.$symbol.'</span>';
393
+	$default_amount      = give_format_amount(give_get_default_form_amount($form_id), array('sanitize' => false, 'currency' => give_get_currency($form_id)));
394
+	$custom_amount_text  = give_get_meta($form_id, '_give_custom_amount_text', true);
395 395
 
396 396
 	/**
397 397
 	 * Fires while displaying donation form, before donation level fields.
@@ -401,20 +401,20 @@  discard block
 block discarded – undo
401 401
 	 * @param int   $form_id The form ID.
402 402
 	 * @param array $args    An array of form arguments.
403 403
 	 */
404
-	do_action( 'give_before_donation_levels', $form_id, $args );
404
+	do_action('give_before_donation_levels', $form_id, $args);
405 405
 
406 406
 	//Set Price, No Custom Amount Allowed means hidden price field
407
-	if ( ! give_is_setting_enabled( $allow_custom_amount ) ) {
407
+	if ( ! give_is_setting_enabled($allow_custom_amount)) {
408 408
 		?>
409
-		<label class="give-hidden" for="give-amount-hidden"><?php esc_html_e( 'Donation Amount:', 'give' ); ?></label>
409
+		<label class="give-hidden" for="give-amount-hidden"><?php esc_html_e('Donation Amount:', 'give'); ?></label>
410 410
 		<input id="give-amount" class="give-amount-hidden" type="hidden" name="give-amount"
411 411
 			   value="<?php echo $default_amount; ?>" required aria-required="true"/>
412 412
 		<div class="set-price give-donation-amount form-row-wide">
413
-			<?php if ( $currency_position == 'before' ) {
413
+			<?php if ($currency_position == 'before') {
414 414
 				echo $currency_output;
415 415
 			} ?>
416 416
 			<span id="give-amount-text" class="give-text-input give-amount-top"><?php echo $default_amount; ?></span>
417
-			<?php if ( $currency_position == 'after' ) {
417
+			<?php if ($currency_position == 'after') {
418 418
 				echo $currency_output;
419 419
 			} ?>
420 420
 		</div>
@@ -424,13 +424,13 @@  discard block
 block discarded – undo
424 424
 		?>
425 425
 		<div class="give-total-wrap">
426 426
 			<div class="give-donation-amount form-row-wide">
427
-				<?php if ( $currency_position == 'before' ) {
427
+				<?php if ($currency_position == 'before') {
428 428
 					echo $currency_output;
429 429
 				} ?>
430
-				<label class="give-hidden" for="give-amount"><?php esc_html_e( 'Donation Amount:', 'give' ); ?></label>
430
+				<label class="give-hidden" for="give-amount"><?php esc_html_e('Donation Amount:', 'give'); ?></label>
431 431
 				<input class="give-text-input give-amount-top" id="give-amount" name="give-amount" type="tel"
432 432
 					   placeholder="" value="<?php echo $default_amount; ?>" autocomplete="off">
433
-				<?php if ( $currency_position == 'after' ) {
433
+				<?php if ($currency_position == 'after') {
434 434
 					echo $currency_output;
435 435
 				} ?>
436 436
 			</div>
@@ -445,16 +445,16 @@  discard block
 block discarded – undo
445 445
 	 * @param int   $form_id The form ID.
446 446
 	 * @param array $args    An array of form arguments.
447 447
 	 */
448
-	do_action( 'give_after_donation_amount', $form_id, $args );
448
+	do_action('give_after_donation_amount', $form_id, $args);
449 449
 
450 450
 	//Custom Amount Text
451
-	if ( ! $variable_pricing && give_is_setting_enabled( $allow_custom_amount ) && ! empty( $custom_amount_text ) ) { ?>
451
+	if ( ! $variable_pricing && give_is_setting_enabled($allow_custom_amount) && ! empty($custom_amount_text)) { ?>
452 452
 		<p class="give-custom-amount-text"><?php echo $custom_amount_text; ?></p>
453 453
 	<?php }
454 454
 
455 455
 	//Output Variable Pricing Levels.
456
-	if ( $variable_pricing ) {
457
-		give_output_levels( $form_id );
456
+	if ($variable_pricing) {
457
+		give_output_levels($form_id);
458 458
 	}
459 459
 
460 460
 	/**
@@ -465,10 +465,10 @@  discard block
 block discarded – undo
465 465
 	 * @param int   $form_id The form ID.
466 466
 	 * @param array $args    An array of form arguments.
467 467
 	 */
468
-	do_action( 'give_after_donation_levels', $form_id, $args );
468
+	do_action('give_after_donation_levels', $form_id, $args);
469 469
 }
470 470
 
471
-add_action( 'give_donation_form_top', 'give_output_donation_amount_top', 10, 2 );
471
+add_action('give_donation_form_top', 'give_output_donation_amount_top', 10, 2);
472 472
 
473 473
 /**
474 474
  * Outputs the Donation Levels in various formats such as dropdown, radios, and buttons.
@@ -479,30 +479,30 @@  discard block
 block discarded – undo
479 479
  *
480 480
  * @return string Donation levels.
481 481
  */
482
-function give_output_levels( $form_id ) {
482
+function give_output_levels($form_id) {
483 483
 
484 484
 	//Get variable pricing.
485
-	$prices             = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id );
486
-	$display_style      = give_get_meta( $form_id, '_give_display_style', true );
487
-	$custom_amount      = give_get_meta( $form_id, '_give_custom_amount', true );
488
-	$custom_amount_text = give_get_meta( $form_id, '_give_custom_amount_text', true );
489
-	if ( empty( $custom_amount_text ) ) {
490
-		$custom_amount_text = esc_html__( 'Give a Custom Amount', 'give' );
485
+	$prices             = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id);
486
+	$display_style      = give_get_meta($form_id, '_give_display_style', true);
487
+	$custom_amount      = give_get_meta($form_id, '_give_custom_amount', true);
488
+	$custom_amount_text = give_get_meta($form_id, '_give_custom_amount_text', true);
489
+	if (empty($custom_amount_text)) {
490
+		$custom_amount_text = esc_html__('Give a Custom Amount', 'give');
491 491
 	}
492 492
 
493 493
 	$output = '';
494 494
 
495
-	switch ( $display_style ) {
495
+	switch ($display_style) {
496 496
 		case 'buttons':
497 497
 
498 498
 			$output .= '<ul id="give-donation-level-button-wrap" class="give-donation-levels-wrap give-list-inline">';
499 499
 
500
-			foreach ( $prices as $price ) {
501
-				$level_text    = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ) ), $form_id, $price );
502
-				$level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-' . $price['_give_id']['level_id'] . ' ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'give-default-level' : '' ), $form_id, $price );
500
+			foreach ($prices as $price) {
501
+				$level_text    = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'], array('sanitize' => false))), $form_id, $price);
502
+				$level_classes = apply_filters('give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-'.$price['_give_id']['level_id'].' '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'give-default-level' : ''), $form_id, $price);
503 503
 
504 504
 				$output .= '<li>';
505
-				$output .= '<button type="button" data-price-id="' . $price['_give_id']['level_id'] . '" class=" ' . $level_classes . '" value="' . give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ) . '">';
505
+				$output .= '<button type="button" data-price-id="'.$price['_give_id']['level_id'].'" class=" '.$level_classes.'" value="'.give_format_amount($price['_give_amount'], array('sanitize' => false)).'">';
506 506
 				$output .= $level_text;
507 507
 				$output .= '</button>';
508 508
 				$output .= '</li>';
@@ -510,7 +510,7 @@  discard block
 block discarded – undo
510 510
 			}
511 511
 
512 512
 			//Custom Amount.
513
-			if ( give_is_setting_enabled( $custom_amount ) && ! empty( $custom_amount_text ) ) {
513
+			if (give_is_setting_enabled($custom_amount) && ! empty($custom_amount_text)) {
514 514
 				$output .= '<li>';
515 515
 				$output .= '<button type="button" data-price-id="custom" class="give-donation-level-btn give-btn give-btn-level-custom" value="custom">';
516 516
 				$output .= $custom_amount_text;
@@ -526,22 +526,22 @@  discard block
 block discarded – undo
526 526
 
527 527
 			$output .= '<ul id="give-donation-level-radio-list" class="give-donation-levels-wrap">';
528 528
 
529
-			foreach ( $prices as $price ) {
530
-				$level_text    = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ) ), $form_id, $price );
531
-				$level_classes = apply_filters( 'give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-' . $price['_give_id']['level_id'] . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price );
529
+			foreach ($prices as $price) {
530
+				$level_text    = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'], array('sanitize' => false))), $form_id, $price);
531
+				$level_classes = apply_filters('give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-'.$price['_give_id']['level_id'].((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price);
532 532
 
533 533
 				$output .= '<li>';
534
-				$output .= '<input type="radio" data-price-id="' . $price['_give_id']['level_id'] . '" class="' . $level_classes . '" name="give-radio-donation-level" id="give-radio-level-' . $price['_give_id']['level_id'] . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'checked="checked"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ) . '">';
535
-				$output .= '<label for="give-radio-level-' . $price['_give_id']['level_id'] . '">' . $level_text . '</label>';
534
+				$output .= '<input type="radio" data-price-id="'.$price['_give_id']['level_id'].'" class="'.$level_classes.'" name="give-radio-donation-level" id="give-radio-level-'.$price['_give_id']['level_id'].'" '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'checked="checked"' : '').' value="'.give_format_amount($price['_give_amount'], array('sanitize' => false)).'">';
535
+				$output .= '<label for="give-radio-level-'.$price['_give_id']['level_id'].'">'.$level_text.'</label>';
536 536
 				$output .= '</li>';
537 537
 
538 538
 			}
539 539
 
540 540
 			//Custom Amount.
541
-			if ( give_is_setting_enabled( $custom_amount ) && ! empty( $custom_amount_text ) ) {
541
+			if (give_is_setting_enabled($custom_amount) && ! empty($custom_amount_text)) {
542 542
 				$output .= '<li>';
543 543
 				$output .= '<input type="radio" data-price-id="custom" class="give-radio-input give-radio-input-level give-radio-level-custom" name="give-radio-donation-level" id="give-radio-level-custom" value="custom">';
544
-				$output .= '<label for="give-radio-level-custom">' . $custom_amount_text . '</label>';
544
+				$output .= '<label for="give-radio-level-custom">'.$custom_amount_text.'</label>';
545 545
 				$output .= '</li>';
546 546
 			}
547 547
 
@@ -551,23 +551,23 @@  discard block
 block discarded – undo
551 551
 
552 552
 		case 'dropdown':
553 553
 
554
-			$output .= '<label for="give-donation-level-select-' . $form_id . '" class="give-hidden">' . esc_html__( 'Choose Your Donation Amount', 'give' ) . ':</label>';
555
-			$output .= '<select id="give-donation-level-select-' . $form_id . '" class="give-select give-select-level give-donation-levels-wrap">';
554
+			$output .= '<label for="give-donation-level-select-'.$form_id.'" class="give-hidden">'.esc_html__('Choose Your Donation Amount', 'give').':</label>';
555
+			$output .= '<select id="give-donation-level-select-'.$form_id.'" class="give-select give-select-level give-donation-levels-wrap">';
556 556
 
557 557
 			//first loop through prices.
558
-			foreach ( $prices as $price ) {
559
-				$level_text    = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ) ), $form_id, $price );
560
-				$level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-' . $price['_give_id']['level_id'] . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price );
558
+			foreach ($prices as $price) {
559
+				$level_text    = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'], array('sanitize' => false))), $form_id, $price);
560
+				$level_classes = apply_filters('give_form_level_classes', 'give-donation-level-'.$price['_give_id']['level_id'].((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price);
561 561
 
562
-				$output .= '<option data-price-id="' . $price['_give_id']['level_id'] . '" class="' . $level_classes . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'selected="selected"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ) . '">';
562
+				$output .= '<option data-price-id="'.$price['_give_id']['level_id'].'" class="'.$level_classes.'" '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'selected="selected"' : '').' value="'.give_format_amount($price['_give_amount'], array('sanitize' => false)).'">';
563 563
 				$output .= $level_text;
564 564
 				$output .= '</option>';
565 565
 
566 566
 			}
567 567
 
568 568
 			//Custom Amount.
569
-			if ( give_is_setting_enabled( $custom_amount ) && ! empty( $custom_amount_text ) ) {
570
-				$output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">' . $custom_amount_text . '</option>';
569
+			if (give_is_setting_enabled($custom_amount) && ! empty($custom_amount_text)) {
570
+				$output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">'.$custom_amount_text.'</option>';
571 571
 			}
572 572
 
573 573
 			$output .= '</select>';
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
 			break;
576 576
 	}
577 577
 
578
-	echo apply_filters( 'give_form_level_output', $output, $form_id );
578
+	echo apply_filters('give_form_level_output', $output, $form_id);
579 579
 }
580 580
 
581 581
 /**
@@ -590,27 +590,27 @@  discard block
 block discarded – undo
590 590
  *
591 591
  * @return string Checkout button.
592 592
  */
593
-function give_display_checkout_button( $form_id, $args ) {
593
+function give_display_checkout_button($form_id, $args) {
594 594
 
595
-	$display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) )
595
+	$display_option = (isset($args['display_style']) && ! empty($args['display_style']))
596 596
 		? $args['display_style']
597
-		: give_get_meta( $form_id, '_give_payment_display', true );
597
+		: give_get_meta($form_id, '_give_payment_display', true);
598 598
 
599
-	if ( 'button' === $display_option ) {
599
+	if ('button' === $display_option) {
600 600
 		$display_option = 'modal';
601
-	} elseif ( $display_option === 'onpage' ) {
601
+	} elseif ($display_option === 'onpage') {
602 602
 		return '';
603 603
 	}
604 604
 
605
-	$display_label_field = give_get_meta( $form_id, '_give_reveal_label', true );
606
-	$display_label       = ! empty( $args['continue_button_title'] ) ? $args['continue_button_title'] : ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) );
605
+	$display_label_field = give_get_meta($form_id, '_give_reveal_label', true);
606
+	$display_label       = ! empty($args['continue_button_title']) ? $args['continue_button_title'] : ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give'));
607 607
 
608
-	$output = '<button type="button" class="give-btn give-btn-' . $display_option . '">' . $display_label . '</button>';
608
+	$output = '<button type="button" class="give-btn give-btn-'.$display_option.'">'.$display_label.'</button>';
609 609
 
610
-	echo apply_filters( 'give_display_checkout_button', $output );
610
+	echo apply_filters('give_display_checkout_button', $output);
611 611
 }
612 612
 
613
-add_action( 'give_after_donation_levels', 'give_display_checkout_button', 10, 2 );
613
+add_action('give_after_donation_levels', 'give_display_checkout_button', 10, 2);
614 614
 
615 615
 /**
616 616
  * Shows the User Info fields in the Personal Info box, more fields can be added via the hooks provided.
@@ -623,55 +623,55 @@  discard block
 block discarded – undo
623 623
  *
624 624
  * @return void
625 625
  */
626
-function give_user_info_fields( $form_id ) {
626
+function give_user_info_fields($form_id) {
627 627
 	// Get user info.
628
-	$give_user_info = _give_get_prefill_form_field_values( $form_id );
628
+	$give_user_info = _give_get_prefill_form_field_values($form_id);
629 629
 
630 630
 	/**
631 631
 	 * Fire before user personal information fields
632 632
 	 *
633 633
 	 * @since 1.7
634 634
 	 */
635
-	do_action( 'give_donation_form_before_personal_info', $form_id );
635
+	do_action('give_donation_form_before_personal_info', $form_id);
636 636
 	?>
637 637
 	<fieldset id="give_checkout_user_info">
638
-		<legend><?php echo apply_filters( 'give_checkout_personal_info_text', __( 'Personal Info', 'give' ) ); ?></legend>
638
+		<legend><?php echo apply_filters('give_checkout_personal_info_text', __('Personal Info', 'give')); ?></legend>
639 639
 		<p id="give-first-name-wrap" class="form-row form-row-first form-row-responsive">
640 640
 			<label class="give-label" for="give-first">
641
-				<?php _e( 'First Name', 'give' ); ?>
642
-				<?php if ( give_field_is_required( 'give_first', $form_id ) ) : ?>
641
+				<?php _e('First Name', 'give'); ?>
642
+				<?php if (give_field_is_required('give_first', $form_id)) : ?>
643 643
 					<span class="give-required-indicator">*</span>
644 644
 				<?php endif ?>
645
-				<?php echo Give()->tooltips->render_help( __( 'We will use this to personalize your account experience.', 'give' ) ); ?>
645
+				<?php echo Give()->tooltips->render_help(__('We will use this to personalize your account experience.', 'give')); ?>
646 646
 			</label>
647 647
 			<input
648 648
 					class="give-input required"
649 649
 					type="text"
650 650
 					name="give_first"
651
-					placeholder="<?php _e( 'First Name', 'give' ); ?>"
651
+					placeholder="<?php _e('First Name', 'give'); ?>"
652 652
 					id="give-first"
653
-					value="<?php echo isset( $give_user_info['give_first'] ) ? $give_user_info['give_first'] : ''; ?>"
654
-				<?php echo( give_field_is_required( 'give_first', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
653
+					value="<?php echo isset($give_user_info['give_first']) ? $give_user_info['give_first'] : ''; ?>"
654
+				<?php echo(give_field_is_required('give_first', $form_id) ? ' required aria-required="true" ' : ''); ?>
655 655
 			/>
656 656
 		</p>
657 657
 
658 658
 		<p id="give-last-name-wrap" class="form-row form-row-last form-row-responsive">
659 659
 			<label class="give-label" for="give-last">
660
-				<?php _e( 'Last Name', 'give' ); ?>
661
-				<?php if ( give_field_is_required( 'give_last', $form_id ) ) : ?>
660
+				<?php _e('Last Name', 'give'); ?>
661
+				<?php if (give_field_is_required('give_last', $form_id)) : ?>
662 662
 					<span class="give-required-indicator">*</span>
663 663
 				<?php endif ?>
664
-				<?php echo Give()->tooltips->render_help( __( 'We will use this as well to personalize your account experience.', 'give' ) ); ?>
664
+				<?php echo Give()->tooltips->render_help(__('We will use this as well to personalize your account experience.', 'give')); ?>
665 665
 			</label>
666 666
 
667 667
 			<input
668
-					class="give-input<?php echo( give_field_is_required( 'give_last', $form_id ) ? ' required' : '' ); ?>"
668
+					class="give-input<?php echo(give_field_is_required('give_last', $form_id) ? ' required' : ''); ?>"
669 669
 					type="text"
670 670
 					name="give_last"
671 671
 					id="give-last"
672
-					placeholder="<?php _e( 'Last Name', 'give' ); ?>"
673
-					value="<?php echo isset( $give_user_info['give_last'] ) ? $give_user_info['give_last'] : ''; ?>"
674
-				<?php echo( give_field_is_required( 'give_last', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
672
+					placeholder="<?php _e('Last Name', 'give'); ?>"
673
+					value="<?php echo isset($give_user_info['give_last']) ? $give_user_info['give_last'] : ''; ?>"
674
+				<?php echo(give_field_is_required('give_last', $form_id) ? ' required aria-required="true" ' : ''); ?>
675 675
 			/>
676 676
 		</p>
677 677
 
@@ -681,25 +681,25 @@  discard block
 block discarded – undo
681 681
 		 *
682 682
 		 * @since 1.7
683 683
 		 */
684
-		do_action( 'give_donation_form_before_email', $form_id );
684
+		do_action('give_donation_form_before_email', $form_id);
685 685
 		?>
686 686
 		<p id="give-email-wrap" class="form-row form-row-wide">
687 687
 			<label class="give-label" for="give-email">
688
-				<?php _e( 'Email Address', 'give' ); ?>
689
-				<?php if ( give_field_is_required( 'give_email', $form_id ) ) { ?>
688
+				<?php _e('Email Address', 'give'); ?>
689
+				<?php if (give_field_is_required('give_email', $form_id)) { ?>
690 690
 					<span class="give-required-indicator">*</span>
691 691
 				<?php } ?>
692
-				<?php echo Give()->tooltips->render_help( __( 'We will send the donation receipt to this address.', 'give' ) ); ?>
692
+				<?php echo Give()->tooltips->render_help(__('We will send the donation receipt to this address.', 'give')); ?>
693 693
 			</label>
694 694
 
695 695
 			<input
696 696
 					class="give-input required"
697 697
 					type="email"
698 698
 					name="give_email"
699
-					placeholder="<?php _e( 'Email Address', 'give' ); ?>"
699
+					placeholder="<?php _e('Email Address', 'give'); ?>"
700 700
 					id="give-email"
701
-					value="<?php echo isset( $give_user_info['give_email'] ) ? $give_user_info['give_email'] : ''; ?>"
702
-				<?php echo( give_field_is_required( 'give_email', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
701
+					value="<?php echo isset($give_user_info['give_email']) ? $give_user_info['give_email'] : ''; ?>"
702
+				<?php echo(give_field_is_required('give_email', $form_id) ? ' required aria-required="true" ' : ''); ?>
703 703
 			/>
704 704
 
705 705
 		</p>
@@ -709,14 +709,14 @@  discard block
 block discarded – undo
709 709
 		 *
710 710
 		 * @since 1.7
711 711
 		 */
712
-		do_action( 'give_donation_form_after_email', $form_id );
712
+		do_action('give_donation_form_after_email', $form_id);
713 713
 
714 714
 		/**
715 715
 		 * Fire after personal email field
716 716
 		 *
717 717
 		 * @since 1.7
718 718
 		 */
719
-		do_action( 'give_donation_form_user_info', $form_id );
719
+		do_action('give_donation_form_user_info', $form_id);
720 720
 		?>
721 721
 	</fieldset>
722 722
 	<?php
@@ -725,11 +725,11 @@  discard block
 block discarded – undo
725 725
 	 *
726 726
 	 * @since 1.7
727 727
 	 */
728
-	do_action( 'give_donation_form_after_personal_info', $form_id );
728
+	do_action('give_donation_form_after_personal_info', $form_id);
729 729
 }
730 730
 
731
-add_action( 'give_donation_form_after_user_info', 'give_user_info_fields' );
732
-add_action( 'give_register_fields_before', 'give_user_info_fields' );
731
+add_action('give_donation_form_after_user_info', 'give_user_info_fields');
732
+add_action('give_register_fields_before', 'give_user_info_fields');
733 733
 
734 734
 /**
735 735
  * Renders the credit card info form.
@@ -740,7 +740,7 @@  discard block
 block discarded – undo
740 740
  *
741 741
  * @return void
742 742
  */
743
-function give_get_cc_form( $form_id ) {
743
+function give_get_cc_form($form_id) {
744 744
 
745 745
 	ob_start();
746 746
 
@@ -751,50 +751,50 @@  discard block
 block discarded – undo
751 751
 	 *
752 752
 	 * @param int $form_id The form ID.
753 753
 	 */
754
-	do_action( 'give_before_cc_fields', $form_id );
754
+	do_action('give_before_cc_fields', $form_id);
755 755
 	?>
756 756
 	<fieldset id="give_cc_fields-<?php echo $form_id ?>" class="give-do-validate">
757
-		<legend><?php echo apply_filters( 'give_credit_card_fieldset_heading', esc_html__( 'Credit Card Info', 'give' ) ); ?></legend>
758
-		<?php if ( is_ssl() ) : ?>
757
+		<legend><?php echo apply_filters('give_credit_card_fieldset_heading', esc_html__('Credit Card Info', 'give')); ?></legend>
758
+		<?php if (is_ssl()) : ?>
759 759
 			<div id="give_secure_site_wrapper-<?php echo $form_id ?>">
760 760
 				<span class="give-icon padlock"></span>
761
-				<span><?php _e( 'This is a secure SSL encrypted payment.', 'give' ); ?></span>
761
+				<span><?php _e('This is a secure SSL encrypted payment.', 'give'); ?></span>
762 762
 			</div>
763 763
 		<?php endif; ?>
764 764
 		<p id="give-card-number-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds form-row-responsive">
765 765
 			<label for="card_number-<?php echo $form_id ?>" class="give-label">
766
-				<?php _e( 'Card Number', 'give' ); ?>
766
+				<?php _e('Card Number', 'give'); ?>
767 767
 				<span class="give-required-indicator">*</span>
768
-				<?php echo Give()->tooltips->render_help( __( 'The (typically) 16 digits on the front of your credit card.', 'give' ) ); ?>
768
+				<?php echo Give()->tooltips->render_help(__('The (typically) 16 digits on the front of your credit card.', 'give')); ?>
769 769
 				<span class="card-type"></span>
770 770
 			</label>
771 771
 
772 772
 			<input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>"
773
-				   class="card-number give-input required" placeholder="<?php _e( 'Card number', 'give' ); ?>"
773
+				   class="card-number give-input required" placeholder="<?php _e('Card number', 'give'); ?>"
774 774
 				   required aria-required="true"/>
775 775
 		</p>
776 776
 
777 777
 		<p id="give-card-cvc-wrap-<?php echo $form_id ?>" class="form-row form-row-one-third form-row-responsive">
778 778
 			<label for="card_cvc-<?php echo $form_id ?>" class="give-label">
779
-				<?php _e( 'CVC', 'give' ); ?>
779
+				<?php _e('CVC', 'give'); ?>
780 780
 				<span class="give-required-indicator">*</span>
781
-				<?php echo Give()->tooltips->render_help( __( 'The 3 digit (back) or 4 digit (front) value on your card.', 'give' ) ); ?>
781
+				<?php echo Give()->tooltips->render_help(__('The 3 digit (back) or 4 digit (front) value on your card.', 'give')); ?>
782 782
 			</label>
783 783
 
784 784
 			<input type="tel" size="4" autocomplete="off" name="card_cvc" id="card_cvc-<?php echo $form_id ?>"
785
-				   class="card-cvc give-input required" placeholder="<?php _e( 'Security code', 'give' ); ?>"
785
+				   class="card-cvc give-input required" placeholder="<?php _e('Security code', 'give'); ?>"
786 786
 				   required aria-required="true"/>
787 787
 		</p>
788 788
 
789 789
 		<p id="give-card-name-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds form-row-responsive">
790 790
 			<label for="card_name-<?php echo $form_id ?>" class="give-label">
791
-				<?php _e( 'Name on the Card', 'give' ); ?>
791
+				<?php _e('Name on the Card', 'give'); ?>
792 792
 				<span class="give-required-indicator">*</span>
793
-				<?php echo Give()->tooltips->render_help( __( 'The name printed on the front of your credit card.', 'give' ) ); ?>
793
+				<?php echo Give()->tooltips->render_help(__('The name printed on the front of your credit card.', 'give')); ?>
794 794
 			</label>
795 795
 
796 796
 			<input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>"
797
-				   class="card-name give-input required" placeholder="<?php esc_attr_e( 'Card name', 'give' ); ?>"
797
+				   class="card-name give-input required" placeholder="<?php esc_attr_e('Card name', 'give'); ?>"
798 798
 				   required aria-required="true"/>
799 799
 		</p>
800 800
 		<?php
@@ -805,19 +805,19 @@  discard block
 block discarded – undo
805 805
 		 *
806 806
 		 * @param int $form_id The form ID.
807 807
 		 */
808
-		do_action( 'give_before_cc_expiration' );
808
+		do_action('give_before_cc_expiration');
809 809
 		?>
810 810
 		<p class="card-expiration form-row form-row-one-third form-row-responsive">
811 811
 			<label for="card_expiry-<?php echo $form_id ?>" class="give-label">
812
-				<?php _e( 'Expiration', 'give' ); ?>
812
+				<?php _e('Expiration', 'give'); ?>
813 813
 				<span class="give-required-indicator">*</span>
814
-				<?php echo Give()->tooltips->render_help( __( 'The date your credit card expires, typically on the front of the card.', 'give' ) ); ?>
814
+				<?php echo Give()->tooltips->render_help(__('The date your credit card expires, typically on the front of the card.', 'give')); ?>
815 815
 			</label>
816 816
 
817 817
 			<input type="hidden" id="card_exp_month-<?php echo $form_id ?>" name="card_exp_month" class="card-expiry-month"/>
818 818
 			<input type="hidden" id="card_exp_year-<?php echo $form_id ?>" name="card_exp_year" class="card-expiry-year"/>
819 819
 
820
-			<input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>" class="card-expiry give-input required" placeholder="<?php esc_attr_e( 'MM / YY', 'give' ); ?>" required aria-required="true"/>
820
+			<input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>" class="card-expiry give-input required" placeholder="<?php esc_attr_e('MM / YY', 'give'); ?>" required aria-required="true"/>
821 821
 		</p>
822 822
 		<?php
823 823
 		/**
@@ -827,7 +827,7 @@  discard block
 block discarded – undo
827 827
 		 *
828 828
 		 * @param int $form_id The form ID.
829 829
 		 */
830
-		do_action( 'give_after_cc_expiration', $form_id );
830
+		do_action('give_after_cc_expiration', $form_id);
831 831
 		?>
832 832
 	</fieldset>
833 833
 	<?php
@@ -838,12 +838,12 @@  discard block
 block discarded – undo
838 838
 	 *
839 839
 	 * @param int $form_id The form ID.
840 840
 	 */
841
-	do_action( 'give_after_cc_fields', $form_id );
841
+	do_action('give_after_cc_fields', $form_id);
842 842
 
843 843
 	echo ob_get_clean();
844 844
 }
845 845
 
846
-add_action( 'give_cc_form', 'give_get_cc_form' );
846
+add_action('give_cc_form', 'give_get_cc_form');
847 847
 
848 848
 /**
849 849
  * Outputs the default credit card address fields.
@@ -854,20 +854,20 @@  discard block
 block discarded – undo
854 854
  *
855 855
  * @return void
856 856
  */
857
-function give_default_cc_address_fields( $form_id ) {
857
+function give_default_cc_address_fields($form_id) {
858 858
 	// Get user info.
859
-	$give_user_info = _give_get_prefill_form_field_values( $form_id );
859
+	$give_user_info = _give_get_prefill_form_field_values($form_id);
860 860
 
861 861
 	$logged_in = is_user_logged_in();
862 862
 
863
-	if ( $logged_in ) {
864
-		$user_address = give_get_donor_address( get_current_user_id() );
863
+	if ($logged_in) {
864
+		$user_address = give_get_donor_address(get_current_user_id());
865 865
 	}
866 866
 
867 867
 	ob_start();
868 868
 	?>
869 869
 	<fieldset id="give_cc_address" class="cc-address">
870
-		<legend><?php echo apply_filters( 'give_billing_details_fieldset_heading', esc_html__( 'Billing Details', 'give' ) ); ?></legend>
870
+		<legend><?php echo apply_filters('give_billing_details_fieldset_heading', esc_html__('Billing Details', 'give')); ?></legend>
871 871
 		<?php
872 872
 		/**
873 873
 		 * Fires while rendering credit card billing form, before address fields.
@@ -876,36 +876,36 @@  discard block
 block discarded – undo
876 876
 		 *
877 877
 		 * @param int $form_id The form ID.
878 878
 		 */
879
-		do_action( 'give_cc_billing_top' );
879
+		do_action('give_cc_billing_top');
880 880
 
881 881
 		// For Country.
882 882
 		$selected_country = give_get_country();
883
-		if ( ! empty( $give_user_info['billing_country'] ) && '*' !== $give_user_info['billing_country'] ) {
883
+		if ( ! empty($give_user_info['billing_country']) && '*' !== $give_user_info['billing_country']) {
884 884
 			$selected_country = $give_user_info['billing_country'];
885 885
 		}
886 886
 		$countries = give_get_country_list();
887 887
 
888 888
 		// For state
889 889
 		$selected_state = '';
890
-		if ( $selected_country === give_get_country() ) {
890
+		if ($selected_country === give_get_country()) {
891 891
 			// Get defalut selected state by admin.
892 892
 			$selected_state = give_get_state();
893 893
 		}
894 894
 		// Get the last payment made by user states.
895
-		if ( ! empty( $give_user_info['card_state'] ) && '*' !== $give_user_info['card_state'] ) {
895
+		if ( ! empty($give_user_info['card_state']) && '*' !== $give_user_info['card_state']) {
896 896
 			$selected_state = $give_user_info['card_state'];
897 897
 		}
898 898
 		// Get the country code
899
-		if ( ! empty( $give_user_info['billing_country'] ) && '*' !== $give_user_info['billing_country'] ) {
899
+		if ( ! empty($give_user_info['billing_country']) && '*' !== $give_user_info['billing_country']) {
900 900
 			$selected_country = $give_user_info['billing_country'];
901 901
 		}
902
-		$label        = __( 'State', 'give' );
902
+		$label        = __('State', 'give');
903 903
 		$states_label = give_get_states_label();
904 904
 		// Check if $country code exists in the array key for states label.
905
-		if ( array_key_exists( $selected_country, $states_label ) ) {
906
-			$label = $states_label[ $selected_country ];
905
+		if (array_key_exists($selected_country, $states_label)) {
906
+			$label = $states_label[$selected_country];
907 907
 		}
908
-		$states = give_get_states( $selected_country );
908
+		$states = give_get_states($selected_country);
909 909
 		// Get the country list that do not have any states init.
910 910
 		$no_states_country = give_no_states_country_list();
911 911
 		// Get the country list that does not require states.
@@ -913,23 +913,23 @@  discard block
 block discarded – undo
913 913
 		?>
914 914
 	    <p id="give-card-country-wrap" class="form-row form-row-wide">
915 915
 		    <label for="billing_country" class="give-label">
916
-			    <?php esc_html_e( 'Country', 'give' ); ?>
917
-			    <?php if ( give_field_is_required( 'billing_country', $form_id ) ) : ?>
916
+			    <?php esc_html_e('Country', 'give'); ?>
917
+			    <?php if (give_field_is_required('billing_country', $form_id)) : ?>
918 918
 				    <span class="give-required-indicator">*</span>
919 919
 			    <?php endif; ?>
920 920
 			    <span class="give-tooltip give-icon give-icon-question"
921
-			          data-tooltip="<?php esc_attr_e( 'The country for your billing address.', 'give' ); ?>"></span>
921
+			          data-tooltip="<?php esc_attr_e('The country for your billing address.', 'give'); ?>"></span>
922 922
 		    </label>
923 923
 
924 924
 		    <select
925 925
 				    name="billing_country"
926 926
 				    id="billing_country"
927
-				    class="billing-country billing_country give-select<?php echo( give_field_is_required( 'billing_country', $form_id ) ? ' required' : '' ); ?>"
928
-			    <?php echo( give_field_is_required( 'billing_country', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
927
+				    class="billing-country billing_country give-select<?php echo(give_field_is_required('billing_country', $form_id) ? ' required' : ''); ?>"
928
+			    <?php echo(give_field_is_required('billing_country', $form_id) ? ' required aria-required="true" ' : ''); ?>
929 929
 		    >
930 930
 			    <?php
931
-			    foreach ( $countries as $country_code => $country ) {
932
-				    echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>';
931
+			    foreach ($countries as $country_code => $country) {
932
+				    echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>';
933 933
 			    }
934 934
 			    ?>
935 935
 		    </select>
@@ -937,86 +937,86 @@  discard block
 block discarded – undo
937 937
 
938 938
 		<p id="give-card-address-wrap" class="form-row form-row-wide">
939 939
 			<label for="card_address" class="give-label">
940
-				<?php _e( 'Address 1', 'give' ); ?>
940
+				<?php _e('Address 1', 'give'); ?>
941 941
 				<?php
942
-				if ( give_field_is_required( 'card_address', $form_id ) ) : ?>
942
+				if (give_field_is_required('card_address', $form_id)) : ?>
943 943
 					<span class="give-required-indicator">*</span>
944 944
 				<?php endif; ?>
945
-				<?php echo Give()->tooltips->render_help( __( 'The primary billing address for your credit card.', 'give' ) ); ?>
945
+				<?php echo Give()->tooltips->render_help(__('The primary billing address for your credit card.', 'give')); ?>
946 946
 			</label>
947 947
 
948 948
 			<input
949 949
 					type="text"
950 950
 					id="card_address"
951 951
 					name="card_address"
952
-					class="card-address give-input<?php echo( give_field_is_required( 'card_address', $form_id ) ? ' required' : '' ); ?>"
953
-					placeholder="<?php _e( 'Address line 1', 'give' ); ?>"
954
-					value="<?php echo isset( $give_user_info['card_address'] ) ? $give_user_info['card_address'] : ''; ?>"
955
-				<?php echo( give_field_is_required( 'card_address', $form_id ) ? '  required aria-required="true" ' : '' ); ?>
952
+					class="card-address give-input<?php echo(give_field_is_required('card_address', $form_id) ? ' required' : ''); ?>"
953
+					placeholder="<?php _e('Address line 1', 'give'); ?>"
954
+					value="<?php echo isset($give_user_info['card_address']) ? $give_user_info['card_address'] : ''; ?>"
955
+				<?php echo(give_field_is_required('card_address', $form_id) ? '  required aria-required="true" ' : ''); ?>
956 956
 			/>
957 957
 		</p>
958 958
 
959 959
 		<p id="give-card-address-2-wrap" class="form-row form-row-wide">
960 960
 			<label for="card_address_2" class="give-label">
961
-				<?php _e( 'Address 2', 'give' ); ?>
962
-				<?php if ( give_field_is_required( 'card_address_2', $form_id ) ) : ?>
961
+				<?php _e('Address 2', 'give'); ?>
962
+				<?php if (give_field_is_required('card_address_2', $form_id)) : ?>
963 963
 					<span class="give-required-indicator">*</span>
964 964
 				<?php endif; ?>
965
-				<?php echo Give()->tooltips->render_help( __( '(optional) The suite, apartment number, post office box (etc) associated with your billing address.', 'give' ) ); ?>
965
+				<?php echo Give()->tooltips->render_help(__('(optional) The suite, apartment number, post office box (etc) associated with your billing address.', 'give')); ?>
966 966
 			</label>
967 967
 
968 968
 			<input
969 969
 					type="text"
970 970
 					id="card_address_2"
971 971
 					name="card_address_2"
972
-					class="card-address-2 give-input<?php echo( give_field_is_required( 'card_address_2', $form_id ) ? ' required' : '' ); ?>"
973
-					placeholder="<?php _e( 'Address line 2', 'give' ); ?>"
974
-					value="<?php echo isset( $give_user_info['card_address_2'] ) ? $give_user_info['card_address_2'] : ''; ?>"
975
-				<?php echo( give_field_is_required( 'card_address_2', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
972
+					class="card-address-2 give-input<?php echo(give_field_is_required('card_address_2', $form_id) ? ' required' : ''); ?>"
973
+					placeholder="<?php _e('Address line 2', 'give'); ?>"
974
+					value="<?php echo isset($give_user_info['card_address_2']) ? $give_user_info['card_address_2'] : ''; ?>"
975
+				<?php echo(give_field_is_required('card_address_2', $form_id) ? ' required aria-required="true" ' : ''); ?>
976 976
 			/>
977 977
 		</p>
978 978
 
979 979
 		<p id="give-card-city-wrap" class="form-row form-row-wide">
980 980
 			<label for="card_city" class="give-label">
981
-				<?php _e( 'City', 'give' ); ?>
982
-				<?php if ( give_field_is_required( 'card_city', $form_id ) ) : ?>
981
+				<?php _e('City', 'give'); ?>
982
+				<?php if (give_field_is_required('card_city', $form_id)) : ?>
983 983
 					<span class="give-required-indicator">*</span>
984 984
 				<?php endif; ?>
985
-				<?php echo Give()->tooltips->render_help( __( 'The city for your billing address.', 'give' ) ); ?>
985
+				<?php echo Give()->tooltips->render_help(__('The city for your billing address.', 'give')); ?>
986 986
 			</label>
987 987
 			<input
988 988
 					type="text"
989 989
 					id="card_city"
990 990
 					name="card_city"
991
-					class="card-city give-input<?php echo( give_field_is_required( 'card_city', $form_id ) ? ' required' : '' ); ?>"
992
-					placeholder="<?php _e( 'City', 'give' ); ?>"
993
-					value="<?php echo isset( $give_user_info['card_city'] ) ? $give_user_info['card_city'] : ''; ?>"
994
-				<?php echo( give_field_is_required( 'card_city', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
991
+					class="card-city give-input<?php echo(give_field_is_required('card_city', $form_id) ? ' required' : ''); ?>"
992
+					placeholder="<?php _e('City', 'give'); ?>"
993
+					value="<?php echo isset($give_user_info['card_city']) ? $give_user_info['card_city'] : ''; ?>"
994
+				<?php echo(give_field_is_required('card_city', $form_id) ? ' required aria-required="true" ' : ''); ?>
995 995
 			/>
996 996
 		</p>
997 997
 
998 998
 	    <p id="give-card-state-wrap"
999
-	       class="form-row form-row-first form-row-responsive <?php echo ( ! empty( $selected_country ) && array_key_exists( $selected_country, $no_states_country ) ) ? 'give-hidden' : ''; ?> ">
999
+	       class="form-row form-row-first form-row-responsive <?php echo ( ! empty($selected_country) && array_key_exists($selected_country, $no_states_country)) ? 'give-hidden' : ''; ?> ">
1000 1000
 		    <label for="card_state" class="give-label">
1001 1001
 			    <span class="state-label-text"><?php echo $label; ?></span>
1002
-			    <?php if ( give_field_is_required( 'card_state', $form_id ) ) :
1002
+			    <?php if (give_field_is_required('card_state', $form_id)) :
1003 1003
 				    ?>
1004
-				    <span class="give-required-indicator <?php echo( array_key_exists( $selected_country, $states_not_required_country_list ) ? 'give-hidden' : '' ) ?> ">*</span>
1004
+				    <span class="give-required-indicator <?php echo(array_key_exists($selected_country, $states_not_required_country_list) ? 'give-hidden' : '') ?> ">*</span>
1005 1005
 			    <?php endif; ?>
1006 1006
 			    <span class="give-tooltip give-icon give-icon-question"
1007
-			          data-tooltip="<?php esc_attr_e( 'The state, province, or county for your billing address.', 'give' ); ?>"></span>
1007
+			          data-tooltip="<?php esc_attr_e('The state, province, or county for your billing address.', 'give'); ?>"></span>
1008 1008
 		    </label>
1009 1009
 		    <?php
1010 1010
 
1011
-		    if ( ! empty( $states ) ) : ?>
1011
+		    if ( ! empty($states)) : ?>
1012 1012
 			    <select
1013 1013
 					    name="card_state"
1014 1014
 					    id="card_state"
1015
-					    class="card_state give-select<?php echo( give_field_is_required( 'card_state', $form_id ) ? ' required' : '' ); ?>"
1016
-				    <?php echo( give_field_is_required( 'card_state', $form_id ) ? ' required aria-required="true" ' : '' ); ?>>
1015
+					    class="card_state give-select<?php echo(give_field_is_required('card_state', $form_id) ? ' required' : ''); ?>"
1016
+				    <?php echo(give_field_is_required('card_state', $form_id) ? ' required aria-required="true" ' : ''); ?>>
1017 1017
 				    <?php
1018
-				    foreach ( $states as $state_code => $state ) {
1019
-					    echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>';
1018
+				    foreach ($states as $state_code => $state) {
1019
+					    echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>';
1020 1020
 				    }
1021 1021
 				    ?>
1022 1022
 			    </select>
@@ -1028,11 +1028,11 @@  discard block
 block discarded – undo
1028 1028
 
1029 1029
 		<p id="give-card-zip-wrap" class="form-row form-row-last form-row-responsive">
1030 1030
 			<label for="card_zip" class="give-label">
1031
-				<?php _e( 'Zip / Postal Code', 'give' ); ?>
1032
-				<?php if ( give_field_is_required( 'card_zip', $form_id ) ) : ?>
1031
+				<?php _e('Zip / Postal Code', 'give'); ?>
1032
+				<?php if (give_field_is_required('card_zip', $form_id)) : ?>
1033 1033
 					<span class="give-required-indicator">*</span>
1034 1034
 				<?php endif; ?>
1035
-				<?php echo Give()->tooltips->render_help( __( 'The ZIP Code or postal code for your billing address.', 'give' ) ); ?>
1035
+				<?php echo Give()->tooltips->render_help(__('The ZIP Code or postal code for your billing address.', 'give')); ?>
1036 1036
 			</label>
1037 1037
 
1038 1038
 			<input
@@ -1040,10 +1040,10 @@  discard block
 block discarded – undo
1040 1040
 					size="4"
1041 1041
 					id="card_zip"
1042 1042
 					name="card_zip"
1043
-					class="card-zip give-input<?php echo( give_field_is_required( 'card_zip', $form_id ) ? ' required' : '' ); ?>"
1044
-					placeholder="<?php _e( 'Zip / Postal Code', 'give' ); ?>"
1045
-					value="<?php echo isset( $give_user_info['card_zip'] ) ? $give_user_info['card_zip'] : ''; ?>"
1046
-				<?php echo( give_field_is_required( 'card_zip', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
1043
+					class="card-zip give-input<?php echo(give_field_is_required('card_zip', $form_id) ? ' required' : ''); ?>"
1044
+					placeholder="<?php _e('Zip / Postal Code', 'give'); ?>"
1045
+					value="<?php echo isset($give_user_info['card_zip']) ? $give_user_info['card_zip'] : ''; ?>"
1046
+				<?php echo(give_field_is_required('card_zip', $form_id) ? ' required aria-required="true" ' : ''); ?>
1047 1047
 			/>
1048 1048
 		</p>
1049 1049
 		<?php
@@ -1054,14 +1054,14 @@  discard block
 block discarded – undo
1054 1054
 		 *
1055 1055
 		 * @param int $form_id The form ID.
1056 1056
 		 */
1057
-		do_action( 'give_cc_billing_bottom' );
1057
+		do_action('give_cc_billing_bottom');
1058 1058
 		?>
1059 1059
 	</fieldset>
1060 1060
 	<?php
1061 1061
 	echo ob_get_clean();
1062 1062
 }
1063 1063
 
1064
-add_action( 'give_after_cc_fields', 'give_default_cc_address_fields' );
1064
+add_action('give_after_cc_fields', 'give_default_cc_address_fields');
1065 1065
 
1066 1066
 
1067 1067
 /**
@@ -1074,15 +1074,15 @@  discard block
 block discarded – undo
1074 1074
  *
1075 1075
  * @return string
1076 1076
  */
1077
-function give_get_register_fields( $form_id ) {
1077
+function give_get_register_fields($form_id) {
1078 1078
 
1079 1079
 	global $user_ID;
1080 1080
 
1081
-	if ( is_user_logged_in() ) {
1082
-		$user_data = get_userdata( $user_ID );
1081
+	if (is_user_logged_in()) {
1082
+		$user_data = get_userdata($user_ID);
1083 1083
 	}
1084 1084
 
1085
-	$show_register_form = give_show_login_register_option( $form_id );
1085
+	$show_register_form = give_show_login_register_option($form_id);
1086 1086
 
1087 1087
 	ob_start(); ?>
1088 1088
 	<fieldset id="give-register-fields-<?php echo $form_id; ?>">
@@ -1095,7 +1095,7 @@  discard block
 block discarded – undo
1095 1095
 		 *
1096 1096
 		 * @param int $form_id The form ID.
1097 1097
 		 */
1098
-		do_action( 'give_register_fields_before', $form_id );
1098
+		do_action('give_register_fields_before', $form_id);
1099 1099
 		?>
1100 1100
 
1101 1101
 		<fieldset id="give-register-account-fields-<?php echo $form_id; ?>">
@@ -1107,22 +1107,22 @@  discard block
 block discarded – undo
1107 1107
 			 *
1108 1108
 			 * @param int $form_id The form ID.
1109 1109
 			 */
1110
-			do_action( 'give_register_account_fields_before', $form_id );
1110
+			do_action('give_register_account_fields_before', $form_id);
1111 1111
 			?>
1112 1112
 			<div id="give-create-account-wrap-<?php echo $form_id; ?>" class="form-row form-row-first form-row-responsive">
1113 1113
 				<label for="give-create-account-<?php echo $form_id; ?>">
1114 1114
 					<?php
1115 1115
 					// Add attributes to checkbox, if Guest Checkout is disabled.
1116
-					$is_guest_checkout = give_get_meta( $form_id, '_give_logged_in_only', true );
1117
-					$id                = 'give-create-account-' . $form_id;
1118
-					if ( ! give_is_setting_enabled( $is_guest_checkout ) ) {
1116
+					$is_guest_checkout = give_get_meta($form_id, '_give_logged_in_only', true);
1117
+					$id                = 'give-create-account-'.$form_id;
1118
+					if ( ! give_is_setting_enabled($is_guest_checkout)) {
1119 1119
 						echo Give()->tooltips->render(
1120 1120
 							array(
1121 1121
 								'tag_content' => sprintf(
1122 1122
 									'<input type="checkbox" name="give_create_account" value="on" id="%s" class="give-input give-disabled" checked />',
1123 1123
 									$id
1124 1124
 								),
1125
-								'label'       => __( 'Registration is required to donate.', 'give' ),
1125
+								'label'       => __('Registration is required to donate.', 'give'),
1126 1126
 							) );
1127 1127
 					} else {
1128 1128
 						?>
@@ -1130,16 +1130,16 @@  discard block
 block discarded – undo
1130 1130
 						<?php
1131 1131
 					}
1132 1132
 					?>
1133
-					<?php _e( 'Create an account', 'give' ); ?>
1134
-					<?php echo Give()->tooltips->render_help( __( 'Create an account on the site to see and manage donation history.', 'give' ) ); ?>
1133
+					<?php _e('Create an account', 'give'); ?>
1134
+					<?php echo Give()->tooltips->render_help(__('Create an account on the site to see and manage donation history.', 'give')); ?>
1135 1135
 				</label>
1136 1136
 			</div>
1137 1137
 
1138
-			<?php if ( 'both' === $show_register_form ) { ?>
1138
+			<?php if ('both' === $show_register_form) { ?>
1139 1139
 				<div class="give-login-account-wrap form-row form-row-last form-row-responsive">
1140
-					<p class="give-login-message"><?php esc_html_e( 'Already have an account?', 'give' ); ?>&nbsp;
1141
-						<a href="<?php echo esc_url( add_query_arg( 'login', 1 ) ); ?>" class="give-checkout-login"
1142
-						   data-action="give_checkout_login"><?php esc_html_e( 'Login', 'give' ); ?></a>
1140
+					<p class="give-login-message"><?php esc_html_e('Already have an account?', 'give'); ?>&nbsp;
1141
+						<a href="<?php echo esc_url(add_query_arg('login', 1)); ?>" class="give-checkout-login"
1142
+						   data-action="give_checkout_login"><?php esc_html_e('Login', 'give'); ?></a>
1143 1143
 					</p>
1144 1144
 					<p class="give-loading-text">
1145 1145
 						<span class="give-loading-animation"></span>
@@ -1155,7 +1155,7 @@  discard block
 block discarded – undo
1155 1155
 			 *
1156 1156
 			 * @param int $form_id The form ID.
1157 1157
 			 */
1158
-			do_action( 'give_register_account_fields_after', $form_id );
1158
+			do_action('give_register_account_fields_after', $form_id);
1159 1159
 			?>
1160 1160
 		</fieldset>
1161 1161
 
@@ -1167,7 +1167,7 @@  discard block
 block discarded – undo
1167 1167
 		 *
1168 1168
 		 * @param int $form_id The form ID.
1169 1169
 		 */
1170
-		do_action( 'give_register_fields_after', $form_id );
1170
+		do_action('give_register_fields_after', $form_id);
1171 1171
 		?>
1172 1172
 
1173 1173
 		<input type="hidden" name="give-purchase-var" value="needs-to-register"/>
@@ -1178,7 +1178,7 @@  discard block
 block discarded – undo
1178 1178
 		 *
1179 1179
 		 * @since 1.7
1180 1180
 		 */
1181
-		do_action( 'give_donation_form_user_info', $form_id );
1181
+		do_action('give_donation_form_user_info', $form_id);
1182 1182
 		?>
1183 1183
 
1184 1184
 	</fieldset>
@@ -1186,7 +1186,7 @@  discard block
 block discarded – undo
1186 1186
 	echo ob_get_clean();
1187 1187
 }
1188 1188
 
1189
-add_action( 'give_donation_form_register_fields', 'give_get_register_fields' );
1189
+add_action('give_donation_form_register_fields', 'give_get_register_fields');
1190 1190
 
1191 1191
 /**
1192 1192
  * Gets the login fields for the login form on the checkout. This function hooks
@@ -1199,27 +1199,27 @@  discard block
 block discarded – undo
1199 1199
  *
1200 1200
  * @return string
1201 1201
  */
1202
-function give_get_login_fields( $form_id ) {
1202
+function give_get_login_fields($form_id) {
1203 1203
 
1204
-	$form_id            = isset( $_POST['form_id'] ) ? $_POST['form_id'] : $form_id;
1205
-	$show_register_form = give_show_login_register_option( $form_id );
1204
+	$form_id            = isset($_POST['form_id']) ? $_POST['form_id'] : $form_id;
1205
+	$show_register_form = give_show_login_register_option($form_id);
1206 1206
 
1207 1207
 	ob_start();
1208 1208
 	?>
1209 1209
 	<fieldset id="give-login-fields-<?php echo $form_id; ?>">
1210
-		<legend><?php echo apply_filters( 'give_account_login_fieldset_heading', __( 'Login to Your Account', 'give' ) );
1211
-			if ( ! give_logged_in_only( $form_id ) ) {
1212
-				echo ' <span class="sub-text">' . __( '(optional)', 'give' ) . '</span>';
1210
+		<legend><?php echo apply_filters('give_account_login_fieldset_heading', __('Login to Your Account', 'give'));
1211
+			if ( ! give_logged_in_only($form_id)) {
1212
+				echo ' <span class="sub-text">'.__('(optional)', 'give').'</span>';
1213 1213
 			} ?>
1214 1214
 		</legend>
1215
-		<?php if ( $show_register_form == 'both' ) { ?>
1215
+		<?php if ($show_register_form == 'both') { ?>
1216 1216
 			<p class="give-new-account-link">
1217
-				<?php _e( 'Need to create an account?', 'give' ); ?>&nbsp;
1218
-				<a href="<?php echo remove_query_arg( 'login' ); ?>" class="give-checkout-register-cancel"
1217
+				<?php _e('Need to create an account?', 'give'); ?>&nbsp;
1218
+				<a href="<?php echo remove_query_arg('login'); ?>" class="give-checkout-register-cancel"
1219 1219
 				   data-action="give_checkout_register">
1220
-					<?php _e( 'Register', 'give' );
1221
-					if ( ! give_logged_in_only( $form_id ) ) {
1222
-						echo ' ' . __( 'and donate as a guest &raquo;', 'give' );
1220
+					<?php _e('Register', 'give');
1221
+					if ( ! give_logged_in_only($form_id)) {
1222
+						echo ' '.__('and donate as a guest &raquo;', 'give');
1223 1223
 					} ?>
1224 1224
 				</a>
1225 1225
 			</p>
@@ -1235,49 +1235,49 @@  discard block
 block discarded – undo
1235 1235
 		 *
1236 1236
 		 * @param int $form_id The form ID.
1237 1237
 		 */
1238
-		do_action( 'give_checkout_login_fields_before', $form_id );
1238
+		do_action('give_checkout_login_fields_before', $form_id);
1239 1239
 		?>
1240 1240
 		<div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-first form-row-responsive">
1241 1241
 			<label class="give-label" for="give-user-login-<?php echo $form_id; ?>">
1242
-				<?php _e( 'Username', 'give' ); ?>
1243
-				<?php if ( give_logged_in_only( $form_id ) ) { ?>
1242
+				<?php _e('Username', 'give'); ?>
1243
+				<?php if (give_logged_in_only($form_id)) { ?>
1244 1244
 					<span class="give-required-indicator">*</span>
1245 1245
 				<?php } ?>
1246 1246
 			</label>
1247 1247
 
1248
-			<input class="give-input<?php echo ( give_logged_in_only( $form_id ) ) ? ' required' : ''; ?>" type="text"
1248
+			<input class="give-input<?php echo (give_logged_in_only($form_id)) ? ' required' : ''; ?>" type="text"
1249 1249
 				   name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value=""
1250
-				   placeholder="<?php _e( 'Your username', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/>
1250
+				   placeholder="<?php _e('Your username', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/>
1251 1251
 		</div>
1252 1252
 
1253 1253
 		<div id="give-user-pass-wrap-<?php echo $form_id; ?>"
1254 1254
 			 class="give_login_password form-row form-row-last form-row-responsive">
1255 1255
 			<label class="give-label" for="give-user-pass-<?php echo $form_id; ?>">
1256
-				<?php _e( 'Password', 'give' ); ?>
1257
-				<?php if ( give_logged_in_only( $form_id ) ) { ?>
1256
+				<?php _e('Password', 'give'); ?>
1257
+				<?php if (give_logged_in_only($form_id)) { ?>
1258 1258
 					<span class="give-required-indicator">*</span>
1259 1259
 				<?php } ?>
1260 1260
 			</label>
1261
-			<input class="give-input<?php echo ( give_logged_in_only( $form_id ) ) ? ' required' : ''; ?>"
1261
+			<input class="give-input<?php echo (give_logged_in_only($form_id)) ? ' required' : ''; ?>"
1262 1262
 				   type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>"
1263
-				   placeholder="<?php _e( 'Your password', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/>
1263
+				   placeholder="<?php _e('Your password', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/>
1264 1264
 			<input type="hidden" name="give-purchase-var" value="needs-to-login"/>
1265 1265
 		</div>
1266 1266
 
1267 1267
 		<div id="give-forgot-password-wrap-<?php echo $form_id; ?>" class="give_login_forgot_password">
1268 1268
 			 <span class="give-forgot-password ">
1269 1269
 				 <a href="<?php echo wp_lostpassword_url() ?>"
1270
-					target="_blank"><?php _e( 'Reset Password', 'give' ) ?></a>
1270
+					target="_blank"><?php _e('Reset Password', 'give') ?></a>
1271 1271
 			 </span>
1272 1272
 		</div>
1273 1273
 
1274 1274
 		<div id="give-user-login-submit-<?php echo $form_id; ?>" class="give-clearfix">
1275 1275
 			<input type="submit" class="give-submit give-btn button" name="give_login_submit"
1276
-				   value="<?php _e( 'Login', 'give' ); ?>"/>
1277
-			<?php if ( $show_register_form !== 'login' ) { ?>
1276
+				   value="<?php _e('Login', 'give'); ?>"/>
1277
+			<?php if ($show_register_form !== 'login') { ?>
1278 1278
 				<input type="button" data-action="give_cancel_login"
1279 1279
 					   class="give-cancel-login give-checkout-register-cancel give-btn button" name="give_login_cancel"
1280
-					   value="<?php _e( 'Cancel', 'give' ); ?>"/>
1280
+					   value="<?php _e('Cancel', 'give'); ?>"/>
1281 1281
 			<?php } ?>
1282 1282
 			<span class="give-loading-animation"></span>
1283 1283
 		</div>
@@ -1289,14 +1289,14 @@  discard block
 block discarded – undo
1289 1289
 		 *
1290 1290
 		 * @param int $form_id The form ID.
1291 1291
 		 */
1292
-		do_action( 'give_checkout_login_fields_after', $form_id );
1292
+		do_action('give_checkout_login_fields_after', $form_id);
1293 1293
 		?>
1294 1294
 	</fieldset><!--end #give-login-fields-->
1295 1295
 	<?php
1296 1296
 	echo ob_get_clean();
1297 1297
 }
1298 1298
 
1299
-add_action( 'give_donation_form_login_fields', 'give_get_login_fields', 10, 1 );
1299
+add_action('give_donation_form_login_fields', 'give_get_login_fields', 10, 1);
1300 1300
 
1301 1301
 /**
1302 1302
  * Payment Mode Select.
@@ -1312,9 +1312,9 @@  discard block
 block discarded – undo
1312 1312
  *
1313 1313
  * @return void
1314 1314
  */
1315
-function give_payment_mode_select( $form_id ) {
1315
+function give_payment_mode_select($form_id) {
1316 1316
 
1317
-	$gateways = give_get_enabled_payment_gateways( $form_id );
1317
+	$gateways = give_get_enabled_payment_gateways($form_id);
1318 1318
 
1319 1319
 	/**
1320 1320
 	 * Fires while selecting payment gateways, before the fields.
@@ -1323,10 +1323,10 @@  discard block
 block discarded – undo
1323 1323
 	 *
1324 1324
 	 * @param int $form_id The form ID.
1325 1325
 	 */
1326
-	do_action( 'give_payment_mode_top', $form_id );
1326
+	do_action('give_payment_mode_top', $form_id);
1327 1327
 	?>
1328 1328
 
1329
-	<fieldset id="give-payment-mode-select" <?php if ( count( $gateways ) <= 1 ) {
1329
+	<fieldset id="give-payment-mode-select" <?php if (count($gateways) <= 1) {
1330 1330
 		echo 'style="display: none;"';
1331 1331
 	} ?>>
1332 1332
 		<?php
@@ -1337,10 +1337,10 @@  discard block
 block discarded – undo
1337 1337
 		 *
1338 1338
 		 * @param int $form_id The form ID.
1339 1339
 		 */
1340
-		do_action( 'give_payment_mode_before_gateways_wrap' );
1340
+		do_action('give_payment_mode_before_gateways_wrap');
1341 1341
 		?>
1342 1342
 		<legend
1343
-				class="give-payment-mode-label"><?php echo apply_filters( 'give_checkout_payment_method_text', esc_html__( 'Select Payment Method', 'give' ) ); ?>
1343
+				class="give-payment-mode-label"><?php echo apply_filters('give_checkout_payment_method_text', esc_html__('Select Payment Method', 'give')); ?>
1344 1344
 			<span class="give-loading-text"><span
1345 1345
 						class="give-loading-animation"></span>
1346 1346
             </span>
@@ -1353,26 +1353,26 @@  discard block
 block discarded – undo
1353 1353
 			 *
1354 1354
 			 * @since 1.7
1355 1355
 			 */
1356
-			do_action( 'give_payment_mode_before_gateways' )
1356
+			do_action('give_payment_mode_before_gateways')
1357 1357
 			?>
1358 1358
 			<ul id="give-gateway-radio-list">
1359 1359
 				<?php
1360 1360
 				/**
1361 1361
 				 * Loop through the active payment gateways.
1362 1362
 				 */
1363
-				$selected_gateway  = give_get_chosen_gateway( $form_id );
1363
+				$selected_gateway = give_get_chosen_gateway($form_id);
1364 1364
 
1365
-				foreach ( $gateways as $gateway_id => $gateway ) :
1365
+				foreach ($gateways as $gateway_id => $gateway) :
1366 1366
 					//Determine the default gateway.
1367
-					$checked = checked( $gateway_id, $selected_gateway, false );
1367
+					$checked = checked($gateway_id, $selected_gateway, false);
1368 1368
 					$checked_class = $checked ? ' class="give-gateway-option-selected"' : ''; ?>
1369 1369
 					<li<?php echo $checked_class ?>>
1370 1370
 						<input type="radio" name="payment-mode" class="give-gateway"
1371
-							   id="give-gateway-<?php echo esc_attr( $gateway_id ) . '-' . $form_id; ?>"
1372
-							   value="<?php echo esc_attr( $gateway_id ); ?>"<?php echo $checked; ?>>
1373
-						<label for="give-gateway-<?php echo esc_attr( $gateway_id ) . '-' . $form_id; ?>"
1371
+							   id="give-gateway-<?php echo esc_attr($gateway_id).'-'.$form_id; ?>"
1372
+							   value="<?php echo esc_attr($gateway_id); ?>"<?php echo $checked; ?>>
1373
+						<label for="give-gateway-<?php echo esc_attr($gateway_id).'-'.$form_id; ?>"
1374 1374
 							   class="give-gateway-option"
1375
-							   id="give-gateway-option-<?php echo esc_attr( $gateway_id ); ?>"> <?php echo esc_html( $gateway['checkout_label'] ); ?></label>
1375
+							   id="give-gateway-option-<?php echo esc_attr($gateway_id); ?>"> <?php echo esc_html($gateway['checkout_label']); ?></label>
1376 1376
 					</li>
1377 1377
 					<?php
1378 1378
 				endforeach;
@@ -1384,7 +1384,7 @@  discard block
 block discarded – undo
1384 1384
 			 *
1385 1385
 			 * @since 1.7
1386 1386
 			 */
1387
-			do_action( 'give_payment_mode_after_gateways' );
1387
+			do_action('give_payment_mode_after_gateways');
1388 1388
 			?>
1389 1389
 		</div>
1390 1390
 		<?php
@@ -1395,7 +1395,7 @@  discard block
 block discarded – undo
1395 1395
 		 *
1396 1396
 		 * @param int $form_id The form ID.
1397 1397
 		 */
1398
-		do_action( 'give_payment_mode_after_gateways_wrap' );
1398
+		do_action('give_payment_mode_after_gateways_wrap');
1399 1399
 		?>
1400 1400
 	</fieldset>
1401 1401
 
@@ -1407,7 +1407,7 @@  discard block
 block discarded – undo
1407 1407
 	 *
1408 1408
 	 * @param int $form_id The form ID.
1409 1409
 	 */
1410
-	do_action( 'give_payment_mode_bottom', $form_id );
1410
+	do_action('give_payment_mode_bottom', $form_id);
1411 1411
 	?>
1412 1412
 
1413 1413
 	<div id="give_purchase_form_wrap">
@@ -1418,7 +1418,7 @@  discard block
 block discarded – undo
1418 1418
 		 *
1419 1419
 		 * @since 1.7
1420 1420
 		 */
1421
-		do_action( 'give_donation_form', $form_id );
1421
+		do_action('give_donation_form', $form_id);
1422 1422
 		?>
1423 1423
 
1424 1424
 	</div>
@@ -1429,10 +1429,10 @@  discard block
 block discarded – undo
1429 1429
 	 *
1430 1430
 	 * @since 1.7
1431 1431
 	 */
1432
-	do_action( 'give_donation_form_wrap_bottom', $form_id );
1432
+	do_action('give_donation_form_wrap_bottom', $form_id);
1433 1433
 }
1434 1434
 
1435
-add_action( 'give_payment_mode_select', 'give_payment_mode_select' );
1435
+add_action('give_payment_mode_select', 'give_payment_mode_select');
1436 1436
 
1437 1437
 /**
1438 1438
  * Renders the Checkout Agree to Terms, this displays a checkbox for users to
@@ -1445,31 +1445,31 @@  discard block
 block discarded – undo
1445 1445
  *
1446 1446
  * @return bool
1447 1447
  */
1448
-function give_terms_agreement( $form_id ) {
1449
-	$form_option = give_get_meta( $form_id, '_give_terms_option', true );
1448
+function give_terms_agreement($form_id) {
1449
+	$form_option = give_get_meta($form_id, '_give_terms_option', true);
1450 1450
 
1451 1451
 	// Bailout if per form and global term and conditions is not setup.
1452 1452
 	if (
1453
-		give_is_setting_enabled( $form_option, 'global' )
1454
-		&& give_is_setting_enabled( give_get_option( 'terms' ) )
1453
+		give_is_setting_enabled($form_option, 'global')
1454
+		&& give_is_setting_enabled(give_get_option('terms'))
1455 1455
 	) {
1456
-		$label         = give_get_option( 'agree_to_terms_label', esc_html__( 'Agree to Terms?', 'give' ) );
1457
-		$terms         = $terms = give_get_option( 'agreement_text', '' );
1458
-		$edit_term_url = admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=display&section=term-and-conditions' );
1456
+		$label         = give_get_option('agree_to_terms_label', esc_html__('Agree to Terms?', 'give'));
1457
+		$terms         = $terms = give_get_option('agreement_text', '');
1458
+		$edit_term_url = admin_url('edit.php?post_type=give_forms&page=give-settings&tab=display&section=term-and-conditions');
1459 1459
 
1460
-	} elseif ( give_is_setting_enabled( $form_option ) ) {
1461
-		$label         = ( $label = give_get_meta( $form_id, '_give_agree_label', true ) ) ? stripslashes( $label ) : esc_html__( 'Agree to Terms?', 'give' );
1462
-		$terms         = give_get_meta( $form_id, '_give_agree_text', true );
1463
-		$edit_term_url = admin_url( 'post.php?post=' . $form_id . '&action=edit#form_terms_options' );
1460
+	} elseif (give_is_setting_enabled($form_option)) {
1461
+		$label         = ($label = give_get_meta($form_id, '_give_agree_label', true)) ? stripslashes($label) : esc_html__('Agree to Terms?', 'give');
1462
+		$terms         = give_get_meta($form_id, '_give_agree_text', true);
1463
+		$edit_term_url = admin_url('post.php?post='.$form_id.'&action=edit#form_terms_options');
1464 1464
 
1465 1465
 	} else {
1466 1466
 		return false;
1467 1467
 	}
1468 1468
 
1469 1469
 	// Bailout: Check if term and conditions text is empty or not.
1470
-	if ( empty( $terms ) ) {
1471
-		if ( is_user_logged_in() && current_user_can( 'edit_give_forms' ) ) {
1472
-			echo sprintf( __( 'Please enter valid terms and conditions in <a href="%s">this form\'s settings</a>.', 'give' ), $edit_term_url );
1470
+	if (empty($terms)) {
1471
+		if (is_user_logged_in() && current_user_can('edit_give_forms')) {
1472
+			echo sprintf(__('Please enter valid terms and conditions in <a href="%s">this form\'s settings</a>.', 'give'), $edit_term_url);
1473 1473
 		}
1474 1474
 
1475 1475
 		return false;
@@ -1477,7 +1477,7 @@  discard block
 block discarded – undo
1477 1477
 
1478 1478
 	?>
1479 1479
 	<fieldset id="give_terms_agreement">
1480
-		<legend><?php echo apply_filters( 'give_terms_agreement_text', esc_html__( 'Terms', 'give' ) ); ?></legend>
1480
+		<legend><?php echo apply_filters('give_terms_agreement_text', esc_html__('Terms', 'give')); ?></legend>
1481 1481
 		<div id="give_terms" class="give_terms-<?php echo $form_id; ?>" style="display:none;">
1482 1482
 			<?php
1483 1483
 			/**
@@ -1485,22 +1485,22 @@  discard block
 block discarded – undo
1485 1485
 			 *
1486 1486
 			 * @since 1.0
1487 1487
 			 */
1488
-			do_action( 'give_before_terms' );
1488
+			do_action('give_before_terms');
1489 1489
 
1490
-			echo wpautop( stripslashes( $terms ) );
1490
+			echo wpautop(stripslashes($terms));
1491 1491
 			/**
1492 1492
 			 * Fires while rendering terms of agreement, after the fields.
1493 1493
 			 *
1494 1494
 			 * @since 1.0
1495 1495
 			 */
1496
-			do_action( 'give_after_terms' );
1496
+			do_action('give_after_terms');
1497 1497
 			?>
1498 1498
 		</div>
1499 1499
 		<div id="give_show_terms">
1500 1500
 			<a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" role="button"
1501
-			   aria-controls="give_terms"><?php esc_html_e( 'Show Terms', 'give' ); ?></a>
1501
+			   aria-controls="give_terms"><?php esc_html_e('Show Terms', 'give'); ?></a>
1502 1502
 			<a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" role="button"
1503
-			   aria-controls="give_terms" style="display:none;"><?php esc_html_e( 'Hide Terms', 'give' ); ?></a>
1503
+			   aria-controls="give_terms" style="display:none;"><?php esc_html_e('Hide Terms', 'give'); ?></a>
1504 1504
 		</div>
1505 1505
 
1506 1506
 		<input name="give_agree_to_terms" class="required" type="checkbox"
@@ -1511,7 +1511,7 @@  discard block
 block discarded – undo
1511 1511
 	<?php
1512 1512
 }
1513 1513
 
1514
-add_action( 'give_donation_form_after_cc_form', 'give_terms_agreement', 8888, 1 );
1514
+add_action('give_donation_form_after_cc_form', 'give_terms_agreement', 8888, 1);
1515 1515
 
1516 1516
 /**
1517 1517
  * Checkout Final Total.
@@ -1524,31 +1524,30 @@  discard block
 block discarded – undo
1524 1524
  *
1525 1525
  * @return void
1526 1526
  */
1527
-function give_checkout_final_total( $form_id ) {
1527
+function give_checkout_final_total($form_id) {
1528 1528
 
1529
-	$total = isset( $_POST['give_total'] ) ?
1530
-		apply_filters( 'give_donation_total', give_maybe_sanitize_amount( $_POST['give_total'] ) ) :
1531
-		give_get_default_form_amount( $form_id );
1529
+	$total = isset($_POST['give_total']) ?
1530
+		apply_filters('give_donation_total', give_maybe_sanitize_amount($_POST['give_total'])) : give_get_default_form_amount($form_id);
1532 1531
 
1533 1532
 
1534 1533
 	// Only proceed if give_total available.
1535
-	if ( empty( $total ) ) {
1534
+	if (empty($total)) {
1536 1535
 		return;
1537 1536
 	}
1538 1537
 	?>
1539 1538
 	<p id="give-final-total-wrap" class="form-wrap ">
1540 1539
 		<span class="give-donation-total-label">
1541
-			<?php echo apply_filters( 'give_donation_total_label', esc_html__( 'Donation Total:', 'give' ) ); ?>
1540
+			<?php echo apply_filters('give_donation_total_label', esc_html__('Donation Total:', 'give')); ?>
1542 1541
 		</span>
1543 1542
 		<span class="give-final-total-amount"
1544
-			  data-total="<?php echo give_format_amount( $total, array( 'sanitize' => false ) ); ?>">
1545
-			<?php echo give_currency_filter( give_format_amount( $total, array( 'sanitize' => false ) ), array( 'currency_code' => give_get_currency( $form_id ) ) ); ?>
1543
+			  data-total="<?php echo give_format_amount($total, array('sanitize' => false)); ?>">
1544
+			<?php echo give_currency_filter(give_format_amount($total, array('sanitize' => false)), array('currency_code' => give_get_currency($form_id))); ?>
1546 1545
 		</span>
1547 1546
 	</p>
1548 1547
 	<?php
1549 1548
 }
1550 1549
 
1551
-add_action( 'give_donation_form_before_submit', 'give_checkout_final_total', 999 );
1550
+add_action('give_donation_form_before_submit', 'give_checkout_final_total', 999);
1552 1551
 
1553 1552
 /**
1554 1553
  * Renders the Checkout Submit section.
@@ -1559,7 +1558,7 @@  discard block
 block discarded – undo
1559 1558
  *
1560 1559
  * @return void
1561 1560
  */
1562
-function give_checkout_submit( $form_id ) {
1561
+function give_checkout_submit($form_id) {
1563 1562
 	?>
1564 1563
 	<fieldset id="give_purchase_submit">
1565 1564
 		<?php
@@ -1568,24 +1567,24 @@  discard block
 block discarded – undo
1568 1567
 		 *
1569 1568
 		 * @since 1.7
1570 1569
 		 */
1571
-		do_action( 'give_donation_form_before_submit', $form_id );
1570
+		do_action('give_donation_form_before_submit', $form_id);
1572 1571
 
1573
-		give_checkout_hidden_fields( $form_id );
1572
+		give_checkout_hidden_fields($form_id);
1574 1573
 
1575
-		echo give_get_donation_form_submit_button( $form_id );
1574
+		echo give_get_donation_form_submit_button($form_id);
1576 1575
 
1577 1576
 		/**
1578 1577
 		 * Fire after donation form submit.
1579 1578
 		 *
1580 1579
 		 * @since 1.7
1581 1580
 		 */
1582
-		do_action( 'give_donation_form_after_submit', $form_id );
1581
+		do_action('give_donation_form_after_submit', $form_id);
1583 1582
 		?>
1584 1583
 	</fieldset>
1585 1584
 	<?php
1586 1585
 }
1587 1586
 
1588
-add_action( 'give_donation_form_after_cc_form', 'give_checkout_submit', 9999 );
1587
+add_action('give_donation_form_after_cc_form', 'give_checkout_submit', 9999);
1589 1588
 
1590 1589
 /**
1591 1590
  * Give Donation form submit button.
@@ -1596,10 +1595,10 @@  discard block
 block discarded – undo
1596 1595
  *
1597 1596
  * @return string
1598 1597
  */
1599
-function give_get_donation_form_submit_button( $form_id ) {
1598
+function give_get_donation_form_submit_button($form_id) {
1600 1599
 
1601
-	$display_label_field = give_get_meta( $form_id, '_give_checkout_label', true );
1602
-	$display_label       = ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) );
1600
+	$display_label_field = give_get_meta($form_id, '_give_checkout_label', true);
1601
+	$display_label       = ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give'));
1603 1602
 	ob_start();
1604 1603
 	?>
1605 1604
 	<div class="give-submit-button-wrap give-clearfix">
@@ -1608,7 +1607,7 @@  discard block
 block discarded – undo
1608 1607
 		<span class="give-loading-animation"></span>
1609 1608
 	</div>
1610 1609
 	<?php
1611
-	return apply_filters( 'give_donation_form_submit_button', ob_get_clean(), $form_id );
1610
+	return apply_filters('give_donation_form_submit_button', ob_get_clean(), $form_id);
1612 1611
 }
1613 1612
 
1614 1613
 /**
@@ -1623,22 +1622,22 @@  discard block
 block discarded – undo
1623 1622
  *
1624 1623
  * @return mixed
1625 1624
  */
1626
-function give_show_goal_progress( $form_id, $args ) {
1625
+function give_show_goal_progress($form_id, $args) {
1627 1626
 
1628 1627
 	ob_start();
1629
-	give_get_template( 'shortcode-goal', array( 'form_id' => $form_id, 'args' => $args ) );
1628
+	give_get_template('shortcode-goal', array('form_id' => $form_id, 'args' => $args));
1630 1629
 
1631 1630
 	/**
1632 1631
 	 * Filter progress bar output
1633 1632
 	 *
1634 1633
 	 * @since 2.0
1635 1634
 	 */
1636
-	echo apply_filters( 'give_goal_output', ob_get_clean(), $form_id, $args );
1635
+	echo apply_filters('give_goal_output', ob_get_clean(), $form_id, $args);
1637 1636
 
1638 1637
 	return true;
1639 1638
 }
1640 1639
 
1641
-add_action( 'give_pre_form', 'give_show_goal_progress', 10, 2 );
1640
+add_action('give_pre_form', 'give_show_goal_progress', 10, 2);
1642 1641
 
1643 1642
 
1644 1643
 /**
@@ -1651,10 +1650,10 @@  discard block
 block discarded – undo
1651 1650
  *
1652 1651
  * @return mixed|string
1653 1652
  */
1654
-function give_get_form_content_placement( $form_id, $args ) {
1653
+function give_get_form_content_placement($form_id, $args) {
1655 1654
 	$show_content = '';
1656 1655
 
1657
-	if ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) ) {
1656
+	if (isset($args['show_content']) && ! empty($args['show_content'])) {
1658 1657
 		// Content positions.
1659 1658
 		$content_placement = array(
1660 1659
 			'above' => 'give_pre_form',
@@ -1662,18 +1661,18 @@  discard block
 block discarded – undo
1662 1661
 		);
1663 1662
 
1664 1663
 		// Check if content position already decoded.
1665
-		if ( in_array( $args['show_content'], $content_placement ) ) {
1664
+		if (in_array($args['show_content'], $content_placement)) {
1666 1665
 			return $args['show_content'];
1667 1666
 		}
1668 1667
 
1669
-		$show_content = ( 'none' !== $args['show_content'] ? $content_placement[ $args['show_content'] ] : '' );
1668
+		$show_content = ('none' !== $args['show_content'] ? $content_placement[$args['show_content']] : '');
1670 1669
 
1671
-	} elseif ( give_is_setting_enabled( give_get_meta( $form_id, '_give_display_content', true ) ) ) {
1672
-		$show_content = give_get_meta( $form_id, '_give_content_placement', true );
1670
+	} elseif (give_is_setting_enabled(give_get_meta($form_id, '_give_display_content', true))) {
1671
+		$show_content = give_get_meta($form_id, '_give_content_placement', true);
1673 1672
 
1674
-	} elseif ( 'none' !== give_get_meta( $form_id, '_give_content_option', true ) ) {
1673
+	} elseif ('none' !== give_get_meta($form_id, '_give_content_option', true)) {
1675 1674
 		// Backward compatibility for _give_content_option for v18.
1676
-		$show_content = give_get_meta( $form_id, '_give_content_option', true );
1675
+		$show_content = give_get_meta($form_id, '_give_content_option', true);
1677 1676
 	}
1678 1677
 
1679 1678
 	return $show_content;
@@ -1689,20 +1688,20 @@  discard block
 block discarded – undo
1689 1688
  *
1690 1689
  * @return void|bool
1691 1690
  */
1692
-function give_form_content( $form_id, $args ) {
1691
+function give_form_content($form_id, $args) {
1693 1692
 
1694
-	$show_content = give_get_form_content_placement( $form_id, $args );
1693
+	$show_content = give_get_form_content_placement($form_id, $args);
1695 1694
 
1696 1695
 	// Bailout.
1697
-	if ( empty( $show_content ) ) {
1696
+	if (empty($show_content)) {
1698 1697
 		return false;
1699 1698
 	}
1700 1699
 
1701 1700
 	// Add action according to value.
1702
-	add_action( $show_content, 'give_form_display_content', 10, 2 );
1701
+	add_action($show_content, 'give_form_display_content', 10, 2);
1703 1702
 }
1704 1703
 
1705
-add_action( 'give_pre_form_output', 'give_form_content', 10, 2 );
1704
+add_action('give_pre_form_output', 'give_form_content', 10, 2);
1706 1705
 
1707 1706
 /**
1708 1707
  * Renders Post Form Content.
@@ -1716,22 +1715,22 @@  discard block
 block discarded – undo
1716 1715
  *
1717 1716
  * @return void
1718 1717
  */
1719
-function give_form_display_content( $form_id, $args ) {
1718
+function give_form_display_content($form_id, $args) {
1720 1719
 
1721
-	$content      = wpautop( give_get_meta( $form_id, '_give_form_content', true ) );
1722
-	$show_content = give_get_form_content_placement( $form_id, $args );
1720
+	$content      = wpautop(give_get_meta($form_id, '_give_form_content', true));
1721
+	$show_content = give_get_form_content_placement($form_id, $args);
1723 1722
 
1724
-	if ( give_is_setting_enabled( give_get_option( 'the_content_filter' ) ) ) {
1725
-		$content = apply_filters( 'the_content', $content );
1723
+	if (give_is_setting_enabled(give_get_option('the_content_filter'))) {
1724
+		$content = apply_filters('the_content', $content);
1726 1725
 	}
1727 1726
 
1728
-	$output = '<div id="give-form-content-' . $form_id . '" class="give-form-content-wrap ' . $show_content . '-content">' . $content . '</div>';
1727
+	$output = '<div id="give-form-content-'.$form_id.'" class="give-form-content-wrap '.$show_content.'-content">'.$content.'</div>';
1729 1728
 
1730
-	echo apply_filters( 'give_form_content_output', $output );
1729
+	echo apply_filters('give_form_content_output', $output);
1731 1730
 
1732 1731
 	// remove action to prevent content output on addition forms on page.
1733 1732
 	// @see: https://github.com/WordImpress/Give/issues/634.
1734
-	remove_action( $show_content, 'give_form_display_content' );
1733
+	remove_action($show_content, 'give_form_display_content');
1735 1734
 }
1736 1735
 
1737 1736
 /**
@@ -1743,7 +1742,7 @@  discard block
 block discarded – undo
1743 1742
  *
1744 1743
  * @return void
1745 1744
  */
1746
-function give_checkout_hidden_fields( $form_id ) {
1745
+function give_checkout_hidden_fields($form_id) {
1747 1746
 
1748 1747
 	/**
1749 1748
 	 * Fires while rendering hidden checkout fields, before the fields.
@@ -1752,13 +1751,13 @@  discard block
 block discarded – undo
1752 1751
 	 *
1753 1752
 	 * @param int $form_id The form ID.
1754 1753
 	 */
1755
-	do_action( 'give_hidden_fields_before', $form_id );
1754
+	do_action('give_hidden_fields_before', $form_id);
1756 1755
 
1757
-	if ( is_user_logged_in() ) { ?>
1756
+	if (is_user_logged_in()) { ?>
1758 1757
 		<input type="hidden" name="give-user-id" value="<?php echo get_current_user_id(); ?>"/>
1759 1758
 	<?php } ?>
1760 1759
 	<input type="hidden" name="give_action" value="purchase"/>
1761
-	<input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway( $form_id ); ?>"/>
1760
+	<input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway($form_id); ?>"/>
1762 1761
 	<?php
1763 1762
 	/**
1764 1763
 	 * Fires while rendering hidden checkout fields, after the fields.
@@ -1767,7 +1766,7 @@  discard block
 block discarded – undo
1767 1766
 	 *
1768 1767
 	 * @param int $form_id The form ID.
1769 1768
 	 */
1770
-	do_action( 'give_hidden_fields_after', $form_id );
1769
+	do_action('give_hidden_fields_after', $form_id);
1771 1770
 
1772 1771
 }
1773 1772
 
@@ -1782,20 +1781,20 @@  discard block
 block discarded – undo
1782 1781
  *
1783 1782
  * @return string $content Filtered content.
1784 1783
  */
1785
-function give_filter_success_page_content( $content ) {
1784
+function give_filter_success_page_content($content) {
1786 1785
 
1787 1786
 	$give_options = give_get_settings();
1788 1787
 
1789
-	if ( isset( $give_options['success_page'] ) && isset( $_GET['payment-confirmation'] ) && is_page( $give_options['success_page'] ) ) {
1790
-		if ( has_filter( 'give_payment_confirm_' . $_GET['payment-confirmation'] ) ) {
1791
-			$content = apply_filters( 'give_payment_confirm_' . $_GET['payment-confirmation'], $content );
1788
+	if (isset($give_options['success_page']) && isset($_GET['payment-confirmation']) && is_page($give_options['success_page'])) {
1789
+		if (has_filter('give_payment_confirm_'.$_GET['payment-confirmation'])) {
1790
+			$content = apply_filters('give_payment_confirm_'.$_GET['payment-confirmation'], $content);
1792 1791
 		}
1793 1792
 	}
1794 1793
 
1795 1794
 	return $content;
1796 1795
 }
1797 1796
 
1798
-add_filter( 'the_content', 'give_filter_success_page_content' );
1797
+add_filter('the_content', 'give_filter_success_page_content');
1799 1798
 
1800 1799
 /**
1801 1800
  * Test Mode Frontend Warning.
@@ -1806,12 +1805,12 @@  discard block
 block discarded – undo
1806 1805
  */
1807 1806
 function give_test_mode_frontend_warning() {
1808 1807
 
1809
-	if ( give_is_test_mode() ) {
1810
-		echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>' . esc_html__( 'Notice:', 'give' ) . '</strong> ' . esc_html__( 'Test mode is enabled. While in test mode no live donations are processed.', 'give' ) . '</p></div>';
1808
+	if (give_is_test_mode()) {
1809
+		echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>'.esc_html__('Notice:', 'give').'</strong> '.esc_html__('Test mode is enabled. While in test mode no live donations are processed.', 'give').'</p></div>';
1811 1810
 	}
1812 1811
 }
1813 1812
 
1814
-add_action( 'give_pre_form', 'give_test_mode_frontend_warning', 10 );
1813
+add_action('give_pre_form', 'give_test_mode_frontend_warning', 10);
1815 1814
 
1816 1815
 /**
1817 1816
  * Members-only Form.
@@ -1825,21 +1824,21 @@  discard block
 block discarded – undo
1825 1824
  *
1826 1825
  * @return string
1827 1826
  */
1828
-function give_members_only_form( $final_output, $args ) {
1827
+function give_members_only_form($final_output, $args) {
1829 1828
 
1830
-	$form_id = isset( $args['form_id'] ) ? $args['form_id'] : 0;
1829
+	$form_id = isset($args['form_id']) ? $args['form_id'] : 0;
1831 1830
 
1832 1831
 	//Sanity Check: Must have form_id & not be logged in.
1833
-	if ( empty( $form_id ) || is_user_logged_in() ) {
1832
+	if (empty($form_id) || is_user_logged_in()) {
1834 1833
 		return $final_output;
1835 1834
 	}
1836 1835
 
1837 1836
 	//Logged in only and Register / Login set to none.
1838
-	if ( give_logged_in_only( $form_id ) && give_show_login_register_option( $form_id ) == 'none' ) {
1837
+	if (give_logged_in_only($form_id) && give_show_login_register_option($form_id) == 'none') {
1839 1838
 
1840
-		$final_output = Give()->notices->print_frontend_notice( esc_html__( 'Please log in in order to complete your donation.', 'give' ), false );
1839
+		$final_output = Give()->notices->print_frontend_notice(esc_html__('Please log in in order to complete your donation.', 'give'), false);
1841 1840
 
1842
-		return apply_filters( 'give_members_only_output', $final_output, $form_id );
1841
+		return apply_filters('give_members_only_output', $final_output, $form_id);
1843 1842
 
1844 1843
 	}
1845 1844
 
@@ -1847,7 +1846,7 @@  discard block
 block discarded – undo
1847 1846
 
1848 1847
 }
1849 1848
 
1850
-add_filter( 'give_donate_form', 'give_members_only_form', 10, 2 );
1849
+add_filter('give_donate_form', 'give_members_only_form', 10, 2);
1851 1850
 
1852 1851
 
1853 1852
 /**
@@ -1859,28 +1858,28 @@  discard block
 block discarded – undo
1859 1858
  * @param array            $args
1860 1859
  * @param Give_Donate_Form $form
1861 1860
  */
1862
-function __give_form_add_donation_hidden_field( $form_id, $args, $form ) {
1861
+function __give_form_add_donation_hidden_field($form_id, $args, $form) {
1863 1862
 	?>
1864 1863
 	<input type="hidden" name="give-form-id" value="<?php echo $form_id; ?>"/>
1865
-	<input type="hidden" name="give-form-title" value="<?php echo htmlentities( $form->post_title ); ?>"/>
1864
+	<input type="hidden" name="give-form-title" value="<?php echo htmlentities($form->post_title); ?>"/>
1866 1865
 	<input type="hidden" name="give-current-url"
1867
-		   value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/>
1868
-	<input type="hidden" name="give-form-url" value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/>
1866
+		   value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/>
1867
+	<input type="hidden" name="give-form-url" value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/>
1869 1868
 	<input type="hidden" name="give-form-minimum"
1870
-		   value="<?php echo give_format_amount( give_get_form_minimum_price( $form_id ), array( 'sanitize' => false ) ); ?>"/>
1869
+		   value="<?php echo give_format_amount(give_get_form_minimum_price($form_id), array('sanitize' => false)); ?>"/>
1871 1870
 	<?php
1872 1871
 
1873 1872
 	// WP nonce field.
1874
-	wp_nonce_field( "donation_form_nonce_{$form_id}", '_wpnonce', false );
1873
+	wp_nonce_field("donation_form_nonce_{$form_id}", '_wpnonce', false);
1875 1874
 
1876 1875
 	// Price ID hidden field for variable (multi-level) donation forms.
1877
-	if ( give_has_variable_prices( $form_id ) ) {
1876
+	if (give_has_variable_prices($form_id)) {
1878 1877
 		// Get default selected price ID.
1879
-		$prices   = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id );
1878
+		$prices   = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id);
1880 1879
 		$price_id = 0;
1881 1880
 		//loop through prices.
1882
-		foreach ( $prices as $price ) {
1883
-			if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) {
1881
+		foreach ($prices as $price) {
1882
+			if (isset($price['_give_default']) && $price['_give_default'] === 'default') {
1884 1883
 				$price_id = $price['_give_id']['level_id'];
1885 1884
 			};
1886 1885
 		}
@@ -1893,7 +1892,7 @@  discard block
 block discarded – undo
1893 1892
 	}
1894 1893
 }
1895 1894
 
1896
-add_action( 'give_donation_form_top', '__give_form_add_donation_hidden_field', 0, 3 );
1895
+add_action('give_donation_form_top', '__give_form_add_donation_hidden_field', 0, 3);
1897 1896
 
1898 1897
 /**
1899 1898
  * Add currency settings on donation form.
@@ -1905,20 +1904,20 @@  discard block
 block discarded – undo
1905 1904
  *
1906 1905
  * @return array
1907 1906
  */
1908
-function __give_form_add_currency_settings( $form_html_tags, $form ) {
1909
-	$form_currency     = give_get_currency( $form->ID );
1910
-	$currency_settings = give_get_currency_formatting_settings( $form_currency );
1907
+function __give_form_add_currency_settings($form_html_tags, $form) {
1908
+	$form_currency     = give_get_currency($form->ID);
1909
+	$currency_settings = give_get_currency_formatting_settings($form_currency);
1911 1910
 
1912 1911
 	// Check if currency exist.
1913
-	if ( empty( $currency_settings ) ) {
1912
+	if (empty($currency_settings)) {
1914 1913
 		return $form_html_tags;
1915 1914
 	}
1916 1915
 
1917
-	$form_html_tags['data-currency_symbol'] = give_currency_symbol( $form_currency );
1916
+	$form_html_tags['data-currency_symbol'] = give_currency_symbol($form_currency);
1918 1917
 	$form_html_tags['data-currency_code']   = $form_currency;
1919 1918
 
1920
-	if ( ! empty( $currency_settings ) ) {
1921
-		foreach ( $currency_settings as $key => $value ) {
1919
+	if ( ! empty($currency_settings)) {
1920
+		foreach ($currency_settings as $key => $value) {
1922 1921
 			$form_html_tags["data-{$key}"] = $value;
1923 1922
 		}
1924 1923
 	}
@@ -1926,4 +1925,4 @@  discard block
 block discarded – undo
1926 1925
 	return $form_html_tags;
1927 1926
 }
1928 1927
 
1929
-add_filter( 'give_form_html_tags', '__give_form_add_currency_settings', 0, 2 );
1928
+add_filter('give_form_html_tags', '__give_form_add_currency_settings', 0, 2);
Please login to merge, or discard this patch.
includes/process-donation.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -288,8 +288,8 @@
 block discarded – undo
288 288
 
289 289
 	// Check spam detect.
290 290
 	if ( isset( $_POST['action'] )
291
-	     && give_is_setting_enabled( give_get_option( 'akismet_spam_protection' ) )
292
-	     && give_is_spam_donation()
291
+		 && give_is_setting_enabled( give_get_option( 'akismet_spam_protection' ) )
292
+		 && give_is_spam_donation()
293 293
 	) {
294 294
 		give_set_error( 'invalid_donation', __( 'This donation has been flagged as spam. Please try again.', 'give' ) );
295 295
 	}
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
  * @access private
23 23
  * @since  1.0
24 24
  *
25
- * @return mixed
25
+ * @return false|null
26 26
  */
27 27
 function give_process_donation_form() {
28 28
 	$is_ajax = isset( $_POST['give_ajax'] );
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
  * @access      private
463 463
  * @since       1.0
464 464
  *
465
- * @param       $form_id
465
+ * @param       integer $form_id
466 466
  *
467 467
  * @return      array
468 468
  */
Please login to merge, or discard this patch.
Spacing   +249 added lines, -250 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -25,20 +25,20 @@  discard block
 block discarded – undo
25 25
  * @return mixed
26 26
  */
27 27
 function give_process_donation_form() {
28
-	$is_ajax = isset( $_POST['give_ajax'] );
28
+	$is_ajax = isset($_POST['give_ajax']);
29 29
 
30 30
 	// Verify donation form nonce.
31
-	if(  ! give_verify_donation_form_nonce() ) {
32
-		if( $is_ajax ) {
31
+	if ( ! give_verify_donation_form_nonce()) {
32
+		if ($is_ajax) {
33 33
 			/**
34 34
 			 * Fires when AJAX sends back errors from the donation form.
35 35
 			 *
36 36
 			 * @since 1.0
37 37
 			 */
38
-			do_action( 'give_ajax_donation_errors' );
38
+			do_action('give_ajax_donation_errors');
39 39
 			
40 40
 			give_die();
41
-		} else{
41
+		} else {
42 42
 			give_send_back_to_checkout();
43 43
 		}
44 44
 	}
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	 *
49 49
 	 * @since 1.0
50 50
 	 */
51
-	do_action( 'give_pre_process_donation' );
51
+	do_action('give_pre_process_donation');
52 52
 
53 53
 	// Validate the form $_POST data.
54 54
 	$valid_data = give_donation_form_validate_fields();
@@ -63,24 +63,24 @@  discard block
 block discarded – undo
63 63
 	 * @param bool|array $valid_data Validate fields.
64 64
 	 * @param array $_POST Array of variables passed via the HTTP POST.
65 65
 	 */
66
-	do_action( 'give_checkout_error_checks', $valid_data, $_POST );
66
+	do_action('give_checkout_error_checks', $valid_data, $_POST);
67 67
 
68 68
 	// Process the login form.
69
-	if ( isset( $_POST['give_login_submit'] ) ) {
69
+	if (isset($_POST['give_login_submit'])) {
70 70
 		give_process_form_login();
71 71
 	}
72 72
 
73 73
 	// Validate the user.
74
-	$user = give_get_donation_form_user( $valid_data );
74
+	$user = give_get_donation_form_user($valid_data);
75 75
 
76
-	if ( false === $valid_data || give_get_errors() || ! $user ) {
77
-		if ( $is_ajax ) {
76
+	if (false === $valid_data || give_get_errors() || ! $user) {
77
+		if ($is_ajax) {
78 78
 			/**
79 79
 			 * Fires when AJAX sends back errors from the donation form.
80 80
 			 *
81 81
 			 * @since 1.0
82 82
 			 */
83
-			do_action( 'give_ajax_donation_errors' );
83
+			do_action('give_ajax_donation_errors');
84 84
 			give_die();
85 85
 		} else {
86 86
 			return false;
@@ -88,17 +88,17 @@  discard block
 block discarded – undo
88 88
 	}
89 89
 
90 90
 	// If AJAX send back success to proceed with form submission.
91
-	if ( $is_ajax ) {
91
+	if ($is_ajax) {
92 92
 		echo 'success';
93 93
 		give_die();
94 94
 	}
95 95
 
96 96
 	// After AJAX: Setup session if not using php_sessions.
97
-	if ( ! Give()->session->use_php_sessions() ) {
97
+	if ( ! Give()->session->use_php_sessions()) {
98 98
 		// Double-check that set_cookie is publicly accessible.
99 99
 		// we're using a slightly modified class-wp-sessions.php.
100
-		$session_reflection = new ReflectionMethod( 'WP_Session', 'set_cookie' );
101
-		if ( $session_reflection->isPublic() ) {
100
+		$session_reflection = new ReflectionMethod('WP_Session', 'set_cookie');
101
+		if ($session_reflection->isPublic()) {
102 102
 			// Manually set the cookie.
103 103
 			Give()->session->init()->set_cookie();
104 104
 		}
@@ -113,21 +113,20 @@  discard block
 block discarded – undo
113 113
 		'address'    => $user['address'],
114 114
 	);
115 115
 
116
-	$auth_key = defined( 'AUTH_KEY' ) ? AUTH_KEY : '';
116
+	$auth_key = defined('AUTH_KEY') ? AUTH_KEY : '';
117 117
 
118
-	$price        = isset( $_POST['give-amount'] ) ?
119
-		(float) apply_filters( 'give_donation_total', give_maybe_sanitize_amount( $_POST['give-amount'] ) ) :
120
-		'0.00';
121
-	$purchase_key = strtolower( md5( $user['user_email'] . date( 'Y-m-d H:i:s' ) . $auth_key . uniqid( 'give', true ) ) );
118
+	$price        = isset($_POST['give-amount']) ?
119
+		(float) apply_filters('give_donation_total', give_maybe_sanitize_amount($_POST['give-amount'])) : '0.00';
120
+	$purchase_key = strtolower(md5($user['user_email'].date('Y-m-d H:i:s').$auth_key.uniqid('give', true)));
122 121
 
123 122
 	// Setup donation information.
124 123
 	$donation_data = array(
125 124
 		'price'         => $price,
126 125
 		'purchase_key'  => $purchase_key,
127 126
 		'user_email'    => $user['user_email'],
128
-		'date'          => date( 'Y-m-d H:i:s', current_time( 'timestamp' ) ),
129
-		'user_info'     => stripslashes_deep( $user_info ),
130
-		'post_data'     => give_clean( $_POST ),
127
+		'date'          => date('Y-m-d H:i:s', current_time('timestamp')),
128
+		'user_info'     => stripslashes_deep($user_info),
129
+		'post_data'     => give_clean($_POST),
131 130
 		'gateway'       => $valid_data['gateway'],
132 131
 		'card_info'     => $valid_data['cc_info'],
133 132
 	);
@@ -146,10 +145,10 @@  discard block
 block discarded – undo
146 145
 	 * @param array $user_info Array containing basic user information.
147 146
 	 * @param bool|array $valid_data Validate fields.
148 147
 	 */
149
-	do_action( 'give_checkout_before_gateway', give_clean( $_POST ), $user_info, $valid_data );
148
+	do_action('give_checkout_before_gateway', give_clean($_POST), $user_info, $valid_data);
150 149
 
151 150
 	// Sanity check for price.
152
-	if ( ! $donation_data['price'] ) {
151
+	if ( ! $donation_data['price']) {
153 152
 		// Revert to manual.
154 153
 		$donation_data['gateway'] = 'manual';
155 154
 		$_POST['give-gateway']    = 'manual';
@@ -160,26 +159,26 @@  discard block
 block discarded – undo
160 159
 	 *
161 160
 	 * @since 1.7
162 161
 	 */
163
-	$donation_data = apply_filters( 'give_donation_data_before_gateway', $donation_data, $valid_data );
162
+	$donation_data = apply_filters('give_donation_data_before_gateway', $donation_data, $valid_data);
164 163
 
165 164
 	// Setup the data we're storing in the donation session.
166 165
 	$session_data = $donation_data;
167 166
 
168 167
 	// Make sure credit card numbers are never stored in sessions.
169
-	unset( $session_data['card_info']['card_number'] );
170
-	unset( $session_data['post_data']['card_number'] );
168
+	unset($session_data['card_info']['card_number']);
169
+	unset($session_data['post_data']['card_number']);
171 170
 
172 171
 	// Used for showing data to non logged-in users after donation, and for other plugins needing donation data.
173
-	give_set_purchase_session( $session_data );
172
+	give_set_purchase_session($session_data);
174 173
 
175 174
 	// Send info to the gateway for payment processing.
176
-	give_send_to_gateway( $donation_data['gateway'], $donation_data );
175
+	give_send_to_gateway($donation_data['gateway'], $donation_data);
177 176
 	give_die();
178 177
 }
179 178
 
180
-add_action( 'give_purchase', 'give_process_donation_form' );
181
-add_action( 'wp_ajax_give_process_donation', 'give_process_donation_form' );
182
-add_action( 'wp_ajax_nopriv_give_process_donation', 'give_process_donation_form' );
179
+add_action('give_purchase', 'give_process_donation_form');
180
+add_action('wp_ajax_give_process_donation', 'give_process_donation_form');
181
+add_action('wp_ajax_nopriv_give_process_donation', 'give_process_donation_form');
183 182
 
184 183
 
185 184
 /**
@@ -192,29 +191,29 @@  discard block
 block discarded – undo
192 191
  *
193 192
  * @return void
194 193
  */
195
-function give_check_logged_in_user_for_existing_email( $valid_data, $post ) {
194
+function give_check_logged_in_user_for_existing_email($valid_data, $post) {
196 195
 
197 196
 	// Verify that the email address belongs to this customer.
198
-	if ( is_user_logged_in() ) {
197
+	if (is_user_logged_in()) {
199 198
 
200 199
 		$submitted_email = $valid_data['logged_in_user']['user_email'];
201
-		$donor           = new Give_Donor( get_current_user_id(), true );
200
+		$donor           = new Give_Donor(get_current_user_id(), true);
202 201
 
203 202
 		// If this email address is not registered with this customer, see if it belongs to any other customer.
204 203
 		if (
205 204
 			$submitted_email !== $donor->email
206
-			&& ( is_array( $donor->emails ) && ! in_array( $submitted_email, $donor->emails ) )
205
+			&& (is_array($donor->emails) && ! in_array($submitted_email, $donor->emails))
207 206
 		) {
208
-			$found_donor = new Give_Donor( $submitted_email );
207
+			$found_donor = new Give_Donor($submitted_email);
209 208
 
210
-			if ( $found_donor->id > 0 ) {
211
-				give_set_error( 'give-customer-email-exists', sprintf( __( 'You are logged in as %1$s, and are submitting a donation as %2$s, which is an existing donor. To ensure that the email address is tied to the correct donor, please submit this donation from a logged-out browser, or choose another email address.', 'give' ), $donor->email, $submitted_email ) );
209
+			if ($found_donor->id > 0) {
210
+				give_set_error('give-customer-email-exists', sprintf(__('You are logged in as %1$s, and are submitting a donation as %2$s, which is an existing donor. To ensure that the email address is tied to the correct donor, please submit this donation from a logged-out browser, or choose another email address.', 'give'), $donor->email, $submitted_email));
212 211
 			}
213 212
 		}
214 213
 	}
215 214
 }
216 215
 
217
-add_action( 'give_checkout_error_checks', 'give_check_logged_in_user_for_existing_email', 10, 2 );
216
+add_action('give_checkout_error_checks', 'give_check_logged_in_user_for_existing_email', 10, 2);
218 217
 
219 218
 /**
220 219
  * Process the checkout login form
@@ -224,49 +223,49 @@  discard block
 block discarded – undo
224 223
  * @return      void
225 224
  */
226 225
 function give_process_form_login() {
227
-	$is_ajax = isset( $_POST['give_ajax'] );
226
+	$is_ajax = isset($_POST['give_ajax']);
228 227
 
229 228
 	$user_data = give_donation_form_validate_user_login();
230 229
 
231
-	if ( give_get_errors() || $user_data['user_id'] < 1 ) {
232
-		if ( $is_ajax ) {
230
+	if (give_get_errors() || $user_data['user_id'] < 1) {
231
+		if ($is_ajax) {
233 232
 			/**
234 233
 			 * Fires when AJAX sends back errors from the donation form.
235 234
 			 *
236 235
 			 * @since 1.0
237 236
 			 */
238 237
 			ob_start();
239
-			do_action( 'give_ajax_donation_errors' );
238
+			do_action('give_ajax_donation_errors');
240 239
 			$message = ob_get_contents();
241 240
 			ob_end_clean();
242
-			wp_send_json_error( $message );
241
+			wp_send_json_error($message);
243 242
 		} else {
244
-			wp_redirect( $_SERVER['HTTP_REFERER'] );
243
+			wp_redirect($_SERVER['HTTP_REFERER']);
245 244
 			exit;
246 245
 		}
247 246
 	}
248 247
 
249
-	give_log_user_in( $user_data['user_id'], $user_data['user_login'], $user_data['user_pass'] );
248
+	give_log_user_in($user_data['user_id'], $user_data['user_login'], $user_data['user_pass']);
250 249
 
251
-	if ( $is_ajax ) {
250
+	if ($is_ajax) {
252 251
 		$message = Give()->notices->print_frontend_notice(
253 252
 			sprintf(
254 253
 			/* translators: %s: user first name */
255
-				esc_html__( 'Welcome %s! You have successfully logged into your account.', 'give' ),
256
-				( ! empty( $user_data['user_first'] ) ) ? $user_data['user_first'] : $user_data['user_login']
254
+				esc_html__('Welcome %s! You have successfully logged into your account.', 'give'),
255
+				( ! empty($user_data['user_first'])) ? $user_data['user_first'] : $user_data['user_login']
257 256
 			),
258 257
 			false,
259 258
 			'success'
260 259
 		);
261 260
 
262
-		wp_send_json_success( $message );
261
+		wp_send_json_success($message);
263 262
 	} else {
264
-		wp_redirect( $_SERVER['HTTP_REFERER'] );
263
+		wp_redirect($_SERVER['HTTP_REFERER']);
265 264
 	}
266 265
 }
267 266
 
268
-add_action( 'wp_ajax_give_process_donation_login', 'give_process_form_login' );
269
-add_action( 'wp_ajax_nopriv_give_process_donation_login', 'give_process_form_login' );
267
+add_action('wp_ajax_give_process_donation_login', 'give_process_form_login');
268
+add_action('wp_ajax_nopriv_give_process_donation_login', 'give_process_form_login');
270 269
 
271 270
 /**
272 271
  * Donation Form Validate Fields.
@@ -278,52 +277,52 @@  discard block
 block discarded – undo
278 277
 function give_donation_form_validate_fields() {
279 278
 
280 279
 	// Check if there is $_POST.
281
-	if ( empty( $_POST ) ) {
280
+	if (empty($_POST)) {
282 281
 		return false;
283 282
 	}
284 283
 
285
-	$form_id = ! empty( $_POST['give-form-id'] ) ? $_POST['give-form-id'] : '';
284
+	$form_id = ! empty($_POST['give-form-id']) ? $_POST['give-form-id'] : '';
286 285
 
287 286
 	// Start an array to collect valid data.
288 287
 	$valid_data = array(
289 288
 		'gateway'          => give_donation_form_validate_gateway(), // Gateway fallback (amount is validated here).
290
-		'need_new_user'    => false,     // New user flag.
291
-		'need_user_login'  => false,     // Login user flag.
292
-		'logged_user_data' => array(),   // Logged user collected data.
293
-		'new_user_data'    => array(),   // New user collected data.
294
-		'login_user_data'  => array(),   // Login user collected data.
295
-		'guest_user_data'  => array(),   // Guest user collected data.
296
-		'cc_info'          => give_donation_form_validate_cc(),// Credit card info.
289
+		'need_new_user'    => false, // New user flag.
290
+		'need_user_login'  => false, // Login user flag.
291
+		'logged_user_data' => array(), // Logged user collected data.
292
+		'new_user_data'    => array(), // New user collected data.
293
+		'login_user_data'  => array(), // Login user collected data.
294
+		'guest_user_data'  => array(), // Guest user collected data.
295
+		'cc_info'          => give_donation_form_validate_cc(), // Credit card info.
297 296
 	);
298 297
 
299 298
 	// Validate Honeypot First.
300
-	if ( ! empty( $_POST['give-honeypot'] ) ) {
301
-		give_set_error( 'invalid_honeypot', esc_html__( 'Honeypot field detected. Go away bad bot!', 'give' ) );
299
+	if ( ! empty($_POST['give-honeypot'])) {
300
+		give_set_error('invalid_honeypot', esc_html__('Honeypot field detected. Go away bad bot!', 'give'));
302 301
 	}
303 302
 
304 303
 	// Check spam detect.
305
-	if ( isset( $_POST['action'] )
306
-	     && give_is_setting_enabled( give_get_option( 'akismet_spam_protection' ) )
304
+	if (isset($_POST['action'])
305
+	     && give_is_setting_enabled(give_get_option('akismet_spam_protection'))
307 306
 	     && give_is_spam_donation()
308 307
 	) {
309
-		give_set_error( 'invalid_donation', __( 'This donation has been flagged as spam. Please try again.', 'give' ) );
308
+		give_set_error('invalid_donation', __('This donation has been flagged as spam. Please try again.', 'give'));
310 309
 	}
311 310
 
312 311
 	// Validate agree to terms.
313
-	if ( give_is_terms_enabled( $form_id ) ) {
312
+	if (give_is_terms_enabled($form_id)) {
314 313
 		give_donation_form_validate_agree_to_terms();
315 314
 	}
316 315
 
317
-	if ( is_user_logged_in() ) {
316
+	if (is_user_logged_in()) {
318 317
 		// Collect logged in user data.
319 318
 		$valid_data['logged_in_user'] = give_donation_form_validate_logged_in_user();
320
-	} elseif ( isset( $_POST['give-purchase-var'] ) && $_POST['give-purchase-var'] == 'needs-to-register' && ! empty( $_POST['give_create_account'] ) ) {
319
+	} elseif (isset($_POST['give-purchase-var']) && $_POST['give-purchase-var'] == 'needs-to-register' && ! empty($_POST['give_create_account'])) {
321 320
 		// Set new user registration as required.
322 321
 		$valid_data['need_new_user'] = true;
323 322
 		// Validate new user data.
324 323
 		$valid_data['new_user_data'] = give_donation_form_validate_new_user();
325 324
 		// Check if login validation is needed.
326
-	} elseif ( isset( $_POST['give-purchase-var'] ) && $_POST['give-purchase-var'] == 'needs-to-login' ) {
325
+	} elseif (isset($_POST['give-purchase-var']) && $_POST['give-purchase-var'] == 'needs-to-login') {
327 326
 		// Set user login as required.
328 327
 		$valid_data['need_user_login'] = true;
329 328
 		// Validate users login info.
@@ -347,14 +346,14 @@  discard block
 block discarded – undo
347 346
 function give_is_spam_donation() {
348 347
 	$spam = false;
349 348
 
350
-	$user_agent = (string) isset( $_SERVER['HTTP_USER_AGENT'] ) ? $_SERVER['HTTP_USER_AGENT'] : '';
349
+	$user_agent = (string) isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
351 350
 
352
-	if ( strlen( $user_agent ) < 2 ) {
351
+	if (strlen($user_agent) < 2) {
353 352
 		$spam = true;
354 353
 	}
355 354
 
356 355
 	// Allow developer to customized Akismet spam detect API call and it's response.
357
-	return apply_filters( 'give_spam', $spam );
356
+	return apply_filters('give_spam', $spam);
358 357
 }
359 358
 
360 359
 /**
@@ -368,41 +367,41 @@  discard block
 block discarded – undo
368 367
  */
369 368
 function give_donation_form_validate_gateway() {
370 369
 
371
-	$form_id = isset( $_REQUEST['give-form-id'] ) ? $_REQUEST['give-form-id'] : 0;
372
-	$amount  = isset( $_REQUEST['give-amount'] ) ? give_maybe_sanitize_amount( $_REQUEST['give-amount'] ) : 0;
373
-	$gateway = give_get_default_gateway( $form_id );
370
+	$form_id = isset($_REQUEST['give-form-id']) ? $_REQUEST['give-form-id'] : 0;
371
+	$amount  = isset($_REQUEST['give-amount']) ? give_maybe_sanitize_amount($_REQUEST['give-amount']) : 0;
372
+	$gateway = give_get_default_gateway($form_id);
374 373
 
375 374
 	// Check if a gateway value is present.
376
-	if ( ! empty( $_REQUEST['give-gateway'] ) ) {
375
+	if ( ! empty($_REQUEST['give-gateway'])) {
377 376
 
378
-		$gateway = sanitize_text_field( $_REQUEST['give-gateway'] );
377
+		$gateway = sanitize_text_field($_REQUEST['give-gateway']);
379 378
 
380 379
 		// Is amount being donated in LIVE mode 0.00? If so, error:
381
-		if ( $amount == 0 && ! give_is_test_mode() ) {
380
+		if ($amount == 0 && ! give_is_test_mode()) {
382 381
 
383
-			give_set_error( 'invalid_donation_amount', __( 'Please insert a valid donation amount.', 'give' ) );
382
+			give_set_error('invalid_donation_amount', __('Please insert a valid donation amount.', 'give'));
384 383
 
385 384
 		} // End if().
386
-		elseif ( ! give_verify_minimum_price() ) {
385
+		elseif ( ! give_verify_minimum_price()) {
387 386
 			// translators: %s: minimum donation amount.
388 387
 			give_set_error(
389 388
 				'invalid_donation_minimum',
390 389
 				sprintf(
391 390
 				/* translators: %s: minimum donation amount */
392
-					__( 'This form has a minimum donation amount of %s.', 'give' ),
393
-					give_currency_filter( give_format_amount( give_get_form_minimum_price( $form_id ), array( 'sanitize' => false ) ) )
391
+					__('This form has a minimum donation amount of %s.', 'give'),
392
+					give_currency_filter(give_format_amount(give_get_form_minimum_price($form_id), array('sanitize' => false)))
394 393
 				)
395 394
 			);
396 395
 
397 396
 		} //Is this test mode zero donation? Let it through but set to manual gateway.
398
-		elseif ( $amount == 0 && give_is_test_mode() ) {
397
+		elseif ($amount == 0 && give_is_test_mode()) {
399 398
 
400 399
 			$gateway = 'manual';
401 400
 
402 401
 		} //Check if this gateway is active.
403
-		elseif ( ! give_is_gateway_active( $gateway ) ) {
402
+		elseif ( ! give_is_gateway_active($gateway)) {
404 403
 
405
-			give_set_error( 'invalid_gateway', __( 'The selected payment gateway is not enabled.', 'give' ) );
404
+			give_set_error('invalid_gateway', __('The selected payment gateway is not enabled.', 'give'));
406 405
 
407 406
 		}
408 407
 	}
@@ -420,21 +419,21 @@  discard block
 block discarded – undo
420 419
  */
421 420
 function give_verify_minimum_price() {
422 421
 
423
-	$amount          = give_maybe_sanitize_amount( $_REQUEST['give-amount'] );
424
-	$form_id         = isset( $_REQUEST['give-form-id'] ) ? $_REQUEST['give-form-id'] : 0;
425
-	$price_id        = isset( $_REQUEST['give-price-id'] ) ? $_REQUEST['give-price-id'] : null;
426
-	$variable_prices = give_has_variable_prices( $form_id );
422
+	$amount          = give_maybe_sanitize_amount($_REQUEST['give-amount']);
423
+	$form_id         = isset($_REQUEST['give-form-id']) ? $_REQUEST['give-form-id'] : 0;
424
+	$price_id        = isset($_REQUEST['give-price-id']) ? $_REQUEST['give-price-id'] : null;
425
+	$variable_prices = give_has_variable_prices($form_id);
427 426
 
428
-	if ( $variable_prices && in_array( $price_id, give_get_variable_price_ids( $form_id ) ) ) {
427
+	if ($variable_prices && in_array($price_id, give_get_variable_price_ids($form_id))) {
429 428
 
430
-		$price_level_amount = give_get_price_option_amount( $form_id, $price_id );
429
+		$price_level_amount = give_get_price_option_amount($form_id, $price_id);
431 430
 
432
-		if ( $price_level_amount == $amount ) {
431
+		if ($price_level_amount == $amount) {
433 432
 			return true;
434 433
 		}
435 434
 	}
436 435
 
437
-	if ( give_get_form_minimum_price( $form_id ) > $amount ) {
436
+	if (give_get_form_minimum_price($form_id) > $amount) {
438 437
 		return false;
439 438
 	}
440 439
 
@@ -450,9 +449,9 @@  discard block
 block discarded – undo
450 449
  */
451 450
 function give_donation_form_validate_agree_to_terms() {
452 451
 	// Validate agree to terms.
453
-	if ( ! isset( $_POST['give_agree_to_terms'] ) || $_POST['give_agree_to_terms'] != 1 ) {
452
+	if ( ! isset($_POST['give_agree_to_terms']) || $_POST['give_agree_to_terms'] != 1) {
454 453
 		// User did not agree.
455
-		give_set_error( 'agree_to_terms', apply_filters( 'give_agree_to_terms_text', __( 'You must agree to the terms and conditions.', 'give' ) ) );
454
+		give_set_error('agree_to_terms', apply_filters('give_agree_to_terms_text', __('You must agree to the terms and conditions.', 'give')));
456 455
 	}
457 456
 }
458 457
 
@@ -466,59 +465,59 @@  discard block
 block discarded – undo
466 465
  *
467 466
  * @return      array
468 467
  */
469
-function give_get_required_fields( $form_id ) {
468
+function give_get_required_fields($form_id) {
470 469
 
471
-	$payment_mode = give_get_chosen_gateway( $form_id );
470
+	$payment_mode = give_get_chosen_gateway($form_id);
472 471
 
473 472
 	$required_fields = array(
474 473
 		'give_email' => array(
475 474
 			'error_id'      => 'invalid_email',
476
-			'error_message' => __( 'Please enter a valid email address.', 'give' ),
475
+			'error_message' => __('Please enter a valid email address.', 'give'),
477 476
 		),
478 477
 		'give_first' => array(
479 478
 			'error_id'      => 'invalid_first_name',
480
-			'error_message' => __( 'Please enter your first name.', 'give' ),
479
+			'error_message' => __('Please enter your first name.', 'give'),
481 480
 		),
482 481
 	);
483 482
 
484
-	$require_address = give_require_billing_address( $payment_mode );
483
+	$require_address = give_require_billing_address($payment_mode);
485 484
 
486
-	if ( $require_address ) {
487
-		$required_fields['card_address']    = array(
485
+	if ($require_address) {
486
+		$required_fields['card_address'] = array(
488 487
 			'error_id'      => 'invalid_card_address',
489
-			'error_message' => __( 'Please enter your primary billing address.', 'give' ),
488
+			'error_message' => __('Please enter your primary billing address.', 'give'),
490 489
 		);
491
-		$required_fields['card_zip']        = array(
490
+		$required_fields['card_zip'] = array(
492 491
 			'error_id'      => 'invalid_zip_code',
493
-			'error_message' => __( 'Please enter your zip / postal code.', 'give' ),
492
+			'error_message' => __('Please enter your zip / postal code.', 'give'),
494 493
 		);
495
-		$required_fields['card_city']       = array(
494
+		$required_fields['card_city'] = array(
496 495
 			'error_id'      => 'invalid_city',
497
-			'error_message' => __( 'Please enter your billing city.', 'give' ),
496
+			'error_message' => __('Please enter your billing city.', 'give'),
498 497
 		);
499 498
 		$required_fields['billing_country'] = array(
500 499
 			'error_id'      => 'invalid_country',
501
-			'error_message' => __( 'Please select your billing country.', 'give' ),
500
+			'error_message' => __('Please select your billing country.', 'give'),
502 501
 		);
503 502
 
504 503
 
505 504
 		$required_fields['card_state'] = array(
506 505
 			'error_id'      => 'invalid_state',
507
-			'error_message' => __( 'Please enter billing state / province / County.', 'give' ),
506
+			'error_message' => __('Please enter billing state / province / County.', 'give'),
508 507
 		);
509 508
 
510 509
 		// Check if billing country already exists.
511
-		if ( ! empty( $_POST['billing_country'] ) ) {
510
+		if ( ! empty($_POST['billing_country'])) {
512 511
 			// Get the value from $_POST.
513
-			$country = sanitize_text_field( $_POST['billing_country'] );
512
+			$country = sanitize_text_field($_POST['billing_country']);
514 513
 
515 514
 			// Get the country list that does not required any states init.
516 515
 			$states_country = give_states_not_required_country_list();
517 516
 
518 517
 			// Check if states is empty or not.
519
-			if ( array_key_exists( $country, $states_country ) ) {
518
+			if (array_key_exists($country, $states_country)) {
520 519
 				// If states is empty remove the required feilds of state in billing cart.
521
-				unset( $required_fields['card_state'] );
520
+				unset($required_fields['card_state']);
522 521
 			}
523 522
 		}
524 523
 	}
@@ -528,7 +527,7 @@  discard block
 block discarded – undo
528 527
 	 *
529 528
 	 * @since 1.7
530 529
 	 */
531
-	$required_fields = apply_filters( 'give_donation_form_required_fields', $required_fields, $form_id );
530
+	$required_fields = apply_filters('give_donation_form_required_fields', $required_fields, $form_id);
532 531
 
533 532
 	return $required_fields;
534 533
 
@@ -543,16 +542,16 @@  discard block
 block discarded – undo
543 542
  *
544 543
  * @return bool
545 544
  */
546
-function give_require_billing_address( $payment_mode ) {
545
+function give_require_billing_address($payment_mode) {
547 546
 
548 547
 	$return = false;
549 548
 
550
-	if ( isset( $_POST['billing_country'] ) || did_action( "give_{$payment_mode}_cc_form" ) || did_action( 'give_cc_form' ) ) {
549
+	if (isset($_POST['billing_country']) || did_action("give_{$payment_mode}_cc_form") || did_action('give_cc_form')) {
551 550
 		$return = true;
552 551
 	}
553 552
 
554 553
 	// Let payment gateways and other extensions determine if address fields should be required.
555
-	return apply_filters( 'give_require_billing_address', $return );
554
+	return apply_filters('give_require_billing_address', $return);
556 555
 
557 556
 }
558 557
 
@@ -566,38 +565,38 @@  discard block
 block discarded – undo
566 565
 function give_donation_form_validate_logged_in_user() {
567 566
 	global $user_ID;
568 567
 
569
-	$form_id = isset( $_POST['give-form-id'] ) ? $_POST['give-form-id'] : '';
568
+	$form_id = isset($_POST['give-form-id']) ? $_POST['give-form-id'] : '';
570 569
 
571 570
 	// Start empty array to collect valid user data.
572 571
 	$valid_user_data = array(
573 572
 		// Assume there will be errors.
574
-		'user_id' => - 1,
573
+		'user_id' => -1,
575 574
 	);
576 575
 
577 576
 	// Verify there is a user_ID.
578
-	if ( $user_ID > 0 ) {
577
+	if ($user_ID > 0) {
579 578
 		// Get the logged in user data.
580
-		$user_data = get_userdata( $user_ID );
579
+		$user_data = get_userdata($user_ID);
581 580
 
582 581
 		// Validate Required Form Fields.
583
-		give_validate_required_form_fields( $form_id );
582
+		give_validate_required_form_fields($form_id);
584 583
 
585 584
 		// Verify data.
586
-		if ( $user_data ) {
585
+		if ($user_data) {
587 586
 			// Collected logged in user data.
588 587
 			$valid_user_data = array(
589 588
 				'user_id'    => $user_ID,
590
-				'user_email' => isset( $_POST['give_email'] ) ? sanitize_email( $_POST['give_email'] ) : $user_data->user_email,
591
-				'user_first' => isset( $_POST['give_first'] ) && ! empty( $_POST['give_first'] ) ? sanitize_text_field( $_POST['give_first'] ) : $user_data->first_name,
592
-				'user_last'  => isset( $_POST['give_last'] ) && ! empty( $_POST['give_last'] ) ? sanitize_text_field( $_POST['give_last'] ) : $user_data->last_name,
589
+				'user_email' => isset($_POST['give_email']) ? sanitize_email($_POST['give_email']) : $user_data->user_email,
590
+				'user_first' => isset($_POST['give_first']) && ! empty($_POST['give_first']) ? sanitize_text_field($_POST['give_first']) : $user_data->first_name,
591
+				'user_last'  => isset($_POST['give_last']) && ! empty($_POST['give_last']) ? sanitize_text_field($_POST['give_last']) : $user_data->last_name,
593 592
 			);
594 593
 
595
-			if ( ! is_email( $valid_user_data['user_email'] ) ) {
596
-				give_set_error( 'email_invalid', esc_html__( 'Invalid email.', 'give' ) );
594
+			if ( ! is_email($valid_user_data['user_email'])) {
595
+				give_set_error('email_invalid', esc_html__('Invalid email.', 'give'));
597 596
 			}
598 597
 		} else {
599 598
 			// Set invalid user error.
600
-			give_set_error( 'invalid_user', esc_html__( 'The user information is invalid.', 'give' ) );
599
+			give_set_error('invalid_user', esc_html__('The user information is invalid.', 'give'));
601 600
 		}
602 601
 	}
603 602
 
@@ -619,7 +618,7 @@  discard block
 block discarded – undo
619 618
 	// Default user data.
620 619
 	$default_user_data = array(
621 620
 		'give-form-id'           => '',
622
-		'user_id'                => - 1, // Assume there will be errors.
621
+		'user_id'                => -1, // Assume there will be errors.
623 622
 		'user_first'             => '',
624 623
 		'user_last'              => '',
625 624
 		'give_user_login'        => false,
@@ -629,14 +628,14 @@  discard block
 block discarded – undo
629 628
 	);
630 629
 
631 630
 	// Get user data.
632
-	$user_data            = wp_parse_args( give_clean( $_POST ), $default_user_data );
631
+	$user_data            = wp_parse_args(give_clean($_POST), $default_user_data);
633 632
 	$registering_new_user = false;
634
-	$form_id              = absint( $user_data['give-form-id'] );
633
+	$form_id              = absint($user_data['give-form-id']);
635 634
 
636 635
 	// Start an empty array to collect valid user data.
637 636
 	$valid_user_data = array(
638 637
 		// Assume there will be errors.
639
-		'user_id'    => - 1,
638
+		'user_id'    => -1,
640 639
 
641 640
 		// Get first name.
642 641
 		'user_first' => $user_data['give_first'],
@@ -649,13 +648,13 @@  discard block
 block discarded – undo
649 648
 	);
650 649
 
651 650
 	// Validate Required Form Fields.
652
-	give_validate_required_form_fields( $form_id );
651
+	give_validate_required_form_fields($form_id);
653 652
 
654 653
 	// Set Email as Username.
655 654
 	$valid_user_data['user_login'] = $user_data['give_email'];
656 655
 
657 656
 	// Check if we have an email to verify.
658
-	if ( give_validate_user_email( $user_data['give_email'], $registering_new_user ) ) {
657
+	if (give_validate_user_email($user_data['give_email'], $registering_new_user)) {
659 658
 		$valid_user_data['user_email'] = $user_data['give_email'];
660 659
 	}
661 660
 
@@ -674,36 +673,36 @@  discard block
 block discarded – undo
674 673
 	// Start an array to collect valid user data.
675 674
 	$valid_user_data = array(
676 675
 		// Assume there will be errors.
677
-		'user_id' => - 1,
676
+		'user_id' => -1,
678 677
 	);
679 678
 
680 679
 	// Username.
681
-	if ( ! isset( $_POST['give_user_login'] ) || $_POST['give_user_login'] == '' ) {
682
-		give_set_error( 'must_log_in', __( 'You must register or login to complete your donation.', 'give' ) );
680
+	if ( ! isset($_POST['give_user_login']) || $_POST['give_user_login'] == '') {
681
+		give_set_error('must_log_in', __('You must register or login to complete your donation.', 'give'));
683 682
 
684 683
 		return $valid_user_data;
685 684
 	}
686 685
 
687 686
 	// Get the user by login.
688
-	$user_data = get_user_by( 'login', strip_tags( $_POST['give_user_login'] ) );
687
+	$user_data = get_user_by('login', strip_tags($_POST['give_user_login']));
689 688
 
690 689
 	// Check if user exists.
691
-	if ( $user_data ) {
690
+	if ($user_data) {
692 691
 		// Get password.
693
-		$user_pass = isset( $_POST['give_user_pass'] ) ? $_POST['give_user_pass'] : false;
692
+		$user_pass = isset($_POST['give_user_pass']) ? $_POST['give_user_pass'] : false;
694 693
 
695 694
 		// Check user_pass.
696
-		if ( $user_pass ) {
695
+		if ($user_pass) {
697 696
 			// Check if password is valid.
698
-			if ( ! wp_check_password( $user_pass, $user_data->user_pass, $user_data->ID ) ) {
697
+			if ( ! wp_check_password($user_pass, $user_data->user_pass, $user_data->ID)) {
699 698
 				// Incorrect password.
700 699
 				give_set_error(
701 700
 					'password_incorrect',
702 701
 					sprintf(
703 702
 						'%1$s <a href="%2$s">%3$s</a>',
704
-						__( 'The password you entered is incorrect.', 'give' ),
705
-						wp_lostpassword_url( "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]" ),
706
-						__( 'Reset Password', 'give' )
703
+						__('The password you entered is incorrect.', 'give'),
704
+						wp_lostpassword_url("http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"),
705
+						__('Reset Password', 'give')
707 706
 					)
708 707
 				);
709 708
 				// All is correct.
@@ -721,11 +720,11 @@  discard block
 block discarded – undo
721 720
 			}
722 721
 		} else {
723 722
 			// Empty password.
724
-			give_set_error( 'password_empty', __( 'Enter a password.', 'give' ) );
723
+			give_set_error('password_empty', __('Enter a password.', 'give'));
725 724
 		}
726 725
 	} else {
727 726
 		// No username.
728
-		give_set_error( 'username_incorrect', __( 'The username you entered does not exist.', 'give' ) );
727
+		give_set_error('username_incorrect', __('The username you entered does not exist.', 'give'));
729 728
 	}// End if().
730 729
 
731 730
 	return $valid_user_data;
@@ -740,7 +739,7 @@  discard block
 block discarded – undo
740 739
  */
741 740
 function give_donation_form_validate_guest_user() {
742 741
 
743
-	$form_id = isset( $_POST['give-form-id'] ) ? $_POST['give-form-id'] : '';
742
+	$form_id = isset($_POST['give-form-id']) ? $_POST['give-form-id'] : '';
744 743
 
745 744
 	// Start an array to collect valid user data.
746 745
 	$valid_user_data = array(
@@ -749,31 +748,31 @@  discard block
 block discarded – undo
749 748
 	);
750 749
 
751 750
 	// Get the guest email.
752
-	$guest_email = isset( $_POST['give_email'] ) ? $_POST['give_email'] : false;
751
+	$guest_email = isset($_POST['give_email']) ? $_POST['give_email'] : false;
753 752
 
754 753
 	// Check email.
755
-	if ( $guest_email && strlen( $guest_email ) > 0 ) {
754
+	if ($guest_email && strlen($guest_email) > 0) {
756 755
 		// Validate email.
757
-		if ( ! is_email( $guest_email ) ) {
756
+		if ( ! is_email($guest_email)) {
758 757
 			// Invalid email.
759
-			give_set_error( 'email_invalid', __( 'Invalid email.', 'give' ) );
758
+			give_set_error('email_invalid', __('Invalid email.', 'give'));
760 759
 		} else {
761 760
 			// All is good to go.
762 761
 			$valid_user_data['user_email'] = $guest_email;
763 762
 
764 763
 			// Get user_id from donor if exist.
765
-			$donor = new Give_Donor( $guest_email );
766
-			if ( $donor->id && $donor->user_id ) {
764
+			$donor = new Give_Donor($guest_email);
765
+			if ($donor->id && $donor->user_id) {
767 766
 				$valid_user_data['user_id'] = $donor->user_id;
768 767
 			}
769 768
 		}
770 769
 	} else {
771 770
 		// No email.
772
-		give_set_error( 'email_empty', __( 'Enter an email.', 'give' ) );
771
+		give_set_error('email_empty', __('Enter an email.', 'give'));
773 772
 	}
774 773
 
775 774
 	// Validate Required Form Fields.
776
-	give_validate_required_form_fields( $form_id );
775
+	give_validate_required_form_fields($form_id);
777 776
 
778 777
 	return $valid_user_data;
779 778
 }
@@ -787,36 +786,36 @@  discard block
 block discarded – undo
787 786
  * @since   1.0
788 787
  * @return  integer
789 788
  */
790
-function give_register_and_login_new_user( $user_data = array() ) {
789
+function give_register_and_login_new_user($user_data = array()) {
791 790
 	// Verify the array.
792
-	if ( empty( $user_data ) ) {
793
-		return - 1;
791
+	if (empty($user_data)) {
792
+		return -1;
794 793
 	}
795 794
 
796
-	if ( give_get_errors() ) {
797
-		return - 1;
795
+	if (give_get_errors()) {
796
+		return -1;
798 797
 	}
799 798
 
800
-	$user_args = apply_filters( 'give_insert_user_args', array(
801
-		'user_login'      => isset( $user_data['user_login'] ) ? $user_data['user_login'] : '',
802
-		'user_pass'       => isset( $user_data['user_pass'] ) ? $user_data['user_pass'] : '',
803
-		'user_email'      => isset( $user_data['user_email'] ) ? $user_data['user_email'] : '',
804
-		'first_name'      => isset( $user_data['user_first'] ) ? $user_data['user_first'] : '',
805
-		'last_name'       => isset( $user_data['user_last'] ) ? $user_data['user_last'] : '',
806
-		'user_registered' => date( 'Y-m-d H:i:s' ),
807
-		'role'            => give_get_option( 'donor_default_user_role', 'give_donor' ),
808
-	), $user_data );
799
+	$user_args = apply_filters('give_insert_user_args', array(
800
+		'user_login'      => isset($user_data['user_login']) ? $user_data['user_login'] : '',
801
+		'user_pass'       => isset($user_data['user_pass']) ? $user_data['user_pass'] : '',
802
+		'user_email'      => isset($user_data['user_email']) ? $user_data['user_email'] : '',
803
+		'first_name'      => isset($user_data['user_first']) ? $user_data['user_first'] : '',
804
+		'last_name'       => isset($user_data['user_last']) ? $user_data['user_last'] : '',
805
+		'user_registered' => date('Y-m-d H:i:s'),
806
+		'role'            => give_get_option('donor_default_user_role', 'give_donor'),
807
+	), $user_data);
809 808
 
810 809
 	// Insert new user.
811
-	$user_id = wp_insert_user( $user_args );
810
+	$user_id = wp_insert_user($user_args);
812 811
 
813 812
 	// Validate inserted user.
814
-	if ( is_wp_error( $user_id ) ) {
815
-		return - 1;
813
+	if (is_wp_error($user_id)) {
814
+		return -1;
816 815
 	}
817 816
 
818 817
 	// Allow themes and plugins to filter the user data.
819
-	$user_data = apply_filters( 'give_insert_user_data', $user_data, $user_args );
818
+	$user_data = apply_filters('give_insert_user_data', $user_data, $user_args);
820 819
 
821 820
 	/**
822 821
 	 * Fires after inserting user.
@@ -826,7 +825,7 @@  discard block
 block discarded – undo
826 825
 	 * @param int $user_id User id.
827 826
 	 * @param array $user_data Array containing user data.
828 827
 	 */
829
-	do_action( 'give_insert_user', $user_id, $user_data );
828
+	do_action('give_insert_user', $user_id, $user_data);
830 829
 
831 830
 	/**
832 831
 	 * Filter allow user to alter if user when to login or not when user is register for the first time.
@@ -835,9 +834,9 @@  discard block
 block discarded – undo
835 834
 	 *
836 835
 	 * return bool True if login with registration and False if only want to register.
837 836
 	 */
838
-	if ( true === (bool) apply_filters( 'give_log_user_in_on_register', true ) ) {
837
+	if (true === (bool) apply_filters('give_log_user_in_on_register', true)) {
839 838
 		// Login new user.
840
-		give_log_user_in( $user_id, $user_data['user_login'], $user_data['user_pass'] );
839
+		give_log_user_in($user_id, $user_data['user_login'], $user_data['user_pass']);
841 840
 	}
842 841
 
843 842
 	// Return user id.
@@ -853,27 +852,27 @@  discard block
 block discarded – undo
853 852
  * @since   1.0
854 853
  * @return  array|bool
855 854
  */
856
-function give_get_donation_form_user( $valid_data = array() ) {
855
+function give_get_donation_form_user($valid_data = array()) {
857 856
 
858 857
 	// Initialize user.
859 858
 	$user    = false;
860
-	$is_ajax = defined( 'DOING_AJAX' ) && DOING_AJAX;
859
+	$is_ajax = defined('DOING_AJAX') && DOING_AJAX;
861 860
 
862
-	if ( $is_ajax ) {
861
+	if ($is_ajax) {
863 862
 		// Do not create or login the user during the ajax submission (check for errors only).
864 863
 		return true;
865
-	} elseif ( is_user_logged_in() ) {
864
+	} elseif (is_user_logged_in()) {
866 865
 		// Set the valid user as the logged in collected data.
867 866
 		$user = $valid_data['logged_in_user'];
868
-	} elseif ( $valid_data['need_new_user'] === true || $valid_data['need_user_login'] === true ) {
867
+	} elseif ($valid_data['need_new_user'] === true || $valid_data['need_user_login'] === true) {
869 868
 		// New user registration.
870
-		if ( $valid_data['need_new_user'] === true ) {
869
+		if ($valid_data['need_new_user'] === true) {
871 870
 			// Set user.
872 871
 			$user = $valid_data['new_user_data'];
873 872
 			// Register and login new user.
874
-			$user['user_id'] = give_register_and_login_new_user( $user );
873
+			$user['user_id'] = give_register_and_login_new_user($user);
875 874
 			// User login
876
-		} elseif ( $valid_data['need_user_login'] === true && ! $is_ajax ) {
875
+		} elseif ($valid_data['need_user_login'] === true && ! $is_ajax) {
877 876
 
878 877
 			/**
879 878
 			 * The login form is now processed in the give_process_donation_login() function.
@@ -885,42 +884,42 @@  discard block
 block discarded – undo
885 884
 			// Set user.
886 885
 			$user = $valid_data['login_user_data'];
887 886
 			// Login user.
888
-			give_log_user_in( $user['user_id'], $user['user_login'], $user['user_pass'] );
887
+			give_log_user_in($user['user_id'], $user['user_login'], $user['user_pass']);
889 888
 		}
890 889
 	}
891 890
 
892 891
 	// Check guest checkout.
893
-	if ( false === $user && false === give_logged_in_only( $_POST['give-form-id'] ) ) {
892
+	if (false === $user && false === give_logged_in_only($_POST['give-form-id'])) {
894 893
 		// Set user
895 894
 		$user = $valid_data['guest_user_data'];
896 895
 	}
897 896
 
898 897
 	// Verify we have an user.
899
-	if ( false === $user || empty( $user ) ) {
898
+	if (false === $user || empty($user)) {
900 899
 		// Return false.
901 900
 		return false;
902 901
 	}
903 902
 
904 903
 	// Get user first name.
905
-	if ( ! isset( $user['user_first'] ) || strlen( trim( $user['user_first'] ) ) < 1 ) {
906
-		$user['user_first'] = isset( $_POST['give_first'] ) ? strip_tags( trim( $_POST['give_first'] ) ) : '';
904
+	if ( ! isset($user['user_first']) || strlen(trim($user['user_first'])) < 1) {
905
+		$user['user_first'] = isset($_POST['give_first']) ? strip_tags(trim($_POST['give_first'])) : '';
907 906
 	}
908 907
 
909 908
 	// Get user last name.
910
-	if ( ! isset( $user['user_last'] ) || strlen( trim( $user['user_last'] ) ) < 1 ) {
911
-		$user['user_last'] = isset( $_POST['give_last'] ) ? strip_tags( trim( $_POST['give_last'] ) ) : '';
909
+	if ( ! isset($user['user_last']) || strlen(trim($user['user_last'])) < 1) {
910
+		$user['user_last'] = isset($_POST['give_last']) ? strip_tags(trim($_POST['give_last'])) : '';
912 911
 	}
913 912
 
914 913
 	// Get the user's billing address details.
915 914
 	$user['address']            = array();
916
-	$user['address']['line1']   = ! empty( $_POST['card_address'] ) ? give_clean( $_POST['card_address'] ) : false;
917
-	$user['address']['line2']   = ! empty( $_POST['card_address_2'] ) ? give_clean( $_POST['card_address_2'] ) : false;
918
-	$user['address']['city']    = ! empty( $_POST['card_city'] ) ? give_clean( $_POST['card_city'] ) : false;
919
-	$user['address']['state']   = ! empty( $_POST['card_state'] ) ? give_clean( $_POST['card_state'] ) : false;
920
-	$user['address']['zip']     = ! empty( $_POST['card_zip'] ) ? give_clean( $_POST['card_zip'] ) : false;
921
-	$user['address']['country'] = ! empty( $_POST['billing_country'] ) ? give_clean( $_POST['billing_country'] ) : false;
922
-
923
-	if ( empty( $user['address']['country'] ) ) {
915
+	$user['address']['line1']   = ! empty($_POST['card_address']) ? give_clean($_POST['card_address']) : false;
916
+	$user['address']['line2']   = ! empty($_POST['card_address_2']) ? give_clean($_POST['card_address_2']) : false;
917
+	$user['address']['city']    = ! empty($_POST['card_city']) ? give_clean($_POST['card_city']) : false;
918
+	$user['address']['state']   = ! empty($_POST['card_state']) ? give_clean($_POST['card_state']) : false;
919
+	$user['address']['zip']     = ! empty($_POST['card_zip']) ? give_clean($_POST['card_zip']) : false;
920
+	$user['address']['country'] = ! empty($_POST['billing_country']) ? give_clean($_POST['billing_country']) : false;
921
+
922
+	if (empty($user['address']['country'])) {
924 923
 		$user['address'] = false;
925 924
 	} // End if().
926 925
 
@@ -940,16 +939,16 @@  discard block
 block discarded – undo
940 939
 	$card_data = give_get_donation_cc_info();
941 940
 
942 941
 	// Validate the card zip.
943
-	if ( ! empty( $card_data['card_zip'] ) ) {
944
-		if ( ! give_donation_form_validate_cc_zip( $card_data['card_zip'], $card_data['card_country'] ) ) {
945
-			give_set_error( 'invalid_cc_zip', __( 'The zip / postal code you entered for your billing address is invalid.', 'give' ) );
942
+	if ( ! empty($card_data['card_zip'])) {
943
+		if ( ! give_donation_form_validate_cc_zip($card_data['card_zip'], $card_data['card_country'])) {
944
+			give_set_error('invalid_cc_zip', __('The zip / postal code you entered for your billing address is invalid.', 'give'));
946 945
 		}
947 946
 	}
948 947
 
949 948
 	// Ensure no spaces.
950
-	if ( ! empty( $card_data['card_number'] ) ) {
951
-		$card_data['card_number'] = str_replace( '+', '', $card_data['card_number'] ); // no "+" signs
952
-		$card_data['card_number'] = str_replace( ' ', '', $card_data['card_number'] ); // No spaces
949
+	if ( ! empty($card_data['card_number'])) {
950
+		$card_data['card_number'] = str_replace('+', '', $card_data['card_number']); // no "+" signs
951
+		$card_data['card_number'] = str_replace(' ', '', $card_data['card_number']); // No spaces
953 952
 	}
954 953
 
955 954
 	// This should validate card numbers at some point too.
@@ -966,17 +965,17 @@  discard block
 block discarded – undo
966 965
 function give_get_donation_cc_info() {
967 966
 
968 967
 	$cc_info                   = array();
969
-	$cc_info['card_name']      = isset( $_POST['card_name'] ) ? sanitize_text_field( $_POST['card_name'] ) : '';
970
-	$cc_info['card_number']    = isset( $_POST['card_number'] ) ? sanitize_text_field( $_POST['card_number'] ) : '';
971
-	$cc_info['card_cvc']       = isset( $_POST['card_cvc'] ) ? sanitize_text_field( $_POST['card_cvc'] ) : '';
972
-	$cc_info['card_exp_month'] = isset( $_POST['card_exp_month'] ) ? sanitize_text_field( $_POST['card_exp_month'] ) : '';
973
-	$cc_info['card_exp_year']  = isset( $_POST['card_exp_year'] ) ? sanitize_text_field( $_POST['card_exp_year'] ) : '';
974
-	$cc_info['card_address']   = isset( $_POST['card_address'] ) ? sanitize_text_field( $_POST['card_address'] ) : '';
975
-	$cc_info['card_address_2'] = isset( $_POST['card_address_2'] ) ? sanitize_text_field( $_POST['card_address_2'] ) : '';
976
-	$cc_info['card_city']      = isset( $_POST['card_city'] ) ? sanitize_text_field( $_POST['card_city'] ) : '';
977
-	$cc_info['card_state']     = isset( $_POST['card_state'] ) ? sanitize_text_field( $_POST['card_state'] ) : '';
978
-	$cc_info['card_country']   = isset( $_POST['billing_country'] ) ? sanitize_text_field( $_POST['billing_country'] ) : '';
979
-	$cc_info['card_zip']       = isset( $_POST['card_zip'] ) ? sanitize_text_field( $_POST['card_zip'] ) : '';
968
+	$cc_info['card_name']      = isset($_POST['card_name']) ? sanitize_text_field($_POST['card_name']) : '';
969
+	$cc_info['card_number']    = isset($_POST['card_number']) ? sanitize_text_field($_POST['card_number']) : '';
970
+	$cc_info['card_cvc']       = isset($_POST['card_cvc']) ? sanitize_text_field($_POST['card_cvc']) : '';
971
+	$cc_info['card_exp_month'] = isset($_POST['card_exp_month']) ? sanitize_text_field($_POST['card_exp_month']) : '';
972
+	$cc_info['card_exp_year']  = isset($_POST['card_exp_year']) ? sanitize_text_field($_POST['card_exp_year']) : '';
973
+	$cc_info['card_address']   = isset($_POST['card_address']) ? sanitize_text_field($_POST['card_address']) : '';
974
+	$cc_info['card_address_2'] = isset($_POST['card_address_2']) ? sanitize_text_field($_POST['card_address_2']) : '';
975
+	$cc_info['card_city']      = isset($_POST['card_city']) ? sanitize_text_field($_POST['card_city']) : '';
976
+	$cc_info['card_state']     = isset($_POST['card_state']) ? sanitize_text_field($_POST['card_state']) : '';
977
+	$cc_info['card_country']   = isset($_POST['billing_country']) ? sanitize_text_field($_POST['billing_country']) : '';
978
+	$cc_info['card_zip']       = isset($_POST['card_zip']) ? sanitize_text_field($_POST['card_zip']) : '';
980 979
 
981 980
 	// Return cc info.
982 981
 	return $cc_info;
@@ -992,14 +991,14 @@  discard block
 block discarded – undo
992 991
  *
993 992
  * @return bool|mixed
994 993
  */
995
-function give_donation_form_validate_cc_zip( $zip = 0, $country_code = '' ) {
994
+function give_donation_form_validate_cc_zip($zip = 0, $country_code = '') {
996 995
 	$ret = false;
997 996
 
998
-	if ( empty( $zip ) || empty( $country_code ) ) {
997
+	if (empty($zip) || empty($country_code)) {
999 998
 		return $ret;
1000 999
 	}
1001 1000
 
1002
-	$country_code = strtoupper( $country_code );
1001
+	$country_code = strtoupper($country_code);
1003 1002
 
1004 1003
 	$zip_regex = array(
1005 1004
 		'AD' => 'AD\d{3}',
@@ -1159,11 +1158,11 @@  discard block
 block discarded – undo
1159 1158
 		'ZM' => '\d{5}',
1160 1159
 	);
1161 1160
 
1162
-	if ( ! isset( $zip_regex[ $country_code ] ) || preg_match( '/' . $zip_regex[ $country_code ] . '/i', $zip ) ) {
1161
+	if ( ! isset($zip_regex[$country_code]) || preg_match('/'.$zip_regex[$country_code].'/i', $zip)) {
1163 1162
 		$ret = true;
1164 1163
 	}
1165 1164
 
1166
-	return apply_filters( 'give_is_zip_valid', $ret, $zip, $country_code );
1165
+	return apply_filters('give_is_zip_valid', $ret, $zip, $country_code);
1167 1166
 }
1168 1167
 
1169 1168
 
@@ -1177,47 +1176,47 @@  discard block
 block discarded – undo
1177 1176
  *
1178 1177
  * @return bool
1179 1178
  */
1180
-function give_validate_donation_amount( $valid_data, $data ) {
1179
+function give_validate_donation_amount($valid_data, $data) {
1181 1180
 	/* @var Give_Donate_Form $form */
1182
-	$form = new Give_Donate_Form( $data['give-form-id'] );
1181
+	$form = new Give_Donate_Form($data['give-form-id']);
1183 1182
 
1184 1183
 	$donation_level_matched = false;
1185 1184
 
1186
-	if ( $form->is_set_type_donation_form() ) {
1185
+	if ($form->is_set_type_donation_form()) {
1187 1186
 		// Sanitize donation amount.
1188
-		$data['give-amount'] = give_maybe_sanitize_amount( $data['give-amount'] );
1187
+		$data['give-amount'] = give_maybe_sanitize_amount($data['give-amount']);
1189 1188
 
1190 1189
 		// Backward compatibility.
1191
-		if ( $form->is_custom_price( $data['give-amount'] ) ) {
1190
+		if ($form->is_custom_price($data['give-amount'])) {
1192 1191
 			$_POST['give-price-id'] = 'custom';
1193 1192
 		}
1194 1193
 
1195 1194
 		$donation_level_matched = true;
1196 1195
 
1197
-	} elseif ( $form->is_multi_type_donation_form() ) {
1196
+	} elseif ($form->is_multi_type_donation_form()) {
1198 1197
 
1199 1198
 		// Bailout.
1200
-		if ( ! ( $variable_prices = $form->get_prices() ) ) {
1199
+		if ( ! ($variable_prices = $form->get_prices())) {
1201 1200
 			return false;
1202 1201
 		}
1203 1202
 
1204 1203
 		// Sanitize donation amount.
1205
-		$data['give-amount'] = give_maybe_sanitize_amount( $data['give-amount'] );
1204
+		$data['give-amount'] = give_maybe_sanitize_amount($data['give-amount']);
1206 1205
 
1207
-		if ( $data['give-amount'] === give_maybe_sanitize_amount( give_get_price_option_amount( $data['give-form-id'], $data['give-price-id'] ) ) ) {
1206
+		if ($data['give-amount'] === give_maybe_sanitize_amount(give_get_price_option_amount($data['give-form-id'], $data['give-price-id']))) {
1208 1207
 			return true;
1209 1208
 		}
1210 1209
 
1211
-		if ( $form->is_custom_price( $data['give-amount'] ) ) {
1210
+		if ($form->is_custom_price($data['give-amount'])) {
1212 1211
 			$_POST['give-price-id'] = 'custom';
1213 1212
 		} else {
1214 1213
 			// Find correct donation level from all donation levels.
1215
-			foreach ( $variable_prices as $variable_price ) {
1214
+			foreach ($variable_prices as $variable_price) {
1216 1215
 				// Sanitize level amount.
1217
-				$variable_price['_give_amount'] = give_maybe_sanitize_amount( $variable_price['_give_amount'] );
1216
+				$variable_price['_give_amount'] = give_maybe_sanitize_amount($variable_price['_give_amount']);
1218 1217
 
1219 1218
 				// Set first match donation level ID.
1220
-				if ( $data['give-amount'] === $variable_price['_give_amount'] ) {
1219
+				if ($data['give-amount'] === $variable_price['_give_amount']) {
1221 1220
 					$_POST['give-price-id'] = $variable_price['_give_id']['level_id'];
1222 1221
 					break;
1223 1222
 				}
@@ -1226,15 +1225,15 @@  discard block
 block discarded – undo
1226 1225
 
1227 1226
 		// If donation amount is not find in donation levels then check if form has custom donation feature enable or not.
1228 1227
 		// If yes then set price id to custom if amount is greater then custom minimum amount (if any).
1229
-		if ( ! empty( $_POST['give-price-id'] ) ) {
1228
+		if ( ! empty($_POST['give-price-id'])) {
1230 1229
 			$donation_level_matched = true;
1231 1230
 		}
1232 1231
 	}// End if().
1233 1232
 
1234
-	return ( $donation_level_matched ? true : false );
1233
+	return ($donation_level_matched ? true : false);
1235 1234
 }
1236 1235
 
1237
-add_action( 'give_checkout_error_checks', 'give_validate_donation_amount', 10, 2 );
1236
+add_action('give_checkout_error_checks', 'give_validate_donation_amount', 10, 2);
1238 1237
 
1239 1238
 /**
1240 1239
  * Validate Required Form Fields.
@@ -1243,17 +1242,17 @@  discard block
 block discarded – undo
1243 1242
  *
1244 1243
  * @since 2.0
1245 1244
  */
1246
-function give_validate_required_form_fields( $form_id ) {
1245
+function give_validate_required_form_fields($form_id) {
1247 1246
 
1248 1247
 	// Loop through required fields and show error messages.
1249
-	foreach ( give_get_required_fields( $form_id ) as $field_name => $value ) {
1248
+	foreach (give_get_required_fields($form_id) as $field_name => $value) {
1250 1249
 
1251 1250
 		// Clean Up Data of the input fields.
1252
-		$field_value = give_clean( $_POST[ $field_name ] );
1251
+		$field_value = give_clean($_POST[$field_name]);
1253 1252
 
1254 1253
 		// Check whether the required field is empty, then show the error message.
1255
-		if ( in_array( $value, give_get_required_fields( $form_id ) ) && empty( $field_value ) ) {
1256
-			give_set_error( $value['error_id'], $value['error_message'] );
1254
+		if (in_array($value, give_get_required_fields($form_id)) && empty($field_value)) {
1255
+			give_set_error($value['error_id'], $value['error_message']);
1257 1256
 		}
1258 1257
 	}
1259 1258
 }
Please login to merge, or discard this patch.