Passed
Push — master ( 2e88d0...11ea61 )
by Brian
15:10 queued 09:32
created
vendor/composer/installers/src/Composer/Installers/PxcmsInstaller.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -35,11 +35,11 @@  discard block
 block discarded – undo
35 35
      */
36 36
     protected function inflectModuleVars($vars)
37 37
     {
38
-        $vars['name'] = str_replace('pxcms-', '', $vars['name']);       // strip out pxcms- just incase (legacy)
39
-        $vars['name'] = str_replace('module-', '', $vars['name']);      // strip out module-
40
-        $vars['name'] = preg_replace('/-module$/', '', $vars['name']);  // strip out -module
41
-        $vars['name'] = str_replace('-', '_', $vars['name']);           // make -'s be _'s
42
-        $vars['name'] = ucwords($vars['name']);                         // make module name camelcased
38
+        $vars['name'] = str_replace('pxcms-', '', $vars['name']); // strip out pxcms- just incase (legacy)
39
+        $vars['name'] = str_replace('module-', '', $vars['name']); // strip out module-
40
+        $vars['name'] = preg_replace('/-module$/', '', $vars['name']); // strip out -module
41
+        $vars['name'] = str_replace('-', '_', $vars['name']); // make -'s be _'s
42
+        $vars['name'] = ucwords($vars['name']); // make module name camelcased
43 43
 
44 44
         return $vars;
45 45
     }
@@ -52,11 +52,11 @@  discard block
 block discarded – undo
52 52
      */
53 53
     protected function inflectThemeVars($vars)
54 54
     {
55
-        $vars['name'] = str_replace('pxcms-', '', $vars['name']);       // strip out pxcms- just incase (legacy)
56
-        $vars['name'] = str_replace('theme-', '', $vars['name']);       // strip out theme-
57
-        $vars['name'] = preg_replace('/-theme$/', '', $vars['name']);   // strip out -theme
58
-        $vars['name'] = str_replace('-', '_', $vars['name']);           // make -'s be _'s
59
-        $vars['name'] = ucwords($vars['name']);                         // make module name camelcased
55
+        $vars['name'] = str_replace('pxcms-', '', $vars['name']); // strip out pxcms- just incase (legacy)
56
+        $vars['name'] = str_replace('theme-', '', $vars['name']); // strip out theme-
57
+        $vars['name'] = preg_replace('/-theme$/', '', $vars['name']); // strip out -theme
58
+        $vars['name'] = str_replace('-', '_', $vars['name']); // make -'s be _'s
59
+        $vars['name'] = ucwords($vars['name']); // make module name camelcased
60 60
 
61 61
         return $vars;
62 62
     }
Please login to merge, or discard this patch.
vendor/composer/installers/src/Composer/Installers/ShopwareInstaller.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
      */
38 38
     private function correctPluginName($vars)
39 39
     {
40
-        $camelCasedName = preg_replace_callback('/(-[a-z])/', function ($matches) {
40
+        $camelCasedName = preg_replace_callback('/(-[a-z])/', function($matches) {
41 41
             return strtoupper($matches[0][1]);
42 42
         }, $vars['name']);
43 43
 
Please login to merge, or discard this patch.
vendor/composer/installers/src/bootstrap.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -6,8 +6,8 @@
 block discarded – undo
6 6
     }
7 7
 }
8 8
 if ((!$loader = includeIfExists(__DIR__ . '/../vendor/autoload.php')) && (!$loader = includeIfExists(__DIR__ . '/../../../autoload.php'))) {
9
-    die('You must set up the project dependencies, run the following commands:'.PHP_EOL.
10
-        'curl -s http://getcomposer.org/installer | php'.PHP_EOL.
11
-        'php composer.phar install'.PHP_EOL);
9
+    die('You must set up the project dependencies, run the following commands:' . PHP_EOL .
10
+        'curl -s http://getcomposer.org/installer | php' . PHP_EOL .
11
+        'php composer.phar install' . PHP_EOL);
12 12
 }
13 13
 return $loader;
Please login to merge, or discard this patch.
includes/admin/register-settings.php 3 patches
Braces   +15 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1100,10 +1100,11 @@  discard block
 block discarded – undo
1100 1100
         
1101 1101
         $checked = false;
1102 1102
 
1103
-		if ( isset( $wpinv_options[ $args['id'] ] ) && $wpinv_options[ $args['id'] ] == $key )
1104
-			$checked = true;
1105
-		elseif( isset( $args['std'] ) && $args['std'] == $key && ! isset( $wpinv_options[ $args['id'] ] ) )
1106
-			$checked = true;
1103
+		if ( isset( $wpinv_options[ $args['id'] ] ) && $wpinv_options[ $args['id'] ] == $key ) {
1104
+					$checked = true;
1105
+		} elseif( isset( $args['std'] ) && $args['std'] == $key && ! isset( $wpinv_options[ $args['id'] ] ) ) {
1106
+					$checked = true;
1107
+		}
1107 1108
 
1108 1109
 		echo '<input name="wpinv_settings[' . $sanitize_id . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="radio" value="' . $sanitize_key . '" ' . checked(true, $checked, false) . '/>&nbsp;';
1109 1110
 		echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html( $option ) . '</label><br/>';
@@ -1120,10 +1121,11 @@  discard block
 block discarded – undo
1120 1121
 	foreach ( $args['options'] as $key => $option ) :
1121 1122
 		$sanitize_key = wpinv_sanitize_key( $key );
1122 1123
         
1123
-        if ( isset( $wpinv_options['gateways'][ $key ] ) )
1124
-			$enabled = '1';
1125
-		else
1126
-			$enabled = null;
1124
+        if ( isset( $wpinv_options['gateways'][ $key ] ) ) {
1125
+        			$enabled = '1';
1126
+        } else {
1127
+					$enabled = null;
1128
+		}
1127 1129
 
1128 1130
 		echo '<input name="wpinv_settings[' . esc_attr( $args['id'] ) . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="1" ' . checked('1', $enabled, false) . '/>&nbsp;';
1129 1131
 		echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html( $option['admin_label'] ) . '</label><br/>';
@@ -1487,7 +1489,8 @@  discard block
 block discarded – undo
1487 1489
 				<td class="wpinv_tax_action"><span class="wpinv_remove_tax_rate button-secondary"><?php _e( 'Remove Rate', 'invoicing' ); ?></span></td>
1488 1490
 			</tr>
1489 1491
 			<?php endforeach; ?>
1490
-		<?php else : ?>
1492
+		<?php else {
1493
+    : ?>
1491 1494
 			<tr>
1492 1495
 				<td class="wpinv_tax_country">
1493 1496
 					<?php
@@ -1498,7 +1501,9 @@  discard block
 block discarded – undo
1498 1501
 						'show_option_none' => false,
1499 1502
 						'class'            => 'wpinv-tax-country wpi_select2',
1500 1503
 						'placeholder'      => __( 'Choose a country', 'invoicing' )
1501
-					) ); ?>
1504
+					) );
1505
+}
1506
+?>
1502 1507
 				</td>
1503 1508
 				<td class="wpinv_tax_state">
1504 1509
 					<?php echo wpinv_html_text( array(
Please login to merge, or discard this patch.
Indentation   +338 added lines, -338 removed lines patch added patch discarded remove patch
@@ -196,11 +196,11 @@  discard block
 block discarded – undo
196 196
     $cb      = "wpinv_{$option['type']}_callback";
197 197
     $section = "wpinv_settings_{$tab}_$section";
198 198
 
199
-	if ( isset( $option['desc'] ) && ! empty( $option['help-tip'] ) ) {
200
-		$tip   = esc_attr( $option['desc'] );
201
-		$name .= "<span class='dashicons dashicons-editor-help wpi-help-tip' title='$tip'></span>";
202
-		unset( $option['desc'] );
203
-	}
199
+    if ( isset( $option['desc'] ) && ! empty( $option['help-tip'] ) ) {
200
+        $tip   = esc_attr( $option['desc'] );
201
+        $name .= "<span class='dashicons dashicons-editor-help wpi-help-tip' title='$tip'></span>";
202
+        unset( $option['desc'] );
203
+    }
204 204
 
205 205
     // Loop through all tabs.
206 206
     add_settings_field(
@@ -425,333 +425,333 @@  discard block
 block discarded – undo
425 425
 }
426 426
 
427 427
 function wpinv_get_pages( $with_slug = false, $default_label = NULL ) {
428
-	$pages_options = array();
428
+    $pages_options = array();
429 429
 
430
-	if( $default_label !== NULL && $default_label !== false ) {
431
-		$pages_options = array( '' => $default_label ); // Blank option
432
-	}
430
+    if( $default_label !== NULL && $default_label !== false ) {
431
+        $pages_options = array( '' => $default_label ); // Blank option
432
+    }
433 433
 
434
-	$pages = get_pages();
435
-	if ( $pages ) {
436
-		foreach ( $pages as $page ) {
437
-			$title = $with_slug ? $page->post_title . ' (' . $page->post_name . ')' : $page->post_title;
434
+    $pages = get_pages();
435
+    if ( $pages ) {
436
+        foreach ( $pages as $page ) {
437
+            $title = $with_slug ? $page->post_title . ' (' . $page->post_name . ')' : $page->post_title;
438 438
             $pages_options[ $page->ID ] = $title;
439
-		}
440
-	}
439
+        }
440
+    }
441 441
 
442
-	return $pages_options;
442
+    return $pages_options;
443 443
 }
444 444
 
445 445
 function wpinv_header_callback( $args ) {
446
-	if ( !empty( $args['desc'] ) ) {
446
+    if ( !empty( $args['desc'] ) ) {
447 447
         echo $args['desc'];
448 448
     }
449 449
 }
450 450
 
451 451
 function wpinv_hidden_callback( $args ) {
452
-	global $wpinv_options;
453
-
454
-	if ( isset( $args['set_value'] ) ) {
455
-		$value = $args['set_value'];
456
-	} elseif ( isset( $wpinv_options[ $args['id'] ] ) ) {
457
-		$value = $wpinv_options[ $args['id'] ];
458
-	} else {
459
-		$value = isset( $args['std'] ) ? $args['std'] : '';
460
-	}
461
-
462
-	if ( isset( $args['faux'] ) && true === $args['faux'] ) {
463
-		$args['readonly'] = true;
464
-		$value = isset( $args['std'] ) ? $args['std'] : '';
465
-		$name  = '';
466
-	} else {
467
-		$name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"';
468
-	}
469
-
470
-	$html = '<input type="hidden" id="wpinv_settings[' . wpinv_sanitize_key( $args['id'] ) . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '" />';
452
+    global $wpinv_options;
453
+
454
+    if ( isset( $args['set_value'] ) ) {
455
+        $value = $args['set_value'];
456
+    } elseif ( isset( $wpinv_options[ $args['id'] ] ) ) {
457
+        $value = $wpinv_options[ $args['id'] ];
458
+    } else {
459
+        $value = isset( $args['std'] ) ? $args['std'] : '';
460
+    }
461
+
462
+    if ( isset( $args['faux'] ) && true === $args['faux'] ) {
463
+        $args['readonly'] = true;
464
+        $value = isset( $args['std'] ) ? $args['std'] : '';
465
+        $name  = '';
466
+    } else {
467
+        $name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"';
468
+    }
469
+
470
+    $html = '<input type="hidden" id="wpinv_settings[' . wpinv_sanitize_key( $args['id'] ) . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '" />';
471 471
     
472
-	echo $html;
472
+    echo $html;
473 473
 }
474 474
 
475 475
 function wpinv_checkbox_callback( $args ) {
476
-	global $wpinv_options;
476
+    global $wpinv_options;
477 477
     
478 478
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
479 479
 
480
-	if ( isset( $args['faux'] ) && true === $args['faux'] ) {
481
-		$name = '';
482
-	} else {
483
-		$name = 'name="wpinv_settings[' . $sanitize_id . ']"';
484
-	}
480
+    if ( isset( $args['faux'] ) && true === $args['faux'] ) {
481
+        $name = '';
482
+    } else {
483
+        $name = 'name="wpinv_settings[' . $sanitize_id . ']"';
484
+    }
485 485
 
486
-	$std     = isset( $args['std'] ) ? $args['std'] : 0;
487
-	$value   = isset( $wpinv_options[ $args['id'] ] ) ? $wpinv_options[ $args['id'] ] : $std;
488
-	$checked = checked( empty( $value ), false, false );
486
+    $std     = isset( $args['std'] ) ? $args['std'] : 0;
487
+    $value   = isset( $wpinv_options[ $args['id'] ] ) ? $wpinv_options[ $args['id'] ] : $std;
488
+    $checked = checked( empty( $value ), false, false );
489 489
 
490
-	$html = '<input type="checkbox" id="wpinv_settings[' . $sanitize_id . ']"' . $name . ' value="1" ' . $checked . '/>';
491
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
490
+    $html = '<input type="checkbox" id="wpinv_settings[' . $sanitize_id . ']"' . $name . ' value="1" ' . $checked . '/>';
491
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
492 492
 
493
-	echo $html;
493
+    echo $html;
494 494
 }
495 495
 
496 496
 function wpinv_multicheck_callback( $args ) {
497
-	global $wpinv_options;
497
+    global $wpinv_options;
498 498
 
499
-	$sanitize_id = wpinv_sanitize_key( $args['id'] );
500
-	$class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : '';
499
+    $sanitize_id = wpinv_sanitize_key( $args['id'] );
500
+    $class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : '';
501 501
 
502
-	if ( ! empty( $args['options'] ) ) {
502
+    if ( ! empty( $args['options'] ) ) {
503 503
 
504
-		$std     = isset( $args['std'] ) ? $args['std'] : array();
505
-		$value   = isset( $wpinv_options[ $args['id'] ] ) ? $wpinv_options[ $args['id'] ] : $std;
504
+        $std     = isset( $args['std'] ) ? $args['std'] : array();
505
+        $value   = isset( $wpinv_options[ $args['id'] ] ) ? $wpinv_options[ $args['id'] ] : $std;
506 506
 
507
-		echo '<div class="wpi-mcheck-rows wpi-mcheck-' . $sanitize_id . $class . '">';
507
+        echo '<div class="wpi-mcheck-rows wpi-mcheck-' . $sanitize_id . $class . '">';
508 508
         foreach( $args['options'] as $key => $option ):
509
-			$sanitize_key = wpinv_sanitize_key( $key );
510
-			if ( in_array( $sanitize_key, $value ) ) { 
511
-				$enabled = $sanitize_key;
512
-			} else { 
513
-				$enabled = NULL; 
514
-			}
515
-			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;';
516
-			echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . wp_kses_post( $option ) . '</label></div>';
517
-		endforeach;
518
-		echo '</div>';
519
-		echo '<p class="description">' . $args['desc'] . '</p>';
520
-	}
509
+            $sanitize_key = wpinv_sanitize_key( $key );
510
+            if ( in_array( $sanitize_key, $value ) ) { 
511
+                $enabled = $sanitize_key;
512
+            } else { 
513
+                $enabled = NULL; 
514
+            }
515
+            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;';
516
+            echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . wp_kses_post( $option ) . '</label></div>';
517
+        endforeach;
518
+        echo '</div>';
519
+        echo '<p class="description">' . $args['desc'] . '</p>';
520
+    }
521 521
 }
522 522
 
523 523
 function wpinv_payment_icons_callback( $args ) {
524
-	global $wpinv_options;
524
+    global $wpinv_options;
525 525
     
526 526
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
527 527
 
528
-	if ( ! empty( $args['options'] ) ) {
529
-		foreach( $args['options'] as $key => $option ) {
528
+    if ( ! empty( $args['options'] ) ) {
529
+        foreach( $args['options'] as $key => $option ) {
530 530
             $sanitize_key = wpinv_sanitize_key( $key );
531 531
             
532
-			if( isset( $wpinv_options[$args['id']][$key] ) ) {
533
-				$enabled = $option;
534
-			} else {
535
-				$enabled = NULL;
536
-			}
537
-
538
-			echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" style="margin-right:10px;line-height:16px;height:16px;display:inline-block;">';
539
-
540
-				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;';
541
-
542
-				if ( wpinv_string_is_image_url( $key ) ) {
543
-					echo '<img class="payment-icon" src="' . esc_url( $key ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
544
-				} else {
545
-					$card = strtolower( str_replace( ' ', '', $option ) );
546
-
547
-					if ( has_filter( 'wpinv_accepted_payment_' . $card . '_image' ) ) {
548
-						$image = apply_filters( 'wpinv_accepted_payment_' . $card . '_image', '' );
549
-					} else {
550
-						$image       = wpinv_locate_template( 'images' . DIRECTORY_SEPARATOR . 'icons' . DIRECTORY_SEPARATOR . $card . '.gif', false );
551
-						$content_dir = WP_CONTENT_DIR;
552
-
553
-						if ( function_exists( 'wp_normalize_path' ) ) {
554
-							// Replaces backslashes with forward slashes for Windows systems
555
-							$image = wp_normalize_path( $image );
556
-							$content_dir = wp_normalize_path( $content_dir );
557
-						}
558
-
559
-						$image = str_replace( $content_dir, content_url(), $image );
560
-					}
561
-
562
-					echo '<img class="payment-icon" src="' . esc_url( $image ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
563
-				}
564
-			echo $option . '</label>';
565
-		}
566
-		echo '<p class="description" style="margin-top:16px;">' . wp_kses_post( $args['desc'] ) . '</p>';
567
-	}
532
+            if( isset( $wpinv_options[$args['id']][$key] ) ) {
533
+                $enabled = $option;
534
+            } else {
535
+                $enabled = NULL;
536
+            }
537
+
538
+            echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" style="margin-right:10px;line-height:16px;height:16px;display:inline-block;">';
539
+
540
+                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;';
541
+
542
+                if ( wpinv_string_is_image_url( $key ) ) {
543
+                    echo '<img class="payment-icon" src="' . esc_url( $key ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
544
+                } else {
545
+                    $card = strtolower( str_replace( ' ', '', $option ) );
546
+
547
+                    if ( has_filter( 'wpinv_accepted_payment_' . $card . '_image' ) ) {
548
+                        $image = apply_filters( 'wpinv_accepted_payment_' . $card . '_image', '' );
549
+                    } else {
550
+                        $image       = wpinv_locate_template( 'images' . DIRECTORY_SEPARATOR . 'icons' . DIRECTORY_SEPARATOR . $card . '.gif', false );
551
+                        $content_dir = WP_CONTENT_DIR;
552
+
553
+                        if ( function_exists( 'wp_normalize_path' ) ) {
554
+                            // Replaces backslashes with forward slashes for Windows systems
555
+                            $image = wp_normalize_path( $image );
556
+                            $content_dir = wp_normalize_path( $content_dir );
557
+                        }
558
+
559
+                        $image = str_replace( $content_dir, content_url(), $image );
560
+                    }
561
+
562
+                    echo '<img class="payment-icon" src="' . esc_url( $image ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
563
+                }
564
+            echo $option . '</label>';
565
+        }
566
+        echo '<p class="description" style="margin-top:16px;">' . wp_kses_post( $args['desc'] ) . '</p>';
567
+    }
568 568
 }
569 569
 
570 570
 function wpinv_radio_callback( $args ) {
571
-	global $wpinv_options;
571
+    global $wpinv_options;
572 572
     
573 573
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
574 574
     
575 575
     foreach ( $args['options'] as $key => $option ) :
576
-		$sanitize_key = wpinv_sanitize_key( $key );
576
+        $sanitize_key = wpinv_sanitize_key( $key );
577 577
         
578 578
         $checked = false;
579 579
 
580
-		if ( isset( $wpinv_options[ $args['id'] ] ) && $wpinv_options[ $args['id'] ] == $key )
581
-			$checked = true;
582
-		elseif( isset( $args['std'] ) && $args['std'] == $key && ! isset( $wpinv_options[ $args['id'] ] ) )
583
-			$checked = true;
580
+        if ( isset( $wpinv_options[ $args['id'] ] ) && $wpinv_options[ $args['id'] ] == $key )
581
+            $checked = true;
582
+        elseif( isset( $args['std'] ) && $args['std'] == $key && ! isset( $wpinv_options[ $args['id'] ] ) )
583
+            $checked = true;
584 584
 
585
-		echo '<input name="wpinv_settings[' . $sanitize_id . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="radio" value="' . $sanitize_key . '" ' . checked(true, $checked, false) . '/>&nbsp;';
586
-		echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html( $option ) . '</label><br/>';
587
-	endforeach;
585
+        echo '<input name="wpinv_settings[' . $sanitize_id . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="radio" value="' . $sanitize_key . '" ' . checked(true, $checked, false) . '/>&nbsp;';
586
+        echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html( $option ) . '</label><br/>';
587
+    endforeach;
588 588
 
589
-	echo '<p class="description">' . wp_kses_post( $args['desc'] ) . '</p>';
589
+    echo '<p class="description">' . wp_kses_post( $args['desc'] ) . '</p>';
590 590
 }
591 591
 
592 592
 function wpinv_gateways_callback( $args ) {
593
-	global $wpinv_options;
593
+    global $wpinv_options;
594 594
     
595 595
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
596 596
 
597
-	foreach ( $args['options'] as $key => $option ) :
598
-		$sanitize_key = wpinv_sanitize_key( $key );
597
+    foreach ( $args['options'] as $key => $option ) :
598
+        $sanitize_key = wpinv_sanitize_key( $key );
599 599
         
600 600
         if ( isset( $wpinv_options['gateways'][ $key ] ) )
601
-			$enabled = '1';
602
-		else
603
-			$enabled = null;
601
+            $enabled = '1';
602
+        else
603
+            $enabled = null;
604 604
 
605
-		echo '<input name="wpinv_settings[' . esc_attr( $args['id'] ) . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="1" ' . checked('1', $enabled, false) . '/>&nbsp;';
606
-		echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html( $option['admin_label'] ) . '</label><br/>';
607
-	endforeach;
605
+        echo '<input name="wpinv_settings[' . esc_attr( $args['id'] ) . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="1" ' . checked('1', $enabled, false) . '/>&nbsp;';
606
+        echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html( $option['admin_label'] ) . '</label><br/>';
607
+    endforeach;
608 608
 }
609 609
 
610 610
 function wpinv_gateway_select_callback($args) {
611
-	global $wpinv_options;
611
+    global $wpinv_options;
612 612
     
613 613
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
614 614
     $class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : '';
615 615
 
616
-	echo '<select name="wpinv_settings[' . $sanitize_id . ']"" id="wpinv_settings[' . $sanitize_id . ']" class="'.$class.'" >';
616
+    echo '<select name="wpinv_settings[' . $sanitize_id . ']"" id="wpinv_settings[' . $sanitize_id . ']" class="'.$class.'" >';
617 617
 
618
-	foreach ( $args['options'] as $key => $option ) :
619
-		if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) {
618
+    foreach ( $args['options'] as $key => $option ) :
619
+        if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) {
620 620
             $selected = selected( $key, $args['selected'], false );
621 621
         } else {
622 622
             $selected = isset( $wpinv_options[ $args['id'] ] ) ? selected( $key, $wpinv_options[$args['id']], false ) : '';
623 623
         }
624
-		echo '<option value="' . wpinv_sanitize_key( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>';
625
-	endforeach;
624
+        echo '<option value="' . wpinv_sanitize_key( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>';
625
+    endforeach;
626 626
 
627
-	echo '</select>';
628
-	echo '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
627
+    echo '</select>';
628
+    echo '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
629 629
 }
630 630
 
631 631
 function wpinv_text_callback( $args ) {
632
-	global $wpinv_options;
632
+    global $wpinv_options;
633 633
     
634 634
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
635 635
 
636
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
637
-		$value = $wpinv_options[ $args['id'] ];
638
-	} else {
639
-		$value = isset( $args['std'] ) ? $args['std'] : '';
640
-	}
641
-
642
-	if ( isset( $args['faux'] ) && true === $args['faux'] ) {
643
-		$args['readonly'] = true;
644
-		$value = isset( $args['std'] ) ? $args['std'] : '';
645
-		$name  = '';
646
-	} else {
647
-		$name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"';
648
-	}
649
-	$class = !empty( $args['class'] ) ? sanitize_html_class( $args['class'] ) : '';
650
-
651
-	$readonly = $args['readonly'] === true ? ' readonly="readonly"' : '';
652
-	$size     = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
653
-	$html     = '<input type="text" class="' . sanitize_html_class( $size ) . '-text ' . $class . '" id="wpinv_settings[' . $sanitize_id . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '"' . $readonly . '/>';
654
-	$html    .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
655
-
656
-	echo $html;
636
+    if ( isset( $wpinv_options[ $args['id'] ] ) ) {
637
+        $value = $wpinv_options[ $args['id'] ];
638
+    } else {
639
+        $value = isset( $args['std'] ) ? $args['std'] : '';
640
+    }
641
+
642
+    if ( isset( $args['faux'] ) && true === $args['faux'] ) {
643
+        $args['readonly'] = true;
644
+        $value = isset( $args['std'] ) ? $args['std'] : '';
645
+        $name  = '';
646
+    } else {
647
+        $name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"';
648
+    }
649
+    $class = !empty( $args['class'] ) ? sanitize_html_class( $args['class'] ) : '';
650
+
651
+    $readonly = $args['readonly'] === true ? ' readonly="readonly"' : '';
652
+    $size     = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
653
+    $html     = '<input type="text" class="' . sanitize_html_class( $size ) . '-text ' . $class . '" id="wpinv_settings[' . $sanitize_id . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '"' . $readonly . '/>';
654
+    $html    .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
655
+
656
+    echo $html;
657 657
 }
658 658
 
659 659
 function wpinv_number_callback( $args ) {
660
-	global $wpinv_options;
660
+    global $wpinv_options;
661 661
     
662 662
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
663 663
 
664
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
665
-		$value = $wpinv_options[ $args['id'] ];
666
-	} else {
667
-		$value = isset( $args['std'] ) ? $args['std'] : '';
668
-	}
669
-
670
-	if ( isset( $args['faux'] ) && true === $args['faux'] ) {
671
-		$args['readonly'] = true;
672
-		$value = isset( $args['std'] ) ? $args['std'] : '';
673
-		$name  = '';
674
-	} else {
675
-		$name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"';
676
-	}
677
-
678
-	$max  = isset( $args['max'] ) ? $args['max'] : 999999;
679
-	$min  = isset( $args['min'] ) ? $args['min'] : 0;
680
-	$step = isset( $args['step'] ) ? $args['step'] : 1;
681
-	$class = !empty( $args['class'] ) ? sanitize_html_class( $args['class'] ) : '';
682
-
683
-	$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
684
-	$html = '<input type="number" step="' . esc_attr( $step ) . '" max="' . esc_attr( $max ) . '" min="' . esc_attr( $min ) . '" class="' . sanitize_html_class( $size ) . '-text ' . $class . '" id="wpinv_settings[' . $sanitize_id . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '"/>';
685
-	$html .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
686
-
687
-	echo $html;
664
+    if ( isset( $wpinv_options[ $args['id'] ] ) ) {
665
+        $value = $wpinv_options[ $args['id'] ];
666
+    } else {
667
+        $value = isset( $args['std'] ) ? $args['std'] : '';
668
+    }
669
+
670
+    if ( isset( $args['faux'] ) && true === $args['faux'] ) {
671
+        $args['readonly'] = true;
672
+        $value = isset( $args['std'] ) ? $args['std'] : '';
673
+        $name  = '';
674
+    } else {
675
+        $name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"';
676
+    }
677
+
678
+    $max  = isset( $args['max'] ) ? $args['max'] : 999999;
679
+    $min  = isset( $args['min'] ) ? $args['min'] : 0;
680
+    $step = isset( $args['step'] ) ? $args['step'] : 1;
681
+    $class = !empty( $args['class'] ) ? sanitize_html_class( $args['class'] ) : '';
682
+
683
+    $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
684
+    $html = '<input type="number" step="' . esc_attr( $step ) . '" max="' . esc_attr( $max ) . '" min="' . esc_attr( $min ) . '" class="' . sanitize_html_class( $size ) . '-text ' . $class . '" id="wpinv_settings[' . $sanitize_id . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '"/>';
685
+    $html .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
686
+
687
+    echo $html;
688 688
 }
689 689
 
690 690
 function wpinv_textarea_callback( $args ) {
691
-	global $wpinv_options;
691
+    global $wpinv_options;
692 692
     
693 693
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
694 694
 
695
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
696
-		$value = $wpinv_options[ $args['id'] ];
697
-	} else {
698
-		$value = isset( $args['std'] ) ? $args['std'] : '';
699
-	}
695
+    if ( isset( $wpinv_options[ $args['id'] ] ) ) {
696
+        $value = $wpinv_options[ $args['id'] ];
697
+    } else {
698
+        $value = isset( $args['std'] ) ? $args['std'] : '';
699
+    }
700 700
     
701 701
     $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
702 702
     $class = ( isset( $args['class'] ) && ! is_null( $args['class'] ) ) ? $args['class'] : 'large-text';
703 703
 
704
-	$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>';
705
-	$html .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
704
+    $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>';
705
+    $html .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
706 706
 
707
-	echo $html;
707
+    echo $html;
708 708
 }
709 709
 
710 710
 function wpinv_password_callback( $args ) {
711
-	global $wpinv_options;
711
+    global $wpinv_options;
712 712
     
713 713
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
714 714
 
715
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
716
-		$value = $wpinv_options[ $args['id'] ];
717
-	} else {
718
-		$value = isset( $args['std'] ) ? $args['std'] : '';
719
-	}
715
+    if ( isset( $wpinv_options[ $args['id'] ] ) ) {
716
+        $value = $wpinv_options[ $args['id'] ];
717
+    } else {
718
+        $value = isset( $args['std'] ) ? $args['std'] : '';
719
+    }
720 720
 
721
-	$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
722
-	$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 ) . '"/>';
723
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
721
+    $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
722
+    $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 ) . '"/>';
723
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
724 724
 
725
-	echo $html;
725
+    echo $html;
726 726
 }
727 727
 
728 728
 function wpinv_missing_callback($args) {
729
-	printf(
730
-		__( 'The callback function used for the %s setting is missing.', 'invoicing' ),
731
-		'<strong>' . $args['id'] . '</strong>'
732
-	);
729
+    printf(
730
+        __( 'The callback function used for the %s setting is missing.', 'invoicing' ),
731
+        '<strong>' . $args['id'] . '</strong>'
732
+    );
733 733
 }
734 734
 
735 735
 function wpinv_select_callback($args) {
736
-	global $wpinv_options;
736
+    global $wpinv_options;
737 737
     
738 738
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
739 739
 
740
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
741
-		$value = $wpinv_options[ $args['id'] ];
742
-	} else {
743
-		$value = isset( $args['std'] ) ? $args['std'] : '';
744
-	}
740
+    if ( isset( $wpinv_options[ $args['id'] ] ) ) {
741
+        $value = $wpinv_options[ $args['id'] ];
742
+    } else {
743
+        $value = isset( $args['std'] ) ? $args['std'] : '';
744
+    }
745 745
     
746 746
     if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) {
747 747
         $value = $args['selected'];
748 748
     }
749 749
 
750
-	if ( isset( $args['placeholder'] ) ) {
751
-		$placeholder = $args['placeholder'];
752
-	} else {
753
-		$placeholder = '';
754
-	}
750
+    if ( isset( $args['placeholder'] ) ) {
751
+        $placeholder = $args['placeholder'];
752
+    } else {
753
+        $placeholder = '';
754
+    }
755 755
     
756 756
     if( !empty( $args['onchange'] ) ) {
757 757
         $onchange = ' onchange="' . esc_attr( $args['onchange'] ) . '"';
@@ -761,143 +761,143 @@  discard block
 block discarded – undo
761 761
 
762 762
     $class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : '';
763 763
 
764
-	$html = '<select id="wpinv_settings[' . $sanitize_id . ']" class="'.$class.'"  name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" data-placeholder="' . esc_html( $placeholder ) . '"' . $onchange . ' />';
764
+    $html = '<select id="wpinv_settings[' . $sanitize_id . ']" class="'.$class.'"  name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" data-placeholder="' . esc_html( $placeholder ) . '"' . $onchange . ' />';
765 765
 
766
-	foreach ( $args['options'] as $option => $name ) {
767
-		$selected = selected( $option, $value, false );
768
-		$html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>';
769
-	}
766
+    foreach ( $args['options'] as $option => $name ) {
767
+        $selected = selected( $option, $value, false );
768
+        $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>';
769
+    }
770 770
 
771
-	$html .= '</select>';
772
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
771
+    $html .= '</select>';
772
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
773 773
 
774
-	echo $html;
774
+    echo $html;
775 775
 }
776 776
 
777 777
 function wpinv_color_select_callback( $args ) {
778
-	global $wpinv_options;
778
+    global $wpinv_options;
779 779
     
780 780
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
781 781
 
782
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
783
-		$value = $wpinv_options[ $args['id'] ];
784
-	} else {
785
-		$value = isset( $args['std'] ) ? $args['std'] : '';
786
-	}
782
+    if ( isset( $wpinv_options[ $args['id'] ] ) ) {
783
+        $value = $wpinv_options[ $args['id'] ];
784
+    } else {
785
+        $value = isset( $args['std'] ) ? $args['std'] : '';
786
+    }
787 787
 
788
-	$html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"/>';
788
+    $html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"/>';
789 789
 
790
-	foreach ( $args['options'] as $option => $color ) {
791
-		$selected = selected( $option, $value, false );
792
-		$html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $color['label'] ) . '</option>';
793
-	}
790
+    foreach ( $args['options'] as $option => $color ) {
791
+        $selected = selected( $option, $value, false );
792
+        $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $color['label'] ) . '</option>';
793
+    }
794 794
 
795
-	$html .= '</select>';
796
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
795
+    $html .= '</select>';
796
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
797 797
 
798
-	echo $html;
798
+    echo $html;
799 799
 }
800 800
 
801 801
 function wpinv_rich_editor_callback( $args ) {
802
-	global $wpinv_options, $wp_version;
802
+    global $wpinv_options, $wp_version;
803 803
     
804 804
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
805 805
 
806
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
807
-		$value = $wpinv_options[ $args['id'] ];
806
+    if ( isset( $wpinv_options[ $args['id'] ] ) ) {
807
+        $value = $wpinv_options[ $args['id'] ];
808 808
 
809
-		if( empty( $args['allow_blank'] ) && empty( $value ) ) {
810
-			$value = isset( $args['std'] ) ? $args['std'] : '';
811
-		}
812
-	} else {
813
-		$value = isset( $args['std'] ) ? $args['std'] : '';
814
-	}
809
+        if( empty( $args['allow_blank'] ) && empty( $value ) ) {
810
+            $value = isset( $args['std'] ) ? $args['std'] : '';
811
+        }
812
+    } else {
813
+        $value = isset( $args['std'] ) ? $args['std'] : '';
814
+    }
815 815
 
816
-	$rows = isset( $args['size'] ) ? $args['size'] : 20;
816
+    $rows = isset( $args['size'] ) ? $args['size'] : 20;
817 817
 
818
-	$html = '<div class="getpaid-settings-editor-input">';
819
-	if ( $wp_version >= 3.3 && function_exists( 'wp_editor' ) ) {
820
-		ob_start();
821
-		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 ) );
822
-		$html .= ob_get_clean();
823
-	} else {
824
-		$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>';
825
-	}
818
+    $html = '<div class="getpaid-settings-editor-input">';
819
+    if ( $wp_version >= 3.3 && function_exists( 'wp_editor' ) ) {
820
+        ob_start();
821
+        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 ) );
822
+        $html .= ob_get_clean();
823
+    } else {
824
+        $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>';
825
+    }
826 826
 
827
-	$html .= '</div><br/><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
827
+    $html .= '</div><br/><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
828 828
 
829
-	echo $html;
829
+    echo $html;
830 830
 }
831 831
 
832 832
 function wpinv_upload_callback( $args ) {
833
-	global $wpinv_options;
833
+    global $wpinv_options;
834 834
     
835 835
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
836 836
 
837
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
838
-		$value = $wpinv_options[$args['id']];
839
-	} else {
840
-		$value = isset($args['std']) ? $args['std'] : '';
841
-	}
837
+    if ( isset( $wpinv_options[ $args['id'] ] ) ) {
838
+        $value = $wpinv_options[$args['id']];
839
+    } else {
840
+        $value = isset($args['std']) ? $args['std'] : '';
841
+    }
842 842
 
843
-	$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
844
-	$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 ) ) . '"/>';
845
-	$html .= '<span>&nbsp;<input type="button" class="wpinv_settings_upload_button button-secondary" value="' . __( 'Upload File', 'invoicing' ) . '"/></span>';
846
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
843
+    $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
844
+    $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 ) ) . '"/>';
845
+    $html .= '<span>&nbsp;<input type="button" class="wpinv_settings_upload_button button-secondary" value="' . __( 'Upload File', 'invoicing' ) . '"/></span>';
846
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
847 847
 
848
-	echo $html;
848
+    echo $html;
849 849
 }
850 850
 
851 851
 function wpinv_color_callback( $args ) {
852
-	global $wpinv_options;
852
+    global $wpinv_options;
853 853
     
854 854
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
855 855
 
856
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
857
-		$value = $wpinv_options[ $args['id'] ];
858
-	} else {
859
-		$value = isset( $args['std'] ) ? $args['std'] : '';
860
-	}
856
+    if ( isset( $wpinv_options[ $args['id'] ] ) ) {
857
+        $value = $wpinv_options[ $args['id'] ];
858
+    } else {
859
+        $value = isset( $args['std'] ) ? $args['std'] : '';
860
+    }
861 861
 
862
-	$default = isset( $args['std'] ) ? $args['std'] : '';
862
+    $default = isset( $args['std'] ) ? $args['std'] : '';
863 863
 
864
-	$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( $default ) . '" />';
865
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
864
+    $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( $default ) . '" />';
865
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
866 866
 
867
-	echo $html;
867
+    echo $html;
868 868
 }
869 869
 
870 870
 function wpinv_country_states_callback($args) {
871
-	global $wpinv_options;
871
+    global $wpinv_options;
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 = isset( $wpinv_options[ $args['id'] ] ) ? selected( $option, $wpinv_options[$args['id']], false ) : '';
888
-		$html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>';
889
-	}
886
+    foreach ( $states as $option => $name ) {
887
+        $selected = isset( $wpinv_options[ $args['id'] ] ) ? selected( $option, $wpinv_options[$args['id']], 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
 function wpinv_tax_rates_callback($args) {
898
-	global $wpinv_options;
899
-	$rates = wpinv_get_tax_rates();
900
-	ob_start(); ?>
898
+    global $wpinv_options;
899
+    $rates = wpinv_get_tax_rates();
900
+    ob_start(); ?>
901 901
     </td><tr>
902 902
     <td colspan="2" class="wpinv_tax_tdbox">
903 903
 	<p><?php echo $args['desc']; ?></p>
@@ -921,40 +921,40 @@  discard block
 block discarded – undo
921 921
 			<tr>
922 922
 				<td class="wpinv_tax_country">
923 923
 					<?php
924
-					echo wpinv_html_select( array(
925
-						'options'          => wpinv_get_country_list( true ),
926
-						'name'             => 'tax_rates[' . $sanitized_key . '][country]',
924
+                    echo wpinv_html_select( array(
925
+                        'options'          => wpinv_get_country_list( true ),
926
+                        'name'             => 'tax_rates[' . $sanitized_key . '][country]',
927 927
                         'id'               => 'tax_rates[' . $sanitized_key . '][country]',
928
-						'selected'         => $rate['country'],
929
-						'show_option_all'  => false,
930
-						'show_option_none' => false,
931
-						'class'            => 'wpinv-tax-country wpi_select2',
932
-						'placeholder'      => __( 'Choose a country', 'invoicing' )
933
-					) );
934
-					?>
928
+                        'selected'         => $rate['country'],
929
+                        'show_option_all'  => false,
930
+                        'show_option_none' => false,
931
+                        'class'            => 'wpinv-tax-country wpi_select2',
932
+                        'placeholder'      => __( 'Choose a country', 'invoicing' )
933
+                    ) );
934
+                    ?>
935 935
 				</td>
936 936
 				<td class="wpinv_tax_state">
937 937
 					<?php
938
-					$states = wpinv_get_country_states( $rate['country'] );
939
-					if( !empty( $states ) ) {
940
-						echo wpinv_html_select( array(
941
-							'options'          => array_merge( array( '' => '' ), $states ),
942
-							'name'             => 'tax_rates[' . $sanitized_key . '][state]',
938
+                    $states = wpinv_get_country_states( $rate['country'] );
939
+                    if( !empty( $states ) ) {
940
+                        echo wpinv_html_select( array(
941
+                            'options'          => array_merge( array( '' => '' ), $states ),
942
+                            'name'             => 'tax_rates[' . $sanitized_key . '][state]',
943 943
                             'id'               => 'tax_rates[' . $sanitized_key . '][state]',
944
-							'selected'         => $rate['state'],
945
-							'show_option_all'  => false,
946
-							'show_option_none' => false,
944
+                            'selected'         => $rate['state'],
945
+                            'show_option_all'  => false,
946
+                            'show_option_none' => false,
947 947
                             'class'            => 'wpi_select2',
948
-							'placeholder'      => __( 'Choose a state', 'invoicing' )
949
-						) );
950
-					} else {
951
-						echo wpinv_html_text( array(
952
-							'name'  => 'tax_rates[' . $sanitized_key . '][state]', $rate['state'],
953
-							'value' => ! empty( $rate['state'] ) ? $rate['state'] : '',
948
+                            'placeholder'      => __( 'Choose a state', 'invoicing' )
949
+                        ) );
950
+                    } else {
951
+                        echo wpinv_html_text( array(
952
+                            'name'  => 'tax_rates[' . $sanitized_key . '][state]', $rate['state'],
953
+                            'value' => ! empty( $rate['state'] ) ? $rate['state'] : '',
954 954
                             'id'    => 'tax_rates[' . $sanitized_key . '][state]',
955
-						) );
956
-					}
957
-					?>
955
+                        ) );
956
+                    }
957
+                    ?>
958 958
 				</td>
959 959
 				<td class="wpinv_tax_global">
960 960
 					<input type="checkbox" name="tax_rates[<?php echo $sanitized_key; ?>][global]" id="tax_rates[<?php echo $sanitized_key; ?>][global]" value="1"<?php checked( true, ! empty( $rate['global'] ) ); ?>/>
@@ -969,19 +969,19 @@  discard block
 block discarded – undo
969 969
 			<tr>
970 970
 				<td class="wpinv_tax_country">
971 971
 					<?php
972
-					echo wpinv_html_select( array(
973
-						'options'          => wpinv_get_country_list( true ),
974
-						'name'             => 'tax_rates[0][country]',
975
-						'show_option_all'  => false,
976
-						'show_option_none' => false,
977
-						'class'            => 'wpinv-tax-country wpi_select2',
978
-						'placeholder'      => __( 'Choose a country', 'invoicing' )
979
-					) ); ?>
972
+                    echo wpinv_html_select( array(
973
+                        'options'          => wpinv_get_country_list( true ),
974
+                        'name'             => 'tax_rates[0][country]',
975
+                        'show_option_all'  => false,
976
+                        'show_option_none' => false,
977
+                        'class'            => 'wpinv-tax-country wpi_select2',
978
+                        'placeholder'      => __( 'Choose a country', 'invoicing' )
979
+                    ) ); ?>
980 980
 				</td>
981 981
 				<td class="wpinv_tax_state">
982 982
 					<?php echo wpinv_html_text( array(
983
-						'name' => 'tax_rates[0][state]'
984
-					) ); ?>
983
+                        'name' => 'tax_rates[0][state]'
984
+                    ) ); ?>
985 985
 				</td>
986 986
 				<td class="wpinv_tax_global">
987 987
 					<input type="checkbox" name="tax_rates[0][global]" id="tax_rates[0][global]" value="1"/>
@@ -996,7 +996,7 @@  discard block
 block discarded – undo
996 996
         <tfoot><tr><td colspan="5"></td><td class="wpinv_tax_action"><span class="button-secondary" id="wpinv_add_tax_rate"><?php _e( 'Add Tax Rate', 'invoicing' ); ?></span></td></tr></tfoot>
997 997
 	</table>
998 998
 	<?php
999
-	echo ob_get_clean();
999
+    echo ob_get_clean();
1000 1000
 }
1001 1001
 
1002 1002
 function wpinv_tools_callback($args) {
@@ -1024,15 +1024,15 @@  discard block
 block discarded – undo
1024 1024
 }
1025 1025
 
1026 1026
 function wpinv_descriptive_text_callback( $args ) {
1027
-	echo wp_kses_post( $args['desc'] );
1027
+    echo wp_kses_post( $args['desc'] );
1028 1028
 }
1029 1029
 
1030 1030
 function wpinv_hook_callback( $args ) {
1031
-	do_action( 'wpinv_' . $args['id'], $args );
1031
+    do_action( 'wpinv_' . $args['id'], $args );
1032 1032
 }
1033 1033
 
1034 1034
 function wpinv_set_settings_cap() {
1035
-	return wpinv_get_capability();
1035
+    return wpinv_get_capability();
1036 1036
 }
1037 1037
 add_filter( 'option_page_capability_wpinv_settings', 'wpinv_set_settings_cap' );
1038 1038
 
Please login to merge, or discard this patch.
Spacing   +396 added lines, -396 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  * @since   1.0.0
7 7
  */
8 8
 
9
-defined( 'ABSPATH' ) || exit;
9
+defined('ABSPATH') || exit;
10 10
 
11 11
 /**
12 12
  * Retrieves all default settings.
@@ -16,13 +16,13 @@  discard block
 block discarded – undo
16 16
 function wpinv_get_settings() {
17 17
     $defaults = array();
18 18
 
19
-    foreach ( array_values( wpinv_get_registered_settings() ) as $tab_settings ) {
19
+    foreach (array_values(wpinv_get_registered_settings()) as $tab_settings) {
20 20
 
21
-        foreach ( array_values( $tab_settings ) as $section_settings ) {
21
+        foreach (array_values($tab_settings) as $section_settings) {
22 22
 
23
-            foreach ( $section_settings as $key => $setting ) {
24
-                if ( isset( $setting['std'] ) ) {
25
-                    $defaults[ $key ] = $setting['std'];
23
+            foreach ($section_settings as $key => $setting) {
24
+                if (isset($setting['std'])) {
25
+                    $defaults[$key] = $setting['std'];
26 26
                 }
27 27
             }
28 28
 
@@ -43,12 +43,12 @@  discard block
 block discarded – undo
43 43
     global $wpinv_options;
44 44
 
45 45
     // Try fetching the saved options.
46
-    if ( ! is_array( $wpinv_options ) ) {
47
-        $wpinv_options = get_option( 'wpinv_settings' );
46
+    if (!is_array($wpinv_options)) {
47
+        $wpinv_options = get_option('wpinv_settings');
48 48
     }
49 49
 
50 50
     // If that fails, don't fetch the default settings to prevent a loop.
51
-    if ( ! is_array( $wpinv_options ) ) {
51
+    if (!is_array($wpinv_options)) {
52 52
         $wpinv_options = array();
53 53
     }
54 54
 
@@ -62,13 +62,13 @@  discard block
 block discarded – undo
62 62
  * @param mixed $default The default value to use if the setting has not been set.
63 63
  * @return mixed
64 64
  */
65
-function wpinv_get_option( $key = '', $default = false ) {
65
+function wpinv_get_option($key = '', $default = false) {
66 66
 
67 67
     $options = wpinv_get_options();
68
-    $value   = isset( $options[ $key ] ) ? $options[ $key ] : $default;
69
-    $value   = apply_filters( 'wpinv_get_option', $value, $key, $default );
68
+    $value   = isset($options[$key]) ? $options[$key] : $default;
69
+    $value   = apply_filters('wpinv_get_option', $value, $key, $default);
70 70
 
71
-    return apply_filters( 'wpinv_get_option_' . $key, $value, $key, $default );
71
+    return apply_filters('wpinv_get_option_' . $key, $value, $key, $default);
72 72
 }
73 73
 
74 74
 /**
@@ -77,11 +77,11 @@  discard block
 block discarded – undo
77 77
  * @param array $options the new options.
78 78
  * @return bool
79 79
  */
80
-function wpinv_update_options( $options ) {
80
+function wpinv_update_options($options) {
81 81
     global $wpinv_options;
82 82
 
83 83
     // update the option.
84
-    if ( is_array( $options ) && update_option( 'wpinv_settings', $options ) ) {
84
+    if (is_array($options) && update_option('wpinv_settings', $options)) {
85 85
         $wpinv_options = $options;
86 86
         return true;
87 87
     }
@@ -96,24 +96,24 @@  discard block
 block discarded – undo
96 96
  * @param mixed $value The setting value.
97 97
  * @return bool
98 98
  */
99
-function wpinv_update_option( $key = '', $value = false ) {
99
+function wpinv_update_option($key = '', $value = false) {
100 100
 
101 101
     // If no key, exit.
102
-    if ( empty( $key ) ) {
102
+    if (empty($key)) {
103 103
         return false;
104 104
     }
105 105
 
106 106
     // Maybe delete the option instead.
107
-    if ( is_null( $value ) ) {
108
-        return wpinv_delete_option( $key );
107
+    if (is_null($value)) {
108
+        return wpinv_delete_option($key);
109 109
     }
110 110
 
111 111
     // Prepare the new options.
112 112
     $options         = wpinv_get_options();
113
-    $options[ $key ] = apply_filters( 'wpinv_update_option', $value, $key );
113
+    $options[$key] = apply_filters('wpinv_update_option', $value, $key);
114 114
 
115 115
     // Save the new options.
116
-    return wpinv_update_options( $options );
116
+    return wpinv_update_options($options);
117 117
 
118 118
 }
119 119
 
@@ -123,18 +123,18 @@  discard block
 block discarded – undo
123 123
  * @param string $key the setting key.
124 124
  * @return bool
125 125
  */
126
-function wpinv_delete_option( $key = '' ) {
126
+function wpinv_delete_option($key = '') {
127 127
 
128 128
     // If no key, exit
129
-    if ( empty( $key ) ) {
129
+    if (empty($key)) {
130 130
         return false;
131 131
     }
132 132
 
133 133
     $options = wpinv_get_options();
134 134
 
135
-    if ( isset( $options[ $key ] ) ) {
136
-        unset( $options[ $key ] );
137
-        return wpinv_update_options( $options );
135
+    if (isset($options[$key])) {
136
+        unset($options[$key]);
137
+        return wpinv_update_options($options);
138 138
     }
139 139
 
140 140
     return true;
@@ -148,14 +148,14 @@  discard block
 block discarded – undo
148 148
 function wpinv_register_settings() {
149 149
 
150 150
     // Loop through all tabs.
151
-    foreach ( wpinv_get_registered_settings() as $tab => $sections ) {
151
+    foreach (wpinv_get_registered_settings() as $tab => $sections) {
152 152
 
153 153
         // In each tab, loop through sections.
154
-        foreach ( $sections as $section => $settings ) {
154
+        foreach ($sections as $section => $settings) {
155 155
 
156 156
             // Check for backwards compatibility
157
-            $section_tabs = wpinv_get_settings_tab_sections( $tab );
158
-            if ( ! is_array( $section_tabs ) || ! array_key_exists( $section, $section_tabs ) ) {
157
+            $section_tabs = wpinv_get_settings_tab_sections($tab);
158
+            if (!is_array($section_tabs) || !array_key_exists($section, $section_tabs)) {
159 159
                 $section = 'main';
160 160
                 $settings = $sections;
161 161
             }
@@ -168,9 +168,9 @@  discard block
 block discarded – undo
168 168
                 'wpinv_settings_' . $tab . '_' . $section
169 169
             );
170 170
 
171
-            foreach ( $settings as $option ) {
172
-                if ( ! empty( $option['id'] ) ) {
173
-                    wpinv_register_settings_option( $tab, $section, $option );
171
+            foreach ($settings as $option) {
172
+                if (!empty($option['id'])) {
173
+                    wpinv_register_settings_option($tab, $section, $option);
174 174
                 }
175 175
             }
176 176
 
@@ -178,9 +178,9 @@  discard block
 block discarded – undo
178 178
     }
179 179
 
180 180
     // Creates our settings in the options table.
181
-    register_setting( 'wpinv_settings', 'wpinv_settings', 'wpinv_settings_sanitize' );
181
+    register_setting('wpinv_settings', 'wpinv_settings', 'wpinv_settings_sanitize');
182 182
 }
183
-add_action( 'admin_init', 'wpinv_register_settings' );
183
+add_action('admin_init', 'wpinv_register_settings');
184 184
 
185 185
 /**
186 186
  * Register a single settings option.
@@ -190,46 +190,46 @@  discard block
 block discarded – undo
190 190
  * @param string $option
191 191
  * 
192 192
  */
193
-function wpinv_register_settings_option( $tab, $section, $option ) {
193
+function wpinv_register_settings_option($tab, $section, $option) {
194 194
 
195
-    $name    = isset( $option['name'] ) ? $option['name'] : '';
195
+    $name    = isset($option['name']) ? $option['name'] : '';
196 196
     $cb      = "wpinv_{$option['type']}_callback";
197 197
     $section = "wpinv_settings_{$tab}_$section";
198 198
 
199
-	if ( isset( $option['desc'] ) && ! empty( $option['help-tip'] ) ) {
200
-		$tip   = esc_attr( $option['desc'] );
199
+	if (isset($option['desc']) && !empty($option['help-tip'])) {
200
+		$tip   = esc_attr($option['desc']);
201 201
 		$name .= "<span class='dashicons dashicons-editor-help wpi-help-tip' title='$tip'></span>";
202
-		unset( $option['desc'] );
202
+		unset($option['desc']);
203 203
 	}
204 204
 
205 205
     // Loop through all tabs.
206 206
     add_settings_field(
207 207
         'wpinv_settings[' . $option['id'] . ']',
208 208
         $name,
209
-        function_exists( $cb ) ? $cb : 'wpinv_missing_callback',
209
+        function_exists($cb) ? $cb : 'wpinv_missing_callback',
210 210
         $section,
211 211
         $section,
212 212
         array(
213 213
             'section'     => $section,
214
-            'id'          => isset( $option['id'] )          ? $option['id']          : null,
215
-            'desc'        => isset( $option['desc'] )        ? $option['desc']        : '',
214
+            'id'          => isset($option['id']) ? $option['id'] : null,
215
+            'desc'        => isset($option['desc']) ? $option['desc'] : '',
216 216
             'name'        => $name,
217
-            'size'        => isset( $option['size'] )        ? $option['size']        : null,
218
-            'options'     => isset( $option['options'] )     ? $option['options']     : '',
219
-            'selected'    => isset( $option['selected'] )    ? $option['selected']    : null,
220
-            'std'         => isset( $option['std'] )         ? $option['std']         : '',
221
-            'min'         => isset( $option['min'] )         ? $option['min']         : null,
222
-            'max'         => isset( $option['max'] )         ? $option['max']         : null,
223
-            'step'        => isset( $option['step'] )        ? $option['step']        : null,
224
-            'placeholder' => isset( $option['placeholder'] ) ? $option['placeholder'] : null,
225
-            'allow_blank' => isset( $option['allow_blank'] ) ? $option['allow_blank'] : true,
226
-            'readonly'    => isset( $option['readonly'] )    ? $option['readonly']    : false,
227
-            'faux'        => isset( $option['faux'] )        ? $option['faux']        : false,
228
-            'onchange'    => isset( $option['onchange'] )   ? $option['onchange']     : '',
229
-            'custom'      => isset( $option['custom'] )     ? $option['custom']       : '',
230
-            'class'       => isset( $option['class'] )     ? $option['class']         : '',
231
-            'cols'        => isset( $option['cols'] ) && (int) $option['cols'] > 0 ? (int) $option['cols'] : 50,
232
-            'rows'        => isset( $option['rows'] ) && (int) $option['rows'] > 0 ? (int) $option['rows'] : 5,
217
+            'size'        => isset($option['size']) ? $option['size'] : null,
218
+            'options'     => isset($option['options']) ? $option['options'] : '',
219
+            'selected'    => isset($option['selected']) ? $option['selected'] : null,
220
+            'std'         => isset($option['std']) ? $option['std'] : '',
221
+            'min'         => isset($option['min']) ? $option['min'] : null,
222
+            'max'         => isset($option['max']) ? $option['max'] : null,
223
+            'step'        => isset($option['step']) ? $option['step'] : null,
224
+            'placeholder' => isset($option['placeholder']) ? $option['placeholder'] : null,
225
+            'allow_blank' => isset($option['allow_blank']) ? $option['allow_blank'] : true,
226
+            'readonly'    => isset($option['readonly']) ? $option['readonly'] : false,
227
+            'faux'        => isset($option['faux']) ? $option['faux'] : false,
228
+            'onchange'    => isset($option['onchange']) ? $option['onchange'] : '',
229
+            'custom'      => isset($option['custom']) ? $option['custom'] : '',
230
+            'class'       => isset($option['class']) ? $option['class'] : '',
231
+            'cols'        => isset($option['cols']) && (int) $option['cols'] > 0 ? (int) $option['cols'] : 50,
232
+            'rows'        => isset($option['rows']) && (int) $option['rows'] > 0 ? (int) $option['rows'] : 5,
233 233
         )
234 234
     );
235 235
 
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
  * @return array
242 242
  */
243 243
 function wpinv_get_registered_settings() {
244
-    return apply_filters( 'wpinv_registered_settings', wpinv_get_data( 'admin-settings' ) );
244
+    return apply_filters('wpinv_registered_settings', wpinv_get_data('admin-settings'));
245 245
 }
246 246
 
247 247
 /**
@@ -249,134 +249,134 @@  discard block
 block discarded – undo
249 249
  * 
250 250
  * @return array
251 251
  */
252
-function wpinv_settings_sanitize( $input = array() ) {
252
+function wpinv_settings_sanitize($input = array()) {
253 253
 
254 254
     $wpinv_options = wpinv_get_options();
255 255
 
256
-    if ( empty( wp_get_raw_referer() ) ) {
256
+    if (empty(wp_get_raw_referer())) {
257 257
         return $input;
258 258
     }
259 259
 
260
-    wp_parse_str( wp_get_raw_referer(), $referrer );
260
+    wp_parse_str(wp_get_raw_referer(), $referrer);
261 261
 
262 262
     $settings = wpinv_get_registered_settings();
263
-    $tab      = isset( $referrer['tab'] ) ? $referrer['tab'] : 'general';
264
-    $section  = isset( $referrer['section'] ) ? $referrer['section'] : 'main';
263
+    $tab      = isset($referrer['tab']) ? $referrer['tab'] : 'general';
264
+    $section  = isset($referrer['section']) ? $referrer['section'] : 'main';
265 265
 
266 266
     $input = $input ? $input : array();
267
-    $input = apply_filters( 'wpinv_settings_tab_' . $tab . '_sanitize', $input );
268
-    $input = apply_filters( 'wpinv_settings_' . $tab . '-' . $section . '_sanitize', $input );
267
+    $input = apply_filters('wpinv_settings_tab_' . $tab . '_sanitize', $input);
268
+    $input = apply_filters('wpinv_settings_' . $tab . '-' . $section . '_sanitize', $input);
269 269
 
270 270
     // Loop through each setting being saved and pass it through a sanitization filter
271
-    foreach ( $input as $key => $value ) {
271
+    foreach ($input as $key => $value) {
272 272
 
273 273
         // Get the setting type (checkbox, select, etc)
274
-        $type = isset( $settings[ $tab ][$section][ $key ]['type'] ) ? $settings[ $tab ][$section][ $key ]['type'] : false;
274
+        $type = isset($settings[$tab][$section][$key]['type']) ? $settings[$tab][$section][$key]['type'] : false;
275 275
 
276
-        if ( $type ) {
276
+        if ($type) {
277 277
             // Field type specific filter
278
-            $input[$key] = apply_filters( 'wpinv_settings_sanitize_' . $type, $value, $key );
278
+            $input[$key] = apply_filters('wpinv_settings_sanitize_' . $type, $value, $key);
279 279
         }
280 280
 
281 281
         // General filter
282
-        $input[ $key ] = apply_filters( 'wpinv_settings_sanitize', $input[ $key ], $key );
282
+        $input[$key] = apply_filters('wpinv_settings_sanitize', $input[$key], $key);
283 283
     }
284 284
 
285 285
     // Loop through the whitelist and unset any that are empty for the tab being saved
286
-    $main_settings    = $section == 'main' ? $settings[ $tab ] : array(); // Check for extensions that aren't using new sections
287
-    $section_settings = ! empty( $settings[ $tab ][ $section ] ) ? $settings[ $tab ][ $section ] : array();
286
+    $main_settings    = $section == 'main' ? $settings[$tab] : array(); // Check for extensions that aren't using new sections
287
+    $section_settings = !empty($settings[$tab][$section]) ? $settings[$tab][$section] : array();
288 288
 
289
-    $found_settings = array_merge( $main_settings, $section_settings );
289
+    $found_settings = array_merge($main_settings, $section_settings);
290 290
 
291
-    if ( ! empty( $found_settings ) ) {
292
-        foreach ( $found_settings as $key => $value ) {
291
+    if (!empty($found_settings)) {
292
+        foreach ($found_settings as $key => $value) {
293 293
 
294 294
             // settings used to have numeric keys, now they have keys that match the option ID. This ensures both methods work
295
-            if ( is_numeric( $key ) ) {
295
+            if (is_numeric($key)) {
296 296
                 $key = $value['id'];
297 297
             }
298 298
 
299
-            if ( ! isset( $input[ $key ] ) && isset( $wpinv_options[ $key ] ) ) {
300
-                unset( $wpinv_options[ $key ] );
299
+            if (!isset($input[$key]) && isset($wpinv_options[$key])) {
300
+                unset($wpinv_options[$key]);
301 301
             }
302 302
         }
303 303
     }
304 304
 
305 305
     // Merge our new settings with the existing
306
-    $output = array_merge( $wpinv_options, $input );
306
+    $output = array_merge($wpinv_options, $input);
307 307
 
308
-    add_settings_error( 'wpinv-notices', '', __( 'Settings updated.', 'invoicing' ), 'updated' );
308
+    add_settings_error('wpinv-notices', '', __('Settings updated.', 'invoicing'), 'updated');
309 309
 
310 310
     return $output;
311 311
 }
312 312
 
313
-function wpinv_settings_sanitize_misc_accounting( $input ) {
313
+function wpinv_settings_sanitize_misc_accounting($input) {
314 314
 
315
-    if ( ! wpinv_current_user_can_manage_invoicing() ) {
315
+    if (!wpinv_current_user_can_manage_invoicing()) {
316 316
         return $input;
317 317
     }
318 318
 
319
-    if( ! empty( $input['enable_sequential'] ) && !wpinv_get_option( 'enable_sequential' ) ) {
319
+    if (!empty($input['enable_sequential']) && !wpinv_get_option('enable_sequential')) {
320 320
         // Shows an admin notice about upgrading previous order numbers
321
-        getpaid_session()->set( 'upgrade_sequential', '1' );
321
+        getpaid_session()->set('upgrade_sequential', '1');
322 322
     }
323 323
 
324 324
     return $input;
325 325
 }
326
-add_filter( 'wpinv_settings_misc-accounting_sanitize', 'wpinv_settings_sanitize_misc_accounting' );
326
+add_filter('wpinv_settings_misc-accounting_sanitize', 'wpinv_settings_sanitize_misc_accounting');
327 327
 
328
-function wpinv_settings_sanitize_tax_rates( $input ) {
329
-    if( ! wpinv_current_user_can_manage_invoicing() ) {
328
+function wpinv_settings_sanitize_tax_rates($input) {
329
+    if (!wpinv_current_user_can_manage_invoicing()) {
330 330
         return $input;
331 331
     }
332 332
 
333
-    $new_rates = !empty( $_POST['tax_rates'] ) ? array_values( $_POST['tax_rates'] ) : array();
333
+    $new_rates = !empty($_POST['tax_rates']) ? array_values($_POST['tax_rates']) : array();
334 334
 
335 335
     $tax_rates = array();
336 336
 
337
-    if ( !empty( $new_rates ) ) {
338
-        foreach ( $new_rates as $rate ) {
339
-            if ( isset( $rate['country'] ) && empty( $rate['country'] ) && empty( $rate['state'] ) ) {
337
+    if (!empty($new_rates)) {
338
+        foreach ($new_rates as $rate) {
339
+            if (isset($rate['country']) && empty($rate['country']) && empty($rate['state'])) {
340 340
                 continue;
341 341
             }
342 342
             
343
-            $rate['rate'] = wpinv_sanitize_amount( $rate['rate'], 4 );
343
+            $rate['rate'] = wpinv_sanitize_amount($rate['rate'], 4);
344 344
             
345 345
             $tax_rates[] = $rate;
346 346
         }
347 347
     }
348 348
 
349
-    update_option( 'wpinv_tax_rates', $tax_rates );
349
+    update_option('wpinv_tax_rates', $tax_rates);
350 350
 
351 351
     return $input;
352 352
 }
353
-add_filter( 'wpinv_settings_taxes-rates_sanitize', 'wpinv_settings_sanitize_tax_rates' );
353
+add_filter('wpinv_settings_taxes-rates_sanitize', 'wpinv_settings_sanitize_tax_rates');
354 354
 
355
-function wpinv_sanitize_text_field( $input ) {
356
-    return trim( $input );
355
+function wpinv_sanitize_text_field($input) {
356
+    return trim($input);
357 357
 }
358
-add_filter( 'wpinv_settings_sanitize_text', 'wpinv_sanitize_text_field' );
358
+add_filter('wpinv_settings_sanitize_text', 'wpinv_sanitize_text_field');
359 359
 
360 360
 function wpinv_get_settings_tabs() {
361 361
     $tabs             = array();
362
-    $tabs['general']  = __( 'General', 'invoicing' );
363
-    $tabs['gateways'] = __( 'Payment Gateways', 'invoicing' );
364
-    $tabs['taxes']    = __( 'Taxes', 'invoicing' );
365
-    $tabs['emails']   = __( 'Emails', 'invoicing' );
366
-    $tabs['privacy']  = __( 'Privacy', 'invoicing' );
367
-    $tabs['misc']     = __( 'Misc', 'invoicing' );
368
-    $tabs['tools']    = __( 'Tools', 'invoicing' );
369
-
370
-    return apply_filters( 'wpinv_settings_tabs', $tabs );
362
+    $tabs['general']  = __('General', 'invoicing');
363
+    $tabs['gateways'] = __('Payment Gateways', 'invoicing');
364
+    $tabs['taxes']    = __('Taxes', 'invoicing');
365
+    $tabs['emails']   = __('Emails', 'invoicing');
366
+    $tabs['privacy']  = __('Privacy', 'invoicing');
367
+    $tabs['misc']     = __('Misc', 'invoicing');
368
+    $tabs['tools']    = __('Tools', 'invoicing');
369
+
370
+    return apply_filters('wpinv_settings_tabs', $tabs);
371 371
 }
372 372
 
373
-function wpinv_get_settings_tab_sections( $tab = false ) {
373
+function wpinv_get_settings_tab_sections($tab = false) {
374 374
     $tabs     = false;
375 375
     $sections = wpinv_get_registered_settings_sections();
376 376
 
377
-    if( $tab && ! empty( $sections[ $tab ] ) ) {
378
-        $tabs = $sections[ $tab ];
379
-    } else if ( $tab ) {
377
+    if ($tab && !empty($sections[$tab])) {
378
+        $tabs = $sections[$tab];
379
+    } else if ($tab) {
380 380
         $tabs = false;
381 381
     }
382 382
 
@@ -386,150 +386,150 @@  discard block
 block discarded – undo
386 386
 function wpinv_get_registered_settings_sections() {
387 387
     static $sections = false;
388 388
 
389
-    if ( false !== $sections ) {
389
+    if (false !== $sections) {
390 390
         return $sections;
391 391
     }
392 392
 
393 393
     $sections = array(
394
-        'general' => apply_filters( 'wpinv_settings_sections_general', array(
395
-            'main' => __( 'General Settings', 'invoicing' ),
396
-            'currency_section' => __( 'Currency Settings', 'invoicing' ),
397
-            'labels' => __( 'Label Texts', 'invoicing' ),
398
-        ) ),
399
-        'gateways' => apply_filters( 'wpinv_settings_sections_gateways', array(
400
-            'main' => __( 'Gateway Settings', 'invoicing' ),
401
-        ) ),
402
-        'taxes' => apply_filters( 'wpinv_settings_sections_taxes', array(
403
-            'main' => __( 'Tax Settings', 'invoicing' ),
404
-            'rates' => __( 'Tax Rates', 'invoicing' ),
405
-        ) ),
406
-        'emails' => apply_filters( 'wpinv_settings_sections_emails', array(
407
-            'main' => __( 'Email Settings', 'invoicing' ),
408
-        ) ),
409
-        'privacy' => apply_filters( 'wpinv_settings_sections_privacy', array(
410
-            'main' => __( 'Privacy policy', 'invoicing' ),
411
-        ) ),
412
-        'misc' => apply_filters( 'wpinv_settings_sections_misc', array(
413
-            'main' => __( 'Miscellaneous', 'invoicing' ),
414
-            'fields' => __( 'Fields Settings', 'invoicing' ),
415
-            'custom-css' => __( 'Custom CSS', 'invoicing' ),
416
-        ) ),
417
-        'tools' => apply_filters( 'wpinv_settings_sections_tools', array(
418
-            'main' => __( 'Diagnostic Tools', 'invoicing' ),
419
-        ) ),
394
+        'general' => apply_filters('wpinv_settings_sections_general', array(
395
+            'main' => __('General Settings', 'invoicing'),
396
+            'currency_section' => __('Currency Settings', 'invoicing'),
397
+            'labels' => __('Label Texts', 'invoicing'),
398
+        )),
399
+        'gateways' => apply_filters('wpinv_settings_sections_gateways', array(
400
+            'main' => __('Gateway Settings', 'invoicing'),
401
+        )),
402
+        'taxes' => apply_filters('wpinv_settings_sections_taxes', array(
403
+            'main' => __('Tax Settings', 'invoicing'),
404
+            'rates' => __('Tax Rates', 'invoicing'),
405
+        )),
406
+        'emails' => apply_filters('wpinv_settings_sections_emails', array(
407
+            'main' => __('Email Settings', 'invoicing'),
408
+        )),
409
+        'privacy' => apply_filters('wpinv_settings_sections_privacy', array(
410
+            'main' => __('Privacy policy', 'invoicing'),
411
+        )),
412
+        'misc' => apply_filters('wpinv_settings_sections_misc', array(
413
+            'main' => __('Miscellaneous', 'invoicing'),
414
+            'fields' => __('Fields Settings', 'invoicing'),
415
+            'custom-css' => __('Custom CSS', 'invoicing'),
416
+        )),
417
+        'tools' => apply_filters('wpinv_settings_sections_tools', array(
418
+            'main' => __('Diagnostic Tools', 'invoicing'),
419
+        )),
420 420
     );
421 421
 
422
-    $sections = apply_filters( 'wpinv_settings_sections', $sections );
422
+    $sections = apply_filters('wpinv_settings_sections', $sections);
423 423
 
424 424
     return $sections;
425 425
 }
426 426
 
427
-function wpinv_get_pages( $with_slug = false, $default_label = NULL ) {
427
+function wpinv_get_pages($with_slug = false, $default_label = NULL) {
428 428
 	$pages_options = array();
429 429
 
430
-	if( $default_label !== NULL && $default_label !== false ) {
431
-		$pages_options = array( '' => $default_label ); // Blank option
430
+	if ($default_label !== NULL && $default_label !== false) {
431
+		$pages_options = array('' => $default_label); // Blank option
432 432
 	}
433 433
 
434 434
 	$pages = get_pages();
435
-	if ( $pages ) {
436
-		foreach ( $pages as $page ) {
435
+	if ($pages) {
436
+		foreach ($pages as $page) {
437 437
 			$title = $with_slug ? $page->post_title . ' (' . $page->post_name . ')' : $page->post_title;
438
-            $pages_options[ $page->ID ] = $title;
438
+            $pages_options[$page->ID] = $title;
439 439
 		}
440 440
 	}
441 441
 
442 442
 	return $pages_options;
443 443
 }
444 444
 
445
-function wpinv_header_callback( $args ) {
446
-	if ( !empty( $args['desc'] ) ) {
445
+function wpinv_header_callback($args) {
446
+	if (!empty($args['desc'])) {
447 447
         echo $args['desc'];
448 448
     }
449 449
 }
450 450
 
451
-function wpinv_hidden_callback( $args ) {
451
+function wpinv_hidden_callback($args) {
452 452
 	global $wpinv_options;
453 453
 
454
-	if ( isset( $args['set_value'] ) ) {
454
+	if (isset($args['set_value'])) {
455 455
 		$value = $args['set_value'];
456
-	} elseif ( isset( $wpinv_options[ $args['id'] ] ) ) {
457
-		$value = $wpinv_options[ $args['id'] ];
456
+	} elseif (isset($wpinv_options[$args['id']])) {
457
+		$value = $wpinv_options[$args['id']];
458 458
 	} else {
459
-		$value = isset( $args['std'] ) ? $args['std'] : '';
459
+		$value = isset($args['std']) ? $args['std'] : '';
460 460
 	}
461 461
 
462
-	if ( isset( $args['faux'] ) && true === $args['faux'] ) {
462
+	if (isset($args['faux']) && true === $args['faux']) {
463 463
 		$args['readonly'] = true;
464
-		$value = isset( $args['std'] ) ? $args['std'] : '';
464
+		$value = isset($args['std']) ? $args['std'] : '';
465 465
 		$name  = '';
466 466
 	} else {
467
-		$name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"';
467
+		$name = 'name="wpinv_settings[' . esc_attr($args['id']) . ']"';
468 468
 	}
469 469
 
470
-	$html = '<input type="hidden" id="wpinv_settings[' . wpinv_sanitize_key( $args['id'] ) . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '" />';
470
+	$html = '<input type="hidden" id="wpinv_settings[' . wpinv_sanitize_key($args['id']) . ']" ' . $name . ' value="' . esc_attr(stripslashes($value)) . '" />';
471 471
     
472 472
 	echo $html;
473 473
 }
474 474
 
475
-function wpinv_checkbox_callback( $args ) {
475
+function wpinv_checkbox_callback($args) {
476 476
 	global $wpinv_options;
477 477
     
478
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
478
+    $sanitize_id = wpinv_sanitize_key($args['id']);
479 479
 
480
-	if ( isset( $args['faux'] ) && true === $args['faux'] ) {
480
+	if (isset($args['faux']) && true === $args['faux']) {
481 481
 		$name = '';
482 482
 	} else {
483 483
 		$name = 'name="wpinv_settings[' . $sanitize_id . ']"';
484 484
 	}
485 485
 
486
-	$std     = isset( $args['std'] ) ? $args['std'] : 0;
487
-	$value   = isset( $wpinv_options[ $args['id'] ] ) ? $wpinv_options[ $args['id'] ] : $std;
488
-	$checked = checked( empty( $value ), false, false );
486
+	$std     = isset($args['std']) ? $args['std'] : 0;
487
+	$value   = isset($wpinv_options[$args['id']]) ? $wpinv_options[$args['id']] : $std;
488
+	$checked = checked(empty($value), false, false);
489 489
 
490 490
 	$html = '<input type="checkbox" id="wpinv_settings[' . $sanitize_id . ']"' . $name . ' value="1" ' . $checked . '/>';
491
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
491
+	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
492 492
 
493 493
 	echo $html;
494 494
 }
495 495
 
496
-function wpinv_multicheck_callback( $args ) {
496
+function wpinv_multicheck_callback($args) {
497 497
 	global $wpinv_options;
498 498
 
499
-	$sanitize_id = wpinv_sanitize_key( $args['id'] );
500
-	$class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : '';
499
+	$sanitize_id = wpinv_sanitize_key($args['id']);
500
+	$class = !empty($args['class']) ? ' ' . esc_attr($args['class']) : '';
501 501
 
502
-	if ( ! empty( $args['options'] ) ) {
502
+	if (!empty($args['options'])) {
503 503
 
504
-		$std     = isset( $args['std'] ) ? $args['std'] : array();
505
-		$value   = isset( $wpinv_options[ $args['id'] ] ) ? $wpinv_options[ $args['id'] ] : $std;
504
+		$std     = isset($args['std']) ? $args['std'] : array();
505
+		$value   = isset($wpinv_options[$args['id']]) ? $wpinv_options[$args['id']] : $std;
506 506
 
507 507
 		echo '<div class="wpi-mcheck-rows wpi-mcheck-' . $sanitize_id . $class . '">';
508
-        foreach( $args['options'] as $key => $option ):
509
-			$sanitize_key = wpinv_sanitize_key( $key );
510
-			if ( in_array( $sanitize_key, $value ) ) { 
508
+        foreach ($args['options'] as $key => $option):
509
+			$sanitize_key = wpinv_sanitize_key($key);
510
+			if (in_array($sanitize_key, $value)) { 
511 511
 				$enabled = $sanitize_key;
512 512
 			} else { 
513 513
 				$enabled = NULL; 
514 514
 			}
515
-			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;';
516
-			echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . wp_kses_post( $option ) . '</label></div>';
515
+			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;';
516
+			echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . wp_kses_post($option) . '</label></div>';
517 517
 		endforeach;
518 518
 		echo '</div>';
519 519
 		echo '<p class="description">' . $args['desc'] . '</p>';
520 520
 	}
521 521
 }
522 522
 
523
-function wpinv_payment_icons_callback( $args ) {
523
+function wpinv_payment_icons_callback($args) {
524 524
 	global $wpinv_options;
525 525
     
526
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
526
+    $sanitize_id = wpinv_sanitize_key($args['id']);
527 527
 
528
-	if ( ! empty( $args['options'] ) ) {
529
-		foreach( $args['options'] as $key => $option ) {
530
-            $sanitize_key = wpinv_sanitize_key( $key );
528
+	if (!empty($args['options'])) {
529
+		foreach ($args['options'] as $key => $option) {
530
+            $sanitize_key = wpinv_sanitize_key($key);
531 531
             
532
-			if( isset( $wpinv_options[$args['id']][$key] ) ) {
532
+			if (isset($wpinv_options[$args['id']][$key])) {
533 533
 				$enabled = $option;
534 534
 			} else {
535 535
 				$enabled = NULL;
@@ -537,197 +537,197 @@  discard block
 block discarded – undo
537 537
 
538 538
 			echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" style="margin-right:10px;line-height:16px;height:16px;display:inline-block;">';
539 539
 
540
-				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;';
540
+				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;';
541 541
 
542
-				if ( wpinv_string_is_image_url( $key ) ) {
543
-					echo '<img class="payment-icon" src="' . esc_url( $key ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
542
+				if (wpinv_string_is_image_url($key)) {
543
+					echo '<img class="payment-icon" src="' . esc_url($key) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
544 544
 				} else {
545
-					$card = strtolower( str_replace( ' ', '', $option ) );
545
+					$card = strtolower(str_replace(' ', '', $option));
546 546
 
547
-					if ( has_filter( 'wpinv_accepted_payment_' . $card . '_image' ) ) {
548
-						$image = apply_filters( 'wpinv_accepted_payment_' . $card . '_image', '' );
547
+					if (has_filter('wpinv_accepted_payment_' . $card . '_image')) {
548
+						$image = apply_filters('wpinv_accepted_payment_' . $card . '_image', '');
549 549
 					} else {
550
-						$image       = wpinv_locate_template( 'images' . DIRECTORY_SEPARATOR . 'icons' . DIRECTORY_SEPARATOR . $card . '.gif', false );
550
+						$image       = wpinv_locate_template('images' . DIRECTORY_SEPARATOR . 'icons' . DIRECTORY_SEPARATOR . $card . '.gif', false);
551 551
 						$content_dir = WP_CONTENT_DIR;
552 552
 
553
-						if ( function_exists( 'wp_normalize_path' ) ) {
553
+						if (function_exists('wp_normalize_path')) {
554 554
 							// Replaces backslashes with forward slashes for Windows systems
555
-							$image = wp_normalize_path( $image );
556
-							$content_dir = wp_normalize_path( $content_dir );
555
+							$image = wp_normalize_path($image);
556
+							$content_dir = wp_normalize_path($content_dir);
557 557
 						}
558 558
 
559
-						$image = str_replace( $content_dir, content_url(), $image );
559
+						$image = str_replace($content_dir, content_url(), $image);
560 560
 					}
561 561
 
562
-					echo '<img class="payment-icon" src="' . esc_url( $image ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
562
+					echo '<img class="payment-icon" src="' . esc_url($image) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
563 563
 				}
564 564
 			echo $option . '</label>';
565 565
 		}
566
-		echo '<p class="description" style="margin-top:16px;">' . wp_kses_post( $args['desc'] ) . '</p>';
566
+		echo '<p class="description" style="margin-top:16px;">' . wp_kses_post($args['desc']) . '</p>';
567 567
 	}
568 568
 }
569 569
 
570
-function wpinv_radio_callback( $args ) {
570
+function wpinv_radio_callback($args) {
571 571
 	global $wpinv_options;
572 572
     
573
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
573
+    $sanitize_id = wpinv_sanitize_key($args['id']);
574 574
     
575
-    foreach ( $args['options'] as $key => $option ) :
576
-		$sanitize_key = wpinv_sanitize_key( $key );
575
+    foreach ($args['options'] as $key => $option) :
576
+		$sanitize_key = wpinv_sanitize_key($key);
577 577
         
578 578
         $checked = false;
579 579
 
580
-		if ( isset( $wpinv_options[ $args['id'] ] ) && $wpinv_options[ $args['id'] ] == $key )
580
+		if (isset($wpinv_options[$args['id']]) && $wpinv_options[$args['id']] == $key)
581 581
 			$checked = true;
582
-		elseif( isset( $args['std'] ) && $args['std'] == $key && ! isset( $wpinv_options[ $args['id'] ] ) )
582
+		elseif (isset($args['std']) && $args['std'] == $key && !isset($wpinv_options[$args['id']]))
583 583
 			$checked = true;
584 584
 
585 585
 		echo '<input name="wpinv_settings[' . $sanitize_id . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="radio" value="' . $sanitize_key . '" ' . checked(true, $checked, false) . '/>&nbsp;';
586
-		echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html( $option ) . '</label><br/>';
586
+		echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html($option) . '</label><br/>';
587 587
 	endforeach;
588 588
 
589
-	echo '<p class="description">' . wp_kses_post( $args['desc'] ) . '</p>';
589
+	echo '<p class="description">' . wp_kses_post($args['desc']) . '</p>';
590 590
 }
591 591
 
592
-function wpinv_gateways_callback( $args ) {
592
+function wpinv_gateways_callback($args) {
593 593
 	global $wpinv_options;
594 594
     
595
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
595
+    $sanitize_id = wpinv_sanitize_key($args['id']);
596 596
 
597
-	foreach ( $args['options'] as $key => $option ) :
598
-		$sanitize_key = wpinv_sanitize_key( $key );
597
+	foreach ($args['options'] as $key => $option) :
598
+		$sanitize_key = wpinv_sanitize_key($key);
599 599
         
600
-        if ( isset( $wpinv_options['gateways'][ $key ] ) )
600
+        if (isset($wpinv_options['gateways'][$key]))
601 601
 			$enabled = '1';
602 602
 		else
603 603
 			$enabled = null;
604 604
 
605
-		echo '<input name="wpinv_settings[' . esc_attr( $args['id'] ) . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="1" ' . checked('1', $enabled, false) . '/>&nbsp;';
606
-		echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html( $option['admin_label'] ) . '</label><br/>';
605
+		echo '<input name="wpinv_settings[' . esc_attr($args['id']) . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="1" ' . checked('1', $enabled, false) . '/>&nbsp;';
606
+		echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html($option['admin_label']) . '</label><br/>';
607 607
 	endforeach;
608 608
 }
609 609
 
610 610
 function wpinv_gateway_select_callback($args) {
611 611
 	global $wpinv_options;
612 612
     
613
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
614
-    $class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : '';
613
+    $sanitize_id = wpinv_sanitize_key($args['id']);
614
+    $class = !empty($args['class']) ? ' ' . esc_attr($args['class']) : '';
615 615
 
616
-	echo '<select name="wpinv_settings[' . $sanitize_id . ']"" id="wpinv_settings[' . $sanitize_id . ']" class="'.$class.'" >';
616
+	echo '<select name="wpinv_settings[' . $sanitize_id . ']"" id="wpinv_settings[' . $sanitize_id . ']" class="' . $class . '" >';
617 617
 
618
-	foreach ( $args['options'] as $key => $option ) :
619
-		if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) {
620
-            $selected = selected( $key, $args['selected'], false );
618
+	foreach ($args['options'] as $key => $option) :
619
+		if (isset($args['selected']) && $args['selected'] !== null && $args['selected'] !== false) {
620
+            $selected = selected($key, $args['selected'], false);
621 621
         } else {
622
-            $selected = isset( $wpinv_options[ $args['id'] ] ) ? selected( $key, $wpinv_options[$args['id']], false ) : '';
622
+            $selected = isset($wpinv_options[$args['id']]) ? selected($key, $wpinv_options[$args['id']], false) : '';
623 623
         }
624
-		echo '<option value="' . wpinv_sanitize_key( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>';
624
+		echo '<option value="' . wpinv_sanitize_key($key) . '"' . $selected . '>' . esc_html($option['admin_label']) . '</option>';
625 625
 	endforeach;
626 626
 
627 627
 	echo '</select>';
628
-	echo '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
628
+	echo '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
629 629
 }
630 630
 
631
-function wpinv_text_callback( $args ) {
631
+function wpinv_text_callback($args) {
632 632
 	global $wpinv_options;
633 633
     
634
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
634
+    $sanitize_id = wpinv_sanitize_key($args['id']);
635 635
 
636
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
637
-		$value = $wpinv_options[ $args['id'] ];
636
+	if (isset($wpinv_options[$args['id']])) {
637
+		$value = $wpinv_options[$args['id']];
638 638
 	} else {
639
-		$value = isset( $args['std'] ) ? $args['std'] : '';
639
+		$value = isset($args['std']) ? $args['std'] : '';
640 640
 	}
641 641
 
642
-	if ( isset( $args['faux'] ) && true === $args['faux'] ) {
642
+	if (isset($args['faux']) && true === $args['faux']) {
643 643
 		$args['readonly'] = true;
644
-		$value = isset( $args['std'] ) ? $args['std'] : '';
644
+		$value = isset($args['std']) ? $args['std'] : '';
645 645
 		$name  = '';
646 646
 	} else {
647
-		$name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"';
647
+		$name = 'name="wpinv_settings[' . esc_attr($args['id']) . ']"';
648 648
 	}
649
-	$class = !empty( $args['class'] ) ? sanitize_html_class( $args['class'] ) : '';
649
+	$class = !empty($args['class']) ? sanitize_html_class($args['class']) : '';
650 650
 
651 651
 	$readonly = $args['readonly'] === true ? ' readonly="readonly"' : '';
652
-	$size     = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
653
-	$html     = '<input type="text" class="' . sanitize_html_class( $size ) . '-text ' . $class . '" id="wpinv_settings[' . $sanitize_id . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '"' . $readonly . '/>';
654
-	$html    .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
652
+	$size     = (isset($args['size']) && !is_null($args['size'])) ? $args['size'] : 'regular';
653
+	$html     = '<input type="text" class="' . sanitize_html_class($size) . '-text ' . $class . '" id="wpinv_settings[' . $sanitize_id . ']" ' . $name . ' value="' . esc_attr(stripslashes($value)) . '"' . $readonly . '/>';
654
+	$html    .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
655 655
 
656 656
 	echo $html;
657 657
 }
658 658
 
659
-function wpinv_number_callback( $args ) {
659
+function wpinv_number_callback($args) {
660 660
 	global $wpinv_options;
661 661
     
662
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
662
+    $sanitize_id = wpinv_sanitize_key($args['id']);
663 663
 
664
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
665
-		$value = $wpinv_options[ $args['id'] ];
664
+	if (isset($wpinv_options[$args['id']])) {
665
+		$value = $wpinv_options[$args['id']];
666 666
 	} else {
667
-		$value = isset( $args['std'] ) ? $args['std'] : '';
667
+		$value = isset($args['std']) ? $args['std'] : '';
668 668
 	}
669 669
 
670
-	if ( isset( $args['faux'] ) && true === $args['faux'] ) {
670
+	if (isset($args['faux']) && true === $args['faux']) {
671 671
 		$args['readonly'] = true;
672
-		$value = isset( $args['std'] ) ? $args['std'] : '';
672
+		$value = isset($args['std']) ? $args['std'] : '';
673 673
 		$name  = '';
674 674
 	} else {
675
-		$name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"';
675
+		$name = 'name="wpinv_settings[' . esc_attr($args['id']) . ']"';
676 676
 	}
677 677
 
678
-	$max  = isset( $args['max'] ) ? $args['max'] : 999999;
679
-	$min  = isset( $args['min'] ) ? $args['min'] : 0;
680
-	$step = isset( $args['step'] ) ? $args['step'] : 1;
681
-	$class = !empty( $args['class'] ) ? sanitize_html_class( $args['class'] ) : '';
678
+	$max  = isset($args['max']) ? $args['max'] : 999999;
679
+	$min  = isset($args['min']) ? $args['min'] : 0;
680
+	$step = isset($args['step']) ? $args['step'] : 1;
681
+	$class = !empty($args['class']) ? sanitize_html_class($args['class']) : '';
682 682
 
683
-	$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
684
-	$html = '<input type="number" step="' . esc_attr( $step ) . '" max="' . esc_attr( $max ) . '" min="' . esc_attr( $min ) . '" class="' . sanitize_html_class( $size ) . '-text ' . $class . '" id="wpinv_settings[' . $sanitize_id . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '"/>';
685
-	$html .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
683
+	$size = (isset($args['size']) && !is_null($args['size'])) ? $args['size'] : 'regular';
684
+	$html = '<input type="number" step="' . esc_attr($step) . '" max="' . esc_attr($max) . '" min="' . esc_attr($min) . '" class="' . sanitize_html_class($size) . '-text ' . $class . '" id="wpinv_settings[' . $sanitize_id . ']" ' . $name . ' value="' . esc_attr(stripslashes($value)) . '"/>';
685
+	$html .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
686 686
 
687 687
 	echo $html;
688 688
 }
689 689
 
690
-function wpinv_textarea_callback( $args ) {
690
+function wpinv_textarea_callback($args) {
691 691
 	global $wpinv_options;
692 692
     
693
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
693
+    $sanitize_id = wpinv_sanitize_key($args['id']);
694 694
 
695
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
696
-		$value = $wpinv_options[ $args['id'] ];
695
+	if (isset($wpinv_options[$args['id']])) {
696
+		$value = $wpinv_options[$args['id']];
697 697
 	} else {
698
-		$value = isset( $args['std'] ) ? $args['std'] : '';
698
+		$value = isset($args['std']) ? $args['std'] : '';
699 699
 	}
700 700
     
701
-    $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
702
-    $class = ( isset( $args['class'] ) && ! is_null( $args['class'] ) ) ? $args['class'] : 'large-text';
701
+    $size = (isset($args['size']) && !is_null($args['size'])) ? $args['size'] : 'regular';
702
+    $class = (isset($args['class']) && !is_null($args['class'])) ? $args['class'] : 'large-text';
703 703
 
704
-	$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>';
705
-	$html .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
704
+	$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>';
705
+	$html .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
706 706
 
707 707
 	echo $html;
708 708
 }
709 709
 
710
-function wpinv_password_callback( $args ) {
710
+function wpinv_password_callback($args) {
711 711
 	global $wpinv_options;
712 712
     
713
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
713
+    $sanitize_id = wpinv_sanitize_key($args['id']);
714 714
 
715
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
716
-		$value = $wpinv_options[ $args['id'] ];
715
+	if (isset($wpinv_options[$args['id']])) {
716
+		$value = $wpinv_options[$args['id']];
717 717
 	} else {
718
-		$value = isset( $args['std'] ) ? $args['std'] : '';
718
+		$value = isset($args['std']) ? $args['std'] : '';
719 719
 	}
720 720
 
721
-	$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
722
-	$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 ) . '"/>';
723
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
721
+	$size = (isset($args['size']) && !is_null($args['size'])) ? $args['size'] : 'regular';
722
+	$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) . '"/>';
723
+	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
724 724
 
725 725
 	echo $html;
726 726
 }
727 727
 
728 728
 function wpinv_missing_callback($args) {
729 729
 	printf(
730
-		__( 'The callback function used for the %s setting is missing.', 'invoicing' ),
730
+		__('The callback function used for the %s setting is missing.', 'invoicing'),
731 731
 		'<strong>' . $args['id'] . '</strong>'
732 732
 	);
733 733
 }
@@ -735,134 +735,134 @@  discard block
 block discarded – undo
735 735
 function wpinv_select_callback($args) {
736 736
 	global $wpinv_options;
737 737
     
738
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
738
+    $sanitize_id = wpinv_sanitize_key($args['id']);
739 739
 
740
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
741
-		$value = $wpinv_options[ $args['id'] ];
740
+	if (isset($wpinv_options[$args['id']])) {
741
+		$value = $wpinv_options[$args['id']];
742 742
 	} else {
743
-		$value = isset( $args['std'] ) ? $args['std'] : '';
743
+		$value = isset($args['std']) ? $args['std'] : '';
744 744
 	}
745 745
     
746
-    if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) {
746
+    if (isset($args['selected']) && $args['selected'] !== null && $args['selected'] !== false) {
747 747
         $value = $args['selected'];
748 748
     }
749 749
 
750
-	if ( isset( $args['placeholder'] ) ) {
750
+	if (isset($args['placeholder'])) {
751 751
 		$placeholder = $args['placeholder'];
752 752
 	} else {
753 753
 		$placeholder = '';
754 754
 	}
755 755
     
756
-    if( !empty( $args['onchange'] ) ) {
757
-        $onchange = ' onchange="' . esc_attr( $args['onchange'] ) . '"';
756
+    if (!empty($args['onchange'])) {
757
+        $onchange = ' onchange="' . esc_attr($args['onchange']) . '"';
758 758
     } else {
759 759
         $onchange = '';
760 760
     }
761 761
 
762
-    $class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : '';
762
+    $class = !empty($args['class']) ? ' ' . esc_attr($args['class']) : '';
763 763
 
764
-	$html = '<select id="wpinv_settings[' . $sanitize_id . ']" class="'.$class.'"  name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" data-placeholder="' . esc_html( $placeholder ) . '"' . $onchange . ' />';
764
+	$html = '<select id="wpinv_settings[' . $sanitize_id . ']" class="' . $class . '"  name="wpinv_settings[' . esc_attr($args['id']) . ']" data-placeholder="' . esc_html($placeholder) . '"' . $onchange . ' />';
765 765
 
766
-	foreach ( $args['options'] as $option => $name ) {
767
-		$selected = selected( $option, $value, false );
768
-		$html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>';
766
+	foreach ($args['options'] as $option => $name) {
767
+		$selected = selected($option, $value, false);
768
+		$html .= '<option value="' . esc_attr($option) . '" ' . $selected . '>' . esc_html($name) . '</option>';
769 769
 	}
770 770
 
771 771
 	$html .= '</select>';
772
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
772
+	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
773 773
 
774 774
 	echo $html;
775 775
 }
776 776
 
777
-function wpinv_color_select_callback( $args ) {
777
+function wpinv_color_select_callback($args) {
778 778
 	global $wpinv_options;
779 779
     
780
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
780
+    $sanitize_id = wpinv_sanitize_key($args['id']);
781 781
 
782
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
783
-		$value = $wpinv_options[ $args['id'] ];
782
+	if (isset($wpinv_options[$args['id']])) {
783
+		$value = $wpinv_options[$args['id']];
784 784
 	} else {
785
-		$value = isset( $args['std'] ) ? $args['std'] : '';
785
+		$value = isset($args['std']) ? $args['std'] : '';
786 786
 	}
787 787
 
788
-	$html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"/>';
788
+	$html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr($args['id']) . ']"/>';
789 789
 
790
-	foreach ( $args['options'] as $option => $color ) {
791
-		$selected = selected( $option, $value, false );
792
-		$html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $color['label'] ) . '</option>';
790
+	foreach ($args['options'] as $option => $color) {
791
+		$selected = selected($option, $value, false);
792
+		$html .= '<option value="' . esc_attr($option) . '" ' . $selected . '>' . esc_html($color['label']) . '</option>';
793 793
 	}
794 794
 
795 795
 	$html .= '</select>';
796
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
796
+	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
797 797
 
798 798
 	echo $html;
799 799
 }
800 800
 
801
-function wpinv_rich_editor_callback( $args ) {
801
+function wpinv_rich_editor_callback($args) {
802 802
 	global $wpinv_options, $wp_version;
803 803
     
804
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
804
+    $sanitize_id = wpinv_sanitize_key($args['id']);
805 805
 
806
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
807
-		$value = $wpinv_options[ $args['id'] ];
806
+	if (isset($wpinv_options[$args['id']])) {
807
+		$value = $wpinv_options[$args['id']];
808 808
 
809
-		if( empty( $args['allow_blank'] ) && empty( $value ) ) {
810
-			$value = isset( $args['std'] ) ? $args['std'] : '';
809
+		if (empty($args['allow_blank']) && empty($value)) {
810
+			$value = isset($args['std']) ? $args['std'] : '';
811 811
 		}
812 812
 	} else {
813
-		$value = isset( $args['std'] ) ? $args['std'] : '';
813
+		$value = isset($args['std']) ? $args['std'] : '';
814 814
 	}
815 815
 
816
-	$rows = isset( $args['size'] ) ? $args['size'] : 20;
816
+	$rows = isset($args['size']) ? $args['size'] : 20;
817 817
 
818 818
 	$html = '<div class="getpaid-settings-editor-input">';
819
-	if ( $wp_version >= 3.3 && function_exists( 'wp_editor' ) ) {
819
+	if ($wp_version >= 3.3 && function_exists('wp_editor')) {
820 820
 		ob_start();
821
-		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 ) );
821
+		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));
822 822
 		$html .= ob_get_clean();
823 823
 	} else {
824
-		$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>';
824
+		$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>';
825 825
 	}
826 826
 
827
-	$html .= '</div><br/><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
827
+	$html .= '</div><br/><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
828 828
 
829 829
 	echo $html;
830 830
 }
831 831
 
832
-function wpinv_upload_callback( $args ) {
832
+function wpinv_upload_callback($args) {
833 833
 	global $wpinv_options;
834 834
     
835
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
835
+    $sanitize_id = wpinv_sanitize_key($args['id']);
836 836
 
837
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
837
+	if (isset($wpinv_options[$args['id']])) {
838 838
 		$value = $wpinv_options[$args['id']];
839 839
 	} else {
840 840
 		$value = isset($args['std']) ? $args['std'] : '';
841 841
 	}
842 842
 
843
-	$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
844
-	$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 ) ) . '"/>';
845
-	$html .= '<span>&nbsp;<input type="button" class="wpinv_settings_upload_button button-secondary" value="' . __( 'Upload File', 'invoicing' ) . '"/></span>';
846
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
843
+	$size = (isset($args['size']) && !is_null($args['size'])) ? $args['size'] : 'regular';
844
+	$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)) . '"/>';
845
+	$html .= '<span>&nbsp;<input type="button" class="wpinv_settings_upload_button button-secondary" value="' . __('Upload File', 'invoicing') . '"/></span>';
846
+	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
847 847
 
848 848
 	echo $html;
849 849
 }
850 850
 
851
-function wpinv_color_callback( $args ) {
851
+function wpinv_color_callback($args) {
852 852
 	global $wpinv_options;
853 853
     
854
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
854
+    $sanitize_id = wpinv_sanitize_key($args['id']);
855 855
 
856
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
857
-		$value = $wpinv_options[ $args['id'] ];
856
+	if (isset($wpinv_options[$args['id']])) {
857
+		$value = $wpinv_options[$args['id']];
858 858
 	} else {
859
-		$value = isset( $args['std'] ) ? $args['std'] : '';
859
+		$value = isset($args['std']) ? $args['std'] : '';
860 860
 	}
861 861
 
862
-	$default = isset( $args['std'] ) ? $args['std'] : '';
862
+	$default = isset($args['std']) ? $args['std'] : '';
863 863
 
864
-	$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( $default ) . '" />';
865
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
864
+	$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($default) . '" />';
865
+	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
866 866
 
867 867
 	echo $html;
868 868
 }
@@ -870,9 +870,9 @@  discard block
 block discarded – undo
870 870
 function wpinv_country_states_callback($args) {
871 871
 	global $wpinv_options;
872 872
     
873
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
873
+    $sanitize_id = wpinv_sanitize_key($args['id']);
874 874
 
875
-	if ( isset( $args['placeholder'] ) ) {
875
+	if (isset($args['placeholder'])) {
876 876
 		$placeholder = $args['placeholder'];
877 877
 	} else {
878 878
 		$placeholder = '';
@@ -880,16 +880,16 @@  discard block
 block discarded – undo
880 880
 
881 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 = isset( $wpinv_options[ $args['id'] ] ) ? selected( $option, $wpinv_options[$args['id']], false ) : '';
888
-		$html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>';
886
+	foreach ($states as $option => $name) {
887
+		$selected = isset($wpinv_options[$args['id']]) ? selected($option, $wpinv_options[$args['id']], false) : '';
888
+		$html .= '<option value="' . esc_attr($option) . '" ' . $selected . '>' . esc_html($name) . '</option>';
889 889
 	}
890 890
 
891 891
 	$html .= '</select>';
892
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
892
+	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
893 893
 
894 894
 	echo $html;
895 895
 }
@@ -904,96 +904,96 @@  discard block
 block discarded – undo
904 904
 	<table id="wpinv_tax_rates" class="wp-list-table widefat fixed posts">
905 905
 		<thead>
906 906
 			<tr>
907
-				<th scope="col" class="wpinv_tax_country"><?php _e( 'Country', 'invoicing' ); ?></th>
908
-				<th scope="col" class="wpinv_tax_state"><?php _e( 'State / Province', 'invoicing' ); ?></th>
909
-                <th scope="col" class="wpinv_tax_global" title="<?php esc_attr_e( 'Apply rate to whole country, regardless of state / province', 'invoicing' ); ?>"><?php _e( 'Country Wide', 'invoicing' ); ?></th>
910
-                <th scope="col" class="wpinv_tax_rate"><?php _e( 'Rate %', 'invoicing' ); ?></th> 
911
-                <th scope="col" class="wpinv_tax_name"><?php _e( 'Tax Name', 'invoicing' ); ?></th>
912
-				<th scope="col" class="wpinv_tax_action"><?php _e( 'Remove', 'invoicing' ); ?></th>
907
+				<th scope="col" class="wpinv_tax_country"><?php _e('Country', 'invoicing'); ?></th>
908
+				<th scope="col" class="wpinv_tax_state"><?php _e('State / Province', 'invoicing'); ?></th>
909
+                <th scope="col" class="wpinv_tax_global" title="<?php esc_attr_e('Apply rate to whole country, regardless of state / province', 'invoicing'); ?>"><?php _e('Country Wide', 'invoicing'); ?></th>
910
+                <th scope="col" class="wpinv_tax_rate"><?php _e('Rate %', 'invoicing'); ?></th> 
911
+                <th scope="col" class="wpinv_tax_name"><?php _e('Tax Name', 'invoicing'); ?></th>
912
+				<th scope="col" class="wpinv_tax_action"><?php _e('Remove', 'invoicing'); ?></th>
913 913
 			</tr>
914 914
 		</thead>
915 915
         <tbody>
916
-		<?php if( !empty( $rates ) ) : ?>
917
-			<?php foreach( $rates as $key => $rate ) : ?>
916
+		<?php if (!empty($rates)) : ?>
917
+			<?php foreach ($rates as $key => $rate) : ?>
918 918
             <?php 
919
-            $sanitized_key = wpinv_sanitize_key( $key );
919
+            $sanitized_key = wpinv_sanitize_key($key);
920 920
             ?>
921 921
 			<tr>
922 922
 				<td class="wpinv_tax_country">
923 923
 					<?php
924
-					echo wpinv_html_select( array(
925
-						'options'          => wpinv_get_country_list( true ),
924
+					echo wpinv_html_select(array(
925
+						'options'          => wpinv_get_country_list(true),
926 926
 						'name'             => 'tax_rates[' . $sanitized_key . '][country]',
927 927
                         'id'               => 'tax_rates[' . $sanitized_key . '][country]',
928 928
 						'selected'         => $rate['country'],
929 929
 						'show_option_all'  => false,
930 930
 						'show_option_none' => false,
931 931
 						'class'            => 'wpinv-tax-country wpi_select2',
932
-						'placeholder'      => __( 'Choose a country', 'invoicing' )
933
-					) );
932
+						'placeholder'      => __('Choose a country', 'invoicing')
933
+					));
934 934
 					?>
935 935
 				</td>
936 936
 				<td class="wpinv_tax_state">
937 937
 					<?php
938
-					$states = wpinv_get_country_states( $rate['country'] );
939
-					if( !empty( $states ) ) {
940
-						echo wpinv_html_select( array(
941
-							'options'          => array_merge( array( '' => '' ), $states ),
938
+					$states = wpinv_get_country_states($rate['country']);
939
+					if (!empty($states)) {
940
+						echo wpinv_html_select(array(
941
+							'options'          => array_merge(array('' => ''), $states),
942 942
 							'name'             => 'tax_rates[' . $sanitized_key . '][state]',
943 943
                             'id'               => 'tax_rates[' . $sanitized_key . '][state]',
944 944
 							'selected'         => $rate['state'],
945 945
 							'show_option_all'  => false,
946 946
 							'show_option_none' => false,
947 947
                             'class'            => 'wpi_select2',
948
-							'placeholder'      => __( 'Choose a state', 'invoicing' )
949
-						) );
948
+							'placeholder'      => __('Choose a state', 'invoicing')
949
+						));
950 950
 					} else {
951
-						echo wpinv_html_text( array(
951
+						echo wpinv_html_text(array(
952 952
 							'name'  => 'tax_rates[' . $sanitized_key . '][state]', $rate['state'],
953
-							'value' => ! empty( $rate['state'] ) ? $rate['state'] : '',
953
+							'value' => !empty($rate['state']) ? $rate['state'] : '',
954 954
                             'id'    => 'tax_rates[' . $sanitized_key . '][state]',
955
-						) );
955
+						));
956 956
 					}
957 957
 					?>
958 958
 				</td>
959 959
 				<td class="wpinv_tax_global">
960
-					<input type="checkbox" name="tax_rates[<?php echo $sanitized_key; ?>][global]" id="tax_rates[<?php echo $sanitized_key; ?>][global]" value="1"<?php checked( true, ! empty( $rate['global'] ) ); ?>/>
961
-					<label for="tax_rates[<?php echo $sanitized_key; ?>][global]"><?php _e( 'Apply to whole country', 'invoicing' ); ?></label>
960
+					<input type="checkbox" name="tax_rates[<?php echo $sanitized_key; ?>][global]" id="tax_rates[<?php echo $sanitized_key; ?>][global]" value="1"<?php checked(true, !empty($rate['global'])); ?>/>
961
+					<label for="tax_rates[<?php echo $sanitized_key; ?>][global]"><?php _e('Apply to whole country', 'invoicing'); ?></label>
962 962
 				</td>
963
-				<td class="wpinv_tax_rate"><input type="number" class="small-text" step="any" min="0" max="99" name="tax_rates[<?php echo $sanitized_key; ?>][rate]" value="<?php echo esc_html( $rate['rate'] ); ?>"/></td>
964
-                <td class="wpinv_tax_name"><input type="text" class="regular-text" name="tax_rates[<?php echo $sanitized_key; ?>][name]" value="<?php echo esc_html( $rate['name'] ); ?>"/></td>
965
-				<td class="wpinv_tax_action"><span class="wpinv_remove_tax_rate button-secondary"><?php _e( 'Remove Rate', 'invoicing' ); ?></span></td>
963
+				<td class="wpinv_tax_rate"><input type="number" class="small-text" step="any" min="0" max="99" name="tax_rates[<?php echo $sanitized_key; ?>][rate]" value="<?php echo esc_html($rate['rate']); ?>"/></td>
964
+                <td class="wpinv_tax_name"><input type="text" class="regular-text" name="tax_rates[<?php echo $sanitized_key; ?>][name]" value="<?php echo esc_html($rate['name']); ?>"/></td>
965
+				<td class="wpinv_tax_action"><span class="wpinv_remove_tax_rate button-secondary"><?php _e('Remove Rate', 'invoicing'); ?></span></td>
966 966
 			</tr>
967 967
 			<?php endforeach; ?>
968 968
 		<?php else : ?>
969 969
 			<tr>
970 970
 				<td class="wpinv_tax_country">
971 971
 					<?php
972
-					echo wpinv_html_select( array(
973
-						'options'          => wpinv_get_country_list( true ),
972
+					echo wpinv_html_select(array(
973
+						'options'          => wpinv_get_country_list(true),
974 974
 						'name'             => 'tax_rates[0][country]',
975 975
 						'show_option_all'  => false,
976 976
 						'show_option_none' => false,
977 977
 						'class'            => 'wpinv-tax-country wpi_select2',
978
-						'placeholder'      => __( 'Choose a country', 'invoicing' )
979
-					) ); ?>
978
+						'placeholder'      => __('Choose a country', 'invoicing')
979
+					)); ?>
980 980
 				</td>
981 981
 				<td class="wpinv_tax_state">
982
-					<?php echo wpinv_html_text( array(
982
+					<?php echo wpinv_html_text(array(
983 983
 						'name' => 'tax_rates[0][state]'
984
-					) ); ?>
984
+					)); ?>
985 985
 				</td>
986 986
 				<td class="wpinv_tax_global">
987 987
 					<input type="checkbox" name="tax_rates[0][global]" id="tax_rates[0][global]" value="1"/>
988
-					<label for="tax_rates[0][global]"><?php _e( 'Apply to whole country', 'invoicing' ); ?></label>
988
+					<label for="tax_rates[0][global]"><?php _e('Apply to whole country', 'invoicing'); ?></label>
989 989
 				</td>
990
-				<td class="wpinv_tax_rate"><input type="number" class="small-text" step="any" min="0" max="99" name="tax_rates[0][rate]" placeholder="<?php echo (float)wpinv_get_option( 'tax_rate', 0 ) ;?>" value="<?php echo (float)wpinv_get_option( 'tax_rate', 0 ) ;?>"/></td>
990
+				<td class="wpinv_tax_rate"><input type="number" class="small-text" step="any" min="0" max="99" name="tax_rates[0][rate]" placeholder="<?php echo (float) wpinv_get_option('tax_rate', 0); ?>" value="<?php echo (float) wpinv_get_option('tax_rate', 0); ?>"/></td>
991 991
                 <td class="wpinv_tax_name"><input type="text" class="regular-text" name="tax_rates[0][name]" /></td>
992
-				<td><span class="wpinv_remove_tax_rate button-secondary"><?php _e( 'Remove Rate', 'invoicing' ); ?></span></td>
992
+				<td><span class="wpinv_remove_tax_rate button-secondary"><?php _e('Remove Rate', 'invoicing'); ?></span></td>
993 993
 			</tr>
994 994
 		<?php endif; ?>
995 995
         </tbody>
996
-        <tfoot><tr><td colspan="5"></td><td class="wpinv_tax_action"><span class="button-secondary" id="wpinv_add_tax_rate"><?php _e( 'Add Tax Rate', 'invoicing' ); ?></span></td></tr></tfoot>
996
+        <tfoot><tr><td colspan="5"></td><td class="wpinv_tax_action"><span class="button-secondary" id="wpinv_add_tax_rate"><?php _e('Add Tax Rate', 'invoicing'); ?></span></td></tr></tfoot>
997 997
 	</table>
998 998
 	<?php
999 999
 	echo ob_get_clean();
@@ -1004,76 +1004,76 @@  discard block
 block discarded – undo
1004 1004
     ob_start(); ?>
1005 1005
     </td><tr>
1006 1006
     <td colspan="2" class="wpinv_tools_tdbox">
1007
-    <?php if ( $args['desc'] ) { ?><p><?php echo $args['desc']; ?></p><?php } ?>
1008
-    <?php do_action( 'wpinv_tools_before' ); ?>
1007
+    <?php if ($args['desc']) { ?><p><?php echo $args['desc']; ?></p><?php } ?>
1008
+    <?php do_action('wpinv_tools_before'); ?>
1009 1009
     <table id="wpinv_tools_table" class="wp-list-table widefat fixed posts">
1010 1010
         <thead>
1011 1011
             <tr>
1012
-                <th scope="col" class="wpinv-th-tool"><?php _e( 'Tool', 'invoicing' ); ?></th>
1013
-                <th scope="col" class="wpinv-th-desc"><?php _e( 'Description', 'invoicing' ); ?></th>
1014
-                <th scope="col" class="wpinv-th-action"><?php _e( 'Action', 'invoicing' ); ?></th>
1012
+                <th scope="col" class="wpinv-th-tool"><?php _e('Tool', 'invoicing'); ?></th>
1013
+                <th scope="col" class="wpinv-th-desc"><?php _e('Description', 'invoicing'); ?></th>
1014
+                <th scope="col" class="wpinv-th-action"><?php _e('Action', 'invoicing'); ?></th>
1015 1015
             </tr>
1016 1016
         </thead>
1017
-            <?php do_action( 'wpinv_tools_row' ); ?>
1017
+            <?php do_action('wpinv_tools_row'); ?>
1018 1018
         <tbody>
1019 1019
         </tbody>
1020 1020
     </table>
1021
-    <?php do_action( 'wpinv_tools_after' ); ?>
1021
+    <?php do_action('wpinv_tools_after'); ?>
1022 1022
     <?php
1023 1023
     echo ob_get_clean();
1024 1024
 }
1025 1025
 
1026
-function wpinv_descriptive_text_callback( $args ) {
1027
-	echo wp_kses_post( $args['desc'] );
1026
+function wpinv_descriptive_text_callback($args) {
1027
+	echo wp_kses_post($args['desc']);
1028 1028
 }
1029 1029
 
1030
-function wpinv_hook_callback( $args ) {
1031
-	do_action( 'wpinv_' . $args['id'], $args );
1030
+function wpinv_hook_callback($args) {
1031
+	do_action('wpinv_' . $args['id'], $args);
1032 1032
 }
1033 1033
 
1034 1034
 function wpinv_set_settings_cap() {
1035 1035
 	return wpinv_get_capability();
1036 1036
 }
1037
-add_filter( 'option_page_capability_wpinv_settings', 'wpinv_set_settings_cap' );
1037
+add_filter('option_page_capability_wpinv_settings', 'wpinv_set_settings_cap');
1038 1038
 
1039
-function wpinv_settings_sanitize_input( $value, $key ) {
1040
-    if ( $key == 'tax_rate' || $key == 'eu_fallback_rate' ) {
1041
-        $value = wpinv_sanitize_amount( $value, 4 );
1039
+function wpinv_settings_sanitize_input($value, $key) {
1040
+    if ($key == 'tax_rate' || $key == 'eu_fallback_rate') {
1041
+        $value = wpinv_sanitize_amount($value, 4);
1042 1042
         $value = $value >= 100 ? 99 : $value;
1043 1043
     }
1044 1044
         
1045 1045
     return $value;
1046 1046
 }
1047
-add_filter( 'wpinv_settings_sanitize', 'wpinv_settings_sanitize_input', 10, 2 );
1047
+add_filter('wpinv_settings_sanitize', 'wpinv_settings_sanitize_input', 10, 2);
1048 1048
 
1049
-function wpinv_on_update_settings( $old_value, $value, $option ) {
1050
-    $old = !empty( $old_value['remove_data_on_unistall'] ) ? 1 : '';
1051
-    $new = !empty( $value['remove_data_on_unistall'] ) ? 1 : '';
1049
+function wpinv_on_update_settings($old_value, $value, $option) {
1050
+    $old = !empty($old_value['remove_data_on_unistall']) ? 1 : '';
1051
+    $new = !empty($value['remove_data_on_unistall']) ? 1 : '';
1052 1052
     
1053
-    if ( $old != $new ) {
1054
-        update_option( 'wpinv_remove_data_on_invoice_unistall', $new );
1053
+    if ($old != $new) {
1054
+        update_option('wpinv_remove_data_on_invoice_unistall', $new);
1055 1055
     }
1056 1056
 }
1057
-add_action( 'update_option_wpinv_settings', 'wpinv_on_update_settings', 10, 3 );
1058
-add_action( 'wpinv_settings_tab_bottom_emails_new_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2 );
1059
-add_action( 'wpinv_settings_tab_bottom_emails_cancelled_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2 );
1060
-add_action( 'wpinv_settings_tab_bottom_emails_failed_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2 );
1061
-add_action( 'wpinv_settings_tab_bottom_emails_onhold_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2 );
1062
-add_action( 'wpinv_settings_tab_bottom_emails_processing_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2 );
1063
-add_action( 'wpinv_settings_tab_bottom_emails_completed_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2 );
1064
-add_action( 'wpinv_settings_tab_bottom_emails_refunded_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2 );
1065
-add_action( 'wpinv_settings_tab_bottom_emails_user_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2 );
1066
-add_action( 'wpinv_settings_tab_bottom_emails_user_note', 'wpinv_settings_tab_bottom_emails', 10, 2 );
1067
-add_action( 'wpinv_settings_tab_bottom_emails_overdue', 'wpinv_settings_tab_bottom_emails', 10, 2 );
1068
-
1069
-function wpinv_settings_tab_bottom_emails( $active_tab, $section ) {
1057
+add_action('update_option_wpinv_settings', 'wpinv_on_update_settings', 10, 3);
1058
+add_action('wpinv_settings_tab_bottom_emails_new_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2);
1059
+add_action('wpinv_settings_tab_bottom_emails_cancelled_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2);
1060
+add_action('wpinv_settings_tab_bottom_emails_failed_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2);
1061
+add_action('wpinv_settings_tab_bottom_emails_onhold_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2);
1062
+add_action('wpinv_settings_tab_bottom_emails_processing_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2);
1063
+add_action('wpinv_settings_tab_bottom_emails_completed_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2);
1064
+add_action('wpinv_settings_tab_bottom_emails_refunded_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2);
1065
+add_action('wpinv_settings_tab_bottom_emails_user_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2);
1066
+add_action('wpinv_settings_tab_bottom_emails_user_note', 'wpinv_settings_tab_bottom_emails', 10, 2);
1067
+add_action('wpinv_settings_tab_bottom_emails_overdue', 'wpinv_settings_tab_bottom_emails', 10, 2);
1068
+
1069
+function wpinv_settings_tab_bottom_emails($active_tab, $section) {
1070 1070
     ?>
1071 1071
     <div class="wpinv-email-wc-row ">
1072 1072
         <div class="wpinv-email-wc-td">
1073
-            <h3 class="wpinv-email-wc-title"><?php echo apply_filters( 'wpinv_settings_email_wildcards_title', __( 'Wildcards For Emails', 'invoicing' ) ); ?></h3>
1073
+            <h3 class="wpinv-email-wc-title"><?php echo apply_filters('wpinv_settings_email_wildcards_title', __('Wildcards For Emails', 'invoicing')); ?></h3>
1074 1074
             <p class="wpinv-email-wc-description">
1075 1075
                 <?php
1076
-                $description = __( 'The following wildcards can be used in email subjects, heading and content:<br>
1076
+                $description = __('The following wildcards can be used in email subjects, heading and content:<br>
1077 1077
                     <strong>{site_title} :</strong> Site Title<br>
1078 1078
                     <strong>{name} :</strong> Customer\'s full name<br>
1079 1079
                     <strong>{first_name} :</strong> Customer\'s first name<br>
@@ -1087,7 +1087,7 @@  discard block
 block discarded – undo
1087 1087
                     <strong>{invoice_due_date} :</strong> The date the invoice is due<br>
1088 1088
                     <strong>{date} :</strong> Today\'s date.<br>
1089 1089
                     <strong>{is_was} :</strong> If due date of invoice is past, displays "was" otherwise displays "is"<br>
1090
-                    <strong>{invoice_label} :</strong> Invoices/quotes singular name. Ex: Invoice/Quote<br>', 'invoicing' );
1090
+                    <strong>{invoice_label} :</strong> Invoices/quotes singular name. Ex: Invoice/Quote<br>', 'invoicing');
1091 1091
                 echo apply_filters('wpinv_settings_email_wildcards_description', $description, $active_tab, $section);
1092 1092
                 ?>
1093 1093
             </p>
Please login to merge, or discard this patch.
includes/class-wpinv-addons.php 3 patches
Braces   +11 added lines, -12 removed lines patch added patch discarded remove patch
@@ -45,8 +45,7 @@  discard block
 block discarded – undo
45 45
 
46 46
 		if($section_id=='recommended_plugins'){
47 47
 			$section_data->products = self::get_recommend_wp_plugins_edd_formatted();
48
-		}
49
-		elseif ( ! empty( $section ) ) {
48
+		} elseif ( ! empty( $section ) ) {
50 49
 			if ( false === ( $section_data = get_transient( 'wpi_addons_section_' . $section_id ) ) ) { //@todo restore after testing
51 50
 			//if ( 1==1) {
52 51
 
@@ -121,13 +120,13 @@  discard block
 block discarded – undo
121 120
 			$button_args['file'] = isset($status['file']) ? $status['file'] : '';
122 121
 			if(isset($status['status'])){$button_args['install_status'] = $status['status'];}
123 122
 			$button_args['update_url'] = "https://wpinvoicing.com";
124
-		}elseif($current_tab == 'themes' && isset($addon->info->id) && $addon->info->id) {
123
+		} elseif($current_tab == 'themes' && isset($addon->info->id) && $addon->info->id) {
125 124
 			if(!empty($addon->licensing->edd_slug)){$button_args['slug'] = $addon->licensing->edd_slug;}
126 125
 			$button_args['installed'] = self::is_theme_installed($addon);
127 126
 			if(!in_array($button_args['slug'],$wp_org_themes)){
128 127
 				$button_args['update_url'] = "https://wpinvoicing.com";
129 128
 			}
130
-		}elseif($current_tab == 'recommended_plugins' && isset($addon->info->slug) && $addon->info->slug){
129
+		} elseif($current_tab == 'recommended_plugins' && isset($addon->info->slug) && $addon->info->slug){
131 130
 			include_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); //for plugins_api..
132 131
 			$status = install_plugin_install_status(array("slug"=>$button_args['slug'],"version"=>""));
133 132
 			$button_args['install_status'] = isset($status['status']) ? $status['status'] : 'install';
@@ -139,7 +138,7 @@  discard block
 block discarded – undo
139 138
 			if(is_object($addon->pricing)){
140 139
 				$prices = (Array)$addon->pricing;
141 140
 				$button_args['price'] = reset($prices);
142
-			}elseif(isset($addon->pricing)){
141
+			} elseif(isset($addon->pricing)){
143 142
 				$button_args['price'] = $addon->pricing;
144 143
 			}
145 144
 		}
@@ -160,7 +159,7 @@  discard block
 block discarded – undo
160 159
 		if($button_args['installed'] && ($button_args['file'] || $button_args['type'] == 'themes')){
161 160
 			if($button_args['type'] != 'themes'){
162 161
 				$button_args['active'] = is_plugin_active($button_args['file']);
163
-			}else{
162
+			} else{
164 163
 				$button_args['active'] = self::is_theme_active($addon);
165 164
 			}
166 165
 		}
@@ -169,27 +168,27 @@  discard block
 block discarded – undo
169 168
 		if($button_args['active']){
170 169
 			$button_args['button_text'] = __('Active','invoicing');
171 170
 			$button_args['class'] = ' button-secondary disabled ';
172
-		}elseif($button_args['installed']){
171
+		} elseif($button_args['installed']){
173 172
 			$button_args['button_text'] = __('Activate','invoicing');
174 173
 
175 174
 			if($button_args['type'] != 'themes'){
176 175
 				if ( current_user_can( 'manage_options' ) ) {
177 176
 					$button_args['url'] = wp_nonce_url(admin_url('plugins.php?action=activate&plugin='.$button_args['file']), 'activate-plugin_' . $button_args['file']);
178
-				}else{
177
+				} else{
179 178
 					$button_args['url'] = '#';
180 179
 				}
181
-			}else{
180
+			} else{
182 181
 				if ( current_user_can( 'switch_themes' ) ) {
183 182
 					$button_args['url'] = self::get_theme_activation_url($addon);
184
-				}else{
183
+				} else{
185 184
 					$button_args['url'] = '#';
186 185
 				}
187 186
 			}
188 187
 
189
-		}else{
188
+		} else{
190 189
 			if($button_args['type'] == 'recommended_plugins'){
191 190
 				$button_args['button_text'] = __('Install','invoicing');
192
-			}else{
191
+			} else{
193 192
 				$button_args['button_text'] = __('Get it','invoicing');
194 193
 
195 194
 				/*if($button_args['type'] == 'themes' && in_array($button_args['slug'],$wp_org_themes) ){
Please login to merge, or discard this patch.
Indentation   +203 added lines, -203 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  *
7 7
  */
8 8
 if ( ! defined( 'ABSPATH' ) ) {
9
-	exit;
9
+    exit;
10 10
 }
11 11
 
12 12
 /**
@@ -15,71 +15,71 @@  discard block
 block discarded – undo
15 15
 class WPInv_Admin_Addons extends Ayecode_Addons {
16 16
 
17 17
 
18
-	/**
19
-	 * Get the extensions page tabs.
20
-	 *
21
-	 * @return array of tabs.
22
-	 */
23
-	public function get_tabs(){
24
-		$tabs = array(
25
-			'addons' => __("Addons", "invoicing"),
18
+    /**
19
+     * Get the extensions page tabs.
20
+     *
21
+     * @return array of tabs.
22
+     */
23
+    public function get_tabs(){
24
+        $tabs = array(
25
+            'addons' => __("Addons", "invoicing"),
26 26
             'gateways' => __("Payment Gateways", "invoicing"),
27 27
             'recommended_plugins' => __("Recommended plugins", "invoicing"),
28 28
             'membership' => __("Membership", "invoicing"),
29
-		);
30
-
31
-		return $tabs;
32
-	}
33
-
34
-	/**
35
-	 * Get section content for the addons screen.
36
-	 *
37
-	 * @param  string $section_id
38
-	 *
39
-	 * @return array
40
-	 */
41
-	public function get_section_data( $section_id ) {
42
-		$section      = self::get_tab( $section_id );
43
-		$api_url = "https://wpinvoicing.com/edd-api/v2/products/";
44
-		$section_data = new stdClass();
45
-
46
-		if($section_id=='recommended_plugins'){
47
-			$section_data->products = self::get_recommend_wp_plugins_edd_formatted();
48
-		}
49
-		elseif ( ! empty( $section ) ) {
50
-			if ( false === ( $section_data = get_transient( 'wpi_addons_section_' . $section_id ) ) ) { //@todo restore after testing
51
-			//if ( 1==1) {
52
-
53
-				$query_args = array( 'category' => $section_id, 'number' => 100);
54
-				$query_args = apply_filters('wpeu_edd_api_query_args',$query_args,$api_url,$section_id);
55
-
56
-				$raw_section = wp_safe_remote_get( esc_url_raw( add_query_arg($query_args ,$api_url) ), array( 'user-agent' => 'Invoicing Addons Page','timeout'     => 15, ) );
57
-
58
-				if ( ! is_wp_error( $raw_section ) ) {
59
-					$section_data = json_decode( wp_remote_retrieve_body( $raw_section ) );
60
-
61
-					if ( ! empty( $section_data->products ) ) {
62
-						set_transient( 'wpi_addons_section_' . $section_id, $section_data, DAY_IN_SECONDS );
63
-					}
64
-				}
65
-			}
66
-		}
67
-
68
-		$products = isset($section_data->products) ? $section_data->products : '';
69
-
70
-		return apply_filters( 'wpi_addons_section_data', $products, $section_id );
71
-	}
72
-
73
-	/**
74
-	 * Outputs a button.
75
-	 *ccc
76
-	 * @param string $url
77
-	 * @param string $text
78
-	 * @param string $theme
79
-	 * @param string $plugin
80
-	 */
81
-	public function output_button( $addon ) {
82
-		$current_tab     = empty( $_GET['tab'] ) ? 'addons' : sanitize_title( $_GET['tab'] );
29
+        );
30
+
31
+        return $tabs;
32
+    }
33
+
34
+    /**
35
+     * Get section content for the addons screen.
36
+     *
37
+     * @param  string $section_id
38
+     *
39
+     * @return array
40
+     */
41
+    public function get_section_data( $section_id ) {
42
+        $section      = self::get_tab( $section_id );
43
+        $api_url = "https://wpinvoicing.com/edd-api/v2/products/";
44
+        $section_data = new stdClass();
45
+
46
+        if($section_id=='recommended_plugins'){
47
+            $section_data->products = self::get_recommend_wp_plugins_edd_formatted();
48
+        }
49
+        elseif ( ! empty( $section ) ) {
50
+            if ( false === ( $section_data = get_transient( 'wpi_addons_section_' . $section_id ) ) ) { //@todo restore after testing
51
+            //if ( 1==1) {
52
+
53
+                $query_args = array( 'category' => $section_id, 'number' => 100);
54
+                $query_args = apply_filters('wpeu_edd_api_query_args',$query_args,$api_url,$section_id);
55
+
56
+                $raw_section = wp_safe_remote_get( esc_url_raw( add_query_arg($query_args ,$api_url) ), array( 'user-agent' => 'Invoicing Addons Page','timeout'     => 15, ) );
57
+
58
+                if ( ! is_wp_error( $raw_section ) ) {
59
+                    $section_data = json_decode( wp_remote_retrieve_body( $raw_section ) );
60
+
61
+                    if ( ! empty( $section_data->products ) ) {
62
+                        set_transient( 'wpi_addons_section_' . $section_id, $section_data, DAY_IN_SECONDS );
63
+                    }
64
+                }
65
+            }
66
+        }
67
+
68
+        $products = isset($section_data->products) ? $section_data->products : '';
69
+
70
+        return apply_filters( 'wpi_addons_section_data', $products, $section_id );
71
+    }
72
+
73
+    /**
74
+     * Outputs a button.
75
+     *ccc
76
+     * @param string $url
77
+     * @param string $text
78
+     * @param string $theme
79
+     * @param string $plugin
80
+     */
81
+    public function output_button( $addon ) {
82
+        $current_tab     = empty( $_GET['tab'] ) ? 'addons' : sanitize_title( $_GET['tab'] );
83 83
 //		$button_text = __('Free','invoicing');
84 84
 //		$licensing = false;
85 85
 //		$installed = false;
@@ -91,123 +91,123 @@  discard block
 block discarded – undo
91 91
 //		$install_status = 'get';
92 92
 //		$onclick = '';
93 93
 
94
-		$wp_org_themes = array('supreme-directory','directory-starter');
95
-
96
-		$button_args = array(
97
-			'type' => ($current_tab == 'addons' || $current_tab =='gateways') ? 'addons' : $current_tab,
98
-			'id' => isset($addon->info->id) ? absint($addon->info->id) : '',
99
-			'title' => isset($addon->info->title) ? $addon->info->title : '',
100
-			'button_text' => __('Free','invoicing'),
101
-			'price_text' => __('Free','invoicing'),
102
-			'link' => isset($addon->info->link) ? $addon->info->link : '', // link to product
103
-			'url' => isset($addon->info->link) ? $addon->info->link : '', // button url
104
-			'class' => 'button-primary',
105
-			'install_status' => 'get',
106
-			'installed' => false,
107
-			'price' => '',
108
-			'licensing' => isset($addon->licensing->enabled) && $addon->licensing->enabled ? true : false,
109
-			'license' => isset($addon->licensing->license) && $addon->licensing->license ? $addon->licensing->license : '',
110
-			'onclick' => '',
111
-			'slug' => isset($addon->info->slug) ? $addon->info->slug : '',
112
-			'active' => false,
113
-			'file' => '',
114
-			'update_url' => '',
115
-		);
116
-
117
-		if( ($current_tab == 'addons' || $current_tab =='gateways') && isset($addon->info->id) && $addon->info->id){
118
-			include_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); //for plugins_api..
119
-			if(!empty($addon->licensing->edd_slug)){$button_args['slug'] = $addon->licensing->edd_slug;}
120
-			$status = self::install_plugin_install_status($addon);
121
-			$button_args['file'] = isset($status['file']) ? $status['file'] : '';
122
-			if(isset($status['status'])){$button_args['install_status'] = $status['status'];}
123
-			$button_args['update_url'] = "https://wpinvoicing.com";
124
-		}elseif($current_tab == 'themes' && isset($addon->info->id) && $addon->info->id) {
125
-			if(!empty($addon->licensing->edd_slug)){$button_args['slug'] = $addon->licensing->edd_slug;}
126
-			$button_args['installed'] = self::is_theme_installed($addon);
127
-			if(!in_array($button_args['slug'],$wp_org_themes)){
128
-				$button_args['update_url'] = "https://wpinvoicing.com";
129
-			}
130
-		}elseif($current_tab == 'recommended_plugins' && isset($addon->info->slug) && $addon->info->slug){
131
-			include_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); //for plugins_api..
132
-			$status = install_plugin_install_status(array("slug"=>$button_args['slug'],"version"=>""));
133
-			$button_args['install_status'] = isset($status['status']) ? $status['status'] : 'install';
134
-			$button_args['file'] = isset($status['file']) ? $status['file'] : '';
135
-		}
136
-
137
-		// set price
138
-		if(isset($addon->pricing) && !empty($addon->pricing)){
139
-			if(is_object($addon->pricing)){
140
-				$prices = (Array)$addon->pricing;
141
-				$button_args['price'] = reset($prices);
142
-			}elseif(isset($addon->pricing)){
143
-				$button_args['price'] = $addon->pricing;
144
-			}
145
-		}
146
-
147
-		// set price text
148
-		if( $button_args['price'] && $button_args['price'] != '0.00' ){
149
-			$button_args['price_text'] = sprintf( __('From: $%d', 'invoicing'), $button_args['price']);
150
-		}
151
-
152
-
153
-		// set if installed
154
-		if(in_array($button_args['install_status'], array('installed','latest_installed','update_available','newer_installed'))){
155
-			$button_args['installed'] = true;
156
-		}
94
+        $wp_org_themes = array('supreme-directory','directory-starter');
95
+
96
+        $button_args = array(
97
+            'type' => ($current_tab == 'addons' || $current_tab =='gateways') ? 'addons' : $current_tab,
98
+            'id' => isset($addon->info->id) ? absint($addon->info->id) : '',
99
+            'title' => isset($addon->info->title) ? $addon->info->title : '',
100
+            'button_text' => __('Free','invoicing'),
101
+            'price_text' => __('Free','invoicing'),
102
+            'link' => isset($addon->info->link) ? $addon->info->link : '', // link to product
103
+            'url' => isset($addon->info->link) ? $addon->info->link : '', // button url
104
+            'class' => 'button-primary',
105
+            'install_status' => 'get',
106
+            'installed' => false,
107
+            'price' => '',
108
+            'licensing' => isset($addon->licensing->enabled) && $addon->licensing->enabled ? true : false,
109
+            'license' => isset($addon->licensing->license) && $addon->licensing->license ? $addon->licensing->license : '',
110
+            'onclick' => '',
111
+            'slug' => isset($addon->info->slug) ? $addon->info->slug : '',
112
+            'active' => false,
113
+            'file' => '',
114
+            'update_url' => '',
115
+        );
116
+
117
+        if( ($current_tab == 'addons' || $current_tab =='gateways') && isset($addon->info->id) && $addon->info->id){
118
+            include_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); //for plugins_api..
119
+            if(!empty($addon->licensing->edd_slug)){$button_args['slug'] = $addon->licensing->edd_slug;}
120
+            $status = self::install_plugin_install_status($addon);
121
+            $button_args['file'] = isset($status['file']) ? $status['file'] : '';
122
+            if(isset($status['status'])){$button_args['install_status'] = $status['status'];}
123
+            $button_args['update_url'] = "https://wpinvoicing.com";
124
+        }elseif($current_tab == 'themes' && isset($addon->info->id) && $addon->info->id) {
125
+            if(!empty($addon->licensing->edd_slug)){$button_args['slug'] = $addon->licensing->edd_slug;}
126
+            $button_args['installed'] = self::is_theme_installed($addon);
127
+            if(!in_array($button_args['slug'],$wp_org_themes)){
128
+                $button_args['update_url'] = "https://wpinvoicing.com";
129
+            }
130
+        }elseif($current_tab == 'recommended_plugins' && isset($addon->info->slug) && $addon->info->slug){
131
+            include_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); //for plugins_api..
132
+            $status = install_plugin_install_status(array("slug"=>$button_args['slug'],"version"=>""));
133
+            $button_args['install_status'] = isset($status['status']) ? $status['status'] : 'install';
134
+            $button_args['file'] = isset($status['file']) ? $status['file'] : '';
135
+        }
136
+
137
+        // set price
138
+        if(isset($addon->pricing) && !empty($addon->pricing)){
139
+            if(is_object($addon->pricing)){
140
+                $prices = (Array)$addon->pricing;
141
+                $button_args['price'] = reset($prices);
142
+            }elseif(isset($addon->pricing)){
143
+                $button_args['price'] = $addon->pricing;
144
+            }
145
+        }
146
+
147
+        // set price text
148
+        if( $button_args['price'] && $button_args['price'] != '0.00' ){
149
+            $button_args['price_text'] = sprintf( __('From: $%d', 'invoicing'), $button_args['price']);
150
+        }
151
+
152
+
153
+        // set if installed
154
+        if(in_array($button_args['install_status'], array('installed','latest_installed','update_available','newer_installed'))){
155
+            $button_args['installed'] = true;
156
+        }
157 157
 
158 158
 //		print_r($button_args);
159
-		// set if active
160
-		if($button_args['installed'] && ($button_args['file'] || $button_args['type'] == 'themes')){
161
-			if($button_args['type'] != 'themes'){
162
-				$button_args['active'] = is_plugin_active($button_args['file']);
163
-			}else{
164
-				$button_args['active'] = self::is_theme_active($addon);
165
-			}
166
-		}
167
-
168
-		// set button text and class
169
-		if($button_args['active']){
170
-			$button_args['button_text'] = __('Active','invoicing');
171
-			$button_args['class'] = ' button-secondary disabled ';
172
-		}elseif($button_args['installed']){
173
-			$button_args['button_text'] = __('Activate','invoicing');
174
-
175
-			if($button_args['type'] != 'themes'){
176
-				if ( current_user_can( 'manage_options' ) ) {
177
-					$button_args['url'] = wp_nonce_url(admin_url('plugins.php?action=activate&plugin='.$button_args['file']), 'activate-plugin_' . $button_args['file']);
178
-				}else{
179
-					$button_args['url'] = '#';
180
-				}
181
-			}else{
182
-				if ( current_user_can( 'switch_themes' ) ) {
183
-					$button_args['url'] = self::get_theme_activation_url($addon);
184
-				}else{
185
-					$button_args['url'] = '#';
186
-				}
187
-			}
188
-
189
-		}else{
190
-			if($button_args['type'] == 'recommended_plugins'){
191
-				$button_args['button_text'] = __('Install','invoicing');
192
-			}else{
193
-				$button_args['button_text'] = __('Get it','invoicing');
194
-
195
-				/*if($button_args['type'] == 'themes' && in_array($button_args['slug'],$wp_org_themes) ){
159
+        // set if active
160
+        if($button_args['installed'] && ($button_args['file'] || $button_args['type'] == 'themes')){
161
+            if($button_args['type'] != 'themes'){
162
+                $button_args['active'] = is_plugin_active($button_args['file']);
163
+            }else{
164
+                $button_args['active'] = self::is_theme_active($addon);
165
+            }
166
+        }
167
+
168
+        // set button text and class
169
+        if($button_args['active']){
170
+            $button_args['button_text'] = __('Active','invoicing');
171
+            $button_args['class'] = ' button-secondary disabled ';
172
+        }elseif($button_args['installed']){
173
+            $button_args['button_text'] = __('Activate','invoicing');
174
+
175
+            if($button_args['type'] != 'themes'){
176
+                if ( current_user_can( 'manage_options' ) ) {
177
+                    $button_args['url'] = wp_nonce_url(admin_url('plugins.php?action=activate&plugin='.$button_args['file']), 'activate-plugin_' . $button_args['file']);
178
+                }else{
179
+                    $button_args['url'] = '#';
180
+                }
181
+            }else{
182
+                if ( current_user_can( 'switch_themes' ) ) {
183
+                    $button_args['url'] = self::get_theme_activation_url($addon);
184
+                }else{
185
+                    $button_args['url'] = '#';
186
+                }
187
+            }
188
+
189
+        }else{
190
+            if($button_args['type'] == 'recommended_plugins'){
191
+                $button_args['button_text'] = __('Install','invoicing');
192
+            }else{
193
+                $button_args['button_text'] = __('Get it','invoicing');
194
+
195
+                /*if($button_args['type'] == 'themes' && in_array($button_args['slug'],$wp_org_themes) ){
196 196
 					$button_args['button_text'] = __('Install','invoicing');
197 197
 					$button_args['url'] = self::get_theme_install_url($button_args['slug']);
198 198
 					$button_args['onclick'] = 'gd_set_button_installing(this);';
199 199
 				}*/
200 200
 
201
-			}
202
-		}
201
+            }
202
+        }
203 203
 
204 204
 		
205
-		// filter the button arguments
206
-		$button_args = apply_filters('edd_api_button_args',$button_args);
205
+        // filter the button arguments
206
+        $button_args = apply_filters('edd_api_button_args',$button_args);
207 207
 //		print_r($button_args);
208
-		// set price text
209
-		if(isset($button_args['price_text'])){
210
-			?>
208
+        // set price text
209
+        if(isset($button_args['price_text'])){
210
+            ?>
211 211
 			<a
212 212
 				target="_blank"
213 213
 				class="addons-price-text"
@@ -215,15 +215,15 @@  discard block
 block discarded – undo
215 215
 				<?php echo esc_html( $button_args['price_text'] ); ?>
216 216
 			</a>
217 217
 			<?php
218
-		}
218
+        }
219 219
 
220 220
 
221
-		$target = '';
222
-		if ( ! empty( $button_args['url'] ) ) {
223
-			$target = strpos($button_args['url'], get_site_url()) !== false ? '' : ' target="_blank" ';
224
-		}
221
+        $target = '';
222
+        if ( ! empty( $button_args['url'] ) ) {
223
+            $target = strpos($button_args['url'], get_site_url()) !== false ? '' : ' target="_blank" ';
224
+        }
225 225
 
226
-		?>
226
+        ?>
227 227
 		<a
228 228
 			data-licence="<?php echo esc_attr($button_args['license']);?>"
229 229
 			data-licensing="<?php echo $button_args['licensing'] ? 1 : 0;?>"
@@ -246,33 +246,33 @@  discard block
 block discarded – undo
246 246
 		<?php
247 247
 
248 248
 
249
-	}
250
-
251
-
252
-	/**
253
-	 * Handles output of the addons page in admin.
254
-	 */
255
-	public function output() {
256
-		$tabs            = self::get_tabs();
257
-		$sections        = self::get_sections();
258
-		$theme           = wp_get_theme();
259
-		$section_keys    = array_keys( $sections );
260
-		$current_section = isset( $_GET['section'] ) ? sanitize_text_field( $_GET['section'] ) : current( $section_keys );
261
-		$current_tab     = empty( $_GET['tab'] ) ? 'addons' : sanitize_title( $_GET['tab'] );
262
-		include_once( WPINV_PLUGIN_DIR . '/includes/admin/html-admin-page-addons.php' );
263
-	}
264
-
265
-	/**
266
-	 * A list of recommended wp.org plugins.
267
-	 * @return array
268
-	 */
269
-	public function get_recommend_wp_plugins(){
270
-		$plugins = array(
249
+    }
250
+
251
+
252
+    /**
253
+     * Handles output of the addons page in admin.
254
+     */
255
+    public function output() {
256
+        $tabs            = self::get_tabs();
257
+        $sections        = self::get_sections();
258
+        $theme           = wp_get_theme();
259
+        $section_keys    = array_keys( $sections );
260
+        $current_section = isset( $_GET['section'] ) ? sanitize_text_field( $_GET['section'] ) : current( $section_keys );
261
+        $current_tab     = empty( $_GET['tab'] ) ? 'addons' : sanitize_title( $_GET['tab'] );
262
+        include_once( WPINV_PLUGIN_DIR . '/includes/admin/html-admin-page-addons.php' );
263
+    }
264
+
265
+    /**
266
+     * A list of recommended wp.org plugins.
267
+     * @return array
268
+     */
269
+    public function get_recommend_wp_plugins(){
270
+        $plugins = array(
271 271
             'invoicing-quotes' => array(
272 272
                 'url'   => 'https://wordpress.org/plugins/invoicing-quotes/',
273 273
                 'slug'   => 'invoicing-quotes',
274
-				'name'   => 'Quotes',
275
-				'thumbnail'  => 'https://ps.w.org/invoicing-quotes/assets/banner-772x250.jpg',
274
+                'name'   => 'Quotes',
275
+                'thumbnail'  => 'https://ps.w.org/invoicing-quotes/assets/banner-772x250.jpg',
276 276
                 'desc'   => __('Allows you to create quotes, send them to clients and convert them to Invoices when accepted by the customer.','invoicing'),
277 277
             ),
278 278
             'geodirectory' => array(
@@ -287,8 +287,8 @@  discard block
 block discarded – undo
287 287
                 'name'   => 'UsersWP',
288 288
                 'desc'   => __('Allow frontend user login and registration as well as have slick profile pages.','invoicing'),
289 289
             ),
290
-		);
290
+        );
291 291
 
292
-		return $plugins;
293
-	}
292
+        return $plugins;
293
+    }
294 294
 }
Please login to merge, or discard this patch.
Spacing   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
  * All Invoicing extensions screen related functions can be found here.
6 6
  *
7 7
  */
8
-if ( ! defined( 'ABSPATH' ) ) {
8
+if (!defined('ABSPATH')) {
9 9
 	exit;
10 10
 }
11 11
 
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 	 *
21 21
 	 * @return array of tabs.
22 22
 	 */
23
-	public function get_tabs(){
23
+	public function get_tabs() {
24 24
 		$tabs = array(
25 25
 			'addons' => __("Addons", "invoicing"),
26 26
             'gateways' => __("Payment Gateways", "invoicing"),
@@ -38,28 +38,28 @@  discard block
 block discarded – undo
38 38
 	 *
39 39
 	 * @return array
40 40
 	 */
41
-	public function get_section_data( $section_id ) {
42
-		$section      = self::get_tab( $section_id );
41
+	public function get_section_data($section_id) {
42
+		$section      = self::get_tab($section_id);
43 43
 		$api_url = "https://wpinvoicing.com/edd-api/v2/products/";
44 44
 		$section_data = new stdClass();
45 45
 
46
-		if($section_id=='recommended_plugins'){
46
+		if ($section_id == 'recommended_plugins') {
47 47
 			$section_data->products = self::get_recommend_wp_plugins_edd_formatted();
48 48
 		}
49
-		elseif ( ! empty( $section ) ) {
50
-			if ( false === ( $section_data = get_transient( 'wpi_addons_section_' . $section_id ) ) ) { //@todo restore after testing
49
+		elseif (!empty($section)) {
50
+			if (false === ($section_data = get_transient('wpi_addons_section_' . $section_id))) { //@todo restore after testing
51 51
 			//if ( 1==1) {
52 52
 
53
-				$query_args = array( 'category' => $section_id, 'number' => 100);
54
-				$query_args = apply_filters('wpeu_edd_api_query_args',$query_args,$api_url,$section_id);
53
+				$query_args = array('category' => $section_id, 'number' => 100);
54
+				$query_args = apply_filters('wpeu_edd_api_query_args', $query_args, $api_url, $section_id);
55 55
 
56
-				$raw_section = wp_safe_remote_get( esc_url_raw( add_query_arg($query_args ,$api_url) ), array( 'user-agent' => 'Invoicing Addons Page','timeout'     => 15, ) );
56
+				$raw_section = wp_safe_remote_get(esc_url_raw(add_query_arg($query_args, $api_url)), array('user-agent' => 'Invoicing Addons Page', 'timeout'     => 15,));
57 57
 
58
-				if ( ! is_wp_error( $raw_section ) ) {
59
-					$section_data = json_decode( wp_remote_retrieve_body( $raw_section ) );
58
+				if (!is_wp_error($raw_section)) {
59
+					$section_data = json_decode(wp_remote_retrieve_body($raw_section));
60 60
 
61
-					if ( ! empty( $section_data->products ) ) {
62
-						set_transient( 'wpi_addons_section_' . $section_id, $section_data, DAY_IN_SECONDS );
61
+					if (!empty($section_data->products)) {
62
+						set_transient('wpi_addons_section_' . $section_id, $section_data, DAY_IN_SECONDS);
63 63
 					}
64 64
 				}
65 65
 			}
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 
68 68
 		$products = isset($section_data->products) ? $section_data->products : '';
69 69
 
70
-		return apply_filters( 'wpi_addons_section_data', $products, $section_id );
70
+		return apply_filters('wpi_addons_section_data', $products, $section_id);
71 71
 	}
72 72
 
73 73
 	/**
@@ -78,8 +78,8 @@  discard block
 block discarded – undo
78 78
 	 * @param string $theme
79 79
 	 * @param string $plugin
80 80
 	 */
81
-	public function output_button( $addon ) {
82
-		$current_tab     = empty( $_GET['tab'] ) ? 'addons' : sanitize_title( $_GET['tab'] );
81
+	public function output_button($addon) {
82
+		$current_tab = empty($_GET['tab']) ? 'addons' : sanitize_title($_GET['tab']);
83 83
 //		$button_text = __('Free','invoicing');
84 84
 //		$licensing = false;
85 85
 //		$installed = false;
@@ -91,14 +91,14 @@  discard block
 block discarded – undo
91 91
 //		$install_status = 'get';
92 92
 //		$onclick = '';
93 93
 
94
-		$wp_org_themes = array('supreme-directory','directory-starter');
94
+		$wp_org_themes = array('supreme-directory', 'directory-starter');
95 95
 
96 96
 		$button_args = array(
97
-			'type' => ($current_tab == 'addons' || $current_tab =='gateways') ? 'addons' : $current_tab,
97
+			'type' => ($current_tab == 'addons' || $current_tab == 'gateways') ? 'addons' : $current_tab,
98 98
 			'id' => isset($addon->info->id) ? absint($addon->info->id) : '',
99 99
 			'title' => isset($addon->info->title) ? $addon->info->title : '',
100
-			'button_text' => __('Free','invoicing'),
101
-			'price_text' => __('Free','invoicing'),
100
+			'button_text' => __('Free', 'invoicing'),
101
+			'price_text' => __('Free', 'invoicing'),
102 102
 			'link' => isset($addon->info->link) ? $addon->info->link : '', // link to product
103 103
 			'url' => isset($addon->info->link) ? $addon->info->link : '', // button url
104 104
 			'class' => 'button-primary',
@@ -114,83 +114,83 @@  discard block
 block discarded – undo
114 114
 			'update_url' => '',
115 115
 		);
116 116
 
117
-		if( ($current_tab == 'addons' || $current_tab =='gateways') && isset($addon->info->id) && $addon->info->id){
118
-			include_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); //for plugins_api..
119
-			if(!empty($addon->licensing->edd_slug)){$button_args['slug'] = $addon->licensing->edd_slug;}
117
+		if (($current_tab == 'addons' || $current_tab == 'gateways') && isset($addon->info->id) && $addon->info->id) {
118
+			include_once(ABSPATH . 'wp-admin/includes/plugin-install.php'); //for plugins_api..
119
+			if (!empty($addon->licensing->edd_slug)) {$button_args['slug'] = $addon->licensing->edd_slug; }
120 120
 			$status = self::install_plugin_install_status($addon);
121 121
 			$button_args['file'] = isset($status['file']) ? $status['file'] : '';
122
-			if(isset($status['status'])){$button_args['install_status'] = $status['status'];}
122
+			if (isset($status['status'])) {$button_args['install_status'] = $status['status']; }
123 123
 			$button_args['update_url'] = "https://wpinvoicing.com";
124
-		}elseif($current_tab == 'themes' && isset($addon->info->id) && $addon->info->id) {
125
-			if(!empty($addon->licensing->edd_slug)){$button_args['slug'] = $addon->licensing->edd_slug;}
124
+		}elseif ($current_tab == 'themes' && isset($addon->info->id) && $addon->info->id) {
125
+			if (!empty($addon->licensing->edd_slug)) {$button_args['slug'] = $addon->licensing->edd_slug; }
126 126
 			$button_args['installed'] = self::is_theme_installed($addon);
127
-			if(!in_array($button_args['slug'],$wp_org_themes)){
127
+			if (!in_array($button_args['slug'], $wp_org_themes)) {
128 128
 				$button_args['update_url'] = "https://wpinvoicing.com";
129 129
 			}
130
-		}elseif($current_tab == 'recommended_plugins' && isset($addon->info->slug) && $addon->info->slug){
131
-			include_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); //for plugins_api..
132
-			$status = install_plugin_install_status(array("slug"=>$button_args['slug'],"version"=>""));
130
+		}elseif ($current_tab == 'recommended_plugins' && isset($addon->info->slug) && $addon->info->slug) {
131
+			include_once(ABSPATH . 'wp-admin/includes/plugin-install.php'); //for plugins_api..
132
+			$status = install_plugin_install_status(array("slug"=>$button_args['slug'], "version"=>""));
133 133
 			$button_args['install_status'] = isset($status['status']) ? $status['status'] : 'install';
134 134
 			$button_args['file'] = isset($status['file']) ? $status['file'] : '';
135 135
 		}
136 136
 
137 137
 		// set price
138
-		if(isset($addon->pricing) && !empty($addon->pricing)){
139
-			if(is_object($addon->pricing)){
140
-				$prices = (Array)$addon->pricing;
138
+		if (isset($addon->pricing) && !empty($addon->pricing)) {
139
+			if (is_object($addon->pricing)) {
140
+				$prices = (Array) $addon->pricing;
141 141
 				$button_args['price'] = reset($prices);
142
-			}elseif(isset($addon->pricing)){
142
+			}elseif (isset($addon->pricing)) {
143 143
 				$button_args['price'] = $addon->pricing;
144 144
 			}
145 145
 		}
146 146
 
147 147
 		// set price text
148
-		if( $button_args['price'] && $button_args['price'] != '0.00' ){
149
-			$button_args['price_text'] = sprintf( __('From: $%d', 'invoicing'), $button_args['price']);
148
+		if ($button_args['price'] && $button_args['price'] != '0.00') {
149
+			$button_args['price_text'] = sprintf(__('From: $%d', 'invoicing'), $button_args['price']);
150 150
 		}
151 151
 
152 152
 
153 153
 		// set if installed
154
-		if(in_array($button_args['install_status'], array('installed','latest_installed','update_available','newer_installed'))){
154
+		if (in_array($button_args['install_status'], array('installed', 'latest_installed', 'update_available', 'newer_installed'))) {
155 155
 			$button_args['installed'] = true;
156 156
 		}
157 157
 
158 158
 //		print_r($button_args);
159 159
 		// set if active
160
-		if($button_args['installed'] && ($button_args['file'] || $button_args['type'] == 'themes')){
161
-			if($button_args['type'] != 'themes'){
160
+		if ($button_args['installed'] && ($button_args['file'] || $button_args['type'] == 'themes')) {
161
+			if ($button_args['type'] != 'themes') {
162 162
 				$button_args['active'] = is_plugin_active($button_args['file']);
163
-			}else{
163
+			} else {
164 164
 				$button_args['active'] = self::is_theme_active($addon);
165 165
 			}
166 166
 		}
167 167
 
168 168
 		// set button text and class
169
-		if($button_args['active']){
170
-			$button_args['button_text'] = __('Active','invoicing');
169
+		if ($button_args['active']) {
170
+			$button_args['button_text'] = __('Active', 'invoicing');
171 171
 			$button_args['class'] = ' button-secondary disabled ';
172
-		}elseif($button_args['installed']){
173
-			$button_args['button_text'] = __('Activate','invoicing');
172
+		}elseif ($button_args['installed']) {
173
+			$button_args['button_text'] = __('Activate', 'invoicing');
174 174
 
175
-			if($button_args['type'] != 'themes'){
176
-				if ( current_user_can( 'manage_options' ) ) {
177
-					$button_args['url'] = wp_nonce_url(admin_url('plugins.php?action=activate&plugin='.$button_args['file']), 'activate-plugin_' . $button_args['file']);
178
-				}else{
175
+			if ($button_args['type'] != 'themes') {
176
+				if (current_user_can('manage_options')) {
177
+					$button_args['url'] = wp_nonce_url(admin_url('plugins.php?action=activate&plugin=' . $button_args['file']), 'activate-plugin_' . $button_args['file']);
178
+				} else {
179 179
 					$button_args['url'] = '#';
180 180
 				}
181
-			}else{
182
-				if ( current_user_can( 'switch_themes' ) ) {
181
+			} else {
182
+				if (current_user_can('switch_themes')) {
183 183
 					$button_args['url'] = self::get_theme_activation_url($addon);
184
-				}else{
184
+				} else {
185 185
 					$button_args['url'] = '#';
186 186
 				}
187 187
 			}
188 188
 
189
-		}else{
190
-			if($button_args['type'] == 'recommended_plugins'){
191
-				$button_args['button_text'] = __('Install','invoicing');
192
-			}else{
193
-				$button_args['button_text'] = __('Get it','invoicing');
189
+		} else {
190
+			if ($button_args['type'] == 'recommended_plugins') {
191
+				$button_args['button_text'] = __('Install', 'invoicing');
192
+			} else {
193
+				$button_args['button_text'] = __('Get it', 'invoicing');
194 194
 
195 195
 				/*if($button_args['type'] == 'themes' && in_array($button_args['slug'],$wp_org_themes) ){
196 196
 					$button_args['button_text'] = __('Install','invoicing');
@@ -203,45 +203,45 @@  discard block
 block discarded – undo
203 203
 
204 204
 		
205 205
 		// filter the button arguments
206
-		$button_args = apply_filters('edd_api_button_args',$button_args);
206
+		$button_args = apply_filters('edd_api_button_args', $button_args);
207 207
 //		print_r($button_args);
208 208
 		// set price text
209
-		if(isset($button_args['price_text'])){
209
+		if (isset($button_args['price_text'])) {
210 210
 			?>
211 211
 			<a
212 212
 				target="_blank"
213 213
 				class="addons-price-text"
214
-				href="<?php echo esc_url( $button_args['link'] ); ?>">
215
-				<?php echo esc_html( $button_args['price_text'] ); ?>
214
+				href="<?php echo esc_url($button_args['link']); ?>">
215
+				<?php echo esc_html($button_args['price_text']); ?>
216 216
 			</a>
217 217
 			<?php
218 218
 		}
219 219
 
220 220
 
221 221
 		$target = '';
222
-		if ( ! empty( $button_args['url'] ) ) {
222
+		if (!empty($button_args['url'])) {
223 223
 			$target = strpos($button_args['url'], get_site_url()) !== false ? '' : ' target="_blank" ';
224 224
 		}
225 225
 
226 226
 		?>
227 227
 		<a
228
-			data-licence="<?php echo esc_attr($button_args['license']);?>"
229
-			data-licensing="<?php echo $button_args['licensing'] ? 1 : 0;?>"
230
-			data-title="<?php echo esc_attr($button_args['title']);?>"
231
-			data-type="<?php echo esc_attr($button_args['type']);?>"
232
-			data-text-error-message="<?php _e('Something went wrong!','invoicing');?>"
233
-			data-text-activate="<?php _e('Activate','invoicing');?>"
234
-			data-text-activating="<?php _e('Activating','invoicing');?>"
235
-			data-text-deactivate="<?php _e('Deactivate','invoicing');?>"
236
-			data-text-installed="<?php _e('Installed','invoicing');?>"
237
-			data-text-install="<?php _e('Install','invoicing');?>"
238
-			data-text-installing="<?php _e('Installing','invoicing');?>"
239
-			data-text-error="<?php _e('Error','invoicing');?>"
240
-			<?php if(!empty($button_args['onclick'])){echo " onclick='".$button_args['onclick']."' ";}?>
241
-			<?php echo $target;?>
242
-			class="addons-button  <?php echo esc_attr( $button_args['class'] ); ?>"
243
-			href="<?php echo esc_url( $button_args['url'] ); ?>">
244
-			<?php echo esc_html( $button_args['button_text'] ); ?>
228
+			data-licence="<?php echo esc_attr($button_args['license']); ?>"
229
+			data-licensing="<?php echo $button_args['licensing'] ? 1 : 0; ?>"
230
+			data-title="<?php echo esc_attr($button_args['title']); ?>"
231
+			data-type="<?php echo esc_attr($button_args['type']); ?>"
232
+			data-text-error-message="<?php _e('Something went wrong!', 'invoicing'); ?>"
233
+			data-text-activate="<?php _e('Activate', 'invoicing'); ?>"
234
+			data-text-activating="<?php _e('Activating', 'invoicing'); ?>"
235
+			data-text-deactivate="<?php _e('Deactivate', 'invoicing'); ?>"
236
+			data-text-installed="<?php _e('Installed', 'invoicing'); ?>"
237
+			data-text-install="<?php _e('Install', 'invoicing'); ?>"
238
+			data-text-installing="<?php _e('Installing', 'invoicing'); ?>"
239
+			data-text-error="<?php _e('Error', 'invoicing'); ?>"
240
+			<?php if (!empty($button_args['onclick'])) {echo " onclick='" . $button_args['onclick'] . "' "; }?>
241
+			<?php echo $target; ?>
242
+			class="addons-button  <?php echo esc_attr($button_args['class']); ?>"
243
+			href="<?php echo esc_url($button_args['url']); ?>">
244
+			<?php echo esc_html($button_args['button_text']); ?>
245 245
 		</a>
246 246
 		<?php
247 247
 
@@ -256,36 +256,36 @@  discard block
 block discarded – undo
256 256
 		$tabs            = self::get_tabs();
257 257
 		$sections        = self::get_sections();
258 258
 		$theme           = wp_get_theme();
259
-		$section_keys    = array_keys( $sections );
260
-		$current_section = isset( $_GET['section'] ) ? sanitize_text_field( $_GET['section'] ) : current( $section_keys );
261
-		$current_tab     = empty( $_GET['tab'] ) ? 'addons' : sanitize_title( $_GET['tab'] );
262
-		include_once( WPINV_PLUGIN_DIR . '/includes/admin/html-admin-page-addons.php' );
259
+		$section_keys    = array_keys($sections);
260
+		$current_section = isset($_GET['section']) ? sanitize_text_field($_GET['section']) : current($section_keys);
261
+		$current_tab     = empty($_GET['tab']) ? 'addons' : sanitize_title($_GET['tab']);
262
+		include_once(WPINV_PLUGIN_DIR . '/includes/admin/html-admin-page-addons.php');
263 263
 	}
264 264
 
265 265
 	/**
266 266
 	 * A list of recommended wp.org plugins.
267 267
 	 * @return array
268 268
 	 */
269
-	public function get_recommend_wp_plugins(){
269
+	public function get_recommend_wp_plugins() {
270 270
 		$plugins = array(
271 271
             'invoicing-quotes' => array(
272 272
                 'url'   => 'https://wordpress.org/plugins/invoicing-quotes/',
273 273
                 'slug'   => 'invoicing-quotes',
274 274
 				'name'   => 'Quotes',
275 275
 				'thumbnail'  => 'https://ps.w.org/invoicing-quotes/assets/banner-772x250.jpg',
276
-                'desc'   => __('Allows you to create quotes, send them to clients and convert them to Invoices when accepted by the customer.','invoicing'),
276
+                'desc'   => __('Allows you to create quotes, send them to clients and convert them to Invoices when accepted by the customer.', 'invoicing'),
277 277
             ),
278 278
             'geodirectory' => array(
279 279
                 'url'   => 'https://wordpress.org/plugins/geodirectory/',
280 280
                 'slug'   => 'geodirectory',
281 281
                 'name'   => 'GeoDirectory',
282
-                'desc'   => __('Turn any WordPress theme into a global business directory portal.','invoicing'),
282
+                'desc'   => __('Turn any WordPress theme into a global business directory portal.', 'invoicing'),
283 283
             ),
284 284
             'userswp' => array(
285 285
                 'url'   => 'https://wordpress.org/plugins/userswp/',
286 286
                 'slug'   => 'userswp',
287 287
                 'name'   => 'UsersWP',
288
-                'desc'   => __('Allow frontend user login and registration as well as have slick profile pages.','invoicing'),
288
+                'desc'   => __('Allow frontend user login and registration as well as have slick profile pages.', 'invoicing'),
289 289
             ),
290 290
 		);
291 291
 
Please login to merge, or discard this patch.
includes/libraries/class-ayecode-addons.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@
 block discarded – undo
1 1
 <?php
2 2
 // Exit if accessed directly
3
-if ( ! defined( 'ABSPATH' ) ) exit;
4
-if(!class_exists('Ayecode_Addons')) {
3
+if (!defined('ABSPATH')) exit;
4
+if (!class_exists('Ayecode_Addons')) {
5 5
 
6 6
     abstract class Ayecode_Addons
7 7
     {
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 // Exit if accessed directly
3
-if ( ! defined( 'ABSPATH' ) ) exit;
3
+if ( ! defined( 'ABSPATH' ) ) {
4
+    exit;
5
+}
4 6
 if(!class_exists('Ayecode_Addons')) {
5 7
 
6 8
     abstract class Ayecode_Addons
Please login to merge, or discard this patch.
includes/abstracts/abstract-wpinv-privacy.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
  * Abstract privacy class.
4 4
  */
5 5
 
6
-defined( 'ABSPATH' ) || exit;
6
+defined('ABSPATH') || exit;
7 7
 
8 8
 /**
9 9
  * Abstract class that is intended to be extended by
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
      *
39 39
      * @param string $name Plugin identifier.
40 40
      */
41
-    public function __construct( $name = '' ) {
41
+    public function __construct($name = '') {
42 42
         $this->name = $name;
43 43
         $this->init();
44 44
     }
@@ -47,22 +47,22 @@  discard block
 block discarded – undo
47 47
      * Hook in events.
48 48
      */
49 49
     protected function init() {
50
-        add_action( 'admin_init', array( $this, 'add_privacy_message' ) );
50
+        add_action('admin_init', array($this, 'add_privacy_message'));
51 51
         // Register data exporters
52
-        add_filter( 'wp_privacy_personal_data_exporters', array( $this, 'register_exporters' ), 10 );
52
+        add_filter('wp_privacy_personal_data_exporters', array($this, 'register_exporters'), 10);
53 53
         // Register data erasers
54
-        add_filter( 'wp_privacy_personal_data_erasers', array( $this, 'register_erasers' ) );
54
+        add_filter('wp_privacy_personal_data_erasers', array($this, 'register_erasers'));
55 55
     }
56 56
 
57 57
     /**
58 58
      * Adds the privacy message on invoicing privacy page.
59 59
      */
60 60
     public function add_privacy_message() {
61
-        if ( function_exists( 'wp_add_privacy_policy_content' ) ) {
61
+        if (function_exists('wp_add_privacy_policy_content')) {
62 62
             $content = $this->get_privacy_message();
63 63
 
64
-            if ( $content ) {
65
-                wp_add_privacy_policy_content( $this->name, $this->get_privacy_message() );
64
+            if ($content) {
65
+                wp_add_privacy_policy_content($this->name, $this->get_privacy_message());
66 66
             }
67 67
         }
68 68
     }
@@ -83,9 +83,9 @@  discard block
 block discarded – undo
83 83
      * @param array $exporters List of exporter callbacks.
84 84
      * @return array
85 85
      */
86
-    public function register_exporters( $exporters = array() ) {
87
-        foreach ( $this->exporters as $id => $exporter ) {
88
-            $exporters[ $id ] = $exporter;
86
+    public function register_exporters($exporters = array()) {
87
+        foreach ($this->exporters as $id => $exporter) {
88
+            $exporters[$id] = $exporter;
89 89
         }
90 90
         return $exporters;
91 91
     }
@@ -96,9 +96,9 @@  discard block
 block discarded – undo
96 96
      * @param array $erasers List of eraser callbacks.
97 97
      * @return array
98 98
      */
99
-    public function register_erasers( $erasers = array() ) {
100
-        foreach ( $this->erasers as $id => $eraser ) {
101
-            $erasers[ $id ] = $eraser;
99
+    public function register_erasers($erasers = array()) {
100
+        foreach ($this->erasers as $id => $eraser) {
101
+            $erasers[$id] = $eraser;
102 102
         }
103 103
         return $erasers;
104 104
     }
@@ -112,8 +112,8 @@  discard block
 block discarded – undo
112 112
      *
113 113
      * @return array
114 114
      */
115
-    public function add_exporter( $id, $name, $callback ) {
116
-        $this->exporters[ $id ] = array(
115
+    public function add_exporter($id, $name, $callback) {
116
+        $this->exporters[$id] = array(
117 117
             'exporter_friendly_name' => $name,
118 118
             'callback'               => $callback,
119 119
         );
@@ -129,8 +129,8 @@  discard block
 block discarded – undo
129 129
      *
130 130
      * @return array
131 131
      */
132
-    public function add_eraser( $id, $name, $callback ) {
133
-        $this->erasers[ $id ] = array(
132
+    public function add_eraser($id, $name, $callback) {
133
+        $this->erasers[$id] = array(
134 134
             'eraser_friendly_name' => $name,
135 135
             'callback'             => $callback,
136 136
         );
Please login to merge, or discard this patch.
includes/abstracts/abstract-wpinv-session.php 2 patches
Indentation   +98 added lines, -98 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
  */
5 5
 
6 6
 if ( ! defined( 'ABSPATH' ) ) {
7
-	exit;
7
+    exit;
8 8
 }
9 9
 
10 10
 /**
@@ -12,112 +12,112 @@  discard block
 block discarded – undo
12 12
  */
13 13
 abstract class WPInv_Session {
14 14
 
15
-	/**
16
-	 * Customer ID.
17
-	 *
18
-	 * @var int $_customer_id Customer ID.
19
-	 */
20
-	protected $_customer_id;
15
+    /**
16
+     * Customer ID.
17
+     *
18
+     * @var int $_customer_id Customer ID.
19
+     */
20
+    protected $_customer_id;
21 21
 
22
-	/**
23
-	 * Session Data.
24
-	 *
25
-	 * @var array $_data Data array.
26
-	 */
27
-	protected $_data = array();
22
+    /**
23
+     * Session Data.
24
+     *
25
+     * @var array $_data Data array.
26
+     */
27
+    protected $_data = array();
28 28
 
29
-	/**
30
-	 * Dirty when the session needs saving.
31
-	 *
32
-	 * @var bool $_dirty When something changes
33
-	 */
34
-	protected $_dirty = false;
29
+    /**
30
+     * Dirty when the session needs saving.
31
+     *
32
+     * @var bool $_dirty When something changes
33
+     */
34
+    protected $_dirty = false;
35 35
 
36
-	/**
37
-	 * Init hooks and session data. Extended by child classes.
38
-	 *
39
-	 * @since 3.3.0
40
-	 */
41
-	public function init() {}
36
+    /**
37
+     * Init hooks and session data. Extended by child classes.
38
+     *
39
+     * @since 3.3.0
40
+     */
41
+    public function init() {}
42 42
 
43
-	/**
44
-	 * Cleanup session data. Extended by child classes.
45
-	 */
46
-	public function cleanup_sessions() {}
43
+    /**
44
+     * Cleanup session data. Extended by child classes.
45
+     */
46
+    public function cleanup_sessions() {}
47 47
 
48
-	/**
49
-	 * Magic get method.
50
-	 *
51
-	 * @param mixed $key Key to get.
52
-	 * @return mixed
53
-	 */
54
-	public function __get( $key ) {
55
-		return $this->get( $key );
56
-	}
48
+    /**
49
+     * Magic get method.
50
+     *
51
+     * @param mixed $key Key to get.
52
+     * @return mixed
53
+     */
54
+    public function __get( $key ) {
55
+        return $this->get( $key );
56
+    }
57 57
 
58
-	/**
59
-	 * Magic set method.
60
-	 *
61
-	 * @param mixed $key Key to set.
62
-	 * @param mixed $value Value to set.
63
-	 */
64
-	public function __set( $key, $value ) {
65
-		$this->set( $key, $value );
66
-	}
58
+    /**
59
+     * Magic set method.
60
+     *
61
+     * @param mixed $key Key to set.
62
+     * @param mixed $value Value to set.
63
+     */
64
+    public function __set( $key, $value ) {
65
+        $this->set( $key, $value );
66
+    }
67 67
 
68
-	/**
69
-	 * Magic isset method.
70
-	 *
71
-	 * @param mixed $key Key to check.
72
-	 * @return bool
73
-	 */
74
-	public function __isset( $key ) {
75
-		return isset( $this->_data[ sanitize_title( $key ) ] );
76
-	}
68
+    /**
69
+     * Magic isset method.
70
+     *
71
+     * @param mixed $key Key to check.
72
+     * @return bool
73
+     */
74
+    public function __isset( $key ) {
75
+        return isset( $this->_data[ sanitize_title( $key ) ] );
76
+    }
77 77
 
78
-	/**
79
-	 * Magic unset method.
80
-	 *
81
-	 * @param mixed $key Key to unset.
82
-	 */
83
-	public function __unset( $key ) {
84
-		if ( isset( $this->_data[ $key ] ) ) {
85
-			unset( $this->_data[ $key ] );
86
-			$this->_dirty = true;
87
-		}
88
-	}
78
+    /**
79
+     * Magic unset method.
80
+     *
81
+     * @param mixed $key Key to unset.
82
+     */
83
+    public function __unset( $key ) {
84
+        if ( isset( $this->_data[ $key ] ) ) {
85
+            unset( $this->_data[ $key ] );
86
+            $this->_dirty = true;
87
+        }
88
+    }
89 89
 
90
-	/**
91
-	 * Get a session variable.
92
-	 *
93
-	 * @param string $key Key to get.
94
-	 * @param mixed  $default used if the session variable isn't set.
95
-	 * @return array|string value of session variable
96
-	 */
97
-	public function get( $key, $default = null ) {
98
-		$key = sanitize_key( $key );
99
-		return isset( $this->_data[ $key ] ) ? maybe_unserialize( $this->_data[ $key ] ) : $default;
100
-	}
90
+    /**
91
+     * Get a session variable.
92
+     *
93
+     * @param string $key Key to get.
94
+     * @param mixed  $default used if the session variable isn't set.
95
+     * @return array|string value of session variable
96
+     */
97
+    public function get( $key, $default = null ) {
98
+        $key = sanitize_key( $key );
99
+        return isset( $this->_data[ $key ] ) ? maybe_unserialize( $this->_data[ $key ] ) : $default;
100
+    }
101 101
 
102
-	/**
103
-	 * Set a session variable.
104
-	 *
105
-	 * @param string $key Key to set.
106
-	 * @param mixed  $value Value to set.
107
-	 */
108
-	public function set( $key, $value ) {
109
-		if ( $value !== $this->get( $key ) ) {
110
-			$this->_data[ sanitize_key( $key ) ] = maybe_serialize( $value );
111
-			$this->_dirty                        = true;
112
-		}
113
-	}
102
+    /**
103
+     * Set a session variable.
104
+     *
105
+     * @param string $key Key to set.
106
+     * @param mixed  $value Value to set.
107
+     */
108
+    public function set( $key, $value ) {
109
+        if ( $value !== $this->get( $key ) ) {
110
+            $this->_data[ sanitize_key( $key ) ] = maybe_serialize( $value );
111
+            $this->_dirty                        = true;
112
+        }
113
+    }
114 114
 
115
-	/**
116
-	 * Get customer ID.
117
-	 *
118
-	 * @return int
119
-	 */
120
-	public function get_customer_id() {
121
-		return $this->_customer_id;
122
-	}
115
+    /**
116
+     * Get customer ID.
117
+     *
118
+     * @return int
119
+     */
120
+    public function get_customer_id() {
121
+        return $this->_customer_id;
122
+    }
123 123
 }
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
  * Handle data for the current customer session
4 4
  */
5 5
 
6
-if ( ! defined( 'ABSPATH' ) ) {
6
+if (!defined('ABSPATH')) {
7 7
 	exit;
8 8
 }
9 9
 
@@ -51,8 +51,8 @@  discard block
 block discarded – undo
51 51
 	 * @param mixed $key Key to get.
52 52
 	 * @return mixed
53 53
 	 */
54
-	public function __get( $key ) {
55
-		return $this->get( $key );
54
+	public function __get($key) {
55
+		return $this->get($key);
56 56
 	}
57 57
 
58 58
 	/**
@@ -61,8 +61,8 @@  discard block
 block discarded – undo
61 61
 	 * @param mixed $key Key to set.
62 62
 	 * @param mixed $value Value to set.
63 63
 	 */
64
-	public function __set( $key, $value ) {
65
-		$this->set( $key, $value );
64
+	public function __set($key, $value) {
65
+		$this->set($key, $value);
66 66
 	}
67 67
 
68 68
 	/**
@@ -71,8 +71,8 @@  discard block
 block discarded – undo
71 71
 	 * @param mixed $key Key to check.
72 72
 	 * @return bool
73 73
 	 */
74
-	public function __isset( $key ) {
75
-		return isset( $this->_data[ sanitize_title( $key ) ] );
74
+	public function __isset($key) {
75
+		return isset($this->_data[sanitize_title($key)]);
76 76
 	}
77 77
 
78 78
 	/**
@@ -80,9 +80,9 @@  discard block
 block discarded – undo
80 80
 	 *
81 81
 	 * @param mixed $key Key to unset.
82 82
 	 */
83
-	public function __unset( $key ) {
84
-		if ( isset( $this->_data[ $key ] ) ) {
85
-			unset( $this->_data[ $key ] );
83
+	public function __unset($key) {
84
+		if (isset($this->_data[$key])) {
85
+			unset($this->_data[$key]);
86 86
 			$this->_dirty = true;
87 87
 		}
88 88
 	}
@@ -94,9 +94,9 @@  discard block
 block discarded – undo
94 94
 	 * @param mixed  $default used if the session variable isn't set.
95 95
 	 * @return array|string value of session variable
96 96
 	 */
97
-	public function get( $key, $default = null ) {
98
-		$key = sanitize_key( $key );
99
-		return isset( $this->_data[ $key ] ) ? maybe_unserialize( $this->_data[ $key ] ) : $default;
97
+	public function get($key, $default = null) {
98
+		$key = sanitize_key($key);
99
+		return isset($this->_data[$key]) ? maybe_unserialize($this->_data[$key]) : $default;
100 100
 	}
101 101
 
102 102
 	/**
@@ -105,9 +105,9 @@  discard block
 block discarded – undo
105 105
 	 * @param string $key Key to set.
106 106
 	 * @param mixed  $value Value to set.
107 107
 	 */
108
-	public function set( $key, $value ) {
109
-		if ( $value !== $this->get( $key ) ) {
110
-			$this->_data[ sanitize_key( $key ) ] = maybe_serialize( $value );
108
+	public function set($key, $value) {
109
+		if ($value !== $this->get($key)) {
110
+			$this->_data[sanitize_key($key)] = maybe_serialize($value);
111 111
 			$this->_dirty                        = true;
112 112
 		}
113 113
 	}
Please login to merge, or discard this patch.
includes/admin/html-admin-page-addons.php 3 patches
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 			</div>
127 127
 		</div>
128 128
 			<?php
129
-		}else{
129
+		} else{
130 130
 			$installed_plugins = get_plugins();
131 131
             $addon_obj = new WPInv_Admin_Addons();
132 132
 			if ($addons = $addon_obj->get_section_data( $current_tab ) ) :
@@ -151,14 +151,14 @@  discard block
 block discarded – undo
151 151
 										echo '<a href="'.admin_url('/plugin-install.php?tab=plugin-information&plugin='.$addon->info->slug).'&width=770&height=660&TB_iframe=true" class="thickbox" >';
152 152
 										echo '<span class="wpi-product-info">'.__('More info','invoicing').'</span>';
153 153
 										echo '</a>';
154
-									}elseif(isset($addon->info->link) && substr( $addon->info->link, 0, 23 ) === "https://wpinvoicing.com"){
154
+									} elseif(isset($addon->info->link) && substr( $addon->info->link, 0, 23 ) === "https://wpinvoicing.com"){
155 155
 										if(defined('WP_EASY_UPDATES_ACTIVE')){
156 156
 											$url = admin_url('/plugin-install.php?tab=plugin-information&plugin='.$addon->info->slug.'&width=770&height=660&item_id='.$addon->info->id.'&update_url=https://wpinvoicing.com&TB_iframe=true');
157
-										}else{
157
+										} else{
158 158
 											// if installed show activation link
159 159
 											if(isset($installed_plugins['wp-easy-updates/external-updates.php'])){
160 160
 												$url = '#TB_inline?width=600&height=50&inlineId=wpi-wpeu-required-activation';
161
-											}else{
161
+											} else{
162 162
 												$url = '#TB_inline?width=600&height=50&inlineId=wpi-wpeu-required-for-external';
163 163
 											}
164 164
 										}
Please login to merge, or discard this patch.
Indentation   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
  *
5 5
  */
6 6
 if ( ! defined( 'ABSPATH' ) ) {
7
-	exit;
7
+    exit;
8 8
 }
9 9
 add_ThickBox();
10 10
 ?>
@@ -14,18 +14,18 @@  discard block
 block discarded – undo
14 14
 	<?php if ( $tabs ){ ?>
15 15
 		<nav class="nav-tab-wrapper wpi-nav-tab-wrapper">
16 16
 			<?php
17
-			foreach ( $tabs as $name => $label ) {
18
-				echo '<a href="' . admin_url( 'admin.php?page=wpi-addons&tab=' . $name ) . '" class="nav-tab ' . ( $current_tab == $name ? 'nav-tab-active' : '' ) . '">' . $label . '</a>';
19
-			}
20
-			do_action( 'wpi_addons_tabs' );
21
-			?>
17
+            foreach ( $tabs as $name => $label ) {
18
+                echo '<a href="' . admin_url( 'admin.php?page=wpi-addons&tab=' . $name ) . '" class="nav-tab ' . ( $current_tab == $name ? 'nav-tab-active' : '' ) . '">' . $label . '</a>';
19
+            }
20
+            do_action( 'wpi_addons_tabs' );
21
+            ?>
22 22
 		</nav>
23 23
 
24 24
 		<?php
25 25
 
26
-		if($current_tab == 'membership'){
26
+        if($current_tab == 'membership'){
27 27
 
28
-			?>
28
+            ?>
29 29
 
30 30
 			<div class="wpi-membership-tab-conatiner">
31 31
 				<div class="membership-content">
@@ -36,9 +36,9 @@  discard block
 block discarded – undo
36 36
 					<h2><?php _e("Have a membership key?","invoicing");?></h2>
37 37
 					<p>
38 38
 						<?php
39
-						$wpeu_admin = new External_Updates_Admin('wpinvoicing.com','1');
40
-						echo $wpeu_admin->render_licence_actions('wpinvoicing.com', 'membership',array(95, 106, 108,12351));
41
-						?>
39
+                        $wpeu_admin = new External_Updates_Admin('wpinvoicing.com','1');
40
+                        echo $wpeu_admin->render_licence_actions('wpinvoicing.com', 'membership',array(95, 106, 108,12351));
41
+                        ?>
42 42
 					</p>
43 43
 				<?php }?>
44 44
 
@@ -48,13 +48,13 @@  discard block
 block discarded – undo
48 48
 							<div class="feature-list">
49 49
 								<ul>
50 50
 									<?php
51
-									$addon_obj = new WPInv_Admin_Addons();
52
-									if ($addons = $addon_obj->get_section_data( 'addons' ) ) {
53
-										foreach ( $addons as $addon ) {
54
-											echo '<li><i class="far fa-check-circle fa-sm"></i> '.esc_html( $addon->info->title ).'</li>';
55
-										}
56
-									}
57
-									?>
51
+                                    $addon_obj = new WPInv_Admin_Addons();
52
+                                    if ($addons = $addon_obj->get_section_data( 'addons' ) ) {
53
+                                        foreach ( $addons as $addon ) {
54
+                                            echo '<li><i class="far fa-check-circle fa-sm"></i> '.esc_html( $addon->info->title ).'</li>';
55
+                                        }
56
+                                    }
57
+                                    ?>
58 58
 									</ul>
59 59
 
60 60
 									<div class="feature-cta">
@@ -65,12 +65,12 @@  discard block
 block discarded – undo
65 65
 									<h3><?php _e("Included Gateways:","invoicing");?></h3>
66 66
 									<ul>
67 67
 										<?php
68
-										if ($addons = $addon_obj->get_section_data( 'gateways' ) ) {
69
-											foreach ( $addons as $addon ) {
70
-												echo '<li><i class="far fa-check-circle fa-sm"></i> '.esc_html( $addon->info->title ).'</li>';
71
-											}
72
-										}
73
-										?>
68
+                                        if ($addons = $addon_obj->get_section_data( 'gateways' ) ) {
69
+                                            foreach ( $addons as $addon ) {
70
+                                                echo '<li><i class="far fa-check-circle fa-sm"></i> '.esc_html( $addon->info->title ).'</li>';
71
+                                            }
72
+                                        }
73
+                                        ?>
74 74
 								</ul>
75 75
 							</div>
76 76
 
@@ -81,8 +81,8 @@  discard block
 block discarded – undo
81 81
 						<div class="testimonial-content">
82 82
 							<div class="t-image">
83 83
 								<?php
84
-									echo '<img src="' . plugins_url( 'images/t-image2.png', dirname(__FILE__) ) . '" > ';
85
-								?>
84
+                                    echo '<img src="' . plugins_url( 'images/t-image2.png', dirname(__FILE__) ) . '" > ';
85
+                                ?>
86 86
 							</div>
87 87
 							<div class="t-content">
88 88
 								<p>
@@ -101,8 +101,8 @@  discard block
 block discarded – undo
101 101
 						<div class="testimonial-content">
102 102
 							<div class="t-image">
103 103
 								<?php
104
-									echo '<img src="' . plugins_url( 'images/t-image1.png', dirname(__FILE__) ) . '" > ';
105
-								?>
104
+                                    echo '<img src="' . plugins_url( 'images/t-image1.png', dirname(__FILE__) ) . '" > ';
105
+                                ?>
106 106
 							</div>
107 107
 							<div class="t-content">
108 108
 								<p>
@@ -126,20 +126,20 @@  discard block
 block discarded – undo
126 126
 			</div>
127 127
 		</div>
128 128
 			<?php
129
-		}else{
130
-			$installed_plugins = get_plugins();
129
+        }else{
130
+            $installed_plugins = get_plugins();
131 131
             $addon_obj = new WPInv_Admin_Addons();
132
-			if ($addons = $addon_obj->get_section_data( $current_tab ) ) :
133
-				?>
132
+            if ($addons = $addon_obj->get_section_data( $current_tab ) ) :
133
+                ?>
134 134
 				<ul class="wpi-products"><?php foreach ( $addons as $addon ) :
135 135
                         if(965==$addon->info->id){continue;}// don't show quote add on
136
-						?><li class="wpi-product">
136
+                        ?><li class="wpi-product">
137 137
 								<div class="wpi-product-title">
138 138
 									<h3><?php
139
-										if ( ! empty( $addon->info->excerpt) ){
140
-											echo wpi_help_tip( $addon->info->excerpt );
141
-										}
142
-										echo esc_html( $addon->info->title ); ?></h3>
139
+                                        if ( ! empty( $addon->info->excerpt) ){
140
+                                            echo wpi_help_tip( $addon->info->excerpt );
141
+                                        }
142
+                                        echo esc_html( $addon->info->title ); ?></h3>
143 143
 								</div>
144 144
 
145 145
 								<span class="wpi-product-image">
@@ -147,27 +147,27 @@  discard block
 block discarded – undo
147 147
 										<img src="<?php echo esc_attr( $addon->info->thumbnail ); ?>"/>
148 148
 									<?php endif;
149 149
 
150
-									if(isset($addon->info->link) && substr( $addon->info->link, 0, 21 ) === "https://wordpress.org"){
151
-										echo '<a href="'.admin_url('/plugin-install.php?tab=plugin-information&plugin='.$addon->info->slug).'&width=770&height=660&TB_iframe=true" class="thickbox" >';
152
-										echo '<span class="wpi-product-info">'.__('More info','invoicing').'</span>';
153
-										echo '</a>';
154
-									}elseif(isset($addon->info->link) && substr( $addon->info->link, 0, 23 ) === "https://wpinvoicing.com"){
155
-										if(defined('WP_EASY_UPDATES_ACTIVE')){
156
-											$url = admin_url('/plugin-install.php?tab=plugin-information&plugin='.$addon->info->slug.'&width=770&height=660&item_id='.$addon->info->id.'&update_url=https://wpinvoicing.com&TB_iframe=true');
157
-										}else{
158
-											// if installed show activation link
159
-											if(isset($installed_plugins['wp-easy-updates/external-updates.php'])){
160
-												$url = '#TB_inline?width=600&height=50&inlineId=wpi-wpeu-required-activation';
161
-											}else{
162
-												$url = '#TB_inline?width=600&height=50&inlineId=wpi-wpeu-required-for-external';
163
-											}
164
-										}
165
-										echo '<a href="'.$url.'" class="thickbox">';
166
-										echo '<span class="wpi-product-info">'.__('More info','invoicing').'</span>';
167
-										echo '</a>';
168
-									}
169
-
170
-									?>
150
+                                    if(isset($addon->info->link) && substr( $addon->info->link, 0, 21 ) === "https://wordpress.org"){
151
+                                        echo '<a href="'.admin_url('/plugin-install.php?tab=plugin-information&plugin='.$addon->info->slug).'&width=770&height=660&TB_iframe=true" class="thickbox" >';
152
+                                        echo '<span class="wpi-product-info">'.__('More info','invoicing').'</span>';
153
+                                        echo '</a>';
154
+                                    }elseif(isset($addon->info->link) && substr( $addon->info->link, 0, 23 ) === "https://wpinvoicing.com"){
155
+                                        if(defined('WP_EASY_UPDATES_ACTIVE')){
156
+                                            $url = admin_url('/plugin-install.php?tab=plugin-information&plugin='.$addon->info->slug.'&width=770&height=660&item_id='.$addon->info->id.'&update_url=https://wpinvoicing.com&TB_iframe=true');
157
+                                        }else{
158
+                                            // if installed show activation link
159
+                                            if(isset($installed_plugins['wp-easy-updates/external-updates.php'])){
160
+                                                $url = '#TB_inline?width=600&height=50&inlineId=wpi-wpeu-required-activation';
161
+                                            }else{
162
+                                                $url = '#TB_inline?width=600&height=50&inlineId=wpi-wpeu-required-for-external';
163
+                                            }
164
+                                        }
165
+                                        echo '<a href="'.$url.'" class="thickbox">';
166
+                                        echo '<span class="wpi-product-info">'.__('More info','invoicing').'</span>';
167
+                                        echo '</a>';
168
+                                    }
169
+
170
+                                    ?>
171 171
 
172 172
 								</span>
173 173
 
@@ -175,15 +175,15 @@  discard block
 block discarded – undo
175 175
 								<span class="wpi-product-button">
176 176
 									<?php
177 177
                                     $addon_obj->output_button( $addon );
178
-									?>
178
+                                    ?>
179 179
 								</span>
180 180
 
181 181
 								<span class="wpi-price"><?php //print_r($addon); //echo wp_kses_post( $addon->price ); ?></span></li><?php endforeach; ?></ul>
182 182
 			<?php endif;
183
-		}
183
+        }
184 184
 
185
-	}
186
-	?>
185
+    }
186
+    ?>
187 187
 
188 188
 
189 189
 	<div class="clearfix" ></div>
@@ -202,8 +202,8 @@  discard block
 block discarded – undo
202 202
 			<input class="wpeu-licence-key" type="text" placeholder="<?php _e("Enter your licence key",'invoicing');?>"> <button class="button-primary wpeu-licence-popup-button" ><?php _e("Install",'invoicing');?></button>
203 203
 			<br>
204 204
 			<?php
205
-			echo sprintf( __('%sFind your licence key here%s OR %sBuy one here%s', 'invoicing'), '<a href="https://wpinvoicing.com/your-account/" target="_blank">','</a>','<a class="wpeu-licence-link" href="https://wpinvoicing.com/downloads/category/addons/" target="_blank">','</a>' );
206
-			?>
205
+            echo sprintf( __('%sFind your licence key here%s OR %sBuy one here%s', 'invoicing'), '<a href="https://wpinvoicing.com/your-account/" target="_blank">','</a>','<a class="wpeu-licence-link" href="https://wpinvoicing.com/downloads/category/addons/" target="_blank">','</a>' );
206
+            ?>
207 207
 		</span>
208 208
 	</div>
209 209
 
Please login to merge, or discard this patch.
Spacing   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
  * Admin View: Page - Addons
4 4
  *
5 5
  */
6
-if ( ! defined( 'ABSPATH' ) ) {
6
+if (!defined('ABSPATH')) {
7 7
 	exit;
8 8
 }
9 9
 add_ThickBox();
@@ -11,19 +11,19 @@  discard block
 block discarded – undo
11 11
 <div class="wrap wpi_addons_wrap">
12 12
 	<h1><?php echo get_admin_page_title(); ?></h1>
13 13
 
14
-	<?php if ( $tabs ){ ?>
14
+	<?php if ($tabs) { ?>
15 15
 		<nav class="nav-tab-wrapper wpi-nav-tab-wrapper">
16 16
 			<?php
17
-			foreach ( $tabs as $name => $label ) {
18
-				echo '<a href="' . admin_url( 'admin.php?page=wpi-addons&tab=' . $name ) . '" class="nav-tab ' . ( $current_tab == $name ? 'nav-tab-active' : '' ) . '">' . $label . '</a>';
17
+			foreach ($tabs as $name => $label) {
18
+				echo '<a href="' . admin_url('admin.php?page=wpi-addons&tab=' . $name) . '" class="nav-tab ' . ($current_tab == $name ? 'nav-tab-active' : '') . '">' . $label . '</a>';
19 19
 			}
20
-			do_action( 'wpi_addons_tabs' );
20
+			do_action('wpi_addons_tabs');
21 21
 			?>
22 22
 		</nav>
23 23
 
24 24
 		<?php
25 25
 
26
-		if($current_tab == 'membership'){
26
+		if ($current_tab == 'membership') {
27 27
 
28 28
 			?>
29 29
 
@@ -32,42 +32,42 @@  discard block
 block discarded – undo
32 32
 <!--
33 33
 				<h2>With our WPInvoicing Membership you get access to all our products!</h2>
34 34
 				<p><a class="button button-primary" href="https://wpinvoicing.com/downloads/membership/">View Memberships</a></p>-->
35
-				<?php if(defined('WP_EASY_UPDATES_ACTIVE')){?>
36
-					<h2><?php _e("Have a membership key?","invoicing");?></h2>
35
+				<?php if (defined('WP_EASY_UPDATES_ACTIVE')) {?>
36
+					<h2><?php _e("Have a membership key?", "invoicing"); ?></h2>
37 37
 					<p>
38 38
 						<?php
39
-						$wpeu_admin = new External_Updates_Admin('wpinvoicing.com','1');
40
-						echo $wpeu_admin->render_licence_actions('wpinvoicing.com', 'membership',array(95, 106, 108,12351));
39
+						$wpeu_admin = new External_Updates_Admin('wpinvoicing.com', '1');
40
+						echo $wpeu_admin->render_licence_actions('wpinvoicing.com', 'membership', array(95, 106, 108, 12351));
41 41
 						?>
42 42
 					</p>
43 43
 				<?php }?>
44 44
 
45 45
 				<div class="membership-cta-contet">
46 46
 					<div class="main-cta">
47
-							<h2><?php _e("Membership benefits Include:","invoicing");?></h2>
47
+							<h2><?php _e("Membership benefits Include:", "invoicing"); ?></h2>
48 48
 							<div class="feature-list">
49 49
 								<ul>
50 50
 									<?php
51 51
 									$addon_obj = new WPInv_Admin_Addons();
52
-									if ($addons = $addon_obj->get_section_data( 'addons' ) ) {
53
-										foreach ( $addons as $addon ) {
54
-											echo '<li><i class="far fa-check-circle fa-sm"></i> '.esc_html( $addon->info->title ).'</li>';
52
+									if ($addons = $addon_obj->get_section_data('addons')) {
53
+										foreach ($addons as $addon) {
54
+											echo '<li><i class="far fa-check-circle fa-sm"></i> ' . esc_html($addon->info->title) . '</li>';
55 55
 										}
56 56
 									}
57 57
 									?>
58 58
 									</ul>
59 59
 
60 60
 									<div class="feature-cta">
61
-										<h3><?php _e("Membership Starts from","invoicing");?></h3>
61
+										<h3><?php _e("Membership Starts from", "invoicing"); ?></h3>
62 62
 										<h4>$99</h4>
63
-										<a href="https://wpinvoicing.com/downloads/membership/" target="_blank"><?php _e("Buy Membership","invoicing");?></a>
63
+										<a href="https://wpinvoicing.com/downloads/membership/" target="_blank"><?php _e("Buy Membership", "invoicing"); ?></a>
64 64
 									</div>
65
-									<h3><?php _e("Included Gateways:","invoicing");?></h3>
65
+									<h3><?php _e("Included Gateways:", "invoicing"); ?></h3>
66 66
 									<ul>
67 67
 										<?php
68
-										if ($addons = $addon_obj->get_section_data( 'gateways' ) ) {
69
-											foreach ( $addons as $addon ) {
70
-												echo '<li><i class="far fa-check-circle fa-sm"></i> '.esc_html( $addon->info->title ).'</li>';
68
+										if ($addons = $addon_obj->get_section_data('gateways')) {
69
+											foreach ($addons as $addon) {
70
+												echo '<li><i class="far fa-check-circle fa-sm"></i> ' . esc_html($addon->info->title) . '</li>';
71 71
 											}
72 72
 										}
73 73
 										?>
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 						<div class="testimonial-content">
82 82
 							<div class="t-image">
83 83
 								<?php
84
-									echo '<img src="' . plugins_url( 'images/t-image2.png', dirname(__FILE__) ) . '" > ';
84
+									echo '<img src="' . plugins_url('images/t-image2.png', dirname(__FILE__)) . '" > ';
85 85
 								?>
86 86
 							</div>
87 87
 							<div class="t-content">
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 						<div class="testimonial-content">
102 102
 							<div class="t-image">
103 103
 								<?php
104
-									echo '<img src="' . plugins_url( 'images/t-image1.png', dirname(__FILE__) ) . '" > ';
104
+									echo '<img src="' . plugins_url('images/t-image1.png', dirname(__FILE__)) . '" > ';
105 105
 								?>
106 106
 							</div>
107 107
 							<div class="t-content">
@@ -117,8 +117,8 @@  discard block
 block discarded – undo
117 117
 						</div>
118 118
 					</div>
119 119
 					<div class="member-footer">
120
-						<a class="footer-btn" href="https://wpinvoicing.com/downloads/membership/" target="_blank"><?php _e("Buy Membership","invoicing");?></a>
121
-						<a class="footer-link" href="post-new.php?post_type=wpi_invoice"><?php _e("Create Invoice","invoicing");?></a>
120
+						<a class="footer-btn" href="https://wpinvoicing.com/downloads/membership/" target="_blank"><?php _e("Buy Membership", "invoicing"); ?></a>
121
+						<a class="footer-link" href="post-new.php?post_type=wpi_invoice"><?php _e("Create Invoice", "invoicing"); ?></a>
122 122
 					</div>
123 123
 				</div>
124 124
 
@@ -126,44 +126,44 @@  discard block
 block discarded – undo
126 126
 			</div>
127 127
 		</div>
128 128
 			<?php
129
-		}else{
129
+		} else {
130 130
 			$installed_plugins = get_plugins();
131 131
             $addon_obj = new WPInv_Admin_Addons();
132
-			if ($addons = $addon_obj->get_section_data( $current_tab ) ) :
132
+			if ($addons = $addon_obj->get_section_data($current_tab)) :
133 133
 				?>
134
-				<ul class="wpi-products"><?php foreach ( $addons as $addon ) :
135
-                        if(965==$addon->info->id){continue;}// don't show quote add on
134
+				<ul class="wpi-products"><?php foreach ($addons as $addon) :
135
+                        if (965 == $addon->info->id) {continue; }// don't show quote add on
136 136
 						?><li class="wpi-product">
137 137
 								<div class="wpi-product-title">
138 138
 									<h3><?php
139
-										if ( ! empty( $addon->info->excerpt) ){
140
-											echo wpi_help_tip( $addon->info->excerpt );
139
+										if (!empty($addon->info->excerpt)) {
140
+											echo wpi_help_tip($addon->info->excerpt);
141 141
 										}
142
-										echo esc_html( $addon->info->title ); ?></h3>
142
+										echo esc_html($addon->info->title); ?></h3>
143 143
 								</div>
144 144
 
145 145
 								<span class="wpi-product-image">
146
-									<?php if ( ! empty( $addon->info->thumbnail) ) : ?>
147
-										<img src="<?php echo esc_attr( $addon->info->thumbnail ); ?>"/>
146
+									<?php if (!empty($addon->info->thumbnail)) : ?>
147
+										<img src="<?php echo esc_attr($addon->info->thumbnail); ?>"/>
148 148
 									<?php endif;
149 149
 
150
-									if(isset($addon->info->link) && substr( $addon->info->link, 0, 21 ) === "https://wordpress.org"){
151
-										echo '<a href="'.admin_url('/plugin-install.php?tab=plugin-information&plugin='.$addon->info->slug).'&width=770&height=660&TB_iframe=true" class="thickbox" >';
152
-										echo '<span class="wpi-product-info">'.__('More info','invoicing').'</span>';
150
+									if (isset($addon->info->link) && substr($addon->info->link, 0, 21) === "https://wordpress.org") {
151
+										echo '<a href="' . admin_url('/plugin-install.php?tab=plugin-information&plugin=' . $addon->info->slug) . '&width=770&height=660&TB_iframe=true" class="thickbox" >';
152
+										echo '<span class="wpi-product-info">' . __('More info', 'invoicing') . '</span>';
153 153
 										echo '</a>';
154
-									}elseif(isset($addon->info->link) && substr( $addon->info->link, 0, 23 ) === "https://wpinvoicing.com"){
155
-										if(defined('WP_EASY_UPDATES_ACTIVE')){
156
-											$url = admin_url('/plugin-install.php?tab=plugin-information&plugin='.$addon->info->slug.'&width=770&height=660&item_id='.$addon->info->id.'&update_url=https://wpinvoicing.com&TB_iframe=true');
157
-										}else{
154
+									}elseif (isset($addon->info->link) && substr($addon->info->link, 0, 23) === "https://wpinvoicing.com") {
155
+										if (defined('WP_EASY_UPDATES_ACTIVE')) {
156
+											$url = admin_url('/plugin-install.php?tab=plugin-information&plugin=' . $addon->info->slug . '&width=770&height=660&item_id=' . $addon->info->id . '&update_url=https://wpinvoicing.com&TB_iframe=true');
157
+										} else {
158 158
 											// if installed show activation link
159
-											if(isset($installed_plugins['wp-easy-updates/external-updates.php'])){
159
+											if (isset($installed_plugins['wp-easy-updates/external-updates.php'])) {
160 160
 												$url = '#TB_inline?width=600&height=50&inlineId=wpi-wpeu-required-activation';
161
-											}else{
161
+											} else {
162 162
 												$url = '#TB_inline?width=600&height=50&inlineId=wpi-wpeu-required-for-external';
163 163
 											}
164 164
 										}
165
-										echo '<a href="'.$url.'" class="thickbox">';
166
-										echo '<span class="wpi-product-info">'.__('More info','invoicing').'</span>';
165
+										echo '<a href="' . $url . '" class="thickbox">';
166
+										echo '<span class="wpi-product-info">' . __('More info', 'invoicing') . '</span>';
167 167
 										echo '</a>';
168 168
 									}
169 169
 
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 
175 175
 								<span class="wpi-product-button">
176 176
 									<?php
177
-                                    $addon_obj->output_button( $addon );
177
+                                    $addon_obj->output_button($addon);
178 178
 									?>
179 179
 								</span>
180 180
 
@@ -188,21 +188,21 @@  discard block
 block discarded – undo
188 188
 
189 189
 	<div class="clearfix" ></div>
190 190
 
191
-	<?php if($current_tab =='addons'){ ?>
192
-	<p><?php printf( __( 'All of our Invoicing Addons can be found on WPInvoicing.com here: <a href="%s">Invoicing Addons</a>', 'invoicing' ), 'https://wpinvoicing.com/downloads/category/addons/' ); ?></p>
193
-	<?php } if($current_tab =='gateways'){  ?>
194
-    <p><?php printf( __( 'All of our Invoicing Payment Gateways can be found on WPInvoicing.com here: <a href="%s">Invoicing Payment Gateways</a>', 'invoicing' ), 'https://wpinvoicing.com/downloads/category/gateways/' ); ?></p>
191
+	<?php if ($current_tab == 'addons') { ?>
192
+	<p><?php printf(__('All of our Invoicing Addons can be found on WPInvoicing.com here: <a href="%s">Invoicing Addons</a>', 'invoicing'), 'https://wpinvoicing.com/downloads/category/addons/'); ?></p>
193
+	<?php } if ($current_tab == 'gateways') {  ?>
194
+    <p><?php printf(__('All of our Invoicing Payment Gateways can be found on WPInvoicing.com here: <a href="%s">Invoicing Payment Gateways</a>', 'invoicing'), 'https://wpinvoicing.com/downloads/category/gateways/'); ?></p>
195 195
     <?php } ?>
196 196
 
197
-	<div id="wpi-wpeu-required-activation" style="display:none;"><span class="wpi-notification "><?php printf( __("The plugin <a href='https://wpeasyupdates.com/' target='_blank'>WP Easy Updates</a> is required to check for and update some installed plugins/themes, please <a href='%s'>activate</a> it now.",'invoicing'),wp_nonce_url(admin_url('plugins.php?action=activate&plugin=wp-easy-updates/external-updates.php'), 'activate-plugin_wp-easy-updates/external-updates.php'));?></span></div>
198
-	<div id="wpi-wpeu-required-for-external" style="display:none;"><span class="wpi-notification "><?php printf(  __("The plugin <a href='https://wpeasyupdates.com/' target='_blank'>WP Easy Updates</a> is required to check for and update some installed plugins/themes, please <a href='%s' onclick='window.open(\"https://wpeasyupdates.com/wp-easy-updates.zip\", \"_blank\");' >download</a> and install it now.",'invoicing'),admin_url("plugin-install.php?tab=upload&wpeu-install=true"));?></span></div>
197
+	<div id="wpi-wpeu-required-activation" style="display:none;"><span class="wpi-notification "><?php printf(__("The plugin <a href='https://wpeasyupdates.com/' target='_blank'>WP Easy Updates</a> is required to check for and update some installed plugins/themes, please <a href='%s'>activate</a> it now.", 'invoicing'), wp_nonce_url(admin_url('plugins.php?action=activate&plugin=wp-easy-updates/external-updates.php'), 'activate-plugin_wp-easy-updates/external-updates.php')); ?></span></div>
198
+	<div id="wpi-wpeu-required-for-external" style="display:none;"><span class="wpi-notification "><?php printf(__("The plugin <a href='https://wpeasyupdates.com/' target='_blank'>WP Easy Updates</a> is required to check for and update some installed plugins/themes, please <a href='%s' onclick='window.open(\"https://wpeasyupdates.com/wp-easy-updates.zip\", \"_blank\");' >download</a> and install it now.", 'invoicing'), admin_url("plugin-install.php?tab=upload&wpeu-install=true")); ?></span></div>
199 199
 	<div id="wpeu-licence-popup" style="display:none;">
200 200
 		<span class="wpi-notification noti-white">
201
-			<h3 class="wpeu-licence-title"><?php _e("Licence key",'invoicing');?></h3>
202
-			<input class="wpeu-licence-key" type="text" placeholder="<?php _e("Enter your licence key",'invoicing');?>"> <button class="button-primary wpeu-licence-popup-button" ><?php _e("Install",'invoicing');?></button>
201
+			<h3 class="wpeu-licence-title"><?php _e("Licence key", 'invoicing'); ?></h3>
202
+			<input class="wpeu-licence-key" type="text" placeholder="<?php _e("Enter your licence key", 'invoicing'); ?>"> <button class="button-primary wpeu-licence-popup-button" ><?php _e("Install", 'invoicing'); ?></button>
203 203
 			<br>
204 204
 			<?php
205
-			echo sprintf( __('%sFind your licence key here%s OR %sBuy one here%s', 'invoicing'), '<a href="https://wpinvoicing.com/your-account/" target="_blank">','</a>','<a class="wpeu-licence-link" href="https://wpinvoicing.com/downloads/category/addons/" target="_blank">','</a>' );
205
+			echo sprintf(__('%sFind your licence key here%s OR %sBuy one here%s', 'invoicing'), '<a href="https://wpinvoicing.com/your-account/" target="_blank">', '</a>', '<a class="wpeu-licence-link" href="https://wpinvoicing.com/downloads/category/addons/" target="_blank">', '</a>');
206 206
 			?>
207 207
 		</span>
208 208
 	</div>
Please login to merge, or discard this patch.