@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | * |
8 | 8 | */ |
9 | 9 | |
10 | -if ( ! defined( 'ABSPATH' ) ) { |
|
10 | +if (!defined('ABSPATH')) { |
|
11 | 11 | exit; // Exit if accessed directly |
12 | 12 | } |
13 | 13 | |
@@ -21,10 +21,10 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @param WP_Post $post |
23 | 23 | */ |
24 | - public static function output( $post ) { |
|
24 | + public static function output($post) { |
|
25 | 25 | |
26 | 26 | // Prepare the invoice. |
27 | - $invoice = new WPInv_Invoice( $post ); |
|
27 | + $invoice = new WPInv_Invoice($post); |
|
28 | 28 | |
29 | 29 | ?> |
30 | 30 | |
@@ -47,12 +47,12 @@ discard block |
||
47 | 47 | 'id' => 'wpinv_key', |
48 | 48 | 'name' => 'wpinv_key', |
49 | 49 | 'label' => sprintf( |
50 | - __( '%s Key:', 'invoicing' ), |
|
51 | - ucfirst( $invoice->get_invoice_quote_type() ) |
|
50 | + __('%s Key:', 'invoicing'), |
|
51 | + ucfirst($invoice->get_invoice_quote_type()) |
|
52 | 52 | ), |
53 | 53 | 'label_type' => 'vertical', |
54 | 54 | 'class' => 'form-control-sm', |
55 | - 'value' => $invoice->get_key( 'edit' ), |
|
55 | + 'value' => $invoice->get_key('edit'), |
|
56 | 56 | 'extra_attributes' => array( |
57 | 57 | 'onclick' => 'this.select();', |
58 | 58 | 'readonly' => 'true', |
@@ -67,8 +67,8 @@ discard block |
||
67 | 67 | 'id' => 'wpinv_view_url', |
68 | 68 | 'name' => 'wpinv_view_url', |
69 | 69 | 'label' => sprintf( |
70 | - __( '%s URL:', 'invoicing' ), |
|
71 | - ucfirst( $invoice->get_invoice_quote_type() ) |
|
70 | + __('%s URL:', 'invoicing'), |
|
71 | + ucfirst($invoice->get_invoice_quote_type()) |
|
72 | 72 | ), |
73 | 73 | 'label_type' => 'vertical', |
74 | 74 | 'class' => 'form-control-sm', |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | ); |
82 | 82 | |
83 | 83 | // If the invoice is paid... |
84 | - if ( $invoice->is_paid() || $invoice->is_refunded() ) { |
|
84 | + if ($invoice->is_paid() || $invoice->is_refunded()) { |
|
85 | 85 | |
86 | 86 | // Payment date. |
87 | 87 | echo aui()->input( |
@@ -89,11 +89,11 @@ discard block |
||
89 | 89 | 'type' => 'datepicker', |
90 | 90 | 'id' => 'wpinv_date_completed', |
91 | 91 | 'name' => 'date_completed', |
92 | - 'label' => __( 'Payment Date:', 'invoicing' ), |
|
92 | + 'label' => __('Payment Date:', 'invoicing'), |
|
93 | 93 | 'label_type' => 'vertical', |
94 | 94 | 'placeholder' => 'YYYY-MM-DD 00:00', |
95 | 95 | 'class' => 'form-control-sm', |
96 | - 'value' => $invoice->get_date_completed( 'edit' ), |
|
96 | + 'value' => $invoice->get_date_completed('edit'), |
|
97 | 97 | 'extra_attributes' => array( |
98 | 98 | 'data-enable-time' => 'true', |
99 | 99 | 'data-time_24hr' => 'true', |
@@ -108,10 +108,10 @@ discard block |
||
108 | 108 | 'type' => 'text', |
109 | 109 | 'id' => 'wpinv_gateway', |
110 | 110 | 'name' => 'wpinv_gateway', |
111 | - 'label' => __( 'Gateway:', 'invoicing' ), |
|
111 | + 'label' => __('Gateway:', 'invoicing'), |
|
112 | 112 | 'label_type' => 'vertical', |
113 | 113 | 'class' => 'form-control-sm', |
114 | - 'value' => wpinv_get_gateway_admin_label( $invoice->get_gateway( 'edit' ) ), |
|
114 | + 'value' => wpinv_get_gateway_admin_label($invoice->get_gateway('edit')), |
|
115 | 115 | 'extra_attributes' => array( |
116 | 116 | 'onclick' => 'this.select();', |
117 | 117 | 'readonly' => 'true', |
@@ -125,11 +125,11 @@ discard block |
||
125 | 125 | 'type' => 'text', |
126 | 126 | 'id' => 'wpinv_transaction_id', |
127 | 127 | 'name' => 'wpinv_transaction_id', |
128 | - 'label' => __( 'Transaction ID:', 'invoicing' ), |
|
128 | + 'label' => __('Transaction ID:', 'invoicing'), |
|
129 | 129 | 'label_type' => 'vertical', |
130 | 130 | 'class' => 'form-control-sm', |
131 | - 'value' => $invoice->get_transaction_id( 'edit' ), |
|
132 | - 'help_text' => apply_filters( 'wpinv_invoice_transaction_link_' . $invoice->get_gateway( 'edit' ), '', $invoice->get_transaction_id(), $invoice ), |
|
131 | + 'value' => $invoice->get_transaction_id('edit'), |
|
132 | + 'help_text' => apply_filters('wpinv_invoice_transaction_link_' . $invoice->get_gateway('edit'), '', $invoice->get_transaction_id(), $invoice), |
|
133 | 133 | 'extra_attributes' => array( |
134 | 134 | 'onclick' => 'this.select();', |
135 | 135 | 'readonly' => 'true', |
@@ -143,10 +143,10 @@ discard block |
||
143 | 143 | 'type' => 'text', |
144 | 144 | 'id' => 'wpinv_currency', |
145 | 145 | 'name' => 'wpinv_currency', |
146 | - 'label' => __( 'Currency:', 'invoicing' ), |
|
146 | + 'label' => __('Currency:', 'invoicing'), |
|
147 | 147 | 'label_type' => 'vertical', |
148 | 148 | 'class' => 'form-control-sm', |
149 | - 'value' => $invoice->get_currency( 'edit' ), |
|
149 | + 'value' => $invoice->get_currency('edit'), |
|
150 | 150 | 'extra_attributes' => array( |
151 | 151 | 'onclick' => 'this.select();', |
152 | 152 | 'readonly' => 'true', |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | |
157 | 157 | } else { |
158 | 158 | |
159 | - if ( 'wpi_invoice' == $invoice->get_post_type() ) { |
|
159 | + if ('wpi_invoice' == $invoice->get_post_type()) { |
|
160 | 160 | |
161 | 161 | // Payment URL. |
162 | 162 | echo aui()->input( |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | 'type' => 'text', |
165 | 165 | 'id' => 'wpinv_payment_url', |
166 | 166 | 'name' => 'wpinv_payment_url', |
167 | - 'label' => __( 'Payment URL:', 'invoicing' ), |
|
167 | + 'label' => __('Payment URL:', 'invoicing'), |
|
168 | 168 | 'label_type' => 'vertical', |
169 | 169 | 'class' => 'form-control-sm', |
170 | 170 | 'value' => $invoice->get_checkout_payment_url(), |
@@ -180,13 +180,13 @@ discard block |
||
180 | 180 | array( |
181 | 181 | 'id' => 'wpinv_gateway', |
182 | 182 | 'name' => 'wpinv_gateway', |
183 | - 'label' => __( 'Gateway:', 'invoicing' ), |
|
183 | + 'label' => __('Gateway:', 'invoicing'), |
|
184 | 184 | 'label_type' => 'vertical', |
185 | - 'placeholder' => __( 'Select Gateway', 'invoicing' ), |
|
186 | - 'value' => $invoice->get_gateway( 'edit' ), |
|
185 | + 'placeholder' => __('Select Gateway', 'invoicing'), |
|
186 | + 'value' => $invoice->get_gateway('edit'), |
|
187 | 187 | 'select2' => true, |
188 | 188 | 'data-allow-clear' => 'false', |
189 | - 'options' => wp_list_pluck( wpinv_get_enabled_payment_gateways( true ), 'admin_label' ), |
|
189 | + 'options' => wp_list_pluck(wpinv_get_enabled_payment_gateways(true), 'admin_label'), |
|
190 | 190 | ) |
191 | 191 | ); |
192 | 192 |
@@ -8,24 +8,24 @@ discard block |
||
8 | 8 | * @version 1.0.19 |
9 | 9 | */ |
10 | 10 | |
11 | -defined( 'ABSPATH' ) || exit; |
|
11 | +defined('ABSPATH') || exit; |
|
12 | 12 | |
13 | 13 | // Prepare the due date reminder options. |
14 | 14 | $overdue_days_options = array(); |
15 | -$overdue_days_options['0'] = __( 'On the Due Date', 'invoicing' ); |
|
16 | -$overdue_days_options['1'] = __( '1 day after Due Date', 'invoicing' ); |
|
15 | +$overdue_days_options['0'] = __('On the Due Date', 'invoicing'); |
|
16 | +$overdue_days_options['1'] = __('1 day after Due Date', 'invoicing'); |
|
17 | 17 | |
18 | -for ( $i = 2; $i <= 10; $i++ ) { |
|
19 | - $overdue_days_options["$i"] = wp_sprintf( __( '%d days after Due Date', 'invoicing' ), $i ); |
|
18 | +for ($i = 2; $i <= 10; $i++) { |
|
19 | + $overdue_days_options["$i"] = wp_sprintf(__('%d days after Due Date', 'invoicing'), $i); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | // Prepare up coming renewal reminder options. |
23 | 23 | $renewal_days_options = array(); |
24 | -$renewal_days_options['0'] = __( 'On the renewal date', 'invoicing' ); |
|
25 | -$renewal_days_options['1'] = __( '1 day before the renewal date', 'invoicing' ); |
|
24 | +$renewal_days_options['0'] = __('On the renewal date', 'invoicing'); |
|
25 | +$renewal_days_options['1'] = __('1 day before the renewal date', 'invoicing'); |
|
26 | 26 | |
27 | -for ( $i = 2; $i <= 10; $i++ ) { |
|
28 | - $renewal_days_options["$i"] = wp_sprintf( __( '%d days before the renewal date', 'invoicing' ), $i ); |
|
27 | +for ($i = 2; $i <= 10; $i++) { |
|
28 | + $renewal_days_options["$i"] = wp_sprintf(__('%d days before the renewal date', 'invoicing'), $i); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | // Default, built-in gateways |
@@ -34,45 +34,45 @@ discard block |
||
34 | 34 | |
35 | 35 | 'email_new_invoice_header' => array( |
36 | 36 | 'id' => 'email_new_invoice_header', |
37 | - 'name' => '<h3>' . __( 'New Invoice', 'invoicing' ) . '</h3>', |
|
38 | - 'desc' => __( 'These emails are sent to the site admin whenever there is a new invoice.', 'invoicing' ), |
|
37 | + 'name' => '<h3>' . __('New Invoice', 'invoicing') . '</h3>', |
|
38 | + 'desc' => __('These emails are sent to the site admin whenever there is a new invoice.', 'invoicing'), |
|
39 | 39 | 'type' => 'header', |
40 | 40 | ), |
41 | 41 | |
42 | 42 | 'email_new_invoice_active' => array( |
43 | 43 | 'id' => 'email_new_invoice_active', |
44 | - 'name' => __( 'Enable/Disable', 'invoicing' ), |
|
45 | - 'desc' => __( 'Enable this email notification', 'invoicing' ), |
|
44 | + 'name' => __('Enable/Disable', 'invoicing'), |
|
45 | + 'desc' => __('Enable this email notification', 'invoicing'), |
|
46 | 46 | 'type' => 'checkbox', |
47 | 47 | 'std' => 1 |
48 | 48 | ), |
49 | 49 | |
50 | 50 | 'email_new_invoice_subject' => array( |
51 | 51 | 'id' => 'email_new_invoice_subject', |
52 | - 'name' => __( 'Subject', 'invoicing' ), |
|
53 | - 'desc' => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ), |
|
52 | + 'name' => __('Subject', 'invoicing'), |
|
53 | + 'desc' => __('Enter the subject line for the invoice receipt email.', 'invoicing'), |
|
54 | 54 | 'help-tip' => true, |
55 | 55 | 'type' => 'text', |
56 | - 'std' => __( '[{site_title}] New invoice ({invoice_number}) for {invoice_total} {invoice_currency}', 'invoicing' ), |
|
56 | + 'std' => __('[{site_title}] New invoice ({invoice_number}) for {invoice_total} {invoice_currency}', 'invoicing'), |
|
57 | 57 | 'size' => 'large' |
58 | 58 | ), |
59 | 59 | |
60 | 60 | 'email_new_invoice_heading' => array( |
61 | 61 | 'id' => 'email_new_invoice_heading', |
62 | - 'name' => __( 'Email Heading', 'invoicing' ), |
|
63 | - 'desc' => __( 'Enter the main heading contained within the email notification for the invoice receipt email.', 'invoicing' ), |
|
62 | + 'name' => __('Email Heading', 'invoicing'), |
|
63 | + 'desc' => __('Enter the main heading contained within the email notification for the invoice receipt email.', 'invoicing'), |
|
64 | 64 | 'help-tip' => true, |
65 | 65 | 'type' => 'text', |
66 | - 'std' => __( 'New invoice', 'invoicing' ), |
|
66 | + 'std' => __('New invoice', 'invoicing'), |
|
67 | 67 | 'size' => 'large' |
68 | 68 | ), |
69 | 69 | |
70 | 70 | 'email_new_invoice_body' => array( |
71 | 71 | 'id' => 'email_new_invoice_body', |
72 | - 'name' => __( 'Email Content', 'invoicing' ), |
|
72 | + 'name' => __('Email Content', 'invoicing'), |
|
73 | 73 | 'desc' => wpinv_get_merge_tags_help_text(), |
74 | 74 | 'type' => 'rich_editor', |
75 | - 'std' => __( '<p>A new invoice <a href="{invoice_link}">({invoice_number})</a> to {name} for {invoice_total} {invoice_currency} has been created on your site.</p>', 'invoicing' ), |
|
75 | + 'std' => __('<p>A new invoice <a href="{invoice_link}">({invoice_number})</a> to {name} for {invoice_total} {invoice_currency} has been created on your site.</p>', 'invoicing'), |
|
76 | 76 | 'class' => 'large', |
77 | 77 | 'size' => '10' |
78 | 78 | ), |
@@ -82,45 +82,45 @@ discard block |
||
82 | 82 | |
83 | 83 | 'email_cancelled_invoice_header' => array( |
84 | 84 | 'id' => 'email_cancelled_invoice_header', |
85 | - 'name' => '<h3>' . __( 'Cancelled Invoice', 'invoicing' ) . '</h3>', |
|
86 | - 'desc' => __( 'These emails are sent to the site admin whenever invoices are cancelled.', 'invoicing' ), |
|
85 | + 'name' => '<h3>' . __('Cancelled Invoice', 'invoicing') . '</h3>', |
|
86 | + 'desc' => __('These emails are sent to the site admin whenever invoices are cancelled.', 'invoicing'), |
|
87 | 87 | 'type' => 'header', |
88 | 88 | ), |
89 | 89 | |
90 | 90 | 'email_cancelled_invoice_active' => array( |
91 | 91 | 'id' => 'email_cancelled_invoice_active', |
92 | - 'name' => __( 'Enable/Disable', 'invoicing' ), |
|
93 | - 'desc' => __( 'Enable this email notification', 'invoicing' ), |
|
92 | + 'name' => __('Enable/Disable', 'invoicing'), |
|
93 | + 'desc' => __('Enable this email notification', 'invoicing'), |
|
94 | 94 | 'type' => 'checkbox', |
95 | 95 | 'std' => 1 |
96 | 96 | ), |
97 | 97 | |
98 | 98 | 'email_cancelled_invoice_subject' => array( |
99 | 99 | 'id' => 'email_cancelled_invoice_subject', |
100 | - 'name' => __( 'Subject', 'invoicing' ), |
|
101 | - 'desc' => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ), |
|
100 | + 'name' => __('Subject', 'invoicing'), |
|
101 | + 'desc' => __('Enter the subject line for the invoice receipt email.', 'invoicing'), |
|
102 | 102 | 'help-tip' => true, |
103 | 103 | 'type' => 'text', |
104 | - 'std' => __( '[{site_title}] Cancelled invoice ({invoice_number})', 'invoicing' ), |
|
104 | + 'std' => __('[{site_title}] Cancelled invoice ({invoice_number})', 'invoicing'), |
|
105 | 105 | 'size' => 'large' |
106 | 106 | ), |
107 | 107 | |
108 | 108 | 'email_cancelled_invoice_heading' => array( |
109 | 109 | 'id' => 'email_cancelled_invoice_heading', |
110 | - 'name' => __( 'Email Heading', 'invoicing' ), |
|
111 | - 'desc' => __( 'Enter the main heading contained within the email notification.', 'invoicing' ), |
|
110 | + 'name' => __('Email Heading', 'invoicing'), |
|
111 | + 'desc' => __('Enter the main heading contained within the email notification.', 'invoicing'), |
|
112 | 112 | 'help-tip' => true, |
113 | 113 | 'type' => 'text', |
114 | - 'std' => __( 'Cancelled Invoice', 'invoicing' ), |
|
114 | + 'std' => __('Cancelled Invoice', 'invoicing'), |
|
115 | 115 | 'size' => 'large' |
116 | 116 | ), |
117 | 117 | |
118 | 118 | 'email_cancelled_invoice_body' => array( |
119 | 119 | 'id' => 'email_cancelled_invoice_body', |
120 | - 'name' => __( 'Email Content', 'invoicing' ), |
|
120 | + 'name' => __('Email Content', 'invoicing'), |
|
121 | 121 | 'desc' => wpinv_get_merge_tags_help_text(), |
122 | 122 | 'type' => 'rich_editor', |
123 | - 'std' => __( '<p>The invoice <a href="{invoice_link}">#{invoice_number}</a> created for {name} on {site_title} has been cancelled.</p>', 'invoicing' ), |
|
123 | + 'std' => __('<p>The invoice <a href="{invoice_link}">#{invoice_number}</a> created for {name} on {site_title} has been cancelled.</p>', 'invoicing'), |
|
124 | 124 | 'class' => 'large', |
125 | 125 | 'size' => '10' |
126 | 126 | ), |
@@ -131,45 +131,45 @@ discard block |
||
131 | 131 | |
132 | 132 | 'email_failed_invoice_header' => array( |
133 | 133 | 'id' => 'email_failed_invoice_header', |
134 | - 'name' => '<h3>' . __( 'Failed Invoice', 'invoicing' ) . '</h3>', |
|
135 | - 'desc' => __( 'Failed invoice emails are sent to the site admin when invoice payments fail.', 'invoicing' ), |
|
134 | + 'name' => '<h3>' . __('Failed Invoice', 'invoicing') . '</h3>', |
|
135 | + 'desc' => __('Failed invoice emails are sent to the site admin when invoice payments fail.', 'invoicing'), |
|
136 | 136 | 'type' => 'header', |
137 | 137 | ), |
138 | 138 | |
139 | 139 | 'email_failed_invoice_active' => array( |
140 | 140 | 'id' => 'email_failed_invoice_active', |
141 | - 'name' => __( 'Enable/Disable', 'invoicing' ), |
|
142 | - 'desc' => __( 'Enable this email notification', 'invoicing' ), |
|
141 | + 'name' => __('Enable/Disable', 'invoicing'), |
|
142 | + 'desc' => __('Enable this email notification', 'invoicing'), |
|
143 | 143 | 'type' => 'checkbox', |
144 | 144 | 'std' => 1 |
145 | 145 | ), |
146 | 146 | |
147 | 147 | 'email_failed_invoice_subject' => array( |
148 | 148 | 'id' => 'email_failed_invoice_subject', |
149 | - 'name' => __( 'Subject', 'invoicing' ), |
|
150 | - 'desc' => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ), |
|
149 | + 'name' => __('Subject', 'invoicing'), |
|
150 | + 'desc' => __('Enter the subject line for the invoice receipt email.', 'invoicing'), |
|
151 | 151 | 'help-tip' => true, |
152 | 152 | 'type' => 'text', |
153 | - 'std' => __( '[{site_title}] Failed invoice ({invoice_number})', 'invoicing' ), |
|
153 | + 'std' => __('[{site_title}] Failed invoice ({invoice_number})', 'invoicing'), |
|
154 | 154 | 'size' => 'large' |
155 | 155 | ), |
156 | 156 | |
157 | 157 | 'email_failed_invoice_heading' => array( |
158 | 158 | 'id' => 'email_failed_invoice_heading', |
159 | - 'name' => __( 'Email Heading', 'invoicing' ), |
|
160 | - 'desc' => __( 'Enter the main heading contained within the email notification.', 'invoicing' ), |
|
159 | + 'name' => __('Email Heading', 'invoicing'), |
|
160 | + 'desc' => __('Enter the main heading contained within the email notification.', 'invoicing'), |
|
161 | 161 | 'help-tip' => true, |
162 | 162 | 'type' => 'text', |
163 | - 'std' => __( 'Failed invoice', 'invoicing' ), |
|
163 | + 'std' => __('Failed invoice', 'invoicing'), |
|
164 | 164 | 'size' => 'large' |
165 | 165 | ), |
166 | 166 | |
167 | 167 | 'email_failed_invoice_body' => array( |
168 | 168 | 'id' => 'email_failed_invoice_body', |
169 | - 'name' => __( 'Email Content', 'invoicing' ), |
|
169 | + 'name' => __('Email Content', 'invoicing'), |
|
170 | 170 | 'desc' => wpinv_get_merge_tags_help_text(), |
171 | 171 | 'type' => 'rich_editor', |
172 | - 'std' => __( '<p>Payment for the invoice <a href="{invoice_link}">#{invoice_number}</a> on {site_title} has failed to go through.</p>', 'invoicing' ), |
|
172 | + 'std' => __('<p>Payment for the invoice <a href="{invoice_link}">#{invoice_number}</a> on {site_title} has failed to go through.</p>', 'invoicing'), |
|
173 | 173 | 'class' => 'large', |
174 | 174 | 'size' => '10' |
175 | 175 | ), |
@@ -179,53 +179,53 @@ discard block |
||
179 | 179 | |
180 | 180 | 'email_onhold_invoice_header' => array( |
181 | 181 | 'id' => 'email_onhold_invoice_header', |
182 | - 'name' => '<h3>' . __( 'On Hold Invoice', 'invoicing' ) . '</h3>', |
|
183 | - 'desc' => __( 'These emails are sent to customers whenever their invoices are held.', 'invoicing' ), |
|
182 | + 'name' => '<h3>' . __('On Hold Invoice', 'invoicing') . '</h3>', |
|
183 | + 'desc' => __('These emails are sent to customers whenever their invoices are held.', 'invoicing'), |
|
184 | 184 | 'type' => 'header', |
185 | 185 | ), |
186 | 186 | |
187 | 187 | 'email_onhold_invoice_active' => array( |
188 | 188 | 'id' => 'email_onhold_invoice_active', |
189 | - 'name' => __( 'Enable/Disable', 'invoicing' ), |
|
190 | - 'desc' => __( 'Enable this email notification', 'invoicing' ), |
|
189 | + 'name' => __('Enable/Disable', 'invoicing'), |
|
190 | + 'desc' => __('Enable this email notification', 'invoicing'), |
|
191 | 191 | 'type' => 'checkbox', |
192 | 192 | 'std' => 1 |
193 | 193 | ), |
194 | 194 | |
195 | 195 | 'email_onhold_invoice_admin_bcc' => array( |
196 | 196 | 'id' => 'email_onhold_invoice_admin_bcc', |
197 | - 'name' => __( 'Enable Admin BCC', 'invoicing' ), |
|
198 | - 'desc' => __( 'Check if you want to send this notification email to site Admin.', 'invoicing' ), |
|
197 | + 'name' => __('Enable Admin BCC', 'invoicing'), |
|
198 | + 'desc' => __('Check if you want to send this notification email to site Admin.', 'invoicing'), |
|
199 | 199 | 'type' => 'checkbox', |
200 | 200 | 'std' => 1 |
201 | 201 | ), |
202 | 202 | |
203 | 203 | 'email_onhold_invoice_subject' => array( |
204 | 204 | 'id' => 'email_onhold_invoice_subject', |
205 | - 'name' => __( 'Subject', 'invoicing' ), |
|
206 | - 'desc' => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ), |
|
205 | + 'name' => __('Subject', 'invoicing'), |
|
206 | + 'desc' => __('Enter the subject line for the invoice receipt email.', 'invoicing'), |
|
207 | 207 | 'help-tip' => true, |
208 | 208 | 'type' => 'text', |
209 | - 'std' => __( '[{site_title}] Your invoice receipt from {invoice_date}', 'invoicing' ), |
|
209 | + 'std' => __('[{site_title}] Your invoice receipt from {invoice_date}', 'invoicing'), |
|
210 | 210 | 'size' => 'large' |
211 | 211 | ), |
212 | 212 | |
213 | 213 | 'email_onhold_invoice_heading' => array( |
214 | 214 | 'id' => 'email_onhold_invoice_heading', |
215 | - 'name' => __( 'Email Heading', 'invoicing' ), |
|
216 | - 'desc' => __( 'Enter the main heading contained within the email notification.', 'invoicing' ), |
|
215 | + 'name' => __('Email Heading', 'invoicing'), |
|
216 | + 'desc' => __('Enter the main heading contained within the email notification.', 'invoicing'), |
|
217 | 217 | 'help-tip' => true, |
218 | 218 | 'type' => 'text', |
219 | - 'std' => __( 'Thank you for your invoice', 'invoicing' ), |
|
219 | + 'std' => __('Thank you for your invoice', 'invoicing'), |
|
220 | 220 | 'size' => 'large' |
221 | 221 | ), |
222 | 222 | |
223 | 223 | 'email_onhold_invoice_body' => array( |
224 | 224 | 'id' => 'email_onhold_invoice_body', |
225 | - 'name' => __( 'Email Content', 'invoicing' ), |
|
225 | + 'name' => __('Email Content', 'invoicing'), |
|
226 | 226 | 'desc' => wpinv_get_merge_tags_help_text(), |
227 | 227 | 'type' => 'rich_editor', |
228 | - 'std' => __( '<p>Hi {name},</p><p>Your invoice is on-hold and will be processed when we receive your payment.</p>', 'invoicing' ), |
|
228 | + 'std' => __('<p>Hi {name},</p><p>Your invoice is on-hold and will be processed when we receive your payment.</p>', 'invoicing'), |
|
229 | 229 | 'class' => 'large', |
230 | 230 | 'size' => '10' |
231 | 231 | ), |
@@ -236,53 +236,53 @@ discard block |
||
236 | 236 | |
237 | 237 | 'email_processing_invoice_header' => array( |
238 | 238 | 'id' => 'email_processing_invoice_header', |
239 | - 'name' => '<h3>' . __( 'Processing Invoice', 'invoicing' ) . '</h3>', |
|
240 | - 'desc' => __( 'These emails are sent to users whenever payments for their invoices are processing.', 'invoicing' ), |
|
239 | + 'name' => '<h3>' . __('Processing Invoice', 'invoicing') . '</h3>', |
|
240 | + 'desc' => __('These emails are sent to users whenever payments for their invoices are processing.', 'invoicing'), |
|
241 | 241 | 'type' => 'header', |
242 | 242 | ), |
243 | 243 | |
244 | 244 | 'email_processing_invoice_active' => array( |
245 | 245 | 'id' => 'email_processing_invoice_active', |
246 | - 'name' => __( 'Enable/Disable', 'invoicing' ), |
|
247 | - 'desc' => __( 'Enable this email notification', 'invoicing' ), |
|
246 | + 'name' => __('Enable/Disable', 'invoicing'), |
|
247 | + 'desc' => __('Enable this email notification', 'invoicing'), |
|
248 | 248 | 'type' => 'checkbox', |
249 | 249 | 'std' => 1 |
250 | 250 | ), |
251 | 251 | |
252 | 252 | 'email_processing_invoice_admin_bcc' => array( |
253 | 253 | 'id' => 'email_processing_invoice_admin_bcc', |
254 | - 'name' => __( 'Enable Admin BCC', 'invoicing' ), |
|
255 | - 'desc' => __( 'Check if you want to send a copy of this notification email to the site admin.', 'invoicing' ), |
|
254 | + 'name' => __('Enable Admin BCC', 'invoicing'), |
|
255 | + 'desc' => __('Check if you want to send a copy of this notification email to the site admin.', 'invoicing'), |
|
256 | 256 | 'type' => 'checkbox', |
257 | 257 | 'std' => 1 |
258 | 258 | ), |
259 | 259 | |
260 | 260 | 'email_processing_invoice_subject' => array( |
261 | 261 | 'id' => 'email_processing_invoice_subject', |
262 | - 'name' => __( 'Subject', 'invoicing' ), |
|
263 | - 'desc' => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ), |
|
262 | + 'name' => __('Subject', 'invoicing'), |
|
263 | + 'desc' => __('Enter the subject line for the invoice receipt email.', 'invoicing'), |
|
264 | 264 | 'help-tip' => true, |
265 | 265 | 'type' => 'text', |
266 | - 'std' => __( '[{site_title}] Your invoice receipt from {invoice_date}', 'invoicing' ), |
|
266 | + 'std' => __('[{site_title}] Your invoice receipt from {invoice_date}', 'invoicing'), |
|
267 | 267 | 'size' => 'large' |
268 | 268 | ), |
269 | 269 | |
270 | 270 | 'email_processing_invoice_heading' => array( |
271 | 271 | 'id' => 'email_processing_invoice_heading', |
272 | - 'name' => __( 'Email Heading', 'invoicing' ), |
|
273 | - 'desc' => __( 'Enter the main heading contained within the email notification for the invoice receipt email.', 'invoicing' ), |
|
272 | + 'name' => __('Email Heading', 'invoicing'), |
|
273 | + 'desc' => __('Enter the main heading contained within the email notification for the invoice receipt email.', 'invoicing'), |
|
274 | 274 | 'help-tip' => true, |
275 | 275 | 'type' => 'text', |
276 | - 'std' => __( 'Thank you for your invoice', 'invoicing' ), |
|
276 | + 'std' => __('Thank you for your invoice', 'invoicing'), |
|
277 | 277 | 'size' => 'large' |
278 | 278 | ), |
279 | 279 | |
280 | 280 | 'email_processing_invoice_body' => array( |
281 | 281 | 'id' => 'email_processing_invoice_body', |
282 | - 'name' => __( 'Email Content', 'invoicing' ), |
|
282 | + 'name' => __('Email Content', 'invoicing'), |
|
283 | 283 | 'desc' => wpinv_get_merge_tags_help_text(), |
284 | 284 | 'type' => 'rich_editor', |
285 | - 'std' => __( '<p>Hi {name},</p><p>I would like to let you know that we have received and are currently processing your payment for the invoice <a href="{invoice_link}">#{invoice_number}</a> on {site_title}.</p>', 'invoicing' ), |
|
285 | + 'std' => __('<p>Hi {name},</p><p>I would like to let you know that we have received and are currently processing your payment for the invoice <a href="{invoice_link}">#{invoice_number}</a> on {site_title}.</p>', 'invoicing'), |
|
286 | 286 | 'class' => 'large', |
287 | 287 | 'size' => '10' |
288 | 288 | ), |
@@ -293,61 +293,61 @@ discard block |
||
293 | 293 | |
294 | 294 | 'email_completed_invoice_header' => array( |
295 | 295 | 'id' => 'email_completed_invoice_header', |
296 | - 'name' => '<h3>' . __( 'Paid Invoice', 'invoicing' ) . '</h3>', |
|
297 | - 'desc' => __( 'These emails are sent to customers when their invoices are marked as paid.', 'invoicing' ), |
|
296 | + 'name' => '<h3>' . __('Paid Invoice', 'invoicing') . '</h3>', |
|
297 | + 'desc' => __('These emails are sent to customers when their invoices are marked as paid.', 'invoicing'), |
|
298 | 298 | 'type' => 'header', |
299 | 299 | ), |
300 | 300 | |
301 | 301 | 'email_completed_invoice_active' => array( |
302 | 302 | 'id' => 'email_completed_invoice_active', |
303 | - 'name' => __( 'Enable/Disable', 'invoicing' ), |
|
304 | - 'desc' => __( 'Enable this email notification', 'invoicing' ), |
|
303 | + 'name' => __('Enable/Disable', 'invoicing'), |
|
304 | + 'desc' => __('Enable this email notification', 'invoicing'), |
|
305 | 305 | 'type' => 'checkbox', |
306 | 306 | 'std' => 1 |
307 | 307 | ), |
308 | 308 | |
309 | 309 | 'email_completed_invoice_renewal_active' => array( |
310 | 310 | 'id' => 'email_completed_invoice_renewal_active', |
311 | - 'name' => __( 'Enable renewal notification', 'invoicing' ), |
|
312 | - 'desc' => __( 'Should this email be sent for renewals too?', 'invoicing' ), |
|
311 | + 'name' => __('Enable renewal notification', 'invoicing'), |
|
312 | + 'desc' => __('Should this email be sent for renewals too?', 'invoicing'), |
|
313 | 313 | 'type' => 'checkbox', |
314 | 314 | 'std' => 1 |
315 | 315 | ), |
316 | 316 | |
317 | 317 | 'email_completed_invoice_admin_bcc' => array( |
318 | 318 | 'id' => 'email_completed_invoice_admin_bcc', |
319 | - 'name' => __( 'Enable Admin BCC', 'invoicing' ), |
|
320 | - 'desc' => __( 'Check if you want to send a copy of this notification email to the site admin.', 'invoicing' ), |
|
319 | + 'name' => __('Enable Admin BCC', 'invoicing'), |
|
320 | + 'desc' => __('Check if you want to send a copy of this notification email to the site admin.', 'invoicing'), |
|
321 | 321 | 'type' => 'checkbox', |
322 | 322 | 'std' => 1, |
323 | 323 | ), |
324 | 324 | |
325 | 325 | 'email_completed_invoice_subject' => array( |
326 | 326 | 'id' => 'email_completed_invoice_subject', |
327 | - 'name' => __( 'Subject', 'invoicing' ), |
|
328 | - 'desc' => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ), |
|
327 | + 'name' => __('Subject', 'invoicing'), |
|
328 | + 'desc' => __('Enter the subject line for the invoice receipt email.', 'invoicing'), |
|
329 | 329 | 'help-tip' => true, |
330 | 330 | 'type' => 'text', |
331 | - 'std' => __( '[{site_title}] Your invoice from {invoice_date} has been paid', 'invoicing' ), |
|
331 | + 'std' => __('[{site_title}] Your invoice from {invoice_date} has been paid', 'invoicing'), |
|
332 | 332 | 'size' => 'large' |
333 | 333 | ), |
334 | 334 | |
335 | 335 | 'email_completed_invoice_heading' => array( |
336 | 336 | 'id' => 'email_completed_invoice_heading', |
337 | - 'name' => __( 'Email Heading', 'invoicing' ), |
|
338 | - 'desc' => __( 'Enter the main heading contained within the email notification for the invoice receipt email.', 'invoicing' ), |
|
337 | + 'name' => __('Email Heading', 'invoicing'), |
|
338 | + 'desc' => __('Enter the main heading contained within the email notification for the invoice receipt email.', 'invoicing'), |
|
339 | 339 | 'help-tip' => true, |
340 | 340 | 'type' => 'text', |
341 | - 'std' => __( 'Your invoice has been paid', 'invoicing' ), |
|
341 | + 'std' => __('Your invoice has been paid', 'invoicing'), |
|
342 | 342 | 'size' => 'large' |
343 | 343 | ), |
344 | 344 | |
345 | 345 | 'email_completed_invoice_body' => array( |
346 | 346 | 'id' => 'email_completed_invoice_body', |
347 | - 'name' => __( 'Email Content', 'invoicing' ), |
|
347 | + 'name' => __('Email Content', 'invoicing'), |
|
348 | 348 | 'desc' => wpinv_get_merge_tags_help_text(), |
349 | 349 | 'type' => 'rich_editor', |
350 | - 'std' => __( '<p>Hi {name},</p><p>Your recent invoice on {site_title} has been paid.</p>', 'invoicing' ), |
|
350 | + 'std' => __('<p>Hi {name},</p><p>Your recent invoice on {site_title} has been paid.</p>', 'invoicing'), |
|
351 | 351 | 'class' => 'large', |
352 | 352 | 'size' => '10' |
353 | 353 | ), |
@@ -358,53 +358,53 @@ discard block |
||
358 | 358 | |
359 | 359 | 'email_refunded_invoice_header' => array( |
360 | 360 | 'id' => 'email_refunded_invoice_header', |
361 | - 'name' => '<h3>' . __( 'Refunded Invoice', 'invoicing' ) . '</h3>', |
|
362 | - 'desc' => __( 'These emails are sent to users when their invoices are marked as refunded.', 'invoicing' ), |
|
361 | + 'name' => '<h3>' . __('Refunded Invoice', 'invoicing') . '</h3>', |
|
362 | + 'desc' => __('These emails are sent to users when their invoices are marked as refunded.', 'invoicing'), |
|
363 | 363 | 'type' => 'header', |
364 | 364 | ), |
365 | 365 | |
366 | 366 | 'email_refunded_invoice_active' => array( |
367 | 367 | 'id' => 'email_refunded_invoice_active', |
368 | - 'name' => __( 'Enable/Disable', 'invoicing' ), |
|
369 | - 'desc' => __( 'Enable this email notification', 'invoicing' ), |
|
368 | + 'name' => __('Enable/Disable', 'invoicing'), |
|
369 | + 'desc' => __('Enable this email notification', 'invoicing'), |
|
370 | 370 | 'type' => 'checkbox', |
371 | 371 | 'std' => 1 |
372 | 372 | ), |
373 | 373 | |
374 | 374 | 'email_refunded_invoice_admin_bcc' => array( |
375 | 375 | 'id' => 'email_refunded_invoice_admin_bcc', |
376 | - 'name' => __( 'Enable Admin BCC', 'invoicing' ), |
|
377 | - 'desc' => __( 'Check if you want to send a copy of this notification email to the site admin.', 'invoicing' ), |
|
376 | + 'name' => __('Enable Admin BCC', 'invoicing'), |
|
377 | + 'desc' => __('Check if you want to send a copy of this notification email to the site admin.', 'invoicing'), |
|
378 | 378 | 'type' => 'checkbox', |
379 | 379 | 'std' => 1 |
380 | 380 | ), |
381 | 381 | |
382 | 382 | 'email_refunded_invoice_subject' => array( |
383 | 383 | 'id' => 'email_refunded_invoice_subject', |
384 | - 'name' => __( 'Subject', 'invoicing' ), |
|
385 | - 'desc' => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ), |
|
384 | + 'name' => __('Subject', 'invoicing'), |
|
385 | + 'desc' => __('Enter the subject line for the invoice receipt email.', 'invoicing'), |
|
386 | 386 | 'help-tip' => true, |
387 | 387 | 'type' => 'text', |
388 | - 'std' => __( '[{site_title}] Your invoice from {invoice_date} has been refunded', 'invoicing' ), |
|
388 | + 'std' => __('[{site_title}] Your invoice from {invoice_date} has been refunded', 'invoicing'), |
|
389 | 389 | 'size' => 'large' |
390 | 390 | ), |
391 | 391 | |
392 | 392 | 'email_refunded_invoice_heading' => array( |
393 | 393 | 'id' => 'email_refunded_invoice_heading', |
394 | - 'name' => __( 'Email Heading', 'invoicing' ), |
|
395 | - 'desc' => __( 'Enter the main heading contained within the email notification.', 'invoicing' ), |
|
394 | + 'name' => __('Email Heading', 'invoicing'), |
|
395 | + 'desc' => __('Enter the main heading contained within the email notification.', 'invoicing'), |
|
396 | 396 | 'help-tip' => true, |
397 | 397 | 'type' => 'text', |
398 | - 'std' => __( 'Your invoice has been refunded', 'invoicing' ), |
|
398 | + 'std' => __('Your invoice has been refunded', 'invoicing'), |
|
399 | 399 | 'size' => 'large' |
400 | 400 | ), |
401 | 401 | |
402 | 402 | 'email_refunded_invoice_body' => array( |
403 | 403 | 'id' => 'email_refunded_invoice_body', |
404 | - 'name' => __( 'Email Content', 'invoicing' ), |
|
404 | + 'name' => __('Email Content', 'invoicing'), |
|
405 | 405 | 'desc' => wpinv_get_merge_tags_help_text(), |
406 | 406 | 'type' => 'rich_editor', |
407 | - 'std' => __( '<p>Hi {name},</p><p>Your invoice on {site_title} has been refunded.</p>', 'invoicing' ), |
|
407 | + 'std' => __('<p>Hi {name},</p><p>Your invoice on {site_title} has been refunded.</p>', 'invoicing'), |
|
408 | 408 | 'class' => 'large', |
409 | 409 | 'size' => '10' |
410 | 410 | ), |
@@ -415,53 +415,53 @@ discard block |
||
415 | 415 | |
416 | 416 | 'email_user_invoice_header' => array( |
417 | 417 | 'id' => 'email_user_invoice_header', |
418 | - 'name' => '<h3>' . __( 'Customer Invoice', 'invoicing' ) . '</h3>', |
|
419 | - 'desc' => __( 'These emails are sent to customers containing their invoice information and payment links.', 'invoicing' ), |
|
418 | + 'name' => '<h3>' . __('Customer Invoice', 'invoicing') . '</h3>', |
|
419 | + 'desc' => __('These emails are sent to customers containing their invoice information and payment links.', 'invoicing'), |
|
420 | 420 | 'type' => 'header', |
421 | 421 | ), |
422 | 422 | |
423 | 423 | 'email_user_invoice_active' => array( |
424 | 424 | 'id' => 'email_user_invoice_active', |
425 | - 'name' => __( 'Enable/Disable', 'invoicing' ), |
|
426 | - 'desc' => __( 'Enable this email notification', 'invoicing' ), |
|
425 | + 'name' => __('Enable/Disable', 'invoicing'), |
|
426 | + 'desc' => __('Enable this email notification', 'invoicing'), |
|
427 | 427 | 'type' => 'checkbox', |
428 | 428 | 'std' => 1 |
429 | 429 | ), |
430 | 430 | |
431 | 431 | 'email_user_invoice_admin_bcc' => array( |
432 | 432 | 'id' => 'email_user_invoice_admin_bcc', |
433 | - 'name' => __( 'Enable Admin BCC', 'invoicing' ), |
|
434 | - 'desc' => __( 'Check if you want to send a copy of this notification email to to the site admin.', 'invoicing' ), |
|
433 | + 'name' => __('Enable Admin BCC', 'invoicing'), |
|
434 | + 'desc' => __('Check if you want to send a copy of this notification email to to the site admin.', 'invoicing'), |
|
435 | 435 | 'type' => 'checkbox', |
436 | 436 | 'std' => 0 |
437 | 437 | ), |
438 | 438 | |
439 | 439 | 'email_user_invoice_subject' => array( |
440 | 440 | 'id' => 'email_user_invoice_subject', |
441 | - 'name' => __( 'Subject', 'invoicing' ), |
|
442 | - 'desc' => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ), |
|
441 | + 'name' => __('Subject', 'invoicing'), |
|
442 | + 'desc' => __('Enter the subject line for the invoice receipt email.', 'invoicing'), |
|
443 | 443 | 'help-tip' => true, |
444 | 444 | 'type' => 'text', |
445 | - 'std' => __( '[{site_title}] Your invoice from {invoice_date}', 'invoicing' ), |
|
445 | + 'std' => __('[{site_title}] Your invoice from {invoice_date}', 'invoicing'), |
|
446 | 446 | 'size' => 'large' |
447 | 447 | ), |
448 | 448 | |
449 | 449 | 'email_user_invoice_heading' => array( |
450 | 450 | 'id' => 'email_user_invoice_heading', |
451 | - 'name' => __( 'Email Heading', 'invoicing' ), |
|
452 | - 'desc' => __( 'Enter the main heading contained within the email notification for the invoice receipt email.', 'invoicing' ), |
|
451 | + 'name' => __('Email Heading', 'invoicing'), |
|
452 | + 'desc' => __('Enter the main heading contained within the email notification for the invoice receipt email.', 'invoicing'), |
|
453 | 453 | 'help-tip' => true, |
454 | 454 | 'type' => 'text', |
455 | - 'std' => __( 'Your invoice {invoice_number} details', 'invoicing' ), |
|
455 | + 'std' => __('Your invoice {invoice_number} details', 'invoicing'), |
|
456 | 456 | 'size' => 'large' |
457 | 457 | ), |
458 | 458 | |
459 | 459 | 'email_user_invoice_body' => array( |
460 | 460 | 'id' => 'email_user_invoice_body', |
461 | - 'name' => __( 'Email Content', 'invoicing' ), |
|
461 | + 'name' => __('Email Content', 'invoicing'), |
|
462 | 462 | 'desc' => wpinv_get_merge_tags_help_text(), |
463 | 463 | 'type' => 'rich_editor', |
464 | - 'std' => __( '<p>Hi {name},</p><p>An invoice of {invoice_total} has been created for you on {site_title}. You can <a href="{invoice_link}">view</a> or <a href="{invoice_pay_link}">pay</a> the invoice. Please reply to this email if you have any questions about the invoice.', 'invoicing' ), |
|
464 | + 'std' => __('<p>Hi {name},</p><p>An invoice of {invoice_total} has been created for you on {site_title}. You can <a href="{invoice_link}">view</a> or <a href="{invoice_pay_link}">pay</a> the invoice. Please reply to this email if you have any questions about the invoice.', 'invoicing'), |
|
465 | 465 | 'class' => 'large', |
466 | 466 | 'size' => '10' |
467 | 467 | ), |
@@ -471,53 +471,53 @@ discard block |
||
471 | 471 | |
472 | 472 | 'email_user_note_header' => array( |
473 | 473 | 'id' => 'email_user_note_header', |
474 | - 'name' => '<h3>' . __( 'Customer Note', 'invoicing' ) . '</h3>', |
|
475 | - 'desc' => __( 'These emails are sent when you add a customer note to an invoice/quote.', 'invoicing' ), |
|
474 | + 'name' => '<h3>' . __('Customer Note', 'invoicing') . '</h3>', |
|
475 | + 'desc' => __('These emails are sent when you add a customer note to an invoice/quote.', 'invoicing'), |
|
476 | 476 | 'type' => 'header', |
477 | 477 | ), |
478 | 478 | |
479 | 479 | 'email_user_note_active' => array( |
480 | 480 | 'id' => 'email_user_note_active', |
481 | - 'name' => __( 'Enable/Disable', 'invoicing' ), |
|
482 | - 'desc' => __( 'Enable this email notification', 'invoicing' ), |
|
481 | + 'name' => __('Enable/Disable', 'invoicing'), |
|
482 | + 'desc' => __('Enable this email notification', 'invoicing'), |
|
483 | 483 | 'type' => 'checkbox', |
484 | 484 | 'std' => 1 |
485 | 485 | ), |
486 | 486 | |
487 | 487 | 'email_user_note_admin_bcc' => array( |
488 | 488 | 'id' => 'email_user_note_admin_bcc', |
489 | - 'name' => __( 'Enable Admin BCC', 'invoicing' ), |
|
490 | - 'desc' => __( 'Check if you want to send a copy of this notification email to the site admin.', 'invoicing' ), |
|
489 | + 'name' => __('Enable Admin BCC', 'invoicing'), |
|
490 | + 'desc' => __('Check if you want to send a copy of this notification email to the site admin.', 'invoicing'), |
|
491 | 491 | 'type' => 'checkbox', |
492 | 492 | 'std' => 0 |
493 | 493 | ), |
494 | 494 | |
495 | 495 | 'email_user_note_subject' => array( |
496 | 496 | 'id' => 'email_user_note_subject', |
497 | - 'name' => __( 'Subject', 'invoicing' ), |
|
498 | - 'desc' => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ), |
|
497 | + 'name' => __('Subject', 'invoicing'), |
|
498 | + 'desc' => __('Enter the subject line for the invoice receipt email.', 'invoicing'), |
|
499 | 499 | 'help-tip' => true, |
500 | 500 | 'type' => 'text', |
501 | - 'std' => __( '[{site_title}] Note added to your {invoice_label} #{invoice_number} from {invoice_date}', 'invoicing' ), |
|
501 | + 'std' => __('[{site_title}] Note added to your {invoice_label} #{invoice_number} from {invoice_date}', 'invoicing'), |
|
502 | 502 | 'size' => 'large' |
503 | 503 | ), |
504 | 504 | |
505 | 505 | 'email_user_note_heading' => array( |
506 | 506 | 'id' => 'email_user_note_heading', |
507 | - 'name' => __( 'Email Heading', 'invoicing' ), |
|
508 | - 'desc' => __( 'Enter the main heading contained within the email notification.', 'invoicing' ), |
|
507 | + 'name' => __('Email Heading', 'invoicing'), |
|
508 | + 'desc' => __('Enter the main heading contained within the email notification.', 'invoicing'), |
|
509 | 509 | 'help-tip' => true, |
510 | 510 | 'type' => 'text', |
511 | - 'std' => __( 'A note has been added to your {invoice_label}', 'invoicing' ), |
|
511 | + 'std' => __('A note has been added to your {invoice_label}', 'invoicing'), |
|
512 | 512 | 'size' => 'large' |
513 | 513 | ), |
514 | 514 | |
515 | 515 | 'email_user_note_body' => array( |
516 | 516 | 'id' => 'email_user_note_body', |
517 | - 'name' => __( 'Email Content', 'invoicing' ), |
|
517 | + 'name' => __('Email Content', 'invoicing'), |
|
518 | 518 | 'desc' => wpinv_get_merge_tags_help_text(), |
519 | 519 | 'type' => 'rich_editor', |
520 | - 'std' => __( '<p>Hi {name},</p><p>Following note has been added to your {invoice_label}:</p><blockquote class="wpinv-note">{customer_note}</blockquote>', 'invoicing' ), |
|
520 | + 'std' => __('<p>Hi {name},</p><p>Following note has been added to your {invoice_label}:</p><blockquote class="wpinv-note">{customer_note}</blockquote>', 'invoicing'), |
|
521 | 521 | 'class' => 'large', |
522 | 522 | 'size' => '10' |
523 | 523 | ), |
@@ -528,63 +528,63 @@ discard block |
||
528 | 528 | |
529 | 529 | 'email_overdue_header' => array( |
530 | 530 | 'id' => 'email_overdue_header', |
531 | - 'name' => '<h3>' . __( 'Payment Reminder', 'invoicing' ) . '</h3>', |
|
532 | - 'desc' => __( 'Payment reminder emails are sent to customers whenever their invoices are due.', 'invoicing' ), |
|
531 | + 'name' => '<h3>' . __('Payment Reminder', 'invoicing') . '</h3>', |
|
532 | + 'desc' => __('Payment reminder emails are sent to customers whenever their invoices are due.', 'invoicing'), |
|
533 | 533 | 'type' => 'header', |
534 | 534 | ), |
535 | 535 | |
536 | 536 | 'email_overdue_active' => array( |
537 | 537 | 'id' => 'email_overdue_active', |
538 | - 'name' => __( 'Enable/Disable', 'invoicing' ), |
|
539 | - 'desc' => __( 'Enable this email notification', 'invoicing' ), |
|
538 | + 'name' => __('Enable/Disable', 'invoicing'), |
|
539 | + 'desc' => __('Enable this email notification', 'invoicing'), |
|
540 | 540 | 'type' => 'checkbox', |
541 | 541 | 'std' => 1 |
542 | 542 | ), |
543 | 543 | |
544 | 544 | 'email_overdue_admin_bcc' => array( |
545 | 545 | 'id' => 'email_overdue_admin_bcc', |
546 | - 'name' => __( 'Enable Admin BCC', 'invoicing' ), |
|
547 | - 'desc' => __( 'Check if you want to send a copy of this notification email to the site admin.', 'invoicing' ), |
|
546 | + 'name' => __('Enable Admin BCC', 'invoicing'), |
|
547 | + 'desc' => __('Check if you want to send a copy of this notification email to the site admin.', 'invoicing'), |
|
548 | 548 | 'type' => 'checkbox', |
549 | 549 | 'std' => 0 |
550 | 550 | ), |
551 | 551 | |
552 | 552 | 'email_overdue_days' => array( |
553 | 553 | 'id' => 'email_overdue_days', |
554 | - 'name' => __( 'When to Send', 'invoicing' ), |
|
555 | - 'desc' => __( 'Check when you would like payment reminders sent out.', 'invoicing' ), |
|
554 | + 'name' => __('When to Send', 'invoicing'), |
|
555 | + 'desc' => __('Check when you would like payment reminders sent out.', 'invoicing'), |
|
556 | 556 | 'help-tip' => true, |
557 | - 'std' => array( '1' ), |
|
557 | + 'std' => array('1'), |
|
558 | 558 | 'type' => 'multicheck', |
559 | 559 | 'options' => $overdue_days_options, |
560 | 560 | ), |
561 | 561 | |
562 | 562 | 'email_overdue_subject' => array( |
563 | 563 | 'id' => 'email_overdue_subject', |
564 | - 'name' => __( 'Subject', 'invoicing' ), |
|
565 | - 'desc' => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ), |
|
564 | + 'name' => __('Subject', 'invoicing'), |
|
565 | + 'desc' => __('Enter the subject line for the invoice receipt email.', 'invoicing'), |
|
566 | 566 | 'help-tip' => true, |
567 | 567 | 'type' => 'text', |
568 | - 'std' => __( '[{site_title}] Payment Reminder', 'invoicing' ), |
|
568 | + 'std' => __('[{site_title}] Payment Reminder', 'invoicing'), |
|
569 | 569 | 'size' => 'large' |
570 | 570 | ), |
571 | 571 | |
572 | 572 | 'email_overdue_heading' => array( |
573 | 573 | 'id' => 'email_overdue_heading', |
574 | - 'name' => __( 'Email Heading', 'invoicing' ), |
|
575 | - 'desc' => __( 'Enter the main heading contained within the email notification.', 'invoicing' ), |
|
574 | + 'name' => __('Email Heading', 'invoicing'), |
|
575 | + 'desc' => __('Enter the main heading contained within the email notification.', 'invoicing'), |
|
576 | 576 | 'help-tip' => true, |
577 | 577 | 'type' => 'text', |
578 | - 'std' => __( 'Payment reminder for your invoice', 'invoicing' ), |
|
578 | + 'std' => __('Payment reminder for your invoice', 'invoicing'), |
|
579 | 579 | 'size' => 'large' |
580 | 580 | ), |
581 | 581 | |
582 | 582 | 'email_overdue_body' => array( |
583 | 583 | 'id' => 'email_overdue_body', |
584 | - 'name' => __( 'Email Content', 'invoicing' ), |
|
584 | + 'name' => __('Email Content', 'invoicing'), |
|
585 | 585 | 'desc' => wpinv_get_merge_tags_help_text(), |
586 | 586 | 'type' => 'rich_editor', |
587 | - 'std' => __( '<p>Hi {full_name},</p><p>This is just a friendly reminder that your invoice <a href="{invoice_link}">#{invoice_number}</a> {is_was} due on {invoice_due_date}.</p><p>The total of this invoice is {invoice_total}</p><p>To view / pay now for this invoice please use the following link: <a class="btn btn-success" href="{invoice_link}">View / Pay</a></p>', 'invoicing' ), |
|
587 | + 'std' => __('<p>Hi {full_name},</p><p>This is just a friendly reminder that your invoice <a href="{invoice_link}">#{invoice_number}</a> {is_was} due on {invoice_due_date}.</p><p>The total of this invoice is {invoice_total}</p><p>To view / pay now for this invoice please use the following link: <a class="btn btn-success" href="{invoice_link}">View / Pay</a></p>', 'invoicing'), |
|
588 | 588 | 'class' => 'large', |
589 | 589 | 'size' => 10, |
590 | 590 | ), |
@@ -595,63 +595,63 @@ discard block |
||
595 | 595 | |
596 | 596 | 'email_renewal_reminder_header' => array( |
597 | 597 | 'id' => 'email_renewal_reminder_header', |
598 | - 'name' => '<h3>' . __( 'Renewal Reminder', 'invoicing' ) . '</h3>', |
|
599 | - 'desc' => __( 'These emails are sent to customers whenever their subscription is about to expire.', 'invoicing' ), |
|
598 | + 'name' => '<h3>' . __('Renewal Reminder', 'invoicing') . '</h3>', |
|
599 | + 'desc' => __('These emails are sent to customers whenever their subscription is about to expire.', 'invoicing'), |
|
600 | 600 | 'type' => 'header', |
601 | 601 | ), |
602 | 602 | |
603 | 603 | 'email_renewal_reminder_active' => array( |
604 | 604 | 'id' => 'email_renewal_reminder_active', |
605 | - 'name' => __( 'Enable/Disable', 'invoicing' ), |
|
606 | - 'desc' => __( 'Enable this email notification', 'invoicing' ), |
|
605 | + 'name' => __('Enable/Disable', 'invoicing'), |
|
606 | + 'desc' => __('Enable this email notification', 'invoicing'), |
|
607 | 607 | 'type' => 'checkbox', |
608 | 608 | 'std' => 0 |
609 | 609 | ), |
610 | 610 | |
611 | 611 | 'email_renewal_reminder_admin_bcc' => array( |
612 | 612 | 'id' => 'email_renewal_reminder_admin_bcc', |
613 | - 'name' => __( 'Enable Admin BCC', 'invoicing' ), |
|
614 | - 'desc' => __( 'Check if you want to send a copy of this notification email to the site admin.', 'invoicing' ), |
|
613 | + 'name' => __('Enable Admin BCC', 'invoicing'), |
|
614 | + 'desc' => __('Check if you want to send a copy of this notification email to the site admin.', 'invoicing'), |
|
615 | 615 | 'type' => 'checkbox', |
616 | 616 | 'std' => 0 |
617 | 617 | ), |
618 | 618 | |
619 | 619 | 'email_renewal_reminder_days' => array( |
620 | 620 | 'id' => 'email_renewal_reminder_days', |
621 | - 'name' => __( 'When to Send', 'invoicing' ), |
|
622 | - 'desc' => __( 'Check when you would like renewal reminders sent out.', 'invoicing' ), |
|
621 | + 'name' => __('When to Send', 'invoicing'), |
|
622 | + 'desc' => __('Check when you would like renewal reminders sent out.', 'invoicing'), |
|
623 | 623 | 'help-tip' => true, |
624 | - 'std' => array( '1', '5', '10' ), |
|
624 | + 'std' => array('1', '5', '10'), |
|
625 | 625 | 'type' => 'multicheck', |
626 | 626 | 'options' => $renewal_days_options, |
627 | 627 | ), |
628 | 628 | |
629 | 629 | 'email_renewal_reminder_subject' => array( |
630 | 630 | 'id' => 'email_renewal_reminder_subject', |
631 | - 'name' => __( 'Subject', 'invoicing' ), |
|
632 | - 'desc' => __( 'Enter the subject line for the email.', 'invoicing' ), |
|
631 | + 'name' => __('Subject', 'invoicing'), |
|
632 | + 'desc' => __('Enter the subject line for the email.', 'invoicing'), |
|
633 | 633 | 'help-tip' => true, |
634 | 634 | 'type' => 'text', |
635 | - 'std' => __( '[{site_title}] Renewal Reminder', 'invoicing' ), |
|
635 | + 'std' => __('[{site_title}] Renewal Reminder', 'invoicing'), |
|
636 | 636 | 'size' => 'large' |
637 | 637 | ), |
638 | 638 | |
639 | 639 | 'email_renewal_reminder_heading' => array( |
640 | 640 | 'id' => 'email_renewal_reminder_heading', |
641 | - 'name' => __( 'Email Heading', 'invoicing' ), |
|
642 | - 'desc' => __( 'Enter the main heading contained within the email notification.', 'invoicing' ), |
|
641 | + 'name' => __('Email Heading', 'invoicing'), |
|
642 | + 'desc' => __('Enter the main heading contained within the email notification.', 'invoicing'), |
|
643 | 643 | 'help-tip' => true, |
644 | 644 | 'type' => 'text', |
645 | - 'std' => __( 'Upcoming renewal reminder', 'invoicing' ), |
|
645 | + 'std' => __('Upcoming renewal reminder', 'invoicing'), |
|
646 | 646 | 'size' => 'large' |
647 | 647 | ), |
648 | 648 | |
649 | 649 | 'email_renewal_reminder_body' => array( |
650 | 650 | 'id' => 'email_renewal_reminder_body', |
651 | - 'name' => __( 'Email Content', 'invoicing' ), |
|
652 | - 'desc' => wpinv_get_merge_tags_help_text( true ), |
|
651 | + 'name' => __('Email Content', 'invoicing'), |
|
652 | + 'desc' => wpinv_get_merge_tags_help_text(true), |
|
653 | 653 | 'type' => 'rich_editor', |
654 | - 'std' => __( '<p>Hi {full_name},</p><p>This is just a friendly reminder that your subscription for invoice <a href="{invoice_link}">#{invoice_number}</a> will renew on {subscription_renewal_date}.</p>', 'invoicing' ), |
|
654 | + 'std' => __('<p>Hi {full_name},</p><p>This is just a friendly reminder that your subscription for invoice <a href="{invoice_link}">#{invoice_number}</a> will renew on {subscription_renewal_date}.</p>', 'invoicing'), |
|
655 | 655 | 'class' => 'large', |
656 | 656 | 'size' => 10, |
657 | 657 | ), |
@@ -662,53 +662,53 @@ discard block |
||
662 | 662 | |
663 | 663 | 'email_subscription_trial_header' => array( |
664 | 664 | 'id' => 'email_subscription_trial_header', |
665 | - 'name' => '<h3>' . __( 'Trial Started', 'invoicing' ) . '</h3>', |
|
666 | - 'desc' => __( 'These emails are sent when a customer starts a subscription trial.', 'invoicing' ), |
|
665 | + 'name' => '<h3>' . __('Trial Started', 'invoicing') . '</h3>', |
|
666 | + 'desc' => __('These emails are sent when a customer starts a subscription trial.', 'invoicing'), |
|
667 | 667 | 'type' => 'header', |
668 | 668 | ), |
669 | 669 | |
670 | 670 | 'email_subscription_trial_active' => array( |
671 | 671 | 'id' => 'email_subscription_trial_active', |
672 | - 'name' => __( 'Enable/Disable', 'invoicing' ), |
|
673 | - 'desc' => __( 'Enable this email notification', 'invoicing' ), |
|
672 | + 'name' => __('Enable/Disable', 'invoicing'), |
|
673 | + 'desc' => __('Enable this email notification', 'invoicing'), |
|
674 | 674 | 'type' => 'checkbox', |
675 | 675 | 'std' => 0 |
676 | 676 | ), |
677 | 677 | |
678 | 678 | 'email_subscription_trial_admin_bcc' => array( |
679 | 679 | 'id' => 'email_subscription_trial_admin_bcc', |
680 | - 'name' => __( 'Enable Admin BCC', 'invoicing' ), |
|
681 | - 'desc' => __( 'Check if you want to send a copy of this notification email to the site admin.', 'invoicing' ), |
|
680 | + 'name' => __('Enable Admin BCC', 'invoicing'), |
|
681 | + 'desc' => __('Check if you want to send a copy of this notification email to the site admin.', 'invoicing'), |
|
682 | 682 | 'type' => 'checkbox', |
683 | 683 | 'std' => 0 |
684 | 684 | ), |
685 | 685 | |
686 | 686 | 'email_subscription_trial_subject' => array( |
687 | 687 | 'id' => 'email_subscription_trial_subject', |
688 | - 'name' => __( 'Subject', 'invoicing' ), |
|
689 | - 'desc' => __( 'Enter the subject line for the subscription trial email.', 'invoicing' ), |
|
688 | + 'name' => __('Subject', 'invoicing'), |
|
689 | + 'desc' => __('Enter the subject line for the subscription trial email.', 'invoicing'), |
|
690 | 690 | 'help-tip' => true, |
691 | 691 | 'type' => 'text', |
692 | - 'std' => __( '[{site_title}] Trial Started', 'invoicing' ), |
|
692 | + 'std' => __('[{site_title}] Trial Started', 'invoicing'), |
|
693 | 693 | 'size' => 'large' |
694 | 694 | ), |
695 | 695 | |
696 | 696 | 'email_subscription_trial_heading' => array( |
697 | 697 | 'id' => 'email_subscription_trial_heading', |
698 | - 'name' => __( 'Email Heading', 'invoicing' ), |
|
699 | - 'desc' => __( 'Enter the main heading of this email.', 'invoicing' ), |
|
698 | + 'name' => __('Email Heading', 'invoicing'), |
|
699 | + 'desc' => __('Enter the main heading of this email.', 'invoicing'), |
|
700 | 700 | 'help-tip' => true, |
701 | 701 | 'type' => 'text', |
702 | - 'std' => __( 'Trial Started', 'invoicing' ), |
|
702 | + 'std' => __('Trial Started', 'invoicing'), |
|
703 | 703 | 'size' => 'large' |
704 | 704 | ), |
705 | 705 | |
706 | 706 | 'email_subscription_trial_body' => array( |
707 | 707 | 'id' => 'email_subscription_trial_body', |
708 | - 'name' => __( 'Email Content', 'invoicing' ), |
|
709 | - 'desc' => wpinv_get_merge_tags_help_text( true ), |
|
708 | + 'name' => __('Email Content', 'invoicing'), |
|
709 | + 'desc' => wpinv_get_merge_tags_help_text(true), |
|
710 | 710 | 'type' => 'rich_editor', |
711 | - 'std' => __( '<p>Hi {first_name},</p><p>Your trial for {subscription_name} is now active and will renew on {subscription_renewal_date}.</p>', 'invoicing' ), |
|
711 | + 'std' => __('<p>Hi {first_name},</p><p>Your trial for {subscription_name} is now active and will renew on {subscription_renewal_date}.</p>', 'invoicing'), |
|
712 | 712 | 'class' => 'large', |
713 | 713 | 'size' => 10, |
714 | 714 | ), |
@@ -718,53 +718,53 @@ discard block |
||
718 | 718 | |
719 | 719 | 'email_subscription_cancelled_header' => array( |
720 | 720 | 'id' => 'email_subscription_cancelled_header', |
721 | - 'name' => '<h3>' . __( 'Subscription Cancelled', 'invoicing' ) . '</h3>', |
|
722 | - 'desc' => __( 'These emails are sent when a customer cancels their subscription.', 'invoicing' ), |
|
721 | + 'name' => '<h3>' . __('Subscription Cancelled', 'invoicing') . '</h3>', |
|
722 | + 'desc' => __('These emails are sent when a customer cancels their subscription.', 'invoicing'), |
|
723 | 723 | 'type' => 'header', |
724 | 724 | ), |
725 | 725 | |
726 | 726 | 'email_subscription_cancelled_active' => array( |
727 | 727 | 'id' => 'email_subscription_cancelled_active', |
728 | - 'name' => __( 'Enable/Disable', 'invoicing' ), |
|
729 | - 'desc' => __( 'Enable this email notification', 'invoicing' ), |
|
728 | + 'name' => __('Enable/Disable', 'invoicing'), |
|
729 | + 'desc' => __('Enable this email notification', 'invoicing'), |
|
730 | 730 | 'type' => 'checkbox', |
731 | 731 | 'std' => 1 |
732 | 732 | ), |
733 | 733 | |
734 | 734 | 'email_subscription_cancelled_admin_bcc' => array( |
735 | 735 | 'id' => 'email_subscription_cancelled_admin_bcc', |
736 | - 'name' => __( 'Enable Admin BCC', 'invoicing' ), |
|
737 | - 'desc' => __( 'Check if you want to send a copy of this notification email to the site admin.', 'invoicing' ), |
|
736 | + 'name' => __('Enable Admin BCC', 'invoicing'), |
|
737 | + 'desc' => __('Check if you want to send a copy of this notification email to the site admin.', 'invoicing'), |
|
738 | 738 | 'type' => 'checkbox', |
739 | 739 | 'std' => 1 |
740 | 740 | ), |
741 | 741 | |
742 | 742 | 'email_subscription_cancelled_subject' => array( |
743 | 743 | 'id' => 'email_subscription_cancelled_subject', |
744 | - 'name' => __( 'Subject', 'invoicing' ), |
|
745 | - 'desc' => __( 'Enter the subject line for the subscription cancelled email.', 'invoicing' ), |
|
744 | + 'name' => __('Subject', 'invoicing'), |
|
745 | + 'desc' => __('Enter the subject line for the subscription cancelled email.', 'invoicing'), |
|
746 | 746 | 'help-tip' => true, |
747 | 747 | 'type' => 'text', |
748 | - 'std' => __( '[{site_title}] Subscription Cancelled', 'invoicing' ), |
|
748 | + 'std' => __('[{site_title}] Subscription Cancelled', 'invoicing'), |
|
749 | 749 | 'size' => 'large' |
750 | 750 | ), |
751 | 751 | |
752 | 752 | 'email_subscription_cancelled_heading' => array( |
753 | 753 | 'id' => 'email_subscription_cancelled_heading', |
754 | - 'name' => __( 'Email Heading', 'invoicing' ), |
|
755 | - 'desc' => __( 'Enter the main heading of this email.', 'invoicing' ), |
|
754 | + 'name' => __('Email Heading', 'invoicing'), |
|
755 | + 'desc' => __('Enter the main heading of this email.', 'invoicing'), |
|
756 | 756 | 'help-tip' => true, |
757 | 757 | 'type' => 'text', |
758 | - 'std' => __( 'Subscription Cancelled', 'invoicing' ), |
|
758 | + 'std' => __('Subscription Cancelled', 'invoicing'), |
|
759 | 759 | 'size' => 'large' |
760 | 760 | ), |
761 | 761 | |
762 | 762 | 'email_subscription_cancelled_body' => array( |
763 | 763 | 'id' => 'email_subscription_cancelled_body', |
764 | - 'name' => __( 'Email Content', 'invoicing' ), |
|
765 | - 'desc' => wpinv_get_merge_tags_help_text( true ), |
|
764 | + 'name' => __('Email Content', 'invoicing'), |
|
765 | + 'desc' => wpinv_get_merge_tags_help_text(true), |
|
766 | 766 | 'type' => 'rich_editor', |
767 | - 'std' => __( '<p>Hi {first_name},</p><p>Your subscription for {subscription_name} has been cancelled and will no longer renew.</p>', 'invoicing' ), |
|
767 | + 'std' => __('<p>Hi {first_name},</p><p>Your subscription for {subscription_name} has been cancelled and will no longer renew.</p>', 'invoicing'), |
|
768 | 768 | 'class' => 'large', |
769 | 769 | 'size' => 10, |
770 | 770 | ), |
@@ -774,53 +774,53 @@ discard block |
||
774 | 774 | |
775 | 775 | 'email_subscription_expired_header' => array( |
776 | 776 | 'id' => 'email_subscription_expired_header', |
777 | - 'name' => '<h3>' . __( 'Subscription Expired', 'invoicing' ) . '</h3>', |
|
778 | - 'desc' => __( "These emails are sent when a customer's subscription expires and automatic renewal fails.", 'invoicing' ), |
|
777 | + 'name' => '<h3>' . __('Subscription Expired', 'invoicing') . '</h3>', |
|
778 | + 'desc' => __("These emails are sent when a customer's subscription expires and automatic renewal fails.", 'invoicing'), |
|
779 | 779 | 'type' => 'header', |
780 | 780 | ), |
781 | 781 | |
782 | 782 | 'email_subscription_expired_active' => array( |
783 | 783 | 'id' => 'email_subscription_expired_active', |
784 | - 'name' => __( 'Enable/Disable', 'invoicing' ), |
|
785 | - 'desc' => __( 'Enable this email notification', 'invoicing' ), |
|
784 | + 'name' => __('Enable/Disable', 'invoicing'), |
|
785 | + 'desc' => __('Enable this email notification', 'invoicing'), |
|
786 | 786 | 'type' => 'checkbox', |
787 | 787 | 'std' => 1 |
788 | 788 | ), |
789 | 789 | |
790 | 790 | 'email_subscription_expired_admin_bcc' => array( |
791 | 791 | 'id' => 'email_subscription_expired_admin_bcc', |
792 | - 'name' => __( 'Enable Admin BCC', 'invoicing' ), |
|
793 | - 'desc' => __( 'Check if you want to send a copy of this notification email to the site admin.', 'invoicing' ), |
|
792 | + 'name' => __('Enable Admin BCC', 'invoicing'), |
|
793 | + 'desc' => __('Check if you want to send a copy of this notification email to the site admin.', 'invoicing'), |
|
794 | 794 | 'type' => 'checkbox', |
795 | 795 | 'std' => 1 |
796 | 796 | ), |
797 | 797 | |
798 | 798 | 'email_subscription_expired_subject' => array( |
799 | 799 | 'id' => 'email_subscription_expired_subject', |
800 | - 'name' => __( 'Subject', 'invoicing' ), |
|
801 | - 'desc' => __( 'Enter the subject line for the subscription expired email.', 'invoicing' ), |
|
800 | + 'name' => __('Subject', 'invoicing'), |
|
801 | + 'desc' => __('Enter the subject line for the subscription expired email.', 'invoicing'), |
|
802 | 802 | 'help-tip' => true, |
803 | 803 | 'type' => 'text', |
804 | - 'std' => __( '[{site_title}] Subscription Expired', 'invoicing' ), |
|
804 | + 'std' => __('[{site_title}] Subscription Expired', 'invoicing'), |
|
805 | 805 | 'size' => 'large' |
806 | 806 | ), |
807 | 807 | |
808 | 808 | 'email_subscription_expired_heading' => array( |
809 | 809 | 'id' => 'email_subscription_expired_heading', |
810 | - 'name' => __( 'Email Heading', 'invoicing' ), |
|
811 | - 'desc' => __( 'Enter the main heading of this email.', 'invoicing' ), |
|
810 | + 'name' => __('Email Heading', 'invoicing'), |
|
811 | + 'desc' => __('Enter the main heading of this email.', 'invoicing'), |
|
812 | 812 | 'type' => 'text', |
813 | - 'std' => __( 'Subscription Expired', 'invoicing' ), |
|
813 | + 'std' => __('Subscription Expired', 'invoicing'), |
|
814 | 814 | 'help-tip' => true, |
815 | 815 | 'size' => 'large' |
816 | 816 | ), |
817 | 817 | |
818 | 818 | 'email_subscription_expired_body' => array( |
819 | 819 | 'id' => 'email_subscription_expired_body', |
820 | - 'name' => __( 'Email Content', 'invoicing' ), |
|
821 | - 'desc' => wpinv_get_merge_tags_help_text( true ), |
|
820 | + 'name' => __('Email Content', 'invoicing'), |
|
821 | + 'desc' => wpinv_get_merge_tags_help_text(true), |
|
822 | 822 | 'type' => 'rich_editor', |
823 | - 'std' => __( '<p>Hi {first_name},</p><p>Your subscription for {subscription_name} has expired.</p>', 'invoicing' ), |
|
823 | + 'std' => __('<p>Hi {first_name},</p><p>Your subscription for {subscription_name} has expired.</p>', 'invoicing'), |
|
824 | 824 | 'class' => 'large', |
825 | 825 | 'size' => 10, |
826 | 826 | ), |
@@ -830,53 +830,53 @@ discard block |
||
830 | 830 | |
831 | 831 | 'email_subscription_complete_header' => array( |
832 | 832 | 'id' => 'email_subscription_complete_header', |
833 | - 'name' => '<h3>' . __( 'Subscription Complete', 'invoicing' ) . '</h3>', |
|
834 | - 'desc' => __( 'These emails are sent when a customer completes their subscription.', 'invoicing' ), |
|
833 | + 'name' => '<h3>' . __('Subscription Complete', 'invoicing') . '</h3>', |
|
834 | + 'desc' => __('These emails are sent when a customer completes their subscription.', 'invoicing'), |
|
835 | 835 | 'type' => 'header', |
836 | 836 | ), |
837 | 837 | |
838 | 838 | 'email_subscription_complete_active' => array( |
839 | 839 | 'id' => 'email_subscription_complete_active', |
840 | - 'name' => __( 'Enable/Disable', 'invoicing' ), |
|
841 | - 'desc' => __( 'Enable this email notification', 'invoicing' ), |
|
840 | + 'name' => __('Enable/Disable', 'invoicing'), |
|
841 | + 'desc' => __('Enable this email notification', 'invoicing'), |
|
842 | 842 | 'type' => 'checkbox', |
843 | 843 | 'std' => 1 |
844 | 844 | ), |
845 | 845 | |
846 | 846 | 'email_subscription_complete_admin_bcc' => array( |
847 | 847 | 'id' => 'email_subscription_complete_admin_bcc', |
848 | - 'name' => __( 'Enable Admin BCC', 'invoicing' ), |
|
849 | - 'desc' => __( 'Check if you want to send a copy of this notification email to the site admin.', 'invoicing' ), |
|
848 | + 'name' => __('Enable Admin BCC', 'invoicing'), |
|
849 | + 'desc' => __('Check if you want to send a copy of this notification email to the site admin.', 'invoicing'), |
|
850 | 850 | 'type' => 'checkbox', |
851 | 851 | 'std' => 1 |
852 | 852 | ), |
853 | 853 | |
854 | 854 | 'email_subscription_complete_subject' => array( |
855 | 855 | 'id' => 'email_subscription_complete_subject', |
856 | - 'name' => __( 'Subject', 'invoicing' ), |
|
857 | - 'desc' => __( 'Enter the subject line for the subscription complete email.', 'invoicing' ), |
|
856 | + 'name' => __('Subject', 'invoicing'), |
|
857 | + 'desc' => __('Enter the subject line for the subscription complete email.', 'invoicing'), |
|
858 | 858 | 'help-tip' => true, |
859 | 859 | 'type' => 'text', |
860 | - 'std' => __( '[{site_title}] Subscription Complete', 'invoicing' ), |
|
860 | + 'std' => __('[{site_title}] Subscription Complete', 'invoicing'), |
|
861 | 861 | 'size' => 'large' |
862 | 862 | ), |
863 | 863 | |
864 | 864 | 'email_subscription_complete_heading' => array( |
865 | 865 | 'id' => 'email_subscription_complete_heading', |
866 | - 'name' => __( 'Email Heading', 'invoicing' ), |
|
867 | - 'desc' => __( 'Enter the main heading of this email.', 'invoicing' ), |
|
866 | + 'name' => __('Email Heading', 'invoicing'), |
|
867 | + 'desc' => __('Enter the main heading of this email.', 'invoicing'), |
|
868 | 868 | 'help-tip' => true, |
869 | 869 | 'type' => 'text', |
870 | - 'std' => __( 'Subscription Complete', 'invoicing' ), |
|
870 | + 'std' => __('Subscription Complete', 'invoicing'), |
|
871 | 871 | 'size' => 'large' |
872 | 872 | ), |
873 | 873 | |
874 | 874 | 'email_subscription_complete_body' => array( |
875 | 875 | 'id' => 'email_subscription_complete_body', |
876 | - 'name' => __( 'Email Content', 'invoicing' ), |
|
877 | - 'desc' => wpinv_get_merge_tags_help_text( true ), |
|
876 | + 'name' => __('Email Content', 'invoicing'), |
|
877 | + 'desc' => wpinv_get_merge_tags_help_text(true), |
|
878 | 878 | 'type' => 'rich_editor', |
879 | - 'std' => __( '<p>Hi {first_name},</p><p>Your subscription for {subscription_name} is now complete.</p>', 'invoicing' ), |
|
879 | + 'std' => __('<p>Hi {first_name},</p><p>Your subscription for {subscription_name} is now complete.</p>', 'invoicing'), |
|
880 | 880 | 'class' => 'large', |
881 | 881 | 'size' => 10, |
882 | 882 | ), |
@@ -14,77 +14,77 @@ discard block |
||
14 | 14 | class GetPaid_Admin { |
15 | 15 | |
16 | 16 | /** |
17 | - * Local path to this plugins admin directory |
|
18 | - * |
|
19 | - * @var string |
|
20 | - */ |
|
21 | - public $admin_path; |
|
22 | - |
|
23 | - /** |
|
24 | - * Web path to this plugins admin directory |
|
25 | - * |
|
26 | - * @var string |
|
27 | - */ |
|
28 | - public $admin_url; |
|
17 | + * Local path to this plugins admin directory |
|
18 | + * |
|
19 | + * @var string |
|
20 | + */ |
|
21 | + public $admin_path; |
|
22 | + |
|
23 | + /** |
|
24 | + * Web path to this plugins admin directory |
|
25 | + * |
|
26 | + * @var string |
|
27 | + */ |
|
28 | + public $admin_url; |
|
29 | 29 | |
30 | - /** |
|
31 | - * Reports components. |
|
32 | - * |
|
33 | - * @var GetPaid_Reports |
|
34 | - */ |
|
30 | + /** |
|
31 | + * Reports components. |
|
32 | + * |
|
33 | + * @var GetPaid_Reports |
|
34 | + */ |
|
35 | 35 | public $reports; |
36 | 36 | |
37 | 37 | /** |
38 | - * Class constructor. |
|
39 | - */ |
|
40 | - public function __construct(){ |
|
38 | + * Class constructor. |
|
39 | + */ |
|
40 | + public function __construct(){ |
|
41 | 41 | |
42 | 42 | $this->admin_path = plugin_dir_path( __FILE__ ); |
43 | - $this->admin_url = plugins_url( '/', __FILE__ ); |
|
44 | - $this->reports = new GetPaid_Reports(); |
|
43 | + $this->admin_url = plugins_url( '/', __FILE__ ); |
|
44 | + $this->reports = new GetPaid_Reports(); |
|
45 | 45 | |
46 | 46 | if ( is_admin() ) { |
47 | - $this->init_admin_hooks(); |
|
47 | + $this->init_admin_hooks(); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
53 | - * Init action and filter hooks |
|
54 | - * |
|
55 | - */ |
|
56 | - private function init_admin_hooks() { |
|
53 | + * Init action and filter hooks |
|
54 | + * |
|
55 | + */ |
|
56 | + private function init_admin_hooks() { |
|
57 | 57 | add_action( 'admin_enqueue_scripts', array( $this, 'enqeue_scripts' ) ); |
58 | 58 | add_filter( 'admin_body_class', array( $this, 'admin_body_class' ) ); |
59 | 59 | add_action( 'admin_init', array( $this, 'init_ayecode_connect_helper' ) ); |
60 | 60 | add_action( 'admin_init', array( $this, 'activation_redirect') ); |
61 | 61 | add_action( 'admin_init', array( $this, 'maybe_do_admin_action') ); |
62 | - add_action( 'admin_notices', array( $this, 'show_notices' ) ); |
|
63 | - add_action( 'getpaid_authenticated_admin_action_rate_plugin', array( $this, 'redirect_to_wordpress_rating_page' ) ); |
|
64 | - add_action( 'getpaid_authenticated_admin_action_send_invoice', array( $this, 'send_customer_invoice' ) ); |
|
65 | - add_action( 'getpaid_authenticated_admin_action_send_invoice_reminder', array( $this, 'send_customer_payment_reminder' ) ); |
|
62 | + add_action( 'admin_notices', array( $this, 'show_notices' ) ); |
|
63 | + add_action( 'getpaid_authenticated_admin_action_rate_plugin', array( $this, 'redirect_to_wordpress_rating_page' ) ); |
|
64 | + add_action( 'getpaid_authenticated_admin_action_send_invoice', array( $this, 'send_customer_invoice' ) ); |
|
65 | + add_action( 'getpaid_authenticated_admin_action_send_invoice_reminder', array( $this, 'send_customer_payment_reminder' ) ); |
|
66 | 66 | add_action( 'getpaid_authenticated_admin_action_reset_tax_rates', array( $this, 'admin_reset_tax_rates' ) ); |
67 | - add_action( 'getpaid_authenticated_admin_action_create_missing_pages', array( $this, 'admin_create_missing_pages' ) ); |
|
68 | - add_action( 'getpaid_authenticated_admin_action_create_missing_tables', array( $this, 'admin_create_missing_tables' ) ); |
|
69 | - add_action( 'getpaid_authenticated_admin_action_migrate_old_invoices', array( $this, 'admin_migrate_old_invoices' ) ); |
|
70 | - add_action( 'getpaid_authenticated_admin_action_recalculate_discounts', array( $this, 'admin_recalculate_discounts' ) ); |
|
71 | - add_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ) ); |
|
72 | - do_action( 'getpaid_init_admin_hooks', $this ); |
|
67 | + add_action( 'getpaid_authenticated_admin_action_create_missing_pages', array( $this, 'admin_create_missing_pages' ) ); |
|
68 | + add_action( 'getpaid_authenticated_admin_action_create_missing_tables', array( $this, 'admin_create_missing_tables' ) ); |
|
69 | + add_action( 'getpaid_authenticated_admin_action_migrate_old_invoices', array( $this, 'admin_migrate_old_invoices' ) ); |
|
70 | + add_action( 'getpaid_authenticated_admin_action_recalculate_discounts', array( $this, 'admin_recalculate_discounts' ) ); |
|
71 | + add_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ) ); |
|
72 | + do_action( 'getpaid_init_admin_hooks', $this ); |
|
73 | 73 | |
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
77 | - * Register admin scripts |
|
78 | - * |
|
79 | - */ |
|
80 | - public function enqeue_scripts() { |
|
77 | + * Register admin scripts |
|
78 | + * |
|
79 | + */ |
|
80 | + public function enqeue_scripts() { |
|
81 | 81 | global $current_screen, $pagenow; |
82 | 82 | |
83 | - $page = isset( $_GET['page'] ) ? $_GET['page'] : ''; |
|
84 | - $editing = $pagenow == 'post.php' || $pagenow == 'post-new.php'; |
|
83 | + $page = isset( $_GET['page'] ) ? $_GET['page'] : ''; |
|
84 | + $editing = $pagenow == 'post.php' || $pagenow == 'post-new.php'; |
|
85 | 85 | |
86 | 86 | if ( ! empty( $current_screen->post_type ) ) { |
87 | - $page = $current_screen->post_type; |
|
87 | + $page = $current_screen->post_type; |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | // General styles. |
@@ -105,54 +105,54 @@ discard block |
||
105 | 105 | } |
106 | 106 | |
107 | 107 | // Payment form scripts. |
108 | - if ( 'wpi_payment_form' == $page && $editing ) { |
|
108 | + if ( 'wpi_payment_form' == $page && $editing ) { |
|
109 | 109 | $this->load_payment_form_scripts(); |
110 | 110 | } |
111 | 111 | |
112 | - if ( $page == 'wpinv-subscriptions' ) { |
|
113 | - wp_enqueue_script( 'postbox' ); |
|
114 | - } |
|
112 | + if ( $page == 'wpinv-subscriptions' ) { |
|
113 | + wp_enqueue_script( 'postbox' ); |
|
114 | + } |
|
115 | 115 | |
116 | 116 | } |
117 | 117 | |
118 | 118 | /** |
119 | - * Returns admin js translations. |
|
120 | - * |
|
121 | - */ |
|
122 | - protected function get_admin_i18() { |
|
119 | + * Returns admin js translations. |
|
120 | + * |
|
121 | + */ |
|
122 | + protected function get_admin_i18() { |
|
123 | 123 | global $post; |
124 | 124 | |
125 | - $date_range = array( |
|
126 | - 'period' => isset( $_GET['date_range'] ) ? sanitize_text_field( $_GET['date_range'] ) : '7_days' |
|
127 | - ); |
|
125 | + $date_range = array( |
|
126 | + 'period' => isset( $_GET['date_range'] ) ? sanitize_text_field( $_GET['date_range'] ) : '7_days' |
|
127 | + ); |
|
128 | 128 | |
129 | - if ( $date_range['period'] == 'custom' ) { |
|
129 | + if ( $date_range['period'] == 'custom' ) { |
|
130 | 130 | |
131 | - if ( isset( $_GET['from'] ) ) { |
|
132 | - $date_range[ 'after' ] = date( 'Y-m-d', strtotime( sanitize_text_field( $_GET['from'] ), current_time( 'timestamp' ) ) - DAY_IN_SECONDS ); |
|
133 | - } |
|
131 | + if ( isset( $_GET['from'] ) ) { |
|
132 | + $date_range[ 'after' ] = date( 'Y-m-d', strtotime( sanitize_text_field( $_GET['from'] ), current_time( 'timestamp' ) ) - DAY_IN_SECONDS ); |
|
133 | + } |
|
134 | 134 | |
135 | - if ( isset( $_GET['to'] ) ) { |
|
136 | - $date_range[ 'before' ] = date( 'Y-m-d', strtotime( sanitize_text_field( $_GET['to'] ), current_time( 'timestamp' ) ) + DAY_IN_SECONDS ); |
|
137 | - } |
|
135 | + if ( isset( $_GET['to'] ) ) { |
|
136 | + $date_range[ 'before' ] = date( 'Y-m-d', strtotime( sanitize_text_field( $_GET['to'] ), current_time( 'timestamp' ) ) + DAY_IN_SECONDS ); |
|
137 | + } |
|
138 | 138 | |
139 | - } |
|
139 | + } |
|
140 | 140 | |
141 | 141 | $i18n = array( |
142 | 142 | 'ajax_url' => admin_url( 'admin-ajax.php' ), |
143 | 143 | 'post_ID' => isset( $post->ID ) ? $post->ID : '', |
144 | - 'wpinv_nonce' => wp_create_nonce( 'wpinv-nonce' ), |
|
145 | - 'rest_nonce' => wp_create_nonce( 'wp_rest' ), |
|
146 | - 'rest_root' => esc_url_raw( rest_url() ), |
|
147 | - 'date_range' => $date_range, |
|
144 | + 'wpinv_nonce' => wp_create_nonce( 'wpinv-nonce' ), |
|
145 | + 'rest_nonce' => wp_create_nonce( 'wp_rest' ), |
|
146 | + 'rest_root' => esc_url_raw( rest_url() ), |
|
147 | + 'date_range' => $date_range, |
|
148 | 148 | 'add_invoice_note_nonce' => wp_create_nonce( 'add-invoice-note' ), |
149 | 149 | 'delete_invoice_note_nonce' => wp_create_nonce( 'delete-invoice-note' ), |
150 | 150 | 'invoice_item_nonce' => wp_create_nonce( 'invoice-item' ), |
151 | 151 | 'billing_details_nonce' => wp_create_nonce( 'get-billing-details' ), |
152 | 152 | 'tax' => wpinv_tax_amount(), |
153 | 153 | 'discount' => 0, |
154 | - 'currency_symbol' => wpinv_currency_symbol(), |
|
155 | - 'currency' => wpinv_get_currency(), |
|
154 | + 'currency_symbol' => wpinv_currency_symbol(), |
|
155 | + 'currency' => wpinv_get_currency(), |
|
156 | 156 | 'currency_pos' => wpinv_currency_position(), |
157 | 157 | 'thousand_sep' => wpinv_thousands_separator(), |
158 | 158 | 'decimal_sep' => wpinv_decimal_separator(), |
@@ -172,118 +172,118 @@ discard block |
||
172 | 172 | 'item_description' => __( 'Item Description', 'invoicing' ), |
173 | 173 | 'invoice_description' => __( 'Invoice Description', 'invoicing' ), |
174 | 174 | 'discount_description' => __( 'Discount Description', 'invoicing' ), |
175 | - 'searching' => __( 'Searching', 'invoicing' ), |
|
176 | - 'loading' => __( 'Loading...', 'invoicing' ), |
|
177 | - 'search_customers' => __( 'Enter customer name or email', 'invoicing' ), |
|
178 | - 'search_items' => __( 'Enter item name', 'invoicing' ), |
|
175 | + 'searching' => __( 'Searching', 'invoicing' ), |
|
176 | + 'loading' => __( 'Loading...', 'invoicing' ), |
|
177 | + 'search_customers' => __( 'Enter customer name or email', 'invoicing' ), |
|
178 | + 'search_items' => __( 'Enter item name', 'invoicing' ), |
|
179 | 179 | ); |
180 | 180 | |
181 | - if ( ! empty( $post ) && getpaid_is_invoice_post_type( $post->post_type ) ) { |
|
181 | + if ( ! empty( $post ) && getpaid_is_invoice_post_type( $post->post_type ) ) { |
|
182 | 182 | |
183 | - $invoice = new WPInv_Invoice( $post ); |
|
184 | - $i18n['save_invoice'] = sprintf( |
|
185 | - __( 'Save %s', 'invoicing' ), |
|
186 | - ucfirst( $invoice->get_invoice_quote_type() ) |
|
187 | - ); |
|
183 | + $invoice = new WPInv_Invoice( $post ); |
|
184 | + $i18n['save_invoice'] = sprintf( |
|
185 | + __( 'Save %s', 'invoicing' ), |
|
186 | + ucfirst( $invoice->get_invoice_quote_type() ) |
|
187 | + ); |
|
188 | 188 | |
189 | - $i18n['invoice_description'] = sprintf( |
|
190 | - __( '%s Description', 'invoicing' ), |
|
191 | - ucfirst( $invoice->get_invoice_quote_type() ) |
|
192 | - ); |
|
189 | + $i18n['invoice_description'] = sprintf( |
|
190 | + __( '%s Description', 'invoicing' ), |
|
191 | + ucfirst( $invoice->get_invoice_quote_type() ) |
|
192 | + ); |
|
193 | 193 | |
194 | - } |
|
195 | - return $i18n; |
|
196 | - } |
|
194 | + } |
|
195 | + return $i18n; |
|
196 | + } |
|
197 | 197 | |
198 | - /** |
|
199 | - * Change the admin footer text on GetPaid admin pages. |
|
200 | - * |
|
201 | - * @since 2.0.0 |
|
202 | - * @param string $footer_text |
|
203 | - * @return string |
|
204 | - */ |
|
205 | - public function admin_footer_text( $footer_text ) { |
|
206 | - global $current_screen; |
|
198 | + /** |
|
199 | + * Change the admin footer text on GetPaid admin pages. |
|
200 | + * |
|
201 | + * @since 2.0.0 |
|
202 | + * @param string $footer_text |
|
203 | + * @return string |
|
204 | + */ |
|
205 | + public function admin_footer_text( $footer_text ) { |
|
206 | + global $current_screen; |
|
207 | 207 | |
208 | - $page = isset( $_GET['page'] ) ? $_GET['page'] : ''; |
|
208 | + $page = isset( $_GET['page'] ) ? $_GET['page'] : ''; |
|
209 | 209 | |
210 | 210 | if ( ! empty( $current_screen->post_type ) ) { |
211 | - $page = $current_screen->post_type; |
|
211 | + $page = $current_screen->post_type; |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | // General styles. |
215 | 215 | if ( apply_filters( 'getpaid_display_admin_footer_text', wpinv_current_user_can_manage_invoicing() ) && false !== stripos( $page, 'wpi' ) ) { |
216 | 216 | |
217 | - // Change the footer text |
|
218 | - if ( ! get_user_meta( get_current_user_id(), 'getpaid_admin_footer_text_rated', true ) ) { |
|
219 | - |
|
220 | - $rating_url = esc_url( |
|
221 | - wp_nonce_url( |
|
222 | - admin_url( 'admin.php?page=wpinv-reports&getpaid-admin-action=rate_plugin' ), |
|
223 | - 'getpaid-nonce', |
|
224 | - 'getpaid-nonce' |
|
225 | - ) |
|
226 | - ); |
|
227 | - |
|
228 | - $footer_text = sprintf( |
|
229 | - /* translators: %s: five stars */ |
|
230 | - __( 'If you like <strong>GetPaid</strong>, please leave us a %s rating. A huge thanks in advance!', 'invoicing' ), |
|
231 | - "<a href='$rating_url'>★★★★★</a>" |
|
232 | - ); |
|
233 | - |
|
234 | - } else { |
|
235 | - |
|
236 | - $footer_text = sprintf( |
|
237 | - /* translators: %s: GetPaid */ |
|
238 | - __( 'Thank you for using %s!', 'invoicing' ), |
|
239 | - "<a href='https://wpgetpaid.com/' target='_blank'><strong>GetPaid</strong></a>" |
|
240 | - ); |
|
241 | - |
|
242 | - } |
|
243 | - |
|
244 | - } |
|
245 | - |
|
246 | - return $footer_text; |
|
247 | - } |
|
248 | - |
|
249 | - /** |
|
250 | - * Redirects to wp.org to rate the plugin. |
|
251 | - * |
|
252 | - * @since 2.0.0 |
|
253 | - */ |
|
254 | - public function redirect_to_wordpress_rating_page() { |
|
255 | - update_user_meta( get_current_user_id(), 'getpaid_admin_footer_text_rated', 1 ); |
|
256 | - wp_redirect( 'https://wordpress.org/support/plugin/invoicing/reviews?rate=5#new-post' ); |
|
257 | - exit; |
|
258 | - } |
|
217 | + // Change the footer text |
|
218 | + if ( ! get_user_meta( get_current_user_id(), 'getpaid_admin_footer_text_rated', true ) ) { |
|
219 | + |
|
220 | + $rating_url = esc_url( |
|
221 | + wp_nonce_url( |
|
222 | + admin_url( 'admin.php?page=wpinv-reports&getpaid-admin-action=rate_plugin' ), |
|
223 | + 'getpaid-nonce', |
|
224 | + 'getpaid-nonce' |
|
225 | + ) |
|
226 | + ); |
|
227 | + |
|
228 | + $footer_text = sprintf( |
|
229 | + /* translators: %s: five stars */ |
|
230 | + __( 'If you like <strong>GetPaid</strong>, please leave us a %s rating. A huge thanks in advance!', 'invoicing' ), |
|
231 | + "<a href='$rating_url'>★★★★★</a>" |
|
232 | + ); |
|
233 | + |
|
234 | + } else { |
|
235 | + |
|
236 | + $footer_text = sprintf( |
|
237 | + /* translators: %s: GetPaid */ |
|
238 | + __( 'Thank you for using %s!', 'invoicing' ), |
|
239 | + "<a href='https://wpgetpaid.com/' target='_blank'><strong>GetPaid</strong></a>" |
|
240 | + ); |
|
241 | + |
|
242 | + } |
|
243 | + |
|
244 | + } |
|
245 | + |
|
246 | + return $footer_text; |
|
247 | + } |
|
259 | 248 | |
260 | 249 | /** |
261 | - * Loads payment form js. |
|
262 | - * |
|
263 | - */ |
|
264 | - protected function load_payment_form_scripts() { |
|
250 | + * Redirects to wp.org to rate the plugin. |
|
251 | + * |
|
252 | + * @since 2.0.0 |
|
253 | + */ |
|
254 | + public function redirect_to_wordpress_rating_page() { |
|
255 | + update_user_meta( get_current_user_id(), 'getpaid_admin_footer_text_rated', 1 ); |
|
256 | + wp_redirect( 'https://wordpress.org/support/plugin/invoicing/reviews?rate=5#new-post' ); |
|
257 | + exit; |
|
258 | + } |
|
259 | + |
|
260 | + /** |
|
261 | + * Loads payment form js. |
|
262 | + * |
|
263 | + */ |
|
264 | + protected function load_payment_form_scripts() { |
|
265 | 265 | global $post; |
266 | 266 | |
267 | 267 | wp_enqueue_script( 'vue', WPINV_PLUGIN_URL . 'assets/js/vue/vue.js', array(), WPINV_VERSION ); |
268 | - wp_enqueue_script( 'sortable', WPINV_PLUGIN_URL . 'assets/js/sortable.min.js', array(), WPINV_VERSION ); |
|
269 | - wp_enqueue_script( 'vue_draggable', WPINV_PLUGIN_URL . 'assets/js/vue/vuedraggable.min.js', array( 'sortable', 'vue' ), WPINV_VERSION ); |
|
268 | + wp_enqueue_script( 'sortable', WPINV_PLUGIN_URL . 'assets/js/sortable.min.js', array(), WPINV_VERSION ); |
|
269 | + wp_enqueue_script( 'vue_draggable', WPINV_PLUGIN_URL . 'assets/js/vue/vuedraggable.min.js', array( 'sortable', 'vue' ), WPINV_VERSION ); |
|
270 | 270 | |
271 | - $version = filemtime( WPINV_PLUGIN_DIR . 'assets/js/admin-payment-forms.js' ); |
|
272 | - wp_register_script( 'wpinv-admin-payment-form-script', WPINV_PLUGIN_URL . 'assets/js/admin-payment-forms.js', array( 'wpinv-admin-script', 'vue_draggable' ), $version ); |
|
271 | + $version = filemtime( WPINV_PLUGIN_DIR . 'assets/js/admin-payment-forms.js' ); |
|
272 | + wp_register_script( 'wpinv-admin-payment-form-script', WPINV_PLUGIN_URL . 'assets/js/admin-payment-forms.js', array( 'wpinv-admin-script', 'vue_draggable' ), $version ); |
|
273 | 273 | |
274 | - wp_localize_script( |
|
274 | + wp_localize_script( |
|
275 | 275 | 'wpinv-admin-payment-form-script', |
276 | 276 | 'wpinvPaymentFormAdmin', |
277 | 277 | array( |
278 | - 'elements' => wpinv_get_data( 'payment-form-elements' ), |
|
279 | - 'form_elements' => getpaid_get_payment_form_elements( $post->ID ), |
|
280 | - 'currency' => wpinv_currency_symbol(), |
|
281 | - 'position' => wpinv_currency_position(), |
|
282 | - 'decimals' => (int) wpinv_decimals(), |
|
283 | - 'thousands_sep' => wpinv_thousands_separator(), |
|
284 | - 'decimals_sep' => wpinv_decimal_separator(), |
|
285 | - 'form_items' => gepaid_get_form_items( $post->ID ), |
|
286 | - 'is_default' => $post->ID == wpinv_get_default_payment_form(), |
|
278 | + 'elements' => wpinv_get_data( 'payment-form-elements' ), |
|
279 | + 'form_elements' => getpaid_get_payment_form_elements( $post->ID ), |
|
280 | + 'currency' => wpinv_currency_symbol(), |
|
281 | + 'position' => wpinv_currency_position(), |
|
282 | + 'decimals' => (int) wpinv_decimals(), |
|
283 | + 'thousands_sep' => wpinv_thousands_separator(), |
|
284 | + 'decimals_sep' => wpinv_decimal_separator(), |
|
285 | + 'form_items' => gepaid_get_form_items( $post->ID ), |
|
286 | + 'is_default' => $post->ID == wpinv_get_default_payment_form(), |
|
287 | 287 | ) |
288 | 288 | ); |
289 | 289 | |
@@ -292,20 +292,20 @@ discard block |
||
292 | 292 | } |
293 | 293 | |
294 | 294 | /** |
295 | - * Add our classes to admin pages. |
|
295 | + * Add our classes to admin pages. |
|
296 | 296 | * |
297 | 297 | * @param string $classes |
298 | 298 | * @return string |
299 | - * |
|
300 | - */ |
|
299 | + * |
|
300 | + */ |
|
301 | 301 | public function admin_body_class( $classes ) { |
302 | - global $pagenow, $post, $current_screen; |
|
302 | + global $pagenow, $post, $current_screen; |
|
303 | 303 | |
304 | 304 | |
305 | 305 | $page = isset( $_GET['page'] ) ? $_GET['page'] : ''; |
306 | 306 | |
307 | 307 | if ( ! empty( $current_screen->post_type ) ) { |
308 | - $page = $current_screen->post_type; |
|
308 | + $page = $current_screen->post_type; |
|
309 | 309 | } |
310 | 310 | |
311 | 311 | if ( false !== stripos( $page, 'wpi' ) ) { |
@@ -314,59 +314,59 @@ discard block |
||
314 | 314 | |
315 | 315 | if ( in_array( $page, wpinv_parse_list( 'wpi_invoice wpi_payment_form wpi_quote' ) ) ) { |
316 | 316 | $classes .= ' wpinv-cpt wpinv'; |
317 | - } |
|
317 | + } |
|
318 | 318 | |
319 | - if ( getpaid_is_invoice_post_type( $page ) ) { |
|
319 | + if ( getpaid_is_invoice_post_type( $page ) ) { |
|
320 | 320 | $classes .= ' getpaid-is-invoice-cpt'; |
321 | 321 | } |
322 | 322 | |
323 | - return $classes; |
|
323 | + return $classes; |
|
324 | 324 | } |
325 | 325 | |
326 | 326 | /** |
327 | - * Maybe show the AyeCode Connect Notice. |
|
328 | - */ |
|
329 | - public function init_ayecode_connect_helper(){ |
|
327 | + * Maybe show the AyeCode Connect Notice. |
|
328 | + */ |
|
329 | + public function init_ayecode_connect_helper(){ |
|
330 | 330 | |
331 | 331 | new AyeCode_Connect_Helper( |
332 | 332 | array( |
333 | - 'connect_title' => __("WP Invoicing - an AyeCode product!","invoicing"), |
|
334 | - 'connect_external' => __( "Please confirm you wish to connect your site?","invoicing" ), |
|
335 | - 'connect' => sprintf( __( "<strong>Have a license?</strong> Forget about entering license keys or downloading zip files, connect your site for instant access. %slearn more%s","invoicing" ),"<a href='https://ayecode.io/introducing-ayecode-connect/' target='_blank'>","</a>" ), |
|
336 | - 'connect_button' => __("Connect Site","invoicing"), |
|
337 | - 'connecting_button' => __("Connecting...","invoicing"), |
|
338 | - 'error_localhost' => __( "This service will only work with a live domain, not a localhost.","invoicing" ), |
|
339 | - 'error' => __( "Something went wrong, please refresh and try again.","invoicing" ), |
|
333 | + 'connect_title' => __("WP Invoicing - an AyeCode product!","invoicing"), |
|
334 | + 'connect_external' => __( "Please confirm you wish to connect your site?","invoicing" ), |
|
335 | + 'connect' => sprintf( __( "<strong>Have a license?</strong> Forget about entering license keys or downloading zip files, connect your site for instant access. %slearn more%s","invoicing" ),"<a href='https://ayecode.io/introducing-ayecode-connect/' target='_blank'>","</a>" ), |
|
336 | + 'connect_button' => __("Connect Site","invoicing"), |
|
337 | + 'connecting_button' => __("Connecting...","invoicing"), |
|
338 | + 'error_localhost' => __( "This service will only work with a live domain, not a localhost.","invoicing" ), |
|
339 | + 'error' => __( "Something went wrong, please refresh and try again.","invoicing" ), |
|
340 | 340 | ), |
341 | 341 | array( 'wpi-addons' ) |
342 | 342 | ); |
343 | 343 | |
344 | 344 | } |
345 | 345 | |
346 | - /** |
|
347 | - * Redirect users to settings on activation. |
|
348 | - * |
|
349 | - * @return void |
|
350 | - */ |
|
351 | - public function activation_redirect() { |
|
346 | + /** |
|
347 | + * Redirect users to settings on activation. |
|
348 | + * |
|
349 | + * @return void |
|
350 | + */ |
|
351 | + public function activation_redirect() { |
|
352 | 352 | |
353 | - $redirected = get_option( 'wpinv_redirected_to_settings' ); |
|
353 | + $redirected = get_option( 'wpinv_redirected_to_settings' ); |
|
354 | 354 | |
355 | - if ( ! empty( $redirected ) || wp_doing_ajax() || ! current_user_can( 'manage_options' ) ) { |
|
356 | - return; |
|
357 | - } |
|
355 | + if ( ! empty( $redirected ) || wp_doing_ajax() || ! current_user_can( 'manage_options' ) ) { |
|
356 | + return; |
|
357 | + } |
|
358 | 358 | |
359 | - // Bail if activating from network, or bulk |
|
360 | - if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { |
|
361 | - return; |
|
362 | - } |
|
359 | + // Bail if activating from network, or bulk |
|
360 | + if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { |
|
361 | + return; |
|
362 | + } |
|
363 | 363 | |
364 | - update_option( 'wpinv_redirected_to_settings', 1 ); |
|
364 | + update_option( 'wpinv_redirected_to_settings', 1 ); |
|
365 | 365 | |
366 | 366 | wp_safe_redirect( admin_url( 'admin.php?page=wpinv-settings&tab=general' ) ); |
367 | 367 | exit; |
368 | 368 | |
369 | - } |
|
369 | + } |
|
370 | 370 | |
371 | 371 | /** |
372 | 372 | * Fires an admin action after verifying that a user can fire them. |
@@ -380,304 +380,304 @@ discard block |
||
380 | 380 | |
381 | 381 | } |
382 | 382 | |
383 | - /** |
|
383 | + /** |
|
384 | 384 | * Sends a payment reminder to a customer. |
385 | - * |
|
386 | - * @param array $args |
|
385 | + * |
|
386 | + * @param array $args |
|
387 | 387 | */ |
388 | 388 | public function send_customer_invoice( $args ) { |
389 | - $sent = getpaid()->get( 'invoice_emails' )->user_invoice( new WPInv_Invoice( $args['invoice_id'] ), true ); |
|
389 | + $sent = getpaid()->get( 'invoice_emails' )->user_invoice( new WPInv_Invoice( $args['invoice_id'] ), true ); |
|
390 | 390 | |
391 | - if ( $sent ) { |
|
392 | - $this->show_success( __( 'Invoice was successfully sent to the customer', 'invoicing' ) ); |
|
393 | - } else { |
|
394 | - $this->show_error( __( 'Could not send the invoice to the customer', 'invoicing' ) ); |
|
395 | - } |
|
391 | + if ( $sent ) { |
|
392 | + $this->show_success( __( 'Invoice was successfully sent to the customer', 'invoicing' ) ); |
|
393 | + } else { |
|
394 | + $this->show_error( __( 'Could not send the invoice to the customer', 'invoicing' ) ); |
|
395 | + } |
|
396 | 396 | |
397 | - wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce', 'invoice_id' ) ) ); |
|
398 | - exit; |
|
399 | - } |
|
397 | + wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce', 'invoice_id' ) ) ); |
|
398 | + exit; |
|
399 | + } |
|
400 | 400 | |
401 | - /** |
|
401 | + /** |
|
402 | 402 | * Sends a payment reminder to a customer. |
403 | - * |
|
404 | - * @param array $args |
|
403 | + * |
|
404 | + * @param array $args |
|
405 | 405 | */ |
406 | 406 | public function send_customer_payment_reminder( $args ) { |
407 | - $sent = getpaid()->get( 'invoice_emails' )->force_send_overdue_notice( new WPInv_Invoice( $args['invoice_id'] ) ); |
|
407 | + $sent = getpaid()->get( 'invoice_emails' )->force_send_overdue_notice( new WPInv_Invoice( $args['invoice_id'] ) ); |
|
408 | 408 | |
409 | - if ( $sent ) { |
|
410 | - $this->show_success( __( 'Payment reminder was successfully sent to the customer', 'invoicing' ) ); |
|
411 | - } else { |
|
412 | - $this->show_error( __( 'Could not sent payment reminder to the customer', 'invoicing' ) ); |
|
413 | - } |
|
409 | + if ( $sent ) { |
|
410 | + $this->show_success( __( 'Payment reminder was successfully sent to the customer', 'invoicing' ) ); |
|
411 | + } else { |
|
412 | + $this->show_error( __( 'Could not sent payment reminder to the customer', 'invoicing' ) ); |
|
413 | + } |
|
414 | 414 | |
415 | - wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce', 'invoice_id' ) ) ); |
|
416 | - exit; |
|
417 | - } |
|
415 | + wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce', 'invoice_id' ) ) ); |
|
416 | + exit; |
|
417 | + } |
|
418 | 418 | |
419 | - /** |
|
419 | + /** |
|
420 | 420 | * Resets tax rates. |
421 | - * |
|
421 | + * |
|
422 | 422 | */ |
423 | 423 | public function admin_reset_tax_rates() { |
424 | 424 | |
425 | - update_option( 'wpinv_tax_rates', wpinv_get_data( 'tax-rates' ) ); |
|
426 | - wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce' ) ) ); |
|
427 | - exit; |
|
425 | + update_option( 'wpinv_tax_rates', wpinv_get_data( 'tax-rates' ) ); |
|
426 | + wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce' ) ) ); |
|
427 | + exit; |
|
428 | 428 | |
429 | - } |
|
429 | + } |
|
430 | 430 | |
431 | - /** |
|
431 | + /** |
|
432 | 432 | * Resets admin pages. |
433 | - * |
|
433 | + * |
|
434 | 434 | */ |
435 | 435 | public function admin_create_missing_pages() { |
436 | - $installer = new GetPaid_Installer(); |
|
437 | - $installer->create_pages(); |
|
438 | - $this->show_success( __( 'GetPaid pages updated.', 'invoicing' ) ); |
|
439 | - wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce' ) ) ); |
|
440 | - exit; |
|
441 | - } |
|
442 | - |
|
443 | - /** |
|
436 | + $installer = new GetPaid_Installer(); |
|
437 | + $installer->create_pages(); |
|
438 | + $this->show_success( __( 'GetPaid pages updated.', 'invoicing' ) ); |
|
439 | + wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce' ) ) ); |
|
440 | + exit; |
|
441 | + } |
|
442 | + |
|
443 | + /** |
|
444 | 444 | * Creates an missing admin tables. |
445 | - * |
|
445 | + * |
|
446 | 446 | */ |
447 | 447 | public function admin_create_missing_tables() { |
448 | - global $wpdb; |
|
449 | - $installer = new GetPaid_Installer(); |
|
448 | + global $wpdb; |
|
449 | + $installer = new GetPaid_Installer(); |
|
450 | 450 | |
451 | - if ( $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->prefix}wpinv_subscriptions'" ) != $wpdb->prefix . 'wpinv_subscriptions' ) { |
|
452 | - $installer->create_subscriptions_table(); |
|
451 | + if ( $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->prefix}wpinv_subscriptions'" ) != $wpdb->prefix . 'wpinv_subscriptions' ) { |
|
452 | + $installer->create_subscriptions_table(); |
|
453 | 453 | |
454 | - if ( $wpdb->last_error !== '' ) { |
|
455 | - $this->show_error( __( 'Your GetPaid tables have been updated:', 'invoicing' ) . ' ' . $wpdb->last_error ); |
|
456 | - } |
|
457 | - } |
|
454 | + if ( $wpdb->last_error !== '' ) { |
|
455 | + $this->show_error( __( 'Your GetPaid tables have been updated:', 'invoicing' ) . ' ' . $wpdb->last_error ); |
|
456 | + } |
|
457 | + } |
|
458 | 458 | |
459 | - if ( $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->prefix}getpaid_invoices'" ) != $wpdb->prefix . 'getpaid_invoices' ) { |
|
460 | - $installer->create_invoices_table(); |
|
459 | + if ( $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->prefix}getpaid_invoices'" ) != $wpdb->prefix . 'getpaid_invoices' ) { |
|
460 | + $installer->create_invoices_table(); |
|
461 | 461 | |
462 | - if ( $wpdb->last_error !== '' ) { |
|
463 | - $this->show_error( __( 'Your GetPaid tables have been updated:', 'invoicing' ) . ' ' . $wpdb->last_error ); |
|
464 | - } |
|
465 | - } |
|
462 | + if ( $wpdb->last_error !== '' ) { |
|
463 | + $this->show_error( __( 'Your GetPaid tables have been updated:', 'invoicing' ) . ' ' . $wpdb->last_error ); |
|
464 | + } |
|
465 | + } |
|
466 | 466 | |
467 | - if ( $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->prefix}getpaid_invoice_items'" ) != $wpdb->prefix . 'getpaid_invoice_items' ) { |
|
468 | - $installer->create_invoice_items_table(); |
|
467 | + if ( $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->prefix}getpaid_invoice_items'" ) != $wpdb->prefix . 'getpaid_invoice_items' ) { |
|
468 | + $installer->create_invoice_items_table(); |
|
469 | 469 | |
470 | - if ( $wpdb->last_error !== '' ) { |
|
471 | - $this->show_error( __( 'Your GetPaid tables have been updated:', 'invoicing' ) . ' ' . $wpdb->last_error ); |
|
472 | - } |
|
473 | - } |
|
470 | + if ( $wpdb->last_error !== '' ) { |
|
471 | + $this->show_error( __( 'Your GetPaid tables have been updated:', 'invoicing' ) . ' ' . $wpdb->last_error ); |
|
472 | + } |
|
473 | + } |
|
474 | 474 | |
475 | - if ( ! $this->has_notices() ) { |
|
476 | - $this->show_success( __( 'Your GetPaid tables have been updated.', 'invoicing' ) ); |
|
477 | - } |
|
475 | + if ( ! $this->has_notices() ) { |
|
476 | + $this->show_success( __( 'Your GetPaid tables have been updated.', 'invoicing' ) ); |
|
477 | + } |
|
478 | 478 | |
479 | - wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce' ) ) ); |
|
480 | - exit; |
|
481 | - } |
|
479 | + wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce' ) ) ); |
|
480 | + exit; |
|
481 | + } |
|
482 | 482 | |
483 | - /** |
|
483 | + /** |
|
484 | 484 | * Migrates old invoices to the new database tables. |
485 | - * |
|
485 | + * |
|
486 | 486 | */ |
487 | 487 | public function admin_migrate_old_invoices() { |
488 | 488 | |
489 | - // Migrate the invoices. |
|
490 | - $installer = new GetPaid_Installer(); |
|
491 | - $installer->migrate_old_invoices(); |
|
489 | + // Migrate the invoices. |
|
490 | + $installer = new GetPaid_Installer(); |
|
491 | + $installer->migrate_old_invoices(); |
|
492 | 492 | |
493 | - // Show an admin message. |
|
494 | - $this->show_success( __( 'Your invoices have been migrated.', 'invoicing' ) ); |
|
493 | + // Show an admin message. |
|
494 | + $this->show_success( __( 'Your invoices have been migrated.', 'invoicing' ) ); |
|
495 | 495 | |
496 | - // Redirect the admin. |
|
497 | - wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce' ) ) ); |
|
498 | - exit; |
|
496 | + // Redirect the admin. |
|
497 | + wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce' ) ) ); |
|
498 | + exit; |
|
499 | 499 | |
500 | - } |
|
500 | + } |
|
501 | 501 | |
502 | - /** |
|
502 | + /** |
|
503 | 503 | * Recalculates discounts. |
504 | - * |
|
504 | + * |
|
505 | 505 | */ |
506 | 506 | public function admin_recalculate_discounts() { |
507 | - global $wpdb; |
|
507 | + global $wpdb; |
|
508 | 508 | |
509 | - // Fetch all invoices that have discount codes. |
|
510 | - $table = $wpdb->prefix . 'getpaid_invoices'; |
|
511 | - $invoices = $wpdb->get_col( "SELECT `post_id` FROM `$table` WHERE `discount` = 0 && `discount_code` <> ''" ); |
|
509 | + // Fetch all invoices that have discount codes. |
|
510 | + $table = $wpdb->prefix . 'getpaid_invoices'; |
|
511 | + $invoices = $wpdb->get_col( "SELECT `post_id` FROM `$table` WHERE `discount` = 0 && `discount_code` <> ''" ); |
|
512 | 512 | |
513 | - foreach ( $invoices as $invoice ) { |
|
513 | + foreach ( $invoices as $invoice ) { |
|
514 | 514 | |
515 | - $invoice = new WPInv_Invoice( $invoice ); |
|
515 | + $invoice = new WPInv_Invoice( $invoice ); |
|
516 | 516 | |
517 | - if ( ! $invoice->exists() ) { |
|
518 | - continue; |
|
519 | - } |
|
517 | + if ( ! $invoice->exists() ) { |
|
518 | + continue; |
|
519 | + } |
|
520 | 520 | |
521 | - // Abort if the discount does not exist or does not apply here. |
|
522 | - $discount = new WPInv_Discount( $invoice->get_discount_code() ); |
|
523 | - if ( ! $discount->exists() ) { |
|
524 | - continue; |
|
525 | - } |
|
521 | + // Abort if the discount does not exist or does not apply here. |
|
522 | + $discount = new WPInv_Discount( $invoice->get_discount_code() ); |
|
523 | + if ( ! $discount->exists() ) { |
|
524 | + continue; |
|
525 | + } |
|
526 | 526 | |
527 | - $invoice->add_discount( getpaid_calculate_invoice_discount( $invoice, $discount ) ); |
|
528 | - $invoice->recalculate_total(); |
|
527 | + $invoice->add_discount( getpaid_calculate_invoice_discount( $invoice, $discount ) ); |
|
528 | + $invoice->recalculate_total(); |
|
529 | 529 | |
530 | - if ( $invoice->get_total_discount() > 0 ) { |
|
531 | - $invoice->save(); |
|
532 | - } |
|
530 | + if ( $invoice->get_total_discount() > 0 ) { |
|
531 | + $invoice->save(); |
|
532 | + } |
|
533 | 533 | |
534 | - } |
|
534 | + } |
|
535 | 535 | |
536 | - // Show an admin message. |
|
537 | - $this->show_success( __( 'Discounts have been recalculated.', 'invoicing' ) ); |
|
536 | + // Show an admin message. |
|
537 | + $this->show_success( __( 'Discounts have been recalculated.', 'invoicing' ) ); |
|
538 | 538 | |
539 | - // Redirect the admin. |
|
540 | - wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce' ) ) ); |
|
541 | - exit; |
|
539 | + // Redirect the admin. |
|
540 | + wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce' ) ) ); |
|
541 | + exit; |
|
542 | 542 | |
543 | - } |
|
543 | + } |
|
544 | 544 | |
545 | 545 | /** |
546 | - * Returns an array of admin notices. |
|
547 | - * |
|
548 | - * @since 1.0.19 |
|
546 | + * Returns an array of admin notices. |
|
547 | + * |
|
548 | + * @since 1.0.19 |
|
549 | 549 | * @return array |
550 | - */ |
|
551 | - public function get_notices() { |
|
552 | - $notices = get_option( 'wpinv_admin_notices' ); |
|
550 | + */ |
|
551 | + public function get_notices() { |
|
552 | + $notices = get_option( 'wpinv_admin_notices' ); |
|
553 | 553 | return is_array( $notices ) ? $notices : array(); |
554 | - } |
|
554 | + } |
|
555 | 555 | |
556 | - /** |
|
557 | - * Checks if we have any admin notices. |
|
558 | - * |
|
559 | - * @since 2.0.4 |
|
556 | + /** |
|
557 | + * Checks if we have any admin notices. |
|
558 | + * |
|
559 | + * @since 2.0.4 |
|
560 | 560 | * @return array |
561 | - */ |
|
562 | - public function has_notices() { |
|
563 | - return count( $this->get_notices() ) > 0; |
|
564 | - } |
|
565 | - |
|
566 | - /** |
|
567 | - * Clears all admin notices |
|
568 | - * |
|
569 | - * @access public |
|
570 | - * @since 1.0.19 |
|
571 | - */ |
|
572 | - public function clear_notices() { |
|
573 | - delete_option( 'wpinv_admin_notices' ); |
|
574 | - } |
|
575 | - |
|
576 | - /** |
|
577 | - * Saves a new admin notice |
|
578 | - * |
|
579 | - * @access public |
|
580 | - * @since 1.0.19 |
|
581 | - */ |
|
582 | - public function save_notice( $type, $message ) { |
|
583 | - $notices = $this->get_notices(); |
|
584 | - |
|
585 | - if ( empty( $notices[ $type ] ) || ! is_array( $notices[ $type ]) ) { |
|
586 | - $notices[ $type ] = array(); |
|
587 | - } |
|
588 | - |
|
589 | - $notices[ $type ][] = $message; |
|
590 | - |
|
591 | - update_option( 'wpinv_admin_notices', $notices ); |
|
592 | - } |
|
593 | - |
|
594 | - /** |
|
595 | - * Displays a success notice |
|
596 | - * |
|
597 | - * @param string $msg The message to qeue. |
|
598 | - * @access public |
|
599 | - * @since 1.0.19 |
|
600 | - */ |
|
601 | - public function show_success( $msg ) { |
|
602 | - $this->save_notice( 'success', $msg ); |
|
603 | - } |
|
604 | - |
|
605 | - /** |
|
606 | - * Displays a error notice |
|
607 | - * |
|
608 | - * @access public |
|
609 | - * @param string $msg The message to qeue. |
|
610 | - * @since 1.0.19 |
|
611 | - */ |
|
612 | - public function show_error( $msg ) { |
|
613 | - $this->save_notice( 'error', $msg ); |
|
614 | - } |
|
615 | - |
|
616 | - /** |
|
617 | - * Displays a warning notice |
|
618 | - * |
|
619 | - * @access public |
|
620 | - * @param string $msg The message to qeue. |
|
621 | - * @since 1.0.19 |
|
622 | - */ |
|
623 | - public function show_warning( $msg ) { |
|
624 | - $this->save_notice( 'warning', $msg ); |
|
625 | - } |
|
626 | - |
|
627 | - /** |
|
628 | - * Displays a info notice |
|
629 | - * |
|
630 | - * @access public |
|
631 | - * @param string $msg The message to qeue. |
|
632 | - * @since 1.0.19 |
|
633 | - */ |
|
634 | - public function show_info( $msg ) { |
|
635 | - $this->save_notice( 'info', $msg ); |
|
636 | - } |
|
637 | - |
|
638 | - /** |
|
639 | - * Show notices |
|
640 | - * |
|
641 | - * @access public |
|
642 | - * @since 1.0.19 |
|
643 | - */ |
|
644 | - public function show_notices() { |
|
561 | + */ |
|
562 | + public function has_notices() { |
|
563 | + return count( $this->get_notices() ) > 0; |
|
564 | + } |
|
565 | + |
|
566 | + /** |
|
567 | + * Clears all admin notices |
|
568 | + * |
|
569 | + * @access public |
|
570 | + * @since 1.0.19 |
|
571 | + */ |
|
572 | + public function clear_notices() { |
|
573 | + delete_option( 'wpinv_admin_notices' ); |
|
574 | + } |
|
575 | + |
|
576 | + /** |
|
577 | + * Saves a new admin notice |
|
578 | + * |
|
579 | + * @access public |
|
580 | + * @since 1.0.19 |
|
581 | + */ |
|
582 | + public function save_notice( $type, $message ) { |
|
583 | + $notices = $this->get_notices(); |
|
584 | + |
|
585 | + if ( empty( $notices[ $type ] ) || ! is_array( $notices[ $type ]) ) { |
|
586 | + $notices[ $type ] = array(); |
|
587 | + } |
|
588 | + |
|
589 | + $notices[ $type ][] = $message; |
|
590 | + |
|
591 | + update_option( 'wpinv_admin_notices', $notices ); |
|
592 | + } |
|
593 | + |
|
594 | + /** |
|
595 | + * Displays a success notice |
|
596 | + * |
|
597 | + * @param string $msg The message to qeue. |
|
598 | + * @access public |
|
599 | + * @since 1.0.19 |
|
600 | + */ |
|
601 | + public function show_success( $msg ) { |
|
602 | + $this->save_notice( 'success', $msg ); |
|
603 | + } |
|
604 | + |
|
605 | + /** |
|
606 | + * Displays a error notice |
|
607 | + * |
|
608 | + * @access public |
|
609 | + * @param string $msg The message to qeue. |
|
610 | + * @since 1.0.19 |
|
611 | + */ |
|
612 | + public function show_error( $msg ) { |
|
613 | + $this->save_notice( 'error', $msg ); |
|
614 | + } |
|
615 | + |
|
616 | + /** |
|
617 | + * Displays a warning notice |
|
618 | + * |
|
619 | + * @access public |
|
620 | + * @param string $msg The message to qeue. |
|
621 | + * @since 1.0.19 |
|
622 | + */ |
|
623 | + public function show_warning( $msg ) { |
|
624 | + $this->save_notice( 'warning', $msg ); |
|
625 | + } |
|
626 | + |
|
627 | + /** |
|
628 | + * Displays a info notice |
|
629 | + * |
|
630 | + * @access public |
|
631 | + * @param string $msg The message to qeue. |
|
632 | + * @since 1.0.19 |
|
633 | + */ |
|
634 | + public function show_info( $msg ) { |
|
635 | + $this->save_notice( 'info', $msg ); |
|
636 | + } |
|
637 | + |
|
638 | + /** |
|
639 | + * Show notices |
|
640 | + * |
|
641 | + * @access public |
|
642 | + * @since 1.0.19 |
|
643 | + */ |
|
644 | + public function show_notices() { |
|
645 | 645 | |
646 | 646 | $notices = $this->get_notices(); |
647 | 647 | $this->clear_notices(); |
648 | 648 | |
649 | - foreach ( $notices as $type => $messages ) { |
|
649 | + foreach ( $notices as $type => $messages ) { |
|
650 | 650 | |
651 | - if ( ! is_array( $messages ) ) { |
|
652 | - continue; |
|
653 | - } |
|
651 | + if ( ! is_array( $messages ) ) { |
|
652 | + continue; |
|
653 | + } |
|
654 | 654 | |
655 | 655 | $type = sanitize_key( $type ); |
656 | - foreach ( $messages as $message ) { |
|
656 | + foreach ( $messages as $message ) { |
|
657 | 657 | $message = wp_kses_post( $message ); |
658 | - echo "<div class='notice notice-$type is-dismissible'><p>$message</p></div>"; |
|
658 | + echo "<div class='notice notice-$type is-dismissible'><p>$message</p></div>"; |
|
659 | + } |
|
660 | + |
|
661 | + } |
|
662 | + |
|
663 | + foreach ( array( 'checkout_page', 'invoice_history_page', 'success_page', 'failure_page', 'invoice_subscription_page' ) as $page ) { |
|
664 | + |
|
665 | + if ( ! is_numeric( wpinv_get_option( $page, false ) ) ) { |
|
666 | + $url = esc_url( |
|
667 | + wp_nonce_url( |
|
668 | + add_query_arg( 'getpaid-admin-action', 'create_missing_pages' ), |
|
669 | + 'getpaid-nonce', |
|
670 | + 'getpaid-nonce' |
|
671 | + ) |
|
672 | + ); |
|
673 | + $message = __( 'Some GetPaid pages are missing. To use GetPaid without any issues, click the button below to generate the missing pages.', 'invoicing' ); |
|
674 | + $message2 = __( 'Generate Pages', 'invoicing' ); |
|
675 | + echo "<div class='notice notice-warning is-dismissible'><p>$message<br><br><a href='$url' class='button button-primary'>$message2</a></p></div>"; |
|
676 | + break; |
|
659 | 677 | } |
660 | 678 | |
661 | 679 | } |
662 | 680 | |
663 | - foreach ( array( 'checkout_page', 'invoice_history_page', 'success_page', 'failure_page', 'invoice_subscription_page' ) as $page ) { |
|
664 | - |
|
665 | - if ( ! is_numeric( wpinv_get_option( $page, false ) ) ) { |
|
666 | - $url = esc_url( |
|
667 | - wp_nonce_url( |
|
668 | - add_query_arg( 'getpaid-admin-action', 'create_missing_pages' ), |
|
669 | - 'getpaid-nonce', |
|
670 | - 'getpaid-nonce' |
|
671 | - ) |
|
672 | - ); |
|
673 | - $message = __( 'Some GetPaid pages are missing. To use GetPaid without any issues, click the button below to generate the missing pages.', 'invoicing' ); |
|
674 | - $message2 = __( 'Generate Pages', 'invoicing' ); |
|
675 | - echo "<div class='notice notice-warning is-dismissible'><p>$message<br><br><a href='$url' class='button button-primary'>$message2</a></p></div>"; |
|
676 | - break; |
|
677 | - } |
|
678 | - |
|
679 | - } |
|
680 | - |
|
681 | - } |
|
681 | + } |
|
682 | 682 | |
683 | 683 | } |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | * |
5 | 5 | */ |
6 | 6 | |
7 | -defined( 'ABSPATH' ) || exit; |
|
7 | +defined('ABSPATH') || exit; |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * The main admin class. |
@@ -37,13 +37,13 @@ discard block |
||
37 | 37 | /** |
38 | 38 | * Class constructor. |
39 | 39 | */ |
40 | - public function __construct(){ |
|
40 | + public function __construct() { |
|
41 | 41 | |
42 | - $this->admin_path = plugin_dir_path( __FILE__ ); |
|
43 | - $this->admin_url = plugins_url( '/', __FILE__ ); |
|
42 | + $this->admin_path = plugin_dir_path(__FILE__); |
|
43 | + $this->admin_url = plugins_url('/', __FILE__); |
|
44 | 44 | $this->reports = new GetPaid_Reports(); |
45 | 45 | |
46 | - if ( is_admin() ) { |
|
46 | + if (is_admin()) { |
|
47 | 47 | $this->init_admin_hooks(); |
48 | 48 | } |
49 | 49 | |
@@ -54,22 +54,22 @@ discard block |
||
54 | 54 | * |
55 | 55 | */ |
56 | 56 | private function init_admin_hooks() { |
57 | - add_action( 'admin_enqueue_scripts', array( $this, 'enqeue_scripts' ) ); |
|
58 | - add_filter( 'admin_body_class', array( $this, 'admin_body_class' ) ); |
|
59 | - add_action( 'admin_init', array( $this, 'init_ayecode_connect_helper' ) ); |
|
60 | - add_action( 'admin_init', array( $this, 'activation_redirect') ); |
|
61 | - add_action( 'admin_init', array( $this, 'maybe_do_admin_action') ); |
|
62 | - add_action( 'admin_notices', array( $this, 'show_notices' ) ); |
|
63 | - add_action( 'getpaid_authenticated_admin_action_rate_plugin', array( $this, 'redirect_to_wordpress_rating_page' ) ); |
|
64 | - add_action( 'getpaid_authenticated_admin_action_send_invoice', array( $this, 'send_customer_invoice' ) ); |
|
65 | - add_action( 'getpaid_authenticated_admin_action_send_invoice_reminder', array( $this, 'send_customer_payment_reminder' ) ); |
|
66 | - add_action( 'getpaid_authenticated_admin_action_reset_tax_rates', array( $this, 'admin_reset_tax_rates' ) ); |
|
67 | - add_action( 'getpaid_authenticated_admin_action_create_missing_pages', array( $this, 'admin_create_missing_pages' ) ); |
|
68 | - add_action( 'getpaid_authenticated_admin_action_create_missing_tables', array( $this, 'admin_create_missing_tables' ) ); |
|
69 | - add_action( 'getpaid_authenticated_admin_action_migrate_old_invoices', array( $this, 'admin_migrate_old_invoices' ) ); |
|
70 | - add_action( 'getpaid_authenticated_admin_action_recalculate_discounts', array( $this, 'admin_recalculate_discounts' ) ); |
|
71 | - add_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ) ); |
|
72 | - do_action( 'getpaid_init_admin_hooks', $this ); |
|
57 | + add_action('admin_enqueue_scripts', array($this, 'enqeue_scripts')); |
|
58 | + add_filter('admin_body_class', array($this, 'admin_body_class')); |
|
59 | + add_action('admin_init', array($this, 'init_ayecode_connect_helper')); |
|
60 | + add_action('admin_init', array($this, 'activation_redirect')); |
|
61 | + add_action('admin_init', array($this, 'maybe_do_admin_action')); |
|
62 | + add_action('admin_notices', array($this, 'show_notices')); |
|
63 | + add_action('getpaid_authenticated_admin_action_rate_plugin', array($this, 'redirect_to_wordpress_rating_page')); |
|
64 | + add_action('getpaid_authenticated_admin_action_send_invoice', array($this, 'send_customer_invoice')); |
|
65 | + add_action('getpaid_authenticated_admin_action_send_invoice_reminder', array($this, 'send_customer_payment_reminder')); |
|
66 | + add_action('getpaid_authenticated_admin_action_reset_tax_rates', array($this, 'admin_reset_tax_rates')); |
|
67 | + add_action('getpaid_authenticated_admin_action_create_missing_pages', array($this, 'admin_create_missing_pages')); |
|
68 | + add_action('getpaid_authenticated_admin_action_create_missing_tables', array($this, 'admin_create_missing_tables')); |
|
69 | + add_action('getpaid_authenticated_admin_action_migrate_old_invoices', array($this, 'admin_migrate_old_invoices')); |
|
70 | + add_action('getpaid_authenticated_admin_action_recalculate_discounts', array($this, 'admin_recalculate_discounts')); |
|
71 | + add_filter('admin_footer_text', array($this, 'admin_footer_text')); |
|
72 | + do_action('getpaid_init_admin_hooks', $this); |
|
73 | 73 | |
74 | 74 | } |
75 | 75 | |
@@ -80,37 +80,37 @@ discard block |
||
80 | 80 | public function enqeue_scripts() { |
81 | 81 | global $current_screen, $pagenow; |
82 | 82 | |
83 | - $page = isset( $_GET['page'] ) ? $_GET['page'] : ''; |
|
83 | + $page = isset($_GET['page']) ? $_GET['page'] : ''; |
|
84 | 84 | $editing = $pagenow == 'post.php' || $pagenow == 'post-new.php'; |
85 | 85 | |
86 | - if ( ! empty( $current_screen->post_type ) ) { |
|
86 | + if (!empty($current_screen->post_type)) { |
|
87 | 87 | $page = $current_screen->post_type; |
88 | 88 | } |
89 | 89 | |
90 | 90 | // General styles. |
91 | - if ( false !== stripos( $page, 'wpi' ) ) { |
|
91 | + if (false !== stripos($page, 'wpi')) { |
|
92 | 92 | |
93 | 93 | // Styles. |
94 | - $version = filemtime( WPINV_PLUGIN_DIR . 'assets/css/admin.css' ); |
|
95 | - wp_enqueue_style( 'wpinv_admin_style', WPINV_PLUGIN_URL . 'assets/css/admin.css', array( 'wp-color-picker' ), $version ); |
|
96 | - wp_enqueue_style( 'select2', WPINV_PLUGIN_URL . 'assets/css/select2/select2.min.css', array(), '4.0.13', 'all' ); |
|
94 | + $version = filemtime(WPINV_PLUGIN_DIR . 'assets/css/admin.css'); |
|
95 | + wp_enqueue_style('wpinv_admin_style', WPINV_PLUGIN_URL . 'assets/css/admin.css', array('wp-color-picker'), $version); |
|
96 | + wp_enqueue_style('select2', WPINV_PLUGIN_URL . 'assets/css/select2/select2.min.css', array(), '4.0.13', 'all'); |
|
97 | 97 | |
98 | 98 | // Scripts. |
99 | - wp_enqueue_script('select2', WPINV_PLUGIN_URL . 'assets/js/select2/select2.full.min.js', array( 'jquery' ), WPINV_VERSION ); |
|
99 | + wp_enqueue_script('select2', WPINV_PLUGIN_URL . 'assets/js/select2/select2.full.min.js', array('jquery'), WPINV_VERSION); |
|
100 | 100 | |
101 | - $version = filemtime( WPINV_PLUGIN_DIR . 'assets/js/admin.js' ); |
|
102 | - wp_enqueue_script( 'wpinv-admin-script', WPINV_PLUGIN_URL . 'assets/js/admin.js', array( 'jquery', 'wp-color-picker' ), $version ); |
|
103 | - wp_localize_script( 'wpinv-admin-script', 'WPInv_Admin', apply_filters( 'wpinv_admin_js_localize', $this->get_admin_i18() ) ); |
|
101 | + $version = filemtime(WPINV_PLUGIN_DIR . 'assets/js/admin.js'); |
|
102 | + wp_enqueue_script('wpinv-admin-script', WPINV_PLUGIN_URL . 'assets/js/admin.js', array('jquery', 'wp-color-picker'), $version); |
|
103 | + wp_localize_script('wpinv-admin-script', 'WPInv_Admin', apply_filters('wpinv_admin_js_localize', $this->get_admin_i18())); |
|
104 | 104 | |
105 | 105 | } |
106 | 106 | |
107 | 107 | // Payment form scripts. |
108 | - if ( 'wpi_payment_form' == $page && $editing ) { |
|
108 | + if ('wpi_payment_form' == $page && $editing) { |
|
109 | 109 | $this->load_payment_form_scripts(); |
110 | 110 | } |
111 | 111 | |
112 | - if ( $page == 'wpinv-subscriptions' ) { |
|
113 | - wp_enqueue_script( 'postbox' ); |
|
112 | + if ($page == 'wpinv-subscriptions') { |
|
113 | + wp_enqueue_script('postbox'); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | } |
@@ -123,32 +123,32 @@ discard block |
||
123 | 123 | global $post; |
124 | 124 | |
125 | 125 | $date_range = array( |
126 | - 'period' => isset( $_GET['date_range'] ) ? sanitize_text_field( $_GET['date_range'] ) : '7_days' |
|
126 | + 'period' => isset($_GET['date_range']) ? sanitize_text_field($_GET['date_range']) : '7_days' |
|
127 | 127 | ); |
128 | 128 | |
129 | - if ( $date_range['period'] == 'custom' ) { |
|
129 | + if ($date_range['period'] == 'custom') { |
|
130 | 130 | |
131 | - if ( isset( $_GET['from'] ) ) { |
|
132 | - $date_range[ 'after' ] = date( 'Y-m-d', strtotime( sanitize_text_field( $_GET['from'] ), current_time( 'timestamp' ) ) - DAY_IN_SECONDS ); |
|
131 | + if (isset($_GET['from'])) { |
|
132 | + $date_range['after'] = date('Y-m-d', strtotime(sanitize_text_field($_GET['from']), current_time('timestamp')) - DAY_IN_SECONDS); |
|
133 | 133 | } |
134 | 134 | |
135 | - if ( isset( $_GET['to'] ) ) { |
|
136 | - $date_range[ 'before' ] = date( 'Y-m-d', strtotime( sanitize_text_field( $_GET['to'] ), current_time( 'timestamp' ) ) + DAY_IN_SECONDS ); |
|
135 | + if (isset($_GET['to'])) { |
|
136 | + $date_range['before'] = date('Y-m-d', strtotime(sanitize_text_field($_GET['to']), current_time('timestamp')) + DAY_IN_SECONDS); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | } |
140 | 140 | |
141 | 141 | $i18n = array( |
142 | - 'ajax_url' => admin_url( 'admin-ajax.php' ), |
|
143 | - 'post_ID' => isset( $post->ID ) ? $post->ID : '', |
|
144 | - 'wpinv_nonce' => wp_create_nonce( 'wpinv-nonce' ), |
|
145 | - 'rest_nonce' => wp_create_nonce( 'wp_rest' ), |
|
146 | - 'rest_root' => esc_url_raw( rest_url() ), |
|
142 | + 'ajax_url' => admin_url('admin-ajax.php'), |
|
143 | + 'post_ID' => isset($post->ID) ? $post->ID : '', |
|
144 | + 'wpinv_nonce' => wp_create_nonce('wpinv-nonce'), |
|
145 | + 'rest_nonce' => wp_create_nonce('wp_rest'), |
|
146 | + 'rest_root' => esc_url_raw(rest_url()), |
|
147 | 147 | 'date_range' => $date_range, |
148 | - 'add_invoice_note_nonce' => wp_create_nonce( 'add-invoice-note' ), |
|
149 | - 'delete_invoice_note_nonce' => wp_create_nonce( 'delete-invoice-note' ), |
|
150 | - 'invoice_item_nonce' => wp_create_nonce( 'invoice-item' ), |
|
151 | - 'billing_details_nonce' => wp_create_nonce( 'get-billing-details' ), |
|
148 | + 'add_invoice_note_nonce' => wp_create_nonce('add-invoice-note'), |
|
149 | + 'delete_invoice_note_nonce' => wp_create_nonce('delete-invoice-note'), |
|
150 | + 'invoice_item_nonce' => wp_create_nonce('invoice-item'), |
|
151 | + 'billing_details_nonce' => wp_create_nonce('get-billing-details'), |
|
152 | 152 | 'tax' => wpinv_tax_amount(), |
153 | 153 | 'discount' => 0, |
154 | 154 | 'currency_symbol' => wpinv_currency_symbol(), |
@@ -157,38 +157,38 @@ discard block |
||
157 | 157 | 'thousand_sep' => wpinv_thousands_separator(), |
158 | 158 | 'decimal_sep' => wpinv_decimal_separator(), |
159 | 159 | 'decimals' => wpinv_decimals(), |
160 | - 'save_invoice' => __( 'Save Invoice', 'invoicing' ), |
|
161 | - 'status_publish' => wpinv_status_nicename( 'publish' ), |
|
162 | - 'status_pending' => wpinv_status_nicename( 'wpi-pending' ), |
|
163 | - 'delete_tax_rate' => __( 'Are you sure you wish to delete this tax rate?', 'invoicing' ), |
|
164 | - 'status_pending' => wpinv_status_nicename( 'wpi-pending' ), |
|
165 | - 'FillBillingDetails' => __( 'Fill the user\'s billing information? This will remove any currently entered billing information', 'invoicing' ), |
|
166 | - 'confirmCalcTotals' => __( 'Recalculate totals? This will recalculate totals based on the user billing country. If no billing country is set it will use the base country.', 'invoicing' ), |
|
167 | - 'AreYouSure' => __( 'Are you sure?', 'invoicing' ), |
|
168 | - 'errDeleteItem' => __( 'This item is in use! Before delete this item, you need to delete all the invoice(s) using this item.', 'invoicing' ), |
|
169 | - 'delete_subscription' => __( 'Are you sure you want to delete this subscription?', 'invoicing' ), |
|
170 | - 'action_edit' => __( 'Edit', 'invoicing' ), |
|
171 | - 'action_cancel' => __( 'Cancel', 'invoicing' ), |
|
172 | - 'item_description' => __( 'Item Description', 'invoicing' ), |
|
173 | - 'invoice_description' => __( 'Invoice Description', 'invoicing' ), |
|
174 | - 'discount_description' => __( 'Discount Description', 'invoicing' ), |
|
175 | - 'searching' => __( 'Searching', 'invoicing' ), |
|
176 | - 'loading' => __( 'Loading...', 'invoicing' ), |
|
177 | - 'search_customers' => __( 'Enter customer name or email', 'invoicing' ), |
|
178 | - 'search_items' => __( 'Enter item name', 'invoicing' ), |
|
160 | + 'save_invoice' => __('Save Invoice', 'invoicing'), |
|
161 | + 'status_publish' => wpinv_status_nicename('publish'), |
|
162 | + 'status_pending' => wpinv_status_nicename('wpi-pending'), |
|
163 | + 'delete_tax_rate' => __('Are you sure you wish to delete this tax rate?', 'invoicing'), |
|
164 | + 'status_pending' => wpinv_status_nicename('wpi-pending'), |
|
165 | + 'FillBillingDetails' => __('Fill the user\'s billing information? This will remove any currently entered billing information', 'invoicing'), |
|
166 | + 'confirmCalcTotals' => __('Recalculate totals? This will recalculate totals based on the user billing country. If no billing country is set it will use the base country.', 'invoicing'), |
|
167 | + 'AreYouSure' => __('Are you sure?', 'invoicing'), |
|
168 | + 'errDeleteItem' => __('This item is in use! Before delete this item, you need to delete all the invoice(s) using this item.', 'invoicing'), |
|
169 | + 'delete_subscription' => __('Are you sure you want to delete this subscription?', 'invoicing'), |
|
170 | + 'action_edit' => __('Edit', 'invoicing'), |
|
171 | + 'action_cancel' => __('Cancel', 'invoicing'), |
|
172 | + 'item_description' => __('Item Description', 'invoicing'), |
|
173 | + 'invoice_description' => __('Invoice Description', 'invoicing'), |
|
174 | + 'discount_description' => __('Discount Description', 'invoicing'), |
|
175 | + 'searching' => __('Searching', 'invoicing'), |
|
176 | + 'loading' => __('Loading...', 'invoicing'), |
|
177 | + 'search_customers' => __('Enter customer name or email', 'invoicing'), |
|
178 | + 'search_items' => __('Enter item name', 'invoicing'), |
|
179 | 179 | ); |
180 | 180 | |
181 | - if ( ! empty( $post ) && getpaid_is_invoice_post_type( $post->post_type ) ) { |
|
181 | + if (!empty($post) && getpaid_is_invoice_post_type($post->post_type)) { |
|
182 | 182 | |
183 | - $invoice = new WPInv_Invoice( $post ); |
|
183 | + $invoice = new WPInv_Invoice($post); |
|
184 | 184 | $i18n['save_invoice'] = sprintf( |
185 | - __( 'Save %s', 'invoicing' ), |
|
186 | - ucfirst( $invoice->get_invoice_quote_type() ) |
|
185 | + __('Save %s', 'invoicing'), |
|
186 | + ucfirst($invoice->get_invoice_quote_type()) |
|
187 | 187 | ); |
188 | 188 | |
189 | 189 | $i18n['invoice_description'] = sprintf( |
190 | - __( '%s Description', 'invoicing' ), |
|
191 | - ucfirst( $invoice->get_invoice_quote_type() ) |
|
190 | + __('%s Description', 'invoicing'), |
|
191 | + ucfirst($invoice->get_invoice_quote_type()) |
|
192 | 192 | ); |
193 | 193 | |
194 | 194 | } |
@@ -202,24 +202,24 @@ discard block |
||
202 | 202 | * @param string $footer_text |
203 | 203 | * @return string |
204 | 204 | */ |
205 | - public function admin_footer_text( $footer_text ) { |
|
205 | + public function admin_footer_text($footer_text) { |
|
206 | 206 | global $current_screen; |
207 | 207 | |
208 | - $page = isset( $_GET['page'] ) ? $_GET['page'] : ''; |
|
208 | + $page = isset($_GET['page']) ? $_GET['page'] : ''; |
|
209 | 209 | |
210 | - if ( ! empty( $current_screen->post_type ) ) { |
|
210 | + if (!empty($current_screen->post_type)) { |
|
211 | 211 | $page = $current_screen->post_type; |
212 | 212 | } |
213 | 213 | |
214 | 214 | // General styles. |
215 | - if ( apply_filters( 'getpaid_display_admin_footer_text', wpinv_current_user_can_manage_invoicing() ) && false !== stripos( $page, 'wpi' ) ) { |
|
215 | + if (apply_filters('getpaid_display_admin_footer_text', wpinv_current_user_can_manage_invoicing()) && false !== stripos($page, 'wpi')) { |
|
216 | 216 | |
217 | 217 | // Change the footer text |
218 | - if ( ! get_user_meta( get_current_user_id(), 'getpaid_admin_footer_text_rated', true ) ) { |
|
218 | + if (!get_user_meta(get_current_user_id(), 'getpaid_admin_footer_text_rated', true)) { |
|
219 | 219 | |
220 | - $rating_url = esc_url( |
|
220 | + $rating_url = esc_url( |
|
221 | 221 | wp_nonce_url( |
222 | - admin_url( 'admin.php?page=wpinv-reports&getpaid-admin-action=rate_plugin' ), |
|
222 | + admin_url('admin.php?page=wpinv-reports&getpaid-admin-action=rate_plugin'), |
|
223 | 223 | 'getpaid-nonce', |
224 | 224 | 'getpaid-nonce' |
225 | 225 | ) |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | |
228 | 228 | $footer_text = sprintf( |
229 | 229 | /* translators: %s: five stars */ |
230 | - __( 'If you like <strong>GetPaid</strong>, please leave us a %s rating. A huge thanks in advance!', 'invoicing' ), |
|
230 | + __('If you like <strong>GetPaid</strong>, please leave us a %s rating. A huge thanks in advance!', 'invoicing'), |
|
231 | 231 | "<a href='$rating_url'>★★★★★</a>" |
232 | 232 | ); |
233 | 233 | |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | |
236 | 236 | $footer_text = sprintf( |
237 | 237 | /* translators: %s: GetPaid */ |
238 | - __( 'Thank you for using %s!', 'invoicing' ), |
|
238 | + __('Thank you for using %s!', 'invoicing'), |
|
239 | 239 | "<a href='https://wpgetpaid.com/' target='_blank'><strong>GetPaid</strong></a>" |
240 | 240 | ); |
241 | 241 | |
@@ -252,8 +252,8 @@ discard block |
||
252 | 252 | * @since 2.0.0 |
253 | 253 | */ |
254 | 254 | public function redirect_to_wordpress_rating_page() { |
255 | - update_user_meta( get_current_user_id(), 'getpaid_admin_footer_text_rated', 1 ); |
|
256 | - wp_redirect( 'https://wordpress.org/support/plugin/invoicing/reviews?rate=5#new-post' ); |
|
255 | + update_user_meta(get_current_user_id(), 'getpaid_admin_footer_text_rated', 1); |
|
256 | + wp_redirect('https://wordpress.org/support/plugin/invoicing/reviews?rate=5#new-post'); |
|
257 | 257 | exit; |
258 | 258 | } |
259 | 259 | |
@@ -264,30 +264,30 @@ discard block |
||
264 | 264 | protected function load_payment_form_scripts() { |
265 | 265 | global $post; |
266 | 266 | |
267 | - wp_enqueue_script( 'vue', WPINV_PLUGIN_URL . 'assets/js/vue/vue.js', array(), WPINV_VERSION ); |
|
268 | - wp_enqueue_script( 'sortable', WPINV_PLUGIN_URL . 'assets/js/sortable.min.js', array(), WPINV_VERSION ); |
|
269 | - wp_enqueue_script( 'vue_draggable', WPINV_PLUGIN_URL . 'assets/js/vue/vuedraggable.min.js', array( 'sortable', 'vue' ), WPINV_VERSION ); |
|
267 | + wp_enqueue_script('vue', WPINV_PLUGIN_URL . 'assets/js/vue/vue.js', array(), WPINV_VERSION); |
|
268 | + wp_enqueue_script('sortable', WPINV_PLUGIN_URL . 'assets/js/sortable.min.js', array(), WPINV_VERSION); |
|
269 | + wp_enqueue_script('vue_draggable', WPINV_PLUGIN_URL . 'assets/js/vue/vuedraggable.min.js', array('sortable', 'vue'), WPINV_VERSION); |
|
270 | 270 | |
271 | - $version = filemtime( WPINV_PLUGIN_DIR . 'assets/js/admin-payment-forms.js' ); |
|
272 | - wp_register_script( 'wpinv-admin-payment-form-script', WPINV_PLUGIN_URL . 'assets/js/admin-payment-forms.js', array( 'wpinv-admin-script', 'vue_draggable' ), $version ); |
|
271 | + $version = filemtime(WPINV_PLUGIN_DIR . 'assets/js/admin-payment-forms.js'); |
|
272 | + wp_register_script('wpinv-admin-payment-form-script', WPINV_PLUGIN_URL . 'assets/js/admin-payment-forms.js', array('wpinv-admin-script', 'vue_draggable'), $version); |
|
273 | 273 | |
274 | 274 | wp_localize_script( |
275 | 275 | 'wpinv-admin-payment-form-script', |
276 | 276 | 'wpinvPaymentFormAdmin', |
277 | 277 | array( |
278 | - 'elements' => wpinv_get_data( 'payment-form-elements' ), |
|
279 | - 'form_elements' => getpaid_get_payment_form_elements( $post->ID ), |
|
278 | + 'elements' => wpinv_get_data('payment-form-elements'), |
|
279 | + 'form_elements' => getpaid_get_payment_form_elements($post->ID), |
|
280 | 280 | 'currency' => wpinv_currency_symbol(), |
281 | 281 | 'position' => wpinv_currency_position(), |
282 | 282 | 'decimals' => (int) wpinv_decimals(), |
283 | 283 | 'thousands_sep' => wpinv_thousands_separator(), |
284 | 284 | 'decimals_sep' => wpinv_decimal_separator(), |
285 | - 'form_items' => gepaid_get_form_items( $post->ID ), |
|
285 | + 'form_items' => gepaid_get_form_items($post->ID), |
|
286 | 286 | 'is_default' => $post->ID == wpinv_get_default_payment_form(), |
287 | 287 | ) |
288 | 288 | ); |
289 | 289 | |
290 | - wp_enqueue_script( 'wpinv-admin-payment-form-script' ); |
|
290 | + wp_enqueue_script('wpinv-admin-payment-form-script'); |
|
291 | 291 | |
292 | 292 | } |
293 | 293 | |
@@ -298,25 +298,25 @@ discard block |
||
298 | 298 | * @return string |
299 | 299 | * |
300 | 300 | */ |
301 | - public function admin_body_class( $classes ) { |
|
301 | + public function admin_body_class($classes) { |
|
302 | 302 | global $pagenow, $post, $current_screen; |
303 | 303 | |
304 | 304 | |
305 | - $page = isset( $_GET['page'] ) ? $_GET['page'] : ''; |
|
305 | + $page = isset($_GET['page']) ? $_GET['page'] : ''; |
|
306 | 306 | |
307 | - if ( ! empty( $current_screen->post_type ) ) { |
|
307 | + if (!empty($current_screen->post_type)) { |
|
308 | 308 | $page = $current_screen->post_type; |
309 | 309 | } |
310 | 310 | |
311 | - if ( false !== stripos( $page, 'wpi' ) ) { |
|
312 | - $classes .= ' wpi-' . sanitize_key( $page ); |
|
311 | + if (false !== stripos($page, 'wpi')) { |
|
312 | + $classes .= ' wpi-' . sanitize_key($page); |
|
313 | 313 | } |
314 | 314 | |
315 | - if ( in_array( $page, wpinv_parse_list( 'wpi_invoice wpi_payment_form wpi_quote' ) ) ) { |
|
315 | + if (in_array($page, wpinv_parse_list('wpi_invoice wpi_payment_form wpi_quote'))) { |
|
316 | 316 | $classes .= ' wpinv-cpt wpinv'; |
317 | 317 | } |
318 | 318 | |
319 | - if ( getpaid_is_invoice_post_type( $page ) ) { |
|
319 | + if (getpaid_is_invoice_post_type($page)) { |
|
320 | 320 | $classes .= ' getpaid-is-invoice-cpt'; |
321 | 321 | } |
322 | 322 | |
@@ -326,19 +326,19 @@ discard block |
||
326 | 326 | /** |
327 | 327 | * Maybe show the AyeCode Connect Notice. |
328 | 328 | */ |
329 | - public function init_ayecode_connect_helper(){ |
|
329 | + public function init_ayecode_connect_helper() { |
|
330 | 330 | |
331 | 331 | new AyeCode_Connect_Helper( |
332 | 332 | array( |
333 | - 'connect_title' => __("WP Invoicing - an AyeCode product!","invoicing"), |
|
334 | - 'connect_external' => __( "Please confirm you wish to connect your site?","invoicing" ), |
|
335 | - 'connect' => sprintf( __( "<strong>Have a license?</strong> Forget about entering license keys or downloading zip files, connect your site for instant access. %slearn more%s","invoicing" ),"<a href='https://ayecode.io/introducing-ayecode-connect/' target='_blank'>","</a>" ), |
|
336 | - 'connect_button' => __("Connect Site","invoicing"), |
|
337 | - 'connecting_button' => __("Connecting...","invoicing"), |
|
338 | - 'error_localhost' => __( "This service will only work with a live domain, not a localhost.","invoicing" ), |
|
339 | - 'error' => __( "Something went wrong, please refresh and try again.","invoicing" ), |
|
333 | + 'connect_title' => __("WP Invoicing - an AyeCode product!", "invoicing"), |
|
334 | + 'connect_external' => __("Please confirm you wish to connect your site?", "invoicing"), |
|
335 | + 'connect' => sprintf(__("<strong>Have a license?</strong> Forget about entering license keys or downloading zip files, connect your site for instant access. %slearn more%s", "invoicing"), "<a href='https://ayecode.io/introducing-ayecode-connect/' target='_blank'>", "</a>"), |
|
336 | + 'connect_button' => __("Connect Site", "invoicing"), |
|
337 | + 'connecting_button' => __("Connecting...", "invoicing"), |
|
338 | + 'error_localhost' => __("This service will only work with a live domain, not a localhost.", "invoicing"), |
|
339 | + 'error' => __("Something went wrong, please refresh and try again.", "invoicing"), |
|
340 | 340 | ), |
341 | - array( 'wpi-addons' ) |
|
341 | + array('wpi-addons') |
|
342 | 342 | ); |
343 | 343 | |
344 | 344 | } |
@@ -350,20 +350,20 @@ discard block |
||
350 | 350 | */ |
351 | 351 | public function activation_redirect() { |
352 | 352 | |
353 | - $redirected = get_option( 'wpinv_redirected_to_settings' ); |
|
353 | + $redirected = get_option('wpinv_redirected_to_settings'); |
|
354 | 354 | |
355 | - if ( ! empty( $redirected ) || wp_doing_ajax() || ! current_user_can( 'manage_options' ) ) { |
|
355 | + if (!empty($redirected) || wp_doing_ajax() || !current_user_can('manage_options')) { |
|
356 | 356 | return; |
357 | 357 | } |
358 | 358 | |
359 | 359 | // Bail if activating from network, or bulk |
360 | - if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { |
|
360 | + if (is_network_admin() || isset($_GET['activate-multi'])) { |
|
361 | 361 | return; |
362 | 362 | } |
363 | 363 | |
364 | - update_option( 'wpinv_redirected_to_settings', 1 ); |
|
364 | + update_option('wpinv_redirected_to_settings', 1); |
|
365 | 365 | |
366 | - wp_safe_redirect( admin_url( 'admin.php?page=wpinv-settings&tab=general' ) ); |
|
366 | + wp_safe_redirect(admin_url('admin.php?page=wpinv-settings&tab=general')); |
|
367 | 367 | exit; |
368 | 368 | |
369 | 369 | } |
@@ -373,9 +373,9 @@ discard block |
||
373 | 373 | */ |
374 | 374 | public function maybe_do_admin_action() { |
375 | 375 | |
376 | - if ( wpinv_current_user_can_manage_invoicing() && isset( $_REQUEST['getpaid-admin-action'] ) && isset( $_REQUEST['getpaid-nonce'] ) && wp_verify_nonce( $_REQUEST['getpaid-nonce'], 'getpaid-nonce' ) ) { |
|
377 | - $key = sanitize_key( $_REQUEST['getpaid-admin-action'] ); |
|
378 | - do_action( "getpaid_authenticated_admin_action_$key", $_REQUEST ); |
|
376 | + if (wpinv_current_user_can_manage_invoicing() && isset($_REQUEST['getpaid-admin-action']) && isset($_REQUEST['getpaid-nonce']) && wp_verify_nonce($_REQUEST['getpaid-nonce'], 'getpaid-nonce')) { |
|
377 | + $key = sanitize_key($_REQUEST['getpaid-admin-action']); |
|
378 | + do_action("getpaid_authenticated_admin_action_$key", $_REQUEST); |
|
379 | 379 | } |
380 | 380 | |
381 | 381 | } |
@@ -385,16 +385,16 @@ discard block |
||
385 | 385 | * |
386 | 386 | * @param array $args |
387 | 387 | */ |
388 | - public function send_customer_invoice( $args ) { |
|
389 | - $sent = getpaid()->get( 'invoice_emails' )->user_invoice( new WPInv_Invoice( $args['invoice_id'] ), true ); |
|
388 | + public function send_customer_invoice($args) { |
|
389 | + $sent = getpaid()->get('invoice_emails')->user_invoice(new WPInv_Invoice($args['invoice_id']), true); |
|
390 | 390 | |
391 | - if ( $sent ) { |
|
392 | - $this->show_success( __( 'Invoice was successfully sent to the customer', 'invoicing' ) ); |
|
391 | + if ($sent) { |
|
392 | + $this->show_success(__('Invoice was successfully sent to the customer', 'invoicing')); |
|
393 | 393 | } else { |
394 | - $this->show_error( __( 'Could not send the invoice to the customer', 'invoicing' ) ); |
|
394 | + $this->show_error(__('Could not send the invoice to the customer', 'invoicing')); |
|
395 | 395 | } |
396 | 396 | |
397 | - wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce', 'invoice_id' ) ) ); |
|
397 | + wp_safe_redirect(remove_query_arg(array('getpaid-admin-action', 'getpaid-nonce', 'invoice_id'))); |
|
398 | 398 | exit; |
399 | 399 | } |
400 | 400 | |
@@ -403,16 +403,16 @@ discard block |
||
403 | 403 | * |
404 | 404 | * @param array $args |
405 | 405 | */ |
406 | - public function send_customer_payment_reminder( $args ) { |
|
407 | - $sent = getpaid()->get( 'invoice_emails' )->force_send_overdue_notice( new WPInv_Invoice( $args['invoice_id'] ) ); |
|
406 | + public function send_customer_payment_reminder($args) { |
|
407 | + $sent = getpaid()->get('invoice_emails')->force_send_overdue_notice(new WPInv_Invoice($args['invoice_id'])); |
|
408 | 408 | |
409 | - if ( $sent ) { |
|
410 | - $this->show_success( __( 'Payment reminder was successfully sent to the customer', 'invoicing' ) ); |
|
409 | + if ($sent) { |
|
410 | + $this->show_success(__('Payment reminder was successfully sent to the customer', 'invoicing')); |
|
411 | 411 | } else { |
412 | - $this->show_error( __( 'Could not sent payment reminder to the customer', 'invoicing' ) ); |
|
412 | + $this->show_error(__('Could not sent payment reminder to the customer', 'invoicing')); |
|
413 | 413 | } |
414 | 414 | |
415 | - wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce', 'invoice_id' ) ) ); |
|
415 | + wp_safe_redirect(remove_query_arg(array('getpaid-admin-action', 'getpaid-nonce', 'invoice_id'))); |
|
416 | 416 | exit; |
417 | 417 | } |
418 | 418 | |
@@ -422,8 +422,8 @@ discard block |
||
422 | 422 | */ |
423 | 423 | public function admin_reset_tax_rates() { |
424 | 424 | |
425 | - update_option( 'wpinv_tax_rates', wpinv_get_data( 'tax-rates' ) ); |
|
426 | - wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce' ) ) ); |
|
425 | + update_option('wpinv_tax_rates', wpinv_get_data('tax-rates')); |
|
426 | + wp_safe_redirect(remove_query_arg(array('getpaid-admin-action', 'getpaid-nonce'))); |
|
427 | 427 | exit; |
428 | 428 | |
429 | 429 | } |
@@ -435,8 +435,8 @@ discard block |
||
435 | 435 | public function admin_create_missing_pages() { |
436 | 436 | $installer = new GetPaid_Installer(); |
437 | 437 | $installer->create_pages(); |
438 | - $this->show_success( __( 'GetPaid pages updated.', 'invoicing' ) ); |
|
439 | - wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce' ) ) ); |
|
438 | + $this->show_success(__('GetPaid pages updated.', 'invoicing')); |
|
439 | + wp_safe_redirect(remove_query_arg(array('getpaid-admin-action', 'getpaid-nonce'))); |
|
440 | 440 | exit; |
441 | 441 | } |
442 | 442 | |
@@ -448,35 +448,35 @@ discard block |
||
448 | 448 | global $wpdb; |
449 | 449 | $installer = new GetPaid_Installer(); |
450 | 450 | |
451 | - if ( $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->prefix}wpinv_subscriptions'" ) != $wpdb->prefix . 'wpinv_subscriptions' ) { |
|
451 | + if ($wpdb->get_var("SHOW TABLES LIKE '{$wpdb->prefix}wpinv_subscriptions'") != $wpdb->prefix . 'wpinv_subscriptions') { |
|
452 | 452 | $installer->create_subscriptions_table(); |
453 | 453 | |
454 | - if ( $wpdb->last_error !== '' ) { |
|
455 | - $this->show_error( __( 'Your GetPaid tables have been updated:', 'invoicing' ) . ' ' . $wpdb->last_error ); |
|
454 | + if ($wpdb->last_error !== '') { |
|
455 | + $this->show_error(__('Your GetPaid tables have been updated:', 'invoicing') . ' ' . $wpdb->last_error); |
|
456 | 456 | } |
457 | 457 | } |
458 | 458 | |
459 | - if ( $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->prefix}getpaid_invoices'" ) != $wpdb->prefix . 'getpaid_invoices' ) { |
|
459 | + if ($wpdb->get_var("SHOW TABLES LIKE '{$wpdb->prefix}getpaid_invoices'") != $wpdb->prefix . 'getpaid_invoices') { |
|
460 | 460 | $installer->create_invoices_table(); |
461 | 461 | |
462 | - if ( $wpdb->last_error !== '' ) { |
|
463 | - $this->show_error( __( 'Your GetPaid tables have been updated:', 'invoicing' ) . ' ' . $wpdb->last_error ); |
|
462 | + if ($wpdb->last_error !== '') { |
|
463 | + $this->show_error(__('Your GetPaid tables have been updated:', 'invoicing') . ' ' . $wpdb->last_error); |
|
464 | 464 | } |
465 | 465 | } |
466 | 466 | |
467 | - if ( $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->prefix}getpaid_invoice_items'" ) != $wpdb->prefix . 'getpaid_invoice_items' ) { |
|
467 | + if ($wpdb->get_var("SHOW TABLES LIKE '{$wpdb->prefix}getpaid_invoice_items'") != $wpdb->prefix . 'getpaid_invoice_items') { |
|
468 | 468 | $installer->create_invoice_items_table(); |
469 | 469 | |
470 | - if ( $wpdb->last_error !== '' ) { |
|
471 | - $this->show_error( __( 'Your GetPaid tables have been updated:', 'invoicing' ) . ' ' . $wpdb->last_error ); |
|
470 | + if ($wpdb->last_error !== '') { |
|
471 | + $this->show_error(__('Your GetPaid tables have been updated:', 'invoicing') . ' ' . $wpdb->last_error); |
|
472 | 472 | } |
473 | 473 | } |
474 | 474 | |
475 | - if ( ! $this->has_notices() ) { |
|
476 | - $this->show_success( __( 'Your GetPaid tables have been updated.', 'invoicing' ) ); |
|
475 | + if (!$this->has_notices()) { |
|
476 | + $this->show_success(__('Your GetPaid tables have been updated.', 'invoicing')); |
|
477 | 477 | } |
478 | 478 | |
479 | - wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce' ) ) ); |
|
479 | + wp_safe_redirect(remove_query_arg(array('getpaid-admin-action', 'getpaid-nonce'))); |
|
480 | 480 | exit; |
481 | 481 | } |
482 | 482 | |
@@ -491,10 +491,10 @@ discard block |
||
491 | 491 | $installer->migrate_old_invoices(); |
492 | 492 | |
493 | 493 | // Show an admin message. |
494 | - $this->show_success( __( 'Your invoices have been migrated.', 'invoicing' ) ); |
|
494 | + $this->show_success(__('Your invoices have been migrated.', 'invoicing')); |
|
495 | 495 | |
496 | 496 | // Redirect the admin. |
497 | - wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce' ) ) ); |
|
497 | + wp_safe_redirect(remove_query_arg(array('getpaid-admin-action', 'getpaid-nonce'))); |
|
498 | 498 | exit; |
499 | 499 | |
500 | 500 | } |
@@ -508,36 +508,36 @@ discard block |
||
508 | 508 | |
509 | 509 | // Fetch all invoices that have discount codes. |
510 | 510 | $table = $wpdb->prefix . 'getpaid_invoices'; |
511 | - $invoices = $wpdb->get_col( "SELECT `post_id` FROM `$table` WHERE `discount` = 0 && `discount_code` <> ''" ); |
|
511 | + $invoices = $wpdb->get_col("SELECT `post_id` FROM `$table` WHERE `discount` = 0 && `discount_code` <> ''"); |
|
512 | 512 | |
513 | - foreach ( $invoices as $invoice ) { |
|
513 | + foreach ($invoices as $invoice) { |
|
514 | 514 | |
515 | - $invoice = new WPInv_Invoice( $invoice ); |
|
515 | + $invoice = new WPInv_Invoice($invoice); |
|
516 | 516 | |
517 | - if ( ! $invoice->exists() ) { |
|
517 | + if (!$invoice->exists()) { |
|
518 | 518 | continue; |
519 | 519 | } |
520 | 520 | |
521 | 521 | // Abort if the discount does not exist or does not apply here. |
522 | - $discount = new WPInv_Discount( $invoice->get_discount_code() ); |
|
523 | - if ( ! $discount->exists() ) { |
|
522 | + $discount = new WPInv_Discount($invoice->get_discount_code()); |
|
523 | + if (!$discount->exists()) { |
|
524 | 524 | continue; |
525 | 525 | } |
526 | 526 | |
527 | - $invoice->add_discount( getpaid_calculate_invoice_discount( $invoice, $discount ) ); |
|
527 | + $invoice->add_discount(getpaid_calculate_invoice_discount($invoice, $discount)); |
|
528 | 528 | $invoice->recalculate_total(); |
529 | 529 | |
530 | - if ( $invoice->get_total_discount() > 0 ) { |
|
530 | + if ($invoice->get_total_discount() > 0) { |
|
531 | 531 | $invoice->save(); |
532 | 532 | } |
533 | 533 | |
534 | 534 | } |
535 | 535 | |
536 | 536 | // Show an admin message. |
537 | - $this->show_success( __( 'Discounts have been recalculated.', 'invoicing' ) ); |
|
537 | + $this->show_success(__('Discounts have been recalculated.', 'invoicing')); |
|
538 | 538 | |
539 | 539 | // Redirect the admin. |
540 | - wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce' ) ) ); |
|
540 | + wp_safe_redirect(remove_query_arg(array('getpaid-admin-action', 'getpaid-nonce'))); |
|
541 | 541 | exit; |
542 | 542 | |
543 | 543 | } |
@@ -549,8 +549,8 @@ discard block |
||
549 | 549 | * @return array |
550 | 550 | */ |
551 | 551 | public function get_notices() { |
552 | - $notices = get_option( 'wpinv_admin_notices' ); |
|
553 | - return is_array( $notices ) ? $notices : array(); |
|
552 | + $notices = get_option('wpinv_admin_notices'); |
|
553 | + return is_array($notices) ? $notices : array(); |
|
554 | 554 | } |
555 | 555 | |
556 | 556 | /** |
@@ -560,7 +560,7 @@ discard block |
||
560 | 560 | * @return array |
561 | 561 | */ |
562 | 562 | public function has_notices() { |
563 | - return count( $this->get_notices() ) > 0; |
|
563 | + return count($this->get_notices()) > 0; |
|
564 | 564 | } |
565 | 565 | |
566 | 566 | /** |
@@ -570,7 +570,7 @@ discard block |
||
570 | 570 | * @since 1.0.19 |
571 | 571 | */ |
572 | 572 | public function clear_notices() { |
573 | - delete_option( 'wpinv_admin_notices' ); |
|
573 | + delete_option('wpinv_admin_notices'); |
|
574 | 574 | } |
575 | 575 | |
576 | 576 | /** |
@@ -579,16 +579,16 @@ discard block |
||
579 | 579 | * @access public |
580 | 580 | * @since 1.0.19 |
581 | 581 | */ |
582 | - public function save_notice( $type, $message ) { |
|
582 | + public function save_notice($type, $message) { |
|
583 | 583 | $notices = $this->get_notices(); |
584 | 584 | |
585 | - if ( empty( $notices[ $type ] ) || ! is_array( $notices[ $type ]) ) { |
|
586 | - $notices[ $type ] = array(); |
|
585 | + if (empty($notices[$type]) || !is_array($notices[$type])) { |
|
586 | + $notices[$type] = array(); |
|
587 | 587 | } |
588 | 588 | |
589 | - $notices[ $type ][] = $message; |
|
589 | + $notices[$type][] = $message; |
|
590 | 590 | |
591 | - update_option( 'wpinv_admin_notices', $notices ); |
|
591 | + update_option('wpinv_admin_notices', $notices); |
|
592 | 592 | } |
593 | 593 | |
594 | 594 | /** |
@@ -598,8 +598,8 @@ discard block |
||
598 | 598 | * @access public |
599 | 599 | * @since 1.0.19 |
600 | 600 | */ |
601 | - public function show_success( $msg ) { |
|
602 | - $this->save_notice( 'success', $msg ); |
|
601 | + public function show_success($msg) { |
|
602 | + $this->save_notice('success', $msg); |
|
603 | 603 | } |
604 | 604 | |
605 | 605 | /** |
@@ -609,8 +609,8 @@ discard block |
||
609 | 609 | * @param string $msg The message to qeue. |
610 | 610 | * @since 1.0.19 |
611 | 611 | */ |
612 | - public function show_error( $msg ) { |
|
613 | - $this->save_notice( 'error', $msg ); |
|
612 | + public function show_error($msg) { |
|
613 | + $this->save_notice('error', $msg); |
|
614 | 614 | } |
615 | 615 | |
616 | 616 | /** |
@@ -620,8 +620,8 @@ discard block |
||
620 | 620 | * @param string $msg The message to qeue. |
621 | 621 | * @since 1.0.19 |
622 | 622 | */ |
623 | - public function show_warning( $msg ) { |
|
624 | - $this->save_notice( 'warning', $msg ); |
|
623 | + public function show_warning($msg) { |
|
624 | + $this->save_notice('warning', $msg); |
|
625 | 625 | } |
626 | 626 | |
627 | 627 | /** |
@@ -631,8 +631,8 @@ discard block |
||
631 | 631 | * @param string $msg The message to qeue. |
632 | 632 | * @since 1.0.19 |
633 | 633 | */ |
634 | - public function show_info( $msg ) { |
|
635 | - $this->save_notice( 'info', $msg ); |
|
634 | + public function show_info($msg) { |
|
635 | + $this->save_notice('info', $msg); |
|
636 | 636 | } |
637 | 637 | |
638 | 638 | /** |
@@ -646,32 +646,32 @@ discard block |
||
646 | 646 | $notices = $this->get_notices(); |
647 | 647 | $this->clear_notices(); |
648 | 648 | |
649 | - foreach ( $notices as $type => $messages ) { |
|
649 | + foreach ($notices as $type => $messages) { |
|
650 | 650 | |
651 | - if ( ! is_array( $messages ) ) { |
|
651 | + if (!is_array($messages)) { |
|
652 | 652 | continue; |
653 | 653 | } |
654 | 654 | |
655 | - $type = sanitize_key( $type ); |
|
656 | - foreach ( $messages as $message ) { |
|
657 | - $message = wp_kses_post( $message ); |
|
655 | + $type = sanitize_key($type); |
|
656 | + foreach ($messages as $message) { |
|
657 | + $message = wp_kses_post($message); |
|
658 | 658 | echo "<div class='notice notice-$type is-dismissible'><p>$message</p></div>"; |
659 | 659 | } |
660 | 660 | |
661 | 661 | } |
662 | 662 | |
663 | - foreach ( array( 'checkout_page', 'invoice_history_page', 'success_page', 'failure_page', 'invoice_subscription_page' ) as $page ) { |
|
663 | + foreach (array('checkout_page', 'invoice_history_page', 'success_page', 'failure_page', 'invoice_subscription_page') as $page) { |
|
664 | 664 | |
665 | - if ( ! is_numeric( wpinv_get_option( $page, false ) ) ) { |
|
666 | - $url = esc_url( |
|
665 | + if (!is_numeric(wpinv_get_option($page, false))) { |
|
666 | + $url = esc_url( |
|
667 | 667 | wp_nonce_url( |
668 | - add_query_arg( 'getpaid-admin-action', 'create_missing_pages' ), |
|
668 | + add_query_arg('getpaid-admin-action', 'create_missing_pages'), |
|
669 | 669 | 'getpaid-nonce', |
670 | 670 | 'getpaid-nonce' |
671 | 671 | ) |
672 | 672 | ); |
673 | - $message = __( 'Some GetPaid pages are missing. To use GetPaid without any issues, click the button below to generate the missing pages.', 'invoicing' ); |
|
674 | - $message2 = __( 'Generate Pages', 'invoicing' ); |
|
673 | + $message = __('Some GetPaid pages are missing. To use GetPaid without any issues, click the button below to generate the missing pages.', 'invoicing'); |
|
674 | + $message2 = __('Generate Pages', 'invoicing'); |
|
675 | 675 | echo "<div class='notice notice-warning is-dismissible'><p>$message<br><br><a href='$url' class='button button-primary'>$message2</a></p></div>"; |
676 | 676 | break; |
677 | 677 | } |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | * |
8 | 8 | */ |
9 | 9 | |
10 | -if ( ! defined( 'ABSPATH' ) ) { |
|
10 | +if (!defined('ABSPATH')) { |
|
11 | 11 | exit; // Exit if accessed directly |
12 | 12 | } |
13 | 13 | |
@@ -21,13 +21,13 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @param WP_Post $post |
23 | 23 | */ |
24 | - public static function output( $post ) { |
|
24 | + public static function output($post) { |
|
25 | 25 | |
26 | 26 | // Prepare the invoice. |
27 | - $invoice = new WPInv_Invoice( $post ); |
|
27 | + $invoice = new WPInv_Invoice($post); |
|
28 | 28 | |
29 | 29 | // Nonce field. |
30 | - wp_nonce_field( 'wpinv_details', 'wpinv_details_nonce' ) ; |
|
30 | + wp_nonce_field('wpinv_details', 'wpinv_details_nonce'); |
|
31 | 31 | |
32 | 32 | |
33 | 33 | ?> |
@@ -46,11 +46,11 @@ discard block |
||
46 | 46 | |
47 | 47 | <div class="bsui" style="margin-top: 1.5rem"> |
48 | 48 | |
49 | - <?php do_action( 'getpaid_invoice_edit_before_viewed_by_customer', $invoice ); ?> |
|
50 | - <?php if ( ! $invoice->is_draft() ) : ?> |
|
49 | + <?php do_action('getpaid_invoice_edit_before_viewed_by_customer', $invoice); ?> |
|
50 | + <?php if (!$invoice->is_draft()) : ?> |
|
51 | 51 | <div class="form-group"> |
52 | - <strong><?php _e( 'Viewed by Customer:', 'invoicing' );?></strong> |
|
53 | - <?php ( $invoice->get_is_viewed() ) ? _e( 'Yes', 'invoicing' ) : _e( 'No', 'invoicing' ); ?> |
|
52 | + <strong><?php _e('Viewed by Customer:', 'invoicing'); ?></strong> |
|
53 | + <?php ($invoice->get_is_viewed()) ? _e('Yes', 'invoicing') : _e('No', 'invoicing'); ?> |
|
54 | 54 | </div> |
55 | 55 | <?php endif; ?> |
56 | 56 | |
@@ -58,13 +58,13 @@ discard block |
||
58 | 58 | |
59 | 59 | // Date created. |
60 | 60 | $label = sprintf( |
61 | - __( '%s Date:', 'invoicing' ), |
|
62 | - ucfirst( $invoice->get_invoice_quote_type() ) |
|
61 | + __('%s Date:', 'invoicing'), |
|
62 | + ucfirst($invoice->get_invoice_quote_type()) |
|
63 | 63 | ); |
64 | 64 | |
65 | - $info = sprintf( |
|
66 | - __( 'The date this %s was created.', 'invoicing' ), |
|
67 | - strtolower( $invoice->get_invoice_quote_type() ) |
|
65 | + $info = sprintf( |
|
66 | + __('The date this %s was created.', 'invoicing'), |
|
67 | + strtolower($invoice->get_invoice_quote_type()) |
|
68 | 68 | ); |
69 | 69 | |
70 | 70 | echo aui()->input( |
@@ -72,11 +72,11 @@ discard block |
||
72 | 72 | 'type' => 'datepicker', |
73 | 73 | 'id' => 'wpinv_date_created', |
74 | 74 | 'name' => 'date_created', |
75 | - 'label' => $label . getpaid_get_help_tip( $info ), |
|
75 | + 'label' => $label . getpaid_get_help_tip($info), |
|
76 | 76 | 'label_type' => 'vertical', |
77 | 77 | 'placeholder' => 'YYYY-MM-DD 00:00', |
78 | 78 | 'class' => 'form-control-sm', |
79 | - 'value' => $invoice->get_date_created( 'edit' ), |
|
79 | + 'value' => $invoice->get_date_created('edit'), |
|
80 | 80 | 'extra_attributes' => array( |
81 | 81 | 'data-enable-time' => 'true', |
82 | 82 | 'data-time_24hr' => 'true', |
@@ -87,15 +87,15 @@ discard block |
||
87 | 87 | ); |
88 | 88 | |
89 | 89 | // Date paid. |
90 | - $date_paid = $invoice->get_date_completed( 'edit' ); |
|
91 | - if ( ! empty( $date_paid ) && $invoice->is_paid() ) { |
|
90 | + $date_paid = $invoice->get_date_completed('edit'); |
|
91 | + if (!empty($date_paid) && $invoice->is_paid()) { |
|
92 | 92 | |
93 | 93 | echo aui()->input( |
94 | 94 | array( |
95 | 95 | 'type' => 'text', |
96 | 96 | 'id' => 'wpinv_date_completed', |
97 | 97 | 'name' => 'wpinv_date_completed', |
98 | - 'label' => __( 'Date Completed:', 'invoicing' ), |
|
98 | + 'label' => __('Date Completed:', 'invoicing'), |
|
99 | 99 | 'label_type' => 'vertical', |
100 | 100 | 'class' => 'form-control-sm', |
101 | 101 | 'value' => $date_paid, |
@@ -109,56 +109,56 @@ discard block |
||
109 | 109 | } |
110 | 110 | |
111 | 111 | // Due date. |
112 | - if ( $invoice->is_type( 'invoice' ) && wpinv_get_option( 'overdue_active' ) && ( $invoice->needs_payment() || $invoice->is_draft() ) ) { |
|
112 | + if ($invoice->is_type('invoice') && wpinv_get_option('overdue_active') && ($invoice->needs_payment() || $invoice->is_draft())) { |
|
113 | 113 | |
114 | 114 | echo aui()->input( |
115 | 115 | array( |
116 | 116 | 'type' => 'text', |
117 | 117 | 'id' => 'wpinv_due_date', |
118 | 118 | 'name' => 'wpinv_due_date', |
119 | - 'label' => __( 'Due Date:', 'invoicing' ) . getpaid_get_help_tip( __( 'Leave blank to disable automated reminder emails for this invoice.', 'invoicing' ) ), |
|
119 | + 'label' => __('Due Date:', 'invoicing') . getpaid_get_help_tip(__('Leave blank to disable automated reminder emails for this invoice.', 'invoicing')), |
|
120 | 120 | 'label_type' => 'vertical', |
121 | - 'placeholder' => __( 'No due date', 'invoicing' ), |
|
121 | + 'placeholder' => __('No due date', 'invoicing'), |
|
122 | 122 | 'class' => 'form-control-sm', |
123 | - 'value' => $invoice->get_due_date( 'edit' ), |
|
123 | + 'value' => $invoice->get_due_date('edit'), |
|
124 | 124 | ) |
125 | 125 | ); |
126 | 126 | |
127 | 127 | } |
128 | 128 | |
129 | - do_action( 'wpinv_meta_box_details_after_due_date', $invoice->get_id() ); |
|
130 | - do_action( 'getpaid_metabox_after_due_date', $invoice ); |
|
129 | + do_action('wpinv_meta_box_details_after_due_date', $invoice->get_id()); |
|
130 | + do_action('getpaid_metabox_after_due_date', $invoice); |
|
131 | 131 | |
132 | 132 | // Status. |
133 | 133 | $label = sprintf( |
134 | - __( '%s Status:', 'invoicing' ), |
|
135 | - ucfirst( $invoice->get_invoice_quote_type() ) |
|
134 | + __('%s Status:', 'invoicing'), |
|
135 | + ucfirst($invoice->get_invoice_quote_type()) |
|
136 | 136 | ); |
137 | 137 | |
138 | - $status = $invoice->get_status( 'edit' ); |
|
138 | + $status = $invoice->get_status('edit'); |
|
139 | 139 | echo aui()->select( |
140 | 140 | array( |
141 | 141 | 'id' => 'wpinv_status', |
142 | 142 | 'name' => 'wpinv_status', |
143 | 143 | 'label' => $label, |
144 | 144 | 'label_type' => 'vertical', |
145 | - 'placeholder' => __( 'Select Status', 'invoicing' ), |
|
146 | - 'value' => array_key_exists( $status, $invoice->get_all_statuses() ) ? $status : $invoice->get_default_status(), |
|
145 | + 'placeholder' => __('Select Status', 'invoicing'), |
|
146 | + 'value' => array_key_exists($status, $invoice->get_all_statuses()) ? $status : $invoice->get_default_status(), |
|
147 | 147 | 'select2' => true, |
148 | 148 | 'data-allow-clear' => 'false', |
149 | - 'options' => wpinv_get_invoice_statuses( true, false, $invoice ) |
|
149 | + 'options' => wpinv_get_invoice_statuses(true, false, $invoice) |
|
150 | 150 | ) |
151 | 151 | ); |
152 | 152 | |
153 | 153 | // Invoice number. |
154 | 154 | $label = sprintf( |
155 | - __( '%s Number:', 'invoicing' ), |
|
156 | - ucfirst( $invoice->get_invoice_quote_type() ) |
|
155 | + __('%s Number:', 'invoicing'), |
|
156 | + ucfirst($invoice->get_invoice_quote_type()) |
|
157 | 157 | ); |
158 | 158 | |
159 | - $info = sprintf( |
|
160 | - __( 'Each %s number must be unique.', 'invoicing' ), |
|
161 | - strtolower( $invoice->get_invoice_quote_type() ) |
|
159 | + $info = sprintf( |
|
160 | + __('Each %s number must be unique.', 'invoicing'), |
|
161 | + strtolower($invoice->get_invoice_quote_type()) |
|
162 | 162 | ); |
163 | 163 | |
164 | 164 | echo aui()->input( |
@@ -166,11 +166,11 @@ discard block |
||
166 | 166 | 'type' => 'text', |
167 | 167 | 'id' => 'wpinv_number', |
168 | 168 | 'name' => 'wpinv_number', |
169 | - 'label' => $label . getpaid_get_help_tip( $info ), |
|
169 | + 'label' => $label . getpaid_get_help_tip($info), |
|
170 | 170 | 'label_type' => 'vertical', |
171 | - 'placeholder' => __( 'Autogenerate', 'invoicing' ), |
|
171 | + 'placeholder' => __('Autogenerate', 'invoicing'), |
|
172 | 172 | 'class' => 'form-control-sm', |
173 | - 'value' => $invoice->get_number( 'edit' ), |
|
173 | + 'value' => $invoice->get_number('edit'), |
|
174 | 174 | ) |
175 | 175 | ); |
176 | 176 | |
@@ -180,15 +180,15 @@ discard block |
||
180 | 180 | 'type' => 'text', |
181 | 181 | 'id' => 'wpinv_cc', |
182 | 182 | 'name' => 'wpinv_cc', |
183 | - 'label' => __( 'Email CC:', 'invoicing' ) . getpaid_get_help_tip( __( 'Enter a comma separated list of other emails that should be notified about the invoice.', 'invoicing' ) ), |
|
183 | + 'label' => __('Email CC:', 'invoicing') . getpaid_get_help_tip(__('Enter a comma separated list of other emails that should be notified about the invoice.', 'invoicing')), |
|
184 | 184 | 'label_type' => 'vertical', |
185 | - 'placeholder' => __( '[email protected], [email protected]', 'invoicing' ), |
|
185 | + 'placeholder' => __('[email protected], [email protected]', 'invoicing'), |
|
186 | 186 | 'class' => 'form-control-sm', |
187 | - 'value' => $invoice->get_email_cc( 'edit' ), |
|
187 | + 'value' => $invoice->get_email_cc('edit'), |
|
188 | 188 | ) |
189 | 189 | ); |
190 | 190 | |
191 | - if ( ! $invoice->is_paid() && ! $invoice->is_refunded() ) { |
|
191 | + if (!$invoice->is_paid() && !$invoice->is_refunded()) { |
|
192 | 192 | |
193 | 193 | // Apply a discount. |
194 | 194 | echo aui()->input( |
@@ -196,25 +196,25 @@ discard block |
||
196 | 196 | 'type' => 'text', |
197 | 197 | 'id' => 'wpinv_discount_code', |
198 | 198 | 'name' => 'wpinv_discount_code', |
199 | - 'label' => __( 'Discount Code:', 'invoicing' ), |
|
200 | - 'placeholder' => __( 'Apply Discount', 'invoicing' ), |
|
199 | + 'label' => __('Discount Code:', 'invoicing'), |
|
200 | + 'placeholder' => __('Apply Discount', 'invoicing'), |
|
201 | 201 | 'label_type' => 'vertical', |
202 | 202 | 'class' => 'form-control-sm', |
203 | - 'value' => $invoice->get_discount_code( 'edit' ), |
|
203 | + 'value' => $invoice->get_discount_code('edit'), |
|
204 | 204 | ) |
205 | 205 | ); |
206 | 206 | |
207 | - } else if ( $invoice->get_discount_code( 'edit' ) ) { |
|
207 | + } else if ($invoice->get_discount_code('edit')) { |
|
208 | 208 | |
209 | 209 | echo aui()->input( |
210 | 210 | array( |
211 | 211 | 'type' => 'text', |
212 | 212 | 'id' => 'wpinv_discount_code', |
213 | 213 | 'name' => 'wpinv_discount_code', |
214 | - 'label' => __( 'Discount Code:', 'invoicing' ), |
|
214 | + 'label' => __('Discount Code:', 'invoicing'), |
|
215 | 215 | 'label_type' => 'vertical', |
216 | 216 | 'class' => 'form-control-sm', |
217 | - 'value' => $invoice->get_discount_code( 'edit' ), |
|
217 | + 'value' => $invoice->get_discount_code('edit'), |
|
218 | 218 | 'extra_attributes' => array( |
219 | 219 | 'onclick' => 'this.select();', |
220 | 220 | 'readonly' => 'true', |
@@ -224,17 +224,17 @@ discard block |
||
224 | 224 | |
225 | 225 | } |
226 | 226 | |
227 | - do_action( 'wpinv_meta_box_details_inner', $invoice->get_id() ); |
|
227 | + do_action('wpinv_meta_box_details_inner', $invoice->get_id()); |
|
228 | 228 | |
229 | 229 | // Disable taxes. |
230 | - if ( wpinv_use_taxes() && ! ( $invoice->is_paid() || $invoice->is_refunded() ) ) { |
|
230 | + if (wpinv_use_taxes() && !($invoice->is_paid() || $invoice->is_refunded())) { |
|
231 | 231 | |
232 | 232 | echo aui()->input( |
233 | 233 | array( |
234 | 234 | 'id' => 'wpinv_taxable', |
235 | 235 | 'name' => 'disable_taxes', |
236 | 236 | 'type' => 'checkbox', |
237 | - 'label' => __( 'Disable taxes', 'invoicing' ), |
|
237 | + 'label' => __('Disable taxes', 'invoicing'), |
|
238 | 238 | 'value' => '1', |
239 | 239 | 'checked' => (bool) $invoice->get_disable_taxes(), |
240 | 240 | ) |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | |
243 | 243 | } |
244 | 244 | |
245 | - if ( $invoice->is_type( 'invoice' ) ) { |
|
245 | + if ($invoice->is_type('invoice')) { |
|
246 | 246 | |
247 | 247 | // Send to customer. |
248 | 248 | echo aui()->input( |
@@ -250,15 +250,15 @@ discard block |
||
250 | 250 | 'id' => 'wpinv_send_to_customer', |
251 | 251 | 'name' => 'send_to_customer', |
252 | 252 | 'type' => 'checkbox', |
253 | - 'label' => __( 'Send invoice to customer after saving', 'invoicing' ), |
|
253 | + 'label' => __('Send invoice to customer after saving', 'invoicing'), |
|
254 | 254 | 'value' => '1', |
255 | - 'checked' => $invoice->is_draft() && (bool) wpinv_get_option( 'email_user_invoice_active', true ), |
|
255 | + 'checked' => $invoice->is_draft() && (bool) wpinv_get_option('email_user_invoice_active', true), |
|
256 | 256 | ) |
257 | 257 | ); |
258 | 258 | |
259 | 259 | } |
260 | 260 | |
261 | - do_action( 'getpaid_metabox_after_invoice_details', $invoice ); |
|
261 | + do_action('getpaid_metabox_after_invoice_details', $invoice); |
|
262 | 262 | |
263 | 263 | ?> |
264 | 264 |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | * |
8 | 8 | */ |
9 | 9 | |
10 | -if ( ! defined( 'ABSPATH' ) ) { |
|
10 | +if (!defined('ABSPATH')) { |
|
11 | 11 | exit; // Exit if accessed directly |
12 | 12 | } |
13 | 13 | |
@@ -21,14 +21,14 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @param WP_Post $post |
23 | 23 | */ |
24 | - public static function output( $post ) { |
|
24 | + public static function output($post) { |
|
25 | 25 | |
26 | 26 | // Prepare the invoice. |
27 | - $invoice = new WPInv_Invoice( $post ); |
|
28 | - $customer = $invoice->exists() ? $invoice->get_user_id( 'edit' ) : get_current_user_id(); |
|
29 | - $customer = new WP_User( $customer ); |
|
30 | - $display = sprintf( _x( '%1$s (%2$s)', 'user dropdown', 'invoicing' ), $customer->display_name, $customer->user_email ); |
|
31 | - wp_nonce_field( 'getpaid_meta_nonce', 'getpaid_meta_nonce' ); |
|
27 | + $invoice = new WPInv_Invoice($post); |
|
28 | + $customer = $invoice->exists() ? $invoice->get_user_id('edit') : get_current_user_id(); |
|
29 | + $customer = new WP_User($customer); |
|
30 | + $display = sprintf(_x('%1$s (%2$s)', 'user dropdown', 'invoicing'), $customer->display_name, $customer->user_email); |
|
31 | + wp_nonce_field('getpaid_meta_nonce', 'getpaid_meta_nonce'); |
|
32 | 32 | |
33 | 33 | ?> |
34 | 34 | |
@@ -43,11 +43,11 @@ discard block |
||
43 | 43 | <div class="col-12 col-sm-6"> |
44 | 44 | <div id="getpaid-invoice-user-id-wrapper" class="form-group"> |
45 | 45 | <div> |
46 | - <label for="post_author_override"><?php _e( 'Customer', 'invoicing' );?></label> |
|
46 | + <label for="post_author_override"><?php _e('Customer', 'invoicing'); ?></label> |
|
47 | 47 | </div> |
48 | 48 | <div> |
49 | - <select name="post_author_override" id="wpinv_post_author_override" class="getpaid-customer-search form-control regular-text" data-placeholder="<?php esc_attr_e( 'Search for a customer by email or name', 'invoicing' ); ?>"> |
|
50 | - <option selected="selected" value="<?php echo (int) $customer->ID; ?>"><?php echo sanitize_text_field( $display ); ?> </option>) |
|
49 | + <select name="post_author_override" id="wpinv_post_author_override" class="getpaid-customer-search form-control regular-text" data-placeholder="<?php esc_attr_e('Search for a customer by email or name', 'invoicing'); ?>"> |
|
50 | + <option selected="selected" value="<?php echo (int) $customer->ID; ?>"><?php echo sanitize_text_field($display); ?> </option>) |
|
51 | 51 | </select> |
52 | 52 | </div> |
53 | 53 | </div> |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | 'type' => 'text', |
61 | 61 | 'id' => 'getpaid-invoice-new-user-email', |
62 | 62 | 'name' => 'wpinv_email', |
63 | - 'label' => __( 'Email', 'invoicing' ) . '<span class="required">*</span>', |
|
63 | + 'label' => __('Email', 'invoicing') . '<span class="required">*</span>', |
|
64 | 64 | 'label_type' => 'vertical', |
65 | 65 | 'placeholder' => '[email protected]', |
66 | 66 | 'class' => 'form-control-sm', |
@@ -70,18 +70,18 @@ discard block |
||
70 | 70 | </div> |
71 | 71 | </div> |
72 | 72 | <div class="col-12 col-sm-6 form-group mt-sm-4"> |
73 | - <?php if ( ! $invoice->is_paid() && ! $invoice->is_refunded() ) : ?> |
|
73 | + <?php if (!$invoice->is_paid() && !$invoice->is_refunded()) : ?> |
|
74 | 74 | <a id="getpaid-invoice-fill-user-details" class="button button-small button-secondary" href="javascript:void(0)"> |
75 | 75 | <i aria-hidden="true" class="fa fa-refresh"></i> |
76 | - <?php _e( 'Fill User Details', 'invoicing' );?> |
|
76 | + <?php _e('Fill User Details', 'invoicing'); ?> |
|
77 | 77 | </a> |
78 | 78 | <a id="getpaid-invoice-create-new-user-button" class="button button-small button-secondary" href="javascript:void(0)"> |
79 | 79 | <i aria-hidden="true" class="fa fa-plus"></i> |
80 | - <?php _e( 'Add New User', 'invoicing' );?> |
|
80 | + <?php _e('Add New User', 'invoicing'); ?> |
|
81 | 81 | </a> |
82 | 82 | <a id="getpaid-invoice-cancel-create-new-user" class="button button-small button-secondary d-none" href="javascript:void(0)"> |
83 | 83 | <i aria-hidden="true" class="fa fa-close"></i> |
84 | - <?php _e( 'Cancel', 'invoicing' );?> |
|
84 | + <?php _e('Cancel', 'invoicing'); ?> |
|
85 | 85 | </a> |
86 | 86 | <?php endif; ?> |
87 | 87 | </div> |
@@ -94,11 +94,11 @@ discard block |
||
94 | 94 | 'type' => 'text', |
95 | 95 | 'id' => 'wpinv_first_name', |
96 | 96 | 'name' => 'wpinv_first_name', |
97 | - 'label' => __( 'First Name', 'invoicing' ), |
|
97 | + 'label' => __('First Name', 'invoicing'), |
|
98 | 98 | 'label_type' => 'vertical', |
99 | 99 | 'placeholder' => '', |
100 | 100 | 'class' => 'form-control-sm', |
101 | - 'value' => $invoice->get_first_name( 'edit' ), |
|
101 | + 'value' => $invoice->get_first_name('edit'), |
|
102 | 102 | ) |
103 | 103 | ); |
104 | 104 | ?> |
@@ -110,11 +110,11 @@ discard block |
||
110 | 110 | 'type' => 'text', |
111 | 111 | 'id' => 'wpinv_last_name', |
112 | 112 | 'name' => 'wpinv_last_name', |
113 | - 'label' => __( 'Last Name', 'invoicing' ), |
|
113 | + 'label' => __('Last Name', 'invoicing'), |
|
114 | 114 | 'label_type' => 'vertical', |
115 | 115 | 'placeholder' => '', |
116 | 116 | 'class' => 'form-control-sm', |
117 | - 'value' => $invoice->get_last_name( 'edit' ), |
|
117 | + 'value' => $invoice->get_last_name('edit'), |
|
118 | 118 | ) |
119 | 119 | ); |
120 | 120 | ?> |
@@ -129,11 +129,11 @@ discard block |
||
129 | 129 | 'type' => 'text', |
130 | 130 | 'id' => 'wpinv_company', |
131 | 131 | 'name' => 'wpinv_company', |
132 | - 'label' => __( 'Company', 'invoicing' ), |
|
132 | + 'label' => __('Company', 'invoicing'), |
|
133 | 133 | 'label_type' => 'vertical', |
134 | 134 | 'placeholder' => '', |
135 | 135 | 'class' => 'form-control-sm', |
136 | - 'value' => $invoice->get_company( 'edit' ), |
|
136 | + 'value' => $invoice->get_company('edit'), |
|
137 | 137 | ) |
138 | 138 | ); |
139 | 139 | ?> |
@@ -145,11 +145,11 @@ discard block |
||
145 | 145 | 'type' => 'text', |
146 | 146 | 'id' => 'wpinv_vat_number', |
147 | 147 | 'name' => 'wpinv_vat_number', |
148 | - 'label' => __( 'Vat Number', 'invoicing' ), |
|
148 | + 'label' => __('Vat Number', 'invoicing'), |
|
149 | 149 | 'label_type' => 'vertical', |
150 | 150 | 'placeholder' => '', |
151 | 151 | 'class' => 'form-control-sm', |
152 | - 'value' => $invoice->get_vat_number( 'edit' ), |
|
152 | + 'value' => $invoice->get_vat_number('edit'), |
|
153 | 153 | ) |
154 | 154 | ); |
155 | 155 | ?> |
@@ -164,11 +164,11 @@ discard block |
||
164 | 164 | 'type' => 'text', |
165 | 165 | 'id' => 'wpinv_address', |
166 | 166 | 'name' => 'wpinv_address', |
167 | - 'label' => __( 'Address', 'invoicing' ), |
|
167 | + 'label' => __('Address', 'invoicing'), |
|
168 | 168 | 'label_type' => 'vertical', |
169 | 169 | 'placeholder' => '', |
170 | 170 | 'class' => 'form-control-sm', |
171 | - 'value' => $invoice->get_address( 'edit' ), |
|
171 | + 'value' => $invoice->get_address('edit'), |
|
172 | 172 | ) |
173 | 173 | ); |
174 | 174 | ?> |
@@ -180,11 +180,11 @@ discard block |
||
180 | 180 | 'type' => 'text', |
181 | 181 | 'id' => 'wpinv_city', |
182 | 182 | 'name' => 'wpinv_city', |
183 | - 'label' => __( 'City', 'invoicing' ), |
|
183 | + 'label' => __('City', 'invoicing'), |
|
184 | 184 | 'label_type' => 'vertical', |
185 | 185 | 'placeholder' => '', |
186 | 186 | 'class' => 'form-control-sm', |
187 | - 'value' => $invoice->get_city( 'edit' ), |
|
187 | + 'value' => $invoice->get_city('edit'), |
|
188 | 188 | ) |
189 | 189 | ); |
190 | 190 | ?> |
@@ -198,11 +198,11 @@ discard block |
||
198 | 198 | array( |
199 | 199 | 'id' => 'wpinv_country', |
200 | 200 | 'name' => 'wpinv_country', |
201 | - 'label' => __( 'Country', 'invoicing' ), |
|
201 | + 'label' => __('Country', 'invoicing'), |
|
202 | 202 | 'label_type' => 'vertical', |
203 | - 'placeholder' => __( 'Choose a country', 'invoicing' ), |
|
203 | + 'placeholder' => __('Choose a country', 'invoicing'), |
|
204 | 204 | 'class' => 'form-control-sm', |
205 | - 'value' => $invoice->get_country( 'edit' ), |
|
205 | + 'value' => $invoice->get_country('edit'), |
|
206 | 206 | 'options' => wpinv_get_country_list(), |
207 | 207 | 'data-allow-clear' => 'false', |
208 | 208 | 'select2' => true, |
@@ -213,20 +213,20 @@ discard block |
||
213 | 213 | <div class="col-12 col-sm-6"> |
214 | 214 | <?php |
215 | 215 | |
216 | - $states = wpinv_get_country_states( $invoice->get_country( 'edit' ) ); |
|
216 | + $states = wpinv_get_country_states($invoice->get_country('edit')); |
|
217 | 217 | |
218 | - if ( empty( $states ) ) { |
|
218 | + if (empty($states)) { |
|
219 | 219 | |
220 | 220 | echo aui()->input( |
221 | 221 | array( |
222 | 222 | 'type' => 'text', |
223 | 223 | 'id' => 'wpinv_state', |
224 | 224 | 'name' => 'wpinv_state', |
225 | - 'label' => __( 'State', 'invoicing' ), |
|
225 | + 'label' => __('State', 'invoicing'), |
|
226 | 226 | 'label_type' => 'vertical', |
227 | 227 | 'placeholder' => '', |
228 | 228 | 'class' => 'form-control-sm', |
229 | - 'value' => $invoice->get_state( 'edit' ), |
|
229 | + 'value' => $invoice->get_state('edit'), |
|
230 | 230 | ) |
231 | 231 | ); |
232 | 232 | |
@@ -236,11 +236,11 @@ discard block |
||
236 | 236 | array( |
237 | 237 | 'id' => 'wpinv_state', |
238 | 238 | 'name' => 'wpinv_state', |
239 | - 'label' => __( 'State', 'invoicing' ), |
|
239 | + 'label' => __('State', 'invoicing'), |
|
240 | 240 | 'label_type' => 'vertical', |
241 | - 'placeholder' => __( 'Select a state', 'invoicing' ), |
|
241 | + 'placeholder' => __('Select a state', 'invoicing'), |
|
242 | 242 | 'class' => 'form-control-sm', |
243 | - 'value' => $invoice->get_state( 'edit' ), |
|
243 | + 'value' => $invoice->get_state('edit'), |
|
244 | 244 | 'options' => $states, |
245 | 245 | 'data-allow-clear' => 'false', |
246 | 246 | 'select2' => true, |
@@ -261,11 +261,11 @@ discard block |
||
261 | 261 | 'type' => 'text', |
262 | 262 | 'id' => 'wpinv_zip', |
263 | 263 | 'name' => 'wpinv_zip', |
264 | - 'label' => __( 'Zip / Postal Code', 'invoicing' ), |
|
264 | + 'label' => __('Zip / Postal Code', 'invoicing'), |
|
265 | 265 | 'label_type' => 'vertical', |
266 | 266 | 'placeholder' => '', |
267 | 267 | 'class' => 'form-control-sm', |
268 | - 'value' => $invoice->get_zip( 'edit' ), |
|
268 | + 'value' => $invoice->get_zip('edit'), |
|
269 | 269 | ) |
270 | 270 | ); |
271 | 271 | ?> |
@@ -277,11 +277,11 @@ discard block |
||
277 | 277 | 'type' => 'text', |
278 | 278 | 'id' => 'wpinv_phone', |
279 | 279 | 'name' => 'wpinv_phone', |
280 | - 'label' => __( 'Phone', 'invoicing' ), |
|
280 | + 'label' => __('Phone', 'invoicing'), |
|
281 | 281 | 'label_type' => 'vertical', |
282 | 282 | 'placeholder' => '', |
283 | 283 | 'class' => 'form-control-sm', |
284 | - 'value' => $invoice->get_phone( 'edit' ), |
|
284 | + 'value' => $invoice->get_phone('edit'), |
|
285 | 285 | ) |
286 | 286 | ); |
287 | 287 | ?> |
@@ -297,49 +297,49 @@ discard block |
||
297 | 297 | * |
298 | 298 | * @param int $post_id |
299 | 299 | */ |
300 | - public static function save( $post_id ) { |
|
300 | + public static function save($post_id) { |
|
301 | 301 | |
302 | 302 | // Prepare the invoice. |
303 | - $invoice = new WPInv_Invoice( $post_id ); |
|
303 | + $invoice = new WPInv_Invoice($post_id); |
|
304 | 304 | |
305 | 305 | // Load new data. |
306 | 306 | $invoice->set_props( |
307 | 307 | array( |
308 | - 'template' => isset( $_POST['wpinv_template'] ) ? wpinv_clean( $_POST['wpinv_template'] ) : null, |
|
309 | - 'email_cc' => isset( $_POST['wpinv_cc'] ) ? wpinv_clean( $_POST['wpinv_cc'] ) : null, |
|
310 | - 'disable_taxes' => isset( $_POST['disable_taxes'] ), |
|
311 | - 'currency' => isset( $_POST['wpinv_currency'] ) ? wpinv_clean( $_POST['wpinv_currency'] ) : null, |
|
312 | - 'gateway' => isset( $_POST['wpinv_gateway'] ) ? wpinv_clean( $_POST['wpinv_gateway'] ) : null, |
|
313 | - 'address' => isset( $_POST['wpinv_address'] ) ? wpinv_clean( $_POST['wpinv_address'] ) : null, |
|
314 | - 'vat_number' => isset( $_POST['wpinv_vat_number'] ) ? wpinv_clean( $_POST['wpinv_vat_number'] ) : null, |
|
315 | - 'company' => isset( $_POST['wpinv_company'] ) ? wpinv_clean( $_POST['wpinv_company'] ) : null, |
|
316 | - 'zip' => isset( $_POST['wpinv_zip'] ) ? wpinv_clean( $_POST['wpinv_zip'] ) : null, |
|
317 | - 'state' => isset( $_POST['wpinv_state'] ) ? wpinv_clean( $_POST['wpinv_state'] ) : null, |
|
318 | - 'city' => isset( $_POST['wpinv_city'] ) ? wpinv_clean( $_POST['wpinv_city'] ) : null, |
|
319 | - 'country' => isset( $_POST['wpinv_country'] ) ? wpinv_clean( $_POST['wpinv_country'] ) : null, |
|
320 | - 'phone' => isset( $_POST['wpinv_phone'] ) ? wpinv_clean( $_POST['wpinv_phone'] ) : null, |
|
321 | - 'first_name' => isset( $_POST['wpinv_first_name'] ) ? wpinv_clean( $_POST['wpinv_first_name'] ) : null, |
|
322 | - 'last_name' => isset( $_POST['wpinv_last_name'] ) ? wpinv_clean( $_POST['wpinv_last_name'] ) : null, |
|
323 | - 'author' => isset( $_POST['post_author_override'] ) ? wpinv_clean( $_POST['post_author_override'] ) : null, |
|
324 | - 'date_created' => isset( $_POST['date_created'] ) ? wpinv_clean( $_POST['date_created'] ) : null, |
|
325 | - 'due_date' => isset( $_POST['wpinv_due_date'] ) ? wpinv_clean( $_POST['wpinv_due_date'] ) : null, |
|
326 | - 'number' => isset( $_POST['wpinv_number'] ) ? wpinv_clean( $_POST['wpinv_number'] ) : null, |
|
327 | - 'status' => isset( $_POST['wpinv_status'] ) ? wpinv_clean( $_POST['wpinv_status'] ) : null, |
|
308 | + 'template' => isset($_POST['wpinv_template']) ? wpinv_clean($_POST['wpinv_template']) : null, |
|
309 | + 'email_cc' => isset($_POST['wpinv_cc']) ? wpinv_clean($_POST['wpinv_cc']) : null, |
|
310 | + 'disable_taxes' => isset($_POST['disable_taxes']), |
|
311 | + 'currency' => isset($_POST['wpinv_currency']) ? wpinv_clean($_POST['wpinv_currency']) : null, |
|
312 | + 'gateway' => isset($_POST['wpinv_gateway']) ? wpinv_clean($_POST['wpinv_gateway']) : null, |
|
313 | + 'address' => isset($_POST['wpinv_address']) ? wpinv_clean($_POST['wpinv_address']) : null, |
|
314 | + 'vat_number' => isset($_POST['wpinv_vat_number']) ? wpinv_clean($_POST['wpinv_vat_number']) : null, |
|
315 | + 'company' => isset($_POST['wpinv_company']) ? wpinv_clean($_POST['wpinv_company']) : null, |
|
316 | + 'zip' => isset($_POST['wpinv_zip']) ? wpinv_clean($_POST['wpinv_zip']) : null, |
|
317 | + 'state' => isset($_POST['wpinv_state']) ? wpinv_clean($_POST['wpinv_state']) : null, |
|
318 | + 'city' => isset($_POST['wpinv_city']) ? wpinv_clean($_POST['wpinv_city']) : null, |
|
319 | + 'country' => isset($_POST['wpinv_country']) ? wpinv_clean($_POST['wpinv_country']) : null, |
|
320 | + 'phone' => isset($_POST['wpinv_phone']) ? wpinv_clean($_POST['wpinv_phone']) : null, |
|
321 | + 'first_name' => isset($_POST['wpinv_first_name']) ? wpinv_clean($_POST['wpinv_first_name']) : null, |
|
322 | + 'last_name' => isset($_POST['wpinv_last_name']) ? wpinv_clean($_POST['wpinv_last_name']) : null, |
|
323 | + 'author' => isset($_POST['post_author_override']) ? wpinv_clean($_POST['post_author_override']) : null, |
|
324 | + 'date_created' => isset($_POST['date_created']) ? wpinv_clean($_POST['date_created']) : null, |
|
325 | + 'due_date' => isset($_POST['wpinv_due_date']) ? wpinv_clean($_POST['wpinv_due_date']) : null, |
|
326 | + 'number' => isset($_POST['wpinv_number']) ? wpinv_clean($_POST['wpinv_number']) : null, |
|
327 | + 'status' => isset($_POST['wpinv_status']) ? wpinv_clean($_POST['wpinv_status']) : null, |
|
328 | 328 | ) |
329 | 329 | ); |
330 | 330 | |
331 | 331 | // Discount code. |
332 | - if ( ! $invoice->is_paid() && ! $invoice->is_refunded() ) { |
|
332 | + if (!$invoice->is_paid() && !$invoice->is_refunded()) { |
|
333 | 333 | |
334 | - if ( isset( $_POST['wpinv_discount_code'] ) ) { |
|
335 | - $invoice->set_discount_code( $_POST['wpinv_discount_code'] ); |
|
334 | + if (isset($_POST['wpinv_discount_code'])) { |
|
335 | + $invoice->set_discount_code($_POST['wpinv_discount_code']); |
|
336 | 336 | } |
337 | 337 | |
338 | - $discount = new WPInv_Discount( $invoice->get_discount_code() ); |
|
339 | - if ( $discount->exists() ) { |
|
340 | - $invoice->add_discount( getpaid_calculate_invoice_discount( $invoice, $discount ) ); |
|
338 | + $discount = new WPInv_Discount($invoice->get_discount_code()); |
|
339 | + if ($discount->exists()) { |
|
340 | + $invoice->add_discount(getpaid_calculate_invoice_discount($invoice, $discount)); |
|
341 | 341 | } else { |
342 | - $invoice->remove_discount( 'discount_code' ); |
|
342 | + $invoice->remove_discount('discount_code'); |
|
343 | 343 | } |
344 | 344 | |
345 | 345 | // Recalculate totals. |
@@ -348,17 +348,17 @@ discard block |
||
348 | 348 | } |
349 | 349 | |
350 | 350 | // If we're creating a new user... |
351 | - if ( ! empty( $_POST['wpinv_new_user'] ) && is_email( $_POST['wpinv_email'] ) ) { |
|
351 | + if (!empty($_POST['wpinv_new_user']) && is_email($_POST['wpinv_email'])) { |
|
352 | 352 | |
353 | 353 | // Attempt to create the user. |
354 | - $user = wpinv_create_user( sanitize_email( $_POST['wpinv_email'] ) ); |
|
354 | + $user = wpinv_create_user(sanitize_email($_POST['wpinv_email'])); |
|
355 | 355 | |
356 | 356 | |
357 | 357 | // If successful, update the invoice author. |
358 | - if ( is_numeric( $user ) ) { |
|
359 | - $invoice->set_author( $user ); |
|
358 | + if (is_numeric($user)) { |
|
359 | + $invoice->set_author($user); |
|
360 | 360 | } else { |
361 | - wpinv_error_log( $user->get_error_message(), __( 'Invoice add new user', 'invoicing' ), __FILE__, __LINE__ ); |
|
361 | + wpinv_error_log($user->get_error_message(), __('Invoice add new user', 'invoicing'), __FILE__, __LINE__); |
|
362 | 362 | } |
363 | 363 | } |
364 | 364 | |
@@ -372,23 +372,23 @@ discard block |
||
372 | 372 | $GLOBALS['wpinv_skip_invoice_notification'] = false; |
373 | 373 | |
374 | 374 | // (Maybe) send new user notification. |
375 | - if ( ! empty( $user ) && is_numeric( $user ) && apply_filters( 'getpaid_send_new_user_notification', true ) ) { |
|
376 | - wp_send_new_user_notifications( $user, 'user' ); |
|
375 | + if (!empty($user) && is_numeric($user) && apply_filters('getpaid_send_new_user_notification', true)) { |
|
376 | + wp_send_new_user_notifications($user, 'user'); |
|
377 | 377 | } |
378 | 378 | |
379 | - if ( ! empty( $_POST['send_to_customer'] ) && ! $invoice->is_draft() ) { |
|
379 | + if (!empty($_POST['send_to_customer']) && !$invoice->is_draft()) { |
|
380 | 380 | |
381 | - $sent = getpaid()->get( 'invoice_emails' )->user_invoice( $invoice, true ); |
|
381 | + $sent = getpaid()->get('invoice_emails')->user_invoice($invoice, true); |
|
382 | 382 | |
383 | - if ( $sent ) { |
|
384 | - getpaid_admin()->show_success( __( 'Invoice was successfully sent to the customer', 'invoicing' ) ); |
|
383 | + if ($sent) { |
|
384 | + getpaid_admin()->show_success(__('Invoice was successfully sent to the customer', 'invoicing')); |
|
385 | 385 | } else { |
386 | - getpaid_admin()->show_error( __( 'Could not send the invoice to the customer', 'invoicing' ) ); |
|
386 | + getpaid_admin()->show_error(__('Could not send the invoice to the customer', 'invoicing')); |
|
387 | 387 | } |
388 | 388 | |
389 | 389 | } |
390 | 390 | |
391 | 391 | // Fires after an invoice is saved. |
392 | - do_action( 'wpinv_invoice_metabox_saved', $invoice ); |
|
392 | + do_action('wpinv_invoice_metabox_saved', $invoice); |
|
393 | 393 | } |
394 | 394 | } |
@@ -12,449 +12,449 @@ |
||
12 | 12 | */ |
13 | 13 | class GetPaid_Invoice_Notification_Emails { |
14 | 14 | |
15 | - /** |
|
16 | - * The array of invoice email actions. |
|
17 | - * |
|
18 | - * @param array |
|
19 | - */ |
|
20 | - public $invoice_actions; |
|
21 | - |
|
22 | - /** |
|
23 | - * Class constructor |
|
24 | - * |
|
25 | - */ |
|
26 | - public function __construct() { |
|
27 | - |
|
28 | - $this->invoice_actions = apply_filters( |
|
29 | - 'getpaid_notification_email_invoice_triggers', |
|
30 | - array( |
|
31 | - 'getpaid_new_invoice' => array( 'new_invoice', 'user_invoice' ), |
|
32 | - 'getpaid_invoice_status_wpi-cancelled' => 'cancelled_invoice', |
|
33 | - 'getpaid_invoice_status_wpi-failed' => 'failed_invoice', |
|
34 | - 'getpaid_invoice_status_wpi-onhold' => 'onhold_invoice', |
|
35 | - 'getpaid_invoice_status_wpi-processing' => 'processing_invoice', |
|
36 | - 'getpaid_invoice_status_publish' => 'completed_invoice', |
|
37 | - 'getpaid_invoice_status_wpi-renewal' => 'completed_invoice', |
|
38 | - 'getpaid_invoice_status_wpi-refunded' => 'refunded_invoice', |
|
39 | - 'getpaid_new_customer_note' => 'user_note', |
|
40 | - 'getpaid_daily_maintenance' => 'overdue', |
|
41 | - ) |
|
42 | - ); |
|
43 | - |
|
44 | - $this->init_hooks(); |
|
45 | - |
|
46 | - } |
|
47 | - |
|
48 | - /** |
|
49 | - * Registers email hooks. |
|
50 | - */ |
|
51 | - public function init_hooks() { |
|
52 | - |
|
53 | - add_filter( 'getpaid_get_email_merge_tags', array( $this, 'invoice_merge_tags' ), 10, 2 ); |
|
54 | - add_filter( 'getpaid_invoice_email_recipients', array( $this, 'filter_email_recipients' ), 10, 2 ); |
|
55 | - |
|
56 | - foreach ( $this->invoice_actions as $hook => $email_type ) { |
|
57 | - $this->init_email_type_hook( $hook, $email_type ); |
|
58 | - } |
|
59 | - } |
|
60 | - |
|
61 | - /** |
|
62 | - * Registers an email hook for an invoice action. |
|
63 | - * |
|
64 | - * @param string $hook |
|
65 | - * @param string|array $email_type |
|
66 | - */ |
|
67 | - public function init_email_type_hook( $hook, $email_type ) { |
|
68 | - |
|
69 | - $email_type = wpinv_parse_list( $email_type ); |
|
70 | - |
|
71 | - foreach ( $email_type as $type ) { |
|
72 | - |
|
73 | - $email = new GetPaid_Notification_Email( $type ); |
|
74 | - |
|
75 | - // Abort if it is not active. |
|
76 | - if ( ! $email->is_active() ) { |
|
77 | - continue; |
|
78 | - } |
|
79 | - |
|
80 | - if ( method_exists( $this, $type ) ) { |
|
81 | - add_action( $hook, array( $this, $type ), 100, 2 ); |
|
82 | - continue; |
|
83 | - } |
|
84 | - |
|
85 | - do_action( 'getpaid_invoice_init_email_type_hook', $type, $hook ); |
|
86 | - } |
|
87 | - |
|
88 | - } |
|
89 | - |
|
90 | - /** |
|
91 | - * Filters invoice merge tags. |
|
92 | - * |
|
93 | - * @param array $merge_tags |
|
94 | - * @param mixed|WPInv_Invoice|WPInv_Subscription $object |
|
95 | - */ |
|
96 | - public function invoice_merge_tags( $merge_tags, $object ) { |
|
97 | - |
|
98 | - if ( is_a( $object, 'WPInv_Invoice' ) ) { |
|
99 | - return array_merge( |
|
100 | - $merge_tags, |
|
101 | - $this->get_invoice_merge_tags( $object ) |
|
102 | - ); |
|
103 | - } |
|
104 | - |
|
105 | - if ( is_a( $object, 'WPInv_Subscription' ) ) { |
|
106 | - return array_merge( |
|
107 | - $merge_tags, |
|
108 | - $this->get_invoice_merge_tags( $object->get_parent_payment() ) |
|
109 | - ); |
|
110 | - } |
|
111 | - |
|
112 | - return $merge_tags; |
|
113 | - |
|
114 | - } |
|
115 | - |
|
116 | - /** |
|
117 | - * Generates invoice merge tags. |
|
118 | - * |
|
119 | - * @param WPInv_Invoice $invoice |
|
120 | - * @return array |
|
121 | - */ |
|
122 | - public function get_invoice_merge_tags( $invoice ) { |
|
123 | - |
|
124 | - // Abort if it does not exist. |
|
125 | - if ( ! $invoice->get_id() ) { |
|
126 | - return array(); |
|
127 | - } |
|
128 | - |
|
129 | - $merge_tags = array( |
|
130 | - '{name}' => sanitize_text_field( $invoice->get_user_full_name() ), |
|
131 | - '{full_name}' => sanitize_text_field( $invoice->get_user_full_name() ), |
|
132 | - '{first_name}' => sanitize_text_field( $invoice->get_first_name() ), |
|
133 | - '{last_name}' => sanitize_text_field( $invoice->get_last_name() ), |
|
134 | - '{email}' => sanitize_email( $invoice->get_email() ), |
|
135 | - '{invoice_number}' => sanitize_text_field( $invoice->get_number() ), |
|
136 | - '{invoice_currency}' => sanitize_text_field( $invoice->get_currency() ), |
|
137 | - '{invoice_total}' => sanitize_text_field( wpinv_price( $invoice->get_total(), $invoice->get_currency() ) ), |
|
138 | - '{invoice_link}' => esc_url( $invoice->get_view_url() ), |
|
139 | - '{invoice_pay_link}' => esc_url( $invoice->get_checkout_payment_url() ), |
|
140 | - '{invoice_receipt_link}'=> esc_url( $invoice->get_receipt_url() ), |
|
141 | - '{invoice_date}' => getpaid_format_date_value( $invoice->get_date_created() ), |
|
142 | - '{invoice_due_date}' => getpaid_format_date_value( $invoice->get_due_date(), __( 'on receipt', 'invoicing' ) ), |
|
143 | - '{invoice_quote}' => sanitize_text_field( strtolower( $invoice->get_label() ) ), |
|
144 | - '{invoice_label}' => sanitize_text_field( ucfirst( $invoice->get_label() ) ), |
|
145 | - '{invoice_description}' => wp_kses_post( $invoice->get_description() ), |
|
146 | - '{subscription_name}' => wp_kses_post( $invoice->get_subscription_name() ), |
|
147 | - '{is_was}' => strtotime( $invoice->get_due_date() ) < current_time( 'timestamp' ) ? __( 'was', 'invoicing' ) : __( 'is', 'invoicing' ), |
|
148 | - ); |
|
149 | - |
|
150 | - return apply_filters( 'getpaid_invoice_email_merge_tags', $merge_tags, $invoice ); |
|
151 | - } |
|
152 | - |
|
153 | - /** |
|
154 | - * Helper function to send an email. |
|
155 | - * |
|
156 | - * @param WPInv_Invoice $invoice |
|
157 | - * @param GetPaid_Notification_Email $email |
|
158 | - * @param string $type |
|
159 | - * @param string|array $recipients |
|
160 | - * @param array $extra_args Extra template args. |
|
161 | - */ |
|
162 | - public function send_email( $invoice, $email, $type, $recipients, $extra_args = array() ) { |
|
163 | - |
|
164 | - do_action( 'getpaid_before_send_invoice_notification', $type, $invoice, $email ); |
|
165 | - |
|
166 | - $mailer = new GetPaid_Notification_Email_Sender(); |
|
167 | - $merge_tags = $email->get_merge_tags(); |
|
168 | - |
|
169 | - $result = $mailer->send( |
|
170 | - apply_filters( 'getpaid_invoice_email_recipients', wpinv_parse_list( $recipients ), $email ), |
|
171 | - $email->add_merge_tags( $email->get_subject(), $merge_tags ), |
|
172 | - $email->get_content( $merge_tags, $extra_args ), |
|
173 | - $email->get_attachments() |
|
174 | - ); |
|
175 | - |
|
176 | - // Maybe send a copy to the admin. |
|
177 | - if ( $email->include_admin_bcc() ) { |
|
178 | - $mailer->send( |
|
179 | - wpinv_get_admin_email(), |
|
180 | - $email->add_merge_tags( $email->get_subject() . __( ' - ADMIN BCC COPY', 'invoicing' ), $merge_tags ), |
|
181 | - $email->get_content( $merge_tags ), |
|
182 | - $email->get_attachments() |
|
183 | - ); |
|
184 | - } |
|
185 | - |
|
186 | - if ( ! $result ) { |
|
187 | - $invoice->add_note( sprintf( __( 'Failed sending %s notification email.', 'invoicing' ), sanitize_key( $type ) ), false, false, true ); |
|
188 | - } |
|
189 | - |
|
190 | - do_action( 'getpaid_after_send_invoice_notification', $type, $invoice, $email ); |
|
191 | - |
|
192 | - return $result; |
|
193 | - } |
|
194 | - |
|
195 | - /** |
|
196 | - * Also send emails to any cc users. |
|
197 | - * |
|
198 | - * @param array $recipients |
|
199 | - * @param GetPaid_Notification_Email $email |
|
200 | - */ |
|
201 | - public function filter_email_recipients( $recipients, $email ) { |
|
202 | - |
|
203 | - if ( ! $email->is_admin_email() ) { |
|
204 | - $cc = $email->object->get_email_cc(); |
|
205 | - |
|
206 | - if ( ! empty( $cc ) ) { |
|
207 | - $cc = array_map( 'sanitize_email', wpinv_parse_list( $cc ) ); |
|
208 | - $recipients = array_filter( array_unique( array_merge( $recipients, $cc ) ) ); |
|
209 | - } |
|
210 | - |
|
211 | - } |
|
212 | - |
|
213 | - return $recipients; |
|
214 | - |
|
215 | - } |
|
216 | - |
|
217 | - /** |
|
218 | - * Sends a new invoice notification. |
|
219 | - * |
|
220 | - * @param WPInv_Invoice $invoice |
|
221 | - */ |
|
222 | - public function new_invoice( $invoice ) { |
|
223 | - |
|
224 | - // Only send this email for invoices created via the admin page. |
|
225 | - if ( ! $invoice->is_type( 'invoice' ) || $this->is_payment_form_invoice( $invoice->get_id() ) ) { |
|
226 | - return; |
|
227 | - } |
|
228 | - |
|
229 | - $email = new GetPaid_Notification_Email( __FUNCTION__, $invoice ); |
|
230 | - $recipient = wpinv_get_admin_email(); |
|
231 | - |
|
232 | - return $this->send_email( $invoice, $email, __FUNCTION__, $recipient ); |
|
233 | - |
|
234 | - } |
|
235 | - |
|
236 | - /** |
|
237 | - * Sends a cancelled invoice notification. |
|
238 | - * |
|
239 | - * @param WPInv_Invoice $invoice |
|
240 | - */ |
|
241 | - public function cancelled_invoice( $invoice ) { |
|
242 | - |
|
243 | - $email = new GetPaid_Notification_Email( __FUNCTION__, $invoice ); |
|
244 | - $recipient = wpinv_get_admin_email(); |
|
15 | + /** |
|
16 | + * The array of invoice email actions. |
|
17 | + * |
|
18 | + * @param array |
|
19 | + */ |
|
20 | + public $invoice_actions; |
|
21 | + |
|
22 | + /** |
|
23 | + * Class constructor |
|
24 | + * |
|
25 | + */ |
|
26 | + public function __construct() { |
|
27 | + |
|
28 | + $this->invoice_actions = apply_filters( |
|
29 | + 'getpaid_notification_email_invoice_triggers', |
|
30 | + array( |
|
31 | + 'getpaid_new_invoice' => array( 'new_invoice', 'user_invoice' ), |
|
32 | + 'getpaid_invoice_status_wpi-cancelled' => 'cancelled_invoice', |
|
33 | + 'getpaid_invoice_status_wpi-failed' => 'failed_invoice', |
|
34 | + 'getpaid_invoice_status_wpi-onhold' => 'onhold_invoice', |
|
35 | + 'getpaid_invoice_status_wpi-processing' => 'processing_invoice', |
|
36 | + 'getpaid_invoice_status_publish' => 'completed_invoice', |
|
37 | + 'getpaid_invoice_status_wpi-renewal' => 'completed_invoice', |
|
38 | + 'getpaid_invoice_status_wpi-refunded' => 'refunded_invoice', |
|
39 | + 'getpaid_new_customer_note' => 'user_note', |
|
40 | + 'getpaid_daily_maintenance' => 'overdue', |
|
41 | + ) |
|
42 | + ); |
|
43 | + |
|
44 | + $this->init_hooks(); |
|
45 | + |
|
46 | + } |
|
47 | + |
|
48 | + /** |
|
49 | + * Registers email hooks. |
|
50 | + */ |
|
51 | + public function init_hooks() { |
|
52 | + |
|
53 | + add_filter( 'getpaid_get_email_merge_tags', array( $this, 'invoice_merge_tags' ), 10, 2 ); |
|
54 | + add_filter( 'getpaid_invoice_email_recipients', array( $this, 'filter_email_recipients' ), 10, 2 ); |
|
55 | + |
|
56 | + foreach ( $this->invoice_actions as $hook => $email_type ) { |
|
57 | + $this->init_email_type_hook( $hook, $email_type ); |
|
58 | + } |
|
59 | + } |
|
60 | + |
|
61 | + /** |
|
62 | + * Registers an email hook for an invoice action. |
|
63 | + * |
|
64 | + * @param string $hook |
|
65 | + * @param string|array $email_type |
|
66 | + */ |
|
67 | + public function init_email_type_hook( $hook, $email_type ) { |
|
68 | + |
|
69 | + $email_type = wpinv_parse_list( $email_type ); |
|
70 | + |
|
71 | + foreach ( $email_type as $type ) { |
|
72 | + |
|
73 | + $email = new GetPaid_Notification_Email( $type ); |
|
74 | + |
|
75 | + // Abort if it is not active. |
|
76 | + if ( ! $email->is_active() ) { |
|
77 | + continue; |
|
78 | + } |
|
79 | + |
|
80 | + if ( method_exists( $this, $type ) ) { |
|
81 | + add_action( $hook, array( $this, $type ), 100, 2 ); |
|
82 | + continue; |
|
83 | + } |
|
84 | + |
|
85 | + do_action( 'getpaid_invoice_init_email_type_hook', $type, $hook ); |
|
86 | + } |
|
87 | + |
|
88 | + } |
|
89 | + |
|
90 | + /** |
|
91 | + * Filters invoice merge tags. |
|
92 | + * |
|
93 | + * @param array $merge_tags |
|
94 | + * @param mixed|WPInv_Invoice|WPInv_Subscription $object |
|
95 | + */ |
|
96 | + public function invoice_merge_tags( $merge_tags, $object ) { |
|
97 | + |
|
98 | + if ( is_a( $object, 'WPInv_Invoice' ) ) { |
|
99 | + return array_merge( |
|
100 | + $merge_tags, |
|
101 | + $this->get_invoice_merge_tags( $object ) |
|
102 | + ); |
|
103 | + } |
|
104 | + |
|
105 | + if ( is_a( $object, 'WPInv_Subscription' ) ) { |
|
106 | + return array_merge( |
|
107 | + $merge_tags, |
|
108 | + $this->get_invoice_merge_tags( $object->get_parent_payment() ) |
|
109 | + ); |
|
110 | + } |
|
111 | + |
|
112 | + return $merge_tags; |
|
113 | + |
|
114 | + } |
|
115 | + |
|
116 | + /** |
|
117 | + * Generates invoice merge tags. |
|
118 | + * |
|
119 | + * @param WPInv_Invoice $invoice |
|
120 | + * @return array |
|
121 | + */ |
|
122 | + public function get_invoice_merge_tags( $invoice ) { |
|
123 | + |
|
124 | + // Abort if it does not exist. |
|
125 | + if ( ! $invoice->get_id() ) { |
|
126 | + return array(); |
|
127 | + } |
|
128 | + |
|
129 | + $merge_tags = array( |
|
130 | + '{name}' => sanitize_text_field( $invoice->get_user_full_name() ), |
|
131 | + '{full_name}' => sanitize_text_field( $invoice->get_user_full_name() ), |
|
132 | + '{first_name}' => sanitize_text_field( $invoice->get_first_name() ), |
|
133 | + '{last_name}' => sanitize_text_field( $invoice->get_last_name() ), |
|
134 | + '{email}' => sanitize_email( $invoice->get_email() ), |
|
135 | + '{invoice_number}' => sanitize_text_field( $invoice->get_number() ), |
|
136 | + '{invoice_currency}' => sanitize_text_field( $invoice->get_currency() ), |
|
137 | + '{invoice_total}' => sanitize_text_field( wpinv_price( $invoice->get_total(), $invoice->get_currency() ) ), |
|
138 | + '{invoice_link}' => esc_url( $invoice->get_view_url() ), |
|
139 | + '{invoice_pay_link}' => esc_url( $invoice->get_checkout_payment_url() ), |
|
140 | + '{invoice_receipt_link}'=> esc_url( $invoice->get_receipt_url() ), |
|
141 | + '{invoice_date}' => getpaid_format_date_value( $invoice->get_date_created() ), |
|
142 | + '{invoice_due_date}' => getpaid_format_date_value( $invoice->get_due_date(), __( 'on receipt', 'invoicing' ) ), |
|
143 | + '{invoice_quote}' => sanitize_text_field( strtolower( $invoice->get_label() ) ), |
|
144 | + '{invoice_label}' => sanitize_text_field( ucfirst( $invoice->get_label() ) ), |
|
145 | + '{invoice_description}' => wp_kses_post( $invoice->get_description() ), |
|
146 | + '{subscription_name}' => wp_kses_post( $invoice->get_subscription_name() ), |
|
147 | + '{is_was}' => strtotime( $invoice->get_due_date() ) < current_time( 'timestamp' ) ? __( 'was', 'invoicing' ) : __( 'is', 'invoicing' ), |
|
148 | + ); |
|
149 | + |
|
150 | + return apply_filters( 'getpaid_invoice_email_merge_tags', $merge_tags, $invoice ); |
|
151 | + } |
|
152 | + |
|
153 | + /** |
|
154 | + * Helper function to send an email. |
|
155 | + * |
|
156 | + * @param WPInv_Invoice $invoice |
|
157 | + * @param GetPaid_Notification_Email $email |
|
158 | + * @param string $type |
|
159 | + * @param string|array $recipients |
|
160 | + * @param array $extra_args Extra template args. |
|
161 | + */ |
|
162 | + public function send_email( $invoice, $email, $type, $recipients, $extra_args = array() ) { |
|
163 | + |
|
164 | + do_action( 'getpaid_before_send_invoice_notification', $type, $invoice, $email ); |
|
165 | + |
|
166 | + $mailer = new GetPaid_Notification_Email_Sender(); |
|
167 | + $merge_tags = $email->get_merge_tags(); |
|
168 | + |
|
169 | + $result = $mailer->send( |
|
170 | + apply_filters( 'getpaid_invoice_email_recipients', wpinv_parse_list( $recipients ), $email ), |
|
171 | + $email->add_merge_tags( $email->get_subject(), $merge_tags ), |
|
172 | + $email->get_content( $merge_tags, $extra_args ), |
|
173 | + $email->get_attachments() |
|
174 | + ); |
|
175 | + |
|
176 | + // Maybe send a copy to the admin. |
|
177 | + if ( $email->include_admin_bcc() ) { |
|
178 | + $mailer->send( |
|
179 | + wpinv_get_admin_email(), |
|
180 | + $email->add_merge_tags( $email->get_subject() . __( ' - ADMIN BCC COPY', 'invoicing' ), $merge_tags ), |
|
181 | + $email->get_content( $merge_tags ), |
|
182 | + $email->get_attachments() |
|
183 | + ); |
|
184 | + } |
|
185 | + |
|
186 | + if ( ! $result ) { |
|
187 | + $invoice->add_note( sprintf( __( 'Failed sending %s notification email.', 'invoicing' ), sanitize_key( $type ) ), false, false, true ); |
|
188 | + } |
|
189 | + |
|
190 | + do_action( 'getpaid_after_send_invoice_notification', $type, $invoice, $email ); |
|
191 | + |
|
192 | + return $result; |
|
193 | + } |
|
194 | + |
|
195 | + /** |
|
196 | + * Also send emails to any cc users. |
|
197 | + * |
|
198 | + * @param array $recipients |
|
199 | + * @param GetPaid_Notification_Email $email |
|
200 | + */ |
|
201 | + public function filter_email_recipients( $recipients, $email ) { |
|
202 | + |
|
203 | + if ( ! $email->is_admin_email() ) { |
|
204 | + $cc = $email->object->get_email_cc(); |
|
205 | + |
|
206 | + if ( ! empty( $cc ) ) { |
|
207 | + $cc = array_map( 'sanitize_email', wpinv_parse_list( $cc ) ); |
|
208 | + $recipients = array_filter( array_unique( array_merge( $recipients, $cc ) ) ); |
|
209 | + } |
|
210 | + |
|
211 | + } |
|
212 | + |
|
213 | + return $recipients; |
|
214 | + |
|
215 | + } |
|
216 | + |
|
217 | + /** |
|
218 | + * Sends a new invoice notification. |
|
219 | + * |
|
220 | + * @param WPInv_Invoice $invoice |
|
221 | + */ |
|
222 | + public function new_invoice( $invoice ) { |
|
223 | + |
|
224 | + // Only send this email for invoices created via the admin page. |
|
225 | + if ( ! $invoice->is_type( 'invoice' ) || $this->is_payment_form_invoice( $invoice->get_id() ) ) { |
|
226 | + return; |
|
227 | + } |
|
228 | + |
|
229 | + $email = new GetPaid_Notification_Email( __FUNCTION__, $invoice ); |
|
230 | + $recipient = wpinv_get_admin_email(); |
|
231 | + |
|
232 | + return $this->send_email( $invoice, $email, __FUNCTION__, $recipient ); |
|
233 | + |
|
234 | + } |
|
235 | + |
|
236 | + /** |
|
237 | + * Sends a cancelled invoice notification. |
|
238 | + * |
|
239 | + * @param WPInv_Invoice $invoice |
|
240 | + */ |
|
241 | + public function cancelled_invoice( $invoice ) { |
|
242 | + |
|
243 | + $email = new GetPaid_Notification_Email( __FUNCTION__, $invoice ); |
|
244 | + $recipient = wpinv_get_admin_email(); |
|
245 | 245 | |
246 | - return $this->send_email( $invoice, $email, __FUNCTION__, $recipient ); |
|
246 | + return $this->send_email( $invoice, $email, __FUNCTION__, $recipient ); |
|
247 | 247 | |
248 | - } |
|
248 | + } |
|
249 | 249 | |
250 | - /** |
|
251 | - * Sends a failed invoice notification. |
|
252 | - * |
|
253 | - * @param WPInv_Invoice $invoice |
|
254 | - */ |
|
255 | - public function failed_invoice( $invoice ) { |
|
250 | + /** |
|
251 | + * Sends a failed invoice notification. |
|
252 | + * |
|
253 | + * @param WPInv_Invoice $invoice |
|
254 | + */ |
|
255 | + public function failed_invoice( $invoice ) { |
|
256 | 256 | |
257 | - $email = new GetPaid_Notification_Email( __FUNCTION__, $invoice ); |
|
258 | - $recipient = wpinv_get_admin_email(); |
|
257 | + $email = new GetPaid_Notification_Email( __FUNCTION__, $invoice ); |
|
258 | + $recipient = wpinv_get_admin_email(); |
|
259 | 259 | |
260 | - return $this->send_email( $invoice, $email, __FUNCTION__, $recipient ); |
|
260 | + return $this->send_email( $invoice, $email, __FUNCTION__, $recipient ); |
|
261 | 261 | |
262 | - } |
|
262 | + } |
|
263 | 263 | |
264 | - /** |
|
265 | - * Sends a notification whenever an invoice is put on hold. |
|
266 | - * |
|
267 | - * @param WPInv_Invoice $invoice |
|
268 | - */ |
|
269 | - public function onhold_invoice( $invoice ) { |
|
264 | + /** |
|
265 | + * Sends a notification whenever an invoice is put on hold. |
|
266 | + * |
|
267 | + * @param WPInv_Invoice $invoice |
|
268 | + */ |
|
269 | + public function onhold_invoice( $invoice ) { |
|
270 | 270 | |
271 | - $email = new GetPaid_Notification_Email( __FUNCTION__, $invoice ); |
|
272 | - $recipient = $invoice->get_email(); |
|
271 | + $email = new GetPaid_Notification_Email( __FUNCTION__, $invoice ); |
|
272 | + $recipient = $invoice->get_email(); |
|
273 | 273 | |
274 | - return $this->send_email( $invoice, $email, __FUNCTION__, $recipient ); |
|
274 | + return $this->send_email( $invoice, $email, __FUNCTION__, $recipient ); |
|
275 | 275 | |
276 | - } |
|
276 | + } |
|
277 | 277 | |
278 | - /** |
|
279 | - * Sends a notification whenever an invoice is marked as processing payment. |
|
280 | - * |
|
281 | - * @param WPInv_Invoice $invoice |
|
282 | - */ |
|
283 | - public function processing_invoice( $invoice ) { |
|
278 | + /** |
|
279 | + * Sends a notification whenever an invoice is marked as processing payment. |
|
280 | + * |
|
281 | + * @param WPInv_Invoice $invoice |
|
282 | + */ |
|
283 | + public function processing_invoice( $invoice ) { |
|
284 | 284 | |
285 | - $email = new GetPaid_Notification_Email( __FUNCTION__, $invoice ); |
|
286 | - $recipient = $invoice->get_email(); |
|
285 | + $email = new GetPaid_Notification_Email( __FUNCTION__, $invoice ); |
|
286 | + $recipient = $invoice->get_email(); |
|
287 | 287 | |
288 | - return $this->send_email( $invoice, $email, __FUNCTION__, $recipient ); |
|
288 | + return $this->send_email( $invoice, $email, __FUNCTION__, $recipient ); |
|
289 | 289 | |
290 | - } |
|
290 | + } |
|
291 | 291 | |
292 | - /** |
|
293 | - * Sends a notification whenever an invoice is paid. |
|
294 | - * |
|
295 | - * @param WPInv_Invoice $invoice |
|
296 | - */ |
|
297 | - public function completed_invoice( $invoice ) { |
|
292 | + /** |
|
293 | + * Sends a notification whenever an invoice is paid. |
|
294 | + * |
|
295 | + * @param WPInv_Invoice $invoice |
|
296 | + */ |
|
297 | + public function completed_invoice( $invoice ) { |
|
298 | 298 | |
299 | - // (Maybe) abort if it is a renewal invoice. |
|
300 | - if ( $invoice->is_renewal() && ! wpinv_get_option( 'email_completed_invoice_renewal_active', false ) ) { |
|
301 | - return; |
|
302 | - } |
|
299 | + // (Maybe) abort if it is a renewal invoice. |
|
300 | + if ( $invoice->is_renewal() && ! wpinv_get_option( 'email_completed_invoice_renewal_active', false ) ) { |
|
301 | + return; |
|
302 | + } |
|
303 | 303 | |
304 | - $email = new GetPaid_Notification_Email( __FUNCTION__, $invoice ); |
|
305 | - $recipient = $invoice->get_email(); |
|
304 | + $email = new GetPaid_Notification_Email( __FUNCTION__, $invoice ); |
|
305 | + $recipient = $invoice->get_email(); |
|
306 | 306 | |
307 | - return $this->send_email( $invoice, $email, __FUNCTION__, $recipient ); |
|
307 | + return $this->send_email( $invoice, $email, __FUNCTION__, $recipient ); |
|
308 | 308 | |
309 | - } |
|
309 | + } |
|
310 | 310 | |
311 | - /** |
|
312 | - * Sends a notification whenever an invoice is refunded. |
|
313 | - * |
|
314 | - * @param WPInv_Invoice $invoice |
|
315 | - */ |
|
316 | - public function refunded_invoice( $invoice ) { |
|
311 | + /** |
|
312 | + * Sends a notification whenever an invoice is refunded. |
|
313 | + * |
|
314 | + * @param WPInv_Invoice $invoice |
|
315 | + */ |
|
316 | + public function refunded_invoice( $invoice ) { |
|
317 | 317 | |
318 | - $email = new GetPaid_Notification_Email( __FUNCTION__, $invoice ); |
|
319 | - $recipient = $invoice->get_email(); |
|
318 | + $email = new GetPaid_Notification_Email( __FUNCTION__, $invoice ); |
|
319 | + $recipient = $invoice->get_email(); |
|
320 | 320 | |
321 | - return $this->send_email( $invoice, $email, __FUNCTION__, $recipient ); |
|
321 | + return $this->send_email( $invoice, $email, __FUNCTION__, $recipient ); |
|
322 | 322 | |
323 | - } |
|
323 | + } |
|
324 | 324 | |
325 | - /** |
|
326 | - * Notifies a user about new invoices |
|
327 | - * |
|
328 | - * @param WPInv_Invoice $invoice |
|
329 | - * @param bool $force |
|
330 | - */ |
|
331 | - public function user_invoice( $invoice, $force = false ) { |
|
325 | + /** |
|
326 | + * Notifies a user about new invoices |
|
327 | + * |
|
328 | + * @param WPInv_Invoice $invoice |
|
329 | + * @param bool $force |
|
330 | + */ |
|
331 | + public function user_invoice( $invoice, $force = false ) { |
|
332 | 332 | |
333 | - if ( ! empty( $GLOBALS['wpinv_skip_invoice_notification'] ) ) { |
|
334 | - return; |
|
335 | - } |
|
333 | + if ( ! empty( $GLOBALS['wpinv_skip_invoice_notification'] ) ) { |
|
334 | + return; |
|
335 | + } |
|
336 | 336 | |
337 | - // Only send this email for invoices created via the admin page. |
|
338 | - if ( ! $invoice->is_type( 'invoice' ) || ( empty( $force ) && $this->is_payment_form_invoice( $invoice->get_id() ) ) ) { |
|
339 | - return; |
|
340 | - } |
|
337 | + // Only send this email for invoices created via the admin page. |
|
338 | + if ( ! $invoice->is_type( 'invoice' ) || ( empty( $force ) && $this->is_payment_form_invoice( $invoice->get_id() ) ) ) { |
|
339 | + return; |
|
340 | + } |
|
341 | 341 | |
342 | - $email = new GetPaid_Notification_Email( __FUNCTION__, $invoice ); |
|
343 | - $recipient = $invoice->get_email(); |
|
342 | + $email = new GetPaid_Notification_Email( __FUNCTION__, $invoice ); |
|
343 | + $recipient = $invoice->get_email(); |
|
344 | 344 | |
345 | - return $this->send_email( $invoice, $email, __FUNCTION__, $recipient ); |
|
345 | + return $this->send_email( $invoice, $email, __FUNCTION__, $recipient ); |
|
346 | 346 | |
347 | - } |
|
347 | + } |
|
348 | 348 | |
349 | - /** |
|
350 | - * Checks if an invoice is a payment form invoice. |
|
351 | - * |
|
352 | - * @param int $invoice |
|
353 | - * @return bool |
|
354 | - */ |
|
355 | - public function is_payment_form_invoice( $invoice ) { |
|
356 | - return empty( $_GET['getpaid-admin-action'] ) && ( 'payment_form' == get_post_meta( $invoice, 'wpinv_created_via', true ) || 'geodirectory' == get_post_meta( $invoice, 'wpinv_created_via', true ) ); |
|
357 | - } |
|
349 | + /** |
|
350 | + * Checks if an invoice is a payment form invoice. |
|
351 | + * |
|
352 | + * @param int $invoice |
|
353 | + * @return bool |
|
354 | + */ |
|
355 | + public function is_payment_form_invoice( $invoice ) { |
|
356 | + return empty( $_GET['getpaid-admin-action'] ) && ( 'payment_form' == get_post_meta( $invoice, 'wpinv_created_via', true ) || 'geodirectory' == get_post_meta( $invoice, 'wpinv_created_via', true ) ); |
|
357 | + } |
|
358 | 358 | |
359 | - /** |
|
360 | - * Notifies admin about new invoice notes |
|
361 | - * |
|
362 | - * @param WPInv_Invoice $invoice |
|
363 | - * @param string $note |
|
364 | - */ |
|
365 | - public function user_note( $invoice, $note ) { |
|
366 | - |
|
367 | - $email = new GetPaid_Notification_Email( __FUNCTION__, $invoice ); |
|
368 | - $recipient = $invoice->get_email(); |
|
359 | + /** |
|
360 | + * Notifies admin about new invoice notes |
|
361 | + * |
|
362 | + * @param WPInv_Invoice $invoice |
|
363 | + * @param string $note |
|
364 | + */ |
|
365 | + public function user_note( $invoice, $note ) { |
|
366 | + |
|
367 | + $email = new GetPaid_Notification_Email( __FUNCTION__, $invoice ); |
|
368 | + $recipient = $invoice->get_email(); |
|
369 | 369 | |
370 | - return $this->send_email( $invoice, $email, __FUNCTION__, $recipient, array( 'customer_note' => $note ) ); |
|
371 | - |
|
372 | - } |
|
370 | + return $this->send_email( $invoice, $email, __FUNCTION__, $recipient, array( 'customer_note' => $note ) ); |
|
371 | + |
|
372 | + } |
|
373 | 373 | |
374 | - /** |
|
375 | - * (Force) Sends overdue notices. |
|
376 | - * |
|
377 | - * @param WPInv_Invoice $invoice |
|
378 | - */ |
|
379 | - public function force_send_overdue_notice( $invoice ) { |
|
380 | - $email = new GetPaid_Notification_Email( 'overdue', $invoice ); |
|
381 | - return $this->send_email( $invoice, $email, 'overdue', $invoice->get_email() ); |
|
382 | - } |
|
383 | - |
|
384 | - /** |
|
385 | - * Sends overdue notices. |
|
386 | - * |
|
387 | - * @TODO: Create an invoices query class. |
|
388 | - */ |
|
389 | - public function overdue() { |
|
390 | - global $wpdb; |
|
391 | - |
|
392 | - $email = new GetPaid_Notification_Email( __FUNCTION__ ); |
|
393 | - |
|
394 | - // Fetch reminder days. |
|
395 | - $reminder_days = array_unique( wp_parse_id_list( $email->get_option( 'days' ) ) ); |
|
396 | - |
|
397 | - // Abort if non is set. |
|
398 | - if ( empty( $reminder_days ) ) { |
|
399 | - return; |
|
400 | - } |
|
401 | - |
|
402 | - // Retrieve date query. |
|
403 | - $date_query = $this->get_date_query( $reminder_days ); |
|
404 | - |
|
405 | - // Invoices table. |
|
406 | - $table = $wpdb->prefix . 'getpaid_invoices'; |
|
407 | - |
|
408 | - // Fetch invoices. |
|
409 | - $invoices = $wpdb->get_col( |
|
410 | - "SELECT posts.ID FROM $wpdb->posts as posts |
|
374 | + /** |
|
375 | + * (Force) Sends overdue notices. |
|
376 | + * |
|
377 | + * @param WPInv_Invoice $invoice |
|
378 | + */ |
|
379 | + public function force_send_overdue_notice( $invoice ) { |
|
380 | + $email = new GetPaid_Notification_Email( 'overdue', $invoice ); |
|
381 | + return $this->send_email( $invoice, $email, 'overdue', $invoice->get_email() ); |
|
382 | + } |
|
383 | + |
|
384 | + /** |
|
385 | + * Sends overdue notices. |
|
386 | + * |
|
387 | + * @TODO: Create an invoices query class. |
|
388 | + */ |
|
389 | + public function overdue() { |
|
390 | + global $wpdb; |
|
391 | + |
|
392 | + $email = new GetPaid_Notification_Email( __FUNCTION__ ); |
|
393 | + |
|
394 | + // Fetch reminder days. |
|
395 | + $reminder_days = array_unique( wp_parse_id_list( $email->get_option( 'days' ) ) ); |
|
396 | + |
|
397 | + // Abort if non is set. |
|
398 | + if ( empty( $reminder_days ) ) { |
|
399 | + return; |
|
400 | + } |
|
401 | + |
|
402 | + // Retrieve date query. |
|
403 | + $date_query = $this->get_date_query( $reminder_days ); |
|
404 | + |
|
405 | + // Invoices table. |
|
406 | + $table = $wpdb->prefix . 'getpaid_invoices'; |
|
407 | + |
|
408 | + // Fetch invoices. |
|
409 | + $invoices = $wpdb->get_col( |
|
410 | + "SELECT posts.ID FROM $wpdb->posts as posts |
|
411 | 411 | LEFT JOIN $table as invoices ON invoices.post_id = posts.ID |
412 | 412 | WHERE posts.post_type = 'wpi_invoice' AND posts.post_status = 'wpi-pending' $date_query"); |
413 | 413 | |
414 | - foreach ( $invoices as $invoice ) { |
|
414 | + foreach ( $invoices as $invoice ) { |
|
415 | 415 | |
416 | - // Only send this email for invoices created via the admin page. |
|
417 | - if ( ! $this->is_payment_form_invoice( $invoice ) ) { |
|
418 | - $invoice = new WPInv_Invoice( $invoice ); |
|
419 | - $email->object = $invoice; |
|
416 | + // Only send this email for invoices created via the admin page. |
|
417 | + if ( ! $this->is_payment_form_invoice( $invoice ) ) { |
|
418 | + $invoice = new WPInv_Invoice( $invoice ); |
|
419 | + $email->object = $invoice; |
|
420 | 420 | |
421 | - if ( $invoice->needs_payment() ) { |
|
422 | - $this->send_email( $invoice, $email, __FUNCTION__, $invoice->get_email() ); |
|
423 | - } |
|
421 | + if ( $invoice->needs_payment() ) { |
|
422 | + $this->send_email( $invoice, $email, __FUNCTION__, $invoice->get_email() ); |
|
423 | + } |
|
424 | 424 | |
425 | - } |
|
425 | + } |
|
426 | 426 | |
427 | - } |
|
427 | + } |
|
428 | 428 | |
429 | - } |
|
429 | + } |
|
430 | 430 | |
431 | - /** |
|
432 | - * Calculates the date query for an invoices query |
|
433 | - * |
|
434 | - * @param array $reminder_days |
|
435 | - * @return string |
|
436 | - */ |
|
437 | - public function get_date_query( $reminder_days ) { |
|
431 | + /** |
|
432 | + * Calculates the date query for an invoices query |
|
433 | + * |
|
434 | + * @param array $reminder_days |
|
435 | + * @return string |
|
436 | + */ |
|
437 | + public function get_date_query( $reminder_days ) { |
|
438 | 438 | |
439 | - $date_query = array( |
|
440 | - 'relation' => 'OR' |
|
441 | - ); |
|
439 | + $date_query = array( |
|
440 | + 'relation' => 'OR' |
|
441 | + ); |
|
442 | 442 | |
443 | - foreach ( $reminder_days as $days ) { |
|
444 | - $date = date_parse( date( 'Y-m-d', strtotime( "-$days days", current_time( 'timestamp' ) ) ) ); |
|
443 | + foreach ( $reminder_days as $days ) { |
|
444 | + $date = date_parse( date( 'Y-m-d', strtotime( "-$days days", current_time( 'timestamp' ) ) ) ); |
|
445 | 445 | |
446 | - $date_query[] = array( |
|
447 | - 'year' => $date['year'], |
|
448 | - 'month' => $date['month'], |
|
449 | - 'day' => $date['day'], |
|
450 | - ); |
|
446 | + $date_query[] = array( |
|
447 | + 'year' => $date['year'], |
|
448 | + 'month' => $date['month'], |
|
449 | + 'day' => $date['day'], |
|
450 | + ); |
|
451 | 451 | |
452 | - } |
|
452 | + } |
|
453 | 453 | |
454 | - $date_query = new WP_Date_Query( $date_query, 'invoices.due_date' ); |
|
454 | + $date_query = new WP_Date_Query( $date_query, 'invoices.due_date' ); |
|
455 | 455 | |
456 | - return $date_query->get_sql(); |
|
456 | + return $date_query->get_sql(); |
|
457 | 457 | |
458 | - } |
|
458 | + } |
|
459 | 459 | |
460 | 460 | } |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | * |
5 | 5 | */ |
6 | 6 | |
7 | -defined( 'ABSPATH' ) || exit; |
|
7 | +defined('ABSPATH') || exit; |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * This class handles invoice notificaiton emails. |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | $this->invoice_actions = apply_filters( |
29 | 29 | 'getpaid_notification_email_invoice_triggers', |
30 | 30 | array( |
31 | - 'getpaid_new_invoice' => array( 'new_invoice', 'user_invoice' ), |
|
31 | + 'getpaid_new_invoice' => array('new_invoice', 'user_invoice'), |
|
32 | 32 | 'getpaid_invoice_status_wpi-cancelled' => 'cancelled_invoice', |
33 | 33 | 'getpaid_invoice_status_wpi-failed' => 'failed_invoice', |
34 | 34 | 'getpaid_invoice_status_wpi-onhold' => 'onhold_invoice', |
@@ -50,11 +50,11 @@ discard block |
||
50 | 50 | */ |
51 | 51 | public function init_hooks() { |
52 | 52 | |
53 | - add_filter( 'getpaid_get_email_merge_tags', array( $this, 'invoice_merge_tags' ), 10, 2 ); |
|
54 | - add_filter( 'getpaid_invoice_email_recipients', array( $this, 'filter_email_recipients' ), 10, 2 ); |
|
53 | + add_filter('getpaid_get_email_merge_tags', array($this, 'invoice_merge_tags'), 10, 2); |
|
54 | + add_filter('getpaid_invoice_email_recipients', array($this, 'filter_email_recipients'), 10, 2); |
|
55 | 55 | |
56 | - foreach ( $this->invoice_actions as $hook => $email_type ) { |
|
57 | - $this->init_email_type_hook( $hook, $email_type ); |
|
56 | + foreach ($this->invoice_actions as $hook => $email_type) { |
|
57 | + $this->init_email_type_hook($hook, $email_type); |
|
58 | 58 | } |
59 | 59 | } |
60 | 60 | |
@@ -64,25 +64,25 @@ discard block |
||
64 | 64 | * @param string $hook |
65 | 65 | * @param string|array $email_type |
66 | 66 | */ |
67 | - public function init_email_type_hook( $hook, $email_type ) { |
|
67 | + public function init_email_type_hook($hook, $email_type) { |
|
68 | 68 | |
69 | - $email_type = wpinv_parse_list( $email_type ); |
|
69 | + $email_type = wpinv_parse_list($email_type); |
|
70 | 70 | |
71 | - foreach ( $email_type as $type ) { |
|
71 | + foreach ($email_type as $type) { |
|
72 | 72 | |
73 | - $email = new GetPaid_Notification_Email( $type ); |
|
73 | + $email = new GetPaid_Notification_Email($type); |
|
74 | 74 | |
75 | 75 | // Abort if it is not active. |
76 | - if ( ! $email->is_active() ) { |
|
76 | + if (!$email->is_active()) { |
|
77 | 77 | continue; |
78 | 78 | } |
79 | 79 | |
80 | - if ( method_exists( $this, $type ) ) { |
|
81 | - add_action( $hook, array( $this, $type ), 100, 2 ); |
|
80 | + if (method_exists($this, $type)) { |
|
81 | + add_action($hook, array($this, $type), 100, 2); |
|
82 | 82 | continue; |
83 | 83 | } |
84 | 84 | |
85 | - do_action( 'getpaid_invoice_init_email_type_hook', $type, $hook ); |
|
85 | + do_action('getpaid_invoice_init_email_type_hook', $type, $hook); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | } |
@@ -93,19 +93,19 @@ discard block |
||
93 | 93 | * @param array $merge_tags |
94 | 94 | * @param mixed|WPInv_Invoice|WPInv_Subscription $object |
95 | 95 | */ |
96 | - public function invoice_merge_tags( $merge_tags, $object ) { |
|
96 | + public function invoice_merge_tags($merge_tags, $object) { |
|
97 | 97 | |
98 | - if ( is_a( $object, 'WPInv_Invoice' ) ) { |
|
98 | + if (is_a($object, 'WPInv_Invoice')) { |
|
99 | 99 | return array_merge( |
100 | 100 | $merge_tags, |
101 | - $this->get_invoice_merge_tags( $object ) |
|
101 | + $this->get_invoice_merge_tags($object) |
|
102 | 102 | ); |
103 | 103 | } |
104 | 104 | |
105 | - if ( is_a( $object, 'WPInv_Subscription' ) ) { |
|
105 | + if (is_a($object, 'WPInv_Subscription')) { |
|
106 | 106 | return array_merge( |
107 | 107 | $merge_tags, |
108 | - $this->get_invoice_merge_tags( $object->get_parent_payment() ) |
|
108 | + $this->get_invoice_merge_tags($object->get_parent_payment()) |
|
109 | 109 | ); |
110 | 110 | } |
111 | 111 | |
@@ -119,35 +119,35 @@ discard block |
||
119 | 119 | * @param WPInv_Invoice $invoice |
120 | 120 | * @return array |
121 | 121 | */ |
122 | - public function get_invoice_merge_tags( $invoice ) { |
|
122 | + public function get_invoice_merge_tags($invoice) { |
|
123 | 123 | |
124 | 124 | // Abort if it does not exist. |
125 | - if ( ! $invoice->get_id() ) { |
|
125 | + if (!$invoice->get_id()) { |
|
126 | 126 | return array(); |
127 | 127 | } |
128 | 128 | |
129 | 129 | $merge_tags = array( |
130 | - '{name}' => sanitize_text_field( $invoice->get_user_full_name() ), |
|
131 | - '{full_name}' => sanitize_text_field( $invoice->get_user_full_name() ), |
|
132 | - '{first_name}' => sanitize_text_field( $invoice->get_first_name() ), |
|
133 | - '{last_name}' => sanitize_text_field( $invoice->get_last_name() ), |
|
134 | - '{email}' => sanitize_email( $invoice->get_email() ), |
|
135 | - '{invoice_number}' => sanitize_text_field( $invoice->get_number() ), |
|
136 | - '{invoice_currency}' => sanitize_text_field( $invoice->get_currency() ), |
|
137 | - '{invoice_total}' => sanitize_text_field( wpinv_price( $invoice->get_total(), $invoice->get_currency() ) ), |
|
138 | - '{invoice_link}' => esc_url( $invoice->get_view_url() ), |
|
139 | - '{invoice_pay_link}' => esc_url( $invoice->get_checkout_payment_url() ), |
|
140 | - '{invoice_receipt_link}'=> esc_url( $invoice->get_receipt_url() ), |
|
141 | - '{invoice_date}' => getpaid_format_date_value( $invoice->get_date_created() ), |
|
142 | - '{invoice_due_date}' => getpaid_format_date_value( $invoice->get_due_date(), __( 'on receipt', 'invoicing' ) ), |
|
143 | - '{invoice_quote}' => sanitize_text_field( strtolower( $invoice->get_label() ) ), |
|
144 | - '{invoice_label}' => sanitize_text_field( ucfirst( $invoice->get_label() ) ), |
|
145 | - '{invoice_description}' => wp_kses_post( $invoice->get_description() ), |
|
146 | - '{subscription_name}' => wp_kses_post( $invoice->get_subscription_name() ), |
|
147 | - '{is_was}' => strtotime( $invoice->get_due_date() ) < current_time( 'timestamp' ) ? __( 'was', 'invoicing' ) : __( 'is', 'invoicing' ), |
|
130 | + '{name}' => sanitize_text_field($invoice->get_user_full_name()), |
|
131 | + '{full_name}' => sanitize_text_field($invoice->get_user_full_name()), |
|
132 | + '{first_name}' => sanitize_text_field($invoice->get_first_name()), |
|
133 | + '{last_name}' => sanitize_text_field($invoice->get_last_name()), |
|
134 | + '{email}' => sanitize_email($invoice->get_email()), |
|
135 | + '{invoice_number}' => sanitize_text_field($invoice->get_number()), |
|
136 | + '{invoice_currency}' => sanitize_text_field($invoice->get_currency()), |
|
137 | + '{invoice_total}' => sanitize_text_field(wpinv_price($invoice->get_total(), $invoice->get_currency())), |
|
138 | + '{invoice_link}' => esc_url($invoice->get_view_url()), |
|
139 | + '{invoice_pay_link}' => esc_url($invoice->get_checkout_payment_url()), |
|
140 | + '{invoice_receipt_link}'=> esc_url($invoice->get_receipt_url()), |
|
141 | + '{invoice_date}' => getpaid_format_date_value($invoice->get_date_created()), |
|
142 | + '{invoice_due_date}' => getpaid_format_date_value($invoice->get_due_date(), __('on receipt', 'invoicing')), |
|
143 | + '{invoice_quote}' => sanitize_text_field(strtolower($invoice->get_label())), |
|
144 | + '{invoice_label}' => sanitize_text_field(ucfirst($invoice->get_label())), |
|
145 | + '{invoice_description}' => wp_kses_post($invoice->get_description()), |
|
146 | + '{subscription_name}' => wp_kses_post($invoice->get_subscription_name()), |
|
147 | + '{is_was}' => strtotime($invoice->get_due_date()) < current_time('timestamp') ? __('was', 'invoicing') : __('is', 'invoicing'), |
|
148 | 148 | ); |
149 | 149 | |
150 | - return apply_filters( 'getpaid_invoice_email_merge_tags', $merge_tags, $invoice ); |
|
150 | + return apply_filters('getpaid_invoice_email_merge_tags', $merge_tags, $invoice); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | /** |
@@ -159,35 +159,35 @@ discard block |
||
159 | 159 | * @param string|array $recipients |
160 | 160 | * @param array $extra_args Extra template args. |
161 | 161 | */ |
162 | - public function send_email( $invoice, $email, $type, $recipients, $extra_args = array() ) { |
|
162 | + public function send_email($invoice, $email, $type, $recipients, $extra_args = array()) { |
|
163 | 163 | |
164 | - do_action( 'getpaid_before_send_invoice_notification', $type, $invoice, $email ); |
|
164 | + do_action('getpaid_before_send_invoice_notification', $type, $invoice, $email); |
|
165 | 165 | |
166 | 166 | $mailer = new GetPaid_Notification_Email_Sender(); |
167 | 167 | $merge_tags = $email->get_merge_tags(); |
168 | 168 | |
169 | 169 | $result = $mailer->send( |
170 | - apply_filters( 'getpaid_invoice_email_recipients', wpinv_parse_list( $recipients ), $email ), |
|
171 | - $email->add_merge_tags( $email->get_subject(), $merge_tags ), |
|
172 | - $email->get_content( $merge_tags, $extra_args ), |
|
170 | + apply_filters('getpaid_invoice_email_recipients', wpinv_parse_list($recipients), $email), |
|
171 | + $email->add_merge_tags($email->get_subject(), $merge_tags), |
|
172 | + $email->get_content($merge_tags, $extra_args), |
|
173 | 173 | $email->get_attachments() |
174 | 174 | ); |
175 | 175 | |
176 | 176 | // Maybe send a copy to the admin. |
177 | - if ( $email->include_admin_bcc() ) { |
|
177 | + if ($email->include_admin_bcc()) { |
|
178 | 178 | $mailer->send( |
179 | 179 | wpinv_get_admin_email(), |
180 | - $email->add_merge_tags( $email->get_subject() . __( ' - ADMIN BCC COPY', 'invoicing' ), $merge_tags ), |
|
181 | - $email->get_content( $merge_tags ), |
|
180 | + $email->add_merge_tags($email->get_subject() . __(' - ADMIN BCC COPY', 'invoicing'), $merge_tags), |
|
181 | + $email->get_content($merge_tags), |
|
182 | 182 | $email->get_attachments() |
183 | 183 | ); |
184 | 184 | } |
185 | 185 | |
186 | - if ( ! $result ) { |
|
187 | - $invoice->add_note( sprintf( __( 'Failed sending %s notification email.', 'invoicing' ), sanitize_key( $type ) ), false, false, true ); |
|
186 | + if (!$result) { |
|
187 | + $invoice->add_note(sprintf(__('Failed sending %s notification email.', 'invoicing'), sanitize_key($type)), false, false, true); |
|
188 | 188 | } |
189 | 189 | |
190 | - do_action( 'getpaid_after_send_invoice_notification', $type, $invoice, $email ); |
|
190 | + do_action('getpaid_after_send_invoice_notification', $type, $invoice, $email); |
|
191 | 191 | |
192 | 192 | return $result; |
193 | 193 | } |
@@ -198,14 +198,14 @@ discard block |
||
198 | 198 | * @param array $recipients |
199 | 199 | * @param GetPaid_Notification_Email $email |
200 | 200 | */ |
201 | - public function filter_email_recipients( $recipients, $email ) { |
|
201 | + public function filter_email_recipients($recipients, $email) { |
|
202 | 202 | |
203 | - if ( ! $email->is_admin_email() ) { |
|
203 | + if (!$email->is_admin_email()) { |
|
204 | 204 | $cc = $email->object->get_email_cc(); |
205 | 205 | |
206 | - if ( ! empty( $cc ) ) { |
|
207 | - $cc = array_map( 'sanitize_email', wpinv_parse_list( $cc ) ); |
|
208 | - $recipients = array_filter( array_unique( array_merge( $recipients, $cc ) ) ); |
|
206 | + if (!empty($cc)) { |
|
207 | + $cc = array_map('sanitize_email', wpinv_parse_list($cc)); |
|
208 | + $recipients = array_filter(array_unique(array_merge($recipients, $cc))); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | } |
@@ -219,17 +219,17 @@ discard block |
||
219 | 219 | * |
220 | 220 | * @param WPInv_Invoice $invoice |
221 | 221 | */ |
222 | - public function new_invoice( $invoice ) { |
|
222 | + public function new_invoice($invoice) { |
|
223 | 223 | |
224 | 224 | // Only send this email for invoices created via the admin page. |
225 | - if ( ! $invoice->is_type( 'invoice' ) || $this->is_payment_form_invoice( $invoice->get_id() ) ) { |
|
225 | + if (!$invoice->is_type('invoice') || $this->is_payment_form_invoice($invoice->get_id())) { |
|
226 | 226 | return; |
227 | 227 | } |
228 | 228 | |
229 | - $email = new GetPaid_Notification_Email( __FUNCTION__, $invoice ); |
|
229 | + $email = new GetPaid_Notification_Email(__FUNCTION__, $invoice); |
|
230 | 230 | $recipient = wpinv_get_admin_email(); |
231 | 231 | |
232 | - return $this->send_email( $invoice, $email, __FUNCTION__, $recipient ); |
|
232 | + return $this->send_email($invoice, $email, __FUNCTION__, $recipient); |
|
233 | 233 | |
234 | 234 | } |
235 | 235 | |
@@ -238,12 +238,12 @@ discard block |
||
238 | 238 | * |
239 | 239 | * @param WPInv_Invoice $invoice |
240 | 240 | */ |
241 | - public function cancelled_invoice( $invoice ) { |
|
241 | + public function cancelled_invoice($invoice) { |
|
242 | 242 | |
243 | - $email = new GetPaid_Notification_Email( __FUNCTION__, $invoice ); |
|
243 | + $email = new GetPaid_Notification_Email(__FUNCTION__, $invoice); |
|
244 | 244 | $recipient = wpinv_get_admin_email(); |
245 | 245 | |
246 | - return $this->send_email( $invoice, $email, __FUNCTION__, $recipient ); |
|
246 | + return $this->send_email($invoice, $email, __FUNCTION__, $recipient); |
|
247 | 247 | |
248 | 248 | } |
249 | 249 | |
@@ -252,12 +252,12 @@ discard block |
||
252 | 252 | * |
253 | 253 | * @param WPInv_Invoice $invoice |
254 | 254 | */ |
255 | - public function failed_invoice( $invoice ) { |
|
255 | + public function failed_invoice($invoice) { |
|
256 | 256 | |
257 | - $email = new GetPaid_Notification_Email( __FUNCTION__, $invoice ); |
|
257 | + $email = new GetPaid_Notification_Email(__FUNCTION__, $invoice); |
|
258 | 258 | $recipient = wpinv_get_admin_email(); |
259 | 259 | |
260 | - return $this->send_email( $invoice, $email, __FUNCTION__, $recipient ); |
|
260 | + return $this->send_email($invoice, $email, __FUNCTION__, $recipient); |
|
261 | 261 | |
262 | 262 | } |
263 | 263 | |
@@ -266,12 +266,12 @@ discard block |
||
266 | 266 | * |
267 | 267 | * @param WPInv_Invoice $invoice |
268 | 268 | */ |
269 | - public function onhold_invoice( $invoice ) { |
|
269 | + public function onhold_invoice($invoice) { |
|
270 | 270 | |
271 | - $email = new GetPaid_Notification_Email( __FUNCTION__, $invoice ); |
|
271 | + $email = new GetPaid_Notification_Email(__FUNCTION__, $invoice); |
|
272 | 272 | $recipient = $invoice->get_email(); |
273 | 273 | |
274 | - return $this->send_email( $invoice, $email, __FUNCTION__, $recipient ); |
|
274 | + return $this->send_email($invoice, $email, __FUNCTION__, $recipient); |
|
275 | 275 | |
276 | 276 | } |
277 | 277 | |
@@ -280,12 +280,12 @@ discard block |
||
280 | 280 | * |
281 | 281 | * @param WPInv_Invoice $invoice |
282 | 282 | */ |
283 | - public function processing_invoice( $invoice ) { |
|
283 | + public function processing_invoice($invoice) { |
|
284 | 284 | |
285 | - $email = new GetPaid_Notification_Email( __FUNCTION__, $invoice ); |
|
285 | + $email = new GetPaid_Notification_Email(__FUNCTION__, $invoice); |
|
286 | 286 | $recipient = $invoice->get_email(); |
287 | 287 | |
288 | - return $this->send_email( $invoice, $email, __FUNCTION__, $recipient ); |
|
288 | + return $this->send_email($invoice, $email, __FUNCTION__, $recipient); |
|
289 | 289 | |
290 | 290 | } |
291 | 291 | |
@@ -294,17 +294,17 @@ discard block |
||
294 | 294 | * |
295 | 295 | * @param WPInv_Invoice $invoice |
296 | 296 | */ |
297 | - public function completed_invoice( $invoice ) { |
|
297 | + public function completed_invoice($invoice) { |
|
298 | 298 | |
299 | 299 | // (Maybe) abort if it is a renewal invoice. |
300 | - if ( $invoice->is_renewal() && ! wpinv_get_option( 'email_completed_invoice_renewal_active', false ) ) { |
|
300 | + if ($invoice->is_renewal() && !wpinv_get_option('email_completed_invoice_renewal_active', false)) { |
|
301 | 301 | return; |
302 | 302 | } |
303 | 303 | |
304 | - $email = new GetPaid_Notification_Email( __FUNCTION__, $invoice ); |
|
304 | + $email = new GetPaid_Notification_Email(__FUNCTION__, $invoice); |
|
305 | 305 | $recipient = $invoice->get_email(); |
306 | 306 | |
307 | - return $this->send_email( $invoice, $email, __FUNCTION__, $recipient ); |
|
307 | + return $this->send_email($invoice, $email, __FUNCTION__, $recipient); |
|
308 | 308 | |
309 | 309 | } |
310 | 310 | |
@@ -313,12 +313,12 @@ discard block |
||
313 | 313 | * |
314 | 314 | * @param WPInv_Invoice $invoice |
315 | 315 | */ |
316 | - public function refunded_invoice( $invoice ) { |
|
316 | + public function refunded_invoice($invoice) { |
|
317 | 317 | |
318 | - $email = new GetPaid_Notification_Email( __FUNCTION__, $invoice ); |
|
318 | + $email = new GetPaid_Notification_Email(__FUNCTION__, $invoice); |
|
319 | 319 | $recipient = $invoice->get_email(); |
320 | 320 | |
321 | - return $this->send_email( $invoice, $email, __FUNCTION__, $recipient ); |
|
321 | + return $this->send_email($invoice, $email, __FUNCTION__, $recipient); |
|
322 | 322 | |
323 | 323 | } |
324 | 324 | |
@@ -328,21 +328,21 @@ discard block |
||
328 | 328 | * @param WPInv_Invoice $invoice |
329 | 329 | * @param bool $force |
330 | 330 | */ |
331 | - public function user_invoice( $invoice, $force = false ) { |
|
331 | + public function user_invoice($invoice, $force = false) { |
|
332 | 332 | |
333 | - if ( ! empty( $GLOBALS['wpinv_skip_invoice_notification'] ) ) { |
|
333 | + if (!empty($GLOBALS['wpinv_skip_invoice_notification'])) { |
|
334 | 334 | return; |
335 | 335 | } |
336 | 336 | |
337 | 337 | // Only send this email for invoices created via the admin page. |
338 | - if ( ! $invoice->is_type( 'invoice' ) || ( empty( $force ) && $this->is_payment_form_invoice( $invoice->get_id() ) ) ) { |
|
338 | + if (!$invoice->is_type('invoice') || (empty($force) && $this->is_payment_form_invoice($invoice->get_id()))) { |
|
339 | 339 | return; |
340 | 340 | } |
341 | 341 | |
342 | - $email = new GetPaid_Notification_Email( __FUNCTION__, $invoice ); |
|
342 | + $email = new GetPaid_Notification_Email(__FUNCTION__, $invoice); |
|
343 | 343 | $recipient = $invoice->get_email(); |
344 | 344 | |
345 | - return $this->send_email( $invoice, $email, __FUNCTION__, $recipient ); |
|
345 | + return $this->send_email($invoice, $email, __FUNCTION__, $recipient); |
|
346 | 346 | |
347 | 347 | } |
348 | 348 | |
@@ -352,8 +352,8 @@ discard block |
||
352 | 352 | * @param int $invoice |
353 | 353 | * @return bool |
354 | 354 | */ |
355 | - public function is_payment_form_invoice( $invoice ) { |
|
356 | - return empty( $_GET['getpaid-admin-action'] ) && ( 'payment_form' == get_post_meta( $invoice, 'wpinv_created_via', true ) || 'geodirectory' == get_post_meta( $invoice, 'wpinv_created_via', true ) ); |
|
355 | + public function is_payment_form_invoice($invoice) { |
|
356 | + return empty($_GET['getpaid-admin-action']) && ('payment_form' == get_post_meta($invoice, 'wpinv_created_via', true) || 'geodirectory' == get_post_meta($invoice, 'wpinv_created_via', true)); |
|
357 | 357 | } |
358 | 358 | |
359 | 359 | /** |
@@ -362,12 +362,12 @@ discard block |
||
362 | 362 | * @param WPInv_Invoice $invoice |
363 | 363 | * @param string $note |
364 | 364 | */ |
365 | - public function user_note( $invoice, $note ) { |
|
365 | + public function user_note($invoice, $note) { |
|
366 | 366 | |
367 | - $email = new GetPaid_Notification_Email( __FUNCTION__, $invoice ); |
|
367 | + $email = new GetPaid_Notification_Email(__FUNCTION__, $invoice); |
|
368 | 368 | $recipient = $invoice->get_email(); |
369 | 369 | |
370 | - return $this->send_email( $invoice, $email, __FUNCTION__, $recipient, array( 'customer_note' => $note ) ); |
|
370 | + return $this->send_email($invoice, $email, __FUNCTION__, $recipient, array('customer_note' => $note)); |
|
371 | 371 | |
372 | 372 | } |
373 | 373 | |
@@ -376,9 +376,9 @@ discard block |
||
376 | 376 | * |
377 | 377 | * @param WPInv_Invoice $invoice |
378 | 378 | */ |
379 | - public function force_send_overdue_notice( $invoice ) { |
|
380 | - $email = new GetPaid_Notification_Email( 'overdue', $invoice ); |
|
381 | - return $this->send_email( $invoice, $email, 'overdue', $invoice->get_email() ); |
|
379 | + public function force_send_overdue_notice($invoice) { |
|
380 | + $email = new GetPaid_Notification_Email('overdue', $invoice); |
|
381 | + return $this->send_email($invoice, $email, 'overdue', $invoice->get_email()); |
|
382 | 382 | } |
383 | 383 | |
384 | 384 | /** |
@@ -389,37 +389,37 @@ discard block |
||
389 | 389 | public function overdue() { |
390 | 390 | global $wpdb; |
391 | 391 | |
392 | - $email = new GetPaid_Notification_Email( __FUNCTION__ ); |
|
392 | + $email = new GetPaid_Notification_Email(__FUNCTION__); |
|
393 | 393 | |
394 | 394 | // Fetch reminder days. |
395 | - $reminder_days = array_unique( wp_parse_id_list( $email->get_option( 'days' ) ) ); |
|
395 | + $reminder_days = array_unique(wp_parse_id_list($email->get_option('days'))); |
|
396 | 396 | |
397 | 397 | // Abort if non is set. |
398 | - if ( empty( $reminder_days ) ) { |
|
398 | + if (empty($reminder_days)) { |
|
399 | 399 | return; |
400 | 400 | } |
401 | 401 | |
402 | 402 | // Retrieve date query. |
403 | - $date_query = $this->get_date_query( $reminder_days ); |
|
403 | + $date_query = $this->get_date_query($reminder_days); |
|
404 | 404 | |
405 | 405 | // Invoices table. |
406 | 406 | $table = $wpdb->prefix . 'getpaid_invoices'; |
407 | 407 | |
408 | 408 | // Fetch invoices. |
409 | - $invoices = $wpdb->get_col( |
|
409 | + $invoices = $wpdb->get_col( |
|
410 | 410 | "SELECT posts.ID FROM $wpdb->posts as posts |
411 | 411 | LEFT JOIN $table as invoices ON invoices.post_id = posts.ID |
412 | 412 | WHERE posts.post_type = 'wpi_invoice' AND posts.post_status = 'wpi-pending' $date_query"); |
413 | 413 | |
414 | - foreach ( $invoices as $invoice ) { |
|
414 | + foreach ($invoices as $invoice) { |
|
415 | 415 | |
416 | 416 | // Only send this email for invoices created via the admin page. |
417 | - if ( ! $this->is_payment_form_invoice( $invoice ) ) { |
|
418 | - $invoice = new WPInv_Invoice( $invoice ); |
|
417 | + if (!$this->is_payment_form_invoice($invoice)) { |
|
418 | + $invoice = new WPInv_Invoice($invoice); |
|
419 | 419 | $email->object = $invoice; |
420 | 420 | |
421 | - if ( $invoice->needs_payment() ) { |
|
422 | - $this->send_email( $invoice, $email, __FUNCTION__, $invoice->get_email() ); |
|
421 | + if ($invoice->needs_payment()) { |
|
422 | + $this->send_email($invoice, $email, __FUNCTION__, $invoice->get_email()); |
|
423 | 423 | } |
424 | 424 | |
425 | 425 | } |
@@ -434,14 +434,14 @@ discard block |
||
434 | 434 | * @param array $reminder_days |
435 | 435 | * @return string |
436 | 436 | */ |
437 | - public function get_date_query( $reminder_days ) { |
|
437 | + public function get_date_query($reminder_days) { |
|
438 | 438 | |
439 | 439 | $date_query = array( |
440 | 440 | 'relation' => 'OR' |
441 | 441 | ); |
442 | 442 | |
443 | - foreach ( $reminder_days as $days ) { |
|
444 | - $date = date_parse( date( 'Y-m-d', strtotime( "-$days days", current_time( 'timestamp' ) ) ) ); |
|
443 | + foreach ($reminder_days as $days) { |
|
444 | + $date = date_parse(date('Y-m-d', strtotime("-$days days", current_time('timestamp')))); |
|
445 | 445 | |
446 | 446 | $date_query[] = array( |
447 | 447 | 'year' => $date['year'], |
@@ -451,7 +451,7 @@ discard block |
||
451 | 451 | |
452 | 452 | } |
453 | 453 | |
454 | - $date_query = new WP_Date_Query( $date_query, 'invoices.due_date' ); |
|
454 | + $date_query = new WP_Date_Query($date_query, 'invoices.due_date'); |
|
455 | 455 | |
456 | 456 | return $date_query->get_sql(); |
457 | 457 |