Passed
Pull Request — master (#405)
by Brian
05:03
created
includes/class-wpinv-subscriptions.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 // Exit if accessed directly.
3
-if (!defined( 'ABSPATH' ) ) exit;
3
+if (!defined( 'ABSPATH' ) ) {
4
+    exit;
5
+}
4 6
 
5 7
 function wpinv_subscription_init() {
6 8
     return WPInv_Subscriptions::instance();
Please login to merge, or discard this patch.
Spacing   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 // Exit if accessed directly.
3
-if (!defined( 'ABSPATH' ) ) exit;
3
+if (!defined('ABSPATH')) exit;
4 4
 
5 5
 function wpinv_subscription_init() {
6 6
     return WPInv_Subscriptions::instance();
7 7
 }
8
-add_action( 'plugins_loaded', 'wpinv_subscription_init', 100 );
8
+add_action('plugins_loaded', 'wpinv_subscription_init', 100);
9 9
 
10 10
 /**
11 11
  * WPInv_Subscriptions Class.
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
      * Main WPInv_Subscriptions Instance
21 21
      */
22 22
     public static function instance() {
23
-        if ( ! isset( self::$instance ) ) {
23
+        if (!isset(self::$instance)) {
24 24
             self::$instance = new WPInv_Subscriptions;
25 25
 
26 26
             self::$instance->init();
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
      *
35 35
      * @since 1.0.0
36 36
      */
37
-    private function __construct(){
37
+    private function __construct() {
38 38
 
39 39
     }
40 40
 
@@ -63,8 +63,8 @@  discard block
 block discarded – undo
63 63
     private function setup_constants() {
64 64
 
65 65
         // Make sure CAL_GREGORIAN is defined.
66
-        if ( ! defined( 'CAL_GREGORIAN' ) ) {
67
-            define( 'CAL_GREGORIAN', 1 );
66
+        if (!defined('CAL_GREGORIAN')) {
67
+            define('CAL_GREGORIAN', 1);
68 68
         }
69 69
     }
70 70
 
@@ -76,13 +76,13 @@  discard block
 block discarded – undo
76 76
      */
77 77
     private function actions() {
78 78
 
79
-        add_action( 'admin_menu', array( $this, 'wpinv_subscriptions_list' ), 40 );
80
-        add_action( 'admin_notices', array( $this, 'notices' ) );
81
-        add_action( 'init', array( $this, 'wpinv_post_actions' ) );
82
-        add_action( 'init', array( $this, 'wpinv_get_actions' ) );
83
-        add_action( 'wpinv_cancel_subscription', array( $this, 'wpinv_process_cancellation' ) );
84
-        add_action( 'getpaid_checkout_before_gateway', array( $this, 'add_subscription' ), -999 );
85
-        add_action( 'wpinv_subscriptions_front_notices', array( $this, 'notices' ) );
79
+        add_action('admin_menu', array($this, 'wpinv_subscriptions_list'), 40);
80
+        add_action('admin_notices', array($this, 'notices'));
81
+        add_action('init', array($this, 'wpinv_post_actions'));
82
+        add_action('init', array($this, 'wpinv_get_actions'));
83
+        add_action('wpinv_cancel_subscription', array($this, 'wpinv_process_cancellation'));
84
+        add_action('getpaid_checkout_before_gateway', array($this, 'add_subscription'), -999);
85
+        add_action('wpinv_subscriptions_front_notices', array($this, 'notices'));
86 86
     }
87 87
 
88 88
     /**
@@ -104,8 +104,8 @@  discard block
 block discarded – undo
104 104
     public function wpinv_subscriptions_list() {
105 105
         add_submenu_page(
106 106
             'wpinv',
107
-            __( 'Subscriptions', 'invoicing' ),
108
-            __( 'Subscriptions', 'invoicing' ),
107
+            __('Subscriptions', 'invoicing'),
108
+            __('Subscriptions', 'invoicing'),
109 109
             wpinv_get_capability(),
110 110
             'wpinv-subscriptions',
111 111
             'wpinv_subscriptions_page'
@@ -114,37 +114,37 @@  discard block
 block discarded – undo
114 114
 
115 115
     public function notices() {
116 116
 
117
-        if( empty( $_GET['wpinv-message'] ) ) {
117
+        if (empty($_GET['wpinv-message'])) {
118 118
             return;
119 119
         }
120 120
 
121 121
         $type    = 'updated';
122 122
         $message = '';
123 123
 
124
-        switch( strtolower( $_GET['wpinv-message'] ) ) {
124
+        switch (strtolower($_GET['wpinv-message'])) {
125 125
 
126 126
             case 'updated' :
127 127
 
128
-                $message = __( 'Subscription updated successfully.', 'invoicing' );
128
+                $message = __('Subscription updated successfully.', 'invoicing');
129 129
 
130 130
                 break;
131 131
 
132 132
             case 'deleted' :
133 133
 
134
-                $message = __( 'Subscription deleted successfully.', 'invoicing' );
134
+                $message = __('Subscription deleted successfully.', 'invoicing');
135 135
 
136 136
                 break;
137 137
 
138 138
             case 'cancelled' :
139 139
 
140
-                $message = __( 'Subscription cancelled successfully.', 'invoicing' );
140
+                $message = __('Subscription cancelled successfully.', 'invoicing');
141 141
 
142 142
                 break;
143 143
 
144 144
         }
145 145
 
146
-        if ( ! empty( $message ) ) {
147
-            echo '<div class="' . esc_attr( $type ) . '"><p>' . $message . '</p></div>';
146
+        if (!empty($message)) {
147
+            echo '<div class="' . esc_attr($type) . '"><p>' . $message . '</p></div>';
148 148
         }
149 149
 
150 150
     }
@@ -157,8 +157,8 @@  discard block
 block discarded – undo
157 157
      * @return void
158 158
      */
159 159
     function wpinv_get_actions() {
160
-        if ( isset( $_GET['wpinv_action'] ) ) {
161
-            do_action( 'wpinv_' . $_GET['wpinv_action'], $_GET );
160
+        if (isset($_GET['wpinv_action'])) {
161
+            do_action('wpinv_' . $_GET['wpinv_action'], $_GET);
162 162
         }
163 163
     }
164 164
 
@@ -170,8 +170,8 @@  discard block
 block discarded – undo
170 170
      * @return void
171 171
      */
172 172
     function wpinv_post_actions() {
173
-        if ( isset( $_POST['wpinv_action'] ) ) {
174
-            do_action( 'wpinv_' . $_POST['wpinv_action'], $_POST );
173
+        if (isset($_POST['wpinv_action'])) {
174
+            do_action('wpinv_' . $_POST['wpinv_action'], $_POST);
175 175
         }
176 176
     }
177 177
 
@@ -182,29 +182,29 @@  discard block
 block discarded – undo
182 182
      * @param int $frequency_count The frequency of the period.
183 183
      * @return mixed|string|void
184 184
      */
185
-    public static function wpinv_get_pretty_subscription_frequency( $period, $frequency_count = 1) {
185
+    public static function wpinv_get_pretty_subscription_frequency($period, $frequency_count = 1) {
186 186
 
187 187
         $frequency = '';
188 188
         //Format period details
189
-        switch ( strtolower( $period ) ) {
189
+        switch (strtolower($period)) {
190 190
             case 'day' :
191 191
             case 'd' :
192
-                $frequency = sprintf( _n('%d Day', '%d Days', $frequency_count, 'invoicing'), $frequency_count);
192
+                $frequency = sprintf(_n('%d Day', '%d Days', $frequency_count, 'invoicing'), $frequency_count);
193 193
                 break;
194 194
             case 'week' :
195 195
             case 'w' :
196
-                $frequency = sprintf( _n('%d Week', '%d Weeks', $frequency_count, 'invoicing'), $frequency_count);
196
+                $frequency = sprintf(_n('%d Week', '%d Weeks', $frequency_count, 'invoicing'), $frequency_count);
197 197
                 break;
198 198
             case 'month' :
199 199
             case 'm' :
200
-                $frequency = sprintf( _n('%d Month', '%d Months', $frequency_count, 'invoicing'), $frequency_count);
200
+                $frequency = sprintf(_n('%d Month', '%d Months', $frequency_count, 'invoicing'), $frequency_count);
201 201
                 break;
202 202
             case 'year' :
203 203
             case 'y' :
204
-                $frequency = sprintf( _n('%d Year', '%d Years', $frequency_count, 'invoicing'), $frequency_count);
204
+                $frequency = sprintf(_n('%d Year', '%d Years', $frequency_count, 'invoicing'), $frequency_count);
205 205
                 break;
206 206
             default :
207
-                $frequency = apply_filters( 'wpinv_recurring_subscription_frequency', $frequency, $period, $frequency_count );
207
+                $frequency = apply_filters('wpinv_recurring_subscription_frequency', $frequency, $period, $frequency_count);
208 208
                 break;
209 209
         }
210 210
 
@@ -219,50 +219,50 @@  discard block
 block discarded – undo
219 219
      * @since       1.0.0
220 220
      * @return      void
221 221
      */
222
-    public function wpinv_process_cancellation( $data ) {
222
+    public function wpinv_process_cancellation($data) {
223 223
 
224 224
 
225
-        if( empty( $data['sub_id'] ) ) {
225
+        if (empty($data['sub_id'])) {
226 226
             return;
227 227
         }
228 228
 
229
-        if( ! is_user_logged_in() ) {
229
+        if (!is_user_logged_in()) {
230 230
             return;
231 231
         }
232 232
 
233
-        if( ! wp_verify_nonce( $data['_wpnonce'], 'wpinv-recurring-cancel' ) ) {
234
-            wp_die( __( 'Error', 'invoicing' ), __( 'Nonce verification failed', 'invoicing' ), array( 'response' => 403 ) );
233
+        if (!wp_verify_nonce($data['_wpnonce'], 'wpinv-recurring-cancel')) {
234
+            wp_die(__('Error', 'invoicing'), __('Nonce verification failed', 'invoicing'), array('response' => 403));
235 235
         }
236 236
 
237
-        $data['sub_id'] = absint( $data['sub_id'] );
238
-        $subscription   = new WPInv_Subscription( $data['sub_id'] );
237
+        $data['sub_id'] = absint($data['sub_id']);
238
+        $subscription   = new WPInv_Subscription($data['sub_id']);
239 239
 
240
-        if( ! $subscription->can_cancel() ) {
241
-            wp_die( __( 'Error', 'invoicing' ), __( 'This subscription cannot be cancelled', 'invoicing' ), array( 'response' => 403 ) );
240
+        if (!$subscription->can_cancel()) {
241
+            wp_die(__('Error', 'invoicing'), __('This subscription cannot be cancelled', 'invoicing'), array('response' => 403));
242 242
         }
243 243
 
244 244
         try {
245 245
 
246
-            do_action( 'wpinv_recurring_cancel_' . $subscription->gateway . '_subscription', $subscription, true );
246
+            do_action('wpinv_recurring_cancel_' . $subscription->gateway . '_subscription', $subscription, true);
247 247
 
248 248
             $subscription->cancel();
249 249
 
250
-            if( is_admin() ) {
250
+            if (is_admin()) {
251 251
 
252
-                wp_redirect( admin_url( 'admin.php?page=wpinv-subscriptions&wpinv-message=cancelled&id=' . $subscription->id ) );
252
+                wp_redirect(admin_url('admin.php?page=wpinv-subscriptions&wpinv-message=cancelled&id=' . $subscription->id));
253 253
                 exit;
254 254
 
255 255
             } else {
256 256
 
257
-                $redirect = remove_query_arg( array( '_wpnonce', 'wpinv_action', 'sub_id' ), add_query_arg( array( 'wpinv-message' => 'cancelled' ) ) );
258
-                $redirect = apply_filters( 'wpinv_recurring_cancellation_redirect', $redirect, $subscription );
259
-                wp_safe_redirect( $redirect );
257
+                $redirect = remove_query_arg(array('_wpnonce', 'wpinv_action', 'sub_id'), add_query_arg(array('wpinv-message' => 'cancelled')));
258
+                $redirect = apply_filters('wpinv_recurring_cancellation_redirect', $redirect, $subscription);
259
+                wp_safe_redirect($redirect);
260 260
                 exit;
261 261
 
262 262
             }
263 263
 
264
-        } catch ( Exception $e ) {
265
-            wp_die( __( 'Error', 'invoicing' ), $e->getMessage(), array( 'response' => 403 ) );
264
+        } catch (Exception $e) {
265
+            wp_die(__('Error', 'invoicing'), $e->getMessage(), array('response' => 403));
266 266
         }
267 267
 
268 268
     }
@@ -275,33 +275,33 @@  discard block
 block discarded – undo
275 275
      * @since       1.0.0
276 276
      * @return      void
277 277
      */
278
-    public function add_subscription( $invoice ) {
278
+    public function add_subscription($invoice) {
279 279
 
280
-        $invoice = new WPInv_Invoice( $invoice );
280
+        $invoice = new WPInv_Invoice($invoice);
281 281
 
282 282
         // Abort if it is not recurring.
283
-        if ( ! $invoice->is_recurring() || $invoice->is_renewal() ) {
283
+        if (!$invoice->is_recurring() || $invoice->is_renewal()) {
284 284
             return;
285 285
         }
286 286
 
287 287
         // Should we create a subscription for the invoice?
288
-        if ( apply_filters( 'wpinv_skip_invoice_subscription_creation', false, $invoice ) ) {
288
+        if (apply_filters('wpinv_skip_invoice_subscription_creation', false, $invoice)) {
289 289
             return;
290 290
         }
291 291
 
292 292
         // Get the recurring item.
293
-        $subscription_item = $invoice->get_recurring( true );
293
+        $subscription_item = $invoice->get_recurring(true);
294 294
 
295 295
         // Prepare the subscription details.
296
-        $period       = $subscription_item->get_recurring_period( true );
296
+        $period       = $subscription_item->get_recurring_period(true);
297 297
         $interval     = $subscription_item->get_recurring_interval();
298 298
         $add_period   = $interval . ' ' . $period;
299 299
         $trial_period = '';
300 300
 
301
-        if ( $invoice->has_free_trial() ) {
301
+        if ($invoice->has_free_trial()) {
302 302
 
303
-            if ( $subscription_item->has_free_trial() ) {
304
-                $trial_period   = $subscription_item->get_trial_period( true );
303
+            if ($subscription_item->has_free_trial()) {
304
+                $trial_period   = $subscription_item->get_trial_period(true);
305 305
                 $free_interval  = $subscription_item->get_trial_interval();
306 306
             } else {
307 307
                 $trial_period   = $period;
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
         }
315 315
 
316 316
         // Calculate the next renewal date.
317
-        $expiration = date( 'Y-m-d H:i:s', strtotime( "+ $add_period", current_time( 'timestamp' ) ) );
317
+        $expiration = date('Y-m-d H:i:s', strtotime("+ $add_period", current_time('timestamp')));
318 318
 
319 319
         // Subscription arguments.
320 320
         $args = array(
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
             'initial_amount'    => $invoice->get_initial_total(),
328 328
             'recurring_amount'  => $invoice->get_recurring_total(),
329 329
             'bill_times'        => $subscription_item->get_recurring_limit(),
330
-            'created'           => current_time( 'mysql' ),
330
+            'created'           => current_time('mysql'),
331 331
             'expiration'        => $expiration,
332 332
             'trial_period'      => $trial_period,
333 333
             'profile_id'        => '',
@@ -335,19 +335,19 @@  discard block
 block discarded – undo
335 335
         );
336 336
 
337 337
         // Create or update the subscription.
338
-        $subscription = wpinv_get_subscription( $invoice );
338
+        $subscription = wpinv_get_subscription($invoice);
339 339
 
340
-        if ( empty( $subscription ) ) {
340
+        if (empty($subscription)) {
341 341
 
342 342
             $subscription = new WPInv_Subscription();
343
-            $subscription->create( $args );
343
+            $subscription->create($args);
344 344
 
345 345
         } else {
346 346
 
347 347
 
348
-            unset( $args['transaction_id'] );
349
-            unset( $args['profile_id'] );
350
-            $subscription->update( $args );
348
+            unset($args['transaction_id']);
349
+            unset($args['profile_id']);
350
+            $subscription->update($args);
351 351
 
352 352
         }
353 353
 
Please login to merge, or discard this patch.
templates/emails/wpinv-email-completed_invoice.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 // don't load directly
3
-if ( !defined('ABSPATH') )
3
+if ( !defined('ABSPATH') ) {
4 4
     die('-1');
5
+}
5 6
 
6 7
 do_action( 'wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin );
7 8
 
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,18 +1,18 @@
 block discarded – undo
1 1
 <?php
2 2
 // don't load directly
3
-if ( !defined('ABSPATH') )
3
+if (!defined('ABSPATH'))
4 4
     die('-1');
5 5
 
6
-do_action( 'wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin );
6
+do_action('wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin);
7 7
 
8
-if ( ! empty( $message_body ) ) {
9
-    echo wpautop( wptexturize( $message_body ) );
8
+if (!empty($message_body)) {
9
+    echo wpautop(wptexturize($message_body));
10 10
 }
11 11
 
12
-do_action( 'wpinv_email_invoice_details', $invoice, $email_type, $sent_to_admin );
12
+do_action('wpinv_email_invoice_details', $invoice, $email_type, $sent_to_admin);
13 13
 
14
-do_action( 'wpinv_email_invoice_items', $invoice, $email_type, $sent_to_admin );
14
+do_action('wpinv_email_invoice_items', $invoice, $email_type, $sent_to_admin);
15 15
 
16
-do_action( 'wpinv_email_billing_details', $invoice, $email_type, $sent_to_admin );
16
+do_action('wpinv_email_billing_details', $invoice, $email_type, $sent_to_admin);
17 17
 
18
-do_action( 'wpinv_email_footer', $invoice, $email_type, $sent_to_admin );
19 18
\ No newline at end of file
19
+do_action('wpinv_email_footer', $invoice, $email_type, $sent_to_admin);
20 20
\ No newline at end of file
Please login to merge, or discard this patch.
templates/emails/wpinv-email-refunded_invoice.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 // don't load directly
3
-if ( !defined('ABSPATH') )
3
+if ( !defined('ABSPATH') ) {
4 4
     die('-1');
5
+}
5 6
 
6 7
 do_action( 'wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin );
7 8
 
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,18 +1,18 @@
 block discarded – undo
1 1
 <?php
2 2
 // don't load directly
3
-if ( !defined('ABSPATH') )
3
+if (!defined('ABSPATH'))
4 4
     die('-1');
5 5
 
6
-do_action( 'wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin );
6
+do_action('wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin);
7 7
 
8
-if ( ! empty( $message_body ) ) {
9
-    echo wpautop( wptexturize( $message_body ) );
8
+if (!empty($message_body)) {
9
+    echo wpautop(wptexturize($message_body));
10 10
 }
11 11
 
12
-do_action( 'wpinv_email_invoice_details', $invoice, $email_type, $sent_to_admin );
12
+do_action('wpinv_email_invoice_details', $invoice, $email_type, $sent_to_admin);
13 13
 
14
-do_action( 'wpinv_email_invoice_items', $invoice, $email_type, $sent_to_admin );
14
+do_action('wpinv_email_invoice_items', $invoice, $email_type, $sent_to_admin);
15 15
 
16
-do_action( 'wpinv_email_billing_details', $invoice, $email_type, $sent_to_admin );
16
+do_action('wpinv_email_billing_details', $invoice, $email_type, $sent_to_admin);
17 17
 
18
-do_action( 'wpinv_email_footer', $invoice, $email_type, $sent_to_admin );
19 18
\ No newline at end of file
19
+do_action('wpinv_email_footer', $invoice, $email_type, $sent_to_admin);
20 20
\ No newline at end of file
Please login to merge, or discard this patch.
templates/emails/wpinv-email-onhold_invoice.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 // don't load directly
3
-if ( !defined('ABSPATH') )
3
+if ( !defined('ABSPATH') ) {
4 4
     die('-1');
5
+}
5 6
 
6 7
 do_action( 'wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin );
7 8
 
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,18 +1,18 @@
 block discarded – undo
1 1
 <?php
2 2
 // don't load directly
3
-if ( !defined('ABSPATH') )
3
+if (!defined('ABSPATH'))
4 4
     die('-1');
5 5
 
6
-do_action( 'wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin );
6
+do_action('wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin);
7 7
 
8
-if ( ! empty( $message_body ) ) {
9
-    echo wpautop( wptexturize( $message_body ) );
8
+if (!empty($message_body)) {
9
+    echo wpautop(wptexturize($message_body));
10 10
 }
11 11
 
12
-do_action( 'wpinv_email_invoice_details', $invoice, $email_type, $sent_to_admin );
12
+do_action('wpinv_email_invoice_details', $invoice, $email_type, $sent_to_admin);
13 13
 
14
-do_action( 'wpinv_email_invoice_items', $invoice, $email_type, $sent_to_admin );
14
+do_action('wpinv_email_invoice_items', $invoice, $email_type, $sent_to_admin);
15 15
 
16
-do_action( 'wpinv_email_billing_details', $invoice, $email_type, $sent_to_admin );
16
+do_action('wpinv_email_billing_details', $invoice, $email_type, $sent_to_admin);
17 17
 
18
-do_action( 'wpinv_email_footer', $invoice, $email_type, $sent_to_admin );
19 18
\ No newline at end of file
19
+do_action('wpinv_email_footer', $invoice, $email_type, $sent_to_admin);
20 20
\ No newline at end of file
Please login to merge, or discard this patch.
templates/emails/wpinv-email-new_invoice.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 // don't load directly
3
-if ( !defined('ABSPATH') )
3
+if ( !defined('ABSPATH') ) {
4 4
     die('-1');
5
+}
5 6
 
6 7
 do_action( 'wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin );
7 8
 
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,18 +1,18 @@
 block discarded – undo
1 1
 <?php
2 2
 // don't load directly
3
-if ( !defined('ABSPATH') )
3
+if (!defined('ABSPATH'))
4 4
     die('-1');
5 5
 
6
-do_action( 'wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin );
6
+do_action('wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin);
7 7
 
8
-if ( ! empty( $message_body ) ) {
9
-    echo wpautop( wptexturize( $message_body ) );
8
+if (!empty($message_body)) {
9
+    echo wpautop(wptexturize($message_body));
10 10
 }
11 11
 
12
-do_action( 'wpinv_email_invoice_details', $invoice, $email_type, $sent_to_admin );
12
+do_action('wpinv_email_invoice_details', $invoice, $email_type, $sent_to_admin);
13 13
 
14
-do_action( 'wpinv_email_invoice_items', $invoice, $email_type, $sent_to_admin );
14
+do_action('wpinv_email_invoice_items', $invoice, $email_type, $sent_to_admin);
15 15
 
16
-do_action( 'wpinv_email_billing_details', $invoice, $email_type, $sent_to_admin );
16
+do_action('wpinv_email_billing_details', $invoice, $email_type, $sent_to_admin);
17 17
 
18
-do_action( 'wpinv_email_footer', $invoice, $email_type, $sent_to_admin );
19 18
\ No newline at end of file
19
+do_action('wpinv_email_footer', $invoice, $email_type, $sent_to_admin);
20 20
\ No newline at end of file
Please login to merge, or discard this patch.
templates/emails/wpinv-email-failed_invoice.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 // don't load directly
3
-if ( !defined('ABSPATH') )
3
+if ( !defined('ABSPATH') ) {
4 4
     die('-1');
5
+}
5 6
 
6 7
 do_action( 'wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin );
7 8
 
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,18 +1,18 @@
 block discarded – undo
1 1
 <?php
2 2
 // don't load directly
3
-if ( !defined('ABSPATH') )
3
+if (!defined('ABSPATH'))
4 4
     die('-1');
5 5
 
6
-do_action( 'wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin );
6
+do_action('wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin);
7 7
 
8
-if ( ! empty( $message_body ) ) {
9
-    echo wpautop( wptexturize( $message_body ) );
8
+if (!empty($message_body)) {
9
+    echo wpautop(wptexturize($message_body));
10 10
 }
11 11
 
12
-do_action( 'wpinv_email_invoice_details', $invoice, $email_type, $sent_to_admin );
12
+do_action('wpinv_email_invoice_details', $invoice, $email_type, $sent_to_admin);
13 13
 
14
-do_action( 'wpinv_email_invoice_items', $invoice, $email_type, $sent_to_admin );
14
+do_action('wpinv_email_invoice_items', $invoice, $email_type, $sent_to_admin);
15 15
 
16
-do_action( 'wpinv_email_billing_details', $invoice, $email_type, $sent_to_admin );
16
+do_action('wpinv_email_billing_details', $invoice, $email_type, $sent_to_admin);
17 17
 
18
-do_action( 'wpinv_email_footer', $invoice, $email_type, $sent_to_admin );
19 18
\ No newline at end of file
19
+do_action('wpinv_email_footer', $invoice, $email_type, $sent_to_admin);
20 20
\ No newline at end of file
Please login to merge, or discard this patch.
templates/emails/wpinv-email-cancelled_invoice.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 // don't load directly
3
-if ( !defined('ABSPATH') )
3
+if ( !defined('ABSPATH') ) {
4 4
     die('-1');
5
+}
5 6
 
6 7
 do_action( 'wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin );
7 8
 
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,18 +1,18 @@
 block discarded – undo
1 1
 <?php
2 2
 // don't load directly
3
-if ( !defined('ABSPATH') )
3
+if (!defined('ABSPATH'))
4 4
     die('-1');
5 5
 
6
-do_action( 'wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin );
6
+do_action('wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin);
7 7
 
8
-if ( ! empty( $message_body ) ) {
9
-    echo wpautop( wptexturize( $message_body ) );
8
+if (!empty($message_body)) {
9
+    echo wpautop(wptexturize($message_body));
10 10
 }
11 11
 
12
-do_action( 'wpinv_email_invoice_details', $invoice, $email_type, $sent_to_admin );
12
+do_action('wpinv_email_invoice_details', $invoice, $email_type, $sent_to_admin);
13 13
 
14
-do_action( 'wpinv_email_invoice_items', $invoice, $email_type, $sent_to_admin );
14
+do_action('wpinv_email_invoice_items', $invoice, $email_type, $sent_to_admin);
15 15
 
16
-do_action( 'wpinv_email_billing_details', $invoice, $email_type, $sent_to_admin );
16
+do_action('wpinv_email_billing_details', $invoice, $email_type, $sent_to_admin);
17 17
 
18
-do_action( 'wpinv_email_footer', $invoice, $email_type, $sent_to_admin );
19 18
\ No newline at end of file
19
+do_action('wpinv_email_footer', $invoice, $email_type, $sent_to_admin);
20 20
\ No newline at end of file
Please login to merge, or discard this patch.
templates/emails/wpinv-email-processing_invoice.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 // don't load directly
3
-if ( !defined('ABSPATH') )
3
+if ( !defined('ABSPATH') ) {
4 4
     die('-1');
5
+}
5 6
 
6 7
 do_action( 'wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin );
7 8
 
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,18 +1,18 @@
 block discarded – undo
1 1
 <?php
2 2
 // don't load directly
3
-if ( !defined('ABSPATH') )
3
+if (!defined('ABSPATH'))
4 4
     die('-1');
5 5
 
6
-do_action( 'wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin );
6
+do_action('wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin);
7 7
 
8
-if ( ! empty( $message_body ) ) {
9
-    echo wpautop( wptexturize( $message_body ) );
8
+if (!empty($message_body)) {
9
+    echo wpautop(wptexturize($message_body));
10 10
 }
11 11
 
12
-do_action( 'wpinv_email_invoice_details', $invoice, $email_type, $sent_to_admin );
12
+do_action('wpinv_email_invoice_details', $invoice, $email_type, $sent_to_admin);
13 13
 
14
-do_action( 'wpinv_email_invoice_items', $invoice, $email_type, $sent_to_admin );
14
+do_action('wpinv_email_invoice_items', $invoice, $email_type, $sent_to_admin);
15 15
 
16
-do_action( 'wpinv_email_billing_details', $invoice, $email_type, $sent_to_admin );
16
+do_action('wpinv_email_billing_details', $invoice, $email_type, $sent_to_admin);
17 17
 
18
-do_action( 'wpinv_email_footer', $invoice, $email_type, $sent_to_admin );
19 18
\ No newline at end of file
19
+do_action('wpinv_email_footer', $invoice, $email_type, $sent_to_admin);
20 20
\ No newline at end of file
Please login to merge, or discard this patch.
includes/wpinv-user-functions.php 3 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 // Exit if accessed directly
3
-if ( ! defined( 'ABSPATH' ) ) exit;
3
+if ( ! defined( 'ABSPATH' ) ) {
4
+    exit;
5
+}
4 6
 
5 7
 function wpinv_get_users_invoices( $user = 0, $number = 20, $pagination = false, $status = 'publish', $orderby = 'ID', $order = 'DESC' ) {
6 8
     if ( empty( $user ) ) {
Please login to merge, or discard this patch.
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -159,11 +159,11 @@  discard block
 block discarded – undo
159 159
  */
160 160
 function wpinv_get_capability( $capalibilty = 'manage_invoicing' ) {
161 161
 
162
-	if ( current_user_can( 'manage_options' ) ) {
163
-		return 'manage_options';
164
-	};
162
+    if ( current_user_can( 'manage_options' ) ) {
163
+        return 'manage_options';
164
+    };
165 165
 
166
-	return $capalibilty;
166
+    return $capalibilty;
167 167
 }
168 168
 
169 169
 /**
@@ -185,10 +185,10 @@  discard block
 block discarded – undo
185 185
 function wpinv_create_user( $email ) {
186 186
 
187 187
     // Prepare user values.
188
-	$args = array(
189
-		'user_login' => wpinv_generate_user_name( $email ),
190
-		'user_pass'  => wp_generate_password(),
191
-		'user_email' => $email,
188
+    $args = array(
189
+        'user_login' => wpinv_generate_user_name( $email ),
190
+        'user_pass'  => wp_generate_password(),
191
+        'user_email' => $email,
192 192
         'role'       => 'subscriber',
193 193
     );
194 194
 
@@ -205,20 +205,20 @@  discard block
 block discarded – undo
205 205
 function wpinv_generate_user_name( $prefix = '' ) {
206 206
 
207 207
     // If prefix is an email, retrieve the part before the email.
208
-	$prefix = strtok( $prefix, '@' );
208
+    $prefix = strtok( $prefix, '@' );
209 209
 
210
-	// Trim to 4 characters max.
211
-	$prefix = sanitize_user( $prefix );
210
+    // Trim to 4 characters max.
211
+    $prefix = sanitize_user( $prefix );
212 212
 
213
-	$illegal_logins = (array) apply_filters( 'illegal_user_logins', array() );
214
-	if ( empty( $prefix ) || in_array( strtolower( $prefix ), array_map( 'strtolower', $illegal_logins ), true ) ) {
215
-		$prefix = 'gtp';
216
-	}
213
+    $illegal_logins = (array) apply_filters( 'illegal_user_logins', array() );
214
+    if ( empty( $prefix ) || in_array( strtolower( $prefix ), array_map( 'strtolower', $illegal_logins ), true ) ) {
215
+        $prefix = 'gtp';
216
+    }
217 217
 
218
-	$username = $prefix . '_' . zeroise( wp_rand( 0, 9999 ), 4 );
219
-	if ( username_exists( $username ) ) {
220
-		return wpinv_generate_user_name( $username );
221
-	}
218
+    $username = $prefix . '_' . zeroise( wp_rand( 0, 9999 ), 4 );
219
+    if ( username_exists( $username ) ) {
220
+        return wpinv_generate_user_name( $username );
221
+    }
222 222
 
223 223
     return $username;
224 224
 }
Please login to merge, or discard this patch.
Spacing   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -1,22 +1,22 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 // Exit if accessed directly
3
-if ( ! defined( 'ABSPATH' ) ) exit;
3
+if (!defined('ABSPATH')) exit;
4 4
 
5
-function wpinv_get_users_invoices( $user = 0, $number = 20, $pagination = false, $status = 'publish', $orderby = 'ID', $order = 'DESC' ) {
6
-    if ( empty( $user ) ) {
5
+function wpinv_get_users_invoices($user = 0, $number = 20, $pagination = false, $status = 'publish', $orderby = 'ID', $order = 'DESC') {
6
+    if (empty($user)) {
7 7
         $user = get_current_user_id();
8 8
     }
9 9
 
10
-    if ( empty( $user ) ) {
10
+    if (empty($user)) {
11 11
         return false;
12 12
     }
13 13
 
14
-    $args = apply_filters( 'wpinv_get_users_invoices_args', array( 'user' => $user, 'limit' => $number, 'status' => $status, 'paginate' => $pagination, 'orderby' => $orderby, 'order' => $order ) );
14
+    $args = apply_filters('wpinv_get_users_invoices_args', array('user' => $user, 'limit' => $number, 'status' => $status, 'paginate' => $pagination, 'orderby' => $orderby, 'order' => $order));
15 15
     
16
-    return wpinv_get_invoices( $args );
16
+    return wpinv_get_invoices($args);
17 17
 }
18 18
 
19
-function wpinv_dropdown_users( $args = '' ) {
19
+function wpinv_dropdown_users($args = '') {
20 20
     $defaults = array(
21 21
         'show_option_all' => '', 'show_option_none' => '', 'hide_if_only_one_author' => '',
22 22
         'orderby' => 'display_name', 'order' => 'ASC',
@@ -27,18 +27,18 @@  discard block
 block discarded – undo
27 27
         'option_none_value' => -1
28 28
     );
29 29
 
30
-    $defaults['selected'] = is_author() ? get_query_var( 'author' ) : 0;
30
+    $defaults['selected'] = is_author() ? get_query_var('author') : 0;
31 31
 
32
-    $r = wp_parse_args( $args, $defaults );
32
+    $r = wp_parse_args($args, $defaults);
33 33
 
34
-    $query_args = wp_array_slice_assoc( $r, array( 'blog_id', 'include', 'exclude', 'orderby', 'order', 'who' ) );
34
+    $query_args = wp_array_slice_assoc($r, array('blog_id', 'include', 'exclude', 'orderby', 'order', 'who'));
35 35
 
36
-    $fields = array( 'ID', 'user_login', 'user_email' );
36
+    $fields = array('ID', 'user_login', 'user_email');
37 37
 
38
-    $show = ! empty( $r['show'] ) ? $r['show'] : 'display_name';
39
-    if ( 'display_name_with_login' === $show ) {
38
+    $show = !empty($r['show']) ? $r['show'] : 'display_name';
39
+    if ('display_name_with_login' === $show) {
40 40
         $fields[] = 'display_name';
41
-    } else if ( 'display_name_with_email' === $show ) {
41
+    } else if ('display_name_with_email' === $show) {
42 42
         $fields[] = 'display_name';
43 43
     } else {
44 44
         $fields[] = $show;
@@ -50,99 +50,99 @@  discard block
 block discarded – undo
50 50
     $show_option_none = $r['show_option_none'];
51 51
     $option_none_value = $r['option_none_value'];
52 52
 
53
-    $query_args = apply_filters( 'wpinv_dropdown_users_args', $query_args, $r );
53
+    $query_args = apply_filters('wpinv_dropdown_users_args', $query_args, $r);
54 54
 
55
-    $users = get_users( $query_args );
55
+    $users = get_users($query_args);
56 56
 
57 57
     $output = '';
58
-    if ( ! empty( $users ) && ( empty( $r['hide_if_only_one_author'] ) || count( $users ) > 1 ) ) {
59
-        $name = esc_attr( $r['name'] );
60
-        if ( $r['multi'] && ! $r['id'] ) {
58
+    if (!empty($users) && (empty($r['hide_if_only_one_author']) || count($users) > 1)) {
59
+        $name = esc_attr($r['name']);
60
+        if ($r['multi'] && !$r['id']) {
61 61
             $id = '';
62 62
         } else {
63
-            $id = $r['id'] ? " id='" . esc_attr( $r['id'] ) . "'" : " id='$name'";
63
+            $id = $r['id'] ? " id='" . esc_attr($r['id']) . "'" : " id='$name'";
64 64
         }
65 65
         $output = "<select name='{$name}'{$id} class='" . $r['class'] . "'>\n";
66 66
 
67
-        if ( $show_option_all ) {
67
+        if ($show_option_all) {
68 68
             $output .= "\t<option value='0'>$show_option_all</option>\n";
69 69
         }
70 70
 
71
-        if ( $show_option_none ) {
72
-            $_selected = selected( $option_none_value, $r['selected'], false );
73
-            $output .= "\t<option value='" . esc_attr( $option_none_value ) . "'$_selected>$show_option_none</option>\n";
71
+        if ($show_option_none) {
72
+            $_selected = selected($option_none_value, $r['selected'], false);
73
+            $output .= "\t<option value='" . esc_attr($option_none_value) . "'$_selected>$show_option_none</option>\n";
74 74
         }
75 75
 
76
-        if ( $r['include_selected'] && ( $r['selected'] > 0 ) ) {
76
+        if ($r['include_selected'] && ($r['selected'] > 0)) {
77 77
             $found_selected = false;
78 78
             $r['selected'] = (int) $r['selected'];
79
-            foreach ( (array) $users as $user ) {
79
+            foreach ((array) $users as $user) {
80 80
                 $user->ID = (int) $user->ID;
81
-                if ( $user->ID === $r['selected'] ) {
81
+                if ($user->ID === $r['selected']) {
82 82
                     $found_selected = true;
83 83
                 }
84 84
             }
85 85
 
86
-            if ( ! $found_selected ) {
87
-                $users[] = get_userdata( $r['selected'] );
86
+            if (!$found_selected) {
87
+                $users[] = get_userdata($r['selected']);
88 88
             }
89 89
         }
90 90
 
91
-        foreach ( (array) $users as $user ) {
92
-            if ( 'display_name_with_login' === $show ) {
91
+        foreach ((array) $users as $user) {
92
+            if ('display_name_with_login' === $show) {
93 93
                 /* translators: 1: display name, 2: user_login */
94
-                $display = sprintf( _x( '%1$s (%2$s)', 'user dropdown' ), $user->display_name, $user->user_login );
95
-            } elseif ( 'display_name_with_email' === $show ) {
94
+                $display = sprintf(_x('%1$s (%2$s)', 'user dropdown'), $user->display_name, $user->user_login);
95
+            } elseif ('display_name_with_email' === $show) {
96 96
                 /* translators: 1: display name, 2: user_email */
97
-                if ( $user->display_name == $user->user_email ) {
97
+                if ($user->display_name == $user->user_email) {
98 98
                     $display = $user->display_name;
99 99
                 } else {
100
-                    $display = sprintf( _x( '%1$s (%2$s)', 'user dropdown' ), $user->display_name, $user->user_email );
100
+                    $display = sprintf(_x('%1$s (%2$s)', 'user dropdown'), $user->display_name, $user->user_email);
101 101
                 }
102
-            } elseif ( ! empty( $user->$show ) ) {
102
+            } elseif (!empty($user->$show)) {
103 103
                 $display = $user->$show;
104 104
             } else {
105 105
                 $display = '(' . $user->user_login . ')';
106 106
             }
107 107
 
108
-            $_selected = selected( $user->ID, $r['selected'], false );
109
-            $output .= "\t<option value='$user->ID'$_selected>" . esc_html( $display ) . "</option>\n";
108
+            $_selected = selected($user->ID, $r['selected'], false);
109
+            $output .= "\t<option value='$user->ID'$_selected>" . esc_html($display) . "</option>\n";
110 110
         }
111 111
 
112 112
         $output .= "</select>";
113 113
     }
114 114
 
115
-    $html = apply_filters( 'wpinv_dropdown_users', $output );
115
+    $html = apply_filters('wpinv_dropdown_users', $output);
116 116
 
117
-    if ( $r['echo'] ) {
117
+    if ($r['echo']) {
118 118
         echo $html;
119 119
     }
120 120
     return $html;
121 121
 }
122 122
 
123
-function wpinv_guest_redirect( $redirect_to, $user_id = 0 ) {
124
-    if ( (int)wpinv_get_option( 'guest_checkout' ) && $user_id > 0 ) {
125
-        wpinv_login_user( $user_id );
123
+function wpinv_guest_redirect($redirect_to, $user_id = 0) {
124
+    if ((int) wpinv_get_option('guest_checkout') && $user_id > 0) {
125
+        wpinv_login_user($user_id);
126 126
     } else {
127
-        $redirect_to = wp_login_url( $redirect_to );
127
+        $redirect_to = wp_login_url($redirect_to);
128 128
     }
129 129
     
130
-    $redirect_to = apply_filters( 'wpinv_invoice_link_guest_redirect', $redirect_to, $user_id );
130
+    $redirect_to = apply_filters('wpinv_invoice_link_guest_redirect', $redirect_to, $user_id);
131 131
     
132
-    wp_redirect( $redirect_to );
132
+    wp_redirect($redirect_to);
133 133
 }
134 134
 
135
-function wpinv_login_user( $user_id ) {
136
-    if ( is_user_logged_in() ) {
135
+function wpinv_login_user($user_id) {
136
+    if (is_user_logged_in()) {
137 137
         return true;
138 138
     }
139 139
     
140
-    $user = get_user_by( 'id', $user_id );
140
+    $user = get_user_by('id', $user_id);
141 141
     
142
-    if ( !empty( $user ) && !is_wp_error( $user ) && !empty( $user->user_login ) ) {
143
-        wp_set_current_user( $user_id, $user->user_login );
144
-        wp_set_auth_cookie( $user_id );
145
-        do_action( 'wp_login', $user->user_login );
142
+    if (!empty($user) && !is_wp_error($user) && !empty($user->user_login)) {
143
+        wp_set_current_user($user_id, $user->user_login);
144
+        wp_set_auth_cookie($user_id);
145
+        do_action('wp_login', $user->user_login);
146 146
         
147 147
         return true;
148 148
     }
@@ -157,9 +157,9 @@  discard block
 block discarded – undo
157 157
  * @return string capability to check against
158 158
  * @param string $capalibilty Optional. The alternative capability to check against.
159 159
  */
160
-function wpinv_get_capability( $capalibilty = 'manage_invoicing' ) {
160
+function wpinv_get_capability($capalibilty = 'manage_invoicing') {
161 161
 
162
-	if ( current_user_can( 'manage_options' ) ) {
162
+	if (current_user_can('manage_options')) {
163 163
 		return 'manage_options';
164 164
 	};
165 165
 
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
  * @return bool
174 174
  */
175 175
 function wpinv_current_user_can_manage_invoicing() {
176
-    return current_user_can( wpinv_get_capability() );
176
+    return current_user_can(wpinv_get_capability());
177 177
 }
178 178
 
179 179
 /**
@@ -182,17 +182,17 @@  discard block
 block discarded – undo
182 182
  * @since 1.0.19
183 183
  * @return int|WP_Error
184 184
  */
185
-function wpinv_create_user( $email ) {
185
+function wpinv_create_user($email) {
186 186
 
187 187
     // Prepare user values.
188 188
 	$args = array(
189
-		'user_login' => wpinv_generate_user_name( $email ),
189
+		'user_login' => wpinv_generate_user_name($email),
190 190
 		'user_pass'  => wp_generate_password(),
191 191
 		'user_email' => $email,
192 192
         'role'       => 'subscriber',
193 193
     );
194 194
 
195
-    return wp_insert_user( $args );
195
+    return wp_insert_user($args);
196 196
 
197 197
 }
198 198
 
@@ -202,22 +202,22 @@  discard block
 block discarded – undo
202 202
  * @since 1.0.19
203 203
  * @return bool|WP_User
204 204
  */
205
-function wpinv_generate_user_name( $prefix = '' ) {
205
+function wpinv_generate_user_name($prefix = '') {
206 206
 
207 207
     // If prefix is an email, retrieve the part before the email.
208
-	$prefix = strtok( $prefix, '@' );
208
+	$prefix = strtok($prefix, '@');
209 209
 
210 210
 	// Trim to 4 characters max.
211
-	$prefix = sanitize_user( $prefix );
211
+	$prefix = sanitize_user($prefix);
212 212
 
213
-	$illegal_logins = (array) apply_filters( 'illegal_user_logins', array() );
214
-	if ( empty( $prefix ) || in_array( strtolower( $prefix ), array_map( 'strtolower', $illegal_logins ), true ) ) {
213
+	$illegal_logins = (array) apply_filters('illegal_user_logins', array());
214
+	if (empty($prefix) || in_array(strtolower($prefix), array_map('strtolower', $illegal_logins), true)) {
215 215
 		$prefix = 'gtp';
216 216
 	}
217 217
 
218
-	$username = $prefix . '_' . zeroise( wp_rand( 0, 9999 ), 4 );
219
-	if ( username_exists( $username ) ) {
220
-		return wpinv_generate_user_name( $username );
218
+	$username = $prefix . '_' . zeroise(wp_rand(0, 9999), 4);
219
+	if (username_exists($username)) {
220
+		return wpinv_generate_user_name($username);
221 221
 	}
222 222
 
223 223
     return $username;
Please login to merge, or discard this patch.