Passed
Push — master ( 01e429...89614d )
by Brian
08:00 queued 03:45
created
vendor/composer/installers/src/Composer/Installers/Installer.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -215,7 +215,7 @@
 block discarded – undo
215 215
             $pattern = $locations ? '(' . implode('|', $locations) . ')' : false;
216 216
         }
217 217
 
218
-        return $pattern ? : '(\w+)';
218
+        return $pattern ?: '(\w+)';
219 219
     }
220 220
 
221 221
     /**
Please login to merge, or discard this patch.
vendor/composer/installers/src/Composer/Installers/BitrixInstaller.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,9 +26,9 @@
 block discarded – undo
26 26
 class BitrixInstaller extends BaseInstaller
27 27
 {
28 28
     protected $locations = array(
29
-        'module'    => '{$bitrix_dir}/modules/{$name}/',    // deprecated, remove on the major release (Backward compatibility will be broken)
29
+        'module'    => '{$bitrix_dir}/modules/{$name}/', // deprecated, remove on the major release (Backward compatibility will be broken)
30 30
         'component' => '{$bitrix_dir}/components/{$name}/', // deprecated, remove on the major release (Backward compatibility will be broken)
31
-        'theme'     => '{$bitrix_dir}/templates/{$name}/',  // deprecated, remove on the major release (Backward compatibility will be broken)
31
+        'theme'     => '{$bitrix_dir}/templates/{$name}/', // deprecated, remove on the major release (Backward compatibility will be broken)
32 32
         'd7-module'    => '{$bitrix_dir}/modules/{$vendor}.{$name}/',
33 33
         'd7-component' => '{$bitrix_dir}/components/{$vendor}/{$name}/',
34 34
         'd7-template'     => '{$bitrix_dir}/templates/{$vendor}_{$name}/',
Please login to merge, or discard this patch.
vendor/composer/installers/src/Composer/Installers/Symfony1Installer.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
      */
18 18
     public function inflectPackageVars($vars)
19 19
     {
20
-        $vars['name'] = preg_replace_callback('/(-[a-z])/', function ($matches) {
20
+        $vars['name'] = preg_replace_callback('/(-[a-z])/', function($matches) {
21 21
             return strtoupper($matches[0][1]);
22 22
         }, $vars['name']);
23 23
 
Please login to merge, or discard this patch.
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   +328 added lines, -328 removed lines patch added patch discarded remove patch
@@ -984,326 +984,326 @@  discard block
 block discarded – undo
984 984
 }
985 985
 
986 986
 function wpinv_get_pages( $with_slug = false, $default_label = NULL ) {
987
-	$pages_options = array();
987
+    $pages_options = array();
988 988
 
989
-	if( $default_label !== NULL && $default_label !== false ) {
990
-		$pages_options = array( '' => $default_label ); // Blank option
991
-	}
989
+    if( $default_label !== NULL && $default_label !== false ) {
990
+        $pages_options = array( '' => $default_label ); // Blank option
991
+    }
992 992
 
993
-	$pages = get_pages();
994
-	if ( $pages ) {
995
-		foreach ( $pages as $page ) {
996
-			$title = $with_slug ? $page->post_title . ' (' . $page->post_name . ')' : $page->post_title;
993
+    $pages = get_pages();
994
+    if ( $pages ) {
995
+        foreach ( $pages as $page ) {
996
+            $title = $with_slug ? $page->post_title . ' (' . $page->post_name . ')' : $page->post_title;
997 997
             $pages_options[ $page->ID ] = $title;
998
-		}
999
-	}
998
+        }
999
+    }
1000 1000
 
1001
-	return $pages_options;
1001
+    return $pages_options;
1002 1002
 }
1003 1003
 
1004 1004
 function wpinv_header_callback( $args ) {
1005
-	if ( !empty( $args['desc'] ) ) {
1005
+    if ( !empty( $args['desc'] ) ) {
1006 1006
         echo $args['desc'];
1007 1007
     }
1008 1008
 }
1009 1009
 
1010 1010
 function wpinv_hidden_callback( $args ) {
1011
-	global $wpinv_options;
1012
-
1013
-	if ( isset( $args['set_value'] ) ) {
1014
-		$value = $args['set_value'];
1015
-	} elseif ( isset( $wpinv_options[ $args['id'] ] ) ) {
1016
-		$value = $wpinv_options[ $args['id'] ];
1017
-	} else {
1018
-		$value = isset( $args['std'] ) ? $args['std'] : '';
1019
-	}
1020
-
1021
-	if ( isset( $args['faux'] ) && true === $args['faux'] ) {
1022
-		$args['readonly'] = true;
1023
-		$value = isset( $args['std'] ) ? $args['std'] : '';
1024
-		$name  = '';
1025
-	} else {
1026
-		$name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"';
1027
-	}
1028
-
1029
-	$html = '<input type="hidden" id="wpinv_settings[' . wpinv_sanitize_key( $args['id'] ) . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '" />';
1011
+    global $wpinv_options;
1012
+
1013
+    if ( isset( $args['set_value'] ) ) {
1014
+        $value = $args['set_value'];
1015
+    } elseif ( isset( $wpinv_options[ $args['id'] ] ) ) {
1016
+        $value = $wpinv_options[ $args['id'] ];
1017
+    } else {
1018
+        $value = isset( $args['std'] ) ? $args['std'] : '';
1019
+    }
1020
+
1021
+    if ( isset( $args['faux'] ) && true === $args['faux'] ) {
1022
+        $args['readonly'] = true;
1023
+        $value = isset( $args['std'] ) ? $args['std'] : '';
1024
+        $name  = '';
1025
+    } else {
1026
+        $name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"';
1027
+    }
1028
+
1029
+    $html = '<input type="hidden" id="wpinv_settings[' . wpinv_sanitize_key( $args['id'] ) . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '" />';
1030 1030
     
1031
-	echo $html;
1031
+    echo $html;
1032 1032
 }
1033 1033
 
1034 1034
 function wpinv_checkbox_callback( $args ) {
1035
-	global $wpinv_options;
1035
+    global $wpinv_options;
1036 1036
     
1037 1037
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
1038 1038
 
1039
-	if ( isset( $args['faux'] ) && true === $args['faux'] ) {
1040
-		$name = '';
1041
-	} else {
1042
-		$name = 'name="wpinv_settings[' . $sanitize_id . ']"';
1043
-	}
1039
+    if ( isset( $args['faux'] ) && true === $args['faux'] ) {
1040
+        $name = '';
1041
+    } else {
1042
+        $name = 'name="wpinv_settings[' . $sanitize_id . ']"';
1043
+    }
1044 1044
 
1045
-	$checked = isset( $wpinv_options[ $args['id'] ] ) ? checked( 1, $wpinv_options[ $args['id'] ], false ) : '';
1046
-	$html = '<input type="checkbox" id="wpinv_settings[' . $sanitize_id . ']"' . $name . ' value="1" ' . $checked . '/>';
1047
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1045
+    $checked = isset( $wpinv_options[ $args['id'] ] ) ? checked( 1, $wpinv_options[ $args['id'] ], false ) : '';
1046
+    $html = '<input type="checkbox" id="wpinv_settings[' . $sanitize_id . ']"' . $name . ' value="1" ' . $checked . '/>';
1047
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1048 1048
 
1049
-	echo $html;
1049
+    echo $html;
1050 1050
 }
1051 1051
 
1052 1052
 function wpinv_multicheck_callback( $args ) {
1053
-	global $wpinv_options;
1053
+    global $wpinv_options;
1054 1054
 
1055
-	$sanitize_id = wpinv_sanitize_key( $args['id'] );
1056
-	$class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : '';
1055
+    $sanitize_id = wpinv_sanitize_key( $args['id'] );
1056
+    $class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : '';
1057 1057
 
1058
-	if ( ! empty( $args['options'] ) ) {
1059
-		echo '<div class="wpi-mcheck-rows wpi-mcheck-' . $sanitize_id . $class . '">';
1058
+    if ( ! empty( $args['options'] ) ) {
1059
+        echo '<div class="wpi-mcheck-rows wpi-mcheck-' . $sanitize_id . $class . '">';
1060 1060
         foreach( $args['options'] as $key => $option ):
1061
-			$sanitize_key = wpinv_sanitize_key( $key );
1062
-			if ( isset( $wpinv_options[$args['id']][$sanitize_key] ) ) { 
1063
-				$enabled = $sanitize_key;
1064
-			} else { 
1065
-				$enabled = NULL; 
1066
-			}
1067
-			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;';
1068
-			echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . wp_kses_post( $option ) . '</label></div>';
1069
-		endforeach;
1070
-		echo '</div>';
1071
-		echo '<p class="description">' . $args['desc'] . '</p>';
1072
-	}
1061
+            $sanitize_key = wpinv_sanitize_key( $key );
1062
+            if ( isset( $wpinv_options[$args['id']][$sanitize_key] ) ) { 
1063
+                $enabled = $sanitize_key;
1064
+            } else { 
1065
+                $enabled = NULL; 
1066
+            }
1067
+            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;';
1068
+            echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . wp_kses_post( $option ) . '</label></div>';
1069
+        endforeach;
1070
+        echo '</div>';
1071
+        echo '<p class="description">' . $args['desc'] . '</p>';
1072
+    }
1073 1073
 }
1074 1074
 
1075 1075
 function wpinv_payment_icons_callback( $args ) {
1076
-	global $wpinv_options;
1076
+    global $wpinv_options;
1077 1077
     
1078 1078
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
1079 1079
 
1080
-	if ( ! empty( $args['options'] ) ) {
1081
-		foreach( $args['options'] as $key => $option ) {
1080
+    if ( ! empty( $args['options'] ) ) {
1081
+        foreach( $args['options'] as $key => $option ) {
1082 1082
             $sanitize_key = wpinv_sanitize_key( $key );
1083 1083
             
1084
-			if( isset( $wpinv_options[$args['id']][$key] ) ) {
1085
-				$enabled = $option;
1086
-			} else {
1087
-				$enabled = NULL;
1088
-			}
1089
-
1090
-			echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" style="margin-right:10px;line-height:16px;height:16px;display:inline-block;">';
1091
-
1092
-				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;';
1093
-
1094
-				if ( wpinv_string_is_image_url( $key ) ) {
1095
-					echo '<img class="payment-icon" src="' . esc_url( $key ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
1096
-				} else {
1097
-					$card = strtolower( str_replace( ' ', '', $option ) );
1098
-
1099
-					if ( has_filter( 'wpinv_accepted_payment_' . $card . '_image' ) ) {
1100
-						$image = apply_filters( 'wpinv_accepted_payment_' . $card . '_image', '' );
1101
-					} else {
1102
-						$image       = wpinv_locate_template( 'images' . DIRECTORY_SEPARATOR . 'icons' . DIRECTORY_SEPARATOR . $card . '.gif', false );
1103
-						$content_dir = WP_CONTENT_DIR;
1104
-
1105
-						if ( function_exists( 'wp_normalize_path' ) ) {
1106
-							// Replaces backslashes with forward slashes for Windows systems
1107
-							$image = wp_normalize_path( $image );
1108
-							$content_dir = wp_normalize_path( $content_dir );
1109
-						}
1110
-
1111
-						$image = str_replace( $content_dir, content_url(), $image );
1112
-					}
1113
-
1114
-					echo '<img class="payment-icon" src="' . esc_url( $image ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
1115
-				}
1116
-			echo $option . '</label>';
1117
-		}
1118
-		echo '<p class="description" style="margin-top:16px;">' . wp_kses_post( $args['desc'] ) . '</p>';
1119
-	}
1084
+            if( isset( $wpinv_options[$args['id']][$key] ) ) {
1085
+                $enabled = $option;
1086
+            } else {
1087
+                $enabled = NULL;
1088
+            }
1089
+
1090
+            echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" style="margin-right:10px;line-height:16px;height:16px;display:inline-block;">';
1091
+
1092
+                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;';
1093
+
1094
+                if ( wpinv_string_is_image_url( $key ) ) {
1095
+                    echo '<img class="payment-icon" src="' . esc_url( $key ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
1096
+                } else {
1097
+                    $card = strtolower( str_replace( ' ', '', $option ) );
1098
+
1099
+                    if ( has_filter( 'wpinv_accepted_payment_' . $card . '_image' ) ) {
1100
+                        $image = apply_filters( 'wpinv_accepted_payment_' . $card . '_image', '' );
1101
+                    } else {
1102
+                        $image       = wpinv_locate_template( 'images' . DIRECTORY_SEPARATOR . 'icons' . DIRECTORY_SEPARATOR . $card . '.gif', false );
1103
+                        $content_dir = WP_CONTENT_DIR;
1104
+
1105
+                        if ( function_exists( 'wp_normalize_path' ) ) {
1106
+                            // Replaces backslashes with forward slashes for Windows systems
1107
+                            $image = wp_normalize_path( $image );
1108
+                            $content_dir = wp_normalize_path( $content_dir );
1109
+                        }
1110
+
1111
+                        $image = str_replace( $content_dir, content_url(), $image );
1112
+                    }
1113
+
1114
+                    echo '<img class="payment-icon" src="' . esc_url( $image ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
1115
+                }
1116
+            echo $option . '</label>';
1117
+        }
1118
+        echo '<p class="description" style="margin-top:16px;">' . wp_kses_post( $args['desc'] ) . '</p>';
1119
+    }
1120 1120
 }
1121 1121
 
1122 1122
 function wpinv_radio_callback( $args ) {
1123
-	global $wpinv_options;
1123
+    global $wpinv_options;
1124 1124
     
1125 1125
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
1126 1126
     
1127 1127
     foreach ( $args['options'] as $key => $option ) :
1128
-		$sanitize_key = wpinv_sanitize_key( $key );
1128
+        $sanitize_key = wpinv_sanitize_key( $key );
1129 1129
         
1130 1130
         $checked = false;
1131 1131
 
1132
-		if ( isset( $wpinv_options[ $args['id'] ] ) && $wpinv_options[ $args['id'] ] == $key )
1133
-			$checked = true;
1134
-		elseif( isset( $args['std'] ) && $args['std'] == $key && ! isset( $wpinv_options[ $args['id'] ] ) )
1135
-			$checked = true;
1132
+        if ( isset( $wpinv_options[ $args['id'] ] ) && $wpinv_options[ $args['id'] ] == $key )
1133
+            $checked = true;
1134
+        elseif( isset( $args['std'] ) && $args['std'] == $key && ! isset( $wpinv_options[ $args['id'] ] ) )
1135
+            $checked = true;
1136 1136
 
1137
-		echo '<input name="wpinv_settings[' . $sanitize_id . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="radio" value="' . $sanitize_key . '" ' . checked(true, $checked, false) . '/>&nbsp;';
1138
-		echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html( $option ) . '</label><br/>';
1139
-	endforeach;
1137
+        echo '<input name="wpinv_settings[' . $sanitize_id . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="radio" value="' . $sanitize_key . '" ' . checked(true, $checked, false) . '/>&nbsp;';
1138
+        echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html( $option ) . '</label><br/>';
1139
+    endforeach;
1140 1140
 
1141
-	echo '<p class="description">' . wp_kses_post( $args['desc'] ) . '</p>';
1141
+    echo '<p class="description">' . wp_kses_post( $args['desc'] ) . '</p>';
1142 1142
 }
1143 1143
 
1144 1144
 function wpinv_gateways_callback( $args ) {
1145
-	global $wpinv_options;
1145
+    global $wpinv_options;
1146 1146
     
1147 1147
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
1148 1148
 
1149
-	foreach ( $args['options'] as $key => $option ) :
1150
-		$sanitize_key = wpinv_sanitize_key( $key );
1149
+    foreach ( $args['options'] as $key => $option ) :
1150
+        $sanitize_key = wpinv_sanitize_key( $key );
1151 1151
         
1152 1152
         if ( isset( $wpinv_options['gateways'][ $key ] ) )
1153
-			$enabled = '1';
1154
-		else
1155
-			$enabled = null;
1153
+            $enabled = '1';
1154
+        else
1155
+            $enabled = null;
1156 1156
 
1157
-		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;';
1158
-		echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html( $option['admin_label'] ) . '</label><br/>';
1159
-	endforeach;
1157
+        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;';
1158
+        echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html( $option['admin_label'] ) . '</label><br/>';
1159
+    endforeach;
1160 1160
 }
1161 1161
 
1162 1162
 function wpinv_gateway_select_callback($args) {
1163
-	global $wpinv_options;
1163
+    global $wpinv_options;
1164 1164
     
1165 1165
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
1166 1166
     $class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : '';
1167 1167
 
1168
-	echo '<select name="wpinv_settings[' . $sanitize_id . ']"" id="wpinv_settings[' . $sanitize_id . ']" class="'.$class.'" >';
1168
+    echo '<select name="wpinv_settings[' . $sanitize_id . ']"" id="wpinv_settings[' . $sanitize_id . ']" class="'.$class.'" >';
1169 1169
 
1170
-	foreach ( $args['options'] as $key => $option ) :
1171
-		if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) {
1170
+    foreach ( $args['options'] as $key => $option ) :
1171
+        if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) {
1172 1172
             $selected = selected( $key, $args['selected'], false );
1173 1173
         } else {
1174 1174
             $selected = isset( $wpinv_options[ $args['id'] ] ) ? selected( $key, $wpinv_options[$args['id']], false ) : '';
1175 1175
         }
1176
-		echo '<option value="' . wpinv_sanitize_key( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>';
1177
-	endforeach;
1176
+        echo '<option value="' . wpinv_sanitize_key( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>';
1177
+    endforeach;
1178 1178
 
1179
-	echo '</select>';
1180
-	echo '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1179
+    echo '</select>';
1180
+    echo '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1181 1181
 }
1182 1182
 
1183 1183
 function wpinv_text_callback( $args ) {
1184
-	global $wpinv_options;
1184
+    global $wpinv_options;
1185 1185
     
1186 1186
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
1187 1187
 
1188
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1189
-		$value = $wpinv_options[ $args['id'] ];
1190
-	} else {
1191
-		$value = isset( $args['std'] ) ? $args['std'] : '';
1192
-	}
1193
-
1194
-	if ( isset( $args['faux'] ) && true === $args['faux'] ) {
1195
-		$args['readonly'] = true;
1196
-		$value = isset( $args['std'] ) ? $args['std'] : '';
1197
-		$name  = '';
1198
-	} else {
1199
-		$name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"';
1200
-	}
1201
-	$class = !empty( $args['class'] ) ? sanitize_html_class( $args['class'] ) : '';
1202
-
1203
-	$readonly = $args['readonly'] === true ? ' readonly="readonly"' : '';
1204
-	$size     = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
1205
-	$html     = '<input type="text" class="' . sanitize_html_class( $size ) . '-text ' . $class . '" id="wpinv_settings[' . $sanitize_id . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '"' . $readonly . '/>';
1206
-	$html    .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1207
-
1208
-	echo $html;
1188
+    if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1189
+        $value = $wpinv_options[ $args['id'] ];
1190
+    } else {
1191
+        $value = isset( $args['std'] ) ? $args['std'] : '';
1192
+    }
1193
+
1194
+    if ( isset( $args['faux'] ) && true === $args['faux'] ) {
1195
+        $args['readonly'] = true;
1196
+        $value = isset( $args['std'] ) ? $args['std'] : '';
1197
+        $name  = '';
1198
+    } else {
1199
+        $name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"';
1200
+    }
1201
+    $class = !empty( $args['class'] ) ? sanitize_html_class( $args['class'] ) : '';
1202
+
1203
+    $readonly = $args['readonly'] === true ? ' readonly="readonly"' : '';
1204
+    $size     = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
1205
+    $html     = '<input type="text" class="' . sanitize_html_class( $size ) . '-text ' . $class . '" id="wpinv_settings[' . $sanitize_id . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '"' . $readonly . '/>';
1206
+    $html    .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1207
+
1208
+    echo $html;
1209 1209
 }
1210 1210
 
1211 1211
 function wpinv_number_callback( $args ) {
1212
-	global $wpinv_options;
1212
+    global $wpinv_options;
1213 1213
     
1214 1214
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
1215 1215
 
1216
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1217
-		$value = $wpinv_options[ $args['id'] ];
1218
-	} else {
1219
-		$value = isset( $args['std'] ) ? $args['std'] : '';
1220
-	}
1221
-
1222
-	if ( isset( $args['faux'] ) && true === $args['faux'] ) {
1223
-		$args['readonly'] = true;
1224
-		$value = isset( $args['std'] ) ? $args['std'] : '';
1225
-		$name  = '';
1226
-	} else {
1227
-		$name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"';
1228
-	}
1229
-
1230
-	$max  = isset( $args['max'] ) ? $args['max'] : 999999;
1231
-	$min  = isset( $args['min'] ) ? $args['min'] : 0;
1232
-	$step = isset( $args['step'] ) ? $args['step'] : 1;
1233
-	$class = !empty( $args['class'] ) ? sanitize_html_class( $args['class'] ) : '';
1234
-
1235
-	$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
1236
-	$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 ) ) . '"/>';
1237
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1238
-
1239
-	echo $html;
1216
+    if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1217
+        $value = $wpinv_options[ $args['id'] ];
1218
+    } else {
1219
+        $value = isset( $args['std'] ) ? $args['std'] : '';
1220
+    }
1221
+
1222
+    if ( isset( $args['faux'] ) && true === $args['faux'] ) {
1223
+        $args['readonly'] = true;
1224
+        $value = isset( $args['std'] ) ? $args['std'] : '';
1225
+        $name  = '';
1226
+    } else {
1227
+        $name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"';
1228
+    }
1229
+
1230
+    $max  = isset( $args['max'] ) ? $args['max'] : 999999;
1231
+    $min  = isset( $args['min'] ) ? $args['min'] : 0;
1232
+    $step = isset( $args['step'] ) ? $args['step'] : 1;
1233
+    $class = !empty( $args['class'] ) ? sanitize_html_class( $args['class'] ) : '';
1234
+
1235
+    $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
1236
+    $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 ) ) . '"/>';
1237
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1238
+
1239
+    echo $html;
1240 1240
 }
1241 1241
 
1242 1242
 function wpinv_textarea_callback( $args ) {
1243
-	global $wpinv_options;
1243
+    global $wpinv_options;
1244 1244
     
1245 1245
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
1246 1246
 
1247
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1248
-		$value = $wpinv_options[ $args['id'] ];
1249
-	} else {
1250
-		$value = isset( $args['std'] ) ? $args['std'] : '';
1251
-	}
1247
+    if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1248
+        $value = $wpinv_options[ $args['id'] ];
1249
+    } else {
1250
+        $value = isset( $args['std'] ) ? $args['std'] : '';
1251
+    }
1252 1252
     
1253 1253
     $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
1254 1254
     $class = ( isset( $args['class'] ) && ! is_null( $args['class'] ) ) ? $args['class'] : 'large-text';
1255 1255
 
1256
-	$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>';
1257
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1256
+    $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>';
1257
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1258 1258
 
1259
-	echo $html;
1259
+    echo $html;
1260 1260
 }
1261 1261
 
1262 1262
 function wpinv_password_callback( $args ) {
1263
-	global $wpinv_options;
1263
+    global $wpinv_options;
1264 1264
     
1265 1265
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
1266 1266
 
1267
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1268
-		$value = $wpinv_options[ $args['id'] ];
1269
-	} else {
1270
-		$value = isset( $args['std'] ) ? $args['std'] : '';
1271
-	}
1267
+    if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1268
+        $value = $wpinv_options[ $args['id'] ];
1269
+    } else {
1270
+        $value = isset( $args['std'] ) ? $args['std'] : '';
1271
+    }
1272 1272
 
1273
-	$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
1274
-	$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 ) . '"/>';
1275
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
1273
+    $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
1274
+    $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 ) . '"/>';
1275
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
1276 1276
 
1277
-	echo $html;
1277
+    echo $html;
1278 1278
 }
1279 1279
 
1280 1280
 function wpinv_missing_callback($args) {
1281
-	printf(
1282
-		__( 'The callback function used for the %s setting is missing.', 'invoicing' ),
1283
-		'<strong>' . $args['id'] . '</strong>'
1284
-	);
1281
+    printf(
1282
+        __( 'The callback function used for the %s setting is missing.', 'invoicing' ),
1283
+        '<strong>' . $args['id'] . '</strong>'
1284
+    );
1285 1285
 }
1286 1286
 
1287 1287
 function wpinv_select_callback($args) {
1288
-	global $wpinv_options;
1288
+    global $wpinv_options;
1289 1289
     
1290 1290
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
1291 1291
 
1292
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1293
-		$value = $wpinv_options[ $args['id'] ];
1294
-	} else {
1295
-		$value = isset( $args['std'] ) ? $args['std'] : '';
1296
-	}
1292
+    if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1293
+        $value = $wpinv_options[ $args['id'] ];
1294
+    } else {
1295
+        $value = isset( $args['std'] ) ? $args['std'] : '';
1296
+    }
1297 1297
     
1298 1298
     if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) {
1299 1299
         $value = $args['selected'];
1300 1300
     }
1301 1301
 
1302
-	if ( isset( $args['placeholder'] ) ) {
1303
-		$placeholder = $args['placeholder'];
1304
-	} else {
1305
-		$placeholder = '';
1306
-	}
1302
+    if ( isset( $args['placeholder'] ) ) {
1303
+        $placeholder = $args['placeholder'];
1304
+    } else {
1305
+        $placeholder = '';
1306
+    }
1307 1307
     
1308 1308
     if( !empty( $args['onchange'] ) ) {
1309 1309
         $onchange = ' onchange="' . esc_attr( $args['onchange'] ) . '"';
@@ -1313,142 +1313,142 @@  discard block
 block discarded – undo
1313 1313
 
1314 1314
     $class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : '';
1315 1315
 
1316
-	$html = '<select id="wpinv_settings[' . $sanitize_id . ']" class="'.$class.'"  name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" data-placeholder="' . esc_html( $placeholder ) . '"' . $onchange . ' />';
1316
+    $html = '<select id="wpinv_settings[' . $sanitize_id . ']" class="'.$class.'"  name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" data-placeholder="' . esc_html( $placeholder ) . '"' . $onchange . ' />';
1317 1317
 
1318
-	foreach ( $args['options'] as $option => $name ) {
1319
-		$selected = selected( $option, $value, false );
1320
-		$html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>';
1321
-	}
1318
+    foreach ( $args['options'] as $option => $name ) {
1319
+        $selected = selected( $option, $value, false );
1320
+        $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>';
1321
+    }
1322 1322
 
1323
-	$html .= '</select>';
1324
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
1323
+    $html .= '</select>';
1324
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
1325 1325
 
1326
-	echo $html;
1326
+    echo $html;
1327 1327
 }
1328 1328
 
1329 1329
 function wpinv_color_select_callback( $args ) {
1330
-	global $wpinv_options;
1330
+    global $wpinv_options;
1331 1331
     
1332 1332
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
1333 1333
 
1334
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1335
-		$value = $wpinv_options[ $args['id'] ];
1336
-	} else {
1337
-		$value = isset( $args['std'] ) ? $args['std'] : '';
1338
-	}
1334
+    if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1335
+        $value = $wpinv_options[ $args['id'] ];
1336
+    } else {
1337
+        $value = isset( $args['std'] ) ? $args['std'] : '';
1338
+    }
1339 1339
 
1340
-	$html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"/>';
1340
+    $html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"/>';
1341 1341
 
1342
-	foreach ( $args['options'] as $option => $color ) {
1343
-		$selected = selected( $option, $value, false );
1344
-		$html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $color['label'] ) . '</option>';
1345
-	}
1342
+    foreach ( $args['options'] as $option => $color ) {
1343
+        $selected = selected( $option, $value, false );
1344
+        $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $color['label'] ) . '</option>';
1345
+    }
1346 1346
 
1347
-	$html .= '</select>';
1348
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1347
+    $html .= '</select>';
1348
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1349 1349
 
1350
-	echo $html;
1350
+    echo $html;
1351 1351
 }
1352 1352
 
1353 1353
 function wpinv_rich_editor_callback( $args ) {
1354
-	global $wpinv_options, $wp_version;
1354
+    global $wpinv_options, $wp_version;
1355 1355
     
1356 1356
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
1357 1357
 
1358
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1359
-		$value = $wpinv_options[ $args['id'] ];
1358
+    if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1359
+        $value = $wpinv_options[ $args['id'] ];
1360 1360
 
1361
-		if( empty( $args['allow_blank'] ) && empty( $value ) ) {
1362
-			$value = isset( $args['std'] ) ? $args['std'] : '';
1363
-		}
1364
-	} else {
1365
-		$value = isset( $args['std'] ) ? $args['std'] : '';
1366
-	}
1361
+        if( empty( $args['allow_blank'] ) && empty( $value ) ) {
1362
+            $value = isset( $args['std'] ) ? $args['std'] : '';
1363
+        }
1364
+    } else {
1365
+        $value = isset( $args['std'] ) ? $args['std'] : '';
1366
+    }
1367 1367
 
1368
-	$rows = isset( $args['size'] ) ? $args['size'] : 20;
1368
+    $rows = isset( $args['size'] ) ? $args['size'] : 20;
1369 1369
 
1370
-	if ( $wp_version >= 3.3 && function_exists( 'wp_editor' ) ) {
1371
-		ob_start();
1372
-		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 ) );
1373
-		$html = ob_get_clean();
1374
-	} else {
1375
-		$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>';
1376
-	}
1370
+    if ( $wp_version >= 3.3 && function_exists( 'wp_editor' ) ) {
1371
+        ob_start();
1372
+        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 ) );
1373
+        $html = ob_get_clean();
1374
+    } else {
1375
+        $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>';
1376
+    }
1377 1377
 
1378
-	$html .= '<br/><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
1378
+    $html .= '<br/><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
1379 1379
 
1380
-	echo $html;
1380
+    echo $html;
1381 1381
 }
1382 1382
 
1383 1383
 function wpinv_upload_callback( $args ) {
1384
-	global $wpinv_options;
1384
+    global $wpinv_options;
1385 1385
     
1386 1386
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
1387 1387
 
1388
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1389
-		$value = $wpinv_options[$args['id']];
1390
-	} else {
1391
-		$value = isset($args['std']) ? $args['std'] : '';
1392
-	}
1388
+    if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1389
+        $value = $wpinv_options[$args['id']];
1390
+    } else {
1391
+        $value = isset($args['std']) ? $args['std'] : '';
1392
+    }
1393 1393
 
1394
-	$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
1395
-	$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 ) ) . '"/>';
1396
-	$html .= '<span>&nbsp;<input type="button" class="wpinv_settings_upload_button button-secondary" value="' . __( 'Upload File', 'invoicing' ) . '"/></span>';
1397
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
1394
+    $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
1395
+    $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 ) ) . '"/>';
1396
+    $html .= '<span>&nbsp;<input type="button" class="wpinv_settings_upload_button button-secondary" value="' . __( 'Upload File', 'invoicing' ) . '"/></span>';
1397
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
1398 1398
 
1399
-	echo $html;
1399
+    echo $html;
1400 1400
 }
1401 1401
 
1402 1402
 function wpinv_color_callback( $args ) {
1403
-	global $wpinv_options;
1403
+    global $wpinv_options;
1404 1404
     
1405 1405
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
1406 1406
 
1407
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1408
-		$value = $wpinv_options[ $args['id'] ];
1409
-	} else {
1410
-		$value = isset( $args['std'] ) ? $args['std'] : '';
1411
-	}
1407
+    if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1408
+        $value = $wpinv_options[ $args['id'] ];
1409
+    } else {
1410
+        $value = isset( $args['std'] ) ? $args['std'] : '';
1411
+    }
1412 1412
 
1413
-	$default = isset( $args['std'] ) ? $args['std'] : '';
1413
+    $default = isset( $args['std'] ) ? $args['std'] : '';
1414 1414
 
1415
-	$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 ) . '" />';
1416
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1415
+    $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 ) . '" />';
1416
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1417 1417
 
1418
-	echo $html;
1418
+    echo $html;
1419 1419
 }
1420 1420
 
1421 1421
 function wpinv_country_states_callback($args) {
1422
-	global $wpinv_options;
1422
+    global $wpinv_options;
1423 1423
     
1424 1424
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
1425 1425
 
1426
-	if ( isset( $args['placeholder'] ) ) {
1427
-		$placeholder = $args['placeholder'];
1428
-	} else {
1429
-		$placeholder = '';
1430
-	}
1426
+    if ( isset( $args['placeholder'] ) ) {
1427
+        $placeholder = $args['placeholder'];
1428
+    } else {
1429
+        $placeholder = '';
1430
+    }
1431 1431
 
1432
-	$states = wpinv_get_country_states();
1432
+    $states = wpinv_get_country_states();
1433 1433
 
1434
-	$class = empty( $states ) ? ' class="wpinv-no-states"' : ' class="wpi_select2"';
1435
-	$html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"' . $class . 'data-placeholder="' . esc_html( $placeholder ) . '"/>';
1434
+    $class = empty( $states ) ? ' class="wpinv-no-states"' : ' class="wpi_select2"';
1435
+    $html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"' . $class . 'data-placeholder="' . esc_html( $placeholder ) . '"/>';
1436 1436
 
1437
-	foreach ( $states as $option => $name ) {
1438
-		$selected = isset( $wpinv_options[ $args['id'] ] ) ? selected( $option, $wpinv_options[$args['id']], false ) : '';
1439
-		$html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>';
1440
-	}
1437
+    foreach ( $states as $option => $name ) {
1438
+        $selected = isset( $wpinv_options[ $args['id'] ] ) ? selected( $option, $wpinv_options[$args['id']], false ) : '';
1439
+        $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>';
1440
+    }
1441 1441
 
1442
-	$html .= '</select>';
1443
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1442
+    $html .= '</select>';
1443
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1444 1444
 
1445
-	echo $html;
1445
+    echo $html;
1446 1446
 }
1447 1447
 
1448 1448
 function wpinv_tax_rates_callback($args) {
1449
-	global $wpinv_options;
1450
-	$rates = wpinv_get_tax_rates();
1451
-	ob_start(); ?>
1449
+    global $wpinv_options;
1450
+    $rates = wpinv_get_tax_rates();
1451
+    ob_start(); ?>
1452 1452
     </td><tr>
1453 1453
     <td colspan="2" class="wpinv_tax_tdbox">
1454 1454
 	<p><?php echo $args['desc']; ?></p>
@@ -1472,40 +1472,40 @@  discard block
 block discarded – undo
1472 1472
 			<tr>
1473 1473
 				<td class="wpinv_tax_country">
1474 1474
 					<?php
1475
-					echo wpinv_html_select( array(
1476
-						'options'          => wpinv_get_country_list( true ),
1477
-						'name'             => 'tax_rates[' . $sanitized_key . '][country]',
1475
+                    echo wpinv_html_select( array(
1476
+                        'options'          => wpinv_get_country_list( true ),
1477
+                        'name'             => 'tax_rates[' . $sanitized_key . '][country]',
1478 1478
                         'id'               => 'tax_rates[' . $sanitized_key . '][country]',
1479
-						'selected'         => $rate['country'],
1480
-						'show_option_all'  => false,
1481
-						'show_option_none' => false,
1482
-						'class'            => 'wpinv-tax-country wpi_select2',
1483
-						'placeholder'      => __( 'Choose a country', 'invoicing' )
1484
-					) );
1485
-					?>
1479
+                        'selected'         => $rate['country'],
1480
+                        'show_option_all'  => false,
1481
+                        'show_option_none' => false,
1482
+                        'class'            => 'wpinv-tax-country wpi_select2',
1483
+                        'placeholder'      => __( 'Choose a country', 'invoicing' )
1484
+                    ) );
1485
+                    ?>
1486 1486
 				</td>
1487 1487
 				<td class="wpinv_tax_state">
1488 1488
 					<?php
1489
-					$states = wpinv_get_country_states( $rate['country'] );
1490
-					if( !empty( $states ) ) {
1491
-						echo wpinv_html_select( array(
1492
-							'options'          => array_merge( array( '' => '' ), $states ),
1493
-							'name'             => 'tax_rates[' . $sanitized_key . '][state]',
1489
+                    $states = wpinv_get_country_states( $rate['country'] );
1490
+                    if( !empty( $states ) ) {
1491
+                        echo wpinv_html_select( array(
1492
+                            'options'          => array_merge( array( '' => '' ), $states ),
1493
+                            'name'             => 'tax_rates[' . $sanitized_key . '][state]',
1494 1494
                             'id'               => 'tax_rates[' . $sanitized_key . '][state]',
1495
-							'selected'         => $rate['state'],
1496
-							'show_option_all'  => false,
1497
-							'show_option_none' => false,
1495
+                            'selected'         => $rate['state'],
1496
+                            'show_option_all'  => false,
1497
+                            'show_option_none' => false,
1498 1498
                             'class'            => 'wpi_select2',
1499
-							'placeholder'      => __( 'Choose a state', 'invoicing' )
1500
-						) );
1501
-					} else {
1502
-						echo wpinv_html_text( array(
1503
-							'name'  => 'tax_rates[' . $sanitized_key . '][state]', $rate['state'],
1504
-							'value' => ! empty( $rate['state'] ) ? $rate['state'] : '',
1499
+                            'placeholder'      => __( 'Choose a state', 'invoicing' )
1500
+                        ) );
1501
+                    } else {
1502
+                        echo wpinv_html_text( array(
1503
+                            'name'  => 'tax_rates[' . $sanitized_key . '][state]', $rate['state'],
1504
+                            'value' => ! empty( $rate['state'] ) ? $rate['state'] : '',
1505 1505
                             'id'    => 'tax_rates[' . $sanitized_key . '][state]',
1506
-						) );
1507
-					}
1508
-					?>
1506
+                        ) );
1507
+                    }
1508
+                    ?>
1509 1509
 				</td>
1510 1510
 				<td class="wpinv_tax_global">
1511 1511
 					<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'] ) ); ?>/>
@@ -1520,19 +1520,19 @@  discard block
 block discarded – undo
1520 1520
 			<tr>
1521 1521
 				<td class="wpinv_tax_country">
1522 1522
 					<?php
1523
-					echo wpinv_html_select( array(
1524
-						'options'          => wpinv_get_country_list( true ),
1525
-						'name'             => 'tax_rates[0][country]',
1526
-						'show_option_all'  => false,
1527
-						'show_option_none' => false,
1528
-						'class'            => 'wpinv-tax-country wpi_select2',
1529
-						'placeholder'      => __( 'Choose a country', 'invoicing' )
1530
-					) ); ?>
1523
+                    echo wpinv_html_select( array(
1524
+                        'options'          => wpinv_get_country_list( true ),
1525
+                        'name'             => 'tax_rates[0][country]',
1526
+                        'show_option_all'  => false,
1527
+                        'show_option_none' => false,
1528
+                        'class'            => 'wpinv-tax-country wpi_select2',
1529
+                        'placeholder'      => __( 'Choose a country', 'invoicing' )
1530
+                    ) ); ?>
1531 1531
 				</td>
1532 1532
 				<td class="wpinv_tax_state">
1533 1533
 					<?php echo wpinv_html_text( array(
1534
-						'name' => 'tax_rates[0][state]'
1535
-					) ); ?>
1534
+                        'name' => 'tax_rates[0][state]'
1535
+                    ) ); ?>
1536 1536
 				</td>
1537 1537
 				<td class="wpinv_tax_global">
1538 1538
 					<input type="checkbox" name="tax_rates[0][global]" id="tax_rates[0][global]" value="1"/>
@@ -1547,7 +1547,7 @@  discard block
 block discarded – undo
1547 1547
         <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>
1548 1548
 	</table>
1549 1549
 	<?php
1550
-	echo ob_get_clean();
1550
+    echo ob_get_clean();
1551 1551
 }
1552 1552
 
1553 1553
 function wpinv_tools_callback($args) {
@@ -1575,15 +1575,15 @@  discard block
 block discarded – undo
1575 1575
 }
1576 1576
 
1577 1577
 function wpinv_descriptive_text_callback( $args ) {
1578
-	echo wp_kses_post( $args['desc'] );
1578
+    echo wp_kses_post( $args['desc'] );
1579 1579
 }
1580 1580
 
1581 1581
 function wpinv_hook_callback( $args ) {
1582
-	do_action( 'wpinv_' . $args['id'], $args );
1582
+    do_action( 'wpinv_' . $args['id'], $args );
1583 1583
 }
1584 1584
 
1585 1585
 function wpinv_set_settings_cap() {
1586
-	return wpinv_get_capability();
1586
+    return wpinv_get_capability();
1587 1587
 }
1588 1588
 add_filter( 'option_page_capability_wpinv_settings', 'wpinv_set_settings_cap' );
1589 1589
 
Please login to merge, or discard this patch.
Spacing   +390 added lines, -390 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 array
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,9 +190,9 @@  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
 
@@ -200,30 +200,30 @@  discard block
 block discarded – undo
200 200
     add_settings_field(
201 201
         'wpinv_settings[' . $option['id'] . ']',
202 202
         $name,
203
-        function_exists( $cb ) ? $cb : 'wpinv_missing_callback',
203
+        function_exists($cb) ? $cb : 'wpinv_missing_callback',
204 204
         $section,
205 205
         $section,
206 206
         array(
207 207
             'section'     => $section,
208
-            'id'          => isset( $option['id'] )          ? $option['id']          : null,
209
-            'desc'        => isset( $option['desc'] )        ? $option['desc']        : '',
210
-            'name'        => isset( $option['name'] )        ? $option['name']        : null,
211
-            'size'        => isset( $option['size'] )        ? $option['size']        : null,
212
-            'options'     => isset( $option['options'] )     ? $option['options']     : '',
213
-            'selected'    => isset( $option['selected'] )    ? $option['selected']    : null,
214
-            'std'         => isset( $option['std'] )         ? $option['std']         : '',
215
-            'min'         => isset( $option['min'] )         ? $option['min']         : null,
216
-            'max'         => isset( $option['max'] )         ? $option['max']         : null,
217
-            'step'        => isset( $option['step'] )        ? $option['step']        : null,
218
-            'placeholder' => isset( $option['placeholder'] ) ? $option['placeholder'] : null,
219
-            'allow_blank' => isset( $option['allow_blank'] ) ? $option['allow_blank'] : true,
220
-            'readonly'    => isset( $option['readonly'] )    ? $option['readonly']    : false,
221
-            'faux'        => isset( $option['faux'] )        ? $option['faux']        : false,
222
-            'onchange'    => isset( $option['onchange'] )   ? $option['onchange']     : '',
223
-            'custom'      => isset( $option['custom'] )     ? $option['custom']       : '',
224
-            'class'       => isset( $option['class'] )     ? $option['class']         : '',
225
-            'cols'        => isset( $option['cols'] ) && (int) $option['cols'] > 0 ? (int) $option['cols'] : 50,
226
-            'rows'        => isset( $option['rows'] ) && (int) $option['rows'] > 0 ? (int) $option['rows'] : 5,
208
+            'id'          => isset($option['id']) ? $option['id'] : null,
209
+            'desc'        => isset($option['desc']) ? $option['desc'] : '',
210
+            'name'        => isset($option['name']) ? $option['name'] : null,
211
+            'size'        => isset($option['size']) ? $option['size'] : null,
212
+            'options'     => isset($option['options']) ? $option['options'] : '',
213
+            'selected'    => isset($option['selected']) ? $option['selected'] : null,
214
+            'std'         => isset($option['std']) ? $option['std'] : '',
215
+            'min'         => isset($option['min']) ? $option['min'] : null,
216
+            'max'         => isset($option['max']) ? $option['max'] : null,
217
+            'step'        => isset($option['step']) ? $option['step'] : null,
218
+            'placeholder' => isset($option['placeholder']) ? $option['placeholder'] : null,
219
+            'allow_blank' => isset($option['allow_blank']) ? $option['allow_blank'] : true,
220
+            'readonly'    => isset($option['readonly']) ? $option['readonly'] : false,
221
+            'faux'        => isset($option['faux']) ? $option['faux'] : false,
222
+            'onchange'    => isset($option['onchange']) ? $option['onchange'] : '',
223
+            'custom'      => isset($option['custom']) ? $option['custom'] : '',
224
+            'class'       => isset($option['class']) ? $option['class'] : '',
225
+            'cols'        => isset($option['cols']) && (int) $option['cols'] > 0 ? (int) $option['cols'] : 50,
226
+            'rows'        => isset($option['rows']) && (int) $option['rows'] > 0 ? (int) $option['rows'] : 5,
227 227
         )
228 228
     );
229 229
 
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
  * @return array
236 236
  */
237 237
 function wpinv_get_registered_settings() {
238
-    return apply_filters( 'wpinv_registered_settings', wpinv_get_data( 'admin-settings' ) );
238
+    return apply_filters('wpinv_registered_settings', wpinv_get_data('admin-settings'));
239 239
 }
240 240
 
241 241
 /**
@@ -243,134 +243,134 @@  discard block
 block discarded – undo
243 243
  * 
244 244
  * @return array
245 245
  */
246
-function wpinv_settings_sanitize( $input = array() ) {
246
+function wpinv_settings_sanitize($input = array()) {
247 247
 
248 248
     $wpinv_options = wpinv_get_options();
249 249
 
250
-    if ( empty( wp_get_raw_referer() ) ) {
250
+    if (empty(wp_get_raw_referer())) {
251 251
         return $input;
252 252
     }
253 253
 
254
-    wp_parse_str( wp_get_raw_referer(), $referrer );
254
+    wp_parse_str(wp_get_raw_referer(), $referrer);
255 255
 
256 256
     $settings = wpinv_get_registered_settings();
257
-    $tab      = isset( $referrer['tab'] ) ? $referrer['tab'] : 'general';
258
-    $section  = isset( $referrer['section'] ) ? $referrer['section'] : 'main';
257
+    $tab      = isset($referrer['tab']) ? $referrer['tab'] : 'general';
258
+    $section  = isset($referrer['section']) ? $referrer['section'] : 'main';
259 259
 
260 260
     $input = $input ? $input : array();
261
-    $input = apply_filters( 'wpinv_settings_tab_' . $tab . '_sanitize', $input );
262
-    $input = apply_filters( 'wpinv_settings_' . $tab . '-' . $section . '_sanitize', $input );
261
+    $input = apply_filters('wpinv_settings_tab_' . $tab . '_sanitize', $input);
262
+    $input = apply_filters('wpinv_settings_' . $tab . '-' . $section . '_sanitize', $input);
263 263
 
264 264
     // Loop through each setting being saved and pass it through a sanitization filter
265
-    foreach ( $input as $key => $value ) {
265
+    foreach ($input as $key => $value) {
266 266
 
267 267
         // Get the setting type (checkbox, select, etc)
268
-        $type = isset( $settings[ $tab ][$section][ $key ]['type'] ) ? $settings[ $tab ][$section][ $key ]['type'] : false;
268
+        $type = isset($settings[$tab][$section][$key]['type']) ? $settings[$tab][$section][$key]['type'] : false;
269 269
 
270
-        if ( $type ) {
270
+        if ($type) {
271 271
             // Field type specific filter
272
-            $input[$key] = apply_filters( 'wpinv_settings_sanitize_' . $type, $value, $key );
272
+            $input[$key] = apply_filters('wpinv_settings_sanitize_' . $type, $value, $key);
273 273
         }
274 274
 
275 275
         // General filter
276
-        $input[ $key ] = apply_filters( 'wpinv_settings_sanitize', $input[ $key ], $key );
276
+        $input[$key] = apply_filters('wpinv_settings_sanitize', $input[$key], $key);
277 277
     }
278 278
 
279 279
     // Loop through the whitelist and unset any that are empty for the tab being saved
280
-    $main_settings    = $section == 'main' ? $settings[ $tab ] : array(); // Check for extensions that aren't using new sections
281
-    $section_settings = ! empty( $settings[ $tab ][ $section ] ) ? $settings[ $tab ][ $section ] : array();
280
+    $main_settings    = $section == 'main' ? $settings[$tab] : array(); // Check for extensions that aren't using new sections
281
+    $section_settings = !empty($settings[$tab][$section]) ? $settings[$tab][$section] : array();
282 282
 
283
-    $found_settings = array_merge( $main_settings, $section_settings );
283
+    $found_settings = array_merge($main_settings, $section_settings);
284 284
 
285
-    if ( ! empty( $found_settings ) ) {
286
-        foreach ( $found_settings as $key => $value ) {
285
+    if (!empty($found_settings)) {
286
+        foreach ($found_settings as $key => $value) {
287 287
 
288 288
             // settings used to have numeric keys, now they have keys that match the option ID. This ensures both methods work
289
-            if ( is_numeric( $key ) ) {
289
+            if (is_numeric($key)) {
290 290
                 $key = $value['id'];
291 291
             }
292 292
 
293
-            if ( ! isset( $input[ $key ] ) && isset( $wpinv_options[ $key ] ) ) {
294
-                unset( $wpinv_options[ $key ] );
293
+            if (!isset($input[$key]) && isset($wpinv_options[$key])) {
294
+                unset($wpinv_options[$key]);
295 295
             }
296 296
         }
297 297
     }
298 298
 
299 299
     // Merge our new settings with the existing
300
-    $output = array_merge( $wpinv_options, $input );
300
+    $output = array_merge($wpinv_options, $input);
301 301
 
302
-    add_settings_error( 'wpinv-notices', '', __( 'Settings updated.', 'invoicing' ), 'updated' );
302
+    add_settings_error('wpinv-notices', '', __('Settings updated.', 'invoicing'), 'updated');
303 303
 
304 304
     return $output;
305 305
 }
306 306
 
307
-function wpinv_settings_sanitize_misc_accounting( $input ) {
307
+function wpinv_settings_sanitize_misc_accounting($input) {
308 308
 
309
-    if ( ! wpinv_current_user_can_manage_invoicing() ) {
309
+    if (!wpinv_current_user_can_manage_invoicing()) {
310 310
         return $input;
311 311
     }
312 312
 
313
-    if( ! empty( $input['enable_sequential'] ) && !wpinv_get_option( 'enable_sequential' ) ) {
313
+    if (!empty($input['enable_sequential']) && !wpinv_get_option('enable_sequential')) {
314 314
         // Shows an admin notice about upgrading previous order numbers
315
-        getpaid_session()->set( 'upgrade_sequential', '1' );
315
+        getpaid_session()->set('upgrade_sequential', '1');
316 316
     }
317 317
 
318 318
     return $input;
319 319
 }
320
-add_filter( 'wpinv_settings_misc-accounting_sanitize', 'wpinv_settings_sanitize_misc_accounting' );
320
+add_filter('wpinv_settings_misc-accounting_sanitize', 'wpinv_settings_sanitize_misc_accounting');
321 321
 
322
-function wpinv_settings_sanitize_tax_rates( $input ) {
323
-    if( ! wpinv_current_user_can_manage_invoicing() ) {
322
+function wpinv_settings_sanitize_tax_rates($input) {
323
+    if (!wpinv_current_user_can_manage_invoicing()) {
324 324
         return $input;
325 325
     }
326 326
 
327
-    $new_rates = !empty( $_POST['tax_rates'] ) ? array_values( $_POST['tax_rates'] ) : array();
327
+    $new_rates = !empty($_POST['tax_rates']) ? array_values($_POST['tax_rates']) : array();
328 328
 
329 329
     $tax_rates = array();
330 330
 
331
-    if ( !empty( $new_rates ) ) {
332
-        foreach ( $new_rates as $rate ) {
333
-            if ( isset( $rate['country'] ) && empty( $rate['country'] ) && empty( $rate['state'] ) ) {
331
+    if (!empty($new_rates)) {
332
+        foreach ($new_rates as $rate) {
333
+            if (isset($rate['country']) && empty($rate['country']) && empty($rate['state'])) {
334 334
                 continue;
335 335
             }
336 336
             
337
-            $rate['rate'] = wpinv_sanitize_amount( $rate['rate'], 4 );
337
+            $rate['rate'] = wpinv_sanitize_amount($rate['rate'], 4);
338 338
             
339 339
             $tax_rates[] = $rate;
340 340
         }
341 341
     }
342 342
 
343
-    update_option( 'wpinv_tax_rates', $tax_rates );
343
+    update_option('wpinv_tax_rates', $tax_rates);
344 344
 
345 345
     return $input;
346 346
 }
347
-add_filter( 'wpinv_settings_taxes-rates_sanitize', 'wpinv_settings_sanitize_tax_rates' );
347
+add_filter('wpinv_settings_taxes-rates_sanitize', 'wpinv_settings_sanitize_tax_rates');
348 348
 
349
-function wpinv_sanitize_text_field( $input ) {
350
-    return trim( $input );
349
+function wpinv_sanitize_text_field($input) {
350
+    return trim($input);
351 351
 }
352
-add_filter( 'wpinv_settings_sanitize_text', 'wpinv_sanitize_text_field' );
352
+add_filter('wpinv_settings_sanitize_text', 'wpinv_sanitize_text_field');
353 353
 
354 354
 function wpinv_get_settings_tabs() {
355 355
     $tabs             = array();
356
-    $tabs['general']  = __( 'General', 'invoicing' );
357
-    $tabs['gateways'] = __( 'Payment Gateways', 'invoicing' );
358
-    $tabs['taxes']    = __( 'Taxes', 'invoicing' );
359
-    $tabs['emails']   = __( 'Emails', 'invoicing' );
360
-    $tabs['privacy']  = __( 'Privacy', 'invoicing' );
361
-    $tabs['misc']     = __( 'Misc', 'invoicing' );
362
-    $tabs['tools']    = __( 'Tools', 'invoicing' );
363
-
364
-    return apply_filters( 'wpinv_settings_tabs', $tabs );
356
+    $tabs['general']  = __('General', 'invoicing');
357
+    $tabs['gateways'] = __('Payment Gateways', 'invoicing');
358
+    $tabs['taxes']    = __('Taxes', 'invoicing');
359
+    $tabs['emails']   = __('Emails', 'invoicing');
360
+    $tabs['privacy']  = __('Privacy', 'invoicing');
361
+    $tabs['misc']     = __('Misc', 'invoicing');
362
+    $tabs['tools']    = __('Tools', 'invoicing');
363
+
364
+    return apply_filters('wpinv_settings_tabs', $tabs);
365 365
 }
366 366
 
367
-function wpinv_get_settings_tab_sections( $tab = false ) {
367
+function wpinv_get_settings_tab_sections($tab = false) {
368 368
     $tabs     = false;
369 369
     $sections = wpinv_get_registered_settings_sections();
370 370
 
371
-    if( $tab && ! empty( $sections[ $tab ] ) ) {
372
-        $tabs = $sections[ $tab ];
373
-    } else if ( $tab ) {
371
+    if ($tab && !empty($sections[$tab])) {
372
+        $tabs = $sections[$tab];
373
+    } else if ($tab) {
374 374
         $tabs = false;
375 375
     }
376 376
 
@@ -380,143 +380,143 @@  discard block
 block discarded – undo
380 380
 function wpinv_get_registered_settings_sections() {
381 381
     static $sections = false;
382 382
 
383
-    if ( false !== $sections ) {
383
+    if (false !== $sections) {
384 384
         return $sections;
385 385
     }
386 386
 
387 387
     $sections = array(
388
-        'general' => apply_filters( 'wpinv_settings_sections_general', array(
389
-            'main' => __( 'General Settings', 'invoicing' ),
390
-            'currency_section' => __( 'Currency Settings', 'invoicing' ),
391
-            'labels' => __( 'Label Texts', 'invoicing' ),
392
-        ) ),
393
-        'gateways' => apply_filters( 'wpinv_settings_sections_gateways', array(
394
-            'main' => __( 'Gateway Settings', 'invoicing' ),
395
-        ) ),
396
-        'taxes' => apply_filters( 'wpinv_settings_sections_taxes', array(
397
-            'main' => __( 'Tax Settings', 'invoicing' ),
398
-            'rates' => __( 'Tax Rates', 'invoicing' ),
399
-        ) ),
400
-        'emails' => apply_filters( 'wpinv_settings_sections_emails', array(
401
-            'main' => __( 'Email Settings', 'invoicing' ),
402
-        ) ),
403
-        'privacy' => apply_filters( 'wpinv_settings_sections_privacy', array(
404
-            'main' => __( 'Privacy policy', 'invoicing' ),
405
-        ) ),
406
-        'misc' => apply_filters( 'wpinv_settings_sections_misc', array(
407
-            'main' => __( 'Miscellaneous', 'invoicing' ),
408
-            'fields' => __( 'Fields Settings', 'invoicing' ),
409
-            'custom-css' => __( 'Custom CSS', 'invoicing' ),
410
-        ) ),
411
-        'tools' => apply_filters( 'wpinv_settings_sections_tools', array(
412
-            'main' => __( 'Diagnostic Tools', 'invoicing' ),
413
-        ) ),
388
+        'general' => apply_filters('wpinv_settings_sections_general', array(
389
+            'main' => __('General Settings', 'invoicing'),
390
+            'currency_section' => __('Currency Settings', 'invoicing'),
391
+            'labels' => __('Label Texts', 'invoicing'),
392
+        )),
393
+        'gateways' => apply_filters('wpinv_settings_sections_gateways', array(
394
+            'main' => __('Gateway Settings', 'invoicing'),
395
+        )),
396
+        'taxes' => apply_filters('wpinv_settings_sections_taxes', array(
397
+            'main' => __('Tax Settings', 'invoicing'),
398
+            'rates' => __('Tax Rates', 'invoicing'),
399
+        )),
400
+        'emails' => apply_filters('wpinv_settings_sections_emails', array(
401
+            'main' => __('Email Settings', 'invoicing'),
402
+        )),
403
+        'privacy' => apply_filters('wpinv_settings_sections_privacy', array(
404
+            'main' => __('Privacy policy', 'invoicing'),
405
+        )),
406
+        'misc' => apply_filters('wpinv_settings_sections_misc', array(
407
+            'main' => __('Miscellaneous', 'invoicing'),
408
+            'fields' => __('Fields Settings', 'invoicing'),
409
+            'custom-css' => __('Custom CSS', 'invoicing'),
410
+        )),
411
+        'tools' => apply_filters('wpinv_settings_sections_tools', array(
412
+            'main' => __('Diagnostic Tools', 'invoicing'),
413
+        )),
414 414
     );
415 415
 
416
-    $sections = apply_filters( 'wpinv_settings_sections', $sections );
416
+    $sections = apply_filters('wpinv_settings_sections', $sections);
417 417
 
418 418
     return $sections;
419 419
 }
420 420
 
421
-function wpinv_get_pages( $with_slug = false, $default_label = NULL ) {
421
+function wpinv_get_pages($with_slug = false, $default_label = NULL) {
422 422
 	$pages_options = array();
423 423
 
424
-	if( $default_label !== NULL && $default_label !== false ) {
425
-		$pages_options = array( '' => $default_label ); // Blank option
424
+	if ($default_label !== NULL && $default_label !== false) {
425
+		$pages_options = array('' => $default_label); // Blank option
426 426
 	}
427 427
 
428 428
 	$pages = get_pages();
429
-	if ( $pages ) {
430
-		foreach ( $pages as $page ) {
429
+	if ($pages) {
430
+		foreach ($pages as $page) {
431 431
 			$title = $with_slug ? $page->post_title . ' (' . $page->post_name . ')' : $page->post_title;
432
-            $pages_options[ $page->ID ] = $title;
432
+            $pages_options[$page->ID] = $title;
433 433
 		}
434 434
 	}
435 435
 
436 436
 	return $pages_options;
437 437
 }
438 438
 
439
-function wpinv_header_callback( $args ) {
440
-	if ( !empty( $args['desc'] ) ) {
439
+function wpinv_header_callback($args) {
440
+	if (!empty($args['desc'])) {
441 441
         echo $args['desc'];
442 442
     }
443 443
 }
444 444
 
445
-function wpinv_hidden_callback( $args ) {
445
+function wpinv_hidden_callback($args) {
446 446
 	global $wpinv_options;
447 447
 
448
-	if ( isset( $args['set_value'] ) ) {
448
+	if (isset($args['set_value'])) {
449 449
 		$value = $args['set_value'];
450
-	} elseif ( isset( $wpinv_options[ $args['id'] ] ) ) {
451
-		$value = $wpinv_options[ $args['id'] ];
450
+	} elseif (isset($wpinv_options[$args['id']])) {
451
+		$value = $wpinv_options[$args['id']];
452 452
 	} else {
453
-		$value = isset( $args['std'] ) ? $args['std'] : '';
453
+		$value = isset($args['std']) ? $args['std'] : '';
454 454
 	}
455 455
 
456
-	if ( isset( $args['faux'] ) && true === $args['faux'] ) {
456
+	if (isset($args['faux']) && true === $args['faux']) {
457 457
 		$args['readonly'] = true;
458
-		$value = isset( $args['std'] ) ? $args['std'] : '';
458
+		$value = isset($args['std']) ? $args['std'] : '';
459 459
 		$name  = '';
460 460
 	} else {
461
-		$name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"';
461
+		$name = 'name="wpinv_settings[' . esc_attr($args['id']) . ']"';
462 462
 	}
463 463
 
464
-	$html = '<input type="hidden" id="wpinv_settings[' . wpinv_sanitize_key( $args['id'] ) . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '" />';
464
+	$html = '<input type="hidden" id="wpinv_settings[' . wpinv_sanitize_key($args['id']) . ']" ' . $name . ' value="' . esc_attr(stripslashes($value)) . '" />';
465 465
     
466 466
 	echo $html;
467 467
 }
468 468
 
469
-function wpinv_checkbox_callback( $args ) {
469
+function wpinv_checkbox_callback($args) {
470 470
 	global $wpinv_options;
471 471
     
472
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
472
+    $sanitize_id = wpinv_sanitize_key($args['id']);
473 473
 
474
-	if ( isset( $args['faux'] ) && true === $args['faux'] ) {
474
+	if (isset($args['faux']) && true === $args['faux']) {
475 475
 		$name = '';
476 476
 	} else {
477 477
 		$name = 'name="wpinv_settings[' . $sanitize_id . ']"';
478 478
 	}
479 479
 
480
-	$checked = isset( $wpinv_options[ $args['id'] ] ) ? checked( 1, $wpinv_options[ $args['id'] ], false ) : '';
480
+	$checked = isset($wpinv_options[$args['id']]) ? checked(1, $wpinv_options[$args['id']], false) : '';
481 481
 	$html = '<input type="checkbox" id="wpinv_settings[' . $sanitize_id . ']"' . $name . ' value="1" ' . $checked . '/>';
482
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
482
+	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
483 483
 
484 484
 	echo $html;
485 485
 }
486 486
 
487
-function wpinv_multicheck_callback( $args ) {
487
+function wpinv_multicheck_callback($args) {
488 488
 	global $wpinv_options;
489 489
 
490
-	$sanitize_id = wpinv_sanitize_key( $args['id'] );
491
-	$class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : '';
490
+	$sanitize_id = wpinv_sanitize_key($args['id']);
491
+	$class = !empty($args['class']) ? ' ' . esc_attr($args['class']) : '';
492 492
 
493
-	if ( ! empty( $args['options'] ) ) {
493
+	if (!empty($args['options'])) {
494 494
 		echo '<div class="wpi-mcheck-rows wpi-mcheck-' . $sanitize_id . $class . '">';
495
-        foreach( $args['options'] as $key => $option ):
496
-			$sanitize_key = wpinv_sanitize_key( $key );
497
-			if ( isset( $wpinv_options[$args['id']][$sanitize_key] ) ) { 
495
+        foreach ($args['options'] as $key => $option):
496
+			$sanitize_key = wpinv_sanitize_key($key);
497
+			if (isset($wpinv_options[$args['id']][$sanitize_key])) { 
498 498
 				$enabled = $sanitize_key;
499 499
 			} else { 
500 500
 				$enabled = NULL; 
501 501
 			}
502
-			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;';
503
-			echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . wp_kses_post( $option ) . '</label></div>';
502
+			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;';
503
+			echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . wp_kses_post($option) . '</label></div>';
504 504
 		endforeach;
505 505
 		echo '</div>';
506 506
 		echo '<p class="description">' . $args['desc'] . '</p>';
507 507
 	}
508 508
 }
509 509
 
510
-function wpinv_payment_icons_callback( $args ) {
510
+function wpinv_payment_icons_callback($args) {
511 511
 	global $wpinv_options;
512 512
     
513
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
513
+    $sanitize_id = wpinv_sanitize_key($args['id']);
514 514
 
515
-	if ( ! empty( $args['options'] ) ) {
516
-		foreach( $args['options'] as $key => $option ) {
517
-            $sanitize_key = wpinv_sanitize_key( $key );
515
+	if (!empty($args['options'])) {
516
+		foreach ($args['options'] as $key => $option) {
517
+            $sanitize_key = wpinv_sanitize_key($key);
518 518
             
519
-			if( isset( $wpinv_options[$args['id']][$key] ) ) {
519
+			if (isset($wpinv_options[$args['id']][$key])) {
520 520
 				$enabled = $option;
521 521
 			} else {
522 522
 				$enabled = NULL;
@@ -524,197 +524,197 @@  discard block
 block discarded – undo
524 524
 
525 525
 			echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" style="margin-right:10px;line-height:16px;height:16px;display:inline-block;">';
526 526
 
527
-				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;';
527
+				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;';
528 528
 
529
-				if ( wpinv_string_is_image_url( $key ) ) {
530
-					echo '<img class="payment-icon" src="' . esc_url( $key ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
529
+				if (wpinv_string_is_image_url($key)) {
530
+					echo '<img class="payment-icon" src="' . esc_url($key) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
531 531
 				} else {
532
-					$card = strtolower( str_replace( ' ', '', $option ) );
532
+					$card = strtolower(str_replace(' ', '', $option));
533 533
 
534
-					if ( has_filter( 'wpinv_accepted_payment_' . $card . '_image' ) ) {
535
-						$image = apply_filters( 'wpinv_accepted_payment_' . $card . '_image', '' );
534
+					if (has_filter('wpinv_accepted_payment_' . $card . '_image')) {
535
+						$image = apply_filters('wpinv_accepted_payment_' . $card . '_image', '');
536 536
 					} else {
537
-						$image       = wpinv_locate_template( 'images' . DIRECTORY_SEPARATOR . 'icons' . DIRECTORY_SEPARATOR . $card . '.gif', false );
537
+						$image       = wpinv_locate_template('images' . DIRECTORY_SEPARATOR . 'icons' . DIRECTORY_SEPARATOR . $card . '.gif', false);
538 538
 						$content_dir = WP_CONTENT_DIR;
539 539
 
540
-						if ( function_exists( 'wp_normalize_path' ) ) {
540
+						if (function_exists('wp_normalize_path')) {
541 541
 							// Replaces backslashes with forward slashes for Windows systems
542
-							$image = wp_normalize_path( $image );
543
-							$content_dir = wp_normalize_path( $content_dir );
542
+							$image = wp_normalize_path($image);
543
+							$content_dir = wp_normalize_path($content_dir);
544 544
 						}
545 545
 
546
-						$image = str_replace( $content_dir, content_url(), $image );
546
+						$image = str_replace($content_dir, content_url(), $image);
547 547
 					}
548 548
 
549
-					echo '<img class="payment-icon" src="' . esc_url( $image ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
549
+					echo '<img class="payment-icon" src="' . esc_url($image) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
550 550
 				}
551 551
 			echo $option . '</label>';
552 552
 		}
553
-		echo '<p class="description" style="margin-top:16px;">' . wp_kses_post( $args['desc'] ) . '</p>';
553
+		echo '<p class="description" style="margin-top:16px;">' . wp_kses_post($args['desc']) . '</p>';
554 554
 	}
555 555
 }
556 556
 
557
-function wpinv_radio_callback( $args ) {
557
+function wpinv_radio_callback($args) {
558 558
 	global $wpinv_options;
559 559
     
560
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
560
+    $sanitize_id = wpinv_sanitize_key($args['id']);
561 561
     
562
-    foreach ( $args['options'] as $key => $option ) :
563
-		$sanitize_key = wpinv_sanitize_key( $key );
562
+    foreach ($args['options'] as $key => $option) :
563
+		$sanitize_key = wpinv_sanitize_key($key);
564 564
         
565 565
         $checked = false;
566 566
 
567
-		if ( isset( $wpinv_options[ $args['id'] ] ) && $wpinv_options[ $args['id'] ] == $key )
567
+		if (isset($wpinv_options[$args['id']]) && $wpinv_options[$args['id']] == $key)
568 568
 			$checked = true;
569
-		elseif( isset( $args['std'] ) && $args['std'] == $key && ! isset( $wpinv_options[ $args['id'] ] ) )
569
+		elseif (isset($args['std']) && $args['std'] == $key && !isset($wpinv_options[$args['id']]))
570 570
 			$checked = true;
571 571
 
572 572
 		echo '<input name="wpinv_settings[' . $sanitize_id . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="radio" value="' . $sanitize_key . '" ' . checked(true, $checked, false) . '/>&nbsp;';
573
-		echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html( $option ) . '</label><br/>';
573
+		echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html($option) . '</label><br/>';
574 574
 	endforeach;
575 575
 
576
-	echo '<p class="description">' . wp_kses_post( $args['desc'] ) . '</p>';
576
+	echo '<p class="description">' . wp_kses_post($args['desc']) . '</p>';
577 577
 }
578 578
 
579
-function wpinv_gateways_callback( $args ) {
579
+function wpinv_gateways_callback($args) {
580 580
 	global $wpinv_options;
581 581
     
582
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
582
+    $sanitize_id = wpinv_sanitize_key($args['id']);
583 583
 
584
-	foreach ( $args['options'] as $key => $option ) :
585
-		$sanitize_key = wpinv_sanitize_key( $key );
584
+	foreach ($args['options'] as $key => $option) :
585
+		$sanitize_key = wpinv_sanitize_key($key);
586 586
         
587
-        if ( isset( $wpinv_options['gateways'][ $key ] ) )
587
+        if (isset($wpinv_options['gateways'][$key]))
588 588
 			$enabled = '1';
589 589
 		else
590 590
 			$enabled = null;
591 591
 
592
-		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;';
593
-		echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html( $option['admin_label'] ) . '</label><br/>';
592
+		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;';
593
+		echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html($option['admin_label']) . '</label><br/>';
594 594
 	endforeach;
595 595
 }
596 596
 
597 597
 function wpinv_gateway_select_callback($args) {
598 598
 	global $wpinv_options;
599 599
     
600
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
601
-    $class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : '';
600
+    $sanitize_id = wpinv_sanitize_key($args['id']);
601
+    $class = !empty($args['class']) ? ' ' . esc_attr($args['class']) : '';
602 602
 
603
-	echo '<select name="wpinv_settings[' . $sanitize_id . ']"" id="wpinv_settings[' . $sanitize_id . ']" class="'.$class.'" >';
603
+	echo '<select name="wpinv_settings[' . $sanitize_id . ']"" id="wpinv_settings[' . $sanitize_id . ']" class="' . $class . '" >';
604 604
 
605
-	foreach ( $args['options'] as $key => $option ) :
606
-		if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) {
607
-            $selected = selected( $key, $args['selected'], false );
605
+	foreach ($args['options'] as $key => $option) :
606
+		if (isset($args['selected']) && $args['selected'] !== null && $args['selected'] !== false) {
607
+            $selected = selected($key, $args['selected'], false);
608 608
         } else {
609
-            $selected = isset( $wpinv_options[ $args['id'] ] ) ? selected( $key, $wpinv_options[$args['id']], false ) : '';
609
+            $selected = isset($wpinv_options[$args['id']]) ? selected($key, $wpinv_options[$args['id']], false) : '';
610 610
         }
611
-		echo '<option value="' . wpinv_sanitize_key( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>';
611
+		echo '<option value="' . wpinv_sanitize_key($key) . '"' . $selected . '>' . esc_html($option['admin_label']) . '</option>';
612 612
 	endforeach;
613 613
 
614 614
 	echo '</select>';
615
-	echo '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
615
+	echo '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
616 616
 }
617 617
 
618
-function wpinv_text_callback( $args ) {
618
+function wpinv_text_callback($args) {
619 619
 	global $wpinv_options;
620 620
     
621
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
621
+    $sanitize_id = wpinv_sanitize_key($args['id']);
622 622
 
623
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
624
-		$value = $wpinv_options[ $args['id'] ];
623
+	if (isset($wpinv_options[$args['id']])) {
624
+		$value = $wpinv_options[$args['id']];
625 625
 	} else {
626
-		$value = isset( $args['std'] ) ? $args['std'] : '';
626
+		$value = isset($args['std']) ? $args['std'] : '';
627 627
 	}
628 628
 
629
-	if ( isset( $args['faux'] ) && true === $args['faux'] ) {
629
+	if (isset($args['faux']) && true === $args['faux']) {
630 630
 		$args['readonly'] = true;
631
-		$value = isset( $args['std'] ) ? $args['std'] : '';
631
+		$value = isset($args['std']) ? $args['std'] : '';
632 632
 		$name  = '';
633 633
 	} else {
634
-		$name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"';
634
+		$name = 'name="wpinv_settings[' . esc_attr($args['id']) . ']"';
635 635
 	}
636
-	$class = !empty( $args['class'] ) ? sanitize_html_class( $args['class'] ) : '';
636
+	$class = !empty($args['class']) ? sanitize_html_class($args['class']) : '';
637 637
 
638 638
 	$readonly = $args['readonly'] === true ? ' readonly="readonly"' : '';
639
-	$size     = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
640
-	$html     = '<input type="text" class="' . sanitize_html_class( $size ) . '-text ' . $class . '" id="wpinv_settings[' . $sanitize_id . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '"' . $readonly . '/>';
641
-	$html    .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
639
+	$size     = (isset($args['size']) && !is_null($args['size'])) ? $args['size'] : 'regular';
640
+	$html     = '<input type="text" class="' . sanitize_html_class($size) . '-text ' . $class . '" id="wpinv_settings[' . $sanitize_id . ']" ' . $name . ' value="' . esc_attr(stripslashes($value)) . '"' . $readonly . '/>';
641
+	$html    .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
642 642
 
643 643
 	echo $html;
644 644
 }
645 645
 
646
-function wpinv_number_callback( $args ) {
646
+function wpinv_number_callback($args) {
647 647
 	global $wpinv_options;
648 648
     
649
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
649
+    $sanitize_id = wpinv_sanitize_key($args['id']);
650 650
 
651
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
652
-		$value = $wpinv_options[ $args['id'] ];
651
+	if (isset($wpinv_options[$args['id']])) {
652
+		$value = $wpinv_options[$args['id']];
653 653
 	} else {
654
-		$value = isset( $args['std'] ) ? $args['std'] : '';
654
+		$value = isset($args['std']) ? $args['std'] : '';
655 655
 	}
656 656
 
657
-	if ( isset( $args['faux'] ) && true === $args['faux'] ) {
657
+	if (isset($args['faux']) && true === $args['faux']) {
658 658
 		$args['readonly'] = true;
659
-		$value = isset( $args['std'] ) ? $args['std'] : '';
659
+		$value = isset($args['std']) ? $args['std'] : '';
660 660
 		$name  = '';
661 661
 	} else {
662
-		$name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"';
662
+		$name = 'name="wpinv_settings[' . esc_attr($args['id']) . ']"';
663 663
 	}
664 664
 
665
-	$max  = isset( $args['max'] ) ? $args['max'] : 999999;
666
-	$min  = isset( $args['min'] ) ? $args['min'] : 0;
667
-	$step = isset( $args['step'] ) ? $args['step'] : 1;
668
-	$class = !empty( $args['class'] ) ? sanitize_html_class( $args['class'] ) : '';
665
+	$max  = isset($args['max']) ? $args['max'] : 999999;
666
+	$min  = isset($args['min']) ? $args['min'] : 0;
667
+	$step = isset($args['step']) ? $args['step'] : 1;
668
+	$class = !empty($args['class']) ? sanitize_html_class($args['class']) : '';
669 669
 
670
-	$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
671
-	$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 ) ) . '"/>';
672
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
670
+	$size = (isset($args['size']) && !is_null($args['size'])) ? $args['size'] : 'regular';
671
+	$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)) . '"/>';
672
+	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
673 673
 
674 674
 	echo $html;
675 675
 }
676 676
 
677
-function wpinv_textarea_callback( $args ) {
677
+function wpinv_textarea_callback($args) {
678 678
 	global $wpinv_options;
679 679
     
680
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
680
+    $sanitize_id = wpinv_sanitize_key($args['id']);
681 681
 
682
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
683
-		$value = $wpinv_options[ $args['id'] ];
682
+	if (isset($wpinv_options[$args['id']])) {
683
+		$value = $wpinv_options[$args['id']];
684 684
 	} else {
685
-		$value = isset( $args['std'] ) ? $args['std'] : '';
685
+		$value = isset($args['std']) ? $args['std'] : '';
686 686
 	}
687 687
     
688
-    $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
689
-    $class = ( isset( $args['class'] ) && ! is_null( $args['class'] ) ) ? $args['class'] : 'large-text';
688
+    $size = (isset($args['size']) && !is_null($args['size'])) ? $args['size'] : 'regular';
689
+    $class = (isset($args['class']) && !is_null($args['class'])) ? $args['class'] : 'large-text';
690 690
 
691
-	$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>';
692
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
691
+	$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>';
692
+	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
693 693
 
694 694
 	echo $html;
695 695
 }
696 696
 
697
-function wpinv_password_callback( $args ) {
697
+function wpinv_password_callback($args) {
698 698
 	global $wpinv_options;
699 699
     
700
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
700
+    $sanitize_id = wpinv_sanitize_key($args['id']);
701 701
 
702
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
703
-		$value = $wpinv_options[ $args['id'] ];
702
+	if (isset($wpinv_options[$args['id']])) {
703
+		$value = $wpinv_options[$args['id']];
704 704
 	} else {
705
-		$value = isset( $args['std'] ) ? $args['std'] : '';
705
+		$value = isset($args['std']) ? $args['std'] : '';
706 706
 	}
707 707
 
708
-	$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
709
-	$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 ) . '"/>';
710
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
708
+	$size = (isset($args['size']) && !is_null($args['size'])) ? $args['size'] : 'regular';
709
+	$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) . '"/>';
710
+	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
711 711
 
712 712
 	echo $html;
713 713
 }
714 714
 
715 715
 function wpinv_missing_callback($args) {
716 716
 	printf(
717
-		__( 'The callback function used for the %s setting is missing.', 'invoicing' ),
717
+		__('The callback function used for the %s setting is missing.', 'invoicing'),
718 718
 		'<strong>' . $args['id'] . '</strong>'
719 719
 	);
720 720
 }
@@ -722,133 +722,133 @@  discard block
 block discarded – undo
722 722
 function wpinv_select_callback($args) {
723 723
 	global $wpinv_options;
724 724
     
725
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
725
+    $sanitize_id = wpinv_sanitize_key($args['id']);
726 726
 
727
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
728
-		$value = $wpinv_options[ $args['id'] ];
727
+	if (isset($wpinv_options[$args['id']])) {
728
+		$value = $wpinv_options[$args['id']];
729 729
 	} else {
730
-		$value = isset( $args['std'] ) ? $args['std'] : '';
730
+		$value = isset($args['std']) ? $args['std'] : '';
731 731
 	}
732 732
     
733
-    if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) {
733
+    if (isset($args['selected']) && $args['selected'] !== null && $args['selected'] !== false) {
734 734
         $value = $args['selected'];
735 735
     }
736 736
 
737
-	if ( isset( $args['placeholder'] ) ) {
737
+	if (isset($args['placeholder'])) {
738 738
 		$placeholder = $args['placeholder'];
739 739
 	} else {
740 740
 		$placeholder = '';
741 741
 	}
742 742
     
743
-    if( !empty( $args['onchange'] ) ) {
744
-        $onchange = ' onchange="' . esc_attr( $args['onchange'] ) . '"';
743
+    if (!empty($args['onchange'])) {
744
+        $onchange = ' onchange="' . esc_attr($args['onchange']) . '"';
745 745
     } else {
746 746
         $onchange = '';
747 747
     }
748 748
 
749
-    $class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : '';
749
+    $class = !empty($args['class']) ? ' ' . esc_attr($args['class']) : '';
750 750
 
751
-	$html = '<select id="wpinv_settings[' . $sanitize_id . ']" class="'.$class.'"  name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" data-placeholder="' . esc_html( $placeholder ) . '"' . $onchange . ' />';
751
+	$html = '<select id="wpinv_settings[' . $sanitize_id . ']" class="' . $class . '"  name="wpinv_settings[' . esc_attr($args['id']) . ']" data-placeholder="' . esc_html($placeholder) . '"' . $onchange . ' />';
752 752
 
753
-	foreach ( $args['options'] as $option => $name ) {
754
-		$selected = selected( $option, $value, false );
755
-		$html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>';
753
+	foreach ($args['options'] as $option => $name) {
754
+		$selected = selected($option, $value, false);
755
+		$html .= '<option value="' . esc_attr($option) . '" ' . $selected . '>' . esc_html($name) . '</option>';
756 756
 	}
757 757
 
758 758
 	$html .= '</select>';
759
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
759
+	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
760 760
 
761 761
 	echo $html;
762 762
 }
763 763
 
764
-function wpinv_color_select_callback( $args ) {
764
+function wpinv_color_select_callback($args) {
765 765
 	global $wpinv_options;
766 766
     
767
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
767
+    $sanitize_id = wpinv_sanitize_key($args['id']);
768 768
 
769
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
770
-		$value = $wpinv_options[ $args['id'] ];
769
+	if (isset($wpinv_options[$args['id']])) {
770
+		$value = $wpinv_options[$args['id']];
771 771
 	} else {
772
-		$value = isset( $args['std'] ) ? $args['std'] : '';
772
+		$value = isset($args['std']) ? $args['std'] : '';
773 773
 	}
774 774
 
775
-	$html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"/>';
775
+	$html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr($args['id']) . ']"/>';
776 776
 
777
-	foreach ( $args['options'] as $option => $color ) {
778
-		$selected = selected( $option, $value, false );
779
-		$html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $color['label'] ) . '</option>';
777
+	foreach ($args['options'] as $option => $color) {
778
+		$selected = selected($option, $value, false);
779
+		$html .= '<option value="' . esc_attr($option) . '" ' . $selected . '>' . esc_html($color['label']) . '</option>';
780 780
 	}
781 781
 
782 782
 	$html .= '</select>';
783
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
783
+	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
784 784
 
785 785
 	echo $html;
786 786
 }
787 787
 
788
-function wpinv_rich_editor_callback( $args ) {
788
+function wpinv_rich_editor_callback($args) {
789 789
 	global $wpinv_options, $wp_version;
790 790
     
791
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
791
+    $sanitize_id = wpinv_sanitize_key($args['id']);
792 792
 
793
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
794
-		$value = $wpinv_options[ $args['id'] ];
793
+	if (isset($wpinv_options[$args['id']])) {
794
+		$value = $wpinv_options[$args['id']];
795 795
 
796
-		if( empty( $args['allow_blank'] ) && empty( $value ) ) {
797
-			$value = isset( $args['std'] ) ? $args['std'] : '';
796
+		if (empty($args['allow_blank']) && empty($value)) {
797
+			$value = isset($args['std']) ? $args['std'] : '';
798 798
 		}
799 799
 	} else {
800
-		$value = isset( $args['std'] ) ? $args['std'] : '';
800
+		$value = isset($args['std']) ? $args['std'] : '';
801 801
 	}
802 802
 
803
-	$rows = isset( $args['size'] ) ? $args['size'] : 20;
803
+	$rows = isset($args['size']) ? $args['size'] : 20;
804 804
 
805
-	if ( $wp_version >= 3.3 && function_exists( 'wp_editor' ) ) {
805
+	if ($wp_version >= 3.3 && function_exists('wp_editor')) {
806 806
 		ob_start();
807
-		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 ) );
807
+		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));
808 808
 		$html = ob_get_clean();
809 809
 	} else {
810
-		$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>';
810
+		$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>';
811 811
 	}
812 812
 
813
-	$html .= '<br/><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
813
+	$html .= '<br/><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
814 814
 
815 815
 	echo $html;
816 816
 }
817 817
 
818
-function wpinv_upload_callback( $args ) {
818
+function wpinv_upload_callback($args) {
819 819
 	global $wpinv_options;
820 820
     
821
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
821
+    $sanitize_id = wpinv_sanitize_key($args['id']);
822 822
 
823
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
823
+	if (isset($wpinv_options[$args['id']])) {
824 824
 		$value = $wpinv_options[$args['id']];
825 825
 	} else {
826 826
 		$value = isset($args['std']) ? $args['std'] : '';
827 827
 	}
828 828
 
829
-	$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
830
-	$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 ) ) . '"/>';
831
-	$html .= '<span>&nbsp;<input type="button" class="wpinv_settings_upload_button button-secondary" value="' . __( 'Upload File', 'invoicing' ) . '"/></span>';
832
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
829
+	$size = (isset($args['size']) && !is_null($args['size'])) ? $args['size'] : 'regular';
830
+	$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)) . '"/>';
831
+	$html .= '<span>&nbsp;<input type="button" class="wpinv_settings_upload_button button-secondary" value="' . __('Upload File', 'invoicing') . '"/></span>';
832
+	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
833 833
 
834 834
 	echo $html;
835 835
 }
836 836
 
837
-function wpinv_color_callback( $args ) {
837
+function wpinv_color_callback($args) {
838 838
 	global $wpinv_options;
839 839
     
840
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
840
+    $sanitize_id = wpinv_sanitize_key($args['id']);
841 841
 
842
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
843
-		$value = $wpinv_options[ $args['id'] ];
842
+	if (isset($wpinv_options[$args['id']])) {
843
+		$value = $wpinv_options[$args['id']];
844 844
 	} else {
845
-		$value = isset( $args['std'] ) ? $args['std'] : '';
845
+		$value = isset($args['std']) ? $args['std'] : '';
846 846
 	}
847 847
 
848
-	$default = isset( $args['std'] ) ? $args['std'] : '';
848
+	$default = isset($args['std']) ? $args['std'] : '';
849 849
 
850
-	$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 ) . '" />';
851
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
850
+	$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) . '" />';
851
+	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
852 852
 
853 853
 	echo $html;
854 854
 }
@@ -856,9 +856,9 @@  discard block
 block discarded – undo
856 856
 function wpinv_country_states_callback($args) {
857 857
 	global $wpinv_options;
858 858
     
859
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
859
+    $sanitize_id = wpinv_sanitize_key($args['id']);
860 860
 
861
-	if ( isset( $args['placeholder'] ) ) {
861
+	if (isset($args['placeholder'])) {
862 862
 		$placeholder = $args['placeholder'];
863 863
 	} else {
864 864
 		$placeholder = '';
@@ -866,16 +866,16 @@  discard block
 block discarded – undo
866 866
 
867 867
 	$states = wpinv_get_country_states();
868 868
 
869
-	$class = empty( $states ) ? ' class="wpinv-no-states"' : ' class="wpi_select2"';
870
-	$html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"' . $class . 'data-placeholder="' . esc_html( $placeholder ) . '"/>';
869
+	$class = empty($states) ? ' class="wpinv-no-states"' : ' class="wpi_select2"';
870
+	$html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr($args['id']) . ']"' . $class . 'data-placeholder="' . esc_html($placeholder) . '"/>';
871 871
 
872
-	foreach ( $states as $option => $name ) {
873
-		$selected = isset( $wpinv_options[ $args['id'] ] ) ? selected( $option, $wpinv_options[$args['id']], false ) : '';
874
-		$html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>';
872
+	foreach ($states as $option => $name) {
873
+		$selected = isset($wpinv_options[$args['id']]) ? selected($option, $wpinv_options[$args['id']], false) : '';
874
+		$html .= '<option value="' . esc_attr($option) . '" ' . $selected . '>' . esc_html($name) . '</option>';
875 875
 	}
876 876
 
877 877
 	$html .= '</select>';
878
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
878
+	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
879 879
 
880 880
 	echo $html;
881 881
 }
@@ -890,96 +890,96 @@  discard block
 block discarded – undo
890 890
 	<table id="wpinv_tax_rates" class="wp-list-table widefat fixed posts">
891 891
 		<thead>
892 892
 			<tr>
893
-				<th scope="col" class="wpinv_tax_country"><?php _e( 'Country', 'invoicing' ); ?></th>
894
-				<th scope="col" class="wpinv_tax_state"><?php _e( 'State / Province', 'invoicing' ); ?></th>
895
-                <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>
896
-                <th scope="col" class="wpinv_tax_rate"><?php _e( 'Rate %', 'invoicing' ); ?></th> 
897
-                <th scope="col" class="wpinv_tax_name"><?php _e( 'Tax Name', 'invoicing' ); ?></th>
898
-				<th scope="col" class="wpinv_tax_action"><?php _e( 'Remove', 'invoicing' ); ?></th>
893
+				<th scope="col" class="wpinv_tax_country"><?php _e('Country', 'invoicing'); ?></th>
894
+				<th scope="col" class="wpinv_tax_state"><?php _e('State / Province', 'invoicing'); ?></th>
895
+                <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>
896
+                <th scope="col" class="wpinv_tax_rate"><?php _e('Rate %', 'invoicing'); ?></th> 
897
+                <th scope="col" class="wpinv_tax_name"><?php _e('Tax Name', 'invoicing'); ?></th>
898
+				<th scope="col" class="wpinv_tax_action"><?php _e('Remove', 'invoicing'); ?></th>
899 899
 			</tr>
900 900
 		</thead>
901 901
         <tbody>
902
-		<?php if( !empty( $rates ) ) : ?>
903
-			<?php foreach( $rates as $key => $rate ) : ?>
902
+		<?php if (!empty($rates)) : ?>
903
+			<?php foreach ($rates as $key => $rate) : ?>
904 904
             <?php 
905
-            $sanitized_key = wpinv_sanitize_key( $key );
905
+            $sanitized_key = wpinv_sanitize_key($key);
906 906
             ?>
907 907
 			<tr>
908 908
 				<td class="wpinv_tax_country">
909 909
 					<?php
910
-					echo wpinv_html_select( array(
911
-						'options'          => wpinv_get_country_list( true ),
910
+					echo wpinv_html_select(array(
911
+						'options'          => wpinv_get_country_list(true),
912 912
 						'name'             => 'tax_rates[' . $sanitized_key . '][country]',
913 913
                         'id'               => 'tax_rates[' . $sanitized_key . '][country]',
914 914
 						'selected'         => $rate['country'],
915 915
 						'show_option_all'  => false,
916 916
 						'show_option_none' => false,
917 917
 						'class'            => 'wpinv-tax-country wpi_select2',
918
-						'placeholder'      => __( 'Choose a country', 'invoicing' )
919
-					) );
918
+						'placeholder'      => __('Choose a country', 'invoicing')
919
+					));
920 920
 					?>
921 921
 				</td>
922 922
 				<td class="wpinv_tax_state">
923 923
 					<?php
924
-					$states = wpinv_get_country_states( $rate['country'] );
925
-					if( !empty( $states ) ) {
926
-						echo wpinv_html_select( array(
927
-							'options'          => array_merge( array( '' => '' ), $states ),
924
+					$states = wpinv_get_country_states($rate['country']);
925
+					if (!empty($states)) {
926
+						echo wpinv_html_select(array(
927
+							'options'          => array_merge(array('' => ''), $states),
928 928
 							'name'             => 'tax_rates[' . $sanitized_key . '][state]',
929 929
                             'id'               => 'tax_rates[' . $sanitized_key . '][state]',
930 930
 							'selected'         => $rate['state'],
931 931
 							'show_option_all'  => false,
932 932
 							'show_option_none' => false,
933 933
                             'class'            => 'wpi_select2',
934
-							'placeholder'      => __( 'Choose a state', 'invoicing' )
935
-						) );
934
+							'placeholder'      => __('Choose a state', 'invoicing')
935
+						));
936 936
 					} else {
937
-						echo wpinv_html_text( array(
937
+						echo wpinv_html_text(array(
938 938
 							'name'  => 'tax_rates[' . $sanitized_key . '][state]', $rate['state'],
939
-							'value' => ! empty( $rate['state'] ) ? $rate['state'] : '',
939
+							'value' => !empty($rate['state']) ? $rate['state'] : '',
940 940
                             'id'    => 'tax_rates[' . $sanitized_key . '][state]',
941
-						) );
941
+						));
942 942
 					}
943 943
 					?>
944 944
 				</td>
945 945
 				<td class="wpinv_tax_global">
946
-					<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'] ) ); ?>/>
947
-					<label for="tax_rates[<?php echo $sanitized_key; ?>][global]"><?php _e( 'Apply to whole country', 'invoicing' ); ?></label>
946
+					<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'])); ?>/>
947
+					<label for="tax_rates[<?php echo $sanitized_key; ?>][global]"><?php _e('Apply to whole country', 'invoicing'); ?></label>
948 948
 				</td>
949
-				<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>
950
-                <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>
951
-				<td class="wpinv_tax_action"><span class="wpinv_remove_tax_rate button-secondary"><?php _e( 'Remove Rate', 'invoicing' ); ?></span></td>
949
+				<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>
950
+                <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>
951
+				<td class="wpinv_tax_action"><span class="wpinv_remove_tax_rate button-secondary"><?php _e('Remove Rate', 'invoicing'); ?></span></td>
952 952
 			</tr>
953 953
 			<?php endforeach; ?>
954 954
 		<?php else : ?>
955 955
 			<tr>
956 956
 				<td class="wpinv_tax_country">
957 957
 					<?php
958
-					echo wpinv_html_select( array(
959
-						'options'          => wpinv_get_country_list( true ),
958
+					echo wpinv_html_select(array(
959
+						'options'          => wpinv_get_country_list(true),
960 960
 						'name'             => 'tax_rates[0][country]',
961 961
 						'show_option_all'  => false,
962 962
 						'show_option_none' => false,
963 963
 						'class'            => 'wpinv-tax-country wpi_select2',
964
-						'placeholder'      => __( 'Choose a country', 'invoicing' )
965
-					) ); ?>
964
+						'placeholder'      => __('Choose a country', 'invoicing')
965
+					)); ?>
966 966
 				</td>
967 967
 				<td class="wpinv_tax_state">
968
-					<?php echo wpinv_html_text( array(
968
+					<?php echo wpinv_html_text(array(
969 969
 						'name' => 'tax_rates[0][state]'
970
-					) ); ?>
970
+					)); ?>
971 971
 				</td>
972 972
 				<td class="wpinv_tax_global">
973 973
 					<input type="checkbox" name="tax_rates[0][global]" id="tax_rates[0][global]" value="1"/>
974
-					<label for="tax_rates[0][global]"><?php _e( 'Apply to whole country', 'invoicing' ); ?></label>
974
+					<label for="tax_rates[0][global]"><?php _e('Apply to whole country', 'invoicing'); ?></label>
975 975
 				</td>
976
-				<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>
976
+				<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>
977 977
                 <td class="wpinv_tax_name"><input type="text" class="regular-text" name="tax_rates[0][name]" /></td>
978
-				<td><span class="wpinv_remove_tax_rate button-secondary"><?php _e( 'Remove Rate', 'invoicing' ); ?></span></td>
978
+				<td><span class="wpinv_remove_tax_rate button-secondary"><?php _e('Remove Rate', 'invoicing'); ?></span></td>
979 979
 			</tr>
980 980
 		<?php endif; ?>
981 981
         </tbody>
982
-        <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>
982
+        <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>
983 983
 	</table>
984 984
 	<?php
985 985
 	echo ob_get_clean();
@@ -990,76 +990,76 @@  discard block
 block discarded – undo
990 990
     ob_start(); ?>
991 991
     </td><tr>
992 992
     <td colspan="2" class="wpinv_tools_tdbox">
993
-    <?php if ( $args['desc'] ) { ?><p><?php echo $args['desc']; ?></p><?php } ?>
994
-    <?php do_action( 'wpinv_tools_before' ); ?>
993
+    <?php if ($args['desc']) { ?><p><?php echo $args['desc']; ?></p><?php } ?>
994
+    <?php do_action('wpinv_tools_before'); ?>
995 995
     <table id="wpinv_tools_table" class="wp-list-table widefat fixed posts">
996 996
         <thead>
997 997
             <tr>
998
-                <th scope="col" class="wpinv-th-tool"><?php _e( 'Tool', 'invoicing' ); ?></th>
999
-                <th scope="col" class="wpinv-th-desc"><?php _e( 'Description', 'invoicing' ); ?></th>
1000
-                <th scope="col" class="wpinv-th-action"><?php _e( 'Action', 'invoicing' ); ?></th>
998
+                <th scope="col" class="wpinv-th-tool"><?php _e('Tool', 'invoicing'); ?></th>
999
+                <th scope="col" class="wpinv-th-desc"><?php _e('Description', 'invoicing'); ?></th>
1000
+                <th scope="col" class="wpinv-th-action"><?php _e('Action', 'invoicing'); ?></th>
1001 1001
             </tr>
1002 1002
         </thead>
1003
-            <?php do_action( 'wpinv_tools_row' ); ?>
1003
+            <?php do_action('wpinv_tools_row'); ?>
1004 1004
         <tbody>
1005 1005
         </tbody>
1006 1006
     </table>
1007
-    <?php do_action( 'wpinv_tools_after' ); ?>
1007
+    <?php do_action('wpinv_tools_after'); ?>
1008 1008
     <?php
1009 1009
     echo ob_get_clean();
1010 1010
 }
1011 1011
 
1012
-function wpinv_descriptive_text_callback( $args ) {
1013
-	echo wp_kses_post( $args['desc'] );
1012
+function wpinv_descriptive_text_callback($args) {
1013
+	echo wp_kses_post($args['desc']);
1014 1014
 }
1015 1015
 
1016
-function wpinv_hook_callback( $args ) {
1017
-	do_action( 'wpinv_' . $args['id'], $args );
1016
+function wpinv_hook_callback($args) {
1017
+	do_action('wpinv_' . $args['id'], $args);
1018 1018
 }
1019 1019
 
1020 1020
 function wpinv_set_settings_cap() {
1021 1021
 	return wpinv_get_capability();
1022 1022
 }
1023
-add_filter( 'option_page_capability_wpinv_settings', 'wpinv_set_settings_cap' );
1023
+add_filter('option_page_capability_wpinv_settings', 'wpinv_set_settings_cap');
1024 1024
 
1025
-function wpinv_settings_sanitize_input( $value, $key ) {
1026
-    if ( $key == 'tax_rate' || $key == 'eu_fallback_rate' ) {
1027
-        $value = wpinv_sanitize_amount( $value, 4 );
1025
+function wpinv_settings_sanitize_input($value, $key) {
1026
+    if ($key == 'tax_rate' || $key == 'eu_fallback_rate') {
1027
+        $value = wpinv_sanitize_amount($value, 4);
1028 1028
         $value = $value >= 100 ? 99 : $value;
1029 1029
     }
1030 1030
         
1031 1031
     return $value;
1032 1032
 }
1033
-add_filter( 'wpinv_settings_sanitize', 'wpinv_settings_sanitize_input', 10, 2 );
1033
+add_filter('wpinv_settings_sanitize', 'wpinv_settings_sanitize_input', 10, 2);
1034 1034
 
1035
-function wpinv_on_update_settings( $old_value, $value, $option ) {
1036
-    $old = !empty( $old_value['remove_data_on_unistall'] ) ? 1 : '';
1037
-    $new = !empty( $value['remove_data_on_unistall'] ) ? 1 : '';
1035
+function wpinv_on_update_settings($old_value, $value, $option) {
1036
+    $old = !empty($old_value['remove_data_on_unistall']) ? 1 : '';
1037
+    $new = !empty($value['remove_data_on_unistall']) ? 1 : '';
1038 1038
     
1039
-    if ( $old != $new ) {
1040
-        update_option( 'wpinv_remove_data_on_invoice_unistall', $new );
1039
+    if ($old != $new) {
1040
+        update_option('wpinv_remove_data_on_invoice_unistall', $new);
1041 1041
     }
1042 1042
 }
1043
-add_action( 'update_option_wpinv_settings', 'wpinv_on_update_settings', 10, 3 );
1044
-add_action( 'wpinv_settings_tab_bottom_emails_new_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2 );
1045
-add_action( 'wpinv_settings_tab_bottom_emails_cancelled_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2 );
1046
-add_action( 'wpinv_settings_tab_bottom_emails_failed_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2 );
1047
-add_action( 'wpinv_settings_tab_bottom_emails_onhold_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2 );
1048
-add_action( 'wpinv_settings_tab_bottom_emails_processing_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2 );
1049
-add_action( 'wpinv_settings_tab_bottom_emails_completed_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2 );
1050
-add_action( 'wpinv_settings_tab_bottom_emails_refunded_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2 );
1051
-add_action( 'wpinv_settings_tab_bottom_emails_user_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2 );
1052
-add_action( 'wpinv_settings_tab_bottom_emails_user_note', 'wpinv_settings_tab_bottom_emails', 10, 2 );
1053
-add_action( 'wpinv_settings_tab_bottom_emails_overdue', 'wpinv_settings_tab_bottom_emails', 10, 2 );
1054
-
1055
-function wpinv_settings_tab_bottom_emails( $active_tab, $section ) {
1043
+add_action('update_option_wpinv_settings', 'wpinv_on_update_settings', 10, 3);
1044
+add_action('wpinv_settings_tab_bottom_emails_new_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2);
1045
+add_action('wpinv_settings_tab_bottom_emails_cancelled_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2);
1046
+add_action('wpinv_settings_tab_bottom_emails_failed_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2);
1047
+add_action('wpinv_settings_tab_bottom_emails_onhold_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2);
1048
+add_action('wpinv_settings_tab_bottom_emails_processing_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2);
1049
+add_action('wpinv_settings_tab_bottom_emails_completed_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2);
1050
+add_action('wpinv_settings_tab_bottom_emails_refunded_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2);
1051
+add_action('wpinv_settings_tab_bottom_emails_user_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2);
1052
+add_action('wpinv_settings_tab_bottom_emails_user_note', 'wpinv_settings_tab_bottom_emails', 10, 2);
1053
+add_action('wpinv_settings_tab_bottom_emails_overdue', 'wpinv_settings_tab_bottom_emails', 10, 2);
1054
+
1055
+function wpinv_settings_tab_bottom_emails($active_tab, $section) {
1056 1056
     ?>
1057 1057
     <div class="wpinv-email-wc-row ">
1058 1058
         <div class="wpinv-email-wc-td">
1059
-            <h3 class="wpinv-email-wc-title"><?php echo apply_filters( 'wpinv_settings_email_wildcards_title', __( 'Wildcards For Emails', 'invoicing' ) ); ?></h3>
1059
+            <h3 class="wpinv-email-wc-title"><?php echo apply_filters('wpinv_settings_email_wildcards_title', __('Wildcards For Emails', 'invoicing')); ?></h3>
1060 1060
             <p class="wpinv-email-wc-description">
1061 1061
                 <?php
1062
-                $description = __( 'The following wildcards can be used in email subjects, heading and content:<br>
1062
+                $description = __('The following wildcards can be used in email subjects, heading and content:<br>
1063 1063
                     <strong>{site_title} :</strong> Site Title<br>
1064 1064
                     <strong>{name} :</strong> Customer\'s full name<br>
1065 1065
                     <strong>{first_name} :</strong> Customer\'s first name<br>
@@ -1073,7 +1073,7 @@  discard block
 block discarded – undo
1073 1073
                     <strong>{invoice_due_date} :</strong> The date the invoice is due<br>
1074 1074
                     <strong>{date} :</strong> Today\'s date.<br>
1075 1075
                     <strong>{is_was} :</strong> If due date of invoice is past, displays "was" otherwise displays "is"<br>
1076
-                    <strong>{invoice_label} :</strong> Invoices/quotes singular name. Ex: Invoice/Quote<br>', 'invoicing' );
1076
+                    <strong>{invoice_label} :</strong> Invoices/quotes singular name. Ex: Invoice/Quote<br>', 'invoicing');
1077 1077
                 echo apply_filters('wpinv_settings_email_wildcards_description', $description, $active_tab, $section);
1078 1078
                 ?>
1079 1079
             </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.