@@ -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( |
|
133 | - '<a href="%s" class="btn btn-danger btn-sm" onclick="return confirm(\'%s\')">%s</a> ', |
|
134 | - esc_url( $subscription->get_cancel_url() ), |
|
135 | - esc_attr__( 'Are you sure you want to cancel this subscription?', 'invoicing' ), |
|
136 | - __( 'Cancel Subscription', 'invoicing' ) |
|
137 | - ); |
|
138 | - } |
|
139 | - |
|
140 | - do_action( 'getpaid-single-subscription-page-actions', $subscription ); |
|
141 | - ?> |
|
131 | + if ( $subscription->can_cancel() ) { |
|
132 | + printf( |
|
133 | + '<a href="%s" class="btn btn-danger btn-sm" onclick="return confirm(\'%s\')">%s</a> ', |
|
134 | + esc_url( $subscription->get_cancel_url() ), |
|
135 | + esc_attr__( 'Are you sure you want to cancel this subscription?', 'invoicing' ), |
|
136 | + __( 'Cancel Subscription', 'invoicing' ) |
|
137 | + ); |
|
138 | + } |
|
139 | + |
|
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> |
@@ -42,92 +42,92 @@ discard block |
||
42 | 42 | <tr class="wpinv-item wpinv-item-<?php echo sanitize_html_class( $invoice->get_status() ); ?>"> |
43 | 43 | <?php |
44 | 44 | |
45 | - foreach ( wpinv_get_user_invoices_columns( $post_type ) as $column_id => $column_name ) : |
|
45 | + foreach ( wpinv_get_user_invoices_columns( $post_type ) as $column_id => $column_name ) : |
|
46 | 46 | |
47 | - $column_id = sanitize_html_class( $column_id ); |
|
48 | - $class = empty( $column_name['class'] ) ? '' : sanitize_html_class( $column_name['class'] ); |
|
47 | + $column_id = sanitize_html_class( $column_id ); |
|
48 | + $class = empty( $column_name['class'] ) ? '' : sanitize_html_class( $column_name['class'] ); |
|
49 | 49 | |
50 | - echo "<td class='$column_id $class'>"; |
|
51 | - switch ( $column_id ) { |
|
50 | + echo "<td class='$column_id $class'>"; |
|
51 | + switch ( $column_id ) { |
|
52 | 52 | |
53 | - case 'invoice-number': |
|
54 | - echo wp_kses_post( wpinv_invoice_link( $invoice ) ); |
|
55 | - break; |
|
53 | + case 'invoice-number': |
|
54 | + echo wp_kses_post( wpinv_invoice_link( $invoice ) ); |
|
55 | + break; |
|
56 | 56 | |
57 | - case 'created-date': |
|
58 | - echo getpaid_format_date_value( $invoice->get_date_created() ); |
|
59 | - break; |
|
57 | + case 'created-date': |
|
58 | + echo getpaid_format_date_value( $invoice->get_date_created() ); |
|
59 | + break; |
|
60 | 60 | |
61 | - case 'payment-date': |
|
62 | - if ( $invoice->needs_payment() ) { |
|
63 | - echo '—'; |
|
64 | - } else { |
|
65 | - echo getpaid_format_date_value( $invoice->get_date_completed() ); |
|
66 | - } |
|
61 | + case 'payment-date': |
|
62 | + if ( $invoice->needs_payment() ) { |
|
63 | + echo '—'; |
|
64 | + } else { |
|
65 | + echo getpaid_format_date_value( $invoice->get_date_completed() ); |
|
66 | + } |
|
67 | 67 | |
68 | - break; |
|
68 | + break; |
|
69 | 69 | |
70 | - case 'invoice-status': |
|
71 | - echo wp_kses_post( $invoice->get_status_label_html() ); |
|
70 | + case 'invoice-status': |
|
71 | + echo wp_kses_post( $invoice->get_status_label_html() ); |
|
72 | 72 | |
73 | - break; |
|
73 | + break; |
|
74 | 74 | |
75 | - case 'invoice-total': |
|
76 | - echo wpinv_price( $invoice->get_total(), $invoice->get_currency() ); |
|
75 | + case 'invoice-total': |
|
76 | + echo wpinv_price( $invoice->get_total(), $invoice->get_currency() ); |
|
77 | 77 | |
78 | - break; |
|
78 | + break; |
|
79 | 79 | |
80 | - case 'invoice-actions': |
|
81 | - $actions = array( |
|
80 | + case 'invoice-actions': |
|
81 | + $actions = array( |
|
82 | 82 | |
83 | - 'pay' => array( |
|
84 | - 'url' => $invoice->get_checkout_payment_url(), |
|
85 | - 'name' => __( 'Pay Now', 'invoicing' ), |
|
86 | - 'class' => 'btn-success', |
|
87 | - ), |
|
83 | + 'pay' => array( |
|
84 | + 'url' => $invoice->get_checkout_payment_url(), |
|
85 | + 'name' => __( 'Pay Now', 'invoicing' ), |
|
86 | + 'class' => 'btn-success', |
|
87 | + ), |
|
88 | 88 | |
89 | - 'print' => array( |
|
90 | - 'url' => $invoice->get_view_url(), |
|
91 | - 'name' => __( 'View', 'invoicing' ), |
|
92 | - 'class' => 'btn-secondary', |
|
93 | - 'attrs' => 'target="_blank"', |
|
94 | - ), |
|
95 | - ); |
|
89 | + 'print' => array( |
|
90 | + 'url' => $invoice->get_view_url(), |
|
91 | + 'name' => __( 'View', 'invoicing' ), |
|
92 | + 'class' => 'btn-secondary', |
|
93 | + 'attrs' => 'target="_blank"', |
|
94 | + ), |
|
95 | + ); |
|
96 | 96 | |
97 | - if ( ! $invoice->needs_payment() ) { |
|
98 | - unset( $actions['pay'] ); |
|
99 | - } |
|
97 | + if ( ! $invoice->needs_payment() ) { |
|
98 | + unset( $actions['pay'] ); |
|
99 | + } |
|
100 | 100 | |
101 | - if ( $invoice->needs_payment() ) { |
|
102 | - $actions['delete'] = array( |
|
103 | - 'url' => getpaid_get_authenticated_action_url( 'delete_invoice', add_query_arg( 'invoice_id', $invoice->get_id() ) ), |
|
104 | - 'name' => __( 'Delete', 'invoicing' ), |
|
105 | - 'class' => 'btn-danger', |
|
106 | - ); |
|
107 | - } |
|
101 | + if ( $invoice->needs_payment() ) { |
|
102 | + $actions['delete'] = array( |
|
103 | + 'url' => getpaid_get_authenticated_action_url( 'delete_invoice', add_query_arg( 'invoice_id', $invoice->get_id() ) ), |
|
104 | + 'name' => __( 'Delete', 'invoicing' ), |
|
105 | + 'class' => 'btn-danger', |
|
106 | + ); |
|
107 | + } |
|
108 | 108 | |
109 | - $actions = apply_filters( 'wpinv_user_invoices_actions', $actions, $invoice, $post_type ); |
|
109 | + $actions = apply_filters( 'wpinv_user_invoices_actions', $actions, $invoice, $post_type ); |
|
110 | 110 | |
111 | - foreach ( $actions as $key => $action ) { |
|
112 | - $class = ! empty( $action['class'] ) ? sanitize_html_class( $action['class'] ) : ''; |
|
113 | - echo '<a href="' . esc_url( $action['url'] ) . '" class="btn btn-sm btn-block ' . $class . ' ' . sanitize_html_class( $key ) . '" ' . ( ! empty( $action['attrs'] ) ? $action['attrs'] : '' ) . '>' . $action['name'] . '</a>'; |
|
114 | - } |
|
111 | + foreach ( $actions as $key => $action ) { |
|
112 | + $class = ! empty( $action['class'] ) ? sanitize_html_class( $action['class'] ) : ''; |
|
113 | + echo '<a href="' . esc_url( $action['url'] ) . '" class="btn btn-sm btn-block ' . $class . ' ' . sanitize_html_class( $key ) . '" ' . ( ! empty( $action['attrs'] ) ? $action['attrs'] : '' ) . '>' . $action['name'] . '</a>'; |
|
114 | + } |
|
115 | 115 | |
116 | - break; |
|
116 | + break; |
|
117 | 117 | |
118 | - default: |
|
119 | - do_action( "wpinv_user_invoices_column_$column_id", $invoice ); |
|
120 | - break; |
|
118 | + default: |
|
119 | + do_action( "wpinv_user_invoices_column_$column_id", $invoice ); |
|
120 | + break; |
|
121 | 121 | |
122 | 122 | |
123 | - } |
|
123 | + } |
|
124 | 124 | |
125 | - do_action( "wpinv_user_invoices_column_after_$column_id", $invoice ); |
|
125 | + do_action( "wpinv_user_invoices_column_after_$column_id", $invoice ); |
|
126 | 126 | |
127 | - echo '</td>'; |
|
127 | + echo '</td>'; |
|
128 | 128 | |
129 | - endforeach; |
|
130 | - ?> |
|
129 | + endforeach; |
|
130 | + ?> |
|
131 | 131 | </tr> |
132 | 132 | |
133 | 133 | <?php endforeach; ?> |
@@ -141,16 +141,16 @@ discard block |
||
141 | 141 | <?php if ( 1 < $invoices->max_num_pages ) : ?> |
142 | 142 | <div class="invoicing-Pagination"> |
143 | 143 | <?php |
144 | - $big = 999999; |
|
144 | + $big = 999999; |
|
145 | 145 | |
146 | - echo paginate_links( |
|
146 | + echo paginate_links( |
|
147 | 147 | array( |
148 | - 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), |
|
149 | - 'format' => '?paged=%#%', |
|
150 | - 'total' => $invoices->max_num_pages, |
|
148 | + 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), |
|
149 | + 'format' => '?paged=%#%', |
|
150 | + 'total' => $invoices->max_num_pages, |
|
151 | 151 | ) |
152 | 152 | ); |
153 | - ?> |
|
153 | + ?> |
|
154 | 154 | </div> |
155 | 155 | <?php endif; ?> |
156 | 156 |
@@ -64,8 +64,8 @@ |
||
64 | 64 | $description = wpinv_get_gateway_description( $gateway ); |
65 | 65 | |
66 | 66 | if ( wpinv_is_test_mode( $gateway ) ) { |
67 | - $sandbox_notice = apply_filters( "getpaid_{$gateway}_sandbox_notice", __( 'SANDBOX ENABLED: No real payments will occur.', 'invoicing' ) ); |
|
68 | - $description = "$description $sandbox_notice"; |
|
67 | + $sandbox_notice = apply_filters( "getpaid_{$gateway}_sandbox_notice", __( 'SANDBOX ENABLED: No real payments will occur.', 'invoicing' ) ); |
|
68 | + $description = "$description $sandbox_notice"; |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | echo wpautop( wp_kses_post( $description ) ); |
@@ -21,20 +21,20 @@ |
||
21 | 21 | |
22 | 22 | foreach ( $file_types as $file_type ) { |
23 | 23 | |
24 | - if ( isset( $all_types[ $file_type ] ) ) { |
|
25 | - $types[] = $all_types[ $file_type ]; |
|
26 | - $file_type = explode( '|', $file_type ); |
|
27 | - |
|
28 | - foreach ( $file_type as $type ) { |
|
29 | - $type = trim( $type ); |
|
30 | - $types[] = ".$type"; |
|
31 | - $_types[] = $type; |
|
32 | - } |
|
24 | + if ( isset( $all_types[ $file_type ] ) ) { |
|
25 | + $types[] = $all_types[ $file_type ]; |
|
26 | + $file_type = explode( '|', $file_type ); |
|
27 | + |
|
28 | + foreach ( $file_type as $type ) { |
|
29 | + $type = trim( $type ); |
|
30 | + $types[] = ".$type"; |
|
31 | + $_types[] = $type; |
|
32 | + } |
|
33 | 33 | } |
34 | 34 | } |
35 | 35 | |
36 | 36 | if ( ! empty( $required ) ) { |
37 | - $label .= "<span class='text-danger'> *</span>"; |
|
37 | + $label .= "<span class='text-danger'> *</span>"; |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | ?> |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | defined( 'ABSPATH' ) || exit; |
11 | 11 | |
12 | 12 | if ( empty( $fields ) ) { |
13 | - return; |
|
13 | + return; |
|
14 | 14 | } |
15 | 15 | |
16 | 16 | // A prefix for all ids (so that a form can be included in the same page multiple times). |
@@ -18,12 +18,12 @@ discard block |
||
18 | 18 | |
19 | 19 | // Prepare the user's country. |
20 | 20 | if ( ! empty( $form->invoice ) ) { |
21 | - $country = $form->invoice->get_country(); |
|
21 | + $country = $form->invoice->get_country(); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | if ( empty( $country ) ) { |
25 | - $country = empty( $country ) ? getpaid_get_ip_country() : $country; |
|
26 | - $country = empty( $country ) ? wpinv_get_default_country() : $country; |
|
25 | + $country = empty( $country ) ? getpaid_get_ip_country() : $country; |
|
26 | + $country = empty( $country ) ? wpinv_get_default_country() : $country; |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | // A prefix for all ids (so that a form can be included in the same page multiple times). |
@@ -55,10 +55,10 @@ discard block |
||
55 | 55 | <!-- Start Billing Address --> |
56 | 56 | <div class="getpaid-billing-address-wrapper"> |
57 | 57 | <?php |
58 | - $field_type = 'billing'; |
|
59 | - include plugin_dir_path( __FILE__ ) . 'address-fields.php'; |
|
60 | - do_action( 'getpaid_after_payment_form_billing_fields', $form ); |
|
61 | - ?> |
|
58 | + $field_type = 'billing'; |
|
59 | + include plugin_dir_path( __FILE__ ) . 'address-fields.php'; |
|
60 | + do_action( 'getpaid_after_payment_form_billing_fields', $form ); |
|
61 | + ?> |
|
62 | 62 | </div> |
63 | 63 | <!-- End Billing Address --> |
64 | 64 | |
@@ -70,20 +70,20 @@ discard block |
||
70 | 70 | |
71 | 71 | <?php |
72 | 72 | |
73 | - echo aui()->input( |
|
74 | - array( |
|
75 | - 'type' => 'checkbox', |
|
76 | - 'name' => 'same-shipping-address', |
|
77 | - 'id' => "shipping-toggle$uniqid", |
|
78 | - 'required' => false, |
|
79 | - 'label' => wp_kses_post( $shipping_address_toggle ), |
|
80 | - 'value' => 1, |
|
81 | - 'checked' => true, |
|
82 | - 'class' => 'w-auto', |
|
83 | - ) |
|
84 | - ); |
|
73 | + echo aui()->input( |
|
74 | + array( |
|
75 | + 'type' => 'checkbox', |
|
76 | + 'name' => 'same-shipping-address', |
|
77 | + 'id' => "shipping-toggle$uniqid", |
|
78 | + 'required' => false, |
|
79 | + 'label' => wp_kses_post( $shipping_address_toggle ), |
|
80 | + 'value' => 1, |
|
81 | + 'checked' => true, |
|
82 | + 'class' => 'w-auto', |
|
83 | + ) |
|
84 | + ); |
|
85 | 85 | |
86 | - ?> |
|
86 | + ?> |
|
87 | 87 | |
88 | 88 | |
89 | 89 | <!-- Start Shipping Address Title --> |
@@ -102,10 +102,10 @@ discard block |
||
102 | 102 | <!-- Start Shipping Address --> |
103 | 103 | <div class="getpaid-shipping-address-wrapper"> |
104 | 104 | <?php |
105 | - $field_type = 'shipping'; |
|
106 | - include plugin_dir_path( __FILE__ ) . 'address-fields.php'; |
|
107 | - do_action( 'getpaid_after_payment_form_shipping_fields', $form ); |
|
108 | - ?> |
|
105 | + $field_type = 'shipping'; |
|
106 | + include plugin_dir_path( __FILE__ ) . 'address-fields.php'; |
|
107 | + do_action( 'getpaid_after_payment_form_shipping_fields', $form ); |
|
108 | + ?> |
|
109 | 109 | </div> |
110 | 110 | <!-- End Shipping Address --> |
111 | 111 |
@@ -12,57 +12,57 @@ |
||
12 | 12 | $label = empty( $label ) ? '' : wp_kses_post( $label ); |
13 | 13 | $label_class = sanitize_key( preg_replace( '/[^A-Za-z0-9_-]/', '-', $label ) ); |
14 | 14 | if ( ! empty( $required ) ) { |
15 | - $label .= "<span class='text-danger'> *</span>"; |
|
15 | + $label .= "<span class='text-danger'> *</span>"; |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | $disable_dates = array(); |
19 | 19 | |
20 | 20 | if ( ! empty( $disabled_dates ) ) { |
21 | - $disabled_dates = preg_replace( '/\s+/', '', $disabled_dates ); |
|
22 | - $disabled_dates = str_ireplace( 'today', current_time( 'Y-m-d' ), $disabled_dates ); |
|
23 | - $disabled_dates = array_filter( explode( ',', $disabled_dates ) ); |
|
21 | + $disabled_dates = preg_replace( '/\s+/', '', $disabled_dates ); |
|
22 | + $disabled_dates = str_ireplace( 'today', current_time( 'Y-m-d' ), $disabled_dates ); |
|
23 | + $disabled_dates = array_filter( explode( ',', $disabled_dates ) ); |
|
24 | 24 | |
25 | - foreach ( $disabled_dates as $disabled_date ) { |
|
25 | + foreach ( $disabled_dates as $disabled_date ) { |
|
26 | 26 | |
27 | - $disabled_date = trim( $disabled_date ); |
|
27 | + $disabled_date = trim( $disabled_date ); |
|
28 | 28 | |
29 | - if ( false === strpos( $disabled_date, '|' ) ) { |
|
30 | - $disable_dates[] = $disabled_date; |
|
31 | - continue; |
|
32 | - } |
|
29 | + if ( false === strpos( $disabled_date, '|' ) ) { |
|
30 | + $disable_dates[] = $disabled_date; |
|
31 | + continue; |
|
32 | + } |
|
33 | 33 | |
34 | - $disabled_date = explode( '|', $disabled_date ); |
|
35 | - $disable_dates[] = array( |
|
36 | - 'from' => trim( $disabled_date[0] ), |
|
37 | - 'to' => trim( $disabled_date[1] ), |
|
38 | - ); |
|
34 | + $disabled_date = explode( '|', $disabled_date ); |
|
35 | + $disable_dates[] = array( |
|
36 | + 'from' => trim( $disabled_date[0] ), |
|
37 | + 'to' => trim( $disabled_date[1] ), |
|
38 | + ); |
|
39 | 39 | |
40 | - } |
|
40 | + } |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | $options = array( |
44 | - 'data-default-date' => empty( 'default_date' ) ? false : $default_date, |
|
45 | - 'data-min-date' => empty( 'min_date' ) ? false : $min_date, |
|
46 | - 'data-max-date' => empty( 'max_date' ) ? false : $max_date, |
|
47 | - 'data-mode' => empty( 'mode' ) ? 'single' : $mode, |
|
48 | - 'data-alt-format' => get_option( 'date_format', 'F j, Y' ), |
|
49 | - 'data-date-format' => 'Y-m-d', |
|
50 | - 'data-alt-input' => 'true', |
|
51 | - 'data-disable_alt' => empty( $disabled_dates ) ? false : wp_json_encode( $disable_dates ), |
|
52 | - 'data-disable_days_alt' => empty( $disable_days ) ? false : wp_json_encode( wp_parse_id_list( $disable_days ) ), |
|
44 | + 'data-default-date' => empty( 'default_date' ) ? false : $default_date, |
|
45 | + 'data-min-date' => empty( 'min_date' ) ? false : $min_date, |
|
46 | + 'data-max-date' => empty( 'max_date' ) ? false : $max_date, |
|
47 | + 'data-mode' => empty( 'mode' ) ? 'single' : $mode, |
|
48 | + 'data-alt-format' => get_option( 'date_format', 'F j, Y' ), |
|
49 | + 'data-date-format' => 'Y-m-d', |
|
50 | + 'data-alt-input' => 'true', |
|
51 | + 'data-disable_alt' => empty( $disabled_dates ) ? false : wp_json_encode( $disable_dates ), |
|
52 | + 'data-disable_days_alt' => empty( $disable_days ) ? false : wp_json_encode( wp_parse_id_list( $disable_days ) ), |
|
53 | 53 | ); |
54 | 54 | |
55 | 55 | echo aui()->input( |
56 | - array( |
|
57 | - 'name' => esc_attr( $id ), |
|
58 | - 'id' => esc_attr( $id ) . uniqid( '_' ), |
|
59 | - 'placeholder' => empty( $placeholder ) ? '' : esc_attr( $placeholder ), |
|
60 | - 'required' => ! empty( $required ), |
|
61 | - 'label' => $label, |
|
62 | - 'label_type' => 'vertical', |
|
63 | - 'help_text' => empty( $description ) ? '' : wp_kses_post( $description ), |
|
64 | - 'type' => 'datepicker', |
|
65 | - 'class' => $label_class . ' getpaid-init-flatpickr flatpickr-input', |
|
66 | - 'extra_attributes' => array_filter( apply_filters( 'getpaid_date_field_attributes', $options ) ), |
|
67 | - ) |
|
56 | + array( |
|
57 | + 'name' => esc_attr( $id ), |
|
58 | + 'id' => esc_attr( $id ) . uniqid( '_' ), |
|
59 | + 'placeholder' => empty( $placeholder ) ? '' : esc_attr( $placeholder ), |
|
60 | + 'required' => ! empty( $required ), |
|
61 | + 'label' => $label, |
|
62 | + 'label_type' => 'vertical', |
|
63 | + 'help_text' => empty( $description ) ? '' : wp_kses_post( $description ), |
|
64 | + 'type' => 'datepicker', |
|
65 | + 'class' => $label_class . ' getpaid-init-flatpickr flatpickr-input', |
|
66 | + 'extra_attributes' => array_filter( apply_filters( 'getpaid_date_field_attributes', $options ) ), |
|
67 | + ) |
|
68 | 68 | ); |
@@ -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( |
|
170 | - '<small class="d-sm-none text-muted form-text getpaid-mobile-item-subtotal">%s</small>', |
|
171 | - sprintf( __( 'Subtotal: %s', 'invoicing' ), wpinv_price( $item->get_sub_total(), $currency ) ) |
|
172 | - ); |
|
173 | - } |
|
169 | + printf( |
|
170 | + '<small class="d-sm-none text-muted form-text getpaid-mobile-item-subtotal">%s</small>', |
|
171 | + sprintf( __( 'Subtotal: %s', 'invoicing' ), wpinv_price( $item->get_sub_total(), $currency ) ) |
|
172 | + ); |
|
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 |
@@ -11,26 +11,26 @@ discard block |
||
11 | 11 | |
12 | 12 | // Totals rows. |
13 | 13 | $totals = apply_filters( |
14 | - 'getpaid_payment_form_cart_table_totals', |
|
15 | - array( |
|
16 | - 'subtotal' => __( 'Subtotal', 'invoicing' ), |
|
17 | - 'tax' => __( 'Tax', 'invoicing' ), |
|
18 | - 'fees' => __( 'Fee', 'invoicing' ), |
|
19 | - 'discount' => __( 'Discount', 'invoicing' ), |
|
20 | - 'total' => __( 'Total', 'invoicing' ), |
|
21 | - ), |
|
22 | - $form |
|
14 | + 'getpaid_payment_form_cart_table_totals', |
|
15 | + array( |
|
16 | + 'subtotal' => __( 'Subtotal', 'invoicing' ), |
|
17 | + 'tax' => __( 'Tax', 'invoicing' ), |
|
18 | + 'fees' => __( 'Fee', 'invoicing' ), |
|
19 | + 'discount' => __( 'Discount', 'invoicing' ), |
|
20 | + 'total' => __( 'Total', 'invoicing' ), |
|
21 | + ), |
|
22 | + $form |
|
23 | 23 | ); |
24 | 24 | |
25 | 25 | $currency = $form->get_currency(); |
26 | 26 | $country = wpinv_get_default_country(); |
27 | 27 | |
28 | 28 | if ( ! empty( $form->invoice ) ) { |
29 | - $country = $form->invoice->get_country(); |
|
29 | + $country = $form->invoice->get_country(); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | if ( ! wpinv_use_taxes() && isset( $totals['tax'] ) ) { |
33 | - unset( $totals['tax'] ); |
|
33 | + unset( $totals['tax'] ); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | do_action( 'getpaid_before_payment_form_cart_totals', $form, $totals ); |
@@ -61,13 +61,13 @@ discard block |
||
61 | 61 | |
62 | 62 | <?php |
63 | 63 | |
64 | - // Total tax. |
|
65 | - if ( in_array( $key, array( 'tax', 'discount', 'subtotal', 'total', 'fees' ) ) ) { |
|
66 | - echo wpinv_price( 0, $currency ); |
|
67 | - } |
|
64 | + // Total tax. |
|
65 | + if ( in_array( $key, array( 'tax', 'discount', 'subtotal', 'total', 'fees' ) ) ) { |
|
66 | + echo wpinv_price( 0, $currency ); |
|
67 | + } |
|
68 | 68 | |
69 | - do_action( "getpaid_payment_form_cart_totals_$key", $form ); |
|
70 | - ?> |
|
69 | + do_action( "getpaid_payment_form_cart_totals_$key", $form ); |
|
70 | + ?> |
|
71 | 71 | |
72 | 72 | </div> |
73 | 73 |
@@ -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( |
|
6 | - array( |
|
3 | + // Is the request set up correctly? |
|
4 | + if ( empty( $_GET['form'] ) && empty( $_GET['item'] ) ) { |
|
5 | + return aui()->alert( |
|
6 | + array( |
|
7 | 7 | 'type' => 'warning', |
8 | 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( |
|
18 | - '[getpaid form=%s]', |
|
19 | - (int) $_GET['form'] |
|
17 | + $shortcode = sprintf( |
|
18 | + '[getpaid form=%s]', |
|
19 | + (int) $_GET['form'] |
|
20 | 20 | ); |
21 | 21 | |
22 | - } else { |
|
22 | + } else { |
|
23 | 23 | |
24 | - $shortcode = sprintf( |
|
25 | - '[getpaid item=%s]', |
|
26 | - esc_attr( urldecode( $_GET['item'] ) ) |
|
27 | - ); |
|
24 | + $shortcode = sprintf( |
|
25 | + '[getpaid item=%s]', |
|
26 | + esc_attr( urldecode( $_GET['item'] ) ) |
|
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> |