@@ -7,31 +7,31 @@ |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | // Prepare the selectable items. |
13 | 13 | $selectable = array(); |
14 | -foreach ( $form->get_items() as $item ) { |
|
15 | - if ( ! $item->is_required ) { |
|
16 | - $selectable[$item->get_id()] = $item->get_name() . ' — ' . wpinv_price( $item->get_initial_price() ); |
|
14 | +foreach ($form->get_items() as $item) { |
|
15 | + if (!$item->is_required) { |
|
16 | + $selectable[$item->get_id()] = $item->get_name() . ' — ' . wpinv_price($item->get_initial_price()); |
|
17 | 17 | } |
18 | 18 | } |
19 | 19 | |
20 | -if ( empty( $selectable ) ) { |
|
20 | +if (empty($selectable)) { |
|
21 | 21 | return; |
22 | 22 | } |
23 | 23 | |
24 | 24 | echo '<div class="getpaid-payment-form-items-checkbox form-group">'; |
25 | 25 | |
26 | -foreach ( $selectable as $item_id => $item_name ) { |
|
26 | +foreach ($selectable as $item_id => $item_name) { |
|
27 | 27 | |
28 | - $is_checked = get_post_meta( $item_id, 'selected_by_default', true ); |
|
28 | + $is_checked = get_post_meta($item_id, 'selected_by_default', true); |
|
29 | 29 | |
30 | 30 | echo aui()->input( |
31 | 31 | array( |
32 | 32 | 'type' => 'checkbox', |
33 | 33 | 'name' => 'getpaid-payment-form-selected-item', |
34 | - 'id' => 'getpaid-payment-form-selected-item' . uniqid( '_' ) . $item_id, |
|
34 | + 'id' => 'getpaid-payment-form-selected-item' . uniqid('_') . $item_id, |
|
35 | 35 | 'label' => $item_name, |
36 | 36 | 'value' => $item_id, |
37 | 37 | 'no_wrap' => true, |
@@ -7,26 +7,26 @@ discard block |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | // Make sure that the form is active. |
13 | -if ( ! $form->is_active() ) { |
|
13 | +if (!$form->is_active()) { |
|
14 | 14 | echo aui()->alert( |
15 | 15 | array( |
16 | 16 | 'type' => 'warning', |
17 | - 'content' => __( 'This payment form is no longer active', 'invoicing' ), |
|
17 | + 'content' => __('This payment form is no longer active', 'invoicing'), |
|
18 | 18 | ) |
19 | 19 | ); |
20 | 20 | return; |
21 | 21 | } |
22 | 22 | |
23 | 23 | // Require login to checkout. |
24 | -if ( wpinv_require_login_to_checkout() && ! get_current_user_id() ) { |
|
24 | +if (wpinv_require_login_to_checkout() && !get_current_user_id()) { |
|
25 | 25 | |
26 | 26 | echo aui()->alert( |
27 | 27 | array( |
28 | 28 | 'type' => 'danger', |
29 | - 'content' => __( 'You must be logged in to checkout.', 'invoicing' ), |
|
29 | + 'content' => __('You must be logged in to checkout.', 'invoicing'), |
|
30 | 30 | ) |
31 | 31 | ); |
32 | 32 | return; |
@@ -34,29 +34,29 @@ discard block |
||
34 | 34 | } |
35 | 35 | |
36 | 36 | // Fires before displaying a payment form. |
37 | -do_action( 'getpaid_before_payment_form', $form ); |
|
37 | +do_action('getpaid_before_payment_form', $form); |
|
38 | 38 | ?> |
39 | 39 | |
40 | -<form class='getpaid-payment-form getpaid-payment-form-<?php echo absint( $form->get_id() ); ?> bsui position-relative' method='POST' data-key='<?php echo uniqid('gpf'); ?>' data-currency='<?php echo esc_attr( empty( $form->invoice ) ? wpinv_get_currency() : $form->invoice->get_currency() ); ?>' novalidate> |
|
40 | +<form class='getpaid-payment-form getpaid-payment-form-<?php echo absint($form->get_id()); ?> bsui position-relative' method='POST' data-key='<?php echo uniqid('gpf'); ?>' data-currency='<?php echo esc_attr(empty($form->invoice) ? wpinv_get_currency() : $form->invoice->get_currency()); ?>' novalidate> |
|
41 | 41 | |
42 | 42 | <?php |
43 | 43 | |
44 | 44 | // Fires when printing the top of a payment form. |
45 | - do_action( 'getpaid_payment_form_top', $form ); |
|
45 | + do_action('getpaid_payment_form_top', $form); |
|
46 | 46 | |
47 | 47 | // And the optional invoice id. |
48 | - if ( ! empty( $form->invoice ) ) { |
|
49 | - echo getpaid_hidden_field( 'invoice_id', $form->invoice->get_id() ); |
|
48 | + if (!empty($form->invoice)) { |
|
49 | + echo getpaid_hidden_field('invoice_id', $form->invoice->get_id()); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | // We also want to include the form id. |
53 | - echo getpaid_hidden_field( 'form_id', $form->get_id() ); |
|
53 | + echo getpaid_hidden_field('form_id', $form->get_id()); |
|
54 | 54 | |
55 | 55 | // And an indication that this is a payment form submission. |
56 | - echo getpaid_hidden_field( 'getpaid_payment_form_submission', '1' ); |
|
56 | + echo getpaid_hidden_field('getpaid_payment_form_submission', '1'); |
|
57 | 57 | |
58 | 58 | // Fires before displaying payment form elements. |
59 | - do_action( 'getpaid_payment_form_before_elements', $form ); |
|
59 | + do_action('getpaid_payment_form_before_elements', $form); |
|
60 | 60 | |
61 | 61 | // Display the elements. |
62 | 62 | ?> |
@@ -64,13 +64,13 @@ discard block |
||
64 | 64 | <div class="row"> |
65 | 65 | <?php |
66 | 66 | |
67 | - foreach ( $form->get_elements() as $element ) { |
|
67 | + foreach ($form->get_elements() as $element) { |
|
68 | 68 | |
69 | - if ( isset( $element['type'] ) ) { |
|
70 | - $grid_class = esc_attr( getpaid_get_form_element_grid_class( $element ) ); |
|
69 | + if (isset($element['type'])) { |
|
70 | + $grid_class = esc_attr(getpaid_get_form_element_grid_class($element)); |
|
71 | 71 | echo "<div class='$grid_class'>"; |
72 | - do_action( 'getpaid_payment_form_element', $element, $form ); |
|
73 | - do_action( "getpaid_payment_form_element_{$element['type']}_template", $element, $form ); |
|
72 | + do_action('getpaid_payment_form_element', $element, $form); |
|
73 | + do_action("getpaid_payment_form_element_{$element['type']}_template", $element, $form); |
|
74 | 74 | echo "</div>"; |
75 | 75 | } |
76 | 76 | |
@@ -82,16 +82,16 @@ discard block |
||
82 | 82 | |
83 | 83 | <?php |
84 | 84 | // Fires after displaying payment form elements. |
85 | - do_action( 'getpaid_payment_form_after_elements', $form ); |
|
85 | + do_action('getpaid_payment_form_after_elements', $form); |
|
86 | 86 | |
87 | 87 | echo "<div class='getpaid-payment-form-errors alert alert-danger d-none'></div>"; |
88 | 88 | |
89 | - if ( wpinv_current_user_can_manage_invoicing() ) { |
|
89 | + if (wpinv_current_user_can_manage_invoicing()) { |
|
90 | 90 | |
91 | 91 | edit_post_link( |
92 | - __( 'Edit this form.', 'invoicing' ), |
|
92 | + __('Edit this form.', 'invoicing'), |
|
93 | 93 | '<small class="form-text text-muted">', |
94 | - ' ' . __( 'This is only visible to website administators.', 'invoicing' ) . '</small>', |
|
94 | + ' ' . __('This is only visible to website administators.', 'invoicing') . '</small>', |
|
95 | 95 | $form->get_id(), |
96 | 96 | 'text-danger' |
97 | 97 | ); |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | |
104 | 104 | <div class="loading_div overlay overlay-black position-absolute row m-0 rounded overflow-hidden" style="height: 100%;width: 100%;top: 0px;z-index: 2;display:none;"> |
105 | 105 | <div class="spinner-border mx-auto align-self-center text-white" role="status"> |
106 | - <span class="sr-only"><?php _e( 'Loading...', 'invoicing' );?></span> |
|
106 | + <span class="sr-only"><?php _e('Loading...', 'invoicing'); ?></span> |
|
107 | 107 | </div> |
108 | 108 | </div> |
109 | 109 | |
@@ -112,4 +112,4 @@ discard block |
||
112 | 112 | <?php |
113 | 113 | |
114 | 114 | // Fires after displaying a payment form. |
115 | -do_action( 'getpaid_after_payment_form', $form ); |
|
115 | +do_action('getpaid_after_payment_form', $form); |
@@ -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 | * Metaboxes Admin Class |
@@ -25,35 +25,35 @@ discard block |
||
25 | 25 | public static function init() { |
26 | 26 | |
27 | 27 | // Register metaboxes. |
28 | - add_action( 'add_meta_boxes', 'GetPaid_Metaboxes::add_meta_boxes', 5, 2 ); |
|
28 | + add_action('add_meta_boxes', 'GetPaid_Metaboxes::add_meta_boxes', 5, 2); |
|
29 | 29 | |
30 | 30 | // Remove metaboxes. |
31 | - add_action( 'add_meta_boxes', 'GetPaid_Metaboxes::remove_meta_boxes', 30 ); |
|
31 | + add_action('add_meta_boxes', 'GetPaid_Metaboxes::remove_meta_boxes', 30); |
|
32 | 32 | |
33 | 33 | // Rename metaboxes. |
34 | - add_action( 'add_meta_boxes', 'GetPaid_Metaboxes::rename_meta_boxes', 45 ); |
|
34 | + add_action('add_meta_boxes', 'GetPaid_Metaboxes::rename_meta_boxes', 45); |
|
35 | 35 | |
36 | 36 | // Save metaboxes. |
37 | - add_action( 'save_post', 'GetPaid_Metaboxes::save_meta_boxes', 1, 2 ); |
|
37 | + add_action('save_post', 'GetPaid_Metaboxes::save_meta_boxes', 1, 2); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | /** |
41 | 41 | * Register core metaboxes. |
42 | 42 | */ |
43 | - public static function add_meta_boxes( $post_type, $post ) { |
|
43 | + public static function add_meta_boxes($post_type, $post) { |
|
44 | 44 | |
45 | 45 | // For invoices... |
46 | - self::add_invoice_meta_boxes( $post_type, $post ); |
|
46 | + self::add_invoice_meta_boxes($post_type, $post); |
|
47 | 47 | |
48 | 48 | // For payment forms. |
49 | - self::add_payment_form_meta_boxes( $post_type, $post ); |
|
49 | + self::add_payment_form_meta_boxes($post_type, $post); |
|
50 | 50 | |
51 | 51 | // For invoice items. |
52 | - self::add_item_meta_boxes( $post_type ); |
|
52 | + self::add_item_meta_boxes($post_type); |
|
53 | 53 | |
54 | 54 | // For invoice discounts. |
55 | - if ( $post_type == 'wpi_discount' ) { |
|
56 | - add_meta_box( 'wpinv_discount_details', __( 'Discount Details', 'invoicing' ), 'GetPaid_Meta_Box_Discount_Details::output', 'wpi_discount', 'normal', 'high' ); |
|
55 | + if ($post_type == 'wpi_discount') { |
|
56 | + add_meta_box('wpinv_discount_details', __('Discount Details', 'invoicing'), 'GetPaid_Meta_Box_Discount_Details::output', 'wpi_discount', 'normal', 'high'); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | } |
@@ -61,17 +61,17 @@ discard block |
||
61 | 61 | /** |
62 | 62 | * Register core metaboxes. |
63 | 63 | */ |
64 | - protected static function add_payment_form_meta_boxes( $post_type, $post ) { |
|
64 | + protected static function add_payment_form_meta_boxes($post_type, $post) { |
|
65 | 65 | |
66 | 66 | // For payment forms. |
67 | - if ( $post_type == 'wpi_payment_form' ) { |
|
67 | + if ($post_type == 'wpi_payment_form') { |
|
68 | 68 | |
69 | 69 | // Design payment form. |
70 | - add_meta_box( 'wpinv-payment-form-design', __( 'Payment Form', 'invoicing' ), 'GetPaid_Meta_Box_Payment_Form::output', 'wpi_payment_form', 'normal' ); |
|
70 | + add_meta_box('wpinv-payment-form-design', __('Payment Form', 'invoicing'), 'GetPaid_Meta_Box_Payment_Form::output', 'wpi_payment_form', 'normal'); |
|
71 | 71 | |
72 | 72 | // Payment form information. |
73 | - if ( $post->ID != wpinv_get_default_payment_form() ) { |
|
74 | - add_meta_box( 'wpinv-payment-form-info', __( 'Details', 'invoicing' ), 'GetPaid_Meta_Box_Payment_Form_Info::output', 'wpi_payment_form', 'side' ); |
|
73 | + if ($post->ID != wpinv_get_default_payment_form()) { |
|
74 | + add_meta_box('wpinv-payment-form-info', __('Details', 'invoicing'), 'GetPaid_Meta_Box_Payment_Form_Info::output', 'wpi_payment_form', 'side'); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | } |
@@ -81,20 +81,20 @@ discard block |
||
81 | 81 | /** |
82 | 82 | * Register core metaboxes. |
83 | 83 | */ |
84 | - protected static function add_item_meta_boxes( $post_type ) { |
|
84 | + protected static function add_item_meta_boxes($post_type) { |
|
85 | 85 | |
86 | - if ( $post_type == 'wpi_item' ) { |
|
86 | + if ($post_type == 'wpi_item') { |
|
87 | 87 | |
88 | 88 | // Item details. |
89 | - add_meta_box( 'wpinv_item_details', __( 'Item Details', 'invoicing' ), 'GetPaid_Meta_Box_Item_Details::output', 'wpi_item', 'normal', 'high' ); |
|
89 | + add_meta_box('wpinv_item_details', __('Item Details', 'invoicing'), 'GetPaid_Meta_Box_Item_Details::output', 'wpi_item', 'normal', 'high'); |
|
90 | 90 | |
91 | 91 | // If taxes are enabled, register the tax metabox. |
92 | - if ( wpinv_use_taxes() ) { |
|
93 | - add_meta_box( 'wpinv_item_vat', __( 'Tax', 'invoicing' ), 'GetPaid_Meta_Box_Item_VAT::output', 'wpi_item', 'normal', 'high' ); |
|
92 | + if (wpinv_use_taxes()) { |
|
93 | + add_meta_box('wpinv_item_vat', __('Tax', 'invoicing'), 'GetPaid_Meta_Box_Item_VAT::output', 'wpi_item', 'normal', 'high'); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | // Item info. |
97 | - add_meta_box( 'wpinv_field_item_info', __( 'Item info', 'invoicing' ), 'GetPaid_Meta_Box_Item_Info::output', 'wpi_item', 'side', 'core' ); |
|
97 | + add_meta_box('wpinv_field_item_info', __('Item info', 'invoicing'), 'GetPaid_Meta_Box_Item_Info::output', 'wpi_item', 'side', 'core'); |
|
98 | 98 | |
99 | 99 | } |
100 | 100 | |
@@ -103,20 +103,20 @@ discard block |
||
103 | 103 | /** |
104 | 104 | * Register invoice metaboxes. |
105 | 105 | */ |
106 | - protected static function add_invoice_meta_boxes( $post_type, $post ) { |
|
106 | + protected static function add_invoice_meta_boxes($post_type, $post) { |
|
107 | 107 | |
108 | 108 | // For invoices... |
109 | - if ( getpaid_is_invoice_post_type( $post_type ) ) { |
|
110 | - $invoice = new WPInv_Invoice( $post ); |
|
109 | + if (getpaid_is_invoice_post_type($post_type)) { |
|
110 | + $invoice = new WPInv_Invoice($post); |
|
111 | 111 | |
112 | 112 | // Resend invoice. |
113 | - if ( ! $invoice->is_draft() ) { |
|
113 | + if (!$invoice->is_draft()) { |
|
114 | 114 | |
115 | 115 | add_meta_box( |
116 | 116 | 'wpinv-mb-resend-invoice', |
117 | 117 | sprintf( |
118 | - __( 'Resend %s', 'invoicing' ), |
|
119 | - ucfirst( $invoice->get_invoice_quote_type() ) |
|
118 | + __('Resend %s', 'invoicing'), |
|
119 | + ucfirst($invoice->get_invoice_quote_type()) |
|
120 | 120 | ), |
121 | 121 | 'GetPaid_Meta_Box_Resend_Invoice::output', |
122 | 122 | $post_type, |
@@ -127,17 +127,17 @@ discard block |
||
127 | 127 | } |
128 | 128 | |
129 | 129 | // Subscriptions. |
130 | - $subscriptions = getpaid_get_invoice_subscriptions( $invoice ); |
|
131 | - if ( ! empty( $subscriptions ) ) { |
|
130 | + $subscriptions = getpaid_get_invoice_subscriptions($invoice); |
|
131 | + if (!empty($subscriptions)) { |
|
132 | 132 | |
133 | - if ( is_array( $subscriptions ) ) { |
|
134 | - add_meta_box( 'wpinv-mb-subscriptions', __( 'Related Subscriptions', 'invoicing' ), 'GetPaid_Meta_Box_Invoice_Subscription::output_related', $post_type, 'advanced' ); |
|
133 | + if (is_array($subscriptions)) { |
|
134 | + add_meta_box('wpinv-mb-subscriptions', __('Related Subscriptions', 'invoicing'), 'GetPaid_Meta_Box_Invoice_Subscription::output_related', $post_type, 'advanced'); |
|
135 | 135 | } else { |
136 | - add_meta_box( 'wpinv-mb-subscriptions', __( 'Subscription Details', 'invoicing' ), 'GetPaid_Meta_Box_Invoice_Subscription::output', $post_type, 'advanced' ); |
|
136 | + add_meta_box('wpinv-mb-subscriptions', __('Subscription Details', 'invoicing'), 'GetPaid_Meta_Box_Invoice_Subscription::output', $post_type, 'advanced'); |
|
137 | 137 | } |
138 | 138 | |
139 | - if ( getpaid_count_subscription_invoices( $invoice->is_renewal() ? $invoice->get_parent_id() : $invoice->get_id() ) > 1 ) { |
|
140 | - add_meta_box( 'wpinv-mb-subscription-invoices', __( 'Related Payments', 'invoicing' ), 'GetPaid_Meta_Box_Invoice_Subscription::output_invoices', $post_type, 'advanced' ); |
|
139 | + if (getpaid_count_subscription_invoices($invoice->is_renewal() ? $invoice->get_parent_id() : $invoice->get_id()) > 1) { |
|
140 | + add_meta_box('wpinv-mb-subscription-invoices', __('Related Payments', 'invoicing'), 'GetPaid_Meta_Box_Invoice_Subscription::output_invoices', $post_type, 'advanced'); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | } |
@@ -146,8 +146,8 @@ discard block |
||
146 | 146 | add_meta_box( |
147 | 147 | 'wpinv-details', |
148 | 148 | sprintf( |
149 | - __( '%s Details', 'invoicing' ), |
|
150 | - ucfirst( $invoice->get_invoice_quote_type() ) |
|
149 | + __('%s Details', 'invoicing'), |
|
150 | + ucfirst($invoice->get_invoice_quote_type()) |
|
151 | 151 | ), |
152 | 152 | 'GetPaid_Meta_Box_Invoice_Details::output', |
153 | 153 | $post_type, |
@@ -155,17 +155,17 @@ discard block |
||
155 | 155 | ); |
156 | 156 | |
157 | 157 | // Payment details. |
158 | - add_meta_box( 'wpinv-payment-meta', __( 'Payment Meta', 'invoicing' ), 'GetPaid_Meta_Box_Invoice_Payment_Meta::output', $post_type, 'side', 'default' ); |
|
158 | + add_meta_box('wpinv-payment-meta', __('Payment Meta', 'invoicing'), 'GetPaid_Meta_Box_Invoice_Payment_Meta::output', $post_type, 'side', 'default'); |
|
159 | 159 | |
160 | 160 | // Billing details. |
161 | - add_meta_box( 'wpinv-address', __( 'Billing Details', 'invoicing' ), 'GetPaid_Meta_Box_Invoice_Address::output', $post_type, 'normal', 'high' ); |
|
161 | + add_meta_box('wpinv-address', __('Billing Details', 'invoicing'), 'GetPaid_Meta_Box_Invoice_Address::output', $post_type, 'normal', 'high'); |
|
162 | 162 | |
163 | 163 | // Invoice items. |
164 | 164 | add_meta_box( |
165 | 165 | 'wpinv-items', |
166 | 166 | sprintf( |
167 | - __( '%s Items', 'invoicing' ), |
|
168 | - ucfirst( $invoice->get_invoice_quote_type() ) |
|
167 | + __('%s Items', 'invoicing'), |
|
168 | + ucfirst($invoice->get_invoice_quote_type()) |
|
169 | 169 | ), |
170 | 170 | 'GetPaid_Meta_Box_Invoice_Items::output', |
171 | 171 | $post_type, |
@@ -177,8 +177,8 @@ discard block |
||
177 | 177 | add_meta_box( |
178 | 178 | 'wpinv-notes', |
179 | 179 | sprintf( |
180 | - __( '%s Notes', 'invoicing' ), |
|
181 | - ucfirst( $invoice->get_invoice_quote_type() ) |
|
180 | + __('%s Notes', 'invoicing'), |
|
181 | + ucfirst($invoice->get_invoice_quote_type()) |
|
182 | 182 | ), |
183 | 183 | 'WPInv_Meta_Box_Notes::output', |
184 | 184 | $post_type, |
@@ -187,13 +187,13 @@ discard block |
||
187 | 187 | ); |
188 | 188 | |
189 | 189 | // Shipping Address. |
190 | - if ( get_post_meta( $invoice->get_id(), 'shipping_address', true ) ) { |
|
191 | - add_meta_box( 'wpinv-invoice-shipping-details', __( 'Shipping Address', 'invoicing' ), 'GetPaid_Meta_Box_Invoice_Shipping_Address::output', $post_type, 'side', 'high' ); |
|
190 | + if (get_post_meta($invoice->get_id(), 'shipping_address', true)) { |
|
191 | + add_meta_box('wpinv-invoice-shipping-details', __('Shipping Address', 'invoicing'), 'GetPaid_Meta_Box_Invoice_Shipping_Address::output', $post_type, 'side', 'high'); |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | // Payment form information. |
195 | - if ( get_post_meta( $invoice->get_id(), 'payment_form_data', true ) ) { |
|
196 | - add_meta_box( 'wpinv-invoice-payment-form-details', __( 'Payment Form Details', 'invoicing' ), 'WPInv_Meta_Box_Payment_Form::output_details', $post_type, 'side', 'high' ); |
|
195 | + if (get_post_meta($invoice->get_id(), 'payment_form_data', true)) { |
|
196 | + add_meta_box('wpinv-invoice-payment-form-details', __('Payment Form Details', 'invoicing'), 'WPInv_Meta_Box_Payment_Form::output_details', $post_type, 'side', 'high'); |
|
197 | 197 | } |
198 | 198 | |
199 | 199 | } |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | * Remove some metaboxes. |
205 | 205 | */ |
206 | 206 | public static function remove_meta_boxes() { |
207 | - remove_meta_box( 'wpseo_meta', 'wpi_invoice', 'normal' ); |
|
207 | + remove_meta_box('wpseo_meta', 'wpi_invoice', 'normal'); |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | /** |
@@ -220,46 +220,46 @@ discard block |
||
220 | 220 | * @param int $post_id Post ID. |
221 | 221 | * @param object $post Post object. |
222 | 222 | */ |
223 | - public static function save_meta_boxes( $post_id, $post ) { |
|
224 | - $post_id = absint( $post_id ); |
|
225 | - $data = wp_kses_post_deep( wp_unslash( $_POST ) ); |
|
223 | + public static function save_meta_boxes($post_id, $post) { |
|
224 | + $post_id = absint($post_id); |
|
225 | + $data = wp_kses_post_deep(wp_unslash($_POST)); |
|
226 | 226 | |
227 | 227 | // Do not save for ajax requests. |
228 | - if ( ( defined( 'DOING_AJAX') && DOING_AJAX ) || isset( $_REQUEST['bulk_edit'] ) ) { |
|
228 | + if ((defined('DOING_AJAX') && DOING_AJAX) || isset($_REQUEST['bulk_edit'])) { |
|
229 | 229 | return; |
230 | 230 | } |
231 | 231 | |
232 | 232 | // $post_id and $post are required |
233 | - if ( empty( $post_id ) || empty( $post ) || self::$saved_meta_boxes ) { |
|
233 | + if (empty($post_id) || empty($post) || self::$saved_meta_boxes) { |
|
234 | 234 | return; |
235 | 235 | } |
236 | 236 | |
237 | 237 | // Dont' save meta boxes for revisions or autosaves. |
238 | - if ( ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) || is_int( wp_is_post_revision( $post ) ) || is_int( wp_is_post_autosave( $post ) ) ) { |
|
238 | + if ((defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) || is_int(wp_is_post_revision($post)) || is_int(wp_is_post_autosave($post))) { |
|
239 | 239 | return; |
240 | 240 | } |
241 | 241 | |
242 | 242 | // Check the nonce. |
243 | - if ( empty( $data['getpaid_meta_nonce'] ) || ! wp_verify_nonce( $data['getpaid_meta_nonce'], 'getpaid_meta_nonce' ) ) { |
|
243 | + if (empty($data['getpaid_meta_nonce']) || !wp_verify_nonce($data['getpaid_meta_nonce'], 'getpaid_meta_nonce')) { |
|
244 | 244 | return; |
245 | 245 | } |
246 | 246 | |
247 | 247 | // Check the post being saved == the $post_id to prevent triggering this call for other save_post events. |
248 | - if ( empty( $data['post_ID'] ) || absint( $data['post_ID'] ) !== $post_id ) { |
|
248 | + if (empty($data['post_ID']) || absint($data['post_ID']) !== $post_id) { |
|
249 | 249 | return; |
250 | 250 | } |
251 | 251 | |
252 | 252 | // Check user has permission to edit. |
253 | - if ( ! current_user_can( 'edit_post', $post_id ) ) { |
|
253 | + if (!current_user_can('edit_post', $post_id)) { |
|
254 | 254 | return; |
255 | 255 | } |
256 | 256 | |
257 | - if ( getpaid_is_invoice_post_type( $post->post_type ) ) { |
|
257 | + if (getpaid_is_invoice_post_type($post->post_type)) { |
|
258 | 258 | |
259 | 259 | // We need this save event to run once to avoid potential endless loops. |
260 | 260 | self::$saved_meta_boxes = true; |
261 | 261 | |
262 | - return GetPaid_Meta_Box_Invoice_Address::save( $post_id ); |
|
262 | + return GetPaid_Meta_Box_Invoice_Address::save($post_id); |
|
263 | 263 | |
264 | 264 | } |
265 | 265 | |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | ); |
272 | 272 | |
273 | 273 | // Is this our post type? |
274 | - if ( ! isset( $post_types_map[ $post->post_type ] ) ) { |
|
274 | + if (!isset($post_types_map[$post->post_type])) { |
|
275 | 275 | return; |
276 | 276 | } |
277 | 277 | |
@@ -279,8 +279,8 @@ discard block |
||
279 | 279 | self::$saved_meta_boxes = true; |
280 | 280 | |
281 | 281 | // Save the post. |
282 | - $class = $post_types_map[ $post->post_type ]; |
|
283 | - $class::save( $post_id, $_POST, $post ); |
|
282 | + $class = $post_types_map[$post->post_type]; |
|
283 | + $class::save($post_id, $_POST, $post); |
|
284 | 284 | |
285 | 285 | } |
286 | 286 |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * @package Invoicing |
7 | 7 | */ |
8 | 8 | |
9 | -defined( 'ABSPATH' ) || exit; |
|
9 | +defined('ABSPATH') || exit; |
|
10 | 10 | |
11 | 11 | /** |
12 | 12 | * Are we supporting item quantities? |
@@ -20,35 +20,35 @@ discard block |
||
20 | 20 | */ |
21 | 21 | function wpinv_get_ip() { |
22 | 22 | |
23 | - if ( isset( $_SERVER['HTTP_X_REAL_IP'] ) ) { |
|
24 | - return sanitize_text_field( wp_unslash( $_SERVER['HTTP_X_REAL_IP'] ) ); |
|
23 | + if (isset($_SERVER['HTTP_X_REAL_IP'])) { |
|
24 | + return sanitize_text_field(wp_unslash($_SERVER['HTTP_X_REAL_IP'])); |
|
25 | 25 | } |
26 | 26 | |
27 | - if ( isset( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) { |
|
27 | + if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { |
|
28 | 28 | // Proxy servers can send through this header like this: X-Forwarded-For: client1, proxy1, proxy2 |
29 | 29 | // Make sure we always only send through the first IP in the list which should always be the client IP. |
30 | - return (string) rest_is_ip_address( trim( current( preg_split( '/,/', sanitize_text_field( wp_unslash( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) ) ) ) ); |
|
30 | + return (string) rest_is_ip_address(trim(current(preg_split('/,/', sanitize_text_field(wp_unslash($_SERVER['HTTP_X_FORWARDED_FOR'])))))); |
|
31 | 31 | } |
32 | 32 | |
33 | - if ( isset( $_SERVER['HTTP_CLIENT_IP'] ) ) { |
|
34 | - return sanitize_text_field( wp_unslash( $_SERVER['HTTP_CLIENT_IP'] ) ); |
|
33 | + if (isset($_SERVER['HTTP_CLIENT_IP'])) { |
|
34 | + return sanitize_text_field(wp_unslash($_SERVER['HTTP_CLIENT_IP'])); |
|
35 | 35 | } |
36 | 36 | |
37 | - if ( isset( $_SERVER['REMOTE_ADDR'] ) ) { |
|
38 | - return sanitize_text_field( wp_unslash( $_SERVER['REMOTE_ADDR'] ) ); |
|
37 | + if (isset($_SERVER['REMOTE_ADDR'])) { |
|
38 | + return sanitize_text_field(wp_unslash($_SERVER['REMOTE_ADDR'])); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | return ''; |
42 | 42 | } |
43 | 43 | |
44 | 44 | function wpinv_get_user_agent() { |
45 | - if ( ! empty( $_SERVER['HTTP_USER_AGENT'] ) ) { |
|
46 | - $user_agent = sanitize_text_field( $_SERVER['HTTP_USER_AGENT'] ); |
|
45 | + if (!empty($_SERVER['HTTP_USER_AGENT'])) { |
|
46 | + $user_agent = sanitize_text_field($_SERVER['HTTP_USER_AGENT']); |
|
47 | 47 | } else { |
48 | 48 | $user_agent = ''; |
49 | 49 | } |
50 | 50 | |
51 | - return apply_filters( 'wpinv_get_user_agent', $user_agent ); |
|
51 | + return apply_filters('wpinv_get_user_agent', $user_agent); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
@@ -57,16 +57,16 @@ discard block |
||
57 | 57 | * @param string $amount The amount to sanitize. |
58 | 58 | * @return float |
59 | 59 | */ |
60 | -function getpaid_standardize_amount( $amount ) { |
|
60 | +function getpaid_standardize_amount($amount) { |
|
61 | 61 | |
62 | - $amount = str_replace( wpinv_thousands_separator(), '', $amount ); |
|
63 | - $amount = str_replace( wpinv_decimal_separator(), '.', $amount ); |
|
64 | - if ( is_numeric( $amount ) ) { |
|
65 | - return floatval( $amount ); |
|
62 | + $amount = str_replace(wpinv_thousands_separator(), '', $amount); |
|
63 | + $amount = str_replace(wpinv_decimal_separator(), '.', $amount); |
|
64 | + if (is_numeric($amount)) { |
|
65 | + return floatval($amount); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | // Cast the remaining to a float. |
69 | - return wpinv_round_amount( preg_replace( '/[^0-9\.\-]/', '', $amount ) ); |
|
69 | + return wpinv_round_amount(preg_replace('/[^0-9\.\-]/', '', $amount)); |
|
70 | 70 | |
71 | 71 | } |
72 | 72 | |
@@ -75,8 +75,8 @@ discard block |
||
75 | 75 | * |
76 | 76 | * @param string $amount The amount to sanitize. |
77 | 77 | */ |
78 | -function getpaid_unstandardize_amount( $amount ) { |
|
79 | - return str_replace( '.', wpinv_decimal_separator(), $amount ); |
|
78 | +function getpaid_unstandardize_amount($amount) { |
|
79 | + return str_replace('.', wpinv_decimal_separator(), $amount); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | /** |
@@ -84,23 +84,23 @@ discard block |
||
84 | 84 | * |
85 | 85 | * @param string $amount The amount to sanitize. |
86 | 86 | */ |
87 | -function wpinv_sanitize_amount( $amount ) { |
|
87 | +function wpinv_sanitize_amount($amount) { |
|
88 | 88 | |
89 | - if ( is_numeric( $amount ) ) { |
|
90 | - return floatval( $amount ); |
|
89 | + if (is_numeric($amount)) { |
|
90 | + return floatval($amount); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | // Separate the decimals and thousands. |
94 | - $amount = explode( wpinv_decimal_separator(), $amount ); |
|
94 | + $amount = explode(wpinv_decimal_separator(), $amount); |
|
95 | 95 | |
96 | 96 | // Remove thousands. |
97 | - $amount[0] = str_replace( wpinv_thousands_separator(), '', $amount[0] ); |
|
97 | + $amount[0] = str_replace(wpinv_thousands_separator(), '', $amount[0]); |
|
98 | 98 | |
99 | 99 | // Convert back to string. |
100 | - $amount = count( $amount ) > 1 ? "{$amount[0]}.{$amount[1]}" : $amount[0]; |
|
100 | + $amount = count($amount) > 1 ? "{$amount[0]}.{$amount[1]}" : $amount[0]; |
|
101 | 101 | |
102 | 102 | // Cast the remaining to a float. |
103 | - return (float) preg_replace( '/[^0-9\.\-]/', '', $amount ); |
|
103 | + return (float) preg_replace('/[^0-9\.\-]/', '', $amount); |
|
104 | 104 | |
105 | 105 | } |
106 | 106 | |
@@ -110,19 +110,19 @@ discard block |
||
110 | 110 | * @param float $amount |
111 | 111 | * @param float|string|int|null $decimals |
112 | 112 | */ |
113 | -function wpinv_round_amount( $amount, $decimals = null, $use_sprintf = false ) { |
|
113 | +function wpinv_round_amount($amount, $decimals = null, $use_sprintf = false) { |
|
114 | 114 | |
115 | - if ( $decimals === null ) { |
|
115 | + if ($decimals === null) { |
|
116 | 116 | $decimals = wpinv_decimals(); |
117 | 117 | } |
118 | 118 | |
119 | - if ( $use_sprintf ) { |
|
120 | - $amount = sprintf( "%.{$decimals}f", (float) $amount ); |
|
119 | + if ($use_sprintf) { |
|
120 | + $amount = sprintf("%.{$decimals}f", (float) $amount); |
|
121 | 121 | } else { |
122 | - $amount = round( (float) $amount, absint( $decimals ) ); |
|
122 | + $amount = round((float) $amount, absint($decimals)); |
|
123 | 123 | } |
124 | 124 | |
125 | - return apply_filters( 'wpinv_round_amount', $amount, $decimals ); |
|
125 | + return apply_filters('wpinv_round_amount', $amount, $decimals); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | /** |
@@ -134,32 +134,32 @@ discard block |
||
134 | 134 | * @param string|WPInv_Invoice $invoice The invoice object|post type|type |
135 | 135 | * @return array |
136 | 136 | */ |
137 | -function wpinv_get_invoice_statuses( $draft = false, $trashed = false, $invoice = false ) { |
|
137 | +function wpinv_get_invoice_statuses($draft = false, $trashed = false, $invoice = false) { |
|
138 | 138 | |
139 | 139 | $invoice_statuses = array( |
140 | - 'wpi-pending' => _x( 'Pending payment', 'Invoice status', 'invoicing' ), |
|
141 | - 'publish' => _x( 'Paid', 'Invoice status', 'invoicing' ), |
|
142 | - 'wpi-processing' => _x( 'Processing', 'Invoice status', 'invoicing' ), |
|
143 | - 'wpi-onhold' => _x( 'On hold', 'Invoice status', 'invoicing' ), |
|
144 | - 'wpi-cancelled' => _x( 'Cancelled', 'Invoice status', 'invoicing' ), |
|
145 | - 'wpi-refunded' => _x( 'Refunded', 'Invoice status', 'invoicing' ), |
|
146 | - 'wpi-failed' => _x( 'Failed', 'Invoice status', 'invoicing' ), |
|
147 | - 'wpi-renewal' => _x( 'Renewal Payment', 'Invoice status', 'invoicing' ), |
|
140 | + 'wpi-pending' => _x('Pending payment', 'Invoice status', 'invoicing'), |
|
141 | + 'publish' => _x('Paid', 'Invoice status', 'invoicing'), |
|
142 | + 'wpi-processing' => _x('Processing', 'Invoice status', 'invoicing'), |
|
143 | + 'wpi-onhold' => _x('On hold', 'Invoice status', 'invoicing'), |
|
144 | + 'wpi-cancelled' => _x('Cancelled', 'Invoice status', 'invoicing'), |
|
145 | + 'wpi-refunded' => _x('Refunded', 'Invoice status', 'invoicing'), |
|
146 | + 'wpi-failed' => _x('Failed', 'Invoice status', 'invoicing'), |
|
147 | + 'wpi-renewal' => _x('Renewal Payment', 'Invoice status', 'invoicing'), |
|
148 | 148 | ); |
149 | 149 | |
150 | - if ( $draft ) { |
|
151 | - $invoice_statuses['draft'] = __( 'Draft', 'invoicing' ); |
|
150 | + if ($draft) { |
|
151 | + $invoice_statuses['draft'] = __('Draft', 'invoicing'); |
|
152 | 152 | } |
153 | 153 | |
154 | - if ( $trashed ) { |
|
155 | - $invoice_statuses['trash'] = __( 'Trash', 'invoicing' ); |
|
154 | + if ($trashed) { |
|
155 | + $invoice_statuses['trash'] = __('Trash', 'invoicing'); |
|
156 | 156 | } |
157 | 157 | |
158 | - if ( $invoice instanceof WPInv_Invoice ) { |
|
158 | + if ($invoice instanceof WPInv_Invoice) { |
|
159 | 159 | $invoice = $invoice->get_post_type(); |
160 | 160 | } |
161 | 161 | |
162 | - return apply_filters( 'wpinv_statuses', $invoice_statuses, $invoice ); |
|
162 | + return apply_filters('wpinv_statuses', $invoice_statuses, $invoice); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | /** |
@@ -168,11 +168,11 @@ discard block |
||
168 | 168 | * @param string $status The raw status |
169 | 169 | * @param string|WPInv_Invoice $invoice The invoice object|post type|type |
170 | 170 | */ |
171 | -function wpinv_status_nicename( $status, $invoice = false ) { |
|
172 | - $statuses = wpinv_get_invoice_statuses( true, true, $invoice ); |
|
173 | - $status = isset( $statuses[$status] ) ? $statuses[$status] : $status; |
|
171 | +function wpinv_status_nicename($status, $invoice = false) { |
|
172 | + $statuses = wpinv_get_invoice_statuses(true, true, $invoice); |
|
173 | + $status = isset($statuses[$status]) ? $statuses[$status] : $status; |
|
174 | 174 | |
175 | - return sanitize_text_field( $status ); |
|
175 | + return sanitize_text_field($status); |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | /** |
@@ -180,13 +180,13 @@ discard block |
||
180 | 180 | * |
181 | 181 | * @param string $current |
182 | 182 | */ |
183 | -function wpinv_get_currency( $current = '' ) { |
|
183 | +function wpinv_get_currency($current = '') { |
|
184 | 184 | |
185 | - if ( empty( $current ) ) { |
|
186 | - $current = apply_filters( 'wpinv_currency', wpinv_get_option( 'currency', 'USD' ) ); |
|
185 | + if (empty($current)) { |
|
186 | + $current = apply_filters('wpinv_currency', wpinv_get_option('currency', 'USD')); |
|
187 | 187 | } |
188 | 188 | |
189 | - return trim( strtoupper( $current ) ); |
|
189 | + return trim(strtoupper($current)); |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | /** |
@@ -194,25 +194,25 @@ discard block |
||
194 | 194 | * |
195 | 195 | * @param string|null $currency The currency code. Defaults to the default currency. |
196 | 196 | */ |
197 | -function wpinv_currency_symbol( $currency = null ) { |
|
197 | +function wpinv_currency_symbol($currency = null) { |
|
198 | 198 | |
199 | 199 | // Prepare the currency. |
200 | - $currency = empty( $currency ) ? wpinv_get_currency() : wpinv_clean( $currency ); |
|
200 | + $currency = empty($currency) ? wpinv_get_currency() : wpinv_clean($currency); |
|
201 | 201 | |
202 | 202 | // Fetch all symbols. |
203 | 203 | $symbols = wpinv_get_currency_symbols(); |
204 | 204 | |
205 | 205 | // Fetch this currencies symbol. |
206 | - $currency_symbol = isset( $symbols[$currency] ) ? $symbols[$currency] : $currency; |
|
206 | + $currency_symbol = isset($symbols[$currency]) ? $symbols[$currency] : $currency; |
|
207 | 207 | |
208 | 208 | // Filter the symbol. |
209 | - return apply_filters( 'wpinv_currency_symbol', $currency_symbol, $currency ); |
|
209 | + return apply_filters('wpinv_currency_symbol', $currency_symbol, $currency); |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | function wpinv_currency_position() { |
213 | - $position = wpinv_get_option( 'currency_position', 'left' ); |
|
213 | + $position = wpinv_get_option('currency_position', 'left'); |
|
214 | 214 | |
215 | - return apply_filters( 'wpinv_currency_position', $position ); |
|
215 | + return apply_filters('wpinv_currency_position', $position); |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | /** |
@@ -220,13 +220,13 @@ discard block |
||
220 | 220 | * |
221 | 221 | * @param $string|null $current |
222 | 222 | */ |
223 | -function wpinv_thousands_separator( $current = null ) { |
|
223 | +function wpinv_thousands_separator($current = null) { |
|
224 | 224 | |
225 | - if ( null == $current ) { |
|
226 | - $current = wpinv_get_option( 'thousands_separator', ',' ); |
|
225 | + if (null == $current) { |
|
226 | + $current = wpinv_get_option('thousands_separator', ','); |
|
227 | 227 | } |
228 | 228 | |
229 | - return trim( $current ); |
|
229 | + return trim($current); |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | /** |
@@ -234,13 +234,13 @@ discard block |
||
234 | 234 | * |
235 | 235 | * @param $string|null $current |
236 | 236 | */ |
237 | -function wpinv_decimal_separator( $current = null ) { |
|
237 | +function wpinv_decimal_separator($current = null) { |
|
238 | 238 | |
239 | - if ( null == $current ) { |
|
240 | - $current = wpinv_get_option( 'decimal_separator', '.' ); |
|
239 | + if (null == $current) { |
|
240 | + $current = wpinv_get_option('decimal_separator', '.'); |
|
241 | 241 | } |
242 | 242 | |
243 | - return trim( $current ); |
|
243 | + return trim($current); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | /** |
@@ -248,27 +248,27 @@ discard block |
||
248 | 248 | * |
249 | 249 | * @param $string|null $current |
250 | 250 | */ |
251 | -function wpinv_decimals( $current = null ) { |
|
251 | +function wpinv_decimals($current = null) { |
|
252 | 252 | |
253 | - if ( null == $current ) { |
|
254 | - $current = wpinv_get_option( 'decimals', 2 ); |
|
253 | + if (null == $current) { |
|
254 | + $current = wpinv_get_option('decimals', 2); |
|
255 | 255 | } |
256 | 256 | |
257 | - return absint( $current ); |
|
257 | + return absint($current); |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | /** |
261 | 261 | * Retrieves a list of all supported currencies. |
262 | 262 | */ |
263 | 263 | function wpinv_get_currencies() { |
264 | - return apply_filters( 'wpinv_currencies', wpinv_get_data( 'currencies' ) ); |
|
264 | + return apply_filters('wpinv_currencies', wpinv_get_data('currencies')); |
|
265 | 265 | } |
266 | 266 | |
267 | 267 | /** |
268 | 268 | * Retrieves a list of all currency symbols. |
269 | 269 | */ |
270 | 270 | function wpinv_get_currency_symbols() { |
271 | - return apply_filters( 'wpinv_currency_symbols', wpinv_get_data( 'currency-symbols' ) ); |
|
271 | + return apply_filters('wpinv_currency_symbols', wpinv_get_data('currency-symbols')); |
|
272 | 272 | } |
273 | 273 | |
274 | 274 | /** |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | $currency_pos = wpinv_currency_position(); |
281 | 281 | $format = '%1$s%2$s'; |
282 | 282 | |
283 | - switch ( $currency_pos ) { |
|
283 | + switch ($currency_pos) { |
|
284 | 284 | case 'left': |
285 | 285 | $format = '%1$s%2$s'; |
286 | 286 | break; |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | break; |
296 | 296 | } |
297 | 297 | |
298 | - return apply_filters( 'getpaid_price_format', $format, $currency_pos ); |
|
298 | + return apply_filters('getpaid_price_format', $format, $currency_pos); |
|
299 | 299 | } |
300 | 300 | |
301 | 301 | /** |
@@ -305,25 +305,25 @@ discard block |
||
305 | 305 | * @param string $currency Currency. |
306 | 306 | * @return string |
307 | 307 | */ |
308 | -function wpinv_price( $amount = 0, $currency = '' ) { |
|
308 | +function wpinv_price($amount = 0, $currency = '') { |
|
309 | 309 | |
310 | 310 | // Backwards compatibility. |
311 | - $amount = wpinv_sanitize_amount( $amount ); |
|
311 | + $amount = wpinv_sanitize_amount($amount); |
|
312 | 312 | |
313 | 313 | // Prepare variables. |
314 | - $currency = wpinv_get_currency( $currency ); |
|
314 | + $currency = wpinv_get_currency($currency); |
|
315 | 315 | $amount = (float) $amount; |
316 | 316 | $unformatted_amount = $amount; |
317 | 317 | $negative = $amount < 0; |
318 | - $amount = apply_filters( 'getpaid_raw_amount', floatval( $negative ? $amount * -1 : $amount ) ); |
|
319 | - $amount = wpinv_format_amount( $amount ); |
|
318 | + $amount = apply_filters('getpaid_raw_amount', floatval($negative ? $amount * -1 : $amount)); |
|
319 | + $amount = wpinv_format_amount($amount); |
|
320 | 320 | |
321 | 321 | // Format the amount. |
322 | 322 | $format = getpaid_get_price_format(); |
323 | - $formatted_amount = ( $negative ? '-' : '' ) . sprintf( $format, '<span class="getpaid-currency__symbol">' . wpinv_currency_symbol( $currency ) . '</span>', $amount ); |
|
323 | + $formatted_amount = ($negative ? '-' : '') . sprintf($format, '<span class="getpaid-currency__symbol">' . wpinv_currency_symbol($currency) . '</span>', $amount); |
|
324 | 324 | |
325 | 325 | // Filter the formatting. |
326 | - return apply_filters( 'wpinv_price', $formatted_amount, $amount, $currency, $unformatted_amount ); |
|
326 | + return apply_filters('wpinv_price', $formatted_amount, $amount, $currency, $unformatted_amount); |
|
327 | 327 | } |
328 | 328 | |
329 | 329 | /** |
@@ -334,25 +334,25 @@ discard block |
||
334 | 334 | * @param bool $calculate Whether or not to apply separators. |
335 | 335 | * @return string |
336 | 336 | */ |
337 | -function wpinv_format_amount( $amount, $decimals = null, $calculate = false ) { |
|
337 | +function wpinv_format_amount($amount, $decimals = null, $calculate = false) { |
|
338 | 338 | $thousands_sep = wpinv_thousands_separator(); |
339 | 339 | $decimal_sep = wpinv_decimal_separator(); |
340 | - $decimals = wpinv_decimals( $decimals ); |
|
341 | - $amount = wpinv_sanitize_amount( $amount ); |
|
340 | + $decimals = wpinv_decimals($decimals); |
|
341 | + $amount = wpinv_sanitize_amount($amount); |
|
342 | 342 | |
343 | - if ( $calculate ) { |
|
343 | + if ($calculate) { |
|
344 | 344 | return $amount; |
345 | 345 | } |
346 | 346 | |
347 | 347 | // Fomart the amount. |
348 | - return number_format( $amount, $decimals, $decimal_sep, $thousands_sep ); |
|
348 | + return number_format($amount, $decimals, $decimal_sep, $thousands_sep); |
|
349 | 349 | } |
350 | 350 | |
351 | -function wpinv_sanitize_key( $key ) { |
|
351 | +function wpinv_sanitize_key($key) { |
|
352 | 352 | $raw_key = $key; |
353 | - $key = preg_replace( '/[^a-zA-Z0-9_\-\.\:\/]/', '', $key ); |
|
353 | + $key = preg_replace('/[^a-zA-Z0-9_\-\.\:\/]/', '', $key); |
|
354 | 354 | |
355 | - return apply_filters( 'wpinv_sanitize_key', $key, $raw_key ); |
|
355 | + return apply_filters('wpinv_sanitize_key', $key, $raw_key); |
|
356 | 356 | } |
357 | 357 | |
358 | 358 | /** |
@@ -360,8 +360,8 @@ discard block |
||
360 | 360 | * |
361 | 361 | * @param $str the file whose extension should be retrieved. |
362 | 362 | */ |
363 | -function wpinv_get_file_extension( $str ) { |
|
364 | - $filetype = wp_check_filetype( $str ); |
|
363 | +function wpinv_get_file_extension($str) { |
|
364 | + $filetype = wp_check_filetype($str); |
|
365 | 365 | return $filetype['ext']; |
366 | 366 | } |
367 | 367 | |
@@ -370,16 +370,16 @@ discard block |
||
370 | 370 | * |
371 | 371 | * @param string $string |
372 | 372 | */ |
373 | -function wpinv_string_is_image_url( $string ) { |
|
374 | - $extension = strtolower( wpinv_get_file_extension( $string ) ); |
|
375 | - return in_array( $extension, array( 'jpeg', 'jpg', 'png', 'gif', 'ico' ), true ); |
|
373 | +function wpinv_string_is_image_url($string) { |
|
374 | + $extension = strtolower(wpinv_get_file_extension($string)); |
|
375 | + return in_array($extension, array('jpeg', 'jpg', 'png', 'gif', 'ico'), true); |
|
376 | 376 | } |
377 | 377 | |
378 | 378 | /** |
379 | 379 | * Returns the current URL. |
380 | 380 | */ |
381 | 381 | function wpinv_get_current_page_url() { |
382 | - return ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; |
|
382 | + return (is_ssl() ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; |
|
383 | 383 | } |
384 | 384 | |
385 | 385 | /** |
@@ -389,46 +389,46 @@ discard block |
||
389 | 389 | * @param string $name Constant name. |
390 | 390 | * @param mixed $value Value. |
391 | 391 | */ |
392 | -function getpaid_maybe_define_constant( $name, $value ) { |
|
393 | - if ( ! defined( $name ) ) { |
|
394 | - define( $name, $value ); |
|
392 | +function getpaid_maybe_define_constant($name, $value) { |
|
393 | + if (!defined($name)) { |
|
394 | + define($name, $value); |
|
395 | 395 | } |
396 | 396 | } |
397 | 397 | |
398 | 398 | function wpinv_get_php_arg_separator_output() { |
399 | - return ini_get( 'arg_separator.output' ); |
|
399 | + return ini_get('arg_separator.output'); |
|
400 | 400 | } |
401 | 401 | |
402 | -function wpinv_rgb_from_hex( $color ) { |
|
403 | - $color = str_replace( '#', '', $color ); |
|
402 | +function wpinv_rgb_from_hex($color) { |
|
403 | + $color = str_replace('#', '', $color); |
|
404 | 404 | |
405 | 405 | // Convert shorthand colors to full format, e.g. "FFF" -> "FFFFFF" |
406 | - $color = preg_replace( '~^(.)(.)(.)$~', '$1$1$2$2$3$3', $color ); |
|
407 | - if ( empty( $color ) ) { |
|
406 | + $color = preg_replace('~^(.)(.)(.)$~', '$1$1$2$2$3$3', $color); |
|
407 | + if (empty($color)) { |
|
408 | 408 | return NULL; |
409 | 409 | } |
410 | 410 | |
411 | - $color = str_split( $color ); |
|
411 | + $color = str_split($color); |
|
412 | 412 | |
413 | 413 | $rgb = array(); |
414 | - $rgb['R'] = hexdec( $color[0] . $color[1] ); |
|
415 | - $rgb['G'] = hexdec( $color[2] . $color[3] ); |
|
416 | - $rgb['B'] = hexdec( $color[4] . $color[5] ); |
|
414 | + $rgb['R'] = hexdec($color[0] . $color[1]); |
|
415 | + $rgb['G'] = hexdec($color[2] . $color[3]); |
|
416 | + $rgb['B'] = hexdec($color[4] . $color[5]); |
|
417 | 417 | |
418 | 418 | return $rgb; |
419 | 419 | } |
420 | 420 | |
421 | -function wpinv_hex_darker( $color, $factor = 30 ) { |
|
422 | - $base = wpinv_rgb_from_hex( $color ); |
|
421 | +function wpinv_hex_darker($color, $factor = 30) { |
|
422 | + $base = wpinv_rgb_from_hex($color); |
|
423 | 423 | $color = '#'; |
424 | 424 | |
425 | - foreach ( $base as $k => $v ) { |
|
425 | + foreach ($base as $k => $v) { |
|
426 | 426 | $amount = $v / 100; |
427 | - $amount = round( $amount * $factor ); |
|
427 | + $amount = round($amount * $factor); |
|
428 | 428 | $new_decimal = $v - $amount; |
429 | 429 | |
430 | - $new_hex_component = dechex( $new_decimal ); |
|
431 | - if ( strlen( $new_hex_component ) < 2 ) { |
|
430 | + $new_hex_component = dechex($new_decimal); |
|
431 | + if (strlen($new_hex_component) < 2) { |
|
432 | 432 | $new_hex_component = "0" . $new_hex_component; |
433 | 433 | } |
434 | 434 | $color .= $new_hex_component; |
@@ -437,18 +437,18 @@ discard block |
||
437 | 437 | return $color; |
438 | 438 | } |
439 | 439 | |
440 | -function wpinv_hex_lighter( $color, $factor = 30 ) { |
|
441 | - $base = wpinv_rgb_from_hex( $color ); |
|
440 | +function wpinv_hex_lighter($color, $factor = 30) { |
|
441 | + $base = wpinv_rgb_from_hex($color); |
|
442 | 442 | $color = '#'; |
443 | 443 | |
444 | - foreach ( $base as $k => $v ) { |
|
444 | + foreach ($base as $k => $v) { |
|
445 | 445 | $amount = 255 - $v; |
446 | 446 | $amount = $amount / 100; |
447 | - $amount = round( $amount * $factor ); |
|
447 | + $amount = round($amount * $factor); |
|
448 | 448 | $new_decimal = $v + $amount; |
449 | 449 | |
450 | - $new_hex_component = dechex( $new_decimal ); |
|
451 | - if ( strlen( $new_hex_component ) < 2 ) { |
|
450 | + $new_hex_component = dechex($new_decimal); |
|
451 | + if (strlen($new_hex_component) < 2) { |
|
452 | 452 | $new_hex_component = "0" . $new_hex_component; |
453 | 453 | } |
454 | 454 | $color .= $new_hex_component; |
@@ -457,22 +457,22 @@ discard block |
||
457 | 457 | return $color; |
458 | 458 | } |
459 | 459 | |
460 | -function wpinv_light_or_dark( $color, $dark = '#000000', $light = '#FFFFFF' ) { |
|
461 | - $hex = str_replace( '#', '', $color ); |
|
460 | +function wpinv_light_or_dark($color, $dark = '#000000', $light = '#FFFFFF') { |
|
461 | + $hex = str_replace('#', '', $color); |
|
462 | 462 | |
463 | - $c_r = hexdec( substr( $hex, 0, 2 ) ); |
|
464 | - $c_g = hexdec( substr( $hex, 2, 2 ) ); |
|
465 | - $c_b = hexdec( substr( $hex, 4, 2 ) ); |
|
463 | + $c_r = hexdec(substr($hex, 0, 2)); |
|
464 | + $c_g = hexdec(substr($hex, 2, 2)); |
|
465 | + $c_b = hexdec(substr($hex, 4, 2)); |
|
466 | 466 | |
467 | - $brightness = ( ( $c_r * 299 ) + ( $c_g * 587 ) + ( $c_b * 114 ) ) / 1000; |
|
467 | + $brightness = (($c_r * 299) + ($c_g * 587) + ($c_b * 114)) / 1000; |
|
468 | 468 | |
469 | 469 | return $brightness > 155 ? $dark : $light; |
470 | 470 | } |
471 | 471 | |
472 | -function wpinv_format_hex( $hex ) { |
|
473 | - $hex = trim( str_replace( '#', '', $hex ) ); |
|
472 | +function wpinv_format_hex($hex) { |
|
473 | + $hex = trim(str_replace('#', '', $hex)); |
|
474 | 474 | |
475 | - if ( strlen( $hex ) == 3 ) { |
|
475 | + if (strlen($hex) == 3) { |
|
476 | 476 | $hex = $hex[0] . $hex[0] . $hex[1] . $hex[1] . $hex[2] . $hex[2]; |
477 | 477 | } |
478 | 478 | |
@@ -492,12 +492,12 @@ discard block |
||
492 | 492 | * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8". |
493 | 493 | * @return string |
494 | 494 | */ |
495 | -function wpinv_utf8_strimwidth( $str, $start, $width, $trimmaker = '', $encoding = 'UTF-8' ) { |
|
496 | - if ( function_exists( 'mb_strimwidth' ) ) { |
|
497 | - return mb_strimwidth( $str, $start, $width, $trimmaker, $encoding ); |
|
495 | +function wpinv_utf8_strimwidth($str, $start, $width, $trimmaker = '', $encoding = 'UTF-8') { |
|
496 | + if (function_exists('mb_strimwidth')) { |
|
497 | + return mb_strimwidth($str, $start, $width, $trimmaker, $encoding); |
|
498 | 498 | } |
499 | 499 | |
500 | - return wpinv_utf8_substr( $str, $start, $width, $encoding ) . $trimmaker; |
|
500 | + return wpinv_utf8_substr($str, $start, $width, $encoding) . $trimmaker; |
|
501 | 501 | } |
502 | 502 | |
503 | 503 | /** |
@@ -509,28 +509,28 @@ discard block |
||
509 | 509 | * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8". |
510 | 510 | * @return int Returns the number of characters in string. |
511 | 511 | */ |
512 | -function wpinv_utf8_strlen( $str, $encoding = 'UTF-8' ) { |
|
513 | - if ( function_exists( 'mb_strlen' ) ) { |
|
514 | - return mb_strlen( $str, $encoding ); |
|
512 | +function wpinv_utf8_strlen($str, $encoding = 'UTF-8') { |
|
513 | + if (function_exists('mb_strlen')) { |
|
514 | + return mb_strlen($str, $encoding); |
|
515 | 515 | } |
516 | 516 | |
517 | - return strlen( $str ); |
|
517 | + return strlen($str); |
|
518 | 518 | } |
519 | 519 | |
520 | -function wpinv_utf8_strtolower( $str, $encoding = 'UTF-8' ) { |
|
521 | - if ( function_exists( 'mb_strtolower' ) ) { |
|
522 | - return mb_strtolower( $str, $encoding ); |
|
520 | +function wpinv_utf8_strtolower($str, $encoding = 'UTF-8') { |
|
521 | + if (function_exists('mb_strtolower')) { |
|
522 | + return mb_strtolower($str, $encoding); |
|
523 | 523 | } |
524 | 524 | |
525 | - return strtolower( $str ); |
|
525 | + return strtolower($str); |
|
526 | 526 | } |
527 | 527 | |
528 | -function wpinv_utf8_strtoupper( $str, $encoding = 'UTF-8' ) { |
|
529 | - if ( function_exists( 'mb_strtoupper' ) ) { |
|
530 | - return mb_strtoupper( $str, $encoding ); |
|
528 | +function wpinv_utf8_strtoupper($str, $encoding = 'UTF-8') { |
|
529 | + if (function_exists('mb_strtoupper')) { |
|
530 | + return mb_strtoupper($str, $encoding); |
|
531 | 531 | } |
532 | 532 | |
533 | - return strtoupper( $str ); |
|
533 | + return strtoupper($str); |
|
534 | 534 | } |
535 | 535 | |
536 | 536 | /** |
@@ -544,12 +544,12 @@ discard block |
||
544 | 544 | * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8". |
545 | 545 | * @return int Returns the position of the first occurrence of search in the string. |
546 | 546 | */ |
547 | -function wpinv_utf8_strpos( $str, $find, $offset = 0, $encoding = 'UTF-8' ) { |
|
548 | - if ( function_exists( 'mb_strpos' ) ) { |
|
549 | - return mb_strpos( $str, $find, $offset, $encoding ); |
|
547 | +function wpinv_utf8_strpos($str, $find, $offset = 0, $encoding = 'UTF-8') { |
|
548 | + if (function_exists('mb_strpos')) { |
|
549 | + return mb_strpos($str, $find, $offset, $encoding); |
|
550 | 550 | } |
551 | 551 | |
552 | - return strpos( $str, $find, $offset ); |
|
552 | + return strpos($str, $find, $offset); |
|
553 | 553 | } |
554 | 554 | |
555 | 555 | /** |
@@ -563,12 +563,12 @@ discard block |
||
563 | 563 | * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8". |
564 | 564 | * @return int Returns the position of the last occurrence of search. |
565 | 565 | */ |
566 | -function wpinv_utf8_strrpos( $str, $find, $offset = 0, $encoding = 'UTF-8' ) { |
|
567 | - if ( function_exists( 'mb_strrpos' ) ) { |
|
568 | - return mb_strrpos( $str, $find, $offset, $encoding ); |
|
566 | +function wpinv_utf8_strrpos($str, $find, $offset = 0, $encoding = 'UTF-8') { |
|
567 | + if (function_exists('mb_strrpos')) { |
|
568 | + return mb_strrpos($str, $find, $offset, $encoding); |
|
569 | 569 | } |
570 | 570 | |
571 | - return strrpos( $str, $find, $offset ); |
|
571 | + return strrpos($str, $find, $offset); |
|
572 | 572 | } |
573 | 573 | |
574 | 574 | /** |
@@ -583,16 +583,16 @@ discard block |
||
583 | 583 | * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8". |
584 | 584 | * @return string |
585 | 585 | */ |
586 | -function wpinv_utf8_substr( $str, $start, $length = null, $encoding = 'UTF-8' ) { |
|
587 | - if ( function_exists( 'mb_substr' ) ) { |
|
588 | - if ( $length === null ) { |
|
589 | - return mb_substr( $str, $start, wpinv_utf8_strlen( $str, $encoding ), $encoding ); |
|
586 | +function wpinv_utf8_substr($str, $start, $length = null, $encoding = 'UTF-8') { |
|
587 | + if (function_exists('mb_substr')) { |
|
588 | + if ($length === null) { |
|
589 | + return mb_substr($str, $start, wpinv_utf8_strlen($str, $encoding), $encoding); |
|
590 | 590 | } else { |
591 | - return mb_substr( $str, $start, $length, $encoding ); |
|
591 | + return mb_substr($str, $start, $length, $encoding); |
|
592 | 592 | } |
593 | 593 | } |
594 | 594 | |
595 | - return substr( $str, $start, $length ); |
|
595 | + return substr($str, $start, $length); |
|
596 | 596 | } |
597 | 597 | |
598 | 598 | /** |
@@ -604,48 +604,48 @@ discard block |
||
604 | 604 | * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8". |
605 | 605 | * @return string The width of string. |
606 | 606 | */ |
607 | -function wpinv_utf8_strwidth( $str, $encoding = 'UTF-8' ) { |
|
608 | - if ( function_exists( 'mb_strwidth' ) ) { |
|
609 | - return mb_strwidth( $str, $encoding ); |
|
607 | +function wpinv_utf8_strwidth($str, $encoding = 'UTF-8') { |
|
608 | + if (function_exists('mb_strwidth')) { |
|
609 | + return mb_strwidth($str, $encoding); |
|
610 | 610 | } |
611 | 611 | |
612 | - return wpinv_utf8_strlen( $str, $encoding ); |
|
612 | + return wpinv_utf8_strlen($str, $encoding); |
|
613 | 613 | } |
614 | 614 | |
615 | -function wpinv_utf8_ucfirst( $str, $lower_str_end = false, $encoding = 'UTF-8' ) { |
|
616 | - if ( function_exists( 'mb_strlen' ) ) { |
|
617 | - $first_letter = wpinv_utf8_strtoupper( wpinv_utf8_substr( $str, 0, 1, $encoding ), $encoding ); |
|
615 | +function wpinv_utf8_ucfirst($str, $lower_str_end = false, $encoding = 'UTF-8') { |
|
616 | + if (function_exists('mb_strlen')) { |
|
617 | + $first_letter = wpinv_utf8_strtoupper(wpinv_utf8_substr($str, 0, 1, $encoding), $encoding); |
|
618 | 618 | $str_end = ""; |
619 | 619 | |
620 | - if ( $lower_str_end ) { |
|
621 | - $str_end = wpinv_utf8_strtolower( wpinv_utf8_substr( $str, 1, wpinv_utf8_strlen( $str, $encoding ), $encoding ), $encoding ); |
|
620 | + if ($lower_str_end) { |
|
621 | + $str_end = wpinv_utf8_strtolower(wpinv_utf8_substr($str, 1, wpinv_utf8_strlen($str, $encoding), $encoding), $encoding); |
|
622 | 622 | } else { |
623 | - $str_end = wpinv_utf8_substr( $str, 1, wpinv_utf8_strlen( $str, $encoding ), $encoding ); |
|
623 | + $str_end = wpinv_utf8_substr($str, 1, wpinv_utf8_strlen($str, $encoding), $encoding); |
|
624 | 624 | } |
625 | 625 | |
626 | 626 | return $first_letter . $str_end; |
627 | 627 | } |
628 | 628 | |
629 | - return ucfirst( $str ); |
|
629 | + return ucfirst($str); |
|
630 | 630 | } |
631 | 631 | |
632 | -function wpinv_utf8_ucwords( $str, $encoding = 'UTF-8' ) { |
|
633 | - if ( function_exists( 'mb_convert_case' ) ) { |
|
634 | - return mb_convert_case( $str, MB_CASE_TITLE, $encoding ); |
|
632 | +function wpinv_utf8_ucwords($str, $encoding = 'UTF-8') { |
|
633 | + if (function_exists('mb_convert_case')) { |
|
634 | + return mb_convert_case($str, MB_CASE_TITLE, $encoding); |
|
635 | 635 | } |
636 | 636 | |
637 | - return ucwords( $str ); |
|
637 | + return ucwords($str); |
|
638 | 638 | } |
639 | 639 | |
640 | -function wpinv_period_in_days( $period, $unit ) { |
|
641 | - $period = absint( $period ); |
|
640 | +function wpinv_period_in_days($period, $unit) { |
|
641 | + $period = absint($period); |
|
642 | 642 | |
643 | - if ( $period > 0 ) { |
|
644 | - if ( in_array( strtolower( $unit ), array( 'w', 'week', 'weeks' ) ) ) { |
|
643 | + if ($period > 0) { |
|
644 | + if (in_array(strtolower($unit), array('w', 'week', 'weeks'))) { |
|
645 | 645 | $period = $period * 7; |
646 | - } else if ( in_array( strtolower( $unit ), array( 'm', 'month', 'months' ) ) ) { |
|
646 | + } else if (in_array(strtolower($unit), array('m', 'month', 'months'))) { |
|
647 | 647 | $period = $period * 30; |
648 | - } else if ( in_array( strtolower( $unit ), array( 'y', 'year', 'years' ) ) ) { |
|
648 | + } else if (in_array(strtolower($unit), array('y', 'year', 'years'))) { |
|
649 | 649 | $period = $period * 365; |
650 | 650 | } |
651 | 651 | } |
@@ -653,14 +653,14 @@ discard block |
||
653 | 653 | return $period; |
654 | 654 | } |
655 | 655 | |
656 | -function wpinv_cal_days_in_month( $calendar, $month, $year ) { |
|
657 | - if ( function_exists( 'cal_days_in_month' ) ) { |
|
658 | - return cal_days_in_month( $calendar, $month, $year ); |
|
656 | +function wpinv_cal_days_in_month($calendar, $month, $year) { |
|
657 | + if (function_exists('cal_days_in_month')) { |
|
658 | + return cal_days_in_month($calendar, $month, $year); |
|
659 | 659 | } |
660 | 660 | |
661 | 661 | // Fallback in case the calendar extension is not loaded in PHP |
662 | 662 | // Only supports Gregorian calendar |
663 | - return date( 't', mktime( 0, 0, 0, $month, 1, $year ) ); |
|
663 | + return date('t', mktime(0, 0, 0, $month, 1, $year)); |
|
664 | 664 | } |
665 | 665 | |
666 | 666 | /** |
@@ -671,15 +671,15 @@ discard block |
||
671 | 671 | * |
672 | 672 | * @return string |
673 | 673 | */ |
674 | -function wpi_help_tip( $tip, $allow_html = false, $is_vue = false ) { |
|
674 | +function wpi_help_tip($tip, $allow_html = false, $is_vue = false) { |
|
675 | 675 | |
676 | - if ( $allow_html ) { |
|
677 | - $tip = wpi_sanitize_tooltip( $tip ); |
|
676 | + if ($allow_html) { |
|
677 | + $tip = wpi_sanitize_tooltip($tip); |
|
678 | 678 | } else { |
679 | - $tip = esc_attr( $tip ); |
|
679 | + $tip = esc_attr($tip); |
|
680 | 680 | } |
681 | 681 | |
682 | - if ( $is_vue ) { |
|
682 | + if ($is_vue) { |
|
683 | 683 | return '<span class="dashicons dashicons-editor-help" title="' . $tip . '"></span>'; |
684 | 684 | } |
685 | 685 | |
@@ -694,8 +694,8 @@ discard block |
||
694 | 694 | * @param string $var |
695 | 695 | * @return string |
696 | 696 | */ |
697 | -function wpi_sanitize_tooltip( $var ) { |
|
698 | - return wp_kses( html_entity_decode( $var ), array( |
|
697 | +function wpi_sanitize_tooltip($var) { |
|
698 | + return wp_kses(html_entity_decode($var), array( |
|
699 | 699 | 'br' => array(), |
700 | 700 | 'em' => array(), |
701 | 701 | 'strong' => array(), |
@@ -706,7 +706,7 @@ discard block |
||
706 | 706 | 'li' => array(), |
707 | 707 | 'ol' => array(), |
708 | 708 | 'p' => array(), |
709 | - ) ); |
|
709 | + )); |
|
710 | 710 | } |
711 | 711 | |
712 | 712 | /** |
@@ -716,7 +716,7 @@ discard block |
||
716 | 716 | */ |
717 | 717 | function wpinv_get_screen_ids() { |
718 | 718 | |
719 | - $screen_id = sanitize_title( __( 'Invoicing', 'invoicing' ) ); |
|
719 | + $screen_id = sanitize_title(__('Invoicing', 'invoicing')); |
|
720 | 720 | |
721 | 721 | $screen_ids = array( |
722 | 722 | 'toplevel_page_' . $screen_id, |
@@ -735,10 +735,10 @@ discard block |
||
735 | 735 | 'getpaid_page_wpinv-reports', |
736 | 736 | 'getpaid_page_wpi-addons', |
737 | 737 | 'getpaid_page_wpinv-customers', |
738 | - 'gp-setup',// setup wizard |
|
738 | + 'gp-setup', // setup wizard |
|
739 | 739 | ); |
740 | 740 | |
741 | - return apply_filters( 'wpinv_screen_ids', $screen_ids ); |
|
741 | + return apply_filters('wpinv_screen_ids', $screen_ids); |
|
742 | 742 | } |
743 | 743 | |
744 | 744 | /** |
@@ -749,14 +749,14 @@ discard block |
||
749 | 749 | * @param array|string $list List of values. |
750 | 750 | * @return array Sanitized array of values. |
751 | 751 | */ |
752 | -function wpinv_parse_list( $list ) { |
|
752 | +function wpinv_parse_list($list) { |
|
753 | 753 | |
754 | - if ( empty( $list ) ) { |
|
754 | + if (empty($list)) { |
|
755 | 755 | $list = array(); |
756 | 756 | } |
757 | 757 | |
758 | - if ( ! is_array( $list ) ) { |
|
759 | - return preg_split( '/[\s,]+/', $list, -1, PREG_SPLIT_NO_EMPTY ); |
|
758 | + if (!is_array($list)) { |
|
759 | + return preg_split('/[\s,]+/', $list, -1, PREG_SPLIT_NO_EMPTY); |
|
760 | 760 | } |
761 | 761 | |
762 | 762 | return $list; |
@@ -770,16 +770,16 @@ discard block |
||
770 | 770 | * @param string $key Type of data to fetch. |
771 | 771 | * @return mixed Fetched data. |
772 | 772 | */ |
773 | -function wpinv_get_data( $key ) { |
|
773 | +function wpinv_get_data($key) { |
|
774 | 774 | |
775 | 775 | // Try fetching it from the cache. |
776 | - $data = wp_cache_get( "wpinv-data-$key", 'wpinv' ); |
|
777 | - if( $data ) { |
|
776 | + $data = wp_cache_get("wpinv-data-$key", 'wpinv'); |
|
777 | + if ($data) { |
|
778 | 778 | return $data; |
779 | 779 | } |
780 | 780 | |
781 | - $data = apply_filters( "wpinv_get_$key", include WPINV_PLUGIN_DIR . "includes/data/$key.php" ); |
|
782 | - wp_cache_set( "wpinv-data-$key", $data, 'wpinv' ); |
|
781 | + $data = apply_filters("wpinv_get_$key", include WPINV_PLUGIN_DIR . "includes/data/$key.php"); |
|
782 | + wp_cache_set("wpinv-data-$key", $data, 'wpinv'); |
|
783 | 783 | |
784 | 784 | return $data; |
785 | 785 | } |
@@ -793,10 +793,10 @@ discard block |
||
793 | 793 | * @param bool $first_empty Whether or not the first item in the list should be empty |
794 | 794 | * @return mixed Fetched data. |
795 | 795 | */ |
796 | -function wpinv_maybe_add_empty_option( $options, $first_empty ) { |
|
796 | +function wpinv_maybe_add_empty_option($options, $first_empty) { |
|
797 | 797 | |
798 | - if ( ! empty( $options ) && $first_empty ) { |
|
799 | - return array_merge( array( '' => '' ), $options ); |
|
798 | + if (!empty($options) && $first_empty) { |
|
799 | + return array_merge(array('' => ''), $options); |
|
800 | 800 | } |
801 | 801 | return $options; |
802 | 802 | |
@@ -808,21 +808,21 @@ discard block |
||
808 | 808 | * @param mixed $var Data to sanitize. |
809 | 809 | * @return string|array |
810 | 810 | */ |
811 | -function wpinv_clean( $var ) { |
|
811 | +function wpinv_clean($var) { |
|
812 | 812 | |
813 | - if ( is_array( $var ) ) { |
|
814 | - return array_map( 'wpinv_clean', $var ); |
|
813 | + if (is_array($var)) { |
|
814 | + return array_map('wpinv_clean', $var); |
|
815 | 815 | } |
816 | 816 | |
817 | - if ( is_object( $var ) ) { |
|
818 | - $object_vars = get_object_vars( $var ); |
|
819 | - foreach ( $object_vars as $property_name => $property_value ) { |
|
820 | - $var->$property_name = wpinv_clean( $property_value ); |
|
817 | + if (is_object($var)) { |
|
818 | + $object_vars = get_object_vars($var); |
|
819 | + foreach ($object_vars as $property_name => $property_value) { |
|
820 | + $var->$property_name = wpinv_clean($property_value); |
|
821 | 821 | } |
822 | 822 | return $var; |
823 | 823 | } |
824 | 824 | |
825 | - return is_string( $var ) ? sanitize_text_field( stripslashes( $var ) ) : $var; |
|
825 | + return is_string($var) ? sanitize_text_field(stripslashes($var)) : $var; |
|
826 | 826 | } |
827 | 827 | |
828 | 828 | /** |
@@ -831,43 +831,43 @@ discard block |
||
831 | 831 | * @param string $str Data to convert. |
832 | 832 | * @return string|array |
833 | 833 | */ |
834 | -function getpaid_convert_price_string_to_options( $str ) { |
|
834 | +function getpaid_convert_price_string_to_options($str) { |
|
835 | 835 | |
836 | - $raw_options = array_map( 'trim', explode( ',', $str ) ); |
|
837 | - $options = array(); |
|
836 | + $raw_options = array_map('trim', explode(',', $str)); |
|
837 | + $options = array(); |
|
838 | 838 | |
839 | - foreach ( $raw_options as $option ) { |
|
839 | + foreach ($raw_options as $option) { |
|
840 | 840 | |
841 | - if ( '' == $option ) { |
|
841 | + if ('' == $option) { |
|
842 | 842 | continue; |
843 | 843 | } |
844 | 844 | |
845 | - $option = array_map( 'trim', explode( '|', $option ) ); |
|
845 | + $option = array_map('trim', explode('|', $option)); |
|
846 | 846 | |
847 | 847 | $price = null; |
848 | 848 | $label = null; |
849 | 849 | |
850 | - if ( isset( $option[0] ) && '' != $option[0] ) { |
|
851 | - $label = $option[0]; |
|
850 | + if (isset($option[0]) && '' != $option[0]) { |
|
851 | + $label = $option[0]; |
|
852 | 852 | } |
853 | 853 | |
854 | - if ( isset( $option[1] ) && '' != $option[1] ) { |
|
854 | + if (isset($option[1]) && '' != $option[1]) { |
|
855 | 855 | $price = $option[1]; |
856 | 856 | } |
857 | 857 | |
858 | - if ( ! isset( $price ) ) { |
|
858 | + if (!isset($price)) { |
|
859 | 859 | $price = $label; |
860 | 860 | } |
861 | 861 | |
862 | - if ( ! isset( $price ) || ! is_numeric( $price ) ) { |
|
862 | + if (!isset($price) || !is_numeric($price)) { |
|
863 | 863 | continue; |
864 | 864 | } |
865 | 865 | |
866 | - if ( ! isset( $label ) ) { |
|
866 | + if (!isset($label)) { |
|
867 | 867 | $label = $price; |
868 | 868 | } |
869 | 869 | |
870 | - $options[ "$label|$price" ] = $label; |
|
870 | + $options["$label|$price"] = $label; |
|
871 | 871 | } |
872 | 872 | |
873 | 873 | return $options; |
@@ -876,27 +876,27 @@ discard block |
||
876 | 876 | /** |
877 | 877 | * Returns the help tip. |
878 | 878 | */ |
879 | -function getpaid_get_help_tip( $tip, $additional_classes = '' ) { |
|
880 | - $additional_classes = sanitize_html_class( $additional_classes ); |
|
881 | - $tip = esc_attr__( $tip ); |
|
879 | +function getpaid_get_help_tip($tip, $additional_classes = '') { |
|
880 | + $additional_classes = sanitize_html_class($additional_classes); |
|
881 | + $tip = esc_attr__($tip); |
|
882 | 882 | return "<span class='wpi-help-tip dashicons dashicons-editor-help $additional_classes' title='$tip'></span>"; |
883 | 883 | } |
884 | 884 | |
885 | 885 | /** |
886 | 886 | * Formats a date |
887 | 887 | */ |
888 | -function getpaid_format_date( $date, $with_time = false ) { |
|
888 | +function getpaid_format_date($date, $with_time = false) { |
|
889 | 889 | |
890 | - if ( empty( $date ) || $date == '0000-00-00 00:00:00' ) { |
|
890 | + if (empty($date) || $date == '0000-00-00 00:00:00') { |
|
891 | 891 | return ''; |
892 | 892 | } |
893 | 893 | |
894 | 894 | $format = getpaid_date_format(); |
895 | 895 | |
896 | - if ( $with_time ) { |
|
896 | + if ($with_time) { |
|
897 | 897 | $format .= ' ' . getpaid_time_format(); |
898 | 898 | } |
899 | - return date_i18n( $format, strtotime( $date ) ); |
|
899 | + return date_i18n($format, strtotime($date)); |
|
900 | 900 | |
901 | 901 | } |
902 | 902 | |
@@ -905,9 +905,9 @@ discard block |
||
905 | 905 | * |
906 | 906 | * @return string |
907 | 907 | */ |
908 | -function getpaid_format_date_value( $date, $default = "—", $with_time = false ) { |
|
909 | - $date = getpaid_format_date( $date, $with_time ); |
|
910 | - return empty( $date ) ? $default : $date; |
|
908 | +function getpaid_format_date_value($date, $default = "—", $with_time = false) { |
|
909 | + $date = getpaid_format_date($date, $with_time); |
|
910 | + return empty($date) ? $default : $date; |
|
911 | 911 | } |
912 | 912 | |
913 | 913 | /** |
@@ -916,7 +916,7 @@ discard block |
||
916 | 916 | * @return string |
917 | 917 | */ |
918 | 918 | function getpaid_date_format() { |
919 | - return apply_filters( 'getpaid_date_format', get_option( 'date_format' ) ); |
|
919 | + return apply_filters('getpaid_date_format', get_option('date_format')); |
|
920 | 920 | } |
921 | 921 | |
922 | 922 | /** |
@@ -925,7 +925,7 @@ discard block |
||
925 | 925 | * @return string |
926 | 926 | */ |
927 | 927 | function getpaid_time_format() { |
928 | - return apply_filters( 'getpaid_time_format', get_option( 'time_format' ) ); |
|
928 | + return apply_filters('getpaid_time_format', get_option('time_format')); |
|
929 | 929 | } |
930 | 930 | |
931 | 931 | /** |
@@ -935,16 +935,16 @@ discard block |
||
935 | 935 | * @param integer $limit Limit size in characters. |
936 | 936 | * @return string |
937 | 937 | */ |
938 | -function getpaid_limit_length( $string, $limit ) { |
|
938 | +function getpaid_limit_length($string, $limit) { |
|
939 | 939 | $str_limit = $limit - 3; |
940 | 940 | |
941 | - if ( function_exists( 'mb_strimwidth' ) ) { |
|
942 | - if ( mb_strlen( $string ) > $limit ) { |
|
943 | - $string = mb_strimwidth( $string, 0, $str_limit ) . '...'; |
|
941 | + if (function_exists('mb_strimwidth')) { |
|
942 | + if (mb_strlen($string) > $limit) { |
|
943 | + $string = mb_strimwidth($string, 0, $str_limit) . '...'; |
|
944 | 944 | } |
945 | 945 | } else { |
946 | - if ( strlen( $string ) > $limit ) { |
|
947 | - $string = substr( $string, 0, $str_limit ) . '...'; |
|
946 | + if (strlen($string) > $limit) { |
|
947 | + $string = substr($string, 0, $str_limit) . '...'; |
|
948 | 948 | } |
949 | 949 | } |
950 | 950 | return $string; |
@@ -958,7 +958,7 @@ discard block |
||
958 | 958 | * @since 1.0.19 |
959 | 959 | */ |
960 | 960 | function getpaid_api() { |
961 | - return getpaid()->get( 'api' ); |
|
961 | + return getpaid()->get('api'); |
|
962 | 962 | } |
963 | 963 | |
964 | 964 | /** |
@@ -968,7 +968,7 @@ discard block |
||
968 | 968 | * @since 1.0.19 |
969 | 969 | */ |
970 | 970 | function getpaid_post_types() { |
971 | - return getpaid()->get( 'post_types' ); |
|
971 | + return getpaid()->get('post_types'); |
|
972 | 972 | } |
973 | 973 | |
974 | 974 | /** |
@@ -978,7 +978,7 @@ discard block |
||
978 | 978 | * @since 1.0.19 |
979 | 979 | */ |
980 | 980 | function getpaid_session() { |
981 | - return getpaid()->get( 'session' ); |
|
981 | + return getpaid()->get('session'); |
|
982 | 982 | } |
983 | 983 | |
984 | 984 | /** |
@@ -988,7 +988,7 @@ discard block |
||
988 | 988 | * @since 1.0.19 |
989 | 989 | */ |
990 | 990 | function getpaid_notes() { |
991 | - return getpaid()->get( 'notes' ); |
|
991 | + return getpaid()->get('notes'); |
|
992 | 992 | } |
993 | 993 | |
994 | 994 | /** |
@@ -997,7 +997,7 @@ discard block |
||
997 | 997 | * @return GetPaid_Admin |
998 | 998 | */ |
999 | 999 | function getpaid_admin() { |
1000 | - return getpaid()->get( 'admin' ); |
|
1000 | + return getpaid()->get('admin'); |
|
1001 | 1001 | } |
1002 | 1002 | |
1003 | 1003 | /** |
@@ -1007,8 +1007,8 @@ discard block |
||
1007 | 1007 | * @param string $base the base url |
1008 | 1008 | * @return string |
1009 | 1009 | */ |
1010 | -function getpaid_get_authenticated_action_url( $action, $base = false ) { |
|
1011 | - return wp_nonce_url( add_query_arg( 'getpaid-action', $action, $base ), 'getpaid-nonce', 'getpaid-nonce' ); |
|
1010 | +function getpaid_get_authenticated_action_url($action, $base = false) { |
|
1011 | + return wp_nonce_url(add_query_arg('getpaid-action', $action, $base), 'getpaid-nonce', 'getpaid-nonce'); |
|
1012 | 1012 | } |
1013 | 1013 | |
1014 | 1014 | /** |
@@ -1016,11 +1016,11 @@ discard block |
||
1016 | 1016 | * |
1017 | 1017 | * @return string |
1018 | 1018 | */ |
1019 | -function getpaid_get_post_type_label( $post_type, $plural = true ) { |
|
1019 | +function getpaid_get_post_type_label($post_type, $plural = true) { |
|
1020 | 1020 | |
1021 | - $post_type = get_post_type_object( $post_type ); |
|
1021 | + $post_type = get_post_type_object($post_type); |
|
1022 | 1022 | |
1023 | - if ( ! is_object( $post_type ) ) { |
|
1023 | + if (!is_object($post_type)) { |
|
1024 | 1024 | return null; |
1025 | 1025 | } |
1026 | 1026 | |
@@ -1033,18 +1033,18 @@ discard block |
||
1033 | 1033 | * |
1034 | 1034 | * @return mixed|null |
1035 | 1035 | */ |
1036 | -function getpaid_get_array_field( $array, $key, $secondary_key = null ) { |
|
1036 | +function getpaid_get_array_field($array, $key, $secondary_key = null) { |
|
1037 | 1037 | |
1038 | - if ( ! is_array( $array ) ) { |
|
1038 | + if (!is_array($array)) { |
|
1039 | 1039 | return null; |
1040 | 1040 | } |
1041 | 1041 | |
1042 | - if ( ! empty( $secondary_key ) ) { |
|
1043 | - $array = isset( $array[ $secondary_key ] ) ? $array[ $secondary_key ] : array(); |
|
1044 | - return getpaid_get_array_field( $array, $key ); |
|
1042 | + if (!empty($secondary_key)) { |
|
1043 | + $array = isset($array[$secondary_key]) ? $array[$secondary_key] : array(); |
|
1044 | + return getpaid_get_array_field($array, $key); |
|
1045 | 1045 | } |
1046 | 1046 | |
1047 | - return isset( $array[ $key ] ) ? $array[ $key ] : null; |
|
1047 | + return isset($array[$key]) ? $array[$key] : null; |
|
1048 | 1048 | |
1049 | 1049 | } |
1050 | 1050 | |
@@ -1053,12 +1053,12 @@ discard block |
||
1053 | 1053 | * |
1054 | 1054 | * @return array |
1055 | 1055 | */ |
1056 | -function getpaid_array_merge_if_empty( $args, $defaults ) { |
|
1056 | +function getpaid_array_merge_if_empty($args, $defaults) { |
|
1057 | 1057 | |
1058 | - foreach ( $defaults as $key => $value ) { |
|
1058 | + foreach ($defaults as $key => $value) { |
|
1059 | 1059 | |
1060 | - if ( array_key_exists( $key, $args ) && empty( $args[ $key ] ) ) { |
|
1061 | - $args[ $key ] = $value; |
|
1060 | + if (array_key_exists($key, $args) && empty($args[$key])) { |
|
1061 | + $args[$key] = $value; |
|
1062 | 1062 | } |
1063 | 1063 | |
1064 | 1064 | } |
@@ -1076,12 +1076,12 @@ discard block |
||
1076 | 1076 | |
1077 | 1077 | $types = get_allowed_mime_types(); |
1078 | 1078 | |
1079 | - if ( isset( $types['htm|html'] ) ) { |
|
1080 | - unset( $types['htm|html'] ); |
|
1079 | + if (isset($types['htm|html'])) { |
|
1080 | + unset($types['htm|html']); |
|
1081 | 1081 | } |
1082 | 1082 | |
1083 | - if ( isset( $types['js'] ) ) { |
|
1084 | - unset( $types['js'] ); |
|
1083 | + if (isset($types['js'])) { |
|
1084 | + unset($types['js']); |
|
1085 | 1085 | } |
1086 | 1086 | |
1087 | 1087 | return $types; |
@@ -9,41 +9,41 @@ discard block |
||
9 | 9 | * @version 1.0.19 |
10 | 10 | */ |
11 | 11 | |
12 | -defined( 'ABSPATH' ) || exit; |
|
12 | +defined('ABSPATH') || exit; |
|
13 | 13 | |
14 | 14 | return array( |
15 | 15 | |
16 | 16 | array( |
17 | 17 | 'type' => 'heading', |
18 | - 'name' => __( 'Heading', 'invoicing' ), |
|
18 | + 'name' => __('Heading', 'invoicing'), |
|
19 | 19 | 'defaults' => array( |
20 | 20 | 'level' => 'h2', |
21 | - 'text' => __( 'Heading', 'invoicing' ), |
|
21 | + 'text' => __('Heading', 'invoicing'), |
|
22 | 22 | ) |
23 | 23 | ), |
24 | 24 | |
25 | 25 | array( |
26 | 26 | 'type' => 'paragraph', |
27 | - 'name' => __( 'Paragraph', 'invoicing' ), |
|
27 | + 'name' => __('Paragraph', 'invoicing'), |
|
28 | 28 | 'defaults' => array( |
29 | - 'text' => __( 'Paragraph text', 'invoicing' ), |
|
29 | + 'text' => __('Paragraph text', 'invoicing'), |
|
30 | 30 | ) |
31 | 31 | ), |
32 | 32 | |
33 | 33 | array( |
34 | 34 | 'type' => 'alert', |
35 | - 'name' => __( 'Alert', 'invoicing' ), |
|
35 | + 'name' => __('Alert', 'invoicing'), |
|
36 | 36 | 'defaults' => array( |
37 | 37 | 'value' => '', |
38 | 38 | 'class' => 'alert-warning', |
39 | - 'text' => __( 'Alert', 'invoicing' ), |
|
39 | + 'text' => __('Alert', 'invoicing'), |
|
40 | 40 | 'dismissible' => false, |
41 | 41 | ) |
42 | 42 | ), |
43 | 43 | |
44 | 44 | array( |
45 | 45 | 'type' => 'separator', |
46 | - 'name' => __( 'Separator', 'invoicing' ), |
|
46 | + 'name' => __('Separator', 'invoicing'), |
|
47 | 47 | 'defaults' => array( |
48 | 48 | 'value' => '', |
49 | 49 | ), |
@@ -51,11 +51,11 @@ discard block |
||
51 | 51 | |
52 | 52 | array( |
53 | 53 | 'type' => 'text', |
54 | - 'name' => __( 'Text Input', 'invoicing' ), |
|
54 | + 'name' => __('Text Input', 'invoicing'), |
|
55 | 55 | 'defaults' => array( |
56 | - 'placeholder' => __( 'Enter some text', 'invoicing' ), |
|
56 | + 'placeholder' => __('Enter some text', 'invoicing'), |
|
57 | 57 | 'value' => '', |
58 | - 'label' => __( 'Field Label', 'invoicing' ), |
|
58 | + 'label' => __('Field Label', 'invoicing'), |
|
59 | 59 | 'description' => '', |
60 | 60 | 'required' => false, |
61 | 61 | ) |
@@ -63,11 +63,11 @@ discard block |
||
63 | 63 | |
64 | 64 | array( |
65 | 65 | 'type' => 'textarea', |
66 | - 'name' => __( 'Textarea', 'invoicing' ), |
|
66 | + 'name' => __('Textarea', 'invoicing'), |
|
67 | 67 | 'defaults' => array( |
68 | - 'placeholder' => __( 'Enter your text here', 'invoicing' ), |
|
68 | + 'placeholder' => __('Enter your text here', 'invoicing'), |
|
69 | 69 | 'value' => '', |
70 | - 'label' => __( 'Textarea Label', 'invoicing' ), |
|
70 | + 'label' => __('Textarea Label', 'invoicing'), |
|
71 | 71 | 'description' => '', |
72 | 72 | 'required' => false, |
73 | 73 | ) |
@@ -75,27 +75,27 @@ discard block |
||
75 | 75 | |
76 | 76 | array( |
77 | 77 | 'type' => 'select', |
78 | - 'name' => __( 'Dropdown', 'invoicing' ), |
|
78 | + 'name' => __('Dropdown', 'invoicing'), |
|
79 | 79 | 'defaults' => array( |
80 | - 'placeholder' => __( 'Select a value', 'invoicing' ), |
|
80 | + 'placeholder' => __('Select a value', 'invoicing'), |
|
81 | 81 | 'value' => '', |
82 | - 'label' => __( 'Dropdown Label', 'invoicing' ), |
|
82 | + 'label' => __('Dropdown Label', 'invoicing'), |
|
83 | 83 | 'description' => '', |
84 | 84 | 'required' => false, |
85 | 85 | 'options' => array( |
86 | - esc_attr__( 'Option One', 'invoicing' ), |
|
87 | - esc_attr__( 'Option Two', 'invoicing' ), |
|
88 | - esc_attr__( 'Option Three', 'invoicing' ) |
|
86 | + esc_attr__('Option One', 'invoicing'), |
|
87 | + esc_attr__('Option Two', 'invoicing'), |
|
88 | + esc_attr__('Option Three', 'invoicing') |
|
89 | 89 | ), |
90 | 90 | ) |
91 | 91 | ), |
92 | 92 | |
93 | 93 | array( |
94 | 94 | 'type' => 'checkbox', |
95 | - 'name' => __( 'Checkbox', 'invoicing' ), |
|
95 | + 'name' => __('Checkbox', 'invoicing'), |
|
96 | 96 | 'defaults' => array( |
97 | 97 | 'value' => '', |
98 | - 'label' => __( 'Checkbox Label', 'invoicing' ), |
|
98 | + 'label' => __('Checkbox Label', 'invoicing'), |
|
99 | 99 | 'description' => '', |
100 | 100 | 'required' => false, |
101 | 101 | ) |
@@ -103,23 +103,23 @@ discard block |
||
103 | 103 | |
104 | 104 | array( |
105 | 105 | 'type' => 'radio', |
106 | - 'name' => __( 'Radio', 'invoicing' ), |
|
106 | + 'name' => __('Radio', 'invoicing'), |
|
107 | 107 | 'defaults' => array( |
108 | - 'label' => __( 'Select one choice', 'invoicing' ), |
|
108 | + 'label' => __('Select one choice', 'invoicing'), |
|
109 | 109 | 'options' => array( |
110 | - esc_attr__( 'Choice One', 'invoicing' ), |
|
111 | - esc_attr__( 'Choice Two', 'invoicing' ), |
|
112 | - esc_attr__( 'Choice Three', 'invoicing' ) |
|
110 | + esc_attr__('Choice One', 'invoicing'), |
|
111 | + esc_attr__('Choice Two', 'invoicing'), |
|
112 | + esc_attr__('Choice Three', 'invoicing') |
|
113 | 113 | ), |
114 | 114 | ) |
115 | 115 | ), |
116 | 116 | |
117 | 117 | array( |
118 | 118 | 'type' => 'date', |
119 | - 'name' => __( 'Date', 'invoicing' ), |
|
119 | + 'name' => __('Date', 'invoicing'), |
|
120 | 120 | 'defaults' => array( |
121 | 121 | 'value' => '', |
122 | - 'label' => __( 'Date', 'invoicing' ), |
|
122 | + 'label' => __('Date', 'invoicing'), |
|
123 | 123 | 'description' => '', |
124 | 124 | 'single' => 'single', |
125 | 125 | 'required' => false, |
@@ -128,10 +128,10 @@ discard block |
||
128 | 128 | |
129 | 129 | array( |
130 | 130 | 'type' => 'time', |
131 | - 'name' => __( 'Time', 'invoicing' ), |
|
131 | + 'name' => __('Time', 'invoicing'), |
|
132 | 132 | 'defaults' => array( |
133 | 133 | 'value' => '', |
134 | - 'label' => __( 'Time', 'invoicing' ), |
|
134 | + 'label' => __('Time', 'invoicing'), |
|
135 | 135 | 'description' => '', |
136 | 136 | 'required' => false, |
137 | 137 | ) |
@@ -139,11 +139,11 @@ discard block |
||
139 | 139 | |
140 | 140 | array( |
141 | 141 | 'type' => 'number', |
142 | - 'name' => __( 'Number', 'invoicing' ), |
|
142 | + 'name' => __('Number', 'invoicing'), |
|
143 | 143 | 'defaults' => array( |
144 | 144 | 'placeholder' => '', |
145 | 145 | 'value' => '', |
146 | - 'label' => __( 'Number', 'invoicing' ), |
|
146 | + 'label' => __('Number', 'invoicing'), |
|
147 | 147 | 'description' => '', |
148 | 148 | 'required' => false, |
149 | 149 | ) |
@@ -151,11 +151,11 @@ discard block |
||
151 | 151 | |
152 | 152 | array( |
153 | 153 | 'type' => 'website', |
154 | - 'name' => __( 'Website', 'invoicing' ), |
|
154 | + 'name' => __('Website', 'invoicing'), |
|
155 | 155 | 'defaults' => array( |
156 | 156 | 'placeholder' => 'http://example.com', |
157 | 157 | 'value' => '', |
158 | - 'label' => __( 'Website', 'invoicing' ), |
|
158 | + 'label' => __('Website', 'invoicing'), |
|
159 | 159 | 'description' => '', |
160 | 160 | 'required' => false, |
161 | 161 | ) |
@@ -163,11 +163,11 @@ discard block |
||
163 | 163 | |
164 | 164 | array( |
165 | 165 | 'type' => 'email', |
166 | - 'name' => __( 'Email', 'invoicing' ), |
|
166 | + 'name' => __('Email', 'invoicing'), |
|
167 | 167 | 'defaults' => array( |
168 | 168 | 'placeholder' => '[email protected]', |
169 | 169 | 'value' => '', |
170 | - 'label' => __( 'Email Address', 'invoicing' ), |
|
170 | + 'label' => __('Email Address', 'invoicing'), |
|
171 | 171 | 'description' => '', |
172 | 172 | 'required' => false, |
173 | 173 | ) |
@@ -175,31 +175,31 @@ discard block |
||
175 | 175 | |
176 | 176 | array( |
177 | 177 | 'type' => 'file_upload', |
178 | - 'name' => __( 'File Upload', 'invoicing' ), |
|
178 | + 'name' => __('File Upload', 'invoicing'), |
|
179 | 179 | 'defaults' => array( |
180 | 180 | 'value' => '', |
181 | - 'label' => __( 'Upload File', 'invoicing' ), |
|
181 | + 'label' => __('Upload File', 'invoicing'), |
|
182 | 182 | 'description' => '', |
183 | 183 | 'required' => false, |
184 | 184 | 'max_file_num' => 1, |
185 | - 'file_types' => array( 'jpg|jpeg|jpe', 'gif', 'png' ), |
|
185 | + 'file_types' => array('jpg|jpeg|jpe', 'gif', 'png'), |
|
186 | 186 | ) |
187 | 187 | ), |
188 | 188 | |
189 | 189 | array( |
190 | 190 | 'type' => 'address', |
191 | - 'name' => __( 'Address', 'invoicing' ), |
|
191 | + 'name' => __('Address', 'invoicing'), |
|
192 | 192 | 'defaults' => array( |
193 | 193 | |
194 | 194 | 'address_type' => 'billing', |
195 | - 'billing_address_title' => __( 'Billing Address', 'invoicing' ), |
|
196 | - 'shipping_address_title' => __( 'Shipping Address', 'invoicing' ), |
|
197 | - 'shipping_address_toggle' => __( 'Same billing & shipping address.', 'invoicing' ), |
|
195 | + 'billing_address_title' => __('Billing Address', 'invoicing'), |
|
196 | + 'shipping_address_title' => __('Shipping Address', 'invoicing'), |
|
197 | + 'shipping_address_toggle' => __('Same billing & shipping address.', 'invoicing'), |
|
198 | 198 | 'fields' => array( |
199 | 199 | array( |
200 | 200 | 'placeholder' => 'Jon', |
201 | 201 | 'value' => '', |
202 | - 'label' => __( 'First Name', 'invoicing' ), |
|
202 | + 'label' => __('First Name', 'invoicing'), |
|
203 | 203 | 'description' => '', |
204 | 204 | 'required' => false, |
205 | 205 | 'visible' => true, |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | array( |
211 | 211 | 'placeholder' => 'Snow', |
212 | 212 | 'value' => '', |
213 | - 'label' => __( 'Last Name', 'invoicing' ), |
|
213 | + 'label' => __('Last Name', 'invoicing'), |
|
214 | 214 | 'description' => '', |
215 | 215 | 'required' => false, |
216 | 216 | 'visible' => true, |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | array( |
222 | 222 | 'placeholder' => '', |
223 | 223 | 'value' => '', |
224 | - 'label' => __( 'Address', 'invoicing' ), |
|
224 | + 'label' => __('Address', 'invoicing'), |
|
225 | 225 | 'description' => '', |
226 | 226 | 'required' => false, |
227 | 227 | 'visible' => true, |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | array( |
233 | 233 | 'placeholder' => '', |
234 | 234 | 'value' => '', |
235 | - 'label' => __( 'City', 'invoicing' ), |
|
235 | + 'label' => __('City', 'invoicing'), |
|
236 | 236 | 'description' => '', |
237 | 237 | 'required' => false, |
238 | 238 | 'visible' => true, |
@@ -241,9 +241,9 @@ discard block |
||
241 | 241 | ), |
242 | 242 | |
243 | 243 | array( |
244 | - 'placeholder' => __( 'Select your country' ), |
|
244 | + 'placeholder' => __('Select your country'), |
|
245 | 245 | 'value' => '', |
246 | - 'label' => __( 'Country', 'invoicing' ), |
|
246 | + 'label' => __('Country', 'invoicing'), |
|
247 | 247 | 'description' => '', |
248 | 248 | 'required' => false, |
249 | 249 | 'visible' => true, |
@@ -252,9 +252,9 @@ discard block |
||
252 | 252 | ), |
253 | 253 | |
254 | 254 | array( |
255 | - 'placeholder' => __( 'Choose a state', 'invoicing' ), |
|
255 | + 'placeholder' => __('Choose a state', 'invoicing'), |
|
256 | 256 | 'value' => '', |
257 | - 'label' => __( 'State / Province', 'invoicing' ), |
|
257 | + 'label' => __('State / Province', 'invoicing'), |
|
258 | 258 | 'description' => '', |
259 | 259 | 'required' => false, |
260 | 260 | 'visible' => true, |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | array( |
266 | 266 | 'placeholder' => '', |
267 | 267 | 'value' => '', |
268 | - 'label' => __( 'ZIP / Postcode', 'invoicing' ), |
|
268 | + 'label' => __('ZIP / Postcode', 'invoicing'), |
|
269 | 269 | 'description' => '', |
270 | 270 | 'required' => false, |
271 | 271 | 'visible' => true, |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | array( |
277 | 277 | 'placeholder' => '', |
278 | 278 | 'value' => '', |
279 | - 'label' => __( 'Phone', 'invoicing' ), |
|
279 | + 'label' => __('Phone', 'invoicing'), |
|
280 | 280 | 'description' => '', |
281 | 281 | 'required' => false, |
282 | 282 | 'visible' => true, |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | array( |
288 | 288 | 'placeholder' => '', |
289 | 289 | 'value' => '', |
290 | - 'label' => __( 'Company', 'invoicing' ), |
|
290 | + 'label' => __('Company', 'invoicing'), |
|
291 | 291 | 'description' => '', |
292 | 292 | 'required' => false, |
293 | 293 | 'visible' => false, |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | array( |
299 | 299 | 'placeholder' => '', |
300 | 300 | 'value' => '', |
301 | - 'label' => __( 'Company ID', 'invoicing' ), |
|
301 | + 'label' => __('Company ID', 'invoicing'), |
|
302 | 302 | 'description' => '', |
303 | 303 | 'required' => false, |
304 | 304 | 'visible' => false, |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | array( |
310 | 310 | 'placeholder' => '', |
311 | 311 | 'value' => '', |
312 | - 'label' => __( 'VAT Number', 'invoicing' ), |
|
312 | + 'label' => __('VAT Number', 'invoicing'), |
|
313 | 313 | 'description' => '', |
314 | 314 | 'required' => false, |
315 | 315 | 'visible' => false, |
@@ -322,11 +322,11 @@ discard block |
||
322 | 322 | |
323 | 323 | array( |
324 | 324 | 'type' => 'billing_email', |
325 | - 'name' => __( 'Billing Email', 'invoicing' ), |
|
325 | + 'name' => __('Billing Email', 'invoicing'), |
|
326 | 326 | 'defaults' => array( |
327 | 327 | 'placeholder' => '[email protected]', |
328 | 328 | 'value' => '', |
329 | - 'label' => __( 'Billing Email', 'invoicing' ), |
|
329 | + 'label' => __('Billing Email', 'invoicing'), |
|
330 | 330 | 'description' => '', |
331 | 331 | 'premade' => true, |
332 | 332 | ) |
@@ -334,18 +334,18 @@ discard block |
||
334 | 334 | |
335 | 335 | array( |
336 | 336 | 'type' => 'discount', |
337 | - 'name' => __( 'Discount Input', 'invoicing' ), |
|
337 | + 'name' => __('Discount Input', 'invoicing'), |
|
338 | 338 | 'defaults' => array( |
339 | 339 | 'value' => '', |
340 | - 'input_label' => __( 'Coupon Code', 'invoicing' ), |
|
341 | - 'button_label' => __( 'Apply Coupon', 'invoicing' ), |
|
342 | - 'description' => __( 'Have a discount code? Enter it above.', 'invoicing' ), |
|
340 | + 'input_label' => __('Coupon Code', 'invoicing'), |
|
341 | + 'button_label' => __('Apply Coupon', 'invoicing'), |
|
342 | + 'description' => __('Have a discount code? Enter it above.', 'invoicing'), |
|
343 | 343 | ) |
344 | 344 | ), |
345 | 345 | |
346 | 346 | array( |
347 | 347 | 'type' => 'items', |
348 | - 'name' => __( 'Items', 'invoicing' ), |
|
348 | + 'name' => __('Items', 'invoicing'), |
|
349 | 349 | 'defaults' => array( |
350 | 350 | 'value' => '', |
351 | 351 | 'items_type' => 'total', |
@@ -357,22 +357,22 @@ discard block |
||
357 | 357 | |
358 | 358 | array( |
359 | 359 | 'type' => 'price_input', |
360 | - 'name' => __( 'Price Input', 'invoicing' ), |
|
360 | + 'name' => __('Price Input', 'invoicing'), |
|
361 | 361 | 'defaults' => array( |
362 | 362 | 'placeholder' => wpinv_format_amount(0), |
363 | 363 | 'value' => wpinv_format_amount(0), |
364 | 364 | 'minimum' => wpinv_format_amount(0), |
365 | - 'label' => __( 'Enter Amount', 'invoicing' ), |
|
365 | + 'label' => __('Enter Amount', 'invoicing'), |
|
366 | 366 | 'description' => '', |
367 | 367 | ) |
368 | 368 | ), |
369 | 369 | |
370 | 370 | array( |
371 | 371 | 'type' => 'price_select', |
372 | - 'name' => __( 'Price Select', 'invoicing' ), |
|
372 | + 'name' => __('Price Select', 'invoicing'), |
|
373 | 373 | 'defaults' => array( |
374 | 374 | 'description' => '', |
375 | - 'label' => __( 'Select Amount', 'invoicing' ), |
|
375 | + 'label' => __('Select Amount', 'invoicing'), |
|
376 | 376 | 'options' => 'Option 1|10, Option 2|20', |
377 | 377 | 'placeholder' => '', |
378 | 378 | 'select_type' => 'select', |
@@ -381,39 +381,39 @@ discard block |
||
381 | 381 | |
382 | 382 | array( |
383 | 383 | 'type' => 'pay_button', |
384 | - 'name' => __( 'Payment Button', 'invoicing' ), |
|
384 | + 'name' => __('Payment Button', 'invoicing'), |
|
385 | 385 | 'defaults' => array( |
386 | 386 | 'value' => '', |
387 | 387 | 'class' => 'btn-primary', |
388 | - 'label' => __( 'Pay %price% »', 'invoicing' ), |
|
389 | - 'free' => __( 'Continue »', 'invoicing' ), |
|
390 | - 'description' => __( 'By continuing with our payment, you are agreeing to our privacy policy and terms of service.', 'invoicing' ), |
|
388 | + 'label' => __('Pay %price% »', 'invoicing'), |
|
389 | + 'free' => __('Continue »', 'invoicing'), |
|
390 | + 'description' => __('By continuing with our payment, you are agreeing to our privacy policy and terms of service.', 'invoicing'), |
|
391 | 391 | 'premade' => true, |
392 | 392 | ) |
393 | 393 | ), |
394 | 394 | |
395 | 395 | array( |
396 | 396 | 'type' => 'gateway_select', |
397 | - 'name' => __( 'Gateway Select', 'invoicing' ), |
|
397 | + 'name' => __('Gateway Select', 'invoicing'), |
|
398 | 398 | 'defaults' => array( |
399 | - 'text' => __( 'Select Payment Method', 'invoicing' ), |
|
399 | + 'text' => __('Select Payment Method', 'invoicing'), |
|
400 | 400 | 'premade' => true, |
401 | 401 | ) |
402 | 402 | ), |
403 | 403 | |
404 | 404 | array( |
405 | 405 | 'type' => 'total_payable', |
406 | - 'name' => __( 'Total Payable', 'invoicing' ), |
|
406 | + 'name' => __('Total Payable', 'invoicing'), |
|
407 | 407 | 'defaults' => array( |
408 | - 'text' => __( 'Total to pay:', 'invoicing' ), |
|
408 | + 'text' => __('Total to pay:', 'invoicing'), |
|
409 | 409 | ) |
410 | 410 | ), |
411 | 411 | |
412 | 412 | array( |
413 | 413 | 'type' => 'ip_address', |
414 | - 'name' => __( 'IP Address', 'invoicing' ), |
|
414 | + 'name' => __('IP Address', 'invoicing'), |
|
415 | 415 | 'defaults' => array( |
416 | - 'text' => __( 'Your IP address is:', 'invoicing' ), |
|
416 | + 'text' => __('Your IP address is:', 'invoicing'), |
|
417 | 417 | ) |
418 | 418 | ) |
419 | 419 | ); |
@@ -7,34 +7,34 @@ discard block |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | -$label = empty( $label ) ? '' : wp_kses_post( $label ); |
|
13 | -$label_class = sanitize_key( preg_replace( '/[^A-Za-z0-9_-]/', '-', $label ) ); |
|
14 | -if ( ! empty( $required ) ) { |
|
12 | +$label = empty($label) ? '' : wp_kses_post($label); |
|
13 | +$label_class = sanitize_key(preg_replace('/[^A-Za-z0-9_-]/', '-', $label)); |
|
14 | +if (!empty($required)) { |
|
15 | 15 | $label .= "<span class='text-danger'> *</span>"; |
16 | 16 | } |
17 | 17 | |
18 | 18 | $disable_dates = array(); |
19 | 19 | |
20 | -if ( ! empty( $disabled_dates ) ) { |
|
21 | - $disabled_dates = preg_replace( '/\s+/', '', $disabled_dates ); |
|
22 | - $disabled_dates = str_ireplace( 'today', current_time( 'Y-m-d' ), $disabled_dates ); |
|
23 | - $disabled_dates = array_filter( explode( ',', $disabled_dates ) ); |
|
20 | +if (!empty($disabled_dates)) { |
|
21 | + $disabled_dates = preg_replace('/\s+/', '', $disabled_dates); |
|
22 | + $disabled_dates = str_ireplace('today', current_time('Y-m-d'), $disabled_dates); |
|
23 | + $disabled_dates = array_filter(explode(',', $disabled_dates)); |
|
24 | 24 | |
25 | - foreach ( $disabled_dates as $disabled_date ) { |
|
25 | + foreach ($disabled_dates as $disabled_date) { |
|
26 | 26 | |
27 | - $disabled_date = trim( $disabled_date ); |
|
27 | + $disabled_date = trim($disabled_date); |
|
28 | 28 | |
29 | - if ( false === strpos( $disabled_date, '|' ) ) { |
|
29 | + if (false === strpos($disabled_date, '|')) { |
|
30 | 30 | $disable_dates[] = $disabled_date; |
31 | 31 | continue; |
32 | 32 | } |
33 | 33 | |
34 | - $disabled_date = explode( '|', $disabled_date ); |
|
34 | + $disabled_date = explode('|', $disabled_date); |
|
35 | 35 | $disable_dates[] = array( |
36 | - 'from' => trim( $disabled_date[0] ), |
|
37 | - 'to' => trim( $disabled_date[1] ), |
|
36 | + 'from' => trim($disabled_date[0]), |
|
37 | + 'to' => trim($disabled_date[1]), |
|
38 | 38 | ); |
39 | 39 | |
40 | 40 | } |
@@ -42,28 +42,28 @@ discard block |
||
42 | 42 | } |
43 | 43 | |
44 | 44 | $options = array( |
45 | - 'data-default-date' => empty( 'default_date' ) ? false : $default_date, |
|
46 | - 'data-min-date' => empty( 'min_date' ) ? false : $min_date, |
|
47 | - 'data-max-date' => empty( 'max_date' ) ? false : $max_date, |
|
48 | - 'data-mode' => empty( 'mode' ) ? 'single' : $mode, |
|
49 | - 'data-alt-format' => get_option( 'date_format', 'F j, Y' ), |
|
45 | + 'data-default-date' => empty('default_date') ? false : $default_date, |
|
46 | + 'data-min-date' => empty('min_date') ? false : $min_date, |
|
47 | + 'data-max-date' => empty('max_date') ? false : $max_date, |
|
48 | + 'data-mode' => empty('mode') ? 'single' : $mode, |
|
49 | + 'data-alt-format' => get_option('date_format', 'F j, Y'), |
|
50 | 50 | 'data-date-format' => 'Y-m-d', |
51 | 51 | 'data-alt-input' => 'true', |
52 | - 'data-disable_alt' => empty( $disabled_dates ) ? false : wp_json_encode( $disable_dates ), |
|
53 | - 'data-disable_days_alt' => empty( $disable_days ) ? false : wp_json_encode( wp_parse_id_list( $disable_days ) ), |
|
52 | + 'data-disable_alt' => empty($disabled_dates) ? false : wp_json_encode($disable_dates), |
|
53 | + 'data-disable_days_alt' => empty($disable_days) ? false : wp_json_encode(wp_parse_id_list($disable_days)), |
|
54 | 54 | ); |
55 | 55 | |
56 | 56 | echo aui()->input( |
57 | 57 | array( |
58 | - 'name' => esc_attr( $id ), |
|
59 | - 'id' => esc_attr( $id ) . uniqid( '_' ), |
|
60 | - 'placeholder' => empty( $placeholder ) ? '' : esc_attr( $placeholder ), |
|
61 | - 'required' => ! empty( $required ), |
|
58 | + 'name' => esc_attr($id), |
|
59 | + 'id' => esc_attr($id) . uniqid('_'), |
|
60 | + 'placeholder' => empty($placeholder) ? '' : esc_attr($placeholder), |
|
61 | + 'required' => !empty($required), |
|
62 | 62 | 'label' => $label, |
63 | 63 | 'label_type' => 'vertical', |
64 | - 'help_text' => empty( $description ) ? '' : wp_kses_post( $description ), |
|
64 | + 'help_text' => empty($description) ? '' : wp_kses_post($description), |
|
65 | 65 | 'type' => 'datepicker', |
66 | 66 | 'class' => $label_class . ' getpaid-init-flatpickr flatpickr-input', |
67 | - 'extra_attributes' => array_filter( apply_filters( 'getpaid_date_field_attributes', $options ) ), |
|
67 | + 'extra_attributes' => array_filter(apply_filters('getpaid_date_field_attributes', $options)), |
|
68 | 68 | ) |
69 | 69 | ); |
@@ -7,104 +7,104 @@ |
||
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( 'Default Date', 'invoicing' ); ?></span> |
|
24 | - <?php echo wpi_help_tip( sprintf( __( 'You can enter the shortcut "today" or enter a date matching the format Y-m-d, e.g %s', 'invoicing' ), current_time( 'Y-m-d' ) ), false, true ); ?> |
|
25 | - <input v-model='active_form_element.default_date' placeholder="<?php esc_attr_e( 'None', 'invoicing' ); ?>" class='form-control' type="text"/> |
|
23 | + <span><?php esc_html_e('Default Date', 'invoicing'); ?></span> |
|
24 | + <?php echo wpi_help_tip(sprintf(__('You can enter the shortcut "today" or enter a date matching the format Y-m-d, e.g %s', 'invoicing'), current_time('Y-m-d')), false, true); ?> |
|
25 | + <input v-model='active_form_element.default_date' placeholder="<?php esc_attr_e('None', 'invoicing'); ?>" class='form-control' type="text"/> |
|
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( 'Minimum Date', 'invoicing' ); ?></span> |
|
32 | - <?php echo wpi_help_tip( sprintf( __( 'You can enter the shortcut "today" or enter a date matching the format Y-m-d, e.g %s', 'invoicing' ), current_time( 'Y-m-d' ) ), false, true ); ?> |
|
33 | - <input v-model='active_form_element.min_date' placeholder="<?php esc_attr_e( 'None', 'invoicing' ); ?>" class='form-control' type="text"/> |
|
34 | - <small class="form-text text-muted"><?php _e( 'Specify the minimum/earliest date (inclusively) allowed for selection.', 'invoicing' ); ?></small> |
|
31 | + <span><?php esc_html_e('Minimum Date', 'invoicing'); ?></span> |
|
32 | + <?php echo wpi_help_tip(sprintf(__('You can enter the shortcut "today" or enter a date matching the format Y-m-d, e.g %s', 'invoicing'), current_time('Y-m-d')), false, true); ?> |
|
33 | + <input v-model='active_form_element.min_date' placeholder="<?php esc_attr_e('None', 'invoicing'); ?>" class='form-control' type="text"/> |
|
34 | + <small class="form-text text-muted"><?php _e('Specify the minimum/earliest date (inclusively) allowed for selection.', 'invoicing'); ?></small> |
|
35 | 35 | </label> |
36 | 36 | </div> |
37 | 37 | |
38 | 38 | <div class='form-group'> |
39 | 39 | <label class="d-block"> |
40 | - <span><?php esc_html_e( 'Maximum Date', 'invoicing' ); ?></span> |
|
41 | - <?php echo wpi_help_tip( sprintf( __( 'You can enter the shortcut "today" or enter a date matching the format Y-m-d, e.g %s', 'invoicing' ), current_time( 'Y-m-d' ) ), false, true ); ?> |
|
42 | - <input v-model='active_form_element.max_date' placeholder="<?php esc_attr_e( 'None', 'invoicing' ); ?>" class='form-control' type="text"/> |
|
43 | - <small class="form-text text-muted"><?php _e( 'Specify the maximum/latest date (inclusively) allowed for selection.', 'invoicing' ); ?></small> |
|
40 | + <span><?php esc_html_e('Maximum Date', 'invoicing'); ?></span> |
|
41 | + <?php echo wpi_help_tip(sprintf(__('You can enter the shortcut "today" or enter a date matching the format Y-m-d, e.g %s', 'invoicing'), current_time('Y-m-d')), false, true); ?> |
|
42 | + <input v-model='active_form_element.max_date' placeholder="<?php esc_attr_e('None', 'invoicing'); ?>" class='form-control' type="text"/> |
|
43 | + <small class="form-text text-muted"><?php _e('Specify the maximum/latest date (inclusively) allowed for selection.', 'invoicing'); ?></small> |
|
44 | 44 | </label> |
45 | 45 | </div> |
46 | 46 | |
47 | 47 | <div class='form-group'> |
48 | 48 | <label class="d-block"> |
49 | - <span><?php esc_html_e( 'Disabled Dates', 'invoicing' ); ?></span> |
|
50 | - <?php echo wpi_help_tip( sprintf( __( 'You can use the shortcut "today" or enter dates matching the format Y-m-d, e.g %s', 'invoicing' ), current_time( 'Y-m-d' ) ), false, true ); ?> |
|
51 | - <input v-model='active_form_element.disabled_dates' placeholder="<?php echo esc_attr( sprintf( __( 'For example, %s', 'invoicing' ), 'today,2025-04-01|2025-05-01,2025-09-01|2025-12-01' ) ); ?>" class='form-control' type="text"/> |
|
52 | - <small class="form-text text-muted"><?php _e( 'Specify the dates to ignore. Use commas to separate dates and "|" to separate date ranges.', 'invoicing' ); ?></small> |
|
49 | + <span><?php esc_html_e('Disabled Dates', 'invoicing'); ?></span> |
|
50 | + <?php echo wpi_help_tip(sprintf(__('You can use the shortcut "today" or enter dates matching the format Y-m-d, e.g %s', 'invoicing'), current_time('Y-m-d')), false, true); ?> |
|
51 | + <input v-model='active_form_element.disabled_dates' placeholder="<?php echo esc_attr(sprintf(__('For example, %s', 'invoicing'), 'today,2025-04-01|2025-05-01,2025-09-01|2025-12-01')); ?>" class='form-control' type="text"/> |
|
52 | + <small class="form-text text-muted"><?php _e('Specify the dates to ignore. Use commas to separate dates and "|" to separate date ranges.', 'invoicing'); ?></small> |
|
53 | 53 | </label> |
54 | 54 | </div> |
55 | 55 | |
56 | 56 | <div class='form-group'> |
57 | 57 | <label class="d-block"> |
58 | - <span><?php esc_html_e( 'Disable Days', 'invoicing' ) ?></span> |
|
58 | + <span><?php esc_html_e('Disable Days', 'invoicing') ?></span> |
|
59 | 59 | <gpselect2 class='form-control custom-select' v-model='active_form_element.disable_days' multiple> |
60 | - <option value='0'><?php esc_html_e( 'Sundays', 'invoicing' ); ?></option> |
|
61 | - <option value='1'><?php esc_html_e( 'Mondays', 'invoicing' ); ?></option> |
|
62 | - <option value='2'><?php esc_html_e( 'Tuesdays', 'invoicing' ); ?></option> |
|
63 | - <option value='3'><?php esc_html_e( 'Wednesdays', 'invoicing' ); ?></option> |
|
64 | - <option value='4'><?php esc_html_e( 'Thursdays', 'invoicing' ); ?></option> |
|
65 | - <option value='5'><?php esc_html_e( 'Fridays', 'invoicing' ); ?></option> |
|
66 | - <option value='6'><?php esc_html_e( 'Saturdays', 'invoicing' ); ?></option> |
|
60 | + <option value='0'><?php esc_html_e('Sundays', 'invoicing'); ?></option> |
|
61 | + <option value='1'><?php esc_html_e('Mondays', 'invoicing'); ?></option> |
|
62 | + <option value='2'><?php esc_html_e('Tuesdays', 'invoicing'); ?></option> |
|
63 | + <option value='3'><?php esc_html_e('Wednesdays', 'invoicing'); ?></option> |
|
64 | + <option value='4'><?php esc_html_e('Thursdays', 'invoicing'); ?></option> |
|
65 | + <option value='5'><?php esc_html_e('Fridays', 'invoicing'); ?></option> |
|
66 | + <option value='6'><?php esc_html_e('Saturdays', 'invoicing'); ?></option> |
|
67 | 67 | </gpselect2> |
68 | - <small class="form-text text-muted"><?php _e( 'Optionally specify the days of the week to disable.', 'invoicing' ); ?></small> |
|
68 | + <small class="form-text text-muted"><?php _e('Optionally specify the days of the week to disable.', 'invoicing'); ?></small> |
|
69 | 69 | </label> |
70 | 70 | </div> |
71 | 71 | |
72 | 72 | <div class='form-group'> |
73 | 73 | <label class="d-block"> |
74 | - <span><?php esc_html_e( 'Mode', 'invoicing' ) ?></span> |
|
74 | + <span><?php esc_html_e('Mode', 'invoicing') ?></span> |
|
75 | 75 | <select class='form-control custom-select' v-model='active_form_element.mode'> |
76 | - <option value='single'><?php esc_html_e( 'Users can only select a single date', 'invoicing' ); ?></option> |
|
77 | - <option value='range'><?php esc_html_e( 'Users can select a date range', 'invoicing' ); ?></option> |
|
78 | - <option value='multiple'><?php esc_html_e( 'Users can select multiple dates', 'invoicing' ); ?></option> |
|
76 | + <option value='single'><?php esc_html_e('Users can only select a single date', 'invoicing'); ?></option> |
|
77 | + <option value='range'><?php esc_html_e('Users can select a date range', 'invoicing'); ?></option> |
|
78 | + <option value='multiple'><?php esc_html_e('Users can select multiple dates', 'invoicing'); ?></option> |
|
79 | 79 | </select> |
80 | 80 | </label> |
81 | 81 | </div> |
82 | 82 | |
83 | 83 | <div class='form-group'> |
84 | 84 | <label class="d-block"> |
85 | - <span><?php esc_html_e( 'Help Text', 'invoicing' ); ?></span> |
|
86 | - <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> |
|
87 | - <small class="form-text text-muted"><?php _e( 'HTML is allowed', 'invoicing' ); ?></small> |
|
85 | + <span><?php esc_html_e('Help Text', 'invoicing'); ?></span> |
|
86 | + <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> |
|
87 | + <small class="form-text text-muted"><?php _e('HTML is allowed', 'invoicing'); ?></small> |
|
88 | 88 | </label> |
89 | 89 | </div> |
90 | 90 | |
91 | 91 | <div class='form-group form-check'> |
92 | 92 | <input :id="active_form_element.id + '_edit'" v-model='active_form_element.required' type='checkbox' class='form-check-input' /> |
93 | - <label class='form-check-label' :for="active_form_element.id + '_edit'"><?php esc_html_e( 'Is this field required?', 'invoicing' ); ?></label> |
|
93 | + <label class='form-check-label' :for="active_form_element.id + '_edit'"><?php esc_html_e('Is this field required?', 'invoicing'); ?></label> |
|
94 | 94 | </div> |
95 | 95 | |
96 | 96 | <div class='form-group form-check'> |
97 | 97 | <input :id="active_form_element.id + '_add_meta'" v-model='active_form_element.add_meta' type='checkbox' class='form-check-input' /> |
98 | - <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> |
|
98 | + <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> |
|
99 | 99 | </div> |
100 | 100 | |
101 | 101 | <hr class='featurette-divider mt-4'> |
102 | 102 | |
103 | 103 | <div class='form-group'> |
104 | 104 | <label class="d-block"> |
105 | - <span><?php esc_html_e( 'Email Merge Tag', 'invoicing' ); ?></span> |
|
105 | + <span><?php esc_html_e('Email Merge Tag', 'invoicing'); ?></span> |
|
106 | 106 | <input :value='active_form_element.label | formatMergeTag' class='form-control bg-white' type="text" readonly onclick="this.select()" /> |
107 | - <span class="form-text text-muted"><?php esc_html_e( 'You can use this merge tag in notification emails', 'invoicing' ); ?></span> |
|
107 | + <span class="form-text text-muted"><?php esc_html_e('You can use this merge tag in notification emails', 'invoicing'); ?></span> |
|
108 | 108 | </label> |
109 | 109 | </div> |
110 | 110 |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | * Setup menus in WP admin. |
4 | 4 | */ |
5 | 5 | |
6 | -defined( 'ABSPATH' ) || exit; |
|
6 | +defined('ABSPATH') || exit; |
|
7 | 7 | |
8 | 8 | /** |
9 | 9 | * WC_Admin_Menus Class. |
@@ -13,14 +13,14 @@ discard block |
||
13 | 13 | * Hook in tabs. |
14 | 14 | */ |
15 | 15 | public function __construct() { |
16 | - add_action( 'admin_head', array( $this, 'set_admin_menu_class' ) ); |
|
17 | - add_action( 'admin_menu', array( $this, 'admin_menu' ), 10 ); |
|
18 | - add_action( 'admin_menu', array( $this, 'add_customers_menu' ), 18 ); |
|
19 | - add_action( 'admin_menu', array( $this, 'add_subscriptions_menu' ), 40 ); |
|
20 | - add_action( 'admin_menu', array( $this, 'add_addons_menu' ), 100 ); |
|
21 | - add_action( 'admin_menu', array( $this, 'add_settings_menu' ), 60 ); |
|
22 | - add_action( 'admin_menu', array( $this, 'remove_admin_submenus' ), 10 ); |
|
23 | - add_action( 'admin_head-nav-menus.php', array( $this, 'add_nav_menu_meta_boxes' ) ); |
|
16 | + add_action('admin_head', array($this, 'set_admin_menu_class')); |
|
17 | + add_action('admin_menu', array($this, 'admin_menu'), 10); |
|
18 | + add_action('admin_menu', array($this, 'add_customers_menu'), 18); |
|
19 | + add_action('admin_menu', array($this, 'add_subscriptions_menu'), 40); |
|
20 | + add_action('admin_menu', array($this, 'add_addons_menu'), 100); |
|
21 | + add_action('admin_menu', array($this, 'add_settings_menu'), 60); |
|
22 | + add_action('admin_menu', array($this, 'remove_admin_submenus'), 10); |
|
23 | + add_action('admin_head-nav-menus.php', array($this, 'add_nav_menu_meta_boxes')); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | /** |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | public function set_admin_menu_class() { |
30 | 30 | global $current_screen, $parent_file, $submenu_file; |
31 | 31 | |
32 | - if ( ! empty( $current_screen->id ) && in_array( $current_screen->id , array( 'wpi_discount', 'wpi_payment_form', 'wpi_invoice' ) ) ) { |
|
32 | + if (!empty($current_screen->id) && in_array($current_screen->id, array('wpi_discount', 'wpi_payment_form', 'wpi_invoice'))) { |
|
33 | 33 | $parent_file = 'wpinv'; |
34 | 34 | $submenu_file = 'edit.php?post_type=' . $current_screen->id; |
35 | 35 | } |
@@ -38,14 +38,14 @@ discard block |
||
38 | 38 | |
39 | 39 | public function admin_menu() { |
40 | 40 | |
41 | - $capability = apply_filters( 'invoicing_capability', wpinv_get_capability() ); |
|
41 | + $capability = apply_filters('invoicing_capability', wpinv_get_capability()); |
|
42 | 42 | add_menu_page( |
43 | - __( 'GetPaid', 'invoicing' ), |
|
44 | - __( 'GetPaid', 'invoicing' ), |
|
43 | + __('GetPaid', 'invoicing'), |
|
44 | + __('GetPaid', 'invoicing'), |
|
45 | 45 | $capability, |
46 | 46 | 'wpinv', |
47 | 47 | null, |
48 | - 'data:image/svg+xml;base64,' . base64_encode( file_get_contents( WPINV_PLUGIN_DIR . 'assets/images/GetPaid.svg' ) ), |
|
48 | + 'data:image/svg+xml;base64,' . base64_encode(file_get_contents(WPINV_PLUGIN_DIR . 'assets/images/GetPaid.svg')), |
|
49 | 49 | '54.123460' |
50 | 50 | ); |
51 | 51 | |
@@ -57,11 +57,11 @@ discard block |
||
57 | 57 | public function add_customers_menu() { |
58 | 58 | add_submenu_page( |
59 | 59 | 'wpinv', |
60 | - __( 'Customers', 'invoicing' ), |
|
61 | - __( 'Customers', 'invoicing' ), |
|
60 | + __('Customers', 'invoicing'), |
|
61 | + __('Customers', 'invoicing'), |
|
62 | 62 | wpinv_get_capability(), |
63 | 63 | 'wpinv-customers', |
64 | - array( $this, 'customers_page' ) |
|
64 | + array($this, 'customers_page') |
|
65 | 65 | ); |
66 | 66 | } |
67 | 67 | |
@@ -71,8 +71,8 @@ discard block |
||
71 | 71 | public function add_subscriptions_menu() { |
72 | 72 | add_submenu_page( |
73 | 73 | 'wpinv', |
74 | - __( 'Subscriptions', 'invoicing' ), |
|
75 | - __( 'Subscriptions', 'invoicing' ), |
|
74 | + __('Subscriptions', 'invoicing'), |
|
75 | + __('Subscriptions', 'invoicing'), |
|
76 | 76 | wpinv_get_capability(), |
77 | 77 | 'wpinv-subscriptions', |
78 | 78 | 'wpinv_subscriptions_page' |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | * Displays the customers page. |
84 | 84 | */ |
85 | 85 | public function customers_page() { |
86 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-customers-table.php' ); |
|
86 | + require_once(WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-customers-table.php'); |
|
87 | 87 | ?> |
88 | 88 | <div class="wrap wpi-customers-wrap"> |
89 | 89 | <style> |
@@ -91,12 +91,12 @@ discard block |
||
91 | 91 | width: 30%; |
92 | 92 | } |
93 | 93 | </style> |
94 | - <h1><?php echo esc_html( __( 'Customers', 'invoicing' ) ); ?> <a href="<?php echo wp_nonce_url( add_query_arg( 'getpaid-admin-action', 'download_customers' ), 'getpaid-nonce', 'getpaid-nonce' ); ?>" class="page-title-action"><?php _e( 'Export', 'invoicing' ); ?></a></h1> |
|
94 | + <h1><?php echo esc_html(__('Customers', 'invoicing')); ?> <a href="<?php echo wp_nonce_url(add_query_arg('getpaid-admin-action', 'download_customers'), 'getpaid-nonce', 'getpaid-nonce'); ?>" class="page-title-action"><?php _e('Export', 'invoicing'); ?></a></h1> |
|
95 | 95 | <form method="post"> |
96 | 96 | <?php |
97 | 97 | $table = new WPInv_Customers_Table(); |
98 | 98 | $table->prepare_items(); |
99 | - $table->search_box( __( 'Search Customers', 'invoicing' ), 'search-customers' ); |
|
99 | + $table->search_box(__('Search Customers', 'invoicing'), 'search-customers'); |
|
100 | 100 | $table->display(); |
101 | 101 | ?> |
102 | 102 | </form> |
@@ -110,16 +110,16 @@ discard block |
||
110 | 110 | public function add_settings_menu() { |
111 | 111 | add_submenu_page( |
112 | 112 | 'wpinv', |
113 | - __( 'Invoice Settings', 'invoicing' ), |
|
114 | - __( 'Settings', 'invoicing' ), |
|
115 | - apply_filters( 'invoicing_capability', wpinv_get_capability() ), |
|
113 | + __('Invoice Settings', 'invoicing'), |
|
114 | + __('Settings', 'invoicing'), |
|
115 | + apply_filters('invoicing_capability', wpinv_get_capability()), |
|
116 | 116 | 'wpinv-settings', |
117 | - array( $this, 'options_page' ) |
|
117 | + array($this, 'options_page') |
|
118 | 118 | ); |
119 | 119 | } |
120 | 120 | |
121 | - public function add_addons_menu(){ |
|
122 | - if ( !apply_filters( 'wpi_show_addons_page', true ) ) { |
|
121 | + public function add_addons_menu() { |
|
122 | + if (!apply_filters('wpi_show_addons_page', true)) { |
|
123 | 123 | return; |
124 | 124 | } |
125 | 125 | |
@@ -129,78 +129,78 @@ discard block |
||
129 | 129 | __('Extensions', 'invoicing'), |
130 | 130 | 'manage_options', |
131 | 131 | 'wpi-addons', |
132 | - array( $this, 'addons_page' ) |
|
132 | + array($this, 'addons_page') |
|
133 | 133 | ); |
134 | 134 | } |
135 | 135 | |
136 | - public function addons_page(){ |
|
136 | + public function addons_page() { |
|
137 | 137 | $addon_obj = new WPInv_Admin_Addons(); |
138 | 138 | $addon_obj->output(); |
139 | 139 | } |
140 | 140 | |
141 | 141 | function options_page() { |
142 | 142 | |
143 | - if ( ! wpinv_current_user_can_manage_invoicing() ) { |
|
143 | + if (!wpinv_current_user_can_manage_invoicing()) { |
|
144 | 144 | return; |
145 | 145 | } |
146 | 146 | |
147 | 147 | $settings_tabs = wpinv_get_settings_tabs(); |
148 | 148 | $settings_tabs = empty($settings_tabs) ? array() : $settings_tabs; |
149 | - $active_tab = isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $settings_tabs ) ? esc_html( $_GET['tab'] ) : 'general'; |
|
150 | - $sections = wpinv_get_settings_tab_sections( $active_tab ); |
|
149 | + $active_tab = isset($_GET['tab']) && array_key_exists($_GET['tab'], $settings_tabs) ? esc_html($_GET['tab']) : 'general'; |
|
150 | + $sections = wpinv_get_settings_tab_sections($active_tab); |
|
151 | 151 | $key = 'main'; |
152 | 152 | |
153 | - if ( is_array( $sections ) ) { |
|
154 | - $key = key( $sections ); |
|
153 | + if (is_array($sections)) { |
|
154 | + $key = key($sections); |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | add_thickbox(); |
158 | 158 | |
159 | - $registered_sections = wpinv_get_settings_tab_sections( $active_tab ); |
|
160 | - $section = isset( $_GET['section'] ) && ! empty( $registered_sections ) && array_key_exists( $_GET['section'], $registered_sections ) ? $_GET['section'] : $key; |
|
159 | + $registered_sections = wpinv_get_settings_tab_sections($active_tab); |
|
160 | + $section = isset($_GET['section']) && !empty($registered_sections) && array_key_exists($_GET['section'], $registered_sections) ? $_GET['section'] : $key; |
|
161 | 161 | ?> |
162 | 162 | <div class="wrap"> |
163 | 163 | <h1 class="nav-tab-wrapper"> |
164 | 164 | <?php |
165 | - foreach( wpinv_get_settings_tabs() as $tab_id => $tab_name ) { |
|
166 | - $tab_url = add_query_arg( array( |
|
165 | + foreach (wpinv_get_settings_tabs() as $tab_id => $tab_name) { |
|
166 | + $tab_url = add_query_arg(array( |
|
167 | 167 | 'settings-updated' => false, |
168 | 168 | 'tab' => $tab_id, |
169 | - ), 'admin.php?page=wpinv-settings' ); |
|
169 | + ), 'admin.php?page=wpinv-settings'); |
|
170 | 170 | |
171 | 171 | // Remove the section from the tabs so we always end up at the main section |
172 | - $tab_url = remove_query_arg( 'section', $tab_url ); |
|
173 | - $tab_url = remove_query_arg( 'wpi_sub', $tab_url ); |
|
172 | + $tab_url = remove_query_arg('section', $tab_url); |
|
173 | + $tab_url = remove_query_arg('wpi_sub', $tab_url); |
|
174 | 174 | |
175 | 175 | $active = $active_tab == $tab_id ? ' nav-tab-active' : ''; |
176 | 176 | |
177 | - echo '<a href="' . esc_url( $tab_url ) . '" title="' . esc_attr( $tab_name ) . '" class="nav-tab' . $active . '">'; |
|
178 | - echo esc_html( $tab_name ); |
|
177 | + echo '<a href="' . esc_url($tab_url) . '" title="' . esc_attr($tab_name) . '" class="nav-tab' . $active . '">'; |
|
178 | + echo esc_html($tab_name); |
|
179 | 179 | echo '</a>'; |
180 | 180 | } |
181 | 181 | ?> |
182 | 182 | </h1> |
183 | 183 | <?php |
184 | - $number_of_sections = count( $sections ); |
|
184 | + $number_of_sections = count($sections); |
|
185 | 185 | $number = 0; |
186 | - if ( $number_of_sections > 1 ) { |
|
186 | + if ($number_of_sections > 1) { |
|
187 | 187 | echo '<div><ul class="subsubsub">'; |
188 | - foreach( $sections as $section_id => $section_name ) { |
|
188 | + foreach ($sections as $section_id => $section_name) { |
|
189 | 189 | echo '<li>'; |
190 | 190 | $number++; |
191 | - $tab_url = add_query_arg( array( |
|
191 | + $tab_url = add_query_arg(array( |
|
192 | 192 | 'settings-updated' => false, |
193 | 193 | 'tab' => $active_tab, |
194 | 194 | 'section' => $section_id |
195 | - ), admin_url( 'admin.php?page=wpinv-settings' ) ); |
|
196 | - $tab_url = remove_query_arg( 'wpi_sub', $tab_url ); |
|
195 | + ), admin_url('admin.php?page=wpinv-settings')); |
|
196 | + $tab_url = remove_query_arg('wpi_sub', $tab_url); |
|
197 | 197 | $class = ''; |
198 | - if ( $section == $section_id ) { |
|
198 | + if ($section == $section_id) { |
|
199 | 199 | $class = 'current'; |
200 | 200 | } |
201 | - echo '<a class="' . $class . '" href="' . esc_url( $tab_url ) . '">' . $section_name . '</a>'; |
|
201 | + echo '<a class="' . $class . '" href="' . esc_url($tab_url) . '">' . $section_name . '</a>'; |
|
202 | 202 | |
203 | - if ( $number != $number_of_sections ) { |
|
203 | + if ($number != $number_of_sections) { |
|
204 | 204 | echo ' | '; |
205 | 205 | } |
206 | 206 | echo '</li>'; |
@@ -212,20 +212,20 @@ discard block |
||
212 | 212 | <form method="post" action="options.php"> |
213 | 213 | <table class="form-table"> |
214 | 214 | <?php |
215 | - settings_fields( 'wpinv_settings' ); |
|
215 | + settings_fields('wpinv_settings'); |
|
216 | 216 | |
217 | - if ( 'main' === $section ) { |
|
218 | - do_action( 'wpinv_settings_tab_top', $active_tab ); |
|
217 | + if ('main' === $section) { |
|
218 | + do_action('wpinv_settings_tab_top', $active_tab); |
|
219 | 219 | } |
220 | 220 | |
221 | - do_action( 'wpinv_settings_tab_top_' . $active_tab . '_' . $section, $active_tab, $section ); |
|
222 | - do_settings_sections( 'wpinv_settings_' . $active_tab . '_' . $section, $active_tab, $section ); |
|
223 | - do_action( 'wpinv_settings_tab_bottom_' . $active_tab . '_' . $section, $active_tab, $section ); |
|
224 | - do_action( 'getpaid_settings_tab_bottom', $active_tab, $section ); |
|
221 | + do_action('wpinv_settings_tab_top_' . $active_tab . '_' . $section, $active_tab, $section); |
|
222 | + do_settings_sections('wpinv_settings_' . $active_tab . '_' . $section, $active_tab, $section); |
|
223 | + do_action('wpinv_settings_tab_bottom_' . $active_tab . '_' . $section, $active_tab, $section); |
|
224 | + do_action('getpaid_settings_tab_bottom', $active_tab, $section); |
|
225 | 225 | |
226 | 226 | // For backwards compatibility |
227 | - if ( 'main' === $section ) { |
|
228 | - do_action( 'wpinv_settings_tab_bottom', $active_tab ); |
|
227 | + if ('main' === $section) { |
|
228 | + do_action('wpinv_settings_tab_bottom', $active_tab); |
|
229 | 229 | } |
230 | 230 | ?> |
231 | 231 | </table> |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | } |
238 | 238 | |
239 | 239 | public function remove_admin_submenus() { |
240 | - remove_submenu_page( 'edit.php?post_type=wpi_invoice', 'post-new.php?post_type=wpi_invoice' ); |
|
240 | + remove_submenu_page('edit.php?post_type=wpi_invoice', 'post-new.php?post_type=wpi_invoice'); |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | /** |
@@ -247,8 +247,8 @@ discard block |
||
247 | 247 | |
248 | 248 | add_meta_box( |
249 | 249 | 'wpinv_endpoints_nav_link', |
250 | - __( 'GetPaid endpoints', 'invoicing' ), |
|
251 | - array( $this, 'nav_menu_links' ), |
|
250 | + __('GetPaid endpoints', 'invoicing'), |
|
251 | + array($this, 'nav_menu_links'), |
|
252 | 252 | 'nav-menus', |
253 | 253 | 'side', |
254 | 254 | 'low' |
@@ -263,12 +263,12 @@ discard block |
||
263 | 263 | $endpoints = $this->get_menu_items(); |
264 | 264 | ?> |
265 | 265 | <div id="invoicing-endpoints" class="posttypediv"> |
266 | - <?php if ( ! empty( $endpoints['pages'] ) ) : ?> |
|
266 | + <?php if (!empty($endpoints['pages'])) : ?> |
|
267 | 267 | <div id="tabs-panel-invoicing-endpoints" class="tabs-panel tabs-panel-active"> |
268 | 268 | <ul id="invoicing-endpoints-checklist" class="categorychecklist form-no-clear"> |
269 | 269 | <?php |
270 | - $walker = new Walker_Nav_Menu_Checklist( array() ); |
|
271 | - echo walk_nav_menu_tree( array_map( 'wp_setup_nav_menu_item', $endpoints['pages'] ), 0, (object) array( 'walker' => $walker ) ); |
|
270 | + $walker = new Walker_Nav_Menu_Checklist(array()); |
|
271 | + echo walk_nav_menu_tree(array_map('wp_setup_nav_menu_item', $endpoints['pages']), 0, (object) array('walker' => $walker)); |
|
272 | 272 | ?> |
273 | 273 | </ul> |
274 | 274 | </div> |
@@ -277,11 +277,11 @@ discard block |
||
277 | 277 | <p class="button-controls wp-clearfix" data-items-type="invoicing-endpoints"> |
278 | 278 | <span class="list-controls hide-if-no-js"> |
279 | 279 | <input type="checkbox" id="invoicing-endpoints-tab" class="select-all"> |
280 | - <label for="invoicing-endpoints-tab"><?php _e( 'Select all', 'invoicing' ); ?></label> |
|
280 | + <label for="invoicing-endpoints-tab"><?php _e('Select all', 'invoicing'); ?></label> |
|
281 | 281 | </span> |
282 | 282 | |
283 | 283 | <span class="add-to-menu"> |
284 | - <input type="submit" class="button submit-add-to-menu right" value="<?php esc_attr_e( 'Add to menu', 'invoicing' ); ?>" name="add-invoicing-endpoints-item" id="submit-invoicing-endpoints"> |
|
284 | + <input type="submit" class="button submit-add-to-menu right" value="<?php esc_attr_e('Add to menu', 'invoicing'); ?>" name="add-invoicing-endpoints-item" id="submit-invoicing-endpoints"> |
|
285 | 285 | <span class="spinner"></span> |
286 | 286 | </span> |
287 | 287 | </p> |
@@ -294,35 +294,35 @@ discard block |
||
294 | 294 | * |
295 | 295 | * @return array. |
296 | 296 | */ |
297 | - public function get_menu_items(){ |
|
297 | + public function get_menu_items() { |
|
298 | 298 | $items = array(); |
299 | 299 | |
300 | 300 | $pages = array( |
301 | 301 | array( |
302 | - 'id' => wpinv_get_option( 'invoice_history_page' ), |
|
303 | - 'label' => __( 'My Invoices', 'invoicing' ), |
|
302 | + 'id' => wpinv_get_option('invoice_history_page'), |
|
303 | + 'label' => __('My Invoices', 'invoicing'), |
|
304 | 304 | ), |
305 | 305 | array( |
306 | - 'id' => wpinv_get_option( 'invoice_subscription_page' ), |
|
307 | - 'label' => __( 'My Subscriptions', 'invoicing' ), |
|
306 | + 'id' => wpinv_get_option('invoice_subscription_page'), |
|
307 | + 'label' => __('My Subscriptions', 'invoicing'), |
|
308 | 308 | ) |
309 | 309 | ); |
310 | 310 | |
311 | - foreach ( apply_filters( 'getpaid_menu_pages', $pages ) as $page ) { |
|
311 | + foreach (apply_filters('getpaid_menu_pages', $pages) as $page) { |
|
312 | 312 | |
313 | - if ( (int) $page['id'] > 0 ) { |
|
313 | + if ((int) $page['id'] > 0) { |
|
314 | 314 | |
315 | 315 | $item = new stdClass(); |
316 | 316 | $item->object_id = (int) $page['id']; |
317 | 317 | $item->db_id = 0; |
318 | - $item->object = 'page'; |
|
318 | + $item->object = 'page'; |
|
319 | 319 | $item->menu_item_parent = 0; |
320 | 320 | $item->type = 'post_type'; |
321 | - $item->title = esc_html( $page['label'] ); |
|
322 | - $item->url = get_permalink( (int) $page['id'] ); |
|
321 | + $item->title = esc_html($page['label']); |
|
322 | + $item->url = get_permalink((int) $page['id']); |
|
323 | 323 | $item->target = ''; |
324 | 324 | $item->attr_title = ''; |
325 | - $item->classes = array( 'wpinv-menu-item' ); |
|
325 | + $item->classes = array('wpinv-menu-item'); |
|
326 | 326 | $item->xfn = ''; |
327 | 327 | |
328 | 328 | $items['pages'][] = $item; |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | |
332 | 332 | } |
333 | 333 | |
334 | - return apply_filters( 'wpinv_menu_items', $items ); |
|
334 | + return apply_filters('wpinv_menu_items', $items); |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | } |
@@ -9,26 +9,26 @@ discard block |
||
9 | 9 | * @var WPInv_Invoice $invoice |
10 | 10 | */ |
11 | 11 | |
12 | -defined( 'ABSPATH' ) || exit; |
|
12 | +defined('ABSPATH') || exit; |
|
13 | 13 | |
14 | 14 | // Totals rows. |
15 | -$totals = getpaid_invoice_totals_rows( $invoice ); |
|
15 | +$totals = getpaid_invoice_totals_rows($invoice); |
|
16 | 16 | |
17 | -do_action( 'getpaid_before_invoice_line_totals', $invoice, $totals ); |
|
17 | +do_action('getpaid_before_invoice_line_totals', $invoice, $totals); |
|
18 | 18 | |
19 | 19 | ?> |
20 | 20 | <div class='getpaid-invoice-line-totals'> |
21 | 21 | <div class="row"> |
22 | 22 | <div class="col-12 offset-sm-6 col-sm-6 border-sm-left pl-sm-0"> |
23 | 23 | |
24 | - <?php foreach ( $totals as $key => $label ) : ?> |
|
24 | + <?php foreach ($totals as $key => $label) : ?> |
|
25 | 25 | |
26 | - <div class="getpaid-invoice-line-totals-col <?php echo sanitize_html_class( $key ); ?>"> |
|
26 | + <div class="getpaid-invoice-line-totals-col <?php echo sanitize_html_class($key); ?>"> |
|
27 | 27 | |
28 | 28 | <div class="form-row"> |
29 | 29 | |
30 | 30 | <div class="col-8 getpaid-invoice-line-totals-label"> |
31 | - <?php echo esc_html( $label ); ?> |
|
31 | + <?php echo esc_html($label); ?> |
|
32 | 32 | </div> |
33 | 33 | |
34 | 34 | <div class="col-4 getpaid-invoice-line-totals-value pl-0"> |
@@ -36,15 +36,15 @@ discard block |
||
36 | 36 | <?php |
37 | 37 | |
38 | 38 | // Total tax. |
39 | - if ( 'tax' == $key ) { |
|
40 | - echo wpinv_price( $invoice->get_total_tax(), $invoice->get_currency() ); |
|
39 | + if ('tax' == $key) { |
|
40 | + echo wpinv_price($invoice->get_total_tax(), $invoice->get_currency()); |
|
41 | 41 | |
42 | - if ( wpinv_use_taxes() && ! $invoice->get_disable_taxes() ) { |
|
42 | + if (wpinv_use_taxes() && !$invoice->get_disable_taxes()) { |
|
43 | 43 | |
44 | 44 | $taxes = $invoice->get_total_tax(); |
45 | - if ( empty( $taxes ) && GetPaid_Payment_Form_Submission_Taxes::is_eu_transaction( $invoice->get_country() ) ) { |
|
45 | + if (empty($taxes) && GetPaid_Payment_Form_Submission_Taxes::is_eu_transaction($invoice->get_country())) { |
|
46 | 46 | echo ' <em class="text-muted small">'; |
47 | - _x( '(Reverse charged)','This is a legal term for reverse charging tax in the EU', 'invoicing' ); |
|
47 | + _x('(Reverse charged)', 'This is a legal term for reverse charging tax in the EU', 'invoicing'); |
|
48 | 48 | echo '</em>'; |
49 | 49 | } |
50 | 50 | |
@@ -53,32 +53,32 @@ discard block |
||
53 | 53 | } |
54 | 54 | |
55 | 55 | // Total Fee. |
56 | - if ( 'fee' == $key ) { |
|
57 | - echo wpinv_price( $invoice->get_total_fees(), $invoice->get_currency() ); |
|
56 | + if ('fee' == $key) { |
|
57 | + echo wpinv_price($invoice->get_total_fees(), $invoice->get_currency()); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | // Total discount. |
61 | - if ( 'discount' == $key ) { |
|
62 | - echo wpinv_price( $invoice->get_total_discount(), $invoice->get_currency() ); |
|
61 | + if ('discount' == $key) { |
|
62 | + echo wpinv_price($invoice->get_total_discount(), $invoice->get_currency()); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | // Shipping. |
66 | - if ( 'shipping' == $key ) { |
|
67 | - echo wpinv_price( $invoice->get_shipping(), $invoice->get_currency() ); |
|
66 | + if ('shipping' == $key) { |
|
67 | + echo wpinv_price($invoice->get_shipping(), $invoice->get_currency()); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | // Sub total. |
71 | - if ( 'subtotal' == $key ) { |
|
72 | - echo wpinv_price( $invoice->get_subtotal(), $invoice->get_currency() ); |
|
71 | + if ('subtotal' == $key) { |
|
72 | + echo wpinv_price($invoice->get_subtotal(), $invoice->get_currency()); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | // Total. |
76 | - if ( 'total' == $key ) { |
|
77 | - echo wpinv_price( $invoice->get_total(), $invoice->get_currency() ); |
|
76 | + if ('total' == $key) { |
|
77 | + echo wpinv_price($invoice->get_total(), $invoice->get_currency()); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | // Fires when printing a cart total. |
81 | - do_action( "getpaid_invoice_cart_totals_$key", $invoice ); |
|
81 | + do_action("getpaid_invoice_cart_totals_$key", $invoice); |
|
82 | 82 | |
83 | 83 | ?> |
84 | 84 | |
@@ -92,4 +92,4 @@ discard block |
||
92 | 92 | </div> |
93 | 93 | </div> <!-- end .getpaid-invoice-line-totals --> |
94 | 94 | |
95 | -<?php do_action( 'getpaid_after_invoice_line_totals', $invoice, $totals ); ?> |
|
95 | +<?php do_action('getpaid_after_invoice_line_totals', $invoice, $totals); ?> |