@@ -46,62 +46,62 @@ discard block |
||
46 | 46 | <td style="width: 65%"> |
47 | 47 | <?php |
48 | 48 | |
49 | - switch ( $key ) { |
|
49 | + switch ( $key ) { |
|
50 | 50 | |
51 | - case 'status': |
|
52 | - echo esc_html( $subscription->get_status_label() ); |
|
53 | - break; |
|
51 | + case 'status': |
|
52 | + echo esc_html( $subscription->get_status_label() ); |
|
53 | + break; |
|
54 | 54 | |
55 | - case 'start_date': |
|
56 | - echo esc_html( getpaid_format_date_value( $subscription->get_date_created() ) ); |
|
57 | - break; |
|
55 | + case 'start_date': |
|
56 | + echo esc_html( getpaid_format_date_value( $subscription->get_date_created() ) ); |
|
57 | + break; |
|
58 | 58 | |
59 | - case 'expiry_date': |
|
60 | - echo esc_html( getpaid_format_date_value( $subscription->get_next_renewal_date() ) ); |
|
61 | - break; |
|
59 | + case 'expiry_date': |
|
60 | + echo esc_html( getpaid_format_date_value( $subscription->get_next_renewal_date() ) ); |
|
61 | + break; |
|
62 | 62 | |
63 | - case 'initial_amount': |
|
64 | - echo wpinv_price( $subscription->get_initial_amount(), $subscription->get_parent_payment()->get_currency() ); |
|
63 | + case 'initial_amount': |
|
64 | + echo wpinv_price( $subscription->get_initial_amount(), $subscription->get_parent_payment()->get_currency() ); |
|
65 | 65 | |
66 | - if ( $subscription->has_trial_period() ) { |
|
66 | + if ( $subscription->has_trial_period() ) { |
|
67 | 67 | |
68 | - echo "<small class='text-muted'> "; |
|
69 | - printf( |
|
70 | - _x( '( %1$s trial )', 'Subscription trial period. (e.g.: 1 month trial)', 'invoicing' ), |
|
71 | - esc_html( $subscription->get_trial_period() ) |
|
72 | - ); |
|
73 | - echo '</small>'; |
|
68 | + echo "<small class='text-muted'> "; |
|
69 | + printf( |
|
70 | + _x( '( %1$s trial )', 'Subscription trial period. (e.g.: 1 month trial)', 'invoicing' ), |
|
71 | + esc_html( $subscription->get_trial_period() ) |
|
72 | + ); |
|
73 | + echo '</small>'; |
|
74 | 74 | |
75 | - } |
|
75 | + } |
|
76 | 76 | |
77 | - break; |
|
77 | + break; |
|
78 | 78 | |
79 | - case 'recurring_amount': |
|
80 | - $frequency = getpaid_get_subscription_period_label( $subscription->get_period(), $subscription->get_frequency(), '' ); |
|
81 | - $amount = wpinv_price( $subscription->get_recurring_amount(), $subscription->get_parent_payment()->get_currency() ); |
|
82 | - echo wp_kses_post( strtolower( "<strong style='font-weight: 500;'>$amount</strong> / <span class='getpaid-item-recurring-period'>$frequency</span>" ) ); |
|
83 | - break; |
|
79 | + case 'recurring_amount': |
|
80 | + $frequency = getpaid_get_subscription_period_label( $subscription->get_period(), $subscription->get_frequency(), '' ); |
|
81 | + $amount = wpinv_price( $subscription->get_recurring_amount(), $subscription->get_parent_payment()->get_currency() ); |
|
82 | + echo wp_kses_post( strtolower( "<strong style='font-weight: 500;'>$amount</strong> / <span class='getpaid-item-recurring-period'>$frequency</span>" ) ); |
|
83 | + break; |
|
84 | 84 | |
85 | - case 'item': |
|
86 | - if ( empty( $subscription_group ) ) { |
|
87 | - echo wp_kses_post( WPInv_Subscriptions_List_Table::generate_item_markup( $subscription->get_product_id() ) ); |
|
88 | - } else { |
|
89 | - $markup = array_map( array( 'WPInv_Subscriptions_List_Table', 'generate_item_markup' ), array_keys( $subscription_group['items'] ) ); |
|
90 | - echo wp_kses_post( implode( ' | ', $markup ) ); |
|
91 | - } |
|
85 | + case 'item': |
|
86 | + if ( empty( $subscription_group ) ) { |
|
87 | + echo wp_kses_post( WPInv_Subscriptions_List_Table::generate_item_markup( $subscription->get_product_id() ) ); |
|
88 | + } else { |
|
89 | + $markup = array_map( array( 'WPInv_Subscriptions_List_Table', 'generate_item_markup' ), array_keys( $subscription_group['items'] ) ); |
|
90 | + echo wp_kses_post( implode( ' | ', $markup ) ); |
|
91 | + } |
|
92 | 92 | |
93 | - break; |
|
93 | + break; |
|
94 | 94 | |
95 | - case 'payments': |
|
96 | - $max_activations = (int) $subscription->get_bill_times(); |
|
97 | - echo ( (int) $subscription->get_times_billed() ) . ' / ' . ( empty( $max_activations ) ? '∞' : (int) $max_activations ); |
|
95 | + case 'payments': |
|
96 | + $max_activations = (int) $subscription->get_bill_times(); |
|
97 | + echo ( (int) $subscription->get_times_billed() ) . ' / ' . ( empty( $max_activations ) ? '∞' : (int) $max_activations ); |
|
98 | 98 | |
99 | - break; |
|
99 | + break; |
|
100 | 100 | |
101 | - } |
|
102 | - do_action( "getpaid_render_single_subscription_column_$key", $subscription ); |
|
101 | + } |
|
102 | + do_action( "getpaid_render_single_subscription_column_$key", $subscription ); |
|
103 | 103 | |
104 | - ?> |
|
104 | + ?> |
|
105 | 105 | </td> |
106 | 106 | |
107 | 107 | </tr> |
@@ -128,17 +128,17 @@ discard block |
||
128 | 128 | <span class="form-text"> |
129 | 129 | |
130 | 130 | <?php |
131 | - if ( $subscription->can_cancel() ) { |
|
132 | - printf( |
|
131 | + if ( $subscription->can_cancel() ) { |
|
132 | + printf( |
|
133 | 133 | '<a href="%s" class="btn btn-danger btn-sm" onclick="return confirm(\'%s\')">%s</a> ', |
134 | 134 | esc_url( $subscription->get_cancel_url() ), |
135 | 135 | esc_attr__( 'Are you sure you want to cancel this subscription?', 'invoicing' ), |
136 | 136 | __( 'Cancel Subscription', 'invoicing' ) |
137 | 137 | ); |
138 | - } |
|
138 | + } |
|
139 | 139 | |
140 | - do_action( 'getpaid-single-subscription-page-actions', $subscription ); |
|
141 | - ?> |
|
140 | + do_action( 'getpaid-single-subscription-page-actions', $subscription ); |
|
141 | + ?> |
|
142 | 142 | |
143 | 143 | <a href="<?php echo esc_url( getpaid_get_tab_url( 'gp-subscriptions', get_permalink( (int) wpinv_get_option( 'invoice_subscription_page' ) ) ) ); ?>" class="btn btn-secondary btn-sm"><?php _e( 'Go Back', 'invoicing' ); ?></a> |
144 | 144 | </span> |
@@ -26,58 +26,58 @@ discard block |
||
26 | 26 | |
27 | 27 | <?php |
28 | 28 | |
29 | - // Fires before printing a line item column. |
|
30 | - do_action( "getpaid_form_cart_item_before_$key", $item, $form ); |
|
31 | - |
|
32 | - // Item name. |
|
33 | - if ( 'name' == $key ) { |
|
34 | - |
|
35 | - ob_start(); |
|
36 | - // And an optional description. |
|
37 | - $description = $item->get_description(); |
|
38 | - |
|
39 | - if ( ! empty( $description ) ) { |
|
40 | - $description = wp_kses_post( $description ); |
|
41 | - echo "<small class='form-text text-muted pr-2 m-0'>$description</small>"; |
|
42 | - } |
|
43 | - |
|
44 | - // Price help text. |
|
45 | - $description = getpaid_item_recurring_price_help_text( $item, $currency ); |
|
46 | - if ( $description ) { |
|
47 | - echo "<small class='getpaid-form-item-price-desc form-text text-muted pr-2 m-0'>$description</small>"; |
|
48 | - } |
|
49 | - |
|
50 | - do_action( 'getpaid_payment_form_cart_item_description', $item, $form ); |
|
51 | - |
|
52 | - if ( wpinv_current_user_can_manage_invoicing() ) { |
|
53 | - |
|
54 | - edit_post_link( |
|
55 | - __( 'Edit this item.', 'invoicing' ), |
|
56 | - '<small class="form-text text-muted">', |
|
57 | - '</small>', |
|
58 | - $item->get_id(), |
|
59 | - 'text-danger' |
|
60 | - ); |
|
61 | - |
|
62 | - } |
|
63 | - |
|
64 | - $description = ob_get_clean(); |
|
65 | - |
|
66 | - // Display the name. |
|
67 | - $tootip = empty( $description ) ? '' : ' ' . '<i class="fas fa-xs fa-info gp-tooltip d-sm-none text-muted"></i>'; |
|
68 | - echo '<div class="mb-1">' . esc_html( $item->get_name() ) . wp_kses_post( $tootip ) . '</div>'; |
|
69 | - |
|
70 | - if ( ! empty( $description ) ) { |
|
71 | - printf( '<span class="d-none d-sm-block getpaid-item-desc">%s</span>', $description ); |
|
72 | - } |
|
73 | - |
|
74 | - if ( $item->allows_quantities() ) { |
|
75 | - printf( |
|
76 | - '<small class="d-sm-none text-muted form-text">%s</small>', |
|
77 | - sprintf( |
|
78 | - __( 'Qty %s', 'invoicing' ), |
|
79 | - sprintf( |
|
80 | - '<input |
|
29 | + // Fires before printing a line item column. |
|
30 | + do_action( "getpaid_form_cart_item_before_$key", $item, $form ); |
|
31 | + |
|
32 | + // Item name. |
|
33 | + if ( 'name' == $key ) { |
|
34 | + |
|
35 | + ob_start(); |
|
36 | + // And an optional description. |
|
37 | + $description = $item->get_description(); |
|
38 | + |
|
39 | + if ( ! empty( $description ) ) { |
|
40 | + $description = wp_kses_post( $description ); |
|
41 | + echo "<small class='form-text text-muted pr-2 m-0'>$description</small>"; |
|
42 | + } |
|
43 | + |
|
44 | + // Price help text. |
|
45 | + $description = getpaid_item_recurring_price_help_text( $item, $currency ); |
|
46 | + if ( $description ) { |
|
47 | + echo "<small class='getpaid-form-item-price-desc form-text text-muted pr-2 m-0'>$description</small>"; |
|
48 | + } |
|
49 | + |
|
50 | + do_action( 'getpaid_payment_form_cart_item_description', $item, $form ); |
|
51 | + |
|
52 | + if ( wpinv_current_user_can_manage_invoicing() ) { |
|
53 | + |
|
54 | + edit_post_link( |
|
55 | + __( 'Edit this item.', 'invoicing' ), |
|
56 | + '<small class="form-text text-muted">', |
|
57 | + '</small>', |
|
58 | + $item->get_id(), |
|
59 | + 'text-danger' |
|
60 | + ); |
|
61 | + |
|
62 | + } |
|
63 | + |
|
64 | + $description = ob_get_clean(); |
|
65 | + |
|
66 | + // Display the name. |
|
67 | + $tootip = empty( $description ) ? '' : ' ' . '<i class="fas fa-xs fa-info gp-tooltip d-sm-none text-muted"></i>'; |
|
68 | + echo '<div class="mb-1">' . esc_html( $item->get_name() ) . wp_kses_post( $tootip ) . '</div>'; |
|
69 | + |
|
70 | + if ( ! empty( $description ) ) { |
|
71 | + printf( '<span class="d-none d-sm-block getpaid-item-desc">%s</span>', $description ); |
|
72 | + } |
|
73 | + |
|
74 | + if ( $item->allows_quantities() ) { |
|
75 | + printf( |
|
76 | + '<small class="d-sm-none text-muted form-text">%s</small>', |
|
77 | + sprintf( |
|
78 | + __( 'Qty %s', 'invoicing' ), |
|
79 | + sprintf( |
|
80 | + '<input |
|
81 | 81 | type="number" |
82 | 82 | step="0.01" |
83 | 83 | style="width: 48px;" |
@@ -87,53 +87,53 @@ discard block |
||
87 | 87 | %s>', |
88 | 88 | (float) $item->get_quantity() == 0 ? 1 : (float) $item->get_quantity(), |
89 | 89 | null !== $max_qty ? 'max="' . (float) $max_qty . '"' : '' |
90 | - ) |
|
91 | - ) |
|
92 | - ); |
|
93 | - } else { |
|
94 | - printf( |
|
95 | - '<small class="d-sm-none text-muted form-text">%s</small>', |
|
96 | - sprintf( |
|
97 | - __( 'Qty %s', 'invoicing' ), |
|
98 | - (float) $item->get_quantity() |
|
99 | - ) |
|
100 | - ); |
|
101 | - } |
|
90 | + ) |
|
91 | + ) |
|
92 | + ); |
|
93 | + } else { |
|
94 | + printf( |
|
95 | + '<small class="d-sm-none text-muted form-text">%s</small>', |
|
96 | + sprintf( |
|
97 | + __( 'Qty %s', 'invoicing' ), |
|
98 | + (float) $item->get_quantity() |
|
99 | + ) |
|
100 | + ); |
|
101 | + } |
|
102 | 102 | } |
103 | 103 | |
104 | - // Item price. |
|
105 | - if ( 'price' == $key ) { |
|
104 | + // Item price. |
|
105 | + if ( 'price' == $key ) { |
|
106 | 106 | |
107 | - // Set the currency position. |
|
108 | - $position = wpinv_currency_position(); |
|
107 | + // Set the currency position. |
|
108 | + $position = wpinv_currency_position(); |
|
109 | 109 | |
110 | - if ( $position == 'left_space' ) { |
|
111 | - $position = 'left'; |
|
112 | - } |
|
110 | + if ( $position == 'left_space' ) { |
|
111 | + $position = 'left'; |
|
112 | + } |
|
113 | 113 | |
114 | - if ( $position == 'right_space' ) { |
|
115 | - $position = 'right'; |
|
116 | - } |
|
114 | + if ( $position == 'right_space' ) { |
|
115 | + $position = 'right'; |
|
116 | + } |
|
117 | 117 | |
118 | - if ( $item->user_can_set_their_price() ) { |
|
119 | - $price = max( (float) $item->get_price(), (float) $item->get_minimum_price() ); |
|
120 | - $minimum = (float) $item->get_minimum_price(); |
|
121 | - $validate_minimum = ''; |
|
122 | - $class = ''; |
|
123 | - $data_minimum = ''; |
|
118 | + if ( $item->user_can_set_their_price() ) { |
|
119 | + $price = max( (float) $item->get_price(), (float) $item->get_minimum_price() ); |
|
120 | + $minimum = (float) $item->get_minimum_price(); |
|
121 | + $validate_minimum = ''; |
|
122 | + $class = ''; |
|
123 | + $data_minimum = ''; |
|
124 | 124 | |
125 | - if ( $minimum > 0 ) { |
|
126 | - $validate_minimum = sprintf( |
|
127 | - esc_attr__( 'The minimum allowed amount is %s', 'invoicing' ), |
|
128 | - strip_tags( wpinv_price( $minimum, $currency ) ) |
|
129 | - ); |
|
125 | + if ( $minimum > 0 ) { |
|
126 | + $validate_minimum = sprintf( |
|
127 | + esc_attr__( 'The minimum allowed amount is %s', 'invoicing' ), |
|
128 | + strip_tags( wpinv_price( $minimum, $currency ) ) |
|
129 | + ); |
|
130 | 130 | |
131 | - $class = 'getpaid-validate-minimum-amount'; |
|
131 | + $class = 'getpaid-validate-minimum-amount'; |
|
132 | 132 | |
133 | - $data_minimum = "data-minimum-amount='" . esc_attr( getpaid_unstandardize_amount( $minimum ) ) . "'"; |
|
134 | - } |
|
133 | + $data_minimum = "data-minimum-amount='" . esc_attr( getpaid_unstandardize_amount( $minimum ) ) . "'"; |
|
134 | + } |
|
135 | 135 | |
136 | - ?> |
|
136 | + ?> |
|
137 | 137 | <div class="input-group input-group-sm"> |
138 | 138 | <?php if ( 'left' == $position ) : ?> |
139 | 139 | <div class="input-group-prepend"> |
@@ -158,43 +158,43 @@ discard block |
||
158 | 158 | |
159 | 159 | <?php |
160 | 160 | |
161 | - } else { |
|
162 | - echo wpinv_price( $item->get_price(), $currency ); |
|
161 | + } else { |
|
162 | + echo wpinv_price( $item->get_price(), $currency ); |
|
163 | 163 | |
164 | - ?> |
|
164 | + ?> |
|
165 | 165 | <input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][price]' type='hidden' class='getpaid-item-price-input' value='<?php echo esc_attr( $item->get_price() ); ?>'> |
166 | 166 | <?php |
167 | - } |
|
167 | + } |
|
168 | 168 | |
169 | - printf( |
|
169 | + printf( |
|
170 | 170 | '<small class="d-sm-none text-muted form-text getpaid-mobile-item-subtotal">%s</small>', |
171 | 171 | sprintf( __( 'Subtotal: %s', 'invoicing' ), wpinv_price( $item->get_sub_total(), $currency ) ) |
172 | 172 | ); |
173 | - } |
|
173 | + } |
|
174 | 174 | |
175 | - // Item quantity. |
|
176 | - if ( 'quantity' == $key ) { |
|
175 | + // Item quantity. |
|
176 | + if ( 'quantity' == $key ) { |
|
177 | 177 | |
178 | - if ( $item->allows_quantities() ) { |
|
179 | - ?> |
|
178 | + if ( $item->allows_quantities() ) { |
|
179 | + ?> |
|
180 | 180 | <input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][quantity]' type="number" step="0.01" style='width: 64px; line-height: 1; min-height: 35px;' class='getpaid-item-quantity-input p-1 align-middle font-weight-normal shadow-none m-0 rounded-0 text-center border' value='<?php echo (float) $item->get_quantity() == 0 ? 1 : (float) $item->get_quantity(); ?>' min='1' <?php echo null !== $max_qty ? 'max="' . (float) $max_qty . '"' : ''; ?> required> |
181 | 181 | <?php |
182 | - } else { |
|
183 | - echo (float) $item->get_quantity(); |
|
184 | - echo ' '; |
|
185 | - ?> |
|
182 | + } else { |
|
183 | + echo (float) $item->get_quantity(); |
|
184 | + echo ' '; |
|
185 | + ?> |
|
186 | 186 | <input type='hidden' name='getpaid-items[<?php echo (int) $item->get_id(); ?>][quantity]' class='getpaid-item-quantity-input' value='<?php echo (float) $item->get_quantity(); ?>'> |
187 | 187 | <?php |
188 | - } |
|
188 | + } |
|
189 | 189 | } |
190 | 190 | |
191 | - // Item sub total. |
|
192 | - if ( 'subtotal' == $key ) { |
|
193 | - echo wpinv_price( $item->get_sub_total(), $currency ); |
|
194 | - } |
|
191 | + // Item sub total. |
|
192 | + if ( 'subtotal' == $key ) { |
|
193 | + echo wpinv_price( $item->get_sub_total(), $currency ); |
|
194 | + } |
|
195 | 195 | |
196 | - do_action( "getpaid_payment_form_cart_item_$key", $item, $form ); |
|
197 | - ?> |
|
196 | + do_action( "getpaid_payment_form_cart_item_$key", $item, $form ); |
|
197 | + ?> |
|
198 | 198 | |
199 | 199 | </div> |
200 | 200 |
@@ -1,32 +1,32 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | - // Is the request set up correctly? |
|
4 | - if ( empty( $_GET['form'] ) && empty( $_GET['item'] ) ) { |
|
5 | - return aui()->alert( |
|
3 | + // Is the request set up correctly? |
|
4 | + if ( empty( $_GET['form'] ) && empty( $_GET['item'] ) ) { |
|
5 | + return aui()->alert( |
|
6 | 6 | array( |
7 | - 'type' => 'warning', |
|
8 | - 'content' => __( 'No payment form or item selected', 'invoicing' ), |
|
7 | + 'type' => 'warning', |
|
8 | + 'content' => __( 'No payment form or item selected', 'invoicing' ), |
|
9 | 9 | ) |
10 | 10 | ); |
11 | 11 | wp_die( __( 'No payment form or item selected', 'invoicing' ), 400 ); |
12 | - } |
|
12 | + } |
|
13 | 13 | |
14 | - // Payment form or button? |
|
15 | - if ( ! empty( $_GET['form'] ) ) { |
|
14 | + // Payment form or button? |
|
15 | + if ( ! empty( $_GET['form'] ) ) { |
|
16 | 16 | |
17 | - $shortcode = sprintf( |
|
17 | + $shortcode = sprintf( |
|
18 | 18 | '[getpaid form=%s]', |
19 | 19 | (int) $_GET['form'] |
20 | 20 | ); |
21 | 21 | |
22 | - } else { |
|
22 | + } else { |
|
23 | 23 | |
24 | - $shortcode = sprintf( |
|
24 | + $shortcode = sprintf( |
|
25 | 25 | '[getpaid item=%s]', |
26 | 26 | esc_attr( urldecode( $_GET['item'] ) ) |
27 | - ); |
|
27 | + ); |
|
28 | 28 | |
29 | - } |
|
29 | + } |
|
30 | 30 | |
31 | 31 | ?> |
32 | 32 | |
@@ -44,12 +44,12 @@ discard block |
||
44 | 44 | |
45 | 45 | <title>GetPaid</title> |
46 | 46 | <?php |
47 | - wp_enqueue_scripts(); |
|
48 | - wp_print_styles(); |
|
49 | - wp_print_head_scripts(); |
|
50 | - wp_custom_css_cb(); |
|
51 | - wpinv_get_template( 'frontend-head.php' ); |
|
52 | - ?> |
|
47 | + wp_enqueue_scripts(); |
|
48 | + wp_print_styles(); |
|
49 | + wp_print_head_scripts(); |
|
50 | + wp_custom_css_cb(); |
|
51 | + wpinv_get_template( 'frontend-head.php' ); |
|
52 | + ?> |
|
53 | 53 | |
54 | 54 | <style type="text/css"> |
55 | 55 | .body{ |
@@ -83,11 +83,11 @@ discard block |
||
83 | 83 | <body class="body page-template-default page"> |
84 | 84 | <div id="getpaid-form-embed" class="container my-5 page type-page status-publish hentry post post-content"> |
85 | 85 | <?php |
86 | - do_action( 'getpaid_payment_form_embed_top' ); |
|
87 | - echo do_shortcode( $shortcode ); |
|
88 | - do_action( 'getpaid_payment_form_embed_bottom' ); |
|
89 | - wpinv_get_template( 'frontend-footer.php' ); |
|
90 | - ?> |
|
86 | + do_action( 'getpaid_payment_form_embed_top' ); |
|
87 | + echo do_shortcode( $shortcode ); |
|
88 | + do_action( 'getpaid_payment_form_embed_bottom' ); |
|
89 | + wpinv_get_template( 'frontend-footer.php' ); |
|
90 | + ?> |
|
91 | 91 | </div> |
92 | 92 | <?php wp_footer(); ?> |
93 | 93 | </body> |
@@ -34,11 +34,11 @@ discard block |
||
34 | 34 | */ |
35 | 35 | function wpinv_get_capability( $capalibilty = 'manage_invoicing' ) { |
36 | 36 | |
37 | - if ( current_user_can( 'manage_options' ) ) { |
|
38 | - return 'manage_options'; |
|
39 | - }; |
|
37 | + if ( current_user_can( 'manage_options' ) ) { |
|
38 | + return 'manage_options'; |
|
39 | + }; |
|
40 | 40 | |
41 | - return $capalibilty; |
|
41 | + return $capalibilty; |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -62,10 +62,10 @@ discard block |
||
62 | 62 | // Prepare user values. |
63 | 63 | $prefix = preg_replace( '/\s+/', '', $prefix ); |
64 | 64 | $prefix = empty( $prefix ) ? $email : $prefix; |
65 | - $args = array( |
|
66 | - 'user_login' => wpinv_generate_user_name( $prefix ), |
|
67 | - 'user_pass' => wp_generate_password(), |
|
68 | - 'user_email' => $email, |
|
65 | + $args = array( |
|
66 | + 'user_login' => wpinv_generate_user_name( $prefix ), |
|
67 | + 'user_pass' => wp_generate_password(), |
|
68 | + 'user_email' => $email, |
|
69 | 69 | 'role' => 'subscriber', |
70 | 70 | ); |
71 | 71 | |
@@ -82,16 +82,16 @@ discard block |
||
82 | 82 | function wpinv_generate_user_name( $prefix = '' ) { |
83 | 83 | |
84 | 84 | // If prefix is an email, retrieve the part before the email. |
85 | - $prefix = strtok( $prefix, '@' ); |
|
85 | + $prefix = strtok( $prefix, '@' ); |
|
86 | 86 | $prefix = trim( $prefix, '.' ); |
87 | 87 | |
88 | - // Sanitize the username. |
|
89 | - $prefix = sanitize_user( $prefix, true ); |
|
88 | + // Sanitize the username. |
|
89 | + $prefix = sanitize_user( $prefix, true ); |
|
90 | 90 | |
91 | - $illegal_logins = (array) apply_filters( 'illegal_user_logins', array() ); |
|
92 | - if ( empty( $prefix ) || in_array( strtolower( $prefix ), array_map( 'strtolower', $illegal_logins ), true ) ) { |
|
93 | - $prefix = 'gtp_' . zeroise( wp_rand( 0, 9999 ), 4 ); |
|
94 | - } |
|
91 | + $illegal_logins = (array) apply_filters( 'illegal_user_logins', array() ); |
|
92 | + if ( empty( $prefix ) || in_array( strtolower( $prefix ), array_map( 'strtolower', $illegal_logins ), true ) ) { |
|
93 | + $prefix = 'gtp_' . zeroise( wp_rand( 0, 9999 ), 4 ); |
|
94 | + } |
|
95 | 95 | |
96 | 96 | $username = $prefix; |
97 | 97 | $postfix = 2; |
@@ -220,52 +220,52 @@ discard block |
||
220 | 220 | |
221 | 221 | foreach ( getpaid_user_address_fields() as $key => $label ) { |
222 | 222 | |
223 | - // Display the country. |
|
224 | - if ( 'country' == $key ) { |
|
225 | - |
|
226 | - echo aui()->select( |
|
227 | - array( |
|
228 | - 'options' => wpinv_get_country_list(), |
|
229 | - 'name' => 'getpaid_address[' . esc_attr( $key ) . ']', |
|
230 | - 'id' => 'wpinv-' . sanitize_html_class( $key ), |
|
231 | - 'value' => sanitize_text_field( getpaid_get_user_address_field( get_current_user_id(), $key ) ), |
|
232 | - 'placeholder' => $label, |
|
233 | - 'label' => wp_kses_post( $label ), |
|
234 | - 'label_type' => 'vertical', |
|
235 | - 'class' => 'getpaid-address-field', |
|
236 | - ) |
|
237 | - ); |
|
238 | - |
|
239 | - } |
|
240 | - |
|
241 | - // Display the state. |
|
242 | - elseif ( 'state' == $key ) { |
|
243 | - |
|
244 | - echo getpaid_get_states_select_markup( |
|
245 | - getpaid_get_user_address_field( get_current_user_id(), 'country' ), |
|
246 | - getpaid_get_user_address_field( get_current_user_id(), 'state' ), |
|
247 | - $label, |
|
248 | - $label, |
|
249 | - '', |
|
250 | - false, |
|
251 | - '', |
|
252 | - 'getpaid_address[' . esc_attr( $key ) . ']' |
|
253 | - ); |
|
223 | + // Display the country. |
|
224 | + if ( 'country' == $key ) { |
|
225 | + |
|
226 | + echo aui()->select( |
|
227 | + array( |
|
228 | + 'options' => wpinv_get_country_list(), |
|
229 | + 'name' => 'getpaid_address[' . esc_attr( $key ) . ']', |
|
230 | + 'id' => 'wpinv-' . sanitize_html_class( $key ), |
|
231 | + 'value' => sanitize_text_field( getpaid_get_user_address_field( get_current_user_id(), $key ) ), |
|
232 | + 'placeholder' => $label, |
|
233 | + 'label' => wp_kses_post( $label ), |
|
234 | + 'label_type' => 'vertical', |
|
235 | + 'class' => 'getpaid-address-field', |
|
236 | + ) |
|
237 | + ); |
|
238 | + |
|
239 | + } |
|
240 | + |
|
241 | + // Display the state. |
|
242 | + elseif ( 'state' == $key ) { |
|
243 | + |
|
244 | + echo getpaid_get_states_select_markup( |
|
245 | + getpaid_get_user_address_field( get_current_user_id(), 'country' ), |
|
246 | + getpaid_get_user_address_field( get_current_user_id(), 'state' ), |
|
247 | + $label, |
|
248 | + $label, |
|
249 | + '', |
|
250 | + false, |
|
251 | + '', |
|
252 | + 'getpaid_address[' . esc_attr( $key ) . ']' |
|
253 | + ); |
|
254 | 254 | |
255 | 255 | } else { |
256 | 256 | |
257 | - echo aui()->input( |
|
257 | + echo aui()->input( |
|
258 | 258 | array( |
259 | - 'name' => 'getpaid_address[' . esc_attr( $key ) . ']', |
|
260 | - 'id' => 'wpinv-' . sanitize_html_class( $key ), |
|
261 | - 'placeholder' => $label, |
|
262 | - 'label' => wp_kses_post( $label ), |
|
263 | - 'label_type' => 'vertical', |
|
264 | - 'type' => 'text', |
|
265 | - 'value' => sanitize_text_field( getpaid_get_user_address_field( get_current_user_id(), $key ) ), |
|
266 | - 'class' => 'getpaid-address-field', |
|
259 | + 'name' => 'getpaid_address[' . esc_attr( $key ) . ']', |
|
260 | + 'id' => 'wpinv-' . sanitize_html_class( $key ), |
|
261 | + 'placeholder' => $label, |
|
262 | + 'label' => wp_kses_post( $label ), |
|
263 | + 'label_type' => 'vertical', |
|
264 | + 'type' => 'text', |
|
265 | + 'value' => sanitize_text_field( getpaid_get_user_address_field( get_current_user_id(), $key ) ), |
|
266 | + 'class' => 'getpaid-address-field', |
|
267 | 267 | ) |
268 | - ); |
|
268 | + ); |
|
269 | 269 | |
270 | 270 | } |
271 | 271 | } |