Passed
Push — master ( 838265...c6d0db )
by Brian
06:10
created
includes/admin/meta-boxes/class-getpaid-meta-box-item-info.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  *
8 8
  */
9 9
 
10
-if ( ! defined( 'ABSPATH' ) ) {
10
+if (!defined('ABSPATH')) {
11 11
 	exit; // Exit if accessed directly
12 12
 }
13 13
 
@@ -21,20 +21,20 @@  discard block
 block discarded – undo
21 21
 	 *
22 22
 	 * @param WP_Post $post
23 23
 	 */
24
-    public static function output( $post ) {
24
+    public static function output($post) {
25 25
 
26 26
         // Prepare the item.
27
-        $item = new WPInv_Item( $post );
27
+        $item = new WPInv_Item($post);
28 28
 
29 29
         ?>
30 30
 
31 31
         <div class='bsui' style='padding-top: 10px;'>
32
-            <?php do_action( 'wpinv_item_before_info_metabox', $item ); ?>
32
+            <?php do_action('wpinv_item_before_info_metabox', $item); ?>
33 33
 
34 34
             <div class="wpinv_item_type form-group row">
35 35
                 <label for="wpinv_item_type" class="col-sm-12 col-form-label">
36
-                    <?php _e( 'Item Type', 'invoicing' );?>
37
-                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php echo strip_tags( self::get_tooltip( $post ) ); ?>"></span>
36
+                    <?php _e('Item Type', 'invoicing'); ?>
37
+                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php echo strip_tags(self::get_tooltip($post)); ?>"></span>
38 38
                 </label>
39 39
 
40 40
                 <div class="col-sm-12">
@@ -44,8 +44,8 @@  discard block
 block discarded – undo
44 44
                             array(
45 45
                                 'id'               => 'wpinv_item_type',
46 46
                                 'name'             => 'wpinv_item_type',
47
-                                'placeholder'      => __( 'Select item type', 'invoicing' ),
48
-                                'value'            => $item->get_type( 'edit' ),
47
+                                'placeholder'      => __('Select item type', 'invoicing'),
48
+                                'value'            => $item->get_type('edit'),
49 49
                                 'select2'          => true,
50 50
                                 'data-allow-clear' => 'false',
51 51
                                 'no_wrap'          => true,
@@ -59,38 +59,38 @@  discard block
 block discarded – undo
59 59
 
60 60
             <div class="wpinv_item_shortcode form-group row">
61 61
                 <label for="wpinv_item_shortcode" class="col-sm-12 col-form-label">
62
-                    <?php _e( 'Payment Form Shortcode', 'invoicing' );?>
63
-                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Displays a payment form', 'invoicing' ); ?>"></span>
62
+                    <?php _e('Payment Form Shortcode', 'invoicing'); ?>
63
+                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Displays a payment form', 'invoicing'); ?>"></span>
64 64
                 </label>
65 65
 
66 66
                 <div class="col-sm-12">
67
-                    <input  onClick="this.select()" type="text" id="wpinv_item_shortcode" value="[getpaid item=<?php echo esc_attr( $item->get_id() ); ?>]" style="width: 100%;" readonly/>
67
+                    <input  onClick="this.select()" type="text" id="wpinv_item_shortcode" value="[getpaid item=<?php echo esc_attr($item->get_id()); ?>]" style="width: 100%;" readonly/>
68 68
                 </div>
69 69
             </div>
70 70
 
71 71
             <div class="wpinv_item_buy_shortcode form-group row">
72 72
                 <label for="wpinv_item_button_shortcode" class="col-sm-12 col-form-label">
73
-                    <?php _e( 'Payment Button Shortcode', 'invoicing' );?>
74
-                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Displays a buy now button', 'invoicing' ); ?>"></span>
73
+                    <?php _e('Payment Button Shortcode', 'invoicing'); ?>
74
+                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Displays a buy now button', 'invoicing'); ?>"></span>
75 75
                 </label>
76 76
 
77 77
                 <div class="col-sm-12">
78
-                    <input onClick="this.select()" type="text" id="wpinv_item_button_shortcode" value="[getpaid item=<?php echo esc_attr( $item->get_id() ); ?> button='Buy Now']" style="width: 100%;" readonly/>
78
+                    <input onClick="this.select()" type="text" id="wpinv_item_button_shortcode" value="[getpaid item=<?php echo esc_attr($item->get_id()); ?> button='Buy Now']" style="width: 100%;" readonly/>
79 79
                 </div>
80 80
             </div>
81 81
 
82 82
             <div class="wpinv_item_custom_id form-group">
83
-                <?php _e( 'Custom ID', 'invoicing' );?> &mdash; <?php echo sanitize_text_field( $item->get_custom_id() ) ?>
83
+                <?php _e('Custom ID', 'invoicing'); ?> &mdash; <?php echo sanitize_text_field($item->get_custom_id()) ?>
84 84
             </div>
85 85
 
86
-            <?php do_action( 'wpinv_meta_values_metabox_before', $post ); ?>
87
-            <?php foreach ( apply_filters( 'wpinv_show_meta_values_for_keys', array() ) as $meta_key ) : ?>
86
+            <?php do_action('wpinv_meta_values_metabox_before', $post); ?>
87
+            <?php foreach (apply_filters('wpinv_show_meta_values_for_keys', array()) as $meta_key) : ?>
88 88
                 <div class="wpinv_item_custom_id form-group">
89
-                    <?php sanitize_text_field( $meta_key );?> &mdash; <?php echo sanitize_text_field( get_post_meta( $item->get_id(), '_wpinv_' . $meta_key, true ) ); ?>
89
+                    <?php sanitize_text_field($meta_key); ?> &mdash; <?php echo sanitize_text_field(get_post_meta($item->get_id(), '_wpinv_' . $meta_key, true)); ?>
90 90
                 </div>
91 91
             <?php endforeach; ?>
92
-            <?php do_action( 'wpinv_meta_values_metabox_after', $post ); ?>
93
-            <?php do_action( 'wpinv_item_info_metabox', $item ); ?>
92
+            <?php do_action('wpinv_meta_values_metabox_after', $post); ?>
93
+            <?php do_action('wpinv_item_info_metabox', $item); ?>
94 94
         </div>
95 95
         <?php
96 96
 
@@ -100,16 +100,16 @@  discard block
 block discarded – undo
100 100
 	 * Returns item type tolltip.
101 101
 	 *
102 102
 	 */
103
-    public static function get_tooltip( $post ) {
103
+    public static function get_tooltip($post) {
104 104
 
105 105
         ob_start();
106 106
         ?>
107 107
 
108
-        <?php _e( 'Standard: Standard item type', 'invoicing' );?>
109
-        <?php _e( 'Fee: Like Registration Fee, Sign up Fee etc', 'invoicing' );?>
108
+        <?php _e('Standard: Standard item type', 'invoicing'); ?>
109
+        <?php _e('Fee: Like Registration Fee, Sign up Fee etc', 'invoicing'); ?>
110 110
 
111 111
         <?php
112
-        do_action( 'wpinv_item_info_metabox_after', $post );
112
+        do_action('wpinv_item_info_metabox_after', $post);
113 113
 
114 114
         return ob_get_clean();
115 115
 
Please login to merge, or discard this patch.
includes/wpinv-helper-functions.php 1 patch
Spacing   +235 added lines, -235 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  * @package Invoicing
7 7
  */
8 8
  
9
-defined( 'ABSPATH' ) || exit;
9
+defined('ABSPATH') || exit;
10 10
 
11 11
 /**
12 12
  * Are we supporting item quantities?
@@ -21,25 +21,25 @@  discard block
 block discarded – undo
21 21
 function wpinv_get_ip() {
22 22
     $ip = $_SERVER['REMOTE_ADDR'];
23 23
 
24
-    if ( ! empty( $_SERVER['HTTP_CLIENT_IP'] ) ) {
24
+    if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
25 25
         //Check ip from share internet.
26 26
         $ip = $_SERVER['HTTP_CLIENT_IP'];
27
-    } elseif ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
27
+    } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
28 28
         //Check ip is pass from proxy.
29 29
         $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
30 30
     }
31 31
 
32
-    return apply_filters( 'wpinv_get_ip', $ip );
32
+    return apply_filters('wpinv_get_ip', $ip);
33 33
 }
34 34
 
35 35
 function wpinv_get_user_agent() {
36
-    if ( ! empty( $_SERVER['HTTP_USER_AGENT'] ) ) {
37
-        $user_agent = sanitize_text_field( $_SERVER['HTTP_USER_AGENT'] );
36
+    if (!empty($_SERVER['HTTP_USER_AGENT'])) {
37
+        $user_agent = sanitize_text_field($_SERVER['HTTP_USER_AGENT']);
38 38
     } else {
39 39
         $user_agent = '';
40 40
     }
41 41
 
42
-    return apply_filters( 'wpinv_get_user_agent', $user_agent );
42
+    return apply_filters('wpinv_get_user_agent', $user_agent);
43 43
 }
44 44
 
45 45
 /**
@@ -47,27 +47,27 @@  discard block
 block discarded – undo
47 47
  * 
48 48
  * @param string $amount The amount to sanitize.
49 49
  */
50
-function wpinv_sanitize_amount( $amount ) {
50
+function wpinv_sanitize_amount($amount) {
51 51
 
52 52
     // Format decimals.
53
-    $amount = str_replace( wpinv_decimal_separator(), '.', $amount );
53
+    $amount = str_replace(wpinv_decimal_separator(), '.', $amount);
54 54
 
55 55
     // Remove thousands.
56
-    $amount = str_replace( wpinv_thousands_separator(), '', $amount );
56
+    $amount = str_replace(wpinv_thousands_separator(), '', $amount);
57 57
 
58 58
     // Cast the remaining to a float.
59
-    return (float) preg_replace( '/[^0-9\.\-]/', '', $amount );
59
+    return (float) preg_replace('/[^0-9\.\-]/', '', $amount);
60 60
 
61 61
 }
62 62
 
63
-function wpinv_round_amount( $amount, $decimals = NULL ) {
64
-    if ( $decimals === NULL ) {
63
+function wpinv_round_amount($amount, $decimals = NULL) {
64
+    if ($decimals === NULL) {
65 65
         $decimals = wpinv_decimals();
66 66
     }
67 67
     
68
-    $amount = round( (double)$amount, wpinv_currency_decimal_filter( absint( $decimals ) ) );
68
+    $amount = round((double) $amount, wpinv_currency_decimal_filter(absint($decimals)));
69 69
 
70
-    return apply_filters( 'wpinv_round_amount', $amount, $decimals );
70
+    return apply_filters('wpinv_round_amount', $amount, $decimals);
71 71
 }
72 72
 
73 73
 /**
@@ -76,32 +76,32 @@  discard block
 block discarded – undo
76 76
  * @since 1.0.19
77 77
  * @return array
78 78
  */
79
-function wpinv_get_invoice_statuses( $draft = false, $trashed = false, $invoice = false ) {
79
+function wpinv_get_invoice_statuses($draft = false, $trashed = false, $invoice = false) {
80 80
 	$invoice_statuses = array(
81
-		'wpi-pending'    => _x( 'Pending payment', 'Invoice status', 'invoicing' ),
82
-        'publish'        => _x( 'Paid', 'Invoice status', 'invoicing' ),
83
-        'wpi-processing' => _x( 'Processing', 'Invoice status', 'invoicing' ),
84
-		'wpi-onhold'     => _x( 'On hold', 'Invoice status', 'invoicing' ),
85
-		'wpi-cancelled'  => _x( 'Cancelled', 'Invoice status', 'invoicing' ),
86
-		'wpi-refunded'   => _x( 'Refunded', 'Invoice status', 'invoicing' ),
87
-        'wpi-failed'     => _x( 'Failed', 'Invoice status', 'invoicing' ),
88
-        'wpi-renewal'    => _x( 'Renewal Payment', 'Invoice status', 'invoicing' ),
81
+		'wpi-pending'    => _x('Pending payment', 'Invoice status', 'invoicing'),
82
+        'publish'        => _x('Paid', 'Invoice status', 'invoicing'),
83
+        'wpi-processing' => _x('Processing', 'Invoice status', 'invoicing'),
84
+		'wpi-onhold'     => _x('On hold', 'Invoice status', 'invoicing'),
85
+		'wpi-cancelled'  => _x('Cancelled', 'Invoice status', 'invoicing'),
86
+		'wpi-refunded'   => _x('Refunded', 'Invoice status', 'invoicing'),
87
+        'wpi-failed'     => _x('Failed', 'Invoice status', 'invoicing'),
88
+        'wpi-renewal'    => _x('Renewal Payment', 'Invoice status', 'invoicing'),
89 89
     );
90 90
 
91
-    if ( $draft ) {
92
-        $invoice_statuses['draft'] = __( 'Draft', 'invoicing' );
91
+    if ($draft) {
92
+        $invoice_statuses['draft'] = __('Draft', 'invoicing');
93 93
     }
94 94
 
95
-    if ( $trashed ) {
96
-        $invoice_statuses['trash'] = __( 'Trash', 'invoicing' );
95
+    if ($trashed) {
96
+        $invoice_statuses['trash'] = __('Trash', 'invoicing');
97 97
     }
98 98
 
99
-	return apply_filters( 'wpinv_statuses', $invoice_statuses, $invoice );
99
+	return apply_filters('wpinv_statuses', $invoice_statuses, $invoice);
100 100
 }
101 101
 
102
-function wpinv_status_nicename( $status ) {
103
-    $statuses = wpinv_get_invoice_statuses( true, true );
104
-    $status   = isset( $statuses[$status] ) ? $statuses[$status] : __( $status, 'invoicing' );
102
+function wpinv_status_nicename($status) {
103
+    $statuses = wpinv_get_invoice_statuses(true, true);
104
+    $status   = isset($statuses[$status]) ? $statuses[$status] : __($status, 'invoicing');
105 105
 
106 106
     return $status;
107 107
 }
@@ -111,13 +111,13 @@  discard block
 block discarded – undo
111 111
  * 
112 112
  * @param string $current
113 113
  */
114
-function wpinv_get_currency( $current = '' ) {
114
+function wpinv_get_currency($current = '') {
115 115
 
116
-    if ( empty( $current ) ) {
117
-        $current = apply_filters( 'wpinv_currency', wpinv_get_option( 'currency', 'USD' ) );
116
+    if (empty($current)) {
117
+        $current = apply_filters('wpinv_currency', wpinv_get_option('currency', 'USD'));
118 118
     }
119 119
 
120
-    return trim( strtoupper( $current ) );
120
+    return trim(strtoupper($current));
121 121
 }
122 122
 
123 123
 /**
@@ -125,25 +125,25 @@  discard block
 block discarded – undo
125 125
  * 
126 126
  * @param string|null $currency The currency code. Defaults to the default currency.
127 127
  */
128
-function wpinv_currency_symbol( $currency = null ) {
128
+function wpinv_currency_symbol($currency = null) {
129 129
 
130 130
     // Prepare the currency.
131
-    $currency = empty( $currency ) ? wpinv_get_currency() : wpinv_clean( $currency );
131
+    $currency = empty($currency) ? wpinv_get_currency() : wpinv_clean($currency);
132 132
 
133 133
     // Fetch all symbols.
134 134
     $symbols = wpinv_get_currency_symbols();
135 135
 
136 136
     // Fetch this currencies symbol.
137
-    $currency_symbol = isset( $symbols[$currency] ) ? $symbols[$currency] : $currency;
137
+    $currency_symbol = isset($symbols[$currency]) ? $symbols[$currency] : $currency;
138 138
 
139 139
     // Filter the symbol.
140
-    return apply_filters( 'wpinv_currency_symbol', $currency_symbol, $currency );
140
+    return apply_filters('wpinv_currency_symbol', $currency_symbol, $currency);
141 141
 }
142 142
 
143 143
 function wpinv_currency_position() {
144
-    $position = wpinv_get_option( 'currency_position', 'left' );
144
+    $position = wpinv_get_option('currency_position', 'left');
145 145
     
146
-    return apply_filters( 'wpinv_currency_position', $position );
146
+    return apply_filters('wpinv_currency_position', $position);
147 147
 }
148 148
 
149 149
 /**
@@ -151,13 +151,13 @@  discard block
 block discarded – undo
151 151
  * 
152 152
  * @param $string|null $current
153 153
  */
154
-function wpinv_thousands_separator( $current = null ) {
154
+function wpinv_thousands_separator($current = null) {
155 155
 
156
-    if ( null == $current ) {
157
-        $current = wpinv_get_option( 'thousands_separator', '.' );
156
+    if (null == $current) {
157
+        $current = wpinv_get_option('thousands_separator', '.');
158 158
     }
159 159
 
160
-    return trim( $current );
160
+    return trim($current);
161 161
 }
162 162
 
163 163
 /**
@@ -165,13 +165,13 @@  discard block
 block discarded – undo
165 165
  * 
166 166
  * @param $string|null $current
167 167
  */
168
-function wpinv_decimal_separator( $current = null ) {
168
+function wpinv_decimal_separator($current = null) {
169 169
 
170
-    if ( null == $current ) {
171
-        $current = wpinv_get_option( 'decimal_separator', '.' );
170
+    if (null == $current) {
171
+        $current = wpinv_get_option('decimal_separator', '.');
172 172
     }
173 173
     
174
-    return trim( $current );
174
+    return trim($current);
175 175
 }
176 176
 
177 177
 /**
@@ -179,27 +179,27 @@  discard block
 block discarded – undo
179 179
  * 
180 180
  * @param $string|null $current
181 181
  */
182
-function wpinv_decimals( $current = null ) {
182
+function wpinv_decimals($current = null) {
183 183
 
184
-    if ( null == $current ) {
185
-        $current = wpinv_get_option( 'decimals', 2 );
184
+    if (null == $current) {
185
+        $current = wpinv_get_option('decimals', 2);
186 186
     }
187 187
     
188
-    return absint( $current );
188
+    return absint($current);
189 189
 }
190 190
 
191 191
 /**
192 192
  * Retrieves a list of all supported currencies.
193 193
  */
194 194
 function wpinv_get_currencies() {
195
-    return apply_filters( 'wpinv_currencies', wpinv_get_data( 'currencies' ) );
195
+    return apply_filters('wpinv_currencies', wpinv_get_data('currencies'));
196 196
 }
197 197
 
198 198
 /**
199 199
  * Retrieves a list of all currency symbols.
200 200
  */
201 201
 function wpinv_get_currency_symbols() {
202
-    return apply_filters( 'wpinv_currency_symbols', wpinv_get_data( 'currency-symbols' ) );
202
+    return apply_filters('wpinv_currency_symbols', wpinv_get_data('currency-symbols'));
203 203
 }
204 204
 
205 205
 /**
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 	$currency_pos = wpinv_currency_position();
212 212
 	$format       = '%1$s%2$s';
213 213
 
214
-	switch ( $currency_pos ) {
214
+	switch ($currency_pos) {
215 215
 		case 'left':
216 216
 			$format = '%1$s%2$s';
217 217
 			break;
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 			break;
227 227
 	}
228 228
 
229
-	return apply_filters( 'getpaid_price_format', $format, $currency_pos );
229
+	return apply_filters('getpaid_price_format', $format, $currency_pos);
230 230
 }
231 231
 
232 232
 /**
@@ -236,25 +236,25 @@  discard block
 block discarded – undo
236 236
  * @param  string $currency Currency.
237 237
  * @return string
238 238
  */
239
-function wpinv_price( $amount = 0, $currency = '' ) {
239
+function wpinv_price($amount = 0, $currency = '') {
240 240
 
241 241
     // Backwards compatibility.
242
-    $amount             = floatval( wpinv_sanitize_amount( $amount ) );
242
+    $amount             = floatval(wpinv_sanitize_amount($amount));
243 243
 
244 244
     // Prepare variables.
245
-    $currency           = wpinv_get_currency( $currency );
245
+    $currency           = wpinv_get_currency($currency);
246 246
     $amount             = (float) $amount;
247 247
     $unformatted_amount = $amount;
248 248
     $negative           = $amount < 0;
249
-    $amount             = apply_filters( 'getpaid_raw_amount', floatval( $negative ? $amount * -1 : $amount ) );
250
-    $amount             = wpinv_format_amount( $amount );
249
+    $amount             = apply_filters('getpaid_raw_amount', floatval($negative ? $amount * -1 : $amount));
250
+    $amount             = wpinv_format_amount($amount);
251 251
 
252 252
     // Format the amount.
253 253
     $format             = getpaid_get_price_format();
254
-    $formatted_amount   = ( $negative ? '-' : '' ) . sprintf( $format, '<span class="getpaid-currency__symbol">' . wpinv_currency_symbol( $currency ) . '</span>', $amount );
254
+    $formatted_amount   = ($negative ? '-' : '') . sprintf($format, '<span class="getpaid-currency__symbol">' . wpinv_currency_symbol($currency) . '</span>', $amount);
255 255
 
256 256
     // Filter the formatting.
257
-    return apply_filters( 'wpinv_price', $formatted_amount, $amount, $currency, $unformatted_amount );
257
+    return apply_filters('wpinv_price', $formatted_amount, $amount, $currency, $unformatted_amount);
258 258
 }
259 259
 
260 260
 /**
@@ -265,33 +265,33 @@  discard block
 block discarded – undo
265 265
  * @param  bool     $calculate Whether or not to apply separators.
266 266
  * @return string
267 267
  */
268
-function wpinv_format_amount( $amount, $decimals = null, $calculate = false ) {
268
+function wpinv_format_amount($amount, $decimals = null, $calculate = false) {
269 269
     $thousands_sep = wpinv_thousands_separator();
270 270
     $decimal_sep   = wpinv_decimal_separator();
271
-    $decimals      = wpinv_decimals( $decimals );
271
+    $decimals      = wpinv_decimals($decimals);
272 272
 
273 273
     // Format decimals.
274
-    $amount = str_replace( $decimal_sep, '.', $amount );
274
+    $amount = str_replace($decimal_sep, '.', $amount);
275 275
 
276 276
     // Remove thousands.
277
-    $amount = str_replace( $thousands_sep, '', $amount );
277
+    $amount = str_replace($thousands_sep, '', $amount);
278 278
 
279 279
     // Cast the remaining to a float.
280
-    $amount = floatval( $amount );
280
+    $amount = floatval($amount);
281 281
 
282
-    if ( $calculate ) {
282
+    if ($calculate) {
283 283
         return $amount;
284 284
     }
285 285
 
286 286
     // Fomart the amount.
287
-    return number_format( $amount, $decimals, $decimal_sep, $thousands_sep );
287
+    return number_format($amount, $decimals, $decimal_sep, $thousands_sep);
288 288
 }
289 289
 
290
-function wpinv_sanitize_key( $key ) {
290
+function wpinv_sanitize_key($key) {
291 291
     $raw_key = $key;
292
-    $key = preg_replace( '/[^a-zA-Z0-9_\-\.\:\/]/', '', $key );
292
+    $key = preg_replace('/[^a-zA-Z0-9_\-\.\:\/]/', '', $key);
293 293
 
294
-    return apply_filters( 'wpinv_sanitize_key', $key, $raw_key );
294
+    return apply_filters('wpinv_sanitize_key', $key, $raw_key);
295 295
 }
296 296
 
297 297
 /**
@@ -299,8 +299,8 @@  discard block
 block discarded – undo
299 299
  * 
300 300
  * @param $str the file whose extension should be retrieved.
301 301
  */
302
-function wpinv_get_file_extension( $str ) {
303
-    $filetype = wp_check_filetype( $str );
302
+function wpinv_get_file_extension($str) {
303
+    $filetype = wp_check_filetype($str);
304 304
     return $filetype['ext'];
305 305
 }
306 306
 
@@ -309,16 +309,16 @@  discard block
 block discarded – undo
309 309
  * 
310 310
  * @param string $string
311 311
  */
312
-function wpinv_string_is_image_url( $string ) {
313
-    $extension = strtolower( wpinv_get_file_extension( $string ) );
314
-    return in_array( $extension, array( 'jpeg', 'jpg', 'png', 'gif', 'ico' ), true );
312
+function wpinv_string_is_image_url($string) {
313
+    $extension = strtolower(wpinv_get_file_extension($string));
314
+    return in_array($extension, array('jpeg', 'jpg', 'png', 'gif', 'ico'), true);
315 315
 }
316 316
 
317 317
 /**
318 318
  * Returns the current URL.
319 319
  */
320 320
 function wpinv_get_current_page_url() {
321
-    return ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
321
+    return (is_ssl() ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
322 322
 }
323 323
 
324 324
 /**
@@ -328,46 +328,46 @@  discard block
 block discarded – undo
328 328
  * @param string $name  Constant name.
329 329
  * @param mixed  $value Value.
330 330
  */
331
-function getpaid_maybe_define_constant( $name, $value ) {
332
-	if ( ! defined( $name ) ) {
333
-		define( $name, $value );
331
+function getpaid_maybe_define_constant($name, $value) {
332
+	if (!defined($name)) {
333
+		define($name, $value);
334 334
 	}
335 335
 }
336 336
 
337 337
 function wpinv_get_php_arg_separator_output() {
338
-	return ini_get( 'arg_separator.output' );
338
+	return ini_get('arg_separator.output');
339 339
 }
340 340
 
341
-function wpinv_rgb_from_hex( $color ) {
342
-    $color = str_replace( '#', '', $color );
341
+function wpinv_rgb_from_hex($color) {
342
+    $color = str_replace('#', '', $color);
343 343
 
344 344
     // Convert shorthand colors to full format, e.g. "FFF" -> "FFFFFF"
345
-    $color = preg_replace( '~^(.)(.)(.)$~', '$1$1$2$2$3$3', $color );
346
-    if ( empty( $color ) ) {
345
+    $color = preg_replace('~^(.)(.)(.)$~', '$1$1$2$2$3$3', $color);
346
+    if (empty($color)) {
347 347
         return NULL;
348 348
     }
349 349
 
350
-    $color = str_split( $color );
350
+    $color = str_split($color);
351 351
 
352 352
     $rgb      = array();
353
-    $rgb['R'] = hexdec( $color[0] . $color[1] );
354
-    $rgb['G'] = hexdec( $color[2] . $color[3] );
355
-    $rgb['B'] = hexdec( $color[4] . $color[5] );
353
+    $rgb['R'] = hexdec($color[0] . $color[1]);
354
+    $rgb['G'] = hexdec($color[2] . $color[3]);
355
+    $rgb['B'] = hexdec($color[4] . $color[5]);
356 356
 
357 357
     return $rgb;
358 358
 }
359 359
 
360
-function wpinv_hex_darker( $color, $factor = 30 ) {
361
-    $base  = wpinv_rgb_from_hex( $color );
360
+function wpinv_hex_darker($color, $factor = 30) {
361
+    $base  = wpinv_rgb_from_hex($color);
362 362
     $color = '#';
363 363
 
364
-    foreach ( $base as $k => $v ) {
364
+    foreach ($base as $k => $v) {
365 365
         $amount      = $v / 100;
366
-        $amount      = round( $amount * $factor );
366
+        $amount      = round($amount * $factor);
367 367
         $new_decimal = $v - $amount;
368 368
 
369
-        $new_hex_component = dechex( $new_decimal );
370
-        if ( strlen( $new_hex_component ) < 2 ) {
369
+        $new_hex_component = dechex($new_decimal);
370
+        if (strlen($new_hex_component) < 2) {
371 371
             $new_hex_component = "0" . $new_hex_component;
372 372
         }
373 373
         $color .= $new_hex_component;
@@ -376,18 +376,18 @@  discard block
 block discarded – undo
376 376
     return $color;
377 377
 }
378 378
 
379
-function wpinv_hex_lighter( $color, $factor = 30 ) {
380
-    $base  = wpinv_rgb_from_hex( $color );
379
+function wpinv_hex_lighter($color, $factor = 30) {
380
+    $base  = wpinv_rgb_from_hex($color);
381 381
     $color = '#';
382 382
 
383
-    foreach ( $base as $k => $v ) {
383
+    foreach ($base as $k => $v) {
384 384
         $amount      = 255 - $v;
385 385
         $amount      = $amount / 100;
386
-        $amount      = round( $amount * $factor );
386
+        $amount      = round($amount * $factor);
387 387
         $new_decimal = $v + $amount;
388 388
 
389
-        $new_hex_component = dechex( $new_decimal );
390
-        if ( strlen( $new_hex_component ) < 2 ) {
389
+        $new_hex_component = dechex($new_decimal);
390
+        if (strlen($new_hex_component) < 2) {
391 391
             $new_hex_component = "0" . $new_hex_component;
392 392
         }
393 393
         $color .= $new_hex_component;
@@ -396,22 +396,22 @@  discard block
 block discarded – undo
396 396
     return $color;
397 397
 }
398 398
 
399
-function wpinv_light_or_dark( $color, $dark = '#000000', $light = '#FFFFFF' ) {
400
-    $hex = str_replace( '#', '', $color );
399
+function wpinv_light_or_dark($color, $dark = '#000000', $light = '#FFFFFF') {
400
+    $hex = str_replace('#', '', $color);
401 401
 
402
-    $c_r = hexdec( substr( $hex, 0, 2 ) );
403
-    $c_g = hexdec( substr( $hex, 2, 2 ) );
404
-    $c_b = hexdec( substr( $hex, 4, 2 ) );
402
+    $c_r = hexdec(substr($hex, 0, 2));
403
+    $c_g = hexdec(substr($hex, 2, 2));
404
+    $c_b = hexdec(substr($hex, 4, 2));
405 405
 
406
-    $brightness = ( ( $c_r * 299 ) + ( $c_g * 587 ) + ( $c_b * 114 ) ) / 1000;
406
+    $brightness = (($c_r * 299) + ($c_g * 587) + ($c_b * 114)) / 1000;
407 407
 
408 408
     return $brightness > 155 ? $dark : $light;
409 409
 }
410 410
 
411
-function wpinv_format_hex( $hex ) {
412
-    $hex = trim( str_replace( '#', '', $hex ) );
411
+function wpinv_format_hex($hex) {
412
+    $hex = trim(str_replace('#', '', $hex));
413 413
 
414
-    if ( strlen( $hex ) == 3 ) {
414
+    if (strlen($hex) == 3) {
415 415
         $hex = $hex[0] . $hex[0] . $hex[1] . $hex[1] . $hex[2] . $hex[2];
416 416
     }
417 417
 
@@ -431,12 +431,12 @@  discard block
 block discarded – undo
431 431
  * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8".
432 432
  * @return string
433 433
  */
434
-function wpinv_utf8_strimwidth( $str, $start, $width, $trimmaker = '', $encoding = 'UTF-8' ) {
435
-    if ( function_exists( 'mb_strimwidth' ) ) {
436
-        return mb_strimwidth( $str, $start, $width, $trimmaker, $encoding );
434
+function wpinv_utf8_strimwidth($str, $start, $width, $trimmaker = '', $encoding = 'UTF-8') {
435
+    if (function_exists('mb_strimwidth')) {
436
+        return mb_strimwidth($str, $start, $width, $trimmaker, $encoding);
437 437
     }
438 438
     
439
-    return wpinv_utf8_substr( $str, $start, $width, $encoding ) . $trimmaker;
439
+    return wpinv_utf8_substr($str, $start, $width, $encoding) . $trimmaker;
440 440
 }
441 441
 
442 442
 /**
@@ -448,28 +448,28 @@  discard block
 block discarded – undo
448 448
  * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8".
449 449
  * @return int Returns the number of characters in string.
450 450
  */
451
-function wpinv_utf8_strlen( $str, $encoding = 'UTF-8' ) {
452
-    if ( function_exists( 'mb_strlen' ) ) {
453
-        return mb_strlen( $str, $encoding );
451
+function wpinv_utf8_strlen($str, $encoding = 'UTF-8') {
452
+    if (function_exists('mb_strlen')) {
453
+        return mb_strlen($str, $encoding);
454 454
     }
455 455
         
456
-    return strlen( $str );
456
+    return strlen($str);
457 457
 }
458 458
 
459
-function wpinv_utf8_strtolower( $str, $encoding = 'UTF-8' ) {
460
-    if ( function_exists( 'mb_strtolower' ) ) {
461
-        return mb_strtolower( $str, $encoding );
459
+function wpinv_utf8_strtolower($str, $encoding = 'UTF-8') {
460
+    if (function_exists('mb_strtolower')) {
461
+        return mb_strtolower($str, $encoding);
462 462
     }
463 463
     
464
-    return strtolower( $str );
464
+    return strtolower($str);
465 465
 }
466 466
 
467
-function wpinv_utf8_strtoupper( $str, $encoding = 'UTF-8' ) {
468
-    if ( function_exists( 'mb_strtoupper' ) ) {
469
-        return mb_strtoupper( $str, $encoding );
467
+function wpinv_utf8_strtoupper($str, $encoding = 'UTF-8') {
468
+    if (function_exists('mb_strtoupper')) {
469
+        return mb_strtoupper($str, $encoding);
470 470
     }
471 471
     
472
-    return strtoupper( $str );
472
+    return strtoupper($str);
473 473
 }
474 474
 
475 475
 /**
@@ -483,12 +483,12 @@  discard block
 block discarded – undo
483 483
  * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8".
484 484
  * @return int Returns the position of the first occurrence of search in the string.
485 485
  */
486
-function wpinv_utf8_strpos( $str, $find, $offset = 0, $encoding = 'UTF-8' ) {
487
-    if ( function_exists( 'mb_strpos' ) ) {
488
-        return mb_strpos( $str, $find, $offset, $encoding );
486
+function wpinv_utf8_strpos($str, $find, $offset = 0, $encoding = 'UTF-8') {
487
+    if (function_exists('mb_strpos')) {
488
+        return mb_strpos($str, $find, $offset, $encoding);
489 489
     }
490 490
         
491
-    return strpos( $str, $find, $offset );
491
+    return strpos($str, $find, $offset);
492 492
 }
493 493
 
494 494
 /**
@@ -502,12 +502,12 @@  discard block
 block discarded – undo
502 502
  * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8".
503 503
  * @return int Returns the position of the last occurrence of search.
504 504
  */
505
-function wpinv_utf8_strrpos( $str, $find, $offset = 0, $encoding = 'UTF-8' ) {
506
-    if ( function_exists( 'mb_strrpos' ) ) {
507
-        return mb_strrpos( $str, $find, $offset, $encoding );
505
+function wpinv_utf8_strrpos($str, $find, $offset = 0, $encoding = 'UTF-8') {
506
+    if (function_exists('mb_strrpos')) {
507
+        return mb_strrpos($str, $find, $offset, $encoding);
508 508
     }
509 509
         
510
-    return strrpos( $str, $find, $offset );
510
+    return strrpos($str, $find, $offset);
511 511
 }
512 512
 
513 513
 /**
@@ -522,16 +522,16 @@  discard block
 block discarded – undo
522 522
  * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8".
523 523
  * @return string
524 524
  */
525
-function wpinv_utf8_substr( $str, $start, $length = null, $encoding = 'UTF-8' ) {
526
-    if ( function_exists( 'mb_substr' ) ) {
527
-        if ( $length === null ) {
528
-            return mb_substr( $str, $start, wpinv_utf8_strlen( $str, $encoding ), $encoding );
525
+function wpinv_utf8_substr($str, $start, $length = null, $encoding = 'UTF-8') {
526
+    if (function_exists('mb_substr')) {
527
+        if ($length === null) {
528
+            return mb_substr($str, $start, wpinv_utf8_strlen($str, $encoding), $encoding);
529 529
         } else {
530
-            return mb_substr( $str, $start, $length, $encoding );
530
+            return mb_substr($str, $start, $length, $encoding);
531 531
         }
532 532
     }
533 533
         
534
-    return substr( $str, $start, $length );
534
+    return substr($str, $start, $length);
535 535
 }
536 536
 
537 537
 /**
@@ -543,48 +543,48 @@  discard block
 block discarded – undo
543 543
  * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8".
544 544
  * @return string The width of string.
545 545
  */
546
-function wpinv_utf8_strwidth( $str, $encoding = 'UTF-8' ) {
547
-    if ( function_exists( 'mb_strwidth' ) ) {
548
-        return mb_strwidth( $str, $encoding );
546
+function wpinv_utf8_strwidth($str, $encoding = 'UTF-8') {
547
+    if (function_exists('mb_strwidth')) {
548
+        return mb_strwidth($str, $encoding);
549 549
     }
550 550
     
551
-    return wpinv_utf8_strlen( $str, $encoding );
551
+    return wpinv_utf8_strlen($str, $encoding);
552 552
 }
553 553
 
554
-function wpinv_utf8_ucfirst( $str, $lower_str_end = false, $encoding = 'UTF-8' ) {
555
-    if ( function_exists( 'mb_strlen' ) ) {
556
-        $first_letter = wpinv_utf8_strtoupper( wpinv_utf8_substr( $str, 0, 1, $encoding ), $encoding );
554
+function wpinv_utf8_ucfirst($str, $lower_str_end = false, $encoding = 'UTF-8') {
555
+    if (function_exists('mb_strlen')) {
556
+        $first_letter = wpinv_utf8_strtoupper(wpinv_utf8_substr($str, 0, 1, $encoding), $encoding);
557 557
         $str_end = "";
558 558
         
559
-        if ( $lower_str_end ) {
560
-            $str_end = wpinv_utf8_strtolower( wpinv_utf8_substr( $str, 1, wpinv_utf8_strlen( $str, $encoding ), $encoding ), $encoding );
559
+        if ($lower_str_end) {
560
+            $str_end = wpinv_utf8_strtolower(wpinv_utf8_substr($str, 1, wpinv_utf8_strlen($str, $encoding), $encoding), $encoding);
561 561
         } else {
562
-            $str_end = wpinv_utf8_substr( $str, 1, wpinv_utf8_strlen( $str, $encoding ), $encoding );
562
+            $str_end = wpinv_utf8_substr($str, 1, wpinv_utf8_strlen($str, $encoding), $encoding);
563 563
         }
564 564
 
565 565
         return $first_letter . $str_end;
566 566
     }
567 567
     
568
-    return ucfirst( $str );
568
+    return ucfirst($str);
569 569
 }
570 570
 
571
-function wpinv_utf8_ucwords( $str, $encoding = 'UTF-8' ) {
572
-    if ( function_exists( 'mb_convert_case' ) ) {
573
-        return mb_convert_case( $str, MB_CASE_TITLE, $encoding );
571
+function wpinv_utf8_ucwords($str, $encoding = 'UTF-8') {
572
+    if (function_exists('mb_convert_case')) {
573
+        return mb_convert_case($str, MB_CASE_TITLE, $encoding);
574 574
     }
575 575
     
576
-    return ucwords( $str );
576
+    return ucwords($str);
577 577
 }
578 578
 
579
-function wpinv_period_in_days( $period, $unit ) {
580
-    $period = absint( $period );
579
+function wpinv_period_in_days($period, $unit) {
580
+    $period = absint($period);
581 581
     
582
-    if ( $period > 0 ) {
583
-        if ( in_array( strtolower( $unit ), array( 'w', 'week', 'weeks' ) ) ) {
582
+    if ($period > 0) {
583
+        if (in_array(strtolower($unit), array('w', 'week', 'weeks'))) {
584 584
             $period = $period * 7;
585
-        } else if ( in_array( strtolower( $unit ), array( 'm', 'month', 'months' ) ) ) {
585
+        } else if (in_array(strtolower($unit), array('m', 'month', 'months'))) {
586 586
             $period = $period * 30;
587
-        } else if ( in_array( strtolower( $unit ), array( 'y', 'year', 'years' ) ) ) {
587
+        } else if (in_array(strtolower($unit), array('y', 'year', 'years'))) {
588 588
             $period = $period * 365;
589 589
         }
590 590
     }
@@ -592,14 +592,14 @@  discard block
 block discarded – undo
592 592
     return $period;
593 593
 }
594 594
 
595
-function wpinv_cal_days_in_month( $calendar, $month, $year ) {
596
-    if ( function_exists( 'cal_days_in_month' ) ) {
597
-        return cal_days_in_month( $calendar, $month, $year );
595
+function wpinv_cal_days_in_month($calendar, $month, $year) {
596
+    if (function_exists('cal_days_in_month')) {
597
+        return cal_days_in_month($calendar, $month, $year);
598 598
     }
599 599
 
600 600
     // Fallback in case the calendar extension is not loaded in PHP
601 601
     // Only supports Gregorian calendar
602
-    return date( 't', mktime( 0, 0, 0, $month, 1, $year ) );
602
+    return date('t', mktime(0, 0, 0, $month, 1, $year));
603 603
 }
604 604
 
605 605
 /**
@@ -610,12 +610,12 @@  discard block
 block discarded – undo
610 610
  *
611 611
  * @return string
612 612
  */
613
-function wpi_help_tip( $tip, $allow_html = false ) {
613
+function wpi_help_tip($tip, $allow_html = false) {
614 614
 
615
-    if ( $allow_html ) {
616
-        $tip = wpi_sanitize_tooltip( $tip );
615
+    if ($allow_html) {
616
+        $tip = wpi_sanitize_tooltip($tip);
617 617
     } else {
618
-        $tip = esc_attr( $tip );
618
+        $tip = esc_attr($tip);
619 619
     }
620 620
 
621 621
     return '<span class="wpi-help-tip dashicons dashicons-editor-help" title="' . $tip . '"></span>';
@@ -629,8 +629,8 @@  discard block
 block discarded – undo
629 629
  * @param string $var
630 630
  * @return string
631 631
  */
632
-function wpi_sanitize_tooltip( $var ) {
633
-    return wp_kses( html_entity_decode( $var ), array(
632
+function wpi_sanitize_tooltip($var) {
633
+    return wp_kses(html_entity_decode($var), array(
634 634
         'br'     => array(),
635 635
         'em'     => array(),
636 636
         'strong' => array(),
@@ -641,7 +641,7 @@  discard block
 block discarded – undo
641 641
         'li'     => array(),
642 642
         'ol'     => array(),
643 643
         'p'      => array(),
644
-    ) );
644
+    ));
645 645
 }
646 646
 
647 647
 /**
@@ -651,7 +651,7 @@  discard block
 block discarded – undo
651 651
  */
652 652
 function wpinv_get_screen_ids() {
653 653
 
654
-    $screen_id = sanitize_title( __( 'Invoicing', 'invoicing' ) );
654
+    $screen_id = sanitize_title(__('Invoicing', 'invoicing'));
655 655
 
656 656
     $screen_ids = array(
657 657
         'toplevel_page_' . $screen_id,
@@ -669,7 +669,7 @@  discard block
 block discarded – undo
669 669
         'invoicing_page_wpi-addons',
670 670
     );
671 671
 
672
-    return apply_filters( 'wpinv_screen_ids', $screen_ids );
672
+    return apply_filters('wpinv_screen_ids', $screen_ids);
673 673
 }
674 674
 
675 675
 /**
@@ -680,14 +680,14 @@  discard block
 block discarded – undo
680 680
  * @param array|string $list List of values.
681 681
  * @return array Sanitized array of values.
682 682
  */
683
-function wpinv_parse_list( $list ) {
683
+function wpinv_parse_list($list) {
684 684
 
685
-    if ( empty( $list ) ) {
685
+    if (empty($list)) {
686 686
         $list = array();
687 687
     }
688 688
 
689
-	if ( ! is_array( $list ) ) {
690
-		return preg_split( '/[\s,]+/', $list, -1, PREG_SPLIT_NO_EMPTY );
689
+	if (!is_array($list)) {
690
+		return preg_split('/[\s,]+/', $list, -1, PREG_SPLIT_NO_EMPTY);
691 691
 	}
692 692
 
693 693
 	return $list;
@@ -701,16 +701,16 @@  discard block
 block discarded – undo
701 701
  * @param string $key Type of data to fetch.
702 702
  * @return mixed Fetched data.
703 703
  */
704
-function wpinv_get_data( $key ) {
704
+function wpinv_get_data($key) {
705 705
 
706 706
     // Try fetching it from the cache.
707
-    $data = wp_cache_get( "wpinv-data-$key", 'wpinv' );
708
-    if( $data ) {
707
+    $data = wp_cache_get("wpinv-data-$key", 'wpinv');
708
+    if ($data) {
709 709
         return $data;
710 710
     }
711 711
 
712
-    $data = apply_filters( "wpinv_get_$key", include WPINV_PLUGIN_DIR . "includes/data/$key.php" );
713
-	wp_cache_set( "wpinv-data-$key", $data, 'wpinv' );
712
+    $data = apply_filters("wpinv_get_$key", include WPINV_PLUGIN_DIR . "includes/data/$key.php");
713
+	wp_cache_set("wpinv-data-$key", $data, 'wpinv');
714 714
 
715 715
 	return $data;
716 716
 }
@@ -724,10 +724,10 @@  discard block
 block discarded – undo
724 724
  * @param bool $first_empty Whether or not the first item in the list should be empty
725 725
  * @return mixed Fetched data.
726 726
  */
727
-function wpinv_maybe_add_empty_option( $options, $first_empty ) {
727
+function wpinv_maybe_add_empty_option($options, $first_empty) {
728 728
 
729
-    if ( ! empty( $options ) && $first_empty ) {
730
-        return array_merge( array( '' => '' ), $options );
729
+    if (!empty($options) && $first_empty) {
730
+        return array_merge(array('' => ''), $options);
731 731
     }
732 732
     return $options;
733 733
 
@@ -739,21 +739,21 @@  discard block
 block discarded – undo
739 739
  * @param mixed $var Data to sanitize.
740 740
  * @return string|array
741 741
  */
742
-function wpinv_clean( $var ) {
742
+function wpinv_clean($var) {
743 743
 
744
-	if ( is_array( $var ) ) {
745
-		return array_map( 'wpinv_clean', $var );
744
+	if (is_array($var)) {
745
+		return array_map('wpinv_clean', $var);
746 746
     }
747 747
 
748
-    if ( is_object( $var ) ) {
749
-		$object_vars = get_object_vars( $var );
750
-		foreach ( $object_vars as $property_name => $property_value ) {
751
-			$var->$property_name = wpinv_clean( $property_value );
748
+    if (is_object($var)) {
749
+		$object_vars = get_object_vars($var);
750
+		foreach ($object_vars as $property_name => $property_value) {
751
+			$var->$property_name = wpinv_clean($property_value);
752 752
         }
753 753
         return $var;
754 754
 	}
755 755
     
756
-    return is_string( $var ) ? sanitize_text_field( $var ) : $var;
756
+    return is_string($var) ? sanitize_text_field($var) : $var;
757 757
 }
758 758
 
759 759
 /**
@@ -762,43 +762,43 @@  discard block
 block discarded – undo
762 762
  * @param string $str Data to convert.
763 763
  * @return string|array
764 764
  */
765
-function getpaid_convert_price_string_to_options( $str ) {
765
+function getpaid_convert_price_string_to_options($str) {
766 766
 
767
-	$raw_options = array_map( 'trim', explode( ',', $str ) );
768
-    $options     = array();
767
+	$raw_options = array_map('trim', explode(',', $str));
768
+    $options = array();
769 769
 
770
-    foreach ( $raw_options as $option ) {
770
+    foreach ($raw_options as $option) {
771 771
 
772
-        if ( '' == $option ) {
772
+        if ('' == $option) {
773 773
             continue;
774 774
         }
775 775
 
776
-        $option = array_map( 'trim', explode( '|', $option ) );
776
+        $option = array_map('trim', explode('|', $option));
777 777
 
778 778
         $price = null;
779 779
         $label = null;
780 780
 
781
-        if ( isset( $option[0] ) && '' !=  $option[0] ) {
782
-            $label  = $option[0];
781
+        if (isset($option[0]) && '' != $option[0]) {
782
+            $label = $option[0];
783 783
         }
784 784
 
785
-        if ( isset( $option[1] ) && '' !=  $option[1] ) {
785
+        if (isset($option[1]) && '' != $option[1]) {
786 786
             $price = $option[1];
787 787
         }
788 788
 
789
-        if ( ! isset( $price ) ) {
789
+        if (!isset($price)) {
790 790
             $price = $label;
791 791
         }
792 792
 
793
-        if ( ! isset( $price ) || ! is_numeric( $price ) ) {
793
+        if (!isset($price) || !is_numeric($price)) {
794 794
             continue;
795 795
         }
796 796
 
797
-        if ( ! isset( $label ) ) {
797
+        if (!isset($label)) {
798 798
             $label = $price;
799 799
         }
800 800
 
801
-        $options[ $price ] = $label;
801
+        $options[$price] = $label;
802 802
     }
803 803
 
804 804
     return $options;
@@ -807,22 +807,22 @@  discard block
 block discarded – undo
807 807
 /**
808 808
  * Returns the help tip.
809 809
  */
810
-function getpaid_get_help_tip( $tip, $additional_classes = '' ) {
811
-    $additional_classes = sanitize_html_class( $additional_classes );
812
-    $tip                = esc_attr__( $tip );
810
+function getpaid_get_help_tip($tip, $additional_classes = '') {
811
+    $additional_classes = sanitize_html_class($additional_classes);
812
+    $tip                = esc_attr__($tip);
813 813
     return "<span class='wpi-help-tip dashicons dashicons-editor-help $additional_classes' title='$tip'></span>";
814 814
 }
815 815
 
816 816
 /**
817 817
  * Formats a date
818 818
  */
819
-function getpaid_format_date( $date ) {
819
+function getpaid_format_date($date) {
820 820
 
821
-    if ( empty( $date ) || $date == '0000-00-00 00:00:00' ) {
821
+    if (empty($date) || $date == '0000-00-00 00:00:00') {
822 822
         return '';
823 823
     }
824 824
 
825
-    return date_i18n( getpaid_date_format(), strtotime( $date ) );
825
+    return date_i18n(getpaid_date_format(), strtotime($date));
826 826
 
827 827
 }
828 828
 
@@ -831,9 +831,9 @@  discard block
 block discarded – undo
831 831
  *
832 832
  * @return string
833 833
  */
834
-function getpaid_format_date_value( $date, $default = "&mdash;" ) {
835
-    $date = getpaid_format_date( $date );
836
-    return empty( $date ) ? $default : $date;
834
+function getpaid_format_date_value($date, $default = "&mdash;") {
835
+    $date = getpaid_format_date($date);
836
+    return empty($date) ? $default : $date;
837 837
 }
838 838
 
839 839
 /**
@@ -842,7 +842,7 @@  discard block
 block discarded – undo
842 842
  * @return string
843 843
  */
844 844
 function getpaid_date_format() {
845
-	return apply_filters( 'getpaid_date_format', get_option( 'date_format' ) );
845
+	return apply_filters('getpaid_date_format', get_option('date_format'));
846 846
 }
847 847
 
848 848
 /**
@@ -851,7 +851,7 @@  discard block
 block discarded – undo
851 851
  * @return string
852 852
  */
853 853
 function getpaid_time_format() {
854
-	return apply_filters( 'getpaid_time_format', get_option( 'time_format' ) );
854
+	return apply_filters('getpaid_time_format', get_option('time_format'));
855 855
 }
856 856
 
857 857
 /**
@@ -861,16 +861,16 @@  discard block
 block discarded – undo
861 861
  * @param  integer $limit Limit size in characters.
862 862
  * @return string
863 863
  */
864
-function getpaid_limit_length( $string, $limit ) {
864
+function getpaid_limit_length($string, $limit) {
865 865
     $str_limit = $limit - 3;
866 866
 
867
-	if ( function_exists( 'mb_strimwidth' ) ) {
868
-		if ( mb_strlen( $string ) > $limit ) {
869
-			$string = mb_strimwidth( $string, 0, $str_limit ) . '...';
867
+	if (function_exists('mb_strimwidth')) {
868
+		if (mb_strlen($string) > $limit) {
869
+			$string = mb_strimwidth($string, 0, $str_limit) . '...';
870 870
 		}
871 871
 	} else {
872
-		if ( strlen( $string ) > $limit ) {
873
-			$string = substr( $string, 0, $str_limit ) . '...';
872
+		if (strlen($string) > $limit) {
873
+			$string = substr($string, 0, $str_limit) . '...';
874 874
 		}
875 875
 	}
876 876
     return $string;
@@ -884,7 +884,7 @@  discard block
 block discarded – undo
884 884
  * @since 1.0.19
885 885
  */
886 886
 function getpaid_api() {
887
-    return getpaid()->get( 'api' );
887
+    return getpaid()->get('api');
888 888
 }
889 889
 
890 890
 /**
@@ -894,7 +894,7 @@  discard block
 block discarded – undo
894 894
  * @since 1.0.19
895 895
  */
896 896
 function getpaid_post_types() {
897
-    return getpaid()->get( 'post_types' );
897
+    return getpaid()->get('post_types');
898 898
 }
899 899
 
900 900
 /**
@@ -904,7 +904,7 @@  discard block
 block discarded – undo
904 904
  * @since 1.0.19
905 905
  */
906 906
 function getpaid_session() {
907
-    return getpaid()->get( 'session' );
907
+    return getpaid()->get('session');
908 908
 }
909 909
 
910 910
 /**
@@ -914,7 +914,7 @@  discard block
 block discarded – undo
914 914
  * @since 1.0.19
915 915
  */
916 916
 function getpaid_notes() {
917
-    return getpaid()->get( 'notes' );
917
+    return getpaid()->get('notes');
918 918
 }
919 919
 
920 920
 /**
@@ -923,7 +923,7 @@  discard block
 block discarded – undo
923 923
  * @return GetPaid_Admin
924 924
  */
925 925
 function getpaid_admin() {
926
-    return getpaid()->get( 'admin' );
926
+    return getpaid()->get('admin');
927 927
 }
928 928
 
929 929
 /**
@@ -933,6 +933,6 @@  discard block
 block discarded – undo
933 933
  * @param string $base the base url
934 934
  * @return string
935 935
  */
936
-function getpaid_get_authenticated_action_url( $action, $base = false ) {
937
-    return wp_nonce_url( add_query_arg( 'getpaid-action', $action, $base ), 'getpaid-nonce', 'getpaid-nonce' );
936
+function getpaid_get_authenticated_action_url($action, $base = false) {
937
+    return wp_nonce_url(add_query_arg('getpaid-action', $action, $base), 'getpaid-nonce', 'getpaid-nonce');
938 938
 }
Please login to merge, or discard this patch.