Passed
Push — master ( d100e4...32435e )
by Brian
11:14
created
includes/user-functions.php 1 patch
Spacing   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  * @package GetPaid
7 7
  */
8 8
 
9
-defined( 'ABSPATH' ) || exit;
9
+defined('ABSPATH') || exit;
10 10
 
11 11
 /**
12 12
  *  Generates a users select dropdown.
@@ -16,13 +16,13 @@  discard block
 block discarded – undo
16 16
  * @param array $args
17 17
  * @see wp_dropdown_users
18 18
  */
19
-function wpinv_dropdown_users( $args = '' ) {
19
+function wpinv_dropdown_users($args = '') {
20 20
 
21
-    if ( is_array( $args ) && ! empty( $args['show'] ) && 'display_name_with_email' == $args['show'] ) {
21
+    if (is_array($args) && !empty($args['show']) && 'display_name_with_email' == $args['show']) {
22 22
         $args['show'] = 'display_name_with_login';
23 23
     }
24 24
 
25
-    return wp_dropdown_users( $args );
25
+    return wp_dropdown_users($args);
26 26
 }
27 27
 
28 28
 /**
@@ -32,9 +32,9 @@  discard block
 block discarded – undo
32 32
  * @return string capability to check against
33 33
  * @param string $capalibilty Optional. The alternative capability to check against.
34 34
  */
35
-function wpinv_get_capability( $capalibilty = 'manage_invoicing' ) {
35
+function wpinv_get_capability($capalibilty = 'manage_invoicing') {
36 36
 
37
-	if ( current_user_can( 'manage_options' ) ) {
37
+	if (current_user_can('manage_options')) {
38 38
 		return 'manage_options';
39 39
 	};
40 40
 
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
  * @return bool
49 49
  */
50 50
 function wpinv_current_user_can_manage_invoicing() {
51
-    return current_user_can( wpinv_get_capability() );
51
+    return current_user_can(wpinv_get_capability());
52 52
 }
53 53
 
54 54
 /**
@@ -57,17 +57,17 @@  discard block
 block discarded – undo
57 57
  * @since 1.0.19
58 58
  * @return int|WP_Error
59 59
  */
60
-function wpinv_create_user( $email ) {
60
+function wpinv_create_user($email) {
61 61
 
62 62
     // Prepare user values.
63 63
 	$args = array(
64
-		'user_login' => wpinv_generate_user_name( $email ),
64
+		'user_login' => wpinv_generate_user_name($email),
65 65
 		'user_pass'  => wp_generate_password(),
66 66
 		'user_email' => $email,
67 67
         'role'       => 'subscriber',
68 68
     );
69 69
 
70
-    return wp_insert_user( $args );
70
+    return wp_insert_user($args);
71 71
 
72 72
 }
73 73
 
@@ -77,22 +77,22 @@  discard block
 block discarded – undo
77 77
  * @since 1.0.19
78 78
  * @return bool|WP_User
79 79
  */
80
-function wpinv_generate_user_name( $prefix = '' ) {
80
+function wpinv_generate_user_name($prefix = '') {
81 81
 
82 82
     // If prefix is an email, retrieve the part before the email.
83
-	$prefix = strtok( $prefix, '@' );
83
+	$prefix = strtok($prefix, '@');
84 84
 
85 85
 	// Trim to 4 characters max.
86
-	$prefix = sanitize_user( $prefix );
86
+	$prefix = sanitize_user($prefix);
87 87
 
88
-	$illegal_logins = (array) apply_filters( 'illegal_user_logins', array() );
89
-	if ( empty( $prefix ) || in_array( strtolower( $prefix ), array_map( 'strtolower', $illegal_logins ), true ) ) {
88
+	$illegal_logins = (array) apply_filters('illegal_user_logins', array());
89
+	if (empty($prefix) || in_array(strtolower($prefix), array_map('strtolower', $illegal_logins), true)) {
90 90
 		$prefix = 'gtp';
91 91
 	}
92 92
 
93
-	$username = $prefix . '_' . zeroise( wp_rand( 0, 9999 ), 4 );
94
-	if ( username_exists( $username ) ) {
95
-		return wpinv_generate_user_name( $username );
93
+	$username = $prefix . '_' . zeroise(wp_rand(0, 9999), 4);
94
+	if (username_exists($username)) {
95
+		return wpinv_generate_user_name($username);
96 96
 	}
97 97
 
98 98
     return $username;
@@ -110,19 +110,19 @@  discard block
 block discarded – undo
110 110
 
111 111
         // Slug - invoices.
112 112
         'invoices'      => array(
113
-            'label'     => __( 'Invoices', 'invoicing' ), // Name of the tab.
113
+            'label'     => __('Invoices', 'invoicing'), // Name of the tab.
114 114
             'content'   => '[wpinv_history]', // Content of the tab. Or specify "callback" to provide a callback instead.
115 115
             'icon'      => 'fas fa-file-invoice', // Shown on some profile plugins.
116 116
         ),
117 117
 
118 118
         'subscriptions' => array(
119
-            'label'     => __( 'Subscriptions', 'invoicing' ),
119
+            'label'     => __('Subscriptions', 'invoicing'),
120 120
             'content'   => '[wpinv_subscriptions]',
121 121
             'icon'      => 'fas fa-redo',
122 122
         )
123 123
     );
124 124
 
125
-    return apply_filters( 'getpaid_user_content_tabs', $tabs );
125
+    return apply_filters('getpaid_user_content_tabs', $tabs);
126 126
 }
127 127
 
128 128
 /**
@@ -132,19 +132,19 @@  discard block
 block discarded – undo
132 132
  * @param array $tab
133 133
  * @return array
134 134
  */
135
-function getpaid_prepare_user_content_tab( $tab ) {
135
+function getpaid_prepare_user_content_tab($tab) {
136 136
 
137
-    if ( ! empty( $tab['callback'] ) ) {
138
-        return call_user_func( $tab['callback'] );
137
+    if (!empty($tab['callback'])) {
138
+        return call_user_func($tab['callback']);
139 139
     }
140 140
 
141
-    if ( ! empty( $tab['content'] ) ) {
142
-        return convert_smilies( capital_P_dangit( wp_filter_content_tags( do_shortcode( shortcode_unautop( wpautop( wptexturize( do_blocks( $tab['content'] ) ) ) ) ) ) ) );
141
+    if (!empty($tab['content'])) {
142
+        return convert_smilies(capital_P_dangit(wp_filter_content_tags(do_shortcode(shortcode_unautop(wpautop(wptexturize(do_blocks($tab['content']))))))));
143 143
     }
144 144
 
145 145
     $notice = aui()->alert(
146 146
         array(
147
-            'content'     => __( 'This tab has no content or content callback.', 'invoicing' ),
147
+            'content'     => __('This tab has no content or content callback.', 'invoicing'),
148 148
             'type'        => 'error',
149 149
         )
150 150
     );
@@ -167,27 +167,27 @@  discard block
 block discarded – undo
167 167
  * @param  array $tabs
168 168
  * @return array
169 169
  */
170
-function getpaid_filter_userswp_account_tabs( $tabs ) {
170
+function getpaid_filter_userswp_account_tabs($tabs) {
171 171
 
172 172
     // Abort if the integration is inactive.
173
-    if ( ! getpaid_is_userswp_integration_active() ) {
173
+    if (!getpaid_is_userswp_integration_active()) {
174 174
         return $tabs;
175 175
     }
176 176
 
177
-    $new_tabs   = array();
177
+    $new_tabs = array();
178 178
 
179
-    foreach ( getpaid_get_user_content_tabs() as $slug => $tab ) {
179
+    foreach (getpaid_get_user_content_tabs() as $slug => $tab) {
180 180
 
181
-        $new_tabs[ $slug ] = array(
182
-            'title' => $tab[ 'label'],
183
-            'icon'  =>  $tab[ 'icon'],
181
+        $new_tabs[$slug] = array(
182
+            'title' => $tab['label'],
183
+            'icon'  =>  $tab['icon'],
184 184
         );
185 185
 
186 186
     }
187 187
 
188
-    return array_merge( $new_tabs, $tabs );
188
+    return array_merge($new_tabs, $tabs);
189 189
 }
190
-add_filter( 'uwp_account_available_tabs', 'getpaid_filter_userswp_account_tabs' );
190
+add_filter('uwp_account_available_tabs', 'getpaid_filter_userswp_account_tabs');
191 191
 
192 192
 /**
193 193
  * Display our UsersWP account tabs.
@@ -196,16 +196,16 @@  discard block
 block discarded – undo
196 196
  * @param  array $tabs
197 197
  * @return array
198 198
  */
199
-function getpaid_display_userswp_account_tabs( $tab ) {
199
+function getpaid_display_userswp_account_tabs($tab) {
200 200
 
201 201
     $our_tabs = getpaid_get_user_content_tabs();
202 202
 
203
-    if ( getpaid_is_userswp_integration_active() && isset( $our_tabs[ $tab ] ) ) {
204
-        echo getpaid_prepare_user_content_tab( $our_tabs[ $tab ] );
203
+    if (getpaid_is_userswp_integration_active() && isset($our_tabs[$tab])) {
204
+        echo getpaid_prepare_user_content_tab($our_tabs[$tab]);
205 205
     }
206 206
 
207 207
 }
208
-add_action( 'uwp_account_form_display', 'getpaid_display_userswp_account_tabs' );
208
+add_action('uwp_account_form_display', 'getpaid_display_userswp_account_tabs');
209 209
 
210 210
 
211 211
 /**
@@ -216,17 +216,17 @@  discard block
 block discarded – undo
216 216
  * @param  string $tab   Current tab.
217 217
  * @return string Title.
218 218
  */
219
-function getpaid_filter_userswp_account_title( $title, $tab ) {
219
+function getpaid_filter_userswp_account_title($title, $tab) {
220 220
 
221
-    $our_tabs   = getpaid_get_user_content_tabs();
221
+    $our_tabs = getpaid_get_user_content_tabs();
222 222
 
223
-    if ( getpaid_is_userswp_integration_active() && isset( $our_tabs[ $tab ] ) ) {
224
-        return $our_tabs[ $tab ]['label'];
223
+    if (getpaid_is_userswp_integration_active() && isset($our_tabs[$tab])) {
224
+        return $our_tabs[$tab]['label'];
225 225
     }
226 226
 
227 227
     return $title;
228 228
 }
229
-add_filter( 'uwp_account_page_title', 'getpaid_filter_userswp_account_title', 10, 2 );
229
+add_filter('uwp_account_page_title', 'getpaid_filter_userswp_account_title', 10, 2);
230 230
 
231 231
 /**
232 232
  * Registers the UsersWP integration settings.
@@ -235,26 +235,26 @@  discard block
 block discarded – undo
235 235
  * @param  array $settings An array of integration settings.
236 236
  * @return array
237 237
  */
238
-function getpaid_register_userswp_settings( $settings ) {
238
+function getpaid_register_userswp_settings($settings) {
239 239
 
240
-    if ( defined( 'USERSWP_PLUGIN_FILE' ) ) {
240
+    if (defined('USERSWP_PLUGIN_FILE')) {
241 241
 
242 242
         $settings[] = array(
243 243
 
244 244
             'id'       => 'userswp',
245
-            'label'    => __( 'UsersWP', 'invoicing' ),
245
+            'label'    => __('UsersWP', 'invoicing'),
246 246
             'settings' => array(
247 247
 
248 248
                 'userswp_settings' => array(
249 249
                     'id'   => 'userswp_settings',
250
-                    'name' => '<h3>' . __( 'UsersWP', 'invoicing' ) . '</h3>',
250
+                    'name' => '<h3>' . __('UsersWP', 'invoicing') . '</h3>',
251 251
                     'type' => 'header',
252 252
                 ),
253 253
 
254 254
                 'enable_userswp' => array(
255 255
                     'id'         => 'enable_userswp',
256
-                    'name'       => __( 'Enable Integration', 'invoicing' ),
257
-                    'desc'       => __( 'Display GetPaid items on UsersWP account page.', 'invoicing' ),
256
+                    'name'       => __('Enable Integration', 'invoicing'),
257
+                    'desc'       => __('Display GetPaid items on UsersWP account page.', 'invoicing'),
258 258
                     'type'       => 'checkbox',
259 259
                     'std'        => 1,
260 260
                 )
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 
268 268
     return $settings;
269 269
 }
270
-add_filter( 'getpaid_integration_settings', 'getpaid_register_userswp_settings' );
270
+add_filter('getpaid_integration_settings', 'getpaid_register_userswp_settings');
271 271
 
272 272
 /**
273 273
  * Checks if the integration is enabled.
@@ -276,6 +276,6 @@  discard block
 block discarded – undo
276 276
  * @return bool
277 277
  */
278 278
 function getpaid_is_userswp_integration_active() {
279
-    $enabled = wpinv_get_option( 'enable_userswp', 1 );
280
-    return defined( 'USERSWP_PLUGIN_FILE' ) && ! empty( $enabled );
279
+    $enabled = wpinv_get_option('enable_userswp', 1);
280
+    return defined('USERSWP_PLUGIN_FILE') && !empty($enabled);
281 281
 }
Please login to merge, or discard this patch.
includes/admin/register-settings.php 2 patches
Indentation   +317 added lines, -317 removed lines patch added patch discarded remove patch
@@ -196,11 +196,11 @@  discard block
 block discarded – undo
196 196
     $cb      = "wpinv_{$option['type']}_callback";
197 197
     $section = "wpinv_settings_{$tab}_$section";
198 198
 
199
-	if ( isset( $option['desc'] ) && ! empty( $option['help-tip'] ) ) {
200
-		$tip   = esc_attr( $option['desc'] );
201
-		$name .= "<span class='dashicons dashicons-editor-help wpi-help-tip' title='$tip'></span>";
202
-		unset( $option['desc'] );
203
-	}
199
+    if ( isset( $option['desc'] ) && ! empty( $option['help-tip'] ) ) {
200
+        $tip   = esc_attr( $option['desc'] );
201
+        $name .= "<span class='dashicons dashicons-editor-help wpi-help-tip' title='$tip'></span>";
202
+        unset( $option['desc'] );
203
+    }
204 204
 
205 205
     // Loop through all tabs.
206 206
     add_settings_field(
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
  * @return array
242 242
  */
243 243
 function wpinv_get_registered_settings() {
244
-	return array_filter( apply_filters( 'wpinv_registered_settings', wpinv_get_data( 'admin-settings' ) ) );
244
+    return array_filter( apply_filters( 'wpinv_registered_settings', wpinv_get_data( 'admin-settings' ) ) );
245 245
 }
246 246
 
247 247
 /**
@@ -288,10 +288,10 @@  discard block
 block discarded – undo
288 288
         }
289 289
 
290 290
         // General filter
291
-		$input[ $key ] = apply_filters( 'wpinv_settings_sanitize', $input[ $key ], $key );
291
+        $input[ $key ] = apply_filters( 'wpinv_settings_sanitize', $input[ $key ], $key );
292 292
 
293
-		// Key specific filter.
294
-		$input[ $key ] = apply_filters( "wpinv_settings_sanitize_$key", $input[ $key ] );
293
+        // Key specific filter.
294
+        $input[ $key ] = apply_filters( "wpinv_settings_sanitize_$key", $input[ $key ] );
295 295
     }
296 296
 
297 297
     // Loop through the whitelist and unset any that are empty for the tab being saved
@@ -347,14 +347,14 @@  discard block
 block discarded – undo
347 347
 
348 348
     foreach ( $new_rates as $rate ) {
349 349
 
350
-		$rate['rate']    = wpinv_sanitize_amount( $rate['rate'] );
351
-		$rate['name']    = sanitize_text_field( $rate['name'] );
352
-		$rate['state']   = sanitize_text_field( $rate['state'] );
353
-		$rate['country'] = sanitize_text_field( $rate['country'] );
354
-		$rate['global']  = empty( $rate['state'] );
355
-		$tax_rates[]     = $rate;
350
+        $rate['rate']    = wpinv_sanitize_amount( $rate['rate'] );
351
+        $rate['name']    = sanitize_text_field( $rate['name'] );
352
+        $rate['state']   = sanitize_text_field( $rate['state'] );
353
+        $rate['country'] = sanitize_text_field( $rate['country'] );
354
+        $rate['global']  = empty( $rate['state'] );
355
+        $tax_rates[]     = $rate;
356 356
 
357
-	}
357
+    }
358 358
 
359 359
     update_option( 'wpinv_tax_rates', $tax_rates );
360 360
 
@@ -372,11 +372,11 @@  discard block
 block discarded – undo
372 372
     $tabs['general']  = __( 'General', 'invoicing' );
373 373
     $tabs['gateways'] = __( 'Payment Gateways', 'invoicing' );
374 374
     $tabs['taxes']    = __( 'Taxes', 'invoicing' );
375
-	$tabs['emails']   = __( 'Emails', 'invoicing' );
375
+    $tabs['emails']   = __( 'Emails', 'invoicing' );
376 376
 
377
-	if ( count( getpaid_get_integration_settings() ) > 0 ) {
378
-		$tabs['integrations'] = __( 'Integrations', 'invoicing' );
379
-	}
377
+    if ( count( getpaid_get_integration_settings() ) > 0 ) {
378
+        $tabs['integrations'] = __( 'Integrations', 'invoicing' );
379
+    }
380 380
 
381 381
     $tabs['privacy']  = __( 'Privacy', 'invoicing' );
382 382
     $tabs['misc']     = __( 'Misc', 'invoicing' );
@@ -416,14 +416,14 @@  discard block
 block discarded – undo
416 416
         ) ),
417 417
         'taxes' => apply_filters( 'wpinv_settings_sections_taxes', array(
418 418
             'main'  => __( 'Tax Settings', 'invoicing' ),
419
-			'rates' => __( 'Tax Rates', 'invoicing' ),
420
-			'vat'   => __( 'EU VAT Settings', 'invoicing' )
419
+            'rates' => __( 'Tax Rates', 'invoicing' ),
420
+            'vat'   => __( 'EU VAT Settings', 'invoicing' )
421 421
         ) ),
422 422
         'emails' => apply_filters( 'wpinv_settings_sections_emails', array(
423 423
             'main' => __( 'Email Settings', 'invoicing' ),
424
-		) ),
424
+        ) ),
425 425
 
426
-		'integrations' => wp_list_pluck( getpaid_get_integration_settings(), 'label', 'id' ),
426
+        'integrations' => wp_list_pluck( getpaid_get_integration_settings(), 'label', 'id' ),
427 427
 
428 428
         'privacy' => apply_filters( 'wpinv_settings_sections_privacy', array(
429 429
             'main' => __( 'Privacy policy', 'invoicing' ),
@@ -443,51 +443,51 @@  discard block
 block discarded – undo
443 443
 }
444 444
 
445 445
 function wpinv_get_pages( $with_slug = false, $default_label = NULL ) {
446
-	$pages_options = array();
446
+    $pages_options = array();
447 447
 
448
-	if( $default_label !== NULL && $default_label !== false ) {
449
-		$pages_options = array( '' => $default_label ); // Blank option
450
-	}
448
+    if( $default_label !== NULL && $default_label !== false ) {
449
+        $pages_options = array( '' => $default_label ); // Blank option
450
+    }
451 451
 
452
-	$pages = get_pages();
453
-	if ( $pages ) {
454
-		foreach ( $pages as $page ) {
455
-			$title = $with_slug ? $page->post_title . ' (' . $page->post_name . ')' : $page->post_title;
452
+    $pages = get_pages();
453
+    if ( $pages ) {
454
+        foreach ( $pages as $page ) {
455
+            $title = $with_slug ? $page->post_title . ' (' . $page->post_name . ')' : $page->post_title;
456 456
             $pages_options[ $page->ID ] = $title;
457
-		}
458
-	}
457
+        }
458
+    }
459 459
 
460
-	return $pages_options;
460
+    return $pages_options;
461 461
 }
462 462
 
463 463
 function wpinv_header_callback( $args ) {
464
-	if ( !empty( $args['desc'] ) ) {
464
+    if ( !empty( $args['desc'] ) ) {
465 465
         echo $args['desc'];
466 466
     }
467 467
 }
468 468
 
469 469
 function wpinv_hidden_callback( $args ) {
470
-	global $wpinv_options;
471
-
472
-	if ( isset( $args['set_value'] ) ) {
473
-		$value = $args['set_value'];
474
-	} elseif ( isset( $wpinv_options[ $args['id'] ] ) ) {
475
-		$value = $wpinv_options[ $args['id'] ];
476
-	} else {
477
-		$value = isset( $args['std'] ) ? $args['std'] : '';
478
-	}
479
-
480
-	if ( isset( $args['faux'] ) && true === $args['faux'] ) {
481
-		$args['readonly'] = true;
482
-		$value = isset( $args['std'] ) ? $args['std'] : '';
483
-		$name  = '';
484
-	} else {
485
-		$name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"';
486
-	}
487
-
488
-	$html = '<input type="hidden" id="wpinv_settings[' . wpinv_sanitize_key( $args['id'] ) . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '" />';
470
+    global $wpinv_options;
471
+
472
+    if ( isset( $args['set_value'] ) ) {
473
+        $value = $args['set_value'];
474
+    } elseif ( isset( $wpinv_options[ $args['id'] ] ) ) {
475
+        $value = $wpinv_options[ $args['id'] ];
476
+    } else {
477
+        $value = isset( $args['std'] ) ? $args['std'] : '';
478
+    }
479
+
480
+    if ( isset( $args['faux'] ) && true === $args['faux'] ) {
481
+        $args['readonly'] = true;
482
+        $value = isset( $args['std'] ) ? $args['std'] : '';
483
+        $name  = '';
484
+    } else {
485
+        $name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"';
486
+    }
487
+
488
+    $html = '<input type="hidden" id="wpinv_settings[' . wpinv_sanitize_key( $args['id'] ) . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '" />';
489 489
     
490
-	echo $html;
490
+    echo $html;
491 491
 }
492 492
 
493 493
 /**
@@ -495,12 +495,12 @@  discard block
 block discarded – undo
495 495
  */
496 496
 function wpinv_checkbox_callback( $args ) {
497 497
 
498
-	$std = isset( $args['std'] ) ? $args['std'] : '';
499
-	$std = wpinv_get_option( $args['id'], $std );
500
-	$id  = esc_attr( $args['id'] );
498
+    $std = isset( $args['std'] ) ? $args['std'] : '';
499
+    $std = wpinv_get_option( $args['id'], $std );
500
+    $id  = esc_attr( $args['id'] );
501 501
 
502
-	getpaid_hidden_field( "wpinv_settings[$id]", '0' );
503
-	?>
502
+    getpaid_hidden_field( "wpinv_settings[$id]", '0' );
503
+    ?>
504 504
 		<fieldset>
505 505
 			<label>
506 506
 				<input id="wpinv-settings-<?php echo $id; ?>" name="wpinv_settings[<?php echo $id; ?>]" <?php checked( empty( $std ), false ); ?> value="1" type="checkbox">
@@ -512,77 +512,77 @@  discard block
 block discarded – undo
512 512
 
513 513
 function wpinv_multicheck_callback( $args ) {
514 514
 	
515
-	global $wpinv_options;
515
+    global $wpinv_options;
516 516
 
517
-	$sanitize_id = wpinv_sanitize_key( $args['id'] );
518
-	$class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : '';
517
+    $sanitize_id = wpinv_sanitize_key( $args['id'] );
518
+    $class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : '';
519 519
 
520
-	if ( ! empty( $args['options'] ) ) {
520
+    if ( ! empty( $args['options'] ) ) {
521 521
 
522
-		$std     = isset( $args['std'] ) ? $args['std'] : array();
523
-		$value   = isset( $wpinv_options[ $args['id'] ] ) ? $wpinv_options[ $args['id'] ] : $std;
522
+        $std     = isset( $args['std'] ) ? $args['std'] : array();
523
+        $value   = isset( $wpinv_options[ $args['id'] ] ) ? $wpinv_options[ $args['id'] ] : $std;
524 524
 
525
-		echo '<div class="wpi-mcheck-rows wpi-mcheck-' . $sanitize_id . $class . '">';
525
+        echo '<div class="wpi-mcheck-rows wpi-mcheck-' . $sanitize_id . $class . '">';
526 526
         foreach( $args['options'] as $key => $option ):
527
-			$sanitize_key = wpinv_sanitize_key( $key );
528
-			if ( in_array( $sanitize_key, $value ) ) { 
529
-				$enabled = $sanitize_key;
530
-			} else { 
531
-				$enabled = NULL; 
532
-			}
533
-			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;';
534
-			echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . wp_kses_post( $option ) . '</label></div>';
535
-		endforeach;
536
-		echo '</div>';
537
-		echo '<p class="description">' . $args['desc'] . '</p>';
538
-	}
527
+            $sanitize_key = wpinv_sanitize_key( $key );
528
+            if ( in_array( $sanitize_key, $value ) ) { 
529
+                $enabled = $sanitize_key;
530
+            } else { 
531
+                $enabled = NULL; 
532
+            }
533
+            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;';
534
+            echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . wp_kses_post( $option ) . '</label></div>';
535
+        endforeach;
536
+        echo '</div>';
537
+        echo '<p class="description">' . $args['desc'] . '</p>';
538
+    }
539 539
 }
540 540
 
541 541
 function wpinv_payment_icons_callback( $args ) {
542
-	global $wpinv_options;
542
+    global $wpinv_options;
543 543
     
544 544
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
545 545
 
546
-	if ( ! empty( $args['options'] ) ) {
547
-		foreach( $args['options'] as $key => $option ) {
546
+    if ( ! empty( $args['options'] ) ) {
547
+        foreach( $args['options'] as $key => $option ) {
548 548
             $sanitize_key = wpinv_sanitize_key( $key );
549 549
             
550
-			if( isset( $wpinv_options[$args['id']][$key] ) ) {
551
-				$enabled = $option;
552
-			} else {
553
-				$enabled = NULL;
554
-			}
555
-
556
-			echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" style="margin-right:10px;line-height:16px;height:16px;display:inline-block;">';
557
-
558
-				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;';
559
-
560
-				if ( wpinv_string_is_image_url( $key ) ) {
561
-					echo '<img class="payment-icon" src="' . esc_url( $key ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
562
-				} else {
563
-					$card = strtolower( str_replace( ' ', '', $option ) );
564
-
565
-					if ( has_filter( 'wpinv_accepted_payment_' . $card . '_image' ) ) {
566
-						$image = apply_filters( 'wpinv_accepted_payment_' . $card . '_image', '' );
567
-					} else {
568
-						$image       = wpinv_locate_template( 'images' . DIRECTORY_SEPARATOR . 'icons' . DIRECTORY_SEPARATOR . $card . '.gif', false );
569
-						$content_dir = WP_CONTENT_DIR;
570
-
571
-						if ( function_exists( 'wp_normalize_path' ) ) {
572
-							// Replaces backslashes with forward slashes for Windows systems
573
-							$image = wp_normalize_path( $image );
574
-							$content_dir = wp_normalize_path( $content_dir );
575
-						}
576
-
577
-						$image = str_replace( $content_dir, content_url(), $image );
578
-					}
579
-
580
-					echo '<img class="payment-icon" src="' . esc_url( $image ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
581
-				}
582
-			echo $option . '</label>';
583
-		}
584
-		echo '<p class="description" style="margin-top:16px;">' . wp_kses_post( $args['desc'] ) . '</p>';
585
-	}
550
+            if( isset( $wpinv_options[$args['id']][$key] ) ) {
551
+                $enabled = $option;
552
+            } else {
553
+                $enabled = NULL;
554
+            }
555
+
556
+            echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" style="margin-right:10px;line-height:16px;height:16px;display:inline-block;">';
557
+
558
+                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;';
559
+
560
+                if ( wpinv_string_is_image_url( $key ) ) {
561
+                    echo '<img class="payment-icon" src="' . esc_url( $key ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
562
+                } else {
563
+                    $card = strtolower( str_replace( ' ', '', $option ) );
564
+
565
+                    if ( has_filter( 'wpinv_accepted_payment_' . $card . '_image' ) ) {
566
+                        $image = apply_filters( 'wpinv_accepted_payment_' . $card . '_image', '' );
567
+                    } else {
568
+                        $image       = wpinv_locate_template( 'images' . DIRECTORY_SEPARATOR . 'icons' . DIRECTORY_SEPARATOR . $card . '.gif', false );
569
+                        $content_dir = WP_CONTENT_DIR;
570
+
571
+                        if ( function_exists( 'wp_normalize_path' ) ) {
572
+                            // Replaces backslashes with forward slashes for Windows systems
573
+                            $image = wp_normalize_path( $image );
574
+                            $content_dir = wp_normalize_path( $content_dir );
575
+                        }
576
+
577
+                        $image = str_replace( $content_dir, content_url(), $image );
578
+                    }
579
+
580
+                    echo '<img class="payment-icon" src="' . esc_url( $image ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
581
+                }
582
+            echo $option . '</label>';
583
+        }
584
+        echo '<p class="description" style="margin-top:16px;">' . wp_kses_post( $args['desc'] ) . '</p>';
585
+    }
586 586
 }
587 587
 
588 588
 /**
@@ -590,9 +590,9 @@  discard block
 block discarded – undo
590 590
  */
591 591
 function wpinv_radio_callback( $args ) {
592 592
 
593
-	$std = isset( $args['std'] ) ? $args['std'] : '';
594
-	$std = wpinv_get_option( $args['id'], $std );
595
-	?>
593
+    $std = isset( $args['std'] ) ? $args['std'] : '';
594
+    $std = wpinv_get_option( $args['id'], $std );
595
+    ?>
596 596
 		<fieldset>
597 597
 			<ul id="wpinv-settings-<?php echo esc_attr( $args['id'] ); ?>" style="margin-top: 0;">
598 598
 				<?php foreach( $args['options'] as $key => $option ) : ?>
@@ -606,7 +606,7 @@  discard block
 block discarded – undo
606 606
 			</ul>
607 607
 		</fieldset>
608 608
 	<?php
609
-	getpaid_settings_description_callback( $args );
609
+    getpaid_settings_description_callback( $args );
610 610
 }
611 611
 
612 612
 /**
@@ -614,176 +614,176 @@  discard block
 block discarded – undo
614 614
  */
615 615
 function getpaid_settings_description_callback( $args ) {
616 616
 
617
-	if ( ! empty( $args['desc'] ) ) {
618
-		$description = wp_kses_post( $args['desc'] );
619
-		echo "<p class='description'>$description</p>";
620
-	}
617
+    if ( ! empty( $args['desc'] ) ) {
618
+        $description = wp_kses_post( $args['desc'] );
619
+        echo "<p class='description'>$description</p>";
620
+    }
621 621
 
622 622
 }
623 623
 
624 624
 function wpinv_gateways_callback( $args ) {
625
-	global $wpinv_options;
625
+    global $wpinv_options;
626 626
     
627 627
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
628 628
 
629
-	foreach ( $args['options'] as $key => $option ) :
630
-		$sanitize_key = wpinv_sanitize_key( $key );
629
+    foreach ( $args['options'] as $key => $option ) :
630
+        $sanitize_key = wpinv_sanitize_key( $key );
631 631
         
632 632
         if ( isset( $wpinv_options['gateways'][ $key ] ) )
633
-			$enabled = '1';
634
-		else
635
-			$enabled = null;
633
+            $enabled = '1';
634
+        else
635
+            $enabled = null;
636 636
 
637
-		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;';
638
-		echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html( $option['admin_label'] ) . '</label><br/>';
639
-	endforeach;
637
+        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;';
638
+        echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html( $option['admin_label'] ) . '</label><br/>';
639
+    endforeach;
640 640
 }
641 641
 
642 642
 function wpinv_gateway_select_callback($args) {
643
-	global $wpinv_options;
643
+    global $wpinv_options;
644 644
     
645 645
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
646 646
     $class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : '';
647 647
 
648
-	echo '<select name="wpinv_settings[' . $sanitize_id . ']"" id="wpinv_settings[' . $sanitize_id . ']" class="'.$class.'" >';
648
+    echo '<select name="wpinv_settings[' . $sanitize_id . ']"" id="wpinv_settings[' . $sanitize_id . ']" class="'.$class.'" >';
649 649
 
650
-	foreach ( $args['options'] as $key => $option ) :
651
-		if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) {
650
+    foreach ( $args['options'] as $key => $option ) :
651
+        if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) {
652 652
             $selected = selected( $key, $args['selected'], false );
653 653
         } else {
654 654
             $selected = isset( $wpinv_options[ $args['id'] ] ) ? selected( $key, $wpinv_options[$args['id']], false ) : '';
655 655
         }
656
-		echo '<option value="' . wpinv_sanitize_key( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>';
657
-	endforeach;
656
+        echo '<option value="' . wpinv_sanitize_key( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>';
657
+    endforeach;
658 658
 
659
-	echo '</select>';
660
-	echo '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
659
+    echo '</select>';
660
+    echo '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
661 661
 }
662 662
 
663 663
 function wpinv_text_callback( $args ) {
664
-	global $wpinv_options;
664
+    global $wpinv_options;
665 665
     
666 666
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
667 667
 
668
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
669
-		$value = $wpinv_options[ $args['id'] ];
670
-	} else {
671
-		$value = isset( $args['std'] ) ? $args['std'] : '';
672
-	}
673
-
674
-	if ( isset( $args['faux'] ) && true === $args['faux'] ) {
675
-		$args['readonly'] = true;
676
-		$value = isset( $args['std'] ) ? $args['std'] : '';
677
-		$name  = '';
678
-	} else {
679
-		$name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"';
680
-	}
681
-	$class = !empty( $args['class'] ) ? sanitize_html_class( $args['class'] ) : '';
682
-
683
-	$readonly = $args['readonly'] === true ? ' readonly="readonly"' : '';
684
-	$size     = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
685
-	$html     = '<input type="text" class="' . sanitize_html_class( $size ) . '-text ' . $class . '" id="wpinv_settings[' . $sanitize_id . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '"' . $readonly . '/>';
686
-	$html    .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
687
-
688
-	echo $html;
668
+    if ( isset( $wpinv_options[ $args['id'] ] ) ) {
669
+        $value = $wpinv_options[ $args['id'] ];
670
+    } else {
671
+        $value = isset( $args['std'] ) ? $args['std'] : '';
672
+    }
673
+
674
+    if ( isset( $args['faux'] ) && true === $args['faux'] ) {
675
+        $args['readonly'] = true;
676
+        $value = isset( $args['std'] ) ? $args['std'] : '';
677
+        $name  = '';
678
+    } else {
679
+        $name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"';
680
+    }
681
+    $class = !empty( $args['class'] ) ? sanitize_html_class( $args['class'] ) : '';
682
+
683
+    $readonly = $args['readonly'] === true ? ' readonly="readonly"' : '';
684
+    $size     = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
685
+    $html     = '<input type="text" class="' . sanitize_html_class( $size ) . '-text ' . $class . '" id="wpinv_settings[' . $sanitize_id . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '"' . $readonly . '/>';
686
+    $html    .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
687
+
688
+    echo $html;
689 689
 }
690 690
 
691 691
 function wpinv_number_callback( $args ) {
692
-	global $wpinv_options;
692
+    global $wpinv_options;
693 693
     
694 694
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
695 695
 
696
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
697
-		$value = $wpinv_options[ $args['id'] ];
698
-	} else {
699
-		$value = isset( $args['std'] ) ? $args['std'] : '';
700
-	}
701
-
702
-	if ( isset( $args['faux'] ) && true === $args['faux'] ) {
703
-		$args['readonly'] = true;
704
-		$value = isset( $args['std'] ) ? $args['std'] : '';
705
-		$name  = '';
706
-	} else {
707
-		$name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"';
708
-	}
709
-
710
-	$max  = isset( $args['max'] ) ? $args['max'] : 999999;
711
-	$min  = isset( $args['min'] ) ? $args['min'] : 0;
712
-	$step = isset( $args['step'] ) ? $args['step'] : 1;
713
-	$class = !empty( $args['class'] ) ? sanitize_html_class( $args['class'] ) : '';
714
-
715
-	$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
716
-	$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 ) ) . '"/>';
717
-	$html .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
718
-
719
-	echo $html;
696
+    if ( isset( $wpinv_options[ $args['id'] ] ) ) {
697
+        $value = $wpinv_options[ $args['id'] ];
698
+    } else {
699
+        $value = isset( $args['std'] ) ? $args['std'] : '';
700
+    }
701
+
702
+    if ( isset( $args['faux'] ) && true === $args['faux'] ) {
703
+        $args['readonly'] = true;
704
+        $value = isset( $args['std'] ) ? $args['std'] : '';
705
+        $name  = '';
706
+    } else {
707
+        $name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"';
708
+    }
709
+
710
+    $max  = isset( $args['max'] ) ? $args['max'] : 999999;
711
+    $min  = isset( $args['min'] ) ? $args['min'] : 0;
712
+    $step = isset( $args['step'] ) ? $args['step'] : 1;
713
+    $class = !empty( $args['class'] ) ? sanitize_html_class( $args['class'] ) : '';
714
+
715
+    $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
716
+    $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 ) ) . '"/>';
717
+    $html .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
718
+
719
+    echo $html;
720 720
 }
721 721
 
722 722
 function wpinv_textarea_callback( $args ) {
723
-	global $wpinv_options;
723
+    global $wpinv_options;
724 724
     
725 725
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
726 726
 
727
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
728
-		$value = $wpinv_options[ $args['id'] ];
729
-	} else {
730
-		$value = isset( $args['std'] ) ? $args['std'] : '';
731
-	}
727
+    if ( isset( $wpinv_options[ $args['id'] ] ) ) {
728
+        $value = $wpinv_options[ $args['id'] ];
729
+    } else {
730
+        $value = isset( $args['std'] ) ? $args['std'] : '';
731
+    }
732 732
     
733 733
     $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
734 734
     $class = ( isset( $args['class'] ) && ! is_null( $args['class'] ) ) ? $args['class'] : 'large-text';
735 735
 
736
-	$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>';
737
-	$html .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
736
+    $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>';
737
+    $html .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
738 738
 
739
-	echo $html;
739
+    echo $html;
740 740
 }
741 741
 
742 742
 function wpinv_password_callback( $args ) {
743
-	global $wpinv_options;
743
+    global $wpinv_options;
744 744
     
745 745
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
746 746
 
747
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
748
-		$value = $wpinv_options[ $args['id'] ];
749
-	} else {
750
-		$value = isset( $args['std'] ) ? $args['std'] : '';
751
-	}
747
+    if ( isset( $wpinv_options[ $args['id'] ] ) ) {
748
+        $value = $wpinv_options[ $args['id'] ];
749
+    } else {
750
+        $value = isset( $args['std'] ) ? $args['std'] : '';
751
+    }
752 752
 
753
-	$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
754
-	$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 ) . '"/>';
755
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
753
+    $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
754
+    $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 ) . '"/>';
755
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
756 756
 
757
-	echo $html;
757
+    echo $html;
758 758
 }
759 759
 
760 760
 function wpinv_missing_callback($args) {
761
-	printf(
762
-		__( 'The callback function used for the %s setting is missing.', 'invoicing' ),
763
-		'<strong>' . $args['id'] . '</strong>'
764
-	);
761
+    printf(
762
+        __( 'The callback function used for the %s setting is missing.', 'invoicing' ),
763
+        '<strong>' . $args['id'] . '</strong>'
764
+    );
765 765
 }
766 766
 
767 767
 function wpinv_select_callback($args) {
768
-	global $wpinv_options;
768
+    global $wpinv_options;
769 769
     
770 770
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
771 771
 
772
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
773
-		$value = $wpinv_options[ $args['id'] ];
774
-	} else {
775
-		$value = isset( $args['std'] ) ? $args['std'] : '';
776
-	}
772
+    if ( isset( $wpinv_options[ $args['id'] ] ) ) {
773
+        $value = $wpinv_options[ $args['id'] ];
774
+    } else {
775
+        $value = isset( $args['std'] ) ? $args['std'] : '';
776
+    }
777 777
     
778 778
     if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) {
779 779
         $value = $args['selected'];
780 780
     }
781 781
 
782
-	if ( isset( $args['placeholder'] ) ) {
783
-		$placeholder = $args['placeholder'];
784
-	} else {
785
-		$placeholder = '';
786
-	}
782
+    if ( isset( $args['placeholder'] ) ) {
783
+        $placeholder = $args['placeholder'];
784
+    } else {
785
+        $placeholder = '';
786
+    }
787 787
     
788 788
     if( !empty( $args['onchange'] ) ) {
789 789
         $onchange = ' onchange="' . esc_attr( $args['onchange'] ) . '"';
@@ -793,137 +793,137 @@  discard block
 block discarded – undo
793 793
 
794 794
     $class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : '';
795 795
 
796
-	$html = '<select id="wpinv_settings[' . $sanitize_id . ']" class="'.$class.'"  name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" data-placeholder="' . esc_html( $placeholder ) . '"' . $onchange . ' />';
796
+    $html = '<select id="wpinv_settings[' . $sanitize_id . ']" class="'.$class.'"  name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" data-placeholder="' . esc_html( $placeholder ) . '"' . $onchange . ' />';
797 797
 
798
-	foreach ( $args['options'] as $option => $name ) {
799
-		$selected = selected( $option, $value, false );
800
-		$html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>';
801
-	}
798
+    foreach ( $args['options'] as $option => $name ) {
799
+        $selected = selected( $option, $value, false );
800
+        $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>';
801
+    }
802 802
 
803
-	$html .= '</select>';
804
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
803
+    $html .= '</select>';
804
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
805 805
 
806
-	echo $html;
806
+    echo $html;
807 807
 }
808 808
 
809 809
 function wpinv_color_select_callback( $args ) {
810
-	global $wpinv_options;
810
+    global $wpinv_options;
811 811
     
812 812
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
813 813
 
814
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
815
-		$value = $wpinv_options[ $args['id'] ];
816
-	} else {
817
-		$value = isset( $args['std'] ) ? $args['std'] : '';
818
-	}
814
+    if ( isset( $wpinv_options[ $args['id'] ] ) ) {
815
+        $value = $wpinv_options[ $args['id'] ];
816
+    } else {
817
+        $value = isset( $args['std'] ) ? $args['std'] : '';
818
+    }
819 819
 
820
-	$html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"/>';
820
+    $html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"/>';
821 821
 
822
-	foreach ( $args['options'] as $option => $color ) {
823
-		$selected = selected( $option, $value, false );
824
-		$html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $color['label'] ) . '</option>';
825
-	}
822
+    foreach ( $args['options'] as $option => $color ) {
823
+        $selected = selected( $option, $value, false );
824
+        $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $color['label'] ) . '</option>';
825
+    }
826 826
 
827
-	$html .= '</select>';
828
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
827
+    $html .= '</select>';
828
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
829 829
 
830
-	echo $html;
830
+    echo $html;
831 831
 }
832 832
 
833 833
 function wpinv_rich_editor_callback( $args ) {
834
-	global $wpinv_options, $wp_version;
834
+    global $wpinv_options, $wp_version;
835 835
     
836 836
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
837 837
 
838
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
839
-		$value = $wpinv_options[ $args['id'] ];
838
+    if ( isset( $wpinv_options[ $args['id'] ] ) ) {
839
+        $value = $wpinv_options[ $args['id'] ];
840 840
 
841
-		if( empty( $args['allow_blank'] ) && empty( $value ) ) {
842
-			$value = isset( $args['std'] ) ? $args['std'] : '';
843
-		}
844
-	} else {
845
-		$value = isset( $args['std'] ) ? $args['std'] : '';
846
-	}
841
+        if( empty( $args['allow_blank'] ) && empty( $value ) ) {
842
+            $value = isset( $args['std'] ) ? $args['std'] : '';
843
+        }
844
+    } else {
845
+        $value = isset( $args['std'] ) ? $args['std'] : '';
846
+    }
847 847
 
848
-	$rows = isset( $args['size'] ) ? $args['size'] : 20;
848
+    $rows = isset( $args['size'] ) ? $args['size'] : 20;
849 849
 
850
-	$html = '<div class="getpaid-settings-editor-input">';
851
-	if ( $wp_version >= 3.3 && function_exists( 'wp_editor' ) ) {
852
-		ob_start();
853
-		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 ) );
854
-		$html .= ob_get_clean();
855
-	} else {
856
-		$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>';
857
-	}
850
+    $html = '<div class="getpaid-settings-editor-input">';
851
+    if ( $wp_version >= 3.3 && function_exists( 'wp_editor' ) ) {
852
+        ob_start();
853
+        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 ) );
854
+        $html .= ob_get_clean();
855
+    } else {
856
+        $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>';
857
+    }
858 858
 
859
-	$html .= '</div><br/><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
859
+    $html .= '</div><br/><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
860 860
 
861
-	echo $html;
861
+    echo $html;
862 862
 }
863 863
 
864 864
 function wpinv_upload_callback( $args ) {
865
-	global $wpinv_options;
865
+    global $wpinv_options;
866 866
     
867 867
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
868 868
 
869
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
870
-		$value = $wpinv_options[$args['id']];
871
-	} else {
872
-		$value = isset($args['std']) ? $args['std'] : '';
873
-	}
869
+    if ( isset( $wpinv_options[ $args['id'] ] ) ) {
870
+        $value = $wpinv_options[$args['id']];
871
+    } else {
872
+        $value = isset($args['std']) ? $args['std'] : '';
873
+    }
874 874
 
875
-	$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
876
-	$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 ) ) . '"/>';
877
-	$html .= '<span>&nbsp;<input type="button" class="wpinv_settings_upload_button button-secondary" value="' . __( 'Upload File', 'invoicing' ) . '"/></span>';
878
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
875
+    $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
876
+    $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 ) ) . '"/>';
877
+    $html .= '<span>&nbsp;<input type="button" class="wpinv_settings_upload_button button-secondary" value="' . __( 'Upload File', 'invoicing' ) . '"/></span>';
878
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
879 879
 
880
-	echo $html;
880
+    echo $html;
881 881
 }
882 882
 
883 883
 function wpinv_color_callback( $args ) {
884
-	global $wpinv_options;
884
+    global $wpinv_options;
885 885
     
886 886
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
887 887
 
888
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
889
-		$value = $wpinv_options[ $args['id'] ];
890
-	} else {
891
-		$value = isset( $args['std'] ) ? $args['std'] : '';
892
-	}
888
+    if ( isset( $wpinv_options[ $args['id'] ] ) ) {
889
+        $value = $wpinv_options[ $args['id'] ];
890
+    } else {
891
+        $value = isset( $args['std'] ) ? $args['std'] : '';
892
+    }
893 893
 
894
-	$default = isset( $args['std'] ) ? $args['std'] : '';
894
+    $default = isset( $args['std'] ) ? $args['std'] : '';
895 895
 
896
-	$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 ) . '" />';
897
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
896
+    $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 ) . '" />';
897
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
898 898
 
899
-	echo $html;
899
+    echo $html;
900 900
 }
901 901
 
902 902
 function wpinv_country_states_callback($args) {
903
-	global $wpinv_options;
903
+    global $wpinv_options;
904 904
     
905 905
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
906 906
 
907
-	if ( isset( $args['placeholder'] ) ) {
908
-		$placeholder = $args['placeholder'];
909
-	} else {
910
-		$placeholder = '';
911
-	}
907
+    if ( isset( $args['placeholder'] ) ) {
908
+        $placeholder = $args['placeholder'];
909
+    } else {
910
+        $placeholder = '';
911
+    }
912 912
 
913
-	$states = wpinv_get_country_states();
913
+    $states = wpinv_get_country_states();
914 914
 
915
-	$class = empty( $states ) ? ' class="wpinv-no-states"' : ' class="wpi_select2"';
916
-	$html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"' . $class . 'data-placeholder="' . esc_html( $placeholder ) . '"/>';
915
+    $class = empty( $states ) ? ' class="wpinv-no-states"' : ' class="wpi_select2"';
916
+    $html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"' . $class . 'data-placeholder="' . esc_html( $placeholder ) . '"/>';
917 917
 
918
-	foreach ( $states as $option => $name ) {
919
-		$selected = isset( $wpinv_options[ $args['id'] ] ) ? selected( $option, $wpinv_options[$args['id']], false ) : '';
920
-		$html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>';
921
-	}
918
+    foreach ( $states as $option => $name ) {
919
+        $selected = isset( $wpinv_options[ $args['id'] ] ) ? selected( $option, $wpinv_options[$args['id']], false ) : '';
920
+        $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>';
921
+    }
922 922
 
923
-	$html .= '</select>';
924
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
923
+    $html .= '</select>';
924
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
925 925
 
926
-	echo $html;
926
+    echo $html;
927 927
 }
928 928
 
929 929
 /**
@@ -931,7 +931,7 @@  discard block
 block discarded – undo
931 931
  */
932 932
 function wpinv_tax_rates_callback() {
933 933
 	
934
-	?>
934
+    ?>
935 935
 		</td>
936 936
 	</tr>
937 937
 	<tr class="bsui">
@@ -946,17 +946,17 @@  discard block
 block discarded – undo
946 946
  * Displays a tax rate' edit row.
947 947
  */
948 948
 function wpinv_tax_rate_callback( $tax_rate, $key, $echo = true ) {
949
-	ob_start();
949
+    ob_start();
950 950
 
951
-	$key                      = sanitize_key( $key );
952
-	$tax_rate['reduced_rate'] = empty( $tax_rate['reduced_rate'] ) ? 0 : $tax_rate['reduced_rate'];
953
-	include plugin_dir_path( __FILE__ ) . 'views/html-tax-rate-edit.php';
951
+    $key                      = sanitize_key( $key );
952
+    $tax_rate['reduced_rate'] = empty( $tax_rate['reduced_rate'] ) ? 0 : $tax_rate['reduced_rate'];
953
+    include plugin_dir_path( __FILE__ ) . 'views/html-tax-rate-edit.php';
954 954
 
955
-	if ( $echo ) {
956
-		echo ob_get_clean();
957
-	} else {
958
-		return ob_get_clean(); 
959
-	}
955
+    if ( $echo ) {
956
+        echo ob_get_clean();
957
+    } else {
958
+        return ob_get_clean(); 
959
+    }
960 960
 
961 961
 }
962 962
 
@@ -984,15 +984,15 @@  discard block
 block discarded – undo
984 984
 }
985 985
 
986 986
 function wpinv_descriptive_text_callback( $args ) {
987
-	echo wp_kses_post( $args['desc'] );
987
+    echo wp_kses_post( $args['desc'] );
988 988
 }
989 989
 
990 990
 function wpinv_hook_callback( $args ) {
991
-	do_action( 'wpinv_' . $args['id'], $args );
991
+    do_action( 'wpinv_' . $args['id'], $args );
992 992
 }
993 993
 
994 994
 function wpinv_set_settings_cap() {
995
-	return wpinv_get_capability();
995
+    return wpinv_get_capability();
996 996
 }
997 997
 add_filter( 'option_page_capability_wpinv_settings', 'wpinv_set_settings_cap' );
998 998
 
Please login to merge, or discard this patch.
Spacing   +376 added lines, -376 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  * @since   1.0.0
7 7
  */
8 8
 
9
-defined( 'ABSPATH' ) || exit;
9
+defined('ABSPATH') || exit;
10 10
 
11 11
 /**
12 12
  * Retrieves all default settings.
@@ -16,13 +16,13 @@  discard block
 block discarded – undo
16 16
 function wpinv_get_settings() {
17 17
     $defaults = array();
18 18
 
19
-    foreach ( array_values( wpinv_get_registered_settings() ) as $tab_settings ) {
19
+    foreach (array_values(wpinv_get_registered_settings()) as $tab_settings) {
20 20
 
21
-        foreach ( array_values( $tab_settings ) as $section_settings ) {
21
+        foreach (array_values($tab_settings) as $section_settings) {
22 22
 
23
-            foreach ( $section_settings as $key => $setting ) {
24
-                if ( isset( $setting['std'] ) ) {
25
-                    $defaults[ $key ] = $setting['std'];
23
+            foreach ($section_settings as $key => $setting) {
24
+                if (isset($setting['std'])) {
25
+                    $defaults[$key] = $setting['std'];
26 26
                 }
27 27
             }
28 28
 
@@ -43,12 +43,12 @@  discard block
 block discarded – undo
43 43
     global $wpinv_options;
44 44
 
45 45
     // Try fetching the saved options.
46
-    if ( ! is_array( $wpinv_options ) ) {
47
-        $wpinv_options = get_option( 'wpinv_settings' );
46
+    if (!is_array($wpinv_options)) {
47
+        $wpinv_options = get_option('wpinv_settings');
48 48
     }
49 49
 
50 50
     // If that fails, don't fetch the default settings to prevent a loop.
51
-    if ( ! is_array( $wpinv_options ) ) {
51
+    if (!is_array($wpinv_options)) {
52 52
         $wpinv_options = array();
53 53
     }
54 54
 
@@ -62,13 +62,13 @@  discard block
 block discarded – undo
62 62
  * @param mixed $default The default value to use if the setting has not been set.
63 63
  * @return mixed
64 64
  */
65
-function wpinv_get_option( $key = '', $default = false ) {
65
+function wpinv_get_option($key = '', $default = false) {
66 66
 
67 67
     $options = wpinv_get_options();
68
-    $value   = isset( $options[ $key ] ) ? $options[ $key ] : $default;
69
-    $value   = apply_filters( 'wpinv_get_option', $value, $key, $default );
68
+    $value   = isset($options[$key]) ? $options[$key] : $default;
69
+    $value   = apply_filters('wpinv_get_option', $value, $key, $default);
70 70
 
71
-    return apply_filters( 'wpinv_get_option_' . $key, $value, $key, $default );
71
+    return apply_filters('wpinv_get_option_' . $key, $value, $key, $default);
72 72
 }
73 73
 
74 74
 /**
@@ -77,11 +77,11 @@  discard block
 block discarded – undo
77 77
  * @param array $options the new options.
78 78
  * @return bool
79 79
  */
80
-function wpinv_update_options( $options ) {
80
+function wpinv_update_options($options) {
81 81
     global $wpinv_options;
82 82
 
83 83
     // update the option.
84
-    if ( is_array( $options ) && update_option( 'wpinv_settings', $options ) ) {
84
+    if (is_array($options) && update_option('wpinv_settings', $options)) {
85 85
         $wpinv_options = $options;
86 86
         return true;
87 87
     }
@@ -96,24 +96,24 @@  discard block
 block discarded – undo
96 96
  * @param mixed $value The setting value.
97 97
  * @return bool
98 98
  */
99
-function wpinv_update_option( $key = '', $value = false ) {
99
+function wpinv_update_option($key = '', $value = false) {
100 100
 
101 101
     // If no key, exit.
102
-    if ( empty( $key ) ) {
102
+    if (empty($key)) {
103 103
         return false;
104 104
     }
105 105
 
106 106
     // Maybe delete the option instead.
107
-    if ( is_null( $value ) ) {
108
-        return wpinv_delete_option( $key );
107
+    if (is_null($value)) {
108
+        return wpinv_delete_option($key);
109 109
     }
110 110
 
111 111
     // Prepare the new options.
112 112
     $options         = wpinv_get_options();
113
-    $options[ $key ] = apply_filters( 'wpinv_update_option', $value, $key );
113
+    $options[$key] = apply_filters('wpinv_update_option', $value, $key);
114 114
 
115 115
     // Save the new options.
116
-    return wpinv_update_options( $options );
116
+    return wpinv_update_options($options);
117 117
 
118 118
 }
119 119
 
@@ -123,18 +123,18 @@  discard block
 block discarded – undo
123 123
  * @param string $key the setting key.
124 124
  * @return bool
125 125
  */
126
-function wpinv_delete_option( $key = '' ) {
126
+function wpinv_delete_option($key = '') {
127 127
 
128 128
     // If no key, exit
129
-    if ( empty( $key ) ) {
129
+    if (empty($key)) {
130 130
         return false;
131 131
     }
132 132
 
133 133
     $options = wpinv_get_options();
134 134
 
135
-    if ( isset( $options[ $key ] ) ) {
136
-        unset( $options[ $key ] );
137
-        return wpinv_update_options( $options );
135
+    if (isset($options[$key])) {
136
+        unset($options[$key]);
137
+        return wpinv_update_options($options);
138 138
     }
139 139
 
140 140
     return true;
@@ -148,14 +148,14 @@  discard block
 block discarded – undo
148 148
 function wpinv_register_settings() {
149 149
 
150 150
     // Loop through all tabs.
151
-    foreach ( wpinv_get_registered_settings() as $tab => $sections ) {
151
+    foreach (wpinv_get_registered_settings() as $tab => $sections) {
152 152
 
153 153
         // In each tab, loop through sections.
154
-        foreach ( $sections as $section => $settings ) {
154
+        foreach ($sections as $section => $settings) {
155 155
 
156 156
             // Check for backwards compatibility
157
-            $section_tabs = wpinv_get_settings_tab_sections( $tab );
158
-            if ( ! is_array( $section_tabs ) || ! array_key_exists( $section, $section_tabs ) ) {
157
+            $section_tabs = wpinv_get_settings_tab_sections($tab);
158
+            if (!is_array($section_tabs) || !array_key_exists($section, $section_tabs)) {
159 159
                 $section = 'main';
160 160
                 $settings = $sections;
161 161
             }
@@ -168,9 +168,9 @@  discard block
 block discarded – undo
168 168
                 'wpinv_settings_' . $tab . '_' . $section
169 169
             );
170 170
 
171
-            foreach ( $settings as $option ) {
172
-                if ( ! empty( $option['id'] ) ) {
173
-                    wpinv_register_settings_option( $tab, $section, $option );
171
+            foreach ($settings as $option) {
172
+                if (!empty($option['id'])) {
173
+                    wpinv_register_settings_option($tab, $section, $option);
174 174
                 }
175 175
             }
176 176
 
@@ -178,9 +178,9 @@  discard block
 block discarded – undo
178 178
     }
179 179
 
180 180
     // Creates our settings in the options table.
181
-    register_setting( 'wpinv_settings', 'wpinv_settings', 'wpinv_settings_sanitize' );
181
+    register_setting('wpinv_settings', 'wpinv_settings', 'wpinv_settings_sanitize');
182 182
 }
183
-add_action( 'admin_init', 'wpinv_register_settings' );
183
+add_action('admin_init', 'wpinv_register_settings');
184 184
 
185 185
 /**
186 186
  * Register a single settings option.
@@ -190,46 +190,46 @@  discard block
 block discarded – undo
190 190
  * @param string $option
191 191
  * 
192 192
  */
193
-function wpinv_register_settings_option( $tab, $section, $option ) {
193
+function wpinv_register_settings_option($tab, $section, $option) {
194 194
 
195
-    $name    = isset( $option['name'] ) ? $option['name'] : '';
195
+    $name    = isset($option['name']) ? $option['name'] : '';
196 196
     $cb      = "wpinv_{$option['type']}_callback";
197 197
     $section = "wpinv_settings_{$tab}_$section";
198 198
 
199
-	if ( isset( $option['desc'] ) && ! empty( $option['help-tip'] ) ) {
200
-		$tip   = esc_attr( $option['desc'] );
199
+	if (isset($option['desc']) && !empty($option['help-tip'])) {
200
+		$tip   = esc_attr($option['desc']);
201 201
 		$name .= "<span class='dashicons dashicons-editor-help wpi-help-tip' title='$tip'></span>";
202
-		unset( $option['desc'] );
202
+		unset($option['desc']);
203 203
 	}
204 204
 
205 205
     // Loop through all tabs.
206 206
     add_settings_field(
207 207
         'wpinv_settings[' . $option['id'] . ']',
208 208
         $name,
209
-        function_exists( $cb ) ? $cb : 'wpinv_missing_callback',
209
+        function_exists($cb) ? $cb : 'wpinv_missing_callback',
210 210
         $section,
211 211
         $section,
212 212
         array(
213 213
             'section'     => $section,
214
-            'id'          => isset( $option['id'] )          ? $option['id']          : null,
215
-            'desc'        => isset( $option['desc'] )        ? $option['desc']        : '',
214
+            'id'          => isset($option['id']) ? $option['id'] : null,
215
+            'desc'        => isset($option['desc']) ? $option['desc'] : '',
216 216
             'name'        => $name,
217
-            'size'        => isset( $option['size'] )        ? $option['size']        : null,
218
-            'options'     => isset( $option['options'] )     ? $option['options']     : '',
219
-            'selected'    => isset( $option['selected'] )    ? $option['selected']    : null,
220
-            'std'         => isset( $option['std'] )         ? $option['std']         : '',
221
-            'min'         => isset( $option['min'] )         ? $option['min']         : null,
222
-            'max'         => isset( $option['max'] )         ? $option['max']         : null,
223
-            'step'        => isset( $option['step'] )        ? $option['step']        : null,
224
-            'placeholder' => isset( $option['placeholder'] ) ? $option['placeholder'] : null,
225
-            'allow_blank' => isset( $option['allow_blank'] ) ? $option['allow_blank'] : true,
226
-            'readonly'    => isset( $option['readonly'] )    ? $option['readonly']    : false,
227
-            'faux'        => isset( $option['faux'] )        ? $option['faux']        : false,
228
-            'onchange'    => isset( $option['onchange'] )   ? $option['onchange']     : '',
229
-            'custom'      => isset( $option['custom'] )     ? $option['custom']       : '',
230
-            'class'       => isset( $option['class'] )     ? $option['class']         : '',
231
-            'cols'        => isset( $option['cols'] ) && (int) $option['cols'] > 0 ? (int) $option['cols'] : 50,
232
-            'rows'        => isset( $option['rows'] ) && (int) $option['rows'] > 0 ? (int) $option['rows'] : 5,
217
+            'size'        => isset($option['size']) ? $option['size'] : null,
218
+            'options'     => isset($option['options']) ? $option['options'] : '',
219
+            'selected'    => isset($option['selected']) ? $option['selected'] : null,
220
+            'std'         => isset($option['std']) ? $option['std'] : '',
221
+            'min'         => isset($option['min']) ? $option['min'] : null,
222
+            'max'         => isset($option['max']) ? $option['max'] : null,
223
+            'step'        => isset($option['step']) ? $option['step'] : null,
224
+            'placeholder' => isset($option['placeholder']) ? $option['placeholder'] : null,
225
+            'allow_blank' => isset($option['allow_blank']) ? $option['allow_blank'] : true,
226
+            'readonly'    => isset($option['readonly']) ? $option['readonly'] : false,
227
+            'faux'        => isset($option['faux']) ? $option['faux'] : false,
228
+            'onchange'    => isset($option['onchange']) ? $option['onchange'] : '',
229
+            'custom'      => isset($option['custom']) ? $option['custom'] : '',
230
+            'class'       => isset($option['class']) ? $option['class'] : '',
231
+            'cols'        => isset($option['cols']) && (int) $option['cols'] > 0 ? (int) $option['cols'] : 50,
232
+            'rows'        => isset($option['rows']) && (int) $option['rows'] > 0 ? (int) $option['rows'] : 5,
233 233
         )
234 234
     );
235 235
 
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
  * @return array
242 242
  */
243 243
 function wpinv_get_registered_settings() {
244
-	return array_filter( apply_filters( 'wpinv_registered_settings', wpinv_get_data( 'admin-settings' ) ) );
244
+	return array_filter(apply_filters('wpinv_registered_settings', wpinv_get_data('admin-settings')));
245 245
 }
246 246
 
247 247
 /**
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
  * @return array
251 251
  */
252 252
 function getpaid_get_integration_settings() {
253
-    return apply_filters( 'getpaid_integration_settings', array() );
253
+    return apply_filters('getpaid_integration_settings', array());
254 254
 }
255 255
 
256 256
 /**
@@ -258,140 +258,140 @@  discard block
 block discarded – undo
258 258
  * 
259 259
  * @return array
260 260
  */
261
-function wpinv_settings_sanitize( $input = array() ) {
261
+function wpinv_settings_sanitize($input = array()) {
262 262
 
263 263
     $wpinv_options = wpinv_get_options();
264 264
 
265
-    if ( empty( wp_get_raw_referer() ) ) {
265
+    if (empty(wp_get_raw_referer())) {
266 266
         return $input;
267 267
     }
268 268
 
269
-    wp_parse_str( wp_get_raw_referer(), $referrer );
269
+    wp_parse_str(wp_get_raw_referer(), $referrer);
270 270
 
271 271
     $settings = wpinv_get_registered_settings();
272
-    $tab      = isset( $referrer['tab'] ) ? $referrer['tab'] : 'general';
273
-    $section  = isset( $referrer['section'] ) ? $referrer['section'] : 'main';
272
+    $tab      = isset($referrer['tab']) ? $referrer['tab'] : 'general';
273
+    $section  = isset($referrer['section']) ? $referrer['section'] : 'main';
274 274
 
275 275
     $input = $input ? $input : array();
276
-    $input = apply_filters( 'wpinv_settings_tab_' . $tab . '_sanitize', $input );
277
-    $input = apply_filters( 'wpinv_settings_' . $tab . '-' . $section . '_sanitize', $input );
276
+    $input = apply_filters('wpinv_settings_tab_' . $tab . '_sanitize', $input);
277
+    $input = apply_filters('wpinv_settings_' . $tab . '-' . $section . '_sanitize', $input);
278 278
 
279 279
     // Loop through each setting being saved and pass it through a sanitization filter
280
-    foreach ( $input as $key => $value ) {
280
+    foreach ($input as $key => $value) {
281 281
 
282 282
         // Get the setting type (checkbox, select, etc)
283
-        $type = isset( $settings[ $tab ][$section][ $key ]['type'] ) ? $settings[ $tab ][$section][ $key ]['type'] : false;
283
+        $type = isset($settings[$tab][$section][$key]['type']) ? $settings[$tab][$section][$key]['type'] : false;
284 284
 
285
-        if ( $type ) {
285
+        if ($type) {
286 286
             // Field type specific filter
287
-            $input[$key] = apply_filters( 'wpinv_settings_sanitize_' . $type, $value, $key );
287
+            $input[$key] = apply_filters('wpinv_settings_sanitize_' . $type, $value, $key);
288 288
         }
289 289
 
290 290
         // General filter
291
-		$input[ $key ] = apply_filters( 'wpinv_settings_sanitize', $input[ $key ], $key );
291
+		$input[$key] = apply_filters('wpinv_settings_sanitize', $input[$key], $key);
292 292
 
293 293
 		// Key specific filter.
294
-		$input[ $key ] = apply_filters( "wpinv_settings_sanitize_$key", $input[ $key ] );
294
+		$input[$key] = apply_filters("wpinv_settings_sanitize_$key", $input[$key]);
295 295
     }
296 296
 
297 297
     // Loop through the whitelist and unset any that are empty for the tab being saved
298
-    $main_settings    = $section == 'main' ? $settings[ $tab ] : array(); // Check for extensions that aren't using new sections
299
-    $section_settings = ! empty( $settings[ $tab ][ $section ] ) ? $settings[ $tab ][ $section ] : array();
298
+    $main_settings    = $section == 'main' ? $settings[$tab] : array(); // Check for extensions that aren't using new sections
299
+    $section_settings = !empty($settings[$tab][$section]) ? $settings[$tab][$section] : array();
300 300
 
301
-    $found_settings = array_merge( $main_settings, $section_settings );
301
+    $found_settings = array_merge($main_settings, $section_settings);
302 302
 
303
-    if ( ! empty( $found_settings ) ) {
304
-        foreach ( $found_settings as $key => $value ) {
303
+    if (!empty($found_settings)) {
304
+        foreach ($found_settings as $key => $value) {
305 305
 
306 306
             // settings used to have numeric keys, now they have keys that match the option ID. This ensures both methods work
307
-            if ( is_numeric( $key ) ) {
307
+            if (is_numeric($key)) {
308 308
                 $key = $value['id'];
309 309
             }
310 310
 
311
-            if ( ! isset( $input[ $key ] ) && isset( $wpinv_options[ $key ] ) ) {
312
-                unset( $wpinv_options[ $key ] );
311
+            if (!isset($input[$key]) && isset($wpinv_options[$key])) {
312
+                unset($wpinv_options[$key]);
313 313
             }
314 314
         }
315 315
     }
316 316
 
317 317
     // Merge our new settings with the existing
318
-    $output = array_merge( $wpinv_options, $input );
318
+    $output = array_merge($wpinv_options, $input);
319 319
 
320
-    add_settings_error( 'wpinv-notices', '', __( 'Settings updated.', 'invoicing' ), 'updated' );
320
+    add_settings_error('wpinv-notices', '', __('Settings updated.', 'invoicing'), 'updated');
321 321
 
322 322
     return $output;
323 323
 }
324 324
 
325
-function wpinv_settings_sanitize_misc_accounting( $input ) {
325
+function wpinv_settings_sanitize_misc_accounting($input) {
326 326
 
327
-    if ( ! wpinv_current_user_can_manage_invoicing() ) {
327
+    if (!wpinv_current_user_can_manage_invoicing()) {
328 328
         return $input;
329 329
     }
330 330
 
331
-    if( ! empty( $input['enable_sequential'] ) && !wpinv_get_option( 'enable_sequential' ) ) {
331
+    if (!empty($input['enable_sequential']) && !wpinv_get_option('enable_sequential')) {
332 332
         // Shows an admin notice about upgrading previous order numbers
333
-        getpaid_session()->set( 'upgrade_sequential', '1' );
333
+        getpaid_session()->set('upgrade_sequential', '1');
334 334
     }
335 335
 
336 336
     return $input;
337 337
 }
338
-add_filter( 'wpinv_settings_misc-accounting_sanitize', 'wpinv_settings_sanitize_misc_accounting' );
338
+add_filter('wpinv_settings_misc-accounting_sanitize', 'wpinv_settings_sanitize_misc_accounting');
339 339
 
340
-function wpinv_settings_sanitize_tax_rates( $input ) {
341
-    if( ! wpinv_current_user_can_manage_invoicing() ) {
340
+function wpinv_settings_sanitize_tax_rates($input) {
341
+    if (!wpinv_current_user_can_manage_invoicing()) {
342 342
         return $input;
343 343
     }
344 344
 
345
-    $new_rates = ! empty( $_POST['tax_rates'] ) ? array_values( $_POST['tax_rates'] ) : array();
345
+    $new_rates = !empty($_POST['tax_rates']) ? array_values($_POST['tax_rates']) : array();
346 346
     $tax_rates = array();
347 347
 
348
-    foreach ( $new_rates as $rate ) {
348
+    foreach ($new_rates as $rate) {
349 349
 
350
-		$rate['rate']    = wpinv_sanitize_amount( $rate['rate'] );
351
-		$rate['name']    = sanitize_text_field( $rate['name'] );
352
-		$rate['state']   = sanitize_text_field( $rate['state'] );
353
-		$rate['country'] = sanitize_text_field( $rate['country'] );
354
-		$rate['global']  = empty( $rate['state'] );
350
+		$rate['rate']    = wpinv_sanitize_amount($rate['rate']);
351
+		$rate['name']    = sanitize_text_field($rate['name']);
352
+		$rate['state']   = sanitize_text_field($rate['state']);
353
+		$rate['country'] = sanitize_text_field($rate['country']);
354
+		$rate['global']  = empty($rate['state']);
355 355
 		$tax_rates[]     = $rate;
356 356
 
357 357
 	}
358 358
 
359
-    update_option( 'wpinv_tax_rates', $tax_rates );
359
+    update_option('wpinv_tax_rates', $tax_rates);
360 360
 
361 361
     return $input;
362 362
 }
363
-add_filter( 'wpinv_settings_taxes-rates_sanitize', 'wpinv_settings_sanitize_tax_rates' );
363
+add_filter('wpinv_settings_taxes-rates_sanitize', 'wpinv_settings_sanitize_tax_rates');
364 364
 
365
-function wpinv_sanitize_text_field( $input ) {
366
-    return trim( $input );
365
+function wpinv_sanitize_text_field($input) {
366
+    return trim($input);
367 367
 }
368
-add_filter( 'wpinv_settings_sanitize_text', 'wpinv_sanitize_text_field' );
368
+add_filter('wpinv_settings_sanitize_text', 'wpinv_sanitize_text_field');
369 369
 
370 370
 function wpinv_get_settings_tabs() {
371 371
     $tabs             = array();
372
-    $tabs['general']  = __( 'General', 'invoicing' );
373
-    $tabs['gateways'] = __( 'Payment Gateways', 'invoicing' );
374
-    $tabs['taxes']    = __( 'Taxes', 'invoicing' );
375
-	$tabs['emails']   = __( 'Emails', 'invoicing' );
372
+    $tabs['general']  = __('General', 'invoicing');
373
+    $tabs['gateways'] = __('Payment Gateways', 'invoicing');
374
+    $tabs['taxes']    = __('Taxes', 'invoicing');
375
+	$tabs['emails'] = __('Emails', 'invoicing');
376 376
 
377
-	if ( count( getpaid_get_integration_settings() ) > 0 ) {
378
-		$tabs['integrations'] = __( 'Integrations', 'invoicing' );
377
+	if (count(getpaid_get_integration_settings()) > 0) {
378
+		$tabs['integrations'] = __('Integrations', 'invoicing');
379 379
 	}
380 380
 
381
-    $tabs['privacy']  = __( 'Privacy', 'invoicing' );
382
-    $tabs['misc']     = __( 'Misc', 'invoicing' );
383
-    $tabs['tools']    = __( 'Tools', 'invoicing' );
381
+    $tabs['privacy']  = __('Privacy', 'invoicing');
382
+    $tabs['misc']     = __('Misc', 'invoicing');
383
+    $tabs['tools']    = __('Tools', 'invoicing');
384 384
 
385
-    return apply_filters( 'wpinv_settings_tabs', $tabs );
385
+    return apply_filters('wpinv_settings_tabs', $tabs);
386 386
 }
387 387
 
388
-function wpinv_get_settings_tab_sections( $tab = false ) {
388
+function wpinv_get_settings_tab_sections($tab = false) {
389 389
     $tabs     = false;
390 390
     $sections = wpinv_get_registered_settings_sections();
391 391
 
392
-    if( $tab && ! empty( $sections[ $tab ] ) ) {
393
-        $tabs = $sections[ $tab ];
394
-    } else if ( $tab ) {
392
+    if ($tab && !empty($sections[$tab])) {
393
+        $tabs = $sections[$tab];
394
+    } else if ($tab) {
395 395
         $tabs = false;
396 396
     }
397 397
 
@@ -401,91 +401,91 @@  discard block
 block discarded – undo
401 401
 function wpinv_get_registered_settings_sections() {
402 402
     static $sections = false;
403 403
 
404
-    if ( false !== $sections ) {
404
+    if (false !== $sections) {
405 405
         return $sections;
406 406
     }
407 407
 
408 408
     $sections = array(
409
-        'general' => apply_filters( 'wpinv_settings_sections_general', array(
410
-            'main' => __( 'General Settings', 'invoicing' ),
411
-            'currency_section' => __( 'Currency Settings', 'invoicing' ),
412
-            'labels' => __( 'Label Texts', 'invoicing' ),
413
-        ) ),
414
-        'gateways' => apply_filters( 'wpinv_settings_sections_gateways', array(
415
-            'main' => __( 'Gateway Settings', 'invoicing' ),
416
-        ) ),
417
-        'taxes' => apply_filters( 'wpinv_settings_sections_taxes', array(
418
-            'main'  => __( 'Tax Settings', 'invoicing' ),
419
-			'rates' => __( 'Tax Rates', 'invoicing' ),
420
-			'vat'   => __( 'EU VAT Settings', 'invoicing' )
421
-        ) ),
422
-        'emails' => apply_filters( 'wpinv_settings_sections_emails', array(
423
-            'main' => __( 'Email Settings', 'invoicing' ),
424
-		) ),
425
-
426
-		'integrations' => wp_list_pluck( getpaid_get_integration_settings(), 'label', 'id' ),
427
-
428
-        'privacy' => apply_filters( 'wpinv_settings_sections_privacy', array(
429
-            'main' => __( 'Privacy policy', 'invoicing' ),
430
-        ) ),
431
-        'misc' => apply_filters( 'wpinv_settings_sections_misc', array(
432
-            'main' => __( 'Miscellaneous', 'invoicing' ),
433
-            'custom-css' => __( 'Custom CSS', 'invoicing' ),
434
-        ) ),
435
-        'tools' => apply_filters( 'wpinv_settings_sections_tools', array(
436
-            'main' => __( 'Diagnostic Tools', 'invoicing' ),
437
-        ) ),
409
+        'general' => apply_filters('wpinv_settings_sections_general', array(
410
+            'main' => __('General Settings', 'invoicing'),
411
+            'currency_section' => __('Currency Settings', 'invoicing'),
412
+            'labels' => __('Label Texts', 'invoicing'),
413
+        )),
414
+        'gateways' => apply_filters('wpinv_settings_sections_gateways', array(
415
+            'main' => __('Gateway Settings', 'invoicing'),
416
+        )),
417
+        'taxes' => apply_filters('wpinv_settings_sections_taxes', array(
418
+            'main'  => __('Tax Settings', 'invoicing'),
419
+			'rates' => __('Tax Rates', 'invoicing'),
420
+			'vat'   => __('EU VAT Settings', 'invoicing')
421
+        )),
422
+        'emails' => apply_filters('wpinv_settings_sections_emails', array(
423
+            'main' => __('Email Settings', 'invoicing'),
424
+		)),
425
+
426
+		'integrations' => wp_list_pluck(getpaid_get_integration_settings(), 'label', 'id'),
427
+
428
+        'privacy' => apply_filters('wpinv_settings_sections_privacy', array(
429
+            'main' => __('Privacy policy', 'invoicing'),
430
+        )),
431
+        'misc' => apply_filters('wpinv_settings_sections_misc', array(
432
+            'main' => __('Miscellaneous', 'invoicing'),
433
+            'custom-css' => __('Custom CSS', 'invoicing'),
434
+        )),
435
+        'tools' => apply_filters('wpinv_settings_sections_tools', array(
436
+            'main' => __('Diagnostic Tools', 'invoicing'),
437
+        )),
438 438
     );
439 439
 
440
-    $sections = apply_filters( 'wpinv_settings_sections', $sections );
440
+    $sections = apply_filters('wpinv_settings_sections', $sections);
441 441
 
442 442
     return $sections;
443 443
 }
444 444
 
445
-function wpinv_get_pages( $with_slug = false, $default_label = NULL ) {
445
+function wpinv_get_pages($with_slug = false, $default_label = NULL) {
446 446
 	$pages_options = array();
447 447
 
448
-	if( $default_label !== NULL && $default_label !== false ) {
449
-		$pages_options = array( '' => $default_label ); // Blank option
448
+	if ($default_label !== NULL && $default_label !== false) {
449
+		$pages_options = array('' => $default_label); // Blank option
450 450
 	}
451 451
 
452 452
 	$pages = get_pages();
453
-	if ( $pages ) {
454
-		foreach ( $pages as $page ) {
453
+	if ($pages) {
454
+		foreach ($pages as $page) {
455 455
 			$title = $with_slug ? $page->post_title . ' (' . $page->post_name . ')' : $page->post_title;
456
-            $pages_options[ $page->ID ] = $title;
456
+            $pages_options[$page->ID] = $title;
457 457
 		}
458 458
 	}
459 459
 
460 460
 	return $pages_options;
461 461
 }
462 462
 
463
-function wpinv_header_callback( $args ) {
464
-	if ( !empty( $args['desc'] ) ) {
463
+function wpinv_header_callback($args) {
464
+	if (!empty($args['desc'])) {
465 465
         echo $args['desc'];
466 466
     }
467 467
 }
468 468
 
469
-function wpinv_hidden_callback( $args ) {
469
+function wpinv_hidden_callback($args) {
470 470
 	global $wpinv_options;
471 471
 
472
-	if ( isset( $args['set_value'] ) ) {
472
+	if (isset($args['set_value'])) {
473 473
 		$value = $args['set_value'];
474
-	} elseif ( isset( $wpinv_options[ $args['id'] ] ) ) {
475
-		$value = $wpinv_options[ $args['id'] ];
474
+	} elseif (isset($wpinv_options[$args['id']])) {
475
+		$value = $wpinv_options[$args['id']];
476 476
 	} else {
477
-		$value = isset( $args['std'] ) ? $args['std'] : '';
477
+		$value = isset($args['std']) ? $args['std'] : '';
478 478
 	}
479 479
 
480
-	if ( isset( $args['faux'] ) && true === $args['faux'] ) {
480
+	if (isset($args['faux']) && true === $args['faux']) {
481 481
 		$args['readonly'] = true;
482
-		$value = isset( $args['std'] ) ? $args['std'] : '';
482
+		$value = isset($args['std']) ? $args['std'] : '';
483 483
 		$name  = '';
484 484
 	} else {
485
-		$name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"';
485
+		$name = 'name="wpinv_settings[' . esc_attr($args['id']) . ']"';
486 486
 	}
487 487
 
488
-	$html = '<input type="hidden" id="wpinv_settings[' . wpinv_sanitize_key( $args['id'] ) . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '" />';
488
+	$html = '<input type="hidden" id="wpinv_settings[' . wpinv_sanitize_key($args['id']) . ']" ' . $name . ' value="' . esc_attr(stripslashes($value)) . '" />';
489 489
     
490 490
 	echo $html;
491 491
 }
@@ -493,61 +493,61 @@  discard block
 block discarded – undo
493 493
 /**
494 494
  * Displays a checkbox settings callback.
495 495
  */
496
-function wpinv_checkbox_callback( $args ) {
496
+function wpinv_checkbox_callback($args) {
497 497
 
498
-	$std = isset( $args['std'] ) ? $args['std'] : '';
499
-	$std = wpinv_get_option( $args['id'], $std );
500
-	$id  = esc_attr( $args['id'] );
498
+	$std = isset($args['std']) ? $args['std'] : '';
499
+	$std = wpinv_get_option($args['id'], $std);
500
+	$id  = esc_attr($args['id']);
501 501
 
502
-	getpaid_hidden_field( "wpinv_settings[$id]", '0' );
502
+	getpaid_hidden_field("wpinv_settings[$id]", '0');
503 503
 	?>
504 504
 		<fieldset>
505 505
 			<label>
506
-				<input id="wpinv-settings-<?php echo $id; ?>" name="wpinv_settings[<?php echo $id; ?>]" <?php checked( empty( $std ), false ); ?> value="1" type="checkbox">
507
-				<?php echo wp_kses_post( $args['desc'] ); ?>
506
+				<input id="wpinv-settings-<?php echo $id; ?>" name="wpinv_settings[<?php echo $id; ?>]" <?php checked(empty($std), false); ?> value="1" type="checkbox">
507
+				<?php echo wp_kses_post($args['desc']); ?>
508 508
 			</label>
509 509
 		</fieldset>
510 510
 	<?php
511 511
 }
512 512
 
513
-function wpinv_multicheck_callback( $args ) {
513
+function wpinv_multicheck_callback($args) {
514 514
 	
515 515
 	global $wpinv_options;
516 516
 
517
-	$sanitize_id = wpinv_sanitize_key( $args['id'] );
518
-	$class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : '';
517
+	$sanitize_id = wpinv_sanitize_key($args['id']);
518
+	$class = !empty($args['class']) ? ' ' . esc_attr($args['class']) : '';
519 519
 
520
-	if ( ! empty( $args['options'] ) ) {
520
+	if (!empty($args['options'])) {
521 521
 
522
-		$std     = isset( $args['std'] ) ? $args['std'] : array();
523
-		$value   = isset( $wpinv_options[ $args['id'] ] ) ? $wpinv_options[ $args['id'] ] : $std;
522
+		$std     = isset($args['std']) ? $args['std'] : array();
523
+		$value   = isset($wpinv_options[$args['id']]) ? $wpinv_options[$args['id']] : $std;
524 524
 
525 525
 		echo '<div class="wpi-mcheck-rows wpi-mcheck-' . $sanitize_id . $class . '">';
526
-        foreach( $args['options'] as $key => $option ):
527
-			$sanitize_key = wpinv_sanitize_key( $key );
528
-			if ( in_array( $sanitize_key, $value ) ) { 
526
+        foreach ($args['options'] as $key => $option):
527
+			$sanitize_key = wpinv_sanitize_key($key);
528
+			if (in_array($sanitize_key, $value)) { 
529 529
 				$enabled = $sanitize_key;
530 530
 			} else { 
531 531
 				$enabled = NULL; 
532 532
 			}
533
-			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;';
534
-			echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . wp_kses_post( $option ) . '</label></div>';
533
+			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;';
534
+			echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . wp_kses_post($option) . '</label></div>';
535 535
 		endforeach;
536 536
 		echo '</div>';
537 537
 		echo '<p class="description">' . $args['desc'] . '</p>';
538 538
 	}
539 539
 }
540 540
 
541
-function wpinv_payment_icons_callback( $args ) {
541
+function wpinv_payment_icons_callback($args) {
542 542
 	global $wpinv_options;
543 543
     
544
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
544
+    $sanitize_id = wpinv_sanitize_key($args['id']);
545 545
 
546
-	if ( ! empty( $args['options'] ) ) {
547
-		foreach( $args['options'] as $key => $option ) {
548
-            $sanitize_key = wpinv_sanitize_key( $key );
546
+	if (!empty($args['options'])) {
547
+		foreach ($args['options'] as $key => $option) {
548
+            $sanitize_key = wpinv_sanitize_key($key);
549 549
             
550
-			if( isset( $wpinv_options[$args['id']][$key] ) ) {
550
+			if (isset($wpinv_options[$args['id']][$key])) {
551 551
 				$enabled = $option;
552 552
 			} else {
553 553
 				$enabled = NULL;
@@ -555,211 +555,211 @@  discard block
 block discarded – undo
555 555
 
556 556
 			echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" style="margin-right:10px;line-height:16px;height:16px;display:inline-block;">';
557 557
 
558
-				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;';
558
+				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;';
559 559
 
560
-				if ( wpinv_string_is_image_url( $key ) ) {
561
-					echo '<img class="payment-icon" src="' . esc_url( $key ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
560
+				if (wpinv_string_is_image_url($key)) {
561
+					echo '<img class="payment-icon" src="' . esc_url($key) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
562 562
 				} else {
563
-					$card = strtolower( str_replace( ' ', '', $option ) );
563
+					$card = strtolower(str_replace(' ', '', $option));
564 564
 
565
-					if ( has_filter( 'wpinv_accepted_payment_' . $card . '_image' ) ) {
566
-						$image = apply_filters( 'wpinv_accepted_payment_' . $card . '_image', '' );
565
+					if (has_filter('wpinv_accepted_payment_' . $card . '_image')) {
566
+						$image = apply_filters('wpinv_accepted_payment_' . $card . '_image', '');
567 567
 					} else {
568
-						$image       = wpinv_locate_template( 'images' . DIRECTORY_SEPARATOR . 'icons' . DIRECTORY_SEPARATOR . $card . '.gif', false );
568
+						$image       = wpinv_locate_template('images' . DIRECTORY_SEPARATOR . 'icons' . DIRECTORY_SEPARATOR . $card . '.gif', false);
569 569
 						$content_dir = WP_CONTENT_DIR;
570 570
 
571
-						if ( function_exists( 'wp_normalize_path' ) ) {
571
+						if (function_exists('wp_normalize_path')) {
572 572
 							// Replaces backslashes with forward slashes for Windows systems
573
-							$image = wp_normalize_path( $image );
574
-							$content_dir = wp_normalize_path( $content_dir );
573
+							$image = wp_normalize_path($image);
574
+							$content_dir = wp_normalize_path($content_dir);
575 575
 						}
576 576
 
577
-						$image = str_replace( $content_dir, content_url(), $image );
577
+						$image = str_replace($content_dir, content_url(), $image);
578 578
 					}
579 579
 
580
-					echo '<img class="payment-icon" src="' . esc_url( $image ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
580
+					echo '<img class="payment-icon" src="' . esc_url($image) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
581 581
 				}
582 582
 			echo $option . '</label>';
583 583
 		}
584
-		echo '<p class="description" style="margin-top:16px;">' . wp_kses_post( $args['desc'] ) . '</p>';
584
+		echo '<p class="description" style="margin-top:16px;">' . wp_kses_post($args['desc']) . '</p>';
585 585
 	}
586 586
 }
587 587
 
588 588
 /**
589 589
  * Displays a radio settings field.
590 590
  */
591
-function wpinv_radio_callback( $args ) {
591
+function wpinv_radio_callback($args) {
592 592
 
593
-	$std = isset( $args['std'] ) ? $args['std'] : '';
594
-	$std = wpinv_get_option( $args['id'], $std );
593
+	$std = isset($args['std']) ? $args['std'] : '';
594
+	$std = wpinv_get_option($args['id'], $std);
595 595
 	?>
596 596
 		<fieldset>
597
-			<ul id="wpinv-settings-<?php echo esc_attr( $args['id'] ); ?>" style="margin-top: 0;">
598
-				<?php foreach( $args['options'] as $key => $option ) : ?>
597
+			<ul id="wpinv-settings-<?php echo esc_attr($args['id']); ?>" style="margin-top: 0;">
598
+				<?php foreach ($args['options'] as $key => $option) : ?>
599 599
 					<li>
600 600
 						<label>
601
-							<input name="wpinv_settings[<?php echo esc_attr( $args['id'] ); ?>]" <?php checked( $std, $key ); ?> value="<?php echo esc_attr( $key ); ?>" type="radio">
602
-							<?php echo wp_kses_post( $option ); ?>
601
+							<input name="wpinv_settings[<?php echo esc_attr($args['id']); ?>]" <?php checked($std, $key); ?> value="<?php echo esc_attr($key); ?>" type="radio">
602
+							<?php echo wp_kses_post($option); ?>
603 603
 						</label>
604 604
 					</li>
605 605
 				<?php endforeach; ?>
606 606
 			</ul>
607 607
 		</fieldset>
608 608
 	<?php
609
-	getpaid_settings_description_callback( $args );
609
+	getpaid_settings_description_callback($args);
610 610
 }
611 611
 
612 612
 /**
613 613
  * Displays a description if available.
614 614
  */
615
-function getpaid_settings_description_callback( $args ) {
615
+function getpaid_settings_description_callback($args) {
616 616
 
617
-	if ( ! empty( $args['desc'] ) ) {
618
-		$description = wp_kses_post( $args['desc'] );
617
+	if (!empty($args['desc'])) {
618
+		$description = wp_kses_post($args['desc']);
619 619
 		echo "<p class='description'>$description</p>";
620 620
 	}
621 621
 
622 622
 }
623 623
 
624
-function wpinv_gateways_callback( $args ) {
624
+function wpinv_gateways_callback($args) {
625 625
 	global $wpinv_options;
626 626
     
627
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
627
+    $sanitize_id = wpinv_sanitize_key($args['id']);
628 628
 
629
-	foreach ( $args['options'] as $key => $option ) :
630
-		$sanitize_key = wpinv_sanitize_key( $key );
629
+	foreach ($args['options'] as $key => $option) :
630
+		$sanitize_key = wpinv_sanitize_key($key);
631 631
         
632
-        if ( isset( $wpinv_options['gateways'][ $key ] ) )
632
+        if (isset($wpinv_options['gateways'][$key]))
633 633
 			$enabled = '1';
634 634
 		else
635 635
 			$enabled = null;
636 636
 
637
-		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;';
638
-		echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html( $option['admin_label'] ) . '</label><br/>';
637
+		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;';
638
+		echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html($option['admin_label']) . '</label><br/>';
639 639
 	endforeach;
640 640
 }
641 641
 
642 642
 function wpinv_gateway_select_callback($args) {
643 643
 	global $wpinv_options;
644 644
     
645
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
646
-    $class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : '';
645
+    $sanitize_id = wpinv_sanitize_key($args['id']);
646
+    $class = !empty($args['class']) ? ' ' . esc_attr($args['class']) : '';
647 647
 
648
-	echo '<select name="wpinv_settings[' . $sanitize_id . ']"" id="wpinv_settings[' . $sanitize_id . ']" class="'.$class.'" >';
648
+	echo '<select name="wpinv_settings[' . $sanitize_id . ']"" id="wpinv_settings[' . $sanitize_id . ']" class="' . $class . '" >';
649 649
 
650
-	foreach ( $args['options'] as $key => $option ) :
651
-		if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) {
652
-            $selected = selected( $key, $args['selected'], false );
650
+	foreach ($args['options'] as $key => $option) :
651
+		if (isset($args['selected']) && $args['selected'] !== null && $args['selected'] !== false) {
652
+            $selected = selected($key, $args['selected'], false);
653 653
         } else {
654
-            $selected = isset( $wpinv_options[ $args['id'] ] ) ? selected( $key, $wpinv_options[$args['id']], false ) : '';
654
+            $selected = isset($wpinv_options[$args['id']]) ? selected($key, $wpinv_options[$args['id']], false) : '';
655 655
         }
656
-		echo '<option value="' . wpinv_sanitize_key( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>';
656
+		echo '<option value="' . wpinv_sanitize_key($key) . '"' . $selected . '>' . esc_html($option['admin_label']) . '</option>';
657 657
 	endforeach;
658 658
 
659 659
 	echo '</select>';
660
-	echo '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
660
+	echo '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
661 661
 }
662 662
 
663
-function wpinv_text_callback( $args ) {
663
+function wpinv_text_callback($args) {
664 664
 	global $wpinv_options;
665 665
     
666
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
666
+    $sanitize_id = wpinv_sanitize_key($args['id']);
667 667
 
668
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
669
-		$value = $wpinv_options[ $args['id'] ];
668
+	if (isset($wpinv_options[$args['id']])) {
669
+		$value = $wpinv_options[$args['id']];
670 670
 	} else {
671
-		$value = isset( $args['std'] ) ? $args['std'] : '';
671
+		$value = isset($args['std']) ? $args['std'] : '';
672 672
 	}
673 673
 
674
-	if ( isset( $args['faux'] ) && true === $args['faux'] ) {
674
+	if (isset($args['faux']) && true === $args['faux']) {
675 675
 		$args['readonly'] = true;
676
-		$value = isset( $args['std'] ) ? $args['std'] : '';
676
+		$value = isset($args['std']) ? $args['std'] : '';
677 677
 		$name  = '';
678 678
 	} else {
679
-		$name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"';
679
+		$name = 'name="wpinv_settings[' . esc_attr($args['id']) . ']"';
680 680
 	}
681
-	$class = !empty( $args['class'] ) ? sanitize_html_class( $args['class'] ) : '';
681
+	$class = !empty($args['class']) ? sanitize_html_class($args['class']) : '';
682 682
 
683 683
 	$readonly = $args['readonly'] === true ? ' readonly="readonly"' : '';
684
-	$size     = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
685
-	$html     = '<input type="text" class="' . sanitize_html_class( $size ) . '-text ' . $class . '" id="wpinv_settings[' . $sanitize_id . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '"' . $readonly . '/>';
686
-	$html    .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
684
+	$size     = (isset($args['size']) && !is_null($args['size'])) ? $args['size'] : 'regular';
685
+	$html     = '<input type="text" class="' . sanitize_html_class($size) . '-text ' . $class . '" id="wpinv_settings[' . $sanitize_id . ']" ' . $name . ' value="' . esc_attr(stripslashes($value)) . '"' . $readonly . '/>';
686
+	$html    .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
687 687
 
688 688
 	echo $html;
689 689
 }
690 690
 
691
-function wpinv_number_callback( $args ) {
691
+function wpinv_number_callback($args) {
692 692
 	global $wpinv_options;
693 693
     
694
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
694
+    $sanitize_id = wpinv_sanitize_key($args['id']);
695 695
 
696
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
697
-		$value = $wpinv_options[ $args['id'] ];
696
+	if (isset($wpinv_options[$args['id']])) {
697
+		$value = $wpinv_options[$args['id']];
698 698
 	} else {
699
-		$value = isset( $args['std'] ) ? $args['std'] : '';
699
+		$value = isset($args['std']) ? $args['std'] : '';
700 700
 	}
701 701
 
702
-	if ( isset( $args['faux'] ) && true === $args['faux'] ) {
702
+	if (isset($args['faux']) && true === $args['faux']) {
703 703
 		$args['readonly'] = true;
704
-		$value = isset( $args['std'] ) ? $args['std'] : '';
704
+		$value = isset($args['std']) ? $args['std'] : '';
705 705
 		$name  = '';
706 706
 	} else {
707
-		$name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"';
707
+		$name = 'name="wpinv_settings[' . esc_attr($args['id']) . ']"';
708 708
 	}
709 709
 
710
-	$max  = isset( $args['max'] ) ? $args['max'] : 999999;
711
-	$min  = isset( $args['min'] ) ? $args['min'] : 0;
712
-	$step = isset( $args['step'] ) ? $args['step'] : 1;
713
-	$class = !empty( $args['class'] ) ? sanitize_html_class( $args['class'] ) : '';
710
+	$max  = isset($args['max']) ? $args['max'] : 999999;
711
+	$min  = isset($args['min']) ? $args['min'] : 0;
712
+	$step = isset($args['step']) ? $args['step'] : 1;
713
+	$class = !empty($args['class']) ? sanitize_html_class($args['class']) : '';
714 714
 
715
-	$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
716
-	$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 ) ) . '"/>';
717
-	$html .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
715
+	$size = (isset($args['size']) && !is_null($args['size'])) ? $args['size'] : 'regular';
716
+	$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)) . '"/>';
717
+	$html .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
718 718
 
719 719
 	echo $html;
720 720
 }
721 721
 
722
-function wpinv_textarea_callback( $args ) {
722
+function wpinv_textarea_callback($args) {
723 723
 	global $wpinv_options;
724 724
     
725
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
725
+    $sanitize_id = wpinv_sanitize_key($args['id']);
726 726
 
727
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
728
-		$value = $wpinv_options[ $args['id'] ];
727
+	if (isset($wpinv_options[$args['id']])) {
728
+		$value = $wpinv_options[$args['id']];
729 729
 	} else {
730
-		$value = isset( $args['std'] ) ? $args['std'] : '';
730
+		$value = isset($args['std']) ? $args['std'] : '';
731 731
 	}
732 732
     
733
-    $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
734
-    $class = ( isset( $args['class'] ) && ! is_null( $args['class'] ) ) ? $args['class'] : 'large-text';
733
+    $size = (isset($args['size']) && !is_null($args['size'])) ? $args['size'] : 'regular';
734
+    $class = (isset($args['class']) && !is_null($args['class'])) ? $args['class'] : 'large-text';
735 735
 
736
-	$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>';
737
-	$html .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
736
+	$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>';
737
+	$html .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
738 738
 
739 739
 	echo $html;
740 740
 }
741 741
 
742
-function wpinv_password_callback( $args ) {
742
+function wpinv_password_callback($args) {
743 743
 	global $wpinv_options;
744 744
     
745
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
745
+    $sanitize_id = wpinv_sanitize_key($args['id']);
746 746
 
747
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
748
-		$value = $wpinv_options[ $args['id'] ];
747
+	if (isset($wpinv_options[$args['id']])) {
748
+		$value = $wpinv_options[$args['id']];
749 749
 	} else {
750
-		$value = isset( $args['std'] ) ? $args['std'] : '';
750
+		$value = isset($args['std']) ? $args['std'] : '';
751 751
 	}
752 752
 
753
-	$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
754
-	$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 ) . '"/>';
755
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
753
+	$size = (isset($args['size']) && !is_null($args['size'])) ? $args['size'] : 'regular';
754
+	$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) . '"/>';
755
+	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
756 756
 
757 757
 	echo $html;
758 758
 }
759 759
 
760 760
 function wpinv_missing_callback($args) {
761 761
 	printf(
762
-		__( 'The callback function used for the %s setting is missing.', 'invoicing' ),
762
+		__('The callback function used for the %s setting is missing.', 'invoicing'),
763 763
 		'<strong>' . $args['id'] . '</strong>'
764 764
 	);
765 765
 }
@@ -767,134 +767,134 @@  discard block
 block discarded – undo
767 767
 function wpinv_select_callback($args) {
768 768
 	global $wpinv_options;
769 769
     
770
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
770
+    $sanitize_id = wpinv_sanitize_key($args['id']);
771 771
 
772
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
773
-		$value = $wpinv_options[ $args['id'] ];
772
+	if (isset($wpinv_options[$args['id']])) {
773
+		$value = $wpinv_options[$args['id']];
774 774
 	} else {
775
-		$value = isset( $args['std'] ) ? $args['std'] : '';
775
+		$value = isset($args['std']) ? $args['std'] : '';
776 776
 	}
777 777
     
778
-    if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) {
778
+    if (isset($args['selected']) && $args['selected'] !== null && $args['selected'] !== false) {
779 779
         $value = $args['selected'];
780 780
     }
781 781
 
782
-	if ( isset( $args['placeholder'] ) ) {
782
+	if (isset($args['placeholder'])) {
783 783
 		$placeholder = $args['placeholder'];
784 784
 	} else {
785 785
 		$placeholder = '';
786 786
 	}
787 787
     
788
-    if( !empty( $args['onchange'] ) ) {
789
-        $onchange = ' onchange="' . esc_attr( $args['onchange'] ) . '"';
788
+    if (!empty($args['onchange'])) {
789
+        $onchange = ' onchange="' . esc_attr($args['onchange']) . '"';
790 790
     } else {
791 791
         $onchange = '';
792 792
     }
793 793
 
794
-    $class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : '';
794
+    $class = !empty($args['class']) ? ' ' . esc_attr($args['class']) : '';
795 795
 
796
-	$html = '<select id="wpinv_settings[' . $sanitize_id . ']" class="'.$class.'"  name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" data-placeholder="' . esc_html( $placeholder ) . '"' . $onchange . ' />';
796
+	$html = '<select id="wpinv_settings[' . $sanitize_id . ']" class="' . $class . '"  name="wpinv_settings[' . esc_attr($args['id']) . ']" data-placeholder="' . esc_html($placeholder) . '"' . $onchange . ' />';
797 797
 
798
-	foreach ( $args['options'] as $option => $name ) {
799
-		$selected = selected( $option, $value, false );
800
-		$html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>';
798
+	foreach ($args['options'] as $option => $name) {
799
+		$selected = selected($option, $value, false);
800
+		$html .= '<option value="' . esc_attr($option) . '" ' . $selected . '>' . esc_html($name) . '</option>';
801 801
 	}
802 802
 
803 803
 	$html .= '</select>';
804
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
804
+	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
805 805
 
806 806
 	echo $html;
807 807
 }
808 808
 
809
-function wpinv_color_select_callback( $args ) {
809
+function wpinv_color_select_callback($args) {
810 810
 	global $wpinv_options;
811 811
     
812
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
812
+    $sanitize_id = wpinv_sanitize_key($args['id']);
813 813
 
814
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
815
-		$value = $wpinv_options[ $args['id'] ];
814
+	if (isset($wpinv_options[$args['id']])) {
815
+		$value = $wpinv_options[$args['id']];
816 816
 	} else {
817
-		$value = isset( $args['std'] ) ? $args['std'] : '';
817
+		$value = isset($args['std']) ? $args['std'] : '';
818 818
 	}
819 819
 
820
-	$html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"/>';
820
+	$html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr($args['id']) . ']"/>';
821 821
 
822
-	foreach ( $args['options'] as $option => $color ) {
823
-		$selected = selected( $option, $value, false );
824
-		$html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $color['label'] ) . '</option>';
822
+	foreach ($args['options'] as $option => $color) {
823
+		$selected = selected($option, $value, false);
824
+		$html .= '<option value="' . esc_attr($option) . '" ' . $selected . '>' . esc_html($color['label']) . '</option>';
825 825
 	}
826 826
 
827 827
 	$html .= '</select>';
828
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
828
+	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
829 829
 
830 830
 	echo $html;
831 831
 }
832 832
 
833
-function wpinv_rich_editor_callback( $args ) {
833
+function wpinv_rich_editor_callback($args) {
834 834
 	global $wpinv_options, $wp_version;
835 835
     
836
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
836
+    $sanitize_id = wpinv_sanitize_key($args['id']);
837 837
 
838
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
839
-		$value = $wpinv_options[ $args['id'] ];
838
+	if (isset($wpinv_options[$args['id']])) {
839
+		$value = $wpinv_options[$args['id']];
840 840
 
841
-		if( empty( $args['allow_blank'] ) && empty( $value ) ) {
842
-			$value = isset( $args['std'] ) ? $args['std'] : '';
841
+		if (empty($args['allow_blank']) && empty($value)) {
842
+			$value = isset($args['std']) ? $args['std'] : '';
843 843
 		}
844 844
 	} else {
845
-		$value = isset( $args['std'] ) ? $args['std'] : '';
845
+		$value = isset($args['std']) ? $args['std'] : '';
846 846
 	}
847 847
 
848
-	$rows = isset( $args['size'] ) ? $args['size'] : 20;
848
+	$rows = isset($args['size']) ? $args['size'] : 20;
849 849
 
850 850
 	$html = '<div class="getpaid-settings-editor-input">';
851
-	if ( $wp_version >= 3.3 && function_exists( 'wp_editor' ) ) {
851
+	if ($wp_version >= 3.3 && function_exists('wp_editor')) {
852 852
 		ob_start();
853
-		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 ) );
853
+		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));
854 854
 		$html .= ob_get_clean();
855 855
 	} else {
856
-		$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>';
856
+		$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>';
857 857
 	}
858 858
 
859
-	$html .= '</div><br/><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
859
+	$html .= '</div><br/><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
860 860
 
861 861
 	echo $html;
862 862
 }
863 863
 
864
-function wpinv_upload_callback( $args ) {
864
+function wpinv_upload_callback($args) {
865 865
 	global $wpinv_options;
866 866
     
867
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
867
+    $sanitize_id = wpinv_sanitize_key($args['id']);
868 868
 
869
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
869
+	if (isset($wpinv_options[$args['id']])) {
870 870
 		$value = $wpinv_options[$args['id']];
871 871
 	} else {
872 872
 		$value = isset($args['std']) ? $args['std'] : '';
873 873
 	}
874 874
 
875
-	$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
876
-	$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 ) ) . '"/>';
877
-	$html .= '<span>&nbsp;<input type="button" class="wpinv_settings_upload_button button-secondary" value="' . __( 'Upload File', 'invoicing' ) . '"/></span>';
878
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
875
+	$size = (isset($args['size']) && !is_null($args['size'])) ? $args['size'] : 'regular';
876
+	$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)) . '"/>';
877
+	$html .= '<span>&nbsp;<input type="button" class="wpinv_settings_upload_button button-secondary" value="' . __('Upload File', 'invoicing') . '"/></span>';
878
+	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
879 879
 
880 880
 	echo $html;
881 881
 }
882 882
 
883
-function wpinv_color_callback( $args ) {
883
+function wpinv_color_callback($args) {
884 884
 	global $wpinv_options;
885 885
     
886
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
886
+    $sanitize_id = wpinv_sanitize_key($args['id']);
887 887
 
888
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
889
-		$value = $wpinv_options[ $args['id'] ];
888
+	if (isset($wpinv_options[$args['id']])) {
889
+		$value = $wpinv_options[$args['id']];
890 890
 	} else {
891
-		$value = isset( $args['std'] ) ? $args['std'] : '';
891
+		$value = isset($args['std']) ? $args['std'] : '';
892 892
 	}
893 893
 
894
-	$default = isset( $args['std'] ) ? $args['std'] : '';
894
+	$default = isset($args['std']) ? $args['std'] : '';
895 895
 
896
-	$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 ) . '" />';
897
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
896
+	$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) . '" />';
897
+	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
898 898
 
899 899
 	echo $html;
900 900
 }
@@ -902,9 +902,9 @@  discard block
 block discarded – undo
902 902
 function wpinv_country_states_callback($args) {
903 903
 	global $wpinv_options;
904 904
     
905
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
905
+    $sanitize_id = wpinv_sanitize_key($args['id']);
906 906
 
907
-	if ( isset( $args['placeholder'] ) ) {
907
+	if (isset($args['placeholder'])) {
908 908
 		$placeholder = $args['placeholder'];
909 909
 	} else {
910 910
 		$placeholder = '';
@@ -912,16 +912,16 @@  discard block
 block discarded – undo
912 912
 
913 913
 	$states = wpinv_get_country_states();
914 914
 
915
-	$class = empty( $states ) ? ' class="wpinv-no-states"' : ' class="wpi_select2"';
916
-	$html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"' . $class . 'data-placeholder="' . esc_html( $placeholder ) . '"/>';
915
+	$class = empty($states) ? ' class="wpinv-no-states"' : ' class="wpi_select2"';
916
+	$html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr($args['id']) . ']"' . $class . 'data-placeholder="' . esc_html($placeholder) . '"/>';
917 917
 
918
-	foreach ( $states as $option => $name ) {
919
-		$selected = isset( $wpinv_options[ $args['id'] ] ) ? selected( $option, $wpinv_options[$args['id']], false ) : '';
920
-		$html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>';
918
+	foreach ($states as $option => $name) {
919
+		$selected = isset($wpinv_options[$args['id']]) ? selected($option, $wpinv_options[$args['id']], false) : '';
920
+		$html .= '<option value="' . esc_attr($option) . '" ' . $selected . '>' . esc_html($name) . '</option>';
921 921
 	}
922 922
 
923 923
 	$html .= '</select>';
924
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
924
+	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
925 925
 
926 926
 	echo $html;
927 927
 }
@@ -936,7 +936,7 @@  discard block
 block discarded – undo
936 936
 	</tr>
937 937
 	<tr class="bsui">
938 938
     	<td colspan="2" class="p-0">
939
-			<?php include plugin_dir_path( __FILE__ ) . 'views/html-tax-rates-edit.php'; ?>
939
+			<?php include plugin_dir_path(__FILE__) . 'views/html-tax-rates-edit.php'; ?>
940 940
 
941 941
 	<?php
942 942
 
@@ -945,14 +945,14 @@  discard block
 block discarded – undo
945 945
 /**
946 946
  * Displays a tax rate' edit row.
947 947
  */
948
-function wpinv_tax_rate_callback( $tax_rate, $key, $echo = true ) {
948
+function wpinv_tax_rate_callback($tax_rate, $key, $echo = true) {
949 949
 	ob_start();
950 950
 
951
-	$key                      = sanitize_key( $key );
952
-	$tax_rate['reduced_rate'] = empty( $tax_rate['reduced_rate'] ) ? 0 : $tax_rate['reduced_rate'];
953
-	include plugin_dir_path( __FILE__ ) . 'views/html-tax-rate-edit.php';
951
+	$key                      = sanitize_key($key);
952
+	$tax_rate['reduced_rate'] = empty($tax_rate['reduced_rate']) ? 0 : $tax_rate['reduced_rate'];
953
+	include plugin_dir_path(__FILE__) . 'views/html-tax-rate-edit.php';
954 954
 
955
-	if ( $echo ) {
955
+	if ($echo) {
956 956
 		echo ob_get_clean();
957 957
 	} else {
958 958
 		return ob_get_clean(); 
@@ -964,77 +964,77 @@  discard block
 block discarded – undo
964 964
     ob_start(); ?>
965 965
     </td><tr>
966 966
     <td colspan="2" class="wpinv_tools_tdbox">
967
-    <?php if ( $args['desc'] ) { ?><p><?php echo $args['desc']; ?></p><?php } ?>
968
-    <?php do_action( 'wpinv_tools_before' ); ?>
967
+    <?php if ($args['desc']) { ?><p><?php echo $args['desc']; ?></p><?php } ?>
968
+    <?php do_action('wpinv_tools_before'); ?>
969 969
     <table id="wpinv_tools_table" class="wp-list-table widefat fixed posts">
970 970
         <thead>
971 971
             <tr>
972
-                <th scope="col" class="wpinv-th-tool"><?php _e( 'Tool', 'invoicing' ); ?></th>
973
-                <th scope="col" class="wpinv-th-desc"><?php _e( 'Description', 'invoicing' ); ?></th>
974
-                <th scope="col" class="wpinv-th-action"><?php _e( 'Action', 'invoicing' ); ?></th>
972
+                <th scope="col" class="wpinv-th-tool"><?php _e('Tool', 'invoicing'); ?></th>
973
+                <th scope="col" class="wpinv-th-desc"><?php _e('Description', 'invoicing'); ?></th>
974
+                <th scope="col" class="wpinv-th-action"><?php _e('Action', 'invoicing'); ?></th>
975 975
             </tr>
976 976
         </thead>
977
-            <?php do_action( 'wpinv_tools_row' ); ?>
977
+            <?php do_action('wpinv_tools_row'); ?>
978 978
         <tbody>
979 979
         </tbody>
980 980
     </table>
981
-    <?php do_action( 'wpinv_tools_after' ); ?>
981
+    <?php do_action('wpinv_tools_after'); ?>
982 982
     <?php
983 983
     echo ob_get_clean();
984 984
 }
985 985
 
986
-function wpinv_descriptive_text_callback( $args ) {
987
-	echo wp_kses_post( $args['desc'] );
986
+function wpinv_descriptive_text_callback($args) {
987
+	echo wp_kses_post($args['desc']);
988 988
 }
989 989
 
990
-function wpinv_hook_callback( $args ) {
991
-	do_action( 'wpinv_' . $args['id'], $args );
990
+function wpinv_hook_callback($args) {
991
+	do_action('wpinv_' . $args['id'], $args);
992 992
 }
993 993
 
994 994
 function wpinv_set_settings_cap() {
995 995
 	return wpinv_get_capability();
996 996
 }
997
-add_filter( 'option_page_capability_wpinv_settings', 'wpinv_set_settings_cap' );
997
+add_filter('option_page_capability_wpinv_settings', 'wpinv_set_settings_cap');
998 998
 
999
-function wpinv_settings_sanitize_input( $value, $key ) {
999
+function wpinv_settings_sanitize_input($value, $key) {
1000 1000
 
1001
-    if ( $key == 'tax_rate' ) {
1002
-        $value = wpinv_sanitize_amount( $value );
1001
+    if ($key == 'tax_rate') {
1002
+        $value = wpinv_sanitize_amount($value);
1003 1003
         $value = $value >= 100 ? 99 : $value;
1004 1004
     }
1005 1005
 
1006 1006
     return $value;
1007 1007
 }
1008
-add_filter( 'wpinv_settings_sanitize', 'wpinv_settings_sanitize_input', 10, 2 );
1008
+add_filter('wpinv_settings_sanitize', 'wpinv_settings_sanitize_input', 10, 2);
1009 1009
 
1010
-function wpinv_on_update_settings( $old_value, $value, $option ) {
1011
-    $old = !empty( $old_value['remove_data_on_unistall'] ) ? 1 : '';
1012
-    $new = !empty( $value['remove_data_on_unistall'] ) ? 1 : '';
1010
+function wpinv_on_update_settings($old_value, $value, $option) {
1011
+    $old = !empty($old_value['remove_data_on_unistall']) ? 1 : '';
1012
+    $new = !empty($value['remove_data_on_unistall']) ? 1 : '';
1013 1013
     
1014
-    if ( $old != $new ) {
1015
-        update_option( 'wpinv_remove_data_on_invoice_unistall', $new );
1014
+    if ($old != $new) {
1015
+        update_option('wpinv_remove_data_on_invoice_unistall', $new);
1016 1016
     }
1017 1017
 }
1018
-add_action( 'update_option_wpinv_settings', 'wpinv_on_update_settings', 10, 3 );
1019
-add_action( 'wpinv_settings_tab_bottom_emails_new_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2 );
1020
-add_action( 'wpinv_settings_tab_bottom_emails_cancelled_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2 );
1021
-add_action( 'wpinv_settings_tab_bottom_emails_failed_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2 );
1022
-add_action( 'wpinv_settings_tab_bottom_emails_onhold_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2 );
1023
-add_action( 'wpinv_settings_tab_bottom_emails_processing_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2 );
1024
-add_action( 'wpinv_settings_tab_bottom_emails_completed_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2 );
1025
-add_action( 'wpinv_settings_tab_bottom_emails_refunded_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2 );
1026
-add_action( 'wpinv_settings_tab_bottom_emails_user_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2 );
1027
-add_action( 'wpinv_settings_tab_bottom_emails_user_note', 'wpinv_settings_tab_bottom_emails', 10, 2 );
1028
-add_action( 'wpinv_settings_tab_bottom_emails_overdue', 'wpinv_settings_tab_bottom_emails', 10, 2 );
1029
-
1030
-function wpinv_settings_tab_bottom_emails( $active_tab, $section ) {
1018
+add_action('update_option_wpinv_settings', 'wpinv_on_update_settings', 10, 3);
1019
+add_action('wpinv_settings_tab_bottom_emails_new_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2);
1020
+add_action('wpinv_settings_tab_bottom_emails_cancelled_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2);
1021
+add_action('wpinv_settings_tab_bottom_emails_failed_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2);
1022
+add_action('wpinv_settings_tab_bottom_emails_onhold_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2);
1023
+add_action('wpinv_settings_tab_bottom_emails_processing_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2);
1024
+add_action('wpinv_settings_tab_bottom_emails_completed_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2);
1025
+add_action('wpinv_settings_tab_bottom_emails_refunded_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2);
1026
+add_action('wpinv_settings_tab_bottom_emails_user_invoice', 'wpinv_settings_tab_bottom_emails', 10, 2);
1027
+add_action('wpinv_settings_tab_bottom_emails_user_note', 'wpinv_settings_tab_bottom_emails', 10, 2);
1028
+add_action('wpinv_settings_tab_bottom_emails_overdue', 'wpinv_settings_tab_bottom_emails', 10, 2);
1029
+
1030
+function wpinv_settings_tab_bottom_emails($active_tab, $section) {
1031 1031
     ?>
1032 1032
     <div class="wpinv-email-wc-row ">
1033 1033
         <div class="wpinv-email-wc-td">
1034
-            <h3 class="wpinv-email-wc-title"><?php echo apply_filters( 'wpinv_settings_email_wildcards_title', __( 'Wildcards For Emails', 'invoicing' ) ); ?></h3>
1034
+            <h3 class="wpinv-email-wc-title"><?php echo apply_filters('wpinv_settings_email_wildcards_title', __('Wildcards For Emails', 'invoicing')); ?></h3>
1035 1035
             <p class="wpinv-email-wc-description">
1036 1036
                 <?php
1037
-                $description = __( 'The following wildcards can be used in email subjects, heading and content:<br>
1037
+                $description = __('The following wildcards can be used in email subjects, heading and content:<br>
1038 1038
                     <strong>{site_title} :</strong> Site Title<br>
1039 1039
                     <strong>{name} :</strong> Customer\'s full name<br>
1040 1040
                     <strong>{first_name} :</strong> Customer\'s first name<br>
@@ -1048,7 +1048,7 @@  discard block
 block discarded – undo
1048 1048
                     <strong>{invoice_due_date} :</strong> The date the invoice is due<br>
1049 1049
                     <strong>{date} :</strong> Today\'s date.<br>
1050 1050
                     <strong>{is_was} :</strong> If due date of invoice is past, displays "was" otherwise displays "is"<br>
1051
-                    <strong>{invoice_label} :</strong> Invoices/quotes singular name. Ex: Invoice/Quote<br>', 'invoicing' );
1051
+                    <strong>{invoice_label} :</strong> Invoices/quotes singular name. Ex: Invoice/Quote<br>', 'invoicing');
1052 1052
                 echo apply_filters('wpinv_settings_email_wildcards_description', $description, $active_tab, $section);
1053 1053
                 ?>
1054 1054
             </p>
Please login to merge, or discard this patch.
includes/data/admin-settings.php 1 patch
Spacing   +161 added lines, -161 removed lines patch added patch discarded remove patch
@@ -8,192 +8,192 @@  discard block
 block discarded – undo
8 8
  * @version 1.0.19
9 9
  */
10 10
 
11
-defined( 'ABSPATH' ) || exit;
11
+defined('ABSPATH') || exit;
12 12
 
13
-$pages = wpinv_get_pages( true );
13
+$pages = wpinv_get_pages(true);
14 14
     
15 15
 $currencies = wpinv_get_currencies();
16 16
     
17 17
 $currency_code_options = array();
18
-foreach ( $currencies as $code => $name ) {
19
-    $currency_code_options[ $code ] = $code . ' - ' . $name . ' (' . wpinv_currency_symbol( $code ) . ')';
18
+foreach ($currencies as $code => $name) {
19
+    $currency_code_options[$code] = $code . ' - ' . $name . ' (' . wpinv_currency_symbol($code) . ')';
20 20
 }
21 21
     
22 22
 $due_payment_options       = array();
23
-$due_payment_options[0]    = __( 'Now', 'invoicing' );
24
-for ( $i = 1; $i <= 30; $i++ ) {
23
+$due_payment_options[0]    = __('Now', 'invoicing');
24
+for ($i = 1; $i <= 30; $i++) {
25 25
     $due_payment_options[$i] = $i;
26 26
 }
27 27
     
28 28
 $invoice_number_padd_options = array();
29
-for ( $i = 0; $i <= 20; $i++ ) {
29
+for ($i = 0; $i <= 20; $i++) {
30 30
     $invoice_number_padd_options[$i] = $i;
31 31
 }
32 32
     
33 33
 $currency_symbol = wpinv_currency_symbol();
34 34
     
35 35
 $last_number = $reset_number = '';
36
-if ( $last_invoice_number = get_option( 'wpinv_last_invoice_number' ) ) {
37
-    $last_invoice_number = preg_replace( '/[^0-9]/', '', $last_invoice_number );
36
+if ($last_invoice_number = get_option('wpinv_last_invoice_number')) {
37
+    $last_invoice_number = preg_replace('/[^0-9]/', '', $last_invoice_number);
38 38
 
39
-    if ( !empty( $last_invoice_number ) ) {
40
-        $last_number = ' ' . wp_sprintf( __( "( Last Invoice's sequential number: <b>%s</b> )", 'invoicing' ), $last_invoice_number );
39
+    if (!empty($last_invoice_number)) {
40
+        $last_number = ' ' . wp_sprintf(__("( Last Invoice's sequential number: <b>%s</b> )", 'invoicing'), $last_invoice_number);
41 41
     }
42 42
 
43 43
     $nonce = wp_create_nonce('reset_invoice_count');
44
-    $reset_number = '<a href="'.add_query_arg(array('reset_invoice_count' => 1, '_nonce' => $nonce)).'" class="btn button">'.__('Force Reset Sequence', 'invoicing' ). '</a>';
44
+    $reset_number = '<a href="' . add_query_arg(array('reset_invoice_count' => 1, '_nonce' => $nonce)) . '" class="btn button">' . __('Force Reset Sequence', 'invoicing') . '</a>';
45 45
 }
46 46
     
47 47
 $alert_wrapper_start = '<p style="color: #F00">';
48 48
 $alert_wrapper_close = '</p>';
49 49
 
50 50
 return array(
51
-    'general' => apply_filters( 'wpinv_settings_general',
51
+    'general' => apply_filters('wpinv_settings_general',
52 52
         array(
53 53
             'main' => array(
54 54
                 'location_settings' => array(
55 55
                     'id'   => 'location_settings',
56
-                    'name' => '<h3>' . __( 'Default Location', 'invoicing' ) . '</h3>',
56
+                    'name' => '<h3>' . __('Default Location', 'invoicing') . '</h3>',
57 57
                     'desc' => '',
58 58
                     'type' => 'header',
59 59
                 ),
60 60
                 'default_country' => array(
61 61
                     'id'      => 'default_country',
62
-                    'name'    => __( 'Default Country', 'invoicing' ),
63
-                    'desc'    => __( 'Where does your store operate from?', 'invoicing' ),
62
+                    'name'    => __('Default Country', 'invoicing'),
63
+                    'desc'    => __('Where does your store operate from?', 'invoicing'),
64 64
                     'type'    => 'select',
65 65
                     'options' => wpinv_get_country_list(),
66 66
                     'std'     => 'GB',
67 67
                     'class'   => 'wpi_select2',
68
-                    'placeholder' => __( 'Select a country', 'invoicing' ),
68
+                    'placeholder' => __('Select a country', 'invoicing'),
69 69
                 ),
70 70
                 'default_state' => array(
71 71
                     'id'      => 'default_state',
72
-                    'name'    => __( 'Default State / Province', 'invoicing' ),
73
-                    'desc'    => __( 'What state / province does your store operate from?', 'invoicing' ),
72
+                    'name'    => __('Default State / Province', 'invoicing'),
73
+                    'desc'    => __('What state / province does your store operate from?', 'invoicing'),
74 74
                     'type'    => 'country_states',
75 75
                     'class'   => 'wpi_select2',
76
-                    'placeholder' => __( 'Select a state', 'invoicing' ),
76
+                    'placeholder' => __('Select a state', 'invoicing'),
77 77
                 ),
78 78
                 'store_name' => array(
79 79
                     'id'   => 'store_name',
80
-                    'name' => __( 'Store Name', 'invoicing' ),
81
-                    'desc' => __( 'Store name to print on invoices.', 'invoicing' ),
80
+                    'name' => __('Store Name', 'invoicing'),
81
+                    'desc' => __('Store name to print on invoices.', 'invoicing'),
82 82
                     'std'     => get_option('blogname'),
83 83
                     'type' => 'text',
84 84
                 ),
85 85
                 'logo' => array(
86 86
                     'id'   => 'logo',
87
-                    'name' => __( 'Logo URL', 'invoicing' ),
88
-                    'desc' => __( 'Store logo to print on invoices.', 'invoicing' ),
87
+                    'name' => __('Logo URL', 'invoicing'),
88
+                    'desc' => __('Store logo to print on invoices.', 'invoicing'),
89 89
                     'type' => 'text',
90 90
                 ),
91 91
                 'store_address' => array(
92 92
                     'id'   => 'store_address',
93
-                    'name' => __( 'Store Address', 'invoicing' ),
94
-                    'desc' => __( 'Enter the store address to display on invoice', 'invoicing' ),
93
+                    'name' => __('Store Address', 'invoicing'),
94
+                    'desc' => __('Enter the store address to display on invoice', 'invoicing'),
95 95
                     'type' => 'textarea',
96 96
                 ),
97 97
                 'page_settings' => array(
98 98
                     'id'   => 'page_settings',
99
-                    'name' => '<h3>' . __( 'Page Settings', 'invoicing' ) . '</h3>',
99
+                    'name' => '<h3>' . __('Page Settings', 'invoicing') . '</h3>',
100 100
                     'desc' => '',
101 101
                     'type' => 'header',
102 102
                 ),
103 103
                 'checkout_page' => array(
104 104
                     'id'          => 'checkout_page',
105
-                    'name'        => __( 'Checkout Page', 'invoicing' ),
106
-                    'desc'        => __( 'This is the checkout page where buyers will complete their payments. The <b>[wpinv_checkout]</b> short code must be on this page.', 'invoicing' ),
105
+                    'name'        => __('Checkout Page', 'invoicing'),
106
+                    'desc'        => __('This is the checkout page where buyers will complete their payments. The <b>[wpinv_checkout]</b> short code must be on this page.', 'invoicing'),
107 107
                     'type'        => 'select',
108 108
                     'options'     => $pages,
109 109
                     'class'       => 'wpi_select2',
110
-                    'placeholder' => __( 'Select a page', 'invoicing' ),
110
+                    'placeholder' => __('Select a page', 'invoicing'),
111 111
                 ),
112 112
                 'success_page' => array(
113 113
                     'id'          => 'success_page',
114
-                    'name'        => __( 'Success Page', 'invoicing' ),
115
-                    'desc'        => __( 'This is the page buyers are sent to after completing their payments. The <b>[wpinv_receipt]</b> short code should be on this page.', 'invoicing' ),
114
+                    'name'        => __('Success Page', 'invoicing'),
115
+                    'desc'        => __('This is the page buyers are sent to after completing their payments. The <b>[wpinv_receipt]</b> short code should be on this page.', 'invoicing'),
116 116
                     'type'        => 'select',
117 117
                     'options'     => $pages,
118 118
                     'class'       => 'wpi_select2',
119
-                    'placeholder' => __( 'Select a page', 'invoicing' ),
119
+                    'placeholder' => __('Select a page', 'invoicing'),
120 120
                 ),
121 121
                 'failure_page' => array(
122 122
                     'id'          => 'failure_page',
123
-                    'name'        => __( 'Failed Transaction Page', 'invoicing' ),
124
-                    'desc'        => __( 'This is the page buyers are sent to if their transaction is cancelled or fails.', 'invoicing' ),
123
+                    'name'        => __('Failed Transaction Page', 'invoicing'),
124
+                    'desc'        => __('This is the page buyers are sent to if their transaction is cancelled or fails.', 'invoicing'),
125 125
                     'type'        => 'select',
126 126
                     'options'     => $pages,
127 127
                     'class'       => 'wpi_select2',
128
-                    'placeholder' => __( 'Select a page', 'invoicing' ),
128
+                    'placeholder' => __('Select a page', 'invoicing'),
129 129
                 ),
130 130
                 'invoice_history_page' => array(
131 131
                     'id'          => 'invoice_history_page',
132
-                    'name'        => __( 'Invoice History Page', 'invoicing' ),
133
-                    'desc'        => __( 'This page shows an invoice history for the current user. The <b>[wpinv_history]</b> short code should be on this page.', 'invoicing' ),
132
+                    'name'        => __('Invoice History Page', 'invoicing'),
133
+                    'desc'        => __('This page shows an invoice history for the current user. The <b>[wpinv_history]</b> short code should be on this page.', 'invoicing'),
134 134
                     'type'        => 'select',
135 135
                     'options'     => $pages,
136 136
                     'class'       => 'wpi_select2',
137
-                    'placeholder' => __( 'Select a page', 'invoicing' ),
137
+                    'placeholder' => __('Select a page', 'invoicing'),
138 138
                 ),
139 139
                 'invoice_subscription_page' => array(
140 140
                     'id'          => 'invoice_subscription_page',
141
-                    'name'        => __( 'Invoice Subscriptions Page', 'invoicing' ),
142
-                    'desc'        => __( 'This page shows subscriptions history for the current user. The <b>[wpinv_subscriptions]</b> short code should be on this page.', 'invoicing' ),
141
+                    'name'        => __('Invoice Subscriptions Page', 'invoicing'),
142
+                    'desc'        => __('This page shows subscriptions history for the current user. The <b>[wpinv_subscriptions]</b> short code should be on this page.', 'invoicing'),
143 143
                     'type'        => 'select',
144 144
                     'options'     => $pages,
145 145
                     'class'       => 'wpi_select2',
146
-                    'placeholder' => __( 'Select a page', 'invoicing' ),
146
+                    'placeholder' => __('Select a page', 'invoicing'),
147 147
                 ),
148 148
             ),
149 149
             'currency_section' => array(
150 150
                 'currency_settings' => array(
151 151
                     'id'   => 'currency_settings',
152
-                    'name' => '<h3>' . __( 'Currency Settings', 'invoicing' ) . '</h3>',
152
+                    'name' => '<h3>' . __('Currency Settings', 'invoicing') . '</h3>',
153 153
                     'desc' => '',
154 154
                     'type' => 'header',
155 155
                 ),
156 156
                 'currency' => array(
157 157
                     'id'      => 'currency',
158
-                    'name'    => __( 'Currency', 'invoicing' ),
159
-                    'desc'    => __( 'Choose your currency. Note that some payment gateways have currency restrictions.', 'invoicing' ),
158
+                    'name'    => __('Currency', 'invoicing'),
159
+                    'desc'    => __('Choose your currency. Note that some payment gateways have currency restrictions.', 'invoicing'),
160 160
                     'type'    => 'select',
161 161
                     'class'       => 'wpi_select2',
162 162
                     'options' => $currency_code_options,
163 163
                 ),
164 164
                 'currency_position' => array(
165 165
                     'id'      => 'currency_position',
166
-                    'name'    => __( 'Currency Position', 'invoicing' ),
167
-                    'desc'    => __( 'Choose the location of the currency sign.', 'invoicing' ),
166
+                    'name'    => __('Currency Position', 'invoicing'),
167
+                    'desc'    => __('Choose the location of the currency sign.', 'invoicing'),
168 168
                     'type'    => 'select',
169 169
                     'class'   => 'wpi_select2',
170 170
                     'options'  => array(
171
-                        'left'        => __( 'Left', 'invoicing' ) . ' (' . $currency_symbol . wpinv_format_amount( '99.99' ) . ')',
172
-                        'right'       => __( 'Right', 'invoicing' ) . ' ('. wpinv_format_amount( '99.99' ) . $currency_symbol . ')',
173
-                        'left_space'  => __( 'Left with space', 'invoicing' ) . ' (' . $currency_symbol . ' ' . wpinv_format_amount( '99.99' ) . ')',
174
-                        'right_space' => __( 'Right with space', 'invoicing' ) . ' (' . wpinv_format_amount( '99.99' ) . ' ' . $currency_symbol . ')'
171
+                        'left'        => __('Left', 'invoicing') . ' (' . $currency_symbol . wpinv_format_amount('99.99') . ')',
172
+                        'right'       => __('Right', 'invoicing') . ' (' . wpinv_format_amount('99.99') . $currency_symbol . ')',
173
+                        'left_space'  => __('Left with space', 'invoicing') . ' (' . $currency_symbol . ' ' . wpinv_format_amount('99.99') . ')',
174
+                        'right_space' => __('Right with space', 'invoicing') . ' (' . wpinv_format_amount('99.99') . ' ' . $currency_symbol . ')'
175 175
                     )
176 176
                 ),
177 177
                 'thousands_separator' => array(
178 178
                     'id'   => 'thousands_separator',
179
-                    'name' => __( 'Thousands Separator', 'invoicing' ),
180
-                    'desc' => __( 'The symbol (usually , or .) to separate thousands', 'invoicing' ),
179
+                    'name' => __('Thousands Separator', 'invoicing'),
180
+                    'desc' => __('The symbol (usually , or .) to separate thousands', 'invoicing'),
181 181
                     'type' => 'text',
182 182
                     'size' => 'small',
183 183
                     'std'  => ',',
184 184
                 ),
185 185
                 'decimal_separator' => array(
186 186
                     'id'   => 'decimal_separator',
187
-                    'name' => __( 'Decimal Separator', 'invoicing' ),
188
-                    'desc' => __( 'The symbol (usually , or .) to separate decimal points', 'invoicing' ),
187
+                    'name' => __('Decimal Separator', 'invoicing'),
188
+                    'desc' => __('The symbol (usually , or .) to separate decimal points', 'invoicing'),
189 189
                     'type' => 'text',
190 190
                     'size' => 'small',
191 191
                     'std'  => '.',
192 192
                 ),
193 193
                 'decimals' => array(
194 194
                     'id'   => 'decimals',
195
-                    'name' => __( 'Number of Decimals', 'invoicing' ),
196
-                    'desc' => __( 'This sets the number of decimal points shown in displayed prices.', 'invoicing' ),
195
+                    'name' => __('Number of Decimals', 'invoicing'),
196
+                    'desc' => __('This sets the number of decimal points shown in displayed prices.', 'invoicing'),
197 197
                     'type' => 'number',
198 198
                     'size' => 'small',
199 199
                     'std'  => '2',
@@ -205,29 +205,29 @@  discard block
 block discarded – undo
205 205
             'labels' => array(
206 206
                 'labels' => array(
207 207
                     'id'   => 'labels_settings',
208
-                    'name' => '<h3>' . __( 'Invoice Labels', 'invoicing' ) . '</h3>',
208
+                    'name' => '<h3>' . __('Invoice Labels', 'invoicing') . '</h3>',
209 209
                     'desc' => '',
210 210
                     'type' => 'header',
211 211
                 ),
212 212
                 'vat_name' => array(
213 213
                     'id' => 'vat_name',
214
-                    'name' => __( 'VAT Name', 'invoicing' ),
215
-                    'desc' => __( 'Enter the VAT name', 'invoicing' ),
214
+                    'name' => __('VAT Name', 'invoicing'),
215
+                    'desc' => __('Enter the VAT name', 'invoicing'),
216 216
                     'type' => 'text',
217 217
                     'size' => 'regular',
218
-                    'std' => __( 'VAT', 'invoicing' ),
218
+                    'std' => __('VAT', 'invoicing'),
219 219
                 ),
220 220
                 'vat_invoice_notice_label' => array(
221 221
                     'id' => 'vat_invoice_notice_label',
222
-                    'name' => __( 'Invoice Notice Label', 'invoicing' ),
223
-                    'desc' => __( 'Use this to add an invoice notice section (label) to your invoices', 'invoicing' ),
222
+                    'name' => __('Invoice Notice Label', 'invoicing'),
223
+                    'desc' => __('Use this to add an invoice notice section (label) to your invoices', 'invoicing'),
224 224
                     'type' => 'text',
225 225
                     'size' => 'regular',
226 226
                 ),
227 227
                 'vat_invoice_notice' => array(
228 228
                     'id' => 'vat_invoice_notice',
229
-                    'name' => __( 'Invoice notice', 'invoicing' ),
230
-                    'desc' =>   __( 'Use this to add an invoice notice section (description) to your invoices', 'invoicing' ),
229
+                    'name' => __('Invoice notice', 'invoicing'),
230
+                    'desc' =>   __('Use this to add an invoice notice section (description) to your invoices', 'invoicing'),
231 231
                     'type' => 'text',
232 232
                     'size' => 'regular',
233 233
                 ),
@@ -239,22 +239,22 @@  discard block
 block discarded – undo
239 239
             'main' => array(
240 240
                 'gateway_settings' => array(
241 241
                     'id'   => 'api_header',
242
-                    'name' => '<h3>' . __( 'Gateway Settings', 'invoicing' ) . '</h3>',
242
+                    'name' => '<h3>' . __('Gateway Settings', 'invoicing') . '</h3>',
243 243
                     'desc' => '',
244 244
                     'type' => 'header',
245 245
                 ),
246 246
                 'gateways' => array(
247 247
                     'id'      => 'gateways',
248
-                    'name'    => __( 'Payment Gateways', 'invoicing' ),
249
-                    'desc'    => __( 'Choose the payment gateways you want to enable.', 'invoicing' ),
248
+                    'name'    => __('Payment Gateways', 'invoicing'),
249
+                    'desc'    => __('Choose the payment gateways you want to enable.', 'invoicing'),
250 250
                     'type'    => 'gateways',
251 251
                     'std'     => array('manual'=>1),
252 252
                     'options' => wpinv_get_payment_gateways(),
253 253
                 ),
254 254
                 'default_gateway' => array(
255 255
                     'id'      => 'default_gateway',
256
-                    'name'    => __( 'Default Gateway', 'invoicing' ),
257
-                    'desc'    => __( 'This gateway will be loaded automatically with the checkout page.', 'invoicing' ),
256
+                    'name'    => __('Default Gateway', 'invoicing'),
257
+                    'desc'    => __('This gateway will be loaded automatically with the checkout page.', 'invoicing'),
258 258
                     'type'    => 'gateway_select',
259 259
                     'std'     => 'manual',
260 260
                     'class'   => 'wpi_select2',
@@ -269,32 +269,32 @@  discard block
 block discarded – undo
269 269
             'main' => array(
270 270
                 'tax_settings' => array(
271 271
                     'id'   => 'tax_settings',
272
-                    'name' => '<h3>' . __( 'Tax Settings', 'invoicing' ) . '</h3>',
272
+                    'name' => '<h3>' . __('Tax Settings', 'invoicing') . '</h3>',
273 273
                     'type' => 'header',
274 274
                 ),
275 275
 
276 276
                 'enable_taxes' => array(
277 277
                     'id'       => 'enable_taxes',
278
-                    'name'     => __( 'Enable Taxes', 'invoicing' ),
279
-                    'desc'     => __( 'Enable tax rates and calculations.', 'invoicing' ),
278
+                    'name'     => __('Enable Taxes', 'invoicing'),
279
+                    'desc'     => __('Enable tax rates and calculations.', 'invoicing'),
280 280
                     'type'     => 'checkbox',
281 281
                     'std'      => 0,
282 282
                 ),
283 283
 
284 284
                 'tax_subtotal_rounding' => array(
285 285
                     'id'                => 'tax_subtotal_rounding',
286
-                    'name'              => __( 'Rounding', 'invoicing' ),
287
-                    'desc'              => __( 'Round tax at subtotal level, instead of rounding per tax rate', 'invoicing' ),
286
+                    'name'              => __('Rounding', 'invoicing'),
287
+                    'desc'              => __('Round tax at subtotal level, instead of rounding per tax rate', 'invoicing'),
288 288
                     'type'              => 'checkbox',
289 289
                     'std'               => 1,
290 290
                 ),
291 291
 
292 292
                 'prices_include_tax' => array(
293 293
                     'id'      => 'prices_include_tax',
294
-                    'name'    => __( 'Prices entered with tax', 'invoicing' ),
294
+                    'name'    => __('Prices entered with tax', 'invoicing'),
295 295
                     'options' => array(
296
-                        'yes' => __( 'Yes, I will enter prices inclusive of tax', 'invoicing' ),
297
-                        'no'  => __( 'No, I will enter prices exclusive of tax', 'invoicing' ),
296
+                        'yes' => __('Yes, I will enter prices inclusive of tax', 'invoicing'),
297
+                        'no'  => __('No, I will enter prices exclusive of tax', 'invoicing'),
298 298
                     ),
299 299
                     'type'    => 'select',
300 300
                     'std'     => 'no',
@@ -302,10 +302,10 @@  discard block
 block discarded – undo
302 302
 
303 303
                 'tax_base'              => array(
304 304
                     'id'                => 'tax_base',
305
-                    'name'              => __( 'Calculate tax based on', 'invoicing' ),
305
+                    'name'              => __('Calculate tax based on', 'invoicing'),
306 306
                     'options'           => array(
307
-                        'billing'       => __( 'Customer billing address', 'invoicing' ),
308
-                        'base'          => __( 'Shop base address', 'invoicing' ),
307
+                        'billing'       => __('Customer billing address', 'invoicing'),
308
+                        'base'          => __('Shop base address', 'invoicing'),
309 309
                     ),
310 310
                     'type'              => 'select',
311 311
                     'std'               => 'billing',
@@ -313,10 +313,10 @@  discard block
 block discarded – undo
313 313
 
314 314
                 'tax_display_totals'    => array(
315 315
                     'id'                => 'tax_display_totals',
316
-                    'name'              => __( 'Display tax totals', 'invoicing' ),
316
+                    'name'              => __('Display tax totals', 'invoicing'),
317 317
                     'options'           => array(
318
-                        'single'        => __( 'As a single total', 'invoicing' ),
319
-                        'individual'    => __( 'As individual tax rates', 'invoicing' ),
318
+                        'single'        => __('As a single total', 'invoicing'),
319
+                        'individual'    => __('As individual tax rates', 'invoicing'),
320 320
                     ),
321 321
                     'type'              => 'select',
322 322
                     'std'               => 'individual',
@@ -324,8 +324,8 @@  discard block
 block discarded – undo
324 324
 
325 325
                 'tax_rate' => array(
326 326
                     'id'   => 'tax_rate',
327
-                    'name' => __( 'Fallback Tax Rate', 'invoicing' ),
328
-                    'desc' => __( 'Enter a percentage, such as 6.5. Customers not in a specific rate will be charged this rate.', 'invoicing' ),
327
+                    'name' => __('Fallback Tax Rate', 'invoicing'),
328
+                    'desc' => __('Enter a percentage, such as 6.5. Customers not in a specific rate will be charged this rate.', 'invoicing'),
329 329
                     'type' => 'number',
330 330
                     'size' => 'small',
331 331
                     'min'  => '0',
@@ -337,8 +337,8 @@  discard block
 block discarded – undo
337 337
             'rates' => array(
338 338
                 'tax_rates' => array(
339 339
                     'id'   => 'tax_rates',
340
-                    'name' => '<h3>' . __( 'Tax Rates', 'invoicing' ) . '</h3>',
341
-                    'desc' => __( 'Enter tax rates for specific regions.', 'invoicing' ),
340
+                    'name' => '<h3>' . __('Tax Rates', 'invoicing') . '</h3>',
341
+                    'desc' => __('Enter tax rates for specific regions.', 'invoicing'),
342 342
                     'type' => 'tax_rates',
343 343
                 ),
344 344
             ),
@@ -347,44 +347,44 @@  discard block
 block discarded – undo
347 347
 
348 348
                 'vat_company_name' => array(
349 349
                     'id' => 'vat_company_name',
350
-                    'name' => __( 'Company Name', 'invoicing' ),
351
-                    'desc' => wp_sprintf(__( 'Verify your company name and  VAT number on the %sEU VIES System.%s', 'invoicing' ), '<a href="http://ec.europa.eu/taxation_customs/vies/" target="_blank">', '</a>' ),
350
+                    'name' => __('Company Name', 'invoicing'),
351
+                    'desc' => wp_sprintf(__('Verify your company name and  VAT number on the %sEU VIES System.%s', 'invoicing'), '<a href="http://ec.europa.eu/taxation_customs/vies/" target="_blank">', '</a>'),
352 352
                     'type' => 'text',
353 353
                     'size' => 'regular',
354 354
                 ),
355 355
 
356 356
                 'vat_number' => array(
357 357
                     'id'   => 'vat_number',
358
-                    'name' => __( 'VAT Number', 'invoicing' ),
359
-                    'desc' => __( 'Enter your VAT number including the country identifier, eg: GB123456789', 'invoicing' ),
358
+                    'name' => __('VAT Number', 'invoicing'),
359
+                    'desc' => __('Enter your VAT number including the country identifier, eg: GB123456789', 'invoicing'),
360 360
                     'type' => 'text',
361 361
                     'size' => 'regular',
362 362
                 ),
363 363
 
364 364
                 'vat_prevent_b2c_purchase' => array(
365 365
                     'id' => 'vat_prevent_b2c_purchase',
366
-                    'name' => __( 'Prevent B2C Sales', 'invoicing' ),
367
-                    'desc' => __( 'Require everyone in the EU to provide a VAT number.', 'invoicing' ),
366
+                    'name' => __('Prevent B2C Sales', 'invoicing'),
367
+                    'desc' => __('Require everyone in the EU to provide a VAT number.', 'invoicing'),
368 368
                     'type' => 'checkbox'
369 369
                 ),
370 370
 
371 371
                 'validate_vat_number' => array(
372 372
                     'id'   => 'validate_vat_number',
373
-                    'name' => __( 'Validate VAT Number', 'invoicing' ),
374
-                    'desc' => __( 'Validate VAT numbers with VIES.', 'invoicing' ),
373
+                    'name' => __('Validate VAT Number', 'invoicing'),
374
+                    'desc' => __('Validate VAT numbers with VIES.', 'invoicing'),
375 375
                     'type' => 'checkbox'
376 376
                 ),
377 377
 
378 378
                 'vat_same_country_rule' => array(
379 379
                     'id'          => 'vat_same_country_rule',
380
-                    'name'        => __( 'Same Country Rule', 'invoicing' ),
381
-                    'desc'        => __( 'What should happen if a customer is from the same country as your business?', 'invoicing' ),
380
+                    'name'        => __('Same Country Rule', 'invoicing'),
381
+                    'desc'        => __('What should happen if a customer is from the same country as your business?', 'invoicing'),
382 382
                     'type'        => 'select',
383 383
                     'options'     => array(
384
-                        'no'        => __( 'Do not charge Tax', 'invoicing' ),
385
-                        'always'    => __( 'Charge Tax', 'invoicing' ),
384
+                        'no'        => __('Do not charge Tax', 'invoicing'),
385
+                        'always'    => __('Charge Tax', 'invoicing'),
386 386
                     ),
387
-                    'placeholder' => __( 'Select an option', 'invoicing' ),
387
+                    'placeholder' => __('Select an option', 'invoicing'),
388 388
                     'std'         => 'always',
389 389
                 ),
390 390
 
@@ -398,68 +398,68 @@  discard block
 block discarded – undo
398 398
             'main' => array(
399 399
                 'email_settings_header' => array(
400 400
                     'id'   => 'email_settings_header',
401
-                    'name' => '<h3>' . __( 'Email Sender Options', 'invoicing' ) . '</h3>',
401
+                    'name' => '<h3>' . __('Email Sender Options', 'invoicing') . '</h3>',
402 402
                     'type' => 'header',
403 403
                 ),
404 404
                 'email_from_name' => array(
405 405
                     'id'   => 'email_from_name',
406
-                    'name' => __( 'From Name', 'invoicing' ),
407
-                    'desc' => __( 'Enter the sender\'s name appears in outgoing invoice emails. This should be your site name.', 'invoicing' ),
408
-                    'std' => esc_attr( get_bloginfo( 'name', 'display' ) ),
406
+                    'name' => __('From Name', 'invoicing'),
407
+                    'desc' => __('Enter the sender\'s name appears in outgoing invoice emails. This should be your site name.', 'invoicing'),
408
+                    'std' => esc_attr(get_bloginfo('name', 'display')),
409 409
                     'type' => 'text',
410 410
                 ),
411 411
                 'email_from' => array(
412 412
                     'id'   => 'email_from',
413
-                    'name' => __( 'From Email', 'invoicing' ),
414
-                    'desc' => sprintf (__( 'Email address to send invoice emails from. This will act as the "from" and "reply-to" address. %s If emails are not being sent it may be that your hosting prevents emails being sent if the email domains do not match.%s', 'invoicing' ), $alert_wrapper_start, $alert_wrapper_close),
415
-                    'std' => get_option( 'admin_email' ),
413
+                    'name' => __('From Email', 'invoicing'),
414
+                    'desc' => sprintf(__('Email address to send invoice emails from. This will act as the "from" and "reply-to" address. %s If emails are not being sent it may be that your hosting prevents emails being sent if the email domains do not match.%s', 'invoicing'), $alert_wrapper_start, $alert_wrapper_close),
415
+                    'std' => get_option('admin_email'),
416 416
                     'type' => 'text',
417 417
                 ),
418 418
                 'admin_email' => array(
419 419
                     'id'   => 'admin_email',
420
-                    'name' => __( 'Admin Email', 'invoicing' ),
421
-                    'desc' => __( 'Where should we send admin notifications?', 'invoicing' ),
422
-                    'std' => get_option( 'admin_email' ),
420
+                    'name' => __('Admin Email', 'invoicing'),
421
+                    'desc' => __('Where should we send admin notifications?', 'invoicing'),
422
+                    'std' => get_option('admin_email'),
423 423
                     'type' => 'text',
424 424
                 ),
425 425
                 'overdue_settings_header' => array(
426 426
                     'id'   => 'overdue_settings_header',
427
-                    'name' => '<h3>' . __( 'Due Date Settings', 'invoicing' ) . '</h3>',
427
+                    'name' => '<h3>' . __('Due Date Settings', 'invoicing') . '</h3>',
428 428
                     'type' => 'header',
429 429
                 ),
430 430
                 'overdue_active' => array(
431 431
                     'id'   => 'overdue_active',
432
-                    'name' => __( 'Enable Due Date', 'invoicing' ),
433
-                    'desc' => __( 'Check this to enable due date option for invoices.', 'invoicing' ),
432
+                    'name' => __('Enable Due Date', 'invoicing'),
433
+                    'desc' => __('Check this to enable due date option for invoices.', 'invoicing'),
434 434
                     'type' => 'checkbox',
435 435
                     'std'  => false,
436 436
                 ),
437 437
                 'overdue_days' => array(
438 438
                     'id'          => 'overdue_days',
439
-                    'name'        => __( 'Default Due Date', 'invoicing' ),
440
-                    'desc'        => __( 'Number of days each Invoice is due after the created date. This will automatically set the date in the "Due Date" field. Can be overridden on individual Invoices.', 'invoicing' ),
439
+                    'name'        => __('Default Due Date', 'invoicing'),
440
+                    'desc'        => __('Number of days each Invoice is due after the created date. This will automatically set the date in the "Due Date" field. Can be overridden on individual Invoices.', 'invoicing'),
441 441
                     'type'        => 'select',
442 442
                     'options'     => $due_payment_options,
443 443
                     'std'         => 0,
444
-                    'placeholder' => __( 'Select a page', 'invoicing' ),
444
+                    'placeholder' => __('Select a page', 'invoicing'),
445 445
                 ),
446 446
                 'email_template_header' => array(
447 447
                     'id'   => 'email_template_header',
448
-                    'name' => '<h3>' . __( 'Email Template', 'invoicing' ) . '</h3>',
448
+                    'name' => '<h3>' . __('Email Template', 'invoicing') . '</h3>',
449 449
                     'type' => 'header',
450 450
                 ),
451 451
                 'email_header_image' => array(
452 452
                     'id'   => 'email_header_image',
453
-                    'name' => __( 'Header Image', 'invoicing' ),
454
-                    'desc' => __( 'URL to an image you want to show in the email header. Upload images using the media uploader (Admin > Media).', 'invoicing' ),
453
+                    'name' => __('Header Image', 'invoicing'),
454
+                    'desc' => __('URL to an image you want to show in the email header. Upload images using the media uploader (Admin > Media).', 'invoicing'),
455 455
                     'std' => '',
456 456
                     'type' => 'text',
457 457
                 ),
458 458
                 'email_footer_text' => array(
459 459
                     'id'   => 'email_footer_text',
460
-                    'name' => __( 'Footer Text', 'invoicing' ),
461
-                    'desc' => __( 'The text to appear in the footer of all invoice emails.', 'invoicing' ),
462
-                    'std' => get_bloginfo( 'name', 'display' ) . ' - ' . __( 'Powered by GeoDirectory', 'invoicing' ),
460
+                    'name' => __('Footer Text', 'invoicing'),
461
+                    'desc' => __('The text to appear in the footer of all invoice emails.', 'invoicing'),
462
+                    'std' => get_bloginfo('name', 'display') . ' - ' . __('Powered by GeoDirectory', 'invoicing'),
463 463
                     'type' => 'textarea',
464 464
                     'class' => 'regular-text',
465 465
                     'rows' => 2,
@@ -467,29 +467,29 @@  discard block
 block discarded – undo
467 467
                 ),
468 468
                 'email_base_color' => array(
469 469
                     'id'   => 'email_base_color',
470
-                    'name' => __( 'Base Color', 'invoicing' ),
471
-                    'desc' => __( 'The base color for invoice email template. Default <code>#557da2</code>.', 'invoicing' ),
470
+                    'name' => __('Base Color', 'invoicing'),
471
+                    'desc' => __('The base color for invoice email template. Default <code>#557da2</code>.', 'invoicing'),
472 472
                     'std' => '#557da2',
473 473
                     'type' => 'color',
474 474
                 ),
475 475
                 'email_background_color' => array(
476 476
                     'id'   => 'email_background_color',
477
-                    'name' => __( 'Background Color', 'invoicing' ),
478
-                    'desc' => __( 'The background color of email template. Default <code>#f5f5f5</code>.', 'invoicing' ),
477
+                    'name' => __('Background Color', 'invoicing'),
478
+                    'desc' => __('The background color of email template. Default <code>#f5f5f5</code>.', 'invoicing'),
479 479
                     'std' => '#f5f5f5',
480 480
                     'type' => 'color',
481 481
                 ),
482 482
                 'email_body_background_color' => array(
483 483
                     'id'   => 'email_body_background_color',
484
-                    'name' => __( 'Body Background Color', 'invoicing' ),
485
-                    'desc' => __( 'The main body background color of email template. Default <code>#fdfdfd</code>.', 'invoicing' ),
484
+                    'name' => __('Body Background Color', 'invoicing'),
485
+                    'desc' => __('The main body background color of email template. Default <code>#fdfdfd</code>.', 'invoicing'),
486 486
                     'std' => '#fdfdfd',
487 487
                     'type' => 'color',
488 488
                 ),
489 489
                 'email_text_color' => array(
490 490
                     'id'   => 'email_text_color',
491
-                    'name' => __( 'Body Text Color', 'invoicing' ),
492
-                    'desc' => __( 'The main body text color. Default <code>#505050</code>.', 'invoicing' ),
491
+                    'name' => __('Body Text Color', 'invoicing'),
492
+                    'desc' => __('The main body text color. Default <code>#505050</code>.', 'invoicing'),
493 493
                     'std' => '#505050',
494 494
                     'type' => 'color',
495 495
                 ),
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
     ),
505 505
 
506 506
     // Integrations.
507
-    'integrations' => wp_list_pluck( getpaid_get_integration_settings(), 'settings', 'id' ),
507
+    'integrations' => wp_list_pluck(getpaid_get_integration_settings(), 'settings', 'id'),
508 508
 
509 509
     /** Privacy Settings */
510 510
     'privacy' => apply_filters('wpinv_settings_privacy',
@@ -512,17 +512,17 @@  discard block
 block discarded – undo
512 512
             'main' => array(
513 513
                 'invoicing_privacy_policy_settings' => array(
514 514
                     'id'   => 'invoicing_privacy_policy_settings',
515
-                    'name' => '<h3>' . __( 'Privacy Policy', 'invoicing' ) . '</h3>',
515
+                    'name' => '<h3>' . __('Privacy Policy', 'invoicing') . '</h3>',
516 516
                     'type' => 'header',
517 517
                 ),
518 518
                 'privacy_page' => array(
519 519
                     'id'          => 'privacy_page',
520
-                    'name'        => __( 'Privacy Page', 'invoicing' ),
521
-                    'desc'        => __( 'If no privacy policy page set in Settings->Privacy default settings, this page will be used on checkout page.', 'invoicing' ),
520
+                    'name'        => __('Privacy Page', 'invoicing'),
521
+                    'desc'        => __('If no privacy policy page set in Settings->Privacy default settings, this page will be used on checkout page.', 'invoicing'),
522 522
                     'type'        => 'select',
523
-                    'options'     => wpinv_get_pages( true,  __( 'Select a page', 'invoicing' )),
523
+                    'options'     => wpinv_get_pages(true, __('Select a page', 'invoicing')),
524 524
                     'class'       => 'wpi_select2',
525
-                    'placeholder' => __( 'Select a page', 'invoicing' ),
525
+                    'placeholder' => __('Select a page', 'invoicing'),
526 526
                 ),
527 527
             ),
528 528
         )
@@ -533,19 +533,19 @@  discard block
 block discarded – undo
533 533
             'main' => array(
534 534
                 'invoice_number_format_settings' => array(
535 535
                     'id'   => 'invoice_number_format_settings',
536
-                    'name' => '<h3>' . __( 'Invoice Number', 'invoicing' ) . '</h3>',
536
+                    'name' => '<h3>' . __('Invoice Number', 'invoicing') . '</h3>',
537 537
                     'type' => 'header',
538 538
                 ),
539 539
                 'sequential_invoice_number' => array(
540 540
                     'id'   => 'sequential_invoice_number',
541
-                    'name' => __( 'Sequential Invoice Numbers', 'invoicing' ),
542
-                    'desc' => __('Check this box to enable sequential invoice numbers.', 'invoicing' ) . $reset_number,
541
+                    'name' => __('Sequential Invoice Numbers', 'invoicing'),
542
+                    'desc' => __('Check this box to enable sequential invoice numbers.', 'invoicing') . $reset_number,
543 543
                     'type' => 'checkbox',
544 544
                 ),
545 545
                 'invoice_sequence_start' => array(
546 546
                     'id'   => 'invoice_sequence_start',
547
-                    'name' => __( 'Sequential Starting Number', 'invoicing' ),
548
-                    'desc' => __( 'The number at which the invoice number sequence should begin.', 'invoicing' ) . $last_number,
547
+                    'name' => __('Sequential Starting Number', 'invoicing'),
548
+                    'desc' => __('The number at which the invoice number sequence should begin.', 'invoicing') . $last_number,
549 549
                     'type' => 'number',
550 550
                     'size' => 'small',
551 551
                     'std'  => '1',
@@ -553,8 +553,8 @@  discard block
 block discarded – undo
553 553
                 ),
554 554
                 'invoice_number_padd' => array(
555 555
                     'id'      => 'invoice_number_padd',
556
-                    'name'    => __( 'Minimum Digits', 'invoicing' ),
557
-                    'desc'    => __( 'If the invoice number has less digits than this number, it is left padded with 0s. Ex: invoice number 108 will padded to 00108 if digits set to 5. The default 0 means no padding.', 'invoicing' ),
556
+                    'name'    => __('Minimum Digits', 'invoicing'),
557
+                    'desc'    => __('If the invoice number has less digits than this number, it is left padded with 0s. Ex: invoice number 108 will padded to 00108 if digits set to 5. The default 0 means no padding.', 'invoicing'),
558 558
                     'type'    => 'select',
559 559
                     'options' => $invoice_number_padd_options,
560 560
                     'std'     => 5,
@@ -562,8 +562,8 @@  discard block
 block discarded – undo
562 562
                 ),
563 563
                 'invoice_number_prefix' => array(
564 564
                     'id' => 'invoice_number_prefix',
565
-                    'name' => __( 'Invoice Number Prefix', 'invoicing' ),
566
-                    'desc' => __( 'Prefix for all invoice numbers. Ex: INV-', 'invoicing' ),
565
+                    'name' => __('Invoice Number Prefix', 'invoicing'),
566
+                    'desc' => __('Prefix for all invoice numbers. Ex: INV-', 'invoicing'),
567 567
                     'type' => 'text',
568 568
                     'size' => 'regular',
569 569
                     'std' => 'INV-',
@@ -571,41 +571,41 @@  discard block
 block discarded – undo
571 571
                 ),
572 572
                 'invoice_number_postfix' => array(
573 573
                     'id' => 'invoice_number_postfix',
574
-                    'name' => __( 'Invoice Number Postfix', 'invoicing' ),
575
-                    'desc' => __( 'Postfix for all invoice numbers.', 'invoicing' ),
574
+                    'name' => __('Invoice Number Postfix', 'invoicing'),
575
+                    'desc' => __('Postfix for all invoice numbers.', 'invoicing'),
576 576
                     'type' => 'text',
577 577
                     'size' => 'regular',
578 578
                     'std' => ''
579 579
                 ),
580 580
                 'checkout_settings' => array(
581 581
                     'id'   => 'checkout_settings',
582
-                    'name' => '<h3>' . __( 'Checkout Settings', 'invoicing' ) . '</h3>',
582
+                    'name' => '<h3>' . __('Checkout Settings', 'invoicing') . '</h3>',
583 583
                     'type' => 'header',
584 584
                 ),
585 585
                 'login_to_checkout' => array(
586 586
                     'id'   => 'login_to_checkout',
587
-                    'name' => __( 'Require Login To Checkout', 'invoicing' ),
588
-                    'desc' => __( 'If ticked then user needs to be logged in to view or pay invoice, can only view or pay their own invoice. If unticked then anyone can view or pay the invoice.', 'invoicing' ),
587
+                    'name' => __('Require Login To Checkout', 'invoicing'),
588
+                    'desc' => __('If ticked then user needs to be logged in to view or pay invoice, can only view or pay their own invoice. If unticked then anyone can view or pay the invoice.', 'invoicing'),
589 589
                     'type' => 'checkbox',
590 590
                 ),
591 591
 
592 592
                 'maxmind_license_key' => array(
593 593
                     'id'   => 'maxmind_license_key',
594
-                    'name' => __( 'MaxMind License Key', 'invoicing' ),
594
+                    'name' => __('MaxMind License Key', 'invoicing'),
595 595
                     'type' => 'text',
596 596
                     'size' => 'regular',
597
-                    'desc' => __( "Enter you license key if you would like to use MaxMind to automatically detect a customer's country.", 'invoicing' ) . ' <a href="https://support.maxmind.com/account-faq/license-keys/how-do-i-generate-a-license-key/">' . __( 'How to generate a free license key.', 'invoicing' ) . '</a>',
597
+                    'desc' => __("Enter you license key if you would like to use MaxMind to automatically detect a customer's country.", 'invoicing') . ' <a href="https://support.maxmind.com/account-faq/license-keys/how-do-i-generate-a-license-key/">' . __('How to generate a free license key.', 'invoicing') . '</a>',
598 598
                 ),
599 599
 
600 600
                 'uninstall_settings' => array(
601 601
                     'id'   => 'uninstall_settings',
602
-                    'name' => '<h3>' . __( 'Uninstall Settings', 'invoicing' ) . '</h3>',
602
+                    'name' => '<h3>' . __('Uninstall Settings', 'invoicing') . '</h3>',
603 603
                     'type' => 'header',
604 604
                 ),
605 605
                 'remove_data_on_unistall' => array(
606 606
                     'id'   => 'remove_data_on_unistall',
607
-                    'name' => __( 'Remove Data on Uninstall?', 'invoicing' ),
608
-                    'desc' => __( 'Check this box if you would like Invoicing plugin to completely remove all of its data when the plugin is deleted/uninstalled.', 'invoicing' ),
607
+                    'name' => __('Remove Data on Uninstall?', 'invoicing'),
608
+                    'desc' => __('Check this box if you would like Invoicing plugin to completely remove all of its data when the plugin is deleted/uninstalled.', 'invoicing'),
609 609
                     'type' => 'checkbox',
610 610
                     'std'  => ''
611 611
                 ),
@@ -614,13 +614,13 @@  discard block
 block discarded – undo
614 614
             'custom-css' => array(
615 615
                 'css_settings' => array(
616 616
                     'id'   => 'css_settings',
617
-                    'name' => '<h3>' . __( 'Custom CSS', 'invoicing' ) . '</h3>',
617
+                    'name' => '<h3>' . __('Custom CSS', 'invoicing') . '</h3>',
618 618
                     'type' => 'header',
619 619
                 ),
620 620
                 'template_custom_css' => array(
621 621
                     'id' => 'template_custom_css',
622
-                    'name' => __( 'Invoice Template CSS', 'invoicing' ),
623
-                    'desc' => __( 'Add CSS to modify appearance of the print invoice page.', 'invoicing' ),
622
+                    'name' => __('Invoice Template CSS', 'invoicing'),
623
+                    'desc' => __('Add CSS to modify appearance of the print invoice page.', 'invoicing'),
624 624
                     'type' => 'textarea',
625 625
                     'class'=> 'regular-text',
626 626
                     'rows' => 10,
@@ -634,8 +634,8 @@  discard block
 block discarded – undo
634 634
             'main' => array(
635 635
                 'tool_settings' => array(
636 636
                     'id'   => 'tool_settings',
637
-                    'name' => '<h3>' . __( 'Diagnostic Tools', 'invoicing' ) . '</h3>',
638
-                    'desc' => __( 'Invoicing diagnostic tools', 'invoicing' ),
637
+                    'name' => '<h3>' . __('Diagnostic Tools', 'invoicing') . '</h3>',
638
+                    'desc' => __('Invoicing diagnostic tools', 'invoicing'),
639 639
                     'type' => 'tools',
640 640
                 ),
641 641
             ),
Please login to merge, or discard this patch.