Passed
Push — master ( fbe222...6a1205 )
by Brian
04:23
created
includes/admin/register-settings.php 1 patch
Indentation   +301 added lines, -301 removed lines patch added patch discarded remove patch
@@ -195,13 +195,13 @@  discard block
 block discarded – undo
195 195
     $name       = isset( $option['name'] ) ? $option['name'] : '';
196 196
     $cb         = "wpinv_{$option['type']}_callback";
197 197
     $section    = "wpinv_settings_{$tab}_$section";
198
-	$is_wizzard = is_admin() && isset( $_GET['page'] ) && 'gp-setup' == $_GET['page'];
198
+    $is_wizzard = is_admin() && isset( $_GET['page'] ) && 'gp-setup' == $_GET['page'];
199 199
 
200
-	if ( isset( $option['desc'] ) && ( ! $is_wizzard && ! empty( $option['help-tip'] ) ) ) {
201
-		$tip   = wpinv_clean( $option['desc'] );
202
-		$name .= "<span class='dashicons dashicons-editor-help wpi-help-tip' title='$tip'></span>";
203
-		unset( $option['desc'] );
204
-	}
200
+    if ( isset( $option['desc'] ) && ( ! $is_wizzard && ! empty( $option['help-tip'] ) ) ) {
201
+        $tip   = wpinv_clean( $option['desc'] );
202
+        $name .= "<span class='dashicons dashicons-editor-help wpi-help-tip' title='$tip'></span>";
203
+        unset( $option['desc'] );
204
+    }
205 205
 
206 206
     // Loop through all tabs.
207 207
     add_settings_field(
@@ -228,9 +228,9 @@  discard block
 block discarded – undo
228 228
             'faux'        => isset( $option['faux'] )        ? $option['faux']        : false,
229 229
             'onchange'    => isset( $option['onchange'] )   ? $option['onchange']     : '',
230 230
             'custom'      => isset( $option['custom'] )     ? $option['custom']       : '',
231
-			'default_content' => isset( $option['default_content'] )     ? $option['default_content']       : '',
232
-			'class'       => isset( $option['class'] )     ? $option['class']         : '',
233
-			'style'       => isset( $option['style'] )     ? $option['style']         : '',
231
+            'default_content' => isset( $option['default_content'] )     ? $option['default_content']       : '',
232
+            'class'       => isset( $option['class'] )     ? $option['class']         : '',
233
+            'style'       => isset( $option['style'] )     ? $option['style']         : '',
234 234
             'cols'        => isset( $option['cols'] ) && (int) $option['cols'] > 0 ? (int) $option['cols'] : 50,
235 235
             'rows'        => isset( $option['rows'] ) && (int) $option['rows'] > 0 ? (int) $option['rows'] : 5,
236 236
         )
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
  * @return array
245 245
  */
246 246
 function wpinv_get_registered_settings() {
247
-	return array_filter( apply_filters( 'wpinv_registered_settings', wpinv_get_data( 'admin-settings' ) ) );
247
+    return array_filter( apply_filters( 'wpinv_registered_settings', wpinv_get_data( 'admin-settings' ) ) );
248 248
 }
249 249
 
250 250
 /**
@@ -263,18 +263,18 @@  discard block
 block discarded – undo
263 263
  */
264 264
 function wpinv_settings_sanitize( $input = array() ) {
265 265
 
266
-	$wpinv_options = wpinv_get_options();
267
-	$raw_referrer  = wp_get_raw_referer();
266
+    $wpinv_options = wpinv_get_options();
267
+    $raw_referrer  = wp_get_raw_referer();
268 268
 
269 269
     if ( empty( $raw_referrer ) ) {
270
-		return array_merge( $wpinv_options, $input );
270
+        return array_merge( $wpinv_options, $input );
271 271
     }
272 272
 
273 273
     wp_parse_str( $raw_referrer, $referrer );
274 274
 
275
-	if ( in_array( 'gp-setup', $referrer ) ) {
276
-		return array_merge( $wpinv_options, $input );
277
-	}
275
+    if ( in_array( 'gp-setup', $referrer ) ) {
276
+        return array_merge( $wpinv_options, $input );
277
+    }
278 278
 
279 279
     $settings = wpinv_get_registered_settings();
280 280
     $tab      = isset( $referrer['tab'] ) ? $referrer['tab'] : 'general';
@@ -296,10 +296,10 @@  discard block
 block discarded – undo
296 296
         }
297 297
 
298 298
         // General filter
299
-		$input[ $key ] = apply_filters( 'wpinv_settings_sanitize', $input[ $key ], $key );
299
+        $input[ $key ] = apply_filters( 'wpinv_settings_sanitize', $input[ $key ], $key );
300 300
 
301
-		// Key specific filter.
302
-		$input[ $key ] = apply_filters( "wpinv_settings_sanitize_$key", $input[ $key ] );
301
+        // Key specific filter.
302
+        $input[ $key ] = apply_filters( "wpinv_settings_sanitize_$key", $input[ $key ] );
303 303
     }
304 304
 
305 305
     // Loop through the whitelist and unset any that are empty for the tab being saved
@@ -342,14 +342,14 @@  discard block
 block discarded – undo
342 342
 
343 343
     foreach ( $new_rates as $rate ) {
344 344
 
345
-		$rate['rate']    = wpinv_sanitize_amount( $rate['rate'] );
346
-		$rate['name']    = sanitize_text_field( $rate['name'] );
347
-		$rate['state']   = sanitize_text_field( $rate['state'] );
348
-		$rate['country'] = sanitize_text_field( $rate['country'] );
349
-		$rate['global']  = empty( $rate['state'] );
350
-		$tax_rates[]     = $rate;
345
+        $rate['rate']    = wpinv_sanitize_amount( $rate['rate'] );
346
+        $rate['name']    = sanitize_text_field( $rate['name'] );
347
+        $rate['state']   = sanitize_text_field( $rate['state'] );
348
+        $rate['country'] = sanitize_text_field( $rate['country'] );
349
+        $rate['global']  = empty( $rate['state'] );
350
+        $tax_rates[]     = $rate;
351 351
 
352
-	}
352
+    }
353 353
 
354 354
     update_option( 'wpinv_tax_rates', $tax_rates );
355 355
 
@@ -362,11 +362,11 @@  discard block
 block discarded – undo
362 362
     $tabs['general']  = __( 'General', 'invoicing' );
363 363
     $tabs['gateways'] = __( 'Payment Gateways', 'invoicing' );
364 364
     $tabs['taxes']    = __( 'Taxes', 'invoicing' );
365
-	$tabs['emails']   = __( 'Emails', 'invoicing' );
365
+    $tabs['emails']   = __( 'Emails', 'invoicing' );
366 366
 
367
-	if ( count( getpaid_get_integration_settings() ) > 0 ) {
368
-		$tabs['integrations'] = __( 'Integrations', 'invoicing' );
369
-	}
367
+    if ( count( getpaid_get_integration_settings() ) > 0 ) {
368
+        $tabs['integrations'] = __( 'Integrations', 'invoicing' );
369
+    }
370 370
 
371 371
     $tabs['privacy']  = __( 'Privacy', 'invoicing' );
372 372
     $tabs['misc']     = __( 'Misc', 'invoicing' );
@@ -405,14 +405,14 @@  discard block
 block discarded – undo
405 405
         ) ),
406 406
         'taxes' => apply_filters( 'wpinv_settings_sections_taxes', array(
407 407
             'main'  => __( 'Tax Settings', 'invoicing' ),
408
-			'rates' => __( 'Tax Rates', 'invoicing' ),
409
-			'vat'   => __( 'EU VAT Settings', 'invoicing' )
408
+            'rates' => __( 'Tax Rates', 'invoicing' ),
409
+            'vat'   => __( 'EU VAT Settings', 'invoicing' )
410 410
         ) ),
411 411
         'emails' => apply_filters( 'wpinv_settings_sections_emails', array(
412 412
             'main' => __( 'Email Settings', 'invoicing' ),
413
-		) ),
413
+        ) ),
414 414
 
415
-		'integrations' => wp_list_pluck( getpaid_get_integration_settings(), 'label', 'id' ),
415
+        'integrations' => wp_list_pluck( getpaid_get_integration_settings(), 'label', 'id' ),
416 416
 
417 417
         'privacy' => apply_filters( 'wpinv_settings_sections_privacy', array(
418 418
             'main' => __( 'Privacy policy', 'invoicing' ),
@@ -432,48 +432,48 @@  discard block
 block discarded – undo
432 432
 }
433 433
 
434 434
 function wpinv_get_pages( $with_slug = false, $default_label = NULL ) {
435
-	$pages_options = array();
435
+    $pages_options = array();
436 436
 
437
-	if( $default_label !== NULL && $default_label !== false ) {
438
-		$pages_options = array( '' => $default_label ); // Blank option
439
-	}
437
+    if( $default_label !== NULL && $default_label !== false ) {
438
+        $pages_options = array( '' => $default_label ); // Blank option
439
+    }
440 440
 
441
-	$pages = get_pages();
442
-	if ( $pages ) {
443
-		foreach ( $pages as $page ) {
444
-			$title = $with_slug ? $page->post_title . ' (' . $page->post_name . ')' : $page->post_title;
441
+    $pages = get_pages();
442
+    if ( $pages ) {
443
+        foreach ( $pages as $page ) {
444
+            $title = $with_slug ? $page->post_title . ' (' . $page->post_name . ')' : $page->post_title;
445 445
             $pages_options[ $page->ID ] = $title;
446
-		}
447
-	}
446
+        }
447
+    }
448 448
 
449
-	return $pages_options;
449
+    return $pages_options;
450 450
 }
451 451
 
452 452
 function wpinv_header_callback( $args ) {
453
-	if ( !empty( $args['desc'] ) ) {
453
+    if ( !empty( $args['desc'] ) ) {
454 454
         echo $args['desc'];
455 455
     }
456 456
 }
457 457
 
458 458
 function wpinv_hidden_callback( $args ) {
459 459
 
460
-	$std     = isset( $args['std'] ) ? $args['std'] : '';
461
-	$value   = wpinv_get_option( $args['id'], $std );
460
+    $std     = isset( $args['std'] ) ? $args['std'] : '';
461
+    $value   = wpinv_get_option( $args['id'], $std );
462 462
 
463
-	if ( isset( $args['set_value'] ) ) {
464
-		$value = $args['set_value'];
465
-	}
463
+    if ( isset( $args['set_value'] ) ) {
464
+        $value = $args['set_value'];
465
+    }
466 466
 
467
-	if ( isset( $args['faux'] ) && true === $args['faux'] ) {
468
-		$args['readonly'] = true;
469
-		$name  = '';
470
-	} else {
471
-		$name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"';
472
-	}
467
+    if ( isset( $args['faux'] ) && true === $args['faux'] ) {
468
+        $args['readonly'] = true;
469
+        $name  = '';
470
+    } else {
471
+        $name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"';
472
+    }
473 473
 
474
-	$html = '<input type="hidden" id="wpinv_settings[' . wpinv_sanitize_key( $args['id'] ) . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '" />';
474
+    $html = '<input type="hidden" id="wpinv_settings[' . wpinv_sanitize_key( $args['id'] ) . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '" />';
475 475
     
476
-	echo $html;
476
+    echo $html;
477 477
 }
478 478
 
479 479
 /**
@@ -481,12 +481,12 @@  discard block
 block discarded – undo
481 481
  */
482 482
 function wpinv_checkbox_callback( $args ) {
483 483
 
484
-	$std = isset( $args['std'] ) ? $args['std'] : '';
485
-	$std = wpinv_get_option( $args['id'], $std );
486
-	$id  = esc_attr( $args['id'] );
484
+    $std = isset( $args['std'] ) ? $args['std'] : '';
485
+    $std = wpinv_get_option( $args['id'], $std );
486
+    $id  = esc_attr( $args['id'] );
487 487
 
488
-	getpaid_hidden_field( "wpinv_settings[$id]", '0' );
489
-	?>
488
+    getpaid_hidden_field( "wpinv_settings[$id]", '0' );
489
+    ?>
490 490
 		<fieldset>
491 491
 			<label>
492 492
 				<input id="wpinv-settings-<?php echo $id; ?>" name="wpinv_settings[<?php echo $id; ?>]" <?php checked( empty( $std ), false ); ?> value="1" type="checkbox">
@@ -498,75 +498,75 @@  discard block
 block discarded – undo
498 498
 
499 499
 function wpinv_multicheck_callback( $args ) {
500 500
 
501
-	$sanitize_id = wpinv_sanitize_key( $args['id'] );
502
-	$class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : '';
501
+    $sanitize_id = wpinv_sanitize_key( $args['id'] );
502
+    $class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : '';
503 503
 
504
-	if ( ! empty( $args['options'] ) ) {
504
+    if ( ! empty( $args['options'] ) ) {
505 505
 
506
-		$std     = isset( $args['std'] ) ? $args['std'] : array();
507
-		$value   = wpinv_get_option( $args['id'], $std );
506
+        $std     = isset( $args['std'] ) ? $args['std'] : array();
507
+        $value   = wpinv_get_option( $args['id'], $std );
508 508
 
509
-		echo '<div class="wpi-mcheck-rows wpi-mcheck-' . $sanitize_id . $class . '">';
509
+        echo '<div class="wpi-mcheck-rows wpi-mcheck-' . $sanitize_id . $class . '">';
510 510
         foreach( $args['options'] as $key => $option ):
511
-			$sanitize_key = wpinv_sanitize_key( $key );
512
-			if ( in_array( $sanitize_key, $value ) ) { 
513
-				$enabled = $sanitize_key;
514
-			} else { 
515
-				$enabled = NULL; 
516
-			}
517
-			echo '<div class="wpi-mcheck-row"><input name="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="' . esc_attr( $sanitize_key ) . '" ' . checked( $sanitize_key, $enabled, false ) . '/>&nbsp;';
518
-			echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . wp_kses_post( $option ) . '</label></div>';
519
-		endforeach;
520
-		echo '</div>';
521
-		echo '<p class="description">' . $args['desc'] . '</p>';
522
-	}
511
+            $sanitize_key = wpinv_sanitize_key( $key );
512
+            if ( in_array( $sanitize_key, $value ) ) { 
513
+                $enabled = $sanitize_key;
514
+            } else { 
515
+                $enabled = NULL; 
516
+            }
517
+            echo '<div class="wpi-mcheck-row"><input name="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="' . esc_attr( $sanitize_key ) . '" ' . checked( $sanitize_key, $enabled, false ) . '/>&nbsp;';
518
+            echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . wp_kses_post( $option ) . '</label></div>';
519
+        endforeach;
520
+        echo '</div>';
521
+        echo '<p class="description">' . $args['desc'] . '</p>';
522
+    }
523 523
 }
524 524
 
525 525
 function wpinv_payment_icons_callback( $args ) {
526 526
     
527 527
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
528
-	$value   = wpinv_get_option( $args['id'], false);
528
+    $value   = wpinv_get_option( $args['id'], false);
529 529
 
530
-	if ( ! empty( $args['options'] ) ) {
531
-		foreach( $args['options'] as $key => $option ) {
530
+    if ( ! empty( $args['options'] ) ) {
531
+        foreach( $args['options'] as $key => $option ) {
532 532
             $sanitize_key = wpinv_sanitize_key( $key );
533 533
             
534
-			if( empty( $value ) ) {
535
-				$enabled = $option;
536
-			} else {
537
-				$enabled = NULL;
538
-			}
539
-
540
-			echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" style="margin-right:10px;line-height:16px;height:16px;display:inline-block;">';
541
-
542
-				echo '<input name="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="' . esc_attr( $option ) . '" ' . checked( $option, $enabled, false ) . '/>&nbsp;';
543
-
544
-				if ( wpinv_string_is_image_url( $key ) ) {
545
-					echo '<img class="payment-icon" src="' . esc_url( $key ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
546
-				} else {
547
-					$card = strtolower( str_replace( ' ', '', $option ) );
548
-
549
-					if ( has_filter( 'wpinv_accepted_payment_' . $card . '_image' ) ) {
550
-						$image = apply_filters( 'wpinv_accepted_payment_' . $card . '_image', '' );
551
-					} else {
552
-						$image       = wpinv_locate_template( 'images' . DIRECTORY_SEPARATOR . 'icons' . DIRECTORY_SEPARATOR . $card . '.gif', false );
553
-						$content_dir = WP_CONTENT_DIR;
554
-
555
-						if ( function_exists( 'wp_normalize_path' ) ) {
556
-							// Replaces backslashes with forward slashes for Windows systems
557
-							$image = wp_normalize_path( $image );
558
-							$content_dir = wp_normalize_path( $content_dir );
559
-						}
560
-
561
-						$image = str_replace( $content_dir, content_url(), $image );
562
-					}
563
-
564
-					echo '<img class="payment-icon" src="' . esc_url( $image ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
565
-				}
566
-			echo $option . '</label>';
567
-		}
568
-		echo '<p class="description" style="margin-top:16px;">' . wp_kses_post( $args['desc'] ) . '</p>';
569
-	}
534
+            if( empty( $value ) ) {
535
+                $enabled = $option;
536
+            } else {
537
+                $enabled = NULL;
538
+            }
539
+
540
+            echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" style="margin-right:10px;line-height:16px;height:16px;display:inline-block;">';
541
+
542
+                echo '<input name="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="' . esc_attr( $option ) . '" ' . checked( $option, $enabled, false ) . '/>&nbsp;';
543
+
544
+                if ( wpinv_string_is_image_url( $key ) ) {
545
+                    echo '<img class="payment-icon" src="' . esc_url( $key ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
546
+                } else {
547
+                    $card = strtolower( str_replace( ' ', '', $option ) );
548
+
549
+                    if ( has_filter( 'wpinv_accepted_payment_' . $card . '_image' ) ) {
550
+                        $image = apply_filters( 'wpinv_accepted_payment_' . $card . '_image', '' );
551
+                    } else {
552
+                        $image       = wpinv_locate_template( 'images' . DIRECTORY_SEPARATOR . 'icons' . DIRECTORY_SEPARATOR . $card . '.gif', false );
553
+                        $content_dir = WP_CONTENT_DIR;
554
+
555
+                        if ( function_exists( 'wp_normalize_path' ) ) {
556
+                            // Replaces backslashes with forward slashes for Windows systems
557
+                            $image = wp_normalize_path( $image );
558
+                            $content_dir = wp_normalize_path( $content_dir );
559
+                        }
560
+
561
+                        $image = str_replace( $content_dir, content_url(), $image );
562
+                    }
563
+
564
+                    echo '<img class="payment-icon" src="' . esc_url( $image ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
565
+                }
566
+            echo $option . '</label>';
567
+        }
568
+        echo '<p class="description" style="margin-top:16px;">' . wp_kses_post( $args['desc'] ) . '</p>';
569
+    }
570 570
 }
571 571
 
572 572
 /**
@@ -574,9 +574,9 @@  discard block
 block discarded – undo
574 574
  */
575 575
 function wpinv_radio_callback( $args ) {
576 576
 
577
-	$std = isset( $args['std'] ) ? $args['std'] : '';
578
-	$std = wpinv_get_option( $args['id'], $std );
579
-	?>
577
+    $std = isset( $args['std'] ) ? $args['std'] : '';
578
+    $std = wpinv_get_option( $args['id'], $std );
579
+    ?>
580 580
 		<fieldset>
581 581
 			<ul id="wpinv-settings-<?php echo esc_attr( $args['id'] ); ?>" style="margin-top: 0;">
582 582
 				<?php foreach( $args['options'] as $key => $option ) : ?>
@@ -590,7 +590,7 @@  discard block
 block discarded – undo
590 590
 			</ul>
591 591
 		</fieldset>
592 592
 	<?php
593
-	getpaid_settings_description_callback( $args );
593
+    getpaid_settings_description_callback( $args );
594 594
 }
595 595
 
596 596
 /**
@@ -598,10 +598,10 @@  discard block
 block discarded – undo
598 598
  */
599 599
 function getpaid_settings_description_callback( $args ) {
600 600
 
601
-	if ( ! empty( $args['desc'] ) ) {
602
-		$description = wp_kses_post( $args['desc'] );
603
-		echo "<p class='description'>$description</p>";
604
-	}
601
+    if ( ! empty( $args['desc'] ) ) {
602
+        $description = wp_kses_post( $args['desc'] );
603
+        echo "<p class='description'>$description</p>";
604
+    }
605 605
 
606 606
 }
607 607
 
@@ -610,7 +610,7 @@  discard block
 block discarded – undo
610 610
  */
611 611
 function wpinv_gateways_callback() {
612 612
 
613
-	?>
613
+    ?>
614 614
 		</td>
615 615
 	</tr>
616 616
 	<tr class="bsui">
@@ -624,22 +624,22 @@  discard block
 block discarded – undo
624 624
     
625 625
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
626 626
     $class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : '';
627
-	$std     = isset( $args['std'] ) ? $args['std'] : '';
628
-	$value   = wpinv_get_option( $args['id'], $std );
627
+    $std     = isset( $args['std'] ) ? $args['std'] : '';
628
+    $value   = wpinv_get_option( $args['id'], $std );
629 629
 
630
-	echo '<select name="wpinv_settings[' . $sanitize_id . ']"" id="wpinv_settings[' . $sanitize_id . ']" class="'.$class.'" >';
630
+    echo '<select name="wpinv_settings[' . $sanitize_id . ']"" id="wpinv_settings[' . $sanitize_id . ']" class="'.$class.'" >';
631 631
 
632
-	foreach ( $args['options'] as $key => $option ) :
633
-		if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) {
632
+    foreach ( $args['options'] as $key => $option ) :
633
+        if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) {
634 634
             $selected = selected( $key, $args['selected'], false );
635 635
         } else {
636 636
             $selected = selected( $key, $value, false );
637 637
         }
638
-		echo '<option value="' . wpinv_sanitize_key( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>';
639
-	endforeach;
638
+        echo '<option value="' . wpinv_sanitize_key( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>';
639
+    endforeach;
640 640
 
641
-	echo '</select>';
642
-	echo '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
641
+    echo '</select>';
642
+    echo '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
643 643
 }
644 644
 
645 645
 /**
@@ -650,29 +650,29 @@  discard block
 block discarded – undo
650 650
  */
651 651
 function wpinv_settings_attrs_helper( $args ) {
652 652
 
653
-	$value        = isset( $args['std'] ) ? $args['std'] : '';
654
-	$id           = esc_attr( $args['id'] );
655
-	$placeholder  = esc_attr( $args['placeholder'] );
653
+    $value        = isset( $args['std'] ) ? $args['std'] : '';
654
+    $id           = esc_attr( $args['id'] );
655
+    $placeholder  = esc_attr( $args['placeholder'] );
656 656
 
657
-	if ( ! empty( $args['faux'] ) ) {
658
-		$args['readonly'] = true;
659
-		$name             = '';
660
-	} else {
661
-		$value  = wpinv_get_option( $args['id'], $value );
662
-		$name   = "wpinv_settings[$id]";
663
-	}
657
+    if ( ! empty( $args['faux'] ) ) {
658
+        $args['readonly'] = true;
659
+        $name             = '';
660
+    } else {
661
+        $value  = wpinv_get_option( $args['id'], $value );
662
+        $name   = "wpinv_settings[$id]";
663
+    }
664 664
 
665
-	$value    = is_scalar( $value ) ? esc_attr( $value ) : '';
666
-	$class    = esc_attr( $args['class'] );
667
-	$style    = esc_attr( $args['style'] );
668
-	$readonly = empty( $args['readonly'] ) ? '' : 'readonly onclick="this.select()"';
665
+    $value    = is_scalar( $value ) ? esc_attr( $value ) : '';
666
+    $class    = esc_attr( $args['class'] );
667
+    $style    = esc_attr( $args['style'] );
668
+    $readonly = empty( $args['readonly'] ) ? '' : 'readonly onclick="this.select()"';
669 669
 
670
-	$onchange = '';
670
+    $onchange = '';
671 671
     if ( ! empty( $args['onchange'] ) ) {
672 672
         $onchange = ' onchange="' . esc_attr( $args['onchange'] ) . '"';
673
-	}
673
+    }
674 674
 
675
-	return "name='$name' id='wpinv-settings-$id' style='$style' value='$value' class='$class' placeholder='$placeholder' data-placeholder='$placeholder' $onchange $readonly";
675
+    return "name='$name' id='wpinv-settings-$id' style='$style' value='$value' class='$class' placeholder='$placeholder' data-placeholder='$placeholder' $onchange $readonly";
676 676
 }
677 677
 
678 678
 /**
@@ -680,11 +680,11 @@  discard block
 block discarded – undo
680 680
  */
681 681
 function wpinv_text_callback( $args ) {
682 682
 
683
-	$desc = wp_kses_post( $args['desc'] );
684
-	$desc = empty( $desc ) ? '' : "<p class='description'>$desc</p>";
685
-	$attr = wpinv_settings_attrs_helper( $args );
683
+    $desc = wp_kses_post( $args['desc'] );
684
+    $desc = empty( $desc ) ? '' : "<p class='description'>$desc</p>";
685
+    $attr = wpinv_settings_attrs_helper( $args );
686 686
 
687
-	?>
687
+    ?>
688 688
 		<label style="width: 100%;">
689 689
 			<input type="text" <?php echo $attr; ?>>
690 690
 			<?php echo $desc; ?>
@@ -698,14 +698,14 @@  discard block
 block discarded – undo
698 698
  */
699 699
 function wpinv_number_callback( $args ) {
700 700
 
701
-	$desc = wp_kses_post( $args['desc'] );
702
-	$desc = empty( $desc ) ? '' : "<p class='description'>$desc</p>";
703
-	$attr = wpinv_settings_attrs_helper( $args );
704
-	$max  = intval( $args['max'] );
705
-	$min  = intval( $args['min'] );
706
-	$step = floatval( $args['step'] );
701
+    $desc = wp_kses_post( $args['desc'] );
702
+    $desc = empty( $desc ) ? '' : "<p class='description'>$desc</p>";
703
+    $attr = wpinv_settings_attrs_helper( $args );
704
+    $max  = intval( $args['max'] );
705
+    $min  = intval( $args['min'] );
706
+    $step = floatval( $args['step'] );
707 707
 
708
-	?>
708
+    ?>
709 709
 		<label style="width: 100%;">
710 710
 			<input type="number" step="<?php echo $step; ?>" max="<?php echo $max; ?>" min="<?php echo $min; ?>" <?php echo $attr; ?>>
711 711
 			<?php echo $desc; ?>
@@ -717,36 +717,36 @@  discard block
 block discarded – undo
717 717
 function wpinv_textarea_callback( $args ) {
718 718
     
719 719
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
720
-	$std     = isset( $args['std'] ) ? $args['std'] : '';
721
-	$value   = wpinv_get_option( $args['id'], $std );
720
+    $std     = isset( $args['std'] ) ? $args['std'] : '';
721
+    $value   = wpinv_get_option( $args['id'], $std );
722 722
 
723 723
     $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
724 724
     $class = ( isset( $args['class'] ) && ! is_null( $args['class'] ) ) ? $args['class'] : 'large-text';
725 725
 
726
-	$html = '<textarea class="' . sanitize_html_class( $class ) . ' txtarea-' . sanitize_html_class( $size ) . ' wpi-' . esc_attr( sanitize_html_class( $sanitize_id ) ) . ' " cols="' . $args['cols'] . '" rows="' . $args['rows'] . '" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']">' . esc_textarea( stripslashes( $value ) ) . '</textarea>';
727
-	$html .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
726
+    $html = '<textarea class="' . sanitize_html_class( $class ) . ' txtarea-' . sanitize_html_class( $size ) . ' wpi-' . esc_attr( sanitize_html_class( $sanitize_id ) ) . ' " cols="' . $args['cols'] . '" rows="' . $args['rows'] . '" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']">' . esc_textarea( stripslashes( $value ) ) . '</textarea>';
727
+    $html .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
728 728
 
729
-	echo $html;
729
+    echo $html;
730 730
 }
731 731
 
732 732
 function wpinv_password_callback( $args ) {
733 733
     
734 734
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
735
-	$std     = isset( $args['std'] ) ? $args['std'] : '';
736
-	$value   = wpinv_get_option( $args['id'], $std );
735
+    $std     = isset( $args['std'] ) ? $args['std'] : '';
736
+    $value   = wpinv_get_option( $args['id'], $std );
737 737
 
738
-	$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
739
-	$html = '<input type="password" class="' . sanitize_html_class( $size ) . '-text" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( $value ) . '"/>';
740
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
738
+    $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
739
+    $html = '<input type="password" class="' . sanitize_html_class( $size ) . '-text" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( $value ) . '"/>';
740
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
741 741
 
742
-	echo $html;
742
+    echo $html;
743 743
 }
744 744
 
745 745
 function wpinv_missing_callback($args) {
746
-	printf(
747
-		__( 'The callback function used for the %s setting is missing.', 'invoicing' ),
748
-		'<strong>' . $args['id'] . '</strong>'
749
-	);
746
+    printf(
747
+        __( 'The callback function used for the %s setting is missing.', 'invoicing' ),
748
+        '<strong>' . $args['id'] . '</strong>'
749
+    );
750 750
 }
751 751
 
752 752
 /**
@@ -754,14 +754,14 @@  discard block
 block discarded – undo
754 754
  */
755 755
 function wpinv_select_callback( $args ) {
756 756
 
757
-	$desc   = wp_kses_post( $args['desc'] );
758
-	$desc   = empty( $desc ) ? '' : "<p class='description'>$desc</p>";
759
-	$attr   = wpinv_settings_attrs_helper( $args );
760
-	$value  = isset( $args['std'] ) ? $args['std'] : '';
761
-	$value  = wpinv_get_option( $args['id'], $value );
762
-	$rand   = uniqid( 'random_id' );
757
+    $desc   = wp_kses_post( $args['desc'] );
758
+    $desc   = empty( $desc ) ? '' : "<p class='description'>$desc</p>";
759
+    $attr   = wpinv_settings_attrs_helper( $args );
760
+    $value  = isset( $args['std'] ) ? $args['std'] : '';
761
+    $value  = wpinv_get_option( $args['id'], $value );
762
+    $rand   = uniqid( 'random_id' );
763 763
 
764
-	?>
764
+    ?>
765 765
 		<label style="width: 100%;">
766 766
 			<select <?php echo $attr; ?> data-allow-clear="true">
767 767
 				<?php foreach ( $args['options'] as $option => $name ) : ?>
@@ -794,104 +794,104 @@  discard block
 block discarded – undo
794 794
 function wpinv_color_select_callback( $args ) {
795 795
     
796 796
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
797
-	$std     = isset( $args['std'] ) ? $args['std'] : '';
798
-	$value   = wpinv_get_option( $args['id'], $std );
797
+    $std     = isset( $args['std'] ) ? $args['std'] : '';
798
+    $value   = wpinv_get_option( $args['id'], $std );
799 799
 
800
-	$html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"/>';
800
+    $html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"/>';
801 801
 
802
-	foreach ( $args['options'] as $option => $color ) {
803
-		$selected = selected( $option, $value, false );
804
-		$html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $color['label'] ) . '</option>';
805
-	}
802
+    foreach ( $args['options'] as $option => $color ) {
803
+        $selected = selected( $option, $value, false );
804
+        $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $color['label'] ) . '</option>';
805
+    }
806 806
 
807
-	$html .= '</select>';
808
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
807
+    $html .= '</select>';
808
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
809 809
 
810
-	echo $html;
810
+    echo $html;
811 811
 }
812 812
 
813 813
 function wpinv_rich_editor_callback( $args ) {
814
-	global $wp_version;
814
+    global $wp_version;
815 815
     
816 816
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
817 817
 
818
-	$std     = isset( $args['std'] ) ? $args['std'] : '';
819
-	$value   = wpinv_get_option( $args['id'], $std );
818
+    $std     = isset( $args['std'] ) ? $args['std'] : '';
819
+    $value   = wpinv_get_option( $args['id'], $std );
820 820
 	
821
-	if ( ! empty( $args['allow_blank'] ) && empty( $value ) ) {
822
-		$value = $std;
823
-	}
821
+    if ( ! empty( $args['allow_blank'] ) && empty( $value ) ) {
822
+        $value = $std;
823
+    }
824 824
 
825
-	$rows = isset( $args['size'] ) ? $args['size'] : 20;
825
+    $rows = isset( $args['size'] ) ? $args['size'] : 20;
826 826
 
827
-	$html = '<div class="getpaid-settings-editor-input">';
828
-	if ( $wp_version >= 3.3 && function_exists( 'wp_editor' ) ) {
829
-		ob_start();
830
-		wp_editor( stripslashes( $value ), 'wpinv_settings_' . esc_attr( $args['id'] ), array( 'textarea_name' => 'wpinv_settings[' . esc_attr( $args['id'] ) . ']', 'textarea_rows' => absint( $rows ), 'media_buttons' => false ) );
831
-		$html .= ob_get_clean();
832
-	} else {
833
-		$html .= '<textarea class="large-text" rows="10" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" class="wpi-' . esc_attr( sanitize_html_class( $args['id'] ) ) . '">' . esc_textarea( stripslashes( $value ) ) . '</textarea>';
834
-	}
827
+    $html = '<div class="getpaid-settings-editor-input">';
828
+    if ( $wp_version >= 3.3 && function_exists( 'wp_editor' ) ) {
829
+        ob_start();
830
+        wp_editor( stripslashes( $value ), 'wpinv_settings_' . esc_attr( $args['id'] ), array( 'textarea_name' => 'wpinv_settings[' . esc_attr( $args['id'] ) . ']', 'textarea_rows' => absint( $rows ), 'media_buttons' => false ) );
831
+        $html .= ob_get_clean();
832
+    } else {
833
+        $html .= '<textarea class="large-text" rows="10" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" class="wpi-' . esc_attr( sanitize_html_class( $args['id'] ) ) . '">' . esc_textarea( stripslashes( $value ) ) . '</textarea>';
834
+    }
835 835
 
836
-	$html .= '</div><br/><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
836
+    $html .= '</div><br/><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
837 837
 
838
-	echo $html;
838
+    echo $html;
839 839
 }
840 840
 
841 841
 function wpinv_upload_callback( $args ) {
842 842
     
843 843
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
844 844
 
845
-	$std     = isset( $args['std'] ) ? $args['std'] : '';
846
-	$value   = wpinv_get_option( $args['id'], $std );
845
+    $std     = isset( $args['std'] ) ? $args['std'] : '';
846
+    $value   = wpinv_get_option( $args['id'], $std );
847 847
 
848
-	$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
849
-	$html = '<input type="text" class="' . sanitize_html_class( $size ) . '-text" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( stripslashes( $value ) ) . '"/>';
850
-	$html .= '<span>&nbsp;<input type="button" class="wpinv_settings_upload_button button-secondary" value="' . __( 'Upload File', 'invoicing' ) . '"/></span>';
851
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
848
+    $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
849
+    $html = '<input type="text" class="' . sanitize_html_class( $size ) . '-text" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( stripslashes( $value ) ) . '"/>';
850
+    $html .= '<span>&nbsp;<input type="button" class="wpinv_settings_upload_button button-secondary" value="' . __( 'Upload File', 'invoicing' ) . '"/></span>';
851
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
852 852
 
853
-	echo $html;
853
+    echo $html;
854 854
 }
855 855
 
856 856
 function wpinv_color_callback( $args ) {
857 857
 
858
-	$std         = isset( $args['std'] ) ? $args['std'] : '';
859
-	$value       = wpinv_get_option( $args['id'], $std );
858
+    $std         = isset( $args['std'] ) ? $args['std'] : '';
859
+    $value       = wpinv_get_option( $args['id'], $std );
860 860
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
861 861
 
862
-	$html = '<input type="text" class="wpinv-color-picker" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( $value ) . '" data-default-color="' . esc_attr( $std ) . '" />';
863
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
862
+    $html = '<input type="text" class="wpinv-color-picker" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( $value ) . '" data-default-color="' . esc_attr( $std ) . '" />';
863
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
864 864
 
865
-	echo $html;
865
+    echo $html;
866 866
 }
867 867
 
868 868
 function wpinv_country_states_callback($args) {
869 869
 
870
-	$std     = isset( $args['std'] ) ? $args['std'] : '';
871
-	$value   = wpinv_get_option( $args['id'], $std );
870
+    $std     = isset( $args['std'] ) ? $args['std'] : '';
871
+    $value   = wpinv_get_option( $args['id'], $std );
872 872
 
873 873
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
874 874
 
875
-	if ( isset( $args['placeholder'] ) ) {
876
-		$placeholder = $args['placeholder'];
877
-	} else {
878
-		$placeholder = '';
879
-	}
875
+    if ( isset( $args['placeholder'] ) ) {
876
+        $placeholder = $args['placeholder'];
877
+    } else {
878
+        $placeholder = '';
879
+    }
880 880
 
881
-	$states = wpinv_get_country_states();
881
+    $states = wpinv_get_country_states();
882 882
 
883
-	$class = empty( $states ) ? ' class="wpinv-no-states"' : ' class="wpi_select2"';
884
-	$html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"' . $class . 'data-placeholder="' . esc_html( $placeholder ) . '"/>';
883
+    $class = empty( $states ) ? ' class="wpinv-no-states"' : ' class="wpi_select2"';
884
+    $html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"' . $class . 'data-placeholder="' . esc_html( $placeholder ) . '"/>';
885 885
 
886
-	foreach ( $states as $option => $name ) {
887
-		$selected = selected( $option, $value, false );
888
-		$html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>';
889
-	}
886
+    foreach ( $states as $option => $name ) {
887
+        $selected = selected( $option, $value, false );
888
+        $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>';
889
+    }
890 890
 
891
-	$html .= '</select>';
892
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
891
+    $html .= '</select>';
892
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
893 893
 
894
-	echo $html;
894
+    echo $html;
895 895
 }
896 896
 
897 897
 /**
@@ -899,7 +899,7 @@  discard block
 block discarded – undo
899 899
  */
900 900
 function wpinv_tax_rates_callback() {
901 901
 	
902
-	?>
902
+    ?>
903 903
 		</td>
904 904
 	</tr>
905 905
 	<tr class="bsui">
@@ -914,17 +914,17 @@  discard block
 block discarded – undo
914 914
  * Displays a tax rate' edit row.
915 915
  */
916 916
 function wpinv_tax_rate_callback( $tax_rate, $key, $echo = true ) {
917
-	ob_start();
917
+    ob_start();
918 918
 
919
-	$key                      = sanitize_key( $key );
920
-	$tax_rate['reduced_rate'] = empty( $tax_rate['reduced_rate'] ) ? 0 : $tax_rate['reduced_rate'];
921
-	include plugin_dir_path( __FILE__ ) . 'views/html-tax-rate-edit.php';
919
+    $key                      = sanitize_key( $key );
920
+    $tax_rate['reduced_rate'] = empty( $tax_rate['reduced_rate'] ) ? 0 : $tax_rate['reduced_rate'];
921
+    include plugin_dir_path( __FILE__ ) . 'views/html-tax-rate-edit.php';
922 922
 
923
-	if ( $echo ) {
924
-		echo ob_get_clean();
925
-	} else {
926
-		return ob_get_clean(); 
927
-	}
923
+    if ( $echo ) {
924
+        echo ob_get_clean();
925
+    } else {
926
+        return ob_get_clean(); 
927
+    }
928 928
 
929 929
 }
930 930
 
@@ -952,14 +952,14 @@  discard block
 block discarded – undo
952 952
                 </td>
953 953
                 <td>
954 954
 					<a href="<?php
955
-						echo esc_url(
956
-							wp_nonce_url(
957
-								add_query_arg( 'getpaid-admin-action', 'create_missing_pages' ),
958
-								'getpaid-nonce',
959
-								'getpaid-nonce'
960
-							)
961
-						);
962
-					?>" class="button button-primary"><?php _e('Run', 'invoicing');?></a>
955
+                        echo esc_url(
956
+                            wp_nonce_url(
957
+                                add_query_arg( 'getpaid-admin-action', 'create_missing_pages' ),
958
+                                'getpaid-nonce',
959
+                                'getpaid-nonce'
960
+                            )
961
+                        );
962
+                    ?>" class="button button-primary"><?php _e('Run', 'invoicing');?></a>
963 963
                 </td>
964 964
             </tr>
965 965
 			<tr>
@@ -969,14 +969,14 @@  discard block
 block discarded – undo
969 969
                 </td>
970 970
                 <td>
971 971
 					<a href="<?php
972
-						echo esc_url(
973
-							wp_nonce_url(
974
-								add_query_arg( 'getpaid-admin-action', 'create_missing_tables' ),
975
-								'getpaid-nonce',
976
-								'getpaid-nonce'
977
-							)
978
-						);
979
-					?>" class="button button-primary"><?php _e('Run', 'invoicing');?></a>
972
+                        echo esc_url(
973
+                            wp_nonce_url(
974
+                                add_query_arg( 'getpaid-admin-action', 'create_missing_tables' ),
975
+                                'getpaid-nonce',
976
+                                'getpaid-nonce'
977
+                            )
978
+                        );
979
+                    ?>" class="button button-primary"><?php _e('Run', 'invoicing');?></a>
980 980
                 </td>
981 981
             </tr>
982 982
 			<tr>
@@ -986,14 +986,14 @@  discard block
 block discarded – undo
986 986
                 </td>
987 987
                 <td>
988 988
 					<a href="<?php
989
-						echo esc_url(
990
-							wp_nonce_url(
991
-								add_query_arg( 'getpaid-admin-action', 'migrate_old_invoices' ),
992
-								'getpaid-nonce',
993
-								'getpaid-nonce'
994
-							)
995
-						);
996
-					?>" class="button button-primary"><?php _e('Run', 'invoicing');?></a>
989
+                        echo esc_url(
990
+                            wp_nonce_url(
991
+                                add_query_arg( 'getpaid-admin-action', 'migrate_old_invoices' ),
992
+                                'getpaid-nonce',
993
+                                'getpaid-nonce'
994
+                            )
995
+                        );
996
+                    ?>" class="button button-primary"><?php _e('Run', 'invoicing');?></a>
997 997
                 </td>
998 998
             </tr>
999 999
 
@@ -1004,14 +1004,14 @@  discard block
 block discarded – undo
1004 1004
                 </td>
1005 1005
                 <td>
1006 1006
 					<a href="<?php
1007
-						echo esc_url(
1008
-							wp_nonce_url(
1009
-								add_query_arg( 'getpaid-admin-action', 'recalculate_discounts' ),
1010
-								'getpaid-nonce',
1011
-								'getpaid-nonce'
1012
-							)
1013
-						);
1014
-					?>" class="button button-primary"><?php _e( 'Run', 'invoicing' );?></a>
1007
+                        echo esc_url(
1008
+                            wp_nonce_url(
1009
+                                add_query_arg( 'getpaid-admin-action', 'recalculate_discounts' ),
1010
+                                'getpaid-nonce',
1011
+                                'getpaid-nonce'
1012
+                            )
1013
+                        );
1014
+                    ?>" class="button button-primary"><?php _e( 'Run', 'invoicing' );?></a>
1015 1015
                 </td>
1016 1016
             </tr>
1017 1017
 
@@ -1022,8 +1022,8 @@  discard block
 block discarded – undo
1022 1022
                 </td>
1023 1023
                 <td>
1024 1024
 					<a href="<?php
1025
-						echo esc_url( admin_url( 'index.php?page=gp-setup' ) );
1026
-					?>" class="button button-primary"><?php _e( 'Launch', 'invoicing' );?></a>
1025
+                        echo esc_url( admin_url( 'index.php?page=gp-setup' ) );
1026
+                    ?>" class="button button-primary"><?php _e( 'Launch', 'invoicing' );?></a>
1027 1027
                 </td>
1028 1028
             </tr>
1029 1029
 
@@ -1037,19 +1037,19 @@  discard block
 block discarded – undo
1037 1037
 
1038 1038
 
1039 1039
 function wpinv_descriptive_text_callback( $args ) {
1040
-	echo wp_kses_post( $args['desc'] );
1040
+    echo wp_kses_post( $args['desc'] );
1041 1041
 }
1042 1042
 
1043 1043
 function wpinv_raw_html_callback( $args ) {
1044
-	echo $args['desc'];
1044
+    echo $args['desc'];
1045 1045
 }
1046 1046
 
1047 1047
 function wpinv_hook_callback( $args ) {
1048
-	do_action( 'wpinv_' . $args['id'], $args );
1048
+    do_action( 'wpinv_' . $args['id'], $args );
1049 1049
 }
1050 1050
 
1051 1051
 function wpinv_set_settings_cap() {
1052
-	return wpinv_get_capability();
1052
+    return wpinv_get_capability();
1053 1053
 }
1054 1054
 add_filter( 'option_page_capability_wpinv_settings', 'wpinv_set_settings_cap' );
1055 1055
 
@@ -1073,15 +1073,15 @@  discard block
 block discarded – undo
1073 1073
  */
1074 1074
 function wpinv_get_merge_tags_help_text( $subscription = false ) {
1075 1075
 
1076
-	$url  = $subscription ? 'https://gist.github.com/picocodes/3d213982d57c34edf7a46fd3f0e8583e' : 'https://gist.github.com/picocodes/43bdc4d4bbba844534b2722e2af0b58f';
1077
-	$link = sprintf(
1078
-		'<strong><a href="%s" target="_blank">%s</a></strong>',
1079
-		$url,
1080
-		esc_html__( 'View available merge tags.', 'wpinv-quotes' )
1081
-	);
1076
+    $url  = $subscription ? 'https://gist.github.com/picocodes/3d213982d57c34edf7a46fd3f0e8583e' : 'https://gist.github.com/picocodes/43bdc4d4bbba844534b2722e2af0b58f';
1077
+    $link = sprintf(
1078
+        '<strong><a href="%s" target="_blank">%s</a></strong>',
1079
+        $url,
1080
+        esc_html__( 'View available merge tags.', 'wpinv-quotes' )
1081
+    );
1082 1082
 
1083
-	$description = esc_html__( 'The content of the email (Merge Tags and HTML are allowed).', 'invoicing' );
1083
+    $description = esc_html__( 'The content of the email (Merge Tags and HTML are allowed).', 'invoicing' );
1084 1084
 
1085
-	return "$description $link";
1085
+    return "$description $link";
1086 1086
 
1087 1087
 }
Please login to merge, or discard this patch.