Passed
Pull Request — master (#153)
by Kiran
04:27
created
includes/admin/subscriptions.php 1 patch
Indentation   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -8,23 +8,23 @@  discard block
 block discarded – undo
8 8
  */
9 9
 function wpinv_subscriptions_page() {
10 10
 
11
-	if ( ! empty( $_GET['id'] ) ) {
11
+    if ( ! empty( $_GET['id'] ) ) {
12 12
 
13 13
         wpinv_recurring_subscription_details();
14 14
 
15
-		return;
15
+        return;
16 16
 
17
-	}
18
-	?>
17
+    }
18
+    ?>
19 19
 	<div class="wrap">
20 20
 
21 21
 		<h1>
22 22
 			<?php _e( 'Subscriptions', 'invoicing' ); ?>
23 23
 		</h1>
24 24
 		<?php
25
-		$subscribers_table = new WPInv_Subscription_Reports_Table();
26
-		$subscribers_table->prepare_items();
27
-		?>
25
+        $subscribers_table = new WPInv_Subscription_Reports_Table();
26
+        $subscribers_table->prepare_items();
27
+        ?>
28 28
 
29 29
 		<form id="subscribers-filter" method="get">
30 30
 
@@ -47,24 +47,24 @@  discard block
 block discarded – undo
47 47
  */
48 48
 function wpinv_recurring_subscription_details() {
49 49
 
50
-	$render = true;
50
+    $render = true;
51 51
 
52
-	if ( ! current_user_can( 'manage_invoicing' ) ) {
53
-		die( __( 'You are not permitted to view this data.', 'invoicing' ) );
54
-	}
52
+    if ( ! current_user_can( 'manage_invoicing' ) ) {
53
+        die( __( 'You are not permitted to view this data.', 'invoicing' ) );
54
+    }
55 55
 
56
-	if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) {
56
+    if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) {
57 57
         die( __( 'Invalid subscription ID Provided.', 'invoicing' ) );
58
-	}
58
+    }
59 59
 
60
-	$sub_id  = (int) $_GET['id'];
61
-	$sub     = new WPInv_Subscription( $sub_id );
60
+    $sub_id  = (int) $_GET['id'];
61
+    $sub     = new WPInv_Subscription( $sub_id );
62 62
 
63
-	if ( empty( $sub ) ) {
64
-		die( __( 'Invalid subscription ID Provided.', 'invoicing' ) );
65
-	}
63
+    if ( empty( $sub ) ) {
64
+        die( __( 'Invalid subscription ID Provided.', 'invoicing' ) );
65
+    }
66 66
 
67
-	?>
67
+    ?>
68 68
 	<div class="wrap">
69 69
 		<h2><?php _e( 'Subscription Details', 'invoicing' ); ?></h2>
70 70
 
@@ -88,11 +88,11 @@  discard block
 block discarded – undo
88 88
 										</td>
89 89
 										<td>
90 90
 											<?php
91
-											$frequency = WPInv_Subscriptions::wpinv_get_pretty_subscription_frequency( $sub->period, $sub->frequency );
92
-											$billing   = wpinv_price( wpinv_format_amount( $sub->recurring_amount ), wpinv_get_invoice_currency_code( $sub->parent_payment_id ) ) . ' / ' . $frequency;
93
-											$initial   = wpinv_price( wpinv_format_amount( $sub->initial_amount ), wpinv_get_invoice_currency_code( $sub->parent_payment_id ) );
94
-											printf( _x( '%s then %s', 'Initial subscription amount then billing cycle and amount', 'invoicing' ), $initial, $billing );
95
-											?>
91
+                                            $frequency = WPInv_Subscriptions::wpinv_get_pretty_subscription_frequency( $sub->period, $sub->frequency );
92
+                                            $billing   = wpinv_price( wpinv_format_amount( $sub->recurring_amount ), wpinv_get_invoice_currency_code( $sub->parent_payment_id ) ) . ' / ' . $frequency;
93
+                                            $initial   = wpinv_price( wpinv_format_amount( $sub->initial_amount ), wpinv_get_invoice_currency_code( $sub->parent_payment_id ) );
94
+                                            printf( _x( '%s then %s', 'Initial subscription amount then billing cycle and amount', 'invoicing' ), $initial, $billing );
95
+                                            ?>
96 96
 										</td>
97 97
 									</tr>
98 98
 									<tr>
@@ -134,9 +134,9 @@  discard block
 block discarded – undo
134 134
 
135 135
                                             ?>
136 136
 											<a href="<?php echo esc_url( add_query_arg( array(
137
-													'post'   => $sub->product_id,
138
-													'action' => 'edit'
139
-												), admin_url( 'post.php' ) ) ); ?>" target="_blank"><?php _e( 'View Item', 'invoicing' ) ; ?></a>
137
+                                                    'post'   => $sub->product_id,
138
+                                                    'action' => 'edit'
139
+                                                ), admin_url( 'post.php' ) ) ); ?>" target="_blank"><?php _e( 'View Item', 'invoicing' ) ; ?></a>
140 140
 										</td>
141 141
 									</tr>
142 142
 									<tr>
@@ -299,56 +299,56 @@  discard block
 block discarded – undo
299 299
  */
300 300
 function wpinv_recurring_process_subscription_update() {
301 301
 
302
-	if( empty( $_POST['sub_id'] ) ) {
303
-		return;
304
-	}
302
+    if( empty( $_POST['sub_id'] ) ) {
303
+        return;
304
+    }
305 305
 
306
-	if( empty( $_POST['wpinv_update_subscription'] ) ) {
307
-		return;
308
-	}
306
+    if( empty( $_POST['wpinv_update_subscription'] ) ) {
307
+        return;
308
+    }
309 309
 
310
-	if( ! current_user_can( 'manage_invoicing') ) {
311
-		return;
312
-	}
310
+    if( ! current_user_can( 'manage_invoicing') ) {
311
+        return;
312
+    }
313 313
 
314
-	if( ! wp_verify_nonce( $_POST['wpinv-recurring-update-nonce'], 'wpinv-recurring-update' ) ) {
315
-		wp_die( __( 'Nonce verification failed', 'invoicing' ), __( 'Error', 'invoicing' ), array( 'response' => 403 ) );
316
-	}
314
+    if( ! wp_verify_nonce( $_POST['wpinv-recurring-update-nonce'], 'wpinv-recurring-update' ) ) {
315
+        wp_die( __( 'Nonce verification failed', 'invoicing' ), __( 'Error', 'invoicing' ), array( 'response' => 403 ) );
316
+    }
317 317
 
318
-	$profile_id      = sanitize_text_field( $_POST['profile_id'] );
319
-	$transaction_id  = sanitize_text_field( $_POST['transaction_id'] );
320
-	$product_id      = absint( $_POST['product_id'] );
321
-	$subscription    = new WPInv_Subscription( absint( $_POST['sub_id'] ) );
322
-	$subscription->update( array(
323
-		'status'         => sanitize_text_field( $_POST['status'] ),
324
-		'profile_id'     => $profile_id,
325
-		'product_id'     => $product_id,
326
-		'transaction_id' => $transaction_id,
327
-	) );
318
+    $profile_id      = sanitize_text_field( $_POST['profile_id'] );
319
+    $transaction_id  = sanitize_text_field( $_POST['transaction_id'] );
320
+    $product_id      = absint( $_POST['product_id'] );
321
+    $subscription    = new WPInv_Subscription( absint( $_POST['sub_id'] ) );
322
+    $subscription->update( array(
323
+        'status'         => sanitize_text_field( $_POST['status'] ),
324
+        'profile_id'     => $profile_id,
325
+        'product_id'     => $product_id,
326
+        'transaction_id' => $transaction_id,
327
+    ) );
328 328
 
329
-	$status = sanitize_text_field( $_POST['status'] );
329
+    $status = sanitize_text_field( $_POST['status'] );
330 330
 
331
-	switch( $status ) {
331
+    switch( $status ) {
332 332
 
333
-		case 'cancelled' :
333
+        case 'cancelled' :
334 334
 
335
-			$subscription->cancel();
336
-			break;
335
+            $subscription->cancel();
336
+            break;
337 337
 
338
-		case 'expired' :
338
+        case 'expired' :
339 339
 
340
-			$subscription->expire();
341
-			break;
340
+            $subscription->expire();
341
+            break;
342 342
 
343
-		case 'completed' :
343
+        case 'completed' :
344 344
 
345
-			$subscription->complete();
346
-			break;
345
+            $subscription->complete();
346
+            break;
347 347
 
348
-	}
348
+    }
349 349
 
350
-	wp_redirect( admin_url( 'admin.php?page=wpinv-subscriptions&wpinv-message=updated&id=' . $subscription->id ) );
351
-	exit;
350
+    wp_redirect( admin_url( 'admin.php?page=wpinv-subscriptions&wpinv-message=updated&id=' . $subscription->id ) );
351
+    exit;
352 352
 
353 353
 }
354 354
 add_action( 'admin_init', 'wpinv_recurring_process_subscription_update', 1 );
@@ -362,30 +362,30 @@  discard block
 block discarded – undo
362 362
  */
363 363
 function wpinv_recurring_process_subscription_deletion() {
364 364
 
365
-	if( empty( $_POST['sub_id'] ) ) {
366
-		return;
367
-	}
365
+    if( empty( $_POST['sub_id'] ) ) {
366
+        return;
367
+    }
368 368
 
369
-	if( empty( $_POST['wpinv_delete_subscription'] ) ) {
370
-		return;
371
-	}
369
+    if( empty( $_POST['wpinv_delete_subscription'] ) ) {
370
+        return;
371
+    }
372 372
 
373
-	if( ! current_user_can( 'manage_invoicing') ) {
374
-		return;
375
-	}
373
+    if( ! current_user_can( 'manage_invoicing') ) {
374
+        return;
375
+    }
376 376
 
377
-	if( ! wp_verify_nonce( $_POST['wpinv-recurring-update-nonce'], 'wpinv-recurring-update' ) ) {
378
-		wp_die( __( 'Nonce verification failed', 'invoicing' ), __( 'Error', 'invoicing' ), array( 'response' => 403 ) );
379
-	}
377
+    if( ! wp_verify_nonce( $_POST['wpinv-recurring-update-nonce'], 'wpinv-recurring-update' ) ) {
378
+        wp_die( __( 'Nonce verification failed', 'invoicing' ), __( 'Error', 'invoicing' ), array( 'response' => 403 ) );
379
+    }
380 380
 
381
-	$subscription = new WPInv_Subscription( absint( $_POST['sub_id'] ) );
381
+    $subscription = new WPInv_Subscription( absint( $_POST['sub_id'] ) );
382 382
 
383
-	delete_post_meta( $subscription->parent_payment_id, '_wpinv_subscription_payment' );
383
+    delete_post_meta( $subscription->parent_payment_id, '_wpinv_subscription_payment' );
384 384
 
385
-	$subscription->delete();
385
+    $subscription->delete();
386 386
 
387
-	wp_redirect( admin_url( 'admin.php?page=wpinv-subscriptions&wpinv-message=deleted' ) );
388
-	exit;
387
+    wp_redirect( admin_url( 'admin.php?page=wpinv-subscriptions&wpinv-message=deleted' ) );
388
+    exit;
389 389
 
390 390
 }
391 391
 add_action( 'admin_init', 'wpinv_recurring_process_subscription_deletion', 2 );
Please login to merge, or discard this patch.
includes/admin/register-settings.php 1 patch
Indentation   +328 added lines, -328 removed lines patch added patch discarded remove patch
@@ -876,325 +876,325 @@  discard block
 block discarded – undo
876 876
 }
877 877
 
878 878
 function wpinv_get_pages( $with_slug = false, $default_label = NULL ) {
879
-	$pages_options = array();
879
+    $pages_options = array();
880 880
 
881
-	if( $default_label !== NULL && $default_label !== false ) {
882
-		$pages_options = array( '' => $default_label ); // Blank option
883
-	}
881
+    if( $default_label !== NULL && $default_label !== false ) {
882
+        $pages_options = array( '' => $default_label ); // Blank option
883
+    }
884 884
 
885
-	$pages = get_pages();
886
-	if ( $pages ) {
887
-		foreach ( $pages as $page ) {
888
-			$title = $with_slug ? $page->post_title . ' (' . $page->post_name . ')' : $page->post_title;
885
+    $pages = get_pages();
886
+    if ( $pages ) {
887
+        foreach ( $pages as $page ) {
888
+            $title = $with_slug ? $page->post_title . ' (' . $page->post_name . ')' : $page->post_title;
889 889
             $pages_options[ $page->ID ] = $title;
890
-		}
891
-	}
890
+        }
891
+    }
892 892
 
893
-	return $pages_options;
893
+    return $pages_options;
894 894
 }
895 895
 
896 896
 function wpinv_header_callback( $args ) {
897
-	if ( !empty( $args['desc'] ) ) {
897
+    if ( !empty( $args['desc'] ) ) {
898 898
         echo $args['desc'];
899 899
     }
900 900
 }
901 901
 
902 902
 function wpinv_hidden_callback( $args ) {
903
-	global $wpinv_options;
904
-
905
-	if ( isset( $args['set_value'] ) ) {
906
-		$value = $args['set_value'];
907
-	} elseif ( isset( $wpinv_options[ $args['id'] ] ) ) {
908
-		$value = $wpinv_options[ $args['id'] ];
909
-	} else {
910
-		$value = isset( $args['std'] ) ? $args['std'] : '';
911
-	}
912
-
913
-	if ( isset( $args['faux'] ) && true === $args['faux'] ) {
914
-		$args['readonly'] = true;
915
-		$value = isset( $args['std'] ) ? $args['std'] : '';
916
-		$name  = '';
917
-	} else {
918
-		$name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"';
919
-	}
920
-
921
-	$html = '<input type="hidden" id="wpinv_settings[' . wpinv_sanitize_key( $args['id'] ) . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '" />';
903
+    global $wpinv_options;
904
+
905
+    if ( isset( $args['set_value'] ) ) {
906
+        $value = $args['set_value'];
907
+    } elseif ( isset( $wpinv_options[ $args['id'] ] ) ) {
908
+        $value = $wpinv_options[ $args['id'] ];
909
+    } else {
910
+        $value = isset( $args['std'] ) ? $args['std'] : '';
911
+    }
912
+
913
+    if ( isset( $args['faux'] ) && true === $args['faux'] ) {
914
+        $args['readonly'] = true;
915
+        $value = isset( $args['std'] ) ? $args['std'] : '';
916
+        $name  = '';
917
+    } else {
918
+        $name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"';
919
+    }
920
+
921
+    $html = '<input type="hidden" id="wpinv_settings[' . wpinv_sanitize_key( $args['id'] ) . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '" />';
922 922
     
923
-	echo $html;
923
+    echo $html;
924 924
 }
925 925
 
926 926
 function wpinv_checkbox_callback( $args ) {
927
-	global $wpinv_options;
927
+    global $wpinv_options;
928 928
     
929 929
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
930 930
 
931
-	if ( isset( $args['faux'] ) && true === $args['faux'] ) {
932
-		$name = '';
933
-	} else {
934
-		$name = 'name="wpinv_settings[' . $sanitize_id . ']"';
935
-	}
931
+    if ( isset( $args['faux'] ) && true === $args['faux'] ) {
932
+        $name = '';
933
+    } else {
934
+        $name = 'name="wpinv_settings[' . $sanitize_id . ']"';
935
+    }
936 936
 
937
-	$checked = isset( $wpinv_options[ $args['id'] ] ) ? checked( 1, $wpinv_options[ $args['id'] ], false ) : '';
938
-	$html = '<input type="checkbox" id="wpinv_settings[' . $sanitize_id . ']"' . $name . ' value="1" ' . $checked . '/>';
939
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
937
+    $checked = isset( $wpinv_options[ $args['id'] ] ) ? checked( 1, $wpinv_options[ $args['id'] ], false ) : '';
938
+    $html = '<input type="checkbox" id="wpinv_settings[' . $sanitize_id . ']"' . $name . ' value="1" ' . $checked . '/>';
939
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
940 940
 
941
-	echo $html;
941
+    echo $html;
942 942
 }
943 943
 
944 944
 function wpinv_multicheck_callback( $args ) {
945
-	global $wpinv_options;
945
+    global $wpinv_options;
946 946
 
947
-	$sanitize_id = wpinv_sanitize_key( $args['id'] );
948
-	$class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : '';
947
+    $sanitize_id = wpinv_sanitize_key( $args['id'] );
948
+    $class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : '';
949 949
 
950
-	if ( ! empty( $args['options'] ) ) {
951
-		echo '<div class="wpi-mcheck-rows wpi-mcheck-' . $sanitize_id . $class . '">';
950
+    if ( ! empty( $args['options'] ) ) {
951
+        echo '<div class="wpi-mcheck-rows wpi-mcheck-' . $sanitize_id . $class . '">';
952 952
         foreach( $args['options'] as $key => $option ):
953
-			$sanitize_key = wpinv_sanitize_key( $key );
954
-			if ( isset( $wpinv_options[$args['id']][$sanitize_key] ) ) { 
955
-				$enabled = $sanitize_key;
956
-			} else { 
957
-				$enabled = NULL; 
958
-			}
959
-			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;';
960
-			echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . wp_kses_post( $option ) . '</label></div>';
961
-		endforeach;
962
-		echo '</div>';
963
-		echo '<p class="description">' . $args['desc'] . '</p>';
964
-	}
953
+            $sanitize_key = wpinv_sanitize_key( $key );
954
+            if ( isset( $wpinv_options[$args['id']][$sanitize_key] ) ) { 
955
+                $enabled = $sanitize_key;
956
+            } else { 
957
+                $enabled = NULL; 
958
+            }
959
+            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;';
960
+            echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . wp_kses_post( $option ) . '</label></div>';
961
+        endforeach;
962
+        echo '</div>';
963
+        echo '<p class="description">' . $args['desc'] . '</p>';
964
+    }
965 965
 }
966 966
 
967 967
 function wpinv_payment_icons_callback( $args ) {
968
-	global $wpinv_options;
968
+    global $wpinv_options;
969 969
     
970 970
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
971 971
 
972
-	if ( ! empty( $args['options'] ) ) {
973
-		foreach( $args['options'] as $key => $option ) {
972
+    if ( ! empty( $args['options'] ) ) {
973
+        foreach( $args['options'] as $key => $option ) {
974 974
             $sanitize_key = wpinv_sanitize_key( $key );
975 975
             
976
-			if( isset( $wpinv_options[$args['id']][$key] ) ) {
977
-				$enabled = $option;
978
-			} else {
979
-				$enabled = NULL;
980
-			}
981
-
982
-			echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" style="margin-right:10px;line-height:16px;height:16px;display:inline-block;">';
983
-
984
-				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;';
985
-
986
-				if ( wpinv_string_is_image_url( $key ) ) {
987
-					echo '<img class="payment-icon" src="' . esc_url( $key ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
988
-				} else {
989
-					$card = strtolower( str_replace( ' ', '', $option ) );
990
-
991
-					if ( has_filter( 'wpinv_accepted_payment_' . $card . '_image' ) ) {
992
-						$image = apply_filters( 'wpinv_accepted_payment_' . $card . '_image', '' );
993
-					} else {
994
-						$image       = wpinv_locate_template( 'images' . DIRECTORY_SEPARATOR . 'icons' . DIRECTORY_SEPARATOR . $card . '.gif', false );
995
-						$content_dir = WP_CONTENT_DIR;
996
-
997
-						if ( function_exists( 'wp_normalize_path' ) ) {
998
-							// Replaces backslashes with forward slashes for Windows systems
999
-							$image = wp_normalize_path( $image );
1000
-							$content_dir = wp_normalize_path( $content_dir );
1001
-						}
1002
-
1003
-						$image = str_replace( $content_dir, content_url(), $image );
1004
-					}
1005
-
1006
-					echo '<img class="payment-icon" src="' . esc_url( $image ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
1007
-				}
1008
-			echo $option . '</label>';
1009
-		}
1010
-		echo '<p class="description" style="margin-top:16px;">' . wp_kses_post( $args['desc'] ) . '</p>';
1011
-	}
976
+            if( isset( $wpinv_options[$args['id']][$key] ) ) {
977
+                $enabled = $option;
978
+            } else {
979
+                $enabled = NULL;
980
+            }
981
+
982
+            echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" style="margin-right:10px;line-height:16px;height:16px;display:inline-block;">';
983
+
984
+                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;';
985
+
986
+                if ( wpinv_string_is_image_url( $key ) ) {
987
+                    echo '<img class="payment-icon" src="' . esc_url( $key ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
988
+                } else {
989
+                    $card = strtolower( str_replace( ' ', '', $option ) );
990
+
991
+                    if ( has_filter( 'wpinv_accepted_payment_' . $card . '_image' ) ) {
992
+                        $image = apply_filters( 'wpinv_accepted_payment_' . $card . '_image', '' );
993
+                    } else {
994
+                        $image       = wpinv_locate_template( 'images' . DIRECTORY_SEPARATOR . 'icons' . DIRECTORY_SEPARATOR . $card . '.gif', false );
995
+                        $content_dir = WP_CONTENT_DIR;
996
+
997
+                        if ( function_exists( 'wp_normalize_path' ) ) {
998
+                            // Replaces backslashes with forward slashes for Windows systems
999
+                            $image = wp_normalize_path( $image );
1000
+                            $content_dir = wp_normalize_path( $content_dir );
1001
+                        }
1002
+
1003
+                        $image = str_replace( $content_dir, content_url(), $image );
1004
+                    }
1005
+
1006
+                    echo '<img class="payment-icon" src="' . esc_url( $image ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
1007
+                }
1008
+            echo $option . '</label>';
1009
+        }
1010
+        echo '<p class="description" style="margin-top:16px;">' . wp_kses_post( $args['desc'] ) . '</p>';
1011
+    }
1012 1012
 }
1013 1013
 
1014 1014
 function wpinv_radio_callback( $args ) {
1015
-	global $wpinv_options;
1015
+    global $wpinv_options;
1016 1016
     
1017 1017
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
1018 1018
     
1019 1019
     foreach ( $args['options'] as $key => $option ) :
1020
-		$sanitize_key = wpinv_sanitize_key( $key );
1020
+        $sanitize_key = wpinv_sanitize_key( $key );
1021 1021
         
1022 1022
         $checked = false;
1023 1023
 
1024
-		if ( isset( $wpinv_options[ $args['id'] ] ) && $wpinv_options[ $args['id'] ] == $key )
1025
-			$checked = true;
1026
-		elseif( isset( $args['std'] ) && $args['std'] == $key && ! isset( $wpinv_options[ $args['id'] ] ) )
1027
-			$checked = true;
1024
+        if ( isset( $wpinv_options[ $args['id'] ] ) && $wpinv_options[ $args['id'] ] == $key )
1025
+            $checked = true;
1026
+        elseif( isset( $args['std'] ) && $args['std'] == $key && ! isset( $wpinv_options[ $args['id'] ] ) )
1027
+            $checked = true;
1028 1028
 
1029
-		echo '<input name="wpinv_settings[' . $sanitize_id . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="radio" value="' . $sanitize_key . '" ' . checked(true, $checked, false) . '/>&nbsp;';
1030
-		echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html( $option ) . '</label><br/>';
1031
-	endforeach;
1029
+        echo '<input name="wpinv_settings[' . $sanitize_id . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="radio" value="' . $sanitize_key . '" ' . checked(true, $checked, false) . '/>&nbsp;';
1030
+        echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html( $option ) . '</label><br/>';
1031
+    endforeach;
1032 1032
 
1033
-	echo '<p class="description">' . wp_kses_post( $args['desc'] ) . '</p>';
1033
+    echo '<p class="description">' . wp_kses_post( $args['desc'] ) . '</p>';
1034 1034
 }
1035 1035
 
1036 1036
 function wpinv_gateways_callback( $args ) {
1037
-	global $wpinv_options;
1037
+    global $wpinv_options;
1038 1038
     
1039 1039
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
1040 1040
 
1041
-	foreach ( $args['options'] as $key => $option ) :
1042
-		$sanitize_key = wpinv_sanitize_key( $key );
1041
+    foreach ( $args['options'] as $key => $option ) :
1042
+        $sanitize_key = wpinv_sanitize_key( $key );
1043 1043
         
1044 1044
         if ( isset( $wpinv_options['gateways'][ $key ] ) )
1045
-			$enabled = '1';
1046
-		else
1047
-			$enabled = null;
1045
+            $enabled = '1';
1046
+        else
1047
+            $enabled = null;
1048 1048
 
1049
-		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;';
1050
-		echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html( $option['admin_label'] ) . '</label><br/>';
1051
-	endforeach;
1049
+        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;';
1050
+        echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html( $option['admin_label'] ) . '</label><br/>';
1051
+    endforeach;
1052 1052
 }
1053 1053
 
1054 1054
 function wpinv_gateway_select_callback($args) {
1055
-	global $wpinv_options;
1055
+    global $wpinv_options;
1056 1056
     
1057 1057
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
1058 1058
 
1059
-	echo '<select name="wpinv_settings[' . $sanitize_id . ']"" id="wpinv_settings[' . $sanitize_id . ']">';
1059
+    echo '<select name="wpinv_settings[' . $sanitize_id . ']"" id="wpinv_settings[' . $sanitize_id . ']">';
1060 1060
 
1061
-	foreach ( $args['options'] as $key => $option ) :
1062
-		if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) {
1061
+    foreach ( $args['options'] as $key => $option ) :
1062
+        if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) {
1063 1063
             $selected = selected( $key, $args['selected'], false );
1064 1064
         } else {
1065 1065
             $selected = isset( $wpinv_options[ $args['id'] ] ) ? selected( $key, $wpinv_options[$args['id']], false ) : '';
1066 1066
         }
1067
-		echo '<option value="' . wpinv_sanitize_key( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>';
1068
-	endforeach;
1067
+        echo '<option value="' . wpinv_sanitize_key( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>';
1068
+    endforeach;
1069 1069
 
1070
-	echo '</select>';
1071
-	echo '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1070
+    echo '</select>';
1071
+    echo '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1072 1072
 }
1073 1073
 
1074 1074
 function wpinv_text_callback( $args ) {
1075
-	global $wpinv_options;
1075
+    global $wpinv_options;
1076 1076
     
1077 1077
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
1078 1078
 
1079
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1080
-		$value = $wpinv_options[ $args['id'] ];
1081
-	} else {
1082
-		$value = isset( $args['std'] ) ? $args['std'] : '';
1083
-	}
1084
-
1085
-	if ( isset( $args['faux'] ) && true === $args['faux'] ) {
1086
-		$args['readonly'] = true;
1087
-		$value = isset( $args['std'] ) ? $args['std'] : '';
1088
-		$name  = '';
1089
-	} else {
1090
-		$name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"';
1091
-	}
1092
-	$class = !empty( $args['class'] ) ? sanitize_html_class( $args['class'] ) : '';
1093
-
1094
-	$readonly = $args['readonly'] === true ? ' readonly="readonly"' : '';
1095
-	$size     = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
1096
-	$html     = '<input type="text" class="' . sanitize_html_class( $size ) . '-text ' . $class . '" id="wpinv_settings[' . $sanitize_id . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '"' . $readonly . '/>';
1097
-	$html    .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1098
-
1099
-	echo $html;
1079
+    if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1080
+        $value = $wpinv_options[ $args['id'] ];
1081
+    } else {
1082
+        $value = isset( $args['std'] ) ? $args['std'] : '';
1083
+    }
1084
+
1085
+    if ( isset( $args['faux'] ) && true === $args['faux'] ) {
1086
+        $args['readonly'] = true;
1087
+        $value = isset( $args['std'] ) ? $args['std'] : '';
1088
+        $name  = '';
1089
+    } else {
1090
+        $name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"';
1091
+    }
1092
+    $class = !empty( $args['class'] ) ? sanitize_html_class( $args['class'] ) : '';
1093
+
1094
+    $readonly = $args['readonly'] === true ? ' readonly="readonly"' : '';
1095
+    $size     = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
1096
+    $html     = '<input type="text" class="' . sanitize_html_class( $size ) . '-text ' . $class . '" id="wpinv_settings[' . $sanitize_id . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '"' . $readonly . '/>';
1097
+    $html    .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1098
+
1099
+    echo $html;
1100 1100
 }
1101 1101
 
1102 1102
 function wpinv_number_callback( $args ) {
1103
-	global $wpinv_options;
1103
+    global $wpinv_options;
1104 1104
     
1105 1105
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
1106 1106
 
1107
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1108
-		$value = $wpinv_options[ $args['id'] ];
1109
-	} else {
1110
-		$value = isset( $args['std'] ) ? $args['std'] : '';
1111
-	}
1112
-
1113
-	if ( isset( $args['faux'] ) && true === $args['faux'] ) {
1114
-		$args['readonly'] = true;
1115
-		$value = isset( $args['std'] ) ? $args['std'] : '';
1116
-		$name  = '';
1117
-	} else {
1118
-		$name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"';
1119
-	}
1120
-
1121
-	$max  = isset( $args['max'] ) ? $args['max'] : 999999;
1122
-	$min  = isset( $args['min'] ) ? $args['min'] : 0;
1123
-	$step = isset( $args['step'] ) ? $args['step'] : 1;
1124
-	$class = !empty( $args['class'] ) ? sanitize_html_class( $args['class'] ) : '';
1125
-
1126
-	$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
1127
-	$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 ) ) . '"/>';
1128
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1129
-
1130
-	echo $html;
1107
+    if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1108
+        $value = $wpinv_options[ $args['id'] ];
1109
+    } else {
1110
+        $value = isset( $args['std'] ) ? $args['std'] : '';
1111
+    }
1112
+
1113
+    if ( isset( $args['faux'] ) && true === $args['faux'] ) {
1114
+        $args['readonly'] = true;
1115
+        $value = isset( $args['std'] ) ? $args['std'] : '';
1116
+        $name  = '';
1117
+    } else {
1118
+        $name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"';
1119
+    }
1120
+
1121
+    $max  = isset( $args['max'] ) ? $args['max'] : 999999;
1122
+    $min  = isset( $args['min'] ) ? $args['min'] : 0;
1123
+    $step = isset( $args['step'] ) ? $args['step'] : 1;
1124
+    $class = !empty( $args['class'] ) ? sanitize_html_class( $args['class'] ) : '';
1125
+
1126
+    $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
1127
+    $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 ) ) . '"/>';
1128
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1129
+
1130
+    echo $html;
1131 1131
 }
1132 1132
 
1133 1133
 function wpinv_textarea_callback( $args ) {
1134
-	global $wpinv_options;
1134
+    global $wpinv_options;
1135 1135
     
1136 1136
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
1137 1137
 
1138
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1139
-		$value = $wpinv_options[ $args['id'] ];
1140
-	} else {
1141
-		$value = isset( $args['std'] ) ? $args['std'] : '';
1142
-	}
1138
+    if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1139
+        $value = $wpinv_options[ $args['id'] ];
1140
+    } else {
1141
+        $value = isset( $args['std'] ) ? $args['std'] : '';
1142
+    }
1143 1143
     
1144 1144
     $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
1145 1145
     $class = ( isset( $args['class'] ) && ! is_null( $args['class'] ) ) ? $args['class'] : 'large-text';
1146 1146
 
1147
-	$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>';
1148
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1147
+    $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>';
1148
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1149 1149
 
1150
-	echo $html;
1150
+    echo $html;
1151 1151
 }
1152 1152
 
1153 1153
 function wpinv_password_callback( $args ) {
1154
-	global $wpinv_options;
1154
+    global $wpinv_options;
1155 1155
     
1156 1156
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
1157 1157
 
1158
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1159
-		$value = $wpinv_options[ $args['id'] ];
1160
-	} else {
1161
-		$value = isset( $args['std'] ) ? $args['std'] : '';
1162
-	}
1158
+    if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1159
+        $value = $wpinv_options[ $args['id'] ];
1160
+    } else {
1161
+        $value = isset( $args['std'] ) ? $args['std'] : '';
1162
+    }
1163 1163
 
1164
-	$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
1165
-	$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 ) . '"/>';
1166
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
1164
+    $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
1165
+    $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 ) . '"/>';
1166
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
1167 1167
 
1168
-	echo $html;
1168
+    echo $html;
1169 1169
 }
1170 1170
 
1171 1171
 function wpinv_missing_callback($args) {
1172
-	printf(
1173
-		__( 'The callback function used for the %s setting is missing.', 'invoicing' ),
1174
-		'<strong>' . $args['id'] . '</strong>'
1175
-	);
1172
+    printf(
1173
+        __( 'The callback function used for the %s setting is missing.', 'invoicing' ),
1174
+        '<strong>' . $args['id'] . '</strong>'
1175
+    );
1176 1176
 }
1177 1177
 
1178 1178
 function wpinv_select_callback($args) {
1179
-	global $wpinv_options;
1179
+    global $wpinv_options;
1180 1180
     
1181 1181
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
1182 1182
 
1183
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1184
-		$value = $wpinv_options[ $args['id'] ];
1185
-	} else {
1186
-		$value = isset( $args['std'] ) ? $args['std'] : '';
1187
-	}
1183
+    if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1184
+        $value = $wpinv_options[ $args['id'] ];
1185
+    } else {
1186
+        $value = isset( $args['std'] ) ? $args['std'] : '';
1187
+    }
1188 1188
     
1189 1189
     if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) {
1190 1190
         $value = $args['selected'];
1191 1191
     }
1192 1192
 
1193
-	if ( isset( $args['placeholder'] ) ) {
1194
-		$placeholder = $args['placeholder'];
1195
-	} else {
1196
-		$placeholder = '';
1197
-	}
1193
+    if ( isset( $args['placeholder'] ) ) {
1194
+        $placeholder = $args['placeholder'];
1195
+    } else {
1196
+        $placeholder = '';
1197
+    }
1198 1198
     
1199 1199
     if( !empty( $args['onchange'] ) ) {
1200 1200
         $onchange = ' onchange="' . esc_attr( $args['onchange'] ) . '"';
@@ -1202,142 +1202,142 @@  discard block
 block discarded – undo
1202 1202
         $onchange = '';
1203 1203
     }
1204 1204
 
1205
-	$html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" data-placeholder="' . esc_html( $placeholder ) . '"' . $onchange . ' />';
1205
+    $html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" data-placeholder="' . esc_html( $placeholder ) . '"' . $onchange . ' />';
1206 1206
 
1207
-	foreach ( $args['options'] as $option => $name ) {
1208
-		$selected = selected( $option, $value, false );
1209
-		$html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>';
1210
-	}
1207
+    foreach ( $args['options'] as $option => $name ) {
1208
+        $selected = selected( $option, $value, false );
1209
+        $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>';
1210
+    }
1211 1211
 
1212
-	$html .= '</select>';
1213
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
1212
+    $html .= '</select>';
1213
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
1214 1214
 
1215
-	echo $html;
1215
+    echo $html;
1216 1216
 }
1217 1217
 
1218 1218
 function wpinv_color_select_callback( $args ) {
1219
-	global $wpinv_options;
1219
+    global $wpinv_options;
1220 1220
     
1221 1221
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
1222 1222
 
1223
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1224
-		$value = $wpinv_options[ $args['id'] ];
1225
-	} else {
1226
-		$value = isset( $args['std'] ) ? $args['std'] : '';
1227
-	}
1223
+    if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1224
+        $value = $wpinv_options[ $args['id'] ];
1225
+    } else {
1226
+        $value = isset( $args['std'] ) ? $args['std'] : '';
1227
+    }
1228 1228
 
1229
-	$html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"/>';
1229
+    $html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"/>';
1230 1230
 
1231
-	foreach ( $args['options'] as $option => $color ) {
1232
-		$selected = selected( $option, $value, false );
1233
-		$html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $color['label'] ) . '</option>';
1234
-	}
1231
+    foreach ( $args['options'] as $option => $color ) {
1232
+        $selected = selected( $option, $value, false );
1233
+        $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $color['label'] ) . '</option>';
1234
+    }
1235 1235
 
1236
-	$html .= '</select>';
1237
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1236
+    $html .= '</select>';
1237
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1238 1238
 
1239
-	echo $html;
1239
+    echo $html;
1240 1240
 }
1241 1241
 
1242 1242
 function wpinv_rich_editor_callback( $args ) {
1243
-	global $wpinv_options, $wp_version;
1243
+    global $wpinv_options, $wp_version;
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'] ];
1247
+    if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1248
+        $value = $wpinv_options[ $args['id'] ];
1249 1249
 
1250
-		if( empty( $args['allow_blank'] ) && empty( $value ) ) {
1251
-			$value = isset( $args['std'] ) ? $args['std'] : '';
1252
-		}
1253
-	} else {
1254
-		$value = isset( $args['std'] ) ? $args['std'] : '';
1255
-	}
1250
+        if( empty( $args['allow_blank'] ) && empty( $value ) ) {
1251
+            $value = isset( $args['std'] ) ? $args['std'] : '';
1252
+        }
1253
+    } else {
1254
+        $value = isset( $args['std'] ) ? $args['std'] : '';
1255
+    }
1256 1256
 
1257
-	$rows = isset( $args['size'] ) ? $args['size'] : 20;
1257
+    $rows = isset( $args['size'] ) ? $args['size'] : 20;
1258 1258
 
1259
-	if ( $wp_version >= 3.3 && function_exists( 'wp_editor' ) ) {
1260
-		ob_start();
1261
-		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 ) );
1262
-		$html = ob_get_clean();
1263
-	} else {
1264
-		$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>';
1265
-	}
1259
+    if ( $wp_version >= 3.3 && function_exists( 'wp_editor' ) ) {
1260
+        ob_start();
1261
+        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 ) );
1262
+        $html = ob_get_clean();
1263
+    } else {
1264
+        $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>';
1265
+    }
1266 1266
 
1267
-	$html .= '<br/><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
1267
+    $html .= '<br/><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
1268 1268
 
1269
-	echo $html;
1269
+    echo $html;
1270 1270
 }
1271 1271
 
1272 1272
 function wpinv_upload_callback( $args ) {
1273
-	global $wpinv_options;
1273
+    global $wpinv_options;
1274 1274
     
1275 1275
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
1276 1276
 
1277
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1278
-		$value = $wpinv_options[$args['id']];
1279
-	} else {
1280
-		$value = isset($args['std']) ? $args['std'] : '';
1281
-	}
1277
+    if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1278
+        $value = $wpinv_options[$args['id']];
1279
+    } else {
1280
+        $value = isset($args['std']) ? $args['std'] : '';
1281
+    }
1282 1282
 
1283
-	$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
1284
-	$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 ) ) . '"/>';
1285
-	$html .= '<span>&nbsp;<input type="button" class="wpinv_settings_upload_button button-secondary" value="' . __( 'Upload File', 'invoicing' ) . '"/></span>';
1286
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
1283
+    $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
1284
+    $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 ) ) . '"/>';
1285
+    $html .= '<span>&nbsp;<input type="button" class="wpinv_settings_upload_button button-secondary" value="' . __( 'Upload File', 'invoicing' ) . '"/></span>';
1286
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
1287 1287
 
1288
-	echo $html;
1288
+    echo $html;
1289 1289
 }
1290 1290
 
1291 1291
 function wpinv_color_callback( $args ) {
1292
-	global $wpinv_options;
1292
+    global $wpinv_options;
1293 1293
     
1294 1294
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
1295 1295
 
1296
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1297
-		$value = $wpinv_options[ $args['id'] ];
1298
-	} else {
1299
-		$value = isset( $args['std'] ) ? $args['std'] : '';
1300
-	}
1296
+    if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1297
+        $value = $wpinv_options[ $args['id'] ];
1298
+    } else {
1299
+        $value = isset( $args['std'] ) ? $args['std'] : '';
1300
+    }
1301 1301
 
1302
-	$default = isset( $args['std'] ) ? $args['std'] : '';
1302
+    $default = isset( $args['std'] ) ? $args['std'] : '';
1303 1303
 
1304
-	$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 ) . '" />';
1305
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1304
+    $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 ) . '" />';
1305
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1306 1306
 
1307
-	echo $html;
1307
+    echo $html;
1308 1308
 }
1309 1309
 
1310 1310
 function wpinv_country_states_callback($args) {
1311
-	global $wpinv_options;
1311
+    global $wpinv_options;
1312 1312
     
1313 1313
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
1314 1314
 
1315
-	if ( isset( $args['placeholder'] ) ) {
1316
-		$placeholder = $args['placeholder'];
1317
-	} else {
1318
-		$placeholder = '';
1319
-	}
1315
+    if ( isset( $args['placeholder'] ) ) {
1316
+        $placeholder = $args['placeholder'];
1317
+    } else {
1318
+        $placeholder = '';
1319
+    }
1320 1320
 
1321
-	$states = wpinv_get_country_states();
1321
+    $states = wpinv_get_country_states();
1322 1322
 
1323
-	$class = empty( $states ) ? ' class="wpinv-no-states"' : '';
1324
-	$html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"' . $class . 'data-placeholder="' . esc_html( $placeholder ) . '"/>';
1323
+    $class = empty( $states ) ? ' class="wpinv-no-states"' : '';
1324
+    $html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"' . $class . 'data-placeholder="' . esc_html( $placeholder ) . '"/>';
1325 1325
 
1326
-	foreach ( $states as $option => $name ) {
1327
-		$selected = isset( $wpinv_options[ $args['id'] ] ) ? selected( $option, $wpinv_options[$args['id']], false ) : '';
1328
-		$html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>';
1329
-	}
1326
+    foreach ( $states as $option => $name ) {
1327
+        $selected = isset( $wpinv_options[ $args['id'] ] ) ? selected( $option, $wpinv_options[$args['id']], false ) : '';
1328
+        $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>';
1329
+    }
1330 1330
 
1331
-	$html .= '</select>';
1332
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1331
+    $html .= '</select>';
1332
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1333 1333
 
1334
-	echo $html;
1334
+    echo $html;
1335 1335
 }
1336 1336
 
1337 1337
 function wpinv_tax_rates_callback($args) {
1338
-	global $wpinv_options;
1339
-	$rates = wpinv_get_tax_rates();
1340
-	ob_start(); ?>
1338
+    global $wpinv_options;
1339
+    $rates = wpinv_get_tax_rates();
1340
+    ob_start(); ?>
1341 1341
     </td><tr>
1342 1342
     <td colspan="2" class="wpinv_tax_tdbox">
1343 1343
 	<p><?php echo $args['desc']; ?></p>
@@ -1361,39 +1361,39 @@  discard block
 block discarded – undo
1361 1361
 			<tr>
1362 1362
 				<td class="wpinv_tax_country">
1363 1363
 					<?php
1364
-					echo wpinv_html_select( array(
1365
-						'options'          => wpinv_get_country_list( true ),
1366
-						'name'             => 'tax_rates[' . $sanitized_key . '][country]',
1364
+                    echo wpinv_html_select( array(
1365
+                        'options'          => wpinv_get_country_list( true ),
1366
+                        'name'             => 'tax_rates[' . $sanitized_key . '][country]',
1367 1367
                         'id'               => 'tax_rates[' . $sanitized_key . '][country]',
1368
-						'selected'         => $rate['country'],
1369
-						'show_option_all'  => false,
1370
-						'show_option_none' => false,
1371
-						'class'            => 'wpinv-tax-country',
1372
-						'placeholder'      => __( 'Choose a country', 'invoicing' )
1373
-					) );
1374
-					?>
1368
+                        'selected'         => $rate['country'],
1369
+                        'show_option_all'  => false,
1370
+                        'show_option_none' => false,
1371
+                        'class'            => 'wpinv-tax-country',
1372
+                        'placeholder'      => __( 'Choose a country', 'invoicing' )
1373
+                    ) );
1374
+                    ?>
1375 1375
 				</td>
1376 1376
 				<td class="wpinv_tax_state">
1377 1377
 					<?php
1378
-					$states = wpinv_get_country_states( $rate['country'] );
1379
-					if( !empty( $states ) ) {
1380
-						echo wpinv_html_select( array(
1381
-							'options'          => array_merge( array( '' => '' ), $states ),
1382
-							'name'             => 'tax_rates[' . $sanitized_key . '][state]',
1378
+                    $states = wpinv_get_country_states( $rate['country'] );
1379
+                    if( !empty( $states ) ) {
1380
+                        echo wpinv_html_select( array(
1381
+                            'options'          => array_merge( array( '' => '' ), $states ),
1382
+                            'name'             => 'tax_rates[' . $sanitized_key . '][state]',
1383 1383
                             'id'               => 'tax_rates[' . $sanitized_key . '][state]',
1384
-							'selected'         => $rate['state'],
1385
-							'show_option_all'  => false,
1386
-							'show_option_none' => false,
1387
-							'placeholder'      => __( 'Choose a state', 'invoicing' )
1388
-						) );
1389
-					} else {
1390
-						echo wpinv_html_text( array(
1391
-							'name'  => 'tax_rates[' . $sanitized_key . '][state]', $rate['state'],
1392
-							'value' => ! empty( $rate['state'] ) ? $rate['state'] : '',
1384
+                            'selected'         => $rate['state'],
1385
+                            'show_option_all'  => false,
1386
+                            'show_option_none' => false,
1387
+                            'placeholder'      => __( 'Choose a state', 'invoicing' )
1388
+                        ) );
1389
+                    } else {
1390
+                        echo wpinv_html_text( array(
1391
+                            'name'  => 'tax_rates[' . $sanitized_key . '][state]', $rate['state'],
1392
+                            'value' => ! empty( $rate['state'] ) ? $rate['state'] : '',
1393 1393
                             'id'    => 'tax_rates[' . $sanitized_key . '][state]',
1394
-						) );
1395
-					}
1396
-					?>
1394
+                        ) );
1395
+                    }
1396
+                    ?>
1397 1397
 				</td>
1398 1398
 				<td class="wpinv_tax_global">
1399 1399
 					<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'] ) ); ?>/>
@@ -1408,19 +1408,19 @@  discard block
 block discarded – undo
1408 1408
 			<tr>
1409 1409
 				<td class="wpinv_tax_country">
1410 1410
 					<?php
1411
-					echo wpinv_html_select( array(
1412
-						'options'          => wpinv_get_country_list( true ),
1413
-						'name'             => 'tax_rates[0][country]',
1414
-						'show_option_all'  => false,
1415
-						'show_option_none' => false,
1416
-						'class'            => 'wpinv-tax-country',
1417
-						'placeholder'      => __( 'Choose a country', 'invoicing' )
1418
-					) ); ?>
1411
+                    echo wpinv_html_select( array(
1412
+                        'options'          => wpinv_get_country_list( true ),
1413
+                        'name'             => 'tax_rates[0][country]',
1414
+                        'show_option_all'  => false,
1415
+                        'show_option_none' => false,
1416
+                        'class'            => 'wpinv-tax-country',
1417
+                        'placeholder'      => __( 'Choose a country', 'invoicing' )
1418
+                    ) ); ?>
1419 1419
 				</td>
1420 1420
 				<td class="wpinv_tax_state">
1421 1421
 					<?php echo wpinv_html_text( array(
1422
-						'name' => 'tax_rates[0][state]'
1423
-					) ); ?>
1422
+                        'name' => 'tax_rates[0][state]'
1423
+                    ) ); ?>
1424 1424
 				</td>
1425 1425
 				<td class="wpinv_tax_global">
1426 1426
 					<input type="checkbox" name="tax_rates[0][global]" id="tax_rates[0][global]" value="1"/>
@@ -1435,7 +1435,7 @@  discard block
 block discarded – undo
1435 1435
         <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>
1436 1436
 	</table>
1437 1437
 	<?php
1438
-	echo ob_get_clean();
1438
+    echo ob_get_clean();
1439 1439
 }
1440 1440
 
1441 1441
 function wpinv_tools_callback($args) {
@@ -1463,15 +1463,15 @@  discard block
 block discarded – undo
1463 1463
 }
1464 1464
 
1465 1465
 function wpinv_descriptive_text_callback( $args ) {
1466
-	echo wp_kses_post( $args['desc'] );
1466
+    echo wp_kses_post( $args['desc'] );
1467 1467
 }
1468 1468
 
1469 1469
 function wpinv_hook_callback( $args ) {
1470
-	do_action( 'wpinv_' . $args['id'], $args );
1470
+    do_action( 'wpinv_' . $args['id'], $args );
1471 1471
 }
1472 1472
 
1473 1473
 function wpinv_set_settings_cap() {
1474
-	return 'manage_options';
1474
+    return 'manage_options';
1475 1475
 }
1476 1476
 add_filter( 'option_page_capability_wpinv_settings', 'wpinv_set_settings_cap' );
1477 1477
 
Please login to merge, or discard this patch.