@@ -1,25 +1,25 @@ discard block |
||
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 | // Load colours |
7 | -$bg = wpinv_get_option( 'email_background_color', '#f5f5f5' ); |
|
8 | -$body = wpinv_get_option( 'email_body_background_color', '#fdfdfd' ); |
|
9 | -$base = wpinv_get_option( 'email_base_color', '#557da2' ); |
|
10 | -$base_text = wpinv_light_or_dark( $base, '#202020', '#ffffff' ); |
|
11 | -$text = wpinv_get_option( 'email_text_color', '#505050' ); |
|
7 | +$bg = wpinv_get_option('email_background_color', '#f5f5f5'); |
|
8 | +$body = wpinv_get_option('email_body_background_color', '#fdfdfd'); |
|
9 | +$base = wpinv_get_option('email_base_color', '#557da2'); |
|
10 | +$base_text = wpinv_light_or_dark($base, '#202020', '#ffffff'); |
|
11 | +$text = wpinv_get_option('email_text_color', '#505050'); |
|
12 | 12 | |
13 | -$bg_darker_10 = wpinv_hex_darker( $bg, 10 ); |
|
14 | -$body_darker_10 = wpinv_hex_darker( $body, 10 ); |
|
15 | -$base_lighter_20 = wpinv_hex_lighter( $base, 20 ); |
|
16 | -$base_lighter_40 = wpinv_hex_lighter( $base, 40 ); |
|
17 | -$text_lighter_20 = wpinv_hex_lighter( $text, 20 ); |
|
13 | +$bg_darker_10 = wpinv_hex_darker($bg, 10); |
|
14 | +$body_darker_10 = wpinv_hex_darker($body, 10); |
|
15 | +$base_lighter_20 = wpinv_hex_lighter($base, 20); |
|
16 | +$base_lighter_40 = wpinv_hex_lighter($base, 40); |
|
17 | +$text_lighter_20 = wpinv_hex_lighter($text, 20); |
|
18 | 18 | |
19 | 19 | // !important; is a gmail hack to prevent styles being stripped if it doesn't like something. |
20 | 20 | ?> |
21 | 21 | #wrapper { |
22 | - background-color: <?php echo esc_attr( $bg ); ?>; |
|
22 | + background-color: <?php echo esc_attr($bg); ?>; |
|
23 | 23 | margin: 0; |
24 | 24 | -webkit-text-size-adjust: none !important; |
25 | 25 | padding: 3%; |
@@ -40,15 +40,15 @@ discard block |
||
40 | 40 | |
41 | 41 | #template_container { |
42 | 42 | box-shadow: 0 1px 4px rgba(0,0,0,0.1) !important; |
43 | - background-color: <?php echo esc_attr( $body ); ?>; |
|
44 | - border: 1px solid <?php echo esc_attr( $bg_darker_10 ); ?>; |
|
43 | + background-color: <?php echo esc_attr($body); ?>; |
|
44 | + border: 1px solid <?php echo esc_attr($bg_darker_10); ?>; |
|
45 | 45 | border-radius: 3px !important; |
46 | 46 | } |
47 | 47 | |
48 | 48 | #template_header { |
49 | - background-color: <?php echo esc_attr( $base ); ?>; |
|
49 | + background-color: <?php echo esc_attr($base); ?>; |
|
50 | 50 | border-radius: 3px 3px 0 0 !important; |
51 | - color: <?php echo esc_attr( $base_text ); ?>; |
|
51 | + color: <?php echo esc_attr($base_text); ?>; |
|
52 | 52 | border-bottom: 0; |
53 | 53 | font-weight: bold; |
54 | 54 | line-height: 100%; |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | } |
62 | 62 | |
63 | 63 | #template_header h1 { |
64 | - color: <?php echo esc_attr( $base_text ); ?>; |
|
64 | + color: <?php echo esc_attr($base_text); ?>; |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | #template_footer td { |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | |
73 | 73 | #template_footer #credit { |
74 | 74 | border:0; |
75 | - color: <?php echo esc_attr( $base_lighter_40 ); ?>; |
|
75 | + color: <?php echo esc_attr($base_lighter_40); ?>; |
|
76 | 76 | font-family: Arial; |
77 | 77 | font-size:12px; |
78 | 78 | line-height:125%; |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | } |
82 | 82 | |
83 | 83 | #body_content { |
84 | - background-color: <?php echo esc_attr( $body ); ?>; |
|
84 | + background-color: <?php echo esc_attr($body); ?>; |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | #body_content table td { |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | } |
102 | 102 | |
103 | 103 | #body_content_inner { |
104 | - color: <?php echo esc_attr( $text_lighter_20 ); ?>; |
|
104 | + color: <?php echo esc_attr($text_lighter_20); ?>; |
|
105 | 105 | font-family: Arial,Helvetica,sans-serif; |
106 | 106 | font-size: 14px; |
107 | 107 | line-height: 150%; |
@@ -109,17 +109,17 @@ discard block |
||
109 | 109 | } |
110 | 110 | |
111 | 111 | .td { |
112 | - color: <?php echo esc_attr( $text_lighter_20 ); ?>; |
|
113 | - border: 1px solid <?php echo esc_attr( $body_darker_10 ); ?>; |
|
112 | + color: <?php echo esc_attr($text_lighter_20); ?>; |
|
113 | + border: 1px solid <?php echo esc_attr($body_darker_10); ?>; |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | .text { |
117 | - color: <?php echo esc_attr( $text ); ?>; |
|
117 | + color: <?php echo esc_attr($text); ?>; |
|
118 | 118 | font-family: Arial,Helvetica,sans-serif; |
119 | 119 | } |
120 | 120 | |
121 | 121 | .link { |
122 | - color: <?php echo esc_attr( $base ); ?>; |
|
122 | + color: <?php echo esc_attr($base); ?>; |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | #header_wrapper { |
@@ -128,19 +128,19 @@ discard block |
||
128 | 128 | } |
129 | 129 | |
130 | 130 | h1 { |
131 | - color: <?php echo esc_attr( $base ); ?>; |
|
131 | + color: <?php echo esc_attr($base); ?>; |
|
132 | 132 | font-family: Arial,Helvetica,sans-serif; |
133 | 133 | font-size: 30px; |
134 | 134 | font-weight: 300; |
135 | 135 | line-height: 150%; |
136 | 136 | margin: 0; |
137 | 137 | text-align: <?php echo is_rtl() ? 'right' : 'left'; ?>; |
138 | - text-shadow: 0 1px 0 <?php echo esc_attr( $base_lighter_20 ); ?>; |
|
138 | + text-shadow: 0 1px 0 <?php echo esc_attr($base_lighter_20); ?>; |
|
139 | 139 | -webkit-font-smoothing: antialiased; |
140 | 140 | } |
141 | 141 | |
142 | 142 | h2 { |
143 | - color: <?php echo esc_attr( $base ); ?>; |
|
143 | + color: <?php echo esc_attr($base); ?>; |
|
144 | 144 | display: block; |
145 | 145 | font-family: Arial,Helvetica,sans-serif; |
146 | 146 | font-size: 18px; |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | } |
152 | 152 | |
153 | 153 | h3 { |
154 | - color: <?php echo esc_attr( $base ); ?>; |
|
154 | + color: <?php echo esc_attr($base); ?>; |
|
155 | 155 | display: block; |
156 | 156 | font-family: Arial,Helvetica,sans-serif; |
157 | 157 | font-size: 16px; |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | } |
163 | 163 | |
164 | 164 | a { |
165 | - color: <?php echo esc_attr( $base ); ?>; |
|
165 | + color: <?php echo esc_attr($base); ?>; |
|
166 | 166 | font-weight: normal; |
167 | 167 | text-decoration: underline; |
168 | 168 | } |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | } |
181 | 181 | |
182 | 182 | .table-bordered { |
183 | - border: 1px solid <?php echo esc_attr( $body_darker_10 ); ?>; |
|
183 | + border: 1px solid <?php echo esc_attr($body_darker_10); ?>; |
|
184 | 184 | border-collapse: collapse; |
185 | 185 | border-spacing: 0; |
186 | 186 | width: 100%; |
@@ -188,8 +188,8 @@ discard block |
||
188 | 188 | |
189 | 189 | .table-bordered th, |
190 | 190 | .table-bordered td { |
191 | - border: 1px solid <?php echo esc_attr( $body_darker_10 ); ?>; |
|
192 | - color: <?php echo esc_attr( $text_lighter_20 ); ?>; |
|
191 | + border: 1px solid <?php echo esc_attr($body_darker_10); ?>; |
|
192 | + color: <?php echo esc_attr($text_lighter_20); ?>; |
|
193 | 193 | font-size: 14px; |
194 | 194 | } |
195 | 195 | .small { |
@@ -288,9 +288,9 @@ discard block |
||
288 | 288 | text-decoration: none; |
289 | 289 | } |
290 | 290 | .btn-default { |
291 | - color: <?php echo esc_attr( $base_text ); ?>; |
|
292 | - background-color: <?php echo esc_attr( $base ); ?>; |
|
293 | - border-color: <?php echo esc_attr( $base ); ?>; |
|
291 | + color: <?php echo esc_attr($base_text); ?>; |
|
292 | + background-color: <?php echo esc_attr($base); ?>; |
|
293 | + border-color: <?php echo esc_attr($base); ?>; |
|
294 | 294 | } |
295 | 295 | .btn-primary { |
296 | 296 | color: #fff; |
@@ -1,6 +1,6 @@ discard block |
||
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 | global $wpinv_euvat, $ajax_cart_details; |
@@ -11,152 +11,152 @@ discard block |
||
11 | 11 | $quantities_enabled = wpinv_item_quantities_enabled(); |
12 | 12 | $use_taxes = wpinv_use_taxes(); |
13 | 13 | $zero_tax = !(float)$invoice->get_tax() > 0 ? true : false; |
14 | -$tax_label = $use_taxes && $invoice->has_vat() ? $wpinv_euvat->get_vat_name() : __( 'Tax', 'invoicing' ); |
|
15 | -$tax_title = !$zero_tax && $use_taxes ? ( wpinv_prices_include_tax() ? wp_sprintf( __( '(%s Incl.)', 'invoicing' ), $tax_label ) : wp_sprintf( __( '(%s Excl.)', 'invoicing' ), $tax_label ) ) : ''; |
|
14 | +$tax_label = $use_taxes && $invoice->has_vat() ? $wpinv_euvat->get_vat_name() : __('Tax', 'invoicing'); |
|
15 | +$tax_title = !$zero_tax && $use_taxes ? (wpinv_prices_include_tax() ? wp_sprintf(__('(%s Incl.)', 'invoicing'), $tax_label) : wp_sprintf(__('(%s Excl.)', 'invoicing'), $tax_label)) : ''; |
|
16 | 16 | |
17 | -do_action( 'wpinv_before_email_items', $invoice ); ?> |
|
17 | +do_action('wpinv_before_email_items', $invoice); ?> |
|
18 | 18 | <div id="wpinv-email-items"> |
19 | - <h3 class="wpinv-items-t"><?php echo apply_filters( 'wpinv_email_items_title', __( 'Items', 'invoicing' ) ); ?></h3> |
|
19 | + <h3 class="wpinv-items-t"><?php echo apply_filters('wpinv_email_items_title', __('Items', 'invoicing')); ?></h3> |
|
20 | 20 | <table id="wpinv_checkout_cart" class="table table-bordered table-hover"> |
21 | 21 | <thead> |
22 | 22 | <tr class="wpinv_cart_header_row"> |
23 | - <?php do_action( 'wpinv_email_items_table_header_first' ); ?> |
|
24 | - <th class="wpinv_cart_item_name text-left"><?php _e( 'Item Name', 'invoicing' ); ?></th> |
|
25 | - <th class="wpinv_cart_item_price text-right"><?php _e( 'Item Price', 'invoicing' ); ?></th> |
|
26 | - <?php if ( $quantities_enabled ) { ?> |
|
27 | - <th class="wpinv_cart_item_qty text-right"><?php _e( 'Qty', 'invoicing' ); ?></th> |
|
23 | + <?php do_action('wpinv_email_items_table_header_first'); ?> |
|
24 | + <th class="wpinv_cart_item_name text-left"><?php _e('Item Name', 'invoicing'); ?></th> |
|
25 | + <th class="wpinv_cart_item_price text-right"><?php _e('Item Price', 'invoicing'); ?></th> |
|
26 | + <?php if ($quantities_enabled) { ?> |
|
27 | + <th class="wpinv_cart_item_qty text-right"><?php _e('Qty', 'invoicing'); ?></th> |
|
28 | 28 | <?php } ?> |
29 | - <?php if ( !$zero_tax && $use_taxes ) { ?> |
|
29 | + <?php if (!$zero_tax && $use_taxes) { ?> |
|
30 | 30 | <th class="wpinv_cart_item_tax text-right"><?php echo $tax_label . ' <span class="normal small">(%)</span>'; ?></th> |
31 | 31 | <?php } ?> |
32 | - <th class="wpinv_cart_item_subtotal text-right"><?php echo __( 'Item Total', 'invoicing' ) . ' <span class="normal small">' . $tax_title . '<span>'; ?></th> |
|
33 | - <?php do_action( 'wpinv_email_items_table_header_last' ); ?> |
|
32 | + <th class="wpinv_cart_item_subtotal text-right"><?php echo __('Item Total', 'invoicing') . ' <span class="normal small">' . $tax_title . '<span>'; ?></th> |
|
33 | + <?php do_action('wpinv_email_items_table_header_last'); ?> |
|
34 | 34 | </tr> |
35 | 35 | </thead> |
36 | 36 | <tbody> |
37 | 37 | <?php |
38 | - do_action( 'wpinv_email_items_before' ); |
|
39 | - if ( $cart_items ) { |
|
40 | - foreach ( $cart_items as $key => $item ) { |
|
41 | - $wpi_item = $item['id'] ? new WPInv_Item( $item['id'] ) : NULL; |
|
38 | + do_action('wpinv_email_items_before'); |
|
39 | + if ($cart_items) { |
|
40 | + foreach ($cart_items as $key => $item) { |
|
41 | + $wpi_item = $item['id'] ? new WPInv_Item($item['id']) : NULL; |
|
42 | 42 | ?> |
43 | - <tr class="wpinv_cart_item" id="wpinv_cart_item_<?php echo esc_attr( $key ) . '_' . esc_attr( $item['id'] ); ?>" data-item-id="<?php echo esc_attr( $item['id'] ); ?>"> |
|
44 | - <?php do_action( 'wpinv_email_items_table_body_first', $item ); ?> |
|
43 | + <tr class="wpinv_cart_item" id="wpinv_cart_item_<?php echo esc_attr($key) . '_' . esc_attr($item['id']); ?>" data-item-id="<?php echo esc_attr($item['id']); ?>"> |
|
44 | + <?php do_action('wpinv_email_items_table_body_first', $item); ?> |
|
45 | 45 | <td class="wpinv_cart_item_name text-left"> |
46 | 46 | <?php |
47 | - if ( current_theme_supports( 'post-thumbnails' ) && has_post_thumbnail( $item['id'] ) ) { |
|
47 | + if (current_theme_supports('post-thumbnails') && has_post_thumbnail($item['id'])) { |
|
48 | 48 | echo '<div class="wpinv_cart_item_image">'; |
49 | - echo get_the_post_thumbnail( $item['id'], apply_filters( 'wpinv_checkout_image_size', array( 25,25 ) ) ); |
|
49 | + echo get_the_post_thumbnail($item['id'], apply_filters('wpinv_checkout_image_size', array(25, 25))); |
|
50 | 50 | echo '</div>'; |
51 | 51 | } |
52 | - $item_title = esc_html( wpinv_get_cart_item_name( $item ) ) . wpinv_get_item_suffix( $wpi_item ); |
|
52 | + $item_title = esc_html(wpinv_get_cart_item_name($item)) . wpinv_get_item_suffix($wpi_item); |
|
53 | 53 | echo '<span class="wpinv_email_cart_item_title">' . $item_title . '</span>'; |
54 | 54 | |
55 | - $summary = apply_filters( 'wpinv_email_invoice_line_item_summary', '', $item, $wpi_item, $invoice ); |
|
56 | - if ( !empty( $summary ) ) { |
|
55 | + $summary = apply_filters('wpinv_email_invoice_line_item_summary', '', $item, $wpi_item, $invoice); |
|
56 | + if (!empty($summary)) { |
|
57 | 57 | echo '<p class="small">' . $summary . '</p>'; |
58 | 58 | } |
59 | 59 | |
60 | - do_action( 'wpinv_email_cart_item_title_after', $item, $key ); |
|
60 | + do_action('wpinv_email_cart_item_title_after', $item, $key); |
|
61 | 61 | ?> |
62 | 62 | </td> |
63 | 63 | <td class="wpinv_cart_item_price text-right"> |
64 | 64 | <?php |
65 | - echo wpinv_cart_item_price( $item ); |
|
66 | - do_action( 'wpinv_email_cart_item_price_after', $item, $key ); |
|
65 | + echo wpinv_cart_item_price($item); |
|
66 | + do_action('wpinv_email_cart_item_price_after', $item, $key); |
|
67 | 67 | ?> |
68 | 68 | </td> |
69 | - <?php if ( $quantities_enabled ) { ?> |
|
69 | + <?php if ($quantities_enabled) { ?> |
|
70 | 70 | <td class="wpinv_cart_item_qty text-right"> |
71 | 71 | <?php |
72 | - echo wpinv_get_cart_item_quantity( $item ); |
|
73 | - do_action( 'wpinv_email_item_quantitiy', $item, $key ); |
|
72 | + echo wpinv_get_cart_item_quantity($item); |
|
73 | + do_action('wpinv_email_item_quantitiy', $item, $key); |
|
74 | 74 | ?> |
75 | 75 | </td> |
76 | 76 | <?php } ?> |
77 | - <?php if ( !$zero_tax && $use_taxes ) { ?> |
|
77 | + <?php if (!$zero_tax && $use_taxes) { ?> |
|
78 | 78 | <td class="wpinv_cart_item_tax text-right"> |
79 | 79 | <?php |
80 | - echo wpinv_cart_item_tax( $item ); |
|
81 | - do_action( 'wpinv_email_item_tax', $item, $key ); |
|
80 | + echo wpinv_cart_item_tax($item); |
|
81 | + do_action('wpinv_email_item_tax', $item, $key); |
|
82 | 82 | ?> |
83 | 83 | </td> |
84 | 84 | <?php } ?> |
85 | 85 | <td class="wpinv_cart_item_subtotal text-right"> |
86 | 86 | <?php |
87 | - echo wpinv_cart_item_subtotal( $item ); |
|
88 | - do_action( 'wpinv_email_item_subtotal', $item, $key ); |
|
87 | + echo wpinv_cart_item_subtotal($item); |
|
88 | + do_action('wpinv_email_item_subtotal', $item, $key); |
|
89 | 89 | ?> |
90 | 90 | </td> |
91 | - <?php do_action( 'wpinv_email_items_table_body_last', $item, $key ); ?> |
|
91 | + <?php do_action('wpinv_email_items_table_body_last', $item, $key); ?> |
|
92 | 92 | </tr> |
93 | 93 | <?php } ?> |
94 | 94 | <?php } ?> |
95 | - <?php do_action( 'wpinv_email_items_middle' ); ?> |
|
96 | - <?php do_action( 'wpinv_email_items_after' ); ?> |
|
95 | + <?php do_action('wpinv_email_items_middle'); ?> |
|
96 | + <?php do_action('wpinv_email_items_after'); ?> |
|
97 | 97 | </tbody> |
98 | 98 | <tfoot> |
99 | - <?php $cart_columns = wpinv_checkout_cart_columns(); if ( $zero_tax && $use_taxes ) { $cart_columns--; } ?> |
|
100 | - <?php if ( has_action( 'wpinv_email_footer_buttons' ) ) { ?> |
|
99 | + <?php $cart_columns = wpinv_checkout_cart_columns(); if ($zero_tax && $use_taxes) { $cart_columns--; } ?> |
|
100 | + <?php if (has_action('wpinv_email_footer_buttons')) { ?> |
|
101 | 101 | <tr class="wpinv_cart_footer_row"> |
102 | - <?php do_action( 'wpinv_email_items_table_buttons_first', $cart_items ); ?> |
|
103 | - <td colspan="<?php echo ( $cart_columns ); ?>"> |
|
104 | - <?php do_action( 'wpinv_email_footer_buttons' ); ?> |
|
102 | + <?php do_action('wpinv_email_items_table_buttons_first', $cart_items); ?> |
|
103 | + <td colspan="<?php echo ($cart_columns); ?>"> |
|
104 | + <?php do_action('wpinv_email_footer_buttons'); ?> |
|
105 | 105 | </td> |
106 | - <?php do_action( 'wpinv_email_items_table_buttons_first', $cart_items ); ?> |
|
106 | + <?php do_action('wpinv_email_items_table_buttons_first', $cart_items); ?> |
|
107 | 107 | </tr> |
108 | 108 | <?php } ?> |
109 | 109 | |
110 | - <?php if ( !$zero_tax && $use_taxes && !wpinv_prices_include_tax() && wpinv_is_cart_taxed() ) { ?> |
|
110 | + <?php if (!$zero_tax && $use_taxes && !wpinv_prices_include_tax() && wpinv_is_cart_taxed()) { ?> |
|
111 | 111 | <tr class="wpinv_cart_footer_row wpinv_cart_subtotal_row"> |
112 | - <?php do_action( 'wpinv_email_items_table_subtotal_first', $cart_items ); ?> |
|
113 | - <td colspan="<?php echo ( $cart_columns - 1 ); ?>" class="wpinv_cart_subtotal_label text-right"> |
|
114 | - <strong><?php _e( 'Sub-Total', 'invoicing' ); ?>:</strong> |
|
112 | + <?php do_action('wpinv_email_items_table_subtotal_first', $cart_items); ?> |
|
113 | + <td colspan="<?php echo ($cart_columns - 1); ?>" class="wpinv_cart_subtotal_label text-right"> |
|
114 | + <strong><?php _e('Sub-Total', 'invoicing'); ?>:</strong> |
|
115 | 115 | </td> |
116 | 116 | <td class="wpinv_cart_subtotal text-right"> |
117 | - <span class="wpinv_cart_subtotal_amount bold"><?php echo $invoice->get_subtotal( true ); ?></span> |
|
117 | + <span class="wpinv_cart_subtotal_amount bold"><?php echo $invoice->get_subtotal(true); ?></span> |
|
118 | 118 | </td> |
119 | - <?php do_action( 'wpinv_email_items_table_subtotal_last', $cart_items, $invoice ); ?> |
|
119 | + <?php do_action('wpinv_email_items_table_subtotal_last', $cart_items, $invoice); ?> |
|
120 | 120 | </tr> |
121 | 121 | <?php } ?> |
122 | 122 | |
123 | - <?php if ( wpinv_discount( $invoice_id, false ) > 0 ) { ?> |
|
123 | + <?php if (wpinv_discount($invoice_id, false) > 0) { ?> |
|
124 | 124 | <tr class="wpinv_cart_footer_row wpinv_cart_discount_row"> |
125 | - <?php do_action( 'wpinv_receipt_items_table_discount_first', $cart_items, $invoice ); ?> |
|
126 | - <td colspan="<?php echo ( $cart_columns - 1 ); ?>" class="wpinv_cart_discount_label text-right"> |
|
127 | - <strong><?php wpinv_get_discount_label( wpinv_discount_code( $invoice_id ) ); ?>:</strong> |
|
125 | + <?php do_action('wpinv_receipt_items_table_discount_first', $cart_items, $invoice); ?> |
|
126 | + <td colspan="<?php echo ($cart_columns - 1); ?>" class="wpinv_cart_discount_label text-right"> |
|
127 | + <strong><?php wpinv_get_discount_label(wpinv_discount_code($invoice_id)); ?>:</strong> |
|
128 | 128 | </td> |
129 | 129 | <td class="wpinv_cart_discount text-right"> |
130 | - <span class="wpinv_cart_discount_amount"><?php echo wpinv_discount( $invoice_id, true, true ); ?></span> |
|
130 | + <span class="wpinv_cart_discount_amount"><?php echo wpinv_discount($invoice_id, true, true); ?></span> |
|
131 | 131 | </td> |
132 | - <?php do_action( 'wpinv_receipt_items_table_discount_last', $cart_items, $invoice ); ?> |
|
132 | + <?php do_action('wpinv_receipt_items_table_discount_last', $cart_items, $invoice); ?> |
|
133 | 133 | </tr> |
134 | 134 | <?php } ?> |
135 | 135 | |
136 | - <?php if ( !$zero_tax && $use_taxes && wpinv_is_cart_taxed() ) { ?> |
|
136 | + <?php if (!$zero_tax && $use_taxes && wpinv_is_cart_taxed()) { ?> |
|
137 | 137 | <tr class="wpinv_cart_footer_row wpinv_cart_tax_row"> |
138 | - <?php do_action( 'wpinv_email_items_table_tax_first', $cart_items, $invoice ); ?> |
|
139 | - <td colspan="<?php echo ( $cart_columns - 1 ); ?>" class="wpinv_cart_tax_label text-right"> |
|
138 | + <?php do_action('wpinv_email_items_table_tax_first', $cart_items, $invoice); ?> |
|
139 | + <td colspan="<?php echo ($cart_columns - 1); ?>" class="wpinv_cart_tax_label text-right"> |
|
140 | 140 | <strong><?php echo $tax_label; ?>:</strong> |
141 | 141 | </td> |
142 | 142 | <td class="wpinv_cart_tax text-right"> |
143 | - <span class="wpinv_cart_tax_amount"><?php echo $invoice->get_tax( true ); ?></span> |
|
143 | + <span class="wpinv_cart_tax_amount"><?php echo $invoice->get_tax(true); ?></span> |
|
144 | 144 | </td> |
145 | - <?php do_action( 'wpinv_email_items_table_tax_last', $cart_items, $invoice ); ?> |
|
145 | + <?php do_action('wpinv_email_items_table_tax_last', $cart_items, $invoice); ?> |
|
146 | 146 | </tr> |
147 | 147 | <?php } ?> |
148 | 148 | |
149 | 149 | <tr class="wpinv_cart_footer_row"> |
150 | - <?php do_action( 'wpinv_email_items_table_footer_first', $cart_items, $invoice ); ?> |
|
151 | - <td colspan="<?php echo ( $cart_columns - 1 ); ?>" class="wpinv_cart_total_label text-right"> |
|
152 | - <?php echo apply_filters( 'wpinv_email_cart_total_label', '<strong>' . __( 'Total', 'invoicing' ) . ':</strong>', $invoice ); ?> |
|
150 | + <?php do_action('wpinv_email_items_table_footer_first', $cart_items, $invoice); ?> |
|
151 | + <td colspan="<?php echo ($cart_columns - 1); ?>" class="wpinv_cart_total_label text-right"> |
|
152 | + <?php echo apply_filters('wpinv_email_cart_total_label', '<strong>' . __('Total', 'invoicing') . ':</strong>', $invoice); ?> |
|
153 | 153 | </td> |
154 | 154 | <td class="wpinv_cart_total text-right"> |
155 | - <span class="wpinv_cart_amount bold"><?php echo $invoice->get_total( true ); ?></span> |
|
155 | + <span class="wpinv_cart_amount bold"><?php echo $invoice->get_total(true); ?></span> |
|
156 | 156 | </td> |
157 | - <?php do_action( 'wpinv_email_items_table_footer_last', $cart_items, $invoice ); ?> |
|
157 | + <?php do_action('wpinv_email_items_table_footer_last', $cart_items, $invoice); ?> |
|
158 | 158 | </tr> |
159 | 159 | </tfoot> |
160 | 160 | </table> |
161 | 161 | </div> |
162 | -<?php do_action( 'wpinv_after_email_items', $invoice ); ?> |
|
163 | 162 | \ No newline at end of file |
163 | +<?php do_action('wpinv_after_email_items', $invoice); ?> |
|
164 | 164 | \ No newline at end of file |
@@ -5,138 +5,138 @@ |
||
5 | 5 | |
6 | 6 | global $wpinv_euvat, $post, $ajax_cart_details, $wpi_cart_columns, $wpi_session; |
7 | 7 | $invoice = wpinv_get_invoice_cart(); |
8 | -$cart_items = !empty( $ajax_cart_details ) ? $ajax_cart_details : wpinv_get_cart_content_details(); |
|
8 | +$cart_items = !empty($ajax_cart_details) ? $ajax_cart_details : wpinv_get_cart_content_details(); |
|
9 | 9 | $quantities_enabled = wpinv_item_quantities_enabled(); |
10 | 10 | $use_taxes = wpinv_use_taxes(); |
11 | 11 | $tax_label = $wpinv_euvat->tax_label(); |
12 | -$tax_title = $use_taxes ? ( wpinv_prices_include_tax() ? wp_sprintf( __( '(%s Incl.)', 'invoicing' ), $tax_label ) : wp_sprintf( __( '(%s Excl.)', 'invoicing' ), $tax_label ) ) : ''; |
|
12 | +$tax_title = $use_taxes ? (wpinv_prices_include_tax() ? wp_sprintf(__('(%s Incl.)', 'invoicing'), $tax_label) : wp_sprintf(__('(%s Excl.)', 'invoicing'), $tax_label)) : ''; |
|
13 | 13 | ?> |
14 | 14 | <table id="wpinv_checkout_cart" class="table table-bordered table-hover"> |
15 | 15 | <thead> |
16 | 16 | <tr class="wpinv_cart_header_row"> |
17 | - <?php do_action( 'wpinv_checkout_table_header_first' ); ?> |
|
18 | - <th class="wpinv_cart_item_name text-left"><?php _e( 'Item Name', 'invoicing' ); ?></th> |
|
19 | - <th class="wpinv_cart_item_price text-right"><?php _e( 'Item Price', 'invoicing' ); ?></th> |
|
20 | - <?php if ( $quantities_enabled ) { ?> |
|
21 | - <th class="wpinv_cart_item_qty text-right"><?php _e( 'Qty', 'invoicing' ); ?></th> |
|
17 | + <?php do_action('wpinv_checkout_table_header_first'); ?> |
|
18 | + <th class="wpinv_cart_item_name text-left"><?php _e('Item Name', 'invoicing'); ?></th> |
|
19 | + <th class="wpinv_cart_item_price text-right"><?php _e('Item Price', 'invoicing'); ?></th> |
|
20 | + <?php if ($quantities_enabled) { ?> |
|
21 | + <th class="wpinv_cart_item_qty text-right"><?php _e('Qty', 'invoicing'); ?></th> |
|
22 | 22 | <?php } ?> |
23 | - <?php if ( $use_taxes ) { ?> |
|
23 | + <?php if ($use_taxes) { ?> |
|
24 | 24 | <th class="wpinv_cart_item_tax text-right"><?php echo $tax_label . ' <span class="normal small">(%)</span>'; ?></th> |
25 | 25 | <?php } ?> |
26 | - <th class="wpinv_cart_item_subtotal text-right"><?php echo __( 'Item Total', 'invoicing' ) . ' <span class="normal small">' . $tax_title . '<span>'; ?></th> |
|
27 | - <?php do_action( 'wpinv_checkout_table_header_last' ); ?> |
|
26 | + <th class="wpinv_cart_item_subtotal text-right"><?php echo __('Item Total', 'invoicing') . ' <span class="normal small">' . $tax_title . '<span>'; ?></th> |
|
27 | + <?php do_action('wpinv_checkout_table_header_last'); ?> |
|
28 | 28 | </tr> |
29 | 29 | </thead> |
30 | 30 | <tbody> |
31 | 31 | <?php |
32 | - do_action( 'wpinv_cart_items_before' ); |
|
32 | + do_action('wpinv_cart_items_before'); |
|
33 | 33 | |
34 | - if ( $cart_items ) { |
|
35 | - foreach ( $cart_items as $key => $item ) { |
|
36 | - $wpi_item = !empty( $item['id'] ) ? new WPInv_Item( $item['id'] ) : NULL; |
|
34 | + if ($cart_items) { |
|
35 | + foreach ($cart_items as $key => $item) { |
|
36 | + $wpi_item = !empty($item['id']) ? new WPInv_Item($item['id']) : NULL; |
|
37 | 37 | ?> |
38 | - <tr class="wpinv_cart_item" id="wpinv_cart_item_<?php echo esc_attr( $key ) . '_' . esc_attr( $item['id'] ); ?>" data-item-id="<?php echo esc_attr( $item['id'] ); ?>"> |
|
39 | - <?php do_action( 'wpinv_checkout_table_body_first', $item ); ?> |
|
38 | + <tr class="wpinv_cart_item" id="wpinv_cart_item_<?php echo esc_attr($key) . '_' . esc_attr($item['id']); ?>" data-item-id="<?php echo esc_attr($item['id']); ?>"> |
|
39 | + <?php do_action('wpinv_checkout_table_body_first', $item); ?> |
|
40 | 40 | <td class="wpinv_cart_item_name text-left"> |
41 | 41 | <?php |
42 | - if ( current_theme_supports( 'post-thumbnails' ) && has_post_thumbnail( $item['id'] ) ) { |
|
42 | + if (current_theme_supports('post-thumbnails') && has_post_thumbnail($item['id'])) { |
|
43 | 43 | echo '<div class="wpinv_cart_item_image">'; |
44 | - echo get_the_post_thumbnail( $item['id'], apply_filters( 'wpinv_checkout_image_size', array( 25,25 ) ) ); |
|
44 | + echo get_the_post_thumbnail($item['id'], apply_filters('wpinv_checkout_image_size', array(25, 25))); |
|
45 | 45 | echo '</div>'; |
46 | 46 | } |
47 | - $item_title = esc_html( wpinv_get_cart_item_name( $item ) ) . wpinv_get_item_suffix( $wpi_item ); |
|
47 | + $item_title = esc_html(wpinv_get_cart_item_name($item)) . wpinv_get_item_suffix($wpi_item); |
|
48 | 48 | echo '<span class="wpinv_checkout_cart_item_title">' . $item_title . '</span>'; |
49 | - $summary = apply_filters( 'wpinv_checkout_cart_line_item_summary', '', $item, $wpi_item, $invoice ); |
|
50 | - if ( !empty( $summary ) ) { |
|
49 | + $summary = apply_filters('wpinv_checkout_cart_line_item_summary', '', $item, $wpi_item, $invoice); |
|
50 | + if (!empty($summary)) { |
|
51 | 51 | echo $summary; |
52 | 52 | } |
53 | 53 | ?> |
54 | 54 | </td> |
55 | 55 | <td class="wpinv_cart_item_price text-right"> |
56 | 56 | <?php |
57 | - echo wpinv_cart_item_price( $item ); |
|
58 | - do_action( 'wpinv_checkout_cart_item_price_after', $item, $key ); |
|
57 | + echo wpinv_cart_item_price($item); |
|
58 | + do_action('wpinv_checkout_cart_item_price_after', $item, $key); |
|
59 | 59 | ?> |
60 | 60 | </td> |
61 | - <?php if ( $quantities_enabled ) { ?> |
|
61 | + <?php if ($quantities_enabled) { ?> |
|
62 | 62 | <td class="wpinv_cart_item_qty text-right"> |
63 | 63 | <?php |
64 | - echo wpinv_get_cart_item_quantity( $item ); |
|
65 | - do_action( 'wpinv_cart_item_quantitiy', $item, $key ); |
|
64 | + echo wpinv_get_cart_item_quantity($item); |
|
65 | + do_action('wpinv_cart_item_quantitiy', $item, $key); |
|
66 | 66 | ?> |
67 | 67 | </td> |
68 | 68 | <?php } ?> |
69 | - <?php if ( $use_taxes ) { ?> |
|
69 | + <?php if ($use_taxes) { ?> |
|
70 | 70 | <td class="wpinv_cart_item_tax text-right"> |
71 | 71 | <?php |
72 | - echo wpinv_cart_item_tax( $item ); |
|
72 | + echo wpinv_cart_item_tax($item); |
|
73 | 73 | //echo wpinv_get_cart_item_tax( $wpi_item->ID, $subtotal = '', $options = array() ); |
74 | - do_action( 'wpinv_cart_item_tax', $item, $key ); |
|
74 | + do_action('wpinv_cart_item_tax', $item, $key); |
|
75 | 75 | ?> |
76 | 76 | </td> |
77 | 77 | <?php } ?> |
78 | 78 | <td class="wpinv_cart_item_subtotal text-right"> |
79 | 79 | <?php |
80 | - echo wpinv_cart_item_subtotal( $item ); |
|
81 | - do_action( 'wpinv_cart_item_subtotal', $item, $key ); |
|
80 | + echo wpinv_cart_item_subtotal($item); |
|
81 | + do_action('wpinv_cart_item_subtotal', $item, $key); |
|
82 | 82 | ?> |
83 | 83 | </td> |
84 | - <?php do_action( 'wpinv_checkout_table_body_last', $item, $key ); ?> |
|
84 | + <?php do_action('wpinv_checkout_table_body_last', $item, $key); ?> |
|
85 | 85 | </tr> |
86 | 86 | <?php } ?> |
87 | 87 | <?php } ?> |
88 | - <?php do_action( 'wpinv_cart_items_middle' ); ?> |
|
89 | - <?php do_action( 'wpinv_cart_items_after' ); ?> |
|
88 | + <?php do_action('wpinv_cart_items_middle'); ?> |
|
89 | + <?php do_action('wpinv_cart_items_after'); ?> |
|
90 | 90 | </tbody> |
91 | 91 | <tfoot> |
92 | 92 | <?php $cart_columns = wpinv_checkout_cart_columns(); ?> |
93 | - <?php if ( has_action( 'wpinv_cart_footer_buttons' ) ) { ?> |
|
93 | + <?php if (has_action('wpinv_cart_footer_buttons')) { ?> |
|
94 | 94 | <tr class="wpinv_cart_footer_row"> |
95 | - <?php do_action( 'wpinv_checkout_table_buttons_first', $cart_items ); ?> |
|
96 | - <td colspan="<?php echo ( $cart_columns ); ?>"> |
|
97 | - <?php do_action( 'wpinv_cart_footer_buttons' ); ?> |
|
95 | + <?php do_action('wpinv_checkout_table_buttons_first', $cart_items); ?> |
|
96 | + <td colspan="<?php echo ($cart_columns); ?>"> |
|
97 | + <?php do_action('wpinv_cart_footer_buttons'); ?> |
|
98 | 98 | </td> |
99 | - <?php do_action( 'wpinv_checkout_table_buttons_first', $cart_items ); ?> |
|
99 | + <?php do_action('wpinv_checkout_table_buttons_first', $cart_items); ?> |
|
100 | 100 | </tr> |
101 | 101 | <?php } ?> |
102 | 102 | |
103 | - <?php if ( $use_taxes && !wpinv_prices_include_tax() ) { ?> |
|
104 | - <tr class="wpinv_cart_footer_row wpinv_cart_subtotal_row"<?php if ( !wpinv_is_cart_taxed() ) echo ' style="display:none;"'; ?>> |
|
105 | - <?php do_action( 'wpinv_checkout_table_subtotal_first', $cart_items ); ?> |
|
106 | - <td colspan="<?php echo ( $cart_columns - 1 ); ?>" class="wpinv_cart_subtotal_label text-right"> |
|
107 | - <strong><?php _e( 'Sub-Total', 'invoicing' ); ?>:</strong> |
|
103 | + <?php if ($use_taxes && !wpinv_prices_include_tax()) { ?> |
|
104 | + <tr class="wpinv_cart_footer_row wpinv_cart_subtotal_row"<?php if (!wpinv_is_cart_taxed()) echo ' style="display:none;"'; ?>> |
|
105 | + <?php do_action('wpinv_checkout_table_subtotal_first', $cart_items); ?> |
|
106 | + <td colspan="<?php echo ($cart_columns - 1); ?>" class="wpinv_cart_subtotal_label text-right"> |
|
107 | + <strong><?php _e('Sub-Total', 'invoicing'); ?>:</strong> |
|
108 | 108 | </td> |
109 | 109 | <td class="wpinv_cart_subtotal text-right"> |
110 | - <span class="wpinv_cart_subtotal_amount bold"><?php echo wpinv_cart_subtotal( $cart_items ); ?></span> |
|
110 | + <span class="wpinv_cart_subtotal_amount bold"><?php echo wpinv_cart_subtotal($cart_items); ?></span> |
|
111 | 111 | </td> |
112 | - <?php do_action( 'wpinv_checkout_table_subtotal_last', $cart_items ); ?> |
|
112 | + <?php do_action('wpinv_checkout_table_subtotal_last', $cart_items); ?> |
|
113 | 113 | </tr> |
114 | 114 | <?php } ?> |
115 | 115 | |
116 | - <?php $wpi_cart_columns = $cart_columns - 1; wpinv_cart_discounts_html( $cart_items ); ?> |
|
116 | + <?php $wpi_cart_columns = $cart_columns - 1; wpinv_cart_discounts_html($cart_items); ?> |
|
117 | 117 | |
118 | - <?php if ( $use_taxes ) { ?> |
|
119 | - <tr class="wpinv_cart_footer_row wpinv_cart_tax_row"<?php if( !wpinv_is_cart_taxed() ) echo ' style="display:none;"'; ?>> |
|
120 | - <?php do_action( 'wpinv_checkout_table_tax_first' ); ?> |
|
121 | - <td colspan="<?php echo ( $cart_columns - 1 ); ?>" class="wpinv_cart_tax_label text-right"> |
|
118 | + <?php if ($use_taxes) { ?> |
|
119 | + <tr class="wpinv_cart_footer_row wpinv_cart_tax_row"<?php if (!wpinv_is_cart_taxed()) echo ' style="display:none;"'; ?>> |
|
120 | + <?php do_action('wpinv_checkout_table_tax_first'); ?> |
|
121 | + <td colspan="<?php echo ($cart_columns - 1); ?>" class="wpinv_cart_tax_label text-right"> |
|
122 | 122 | <strong><?php echo $tax_label; ?>:</strong> |
123 | 123 | </td> |
124 | 124 | <td class="wpinv_cart_tax text-right"> |
125 | - <span class="wpinv_cart_tax_amount" data-tax="<?php echo wpinv_get_cart_tax( $cart_items ); ?>"><?php echo esc_html( wpinv_cart_tax( $cart_items ) ); ?></span> |
|
125 | + <span class="wpinv_cart_tax_amount" data-tax="<?php echo wpinv_get_cart_tax($cart_items); ?>"><?php echo esc_html(wpinv_cart_tax($cart_items)); ?></span> |
|
126 | 126 | </td> |
127 | - <?php do_action( 'wpinv_checkout_table_tax_last' ); ?> |
|
127 | + <?php do_action('wpinv_checkout_table_tax_last'); ?> |
|
128 | 128 | </tr> |
129 | 129 | <?php } ?> |
130 | 130 | |
131 | 131 | <tr class="wpinv_cart_footer_row wpinv_cart_total_row"> |
132 | - <?php do_action( 'wpinv_checkout_table_footer_first' ); ?> |
|
133 | - <td colspan="<?php echo ( $cart_columns - 1 ); ?>" class="wpinv_cart_total_label text-right"> |
|
134 | - <?php echo apply_filters( 'wpinv_cart_total_label', '<strong>' . __( 'Total', 'invoicing' ) . ':</strong>', $invoice ); ?> |
|
132 | + <?php do_action('wpinv_checkout_table_footer_first'); ?> |
|
133 | + <td colspan="<?php echo ($cart_columns - 1); ?>" class="wpinv_cart_total_label text-right"> |
|
134 | + <?php echo apply_filters('wpinv_cart_total_label', '<strong>' . __('Total', 'invoicing') . ':</strong>', $invoice); ?> |
|
135 | 135 | </td> |
136 | 136 | <td class="wpinv_cart_total text-right"> |
137 | - <span class="wpinv_cart_amount bold" data-subtotal="<?php echo wpinv_get_cart_total( $cart_items ); ?>" data-total="<?php echo wpinv_get_cart_total( NULL, NULL, $invoice ); ?>"><?php wpinv_cart_total( $cart_items, true, $invoice ); ?></span> |
|
137 | + <span class="wpinv_cart_amount bold" data-subtotal="<?php echo wpinv_get_cart_total($cart_items); ?>" data-total="<?php echo wpinv_get_cart_total(NULL, NULL, $invoice); ?>"><?php wpinv_cart_total($cart_items, true, $invoice); ?></span> |
|
138 | 138 | </td> |
139 | - <?php do_action( 'wpinv_checkout_table_footer_last' ); ?> |
|
139 | + <?php do_action('wpinv_checkout_table_footer_last'); ?> |
|
140 | 140 | </tr> |
141 | 141 | </tfoot> |
142 | 142 | </table> |
@@ -9,58 +9,58 @@ |
||
9 | 9 | */ |
10 | 10 | |
11 | 11 | // If uninstall not called from WordPress, then exit. |
12 | -if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { |
|
12 | +if (!defined('WP_UNINSTALL_PLUGIN')) { |
|
13 | 13 | exit; |
14 | 14 | } |
15 | 15 | |
16 | 16 | global $wpdb, $wp_version; |
17 | 17 | |
18 | -$remove_data = get_option( 'wpinv_remove_data_on_invoice_unistall' ); |
|
18 | +$remove_data = get_option('wpinv_remove_data_on_invoice_unistall'); |
|
19 | 19 | |
20 | 20 | /* |
21 | 21 | * Only remove ALL product and page data if WPINV_REMOVE_ALL_DATA constant is set to true in user's |
22 | 22 | * wp-config.php. This is to prevent data loss when deleting the plugin from the backend |
23 | 23 | * and to ensure only the site owner can perform this action. |
24 | 24 | */ |
25 | -if ( defined( 'WPINV_REMOVE_ALL_DATA' ) ) { |
|
25 | +if (defined('WPINV_REMOVE_ALL_DATA')) { |
|
26 | 26 | $remove_data = true === WPINV_REMOVE_ALL_DATA ? true : false; |
27 | 27 | } |
28 | 28 | |
29 | -if ( $remove_data ) { |
|
29 | +if ($remove_data) { |
|
30 | 30 | // Load Invoicing file. |
31 | - include_once( 'invoicing.php' ); |
|
31 | + include_once('invoicing.php'); |
|
32 | 32 | |
33 | 33 | // Roles + caps. |
34 | - include_once( dirname( __FILE__ ) . '/includes/admin/install.php' ); |
|
34 | + include_once(dirname(__FILE__) . '/includes/admin/install.php'); |
|
35 | 35 | wpinv_remove_admin_caps(); |
36 | 36 | |
37 | - $settings = get_option( 'wpinv_settings' ); |
|
37 | + $settings = get_option('wpinv_settings'); |
|
38 | 38 | |
39 | 39 | // Delete pages. |
40 | - $wpi_pages = array( 'checkout_page', 'success_page', 'failure_page', 'invoice_history_page', 'quote_history_page', 'invoice_subscription_page' ); |
|
41 | - foreach ( $wpi_pages as $page ) { |
|
42 | - if ( !empty( $page ) && !empty( $settings[ $page ] ) ) { |
|
43 | - wp_delete_post( $settings[ $page ], true ); |
|
40 | + $wpi_pages = array('checkout_page', 'success_page', 'failure_page', 'invoice_history_page', 'quote_history_page', 'invoice_subscription_page'); |
|
41 | + foreach ($wpi_pages as $page) { |
|
42 | + if (!empty($page) && !empty($settings[$page])) { |
|
43 | + wp_delete_post($settings[$page], true); |
|
44 | 44 | } |
45 | 45 | } |
46 | 46 | |
47 | 47 | // Delete posts + data. |
48 | - $wpdb->query( "DELETE FROM {$wpdb->posts} WHERE post_type IN ( 'wpi_invoice', 'wpi_item', 'wpi_discount', 'wpi_quote' );" ); |
|
49 | - $wpdb->query( "DELETE meta FROM {$wpdb->postmeta} meta LEFT JOIN {$wpdb->posts} posts ON posts.ID = meta.post_id WHERE posts.ID IS NULL;" ); |
|
48 | + $wpdb->query("DELETE FROM {$wpdb->posts} WHERE post_type IN ( 'wpi_invoice', 'wpi_item', 'wpi_discount', 'wpi_quote' );"); |
|
49 | + $wpdb->query("DELETE meta FROM {$wpdb->postmeta} meta LEFT JOIN {$wpdb->posts} posts ON posts.ID = meta.post_id WHERE posts.ID IS NULL;"); |
|
50 | 50 | |
51 | 51 | // Delete comments. |
52 | - $wpdb->query( "DELETE FROM {$wpdb->comments} WHERE comment_type LIKE 'wpinv_note';" ); |
|
53 | - $wpdb->query( "DELETE meta FROM {$wpdb->commentmeta} meta LEFT JOIN {$wpdb->comments} comments ON comments.comment_ID = meta.comment_id WHERE comments.comment_ID IS NULL;" ); |
|
52 | + $wpdb->query("DELETE FROM {$wpdb->comments} WHERE comment_type LIKE 'wpinv_note';"); |
|
53 | + $wpdb->query("DELETE meta FROM {$wpdb->commentmeta} meta LEFT JOIN {$wpdb->comments} comments ON comments.comment_ID = meta.comment_id WHERE comments.comment_ID IS NULL;"); |
|
54 | 54 | |
55 | 55 | // Delete user meta. |
56 | - $wpdb->query( "DELETE FROM {$wpdb->usermeta} WHERE meta_key LIKE '%_wpinv_%' OR meta_key LIKE '%_wpi_invoice%' OR meta_key LIKE '%_wpi_item%' OR meta_key LIKE '%_wpi_discount%' OR meta_key LIKE '_wpi_stripe%' OR meta_key LIKE '%_wpi_quote%';" ); |
|
56 | + $wpdb->query("DELETE FROM {$wpdb->usermeta} WHERE meta_key LIKE '%_wpinv_%' OR meta_key LIKE '%_wpi_invoice%' OR meta_key LIKE '%_wpi_item%' OR meta_key LIKE '%_wpi_discount%' OR meta_key LIKE '_wpi_stripe%' OR meta_key LIKE '%_wpi_quote%';"); |
|
57 | 57 | |
58 | 58 | // Cleanup Cron Schedule |
59 | - wp_clear_scheduled_hook( 'wp_session_garbage_collection' ); |
|
60 | - wp_clear_scheduled_hook( 'wpinv_register_schedule_event_twicedaily' ); |
|
59 | + wp_clear_scheduled_hook('wp_session_garbage_collection'); |
|
60 | + wp_clear_scheduled_hook('wpinv_register_schedule_event_twicedaily'); |
|
61 | 61 | |
62 | 62 | // Delete options. |
63 | - $wpdb->query( "DELETE FROM {$wpdb->options} WHERE option_name LIKE 'wpinv_%' OR option_name LIKE '_wpinv_%' OR option_name LIKE '\_transient\_wpinv\_%';" ); |
|
63 | + $wpdb->query("DELETE FROM {$wpdb->options} WHERE option_name LIKE 'wpinv_%' OR option_name LIKE '_wpinv_%' OR option_name LIKE '\_transient\_wpinv\_%';"); |
|
64 | 64 | |
65 | 65 | // Clear any cached data that has been removed |
66 | 66 | wp_cache_flush(); |
@@ -1,68 +1,68 @@ |
||
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 | global $wpinv_euvat; |
7 | 7 | |
8 | -$sent_to_admin = !empty( $sent_to_admin ) ? true : false; |
|
9 | -$invoice_url = $invoice->get_view_url( true ); |
|
8 | +$sent_to_admin = !empty($sent_to_admin) ? true : false; |
|
9 | +$invoice_url = $invoice->get_view_url(true); |
|
10 | 10 | $use_taxes = wpinv_use_taxes(); |
11 | 11 | $vat_name = $wpinv_euvat->get_vat_name(); |
12 | 12 | |
13 | -do_action( 'wpinv_email_before_invoice_details', $invoice, $sent_to_admin ); ?> |
|
13 | +do_action('wpinv_email_before_invoice_details', $invoice, $sent_to_admin); ?> |
|
14 | 14 | <div id="wpinv-email-details"> |
15 | - <h3 class="wpinv-details-t"><?php echo apply_filters( 'wpinv_email_details_title', __( 'Invoice Details', 'invoicing' ), $invoice ); ?></h3> |
|
15 | + <h3 class="wpinv-details-t"><?php echo apply_filters('wpinv_email_details_title', __('Invoice Details', 'invoicing'), $invoice); ?></h3> |
|
16 | 16 | <table class="table table-bordered table-sm"> |
17 | - <?php if ( $invoice_number = $invoice->get_number() ) { ?> |
|
17 | + <?php if ($invoice_number = $invoice->get_number()) { ?> |
|
18 | 18 | <tr> |
19 | - <td><?php echo apply_filters( 'wpinv_invoice_number_label', __( 'Invoice Number', 'invoicing' ), $invoice ); ?></td> |
|
20 | - <td><a href="<?php echo esc_url( $invoice_url ) ;?>"><?php echo $invoice_number; ?></a></td> |
|
19 | + <td><?php echo apply_filters('wpinv_invoice_number_label', __('Invoice Number', 'invoicing'), $invoice); ?></td> |
|
20 | + <td><a href="<?php echo esc_url($invoice_url); ?>"><?php echo $invoice_number; ?></a></td> |
|
21 | 21 | </tr> |
22 | 22 | <?php } ?> |
23 | 23 | <tr> |
24 | - <td><?php echo apply_filters( 'wpinv_invoice_status_label', __( 'Invoice Status', 'invoicing' ), $invoice ); ?></td> |
|
25 | - <td><?php echo $invoice->get_status( true ); ?></td> |
|
24 | + <td><?php echo apply_filters('wpinv_invoice_status_label', __('Invoice Status', 'invoicing'), $invoice); ?></td> |
|
25 | + <td><?php echo $invoice->get_status(true); ?></td> |
|
26 | 26 | </tr> |
27 | - <?php if ( $invoice->is_renewal() ) { ?> |
|
27 | + <?php if ($invoice->is_renewal()) { ?> |
|
28 | 28 | <tr> |
29 | - <td><?php echo apply_filters( 'wpinv_invoice_parent_invoice_label', __( 'Parent Invoice', 'invoicing' ), $invoice ); ?></td> |
|
30 | - <td><?php echo wpinv_invoice_link( $invoice->parent_invoice ); ?></td> |
|
29 | + <td><?php echo apply_filters('wpinv_invoice_parent_invoice_label', __('Parent Invoice', 'invoicing'), $invoice); ?></td> |
|
30 | + <td><?php echo wpinv_invoice_link($invoice->parent_invoice); ?></td> |
|
31 | 31 | </tr> |
32 | 32 | <?php } ?> |
33 | - <?php if ( ( $gateway_title = $invoice->get_gateway_title() ) && ( $invoice->is_paid() || $invoice->is_refunded() ) ) { ?> |
|
34 | - <td><?php echo apply_filters( 'wpinv_invoice_payment_method_label', __( 'Payment Method', 'invoicing' ), $invoice ); ?></td> |
|
33 | + <?php if (($gateway_title = $invoice->get_gateway_title()) && ($invoice->is_paid() || $invoice->is_refunded())) { ?> |
|
34 | + <td><?php echo apply_filters('wpinv_invoice_payment_method_label', __('Payment Method', 'invoicing'), $invoice); ?></td> |
|
35 | 35 | <td><?php echo $gateway_title; ?></td> |
36 | 36 | <?php } ?> |
37 | - <?php if ( $invoice_date = $invoice->get_invoice_date( false ) ) { ?> |
|
37 | + <?php if ($invoice_date = $invoice->get_invoice_date(false)) { ?> |
|
38 | 38 | <tr> |
39 | - <td><?php echo apply_filters( 'wpinv_invoice_date_label', __( 'Invoice Date', 'invoicing' ), $invoice ); ?></td> |
|
40 | - <td><?php echo wp_sprintf( '<time datetime="%s">%s</time>', date_i18n( 'c', strtotime( $invoice_date ) ), $invoice->get_invoice_date() ); ?></td> |
|
39 | + <td><?php echo apply_filters('wpinv_invoice_date_label', __('Invoice Date', 'invoicing'), $invoice); ?></td> |
|
40 | + <td><?php echo wp_sprintf('<time datetime="%s">%s</time>', date_i18n('c', strtotime($invoice_date)), $invoice->get_invoice_date()); ?></td> |
|
41 | 41 | </tr> |
42 | 42 | <?php } ?> |
43 | - <?php if ( wpinv_get_option( 'overdue_active' ) && $invoice->needs_payment() && ( $due_date = $invoice->get_due_date() ) ) { ?> |
|
43 | + <?php if (wpinv_get_option('overdue_active') && $invoice->needs_payment() && ($due_date = $invoice->get_due_date())) { ?> |
|
44 | 44 | <tr> |
45 | - <td><?php echo apply_filters( 'wpinv_invoice_due_date_label', __( 'Due Date', 'invoicing' ), $invoice ); ?></td> |
|
46 | - <td><?php echo wp_sprintf( '<time datetime="%s">%s</time>', date_i18n( 'c', strtotime( $due_date ) ), $invoice->get_due_date( true ) ); ?></td> |
|
45 | + <td><?php echo apply_filters('wpinv_invoice_due_date_label', __('Due Date', 'invoicing'), $invoice); ?></td> |
|
46 | + <td><?php echo wp_sprintf('<time datetime="%s">%s</time>', date_i18n('c', strtotime($due_date)), $invoice->get_due_date(true)); ?></td> |
|
47 | 47 | </tr> |
48 | 48 | <?php } ?> |
49 | - <?php do_action( 'wpinv_email_invoice_details_after_due_date', $invoice->ID ); ?> |
|
50 | - <?php if ( empty( $sent_to_admin ) && ( $owner_vat_number = $wpinv_euvat->get_vat_number() ) ) { ?> |
|
49 | + <?php do_action('wpinv_email_invoice_details_after_due_date', $invoice->ID); ?> |
|
50 | + <?php if (empty($sent_to_admin) && ($owner_vat_number = $wpinv_euvat->get_vat_number())) { ?> |
|
51 | 51 | <tr> |
52 | - <td><?php echo apply_filters( 'wpinv_invoice_owner_vat_number_label', wp_sprintf( __( 'Owner %s Number', 'invoicing' ), $vat_name ), $invoice, $vat_name ); ?></td> |
|
52 | + <td><?php echo apply_filters('wpinv_invoice_owner_vat_number_label', wp_sprintf(__('Owner %s Number', 'invoicing'), $vat_name), $invoice, $vat_name); ?></td> |
|
53 | 53 | <td><?php echo $owner_vat_number; ?></td> |
54 | 54 | </tr> |
55 | 55 | <?php } ?> |
56 | - <?php if ( $use_taxes && ( $user_vat_number = $invoice->vat_number ) ) { ?> |
|
56 | + <?php if ($use_taxes && ($user_vat_number = $invoice->vat_number)) { ?> |
|
57 | 57 | <tr> |
58 | - <td><?php echo apply_filters( 'wpinv_invoice_user_vat_number_label', wp_sprintf( __( 'Invoice %s Number', 'invoicing' ), $vat_name ), $invoice, $vat_name ); ?></td> |
|
58 | + <td><?php echo apply_filters('wpinv_invoice_user_vat_number_label', wp_sprintf(__('Invoice %s Number', 'invoicing'), $vat_name), $invoice, $vat_name); ?></td> |
|
59 | 59 | <td><?php echo $user_vat_number; ?></td> |
60 | 60 | </tr> |
61 | 61 | <?php } ?> |
62 | 62 | <tr class="table-active"> |
63 | - <td><strong><?php _e( 'Total Amount', 'invoicing' ) ?></strong></td> |
|
64 | - <td><strong><?php echo $invoice->get_total( true ); ?></strong></td> |
|
63 | + <td><strong><?php _e('Total Amount', 'invoicing') ?></strong></td> |
|
64 | + <td><strong><?php echo $invoice->get_total(true); ?></strong></td> |
|
65 | 65 | </tr> |
66 | 66 | </table> |
67 | 67 | </div> |
68 | -<?php do_action( 'wpinv_email_after_invoice_details', $invoice, $sent_to_admin ); ?> |
|
69 | 68 | \ No newline at end of file |
69 | +<?php do_action('wpinv_email_after_invoice_details', $invoice, $sent_to_admin); ?> |
|
70 | 70 | \ No newline at end of file |
@@ -1,156 +1,156 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -function wpinv_is_subscription_payment( $invoice = '' ) { |
|
4 | - if ( empty( $invoice ) ) { |
|
3 | +function wpinv_is_subscription_payment($invoice = '') { |
|
4 | + if (empty($invoice)) { |
|
5 | 5 | return false; |
6 | 6 | } |
7 | 7 | |
8 | - if ( !is_object( $invoice ) && is_scalar( $invoice ) ) { |
|
9 | - $invoice = wpinv_get_invoice( $invoice ); |
|
8 | + if (!is_object($invoice) && is_scalar($invoice)) { |
|
9 | + $invoice = wpinv_get_invoice($invoice); |
|
10 | 10 | } |
11 | 11 | |
12 | - if ( empty( $invoice ) ) { |
|
12 | + if (empty($invoice)) { |
|
13 | 13 | return false; |
14 | 14 | } |
15 | 15 | |
16 | - if ( $invoice->is_renewal() ) { |
|
16 | + if ($invoice->is_renewal()) { |
|
17 | 17 | return true; |
18 | 18 | } |
19 | 19 | |
20 | 20 | return false; |
21 | 21 | } |
22 | 22 | |
23 | -function wpinv_payment_link_transaction_id( $invoice = '' ) { |
|
24 | - if ( empty( $invoice ) ) { |
|
23 | +function wpinv_payment_link_transaction_id($invoice = '') { |
|
24 | + if (empty($invoice)) { |
|
25 | 25 | return false; |
26 | 26 | } |
27 | 27 | |
28 | - if ( !is_object( $invoice ) && is_scalar( $invoice ) ) { |
|
29 | - $invoice = wpinv_get_invoice( $invoice ); |
|
28 | + if (!is_object($invoice) && is_scalar($invoice)) { |
|
29 | + $invoice = wpinv_get_invoice($invoice); |
|
30 | 30 | } |
31 | 31 | |
32 | - if ( empty( $invoice ) ) { |
|
32 | + if (empty($invoice)) { |
|
33 | 33 | return false; |
34 | 34 | } |
35 | 35 | |
36 | - return apply_filters( 'wpinv_payment_details_transaction_id-' . $invoice->gateway, $invoice->get_transaction_id(), $invoice->ID, $invoice ); |
|
36 | + return apply_filters('wpinv_payment_details_transaction_id-' . $invoice->gateway, $invoice->get_transaction_id(), $invoice->ID, $invoice); |
|
37 | 37 | } |
38 | 38 | |
39 | -function wpinv_subscription_initial_payment_desc( $amount, $period, $interval, $trial_period = '', $trial_interval = 0 ) { |
|
39 | +function wpinv_subscription_initial_payment_desc($amount, $period, $interval, $trial_period = '', $trial_interval = 0) { |
|
40 | 40 | $interval = (int)$interval > 0 ? (int)$interval : 1; |
41 | 41 | |
42 | - if ( $trial_interval > 0 && !empty( $trial_period ) ) { |
|
43 | - $amount = __( 'Free', 'invoicing' ); |
|
42 | + if ($trial_interval > 0 && !empty($trial_period)) { |
|
43 | + $amount = __('Free', 'invoicing'); |
|
44 | 44 | $interval = $trial_interval; |
45 | 45 | $period = $trial_period; |
46 | 46 | } |
47 | 47 | |
48 | 48 | $description = ''; |
49 | - switch ( $period ) { |
|
49 | + switch ($period) { |
|
50 | 50 | case 'D' : |
51 | 51 | case 'day' : |
52 | - $description = wp_sprintf( _n( '%s for the first day.', '%s for the first %d days.', $interval, 'invoicing' ), $amount, $interval ); |
|
52 | + $description = wp_sprintf(_n('%s for the first day.', '%s for the first %d days.', $interval, 'invoicing'), $amount, $interval); |
|
53 | 53 | break; |
54 | 54 | case 'W' : |
55 | 55 | case 'week' : |
56 | - $description = wp_sprintf( _n( '%s for the first week.', '%s for the first %d weeks.', $interval, 'invoicing' ), $amount, $interval ); |
|
56 | + $description = wp_sprintf(_n('%s for the first week.', '%s for the first %d weeks.', $interval, 'invoicing'), $amount, $interval); |
|
57 | 57 | break; |
58 | 58 | case 'M' : |
59 | 59 | case 'month' : |
60 | - $description = wp_sprintf( _n( '%s for the first month.', '%s for the first %d months.', $interval, 'invoicing' ), $amount, $interval ); |
|
60 | + $description = wp_sprintf(_n('%s for the first month.', '%s for the first %d months.', $interval, 'invoicing'), $amount, $interval); |
|
61 | 61 | break; |
62 | 62 | case 'Y' : |
63 | 63 | case 'year' : |
64 | - $description = wp_sprintf( _n( '%s for the first year.', '%s for the first %d years.', $interval, 'invoicing' ), $amount, $interval ); |
|
64 | + $description = wp_sprintf(_n('%s for the first year.', '%s for the first %d years.', $interval, 'invoicing'), $amount, $interval); |
|
65 | 65 | break; |
66 | 66 | } |
67 | 67 | |
68 | - return apply_filters( 'wpinv_subscription_initial_payment_desc', $description, $amount, $period, $interval, $trial_period, $trial_interval ); |
|
68 | + return apply_filters('wpinv_subscription_initial_payment_desc', $description, $amount, $period, $interval, $trial_period, $trial_interval); |
|
69 | 69 | } |
70 | 70 | |
71 | -function wpinv_subscription_recurring_payment_desc( $amount, $period, $interval, $bill_times = 0, $trial_period = '', $trial_interval = 0 ) { |
|
71 | +function wpinv_subscription_recurring_payment_desc($amount, $period, $interval, $bill_times = 0, $trial_period = '', $trial_interval = 0) { |
|
72 | 72 | $interval = (int)$interval > 0 ? (int)$interval : 1; |
73 | 73 | $bill_times = (int)$bill_times > 0 ? (int)$bill_times : 0; |
74 | 74 | |
75 | 75 | $description = ''; |
76 | - switch ( $period ) { |
|
76 | + switch ($period) { |
|
77 | 77 | case 'D' : |
78 | 78 | case 'day' : |
79 | - if ( (int)$bill_times > 0 ) { |
|
80 | - if ( $interval > 1 ) { |
|
81 | - if ( $bill_times > 1 ) { |
|
82 | - $description = wp_sprintf( __( '%s for each %d days, for %d installments.', 'invoicing' ), $amount, $interval, $bill_times ); |
|
79 | + if ((int)$bill_times > 0) { |
|
80 | + if ($interval > 1) { |
|
81 | + if ($bill_times > 1) { |
|
82 | + $description = wp_sprintf(__('%s for each %d days, for %d installments.', 'invoicing'), $amount, $interval, $bill_times); |
|
83 | 83 | } else { |
84 | - $description = wp_sprintf( __( '%s for %d days.', 'invoicing' ), $amount, $interval ); |
|
84 | + $description = wp_sprintf(__('%s for %d days.', 'invoicing'), $amount, $interval); |
|
85 | 85 | } |
86 | 86 | } else { |
87 | - $description = wp_sprintf( _n( '%s for one day.', '%s for each day, for %d installments.', $bill_times, 'invoicing' ), $amount, $bill_times ); |
|
87 | + $description = wp_sprintf(_n('%s for one day.', '%s for each day, for %d installments.', $bill_times, 'invoicing'), $amount, $bill_times); |
|
88 | 88 | } |
89 | 89 | } else { |
90 | - $description = wp_sprintf( _n( '%s for each day.', '%s for each %d days.', $interval, 'invoicing'), $amount, $interval ); |
|
90 | + $description = wp_sprintf(_n('%s for each day.', '%s for each %d days.', $interval, 'invoicing'), $amount, $interval); |
|
91 | 91 | } |
92 | 92 | break; |
93 | 93 | case 'W' : |
94 | 94 | case 'week' : |
95 | - if ( (int)$bill_times > 0 ) { |
|
96 | - if ( $interval > 1 ) { |
|
97 | - if ( $bill_times > 1 ) { |
|
98 | - $description = wp_sprintf( __( '%s for each %d weeks, for %d installments.', 'invoicing' ), $amount, $interval, $bill_times ); |
|
95 | + if ((int)$bill_times > 0) { |
|
96 | + if ($interval > 1) { |
|
97 | + if ($bill_times > 1) { |
|
98 | + $description = wp_sprintf(__('%s for each %d weeks, for %d installments.', 'invoicing'), $amount, $interval, $bill_times); |
|
99 | 99 | } else { |
100 | - $description = wp_sprintf( __( '%s for %d weeks.', 'invoicing' ), $amount, $interval ); |
|
100 | + $description = wp_sprintf(__('%s for %d weeks.', 'invoicing'), $amount, $interval); |
|
101 | 101 | } |
102 | 102 | } else { |
103 | - $description = wp_sprintf( _n( '%s for one week.', '%s for each week, for %d installments.', $bill_times, 'invoicing' ), $amount, $bill_times ); |
|
103 | + $description = wp_sprintf(_n('%s for one week.', '%s for each week, for %d installments.', $bill_times, 'invoicing'), $amount, $bill_times); |
|
104 | 104 | } |
105 | 105 | } else { |
106 | - $description = wp_sprintf( _n( '%s for each week.', '%s for each %d weeks.', $interval, 'invoicing' ), $amount, $interval ); |
|
106 | + $description = wp_sprintf(_n('%s for each week.', '%s for each %d weeks.', $interval, 'invoicing'), $amount, $interval); |
|
107 | 107 | } |
108 | 108 | break; |
109 | 109 | case 'M' : |
110 | 110 | case 'month' : |
111 | - if ( (int)$bill_times > 0 ) { |
|
112 | - if ( $interval > 1 ) { |
|
113 | - if ( $bill_times > 1 ) { |
|
114 | - $description = wp_sprintf( __( '%s for each %d months, for %d installments.', 'invoicing' ), $amount, $interval, $bill_times ); |
|
111 | + if ((int)$bill_times > 0) { |
|
112 | + if ($interval > 1) { |
|
113 | + if ($bill_times > 1) { |
|
114 | + $description = wp_sprintf(__('%s for each %d months, for %d installments.', 'invoicing'), $amount, $interval, $bill_times); |
|
115 | 115 | } else { |
116 | - $description = wp_sprintf( __( '%s for %d months.', 'invoicing' ), $amount, $interval ); |
|
116 | + $description = wp_sprintf(__('%s for %d months.', 'invoicing'), $amount, $interval); |
|
117 | 117 | } |
118 | 118 | } else { |
119 | - $description = wp_sprintf( _n( '%s for one month.', '%s for each month, for %d installments.', $bill_times, 'invoicing' ), $amount, $bill_times ); |
|
119 | + $description = wp_sprintf(_n('%s for one month.', '%s for each month, for %d installments.', $bill_times, 'invoicing'), $amount, $bill_times); |
|
120 | 120 | } |
121 | 121 | } else { |
122 | - $description = wp_sprintf( _n( '%s for each month.', '%s for each %d months.', $interval, 'invoicing' ), $amount, $interval ); |
|
122 | + $description = wp_sprintf(_n('%s for each month.', '%s for each %d months.', $interval, 'invoicing'), $amount, $interval); |
|
123 | 123 | } |
124 | 124 | break; |
125 | 125 | case 'Y' : |
126 | 126 | case 'year' : |
127 | - if ( (int)$bill_times > 0 ) { |
|
128 | - if ( $interval > 1 ) { |
|
129 | - if ( $bill_times > 1 ) { |
|
130 | - $description = wp_sprintf( __( '%s for each %d years, for %d installments.', 'invoicing' ), $amount, $interval, $bill_times ); |
|
127 | + if ((int)$bill_times > 0) { |
|
128 | + if ($interval > 1) { |
|
129 | + if ($bill_times > 1) { |
|
130 | + $description = wp_sprintf(__('%s for each %d years, for %d installments.', 'invoicing'), $amount, $interval, $bill_times); |
|
131 | 131 | } else { |
132 | - $description = wp_sprintf( __( '%s for %d years.', 'invoicing'), $amount, $interval ); |
|
132 | + $description = wp_sprintf(__('%s for %d years.', 'invoicing'), $amount, $interval); |
|
133 | 133 | } |
134 | 134 | } else { |
135 | - $description = wp_sprintf( _n( '%s for one year.', '%s for each year, for %d installments.', $bill_times, 'invoicing' ), $amount, $bill_times ); |
|
135 | + $description = wp_sprintf(_n('%s for one year.', '%s for each year, for %d installments.', $bill_times, 'invoicing'), $amount, $bill_times); |
|
136 | 136 | } |
137 | 137 | } else { |
138 | - $description = wp_sprintf( _n( '%s for each year.', '%s for each %d years.', $interval, 'invoicing' ), $amount, $interval ); |
|
138 | + $description = wp_sprintf(_n('%s for each year.', '%s for each %d years.', $interval, 'invoicing'), $amount, $interval); |
|
139 | 139 | } |
140 | 140 | break; |
141 | 141 | } |
142 | 142 | |
143 | - return apply_filters( 'wpinv_subscription_recurring_payment_desc', $description, $amount, $period, $interval, $bill_times, $trial_period, $trial_interval ); |
|
143 | + return apply_filters('wpinv_subscription_recurring_payment_desc', $description, $amount, $period, $interval, $bill_times, $trial_period, $trial_interval); |
|
144 | 144 | } |
145 | 145 | |
146 | -function wpinv_subscription_payment_desc( $invoice ) { |
|
147 | - if ( empty( $invoice ) ) { |
|
146 | +function wpinv_subscription_payment_desc($invoice) { |
|
147 | + if (empty($invoice)) { |
|
148 | 148 | return NULL; |
149 | 149 | } |
150 | 150 | |
151 | 151 | $description = ''; |
152 | - if ( $invoice->is_parent() && $item = $invoice->get_recurring( true ) ) { |
|
153 | - if ( $item->has_free_trial() ) { |
|
152 | + if ($invoice->is_parent() && $item = $invoice->get_recurring(true)) { |
|
153 | + if ($item->has_free_trial()) { |
|
154 | 154 | $trial_period = $item->get_trial_period(); |
155 | 155 | $trial_interval = $item->get_trial_interval(); |
156 | 156 | } else { |
@@ -158,45 +158,45 @@ discard block |
||
158 | 158 | $trial_interval = 0; |
159 | 159 | } |
160 | 160 | |
161 | - $description = wpinv_get_billing_cycle( $invoice->get_total(), $invoice->get_recurring_details( 'total' ), $item->get_recurring_period(), $item->get_recurring_interval(), $item->get_recurring_limit(), $trial_period, $trial_interval, $invoice->get_currency() ); |
|
161 | + $description = wpinv_get_billing_cycle($invoice->get_total(), $invoice->get_recurring_details('total'), $item->get_recurring_period(), $item->get_recurring_interval(), $item->get_recurring_limit(), $trial_period, $trial_interval, $invoice->get_currency()); |
|
162 | 162 | } |
163 | 163 | |
164 | - return apply_filters( 'wpinv_subscription_payment_desc', $description, $invoice ); |
|
164 | + return apply_filters('wpinv_subscription_payment_desc', $description, $invoice); |
|
165 | 165 | } |
166 | 166 | |
167 | -function wpinv_get_billing_cycle( $initial, $recurring, $period, $interval, $bill_times, $trial_period = '', $trial_interval = 0, $currency = '' ) { |
|
168 | - $initial_total = wpinv_round_amount( $initial ); |
|
169 | - $recurring_total = wpinv_round_amount( $recurring ); |
|
167 | +function wpinv_get_billing_cycle($initial, $recurring, $period, $interval, $bill_times, $trial_period = '', $trial_interval = 0, $currency = '') { |
|
168 | + $initial_total = wpinv_round_amount($initial); |
|
169 | + $recurring_total = wpinv_round_amount($recurring); |
|
170 | 170 | |
171 | - if ( $trial_interval > 0 && !empty( $trial_period ) ) { |
|
171 | + if ($trial_interval > 0 && !empty($trial_period)) { |
|
172 | 172 | // Free trial |
173 | 173 | } else { |
174 | - if ( $bill_times == 1 ) { |
|
174 | + if ($bill_times == 1) { |
|
175 | 175 | $recurring_total = $initial_total; |
176 | - } else if ( $bill_times > 1 && $initial_total != $recurring_total ) { |
|
176 | + } else if ($bill_times > 1 && $initial_total != $recurring_total) { |
|
177 | 177 | $bill_times--; |
178 | 178 | } |
179 | 179 | } |
180 | 180 | |
181 | - $initial_amount = wpinv_price( wpinv_format_amount( $initial_total ), $currency ); |
|
182 | - $recurring_amount = wpinv_price( wpinv_format_amount( $recurring_total ), $currency ); |
|
181 | + $initial_amount = wpinv_price(wpinv_format_amount($initial_total), $currency); |
|
182 | + $recurring_amount = wpinv_price(wpinv_format_amount($recurring_total), $currency); |
|
183 | 183 | |
184 | - $recurring = wpinv_subscription_recurring_payment_desc( $recurring_amount, $period, $interval, $bill_times, $trial_period, $trial_interval ); |
|
184 | + $recurring = wpinv_subscription_recurring_payment_desc($recurring_amount, $period, $interval, $bill_times, $trial_period, $trial_interval); |
|
185 | 185 | |
186 | - if ( $initial_total != $recurring_total ) { |
|
187 | - $initial = wpinv_subscription_initial_payment_desc( $initial_amount, $period, $interval, $trial_period, $trial_interval ); |
|
186 | + if ($initial_total != $recurring_total) { |
|
187 | + $initial = wpinv_subscription_initial_payment_desc($initial_amount, $period, $interval, $trial_period, $trial_interval); |
|
188 | 188 | |
189 | - $description = wp_sprintf( __( '%s Then %s', 'invoicing' ), $initial, $recurring ); |
|
189 | + $description = wp_sprintf(__('%s Then %s', 'invoicing'), $initial, $recurring); |
|
190 | 190 | } else { |
191 | 191 | $description = $recurring; |
192 | 192 | } |
193 | 193 | |
194 | - return apply_filters( 'wpinv_get_billing_cycle', $description, $initial, $recurring, $period, $interval, $bill_times, $trial_period, $trial_interval, $currency ); |
|
194 | + return apply_filters('wpinv_get_billing_cycle', $description, $initial, $recurring, $period, $interval, $bill_times, $trial_period, $trial_interval, $currency); |
|
195 | 195 | } |
196 | 196 | |
197 | -function wpinv_recurring_send_payment_failed( $invoice ) { |
|
198 | - if ( !empty( $invoice->ID ) ) { |
|
199 | - wpinv_failed_invoice_notification( $invoice->ID ); |
|
197 | +function wpinv_recurring_send_payment_failed($invoice) { |
|
198 | + if (!empty($invoice->ID)) { |
|
199 | + wpinv_failed_invoice_notification($invoice->ID); |
|
200 | 200 | } |
201 | 201 | } |
202 | -add_action( 'wpinv_recurring_payment_failed', 'wpinv_recurring_send_payment_failed', 10, 1 ); |
|
203 | 202 | \ No newline at end of file |
203 | +add_action('wpinv_recurring_payment_failed', 'wpinv_recurring_send_payment_failed', 10, 1); |
|
204 | 204 | \ No newline at end of file |
@@ -1,22 +1,22 @@ discard block |
||
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 |
||
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 |
||
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 | - $r['selected'] = (int) $r['selected']; |
|
79 | - foreach ( (array) $users as $user ) { |
|
80 | - $user->ID = (int) $user->ID; |
|
81 | - if ( $user->ID === $r['selected'] ) { |
|
78 | + $r['selected'] = (int)$r['selected']; |
|
79 | + foreach ((array)$users as $user) { |
|
80 | + $user->ID = (int)$user->ID; |
|
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 | } |
@@ -1,18 +1,18 @@ |
||
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 |
@@ -1,22 +1,22 @@ |
||
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 | -do_action( 'wpinv_email_before_note_details', $invoice, $email_type, $sent_to_admin, $customer_note ); |
|
8 | +do_action('wpinv_email_before_note_details', $invoice, $email_type, $sent_to_admin, $customer_note); |
|
9 | 9 | |
10 | -if ( ! empty( $message_body ) ) { |
|
11 | - echo wpautop( wptexturize( $message_body ) ); |
|
10 | +if (!empty($message_body)) { |
|
11 | + echo wpautop(wptexturize($message_body)); |
|
12 | 12 | } |
13 | 13 | |
14 | -do_action( 'wpinv_email_invoice_details', $invoice, $email_type, $sent_to_admin ); |
|
14 | +do_action('wpinv_email_invoice_details', $invoice, $email_type, $sent_to_admin); |
|
15 | 15 | |
16 | -do_action( 'wpinv_email_invoice_items', $invoice, $email_type, $sent_to_admin ); |
|
16 | +do_action('wpinv_email_invoice_items', $invoice, $email_type, $sent_to_admin); |
|
17 | 17 | |
18 | -do_action( 'wpinv_email_billing_details', $invoice, $email_type, $sent_to_admin ); |
|
18 | +do_action('wpinv_email_billing_details', $invoice, $email_type, $sent_to_admin); |
|
19 | 19 | |
20 | -do_action( 'wpinv_email_after_note_details', $invoice, $email_type, $sent_to_admin, $customer_note ); |
|
20 | +do_action('wpinv_email_after_note_details', $invoice, $email_type, $sent_to_admin, $customer_note); |
|
21 | 21 | |
22 | -do_action( 'wpinv_email_footer', $invoice, $email_type, $sent_to_admin ); |
|
23 | 22 | \ No newline at end of file |
23 | +do_action('wpinv_email_footer', $invoice, $email_type, $sent_to_admin); |
|
24 | 24 | \ No newline at end of file |