@@ -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 | * Paypal Payment Gateway class. |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | * |
25 | 25 | * @var array |
26 | 26 | */ |
27 | - protected $supports = array( 'subscription', 'sandbox', 'single_subscription_group' ); |
|
27 | + protected $supports = array('subscription', 'sandbox', 'single_subscription_group'); |
|
28 | 28 | |
29 | 29 | /** |
30 | 30 | * Payment method order. |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | * |
60 | 60 | * @var array |
61 | 61 | */ |
62 | - public $currencies = array( 'AUD', 'BRL', 'CAD', 'MXN', 'NZD', 'HKD', 'SGD', 'USD', 'EUR', 'JPY', 'TRY', 'NOK', 'CZK', 'DKK', 'HUF', 'ILS', 'MYR', 'PHP', 'PLN', 'SEK', 'CHF', 'TWD', 'THB', 'GBP', 'RMB', 'RUB', 'INR' ); |
|
62 | + public $currencies = array('AUD', 'BRL', 'CAD', 'MXN', 'NZD', 'HKD', 'SGD', 'USD', 'EUR', 'JPY', 'TRY', 'NOK', 'CZK', 'DKK', 'HUF', 'ILS', 'MYR', 'PHP', 'PLN', 'SEK', 'CHF', 'TWD', 'THB', 'GBP', 'RMB', 'RUB', 'INR'); |
|
63 | 63 | |
64 | 64 | /** |
65 | 65 | * URL to view a transaction. |
@@ -80,16 +80,16 @@ discard block |
||
80 | 80 | */ |
81 | 81 | public function __construct() { |
82 | 82 | |
83 | - $this->title = __( 'PayPal Standard', 'invoicing' ); |
|
84 | - $this->method_title = __( 'PayPal Standard', 'invoicing' ); |
|
85 | - $this->checkout_button_text = __( 'Proceed to PayPal', 'invoicing' ); |
|
86 | - $this->notify_url = wpinv_get_ipn_url( $this->id ); |
|
83 | + $this->title = __('PayPal Standard', 'invoicing'); |
|
84 | + $this->method_title = __('PayPal Standard', 'invoicing'); |
|
85 | + $this->checkout_button_text = __('Proceed to PayPal', 'invoicing'); |
|
86 | + $this->notify_url = wpinv_get_ipn_url($this->id); |
|
87 | 87 | |
88 | - add_filter( 'getpaid_paypal_args', array( $this, 'process_subscription' ), 10, 2 ); |
|
89 | - add_filter( 'getpaid_paypal_sandbox_notice', array( $this, 'sandbox_notice' ) ); |
|
90 | - add_filter( 'getpaid_get_paypal_connect_url', array( $this, 'maybe_get_connect_url' ), 10, 2 ); |
|
91 | - add_action( 'getpaid_authenticated_admin_action_connect_paypal', array( $this, 'connect_paypal' ) ); |
|
92 | - add_action( 'wpinv_paypal_connect', array( $this, 'display_connect_buttons' ) ); |
|
88 | + add_filter('getpaid_paypal_args', array($this, 'process_subscription'), 10, 2); |
|
89 | + add_filter('getpaid_paypal_sandbox_notice', array($this, 'sandbox_notice')); |
|
90 | + add_filter('getpaid_get_paypal_connect_url', array($this, 'maybe_get_connect_url'), 10, 2); |
|
91 | + add_action('getpaid_authenticated_admin_action_connect_paypal', array($this, 'connect_paypal')); |
|
92 | + add_action('wpinv_paypal_connect', array($this, 'display_connect_buttons')); |
|
93 | 93 | parent::__construct(); |
94 | 94 | } |
95 | 95 | |
@@ -102,16 +102,16 @@ discard block |
||
102 | 102 | * @param GetPaid_Payment_Form_Submission $submission Checkout submission. |
103 | 103 | * @return array |
104 | 104 | */ |
105 | - public function process_payment( $invoice, $submission_data, $submission ) { |
|
105 | + public function process_payment($invoice, $submission_data, $submission) { |
|
106 | 106 | |
107 | 107 | // Get redirect url. |
108 | - $paypal_redirect = $this->get_request_url( $invoice ); |
|
108 | + $paypal_redirect = $this->get_request_url($invoice); |
|
109 | 109 | |
110 | 110 | // Add a note about the request url. |
111 | 111 | $invoice->add_note( |
112 | 112 | sprintf( |
113 | - __( 'Redirecting to PayPal: %s', 'invoicing' ), |
|
114 | - esc_url( $paypal_redirect ) |
|
113 | + __('Redirecting to PayPal: %s', 'invoicing'), |
|
114 | + esc_url($paypal_redirect) |
|
115 | 115 | ), |
116 | 116 | false, |
117 | 117 | false, |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | ); |
120 | 120 | |
121 | 121 | // Redirect to PayPal |
122 | - wp_redirect( $paypal_redirect ); |
|
122 | + wp_redirect($paypal_redirect); |
|
123 | 123 | exit; |
124 | 124 | |
125 | 125 | } |
@@ -130,21 +130,21 @@ discard block |
||
130 | 130 | * @param WPInv_Invoice $invoice Invoice object. |
131 | 131 | * @return string |
132 | 132 | */ |
133 | - public function get_request_url( $invoice ) { |
|
133 | + public function get_request_url($invoice) { |
|
134 | 134 | |
135 | 135 | // Endpoint for this request |
136 | - $this->endpoint = $this->is_sandbox( $invoice ) ? 'https://www.sandbox.paypal.com/cgi-bin/webscr?test_ipn=1&' : 'https://www.paypal.com/cgi-bin/webscr?'; |
|
136 | + $this->endpoint = $this->is_sandbox($invoice) ? 'https://www.sandbox.paypal.com/cgi-bin/webscr?test_ipn=1&' : 'https://www.paypal.com/cgi-bin/webscr?'; |
|
137 | 137 | |
138 | 138 | // Retrieve paypal args. |
139 | - $paypal_args = map_deep( $this->get_paypal_args( $invoice ), 'urlencode' ); |
|
139 | + $paypal_args = map_deep($this->get_paypal_args($invoice), 'urlencode'); |
|
140 | 140 | |
141 | - if ( $invoice->is_recurring() ) { |
|
141 | + if ($invoice->is_recurring()) { |
|
142 | 142 | $paypal_args['bn'] = 'GetPaid_Subscribe_WPS_US'; |
143 | 143 | } else { |
144 | 144 | $paypal_args['bn'] = 'GetPaid_ShoppingCart_WPS_US'; |
145 | 145 | } |
146 | 146 | |
147 | - return add_query_arg( $paypal_args, $this->endpoint ); |
|
147 | + return add_query_arg($paypal_args, $this->endpoint); |
|
148 | 148 | |
149 | 149 | } |
150 | 150 | |
@@ -154,25 +154,25 @@ discard block |
||
154 | 154 | * @param WPInv_Invoice $invoice Invoice object. |
155 | 155 | * @return array |
156 | 156 | */ |
157 | - protected function get_paypal_args( $invoice ) { |
|
157 | + protected function get_paypal_args($invoice) { |
|
158 | 158 | |
159 | 159 | // Whether or not to send the line items as one item. |
160 | - $force_one_line_item = apply_filters( 'getpaid_paypal_force_one_line_item', true, $invoice ); |
|
160 | + $force_one_line_item = apply_filters('getpaid_paypal_force_one_line_item', true, $invoice); |
|
161 | 161 | |
162 | - if ( $invoice->is_recurring() || ( wpinv_use_taxes() && wpinv_prices_include_tax() ) ) { |
|
162 | + if ($invoice->is_recurring() || (wpinv_use_taxes() && wpinv_prices_include_tax())) { |
|
163 | 163 | $force_one_line_item = true; |
164 | 164 | } |
165 | 165 | |
166 | 166 | $paypal_args = apply_filters( |
167 | 167 | 'getpaid_paypal_args', |
168 | 168 | array_merge( |
169 | - $this->get_transaction_args( $invoice ), |
|
170 | - $this->get_line_item_args( $invoice, $force_one_line_item ) |
|
169 | + $this->get_transaction_args($invoice), |
|
170 | + $this->get_line_item_args($invoice, $force_one_line_item) |
|
171 | 171 | ), |
172 | 172 | $invoice |
173 | 173 | ); |
174 | 174 | |
175 | - return $this->fix_request_length( $invoice, $paypal_args ); |
|
175 | + return $this->fix_request_length($invoice, $paypal_args); |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | /** |
@@ -181,9 +181,9 @@ discard block |
||
181 | 181 | * @param WPInv_Invoice $invoice Invoice object. |
182 | 182 | * @return array |
183 | 183 | */ |
184 | - protected function get_transaction_args( $invoice ) { |
|
184 | + protected function get_transaction_args($invoice) { |
|
185 | 185 | |
186 | - $email = $this->is_sandbox( $invoice ) ? wpinv_get_option( 'paypal_sandbox_email', wpinv_get_option( 'paypal_email', '' ) ) : wpinv_get_option( 'paypal_email', '' ); |
|
186 | + $email = $this->is_sandbox($invoice) ? wpinv_get_option('paypal_sandbox_email', wpinv_get_option('paypal_email', '')) : wpinv_get_option('paypal_email', ''); |
|
187 | 187 | return array( |
188 | 188 | 'cmd' => '_cart', |
189 | 189 | 'business' => $email, |
@@ -194,16 +194,16 @@ discard block |
||
194 | 194 | 'rm' => is_ssl() ? 2 : 1, |
195 | 195 | 'upload' => 1, |
196 | 196 | 'currency_code' => $invoice->get_currency(), // https://developer.paypal.com/docs/nvp-soap-api/currency-codes/#paypal |
197 | - 'return' => esc_url_raw( $this->get_return_url( $invoice ) ), |
|
198 | - 'cancel_return' => esc_url_raw( $invoice->get_checkout_payment_url() ), |
|
199 | - 'notify_url' => getpaid_limit_length( $this->notify_url, 255 ), |
|
200 | - 'invoice' => getpaid_limit_length( $invoice->get_number(), 127 ), |
|
197 | + 'return' => esc_url_raw($this->get_return_url($invoice)), |
|
198 | + 'cancel_return' => esc_url_raw($invoice->get_checkout_payment_url()), |
|
199 | + 'notify_url' => getpaid_limit_length($this->notify_url, 255), |
|
200 | + 'invoice' => getpaid_limit_length($invoice->get_number(), 127), |
|
201 | 201 | 'custom' => $invoice->get_id(), |
202 | - 'first_name' => getpaid_limit_length( $invoice->get_first_name(), 32 ), |
|
203 | - 'last_name' => getpaid_limit_length( $invoice->get_last_name(), 64 ), |
|
204 | - 'country' => getpaid_limit_length( $invoice->get_country(), 2 ), |
|
205 | - 'email' => getpaid_limit_length( $invoice->get_email(), 127 ), |
|
206 | - 'cbt' => get_bloginfo( 'name' ), |
|
202 | + 'first_name' => getpaid_limit_length($invoice->get_first_name(), 32), |
|
203 | + 'last_name' => getpaid_limit_length($invoice->get_last_name(), 64), |
|
204 | + 'country' => getpaid_limit_length($invoice->get_country(), 2), |
|
205 | + 'email' => getpaid_limit_length($invoice->get_email(), 127), |
|
206 | + 'cbt' => get_bloginfo('name'), |
|
207 | 207 | ); |
208 | 208 | |
209 | 209 | } |
@@ -215,30 +215,30 @@ discard block |
||
215 | 215 | * @param bool $force_one_line_item Create only one item for this invoice. |
216 | 216 | * @return array |
217 | 217 | */ |
218 | - protected function get_line_item_args( $invoice, $force_one_line_item = false ) { |
|
218 | + protected function get_line_item_args($invoice, $force_one_line_item = false) { |
|
219 | 219 | |
220 | 220 | // Maybe send invoice as a single item. |
221 | - if ( $force_one_line_item ) { |
|
222 | - return $this->get_line_item_args_single_item( $invoice ); |
|
221 | + if ($force_one_line_item) { |
|
222 | + return $this->get_line_item_args_single_item($invoice); |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | // Send each line item individually. |
226 | 226 | $line_item_args = array(); |
227 | 227 | |
228 | 228 | // Prepare line items. |
229 | - $this->prepare_line_items( $invoice ); |
|
229 | + $this->prepare_line_items($invoice); |
|
230 | 230 | |
231 | 231 | // Add taxes to the cart |
232 | - if ( wpinv_use_taxes() && $invoice->is_taxable() ) { |
|
233 | - $line_item_args['tax_cart'] = wpinv_sanitize_amount( (float) $invoice->get_total_tax(), 2 ); |
|
232 | + if (wpinv_use_taxes() && $invoice->is_taxable()) { |
|
233 | + $line_item_args['tax_cart'] = wpinv_sanitize_amount((float) $invoice->get_total_tax(), 2); |
|
234 | 234 | } |
235 | 235 | |
236 | 236 | // Add discount. |
237 | - if ( $invoice->get_total_discount() > 0 ) { |
|
238 | - $line_item_args['discount_amount_cart'] = wpinv_sanitize_amount( (float) $invoice->get_total_discount(), 2 ); |
|
237 | + if ($invoice->get_total_discount() > 0) { |
|
238 | + $line_item_args['discount_amount_cart'] = wpinv_sanitize_amount((float) $invoice->get_total_discount(), 2); |
|
239 | 239 | } |
240 | 240 | |
241 | - return array_merge( $line_item_args, $this->get_line_items() ); |
|
241 | + return array_merge($line_item_args, $this->get_line_items()); |
|
242 | 242 | |
243 | 243 | } |
244 | 244 | |
@@ -248,11 +248,11 @@ discard block |
||
248 | 248 | * @param WPInv_Invoice $invoice Invoice object. |
249 | 249 | * @return array |
250 | 250 | */ |
251 | - protected function get_line_item_args_single_item( $invoice ) { |
|
251 | + protected function get_line_item_args_single_item($invoice) { |
|
252 | 252 | $this->delete_line_items(); |
253 | 253 | |
254 | - $item_name = sprintf( __( 'Invoice #%s', 'invoicing' ), $invoice->get_number() ); |
|
255 | - $this->add_line_item( $item_name, 1, wpinv_round_amount( (float) $invoice->get_total(), 2, true ), $invoice->get_id() ); |
|
254 | + $item_name = sprintf(__('Invoice #%s', 'invoicing'), $invoice->get_number()); |
|
255 | + $this->add_line_item($item_name, 1, wpinv_round_amount((float) $invoice->get_total(), 2, true), $invoice->get_id()); |
|
256 | 256 | |
257 | 257 | return $this->get_line_items(); |
258 | 258 | } |
@@ -276,19 +276,19 @@ discard block |
||
276 | 276 | * |
277 | 277 | * @param WPInv_Invoice $invoice Invoice object. |
278 | 278 | */ |
279 | - protected function prepare_line_items( $invoice ) { |
|
279 | + protected function prepare_line_items($invoice) { |
|
280 | 280 | $this->delete_line_items(); |
281 | 281 | |
282 | 282 | // Items. |
283 | - foreach ( $invoice->get_items() as $item ) { |
|
283 | + foreach ($invoice->get_items() as $item) { |
|
284 | 284 | $amount = $item->get_price(); |
285 | 285 | $quantity = $invoice->get_template() == 'amount' ? 1 : $item->get_quantity(); |
286 | - $this->add_line_item( $item->get_raw_name(), $quantity, $amount, $item->get_id() ); |
|
286 | + $this->add_line_item($item->get_raw_name(), $quantity, $amount, $item->get_id()); |
|
287 | 287 | } |
288 | 288 | |
289 | 289 | // Fees. |
290 | - foreach ( $invoice->get_fees() as $fee => $data ) { |
|
291 | - $this->add_line_item( $fee, 1, wpinv_sanitize_amount( $data['initial_fee'] ) ); |
|
290 | + foreach ($invoice->get_fees() as $fee => $data) { |
|
291 | + $this->add_line_item($fee, 1, wpinv_sanitize_amount($data['initial_fee'])); |
|
292 | 292 | } |
293 | 293 | |
294 | 294 | } |
@@ -301,15 +301,15 @@ discard block |
||
301 | 301 | * @param float $amount Amount. |
302 | 302 | * @param string $item_number Item number. |
303 | 303 | */ |
304 | - protected function add_line_item( $item_name, $quantity = 1, $amount = 0.0, $item_number = '' ) { |
|
305 | - $index = ( count( $this->line_items ) / 4 ) + 1; |
|
304 | + protected function add_line_item($item_name, $quantity = 1, $amount = 0.0, $item_number = '') { |
|
305 | + $index = (count($this->line_items) / 4) + 1; |
|
306 | 306 | |
307 | 307 | $item = apply_filters( |
308 | 308 | 'getpaid_paypal_line_item', |
309 | 309 | array( |
310 | - 'item_name' => html_entity_decode( getpaid_limit_length( $item_name ? wp_strip_all_tags( $item_name ) : __( 'Item', 'invoicing' ), 127 ), ENT_NOQUOTES, 'UTF-8' ), |
|
310 | + 'item_name' => html_entity_decode(getpaid_limit_length($item_name ? wp_strip_all_tags($item_name) : __('Item', 'invoicing'), 127), ENT_NOQUOTES, 'UTF-8'), |
|
311 | 311 | 'quantity' => (float) $quantity, |
312 | - 'amount' => wpinv_sanitize_amount( (float) $amount, 2 ), |
|
312 | + 'amount' => wpinv_sanitize_amount((float) $amount, 2), |
|
313 | 313 | 'item_number' => $item_number, |
314 | 314 | ), |
315 | 315 | $item_name, |
@@ -318,12 +318,12 @@ discard block |
||
318 | 318 | $item_number |
319 | 319 | ); |
320 | 320 | |
321 | - $this->line_items[ 'item_name_' . $index ] = getpaid_limit_length( $item['item_name'], 127 ); |
|
322 | - $this->line_items[ 'quantity_' . $index ] = $item['quantity']; |
|
321 | + $this->line_items['item_name_' . $index] = getpaid_limit_length($item['item_name'], 127); |
|
322 | + $this->line_items['quantity_' . $index] = $item['quantity']; |
|
323 | 323 | |
324 | 324 | // The price or amount of the product, service, or contribution, not including shipping, handling, or tax. |
325 | - $this->line_items[ 'amount_' . $index ] = $item['amount'] * $item['quantity']; |
|
326 | - $this->line_items[ 'item_number_' . $index ] = getpaid_limit_length( $item['item_number'], 127 ); |
|
325 | + $this->line_items['amount_' . $index] = $item['amount'] * $item['quantity']; |
|
326 | + $this->line_items['item_number_' . $index] = getpaid_limit_length($item['item_number'], 127); |
|
327 | 327 | } |
328 | 328 | |
329 | 329 | /** |
@@ -335,19 +335,19 @@ discard block |
||
335 | 335 | * @param array $paypal_args Arguments sent to Paypal in the request. |
336 | 336 | * @return array |
337 | 337 | */ |
338 | - protected function fix_request_length( $invoice, $paypal_args ) { |
|
338 | + protected function fix_request_length($invoice, $paypal_args) { |
|
339 | 339 | $max_paypal_length = 2083; |
340 | - $query_candidate = http_build_query( $paypal_args, '', '&' ); |
|
340 | + $query_candidate = http_build_query($paypal_args, '', '&'); |
|
341 | 341 | |
342 | - if ( strlen( $this->endpoint . $query_candidate ) <= $max_paypal_length ) { |
|
342 | + if (strlen($this->endpoint . $query_candidate) <= $max_paypal_length) { |
|
343 | 343 | return $paypal_args; |
344 | 344 | } |
345 | 345 | |
346 | 346 | return apply_filters( |
347 | 347 | 'getpaid_paypal_args', |
348 | 348 | array_merge( |
349 | - $this->get_transaction_args( $invoice ), |
|
350 | - $this->get_line_item_args( $invoice, true ) |
|
349 | + $this->get_transaction_args($invoice), |
|
350 | + $this->get_line_item_args($invoice, true) |
|
351 | 351 | ), |
352 | 352 | $invoice |
353 | 353 | ); |
@@ -360,10 +360,10 @@ discard block |
||
360 | 360 | * @param array $paypal_args PayPal args. |
361 | 361 | * @param WPInv_Invoice $invoice Invoice object. |
362 | 362 | */ |
363 | - public function process_subscription( $paypal_args, $invoice ) { |
|
363 | + public function process_subscription($paypal_args, $invoice) { |
|
364 | 364 | |
365 | 365 | // Make sure this is a subscription. |
366 | - if ( ! $invoice->is_recurring() || ! $subscription = getpaid_get_invoice_subscription( $invoice ) ) { |
|
366 | + if (!$invoice->is_recurring() || !$subscription = getpaid_get_invoice_subscription($invoice)) { |
|
367 | 367 | return $paypal_args; |
368 | 368 | } |
369 | 369 | |
@@ -371,23 +371,23 @@ discard block |
||
371 | 371 | $paypal_args['cmd'] = '_xclick-subscriptions'; |
372 | 372 | |
373 | 373 | // Subscription name. |
374 | - $paypal_args['item_name'] = sprintf( __( 'Invoice #%s', 'invoicing' ), $invoice->get_number() ); |
|
374 | + $paypal_args['item_name'] = sprintf(__('Invoice #%s', 'invoicing'), $invoice->get_number()); |
|
375 | 375 | |
376 | 376 | // Get subscription args. |
377 | - $period = strtoupper( substr( $subscription->get_period(), 0, 1 ) ); |
|
377 | + $period = strtoupper(substr($subscription->get_period(), 0, 1)); |
|
378 | 378 | $interval = (int) $subscription->get_frequency(); |
379 | 379 | $bill_times = (int) $subscription->get_bill_times(); |
380 | - $initial_amount = (float) wpinv_sanitize_amount( $invoice->get_initial_total(), 2 ); |
|
381 | - $recurring_amount = (float) wpinv_sanitize_amount( $invoice->get_recurring_total(), 2 ); |
|
382 | - $subscription_item = $invoice->get_recurring( true ); |
|
380 | + $initial_amount = (float) wpinv_sanitize_amount($invoice->get_initial_total(), 2); |
|
381 | + $recurring_amount = (float) wpinv_sanitize_amount($invoice->get_recurring_total(), 2); |
|
382 | + $subscription_item = $invoice->get_recurring(true); |
|
383 | 383 | |
384 | 384 | // Convert 365 days to 1 year. |
385 | - if ( 'D' == $period && 365 == $interval ) { |
|
385 | + if ('D' == $period && 365 == $interval) { |
|
386 | 386 | $period = 'Y'; |
387 | 387 | $interval = 1; |
388 | 388 | } |
389 | 389 | |
390 | - if ( $subscription_item->has_free_trial() ) { |
|
390 | + if ($subscription_item->has_free_trial()) { |
|
391 | 391 | |
392 | 392 | $paypal_args['a1'] = 0 == $initial_amount ? 0 : $initial_amount; |
393 | 393 | |
@@ -397,28 +397,28 @@ discard block |
||
397 | 397 | // Trial period. |
398 | 398 | $paypal_args['t1'] = $subscription_item->get_trial_period(); |
399 | 399 | |
400 | - } elseif ( $initial_amount != $recurring_amount ) { |
|
400 | + } elseif ($initial_amount != $recurring_amount) { |
|
401 | 401 | |
402 | 402 | // No trial period, but initial amount includes a sign-up fee and/or other items, so charge it as a separate period. |
403 | 403 | |
404 | - if ( 1 == $bill_times ) { |
|
404 | + if (1 == $bill_times) { |
|
405 | 405 | $param_number = 3; |
406 | 406 | } else { |
407 | 407 | $param_number = 1; |
408 | 408 | } |
409 | 409 | |
410 | - $paypal_args[ 'a' . $param_number ] = $initial_amount ? $initial_amount : 0; |
|
410 | + $paypal_args['a' . $param_number] = $initial_amount ? $initial_amount : 0; |
|
411 | 411 | |
412 | 412 | // Sign Up interval |
413 | - $paypal_args[ 'p' . $param_number ] = $interval; |
|
413 | + $paypal_args['p' . $param_number] = $interval; |
|
414 | 414 | |
415 | 415 | // Sign Up unit of duration |
416 | - $paypal_args[ 't' . $param_number ] = $period; |
|
416 | + $paypal_args['t' . $param_number] = $period; |
|
417 | 417 | |
418 | 418 | } |
419 | 419 | |
420 | 420 | // We have a recurring payment |
421 | - if ( ! isset( $param_number ) || 1 == $param_number ) { |
|
421 | + if (!isset($param_number) || 1 == $param_number) { |
|
422 | 422 | |
423 | 423 | // Subscription price |
424 | 424 | $paypal_args['a3'] = $recurring_amount; |
@@ -432,7 +432,7 @@ discard block |
||
432 | 432 | } |
433 | 433 | |
434 | 434 | // Recurring payments |
435 | - if ( 1 == $bill_times || ( $initial_amount != $recurring_amount && ! $subscription_item->has_free_trial() && 2 == $bill_times ) ) { |
|
435 | + if (1 == $bill_times || ($initial_amount != $recurring_amount && !$subscription_item->has_free_trial() && 2 == $bill_times)) { |
|
436 | 436 | |
437 | 437 | // Non-recurring payments |
438 | 438 | $paypal_args['src'] = 0; |
@@ -441,15 +441,15 @@ discard block |
||
441 | 441 | |
442 | 442 | $paypal_args['src'] = 1; |
443 | 443 | |
444 | - if ( $bill_times > 0 ) { |
|
444 | + if ($bill_times > 0) { |
|
445 | 445 | |
446 | 446 | // An initial period is being used to charge a sign-up fee |
447 | - if ( $initial_amount != $recurring_amount && ! $subscription_item->has_free_trial() ) { |
|
447 | + if ($initial_amount != $recurring_amount && !$subscription_item->has_free_trial()) { |
|
448 | 448 | $bill_times--; |
449 | 449 | } |
450 | 450 | |
451 | 451 | // Make sure it's not over the max of 52 |
452 | - $paypal_args['srt'] = ( $bill_times <= 52 ? absint( $bill_times ) : 52 ); |
|
452 | + $paypal_args['srt'] = ($bill_times <= 52 ? absint($bill_times) : 52); |
|
453 | 453 | |
454 | 454 | } |
455 | 455 | } |
@@ -458,10 +458,10 @@ discard block |
||
458 | 458 | $paypal_args['rm'] = 2; |
459 | 459 | |
460 | 460 | // Get rid of redudant items. |
461 | - foreach ( array( 'item_name_1', 'quantity_1', 'amount_1', 'item_number_1' ) as $arg ) { |
|
461 | + foreach (array('item_name_1', 'quantity_1', 'amount_1', 'item_number_1') as $arg) { |
|
462 | 462 | |
463 | - if ( isset( $paypal_args[ $arg ] ) ) { |
|
464 | - unset( $paypal_args[ $arg ] ); |
|
463 | + if (isset($paypal_args[$arg])) { |
|
464 | + unset($paypal_args[$arg]); |
|
465 | 465 | } |
466 | 466 | } |
467 | 467 | |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | * @return void |
480 | 480 | */ |
481 | 481 | public function verify_ipn() { |
482 | - new GetPaid_Paypal_Gateway_IPN_Handler( $this ); |
|
482 | + new GetPaid_Paypal_Gateway_IPN_Handler($this); |
|
483 | 483 | } |
484 | 484 | |
485 | 485 | /** |
@@ -488,7 +488,7 @@ discard block |
||
488 | 488 | public function sandbox_notice() { |
489 | 489 | |
490 | 490 | return sprintf( |
491 | - __( 'SANDBOX ENABLED. You can use sandbox testing accounts only. See the %1$sPayPal Sandbox Testing Guide%2$s for more details.', 'invoicing' ), |
|
491 | + __('SANDBOX ENABLED. You can use sandbox testing accounts only. See the %1$sPayPal Sandbox Testing Guide%2$s for more details.', 'invoicing'), |
|
492 | 492 | '<a href="https://developer.paypal.com/docs/classic/lifecycle/ug_sandbox/">', |
493 | 493 | '</a>' |
494 | 494 | ); |
@@ -500,49 +500,49 @@ discard block |
||
500 | 500 | * |
501 | 501 | * @param array $admin_settings |
502 | 502 | */ |
503 | - public function admin_settings( $admin_settings ) { |
|
503 | + public function admin_settings($admin_settings) { |
|
504 | 504 | |
505 | 505 | $currencies = sprintf( |
506 | - __( 'Supported Currencies: %s', 'invoicing' ), |
|
507 | - implode( ', ', $this->currencies ) |
|
506 | + __('Supported Currencies: %s', 'invoicing'), |
|
507 | + implode(', ', $this->currencies) |
|
508 | 508 | ); |
509 | 509 | |
510 | 510 | $admin_settings['paypal_active']['desc'] .= " ($currencies)"; |
511 | - $admin_settings['paypal_desc']['std'] = __( 'Pay via PayPal: you can pay with your credit card if you don\'t have a PayPal account.', 'invoicing' ); |
|
511 | + $admin_settings['paypal_desc']['std'] = __('Pay via PayPal: you can pay with your credit card if you don\'t have a PayPal account.', 'invoicing'); |
|
512 | 512 | |
513 | 513 | // Access tokens. |
514 | - $live_email = wpinv_get_option( 'paypal_email' ); |
|
515 | - $sandbox_email = wpinv_get_option( 'paypal_sandbox_email' ); |
|
514 | + $live_email = wpinv_get_option('paypal_email'); |
|
515 | + $sandbox_email = wpinv_get_option('paypal_sandbox_email'); |
|
516 | 516 | |
517 | 517 | $admin_settings['paypal_connect'] = array( |
518 | 518 | 'type' => 'hook', |
519 | 519 | 'id' => 'paypal_connect', |
520 | - 'name' => __( 'Connect to PayPal', 'invoicing' ), |
|
520 | + 'name' => __('Connect to PayPal', 'invoicing'), |
|
521 | 521 | ); |
522 | 522 | |
523 | 523 | $admin_settings['paypal_email'] = array( |
524 | 524 | 'type' => 'text', |
525 | 525 | 'class' => 'live-auth-data', |
526 | 526 | 'id' => 'paypal_email', |
527 | - 'name' => __( 'Live Email Address', 'invoicing' ), |
|
528 | - 'desc' => __( 'The email address of your PayPal account.', 'invoicing' ), |
|
527 | + 'name' => __('Live Email Address', 'invoicing'), |
|
528 | + 'desc' => __('The email address of your PayPal account.', 'invoicing'), |
|
529 | 529 | ); |
530 | 530 | |
531 | 531 | $admin_settings['paypal_sandbox_email'] = array( |
532 | 532 | 'type' => 'text', |
533 | 533 | 'class' => 'sandbox-auth-data', |
534 | 534 | 'id' => 'paypal_sandbox_email', |
535 | - 'name' => __( 'Sandbox Email Address', 'invoicing' ), |
|
536 | - 'desc' => __( 'The email address of your sandbox PayPal account.', 'invoicing' ), |
|
537 | - 'std' => wpinv_get_option( 'paypal_email', '' ), |
|
535 | + 'name' => __('Sandbox Email Address', 'invoicing'), |
|
536 | + 'desc' => __('The email address of your sandbox PayPal account.', 'invoicing'), |
|
537 | + 'std' => wpinv_get_option('paypal_email', ''), |
|
538 | 538 | ); |
539 | 539 | |
540 | 540 | $admin_settings['paypal_ipn_url'] = array( |
541 | 541 | 'type' => 'ipn_url', |
542 | 542 | 'id' => 'paypal_ipn_url', |
543 | - 'name' => __( 'IPN Url', 'invoicing' ), |
|
543 | + 'name' => __('IPN Url', 'invoicing'), |
|
544 | 544 | 'std' => $this->notify_url, |
545 | - 'desc' => __( "If you've not enabled IPNs in your paypal account, use the above URL to enable them.", 'invoicing' ) . ' <a href="https://developer.paypal.com/docs/api-basics/notifications/ipn/"><em>' . __( 'Learn more.', 'invoicing' ) . '</em></a>', |
|
545 | + 'desc' => __("If you've not enabled IPNs in your paypal account, use the above URL to enable them.", 'invoicing') . ' <a href="https://developer.paypal.com/docs/api-basics/notifications/ipn/"><em>' . __('Learn more.', 'invoicing') . '</em></a>', |
|
546 | 546 | 'readonly' => true, |
547 | 547 | ); |
548 | 548 | |
@@ -556,8 +556,8 @@ discard block |
||
556 | 556 | * @param array $data |
557 | 557 | * @return string |
558 | 558 | */ |
559 | - public static function maybe_get_connect_url( $url = '', $data = array() ) { |
|
560 | - return self::get_connect_url( false, urldecode( $data['redirect'] ) ); |
|
559 | + public static function maybe_get_connect_url($url = '', $data = array()) { |
|
560 | + return self::get_connect_url(false, urldecode($data['redirect'])); |
|
561 | 561 | } |
562 | 562 | |
563 | 563 | /** |
@@ -568,25 +568,25 @@ discard block |
||
568 | 568 | * @param string $redirect |
569 | 569 | * @return string |
570 | 570 | */ |
571 | - public static function get_connect_url( $is_sandbox, $redirect = '' ) { |
|
571 | + public static function get_connect_url($is_sandbox, $redirect = '') { |
|
572 | 572 | |
573 | 573 | $redirect_url = add_query_arg( |
574 | 574 | array( |
575 | 575 | 'getpaid-admin-action' => 'connect_paypal', |
576 | 576 | 'page' => 'wpinv-settings', |
577 | - 'live_mode' => (int) empty( $is_sandbox ), |
|
577 | + 'live_mode' => (int) empty($is_sandbox), |
|
578 | 578 | 'tab' => 'gateways', |
579 | 579 | 'section' => 'paypal', |
580 | - 'getpaid-nonce' => wp_create_nonce( 'getpaid-nonce' ), |
|
581 | - 'redirect' => urlencode( $redirect ), |
|
580 | + 'getpaid-nonce' => wp_create_nonce('getpaid-nonce'), |
|
581 | + 'redirect' => urlencode($redirect), |
|
582 | 582 | ), |
583 | - admin_url( 'admin.php' ) |
|
583 | + admin_url('admin.php') |
|
584 | 584 | ); |
585 | 585 | |
586 | 586 | return add_query_arg( |
587 | 587 | array( |
588 | - 'live_mode' => (int) empty( $is_sandbox ), |
|
589 | - 'redirect_url' => urlencode( str_replace( '&', '&', $redirect_url ) ), |
|
588 | + 'live_mode' => (int) empty($is_sandbox), |
|
589 | + 'redirect_url' => urlencode(str_replace('&', '&', $redirect_url)), |
|
590 | 590 | ), |
591 | 591 | 'https://ayecode.io/oauth/paypal' |
592 | 592 | ); |
@@ -602,10 +602,10 @@ discard block |
||
602 | 602 | |
603 | 603 | ?> |
604 | 604 | <div class="wpinv-paypal-connect-live"> |
605 | - <a class="button button-primary" href="<?php echo esc_url( self::get_connect_url( false ) ); ?>"><?php esc_html_e( 'Connect to PayPal', 'invoicing' ); ?></a> |
|
605 | + <a class="button button-primary" href="<?php echo esc_url(self::get_connect_url(false)); ?>"><?php esc_html_e('Connect to PayPal', 'invoicing'); ?></a> |
|
606 | 606 | </div> |
607 | 607 | <div class="wpinv-paypal-connect-sandbox"> |
608 | - <a class="button button-primary" href="<?php echo esc_url( self::get_connect_url( true ) ); ?>"><?php esc_html_e( 'Connect to PayPal Sandbox', 'invoicing' ); ?></a> |
|
608 | + <a class="button button-primary" href="<?php echo esc_url(self::get_connect_url(true)); ?>"><?php esc_html_e('Connect to PayPal Sandbox', 'invoicing'); ?></a> |
|
609 | 609 | </div> |
610 | 610 | |
611 | 611 | <script> |
@@ -646,26 +646,26 @@ discard block |
||
646 | 646 | * @param array $data Connection data. |
647 | 647 | * @return void |
648 | 648 | */ |
649 | - public function connect_paypal( $data ) { |
|
649 | + public function connect_paypal($data) { |
|
650 | 650 | |
651 | 651 | $sandbox = $this->is_sandbox(); |
652 | - $data = wp_unslash( $data ); |
|
653 | - $access_token = empty( $data['access_token'] ) ? '' : sanitize_text_field( $data['access_token'] ); |
|
652 | + $data = wp_unslash($data); |
|
653 | + $access_token = empty($data['access_token']) ? '' : sanitize_text_field($data['access_token']); |
|
654 | 654 | |
655 | - if ( isset( $data['live_mode'] ) ) { |
|
656 | - $sandbox = empty( $data['live_mode'] ); |
|
655 | + if (isset($data['live_mode'])) { |
|
656 | + $sandbox = empty($data['live_mode']); |
|
657 | 657 | } |
658 | 658 | |
659 | - wpinv_update_option( 'paypal_sandbox', (int) $sandbox ); |
|
660 | - wpinv_update_option( 'paypal_active', 1 ); |
|
659 | + wpinv_update_option('paypal_sandbox', (int) $sandbox); |
|
660 | + wpinv_update_option('paypal_active', 1); |
|
661 | 661 | |
662 | - if ( ! empty( $data['error_description'] ) ) { |
|
663 | - getpaid_admin()->show_error( wp_kses_post( urldecode( $data['error_description'] ) ) ); |
|
662 | + if (!empty($data['error_description'])) { |
|
663 | + getpaid_admin()->show_error(wp_kses_post(urldecode($data['error_description']))); |
|
664 | 664 | } else { |
665 | 665 | |
666 | 666 | // Retrieve the user info. |
667 | 667 | $user_info = wp_remote_get( |
668 | - ! $sandbox ? 'https://api-m.paypal.com/v1/identity/oauth2/userinfo?schema=paypalv1.1' : 'https://api-m.sandbox.paypal.com/v1/identity/oauth2/userinfo?schema=paypalv1.1', |
|
668 | + !$sandbox ? 'https://api-m.paypal.com/v1/identity/oauth2/userinfo?schema=paypalv1.1' : 'https://api-m.sandbox.paypal.com/v1/identity/oauth2/userinfo?schema=paypalv1.1', |
|
669 | 669 | array( |
670 | 670 | |
671 | 671 | 'headers' => array( |
@@ -676,33 +676,33 @@ discard block |
||
676 | 676 | ) |
677 | 677 | ); |
678 | 678 | |
679 | - if ( is_wp_error( $user_info ) ) { |
|
680 | - getpaid_admin()->show_error( wp_kses_post( $user_info->get_error_message() ) ); |
|
679 | + if (is_wp_error($user_info)) { |
|
680 | + getpaid_admin()->show_error(wp_kses_post($user_info->get_error_message())); |
|
681 | 681 | } else { |
682 | 682 | |
683 | 683 | // Create application. |
684 | - $user_info = json_decode( wp_remote_retrieve_body( $user_info ) ); |
|
684 | + $user_info = json_decode(wp_remote_retrieve_body($user_info)); |
|
685 | 685 | |
686 | - if ( $sandbox ) { |
|
687 | - wpinv_update_option( 'paypal_sandbox_email', sanitize_email( $user_info->emails[0]->value ) ); |
|
688 | - wpinv_update_option( 'paypal_sandbox_refresh_token', sanitize_text_field( urldecode( $data['refresh_token'] ) ) ); |
|
689 | - set_transient( 'getpaid_paypal_sandbox_access_token', sanitize_text_field( urldecode( $data['access_token'] ) ), (int) $data['expires_in'] ); |
|
690 | - getpaid_admin()->show_success( __( 'Successfully connected your PayPal sandbox account', 'invoicing' ) ); |
|
686 | + if ($sandbox) { |
|
687 | + wpinv_update_option('paypal_sandbox_email', sanitize_email($user_info->emails[0]->value)); |
|
688 | + wpinv_update_option('paypal_sandbox_refresh_token', sanitize_text_field(urldecode($data['refresh_token']))); |
|
689 | + set_transient('getpaid_paypal_sandbox_access_token', sanitize_text_field(urldecode($data['access_token'])), (int) $data['expires_in']); |
|
690 | + getpaid_admin()->show_success(__('Successfully connected your PayPal sandbox account', 'invoicing')); |
|
691 | 691 | } else { |
692 | - wpinv_update_option( 'paypal_email', sanitize_email( $user_info->emails[0]->value ) ); |
|
693 | - wpinv_update_option( 'paypal_refresh_token', sanitize_text_field( urldecode( $data['refresh_token'] ) ) ); |
|
694 | - set_transient( 'getpaid_paypal_access_token', sanitize_text_field( urldecode( $data['access_token'] ) ), (int) $data['expires_in'] ); |
|
695 | - getpaid_admin()->show_success( __( 'Successfully connected your PayPal account', 'invoicing' ) ); |
|
692 | + wpinv_update_option('paypal_email', sanitize_email($user_info->emails[0]->value)); |
|
693 | + wpinv_update_option('paypal_refresh_token', sanitize_text_field(urldecode($data['refresh_token']))); |
|
694 | + set_transient('getpaid_paypal_access_token', sanitize_text_field(urldecode($data['access_token'])), (int) $data['expires_in']); |
|
695 | + getpaid_admin()->show_success(__('Successfully connected your PayPal account', 'invoicing')); |
|
696 | 696 | } |
697 | 697 | } |
698 | 698 | } |
699 | 699 | |
700 | - $redirect = empty( $data['redirect'] ) ? admin_url( 'admin.php?page=wpinv-settings&tab=gateways§ion=paypal' ) : urldecode( $data['redirect'] ); |
|
700 | + $redirect = empty($data['redirect']) ? admin_url('admin.php?page=wpinv-settings&tab=gateways§ion=paypal') : urldecode($data['redirect']); |
|
701 | 701 | |
702 | - if ( isset( $data['step'] ) ) { |
|
703 | - $redirect = add_query_arg( 'step', $data['step'], $redirect ); |
|
702 | + if (isset($data['step'])) { |
|
703 | + $redirect = add_query_arg('step', $data['step'], $redirect); |
|
704 | 704 | } |
705 | - wp_redirect( $redirect ); |
|
705 | + wp_redirect($redirect); |
|
706 | 706 | exit; |
707 | 707 | } |
708 | 708 |
@@ -7,27 +7,27 @@ discard block |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | // Current page. |
13 | -$current_page = empty( $_GET['page'] ) ? 1 : absint( $_GET['page'] ); |
|
13 | +$current_page = empty($_GET['page']) ? 1 : absint($_GET['page']); |
|
14 | 14 | |
15 | 15 | // Fires before displaying user invoices. |
16 | -do_action( 'wpinv_before_user_invoices', $invoices->invoices, $invoices->total, $invoices->max_num_pages, $post_type ); |
|
16 | +do_action('wpinv_before_user_invoices', $invoices->invoices, $invoices->total, $invoices->max_num_pages, $post_type); |
|
17 | 17 | |
18 | 18 | ?> |
19 | 19 | |
20 | 20 | |
21 | 21 | <div class="table-responsive"> |
22 | - <table class="table table-bordered table-hover getpaid-user-invoices <?php echo esc_attr( $post_type ); ?>"> |
|
22 | + <table class="table table-bordered table-hover getpaid-user-invoices <?php echo esc_attr($post_type); ?>"> |
|
23 | 23 | |
24 | 24 | |
25 | 25 | <thead> |
26 | 26 | <tr> |
27 | 27 | |
28 | - <?php foreach ( wpinv_get_user_invoices_columns( $post_type ) as $column_id => $column_name ) : ?> |
|
29 | - <th class="<?php echo esc_attr( $column_id ); ?> <?php echo ( ! empty( $column_name['class'] ) ? sanitize_html_class( $column_name['class'] ) : ''); ?> border-bottom-0"> |
|
30 | - <span class="nobr"><?php echo esc_html( $column_name['title'] ); ?></span> |
|
28 | + <?php foreach (wpinv_get_user_invoices_columns($post_type) as $column_id => $column_name) : ?> |
|
29 | + <th class="<?php echo esc_attr($column_id); ?> <?php echo (!empty($column_name['class']) ? sanitize_html_class($column_name['class']) : ''); ?> border-bottom-0"> |
|
30 | + <span class="nobr"><?php echo esc_html($column_name['title']); ?></span> |
|
31 | 31 | </th> |
32 | 32 | <?php endforeach; ?> |
33 | 33 | |
@@ -37,43 +37,43 @@ discard block |
||
37 | 37 | |
38 | 38 | |
39 | 39 | <tbody> |
40 | - <?php foreach ( $invoices->invoices as $invoice ) : ?> |
|
40 | + <?php foreach ($invoices->invoices as $invoice) : ?> |
|
41 | 41 | |
42 | - <tr class="wpinv-item wpinv-item-<?php echo esc_attr( $invoice->get_status() ); ?>"> |
|
42 | + <tr class="wpinv-item wpinv-item-<?php echo esc_attr($invoice->get_status()); ?>"> |
|
43 | 43 | <?php |
44 | 44 | |
45 | - foreach ( wpinv_get_user_invoices_columns( $post_type ) as $column_id => $column_name ) : |
|
45 | + foreach (wpinv_get_user_invoices_columns($post_type) as $column_id => $column_name) : |
|
46 | 46 | |
47 | - $column_id = sanitize_html_class( $column_id ); |
|
48 | - $class = empty( $column_name['class'] ) ? '' : sanitize_html_class( $column_name['class'] ); |
|
47 | + $column_id = sanitize_html_class($column_id); |
|
48 | + $class = empty($column_name['class']) ? '' : sanitize_html_class($column_name['class']); |
|
49 | 49 | |
50 | - echo "<td class='" . esc_attr( $column_id . ' ' . $class ) . "'>"; |
|
51 | - switch ( $column_id ) { |
|
50 | + echo "<td class='" . esc_attr($column_id . ' ' . $class) . "'>"; |
|
51 | + switch ($column_id) { |
|
52 | 52 | |
53 | 53 | case 'invoice-number': |
54 | - echo wp_kses_post( wpinv_invoice_link( $invoice ) ); |
|
54 | + echo wp_kses_post(wpinv_invoice_link($invoice)); |
|
55 | 55 | break; |
56 | 56 | |
57 | 57 | case 'created-date': |
58 | - echo esc_html( getpaid_format_date_value( $invoice->get_date_created() ) ); |
|
58 | + echo esc_html(getpaid_format_date_value($invoice->get_date_created())); |
|
59 | 59 | break; |
60 | 60 | |
61 | 61 | case 'payment-date': |
62 | - if ( $invoice->needs_payment() ) { |
|
62 | + if ($invoice->needs_payment()) { |
|
63 | 63 | echo '—'; |
64 | 64 | } else { |
65 | - echo esc_html( getpaid_format_date_value( $invoice->get_date_completed() ) ); |
|
65 | + echo esc_html(getpaid_format_date_value($invoice->get_date_completed())); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | break; |
69 | 69 | |
70 | 70 | case 'invoice-status': |
71 | - echo wp_kses_post( $invoice->get_status_label_html() ); |
|
71 | + echo wp_kses_post($invoice->get_status_label_html()); |
|
72 | 72 | |
73 | 73 | break; |
74 | 74 | |
75 | 75 | case 'invoice-total': |
76 | - wpinv_the_price( $invoice->get_total(), $invoice->get_currency() ); |
|
76 | + wpinv_the_price($invoice->get_total(), $invoice->get_currency()); |
|
77 | 77 | |
78 | 78 | break; |
79 | 79 | |
@@ -82,47 +82,47 @@ discard block |
||
82 | 82 | |
83 | 83 | 'pay' => array( |
84 | 84 | 'url' => $invoice->get_checkout_payment_url(), |
85 | - 'name' => __( 'Pay Now', 'invoicing' ), |
|
85 | + 'name' => __('Pay Now', 'invoicing'), |
|
86 | 86 | 'class' => 'btn-success', |
87 | 87 | ), |
88 | 88 | |
89 | 89 | 'print' => array( |
90 | 90 | 'url' => $invoice->get_view_url(), |
91 | - 'name' => __( 'View', 'invoicing' ), |
|
91 | + 'name' => __('View', 'invoicing'), |
|
92 | 92 | 'class' => 'btn-secondary', |
93 | 93 | 'attrs' => 'target="_blank"', |
94 | 94 | ), |
95 | 95 | ); |
96 | 96 | |
97 | - if ( ! $invoice->needs_payment() ) { |
|
98 | - unset( $actions['pay'] ); |
|
97 | + if (!$invoice->needs_payment()) { |
|
98 | + unset($actions['pay']); |
|
99 | 99 | } |
100 | 100 | |
101 | - if ( $invoice->needs_payment() ) { |
|
101 | + if ($invoice->needs_payment()) { |
|
102 | 102 | $actions['delete'] = array( |
103 | - 'url' => getpaid_get_authenticated_action_url( 'delete_invoice', add_query_arg( 'invoice_id', $invoice->get_id() ) ), |
|
104 | - 'name' => __( 'Delete', 'invoicing' ), |
|
103 | + 'url' => getpaid_get_authenticated_action_url('delete_invoice', add_query_arg('invoice_id', $invoice->get_id())), |
|
104 | + 'name' => __('Delete', 'invoicing'), |
|
105 | 105 | 'class' => 'btn-danger', |
106 | 106 | ); |
107 | 107 | } |
108 | 108 | |
109 | - $actions = apply_filters( 'wpinv_user_invoices_actions', $actions, $invoice, $post_type ); |
|
109 | + $actions = apply_filters('wpinv_user_invoices_actions', $actions, $invoice, $post_type); |
|
110 | 110 | |
111 | - foreach ( $actions as $key => $action ) { |
|
112 | - $class = ! empty( $action['class'] ) ? sanitize_html_class( $action['class'] ) : ''; |
|
113 | - echo '<a href="' . esc_url( $action['url'] ) . '" class="btn btn-sm btn-block ' . esc_attr( $class . ' ' . sanitize_html_class( $key ) ) . '" ' . ( ! empty( $action['attrs'] ) ? esc_html( $action['attrs'] ) : '' ) . '>' . esc_attr( $action['name'] ) . '</a>'; |
|
111 | + foreach ($actions as $key => $action) { |
|
112 | + $class = !empty($action['class']) ? sanitize_html_class($action['class']) : ''; |
|
113 | + echo '<a href="' . esc_url($action['url']) . '" class="btn btn-sm btn-block ' . esc_attr($class . ' ' . sanitize_html_class($key)) . '" ' . (!empty($action['attrs']) ? esc_html($action['attrs']) : '') . '>' . esc_attr($action['name']) . '</a>'; |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | break; |
117 | 117 | |
118 | 118 | default: |
119 | - do_action( "wpinv_user_invoices_column_$column_id", $invoice ); |
|
119 | + do_action("wpinv_user_invoices_column_$column_id", $invoice); |
|
120 | 120 | break; |
121 | 121 | |
122 | 122 | |
123 | 123 | } |
124 | 124 | |
125 | - do_action( "wpinv_user_invoices_column_after_$column_id", $invoice ); |
|
125 | + do_action("wpinv_user_invoices_column_after_$column_id", $invoice); |
|
126 | 126 | |
127 | 127 | echo '</td>'; |
128 | 128 | |
@@ -136,9 +136,9 @@ discard block |
||
136 | 136 | </table> |
137 | 137 | </div> |
138 | 138 | |
139 | - <?php do_action( 'wpinv_before_user_invoices_pagination' ); ?> |
|
139 | + <?php do_action('wpinv_before_user_invoices_pagination'); ?> |
|
140 | 140 | |
141 | - <?php if ( 1 < $invoices->max_num_pages ) : ?> |
|
141 | + <?php if (1 < $invoices->max_num_pages) : ?> |
|
142 | 142 | <div class="invoicing-Pagination"> |
143 | 143 | <?php |
144 | 144 | $big = 999999; |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | echo wp_kses_post( |
147 | 147 | paginate_links( |
148 | 148 | array( |
149 | - 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), |
|
149 | + 'base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))), |
|
150 | 150 | 'format' => '?paged=%#%', |
151 | 151 | 'total' => $invoices->max_num_pages, |
152 | 152 | ) |
@@ -156,4 +156,4 @@ discard block |
||
156 | 156 | </div> |
157 | 157 | <?php endif; ?> |
158 | 158 | |
159 | -<?php do_action( 'wpinv_after_user_invoices', $invoices->invoices, $invoices->total, $invoices->max_num_pages, $post_type ); ?> |
|
159 | +<?php do_action('wpinv_after_user_invoices', $invoices->invoices, $invoices->total, $invoices->max_num_pages, $post_type); ?> |
@@ -7,45 +7,45 @@ discard block |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | // The payment methods select title. |
13 | -if ( empty( $text ) ) { |
|
14 | - $text = __( 'Select Payment Method', 'invoicing' ); |
|
13 | +if (empty($text)) { |
|
14 | + $text = __('Select Payment Method', 'invoicing'); |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | // An array of active payment methods. |
18 | -$gateways = wpinv_get_enabled_payment_gateways( true ); |
|
18 | +$gateways = wpinv_get_enabled_payment_gateways(true); |
|
19 | 19 | |
20 | 20 | // The current invoice id. |
21 | 21 | $invoice_id = 0; |
22 | 22 | $chosen_gateway = wpinv_get_default_gateway(); |
23 | 23 | |
24 | -if ( ! empty( $form->invoice ) ) { |
|
24 | +if (!empty($form->invoice)) { |
|
25 | 25 | $invoice_id = $form->invoice->get_id(); |
26 | 26 | $chosen_gateway = $form->invoice->get_gateway(); |
27 | 27 | } |
28 | 28 | |
29 | 29 | ?> |
30 | 30 | |
31 | - <?php do_action( 'getpaid_before_payment_form_gateway_select', $form ); ?> |
|
31 | + <?php do_action('getpaid_before_payment_form_gateway_select', $form); ?> |
|
32 | 32 | <div class="mt-4 mb-4 getpaid-gateways"> |
33 | 33 | |
34 | - <?php do_action( 'wpinv_payment_mode_top', $invoice_id, $chosen_gateway, $gateways, $form ); ?> |
|
34 | + <?php do_action('wpinv_payment_mode_top', $invoice_id, $chosen_gateway, $gateways, $form); ?> |
|
35 | 35 | |
36 | 36 | <div class="getpaid-select-gateway-title-div"> |
37 | - <h6><?php echo esc_html( $text ); ?></h6> |
|
37 | + <h6><?php echo esc_html($text); ?></h6> |
|
38 | 38 | </div> |
39 | 39 | |
40 | 40 | <div class="getpaid-available-gateways-div"> |
41 | 41 | |
42 | - <?php foreach ( array_keys( $gateways ) as $gateway ) : ?> |
|
42 | + <?php foreach (array_keys($gateways) as $gateway) : ?> |
|
43 | 43 | |
44 | - <div class="pt-1 pb-1 getpaid-gateway getpaid-gateway-<?php echo esc_attr( $gateway ); ?>" data-checkout-label='<?php echo esc_attr( apply_filters( "getpaid_gateway_{$gateway}_checkout_button_label", '' ) ); ?>'> |
|
44 | + <div class="pt-1 pb-1 getpaid-gateway getpaid-gateway-<?php echo esc_attr($gateway); ?>" data-checkout-label='<?php echo esc_attr(apply_filters("getpaid_gateway_{$gateway}_checkout_button_label", '')); ?>'> |
|
45 | 45 | |
46 | 46 | <label class="d-block w-100 getpaid-gateway-radio"> |
47 | - <input type="radio" value="<?php echo esc_attr( $gateway ); ?>" <?php checked( $gateway, $chosen_gateway ); ?> name="wpi-gateway"> |
|
48 | - <span><?php echo esc_html( wpinv_get_gateway_checkout_label( $gateway ) ); ?></span> |
|
47 | + <input type="radio" value="<?php echo esc_attr($gateway); ?>" <?php checked($gateway, $chosen_gateway); ?> name="wpi-gateway"> |
|
48 | + <span><?php echo esc_html(wpinv_get_gateway_checkout_label($gateway)); ?></span> |
|
49 | 49 | </label> |
50 | 50 | |
51 | 51 | </div> |
@@ -56,22 +56,22 @@ discard block |
||
56 | 56 | |
57 | 57 | <div class="getpaid-gateway-descriptions-div"> |
58 | 58 | |
59 | - <?php foreach ( array_keys( $gateways ) as $gateway ) : ?> |
|
59 | + <?php foreach (array_keys($gateways) as $gateway) : ?> |
|
60 | 60 | |
61 | - <div class="my-2 p-3 bg-light border getpaid-gateway-description getpaid-description-<?php echo esc_attr( $gateway ); ?>" style="display: none;"> |
|
61 | + <div class="my-2 p-3 bg-light border getpaid-gateway-description getpaid-description-<?php echo esc_attr($gateway); ?>" style="display: none;"> |
|
62 | 62 | <?php |
63 | 63 | |
64 | - $description = wpinv_get_gateway_description( $gateway ); |
|
64 | + $description = wpinv_get_gateway_description($gateway); |
|
65 | 65 | |
66 | - if ( wpinv_is_test_mode( $gateway ) ) { |
|
67 | - $sandbox_notice = apply_filters( "getpaid_{$gateway}_sandbox_notice", __( 'SANDBOX ENABLED: No real payments will occur.', 'invoicing' ) ); |
|
66 | + if (wpinv_is_test_mode($gateway)) { |
|
67 | + $sandbox_notice = apply_filters("getpaid_{$gateway}_sandbox_notice", __('SANDBOX ENABLED: No real payments will occur.', 'invoicing')); |
|
68 | 68 | $description = "$description $sandbox_notice"; |
69 | 69 | } |
70 | 70 | |
71 | - echo wp_kses_post( wpautop( $description ) ); |
|
71 | + echo wp_kses_post(wpautop($description)); |
|
72 | 72 | |
73 | - do_action( 'wpinv_' . $gateway . '_checkout_fields', $invoice_id ); |
|
74 | - do_action( 'wpinv_' . $gateway . '_cc_form', $invoice_id, $form ); |
|
73 | + do_action('wpinv_' . $gateway . '_checkout_fields', $invoice_id); |
|
74 | + do_action('wpinv_' . $gateway . '_cc_form', $invoice_id, $form); |
|
75 | 75 | |
76 | 76 | ?> |
77 | 77 | </div> |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | <?php |
85 | 85 | aui()->alert( |
86 | 86 | array( |
87 | - 'content' => __( 'None of the available payment gateways support purchasing recurring items.', 'invoicing' ), |
|
87 | + 'content' => __('None of the available payment gateways support purchasing recurring items.', 'invoicing'), |
|
88 | 88 | 'type' => 'danger', |
89 | 89 | ), |
90 | 90 | true |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | <?php |
97 | 97 | aui()->alert( |
98 | 98 | array( |
99 | - 'content' => __( 'None of the available payment gateways support purchasing multiple subscriptions in a single order.', 'invoicing' ), |
|
99 | + 'content' => __('None of the available payment gateways support purchasing multiple subscriptions in a single order.', 'invoicing'), |
|
100 | 100 | 'type' => 'danger', |
101 | 101 | ), |
102 | 102 | true |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | <?php |
109 | 109 | aui()->alert( |
110 | 110 | array( |
111 | - 'content' => __( 'None of the available payment gateways support purchasing multiple subscriptions with different billing schedules in a single order.', 'invoicing' ), |
|
111 | + 'content' => __('None of the available payment gateways support purchasing multiple subscriptions with different billing schedules in a single order.', 'invoicing'), |
|
112 | 112 | 'type' => 'danger', |
113 | 113 | ), |
114 | 114 | true |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | <?php |
121 | 121 | aui()->alert( |
122 | 122 | array( |
123 | - 'content' => __( 'There is no active payment gateway available to process your request.', 'invoicing' ), |
|
123 | + 'content' => __('There is no active payment gateway available to process your request.', 'invoicing'), |
|
124 | 124 | 'type' => 'danger', |
125 | 125 | ), |
126 | 126 | true |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | ?> |
129 | 129 | </div> |
130 | 130 | |
131 | - <?php do_action( 'wpinv_payment_mode_bottom', $invoice_id, $chosen_gateway, $gateways, $form ); ?> |
|
131 | + <?php do_action('wpinv_payment_mode_bottom', $invoice_id, $chosen_gateway, $gateways, $form); ?> |
|
132 | 132 | |
133 | 133 | </div> |
134 | - <?php do_action( 'getpaid_after_payment_form_gateway_select', $form ); ?> |
|
134 | + <?php do_action('getpaid_after_payment_form_gateway_select', $form); ?> |
@@ -8,18 +8,18 @@ discard block |
||
8 | 8 | * @var WPInv_Invoice $invoice |
9 | 9 | */ |
10 | 10 | |
11 | -defined( 'ABSPATH' ) || exit; |
|
11 | +defined('ABSPATH') || exit; |
|
12 | 12 | |
13 | -$column_count = count( $columns ); |
|
13 | +$column_count = count($columns); |
|
14 | 14 | ?> |
15 | 15 | |
16 | -<?php do_action( 'wpinv_before_email_items', $invoice ); ?> |
|
16 | +<?php do_action('wpinv_before_email_items', $invoice); ?> |
|
17 | 17 | |
18 | 18 | |
19 | 19 | <div id="wpinv-email-items"> |
20 | 20 | |
21 | 21 | <h3 class="invoice-items-title"> |
22 | - <?php echo sprintf( esc_html__( '%s Items', 'invoicing' ), esc_html( ucfirst( $invoice->get_invoice_quote_type() ) ) ); ?> |
|
22 | + <?php echo sprintf(esc_html__('%s Items', 'invoicing'), esc_html(ucfirst($invoice->get_invoice_quote_type()))); ?> |
|
23 | 23 | </h3> |
24 | 24 | |
25 | 25 | <table class="table table-bordered table-hover"> |
@@ -28,9 +28,9 @@ discard block |
||
28 | 28 | |
29 | 29 | <tr class="wpinv_cart_header_row"> |
30 | 30 | |
31 | - <?php foreach ( $columns as $key => $label ) : ?> |
|
32 | - <th class="<?php echo 'name' == $key ? 'text-left' : 'text-right'; ?> wpinv_cart_item_<?php echo esc_attr( $key ); ?>"> |
|
33 | - <?php echo esc_html( $label ); ?> |
|
31 | + <?php foreach ($columns as $key => $label) : ?> |
|
32 | + <th class="<?php echo 'name' == $key ? 'text-left' : 'text-right'; ?> wpinv_cart_item_<?php echo esc_attr($key); ?>"> |
|
33 | + <?php echo esc_html($label); ?> |
|
34 | 34 | </th> |
35 | 35 | <?php endforeach; ?> |
36 | 36 | |
@@ -43,13 +43,13 @@ discard block |
||
43 | 43 | <?php |
44 | 44 | |
45 | 45 | // Display the item totals. |
46 | - foreach ( $invoice->get_items() as $item ) { |
|
47 | - wpinv_get_template( 'emails/invoice-item.php', compact( 'invoice', 'item', 'columns' ) ); |
|
46 | + foreach ($invoice->get_items() as $item) { |
|
47 | + wpinv_get_template('emails/invoice-item.php', compact('invoice', 'item', 'columns')); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | // Display the fee totals. |
51 | - foreach ( $invoice->get_fees() as $fee ) { |
|
52 | - wpinv_get_template( 'emails/fee-item.php', compact( 'invoice', 'fee', 'columns' ) ); |
|
51 | + foreach ($invoice->get_fees() as $fee) { |
|
52 | + wpinv_get_template('emails/fee-item.php', compact('invoice', 'fee', 'columns')); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | ?> |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | </tbody> |
58 | 58 | |
59 | 59 | <tfoot> |
60 | - <?php wpinv_get_template( 'emails/invoice-totals.php', compact( 'invoice', 'column_count' ) ); ?> |
|
60 | + <?php wpinv_get_template('emails/invoice-totals.php', compact('invoice', 'column_count')); ?> |
|
61 | 61 | </tfoot> |
62 | 62 | |
63 | 63 | </table> |
@@ -10,64 +10,64 @@ discard block |
||
10 | 10 | * @var array $columns |
11 | 11 | */ |
12 | 12 | |
13 | -defined( 'ABSPATH' ) || exit; |
|
13 | +defined('ABSPATH') || exit; |
|
14 | 14 | |
15 | 15 | ?> |
16 | 16 | |
17 | -<?php do_action( 'getpaid_before_email_line_item', $invoice, $item ); ?> |
|
17 | +<?php do_action('getpaid_before_email_line_item', $invoice, $item); ?> |
|
18 | 18 | |
19 | -<tr class="wpinv_cart_item item-type-<?php echo esc_attr( $item->get_type() ); ?>"> |
|
19 | +<tr class="wpinv_cart_item item-type-<?php echo esc_attr($item->get_type()); ?>"> |
|
20 | 20 | |
21 | - <?php foreach ( array_keys( $columns ) as $column ) : ?> |
|
21 | + <?php foreach (array_keys($columns) as $column) : ?> |
|
22 | 22 | |
23 | - <td class="<?php echo 'name' == $column ? 'text-left' : 'text-right'; ?> wpinv_cart_item_<?php echo esc_attr( $column ); ?>"> |
|
23 | + <td class="<?php echo 'name' == $column ? 'text-left' : 'text-right'; ?> wpinv_cart_item_<?php echo esc_attr($column); ?>"> |
|
24 | 24 | |
25 | 25 | <?php |
26 | 26 | |
27 | 27 | // Fires before printing a line item column. |
28 | - do_action( "getpaid_email_line_item_before_$column", $item, $invoice ); |
|
28 | + do_action("getpaid_email_line_item_before_$column", $item, $invoice); |
|
29 | 29 | |
30 | 30 | // Item name. |
31 | - if ( 'name' == $column ) { |
|
31 | + if ('name' == $column) { |
|
32 | 32 | |
33 | 33 | // Display the name. |
34 | - echo '<div class="wpinv_email_cart_item_title">' . esc_html( $item->get_name() ) . '</div>'; |
|
34 | + echo '<div class="wpinv_email_cart_item_title">' . esc_html($item->get_name()) . '</div>'; |
|
35 | 35 | |
36 | 36 | // And an optional description. |
37 | 37 | $description = $item->get_description(); |
38 | 38 | |
39 | - if ( ! empty( $description ) ) { |
|
40 | - echo "<p class='small'>" . wp_kses_post( $description ) . "</p>"; |
|
39 | + if (!empty($description)) { |
|
40 | + echo "<p class='small'>" . wp_kses_post($description) . "</p>"; |
|
41 | 41 | } |
42 | 42 | } |
43 | 43 | |
44 | 44 | // Item price. |
45 | - if ( 'price' == $column ) { |
|
45 | + if ('price' == $column) { |
|
46 | 46 | |
47 | 47 | // Display the item price (or recurring price if this is a renewal invoice) |
48 | 48 | $price = $invoice->is_renewal() ? $item->get_price() : $item->get_initial_price(); |
49 | - wpinv_the_price( $price, $invoice->get_currency() ); |
|
49 | + wpinv_the_price($price, $invoice->get_currency()); |
|
50 | 50 | |
51 | 51 | } |
52 | 52 | |
53 | 53 | // Item quantity. |
54 | - if ( 'quantity' == $column ) { |
|
54 | + if ('quantity' == $column) { |
|
55 | 55 | echo (float) $item->get_quantity(); |
56 | 56 | } |
57 | 57 | |
58 | 58 | // Tax rate. |
59 | - if ( 'tax_rate' == $column ) { |
|
60 | - echo floatval( round( getpaid_get_invoice_tax_rate( $invoice, $item ), 2 ) ) . '%'; |
|
59 | + if ('tax_rate' == $column) { |
|
60 | + echo floatval(round(getpaid_get_invoice_tax_rate($invoice, $item), 2)) . '%'; |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | // Item sub total. |
64 | - if ( 'subtotal' == $column ) { |
|
64 | + if ('subtotal' == $column) { |
|
65 | 65 | $subtotal = $invoice->is_renewal() ? $item->get_recurring_sub_total() : $item->get_sub_total(); |
66 | - wpinv_the_price( $subtotal, $invoice->get_currency() ); |
|
66 | + wpinv_the_price($subtotal, $invoice->get_currency()); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | // Fires when printing a line item column. |
70 | - do_action( "getpaid_email_line_item_$column", $item, $invoice ); |
|
70 | + do_action("getpaid_email_line_item_$column", $item, $invoice); |
|
71 | 71 | |
72 | 72 | ?> |
73 | 73 | |
@@ -77,4 +77,4 @@ discard block |
||
77 | 77 | |
78 | 78 | </tr> |
79 | 79 | |
80 | -<?php do_action( 'getpaid_after_email_line_item', $invoice, $item ); ?> |
|
80 | +<?php do_action('getpaid_after_email_line_item', $invoice, $item); ?> |
@@ -8,45 +8,45 @@ discard block |
||
8 | 8 | * @var WPInv_Invoice $invoice |
9 | 9 | * @var array $columns |
10 | 10 | */ |
11 | -defined( 'ABSPATH' ) || exit; |
|
11 | +defined('ABSPATH') || exit; |
|
12 | 12 | |
13 | -$meta_data = getpaid_get_invoice_meta( $invoice ); |
|
13 | +$meta_data = getpaid_get_invoice_meta($invoice); |
|
14 | 14 | |
15 | -if ( isset( $meta_data['status'] ) ) { |
|
15 | +if (isset($meta_data['status'])) { |
|
16 | 16 | $meta_data['status']['value'] = $invoice->get_status_nicename(); |
17 | 17 | } |
18 | 18 | |
19 | -do_action( 'wpinv_email_before_invoice_details', $invoice, $sent_to_admin ); |
|
19 | +do_action('wpinv_email_before_invoice_details', $invoice, $sent_to_admin); |
|
20 | 20 | |
21 | 21 | ?> |
22 | 22 | |
23 | 23 | <div id="wpinv-email-details"> |
24 | 24 | |
25 | 25 | <h3 class="invoice-details-title"> |
26 | - <?php echo sprintf( esc_html__( '%s Details', 'invoicing' ), esc_html( ucfirst( $invoice->get_invoice_quote_type() ) ) ); ?> |
|
26 | + <?php echo sprintf(esc_html__('%s Details', 'invoicing'), esc_html(ucfirst($invoice->get_invoice_quote_type()))); ?> |
|
27 | 27 | </h3> |
28 | 28 | |
29 | 29 | <table class="table table-bordered table-sm"> |
30 | 30 | |
31 | - <?php foreach ( $meta_data as $key => $data ) : ?> |
|
31 | + <?php foreach ($meta_data as $key => $data) : ?> |
|
32 | 32 | |
33 | - <?php if ( ! empty( $data['value'] ) ) : ?> |
|
33 | + <?php if (!empty($data['value'])) : ?> |
|
34 | 34 | |
35 | - <?php do_action( "getpaid_before_email_details_$key", $invoice, $data ); ?> |
|
35 | + <?php do_action("getpaid_before_email_details_$key", $invoice, $data); ?> |
|
36 | 36 | |
37 | - <tr class="getpaid-email-details-<?php echo esc_attr( $key ); ?>"> |
|
37 | + <tr class="getpaid-email-details-<?php echo esc_attr($key); ?>"> |
|
38 | 38 | |
39 | 39 | <td class="getpaid-lable-td"> |
40 | - <?php echo esc_html( $data['label'] ); ?> |
|
40 | + <?php echo esc_html($data['label']); ?> |
|
41 | 41 | </td> |
42 | 42 | |
43 | 43 | <td class="getpaid-value-td"> |
44 | - <span class="getpaid-invoice-meta-<?php echo esc_attr( $key ); ?>-value"><?php echo wp_kses_post( $data['value'] ); ?></span> |
|
44 | + <span class="getpaid-invoice-meta-<?php echo esc_attr($key); ?>-value"><?php echo wp_kses_post($data['value']); ?></span> |
|
45 | 45 | </td> |
46 | 46 | |
47 | 47 | </tr> |
48 | 48 | |
49 | - <?php do_action( "getpaid_after_email_details_$key", $invoice, $data ); ?> |
|
49 | + <?php do_action("getpaid_after_email_details_$key", $invoice, $data); ?> |
|
50 | 50 | |
51 | 51 | <?php endif; ?> |
52 | 52 | |
@@ -56,4 +56,4 @@ discard block |
||
56 | 56 | |
57 | 57 | </div> |
58 | 58 | |
59 | -<?php do_action( 'wpinv_email_after_invoice_details', $invoice, $sent_to_admin ); ?> |
|
59 | +<?php do_action('wpinv_email_after_invoice_details', $invoice, $sent_to_admin); ?> |
@@ -10,67 +10,67 @@ discard block |
||
10 | 10 | * @var array $columns |
11 | 11 | */ |
12 | 12 | |
13 | -defined( 'ABSPATH' ) || exit; |
|
13 | +defined('ABSPATH') || exit; |
|
14 | 14 | |
15 | 15 | ?> |
16 | 16 | |
17 | -<?php do_action( 'getpaid_before_email_fee_item', $invoice, $fee ); ?> |
|
17 | +<?php do_action('getpaid_before_email_fee_item', $invoice, $fee); ?> |
|
18 | 18 | |
19 | 19 | <tr class="wpinv_cart_item item-fee"> |
20 | 20 | |
21 | - <?php foreach ( array_keys( $columns ) as $column ) : ?> |
|
21 | + <?php foreach (array_keys($columns) as $column) : ?> |
|
22 | 22 | |
23 | - <td class="<?php echo 'name' == $column ? 'text-left' : 'text-right'; ?> wpinv_cart_item_<?php echo esc_attr( $column ); ?>"> |
|
23 | + <td class="<?php echo 'name' == $column ? 'text-left' : 'text-right'; ?> wpinv_cart_item_<?php echo esc_attr($column); ?>"> |
|
24 | 24 | |
25 | 25 | <?php |
26 | 26 | |
27 | 27 | // Fires before printing a fee item column. |
28 | - do_action( "getpaid_email_fee_item_before_$column", $fee, $invoice ); |
|
28 | + do_action("getpaid_email_fee_item_before_$column", $fee, $invoice); |
|
29 | 29 | |
30 | 30 | // Item name. |
31 | - if ( 'name' == $column ) { |
|
31 | + if ('name' == $column) { |
|
32 | 32 | |
33 | 33 | // Display the name. |
34 | - echo '<div class="wpinv_email_cart_item_title">' . esc_html( $fee['name'] ) . '</div>'; |
|
34 | + echo '<div class="wpinv_email_cart_item_title">' . esc_html($fee['name']) . '</div>'; |
|
35 | 35 | |
36 | 36 | // And an optional description. |
37 | - $description = empty( $fee['description'] ) ? esc_html__( 'Fee', 'invoicing' ) : esc_html( $fee['description'] ); |
|
38 | - echo wp_kses_post( "<p class='small'>$description</p>" ); |
|
37 | + $description = empty($fee['description']) ? esc_html__('Fee', 'invoicing') : esc_html($fee['description']); |
|
38 | + echo wp_kses_post("<p class='small'>$description</p>"); |
|
39 | 39 | |
40 | 40 | } |
41 | 41 | |
42 | 42 | // Item price. |
43 | - if ( 'price' == $column ) { |
|
43 | + if ('price' == $column) { |
|
44 | 44 | |
45 | 45 | // Display the item price (or recurring price if this is a renewal invoice) |
46 | - if ( $invoice->is_recurring() && $invoice->is_renewal() ) { |
|
47 | - wpinv_the_price( $fee['recurring_fee'], $invoice->get_currency() ); |
|
46 | + if ($invoice->is_recurring() && $invoice->is_renewal()) { |
|
47 | + wpinv_the_price($fee['recurring_fee'], $invoice->get_currency()); |
|
48 | 48 | } else { |
49 | - wpinv_the_price( $fee['initial_fee'], $invoice->get_currency() ); |
|
49 | + wpinv_the_price($fee['initial_fee'], $invoice->get_currency()); |
|
50 | 50 | } |
51 | 51 | } |
52 | 52 | |
53 | 53 | // Item quantity. |
54 | - if ( 'quantity' == $column ) { |
|
54 | + if ('quantity' == $column) { |
|
55 | 55 | echo '—'; |
56 | 56 | } |
57 | 57 | |
58 | 58 | // Item tax. |
59 | - if ( 'tax_rate' == $column ) { |
|
59 | + if ('tax_rate' == $column) { |
|
60 | 60 | echo '—'; |
61 | 61 | } |
62 | 62 | |
63 | 63 | // Item sub total. |
64 | - if ( 'subtotal' == $column ) { |
|
65 | - if ( $invoice->is_recurring() && $invoice->is_renewal() ) { |
|
66 | - wpinv_the_price( $fee['recurring_fee'], $invoice->get_currency() ); |
|
64 | + if ('subtotal' == $column) { |
|
65 | + if ($invoice->is_recurring() && $invoice->is_renewal()) { |
|
66 | + wpinv_the_price($fee['recurring_fee'], $invoice->get_currency()); |
|
67 | 67 | } else { |
68 | - wpinv_the_price( $fee['initial_fee'], $invoice->get_currency() ); |
|
68 | + wpinv_the_price($fee['initial_fee'], $invoice->get_currency()); |
|
69 | 69 | } |
70 | 70 | } |
71 | 71 | |
72 | 72 | // Fires when printing a line item column. |
73 | - do_action( "getpaid_email_fee_item_$column", $fee, $invoice ); |
|
73 | + do_action("getpaid_email_fee_item_$column", $fee, $invoice); |
|
74 | 74 | |
75 | 75 | ?> |
76 | 76 | |
@@ -80,4 +80,4 @@ discard block |
||
80 | 80 | |
81 | 81 | </tr> |
82 | 82 | |
83 | -<?php do_action( 'getpaid_after_email_fee_item', $invoice, $fee ); ?> |
|
83 | +<?php do_action('getpaid_after_email_fee_item', $invoice, $fee); ?> |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | * Contains functions that display the subscriptions admin page. |
4 | 4 | */ |
5 | 5 | |
6 | -defined( 'ABSPATH' ) || exit; |
|
6 | +defined('ABSPATH') || exit; |
|
7 | 7 | |
8 | 8 | /** |
9 | 9 | * Render the Subscriptions page |
@@ -17,23 +17,23 @@ discard block |
||
17 | 17 | ?> |
18 | 18 | |
19 | 19 | <div class="wrap"> |
20 | - <h1><?php echo esc_html( get_admin_page_title() ); ?></h1> |
|
20 | + <h1><?php echo esc_html(get_admin_page_title()); ?></h1> |
|
21 | 21 | <div class="bsui"> |
22 | 22 | |
23 | 23 | <?php |
24 | 24 | |
25 | 25 | // Verify user permissions. |
26 | - if ( ! wpinv_current_user_can_manage_invoicing() ) { |
|
26 | + if (!wpinv_current_user_can_manage_invoicing()) { |
|
27 | 27 | |
28 | 28 | aui()->alert( |
29 | 29 | array( |
30 | 30 | 'type' => 'danger', |
31 | - 'content' => __( 'You are not permitted to view this page.', 'invoicing' ), |
|
31 | + 'content' => __('You are not permitted to view this page.', 'invoicing'), |
|
32 | 32 | ), |
33 | 33 | true |
34 | 34 | ); |
35 | 35 | |
36 | - } elseif ( ! empty( $_GET['id'] ) && is_numeric( $_GET['id'] ) ) { |
|
36 | + } elseif (!empty($_GET['id']) && is_numeric($_GET['id'])) { |
|
37 | 37 | |
38 | 38 | // Display a single subscription. |
39 | 39 | wpinv_recurring_subscription_details(); |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | <?php $subscribers_table->views(); ?> |
68 | 68 | <form id="subscribers-filter" class="bsui" method="get"> |
69 | 69 | <input type="hidden" name="page" value="wpinv-subscriptions" /> |
70 | - <?php $subscribers_table->search_box( __( 'Search Subscriptions', 'invoicing' ), 'getpaid-search-subscriptions' ); ?> |
|
70 | + <?php $subscribers_table->search_box(__('Search Subscriptions', 'invoicing'), 'getpaid-search-subscriptions'); ?> |
|
71 | 71 | <?php $subscribers_table->display(); ?> |
72 | 72 | </form> |
73 | 73 | <?php |
@@ -83,13 +83,13 @@ discard block |
||
83 | 83 | function wpinv_recurring_subscription_details() { |
84 | 84 | |
85 | 85 | // Fetch the subscription. |
86 | - $sub = new WPInv_Subscription( (int) $_GET['id'] ); |
|
87 | - if ( ! $sub->exists() ) { |
|
86 | + $sub = new WPInv_Subscription((int) $_GET['id']); |
|
87 | + if (!$sub->exists()) { |
|
88 | 88 | |
89 | 89 | aui()->alert( |
90 | 90 | array( |
91 | 91 | 'type' => 'danger', |
92 | - 'content' => __( 'Subscription not found.', 'invoicing' ), |
|
92 | + 'content' => __('Subscription not found.', 'invoicing'), |
|
93 | 93 | ), |
94 | 94 | true |
95 | 95 | ); |
@@ -98,32 +98,32 @@ discard block |
||
98 | 98 | } |
99 | 99 | |
100 | 100 | // Use metaboxes to display the subscription details. |
101 | - add_meta_box( 'getpaid_admin_subscription_details_metabox', __( 'Subscription Details', 'invoicing' ), 'getpaid_admin_subscription_details_metabox', get_current_screen(), 'normal', 'high' ); |
|
102 | - add_meta_box( 'getpaid_admin_subscription_update_metabox', __( 'Change Status', 'invoicing' ), 'getpaid_admin_subscription_update_metabox', get_current_screen(), 'side' ); |
|
101 | + add_meta_box('getpaid_admin_subscription_details_metabox', __('Subscription Details', 'invoicing'), 'getpaid_admin_subscription_details_metabox', get_current_screen(), 'normal', 'high'); |
|
102 | + add_meta_box('getpaid_admin_subscription_update_metabox', __('Change Status', 'invoicing'), 'getpaid_admin_subscription_update_metabox', get_current_screen(), 'side'); |
|
103 | 103 | |
104 | 104 | $subscription_id = $sub->get_id(); |
105 | - $subscription_groups = getpaid_get_invoice_subscription_groups( $sub->get_parent_invoice_id() ); |
|
106 | - $subscription_group = wp_list_filter( $subscription_groups, compact( 'subscription_id' ) ); |
|
105 | + $subscription_groups = getpaid_get_invoice_subscription_groups($sub->get_parent_invoice_id()); |
|
106 | + $subscription_group = wp_list_filter($subscription_groups, compact('subscription_id')); |
|
107 | 107 | |
108 | - if ( 1 < count( $subscription_groups ) ) { |
|
109 | - add_meta_box( 'getpaid_admin_subscription_related_subscriptions_metabox', __( 'Related Subscriptions', 'invoicing' ), 'getpaid_admin_subscription_related_subscriptions_metabox', get_current_screen(), 'advanced' ); |
|
108 | + if (1 < count($subscription_groups)) { |
|
109 | + add_meta_box('getpaid_admin_subscription_related_subscriptions_metabox', __('Related Subscriptions', 'invoicing'), 'getpaid_admin_subscription_related_subscriptions_metabox', get_current_screen(), 'advanced'); |
|
110 | 110 | } |
111 | 111 | |
112 | - if ( ! empty( $subscription_group ) ) { |
|
113 | - add_meta_box( 'getpaid_admin_subscription_item_details_metabox', __( 'Subscription Items', 'invoicing' ), 'getpaid_admin_subscription_item_details_metabox', get_current_screen(), 'normal', 'low' ); |
|
112 | + if (!empty($subscription_group)) { |
|
113 | + add_meta_box('getpaid_admin_subscription_item_details_metabox', __('Subscription Items', 'invoicing'), 'getpaid_admin_subscription_item_details_metabox', get_current_screen(), 'normal', 'low'); |
|
114 | 114 | } |
115 | 115 | |
116 | - add_meta_box( 'getpaid_admin_subscription_invoice_details_metabox', __( 'Related Invoices', 'invoicing' ), 'getpaid_admin_subscription_invoice_details_metabox', get_current_screen(), 'advanced' ); |
|
116 | + add_meta_box('getpaid_admin_subscription_invoice_details_metabox', __('Related Invoices', 'invoicing'), 'getpaid_admin_subscription_invoice_details_metabox', get_current_screen(), 'advanced'); |
|
117 | 117 | |
118 | - do_action( 'getpaid_admin_single_subscription_register_metabox', $sub ); |
|
118 | + do_action('getpaid_admin_single_subscription_register_metabox', $sub); |
|
119 | 119 | |
120 | 120 | ?> |
121 | 121 | |
122 | - <form method="post" action="<?php echo esc_url( admin_url( 'admin.php?page=wpinv-subscriptions&id=' . absint( $sub->get_id() ) ) ); ?>"> |
|
122 | + <form method="post" action="<?php echo esc_url(admin_url('admin.php?page=wpinv-subscriptions&id=' . absint($sub->get_id()))); ?>"> |
|
123 | 123 | |
124 | - <?php wp_nonce_field( 'getpaid-nonce', 'getpaid-nonce' ); ?> |
|
125 | - <?php wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?> |
|
126 | - <?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?> |
|
124 | + <?php wp_nonce_field('getpaid-nonce', 'getpaid-nonce'); ?> |
|
125 | + <?php wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false); ?> |
|
126 | + <?php wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false); ?> |
|
127 | 127 | <input type="hidden" name="getpaid-admin-action" value="update_single_subscription" /> |
128 | 128 | <input type="hidden" name="subscription_id" value="<?php echo (int) $sub->get_id(); ?>" /> |
129 | 129 | |
@@ -131,12 +131,12 @@ discard block |
||
131 | 131 | <div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>"> |
132 | 132 | |
133 | 133 | <div id="postbox-container-1" class="postbox-container"> |
134 | - <?php do_meta_boxes( get_current_screen(), 'side', $sub ); ?> |
|
134 | + <?php do_meta_boxes(get_current_screen(), 'side', $sub); ?> |
|
135 | 135 | </div> |
136 | 136 | |
137 | 137 | <div id="postbox-container-2" class="postbox-container"> |
138 | - <?php do_meta_boxes( get_current_screen(), 'normal', $sub ); ?> |
|
139 | - <?php do_meta_boxes( get_current_screen(), 'advanced', $sub ); ?> |
|
138 | + <?php do_meta_boxes(get_current_screen(), 'normal', $sub); ?> |
|
139 | + <?php do_meta_boxes(get_current_screen(), 'advanced', $sub); ?> |
|
140 | 140 | </div> |
141 | 141 | |
142 | 142 | </div> |
@@ -155,43 +155,43 @@ discard block |
||
155 | 155 | * |
156 | 156 | * @param WPInv_Subscription $sub |
157 | 157 | */ |
158 | -function getpaid_admin_subscription_details_metabox( $sub ) { |
|
158 | +function getpaid_admin_subscription_details_metabox($sub) { |
|
159 | 159 | |
160 | 160 | // Subscription items. |
161 | - $subscription_group = getpaid_get_invoice_subscription_group( $sub->get_parent_invoice_id(), $sub->get_id() ); |
|
162 | - $items_count = empty( $subscription_group ) ? 1 : count( $subscription_group['items'] ); |
|
161 | + $subscription_group = getpaid_get_invoice_subscription_group($sub->get_parent_invoice_id(), $sub->get_id()); |
|
162 | + $items_count = empty($subscription_group) ? 1 : count($subscription_group['items']); |
|
163 | 163 | |
164 | 164 | // Prepare subscription detail columns. |
165 | 165 | $fields = apply_filters( |
166 | 166 | 'getpaid_subscription_admin_page_fields', |
167 | 167 | array( |
168 | - 'subscription' => __( 'Subscription', 'invoicing' ), |
|
169 | - 'customer' => __( 'Customer', 'invoicing' ), |
|
170 | - 'amount' => __( 'Amount', 'invoicing' ), |
|
171 | - 'start_date' => __( 'Start Date', 'invoicing' ), |
|
172 | - 'renews_on' => __( 'Next Payment', 'invoicing' ), |
|
173 | - 'renewals' => __( 'Payments', 'invoicing' ), |
|
174 | - 'item' => _n( 'Item', 'Items', $items_count, 'invoicing' ), |
|
175 | - 'gateway' => __( 'Payment Method', 'invoicing' ), |
|
176 | - 'profile_id' => __( 'Profile ID', 'invoicing' ), |
|
177 | - 'status' => __( 'Status', 'invoicing' ), |
|
168 | + 'subscription' => __('Subscription', 'invoicing'), |
|
169 | + 'customer' => __('Customer', 'invoicing'), |
|
170 | + 'amount' => __('Amount', 'invoicing'), |
|
171 | + 'start_date' => __('Start Date', 'invoicing'), |
|
172 | + 'renews_on' => __('Next Payment', 'invoicing'), |
|
173 | + 'renewals' => __('Payments', 'invoicing'), |
|
174 | + 'item' => _n('Item', 'Items', $items_count, 'invoicing'), |
|
175 | + 'gateway' => __('Payment Method', 'invoicing'), |
|
176 | + 'profile_id' => __('Profile ID', 'invoicing'), |
|
177 | + 'status' => __('Status', 'invoicing'), |
|
178 | 178 | ) |
179 | 179 | ); |
180 | 180 | |
181 | - if ( ! $sub->is_active() ) { |
|
181 | + if (!$sub->is_active()) { |
|
182 | 182 | |
183 | - if ( isset( $fields['renews_on'] ) ) { |
|
184 | - unset( $fields['renews_on'] ); |
|
183 | + if (isset($fields['renews_on'])) { |
|
184 | + unset($fields['renews_on']); |
|
185 | 185 | } |
186 | 186 | |
187 | - if ( isset( $fields['gateway'] ) ) { |
|
188 | - unset( $fields['gateway'] ); |
|
187 | + if (isset($fields['gateway'])) { |
|
188 | + unset($fields['gateway']); |
|
189 | 189 | } |
190 | 190 | } |
191 | 191 | |
192 | 192 | $profile_id = $sub->get_profile_id(); |
193 | - if ( empty( $profile_id ) && isset( $fields['profile_id'] ) ) { |
|
194 | - unset( $fields['profile_id'] ); |
|
193 | + if (empty($profile_id) && isset($fields['profile_id'])) { |
|
194 | + unset($fields['profile_id']); |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | ?> |
@@ -199,16 +199,16 @@ discard block |
||
199 | 199 | <table class="table table-borderless" style="font-size: 14px;"> |
200 | 200 | <tbody> |
201 | 201 | |
202 | - <?php foreach ( $fields as $key => $label ) : ?> |
|
202 | + <?php foreach ($fields as $key => $label) : ?> |
|
203 | 203 | |
204 | - <tr class="getpaid-subscription-meta-<?php echo esc_attr( $key ); ?>"> |
|
204 | + <tr class="getpaid-subscription-meta-<?php echo esc_attr($key); ?>"> |
|
205 | 205 | |
206 | 206 | <th class="w-25" style="font-weight: 500;"> |
207 | - <?php echo esc_html( $label ); ?> |
|
207 | + <?php echo esc_html($label); ?> |
|
208 | 208 | </th> |
209 | 209 | |
210 | 210 | <td class="w-75 text-muted"> |
211 | - <?php do_action( 'getpaid_subscription_admin_display_' . sanitize_key( $key ), $sub, $subscription_group ); ?> |
|
211 | + <?php do_action('getpaid_subscription_admin_display_' . sanitize_key($key), $sub, $subscription_group); ?> |
|
212 | 212 | </td> |
213 | 213 | |
214 | 214 | </tr> |
@@ -226,135 +226,135 @@ discard block |
||
226 | 226 | * |
227 | 227 | * @param WPInv_Subscription $subscription |
228 | 228 | */ |
229 | -function getpaid_admin_subscription_metabox_display_customer( $subscription ) { |
|
229 | +function getpaid_admin_subscription_metabox_display_customer($subscription) { |
|
230 | 230 | |
231 | - $username = __( '(Missing User)', 'invoicing' ); |
|
231 | + $username = __('(Missing User)', 'invoicing'); |
|
232 | 232 | |
233 | - $user = get_userdata( $subscription->get_customer_id() ); |
|
234 | - if ( $user ) { |
|
233 | + $user = get_userdata($subscription->get_customer_id()); |
|
234 | + if ($user) { |
|
235 | 235 | |
236 | 236 | $username = sprintf( |
237 | 237 | '<a href="user-edit.php?user_id=%s">%s</a>', |
238 | - absint( $user->ID ), |
|
239 | - ! empty( $user->display_name ) ? esc_html( $user->display_name ) : sanitize_email( $user->user_email ) |
|
238 | + absint($user->ID), |
|
239 | + !empty($user->display_name) ? esc_html($user->display_name) : sanitize_email($user->user_email) |
|
240 | 240 | ); |
241 | 241 | |
242 | 242 | } |
243 | 243 | |
244 | - echo wp_kses_post( $username ); |
|
244 | + echo wp_kses_post($username); |
|
245 | 245 | } |
246 | -add_action( 'getpaid_subscription_admin_display_customer', 'getpaid_admin_subscription_metabox_display_customer' ); |
|
246 | +add_action('getpaid_subscription_admin_display_customer', 'getpaid_admin_subscription_metabox_display_customer'); |
|
247 | 247 | |
248 | 248 | /** |
249 | 249 | * Displays the subscription amount. |
250 | 250 | * |
251 | 251 | * @param WPInv_Subscription $subscription |
252 | 252 | */ |
253 | -function getpaid_admin_subscription_metabox_display_amount( $subscription ) { |
|
254 | - $amount = getpaid_get_formatted_subscription_amount( $subscription ); |
|
255 | - echo wp_kses_post( "<span>$amount</span>" ); |
|
253 | +function getpaid_admin_subscription_metabox_display_amount($subscription) { |
|
254 | + $amount = getpaid_get_formatted_subscription_amount($subscription); |
|
255 | + echo wp_kses_post("<span>$amount</span>"); |
|
256 | 256 | } |
257 | -add_action( 'getpaid_subscription_admin_display_amount', 'getpaid_admin_subscription_metabox_display_amount' ); |
|
257 | +add_action('getpaid_subscription_admin_display_amount', 'getpaid_admin_subscription_metabox_display_amount'); |
|
258 | 258 | |
259 | 259 | /** |
260 | 260 | * Displays the subscription id. |
261 | 261 | * |
262 | 262 | * @param WPInv_Subscription $subscription |
263 | 263 | */ |
264 | -function getpaid_admin_subscription_metabox_display_id( $subscription ) { |
|
264 | +function getpaid_admin_subscription_metabox_display_id($subscription) { |
|
265 | 265 | |
266 | 266 | printf( |
267 | 267 | '<a href="%s">#%s</a>', |
268 | - esc_url( admin_url( 'admin.php?page=wpinv-subscriptions&id=' . absint( $subscription->get_id() ) ) ), |
|
269 | - absint( $subscription->get_id() ) |
|
268 | + esc_url(admin_url('admin.php?page=wpinv-subscriptions&id=' . absint($subscription->get_id()))), |
|
269 | + absint($subscription->get_id()) |
|
270 | 270 | ); |
271 | 271 | |
272 | 272 | } |
273 | -add_action( 'getpaid_subscription_admin_display_subscription', 'getpaid_admin_subscription_metabox_display_id' ); |
|
273 | +add_action('getpaid_subscription_admin_display_subscription', 'getpaid_admin_subscription_metabox_display_id'); |
|
274 | 274 | |
275 | 275 | /** |
276 | 276 | * Displays the subscription renewal date. |
277 | 277 | * |
278 | 278 | * @param WPInv_Subscription $subscription |
279 | 279 | */ |
280 | -function getpaid_admin_subscription_metabox_display_start_date( $subscription ) { |
|
281 | - echo esc_html( getpaid_format_date_value( $subscription->get_date_created() ) ); |
|
280 | +function getpaid_admin_subscription_metabox_display_start_date($subscription) { |
|
281 | + echo esc_html(getpaid_format_date_value($subscription->get_date_created())); |
|
282 | 282 | } |
283 | -add_action( 'getpaid_subscription_admin_display_start_date', 'getpaid_admin_subscription_metabox_display_start_date' ); |
|
283 | +add_action('getpaid_subscription_admin_display_start_date', 'getpaid_admin_subscription_metabox_display_start_date'); |
|
284 | 284 | |
285 | 285 | /** |
286 | 286 | * Displays the subscription renewal date. |
287 | 287 | * |
288 | 288 | * @param WPInv_Subscription $subscription |
289 | 289 | */ |
290 | -function getpaid_admin_subscription_metabox_display_renews_on( $subscription ) { |
|
291 | - echo esc_html( getpaid_format_date_value( $subscription->get_expiration() ) ); |
|
290 | +function getpaid_admin_subscription_metabox_display_renews_on($subscription) { |
|
291 | + echo esc_html(getpaid_format_date_value($subscription->get_expiration())); |
|
292 | 292 | } |
293 | -add_action( 'getpaid_subscription_admin_display_renews_on', 'getpaid_admin_subscription_metabox_display_renews_on' ); |
|
293 | +add_action('getpaid_subscription_admin_display_renews_on', 'getpaid_admin_subscription_metabox_display_renews_on'); |
|
294 | 294 | |
295 | 295 | /** |
296 | 296 | * Displays the subscription renewal count. |
297 | 297 | * |
298 | 298 | * @param WPInv_Subscription $subscription |
299 | 299 | */ |
300 | -function getpaid_admin_subscription_metabox_display_renewals( $subscription ) { |
|
300 | +function getpaid_admin_subscription_metabox_display_renewals($subscription) { |
|
301 | 301 | $max_bills = $subscription->get_bill_times(); |
302 | - echo ( (int) $subscription->get_times_billed() ) . ' / ' . ( empty( $max_bills ) ? '∞' : (int) $max_bills ); |
|
302 | + echo ((int) $subscription->get_times_billed()) . ' / ' . (empty($max_bills) ? '∞' : (int) $max_bills); |
|
303 | 303 | } |
304 | -add_action( 'getpaid_subscription_admin_display_renewals', 'getpaid_admin_subscription_metabox_display_renewals' ); |
|
304 | +add_action('getpaid_subscription_admin_display_renewals', 'getpaid_admin_subscription_metabox_display_renewals'); |
|
305 | 305 | /** |
306 | 306 | * Displays the subscription item. |
307 | 307 | * |
308 | 308 | * @param WPInv_Subscription $subscription |
309 | 309 | * @param false|array $subscription_group |
310 | 310 | */ |
311 | -function getpaid_admin_subscription_metabox_display_item( $subscription, $subscription_group = false ) { |
|
311 | +function getpaid_admin_subscription_metabox_display_item($subscription, $subscription_group = false) { |
|
312 | 312 | |
313 | - if ( empty( $subscription_group ) ) { |
|
314 | - echo wp_kses_post( WPInv_Subscriptions_List_Table::generate_item_markup( $subscription->get_product_id() ) ); |
|
313 | + if (empty($subscription_group)) { |
|
314 | + echo wp_kses_post(WPInv_Subscriptions_List_Table::generate_item_markup($subscription->get_product_id())); |
|
315 | 315 | return; |
316 | 316 | } |
317 | 317 | |
318 | - $markup = array_map( array( 'WPInv_Subscriptions_List_Table', 'generate_item_markup' ), array_keys( $subscription_group['items'] ) ); |
|
319 | - echo wp_kses_post( implode( ' | ', $markup ) ); |
|
318 | + $markup = array_map(array('WPInv_Subscriptions_List_Table', 'generate_item_markup'), array_keys($subscription_group['items'])); |
|
319 | + echo wp_kses_post(implode(' | ', $markup)); |
|
320 | 320 | |
321 | 321 | } |
322 | -add_action( 'getpaid_subscription_admin_display_item', 'getpaid_admin_subscription_metabox_display_item', 10, 2 ); |
|
322 | +add_action('getpaid_subscription_admin_display_item', 'getpaid_admin_subscription_metabox_display_item', 10, 2); |
|
323 | 323 | |
324 | 324 | /** |
325 | 325 | * Displays the subscription gateway. |
326 | 326 | * |
327 | 327 | * @param WPInv_Subscription $subscription |
328 | 328 | */ |
329 | -function getpaid_admin_subscription_metabox_display_gateway( $subscription ) { |
|
329 | +function getpaid_admin_subscription_metabox_display_gateway($subscription) { |
|
330 | 330 | |
331 | 331 | $gateway = $subscription->get_gateway(); |
332 | 332 | |
333 | - if ( ! empty( $gateway ) ) { |
|
334 | - echo esc_html( wpinv_get_gateway_admin_label( $gateway ) ); |
|
333 | + if (!empty($gateway)) { |
|
334 | + echo esc_html(wpinv_get_gateway_admin_label($gateway)); |
|
335 | 335 | } else { |
336 | 336 | echo '—'; |
337 | 337 | } |
338 | 338 | |
339 | 339 | } |
340 | -add_action( 'getpaid_subscription_admin_display_gateway', 'getpaid_admin_subscription_metabox_display_gateway' ); |
|
340 | +add_action('getpaid_subscription_admin_display_gateway', 'getpaid_admin_subscription_metabox_display_gateway'); |
|
341 | 341 | |
342 | 342 | /** |
343 | 343 | * Displays the subscription status. |
344 | 344 | * |
345 | 345 | * @param WPInv_Subscription $subscription |
346 | 346 | */ |
347 | -function getpaid_admin_subscription_metabox_display_status( $subscription ) { |
|
348 | - echo wp_kses_post( $subscription->get_status_label_html() ); |
|
347 | +function getpaid_admin_subscription_metabox_display_status($subscription) { |
|
348 | + echo wp_kses_post($subscription->get_status_label_html()); |
|
349 | 349 | } |
350 | -add_action( 'getpaid_subscription_admin_display_status', 'getpaid_admin_subscription_metabox_display_status' ); |
|
350 | +add_action('getpaid_subscription_admin_display_status', 'getpaid_admin_subscription_metabox_display_status'); |
|
351 | 351 | |
352 | 352 | /** |
353 | 353 | * Displays the subscription profile id. |
354 | 354 | * |
355 | 355 | * @param WPInv_Subscription $subscription |
356 | 356 | */ |
357 | -function getpaid_admin_subscription_metabox_display_profile_id( $subscription ) { |
|
357 | +function getpaid_admin_subscription_metabox_display_profile_id($subscription) { |
|
358 | 358 | |
359 | 359 | $profile_id = $subscription->get_profile_id(); |
360 | 360 | |
@@ -363,30 +363,30 @@ discard block |
||
363 | 363 | 'type' => 'text', |
364 | 364 | 'id' => 'wpinv_subscription_profile_id', |
365 | 365 | 'name' => 'wpinv_subscription_profile_id', |
366 | - 'label' => __( 'Profile Id', 'invoicing' ), |
|
366 | + 'label' => __('Profile Id', 'invoicing'), |
|
367 | 367 | 'label_type' => 'hidden', |
368 | - 'placeholder' => __( 'Profile Id', 'invoicing' ), |
|
369 | - 'value' => esc_attr( $profile_id ), |
|
368 | + 'placeholder' => __('Profile Id', 'invoicing'), |
|
369 | + 'value' => esc_attr($profile_id), |
|
370 | 370 | 'input_group_right' => '', |
371 | 371 | 'no_wrap' => true, |
372 | 372 | ), |
373 | 373 | true |
374 | 374 | ); |
375 | 375 | |
376 | - $url = apply_filters( 'getpaid_remote_subscription_profile_url', '', $subscription ); |
|
377 | - if ( ! empty( $url ) ) { |
|
378 | - echo ' <a href="' . esc_url_raw( $url ) . '" title="' . esc_attr__( 'View in Gateway', 'invoicing' ) . '" target="_blank"><i class="fas fa-external-link-alt fa-xs fa-fw align-top"></i></a>'; |
|
376 | + $url = apply_filters('getpaid_remote_subscription_profile_url', '', $subscription); |
|
377 | + if (!empty($url)) { |
|
378 | + echo ' <a href="' . esc_url_raw($url) . '" title="' . esc_attr__('View in Gateway', 'invoicing') . '" target="_blank"><i class="fas fa-external-link-alt fa-xs fa-fw align-top"></i></a>'; |
|
379 | 379 | } |
380 | 380 | |
381 | 381 | } |
382 | -add_action( 'getpaid_subscription_admin_display_profile_id', 'getpaid_admin_subscription_metabox_display_profile_id' ); |
|
382 | +add_action('getpaid_subscription_admin_display_profile_id', 'getpaid_admin_subscription_metabox_display_profile_id'); |
|
383 | 383 | |
384 | 384 | /** |
385 | 385 | * Displays the subscriptions update metabox. |
386 | 386 | * |
387 | 387 | * @param WPInv_Subscription $subscription |
388 | 388 | */ |
389 | -function getpaid_admin_subscription_update_metabox( $subscription ) { |
|
389 | +function getpaid_admin_subscription_update_metabox($subscription) { |
|
390 | 390 | |
391 | 391 | ?> |
392 | 392 | <div class="mt-3"> |
@@ -399,10 +399,10 @@ discard block |
||
399 | 399 | 'id' => 'subscription_status_update_select', |
400 | 400 | 'required' => true, |
401 | 401 | 'no_wrap' => false, |
402 | - 'label' => __( 'Subscription Status', 'invoicing' ), |
|
403 | - 'help_text' => __( 'Updating the status will trigger related actions and hooks', 'invoicing' ), |
|
402 | + 'label' => __('Subscription Status', 'invoicing'), |
|
403 | + 'help_text' => __('Updating the status will trigger related actions and hooks', 'invoicing'), |
|
404 | 404 | 'select2' => true, |
405 | - 'value' => $subscription->get_status( 'edit' ), |
|
405 | + 'value' => $subscription->get_status('edit'), |
|
406 | 406 | ), |
407 | 407 | true |
408 | 408 | ); |
@@ -411,14 +411,14 @@ discard block |
||
411 | 411 | <div class="mt-2 px-3 py-2 bg-light border-top" style="margin: -12px;"> |
412 | 412 | |
413 | 413 | <?php |
414 | - submit_button( __( 'Update', 'invoicing' ), 'primary', 'submit', false ); |
|
414 | + submit_button(__('Update', 'invoicing'), 'primary', 'submit', false); |
|
415 | 415 | |
416 | - $url = wp_nonce_url( add_query_arg( 'getpaid-admin-action', 'subscription_manual_renew' ), 'getpaid-nonce', 'getpaid-nonce' ); |
|
417 | - $anchor = __( 'Renew Subscription', 'invoicing' ); |
|
418 | - $title = esc_attr__( 'Are you sure you want to extend the subscription and generate a new invoice that will be automatically marked as paid?', 'invoicing' ); |
|
416 | + $url = wp_nonce_url(add_query_arg('getpaid-admin-action', 'subscription_manual_renew'), 'getpaid-nonce', 'getpaid-nonce'); |
|
417 | + $anchor = __('Renew Subscription', 'invoicing'); |
|
418 | + $title = esc_attr__('Are you sure you want to extend the subscription and generate a new invoice that will be automatically marked as paid?', 'invoicing'); |
|
419 | 419 | |
420 | - if ( $subscription->is_active() ) { |
|
421 | - echo "<a href='" . esc_url( $url ) . "' class='float-right text-muted' onclick='return confirm(\"" . esc_attr( $title ) . "\")'>" . esc_html( $anchor ) . "</a>"; |
|
420 | + if ($subscription->is_active()) { |
|
421 | + echo "<a href='" . esc_url($url) . "' class='float-right text-muted' onclick='return confirm(\"" . esc_attr($title) . "\")'>" . esc_html($anchor) . "</a>"; |
|
422 | 422 | } |
423 | 423 | |
424 | 424 | echo '</div></div>'; |
@@ -430,44 +430,44 @@ discard block |
||
430 | 430 | * @param WPInv_Subscription $subscription |
431 | 431 | * @param bool $strict Whether or not to skip invoices of sibling subscriptions |
432 | 432 | */ |
433 | -function getpaid_admin_subscription_invoice_details_metabox( $subscription, $strict = true ) { |
|
433 | +function getpaid_admin_subscription_invoice_details_metabox($subscription, $strict = true) { |
|
434 | 434 | |
435 | 435 | $columns = apply_filters( |
436 | 436 | 'getpaid_subscription_related_invoices_columns', |
437 | 437 | array( |
438 | - 'invoice' => __( 'Invoice', 'invoicing' ), |
|
439 | - 'relationship' => __( 'Relationship', 'invoicing' ), |
|
440 | - 'date' => __( 'Date', 'invoicing' ), |
|
441 | - 'status' => __( 'Status', 'invoicing' ), |
|
442 | - 'total' => __( 'Total', 'invoicing' ), |
|
438 | + 'invoice' => __('Invoice', 'invoicing'), |
|
439 | + 'relationship' => __('Relationship', 'invoicing'), |
|
440 | + 'date' => __('Date', 'invoicing'), |
|
441 | + 'status' => __('Status', 'invoicing'), |
|
442 | + 'total' => __('Total', 'invoicing'), |
|
443 | 443 | ), |
444 | 444 | $subscription |
445 | 445 | ); |
446 | 446 | |
447 | 447 | // Prepare the invoices. |
448 | - $payments = $subscription->get_child_payments( ! is_admin() ); |
|
448 | + $payments = $subscription->get_child_payments(!is_admin()); |
|
449 | 449 | $parent = $subscription->get_parent_invoice(); |
450 | 450 | |
451 | - if ( $parent->exists() ) { |
|
452 | - $payments = array_merge( array( $parent ), $payments ); |
|
451 | + if ($parent->exists()) { |
|
452 | + $payments = array_merge(array($parent), $payments); |
|
453 | 453 | } |
454 | 454 | |
455 | 455 | $table_class = 'w-100 bg-white'; |
456 | 456 | |
457 | - if ( ! is_admin() ) { |
|
457 | + if (!is_admin()) { |
|
458 | 458 | $table_class = 'table table-bordered'; |
459 | 459 | } |
460 | 460 | |
461 | 461 | ?> |
462 | 462 | <div class="m-0" style="overflow: auto;"> |
463 | 463 | |
464 | - <table class="<?php echo esc_attr( $table_class ); ?>"> |
|
464 | + <table class="<?php echo esc_attr($table_class); ?>"> |
|
465 | 465 | |
466 | 466 | <thead> |
467 | 467 | <tr> |
468 | 468 | <?php |
469 | - foreach ( $columns as $key => $label ) { |
|
470 | - echo "<th class='subscription-invoice-field-" . esc_attr( $key ) . " bg-light p-2 text-left color-dark font-weight-bold'>" . esc_html( $label ) . "</th>"; |
|
469 | + foreach ($columns as $key => $label) { |
|
470 | + echo "<th class='subscription-invoice-field-" . esc_attr($key) . " bg-light p-2 text-left color-dark font-weight-bold'>" . esc_html($label) . "</th>"; |
|
471 | 471 | } |
472 | 472 | ?> |
473 | 473 | </tr> |
@@ -475,71 +475,71 @@ discard block |
||
475 | 475 | |
476 | 476 | <tbody> |
477 | 477 | |
478 | - <?php if ( empty( $payments ) ) : ?> |
|
478 | + <?php if (empty($payments)) : ?> |
|
479 | 479 | <tr> |
480 | - <td colspan="<?php echo count( $columns ); ?>" class="p-2 text-left text-muted"> |
|
481 | - <?php esc_html_e( 'This subscription has no invoices.', 'invoicing' ); ?> |
|
480 | + <td colspan="<?php echo count($columns); ?>" class="p-2 text-left text-muted"> |
|
481 | + <?php esc_html_e('This subscription has no invoices.', 'invoicing'); ?> |
|
482 | 482 | </td> |
483 | 483 | </tr> |
484 | 484 | <?php endif; ?> |
485 | 485 | |
486 | 486 | <?php |
487 | 487 | |
488 | - foreach ( $payments as $payment ) : |
|
488 | + foreach ($payments as $payment) : |
|
489 | 489 | |
490 | 490 | // Ensure that we have an invoice. |
491 | - $payment = new WPInv_Invoice( $payment ); |
|
491 | + $payment = new WPInv_Invoice($payment); |
|
492 | 492 | |
493 | 493 | // Abort if the invoice is invalid... |
494 | - if ( ! $payment->exists() ) { |
|
494 | + if (!$payment->exists()) { |
|
495 | 495 | continue; |
496 | 496 | } |
497 | 497 | |
498 | 498 | // ... or belongs to a different subscription. |
499 | - if ( $strict && $payment->is_renewal() && $payment->get_subscription_id() && $payment->get_subscription_id() != $subscription->get_id() ) { |
|
499 | + if ($strict && $payment->is_renewal() && $payment->get_subscription_id() && $payment->get_subscription_id() != $subscription->get_id()) { |
|
500 | 500 | continue; |
501 | 501 | } |
502 | 502 | |
503 | 503 | echo '<tr>'; |
504 | 504 | |
505 | - foreach ( array_keys( $columns ) as $key ) { |
|
505 | + foreach (array_keys($columns) as $key) { |
|
506 | 506 | |
507 | 507 | echo "<td class='p-2 text-left'>"; |
508 | 508 | |
509 | - switch ( $key ) { |
|
509 | + switch ($key) { |
|
510 | 510 | |
511 | 511 | case 'total': |
512 | 512 | echo '<strong>'; |
513 | - wpinv_the_price( $payment->get_total(), $payment->get_currency() ); |
|
513 | + wpinv_the_price($payment->get_total(), $payment->get_currency()); |
|
514 | 514 | echo '</strong>'; |
515 | 515 | break; |
516 | 516 | |
517 | 517 | case 'relationship': |
518 | - echo $payment->is_renewal() ? esc_html__( 'Renewal Invoice', 'invoicing' ) : esc_html__( 'Initial Invoice', 'invoicing' ); |
|
518 | + echo $payment->is_renewal() ? esc_html__('Renewal Invoice', 'invoicing') : esc_html__('Initial Invoice', 'invoicing'); |
|
519 | 519 | break; |
520 | 520 | |
521 | 521 | case 'date': |
522 | - echo esc_html( getpaid_format_date_value( $payment->get_date_created() ) ); |
|
522 | + echo esc_html(getpaid_format_date_value($payment->get_date_created())); |
|
523 | 523 | break; |
524 | 524 | |
525 | 525 | case 'status': |
526 | 526 | $status = $payment->get_status_nicename(); |
527 | - if ( is_admin() ) { |
|
527 | + if (is_admin()) { |
|
528 | 528 | $status = $payment->get_status_label_html(); |
529 | 529 | } |
530 | 530 | |
531 | - echo wp_kses_post( $status ); |
|
531 | + echo wp_kses_post($status); |
|
532 | 532 | break; |
533 | 533 | |
534 | 534 | case 'invoice': |
535 | - $link = esc_url( get_edit_post_link( $payment->get_id() ) ); |
|
535 | + $link = esc_url(get_edit_post_link($payment->get_id())); |
|
536 | 536 | |
537 | - if ( ! is_admin() ) { |
|
538 | - $link = esc_url( $payment->get_view_url() ); |
|
537 | + if (!is_admin()) { |
|
538 | + $link = esc_url($payment->get_view_url()); |
|
539 | 539 | } |
540 | 540 | |
541 | - $invoice = esc_html( $payment->get_number() ); |
|
542 | - echo wp_kses_post( "<a href='$link'>$invoice</a>" ); |
|
541 | + $invoice = esc_html($payment->get_number()); |
|
542 | + echo wp_kses_post("<a href='$link'>$invoice</a>"); |
|
543 | 543 | break; |
544 | 544 | } |
545 | 545 | |
@@ -566,12 +566,12 @@ discard block |
||
566 | 566 | * |
567 | 567 | * @param WPInv_Subscription $subscription |
568 | 568 | */ |
569 | -function getpaid_admin_subscription_item_details_metabox( $subscription ) { |
|
569 | +function getpaid_admin_subscription_item_details_metabox($subscription) { |
|
570 | 570 | |
571 | 571 | // Fetch the subscription group. |
572 | - $subscription_group = getpaid_get_invoice_subscription_group( $subscription->get_parent_payment_id(), $subscription->get_id() ); |
|
572 | + $subscription_group = getpaid_get_invoice_subscription_group($subscription->get_parent_payment_id(), $subscription->get_id()); |
|
573 | 573 | |
574 | - if ( empty( $subscription_group ) || empty( $subscription_group['items'] ) ) { |
|
574 | + if (empty($subscription_group) || empty($subscription_group['items'])) { |
|
575 | 575 | return; |
576 | 576 | } |
577 | 577 | |
@@ -579,12 +579,12 @@ discard block |
||
579 | 579 | $columns = apply_filters( |
580 | 580 | 'getpaid_subscription_item_details_columns', |
581 | 581 | array( |
582 | - 'item_name' => __( 'Item', 'invoicing' ), |
|
583 | - 'price' => __( 'Price', 'invoicing' ), |
|
584 | - 'tax' => __( 'Tax', 'invoicing' ), |
|
585 | - 'discount' => __( 'Discount', 'invoicing' ), |
|
582 | + 'item_name' => __('Item', 'invoicing'), |
|
583 | + 'price' => __('Price', 'invoicing'), |
|
584 | + 'tax' => __('Tax', 'invoicing'), |
|
585 | + 'discount' => __('Discount', 'invoicing'), |
|
586 | 586 | //'initial' => __( 'Initial Amount', 'invoicing' ), |
587 | - 'recurring' => __( 'Subtotal', 'invoicing' ), |
|
587 | + 'recurring' => __('Subtotal', 'invoicing'), |
|
588 | 588 | ), |
589 | 589 | $subscription |
590 | 590 | ); |
@@ -593,27 +593,27 @@ discard block |
||
593 | 593 | |
594 | 594 | $invoice = $subscription->get_parent_invoice(); |
595 | 595 | |
596 | - if ( ( ! wpinv_use_taxes() || ! $invoice->is_taxable() ) && isset( $columns['tax'] ) ) { |
|
597 | - unset( $columns['tax'] ); |
|
596 | + if ((!wpinv_use_taxes() || !$invoice->is_taxable()) && isset($columns['tax'])) { |
|
597 | + unset($columns['tax']); |
|
598 | 598 | } |
599 | 599 | |
600 | 600 | $table_class = 'w-100 bg-white'; |
601 | 601 | |
602 | - if ( ! is_admin() ) { |
|
602 | + if (!is_admin()) { |
|
603 | 603 | $table_class = 'table table-bordered'; |
604 | 604 | } |
605 | 605 | |
606 | 606 | ?> |
607 | 607 | <div class="m-0" style="overflow: auto;"> |
608 | 608 | |
609 | - <table class="<?php echo esc_attr( $table_class ); ?>"> |
|
609 | + <table class="<?php echo esc_attr($table_class); ?>"> |
|
610 | 610 | |
611 | 611 | <thead> |
612 | 612 | <tr> |
613 | 613 | <?php |
614 | 614 | |
615 | - foreach ( $columns as $key => $label ) { |
|
616 | - echo "<th class='subscription-item-field-" . esc_attr( $key ) . " bg-light p-2 text-left color-dark font-weight-bold'>" . esc_html( $label ) . "</th>"; |
|
615 | + foreach ($columns as $key => $label) { |
|
616 | + echo "<th class='subscription-item-field-" . esc_attr($key) . " bg-light p-2 text-left color-dark font-weight-bold'>" . esc_html($label) . "</th>"; |
|
617 | 617 | } |
618 | 618 | ?> |
619 | 619 | </tr> |
@@ -623,48 +623,48 @@ discard block |
||
623 | 623 | |
624 | 624 | <?php |
625 | 625 | |
626 | - foreach ( $subscription_group['items'] as $subscription_group_item ) : |
|
626 | + foreach ($subscription_group['items'] as $subscription_group_item) : |
|
627 | 627 | |
628 | 628 | echo '<tr>'; |
629 | 629 | |
630 | - foreach ( array_keys( $columns ) as $key ) { |
|
630 | + foreach (array_keys($columns) as $key) { |
|
631 | 631 | |
632 | 632 | $class = 'text-left'; |
633 | 633 | |
634 | 634 | echo "<td class='p-2 text-left'>"; |
635 | 635 | |
636 | - switch ( $key ) { |
|
636 | + switch ($key) { |
|
637 | 637 | |
638 | 638 | case 'item_name': |
639 | - $item_name = get_the_title( $subscription_group_item['item_id'] ); |
|
640 | - $item_name = empty( $item_name ) ? $subscription_group_item['item_name'] : $item_name; |
|
639 | + $item_name = get_the_title($subscription_group_item['item_id']); |
|
640 | + $item_name = empty($item_name) ? $subscription_group_item['item_name'] : $item_name; |
|
641 | 641 | |
642 | - if ( $invoice->get_template() == 'amount' || 1 == (float) $subscription_group_item['quantity'] ) { |
|
643 | - echo esc_html( $item_name ); |
|
642 | + if ($invoice->get_template() == 'amount' || 1 == (float) $subscription_group_item['quantity']) { |
|
643 | + echo esc_html($item_name); |
|
644 | 644 | } else { |
645 | - printf( '%1$s x %2$d', esc_html( $item_name ), (float) $subscription_group_item['quantity'] ); |
|
645 | + printf('%1$s x %2$d', esc_html($item_name), (float) $subscription_group_item['quantity']); |
|
646 | 646 | } |
647 | 647 | |
648 | 648 | break; |
649 | 649 | |
650 | 650 | case 'price': |
651 | - wpinv_the_price( $subscription_group_item['item_price'], $invoice->get_currency() ); |
|
651 | + wpinv_the_price($subscription_group_item['item_price'], $invoice->get_currency()); |
|
652 | 652 | break; |
653 | 653 | |
654 | 654 | case 'tax': |
655 | - wpinv_the_price( $subscription_group_item['tax'], $invoice->get_currency() ); |
|
655 | + wpinv_the_price($subscription_group_item['tax'], $invoice->get_currency()); |
|
656 | 656 | break; |
657 | 657 | |
658 | 658 | case 'discount': |
659 | - wpinv_the_price( $subscription_group_item['discount'], $invoice->get_currency() ); |
|
659 | + wpinv_the_price($subscription_group_item['discount'], $invoice->get_currency()); |
|
660 | 660 | break; |
661 | 661 | |
662 | 662 | case 'initial': |
663 | - wpinv_the_price( $subscription_group_item['price'] * $subscription_group_item['quantity'], $invoice->get_currency() ); |
|
663 | + wpinv_the_price($subscription_group_item['price'] * $subscription_group_item['quantity'], $invoice->get_currency()); |
|
664 | 664 | break; |
665 | 665 | |
666 | 666 | case 'recurring': |
667 | - echo wp_kses_post( '<strong>' . wpinv_price( $subscription_group_item['price'] * $subscription_group_item['quantity'], $invoice->get_currency() ) . '</strong>' ); |
|
667 | + echo wp_kses_post('<strong>' . wpinv_price($subscription_group_item['price'] * $subscription_group_item['quantity'], $invoice->get_currency()) . '</strong>'); |
|
668 | 668 | break; |
669 | 669 | |
670 | 670 | } |
@@ -677,24 +677,24 @@ discard block |
||
677 | 677 | |
678 | 678 | endforeach; |
679 | 679 | |
680 | - foreach ( $subscription_group['fees'] as $subscription_group_fee ) : |
|
680 | + foreach ($subscription_group['fees'] as $subscription_group_fee) : |
|
681 | 681 | |
682 | 682 | echo '<tr>'; |
683 | 683 | |
684 | - foreach ( array_keys( $columns ) as $key ) { |
|
684 | + foreach (array_keys($columns) as $key) { |
|
685 | 685 | |
686 | 686 | $class = 'text-left'; |
687 | 687 | |
688 | 688 | echo "<td class='p-2 text-left'>"; |
689 | 689 | |
690 | - switch ( $key ) { |
|
690 | + switch ($key) { |
|
691 | 691 | |
692 | 692 | case 'item_name': |
693 | - echo esc_html( $subscription_group_fee['name'] ); |
|
693 | + echo esc_html($subscription_group_fee['name']); |
|
694 | 694 | break; |
695 | 695 | |
696 | 696 | case 'price': |
697 | - wpinv_the_price( $subscription_group_fee['initial_fee'], $invoice->get_currency() ); |
|
697 | + wpinv_the_price($subscription_group_fee['initial_fee'], $invoice->get_currency()); |
|
698 | 698 | break; |
699 | 699 | |
700 | 700 | case 'tax': |
@@ -706,11 +706,11 @@ discard block |
||
706 | 706 | break; |
707 | 707 | |
708 | 708 | case 'initial': |
709 | - wpinv_the_price( $subscription_group_fee['initial_fee'], $invoice->get_currency() ); |
|
709 | + wpinv_the_price($subscription_group_fee['initial_fee'], $invoice->get_currency()); |
|
710 | 710 | break; |
711 | 711 | |
712 | 712 | case 'recurring': |
713 | - echo wp_kses_post( '<strong>' . wpinv_price( $subscription_group_fee['recurring_fee'], $invoice->get_currency() ) . '</strong>' ); |
|
713 | + echo wp_kses_post('<strong>' . wpinv_price($subscription_group_fee['recurring_fee'], $invoice->get_currency()) . '</strong>'); |
|
714 | 714 | break; |
715 | 715 | |
716 | 716 | } |
@@ -739,12 +739,12 @@ discard block |
||
739 | 739 | * @param WPInv_Subscription $subscription |
740 | 740 | * @param bool $skip_current |
741 | 741 | */ |
742 | -function getpaid_admin_subscription_related_subscriptions_metabox( $subscription, $skip_current = true ) { |
|
742 | +function getpaid_admin_subscription_related_subscriptions_metabox($subscription, $skip_current = true) { |
|
743 | 743 | |
744 | 744 | // Fetch the subscription groups. |
745 | - $subscription_groups = getpaid_get_invoice_subscription_groups( $subscription->get_parent_payment_id() ); |
|
745 | + $subscription_groups = getpaid_get_invoice_subscription_groups($subscription->get_parent_payment_id()); |
|
746 | 746 | |
747 | - if ( empty( $subscription_groups ) ) { |
|
747 | + if (empty($subscription_groups)) { |
|
748 | 748 | return; |
749 | 749 | } |
750 | 750 | |
@@ -752,37 +752,37 @@ discard block |
||
752 | 752 | $columns = apply_filters( |
753 | 753 | 'getpaid_subscription_related_subscriptions_columns', |
754 | 754 | array( |
755 | - 'subscription' => __( 'Subscription', 'invoicing' ), |
|
756 | - 'start_date' => __( 'Start Date', 'invoicing' ), |
|
757 | - 'renewal_date' => __( 'Next Payment', 'invoicing' ), |
|
758 | - 'renewals' => __( 'Payments', 'invoicing' ), |
|
759 | - 'item' => __( 'Items', 'invoicing' ), |
|
760 | - 'status' => __( 'Status', 'invoicing' ), |
|
755 | + 'subscription' => __('Subscription', 'invoicing'), |
|
756 | + 'start_date' => __('Start Date', 'invoicing'), |
|
757 | + 'renewal_date' => __('Next Payment', 'invoicing'), |
|
758 | + 'renewals' => __('Payments', 'invoicing'), |
|
759 | + 'item' => __('Items', 'invoicing'), |
|
760 | + 'status' => __('Status', 'invoicing'), |
|
761 | 761 | ), |
762 | 762 | $subscription |
763 | 763 | ); |
764 | 764 | |
765 | - if ( $subscription->get_status() == 'pending' ) { |
|
766 | - unset( $columns['start_date'], $columns['renewal_date'] ); |
|
765 | + if ($subscription->get_status() == 'pending') { |
|
766 | + unset($columns['start_date'], $columns['renewal_date']); |
|
767 | 767 | } |
768 | 768 | |
769 | 769 | $table_class = 'w-100 bg-white'; |
770 | 770 | |
771 | - if ( ! is_admin() ) { |
|
771 | + if (!is_admin()) { |
|
772 | 772 | $table_class = 'table table-bordered'; |
773 | 773 | } |
774 | 774 | |
775 | 775 | ?> |
776 | 776 | <div class="m-0" style="overflow: auto;"> |
777 | 777 | |
778 | - <table class="<?php echo esc_attr( $table_class ); ?>"> |
|
778 | + <table class="<?php echo esc_attr($table_class); ?>"> |
|
779 | 779 | |
780 | 780 | <thead> |
781 | 781 | <tr> |
782 | 782 | <?php |
783 | 783 | |
784 | - foreach ( $columns as $key => $label ) { |
|
785 | - echo "<th class='related-subscription-field-" . esc_attr( $key ) . " bg-light p-2 text-left color-dark font-weight-bold'>" . esc_html( $label ) . "</th>"; |
|
784 | + foreach ($columns as $key => $label) { |
|
785 | + echo "<th class='related-subscription-field-" . esc_attr($key) . " bg-light p-2 text-left color-dark font-weight-bold'>" . esc_html($label) . "</th>"; |
|
786 | 786 | } |
787 | 787 | ?> |
788 | 788 | </tr> |
@@ -792,62 +792,62 @@ discard block |
||
792 | 792 | |
793 | 793 | <?php |
794 | 794 | |
795 | - foreach ( $subscription_groups as $subscription_group ) : |
|
795 | + foreach ($subscription_groups as $subscription_group) : |
|
796 | 796 | |
797 | 797 | // Do not list current subscription. |
798 | - if ( $skip_current && (int) $subscription_group['subscription_id'] === $subscription->get_id() ) { |
|
798 | + if ($skip_current && (int) $subscription_group['subscription_id'] === $subscription->get_id()) { |
|
799 | 799 | continue; |
800 | 800 | } |
801 | 801 | |
802 | 802 | // Ensure the subscription exists. |
803 | - $_suscription = new WPInv_Subscription( $subscription_group['subscription_id'] ); |
|
803 | + $_suscription = new WPInv_Subscription($subscription_group['subscription_id']); |
|
804 | 804 | |
805 | - if ( ! $_suscription->exists() ) { |
|
805 | + if (!$_suscription->exists()) { |
|
806 | 806 | continue; |
807 | 807 | } |
808 | 808 | |
809 | 809 | echo '<tr>'; |
810 | 810 | |
811 | - foreach ( array_keys( $columns ) as $key ) { |
|
811 | + foreach (array_keys($columns) as $key) { |
|
812 | 812 | |
813 | 813 | $class = 'text-left'; |
814 | 814 | |
815 | 815 | echo "<td class='p-2 text-left'>"; |
816 | 816 | |
817 | - switch ( $key ) { |
|
817 | + switch ($key) { |
|
818 | 818 | |
819 | 819 | case 'status': |
820 | - echo wp_kses_post( $_suscription->get_status_label_html() ); |
|
820 | + echo wp_kses_post($_suscription->get_status_label_html()); |
|
821 | 821 | break; |
822 | 822 | |
823 | 823 | case 'item': |
824 | - $markup = array_map( array( 'WPInv_Subscriptions_List_Table', 'generate_item_markup' ), array_keys( $subscription_group['items'] ) ); |
|
825 | - echo wp_kses_post( implode( ' | ', $markup ) ); |
|
824 | + $markup = array_map(array('WPInv_Subscriptions_List_Table', 'generate_item_markup'), array_keys($subscription_group['items'])); |
|
825 | + echo wp_kses_post(implode(' | ', $markup)); |
|
826 | 826 | break; |
827 | 827 | |
828 | 828 | case 'renewals': |
829 | 829 | $max_bills = $_suscription->get_bill_times(); |
830 | - echo ( (int) $_suscription->get_times_billed() ) . ' / ' . ( empty( $max_bills ) ? '∞' : (int) $max_bills ); |
|
830 | + echo ((int) $_suscription->get_times_billed()) . ' / ' . (empty($max_bills) ? '∞' : (int) $max_bills); |
|
831 | 831 | break; |
832 | 832 | |
833 | 833 | case 'renewal_date': |
834 | - echo $_suscription->is_active() ? esc_html( getpaid_format_date_value( $_suscription->get_expiration() ) ) : '—'; |
|
834 | + echo $_suscription->is_active() ? esc_html(getpaid_format_date_value($_suscription->get_expiration())) : '—'; |
|
835 | 835 | break; |
836 | 836 | |
837 | 837 | case 'start_date': |
838 | - echo 'pending' == $_suscription->get_status() ? '—' : esc_html( getpaid_format_date_value( $_suscription->get_date_created() ) ); |
|
838 | + echo 'pending' == $_suscription->get_status() ? '—' : esc_html(getpaid_format_date_value($_suscription->get_date_created())); |
|
839 | 839 | break; |
840 | 840 | |
841 | 841 | case 'subscription': |
842 | - $url = is_admin() ? admin_url( 'admin.php?page=wpinv-subscriptions&id=' . absint( $_suscription->get_id() ) ) : $_suscription->get_view_url(); |
|
842 | + $url = is_admin() ? admin_url('admin.php?page=wpinv-subscriptions&id=' . absint($_suscription->get_id())) : $_suscription->get_view_url(); |
|
843 | 843 | printf( |
844 | 844 | '%1$s#%2$s%3$s', |
845 | - '<a href="' . esc_url( $url ) . '">', |
|
846 | - '<strong>' . intval( $_suscription->get_id() ) . '</strong>', |
|
845 | + '<a href="' . esc_url($url) . '">', |
|
846 | + '<strong>' . intval($_suscription->get_id()) . '</strong>', |
|
847 | 847 | '</a>' |
848 | 848 | ); |
849 | 849 | |
850 | - echo wp_kses_post( WPInv_Subscriptions_List_Table::column_amount( $_suscription ) ); |
|
850 | + echo wp_kses_post(WPInv_Subscriptions_List_Table::column_amount($_suscription)); |
|
851 | 851 | break; |
852 | 852 | |
853 | 853 | } |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | * |
6 | 6 | */ |
7 | 7 | |
8 | -defined( 'ABSPATH' ) || exit; |
|
8 | +defined('ABSPATH') || exit; |
|
9 | 9 | |
10 | 10 | /** |
11 | 11 | * GetPaid_Reports_Report Class. |
@@ -23,26 +23,26 @@ discard block |
||
23 | 23 | */ |
24 | 24 | public function __construct() { |
25 | 25 | |
26 | - $this->views = array( |
|
26 | + $this->views = array( |
|
27 | 27 | |
28 | 28 | 'items' => array( |
29 | - 'label' => __( 'Items', 'invoicing' ), |
|
29 | + 'label' => __('Items', 'invoicing'), |
|
30 | 30 | 'class' => 'GetPaid_Reports_Report_Items', |
31 | 31 | ), |
32 | 32 | |
33 | 33 | 'gateways' => array( |
34 | - 'label' => __( 'Payment Methods', 'invoicing' ), |
|
34 | + 'label' => __('Payment Methods', 'invoicing'), |
|
35 | 35 | 'class' => 'GetPaid_Reports_Report_Gateways', |
36 | 36 | ), |
37 | 37 | |
38 | 38 | 'discounts' => array( |
39 | - 'label' => __( 'Discount Codes', 'invoicing' ), |
|
39 | + 'label' => __('Discount Codes', 'invoicing'), |
|
40 | 40 | 'class' => 'GetPaid_Reports_Report_Discounts', |
41 | 41 | ), |
42 | 42 | |
43 | 43 | ); |
44 | 44 | |
45 | - $this->views = apply_filters( 'wpinv_report_views', $this->views ); |
|
45 | + $this->views = apply_filters('wpinv_report_views', $this->views); |
|
46 | 46 | |
47 | 47 | } |
48 | 48 | |
@@ -53,8 +53,8 @@ discard block |
||
53 | 53 | public function get_range() { |
54 | 54 | $valid_ranges = $this->get_periods(); |
55 | 55 | |
56 | - if ( isset( $_GET['date_range'] ) && array_key_exists( $_GET['date_range'], $valid_ranges ) ) { |
|
57 | - return sanitize_key( $_GET['date_range'] ); |
|
56 | + if (isset($_GET['date_range']) && array_key_exists($_GET['date_range'], $valid_ranges)) { |
|
57 | + return sanitize_key($_GET['date_range']); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | return '7_days'; |
@@ -68,22 +68,22 @@ discard block |
||
68 | 68 | public function get_periods() { |
69 | 69 | |
70 | 70 | $periods = array( |
71 | - 'today' => __( 'Today', 'invoicing' ), |
|
72 | - 'yesterday' => __( 'Yesterday', 'invoicing' ), |
|
73 | - 'week' => __( 'This week', 'invoicing' ), |
|
74 | - 'last_week' => __( 'Last week', 'invoicing' ), |
|
75 | - '7_days' => __( 'Last 7 days', 'invoicing' ), |
|
76 | - 'month' => __( 'This month', 'invoicing' ), |
|
77 | - 'last_month' => __( 'Last month', 'invoicing' ), |
|
78 | - '30_days' => __( 'Last 30 days', 'invoicing' ), |
|
79 | - 'quarter' => __( 'This Quarter', 'invoicing' ), |
|
80 | - 'last_quarter' => __( 'Last Quarter', 'invoicing' ), |
|
81 | - 'year' => __( 'This year', 'invoicing' ), |
|
82 | - 'last_year' => __( 'Last Year', 'invoicing' ), |
|
83 | - 'custom' => __( 'Custom Date Range', 'invoicing' ), |
|
71 | + 'today' => __('Today', 'invoicing'), |
|
72 | + 'yesterday' => __('Yesterday', 'invoicing'), |
|
73 | + 'week' => __('This week', 'invoicing'), |
|
74 | + 'last_week' => __('Last week', 'invoicing'), |
|
75 | + '7_days' => __('Last 7 days', 'invoicing'), |
|
76 | + 'month' => __('This month', 'invoicing'), |
|
77 | + 'last_month' => __('Last month', 'invoicing'), |
|
78 | + '30_days' => __('Last 30 days', 'invoicing'), |
|
79 | + 'quarter' => __('This Quarter', 'invoicing'), |
|
80 | + 'last_quarter' => __('Last Quarter', 'invoicing'), |
|
81 | + 'year' => __('This year', 'invoicing'), |
|
82 | + 'last_year' => __('Last Year', 'invoicing'), |
|
83 | + 'custom' => __('Custom Date Range', 'invoicing'), |
|
84 | 84 | ); |
85 | 85 | |
86 | - return apply_filters( 'getpaid_earning_periods', $periods ); |
|
86 | + return apply_filters('getpaid_earning_periods', $periods); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
@@ -96,21 +96,21 @@ discard block |
||
96 | 96 | ?> |
97 | 97 | |
98 | 98 | <form method="get" class="getpaid-filter-earnings float-right"> |
99 | - <?php getpaid_hidden_field( 'page', isset( $_GET['page'] ) ? sanitize_text_field( $_GET['page'] ) : 'wpinv-reports' ); ?> |
|
100 | - <?php getpaid_hidden_field( 'tab', 'reports' ); ?> |
|
99 | + <?php getpaid_hidden_field('page', isset($_GET['page']) ? sanitize_text_field($_GET['page']) : 'wpinv-reports'); ?> |
|
100 | + <?php getpaid_hidden_field('tab', 'reports'); ?> |
|
101 | 101 | <select name='date_range'> |
102 | - <?php foreach ( $this->get_periods() as $key => $label ) : ?> |
|
103 | - <option value="<?php echo esc_attr( $key ); ?>" <?php selected( $key, $range ); ?>><?php echo esc_html( $label ); ?></option> |
|
102 | + <?php foreach ($this->get_periods() as $key => $label) : ?> |
|
103 | + <option value="<?php echo esc_attr($key); ?>" <?php selected($key, $range); ?>><?php echo esc_html($label); ?></option> |
|
104 | 104 | <?php endforeach; ?> |
105 | 105 | </select> |
106 | 106 | <span class="getpaid-date-range-picker <?php echo 'custom' == $range ? '' : 'd-none'; ?>"> |
107 | 107 | <input type="text" name="from" class="getpaid-from align-middle" /> |
108 | - <?php esc_html_e( 'to', 'invoicing' ); ?> |
|
108 | + <?php esc_html_e('to', 'invoicing'); ?> |
|
109 | 109 | <input type="text" name="to" class="getpaid-to align-middle" /> |
110 | 110 | </span> |
111 | 111 | <button type="submit" class="button button-primary"> |
112 | 112 | <i class="fa fa-chevron-right fa-lg"></i> |
113 | - <span class="screen-reader-text"><?php esc_html_e( 'View Reports', 'invoicing' ); ?></span> |
|
113 | + <span class="screen-reader-text"><?php esc_html_e('View Reports', 'invoicing'); ?></span> |
|
114 | 114 | </button> |
115 | 115 | </form> |
116 | 116 | |
@@ -159,17 +159,17 @@ discard block |
||
159 | 159 | |
160 | 160 | <div class="col-12 col-md-4"> |
161 | 161 | <div class="row getpaid-report-cards"> |
162 | - <?php foreach ( $this->get_cards() as $key => $card ) : ?> |
|
162 | + <?php foreach ($this->get_cards() as $key => $card) : ?> |
|
163 | 163 | <div class="col-12 mb-4"> |
164 | 164 | |
165 | - <!-- <?php echo esc_html( $card['label'] ); ?> Card --> |
|
166 | - <div class="card p-0 m-0 shadow-none <?php echo esc_attr( $key ); ?>"> |
|
165 | + <!-- <?php echo esc_html($card['label']); ?> Card --> |
|
166 | + <div class="card p-0 m-0 shadow-none <?php echo esc_attr($key); ?>"> |
|
167 | 167 | |
168 | 168 | <div class="card-body"> |
169 | 169 | |
170 | 170 | <p class="getpaid-current text-uppercase small mb-2"> |
171 | - <strong><?php echo esc_html( $card['label'] ); ?></strong> |
|
172 | - <span title="<?php echo esc_attr( $card['description'] ); ?>" class="wpi-help-tip dashicons dashicons-editor-help text-muted" style="margin-top: -2px;"></span> |
|
171 | + <strong><?php echo esc_html($card['label']); ?></strong> |
|
172 | + <span title="<?php echo esc_attr($card['description']); ?>" class="wpi-help-tip dashicons dashicons-editor-help text-muted" style="margin-top: -2px;"></span> |
|
173 | 173 | </p> |
174 | 174 | <h5 class="font-weight-bold mb-0"> |
175 | 175 | <span class="getpaid-report-card-value"> |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | |
181 | 181 | <hr> |
182 | 182 | |
183 | - <p class="getpaid-previous text-uppercase text-muted small mb-2"><strong><?php esc_html_e( 'Previous Period', 'invoicing' ); ?></strong></p> |
|
183 | + <p class="getpaid-previous text-uppercase text-muted small mb-2"><strong><?php esc_html_e('Previous Period', 'invoicing'); ?></strong></p> |
|
184 | 184 | <h5 class="getpaid-report-card-previous-value font-weight-bold text-muted mb-0"> |
185 | 185 | <span class="spinner is-active float-none"></span> |
186 | 186 | </h5> |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | </div> |
189 | 189 | |
190 | 190 | </div> |
191 | - <!-- <?php echo esc_html( $card['label'] ); ?> Card --> |
|
191 | + <!-- <?php echo esc_html($card['label']); ?> Card --> |
|
192 | 192 | |
193 | 193 | </div> |
194 | 194 | <?php endforeach; ?> |
@@ -213,15 +213,15 @@ discard block |
||
213 | 213 | |
214 | 214 | ?> |
215 | 215 | |
216 | - <?php foreach ( $graphs as $key => $graph ) : ?> |
|
216 | + <?php foreach ($graphs as $key => $graph) : ?> |
|
217 | 217 | <div class="row mb-4"> |
218 | 218 | <div class="col-12"> |
219 | 219 | <div class="card m-0 p-0 single-report-card" style="max-width:100%"> |
220 | 220 | <div class="card-header"> |
221 | - <strong><?php echo esc_html( $graph ); ?></strong> |
|
221 | + <strong><?php echo esc_html($graph); ?></strong> |
|
222 | 222 | </div> |
223 | 223 | <div class="card-body"> |
224 | - <canvas id="getpaid-chartjs-<?php echo esc_attr( $key ); ?>"></canvas> |
|
224 | + <canvas id="getpaid-chartjs-<?php echo esc_attr($key); ?>"></canvas> |
|
225 | 225 | </div> |
226 | 226 | </div> |
227 | 227 | </div> |
@@ -236,14 +236,14 @@ discard block |
||
236 | 236 | * Retrieves the download url. |
237 | 237 | * |
238 | 238 | */ |
239 | - public function get_download_url( $graph, $file_type ) { |
|
239 | + public function get_download_url($graph, $file_type) { |
|
240 | 240 | |
241 | 241 | return wp_nonce_url( |
242 | 242 | add_query_arg( |
243 | 243 | array( |
244 | 244 | 'getpaid-admin-action' => 'download_graph', |
245 | - 'file_type' => urlencode( $file_type ), |
|
246 | - 'graph' => urlencode( $graph ), |
|
245 | + 'file_type' => urlencode($file_type), |
|
246 | + 'graph' => urlencode($graph), |
|
247 | 247 | ) |
248 | 248 | ), |
249 | 249 | 'getpaid-nonce', |
@@ -260,27 +260,27 @@ discard block |
||
260 | 260 | |
261 | 261 | ?> |
262 | 262 | |
263 | - <?php foreach ( $this->views as $key => $view ) : ?> |
|
263 | + <?php foreach ($this->views as $key => $view) : ?> |
|
264 | 264 | <div class="row mb-4"> |
265 | 265 | <div class="col-12"> |
266 | 266 | <div class="card m-0 p-0" style="max-width:100%"> |
267 | 267 | <div class="card-header"> |
268 | 268 | <div class="row"> |
269 | - <div class="<?php echo empty( $view['disable-downloads'] ) ? 'col-9' : 'col-12'; ?>"> |
|
270 | - <strong><?php echo esc_html( $view['label'] ); ?></strong> |
|
269 | + <div class="<?php echo empty($view['disable-downloads']) ? 'col-9' : 'col-12'; ?>"> |
|
270 | + <strong><?php echo esc_html($view['label']); ?></strong> |
|
271 | 271 | </div> |
272 | - <div class="<?php echo empty( $view['disable-downloads'] ) ? 'col-3' : 'd-none'; ?>"> |
|
273 | - <a title="<?php esc_attr_e( 'Download JSON', 'invoicing' ); ?>" href="<?php echo esc_url( $this->get_download_url( $key, 'json' ) ); ?>"> |
|
272 | + <div class="<?php echo empty($view['disable-downloads']) ? 'col-3' : 'd-none'; ?>"> |
|
273 | + <a title="<?php esc_attr_e('Download JSON', 'invoicing'); ?>" href="<?php echo esc_url($this->get_download_url($key, 'json')); ?>"> |
|
274 | 274 | <i class="fa fa-download text-dark" style="font-size: 16px" aria-hidden="true"></i> |
275 | - <span class="screen-reader-text"><?php esc_html_e( 'Download JSON', 'invoicing' ); ?></span> |
|
275 | + <span class="screen-reader-text"><?php esc_html_e('Download JSON', 'invoicing'); ?></span> |
|
276 | 276 | </a> |
277 | - <a title="<?php esc_attr_e( 'Download CSV', 'invoicing' ); ?>" href="<?php echo esc_url( $this->get_download_url( $key, 'csv' ) ); ?>"> |
|
277 | + <a title="<?php esc_attr_e('Download CSV', 'invoicing'); ?>" href="<?php echo esc_url($this->get_download_url($key, 'csv')); ?>"> |
|
278 | 278 | <i class="fa fa-file-csv text-dark" style="font-size: 16px" aria-hidden="true"></i> |
279 | - <span class="screen-reader-text"><?php esc_html_e( 'Download CSV', 'invoicing' ); ?></span> |
|
279 | + <span class="screen-reader-text"><?php esc_html_e('Download CSV', 'invoicing'); ?></span> |
|
280 | 280 | </a> |
281 | - <a title="<?php esc_attr_e( 'Download XML', 'invoicing' ); ?>" href="<?php echo esc_url( $this->get_download_url( $key, 'xml' ) ); ?>"> |
|
281 | + <a title="<?php esc_attr_e('Download XML', 'invoicing'); ?>" href="<?php echo esc_url($this->get_download_url($key, 'xml')); ?>"> |
|
282 | 282 | <i class="fa fa-file-code text-dark" style="font-size: 16px" aria-hidden="true"></i> |
283 | - <span class="screen-reader-text"><?php esc_html_e( 'Download XML', 'invoicing' ); ?></span> |
|
283 | + <span class="screen-reader-text"><?php esc_html_e('Download XML', 'invoicing'); ?></span> |
|
284 | 284 | </a> |
285 | 285 | </div> |
286 | 286 | </div> |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | |
300 | 300 | <?php |
301 | 301 | |
302 | - do_action( 'getpaid_reports_display_right', $this ); |
|
302 | + do_action('getpaid_reports_display_right', $this); |
|
303 | 303 | } |
304 | 304 | |
305 | 305 | /** |
@@ -310,56 +310,56 @@ discard block |
||
310 | 310 | |
311 | 311 | $cards = array( |
312 | 312 | 'total_sales' => array( |
313 | - 'description' => __( 'Gross sales in the period.', 'invoicing' ), |
|
314 | - 'label' => __( 'Gross Revenue', 'invoicing' ), |
|
313 | + 'description' => __('Gross sales in the period.', 'invoicing'), |
|
314 | + 'label' => __('Gross Revenue', 'invoicing'), |
|
315 | 315 | ), |
316 | 316 | 'net_sales' => array( |
317 | - 'description' => __( 'Net sales in the period.', 'invoicing' ), |
|
318 | - 'label' => __( 'Net Revenue', 'invoicing' ), |
|
317 | + 'description' => __('Net sales in the period.', 'invoicing'), |
|
318 | + 'label' => __('Net Revenue', 'invoicing'), |
|
319 | 319 | ), |
320 | 320 | 'average_sales' => array( |
321 | - 'description' => __( 'Average net daily/monthly sales.', 'invoicing' ), |
|
322 | - 'label' => __( 'Avg. Net Sales', 'invoicing' ), |
|
321 | + 'description' => __('Average net daily/monthly sales.', 'invoicing'), |
|
322 | + 'label' => __('Avg. Net Sales', 'invoicing'), |
|
323 | 323 | ), |
324 | 324 | 'average_total_sales' => array( |
325 | - 'description' => __( 'Average gross daily/monthly sales.', 'invoicing' ), |
|
326 | - 'label' => __( 'Avg. Gross Sales', 'invoicing' ), |
|
325 | + 'description' => __('Average gross daily/monthly sales.', 'invoicing'), |
|
326 | + 'label' => __('Avg. Gross Sales', 'invoicing'), |
|
327 | 327 | ), |
328 | 328 | 'total_invoices' => array( |
329 | - 'description' => __( 'Number of paid invoices.', 'invoicing' ), |
|
330 | - 'label' => __( 'Paid Invoices', 'invoicing' ), |
|
329 | + 'description' => __('Number of paid invoices.', 'invoicing'), |
|
330 | + 'label' => __('Paid Invoices', 'invoicing'), |
|
331 | 331 | ), |
332 | 332 | 'total_items' => array( |
333 | - 'description' => __( 'Number of items purchased.', 'invoicing' ), |
|
334 | - 'label' => __( 'Purchased Items', 'invoicing' ), |
|
333 | + 'description' => __('Number of items purchased.', 'invoicing'), |
|
334 | + 'label' => __('Purchased Items', 'invoicing'), |
|
335 | 335 | ), |
336 | 336 | 'refunded_items' => array( |
337 | - 'description' => __( 'Number of items refunded.', 'invoicing' ), |
|
338 | - 'label' => __( 'Refunded Items', 'invoicing' ), |
|
337 | + 'description' => __('Number of items refunded.', 'invoicing'), |
|
338 | + 'label' => __('Refunded Items', 'invoicing'), |
|
339 | 339 | ), |
340 | 340 | 'total_tax' => array( |
341 | - 'description' => __( 'Total charged for taxes.', 'invoicing' ), |
|
342 | - 'label' => __( 'Tax', 'invoicing' ), |
|
341 | + 'description' => __('Total charged for taxes.', 'invoicing'), |
|
342 | + 'label' => __('Tax', 'invoicing'), |
|
343 | 343 | ), |
344 | 344 | 'total_refunded_tax' => array( |
345 | - 'description' => __( 'Total refunded for taxes.', 'invoicing' ), |
|
346 | - 'label' => __( 'Refunded Tax', 'invoicing' ), |
|
345 | + 'description' => __('Total refunded for taxes.', 'invoicing'), |
|
346 | + 'label' => __('Refunded Tax', 'invoicing'), |
|
347 | 347 | ), |
348 | 348 | 'total_fees' => array( |
349 | - 'description' => __( 'Total fees charged.', 'invoicing' ), |
|
350 | - 'label' => __( 'Fees', 'invoicing' ), |
|
349 | + 'description' => __('Total fees charged.', 'invoicing'), |
|
350 | + 'label' => __('Fees', 'invoicing'), |
|
351 | 351 | ), |
352 | 352 | 'total_refunds' => array( |
353 | - 'description' => __( 'Total of refunded invoices.', 'invoicing' ), |
|
354 | - 'label' => __( 'Refunded', 'invoicing' ), |
|
353 | + 'description' => __('Total of refunded invoices.', 'invoicing'), |
|
354 | + 'label' => __('Refunded', 'invoicing'), |
|
355 | 355 | ), |
356 | 356 | 'total_discount' => array( |
357 | - 'description' => __( 'Total of discounts used.', 'invoicing' ), |
|
358 | - 'label' => __( 'Discounted', 'invoicing' ), |
|
357 | + 'description' => __('Total of discounts used.', 'invoicing'), |
|
358 | + 'label' => __('Discounted', 'invoicing'), |
|
359 | 359 | ), |
360 | 360 | ); |
361 | 361 | |
362 | - return apply_filters( 'wpinv_report_cards', $cards ); |
|
362 | + return apply_filters('wpinv_report_cards', $cards); |
|
363 | 363 | } |
364 | 364 | |
365 | 365 |