@@ -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 | * WPInv_Ajax class. |
@@ -17,8 +17,8 @@ discard block |
||
17 | 17 | * Hook in ajax handlers. |
18 | 18 | */ |
19 | 19 | public static function init() { |
20 | - add_action( 'init', array( __CLASS__, 'define_ajax' ), 0 ); |
|
21 | - add_action( 'template_redirect', array( __CLASS__, 'do_wpinv_ajax' ), 0 ); |
|
20 | + add_action('init', array(__CLASS__, 'define_ajax'), 0); |
|
21 | + add_action('template_redirect', array(__CLASS__, 'do_wpinv_ajax'), 0); |
|
22 | 22 | self::add_ajax_events(); |
23 | 23 | } |
24 | 24 | |
@@ -27,11 +27,11 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public static function define_ajax() { |
29 | 29 | |
30 | - if ( ! empty( $_GET['wpinv-ajax'] ) ) { |
|
31 | - getpaid_maybe_define_constant( 'DOING_AJAX', true ); |
|
32 | - getpaid_maybe_define_constant( 'WPInv_DOING_AJAX', true ); |
|
33 | - if ( ! WP_DEBUG || ( WP_DEBUG && ! WP_DEBUG_DISPLAY ) ) { |
|
34 | - /** @scrutinizer ignore-unhandled */ @ini_set( 'display_errors', 0 ); |
|
30 | + if (!empty($_GET['wpinv-ajax'])) { |
|
31 | + getpaid_maybe_define_constant('DOING_AJAX', true); |
|
32 | + getpaid_maybe_define_constant('WPInv_DOING_AJAX', true); |
|
33 | + if (!WP_DEBUG || (WP_DEBUG && !WP_DEBUG_DISPLAY)) { |
|
34 | + /** @scrutinizer ignore-unhandled */ @ini_set('display_errors', 0); |
|
35 | 35 | } |
36 | 36 | $GLOBALS['wpdb']->hide_errors(); |
37 | 37 | } |
@@ -44,13 +44,13 @@ discard block |
||
44 | 44 | * @since 1.0.18 |
45 | 45 | */ |
46 | 46 | private static function wpinv_ajax_headers() { |
47 | - if ( ! headers_sent() ) { |
|
47 | + if (!headers_sent()) { |
|
48 | 48 | send_origin_headers(); |
49 | 49 | send_nosniff_header(); |
50 | 50 | nocache_headers(); |
51 | - header( 'Content-Type: text/html; charset=' . get_option( 'blog_charset' ) ); |
|
52 | - header( 'X-Robots-Tag: noindex' ); |
|
53 | - status_header( 200 ); |
|
51 | + header('Content-Type: text/html; charset=' . get_option('blog_charset')); |
|
52 | + header('X-Robots-Tag: noindex'); |
|
53 | + status_header(200); |
|
54 | 54 | } |
55 | 55 | } |
56 | 56 | |
@@ -60,16 +60,16 @@ discard block |
||
60 | 60 | public static function do_wpinv_ajax() { |
61 | 61 | global $wp_query; |
62 | 62 | |
63 | - if ( ! empty( $_GET['wpinv-ajax'] ) ) { |
|
64 | - $wp_query->set( 'wpinv-ajax', sanitize_text_field( wp_unslash( $_GET['wpinv-ajax'] ) ) ); |
|
63 | + if (!empty($_GET['wpinv-ajax'])) { |
|
64 | + $wp_query->set('wpinv-ajax', sanitize_text_field(wp_unslash($_GET['wpinv-ajax']))); |
|
65 | 65 | } |
66 | 66 | |
67 | - $action = $wp_query->get( 'wpinv-ajax' ); |
|
67 | + $action = $wp_query->get('wpinv-ajax'); |
|
68 | 68 | |
69 | - if ( $action ) { |
|
69 | + if ($action) { |
|
70 | 70 | self::wpinv_ajax_headers(); |
71 | - $action = sanitize_text_field( $action ); |
|
72 | - do_action( 'wpinv_ajax_' . $action ); |
|
71 | + $action = sanitize_text_field($action); |
|
72 | + do_action('wpinv_ajax_' . $action); |
|
73 | 73 | wp_die(); |
74 | 74 | } |
75 | 75 | |
@@ -102,36 +102,36 @@ discard block |
||
102 | 102 | 'ip_geolocation' => true, |
103 | 103 | ); |
104 | 104 | |
105 | - foreach ( $ajax_events as $ajax_event => $nopriv ) { |
|
106 | - add_action( 'wp_ajax_wpinv_' . $ajax_event, array( __CLASS__, $ajax_event ) ); |
|
107 | - add_action( 'wp_ajax_getpaid_' . $ajax_event, array( __CLASS__, $ajax_event ) ); |
|
105 | + foreach ($ajax_events as $ajax_event => $nopriv) { |
|
106 | + add_action('wp_ajax_wpinv_' . $ajax_event, array(__CLASS__, $ajax_event)); |
|
107 | + add_action('wp_ajax_getpaid_' . $ajax_event, array(__CLASS__, $ajax_event)); |
|
108 | 108 | |
109 | - if ( $nopriv ) { |
|
110 | - add_action( 'wp_ajax_nopriv_wpinv_' . $ajax_event, array( __CLASS__, $ajax_event ) ); |
|
111 | - add_action( 'wp_ajax_nopriv_getpaid_' . $ajax_event, array( __CLASS__, $ajax_event ) ); |
|
112 | - add_action( 'wpinv_ajax_' . $ajax_event, array( __CLASS__, $ajax_event ) ); |
|
109 | + if ($nopriv) { |
|
110 | + add_action('wp_ajax_nopriv_wpinv_' . $ajax_event, array(__CLASS__, $ajax_event)); |
|
111 | + add_action('wp_ajax_nopriv_getpaid_' . $ajax_event, array(__CLASS__, $ajax_event)); |
|
112 | + add_action('wpinv_ajax_' . $ajax_event, array(__CLASS__, $ajax_event)); |
|
113 | 113 | } |
114 | 114 | } |
115 | 115 | } |
116 | 116 | |
117 | 117 | public static function add_note() { |
118 | - check_ajax_referer( 'add-invoice-note', '_nonce' ); |
|
118 | + check_ajax_referer('add-invoice-note', '_nonce'); |
|
119 | 119 | |
120 | - if ( ! wpinv_current_user_can_manage_invoicing() ) { |
|
120 | + if (!wpinv_current_user_can_manage_invoicing()) { |
|
121 | 121 | die(-1); |
122 | 122 | } |
123 | 123 | |
124 | - $post_id = absint( $_POST['post_id'] ); |
|
125 | - $note = wp_kses_post( trim( stripslashes( $_POST['note'] ) ) ); |
|
126 | - $note_type = sanitize_text_field( $_POST['note_type'] ); |
|
124 | + $post_id = absint($_POST['post_id']); |
|
125 | + $note = wp_kses_post(trim(stripslashes($_POST['note']))); |
|
126 | + $note_type = sanitize_text_field($_POST['note_type']); |
|
127 | 127 | |
128 | 128 | $is_customer_note = $note_type == 'customer' ? 1 : 0; |
129 | 129 | |
130 | - if ( $post_id > 0 ) { |
|
131 | - $note_id = wpinv_insert_payment_note( $post_id, $note, $is_customer_note ); |
|
130 | + if ($post_id > 0) { |
|
131 | + $note_id = wpinv_insert_payment_note($post_id, $note, $is_customer_note); |
|
132 | 132 | |
133 | - if ( $note_id > 0 && !is_wp_error( $note_id ) ) { |
|
134 | - wpinv_get_invoice_note_line_item( $note_id ); |
|
133 | + if ($note_id > 0 && !is_wp_error($note_id)) { |
|
134 | + wpinv_get_invoice_note_line_item($note_id); |
|
135 | 135 | } |
136 | 136 | } |
137 | 137 | |
@@ -139,16 +139,16 @@ discard block |
||
139 | 139 | } |
140 | 140 | |
141 | 141 | public static function delete_note() { |
142 | - check_ajax_referer( 'delete-invoice-note', '_nonce' ); |
|
142 | + check_ajax_referer('delete-invoice-note', '_nonce'); |
|
143 | 143 | |
144 | - if ( !wpinv_current_user_can_manage_invoicing() ) { |
|
144 | + if (!wpinv_current_user_can_manage_invoicing()) { |
|
145 | 145 | die(-1); |
146 | 146 | } |
147 | 147 | |
148 | - $note_id = (int)$_POST['note_id']; |
|
148 | + $note_id = (int) $_POST['note_id']; |
|
149 | 149 | |
150 | - if ( $note_id > 0 ) { |
|
151 | - wp_delete_comment( $note_id, true ); |
|
150 | + if ($note_id > 0) { |
|
151 | + wp_delete_comment($note_id, true); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | die(); |
@@ -166,34 +166,34 @@ discard block |
||
166 | 166 | public static function get_billing_details() { |
167 | 167 | |
168 | 168 | // Verify nonce. |
169 | - check_ajax_referer( 'wpinv-nonce' ); |
|
169 | + check_ajax_referer('wpinv-nonce'); |
|
170 | 170 | |
171 | 171 | // Can the user manage the plugin? |
172 | - if ( ! wpinv_current_user_can_manage_invoicing() ) { |
|
172 | + if (!wpinv_current_user_can_manage_invoicing()) { |
|
173 | 173 | die(-1); |
174 | 174 | } |
175 | 175 | |
176 | 176 | // Do we have a user id? |
177 | 177 | $user_id = $_GET['user_id']; |
178 | 178 | |
179 | - if ( empty( $user_id ) || ! is_numeric( $user_id ) ) { |
|
179 | + if (empty($user_id) || !is_numeric($user_id)) { |
|
180 | 180 | die(-1); |
181 | 181 | } |
182 | 182 | |
183 | 183 | // Fetch the billing details. |
184 | - $billing_details = wpinv_get_user_address( $user_id ); |
|
185 | - $billing_details = apply_filters( 'wpinv_ajax_billing_details', $billing_details, $user_id ); |
|
184 | + $billing_details = wpinv_get_user_address($user_id); |
|
185 | + $billing_details = apply_filters('wpinv_ajax_billing_details', $billing_details, $user_id); |
|
186 | 186 | |
187 | 187 | // unset the user id and email. |
188 | - $to_ignore = array( 'user_id', 'email' ); |
|
188 | + $to_ignore = array('user_id', 'email'); |
|
189 | 189 | |
190 | - foreach ( $to_ignore as $key ) { |
|
191 | - if ( isset( $billing_details[ $key ] ) ) { |
|
192 | - unset( $billing_details[ $key ] ); |
|
190 | + foreach ($to_ignore as $key) { |
|
191 | + if (isset($billing_details[$key])) { |
|
192 | + unset($billing_details[$key]); |
|
193 | 193 | } |
194 | 194 | } |
195 | 195 | |
196 | - wp_send_json_success( $billing_details ); |
|
196 | + wp_send_json_success($billing_details); |
|
197 | 197 | |
198 | 198 | } |
199 | 199 | |
@@ -203,47 +203,47 @@ discard block |
||
203 | 203 | public static function check_new_user_email() { |
204 | 204 | |
205 | 205 | // Verify nonce. |
206 | - check_ajax_referer( 'wpinv-nonce' ); |
|
206 | + check_ajax_referer('wpinv-nonce'); |
|
207 | 207 | |
208 | 208 | // Can the user manage the plugin? |
209 | - if ( ! wpinv_current_user_can_manage_invoicing() ) { |
|
209 | + if (!wpinv_current_user_can_manage_invoicing()) { |
|
210 | 210 | die(-1); |
211 | 211 | } |
212 | 212 | |
213 | 213 | // We need an email address. |
214 | - if ( empty( $_GET['email'] ) ) { |
|
215 | - _e( "Provide the new user's email address", 'invoicing' ); |
|
214 | + if (empty($_GET['email'])) { |
|
215 | + _e("Provide the new user's email address", 'invoicing'); |
|
216 | 216 | exit; |
217 | 217 | } |
218 | 218 | |
219 | 219 | // Ensure the email is valid. |
220 | - $email = sanitize_text_field( $_GET['email'] ); |
|
221 | - if ( ! is_email( $email ) ) { |
|
222 | - _e( 'Invalid email address', 'invoicing' ); |
|
220 | + $email = sanitize_text_field($_GET['email']); |
|
221 | + if (!is_email($email)) { |
|
222 | + _e('Invalid email address', 'invoicing'); |
|
223 | 223 | exit; |
224 | 224 | } |
225 | 225 | |
226 | 226 | // And it does not exist. |
227 | - if ( email_exists( $email ) ) { |
|
228 | - _e( 'A user with this email address already exists', 'invoicing' ); |
|
227 | + if (email_exists($email)) { |
|
228 | + _e('A user with this email address already exists', 'invoicing'); |
|
229 | 229 | exit; |
230 | 230 | } |
231 | 231 | |
232 | - wp_send_json_success( true ); |
|
232 | + wp_send_json_success(true); |
|
233 | 233 | } |
234 | 234 | |
235 | 235 | public static function run_tool() { |
236 | - check_ajax_referer( 'wpinv-nonce', '_nonce' ); |
|
237 | - if ( !wpinv_current_user_can_manage_invoicing() ) { |
|
236 | + check_ajax_referer('wpinv-nonce', '_nonce'); |
|
237 | + if (!wpinv_current_user_can_manage_invoicing()) { |
|
238 | 238 | die(-1); |
239 | 239 | } |
240 | 240 | |
241 | - $tool = sanitize_text_field( $_POST['tool'] ); |
|
241 | + $tool = sanitize_text_field($_POST['tool']); |
|
242 | 242 | |
243 | - do_action( 'wpinv_run_tool' ); |
|
243 | + do_action('wpinv_run_tool'); |
|
244 | 244 | |
245 | - if ( !empty( $tool ) ) { |
|
246 | - do_action( 'wpinv_tool_' . $tool ); |
|
245 | + if (!empty($tool)) { |
|
246 | + do_action('wpinv_tool_' . $tool); |
|
247 | 247 | } |
248 | 248 | } |
249 | 249 | |
@@ -253,30 +253,30 @@ discard block |
||
253 | 253 | public static function get_payment_form() { |
254 | 254 | |
255 | 255 | // Check nonce. |
256 | - if ( ! isset( $_GET['nonce'] ) || ! wp_verify_nonce( $_GET['nonce'], 'getpaid_ajax_form' ) ) { |
|
257 | - _e( 'Error: Reload the page and try again.', 'invoicing' ); |
|
256 | + if (!isset($_GET['nonce']) || !wp_verify_nonce($_GET['nonce'], 'getpaid_ajax_form')) { |
|
257 | + _e('Error: Reload the page and try again.', 'invoicing'); |
|
258 | 258 | exit; |
259 | 259 | } |
260 | 260 | |
261 | 261 | // Is the request set up correctly? |
262 | - if ( empty( $_GET['form'] ) && empty( $_GET['item'] ) ) { |
|
262 | + if (empty($_GET['form']) && empty($_GET['item'])) { |
|
263 | 263 | echo aui()->alert( |
264 | 264 | array( |
265 | 265 | 'type' => 'warning', |
266 | - 'content' => __( 'No payment form or item provided', 'invoicing' ), |
|
266 | + 'content' => __('No payment form or item provided', 'invoicing'), |
|
267 | 267 | ) |
268 | 268 | ); |
269 | 269 | exit; |
270 | 270 | } |
271 | 271 | |
272 | 272 | // Payment form or button? |
273 | - if ( ! empty( $_GET['form'] ) ) { |
|
274 | - getpaid_display_payment_form( $_GET['form'] ); |
|
275 | - } else if( ! empty( $_GET['invoice'] ) ) { |
|
276 | - getpaid_display_invoice_payment_form( $_GET['invoice'] ); |
|
273 | + if (!empty($_GET['form'])) { |
|
274 | + getpaid_display_payment_form($_GET['form']); |
|
275 | + } else if (!empty($_GET['invoice'])) { |
|
276 | + getpaid_display_invoice_payment_form($_GET['invoice']); |
|
277 | 277 | } else { |
278 | - $items = getpaid_convert_items_to_array( $_GET['item'] ); |
|
279 | - getpaid_display_item_payment_form( $items ); |
|
278 | + $items = getpaid_convert_items_to_array($_GET['item']); |
|
279 | + getpaid_display_item_payment_form($items); |
|
280 | 280 | } |
281 | 281 | |
282 | 282 | exit; |
@@ -291,17 +291,17 @@ discard block |
||
291 | 291 | public static function payment_form() { |
292 | 292 | |
293 | 293 | // Check nonce. |
294 | - check_ajax_referer( 'getpaid_form_nonce' ); |
|
294 | + check_ajax_referer('getpaid_form_nonce'); |
|
295 | 295 | |
296 | 296 | // ... form fields... |
297 | - if ( empty( $_POST['getpaid_payment_form_submission'] ) ) { |
|
298 | - _e( 'Error: Reload the page and try again.', 'invoicing' ); |
|
297 | + if (empty($_POST['getpaid_payment_form_submission'])) { |
|
298 | + _e('Error: Reload the page and try again.', 'invoicing'); |
|
299 | 299 | exit; |
300 | 300 | } |
301 | 301 | |
302 | 302 | // Process the payment form. |
303 | - $checkout_class = apply_filters( 'getpaid_checkout_class', 'GetPaid_Checkout' ); |
|
304 | - $checkout = new $checkout_class( new GetPaid_Payment_Form_Submission() ); |
|
303 | + $checkout_class = apply_filters('getpaid_checkout_class', 'GetPaid_Checkout'); |
|
304 | + $checkout = new $checkout_class(new GetPaid_Payment_Form_Submission()); |
|
305 | 305 | $checkout->process_checkout(); |
306 | 306 | |
307 | 307 | exit; |
@@ -314,51 +314,51 @@ discard block |
||
314 | 314 | */ |
315 | 315 | public static function get_payment_form_states_field() { |
316 | 316 | |
317 | - if ( empty( $_GET['country'] ) || empty( $_GET['form'] ) ) { |
|
317 | + if (empty($_GET['country']) || empty($_GET['form'])) { |
|
318 | 318 | exit; |
319 | 319 | } |
320 | 320 | |
321 | - $elements = getpaid_get_payment_form_elements( $_GET['form'] ); |
|
321 | + $elements = getpaid_get_payment_form_elements($_GET['form']); |
|
322 | 322 | |
323 | - if ( empty( $elements ) ) { |
|
323 | + if (empty($elements)) { |
|
324 | 324 | exit; |
325 | 325 | } |
326 | 326 | |
327 | 327 | $address_fields = array(); |
328 | - foreach ( $elements as $element ) { |
|
329 | - if ( 'address' === $element['type'] ) { |
|
328 | + foreach ($elements as $element) { |
|
329 | + if ('address' === $element['type']) { |
|
330 | 330 | $address_fields = $element; |
331 | 331 | break; |
332 | 332 | } |
333 | 333 | } |
334 | 334 | |
335 | - if ( empty( $address_fields ) ) { |
|
335 | + if (empty($address_fields)) { |
|
336 | 336 | exit; |
337 | 337 | } |
338 | 338 | |
339 | - foreach( $address_fields['fields'] as $address_field ) { |
|
339 | + foreach ($address_fields['fields'] as $address_field) { |
|
340 | 340 | |
341 | - if ( 'wpinv_state' == $address_field['name'] ) { |
|
341 | + if ('wpinv_state' == $address_field['name']) { |
|
342 | 342 | |
343 | 343 | $label = $address_field['label']; |
344 | 344 | |
345 | - if ( ! empty( $address_field['required'] ) ) { |
|
345 | + if (!empty($address_field['required'])) { |
|
346 | 346 | $label .= "<span class='text-danger'> *</span>"; |
347 | 347 | } |
348 | 348 | |
349 | - $states = wpinv_get_country_states( $_GET['country'] ); |
|
349 | + $states = wpinv_get_country_states($_GET['country']); |
|
350 | 350 | |
351 | - if ( ! empty( $states ) ) { |
|
351 | + if (!empty($states)) { |
|
352 | 352 | |
353 | 353 | $html = aui()->select( |
354 | 354 | array( |
355 | 355 | 'options' => $states, |
356 | - 'name' => esc_attr( $address_field['name'] ), |
|
357 | - 'id' => esc_attr( $address_field['name'] ), |
|
358 | - 'placeholder' => esc_attr( $address_field['placeholder'] ), |
|
356 | + 'name' => esc_attr($address_field['name']), |
|
357 | + 'id' => esc_attr($address_field['name']), |
|
358 | + 'placeholder' => esc_attr($address_field['placeholder']), |
|
359 | 359 | 'required' => (bool) $address_field['required'], |
360 | 360 | 'no_wrap' => true, |
361 | - 'label' => wp_kses_post( $label ), |
|
361 | + 'label' => wp_kses_post($label), |
|
362 | 362 | 'select2' => false, |
363 | 363 | ) |
364 | 364 | ); |
@@ -367,10 +367,10 @@ discard block |
||
367 | 367 | |
368 | 368 | $html = aui()->input( |
369 | 369 | array( |
370 | - 'name' => esc_attr( $address_field['name'] ), |
|
371 | - 'id' => esc_attr( $address_field['name'] ), |
|
370 | + 'name' => esc_attr($address_field['name']), |
|
371 | + 'id' => esc_attr($address_field['name']), |
|
372 | 372 | 'required' => (bool) $address_field['required'], |
373 | - 'label' => wp_kses_post( $label ), |
|
373 | + 'label' => wp_kses_post($label), |
|
374 | 374 | 'no_wrap' => true, |
375 | 375 | 'type' => 'text', |
376 | 376 | ) |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | |
379 | 379 | } |
380 | 380 | |
381 | - wp_send_json_success( str_replace( 'sr-only', '', $html ) ); |
|
381 | + wp_send_json_success(str_replace('sr-only', '', $html)); |
|
382 | 382 | exit; |
383 | 383 | |
384 | 384 | } |
@@ -394,56 +394,56 @@ discard block |
||
394 | 394 | public static function recalculate_invoice_totals() { |
395 | 395 | |
396 | 396 | // Verify nonce. |
397 | - check_ajax_referer( 'wpinv-nonce' ); |
|
397 | + check_ajax_referer('wpinv-nonce'); |
|
398 | 398 | |
399 | - if ( ! wpinv_current_user_can_manage_invoicing() ) { |
|
399 | + if (!wpinv_current_user_can_manage_invoicing()) { |
|
400 | 400 | exit; |
401 | 401 | } |
402 | 402 | |
403 | 403 | // We need an invoice. |
404 | - if ( empty( $_POST['post_id'] ) ) { |
|
404 | + if (empty($_POST['post_id'])) { |
|
405 | 405 | exit; |
406 | 406 | } |
407 | 407 | |
408 | 408 | // Fetch the invoice. |
409 | - $invoice = new WPInv_Invoice( trim( $_POST['post_id'] ) ); |
|
409 | + $invoice = new WPInv_Invoice(trim($_POST['post_id'])); |
|
410 | 410 | |
411 | 411 | // Ensure it exists. |
412 | - if ( ! $invoice->get_id() ) { |
|
412 | + if (!$invoice->get_id()) { |
|
413 | 413 | exit; |
414 | 414 | } |
415 | 415 | |
416 | 416 | // Maybe set the country, state, currency. |
417 | - foreach ( array( 'country', 'state', 'currency' ) as $key ) { |
|
418 | - if ( isset( $_POST[ $key ] ) ) { |
|
417 | + foreach (array('country', 'state', 'currency') as $key) { |
|
418 | + if (isset($_POST[$key])) { |
|
419 | 419 | $method = "set_$key"; |
420 | - $invoice->$method( $_POST[ $key ] ); |
|
420 | + $invoice->$method($_POST[$key]); |
|
421 | 421 | } |
422 | 422 | } |
423 | 423 | |
424 | 424 | // Maybe disable taxes. |
425 | - $invoice->set_disable_taxes( ! empty( $_POST['taxes'] ) ); |
|
425 | + $invoice->set_disable_taxes(!empty($_POST['taxes'])); |
|
426 | 426 | |
427 | 427 | // Recalculate totals. |
428 | 428 | $invoice->recalculate_total(); |
429 | 429 | |
430 | - $total = wpinv_price( wpinv_format_amount( $invoice->get_total() ), $invoice->get_currency() ); |
|
430 | + $total = wpinv_price(wpinv_format_amount($invoice->get_total()), $invoice->get_currency()); |
|
431 | 431 | |
432 | - if ( $invoice->is_recurring() && $invoice->is_parent() && $invoice->get_total() != $invoice->get_recurring_total() ) { |
|
433 | - $recurring_total = wpinv_price( wpinv_format_amount( $invoice->get_recurring_total() ), $invoice->get_currency() ); |
|
434 | - $total .= '<small class="form-text text-muted">' . sprintf( __( 'Recurring Price: %s', 'invoicing' ), $recurring_total ) . '</small>'; |
|
432 | + if ($invoice->is_recurring() && $invoice->is_parent() && $invoice->get_total() != $invoice->get_recurring_total()) { |
|
433 | + $recurring_total = wpinv_price(wpinv_format_amount($invoice->get_recurring_total()), $invoice->get_currency()); |
|
434 | + $total .= '<small class="form-text text-muted">' . sprintf(__('Recurring Price: %s', 'invoicing'), $recurring_total) . '</small>'; |
|
435 | 435 | } |
436 | 436 | |
437 | 437 | $totals = array( |
438 | - 'subtotal' => wpinv_price( wpinv_format_amount( $invoice->get_subtotal() ), $invoice->get_currency() ), |
|
439 | - 'discount' => wpinv_price( wpinv_format_amount( $invoice->get_total_discount() ), $invoice->get_currency() ), |
|
440 | - 'tax' => wpinv_price( wpinv_format_amount( $invoice->get_total_tax() ), $invoice->get_currency() ), |
|
438 | + 'subtotal' => wpinv_price(wpinv_format_amount($invoice->get_subtotal()), $invoice->get_currency()), |
|
439 | + 'discount' => wpinv_price(wpinv_format_amount($invoice->get_total_discount()), $invoice->get_currency()), |
|
440 | + 'tax' => wpinv_price(wpinv_format_amount($invoice->get_total_tax()), $invoice->get_currency()), |
|
441 | 441 | 'total' => $total, |
442 | 442 | ); |
443 | 443 | |
444 | - $totals = apply_filters( 'getpaid_invoice_totals', $totals, $invoice ); |
|
444 | + $totals = apply_filters('getpaid_invoice_totals', $totals, $invoice); |
|
445 | 445 | |
446 | - wp_send_json_success( compact( 'totals' ) ); |
|
446 | + wp_send_json_success(compact('totals')); |
|
447 | 447 | } |
448 | 448 | |
449 | 449 | /** |
@@ -452,33 +452,33 @@ discard block |
||
452 | 452 | public static function get_invoice_items() { |
453 | 453 | |
454 | 454 | // Verify nonce. |
455 | - check_ajax_referer( 'wpinv-nonce' ); |
|
455 | + check_ajax_referer('wpinv-nonce'); |
|
456 | 456 | |
457 | - if ( ! wpinv_current_user_can_manage_invoicing() ) { |
|
457 | + if (!wpinv_current_user_can_manage_invoicing()) { |
|
458 | 458 | exit; |
459 | 459 | } |
460 | 460 | |
461 | 461 | // We need an invoice and items. |
462 | - if ( empty( $_POST['post_id'] ) ) { |
|
462 | + if (empty($_POST['post_id'])) { |
|
463 | 463 | exit; |
464 | 464 | } |
465 | 465 | |
466 | 466 | // Fetch the invoice. |
467 | - $invoice = new WPInv_Invoice( trim( $_POST['post_id'] ) ); |
|
467 | + $invoice = new WPInv_Invoice(trim($_POST['post_id'])); |
|
468 | 468 | |
469 | 469 | // Ensure it exists. |
470 | - if ( ! $invoice->get_id() ) { |
|
470 | + if (!$invoice->get_id()) { |
|
471 | 471 | exit; |
472 | 472 | } |
473 | 473 | |
474 | 474 | // Return an array of invoice items. |
475 | 475 | $items = array(); |
476 | 476 | |
477 | - foreach ( $invoice->get_items() as $item_id => $item ) { |
|
478 | - $items[ $item_id ] = $item->prepare_data_for_invoice_edit_ajax( $invoice->get_currency() ); |
|
477 | + foreach ($invoice->get_items() as $item_id => $item) { |
|
478 | + $items[$item_id] = $item->prepare_data_for_invoice_edit_ajax($invoice->get_currency()); |
|
479 | 479 | } |
480 | 480 | |
481 | - wp_send_json_success( compact( 'items' ) ); |
|
481 | + wp_send_json_success(compact('items')); |
|
482 | 482 | } |
483 | 483 | |
484 | 484 | /** |
@@ -487,50 +487,50 @@ discard block |
||
487 | 487 | public static function edit_invoice_item() { |
488 | 488 | |
489 | 489 | // Verify nonce. |
490 | - check_ajax_referer( 'wpinv-nonce' ); |
|
490 | + check_ajax_referer('wpinv-nonce'); |
|
491 | 491 | |
492 | - if ( ! wpinv_current_user_can_manage_invoicing() ) { |
|
492 | + if (!wpinv_current_user_can_manage_invoicing()) { |
|
493 | 493 | exit; |
494 | 494 | } |
495 | 495 | |
496 | 496 | // We need an invoice and item details. |
497 | - if ( empty( $_POST['post_id'] ) || empty( $_POST['data'] ) ) { |
|
497 | + if (empty($_POST['post_id']) || empty($_POST['data'])) { |
|
498 | 498 | exit; |
499 | 499 | } |
500 | 500 | |
501 | 501 | // Fetch the invoice. |
502 | - $invoice = new WPInv_Invoice( trim( $_POST['post_id'] ) ); |
|
502 | + $invoice = new WPInv_Invoice(trim($_POST['post_id'])); |
|
503 | 503 | |
504 | 504 | // Ensure it exists and its not been paid for. |
505 | - if ( ! $invoice->get_id() || $invoice->is_paid() || $invoice->is_refunded() ) { |
|
505 | + if (!$invoice->get_id() || $invoice->is_paid() || $invoice->is_refunded()) { |
|
506 | 506 | exit; |
507 | 507 | } |
508 | 508 | |
509 | 509 | // Format the data. |
510 | - $data = wp_list_pluck( $_POST['data'], 'value', 'field' ); |
|
510 | + $data = wp_list_pluck($_POST['data'], 'value', 'field'); |
|
511 | 511 | |
512 | 512 | // Ensure that we have an item id. |
513 | - if ( empty( $data['id'] ) ) { |
|
513 | + if (empty($data['id'])) { |
|
514 | 514 | exit; |
515 | 515 | } |
516 | 516 | |
517 | 517 | // Abort if the invoice does not have the specified item. |
518 | - $item = $invoice->get_item( (int) $data['id'] ); |
|
518 | + $item = $invoice->get_item((int) $data['id']); |
|
519 | 519 | |
520 | - if ( empty( $item ) ) { |
|
520 | + if (empty($item)) { |
|
521 | 521 | exit; |
522 | 522 | } |
523 | 523 | |
524 | 524 | // Update the item. |
525 | - $item->set_price( $data['price'] ); |
|
526 | - $item->set_name( $data['name'] ); |
|
527 | - $item->set_description( $data['description'] ); |
|
528 | - $item->set_quantity( $data['quantity'] ); |
|
525 | + $item->set_price($data['price']); |
|
526 | + $item->set_name($data['name']); |
|
527 | + $item->set_description($data['description']); |
|
528 | + $item->set_quantity($data['quantity']); |
|
529 | 529 | |
530 | 530 | // Add it to the invoice. |
531 | - $error = $invoice->add_item( $item ); |
|
531 | + $error = $invoice->add_item($item); |
|
532 | 532 | $alert = false; |
533 | - if ( is_wp_error( $error ) ) { |
|
533 | + if (is_wp_error($error)) { |
|
534 | 534 | $alert = $error->get_error_message(); |
535 | 535 | } |
536 | 536 | |
@@ -543,11 +543,11 @@ discard block |
||
543 | 543 | // Return an array of invoice items. |
544 | 544 | $items = array(); |
545 | 545 | |
546 | - foreach ( $invoice->get_items() as $item_id => $item ) { |
|
547 | - $items[ $item_id ] = $item->prepare_data_for_invoice_edit_ajax( $invoice->get_currency() ); |
|
546 | + foreach ($invoice->get_items() as $item_id => $item) { |
|
547 | + $items[$item_id] = $item->prepare_data_for_invoice_edit_ajax($invoice->get_currency()); |
|
548 | 548 | } |
549 | 549 | |
550 | - wp_send_json_success( compact( 'items', 'alert' ) ); |
|
550 | + wp_send_json_success(compact('items', 'alert')); |
|
551 | 551 | } |
552 | 552 | |
553 | 553 | /** |
@@ -556,33 +556,33 @@ discard block |
||
556 | 556 | public static function remove_invoice_item() { |
557 | 557 | |
558 | 558 | // Verify nonce. |
559 | - check_ajax_referer( 'wpinv-nonce' ); |
|
559 | + check_ajax_referer('wpinv-nonce'); |
|
560 | 560 | |
561 | - if ( ! wpinv_current_user_can_manage_invoicing() ) { |
|
561 | + if (!wpinv_current_user_can_manage_invoicing()) { |
|
562 | 562 | exit; |
563 | 563 | } |
564 | 564 | |
565 | 565 | // We need an invoice and an item. |
566 | - if ( empty( $_POST['post_id'] ) || empty( $_POST['item_id'] ) ) { |
|
566 | + if (empty($_POST['post_id']) || empty($_POST['item_id'])) { |
|
567 | 567 | exit; |
568 | 568 | } |
569 | 569 | |
570 | 570 | // Fetch the invoice. |
571 | - $invoice = new WPInv_Invoice( trim( $_POST['post_id'] ) ); |
|
571 | + $invoice = new WPInv_Invoice(trim($_POST['post_id'])); |
|
572 | 572 | |
573 | 573 | // Ensure it exists and its not been paid for. |
574 | - if ( ! $invoice->get_id() || $invoice->is_paid() || $invoice->is_refunded() ) { |
|
574 | + if (!$invoice->get_id() || $invoice->is_paid() || $invoice->is_refunded()) { |
|
575 | 575 | exit; |
576 | 576 | } |
577 | 577 | |
578 | 578 | // Abort if the invoice does not have the specified item. |
579 | - $item = $invoice->get_item( (int) $_POST['item_id'] ); |
|
579 | + $item = $invoice->get_item((int) $_POST['item_id']); |
|
580 | 580 | |
581 | - if ( empty( $item ) ) { |
|
581 | + if (empty($item)) { |
|
582 | 582 | exit; |
583 | 583 | } |
584 | 584 | |
585 | - $invoice->remove_item( (int) $_POST['item_id'] ); |
|
585 | + $invoice->remove_item((int) $_POST['item_id']); |
|
586 | 586 | |
587 | 587 | // Update totals. |
588 | 588 | $invoice->recalculate_total(); |
@@ -593,11 +593,11 @@ discard block |
||
593 | 593 | // Return an array of invoice items. |
594 | 594 | $items = array(); |
595 | 595 | |
596 | - foreach ( $invoice->get_items() as $item_id => $item ) { |
|
597 | - $items[ $item_id ] = $item->prepare_data_for_invoice_edit_ajax( $invoice->get_currency() ); |
|
596 | + foreach ($invoice->get_items() as $item_id => $item) { |
|
597 | + $items[$item_id] = $item->prepare_data_for_invoice_edit_ajax($invoice->get_currency()); |
|
598 | 598 | } |
599 | 599 | |
600 | - wp_send_json_success( compact( 'items' ) ); |
|
600 | + wp_send_json_success(compact('items')); |
|
601 | 601 | } |
602 | 602 | |
603 | 603 | /** |
@@ -606,39 +606,39 @@ discard block |
||
606 | 606 | public static function add_invoice_items() { |
607 | 607 | |
608 | 608 | // Verify nonce. |
609 | - check_ajax_referer( 'wpinv-nonce' ); |
|
609 | + check_ajax_referer('wpinv-nonce'); |
|
610 | 610 | |
611 | - if ( ! wpinv_current_user_can_manage_invoicing() ) { |
|
611 | + if (!wpinv_current_user_can_manage_invoicing()) { |
|
612 | 612 | exit; |
613 | 613 | } |
614 | 614 | |
615 | 615 | // We need an invoice and items. |
616 | - if ( empty( $_POST['post_id'] ) || empty( $_POST['items'] ) ) { |
|
616 | + if (empty($_POST['post_id']) || empty($_POST['items'])) { |
|
617 | 617 | exit; |
618 | 618 | } |
619 | 619 | |
620 | 620 | // Fetch the invoice. |
621 | - $invoice = new WPInv_Invoice( trim( $_POST['post_id'] ) ); |
|
621 | + $invoice = new WPInv_Invoice(trim($_POST['post_id'])); |
|
622 | 622 | $alert = false; |
623 | 623 | |
624 | 624 | // Ensure it exists and its not been paid for. |
625 | - if ( ! $invoice->get_id() || $invoice->is_paid() || $invoice->is_refunded() ) { |
|
625 | + if (!$invoice->get_id() || $invoice->is_paid() || $invoice->is_refunded()) { |
|
626 | 626 | exit; |
627 | 627 | } |
628 | 628 | |
629 | 629 | // Add the items. |
630 | - foreach ( $_POST['items'] as $data ) { |
|
630 | + foreach ($_POST['items'] as $data) { |
|
631 | 631 | |
632 | - $item = new GetPaid_Form_Item( $data[ 'id' ] ); |
|
632 | + $item = new GetPaid_Form_Item($data['id']); |
|
633 | 633 | |
634 | - if ( is_numeric( $data[ 'qty' ] ) && (int) $data[ 'qty' ] > 0 ) { |
|
635 | - $item->set_quantity( $data[ 'qty' ] ); |
|
634 | + if (is_numeric($data['qty']) && (int) $data['qty'] > 0) { |
|
635 | + $item->set_quantity($data['qty']); |
|
636 | 636 | } |
637 | 637 | |
638 | - if ( $item->get_id() > 0 ) { |
|
639 | - $error = $invoice->add_item( $item ); |
|
638 | + if ($item->get_id() > 0) { |
|
639 | + $error = $invoice->add_item($item); |
|
640 | 640 | |
641 | - if ( is_wp_error( $error ) ) { |
|
641 | + if (is_wp_error($error)) { |
|
642 | 642 | $alert = $error->get_error_message(); |
643 | 643 | } |
644 | 644 | |
@@ -653,11 +653,11 @@ discard block |
||
653 | 653 | // Return an array of invoice items. |
654 | 654 | $items = array(); |
655 | 655 | |
656 | - foreach ( $invoice->get_items() as $item_id => $item ) { |
|
657 | - $items[ $item_id ] = $item->prepare_data_for_invoice_edit_ajax( $invoice->get_currency() ); |
|
656 | + foreach ($invoice->get_items() as $item_id => $item) { |
|
657 | + $items[$item_id] = $item->prepare_data_for_invoice_edit_ajax($invoice->get_currency()); |
|
658 | 658 | } |
659 | 659 | |
660 | - wp_send_json_success( compact( 'items', 'alert' ) ); |
|
660 | + wp_send_json_success(compact('items', 'alert')); |
|
661 | 661 | } |
662 | 662 | |
663 | 663 | /** |
@@ -666,15 +666,15 @@ discard block |
||
666 | 666 | public static function get_invoicing_items() { |
667 | 667 | |
668 | 668 | // Verify nonce. |
669 | - check_ajax_referer( 'wpinv-nonce' ); |
|
669 | + check_ajax_referer('wpinv-nonce'); |
|
670 | 670 | |
671 | - if ( ! wpinv_current_user_can_manage_invoicing() ) { |
|
671 | + if (!wpinv_current_user_can_manage_invoicing()) { |
|
672 | 672 | exit; |
673 | 673 | } |
674 | 674 | |
675 | 675 | // We need a search term. |
676 | - if ( empty( $_GET['search'] ) ) { |
|
677 | - wp_send_json_success( array() ); |
|
676 | + if (empty($_GET['search'])) { |
|
677 | + wp_send_json_success(array()); |
|
678 | 678 | } |
679 | 679 | |
680 | 680 | // Retrieve items. |
@@ -683,8 +683,8 @@ discard block |
||
683 | 683 | 'orderby' => 'title', |
684 | 684 | 'order' => 'ASC', |
685 | 685 | 'posts_per_page' => -1, |
686 | - 'post_status' => array( 'publish' ), |
|
687 | - 's' => trim( $_GET['search'] ), |
|
686 | + 'post_status' => array('publish'), |
|
687 | + 's' => trim($_GET['search']), |
|
688 | 688 | 'meta_query' => array( |
689 | 689 | array( |
690 | 690 | 'key' => '_wpinv_type', |
@@ -694,22 +694,22 @@ discard block |
||
694 | 694 | ) |
695 | 695 | ); |
696 | 696 | |
697 | - $items = get_posts( apply_filters( 'getpaid_ajax_invoice_items_query_args', $item_args ) ); |
|
697 | + $items = get_posts(apply_filters('getpaid_ajax_invoice_items_query_args', $item_args)); |
|
698 | 698 | $data = array(); |
699 | 699 | |
700 | 700 | |
701 | - $is_payment_form = ( ! empty( $_GET['post_id'] ) && 'wpi_payment_form' == get_post_type( $_GET['post_id'] ) ); |
|
701 | + $is_payment_form = (!empty($_GET['post_id']) && 'wpi_payment_form' == get_post_type($_GET['post_id'])); |
|
702 | 702 | |
703 | - foreach ( $items as $item ) { |
|
704 | - $item = new GetPaid_Form_Item( $item ); |
|
703 | + foreach ($items as $item) { |
|
704 | + $item = new GetPaid_Form_Item($item); |
|
705 | 705 | $data[] = array( |
706 | 706 | 'id' => (int) $item->get_id(), |
707 | - 'text' => strip_tags( $item->get_name() ), |
|
707 | + 'text' => strip_tags($item->get_name()), |
|
708 | 708 | 'form_data' => $is_payment_form ? $item->prepare_data_for_use() : '', |
709 | 709 | ); |
710 | 710 | } |
711 | 711 | |
712 | - wp_send_json_success( $data ); |
|
712 | + wp_send_json_success($data); |
|
713 | 713 | |
714 | 714 | } |
715 | 715 | |
@@ -719,24 +719,24 @@ discard block |
||
719 | 719 | public static function get_aui_states_field() { |
720 | 720 | |
721 | 721 | // Verify nonce. |
722 | - check_ajax_referer( 'wpinv-nonce' ); |
|
722 | + check_ajax_referer('wpinv-nonce'); |
|
723 | 723 | |
724 | 724 | // We need a country. |
725 | - if ( empty( $_GET['country'] ) ) { |
|
725 | + if (empty($_GET['country'])) { |
|
726 | 726 | exit; |
727 | 727 | } |
728 | 728 | |
729 | - $states = wpinv_get_country_states( trim( $_GET['country'] ) ); |
|
730 | - $state = isset( $_GET['state'] ) ? trim( $_GET['state'] ) : wpinv_get_default_state(); |
|
729 | + $states = wpinv_get_country_states(trim($_GET['country'])); |
|
730 | + $state = isset($_GET['state']) ? trim($_GET['state']) : wpinv_get_default_state(); |
|
731 | 731 | |
732 | - if ( empty( $states ) ) { |
|
732 | + if (empty($states)) { |
|
733 | 733 | |
734 | 734 | $html = aui()->input( |
735 | 735 | array( |
736 | 736 | 'type' => 'text', |
737 | 737 | 'id' => 'wpinv_state', |
738 | 738 | 'name' => 'wpinv_state', |
739 | - 'label' => __( 'State', 'invoicing' ), |
|
739 | + 'label' => __('State', 'invoicing'), |
|
740 | 740 | 'label_type' => 'vertical', |
741 | 741 | 'placeholder' => 'Liège', |
742 | 742 | 'class' => 'form-control-sm', |
@@ -750,9 +750,9 @@ discard block |
||
750 | 750 | array( |
751 | 751 | 'id' => 'wpinv_state', |
752 | 752 | 'name' => 'wpinv_state', |
753 | - 'label' => __( 'State', 'invoicing' ), |
|
753 | + 'label' => __('State', 'invoicing'), |
|
754 | 754 | 'label_type' => 'vertical', |
755 | - 'placeholder' => __( 'Select a state', 'invoicing' ), |
|
755 | + 'placeholder' => __('Select a state', 'invoicing'), |
|
756 | 756 | 'class' => 'form-control-sm', |
757 | 757 | 'value' => $state, |
758 | 758 | 'options' => $states, |
@@ -766,7 +766,7 @@ discard block |
||
766 | 766 | wp_send_json_success( |
767 | 767 | array( |
768 | 768 | 'html' => $html, |
769 | - 'select' => ! empty ( $states ) |
|
769 | + 'select' => !empty ($states) |
|
770 | 770 | ) |
771 | 771 | ); |
772 | 772 | |
@@ -780,46 +780,46 @@ discard block |
||
780 | 780 | public static function ip_geolocation() { |
781 | 781 | |
782 | 782 | // Check nonce. |
783 | - check_ajax_referer( 'getpaid-ip-location' ); |
|
783 | + check_ajax_referer('getpaid-ip-location'); |
|
784 | 784 | |
785 | 785 | // IP address. |
786 | - if ( empty( $_GET['ip'] ) || ! rest_is_ip_address( $_GET['ip'] ) ) { |
|
787 | - _e( 'Invalid IP Address.', 'invoicing' ); |
|
786 | + if (empty($_GET['ip']) || !rest_is_ip_address($_GET['ip'])) { |
|
787 | + _e('Invalid IP Address.', 'invoicing'); |
|
788 | 788 | exit; |
789 | 789 | } |
790 | 790 | |
791 | 791 | // Retrieve location info. |
792 | - $location = getpaid_geolocate_ip_address( $_GET['ip'] ); |
|
792 | + $location = getpaid_geolocate_ip_address($_GET['ip']); |
|
793 | 793 | |
794 | - if ( empty( $location ) ) { |
|
795 | - _e( 'Unable to find geolocation for the IP Address.', 'invoicing' ); |
|
794 | + if (empty($location)) { |
|
795 | + _e('Unable to find geolocation for the IP Address.', 'invoicing'); |
|
796 | 796 | exit; |
797 | 797 | } |
798 | 798 | |
799 | 799 | // Sorry. |
800 | - extract( $location ); |
|
800 | + extract($location); |
|
801 | 801 | |
802 | 802 | // Prepare the address. |
803 | 803 | $content = ''; |
804 | 804 | |
805 | - if ( ! empty( $location['city'] ) ) { |
|
806 | - $content .= $location['city'] . ', '; |
|
805 | + if (!empty($location['city'])) { |
|
806 | + $content .= $location['city'] . ', '; |
|
807 | 807 | } |
808 | 808 | |
809 | - if ( ! empty( $location['region'] ) ) { |
|
810 | - $content .= $location['region'] . ', '; |
|
809 | + if (!empty($location['region'])) { |
|
810 | + $content .= $location['region'] . ', '; |
|
811 | 811 | } |
812 | 812 | |
813 | - $content .= $location['country'] . ' (' . $location['iso'] . ')'; |
|
813 | + $content .= $location['country'] . ' (' . $location['iso'] . ')'; |
|
814 | 814 | |
815 | 815 | $location['address'] = $content; |
816 | 816 | |
817 | - $content = '<p>'. sprintf( __( '<b>Address:</b> %s', 'invoicing' ), $content ) . '</p>'; |
|
818 | - $content .= '<p>'. $location['credit'] . '</p>'; |
|
817 | + $content = '<p>' . sprintf(__('<b>Address:</b> %s', 'invoicing'), $content) . '</p>'; |
|
818 | + $content .= '<p>' . $location['credit'] . '</p>'; |
|
819 | 819 | |
820 | 820 | $location['content'] = $content; |
821 | 821 | |
822 | - wpinv_get_template( 'geolocation.php', $location ); |
|
822 | + wpinv_get_template('geolocation.php', $location); |
|
823 | 823 | |
824 | 824 | exit; |
825 | 825 | } |
@@ -832,11 +832,11 @@ discard block |
||
832 | 832 | public static function payment_form_refresh_prices() { |
833 | 833 | |
834 | 834 | // Check nonce. |
835 | - check_ajax_referer( 'getpaid_form_nonce' ); |
|
835 | + check_ajax_referer('getpaid_form_nonce'); |
|
836 | 836 | |
837 | 837 | // ... form fields... |
838 | - if ( empty( $_POST['getpaid_payment_form_submission'] ) ) { |
|
839 | - _e( 'Error: Reload the page and try again.', 'invoicing' ); |
|
838 | + if (empty($_POST['getpaid_payment_form_submission'])) { |
|
839 | + _e('Error: Reload the page and try again.', 'invoicing'); |
|
840 | 840 | exit; |
841 | 841 | } |
842 | 842 | |
@@ -844,18 +844,18 @@ discard block |
||
844 | 844 | $submission = new GetPaid_Payment_Form_Submission(); |
845 | 845 | |
846 | 846 | // Do we have an error? |
847 | - if ( ! empty( $submission->last_error ) ) { |
|
847 | + if (!empty($submission->last_error)) { |
|
848 | 848 | echo $submission->last_error; |
849 | 849 | exit; |
850 | 850 | } |
851 | 851 | |
852 | 852 | // Prepare the response. |
853 | - $response = new GetPaid_Payment_Form_Submission_Refresh_Prices( $submission ); |
|
853 | + $response = new GetPaid_Payment_Form_Submission_Refresh_Prices($submission); |
|
854 | 854 | |
855 | 855 | // Filter the response. |
856 | - $response = apply_filters( 'getpaid_payment_form_ajax_refresh_prices', $response->response, $submission ); |
|
856 | + $response = apply_filters('getpaid_payment_form_ajax_refresh_prices', $response->response, $submission); |
|
857 | 857 | |
858 | - wp_send_json_success( $response ); |
|
858 | + wp_send_json_success($response); |
|
859 | 859 | } |
860 | 860 | |
861 | 861 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if ( ! defined( 'ABSPATH' ) ) { |
3 | - exit; |
|
3 | + exit; |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | /** |
@@ -10,60 +10,60 @@ discard block |
||
10 | 10 | class GetPaid_Form_Item extends WPInv_Item { |
11 | 11 | |
12 | 12 | /** |
13 | - * Stores a custom description for the item. |
|
14 | - * |
|
15 | - * @var string |
|
16 | - */ |
|
17 | - protected $custom_description = null; |
|
18 | - |
|
19 | - /** |
|
20 | - * Stores the item quantity. |
|
21 | - * |
|
22 | - * @var int |
|
23 | - */ |
|
24 | - protected $quantity = 1; |
|
25 | - |
|
26 | - /** |
|
27 | - * Stores the item meta. |
|
28 | - * |
|
29 | - * @var array |
|
30 | - */ |
|
31 | - protected $meta = array(); |
|
32 | - |
|
33 | - /** |
|
34 | - * Is this item required? |
|
35 | - * |
|
36 | - * @var int |
|
37 | - */ |
|
38 | - protected $is_required = true; |
|
39 | - |
|
40 | - /** |
|
41 | - * Are quantities allowed? |
|
42 | - * |
|
43 | - * @var int |
|
44 | - */ |
|
45 | - protected $allow_quantities = false; |
|
46 | - |
|
47 | - /** |
|
48 | - * Associated invoice. |
|
49 | - * |
|
50 | - * @var int |
|
51 | - */ |
|
52 | - public $invoice_id = 0; |
|
53 | - |
|
54 | - /** |
|
55 | - * Item discount. |
|
56 | - * |
|
57 | - * @var float |
|
58 | - */ |
|
59 | - public $item_discount = 0; |
|
60 | - |
|
61 | - /** |
|
62 | - * Item tax. |
|
63 | - * |
|
64 | - * @var float |
|
65 | - */ |
|
66 | - public $item_tax = 0; |
|
13 | + * Stores a custom description for the item. |
|
14 | + * |
|
15 | + * @var string |
|
16 | + */ |
|
17 | + protected $custom_description = null; |
|
18 | + |
|
19 | + /** |
|
20 | + * Stores the item quantity. |
|
21 | + * |
|
22 | + * @var int |
|
23 | + */ |
|
24 | + protected $quantity = 1; |
|
25 | + |
|
26 | + /** |
|
27 | + * Stores the item meta. |
|
28 | + * |
|
29 | + * @var array |
|
30 | + */ |
|
31 | + protected $meta = array(); |
|
32 | + |
|
33 | + /** |
|
34 | + * Is this item required? |
|
35 | + * |
|
36 | + * @var int |
|
37 | + */ |
|
38 | + protected $is_required = true; |
|
39 | + |
|
40 | + /** |
|
41 | + * Are quantities allowed? |
|
42 | + * |
|
43 | + * @var int |
|
44 | + */ |
|
45 | + protected $allow_quantities = false; |
|
46 | + |
|
47 | + /** |
|
48 | + * Associated invoice. |
|
49 | + * |
|
50 | + * @var int |
|
51 | + */ |
|
52 | + public $invoice_id = 0; |
|
53 | + |
|
54 | + /** |
|
55 | + * Item discount. |
|
56 | + * |
|
57 | + * @var float |
|
58 | + */ |
|
59 | + public $item_discount = 0; |
|
60 | + |
|
61 | + /** |
|
62 | + * Item tax. |
|
63 | + * |
|
64 | + * @var float |
|
65 | + */ |
|
66 | + public $item_tax = 0; |
|
67 | 67 | |
68 | 68 | /* |
69 | 69 | |-------------------------------------------------------------------------- |
@@ -81,226 +81,226 @@ discard block |
||
81 | 81 | */ |
82 | 82 | |
83 | 83 | /** |
84 | - * Get the item name. |
|
85 | - * |
|
86 | - * @since 1.0.19 |
|
87 | - * @param string $context View or edit context. |
|
88 | - * @return string |
|
89 | - */ |
|
90 | - public function get_name( $context = 'view' ) { |
|
91 | - $name = parent::get_name( $context ); |
|
92 | - return $name . wpinv_get_item_suffix( $this ); |
|
93 | - } |
|
94 | - |
|
95 | - /** |
|
96 | - * Get the item name without a suffix. |
|
97 | - * |
|
98 | - * @since 1.0.19 |
|
99 | - * @param string $context View or edit context. |
|
100 | - * @return string |
|
101 | - */ |
|
102 | - public function get_raw_name( $context = 'view' ) { |
|
103 | - return parent::get_name( $context ); |
|
104 | - } |
|
105 | - |
|
106 | - /** |
|
107 | - * Get the item description. |
|
108 | - * |
|
109 | - * @since 1.0.19 |
|
110 | - * @param string $context View or edit context. |
|
111 | - * @return string |
|
112 | - */ |
|
113 | - public function get_description( $context = 'view' ) { |
|
114 | - |
|
115 | - if ( isset( $this->custom_description ) ) { |
|
116 | - return $this->custom_description; |
|
117 | - } |
|
118 | - |
|
119 | - return parent::get_description( $context ); |
|
120 | - } |
|
121 | - |
|
122 | - /** |
|
123 | - * Returns the sub total. |
|
124 | - * |
|
125 | - * @since 1.0.19 |
|
126 | - * @param string $context View or edit context. |
|
127 | - * @return int |
|
128 | - */ |
|
129 | - public function get_sub_total( $context = 'view' ) { |
|
130 | - return $this->get_quantity( $context ) * $this->get_initial_price( $context ); |
|
131 | - } |
|
132 | - |
|
133 | - /** |
|
134 | - * Returns the recurring sub total. |
|
135 | - * |
|
136 | - * @since 1.0.19 |
|
137 | - * @param string $context View or edit context. |
|
138 | - * @return int |
|
139 | - */ |
|
140 | - public function get_recurring_sub_total( $context = 'view' ) { |
|
141 | - return $this->get_quantity( $context ) * $this->get_price( $context ); |
|
142 | - } |
|
143 | - |
|
144 | - /** |
|
145 | - * @deprecated |
|
146 | - */ |
|
147 | - public function get_qantity( $context = 'view' ) { |
|
148 | - return $this->get_quantity( $context ); |
|
149 | - } |
|
150 | - |
|
151 | - /** |
|
152 | - * Get the item quantity. |
|
153 | - * |
|
154 | - * @since 1.0.19 |
|
155 | - * @param string $context View or edit context. |
|
156 | - * @return int |
|
157 | - */ |
|
158 | - public function get_quantity( $context = 'view' ) { |
|
159 | - $quantity = (int) $this->quantity; |
|
160 | - |
|
161 | - if ( empty( $quantity ) || 1 > $quantity ) { |
|
162 | - $quantity = 1; |
|
163 | - } |
|
164 | - |
|
165 | - if ( 'view' == $context ) { |
|
166 | - return apply_filters( 'getpaid_payment_form_item_quantity', $quantity, $this ); |
|
167 | - } |
|
168 | - |
|
169 | - return $quantity; |
|
170 | - |
|
171 | - } |
|
172 | - |
|
173 | - /** |
|
174 | - * Get the item meta data. |
|
175 | - * |
|
176 | - * @since 1.0.19 |
|
177 | - * @param string $context View or edit context. |
|
178 | - * @return meta |
|
179 | - */ |
|
180 | - public function get_item_meta( $context = 'view' ) { |
|
181 | - $meta = $this->meta; |
|
182 | - |
|
183 | - if ( 'view' == $context ) { |
|
184 | - return apply_filters( 'getpaid_payment_form_item_meta', $meta, $this ); |
|
185 | - } |
|
186 | - |
|
187 | - return $meta; |
|
188 | - |
|
189 | - } |
|
190 | - |
|
191 | - /** |
|
192 | - * Returns whether or not customers can update the item quantity. |
|
193 | - * |
|
194 | - * @since 1.0.19 |
|
195 | - * @param string $context View or edit context. |
|
196 | - * @return bool |
|
197 | - */ |
|
198 | - public function get_allow_quantities( $context = 'view' ) { |
|
199 | - $allow_quantities = (bool) $this->allow_quantities; |
|
200 | - |
|
201 | - if ( 'view' == $context ) { |
|
202 | - return apply_filters( 'getpaid_payment_form_item_allow_quantities', $allow_quantities, $this ); |
|
203 | - } |
|
204 | - |
|
205 | - return $allow_quantities; |
|
206 | - |
|
207 | - } |
|
208 | - |
|
209 | - /** |
|
210 | - * Returns whether or not the item is required. |
|
211 | - * |
|
212 | - * @since 1.0.19 |
|
213 | - * @param string $context View or edit context. |
|
214 | - * @return bool |
|
215 | - */ |
|
216 | - public function get_is_required( $context = 'view' ) { |
|
217 | - $is_required = (bool) $this->is_required; |
|
218 | - |
|
219 | - if ( 'view' == $context ) { |
|
220 | - return apply_filters( 'getpaid_payment_form_item_is_required', $is_required, $this ); |
|
221 | - } |
|
222 | - |
|
223 | - return $is_required; |
|
224 | - |
|
225 | - } |
|
226 | - |
|
227 | - /** |
|
228 | - * Prepares form data for use. |
|
229 | - * |
|
230 | - * @since 1.0.19 |
|
231 | - * @return array |
|
232 | - */ |
|
233 | - public function prepare_data_for_use() { |
|
234 | - |
|
235 | - return array( |
|
236 | - 'title' => strip_tags( $this->get_name() ), |
|
237 | - 'id' => $this->get_id(), |
|
238 | - 'price' => $this->get_price(), |
|
239 | - 'recurring' => $this->is_recurring(), |
|
240 | - 'description' => $this->get_description(), |
|
241 | - 'allow_quantities' => $this->allows_quantities(), |
|
242 | - 'required' => $this->is_required(), |
|
243 | - ); |
|
244 | - |
|
245 | - } |
|
246 | - |
|
247 | - /** |
|
248 | - * Prepares form data for ajax use. |
|
249 | - * |
|
250 | - * @since 1.0.19 |
|
251 | - * @return array |
|
252 | - */ |
|
253 | - public function prepare_data_for_invoice_edit_ajax( $currency = '' ) { |
|
254 | - |
|
255 | - $description = getpaid_item_recurring_price_help_text( $this, $currency ); |
|
256 | - |
|
257 | - if ( $description ) { |
|
258 | - $description = "<div class='getpaid-subscription-help-text'>$description</div>"; |
|
259 | - } |
|
260 | - |
|
261 | - return array( |
|
262 | - 'id' => $this->get_id(), |
|
263 | - 'texts' => array( |
|
264 | - 'item-name' => sanitize_text_field( $this->get_name() ), |
|
265 | - 'item-description' => wp_kses_post( $this->get_description() ) . $description, |
|
266 | - 'item-quantity' => absint( $this->get_quantity() ), |
|
267 | - 'item-price' => wpinv_price( wpinv_format_amount ( $this->get_price() ), $currency ), |
|
268 | - 'item-total' => wpinv_price( wpinv_format_amount( $this->get_sub_total() ), $currency ), |
|
269 | - ), |
|
270 | - 'inputs' => array( |
|
271 | - 'item-id' => $this->get_id(), |
|
272 | - 'item-name' => sanitize_text_field( $this->get_name() ), |
|
273 | - 'item-description' => wp_kses_post( $this->get_description() ), |
|
274 | - 'item-quantity' => absint( $this->get_quantity() ), |
|
275 | - 'item-price' => $this->get_price(), |
|
276 | - ) |
|
277 | - ); |
|
278 | - |
|
279 | - } |
|
280 | - |
|
281 | - /** |
|
282 | - * Prepares form data for saving (cart_details). |
|
283 | - * |
|
284 | - * @since 1.0.19 |
|
285 | - * @return array |
|
286 | - */ |
|
287 | - public function prepare_data_for_saving() { |
|
288 | - |
|
289 | - return array( |
|
290 | - 'post_id' => $this->invoice_id, |
|
291 | - 'item_id' => $this->get_id(), |
|
292 | - 'item_name' => sanitize_text_field( $this->get_raw_name() ), |
|
293 | - 'item_description' => $this->get_description(), |
|
294 | - 'tax' => $this->item_tax, |
|
295 | - 'item_price' => $this->get_price(), |
|
296 | - 'quantity' => (int) $this->get_quantity(), |
|
297 | - 'discount' => $this->item_discount, |
|
298 | - 'subtotal' => $this->get_sub_total(), |
|
299 | - 'price' => $this->get_sub_total() + $this->item_tax + $this->item_discount, |
|
300 | - 'meta' => $this->get_item_meta(), |
|
301 | - ); |
|
302 | - |
|
303 | - } |
|
84 | + * Get the item name. |
|
85 | + * |
|
86 | + * @since 1.0.19 |
|
87 | + * @param string $context View or edit context. |
|
88 | + * @return string |
|
89 | + */ |
|
90 | + public function get_name( $context = 'view' ) { |
|
91 | + $name = parent::get_name( $context ); |
|
92 | + return $name . wpinv_get_item_suffix( $this ); |
|
93 | + } |
|
94 | + |
|
95 | + /** |
|
96 | + * Get the item name without a suffix. |
|
97 | + * |
|
98 | + * @since 1.0.19 |
|
99 | + * @param string $context View or edit context. |
|
100 | + * @return string |
|
101 | + */ |
|
102 | + public function get_raw_name( $context = 'view' ) { |
|
103 | + return parent::get_name( $context ); |
|
104 | + } |
|
105 | + |
|
106 | + /** |
|
107 | + * Get the item description. |
|
108 | + * |
|
109 | + * @since 1.0.19 |
|
110 | + * @param string $context View or edit context. |
|
111 | + * @return string |
|
112 | + */ |
|
113 | + public function get_description( $context = 'view' ) { |
|
114 | + |
|
115 | + if ( isset( $this->custom_description ) ) { |
|
116 | + return $this->custom_description; |
|
117 | + } |
|
118 | + |
|
119 | + return parent::get_description( $context ); |
|
120 | + } |
|
121 | + |
|
122 | + /** |
|
123 | + * Returns the sub total. |
|
124 | + * |
|
125 | + * @since 1.0.19 |
|
126 | + * @param string $context View or edit context. |
|
127 | + * @return int |
|
128 | + */ |
|
129 | + public function get_sub_total( $context = 'view' ) { |
|
130 | + return $this->get_quantity( $context ) * $this->get_initial_price( $context ); |
|
131 | + } |
|
132 | + |
|
133 | + /** |
|
134 | + * Returns the recurring sub total. |
|
135 | + * |
|
136 | + * @since 1.0.19 |
|
137 | + * @param string $context View or edit context. |
|
138 | + * @return int |
|
139 | + */ |
|
140 | + public function get_recurring_sub_total( $context = 'view' ) { |
|
141 | + return $this->get_quantity( $context ) * $this->get_price( $context ); |
|
142 | + } |
|
143 | + |
|
144 | + /** |
|
145 | + * @deprecated |
|
146 | + */ |
|
147 | + public function get_qantity( $context = 'view' ) { |
|
148 | + return $this->get_quantity( $context ); |
|
149 | + } |
|
150 | + |
|
151 | + /** |
|
152 | + * Get the item quantity. |
|
153 | + * |
|
154 | + * @since 1.0.19 |
|
155 | + * @param string $context View or edit context. |
|
156 | + * @return int |
|
157 | + */ |
|
158 | + public function get_quantity( $context = 'view' ) { |
|
159 | + $quantity = (int) $this->quantity; |
|
160 | + |
|
161 | + if ( empty( $quantity ) || 1 > $quantity ) { |
|
162 | + $quantity = 1; |
|
163 | + } |
|
164 | + |
|
165 | + if ( 'view' == $context ) { |
|
166 | + return apply_filters( 'getpaid_payment_form_item_quantity', $quantity, $this ); |
|
167 | + } |
|
168 | + |
|
169 | + return $quantity; |
|
170 | + |
|
171 | + } |
|
172 | + |
|
173 | + /** |
|
174 | + * Get the item meta data. |
|
175 | + * |
|
176 | + * @since 1.0.19 |
|
177 | + * @param string $context View or edit context. |
|
178 | + * @return meta |
|
179 | + */ |
|
180 | + public function get_item_meta( $context = 'view' ) { |
|
181 | + $meta = $this->meta; |
|
182 | + |
|
183 | + if ( 'view' == $context ) { |
|
184 | + return apply_filters( 'getpaid_payment_form_item_meta', $meta, $this ); |
|
185 | + } |
|
186 | + |
|
187 | + return $meta; |
|
188 | + |
|
189 | + } |
|
190 | + |
|
191 | + /** |
|
192 | + * Returns whether or not customers can update the item quantity. |
|
193 | + * |
|
194 | + * @since 1.0.19 |
|
195 | + * @param string $context View or edit context. |
|
196 | + * @return bool |
|
197 | + */ |
|
198 | + public function get_allow_quantities( $context = 'view' ) { |
|
199 | + $allow_quantities = (bool) $this->allow_quantities; |
|
200 | + |
|
201 | + if ( 'view' == $context ) { |
|
202 | + return apply_filters( 'getpaid_payment_form_item_allow_quantities', $allow_quantities, $this ); |
|
203 | + } |
|
204 | + |
|
205 | + return $allow_quantities; |
|
206 | + |
|
207 | + } |
|
208 | + |
|
209 | + /** |
|
210 | + * Returns whether or not the item is required. |
|
211 | + * |
|
212 | + * @since 1.0.19 |
|
213 | + * @param string $context View or edit context. |
|
214 | + * @return bool |
|
215 | + */ |
|
216 | + public function get_is_required( $context = 'view' ) { |
|
217 | + $is_required = (bool) $this->is_required; |
|
218 | + |
|
219 | + if ( 'view' == $context ) { |
|
220 | + return apply_filters( 'getpaid_payment_form_item_is_required', $is_required, $this ); |
|
221 | + } |
|
222 | + |
|
223 | + return $is_required; |
|
224 | + |
|
225 | + } |
|
226 | + |
|
227 | + /** |
|
228 | + * Prepares form data for use. |
|
229 | + * |
|
230 | + * @since 1.0.19 |
|
231 | + * @return array |
|
232 | + */ |
|
233 | + public function prepare_data_for_use() { |
|
234 | + |
|
235 | + return array( |
|
236 | + 'title' => strip_tags( $this->get_name() ), |
|
237 | + 'id' => $this->get_id(), |
|
238 | + 'price' => $this->get_price(), |
|
239 | + 'recurring' => $this->is_recurring(), |
|
240 | + 'description' => $this->get_description(), |
|
241 | + 'allow_quantities' => $this->allows_quantities(), |
|
242 | + 'required' => $this->is_required(), |
|
243 | + ); |
|
244 | + |
|
245 | + } |
|
246 | + |
|
247 | + /** |
|
248 | + * Prepares form data for ajax use. |
|
249 | + * |
|
250 | + * @since 1.0.19 |
|
251 | + * @return array |
|
252 | + */ |
|
253 | + public function prepare_data_for_invoice_edit_ajax( $currency = '' ) { |
|
254 | + |
|
255 | + $description = getpaid_item_recurring_price_help_text( $this, $currency ); |
|
256 | + |
|
257 | + if ( $description ) { |
|
258 | + $description = "<div class='getpaid-subscription-help-text'>$description</div>"; |
|
259 | + } |
|
260 | + |
|
261 | + return array( |
|
262 | + 'id' => $this->get_id(), |
|
263 | + 'texts' => array( |
|
264 | + 'item-name' => sanitize_text_field( $this->get_name() ), |
|
265 | + 'item-description' => wp_kses_post( $this->get_description() ) . $description, |
|
266 | + 'item-quantity' => absint( $this->get_quantity() ), |
|
267 | + 'item-price' => wpinv_price( wpinv_format_amount ( $this->get_price() ), $currency ), |
|
268 | + 'item-total' => wpinv_price( wpinv_format_amount( $this->get_sub_total() ), $currency ), |
|
269 | + ), |
|
270 | + 'inputs' => array( |
|
271 | + 'item-id' => $this->get_id(), |
|
272 | + 'item-name' => sanitize_text_field( $this->get_name() ), |
|
273 | + 'item-description' => wp_kses_post( $this->get_description() ), |
|
274 | + 'item-quantity' => absint( $this->get_quantity() ), |
|
275 | + 'item-price' => $this->get_price(), |
|
276 | + ) |
|
277 | + ); |
|
278 | + |
|
279 | + } |
|
280 | + |
|
281 | + /** |
|
282 | + * Prepares form data for saving (cart_details). |
|
283 | + * |
|
284 | + * @since 1.0.19 |
|
285 | + * @return array |
|
286 | + */ |
|
287 | + public function prepare_data_for_saving() { |
|
288 | + |
|
289 | + return array( |
|
290 | + 'post_id' => $this->invoice_id, |
|
291 | + 'item_id' => $this->get_id(), |
|
292 | + 'item_name' => sanitize_text_field( $this->get_raw_name() ), |
|
293 | + 'item_description' => $this->get_description(), |
|
294 | + 'tax' => $this->item_tax, |
|
295 | + 'item_price' => $this->get_price(), |
|
296 | + 'quantity' => (int) $this->get_quantity(), |
|
297 | + 'discount' => $this->item_discount, |
|
298 | + 'subtotal' => $this->get_sub_total(), |
|
299 | + 'price' => $this->get_sub_total() + $this->item_tax + $this->item_discount, |
|
300 | + 'meta' => $this->get_item_meta(), |
|
301 | + ); |
|
302 | + |
|
303 | + } |
|
304 | 304 | |
305 | 305 | /* |
306 | 306 | |-------------------------------------------------------------------------- |
@@ -312,70 +312,70 @@ discard block |
||
312 | 312 | | object. |
313 | 313 | */ |
314 | 314 | |
315 | - /** |
|
316 | - * Set the item qantity. |
|
317 | - * |
|
318 | - * @since 1.0.19 |
|
319 | - * @param int $quantity The item quantity. |
|
320 | - */ |
|
321 | - public function set_quantity( $quantity ) { |
|
322 | - |
|
323 | - if ( empty( $quantity ) || ! is_numeric( $quantity ) ) { |
|
324 | - $quantity = 1; |
|
325 | - } |
|
326 | - |
|
327 | - $this->quantity = (int) $quantity; |
|
328 | - |
|
329 | - } |
|
330 | - |
|
331 | - /** |
|
332 | - * Set the item meta data. |
|
333 | - * |
|
334 | - * @since 1.0.19 |
|
335 | - * @param array $meta The item meta data. |
|
336 | - */ |
|
337 | - public function set_item_meta( $meta ) { |
|
338 | - $this->meta = maybe_unserialize( $meta ); |
|
339 | - } |
|
340 | - |
|
341 | - /** |
|
342 | - * Set whether or not the quantities are allowed. |
|
343 | - * |
|
344 | - * @since 1.0.19 |
|
345 | - * @param bool $allow_quantities |
|
346 | - */ |
|
347 | - public function set_allow_quantities( $allow_quantities ) { |
|
348 | - $this->allow_quantities = (bool) $allow_quantities; |
|
349 | - } |
|
350 | - |
|
351 | - /** |
|
352 | - * Set whether or not the item is required. |
|
353 | - * |
|
354 | - * @since 1.0.19 |
|
355 | - * @param bool $is_required |
|
356 | - */ |
|
357 | - public function set_is_required( $is_required ) { |
|
358 | - $this->is_required = (bool) $is_required; |
|
359 | - } |
|
360 | - |
|
361 | - /** |
|
362 | - * Sets the custom item description. |
|
363 | - * |
|
364 | - * @since 1.0.19 |
|
365 | - * @param string $description |
|
366 | - */ |
|
367 | - public function set_custom_description( $description ) { |
|
368 | - $this->custom_description = $description; |
|
369 | - } |
|
315 | + /** |
|
316 | + * Set the item qantity. |
|
317 | + * |
|
318 | + * @since 1.0.19 |
|
319 | + * @param int $quantity The item quantity. |
|
320 | + */ |
|
321 | + public function set_quantity( $quantity ) { |
|
322 | + |
|
323 | + if ( empty( $quantity ) || ! is_numeric( $quantity ) ) { |
|
324 | + $quantity = 1; |
|
325 | + } |
|
326 | + |
|
327 | + $this->quantity = (int) $quantity; |
|
328 | + |
|
329 | + } |
|
330 | + |
|
331 | + /** |
|
332 | + * Set the item meta data. |
|
333 | + * |
|
334 | + * @since 1.0.19 |
|
335 | + * @param array $meta The item meta data. |
|
336 | + */ |
|
337 | + public function set_item_meta( $meta ) { |
|
338 | + $this->meta = maybe_unserialize( $meta ); |
|
339 | + } |
|
340 | + |
|
341 | + /** |
|
342 | + * Set whether or not the quantities are allowed. |
|
343 | + * |
|
344 | + * @since 1.0.19 |
|
345 | + * @param bool $allow_quantities |
|
346 | + */ |
|
347 | + public function set_allow_quantities( $allow_quantities ) { |
|
348 | + $this->allow_quantities = (bool) $allow_quantities; |
|
349 | + } |
|
350 | + |
|
351 | + /** |
|
352 | + * Set whether or not the item is required. |
|
353 | + * |
|
354 | + * @since 1.0.19 |
|
355 | + * @param bool $is_required |
|
356 | + */ |
|
357 | + public function set_is_required( $is_required ) { |
|
358 | + $this->is_required = (bool) $is_required; |
|
359 | + } |
|
360 | + |
|
361 | + /** |
|
362 | + * Sets the custom item description. |
|
363 | + * |
|
364 | + * @since 1.0.19 |
|
365 | + * @param string $description |
|
366 | + */ |
|
367 | + public function set_custom_description( $description ) { |
|
368 | + $this->custom_description = $description; |
|
369 | + } |
|
370 | 370 | |
371 | 371 | /** |
372 | 372 | * We do not want to save items to the database. |
373 | 373 | * |
374 | - * @return int item id |
|
374 | + * @return int item id |
|
375 | 375 | */ |
376 | 376 | public function save( $data = array() ) { |
377 | 377 | return $this->get_id(); |
378 | - } |
|
378 | + } |
|
379 | 379 | |
380 | 380 | /* |
381 | 381 | |-------------------------------------------------------------------------- |
@@ -387,23 +387,23 @@ discard block |
||
387 | 387 | */ |
388 | 388 | |
389 | 389 | /** |
390 | - * Checks whether the item has enabled dynamic pricing. |
|
391 | - * |
|
392 | - * @since 1.0.19 |
|
393 | - * @return bool |
|
394 | - */ |
|
395 | - public function is_required() { |
|
390 | + * Checks whether the item has enabled dynamic pricing. |
|
391 | + * |
|
392 | + * @since 1.0.19 |
|
393 | + * @return bool |
|
394 | + */ |
|
395 | + public function is_required() { |
|
396 | 396 | return (bool) $this->get_is_required(); |
397 | - } |
|
398 | - |
|
399 | - /** |
|
400 | - * Checks whether users can edit the quantities. |
|
401 | - * |
|
402 | - * @since 1.0.19 |
|
403 | - * @return bool |
|
404 | - */ |
|
405 | - public function allows_quantities() { |
|
397 | + } |
|
398 | + |
|
399 | + /** |
|
400 | + * Checks whether users can edit the quantities. |
|
401 | + * |
|
402 | + * @since 1.0.19 |
|
403 | + * @return bool |
|
404 | + */ |
|
405 | + public function allows_quantities() { |
|
406 | 406 | return (bool) $this->get_allow_quantities(); |
407 | - } |
|
407 | + } |
|
408 | 408 | |
409 | 409 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) { |
|
2 | +if (!defined('ABSPATH')) { |
|
3 | 3 | exit; |
4 | 4 | } |
5 | 5 | |
@@ -87,9 +87,9 @@ discard block |
||
87 | 87 | * @param string $context View or edit context. |
88 | 88 | * @return string |
89 | 89 | */ |
90 | - public function get_name( $context = 'view' ) { |
|
91 | - $name = parent::get_name( $context ); |
|
92 | - return $name . wpinv_get_item_suffix( $this ); |
|
90 | + public function get_name($context = 'view') { |
|
91 | + $name = parent::get_name($context); |
|
92 | + return $name . wpinv_get_item_suffix($this); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | /** |
@@ -99,8 +99,8 @@ discard block |
||
99 | 99 | * @param string $context View or edit context. |
100 | 100 | * @return string |
101 | 101 | */ |
102 | - public function get_raw_name( $context = 'view' ) { |
|
103 | - return parent::get_name( $context ); |
|
102 | + public function get_raw_name($context = 'view') { |
|
103 | + return parent::get_name($context); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | /** |
@@ -110,13 +110,13 @@ discard block |
||
110 | 110 | * @param string $context View or edit context. |
111 | 111 | * @return string |
112 | 112 | */ |
113 | - public function get_description( $context = 'view' ) { |
|
113 | + public function get_description($context = 'view') { |
|
114 | 114 | |
115 | - if ( isset( $this->custom_description ) ) { |
|
115 | + if (isset($this->custom_description)) { |
|
116 | 116 | return $this->custom_description; |
117 | 117 | } |
118 | 118 | |
119 | - return parent::get_description( $context ); |
|
119 | + return parent::get_description($context); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | /** |
@@ -126,8 +126,8 @@ discard block |
||
126 | 126 | * @param string $context View or edit context. |
127 | 127 | * @return int |
128 | 128 | */ |
129 | - public function get_sub_total( $context = 'view' ) { |
|
130 | - return $this->get_quantity( $context ) * $this->get_initial_price( $context ); |
|
129 | + public function get_sub_total($context = 'view') { |
|
130 | + return $this->get_quantity($context) * $this->get_initial_price($context); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | /** |
@@ -137,15 +137,15 @@ discard block |
||
137 | 137 | * @param string $context View or edit context. |
138 | 138 | * @return int |
139 | 139 | */ |
140 | - public function get_recurring_sub_total( $context = 'view' ) { |
|
141 | - return $this->get_quantity( $context ) * $this->get_price( $context ); |
|
140 | + public function get_recurring_sub_total($context = 'view') { |
|
141 | + return $this->get_quantity($context) * $this->get_price($context); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | /** |
145 | 145 | * @deprecated |
146 | 146 | */ |
147 | - public function get_qantity( $context = 'view' ) { |
|
148 | - return $this->get_quantity( $context ); |
|
147 | + public function get_qantity($context = 'view') { |
|
148 | + return $this->get_quantity($context); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | /** |
@@ -155,15 +155,15 @@ discard block |
||
155 | 155 | * @param string $context View or edit context. |
156 | 156 | * @return int |
157 | 157 | */ |
158 | - public function get_quantity( $context = 'view' ) { |
|
158 | + public function get_quantity($context = 'view') { |
|
159 | 159 | $quantity = (int) $this->quantity; |
160 | 160 | |
161 | - if ( empty( $quantity ) || 1 > $quantity ) { |
|
161 | + if (empty($quantity) || 1 > $quantity) { |
|
162 | 162 | $quantity = 1; |
163 | 163 | } |
164 | 164 | |
165 | - if ( 'view' == $context ) { |
|
166 | - return apply_filters( 'getpaid_payment_form_item_quantity', $quantity, $this ); |
|
165 | + if ('view' == $context) { |
|
166 | + return apply_filters('getpaid_payment_form_item_quantity', $quantity, $this); |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | return $quantity; |
@@ -177,11 +177,11 @@ discard block |
||
177 | 177 | * @param string $context View or edit context. |
178 | 178 | * @return meta |
179 | 179 | */ |
180 | - public function get_item_meta( $context = 'view' ) { |
|
180 | + public function get_item_meta($context = 'view') { |
|
181 | 181 | $meta = $this->meta; |
182 | 182 | |
183 | - if ( 'view' == $context ) { |
|
184 | - return apply_filters( 'getpaid_payment_form_item_meta', $meta, $this ); |
|
183 | + if ('view' == $context) { |
|
184 | + return apply_filters('getpaid_payment_form_item_meta', $meta, $this); |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | return $meta; |
@@ -195,11 +195,11 @@ discard block |
||
195 | 195 | * @param string $context View or edit context. |
196 | 196 | * @return bool |
197 | 197 | */ |
198 | - public function get_allow_quantities( $context = 'view' ) { |
|
198 | + public function get_allow_quantities($context = 'view') { |
|
199 | 199 | $allow_quantities = (bool) $this->allow_quantities; |
200 | 200 | |
201 | - if ( 'view' == $context ) { |
|
202 | - return apply_filters( 'getpaid_payment_form_item_allow_quantities', $allow_quantities, $this ); |
|
201 | + if ('view' == $context) { |
|
202 | + return apply_filters('getpaid_payment_form_item_allow_quantities', $allow_quantities, $this); |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | return $allow_quantities; |
@@ -213,11 +213,11 @@ discard block |
||
213 | 213 | * @param string $context View or edit context. |
214 | 214 | * @return bool |
215 | 215 | */ |
216 | - public function get_is_required( $context = 'view' ) { |
|
216 | + public function get_is_required($context = 'view') { |
|
217 | 217 | $is_required = (bool) $this->is_required; |
218 | 218 | |
219 | - if ( 'view' == $context ) { |
|
220 | - return apply_filters( 'getpaid_payment_form_item_is_required', $is_required, $this ); |
|
219 | + if ('view' == $context) { |
|
220 | + return apply_filters('getpaid_payment_form_item_is_required', $is_required, $this); |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | return $is_required; |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | public function prepare_data_for_use() { |
234 | 234 | |
235 | 235 | return array( |
236 | - 'title' => strip_tags( $this->get_name() ), |
|
236 | + 'title' => strip_tags($this->get_name()), |
|
237 | 237 | 'id' => $this->get_id(), |
238 | 238 | 'price' => $this->get_price(), |
239 | 239 | 'recurring' => $this->is_recurring(), |
@@ -250,28 +250,28 @@ discard block |
||
250 | 250 | * @since 1.0.19 |
251 | 251 | * @return array |
252 | 252 | */ |
253 | - public function prepare_data_for_invoice_edit_ajax( $currency = '' ) { |
|
253 | + public function prepare_data_for_invoice_edit_ajax($currency = '') { |
|
254 | 254 | |
255 | - $description = getpaid_item_recurring_price_help_text( $this, $currency ); |
|
255 | + $description = getpaid_item_recurring_price_help_text($this, $currency); |
|
256 | 256 | |
257 | - if ( $description ) { |
|
257 | + if ($description) { |
|
258 | 258 | $description = "<div class='getpaid-subscription-help-text'>$description</div>"; |
259 | 259 | } |
260 | 260 | |
261 | 261 | return array( |
262 | 262 | 'id' => $this->get_id(), |
263 | 263 | 'texts' => array( |
264 | - 'item-name' => sanitize_text_field( $this->get_name() ), |
|
265 | - 'item-description' => wp_kses_post( $this->get_description() ) . $description, |
|
266 | - 'item-quantity' => absint( $this->get_quantity() ), |
|
267 | - 'item-price' => wpinv_price( wpinv_format_amount ( $this->get_price() ), $currency ), |
|
268 | - 'item-total' => wpinv_price( wpinv_format_amount( $this->get_sub_total() ), $currency ), |
|
264 | + 'item-name' => sanitize_text_field($this->get_name()), |
|
265 | + 'item-description' => wp_kses_post($this->get_description()) . $description, |
|
266 | + 'item-quantity' => absint($this->get_quantity()), |
|
267 | + 'item-price' => wpinv_price(wpinv_format_amount($this->get_price()), $currency), |
|
268 | + 'item-total' => wpinv_price(wpinv_format_amount($this->get_sub_total()), $currency), |
|
269 | 269 | ), |
270 | 270 | 'inputs' => array( |
271 | 271 | 'item-id' => $this->get_id(), |
272 | - 'item-name' => sanitize_text_field( $this->get_name() ), |
|
273 | - 'item-description' => wp_kses_post( $this->get_description() ), |
|
274 | - 'item-quantity' => absint( $this->get_quantity() ), |
|
272 | + 'item-name' => sanitize_text_field($this->get_name()), |
|
273 | + 'item-description' => wp_kses_post($this->get_description()), |
|
274 | + 'item-quantity' => absint($this->get_quantity()), |
|
275 | 275 | 'item-price' => $this->get_price(), |
276 | 276 | ) |
277 | 277 | ); |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | return array( |
290 | 290 | 'post_id' => $this->invoice_id, |
291 | 291 | 'item_id' => $this->get_id(), |
292 | - 'item_name' => sanitize_text_field( $this->get_raw_name() ), |
|
292 | + 'item_name' => sanitize_text_field($this->get_raw_name()), |
|
293 | 293 | 'item_description' => $this->get_description(), |
294 | 294 | 'tax' => $this->item_tax, |
295 | 295 | 'item_price' => $this->get_price(), |
@@ -318,9 +318,9 @@ discard block |
||
318 | 318 | * @since 1.0.19 |
319 | 319 | * @param int $quantity The item quantity. |
320 | 320 | */ |
321 | - public function set_quantity( $quantity ) { |
|
321 | + public function set_quantity($quantity) { |
|
322 | 322 | |
323 | - if ( empty( $quantity ) || ! is_numeric( $quantity ) ) { |
|
323 | + if (empty($quantity) || !is_numeric($quantity)) { |
|
324 | 324 | $quantity = 1; |
325 | 325 | } |
326 | 326 | |
@@ -334,8 +334,8 @@ discard block |
||
334 | 334 | * @since 1.0.19 |
335 | 335 | * @param array $meta The item meta data. |
336 | 336 | */ |
337 | - public function set_item_meta( $meta ) { |
|
338 | - $this->meta = maybe_unserialize( $meta ); |
|
337 | + public function set_item_meta($meta) { |
|
338 | + $this->meta = maybe_unserialize($meta); |
|
339 | 339 | } |
340 | 340 | |
341 | 341 | /** |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | * @since 1.0.19 |
345 | 345 | * @param bool $allow_quantities |
346 | 346 | */ |
347 | - public function set_allow_quantities( $allow_quantities ) { |
|
347 | + public function set_allow_quantities($allow_quantities) { |
|
348 | 348 | $this->allow_quantities = (bool) $allow_quantities; |
349 | 349 | } |
350 | 350 | |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | * @since 1.0.19 |
355 | 355 | * @param bool $is_required |
356 | 356 | */ |
357 | - public function set_is_required( $is_required ) { |
|
357 | + public function set_is_required($is_required) { |
|
358 | 358 | $this->is_required = (bool) $is_required; |
359 | 359 | } |
360 | 360 | |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | * @since 1.0.19 |
365 | 365 | * @param string $description |
366 | 366 | */ |
367 | - public function set_custom_description( $description ) { |
|
367 | + public function set_custom_description($description) { |
|
368 | 368 | $this->custom_description = $description; |
369 | 369 | } |
370 | 370 | |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | * |
374 | 374 | * @return int item id |
375 | 375 | */ |
376 | - public function save( $data = array() ) { |
|
376 | + public function save($data = array()) { |
|
377 | 377 | return $this->get_id(); |
378 | 378 | } |
379 | 379 |
@@ -2,12 +2,12 @@ discard block |
||
2 | 2 | global $wpi_invoice; |
3 | 3 | |
4 | 4 | // Backwards compatibility. |
5 | -if ( empty( $invoice ) ) { |
|
5 | +if (empty($invoice)) { |
|
6 | 6 | $invoice = $wpi_invoice; |
7 | 7 | } |
8 | 8 | |
9 | 9 | $success_page_uri = wpinv_get_success_page_uri(); |
10 | -if ( ! empty( $invoice ) ) { |
|
10 | +if (!empty($invoice)) { |
|
11 | 11 | $success_page_uri = $invoice->get_receipt_url(); |
12 | 12 | } |
13 | 13 | ?> |
@@ -17,8 +17,8 @@ discard block |
||
17 | 17 | <?php |
18 | 18 | echo |
19 | 19 | wp_sprintf( |
20 | - __( 'Your payment is processing. This page will reload automatically in 10 seconds. If it does not, click <a href="%s">here</a>.', 'invoicing' ), |
|
21 | - esc_url( $success_page_uri ) |
|
20 | + __('Your payment is processing. This page will reload automatically in 10 seconds. If it does not, click <a href="%s">here</a>.', 'invoicing'), |
|
21 | + esc_url($success_page_uri) |
|
22 | 22 | ); |
23 | 23 | ?> |
24 | 24 | <i class="fa fa-spin fa-refresh"></i> |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | <script type="text/javascript"> |
28 | 28 | setTimeout( |
29 | 29 | function(){ |
30 | - window.location = '<?php echo esc_url( $success_page_uri ); ?>'; |
|
30 | + window.location = '<?php echo esc_url($success_page_uri); ?>'; |
|
31 | 31 | }, |
32 | 32 | 10000 |
33 | 33 | ); |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | ?> |
13 | 13 | |
@@ -15,11 +15,11 @@ discard block |
||
15 | 15 | |
16 | 16 | <label class='form-group'> |
17 | 17 | <input v-model='active_form_element.hide_cart' type='checkbox' /> |
18 | - <span class='form-check-label'><?php esc_html_e( 'Hide cart details', 'invoicing' ); ?></span> |
|
18 | + <span class='form-check-label'><?php esc_html_e('Hide cart details', 'invoicing'); ?></span> |
|
19 | 19 | </label> |
20 | 20 | |
21 | 21 | <div class="mb-1"> |
22 | - <?php esc_html_e( 'Form Items', 'invoicing' ); ?> |
|
22 | + <?php esc_html_e('Form Items', 'invoicing'); ?> |
|
23 | 23 | </div> |
24 | 24 | |
25 | 25 | <draggable v-model='form_items' group='selectable_form_items'> |
@@ -38,22 +38,22 @@ discard block |
||
38 | 38 | <div class='p-3'> |
39 | 39 | |
40 | 40 | <span class='form-text'> |
41 | - <a target="_blank" :href="'<?php echo esc_url( admin_url( '/post.php?action=edit&post' ) ) ?>=' + item.id"> |
|
42 | - <?php _e( 'Edit the item name, price and other details', 'invoicing' ); ?> |
|
41 | + <a target="_blank" :href="'<?php echo esc_url(admin_url('/post.php?action=edit&post')) ?>=' + item.id"> |
|
42 | + <?php _e('Edit the item name, price and other details', 'invoicing'); ?> |
|
43 | 43 | </a> |
44 | 44 | </span> |
45 | 45 | |
46 | 46 | <label class='form-group d-block'> |
47 | 47 | <input v-model='item.allow_quantities' type='checkbox' /> |
48 | - <span><?php _e( 'Allow users to buy several quantities', 'invoicing' ); ?></span> |
|
48 | + <span><?php _e('Allow users to buy several quantities', 'invoicing'); ?></span> |
|
49 | 49 | </label> |
50 | 50 | |
51 | 51 | <label class='form-group d-block'> |
52 | 52 | <input v-model='item.required' type='checkbox' /> |
53 | - <span><?php _e( 'This item is required', 'invoicing' ); ?></span> |
|
53 | + <span><?php _e('This item is required', 'invoicing'); ?></span> |
|
54 | 54 | </label> |
55 | 55 | |
56 | - <button type='button' class='button button-link button-link-delete' @click.prevent='removeItem(item)'><?php _e( 'Delete Item', 'invoicing' ); ?></button> |
|
56 | + <button type='button' class='button button-link button-link-delete' @click.prevent='removeItem(item)'><?php _e('Delete Item', 'invoicing'); ?></button> |
|
57 | 57 | |
58 | 58 | </div> |
59 | 59 | </div> |
@@ -61,19 +61,19 @@ discard block |
||
61 | 61 | </div> |
62 | 62 | </draggable> |
63 | 63 | |
64 | - <small v-if='! form_items.length' class='form-text text-danger'><?php _e( 'You have not set up any items. Please select an item below or create a new item.', 'invoicing' ); ?></small> |
|
64 | + <small v-if='! form_items.length' class='form-text text-danger'><?php _e('You have not set up any items. Please select an item below or create a new item.', 'invoicing'); ?></small> |
|
65 | 65 | |
66 | 66 | <div class="mt-4 mb-4"> |
67 | 67 | |
68 | 68 | <div class="mb-2"> |
69 | 69 | <select class='w-100' v-init-item-search> |
70 | - <option value="" selected="selected"><?php _e( 'Select an item to add...', 'invoicing' ) ?></option> |
|
70 | + <option value="" selected="selected"><?php _e('Select an item to add...', 'invoicing') ?></option> |
|
71 | 71 | </select> |
72 | 72 | |
73 | 73 | </div> |
74 | 74 | |
75 | - <button type="button" @click.prevent='addSelectedItem' class="button button-primary"><?php _e( 'Add Selected Item', 'invoicing' ) ?></button> |
|
76 | - <a href="<?php echo esc_url( admin_url( 'post-new.php?post_type=wpi_item' ) ); ?>" target="_blank" class="button button-secondary"><?php _e( 'Create New Item.', 'invoicing' ) ?></a> |
|
75 | + <button type="button" @click.prevent='addSelectedItem' class="button button-primary"><?php _e('Add Selected Item', 'invoicing') ?></button> |
|
76 | + <a href="<?php echo esc_url(admin_url('post-new.php?post_type=wpi_item')); ?>" target="_blank" class="button button-secondary"><?php _e('Create New Item.', 'invoicing') ?></a> |
|
77 | 77 | |
78 | 78 | </div> |
79 | 79 | </div> |
@@ -82,13 +82,13 @@ discard block |
||
82 | 82 | |
83 | 83 | <label class="w-100 d-block"> |
84 | 84 | |
85 | - <span><?php esc_html_e( 'Let customers...', 'invoicing' ) ?></span> |
|
85 | + <span><?php esc_html_e('Let customers...', 'invoicing') ?></span> |
|
86 | 86 | |
87 | 87 | <select class='w-100' style="padding: 6px 24px 6px 8px; border-color: #e0e0e0;" v-model='active_form_element.items_type'> |
88 | - <option value='total'><?php _e( 'Buy all items on the list', 'invoicing' ); ?></option> |
|
89 | - <option value='radio'><?php _e( 'Select a single item from the list', 'invoicing' ); ?></option> |
|
90 | - <option value='checkbox'><?php _e( 'Select one or more items on the list', 'invoicing' ) ;?></option> |
|
91 | - <option value='select'><?php _e( 'Select a single item from a dropdown', 'invoicing' ); ?></option> |
|
88 | + <option value='total'><?php _e('Buy all items on the list', 'invoicing'); ?></option> |
|
89 | + <option value='radio'><?php _e('Select a single item from the list', 'invoicing'); ?></option> |
|
90 | + <option value='checkbox'><?php _e('Select one or more items on the list', 'invoicing'); ?></option> |
|
91 | + <option value='select'><?php _e('Select a single item from a dropdown', 'invoicing'); ?></option> |
|
92 | 92 | </select> |
93 | 93 | |
94 | 94 | </label> |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | |
98 | 98 | <div class='form-group'> |
99 | 99 | <label class="d-block"> |
100 | - <span><?php esc_html_e( 'Help Text', 'invoicing' ); ?></span> |
|
101 | - <textarea placeholder='<?php esc_attr_e( 'Add some help text for this field', 'invoicing' ); ?>' v-model='active_form_element.description' class='form-control' rows='3'></textarea> |
|
100 | + <span><?php esc_html_e('Help Text', 'invoicing'); ?></span> |
|
101 | + <textarea placeholder='<?php esc_attr_e('Add some help text for this field', 'invoicing'); ?>' v-model='active_form_element.description' class='form-control' rows='3'></textarea> |
|
102 | 102 | </label> |
103 | 103 | </div> |
@@ -7,14 +7,14 @@ |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | ?> |
13 | 13 | |
14 | 14 | <div v-if='!is_default'> |
15 | - <div class='alert alert-info' role='alert'><?php _e( 'Item totals will appear here. Click to set items.', 'invoicing' ) ?></div> |
|
15 | + <div class='alert alert-info' role='alert'><?php _e('Item totals will appear here. Click to set items.', 'invoicing') ?></div> |
|
16 | 16 | </div> |
17 | 17 | |
18 | 18 | <div v-if='is_default'> |
19 | - <div class='alert alert-info' role='alert'><?php _e( 'Item totals will appear here.', 'invoicing' ) ?></div> |
|
19 | + <div class='alert alert-info' role='alert'><?php _e('Item totals will appear here.', 'invoicing') ?></div> |
|
20 | 20 | </div> |