Completed
Push — master ( 71be48...b0d50b )
by Stiofan
12s
created
includes/admin/register-settings.php 1 patch
Indentation   +336 added lines, -336 removed lines patch added patch discarded remove patch
@@ -831,328 +831,328 @@  discard block
 block discarded – undo
831 831
 }
832 832
 
833 833
 function wpinv_get_pages( $with_slug = false, $default_label = NULL ) {
834
-	$pages_options = array();
834
+    $pages_options = array();
835 835
 
836
-	if( $default_label !== NULL && $default_label !== false ) {
837
-		$pages_options = array( '' => $default_label ); // Blank option
838
-	}
836
+    if( $default_label !== NULL && $default_label !== false ) {
837
+        $pages_options = array( '' => $default_label ); // Blank option
838
+    }
839 839
 
840
-	$pages = get_pages();
841
-	if ( $pages ) {
842
-		foreach ( $pages as $page ) {
843
-			$title = $with_slug ? $page->post_title . ' (' . $page->post_name . ')' : $page->post_title;
840
+    $pages = get_pages();
841
+    if ( $pages ) {
842
+        foreach ( $pages as $page ) {
843
+            $title = $with_slug ? $page->post_title . ' (' . $page->post_name . ')' : $page->post_title;
844 844
             $pages_options[ $page->ID ] = $title;
845
-		}
846
-	}
845
+        }
846
+    }
847 847
 
848
-	return $pages_options;
848
+    return $pages_options;
849 849
 }
850 850
 
851 851
 function wpinv_header_callback( $args ) {
852
-	if ( !empty( $args['desc'] ) ) {
852
+    if ( !empty( $args['desc'] ) ) {
853 853
         echo $args['desc'];
854 854
     }
855 855
 }
856 856
 
857 857
 function wpinv_hidden_callback( $args ) {
858
-	global $wpinv_options;
859
-
860
-	if ( isset( $args['set_value'] ) ) {
861
-		$value = $args['set_value'];
862
-	} elseif ( isset( $wpinv_options[ $args['id'] ] ) ) {
863
-		$value = $wpinv_options[ $args['id'] ];
864
-	} else {
865
-		$value = isset( $args['std'] ) ? $args['std'] : '';
866
-	}
867
-
868
-	if ( isset( $args['faux'] ) && true === $args['faux'] ) {
869
-		$args['readonly'] = true;
870
-		$value = isset( $args['std'] ) ? $args['std'] : '';
871
-		$name  = '';
872
-	} else {
873
-		$name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"';
874
-	}
875
-
876
-	$html = '<input type="hidden" id="wpinv_settings[' . wpinv_sanitize_key( $args['id'] ) . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '" />';
858
+    global $wpinv_options;
859
+
860
+    if ( isset( $args['set_value'] ) ) {
861
+        $value = $args['set_value'];
862
+    } elseif ( isset( $wpinv_options[ $args['id'] ] ) ) {
863
+        $value = $wpinv_options[ $args['id'] ];
864
+    } else {
865
+        $value = isset( $args['std'] ) ? $args['std'] : '';
866
+    }
867
+
868
+    if ( isset( $args['faux'] ) && true === $args['faux'] ) {
869
+        $args['readonly'] = true;
870
+        $value = isset( $args['std'] ) ? $args['std'] : '';
871
+        $name  = '';
872
+    } else {
873
+        $name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"';
874
+    }
875
+
876
+    $html = '<input type="hidden" id="wpinv_settings[' . wpinv_sanitize_key( $args['id'] ) . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '" />';
877 877
     
878
-	echo $html;
878
+    echo $html;
879 879
 }
880 880
 
881 881
 function wpinv_checkbox_callback( $args ) {
882
-	global $wpinv_options;
882
+    global $wpinv_options;
883 883
     
884 884
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
885 885
 
886
-	if ( isset( $args['faux'] ) && true === $args['faux'] ) {
887
-		$name = '';
888
-	} else {
889
-		$name = 'name="wpinv_settings[' . $sanitize_id . ']"';
890
-	}
886
+    if ( isset( $args['faux'] ) && true === $args['faux'] ) {
887
+        $name = '';
888
+    } else {
889
+        $name = 'name="wpinv_settings[' . $sanitize_id . ']"';
890
+    }
891 891
 
892
-	$checked = isset( $wpinv_options[ $args['id'] ] ) ? checked( 1, $wpinv_options[ $args['id'] ], false ) : '';
893
-	$html = '<input type="checkbox" id="wpinv_settings[' . $sanitize_id . ']"' . $name . ' value="1" ' . $checked . '/>';
894
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
892
+    $checked = isset( $wpinv_options[ $args['id'] ] ) ? checked( 1, $wpinv_options[ $args['id'] ], false ) : '';
893
+    $html = '<input type="checkbox" id="wpinv_settings[' . $sanitize_id . ']"' . $name . ' value="1" ' . $checked . '/>';
894
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
895 895
 
896
-	echo $html;
896
+    echo $html;
897 897
 }
898 898
 
899 899
 function wpinv_multicheck_callback( $args ) {
900
-	global $wpinv_options;
900
+    global $wpinv_options;
901 901
 	
902
-	$sanitize_id = wpinv_sanitize_key( $args['id'] );
902
+    $sanitize_id = wpinv_sanitize_key( $args['id'] );
903 903
 	
904
-	if ( ! empty( $args['options'] ) ) {
905
-		foreach( $args['options'] as $key => $option ):
906
-			$sanitize_key = wpinv_sanitize_key( $key );
907
-			if ( isset( $wpinv_options[$args['id']][$sanitize_key] ) ) { 
908
-				$enabled = $sanitize_key;
909
-			} else { 
910
-				$enabled = NULL; 
911
-			}
912
-			echo '<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;';
913
-			echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . wp_kses_post( $option ) . '</label><br/>';
914
-		endforeach;
915
-		echo '<p class="description">' . $args['desc'] . '</p>';
916
-	}
904
+    if ( ! empty( $args['options'] ) ) {
905
+        foreach( $args['options'] as $key => $option ):
906
+            $sanitize_key = wpinv_sanitize_key( $key );
907
+            if ( isset( $wpinv_options[$args['id']][$sanitize_key] ) ) { 
908
+                $enabled = $sanitize_key;
909
+            } else { 
910
+                $enabled = NULL; 
911
+            }
912
+            echo '<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;';
913
+            echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . wp_kses_post( $option ) . '</label><br/>';
914
+        endforeach;
915
+        echo '<p class="description">' . $args['desc'] . '</p>';
916
+    }
917 917
 }
918 918
 
919 919
 function wpinv_payment_icons_callback( $args ) {
920
-	global $wpinv_options;
920
+    global $wpinv_options;
921 921
     
922 922
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
923 923
 
924
-	if ( ! empty( $args['options'] ) ) {
925
-		foreach( $args['options'] as $key => $option ) {
924
+    if ( ! empty( $args['options'] ) ) {
925
+        foreach( $args['options'] as $key => $option ) {
926 926
             $sanitize_key = wpinv_sanitize_key( $key );
927 927
             
928
-			if( isset( $wpinv_options[$args['id']][$key] ) ) {
929
-				$enabled = $option;
930
-			} else {
931
-				$enabled = NULL;
932
-			}
933
-
934
-			echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" style="margin-right:10px;line-height:16px;height:16px;display:inline-block;">';
935
-
936
-				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;';
937
-
938
-				if ( wpinv_string_is_image_url( $key ) ) {
939
-					echo '<img class="payment-icon" src="' . esc_url( $key ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
940
-				} else {
941
-					$card = strtolower( str_replace( ' ', '', $option ) );
942
-
943
-					if ( has_filter( 'wpinv_accepted_payment_' . $card . '_image' ) ) {
944
-						$image = apply_filters( 'wpinv_accepted_payment_' . $card . '_image', '' );
945
-					} else {
946
-						$image       = wpinv_locate_template( 'images' . DIRECTORY_SEPARATOR . 'icons' . DIRECTORY_SEPARATOR . $card . '.gif', false );
947
-						$content_dir = WP_CONTENT_DIR;
948
-
949
-						if ( function_exists( 'wp_normalize_path' ) ) {
950
-							// Replaces backslashes with forward slashes for Windows systems
951
-							$image = wp_normalize_path( $image );
952
-							$content_dir = wp_normalize_path( $content_dir );
953
-						}
954
-
955
-						$image = str_replace( $content_dir, content_url(), $image );
956
-					}
957
-
958
-					echo '<img class="payment-icon" src="' . esc_url( $image ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
959
-				}
960
-			echo $option . '</label>';
961
-		}
962
-		echo '<p class="description" style="margin-top:16px;">' . wp_kses_post( $args['desc'] ) . '</p>';
963
-	}
928
+            if( isset( $wpinv_options[$args['id']][$key] ) ) {
929
+                $enabled = $option;
930
+            } else {
931
+                $enabled = NULL;
932
+            }
933
+
934
+            echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" style="margin-right:10px;line-height:16px;height:16px;display:inline-block;">';
935
+
936
+                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;';
937
+
938
+                if ( wpinv_string_is_image_url( $key ) ) {
939
+                    echo '<img class="payment-icon" src="' . esc_url( $key ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
940
+                } else {
941
+                    $card = strtolower( str_replace( ' ', '', $option ) );
942
+
943
+                    if ( has_filter( 'wpinv_accepted_payment_' . $card . '_image' ) ) {
944
+                        $image = apply_filters( 'wpinv_accepted_payment_' . $card . '_image', '' );
945
+                    } else {
946
+                        $image       = wpinv_locate_template( 'images' . DIRECTORY_SEPARATOR . 'icons' . DIRECTORY_SEPARATOR . $card . '.gif', false );
947
+                        $content_dir = WP_CONTENT_DIR;
948
+
949
+                        if ( function_exists( 'wp_normalize_path' ) ) {
950
+                            // Replaces backslashes with forward slashes for Windows systems
951
+                            $image = wp_normalize_path( $image );
952
+                            $content_dir = wp_normalize_path( $content_dir );
953
+                        }
954
+
955
+                        $image = str_replace( $content_dir, content_url(), $image );
956
+                    }
957
+
958
+                    echo '<img class="payment-icon" src="' . esc_url( $image ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
959
+                }
960
+            echo $option . '</label>';
961
+        }
962
+        echo '<p class="description" style="margin-top:16px;">' . wp_kses_post( $args['desc'] ) . '</p>';
963
+    }
964 964
 }
965 965
 
966 966
 function wpinv_radio_callback( $args ) {
967
-	global $wpinv_options;
967
+    global $wpinv_options;
968 968
     
969 969
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
970 970
     
971 971
     foreach ( $args['options'] as $key => $option ) :
972
-		$sanitize_key = wpinv_sanitize_key( $key );
972
+        $sanitize_key = wpinv_sanitize_key( $key );
973 973
         
974 974
         $checked = false;
975 975
 
976
-		if ( isset( $wpinv_options[ $args['id'] ] ) && $wpinv_options[ $args['id'] ] == $key )
977
-			$checked = true;
978
-		elseif( isset( $args['std'] ) && $args['std'] == $key && ! isset( $wpinv_options[ $args['id'] ] ) )
979
-			$checked = true;
976
+        if ( isset( $wpinv_options[ $args['id'] ] ) && $wpinv_options[ $args['id'] ] == $key )
977
+            $checked = true;
978
+        elseif( isset( $args['std'] ) && $args['std'] == $key && ! isset( $wpinv_options[ $args['id'] ] ) )
979
+            $checked = true;
980 980
 
981
-		echo '<input name="wpinv_settings[' . $sanitize_id . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="radio" value="' . $sanitize_key . '" ' . checked(true, $checked, false) . '/>&nbsp;';
982
-		echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html( $option ) . '</label><br/>';
983
-	endforeach;
981
+        echo '<input name="wpinv_settings[' . $sanitize_id . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="radio" value="' . $sanitize_key . '" ' . checked(true, $checked, false) . '/>&nbsp;';
982
+        echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html( $option ) . '</label><br/>';
983
+    endforeach;
984 984
 
985
-	echo '<p class="description">' . wp_kses_post( $args['desc'] ) . '</p>';
985
+    echo '<p class="description">' . wp_kses_post( $args['desc'] ) . '</p>';
986 986
 }
987 987
 
988 988
 function wpinv_gateways_callback( $args ) {
989
-	global $wpinv_options;
989
+    global $wpinv_options;
990 990
     
991 991
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
992 992
 
993
-	foreach ( $args['options'] as $key => $option ) :
994
-		$sanitize_key = wpinv_sanitize_key( $key );
993
+    foreach ( $args['options'] as $key => $option ) :
994
+        $sanitize_key = wpinv_sanitize_key( $key );
995 995
         
996 996
         if ( isset( $wpinv_options['gateways'][ $key ] ) )
997
-			$enabled = '1';
998
-		else
999
-			$enabled = null;
997
+            $enabled = '1';
998
+        else
999
+            $enabled = null;
1000 1000
 
1001
-		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;';
1002
-		echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html( $option['admin_label'] ) . '</label><br/>';
1003
-	endforeach;
1001
+        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;';
1002
+        echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html( $option['admin_label'] ) . '</label><br/>';
1003
+    endforeach;
1004 1004
 }
1005 1005
 
1006 1006
 function wpinv_gateway_select_callback($args) {
1007
-	global $wpinv_options;
1007
+    global $wpinv_options;
1008 1008
     
1009 1009
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
1010 1010
 
1011
-	echo '<select name="wpinv_settings[' . $sanitize_id . ']"" id="wpinv_settings[' . $sanitize_id . ']">';
1011
+    echo '<select name="wpinv_settings[' . $sanitize_id . ']"" id="wpinv_settings[' . $sanitize_id . ']">';
1012 1012
 
1013
-	foreach ( $args['options'] as $key => $option ) :
1014
-		if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) {
1013
+    foreach ( $args['options'] as $key => $option ) :
1014
+        if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) {
1015 1015
             $selected = selected( $key, $args['selected'], false );
1016 1016
         } else {
1017 1017
             $selected = isset( $wpinv_options[ $args['id'] ] ) ? selected( $key, $wpinv_options[$args['id']], false ) : '';
1018 1018
         }
1019
-		echo '<option value="' . wpinv_sanitize_key( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>';
1020
-	endforeach;
1019
+        echo '<option value="' . wpinv_sanitize_key( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>';
1020
+    endforeach;
1021 1021
 
1022
-	echo '</select>';
1023
-	echo '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1022
+    echo '</select>';
1023
+    echo '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1024 1024
 }
1025 1025
 
1026 1026
 function wpinv_text_callback( $args ) {
1027
-	global $wpinv_options;
1027
+    global $wpinv_options;
1028 1028
     
1029 1029
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
1030 1030
 
1031
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1032
-		$value = $wpinv_options[ $args['id'] ];
1033
-	} else {
1034
-		$value = isset( $args['std'] ) ? $args['std'] : '';
1035
-	}
1036
-
1037
-	if ( isset( $args['faux'] ) && true === $args['faux'] ) {
1038
-		$args['readonly'] = true;
1039
-		$value = isset( $args['std'] ) ? $args['std'] : '';
1040
-		$name  = '';
1041
-	} else {
1042
-		$name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"';
1043
-	}
1044
-	$class = !empty( $args['class'] ) ? sanitize_html_class( $args['class'] ) : '';
1045
-
1046
-	$readonly = $args['readonly'] === true ? ' readonly="readonly"' : '';
1047
-	$size     = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
1048
-	$html     = '<input type="text" class="' . sanitize_html_class( $size ) . '-text ' . $class . '" id="wpinv_settings[' . $sanitize_id . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '"' . $readonly . '/>';
1049
-	$html    .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1050
-
1051
-	echo $html;
1031
+    if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1032
+        $value = $wpinv_options[ $args['id'] ];
1033
+    } else {
1034
+        $value = isset( $args['std'] ) ? $args['std'] : '';
1035
+    }
1036
+
1037
+    if ( isset( $args['faux'] ) && true === $args['faux'] ) {
1038
+        $args['readonly'] = true;
1039
+        $value = isset( $args['std'] ) ? $args['std'] : '';
1040
+        $name  = '';
1041
+    } else {
1042
+        $name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"';
1043
+    }
1044
+    $class = !empty( $args['class'] ) ? sanitize_html_class( $args['class'] ) : '';
1045
+
1046
+    $readonly = $args['readonly'] === true ? ' readonly="readonly"' : '';
1047
+    $size     = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
1048
+    $html     = '<input type="text" class="' . sanitize_html_class( $size ) . '-text ' . $class . '" id="wpinv_settings[' . $sanitize_id . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '"' . $readonly . '/>';
1049
+    $html    .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1050
+
1051
+    echo $html;
1052 1052
 }
1053 1053
 
1054 1054
 function wpinv_number_callback( $args ) {
1055
-	global $wpinv_options;
1055
+    global $wpinv_options;
1056 1056
     
1057 1057
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
1058 1058
 
1059
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1060
-		$value = $wpinv_options[ $args['id'] ];
1061
-	} else {
1062
-		$value = isset( $args['std'] ) ? $args['std'] : '';
1063
-	}
1064
-
1065
-	if ( isset( $args['faux'] ) && true === $args['faux'] ) {
1066
-		$args['readonly'] = true;
1067
-		$value = isset( $args['std'] ) ? $args['std'] : '';
1068
-		$name  = '';
1069
-	} else {
1070
-		$name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"';
1071
-	}
1072
-
1073
-	$max  = isset( $args['max'] ) ? $args['max'] : 999999;
1074
-	$min  = isset( $args['min'] ) ? $args['min'] : 0;
1075
-	$step = isset( $args['step'] ) ? $args['step'] : 1;
1076
-	$class = !empty( $args['class'] ) ? sanitize_html_class( $args['class'] ) : '';
1077
-
1078
-	$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
1079
-	$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 ) ) . '"/>';
1080
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1081
-
1082
-	echo $html;
1059
+    if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1060
+        $value = $wpinv_options[ $args['id'] ];
1061
+    } else {
1062
+        $value = isset( $args['std'] ) ? $args['std'] : '';
1063
+    }
1064
+
1065
+    if ( isset( $args['faux'] ) && true === $args['faux'] ) {
1066
+        $args['readonly'] = true;
1067
+        $value = isset( $args['std'] ) ? $args['std'] : '';
1068
+        $name  = '';
1069
+    } else {
1070
+        $name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"';
1071
+    }
1072
+
1073
+    $max  = isset( $args['max'] ) ? $args['max'] : 999999;
1074
+    $min  = isset( $args['min'] ) ? $args['min'] : 0;
1075
+    $step = isset( $args['step'] ) ? $args['step'] : 1;
1076
+    $class = !empty( $args['class'] ) ? sanitize_html_class( $args['class'] ) : '';
1077
+
1078
+    $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
1079
+    $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 ) ) . '"/>';
1080
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1081
+
1082
+    echo $html;
1083 1083
 }
1084 1084
 
1085 1085
 function wpinv_textarea_callback( $args ) {
1086
-	global $wpinv_options;
1086
+    global $wpinv_options;
1087 1087
     
1088 1088
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
1089 1089
 
1090
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1091
-		$value = $wpinv_options[ $args['id'] ];
1092
-	} else {
1093
-		$value = isset( $args['std'] ) ? $args['std'] : '';
1094
-	}
1090
+    if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1091
+        $value = $wpinv_options[ $args['id'] ];
1092
+    } else {
1093
+        $value = isset( $args['std'] ) ? $args['std'] : '';
1094
+    }
1095 1095
     
1096 1096
     $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
1097 1097
     $class = ( isset( $args['class'] ) && ! is_null( $args['class'] ) ) ? $args['class'] : 'large-text';
1098 1098
 
1099
-	$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>';
1100
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1099
+    $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>';
1100
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1101 1101
 
1102
-	echo $html;
1102
+    echo $html;
1103 1103
 }
1104 1104
 
1105 1105
 function wpinv_password_callback( $args ) {
1106
-	global $wpinv_options;
1106
+    global $wpinv_options;
1107 1107
     
1108 1108
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
1109 1109
 
1110
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1111
-		$value = $wpinv_options[ $args['id'] ];
1112
-	} else {
1113
-		$value = isset( $args['std'] ) ? $args['std'] : '';
1114
-	}
1110
+    if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1111
+        $value = $wpinv_options[ $args['id'] ];
1112
+    } else {
1113
+        $value = isset( $args['std'] ) ? $args['std'] : '';
1114
+    }
1115 1115
 
1116
-	$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
1117
-	$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 ) . '"/>';
1118
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
1116
+    $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
1117
+    $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 ) . '"/>';
1118
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
1119 1119
 
1120
-	echo $html;
1120
+    echo $html;
1121 1121
 }
1122 1122
 
1123 1123
 function wpinv_missing_callback($args) {
1124
-	printf(
1125
-		__( 'The callback function used for the %s setting is missing.', 'invoicing' ),
1126
-		'<strong>' . $args['id'] . '</strong>'
1127
-	);
1124
+    printf(
1125
+        __( 'The callback function used for the %s setting is missing.', 'invoicing' ),
1126
+        '<strong>' . $args['id'] . '</strong>'
1127
+    );
1128 1128
 }
1129 1129
 
1130 1130
 function wpinv_select_callback($args) {
1131
-	global $wpinv_options;
1131
+    global $wpinv_options;
1132 1132
     
1133 1133
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
1134 1134
 
1135
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1136
-		$value = $wpinv_options[ $args['id'] ];
1137
-	} else {
1138
-		$value = isset( $args['std'] ) ? $args['std'] : '';
1139
-	}
1135
+    if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1136
+        $value = $wpinv_options[ $args['id'] ];
1137
+    } else {
1138
+        $value = isset( $args['std'] ) ? $args['std'] : '';
1139
+    }
1140 1140
     
1141 1141
     if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) {
1142 1142
         $value = $args['selected'];
1143 1143
     }
1144 1144
 
1145
-	if ( isset( $args['placeholder'] ) ) {
1146
-		$placeholder = $args['placeholder'];
1147
-	} else {
1148
-		$placeholder = '';
1149
-	}
1150
-
1151
-	if ( isset( $args['chosen'] ) ) {
1152
-		$chosen = 'class="wpinv-chosen"';
1153
-	} else {
1154
-		$chosen = '';
1155
-	}
1145
+    if ( isset( $args['placeholder'] ) ) {
1146
+        $placeholder = $args['placeholder'];
1147
+    } else {
1148
+        $placeholder = '';
1149
+    }
1150
+
1151
+    if ( isset( $args['chosen'] ) ) {
1152
+        $chosen = 'class="wpinv-chosen"';
1153
+    } else {
1154
+        $chosen = '';
1155
+    }
1156 1156
     
1157 1157
     if( !empty( $args['onchange'] ) ) {
1158 1158
         $onchange = ' onchange="' . esc_attr( $args['onchange'] ) . '"';
@@ -1160,143 +1160,143 @@  discard block
 block discarded – undo
1160 1160
         $onchange = '';
1161 1161
     }
1162 1162
 
1163
-	$html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" ' . $chosen . 'data-placeholder="' . esc_html( $placeholder ) . '"' . $onchange . ' />';
1163
+    $html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" ' . $chosen . 'data-placeholder="' . esc_html( $placeholder ) . '"' . $onchange . ' />';
1164 1164
 
1165
-	foreach ( $args['options'] as $option => $name ) {
1166
-		$selected = selected( $option, $value, false );
1167
-		$html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>';
1168
-	}
1165
+    foreach ( $args['options'] as $option => $name ) {
1166
+        $selected = selected( $option, $value, false );
1167
+        $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>';
1168
+    }
1169 1169
 
1170
-	$html .= '</select>';
1171
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
1170
+    $html .= '</select>';
1171
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
1172 1172
 
1173
-	echo $html;
1173
+    echo $html;
1174 1174
 }
1175 1175
 
1176 1176
 function wpinv_color_select_callback( $args ) {
1177
-	global $wpinv_options;
1177
+    global $wpinv_options;
1178 1178
     
1179 1179
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
1180 1180
 
1181
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1182
-		$value = $wpinv_options[ $args['id'] ];
1183
-	} else {
1184
-		$value = isset( $args['std'] ) ? $args['std'] : '';
1185
-	}
1181
+    if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1182
+        $value = $wpinv_options[ $args['id'] ];
1183
+    } else {
1184
+        $value = isset( $args['std'] ) ? $args['std'] : '';
1185
+    }
1186 1186
 
1187
-	$html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"/>';
1187
+    $html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"/>';
1188 1188
 
1189
-	foreach ( $args['options'] as $option => $color ) {
1190
-		$selected = selected( $option, $value, false );
1191
-		$html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $color['label'] ) . '</option>';
1192
-	}
1189
+    foreach ( $args['options'] as $option => $color ) {
1190
+        $selected = selected( $option, $value, false );
1191
+        $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $color['label'] ) . '</option>';
1192
+    }
1193 1193
 
1194
-	$html .= '</select>';
1195
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1194
+    $html .= '</select>';
1195
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1196 1196
 
1197
-	echo $html;
1197
+    echo $html;
1198 1198
 }
1199 1199
 
1200 1200
 function wpinv_rich_editor_callback( $args ) {
1201
-	global $wpinv_options, $wp_version;
1201
+    global $wpinv_options, $wp_version;
1202 1202
     
1203 1203
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
1204 1204
 
1205
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1206
-		$value = $wpinv_options[ $args['id'] ];
1205
+    if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1206
+        $value = $wpinv_options[ $args['id'] ];
1207 1207
 
1208
-		if( empty( $args['allow_blank'] ) && empty( $value ) ) {
1209
-			$value = isset( $args['std'] ) ? $args['std'] : '';
1210
-		}
1211
-	} else {
1212
-		$value = isset( $args['std'] ) ? $args['std'] : '';
1213
-	}
1208
+        if( empty( $args['allow_blank'] ) && empty( $value ) ) {
1209
+            $value = isset( $args['std'] ) ? $args['std'] : '';
1210
+        }
1211
+    } else {
1212
+        $value = isset( $args['std'] ) ? $args['std'] : '';
1213
+    }
1214 1214
 
1215
-	$rows = isset( $args['size'] ) ? $args['size'] : 20;
1215
+    $rows = isset( $args['size'] ) ? $args['size'] : 20;
1216 1216
 
1217
-	if ( $wp_version >= 3.3 && function_exists( 'wp_editor' ) ) {
1218
-		ob_start();
1219
-		wp_editor( stripslashes( $value ), 'wpinv_settings_' . esc_attr( $args['id'] ), array( 'textarea_name' => 'wpinv_settings[' . esc_attr( $args['id'] ) . ']', 'textarea_rows' => absint( $rows ) ) );
1220
-		$html = ob_get_clean();
1221
-	} else {
1222
-		$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>';
1223
-	}
1217
+    if ( $wp_version >= 3.3 && function_exists( 'wp_editor' ) ) {
1218
+        ob_start();
1219
+        wp_editor( stripslashes( $value ), 'wpinv_settings_' . esc_attr( $args['id'] ), array( 'textarea_name' => 'wpinv_settings[' . esc_attr( $args['id'] ) . ']', 'textarea_rows' => absint( $rows ) ) );
1220
+        $html = ob_get_clean();
1221
+    } else {
1222
+        $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>';
1223
+    }
1224 1224
 
1225
-	$html .= '<br/><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
1225
+    $html .= '<br/><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
1226 1226
 
1227
-	echo $html;
1227
+    echo $html;
1228 1228
 }
1229 1229
 
1230 1230
 function wpinv_upload_callback( $args ) {
1231
-	global $wpinv_options;
1231
+    global $wpinv_options;
1232 1232
     
1233 1233
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
1234 1234
 
1235
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1236
-		$value = $wpinv_options[$args['id']];
1237
-	} else {
1238
-		$value = isset($args['std']) ? $args['std'] : '';
1239
-	}
1235
+    if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1236
+        $value = $wpinv_options[$args['id']];
1237
+    } else {
1238
+        $value = isset($args['std']) ? $args['std'] : '';
1239
+    }
1240 1240
 
1241
-	$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
1242
-	$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 ) ) . '"/>';
1243
-	$html .= '<span>&nbsp;<input type="button" class="wpinv_settings_upload_button button-secondary" value="' . __( 'Upload File', 'invoicing' ) . '"/></span>';
1244
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
1241
+    $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
1242
+    $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 ) ) . '"/>';
1243
+    $html .= '<span>&nbsp;<input type="button" class="wpinv_settings_upload_button button-secondary" value="' . __( 'Upload File', 'invoicing' ) . '"/></span>';
1244
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
1245 1245
 
1246
-	echo $html;
1246
+    echo $html;
1247 1247
 }
1248 1248
 
1249 1249
 function wpinv_color_callback( $args ) {
1250
-	global $wpinv_options;
1250
+    global $wpinv_options;
1251 1251
     
1252 1252
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
1253 1253
 
1254
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1255
-		$value = $wpinv_options[ $args['id'] ];
1256
-	} else {
1257
-		$value = isset( $args['std'] ) ? $args['std'] : '';
1258
-	}
1254
+    if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1255
+        $value = $wpinv_options[ $args['id'] ];
1256
+    } else {
1257
+        $value = isset( $args['std'] ) ? $args['std'] : '';
1258
+    }
1259 1259
 
1260
-	$default = isset( $args['std'] ) ? $args['std'] : '';
1260
+    $default = isset( $args['std'] ) ? $args['std'] : '';
1261 1261
 
1262
-	$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 ) . '" />';
1263
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1262
+    $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 ) . '" />';
1263
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1264 1264
 
1265
-	echo $html;
1265
+    echo $html;
1266 1266
 }
1267 1267
 
1268 1268
 function wpinv_country_states_callback($args) {
1269
-	global $wpinv_options;
1269
+    global $wpinv_options;
1270 1270
     
1271 1271
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
1272 1272
 
1273
-	if ( isset( $args['placeholder'] ) ) {
1274
-		$placeholder = $args['placeholder'];
1275
-	} else {
1276
-		$placeholder = '';
1277
-	}
1273
+    if ( isset( $args['placeholder'] ) ) {
1274
+        $placeholder = $args['placeholder'];
1275
+    } else {
1276
+        $placeholder = '';
1277
+    }
1278 1278
 
1279
-	$states = wpinv_get_country_states();
1279
+    $states = wpinv_get_country_states();
1280 1280
 
1281
-	$chosen = ( $args['chosen'] ? ' wpinv-chosen' : '' );
1282
-	$class = empty( $states ) ? ' class="wpinv-no-states' . $chosen . '"' : 'class="' . $chosen . '"';
1283
-	$html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"' . $class . 'data-placeholder="' . esc_html( $placeholder ) . '"/>';
1281
+    $chosen = ( $args['chosen'] ? ' wpinv-chosen' : '' );
1282
+    $class = empty( $states ) ? ' class="wpinv-no-states' . $chosen . '"' : 'class="' . $chosen . '"';
1283
+    $html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"' . $class . 'data-placeholder="' . esc_html( $placeholder ) . '"/>';
1284 1284
 
1285
-	foreach ( $states as $option => $name ) {
1286
-		$selected = isset( $wpinv_options[ $args['id'] ] ) ? selected( $option, $wpinv_options[$args['id']], false ) : '';
1287
-		$html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>';
1288
-	}
1285
+    foreach ( $states as $option => $name ) {
1286
+        $selected = isset( $wpinv_options[ $args['id'] ] ) ? selected( $option, $wpinv_options[$args['id']], false ) : '';
1287
+        $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>';
1288
+    }
1289 1289
 
1290
-	$html .= '</select>';
1291
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1290
+    $html .= '</select>';
1291
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1292 1292
 
1293
-	echo $html;
1293
+    echo $html;
1294 1294
 }
1295 1295
 
1296 1296
 function wpinv_tax_rates_callback($args) {
1297
-	global $wpinv_options;
1298
-	$rates = wpinv_get_tax_rates();
1299
-	ob_start(); ?>
1297
+    global $wpinv_options;
1298
+    $rates = wpinv_get_tax_rates();
1299
+    ob_start(); ?>
1300 1300
     </td><tr>
1301 1301
     <td colspan="2" class="wpinv_tax_tdbox">
1302 1302
 	<p><?php echo $args['desc']; ?></p>
@@ -1320,41 +1320,41 @@  discard block
 block discarded – undo
1320 1320
 			<tr>
1321 1321
 				<td class="wpinv_tax_country">
1322 1322
 					<?php
1323
-					echo wpinv_html_select( array(
1324
-						'options'          => wpinv_get_country_list( true ),
1325
-						'name'             => 'tax_rates[' . $sanitized_key . '][country]',
1323
+                    echo wpinv_html_select( array(
1324
+                        'options'          => wpinv_get_country_list( true ),
1325
+                        'name'             => 'tax_rates[' . $sanitized_key . '][country]',
1326 1326
                         'id'               => 'tax_rates[' . $sanitized_key . '][country]',
1327
-						'selected'         => $rate['country'],
1328
-						'show_option_all'  => false,
1329
-						'show_option_none' => false,
1330
-						'class'            => 'wpinv-tax-country',
1331
-						'chosen'           => false,
1332
-						'placeholder'      => __( 'Choose a country', 'invoicing' )
1333
-					) );
1334
-					?>
1327
+                        'selected'         => $rate['country'],
1328
+                        'show_option_all'  => false,
1329
+                        'show_option_none' => false,
1330
+                        'class'            => 'wpinv-tax-country',
1331
+                        'chosen'           => false,
1332
+                        'placeholder'      => __( 'Choose a country', 'invoicing' )
1333
+                    ) );
1334
+                    ?>
1335 1335
 				</td>
1336 1336
 				<td class="wpinv_tax_state">
1337 1337
 					<?php
1338
-					$states = wpinv_get_country_states( $rate['country'] );
1339
-					if( !empty( $states ) ) {
1340
-						echo wpinv_html_select( array(
1341
-							'options'          => array_merge( array( '' => '' ), $states ),
1342
-							'name'             => 'tax_rates[' . $sanitized_key . '][state]',
1338
+                    $states = wpinv_get_country_states( $rate['country'] );
1339
+                    if( !empty( $states ) ) {
1340
+                        echo wpinv_html_select( array(
1341
+                            'options'          => array_merge( array( '' => '' ), $states ),
1342
+                            'name'             => 'tax_rates[' . $sanitized_key . '][state]',
1343 1343
                             'id'               => 'tax_rates[' . $sanitized_key . '][state]',
1344
-							'selected'         => $rate['state'],
1345
-							'show_option_all'  => false,
1346
-							'show_option_none' => false,
1347
-							'chosen'           => false,
1348
-							'placeholder'      => __( 'Choose a state', 'invoicing' )
1349
-						) );
1350
-					} else {
1351
-						echo wpinv_html_text( array(
1352
-							'name'  => 'tax_rates[' . $sanitized_key . '][state]', $rate['state'],
1353
-							'value' => ! empty( $rate['state'] ) ? $rate['state'] : '',
1344
+                            'selected'         => $rate['state'],
1345
+                            'show_option_all'  => false,
1346
+                            'show_option_none' => false,
1347
+                            'chosen'           => false,
1348
+                            'placeholder'      => __( 'Choose a state', 'invoicing' )
1349
+                        ) );
1350
+                    } else {
1351
+                        echo wpinv_html_text( array(
1352
+                            'name'  => 'tax_rates[' . $sanitized_key . '][state]', $rate['state'],
1353
+                            'value' => ! empty( $rate['state'] ) ? $rate['state'] : '',
1354 1354
                             'id'    => 'tax_rates[' . $sanitized_key . '][state]',
1355
-						) );
1356
-					}
1357
-					?>
1355
+                        ) );
1356
+                    }
1357
+                    ?>
1358 1358
 				</td>
1359 1359
 				<td class="wpinv_tax_global">
1360 1360
 					<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'] ) ); ?>/>
@@ -1369,20 +1369,20 @@  discard block
 block discarded – undo
1369 1369
 			<tr>
1370 1370
 				<td class="wpinv_tax_country">
1371 1371
 					<?php
1372
-					echo wpinv_html_select( array(
1373
-						'options'          => wpinv_get_country_list( true ),
1374
-						'name'             => 'tax_rates[0][country]',
1375
-						'show_option_all'  => false,
1376
-						'show_option_none' => false,
1377
-						'class'            => 'wpinv-tax-country',
1378
-						'chosen'           => false,
1379
-						'placeholder'      => __( 'Choose a country', 'invoicing' )
1380
-					) ); ?>
1372
+                    echo wpinv_html_select( array(
1373
+                        'options'          => wpinv_get_country_list( true ),
1374
+                        'name'             => 'tax_rates[0][country]',
1375
+                        'show_option_all'  => false,
1376
+                        'show_option_none' => false,
1377
+                        'class'            => 'wpinv-tax-country',
1378
+                        'chosen'           => false,
1379
+                        'placeholder'      => __( 'Choose a country', 'invoicing' )
1380
+                    ) ); ?>
1381 1381
 				</td>
1382 1382
 				<td class="wpinv_tax_state">
1383 1383
 					<?php echo wpinv_html_text( array(
1384
-						'name' => 'tax_rates[0][state]'
1385
-					) ); ?>
1384
+                        'name' => 'tax_rates[0][state]'
1385
+                    ) ); ?>
1386 1386
 				</td>
1387 1387
 				<td class="wpinv_tax_global">
1388 1388
 					<input type="checkbox" name="tax_rates[0][global]" id="tax_rates[0][global]" value="1"/>
@@ -1397,7 +1397,7 @@  discard block
 block discarded – undo
1397 1397
         <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>
1398 1398
 	</table>
1399 1399
 	<?php
1400
-	echo ob_get_clean();
1400
+    echo ob_get_clean();
1401 1401
 }
1402 1402
 
1403 1403
 function wpinv_tools_callback($args) {
@@ -1425,15 +1425,15 @@  discard block
 block discarded – undo
1425 1425
 }
1426 1426
 
1427 1427
 function wpinv_descriptive_text_callback( $args ) {
1428
-	echo wp_kses_post( $args['desc'] );
1428
+    echo wp_kses_post( $args['desc'] );
1429 1429
 }
1430 1430
 
1431 1431
 function wpinv_hook_callback( $args ) {
1432
-	do_action( 'wpinv_' . $args['id'], $args );
1432
+    do_action( 'wpinv_' . $args['id'], $args );
1433 1433
 }
1434 1434
 
1435 1435
 function wpinv_set_settings_cap() {
1436
-	return 'manage_options';
1436
+    return 'manage_options';
1437 1437
 }
1438 1438
 add_filter( 'option_page_capability_wpinv_settings', 'wpinv_set_settings_cap' );
1439 1439
 
Please login to merge, or discard this patch.
includes/admin/wpinv-admin-functions.php 1 patch
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -155,65 +155,65 @@  discard block
 block discarded – undo
155 155
 }
156 156
 
157 157
 function wpinv_admin_messages() {
158
-	global $wpinv_options, $pagenow, $post;
158
+    global $wpinv_options, $pagenow, $post;
159 159
 
160
-	if ( isset( $_GET['wpinv-message'] ) && 'discount_added' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) {
161
-		 add_settings_error( 'wpinv-notices', 'wpinv-discount-added', __( 'Discount code added.', 'invoicing' ), 'updated' );
162
-	}
160
+    if ( isset( $_GET['wpinv-message'] ) && 'discount_added' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) {
161
+            add_settings_error( 'wpinv-notices', 'wpinv-discount-added', __( 'Discount code added.', 'invoicing' ), 'updated' );
162
+    }
163 163
 
164
-	if ( isset( $_GET['wpinv-message'] ) && 'discount_add_failed' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) {
165
-		add_settings_error( 'wpinv-notices', 'wpinv-discount-add-fail', __( 'There was a problem adding your discount code, please try again.', 'invoicing' ), 'error' );
166
-	}
164
+    if ( isset( $_GET['wpinv-message'] ) && 'discount_add_failed' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) {
165
+        add_settings_error( 'wpinv-notices', 'wpinv-discount-add-fail', __( 'There was a problem adding your discount code, please try again.', 'invoicing' ), 'error' );
166
+    }
167 167
 
168
-	if ( isset( $_GET['wpinv-message'] ) && 'discount_exists' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) {
169
-		add_settings_error( 'wpinv-notices', 'wpinv-discount-exists', __( 'A discount with that code already exists, please use a different code.', 'invoicing' ), 'error' );
170
-	}
168
+    if ( isset( $_GET['wpinv-message'] ) && 'discount_exists' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) {
169
+        add_settings_error( 'wpinv-notices', 'wpinv-discount-exists', __( 'A discount with that code already exists, please use a different code.', 'invoicing' ), 'error' );
170
+    }
171 171
 
172
-	if ( isset( $_GET['wpinv-message'] ) && 'discount_updated' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) {
173
-		 add_settings_error( 'wpinv-notices', 'wpinv-discount-updated', __( 'Discount code updated.', 'invoicing' ), 'updated' );
174
-	}
172
+    if ( isset( $_GET['wpinv-message'] ) && 'discount_updated' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) {
173
+            add_settings_error( 'wpinv-notices', 'wpinv-discount-updated', __( 'Discount code updated.', 'invoicing' ), 'updated' );
174
+    }
175 175
 
176
-	if ( isset( $_GET['wpinv-message'] ) && 'discount_update_failed' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) {
177
-		add_settings_error( 'wpinv-notices', 'wpinv-discount-updated-fail', __( 'There was a problem updating your discount code, please try again.', 'invoicing' ), 'error' );
178
-	}
176
+    if ( isset( $_GET['wpinv-message'] ) && 'discount_update_failed' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) {
177
+        add_settings_error( 'wpinv-notices', 'wpinv-discount-updated-fail', __( 'There was a problem updating your discount code, please try again.', 'invoicing' ), 'error' );
178
+    }
179 179
 
180
-	if ( isset( $_GET['wpinv-message'] ) && 'invoice_deleted' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) {
181
-		add_settings_error( 'wpinv-notices', 'wpinv-deleted', __( 'The invoice has been deleted.', 'invoicing' ), 'updated' );
182
-	}
180
+    if ( isset( $_GET['wpinv-message'] ) && 'invoice_deleted' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) {
181
+        add_settings_error( 'wpinv-notices', 'wpinv-deleted', __( 'The invoice has been deleted.', 'invoicing' ), 'updated' );
182
+    }
183 183
 
184
-	if ( isset( $_GET['wpinv-message'] ) && 'email_sent' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) {
185
-		add_settings_error( 'wpinv-notices', 'wpinv-sent', __( 'The email has been sent to customer.', 'invoicing' ), 'updated' );
184
+    if ( isset( $_GET['wpinv-message'] ) && 'email_sent' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) {
185
+        add_settings_error( 'wpinv-notices', 'wpinv-sent', __( 'The email has been sent to customer.', 'invoicing' ), 'updated' );
186 186
     }
187 187
     
188 188
     if ( isset( $_GET['wpinv-message'] ) && 'email_fail' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) {
189
-		add_settings_error( 'wpinv-notices', 'wpinv-sent-fail', __( 'Fail to send email to the customer.', 'invoicing' ), 'error' );
189
+        add_settings_error( 'wpinv-notices', 'wpinv-sent-fail', __( 'Fail to send email to the customer.', 'invoicing' ), 'error' );
190 190
     }
191 191
 
192 192
     if ( isset( $_GET['wpinv-message'] ) && 'invoice-note-deleted' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) {
193 193
         add_settings_error( 'wpinv-notices', 'wpinv-note-deleted', __( 'The invoice note has been deleted.', 'invoicing' ), 'updated' );
194 194
     }
195 195
 
196
-	if ( isset( $_GET['wpinv-message'] ) && 'settings-imported' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) {
197
-		add_settings_error( 'wpinv-notices', 'wpinv-settings-imported', __( 'The settings have been imported.', 'invoicing' ), 'updated' );
198
-	}
196
+    if ( isset( $_GET['wpinv-message'] ) && 'settings-imported' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) {
197
+        add_settings_error( 'wpinv-notices', 'wpinv-settings-imported', __( 'The settings have been imported.', 'invoicing' ), 'updated' );
198
+    }
199 199
 
200
-	if ( isset( $_GET['wpinv-message'] ) && 'note-added' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) {
201
-		add_settings_error( 'wpinv-notices', 'wpinv-note-added', __( 'The invoice note has been added successfully.', 'invoicing' ), 'updated' );
202
-	}
200
+    if ( isset( $_GET['wpinv-message'] ) && 'note-added' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) {
201
+        add_settings_error( 'wpinv-notices', 'wpinv-note-added', __( 'The invoice note has been added successfully.', 'invoicing' ), 'updated' );
202
+    }
203 203
 
204
-	if ( isset( $_GET['wpinv-message'] ) && 'invoice-updated' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) {
205
-		add_settings_error( 'wpinv-notices', 'wpinv-updated', __( 'The invoice has been successfully updated.', 'invoicing' ), 'updated' );
206
-	}
204
+    if ( isset( $_GET['wpinv-message'] ) && 'invoice-updated' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) {
205
+        add_settings_error( 'wpinv-notices', 'wpinv-updated', __( 'The invoice has been successfully updated.', 'invoicing' ), 'updated' );
206
+    }
207 207
     
208
-	if ( $pagenow == 'post.php' && !empty( $post->post_type ) && $post->post_type == 'wpi_item' && !wpinv_item_is_editable( $post ) ) {
209
-		$message = apply_filters( 'wpinv_item_non_editable_message', __( 'This item in not editable.', 'invoicing' ), $post->ID );
208
+    if ( $pagenow == 'post.php' && !empty( $post->post_type ) && $post->post_type == 'wpi_item' && !wpinv_item_is_editable( $post ) ) {
209
+        $message = apply_filters( 'wpinv_item_non_editable_message', __( 'This item in not editable.', 'invoicing' ), $post->ID );
210 210
 
211
-		if ( !empty( $message ) ) {
212
-			add_settings_error( 'wpinv-notices', 'wpinv-edit-n', $message, 'updated' );
213
-		}
214
-	}
211
+        if ( !empty( $message ) ) {
212
+            add_settings_error( 'wpinv-notices', 'wpinv-edit-n', $message, 'updated' );
213
+        }
214
+    }
215 215
 
216
-	settings_errors( 'wpinv-notices' );
216
+    settings_errors( 'wpinv-notices' );
217 217
 }
218 218
 add_action( 'admin_notices', 'wpinv_admin_messages' );
219 219
 
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
         break;
277 277
         case 'id' :
278 278
            echo $post->ID;
279
-           echo '<div class="hidden" id="wpinv_inline-' . $post->ID . '">
279
+            echo '<div class="hidden" id="wpinv_inline-' . $post->ID . '">
280 280
                     <div class="price">' . wpinv_get_item_price( $post->ID ) . '</div>';
281 281
                     if ( $wpinv_euvat->allow_vat_rules() ) {
282 282
                         echo '<div class="vat_rule">' . $wpinv_euvat->get_item_rule( $post->ID ) . '</div>';
Please login to merge, or discard this patch.