Completed
Pull Request — master (#1055)
by Rami
19:01
created
includes/template-functions.php 2 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -45,22 +45,22 @@  discard block
 block discarded – undo
45 45
  * @param string $default_path  Default path. Default is empty.
46 46
  */
47 47
 function give_get_template( $template_name, $args = array(), $template_path = '', $default_path = '' ) {
48
-    if ( ! empty( $args ) && is_array( $args ) ) {
49
-        extract( $args );
50
-    }
48
+	if ( ! empty( $args ) && is_array( $args ) ) {
49
+		extract( $args );
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_output_error( sprintf( __( 'The %s template was not found.', 'give' ), $located ), true );
59
-        return;
60
-    }
58
+		give_output_error( sprintf( __( 'The %s template was not found.', 'give' ), $located ), true );
59
+		return;
60
+	}
61 61
 
62
-    // Allow 3rd party plugin filter template file from their plugin.
63
-    $located = apply_filters( 'give_get_template', $located, $template_name, $args, $template_path, $default_path );
62
+	// Allow 3rd party plugin filter template file from their plugin.
63
+	$located = apply_filters( 'give_get_template', $located, $template_name, $args, $template_path, $default_path );
64 64
 
65 65
 	/**
66 66
 	 * Fires in give template, before the file is included.
@@ -74,9 +74,9 @@  discard block
 block discarded – undo
74 74
 	 * @param string $located       Template file filter by 3rd party plugin.
75 75
 	 * @param array  $args          Passed arguments.
76 76
 	 */
77
-    do_action( 'give_before_template_part', $template_name, $template_path, $located, $args );
77
+	do_action( 'give_before_template_part', $template_name, $template_path, $located, $args );
78 78
 
79
-    include( $located );
79
+	include( $located );
80 80
 
81 81
 	/**
82 82
 	 * Fires in give template, after the file is included.
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 	 * @param string $located       Template file filter by 3rd party plugin.
91 91
 	 * @param array  $args          Passed arguments.
92 92
 	 */
93
-    do_action( 'give_after_template_part', $template_name, $template_path, $located, $args );
93
+	do_action( 'give_after_template_part', $template_name, $template_path, $located, $args );
94 94
 }
95 95
 
96 96
 /**
Please login to merge, or discard this patch.
Spacing   +84 added lines, -84 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,23 +44,23 @@  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_output_error( sprintf( __( 'The %s template was not found.', 'give' ), $located ), true );
58
+        give_output_error(sprintf(__('The %s template was not found.', 'give'), $located), true);
59 59
         return;
60 60
     }
61 61
 
62 62
     // Allow 3rd party plugin filter template file from their plugin.
63
-    $located = apply_filters( 'give_get_template', $located, $template_name, $args, $template_path, $default_path );
63
+    $located = apply_filters('give_get_template', $located, $template_name, $args, $template_path, $default_path);
64 64
 
65 65
 	/**
66 66
 	 * Fires in give template, before the file is included.
@@ -74,9 +74,9 @@  discard block
 block discarded – undo
74 74
 	 * @param string $located       Template file filter by 3rd party plugin.
75 75
 	 * @param array  $args          Passed arguments.
76 76
 	 */
77
-    do_action( 'give_before_template_part', $template_name, $template_path, $located, $args );
77
+    do_action('give_before_template_part', $template_name, $template_path, $located, $args);
78 78
 
79
-    include( $located );
79
+    include($located);
80 80
 
81 81
 	/**
82 82
 	 * Fires in give template, after the file is included.
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 	 * @param string $located       Template file filter by 3rd party plugin.
91 91
 	 * @param array  $args          Passed arguments.
92 92
 	 */
93
-    do_action( 'give_after_template_part', $template_name, $template_path, $located, $args );
93
+    do_action('give_after_template_part', $template_name, $template_path, $located, $args);
94 94
 }
95 95
 
96 96
 /**
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
  *
107 107
  * @return string 
108 108
  */
109
-function give_get_template_part( $slug, $name = null, $load = true ) {
109
+function give_get_template_part($slug, $name = null, $load = true) {
110 110
 
111 111
 	/**
112 112
 	 * Fires in give template part, before the template part is retrieved.
@@ -118,20 +118,20 @@  discard block
 block discarded – undo
118 118
 	 * @param string $slug Template part file slug {slug}.php.
119 119
 	 * @param string $name Template part file name {slug}-{name}.php.
120 120
 	 */
121
-	do_action( "get_template_part_{$slug}", $slug, $name );
121
+	do_action("get_template_part_{$slug}", $slug, $name);
122 122
 
123 123
 	// Setup possible parts
124 124
 	$templates = array();
125
-	if ( isset( $name ) ) {
126
-		$templates[] = $slug . '-' . $name . '.php';
125
+	if (isset($name)) {
126
+		$templates[] = $slug.'-'.$name.'.php';
127 127
 	}
128
-	$templates[] = $slug . '.php';
128
+	$templates[] = $slug.'.php';
129 129
 
130 130
 	// Allow template parts to be filtered
131
-	$templates = apply_filters( 'give_get_template_part', $templates, $slug, $name );
131
+	$templates = apply_filters('give_get_template_part', $templates, $slug, $name);
132 132
 
133 133
 	// Return the part that is found
134
-	return give_locate_template( $templates, $load, false );
134
+	return give_locate_template($templates, $load, false);
135 135
 }
136 136
 
137 137
 /**
@@ -152,37 +152,37 @@  discard block
 block discarded – undo
152 152
  *
153 153
  * @return string The template filename if one is located.
154 154
  */
155
-function give_locate_template( $template_names, $load = false, $require_once = true ) {
155
+function give_locate_template($template_names, $load = false, $require_once = true) {
156 156
 	// No file found yet
157 157
 	$located = false;
158 158
 
159 159
 	// Try to find a template file
160
-	foreach ( (array) $template_names as $template_name ) {
160
+	foreach ((array) $template_names as $template_name) {
161 161
 
162 162
 		// Continue if template is empty
163
-		if ( empty( $template_name ) ) {
163
+		if (empty($template_name)) {
164 164
 			continue;
165 165
 		}
166 166
 
167 167
 		// Trim off any slashes from the template name
168
-		$template_name = ltrim( $template_name, '/' );
168
+		$template_name = ltrim($template_name, '/');
169 169
 
170 170
 		// try locating this template file by looping through the template paths
171
-		foreach ( give_get_theme_template_paths() as $template_path ) {
171
+		foreach (give_get_theme_template_paths() as $template_path) {
172 172
 
173
-			if ( file_exists( $template_path . $template_name ) ) {
174
-				$located = $template_path . $template_name;
173
+			if (file_exists($template_path.$template_name)) {
174
+				$located = $template_path.$template_name;
175 175
 				break;
176 176
 			}
177 177
 		}
178 178
 
179
-		if ( $located ) {
179
+		if ($located) {
180 180
 			break;
181 181
 		}
182 182
 	}
183 183
 
184
-	if ( ( true == $load ) && ! empty( $located ) ) {
185
-		load_template( $located, $require_once );
184
+	if ((true == $load) && ! empty($located)) {
185
+		load_template($located, $require_once);
186 186
 	}
187 187
 
188 188
 	return $located;
@@ -199,17 +199,17 @@  discard block
 block discarded – undo
199 199
 	$template_dir = give_get_theme_template_dir_name();
200 200
 
201 201
 	$file_paths = array(
202
-		1   => trailingslashit( get_stylesheet_directory() ) . $template_dir,
203
-		10  => trailingslashit( get_template_directory() ) . $template_dir,
202
+		1   => trailingslashit(get_stylesheet_directory()).$template_dir,
203
+		10  => trailingslashit(get_template_directory()).$template_dir,
204 204
 		100 => give_get_templates_dir()
205 205
 	);
206 206
 
207
-	$file_paths = apply_filters( 'give_template_paths', $file_paths );
207
+	$file_paths = apply_filters('give_template_paths', $file_paths);
208 208
 
209 209
 	// sort the file paths based on priority
210
-	ksort( $file_paths, SORT_NUMERIC );
210
+	ksort($file_paths, SORT_NUMERIC);
211 211
 
212
-	return array_map( 'trailingslashit', $file_paths );
212
+	return array_map('trailingslashit', $file_paths);
213 213
 }
214 214
 
215 215
 /**
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
  * @return string
222 222
  */
223 223
 function give_get_theme_template_dir_name() {
224
-	return trailingslashit( apply_filters( 'give_templates_dir', 'give' ) );
224
+	return trailingslashit(apply_filters('give_templates_dir', 'give'));
225 225
 }
226 226
 
227 227
 /**
@@ -231,10 +231,10 @@  discard block
 block discarded – undo
231 231
  * @return void
232 232
  */
233 233
 function give_version_in_header() {
234
-	echo '<meta name="generator" content="Give v' . GIVE_VERSION . '" />' . "\n";
234
+	echo '<meta name="generator" content="Give v'.GIVE_VERSION.'" />'."\n";
235 235
 }
236 236
 
237
-add_action( 'wp_head', 'give_version_in_header' );
237
+add_action('wp_head', 'give_version_in_header');
238 238
 
239 239
 /**
240 240
  * Determines if we're currently on the Donations History page.
@@ -244,9 +244,9 @@  discard block
 block discarded – undo
244 244
  */
245 245
 function give_is_donation_history_page() {
246 246
 
247
-	$ret = is_page( give_get_option( 'history_page' ) );
247
+	$ret = is_page(give_get_option('history_page'));
248 248
 
249
-	return apply_filters( 'give_is_donation_history_page', $ret );
249
+	return apply_filters('give_is_donation_history_page', $ret);
250 250
 }
251 251
 
252 252
 /**
@@ -258,25 +258,25 @@  discard block
 block discarded – undo
258 258
  *
259 259
  * @return array Modified array of classes
260 260
  */
261
-function give_add_body_classes( $class ) {
261
+function give_add_body_classes($class) {
262 262
 	$classes = (array) $class;
263 263
 
264
-	if ( give_is_success_page() ) {
264
+	if (give_is_success_page()) {
265 265
 		$classes[] = 'give-success';
266 266
 		$classes[] = 'give-page';
267 267
 	}
268 268
 
269
-	if ( give_is_failed_transaction_page() ) {
269
+	if (give_is_failed_transaction_page()) {
270 270
 		$classes[] = 'give-failed-transaction';
271 271
 		$classes[] = 'give-page';
272 272
 	}
273 273
 
274
-	if ( give_is_donation_history_page() ) {
274
+	if (give_is_donation_history_page()) {
275 275
 		$classes[] = 'give-donation-history';
276 276
 		$classes[] = 'give-page';
277 277
 	}
278 278
 
279
-	if ( give_is_test_mode() ) {
279
+	if (give_is_test_mode()) {
280 280
 		$classes[] = 'give-test-mode';
281 281
 		$classes[] = 'give-page';
282 282
 	}
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 	//Theme-specific Classes used to prevent conflicts via CSS
285 285
 	$current_theme = wp_get_theme();
286 286
 
287
-	switch ( $current_theme->template ) {
287
+	switch ($current_theme->template) {
288 288
 
289 289
 		case 'Divi':
290 290
 			$classes[] = 'give-divi';
@@ -298,10 +298,10 @@  discard block
 block discarded – undo
298 298
 
299 299
 	}
300 300
 
301
-	return array_unique( $classes );
301
+	return array_unique($classes);
302 302
 }
303 303
 
304
-add_filter( 'body_class', 'give_add_body_classes' );
304
+add_filter('body_class', 'give_add_body_classes');
305 305
 
306 306
 
307 307
 /**
@@ -317,22 +317,22 @@  discard block
 block discarded – undo
317 317
  *
318 318
  * @return array
319 319
  */
320
-function give_add_post_class( $classes, $class = '', $post_id = '' ) {
321
-	if ( ! $post_id || 'give_forms' !== get_post_type( $post_id ) ) {
320
+function give_add_post_class($classes, $class = '', $post_id = '') {
321
+	if ( ! $post_id || 'give_forms' !== get_post_type($post_id)) {
322 322
 		return $classes;
323 323
 	}
324 324
 
325 325
 	//@TODO: Add classes for custom taxonomy and form configurations (multi vs single donations, etc).
326 326
 
327
-	if ( false !== ( $key = array_search( 'hentry', $classes ) ) ) {
328
-		unset( $classes[ $key ] );
327
+	if (false !== ($key = array_search('hentry', $classes))) {
328
+		unset($classes[$key]);
329 329
 	}
330 330
 
331 331
 	return $classes;
332 332
 }
333 333
 
334 334
 
335
-add_filter( 'post_class', 'give_add_post_class', 20, 3 );
335
+add_filter('post_class', 'give_add_post_class', 20, 3);
336 336
 
337 337
 /**
338 338
  * Get the placeholder image URL for forms etc
@@ -342,85 +342,85 @@  discard block
 block discarded – undo
342 342
  */
343 343
 function give_get_placeholder_img_src() {
344 344
 
345
-	$placeholder_url = '//placehold.it/600x600&text=' . urlencode( esc_attr__( 'Give Placeholder Image', 'give' ) );
345
+	$placeholder_url = '//placehold.it/600x600&text='.urlencode(esc_attr__('Give Placeholder Image', 'give'));
346 346
 
347
-	return apply_filters( 'give_placeholder_img_src', $placeholder_url );
347
+	return apply_filters('give_placeholder_img_src', $placeholder_url);
348 348
 }
349 349
 
350 350
 
351 351
 /**
352 352
  * Global
353 353
  */
354
-if ( ! function_exists( 'give_output_content_wrapper' ) ) {
354
+if ( ! function_exists('give_output_content_wrapper')) {
355 355
 
356 356
 	/**
357 357
 	 * Output the start of the page wrapper.
358 358
 	 */
359 359
 	function give_output_content_wrapper() {
360
-		give_get_template_part( 'global/wrapper-start' );
360
+		give_get_template_part('global/wrapper-start');
361 361
 	}
362 362
 }
363
-if ( ! function_exists( 'give_output_content_wrapper_end' ) ) {
363
+if ( ! function_exists('give_output_content_wrapper_end')) {
364 364
 
365 365
 	/**
366 366
 	 * Output the end of the page wrapper.
367 367
 	 */
368 368
 	function give_output_content_wrapper_end() {
369
-		give_get_template_part( 'global/wrapper-end' );
369
+		give_get_template_part('global/wrapper-end');
370 370
 	}
371 371
 }
372 372
 
373 373
 /**
374 374
  * Single Give Form
375 375
  */
376
-if ( ! function_exists( 'give_left_sidebar_pre_wrap' ) ) {
376
+if ( ! function_exists('give_left_sidebar_pre_wrap')) {
377 377
 	function give_left_sidebar_pre_wrap() {
378
-		echo apply_filters( 'give_left_sidebar_pre_wrap', '<div id="give-sidebar-left" class="give-sidebar give-single-form-sidebar-left">' );
378
+		echo apply_filters('give_left_sidebar_pre_wrap', '<div id="give-sidebar-left" class="give-sidebar give-single-form-sidebar-left">');
379 379
 	}
380 380
 }
381 381
 
382
-if ( ! function_exists( 'give_left_sidebar_post_wrap' ) ) {
382
+if ( ! function_exists('give_left_sidebar_post_wrap')) {
383 383
 	function give_left_sidebar_post_wrap() {
384
-		echo apply_filters( 'give_left_sidebar_post_wrap', '</div>' );
384
+		echo apply_filters('give_left_sidebar_post_wrap', '</div>');
385 385
 	}
386 386
 }
387 387
 
388
-if ( ! function_exists( 'give_get_forms_sidebar' ) ) {
388
+if ( ! function_exists('give_get_forms_sidebar')) {
389 389
 	function give_get_forms_sidebar() {
390
-		give_get_template_part( 'single-give-form/sidebar' );
390
+		give_get_template_part('single-give-form/sidebar');
391 391
 	}
392 392
 }
393 393
 
394
-if ( ! function_exists( 'give_show_form_images' ) ) {
394
+if ( ! function_exists('give_show_form_images')) {
395 395
 
396 396
 	/**
397 397
 	 * Output the product image before the single product summary.
398 398
 	 */
399 399
 	function give_show_form_images() {
400
-		$featured_image_option = give_get_option( 'disable_form_featured_img' );
401
-		if ( $featured_image_option !== 'on' ) {
402
-			give_get_template_part( 'single-give-form/featured-image' );
400
+		$featured_image_option = give_get_option('disable_form_featured_img');
401
+		if ($featured_image_option !== 'on') {
402
+			give_get_template_part('single-give-form/featured-image');
403 403
 		}
404 404
 	}
405 405
 }
406 406
 
407
-if ( ! function_exists( 'give_template_single_title' ) ) {
407
+if ( ! function_exists('give_template_single_title')) {
408 408
 
409 409
 	/**
410 410
 	 * Output the product title.
411 411
 	 */
412 412
 	function give_template_single_title() {
413
-		give_get_template_part( 'single-give-form/title' );
413
+		give_get_template_part('single-give-form/title');
414 414
 	}
415 415
 }
416 416
 
417
-if ( ! function_exists( 'give_show_avatars' ) ) {
417
+if ( ! function_exists('give_show_avatars')) {
418 418
 
419 419
 	/**
420 420
 	 * Output the product title.
421 421
 	 */
422 422
 	function give_show_avatars() {
423
-		echo do_shortcode( '[give_donors_gravatars]' );
423
+		echo do_shortcode('[give_donors_gravatars]');
424 424
 	}
425 425
 }
426 426
 
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
  * Conditional Functions
429 429
  */
430 430
 
431
-if ( ! function_exists( 'is_give_form' ) ) {
431
+if ( ! function_exists('is_give_form')) {
432 432
 
433 433
 	/**
434 434
 	 * is_give_form
@@ -440,11 +440,11 @@  discard block
 block discarded – undo
440 440
 	 * @return bool
441 441
 	 */
442 442
 	function is_give_form() {
443
-		return is_singular( array( 'give_form' ) );
443
+		return is_singular(array('give_form'));
444 444
 	}
445 445
 }
446 446
 
447
-if ( ! function_exists( 'is_give_category' ) ) {
447
+if ( ! function_exists('is_give_category')) {
448 448
 
449 449
 	/**
450 450
 	 * is_give_category
@@ -459,12 +459,12 @@  discard block
 block discarded – undo
459 459
 	 *
460 460
 	 * @return bool
461 461
 	 */
462
-	function is_give_category( $term = '' ) {
463
-		return is_tax( 'give_forms_category', $term );
462
+	function is_give_category($term = '') {
463
+		return is_tax('give_forms_category', $term);
464 464
 	}
465 465
 }
466 466
 
467
-if ( ! function_exists( 'is_give_tag' ) ) {
467
+if ( ! function_exists('is_give_tag')) {
468 468
 
469 469
 	/**
470 470
 	 * is_give_tag
@@ -479,12 +479,12 @@  discard block
 block discarded – undo
479 479
 	 *
480 480
 	 * @return bool
481 481
 	 */
482
-	function is_give_tag( $term = '' ) {
483
-		return is_tax( 'give_forms_tag', $term );
482
+	function is_give_tag($term = '') {
483
+		return is_tax('give_forms_tag', $term);
484 484
 	}
485 485
 }
486 486
 
487
-if ( ! function_exists( 'is_give_taxonomy' ) ) {
487
+if ( ! function_exists('is_give_taxonomy')) {
488 488
 
489 489
 	/**
490 490
 	 * is_give_taxonomy
@@ -496,6 +496,6 @@  discard block
 block discarded – undo
496 496
 	 * @return bool
497 497
 	 */
498 498
 	function is_give_taxonomy() {
499
-		return is_tax( get_object_taxonomies( 'give_form' ) );
499
+		return is_tax(get_object_taxonomies('give_form'));
500 500
 	}
501 501
 }
Please login to merge, or discard this patch.
includes/login-register.php 2 patches
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -33,20 +33,20 @@  discard block
 block discarded – undo
33 33
 		$login_redirect = add_query_arg('give-login-success', 'true', give_get_current_page_url());
34 34
 	}
35 35
 
36
-    if ( empty( $logout_redirect ) ) {
37
-        $logout_redirect = add_query_arg( 'give-logout-success', 'true', give_get_current_page_url() );
38
-    }
36
+	if ( empty( $logout_redirect ) ) {
37
+		$logout_redirect = add_query_arg( 'give-logout-success', 'true', give_get_current_page_url() );
38
+	}
39 39
 
40 40
 
41
-    // Add user_logout action to logout url.
42
-    $logout_redirect = add_query_arg(
43
-        array(
44
-            'give_action'       => 'user_logout',
45
-            'give_logout_nonce' => wp_create_nonce( 'give-logout-nonce' ),
46
-            'give_logout_redirect' => urlencode( $logout_redirect )
47
-        ),
48
-        home_url('/')
49
-    );
41
+	// Add user_logout action to logout url.
42
+	$logout_redirect = add_query_arg(
43
+		array(
44
+			'give_action'       => 'user_logout',
45
+			'give_logout_nonce' => wp_create_nonce( 'give-logout-nonce' ),
46
+			'give_logout_redirect' => urlencode( $logout_redirect )
47
+		),
48
+		home_url('/')
49
+	);
50 50
 
51 51
 	$give_login_redirect = $login_redirect;
52 52
 	$give_logout_redirect = $logout_redirect;
@@ -136,31 +136,31 @@  discard block
 block discarded – undo
136 136
  * @return void
137 137
  */
138 138
 function give_process_user_logout( $data ) {
139
-    if ( wp_verify_nonce( $data['give_logout_nonce'], 'give-logout-nonce' ) && is_user_logged_in() ) {
139
+	if ( wp_verify_nonce( $data['give_logout_nonce'], 'give-logout-nonce' ) && is_user_logged_in() ) {
140 140
 
141
-        // Prevent occurring of any custom action on wp_logout.
142
-        remove_all_actions( 'wp_logout' );
141
+		// Prevent occurring of any custom action on wp_logout.
142
+		remove_all_actions( 'wp_logout' );
143 143
 
144 144
 		/**
145 145
 		 * Fires before processing user logout.
146 146
 		 *
147 147
 		 * @since 1.0
148 148
 		 */
149
-        do_action( 'give_before_user_logout' );
149
+		do_action( 'give_before_user_logout' );
150 150
 
151
-        // Logout user.
152
-        wp_logout();
151
+		// Logout user.
152
+		wp_logout();
153 153
 
154 154
 		/**
155 155
 		 * Fires after processing user logout.
156 156
 		 *
157 157
 		 * @since 1.0
158 158
 		 */
159
-        do_action( 'give_after_user_logout' );
159
+		do_action( 'give_after_user_logout' );
160 160
 
161
-        wp_redirect( $data['give_logout_redirect'] );
162
-        give_die();
163
-    }
161
+		wp_redirect( $data['give_logout_redirect'] );
162
+		give_die();
163
+	}
164 164
 }
165 165
 
166 166
 add_action( 'give_user_logout', 'give_process_user_logout' );
Please login to merge, or discard this patch.
Spacing   +70 added lines, -70 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,15 +26,15 @@  discard block
 block discarded – undo
26 26
  *
27 27
  * @return string Login form
28 28
  */
29
-function give_login_form( $login_redirect = '', $logout_redirect = '' ) {
29
+function give_login_form($login_redirect = '', $logout_redirect = '') {
30 30
 	global $give_login_redirect, $give_logout_redirect;
31 31
 
32
-	if ( empty( $login_redirect ) ) {
32
+	if (empty($login_redirect)) {
33 33
 		$login_redirect = add_query_arg('give-login-success', 'true', give_get_current_page_url());
34 34
 	}
35 35
 
36
-    if ( empty( $logout_redirect ) ) {
37
-        $logout_redirect = add_query_arg( 'give-logout-success', 'true', give_get_current_page_url() );
36
+    if (empty($logout_redirect)) {
37
+        $logout_redirect = add_query_arg('give-logout-success', 'true', give_get_current_page_url());
38 38
     }
39 39
 
40 40
 
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
     $logout_redirect = add_query_arg(
43 43
         array(
44 44
             'give_action'       => 'user_logout',
45
-            'give_logout_nonce' => wp_create_nonce( 'give-logout-nonce' ),
46
-            'give_logout_redirect' => urlencode( $logout_redirect )
45
+            'give_logout_nonce' => wp_create_nonce('give-logout-nonce'),
46
+            'give_logout_redirect' => urlencode($logout_redirect)
47 47
         ),
48 48
         home_url('/')
49 49
     );
@@ -53,9 +53,9 @@  discard block
 block discarded – undo
53 53
 
54 54
 	ob_start();
55 55
 
56
-	give_get_template_part( 'shortcode', 'login' );
56
+	give_get_template_part('shortcode', 'login');
57 57
 
58
-	return apply_filters( 'give_login_form', ob_get_clean() );
58
+	return apply_filters('give_login_form', ob_get_clean());
59 59
 }
60 60
 
61 61
 /**
@@ -68,10 +68,10 @@  discard block
 block discarded – undo
68 68
  *
69 69
  * @return string Register form
70 70
  */
71
-function give_register_form( $redirect = '' ) {
71
+function give_register_form($redirect = '') {
72 72
 	global $give_register_redirect;
73 73
 
74
-	if ( empty( $redirect ) ) {
74
+	if (empty($redirect)) {
75 75
 		$redirect = give_get_current_page_url();
76 76
 	}
77 77
 
@@ -79,11 +79,11 @@  discard block
 block discarded – undo
79 79
 
80 80
 	ob_start();
81 81
 
82
-	if ( ! is_user_logged_in() ) {
83
-		give_get_template_part( 'shortcode', 'register' );
82
+	if ( ! is_user_logged_in()) {
83
+		give_get_template_part('shortcode', 'register');
84 84
 	}
85 85
 
86
-	return apply_filters( 'give_register_form', ob_get_clean() );
86
+	return apply_filters('give_register_form', ob_get_clean());
87 87
 }
88 88
 
89 89
 /**
@@ -95,34 +95,34 @@  discard block
 block discarded – undo
95 95
  *
96 96
  * @return void
97 97
  */
98
-function give_process_login_form( $data ) {
99
-	if ( wp_verify_nonce( $data['give_login_nonce'], 'give-login-nonce' ) ) {
100
-		$user_data = get_user_by( 'login', $data['give_user_login'] );
101
-		if ( ! $user_data ) {
102
-			$user_data = get_user_by( 'email', $data['give_user_login'] );
98
+function give_process_login_form($data) {
99
+	if (wp_verify_nonce($data['give_login_nonce'], 'give-login-nonce')) {
100
+		$user_data = get_user_by('login', $data['give_user_login']);
101
+		if ( ! $user_data) {
102
+			$user_data = get_user_by('email', $data['give_user_login']);
103 103
 		}
104
-		if ( $user_data ) {
104
+		if ($user_data) {
105 105
 			$user_ID    = $user_data->ID;
106 106
 			$user_email = $user_data->user_email;
107
-			if ( wp_check_password( $data['give_user_pass'], $user_data->user_pass, $user_data->ID ) ) {
108
-				give_log_user_in( $user_data->ID, $data['give_user_login'], $data['give_user_pass'] );
107
+			if (wp_check_password($data['give_user_pass'], $user_data->user_pass, $user_data->ID)) {
108
+				give_log_user_in($user_data->ID, $data['give_user_login'], $data['give_user_pass']);
109 109
 			} else {
110
-				give_set_error( 'password_incorrect', esc_html__( 'The password you entered is incorrect.', 'give' ) );
110
+				give_set_error('password_incorrect', esc_html__('The password you entered is incorrect.', 'give'));
111 111
 			}
112 112
 		} else {
113
-			give_set_error( 'username_incorrect', esc_html__( 'The username you entered does not exist.', 'give' ) );
113
+			give_set_error('username_incorrect', esc_html__('The username you entered does not exist.', 'give'));
114 114
 		}
115 115
 		// Check for errors and redirect if none present
116 116
 		$errors = give_get_errors();
117
-		if ( ! $errors ) {
118
-			$redirect = apply_filters( 'give_login_redirect', $data['give_login_redirect'], $user_ID );
119
-			wp_redirect( $redirect );
117
+		if ( ! $errors) {
118
+			$redirect = apply_filters('give_login_redirect', $data['give_login_redirect'], $user_ID);
119
+			wp_redirect($redirect);
120 120
 			give_die();
121 121
 		}
122 122
 	}
123 123
 }
124 124
 
125
-add_action( 'give_user_login', 'give_process_login_form' );
125
+add_action('give_user_login', 'give_process_login_form');
126 126
 
127 127
 
128 128
 /**
@@ -134,18 +134,18 @@  discard block
 block discarded – undo
134 134
  *
135 135
  * @return void
136 136
  */
137
-function give_process_user_logout( $data ) {
138
-    if ( wp_verify_nonce( $data['give_logout_nonce'], 'give-logout-nonce' ) && is_user_logged_in() ) {
137
+function give_process_user_logout($data) {
138
+    if (wp_verify_nonce($data['give_logout_nonce'], 'give-logout-nonce') && is_user_logged_in()) {
139 139
 
140 140
         // Prevent occurring of any custom action on wp_logout.
141
-        remove_all_actions( 'wp_logout' );
141
+        remove_all_actions('wp_logout');
142 142
 
143 143
 		/**
144 144
 		 * Fires before processing user logout.
145 145
 		 *
146 146
 		 * @since 1.0
147 147
 		 */
148
-        do_action( 'give_before_user_logout' );
148
+        do_action('give_before_user_logout');
149 149
 
150 150
         // Logout user.
151 151
         wp_logout();
@@ -155,14 +155,14 @@  discard block
 block discarded – undo
155 155
 		 *
156 156
 		 * @since 1.0
157 157
 		 */
158
-        do_action( 'give_after_user_logout' );
158
+        do_action('give_after_user_logout');
159 159
 
160
-        wp_redirect( $data['give_logout_redirect'] );
160
+        wp_redirect($data['give_logout_redirect']);
161 161
         give_die();
162 162
     }
163 163
 }
164 164
 
165
-add_action( 'give_user_logout', 'give_process_user_logout' );
165
+add_action('give_user_logout', 'give_process_user_logout');
166 166
 
167 167
 /**
168 168
  * Log User In
@@ -175,13 +175,13 @@  discard block
 block discarded – undo
175 175
  *
176 176
  * @return void
177 177
  */
178
-function give_log_user_in( $user_id, $user_login, $user_pass ) {
179
-	if ( $user_id < 1 ) {
178
+function give_log_user_in($user_id, $user_login, $user_pass) {
179
+	if ($user_id < 1) {
180 180
 		return;
181 181
 	}
182 182
 
183
-	wp_set_auth_cookie( $user_id );
184
-	wp_set_current_user( $user_id, $user_login );
183
+	wp_set_auth_cookie($user_id);
184
+	wp_set_current_user($user_id, $user_login);
185 185
 
186 186
 	/**
187 187
 	 * Fires after the user has successfully logged in.
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 	 * @param string  $user_login Username.
192 192
 	 * @param WP_User $$user      WP_User object of the logged-in user.
193 193
 	 */
194
-	do_action( 'wp_login', $user_login, get_userdata( $user_id ) );
194
+	do_action('wp_login', $user_login, get_userdata($user_id));
195 195
 
196 196
 	/**
197 197
 	 * Fires after give user has successfully logged in.
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 	 * @param string $user_login Username.
203 203
 	 * @param string $user_pass  User password.
204 204
 	 */
205
-	do_action( 'give_log_user_in', $user_id, $user_login, $user_pass );
205
+	do_action('give_log_user_in', $user_id, $user_login, $user_pass);
206 206
 }
207 207
 
208 208
 
@@ -215,13 +215,13 @@  discard block
 block discarded – undo
215 215
  *
216 216
  * @return void
217 217
  */
218
-function give_process_register_form( $data ) {
218
+function give_process_register_form($data) {
219 219
 
220
-	if ( is_user_logged_in() ) {
220
+	if (is_user_logged_in()) {
221 221
 		return;
222 222
 	}
223 223
 
224
-	if ( empty( $_POST['give_register_submit'] ) ) {
224
+	if (empty($_POST['give_register_submit'])) {
225 225
 		return;
226 226
 	}
227 227
 
@@ -230,38 +230,38 @@  discard block
 block discarded – undo
230 230
 	 *
231 231
 	 * @since 1.0
232 232
 	 */
233
-	do_action( 'give_pre_process_register_form' );
233
+	do_action('give_pre_process_register_form');
234 234
 
235
-	if ( empty( $data['give_user_login'] ) ) {
236
-		give_set_error( 'empty_username', esc_html__( 'Invalid username.', 'give' ) );
235
+	if (empty($data['give_user_login'])) {
236
+		give_set_error('empty_username', esc_html__('Invalid username.', 'give'));
237 237
 	}
238 238
 
239
-	if ( username_exists( $data['give_user_login'] ) ) {
240
-		give_set_error( 'username_unavailable', esc_html__( 'Username already taken.', 'give' ) );
239
+	if (username_exists($data['give_user_login'])) {
240
+		give_set_error('username_unavailable', esc_html__('Username already taken.', 'give'));
241 241
 	}
242 242
 
243
-	if ( ! validate_username( $data['give_user_login'] ) ) {
244
-		give_set_error( 'username_invalid', esc_html__( 'Invalid username.', 'give' ) );
243
+	if ( ! validate_username($data['give_user_login'])) {
244
+		give_set_error('username_invalid', esc_html__('Invalid username.', 'give'));
245 245
 	}
246 246
 
247
-	if ( email_exists( $data['give_user_email'] ) ) {
248
-		give_set_error( 'email_unavailable', esc_html__( 'Email address already taken.', 'give' ) );
247
+	if (email_exists($data['give_user_email'])) {
248
+		give_set_error('email_unavailable', esc_html__('Email address already taken.', 'give'));
249 249
 	}
250 250
 
251
-	if ( empty( $data['give_user_email'] ) || ! is_email( $data['give_user_email'] ) ) {
252
-		give_set_error( 'email_invalid', esc_html__( 'Invalid email.', 'give' ) );
251
+	if (empty($data['give_user_email']) || ! is_email($data['give_user_email'])) {
252
+		give_set_error('email_invalid', esc_html__('Invalid email.', 'give'));
253 253
 	}
254 254
 
255
-	if ( ! empty( $data['give_payment_email'] ) && $data['give_payment_email'] != $data['give_user_email'] && ! is_email( $data['give_payment_email'] ) ) {
256
-		give_set_error( 'payment_email_invalid', esc_html__( 'Invalid payment email.', 'give' ) );
255
+	if ( ! empty($data['give_payment_email']) && $data['give_payment_email'] != $data['give_user_email'] && ! is_email($data['give_payment_email'])) {
256
+		give_set_error('payment_email_invalid', esc_html__('Invalid payment email.', 'give'));
257 257
 	}
258 258
 
259
-	if ( empty( $_POST['give_user_pass'] ) ) {
260
-		give_set_error( 'empty_password', esc_html__( 'Please enter a password.', 'give' ) );
259
+	if (empty($_POST['give_user_pass'])) {
260
+		give_set_error('empty_password', esc_html__('Please enter a password.', 'give'));
261 261
 	}
262 262
 
263
-	if ( ( ! empty( $_POST['give_user_pass'] ) && empty( $_POST['give_user_pass2'] ) ) || ( $_POST['give_user_pass'] !== $_POST['give_user_pass2'] ) ) {
264
-		give_set_error( 'password_mismatch', esc_html__( 'Passwords don\'t match.', 'give' ) );
263
+	if (( ! empty($_POST['give_user_pass']) && empty($_POST['give_user_pass2'])) || ($_POST['give_user_pass'] !== $_POST['give_user_pass2'])) {
264
+		give_set_error('password_mismatch', esc_html__('Passwords don\'t match.', 'give'));
265 265
 	}
266 266
 
267 267
 	/**
@@ -269,26 +269,26 @@  discard block
 block discarded – undo
269 269
 	 *
270 270
 	 * @since 1.0
271 271
 	 */
272
-	do_action( 'give_process_register_form' );
272
+	do_action('give_process_register_form');
273 273
 
274 274
 	// Check for errors and redirect if none present
275 275
 	$errors = give_get_errors();
276 276
 
277
-	if ( empty( $errors ) ) {
277
+	if (empty($errors)) {
278 278
 
279
-		$redirect = apply_filters( 'give_register_redirect', $data['give_redirect'] );
279
+		$redirect = apply_filters('give_register_redirect', $data['give_redirect']);
280 280
 
281
-		give_register_and_login_new_user( array(
281
+		give_register_and_login_new_user(array(
282 282
 			'user_login'      => $data['give_user_login'],
283 283
 			'user_pass'       => $data['give_user_pass'],
284 284
 			'user_email'      => $data['give_user_email'],
285
-			'user_registered' => date( 'Y-m-d H:i:s' ),
286
-			'role'            => get_option( 'default_role' )
287
-		) );
285
+			'user_registered' => date('Y-m-d H:i:s'),
286
+			'role'            => get_option('default_role')
287
+		));
288 288
 
289
-		wp_redirect( $redirect );
289
+		wp_redirect($redirect);
290 290
 		give_die();
291 291
 	}
292 292
 }
293 293
 
294
-add_action( 'give_user_register', 'give_process_register_form' );
295 294
\ No newline at end of file
295
+add_action('give_user_register', 'give_process_register_form');
296 296
\ No newline at end of file
Please login to merge, or discard this patch.
includes/gateways/manual.php 1 patch
Spacing   +14 added lines, -14 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
 
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
  * @since 1.0
21 21
  * @return void
22 22
  */
23
-add_action( 'give_manual_cc_form', '__return_false' );
23
+add_action('give_manual_cc_form', '__return_false');
24 24
 
25 25
 /**
26 26
  * Processes the purchase data and uses the Manual Payment gateway to record
@@ -32,17 +32,17 @@  discard block
 block discarded – undo
32 32
  *
33 33
  * @return void
34 34
  */
35
-function give_manual_payment( $purchase_data ) {
35
+function give_manual_payment($purchase_data) {
36 36
 
37
-	if ( ! wp_verify_nonce( $purchase_data['gateway_nonce'], 'give-gateway' ) ) {
38
-		wp_die( esc_html__( 'Nonce verification has failed.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
37
+	if ( ! wp_verify_nonce($purchase_data['gateway_nonce'], 'give-gateway')) {
38
+		wp_die(esc_html__('Nonce verification has failed.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
39 39
 	}
40 40
 	
41 41
 	//Create payment_data array
42 42
 	$payment_data = array(
43 43
 		'price'           => $purchase_data['price'],
44 44
 		'give_form_title' => $purchase_data['post_data']['give-form-title'],
45
-		'give_form_id'    => intval( $purchase_data['post_data']['give-form-id'] ),
45
+		'give_form_id'    => intval($purchase_data['post_data']['give-form-id']),
46 46
 		'give_price_id'   => isset($purchase_data['post_data']['give-price-id']) ? $purchase_data['post_data']['give-price-id'] : '',
47 47
 		'date'            => $purchase_data['date'],
48 48
 		'user_email'      => $purchase_data['user_email'],
@@ -52,24 +52,24 @@  discard block
 block discarded – undo
52 52
 		'status'          => 'pending'
53 53
 	);
54 54
 	// Record the pending payment
55
-	$payment = give_insert_payment( $payment_data );
55
+	$payment = give_insert_payment($payment_data);
56 56
 
57
-	if ( $payment ) {
58
-		give_update_payment_status( $payment, 'publish' );
57
+	if ($payment) {
58
+		give_update_payment_status($payment, 'publish');
59 59
 		give_send_to_success_page();
60 60
 	} else {
61 61
 		give_record_gateway_error(
62
-			esc_html__( 'Payment Error', 'give' ),
62
+			esc_html__('Payment Error', 'give'),
63 63
 			sprintf(
64 64
 				/* translators: %s: payment data */
65
-				esc_html__( 'The payment creation failed while processing a manual (free or test) donation. Payment data: %s', 'give' ),
66
-				json_encode( $payment_data )
65
+				esc_html__('The payment creation failed while processing a manual (free or test) donation. Payment data: %s', 'give'),
66
+				json_encode($payment_data)
67 67
 			),
68 68
 			$payment
69 69
 		);
70 70
 		// If errors are present, send the user back to the purchase page so they can be corrected
71
-		give_send_back_to_checkout( '?payment-mode=' . $purchase_data['post_data']['give-gateway'] );
71
+		give_send_back_to_checkout('?payment-mode='.$purchase_data['post_data']['give-gateway']);
72 72
 	}
73 73
 }
74 74
 
75
-add_action( 'give_gateway_manual', 'give_manual_payment' );
75
+add_action('give_gateway_manual', 'give_manual_payment');
Please login to merge, or discard this patch.
includes/admin/payments/actions.php 2 patches
Indentation   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	// Retrieve the payment ID
38 38
 	$payment_id = absint( $data['give_payment_id'] );
39 39
 
40
-    /* @var Give_Payment $payment */
40
+	/* @var Give_Payment $payment */
41 41
 	$payment    = new Give_Payment( $payment_id );
42 42
 
43 43
 	// Retrieve existing payment meta
@@ -160,23 +160,23 @@  discard block
 block discarded – undo
160 160
 
161 161
 		if ( 'publish' == $status ) {
162 162
 
163
-            // Reduce previous user donation count and amount.
164
-            $previous_customer->decrease_purchase_count();
165
-            $previous_customer->decrease_value( $curr_total );
163
+			// Reduce previous user donation count and amount.
164
+			$previous_customer->decrease_purchase_count();
165
+			$previous_customer->decrease_value( $curr_total );
166 166
 
167
-            // If donation was completed adjust stats of new customers.
168
-            $customer->increase_purchase_count();
167
+			// If donation was completed adjust stats of new customers.
168
+			$customer->increase_purchase_count();
169 169
 			$customer->increase_value( $new_total );
170 170
 		}
171 171
 
172 172
 		$payment->customer_id = $customer->id;
173 173
 	} else{
174 174
 
175
-	    if( 'publish' === $status ){
176
-            // Update user donation stat.
177
-            $customer->update_donation_value( $curr_total, $new_total );
178
-        }
179
-    }
175
+		if( 'publish' === $status ){
176
+			// Update user donation stat.
177
+			$customer->update_donation_value( $curr_total, $new_total );
178
+		}
179
+	}
180 180
 
181 181
 	// Set new meta values
182 182
 	$payment->user_id    = $customer->user_id;
@@ -217,76 +217,76 @@  discard block
 block discarded – undo
217 217
 
218 218
 	$payment->save();
219 219
 
220
-    // Get new give form ID.
221
-    $new_form_id = absint( $data['forms'] );
222
-    $current_form_id = absint( $payment->get_meta( '_give_payment_form_id' ) );
220
+	// Get new give form ID.
221
+	$new_form_id = absint( $data['forms'] );
222
+	$current_form_id = absint( $payment->get_meta( '_give_payment_form_id' ) );
223 223
 
224
-    // We are adding payment transfer code in last to remove any conflict with above functionality.
225
-    // For example: above code will automatically handle form stat (increase/decrease) when payment status changes.
226
-    /* Check if user want to transfer current payment to new give form id. */
227
-    if( $new_form_id != $current_form_id  ) {
224
+	// We are adding payment transfer code in last to remove any conflict with above functionality.
225
+	// For example: above code will automatically handle form stat (increase/decrease) when payment status changes.
226
+	/* Check if user want to transfer current payment to new give form id. */
227
+	if( $new_form_id != $current_form_id  ) {
228 228
 
229
-        // Get new give form title.
230
-        $new_form_title = get_the_title( $new_form_id );
229
+		// Get new give form title.
230
+		$new_form_title = get_the_title( $new_form_id );
231 231
 
232
-        // Update new give form data in payment data.
233
-        $payment_meta = $payment->get_meta();
234
-        $payment_meta['form_title'] = $new_form_title;
235
-        $payment_meta['form_id']    = $new_form_id;
232
+		// Update new give form data in payment data.
233
+		$payment_meta = $payment->get_meta();
234
+		$payment_meta['form_title'] = $new_form_title;
235
+		$payment_meta['form_id']    = $new_form_id;
236 236
 
237
-        // Update price id post meta data for set donation form.
238
-        if( ! give_has_variable_prices( $new_form_id ) ) {
239
-            $payment_meta['price_id'] = '';
240
-        }
237
+		// Update price id post meta data for set donation form.
238
+		if( ! give_has_variable_prices( $new_form_id ) ) {
239
+			$payment_meta['price_id'] = '';
240
+		}
241 241
 
242
-        // Update payment give form meta data.
243
-        $payment->update_meta( '_give_payment_form_id', $new_form_id );
244
-        $payment->update_meta( '_give_payment_form_title', $new_form_title );
245
-        $payment->update_meta( '_give_payment_meta', $payment_meta );
242
+		// Update payment give form meta data.
243
+		$payment->update_meta( '_give_payment_form_id', $new_form_id );
244
+		$payment->update_meta( '_give_payment_form_title', $new_form_title );
245
+		$payment->update_meta( '_give_payment_meta', $payment_meta );
246 246
 
247
-        // Update price id payment metadata.
248
-        if( ! give_has_variable_prices( $new_form_id ) ) {
249
-            $payment->update_meta( '_give_payment_price_id', '' );
250
-        }
247
+		// Update price id payment metadata.
248
+		if( ! give_has_variable_prices( $new_form_id ) ) {
249
+			$payment->update_meta( '_give_payment_price_id', '' );
250
+		}
251 251
 
252 252
 
253
-        // If donation was completed, adjust stats of forms
254
-        if ( 'publish' == $status ) {
253
+		// If donation was completed, adjust stats of forms
254
+		if ( 'publish' == $status ) {
255 255
 
256
-            // Decrease sale of old give form. For other payment status 
257
-            $current_form = new Give_Donate_Form( $current_form_id );
258
-            $current_form->decrease_sales();
259
-            $current_form->decrease_earnings( $curr_total );
256
+			// Decrease sale of old give form. For other payment status 
257
+			$current_form = new Give_Donate_Form( $current_form_id );
258
+			$current_form->decrease_sales();
259
+			$current_form->decrease_earnings( $curr_total );
260 260
             
261
-            // Increase sale of new give form.
262
-            $new_form = new Give_Donate_Form($new_form_id);
263
-            $new_form->increase_sales();
264
-            $new_form->increase_earnings($new_total);
265
-        }
261
+			// Increase sale of new give form.
262
+			$new_form = new Give_Donate_Form($new_form_id);
263
+			$new_form->increase_sales();
264
+			$new_form->increase_earnings($new_total);
265
+		}
266 266
 
267
-        // Re setup payment to update new meta value in object.
268
-        $payment->update_payment_setup( $payment->ID );
269
-    }
267
+		// Re setup payment to update new meta value in object.
268
+		$payment->update_payment_setup( $payment->ID );
269
+	}
270 270
 
271
-    // Update price id if current form is variable form.
272
-    if( ! empty( $data['give-variable-price'] ) && give_has_variable_prices( $payment->form_id ) ) {
271
+	// Update price id if current form is variable form.
272
+	if( ! empty( $data['give-variable-price'] ) && give_has_variable_prices( $payment->form_id ) ) {
273 273
 
274
-        // Get payment meta data.
275
-        $payment_meta = $payment->get_meta();
274
+		// Get payment meta data.
275
+		$payment_meta = $payment->get_meta();
276 276
 
277
-        // Set payment id to empty string if variable price id is negative ( i.e. custom amount feature enabled ).
278
-        $data['give-variable-price'] = ( 'custom' === $data['give-variable-price'] ) ? 'custom' : ( 0 < $data['give-variable-price'] ) ? $data['give-variable-price'] : '';
277
+		// Set payment id to empty string if variable price id is negative ( i.e. custom amount feature enabled ).
278
+		$data['give-variable-price'] = ( 'custom' === $data['give-variable-price'] ) ? 'custom' : ( 0 < $data['give-variable-price'] ) ? $data['give-variable-price'] : '';
279 279
 
280
-        // Update payment meta data.
281
-        $payment_meta['price_id'] = $data['give-variable-price'];
280
+		// Update payment meta data.
281
+		$payment_meta['price_id'] = $data['give-variable-price'];
282 282
 
283
-        // Update payment give form meta data.
284
-        $payment->update_meta( '_give_payment_price_id', $data['give-variable-price'] );
285
-        $payment->update_meta( '_give_payment_meta', $payment_meta );
283
+		// Update payment give form meta data.
284
+		$payment->update_meta( '_give_payment_price_id', $data['give-variable-price'] );
285
+		$payment->update_meta( '_give_payment_meta', $payment_meta );
286 286
 
287
-        // Re setup payment to update new meta value in object.
288
-        $payment->update_payment_setup( $payment->ID );
289
-    }
287
+		// Re setup payment to update new meta value in object.
288
+		$payment->update_payment_setup( $payment->ID );
289
+	}
290 290
 
291 291
 	/**
292 292
 	 * Fires after updating edited donation.
Please login to merge, or discard this patch.
Spacing   +118 added lines, -118 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,52 +26,52 @@  discard block
 block discarded – undo
26 26
  * @return      void
27 27
  *
28 28
  */
29
-function give_update_payment_details( $data ) {
29
+function give_update_payment_details($data) {
30 30
 
31
-	if ( ! current_user_can( 'edit_give_payments', $data['give_payment_id'] ) ) {
32
-		wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
31
+	if ( ! current_user_can('edit_give_payments', $data['give_payment_id'])) {
32
+		wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
33 33
 	}
34 34
 
35
-	check_admin_referer( 'give_update_payment_details_nonce' );
35
+	check_admin_referer('give_update_payment_details_nonce');
36 36
 
37 37
 	// Retrieve the payment ID
38
-	$payment_id = absint( $data['give_payment_id'] );
38
+	$payment_id = absint($data['give_payment_id']);
39 39
 
40 40
     /* @var Give_Payment $payment */
41
-	$payment    = new Give_Payment( $payment_id );
41
+	$payment    = new Give_Payment($payment_id);
42 42
 
43 43
 	// Retrieve existing payment meta
44 44
 	$meta      = $payment->get_meta();
45 45
 	$user_info = $payment->user_info;
46 46
 
47 47
 	$status = $data['give-payment-status'];
48
-	$date   = sanitize_text_field( $data['give-payment-date'] );
49
-	$hour   = sanitize_text_field( $data['give-payment-time-hour'] );
48
+	$date   = sanitize_text_field($data['give-payment-date']);
49
+	$hour   = sanitize_text_field($data['give-payment-time-hour']);
50 50
 
51 51
 	// Restrict to our high and low
52
-	if ( $hour > 23 ) {
52
+	if ($hour > 23) {
53 53
 		$hour = 23;
54
-	} elseif ( $hour < 0 ) {
54
+	} elseif ($hour < 0) {
55 55
 		$hour = 00;
56 56
 	}
57 57
 
58
-	$minute = sanitize_text_field( $data['give-payment-time-min'] );
58
+	$minute = sanitize_text_field($data['give-payment-time-min']);
59 59
 
60 60
 	// Restrict to our high and low
61
-	if ( $minute > 59 ) {
61
+	if ($minute > 59) {
62 62
 		$minute = 59;
63
-	} elseif ( $minute < 0 ) {
63
+	} elseif ($minute < 0) {
64 64
 		$minute = 00;
65 65
 	}
66 66
 
67
-	$address = array_map( 'trim', $data['give-payment-address'][0] );
67
+	$address = array_map('trim', $data['give-payment-address'][0]);
68 68
 
69
-	$curr_total = give_sanitize_amount( $payment->total );
70
-	$new_total  = give_sanitize_amount( $data['give-payment-total'] );
71
-	$date       = date( 'Y-m-d', strtotime( $date ) ) . ' ' . $hour . ':' . $minute . ':00';
69
+	$curr_total = give_sanitize_amount($payment->total);
70
+	$new_total  = give_sanitize_amount($data['give-payment-total']);
71
+	$date       = date('Y-m-d', strtotime($date)).' '.$hour.':'.$minute.':00';
72 72
 
73
-	$curr_customer_id = sanitize_text_field( $data['give-current-customer'] );
74
-	$new_customer_id  = sanitize_text_field( $data['customer-id'] );
73
+	$curr_customer_id = sanitize_text_field($data['give-current-customer']);
74
+	$new_customer_id  = sanitize_text_field($data['customer-id']);
75 75
 
76 76
 	/**
77 77
 	 * Fires before updating edited donation.
@@ -80,62 +80,62 @@  discard block
 block discarded – undo
80 80
 	 *
81 81
 	 * @param int $payment_id The ID of the payment.
82 82
 	 */
83
-	do_action( 'give_update_edited_purchase', $payment_id );
83
+	do_action('give_update_edited_purchase', $payment_id);
84 84
 
85 85
 	$payment->date = $date;
86 86
 	$updated       = $payment->save();
87 87
 
88
-	if ( 0 === $updated ) {
89
-		wp_die( esc_html__( 'Error Updating Donation.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) );
88
+	if (0 === $updated) {
89
+		wp_die(esc_html__('Error Updating Donation.', 'give'), esc_html__('Error', 'give'), array('response' => 400));
90 90
 	}
91 91
 
92 92
 
93 93
 	$customer_changed = false;
94 94
 
95
-	if ( isset( $data['give-new-customer'] ) && $data['give-new-customer'] == '1' ) {
95
+	if (isset($data['give-new-customer']) && $data['give-new-customer'] == '1') {
96 96
 
97
-		$email = isset( $data['give-new-customer-email'] ) ? sanitize_text_field( $data['give-new-customer-email'] ) : '';
98
-		$names = isset( $data['give-new-customer-name'] ) ? sanitize_text_field( $data['give-new-customer-name'] ) : '';
97
+		$email = isset($data['give-new-customer-email']) ? sanitize_text_field($data['give-new-customer-email']) : '';
98
+		$names = isset($data['give-new-customer-name']) ? sanitize_text_field($data['give-new-customer-name']) : '';
99 99
 
100
-		if ( empty( $email ) || empty( $names ) ) {
101
-			wp_die( esc_html__( 'New Customers require a name and email address.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) );
100
+		if (empty($email) || empty($names)) {
101
+			wp_die(esc_html__('New Customers require a name and email address.', 'give'), esc_html__('Error', 'give'), array('response' => 400));
102 102
 		}
103 103
 
104
-		$customer = new Give_Customer( $email );
105
-		if ( empty( $customer->id ) ) {
106
-			$customer_data = array( 'name' => $names, 'email' => $email );
107
-			$user_id       = email_exists( $email );
108
-			if ( false !== $user_id ) {
104
+		$customer = new Give_Customer($email);
105
+		if (empty($customer->id)) {
106
+			$customer_data = array('name' => $names, 'email' => $email);
107
+			$user_id       = email_exists($email);
108
+			if (false !== $user_id) {
109 109
 				$customer_data['user_id'] = $user_id;
110 110
 			}
111 111
 
112
-			if ( ! $customer->create( $customer_data ) ) {
112
+			if ( ! $customer->create($customer_data)) {
113 113
 				// Failed to crete the new donor, assume the previous donor
114 114
 				$customer_changed = false;
115
-				$customer         = new Give_Customer( $curr_customer_id );
116
-				give_set_error( 'give-payment-new-customer-fail', esc_html__( 'Error creating new donor.', 'give' ) );
115
+				$customer         = new Give_Customer($curr_customer_id);
116
+				give_set_error('give-payment-new-customer-fail', esc_html__('Error creating new donor.', 'give'));
117 117
 			}
118 118
 		}
119 119
 
120 120
 		$new_customer_id = $customer->id;
121 121
 
122
-		$previous_customer = new Give_Customer( $curr_customer_id );
122
+		$previous_customer = new Give_Customer($curr_customer_id);
123 123
 
124 124
 		$customer_changed = true;
125 125
 
126
-	} elseif ( $curr_customer_id !== $new_customer_id ) {
126
+	} elseif ($curr_customer_id !== $new_customer_id) {
127 127
 
128
-		$customer = new Give_Customer( $new_customer_id );
128
+		$customer = new Give_Customer($new_customer_id);
129 129
 		$email    = $customer->email;
130 130
 		$names    = $customer->name;
131 131
 
132
-		$previous_customer = new Give_Customer( $curr_customer_id );
132
+		$previous_customer = new Give_Customer($curr_customer_id);
133 133
 
134 134
 		$customer_changed = true;
135 135
 
136 136
 	} else {
137 137
 
138
-		$customer = new Give_Customer( $curr_customer_id );
138
+		$customer = new Give_Customer($curr_customer_id);
139 139
 		$email    = $customer->email;
140 140
 		$names    = $customer->name;
141 141
 
@@ -143,38 +143,38 @@  discard block
 block discarded – undo
143 143
 
144 144
 
145 145
 	// Setup first and last name from input values
146
-	$names      = explode( ' ', $names );
147
-	$first_name = ! empty( $names[0] ) ? $names[0] : '';
146
+	$names      = explode(' ', $names);
147
+	$first_name = ! empty($names[0]) ? $names[0] : '';
148 148
 	$last_name  = '';
149
-	if ( ! empty( $names[1] ) ) {
150
-		unset( $names[0] );
151
-		$last_name = implode( ' ', $names );
149
+	if ( ! empty($names[1])) {
150
+		unset($names[0]);
151
+		$last_name = implode(' ', $names);
152 152
 	}
153 153
 
154 154
 
155
-	if ( $customer_changed ) {
155
+	if ($customer_changed) {
156 156
 
157 157
 		// Remove the stats and payment from the previous customer and attach it to the new customer
158
-		$previous_customer->remove_payment( $payment_id, false );
159
-		$customer->attach_payment( $payment_id, false );
158
+		$previous_customer->remove_payment($payment_id, false);
159
+		$customer->attach_payment($payment_id, false);
160 160
 
161
-		if ( 'publish' == $status ) {
161
+		if ('publish' == $status) {
162 162
 
163 163
             // Reduce previous user donation count and amount.
164 164
             $previous_customer->decrease_purchase_count();
165
-            $previous_customer->decrease_value( $curr_total );
165
+            $previous_customer->decrease_value($curr_total);
166 166
 
167 167
             // If donation was completed adjust stats of new customers.
168 168
             $customer->increase_purchase_count();
169
-			$customer->increase_value( $new_total );
169
+			$customer->increase_value($new_total);
170 170
 		}
171 171
 
172 172
 		$payment->customer_id = $customer->id;
173
-	} else{
173
+	} else {
174 174
 
175
-	    if( 'publish' === $status ){
175
+	    if ('publish' === $status) {
176 176
             // Update user donation stat.
177
-            $customer->update_donation_value( $curr_total, $new_total );
177
+            $customer->update_donation_value($curr_total, $new_total);
178 178
         }
179 179
     }
180 180
 
@@ -188,10 +188,10 @@  discard block
 block discarded – undo
188 188
 
189 189
 
190 190
 	// Check for payment notes
191
-	if ( ! empty( $data['give-payment-note'] ) ) {
191
+	if ( ! empty($data['give-payment-note'])) {
192 192
 
193
-		$note = wp_kses( $data['give-payment-note'], array() );
194
-		give_insert_payment_note( $payment_id, $note );
193
+		$note = wp_kses($data['give-payment-note'], array());
194
+		give_insert_payment_note($payment_id, $note);
195 195
 
196 196
 	}
197 197
 
@@ -199,17 +199,17 @@  discard block
 block discarded – undo
199 199
 	$payment->status = $status;
200 200
 
201 201
 	// Adjust total store earnings if the payment total has been changed
202
-	if ( $new_total !== $curr_total && 'publish' == $status ) {
202
+	if ($new_total !== $curr_total && 'publish' == $status) {
203 203
 
204
-		if ( $new_total > $curr_total ) {
204
+		if ($new_total > $curr_total) {
205 205
 			// Increase if our new total is higher
206 206
 			$difference = $new_total - $curr_total;
207
-			give_increase_total_earnings( $difference );
207
+			give_increase_total_earnings($difference);
208 208
 
209
-		} elseif ( $curr_total > $new_total ) {
209
+		} elseif ($curr_total > $new_total) {
210 210
 			// Decrease if our new total is lower
211 211
 			$difference = $curr_total - $new_total;
212
-			give_decrease_total_earnings( $difference );
212
+			give_decrease_total_earnings($difference);
213 213
 
214 214
 		}
215 215
 
@@ -218,16 +218,16 @@  discard block
 block discarded – undo
218 218
 	$payment->save();
219 219
 
220 220
     // Get new give form ID.
221
-    $new_form_id = absint( $data['forms'] );
222
-    $current_form_id = absint( $payment->get_meta( '_give_payment_form_id' ) );
221
+    $new_form_id = absint($data['forms']);
222
+    $current_form_id = absint($payment->get_meta('_give_payment_form_id'));
223 223
 
224 224
     // We are adding payment transfer code in last to remove any conflict with above functionality.
225 225
     // For example: above code will automatically handle form stat (increase/decrease) when payment status changes.
226 226
     /* Check if user want to transfer current payment to new give form id. */
227
-    if( $new_form_id != $current_form_id  ) {
227
+    if ($new_form_id != $current_form_id) {
228 228
 
229 229
         // Get new give form title.
230
-        $new_form_title = get_the_title( $new_form_id );
230
+        $new_form_title = get_the_title($new_form_id);
231 231
 
232 232
         // Update new give form data in payment data.
233 233
         $payment_meta = $payment->get_meta();
@@ -235,28 +235,28 @@  discard block
 block discarded – undo
235 235
         $payment_meta['form_id']    = $new_form_id;
236 236
 
237 237
         // Update price id post meta data for set donation form.
238
-        if( ! give_has_variable_prices( $new_form_id ) ) {
238
+        if ( ! give_has_variable_prices($new_form_id)) {
239 239
             $payment_meta['price_id'] = '';
240 240
         }
241 241
 
242 242
         // Update payment give form meta data.
243
-        $payment->update_meta( '_give_payment_form_id', $new_form_id );
244
-        $payment->update_meta( '_give_payment_form_title', $new_form_title );
245
-        $payment->update_meta( '_give_payment_meta', $payment_meta );
243
+        $payment->update_meta('_give_payment_form_id', $new_form_id);
244
+        $payment->update_meta('_give_payment_form_title', $new_form_title);
245
+        $payment->update_meta('_give_payment_meta', $payment_meta);
246 246
 
247 247
         // Update price id payment metadata.
248
-        if( ! give_has_variable_prices( $new_form_id ) ) {
249
-            $payment->update_meta( '_give_payment_price_id', '' );
248
+        if ( ! give_has_variable_prices($new_form_id)) {
249
+            $payment->update_meta('_give_payment_price_id', '');
250 250
         }
251 251
 
252 252
 
253 253
         // If donation was completed, adjust stats of forms
254
-        if ( 'publish' == $status ) {
254
+        if ('publish' == $status) {
255 255
 
256 256
             // Decrease sale of old give form. For other payment status 
257
-            $current_form = new Give_Donate_Form( $current_form_id );
257
+            $current_form = new Give_Donate_Form($current_form_id);
258 258
             $current_form->decrease_sales();
259
-            $current_form->decrease_earnings( $curr_total );
259
+            $current_form->decrease_earnings($curr_total);
260 260
             
261 261
             // Increase sale of new give form.
262 262
             $new_form = new Give_Donate_Form($new_form_id);
@@ -265,27 +265,27 @@  discard block
 block discarded – undo
265 265
         }
266 266
 
267 267
         // Re setup payment to update new meta value in object.
268
-        $payment->update_payment_setup( $payment->ID );
268
+        $payment->update_payment_setup($payment->ID);
269 269
     }
270 270
 
271 271
     // Update price id if current form is variable form.
272
-    if( ! empty( $data['give-variable-price'] ) && give_has_variable_prices( $payment->form_id ) ) {
272
+    if ( ! empty($data['give-variable-price']) && give_has_variable_prices($payment->form_id)) {
273 273
 
274 274
         // Get payment meta data.
275 275
         $payment_meta = $payment->get_meta();
276 276
 
277 277
         // Set payment id to empty string if variable price id is negative ( i.e. custom amount feature enabled ).
278
-        $data['give-variable-price'] = ( 'custom' === $data['give-variable-price'] ) ? 'custom' : ( 0 < $data['give-variable-price'] ) ? $data['give-variable-price'] : '';
278
+        $data['give-variable-price'] = ('custom' === $data['give-variable-price']) ? 'custom' : (0 < $data['give-variable-price']) ? $data['give-variable-price'] : '';
279 279
 
280 280
         // Update payment meta data.
281 281
         $payment_meta['price_id'] = $data['give-variable-price'];
282 282
 
283 283
         // Update payment give form meta data.
284
-        $payment->update_meta( '_give_payment_price_id', $data['give-variable-price'] );
285
-        $payment->update_meta( '_give_payment_meta', $payment_meta );
284
+        $payment->update_meta('_give_payment_price_id', $data['give-variable-price']);
285
+        $payment->update_meta('_give_payment_meta', $payment_meta);
286 286
 
287 287
         // Re setup payment to update new meta value in object.
288
-        $payment->update_payment_setup( $payment->ID );
288
+        $payment->update_payment_setup($payment->ID);
289 289
     }
290 290
 
291 291
 	/**
@@ -295,13 +295,13 @@  discard block
 block discarded – undo
295 295
 	 *
296 296
 	 * @param int $payment_id The ID of the payment.
297 297
 	 */
298
-	do_action( 'give_updated_edited_purchase', $payment_id );
298
+	do_action('give_updated_edited_purchase', $payment_id);
299 299
 
300
-	wp_safe_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&give-message=payment-updated&id=' . $payment_id ) );
300
+	wp_safe_redirect(admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&give-message=payment-updated&id='.$payment_id));
301 301
 	exit;
302 302
 }
303 303
 
304
-add_action( 'give_update_payment_details', 'give_update_payment_details' );
304
+add_action('give_update_payment_details', 'give_update_payment_details');
305 305
 
306 306
 /**
307 307
  * Trigger a Donation Deletion
@@ -312,48 +312,48 @@  discard block
 block discarded – undo
312 312
  *
313 313
  * @return void
314 314
  */
315
-function give_trigger_purchase_delete( $data ) {
316
-	if ( wp_verify_nonce( $data['_wpnonce'], 'give_payment_nonce' ) ) {
315
+function give_trigger_purchase_delete($data) {
316
+	if (wp_verify_nonce($data['_wpnonce'], 'give_payment_nonce')) {
317 317
 
318
-		$payment_id = absint( $data['purchase_id'] );
318
+		$payment_id = absint($data['purchase_id']);
319 319
 
320
-		if ( ! current_user_can( 'edit_give_payments', $payment_id ) ) {
321
-			wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
320
+		if ( ! current_user_can('edit_give_payments', $payment_id)) {
321
+			wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
322 322
 		}
323 323
 
324
-		give_delete_purchase( $payment_id );
325
-		wp_redirect( admin_url( '/edit.php?post_type=give_forms&page=give-payment-history&give-message=payment_deleted' ) );
324
+		give_delete_purchase($payment_id);
325
+		wp_redirect(admin_url('/edit.php?post_type=give_forms&page=give-payment-history&give-message=payment_deleted'));
326 326
 		give_die();
327 327
 	}
328 328
 }
329 329
 
330
-add_action( 'give_delete_payment', 'give_trigger_purchase_delete' );
330
+add_action('give_delete_payment', 'give_trigger_purchase_delete');
331 331
 
332 332
 /**
333 333
  * AJAX Store Donation Note
334 334
  */
335 335
 function give_ajax_store_payment_note() {
336 336
 
337
-	$payment_id = absint( $_POST['payment_id'] );
338
-	$note       = wp_kses( $_POST['note'], array() );
337
+	$payment_id = absint($_POST['payment_id']);
338
+	$note       = wp_kses($_POST['note'], array());
339 339
 
340
-	if ( ! current_user_can( 'edit_give_payments', $payment_id ) ) {
341
-		wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
340
+	if ( ! current_user_can('edit_give_payments', $payment_id)) {
341
+		wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
342 342
 	}
343 343
 
344
-	if ( empty( $payment_id ) ) {
345
-		die( '-1' );
344
+	if (empty($payment_id)) {
345
+		die('-1');
346 346
 	}
347 347
 
348
-	if ( empty( $note ) ) {
349
-		die( '-1' );
348
+	if (empty($note)) {
349
+		die('-1');
350 350
 	}
351 351
 
352
-	$note_id = give_insert_payment_note( $payment_id, $note );
353
-	die( give_get_payment_note_html( $note_id ) );
352
+	$note_id = give_insert_payment_note($payment_id, $note);
353
+	die(give_get_payment_note_html($note_id));
354 354
 }
355 355
 
356
-add_action( 'wp_ajax_give_insert_payment_note', 'give_ajax_store_payment_note' );
356
+add_action('wp_ajax_give_insert_payment_note', 'give_ajax_store_payment_note');
357 357
 
358 358
 /**
359 359
  * Triggers a payment note deletion without ajax
@@ -364,24 +364,24 @@  discard block
 block discarded – undo
364 364
  *
365 365
  * @return void
366 366
  */
367
-function give_trigger_payment_note_deletion( $data ) {
367
+function give_trigger_payment_note_deletion($data) {
368 368
 
369
-	if ( ! wp_verify_nonce( $data['_wpnonce'], 'give_delete_payment_note_' . $data['note_id'] ) ) {
369
+	if ( ! wp_verify_nonce($data['_wpnonce'], 'give_delete_payment_note_'.$data['note_id'])) {
370 370
 		return;
371 371
 	}
372 372
 
373
-	if ( ! current_user_can( 'edit_give_payments', $data['payment_id'] ) ) {
374
-		wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
373
+	if ( ! current_user_can('edit_give_payments', $data['payment_id'])) {
374
+		wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
375 375
 	}
376 376
 
377
-	$edit_order_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&give-message=payment-note-deleted&id=' . absint( $data['payment_id'] ) );
377
+	$edit_order_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&give-message=payment-note-deleted&id='.absint($data['payment_id']));
378 378
 
379
-	give_delete_payment_note( $data['note_id'], $data['payment_id'] );
379
+	give_delete_payment_note($data['note_id'], $data['payment_id']);
380 380
 
381
-	wp_redirect( $edit_order_url );
381
+	wp_redirect($edit_order_url);
382 382
 }
383 383
 
384
-add_action( 'give_delete_payment_note', 'give_trigger_payment_note_deletion' );
384
+add_action('give_delete_payment_note', 'give_trigger_payment_note_deletion');
385 385
 
386 386
 /**
387 387
  * Delete a payment note deletion with ajax
@@ -392,16 +392,16 @@  discard block
 block discarded – undo
392 392
  */
393 393
 function give_ajax_delete_payment_note() {
394 394
 
395
-	if ( ! current_user_can( 'edit_give_payments', $_POST['payment_id'] ) ) {
396
-		wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
395
+	if ( ! current_user_can('edit_give_payments', $_POST['payment_id'])) {
396
+		wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
397 397
 	}
398 398
 
399
-	if ( give_delete_payment_note( $_POST['note_id'], $_POST['payment_id'] ) ) {
400
-		die( '1' );
399
+	if (give_delete_payment_note($_POST['note_id'], $_POST['payment_id'])) {
400
+		die('1');
401 401
 	} else {
402
-		die( '-1' );
402
+		die('-1');
403 403
 	}
404 404
 
405 405
 }
406 406
 
407
-add_action( 'wp_ajax_give_delete_payment_note', 'give_ajax_delete_payment_note' );
408 407
\ No newline at end of file
408
+add_action('wp_ajax_give_delete_payment_note', 'give_ajax_delete_payment_note');
409 409
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/reporting/class-gateways-reports-table.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
17 17
 // Load WP_List_Table if not loaded
18
-if ( ! class_exists( 'WP_List_Table' ) ) {
19
-	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
18
+if ( ! class_exists('WP_List_Table')) {
19
+	require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php';
20 20
 }
21 21
 
22 22
 /**
@@ -45,11 +45,11 @@  discard block
 block discarded – undo
45 45
 		global $status, $page;
46 46
 
47 47
 		// Set parent defaults
48
-		parent::__construct( array(
49
-			'singular' => give_get_forms_label_singular(),    // Singular name of the listed records
50
-			'plural'   => give_get_forms_label_plural(),        // Plural name of the listed records
48
+		parent::__construct(array(
49
+			'singular' => give_get_forms_label_singular(), // Singular name of the listed records
50
+			'plural'   => give_get_forms_label_plural(), // Plural name of the listed records
51 51
 			'ajax'     => false                        // Does this table support ajax?
52
-		) );
52
+		));
53 53
 
54 54
 	}
55 55
 
@@ -64,10 +64,10 @@  discard block
 block discarded – undo
64 64
 	 *
65 65
 	 * @return string Column Name
66 66
 	 */
67
-	public function column_default( $item, $column_name ) {
68
-		switch ( $column_name ) {
67
+	public function column_default($item, $column_name) {
68
+		switch ($column_name) {
69 69
 			default:
70
-				return $item[ $column_name ];
70
+				return $item[$column_name];
71 71
 		}
72 72
 	}
73 73
 
@@ -80,11 +80,11 @@  discard block
 block discarded – undo
80 80
 	 */
81 81
 	public function get_columns() {
82 82
 		$columns = array(
83
-			'label'           => esc_attr__( 'Gateway', 'give' ),
84
-			'complete_sales'  => esc_attr__( 'Complete Transactions', 'give' ),
85
-			'pending_sales'   => esc_attr__( 'Pending / Failed Transactions', 'give' ),
86
-			'total_sales'     => esc_attr__( 'Total Transactions', 'give' ),
87
-			'total_donations' => esc_attr__( 'Total Donations', 'give' )
83
+			'label'           => esc_attr__('Gateway', 'give'),
84
+			'complete_sales'  => esc_attr__('Complete Transactions', 'give'),
85
+			'pending_sales'   => esc_attr__('Pending / Failed Transactions', 'give'),
86
+			'total_sales'     => esc_attr__('Total Transactions', 'give'),
87
+			'total_donations' => esc_attr__('Total Donations', 'give')
88 88
 		);
89 89
 
90 90
 		return $columns;
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 	 * @return int Current page number
100 100
 	 */
101 101
 	public function get_paged() {
102
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
102
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
103 103
 	}
104 104
 
105 105
 
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 	 * @since  1.0
111 111
 	 * @return void
112 112
 	 */
113
-	public function bulk_actions( $which = '' ) {
113
+	public function bulk_actions($which = '') {
114 114
 		// These aren't really bulk actions but this outputs the markup in the right place
115 115
 		give_report_views();
116 116
 	}
@@ -123,23 +123,23 @@  discard block
 block discarded – undo
123 123
 	 *
124 124
 	 * @param string $which
125 125
 	 */
126
-	protected function display_tablenav( $which ) {
126
+	protected function display_tablenav($which) {
127 127
 
128
-		if ( 'top' == $which ) {
129
-			wp_nonce_field( 'bulk-' . $this->_args['plural'] );
128
+		if ('top' == $which) {
129
+			wp_nonce_field('bulk-'.$this->_args['plural']);
130 130
 		}
131 131
 		?>
132
-		<div class="tablenav gateways-report-tablenav give-clearfix <?php echo esc_attr( $which ); ?>">
132
+		<div class="tablenav gateways-report-tablenav give-clearfix <?php echo esc_attr($which); ?>">
133 133
 
134
-			<h3 class="alignleft reports-earnings-title"><span><?php esc_html_e( 'Donation Methods Report', 'give' ); ?></span></h3>
134
+			<h3 class="alignleft reports-earnings-title"><span><?php esc_html_e('Donation Methods Report', 'give'); ?></span></h3>
135 135
 
136 136
 			<div class="alignright tablenav-right">
137 137
 				<div class="actions bulkactions">
138
-					<?php $this->bulk_actions( $which ); ?>
138
+					<?php $this->bulk_actions($which); ?>
139 139
 				</div>
140 140
 				<?php
141
-				$this->extra_tablenav( $which );
142
-				$this->pagination( $which );
141
+				$this->extra_tablenav($which);
142
+				$this->pagination($which);
143 143
 				?>
144 144
 			</div>
145 145
 
@@ -164,18 +164,18 @@  discard block
 block discarded – undo
164 164
 		$gateways     = give_get_payment_gateways();
165 165
 		$stats        = new Give_Payment_Stats();
166 166
 
167
-		foreach ( $gateways as $gateway_id => $gateway ) {
167
+		foreach ($gateways as $gateway_id => $gateway) {
168 168
 
169
-			$complete_count = give_count_sales_by_gateway( $gateway_id, 'publish' );
170
-			$pending_count  = give_count_sales_by_gateway( $gateway_id, array( 'pending', 'failed' ) );
169
+			$complete_count = give_count_sales_by_gateway($gateway_id, 'publish');
170
+			$pending_count  = give_count_sales_by_gateway($gateway_id, array('pending', 'failed'));
171 171
 
172 172
 			$reports_data[] = array(
173 173
 				'ID'              => $gateway_id,
174 174
 				'label'           => $gateway['admin_label'],
175
-				'complete_sales'  => give_format_amount( $complete_count, false ),
176
-				'pending_sales'   => give_format_amount( $pending_count, false ),
177
-				'total_sales'     => give_format_amount( $complete_count + $pending_count, false ),
178
-				'total_donations' => give_currency_filter( give_format_amount( $stats->get_earnings( 0, 0, 0, $gateway_id ) ) )
175
+				'complete_sales'  => give_format_amount($complete_count, false),
176
+				'pending_sales'   => give_format_amount($pending_count, false),
177
+				'total_sales'     => give_format_amount($complete_count + $pending_count, false),
178
+				'total_donations' => give_currency_filter(give_format_amount($stats->get_earnings(0, 0, 0, $gateway_id)))
179 179
 			);
180 180
 		}
181 181
 
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 		$columns               = $this->get_columns();
198 198
 		$hidden                = array(); // No hidden columns
199 199
 		$sortable              = $this->get_sortable_columns();
200
-		$this->_column_headers = array( $columns, $hidden, $sortable );
200
+		$this->_column_headers = array($columns, $hidden, $sortable);
201 201
 		$this->items           = $this->reports_data();
202 202
 
203 203
 	}
Please login to merge, or discard this patch.
includes/admin/reporting/logs.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  * @return void
24 24
  */
25 25
 function give_logs_view_sales() {
26
-	include( dirname( __FILE__ ) . '/class-sales-logs-list-table.php' );
26
+	include(dirname(__FILE__).'/class-sales-logs-list-table.php');
27 27
 
28 28
 	$logs_table = new Give_Sales_Log_Table();
29 29
 	$logs_table->prepare_items();
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 
32 32
 }
33 33
 
34
-add_action( 'give_logs_view_sales', 'give_logs_view_sales' );
34
+add_action('give_logs_view_sales', 'give_logs_view_sales');
35 35
 
36 36
 
37 37
 /**
@@ -43,14 +43,14 @@  discard block
 block discarded – undo
43 43
  * @return void
44 44
  */
45 45
 function give_logs_view_gateway_errors() {
46
-	include( dirname( __FILE__ ) . '/class-gateway-error-logs-list-table.php' );
46
+	include(dirname(__FILE__).'/class-gateway-error-logs-list-table.php');
47 47
 
48 48
 	$logs_table = new Give_Gateway_Error_Log_Table();
49 49
 	$logs_table->prepare_items();
50 50
 	$logs_table->display();
51 51
 }
52 52
 
53
-add_action( 'give_logs_view_gateway_errors', 'give_logs_view_gateway_errors' );
53
+add_action('give_logs_view_gateway_errors', 'give_logs_view_gateway_errors');
54 54
 
55 55
 /**
56 56
  * API Request Logs
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
  * @return void
63 63
  */
64 64
 function give_logs_view_api_requests() {
65
-	include( dirname( __FILE__ ) . '/class-api-requests-logs-list-table.php' );
65
+	include(dirname(__FILE__).'/class-api-requests-logs-list-table.php');
66 66
 
67 67
 	$logs_table = new Give_API_Request_Log_Table();
68 68
 	$logs_table->prepare_items();
@@ -75,12 +75,12 @@  discard block
 block discarded – undo
75 75
 		 *
76 76
 		 * @since 1.0
77 77
 		 */
78
-		do_action( 'give_logs_api_requests_top' );
78
+		do_action('give_logs_api_requests_top');
79 79
 		?>
80 80
 
81
-		<form id="give-logs-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-reports&tab=logs' ); ?>">
81
+		<form id="give-logs-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-reports&tab=logs'); ?>">
82 82
 			<?php
83
-			$logs_table->search_box( esc_html__( 'Search', 'give' ), 'give-api-requests' );
83
+			$logs_table->search_box(esc_html__('Search', 'give'), 'give-api-requests');
84 84
 			$logs_table->display();
85 85
 			?>
86 86
 			<input type="hidden" name="post_type" value="give_forms"/>
@@ -93,14 +93,14 @@  discard block
 block discarded – undo
93 93
 		 *
94 94
 		 * @since 1.0
95 95
 		 */
96
-		do_action( 'give_logs_api_requests_bottom' );
96
+		do_action('give_logs_api_requests_bottom');
97 97
 		?>
98 98
 
99 99
 	</div>
100 100
 	<?php
101 101
 }
102 102
 
103
-add_action( 'give_logs_view_api_requests', 'give_logs_view_api_requests' );
103
+add_action('give_logs_view_api_requests', 'give_logs_view_api_requests');
104 104
 
105 105
 
106 106
 /**
@@ -111,12 +111,12 @@  discard block
 block discarded – undo
111 111
  */
112 112
 function give_log_default_views() {
113 113
 	$views = array(
114
-		'sales'          => esc_html__( 'Donations', 'give' ),
115
-		'gateway_errors' => esc_html__( 'Payment Errors', 'give' ),
116
-		'api_requests'   => esc_html__( 'API Requests', 'give' )
114
+		'sales'          => esc_html__('Donations', 'give'),
115
+		'gateway_errors' => esc_html__('Payment Errors', 'give'),
116
+		'api_requests'   => esc_html__('API Requests', 'give')
117 117
 	);
118 118
 
119
-	$views = apply_filters( 'give_log_views', $views );
119
+	$views = apply_filters('give_log_views', $views);
120 120
 
121 121
 	return $views;
122 122
 }
@@ -129,13 +129,13 @@  discard block
 block discarded – undo
129 129
  */
130 130
 function give_log_views() {
131 131
 	$views        = give_log_default_views();
132
-	$current_view = isset( $_GET['view'] ) && array_key_exists( $_GET['view'], give_log_default_views() ) ? sanitize_text_field( $_GET['view'] ) : 'sales';
132
+	$current_view = isset($_GET['view']) && array_key_exists($_GET['view'], give_log_default_views()) ? sanitize_text_field($_GET['view']) : 'sales';
133 133
 	?>
134 134
 	<form id="give-logs-filter" method="get" action="edit.php">
135 135
 		<select id="give-logs-view" name="view">
136 136
 			<optgroup label="Log Type:">
137
-				<?php foreach ( $views as $view_id => $label ): ?>
138
-					<option value="<?php echo esc_attr( $view_id ); ?>" <?php selected( $view_id, $current_view ); ?>><?php echo $label; ?></option>
137
+				<?php foreach ($views as $view_id => $label): ?>
138
+					<option value="<?php echo esc_attr($view_id); ?>" <?php selected($view_id, $current_view); ?>><?php echo $label; ?></option>
139 139
 				<?php endforeach; ?>
140 140
 			</optgroup>
141 141
 		</select>
@@ -148,14 +148,14 @@  discard block
 block discarded – undo
148 148
 		 *
149 149
 		 * @since 1.0
150 150
 		 */
151
-		do_action( 'give_log_view_actions' );
151
+		do_action('give_log_view_actions');
152 152
 		?>
153 153
 
154 154
 		<input type="hidden" name="post_type" value="give_forms"/>
155 155
 		<input type="hidden" name="page" value="give-reports"/>
156 156
 		<input type="hidden" name="tab" value="logs"/>
157 157
 
158
-		<?php submit_button( esc_html__( 'Apply', 'give' ), 'secondary', 'submit', false ); ?>
158
+		<?php submit_button(esc_html__('Apply', 'give'), 'secondary', 'submit', false); ?>
159 159
 	</form>
160 160
 	<?php
161 161
 }
162 162
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/reporting/export/export-actions.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
11 11
  */
12 12
 
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -22,11 +22,11 @@  discard block
 block discarded – undo
22 22
  */
23 23
 function give_process_batch_export_form() {
24 24
 
25
-	if ( ! wp_verify_nonce( $_REQUEST['nonce'], 'give-batch-export' ) ) {
26
-		wp_die( esc_html__( 'Nonce verification failed.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
25
+	if ( ! wp_verify_nonce($_REQUEST['nonce'], 'give-batch-export')) {
26
+		wp_die(esc_html__('Nonce verification failed.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
27 27
 	}
28 28
 
29
-	require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export.php';
29
+	require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/class-batch-export.php';
30 30
 
31 31
 	/**
32 32
 	 * Fires before batch export.
@@ -35,14 +35,14 @@  discard block
 block discarded – undo
35 35
 	 *
36 36
 	 * @param atring $class Export class.
37 37
 	 */
38
-	do_action( 'give_batch_export_class_include', $_REQUEST['class'] );
38
+	do_action('give_batch_export_class_include', $_REQUEST['class']);
39 39
 
40 40
 	$export = new $_REQUEST['class'];
41 41
 	$export->export();
42 42
 
43 43
 }
44 44
 
45
-add_action( 'give_form_batch_export', 'give_process_batch_export_form' );
45
+add_action('give_form_batch_export', 'give_process_batch_export_form');
46 46
 
47 47
 /**
48 48
  * Exports earnings for a specified time period
@@ -53,14 +53,14 @@  discard block
 block discarded – undo
53 53
  * @return void
54 54
  */
55 55
 function give_export_earnings() {
56
-	require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-export-earnings.php';
56
+	require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-export-earnings.php';
57 57
 
58 58
 	$earnings_export = new Give_Earnings_Export();
59 59
 
60 60
 	$earnings_export->export();
61 61
 }
62 62
 
63
-add_action( 'give_earnings_export', 'give_export_earnings' );
63
+add_action('give_earnings_export', 'give_export_earnings');
64 64
 
65 65
 
66 66
 /**
@@ -73,14 +73,14 @@  discard block
 block discarded – undo
73 73
  * @return void
74 74
  */
75 75
 function give_export_all_customers() {
76
-	require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-export-customers.php';
76
+	require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-export-customers.php';
77 77
 
78 78
 	$customer_export = new Give_Donors_Export();
79 79
 
80 80
 	$customer_export->export();
81 81
 }
82 82
 
83
-add_action( 'give_email_export', 'give_export_all_customers' );
83
+add_action('give_email_export', 'give_export_all_customers');
84 84
 
85 85
 /**
86 86
  * Add a hook allowing extensions to register a hook on the batch export process
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
  * @return void
90 90
  */
91 91
 function give_register_batch_exporters() {
92
-	if ( is_admin() ) {
92
+	if (is_admin()) {
93 93
 		/**
94 94
 		 * Fires in the admin, while plugins loaded.
95 95
 		 *
@@ -99,21 +99,21 @@  discard block
 block discarded – undo
99 99
 		 *
100 100
 		 * @param string $class Export class.
101 101
 		 */
102
-		do_action( 'give_register_batch_exporter' );
102
+		do_action('give_register_batch_exporter');
103 103
 	}
104 104
 }
105 105
 
106
-add_action( 'plugins_loaded', 'give_register_batch_exporters' );
106
+add_action('plugins_loaded', 'give_register_batch_exporters');
107 107
 
108 108
 /**
109 109
  * Register the payments batch exporter
110 110
  * @since  1.5
111 111
  */
112 112
 function give_register_payments_batch_export() {
113
-	add_action( 'give_batch_export_class_include', 'give_include_payments_batch_processor', 10, 1 );
113
+	add_action('give_batch_export_class_include', 'give_include_payments_batch_processor', 10, 1);
114 114
 }
115 115
 
116
-add_action( 'give_register_batch_exporter', 'give_register_payments_batch_export', 10 );
116
+add_action('give_register_batch_exporter', 'give_register_payments_batch_export', 10);
117 117
 
118 118
 /**
119 119
  * Loads the payments batch process if needed
@@ -124,10 +124,10 @@  discard block
 block discarded – undo
124 124
  *
125 125
  * @return void
126 126
  */
127
-function give_include_payments_batch_processor( $class ) {
127
+function give_include_payments_batch_processor($class) {
128 128
 
129
-	if ( 'Give_Batch_Payments_Export' === $class ) {
130
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export-payments.php';
129
+	if ('Give_Batch_Payments_Export' === $class) {
130
+		require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/class-batch-export-payments.php';
131 131
 	}
132 132
 
133 133
 }
@@ -137,10 +137,10 @@  discard block
 block discarded – undo
137 137
  * @since  1.5.2
138 138
  */
139 139
 function give_register_customers_batch_export() {
140
-	add_action( 'give_batch_export_class_include', 'give_include_customers_batch_processor', 10, 1 );
140
+	add_action('give_batch_export_class_include', 'give_include_customers_batch_processor', 10, 1);
141 141
 }
142 142
 
143
-add_action( 'give_register_batch_exporter', 'give_register_customers_batch_export', 10 );
143
+add_action('give_register_batch_exporter', 'give_register_customers_batch_export', 10);
144 144
 
145 145
 /**
146 146
  * Loads the customers batch process if needed
@@ -151,10 +151,10 @@  discard block
 block discarded – undo
151 151
  *
152 152
  * @return void
153 153
  */
154
-function give_include_customers_batch_processor( $class ) {
154
+function give_include_customers_batch_processor($class) {
155 155
 
156
-	if ( 'Give_Batch_Customers_Export' === $class ) {
157
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export-customers.php';
156
+	if ('Give_Batch_Customers_Export' === $class) {
157
+		require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/class-batch-export-customers.php';
158 158
 	}
159 159
 
160 160
 }
@@ -165,10 +165,10 @@  discard block
 block discarded – undo
165 165
  * @since  1.5
166 166
  */
167 167
 function give_register_forms_batch_export() {
168
-	add_action( 'give_batch_export_class_include', 'give_include_forms_batch_processor', 10, 1 );
168
+	add_action('give_batch_export_class_include', 'give_include_forms_batch_processor', 10, 1);
169 169
 }
170 170
 
171
-add_action( 'give_register_batch_exporter', 'give_register_forms_batch_export', 10 );
171
+add_action('give_register_batch_exporter', 'give_register_forms_batch_export', 10);
172 172
 
173 173
 /**
174 174
  * Loads the file downloads batch process if needed
@@ -179,10 +179,10 @@  discard block
 block discarded – undo
179 179
  *
180 180
  * @return void
181 181
  */
182
-function give_include_forms_batch_processor( $class ) {
182
+function give_include_forms_batch_processor($class) {
183 183
 
184
-	if ( 'Give_Batch_Forms_Export' === $class ) {
185
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export-forms.php';
184
+	if ('Give_Batch_Forms_Export' === $class) {
185
+		require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/class-batch-export-forms.php';
186 186
 	}
187 187
 
188 188
 }
189 189
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/forms/metabox.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 					'row_classes'  => 'give-subfield',
76 76
 					'render_row_cb' 	=> 'give_cmb_amount_field_render_row_cb',
77 77
 					'sanitization_cb'   => 'give_sanitize_price_field_value',
78
-                    'attributes'   => array(
78
+					'attributes'   => array(
79 79
 						'placeholder' => give_format_decimal( '1.00' ),
80 80
 						'value'       => give_format_decimal( $price ),
81 81
 						'class'       => 'cmb-type-text-small give-money-field',
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 							'before_field'      => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol  give-money-symbol-before">' . give_currency_symbol() . '</span>' : '',
111 111
 							'after_field'       => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol  give-money-symbol-after">' . give_currency_symbol() . '</span>' : '',
112 112
 							'sanitization_cb'   => 'give_sanitize_price_field_value',
113
-                            'attributes'        => array(
113
+							'attributes'        => array(
114 114
 								'placeholder' => give_format_decimal( '1.00' ),
115 115
 								'class'       => 'cmb-type-text-small give-money-field',
116 116
 							),
Please login to merge, or discard this patch.
Spacing   +183 added lines, -183 removed lines patch added patch discarded remove patch
@@ -10,11 +10,11 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
17
-add_filter( 'cmb2_meta_boxes', 'give_single_forms_cmb2_metaboxes' );
17
+add_filter('cmb2_meta_boxes', 'give_single_forms_cmb2_metaboxes');
18 18
 
19 19
 /**
20 20
  * Define the metabox and field configurations.
@@ -23,23 +23,23 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return array
25 25
  */
26
-function give_single_forms_cmb2_metaboxes( array $meta_boxes ) {
26
+function give_single_forms_cmb2_metaboxes(array $meta_boxes) {
27 27
 
28 28
 	$post_id               = give_get_admin_post_id();
29
-	$price                 = give_get_form_price( $post_id );
30
-	$custom_amount_minimum = give_get_form_minimum_price( $post_id );
31
-	$goal                  = give_get_form_goal( $post_id );
32
-	$variable_pricing      = give_has_variable_prices( $post_id );
33
-	$prices                = give_get_variable_prices( $post_id );
29
+	$price                 = give_get_form_price($post_id);
30
+	$custom_amount_minimum = give_get_form_minimum_price($post_id);
31
+	$goal                  = give_get_form_goal($post_id);
32
+	$variable_pricing      = give_has_variable_prices($post_id);
33
+	$prices                = give_get_variable_prices($post_id);
34 34
 
35 35
 	//No empty prices - min. 1.00 for new forms
36
-	if ( empty( $price ) && is_null( $post_id ) ) {
37
-		$price = esc_attr( give_format_amount( '1.00' ) );
36
+	if (empty($price) && is_null($post_id)) {
37
+		$price = esc_attr(give_format_amount('1.00'));
38 38
 	}
39 39
 
40 40
 	//Min. $1.00 for new forms
41
-	if ( empty( $custom_amount_minimum ) ) {
42
-		$custom_amount_minimum = esc_attr( give_format_amount( '1.00' ) );
41
+	if (empty($custom_amount_minimum)) {
42
+		$custom_amount_minimum = esc_attr(give_format_amount('1.00'));
43 43
 	}
44 44
 
45 45
 	// Start with an underscore to hide fields from custom fields list
@@ -48,327 +48,327 @@  discard block
 block discarded – undo
48 48
 	/**
49 49
 	 * Repeatable Field Groups
50 50
 	 */
51
-	$meta_boxes['form_field_options'] = apply_filters( 'give_forms_field_options', array(
51
+	$meta_boxes['form_field_options'] = apply_filters('give_forms_field_options', array(
52 52
 		'id'           => 'form_field_options',
53
-		'title'        => esc_html__( 'Donation Options', 'give' ),
54
-		'object_types' => array( 'give_forms' ),
53
+		'title'        => esc_html__('Donation Options', 'give'),
54
+		'object_types' => array('give_forms'),
55 55
 		'context'      => 'normal',
56 56
 		'priority'     => 'high', //Show above Content WYSIWYG
57
-		'fields'       => apply_filters( 'give_forms_donation_form_metabox_fields', array(
57
+		'fields'       => apply_filters('give_forms_donation_form_metabox_fields', array(
58 58
 				//Donation Option
59 59
 				array(
60
-					'name'        => esc_html__( 'Donation Option', 'give' ),
61
-					'description' => esc_html__( 'Would you like this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give' ),
62
-					'id'          => $prefix . 'price_option',
60
+					'name'        => esc_html__('Donation Option', 'give'),
61
+					'description' => esc_html__('Would you like this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give'),
62
+					'id'          => $prefix.'price_option',
63 63
 					'type'        => 'radio_inline',
64 64
 					'default'     => 'set',
65
-					'options'     => apply_filters( 'give_forms_price_options', array(
66
-						'set'   => esc_html__( 'Set Donation', 'give' ),
67
-						'multi' => esc_html__( 'Multi-level Donation', 'give' ),
68
-					) ),
65
+					'options'     => apply_filters('give_forms_price_options', array(
66
+						'set'   => esc_html__('Set Donation', 'give'),
67
+						'multi' => esc_html__('Multi-level Donation', 'give'),
68
+					)),
69 69
 				),
70 70
 				array(
71
-					'name'         => esc_html__( 'Set Donation', 'give' ),
72
-					'description'  => esc_html__( 'This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give' ),
73
-					'id'           => $prefix . 'set_price',
71
+					'name'         => esc_html__('Set Donation', 'give'),
72
+					'description'  => esc_html__('This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give'),
73
+					'id'           => $prefix.'set_price',
74 74
 					'type'         => 'text_small',
75 75
 					'row_classes'  => 'give-subfield',
76 76
 					'render_row_cb' 	=> 'give_cmb_amount_field_render_row_cb',
77 77
 					'sanitization_cb'   => 'give_sanitize_price_field_value',
78 78
                     'attributes'   => array(
79
-						'placeholder' => give_format_decimal( '1.00' ),
80
-						'value'       => give_format_decimal( $price ),
79
+						'placeholder' => give_format_decimal('1.00'),
80
+						'value'       => give_format_decimal($price),
81 81
 						'class'       => 'cmb-type-text-small give-money-field',
82 82
 					),
83 83
 				),
84 84
 				//Donation levels: Header
85 85
 				array(
86
-					'id'   => $prefix . 'levels_header',
86
+					'id'   => $prefix.'levels_header',
87 87
 					'type' => 'levels_repeater_header',
88 88
 				),
89 89
 				//Donation Levels: Repeatable CMB2 Group
90 90
 				array(
91
-					'id'          => $prefix . 'donation_levels',
91
+					'id'          => $prefix.'donation_levels',
92 92
 					'type'        => 'group',
93 93
 					'row_classes' => 'give-subfield',
94 94
 					'options'     => array(
95
-						'add_button'    => esc_html__( 'Add Level', 'give' ),
95
+						'add_button'    => esc_html__('Add Level', 'give'),
96 96
 						'remove_button' => '<span class="dashicons dashicons-no"></span>',
97 97
 						'sortable'      => true, // beta
98 98
 					),
99 99
 					// Fields array works the same, except id's only need to be unique for this group. Prefix is not needed.
100
-					'fields'      => apply_filters( 'give_donation_levels_table_row', array(
100
+					'fields'      => apply_filters('give_donation_levels_table_row', array(
101 101
 						array(
102
-							'name' => esc_html__( 'ID', 'give' ),
103
-							'id'   => $prefix . 'id',
102
+							'name' => esc_html__('ID', 'give'),
103
+							'id'   => $prefix.'id',
104 104
 							'type' => 'levels_id',
105 105
 						),
106 106
 						array(
107
-							'name'              => esc_html__( 'Amount', 'give' ),
108
-							'id'                => $prefix . 'amount',
107
+							'name'              => esc_html__('Amount', 'give'),
108
+							'id'                => $prefix.'amount',
109 109
 							'type'              => 'text_small',
110
-							'before_field'      => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol  give-money-symbol-before">' . give_currency_symbol() . '</span>' : '',
111
-							'after_field'       => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol  give-money-symbol-after">' . give_currency_symbol() . '</span>' : '',
110
+							'before_field'      => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol  give-money-symbol-before">'.give_currency_symbol().'</span>' : '',
111
+							'after_field'       => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol  give-money-symbol-after">'.give_currency_symbol().'</span>' : '',
112 112
 							'sanitization_cb'   => 'give_sanitize_price_field_value',
113 113
                             'attributes'        => array(
114
-								'placeholder' => give_format_decimal( '1.00' ),
114
+								'placeholder' => give_format_decimal('1.00'),
115 115
 								'class'       => 'cmb-type-text-small give-money-field',
116 116
 							),
117 117
 							'before'       => 'give_format_admin_multilevel_amount',
118 118
 						),
119 119
 						array(
120
-							'name'       => esc_html__( 'Text', 'give' ),
121
-							'id'         => $prefix . 'text',
120
+							'name'       => esc_html__('Text', 'give'),
121
+							'id'         => $prefix.'text',
122 122
 							'type'       => 'text',
123 123
 							'attributes' => array(
124
-								'placeholder' => esc_html__( 'Donation Level', 'give' ),
124
+								'placeholder' => esc_html__('Donation Level', 'give'),
125 125
 								'class'       => 'give-multilevel-text-field',
126 126
 							),
127 127
 						),
128 128
 						array(
129
-							'name' => esc_html__( 'Default', 'give' ),
130
-							'id'   => $prefix . 'default',
129
+							'name' => esc_html__('Default', 'give'),
130
+							'id'   => $prefix.'default',
131 131
 							'type' => 'give_default_radio_inline'
132 132
 						),
133
-					) ),
133
+					)),
134 134
 				),
135 135
 				//Display Style
136 136
 				array(
137
-					'name'        => esc_html__( 'Display Style', 'give' ),
138
-					'description' => esc_html__( 'Set how the donations levels will display on the form.', 'give' ),
139
-					'id'          => $prefix . 'display_style',
137
+					'name'        => esc_html__('Display Style', 'give'),
138
+					'description' => esc_html__('Set how the donations levels will display on the form.', 'give'),
139
+					'id'          => $prefix.'display_style',
140 140
 					'type'        => 'radio_inline',
141 141
 					'default'     => 'buttons',
142 142
 					'options'     => array(
143
-						'buttons'  => esc_html__( 'Buttons', 'give' ),
144
-						'radios'   => esc_html__( 'Radios', 'give' ),
145
-						'dropdown' => esc_html__( 'Dropdown', 'give' ),
143
+						'buttons'  => esc_html__('Buttons', 'give'),
144
+						'radios'   => esc_html__('Radios', 'give'),
145
+						'dropdown' => esc_html__('Dropdown', 'give'),
146 146
 					),
147 147
 				),
148 148
 				//Custom Amount
149 149
 				array(
150
-					'name'        => esc_html__( 'Custom Amount', 'give' ),
151
-					'description' => esc_html__( 'Do you want the user to be able to input their own donation amount?', 'give' ),
152
-					'id'          => $prefix . 'custom_amount',
150
+					'name'        => esc_html__('Custom Amount', 'give'),
151
+					'description' => esc_html__('Do you want the user to be able to input their own donation amount?', 'give'),
152
+					'id'          => $prefix.'custom_amount',
153 153
 					'type'        => 'radio_inline',
154 154
 					'default'     => 'no',
155 155
 					'options'     => array(
156
-						'yes' => esc_html__( 'Yes', 'give' ),
157
-						'no'  => esc_html__( 'No', 'give' ),
156
+						'yes' => esc_html__('Yes', 'give'),
157
+						'no'  => esc_html__('No', 'give'),
158 158
 					),
159 159
 				),
160 160
 				array(
161
-					'name'              => esc_html__( 'Custom Amount Minimum', 'give' ),
162
-					'description'       => esc_html__( 'If you would like to set a minimum custom donation amount please enter it here.', 'give' ),
163
-					'id'                => $prefix . 'custom_amount_minimum',
161
+					'name'              => esc_html__('Custom Amount Minimum', 'give'),
162
+					'description'       => esc_html__('If you would like to set a minimum custom donation amount please enter it here.', 'give'),
163
+					'id'                => $prefix.'custom_amount_minimum',
164 164
 					'type'              => 'text_small',
165 165
 					'row_classes'       => 'give-subfield',
166 166
 					'render_row_cb'     => 'give_cmb_amount_field_render_row_cb',
167 167
 					'sanitization_cb'   => 'give_sanitize_price_field_value',
168 168
 					'attributes'   => array(
169 169
 						'placeholder' => give_format_decimal('1.00'),
170
-						'value'       => give_format_decimal( $custom_amount_minimum ),
170
+						'value'       => give_format_decimal($custom_amount_minimum),
171 171
 						'class'       => 'cmb-type-text-small give-money-field',
172 172
 					)
173 173
 				),
174 174
 				array(
175
-					'name'        => esc_html__( 'Custom Amount Text', 'give' ),
176
-					'description' => esc_html__( 'This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give' ),
177
-					'id'          => $prefix . 'custom_amount_text',
175
+					'name'        => esc_html__('Custom Amount Text', 'give'),
176
+					'description' => esc_html__('This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give'),
177
+					'id'          => $prefix.'custom_amount_text',
178 178
 					'type'        => 'text',
179 179
 					'row_classes' => 'give-subfield',
180 180
 					'attributes'  => array(
181 181
 						'rows'        => 3,
182
-						'placeholder' => esc_attr__( 'Give a Custom Amount', 'give' ),
182
+						'placeholder' => esc_attr__('Give a Custom Amount', 'give'),
183 183
 					),
184 184
 				),
185 185
 				//Goals
186 186
 				array(
187
-					'name'        => esc_html__( 'Goal', 'give' ),
188
-					'description' => esc_html__( 'Do you want to set a donation goal for this form?', 'give' ),
189
-					'id'          => $prefix . 'goal_option',
187
+					'name'        => esc_html__('Goal', 'give'),
188
+					'description' => esc_html__('Do you want to set a donation goal for this form?', 'give'),
189
+					'id'          => $prefix.'goal_option',
190 190
 					'type'        => 'radio_inline',
191 191
 					'default'     => 'no',
192 192
 					'options'     => array(
193
-						'yes' => esc_html__( 'Yes', 'give' ),
194
-						'no'  => esc_html__( 'No', 'give' ),
193
+						'yes' => esc_html__('Yes', 'give'),
194
+						'no'  => esc_html__('No', 'give'),
195 195
 					),
196 196
 				),
197 197
 				array(
198
-					'name'              => esc_html__( 'Goal Amount', 'give' ),
199
-					'description'       => esc_html__( 'This is the monetary goal amount you want to reach for this donation form.', 'give' ),
200
-					'id'                => $prefix . 'set_goal',
198
+					'name'              => esc_html__('Goal Amount', 'give'),
199
+					'description'       => esc_html__('This is the monetary goal amount you want to reach for this donation form.', 'give'),
200
+					'id'                => $prefix.'set_goal',
201 201
 					'type'              => 'text_small',
202 202
 					'row_classes'       => 'give-subfield',
203 203
 					'render_row_cb' 	=> 'give_cmb_amount_field_render_row_cb',
204 204
 					'sanitization_cb'   => 'give_sanitize_price_field_value',
205 205
 					'attributes'        => array(
206
-						'placeholder' => give_format_decimal( '0.00' ),
207
-						'value'       => give_format_decimal( $goal ),
206
+						'placeholder' => give_format_decimal('0.00'),
207
+						'value'       => give_format_decimal($goal),
208 208
 						'class'       => 'cmb-type-text-small give-money-field',
209 209
 					),
210 210
 				),
211 211
 
212 212
 				array(
213
-					'name'        => esc_html__( 'Goal Format', 'give' ),
214
-					'description' => esc_html__( 'Would you like to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded".', 'give' ),
215
-					'id'          => $prefix . 'goal_format',
213
+					'name'        => esc_html__('Goal Format', 'give'),
214
+					'description' => esc_html__('Would you like to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded".', 'give'),
215
+					'id'          => $prefix.'goal_format',
216 216
 					'type'        => 'radio_inline',
217 217
 					'default'     => 'amount',
218 218
 					'row_classes' => 'give-subfield',
219 219
 					'options'     => array(
220
-						'amount'     => esc_html__( 'Amount', 'give' ),
221
-						'percentage' => esc_html__( 'Percentage', 'give' ),
220
+						'amount'     => esc_html__('Amount', 'give'),
221
+						'percentage' => esc_html__('Percentage', 'give'),
222 222
 					),
223 223
 				),
224 224
 				array(
225
-					'name'        => esc_html__( 'Goal Progress Bar Color', 'give' ),
226
-					'id'          => $prefix . 'goal_color',
225
+					'name'        => esc_html__('Goal Progress Bar Color', 'give'),
226
+					'id'          => $prefix.'goal_color',
227 227
 					'type'        => 'colorpicker',
228 228
 					'row_classes' => 'give-subfield',
229 229
 					'default'     => '#2bc253',
230 230
 				),
231 231
 
232 232
 				array(
233
-					'name'        => esc_html__( 'Close Form when Goal Achieved', 'give' ),
234
-					'desc'        => esc_html__( 'Would you like to close the donation forms and stop accepting donations once this goal has been met?', 'give' ),
235
-					'id'          => $prefix . 'close_form_when_goal_achieved',
233
+					'name'        => esc_html__('Close Form when Goal Achieved', 'give'),
234
+					'desc'        => esc_html__('Would you like to close the donation forms and stop accepting donations once this goal has been met?', 'give'),
235
+					'id'          => $prefix.'close_form_when_goal_achieved',
236 236
 					'type'        => 'radio_inline',
237 237
 					'row_classes' => 'give-subfield',
238 238
 					'options'     => array(
239
-						'yes' => esc_html__( 'Yes', 'give' ),
240
-						'no'  => esc_html__( 'No', 'give' ),
239
+						'yes' => esc_html__('Yes', 'give'),
240
+						'no'  => esc_html__('No', 'give'),
241 241
 					),
242 242
 					'default'     => 'no',
243 243
 				),
244 244
 				array(
245
-					'name'        => esc_html__( 'Goal Achieved Message', 'give' ),
246
-					'desc'        => esc_html__( 'Would you like to display a custom message when the goal is closed? If none is provided the default message will be displayed', 'give' ),
247
-					'id'          => $prefix . 'form_goal_achieved_message',
245
+					'name'        => esc_html__('Goal Achieved Message', 'give'),
246
+					'desc'        => esc_html__('Would you like to display a custom message when the goal is closed? If none is provided the default message will be displayed', 'give'),
247
+					'id'          => $prefix.'form_goal_achieved_message',
248 248
 					'type'        => 'textarea',
249 249
 					'row_classes' => 'give-subfield',
250 250
 					'attributes'  => array(
251
-						'placeholder' => esc_attr__( 'Thank you to all our donors, we have met our fundraising goal.', 'give' ),
251
+						'placeholder' => esc_attr__('Thank you to all our donors, we have met our fundraising goal.', 'give'),
252 252
 					),
253 253
 				)
254 254
 			)
255 255
 		)
256
-	) );
256
+	));
257 257
 
258 258
 
259 259
 	/**
260 260
 	 * Content Field
261 261
 	 */
262
-	$meta_boxes['form_content_options'] = apply_filters( 'give_forms_content_options', array(
262
+	$meta_boxes['form_content_options'] = apply_filters('give_forms_content_options', array(
263 263
 		'id'           => 'form_content_options',
264
-		'title'        => esc_html__( 'Form Content', 'give' ),
265
-		'object_types' => array( 'give_forms' ),
264
+		'title'        => esc_html__('Form Content', 'give'),
265
+		'object_types' => array('give_forms'),
266 266
 		'context'      => 'normal',
267 267
 		'priority'     => 'high', //Show above Content WYSIWYG
268
-		'fields'       => apply_filters( 'give_forms_content_options_metabox_fields', array(
268
+		'fields'       => apply_filters('give_forms_content_options_metabox_fields', array(
269 269
 				//Donation Option
270 270
 				array(
271
-					'name'        => esc_html__( 'Display Content', 'give' ),
272
-					'description' => esc_html__( 'Do you want to display content? If you choose to display content, a WYSIWYG editor will appear which you will be able to enter content.', 'give' ),
273
-					'id'          => $prefix . 'content_option',
271
+					'name'        => esc_html__('Display Content', 'give'),
272
+					'description' => esc_html__('Do you want to display content? If you choose to display content, a WYSIWYG editor will appear which you will be able to enter content.', 'give'),
273
+					'id'          => $prefix.'content_option',
274 274
 					'type'        => 'select',
275
-					'options'     => apply_filters( 'give_forms_content_options_select', array(
276
-							'none'           => esc_html__( 'No Content', 'give' ),
277
-							'give_pre_form'  => esc_html__( 'Display content ABOVE the fields', 'give' ),
278
-							'give_post_form' => esc_html__( 'Display content BELOW the fields', 'give' ),
275
+					'options'     => apply_filters('give_forms_content_options_select', array(
276
+							'none'           => esc_html__('No Content', 'give'),
277
+							'give_pre_form'  => esc_html__('Display content ABOVE the fields', 'give'),
278
+							'give_post_form' => esc_html__('Display content BELOW the fields', 'give'),
279 279
 						)
280 280
 					),
281 281
 					'default'     => 'none',
282 282
 				),
283 283
 				array(
284
-					'name'        => esc_html__( 'Content', 'give' ),
285
-					'description' => esc_html__( 'This content will display on the single give form page.', 'give' ),
286
-					'id'          => $prefix . 'form_content',
284
+					'name'        => esc_html__('Content', 'give'),
285
+					'description' => esc_html__('This content will display on the single give form page.', 'give'),
286
+					'id'          => $prefix.'form_content',
287 287
 					'row_classes' => 'give-subfield',
288 288
 					'type'        => 'wysiwyg'
289 289
 				),
290 290
 			)
291 291
 		)
292
-	) );
292
+	));
293 293
 
294 294
 
295 295
 	/**
296 296
 	 * Display Options
297 297
 	 */
298
-	$meta_boxes['form_display_options'] = apply_filters( 'give_form_display_options', array(
298
+	$meta_boxes['form_display_options'] = apply_filters('give_form_display_options', array(
299 299
 			'id'           => 'form_display_options',
300
-			'title'        => esc_html__( 'Form Display Options', 'give' ),
301
-			'object_types' => array( 'give_forms' ),
300
+			'title'        => esc_html__('Form Display Options', 'give'),
301
+			'object_types' => array('give_forms'),
302 302
 			'context'      => 'normal', //  'normal', 'advanced', or 'side'
303 303
 			'priority'     => 'high', //Show above Content WYSIWYG
304 304
 			'show_names'   => true, // Show field names on the left
305
-			'fields'       => apply_filters( 'give_forms_display_options_metabox_fields', array(
305
+			'fields'       => apply_filters('give_forms_display_options_metabox_fields', array(
306 306
 					array(
307
-						'name'    => esc_html__( 'Payment Fields', 'give' ),
308
-						'desc'    => esc_html__( 'How would you like to display donation information for this form? The "Show on Page" option will display the entire form when the page loads. "Reveal Upon Click" places a button below the donation fields and upon click slides into view the rest of the fields. "Modal Window Upon Click" is a similar option, rather than sliding into view the fields they will open in a shadow box or "modal" window.', 'give' ),
309
-						'id'      => $prefix . 'payment_display',
307
+						'name'    => esc_html__('Payment Fields', 'give'),
308
+						'desc'    => esc_html__('How would you like to display donation information for this form? The "Show on Page" option will display the entire form when the page loads. "Reveal Upon Click" places a button below the donation fields and upon click slides into view the rest of the fields. "Modal Window Upon Click" is a similar option, rather than sliding into view the fields they will open in a shadow box or "modal" window.', 'give'),
309
+						'id'      => $prefix.'payment_display',
310 310
 						'type'    => 'select',
311 311
 						'options' => array(
312
-							'onpage' => esc_html__( 'Show on Page', 'give' ),
313
-							'reveal' => esc_html__( 'Reveal Upon Click', 'give' ),
314
-							'modal'  => esc_html__( 'Modal Window Upon Click', 'give' ),
312
+							'onpage' => esc_html__('Show on Page', 'give'),
313
+							'reveal' => esc_html__('Reveal Upon Click', 'give'),
314
+							'modal'  => esc_html__('Modal Window Upon Click', 'give'),
315 315
 						),
316 316
 						'default' => 'onpage',
317 317
 					),
318 318
 					array(
319
-						'id'          => $prefix . 'reveal_label',
320
-						'name'        => esc_html__( 'Reveal / Modal Open Text', 'give' ),
321
-						'desc'        => esc_html__( 'The button label for completing the donation.', 'give' ),
319
+						'id'          => $prefix.'reveal_label',
320
+						'name'        => esc_html__('Reveal / Modal Open Text', 'give'),
321
+						'desc'        => esc_html__('The button label for completing the donation.', 'give'),
322 322
 						'type'        => 'text_small',
323 323
 						'row_classes' => 'give-subfield',
324 324
 						'attributes'  => array(
325
-							'placeholder' => esc_attr__( 'Donate Now', 'give' ),
325
+							'placeholder' => esc_attr__('Donate Now', 'give'),
326 326
 						),
327 327
 					),
328 328
 					array(
329
-						'id'         => $prefix . 'checkout_label',
330
-						'name'       => esc_html__( 'Complete Donation Text', 'give' ),
331
-						'desc'       => esc_html__( 'The button label for completing a donation.', 'give' ),
329
+						'id'         => $prefix.'checkout_label',
330
+						'name'       => esc_html__('Complete Donation Text', 'give'),
331
+						'desc'       => esc_html__('The button label for completing a donation.', 'give'),
332 332
 						'type'       => 'text_small',
333 333
 						'attributes' => array(
334
-							'placeholder' => esc_html__( 'Donate Now', 'give' ),
334
+							'placeholder' => esc_html__('Donate Now', 'give'),
335 335
 						),
336 336
 					),
337 337
 					array(
338
-						'name' => esc_html__( 'Default Gateway', 'give' ),
339
-						'desc' => esc_html__( 'By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give' ),
340
-						'id'   => $prefix . 'default_gateway',
338
+						'name' => esc_html__('Default Gateway', 'give'),
339
+						'desc' => esc_html__('By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give'),
340
+						'id'   => $prefix.'default_gateway',
341 341
 						'type' => 'default_gateway'
342 342
 					),
343 343
 					array(
344
-						'name' => esc_html__( 'Disable Guest Donations', 'give' ),
345
-						'desc' => esc_html__( 'Do you want to require users be logged-in to make donations?', 'give' ),
346
-						'id'   => $prefix . 'logged_in_only',
344
+						'name' => esc_html__('Disable Guest Donations', 'give'),
345
+						'desc' => esc_html__('Do you want to require users be logged-in to make donations?', 'give'),
346
+						'id'   => $prefix.'logged_in_only',
347 347
 						'type' => 'checkbox'
348 348
 					),
349 349
 					array(
350
-						'name'    => esc_html__( 'Register / Login Form', 'give' ),
351
-						'desc'    => esc_html__( 'Display the registration and login forms in the payment section for non-logged-in users.', 'give' ),
352
-						'id'      => $prefix . 'show_register_form',
350
+						'name'    => esc_html__('Register / Login Form', 'give'),
351
+						'desc'    => esc_html__('Display the registration and login forms in the payment section for non-logged-in users.', 'give'),
352
+						'id'      => $prefix.'show_register_form',
353 353
 						'type'    => 'select',
354 354
 						'options' => array(
355
-							'both'         => esc_html__( 'Registration and Login Forms', 'give' ),
356
-							'registration' => esc_html__( 'Registration Form Only', 'give' ),
357
-							'login'        => esc_html__( 'Login Form Only', 'give' ),
358
-							'none'         => esc_html__( 'None', 'give' ),
355
+							'both'         => esc_html__('Registration and Login Forms', 'give'),
356
+							'registration' => esc_html__('Registration Form Only', 'give'),
357
+							'login'        => esc_html__('Login Form Only', 'give'),
358
+							'none'         => esc_html__('None', 'give'),
359 359
 						),
360 360
 						'default' => 'none',
361 361
 					),
362 362
 					array(
363
-						'name'    => esc_html__( 'Floating Labels', 'give' ),
363
+						'name'    => esc_html__('Floating Labels', 'give'),
364 364
 						/* translators: %s: forms https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels */
365
-						'desc'    => sprintf( __( 'Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form.<br>Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give' ), esc_url( 'https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels' ) ),
366
-						'id'      => $prefix . 'form_floating_labels',
365
+						'desc'    => sprintf(__('Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form.<br>Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give'), esc_url('https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels')),
366
+						'id'      => $prefix.'form_floating_labels',
367 367
 						'type'    => 'select',
368 368
 						'options' => array(
369
-							''         => esc_html__( 'Use the global setting', 'give' ),
370
-							'enabled'  => esc_html__( 'Enabled', 'give' ),
371
-							'disabled' => esc_html__( 'Disabled', 'give' ),
369
+							''         => esc_html__('Use the global setting', 'give'),
370
+							'enabled'  => esc_html__('Enabled', 'give'),
371
+							'disabled' => esc_html__('Disabled', 'give'),
372 372
 						),
373 373
 						'default' => 'none',
374 374
 					)
@@ -380,47 +380,47 @@  discard block
 block discarded – undo
380 380
 	/**
381 381
 	 * Terms & Conditions
382 382
 	 */
383
-	$meta_boxes['form_terms_options'] = apply_filters( 'give_forms_terms_options', array(
383
+	$meta_boxes['form_terms_options'] = apply_filters('give_forms_terms_options', array(
384 384
 		'id'           => 'form_terms_options',
385
-		'title'        => esc_html__( 'Terms and Conditions', 'give' ),
386
-		'object_types' => array( 'give_forms' ),
385
+		'title'        => esc_html__('Terms and Conditions', 'give'),
386
+		'object_types' => array('give_forms'),
387 387
 		'context'      => 'normal',
388 388
 		'priority'     => 'high', //Show above Content WYSIWYG
389
-		'fields'       => apply_filters( 'give_forms_terms_options_metabox_fields', array(
389
+		'fields'       => apply_filters('give_forms_terms_options_metabox_fields', array(
390 390
 				//Donation Option
391 391
 				array(
392
-					'name'        => esc_html__( 'Terms and Conditions', 'give' ),
393
-					'description' => esc_html__( 'Do you want to require the user to agree to terms and conditions prior to being able to complete their donation?', 'give' ),
394
-					'id'          => $prefix . 'terms_option',
392
+					'name'        => esc_html__('Terms and Conditions', 'give'),
393
+					'description' => esc_html__('Do you want to require the user to agree to terms and conditions prior to being able to complete their donation?', 'give'),
394
+					'id'          => $prefix.'terms_option',
395 395
 					'type'        => 'select',
396
-					'options'     => apply_filters( 'give_forms_content_options_select', array(
397
-							'none' => esc_html__( 'No', 'give' ),
398
-							'yes'  => esc_html__( 'Yes', 'give' ),
396
+					'options'     => apply_filters('give_forms_content_options_select', array(
397
+							'none' => esc_html__('No', 'give'),
398
+							'yes'  => esc_html__('Yes', 'give'),
399 399
 						)
400 400
 					),
401 401
 					'default'     => 'none',
402 402
 				),
403 403
 				array(
404
-					'id'          => $prefix . 'agree_label',
405
-					'name'        => esc_html__( 'Agree to Terms Label', 'give' ),
406
-					'desc'        => esc_html__( 'The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give' ),
404
+					'id'          => $prefix.'agree_label',
405
+					'name'        => esc_html__('Agree to Terms Label', 'give'),
406
+					'desc'        => esc_html__('The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give'),
407 407
 					'type'        => 'text',
408 408
 					'row_classes' => 'give-subfield',
409 409
 					'size'        => 'regular',
410 410
 					'attributes'  => array(
411
-						'placeholder' => esc_attr__( 'Agree to Terms?', 'give' ),
411
+						'placeholder' => esc_attr__('Agree to Terms?', 'give'),
412 412
 					),
413 413
 				),
414 414
 				array(
415
-					'id'          => $prefix . 'agree_text',
415
+					'id'          => $prefix.'agree_text',
416 416
 					'row_classes' => 'give-subfield',
417
-					'name'        => esc_html__( 'Agreement Text', 'give' ),
418
-					'desc'        => esc_html__( 'This is the actual text which the user will have to agree to in order to make a donation.', 'give' ),
417
+					'name'        => esc_html__('Agreement Text', 'give'),
418
+					'desc'        => esc_html__('This is the actual text which the user will have to agree to in order to make a donation.', 'give'),
419 419
 					'type'        => 'wysiwyg'
420 420
 				),
421 421
 			)
422 422
 		)
423
-	) );
423
+	));
424 424
 
425 425
 	return $meta_boxes;
426 426
 
@@ -434,9 +434,9 @@  discard block
 block discarded – undo
434 434
 
435 435
 	<div class="table-container">
436 436
 		<div class="table-row">
437
-			<div class="table-cell col-amount"><?php esc_html_e( 'Amount', 'give' ); ?></div>
438
-			<div class="table-cell col-text"><?php esc_html_e( 'Text', 'give' ); ?></div>
439
-			<div class="table-cell col-default"><?php esc_html_e( 'Default', 'give' ); ?></div>
437
+			<div class="table-cell col-amount"><?php esc_html_e('Amount', 'give'); ?></div>
438
+			<div class="table-cell col-text"><?php esc_html_e('Text', 'give'); ?></div>
439
+			<div class="table-cell col-default"><?php esc_html_e('Default', 'give'); ?></div>
440 440
 			<?php
441 441
 			/**
442 442
 			 * Fires in repeatable donation levels table head.
@@ -448,9 +448,9 @@  discard block
 block discarded – undo
448 448
 			 *
449 449
 			 * @since 1.0
450 450
 			 */
451
-			do_action( 'give_donation_levels_table_head' );
451
+			do_action('give_donation_levels_table_head');
452 452
 			?>
453
-			<div class="table-cell col-sort"><?php esc_html_e( 'Sort', 'give' ); ?></div>
453
+			<div class="table-cell col-sort"><?php esc_html_e('Sort', 'give'); ?></div>
454 454
 
455 455
 		</div>
456 456
 	</div>
@@ -458,7 +458,7 @@  discard block
 block discarded – undo
458 458
 	<?php
459 459
 }
460 460
 
461
-add_action( 'cmb2_render_levels_repeater_header', 'give_cmb_render_levels_repeater_header', 10 );
461
+add_action('cmb2_render_levels_repeater_header', 'give_cmb_render_levels_repeater_header', 10);
462 462
 
463 463
 
464 464
 /**
@@ -475,25 +475,25 @@  discard block
 block discarded – undo
475 475
  * @param $object_type
476 476
  * @param $field_type_object
477 477
  */
478
-function give_cmb_render_levels_id( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
478
+function give_cmb_render_levels_id($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
479 479
 
480
-	$escaped_value = ( isset( $escaped_value['level_id'] ) ? $escaped_value['level_id'] : '' );
480
+	$escaped_value = (isset($escaped_value['level_id']) ? $escaped_value['level_id'] : '');
481 481
 
482 482
 	$field_options_array = array(
483 483
 		'class' => 'give-hidden give-level-id-input',
484
-		'name'  => $field_type_object->_name( '[level_id]' ),
485
-		'id'    => $field_type_object->_id( '_level_id' ),
484
+		'name'  => $field_type_object->_name('[level_id]'),
485
+		'id'    => $field_type_object->_id('_level_id'),
486 486
 		'value' => $escaped_value,
487 487
 		'type'  => 'number',
488 488
 		'desc'  => '',
489 489
 	);
490 490
 
491
-	echo '<p class="give-level-id">' . $escaped_value . '</p>';
492
-	echo $field_type_object->input( $field_options_array );
491
+	echo '<p class="give-level-id">'.$escaped_value.'</p>';
492
+	echo $field_type_object->input($field_options_array);
493 493
 
494 494
 }
495 495
 
496
-add_action( 'cmb2_render_levels_id', 'give_cmb_render_levels_id', 10, 5 );
496
+add_action('cmb2_render_levels_id', 'give_cmb_render_levels_id', 10, 5);
497 497
 
498 498
 
499 499
 /**
@@ -505,13 +505,13 @@  discard block
 block discarded – undo
505 505
  * @param $object_type
506 506
  * @param $field_type_object
507 507
  */
508
-function give_cmb_give_default_radio_inline( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
509
-	echo '<input type="radio" class="cmb2-option donation-level-radio" name="' . $field_object->args['_name'] . '" id="' . $field_object->args['id'] . '" value="default" ' . checked( 'default', $escaped_value, false ) . '>';
510
-	echo '<label for="' . $field_object->args['id'] . '">' . esc_html__( 'Default', 'give' ) . '</label>';
508
+function give_cmb_give_default_radio_inline($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
509
+	echo '<input type="radio" class="cmb2-option donation-level-radio" name="'.$field_object->args['_name'].'" id="'.$field_object->args['id'].'" value="default" '.checked('default', $escaped_value, false).'>';
510
+	echo '<label for="'.$field_object->args['id'].'">'.esc_html__('Default', 'give').'</label>';
511 511
 
512 512
 }
513 513
 
514
-add_action( 'cmb2_render_give_default_radio_inline', 'give_cmb_give_default_radio_inline', 10, 5 );
514
+add_action('cmb2_render_give_default_radio_inline', 'give_cmb_give_default_radio_inline', 10, 5);
515 515
 
516 516
 
517 517
 /**
@@ -521,20 +521,20 @@  discard block
 block discarded – undo
521 521
  */
522 522
 function give_add_shortcode_to_publish_metabox() {
523 523
 
524
-	if ( 'give_forms' !== get_post_type() ) {
524
+	if ('give_forms' !== get_post_type()) {
525 525
 		return false;
526 526
 	}
527 527
 
528 528
 	global $post;
529 529
 
530 530
 	//Only enqueue scripts for CPT on post type screen
531
-	if ( 'give_forms' === $post->post_type ) {
531
+	if ('give_forms' === $post->post_type) {
532 532
 		//Shortcode column with select all input
533
-		$shortcode = htmlentities( '[give_form id="' . $post->ID . '"]' );
534
-		echo '<div class="shortcode-wrap box-sizing"><label for="shortcode-input">' . esc_html__( 'Give Form Shortcode:', 'give' ) . '</label><input onClick="this.setSelectionRange(0, this.value.length)" type="text" name="shortcode-input" id="shortcode-input" class="shortcode-input" readonly value="' . $shortcode . '"></div>';
533
+		$shortcode = htmlentities('[give_form id="'.$post->ID.'"]');
534
+		echo '<div class="shortcode-wrap box-sizing"><label for="shortcode-input">'.esc_html__('Give Form Shortcode:', 'give').'</label><input onClick="this.setSelectionRange(0, this.value.length)" type="text" name="shortcode-input" id="shortcode-input" class="shortcode-input" readonly value="'.$shortcode.'"></div>';
535 535
 
536 536
 	}
537 537
 
538 538
 }
539 539
 
540
-add_action( 'post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox' );
540
+add_action('post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox');
Please login to merge, or discard this patch.
includes/emails/class-give-emails.php 1 patch
Spacing   +58 added lines, -58 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
 
@@ -79,12 +79,12 @@  discard block
 block discarded – undo
79 79
 	 */
80 80
 	public function __construct() {
81 81
 
82
-		if ( 'none' === $this->get_template() ) {
82
+		if ('none' === $this->get_template()) {
83 83
 			$this->html = false;
84 84
 		}
85 85
 
86
-		add_action( 'give_email_send_before', array( $this, 'send_before' ) );
87
-		add_action( 'give_email_send_after', array( $this, 'send_after' ) );
86
+		add_action('give_email_send_before', array($this, 'send_before'));
87
+		add_action('give_email_send_after', array($this, 'send_after'));
88 88
 
89 89
 	}
90 90
 
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 	 *
94 94
 	 * @since 1.0
95 95
 	 */
96
-	public function __set( $key, $value ) {
96
+	public function __set($key, $value) {
97 97
 		$this->$key = $value;
98 98
 	}
99 99
 
@@ -103,11 +103,11 @@  discard block
 block discarded – undo
103 103
 	 * @since 1.0
104 104
 	 */
105 105
 	public function get_from_name() {
106
-		if ( ! $this->from_name ) {
107
-			$this->from_name = give_get_option( 'from_name', get_bloginfo( 'name' ) );
106
+		if ( ! $this->from_name) {
107
+			$this->from_name = give_get_option('from_name', get_bloginfo('name'));
108 108
 		}
109 109
 
110
-		return apply_filters( 'give_email_from_name', wp_specialchars_decode( $this->from_name ), $this );
110
+		return apply_filters('give_email_from_name', wp_specialchars_decode($this->from_name), $this);
111 111
 	}
112 112
 
113 113
 	/**
@@ -116,11 +116,11 @@  discard block
 block discarded – undo
116 116
 	 * @since 1.0
117 117
 	 */
118 118
 	public function get_from_address() {
119
-		if ( ! $this->from_address ) {
120
-			$this->from_address = give_get_option( 'from_email', get_option( 'admin_email' ) );
119
+		if ( ! $this->from_address) {
120
+			$this->from_address = give_get_option('from_email', get_option('admin_email'));
121 121
 		}
122 122
 
123
-		return apply_filters( 'give_email_from_address', $this->from_address, $this );
123
+		return apply_filters('give_email_from_address', $this->from_address, $this);
124 124
 	}
125 125
 
126 126
 	/**
@@ -129,13 +129,13 @@  discard block
 block discarded – undo
129 129
 	 * @since 1.0
130 130
 	 */
131 131
 	public function get_content_type() {
132
-		if ( ! $this->content_type && $this->html ) {
133
-			$this->content_type = apply_filters( 'give_email_default_content_type', 'text/html', $this );
134
-		} else if ( ! $this->html ) {
132
+		if ( ! $this->content_type && $this->html) {
133
+			$this->content_type = apply_filters('give_email_default_content_type', 'text/html', $this);
134
+		} else if ( ! $this->html) {
135 135
 			$this->content_type = 'text/plain';
136 136
 		}
137 137
 
138
-		return apply_filters( 'give_email_content_type', $this->content_type, $this );
138
+		return apply_filters('give_email_content_type', $this->content_type, $this);
139 139
 	}
140 140
 
141 141
 	/**
@@ -144,13 +144,13 @@  discard block
 block discarded – undo
144 144
 	 * @since 1.0
145 145
 	 */
146 146
 	public function get_headers() {
147
-		if ( ! $this->headers ) {
147
+		if ( ! $this->headers) {
148 148
 			$this->headers = "From: {$this->get_from_name()} <{$this->get_from_address()}>\r\n";
149 149
 			$this->headers .= "Reply-To: {$this->get_from_address()}\r\n";
150 150
 			$this->headers .= "Content-Type: {$this->get_content_type()}; charset=utf-8\r\n";
151 151
 		}
152 152
 
153
-		return apply_filters( 'give_email_headers', $this->headers, $this );
153
+		return apply_filters('give_email_headers', $this->headers, $this);
154 154
 	}
155 155
 
156 156
 	/**
@@ -160,11 +160,11 @@  discard block
 block discarded – undo
160 160
 	 */
161 161
 	public function get_templates() {
162 162
 		$templates = array(
163
-			'default' => esc_html__( 'Default Template', 'give' ),
164
-			'none'    => esc_html__( 'No template, plain text only', 'give' )
163
+			'default' => esc_html__('Default Template', 'give'),
164
+			'none'    => esc_html__('No template, plain text only', 'give')
165 165
 		);
166 166
 
167
-		return apply_filters( 'give_email_templates', $templates );
167
+		return apply_filters('give_email_templates', $templates);
168 168
 	}
169 169
 
170 170
 	/**
@@ -173,11 +173,11 @@  discard block
 block discarded – undo
173 173
 	 * @since 1.0
174 174
 	 */
175 175
 	public function get_template() {
176
-		if ( ! $this->template ) {
177
-			$this->template = give_get_option( 'email_template', 'default' );
176
+		if ( ! $this->template) {
177
+			$this->template = give_get_option('email_template', 'default');
178 178
 		}
179 179
 
180
-		return apply_filters( 'give_email_template', $this->template );
180
+		return apply_filters('give_email_template', $this->template);
181 181
 	}
182 182
 
183 183
 	/**
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 	 * @since 1.0
187 187
 	 */
188 188
 	public function get_heading() {
189
-		return apply_filters( 'give_email_heading', $this->heading );
189
+		return apply_filters('give_email_heading', $this->heading);
190 190
 	}
191 191
 
192 192
 	/**
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 	 *
197 197
 	 * @return mixed
198 198
 	 */
199
-	public function parse_tags( $content ) {
199
+	public function parse_tags($content) {
200 200
 		return $content;
201 201
 	}
202 202
 
@@ -205,19 +205,19 @@  discard block
 block discarded – undo
205 205
 	 *
206 206
 	 * @since 1.0
207 207
 	 */
208
-	public function build_email( $message ) {
208
+	public function build_email($message) {
209 209
 
210
-		if ( false === $this->html ) {
211
-			return apply_filters( 'give_email_message', wp_strip_all_tags( $message ), $this );
210
+		if (false === $this->html) {
211
+			return apply_filters('give_email_message', wp_strip_all_tags($message), $this);
212 212
 		}
213 213
 
214
-		$message = $this->text_to_html( $message );
214
+		$message = $this->text_to_html($message);
215 215
 
216 216
 		$template = $this->get_template();
217 217
 
218 218
 		ob_start();
219 219
 
220
-		give_get_template_part( 'emails/header', $template, true );
220
+		give_get_template_part('emails/header', $template, true);
221 221
 
222 222
 		/**
223 223
 		 * Fires in the email head.
@@ -226,17 +226,17 @@  discard block
 block discarded – undo
226 226
 		 *
227 227
 		 * @param Give_Emails $this The email object.
228 228
 		 */
229
-		do_action( 'give_email_header', $this );
229
+		do_action('give_email_header', $this);
230 230
 
231
-		if ( has_action( 'give_email_template_' . $template ) ) {
231
+		if (has_action('give_email_template_'.$template)) {
232 232
 			/**
233 233
 			 * Fires in a specific email template.
234 234
 			 *
235 235
 			 * @since 1.0
236 236
 			 */
237
-			do_action( "give_email_template_{$template}" );
237
+			do_action("give_email_template_{$template}");
238 238
 		} else {
239
-			give_get_template_part( 'emails/body', $template, true );
239
+			give_get_template_part('emails/body', $template, true);
240 240
 		}
241 241
 
242 242
 		/**
@@ -246,9 +246,9 @@  discard block
 block discarded – undo
246 246
 		 *
247 247
 		 * @param Give_Emails $this The email object.
248 248
 		 */
249
-		do_action( 'give_email_body', $this );
249
+		do_action('give_email_body', $this);
250 250
 
251
-		give_get_template_part( 'emails/footer', $template, true );
251
+		give_get_template_part('emails/footer', $template, true);
252 252
 
253 253
 		/**
254 254
 		 * Fires in the email footer.
@@ -257,12 +257,12 @@  discard block
 block discarded – undo
257 257
 		 *
258 258
 		 * @param Give_Emails $this The email object.
259 259
 		 */
260
-		do_action( 'give_email_footer', $this );
260
+		do_action('give_email_footer', $this);
261 261
 
262 262
 		$body    = ob_get_clean();
263
-		$message = str_replace( '{email}', $message, $body );
263
+		$message = str_replace('{email}', $message, $body);
264 264
 
265
-		return apply_filters( 'give_email_message', $message, $this );
265
+		return apply_filters('give_email_message', $message, $this);
266 266
 	}
267 267
 
268 268
 	/**
@@ -275,10 +275,10 @@  discard block
 block discarded – undo
275 275
 	 *
276 276
 	 * @return bool
277 277
 	 */
278
-	public function send( $to, $subject, $message, $attachments = '' ) {
278
+	public function send($to, $subject, $message, $attachments = '') {
279 279
 
280
-		if ( ! did_action( 'init' ) && ! did_action( 'admin_init' ) ) {
281
-			_doing_it_wrong( __FUNCTION__, esc_html__( 'You cannot send email with Give_Emails until init/admin_init has been reached.', 'give' ), null );
280
+		if ( ! did_action('init') && ! did_action('admin_init')) {
281
+			_doing_it_wrong(__FUNCTION__, esc_html__('You cannot send email with Give_Emails until init/admin_init has been reached.', 'give'), null);
282 282
 
283 283
 			return false;
284 284
 		}
@@ -290,16 +290,16 @@  discard block
 block discarded – undo
290 290
 		 *
291 291
 		 * @param Give_Emails $this The email object.
292 292
 		 */
293
-		do_action( 'give_email_send_before', $this );
293
+		do_action('give_email_send_before', $this);
294 294
 
295
-		$subject = $this->parse_tags( $subject );
296
-		$message = $this->parse_tags( $message );
295
+		$subject = $this->parse_tags($subject);
296
+		$message = $this->parse_tags($message);
297 297
 
298
-		$message = $this->build_email( $message );
298
+		$message = $this->build_email($message);
299 299
 
300
-		$attachments = apply_filters( 'give_email_attachments', $attachments, $this );
300
+		$attachments = apply_filters('give_email_attachments', $attachments, $this);
301 301
 
302
-		$sent = wp_mail( $to, $subject, $message, $this->get_headers(), $attachments );
302
+		$sent = wp_mail($to, $subject, $message, $this->get_headers(), $attachments);
303 303
 
304 304
 		/**
305 305
 		 * Fires after sending an email.
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
 		 *
309 309
 		 * @param Give_Emails $this The email object.
310 310
 		 */
311
-		do_action( 'give_email_send_after', $this );
311
+		do_action('give_email_send_after', $this);
312 312
 
313 313
 		return $sent;
314 314
 
@@ -320,9 +320,9 @@  discard block
 block discarded – undo
320 320
 	 * @since 1.0
321 321
 	 */
322 322
 	public function send_before() {
323
-		add_filter( 'wp_mail_from', array( $this, 'get_from_address' ) );
324
-		add_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ) );
325
-		add_filter( 'wp_mail_content_type', array( $this, 'get_content_type' ) );
323
+		add_filter('wp_mail_from', array($this, 'get_from_address'));
324
+		add_filter('wp_mail_from_name', array($this, 'get_from_name'));
325
+		add_filter('wp_mail_content_type', array($this, 'get_content_type'));
326 326
 	}
327 327
 
328 328
 	/**
@@ -331,9 +331,9 @@  discard block
 block discarded – undo
331 331
 	 * @since 1.0
332 332
 	 */
333 333
 	public function send_after() {
334
-		remove_filter( 'wp_mail_from', array( $this, 'get_from_address' ) );
335
-		remove_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ) );
336
-		remove_filter( 'wp_mail_content_type', array( $this, 'get_content_type' ) );
334
+		remove_filter('wp_mail_from', array($this, 'get_from_address'));
335
+		remove_filter('wp_mail_from_name', array($this, 'get_from_name'));
336
+		remove_filter('wp_mail_content_type', array($this, 'get_content_type'));
337 337
 
338 338
 		// Reset heading to an empty string
339 339
 		$this->heading = '';
@@ -344,10 +344,10 @@  discard block
 block discarded – undo
344 344
 	 *
345 345
 	 * @since 1.0
346 346
 	 */
347
-	public function text_to_html( $message ) {
347
+	public function text_to_html($message) {
348 348
 
349
-		if ( 'text/html' == $this->content_type || true === $this->html ) {
350
-			$message = wpautop( $message );
349
+		if ('text/html' == $this->content_type || true === $this->html) {
350
+			$message = wpautop($message);
351 351
 		}
352 352
 
353 353
 		return $message;
Please login to merge, or discard this patch.