@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | * |
8 | 8 | */ |
9 | 9 | |
10 | -if ( ! defined( 'ABSPATH' ) ) { |
|
10 | +if (!defined('ABSPATH')) { |
|
11 | 11 | exit; // Exit if accessed directly |
12 | 12 | } |
13 | 13 | |
@@ -21,54 +21,54 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @param WP_Post $post |
23 | 23 | */ |
24 | - public static function output( $post ) { |
|
24 | + public static function output($post) { |
|
25 | 25 | |
26 | 26 | // Prepare the form. |
27 | - $form = new GetPaid_Payment_Form( $post ); |
|
27 | + $form = new GetPaid_Payment_Form($post); |
|
28 | 28 | |
29 | 29 | ?> |
30 | 30 | |
31 | 31 | <div class='bsui' style='padding-top: 10px;'> |
32 | - <?php do_action( 'wpinv_payment_form_before_info_metabox', $form ); ?> |
|
32 | + <?php do_action('wpinv_payment_form_before_info_metabox', $form); ?> |
|
33 | 33 | |
34 | 34 | <div class="wpinv_payment_form_shortcode form-group row"> |
35 | 35 | <label for="wpinv_payment_form_shortcode" class="col-sm-12 col-form-label"> |
36 | - <?php _e( 'Payment Form Shortcode', 'invoicing' );?> |
|
37 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Displays a payment form', 'invoicing' ); ?>"></span> |
|
36 | + <?php _e('Payment Form Shortcode', 'invoicing'); ?> |
|
37 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Displays a payment form', 'invoicing'); ?>"></span> |
|
38 | 38 | </label> |
39 | 39 | |
40 | 40 | <div class="col-sm-12"> |
41 | - <input onClick="this.select()" type="text" id="wpinv_payment_form_shortcode" value="[getpaid form=<?php echo esc_attr( $form->get_id() ); ?>]" style="width: 100%;" /> |
|
41 | + <input onClick="this.select()" type="text" id="wpinv_payment_form_shortcode" value="[getpaid form=<?php echo esc_attr($form->get_id()); ?>]" style="width: 100%;" /> |
|
42 | 42 | </div> |
43 | 43 | </div> |
44 | 44 | |
45 | 45 | <div class="wpinv_payment_form_buy_shortcode form-group row"> |
46 | 46 | <label for="wpinv_payment_form_buy_shortcode" class="col-sm-12 col-form-label"> |
47 | - <?php _e( 'Payment Button Shortcode', 'invoicing' );?> |
|
48 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Displays a buy now button', 'invoicing' ); ?>"></span> |
|
47 | + <?php _e('Payment Button Shortcode', 'invoicing'); ?> |
|
48 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Displays a buy now button', 'invoicing'); ?>"></span> |
|
49 | 49 | </label> |
50 | 50 | |
51 | 51 | <div class="col-sm-12"> |
52 | - <input onClick="this.select()" type="text" id="wpinv_payment_form_buy_shortcode" value="[getpaid form=<?php echo esc_attr( $form->get_id() ); ?> button='Buy Now']" style="width: 100%;" /> |
|
52 | + <input onClick="this.select()" type="text" id="wpinv_payment_form_buy_shortcode" value="[getpaid form=<?php echo esc_attr($form->get_id()); ?> button='Buy Now']" style="width: 100%;" /> |
|
53 | 53 | <small class="form-text text-muted"> |
54 | - <?php _e( 'Or use the following URL in a link:', 'invoicing' );?> |
|
55 | - <code>#getpaid-form-<?php echo intval( $form->get_id() ); ?></code> |
|
54 | + <?php _e('Or use the following URL in a link:', 'invoicing'); ?> |
|
55 | + <code>#getpaid-form-<?php echo intval($form->get_id()); ?></code> |
|
56 | 56 | </small> |
57 | 57 | </div> |
58 | 58 | </div> |
59 | 59 | |
60 | 60 | <div class="wpinv_item_buy_url form-group row"> |
61 | 61 | <label for="wpinv_item_buy_url" class="col-sm-12 col-form-label"> |
62 | - <?php _e( 'Direct Payment URL', 'invoicing' );?> |
|
63 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'You can use this in an iFrame to embed the payment form on another website', 'invoicing' ); ?>"></span> |
|
62 | + <?php _e('Direct Payment URL', 'invoicing'); ?> |
|
63 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('You can use this in an iFrame to embed the payment form on another website', 'invoicing'); ?>"></span> |
|
64 | 64 | </label> |
65 | 65 | |
66 | 66 | <div class="col-sm-12"> |
67 | - <input onClick="this.select()" type="text" id="wpinv_item_buy_url" value="<?php echo esc_url( getpaid_embed_url( $form->get_id(), false ) ); ?>" style="width: 100%;" readonly/> |
|
67 | + <input onClick="this.select()" type="text" id="wpinv_item_buy_url" value="<?php echo esc_url(getpaid_embed_url($form->get_id(), false)); ?>" style="width: 100%;" readonly/> |
|
68 | 68 | </div> |
69 | 69 | </div> |
70 | 70 | |
71 | - <?php do_action( 'wpinv_payment_form_info_metabox', $form ); ?> |
|
71 | + <?php do_action('wpinv_payment_form_info_metabox', $form); ?> |
|
72 | 72 | </div> |
73 | 73 | <?php |
74 | 74 |
@@ -7,64 +7,64 @@ discard block |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | // Fetch the invoice. |
13 | -$invoice = new WPInv_Invoice( $invoice ); |
|
13 | +$invoice = new WPInv_Invoice($invoice); |
|
14 | 14 | |
15 | 15 | // @deprecated |
16 | -do_action( 'wpinv_success_content_before', $invoice ); |
|
17 | -do_action( 'wpinv_before_receipt', $invoice ); |
|
16 | +do_action('wpinv_success_content_before', $invoice); |
|
17 | +do_action('wpinv_before_receipt', $invoice); |
|
18 | 18 | |
19 | 19 | wpinv_print_errors(); |
20 | 20 | |
21 | 21 | // Prepare header text. |
22 | -if ( $invoice->is_paid() ) { |
|
22 | +if ($invoice->is_paid()) { |
|
23 | 23 | |
24 | 24 | $alert = aui()->alert( |
25 | 25 | array( |
26 | 26 | 'type' => 'success', |
27 | - 'content' => __( 'Thank you for your payment!', 'invoicing' ), |
|
27 | + 'content' => __('Thank you for your payment!', 'invoicing'), |
|
28 | 28 | ) |
29 | 29 | ); |
30 | 30 | |
31 | -} else if ( $invoice->is_refunded() ) { |
|
31 | +} else if ($invoice->is_refunded()) { |
|
32 | 32 | |
33 | 33 | $alert = aui()->alert( |
34 | 34 | array( |
35 | 35 | 'type' => 'info', |
36 | - 'content' => __( 'This invoice was refunded.', 'invoicing' ), |
|
36 | + 'content' => __('This invoice was refunded.', 'invoicing'), |
|
37 | 37 | ) |
38 | 38 | ); |
39 | 39 | |
40 | -} else if ( $invoice->is_held() ) { |
|
40 | +} else if ($invoice->is_held()) { |
|
41 | 41 | |
42 | 42 | $alert = aui()->alert( |
43 | 43 | array( |
44 | 44 | 'type' => 'info', |
45 | - 'content' => __( 'This invoice will be processed as soon we verify your payment.', 'invoicing' ), |
|
45 | + 'content' => __('This invoice will be processed as soon we verify your payment.', 'invoicing'), |
|
46 | 46 | ) |
47 | 47 | ); |
48 | 48 | |
49 | -} else if ( $invoice->needs_payment() ) { |
|
49 | +} else if ($invoice->needs_payment()) { |
|
50 | 50 | |
51 | - if ( ! empty( $_GET['token'] ) ) { |
|
51 | + if (!empty($_GET['token'])) { |
|
52 | 52 | |
53 | 53 | $alert = aui()->alert( |
54 | 54 | array( |
55 | 55 | 'type' => 'info', |
56 | - 'content' => __( "Sometimes it takes a few minutes for us to verify your payment. We'll notify you as soon as we've verified the payment.", 'invoicing' ), |
|
56 | + 'content' => __("Sometimes it takes a few minutes for us to verify your payment. We'll notify you as soon as we've verified the payment.", 'invoicing'), |
|
57 | 57 | ) |
58 | 58 | ); |
59 | 59 | |
60 | - } else if ( $invoice->is_due() ) { |
|
60 | + } else if ($invoice->is_due()) { |
|
61 | 61 | |
62 | 62 | $alert = aui()->alert( |
63 | 63 | array( |
64 | 64 | 'type' => 'danger', |
65 | 65 | 'content' => sprintf( |
66 | - __( 'This invoice was due on %.', 'invoicing' ), |
|
67 | - getpaid_format_date_value( $invoice->get_due_date() ) |
|
66 | + __('This invoice was due on %.', 'invoicing'), |
|
67 | + getpaid_format_date_value($invoice->get_due_date()) |
|
68 | 68 | ), |
69 | 69 | ) |
70 | 70 | ); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | $alert = aui()->alert( |
75 | 75 | array( |
76 | 76 | 'type' => 'warning', |
77 | - 'content' => __( 'This invoice needs payment.', 'invoicing' ), |
|
77 | + 'content' => __('This invoice needs payment.', 'invoicing'), |
|
78 | 78 | ) |
79 | 79 | ); |
80 | 80 | |
@@ -89,19 +89,19 @@ discard block |
||
89 | 89 | |
90 | 90 | 'pay' => array( |
91 | 91 | 'url' => $invoice->get_checkout_payment_url(), |
92 | - 'name' => __( 'Pay For Invoice', 'invoicing' ), |
|
92 | + 'name' => __('Pay For Invoice', 'invoicing'), |
|
93 | 93 | 'class' => 'btn-success', |
94 | 94 | ), |
95 | 95 | |
96 | 96 | 'view' => array( |
97 | 97 | 'url' => $invoice->get_view_url(), |
98 | - 'name' => __( 'View Invoice', 'invoicing' ), |
|
98 | + 'name' => __('View Invoice', 'invoicing'), |
|
99 | 99 | 'class' => 'btn-primary', |
100 | 100 | ), |
101 | 101 | |
102 | 102 | 'history' => array( |
103 | 103 | 'url' => wpinv_get_history_page_uri(), |
104 | - 'name' => __( 'Invoice History', 'invoicing' ), |
|
104 | + 'name' => __('Invoice History', 'invoicing'), |
|
105 | 105 | 'class' => 'btn-warning', |
106 | 106 | ), |
107 | 107 | |
@@ -110,12 +110,12 @@ discard block |
||
110 | 110 | |
111 | 111 | ); |
112 | 112 | |
113 | -if ( ( ! $invoice->needs_payment() || $invoice->is_held() ) && isset( $actions['pay'] ) ) { |
|
114 | - unset( $actions['pay'] ); |
|
113 | +if ((!$invoice->needs_payment() || $invoice->is_held()) && isset($actions['pay'])) { |
|
114 | + unset($actions['pay']); |
|
115 | 115 | } |
116 | 116 | |
117 | -if ( ! is_user_logged_in() && isset( $actions['history'] ) ) { |
|
118 | - unset( $actions['history'] ); |
|
117 | +if (!is_user_logged_in() && isset($actions['history'])) { |
|
118 | + unset($actions['history']); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | ?> |
@@ -124,19 +124,19 @@ discard block |
||
124 | 124 | |
125 | 125 | <?php |
126 | 126 | |
127 | - do_action( 'wpinv_receipt_start', $invoice ); |
|
127 | + do_action('wpinv_receipt_start', $invoice); |
|
128 | 128 | |
129 | - if ( ! empty( $actions ) ) { |
|
129 | + if (!empty($actions)) { |
|
130 | 130 | |
131 | 131 | echo '<div class="wpinv-receipt-actions text-right mt-1 mb-4">'; |
132 | 132 | |
133 | - foreach ( $actions as $key => $action ) { |
|
133 | + foreach ($actions as $key => $action) { |
|
134 | 134 | |
135 | - $key = sanitize_html_class( $key ); |
|
136 | - $class = empty( $action['class'] ) ? 'btn-dark' : sanitize_html_class( $action['class'] ); |
|
137 | - $url = empty( $action['url'] ) ? '#' : esc_url( $action['url'] ); |
|
138 | - $attrs = empty( $action['attrs'] ) ? '' : $action['attrs']; |
|
139 | - $anchor = esc_html( $action['name'] ); |
|
135 | + $key = sanitize_html_class($key); |
|
136 | + $class = empty($action['class']) ? 'btn-dark' : sanitize_html_class($action['class']); |
|
137 | + $url = empty($action['url']) ? '#' : esc_url($action['url']); |
|
138 | + $attrs = empty($action['attrs']) ? '' : $action['attrs']; |
|
139 | + $anchor = esc_html($action['name']); |
|
140 | 140 | |
141 | 141 | echo "<a href='$url' class='btn btn-sm ml-1 $class $key' $attrs>$anchor</a>"; |
142 | 142 | } |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | |
146 | 146 | } |
147 | 147 | |
148 | - if ( ! empty( $alert ) ) { |
|
148 | + if (!empty($alert)) { |
|
149 | 149 | echo $alert; |
150 | 150 | } |
151 | 151 | |
@@ -154,19 +154,19 @@ discard block |
||
154 | 154 | <div class="wpinv-receipt-details"> |
155 | 155 | |
156 | 156 | <h4 class="wpinv-details-t mb-3 mt-3"> |
157 | - <?php echo apply_filters( 'wpinv_receipt_details_title', __( 'Invoice Details', 'invoicing' ), $invoice ); ?> |
|
157 | + <?php echo apply_filters('wpinv_receipt_details_title', __('Invoice Details', 'invoicing'), $invoice); ?> |
|
158 | 158 | </h4> |
159 | 159 | |
160 | - <?php getpaid_invoice_meta( $invoice ); ?> |
|
160 | + <?php getpaid_invoice_meta($invoice); ?> |
|
161 | 161 | |
162 | 162 | </div> |
163 | 163 | |
164 | - <?php do_action( 'wpinv_receipt_end', $invoice ); ?> |
|
164 | + <?php do_action('wpinv_receipt_end', $invoice); ?> |
|
165 | 165 | |
166 | 166 | </div> |
167 | 167 | |
168 | 168 | <?php |
169 | 169 | |
170 | 170 | // @deprecated |
171 | -do_action( 'wpinv_success_content_after', $invoice ); |
|
172 | -do_action( 'wpinv_after_receipt', $invoice ); |
|
171 | +do_action('wpinv_success_content_after', $invoice); |
|
172 | +do_action('wpinv_after_receipt', $invoice); |
@@ -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 | * Bank transfer Payment Gateway class. |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | * |
25 | 25 | * @var array |
26 | 26 | */ |
27 | - protected $supports = array( 'subscription', 'addons', 'single_subscription_group', 'multiple_subscription_groups' ); |
|
27 | + protected $supports = array('subscription', 'addons', 'single_subscription_group', 'multiple_subscription_groups'); |
|
28 | 28 | |
29 | 29 | /** |
30 | 30 | * Payment method order. |
@@ -39,17 +39,17 @@ discard block |
||
39 | 39 | public function __construct() { |
40 | 40 | parent::__construct(); |
41 | 41 | |
42 | - $this->title = __( 'Direct bank transfer', 'invoicing' ); |
|
43 | - $this->method_title = __( 'Bank transfer', 'invoicing' ); |
|
44 | - $this->checkout_button_text = __( 'Proceed', 'invoicing' ); |
|
45 | - $this->instructions = apply_filters( 'wpinv_bank_instructions', $this->get_option( 'info' ) ); |
|
42 | + $this->title = __('Direct bank transfer', 'invoicing'); |
|
43 | + $this->method_title = __('Bank transfer', 'invoicing'); |
|
44 | + $this->checkout_button_text = __('Proceed', 'invoicing'); |
|
45 | + $this->instructions = apply_filters('wpinv_bank_instructions', $this->get_option('info')); |
|
46 | 46 | |
47 | - add_action( 'wpinv_receipt_end', array( $this, 'thankyou_page' ) ); |
|
48 | - add_action( 'getpaid_invoice_line_items', array( $this, 'thankyou_page' ), 40 ); |
|
49 | - add_action( 'wpinv_pdf_content_billing', array( $this, 'thankyou_page' ), 11 ); |
|
50 | - add_action( 'wpinv_email_invoice_details', array( $this, 'email_instructions' ), 10, 3 ); |
|
51 | - add_action( 'getpaid_should_renew_subscription', array( $this, 'maybe_renew_subscription' ) ); |
|
52 | - add_action( 'getpaid_invoice_status_publish', array( $this, 'invoice_paid' ), 20 ); |
|
47 | + add_action('wpinv_receipt_end', array($this, 'thankyou_page')); |
|
48 | + add_action('getpaid_invoice_line_items', array($this, 'thankyou_page'), 40); |
|
49 | + add_action('wpinv_pdf_content_billing', array($this, 'thankyou_page'), 11); |
|
50 | + add_action('wpinv_email_invoice_details', array($this, 'email_instructions'), 10, 3); |
|
51 | + add_action('getpaid_should_renew_subscription', array($this, 'maybe_renew_subscription')); |
|
52 | + add_action('getpaid_invoice_status_publish', array($this, 'invoice_paid'), 20); |
|
53 | 53 | |
54 | 54 | } |
55 | 55 | |
@@ -61,23 +61,23 @@ discard block |
||
61 | 61 | * @param GetPaid_Payment_Form_Submission $submission Checkout submission. |
62 | 62 | * @return array |
63 | 63 | */ |
64 | - public function process_payment( $invoice, $submission_data, $submission ) { |
|
64 | + public function process_payment($invoice, $submission_data, $submission) { |
|
65 | 65 | |
66 | 66 | // Add a transaction id. |
67 | - $invoice->set_transaction_id( $invoice->generate_key('bt_') ); |
|
67 | + $invoice->set_transaction_id($invoice->generate_key('bt_')); |
|
68 | 68 | |
69 | 69 | // Set it as pending payment. |
70 | - if ( ! $invoice->needs_payment() ) { |
|
70 | + if (!$invoice->needs_payment()) { |
|
71 | 71 | $invoice->mark_paid(); |
72 | - } else if ( ! $invoice->is_paid() ) { |
|
73 | - $invoice->set_status( 'wpi-onhold' ); |
|
72 | + } else if (!$invoice->is_paid()) { |
|
73 | + $invoice->set_status('wpi-onhold'); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | // Save it. |
77 | 77 | $invoice->save(); |
78 | 78 | |
79 | 79 | // Send to the success page. |
80 | - wpinv_send_to_success_page( array( 'invoice_key' => $invoice->get_key() ) ); |
|
80 | + wpinv_send_to_success_page(array('invoice_key' => $invoice->get_key())); |
|
81 | 81 | |
82 | 82 | } |
83 | 83 | |
@@ -86,17 +86,17 @@ discard block |
||
86 | 86 | * |
87 | 87 | * @param WPInv_Invoice $invoice Invoice. |
88 | 88 | */ |
89 | - public function thankyou_page( $invoice ) { |
|
89 | + public function thankyou_page($invoice) { |
|
90 | 90 | |
91 | - if ( 'bank_transfer' === $invoice->get_gateway() && $invoice->needs_payment() ) { |
|
91 | + if ('bank_transfer' === $invoice->get_gateway() && $invoice->needs_payment()) { |
|
92 | 92 | |
93 | 93 | echo '<div class="mt-4 mb-2 getpaid-bank-transfer-details">' . PHP_EOL; |
94 | 94 | |
95 | - if ( ! empty( $this->instructions ) ) { |
|
96 | - echo wp_kses_post( wpautop( wptexturize( $this->instructions ) ) ); |
|
95 | + if (!empty($this->instructions)) { |
|
96 | + echo wp_kses_post(wpautop(wptexturize($this->instructions))); |
|
97 | 97 | } |
98 | 98 | |
99 | - $this->bank_details( $invoice ); |
|
99 | + $this->bank_details($invoice); |
|
100 | 100 | |
101 | 101 | echo '</div>'; |
102 | 102 | |
@@ -111,17 +111,17 @@ discard block |
||
111 | 111 | * @param string $email_type Email format: plain text or HTML. |
112 | 112 | * @param bool $sent_to_admin Sent to admin. |
113 | 113 | */ |
114 | - public function email_instructions( $invoice, $email_type, $sent_to_admin ) { |
|
114 | + public function email_instructions($invoice, $email_type, $sent_to_admin) { |
|
115 | 115 | |
116 | - if ( ! $sent_to_admin && 'bank_transfer' === $invoice->get_gateway() && $invoice->needs_payment() ) { |
|
116 | + if (!$sent_to_admin && 'bank_transfer' === $invoice->get_gateway() && $invoice->needs_payment()) { |
|
117 | 117 | |
118 | 118 | echo '<div class="wpi-email-row getpaid-bank-transfer-details">'; |
119 | 119 | |
120 | - if ( $this->instructions ) { |
|
121 | - echo wp_kses_post( wpautop( wptexturize( $this->instructions ) ) . PHP_EOL ); |
|
120 | + if ($this->instructions) { |
|
121 | + echo wp_kses_post(wpautop(wptexturize($this->instructions)) . PHP_EOL); |
|
122 | 122 | } |
123 | 123 | |
124 | - $this->bank_details( $invoice ); |
|
124 | + $this->bank_details($invoice); |
|
125 | 125 | |
126 | 126 | echo '</div>'; |
127 | 127 | |
@@ -134,51 +134,51 @@ discard block |
||
134 | 134 | * |
135 | 135 | * @param WPInv_Invoice $invoice Invoice. |
136 | 136 | */ |
137 | - protected function bank_details( $invoice ) { |
|
137 | + protected function bank_details($invoice) { |
|
138 | 138 | |
139 | 139 | // Get the invoice country and country $locale. |
140 | 140 | $country = $invoice->get_country(); |
141 | 141 | $locale = $this->get_country_locale(); |
142 | 142 | |
143 | 143 | // Get sortcode label in the $locale array and use appropriate one. |
144 | - $sortcode = isset( $locale[ $country ]['sortcode']['label'] ) ? $locale[ $country ]['sortcode']['label'] : __( 'Sort code', 'invoicing' ); |
|
144 | + $sortcode = isset($locale[$country]['sortcode']['label']) ? $locale[$country]['sortcode']['label'] : __('Sort code', 'invoicing'); |
|
145 | 145 | |
146 | 146 | $bank_fields = array( |
147 | - 'ac_name' => __( 'Account Name', 'invoicing' ), |
|
148 | - 'ac_no' => __( 'Account Number', 'invoicing' ), |
|
149 | - 'bank_name' => __( 'Bank Name', 'invoicing' ), |
|
150 | - 'ifsc' => __( 'IFSC code', 'invoicing' ), |
|
151 | - 'iban' => __( 'IBAN', 'invoicing' ), |
|
152 | - 'bic' => __( 'BIC/Swift code', 'invoicing' ), |
|
147 | + 'ac_name' => __('Account Name', 'invoicing'), |
|
148 | + 'ac_no' => __('Account Number', 'invoicing'), |
|
149 | + 'bank_name' => __('Bank Name', 'invoicing'), |
|
150 | + 'ifsc' => __('IFSC code', 'invoicing'), |
|
151 | + 'iban' => __('IBAN', 'invoicing'), |
|
152 | + 'bic' => __('BIC/Swift code', 'invoicing'), |
|
153 | 153 | 'sort_code' => $sortcode, |
154 | 154 | ); |
155 | 155 | |
156 | 156 | $bank_info = array(); |
157 | 157 | |
158 | - foreach ( $bank_fields as $field => $label ) { |
|
159 | - $value = $this->get_option( $field ); |
|
158 | + foreach ($bank_fields as $field => $label) { |
|
159 | + $value = $this->get_option($field); |
|
160 | 160 | |
161 | - if ( ! empty( $value ) ) { |
|
162 | - $bank_info[$field] = array( 'label' => $label, 'value' => $value ); |
|
161 | + if (!empty($value)) { |
|
162 | + $bank_info[$field] = array('label' => $label, 'value' => $value); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | } |
166 | 166 | |
167 | - $bank_info = apply_filters( 'wpinv_bank_info', $bank_info ); |
|
167 | + $bank_info = apply_filters('wpinv_bank_info', $bank_info); |
|
168 | 168 | |
169 | - if ( empty( $bank_info ) ) { |
|
169 | + if (empty($bank_info)) { |
|
170 | 170 | return; |
171 | 171 | } |
172 | 172 | |
173 | - echo '<h3 class="getpaid-bank-transfer-title"> ' . apply_filters( 'wpinv_receipt_bank_details_title', __( 'Bank Details', 'invoicing' ) ) . '</h3>' . PHP_EOL; |
|
173 | + echo '<h3 class="getpaid-bank-transfer-title"> ' . apply_filters('wpinv_receipt_bank_details_title', __('Bank Details', 'invoicing')) . '</h3>' . PHP_EOL; |
|
174 | 174 | |
175 | 175 | echo '<table class="table table-bordered getpaid-bank-transfer-details">' . PHP_EOL; |
176 | 176 | |
177 | - foreach ( $bank_info as $key => $data ) { |
|
177 | + foreach ($bank_info as $key => $data) { |
|
178 | 178 | |
179 | - $key = sanitize_html_class( $key ); |
|
180 | - $label = wp_kses_post( $data['label'] ); |
|
181 | - $value = wp_kses_post( wptexturize( $data['value'] ) ); |
|
179 | + $key = sanitize_html_class($key); |
|
180 | + $label = wp_kses_post($data['label']); |
|
181 | + $value = wp_kses_post(wptexturize($data['value'])); |
|
182 | 182 | |
183 | 183 | echo "<tr class='getpaid-bank-transfer-$key'><th class='font-weight-bold'>$label</th><td class='w-75'>$value</td></tr>" . PHP_EOL; |
184 | 184 | } |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | */ |
195 | 195 | public function get_country_locale() { |
196 | 196 | |
197 | - if ( empty( $this->locale ) ) { |
|
197 | + if (empty($this->locale)) { |
|
198 | 198 | |
199 | 199 | // Locale information to be used - only those that are not 'Sort Code'. |
200 | 200 | $this->locale = apply_filters( |
@@ -202,42 +202,42 @@ discard block |
||
202 | 202 | array( |
203 | 203 | 'AU' => array( |
204 | 204 | 'sortcode' => array( |
205 | - 'label' => __( 'BSB', 'invoicing' ), |
|
205 | + 'label' => __('BSB', 'invoicing'), |
|
206 | 206 | ), |
207 | 207 | ), |
208 | 208 | 'CA' => array( |
209 | 209 | 'sortcode' => array( |
210 | - 'label' => __( 'Bank transit number', 'invoicing' ), |
|
210 | + 'label' => __('Bank transit number', 'invoicing'), |
|
211 | 211 | ), |
212 | 212 | ), |
213 | 213 | 'IN' => array( |
214 | 214 | 'sortcode' => array( |
215 | - 'label' => __( 'IFSC', 'invoicing' ), |
|
215 | + 'label' => __('IFSC', 'invoicing'), |
|
216 | 216 | ), |
217 | 217 | ), |
218 | 218 | 'IT' => array( |
219 | 219 | 'sortcode' => array( |
220 | - 'label' => __( 'Branch sort', 'invoicing' ), |
|
220 | + 'label' => __('Branch sort', 'invoicing'), |
|
221 | 221 | ), |
222 | 222 | ), |
223 | 223 | 'NZ' => array( |
224 | 224 | 'sortcode' => array( |
225 | - 'label' => __( 'Bank code', 'invoicing' ), |
|
225 | + 'label' => __('Bank code', 'invoicing'), |
|
226 | 226 | ), |
227 | 227 | ), |
228 | 228 | 'SE' => array( |
229 | 229 | 'sortcode' => array( |
230 | - 'label' => __( 'Bank code', 'invoicing' ), |
|
230 | + 'label' => __('Bank code', 'invoicing'), |
|
231 | 231 | ), |
232 | 232 | ), |
233 | 233 | 'US' => array( |
234 | 234 | 'sortcode' => array( |
235 | - 'label' => __( 'Routing number', 'invoicing' ), |
|
235 | + 'label' => __('Routing number', 'invoicing'), |
|
236 | 236 | ), |
237 | 237 | ), |
238 | 238 | 'ZA' => array( |
239 | 239 | 'sortcode' => array( |
240 | - 'label' => __( 'Branch code', 'invoicing' ), |
|
240 | + 'label' => __('Branch code', 'invoicing'), |
|
241 | 241 | ), |
242 | 242 | ), |
243 | 243 | ) |
@@ -254,51 +254,51 @@ discard block |
||
254 | 254 | * |
255 | 255 | * @param array $admin_settings |
256 | 256 | */ |
257 | - public function admin_settings( $admin_settings ) { |
|
257 | + public function admin_settings($admin_settings) { |
|
258 | 258 | |
259 | - $admin_settings['bank_transfer_desc']['std'] = __( "Make your payment directly into our bank account. Please use your Invoice Number as the payment reference. Your invoice won't be processed until the funds have cleared in our account.", 'invoicing' ); |
|
260 | - $admin_settings['bank_transfer_active']['desc'] = __( 'Enable bank transfer', 'invoicing' ); |
|
259 | + $admin_settings['bank_transfer_desc']['std'] = __("Make your payment directly into our bank account. Please use your Invoice Number as the payment reference. Your invoice won't be processed until the funds have cleared in our account.", 'invoicing'); |
|
260 | + $admin_settings['bank_transfer_active']['desc'] = __('Enable bank transfer', 'invoicing'); |
|
261 | 261 | |
262 | - $locale = $this->get_country_locale(); |
|
262 | + $locale = $this->get_country_locale(); |
|
263 | 263 | |
264 | 264 | // Get sortcode label in the $locale array and use appropriate one. |
265 | 265 | $country = wpinv_default_billing_country(); |
266 | - $sortcode = isset( $locale[ $country ]['sortcode']['label'] ) ? $locale[ $country ]['sortcode']['label'] : __( 'Sort code', 'invoicing' ); |
|
266 | + $sortcode = isset($locale[$country]['sortcode']['label']) ? $locale[$country]['sortcode']['label'] : __('Sort code', 'invoicing'); |
|
267 | 267 | |
268 | 268 | $admin_settings['bank_transfer_ac_name'] = array( |
269 | 269 | 'type' => 'text', |
270 | 270 | 'id' => 'bank_transfer_ac_name', |
271 | - 'name' => __( 'Account Name', 'invoicing' ), |
|
271 | + 'name' => __('Account Name', 'invoicing'), |
|
272 | 272 | ); |
273 | 273 | |
274 | 274 | $admin_settings['bank_transfer_ac_no'] = array( |
275 | 275 | 'type' => 'text', |
276 | 276 | 'id' => 'bank_transfer_ac_no', |
277 | - 'name' => __( 'Account Number', 'invoicing' ), |
|
277 | + 'name' => __('Account Number', 'invoicing'), |
|
278 | 278 | ); |
279 | 279 | |
280 | 280 | $admin_settings['bank_transfer_bank_name'] = array( |
281 | 281 | 'type' => 'text', |
282 | 282 | 'id' => 'bank_transfer_bank_name', |
283 | - 'name' => __( 'Bank Name', 'invoicing' ), |
|
283 | + 'name' => __('Bank Name', 'invoicing'), |
|
284 | 284 | ); |
285 | 285 | |
286 | 286 | $admin_settings['bank_transfer_ifsc'] = array( |
287 | 287 | 'type' => 'text', |
288 | 288 | 'id' => 'bank_transfer_ifsc', |
289 | - 'name' => __( 'IFSC Code', 'invoicing' ), |
|
289 | + 'name' => __('IFSC Code', 'invoicing'), |
|
290 | 290 | ); |
291 | 291 | |
292 | 292 | $admin_settings['bank_transfer_iban'] = array( |
293 | 293 | 'type' => 'text', |
294 | 294 | 'id' => 'bank_transfer_iban', |
295 | - 'name' => __( 'IBAN', 'invoicing' ), |
|
295 | + 'name' => __('IBAN', 'invoicing'), |
|
296 | 296 | ); |
297 | 297 | |
298 | 298 | $admin_settings['bank_transfer_bic'] = array( |
299 | 299 | 'type' => 'text', |
300 | 300 | 'id' => 'bank_transfer_bic', |
301 | - 'name' => __( 'BIC/Swift Code', 'invoicing' ), |
|
301 | + 'name' => __('BIC/Swift Code', 'invoicing'), |
|
302 | 302 | ); |
303 | 303 | |
304 | 304 | $admin_settings['bank_transfer_sort_code'] = array( |
@@ -309,10 +309,10 @@ discard block |
||
309 | 309 | |
310 | 310 | $admin_settings['bank_transfer_info'] = array( |
311 | 311 | 'id' => 'bank_transfer_info', |
312 | - 'name' => __( 'Instructions', 'invoicing' ), |
|
313 | - 'desc' => __( 'Instructions that will be added to the thank you page and emails.', 'invoicing' ), |
|
312 | + 'name' => __('Instructions', 'invoicing'), |
|
313 | + 'desc' => __('Instructions that will be added to the thank you page and emails.', 'invoicing'), |
|
314 | 314 | 'type' => 'textarea', |
315 | - 'std' => __( "Make your payment directly into our bank account. Please use your Invoice Number as the payment reference. Your invoice won't be processed until the funds have cleared in our account.", 'invoicing' ), |
|
315 | + 'std' => __("Make your payment directly into our bank account. Please use your Invoice Number as the payment reference. Your invoice won't be processed until the funds have cleared in our account.", 'invoicing'), |
|
316 | 316 | 'cols' => 50, |
317 | 317 | 'rows' => 5 |
318 | 318 | ); |
@@ -327,10 +327,10 @@ discard block |
||
327 | 327 | * @param GetPaid_Form_Item[] $items |
328 | 328 | * @return WPInv_Invoice |
329 | 329 | */ |
330 | - public function process_addons( $invoice, $items ) { |
|
330 | + public function process_addons($invoice, $items) { |
|
331 | 331 | |
332 | - foreach ( $items as $item ) { |
|
333 | - $invoice->add_item( $item ); |
|
332 | + foreach ($items as $item) { |
|
333 | + $invoice->add_item($item); |
|
334 | 334 | } |
335 | 335 | |
336 | 336 | $invoice->recalculate_total(); |
@@ -343,10 +343,10 @@ discard block |
||
343 | 343 | * |
344 | 344 | * @param WPInv_Subscription $subscription |
345 | 345 | */ |
346 | - public function maybe_renew_subscription( $subscription ) { |
|
346 | + public function maybe_renew_subscription($subscription) { |
|
347 | 347 | |
348 | 348 | // Ensure its our subscription && it's active. |
349 | - if ( $this->id == $subscription->get_gateway() && $subscription->has_status( 'active trialling' ) ) { |
|
349 | + if ($this->id == $subscription->get_gateway() && $subscription->has_status('active trialling')) { |
|
350 | 350 | $subscription->create_payment(); |
351 | 351 | } |
352 | 352 | |
@@ -358,30 +358,30 @@ discard block |
||
358 | 358 | * |
359 | 359 | * @param WPInv_Invoice $invoice |
360 | 360 | */ |
361 | - public function invoice_paid( $invoice ) { |
|
361 | + public function invoice_paid($invoice) { |
|
362 | 362 | |
363 | 363 | // Abort if not paid by bank transfer. |
364 | - if ( $this->id !== $invoice->get_gateway() || ! $invoice->is_recurring() ) { |
|
364 | + if ($this->id !== $invoice->get_gateway() || !$invoice->is_recurring()) { |
|
365 | 365 | return; |
366 | 366 | } |
367 | 367 | |
368 | 368 | // Is it a parent payment? |
369 | - if ( 0 == $invoice->get_parent_id() ) { |
|
369 | + if (0 == $invoice->get_parent_id()) { |
|
370 | 370 | |
371 | 371 | // (Maybe) activate subscriptions. |
372 | - $subscriptions = getpaid_get_invoice_subscriptions( $invoice ); |
|
372 | + $subscriptions = getpaid_get_invoice_subscriptions($invoice); |
|
373 | 373 | |
374 | - if ( ! empty( $subscriptions ) ) { |
|
375 | - $subscriptions = is_array( $subscriptions ) ? $subscriptions : array( $subscriptions ); |
|
374 | + if (!empty($subscriptions)) { |
|
375 | + $subscriptions = is_array($subscriptions) ? $subscriptions : array($subscriptions); |
|
376 | 376 | |
377 | - foreach ( $subscriptions as $subscription ) { |
|
378 | - if ( $subscription->exists() ) { |
|
379 | - $duration = strtotime( $subscription->get_expiration() ) - strtotime( $subscription->get_date_created() ); |
|
380 | - $expiry = date( 'Y-m-d H:i:s', ( current_time( 'timestamp' ) + $duration ) ); |
|
377 | + foreach ($subscriptions as $subscription) { |
|
378 | + if ($subscription->exists()) { |
|
379 | + $duration = strtotime($subscription->get_expiration()) - strtotime($subscription->get_date_created()); |
|
380 | + $expiry = date('Y-m-d H:i:s', (current_time('timestamp') + $duration)); |
|
381 | 381 | |
382 | - $subscription->set_next_renewal_date( $expiry ); |
|
383 | - $subscription->set_date_created( current_time( 'mysql' ) ); |
|
384 | - $subscription->set_profile_id( 'bt_sub_' . $invoice->get_id() . '_' . $subscription->get_id() ); |
|
382 | + $subscription->set_next_renewal_date($expiry); |
|
383 | + $subscription->set_date_created(current_time('mysql')); |
|
384 | + $subscription->set_profile_id('bt_sub_' . $invoice->get_id() . '_' . $subscription->get_id()); |
|
385 | 385 | $subscription->activate(); |
386 | 386 | } |
387 | 387 | } |
@@ -390,11 +390,11 @@ discard block |
||
390 | 390 | |
391 | 391 | } else { |
392 | 392 | |
393 | - $subscription = getpaid_get_subscription( $invoice->get_subscription_id() ); |
|
393 | + $subscription = getpaid_get_subscription($invoice->get_subscription_id()); |
|
394 | 394 | |
395 | 395 | // Renew the subscription. |
396 | - if ( $subscription && $subscription->exists() ) { |
|
397 | - $subscription->add_payment( array(), $invoice ); |
|
396 | + if ($subscription && $subscription->exists()) { |
|
397 | + $subscription->add_payment(array(), $invoice); |
|
398 | 398 | $subscription->renew(); |
399 | 399 | } |
400 | 400 |
@@ -6,35 +6,35 @@ discard block |
||
6 | 6 | |
7 | 7 | class ComposerStaticInit8b6d4385c391849a80038f0b0e87c8b5 |
8 | 8 | { |
9 | - public static $files = array ( |
|
9 | + public static $files = array( |
|
10 | 10 | '24583d3588ebda5228dd453cfaa070da' => __DIR__ . '/..' . '/ayecode/wp-font-awesome-settings/wp-font-awesome-settings.php', |
11 | 11 | '42671a413efb740d7040437ff2a982cd' => __DIR__ . '/..' . '/ayecode/wp-super-duper/sd-functions.php', |
12 | 12 | 'e8d544c98e79f913e13eae1306ab635e' => __DIR__ . '/..' . '/ayecode/wp-ayecode-ui/ayecode-ui-loader.php', |
13 | 13 | ); |
14 | 14 | |
15 | - public static $prefixLengthsPsr4 = array ( |
|
15 | + public static $prefixLengthsPsr4 = array( |
|
16 | 16 | 'M' => |
17 | - array ( |
|
17 | + array( |
|
18 | 18 | 'MaxMind\\Db\\' => 11, |
19 | 19 | ), |
20 | 20 | 'C' => |
21 | - array ( |
|
21 | + array( |
|
22 | 22 | 'Composer\\Installers\\' => 20, |
23 | 23 | ), |
24 | 24 | ); |
25 | 25 | |
26 | - public static $prefixDirsPsr4 = array ( |
|
26 | + public static $prefixDirsPsr4 = array( |
|
27 | 27 | 'MaxMind\\Db\\' => |
28 | - array ( |
|
28 | + array( |
|
29 | 29 | 0 => __DIR__ . '/..' . '/maxmind-db/reader/src/MaxMind/Db', |
30 | 30 | ), |
31 | 31 | 'Composer\\Installers\\' => |
32 | - array ( |
|
32 | + array( |
|
33 | 33 | 0 => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers', |
34 | 34 | ), |
35 | 35 | ); |
36 | 36 | |
37 | - public static $classMap = array ( |
|
37 | + public static $classMap = array( |
|
38 | 38 | 'AyeCode_Connect_Helper' => __DIR__ . '/..' . '/ayecode/ayecode-connect-helper/ayecode-connect-helper.php', |
39 | 39 | 'AyeCode_Deactivation_Survey' => __DIR__ . '/..' . '/ayecode/wp-deactivation-survey/wp-deactivation-survey.php', |
40 | 40 | 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | |
44 | 44 | public static function getInitializer(ClassLoader $loader) |
45 | 45 | { |
46 | - return \Closure::bind(function () use ($loader) { |
|
46 | + return \Closure::bind(function() use ($loader) { |
|
47 | 47 | $loader->prefixLengthsPsr4 = ComposerStaticInit8b6d4385c391849a80038f0b0e87c8b5::$prefixLengthsPsr4; |
48 | 48 | $loader->prefixDirsPsr4 = ComposerStaticInit8b6d4385c391849a80038f0b0e87c8b5::$prefixDirsPsr4; |
49 | 49 | $loader->classMap = ComposerStaticInit8b6d4385c391849a80038f0b0e87c8b5::$classMap; |
@@ -1,10 +1,10 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if ( ! defined( 'ABSPATH' ) ) { |
|
3 | +if (!defined('ABSPATH')) { |
|
4 | 4 | exit; |
5 | 5 | } |
6 | 6 | |
7 | -if ( ! class_exists( 'AyeCode_Deactivation_Survey' ) ) { |
|
7 | +if (!class_exists('AyeCode_Deactivation_Survey')) { |
|
8 | 8 | |
9 | 9 | class AyeCode_Deactivation_Survey { |
10 | 10 | |
@@ -21,18 +21,18 @@ discard block |
||
21 | 21 | |
22 | 22 | public $version = "1.0.4"; |
23 | 23 | |
24 | - public static function instance( $plugin = array() ) { |
|
25 | - if ( ! isset( self::$instance ) && ! ( self::$instance instanceof AyeCode_Deactivation_Survey ) ) { |
|
24 | + public static function instance($plugin = array()) { |
|
25 | + if (!isset(self::$instance) && !(self::$instance instanceof AyeCode_Deactivation_Survey)) { |
|
26 | 26 | self::$instance = new AyeCode_Deactivation_Survey; |
27 | 27 | self::$plugins = array(); |
28 | 28 | |
29 | - add_action( 'admin_enqueue_scripts', array( self::$instance, 'scripts' ) ); |
|
29 | + add_action('admin_enqueue_scripts', array(self::$instance, 'scripts')); |
|
30 | 30 | |
31 | - do_action( 'ayecode_deactivation_survey_loaded' ); |
|
31 | + do_action('ayecode_deactivation_survey_loaded'); |
|
32 | 32 | } |
33 | 33 | |
34 | - if(!empty($plugin)){ |
|
35 | - self::$plugins[] = (object)$plugin; |
|
34 | + if (!empty($plugin)) { |
|
35 | + self::$plugins[] = (object) $plugin; |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | return self::$instance; |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | global $pagenow; |
43 | 43 | |
44 | 44 | // Bail if we are not on the plugins page |
45 | - if ( $pagenow != "plugins.php" ) { |
|
45 | + if ($pagenow != "plugins.php") { |
|
46 | 46 | return; |
47 | 47 | } |
48 | 48 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | 'other' => 'Other', |
86 | 86 | ); |
87 | 87 | |
88 | - foreach($plugins as $plugin) |
|
88 | + foreach ($plugins as $plugin) |
|
89 | 89 | { |
90 | 90 | $plugin->reasons = apply_filters('ayecode_deactivation_survey_reasons', $defaultReasons, $plugin); |
91 | 91 | $plugin->url = home_url(); |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) { |
|
2 | +if (!defined('ABSPATH')) { |
|
3 | 3 | exit; |
4 | 4 | } |
5 | 5 | |
@@ -94,9 +94,9 @@ discard block |
||
94 | 94 | * @param string $context View or edit context. |
95 | 95 | * @return string |
96 | 96 | */ |
97 | - public function get_name( $context = 'view' ) { |
|
98 | - $name = parent::get_name( $context ); |
|
99 | - return $name . wpinv_get_item_suffix( $this ); |
|
97 | + public function get_name($context = 'view') { |
|
98 | + $name = parent::get_name($context); |
|
99 | + return $name . wpinv_get_item_suffix($this); |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | /** |
@@ -106,8 +106,8 @@ discard block |
||
106 | 106 | * @param string $context View or edit context. |
107 | 107 | * @return string |
108 | 108 | */ |
109 | - public function get_raw_name( $context = 'view' ) { |
|
110 | - return parent::get_name( $context ); |
|
109 | + public function get_raw_name($context = 'view') { |
|
110 | + return parent::get_name($context); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | /** |
@@ -117,13 +117,13 @@ discard block |
||
117 | 117 | * @param string $context View or edit context. |
118 | 118 | * @return string |
119 | 119 | */ |
120 | - public function get_description( $context = 'view' ) { |
|
120 | + public function get_description($context = 'view') { |
|
121 | 121 | |
122 | - if ( isset( $this->custom_description ) ) { |
|
122 | + if (isset($this->custom_description)) { |
|
123 | 123 | return $this->custom_description; |
124 | 124 | } |
125 | 125 | |
126 | - return parent::get_description( $context ); |
|
126 | + return parent::get_description($context); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | /** |
@@ -133,8 +133,8 @@ discard block |
||
133 | 133 | * @param string $context View or edit context. |
134 | 134 | * @return float |
135 | 135 | */ |
136 | - public function get_sub_total( $context = 'view' ) { |
|
137 | - return $this->get_quantity( $context ) * $this->get_initial_price( $context ); |
|
136 | + public function get_sub_total($context = 'view') { |
|
137 | + return $this->get_quantity($context) * $this->get_initial_price($context); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | /** |
@@ -144,10 +144,10 @@ discard block |
||
144 | 144 | * @param string $context View or edit context. |
145 | 145 | * @return float |
146 | 146 | */ |
147 | - public function get_recurring_sub_total( $context = 'view' ) { |
|
147 | + public function get_recurring_sub_total($context = 'view') { |
|
148 | 148 | |
149 | - if ( $this->is_recurring() ) { |
|
150 | - return $this->get_quantity( $context ) * $this->get_price( $context ); |
|
149 | + if ($this->is_recurring()) { |
|
150 | + return $this->get_quantity($context) * $this->get_price($context); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | return 0; |
@@ -156,8 +156,8 @@ discard block |
||
156 | 156 | /** |
157 | 157 | * @deprecated |
158 | 158 | */ |
159 | - public function get_qantity( $context = 'view' ) { |
|
160 | - return $this->get_quantity( $context ); |
|
159 | + public function get_qantity($context = 'view') { |
|
160 | + return $this->get_quantity($context); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | /** |
@@ -167,11 +167,11 @@ discard block |
||
167 | 167 | * @param string $context View or edit context. |
168 | 168 | * @return float |
169 | 169 | */ |
170 | - public function get_quantity( $context = 'view' ) { |
|
170 | + public function get_quantity($context = 'view') { |
|
171 | 171 | $quantity = (float) $this->quantity; |
172 | 172 | |
173 | - if ( 'view' == $context ) { |
|
174 | - return apply_filters( 'getpaid_payment_form_item_quantity', $quantity, $this ); |
|
173 | + if ('view' == $context) { |
|
174 | + return apply_filters('getpaid_payment_form_item_quantity', $quantity, $this); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | return $quantity; |
@@ -185,11 +185,11 @@ discard block |
||
185 | 185 | * @param string $context View or edit context. |
186 | 186 | * @return meta |
187 | 187 | */ |
188 | - public function get_item_meta( $context = 'view' ) { |
|
188 | + public function get_item_meta($context = 'view') { |
|
189 | 189 | $meta = $this->meta; |
190 | 190 | |
191 | - if ( 'view' == $context ) { |
|
192 | - return apply_filters( 'getpaid_payment_form_item_meta', $meta, $this ); |
|
191 | + if ('view' == $context) { |
|
192 | + return apply_filters('getpaid_payment_form_item_meta', $meta, $this); |
|
193 | 193 | } |
194 | 194 | |
195 | 195 | return $meta; |
@@ -203,11 +203,11 @@ discard block |
||
203 | 203 | * @param string $context View or edit context. |
204 | 204 | * @return bool |
205 | 205 | */ |
206 | - public function get_allow_quantities( $context = 'view' ) { |
|
206 | + public function get_allow_quantities($context = 'view') { |
|
207 | 207 | $allow_quantities = (bool) $this->allow_quantities; |
208 | 208 | |
209 | - if ( 'view' == $context ) { |
|
210 | - return apply_filters( 'getpaid_payment_form_item_allow_quantities', $allow_quantities, $this ); |
|
209 | + if ('view' == $context) { |
|
210 | + return apply_filters('getpaid_payment_form_item_allow_quantities', $allow_quantities, $this); |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | return $allow_quantities; |
@@ -221,11 +221,11 @@ discard block |
||
221 | 221 | * @param string $context View or edit context. |
222 | 222 | * @return bool |
223 | 223 | */ |
224 | - public function get_is_required( $context = 'view' ) { |
|
224 | + public function get_is_required($context = 'view') { |
|
225 | 225 | $is_required = (bool) $this->is_required; |
226 | 226 | |
227 | - if ( 'view' == $context ) { |
|
228 | - return apply_filters( 'getpaid_payment_form_item_is_required', $is_required, $this ); |
|
227 | + if ('view' == $context) { |
|
228 | + return apply_filters('getpaid_payment_form_item_is_required', $is_required, $this); |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | return $is_required; |
@@ -238,11 +238,11 @@ discard block |
||
238 | 238 | * @since 1.0.19 |
239 | 239 | * @return array |
240 | 240 | */ |
241 | - public function prepare_data_for_use( $required = null ) { |
|
241 | + public function prepare_data_for_use($required = null) { |
|
242 | 242 | |
243 | - $required = is_null( $required ) ? $this->is_required() : $required; |
|
243 | + $required = is_null($required) ? $this->is_required() : $required; |
|
244 | 244 | return array( |
245 | - 'title' => strip_tags( $this->get_name() ), |
|
245 | + 'title' => strip_tags($this->get_name()), |
|
246 | 246 | 'id' => $this->get_id(), |
247 | 247 | 'price' => $this->get_price(), |
248 | 248 | 'recurring' => $this->is_recurring(), |
@@ -259,30 +259,30 @@ discard block |
||
259 | 259 | * @since 1.0.19 |
260 | 260 | * @return array |
261 | 261 | */ |
262 | - public function prepare_data_for_invoice_edit_ajax( $currency = '', $is_renewal = false ) { |
|
262 | + public function prepare_data_for_invoice_edit_ajax($currency = '', $is_renewal = false) { |
|
263 | 263 | |
264 | - $description = getpaid_item_recurring_price_help_text( $this, $currency ); |
|
264 | + $description = getpaid_item_recurring_price_help_text($this, $currency); |
|
265 | 265 | |
266 | - if ( $description ) { |
|
266 | + if ($description) { |
|
267 | 267 | $description = "<div class='getpaid-subscription-help-text'>$description</div>"; |
268 | 268 | } |
269 | 269 | |
270 | - $price = ! $is_renewal ? $this->get_price() : $this->get_recurring_price(); |
|
271 | - $subtotal = ! $is_renewal ? $this->get_sub_total() : $this->get_recurring_sub_total(); |
|
270 | + $price = !$is_renewal ? $this->get_price() : $this->get_recurring_price(); |
|
271 | + $subtotal = !$is_renewal ? $this->get_sub_total() : $this->get_recurring_sub_total(); |
|
272 | 272 | return array( |
273 | 273 | 'id' => $this->get_id(), |
274 | 274 | 'texts' => array( |
275 | - 'item-name' => sanitize_text_field( $this->get_name() ), |
|
276 | - 'item-description' => wp_kses_post( $this->get_description() ) . $description, |
|
277 | - 'item-quantity' => floatval( $this->get_quantity() ), |
|
278 | - 'item-price' => wpinv_price( $price, $currency ), |
|
279 | - 'item-total' => wpinv_price( $subtotal, $currency ), |
|
275 | + 'item-name' => sanitize_text_field($this->get_name()), |
|
276 | + 'item-description' => wp_kses_post($this->get_description()) . $description, |
|
277 | + 'item-quantity' => floatval($this->get_quantity()), |
|
278 | + 'item-price' => wpinv_price($price, $currency), |
|
279 | + 'item-total' => wpinv_price($subtotal, $currency), |
|
280 | 280 | ), |
281 | 281 | 'inputs' => array( |
282 | 282 | 'item-id' => $this->get_id(), |
283 | - 'item-name' => sanitize_text_field( $this->get_name() ), |
|
284 | - 'item-description' => wp_kses_post( $this->get_description() ), |
|
285 | - 'item-quantity' => floatval( $this->get_quantity() ), |
|
283 | + 'item-name' => sanitize_text_field($this->get_name()), |
|
284 | + 'item-description' => wp_kses_post($this->get_description()), |
|
285 | + 'item-quantity' => floatval($this->get_quantity()), |
|
286 | 286 | 'item-price' => $price, |
287 | 287 | ) |
288 | 288 | ); |
@@ -300,15 +300,15 @@ discard block |
||
300 | 300 | return array( |
301 | 301 | 'post_id' => $this->invoice_id, |
302 | 302 | 'item_id' => $this->get_id(), |
303 | - 'item_name' => sanitize_text_field( $this->get_raw_name( 'edit' ) ), |
|
304 | - 'item_description' => $this->get_description( 'edit' ), |
|
303 | + 'item_name' => sanitize_text_field($this->get_raw_name('edit')), |
|
304 | + 'item_description' => $this->get_description('edit'), |
|
305 | 305 | 'tax' => $this->item_tax, |
306 | - 'item_price' => $this->get_price( 'edit' ), |
|
307 | - 'quantity' => (float) $this->get_quantity( 'edit' ), |
|
306 | + 'item_price' => $this->get_price('edit'), |
|
307 | + 'quantity' => (float) $this->get_quantity('edit'), |
|
308 | 308 | 'discount' => $this->item_discount, |
309 | - 'subtotal' => $this->get_sub_total( 'edit' ), |
|
310 | - 'price' => $this->get_sub_total( 'edit' ) + $this->item_tax - $this->item_discount, |
|
311 | - 'meta' => $this->get_item_meta( 'edit' ), |
|
309 | + 'subtotal' => $this->get_sub_total('edit'), |
|
310 | + 'price' => $this->get_sub_total('edit') + $this->item_tax - $this->item_discount, |
|
311 | + 'meta' => $this->get_item_meta('edit'), |
|
312 | 312 | ); |
313 | 313 | |
314 | 314 | } |
@@ -329,9 +329,9 @@ discard block |
||
329 | 329 | * @since 1.0.19 |
330 | 330 | * @param float $quantity The item quantity. |
331 | 331 | */ |
332 | - public function set_quantity( $quantity ) { |
|
332 | + public function set_quantity($quantity) { |
|
333 | 333 | |
334 | - if ( ! is_numeric( $quantity ) ) { |
|
334 | + if (!is_numeric($quantity)) { |
|
335 | 335 | $quantity = 1; |
336 | 336 | } |
337 | 337 | |
@@ -345,8 +345,8 @@ discard block |
||
345 | 345 | * @since 1.0.19 |
346 | 346 | * @param array $meta The item meta data. |
347 | 347 | */ |
348 | - public function set_item_meta( $meta ) { |
|
349 | - $this->meta = maybe_unserialize( $meta ); |
|
348 | + public function set_item_meta($meta) { |
|
349 | + $this->meta = maybe_unserialize($meta); |
|
350 | 350 | } |
351 | 351 | |
352 | 352 | /** |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | * @since 1.0.19 |
356 | 356 | * @param bool $allow_quantities |
357 | 357 | */ |
358 | - public function set_allow_quantities( $allow_quantities ) { |
|
358 | + public function set_allow_quantities($allow_quantities) { |
|
359 | 359 | $this->allow_quantities = (bool) $allow_quantities; |
360 | 360 | } |
361 | 361 | |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | * @since 1.0.19 |
366 | 366 | * @param bool $is_required |
367 | 367 | */ |
368 | - public function set_is_required( $is_required ) { |
|
368 | + public function set_is_required($is_required) { |
|
369 | 369 | $this->is_required = (bool) $is_required; |
370 | 370 | } |
371 | 371 | |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | * @since 1.0.19 |
376 | 376 | * @param string $description |
377 | 377 | */ |
378 | - public function set_custom_description( $description ) { |
|
378 | + public function set_custom_description($description) { |
|
379 | 379 | $this->custom_description = $description; |
380 | 380 | } |
381 | 381 | |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | * |
385 | 385 | * @return int item id |
386 | 386 | */ |
387 | - public function save( $data = array() ) { |
|
387 | + public function save($data = array()) { |
|
388 | 388 | return $this->get_id(); |
389 | 389 | } |
390 | 390 |
@@ -7,31 +7,31 @@ discard block |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | ?> |
13 | 13 | |
14 | 14 | <div class='form-group'> |
15 | 15 | <label class="d-block"> |
16 | - <span><?php esc_html_e( 'Field Label', 'invoicing' ); ?></span> |
|
16 | + <span><?php esc_html_e('Field Label', 'invoicing'); ?></span> |
|
17 | 17 | <input v-model="active_form_element.label" class="form-control" type="text"/> |
18 | 18 | </label> |
19 | 19 | </div> |
20 | 20 | |
21 | 21 | <div class='form-group'> |
22 | 22 | <label class="d-block"> |
23 | - <span><?php esc_html_e( 'Max File Number', 'invoicing' ); ?></span> |
|
23 | + <span><?php esc_html_e('Max File Number', 'invoicing'); ?></span> |
|
24 | 24 | <input v-model="active_form_element.max_file_num" class="form-control" min="1" type="number" /> |
25 | - <small class="form-text text-muted"><?php _e( 'How many files can be uploaded?', 'invoicing' ); ?></small> |
|
25 | + <small class="form-text text-muted"><?php _e('How many files can be uploaded?', 'invoicing'); ?></small> |
|
26 | 26 | </label> |
27 | 27 | </div> |
28 | 28 | |
29 | 29 | <div class='form-group'> |
30 | 30 | <label class="d-block"> |
31 | - <span><?php esc_html_e( 'Allowed File types', 'invoicing' ); ?></span> |
|
31 | + <span><?php esc_html_e('Allowed File types', 'invoicing'); ?></span> |
|
32 | 32 | <gpselect2 class='form-control custom-select' v-model='active_form_element.file_types' multiple> |
33 | - <?php foreach ( getpaid_get_allowed_mime_types() as $ext_regex => $mime_type ) : ?> |
|
34 | - <option value="<?php echo esc_attr( $ext_regex ); ?>"><?php echo esc_html( "$mime_type" ) ?></option> |
|
33 | + <?php foreach (getpaid_get_allowed_mime_types() as $ext_regex => $mime_type) : ?> |
|
34 | + <option value="<?php echo esc_attr($ext_regex); ?>"><?php echo esc_html("$mime_type") ?></option> |
|
35 | 35 | <?php endforeach; ?> |
36 | 36 | </gpselect2> |
37 | 37 | </label> |
@@ -39,9 +39,9 @@ discard block |
||
39 | 39 | |
40 | 40 | <div class='form-group'> |
41 | 41 | <label class="d-block"> |
42 | - <span><?php esc_html_e( 'Help Text', 'invoicing' ); ?></span> |
|
43 | - <textarea placeholder='<?php esc_attr_e( 'Add some help text for this field', 'invoicing' ); ?>' v-model='active_form_element.description' class='form-control' rows='3'></textarea> |
|
44 | - <small class="form-text text-muted"><?php _e( 'HTML is allowed', 'invoicing' ); ?></small> |
|
42 | + <span><?php esc_html_e('Help Text', 'invoicing'); ?></span> |
|
43 | + <textarea placeholder='<?php esc_attr_e('Add some help text for this field', 'invoicing'); ?>' v-model='active_form_element.description' class='form-control' rows='3'></textarea> |
|
44 | + <small class="form-text text-muted"><?php _e('HTML is allowed', 'invoicing'); ?></small> |
|
45 | 45 | </label> |
46 | 46 | </div> |
47 | 47 | |
@@ -49,20 +49,20 @@ discard block |
||
49 | 49 | |
50 | 50 | <div class='form-group form-check'> |
51 | 51 | <input :id="active_form_element.id + '_edit'" v-model='active_form_element.required' type='checkbox' class='form-check-input' /> |
52 | - <label class='form-check-label' :for="active_form_element.id + '_edit'"><?php esc_html_e( 'Is this field required?', 'invoicing' ); ?></label> |
|
52 | + <label class='form-check-label' :for="active_form_element.id + '_edit'"><?php esc_html_e('Is this field required?', 'invoicing'); ?></label> |
|
53 | 53 | </div> |
54 | 54 | |
55 | 55 | <div class='form-group form-check'> |
56 | 56 | <input :id="active_form_element.id + '_add_meta'" v-model='active_form_element.add_meta' type='checkbox' class='form-check-input' /> |
57 | - <label class='form-check-label' :for="active_form_element.id + '_add_meta'"><?php esc_html_e( 'Show this field in receipts and emails?', 'invoicing' ); ?></label> |
|
57 | + <label class='form-check-label' :for="active_form_element.id + '_add_meta'"><?php esc_html_e('Show this field in receipts and emails?', 'invoicing'); ?></label> |
|
58 | 58 | </div> |
59 | 59 | |
60 | 60 | <hr class='featurette-divider mt-4'> |
61 | 61 | |
62 | 62 | <div class='form-group'> |
63 | 63 | <label class="d-block"> |
64 | - <span><?php esc_html_e( 'Email Merge Tag', 'invoicing' ); ?></span> |
|
64 | + <span><?php esc_html_e('Email Merge Tag', 'invoicing'); ?></span> |
|
65 | 65 | <input :value='active_form_element.label | formatMergeTag' class='form-control bg-white' type="text" readonly onclick="this.select()" /> |
66 | - <span class="form-text text-muted"><?php esc_html_e( 'You can use this merge tag in notification emails', 'invoicing' ); ?></span> |
|
66 | + <span class="form-text text-muted"><?php esc_html_e('You can use this merge tag in notification emails', 'invoicing'); ?></span> |
|
67 | 67 | </label> |
68 | 68 | </div> |
@@ -7,15 +7,15 @@ |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | ?> |
13 | 13 | |
14 | 14 | <label><span v-html="form_element.label"></span></label> |
15 | 15 | <div class="d-flex w-100 flex-column align-items-center justify-content-center p-2" style="height: 200px; border: 3px dashed rgb(136, 136, 136); cursor: pointer;"> |
16 | 16 | <div class="h5 text-dark"> |
17 | - <span v-if="form_element.max_file_num > 1"><?php _e( 'Drag files to this area or click to upload', 'invoicing' ); ?></span> |
|
18 | - <span v-if="form_element.max_file_num < 2"><?php _e( 'Drag your file to this area or click to upload', 'invoicing' ); ?></span> |
|
17 | + <span v-if="form_element.max_file_num > 1"><?php _e('Drag files to this area or click to upload', 'invoicing'); ?></span> |
|
18 | + <span v-if="form_element.max_file_num < 2"><?php _e('Drag your file to this area or click to upload', 'invoicing'); ?></span> |
|
19 | 19 | </div> |
20 | 20 | <small v-if='form_element.description' class='form-text text-muted' v-html='form_element.description'></small> |
21 | 21 | </div> |
@@ -7,26 +7,26 @@ discard block |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
11 | - |
|
12 | -$label = empty( $label ) ? '' : wp_kses_post( $label ); |
|
13 | -$label_class = sanitize_key( preg_replace( '/[^A-Za-z0-9_-]/', '-', $label ) ); |
|
14 | -$id = esc_attr( $id ); |
|
15 | -$_id = $id . uniqid( '_' ); |
|
16 | -$max_file_num = empty( $max_file_num ) ? 1 : absint( $max_file_num ); |
|
17 | -$file_types = empty( $file_types ) ? array( 'jpg|jpeg|jpe', 'gif', 'png' ) : $file_types; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | + |
|
12 | +$label = empty($label) ? '' : wp_kses_post($label); |
|
13 | +$label_class = sanitize_key(preg_replace('/[^A-Za-z0-9_-]/', '-', $label)); |
|
14 | +$id = esc_attr($id); |
|
15 | +$_id = $id . uniqid('_'); |
|
16 | +$max_file_num = empty($max_file_num) ? 1 : absint($max_file_num); |
|
17 | +$file_types = empty($file_types) ? array('jpg|jpeg|jpe', 'gif', 'png') : $file_types; |
|
18 | 18 | $all_types = getpaid_get_allowed_mime_types(); |
19 | 19 | $types = array(); |
20 | 20 | $_types = array(); |
21 | 21 | |
22 | -foreach ( $file_types as $file_type ) { |
|
22 | +foreach ($file_types as $file_type) { |
|
23 | 23 | |
24 | - if ( isset( $all_types[ $file_type ] ) ) { |
|
25 | - $types[] = $all_types[ $file_type ]; |
|
26 | - $file_type = explode( '|', $file_type ); |
|
24 | + if (isset($all_types[$file_type])) { |
|
25 | + $types[] = $all_types[$file_type]; |
|
26 | + $file_type = explode('|', $file_type); |
|
27 | 27 | |
28 | - foreach ( $file_type as $type ) { |
|
29 | - $type = trim( $type ); |
|
28 | + foreach ($file_type as $type) { |
|
29 | + $type = trim($type); |
|
30 | 30 | $types[] = ".$type"; |
31 | 31 | $_types[] = $type; |
32 | 32 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | |
36 | 36 | } |
37 | 37 | |
38 | -if ( ! empty( $required ) ) { |
|
38 | +if (!empty($required)) { |
|
39 | 39 | $label .= "<span class='text-danger'> *</span>"; |
40 | 40 | } |
41 | 41 | |
@@ -43,16 +43,16 @@ discard block |
||
43 | 43 | |
44 | 44 | <label><span v-html="form_element.label"></span></label> |
45 | 45 | |
46 | -<div class="form-group <?php echo sanitize_html_class( $label_class ); ?>" data-name="<?php echo esc_attr( $id ); ?>" data-max="<?php echo esc_attr( $max_file_num ); ?>"> |
|
47 | - <label for="<?php echo esc_attr( $id ); ?>"><?php echo wp_kses_post( $label ); ?></label> |
|
48 | - <input type="file" class="sr-only getpaid-files-input" id="<?php echo esc_attr( $id ); ?>" accept="<?php echo esc_attr( implode( ', ', $types ) ); ?>" data-extensions="<?php echo esc_attr( wp_json_encode( $_types ) ); ?>" <?php echo $max_file_num == 1 ? '' : 'multiple="multiple"'; ?>> |
|
46 | +<div class="form-group <?php echo sanitize_html_class($label_class); ?>" data-name="<?php echo esc_attr($id); ?>" data-max="<?php echo esc_attr($max_file_num); ?>"> |
|
47 | + <label for="<?php echo esc_attr($id); ?>"><?php echo wp_kses_post($label); ?></label> |
|
48 | + <input type="file" class="sr-only getpaid-files-input" id="<?php echo esc_attr($id); ?>" accept="<?php echo esc_attr(implode(', ', $types)); ?>" data-extensions="<?php echo esc_attr(wp_json_encode($_types)); ?>" <?php echo $max_file_num == 1 ? '' : 'multiple="multiple"'; ?>> |
|
49 | 49 | |
50 | - <label for="<?php echo esc_attr( $id ); ?>" class="getpaid-file-upload-element d-flex w-100 flex-column align-items-center justify-content-center p-2 mb-2"> |
|
50 | + <label for="<?php echo esc_attr($id); ?>" class="getpaid-file-upload-element d-flex w-100 flex-column align-items-center justify-content-center p-2 mb-2"> |
|
51 | 51 | <div class="h5 text-dark"> |
52 | - <?php echo _n( 'Drag your file to this area or click to upload', 'Drag files to this area or click to upload', $max_file_num, 'invoicing' ); ?> |
|
52 | + <?php echo _n('Drag your file to this area or click to upload', 'Drag files to this area or click to upload', $max_file_num, 'invoicing'); ?> |
|
53 | 53 | </div> |
54 | - <?php if ( ! empty( $description ) ) : ?> |
|
55 | - <small class="form-text text-muted"><?php echo wp_kses_post( $description ); ?></small> |
|
54 | + <?php if (!empty($description)) : ?> |
|
55 | + <small class="form-text text-muted"><?php echo wp_kses_post($description); ?></small> |
|
56 | 56 | <?php endif; ?> |
57 | 57 | </label> |
58 | 58 | |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | <div class="form-row mb-3 d-none getpaid-progress-template"> |
62 | 62 | |
63 | 63 | <div class="overflow-hidden text-nowrap col-7 col-sm-4"> |
64 | - <a href="" class="close float-none" title="<?php esc_attr_e( 'Remove File', 'invoicing' ); ?>">×<span class="sr-only"><?php _e( 'Close', 'invoicing' ); ?></span></a> |
|
64 | + <a href="" class="close float-none" title="<?php esc_attr_e('Remove File', 'invoicing'); ?>">×<span class="sr-only"><?php _e('Close', 'invoicing'); ?></span></a> |
|
65 | 65 | <i class="fa fa-file" aria-hidden="true"></i> <span class="getpaid-progress-file-name"></span> |
66 | 66 | </div> |
67 | 67 |