@@ -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', 50, 2 ); |
|
28 | + add_action('add_meta_boxes', 'GetPaid_Metaboxes::add_meta_boxes', 50, 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 ( 'wpi_discount' === $post_type ) { |
|
56 | - add_meta_box( 'wpinv_discount_details', __( 'Discount Details', 'invoicing' ), 'GetPaid_Meta_Box_Discount_Details::output', 'wpi_discount', 'normal', 'high' ); |
|
55 | + if ('wpi_discount' === $post_type) { |
|
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 ( 'wpi_payment_form' === $post_type ) { |
|
67 | + if ('wpi_payment_form' === $post_type) { |
|
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 ( wpinv_get_default_payment_form() !== $post->ID ) { |
|
74 | - add_meta_box( 'wpinv-payment-form-info', __( 'Details', 'invoicing' ), 'GetPaid_Meta_Box_Payment_Form_Info::output', 'wpi_payment_form', 'side' ); |
|
73 | + if (wpinv_get_default_payment_form() !== $post->ID) { |
|
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 | |
@@ -80,23 +80,23 @@ discard block |
||
80 | 80 | /** |
81 | 81 | * Register core metaboxes. |
82 | 82 | */ |
83 | - protected static function add_item_meta_boxes( $post_type ) { |
|
83 | + protected static function add_item_meta_boxes($post_type) { |
|
84 | 84 | |
85 | - if ( 'wpi_item' === $post_type ) { |
|
85 | + if ('wpi_item' === $post_type) { |
|
86 | 86 | |
87 | 87 | // Item details. |
88 | - add_meta_box( 'wpinv_item_details', __( 'Item Details', 'invoicing' ), 'GetPaid_Meta_Box_Item_Details::output', 'wpi_item', 'normal', 'high' ); |
|
88 | + add_meta_box('wpinv_item_details', __('Item Details', 'invoicing'), 'GetPaid_Meta_Box_Item_Details::output', 'wpi_item', 'normal', 'high'); |
|
89 | 89 | |
90 | 90 | // If taxes are enabled, register the tax metabox. |
91 | - if ( wpinv_use_taxes() ) { |
|
92 | - add_meta_box( 'wpinv_item_vat', __( 'Tax', 'invoicing' ), 'GetPaid_Meta_Box_Item_VAT::output', 'wpi_item', 'normal', 'high' ); |
|
91 | + if (wpinv_use_taxes()) { |
|
92 | + add_meta_box('wpinv_item_vat', __('Tax', 'invoicing'), 'GetPaid_Meta_Box_Item_VAT::output', 'wpi_item', 'normal', 'high'); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | // Item info. |
96 | - add_meta_box( 'wpinv_field_item_info', __( 'Item info', 'invoicing' ), 'GetPaid_Meta_Box_Item_Info::output', 'wpi_item', 'side', 'core' ); |
|
96 | + add_meta_box('wpinv_field_item_info', __('Item info', 'invoicing'), 'GetPaid_Meta_Box_Item_Info::output', 'wpi_item', 'side', 'core'); |
|
97 | 97 | |
98 | 98 | // Item description. |
99 | - add_meta_box( 'postexcerpt', __( 'Item Description', 'invoicing' ), 'GetPaid_Meta_Box_Description::output', 'wpi_item', 'normal' ); |
|
99 | + add_meta_box('postexcerpt', __('Item Description', 'invoicing'), 'GetPaid_Meta_Box_Description::output', 'wpi_item', 'normal'); |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | } |
@@ -104,21 +104,21 @@ discard block |
||
104 | 104 | /** |
105 | 105 | * Register invoice metaboxes. |
106 | 106 | */ |
107 | - protected static function add_invoice_meta_boxes( $post_type, $post ) { |
|
107 | + protected static function add_invoice_meta_boxes($post_type, $post) { |
|
108 | 108 | |
109 | 109 | // For invoices... |
110 | - if ( getpaid_is_invoice_post_type( $post_type ) ) { |
|
111 | - $invoice = new WPInv_Invoice( $post ); |
|
110 | + if (getpaid_is_invoice_post_type($post_type)) { |
|
111 | + $invoice = new WPInv_Invoice($post); |
|
112 | 112 | |
113 | 113 | // Resend invoice. |
114 | - if ( ! $invoice->is_draft() ) { |
|
114 | + if (!$invoice->is_draft()) { |
|
115 | 115 | |
116 | 116 | add_meta_box( |
117 | 117 | 'wpinv-mb-resend-invoice', |
118 | 118 | sprintf( |
119 | 119 | // translators: %s is the invoice type. |
120 | - __( 'Resend %s', 'invoicing' ), |
|
121 | - ucfirst( $invoice->get_invoice_quote_type() ) |
|
120 | + __('Resend %s', 'invoicing'), |
|
121 | + ucfirst($invoice->get_invoice_quote_type()) |
|
122 | 122 | ), |
123 | 123 | 'GetPaid_Meta_Box_Resend_Invoice::output', |
124 | 124 | $post_type, |
@@ -129,17 +129,17 @@ discard block |
||
129 | 129 | } |
130 | 130 | |
131 | 131 | // Subscriptions. |
132 | - $subscriptions = getpaid_get_invoice_subscriptions( $invoice ); |
|
133 | - if ( ! empty( $subscriptions ) ) { |
|
132 | + $subscriptions = getpaid_get_invoice_subscriptions($invoice); |
|
133 | + if (!empty($subscriptions)) { |
|
134 | 134 | |
135 | - if ( is_array( $subscriptions ) ) { |
|
136 | - add_meta_box( 'wpinv-mb-subscriptions', __( 'Related Subscriptions', 'invoicing' ), 'GetPaid_Meta_Box_Invoice_Subscription::output_related', $post_type, 'advanced' ); |
|
135 | + if (is_array($subscriptions)) { |
|
136 | + add_meta_box('wpinv-mb-subscriptions', __('Related Subscriptions', 'invoicing'), 'GetPaid_Meta_Box_Invoice_Subscription::output_related', $post_type, 'advanced'); |
|
137 | 137 | } else { |
138 | - add_meta_box( 'wpinv-mb-subscriptions', __( 'Subscription Details', 'invoicing' ), 'GetPaid_Meta_Box_Invoice_Subscription::output', $post_type, 'advanced' ); |
|
138 | + add_meta_box('wpinv-mb-subscriptions', __('Subscription Details', 'invoicing'), 'GetPaid_Meta_Box_Invoice_Subscription::output', $post_type, 'advanced'); |
|
139 | 139 | } |
140 | 140 | |
141 | - if ( getpaid_count_subscription_invoices( $invoice->is_renewal() ? $invoice->get_parent_id() : $invoice->get_id() ) > 1 ) { |
|
142 | - add_meta_box( 'wpinv-mb-subscription-invoices', __( 'Related Payments', 'invoicing' ), 'GetPaid_Meta_Box_Invoice_Subscription::output_invoices', $post_type, 'advanced' ); |
|
141 | + if (getpaid_count_subscription_invoices($invoice->is_renewal() ? $invoice->get_parent_id() : $invoice->get_id()) > 1) { |
|
142 | + add_meta_box('wpinv-mb-subscription-invoices', __('Related Payments', 'invoicing'), 'GetPaid_Meta_Box_Invoice_Subscription::output_invoices', $post_type, 'advanced'); |
|
143 | 143 | } |
144 | 144 | } |
145 | 145 | |
@@ -148,8 +148,8 @@ discard block |
||
148 | 148 | 'wpinv-details', |
149 | 149 | sprintf( |
150 | 150 | // translators: %s is the invoice type. |
151 | - __( '%s Details', 'invoicing' ), |
|
152 | - ucfirst( $invoice->get_invoice_quote_type() ) |
|
151 | + __('%s Details', 'invoicing'), |
|
152 | + ucfirst($invoice->get_invoice_quote_type()) |
|
153 | 153 | ), |
154 | 154 | 'GetPaid_Meta_Box_Invoice_Details::output', |
155 | 155 | $post_type, |
@@ -157,18 +157,18 @@ discard block |
||
157 | 157 | ); |
158 | 158 | |
159 | 159 | // Payment details. |
160 | - add_meta_box( 'wpinv-payment-meta', __( 'Payment Meta', 'invoicing' ), 'GetPaid_Meta_Box_Invoice_Payment_Meta::output', $post_type, 'side', 'default' ); |
|
160 | + add_meta_box('wpinv-payment-meta', __('Payment Meta', 'invoicing'), 'GetPaid_Meta_Box_Invoice_Payment_Meta::output', $post_type, 'side', 'default'); |
|
161 | 161 | |
162 | 162 | // Billing details. |
163 | - add_meta_box( 'wpinv-address', __( 'Billing Details', 'invoicing' ), 'GetPaid_Meta_Box_Invoice_Address::output', $post_type, 'normal', 'high' ); |
|
163 | + add_meta_box('wpinv-address', __('Billing Details', 'invoicing'), 'GetPaid_Meta_Box_Invoice_Address::output', $post_type, 'normal', 'high'); |
|
164 | 164 | |
165 | 165 | // Invoice items. |
166 | 166 | add_meta_box( |
167 | 167 | 'wpinv-items', |
168 | 168 | sprintf( |
169 | 169 | // translators: %s is the invoice type. |
170 | - __( '%s Items', 'invoicing' ), |
|
171 | - ucfirst( $invoice->get_invoice_quote_type() ) |
|
170 | + __('%s Items', 'invoicing'), |
|
171 | + ucfirst($invoice->get_invoice_quote_type()) |
|
172 | 172 | ), |
173 | 173 | 'GetPaid_Meta_Box_Invoice_Items::output', |
174 | 174 | $post_type, |
@@ -181,8 +181,8 @@ discard block |
||
181 | 181 | 'wpinv-notes', |
182 | 182 | sprintf( |
183 | 183 | // translators: %s is the invoice type. |
184 | - __( '%s Notes', 'invoicing' ), |
|
185 | - ucfirst( $invoice->get_invoice_quote_type() ) |
|
184 | + __('%s Notes', 'invoicing'), |
|
185 | + ucfirst($invoice->get_invoice_quote_type()) |
|
186 | 186 | ), |
187 | 187 | 'WPInv_Meta_Box_Notes::output', |
188 | 188 | $post_type, |
@@ -191,13 +191,13 @@ discard block |
||
191 | 191 | ); |
192 | 192 | |
193 | 193 | // Shipping Address. |
194 | - if ( get_post_meta( $invoice->get_id(), 'shipping_address', true ) ) { |
|
195 | - add_meta_box( 'wpinv-invoice-shipping-details', __( 'Shipping Address', 'invoicing' ), 'GetPaid_Meta_Box_Invoice_Shipping_Address::output', $post_type, 'side', 'high' ); |
|
194 | + if (get_post_meta($invoice->get_id(), 'shipping_address', true)) { |
|
195 | + add_meta_box('wpinv-invoice-shipping-details', __('Shipping Address', 'invoicing'), 'GetPaid_Meta_Box_Invoice_Shipping_Address::output', $post_type, 'side', 'high'); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | // Payment form information. |
199 | - if ( get_post_meta( $invoice->get_id(), 'payment_form_data', true ) ) { |
|
200 | - add_meta_box( 'wpinv-invoice-payment-form-details', __( 'Payment Form Details', 'invoicing' ), 'WPInv_Meta_Box_Payment_Form::output_details', $post_type, 'side', 'high' ); |
|
199 | + if (get_post_meta($invoice->get_id(), 'payment_form_data', true)) { |
|
200 | + add_meta_box('wpinv-invoice-payment-form-details', __('Payment Form Details', 'invoicing'), 'WPInv_Meta_Box_Payment_Form::output_details', $post_type, 'side', 'high'); |
|
201 | 201 | } |
202 | 202 | } |
203 | 203 | |
@@ -207,8 +207,8 @@ discard block |
||
207 | 207 | * Remove some metaboxes. |
208 | 208 | */ |
209 | 209 | public static function remove_meta_boxes() { |
210 | - remove_meta_box( 'wpseo_meta', 'wpi_invoice', 'normal' ); |
|
211 | - remove_meta_box( 'postexcerpt', 'wpi_item', 'normal' ); |
|
210 | + remove_meta_box('wpseo_meta', 'wpi_invoice', 'normal'); |
|
211 | + remove_meta_box('postexcerpt', 'wpi_item', 'normal'); |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | /** |
@@ -224,46 +224,46 @@ discard block |
||
224 | 224 | * @param int $post_id Post ID. |
225 | 225 | * @param object $post Post object. |
226 | 226 | */ |
227 | - public static function save_meta_boxes( $post_id, $post ) { |
|
228 | - $post_id = absint( $post_id ); |
|
229 | - $data = wp_kses_post_deep( wp_unslash( $_POST ) ); |
|
227 | + public static function save_meta_boxes($post_id, $post) { |
|
228 | + $post_id = absint($post_id); |
|
229 | + $data = wp_kses_post_deep(wp_unslash($_POST)); |
|
230 | 230 | |
231 | 231 | // Do not save for ajax requests. |
232 | - if ( ( defined( 'DOING_AJAX' ) && DOING_AJAX ) || isset( $_REQUEST['bulk_edit'] ) ) { |
|
232 | + if ((defined('DOING_AJAX') && DOING_AJAX) || isset($_REQUEST['bulk_edit'])) { |
|
233 | 233 | return; |
234 | 234 | } |
235 | 235 | |
236 | 236 | // $post_id and $post are required |
237 | - if ( empty( $post_id ) || empty( $post ) || self::$saved_meta_boxes ) { |
|
237 | + if (empty($post_id) || empty($post) || self::$saved_meta_boxes) { |
|
238 | 238 | return; |
239 | 239 | } |
240 | 240 | |
241 | 241 | // Dont' save meta boxes for revisions or autosaves. |
242 | - if ( ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) || is_int( wp_is_post_revision( $post ) ) || is_int( wp_is_post_autosave( $post ) ) ) { |
|
242 | + if ((defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) || is_int(wp_is_post_revision($post)) || is_int(wp_is_post_autosave($post))) { |
|
243 | 243 | return; |
244 | 244 | } |
245 | 245 | |
246 | 246 | // Check the nonce. |
247 | - if ( empty( $data['getpaid_meta_nonce'] ) || ! wp_verify_nonce( $data['getpaid_meta_nonce'], 'getpaid_meta_nonce' ) ) { |
|
247 | + if (empty($data['getpaid_meta_nonce']) || !wp_verify_nonce($data['getpaid_meta_nonce'], 'getpaid_meta_nonce')) { |
|
248 | 248 | return; |
249 | 249 | } |
250 | 250 | |
251 | 251 | // Check the post being saved == the $post_id to prevent triggering this call for other save_post events. |
252 | - if ( empty( $data['post_ID'] ) || absint( $data['post_ID'] ) !== $post_id ) { |
|
252 | + if (empty($data['post_ID']) || absint($data['post_ID']) !== $post_id) { |
|
253 | 253 | return; |
254 | 254 | } |
255 | 255 | |
256 | 256 | // Check user has permission to edit. |
257 | - if ( ! current_user_can( 'edit_post', $post_id ) ) { |
|
257 | + if (!current_user_can('edit_post', $post_id)) { |
|
258 | 258 | return; |
259 | 259 | } |
260 | 260 | |
261 | - if ( getpaid_is_invoice_post_type( $post->post_type ) ) { |
|
261 | + if (getpaid_is_invoice_post_type($post->post_type)) { |
|
262 | 262 | |
263 | 263 | // We need this save event to run once to avoid potential endless loops. |
264 | 264 | self::$saved_meta_boxes = true; |
265 | 265 | |
266 | - return GetPaid_Meta_Box_Invoice_Address::save( $post_id, wp_kses_post_deep( $_POST ) ); |
|
266 | + return GetPaid_Meta_Box_Invoice_Address::save($post_id, wp_kses_post_deep($_POST)); |
|
267 | 267 | |
268 | 268 | } |
269 | 269 | |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | ); |
276 | 276 | |
277 | 277 | // Is this our post type? |
278 | - if ( ! isset( $post_types_map[ $post->post_type ] ) ) { |
|
278 | + if (!isset($post_types_map[$post->post_type])) { |
|
279 | 279 | return; |
280 | 280 | } |
281 | 281 | |
@@ -283,8 +283,8 @@ discard block |
||
283 | 283 | self::$saved_meta_boxes = true; |
284 | 284 | |
285 | 285 | // Save the post. |
286 | - $class = $post_types_map[ $post->post_type ]; |
|
287 | - $class::save( $post_id, wp_kses_post_deep( $_POST ), $post ); |
|
286 | + $class = $post_types_map[$post->post_type]; |
|
287 | + $class::save($post_id, wp_kses_post_deep($_POST), $post); |
|
288 | 288 | |
289 | 289 | } |
290 | 290 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if ( ! defined( 'ABSPATH' ) ) { |
|
3 | +if (!defined('ABSPATH')) { |
|
4 | 4 | exit; // Exit if accessed directly |
5 | 5 | } |
6 | 6 | |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | * |
19 | 19 | * @return string The rendered component. |
20 | 20 | */ |
21 | - public static function get($args = array()){ |
|
21 | + public static function get($args = array()) { |
|
22 | 22 | global $aui_bs5; |
23 | 23 | $defaults = array( |
24 | 24 | 'type' => 'info', |
@@ -34,47 +34,47 @@ discard block |
||
34 | 34 | /** |
35 | 35 | * Parse incoming $args into an array and merge it with $defaults |
36 | 36 | */ |
37 | - $args = wp_parse_args( $args, $defaults ); |
|
37 | + $args = wp_parse_args($args, $defaults); |
|
38 | 38 | $output = ''; |
39 | - if ( ! empty( $args['content'] ) ) { |
|
40 | - $type = sanitize_html_class( $args['type'] ); |
|
41 | - if($type=='error'){$type='danger';} |
|
42 | - $icon = !empty($args['icon']) ? "<i class='".esc_attr($args['icon'])."'></i>" : ''; |
|
39 | + if (!empty($args['content'])) { |
|
40 | + $type = sanitize_html_class($args['type']); |
|
41 | + if ($type == 'error') {$type = 'danger'; } |
|
42 | + $icon = !empty($args['icon']) ? "<i class='" . esc_attr($args['icon']) . "'></i>" : ''; |
|
43 | 43 | |
44 | 44 | // set default icon |
45 | - if(!$icon && $args['icon']!==false && $type){ |
|
46 | - if($type=='danger'){$icon = '<i class="fas fa-exclamation-circle"></i>';} |
|
47 | - elseif($type=='warning'){$icon = '<i class="fas fa-exclamation-triangle"></i>';} |
|
48 | - elseif($type=='success'){$icon = '<i class="fas fa-check-circle"></i>';} |
|
49 | - elseif($type=='info'){$icon = '<i class="fas fa-info-circle"></i>';} |
|
45 | + if (!$icon && $args['icon'] !== false && $type) { |
|
46 | + if ($type == 'danger') {$icon = '<i class="fas fa-exclamation-circle"></i>'; } |
|
47 | + elseif ($type == 'warning') {$icon = '<i class="fas fa-exclamation-triangle"></i>'; } |
|
48 | + elseif ($type == 'success') {$icon = '<i class="fas fa-check-circle"></i>'; } |
|
49 | + elseif ($type == 'info') {$icon = '<i class="fas fa-info-circle"></i>'; } |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | $data = ''; |
53 | 53 | $class = !empty($args['class']) ? esc_attr($args['class']) : ''; |
54 | - if($args['dismissible']){$class .= " alert-dismissible fade show";} |
|
54 | + if ($args['dismissible']) {$class .= " alert-dismissible fade show"; } |
|
55 | 55 | |
56 | 56 | // open |
57 | - $output .= '<div class="alert alert-' . $type . ' '.$class.'" role="alert" '.$data.'>'; |
|
57 | + $output .= '<div class="alert alert-' . $type . ' ' . $class . '" role="alert" ' . $data . '>'; |
|
58 | 58 | |
59 | 59 | // heading |
60 | - if ( ! empty( $args['heading'] ) ) { |
|
60 | + if (!empty($args['heading'])) { |
|
61 | 61 | $output .= '<h4 class="alert-heading">' . $args['heading'] . '</h4>'; |
62 | 62 | } |
63 | 63 | |
64 | 64 | // icon |
65 | - if ( ! empty( $icon) ) { |
|
66 | - $output .= $icon." "; |
|
65 | + if (!empty($icon)) { |
|
66 | + $output .= $icon . " "; |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | // content |
70 | 70 | $output .= $args['content']; |
71 | 71 | |
72 | 72 | // dismissible |
73 | - if($args['dismissible']){ |
|
73 | + if ($args['dismissible']) { |
|
74 | 74 | |
75 | - if ( $aui_bs5 ) { |
|
75 | + if ($aui_bs5) { |
|
76 | 76 | $output .= '<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>'; |
77 | - }else{ |
|
77 | + } else { |
|
78 | 78 | $output .= '<button type="button" class="close" data-dismiss="alert" aria-label="Close">'; |
79 | 79 | $output .= '<span aria-hidden="true">×</span>'; |
80 | 80 | $output .= '</button>'; |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | } |
83 | 83 | |
84 | 84 | // footer |
85 | - if ( ! empty( $args['footer'] ) ) { |
|
85 | + if (!empty($args['footer'])) { |
|
86 | 86 | $output .= '<hr>'; |
87 | 87 | $output .= '<p class="mb-0">' . $args['footer'] . '</p>'; |
88 | 88 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if ( ! defined( 'ABSPATH' ) ) { |
|
3 | +if (!defined('ABSPATH')) { |
|
4 | 4 | exit; // Exit if accessed directly |
5 | 5 | } |
6 | 6 | |
@@ -19,12 +19,12 @@ discard block |
||
19 | 19 | * |
20 | 20 | * @return string |
21 | 21 | */ |
22 | - public static function name( $text, $multiple = false ) { |
|
22 | + public static function name($text, $multiple = false) { |
|
23 | 23 | $output = ''; |
24 | 24 | |
25 | - if ( $text ) { |
|
26 | - $is_multiple = strpos( $text, '[' ) === false && $multiple ? '[]' : ''; |
|
27 | - $output = ' name="' . esc_attr( $text ) . $is_multiple . '" '; |
|
25 | + if ($text) { |
|
26 | + $is_multiple = strpos($text, '[') === false && $multiple ? '[]' : ''; |
|
27 | + $output = ' name="' . esc_attr($text) . $is_multiple . '" '; |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | return $output; |
@@ -37,11 +37,11 @@ discard block |
||
37 | 37 | * |
38 | 38 | * @return string The sanitized item. |
39 | 39 | */ |
40 | - public static function id( $text ) { |
|
40 | + public static function id($text) { |
|
41 | 41 | $output = ''; |
42 | 42 | |
43 | - if ( $text ) { |
|
44 | - $output = ' id="' . sanitize_html_class( $text ) . '" '; |
|
43 | + if ($text) { |
|
44 | + $output = ' id="' . sanitize_html_class($text) . '" '; |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | return $output; |
@@ -54,11 +54,11 @@ discard block |
||
54 | 54 | * |
55 | 55 | * @return string The sanitized item. |
56 | 56 | */ |
57 | - public static function title( $text ) { |
|
57 | + public static function title($text) { |
|
58 | 58 | $output = ''; |
59 | 59 | |
60 | - if ( $text ) { |
|
61 | - $output = ' title="' . esc_attr( $text ) . '" '; |
|
60 | + if ($text) { |
|
61 | + $output = ' title="' . esc_attr($text) . '" '; |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | return $output; |
@@ -71,11 +71,11 @@ discard block |
||
71 | 71 | * |
72 | 72 | * @return string The sanitized item. |
73 | 73 | */ |
74 | - public static function value( $text ) { |
|
74 | + public static function value($text) { |
|
75 | 75 | $output = ''; |
76 | 76 | |
77 | - if ( $text !== null && $text !== false ) { |
|
78 | - $output = ' value="' . esc_attr( wp_unslash( $text ) ) . '" '; |
|
77 | + if ($text !== null && $text !== false) { |
|
78 | + $output = ' value="' . esc_attr(wp_unslash($text)) . '" '; |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | return $output; |
@@ -88,12 +88,12 @@ discard block |
||
88 | 88 | * |
89 | 89 | * @return string The sanitized item. |
90 | 90 | */ |
91 | - public static function class_attr( $text ) { |
|
91 | + public static function class_attr($text) { |
|
92 | 92 | $output = ''; |
93 | 93 | |
94 | - if ( $text ) { |
|
95 | - $classes = self::esc_classes( $text ); |
|
96 | - if ( ! empty( $classes ) ) { |
|
94 | + if ($text) { |
|
95 | + $classes = self::esc_classes($text); |
|
96 | + if (!empty($classes)) { |
|
97 | 97 | $output = ' class="' . $classes . '" '; |
98 | 98 | } |
99 | 99 | } |
@@ -108,15 +108,15 @@ discard block |
||
108 | 108 | * |
109 | 109 | * @return string |
110 | 110 | */ |
111 | - public static function esc_classes( $text ) { |
|
111 | + public static function esc_classes($text) { |
|
112 | 112 | $output = ''; |
113 | 113 | |
114 | - if ( $text ) { |
|
115 | - $classes = explode( " ", $text ); |
|
116 | - $classes = array_map( "trim", $classes ); |
|
117 | - $classes = array_map( "sanitize_html_class", $classes ); |
|
118 | - if ( ! empty( $classes ) ) { |
|
119 | - $output = implode( " ", $classes ); |
|
114 | + if ($text) { |
|
115 | + $classes = explode(" ", $text); |
|
116 | + $classes = array_map("trim", $classes); |
|
117 | + $classes = array_map("sanitize_html_class", $classes); |
|
118 | + if (!empty($classes)) { |
|
119 | + $output = implode(" ", $classes); |
|
120 | 120 | } |
121 | 121 | } |
122 | 122 | |
@@ -129,14 +129,14 @@ discard block |
||
129 | 129 | * |
130 | 130 | * @return string |
131 | 131 | */ |
132 | - public static function data_attributes( $args ) { |
|
132 | + public static function data_attributes($args) { |
|
133 | 133 | $output = ''; |
134 | 134 | |
135 | - if ( ! empty( $args ) ) { |
|
135 | + if (!empty($args)) { |
|
136 | 136 | |
137 | - foreach ( $args as $key => $val ) { |
|
138 | - if ( substr( $key, 0, 5 ) === "data-" ) { |
|
139 | - $output .= ' ' . sanitize_html_class( $key ) . '="' . esc_attr( $val ) . '" '; |
|
137 | + foreach ($args as $key => $val) { |
|
138 | + if (substr($key, 0, 5) === "data-") { |
|
139 | + $output .= ' ' . sanitize_html_class($key) . '="' . esc_attr($val) . '" '; |
|
140 | 140 | } |
141 | 141 | } |
142 | 142 | } |
@@ -149,14 +149,14 @@ discard block |
||
149 | 149 | * |
150 | 150 | * @return string |
151 | 151 | */ |
152 | - public static function aria_attributes( $args ) { |
|
152 | + public static function aria_attributes($args) { |
|
153 | 153 | $output = ''; |
154 | 154 | |
155 | - if ( ! empty( $args ) ) { |
|
155 | + if (!empty($args)) { |
|
156 | 156 | |
157 | - foreach ( $args as $key => $val ) { |
|
158 | - if ( substr( $key, 0, 5 ) === "aria-" ) { |
|
159 | - $output .= ' ' . sanitize_html_class( $key ) . '="' . esc_attr( $val ) . '" '; |
|
157 | + foreach ($args as $key => $val) { |
|
158 | + if (substr($key, 0, 5) === "aria-") { |
|
159 | + $output .= ' ' . sanitize_html_class($key) . '="' . esc_attr($val) . '" '; |
|
160 | 160 | } |
161 | 161 | } |
162 | 162 | } |
@@ -173,19 +173,19 @@ discard block |
||
173 | 173 | * |
174 | 174 | * @return string |
175 | 175 | */ |
176 | - public static function icon( $class, $space_after = false, $extra_attributes = array() ) { |
|
176 | + public static function icon($class, $space_after = false, $extra_attributes = array()) { |
|
177 | 177 | $output = ''; |
178 | 178 | |
179 | - if ( $class ) { |
|
180 | - $classes = self::esc_classes( $class ); |
|
181 | - if ( ! empty( $classes ) ) { |
|
179 | + if ($class) { |
|
180 | + $classes = self::esc_classes($class); |
|
181 | + if (!empty($classes)) { |
|
182 | 182 | $output = '<i class="' . $classes . '" '; |
183 | 183 | // extra attributes |
184 | - if ( ! empty( $extra_attributes ) ) { |
|
185 | - $output .= AUI_Component_Helper::extra_attributes( $extra_attributes ); |
|
184 | + if (!empty($extra_attributes)) { |
|
185 | + $output .= AUI_Component_Helper::extra_attributes($extra_attributes); |
|
186 | 186 | } |
187 | 187 | $output .= '></i>'; |
188 | - if ( $space_after ) { |
|
188 | + if ($space_after) { |
|
189 | 189 | $output .= " "; |
190 | 190 | } |
191 | 191 | } |
@@ -199,14 +199,14 @@ discard block |
||
199 | 199 | * |
200 | 200 | * @return string |
201 | 201 | */ |
202 | - public static function extra_attributes( $args ) { |
|
202 | + public static function extra_attributes($args) { |
|
203 | 203 | $output = ''; |
204 | 204 | |
205 | - if ( ! empty( $args ) ) { |
|
205 | + if (!empty($args)) { |
|
206 | 206 | |
207 | - if ( is_array( $args ) ) { |
|
208 | - foreach ( $args as $key => $val ) { |
|
209 | - $output .= ' ' . sanitize_html_class( $key ) . '="' . esc_attr( $val ) . '" '; |
|
207 | + if (is_array($args)) { |
|
208 | + foreach ($args as $key => $val) { |
|
209 | + $output .= ' ' . sanitize_html_class($key) . '="' . esc_attr($val) . '" '; |
|
210 | 210 | } |
211 | 211 | } else { |
212 | 212 | $output .= ' ' . $args . ' '; |
@@ -222,11 +222,11 @@ discard block |
||
222 | 222 | * |
223 | 223 | * @return string |
224 | 224 | */ |
225 | - public static function help_text( $text ) { |
|
225 | + public static function help_text($text) { |
|
226 | 226 | $output = ''; |
227 | 227 | |
228 | - if ( $text ) { |
|
229 | - $output .= '<small class="form-text text-muted d-block">' . wp_kses_post( $text ) . '</small>'; |
|
228 | + if ($text) { |
|
229 | + $output .= '<small class="form-text text-muted d-block">' . wp_kses_post($text) . '</small>'; |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | |
@@ -240,17 +240,17 @@ discard block |
||
240 | 240 | * |
241 | 241 | * @return string|void |
242 | 242 | */ |
243 | - public static function element_require( $input ) { |
|
243 | + public static function element_require($input) { |
|
244 | 244 | |
245 | - $input = str_replace( "'", '"', $input );// we only want double quotes |
|
245 | + $input = str_replace("'", '"', $input); // we only want double quotes |
|
246 | 246 | |
247 | - $output = esc_attr( str_replace( array( "[%", "%]", "%:checked]" ), array( |
|
247 | + $output = esc_attr(str_replace(array("[%", "%]", "%:checked]"), array( |
|
248 | 248 | "jQuery(form).find('[data-argument=\"", |
249 | 249 | "\"]').find('input,select,textarea').val()", |
250 | 250 | "\"]').find('input:checked').val()", |
251 | - ), $input ) ); |
|
251 | + ), $input)); |
|
252 | 252 | |
253 | - if ( $output ) { |
|
253 | + if ($output) { |
|
254 | 254 | $output = ' data-element-require="' . $output . '" '; |
255 | 255 | } |
256 | 256 | |
@@ -267,21 +267,21 @@ discard block |
||
267 | 267 | * |
268 | 268 | * @return mixed Stripped value. |
269 | 269 | */ |
270 | - public static function sanitize_html_field( $value, $input = array() ) { |
|
270 | + public static function sanitize_html_field($value, $input = array()) { |
|
271 | 271 | $original = $value; |
272 | 272 | |
273 | - if ( is_array( $value ) ) { |
|
274 | - foreach ( $value as $index => $item ) { |
|
275 | - $value[ $index ] = self::_sanitize_html_field( $value, $input ); |
|
273 | + if (is_array($value)) { |
|
274 | + foreach ($value as $index => $item) { |
|
275 | + $value[$index] = self::_sanitize_html_field($value, $input); |
|
276 | 276 | } |
277 | - } elseif ( is_object( $value ) ) { |
|
278 | - $object_vars = get_object_vars( $value ); |
|
277 | + } elseif (is_object($value)) { |
|
278 | + $object_vars = get_object_vars($value); |
|
279 | 279 | |
280 | - foreach ( $object_vars as $property_name => $property_value ) { |
|
281 | - $value->$property_name = self::_sanitize_html_field( $property_value, $input ); |
|
280 | + foreach ($object_vars as $property_name => $property_value) { |
|
281 | + $value->$property_name = self::_sanitize_html_field($property_value, $input); |
|
282 | 282 | } |
283 | 283 | } else { |
284 | - $value = self::_sanitize_html_field( $value, $input ); |
|
284 | + $value = self::_sanitize_html_field($value, $input); |
|
285 | 285 | } |
286 | 286 | |
287 | 287 | /** |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | * @param string|array $value Original content without filter. |
294 | 294 | * @param array $input Input Field. |
295 | 295 | */ |
296 | - return apply_filters( 'ayecode_ui_sanitize_html_field', $value, $original, $input ); |
|
296 | + return apply_filters('ayecode_ui_sanitize_html_field', $value, $original, $input); |
|
297 | 297 | } |
298 | 298 | |
299 | 299 | /** |
@@ -316,20 +316,20 @@ discard block |
||
316 | 316 | * |
317 | 317 | * @return string Filtered content with only allowed HTML elements. |
318 | 318 | */ |
319 | - public static function _sanitize_html_field( $value, $input = array() ) { |
|
320 | - if ( $value === '' ) { |
|
319 | + public static function _sanitize_html_field($value, $input = array()) { |
|
320 | + if ($value === '') { |
|
321 | 321 | return $value; |
322 | 322 | } |
323 | 323 | |
324 | - $allowed_html = self::kses_allowed_html( 'post', $input ); |
|
324 | + $allowed_html = self::kses_allowed_html('post', $input); |
|
325 | 325 | |
326 | - if ( ! is_array( $allowed_html ) ) { |
|
327 | - $allowed_html = wp_kses_allowed_html( 'post' ); |
|
326 | + if (!is_array($allowed_html)) { |
|
327 | + $allowed_html = wp_kses_allowed_html('post'); |
|
328 | 328 | } |
329 | 329 | |
330 | - $filtered = trim( wp_unslash( $value ) ); |
|
331 | - $filtered = wp_kses( $filtered, $allowed_html ); |
|
332 | - $filtered = balanceTags( $filtered ); // Balances tags |
|
330 | + $filtered = trim(wp_unslash($value)); |
|
331 | + $filtered = wp_kses($filtered, $allowed_html); |
|
332 | + $filtered = balanceTags($filtered); // Balances tags |
|
333 | 333 | |
334 | 334 | return $filtered; |
335 | 335 | } |
@@ -346,12 +346,12 @@ discard block |
||
346 | 346 | * |
347 | 347 | * @return array Array of allowed HTML tags and their allowed attributes. |
348 | 348 | */ |
349 | - public static function kses_allowed_html( $context = 'post', $input = array() ) { |
|
350 | - $allowed_html = wp_kses_allowed_html( $context ); |
|
349 | + public static function kses_allowed_html($context = 'post', $input = array()) { |
|
350 | + $allowed_html = wp_kses_allowed_html($context); |
|
351 | 351 | |
352 | - if ( is_array( $allowed_html ) ) { |
|
352 | + if (is_array($allowed_html)) { |
|
353 | 353 | // <iframe> |
354 | - if ( ! isset( $allowed_html['iframe'] ) && $context == 'post' ) { |
|
354 | + if (!isset($allowed_html['iframe']) && $context == 'post') { |
|
355 | 355 | $allowed_html['iframe'] = array( |
356 | 356 | 'class' => true, |
357 | 357 | 'id' => true, |
@@ -380,23 +380,23 @@ discard block |
||
380 | 380 | * @param @param string|array $context The context for which to retrieve tags. |
381 | 381 | * @param array $input Input field. |
382 | 382 | */ |
383 | - return apply_filters( 'ayecode_ui_kses_allowed_html', $allowed_html, $context, $input ); |
|
383 | + return apply_filters('ayecode_ui_kses_allowed_html', $allowed_html, $context, $input); |
|
384 | 384 | } |
385 | 385 | |
386 | - public static function get_column_class( $label_number = 2, $type = 'label' ) { |
|
386 | + public static function get_column_class($label_number = 2, $type = 'label') { |
|
387 | 387 | |
388 | 388 | $class = ''; |
389 | 389 | |
390 | 390 | // set default if empty |
391 | - if( $label_number === '' ){ |
|
391 | + if ($label_number === '') { |
|
392 | 392 | $label_number = 2; |
393 | 393 | } |
394 | 394 | |
395 | - if ( $label_number && $label_number < 12 && $label_number > 0 ) { |
|
396 | - if ( $type == 'label' ) { |
|
397 | - $class = 'col-sm-' . absint( $label_number ); |
|
398 | - } elseif ( $type == 'input' ) { |
|
399 | - $class = 'col-sm-' . ( 12 - absint( $label_number ) ); |
|
395 | + if ($label_number && $label_number < 12 && $label_number > 0) { |
|
396 | + if ($type == 'label') { |
|
397 | + $class = 'col-sm-' . absint($label_number); |
|
398 | + } elseif ($type == 'input') { |
|
399 | + $class = 'col-sm-' . (12 - absint($label_number)); |
|
400 | 400 | } |
401 | 401 | } |
402 | 402 | |
@@ -415,8 +415,8 @@ discard block |
||
415 | 415 | * @param string $str String to sanitize. |
416 | 416 | * @return string Sanitized string. |
417 | 417 | */ |
418 | - public static function sanitize_textarea_field( $str ) { |
|
419 | - $filtered = self::_sanitize_text_fields( $str, true ); |
|
418 | + public static function sanitize_textarea_field($str) { |
|
419 | + $filtered = self::_sanitize_text_fields($str, true); |
|
420 | 420 | |
421 | 421 | /** |
422 | 422 | * Filters a sanitized textarea field string. |
@@ -426,7 +426,7 @@ discard block |
||
426 | 426 | * @param string $filtered The sanitized string. |
427 | 427 | * @param string $str The string prior to being sanitized. |
428 | 428 | */ |
429 | - return apply_filters( 'sanitize_textarea_field', $filtered, $str ); |
|
429 | + return apply_filters('sanitize_textarea_field', $filtered, $str); |
|
430 | 430 | } |
431 | 431 | |
432 | 432 | /** |
@@ -439,40 +439,40 @@ discard block |
||
439 | 439 | * @param bool $keep_newlines Optional. Whether to keep newlines. Default: false. |
440 | 440 | * @return string Sanitized string. |
441 | 441 | */ |
442 | - public static function _sanitize_text_fields( $str, $keep_newlines = false ) { |
|
443 | - if ( is_object( $str ) || is_array( $str ) ) { |
|
442 | + public static function _sanitize_text_fields($str, $keep_newlines = false) { |
|
443 | + if (is_object($str) || is_array($str)) { |
|
444 | 444 | return ''; |
445 | 445 | } |
446 | 446 | |
447 | 447 | $str = (string) $str; |
448 | 448 | |
449 | - $filtered = wp_check_invalid_utf8( $str ); |
|
449 | + $filtered = wp_check_invalid_utf8($str); |
|
450 | 450 | |
451 | - if ( strpos( $filtered, '<' ) !== false ) { |
|
452 | - $filtered = wp_pre_kses_less_than( $filtered ); |
|
451 | + if (strpos($filtered, '<') !== false) { |
|
452 | + $filtered = wp_pre_kses_less_than($filtered); |
|
453 | 453 | // This will strip extra whitespace for us. |
454 | - $filtered = wp_strip_all_tags( $filtered, false ); |
|
454 | + $filtered = wp_strip_all_tags($filtered, false); |
|
455 | 455 | |
456 | 456 | // Use HTML entities in a special case to make sure no later |
457 | 457 | // newline stripping stage could lead to a functional tag. |
458 | - $filtered = str_replace( "<\n", "<\n", $filtered ); |
|
458 | + $filtered = str_replace("<\n", "<\n", $filtered); |
|
459 | 459 | } |
460 | 460 | |
461 | - if ( ! $keep_newlines ) { |
|
462 | - $filtered = preg_replace( '/[\r\n\t ]+/', ' ', $filtered ); |
|
461 | + if (!$keep_newlines) { |
|
462 | + $filtered = preg_replace('/[\r\n\t ]+/', ' ', $filtered); |
|
463 | 463 | } |
464 | - $filtered = trim( $filtered ); |
|
464 | + $filtered = trim($filtered); |
|
465 | 465 | |
466 | 466 | $found = false; |
467 | - while ( preg_match( '`[^%](%[a-f0-9]{2})`i', $filtered, $match ) ) { |
|
468 | - $filtered = str_replace( $match[1], '', $filtered ); |
|
467 | + while (preg_match('`[^%](%[a-f0-9]{2})`i', $filtered, $match)) { |
|
468 | + $filtered = str_replace($match[1], '', $filtered); |
|
469 | 469 | $found = true; |
470 | 470 | } |
471 | - unset( $match ); |
|
471 | + unset($match); |
|
472 | 472 | |
473 | - if ( $found ) { |
|
473 | + if ($found) { |
|
474 | 474 | // Strip out the whitespace that may now exist after removing the octets. |
475 | - $filtered = trim( preg_replace( '` +`', ' ', $filtered ) ); |
|
475 | + $filtered = trim(preg_replace('` +`', ' ', $filtered)); |
|
476 | 476 | } |
477 | 477 | |
478 | 478 | return $filtered; |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | */ |
16 | 16 | |
17 | 17 | // If this file is called directly, abort. |
18 | -if ( ! defined( 'WPINC' ) ) { |
|
18 | +if (!defined('WPINC')) { |
|
19 | 19 | die; |
20 | 20 | } |
21 | 21 | |
@@ -29,14 +29,14 @@ discard block |
||
29 | 29 | public function __construct() { |
30 | 30 | |
31 | 31 | // load AUI |
32 | - require_once( dirname( __FILE__ ) . '/ayecode-ui-loader.php' ); |
|
32 | + require_once(dirname(__FILE__) . '/ayecode-ui-loader.php'); |
|
33 | 33 | |
34 | 34 | // Maybe show example page |
35 | - add_action( 'template_redirect', array( $this,'maybe_show_examples' ) ); |
|
35 | + add_action('template_redirect', array($this, 'maybe_show_examples')); |
|
36 | 36 | } |
37 | 37 | |
38 | - public function maybe_show_examples(){ |
|
39 | - if ( current_user_can( 'manage_options' ) && isset( $_REQUEST['preview-aui'] ) ) { |
|
38 | + public function maybe_show_examples() { |
|
39 | + if (current_user_can('manage_options') && isset($_REQUEST['preview-aui'])) { |
|
40 | 40 | echo "<head>"; |
41 | 41 | wp_head(); |
42 | 42 | echo "</head>"; |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | } |
49 | 49 | } |
50 | 50 | |
51 | - public function get_examples(){ |
|
51 | + public function get_examples() { |
|
52 | 52 | $output = ''; |
53 | 53 | |
54 | 54 | // open form |
@@ -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 | * Returns the errors as html |
@@ -15,35 +15,35 @@ discard block |
||
15 | 15 | * @param bool $wrap whether or not to wrap the errors. |
16 | 16 | * @since 1.0.19 |
17 | 17 | */ |
18 | -function getpaid_get_errors_html( $clear = true, $wrap = true ) { |
|
18 | +function getpaid_get_errors_html($clear = true, $wrap = true) { |
|
19 | 19 | |
20 | 20 | $errors = ''; |
21 | - foreach ( wpinv_get_errors() as $id => $error ) { |
|
22 | - $type = 'error'; |
|
21 | + foreach (wpinv_get_errors() as $id => $error) { |
|
22 | + $type = 'error'; |
|
23 | 23 | |
24 | - if ( is_array( $error ) ) { |
|
24 | + if (is_array($error)) { |
|
25 | 25 | $type = $error['type']; |
26 | 26 | $error = $error['text']; |
27 | 27 | } |
28 | 28 | |
29 | - if ( $wrap ) { |
|
29 | + if ($wrap) { |
|
30 | 30 | |
31 | 31 | $errors .= aui()->alert( |
32 | 32 | array( |
33 | - 'content' => wp_kses_post( $error ), |
|
33 | + 'content' => wp_kses_post($error), |
|
34 | 34 | 'type' => $type, |
35 | 35 | ) |
36 | 36 | ); |
37 | 37 | |
38 | 38 | } else { |
39 | 39 | |
40 | - $id = esc_attr( $id ); |
|
41 | - $error = wp_kses_post( $error ); |
|
40 | + $id = esc_attr($id); |
|
41 | + $error = wp_kses_post($error); |
|
42 | 42 | $errors .= "<div data-code='$id'>$error</div>"; |
43 | 43 | } |
44 | 44 | } |
45 | 45 | |
46 | - if ( $clear ) { |
|
46 | + if ($clear) { |
|
47 | 47 | wpinv_clear_errors(); |
48 | 48 | } |
49 | 49 | |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | * Prints (then clears) all available errors. |
56 | 56 | */ |
57 | 57 | function wpinv_print_errors() { |
58 | - echo wp_kses_post( getpaid_get_errors_html() ); |
|
58 | + echo wp_kses_post(getpaid_get_errors_html()); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
@@ -69,54 +69,54 @@ discard block |
||
69 | 69 | $all_errors = array( |
70 | 70 | 'perm_cancel_subscription' => array( |
71 | 71 | 'type' => 'error', |
72 | - 'text' => __( 'You do not have permission to cancel this subscription', 'invoicing' ), |
|
72 | + 'text' => __('You do not have permission to cancel this subscription', 'invoicing'), |
|
73 | 73 | ), |
74 | 74 | 'cannot_cancel_subscription' => array( |
75 | 75 | 'type' => 'error', |
76 | - 'text' => __( 'This subscription cannot be cancelled as it is not active.', 'invoicing' ), |
|
76 | + 'text' => __('This subscription cannot be cancelled as it is not active.', 'invoicing'), |
|
77 | 77 | ), |
78 | 78 | 'cancelled_subscription' => array( |
79 | 79 | 'type' => 'success', |
80 | - 'text' => __( 'Subscription cancelled successfully.', 'invoicing' ), |
|
80 | + 'text' => __('Subscription cancelled successfully.', 'invoicing'), |
|
81 | 81 | ), |
82 | 82 | 'address_updated' => array( |
83 | 83 | 'type' => 'success', |
84 | - 'text' => __( 'Address updated successfully.', 'invoicing' ), |
|
84 | + 'text' => __('Address updated successfully.', 'invoicing'), |
|
85 | 85 | ), |
86 | 86 | 'perm_delete_invoice' => array( |
87 | 87 | 'type' => 'error', |
88 | - 'text' => __( 'You do not have permission to delete this invoice', 'invoicing' ), |
|
88 | + 'text' => __('You do not have permission to delete this invoice', 'invoicing'), |
|
89 | 89 | ), |
90 | 90 | 'cannot_delete_invoice' => array( |
91 | 91 | 'type' => 'error', |
92 | - 'text' => __( 'This invoice cannot be deleted as it has already been paid.', 'invoicing' ), |
|
92 | + 'text' => __('This invoice cannot be deleted as it has already been paid.', 'invoicing'), |
|
93 | 93 | ), |
94 | 94 | 'deleted_invoice' => array( |
95 | 95 | 'type' => 'success', |
96 | - 'text' => __( 'Invoice deleted successfully.', 'invoicing' ), |
|
96 | + 'text' => __('Invoice deleted successfully.', 'invoicing'), |
|
97 | 97 | ), |
98 | 98 | 'card_declined' => array( |
99 | 99 | 'type' => 'error', |
100 | - 'text' => __( 'Your card was declined.', 'invoicing' ), |
|
100 | + 'text' => __('Your card was declined.', 'invoicing'), |
|
101 | 101 | ), |
102 | 102 | 'invalid_currency' => array( |
103 | 103 | 'type' => 'error', |
104 | - 'text' => __( 'The chosen payment gateway does not support this currency.', 'invoicing' ), |
|
104 | + 'text' => __('The chosen payment gateway does not support this currency.', 'invoicing'), |
|
105 | 105 | ), |
106 | 106 | ); |
107 | 107 | |
108 | - $errors = apply_filters( 'wpinv_errors', array() ); |
|
108 | + $errors = apply_filters('wpinv_errors', array()); |
|
109 | 109 | |
110 | - if ( isset( $_GET['wpinv-notice'] ) && isset( $all_errors[ $_GET['wpinv-notice'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
111 | - $errors[ $_GET['wpinv-notice'] ] = $all_errors[ $_GET['wpinv-notice'] ]; // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
110 | + if (isset($_GET['wpinv-notice']) && isset($all_errors[$_GET['wpinv-notice']])) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
111 | + $errors[$_GET['wpinv-notice']] = $all_errors[$_GET['wpinv-notice']]; // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
112 | 112 | } |
113 | 113 | |
114 | - if ( isset( $GLOBALS['wpinv_notice'] ) && isset( $all_errors[ $GLOBALS['wpinv_notice'] ] ) ) { |
|
115 | - $errors[ $GLOBALS['wpinv_notice'] ] = $all_errors[ $GLOBALS['wpinv_notice'] ]; |
|
114 | + if (isset($GLOBALS['wpinv_notice']) && isset($all_errors[$GLOBALS['wpinv_notice']])) { |
|
115 | + $errors[$GLOBALS['wpinv_notice']] = $all_errors[$GLOBALS['wpinv_notice']]; |
|
116 | 116 | } |
117 | 117 | |
118 | - if ( isset( $GLOBALS['wpinv_custom_notice'] ) ) { |
|
119 | - $errors[ $GLOBALS['wpinv_custom_notice']['code'] ] = $GLOBALS['wpinv_custom_notice']; |
|
118 | + if (isset($GLOBALS['wpinv_custom_notice'])) { |
|
119 | + $errors[$GLOBALS['wpinv_custom_notice']['code']] = $GLOBALS['wpinv_custom_notice']; |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | return $errors; |
@@ -129,9 +129,9 @@ discard block |
||
129 | 129 | * @param string $error The error message. |
130 | 130 | * @param string $type The error type. |
131 | 131 | */ |
132 | -function wpinv_set_error( $error_id, $message = '', $type = 'error' ) { |
|
132 | +function wpinv_set_error($error_id, $message = '', $type = 'error') { |
|
133 | 133 | |
134 | - if ( ! empty( $message ) ) { |
|
134 | + if (!empty($message)) { |
|
135 | 135 | $GLOBALS['wpinv_custom_notice'] = array( |
136 | 136 | 'code' => $error_id, |
137 | 137 | 'type' => $type, |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | * |
148 | 148 | */ |
149 | 149 | function wpinv_has_errors() { |
150 | - return count( wpinv_get_errors() ) > 0; |
|
150 | + return count(wpinv_get_errors()) > 0; |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | /** |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | * |
156 | 156 | */ |
157 | 157 | function wpinv_clear_errors() { |
158 | - unset( $GLOBALS['wpinv_notice'] ); |
|
158 | + unset($GLOBALS['wpinv_notice']); |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | /** |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | * |
164 | 164 | */ |
165 | 165 | function wpinv_unset_error() { |
166 | - unset( $GLOBALS['wpinv_notice'] ); |
|
166 | + unset($GLOBALS['wpinv_notice']); |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | /** |
@@ -174,15 +174,15 @@ discard block |
||
174 | 174 | * @param string $message Message to log. |
175 | 175 | * @param string $version Version the message was added in. |
176 | 176 | */ |
177 | -function getpaid_doing_it_wrong( $function, $message, $version ) { |
|
177 | +function getpaid_doing_it_wrong($function, $message, $version) { |
|
178 | 178 | |
179 | 179 | $message .= ' Backtrace: ' . wp_debug_backtrace_summary(); |
180 | 180 | |
181 | - if ( wp_doing_ajax() || defined( 'REST_REQUEST' ) ) { |
|
182 | - do_action( 'doing_it_wrong_run', $function, $message, $version ); |
|
183 | - error_log( "{$function} was called incorrectly. {$message}. This message was added in version {$version}." ); |
|
181 | + if (wp_doing_ajax() || defined('REST_REQUEST')) { |
|
182 | + do_action('doing_it_wrong_run', $function, $message, $version); |
|
183 | + error_log("{$function} was called incorrectly. {$message}. This message was added in version {$version}."); |
|
184 | 184 | } else { |
185 | - _doing_it_wrong( esc_html( $function ), wp_kses_post( $message ), esc_html( $version ) ); |
|
185 | + _doing_it_wrong(esc_html($function), wp_kses_post($message), esc_html($version)); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | } |
@@ -196,41 +196,41 @@ discard block |
||
196 | 196 | * @param string $line The line that contains the error. |
197 | 197 | * @param bool $exit Whether or not to exit function execution. |
198 | 198 | */ |
199 | -function wpinv_error_log( $log, $title = '', $file = '', $line = '', $exit = false ) { |
|
199 | +function wpinv_error_log($log, $title = '', $file = '', $line = '', $exit = false) { |
|
200 | 200 | |
201 | - if ( true === apply_filters( 'wpinv_log_errors', true ) ) { |
|
201 | + if (true === apply_filters('wpinv_log_errors', true)) { |
|
202 | 202 | |
203 | 203 | // Ensure the log is a scalar. |
204 | - if ( ! is_scalar( $log ) ) { |
|
205 | - $log = print_r( $log, true ); |
|
204 | + if (!is_scalar($log)) { |
|
205 | + $log = print_r($log, true); |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | // Add title. |
209 | - if ( ! empty( $title ) ) { |
|
210 | - $log = $title . ' ' . trim( $log ); |
|
209 | + if (!empty($title)) { |
|
210 | + $log = $title . ' ' . trim($log); |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | // Add the file to the label. |
214 | - if ( ! empty( $file ) ) { |
|
214 | + if (!empty($file)) { |
|
215 | 215 | $log .= ' in ' . $file; |
216 | 216 | } |
217 | 217 | |
218 | 218 | // Add the line number to the label. |
219 | - if ( ! empty( $line ) ) { |
|
219 | + if (!empty($line)) { |
|
220 | 220 | $log .= ' on line ' . $line; |
221 | 221 | } |
222 | 222 | |
223 | 223 | // Log the message. |
224 | - error_log( trim( $log ) ); |
|
224 | + error_log(trim($log)); |
|
225 | 225 | |
226 | 226 | // ... and a backtrace. |
227 | - if ( false !== $title && false !== $file ) { |
|
228 | - error_log( 'Backtrace ' . wp_debug_backtrace_summary() ); |
|
227 | + if (false !== $title && false !== $file) { |
|
228 | + error_log('Backtrace ' . wp_debug_backtrace_summary()); |
|
229 | 229 | } |
230 | 230 | } |
231 | 231 | |
232 | 232 | // Maybe exit. |
233 | - if ( $exit ) { |
|
233 | + if ($exit) { |
|
234 | 234 | exit; |
235 | 235 | } |
236 | 236 |
@@ -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 | * Payment form submission itemss class |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @param GetPaid_Payment_Form_Submission $submission |
25 | 25 | */ |
26 | - public function __construct( $submission ) { |
|
26 | + public function __construct($submission) { |
|
27 | 27 | |
28 | 28 | $data = $submission->get_data(); |
29 | 29 | $payment_form = $submission->get_payment_form(); |
@@ -32,46 +32,46 @@ discard block |
||
32 | 32 | |
33 | 33 | // Prepare the selected items. |
34 | 34 | $selected_items = array(); |
35 | - if ( ! empty( $data['getpaid-items'] ) ) { |
|
36 | - $selected_items = wpinv_clean( $data['getpaid-items'] ); |
|
35 | + if (!empty($data['getpaid-items'])) { |
|
36 | + $selected_items = wpinv_clean($data['getpaid-items']); |
|
37 | 37 | |
38 | - if ( ! empty( $invoice ) && $submission->is_initial_fetch() ) { |
|
39 | - foreach ( $invoice->get_items() as $invoice_item ) { |
|
40 | - if ( isset( $selected_items[ $invoice_item->get_id() ] ) ) { |
|
41 | - $selected_items[ $invoice_item->get_id() ]['quantity'] = $invoice_item->get_quantity(); |
|
42 | - $selected_items[ $invoice_item->get_id() ]['price'] = $invoice_item->get_price(); |
|
38 | + if (!empty($invoice) && $submission->is_initial_fetch()) { |
|
39 | + foreach ($invoice->get_items() as $invoice_item) { |
|
40 | + if (isset($selected_items[$invoice_item->get_id()])) { |
|
41 | + $selected_items[$invoice_item->get_id()]['quantity'] = $invoice_item->get_quantity(); |
|
42 | + $selected_items[$invoice_item->get_id()]['price'] = $invoice_item->get_price(); |
|
43 | 43 | |
44 | - $force_prices[ $invoice_item->get_id() ] = $invoice_item->get_price(); |
|
44 | + $force_prices[$invoice_item->get_id()] = $invoice_item->get_price(); |
|
45 | 45 | } |
46 | 46 | } |
47 | 47 | } |
48 | 48 | } |
49 | 49 | |
50 | 50 | // (Maybe) set form items. |
51 | - if ( isset( $data['getpaid-form-items'] ) ) { |
|
51 | + if (isset($data['getpaid-form-items'])) { |
|
52 | 52 | |
53 | 53 | // Confirm items key. |
54 | - $form_items = wpinv_clean( $data['getpaid-form-items'] ); |
|
55 | - if ( ! isset( $data['getpaid-form-items-key'] ) || md5( NONCE_KEY . AUTH_KEY . $form_items ) !== $data['getpaid-form-items-key'] ) { |
|
56 | - throw new Exception( __( 'We could not validate the form items. Please reload the page and try again.', 'invoicing' ) ); |
|
54 | + $form_items = wpinv_clean($data['getpaid-form-items']); |
|
55 | + if (!isset($data['getpaid-form-items-key']) || md5(NONCE_KEY . AUTH_KEY . $form_items) !== $data['getpaid-form-items-key']) { |
|
56 | + throw new Exception(__('We could not validate the form items. Please reload the page and try again.', 'invoicing')); |
|
57 | 57 | } |
58 | 58 | |
59 | - $items = array(); |
|
59 | + $items = array(); |
|
60 | 60 | $item_ids = array(); |
61 | 61 | |
62 | - foreach ( getpaid_convert_items_to_array( $form_items ) as $item_id => $qty ) { |
|
63 | - if ( ! in_array( $item_id, $item_ids ) ) { |
|
64 | - $item = new GetPaid_Form_Item( $item_id ); |
|
65 | - $item->set_quantity( $qty ); |
|
62 | + foreach (getpaid_convert_items_to_array($form_items) as $item_id => $qty) { |
|
63 | + if (!in_array($item_id, $item_ids)) { |
|
64 | + $item = new GetPaid_Form_Item($item_id); |
|
65 | + $item->set_quantity($qty); |
|
66 | 66 | |
67 | - if ( empty( $qty ) ) { |
|
68 | - $item->set_allow_quantities( true ); |
|
69 | - $item->set_is_required( false ); |
|
67 | + if (empty($qty)) { |
|
68 | + $item->set_allow_quantities(true); |
|
69 | + $item->set_is_required(false); |
|
70 | 70 | } |
71 | 71 | |
72 | - if ( ! $item->user_can_set_their_price() && isset( $force_prices[ $item_id ] ) ) { |
|
73 | - $item->set_is_dynamic_pricing( true ); |
|
74 | - $item->set_minimum_price( 0 ); |
|
72 | + if (!$item->user_can_set_their_price() && isset($force_prices[$item_id])) { |
|
73 | + $item->set_is_dynamic_pricing(true); |
|
74 | + $item->set_minimum_price(0); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | $item_ids[] = $item->get_id(); |
@@ -79,23 +79,23 @@ discard block |
||
79 | 79 | } |
80 | 80 | } |
81 | 81 | |
82 | - if ( ! $payment_form->is_default() ) { |
|
82 | + if (!$payment_form->is_default()) { |
|
83 | 83 | |
84 | - foreach ( $payment_form->get_items() as $item ) { |
|
85 | - if ( ! in_array( $item->get_id(), $item_ids ) ) { |
|
84 | + foreach ($payment_form->get_items() as $item) { |
|
85 | + if (!in_array($item->get_id(), $item_ids)) { |
|
86 | 86 | $item_ids[] = $item->get_id(); |
87 | 87 | $items[] = $item; |
88 | 88 | } |
89 | 89 | } |
90 | 90 | } |
91 | 91 | |
92 | - $payment_form->set_items( $items ); |
|
92 | + $payment_form->set_items($items); |
|
93 | 93 | |
94 | 94 | } |
95 | 95 | |
96 | 96 | // Process each individual item. |
97 | - foreach ( $payment_form->get_items() as $item ) { |
|
98 | - $this->process_item( $item, $selected_items, $submission ); |
|
97 | + foreach ($payment_form->get_items() as $item) { |
|
98 | + $this->process_item($item, $selected_items, $submission); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | } |
@@ -107,40 +107,40 @@ discard block |
||
107 | 107 | * @param array $selected_items |
108 | 108 | * @param GetPaid_Payment_Form_Submission $submission |
109 | 109 | */ |
110 | - public function process_item( $item, $selected_items, $submission ) { |
|
110 | + public function process_item($item, $selected_items, $submission) { |
|
111 | 111 | |
112 | 112 | // Abort if this is an optional item and it has not been selected. |
113 | - if ( ! $item->is_required() && ! isset( $selected_items[ $item->get_id() ] ) ) { |
|
113 | + if (!$item->is_required() && !isset($selected_items[$item->get_id()])) { |
|
114 | 114 | return; |
115 | 115 | } |
116 | 116 | |
117 | 117 | // (maybe) let customers change the quantities and prices. |
118 | - if ( isset( $selected_items[ $item->get_id() ] ) ) { |
|
118 | + if (isset($selected_items[$item->get_id()])) { |
|
119 | 119 | |
120 | 120 | // Maybe change the quantities. |
121 | - if ( $item->allows_quantities() ) { |
|
122 | - $item->set_quantity( (float) $selected_items[ $item->get_id() ]['quantity'] ); |
|
121 | + if ($item->allows_quantities()) { |
|
122 | + $item->set_quantity((float) $selected_items[$item->get_id()]['quantity']); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | // Maybe change the price. |
126 | - if ( $item->user_can_set_their_price() ) { |
|
127 | - $price = (float) wpinv_sanitize_amount( $selected_items[ $item->get_id() ]['price'] ); |
|
126 | + if ($item->user_can_set_their_price()) { |
|
127 | + $price = (float) wpinv_sanitize_amount($selected_items[$item->get_id()]['price']); |
|
128 | 128 | |
129 | - if ( $item->get_minimum_price() > $price ) { |
|
130 | - throw new Exception( sprintf( __( 'The minimum allowed amount is %s', 'invoicing' ), getpaid_unstandardize_amount( $item->get_minimum_price() ) ) ); |
|
129 | + if ($item->get_minimum_price() > $price) { |
|
130 | + throw new Exception(sprintf(__('The minimum allowed amount is %s', 'invoicing'), getpaid_unstandardize_amount($item->get_minimum_price()))); |
|
131 | 131 | } |
132 | 132 | |
133 | - $item->set_price( $price ); |
|
133 | + $item->set_price($price); |
|
134 | 134 | |
135 | 135 | } |
136 | 136 | } |
137 | 137 | |
138 | - if ( 0 == $item->get_quantity() ) { |
|
138 | + if (0 == $item->get_quantity()) { |
|
139 | 139 | return; |
140 | 140 | } |
141 | 141 | |
142 | 142 | // Save the item. |
143 | - $this->items[] = apply_filters( 'getpaid_payment_form_submission_processed_item', $item, $submission ); |
|
143 | + $this->items[] = apply_filters('getpaid_payment_form_submission_processed_item', $item, $submission); |
|
144 | 144 | |
145 | 145 | } |
146 | 146 |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) { |
|
2 | +if (!defined('ABSPATH')) { |
|
3 | 3 | exit; |
4 | 4 | } |
5 | 5 | |
@@ -94,9 +94,9 @@ discard block |
||
94 | 94 | * @param string $context View or edit context. |
95 | 95 | * @return string |
96 | 96 | */ |
97 | - public function get_name( $context = 'view' ) { |
|
98 | - $name = parent::get_name( $context ); |
|
99 | - return $name . wpinv_get_item_suffix( $this ); |
|
97 | + public function get_name($context = 'view') { |
|
98 | + $name = parent::get_name($context); |
|
99 | + return $name . wpinv_get_item_suffix($this); |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | /** |
@@ -106,8 +106,8 @@ discard block |
||
106 | 106 | * @param string $context View or edit context. |
107 | 107 | * @return string |
108 | 108 | */ |
109 | - public function get_raw_name( $context = 'view' ) { |
|
110 | - return parent::get_name( $context ); |
|
109 | + public function get_raw_name($context = 'view') { |
|
110 | + return parent::get_name($context); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | /** |
@@ -117,13 +117,13 @@ discard block |
||
117 | 117 | * @param string $context View or edit context. |
118 | 118 | * @return string |
119 | 119 | */ |
120 | - public function get_description( $context = 'view' ) { |
|
120 | + public function get_description($context = 'view') { |
|
121 | 121 | |
122 | - if ( isset( $this->custom_description ) ) { |
|
122 | + if (isset($this->custom_description)) { |
|
123 | 123 | return $this->custom_description; |
124 | 124 | } |
125 | 125 | |
126 | - return parent::get_description( $context ); |
|
126 | + return parent::get_description($context); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | /** |
@@ -133,8 +133,8 @@ discard block |
||
133 | 133 | * @param string $context View or edit context. |
134 | 134 | * @return float |
135 | 135 | */ |
136 | - public function get_sub_total( $context = 'view' ) { |
|
137 | - return $this->get_quantity( $context ) * $this->get_initial_price( $context ); |
|
136 | + public function get_sub_total($context = 'view') { |
|
137 | + return $this->get_quantity($context) * $this->get_initial_price($context); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | /** |
@@ -144,10 +144,10 @@ discard block |
||
144 | 144 | * @param string $context View or edit context. |
145 | 145 | * @return float |
146 | 146 | */ |
147 | - public function get_recurring_sub_total( $context = 'view' ) { |
|
147 | + public function get_recurring_sub_total($context = 'view') { |
|
148 | 148 | |
149 | - if ( $this->is_recurring() ) { |
|
150 | - return $this->get_quantity( $context ) * $this->get_price( $context ); |
|
149 | + if ($this->is_recurring()) { |
|
150 | + return $this->get_quantity($context) * $this->get_price($context); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | return 0; |
@@ -156,8 +156,8 @@ discard block |
||
156 | 156 | /** |
157 | 157 | * @deprecated |
158 | 158 | */ |
159 | - public function get_qantity( $context = 'view' ) { |
|
160 | - return $this->get_quantity( $context ); |
|
159 | + public function get_qantity($context = 'view') { |
|
160 | + return $this->get_quantity($context); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | /** |
@@ -167,11 +167,11 @@ discard block |
||
167 | 167 | * @param string $context View or edit context. |
168 | 168 | * @return float |
169 | 169 | */ |
170 | - public function get_quantity( $context = 'view' ) { |
|
170 | + public function get_quantity($context = 'view') { |
|
171 | 171 | $quantity = (float) $this->quantity; |
172 | 172 | |
173 | - if ( 'view' === $context ) { |
|
174 | - return apply_filters( 'getpaid_payment_form_item_quantity', $quantity, $this ); |
|
173 | + if ('view' === $context) { |
|
174 | + return apply_filters('getpaid_payment_form_item_quantity', $quantity, $this); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | return $quantity; |
@@ -185,11 +185,11 @@ discard block |
||
185 | 185 | * @param string $context View or edit context. |
186 | 186 | * @return meta |
187 | 187 | */ |
188 | - public function get_item_meta( $context = 'view' ) { |
|
188 | + public function get_item_meta($context = 'view') { |
|
189 | 189 | $meta = $this->meta; |
190 | 190 | |
191 | - if ( 'view' === $context ) { |
|
192 | - return apply_filters( 'getpaid_payment_form_item_meta', $meta, $this ); |
|
191 | + if ('view' === $context) { |
|
192 | + return apply_filters('getpaid_payment_form_item_meta', $meta, $this); |
|
193 | 193 | } |
194 | 194 | |
195 | 195 | return $meta; |
@@ -203,11 +203,11 @@ discard block |
||
203 | 203 | * @param string $context View or edit context. |
204 | 204 | * @return bool |
205 | 205 | */ |
206 | - public function get_allow_quantities( $context = 'view' ) { |
|
206 | + public function get_allow_quantities($context = 'view') { |
|
207 | 207 | $allow_quantities = (bool) $this->allow_quantities; |
208 | 208 | |
209 | - if ( 'view' === $context ) { |
|
210 | - return apply_filters( 'getpaid_payment_form_item_allow_quantities', $allow_quantities, $this ); |
|
209 | + if ('view' === $context) { |
|
210 | + return apply_filters('getpaid_payment_form_item_allow_quantities', $allow_quantities, $this); |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | return $allow_quantities; |
@@ -221,11 +221,11 @@ discard block |
||
221 | 221 | * @param string $context View or edit context. |
222 | 222 | * @return bool |
223 | 223 | */ |
224 | - public function get_is_required( $context = 'view' ) { |
|
224 | + public function get_is_required($context = 'view') { |
|
225 | 225 | $is_required = (bool) $this->is_required; |
226 | 226 | |
227 | - if ( 'view' === $context ) { |
|
228 | - return apply_filters( 'getpaid_payment_form_item_is_required', $is_required, $this ); |
|
227 | + if ('view' === $context) { |
|
228 | + return apply_filters('getpaid_payment_form_item_is_required', $is_required, $this); |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | return $is_required; |
@@ -238,11 +238,11 @@ discard block |
||
238 | 238 | * @since 1.0.19 |
239 | 239 | * @return array |
240 | 240 | */ |
241 | - public function prepare_data_for_use( $required = null ) { |
|
241 | + public function prepare_data_for_use($required = null) { |
|
242 | 242 | |
243 | - $required = is_null( $required ) ? $this->is_required() : $required; |
|
243 | + $required = is_null($required) ? $this->is_required() : $required; |
|
244 | 244 | return array( |
245 | - 'title' => wp_strip_all_tags( $this->get_name() ), |
|
245 | + 'title' => wp_strip_all_tags($this->get_name()), |
|
246 | 246 | 'id' => $this->get_id(), |
247 | 247 | 'price' => $this->get_price(), |
248 | 248 | 'recurring' => $this->is_recurring(), |
@@ -259,30 +259,30 @@ discard block |
||
259 | 259 | * @since 1.0.19 |
260 | 260 | * @return array |
261 | 261 | */ |
262 | - public function prepare_data_for_invoice_edit_ajax( $currency = '', $is_renewal = false ) { |
|
262 | + public function prepare_data_for_invoice_edit_ajax($currency = '', $is_renewal = false) { |
|
263 | 263 | |
264 | - $description = getpaid_item_recurring_price_help_text( $this, $currency ); |
|
264 | + $description = getpaid_item_recurring_price_help_text($this, $currency); |
|
265 | 265 | |
266 | - if ( $description ) { |
|
266 | + if ($description) { |
|
267 | 267 | $description = "<div class='getpaid-subscription-help-text'>$description</div>"; |
268 | 268 | } |
269 | 269 | |
270 | - $price = ! $is_renewal ? $this->get_price() : $this->get_recurring_price(); |
|
271 | - $subtotal = ! $is_renewal ? $this->get_sub_total() : $this->get_recurring_sub_total(); |
|
270 | + $price = !$is_renewal ? $this->get_price() : $this->get_recurring_price(); |
|
271 | + $subtotal = !$is_renewal ? $this->get_sub_total() : $this->get_recurring_sub_total(); |
|
272 | 272 | return array( |
273 | 273 | 'id' => $this->get_id(), |
274 | 274 | 'texts' => array( |
275 | - 'item-name' => sanitize_text_field( $this->get_name() ), |
|
276 | - 'item-description' => wp_kses_post( $this->get_description() ) . $description, |
|
277 | - 'item-quantity' => floatval( $this->get_quantity() ), |
|
278 | - 'item-price' => wpinv_price( $price, $currency ), |
|
279 | - 'item-total' => wpinv_price( $subtotal, $currency ), |
|
275 | + 'item-name' => sanitize_text_field($this->get_name()), |
|
276 | + 'item-description' => wp_kses_post($this->get_description()) . $description, |
|
277 | + 'item-quantity' => floatval($this->get_quantity()), |
|
278 | + 'item-price' => wpinv_price($price, $currency), |
|
279 | + 'item-total' => wpinv_price($subtotal, $currency), |
|
280 | 280 | ), |
281 | 281 | 'inputs' => array( |
282 | 282 | 'item-id' => $this->get_id(), |
283 | - 'item-name' => sanitize_text_field( $this->get_name() ), |
|
284 | - 'item-description' => wp_kses_post( $this->get_description() ), |
|
285 | - 'item-quantity' => floatval( $this->get_quantity() ), |
|
283 | + 'item-name' => sanitize_text_field($this->get_name()), |
|
284 | + 'item-description' => wp_kses_post($this->get_description()), |
|
285 | + 'item-quantity' => floatval($this->get_quantity()), |
|
286 | 286 | 'item-price' => $price, |
287 | 287 | ), |
288 | 288 | ); |
@@ -300,15 +300,15 @@ discard block |
||
300 | 300 | return array( |
301 | 301 | 'post_id' => $this->invoice_id, |
302 | 302 | 'item_id' => $this->get_id(), |
303 | - 'item_name' => sanitize_text_field( $this->get_raw_name( 'edit' ) ), |
|
304 | - 'item_description' => $this->get_description( 'edit' ), |
|
303 | + 'item_name' => sanitize_text_field($this->get_raw_name('edit')), |
|
304 | + 'item_description' => $this->get_description('edit'), |
|
305 | 305 | 'tax' => $this->item_tax, |
306 | - 'item_price' => $this->get_price( 'edit' ), |
|
307 | - 'quantity' => (float) $this->get_quantity( 'edit' ), |
|
306 | + 'item_price' => $this->get_price('edit'), |
|
307 | + 'quantity' => (float) $this->get_quantity('edit'), |
|
308 | 308 | 'discount' => $this->item_discount, |
309 | - 'subtotal' => $this->get_sub_total( 'edit' ), |
|
310 | - 'price' => $this->get_sub_total( 'edit' ) + $this->item_tax - $this->item_discount, |
|
311 | - 'meta' => $this->get_item_meta( 'edit' ), |
|
309 | + 'subtotal' => $this->get_sub_total('edit'), |
|
310 | + 'price' => $this->get_sub_total('edit') + $this->item_tax - $this->item_discount, |
|
311 | + 'meta' => $this->get_item_meta('edit'), |
|
312 | 312 | ); |
313 | 313 | |
314 | 314 | } |
@@ -329,9 +329,9 @@ discard block |
||
329 | 329 | * @since 1.0.19 |
330 | 330 | * @param float $quantity The item quantity. |
331 | 331 | */ |
332 | - public function set_quantity( $quantity ) { |
|
332 | + public function set_quantity($quantity) { |
|
333 | 333 | |
334 | - if ( ! is_numeric( $quantity ) ) { |
|
334 | + if (!is_numeric($quantity)) { |
|
335 | 335 | $quantity = 1; |
336 | 336 | } |
337 | 337 | |
@@ -345,8 +345,8 @@ discard block |
||
345 | 345 | * @since 1.0.19 |
346 | 346 | * @param array $meta The item meta data. |
347 | 347 | */ |
348 | - public function set_item_meta( $meta ) { |
|
349 | - $this->meta = maybe_unserialize( $meta ); |
|
348 | + public function set_item_meta($meta) { |
|
349 | + $this->meta = maybe_unserialize($meta); |
|
350 | 350 | } |
351 | 351 | |
352 | 352 | /** |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | * @since 1.0.19 |
356 | 356 | * @param bool $allow_quantities |
357 | 357 | */ |
358 | - public function set_allow_quantities( $allow_quantities ) { |
|
358 | + public function set_allow_quantities($allow_quantities) { |
|
359 | 359 | $this->allow_quantities = (bool) $allow_quantities; |
360 | 360 | } |
361 | 361 | |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | * @since 1.0.19 |
366 | 366 | * @param bool $is_required |
367 | 367 | */ |
368 | - public function set_is_required( $is_required ) { |
|
368 | + public function set_is_required($is_required) { |
|
369 | 369 | $this->is_required = (bool) $is_required; |
370 | 370 | } |
371 | 371 | |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | * @since 1.0.19 |
376 | 376 | * @param string $description |
377 | 377 | */ |
378 | - public function set_custom_description( $description ) { |
|
378 | + public function set_custom_description($description) { |
|
379 | 379 | $this->custom_description = $description; |
380 | 380 | } |
381 | 381 | |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | * |
385 | 385 | * @return int item id |
386 | 386 | */ |
387 | - public function save( $data = array() ) { |
|
387 | + public function save($data = array()) { |
|
388 | 388 | return $this->get_id(); |
389 | 389 | } |
390 | 390 |
@@ -8,40 +8,40 @@ discard block |
||
8 | 8 | * @version 1.0.19 |
9 | 9 | */ |
10 | 10 | |
11 | -defined( 'ABSPATH' ) || exit; |
|
11 | +defined('ABSPATH') || exit; |
|
12 | 12 | |
13 | 13 | $getpaid_pages = GetPaid_Installer::get_pages(); |
14 | -$pages = wpinv_get_pages( true ); |
|
14 | +$pages = wpinv_get_pages(true); |
|
15 | 15 | |
16 | 16 | $currencies = wpinv_get_currencies(); |
17 | 17 | |
18 | 18 | $currency_code_options = array(); |
19 | -foreach ( $currencies as $code => $name ) { |
|
20 | - $currency_code_options[ $code ] = $code . ' - ' . $name . ' (' . wpinv_currency_symbol( $code ) . ')'; |
|
19 | +foreach ($currencies as $code => $name) { |
|
20 | + $currency_code_options[$code] = $code . ' - ' . $name . ' (' . wpinv_currency_symbol($code) . ')'; |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | $invoice_number_padd_options = array(); |
24 | -for ( $i = 0; $i <= 20; $i++ ) { |
|
25 | - $invoice_number_padd_options[ $i ] = $i; |
|
24 | +for ($i = 0; $i <= 20; $i++) { |
|
25 | + $invoice_number_padd_options[$i] = $i; |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | $currency_symbol = wpinv_currency_symbol(); |
29 | 29 | |
30 | 30 | $last_number = $reset_number = ''; |
31 | -if ( $last_invoice_number = get_option( 'wpinv_last_invoice_number' ) ) { |
|
32 | - $last_invoice_number = preg_replace( '/[^0-9]/', '', $last_invoice_number ); |
|
31 | +if ($last_invoice_number = get_option('wpinv_last_invoice_number')) { |
|
32 | + $last_invoice_number = preg_replace('/[^0-9]/', '', $last_invoice_number); |
|
33 | 33 | |
34 | - if ( ! empty( $last_invoice_number ) ) { |
|
35 | - $last_number = ' ' . wp_sprintf( __( "( Last Invoice's sequential number: <b>%s</b> )", 'invoicing' ), $last_invoice_number ); |
|
34 | + if (!empty($last_invoice_number)) { |
|
35 | + $last_number = ' ' . wp_sprintf(__("( Last Invoice's sequential number: <b>%s</b> )", 'invoicing'), $last_invoice_number); |
|
36 | 36 | } |
37 | 37 | |
38 | - $nonce = wp_create_nonce( 'reset_invoice_count' ); |
|
38 | + $nonce = wp_create_nonce('reset_invoice_count'); |
|
39 | 39 | $reset_number = '<a href="' . add_query_arg( |
40 | 40 | array( |
41 | 41 | 'reset_invoice_count' => 1, |
42 | 42 | '_nonce' => $nonce, |
43 | 43 | ) |
44 | - ) . '" class="btn button">' . __( 'Force Reset Sequence', 'invoicing' ) . '</a>'; |
|
44 | + ) . '" class="btn button">' . __('Force Reset Sequence', 'invoicing') . '</a>'; |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | $alert_wrapper_start = '<p style="color: #F00">'; |
@@ -54,59 +54,59 @@ discard block |
||
54 | 54 | 'main' => array( |
55 | 55 | 'location_settings' => array( |
56 | 56 | 'id' => 'location_settings', |
57 | - 'name' => '<h3>' . __( 'Default Location', 'invoicing' ) . '</h3>', |
|
57 | + 'name' => '<h3>' . __('Default Location', 'invoicing') . '</h3>', |
|
58 | 58 | 'desc' => '', |
59 | 59 | 'type' => 'header', |
60 | 60 | ), |
61 | 61 | 'default_country' => array( |
62 | 62 | 'id' => 'default_country', |
63 | - 'name' => __( 'Default Country', 'invoicing' ), |
|
64 | - 'desc' => __( 'Where does your store operate from?', 'invoicing' ), |
|
63 | + 'name' => __('Default Country', 'invoicing'), |
|
64 | + 'desc' => __('Where does your store operate from?', 'invoicing'), |
|
65 | 65 | 'type' => 'select', |
66 | 66 | 'options' => wpinv_get_country_list(), |
67 | 67 | 'std' => 'GB', |
68 | 68 | 'class' => 'wpi_select2', |
69 | - 'placeholder' => __( 'Select a country', 'invoicing' ), |
|
69 | + 'placeholder' => __('Select a country', 'invoicing'), |
|
70 | 70 | ), |
71 | 71 | 'default_state' => array( |
72 | 72 | 'id' => 'default_state', |
73 | - 'name' => __( 'Default State / Province', 'invoicing' ), |
|
74 | - 'desc' => __( 'What state / province does your store operate from?', 'invoicing' ), |
|
73 | + 'name' => __('Default State / Province', 'invoicing'), |
|
74 | + 'desc' => __('What state / province does your store operate from?', 'invoicing'), |
|
75 | 75 | 'type' => 'country_states', |
76 | 76 | 'class' => 'wpi_select2', |
77 | - 'placeholder' => __( 'Select a state', 'invoicing' ), |
|
77 | + 'placeholder' => __('Select a state', 'invoicing'), |
|
78 | 78 | ), |
79 | 79 | 'store_name' => array( |
80 | 80 | 'id' => 'store_name', |
81 | - 'name' => __( 'Store Name', 'invoicing' ), |
|
82 | - 'desc' => __( 'Store name to print on invoices.', 'invoicing' ), |
|
83 | - 'std' => get_option( 'blogname' ), |
|
81 | + 'name' => __('Store Name', 'invoicing'), |
|
82 | + 'desc' => __('Store name to print on invoices.', 'invoicing'), |
|
83 | + 'std' => get_option('blogname'), |
|
84 | 84 | 'type' => 'text', |
85 | 85 | ), |
86 | 86 | 'logo' => array( |
87 | 87 | 'id' => 'logo', |
88 | - 'name' => __( 'Logo URL', 'invoicing' ), |
|
89 | - 'desc' => __( 'Store logo to print on invoices.', 'invoicing' ), |
|
88 | + 'name' => __('Logo URL', 'invoicing'), |
|
89 | + 'desc' => __('Store logo to print on invoices.', 'invoicing'), |
|
90 | 90 | 'type' => 'text', |
91 | 91 | ), |
92 | 92 | 'logo_width' => array( |
93 | 93 | 'id' => 'logo_width', |
94 | - 'name' => __( 'Logo width', 'invoicing' ), |
|
95 | - 'desc' => __( 'Logo width to use in invoice image.', 'invoicing' ), |
|
94 | + 'name' => __('Logo width', 'invoicing'), |
|
95 | + 'desc' => __('Logo width to use in invoice image.', 'invoicing'), |
|
96 | 96 | 'type' => 'number', |
97 | - 'placeholder' => __( 'Auto', 'invoicing' ), |
|
97 | + 'placeholder' => __('Auto', 'invoicing'), |
|
98 | 98 | ), |
99 | 99 | 'logo_height' => array( |
100 | 100 | 'id' => 'logo_height', |
101 | - 'name' => __( 'Logo height', 'invoicing' ), |
|
102 | - 'desc' => __( 'Logo height to use in invoice image.', 'invoicing' ), |
|
101 | + 'name' => __('Logo height', 'invoicing'), |
|
102 | + 'desc' => __('Logo height to use in invoice image.', 'invoicing'), |
|
103 | 103 | 'type' => 'number', |
104 | - 'placeholder' => __( 'Auto', 'invoicing' ), |
|
104 | + 'placeholder' => __('Auto', 'invoicing'), |
|
105 | 105 | ), |
106 | 106 | 'store_address' => array( |
107 | 107 | 'id' => 'store_address', |
108 | - 'name' => __( 'Store Address', 'invoicing' ), |
|
109 | - 'desc' => __( 'Enter the store address to display on invoice', 'invoicing' ), |
|
108 | + 'name' => __('Store Address', 'invoicing'), |
|
109 | + 'desc' => __('Enter the store address to display on invoice', 'invoicing'), |
|
110 | 110 | 'type' => 'textarea', |
111 | 111 | ), |
112 | 112 | |
@@ -114,114 +114,114 @@ discard block |
||
114 | 114 | 'page_section' => array( |
115 | 115 | 'page_settings' => array( |
116 | 116 | 'id' => 'page_settings', |
117 | - 'name' => '<h3>' . __( 'Page Settings', 'invoicing' ) . '</h3>', |
|
117 | + 'name' => '<h3>' . __('Page Settings', 'invoicing') . '</h3>', |
|
118 | 118 | 'desc' => '', |
119 | 119 | 'type' => 'header', |
120 | 120 | ), |
121 | 121 | 'checkout_page' => array( |
122 | 122 | 'id' => 'checkout_page', |
123 | - 'name' => __( 'Checkout Page', 'invoicing' ), |
|
124 | - 'desc' => __( 'This is the checkout page where buyers will complete their payments. The <b>[wpinv_checkout]</b> short code must be on this page.', 'invoicing' ), |
|
123 | + 'name' => __('Checkout Page', 'invoicing'), |
|
124 | + 'desc' => __('This is the checkout page where buyers will complete their payments. The <b>[wpinv_checkout]</b> short code must be on this page.', 'invoicing'), |
|
125 | 125 | 'type' => 'select', |
126 | 126 | 'options' => $pages, |
127 | 127 | 'class' => 'wpi_select2', |
128 | - 'placeholder' => __( 'Select a page', 'invoicing' ), |
|
129 | - 'default_content' => empty( $getpaid_pages['checkout_page'] ) ? '' : $getpaid_pages['checkout_page']['content'], |
|
128 | + 'placeholder' => __('Select a page', 'invoicing'), |
|
129 | + 'default_content' => empty($getpaid_pages['checkout_page']) ? '' : $getpaid_pages['checkout_page']['content'], |
|
130 | 130 | 'help-tip' => true, |
131 | 131 | ), |
132 | 132 | 'success_page' => array( |
133 | 133 | 'id' => 'success_page', |
134 | - 'name' => __( 'Success Page', 'invoicing' ), |
|
135 | - 'desc' => __( 'This is the page buyers are sent to after completing their payments. The <b>[wpinv_receipt]</b> short code should be on this page.', 'invoicing' ), |
|
134 | + 'name' => __('Success Page', 'invoicing'), |
|
135 | + 'desc' => __('This is the page buyers are sent to after completing their payments. The <b>[wpinv_receipt]</b> short code should be on this page.', 'invoicing'), |
|
136 | 136 | 'type' => 'select', |
137 | 137 | 'options' => $pages, |
138 | 138 | 'class' => 'wpi_select2', |
139 | - 'placeholder' => __( 'Select a page', 'invoicing' ), |
|
140 | - 'default_content' => empty( $getpaid_pages['success_page'] ) ? '' : $getpaid_pages['success_page']['content'], |
|
139 | + 'placeholder' => __('Select a page', 'invoicing'), |
|
140 | + 'default_content' => empty($getpaid_pages['success_page']) ? '' : $getpaid_pages['success_page']['content'], |
|
141 | 141 | 'help-tip' => true, |
142 | 142 | ), |
143 | 143 | 'failure_page' => array( |
144 | 144 | 'id' => 'failure_page', |
145 | - 'name' => __( 'Failed Transaction Page', 'invoicing' ), |
|
146 | - 'desc' => __( 'This is the page buyers are sent to if their transaction is cancelled or fails.', 'invoicing' ), |
|
145 | + 'name' => __('Failed Transaction Page', 'invoicing'), |
|
146 | + 'desc' => __('This is the page buyers are sent to if their transaction is cancelled or fails.', 'invoicing'), |
|
147 | 147 | 'type' => 'select', |
148 | 148 | 'options' => $pages, |
149 | 149 | 'class' => 'wpi_select2', |
150 | - 'placeholder' => __( 'Select a page', 'invoicing' ), |
|
151 | - 'default_content' => empty( $getpaid_pages['failure_page'] ) ? '' : $getpaid_pages['failure_page']['content'], |
|
150 | + 'placeholder' => __('Select a page', 'invoicing'), |
|
151 | + 'default_content' => empty($getpaid_pages['failure_page']) ? '' : $getpaid_pages['failure_page']['content'], |
|
152 | 152 | 'help-tip' => true, |
153 | 153 | ), |
154 | 154 | 'invoice_history_page' => array( |
155 | 155 | 'id' => 'invoice_history_page', |
156 | - 'name' => __( 'Invoice History Page', 'invoicing' ), |
|
157 | - 'desc' => __( 'This page shows an invoice history for the current user. The <b>[wpinv_history]</b> short code should be on this page.', 'invoicing' ), |
|
156 | + 'name' => __('Invoice History Page', 'invoicing'), |
|
157 | + 'desc' => __('This page shows an invoice history for the current user. The <b>[wpinv_history]</b> short code should be on this page.', 'invoicing'), |
|
158 | 158 | 'type' => 'select', |
159 | 159 | 'options' => $pages, |
160 | 160 | 'class' => 'wpi_select2', |
161 | - 'placeholder' => __( 'Select a page', 'invoicing' ), |
|
162 | - 'default_content' => empty( $getpaid_pages['invoice_history_page'] ) ? '' : $getpaid_pages['invoice_history_page']['content'], |
|
161 | + 'placeholder' => __('Select a page', 'invoicing'), |
|
162 | + 'default_content' => empty($getpaid_pages['invoice_history_page']) ? '' : $getpaid_pages['invoice_history_page']['content'], |
|
163 | 163 | 'help-tip' => true, |
164 | 164 | ), |
165 | 165 | 'invoice_subscription_page' => array( |
166 | 166 | 'id' => 'invoice_subscription_page', |
167 | - 'name' => __( 'Invoice Subscriptions Page', 'invoicing' ), |
|
168 | - 'desc' => __( 'This page shows subscriptions history for the current user. The <b>[wpinv_subscriptions]</b> short code should be on this page.', 'invoicing' ), |
|
167 | + 'name' => __('Invoice Subscriptions Page', 'invoicing'), |
|
168 | + 'desc' => __('This page shows subscriptions history for the current user. The <b>[wpinv_subscriptions]</b> short code should be on this page.', 'invoicing'), |
|
169 | 169 | 'type' => 'select', |
170 | 170 | 'options' => $pages, |
171 | 171 | 'class' => 'wpi_select2', |
172 | - 'placeholder' => __( 'Select a page', 'invoicing' ), |
|
173 | - 'default_content' => empty( $getpaid_pages['invoice_subscription_page'] ) ? '' : $getpaid_pages['invoice_subscription_page']['content'], |
|
172 | + 'placeholder' => __('Select a page', 'invoicing'), |
|
173 | + 'default_content' => empty($getpaid_pages['invoice_subscription_page']) ? '' : $getpaid_pages['invoice_subscription_page']['content'], |
|
174 | 174 | 'help-tip' => true, |
175 | 175 | ), |
176 | 176 | ), |
177 | 177 | 'currency_section' => array( |
178 | 178 | 'currency_settings' => array( |
179 | 179 | 'id' => 'currency_settings', |
180 | - 'name' => '<h3>' . __( 'Currency Settings', 'invoicing' ) . '</h3>', |
|
180 | + 'name' => '<h3>' . __('Currency Settings', 'invoicing') . '</h3>', |
|
181 | 181 | 'desc' => '', |
182 | 182 | 'type' => 'header', |
183 | 183 | ), |
184 | 184 | 'currency' => array( |
185 | 185 | 'id' => 'currency', |
186 | - 'name' => __( 'Currency', 'invoicing' ), |
|
187 | - 'desc' => __( 'Choose your currency. Note that some payment gateways have currency restrictions.', 'invoicing' ), |
|
186 | + 'name' => __('Currency', 'invoicing'), |
|
187 | + 'desc' => __('Choose your currency. Note that some payment gateways have currency restrictions.', 'invoicing'), |
|
188 | 188 | 'type' => 'select', |
189 | 189 | 'class' => 'wpi_select2', |
190 | 190 | 'options' => $currency_code_options, |
191 | 191 | ), |
192 | 192 | 'currency_position' => array( |
193 | 193 | 'id' => 'currency_position', |
194 | - 'name' => __( 'Currency Position', 'invoicing' ), |
|
195 | - 'desc' => __( 'Choose the location of the currency sign.', 'invoicing' ), |
|
194 | + 'name' => __('Currency Position', 'invoicing'), |
|
195 | + 'desc' => __('Choose the location of the currency sign.', 'invoicing'), |
|
196 | 196 | 'type' => 'select', |
197 | 197 | 'class' => 'wpi_select2', |
198 | 198 | 'options' => array( |
199 | - 'left' => __( 'Left', 'invoicing' ) . ' (' . $currency_symbol . wpinv_format_amount( '99.99' ) . ')', |
|
200 | - 'right' => __( 'Right', 'invoicing' ) . ' (' . wpinv_format_amount( '99.99' ) . $currency_symbol . ')', |
|
201 | - 'left_space' => __( 'Left with space', 'invoicing' ) . ' (' . $currency_symbol . ' ' . wpinv_format_amount( '99.99' ) . ')', |
|
202 | - 'right_space' => __( 'Right with space', 'invoicing' ) . ' (' . wpinv_format_amount( '99.99' ) . ' ' . $currency_symbol . ')', |
|
199 | + 'left' => __('Left', 'invoicing') . ' (' . $currency_symbol . wpinv_format_amount('99.99') . ')', |
|
200 | + 'right' => __('Right', 'invoicing') . ' (' . wpinv_format_amount('99.99') . $currency_symbol . ')', |
|
201 | + 'left_space' => __('Left with space', 'invoicing') . ' (' . $currency_symbol . ' ' . wpinv_format_amount('99.99') . ')', |
|
202 | + 'right_space' => __('Right with space', 'invoicing') . ' (' . wpinv_format_amount('99.99') . ' ' . $currency_symbol . ')', |
|
203 | 203 | ), |
204 | 204 | ), |
205 | 205 | 'thousands_separator' => array( |
206 | 206 | 'id' => 'thousands_separator', |
207 | - 'name' => __( 'Thousands Separator', 'invoicing' ), |
|
208 | - 'desc' => __( 'The symbol (usually , or .) to separate thousands', 'invoicing' ), |
|
207 | + 'name' => __('Thousands Separator', 'invoicing'), |
|
208 | + 'desc' => __('The symbol (usually , or .) to separate thousands', 'invoicing'), |
|
209 | 209 | 'type' => 'text', |
210 | 210 | 'size' => 'small', |
211 | 211 | 'std' => ',', |
212 | 212 | ), |
213 | 213 | 'decimal_separator' => array( |
214 | 214 | 'id' => 'decimal_separator', |
215 | - 'name' => __( 'Decimal Separator', 'invoicing' ), |
|
216 | - 'desc' => __( 'The symbol (usually , or .) to separate decimal points', 'invoicing' ), |
|
215 | + 'name' => __('Decimal Separator', 'invoicing'), |
|
216 | + 'desc' => __('The symbol (usually , or .) to separate decimal points', 'invoicing'), |
|
217 | 217 | 'type' => 'text', |
218 | 218 | 'size' => 'small', |
219 | 219 | 'std' => '.', |
220 | 220 | ), |
221 | 221 | 'decimals' => array( |
222 | 222 | 'id' => 'decimals', |
223 | - 'name' => __( 'Number of Decimals', 'invoicing' ), |
|
224 | - 'desc' => __( 'This sets the number of decimal points shown in displayed prices.', 'invoicing' ), |
|
223 | + 'name' => __('Number of Decimals', 'invoicing'), |
|
224 | + 'desc' => __('This sets the number of decimal points shown in displayed prices.', 'invoicing'), |
|
225 | 225 | 'type' => 'number', |
226 | 226 | 'size' => 'small', |
227 | 227 | 'std' => '2', |
@@ -233,21 +233,21 @@ discard block |
||
233 | 233 | 'labels' => array( |
234 | 234 | 'labels' => array( |
235 | 235 | 'id' => 'labels_settings', |
236 | - 'name' => '<h3>' . __( 'Invoice Labels', 'invoicing' ) . '</h3>', |
|
236 | + 'name' => '<h3>' . __('Invoice Labels', 'invoicing') . '</h3>', |
|
237 | 237 | 'desc' => '', |
238 | 238 | 'type' => 'header', |
239 | 239 | ), |
240 | 240 | 'vat_invoice_notice_label' => array( |
241 | 241 | 'id' => 'vat_invoice_notice_label', |
242 | - 'name' => __( 'Invoice Notice Label', 'invoicing' ), |
|
243 | - 'desc' => __( 'Use this to add an invoice notice section (label) to your invoices', 'invoicing' ), |
|
242 | + 'name' => __('Invoice Notice Label', 'invoicing'), |
|
243 | + 'desc' => __('Use this to add an invoice notice section (label) to your invoices', 'invoicing'), |
|
244 | 244 | 'type' => 'text', |
245 | 245 | 'size' => 'regular', |
246 | 246 | ), |
247 | 247 | 'vat_invoice_notice' => array( |
248 | 248 | 'id' => 'vat_invoice_notice', |
249 | - 'name' => __( 'Invoice notice', 'invoicing' ), |
|
250 | - 'desc' => __( 'Use this to add an invoice notice section (description) to your invoices', 'invoicing' ), |
|
249 | + 'name' => __('Invoice notice', 'invoicing'), |
|
250 | + 'desc' => __('Use this to add an invoice notice section (description) to your invoices', 'invoicing'), |
|
251 | 251 | 'type' => 'text', |
252 | 252 | 'size' => 'regular', |
253 | 253 | ), |
@@ -260,22 +260,22 @@ discard block |
||
260 | 260 | 'main' => array( |
261 | 261 | 'gateway_settings' => array( |
262 | 262 | 'id' => 'api_header', |
263 | - 'name' => '<h3>' . __( 'Gateway Settings', 'invoicing' ) . '</h3>', |
|
263 | + 'name' => '<h3>' . __('Gateway Settings', 'invoicing') . '</h3>', |
|
264 | 264 | 'desc' => '', |
265 | 265 | 'type' => 'header', |
266 | 266 | ), |
267 | 267 | 'gateways' => array( |
268 | 268 | 'id' => 'gateways', |
269 | - 'name' => __( 'Payment Gateways', 'invoicing' ), |
|
270 | - 'desc' => __( 'Choose the payment gateways you want to enable.', 'invoicing' ), |
|
269 | + 'name' => __('Payment Gateways', 'invoicing'), |
|
270 | + 'desc' => __('Choose the payment gateways you want to enable.', 'invoicing'), |
|
271 | 271 | 'type' => 'gateways', |
272 | - 'std' => array( 'manual' => 1 ), |
|
272 | + 'std' => array('manual' => 1), |
|
273 | 273 | 'options' => wpinv_get_payment_gateways(), |
274 | 274 | ), |
275 | 275 | 'default_gateway' => array( |
276 | 276 | 'id' => 'default_gateway', |
277 | - 'name' => __( 'Default Gateway', 'invoicing' ), |
|
278 | - 'desc' => __( 'This gateway will be loaded automatically with the checkout page.', 'invoicing' ), |
|
277 | + 'name' => __('Default Gateway', 'invoicing'), |
|
278 | + 'desc' => __('This gateway will be loaded automatically with the checkout page.', 'invoicing'), |
|
279 | 279 | 'type' => 'gateway_select', |
280 | 280 | 'std' => 'manual', |
281 | 281 | 'class' => 'wpi_select2', |
@@ -291,32 +291,32 @@ discard block |
||
291 | 291 | 'main' => array( |
292 | 292 | 'tax_settings' => array( |
293 | 293 | 'id' => 'tax_settings', |
294 | - 'name' => '<h3>' . __( 'Tax Settings', 'invoicing' ) . '</h3>', |
|
294 | + 'name' => '<h3>' . __('Tax Settings', 'invoicing') . '</h3>', |
|
295 | 295 | 'type' => 'header', |
296 | 296 | ), |
297 | 297 | |
298 | 298 | 'enable_taxes' => array( |
299 | 299 | 'id' => 'enable_taxes', |
300 | - 'name' => __( 'Enable Taxes', 'invoicing' ), |
|
301 | - 'desc' => __( 'Enable tax rates and calculations.', 'invoicing' ), |
|
300 | + 'name' => __('Enable Taxes', 'invoicing'), |
|
301 | + 'desc' => __('Enable tax rates and calculations.', 'invoicing'), |
|
302 | 302 | 'type' => 'checkbox', |
303 | 303 | 'std' => 0, |
304 | 304 | ), |
305 | 305 | |
306 | 306 | 'tax_subtotal_rounding' => array( |
307 | 307 | 'id' => 'tax_subtotal_rounding', |
308 | - 'name' => __( 'Rounding', 'invoicing' ), |
|
309 | - 'desc' => __( 'Round tax at subtotal level, instead of rounding per tax rate', 'invoicing' ), |
|
308 | + 'name' => __('Rounding', 'invoicing'), |
|
309 | + 'desc' => __('Round tax at subtotal level, instead of rounding per tax rate', 'invoicing'), |
|
310 | 310 | 'type' => 'checkbox', |
311 | 311 | 'std' => 1, |
312 | 312 | ), |
313 | 313 | |
314 | 314 | 'prices_include_tax' => array( |
315 | 315 | 'id' => 'prices_include_tax', |
316 | - 'name' => __( 'Prices entered with tax', 'invoicing' ), |
|
316 | + 'name' => __('Prices entered with tax', 'invoicing'), |
|
317 | 317 | 'options' => array( |
318 | - 'yes' => __( 'Yes, I will enter prices inclusive of tax', 'invoicing' ), |
|
319 | - 'no' => __( 'No, I will enter prices exclusive of tax', 'invoicing' ), |
|
318 | + 'yes' => __('Yes, I will enter prices inclusive of tax', 'invoicing'), |
|
319 | + 'no' => __('No, I will enter prices exclusive of tax', 'invoicing'), |
|
320 | 320 | ), |
321 | 321 | 'type' => 'select', |
322 | 322 | 'std' => 'no', |
@@ -324,10 +324,10 @@ discard block |
||
324 | 324 | |
325 | 325 | 'tax_base' => array( |
326 | 326 | 'id' => 'tax_base', |
327 | - 'name' => __( 'Calculate tax based on', 'invoicing' ), |
|
327 | + 'name' => __('Calculate tax based on', 'invoicing'), |
|
328 | 328 | 'options' => array( |
329 | - 'billing' => __( 'Customer billing address', 'invoicing' ), |
|
330 | - 'base' => __( 'Shop base address', 'invoicing' ), |
|
329 | + 'billing' => __('Customer billing address', 'invoicing'), |
|
330 | + 'base' => __('Shop base address', 'invoicing'), |
|
331 | 331 | ), |
332 | 332 | 'type' => 'select', |
333 | 333 | 'std' => 'billing', |
@@ -335,24 +335,24 @@ discard block |
||
335 | 335 | |
336 | 336 | 'vat_same_country_rule' => array( |
337 | 337 | 'id' => 'vat_same_country_rule', |
338 | - 'name' => __( 'Same country rule', 'invoicing' ), |
|
339 | - 'desc' => __( 'What should happen if a customer is from the same country as your business?', 'invoicing' ), |
|
338 | + 'name' => __('Same country rule', 'invoicing'), |
|
339 | + 'desc' => __('What should happen if a customer is from the same country as your business?', 'invoicing'), |
|
340 | 340 | 'type' => 'select', |
341 | 341 | 'options' => array( |
342 | - 'no' => __( 'Do not charge tax', 'invoicing' ), |
|
343 | - 'always' => __( 'Charge tax unless vat number is validated', 'invoicing' ), |
|
344 | - 'vat_too' => __( 'Charge tax even if vat number is validated', 'invoicing' ), |
|
342 | + 'no' => __('Do not charge tax', 'invoicing'), |
|
343 | + 'always' => __('Charge tax unless vat number is validated', 'invoicing'), |
|
344 | + 'vat_too' => __('Charge tax even if vat number is validated', 'invoicing'), |
|
345 | 345 | ), |
346 | - 'placeholder' => __( 'Select an option', 'invoicing' ), |
|
346 | + 'placeholder' => __('Select an option', 'invoicing'), |
|
347 | 347 | 'std' => 'vat_too', |
348 | 348 | ), |
349 | 349 | |
350 | 350 | 'tax_display_totals' => array( |
351 | 351 | 'id' => 'tax_display_totals', |
352 | - 'name' => __( 'Display tax totals', 'invoicing' ), |
|
352 | + 'name' => __('Display tax totals', 'invoicing'), |
|
353 | 353 | 'options' => array( |
354 | - 'single' => __( 'As a single total', 'invoicing' ), |
|
355 | - 'individual' => __( 'As individual tax rates', 'invoicing' ), |
|
354 | + 'single' => __('As a single total', 'invoicing'), |
|
355 | + 'individual' => __('As individual tax rates', 'invoicing'), |
|
356 | 356 | ), |
357 | 357 | 'type' => 'select', |
358 | 358 | 'std' => 'individual', |
@@ -360,8 +360,8 @@ discard block |
||
360 | 360 | |
361 | 361 | 'tax_rate' => array( |
362 | 362 | 'id' => 'tax_rate', |
363 | - 'name' => __( 'Fallback Tax Rate', 'invoicing' ), |
|
364 | - 'desc' => __( 'Enter a percentage, such as 6.5. Customers not in a specific rate will be charged this rate.', 'invoicing' ), |
|
363 | + 'name' => __('Fallback Tax Rate', 'invoicing'), |
|
364 | + 'desc' => __('Enter a percentage, such as 6.5. Customers not in a specific rate will be charged this rate.', 'invoicing'), |
|
365 | 365 | 'type' => 'number', |
366 | 366 | 'size' => 'small', |
367 | 367 | 'min' => '0', |
@@ -373,8 +373,8 @@ discard block |
||
373 | 373 | 'rules' => array( |
374 | 374 | 'tax_rules' => array( |
375 | 375 | 'id' => 'tax_rules', |
376 | - 'name' => '<h3>' . __( 'Tax Rules', 'invoicing' ) . '</h3>', |
|
377 | - 'desc' => __( 'Create/Update tax rules', 'invoicing' ), |
|
376 | + 'name' => '<h3>' . __('Tax Rules', 'invoicing') . '</h3>', |
|
377 | + 'desc' => __('Create/Update tax rules', 'invoicing'), |
|
378 | 378 | 'type' => 'tax_rules', |
379 | 379 | ), |
380 | 380 | ), |
@@ -382,8 +382,8 @@ discard block |
||
382 | 382 | 'rates' => array( |
383 | 383 | 'tax_rates' => array( |
384 | 384 | 'id' => 'tax_rates', |
385 | - 'name' => '<h3>' . __( 'Tax Rates', 'invoicing' ) . '</h3>', |
|
386 | - 'desc' => __( 'Enter tax rates for specific regions.', 'invoicing' ), |
|
385 | + 'name' => '<h3>' . __('Tax Rates', 'invoicing') . '</h3>', |
|
386 | + 'desc' => __('Enter tax rates for specific regions.', 'invoicing'), |
|
387 | 387 | 'type' => 'tax_rates', |
388 | 388 | ), |
389 | 389 | ), |
@@ -392,31 +392,31 @@ discard block |
||
392 | 392 | |
393 | 393 | 'vat_company_name' => array( |
394 | 394 | 'id' => 'vat_company_name', |
395 | - 'name' => __( 'Company Name', 'invoicing' ), |
|
396 | - 'desc' => wp_sprintf( __( 'Verify your company name and VAT number on the %1$sEU VIES System.%2$s', 'invoicing' ), '<a href="http://ec.europa.eu/taxation_customs/vies/" target="_blank">', '</a>' ), |
|
395 | + 'name' => __('Company Name', 'invoicing'), |
|
396 | + 'desc' => wp_sprintf(__('Verify your company name and VAT number on the %1$sEU VIES System.%2$s', 'invoicing'), '<a href="http://ec.europa.eu/taxation_customs/vies/" target="_blank">', '</a>'), |
|
397 | 397 | 'type' => 'text', |
398 | 398 | 'size' => 'regular', |
399 | 399 | ), |
400 | 400 | |
401 | 401 | 'vat_number' => array( |
402 | 402 | 'id' => 'vat_number', |
403 | - 'name' => __( 'VAT Number', 'invoicing' ), |
|
404 | - 'desc' => __( 'Enter your VAT number including the country identifier, eg: GB123456789', 'invoicing' ), |
|
403 | + 'name' => __('VAT Number', 'invoicing'), |
|
404 | + 'desc' => __('Enter your VAT number including the country identifier, eg: GB123456789', 'invoicing'), |
|
405 | 405 | 'type' => 'text', |
406 | 406 | 'size' => 'regular', |
407 | 407 | ), |
408 | 408 | |
409 | 409 | 'vat_prevent_b2c_purchase' => array( |
410 | 410 | 'id' => 'vat_prevent_b2c_purchase', |
411 | - 'name' => __( 'Prevent B2C Sales', 'invoicing' ), |
|
412 | - 'desc' => __( 'Require everyone in the EU to provide a VAT number.', 'invoicing' ), |
|
411 | + 'name' => __('Prevent B2C Sales', 'invoicing'), |
|
412 | + 'desc' => __('Require everyone in the EU to provide a VAT number.', 'invoicing'), |
|
413 | 413 | 'type' => 'checkbox', |
414 | 414 | ), |
415 | 415 | |
416 | 416 | 'validate_vat_number' => array( |
417 | 417 | 'id' => 'validate_vat_number', |
418 | - 'name' => __( 'Validate VAT Number', 'invoicing' ), |
|
419 | - 'desc' => __( 'Validate VAT numbers with VIES.', 'invoicing' ), |
|
418 | + 'name' => __('Validate VAT Number', 'invoicing'), |
|
419 | + 'desc' => __('Validate VAT numbers with VIES.', 'invoicing'), |
|
420 | 420 | 'type' => 'checkbox', |
421 | 421 | ), |
422 | 422 | |
@@ -431,66 +431,66 @@ discard block |
||
431 | 431 | 'main' => array( |
432 | 432 | 'email_settings_header' => array( |
433 | 433 | 'id' => 'email_settings_header', |
434 | - 'name' => '<h3>' . __( 'Email Sender Options', 'invoicing' ) . '</h3>', |
|
434 | + 'name' => '<h3>' . __('Email Sender Options', 'invoicing') . '</h3>', |
|
435 | 435 | 'type' => 'header', |
436 | 436 | ), |
437 | 437 | 'email_from_name' => array( |
438 | 438 | 'id' => 'email_from_name', |
439 | - 'name' => __( 'From Name', 'invoicing' ), |
|
440 | - 'desc' => __( 'Enter the sender\'s name appears in outgoing invoice emails. This should be your site name.', 'invoicing' ), |
|
441 | - 'std' => esc_attr( get_bloginfo( 'name', 'display' ) ), |
|
439 | + 'name' => __('From Name', 'invoicing'), |
|
440 | + 'desc' => __('Enter the sender\'s name appears in outgoing invoice emails. This should be your site name.', 'invoicing'), |
|
441 | + 'std' => esc_attr(get_bloginfo('name', 'display')), |
|
442 | 442 | 'type' => 'text', |
443 | 443 | ), |
444 | 444 | 'email_from' => array( |
445 | 445 | 'id' => 'email_from', |
446 | - 'name' => __( 'From Email', 'invoicing' ), |
|
447 | - 'desc' => sprintf( __( 'Email address to send invoice emails from. This will act as the "from" address. %1$s If emails are not being sent it may be that your hosting prevents emails being sent if the email domains do not match.%2$s', 'invoicing' ), $alert_wrapper_start, $alert_wrapper_close ), |
|
448 | - 'std' => get_option( 'admin_email' ), |
|
446 | + 'name' => __('From Email', 'invoicing'), |
|
447 | + 'desc' => sprintf(__('Email address to send invoice emails from. This will act as the "from" address. %1$s If emails are not being sent it may be that your hosting prevents emails being sent if the email domains do not match.%2$s', 'invoicing'), $alert_wrapper_start, $alert_wrapper_close), |
|
448 | + 'std' => get_option('admin_email'), |
|
449 | 449 | 'type' => 'text', |
450 | 450 | ), |
451 | 451 | 'admin_email' => array( |
452 | 452 | 'id' => 'admin_email', |
453 | - 'name' => __( 'Admin Email', 'invoicing' ), |
|
454 | - 'desc' => __( 'Where should we send admin notifications? This will is also act as the "reply-to" address for invoice emails', 'invoicing' ), |
|
455 | - 'std' => get_option( 'admin_email' ), |
|
453 | + 'name' => __('Admin Email', 'invoicing'), |
|
454 | + 'desc' => __('Where should we send admin notifications? This will is also act as the "reply-to" address for invoice emails', 'invoicing'), |
|
455 | + 'std' => get_option('admin_email'), |
|
456 | 456 | 'type' => 'text', |
457 | 457 | ), |
458 | 458 | 'skip_email_free_invoice' => array( |
459 | 459 | 'id' => 'skip_email_free_invoice', |
460 | - 'name' => __( 'Skip Free Invoices', 'invoicing' ), |
|
461 | - 'desc' => __( 'Check this to disable sending emails for free invoices.', 'invoicing' ), |
|
460 | + 'name' => __('Skip Free Invoices', 'invoicing'), |
|
461 | + 'desc' => __('Check this to disable sending emails for free invoices.', 'invoicing'), |
|
462 | 462 | 'type' => 'checkbox', |
463 | 463 | 'std' => false, |
464 | 464 | ), |
465 | 465 | 'overdue_settings_header' => array( |
466 | 466 | 'id' => 'overdue_settings_header', |
467 | - 'name' => '<h3>' . __( 'Due Date Settings', 'invoicing' ) . '</h3>', |
|
467 | + 'name' => '<h3>' . __('Due Date Settings', 'invoicing') . '</h3>', |
|
468 | 468 | 'type' => 'header', |
469 | 469 | ), |
470 | 470 | 'overdue_active' => array( |
471 | 471 | 'id' => 'overdue_active', |
472 | - 'name' => __( 'Enable Due Date', 'invoicing' ), |
|
473 | - 'desc' => __( 'Check this to enable due date option for invoices.', 'invoicing' ), |
|
472 | + 'name' => __('Enable Due Date', 'invoicing'), |
|
473 | + 'desc' => __('Check this to enable due date option for invoices.', 'invoicing'), |
|
474 | 474 | 'type' => 'checkbox', |
475 | 475 | 'std' => false, |
476 | 476 | ), |
477 | 477 | 'email_template_header' => array( |
478 | 478 | 'id' => 'email_template_header', |
479 | - 'name' => '<h3>' . __( 'Email Template', 'invoicing' ) . '</h3>', |
|
479 | + 'name' => '<h3>' . __('Email Template', 'invoicing') . '</h3>', |
|
480 | 480 | 'type' => 'header', |
481 | 481 | ), |
482 | 482 | 'email_header_image' => array( |
483 | 483 | 'id' => 'email_header_image', |
484 | - 'name' => __( 'Header Image', 'invoicing' ), |
|
485 | - 'desc' => __( 'URL to an image you want to show in the email header. Upload images using the media uploader (Admin > Media).', 'invoicing' ), |
|
484 | + 'name' => __('Header Image', 'invoicing'), |
|
485 | + 'desc' => __('URL to an image you want to show in the email header. Upload images using the media uploader (Admin > Media).', 'invoicing'), |
|
486 | 486 | 'std' => '', |
487 | 487 | 'type' => 'text', |
488 | 488 | ), |
489 | 489 | 'email_footer_text' => array( |
490 | 490 | 'id' => 'email_footer_text', |
491 | - 'name' => __( 'Footer Text', 'invoicing' ), |
|
492 | - 'desc' => __( 'The text to appear in the footer of all invoice emails.', 'invoicing' ), |
|
493 | - 'std' => get_bloginfo( 'name', 'display' ) . ' - ' . __( 'Powered by GetPaid', 'invoicing' ), |
|
491 | + 'name' => __('Footer Text', 'invoicing'), |
|
492 | + 'desc' => __('The text to appear in the footer of all invoice emails.', 'invoicing'), |
|
493 | + 'std' => get_bloginfo('name', 'display') . ' - ' . __('Powered by GetPaid', 'invoicing'), |
|
494 | 494 | 'type' => 'textarea', |
495 | 495 | 'class' => 'regular-text', |
496 | 496 | 'rows' => 2, |
@@ -498,29 +498,29 @@ discard block |
||
498 | 498 | ), |
499 | 499 | 'email_base_color' => array( |
500 | 500 | 'id' => 'email_base_color', |
501 | - 'name' => __( 'Base Color', 'invoicing' ), |
|
502 | - 'desc' => __( 'The base color for invoice email template. Default <code>#557da2</code>.', 'invoicing' ), |
|
501 | + 'name' => __('Base Color', 'invoicing'), |
|
502 | + 'desc' => __('The base color for invoice email template. Default <code>#557da2</code>.', 'invoicing'), |
|
503 | 503 | 'std' => '#557da2', |
504 | 504 | 'type' => 'color', |
505 | 505 | ), |
506 | 506 | 'email_background_color' => array( |
507 | 507 | 'id' => 'email_background_color', |
508 | - 'name' => __( 'Background Color', 'invoicing' ), |
|
509 | - 'desc' => __( 'The background color of email template. Default <code>#f5f5f5</code>.', 'invoicing' ), |
|
508 | + 'name' => __('Background Color', 'invoicing'), |
|
509 | + 'desc' => __('The background color of email template. Default <code>#f5f5f5</code>.', 'invoicing'), |
|
510 | 510 | 'std' => '#f5f5f5', |
511 | 511 | 'type' => 'color', |
512 | 512 | ), |
513 | 513 | 'email_body_background_color' => array( |
514 | 514 | 'id' => 'email_body_background_color', |
515 | - 'name' => __( 'Body Background Color', 'invoicing' ), |
|
516 | - 'desc' => __( 'The main body background color of email template. Default <code>#fdfdfd</code>.', 'invoicing' ), |
|
515 | + 'name' => __('Body Background Color', 'invoicing'), |
|
516 | + 'desc' => __('The main body background color of email template. Default <code>#fdfdfd</code>.', 'invoicing'), |
|
517 | 517 | 'std' => '#fdfdfd', |
518 | 518 | 'type' => 'color', |
519 | 519 | ), |
520 | 520 | 'email_text_color' => array( |
521 | 521 | 'id' => 'email_text_color', |
522 | - 'name' => __( 'Body Text Color', 'invoicing' ), |
|
523 | - 'desc' => __( 'The main body text color. Default <code>#505050</code>.', 'invoicing' ), |
|
522 | + 'name' => __('Body Text Color', 'invoicing'), |
|
523 | + 'desc' => __('The main body text color. Default <code>#505050</code>.', 'invoicing'), |
|
524 | 524 | 'std' => '#505050', |
525 | 525 | 'type' => 'color', |
526 | 526 | ), |
@@ -535,7 +535,7 @@ discard block |
||
535 | 535 | ), |
536 | 536 | |
537 | 537 | // Integrations. |
538 | - 'integrations' => wp_list_pluck( getpaid_get_integration_settings(), 'settings', 'id' ), |
|
538 | + 'integrations' => wp_list_pluck(getpaid_get_integration_settings(), 'settings', 'id'), |
|
539 | 539 | |
540 | 540 | /** Privacy Settings */ |
541 | 541 | 'privacy' => apply_filters( |
@@ -544,17 +544,17 @@ discard block |
||
544 | 544 | 'main' => array( |
545 | 545 | 'invoicing_privacy_policy_settings' => array( |
546 | 546 | 'id' => 'invoicing_privacy_policy_settings', |
547 | - 'name' => '<h3>' . __( 'Privacy Policy', 'invoicing' ) . '</h3>', |
|
547 | + 'name' => '<h3>' . __('Privacy Policy', 'invoicing') . '</h3>', |
|
548 | 548 | 'type' => 'header', |
549 | 549 | ), |
550 | 550 | 'privacy_page' => array( |
551 | 551 | 'id' => 'privacy_page', |
552 | - 'name' => __( 'Privacy Page', 'invoicing' ), |
|
553 | - 'desc' => __( 'If no privacy policy page set in Settings->Privacy default settings, this page will be used on checkout page.', 'invoicing' ), |
|
552 | + 'name' => __('Privacy Page', 'invoicing'), |
|
553 | + 'desc' => __('If no privacy policy page set in Settings->Privacy default settings, this page will be used on checkout page.', 'invoicing'), |
|
554 | 554 | 'type' => 'select', |
555 | - 'options' => wpinv_get_pages( true, __( 'Select a page', 'invoicing' ) ), |
|
555 | + 'options' => wpinv_get_pages(true, __('Select a page', 'invoicing')), |
|
556 | 556 | 'class' => 'wpi_select2', |
557 | - 'placeholder' => __( 'Select a page', 'invoicing' ), |
|
557 | + 'placeholder' => __('Select a page', 'invoicing'), |
|
558 | 558 | ), |
559 | 559 | ), |
560 | 560 | ) |
@@ -566,19 +566,19 @@ discard block |
||
566 | 566 | 'main' => array( |
567 | 567 | 'invoice_number_format_settings' => array( |
568 | 568 | 'id' => 'invoice_number_format_settings', |
569 | - 'name' => '<h3>' . __( 'Invoice Number', 'invoicing' ) . '</h3>', |
|
569 | + 'name' => '<h3>' . __('Invoice Number', 'invoicing') . '</h3>', |
|
570 | 570 | 'type' => 'header', |
571 | 571 | ), |
572 | 572 | 'sequential_invoice_number' => array( |
573 | 573 | 'id' => 'sequential_invoice_number', |
574 | - 'name' => __( 'Sequential Invoice Numbers', 'invoicing' ), |
|
575 | - 'desc' => __( 'Check this box to enable sequential invoice numbers.', 'invoicing' ) . $reset_number, |
|
574 | + 'name' => __('Sequential Invoice Numbers', 'invoicing'), |
|
575 | + 'desc' => __('Check this box to enable sequential invoice numbers.', 'invoicing') . $reset_number, |
|
576 | 576 | 'type' => 'checkbox', |
577 | 577 | ), |
578 | 578 | 'invoice_sequence_start' => array( |
579 | 579 | 'id' => 'invoice_sequence_start', |
580 | - 'name' => __( 'Sequential Starting Number', 'invoicing' ), |
|
581 | - 'desc' => __( 'The number at which the invoice number sequence should begin.', 'invoicing' ) . $last_number, |
|
580 | + 'name' => __('Sequential Starting Number', 'invoicing'), |
|
581 | + 'desc' => __('The number at which the invoice number sequence should begin.', 'invoicing') . $last_number, |
|
582 | 582 | 'type' => 'number', |
583 | 583 | 'size' => 'small', |
584 | 584 | 'std' => '1', |
@@ -586,8 +586,8 @@ discard block |
||
586 | 586 | ), |
587 | 587 | 'invoice_number_padd' => array( |
588 | 588 | 'id' => 'invoice_number_padd', |
589 | - 'name' => __( 'Minimum Digits', 'invoicing' ), |
|
590 | - 'desc' => __( 'If the invoice number has less digits than this number, it is left padded with 0s. Ex: invoice number 108 will padded to 00108 if digits set to 5. The default 0 means no padding.', 'invoicing' ), |
|
589 | + 'name' => __('Minimum Digits', 'invoicing'), |
|
590 | + 'desc' => __('If the invoice number has less digits than this number, it is left padded with 0s. Ex: invoice number 108 will padded to 00108 if digits set to 5. The default 0 means no padding.', 'invoicing'), |
|
591 | 591 | 'type' => 'select', |
592 | 592 | 'options' => $invoice_number_padd_options, |
593 | 593 | 'std' => 5, |
@@ -595,8 +595,8 @@ discard block |
||
595 | 595 | ), |
596 | 596 | 'invoice_number_prefix' => array( |
597 | 597 | 'id' => 'invoice_number_prefix', |
598 | - 'name' => __( 'Invoice Number Prefix', 'invoicing' ), |
|
599 | - 'desc' => __( 'Prefix for all invoice numbers. Ex: INV-', 'invoicing' ), |
|
598 | + 'name' => __('Invoice Number Prefix', 'invoicing'), |
|
599 | + 'desc' => __('Prefix for all invoice numbers. Ex: INV-', 'invoicing'), |
|
600 | 600 | 'type' => 'text', |
601 | 601 | 'size' => 'regular', |
602 | 602 | 'std' => 'INV-', |
@@ -604,77 +604,77 @@ discard block |
||
604 | 604 | ), |
605 | 605 | 'invoice_number_postfix' => array( |
606 | 606 | 'id' => 'invoice_number_postfix', |
607 | - 'name' => __( 'Invoice Number Postfix', 'invoicing' ), |
|
608 | - 'desc' => __( 'Postfix for all invoice numbers.', 'invoicing' ), |
|
607 | + 'name' => __('Invoice Number Postfix', 'invoicing'), |
|
608 | + 'desc' => __('Postfix for all invoice numbers.', 'invoicing'), |
|
609 | 609 | 'type' => 'text', |
610 | 610 | 'size' => 'regular', |
611 | 611 | 'std' => '', |
612 | 612 | ), |
613 | 613 | 'checkout_settings' => array( |
614 | 614 | 'id' => 'checkout_settings', |
615 | - 'name' => '<h3>' . __( 'Checkout Settings', 'invoicing' ) . '</h3>', |
|
615 | + 'name' => '<h3>' . __('Checkout Settings', 'invoicing') . '</h3>', |
|
616 | 616 | 'type' => 'header', |
617 | 617 | ), |
618 | 618 | 'disable_new_user_emails' => array( |
619 | 619 | 'id' => 'disable_new_user_emails', |
620 | - 'name' => __( 'Disable new user emails', 'invoicing' ), |
|
621 | - 'desc' => __( 'Do not send an email to customers when a new user account is created for them.', 'invoicing' ), |
|
620 | + 'name' => __('Disable new user emails', 'invoicing'), |
|
621 | + 'desc' => __('Do not send an email to customers when a new user account is created for them.', 'invoicing'), |
|
622 | 622 | 'type' => 'checkbox', |
623 | 623 | ), |
624 | 624 | 'login_to_checkout' => array( |
625 | 625 | 'id' => 'login_to_checkout', |
626 | - 'name' => __( 'Require Login To Checkout', 'invoicing' ), |
|
627 | - 'desc' => __( 'If ticked then user needs to be logged in to view or pay invoice, can only view or pay their own invoice. If unticked then anyone can view or pay the invoice.', 'invoicing' ), |
|
626 | + 'name' => __('Require Login To Checkout', 'invoicing'), |
|
627 | + 'desc' => __('If ticked then user needs to be logged in to view or pay invoice, can only view or pay their own invoice. If unticked then anyone can view or pay the invoice.', 'invoicing'), |
|
628 | 628 | 'type' => 'checkbox', |
629 | 629 | ), |
630 | 630 | 'enable_recaptcha' => array( |
631 | 631 | 'id' => 'enable_recaptcha', |
632 | - 'name' => __( 'Enable reCAPTCHA', 'invoicing' ), |
|
633 | - 'desc' => __( 'If ticked then reCAPTCHA will be enabled on the checkout page.', 'invoicing' ), |
|
632 | + 'name' => __('Enable reCAPTCHA', 'invoicing'), |
|
633 | + 'desc' => __('If ticked then reCAPTCHA will be enabled on the checkout page.', 'invoicing'), |
|
634 | 634 | 'type' => 'checkbox', |
635 | 635 | ), |
636 | 636 | 'recaptcha_version' => array( |
637 | 637 | 'id' => 'recaptcha_version', |
638 | - 'name' => __( 'reCAPTCHA Version', 'invoicing' ), |
|
639 | - 'desc' => __( 'Select the version of reCAPTCHA you would like to use.', 'invoicing' ), |
|
638 | + 'name' => __('reCAPTCHA Version', 'invoicing'), |
|
639 | + 'desc' => __('Select the version of reCAPTCHA you would like to use.', 'invoicing'), |
|
640 | 640 | 'type' => 'select', |
641 | 641 | 'options' => array( |
642 | - 'v2' => __( 'reCAPTCHA v2', 'invoicing' ), |
|
643 | - 'v3' => __( 'reCAPTCHA v3', 'invoicing' ), |
|
642 | + 'v2' => __('reCAPTCHA v2', 'invoicing'), |
|
643 | + 'v3' => __('reCAPTCHA v3', 'invoicing'), |
|
644 | 644 | ), |
645 | 645 | 'std' => 'v2', |
646 | 646 | ), |
647 | 647 | 'recaptcha_site_key' => array( |
648 | 648 | 'id' => 'recaptcha_site_key', |
649 | - 'name' => __( 'reCAPTCHA Site Key', 'invoicing' ), |
|
650 | - 'desc' => __( 'Enter your reCAPTCHA site key.', 'invoicing' ) . ' <a href="https://www.google.com/recaptcha/admin/create" target="_blank">' . __( 'Generate a site key.', 'invoicing' ) . '</a>', |
|
649 | + 'name' => __('reCAPTCHA Site Key', 'invoicing'), |
|
650 | + 'desc' => __('Enter your reCAPTCHA site key.', 'invoicing') . ' <a href="https://www.google.com/recaptcha/admin/create" target="_blank">' . __('Generate a site key.', 'invoicing') . '</a>', |
|
651 | 651 | 'type' => 'text', |
652 | 652 | 'size' => 'regular', |
653 | 653 | ), |
654 | 654 | 'recaptcha_secret_key' => array( |
655 | 655 | 'id' => 'recaptcha_secret_key', |
656 | - 'name' => __( 'reCAPTCHA Secret Key', 'invoicing' ), |
|
657 | - 'desc' => __( 'Enter your reCAPTCHA secret key.', 'invoicing' ), |
|
656 | + 'name' => __('reCAPTCHA Secret Key', 'invoicing'), |
|
657 | + 'desc' => __('Enter your reCAPTCHA secret key.', 'invoicing'), |
|
658 | 658 | 'type' => 'text', |
659 | 659 | 'size' => 'regular', |
660 | 660 | ), |
661 | 661 | 'maxmind_license_key' => array( |
662 | 662 | 'id' => 'maxmind_license_key', |
663 | - 'name' => __( 'MaxMind License Key', 'invoicing' ), |
|
663 | + 'name' => __('MaxMind License Key', 'invoicing'), |
|
664 | 664 | 'type' => 'text', |
665 | 665 | 'size' => 'regular', |
666 | - 'desc' => __( "Enter you license key if you would like to use MaxMind to automatically detect a customer's country.", 'invoicing' ) . ' <a href="https://support.maxmind.com/hc/en-us/articles/4407111582235-Generate-a-License-Key">' . __( 'How to generate a free license key.', 'invoicing' ) . '</a>', |
|
666 | + 'desc' => __("Enter you license key if you would like to use MaxMind to automatically detect a customer's country.", 'invoicing') . ' <a href="https://support.maxmind.com/hc/en-us/articles/4407111582235-Generate-a-License-Key">' . __('How to generate a free license key.', 'invoicing') . '</a>', |
|
667 | 667 | ), |
668 | 668 | |
669 | 669 | 'uninstall_settings' => array( |
670 | 670 | 'id' => 'uninstall_settings', |
671 | - 'name' => '<h3>' . __( 'Uninstall Settings', 'invoicing' ) . '</h3>', |
|
671 | + 'name' => '<h3>' . __('Uninstall Settings', 'invoicing') . '</h3>', |
|
672 | 672 | 'type' => 'header', |
673 | 673 | ), |
674 | 674 | 'remove_data_on_unistall' => array( |
675 | 675 | 'id' => 'remove_data_on_unistall', |
676 | - 'name' => __( 'Remove Data on Uninstall?', 'invoicing' ), |
|
677 | - 'desc' => __( 'Check this box if you would like Invoicing plugin to completely remove all of its data when the plugin is deleted/uninstalled.', 'invoicing' ), |
|
676 | + 'name' => __('Remove Data on Uninstall?', 'invoicing'), |
|
677 | + 'desc' => __('Check this box if you would like Invoicing plugin to completely remove all of its data when the plugin is deleted/uninstalled.', 'invoicing'), |
|
678 | 678 | 'type' => 'checkbox', |
679 | 679 | 'std' => '', |
680 | 680 | ), |
@@ -683,13 +683,13 @@ discard block |
||
683 | 683 | 'custom-css' => array( |
684 | 684 | 'css_settings' => array( |
685 | 685 | 'id' => 'css_settings', |
686 | - 'name' => '<h3>' . __( 'Custom CSS', 'invoicing' ) . '</h3>', |
|
686 | + 'name' => '<h3>' . __('Custom CSS', 'invoicing') . '</h3>', |
|
687 | 687 | 'type' => 'header', |
688 | 688 | ), |
689 | 689 | 'template_custom_css' => array( |
690 | 690 | 'id' => 'template_custom_css', |
691 | - 'name' => __( 'Invoice Template CSS', 'invoicing' ), |
|
692 | - 'desc' => __( 'Add CSS to modify appearance of the print invoice page.', 'invoicing' ), |
|
691 | + 'name' => __('Invoice Template CSS', 'invoicing'), |
|
692 | + 'desc' => __('Add CSS to modify appearance of the print invoice page.', 'invoicing'), |
|
693 | 693 | 'type' => 'textarea', |
694 | 694 | 'class' => 'regular-text', |
695 | 695 | 'rows' => 10, |
@@ -704,8 +704,8 @@ discard block |
||
704 | 704 | 'main' => array( |
705 | 705 | 'tool_settings' => array( |
706 | 706 | 'id' => 'tool_settings', |
707 | - 'name' => '<h3>' . __( 'Diagnostic Tools', 'invoicing' ) . '</h3>', |
|
708 | - 'desc' => __( 'Invoicing diagnostic tools', 'invoicing' ), |
|
707 | + 'name' => '<h3>' . __('Diagnostic Tools', 'invoicing') . '</h3>', |
|
708 | + 'desc' => __('Invoicing diagnostic tools', 'invoicing'), |
|
709 | 709 | 'type' => 'tools', |
710 | 710 | ), |
711 | 711 | ), |
@@ -7,17 +7,17 @@ discard block |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | // Standardize IDs. |
13 | 13 | global $rendered_getpaid_forms; |
14 | 14 | |
15 | 15 | // Make sure that the form is active. |
16 | -if ( ! $form->is_active() ) { |
|
16 | +if (!$form->is_active()) { |
|
17 | 17 | aui()->alert( |
18 | 18 | array( |
19 | 19 | 'type' => 'warning', |
20 | - 'content' => __( 'This payment form is no longer active', 'invoicing' ), |
|
20 | + 'content' => __('This payment form is no longer active', 'invoicing'), |
|
21 | 21 | ), |
22 | 22 | true |
23 | 23 | ); |
@@ -25,12 +25,12 @@ discard block |
||
25 | 25 | } |
26 | 26 | |
27 | 27 | // Require login to checkout. |
28 | -if ( wpinv_require_login_to_checkout() && ! get_current_user_id() ) { |
|
28 | +if (wpinv_require_login_to_checkout() && !get_current_user_id()) { |
|
29 | 29 | |
30 | 30 | aui()->alert( |
31 | 31 | array( |
32 | 32 | 'type' => 'danger', |
33 | - 'content' => __( 'You must be logged in to checkout.', 'invoicing' ), |
|
33 | + 'content' => __('You must be logged in to checkout.', 'invoicing'), |
|
34 | 34 | ), |
35 | 35 | true |
36 | 36 | ); |
@@ -38,36 +38,36 @@ discard block |
||
38 | 38 | |
39 | 39 | } |
40 | 40 | |
41 | -if ( ! is_array( $rendered_getpaid_forms ) ) { |
|
41 | +if (!is_array($rendered_getpaid_forms)) { |
|
42 | 42 | $rendered_getpaid_forms = array(); |
43 | 43 | } |
44 | 44 | |
45 | -$rendered_getpaid_forms[ $form->get_id() ] = isset( $rendered_getpaid_forms[ $form->get_id() ] ) ? $rendered_getpaid_forms[ $form->get_id() ] + 1 : 0; |
|
45 | +$rendered_getpaid_forms[$form->get_id()] = isset($rendered_getpaid_forms[$form->get_id()]) ? $rendered_getpaid_forms[$form->get_id()] + 1 : 0; |
|
46 | 46 | |
47 | 47 | // Fires before displaying a payment form. |
48 | -do_action( 'getpaid_before_payment_form', $form ); |
|
48 | +do_action('getpaid_before_payment_form', $form); |
|
49 | 49 | ?> |
50 | 50 | |
51 | -<form class='getpaid-payment-form getpaid-payment-form-<?php echo absint( $form->get_id() ); ?> bsui position-relative' method='POST' data-key='<?php echo esc_attr( uniqid( 'gpf' ) ); ?>' data-currency='<?php echo esc_attr( empty( $form->invoice ) ? wpinv_get_currency() : $form->invoice->get_currency() ); ?>' novalidate> |
|
51 | +<form class='getpaid-payment-form getpaid-payment-form-<?php echo absint($form->get_id()); ?> bsui position-relative' method='POST' data-key='<?php echo esc_attr(uniqid('gpf')); ?>' data-currency='<?php echo esc_attr(empty($form->invoice) ? wpinv_get_currency() : $form->invoice->get_currency()); ?>' novalidate> |
|
52 | 52 | |
53 | 53 | <?php |
54 | 54 | |
55 | 55 | // Fires when printing the top of a payment form. |
56 | - do_action( 'getpaid_payment_form_top', $form ); |
|
56 | + do_action('getpaid_payment_form_top', $form); |
|
57 | 57 | |
58 | 58 | // And the optional invoice id. |
59 | - if ( ! empty( $form->invoice ) ) { |
|
60 | - getpaid_hidden_field( 'invoice_id', $form->invoice->get_id() ); |
|
59 | + if (!empty($form->invoice)) { |
|
60 | + getpaid_hidden_field('invoice_id', $form->invoice->get_id()); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | // We also want to include the form id. |
64 | - getpaid_hidden_field( 'form_id', $form->get_id() ); |
|
64 | + getpaid_hidden_field('form_id', $form->get_id()); |
|
65 | 65 | |
66 | 66 | // And an indication that this is a payment form submission. |
67 | - getpaid_hidden_field( 'getpaid_payment_form_submission', '1' ); |
|
67 | + getpaid_hidden_field('getpaid_payment_form_submission', '1'); |
|
68 | 68 | |
69 | 69 | // Fires before displaying payment form elements. |
70 | - do_action( 'getpaid_payment_form_before_elements', $form ); |
|
70 | + do_action('getpaid_payment_form_before_elements', $form); |
|
71 | 71 | |
72 | 72 | // Display the elements. |
73 | 73 | ?> |
@@ -75,17 +75,17 @@ discard block |
||
75 | 75 | <div class="row"> |
76 | 76 | <?php |
77 | 77 | |
78 | - foreach ( $form->get_elements() as $element ) { |
|
79 | - if ( isset( $element['type'] ) ) { |
|
80 | - $grid_class = getpaid_get_form_element_grid_class( $element ); |
|
81 | - do_action( 'getpaid_payment_form_element_before', $element, $form ); |
|
82 | - do_action( "getpaid_payment_form_element_before_{$element['type']}_template", $element, $form ); |
|
83 | - echo "<div class='" . esc_attr( $grid_class ) . "'>"; |
|
84 | - do_action( 'getpaid_payment_form_element', $element, $form ); |
|
85 | - do_action( "getpaid_payment_form_element_{$element['type']}_template", $element, $form ); |
|
78 | + foreach ($form->get_elements() as $element) { |
|
79 | + if (isset($element['type'])) { |
|
80 | + $grid_class = getpaid_get_form_element_grid_class($element); |
|
81 | + do_action('getpaid_payment_form_element_before', $element, $form); |
|
82 | + do_action("getpaid_payment_form_element_before_{$element['type']}_template", $element, $form); |
|
83 | + echo "<div class='" . esc_attr($grid_class) . "'>"; |
|
84 | + do_action('getpaid_payment_form_element', $element, $form); |
|
85 | + do_action("getpaid_payment_form_element_{$element['type']}_template", $element, $form); |
|
86 | 86 | echo '</div>'; |
87 | - do_action( 'getpaid_payment_form_element_after', $element, $form ); |
|
88 | - do_action( "getpaid_payment_form_element_after_{$element['type']}_template", $element, $form ); |
|
87 | + do_action('getpaid_payment_form_element_after', $element, $form); |
|
88 | + do_action("getpaid_payment_form_element_after_{$element['type']}_template", $element, $form); |
|
89 | 89 | } |
90 | 90 | } |
91 | 91 | |
@@ -95,28 +95,28 @@ discard block |
||
95 | 95 | |
96 | 96 | <?php |
97 | 97 | // Fires after displaying payment form elements. |
98 | - do_action( 'getpaid_payment_form_after_elements', $form ); |
|
98 | + do_action('getpaid_payment_form_after_elements', $form); |
|
99 | 99 | |
100 | 100 | echo "<div class='getpaid-payment-form-errors alert alert-danger d-none'></div>"; |
101 | 101 | |
102 | - if ( wpinv_current_user_can_manage_invoicing() ) { |
|
102 | + if (wpinv_current_user_can_manage_invoicing()) { |
|
103 | 103 | |
104 | 104 | edit_post_link( |
105 | - __( 'Edit this form.', 'invoicing' ), |
|
105 | + __('Edit this form.', 'invoicing'), |
|
106 | 106 | '<small class="form-text text-muted">', |
107 | - ' ' . __( 'This is only visible to website administators.', 'invoicing' ) . '</small>', |
|
107 | + ' ' . __('This is only visible to website administators.', 'invoicing') . '</small>', |
|
108 | 108 | $form->get_id(), |
109 | 109 | 'text-danger' |
110 | 110 | ); |
111 | 111 | |
112 | 112 | } |
113 | 113 | |
114 | - echo wp_kses( $extra_markup, getpaid_allowed_html() ); |
|
114 | + echo wp_kses($extra_markup, getpaid_allowed_html()); |
|
115 | 115 | ?> |
116 | 116 | |
117 | 117 | <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;"> |
118 | 118 | <div class="spinner-border mx-auto align-self-center text-white" role="status"> |
119 | - <span class="sr-only"><?php esc_html_e( 'Loading...', 'invoicing' ); ?></span> |
|
119 | + <span class="sr-only"><?php esc_html_e('Loading...', 'invoicing'); ?></span> |
|
120 | 120 | </div> |
121 | 121 | </div> |
122 | 122 | |
@@ -125,4 +125,4 @@ discard block |
||
125 | 125 | <?php |
126 | 126 | |
127 | 127 | // Fires after displaying a payment form. |
128 | -do_action( 'getpaid_after_payment_form', $form ); |
|
128 | +do_action('getpaid_after_payment_form', $form); |