@@ -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 | * Invoice class. |
@@ -135,40 +135,40 @@ discard block |
||
135 | 135 | * |
136 | 136 | * @param int|string|object|WPInv_Invoice|WPInv_Legacy_Invoice|WP_Post $invoice Invoice id, key, transaction id, number or object to read. |
137 | 137 | */ |
138 | - public function __construct( $invoice = 0 ) { |
|
138 | + public function __construct($invoice = 0) { |
|
139 | 139 | |
140 | - parent::__construct( $invoice ); |
|
140 | + parent::__construct($invoice); |
|
141 | 141 | |
142 | - if ( ! empty( $invoice ) && is_numeric( $invoice ) && getpaid_is_invoice_post_type( get_post_type( (int) $invoice ) ) ) { |
|
143 | - $this->set_id( (int) $invoice ); |
|
144 | - } elseif ( $invoice instanceof self ) { |
|
145 | - $this->set_id( $invoice->get_id() ); |
|
146 | - } elseif ( ! empty( $invoice->ID ) ) { |
|
147 | - $this->set_id( $invoice->ID ); |
|
148 | - } elseif ( is_array( $invoice ) ) { |
|
149 | - $this->set_props( $invoice ); |
|
142 | + if (!empty($invoice) && is_numeric($invoice) && getpaid_is_invoice_post_type(get_post_type((int) $invoice))) { |
|
143 | + $this->set_id((int) $invoice); |
|
144 | + } elseif ($invoice instanceof self) { |
|
145 | + $this->set_id($invoice->get_id()); |
|
146 | + } elseif (!empty($invoice->ID)) { |
|
147 | + $this->set_id($invoice->ID); |
|
148 | + } elseif (is_array($invoice)) { |
|
149 | + $this->set_props($invoice); |
|
150 | 150 | |
151 | - if ( isset( $invoice['ID'] ) ) { |
|
152 | - $this->set_id( $invoice['ID'] ); |
|
151 | + if (isset($invoice['ID'])) { |
|
152 | + $this->set_id($invoice['ID']); |
|
153 | 153 | } |
154 | 154 | |
155 | - } elseif ( is_string( $invoice ) && $invoice_id = self::get_invoice_id_by_field( $invoice, 'key' ) ) { |
|
156 | - $this->set_id( $invoice_id ); |
|
157 | - } elseif ( is_string( $invoice ) && $invoice_id = self::get_invoice_id_by_field( $invoice, 'number' ) ) { |
|
158 | - $this->set_id( $invoice_id ); |
|
159 | - } elseif ( is_string( $invoice ) && $invoice_id = self::get_invoice_id_by_field( $invoice, 'transaction_id' ) ) { |
|
160 | - $this->set_id( $invoice_id ); |
|
161 | - }else { |
|
162 | - $this->set_object_read( true ); |
|
155 | + } elseif (is_string($invoice) && $invoice_id = self::get_invoice_id_by_field($invoice, 'key')) { |
|
156 | + $this->set_id($invoice_id); |
|
157 | + } elseif (is_string($invoice) && $invoice_id = self::get_invoice_id_by_field($invoice, 'number')) { |
|
158 | + $this->set_id($invoice_id); |
|
159 | + } elseif (is_string($invoice) && $invoice_id = self::get_invoice_id_by_field($invoice, 'transaction_id')) { |
|
160 | + $this->set_id($invoice_id); |
|
161 | + } else { |
|
162 | + $this->set_object_read(true); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | // Load the datastore. |
166 | - $this->data_store = GetPaid_Data_Store::load( $this->data_store_name ); |
|
166 | + $this->data_store = GetPaid_Data_Store::load($this->data_store_name); |
|
167 | 167 | |
168 | - if ( $this->get_id() > 0 ) { |
|
169 | - $this->post = get_post( $this->get_id() ); |
|
168 | + if ($this->get_id() > 0) { |
|
169 | + $this->post = get_post($this->get_id()); |
|
170 | 170 | $this->ID = $this->get_id(); |
171 | - $this->data_store->read( $this ); |
|
171 | + $this->data_store->read($this); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | } |
@@ -183,38 +183,38 @@ discard block |
||
183 | 183 | * @since 1.0.15 |
184 | 184 | * @return int |
185 | 185 | */ |
186 | - public static function get_invoice_id_by_field( $value, $field = 'key' ) { |
|
186 | + public static function get_invoice_id_by_field($value, $field = 'key') { |
|
187 | 187 | global $wpdb; |
188 | 188 | |
189 | 189 | // Trim the value. |
190 | - $value = trim( $value ); |
|
190 | + $value = trim($value); |
|
191 | 191 | |
192 | - if ( empty( $value ) ) { |
|
192 | + if (empty($value)) { |
|
193 | 193 | return 0; |
194 | 194 | } |
195 | 195 | |
196 | 196 | // Valid fields. |
197 | - $fields = array( 'key', 'number', 'transaction_id' ); |
|
197 | + $fields = array('key', 'number', 'transaction_id'); |
|
198 | 198 | |
199 | 199 | // Ensure a field has been passed. |
200 | - if ( empty( $field ) || ! in_array( $field, $fields ) ) { |
|
200 | + if (empty($field) || !in_array($field, $fields)) { |
|
201 | 201 | return 0; |
202 | 202 | } |
203 | 203 | |
204 | 204 | // Maybe retrieve from the cache. |
205 | - $invoice_id = wp_cache_get( $value, "getpaid_invoice_{$field}s_to_invoice_ids" ); |
|
206 | - if ( false !== $invoice_id ) { |
|
205 | + $invoice_id = wp_cache_get($value, "getpaid_invoice_{$field}s_to_invoice_ids"); |
|
206 | + if (false !== $invoice_id) { |
|
207 | 207 | return $invoice_id; |
208 | 208 | } |
209 | 209 | |
210 | 210 | // Fetch from the db. |
211 | 211 | $table = $wpdb->prefix . 'getpaid_invoices'; |
212 | 212 | $invoice_id = (int) $wpdb->get_var( |
213 | - $wpdb->prepare( "SELECT `post_id` FROM $table WHERE `$field`=%s LIMIT 1", $value ) |
|
213 | + $wpdb->prepare("SELECT `post_id` FROM $table WHERE `$field`=%s LIMIT 1", $value) |
|
214 | 214 | ); |
215 | 215 | |
216 | 216 | // Update the cache with our data |
217 | - wp_cache_set( $value, $invoice_id, "getpaid_invoice_{$field}s_to_invoice_ids" ); |
|
217 | + wp_cache_set($value, $invoice_id, "getpaid_invoice_{$field}s_to_invoice_ids"); |
|
218 | 218 | |
219 | 219 | return $invoice_id; |
220 | 220 | } |
@@ -222,8 +222,8 @@ discard block |
||
222 | 222 | /** |
223 | 223 | * Checks if an invoice key is set. |
224 | 224 | */ |
225 | - public function _isset( $key ) { |
|
226 | - return isset( $this->data[$key] ) || method_exists( $this, "get_$key" ); |
|
225 | + public function _isset($key) { |
|
226 | + return isset($this->data[$key]) || method_exists($this, "get_$key"); |
|
227 | 227 | } |
228 | 228 | |
229 | 229 | /* |
@@ -248,8 +248,8 @@ discard block |
||
248 | 248 | * @param string $context View or edit context. |
249 | 249 | * @return int |
250 | 250 | */ |
251 | - public function get_parent_id( $context = 'view' ) { |
|
252 | - return (int) $this->get_prop( 'parent_id', $context ); |
|
251 | + public function get_parent_id($context = 'view') { |
|
252 | + return (int) $this->get_prop('parent_id', $context); |
|
253 | 253 | } |
254 | 254 | |
255 | 255 | /** |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | * @return WPInv_Invoice |
260 | 260 | */ |
261 | 261 | public function get_parent_payment() { |
262 | - return new WPInv_Invoice( $this->get_parent_id() ); |
|
262 | + return new WPInv_Invoice($this->get_parent_id()); |
|
263 | 263 | } |
264 | 264 | |
265 | 265 | /** |
@@ -279,8 +279,8 @@ discard block |
||
279 | 279 | * @param string $context View or edit context. |
280 | 280 | * @return string |
281 | 281 | */ |
282 | - public function get_status( $context = 'view' ) { |
|
283 | - return $this->get_prop( 'status', $context ); |
|
282 | + public function get_status($context = 'view') { |
|
283 | + return $this->get_prop('status', $context); |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | /** |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | * @return array |
291 | 291 | */ |
292 | 292 | public function get_all_statuses() { |
293 | - return wpinv_get_invoice_statuses( true, true, $this ); |
|
293 | + return wpinv_get_invoice_statuses(true, true, $this); |
|
294 | 294 | } |
295 | 295 | |
296 | 296 | /** |
@@ -302,9 +302,9 @@ discard block |
||
302 | 302 | public function get_status_nicename() { |
303 | 303 | $statuses = $this->get_all_statuses(); |
304 | 304 | |
305 | - $status = isset( $statuses[ $this->get_status() ] ) ? $statuses[ $this->get_status() ] : $this->get_status(); |
|
305 | + $status = isset($statuses[$this->get_status()]) ? $statuses[$this->get_status()] : $this->get_status(); |
|
306 | 306 | |
307 | - return apply_filters( 'wpinv_get_invoice_status_nicename', $status, $this ); |
|
307 | + return apply_filters('wpinv_get_invoice_status_nicename', $status, $this); |
|
308 | 308 | } |
309 | 309 | |
310 | 310 | /** |
@@ -315,8 +315,8 @@ discard block |
||
315 | 315 | */ |
316 | 316 | public function get_status_label_html() { |
317 | 317 | |
318 | - $status_label = sanitize_text_field( $this->get_status_nicename() ); |
|
319 | - $status = sanitize_html_class( $this->get_status() ); |
|
318 | + $status_label = sanitize_text_field($this->get_status_nicename()); |
|
319 | + $status = sanitize_html_class($this->get_status()); |
|
320 | 320 | |
321 | 321 | return "<span class='bsui'><span class='d-inline-block py-2 px-3 rounded getpaid-invoice-status-$status'>$status_label</span></span>"; |
322 | 322 | } |
@@ -328,23 +328,23 @@ discard block |
||
328 | 328 | * @param string $context View or edit context. |
329 | 329 | * @return string |
330 | 330 | */ |
331 | - public function get_version( $context = 'view' ) { |
|
332 | - return $this->get_prop( 'version', $context ); |
|
331 | + public function get_version($context = 'view') { |
|
332 | + return $this->get_prop('version', $context); |
|
333 | 333 | } |
334 | 334 | |
335 | 335 | /** |
336 | 336 | * @deprecated |
337 | 337 | */ |
338 | - public function get_invoice_date( $format = true ) { |
|
339 | - $date = getpaid_format_date( $this->get_date_completed() ); |
|
340 | - $date = empty( $date ) ? $this->get_date_created() : $this->get_date_completed(); |
|
341 | - $formatted = getpaid_format_date( $date ); |
|
338 | + public function get_invoice_date($format = true) { |
|
339 | + $date = getpaid_format_date($this->get_date_completed()); |
|
340 | + $date = empty($date) ? $this->get_date_created() : $this->get_date_completed(); |
|
341 | + $formatted = getpaid_format_date($date); |
|
342 | 342 | |
343 | - if ( $format ) { |
|
343 | + if ($format) { |
|
344 | 344 | return $formatted; |
345 | 345 | } |
346 | 346 | |
347 | - return empty( $formatted ) ? '' : $date; |
|
347 | + return empty($formatted) ? '' : $date; |
|
348 | 348 | |
349 | 349 | } |
350 | 350 | |
@@ -355,8 +355,8 @@ discard block |
||
355 | 355 | * @param string $context View or edit context. |
356 | 356 | * @return string |
357 | 357 | */ |
358 | - public function get_date_created( $context = 'view' ) { |
|
359 | - return $this->get_prop( 'date_created', $context ); |
|
358 | + public function get_date_created($context = 'view') { |
|
359 | + return $this->get_prop('date_created', $context); |
|
360 | 360 | } |
361 | 361 | |
362 | 362 | /** |
@@ -366,8 +366,8 @@ discard block |
||
366 | 366 | * @param string $context View or edit context. |
367 | 367 | * @return string |
368 | 368 | */ |
369 | - public function get_created_date( $context = 'view' ) { |
|
370 | - return $this->get_date_created( $context ); |
|
369 | + public function get_created_date($context = 'view') { |
|
370 | + return $this->get_date_created($context); |
|
371 | 371 | } |
372 | 372 | |
373 | 373 | /** |
@@ -377,11 +377,11 @@ discard block |
||
377 | 377 | * @param string $context View or edit context. |
378 | 378 | * @return string |
379 | 379 | */ |
380 | - public function get_date_created_gmt( $context = 'view' ) { |
|
381 | - $date = $this->get_date_created( $context ); |
|
380 | + public function get_date_created_gmt($context = 'view') { |
|
381 | + $date = $this->get_date_created($context); |
|
382 | 382 | |
383 | - if ( $date ) { |
|
384 | - $date = get_gmt_from_date( $date ); |
|
383 | + if ($date) { |
|
384 | + $date = get_gmt_from_date($date); |
|
385 | 385 | } |
386 | 386 | return $date; |
387 | 387 | } |
@@ -393,8 +393,8 @@ discard block |
||
393 | 393 | * @param string $context View or edit context. |
394 | 394 | * @return string |
395 | 395 | */ |
396 | - public function get_date_modified( $context = 'view' ) { |
|
397 | - return $this->get_prop( 'date_modified', $context ); |
|
396 | + public function get_date_modified($context = 'view') { |
|
397 | + return $this->get_prop('date_modified', $context); |
|
398 | 398 | } |
399 | 399 | |
400 | 400 | /** |
@@ -404,8 +404,8 @@ discard block |
||
404 | 404 | * @param string $context View or edit context. |
405 | 405 | * @return string |
406 | 406 | */ |
407 | - public function get_modified_date( $context = 'view' ) { |
|
408 | - return $this->get_date_modified( $context ); |
|
407 | + public function get_modified_date($context = 'view') { |
|
408 | + return $this->get_date_modified($context); |
|
409 | 409 | } |
410 | 410 | |
411 | 411 | /** |
@@ -415,11 +415,11 @@ discard block |
||
415 | 415 | * @param string $context View or edit context. |
416 | 416 | * @return string |
417 | 417 | */ |
418 | - public function get_date_modified_gmt( $context = 'view' ) { |
|
419 | - $date = $this->get_date_modified( $context ); |
|
418 | + public function get_date_modified_gmt($context = 'view') { |
|
419 | + $date = $this->get_date_modified($context); |
|
420 | 420 | |
421 | - if ( $date ) { |
|
422 | - $date = get_gmt_from_date( $date ); |
|
421 | + if ($date) { |
|
422 | + $date = get_gmt_from_date($date); |
|
423 | 423 | } |
424 | 424 | return $date; |
425 | 425 | } |
@@ -431,8 +431,8 @@ discard block |
||
431 | 431 | * @param string $context View or edit context. |
432 | 432 | * @return string |
433 | 433 | */ |
434 | - public function get_due_date( $context = 'view' ) { |
|
435 | - return $this->get_prop( 'due_date', $context ); |
|
434 | + public function get_due_date($context = 'view') { |
|
435 | + return $this->get_prop('due_date', $context); |
|
436 | 436 | } |
437 | 437 | |
438 | 438 | /** |
@@ -442,8 +442,8 @@ discard block |
||
442 | 442 | * @param string $context View or edit context. |
443 | 443 | * @return string |
444 | 444 | */ |
445 | - public function get_date_due( $context = 'view' ) { |
|
446 | - return $this->get_due_date( $context ); |
|
445 | + public function get_date_due($context = 'view') { |
|
446 | + return $this->get_due_date($context); |
|
447 | 447 | } |
448 | 448 | |
449 | 449 | /** |
@@ -453,11 +453,11 @@ discard block |
||
453 | 453 | * @param string $context View or edit context. |
454 | 454 | * @return string |
455 | 455 | */ |
456 | - public function get_due_date_gmt( $context = 'view' ) { |
|
457 | - $date = $this->get_due_date( $context ); |
|
456 | + public function get_due_date_gmt($context = 'view') { |
|
457 | + $date = $this->get_due_date($context); |
|
458 | 458 | |
459 | - if ( $date ) { |
|
460 | - $date = get_gmt_from_date( $date ); |
|
459 | + if ($date) { |
|
460 | + $date = get_gmt_from_date($date); |
|
461 | 461 | } |
462 | 462 | return $date; |
463 | 463 | } |
@@ -469,8 +469,8 @@ discard block |
||
469 | 469 | * @param string $context View or edit context. |
470 | 470 | * @return string |
471 | 471 | */ |
472 | - public function get_gmt_date_due( $context = 'view' ) { |
|
473 | - return $this->get_due_date_gmt( $context ); |
|
472 | + public function get_gmt_date_due($context = 'view') { |
|
473 | + return $this->get_due_date_gmt($context); |
|
474 | 474 | } |
475 | 475 | |
476 | 476 | /** |
@@ -480,8 +480,8 @@ discard block |
||
480 | 480 | * @param string $context View or edit context. |
481 | 481 | * @return string |
482 | 482 | */ |
483 | - public function get_completed_date( $context = 'view' ) { |
|
484 | - return $this->get_prop( 'completed_date', $context ); |
|
483 | + public function get_completed_date($context = 'view') { |
|
484 | + return $this->get_prop('completed_date', $context); |
|
485 | 485 | } |
486 | 486 | |
487 | 487 | /** |
@@ -491,8 +491,8 @@ discard block |
||
491 | 491 | * @param string $context View or edit context. |
492 | 492 | * @return string |
493 | 493 | */ |
494 | - public function get_date_completed( $context = 'view' ) { |
|
495 | - return $this->get_completed_date( $context ); |
|
494 | + public function get_date_completed($context = 'view') { |
|
495 | + return $this->get_completed_date($context); |
|
496 | 496 | } |
497 | 497 | |
498 | 498 | /** |
@@ -502,11 +502,11 @@ discard block |
||
502 | 502 | * @param string $context View or edit context. |
503 | 503 | * @return string |
504 | 504 | */ |
505 | - public function get_completed_date_gmt( $context = 'view' ) { |
|
506 | - $date = $this->get_completed_date( $context ); |
|
505 | + public function get_completed_date_gmt($context = 'view') { |
|
506 | + $date = $this->get_completed_date($context); |
|
507 | 507 | |
508 | - if ( $date ) { |
|
509 | - $date = get_gmt_from_date( $date ); |
|
508 | + if ($date) { |
|
509 | + $date = get_gmt_from_date($date); |
|
510 | 510 | } |
511 | 511 | return $date; |
512 | 512 | } |
@@ -518,8 +518,8 @@ discard block |
||
518 | 518 | * @param string $context View or edit context. |
519 | 519 | * @return string |
520 | 520 | */ |
521 | - public function get_gmt_completed_date( $context = 'view' ) { |
|
522 | - return $this->get_completed_date_gmt( $context ); |
|
521 | + public function get_gmt_completed_date($context = 'view') { |
|
522 | + return $this->get_completed_date_gmt($context); |
|
523 | 523 | } |
524 | 524 | |
525 | 525 | /** |
@@ -529,12 +529,12 @@ discard block |
||
529 | 529 | * @param string $context View or edit context. |
530 | 530 | * @return string |
531 | 531 | */ |
532 | - public function get_number( $context = 'view' ) { |
|
533 | - $number = $this->get_prop( 'number', $context ); |
|
532 | + public function get_number($context = 'view') { |
|
533 | + $number = $this->get_prop('number', $context); |
|
534 | 534 | |
535 | - if ( empty( $number ) ) { |
|
535 | + if (empty($number)) { |
|
536 | 536 | $number = $this->generate_number(); |
537 | - $this->set_number( $this->generate_number() ); |
|
537 | + $this->set_number($this->generate_number()); |
|
538 | 538 | } |
539 | 539 | |
540 | 540 | return $number; |
@@ -548,8 +548,8 @@ discard block |
||
548 | 548 | public function maybe_set_number() { |
549 | 549 | $number = $this->get_number(); |
550 | 550 | |
551 | - if ( empty( $number ) || $this->get_id() == $number ) { |
|
552 | - $this->set_number( $this->generate_number() ); |
|
551 | + if (empty($number) || $this->get_id() == $number) { |
|
552 | + $this->set_number($this->generate_number()); |
|
553 | 553 | } |
554 | 554 | |
555 | 555 | } |
@@ -561,8 +561,8 @@ discard block |
||
561 | 561 | * @param string $context View or edit context. |
562 | 562 | * @return string |
563 | 563 | */ |
564 | - public function get_key( $context = 'view' ) { |
|
565 | - return $this->get_prop( 'key', $context ); |
|
564 | + public function get_key($context = 'view') { |
|
565 | + return $this->get_prop('key', $context); |
|
566 | 566 | } |
567 | 567 | |
568 | 568 | /** |
@@ -573,9 +573,9 @@ discard block |
||
573 | 573 | public function maybe_set_key() { |
574 | 574 | $key = $this->get_key(); |
575 | 575 | |
576 | - if ( empty( $key ) ) { |
|
577 | - $key = $this->generate_key( $this->get_type() . '_' ); |
|
578 | - $this->set_key( $key ); |
|
576 | + if (empty($key)) { |
|
577 | + $key = $this->generate_key($this->get_type() . '_'); |
|
578 | + $this->set_key($key); |
|
579 | 579 | } |
580 | 580 | |
581 | 581 | } |
@@ -587,8 +587,8 @@ discard block |
||
587 | 587 | * @param string $context View or edit context. |
588 | 588 | * @return string |
589 | 589 | */ |
590 | - public function get_type( $context = 'view' ) { |
|
591 | - return $this->get_prop( 'type', $context ); |
|
590 | + public function get_type($context = 'view') { |
|
591 | + return $this->get_prop('type', $context); |
|
592 | 592 | } |
593 | 593 | |
594 | 594 | /** |
@@ -598,7 +598,7 @@ discard block |
||
598 | 598 | * @return string |
599 | 599 | */ |
600 | 600 | public function get_invoice_quote_type() { |
601 | - return getpaid_get_post_type_label( $this->get_post_type(), false ); |
|
601 | + return getpaid_get_post_type_label($this->get_post_type(), false); |
|
602 | 602 | } |
603 | 603 | |
604 | 604 | /** |
@@ -608,8 +608,8 @@ discard block |
||
608 | 608 | * @param string $context View or edit context. |
609 | 609 | * @return string |
610 | 610 | */ |
611 | - public function get_post_type( $context = 'view' ) { |
|
612 | - return $this->get_prop( 'post_type', $context ); |
|
611 | + public function get_post_type($context = 'view') { |
|
612 | + return $this->get_prop('post_type', $context); |
|
613 | 613 | } |
614 | 614 | |
615 | 615 | /** |
@@ -619,8 +619,8 @@ discard block |
||
619 | 619 | * @param string $context View or edit context. |
620 | 620 | * @return string |
621 | 621 | */ |
622 | - public function get_mode( $context = 'view' ) { |
|
623 | - return $this->get_prop( 'mode', $context ); |
|
622 | + public function get_mode($context = 'view') { |
|
623 | + return $this->get_prop('mode', $context); |
|
624 | 624 | } |
625 | 625 | |
626 | 626 | /** |
@@ -630,13 +630,13 @@ discard block |
||
630 | 630 | * @param string $context View or edit context. |
631 | 631 | * @return string |
632 | 632 | */ |
633 | - public function get_path( $context = 'view' ) { |
|
634 | - $path = $this->get_prop( 'path', $context ); |
|
633 | + public function get_path($context = 'view') { |
|
634 | + $path = $this->get_prop('path', $context); |
|
635 | 635 | $prefix = $this->get_type(); |
636 | 636 | |
637 | - if ( 0 !== strpos( $path, $prefix ) ) { |
|
638 | - $path = sanitize_title( $prefix . '-' . $this->get_id() ); |
|
639 | - $this->set_path( $path ); |
|
637 | + if (0 !== strpos($path, $prefix)) { |
|
638 | + $path = sanitize_title($prefix . '-' . $this->get_id()); |
|
639 | + $this->set_path($path); |
|
640 | 640 | } |
641 | 641 | |
642 | 642 | return $path; |
@@ -649,8 +649,8 @@ discard block |
||
649 | 649 | * @param string $context View or edit context. |
650 | 650 | * @return string |
651 | 651 | */ |
652 | - public function get_name( $context = 'view' ) { |
|
653 | - return $this->get_prop( 'title', $context ); |
|
652 | + public function get_name($context = 'view') { |
|
653 | + return $this->get_prop('title', $context); |
|
654 | 654 | } |
655 | 655 | |
656 | 656 | /** |
@@ -660,8 +660,8 @@ discard block |
||
660 | 660 | * @param string $context View or edit context. |
661 | 661 | * @return string |
662 | 662 | */ |
663 | - public function get_title( $context = 'view' ) { |
|
664 | - return $this->get_name( $context ); |
|
663 | + public function get_title($context = 'view') { |
|
664 | + return $this->get_name($context); |
|
665 | 665 | } |
666 | 666 | |
667 | 667 | /** |
@@ -671,8 +671,8 @@ discard block |
||
671 | 671 | * @param string $context View or edit context. |
672 | 672 | * @return string |
673 | 673 | */ |
674 | - public function get_description( $context = 'view' ) { |
|
675 | - return $this->get_prop( 'description', $context ); |
|
674 | + public function get_description($context = 'view') { |
|
675 | + return $this->get_prop('description', $context); |
|
676 | 676 | } |
677 | 677 | |
678 | 678 | /** |
@@ -682,8 +682,8 @@ discard block |
||
682 | 682 | * @param string $context View or edit context. |
683 | 683 | * @return string |
684 | 684 | */ |
685 | - public function get_excerpt( $context = 'view' ) { |
|
686 | - return $this->get_description( $context ); |
|
685 | + public function get_excerpt($context = 'view') { |
|
686 | + return $this->get_description($context); |
|
687 | 687 | } |
688 | 688 | |
689 | 689 | /** |
@@ -693,8 +693,8 @@ discard block |
||
693 | 693 | * @param string $context View or edit context. |
694 | 694 | * @return string |
695 | 695 | */ |
696 | - public function get_summary( $context = 'view' ) { |
|
697 | - return $this->get_description( $context ); |
|
696 | + public function get_summary($context = 'view') { |
|
697 | + return $this->get_description($context); |
|
698 | 698 | } |
699 | 699 | |
700 | 700 | /** |
@@ -704,25 +704,25 @@ discard block |
||
704 | 704 | * @param string $context View or edit context. |
705 | 705 | * @return array |
706 | 706 | */ |
707 | - public function get_user_info( $context = 'view' ) { |
|
707 | + public function get_user_info($context = 'view') { |
|
708 | 708 | |
709 | 709 | $user_info = array( |
710 | - 'user_id' => $this->get_user_id( $context ), |
|
711 | - 'email' => $this->get_email( $context ), |
|
712 | - 'first_name' => $this->get_first_name( $context ), |
|
713 | - 'last_name' => $this->get_last_name( $context ), |
|
714 | - 'address' => $this->get_address( $context ), |
|
715 | - 'phone' => $this->get_phone( $context ), |
|
716 | - 'city' => $this->get_city( $context ), |
|
717 | - 'country' => $this->get_country( $context ), |
|
718 | - 'state' => $this->get_state( $context ), |
|
719 | - 'zip' => $this->get_zip( $context ), |
|
720 | - 'company' => $this->get_company( $context ), |
|
721 | - 'vat_number' => $this->get_vat_number( $context ), |
|
722 | - 'discount' => $this->get_discount_code( $context ), |
|
710 | + 'user_id' => $this->get_user_id($context), |
|
711 | + 'email' => $this->get_email($context), |
|
712 | + 'first_name' => $this->get_first_name($context), |
|
713 | + 'last_name' => $this->get_last_name($context), |
|
714 | + 'address' => $this->get_address($context), |
|
715 | + 'phone' => $this->get_phone($context), |
|
716 | + 'city' => $this->get_city($context), |
|
717 | + 'country' => $this->get_country($context), |
|
718 | + 'state' => $this->get_state($context), |
|
719 | + 'zip' => $this->get_zip($context), |
|
720 | + 'company' => $this->get_company($context), |
|
721 | + 'vat_number' => $this->get_vat_number($context), |
|
722 | + 'discount' => $this->get_discount_code($context), |
|
723 | 723 | ); |
724 | 724 | |
725 | - return apply_filters( 'wpinv_user_info', $user_info, $this->get_id(), $this ); |
|
725 | + return apply_filters('wpinv_user_info', $user_info, $this->get_id(), $this); |
|
726 | 726 | |
727 | 727 | } |
728 | 728 | |
@@ -733,8 +733,8 @@ discard block |
||
733 | 733 | * @param string $context View or edit context. |
734 | 734 | * @return int |
735 | 735 | */ |
736 | - public function get_author( $context = 'view' ) { |
|
737 | - return (int) $this->get_prop( 'author', $context ); |
|
736 | + public function get_author($context = 'view') { |
|
737 | + return (int) $this->get_prop('author', $context); |
|
738 | 738 | } |
739 | 739 | |
740 | 740 | /** |
@@ -744,8 +744,8 @@ discard block |
||
744 | 744 | * @param string $context View or edit context. |
745 | 745 | * @return int |
746 | 746 | */ |
747 | - public function get_user_id( $context = 'view' ) { |
|
748 | - return $this->get_author( $context ); |
|
747 | + public function get_user_id($context = 'view') { |
|
748 | + return $this->get_author($context); |
|
749 | 749 | } |
750 | 750 | |
751 | 751 | /** |
@@ -755,8 +755,8 @@ discard block |
||
755 | 755 | * @param string $context View or edit context. |
756 | 756 | * @return int |
757 | 757 | */ |
758 | - public function get_customer_id( $context = 'view' ) { |
|
759 | - return $this->get_author( $context ); |
|
758 | + public function get_customer_id($context = 'view') { |
|
759 | + return $this->get_author($context); |
|
760 | 760 | } |
761 | 761 | |
762 | 762 | /** |
@@ -766,8 +766,8 @@ discard block |
||
766 | 766 | * @param string $context View or edit context. |
767 | 767 | * @return string |
768 | 768 | */ |
769 | - public function get_ip( $context = 'view' ) { |
|
770 | - return $this->get_prop( 'user_ip', $context ); |
|
769 | + public function get_ip($context = 'view') { |
|
770 | + return $this->get_prop('user_ip', $context); |
|
771 | 771 | } |
772 | 772 | |
773 | 773 | /** |
@@ -777,8 +777,8 @@ discard block |
||
777 | 777 | * @param string $context View or edit context. |
778 | 778 | * @return string |
779 | 779 | */ |
780 | - public function get_user_ip( $context = 'view' ) { |
|
781 | - return $this->get_ip( $context ); |
|
780 | + public function get_user_ip($context = 'view') { |
|
781 | + return $this->get_ip($context); |
|
782 | 782 | } |
783 | 783 | |
784 | 784 | /** |
@@ -788,8 +788,8 @@ discard block |
||
788 | 788 | * @param string $context View or edit context. |
789 | 789 | * @return string |
790 | 790 | */ |
791 | - public function get_customer_ip( $context = 'view' ) { |
|
792 | - return $this->get_ip( $context ); |
|
791 | + public function get_customer_ip($context = 'view') { |
|
792 | + return $this->get_ip($context); |
|
793 | 793 | } |
794 | 794 | |
795 | 795 | /** |
@@ -799,8 +799,8 @@ discard block |
||
799 | 799 | * @param string $context View or edit context. |
800 | 800 | * @return string |
801 | 801 | */ |
802 | - public function get_first_name( $context = 'view' ) { |
|
803 | - return $this->get_prop( 'first_name', $context ); |
|
802 | + public function get_first_name($context = 'view') { |
|
803 | + return $this->get_prop('first_name', $context); |
|
804 | 804 | } |
805 | 805 | |
806 | 806 | /** |
@@ -810,8 +810,8 @@ discard block |
||
810 | 810 | * @param string $context View or edit context. |
811 | 811 | * @return string |
812 | 812 | */ |
813 | - public function get_user_first_name( $context = 'view' ) { |
|
814 | - return $this->get_first_name( $context ); |
|
813 | + public function get_user_first_name($context = 'view') { |
|
814 | + return $this->get_first_name($context); |
|
815 | 815 | } |
816 | 816 | |
817 | 817 | /** |
@@ -821,8 +821,8 @@ discard block |
||
821 | 821 | * @param string $context View or edit context. |
822 | 822 | * @return string |
823 | 823 | */ |
824 | - public function get_customer_first_name( $context = 'view' ) { |
|
825 | - return $this->get_first_name( $context ); |
|
824 | + public function get_customer_first_name($context = 'view') { |
|
825 | + return $this->get_first_name($context); |
|
826 | 826 | } |
827 | 827 | |
828 | 828 | /** |
@@ -832,8 +832,8 @@ discard block |
||
832 | 832 | * @param string $context View or edit context. |
833 | 833 | * @return string |
834 | 834 | */ |
835 | - public function get_last_name( $context = 'view' ) { |
|
836 | - return $this->get_prop( 'last_name', $context ); |
|
835 | + public function get_last_name($context = 'view') { |
|
836 | + return $this->get_prop('last_name', $context); |
|
837 | 837 | } |
838 | 838 | |
839 | 839 | /** |
@@ -843,8 +843,8 @@ discard block |
||
843 | 843 | * @param string $context View or edit context. |
844 | 844 | * @return string |
845 | 845 | */ |
846 | - public function get_user_last_name( $context = 'view' ) { |
|
847 | - return $this->get_last_name( $context ); |
|
846 | + public function get_user_last_name($context = 'view') { |
|
847 | + return $this->get_last_name($context); |
|
848 | 848 | } |
849 | 849 | |
850 | 850 | /** |
@@ -854,8 +854,8 @@ discard block |
||
854 | 854 | * @param string $context View or edit context. |
855 | 855 | * @return string |
856 | 856 | */ |
857 | - public function get_customer_last_name( $context = 'view' ) { |
|
858 | - return $this->get_last_name( $context ); |
|
857 | + public function get_customer_last_name($context = 'view') { |
|
858 | + return $this->get_last_name($context); |
|
859 | 859 | } |
860 | 860 | |
861 | 861 | /** |
@@ -865,8 +865,8 @@ discard block |
||
865 | 865 | * @param string $context View or edit context. |
866 | 866 | * @return string |
867 | 867 | */ |
868 | - public function get_full_name( $context = 'view' ) { |
|
869 | - return trim( $this->get_first_name( $context ) . ' ' . $this->get_last_name( $context ) ); |
|
868 | + public function get_full_name($context = 'view') { |
|
869 | + return trim($this->get_first_name($context) . ' ' . $this->get_last_name($context)); |
|
870 | 870 | } |
871 | 871 | |
872 | 872 | /** |
@@ -876,8 +876,8 @@ discard block |
||
876 | 876 | * @param string $context View or edit context. |
877 | 877 | * @return string |
878 | 878 | */ |
879 | - public function get_user_full_name( $context = 'view' ) { |
|
880 | - return $this->get_full_name( $context ); |
|
879 | + public function get_user_full_name($context = 'view') { |
|
880 | + return $this->get_full_name($context); |
|
881 | 881 | } |
882 | 882 | |
883 | 883 | /** |
@@ -887,8 +887,8 @@ discard block |
||
887 | 887 | * @param string $context View or edit context. |
888 | 888 | * @return string |
889 | 889 | */ |
890 | - public function get_customer_full_name( $context = 'view' ) { |
|
891 | - return $this->get_full_name( $context ); |
|
890 | + public function get_customer_full_name($context = 'view') { |
|
891 | + return $this->get_full_name($context); |
|
892 | 892 | } |
893 | 893 | |
894 | 894 | /** |
@@ -898,8 +898,8 @@ discard block |
||
898 | 898 | * @param string $context View or edit context. |
899 | 899 | * @return string |
900 | 900 | */ |
901 | - public function get_phone( $context = 'view' ) { |
|
902 | - return $this->get_prop( 'phone', $context ); |
|
901 | + public function get_phone($context = 'view') { |
|
902 | + return $this->get_prop('phone', $context); |
|
903 | 903 | } |
904 | 904 | |
905 | 905 | /** |
@@ -909,8 +909,8 @@ discard block |
||
909 | 909 | * @param string $context View or edit context. |
910 | 910 | * @return string |
911 | 911 | */ |
912 | - public function get_phone_number( $context = 'view' ) { |
|
913 | - return $this->get_phone( $context ); |
|
912 | + public function get_phone_number($context = 'view') { |
|
913 | + return $this->get_phone($context); |
|
914 | 914 | } |
915 | 915 | |
916 | 916 | /** |
@@ -920,8 +920,8 @@ discard block |
||
920 | 920 | * @param string $context View or edit context. |
921 | 921 | * @return string |
922 | 922 | */ |
923 | - public function get_user_phone( $context = 'view' ) { |
|
924 | - return $this->get_phone( $context ); |
|
923 | + public function get_user_phone($context = 'view') { |
|
924 | + return $this->get_phone($context); |
|
925 | 925 | } |
926 | 926 | |
927 | 927 | /** |
@@ -931,8 +931,8 @@ discard block |
||
931 | 931 | * @param string $context View or edit context. |
932 | 932 | * @return string |
933 | 933 | */ |
934 | - public function get_customer_phone( $context = 'view' ) { |
|
935 | - return $this->get_phone( $context ); |
|
934 | + public function get_customer_phone($context = 'view') { |
|
935 | + return $this->get_phone($context); |
|
936 | 936 | } |
937 | 937 | |
938 | 938 | /** |
@@ -942,8 +942,8 @@ discard block |
||
942 | 942 | * @param string $context View or edit context. |
943 | 943 | * @return string |
944 | 944 | */ |
945 | - public function get_email( $context = 'view' ) { |
|
946 | - return $this->get_prop( 'email', $context ); |
|
945 | + public function get_email($context = 'view') { |
|
946 | + return $this->get_prop('email', $context); |
|
947 | 947 | } |
948 | 948 | |
949 | 949 | /** |
@@ -953,8 +953,8 @@ discard block |
||
953 | 953 | * @param string $context View or edit context. |
954 | 954 | * @return string |
955 | 955 | */ |
956 | - public function get_email_address( $context = 'view' ) { |
|
957 | - return $this->get_email( $context ); |
|
956 | + public function get_email_address($context = 'view') { |
|
957 | + return $this->get_email($context); |
|
958 | 958 | } |
959 | 959 | |
960 | 960 | /** |
@@ -964,8 +964,8 @@ discard block |
||
964 | 964 | * @param string $context View or edit context. |
965 | 965 | * @return string |
966 | 966 | */ |
967 | - public function get_user_email( $context = 'view' ) { |
|
968 | - return $this->get_email( $context ); |
|
967 | + public function get_user_email($context = 'view') { |
|
968 | + return $this->get_email($context); |
|
969 | 969 | } |
970 | 970 | |
971 | 971 | /** |
@@ -975,8 +975,8 @@ discard block |
||
975 | 975 | * @param string $context View or edit context. |
976 | 976 | * @return string |
977 | 977 | */ |
978 | - public function get_customer_email( $context = 'view' ) { |
|
979 | - return $this->get_email( $context ); |
|
978 | + public function get_customer_email($context = 'view') { |
|
979 | + return $this->get_email($context); |
|
980 | 980 | } |
981 | 981 | |
982 | 982 | /** |
@@ -986,9 +986,9 @@ discard block |
||
986 | 986 | * @param string $context View or edit context. |
987 | 987 | * @return string |
988 | 988 | */ |
989 | - public function get_country( $context = 'view' ) { |
|
990 | - $country = $this->get_prop( 'country', $context ); |
|
991 | - return empty( $country ) ? wpinv_get_default_country() : $country; |
|
989 | + public function get_country($context = 'view') { |
|
990 | + $country = $this->get_prop('country', $context); |
|
991 | + return empty($country) ? wpinv_get_default_country() : $country; |
|
992 | 992 | } |
993 | 993 | |
994 | 994 | /** |
@@ -998,8 +998,8 @@ discard block |
||
998 | 998 | * @param string $context View or edit context. |
999 | 999 | * @return string |
1000 | 1000 | */ |
1001 | - public function get_user_country( $context = 'view' ) { |
|
1002 | - return $this->get_country( $context ); |
|
1001 | + public function get_user_country($context = 'view') { |
|
1002 | + return $this->get_country($context); |
|
1003 | 1003 | } |
1004 | 1004 | |
1005 | 1005 | /** |
@@ -1009,8 +1009,8 @@ discard block |
||
1009 | 1009 | * @param string $context View or edit context. |
1010 | 1010 | * @return string |
1011 | 1011 | */ |
1012 | - public function get_customer_country( $context = 'view' ) { |
|
1013 | - return $this->get_country( $context ); |
|
1012 | + public function get_customer_country($context = 'view') { |
|
1013 | + return $this->get_country($context); |
|
1014 | 1014 | } |
1015 | 1015 | |
1016 | 1016 | /** |
@@ -1020,9 +1020,9 @@ discard block |
||
1020 | 1020 | * @param string $context View or edit context. |
1021 | 1021 | * @return string |
1022 | 1022 | */ |
1023 | - public function get_state( $context = 'view' ) { |
|
1024 | - $state = $this->get_prop( 'state', $context ); |
|
1025 | - return empty( $state ) ? wpinv_get_default_state() : $state; |
|
1023 | + public function get_state($context = 'view') { |
|
1024 | + $state = $this->get_prop('state', $context); |
|
1025 | + return empty($state) ? wpinv_get_default_state() : $state; |
|
1026 | 1026 | } |
1027 | 1027 | |
1028 | 1028 | /** |
@@ -1032,8 +1032,8 @@ discard block |
||
1032 | 1032 | * @param string $context View or edit context. |
1033 | 1033 | * @return string |
1034 | 1034 | */ |
1035 | - public function get_user_state( $context = 'view' ) { |
|
1036 | - return $this->get_state( $context ); |
|
1035 | + public function get_user_state($context = 'view') { |
|
1036 | + return $this->get_state($context); |
|
1037 | 1037 | } |
1038 | 1038 | |
1039 | 1039 | /** |
@@ -1043,8 +1043,8 @@ discard block |
||
1043 | 1043 | * @param string $context View or edit context. |
1044 | 1044 | * @return string |
1045 | 1045 | */ |
1046 | - public function get_customer_state( $context = 'view' ) { |
|
1047 | - return $this->get_state( $context ); |
|
1046 | + public function get_customer_state($context = 'view') { |
|
1047 | + return $this->get_state($context); |
|
1048 | 1048 | } |
1049 | 1049 | |
1050 | 1050 | /** |
@@ -1054,8 +1054,8 @@ discard block |
||
1054 | 1054 | * @param string $context View or edit context. |
1055 | 1055 | * @return string |
1056 | 1056 | */ |
1057 | - public function get_city( $context = 'view' ) { |
|
1058 | - return $this->get_prop( 'city', $context ); |
|
1057 | + public function get_city($context = 'view') { |
|
1058 | + return $this->get_prop('city', $context); |
|
1059 | 1059 | } |
1060 | 1060 | |
1061 | 1061 | /** |
@@ -1065,8 +1065,8 @@ discard block |
||
1065 | 1065 | * @param string $context View or edit context. |
1066 | 1066 | * @return string |
1067 | 1067 | */ |
1068 | - public function get_user_city( $context = 'view' ) { |
|
1069 | - return $this->get_city( $context ); |
|
1068 | + public function get_user_city($context = 'view') { |
|
1069 | + return $this->get_city($context); |
|
1070 | 1070 | } |
1071 | 1071 | |
1072 | 1072 | /** |
@@ -1076,8 +1076,8 @@ discard block |
||
1076 | 1076 | * @param string $context View or edit context. |
1077 | 1077 | * @return string |
1078 | 1078 | */ |
1079 | - public function get_customer_city( $context = 'view' ) { |
|
1080 | - return $this->get_city( $context ); |
|
1079 | + public function get_customer_city($context = 'view') { |
|
1080 | + return $this->get_city($context); |
|
1081 | 1081 | } |
1082 | 1082 | |
1083 | 1083 | /** |
@@ -1087,8 +1087,8 @@ discard block |
||
1087 | 1087 | * @param string $context View or edit context. |
1088 | 1088 | * @return string |
1089 | 1089 | */ |
1090 | - public function get_zip( $context = 'view' ) { |
|
1091 | - return $this->get_prop( 'zip', $context ); |
|
1090 | + public function get_zip($context = 'view') { |
|
1091 | + return $this->get_prop('zip', $context); |
|
1092 | 1092 | } |
1093 | 1093 | |
1094 | 1094 | /** |
@@ -1098,8 +1098,8 @@ discard block |
||
1098 | 1098 | * @param string $context View or edit context. |
1099 | 1099 | * @return string |
1100 | 1100 | */ |
1101 | - public function get_user_zip( $context = 'view' ) { |
|
1102 | - return $this->get_zip( $context ); |
|
1101 | + public function get_user_zip($context = 'view') { |
|
1102 | + return $this->get_zip($context); |
|
1103 | 1103 | } |
1104 | 1104 | |
1105 | 1105 | /** |
@@ -1109,8 +1109,8 @@ discard block |
||
1109 | 1109 | * @param string $context View or edit context. |
1110 | 1110 | * @return string |
1111 | 1111 | */ |
1112 | - public function get_customer_zip( $context = 'view' ) { |
|
1113 | - return $this->get_zip( $context ); |
|
1112 | + public function get_customer_zip($context = 'view') { |
|
1113 | + return $this->get_zip($context); |
|
1114 | 1114 | } |
1115 | 1115 | |
1116 | 1116 | /** |
@@ -1120,8 +1120,8 @@ discard block |
||
1120 | 1120 | * @param string $context View or edit context. |
1121 | 1121 | * @return string |
1122 | 1122 | */ |
1123 | - public function get_company( $context = 'view' ) { |
|
1124 | - return $this->get_prop( 'company', $context ); |
|
1123 | + public function get_company($context = 'view') { |
|
1124 | + return $this->get_prop('company', $context); |
|
1125 | 1125 | } |
1126 | 1126 | |
1127 | 1127 | /** |
@@ -1131,8 +1131,8 @@ discard block |
||
1131 | 1131 | * @param string $context View or edit context. |
1132 | 1132 | * @return string |
1133 | 1133 | */ |
1134 | - public function get_user_company( $context = 'view' ) { |
|
1135 | - return $this->get_company( $context ); |
|
1134 | + public function get_user_company($context = 'view') { |
|
1135 | + return $this->get_company($context); |
|
1136 | 1136 | } |
1137 | 1137 | |
1138 | 1138 | /** |
@@ -1142,8 +1142,8 @@ discard block |
||
1142 | 1142 | * @param string $context View or edit context. |
1143 | 1143 | * @return string |
1144 | 1144 | */ |
1145 | - public function get_customer_company( $context = 'view' ) { |
|
1146 | - return $this->get_company( $context ); |
|
1145 | + public function get_customer_company($context = 'view') { |
|
1146 | + return $this->get_company($context); |
|
1147 | 1147 | } |
1148 | 1148 | |
1149 | 1149 | /** |
@@ -1153,8 +1153,8 @@ discard block |
||
1153 | 1153 | * @param string $context View or edit context. |
1154 | 1154 | * @return string |
1155 | 1155 | */ |
1156 | - public function get_vat_number( $context = 'view' ) { |
|
1157 | - return $this->get_prop( 'vat_number', $context ); |
|
1156 | + public function get_vat_number($context = 'view') { |
|
1157 | + return $this->get_prop('vat_number', $context); |
|
1158 | 1158 | } |
1159 | 1159 | |
1160 | 1160 | /** |
@@ -1164,8 +1164,8 @@ discard block |
||
1164 | 1164 | * @param string $context View or edit context. |
1165 | 1165 | * @return string |
1166 | 1166 | */ |
1167 | - public function get_user_vat_number( $context = 'view' ) { |
|
1168 | - return $this->get_vat_number( $context ); |
|
1167 | + public function get_user_vat_number($context = 'view') { |
|
1168 | + return $this->get_vat_number($context); |
|
1169 | 1169 | } |
1170 | 1170 | |
1171 | 1171 | /** |
@@ -1175,8 +1175,8 @@ discard block |
||
1175 | 1175 | * @param string $context View or edit context. |
1176 | 1176 | * @return string |
1177 | 1177 | */ |
1178 | - public function get_customer_vat_number( $context = 'view' ) { |
|
1179 | - return $this->get_vat_number( $context ); |
|
1178 | + public function get_customer_vat_number($context = 'view') { |
|
1179 | + return $this->get_vat_number($context); |
|
1180 | 1180 | } |
1181 | 1181 | |
1182 | 1182 | /** |
@@ -1186,8 +1186,8 @@ discard block |
||
1186 | 1186 | * @param string $context View or edit context. |
1187 | 1187 | * @return string |
1188 | 1188 | */ |
1189 | - public function get_vat_rate( $context = 'view' ) { |
|
1190 | - return $this->get_prop( 'vat_rate', $context ); |
|
1189 | + public function get_vat_rate($context = 'view') { |
|
1190 | + return $this->get_prop('vat_rate', $context); |
|
1191 | 1191 | } |
1192 | 1192 | |
1193 | 1193 | /** |
@@ -1197,8 +1197,8 @@ discard block |
||
1197 | 1197 | * @param string $context View or edit context. |
1198 | 1198 | * @return string |
1199 | 1199 | */ |
1200 | - public function get_user_vat_rate( $context = 'view' ) { |
|
1201 | - return $this->get_vat_rate( $context ); |
|
1200 | + public function get_user_vat_rate($context = 'view') { |
|
1201 | + return $this->get_vat_rate($context); |
|
1202 | 1202 | } |
1203 | 1203 | |
1204 | 1204 | /** |
@@ -1208,8 +1208,8 @@ discard block |
||
1208 | 1208 | * @param string $context View or edit context. |
1209 | 1209 | * @return string |
1210 | 1210 | */ |
1211 | - public function get_customer_vat_rate( $context = 'view' ) { |
|
1212 | - return $this->get_vat_rate( $context ); |
|
1211 | + public function get_customer_vat_rate($context = 'view') { |
|
1212 | + return $this->get_vat_rate($context); |
|
1213 | 1213 | } |
1214 | 1214 | |
1215 | 1215 | /** |
@@ -1219,8 +1219,8 @@ discard block |
||
1219 | 1219 | * @param string $context View or edit context. |
1220 | 1220 | * @return string |
1221 | 1221 | */ |
1222 | - public function get_address( $context = 'view' ) { |
|
1223 | - return $this->get_prop( 'address', $context ); |
|
1222 | + public function get_address($context = 'view') { |
|
1223 | + return $this->get_prop('address', $context); |
|
1224 | 1224 | } |
1225 | 1225 | |
1226 | 1226 | /** |
@@ -1230,8 +1230,8 @@ discard block |
||
1230 | 1230 | * @param string $context View or edit context. |
1231 | 1231 | * @return string |
1232 | 1232 | */ |
1233 | - public function get_user_address( $context = 'view' ) { |
|
1234 | - return $this->get_address( $context ); |
|
1233 | + public function get_user_address($context = 'view') { |
|
1234 | + return $this->get_address($context); |
|
1235 | 1235 | } |
1236 | 1236 | |
1237 | 1237 | /** |
@@ -1241,8 +1241,8 @@ discard block |
||
1241 | 1241 | * @param string $context View or edit context. |
1242 | 1242 | * @return string |
1243 | 1243 | */ |
1244 | - public function get_customer_address( $context = 'view' ) { |
|
1245 | - return $this->get_address( $context ); |
|
1244 | + public function get_customer_address($context = 'view') { |
|
1245 | + return $this->get_address($context); |
|
1246 | 1246 | } |
1247 | 1247 | |
1248 | 1248 | /** |
@@ -1252,8 +1252,8 @@ discard block |
||
1252 | 1252 | * @param string $context View or edit context. |
1253 | 1253 | * @return bool |
1254 | 1254 | */ |
1255 | - public function get_is_viewed( $context = 'view' ) { |
|
1256 | - return (bool) $this->get_prop( 'is_viewed', $context ); |
|
1255 | + public function get_is_viewed($context = 'view') { |
|
1256 | + return (bool) $this->get_prop('is_viewed', $context); |
|
1257 | 1257 | } |
1258 | 1258 | |
1259 | 1259 | /** |
@@ -1263,8 +1263,8 @@ discard block |
||
1263 | 1263 | * @param string $context View or edit context. |
1264 | 1264 | * @return bool |
1265 | 1265 | */ |
1266 | - public function get_email_cc( $context = 'view' ) { |
|
1267 | - return $this->get_prop( 'email_cc', $context ); |
|
1266 | + public function get_email_cc($context = 'view') { |
|
1267 | + return $this->get_prop('email_cc', $context); |
|
1268 | 1268 | } |
1269 | 1269 | |
1270 | 1270 | /** |
@@ -1274,8 +1274,8 @@ discard block |
||
1274 | 1274 | * @param string $context View or edit context. |
1275 | 1275 | * @return bool |
1276 | 1276 | */ |
1277 | - public function get_template( $context = 'view' ) { |
|
1278 | - return $this->get_prop( 'template', $context ); |
|
1277 | + public function get_template($context = 'view') { |
|
1278 | + return $this->get_prop('template', $context); |
|
1279 | 1279 | } |
1280 | 1280 | |
1281 | 1281 | /** |
@@ -1285,8 +1285,8 @@ discard block |
||
1285 | 1285 | * @param string $context View or edit context. |
1286 | 1286 | * @return bool |
1287 | 1287 | */ |
1288 | - public function get_created_via( $context = 'view' ) { |
|
1289 | - return $this->get_prop( 'created_via', $context ); |
|
1288 | + public function get_created_via($context = 'view') { |
|
1289 | + return $this->get_prop('created_via', $context); |
|
1290 | 1290 | } |
1291 | 1291 | |
1292 | 1292 | /** |
@@ -1296,8 +1296,8 @@ discard block |
||
1296 | 1296 | * @param string $context View or edit context. |
1297 | 1297 | * @return bool |
1298 | 1298 | */ |
1299 | - public function get_address_confirmed( $context = 'view' ) { |
|
1300 | - return (bool) $this->get_prop( 'address_confirmed', $context ); |
|
1299 | + public function get_address_confirmed($context = 'view') { |
|
1300 | + return (bool) $this->get_prop('address_confirmed', $context); |
|
1301 | 1301 | } |
1302 | 1302 | |
1303 | 1303 | /** |
@@ -1307,8 +1307,8 @@ discard block |
||
1307 | 1307 | * @param string $context View or edit context. |
1308 | 1308 | * @return bool |
1309 | 1309 | */ |
1310 | - public function get_user_address_confirmed( $context = 'view' ) { |
|
1311 | - return $this->get_address_confirmed( $context ); |
|
1310 | + public function get_user_address_confirmed($context = 'view') { |
|
1311 | + return $this->get_address_confirmed($context); |
|
1312 | 1312 | } |
1313 | 1313 | |
1314 | 1314 | /** |
@@ -1318,8 +1318,8 @@ discard block |
||
1318 | 1318 | * @param string $context View or edit context. |
1319 | 1319 | * @return bool |
1320 | 1320 | */ |
1321 | - public function get_customer_address_confirmed( $context = 'view' ) { |
|
1322 | - return $this->get_address_confirmed( $context ); |
|
1321 | + public function get_customer_address_confirmed($context = 'view') { |
|
1322 | + return $this->get_address_confirmed($context); |
|
1323 | 1323 | } |
1324 | 1324 | |
1325 | 1325 | /** |
@@ -1329,12 +1329,12 @@ discard block |
||
1329 | 1329 | * @param string $context View or edit context. |
1330 | 1330 | * @return float |
1331 | 1331 | */ |
1332 | - public function get_subtotal( $context = 'view' ) { |
|
1333 | - $subtotal = (float) $this->get_prop( 'subtotal', $context ); |
|
1332 | + public function get_subtotal($context = 'view') { |
|
1333 | + $subtotal = (float) $this->get_prop('subtotal', $context); |
|
1334 | 1334 | |
1335 | 1335 | // Backwards compatibility. |
1336 | - if ( is_bool( $context ) && $context ) { |
|
1337 | - return wpinv_price( wpinv_format_amount( $subtotal ), $this->get_currency() ); |
|
1336 | + if (is_bool($context) && $context) { |
|
1337 | + return wpinv_price(wpinv_format_amount($subtotal), $this->get_currency()); |
|
1338 | 1338 | } |
1339 | 1339 | |
1340 | 1340 | return $subtotal; |
@@ -1347,8 +1347,8 @@ discard block |
||
1347 | 1347 | * @param string $context View or edit context. |
1348 | 1348 | * @return float |
1349 | 1349 | */ |
1350 | - public function get_total_discount( $context = 'view' ) { |
|
1351 | - return (float) $this->get_prop( 'total_discount', $context ); |
|
1350 | + public function get_total_discount($context = 'view') { |
|
1351 | + return (float) $this->get_prop('total_discount', $context); |
|
1352 | 1352 | } |
1353 | 1353 | |
1354 | 1354 | /** |
@@ -1358,18 +1358,18 @@ discard block |
||
1358 | 1358 | * @param string $context View or edit context. |
1359 | 1359 | * @return float |
1360 | 1360 | */ |
1361 | - public function get_total_tax( $context = 'view' ) { |
|
1362 | - return (float) $this->get_prop( 'total_tax', $context ); |
|
1361 | + public function get_total_tax($context = 'view') { |
|
1362 | + return (float) $this->get_prop('total_tax', $context); |
|
1363 | 1363 | } |
1364 | 1364 | |
1365 | 1365 | /** |
1366 | 1366 | * @deprecated |
1367 | 1367 | */ |
1368 | - public function get_final_tax( $currency = false ) { |
|
1368 | + public function get_final_tax($currency = false) { |
|
1369 | 1369 | $tax = $this->get_total_tax(); |
1370 | 1370 | |
1371 | - if ( $currency ) { |
|
1372 | - return wpinv_price( $tax, $this->get_currency() ); |
|
1371 | + if ($currency) { |
|
1372 | + return wpinv_price($tax, $this->get_currency()); |
|
1373 | 1373 | } |
1374 | 1374 | |
1375 | 1375 | return $tax; |
@@ -1382,8 +1382,8 @@ discard block |
||
1382 | 1382 | * @param string $context View or edit context. |
1383 | 1383 | * @return float |
1384 | 1384 | */ |
1385 | - public function get_total_fees( $context = 'view' ) { |
|
1386 | - return (float) $this->get_prop( 'total_fees', $context ); |
|
1385 | + public function get_total_fees($context = 'view') { |
|
1386 | + return (float) $this->get_prop('total_fees', $context); |
|
1387 | 1387 | } |
1388 | 1388 | |
1389 | 1389 | /** |
@@ -1393,8 +1393,8 @@ discard block |
||
1393 | 1393 | * @param string $context View or edit context. |
1394 | 1394 | * @return float |
1395 | 1395 | */ |
1396 | - public function get_fees_total( $context = 'view' ) { |
|
1397 | - return $this->get_total_fees( $context ); |
|
1396 | + public function get_fees_total($context = 'view') { |
|
1397 | + return $this->get_total_fees($context); |
|
1398 | 1398 | } |
1399 | 1399 | |
1400 | 1400 | /** |
@@ -1405,7 +1405,7 @@ discard block |
||
1405 | 1405 | */ |
1406 | 1406 | public function get_total() { |
1407 | 1407 | $total = $this->is_renewal() ? $this->get_recurring_total() : $this->get_initial_total(); |
1408 | - return apply_filters( 'getpaid_get_invoice_total_amount', $total, $this ); |
|
1408 | + return apply_filters('getpaid_get_invoice_total_amount', $total, $this); |
|
1409 | 1409 | } |
1410 | 1410 | |
1411 | 1411 | /** |
@@ -1427,7 +1427,7 @@ discard block |
||
1427 | 1427 | */ |
1428 | 1428 | public function get_initial_total() { |
1429 | 1429 | |
1430 | - if ( empty( $this->totals ) ) { |
|
1430 | + if (empty($this->totals)) { |
|
1431 | 1431 | $this->recalculate_total(); |
1432 | 1432 | } |
1433 | 1433 | |
@@ -1437,11 +1437,11 @@ discard block |
||
1437 | 1437 | $subtotal = $this->totals['subtotal']['initial']; |
1438 | 1438 | $total = $tax + $fee - $discount + $subtotal; |
1439 | 1439 | |
1440 | - if ( 0 > $total ) { |
|
1440 | + if (0 > $total) { |
|
1441 | 1441 | $total = 0; |
1442 | 1442 | } |
1443 | 1443 | |
1444 | - return apply_filters( 'wpinv_get_initial_invoice_total', $total, $this ); |
|
1444 | + return apply_filters('wpinv_get_initial_invoice_total', $total, $this); |
|
1445 | 1445 | } |
1446 | 1446 | |
1447 | 1447 | /** |
@@ -1453,7 +1453,7 @@ discard block |
||
1453 | 1453 | */ |
1454 | 1454 | public function get_recurring_total() { |
1455 | 1455 | |
1456 | - if ( empty( $this->totals ) ) { |
|
1456 | + if (empty($this->totals)) { |
|
1457 | 1457 | $this->recalculate_total(); |
1458 | 1458 | } |
1459 | 1459 | |
@@ -1463,11 +1463,11 @@ discard block |
||
1463 | 1463 | $subtotal = $this->totals['subtotal']['recurring']; |
1464 | 1464 | $total = $tax + $fee - $discount + $subtotal; |
1465 | 1465 | |
1466 | - if ( 0 > $total ) { |
|
1466 | + if (0 > $total) { |
|
1467 | 1467 | $total = 0; |
1468 | 1468 | } |
1469 | 1469 | |
1470 | - return apply_filters( 'wpinv_get_recurring_invoice_total', $total, $this ); |
|
1470 | + return apply_filters('wpinv_get_recurring_invoice_total', $total, $this); |
|
1471 | 1471 | } |
1472 | 1472 | |
1473 | 1473 | /** |
@@ -1478,10 +1478,10 @@ discard block |
||
1478 | 1478 | * @param string $currency Whether to include the currency. |
1479 | 1479 | * @return float|string |
1480 | 1480 | */ |
1481 | - public function get_recurring_details( $field = '', $currency = false ) { |
|
1481 | + public function get_recurring_details($field = '', $currency = false) { |
|
1482 | 1482 | |
1483 | 1483 | // Maybe recalculate totals. |
1484 | - if ( empty( $this->totals ) ) { |
|
1484 | + if (empty($this->totals)) { |
|
1485 | 1485 | $this->recalculate_total(); |
1486 | 1486 | } |
1487 | 1487 | |
@@ -1501,8 +1501,8 @@ discard block |
||
1501 | 1501 | $currency |
1502 | 1502 | ); |
1503 | 1503 | |
1504 | - if ( isset( $data[$field] ) ) { |
|
1505 | - return ( $currency ? wpinv_price( $data[$field], $this->get_currency() ) : $data[$field] ); |
|
1504 | + if (isset($data[$field])) { |
|
1505 | + return ($currency ? wpinv_price($data[$field], $this->get_currency()) : $data[$field]); |
|
1506 | 1506 | } |
1507 | 1507 | |
1508 | 1508 | return $data; |
@@ -1515,8 +1515,8 @@ discard block |
||
1515 | 1515 | * @param string $context View or edit context. |
1516 | 1516 | * @return array |
1517 | 1517 | */ |
1518 | - public function get_fees( $context = 'view' ) { |
|
1519 | - return wpinv_parse_list( $this->get_prop( 'fees', $context ) ); |
|
1518 | + public function get_fees($context = 'view') { |
|
1519 | + return wpinv_parse_list($this->get_prop('fees', $context)); |
|
1520 | 1520 | } |
1521 | 1521 | |
1522 | 1522 | /** |
@@ -1526,8 +1526,8 @@ discard block |
||
1526 | 1526 | * @param string $context View or edit context. |
1527 | 1527 | * @return array |
1528 | 1528 | */ |
1529 | - public function get_discounts( $context = 'view' ) { |
|
1530 | - return wpinv_parse_list( $this->get_prop( 'discounts', $context ) ); |
|
1529 | + public function get_discounts($context = 'view') { |
|
1530 | + return wpinv_parse_list($this->get_prop('discounts', $context)); |
|
1531 | 1531 | } |
1532 | 1532 | |
1533 | 1533 | /** |
@@ -1537,8 +1537,8 @@ discard block |
||
1537 | 1537 | * @param string $context View or edit context. |
1538 | 1538 | * @return array |
1539 | 1539 | */ |
1540 | - public function get_taxes( $context = 'view' ) { |
|
1541 | - return wpinv_parse_list( $this->get_prop( 'taxes', $context ) ); |
|
1540 | + public function get_taxes($context = 'view') { |
|
1541 | + return wpinv_parse_list($this->get_prop('taxes', $context)); |
|
1542 | 1542 | } |
1543 | 1543 | |
1544 | 1544 | /** |
@@ -1548,8 +1548,8 @@ discard block |
||
1548 | 1548 | * @param string $context View or edit context. |
1549 | 1549 | * @return GetPaid_Form_Item[] |
1550 | 1550 | */ |
1551 | - public function get_items( $context = 'view' ) { |
|
1552 | - return $this->get_prop( 'items', $context ); |
|
1551 | + public function get_items($context = 'view') { |
|
1552 | + return $this->get_prop('items', $context); |
|
1553 | 1553 | } |
1554 | 1554 | |
1555 | 1555 | /** |
@@ -1559,7 +1559,7 @@ discard block |
||
1559 | 1559 | * @return string |
1560 | 1560 | */ |
1561 | 1561 | public function get_item_ids() { |
1562 | - return implode( ', ', wp_list_pluck( $this->get_cart_details(), 'item_id' ) ); |
|
1562 | + return implode(', ', wp_list_pluck($this->get_cart_details(), 'item_id')); |
|
1563 | 1563 | } |
1564 | 1564 | |
1565 | 1565 | /** |
@@ -1569,8 +1569,8 @@ discard block |
||
1569 | 1569 | * @param string $context View or edit context. |
1570 | 1570 | * @return int |
1571 | 1571 | */ |
1572 | - public function get_payment_form( $context = 'view' ) { |
|
1573 | - return intval( $this->get_prop( 'payment_form', $context ) ); |
|
1572 | + public function get_payment_form($context = 'view') { |
|
1573 | + return intval($this->get_prop('payment_form', $context)); |
|
1574 | 1574 | } |
1575 | 1575 | |
1576 | 1576 | /** |
@@ -1580,8 +1580,8 @@ discard block |
||
1580 | 1580 | * @param string $context View or edit context. |
1581 | 1581 | * @return string |
1582 | 1582 | */ |
1583 | - public function get_submission_id( $context = 'view' ) { |
|
1584 | - return $this->get_prop( 'submission_id', $context ); |
|
1583 | + public function get_submission_id($context = 'view') { |
|
1584 | + return $this->get_prop('submission_id', $context); |
|
1585 | 1585 | } |
1586 | 1586 | |
1587 | 1587 | /** |
@@ -1591,8 +1591,8 @@ discard block |
||
1591 | 1591 | * @param string $context View or edit context. |
1592 | 1592 | * @return string |
1593 | 1593 | */ |
1594 | - public function get_discount_code( $context = 'view' ) { |
|
1595 | - return $this->get_prop( 'discount_code', $context ); |
|
1594 | + public function get_discount_code($context = 'view') { |
|
1595 | + return $this->get_prop('discount_code', $context); |
|
1596 | 1596 | } |
1597 | 1597 | |
1598 | 1598 | /** |
@@ -1602,8 +1602,8 @@ discard block |
||
1602 | 1602 | * @param string $context View or edit context. |
1603 | 1603 | * @return string |
1604 | 1604 | */ |
1605 | - public function get_gateway( $context = 'view' ) { |
|
1606 | - return $this->get_prop( 'gateway', $context ); |
|
1605 | + public function get_gateway($context = 'view') { |
|
1606 | + return $this->get_prop('gateway', $context); |
|
1607 | 1607 | } |
1608 | 1608 | |
1609 | 1609 | /** |
@@ -1613,8 +1613,8 @@ discard block |
||
1613 | 1613 | * @return string |
1614 | 1614 | */ |
1615 | 1615 | public function get_gateway_title() { |
1616 | - $title = wpinv_get_gateway_checkout_label( $this->get_gateway() ); |
|
1617 | - return apply_filters( 'wpinv_gateway_title', $title, $this->get_id(), $this ); |
|
1616 | + $title = wpinv_get_gateway_checkout_label($this->get_gateway()); |
|
1617 | + return apply_filters('wpinv_gateway_title', $title, $this->get_id(), $this); |
|
1618 | 1618 | } |
1619 | 1619 | |
1620 | 1620 | /** |
@@ -1624,8 +1624,8 @@ discard block |
||
1624 | 1624 | * @param string $context View or edit context. |
1625 | 1625 | * @return string |
1626 | 1626 | */ |
1627 | - public function get_transaction_id( $context = 'view' ) { |
|
1628 | - return $this->get_prop( 'transaction_id', $context ); |
|
1627 | + public function get_transaction_id($context = 'view') { |
|
1628 | + return $this->get_prop('transaction_id', $context); |
|
1629 | 1629 | } |
1630 | 1630 | |
1631 | 1631 | /** |
@@ -1635,9 +1635,9 @@ discard block |
||
1635 | 1635 | * @param string $context View or edit context. |
1636 | 1636 | * @return string |
1637 | 1637 | */ |
1638 | - public function get_currency( $context = 'view' ) { |
|
1639 | - $currency = $this->get_prop( 'currency', $context ); |
|
1640 | - return empty( $currency ) ? wpinv_get_currency() : $currency; |
|
1638 | + public function get_currency($context = 'view') { |
|
1639 | + $currency = $this->get_prop('currency', $context); |
|
1640 | + return empty($currency) ? wpinv_get_currency() : $currency; |
|
1641 | 1641 | } |
1642 | 1642 | |
1643 | 1643 | /** |
@@ -1647,8 +1647,8 @@ discard block |
||
1647 | 1647 | * @param string $context View or edit context. |
1648 | 1648 | * @return bool |
1649 | 1649 | */ |
1650 | - public function get_disable_taxes( $context = 'view' ) { |
|
1651 | - return (bool) $this->get_prop( 'disable_taxes', $context ); |
|
1650 | + public function get_disable_taxes($context = 'view') { |
|
1651 | + return (bool) $this->get_prop('disable_taxes', $context); |
|
1652 | 1652 | } |
1653 | 1653 | |
1654 | 1654 | /** |
@@ -1658,8 +1658,8 @@ discard block |
||
1658 | 1658 | * @param string $context View or edit context. |
1659 | 1659 | * @return int |
1660 | 1660 | */ |
1661 | - public function get_subscription_id( $context = 'view' ) { |
|
1662 | - return $this->is_renewal() ? $this->get_parent()->get_subscription_id( $context ) : $this->get_prop( 'subscription_id', $context ); |
|
1661 | + public function get_subscription_id($context = 'view') { |
|
1662 | + return $this->is_renewal() ? $this->get_parent()->get_subscription_id($context) : $this->get_prop('subscription_id', $context); |
|
1663 | 1663 | } |
1664 | 1664 | |
1665 | 1665 | /** |
@@ -1669,12 +1669,12 @@ discard block |
||
1669 | 1669 | * @param string $context View or edit context. |
1670 | 1670 | * @return int |
1671 | 1671 | */ |
1672 | - public function get_remote_subscription_id( $context = 'view' ) { |
|
1673 | - $subscription_id = $this->get_prop( 'remote_subscription_id', $context ); |
|
1672 | + public function get_remote_subscription_id($context = 'view') { |
|
1673 | + $subscription_id = $this->get_prop('remote_subscription_id', $context); |
|
1674 | 1674 | |
1675 | - if ( empty( $subscription_id ) && $this->is_renewal() ) { |
|
1675 | + if (empty($subscription_id) && $this->is_renewal()) { |
|
1676 | 1676 | $parent = $this->get_parent(); |
1677 | - return $parent->get_subscription_id( $context ); |
|
1677 | + return $parent->get_subscription_id($context); |
|
1678 | 1678 | } |
1679 | 1679 | |
1680 | 1680 | return $subscription_id; |
@@ -1687,20 +1687,20 @@ discard block |
||
1687 | 1687 | * @param string $context View or edit context. |
1688 | 1688 | * @return array |
1689 | 1689 | */ |
1690 | - public function get_payment_meta( $context = 'view' ) { |
|
1690 | + public function get_payment_meta($context = 'view') { |
|
1691 | 1691 | |
1692 | 1692 | return array( |
1693 | - 'price' => $this->get_total( $context ), |
|
1694 | - 'date' => $this->get_date_created( $context ), |
|
1695 | - 'user_email' => $this->get_email( $context ), |
|
1696 | - 'invoice_key' => $this->get_key( $context ), |
|
1697 | - 'currency' => $this->get_currency( $context ), |
|
1698 | - 'items' => $this->get_items( $context ), |
|
1699 | - 'user_info' => $this->get_user_info( $context ), |
|
1693 | + 'price' => $this->get_total($context), |
|
1694 | + 'date' => $this->get_date_created($context), |
|
1695 | + 'user_email' => $this->get_email($context), |
|
1696 | + 'invoice_key' => $this->get_key($context), |
|
1697 | + 'currency' => $this->get_currency($context), |
|
1698 | + 'items' => $this->get_items($context), |
|
1699 | + 'user_info' => $this->get_user_info($context), |
|
1700 | 1700 | 'cart_details' => $this->get_cart_details(), |
1701 | - 'status' => $this->get_status( $context ), |
|
1702 | - 'fees' => $this->get_fees( $context ), |
|
1703 | - 'taxes' => $this->get_taxes( $context ), |
|
1701 | + 'status' => $this->get_status($context), |
|
1702 | + 'fees' => $this->get_fees($context), |
|
1703 | + 'taxes' => $this->get_taxes($context), |
|
1704 | 1704 | ); |
1705 | 1705 | |
1706 | 1706 | } |
@@ -1715,9 +1715,9 @@ discard block |
||
1715 | 1715 | $items = $this->get_items(); |
1716 | 1716 | $cart_details = array(); |
1717 | 1717 | |
1718 | - foreach ( $items as $item ) { |
|
1718 | + foreach ($items as $item) { |
|
1719 | 1719 | $item->invoice_id = $this->get_id(); |
1720 | - $cart_details[] = $item->prepare_data_for_saving(); |
|
1720 | + $cart_details[] = $item->prepare_data_for_saving(); |
|
1721 | 1721 | } |
1722 | 1722 | |
1723 | 1723 | return $cart_details; |
@@ -1728,11 +1728,11 @@ discard block |
||
1728 | 1728 | * |
1729 | 1729 | * @return null|GetPaid_Form_Item|int |
1730 | 1730 | */ |
1731 | - public function get_recurring( $object = false ) { |
|
1731 | + public function get_recurring($object = false) { |
|
1732 | 1732 | |
1733 | 1733 | // Are we returning an object? |
1734 | - if ( $object ) { |
|
1735 | - return $this->get_item( $this->recurring_item ); |
|
1734 | + if ($object) { |
|
1735 | + return $this->get_item($this->recurring_item); |
|
1736 | 1736 | } |
1737 | 1737 | |
1738 | 1738 | return $this->recurring_item; |
@@ -1747,15 +1747,15 @@ discard block |
||
1747 | 1747 | public function get_subscription_name() { |
1748 | 1748 | |
1749 | 1749 | // Retrieve the recurring name |
1750 | - $item = $this->get_recurring( true ); |
|
1750 | + $item = $this->get_recurring(true); |
|
1751 | 1751 | |
1752 | 1752 | // Abort if it does not exist. |
1753 | - if ( empty( $item ) ) { |
|
1753 | + if (empty($item)) { |
|
1754 | 1754 | return ''; |
1755 | 1755 | } |
1756 | 1756 | |
1757 | 1757 | // Return the item name. |
1758 | - return apply_filters( 'wpinv_invoice_get_subscription_name', $item->get_name(), $this ); |
|
1758 | + return apply_filters('wpinv_invoice_get_subscription_name', $item->get_name(), $this); |
|
1759 | 1759 | } |
1760 | 1760 | |
1761 | 1761 | /** |
@@ -1765,9 +1765,9 @@ discard block |
||
1765 | 1765 | * @return string |
1766 | 1766 | */ |
1767 | 1767 | public function get_view_url() { |
1768 | - $invoice_url = get_permalink( $this->get_id() ); |
|
1769 | - $invoice_url = add_query_arg( 'invoice_key', $this->get_key(), $invoice_url ); |
|
1770 | - return apply_filters( 'wpinv_get_view_url', $invoice_url, $this ); |
|
1768 | + $invoice_url = get_permalink($this->get_id()); |
|
1769 | + $invoice_url = add_query_arg('invoice_key', $this->get_key(), $invoice_url); |
|
1770 | + return apply_filters('wpinv_get_view_url', $invoice_url, $this); |
|
1771 | 1771 | } |
1772 | 1772 | |
1773 | 1773 | /** |
@@ -1776,25 +1776,25 @@ discard block |
||
1776 | 1776 | * @since 1.0.19 |
1777 | 1777 | * @return string |
1778 | 1778 | */ |
1779 | - public function get_checkout_payment_url( $deprecated = false, $secret = false ) { |
|
1779 | + public function get_checkout_payment_url($deprecated = false, $secret = false) { |
|
1780 | 1780 | |
1781 | 1781 | // Retrieve the checkout url. |
1782 | 1782 | $pay_url = wpinv_get_checkout_uri(); |
1783 | 1783 | |
1784 | 1784 | // Maybe force ssl. |
1785 | - if ( is_ssl() ) { |
|
1786 | - $pay_url = str_replace( 'http:', 'https:', $pay_url ); |
|
1785 | + if (is_ssl()) { |
|
1786 | + $pay_url = str_replace('http:', 'https:', $pay_url); |
|
1787 | 1787 | } |
1788 | 1788 | |
1789 | 1789 | // Add the invoice key. |
1790 | - $pay_url = add_query_arg( 'invoice_key', $this->get_key(), $pay_url ); |
|
1790 | + $pay_url = add_query_arg('invoice_key', $this->get_key(), $pay_url); |
|
1791 | 1791 | |
1792 | 1792 | // (Maybe?) add a secret |
1793 | - if ( $secret ) { |
|
1794 | - $pay_url = add_query_arg( array( '_wpipay' => md5( $this->get_user_id() . '::' . $this->get_email() . '::' . $this->get_key() ) ), $pay_url ); |
|
1793 | + if ($secret) { |
|
1794 | + $pay_url = add_query_arg(array('_wpipay' => md5($this->get_user_id() . '::' . $this->get_email() . '::' . $this->get_key())), $pay_url); |
|
1795 | 1795 | } |
1796 | 1796 | |
1797 | - return apply_filters( 'wpinv_get_checkout_payment_url', $pay_url, $this, $deprecated, $secret ); |
|
1797 | + return apply_filters('wpinv_get_checkout_payment_url', $pay_url, $this, $deprecated, $secret); |
|
1798 | 1798 | } |
1799 | 1799 | |
1800 | 1800 | /** |
@@ -1809,14 +1809,14 @@ discard block |
||
1809 | 1809 | $receipt_url = wpinv_get_success_page_uri(); |
1810 | 1810 | |
1811 | 1811 | // Maybe force ssl. |
1812 | - if ( is_ssl() ) { |
|
1813 | - $receipt_url = str_replace( 'http:', 'https:', $receipt_url ); |
|
1812 | + if (is_ssl()) { |
|
1813 | + $receipt_url = str_replace('http:', 'https:', $receipt_url); |
|
1814 | 1814 | } |
1815 | 1815 | |
1816 | 1816 | // Add the invoice key. |
1817 | - $receipt_url = add_query_arg( 'invoice_key', $this->get_key(), $receipt_url ); |
|
1817 | + $receipt_url = add_query_arg('invoice_key', $this->get_key(), $receipt_url); |
|
1818 | 1818 | |
1819 | - return apply_filters( 'getpaid_get_invoice_receipt_url', $receipt_url, $this ); |
|
1819 | + return apply_filters('getpaid_get_invoice_receipt_url', $receipt_url, $this); |
|
1820 | 1820 | } |
1821 | 1821 | |
1822 | 1822 | /** |
@@ -1829,7 +1829,7 @@ discard block |
||
1829 | 1829 | |
1830 | 1830 | $type = $this->get_type(); |
1831 | 1831 | $status = "wpi-$type-pending"; |
1832 | - return str_replace( '-invoice', '', $status ); |
|
1832 | + return str_replace('-invoice', '', $status); |
|
1833 | 1833 | |
1834 | 1834 | } |
1835 | 1835 | |
@@ -1843,8 +1843,8 @@ discard block |
||
1843 | 1843 | * @param string $context View or edit context. |
1844 | 1844 | * @return mixed Value of the given invoice property (if set). |
1845 | 1845 | */ |
1846 | - public function get( $key, $context = 'view' ) { |
|
1847 | - return $this->get_prop( $key, $context ); |
|
1846 | + public function get($key, $context = 'view') { |
|
1847 | + return $this->get_prop($key, $context); |
|
1848 | 1848 | } |
1849 | 1849 | |
1850 | 1850 | /* |
@@ -1867,11 +1867,11 @@ discard block |
||
1867 | 1867 | * @param mixed $value new value. |
1868 | 1868 | * @return mixed Value of the given invoice property (if set). |
1869 | 1869 | */ |
1870 | - public function set( $key, $value ) { |
|
1870 | + public function set($key, $value) { |
|
1871 | 1871 | |
1872 | 1872 | $setter = "set_$key"; |
1873 | - if ( is_callable( array( $this, $setter ) ) ) { |
|
1874 | - $this->{$setter}( $value ); |
|
1873 | + if (is_callable(array($this, $setter))) { |
|
1874 | + $this->{$setter}($value); |
|
1875 | 1875 | } |
1876 | 1876 | |
1877 | 1877 | } |
@@ -1885,47 +1885,47 @@ discard block |
||
1885 | 1885 | * @param bool $manual_update Is this a manual status change?. |
1886 | 1886 | * @return array details of change. |
1887 | 1887 | */ |
1888 | - public function set_status( $new_status, $note = '', $manual_update = false ) { |
|
1888 | + public function set_status($new_status, $note = '', $manual_update = false) { |
|
1889 | 1889 | $old_status = $this->get_status(); |
1890 | 1890 | |
1891 | 1891 | $statuses = $this->get_all_statuses(); |
1892 | 1892 | |
1893 | - if ( isset( $statuses[ 'draft' ] ) ) { |
|
1894 | - unset( $statuses[ 'draft' ] ); |
|
1893 | + if (isset($statuses['draft'])) { |
|
1894 | + unset($statuses['draft']); |
|
1895 | 1895 | } |
1896 | 1896 | |
1897 | - $this->set_prop( 'status', $new_status ); |
|
1897 | + $this->set_prop('status', $new_status); |
|
1898 | 1898 | |
1899 | 1899 | // If setting the status, ensure it's set to a valid status. |
1900 | - if ( true === $this->object_read ) { |
|
1900 | + if (true === $this->object_read) { |
|
1901 | 1901 | |
1902 | 1902 | // Only allow valid new status. |
1903 | - if ( ! array_key_exists( $new_status, $statuses ) ) { |
|
1903 | + if (!array_key_exists($new_status, $statuses)) { |
|
1904 | 1904 | $new_status = $this->get_default_status(); |
1905 | 1905 | } |
1906 | 1906 | |
1907 | 1907 | // If the old status is set but unknown (e.g. draft) assume its pending for action usage. |
1908 | - if ( $old_status && ! array_key_exists( $new_status, $statuses ) ) { |
|
1908 | + if ($old_status && !array_key_exists($new_status, $statuses)) { |
|
1909 | 1909 | $old_status = $this->get_default_status(); |
1910 | 1910 | } |
1911 | 1911 | |
1912 | 1912 | // Paid - Renewal (i.e when duplicating a parent invoice ) |
1913 | - if ( $new_status == 'wpi-pending' && $old_status == 'publish' && ! $this->get_id() ) { |
|
1913 | + if ($new_status == 'wpi-pending' && $old_status == 'publish' && !$this->get_id()) { |
|
1914 | 1914 | $old_status = 'wpi-pending'; |
1915 | 1915 | } |
1916 | 1916 | |
1917 | 1917 | } |
1918 | 1918 | |
1919 | - if ( true === $this->object_read && $old_status !== $new_status ) { |
|
1919 | + if (true === $this->object_read && $old_status !== $new_status) { |
|
1920 | 1920 | $this->status_transition = array( |
1921 | - 'from' => ! empty( $this->status_transition['from'] ) ? $this->status_transition['from'] : $old_status, |
|
1921 | + 'from' => !empty($this->status_transition['from']) ? $this->status_transition['from'] : $old_status, |
|
1922 | 1922 | 'to' => $new_status, |
1923 | 1923 | 'note' => $note, |
1924 | 1924 | 'manual' => (bool) $manual_update, |
1925 | 1925 | ); |
1926 | 1926 | |
1927 | - if ( $manual_update ) { |
|
1928 | - do_action( 'getpaid_' . $this->object_type .'_edit_status', $this->get_id(), $new_status ); |
|
1927 | + if ($manual_update) { |
|
1928 | + do_action('getpaid_' . $this->object_type . '_edit_status', $this->get_id(), $new_status); |
|
1929 | 1929 | } |
1930 | 1930 | |
1931 | 1931 | $this->maybe_set_date_paid(); |
@@ -1948,8 +1948,8 @@ discard block |
||
1948 | 1948 | */ |
1949 | 1949 | public function maybe_set_date_paid() { |
1950 | 1950 | |
1951 | - if ( ! $this->get_date_completed( 'edit' ) && $this->is_paid() ) { |
|
1952 | - $this->set_date_completed( current_time( 'mysql' ) ); |
|
1951 | + if (!$this->get_date_completed('edit') && $this->is_paid()) { |
|
1952 | + $this->set_date_completed(current_time('mysql')); |
|
1953 | 1953 | } |
1954 | 1954 | } |
1955 | 1955 | |
@@ -1958,11 +1958,11 @@ discard block |
||
1958 | 1958 | * |
1959 | 1959 | * @since 1.0.19 |
1960 | 1960 | */ |
1961 | - public function set_parent_id( $value ) { |
|
1962 | - if ( $value && ( $value === $this->get_id() ) ) { |
|
1961 | + public function set_parent_id($value) { |
|
1962 | + if ($value && ($value === $this->get_id())) { |
|
1963 | 1963 | return; |
1964 | 1964 | } |
1965 | - $this->set_prop( 'parent_id', absint( $value ) ); |
|
1965 | + $this->set_prop('parent_id', absint($value)); |
|
1966 | 1966 | } |
1967 | 1967 | |
1968 | 1968 | /** |
@@ -1970,8 +1970,8 @@ discard block |
||
1970 | 1970 | * |
1971 | 1971 | * @since 1.0.19 |
1972 | 1972 | */ |
1973 | - public function set_version( $value ) { |
|
1974 | - $this->set_prop( 'version', $value ); |
|
1973 | + public function set_version($value) { |
|
1974 | + $this->set_prop('version', $value); |
|
1975 | 1975 | } |
1976 | 1976 | |
1977 | 1977 | /** |
@@ -1981,15 +1981,15 @@ discard block |
||
1981 | 1981 | * @param string $value Value to set. |
1982 | 1982 | * @return bool Whether or not the date was set. |
1983 | 1983 | */ |
1984 | - public function set_date_created( $value ) { |
|
1985 | - $date = strtotime( $value ); |
|
1984 | + public function set_date_created($value) { |
|
1985 | + $date = strtotime($value); |
|
1986 | 1986 | |
1987 | - if ( $date && $value !== '0000-00-00 00:00:00' ) { |
|
1988 | - $this->set_prop( 'date_created', date( 'Y-m-d H:i:s', $date ) ); |
|
1987 | + if ($date && $value !== '0000-00-00 00:00:00') { |
|
1988 | + $this->set_prop('date_created', date('Y-m-d H:i:s', $date)); |
|
1989 | 1989 | return true; |
1990 | 1990 | } |
1991 | 1991 | |
1992 | - $this->set_prop( 'date_created', '' ); |
|
1992 | + $this->set_prop('date_created', ''); |
|
1993 | 1993 | return false; |
1994 | 1994 | |
1995 | 1995 | } |
@@ -2001,15 +2001,15 @@ discard block |
||
2001 | 2001 | * @param string $value Value to set. |
2002 | 2002 | * @return bool Whether or not the date was set. |
2003 | 2003 | */ |
2004 | - public function set_due_date( $value ) { |
|
2005 | - $date = strtotime( $value ); |
|
2004 | + public function set_due_date($value) { |
|
2005 | + $date = strtotime($value); |
|
2006 | 2006 | |
2007 | - if ( $date && $value !== '0000-00-00 00:00:00' ) { |
|
2008 | - $this->set_prop( 'due_date', date( 'Y-m-d H:i:s', $date ) ); |
|
2007 | + if ($date && $value !== '0000-00-00 00:00:00') { |
|
2008 | + $this->set_prop('due_date', date('Y-m-d H:i:s', $date)); |
|
2009 | 2009 | return true; |
2010 | 2010 | } |
2011 | 2011 | |
2012 | - $this->set_prop( 'due_date', '' ); |
|
2012 | + $this->set_prop('due_date', ''); |
|
2013 | 2013 | return false; |
2014 | 2014 | |
2015 | 2015 | } |
@@ -2020,8 +2020,8 @@ discard block |
||
2020 | 2020 | * @since 1.0.19 |
2021 | 2021 | * @param string $value New name. |
2022 | 2022 | */ |
2023 | - public function set_date_due( $value ) { |
|
2024 | - $this->set_due_date( $value ); |
|
2023 | + public function set_date_due($value) { |
|
2024 | + $this->set_due_date($value); |
|
2025 | 2025 | } |
2026 | 2026 | |
2027 | 2027 | /** |
@@ -2031,15 +2031,15 @@ discard block |
||
2031 | 2031 | * @param string $value Value to set. |
2032 | 2032 | * @return bool Whether or not the date was set. |
2033 | 2033 | */ |
2034 | - public function set_completed_date( $value ) { |
|
2035 | - $date = strtotime( $value ); |
|
2034 | + public function set_completed_date($value) { |
|
2035 | + $date = strtotime($value); |
|
2036 | 2036 | |
2037 | - if ( $date && $value !== '0000-00-00 00:00:00' ) { |
|
2038 | - $this->set_prop( 'completed_date', date( 'Y-m-d H:i:s', $date ) ); |
|
2037 | + if ($date && $value !== '0000-00-00 00:00:00') { |
|
2038 | + $this->set_prop('completed_date', date('Y-m-d H:i:s', $date)); |
|
2039 | 2039 | return true; |
2040 | 2040 | } |
2041 | 2041 | |
2042 | - $this->set_prop( 'completed_date', '' ); |
|
2042 | + $this->set_prop('completed_date', ''); |
|
2043 | 2043 | return false; |
2044 | 2044 | |
2045 | 2045 | } |
@@ -2050,8 +2050,8 @@ discard block |
||
2050 | 2050 | * @since 1.0.19 |
2051 | 2051 | * @param string $value New name. |
2052 | 2052 | */ |
2053 | - public function set_date_completed( $value ) { |
|
2054 | - $this->set_completed_date( $value ); |
|
2053 | + public function set_date_completed($value) { |
|
2054 | + $this->set_completed_date($value); |
|
2055 | 2055 | } |
2056 | 2056 | |
2057 | 2057 | /** |
@@ -2061,15 +2061,15 @@ discard block |
||
2061 | 2061 | * @param string $value Value to set. |
2062 | 2062 | * @return bool Whether or not the date was set. |
2063 | 2063 | */ |
2064 | - public function set_date_modified( $value ) { |
|
2065 | - $date = strtotime( $value ); |
|
2064 | + public function set_date_modified($value) { |
|
2065 | + $date = strtotime($value); |
|
2066 | 2066 | |
2067 | - if ( $date && $value !== '0000-00-00 00:00:00' ) { |
|
2068 | - $this->set_prop( 'date_modified', date( 'Y-m-d H:i:s', $date ) ); |
|
2067 | + if ($date && $value !== '0000-00-00 00:00:00') { |
|
2068 | + $this->set_prop('date_modified', date('Y-m-d H:i:s', $date)); |
|
2069 | 2069 | return true; |
2070 | 2070 | } |
2071 | 2071 | |
2072 | - $this->set_prop( 'date_modified', '' ); |
|
2072 | + $this->set_prop('date_modified', ''); |
|
2073 | 2073 | return false; |
2074 | 2074 | |
2075 | 2075 | } |
@@ -2080,9 +2080,9 @@ discard block |
||
2080 | 2080 | * @since 1.0.19 |
2081 | 2081 | * @param string $value New number. |
2082 | 2082 | */ |
2083 | - public function set_number( $value ) { |
|
2084 | - $number = sanitize_text_field( $value ); |
|
2085 | - $this->set_prop( 'number', $number ); |
|
2083 | + public function set_number($value) { |
|
2084 | + $number = sanitize_text_field($value); |
|
2085 | + $this->set_prop('number', $number); |
|
2086 | 2086 | } |
2087 | 2087 | |
2088 | 2088 | /** |
@@ -2091,9 +2091,9 @@ discard block |
||
2091 | 2091 | * @since 1.0.19 |
2092 | 2092 | * @param string $value Type. |
2093 | 2093 | */ |
2094 | - public function set_type( $value ) { |
|
2095 | - $type = sanitize_text_field( str_replace( 'wpi_', '', $value ) ); |
|
2096 | - $this->set_prop( 'type', $type ); |
|
2094 | + public function set_type($value) { |
|
2095 | + $type = sanitize_text_field(str_replace('wpi_', '', $value)); |
|
2096 | + $this->set_prop('type', $type); |
|
2097 | 2097 | } |
2098 | 2098 | |
2099 | 2099 | /** |
@@ -2102,10 +2102,10 @@ discard block |
||
2102 | 2102 | * @since 1.0.19 |
2103 | 2103 | * @param string $value Post type. |
2104 | 2104 | */ |
2105 | - public function set_post_type( $value ) { |
|
2106 | - if ( getpaid_is_invoice_post_type( $value ) ) { |
|
2107 | - $this->set_type( $value ); |
|
2108 | - $this->set_prop( 'post_type', $value ); |
|
2105 | + public function set_post_type($value) { |
|
2106 | + if (getpaid_is_invoice_post_type($value)) { |
|
2107 | + $this->set_type($value); |
|
2108 | + $this->set_prop('post_type', $value); |
|
2109 | 2109 | } |
2110 | 2110 | } |
2111 | 2111 | |
@@ -2115,9 +2115,9 @@ discard block |
||
2115 | 2115 | * @since 1.0.19 |
2116 | 2116 | * @param string $value New key. |
2117 | 2117 | */ |
2118 | - public function set_key( $value ) { |
|
2119 | - $key = sanitize_text_field( $value ); |
|
2120 | - $this->set_prop( 'key', $key ); |
|
2118 | + public function set_key($value) { |
|
2119 | + $key = sanitize_text_field($value); |
|
2120 | + $this->set_prop('key', $key); |
|
2121 | 2121 | } |
2122 | 2122 | |
2123 | 2123 | /** |
@@ -2126,9 +2126,9 @@ discard block |
||
2126 | 2126 | * @since 1.0.19 |
2127 | 2127 | * @param string $value mode. |
2128 | 2128 | */ |
2129 | - public function set_mode( $value ) { |
|
2130 | - if ( ! in_array( $value, array( 'live', 'test' ) ) ) { |
|
2131 | - $this->set_prop( 'value', $value ); |
|
2129 | + public function set_mode($value) { |
|
2130 | + if (!in_array($value, array('live', 'test'))) { |
|
2131 | + $this->set_prop('value', $value); |
|
2132 | 2132 | } |
2133 | 2133 | } |
2134 | 2134 | |
@@ -2138,8 +2138,8 @@ discard block |
||
2138 | 2138 | * @since 1.0.19 |
2139 | 2139 | * @param string $value path. |
2140 | 2140 | */ |
2141 | - public function set_path( $value ) { |
|
2142 | - $this->set_prop( 'path', $value ); |
|
2141 | + public function set_path($value) { |
|
2142 | + $this->set_prop('path', $value); |
|
2143 | 2143 | } |
2144 | 2144 | |
2145 | 2145 | /** |
@@ -2148,9 +2148,9 @@ discard block |
||
2148 | 2148 | * @since 1.0.19 |
2149 | 2149 | * @param string $value New name. |
2150 | 2150 | */ |
2151 | - public function set_name( $value ) { |
|
2152 | - $name = sanitize_text_field( $value ); |
|
2153 | - $this->set_prop( 'name', $name ); |
|
2151 | + public function set_name($value) { |
|
2152 | + $name = sanitize_text_field($value); |
|
2153 | + $this->set_prop('name', $name); |
|
2154 | 2154 | } |
2155 | 2155 | |
2156 | 2156 | /** |
@@ -2159,8 +2159,8 @@ discard block |
||
2159 | 2159 | * @since 1.0.19 |
2160 | 2160 | * @param string $value New name. |
2161 | 2161 | */ |
2162 | - public function set_title( $value ) { |
|
2163 | - $this->set_name( $value ); |
|
2162 | + public function set_title($value) { |
|
2163 | + $this->set_name($value); |
|
2164 | 2164 | } |
2165 | 2165 | |
2166 | 2166 | /** |
@@ -2169,9 +2169,9 @@ discard block |
||
2169 | 2169 | * @since 1.0.19 |
2170 | 2170 | * @param string $value New description. |
2171 | 2171 | */ |
2172 | - public function set_description( $value ) { |
|
2173 | - $description = wp_kses_post( $value ); |
|
2174 | - $this->set_prop( 'description', $description ); |
|
2172 | + public function set_description($value) { |
|
2173 | + $description = wp_kses_post($value); |
|
2174 | + $this->set_prop('description', $description); |
|
2175 | 2175 | } |
2176 | 2176 | |
2177 | 2177 | /** |
@@ -2180,8 +2180,8 @@ discard block |
||
2180 | 2180 | * @since 1.0.19 |
2181 | 2181 | * @param string $value New description. |
2182 | 2182 | */ |
2183 | - public function set_excerpt( $value ) { |
|
2184 | - $this->set_description( $value ); |
|
2183 | + public function set_excerpt($value) { |
|
2184 | + $this->set_description($value); |
|
2185 | 2185 | } |
2186 | 2186 | |
2187 | 2187 | /** |
@@ -2190,8 +2190,8 @@ discard block |
||
2190 | 2190 | * @since 1.0.19 |
2191 | 2191 | * @param string $value New description. |
2192 | 2192 | */ |
2193 | - public function set_summary( $value ) { |
|
2194 | - $this->set_description( $value ); |
|
2193 | + public function set_summary($value) { |
|
2194 | + $this->set_description($value); |
|
2195 | 2195 | } |
2196 | 2196 | |
2197 | 2197 | /** |
@@ -2200,12 +2200,12 @@ discard block |
||
2200 | 2200 | * @since 1.0.19 |
2201 | 2201 | * @param int $value New author. |
2202 | 2202 | */ |
2203 | - public function set_author( $value ) { |
|
2204 | - $user = get_user_by( 'id', (int) $value ); |
|
2203 | + public function set_author($value) { |
|
2204 | + $user = get_user_by('id', (int) $value); |
|
2205 | 2205 | |
2206 | - if ( $user && $user->ID ) { |
|
2207 | - $this->set_prop( 'author', $user->ID ); |
|
2208 | - $this->set_prop( 'email', $user->user_email ); |
|
2206 | + if ($user && $user->ID) { |
|
2207 | + $this->set_prop('author', $user->ID); |
|
2208 | + $this->set_prop('email', $user->user_email); |
|
2209 | 2209 | } |
2210 | 2210 | |
2211 | 2211 | } |
@@ -2216,8 +2216,8 @@ discard block |
||
2216 | 2216 | * @since 1.0.19 |
2217 | 2217 | * @param int $value New user id. |
2218 | 2218 | */ |
2219 | - public function set_user_id( $value ) { |
|
2220 | - $this->set_author( $value ); |
|
2219 | + public function set_user_id($value) { |
|
2220 | + $this->set_author($value); |
|
2221 | 2221 | } |
2222 | 2222 | |
2223 | 2223 | /** |
@@ -2226,8 +2226,8 @@ discard block |
||
2226 | 2226 | * @since 1.0.19 |
2227 | 2227 | * @param int $value New user id. |
2228 | 2228 | */ |
2229 | - public function set_customer_id( $value ) { |
|
2230 | - $this->set_author( $value ); |
|
2229 | + public function set_customer_id($value) { |
|
2230 | + $this->set_author($value); |
|
2231 | 2231 | } |
2232 | 2232 | |
2233 | 2233 | /** |
@@ -2236,8 +2236,8 @@ discard block |
||
2236 | 2236 | * @since 1.0.19 |
2237 | 2237 | * @param string $value ip address. |
2238 | 2238 | */ |
2239 | - public function set_ip( $value ) { |
|
2240 | - $this->set_prop( 'ip', $value ); |
|
2239 | + public function set_ip($value) { |
|
2240 | + $this->set_prop('ip', $value); |
|
2241 | 2241 | } |
2242 | 2242 | |
2243 | 2243 | /** |
@@ -2246,8 +2246,8 @@ discard block |
||
2246 | 2246 | * @since 1.0.19 |
2247 | 2247 | * @param string $value ip address. |
2248 | 2248 | */ |
2249 | - public function set_user_ip( $value ) { |
|
2250 | - $this->set_ip( $value ); |
|
2249 | + public function set_user_ip($value) { |
|
2250 | + $this->set_ip($value); |
|
2251 | 2251 | } |
2252 | 2252 | |
2253 | 2253 | /** |
@@ -2256,8 +2256,8 @@ discard block |
||
2256 | 2256 | * @since 1.0.19 |
2257 | 2257 | * @param string $value first name. |
2258 | 2258 | */ |
2259 | - public function set_first_name( $value ) { |
|
2260 | - $this->set_prop( 'first_name', $value ); |
|
2259 | + public function set_first_name($value) { |
|
2260 | + $this->set_prop('first_name', $value); |
|
2261 | 2261 | } |
2262 | 2262 | |
2263 | 2263 | /** |
@@ -2266,8 +2266,8 @@ discard block |
||
2266 | 2266 | * @since 1.0.19 |
2267 | 2267 | * @param string $value first name. |
2268 | 2268 | */ |
2269 | - public function set_user_first_name( $value ) { |
|
2270 | - $this->set_first_name( $value ); |
|
2269 | + public function set_user_first_name($value) { |
|
2270 | + $this->set_first_name($value); |
|
2271 | 2271 | } |
2272 | 2272 | |
2273 | 2273 | /** |
@@ -2276,8 +2276,8 @@ discard block |
||
2276 | 2276 | * @since 1.0.19 |
2277 | 2277 | * @param string $value first name. |
2278 | 2278 | */ |
2279 | - public function set_customer_first_name( $value ) { |
|
2280 | - $this->set_first_name( $value ); |
|
2279 | + public function set_customer_first_name($value) { |
|
2280 | + $this->set_first_name($value); |
|
2281 | 2281 | } |
2282 | 2282 | |
2283 | 2283 | /** |
@@ -2286,8 +2286,8 @@ discard block |
||
2286 | 2286 | * @since 1.0.19 |
2287 | 2287 | * @param string $value last name. |
2288 | 2288 | */ |
2289 | - public function set_last_name( $value ) { |
|
2290 | - $this->set_prop( 'last_name', $value ); |
|
2289 | + public function set_last_name($value) { |
|
2290 | + $this->set_prop('last_name', $value); |
|
2291 | 2291 | } |
2292 | 2292 | |
2293 | 2293 | /** |
@@ -2296,8 +2296,8 @@ discard block |
||
2296 | 2296 | * @since 1.0.19 |
2297 | 2297 | * @param string $value last name. |
2298 | 2298 | */ |
2299 | - public function set_user_last_name( $value ) { |
|
2300 | - $this->set_last_name( $value ); |
|
2299 | + public function set_user_last_name($value) { |
|
2300 | + $this->set_last_name($value); |
|
2301 | 2301 | } |
2302 | 2302 | |
2303 | 2303 | /** |
@@ -2306,8 +2306,8 @@ discard block |
||
2306 | 2306 | * @since 1.0.19 |
2307 | 2307 | * @param string $value last name. |
2308 | 2308 | */ |
2309 | - public function set_customer_last_name( $value ) { |
|
2310 | - $this->set_last_name( $value ); |
|
2309 | + public function set_customer_last_name($value) { |
|
2310 | + $this->set_last_name($value); |
|
2311 | 2311 | } |
2312 | 2312 | |
2313 | 2313 | /** |
@@ -2316,8 +2316,8 @@ discard block |
||
2316 | 2316 | * @since 1.0.19 |
2317 | 2317 | * @param string $value phone. |
2318 | 2318 | */ |
2319 | - public function set_phone( $value ) { |
|
2320 | - $this->set_prop( 'phone', $value ); |
|
2319 | + public function set_phone($value) { |
|
2320 | + $this->set_prop('phone', $value); |
|
2321 | 2321 | } |
2322 | 2322 | |
2323 | 2323 | /** |
@@ -2326,8 +2326,8 @@ discard block |
||
2326 | 2326 | * @since 1.0.19 |
2327 | 2327 | * @param string $value phone. |
2328 | 2328 | */ |
2329 | - public function set_user_phone( $value ) { |
|
2330 | - $this->set_phone( $value ); |
|
2329 | + public function set_user_phone($value) { |
|
2330 | + $this->set_phone($value); |
|
2331 | 2331 | } |
2332 | 2332 | |
2333 | 2333 | /** |
@@ -2336,8 +2336,8 @@ discard block |
||
2336 | 2336 | * @since 1.0.19 |
2337 | 2337 | * @param string $value phone. |
2338 | 2338 | */ |
2339 | - public function set_customer_phone( $value ) { |
|
2340 | - $this->set_phone( $value ); |
|
2339 | + public function set_customer_phone($value) { |
|
2340 | + $this->set_phone($value); |
|
2341 | 2341 | } |
2342 | 2342 | |
2343 | 2343 | /** |
@@ -2346,8 +2346,8 @@ discard block |
||
2346 | 2346 | * @since 1.0.19 |
2347 | 2347 | * @param string $value phone. |
2348 | 2348 | */ |
2349 | - public function set_phone_number( $value ) { |
|
2350 | - $this->set_phone( $value ); |
|
2349 | + public function set_phone_number($value) { |
|
2350 | + $this->set_phone($value); |
|
2351 | 2351 | } |
2352 | 2352 | |
2353 | 2353 | /** |
@@ -2356,8 +2356,8 @@ discard block |
||
2356 | 2356 | * @since 1.0.19 |
2357 | 2357 | * @param string $value email address. |
2358 | 2358 | */ |
2359 | - public function set_email( $value ) { |
|
2360 | - $this->set_prop( 'email', $value ); |
|
2359 | + public function set_email($value) { |
|
2360 | + $this->set_prop('email', $value); |
|
2361 | 2361 | } |
2362 | 2362 | |
2363 | 2363 | /** |
@@ -2366,8 +2366,8 @@ discard block |
||
2366 | 2366 | * @since 1.0.19 |
2367 | 2367 | * @param string $value email address. |
2368 | 2368 | */ |
2369 | - public function set_user_email( $value ) { |
|
2370 | - $this->set_email( $value ); |
|
2369 | + public function set_user_email($value) { |
|
2370 | + $this->set_email($value); |
|
2371 | 2371 | } |
2372 | 2372 | |
2373 | 2373 | /** |
@@ -2376,8 +2376,8 @@ discard block |
||
2376 | 2376 | * @since 1.0.19 |
2377 | 2377 | * @param string $value email address. |
2378 | 2378 | */ |
2379 | - public function set_email_address( $value ) { |
|
2380 | - $this->set_email( $value ); |
|
2379 | + public function set_email_address($value) { |
|
2380 | + $this->set_email($value); |
|
2381 | 2381 | } |
2382 | 2382 | |
2383 | 2383 | /** |
@@ -2386,8 +2386,8 @@ discard block |
||
2386 | 2386 | * @since 1.0.19 |
2387 | 2387 | * @param string $value email address. |
2388 | 2388 | */ |
2389 | - public function set_customer_email( $value ) { |
|
2390 | - $this->set_email( $value ); |
|
2389 | + public function set_customer_email($value) { |
|
2390 | + $this->set_email($value); |
|
2391 | 2391 | } |
2392 | 2392 | |
2393 | 2393 | /** |
@@ -2396,8 +2396,8 @@ discard block |
||
2396 | 2396 | * @since 1.0.19 |
2397 | 2397 | * @param string $value country. |
2398 | 2398 | */ |
2399 | - public function set_country( $value ) { |
|
2400 | - $this->set_prop( 'country', $value ); |
|
2399 | + public function set_country($value) { |
|
2400 | + $this->set_prop('country', $value); |
|
2401 | 2401 | } |
2402 | 2402 | |
2403 | 2403 | /** |
@@ -2406,8 +2406,8 @@ discard block |
||
2406 | 2406 | * @since 1.0.19 |
2407 | 2407 | * @param string $value country. |
2408 | 2408 | */ |
2409 | - public function set_user_country( $value ) { |
|
2410 | - $this->set_country( $value ); |
|
2409 | + public function set_user_country($value) { |
|
2410 | + $this->set_country($value); |
|
2411 | 2411 | } |
2412 | 2412 | |
2413 | 2413 | /** |
@@ -2416,8 +2416,8 @@ discard block |
||
2416 | 2416 | * @since 1.0.19 |
2417 | 2417 | * @param string $value country. |
2418 | 2418 | */ |
2419 | - public function set_customer_country( $value ) { |
|
2420 | - $this->set_country( $value ); |
|
2419 | + public function set_customer_country($value) { |
|
2420 | + $this->set_country($value); |
|
2421 | 2421 | } |
2422 | 2422 | |
2423 | 2423 | /** |
@@ -2426,8 +2426,8 @@ discard block |
||
2426 | 2426 | * @since 1.0.19 |
2427 | 2427 | * @param string $value state. |
2428 | 2428 | */ |
2429 | - public function set_state( $value ) { |
|
2430 | - $this->set_prop( 'state', $value ); |
|
2429 | + public function set_state($value) { |
|
2430 | + $this->set_prop('state', $value); |
|
2431 | 2431 | } |
2432 | 2432 | |
2433 | 2433 | /** |
@@ -2436,8 +2436,8 @@ discard block |
||
2436 | 2436 | * @since 1.0.19 |
2437 | 2437 | * @param string $value state. |
2438 | 2438 | */ |
2439 | - public function set_user_state( $value ) { |
|
2440 | - $this->set_state( $value ); |
|
2439 | + public function set_user_state($value) { |
|
2440 | + $this->set_state($value); |
|
2441 | 2441 | } |
2442 | 2442 | |
2443 | 2443 | /** |
@@ -2446,8 +2446,8 @@ discard block |
||
2446 | 2446 | * @since 1.0.19 |
2447 | 2447 | * @param string $value state. |
2448 | 2448 | */ |
2449 | - public function set_customer_state( $value ) { |
|
2450 | - $this->set_state( $value ); |
|
2449 | + public function set_customer_state($value) { |
|
2450 | + $this->set_state($value); |
|
2451 | 2451 | } |
2452 | 2452 | |
2453 | 2453 | /** |
@@ -2456,8 +2456,8 @@ discard block |
||
2456 | 2456 | * @since 1.0.19 |
2457 | 2457 | * @param string $value city. |
2458 | 2458 | */ |
2459 | - public function set_city( $value ) { |
|
2460 | - $this->set_prop( 'city', $value ); |
|
2459 | + public function set_city($value) { |
|
2460 | + $this->set_prop('city', $value); |
|
2461 | 2461 | } |
2462 | 2462 | |
2463 | 2463 | /** |
@@ -2466,8 +2466,8 @@ discard block |
||
2466 | 2466 | * @since 1.0.19 |
2467 | 2467 | * @param string $value city. |
2468 | 2468 | */ |
2469 | - public function set_user_city( $value ) { |
|
2470 | - $this->set_city( $value ); |
|
2469 | + public function set_user_city($value) { |
|
2470 | + $this->set_city($value); |
|
2471 | 2471 | } |
2472 | 2472 | |
2473 | 2473 | /** |
@@ -2476,8 +2476,8 @@ discard block |
||
2476 | 2476 | * @since 1.0.19 |
2477 | 2477 | * @param string $value city. |
2478 | 2478 | */ |
2479 | - public function set_customer_city( $value ) { |
|
2480 | - $this->set_city( $value ); |
|
2479 | + public function set_customer_city($value) { |
|
2480 | + $this->set_city($value); |
|
2481 | 2481 | } |
2482 | 2482 | |
2483 | 2483 | /** |
@@ -2486,8 +2486,8 @@ discard block |
||
2486 | 2486 | * @since 1.0.19 |
2487 | 2487 | * @param string $value zip. |
2488 | 2488 | */ |
2489 | - public function set_zip( $value ) { |
|
2490 | - $this->set_prop( 'zip', $value ); |
|
2489 | + public function set_zip($value) { |
|
2490 | + $this->set_prop('zip', $value); |
|
2491 | 2491 | } |
2492 | 2492 | |
2493 | 2493 | /** |
@@ -2496,8 +2496,8 @@ discard block |
||
2496 | 2496 | * @since 1.0.19 |
2497 | 2497 | * @param string $value zip. |
2498 | 2498 | */ |
2499 | - public function set_user_zip( $value ) { |
|
2500 | - $this->set_zip( $value ); |
|
2499 | + public function set_user_zip($value) { |
|
2500 | + $this->set_zip($value); |
|
2501 | 2501 | } |
2502 | 2502 | |
2503 | 2503 | /** |
@@ -2506,8 +2506,8 @@ discard block |
||
2506 | 2506 | * @since 1.0.19 |
2507 | 2507 | * @param string $value zip. |
2508 | 2508 | */ |
2509 | - public function set_customer_zip( $value ) { |
|
2510 | - $this->set_zip( $value ); |
|
2509 | + public function set_customer_zip($value) { |
|
2510 | + $this->set_zip($value); |
|
2511 | 2511 | } |
2512 | 2512 | |
2513 | 2513 | /** |
@@ -2516,8 +2516,8 @@ discard block |
||
2516 | 2516 | * @since 1.0.19 |
2517 | 2517 | * @param string $value company. |
2518 | 2518 | */ |
2519 | - public function set_company( $value ) { |
|
2520 | - $this->set_prop( 'company', $value ); |
|
2519 | + public function set_company($value) { |
|
2520 | + $this->set_prop('company', $value); |
|
2521 | 2521 | } |
2522 | 2522 | |
2523 | 2523 | /** |
@@ -2526,8 +2526,8 @@ discard block |
||
2526 | 2526 | * @since 1.0.19 |
2527 | 2527 | * @param string $value company. |
2528 | 2528 | */ |
2529 | - public function set_user_company( $value ) { |
|
2530 | - $this->set_company( $value ); |
|
2529 | + public function set_user_company($value) { |
|
2530 | + $this->set_company($value); |
|
2531 | 2531 | } |
2532 | 2532 | |
2533 | 2533 | /** |
@@ -2536,8 +2536,8 @@ discard block |
||
2536 | 2536 | * @since 1.0.19 |
2537 | 2537 | * @param string $value company. |
2538 | 2538 | */ |
2539 | - public function set_customer_company( $value ) { |
|
2540 | - $this->set_company( $value ); |
|
2539 | + public function set_customer_company($value) { |
|
2540 | + $this->set_company($value); |
|
2541 | 2541 | } |
2542 | 2542 | |
2543 | 2543 | /** |
@@ -2546,8 +2546,8 @@ discard block |
||
2546 | 2546 | * @since 1.0.19 |
2547 | 2547 | * @param string $value var number. |
2548 | 2548 | */ |
2549 | - public function set_vat_number( $value ) { |
|
2550 | - $this->set_prop( 'vat_number', $value ); |
|
2549 | + public function set_vat_number($value) { |
|
2550 | + $this->set_prop('vat_number', $value); |
|
2551 | 2551 | } |
2552 | 2552 | |
2553 | 2553 | /** |
@@ -2556,8 +2556,8 @@ discard block |
||
2556 | 2556 | * @since 1.0.19 |
2557 | 2557 | * @param string $value var number. |
2558 | 2558 | */ |
2559 | - public function set_user_vat_number( $value ) { |
|
2560 | - $this->set_vat_number( $value ); |
|
2559 | + public function set_user_vat_number($value) { |
|
2560 | + $this->set_vat_number($value); |
|
2561 | 2561 | } |
2562 | 2562 | |
2563 | 2563 | /** |
@@ -2566,8 +2566,8 @@ discard block |
||
2566 | 2566 | * @since 1.0.19 |
2567 | 2567 | * @param string $value var number. |
2568 | 2568 | */ |
2569 | - public function set_customer_vat_number( $value ) { |
|
2570 | - $this->set_vat_number( $value ); |
|
2569 | + public function set_customer_vat_number($value) { |
|
2570 | + $this->set_vat_number($value); |
|
2571 | 2571 | } |
2572 | 2572 | |
2573 | 2573 | /** |
@@ -2576,8 +2576,8 @@ discard block |
||
2576 | 2576 | * @since 1.0.19 |
2577 | 2577 | * @param string $value var rate. |
2578 | 2578 | */ |
2579 | - public function set_vat_rate( $value ) { |
|
2580 | - $this->set_prop( 'vat_rate', $value ); |
|
2579 | + public function set_vat_rate($value) { |
|
2580 | + $this->set_prop('vat_rate', $value); |
|
2581 | 2581 | } |
2582 | 2582 | |
2583 | 2583 | /** |
@@ -2586,8 +2586,8 @@ discard block |
||
2586 | 2586 | * @since 1.0.19 |
2587 | 2587 | * @param string $value var number. |
2588 | 2588 | */ |
2589 | - public function set_user_vat_rate( $value ) { |
|
2590 | - $this->set_vat_rate( $value ); |
|
2589 | + public function set_user_vat_rate($value) { |
|
2590 | + $this->set_vat_rate($value); |
|
2591 | 2591 | } |
2592 | 2592 | |
2593 | 2593 | /** |
@@ -2596,8 +2596,8 @@ discard block |
||
2596 | 2596 | * @since 1.0.19 |
2597 | 2597 | * @param string $value var number. |
2598 | 2598 | */ |
2599 | - public function set_customer_vat_rate( $value ) { |
|
2600 | - $this->set_vat_rate( $value ); |
|
2599 | + public function set_customer_vat_rate($value) { |
|
2600 | + $this->set_vat_rate($value); |
|
2601 | 2601 | } |
2602 | 2602 | |
2603 | 2603 | /** |
@@ -2606,8 +2606,8 @@ discard block |
||
2606 | 2606 | * @since 1.0.19 |
2607 | 2607 | * @param string $value address. |
2608 | 2608 | */ |
2609 | - public function set_address( $value ) { |
|
2610 | - $this->set_prop( 'address', $value ); |
|
2609 | + public function set_address($value) { |
|
2610 | + $this->set_prop('address', $value); |
|
2611 | 2611 | } |
2612 | 2612 | |
2613 | 2613 | /** |
@@ -2616,8 +2616,8 @@ discard block |
||
2616 | 2616 | * @since 1.0.19 |
2617 | 2617 | * @param string $value address. |
2618 | 2618 | */ |
2619 | - public function set_user_address( $value ) { |
|
2620 | - $this->set_address( $value ); |
|
2619 | + public function set_user_address($value) { |
|
2620 | + $this->set_address($value); |
|
2621 | 2621 | } |
2622 | 2622 | |
2623 | 2623 | /** |
@@ -2626,8 +2626,8 @@ discard block |
||
2626 | 2626 | * @since 1.0.19 |
2627 | 2627 | * @param string $value address. |
2628 | 2628 | */ |
2629 | - public function set_customer_address( $value ) { |
|
2630 | - $this->set_address( $value ); |
|
2629 | + public function set_customer_address($value) { |
|
2630 | + $this->set_address($value); |
|
2631 | 2631 | } |
2632 | 2632 | |
2633 | 2633 | /** |
@@ -2636,8 +2636,8 @@ discard block |
||
2636 | 2636 | * @since 1.0.19 |
2637 | 2637 | * @param int|bool $value confirmed. |
2638 | 2638 | */ |
2639 | - public function set_is_viewed( $value ) { |
|
2640 | - $this->set_prop( 'is_viewed', $value ); |
|
2639 | + public function set_is_viewed($value) { |
|
2640 | + $this->set_prop('is_viewed', $value); |
|
2641 | 2641 | } |
2642 | 2642 | |
2643 | 2643 | /** |
@@ -2646,8 +2646,8 @@ discard block |
||
2646 | 2646 | * @since 1.0.19 |
2647 | 2647 | * @param string $value email recipients. |
2648 | 2648 | */ |
2649 | - public function set_email_cc( $value ) { |
|
2650 | - $this->set_prop( 'email_cc', $value ); |
|
2649 | + public function set_email_cc($value) { |
|
2650 | + $this->set_prop('email_cc', $value); |
|
2651 | 2651 | } |
2652 | 2652 | |
2653 | 2653 | /** |
@@ -2656,9 +2656,9 @@ discard block |
||
2656 | 2656 | * @since 1.0.19 |
2657 | 2657 | * @param string $value template. |
2658 | 2658 | */ |
2659 | - public function set_template( $value ) { |
|
2660 | - if ( in_array( $value, array( 'quantity', 'hours', 'amount' ) ) ) { |
|
2661 | - $this->set_prop( 'template', $value ); |
|
2659 | + public function set_template($value) { |
|
2660 | + if (in_array($value, array('quantity', 'hours', 'amount'))) { |
|
2661 | + $this->set_prop('template', $value); |
|
2662 | 2662 | } |
2663 | 2663 | } |
2664 | 2664 | |
@@ -2668,8 +2668,8 @@ discard block |
||
2668 | 2668 | * @since 1.0.19 |
2669 | 2669 | * @param string $value email recipients. |
2670 | 2670 | */ |
2671 | - public function created_via( $value ) { |
|
2672 | - $this->set_prop( 'created_via', sanitize_text_field( $value ) ); |
|
2671 | + public function created_via($value) { |
|
2672 | + $this->set_prop('created_via', sanitize_text_field($value)); |
|
2673 | 2673 | } |
2674 | 2674 | |
2675 | 2675 | /** |
@@ -2678,8 +2678,8 @@ discard block |
||
2678 | 2678 | * @since 1.0.19 |
2679 | 2679 | * @param int|bool $value confirmed. |
2680 | 2680 | */ |
2681 | - public function set_address_confirmed( $value ) { |
|
2682 | - $this->set_prop( 'address_confirmed', $value ); |
|
2681 | + public function set_address_confirmed($value) { |
|
2682 | + $this->set_prop('address_confirmed', $value); |
|
2683 | 2683 | } |
2684 | 2684 | |
2685 | 2685 | /** |
@@ -2688,8 +2688,8 @@ discard block |
||
2688 | 2688 | * @since 1.0.19 |
2689 | 2689 | * @param int|bool $value confirmed. |
2690 | 2690 | */ |
2691 | - public function set_user_address_confirmed( $value ) { |
|
2692 | - $this->set_address_confirmed( $value ); |
|
2691 | + public function set_user_address_confirmed($value) { |
|
2692 | + $this->set_address_confirmed($value); |
|
2693 | 2693 | } |
2694 | 2694 | |
2695 | 2695 | /** |
@@ -2698,8 +2698,8 @@ discard block |
||
2698 | 2698 | * @since 1.0.19 |
2699 | 2699 | * @param int|bool $value confirmed. |
2700 | 2700 | */ |
2701 | - public function set_customer_address_confirmed( $value ) { |
|
2702 | - $this->set_address_confirmed( $value ); |
|
2701 | + public function set_customer_address_confirmed($value) { |
|
2702 | + $this->set_address_confirmed($value); |
|
2703 | 2703 | } |
2704 | 2704 | |
2705 | 2705 | /** |
@@ -2708,8 +2708,8 @@ discard block |
||
2708 | 2708 | * @since 1.0.19 |
2709 | 2709 | * @param float $value sub total. |
2710 | 2710 | */ |
2711 | - public function set_subtotal( $value ) { |
|
2712 | - $this->set_prop( 'subtotal', $value ); |
|
2711 | + public function set_subtotal($value) { |
|
2712 | + $this->set_prop('subtotal', $value); |
|
2713 | 2713 | } |
2714 | 2714 | |
2715 | 2715 | /** |
@@ -2718,8 +2718,8 @@ discard block |
||
2718 | 2718 | * @since 1.0.19 |
2719 | 2719 | * @param float $value discount total. |
2720 | 2720 | */ |
2721 | - public function set_total_discount( $value ) { |
|
2722 | - $this->set_prop( 'total_discount', $value ); |
|
2721 | + public function set_total_discount($value) { |
|
2722 | + $this->set_prop('total_discount', $value); |
|
2723 | 2723 | } |
2724 | 2724 | |
2725 | 2725 | /** |
@@ -2728,8 +2728,8 @@ discard block |
||
2728 | 2728 | * @since 1.0.19 |
2729 | 2729 | * @param float $value discount total. |
2730 | 2730 | */ |
2731 | - public function set_discount( $value ) { |
|
2732 | - $this->set_total_discount( $value ); |
|
2731 | + public function set_discount($value) { |
|
2732 | + $this->set_total_discount($value); |
|
2733 | 2733 | } |
2734 | 2734 | |
2735 | 2735 | /** |
@@ -2738,8 +2738,8 @@ discard block |
||
2738 | 2738 | * @since 1.0.19 |
2739 | 2739 | * @param float $value tax total. |
2740 | 2740 | */ |
2741 | - public function set_total_tax( $value ) { |
|
2742 | - $this->set_prop( 'total_tax', $value ); |
|
2741 | + public function set_total_tax($value) { |
|
2742 | + $this->set_prop('total_tax', $value); |
|
2743 | 2743 | } |
2744 | 2744 | |
2745 | 2745 | /** |
@@ -2748,8 +2748,8 @@ discard block |
||
2748 | 2748 | * @since 1.0.19 |
2749 | 2749 | * @param float $value tax total. |
2750 | 2750 | */ |
2751 | - public function set_tax_total( $value ) { |
|
2752 | - $this->set_total_tax( $value ); |
|
2751 | + public function set_tax_total($value) { |
|
2752 | + $this->set_total_tax($value); |
|
2753 | 2753 | } |
2754 | 2754 | |
2755 | 2755 | /** |
@@ -2758,8 +2758,8 @@ discard block |
||
2758 | 2758 | * @since 1.0.19 |
2759 | 2759 | * @param float $value fees total. |
2760 | 2760 | */ |
2761 | - public function set_total_fees( $value ) { |
|
2762 | - $this->set_prop( 'total_fees', $value ); |
|
2761 | + public function set_total_fees($value) { |
|
2762 | + $this->set_prop('total_fees', $value); |
|
2763 | 2763 | } |
2764 | 2764 | |
2765 | 2765 | /** |
@@ -2768,8 +2768,8 @@ discard block |
||
2768 | 2768 | * @since 1.0.19 |
2769 | 2769 | * @param float $value fees total. |
2770 | 2770 | */ |
2771 | - public function set_fees_total( $value ) { |
|
2772 | - $this->set_total_fees( $value ); |
|
2771 | + public function set_fees_total($value) { |
|
2772 | + $this->set_total_fees($value); |
|
2773 | 2773 | } |
2774 | 2774 | |
2775 | 2775 | /** |
@@ -2778,13 +2778,13 @@ discard block |
||
2778 | 2778 | * @since 1.0.19 |
2779 | 2779 | * @param array $value fees. |
2780 | 2780 | */ |
2781 | - public function set_fees( $value ) { |
|
2781 | + public function set_fees($value) { |
|
2782 | 2782 | |
2783 | - if ( ! is_array( $value ) ) { |
|
2783 | + if (!is_array($value)) { |
|
2784 | 2784 | $value = array(); |
2785 | 2785 | } |
2786 | 2786 | |
2787 | - $this->set_prop( 'fees', $value ); |
|
2787 | + $this->set_prop('fees', $value); |
|
2788 | 2788 | |
2789 | 2789 | } |
2790 | 2790 | |
@@ -2794,13 +2794,13 @@ discard block |
||
2794 | 2794 | * @since 1.0.19 |
2795 | 2795 | * @param array $value taxes. |
2796 | 2796 | */ |
2797 | - public function set_taxes( $value ) { |
|
2797 | + public function set_taxes($value) { |
|
2798 | 2798 | |
2799 | - if ( ! is_array( $value ) ) { |
|
2799 | + if (!is_array($value)) { |
|
2800 | 2800 | $value = array(); |
2801 | 2801 | } |
2802 | 2802 | |
2803 | - $this->set_prop( 'taxes', $value ); |
|
2803 | + $this->set_prop('taxes', $value); |
|
2804 | 2804 | |
2805 | 2805 | } |
2806 | 2806 | |
@@ -2810,13 +2810,13 @@ discard block |
||
2810 | 2810 | * @since 1.0.19 |
2811 | 2811 | * @param array $value discounts. |
2812 | 2812 | */ |
2813 | - public function set_discounts( $value ) { |
|
2813 | + public function set_discounts($value) { |
|
2814 | 2814 | |
2815 | - if ( ! is_array( $value ) ) { |
|
2815 | + if (!is_array($value)) { |
|
2816 | 2816 | $value = array(); |
2817 | 2817 | } |
2818 | 2818 | |
2819 | - $this->set_prop( 'discounts', $value ); |
|
2819 | + $this->set_prop('discounts', $value); |
|
2820 | 2820 | } |
2821 | 2821 | |
2822 | 2822 | /** |
@@ -2825,18 +2825,18 @@ discard block |
||
2825 | 2825 | * @since 1.0.19 |
2826 | 2826 | * @param GetPaid_Form_Item[] $value items. |
2827 | 2827 | */ |
2828 | - public function set_items( $value ) { |
|
2828 | + public function set_items($value) { |
|
2829 | 2829 | |
2830 | 2830 | // Remove existing items. |
2831 | - $this->set_prop( 'items', array() ); |
|
2831 | + $this->set_prop('items', array()); |
|
2832 | 2832 | |
2833 | 2833 | // Ensure that we have an array. |
2834 | - if ( ! is_array( $value ) ) { |
|
2834 | + if (!is_array($value)) { |
|
2835 | 2835 | return; |
2836 | 2836 | } |
2837 | 2837 | |
2838 | - foreach ( $value as $item ) { |
|
2839 | - $this->add_item( $item ); |
|
2838 | + foreach ($value as $item) { |
|
2839 | + $this->add_item($item); |
|
2840 | 2840 | } |
2841 | 2841 | |
2842 | 2842 | } |
@@ -2847,8 +2847,8 @@ discard block |
||
2847 | 2847 | * @since 1.0.19 |
2848 | 2848 | * @param int $value payment form. |
2849 | 2849 | */ |
2850 | - public function set_payment_form( $value ) { |
|
2851 | - $this->set_prop( 'payment_form', $value ); |
|
2850 | + public function set_payment_form($value) { |
|
2851 | + $this->set_prop('payment_form', $value); |
|
2852 | 2852 | } |
2853 | 2853 | |
2854 | 2854 | /** |
@@ -2857,8 +2857,8 @@ discard block |
||
2857 | 2857 | * @since 1.0.19 |
2858 | 2858 | * @param string $value submission id. |
2859 | 2859 | */ |
2860 | - public function set_submission_id( $value ) { |
|
2861 | - $this->set_prop( 'submission_id', $value ); |
|
2860 | + public function set_submission_id($value) { |
|
2861 | + $this->set_prop('submission_id', $value); |
|
2862 | 2862 | } |
2863 | 2863 | |
2864 | 2864 | /** |
@@ -2867,8 +2867,8 @@ discard block |
||
2867 | 2867 | * @since 1.0.19 |
2868 | 2868 | * @param string $value discount code. |
2869 | 2869 | */ |
2870 | - public function set_discount_code( $value ) { |
|
2871 | - $this->set_prop( 'discount_code', $value ); |
|
2870 | + public function set_discount_code($value) { |
|
2871 | + $this->set_prop('discount_code', $value); |
|
2872 | 2872 | } |
2873 | 2873 | |
2874 | 2874 | /** |
@@ -2877,8 +2877,8 @@ discard block |
||
2877 | 2877 | * @since 1.0.19 |
2878 | 2878 | * @param string $value gateway. |
2879 | 2879 | */ |
2880 | - public function set_gateway( $value ) { |
|
2881 | - $this->set_prop( 'gateway', $value ); |
|
2880 | + public function set_gateway($value) { |
|
2881 | + $this->set_prop('gateway', $value); |
|
2882 | 2882 | } |
2883 | 2883 | |
2884 | 2884 | /** |
@@ -2887,9 +2887,9 @@ discard block |
||
2887 | 2887 | * @since 1.0.19 |
2888 | 2888 | * @param string $value transaction id. |
2889 | 2889 | */ |
2890 | - public function set_transaction_id( $value ) { |
|
2891 | - if ( ! empty( $value ) ) { |
|
2892 | - $this->set_prop( 'transaction_id', $value ); |
|
2890 | + public function set_transaction_id($value) { |
|
2891 | + if (!empty($value)) { |
|
2892 | + $this->set_prop('transaction_id', $value); |
|
2893 | 2893 | } |
2894 | 2894 | } |
2895 | 2895 | |
@@ -2899,8 +2899,8 @@ discard block |
||
2899 | 2899 | * @since 1.0.19 |
2900 | 2900 | * @param string $value currency id. |
2901 | 2901 | */ |
2902 | - public function set_currency( $value ) { |
|
2903 | - $this->set_prop( 'currency', $value ); |
|
2902 | + public function set_currency($value) { |
|
2903 | + $this->set_prop('currency', $value); |
|
2904 | 2904 | } |
2905 | 2905 | |
2906 | 2906 | /** |
@@ -2909,8 +2909,8 @@ discard block |
||
2909 | 2909 | * @since 1.0.19 |
2910 | 2910 | * @param bool $value value. |
2911 | 2911 | */ |
2912 | - public function set_disable_taxes( $value ) { |
|
2913 | - $this->set_prop( 'disable_taxes', (bool) $value ); |
|
2912 | + public function set_disable_taxes($value) { |
|
2913 | + $this->set_prop('disable_taxes', (bool) $value); |
|
2914 | 2914 | } |
2915 | 2915 | |
2916 | 2916 | /** |
@@ -2919,8 +2919,8 @@ discard block |
||
2919 | 2919 | * @since 1.0.19 |
2920 | 2920 | * @param string $value subscription id. |
2921 | 2921 | */ |
2922 | - public function set_subscription_id( $value ) { |
|
2923 | - $this->set_prop( 'subscription_id', $value ); |
|
2922 | + public function set_subscription_id($value) { |
|
2923 | + $this->set_prop('subscription_id', $value); |
|
2924 | 2924 | } |
2925 | 2925 | |
2926 | 2926 | /** |
@@ -2929,8 +2929,8 @@ discard block |
||
2929 | 2929 | * @since 1.0.19 |
2930 | 2930 | * @param string $value subscription id. |
2931 | 2931 | */ |
2932 | - public function set_remote_subscription_id( $value ) { |
|
2933 | - $this->set_prop( 'remote_subscription_id', $value ); |
|
2932 | + public function set_remote_subscription_id($value) { |
|
2933 | + $this->set_prop('remote_subscription_id', $value); |
|
2934 | 2934 | } |
2935 | 2935 | |
2936 | 2936 | /* |
@@ -2947,28 +2947,28 @@ discard block |
||
2947 | 2947 | */ |
2948 | 2948 | public function is_parent() { |
2949 | 2949 | $parent = $this->get_parent_id(); |
2950 | - return apply_filters( 'wpinv_invoice_is_parent', empty( $parent ), $this ); |
|
2950 | + return apply_filters('wpinv_invoice_is_parent', empty($parent), $this); |
|
2951 | 2951 | } |
2952 | 2952 | |
2953 | 2953 | /** |
2954 | 2954 | * Checks if this is a renewal invoice. |
2955 | 2955 | */ |
2956 | 2956 | public function is_renewal() { |
2957 | - return ! $this->is_parent(); |
|
2957 | + return !$this->is_parent(); |
|
2958 | 2958 | } |
2959 | 2959 | |
2960 | 2960 | /** |
2961 | 2961 | * Checks if this is a recurring invoice. |
2962 | 2962 | */ |
2963 | 2963 | public function is_recurring() { |
2964 | - return $this->is_renewal() || ! empty( $this->recurring_item ); |
|
2964 | + return $this->is_renewal() || !empty($this->recurring_item); |
|
2965 | 2965 | } |
2966 | 2966 | |
2967 | 2967 | /** |
2968 | 2968 | * Checks if this is a taxable invoice. |
2969 | 2969 | */ |
2970 | 2970 | public function is_taxable() { |
2971 | - return ! $this->get_disable_taxes(); |
|
2971 | + return !$this->get_disable_taxes(); |
|
2972 | 2972 | } |
2973 | 2973 | |
2974 | 2974 | /** |
@@ -2982,45 +2982,45 @@ discard block |
||
2982 | 2982 | * Checks to see if the invoice requires payment. |
2983 | 2983 | */ |
2984 | 2984 | public function is_free() { |
2985 | - $is_free = ( (float) wpinv_round_amount( $this->get_initial_total() ) == 0 ); |
|
2985 | + $is_free = ((float) wpinv_round_amount($this->get_initial_total()) == 0); |
|
2986 | 2986 | |
2987 | - if ( $this->is_recurring() && $this->get_recurring_total() > 0 ) { |
|
2987 | + if ($this->is_recurring() && $this->get_recurring_total() > 0) { |
|
2988 | 2988 | $is_free = false; |
2989 | 2989 | } |
2990 | 2990 | |
2991 | - return apply_filters( 'wpinv_invoice_is_free', $is_free, $this ); |
|
2991 | + return apply_filters('wpinv_invoice_is_free', $is_free, $this); |
|
2992 | 2992 | } |
2993 | 2993 | |
2994 | 2994 | /** |
2995 | 2995 | * Checks if the invoice is paid. |
2996 | 2996 | */ |
2997 | 2997 | public function is_paid() { |
2998 | - $is_paid = $this->has_status( array( 'publish', 'wpi-processing', 'wpi-renewal' ) ); |
|
2999 | - return apply_filters( 'wpinv_invoice_is_paid', $is_paid, $this ); |
|
2998 | + $is_paid = $this->has_status(array('publish', 'wpi-processing', 'wpi-renewal')); |
|
2999 | + return apply_filters('wpinv_invoice_is_paid', $is_paid, $this); |
|
3000 | 3000 | } |
3001 | 3001 | |
3002 | 3002 | /** |
3003 | 3003 | * Checks if the invoice needs payment. |
3004 | 3004 | */ |
3005 | 3005 | public function needs_payment() { |
3006 | - $needs_payment = ! $this->is_paid() && ! $this->is_refunded() && ! $this->is_free(); |
|
3007 | - return apply_filters( 'wpinv_needs_payment', $needs_payment, $this ); |
|
3006 | + $needs_payment = !$this->is_paid() && !$this->is_refunded() && !$this->is_free(); |
|
3007 | + return apply_filters('wpinv_needs_payment', $needs_payment, $this); |
|
3008 | 3008 | } |
3009 | 3009 | |
3010 | 3010 | /** |
3011 | 3011 | * Checks if the invoice is refunded. |
3012 | 3012 | */ |
3013 | 3013 | public function is_refunded() { |
3014 | - $is_refunded = $this->has_status( 'wpi-refunded' ); |
|
3015 | - return apply_filters( 'wpinv_invoice_is_refunded', $is_refunded, $this ); |
|
3014 | + $is_refunded = $this->has_status('wpi-refunded'); |
|
3015 | + return apply_filters('wpinv_invoice_is_refunded', $is_refunded, $this); |
|
3016 | 3016 | } |
3017 | 3017 | |
3018 | 3018 | /** |
3019 | 3019 | * Checks if the invoice is held. |
3020 | 3020 | */ |
3021 | 3021 | public function is_held() { |
3022 | - $is_held = $this->has_status( 'wpi-onhold' ); |
|
3023 | - return apply_filters( 'wpinv_invoice_is_held', $is_held, $this ); |
|
3022 | + $is_held = $this->has_status('wpi-onhold'); |
|
3023 | + return apply_filters('wpinv_invoice_is_held', $is_held, $this); |
|
3024 | 3024 | } |
3025 | 3025 | |
3026 | 3026 | /** |
@@ -3028,30 +3028,30 @@ discard block |
||
3028 | 3028 | */ |
3029 | 3029 | public function is_due() { |
3030 | 3030 | $due_date = $this->get_due_date(); |
3031 | - return empty( $due_date ) ? false : current_time( 'timestamp' ) > strtotime( $due_date ); |
|
3031 | + return empty($due_date) ? false : current_time('timestamp') > strtotime($due_date); |
|
3032 | 3032 | } |
3033 | 3033 | |
3034 | 3034 | /** |
3035 | 3035 | * Checks if the invoice is draft. |
3036 | 3036 | */ |
3037 | 3037 | public function is_draft() { |
3038 | - return $this->has_status( 'draft, auto-draft' ); |
|
3038 | + return $this->has_status('draft, auto-draft'); |
|
3039 | 3039 | } |
3040 | 3040 | |
3041 | 3041 | /** |
3042 | 3042 | * Checks if the invoice has a given status. |
3043 | 3043 | */ |
3044 | - public function has_status( $status ) { |
|
3045 | - $status = wpinv_parse_list( $status ); |
|
3046 | - return apply_filters( 'wpinv_has_status', in_array( $this->get_status(), $status ), $status ); |
|
3044 | + public function has_status($status) { |
|
3045 | + $status = wpinv_parse_list($status); |
|
3046 | + return apply_filters('wpinv_has_status', in_array($this->get_status(), $status), $status); |
|
3047 | 3047 | } |
3048 | 3048 | |
3049 | 3049 | /** |
3050 | 3050 | * Checks if the invoice is of a given type. |
3051 | 3051 | */ |
3052 | - public function is_type( $type ) { |
|
3053 | - $type = wpinv_parse_list( $type ); |
|
3054 | - return in_array( $this->get_type(), $type ); |
|
3052 | + public function is_type($type) { |
|
3053 | + $type = wpinv_parse_list($type); |
|
3054 | + return in_array($this->get_type(), $type); |
|
3055 | 3055 | } |
3056 | 3056 | |
3057 | 3057 | /** |
@@ -3083,8 +3083,8 @@ discard block |
||
3083 | 3083 | * |
3084 | 3084 | */ |
3085 | 3085 | public function is_initial_free() { |
3086 | - $is_initial_free = ! ( (float) wpinv_round_amount( $this->get_initial_total() ) > 0 ); |
|
3087 | - return apply_filters( 'wpinv_invoice_is_initial_free', $is_initial_free, $this->get_cart_details(), $this ); |
|
3086 | + $is_initial_free = !((float) wpinv_round_amount($this->get_initial_total()) > 0); |
|
3087 | + return apply_filters('wpinv_invoice_is_initial_free', $is_initial_free, $this->get_cart_details(), $this); |
|
3088 | 3088 | } |
3089 | 3089 | |
3090 | 3090 | /** |
@@ -3094,11 +3094,11 @@ discard block |
||
3094 | 3094 | public function item_has_free_trial() { |
3095 | 3095 | |
3096 | 3096 | // Ensure we have a recurring item. |
3097 | - if ( ! $this->is_recurring() ) { |
|
3097 | + if (!$this->is_recurring()) { |
|
3098 | 3098 | return false; |
3099 | 3099 | } |
3100 | 3100 | |
3101 | - $item = $this->get_recurring( true ); |
|
3101 | + $item = $this->get_recurring(true); |
|
3102 | 3102 | return $item->has_free_trial(); |
3103 | 3103 | } |
3104 | 3104 | |
@@ -3106,7 +3106,7 @@ discard block |
||
3106 | 3106 | * Check if the free trial is a result of a discount. |
3107 | 3107 | */ |
3108 | 3108 | public function is_free_trial_from_discount() { |
3109 | - return $this->has_free_trial() && ! $this->item_has_free_trial(); |
|
3109 | + return $this->has_free_trial() && !$this->item_has_free_trial(); |
|
3110 | 3110 | } |
3111 | 3111 | |
3112 | 3112 | /** |
@@ -3114,12 +3114,12 @@ discard block |
||
3114 | 3114 | */ |
3115 | 3115 | public function discount_first_payment_only() { |
3116 | 3116 | |
3117 | - $discount = wpinv_get_discount_obj( $this->get_discount_code() ); |
|
3118 | - if ( ! $discount->exists() || ! $this->is_recurring() ) { |
|
3117 | + $discount = wpinv_get_discount_obj($this->get_discount_code()); |
|
3118 | + if (!$discount->exists() || !$this->is_recurring()) { |
|
3119 | 3119 | return true; |
3120 | 3120 | } |
3121 | 3121 | |
3122 | - return ! $discount->get_is_recurring(); |
|
3122 | + return !$discount->get_is_recurring(); |
|
3123 | 3123 | } |
3124 | 3124 | |
3125 | 3125 | /* |
@@ -3137,27 +3137,27 @@ discard block |
||
3137 | 3137 | * @param GetPaid_Form_Item|array $item |
3138 | 3138 | * @return WP_Error|Bool |
3139 | 3139 | */ |
3140 | - public function add_item( $item ) { |
|
3140 | + public function add_item($item) { |
|
3141 | 3141 | |
3142 | - if ( is_array( $item ) ) { |
|
3143 | - $item = $this->process_array_item( $item ); |
|
3142 | + if (is_array($item)) { |
|
3143 | + $item = $this->process_array_item($item); |
|
3144 | 3144 | } |
3145 | 3145 | |
3146 | - if ( is_numeric( $item ) ) { |
|
3147 | - $item = new GetPaid_Form_Item( $item ); |
|
3146 | + if (is_numeric($item)) { |
|
3147 | + $item = new GetPaid_Form_Item($item); |
|
3148 | 3148 | } |
3149 | 3149 | |
3150 | 3150 | // Make sure that it is available for purchase. |
3151 | - if ( $item->get_id() > 0 && ! $item->can_purchase() ) { |
|
3152 | - return new WP_Error( 'invalid_item', __( 'This item is not available for purchase', 'invoicing' ) ); |
|
3151 | + if ($item->get_id() > 0 && !$item->can_purchase()) { |
|
3152 | + return new WP_Error('invalid_item', __('This item is not available for purchase', 'invoicing')); |
|
3153 | 3153 | } |
3154 | 3154 | |
3155 | 3155 | // Do we have a recurring item? |
3156 | - if ( $item->is_recurring() ) { |
|
3156 | + if ($item->is_recurring()) { |
|
3157 | 3157 | |
3158 | 3158 | // An invoice can only contain one recurring item. |
3159 | - if ( ! empty( $this->recurring_item && $this->recurring_item != (int) $item->get_id() ) ) { |
|
3160 | - return new WP_Error( 'recurring_item', __( 'An invoice can only contain one recurring item', 'invoicing' ) ); |
|
3159 | + if (!empty($this->recurring_item && $this->recurring_item != (int) $item->get_id())) { |
|
3160 | + return new WP_Error('recurring_item', __('An invoice can only contain one recurring item', 'invoicing')); |
|
3161 | 3161 | } |
3162 | 3162 | |
3163 | 3163 | $this->recurring_item = $item->get_id(); |
@@ -3168,9 +3168,9 @@ discard block |
||
3168 | 3168 | |
3169 | 3169 | // Retrieve all items. |
3170 | 3170 | $items = $this->get_items(); |
3171 | - $items[ (int) $item->get_id() ] = $item; |
|
3171 | + $items[(int) $item->get_id()] = $item; |
|
3172 | 3172 | |
3173 | - $this->set_prop( 'items', $items ); |
|
3173 | + $this->set_prop('items', $items); |
|
3174 | 3174 | return true; |
3175 | 3175 | } |
3176 | 3176 | |
@@ -3180,26 +3180,26 @@ discard block |
||
3180 | 3180 | * @since 1.0.19 |
3181 | 3181 | * @return GetPaid_Form_Item |
3182 | 3182 | */ |
3183 | - protected function process_array_item( $array ) { |
|
3183 | + protected function process_array_item($array) { |
|
3184 | 3184 | |
3185 | - $item_id = isset( $array['item_id'] ) ? $array['item_id'] : 0; |
|
3186 | - $item = new GetPaid_Form_Item( $item_id ); |
|
3185 | + $item_id = isset($array['item_id']) ? $array['item_id'] : 0; |
|
3186 | + $item = new GetPaid_Form_Item($item_id); |
|
3187 | 3187 | |
3188 | 3188 | // Set item data. |
3189 | - foreach ( array( 'name', 'price', 'description' ) as $key ) { |
|
3190 | - if ( isset( $array[ "item_$key" ] ) ) { |
|
3189 | + foreach (array('name', 'price', 'description') as $key) { |
|
3190 | + if (isset($array["item_$key"])) { |
|
3191 | 3191 | $method = "set_$key"; |
3192 | - $item->$method( $array[ "item_$key" ] ); |
|
3192 | + $item->$method($array["item_$key"]); |
|
3193 | 3193 | } |
3194 | 3194 | } |
3195 | 3195 | |
3196 | - if ( isset( $array['quantity'] ) ) { |
|
3197 | - $item->set_quantity( $array['quantity'] ); |
|
3196 | + if (isset($array['quantity'])) { |
|
3197 | + $item->set_quantity($array['quantity']); |
|
3198 | 3198 | } |
3199 | 3199 | |
3200 | 3200 | // Set item meta. |
3201 | - if ( isset( $array['meta'] ) && is_array( $array['meta'] ) ) { |
|
3202 | - $item->set_item_meta( $array['meta'] ); |
|
3201 | + if (isset($array['meta']) && is_array($array['meta'])) { |
|
3202 | + $item->set_item_meta($array['meta']); |
|
3203 | 3203 | } |
3204 | 3204 | |
3205 | 3205 | return $item; |
@@ -3211,10 +3211,10 @@ discard block |
||
3211 | 3211 | * |
3212 | 3212 | * @since 1.0.19 |
3213 | 3213 | */ |
3214 | - public function get_item( $item_id ) { |
|
3214 | + public function get_item($item_id) { |
|
3215 | 3215 | $items = $this->get_items(); |
3216 | 3216 | $item_id = (int) $item_id; |
3217 | - return ( ! empty( $item_id ) && isset( $items[ $item_id ] ) ) ? $items[ $item_id ] : null; |
|
3217 | + return (!empty($item_id) && isset($items[$item_id])) ? $items[$item_id] : null; |
|
3218 | 3218 | } |
3219 | 3219 | |
3220 | 3220 | /** |
@@ -3222,17 +3222,17 @@ discard block |
||
3222 | 3222 | * |
3223 | 3223 | * @since 1.0.19 |
3224 | 3224 | */ |
3225 | - public function remove_item( $item_id ) { |
|
3225 | + public function remove_item($item_id) { |
|
3226 | 3226 | $items = $this->get_items(); |
3227 | 3227 | $item_id = (int) $item_id; |
3228 | 3228 | |
3229 | - if ( $item_id == $this->recurring_item ) { |
|
3229 | + if ($item_id == $this->recurring_item) { |
|
3230 | 3230 | $this->recurring_item = null; |
3231 | 3231 | } |
3232 | 3232 | |
3233 | - if ( isset( $items[ $item_id ] ) ) { |
|
3234 | - unset( $items[ $item_id ] ); |
|
3235 | - $this->set_prop( 'items', $items ); |
|
3233 | + if (isset($items[$item_id])) { |
|
3234 | + unset($items[$item_id]); |
|
3235 | + $this->set_prop('items', $items); |
|
3236 | 3236 | } |
3237 | 3237 | } |
3238 | 3238 | |
@@ -3242,11 +3242,11 @@ discard block |
||
3242 | 3242 | * @param array $fee An array of fee details. name, initial_fee, and recurring_fee are required. |
3243 | 3243 | * @since 1.0.19 |
3244 | 3244 | */ |
3245 | - public function add_fee( $fee ) { |
|
3245 | + public function add_fee($fee) { |
|
3246 | 3246 | |
3247 | 3247 | $fees = $this->get_fees(); |
3248 | - $fees[ $fee['name'] ] = $fee; |
|
3249 | - $this->set_prop( 'fees', $fees ); |
|
3248 | + $fees[$fee['name']] = $fee; |
|
3249 | + $this->set_prop('fees', $fees); |
|
3250 | 3250 | |
3251 | 3251 | } |
3252 | 3252 | |
@@ -3255,9 +3255,9 @@ discard block |
||
3255 | 3255 | * |
3256 | 3256 | * @since 1.0.19 |
3257 | 3257 | */ |
3258 | - public function get_fee( $fee ) { |
|
3258 | + public function get_fee($fee) { |
|
3259 | 3259 | $fees = $this->get_fees(); |
3260 | - return isset( $fees[ $fee ] ) ? $fees[ $fee ] : null; |
|
3260 | + return isset($fees[$fee]) ? $fees[$fee] : null; |
|
3261 | 3261 | } |
3262 | 3262 | |
3263 | 3263 | /** |
@@ -3265,11 +3265,11 @@ discard block |
||
3265 | 3265 | * |
3266 | 3266 | * @since 1.0.19 |
3267 | 3267 | */ |
3268 | - public function remove_fee( $fee ) { |
|
3268 | + public function remove_fee($fee) { |
|
3269 | 3269 | $fees = $this->get_fees(); |
3270 | - if ( isset( $fees[ $fee ] ) ) { |
|
3271 | - unset( $fees[ $fee ] ); |
|
3272 | - $this->set_prop( 'fees', $fees ); |
|
3270 | + if (isset($fees[$fee])) { |
|
3271 | + unset($fees[$fee]); |
|
3272 | + $this->set_prop('fees', $fees); |
|
3273 | 3273 | } |
3274 | 3274 | } |
3275 | 3275 | |
@@ -3279,11 +3279,11 @@ discard block |
||
3279 | 3279 | * @param array $discount An array of discount details. name, initial_discount, and recurring_discount are required. Include discount_code if the discount is from a discount code. |
3280 | 3280 | * @since 1.0.19 |
3281 | 3281 | */ |
3282 | - public function add_discount( $discount ) { |
|
3282 | + public function add_discount($discount) { |
|
3283 | 3283 | |
3284 | 3284 | $discounts = $this->get_discounts(); |
3285 | - $discounts[ $discount['name'] ] = $discount; |
|
3286 | - $this->set_prop( 'discounts', $discounts ); |
|
3285 | + $discounts[$discount['name']] = $discount; |
|
3286 | + $this->set_prop('discounts', $discounts); |
|
3287 | 3287 | |
3288 | 3288 | } |
3289 | 3289 | |
@@ -3293,15 +3293,15 @@ discard block |
||
3293 | 3293 | * @since 1.0.19 |
3294 | 3294 | * @return float |
3295 | 3295 | */ |
3296 | - public function get_discount( $discount = false ) { |
|
3296 | + public function get_discount($discount = false) { |
|
3297 | 3297 | |
3298 | 3298 | // Backwards compatibilty. |
3299 | - if ( empty( $discount ) ) { |
|
3299 | + if (empty($discount)) { |
|
3300 | 3300 | return $this->get_total_discount(); |
3301 | 3301 | } |
3302 | 3302 | |
3303 | 3303 | $discounts = $this->get_discounts(); |
3304 | - return isset( $discounts[ $discount ] ) ? $discounts[ $discount ] : null; |
|
3304 | + return isset($discounts[$discount]) ? $discounts[$discount] : null; |
|
3305 | 3305 | } |
3306 | 3306 | |
3307 | 3307 | /** |
@@ -3309,11 +3309,11 @@ discard block |
||
3309 | 3309 | * |
3310 | 3310 | * @since 1.0.19 |
3311 | 3311 | */ |
3312 | - public function remove_discount( $discount ) { |
|
3312 | + public function remove_discount($discount) { |
|
3313 | 3313 | $discounts = $this->get_discounts(); |
3314 | - if ( isset( $discounts[ $discount ] ) ) { |
|
3315 | - unset( $discounts[ $discount ] ); |
|
3316 | - $this->set_prop( 'discounts', $discounts ); |
|
3314 | + if (isset($discounts[$discount])) { |
|
3315 | + unset($discounts[$discount]); |
|
3316 | + $this->set_prop('discounts', $discounts); |
|
3317 | 3317 | } |
3318 | 3318 | } |
3319 | 3319 | |
@@ -3322,12 +3322,12 @@ discard block |
||
3322 | 3322 | * |
3323 | 3323 | * @param array $tax An array of tax details. name, initial_tax, and recurring_tax are required. |
3324 | 3324 | */ |
3325 | - public function add_tax( $tax ) { |
|
3326 | - if ( $this->is_taxable() ) { |
|
3325 | + public function add_tax($tax) { |
|
3326 | + if ($this->is_taxable()) { |
|
3327 | 3327 | |
3328 | - $taxes = $this->get_taxes(); |
|
3329 | - $taxes[ $tax['name'] ] = $tax; |
|
3330 | - $this->set_prop( 'taxes', $tax ); |
|
3328 | + $taxes = $this->get_taxes(); |
|
3329 | + $taxes[$tax['name']] = $tax; |
|
3330 | + $this->set_prop('taxes', $tax); |
|
3331 | 3331 | |
3332 | 3332 | } |
3333 | 3333 | } |
@@ -3337,15 +3337,15 @@ discard block |
||
3337 | 3337 | * |
3338 | 3338 | * @since 1.0.19 |
3339 | 3339 | */ |
3340 | - public function get_tax( $tax = null ) { |
|
3340 | + public function get_tax($tax = null) { |
|
3341 | 3341 | |
3342 | 3342 | // Backwards compatility. |
3343 | - if ( empty( $tax ) ) { |
|
3343 | + if (empty($tax)) { |
|
3344 | 3344 | return $this->get_total_tax(); |
3345 | 3345 | } |
3346 | 3346 | |
3347 | 3347 | $taxes = $this->get_taxes(); |
3348 | - return isset( $taxes[ $tax ] ) ? $taxes[ $tax ] : null; |
|
3348 | + return isset($taxes[$tax]) ? $taxes[$tax] : null; |
|
3349 | 3349 | } |
3350 | 3350 | |
3351 | 3351 | /** |
@@ -3353,11 +3353,11 @@ discard block |
||
3353 | 3353 | * |
3354 | 3354 | * @since 1.0.19 |
3355 | 3355 | */ |
3356 | - public function remove_tax( $tax ) { |
|
3356 | + public function remove_tax($tax) { |
|
3357 | 3357 | $taxes = $this->get_taxes(); |
3358 | - if ( isset( $taxes[ $tax ] ) ) { |
|
3359 | - unset( $taxes[ $tax ] ); |
|
3360 | - $this->set_prop( 'taxes', $taxes ); |
|
3358 | + if (isset($taxes[$tax])) { |
|
3359 | + unset($taxes[$tax]); |
|
3360 | + $this->set_prop('taxes', $taxes); |
|
3361 | 3361 | } |
3362 | 3362 | } |
3363 | 3363 | |
@@ -3368,17 +3368,17 @@ discard block |
||
3368 | 3368 | * @return float The recalculated subtotal |
3369 | 3369 | */ |
3370 | 3370 | public function recalculate_subtotal() { |
3371 | - $items = $this->get_items(); |
|
3371 | + $items = $this->get_items(); |
|
3372 | 3372 | $subtotal = 0; |
3373 | 3373 | $recurring = 0; |
3374 | 3374 | |
3375 | - foreach ( $items as $item ) { |
|
3375 | + foreach ($items as $item) { |
|
3376 | 3376 | $subtotal += $item->get_sub_total(); |
3377 | 3377 | $recurring += $item->get_recurring_sub_total(); |
3378 | 3378 | } |
3379 | 3379 | |
3380 | 3380 | $current = $this->is_renewal() ? $recurring : $subtotal; |
3381 | - $this->set_subtotal( $current ); |
|
3381 | + $this->set_subtotal($current); |
|
3382 | 3382 | |
3383 | 3383 | $this->totals['subtotal'] = array( |
3384 | 3384 | 'initial' => $subtotal, |
@@ -3399,14 +3399,14 @@ discard block |
||
3399 | 3399 | $discount = 0; |
3400 | 3400 | $recurring = 0; |
3401 | 3401 | |
3402 | - foreach ( $discounts as $data ) { |
|
3403 | - $discount += wpinv_sanitize_amount( $data['initial_discount'] ); |
|
3404 | - $recurring += wpinv_sanitize_amount( $data['recurring_discount'] ); |
|
3402 | + foreach ($discounts as $data) { |
|
3403 | + $discount += wpinv_sanitize_amount($data['initial_discount']); |
|
3404 | + $recurring += wpinv_sanitize_amount($data['recurring_discount']); |
|
3405 | 3405 | } |
3406 | 3406 | |
3407 | 3407 | $current = $this->is_renewal() ? $recurring : $discount; |
3408 | 3408 | |
3409 | - $this->set_total_discount( $current ); |
|
3409 | + $this->set_total_discount($current); |
|
3410 | 3410 | |
3411 | 3411 | $this->totals['discount'] = array( |
3412 | 3412 | 'initial' => $discount, |
@@ -3424,17 +3424,17 @@ discard block |
||
3424 | 3424 | * @return float The recalculated tax |
3425 | 3425 | */ |
3426 | 3426 | public function recalculate_total_tax() { |
3427 | - $taxes = $this->get_taxes(); |
|
3427 | + $taxes = $this->get_taxes(); |
|
3428 | 3428 | $tax = 0; |
3429 | 3429 | $recurring = 0; |
3430 | 3430 | |
3431 | - foreach ( $taxes as $data ) { |
|
3432 | - $tax += wpinv_sanitize_amount( $data['initial_tax'] ); |
|
3433 | - $recurring += wpinv_sanitize_amount( $data['recurring_tax'] ); |
|
3431 | + foreach ($taxes as $data) { |
|
3432 | + $tax += wpinv_sanitize_amount($data['initial_tax']); |
|
3433 | + $recurring += wpinv_sanitize_amount($data['recurring_tax']); |
|
3434 | 3434 | } |
3435 | 3435 | |
3436 | 3436 | $current = $this->is_renewal() ? $recurring : $tax; |
3437 | - $this->set_total_tax( $current ); |
|
3437 | + $this->set_total_tax($current); |
|
3438 | 3438 | |
3439 | 3439 | $this->totals['tax'] = array( |
3440 | 3440 | 'initial' => $tax, |
@@ -3456,20 +3456,20 @@ discard block |
||
3456 | 3456 | $fee = 0; |
3457 | 3457 | $recurring = 0; |
3458 | 3458 | |
3459 | - foreach ( $fees as $data ) { |
|
3460 | - $fee += wpinv_sanitize_amount( $data['initial_fee'] ); |
|
3461 | - $recurring += wpinv_sanitize_amount( $data['recurring_fee'] ); |
|
3459 | + foreach ($fees as $data) { |
|
3460 | + $fee += wpinv_sanitize_amount($data['initial_fee']); |
|
3461 | + $recurring += wpinv_sanitize_amount($data['recurring_fee']); |
|
3462 | 3462 | } |
3463 | 3463 | |
3464 | 3464 | $current = $this->is_renewal() ? $recurring : $fee; |
3465 | - $this->set_total_fees( $current ); |
|
3465 | + $this->set_total_fees($current); |
|
3466 | 3466 | |
3467 | 3467 | $this->totals['fee'] = array( |
3468 | 3468 | 'initial' => $fee, |
3469 | 3469 | 'recurring' => $recurring, |
3470 | 3470 | ); |
3471 | 3471 | |
3472 | - $this->set_total_fees( $fee ); |
|
3472 | + $this->set_total_fees($fee); |
|
3473 | 3473 | return $current; |
3474 | 3474 | } |
3475 | 3475 | |
@@ -3490,9 +3490,9 @@ discard block |
||
3490 | 3490 | /** |
3491 | 3491 | * @deprecated |
3492 | 3492 | */ |
3493 | - public function recalculate_totals( $temp = false ) { |
|
3494 | - $this->update_items( $temp ); |
|
3495 | - $this->save( true ); |
|
3493 | + public function recalculate_totals($temp = false) { |
|
3494 | + $this->update_items($temp); |
|
3495 | + $this->save(true); |
|
3496 | 3496 | return $this; |
3497 | 3497 | } |
3498 | 3498 | |
@@ -3510,10 +3510,10 @@ discard block |
||
3510 | 3510 | * @return int|false The new note's ID on success, false on failure. |
3511 | 3511 | * |
3512 | 3512 | */ |
3513 | - public function add_note( $note = '', $customer_type = false, $added_by_user = false, $system = false ) { |
|
3513 | + public function add_note($note = '', $customer_type = false, $added_by_user = false, $system = false) { |
|
3514 | 3514 | |
3515 | 3515 | // Bail if no note specified or this invoice is not yet saved. |
3516 | - if ( ! $note || $this->get_id() == 0 || ( ! is_user_logged_in() && ! $system ) ) { |
|
3516 | + if (!$note || $this->get_id() == 0 || (!is_user_logged_in() && !$system)) { |
|
3517 | 3517 | return false; |
3518 | 3518 | } |
3519 | 3519 | |
@@ -3521,23 +3521,23 @@ discard block |
||
3521 | 3521 | $author_email = '[email protected]'; |
3522 | 3522 | |
3523 | 3523 | // If this is an admin comment or it has been added by the user. |
3524 | - if ( is_user_logged_in() && ( ! $system || $added_by_user ) ) { |
|
3525 | - $user = get_user_by( 'id', get_current_user_id() ); |
|
3524 | + if (is_user_logged_in() && (!$system || $added_by_user)) { |
|
3525 | + $user = get_user_by('id', get_current_user_id()); |
|
3526 | 3526 | $author = $user->display_name; |
3527 | 3527 | $author_email = $user->user_email; |
3528 | 3528 | } |
3529 | 3529 | |
3530 | - return getpaid_notes()->add_invoice_note( $this, $note, $author, $author_email, $customer_type ); |
|
3530 | + return getpaid_notes()->add_invoice_note($this, $note, $author, $author_email, $customer_type); |
|
3531 | 3531 | |
3532 | 3532 | } |
3533 | 3533 | |
3534 | 3534 | /** |
3535 | 3535 | * Generates a unique key for the invoice. |
3536 | 3536 | */ |
3537 | - public function generate_key( $string = '' ) { |
|
3538 | - $auth_key = defined( 'AUTH_KEY' ) ? AUTH_KEY : ''; |
|
3537 | + public function generate_key($string = '') { |
|
3538 | + $auth_key = defined('AUTH_KEY') ? AUTH_KEY : ''; |
|
3539 | 3539 | return strtolower( |
3540 | - $string . md5( $this->get_id() . date( 'Y-m-d H:i:s' ) . $auth_key . uniqid( 'wpinv', true ) ) |
|
3540 | + $string . md5($this->get_id() . date('Y-m-d H:i:s') . $auth_key . uniqid('wpinv', true)) |
|
3541 | 3541 | ); |
3542 | 3542 | } |
3543 | 3543 | |
@@ -3547,11 +3547,11 @@ discard block |
||
3547 | 3547 | public function generate_number() { |
3548 | 3548 | $number = $this->get_id(); |
3549 | 3549 | |
3550 | - if ( wpinv_sequential_number_active( $this->get_post_type() ) ) { |
|
3551 | - $number = wpinv_get_next_invoice_number( $this->get_post_type() ); |
|
3550 | + if (wpinv_sequential_number_active($this->get_post_type())) { |
|
3551 | + $number = wpinv_get_next_invoice_number($this->get_post_type()); |
|
3552 | 3552 | } |
3553 | 3553 | |
3554 | - return wpinv_format_invoice_number( $number, $this->get_post_type() ); |
|
3554 | + return wpinv_format_invoice_number($number, $this->get_post_type()); |
|
3555 | 3555 | |
3556 | 3556 | } |
3557 | 3557 | |
@@ -3564,55 +3564,55 @@ discard block |
||
3564 | 3564 | // Reset status transition variable. |
3565 | 3565 | $this->status_transition = false; |
3566 | 3566 | |
3567 | - if ( $status_transition ) { |
|
3567 | + if ($status_transition) { |
|
3568 | 3568 | try { |
3569 | 3569 | |
3570 | 3570 | // Fire a hook for the status change. |
3571 | - do_action( 'getpaid_invoice_status_' . $status_transition['to'], $this, $status_transition ); |
|
3571 | + do_action('getpaid_invoice_status_' . $status_transition['to'], $this, $status_transition); |
|
3572 | 3572 | |
3573 | 3573 | // @deprecated this is deprecated and will be removed in the future. |
3574 | - do_action( 'wpinv_status_' . $status_transition['to'], $this->get_id(), $status_transition['from'] ); |
|
3574 | + do_action('wpinv_status_' . $status_transition['to'], $this->get_id(), $status_transition['from']); |
|
3575 | 3575 | |
3576 | - if ( ! empty( $status_transition['from'] ) ) { |
|
3576 | + if (!empty($status_transition['from'])) { |
|
3577 | 3577 | |
3578 | 3578 | /* translators: 1: old invoice status 2: new invoice status */ |
3579 | - $transition_note = sprintf( __( 'Status changed from %1$s to %2$s.', 'invoicing' ), wpinv_status_nicename( $status_transition['from'], $this ), wpinv_status_nicename( $status_transition['to'], $this ) ); |
|
3579 | + $transition_note = sprintf(__('Status changed from %1$s to %2$s.', 'invoicing'), wpinv_status_nicename($status_transition['from'], $this), wpinv_status_nicename($status_transition['to'], $this)); |
|
3580 | 3580 | |
3581 | 3581 | // Fire another hook. |
3582 | - do_action( 'getpaid_invoice_status_' . $status_transition['from'] . '_to_' . $status_transition['to'], $this ); |
|
3583 | - do_action( 'getpaid_invoice_status_changed', $this, $status_transition['from'], $status_transition['to'] ); |
|
3582 | + do_action('getpaid_invoice_status_' . $status_transition['from'] . '_to_' . $status_transition['to'], $this); |
|
3583 | + do_action('getpaid_invoice_status_changed', $this, $status_transition['from'], $status_transition['to']); |
|
3584 | 3584 | |
3585 | 3585 | // @deprecated this is deprecated and will be removed in the future. |
3586 | - do_action( 'wpinv_status_' . $status_transition['from'] . '_to_' . $status_transition['to'], $this->get_id(), $status_transition['from'] ); |
|
3586 | + do_action('wpinv_status_' . $status_transition['from'] . '_to_' . $status_transition['to'], $this->get_id(), $status_transition['from']); |
|
3587 | 3587 | |
3588 | 3588 | // Note the transition occurred. |
3589 | - $this->add_note( trim( $status_transition['note'] . ' ' . $transition_note ), false, $status_transition['manual'] ); |
|
3589 | + $this->add_note(trim($status_transition['note'] . ' ' . $transition_note), false, $status_transition['manual']); |
|
3590 | 3590 | |
3591 | 3591 | // Work out if this was for a payment, and trigger a payment_status hook instead. |
3592 | 3592 | if ( |
3593 | - in_array( $status_transition['from'], array( 'wpi-cancelled', 'wpi-pending', 'wpi-failed', 'wpi-refunded', 'wpi-onhold' ), true ) |
|
3594 | - && in_array( $status_transition['to'], array( 'publish', 'wpi-processing', 'wpi-renewal' ), true ) |
|
3593 | + in_array($status_transition['from'], array('wpi-cancelled', 'wpi-pending', 'wpi-failed', 'wpi-refunded', 'wpi-onhold'), true) |
|
3594 | + && in_array($status_transition['to'], array('publish', 'wpi-processing', 'wpi-renewal'), true) |
|
3595 | 3595 | ) { |
3596 | - do_action( 'getpaid_invoice_payment_status_changed', $this, $status_transition ); |
|
3596 | + do_action('getpaid_invoice_payment_status_changed', $this, $status_transition); |
|
3597 | 3597 | } |
3598 | 3598 | |
3599 | 3599 | // Work out if this was for a payment reversal, and trigger a payment_status_reversed hook instead. |
3600 | 3600 | if ( |
3601 | - in_array( $status_transition['from'], array( 'publish', 'wpi-processing', 'wpi-renewal' ), true ) |
|
3602 | - && in_array( $status_transition['to'], array( 'wpi-cancelled', 'wpi-pending', 'wpi-failed', 'wpi-refunded', 'wpi-onhold' ), true ) |
|
3601 | + in_array($status_transition['from'], array('publish', 'wpi-processing', 'wpi-renewal'), true) |
|
3602 | + && in_array($status_transition['to'], array('wpi-cancelled', 'wpi-pending', 'wpi-failed', 'wpi-refunded', 'wpi-onhold'), true) |
|
3603 | 3603 | ) { |
3604 | - do_action( 'getpaid_invoice_payment_status_reversed', $this, $status_transition ); |
|
3604 | + do_action('getpaid_invoice_payment_status_reversed', $this, $status_transition); |
|
3605 | 3605 | } |
3606 | 3606 | } else { |
3607 | 3607 | /* translators: %s: new invoice status */ |
3608 | - $transition_note = sprintf( __( 'Status set to %s.', 'invoicing' ), wpinv_status_nicename( $status_transition['to'], $this ) ); |
|
3608 | + $transition_note = sprintf(__('Status set to %s.', 'invoicing'), wpinv_status_nicename($status_transition['to'], $this)); |
|
3609 | 3609 | |
3610 | 3610 | // Note the transition occurred. |
3611 | - $this->add_note( trim( $status_transition['note'] . ' ' . $transition_note ), 0, $status_transition['manual'] ); |
|
3611 | + $this->add_note(trim($status_transition['note'] . ' ' . $transition_note), 0, $status_transition['manual']); |
|
3612 | 3612 | |
3613 | 3613 | } |
3614 | - } catch ( Exception $e ) { |
|
3615 | - $this->add_note( __( 'Error during status transition.', 'invoicing' ) . ' ' . $e->getMessage() ); |
|
3614 | + } catch (Exception $e) { |
|
3615 | + $this->add_note(__('Error during status transition.', 'invoicing') . ' ' . $e->getMessage()); |
|
3616 | 3616 | } |
3617 | 3617 | } |
3618 | 3618 | } |
@@ -3620,13 +3620,13 @@ discard block |
||
3620 | 3620 | /** |
3621 | 3621 | * Updates an invoice status. |
3622 | 3622 | */ |
3623 | - public function update_status( $new_status = false, $note = '', $manual = false ) { |
|
3623 | + public function update_status($new_status = false, $note = '', $manual = false) { |
|
3624 | 3624 | |
3625 | 3625 | // Fires before updating a status. |
3626 | - do_action( 'wpinv_before_invoice_status_change', $this->get_id(), $new_status, $this->get_status( 'edit' ) ); |
|
3626 | + do_action('wpinv_before_invoice_status_change', $this->get_id(), $new_status, $this->get_status('edit')); |
|
3627 | 3627 | |
3628 | 3628 | // Update the status. |
3629 | - $this->set_status( $new_status, $note, $manual ); |
|
3629 | + $this->set_status($new_status, $note, $manual); |
|
3630 | 3630 | |
3631 | 3631 | // Save the order. |
3632 | 3632 | return $this->save(); |
@@ -3637,18 +3637,18 @@ discard block |
||
3637 | 3637 | * @deprecated |
3638 | 3638 | */ |
3639 | 3639 | public function refresh_item_ids() { |
3640 | - $item_ids = implode( ',', array_unique( array_keys( $this->get_items() ) ) ); |
|
3641 | - update_post_meta( $this->get_id(), '_wpinv_item_ids', $item_ids ); |
|
3640 | + $item_ids = implode(',', array_unique(array_keys($this->get_items()))); |
|
3641 | + update_post_meta($this->get_id(), '_wpinv_item_ids', $item_ids); |
|
3642 | 3642 | } |
3643 | 3643 | |
3644 | 3644 | /** |
3645 | 3645 | * @deprecated |
3646 | 3646 | */ |
3647 | - public function update_items( $temp = false ) { |
|
3647 | + public function update_items($temp = false) { |
|
3648 | 3648 | |
3649 | - $this->set_items( $this->get_items() ); |
|
3649 | + $this->set_items($this->get_items()); |
|
3650 | 3650 | |
3651 | - if ( ! $temp ) { |
|
3651 | + if (!$temp) { |
|
3652 | 3652 | $this->save(); |
3653 | 3653 | } |
3654 | 3654 | |
@@ -3662,11 +3662,11 @@ discard block |
||
3662 | 3662 | |
3663 | 3663 | $discount_code = $this->get_discount_code(); |
3664 | 3664 | |
3665 | - if ( empty( $discount_code ) ) { |
|
3665 | + if (empty($discount_code)) { |
|
3666 | 3666 | return false; |
3667 | 3667 | } |
3668 | 3668 | |
3669 | - $discount = wpinv_get_discount_obj( $discount_code ); |
|
3669 | + $discount = wpinv_get_discount_obj($discount_code); |
|
3670 | 3670 | |
3671 | 3671 | // Ensure it is active. |
3672 | 3672 | return $discount->exists(); |
@@ -3677,7 +3677,7 @@ discard block |
||
3677 | 3677 | * Refunds an invoice. |
3678 | 3678 | */ |
3679 | 3679 | public function refund() { |
3680 | - $this->set_status( 'wpi-refunded' ); |
|
3680 | + $this->set_status('wpi-refunded'); |
|
3681 | 3681 | $this->save(); |
3682 | 3682 | } |
3683 | 3683 | |
@@ -3686,56 +3686,56 @@ discard block |
||
3686 | 3686 | * |
3687 | 3687 | * @param string $transaction_id |
3688 | 3688 | */ |
3689 | - public function mark_paid( $transaction_id = null, $note = '' ) { |
|
3689 | + public function mark_paid($transaction_id = null, $note = '') { |
|
3690 | 3690 | |
3691 | 3691 | // Set the transaction id. |
3692 | - if ( empty( $transaction_id ) ) { |
|
3692 | + if (empty($transaction_id)) { |
|
3693 | 3693 | $transaction_id = $this->generate_key('trans_'); |
3694 | 3694 | } |
3695 | 3695 | |
3696 | - if ( ! $this->get_transaction_id() ) { |
|
3697 | - $this->set_transaction_id( $transaction_id ); |
|
3696 | + if (!$this->get_transaction_id()) { |
|
3697 | + $this->set_transaction_id($transaction_id); |
|
3698 | 3698 | } |
3699 | 3699 | |
3700 | - if ( $this->is_paid() && 'wpi-processing' != $this->get_status() ) { |
|
3700 | + if ($this->is_paid() && 'wpi-processing' != $this->get_status()) { |
|
3701 | 3701 | return $this->save(); |
3702 | 3702 | } |
3703 | 3703 | |
3704 | 3704 | // Set the completed date. |
3705 | - $this->set_date_completed( current_time( 'mysql' ) ); |
|
3705 | + $this->set_date_completed(current_time('mysql')); |
|
3706 | 3706 | |
3707 | 3707 | // Set the new status. |
3708 | - if ( $this->is_renewal() ) { |
|
3708 | + if ($this->is_renewal()) { |
|
3709 | 3709 | |
3710 | 3710 | $_note = sprintf( |
3711 | - __( 'Renewed via %s', 'invoicing' ), |
|
3712 | - $this->get_gateway_title() . empty( $note ) ? '' : " ($note)" |
|
3711 | + __('Renewed via %s', 'invoicing'), |
|
3712 | + $this->get_gateway_title() . empty($note) ? '' : " ($note)" |
|
3713 | 3713 | ); |
3714 | 3714 | |
3715 | - if ( 'none' == $this->get_gateway() ) { |
|
3715 | + if ('none' == $this->get_gateway()) { |
|
3716 | 3716 | $_note = $note; |
3717 | 3717 | } |
3718 | 3718 | |
3719 | - $this->set_status( 'wpi-renewal', $_note ); |
|
3719 | + $this->set_status('wpi-renewal', $_note); |
|
3720 | 3720 | |
3721 | 3721 | } else { |
3722 | 3722 | |
3723 | 3723 | $_note = sprintf( |
3724 | - __( 'Paid via %s', 'invoicing' ), |
|
3725 | - $this->get_gateway_title() . empty( $note ) ? '' : " ($note)" |
|
3724 | + __('Paid via %s', 'invoicing'), |
|
3725 | + $this->get_gateway_title() . empty($note) ? '' : " ($note)" |
|
3726 | 3726 | ); |
3727 | 3727 | |
3728 | - if ( 'none' == $this->get_gateway() ) { |
|
3728 | + if ('none' == $this->get_gateway()) { |
|
3729 | 3729 | $_note = $note; |
3730 | 3730 | } |
3731 | 3731 | |
3732 | - $this->set_status( 'publish',$_note ); |
|
3732 | + $this->set_status('publish', $_note); |
|
3733 | 3733 | |
3734 | 3734 | } |
3735 | 3735 | |
3736 | 3736 | // Set checkout mode. |
3737 | - $mode = wpinv_is_test_mode( $this->get_gateway() ) ? 'test' : 'live'; |
|
3738 | - $this->set_mode( $mode ); |
|
3737 | + $mode = wpinv_is_test_mode($this->get_gateway()) ? 'test' : 'live'; |
|
3738 | + $this->set_mode($mode); |
|
3739 | 3739 | |
3740 | 3740 | // Save the invoice. |
3741 | 3741 | $this->save(); |
@@ -3761,9 +3761,9 @@ discard block |
||
3761 | 3761 | * Clears the subscription's cache. |
3762 | 3762 | */ |
3763 | 3763 | public function clear_cache() { |
3764 | - wp_cache_delete( $this->get_key(), 'getpaid_invoice_keys_to_invoice_ids' ); |
|
3765 | - wp_cache_delete( $this->get_number(), 'getpaid_invoice_numbers_to_invoice_ids' ); |
|
3766 | - wp_cache_delete( $this->get_transaction_id(), 'getpaid_invoice_transaction_ids_to_invoice_ids' ); |
|
3764 | + wp_cache_delete($this->get_key(), 'getpaid_invoice_keys_to_invoice_ids'); |
|
3765 | + wp_cache_delete($this->get_number(), 'getpaid_invoice_numbers_to_invoice_ids'); |
|
3766 | + wp_cache_delete($this->get_transaction_id(), 'getpaid_invoice_transaction_ids_to_invoice_ids'); |
|
3767 | 3767 | } |
3768 | 3768 | |
3769 | 3769 | } |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | * |
6 | 6 | */ |
7 | 7 | |
8 | -defined( 'ABSPATH' ) || exit; |
|
8 | +defined('ABSPATH') || exit; |
|
9 | 9 | |
10 | 10 | /** |
11 | 11 | * GetPaid_Invoice_Exporter Class. |
@@ -19,33 +19,33 @@ discard block |
||
19 | 19 | * @param array $args Args to search for. |
20 | 20 | * @return array |
21 | 21 | */ |
22 | - public function get_invoice_query_args( $post_type, $args ) { |
|
22 | + public function get_invoice_query_args($post_type, $args) { |
|
23 | 23 | |
24 | 24 | $query_args = array( |
25 | 25 | 'post_type' => $post_type, |
26 | - 'post_status' => array_keys( wpinv_get_invoice_statuses( true, false, $post_type ) ), |
|
26 | + 'post_status' => array_keys(wpinv_get_invoice_statuses(true, false, $post_type)), |
|
27 | 27 | 'posts_per_page' => -1, |
28 | 28 | 'no_found_rows' => true, |
29 | 29 | 'update_post_term_cache' => false, |
30 | 30 | 'fields' => 'ids', |
31 | 31 | ); |
32 | 32 | |
33 | - if ( ! empty( $args['status'] ) && in_array( $args['status'], $query_args['post_status'], true ) ) { |
|
34 | - $query_args['post_status'] = wpinv_clean( wpinv_parse_list( $args['status'] ) ); |
|
33 | + if (!empty($args['status']) && in_array($args['status'], $query_args['post_status'], true)) { |
|
34 | + $query_args['post_status'] = wpinv_clean(wpinv_parse_list($args['status'])); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | $date_query = array(); |
38 | - if ( ! empty( $args['to_date'] ) ) { |
|
39 | - $date_query['before'] = wpinv_clean( $args['to_date'] ); |
|
38 | + if (!empty($args['to_date'])) { |
|
39 | + $date_query['before'] = wpinv_clean($args['to_date']); |
|
40 | 40 | } |
41 | 41 | |
42 | - if ( ! empty( $args['from_date'] ) ) { |
|
43 | - $date_query['after'] = wpinv_clean( $args['from_date'] ); |
|
42 | + if (!empty($args['from_date'])) { |
|
43 | + $date_query['after'] = wpinv_clean($args['from_date']); |
|
44 | 44 | } |
45 | 45 | |
46 | - if ( ! empty( $date_query ) ) { |
|
46 | + if (!empty($date_query)) { |
|
47 | 47 | $date_query['inclusive'] = true; |
48 | - $query_args['date_query'] = array( $date_query ); |
|
48 | + $query_args['date_query'] = array($date_query); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | return $query_args; |
@@ -57,13 +57,13 @@ discard block |
||
57 | 57 | * @param array $query_args WP_Query args. |
58 | 58 | * @return WPInv_Invoice[] |
59 | 59 | */ |
60 | - public function get_invoices( $query_args ) { |
|
60 | + public function get_invoices($query_args) { |
|
61 | 61 | |
62 | 62 | // Get invoices. |
63 | - $invoices = new WP_Query( $query_args ); |
|
63 | + $invoices = new WP_Query($query_args); |
|
64 | 64 | |
65 | 65 | // Prepare the results. |
66 | - return array_map( 'wpinv_get_invoice', $invoices->posts ); |
|
66 | + return array_map('wpinv_get_invoice', $invoices->posts); |
|
67 | 67 | |
68 | 68 | } |
69 | 69 | |
@@ -71,22 +71,22 @@ discard block |
||
71 | 71 | * Handles the actual download. |
72 | 72 | * |
73 | 73 | */ |
74 | - public function export( $post_type, $args ) { |
|
74 | + public function export($post_type, $args) { |
|
75 | 75 | |
76 | - $invoices = $this->get_invoices( $this->get_invoice_query_args( $post_type, $args ) ); |
|
76 | + $invoices = $this->get_invoices($this->get_invoice_query_args($post_type, $args)); |
|
77 | 77 | $stream = $this->prepare_output(); |
78 | - $headers = $this->get_export_fields( $post_type ); |
|
79 | - $file_type = $this->prepare_file_type( strtolower( getpaid_get_post_type_label( $post_type ) ) ); |
|
78 | + $headers = $this->get_export_fields($post_type); |
|
79 | + $file_type = $this->prepare_file_type(strtolower(getpaid_get_post_type_label($post_type))); |
|
80 | 80 | |
81 | - if ( 'csv' == $file_type ) { |
|
82 | - $this->download_csv( $invoices, $stream, $headers ); |
|
83 | - } else if( 'xml' == $file_type ) { |
|
84 | - $this->download_xml( $invoices, $stream, $headers ); |
|
81 | + if ('csv' == $file_type) { |
|
82 | + $this->download_csv($invoices, $stream, $headers); |
|
83 | + } else if ('xml' == $file_type) { |
|
84 | + $this->download_xml($invoices, $stream, $headers); |
|
85 | 85 | } else { |
86 | - $this->download_json( $invoices, $stream, $headers ); |
|
86 | + $this->download_json($invoices, $stream, $headers); |
|
87 | 87 | } |
88 | 88 | |
89 | - fclose( $stream ); |
|
89 | + fclose($stream); |
|
90 | 90 | exit; |
91 | 91 | } |
92 | 92 | |
@@ -98,25 +98,25 @@ discard block |
||
98 | 98 | * @since 1.0.19 |
99 | 99 | * @return array |
100 | 100 | */ |
101 | - public function prepare_row( $invoice, $fields ) { |
|
101 | + public function prepare_row($invoice, $fields) { |
|
102 | 102 | |
103 | 103 | $prepared = array(); |
104 | - $amount_fields = $this->get_amount_fields( $invoice->get_post_type() ); |
|
104 | + $amount_fields = $this->get_amount_fields($invoice->get_post_type()); |
|
105 | 105 | |
106 | - foreach ( $fields as $field ) { |
|
106 | + foreach ($fields as $field) { |
|
107 | 107 | |
108 | 108 | $value = ''; |
109 | 109 | $method = "get_$field"; |
110 | 110 | |
111 | - if ( method_exists( $invoice, $method ) ) { |
|
112 | - $value = $invoice->$method(); |
|
111 | + if (method_exists($invoice, $method)) { |
|
112 | + $value = $invoice->$method(); |
|
113 | 113 | } |
114 | 114 | |
115 | - if ( in_array( $field, $amount_fields ) ) { |
|
116 | - $value = wpinv_round_amount( wpinv_sanitize_amount( $value ) ); |
|
115 | + if (in_array($field, $amount_fields)) { |
|
116 | + $value = wpinv_round_amount(wpinv_sanitize_amount($value)); |
|
117 | 117 | } |
118 | 118 | |
119 | - $prepared[ $field ] = wpinv_clean( $value ); |
|
119 | + $prepared[$field] = wpinv_clean($value); |
|
120 | 120 | |
121 | 121 | } |
122 | 122 | |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | * @since 1.0.19 |
131 | 131 | * @return array |
132 | 132 | */ |
133 | - public function get_export_fields( $post_type ) { |
|
133 | + public function get_export_fields($post_type) { |
|
134 | 134 | |
135 | 135 | $fields = array( |
136 | 136 | 'id', |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | 'created_via' |
181 | 181 | ); |
182 | 182 | |
183 | - return apply_filters( 'getpaid_invoice_exporter_get_fields', $fields, $post_type ); |
|
183 | + return apply_filters('getpaid_invoice_exporter_get_fields', $fields, $post_type); |
|
184 | 184 | } |
185 | 185 | |
186 | 186 | /** |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | * @since 1.0.19 |
191 | 191 | * @return array |
192 | 192 | */ |
193 | - public function get_amount_fields( $post_type ) { |
|
193 | + public function get_amount_fields($post_type) { |
|
194 | 194 | |
195 | 195 | $fields = array( |
196 | 196 | 'subtotal', |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | 'total_fees' |
200 | 200 | ); |
201 | 201 | |
202 | - return apply_filters( 'getpaid_invoice_exporter_get_amount_fields', $fields, $post_type ); |
|
202 | + return apply_filters('getpaid_invoice_exporter_get_amount_fields', $fields, $post_type); |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | } |