@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | * |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 10 | +if (!defined('ABSPATH')) { |
|
| 11 | 11 | exit; // Exit if accessed directly |
| 12 | 12 | } |
| 13 | 13 | |
@@ -21,10 +21,10 @@ discard block |
||
| 21 | 21 | * |
| 22 | 22 | * @param WP_Post $post |
| 23 | 23 | */ |
| 24 | - public static function output( $post ) { |
|
| 24 | + public static function output($post) { |
|
| 25 | 25 | |
| 26 | 26 | // Prepare the invoice. |
| 27 | - $invoice = new WPInv_Invoice( $post ); |
|
| 27 | + $invoice = new WPInv_Invoice($post); |
|
| 28 | 28 | |
| 29 | 29 | ?> |
| 30 | 30 | |
@@ -40,20 +40,20 @@ discard block |
||
| 40 | 40 | |
| 41 | 41 | <?php |
| 42 | 42 | |
| 43 | - if ( $invoice->is_draft() ) { |
|
| 43 | + if ($invoice->is_draft()) { |
|
| 44 | 44 | |
| 45 | 45 | // Set gateway. |
| 46 | 46 | echo aui()->select( |
| 47 | 47 | array( |
| 48 | 48 | 'id' => 'wpinv_gateway', |
| 49 | 49 | 'name' => 'wpinv_gateway', |
| 50 | - 'label' => __( 'Gateway:', 'invoicing' ), |
|
| 50 | + 'label' => __('Gateway:', 'invoicing'), |
|
| 51 | 51 | 'label_type' => 'vertical', |
| 52 | - 'placeholder' => __( 'Select Gateway', 'invoicing' ), |
|
| 52 | + 'placeholder' => __('Select Gateway', 'invoicing'), |
|
| 53 | 53 | 'value' => wpinv_get_default_gateway(), |
| 54 | 54 | 'select2' => true, |
| 55 | 55 | 'data-allow-clear' => 'false', |
| 56 | - 'options' => wp_list_pluck( wpinv_get_enabled_payment_gateways( true ), 'admin_label' ), |
|
| 56 | + 'options' => wp_list_pluck(wpinv_get_enabled_payment_gateways(true), 'admin_label'), |
|
| 57 | 57 | ) |
| 58 | 58 | ); |
| 59 | 59 | |
@@ -65,12 +65,12 @@ discard block |
||
| 65 | 65 | 'id' => 'wpinv_key', |
| 66 | 66 | 'name' => 'wpinv_key', |
| 67 | 67 | 'label' => sprintf( |
| 68 | - __( '%s Key:', 'invoicing' ), |
|
| 69 | - ucfirst( $invoice->get_invoice_quote_type() ) |
|
| 68 | + __('%s Key:', 'invoicing'), |
|
| 69 | + ucfirst($invoice->get_invoice_quote_type()) |
|
| 70 | 70 | ), |
| 71 | 71 | 'label_type' => 'vertical', |
| 72 | 72 | 'class' => 'form-control-sm', |
| 73 | - 'value' => $invoice->get_key( 'edit' ), |
|
| 73 | + 'value' => $invoice->get_key('edit'), |
|
| 74 | 74 | 'extra_attributes' => array( |
| 75 | 75 | 'onclick' => 'this.select();', |
| 76 | 76 | 'readonly' => 'true', |
@@ -85,9 +85,9 @@ discard block |
||
| 85 | 85 | 'id' => 'wpinv_view_url', |
| 86 | 86 | 'name' => 'wpinv_view_url', |
| 87 | 87 | 'label' => sprintf( |
| 88 | - __( '%s URL:', 'invoicing' ), |
|
| 89 | - ucfirst( $invoice->get_invoice_quote_type() ) |
|
| 90 | - ) . ' <a href="' . esc_url_raw( $invoice->get_view_url() ) . '" title="' . __( 'View invoice', 'invoicing' ) . '" target="_blank"><i class="fas fa-external-link-alt fa-fw"></i></a>', |
|
| 88 | + __('%s URL:', 'invoicing'), |
|
| 89 | + ucfirst($invoice->get_invoice_quote_type()) |
|
| 90 | + ) . ' <a href="' . esc_url_raw($invoice->get_view_url()) . '" title="' . __('View invoice', 'invoicing') . '" target="_blank"><i class="fas fa-external-link-alt fa-fw"></i></a>', |
|
| 91 | 91 | 'label_type' => 'vertical', |
| 92 | 92 | 'class' => 'form-control-sm', |
| 93 | 93 | 'value' => $invoice->get_view_url(), |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | ); |
| 100 | 100 | |
| 101 | 101 | // If the invoice is paid... |
| 102 | - if ( $invoice->is_paid() || $invoice->is_refunded() ) { |
|
| 102 | + if ($invoice->is_paid() || $invoice->is_refunded()) { |
|
| 103 | 103 | |
| 104 | 104 | // Gateway. |
| 105 | 105 | echo aui()->input( |
@@ -107,10 +107,10 @@ discard block |
||
| 107 | 107 | 'type' => 'text', |
| 108 | 108 | 'id' => 'wpinv_gateway', |
| 109 | 109 | 'name' => '', |
| 110 | - 'label' => __( 'Gateway:', 'invoicing' ), |
|
| 110 | + 'label' => __('Gateway:', 'invoicing'), |
|
| 111 | 111 | 'label_type' => 'vertical', |
| 112 | 112 | 'class' => 'form-control-sm', |
| 113 | - 'value' => wpinv_get_gateway_admin_label( $invoice->get_gateway( 'edit' ) ), |
|
| 113 | + 'value' => wpinv_get_gateway_admin_label($invoice->get_gateway('edit')), |
|
| 114 | 114 | 'extra_attributes' => array( |
| 115 | 115 | 'onclick' => 'this.select();', |
| 116 | 116 | 'readonly' => 'true', |
@@ -125,11 +125,11 @@ discard block |
||
| 125 | 125 | 'type' => 'text', |
| 126 | 126 | 'id' => 'wpinv_transaction_id', |
| 127 | 127 | 'name' => 'wpinv_transaction_id', |
| 128 | - 'label' => __( 'Transaction ID:', 'invoicing' ) . ( $transaction_url ? ' <a href="' . esc_url( $transaction_url ) . '" title="' . __( 'View details', 'invoicing' ) . '" target="_blank"><i class="fas fa-external-link-alt fa-fw"></i></a>' : '' ), |
|
| 128 | + 'label' => __('Transaction ID:', 'invoicing') . ($transaction_url ? ' <a href="' . esc_url($transaction_url) . '" title="' . __('View details', 'invoicing') . '" target="_blank"><i class="fas fa-external-link-alt fa-fw"></i></a>' : ''), |
|
| 129 | 129 | 'label_type' => 'vertical', |
| 130 | 130 | 'class' => 'form-control-sm', |
| 131 | - 'value' => $invoice->get_transaction_id( 'edit' ), |
|
| 132 | - 'help_text' => apply_filters( 'wpinv_invoice_transaction_link_' . $invoice->get_gateway( 'edit' ), '', $invoice->get_transaction_id(), $invoice ), |
|
| 131 | + 'value' => $invoice->get_transaction_id('edit'), |
|
| 132 | + 'help_text' => apply_filters('wpinv_invoice_transaction_link_' . $invoice->get_gateway('edit'), '', $invoice->get_transaction_id(), $invoice), |
|
| 133 | 133 | 'extra_attributes' => array( |
| 134 | 134 | 'onclick' => 'this.select();', |
| 135 | 135 | 'readonly' => 'true', |
@@ -143,10 +143,10 @@ discard block |
||
| 143 | 143 | 'type' => 'text', |
| 144 | 144 | 'id' => 'wpinv_currency', |
| 145 | 145 | 'name' => 'wpinv_currency', |
| 146 | - 'label' => __( 'Currency:', 'invoicing' ), |
|
| 146 | + 'label' => __('Currency:', 'invoicing'), |
|
| 147 | 147 | 'label_type' => 'vertical', |
| 148 | 148 | 'class' => 'form-control-sm', |
| 149 | - 'value' => $invoice->get_currency( 'edit' ), |
|
| 149 | + 'value' => $invoice->get_currency('edit'), |
|
| 150 | 150 | 'extra_attributes' => array( |
| 151 | 151 | 'onclick' => 'this.select();', |
| 152 | 152 | 'readonly' => 'true', |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | |
| 157 | 157 | } else { |
| 158 | 158 | |
| 159 | - if ( 'wpi_invoice' == $invoice->get_post_type() ) { |
|
| 159 | + if ('wpi_invoice' == $invoice->get_post_type()) { |
|
| 160 | 160 | |
| 161 | 161 | // Payment URL. |
| 162 | 162 | echo aui()->input( |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | 'type' => 'text', |
| 165 | 165 | 'id' => 'wpinv_payment_url', |
| 166 | 166 | 'name' => 'wpinv_payment_url', |
| 167 | - 'label' => __( 'Payment URL:', 'invoicing' ), |
|
| 167 | + 'label' => __('Payment URL:', 'invoicing'), |
|
| 168 | 168 | 'label_type' => 'vertical', |
| 169 | 169 | 'class' => 'form-control-sm', |
| 170 | 170 | 'value' => $invoice->get_checkout_payment_url(), |
@@ -180,13 +180,13 @@ discard block |
||
| 180 | 180 | array( |
| 181 | 181 | 'id' => 'wpinv_gateway', |
| 182 | 182 | 'name' => 'wpinv_gateway', |
| 183 | - 'label' => __( 'Gateway:', 'invoicing' ), |
|
| 183 | + 'label' => __('Gateway:', 'invoicing'), |
|
| 184 | 184 | 'label_type' => 'vertical', |
| 185 | - 'placeholder' => __( 'Select Gateway', 'invoicing' ), |
|
| 186 | - 'value' => $invoice->get_gateway( 'edit' ), |
|
| 185 | + 'placeholder' => __('Select Gateway', 'invoicing'), |
|
| 186 | + 'value' => $invoice->get_gateway('edit'), |
|
| 187 | 187 | 'select2' => true, |
| 188 | 188 | 'data-allow-clear' => 'false', |
| 189 | - 'options' => wp_list_pluck( wpinv_get_enabled_payment_gateways( true ), 'admin_label' ), |
|
| 189 | + 'options' => wp_list_pluck(wpinv_get_enabled_payment_gateways(true), 'admin_label'), |
|
| 190 | 190 | ) |
| 191 | 191 | ); |
| 192 | 192 | |
@@ -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. |
@@ -145,40 +145,40 @@ discard block |
||
| 145 | 145 | * |
| 146 | 146 | * @param int|string|object|WPInv_Invoice|WPInv_Legacy_Invoice|WP_Post $invoice Invoice id, key, transaction id, number or object to read. |
| 147 | 147 | */ |
| 148 | - public function __construct( $invoice = 0 ) { |
|
| 148 | + public function __construct($invoice = 0) { |
|
| 149 | 149 | |
| 150 | - parent::__construct( $invoice ); |
|
| 150 | + parent::__construct($invoice); |
|
| 151 | 151 | |
| 152 | - if ( ! empty( $invoice ) && is_numeric( $invoice ) && getpaid_is_invoice_post_type( get_post_type( (int) $invoice ) ) ) { |
|
| 153 | - $this->set_id( (int) $invoice ); |
|
| 154 | - } elseif ( $invoice instanceof self ) { |
|
| 155 | - $this->set_id( $invoice->get_id() ); |
|
| 156 | - } elseif ( ! empty( $invoice->ID ) ) { |
|
| 157 | - $this->set_id( $invoice->ID ); |
|
| 158 | - } elseif ( is_array( $invoice ) ) { |
|
| 159 | - $this->set_props( $invoice ); |
|
| 152 | + if (!empty($invoice) && is_numeric($invoice) && getpaid_is_invoice_post_type(get_post_type((int) $invoice))) { |
|
| 153 | + $this->set_id((int) $invoice); |
|
| 154 | + } elseif ($invoice instanceof self) { |
|
| 155 | + $this->set_id($invoice->get_id()); |
|
| 156 | + } elseif (!empty($invoice->ID)) { |
|
| 157 | + $this->set_id($invoice->ID); |
|
| 158 | + } elseif (is_array($invoice)) { |
|
| 159 | + $this->set_props($invoice); |
|
| 160 | 160 | |
| 161 | - if ( isset( $invoice['ID'] ) ) { |
|
| 162 | - $this->set_id( $invoice['ID'] ); |
|
| 161 | + if (isset($invoice['ID'])) { |
|
| 162 | + $this->set_id($invoice['ID']); |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | - } elseif ( is_string( $invoice ) && $invoice_id = self::get_invoice_id_by_field( $invoice, 'key' ) ) { |
|
| 166 | - $this->set_id( $invoice_id ); |
|
| 167 | - } elseif ( is_string( $invoice ) && $invoice_id = self::get_invoice_id_by_field( $invoice, 'number' ) ) { |
|
| 168 | - $this->set_id( $invoice_id ); |
|
| 169 | - } elseif ( is_string( $invoice ) && $invoice_id = self::get_invoice_id_by_field( $invoice, 'transaction_id' ) ) { |
|
| 170 | - $this->set_id( $invoice_id ); |
|
| 165 | + } elseif (is_string($invoice) && $invoice_id = self::get_invoice_id_by_field($invoice, 'key')) { |
|
| 166 | + $this->set_id($invoice_id); |
|
| 167 | + } elseif (is_string($invoice) && $invoice_id = self::get_invoice_id_by_field($invoice, 'number')) { |
|
| 168 | + $this->set_id($invoice_id); |
|
| 169 | + } elseif (is_string($invoice) && $invoice_id = self::get_invoice_id_by_field($invoice, 'transaction_id')) { |
|
| 170 | + $this->set_id($invoice_id); |
|
| 171 | 171 | } else { |
| 172 | - $this->set_object_read( true ); |
|
| 172 | + $this->set_object_read(true); |
|
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | // Load the datastore. |
| 176 | - $this->data_store = GetPaid_Data_Store::load( $this->data_store_name ); |
|
| 176 | + $this->data_store = GetPaid_Data_Store::load($this->data_store_name); |
|
| 177 | 177 | |
| 178 | - if ( $this->get_id() > 0 ) { |
|
| 179 | - $this->post = get_post( $this->get_id() ); |
|
| 178 | + if ($this->get_id() > 0) { |
|
| 179 | + $this->post = get_post($this->get_id()); |
|
| 180 | 180 | $this->ID = $this->get_id(); |
| 181 | - $this->data_store->read( $this ); |
|
| 181 | + $this->data_store->read($this); |
|
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | } |
@@ -193,38 +193,38 @@ discard block |
||
| 193 | 193 | * @since 1.0.15 |
| 194 | 194 | * @return int |
| 195 | 195 | */ |
| 196 | - public static function get_invoice_id_by_field( $value, $field = 'key' ) { |
|
| 196 | + public static function get_invoice_id_by_field($value, $field = 'key') { |
|
| 197 | 197 | global $wpdb; |
| 198 | 198 | |
| 199 | 199 | // Trim the value. |
| 200 | - $value = trim( $value ); |
|
| 200 | + $value = trim($value); |
|
| 201 | 201 | |
| 202 | - if ( empty( $value ) ) { |
|
| 202 | + if (empty($value)) { |
|
| 203 | 203 | return 0; |
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | // Valid fields. |
| 207 | - $fields = array( 'key', 'number', 'transaction_id' ); |
|
| 207 | + $fields = array('key', 'number', 'transaction_id'); |
|
| 208 | 208 | |
| 209 | 209 | // Ensure a field has been passed. |
| 210 | - if ( empty( $field ) || ! in_array( $field, $fields ) ) { |
|
| 210 | + if (empty($field) || !in_array($field, $fields)) { |
|
| 211 | 211 | return 0; |
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | // Maybe retrieve from the cache. |
| 215 | - $invoice_id = wp_cache_get( $value, "getpaid_invoice_{$field}s_to_invoice_ids" ); |
|
| 216 | - if ( false !== $invoice_id ) { |
|
| 215 | + $invoice_id = wp_cache_get($value, "getpaid_invoice_{$field}s_to_invoice_ids"); |
|
| 216 | + if (false !== $invoice_id) { |
|
| 217 | 217 | return $invoice_id; |
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | // Fetch from the db. |
| 221 | 221 | $table = $wpdb->prefix . 'getpaid_invoices'; |
| 222 | 222 | $invoice_id = (int) $wpdb->get_var( |
| 223 | - $wpdb->prepare( "SELECT `post_id` FROM $table WHERE `$field`=%s LIMIT 1", $value ) |
|
| 223 | + $wpdb->prepare("SELECT `post_id` FROM $table WHERE `$field`=%s LIMIT 1", $value) |
|
| 224 | 224 | ); |
| 225 | 225 | |
| 226 | 226 | // Update the cache with our data |
| 227 | - wp_cache_set( $value, $invoice_id, "getpaid_invoice_{$field}s_to_invoice_ids" ); |
|
| 227 | + wp_cache_set($value, $invoice_id, "getpaid_invoice_{$field}s_to_invoice_ids"); |
|
| 228 | 228 | |
| 229 | 229 | return $invoice_id; |
| 230 | 230 | } |
@@ -232,8 +232,8 @@ discard block |
||
| 232 | 232 | /** |
| 233 | 233 | * Checks if an invoice key is set. |
| 234 | 234 | */ |
| 235 | - public function _isset( $key ) { |
|
| 236 | - return isset( $this->data[$key] ) || method_exists( $this, "get_$key" ); |
|
| 235 | + public function _isset($key) { |
|
| 236 | + return isset($this->data[$key]) || method_exists($this, "get_$key"); |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | /* |
@@ -258,8 +258,8 @@ discard block |
||
| 258 | 258 | * @param string $context View or edit context. |
| 259 | 259 | * @return int |
| 260 | 260 | */ |
| 261 | - public function get_parent_id( $context = 'view' ) { |
|
| 262 | - return (int) $this->get_prop( 'parent_id', $context ); |
|
| 261 | + public function get_parent_id($context = 'view') { |
|
| 262 | + return (int) $this->get_prop('parent_id', $context); |
|
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | /** |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | * @return WPInv_Invoice |
| 270 | 270 | */ |
| 271 | 271 | public function get_parent_payment() { |
| 272 | - return new WPInv_Invoice( $this->get_parent_id() ); |
|
| 272 | + return new WPInv_Invoice($this->get_parent_id()); |
|
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | /** |
@@ -289,8 +289,8 @@ discard block |
||
| 289 | 289 | * @param string $context View or edit context. |
| 290 | 290 | * @return string |
| 291 | 291 | */ |
| 292 | - public function get_status( $context = 'view' ) { |
|
| 293 | - return $this->get_prop( 'status', $context ); |
|
| 292 | + public function get_status($context = 'view') { |
|
| 293 | + return $this->get_prop('status', $context); |
|
| 294 | 294 | } |
| 295 | 295 | |
| 296 | 296 | /** |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | * @return array |
| 301 | 301 | */ |
| 302 | 302 | public function get_all_statuses() { |
| 303 | - return wpinv_get_invoice_statuses( true, true, $this ); |
|
| 303 | + return wpinv_get_invoice_statuses(true, true, $this); |
|
| 304 | 304 | } |
| 305 | 305 | |
| 306 | 306 | /** |
@@ -312,9 +312,9 @@ discard block |
||
| 312 | 312 | public function get_status_nicename() { |
| 313 | 313 | $statuses = $this->get_all_statuses(); |
| 314 | 314 | |
| 315 | - $status = isset( $statuses[ $this->get_status() ] ) ? $statuses[ $this->get_status() ] : $this->get_status(); |
|
| 315 | + $status = isset($statuses[$this->get_status()]) ? $statuses[$this->get_status()] : $this->get_status(); |
|
| 316 | 316 | |
| 317 | - return apply_filters( 'wpinv_get_invoice_status_nicename', $status, $this ); |
|
| 317 | + return apply_filters('wpinv_get_invoice_status_nicename', $status, $this); |
|
| 318 | 318 | } |
| 319 | 319 | |
| 320 | 320 | /** |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | */ |
| 326 | 326 | public function get_status_class() { |
| 327 | 327 | $statuses = getpaid_get_invoice_status_classes(); |
| 328 | - return isset( $statuses[ $this->get_status() ] ) ? $statuses[ $this->get_status() ] : 'badge-dark'; |
|
| 328 | + return isset($statuses[$this->get_status()]) ? $statuses[$this->get_status()] : 'badge-dark'; |
|
| 329 | 329 | } |
| 330 | 330 | |
| 331 | 331 | /** |
@@ -336,9 +336,9 @@ discard block |
||
| 336 | 336 | */ |
| 337 | 337 | public function get_status_label_html() { |
| 338 | 338 | |
| 339 | - $status_label = sanitize_text_field( $this->get_status_nicename() ); |
|
| 340 | - $status = sanitize_html_class( $this->get_status() ); |
|
| 341 | - $class = esc_attr( $this->get_status_class() ); |
|
| 339 | + $status_label = sanitize_text_field($this->get_status_nicename()); |
|
| 340 | + $status = sanitize_html_class($this->get_status()); |
|
| 341 | + $class = esc_attr($this->get_status_class()); |
|
| 342 | 342 | |
| 343 | 343 | return "<span class='bsui'><span class='badge $class $status'>$status_label</span></span>"; |
| 344 | 344 | } |
@@ -350,23 +350,23 @@ discard block |
||
| 350 | 350 | * @param string $context View or edit context. |
| 351 | 351 | * @return string |
| 352 | 352 | */ |
| 353 | - public function get_version( $context = 'view' ) { |
|
| 354 | - return $this->get_prop( 'version', $context ); |
|
| 353 | + public function get_version($context = 'view') { |
|
| 354 | + return $this->get_prop('version', $context); |
|
| 355 | 355 | } |
| 356 | 356 | |
| 357 | 357 | /** |
| 358 | 358 | * @deprecated |
| 359 | 359 | */ |
| 360 | - public function get_invoice_date( $format = true ) { |
|
| 361 | - $date = getpaid_format_date( $this->get_date_completed() ); |
|
| 362 | - $date = empty( $date ) ? $this->get_date_created() : $this->get_date_completed(); |
|
| 363 | - $formatted = getpaid_format_date( $date ); |
|
| 360 | + public function get_invoice_date($format = true) { |
|
| 361 | + $date = getpaid_format_date($this->get_date_completed()); |
|
| 362 | + $date = empty($date) ? $this->get_date_created() : $this->get_date_completed(); |
|
| 363 | + $formatted = getpaid_format_date($date); |
|
| 364 | 364 | |
| 365 | - if ( $format ) { |
|
| 365 | + if ($format) { |
|
| 366 | 366 | return $formatted; |
| 367 | 367 | } |
| 368 | 368 | |
| 369 | - return empty( $formatted ) ? '' : $date; |
|
| 369 | + return empty($formatted) ? '' : $date; |
|
| 370 | 370 | |
| 371 | 371 | } |
| 372 | 372 | |
@@ -377,8 +377,8 @@ discard block |
||
| 377 | 377 | * @param string $context View or edit context. |
| 378 | 378 | * @return string |
| 379 | 379 | */ |
| 380 | - public function get_date_created( $context = 'view' ) { |
|
| 381 | - return $this->get_prop( 'date_created', $context ); |
|
| 380 | + public function get_date_created($context = 'view') { |
|
| 381 | + return $this->get_prop('date_created', $context); |
|
| 382 | 382 | } |
| 383 | 383 | |
| 384 | 384 | /** |
@@ -388,8 +388,8 @@ discard block |
||
| 388 | 388 | * @param string $context View or edit context. |
| 389 | 389 | * @return string |
| 390 | 390 | */ |
| 391 | - public function get_created_date( $context = 'view' ) { |
|
| 392 | - return $this->get_date_created( $context ); |
|
| 391 | + public function get_created_date($context = 'view') { |
|
| 392 | + return $this->get_date_created($context); |
|
| 393 | 393 | } |
| 394 | 394 | |
| 395 | 395 | /** |
@@ -399,11 +399,11 @@ discard block |
||
| 399 | 399 | * @param string $context View or edit context. |
| 400 | 400 | * @return string |
| 401 | 401 | */ |
| 402 | - public function get_date_created_gmt( $context = 'view' ) { |
|
| 403 | - $date = $this->get_date_created( $context ); |
|
| 402 | + public function get_date_created_gmt($context = 'view') { |
|
| 403 | + $date = $this->get_date_created($context); |
|
| 404 | 404 | |
| 405 | - if ( $date ) { |
|
| 406 | - $date = get_gmt_from_date( $date ); |
|
| 405 | + if ($date) { |
|
| 406 | + $date = get_gmt_from_date($date); |
|
| 407 | 407 | } |
| 408 | 408 | return $date; |
| 409 | 409 | } |
@@ -415,8 +415,8 @@ discard block |
||
| 415 | 415 | * @param string $context View or edit context. |
| 416 | 416 | * @return string |
| 417 | 417 | */ |
| 418 | - public function get_date_modified( $context = 'view' ) { |
|
| 419 | - return $this->get_prop( 'date_modified', $context ); |
|
| 418 | + public function get_date_modified($context = 'view') { |
|
| 419 | + return $this->get_prop('date_modified', $context); |
|
| 420 | 420 | } |
| 421 | 421 | |
| 422 | 422 | /** |
@@ -426,8 +426,8 @@ discard block |
||
| 426 | 426 | * @param string $context View or edit context. |
| 427 | 427 | * @return string |
| 428 | 428 | */ |
| 429 | - public function get_modified_date( $context = 'view' ) { |
|
| 430 | - return $this->get_date_modified( $context ); |
|
| 429 | + public function get_modified_date($context = 'view') { |
|
| 430 | + return $this->get_date_modified($context); |
|
| 431 | 431 | } |
| 432 | 432 | |
| 433 | 433 | /** |
@@ -437,11 +437,11 @@ discard block |
||
| 437 | 437 | * @param string $context View or edit context. |
| 438 | 438 | * @return string |
| 439 | 439 | */ |
| 440 | - public function get_date_modified_gmt( $context = 'view' ) { |
|
| 441 | - $date = $this->get_date_modified( $context ); |
|
| 440 | + public function get_date_modified_gmt($context = 'view') { |
|
| 441 | + $date = $this->get_date_modified($context); |
|
| 442 | 442 | |
| 443 | - if ( $date ) { |
|
| 444 | - $date = get_gmt_from_date( $date ); |
|
| 443 | + if ($date) { |
|
| 444 | + $date = get_gmt_from_date($date); |
|
| 445 | 445 | } |
| 446 | 446 | return $date; |
| 447 | 447 | } |
@@ -453,8 +453,8 @@ discard block |
||
| 453 | 453 | * @param string $context View or edit context. |
| 454 | 454 | * @return string |
| 455 | 455 | */ |
| 456 | - public function get_due_date( $context = 'view' ) { |
|
| 457 | - return $this->get_prop( 'due_date', $context ); |
|
| 456 | + public function get_due_date($context = 'view') { |
|
| 457 | + return $this->get_prop('due_date', $context); |
|
| 458 | 458 | } |
| 459 | 459 | |
| 460 | 460 | /** |
@@ -464,8 +464,8 @@ discard block |
||
| 464 | 464 | * @param string $context View or edit context. |
| 465 | 465 | * @return string |
| 466 | 466 | */ |
| 467 | - public function get_date_due( $context = 'view' ) { |
|
| 468 | - return $this->get_due_date( $context ); |
|
| 467 | + public function get_date_due($context = 'view') { |
|
| 468 | + return $this->get_due_date($context); |
|
| 469 | 469 | } |
| 470 | 470 | |
| 471 | 471 | /** |
@@ -475,11 +475,11 @@ discard block |
||
| 475 | 475 | * @param string $context View or edit context. |
| 476 | 476 | * @return string |
| 477 | 477 | */ |
| 478 | - public function get_due_date_gmt( $context = 'view' ) { |
|
| 479 | - $date = $this->get_due_date( $context ); |
|
| 478 | + public function get_due_date_gmt($context = 'view') { |
|
| 479 | + $date = $this->get_due_date($context); |
|
| 480 | 480 | |
| 481 | - if ( $date ) { |
|
| 482 | - $date = get_gmt_from_date( $date ); |
|
| 481 | + if ($date) { |
|
| 482 | + $date = get_gmt_from_date($date); |
|
| 483 | 483 | } |
| 484 | 484 | return $date; |
| 485 | 485 | } |
@@ -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_gmt_date_due( $context = 'view' ) { |
|
| 495 | - return $this->get_due_date_gmt( $context ); |
|
| 494 | + public function get_gmt_date_due($context = 'view') { |
|
| 495 | + return $this->get_due_date_gmt($context); |
|
| 496 | 496 | } |
| 497 | 497 | |
| 498 | 498 | /** |
@@ -502,8 +502,8 @@ discard block |
||
| 502 | 502 | * @param string $context View or edit context. |
| 503 | 503 | * @return string |
| 504 | 504 | */ |
| 505 | - public function get_completed_date( $context = 'view' ) { |
|
| 506 | - return $this->get_prop( 'completed_date', $context ); |
|
| 505 | + public function get_completed_date($context = 'view') { |
|
| 506 | + return $this->get_prop('completed_date', $context); |
|
| 507 | 507 | } |
| 508 | 508 | |
| 509 | 509 | /** |
@@ -513,8 +513,8 @@ discard block |
||
| 513 | 513 | * @param string $context View or edit context. |
| 514 | 514 | * @return string |
| 515 | 515 | */ |
| 516 | - public function get_date_completed( $context = 'view' ) { |
|
| 517 | - return $this->get_completed_date( $context ); |
|
| 516 | + public function get_date_completed($context = 'view') { |
|
| 517 | + return $this->get_completed_date($context); |
|
| 518 | 518 | } |
| 519 | 519 | |
| 520 | 520 | /** |
@@ -524,11 +524,11 @@ discard block |
||
| 524 | 524 | * @param string $context View or edit context. |
| 525 | 525 | * @return string |
| 526 | 526 | */ |
| 527 | - public function get_completed_date_gmt( $context = 'view' ) { |
|
| 528 | - $date = $this->get_completed_date( $context ); |
|
| 527 | + public function get_completed_date_gmt($context = 'view') { |
|
| 528 | + $date = $this->get_completed_date($context); |
|
| 529 | 529 | |
| 530 | - if ( $date ) { |
|
| 531 | - $date = get_gmt_from_date( $date ); |
|
| 530 | + if ($date) { |
|
| 531 | + $date = get_gmt_from_date($date); |
|
| 532 | 532 | } |
| 533 | 533 | return $date; |
| 534 | 534 | } |
@@ -540,8 +540,8 @@ discard block |
||
| 540 | 540 | * @param string $context View or edit context. |
| 541 | 541 | * @return string |
| 542 | 542 | */ |
| 543 | - public function get_gmt_completed_date( $context = 'view' ) { |
|
| 544 | - return $this->get_completed_date_gmt( $context ); |
|
| 543 | + public function get_gmt_completed_date($context = 'view') { |
|
| 544 | + return $this->get_completed_date_gmt($context); |
|
| 545 | 545 | } |
| 546 | 546 | |
| 547 | 547 | /** |
@@ -551,12 +551,12 @@ discard block |
||
| 551 | 551 | * @param string $context View or edit context. |
| 552 | 552 | * @return string |
| 553 | 553 | */ |
| 554 | - public function get_number( $context = 'view' ) { |
|
| 555 | - $number = $this->get_prop( 'number', $context ); |
|
| 554 | + public function get_number($context = 'view') { |
|
| 555 | + $number = $this->get_prop('number', $context); |
|
| 556 | 556 | |
| 557 | - if ( empty( $number ) ) { |
|
| 557 | + if (empty($number)) { |
|
| 558 | 558 | $number = $this->generate_number(); |
| 559 | - $this->set_number( $this->generate_number() ); |
|
| 559 | + $this->set_number($this->generate_number()); |
|
| 560 | 560 | } |
| 561 | 561 | |
| 562 | 562 | return $number; |
@@ -570,8 +570,8 @@ discard block |
||
| 570 | 570 | public function maybe_set_number() { |
| 571 | 571 | $number = $this->get_number(); |
| 572 | 572 | |
| 573 | - if ( empty( $number ) || $this->get_id() == $number ) { |
|
| 574 | - $this->set_number( $this->generate_number() ); |
|
| 573 | + if (empty($number) || $this->get_id() == $number) { |
|
| 574 | + $this->set_number($this->generate_number()); |
|
| 575 | 575 | } |
| 576 | 576 | |
| 577 | 577 | } |
@@ -583,8 +583,8 @@ discard block |
||
| 583 | 583 | * @param string $context View or edit context. |
| 584 | 584 | * @return string |
| 585 | 585 | */ |
| 586 | - public function get_key( $context = 'view' ) { |
|
| 587 | - return $this->get_prop( 'key', $context ); |
|
| 586 | + public function get_key($context = 'view') { |
|
| 587 | + return $this->get_prop('key', $context); |
|
| 588 | 588 | } |
| 589 | 589 | |
| 590 | 590 | /** |
@@ -595,9 +595,9 @@ discard block |
||
| 595 | 595 | public function maybe_set_key() { |
| 596 | 596 | $key = $this->get_key(); |
| 597 | 597 | |
| 598 | - if ( empty( $key ) ) { |
|
| 599 | - $key = $this->generate_key( $this->get_type() . '_' ); |
|
| 600 | - $this->set_key( $key ); |
|
| 598 | + if (empty($key)) { |
|
| 599 | + $key = $this->generate_key($this->get_type() . '_'); |
|
| 600 | + $this->set_key($key); |
|
| 601 | 601 | } |
| 602 | 602 | |
| 603 | 603 | } |
@@ -609,8 +609,8 @@ discard block |
||
| 609 | 609 | * @param string $context View or edit context. |
| 610 | 610 | * @return string |
| 611 | 611 | */ |
| 612 | - public function get_type( $context = 'view' ) { |
|
| 613 | - return $this->get_prop( 'type', $context ); |
|
| 612 | + public function get_type($context = 'view') { |
|
| 613 | + return $this->get_prop('type', $context); |
|
| 614 | 614 | } |
| 615 | 615 | |
| 616 | 616 | /** |
@@ -620,7 +620,7 @@ discard block |
||
| 620 | 620 | * @return string |
| 621 | 621 | */ |
| 622 | 622 | public function get_invoice_quote_type() { |
| 623 | - return getpaid_get_post_type_label( $this->get_post_type(), false ); |
|
| 623 | + return getpaid_get_post_type_label($this->get_post_type(), false); |
|
| 624 | 624 | } |
| 625 | 625 | |
| 626 | 626 | /** |
@@ -630,8 +630,8 @@ discard block |
||
| 630 | 630 | * @param string $context View or edit context. |
| 631 | 631 | * @return string |
| 632 | 632 | */ |
| 633 | - public function get_label( $context = 'view' ) { |
|
| 634 | - return getpaid_get_post_type_label( $this->get_post_type( $context ), false ); |
|
| 633 | + public function get_label($context = 'view') { |
|
| 634 | + return getpaid_get_post_type_label($this->get_post_type($context), false); |
|
| 635 | 635 | } |
| 636 | 636 | |
| 637 | 637 | /** |
@@ -641,8 +641,8 @@ discard block |
||
| 641 | 641 | * @param string $context View or edit context. |
| 642 | 642 | * @return string |
| 643 | 643 | */ |
| 644 | - public function get_post_type( $context = 'view' ) { |
|
| 645 | - return $this->get_prop( 'post_type', $context ); |
|
| 644 | + public function get_post_type($context = 'view') { |
|
| 645 | + return $this->get_prop('post_type', $context); |
|
| 646 | 646 | } |
| 647 | 647 | |
| 648 | 648 | /** |
@@ -652,8 +652,8 @@ discard block |
||
| 652 | 652 | * @param string $context View or edit context. |
| 653 | 653 | * @return string |
| 654 | 654 | */ |
| 655 | - public function get_mode( $context = 'view' ) { |
|
| 656 | - return $this->get_prop( 'mode', $context ); |
|
| 655 | + public function get_mode($context = 'view') { |
|
| 656 | + return $this->get_prop('mode', $context); |
|
| 657 | 657 | } |
| 658 | 658 | |
| 659 | 659 | /** |
@@ -663,13 +663,13 @@ discard block |
||
| 663 | 663 | * @param string $context View or edit context. |
| 664 | 664 | * @return string |
| 665 | 665 | */ |
| 666 | - public function get_path( $context = 'view' ) { |
|
| 667 | - $path = $this->get_prop( 'path', $context ); |
|
| 666 | + public function get_path($context = 'view') { |
|
| 667 | + $path = $this->get_prop('path', $context); |
|
| 668 | 668 | $prefix = $this->get_type(); |
| 669 | 669 | |
| 670 | - if ( 0 !== strpos( $path, $prefix ) ) { |
|
| 671 | - $path = sanitize_title( $prefix . '-' . $this->get_id() ); |
|
| 672 | - $this->set_path( $path ); |
|
| 670 | + if (0 !== strpos($path, $prefix)) { |
|
| 671 | + $path = sanitize_title($prefix . '-' . $this->get_id()); |
|
| 672 | + $this->set_path($path); |
|
| 673 | 673 | } |
| 674 | 674 | |
| 675 | 675 | return $path; |
@@ -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_name( $context = 'view' ) { |
|
| 686 | - return $this->get_prop( 'title', $context ); |
|
| 685 | + public function get_name($context = 'view') { |
|
| 686 | + return $this->get_prop('title', $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_title( $context = 'view' ) { |
|
| 697 | - return $this->get_name( $context ); |
|
| 696 | + public function get_title($context = 'view') { |
|
| 697 | + return $this->get_name($context); |
|
| 698 | 698 | } |
| 699 | 699 | |
| 700 | 700 | /** |
@@ -704,8 +704,8 @@ discard block |
||
| 704 | 704 | * @param string $context View or edit context. |
| 705 | 705 | * @return string |
| 706 | 706 | */ |
| 707 | - public function get_description( $context = 'view' ) { |
|
| 708 | - return $this->get_prop( 'description', $context ); |
|
| 707 | + public function get_description($context = 'view') { |
|
| 708 | + return $this->get_prop('description', $context); |
|
| 709 | 709 | } |
| 710 | 710 | |
| 711 | 711 | /** |
@@ -715,8 +715,8 @@ discard block |
||
| 715 | 715 | * @param string $context View or edit context. |
| 716 | 716 | * @return string |
| 717 | 717 | */ |
| 718 | - public function get_excerpt( $context = 'view' ) { |
|
| 719 | - return $this->get_description( $context ); |
|
| 718 | + public function get_excerpt($context = 'view') { |
|
| 719 | + return $this->get_description($context); |
|
| 720 | 720 | } |
| 721 | 721 | |
| 722 | 722 | /** |
@@ -726,8 +726,8 @@ discard block |
||
| 726 | 726 | * @param string $context View or edit context. |
| 727 | 727 | * @return string |
| 728 | 728 | */ |
| 729 | - public function get_summary( $context = 'view' ) { |
|
| 730 | - return $this->get_description( $context ); |
|
| 729 | + public function get_summary($context = 'view') { |
|
| 730 | + return $this->get_description($context); |
|
| 731 | 731 | } |
| 732 | 732 | |
| 733 | 733 | /** |
@@ -737,26 +737,26 @@ discard block |
||
| 737 | 737 | * @param string $context View or edit context. |
| 738 | 738 | * @return array |
| 739 | 739 | */ |
| 740 | - public function get_user_info( $context = 'view' ) { |
|
| 740 | + public function get_user_info($context = 'view') { |
|
| 741 | 741 | |
| 742 | 742 | $user_info = array( |
| 743 | - 'user_id' => $this->get_user_id( $context ), |
|
| 744 | - 'email' => $this->get_email( $context ), |
|
| 745 | - 'first_name' => $this->get_first_name( $context ), |
|
| 746 | - 'last_name' => $this->get_last_name( $context ), |
|
| 747 | - 'address' => $this->get_address( $context ), |
|
| 748 | - 'phone' => $this->get_phone( $context ), |
|
| 749 | - 'city' => $this->get_city( $context ), |
|
| 750 | - 'country' => $this->get_country( $context ), |
|
| 751 | - 'state' => $this->get_state( $context ), |
|
| 752 | - 'zip' => $this->get_zip( $context ), |
|
| 753 | - 'company' => $this->get_company( $context ), |
|
| 754 | - 'company_id' => $this->get_company_id( $context ), |
|
| 755 | - 'vat_number' => $this->get_vat_number( $context ), |
|
| 756 | - 'discount' => $this->get_discount_code( $context ), |
|
| 743 | + 'user_id' => $this->get_user_id($context), |
|
| 744 | + 'email' => $this->get_email($context), |
|
| 745 | + 'first_name' => $this->get_first_name($context), |
|
| 746 | + 'last_name' => $this->get_last_name($context), |
|
| 747 | + 'address' => $this->get_address($context), |
|
| 748 | + 'phone' => $this->get_phone($context), |
|
| 749 | + 'city' => $this->get_city($context), |
|
| 750 | + 'country' => $this->get_country($context), |
|
| 751 | + 'state' => $this->get_state($context), |
|
| 752 | + 'zip' => $this->get_zip($context), |
|
| 753 | + 'company' => $this->get_company($context), |
|
| 754 | + 'company_id' => $this->get_company_id($context), |
|
| 755 | + 'vat_number' => $this->get_vat_number($context), |
|
| 756 | + 'discount' => $this->get_discount_code($context), |
|
| 757 | 757 | ); |
| 758 | 758 | |
| 759 | - return apply_filters( 'wpinv_user_info', $user_info, $this->get_id(), $this ); |
|
| 759 | + return apply_filters('wpinv_user_info', $user_info, $this->get_id(), $this); |
|
| 760 | 760 | |
| 761 | 761 | } |
| 762 | 762 | |
@@ -767,8 +767,8 @@ discard block |
||
| 767 | 767 | * @param string $context View or edit context. |
| 768 | 768 | * @return int |
| 769 | 769 | */ |
| 770 | - public function get_author( $context = 'view' ) { |
|
| 771 | - return (int) $this->get_prop( 'author', $context ); |
|
| 770 | + public function get_author($context = 'view') { |
|
| 771 | + return (int) $this->get_prop('author', $context); |
|
| 772 | 772 | } |
| 773 | 773 | |
| 774 | 774 | /** |
@@ -778,8 +778,8 @@ discard block |
||
| 778 | 778 | * @param string $context View or edit context. |
| 779 | 779 | * @return int |
| 780 | 780 | */ |
| 781 | - public function get_user_id( $context = 'view' ) { |
|
| 782 | - return $this->get_author( $context ); |
|
| 781 | + public function get_user_id($context = 'view') { |
|
| 782 | + return $this->get_author($context); |
|
| 783 | 783 | } |
| 784 | 784 | |
| 785 | 785 | /** |
@@ -789,8 +789,8 @@ discard block |
||
| 789 | 789 | * @param string $context View or edit context. |
| 790 | 790 | * @return int |
| 791 | 791 | */ |
| 792 | - public function get_customer_id( $context = 'view' ) { |
|
| 793 | - return $this->get_author( $context ); |
|
| 792 | + public function get_customer_id($context = 'view') { |
|
| 793 | + return $this->get_author($context); |
|
| 794 | 794 | } |
| 795 | 795 | |
| 796 | 796 | /** |
@@ -800,8 +800,8 @@ discard block |
||
| 800 | 800 | * @param string $context View or edit context. |
| 801 | 801 | * @return string |
| 802 | 802 | */ |
| 803 | - public function get_ip( $context = 'view' ) { |
|
| 804 | - return $this->get_prop( 'user_ip', $context ); |
|
| 803 | + public function get_ip($context = 'view') { |
|
| 804 | + return $this->get_prop('user_ip', $context); |
|
| 805 | 805 | } |
| 806 | 806 | |
| 807 | 807 | /** |
@@ -811,8 +811,8 @@ discard block |
||
| 811 | 811 | * @param string $context View or edit context. |
| 812 | 812 | * @return string |
| 813 | 813 | */ |
| 814 | - public function get_user_ip( $context = 'view' ) { |
|
| 815 | - return $this->get_ip( $context ); |
|
| 814 | + public function get_user_ip($context = 'view') { |
|
| 815 | + return $this->get_ip($context); |
|
| 816 | 816 | } |
| 817 | 817 | |
| 818 | 818 | /** |
@@ -822,8 +822,8 @@ discard block |
||
| 822 | 822 | * @param string $context View or edit context. |
| 823 | 823 | * @return string |
| 824 | 824 | */ |
| 825 | - public function get_customer_ip( $context = 'view' ) { |
|
| 826 | - return $this->get_ip( $context ); |
|
| 825 | + public function get_customer_ip($context = 'view') { |
|
| 826 | + return $this->get_ip($context); |
|
| 827 | 827 | } |
| 828 | 828 | |
| 829 | 829 | /** |
@@ -833,8 +833,8 @@ discard block |
||
| 833 | 833 | * @param string $context View or edit context. |
| 834 | 834 | * @return string |
| 835 | 835 | */ |
| 836 | - public function get_first_name( $context = 'view' ) { |
|
| 837 | - return $this->get_prop( 'first_name', $context ); |
|
| 836 | + public function get_first_name($context = 'view') { |
|
| 837 | + return $this->get_prop('first_name', $context); |
|
| 838 | 838 | } |
| 839 | 839 | |
| 840 | 840 | /** |
@@ -844,8 +844,8 @@ discard block |
||
| 844 | 844 | * @param string $context View or edit context. |
| 845 | 845 | * @return string |
| 846 | 846 | */ |
| 847 | - public function get_user_first_name( $context = 'view' ) { |
|
| 848 | - return $this->get_first_name( $context ); |
|
| 847 | + public function get_user_first_name($context = 'view') { |
|
| 848 | + return $this->get_first_name($context); |
|
| 849 | 849 | } |
| 850 | 850 | |
| 851 | 851 | /** |
@@ -855,8 +855,8 @@ discard block |
||
| 855 | 855 | * @param string $context View or edit context. |
| 856 | 856 | * @return string |
| 857 | 857 | */ |
| 858 | - public function get_customer_first_name( $context = 'view' ) { |
|
| 859 | - return $this->get_first_name( $context ); |
|
| 858 | + public function get_customer_first_name($context = 'view') { |
|
| 859 | + return $this->get_first_name($context); |
|
| 860 | 860 | } |
| 861 | 861 | |
| 862 | 862 | /** |
@@ -866,8 +866,8 @@ discard block |
||
| 866 | 866 | * @param string $context View or edit context. |
| 867 | 867 | * @return string |
| 868 | 868 | */ |
| 869 | - public function get_last_name( $context = 'view' ) { |
|
| 870 | - return $this->get_prop( 'last_name', $context ); |
|
| 869 | + public function get_last_name($context = 'view') { |
|
| 870 | + return $this->get_prop('last_name', $context); |
|
| 871 | 871 | } |
| 872 | 872 | |
| 873 | 873 | /** |
@@ -877,8 +877,8 @@ discard block |
||
| 877 | 877 | * @param string $context View or edit context. |
| 878 | 878 | * @return string |
| 879 | 879 | */ |
| 880 | - public function get_user_last_name( $context = 'view' ) { |
|
| 881 | - return $this->get_last_name( $context ); |
|
| 880 | + public function get_user_last_name($context = 'view') { |
|
| 881 | + return $this->get_last_name($context); |
|
| 882 | 882 | } |
| 883 | 883 | |
| 884 | 884 | /** |
@@ -888,8 +888,8 @@ discard block |
||
| 888 | 888 | * @param string $context View or edit context. |
| 889 | 889 | * @return string |
| 890 | 890 | */ |
| 891 | - public function get_customer_last_name( $context = 'view' ) { |
|
| 892 | - return $this->get_last_name( $context ); |
|
| 891 | + public function get_customer_last_name($context = 'view') { |
|
| 892 | + return $this->get_last_name($context); |
|
| 893 | 893 | } |
| 894 | 894 | |
| 895 | 895 | /** |
@@ -899,8 +899,8 @@ discard block |
||
| 899 | 899 | * @param string $context View or edit context. |
| 900 | 900 | * @return string |
| 901 | 901 | */ |
| 902 | - public function get_full_name( $context = 'view' ) { |
|
| 903 | - return trim( $this->get_first_name( $context ) . ' ' . $this->get_last_name( $context ) ); |
|
| 902 | + public function get_full_name($context = 'view') { |
|
| 903 | + return trim($this->get_first_name($context) . ' ' . $this->get_last_name($context)); |
|
| 904 | 904 | } |
| 905 | 905 | |
| 906 | 906 | /** |
@@ -910,8 +910,8 @@ discard block |
||
| 910 | 910 | * @param string $context View or edit context. |
| 911 | 911 | * @return string |
| 912 | 912 | */ |
| 913 | - public function get_user_full_name( $context = 'view' ) { |
|
| 914 | - return $this->get_full_name( $context ); |
|
| 913 | + public function get_user_full_name($context = 'view') { |
|
| 914 | + return $this->get_full_name($context); |
|
| 915 | 915 | } |
| 916 | 916 | |
| 917 | 917 | /** |
@@ -921,8 +921,8 @@ discard block |
||
| 921 | 921 | * @param string $context View or edit context. |
| 922 | 922 | * @return string |
| 923 | 923 | */ |
| 924 | - public function get_customer_full_name( $context = 'view' ) { |
|
| 925 | - return $this->get_full_name( $context ); |
|
| 924 | + public function get_customer_full_name($context = 'view') { |
|
| 925 | + return $this->get_full_name($context); |
|
| 926 | 926 | } |
| 927 | 927 | |
| 928 | 928 | /** |
@@ -932,8 +932,8 @@ discard block |
||
| 932 | 932 | * @param string $context View or edit context. |
| 933 | 933 | * @return string |
| 934 | 934 | */ |
| 935 | - public function get_phone( $context = 'view' ) { |
|
| 936 | - return $this->get_prop( 'phone', $context ); |
|
| 935 | + public function get_phone($context = 'view') { |
|
| 936 | + return $this->get_prop('phone', $context); |
|
| 937 | 937 | } |
| 938 | 938 | |
| 939 | 939 | /** |
@@ -943,8 +943,8 @@ discard block |
||
| 943 | 943 | * @param string $context View or edit context. |
| 944 | 944 | * @return string |
| 945 | 945 | */ |
| 946 | - public function get_phone_number( $context = 'view' ) { |
|
| 947 | - return $this->get_phone( $context ); |
|
| 946 | + public function get_phone_number($context = 'view') { |
|
| 947 | + return $this->get_phone($context); |
|
| 948 | 948 | } |
| 949 | 949 | |
| 950 | 950 | /** |
@@ -954,8 +954,8 @@ discard block |
||
| 954 | 954 | * @param string $context View or edit context. |
| 955 | 955 | * @return string |
| 956 | 956 | */ |
| 957 | - public function get_user_phone( $context = 'view' ) { |
|
| 958 | - return $this->get_phone( $context ); |
|
| 957 | + public function get_user_phone($context = 'view') { |
|
| 958 | + return $this->get_phone($context); |
|
| 959 | 959 | } |
| 960 | 960 | |
| 961 | 961 | /** |
@@ -965,8 +965,8 @@ discard block |
||
| 965 | 965 | * @param string $context View or edit context. |
| 966 | 966 | * @return string |
| 967 | 967 | */ |
| 968 | - public function get_customer_phone( $context = 'view' ) { |
|
| 969 | - return $this->get_phone( $context ); |
|
| 968 | + public function get_customer_phone($context = 'view') { |
|
| 969 | + return $this->get_phone($context); |
|
| 970 | 970 | } |
| 971 | 971 | |
| 972 | 972 | /** |
@@ -976,8 +976,8 @@ discard block |
||
| 976 | 976 | * @param string $context View or edit context. |
| 977 | 977 | * @return string |
| 978 | 978 | */ |
| 979 | - public function get_email( $context = 'view' ) { |
|
| 980 | - return $this->get_prop( 'email', $context ); |
|
| 979 | + public function get_email($context = 'view') { |
|
| 980 | + return $this->get_prop('email', $context); |
|
| 981 | 981 | } |
| 982 | 982 | |
| 983 | 983 | /** |
@@ -987,8 +987,8 @@ discard block |
||
| 987 | 987 | * @param string $context View or edit context. |
| 988 | 988 | * @return string |
| 989 | 989 | */ |
| 990 | - public function get_email_address( $context = 'view' ) { |
|
| 991 | - return $this->get_email( $context ); |
|
| 990 | + public function get_email_address($context = 'view') { |
|
| 991 | + return $this->get_email($context); |
|
| 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_email( $context = 'view' ) { |
|
| 1002 | - return $this->get_email( $context ); |
|
| 1001 | + public function get_user_email($context = 'view') { |
|
| 1002 | + return $this->get_email($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_email( $context = 'view' ) { |
|
| 1013 | - return $this->get_email( $context ); |
|
| 1012 | + public function get_customer_email($context = 'view') { |
|
| 1013 | + return $this->get_email($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_country( $context = 'view' ) { |
|
| 1024 | - $country = $this->get_prop( 'country', $context ); |
|
| 1025 | - return empty( $country ) ? wpinv_get_default_country() : $country; |
|
| 1023 | + public function get_country($context = 'view') { |
|
| 1024 | + $country = $this->get_prop('country', $context); |
|
| 1025 | + return empty($country) ? wpinv_get_default_country() : $country; |
|
| 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_country( $context = 'view' ) { |
|
| 1036 | - return $this->get_country( $context ); |
|
| 1035 | + public function get_user_country($context = 'view') { |
|
| 1036 | + return $this->get_country($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_country( $context = 'view' ) { |
|
| 1047 | - return $this->get_country( $context ); |
|
| 1046 | + public function get_customer_country($context = 'view') { |
|
| 1047 | + return $this->get_country($context); |
|
| 1048 | 1048 | } |
| 1049 | 1049 | |
| 1050 | 1050 | /** |
@@ -1054,9 +1054,9 @@ discard block |
||
| 1054 | 1054 | * @param string $context View or edit context. |
| 1055 | 1055 | * @return string |
| 1056 | 1056 | */ |
| 1057 | - public function get_state( $context = 'view' ) { |
|
| 1058 | - $state = $this->get_prop( 'state', $context ); |
|
| 1059 | - return empty( $state ) ? wpinv_get_default_state() : $state; |
|
| 1057 | + public function get_state($context = 'view') { |
|
| 1058 | + $state = $this->get_prop('state', $context); |
|
| 1059 | + return empty($state) ? wpinv_get_default_state() : $state; |
|
| 1060 | 1060 | } |
| 1061 | 1061 | |
| 1062 | 1062 | /** |
@@ -1066,8 +1066,8 @@ discard block |
||
| 1066 | 1066 | * @param string $context View or edit context. |
| 1067 | 1067 | * @return string |
| 1068 | 1068 | */ |
| 1069 | - public function get_user_state( $context = 'view' ) { |
|
| 1070 | - return $this->get_state( $context ); |
|
| 1069 | + public function get_user_state($context = 'view') { |
|
| 1070 | + return $this->get_state($context); |
|
| 1071 | 1071 | } |
| 1072 | 1072 | |
| 1073 | 1073 | /** |
@@ -1077,8 +1077,8 @@ discard block |
||
| 1077 | 1077 | * @param string $context View or edit context. |
| 1078 | 1078 | * @return string |
| 1079 | 1079 | */ |
| 1080 | - public function get_customer_state( $context = 'view' ) { |
|
| 1081 | - return $this->get_state( $context ); |
|
| 1080 | + public function get_customer_state($context = 'view') { |
|
| 1081 | + return $this->get_state($context); |
|
| 1082 | 1082 | } |
| 1083 | 1083 | |
| 1084 | 1084 | /** |
@@ -1088,8 +1088,8 @@ discard block |
||
| 1088 | 1088 | * @param string $context View or edit context. |
| 1089 | 1089 | * @return string |
| 1090 | 1090 | */ |
| 1091 | - public function get_city( $context = 'view' ) { |
|
| 1092 | - return $this->get_prop( 'city', $context ); |
|
| 1091 | + public function get_city($context = 'view') { |
|
| 1092 | + return $this->get_prop('city', $context); |
|
| 1093 | 1093 | } |
| 1094 | 1094 | |
| 1095 | 1095 | /** |
@@ -1099,8 +1099,8 @@ discard block |
||
| 1099 | 1099 | * @param string $context View or edit context. |
| 1100 | 1100 | * @return string |
| 1101 | 1101 | */ |
| 1102 | - public function get_user_city( $context = 'view' ) { |
|
| 1103 | - return $this->get_city( $context ); |
|
| 1102 | + public function get_user_city($context = 'view') { |
|
| 1103 | + return $this->get_city($context); |
|
| 1104 | 1104 | } |
| 1105 | 1105 | |
| 1106 | 1106 | /** |
@@ -1110,8 +1110,8 @@ discard block |
||
| 1110 | 1110 | * @param string $context View or edit context. |
| 1111 | 1111 | * @return string |
| 1112 | 1112 | */ |
| 1113 | - public function get_customer_city( $context = 'view' ) { |
|
| 1114 | - return $this->get_city( $context ); |
|
| 1113 | + public function get_customer_city($context = 'view') { |
|
| 1114 | + return $this->get_city($context); |
|
| 1115 | 1115 | } |
| 1116 | 1116 | |
| 1117 | 1117 | /** |
@@ -1121,8 +1121,8 @@ discard block |
||
| 1121 | 1121 | * @param string $context View or edit context. |
| 1122 | 1122 | * @return string |
| 1123 | 1123 | */ |
| 1124 | - public function get_zip( $context = 'view' ) { |
|
| 1125 | - return $this->get_prop( 'zip', $context ); |
|
| 1124 | + public function get_zip($context = 'view') { |
|
| 1125 | + return $this->get_prop('zip', $context); |
|
| 1126 | 1126 | } |
| 1127 | 1127 | |
| 1128 | 1128 | /** |
@@ -1132,8 +1132,8 @@ discard block |
||
| 1132 | 1132 | * @param string $context View or edit context. |
| 1133 | 1133 | * @return string |
| 1134 | 1134 | */ |
| 1135 | - public function get_user_zip( $context = 'view' ) { |
|
| 1136 | - return $this->get_zip( $context ); |
|
| 1135 | + public function get_user_zip($context = 'view') { |
|
| 1136 | + return $this->get_zip($context); |
|
| 1137 | 1137 | } |
| 1138 | 1138 | |
| 1139 | 1139 | /** |
@@ -1143,8 +1143,8 @@ discard block |
||
| 1143 | 1143 | * @param string $context View or edit context. |
| 1144 | 1144 | * @return string |
| 1145 | 1145 | */ |
| 1146 | - public function get_customer_zip( $context = 'view' ) { |
|
| 1147 | - return $this->get_zip( $context ); |
|
| 1146 | + public function get_customer_zip($context = 'view') { |
|
| 1147 | + return $this->get_zip($context); |
|
| 1148 | 1148 | } |
| 1149 | 1149 | |
| 1150 | 1150 | /** |
@@ -1154,8 +1154,8 @@ discard block |
||
| 1154 | 1154 | * @param string $context View or edit context. |
| 1155 | 1155 | * @return string |
| 1156 | 1156 | */ |
| 1157 | - public function get_company( $context = 'view' ) { |
|
| 1158 | - return $this->get_prop( 'company', $context ); |
|
| 1157 | + public function get_company($context = 'view') { |
|
| 1158 | + return $this->get_prop('company', $context); |
|
| 1159 | 1159 | } |
| 1160 | 1160 | |
| 1161 | 1161 | /** |
@@ -1165,8 +1165,8 @@ discard block |
||
| 1165 | 1165 | * @param string $context View or edit context. |
| 1166 | 1166 | * @return string |
| 1167 | 1167 | */ |
| 1168 | - public function get_user_company( $context = 'view' ) { |
|
| 1169 | - return $this->get_company( $context ); |
|
| 1168 | + public function get_user_company($context = 'view') { |
|
| 1169 | + return $this->get_company($context); |
|
| 1170 | 1170 | } |
| 1171 | 1171 | |
| 1172 | 1172 | /** |
@@ -1176,8 +1176,8 @@ discard block |
||
| 1176 | 1176 | * @param string $context View or edit context. |
| 1177 | 1177 | * @return string |
| 1178 | 1178 | */ |
| 1179 | - public function get_customer_company( $context = 'view' ) { |
|
| 1180 | - return $this->get_company( $context ); |
|
| 1179 | + public function get_customer_company($context = 'view') { |
|
| 1180 | + return $this->get_company($context); |
|
| 1181 | 1181 | } |
| 1182 | 1182 | |
| 1183 | 1183 | /** |
@@ -1187,8 +1187,8 @@ discard block |
||
| 1187 | 1187 | * @param string $context View or edit context. |
| 1188 | 1188 | * @return string |
| 1189 | 1189 | */ |
| 1190 | - public function get_company_id( $context = 'view' ) { |
|
| 1191 | - return $this->get_prop( 'company_id', $context ); |
|
| 1190 | + public function get_company_id($context = 'view') { |
|
| 1191 | + return $this->get_prop('company_id', $context); |
|
| 1192 | 1192 | } |
| 1193 | 1193 | |
| 1194 | 1194 | /** |
@@ -1198,8 +1198,8 @@ discard block |
||
| 1198 | 1198 | * @param string $context View or edit context. |
| 1199 | 1199 | * @return string |
| 1200 | 1200 | */ |
| 1201 | - public function get_vat_number( $context = 'view' ) { |
|
| 1202 | - return $this->get_prop( 'vat_number', $context ); |
|
| 1201 | + public function get_vat_number($context = 'view') { |
|
| 1202 | + return $this->get_prop('vat_number', $context); |
|
| 1203 | 1203 | } |
| 1204 | 1204 | |
| 1205 | 1205 | /** |
@@ -1209,8 +1209,8 @@ discard block |
||
| 1209 | 1209 | * @param string $context View or edit context. |
| 1210 | 1210 | * @return string |
| 1211 | 1211 | */ |
| 1212 | - public function get_user_vat_number( $context = 'view' ) { |
|
| 1213 | - return $this->get_vat_number( $context ); |
|
| 1212 | + public function get_user_vat_number($context = 'view') { |
|
| 1213 | + return $this->get_vat_number($context); |
|
| 1214 | 1214 | } |
| 1215 | 1215 | |
| 1216 | 1216 | /** |
@@ -1220,8 +1220,8 @@ discard block |
||
| 1220 | 1220 | * @param string $context View or edit context. |
| 1221 | 1221 | * @return string |
| 1222 | 1222 | */ |
| 1223 | - public function get_customer_vat_number( $context = 'view' ) { |
|
| 1224 | - return $this->get_vat_number( $context ); |
|
| 1223 | + public function get_customer_vat_number($context = 'view') { |
|
| 1224 | + return $this->get_vat_number($context); |
|
| 1225 | 1225 | } |
| 1226 | 1226 | |
| 1227 | 1227 | /** |
@@ -1231,8 +1231,8 @@ discard block |
||
| 1231 | 1231 | * @param string $context View or edit context. |
| 1232 | 1232 | * @return string |
| 1233 | 1233 | */ |
| 1234 | - public function get_vat_rate( $context = 'view' ) { |
|
| 1235 | - return $this->get_prop( 'vat_rate', $context ); |
|
| 1234 | + public function get_vat_rate($context = 'view') { |
|
| 1235 | + return $this->get_prop('vat_rate', $context); |
|
| 1236 | 1236 | } |
| 1237 | 1237 | |
| 1238 | 1238 | /** |
@@ -1242,8 +1242,8 @@ discard block |
||
| 1242 | 1242 | * @param string $context View or edit context. |
| 1243 | 1243 | * @return string |
| 1244 | 1244 | */ |
| 1245 | - public function get_user_vat_rate( $context = 'view' ) { |
|
| 1246 | - return $this->get_vat_rate( $context ); |
|
| 1245 | + public function get_user_vat_rate($context = 'view') { |
|
| 1246 | + return $this->get_vat_rate($context); |
|
| 1247 | 1247 | } |
| 1248 | 1248 | |
| 1249 | 1249 | /** |
@@ -1253,8 +1253,8 @@ discard block |
||
| 1253 | 1253 | * @param string $context View or edit context. |
| 1254 | 1254 | * @return string |
| 1255 | 1255 | */ |
| 1256 | - public function get_customer_vat_rate( $context = 'view' ) { |
|
| 1257 | - return $this->get_vat_rate( $context ); |
|
| 1256 | + public function get_customer_vat_rate($context = 'view') { |
|
| 1257 | + return $this->get_vat_rate($context); |
|
| 1258 | 1258 | } |
| 1259 | 1259 | |
| 1260 | 1260 | /** |
@@ -1264,8 +1264,8 @@ discard block |
||
| 1264 | 1264 | * @param string $context View or edit context. |
| 1265 | 1265 | * @return string |
| 1266 | 1266 | */ |
| 1267 | - public function get_address( $context = 'view' ) { |
|
| 1268 | - return $this->get_prop( 'address', $context ); |
|
| 1267 | + public function get_address($context = 'view') { |
|
| 1268 | + return $this->get_prop('address', $context); |
|
| 1269 | 1269 | } |
| 1270 | 1270 | |
| 1271 | 1271 | /** |
@@ -1275,8 +1275,8 @@ discard block |
||
| 1275 | 1275 | * @param string $context View or edit context. |
| 1276 | 1276 | * @return string |
| 1277 | 1277 | */ |
| 1278 | - public function get_user_address( $context = 'view' ) { |
|
| 1279 | - return $this->get_address( $context ); |
|
| 1278 | + public function get_user_address($context = 'view') { |
|
| 1279 | + return $this->get_address($context); |
|
| 1280 | 1280 | } |
| 1281 | 1281 | |
| 1282 | 1282 | /** |
@@ -1286,8 +1286,8 @@ discard block |
||
| 1286 | 1286 | * @param string $context View or edit context. |
| 1287 | 1287 | * @return string |
| 1288 | 1288 | */ |
| 1289 | - public function get_customer_address( $context = 'view' ) { |
|
| 1290 | - return $this->get_address( $context ); |
|
| 1289 | + public function get_customer_address($context = 'view') { |
|
| 1290 | + return $this->get_address($context); |
|
| 1291 | 1291 | } |
| 1292 | 1292 | |
| 1293 | 1293 | /** |
@@ -1297,8 +1297,8 @@ discard block |
||
| 1297 | 1297 | * @param string $context View or edit context. |
| 1298 | 1298 | * @return bool |
| 1299 | 1299 | */ |
| 1300 | - public function get_is_viewed( $context = 'view' ) { |
|
| 1301 | - return (bool) $this->get_prop( 'is_viewed', $context ); |
|
| 1300 | + public function get_is_viewed($context = 'view') { |
|
| 1301 | + return (bool) $this->get_prop('is_viewed', $context); |
|
| 1302 | 1302 | } |
| 1303 | 1303 | |
| 1304 | 1304 | /** |
@@ -1308,8 +1308,8 @@ discard block |
||
| 1308 | 1308 | * @param string $context View or edit context. |
| 1309 | 1309 | * @return bool |
| 1310 | 1310 | */ |
| 1311 | - public function get_email_cc( $context = 'view' ) { |
|
| 1312 | - return $this->get_prop( 'email_cc', $context ); |
|
| 1311 | + public function get_email_cc($context = 'view') { |
|
| 1312 | + return $this->get_prop('email_cc', $context); |
|
| 1313 | 1313 | } |
| 1314 | 1314 | |
| 1315 | 1315 | /** |
@@ -1319,8 +1319,8 @@ discard block |
||
| 1319 | 1319 | * @param string $context View or edit context. |
| 1320 | 1320 | * @return bool |
| 1321 | 1321 | */ |
| 1322 | - public function get_template( $context = 'view' ) { |
|
| 1323 | - return $this->get_prop( 'template', $context ); |
|
| 1322 | + public function get_template($context = 'view') { |
|
| 1323 | + return $this->get_prop('template', $context); |
|
| 1324 | 1324 | } |
| 1325 | 1325 | |
| 1326 | 1326 | /** |
@@ -1330,8 +1330,8 @@ discard block |
||
| 1330 | 1330 | * @param string $context View or edit context. |
| 1331 | 1331 | * @return bool |
| 1332 | 1332 | */ |
| 1333 | - public function get_created_via( $context = 'view' ) { |
|
| 1334 | - return $this->get_prop( 'created_via', $context ); |
|
| 1333 | + public function get_created_via($context = 'view') { |
|
| 1334 | + return $this->get_prop('created_via', $context); |
|
| 1335 | 1335 | } |
| 1336 | 1336 | |
| 1337 | 1337 | /** |
@@ -1341,8 +1341,8 @@ discard block |
||
| 1341 | 1341 | * @param string $context View or edit context. |
| 1342 | 1342 | * @return bool |
| 1343 | 1343 | */ |
| 1344 | - public function get_address_confirmed( $context = 'view' ) { |
|
| 1345 | - return (bool) $this->get_prop( 'address_confirmed', $context ); |
|
| 1344 | + public function get_address_confirmed($context = 'view') { |
|
| 1345 | + return (bool) $this->get_prop('address_confirmed', $context); |
|
| 1346 | 1346 | } |
| 1347 | 1347 | |
| 1348 | 1348 | /** |
@@ -1352,8 +1352,8 @@ discard block |
||
| 1352 | 1352 | * @param string $context View or edit context. |
| 1353 | 1353 | * @return bool |
| 1354 | 1354 | */ |
| 1355 | - public function get_user_address_confirmed( $context = 'view' ) { |
|
| 1356 | - return $this->get_address_confirmed( $context ); |
|
| 1355 | + public function get_user_address_confirmed($context = 'view') { |
|
| 1356 | + return $this->get_address_confirmed($context); |
|
| 1357 | 1357 | } |
| 1358 | 1358 | |
| 1359 | 1359 | /** |
@@ -1363,8 +1363,8 @@ discard block |
||
| 1363 | 1363 | * @param string $context View or edit context. |
| 1364 | 1364 | * @return bool |
| 1365 | 1365 | */ |
| 1366 | - public function get_customer_address_confirmed( $context = 'view' ) { |
|
| 1367 | - return $this->get_address_confirmed( $context ); |
|
| 1366 | + public function get_customer_address_confirmed($context = 'view') { |
|
| 1367 | + return $this->get_address_confirmed($context); |
|
| 1368 | 1368 | } |
| 1369 | 1369 | |
| 1370 | 1370 | /** |
@@ -1375,8 +1375,8 @@ discard block |
||
| 1375 | 1375 | */ |
| 1376 | 1376 | public function get_shipping_address() { |
| 1377 | 1377 | |
| 1378 | - $shipping_address = get_post_meta( $this->get_id(), 'shipping_address', true ); |
|
| 1379 | - return is_array( $shipping_address ) ? $shipping_address : false; |
|
| 1378 | + $shipping_address = get_post_meta($this->get_id(), 'shipping_address', true); |
|
| 1379 | + return is_array($shipping_address) ? $shipping_address : false; |
|
| 1380 | 1380 | } |
| 1381 | 1381 | |
| 1382 | 1382 | /** |
@@ -1393,17 +1393,17 @@ discard block |
||
| 1393 | 1393 | * @param string $context View or edit context. |
| 1394 | 1394 | * @return float |
| 1395 | 1395 | */ |
| 1396 | - public function get_shipping( $context = 'view' ) { |
|
| 1396 | + public function get_shipping($context = 'view') { |
|
| 1397 | 1397 | |
| 1398 | - if ( $context = 'view' ) { |
|
| 1399 | - return floatval( $this->get_prop( 'shipping', $context ) ); |
|
| 1398 | + if ($context = 'view') { |
|
| 1399 | + return floatval($this->get_prop('shipping', $context)); |
|
| 1400 | 1400 | } |
| 1401 | 1401 | |
| 1402 | - return $this->get_prop( 'shipping', $context ); |
|
| 1402 | + return $this->get_prop('shipping', $context); |
|
| 1403 | 1403 | } |
| 1404 | 1404 | |
| 1405 | 1405 | public function has_shipping() { |
| 1406 | - return defined( 'GETPAID_SHIPPING_CALCULATOR_VERSION' ) && null !== $this->get_prop( 'shipping', 'edit' ); |
|
| 1406 | + return defined('GETPAID_SHIPPING_CALCULATOR_VERSION') && null !== $this->get_prop('shipping', 'edit'); |
|
| 1407 | 1407 | } |
| 1408 | 1408 | |
| 1409 | 1409 | /** |
@@ -1413,12 +1413,12 @@ discard block |
||
| 1413 | 1413 | * @param string $context View or edit context. |
| 1414 | 1414 | * @return float |
| 1415 | 1415 | */ |
| 1416 | - public function get_subtotal( $context = 'view' ) { |
|
| 1417 | - $subtotal = (float) $this->get_prop( 'subtotal', $context ); |
|
| 1416 | + public function get_subtotal($context = 'view') { |
|
| 1417 | + $subtotal = (float) $this->get_prop('subtotal', $context); |
|
| 1418 | 1418 | |
| 1419 | 1419 | // Backwards compatibility. |
| 1420 | - if ( is_bool( $context ) && $context ) { |
|
| 1421 | - return wpinv_price( $subtotal, $this->get_currency() ); |
|
| 1420 | + if (is_bool($context) && $context) { |
|
| 1421 | + return wpinv_price($subtotal, $this->get_currency()); |
|
| 1422 | 1422 | } |
| 1423 | 1423 | |
| 1424 | 1424 | return $subtotal; |
@@ -1431,8 +1431,8 @@ discard block |
||
| 1431 | 1431 | * @param string $context View or edit context. |
| 1432 | 1432 | * @return float |
| 1433 | 1433 | */ |
| 1434 | - public function get_total_discount( $context = 'view' ) { |
|
| 1435 | - return wpinv_round_amount( wpinv_sanitize_amount( $this->get_prop( 'total_discount', $context ) ) ); |
|
| 1434 | + public function get_total_discount($context = 'view') { |
|
| 1435 | + return wpinv_round_amount(wpinv_sanitize_amount($this->get_prop('total_discount', $context))); |
|
| 1436 | 1436 | } |
| 1437 | 1437 | |
| 1438 | 1438 | /** |
@@ -1442,18 +1442,18 @@ discard block |
||
| 1442 | 1442 | * @param string $context View or edit context. |
| 1443 | 1443 | * @return float |
| 1444 | 1444 | */ |
| 1445 | - public function get_total_tax( $context = 'view' ) { |
|
| 1446 | - return wpinv_round_amount( wpinv_sanitize_amount( $this->get_prop( 'total_tax', $context ) ) ); |
|
| 1445 | + public function get_total_tax($context = 'view') { |
|
| 1446 | + return wpinv_round_amount(wpinv_sanitize_amount($this->get_prop('total_tax', $context))); |
|
| 1447 | 1447 | } |
| 1448 | 1448 | |
| 1449 | 1449 | /** |
| 1450 | 1450 | * @deprecated |
| 1451 | 1451 | */ |
| 1452 | - public function get_final_tax( $currency = false ) { |
|
| 1452 | + public function get_final_tax($currency = false) { |
|
| 1453 | 1453 | $tax = $this->get_total_tax(); |
| 1454 | 1454 | |
| 1455 | - if ( $currency ) { |
|
| 1456 | - return wpinv_price( $tax, $this->get_currency() ); |
|
| 1455 | + if ($currency) { |
|
| 1456 | + return wpinv_price($tax, $this->get_currency()); |
|
| 1457 | 1457 | } |
| 1458 | 1458 | |
| 1459 | 1459 | return $tax; |
@@ -1466,8 +1466,8 @@ discard block |
||
| 1466 | 1466 | * @param string $context View or edit context. |
| 1467 | 1467 | * @return float |
| 1468 | 1468 | */ |
| 1469 | - public function get_total_fees( $context = 'view' ) { |
|
| 1470 | - return wpinv_round_amount( wpinv_sanitize_amount( $this->get_prop( 'total_fees', $context ) ) ); |
|
| 1469 | + public function get_total_fees($context = 'view') { |
|
| 1470 | + return wpinv_round_amount(wpinv_sanitize_amount($this->get_prop('total_fees', $context))); |
|
| 1471 | 1471 | } |
| 1472 | 1472 | |
| 1473 | 1473 | /** |
@@ -1477,8 +1477,8 @@ discard block |
||
| 1477 | 1477 | * @param string $context View or edit context. |
| 1478 | 1478 | * @return float |
| 1479 | 1479 | */ |
| 1480 | - public function get_fees_total( $context = 'view' ) { |
|
| 1481 | - return $this->get_total_fees( $context ); |
|
| 1480 | + public function get_fees_total($context = 'view') { |
|
| 1481 | + return $this->get_total_fees($context); |
|
| 1482 | 1482 | } |
| 1483 | 1483 | |
| 1484 | 1484 | /** |
@@ -1487,14 +1487,14 @@ discard block |
||
| 1487 | 1487 | * @since 1.0.19 |
| 1488 | 1488 | * @return float |
| 1489 | 1489 | */ |
| 1490 | - public function get_total( $context = 'view' ) { |
|
| 1491 | - $total = $this->get_prop( 'total', $context ); |
|
| 1490 | + public function get_total($context = 'view') { |
|
| 1491 | + $total = $this->get_prop('total', $context); |
|
| 1492 | 1492 | |
| 1493 | - if ( $this->has_shipping() && $context == 'view' ) { |
|
| 1494 | - $total = $this->get_prop( 'total', $context ) + $this->get_shipping( $context ); |
|
| 1493 | + if ($this->has_shipping() && $context == 'view') { |
|
| 1494 | + $total = $this->get_prop('total', $context) + $this->get_shipping($context); |
|
| 1495 | 1495 | } |
| 1496 | 1496 | |
| 1497 | - return wpinv_round_amount( wpinv_sanitize_amount( $total ) ); |
|
| 1497 | + return wpinv_round_amount(wpinv_sanitize_amount($total)); |
|
| 1498 | 1498 | } |
| 1499 | 1499 | |
| 1500 | 1500 | /** |
@@ -1506,20 +1506,20 @@ discard block |
||
| 1506 | 1506 | public function get_non_recurring_total() { |
| 1507 | 1507 | |
| 1508 | 1508 | $subtotal = 0; |
| 1509 | - foreach ( $this->get_items() as $item ) { |
|
| 1510 | - if ( ! $item->is_recurring() ) { |
|
| 1509 | + foreach ($this->get_items() as $item) { |
|
| 1510 | + if (!$item->is_recurring()) { |
|
| 1511 | 1511 | $subtotal += $item->get_sub_total(); |
| 1512 | 1512 | } |
| 1513 | 1513 | } |
| 1514 | 1514 | |
| 1515 | - foreach ( $this->get_fees() as $fee ) { |
|
| 1516 | - if ( empty( $fee['recurring_fee'] ) ) { |
|
| 1517 | - $subtotal += wpinv_sanitize_amount( $fee['initial_fee'] ); |
|
| 1515 | + foreach ($this->get_fees() as $fee) { |
|
| 1516 | + if (empty($fee['recurring_fee'])) { |
|
| 1517 | + $subtotal += wpinv_sanitize_amount($fee['initial_fee']); |
|
| 1518 | 1518 | } |
| 1519 | 1519 | } |
| 1520 | 1520 | |
| 1521 | - $subtotal = wpinv_round_amount( wpinv_sanitize_amount( $subtotal ) ); |
|
| 1522 | - return apply_filters( 'wpinv_get_non_recurring_invoice_total', $subtotal, $this ); |
|
| 1521 | + $subtotal = wpinv_round_amount(wpinv_sanitize_amount($subtotal)); |
|
| 1522 | + return apply_filters('wpinv_get_non_recurring_invoice_total', $subtotal, $this); |
|
| 1523 | 1523 | |
| 1524 | 1524 | } |
| 1525 | 1525 | |
@@ -1542,7 +1542,7 @@ discard block |
||
| 1542 | 1542 | */ |
| 1543 | 1543 | public function get_initial_total() { |
| 1544 | 1544 | |
| 1545 | - if ( empty( $this->totals ) ) { |
|
| 1545 | + if (empty($this->totals)) { |
|
| 1546 | 1546 | $this->recalculate_total(); |
| 1547 | 1547 | } |
| 1548 | 1548 | |
@@ -1552,12 +1552,12 @@ discard block |
||
| 1552 | 1552 | $subtotal = $this->totals['subtotal']['initial']; |
| 1553 | 1553 | $total = $tax + $fee - $discount + $subtotal; |
| 1554 | 1554 | |
| 1555 | - if ( 0 > $total ) { |
|
| 1555 | + if (0 > $total) { |
|
| 1556 | 1556 | $total = 0; |
| 1557 | 1557 | } |
| 1558 | 1558 | |
| 1559 | - $total = wpinv_round_amount( wpinv_sanitize_amount( $total ) ); |
|
| 1560 | - return apply_filters( 'wpinv_get_initial_invoice_total', $total, $this ); |
|
| 1559 | + $total = wpinv_round_amount(wpinv_sanitize_amount($total)); |
|
| 1560 | + return apply_filters('wpinv_get_initial_invoice_total', $total, $this); |
|
| 1561 | 1561 | } |
| 1562 | 1562 | |
| 1563 | 1563 | /** |
@@ -1569,7 +1569,7 @@ discard block |
||
| 1569 | 1569 | */ |
| 1570 | 1570 | public function get_recurring_total() { |
| 1571 | 1571 | |
| 1572 | - if ( empty( $this->totals ) ) { |
|
| 1572 | + if (empty($this->totals)) { |
|
| 1573 | 1573 | $this->recalculate_total(); |
| 1574 | 1574 | } |
| 1575 | 1575 | |
@@ -1579,12 +1579,12 @@ discard block |
||
| 1579 | 1579 | $subtotal = $this->totals['subtotal']['recurring']; |
| 1580 | 1580 | $total = $tax + $fee - $discount + $subtotal; |
| 1581 | 1581 | |
| 1582 | - if ( 0 > $total ) { |
|
| 1582 | + if (0 > $total) { |
|
| 1583 | 1583 | $total = 0; |
| 1584 | 1584 | } |
| 1585 | 1585 | |
| 1586 | - $total = wpinv_round_amount( wpinv_sanitize_amount( $total ) ); |
|
| 1587 | - return apply_filters( 'wpinv_get_recurring_invoice_total', $total, $this ); |
|
| 1586 | + $total = wpinv_round_amount(wpinv_sanitize_amount($total)); |
|
| 1587 | + return apply_filters('wpinv_get_recurring_invoice_total', $total, $this); |
|
| 1588 | 1588 | } |
| 1589 | 1589 | |
| 1590 | 1590 | /** |
@@ -1595,10 +1595,10 @@ discard block |
||
| 1595 | 1595 | * @param string $currency Whether to include the currency. |
| 1596 | 1596 | * @return float|string |
| 1597 | 1597 | */ |
| 1598 | - public function get_recurring_details( $field = '', $currency = false ) { |
|
| 1598 | + public function get_recurring_details($field = '', $currency = false) { |
|
| 1599 | 1599 | |
| 1600 | 1600 | // Maybe recalculate totals. |
| 1601 | - if ( empty( $this->totals ) ) { |
|
| 1601 | + if (empty($this->totals)) { |
|
| 1602 | 1602 | $this->recalculate_total(); |
| 1603 | 1603 | } |
| 1604 | 1604 | |
@@ -1618,8 +1618,8 @@ discard block |
||
| 1618 | 1618 | $currency |
| 1619 | 1619 | ); |
| 1620 | 1620 | |
| 1621 | - if ( isset( $data[$field] ) ) { |
|
| 1622 | - return ( $currency ? wpinv_price( $data[$field], $this->get_currency() ) : $data[$field] ); |
|
| 1621 | + if (isset($data[$field])) { |
|
| 1622 | + return ($currency ? wpinv_price($data[$field], $this->get_currency()) : $data[$field]); |
|
| 1623 | 1623 | } |
| 1624 | 1624 | |
| 1625 | 1625 | return $data; |
@@ -1632,8 +1632,8 @@ discard block |
||
| 1632 | 1632 | * @param string $context View or edit context. |
| 1633 | 1633 | * @return array |
| 1634 | 1634 | */ |
| 1635 | - public function get_fees( $context = 'view' ) { |
|
| 1636 | - return wpinv_parse_list( $this->get_prop( 'fees', $context ) ); |
|
| 1635 | + public function get_fees($context = 'view') { |
|
| 1636 | + return wpinv_parse_list($this->get_prop('fees', $context)); |
|
| 1637 | 1637 | } |
| 1638 | 1638 | |
| 1639 | 1639 | /** |
@@ -1643,8 +1643,8 @@ discard block |
||
| 1643 | 1643 | * @param string $context View or edit context. |
| 1644 | 1644 | * @return array |
| 1645 | 1645 | */ |
| 1646 | - public function get_discounts( $context = 'view' ) { |
|
| 1647 | - return wpinv_parse_list( $this->get_prop( 'discounts', $context ) ); |
|
| 1646 | + public function get_discounts($context = 'view') { |
|
| 1647 | + return wpinv_parse_list($this->get_prop('discounts', $context)); |
|
| 1648 | 1648 | } |
| 1649 | 1649 | |
| 1650 | 1650 | /** |
@@ -1654,8 +1654,8 @@ discard block |
||
| 1654 | 1654 | * @param string $context View or edit context. |
| 1655 | 1655 | * @return array |
| 1656 | 1656 | */ |
| 1657 | - public function get_taxes( $context = 'view' ) { |
|
| 1658 | - return wpinv_parse_list( $this->get_prop( 'taxes', $context ) ); |
|
| 1657 | + public function get_taxes($context = 'view') { |
|
| 1658 | + return wpinv_parse_list($this->get_prop('taxes', $context)); |
|
| 1659 | 1659 | } |
| 1660 | 1660 | |
| 1661 | 1661 | /** |
@@ -1665,8 +1665,8 @@ discard block |
||
| 1665 | 1665 | * @param string $context View or edit context. |
| 1666 | 1666 | * @return GetPaid_Form_Item[] |
| 1667 | 1667 | */ |
| 1668 | - public function get_items( $context = 'view' ) { |
|
| 1669 | - return $this->get_prop( 'items', $context ); |
|
| 1668 | + public function get_items($context = 'view') { |
|
| 1669 | + return $this->get_prop('items', $context); |
|
| 1670 | 1670 | } |
| 1671 | 1671 | |
| 1672 | 1672 | /** |
@@ -1676,7 +1676,7 @@ discard block |
||
| 1676 | 1676 | * @return string |
| 1677 | 1677 | */ |
| 1678 | 1678 | public function get_item_ids() { |
| 1679 | - return implode( ', ', wp_list_pluck( $this->get_cart_details(), 'item_id' ) ); |
|
| 1679 | + return implode(', ', wp_list_pluck($this->get_cart_details(), 'item_id')); |
|
| 1680 | 1680 | } |
| 1681 | 1681 | |
| 1682 | 1682 | /** |
@@ -1686,8 +1686,8 @@ discard block |
||
| 1686 | 1686 | * @param string $context View or edit context. |
| 1687 | 1687 | * @return int |
| 1688 | 1688 | */ |
| 1689 | - public function get_payment_form( $context = 'view' ) { |
|
| 1690 | - return intval( $this->get_prop( 'payment_form', $context ) ); |
|
| 1689 | + public function get_payment_form($context = 'view') { |
|
| 1690 | + return intval($this->get_prop('payment_form', $context)); |
|
| 1691 | 1691 | } |
| 1692 | 1692 | |
| 1693 | 1693 | /** |
@@ -1697,8 +1697,8 @@ discard block |
||
| 1697 | 1697 | * @param string $context View or edit context. |
| 1698 | 1698 | * @return string |
| 1699 | 1699 | */ |
| 1700 | - public function get_submission_id( $context = 'view' ) { |
|
| 1701 | - return $this->get_prop( 'submission_id', $context ); |
|
| 1700 | + public function get_submission_id($context = 'view') { |
|
| 1701 | + return $this->get_prop('submission_id', $context); |
|
| 1702 | 1702 | } |
| 1703 | 1703 | |
| 1704 | 1704 | /** |
@@ -1708,8 +1708,8 @@ discard block |
||
| 1708 | 1708 | * @param string $context View or edit context. |
| 1709 | 1709 | * @return string |
| 1710 | 1710 | */ |
| 1711 | - public function get_discount_code( $context = 'view' ) { |
|
| 1712 | - return $this->get_prop( 'discount_code', $context ); |
|
| 1711 | + public function get_discount_code($context = 'view') { |
|
| 1712 | + return $this->get_prop('discount_code', $context); |
|
| 1713 | 1713 | } |
| 1714 | 1714 | |
| 1715 | 1715 | /** |
@@ -1719,8 +1719,8 @@ discard block |
||
| 1719 | 1719 | * @param string $context View or edit context. |
| 1720 | 1720 | * @return string |
| 1721 | 1721 | */ |
| 1722 | - public function get_gateway( $context = 'view' ) { |
|
| 1723 | - return $this->get_prop( 'gateway', $context ); |
|
| 1722 | + public function get_gateway($context = 'view') { |
|
| 1723 | + return $this->get_prop('gateway', $context); |
|
| 1724 | 1724 | } |
| 1725 | 1725 | |
| 1726 | 1726 | /** |
@@ -1730,8 +1730,8 @@ discard block |
||
| 1730 | 1730 | * @return string |
| 1731 | 1731 | */ |
| 1732 | 1732 | public function get_gateway_title() { |
| 1733 | - $title = wpinv_get_gateway_checkout_label( $this->get_gateway() ); |
|
| 1734 | - return apply_filters( 'wpinv_gateway_title', $title, $this->get_id(), $this ); |
|
| 1733 | + $title = wpinv_get_gateway_checkout_label($this->get_gateway()); |
|
| 1734 | + return apply_filters('wpinv_gateway_title', $title, $this->get_id(), $this); |
|
| 1735 | 1735 | } |
| 1736 | 1736 | |
| 1737 | 1737 | /** |
@@ -1741,8 +1741,8 @@ discard block |
||
| 1741 | 1741 | * @param string $context View or edit context. |
| 1742 | 1742 | * @return string |
| 1743 | 1743 | */ |
| 1744 | - public function get_transaction_id( $context = 'view' ) { |
|
| 1745 | - return $this->get_prop( 'transaction_id', $context ); |
|
| 1744 | + public function get_transaction_id($context = 'view') { |
|
| 1745 | + return $this->get_prop('transaction_id', $context); |
|
| 1746 | 1746 | } |
| 1747 | 1747 | |
| 1748 | 1748 | /** |
@@ -1752,9 +1752,9 @@ discard block |
||
| 1752 | 1752 | * @param string $context View or edit context. |
| 1753 | 1753 | * @return string |
| 1754 | 1754 | */ |
| 1755 | - public function get_currency( $context = 'view' ) { |
|
| 1756 | - $currency = $this->get_prop( 'currency', $context ); |
|
| 1757 | - return empty( $currency ) ? wpinv_get_currency() : $currency; |
|
| 1755 | + public function get_currency($context = 'view') { |
|
| 1756 | + $currency = $this->get_prop('currency', $context); |
|
| 1757 | + return empty($currency) ? wpinv_get_currency() : $currency; |
|
| 1758 | 1758 | } |
| 1759 | 1759 | |
| 1760 | 1760 | /** |
@@ -1764,8 +1764,8 @@ discard block |
||
| 1764 | 1764 | * @param string $context View or edit context. |
| 1765 | 1765 | * @return bool |
| 1766 | 1766 | */ |
| 1767 | - public function get_disable_taxes( $context = 'view' ) { |
|
| 1768 | - return (bool) $this->get_prop( 'disable_taxes', $context ); |
|
| 1767 | + public function get_disable_taxes($context = 'view') { |
|
| 1768 | + return (bool) $this->get_prop('disable_taxes', $context); |
|
| 1769 | 1769 | } |
| 1770 | 1770 | |
| 1771 | 1771 | /** |
@@ -1775,8 +1775,8 @@ discard block |
||
| 1775 | 1775 | * @param string $context View or edit context. |
| 1776 | 1776 | * @return int |
| 1777 | 1777 | */ |
| 1778 | - public function get_subscription_id( $context = 'view' ) { |
|
| 1779 | - return $this->is_renewal() ? $this->get_parent()->get_subscription_id( $context ) : $this->get_prop( 'subscription_id', $context ); |
|
| 1778 | + public function get_subscription_id($context = 'view') { |
|
| 1779 | + return $this->is_renewal() ? $this->get_parent()->get_subscription_id($context) : $this->get_prop('subscription_id', $context); |
|
| 1780 | 1780 | } |
| 1781 | 1781 | |
| 1782 | 1782 | /** |
@@ -1786,12 +1786,12 @@ discard block |
||
| 1786 | 1786 | * @param string $context View or edit context. |
| 1787 | 1787 | * @return int |
| 1788 | 1788 | */ |
| 1789 | - public function get_remote_subscription_id( $context = 'view' ) { |
|
| 1790 | - $subscription_id = $this->get_prop( 'remote_subscription_id', $context ); |
|
| 1789 | + public function get_remote_subscription_id($context = 'view') { |
|
| 1790 | + $subscription_id = $this->get_prop('remote_subscription_id', $context); |
|
| 1791 | 1791 | |
| 1792 | - if ( empty( $subscription_id ) && $this->is_renewal() ) { |
|
| 1792 | + if (empty($subscription_id) && $this->is_renewal()) { |
|
| 1793 | 1793 | $parent = $this->get_parent(); |
| 1794 | - return $parent->get_remote_subscription_id( $context ); |
|
| 1794 | + return $parent->get_remote_subscription_id($context); |
|
| 1795 | 1795 | } |
| 1796 | 1796 | |
| 1797 | 1797 | return $subscription_id; |
@@ -1804,20 +1804,20 @@ discard block |
||
| 1804 | 1804 | * @param string $context View or edit context. |
| 1805 | 1805 | * @return array |
| 1806 | 1806 | */ |
| 1807 | - public function get_payment_meta( $context = 'view' ) { |
|
| 1807 | + public function get_payment_meta($context = 'view') { |
|
| 1808 | 1808 | |
| 1809 | 1809 | return array( |
| 1810 | - 'price' => $this->get_total( $context ), |
|
| 1811 | - 'date' => $this->get_date_created( $context ), |
|
| 1812 | - 'user_email' => $this->get_email( $context ), |
|
| 1813 | - 'invoice_key' => $this->get_key( $context ), |
|
| 1814 | - 'currency' => $this->get_currency( $context ), |
|
| 1815 | - 'items' => $this->get_items( $context ), |
|
| 1816 | - 'user_info' => $this->get_user_info( $context ), |
|
| 1810 | + 'price' => $this->get_total($context), |
|
| 1811 | + 'date' => $this->get_date_created($context), |
|
| 1812 | + 'user_email' => $this->get_email($context), |
|
| 1813 | + 'invoice_key' => $this->get_key($context), |
|
| 1814 | + 'currency' => $this->get_currency($context), |
|
| 1815 | + 'items' => $this->get_items($context), |
|
| 1816 | + 'user_info' => $this->get_user_info($context), |
|
| 1817 | 1817 | 'cart_details' => $this->get_cart_details(), |
| 1818 | - 'status' => $this->get_status( $context ), |
|
| 1819 | - 'fees' => $this->get_fees( $context ), |
|
| 1820 | - 'taxes' => $this->get_taxes( $context ), |
|
| 1818 | + 'status' => $this->get_status($context), |
|
| 1819 | + 'fees' => $this->get_fees($context), |
|
| 1820 | + 'taxes' => $this->get_taxes($context), |
|
| 1821 | 1821 | ); |
| 1822 | 1822 | |
| 1823 | 1823 | } |
@@ -1832,9 +1832,9 @@ discard block |
||
| 1832 | 1832 | $items = $this->get_items(); |
| 1833 | 1833 | $cart_details = array(); |
| 1834 | 1834 | |
| 1835 | - foreach ( $items as $item ) { |
|
| 1835 | + foreach ($items as $item) { |
|
| 1836 | 1836 | $item->invoice_id = $this->get_id(); |
| 1837 | - $cart_details[] = $item->prepare_data_for_saving(); |
|
| 1837 | + $cart_details[] = $item->prepare_data_for_saving(); |
|
| 1838 | 1838 | } |
| 1839 | 1839 | |
| 1840 | 1840 | return $cart_details; |
@@ -1845,11 +1845,11 @@ discard block |
||
| 1845 | 1845 | * |
| 1846 | 1846 | * @return null|GetPaid_Form_Item|int |
| 1847 | 1847 | */ |
| 1848 | - public function get_recurring( $object = false ) { |
|
| 1848 | + public function get_recurring($object = false) { |
|
| 1849 | 1849 | |
| 1850 | 1850 | // Are we returning an object? |
| 1851 | - if ( $object ) { |
|
| 1852 | - return $this->get_item( $this->recurring_item ); |
|
| 1851 | + if ($object) { |
|
| 1852 | + return $this->get_item($this->recurring_item); |
|
| 1853 | 1853 | } |
| 1854 | 1854 | |
| 1855 | 1855 | return $this->recurring_item; |
@@ -1864,15 +1864,15 @@ discard block |
||
| 1864 | 1864 | public function get_subscription_name() { |
| 1865 | 1865 | |
| 1866 | 1866 | // Retrieve the recurring name |
| 1867 | - $item = $this->get_recurring( true ); |
|
| 1867 | + $item = $this->get_recurring(true); |
|
| 1868 | 1868 | |
| 1869 | 1869 | // Abort if it does not exist. |
| 1870 | - if ( empty( $item ) ) { |
|
| 1870 | + if (empty($item)) { |
|
| 1871 | 1871 | return ''; |
| 1872 | 1872 | } |
| 1873 | 1873 | |
| 1874 | 1874 | // Return the item name. |
| 1875 | - return apply_filters( 'wpinv_invoice_get_subscription_name', $item->get_name(), $this ); |
|
| 1875 | + return apply_filters('wpinv_invoice_get_subscription_name', $item->get_name(), $this); |
|
| 1876 | 1876 | } |
| 1877 | 1877 | |
| 1878 | 1878 | /** |
@@ -1882,9 +1882,9 @@ discard block |
||
| 1882 | 1882 | * @return string |
| 1883 | 1883 | */ |
| 1884 | 1884 | public function get_view_url() { |
| 1885 | - $invoice_url = get_permalink( $this->get_id() ); |
|
| 1886 | - $invoice_url = add_query_arg( 'invoice_key', $this->get_key(), $invoice_url ); |
|
| 1887 | - return apply_filters( 'wpinv_get_view_url', $invoice_url, $this ); |
|
| 1885 | + $invoice_url = get_permalink($this->get_id()); |
|
| 1886 | + $invoice_url = add_query_arg('invoice_key', $this->get_key(), $invoice_url); |
|
| 1887 | + return apply_filters('wpinv_get_view_url', $invoice_url, $this); |
|
| 1888 | 1888 | } |
| 1889 | 1889 | |
| 1890 | 1890 | /** |
@@ -1893,25 +1893,25 @@ discard block |
||
| 1893 | 1893 | * @since 1.0.19 |
| 1894 | 1894 | * @return string |
| 1895 | 1895 | */ |
| 1896 | - public function get_checkout_payment_url( $deprecated = false, $secret = false ) { |
|
| 1896 | + public function get_checkout_payment_url($deprecated = false, $secret = false) { |
|
| 1897 | 1897 | |
| 1898 | 1898 | // Retrieve the checkout url. |
| 1899 | 1899 | $pay_url = wpinv_get_checkout_uri(); |
| 1900 | 1900 | |
| 1901 | 1901 | // Maybe force ssl. |
| 1902 | - if ( is_ssl() ) { |
|
| 1903 | - $pay_url = str_replace( 'http:', 'https:', $pay_url ); |
|
| 1902 | + if (is_ssl()) { |
|
| 1903 | + $pay_url = str_replace('http:', 'https:', $pay_url); |
|
| 1904 | 1904 | } |
| 1905 | 1905 | |
| 1906 | 1906 | // Add the invoice key. |
| 1907 | - $pay_url = add_query_arg( 'invoice_key', $this->get_key(), $pay_url ); |
|
| 1907 | + $pay_url = add_query_arg('invoice_key', $this->get_key(), $pay_url); |
|
| 1908 | 1908 | |
| 1909 | 1909 | // (Maybe?) add a secret |
| 1910 | - if ( $secret ) { |
|
| 1911 | - $pay_url = add_query_arg( array( '_wpipay' => md5( $this->get_user_id() . '::' . $this->get_email() . '::' . $this->get_key() ) ), $pay_url ); |
|
| 1910 | + if ($secret) { |
|
| 1911 | + $pay_url = add_query_arg(array('_wpipay' => md5($this->get_user_id() . '::' . $this->get_email() . '::' . $this->get_key())), $pay_url); |
|
| 1912 | 1912 | } |
| 1913 | 1913 | |
| 1914 | - return apply_filters( 'wpinv_get_checkout_payment_url', $pay_url, $this, $deprecated, $secret ); |
|
| 1914 | + return apply_filters('wpinv_get_checkout_payment_url', $pay_url, $this, $deprecated, $secret); |
|
| 1915 | 1915 | } |
| 1916 | 1916 | |
| 1917 | 1917 | /** |
@@ -1926,14 +1926,14 @@ discard block |
||
| 1926 | 1926 | $receipt_url = wpinv_get_success_page_uri(); |
| 1927 | 1927 | |
| 1928 | 1928 | // Maybe force ssl. |
| 1929 | - if ( is_ssl() ) { |
|
| 1930 | - $receipt_url = str_replace( 'http:', 'https:', $receipt_url ); |
|
| 1929 | + if (is_ssl()) { |
|
| 1930 | + $receipt_url = str_replace('http:', 'https:', $receipt_url); |
|
| 1931 | 1931 | } |
| 1932 | 1932 | |
| 1933 | 1933 | // Add the invoice key. |
| 1934 | - $receipt_url = add_query_arg( 'invoice_key', $this->get_key(), $receipt_url ); |
|
| 1934 | + $receipt_url = add_query_arg('invoice_key', $this->get_key(), $receipt_url); |
|
| 1935 | 1935 | |
| 1936 | - return apply_filters( 'getpaid_get_invoice_receipt_url', $receipt_url, $this ); |
|
| 1936 | + return apply_filters('getpaid_get_invoice_receipt_url', $receipt_url, $this); |
|
| 1937 | 1937 | } |
| 1938 | 1938 | |
| 1939 | 1939 | /** |
@@ -1943,7 +1943,7 @@ discard block |
||
| 1943 | 1943 | * @return string |
| 1944 | 1944 | */ |
| 1945 | 1945 | public function get_transaction_url() { |
| 1946 | - return apply_filters( 'getpaid_gateway_' . $this->get_gateway() . '_transaction_url', '', $this ); |
|
| 1946 | + return apply_filters('getpaid_gateway_' . $this->get_gateway() . '_transaction_url', '', $this); |
|
| 1947 | 1947 | } |
| 1948 | 1948 | |
| 1949 | 1949 | /** |
@@ -1956,7 +1956,7 @@ discard block |
||
| 1956 | 1956 | |
| 1957 | 1957 | $type = $this->get_type(); |
| 1958 | 1958 | $status = "wpi-$type-pending"; |
| 1959 | - return str_replace( '-invoice', '', $status ); |
|
| 1959 | + return str_replace('-invoice', '', $status); |
|
| 1960 | 1960 | |
| 1961 | 1961 | } |
| 1962 | 1962 | |
@@ -1970,8 +1970,8 @@ discard block |
||
| 1970 | 1970 | * @param string $context View or edit context. |
| 1971 | 1971 | * @return mixed Value of the given invoice property (if set). |
| 1972 | 1972 | */ |
| 1973 | - public function get( $key, $context = 'view' ) { |
|
| 1974 | - return $this->get_prop( $key, $context ); |
|
| 1973 | + public function get($key, $context = 'view') { |
|
| 1974 | + return $this->get_prop($key, $context); |
|
| 1975 | 1975 | } |
| 1976 | 1976 | |
| 1977 | 1977 | /* |
@@ -1994,11 +1994,11 @@ discard block |
||
| 1994 | 1994 | * @param mixed $value new value. |
| 1995 | 1995 | * @return mixed Value of the given invoice property (if set). |
| 1996 | 1996 | */ |
| 1997 | - public function set( $key, $value ) { |
|
| 1997 | + public function set($key, $value) { |
|
| 1998 | 1998 | |
| 1999 | 1999 | $setter = "set_$key"; |
| 2000 | - if ( is_callable( array( $this, $setter ) ) ) { |
|
| 2001 | - $this->{$setter}( $value ); |
|
| 2000 | + if (is_callable(array($this, $setter))) { |
|
| 2001 | + $this->{$setter}($value); |
|
| 2002 | 2002 | } |
| 2003 | 2003 | |
| 2004 | 2004 | } |
@@ -2012,45 +2012,45 @@ discard block |
||
| 2012 | 2012 | * @param bool $manual_update Is this a manual status change?. |
| 2013 | 2013 | * @return array details of change. |
| 2014 | 2014 | */ |
| 2015 | - public function set_status( $new_status, $note = '', $manual_update = false ) { |
|
| 2015 | + public function set_status($new_status, $note = '', $manual_update = false) { |
|
| 2016 | 2016 | $old_status = $this->get_status(); |
| 2017 | 2017 | |
| 2018 | 2018 | $statuses = $this->get_all_statuses(); |
| 2019 | 2019 | |
| 2020 | - if ( isset( $statuses[ 'draft' ] ) ) { |
|
| 2021 | - unset( $statuses[ 'draft' ] ); |
|
| 2020 | + if (isset($statuses['draft'])) { |
|
| 2021 | + unset($statuses['draft']); |
|
| 2022 | 2022 | } |
| 2023 | 2023 | |
| 2024 | - $this->set_prop( 'status', $new_status ); |
|
| 2024 | + $this->set_prop('status', $new_status); |
|
| 2025 | 2025 | |
| 2026 | 2026 | // If setting the status, ensure it's set to a valid status. |
| 2027 | - if ( true === $this->object_read ) { |
|
| 2027 | + if (true === $this->object_read) { |
|
| 2028 | 2028 | |
| 2029 | 2029 | // Only allow valid new status. |
| 2030 | - if ( ! array_key_exists( $new_status, $statuses ) ) { |
|
| 2030 | + if (!array_key_exists($new_status, $statuses)) { |
|
| 2031 | 2031 | $new_status = $this->get_default_status(); |
| 2032 | 2032 | } |
| 2033 | 2033 | |
| 2034 | 2034 | // If the old status is set but unknown (e.g. draft) assume its pending for action usage. |
| 2035 | - if ( $old_status && ! array_key_exists( $new_status, $statuses ) ) { |
|
| 2035 | + if ($old_status && !array_key_exists($new_status, $statuses)) { |
|
| 2036 | 2036 | $old_status = $this->get_default_status(); |
| 2037 | 2037 | } |
| 2038 | 2038 | |
| 2039 | 2039 | // Paid - Renewal (i.e when duplicating a parent invoice ) |
| 2040 | - if ( $new_status == 'wpi-pending' && $old_status == 'publish' && ! $this->get_id() ) { |
|
| 2040 | + if ($new_status == 'wpi-pending' && $old_status == 'publish' && !$this->get_id()) { |
|
| 2041 | 2041 | $old_status = 'wpi-pending'; |
| 2042 | 2042 | } |
| 2043 | 2043 | |
| 2044 | - if ( $old_status !== $new_status ) { |
|
| 2044 | + if ($old_status !== $new_status) { |
|
| 2045 | 2045 | $this->status_transition = array( |
| 2046 | - 'from' => ! empty( $this->status_transition['from'] ) ? $this->status_transition['from'] : $old_status, |
|
| 2046 | + 'from' => !empty($this->status_transition['from']) ? $this->status_transition['from'] : $old_status, |
|
| 2047 | 2047 | 'to' => $new_status, |
| 2048 | 2048 | 'note' => $note, |
| 2049 | 2049 | 'manual' => (bool) $manual_update, |
| 2050 | 2050 | ); |
| 2051 | 2051 | |
| 2052 | - if ( $manual_update ) { |
|
| 2053 | - do_action( 'getpaid_' . $this->object_type .'_edit_status', $this->get_id(), $new_status ); |
|
| 2052 | + if ($manual_update) { |
|
| 2053 | + do_action('getpaid_' . $this->object_type . '_edit_status', $this->get_id(), $new_status); |
|
| 2054 | 2054 | } |
| 2055 | 2055 | |
| 2056 | 2056 | $this->maybe_set_date_paid(); |
@@ -2075,8 +2075,8 @@ discard block |
||
| 2075 | 2075 | */ |
| 2076 | 2076 | public function maybe_set_date_paid() { |
| 2077 | 2077 | |
| 2078 | - if ( ! $this->get_date_completed( 'edit' ) && $this->is_paid() ) { |
|
| 2079 | - $this->set_date_completed( current_time( 'mysql' ) ); |
|
| 2078 | + if (!$this->get_date_completed('edit') && $this->is_paid()) { |
|
| 2079 | + $this->set_date_completed(current_time('mysql')); |
|
| 2080 | 2080 | } |
| 2081 | 2081 | } |
| 2082 | 2082 | |
@@ -2085,11 +2085,11 @@ discard block |
||
| 2085 | 2085 | * |
| 2086 | 2086 | * @since 1.0.19 |
| 2087 | 2087 | */ |
| 2088 | - public function set_parent_id( $value ) { |
|
| 2089 | - if ( $value && ( $value === $this->get_id() ) ) { |
|
| 2088 | + public function set_parent_id($value) { |
|
| 2089 | + if ($value && ($value === $this->get_id())) { |
|
| 2090 | 2090 | return; |
| 2091 | 2091 | } |
| 2092 | - $this->set_prop( 'parent_id', absint( $value ) ); |
|
| 2092 | + $this->set_prop('parent_id', absint($value)); |
|
| 2093 | 2093 | } |
| 2094 | 2094 | |
| 2095 | 2095 | /** |
@@ -2097,8 +2097,8 @@ discard block |
||
| 2097 | 2097 | * |
| 2098 | 2098 | * @since 1.0.19 |
| 2099 | 2099 | */ |
| 2100 | - public function set_version( $value ) { |
|
| 2101 | - $this->set_prop( 'version', $value ); |
|
| 2100 | + public function set_version($value) { |
|
| 2101 | + $this->set_prop('version', $value); |
|
| 2102 | 2102 | } |
| 2103 | 2103 | |
| 2104 | 2104 | /** |
@@ -2108,15 +2108,15 @@ discard block |
||
| 2108 | 2108 | * @param string $value Value to set. |
| 2109 | 2109 | * @return bool Whether or not the date was set. |
| 2110 | 2110 | */ |
| 2111 | - public function set_date_created( $value ) { |
|
| 2112 | - $date = strtotime( $value ); |
|
| 2111 | + public function set_date_created($value) { |
|
| 2112 | + $date = strtotime($value); |
|
| 2113 | 2113 | |
| 2114 | - if ( $date && $value !== '0000-00-00 00:00:00' ) { |
|
| 2115 | - $this->set_prop( 'date_created', date( 'Y-m-d H:i:s', $date ) ); |
|
| 2114 | + if ($date && $value !== '0000-00-00 00:00:00') { |
|
| 2115 | + $this->set_prop('date_created', date('Y-m-d H:i:s', $date)); |
|
| 2116 | 2116 | return true; |
| 2117 | 2117 | } |
| 2118 | 2118 | |
| 2119 | - $this->set_prop( 'date_created', '' ); |
|
| 2119 | + $this->set_prop('date_created', ''); |
|
| 2120 | 2120 | return false; |
| 2121 | 2121 | |
| 2122 | 2122 | } |
@@ -2128,15 +2128,15 @@ discard block |
||
| 2128 | 2128 | * @param string $value Value to set. |
| 2129 | 2129 | * @return bool Whether or not the date was set. |
| 2130 | 2130 | */ |
| 2131 | - public function set_due_date( $value ) { |
|
| 2132 | - $date = strtotime( $value ); |
|
| 2131 | + public function set_due_date($value) { |
|
| 2132 | + $date = strtotime($value); |
|
| 2133 | 2133 | |
| 2134 | - if ( $date && $value !== '0000-00-00 00:00:00' ) { |
|
| 2135 | - $this->set_prop( 'due_date', date( 'Y-m-d H:i:s', $date ) ); |
|
| 2134 | + if ($date && $value !== '0000-00-00 00:00:00') { |
|
| 2135 | + $this->set_prop('due_date', date('Y-m-d H:i:s', $date)); |
|
| 2136 | 2136 | return true; |
| 2137 | 2137 | } |
| 2138 | 2138 | |
| 2139 | - $this->set_prop( 'due_date', '' ); |
|
| 2139 | + $this->set_prop('due_date', ''); |
|
| 2140 | 2140 | return false; |
| 2141 | 2141 | |
| 2142 | 2142 | } |
@@ -2147,8 +2147,8 @@ discard block |
||
| 2147 | 2147 | * @since 1.0.19 |
| 2148 | 2148 | * @param string $value New name. |
| 2149 | 2149 | */ |
| 2150 | - public function set_date_due( $value ) { |
|
| 2151 | - $this->set_due_date( $value ); |
|
| 2150 | + public function set_date_due($value) { |
|
| 2151 | + $this->set_due_date($value); |
|
| 2152 | 2152 | } |
| 2153 | 2153 | |
| 2154 | 2154 | /** |
@@ -2158,15 +2158,15 @@ discard block |
||
| 2158 | 2158 | * @param string $value Value to set. |
| 2159 | 2159 | * @return bool Whether or not the date was set. |
| 2160 | 2160 | */ |
| 2161 | - public function set_completed_date( $value ) { |
|
| 2162 | - $date = strtotime( $value ); |
|
| 2161 | + public function set_completed_date($value) { |
|
| 2162 | + $date = strtotime($value); |
|
| 2163 | 2163 | |
| 2164 | - if ( $date && $value !== '0000-00-00 00:00:00' ) { |
|
| 2165 | - $this->set_prop( 'completed_date', date( 'Y-m-d H:i:s', $date ) ); |
|
| 2164 | + if ($date && $value !== '0000-00-00 00:00:00') { |
|
| 2165 | + $this->set_prop('completed_date', date('Y-m-d H:i:s', $date)); |
|
| 2166 | 2166 | return true; |
| 2167 | 2167 | } |
| 2168 | 2168 | |
| 2169 | - $this->set_prop( 'completed_date', '' ); |
|
| 2169 | + $this->set_prop('completed_date', ''); |
|
| 2170 | 2170 | return false; |
| 2171 | 2171 | |
| 2172 | 2172 | } |
@@ -2177,8 +2177,8 @@ discard block |
||
| 2177 | 2177 | * @since 1.0.19 |
| 2178 | 2178 | * @param string $value New name. |
| 2179 | 2179 | */ |
| 2180 | - public function set_date_completed( $value ) { |
|
| 2181 | - $this->set_completed_date( $value ); |
|
| 2180 | + public function set_date_completed($value) { |
|
| 2181 | + $this->set_completed_date($value); |
|
| 2182 | 2182 | } |
| 2183 | 2183 | |
| 2184 | 2184 | /** |
@@ -2188,15 +2188,15 @@ discard block |
||
| 2188 | 2188 | * @param string $value Value to set. |
| 2189 | 2189 | * @return bool Whether or not the date was set. |
| 2190 | 2190 | */ |
| 2191 | - public function set_date_modified( $value ) { |
|
| 2192 | - $date = strtotime( $value ); |
|
| 2191 | + public function set_date_modified($value) { |
|
| 2192 | + $date = strtotime($value); |
|
| 2193 | 2193 | |
| 2194 | - if ( $date && $value !== '0000-00-00 00:00:00' ) { |
|
| 2195 | - $this->set_prop( 'date_modified', date( 'Y-m-d H:i:s', $date ) ); |
|
| 2194 | + if ($date && $value !== '0000-00-00 00:00:00') { |
|
| 2195 | + $this->set_prop('date_modified', date('Y-m-d H:i:s', $date)); |
|
| 2196 | 2196 | return true; |
| 2197 | 2197 | } |
| 2198 | 2198 | |
| 2199 | - $this->set_prop( 'date_modified', '' ); |
|
| 2199 | + $this->set_prop('date_modified', ''); |
|
| 2200 | 2200 | return false; |
| 2201 | 2201 | |
| 2202 | 2202 | } |
@@ -2207,9 +2207,9 @@ discard block |
||
| 2207 | 2207 | * @since 1.0.19 |
| 2208 | 2208 | * @param string $value New number. |
| 2209 | 2209 | */ |
| 2210 | - public function set_number( $value ) { |
|
| 2211 | - $number = sanitize_text_field( $value ); |
|
| 2212 | - $this->set_prop( 'number', $number ); |
|
| 2210 | + public function set_number($value) { |
|
| 2211 | + $number = sanitize_text_field($value); |
|
| 2212 | + $this->set_prop('number', $number); |
|
| 2213 | 2213 | } |
| 2214 | 2214 | |
| 2215 | 2215 | /** |
@@ -2218,9 +2218,9 @@ discard block |
||
| 2218 | 2218 | * @since 1.0.19 |
| 2219 | 2219 | * @param string $value Type. |
| 2220 | 2220 | */ |
| 2221 | - public function set_type( $value ) { |
|
| 2222 | - $type = sanitize_text_field( str_replace( 'wpi_', '', $value ) ); |
|
| 2223 | - $this->set_prop( 'type', $type ); |
|
| 2221 | + public function set_type($value) { |
|
| 2222 | + $type = sanitize_text_field(str_replace('wpi_', '', $value)); |
|
| 2223 | + $this->set_prop('type', $type); |
|
| 2224 | 2224 | } |
| 2225 | 2225 | |
| 2226 | 2226 | /** |
@@ -2229,10 +2229,10 @@ discard block |
||
| 2229 | 2229 | * @since 1.0.19 |
| 2230 | 2230 | * @param string $value Post type. |
| 2231 | 2231 | */ |
| 2232 | - public function set_post_type( $value ) { |
|
| 2233 | - if ( getpaid_is_invoice_post_type( $value ) ) { |
|
| 2234 | - $this->set_type( $value ); |
|
| 2235 | - $this->set_prop( 'post_type', $value ); |
|
| 2232 | + public function set_post_type($value) { |
|
| 2233 | + if (getpaid_is_invoice_post_type($value)) { |
|
| 2234 | + $this->set_type($value); |
|
| 2235 | + $this->set_prop('post_type', $value); |
|
| 2236 | 2236 | } |
| 2237 | 2237 | } |
| 2238 | 2238 | |
@@ -2242,9 +2242,9 @@ discard block |
||
| 2242 | 2242 | * @since 1.0.19 |
| 2243 | 2243 | * @param string $value New key. |
| 2244 | 2244 | */ |
| 2245 | - public function set_key( $value ) { |
|
| 2246 | - $key = sanitize_text_field( $value ); |
|
| 2247 | - $this->set_prop( 'key', $key ); |
|
| 2245 | + public function set_key($value) { |
|
| 2246 | + $key = sanitize_text_field($value); |
|
| 2247 | + $this->set_prop('key', $key); |
|
| 2248 | 2248 | } |
| 2249 | 2249 | |
| 2250 | 2250 | /** |
@@ -2253,9 +2253,9 @@ discard block |
||
| 2253 | 2253 | * @since 1.0.19 |
| 2254 | 2254 | * @param string $value mode. |
| 2255 | 2255 | */ |
| 2256 | - public function set_mode( $value ) { |
|
| 2257 | - if ( in_array( $value, array( 'live', 'test' ) ) ) { |
|
| 2258 | - $this->set_prop( 'mode', $value ); |
|
| 2256 | + public function set_mode($value) { |
|
| 2257 | + if (in_array($value, array('live', 'test'))) { |
|
| 2258 | + $this->set_prop('mode', $value); |
|
| 2259 | 2259 | } |
| 2260 | 2260 | } |
| 2261 | 2261 | |
@@ -2265,8 +2265,8 @@ discard block |
||
| 2265 | 2265 | * @since 1.0.19 |
| 2266 | 2266 | * @param string $value path. |
| 2267 | 2267 | */ |
| 2268 | - public function set_path( $value ) { |
|
| 2269 | - $this->set_prop( 'path', $value ); |
|
| 2268 | + public function set_path($value) { |
|
| 2269 | + $this->set_prop('path', $value); |
|
| 2270 | 2270 | } |
| 2271 | 2271 | |
| 2272 | 2272 | /** |
@@ -2275,9 +2275,9 @@ discard block |
||
| 2275 | 2275 | * @since 1.0.19 |
| 2276 | 2276 | * @param string $value New name. |
| 2277 | 2277 | */ |
| 2278 | - public function set_name( $value ) { |
|
| 2279 | - $name = sanitize_text_field( $value ); |
|
| 2280 | - $this->set_prop( 'name', $name ); |
|
| 2278 | + public function set_name($value) { |
|
| 2279 | + $name = sanitize_text_field($value); |
|
| 2280 | + $this->set_prop('name', $name); |
|
| 2281 | 2281 | } |
| 2282 | 2282 | |
| 2283 | 2283 | /** |
@@ -2286,8 +2286,8 @@ discard block |
||
| 2286 | 2286 | * @since 1.0.19 |
| 2287 | 2287 | * @param string $value New name. |
| 2288 | 2288 | */ |
| 2289 | - public function set_title( $value ) { |
|
| 2290 | - $this->set_name( $value ); |
|
| 2289 | + public function set_title($value) { |
|
| 2290 | + $this->set_name($value); |
|
| 2291 | 2291 | } |
| 2292 | 2292 | |
| 2293 | 2293 | /** |
@@ -2296,9 +2296,9 @@ discard block |
||
| 2296 | 2296 | * @since 1.0.19 |
| 2297 | 2297 | * @param string $value New description. |
| 2298 | 2298 | */ |
| 2299 | - public function set_description( $value ) { |
|
| 2300 | - $description = wp_kses_post( $value ); |
|
| 2301 | - $this->set_prop( 'description', $description ); |
|
| 2299 | + public function set_description($value) { |
|
| 2300 | + $description = wp_kses_post($value); |
|
| 2301 | + $this->set_prop('description', $description); |
|
| 2302 | 2302 | } |
| 2303 | 2303 | |
| 2304 | 2304 | /** |
@@ -2307,8 +2307,8 @@ discard block |
||
| 2307 | 2307 | * @since 1.0.19 |
| 2308 | 2308 | * @param string $value New description. |
| 2309 | 2309 | */ |
| 2310 | - public function set_excerpt( $value ) { |
|
| 2311 | - $this->set_description( $value ); |
|
| 2310 | + public function set_excerpt($value) { |
|
| 2311 | + $this->set_description($value); |
|
| 2312 | 2312 | } |
| 2313 | 2313 | |
| 2314 | 2314 | /** |
@@ -2317,8 +2317,8 @@ discard block |
||
| 2317 | 2317 | * @since 1.0.19 |
| 2318 | 2318 | * @param string $value New description. |
| 2319 | 2319 | */ |
| 2320 | - public function set_summary( $value ) { |
|
| 2321 | - $this->set_description( $value ); |
|
| 2320 | + public function set_summary($value) { |
|
| 2321 | + $this->set_description($value); |
|
| 2322 | 2322 | } |
| 2323 | 2323 | |
| 2324 | 2324 | /** |
@@ -2327,12 +2327,12 @@ discard block |
||
| 2327 | 2327 | * @since 1.0.19 |
| 2328 | 2328 | * @param int $value New author. |
| 2329 | 2329 | */ |
| 2330 | - public function set_author( $value ) { |
|
| 2331 | - $user = get_user_by( 'id', (int) $value ); |
|
| 2330 | + public function set_author($value) { |
|
| 2331 | + $user = get_user_by('id', (int) $value); |
|
| 2332 | 2332 | |
| 2333 | - if ( $user && $user->ID ) { |
|
| 2334 | - $this->set_prop( 'author', $user->ID ); |
|
| 2335 | - $this->set_prop( 'email', $user->user_email ); |
|
| 2333 | + if ($user && $user->ID) { |
|
| 2334 | + $this->set_prop('author', $user->ID); |
|
| 2335 | + $this->set_prop('email', $user->user_email); |
|
| 2336 | 2336 | } |
| 2337 | 2337 | |
| 2338 | 2338 | } |
@@ -2343,8 +2343,8 @@ discard block |
||
| 2343 | 2343 | * @since 1.0.19 |
| 2344 | 2344 | * @param int $value New user id. |
| 2345 | 2345 | */ |
| 2346 | - public function set_user_id( $value ) { |
|
| 2347 | - $this->set_author( $value ); |
|
| 2346 | + public function set_user_id($value) { |
|
| 2347 | + $this->set_author($value); |
|
| 2348 | 2348 | } |
| 2349 | 2349 | |
| 2350 | 2350 | /** |
@@ -2353,8 +2353,8 @@ discard block |
||
| 2353 | 2353 | * @since 1.0.19 |
| 2354 | 2354 | * @param int $value New user id. |
| 2355 | 2355 | */ |
| 2356 | - public function set_customer_id( $value ) { |
|
| 2357 | - $this->set_author( $value ); |
|
| 2356 | + public function set_customer_id($value) { |
|
| 2357 | + $this->set_author($value); |
|
| 2358 | 2358 | } |
| 2359 | 2359 | |
| 2360 | 2360 | /** |
@@ -2363,8 +2363,8 @@ discard block |
||
| 2363 | 2363 | * @since 1.0.19 |
| 2364 | 2364 | * @param string $value ip address. |
| 2365 | 2365 | */ |
| 2366 | - public function set_ip( $value ) { |
|
| 2367 | - $this->set_prop( 'ip', $value ); |
|
| 2366 | + public function set_ip($value) { |
|
| 2367 | + $this->set_prop('ip', $value); |
|
| 2368 | 2368 | } |
| 2369 | 2369 | |
| 2370 | 2370 | /** |
@@ -2373,8 +2373,8 @@ discard block |
||
| 2373 | 2373 | * @since 1.0.19 |
| 2374 | 2374 | * @param string $value ip address. |
| 2375 | 2375 | */ |
| 2376 | - public function set_user_ip( $value ) { |
|
| 2377 | - $this->set_ip( $value ); |
|
| 2376 | + public function set_user_ip($value) { |
|
| 2377 | + $this->set_ip($value); |
|
| 2378 | 2378 | } |
| 2379 | 2379 | |
| 2380 | 2380 | /** |
@@ -2383,8 +2383,8 @@ discard block |
||
| 2383 | 2383 | * @since 1.0.19 |
| 2384 | 2384 | * @param string $value first name. |
| 2385 | 2385 | */ |
| 2386 | - public function set_first_name( $value ) { |
|
| 2387 | - $this->set_prop( 'first_name', $value ); |
|
| 2386 | + public function set_first_name($value) { |
|
| 2387 | + $this->set_prop('first_name', $value); |
|
| 2388 | 2388 | } |
| 2389 | 2389 | |
| 2390 | 2390 | /** |
@@ -2393,8 +2393,8 @@ discard block |
||
| 2393 | 2393 | * @since 1.0.19 |
| 2394 | 2394 | * @param string $value first name. |
| 2395 | 2395 | */ |
| 2396 | - public function set_user_first_name( $value ) { |
|
| 2397 | - $this->set_first_name( $value ); |
|
| 2396 | + public function set_user_first_name($value) { |
|
| 2397 | + $this->set_first_name($value); |
|
| 2398 | 2398 | } |
| 2399 | 2399 | |
| 2400 | 2400 | /** |
@@ -2403,8 +2403,8 @@ discard block |
||
| 2403 | 2403 | * @since 1.0.19 |
| 2404 | 2404 | * @param string $value first name. |
| 2405 | 2405 | */ |
| 2406 | - public function set_customer_first_name( $value ) { |
|
| 2407 | - $this->set_first_name( $value ); |
|
| 2406 | + public function set_customer_first_name($value) { |
|
| 2407 | + $this->set_first_name($value); |
|
| 2408 | 2408 | } |
| 2409 | 2409 | |
| 2410 | 2410 | /** |
@@ -2413,8 +2413,8 @@ discard block |
||
| 2413 | 2413 | * @since 1.0.19 |
| 2414 | 2414 | * @param string $value last name. |
| 2415 | 2415 | */ |
| 2416 | - public function set_last_name( $value ) { |
|
| 2417 | - $this->set_prop( 'last_name', $value ); |
|
| 2416 | + public function set_last_name($value) { |
|
| 2417 | + $this->set_prop('last_name', $value); |
|
| 2418 | 2418 | } |
| 2419 | 2419 | |
| 2420 | 2420 | /** |
@@ -2423,8 +2423,8 @@ discard block |
||
| 2423 | 2423 | * @since 1.0.19 |
| 2424 | 2424 | * @param string $value last name. |
| 2425 | 2425 | */ |
| 2426 | - public function set_user_last_name( $value ) { |
|
| 2427 | - $this->set_last_name( $value ); |
|
| 2426 | + public function set_user_last_name($value) { |
|
| 2427 | + $this->set_last_name($value); |
|
| 2428 | 2428 | } |
| 2429 | 2429 | |
| 2430 | 2430 | /** |
@@ -2433,8 +2433,8 @@ discard block |
||
| 2433 | 2433 | * @since 1.0.19 |
| 2434 | 2434 | * @param string $value last name. |
| 2435 | 2435 | */ |
| 2436 | - public function set_customer_last_name( $value ) { |
|
| 2437 | - $this->set_last_name( $value ); |
|
| 2436 | + public function set_customer_last_name($value) { |
|
| 2437 | + $this->set_last_name($value); |
|
| 2438 | 2438 | } |
| 2439 | 2439 | |
| 2440 | 2440 | /** |
@@ -2443,8 +2443,8 @@ discard block |
||
| 2443 | 2443 | * @since 1.0.19 |
| 2444 | 2444 | * @param string $value phone. |
| 2445 | 2445 | */ |
| 2446 | - public function set_phone( $value ) { |
|
| 2447 | - $this->set_prop( 'phone', $value ); |
|
| 2446 | + public function set_phone($value) { |
|
| 2447 | + $this->set_prop('phone', $value); |
|
| 2448 | 2448 | } |
| 2449 | 2449 | |
| 2450 | 2450 | /** |
@@ -2453,8 +2453,8 @@ discard block |
||
| 2453 | 2453 | * @since 1.0.19 |
| 2454 | 2454 | * @param string $value phone. |
| 2455 | 2455 | */ |
| 2456 | - public function set_user_phone( $value ) { |
|
| 2457 | - $this->set_phone( $value ); |
|
| 2456 | + public function set_user_phone($value) { |
|
| 2457 | + $this->set_phone($value); |
|
| 2458 | 2458 | } |
| 2459 | 2459 | |
| 2460 | 2460 | /** |
@@ -2463,8 +2463,8 @@ discard block |
||
| 2463 | 2463 | * @since 1.0.19 |
| 2464 | 2464 | * @param string $value phone. |
| 2465 | 2465 | */ |
| 2466 | - public function set_customer_phone( $value ) { |
|
| 2467 | - $this->set_phone( $value ); |
|
| 2466 | + public function set_customer_phone($value) { |
|
| 2467 | + $this->set_phone($value); |
|
| 2468 | 2468 | } |
| 2469 | 2469 | |
| 2470 | 2470 | /** |
@@ -2473,8 +2473,8 @@ discard block |
||
| 2473 | 2473 | * @since 1.0.19 |
| 2474 | 2474 | * @param string $value phone. |
| 2475 | 2475 | */ |
| 2476 | - public function set_phone_number( $value ) { |
|
| 2477 | - $this->set_phone( $value ); |
|
| 2476 | + public function set_phone_number($value) { |
|
| 2477 | + $this->set_phone($value); |
|
| 2478 | 2478 | } |
| 2479 | 2479 | |
| 2480 | 2480 | /** |
@@ -2483,8 +2483,8 @@ discard block |
||
| 2483 | 2483 | * @since 1.0.19 |
| 2484 | 2484 | * @param string $value email address. |
| 2485 | 2485 | */ |
| 2486 | - public function set_email( $value ) { |
|
| 2487 | - $this->set_prop( 'email', $value ); |
|
| 2486 | + public function set_email($value) { |
|
| 2487 | + $this->set_prop('email', $value); |
|
| 2488 | 2488 | } |
| 2489 | 2489 | |
| 2490 | 2490 | /** |
@@ -2493,8 +2493,8 @@ discard block |
||
| 2493 | 2493 | * @since 1.0.19 |
| 2494 | 2494 | * @param string $value email address. |
| 2495 | 2495 | */ |
| 2496 | - public function set_user_email( $value ) { |
|
| 2497 | - $this->set_email( $value ); |
|
| 2496 | + public function set_user_email($value) { |
|
| 2497 | + $this->set_email($value); |
|
| 2498 | 2498 | } |
| 2499 | 2499 | |
| 2500 | 2500 | /** |
@@ -2503,8 +2503,8 @@ discard block |
||
| 2503 | 2503 | * @since 1.0.19 |
| 2504 | 2504 | * @param string $value email address. |
| 2505 | 2505 | */ |
| 2506 | - public function set_email_address( $value ) { |
|
| 2507 | - $this->set_email( $value ); |
|
| 2506 | + public function set_email_address($value) { |
|
| 2507 | + $this->set_email($value); |
|
| 2508 | 2508 | } |
| 2509 | 2509 | |
| 2510 | 2510 | /** |
@@ -2513,8 +2513,8 @@ discard block |
||
| 2513 | 2513 | * @since 1.0.19 |
| 2514 | 2514 | * @param string $value email address. |
| 2515 | 2515 | */ |
| 2516 | - public function set_customer_email( $value ) { |
|
| 2517 | - $this->set_email( $value ); |
|
| 2516 | + public function set_customer_email($value) { |
|
| 2517 | + $this->set_email($value); |
|
| 2518 | 2518 | } |
| 2519 | 2519 | |
| 2520 | 2520 | /** |
@@ -2523,8 +2523,8 @@ discard block |
||
| 2523 | 2523 | * @since 1.0.19 |
| 2524 | 2524 | * @param string $value country. |
| 2525 | 2525 | */ |
| 2526 | - public function set_country( $value ) { |
|
| 2527 | - $this->set_prop( 'country', $value ); |
|
| 2526 | + public function set_country($value) { |
|
| 2527 | + $this->set_prop('country', $value); |
|
| 2528 | 2528 | } |
| 2529 | 2529 | |
| 2530 | 2530 | /** |
@@ -2533,8 +2533,8 @@ discard block |
||
| 2533 | 2533 | * @since 1.0.19 |
| 2534 | 2534 | * @param string $value country. |
| 2535 | 2535 | */ |
| 2536 | - public function set_user_country( $value ) { |
|
| 2537 | - $this->set_country( $value ); |
|
| 2536 | + public function set_user_country($value) { |
|
| 2537 | + $this->set_country($value); |
|
| 2538 | 2538 | } |
| 2539 | 2539 | |
| 2540 | 2540 | /** |
@@ -2543,8 +2543,8 @@ discard block |
||
| 2543 | 2543 | * @since 1.0.19 |
| 2544 | 2544 | * @param string $value country. |
| 2545 | 2545 | */ |
| 2546 | - public function set_customer_country( $value ) { |
|
| 2547 | - $this->set_country( $value ); |
|
| 2546 | + public function set_customer_country($value) { |
|
| 2547 | + $this->set_country($value); |
|
| 2548 | 2548 | } |
| 2549 | 2549 | |
| 2550 | 2550 | /** |
@@ -2553,8 +2553,8 @@ discard block |
||
| 2553 | 2553 | * @since 1.0.19 |
| 2554 | 2554 | * @param string $value state. |
| 2555 | 2555 | */ |
| 2556 | - public function set_state( $value ) { |
|
| 2557 | - $this->set_prop( 'state', $value ); |
|
| 2556 | + public function set_state($value) { |
|
| 2557 | + $this->set_prop('state', $value); |
|
| 2558 | 2558 | } |
| 2559 | 2559 | |
| 2560 | 2560 | /** |
@@ -2563,8 +2563,8 @@ discard block |
||
| 2563 | 2563 | * @since 1.0.19 |
| 2564 | 2564 | * @param string $value state. |
| 2565 | 2565 | */ |
| 2566 | - public function set_user_state( $value ) { |
|
| 2567 | - $this->set_state( $value ); |
|
| 2566 | + public function set_user_state($value) { |
|
| 2567 | + $this->set_state($value); |
|
| 2568 | 2568 | } |
| 2569 | 2569 | |
| 2570 | 2570 | /** |
@@ -2573,8 +2573,8 @@ discard block |
||
| 2573 | 2573 | * @since 1.0.19 |
| 2574 | 2574 | * @param string $value state. |
| 2575 | 2575 | */ |
| 2576 | - public function set_customer_state( $value ) { |
|
| 2577 | - $this->set_state( $value ); |
|
| 2576 | + public function set_customer_state($value) { |
|
| 2577 | + $this->set_state($value); |
|
| 2578 | 2578 | } |
| 2579 | 2579 | |
| 2580 | 2580 | /** |
@@ -2583,8 +2583,8 @@ discard block |
||
| 2583 | 2583 | * @since 1.0.19 |
| 2584 | 2584 | * @param string $value city. |
| 2585 | 2585 | */ |
| 2586 | - public function set_city( $value ) { |
|
| 2587 | - $this->set_prop( 'city', $value ); |
|
| 2586 | + public function set_city($value) { |
|
| 2587 | + $this->set_prop('city', $value); |
|
| 2588 | 2588 | } |
| 2589 | 2589 | |
| 2590 | 2590 | /** |
@@ -2593,8 +2593,8 @@ discard block |
||
| 2593 | 2593 | * @since 1.0.19 |
| 2594 | 2594 | * @param string $value city. |
| 2595 | 2595 | */ |
| 2596 | - public function set_user_city( $value ) { |
|
| 2597 | - $this->set_city( $value ); |
|
| 2596 | + public function set_user_city($value) { |
|
| 2597 | + $this->set_city($value); |
|
| 2598 | 2598 | } |
| 2599 | 2599 | |
| 2600 | 2600 | /** |
@@ -2603,8 +2603,8 @@ discard block |
||
| 2603 | 2603 | * @since 1.0.19 |
| 2604 | 2604 | * @param string $value city. |
| 2605 | 2605 | */ |
| 2606 | - public function set_customer_city( $value ) { |
|
| 2607 | - $this->set_city( $value ); |
|
| 2606 | + public function set_customer_city($value) { |
|
| 2607 | + $this->set_city($value); |
|
| 2608 | 2608 | } |
| 2609 | 2609 | |
| 2610 | 2610 | /** |
@@ -2613,8 +2613,8 @@ discard block |
||
| 2613 | 2613 | * @since 1.0.19 |
| 2614 | 2614 | * @param string $value zip. |
| 2615 | 2615 | */ |
| 2616 | - public function set_zip( $value ) { |
|
| 2617 | - $this->set_prop( 'zip', $value ); |
|
| 2616 | + public function set_zip($value) { |
|
| 2617 | + $this->set_prop('zip', $value); |
|
| 2618 | 2618 | } |
| 2619 | 2619 | |
| 2620 | 2620 | /** |
@@ -2623,8 +2623,8 @@ discard block |
||
| 2623 | 2623 | * @since 1.0.19 |
| 2624 | 2624 | * @param string $value zip. |
| 2625 | 2625 | */ |
| 2626 | - public function set_user_zip( $value ) { |
|
| 2627 | - $this->set_zip( $value ); |
|
| 2626 | + public function set_user_zip($value) { |
|
| 2627 | + $this->set_zip($value); |
|
| 2628 | 2628 | } |
| 2629 | 2629 | |
| 2630 | 2630 | /** |
@@ -2633,8 +2633,8 @@ discard block |
||
| 2633 | 2633 | * @since 1.0.19 |
| 2634 | 2634 | * @param string $value zip. |
| 2635 | 2635 | */ |
| 2636 | - public function set_customer_zip( $value ) { |
|
| 2637 | - $this->set_zip( $value ); |
|
| 2636 | + public function set_customer_zip($value) { |
|
| 2637 | + $this->set_zip($value); |
|
| 2638 | 2638 | } |
| 2639 | 2639 | |
| 2640 | 2640 | /** |
@@ -2643,8 +2643,8 @@ discard block |
||
| 2643 | 2643 | * @since 1.0.19 |
| 2644 | 2644 | * @param string $value company. |
| 2645 | 2645 | */ |
| 2646 | - public function set_company( $value ) { |
|
| 2647 | - $this->set_prop( 'company', $value ); |
|
| 2646 | + public function set_company($value) { |
|
| 2647 | + $this->set_prop('company', $value); |
|
| 2648 | 2648 | } |
| 2649 | 2649 | |
| 2650 | 2650 | /** |
@@ -2653,8 +2653,8 @@ discard block |
||
| 2653 | 2653 | * @since 1.0.19 |
| 2654 | 2654 | * @param string $value company. |
| 2655 | 2655 | */ |
| 2656 | - public function set_user_company( $value ) { |
|
| 2657 | - $this->set_company( $value ); |
|
| 2656 | + public function set_user_company($value) { |
|
| 2657 | + $this->set_company($value); |
|
| 2658 | 2658 | } |
| 2659 | 2659 | |
| 2660 | 2660 | /** |
@@ -2663,8 +2663,8 @@ discard block |
||
| 2663 | 2663 | * @since 1.0.19 |
| 2664 | 2664 | * @param string $value company. |
| 2665 | 2665 | */ |
| 2666 | - public function set_customer_company( $value ) { |
|
| 2667 | - $this->set_company( $value ); |
|
| 2666 | + public function set_customer_company($value) { |
|
| 2667 | + $this->set_company($value); |
|
| 2668 | 2668 | } |
| 2669 | 2669 | |
| 2670 | 2670 | /** |
@@ -2673,8 +2673,8 @@ discard block |
||
| 2673 | 2673 | * @since 1.0.19 |
| 2674 | 2674 | * @param string $value company id. |
| 2675 | 2675 | */ |
| 2676 | - public function set_company_id( $value ) { |
|
| 2677 | - $this->set_prop( 'company_id', $value ); |
|
| 2676 | + public function set_company_id($value) { |
|
| 2677 | + $this->set_prop('company_id', $value); |
|
| 2678 | 2678 | } |
| 2679 | 2679 | |
| 2680 | 2680 | /** |
@@ -2683,8 +2683,8 @@ discard block |
||
| 2683 | 2683 | * @since 1.0.19 |
| 2684 | 2684 | * @param string $value var number. |
| 2685 | 2685 | */ |
| 2686 | - public function set_vat_number( $value ) { |
|
| 2687 | - $this->set_prop( 'vat_number', $value ); |
|
| 2686 | + public function set_vat_number($value) { |
|
| 2687 | + $this->set_prop('vat_number', $value); |
|
| 2688 | 2688 | } |
| 2689 | 2689 | |
| 2690 | 2690 | /** |
@@ -2693,8 +2693,8 @@ discard block |
||
| 2693 | 2693 | * @since 1.0.19 |
| 2694 | 2694 | * @param string $value var number. |
| 2695 | 2695 | */ |
| 2696 | - public function set_user_vat_number( $value ) { |
|
| 2697 | - $this->set_vat_number( $value ); |
|
| 2696 | + public function set_user_vat_number($value) { |
|
| 2697 | + $this->set_vat_number($value); |
|
| 2698 | 2698 | } |
| 2699 | 2699 | |
| 2700 | 2700 | /** |
@@ -2703,8 +2703,8 @@ discard block |
||
| 2703 | 2703 | * @since 1.0.19 |
| 2704 | 2704 | * @param string $value var number. |
| 2705 | 2705 | */ |
| 2706 | - public function set_customer_vat_number( $value ) { |
|
| 2707 | - $this->set_vat_number( $value ); |
|
| 2706 | + public function set_customer_vat_number($value) { |
|
| 2707 | + $this->set_vat_number($value); |
|
| 2708 | 2708 | } |
| 2709 | 2709 | |
| 2710 | 2710 | /** |
@@ -2713,8 +2713,8 @@ discard block |
||
| 2713 | 2713 | * @since 1.0.19 |
| 2714 | 2714 | * @param string $value var rate. |
| 2715 | 2715 | */ |
| 2716 | - public function set_vat_rate( $value ) { |
|
| 2717 | - $this->set_prop( 'vat_rate', $value ); |
|
| 2716 | + public function set_vat_rate($value) { |
|
| 2717 | + $this->set_prop('vat_rate', $value); |
|
| 2718 | 2718 | } |
| 2719 | 2719 | |
| 2720 | 2720 | /** |
@@ -2723,8 +2723,8 @@ discard block |
||
| 2723 | 2723 | * @since 1.0.19 |
| 2724 | 2724 | * @param string $value var number. |
| 2725 | 2725 | */ |
| 2726 | - public function set_user_vat_rate( $value ) { |
|
| 2727 | - $this->set_vat_rate( $value ); |
|
| 2726 | + public function set_user_vat_rate($value) { |
|
| 2727 | + $this->set_vat_rate($value); |
|
| 2728 | 2728 | } |
| 2729 | 2729 | |
| 2730 | 2730 | /** |
@@ -2733,8 +2733,8 @@ discard block |
||
| 2733 | 2733 | * @since 1.0.19 |
| 2734 | 2734 | * @param string $value var number. |
| 2735 | 2735 | */ |
| 2736 | - public function set_customer_vat_rate( $value ) { |
|
| 2737 | - $this->set_vat_rate( $value ); |
|
| 2736 | + public function set_customer_vat_rate($value) { |
|
| 2737 | + $this->set_vat_rate($value); |
|
| 2738 | 2738 | } |
| 2739 | 2739 | |
| 2740 | 2740 | /** |
@@ -2743,8 +2743,8 @@ discard block |
||
| 2743 | 2743 | * @since 1.0.19 |
| 2744 | 2744 | * @param string $value address. |
| 2745 | 2745 | */ |
| 2746 | - public function set_address( $value ) { |
|
| 2747 | - $this->set_prop( 'address', $value ); |
|
| 2746 | + public function set_address($value) { |
|
| 2747 | + $this->set_prop('address', $value); |
|
| 2748 | 2748 | } |
| 2749 | 2749 | |
| 2750 | 2750 | /** |
@@ -2753,8 +2753,8 @@ discard block |
||
| 2753 | 2753 | * @since 1.0.19 |
| 2754 | 2754 | * @param string $value address. |
| 2755 | 2755 | */ |
| 2756 | - public function set_user_address( $value ) { |
|
| 2757 | - $this->set_address( $value ); |
|
| 2756 | + public function set_user_address($value) { |
|
| 2757 | + $this->set_address($value); |
|
| 2758 | 2758 | } |
| 2759 | 2759 | |
| 2760 | 2760 | /** |
@@ -2763,8 +2763,8 @@ discard block |
||
| 2763 | 2763 | * @since 1.0.19 |
| 2764 | 2764 | * @param string $value address. |
| 2765 | 2765 | */ |
| 2766 | - public function set_customer_address( $value ) { |
|
| 2767 | - $this->set_address( $value ); |
|
| 2766 | + public function set_customer_address($value) { |
|
| 2767 | + $this->set_address($value); |
|
| 2768 | 2768 | } |
| 2769 | 2769 | |
| 2770 | 2770 | /** |
@@ -2773,8 +2773,8 @@ discard block |
||
| 2773 | 2773 | * @since 1.0.19 |
| 2774 | 2774 | * @param int|bool $value confirmed. |
| 2775 | 2775 | */ |
| 2776 | - public function set_is_viewed( $value ) { |
|
| 2777 | - $this->set_prop( 'is_viewed', $value ); |
|
| 2776 | + public function set_is_viewed($value) { |
|
| 2777 | + $this->set_prop('is_viewed', $value); |
|
| 2778 | 2778 | } |
| 2779 | 2779 | |
| 2780 | 2780 | /** |
@@ -2783,8 +2783,8 @@ discard block |
||
| 2783 | 2783 | * @since 1.0.19 |
| 2784 | 2784 | * @param string $value email recipients. |
| 2785 | 2785 | */ |
| 2786 | - public function set_email_cc( $value ) { |
|
| 2787 | - $this->set_prop( 'email_cc', $value ); |
|
| 2786 | + public function set_email_cc($value) { |
|
| 2787 | + $this->set_prop('email_cc', $value); |
|
| 2788 | 2788 | } |
| 2789 | 2789 | |
| 2790 | 2790 | /** |
@@ -2793,9 +2793,9 @@ discard block |
||
| 2793 | 2793 | * @since 1.0.19 |
| 2794 | 2794 | * @param string $value template. |
| 2795 | 2795 | */ |
| 2796 | - public function set_template( $value ) { |
|
| 2797 | - if ( in_array( $value, array( 'quantity', 'hours', 'amount' ) ) ) { |
|
| 2798 | - $this->set_prop( 'template', $value ); |
|
| 2796 | + public function set_template($value) { |
|
| 2797 | + if (in_array($value, array('quantity', 'hours', 'amount'))) { |
|
| 2798 | + $this->set_prop('template', $value); |
|
| 2799 | 2799 | } |
| 2800 | 2800 | } |
| 2801 | 2801 | |
@@ -2806,8 +2806,8 @@ discard block |
||
| 2806 | 2806 | * @param string $value source. |
| 2807 | 2807 | * @deprecated |
| 2808 | 2808 | */ |
| 2809 | - public function created_via( $value ) { |
|
| 2810 | - $this->set_created_via( sanitize_text_field( $value ) ); |
|
| 2809 | + public function created_via($value) { |
|
| 2810 | + $this->set_created_via(sanitize_text_field($value)); |
|
| 2811 | 2811 | } |
| 2812 | 2812 | |
| 2813 | 2813 | /** |
@@ -2816,8 +2816,8 @@ discard block |
||
| 2816 | 2816 | * @since 1.0.19 |
| 2817 | 2817 | * @param string $value source. |
| 2818 | 2818 | */ |
| 2819 | - public function set_created_via( $value ) { |
|
| 2820 | - $this->set_prop( 'created_via', sanitize_text_field( $value ) ); |
|
| 2819 | + public function set_created_via($value) { |
|
| 2820 | + $this->set_prop('created_via', sanitize_text_field($value)); |
|
| 2821 | 2821 | } |
| 2822 | 2822 | |
| 2823 | 2823 | /** |
@@ -2826,8 +2826,8 @@ discard block |
||
| 2826 | 2826 | * @since 1.0.19 |
| 2827 | 2827 | * @param int|bool $value confirmed. |
| 2828 | 2828 | */ |
| 2829 | - public function set_address_confirmed( $value ) { |
|
| 2830 | - $this->set_prop( 'address_confirmed', $value ); |
|
| 2829 | + public function set_address_confirmed($value) { |
|
| 2830 | + $this->set_prop('address_confirmed', $value); |
|
| 2831 | 2831 | } |
| 2832 | 2832 | |
| 2833 | 2833 | /** |
@@ -2836,8 +2836,8 @@ discard block |
||
| 2836 | 2836 | * @since 1.0.19 |
| 2837 | 2837 | * @param int|bool $value confirmed. |
| 2838 | 2838 | */ |
| 2839 | - public function set_user_address_confirmed( $value ) { |
|
| 2840 | - $this->set_address_confirmed( $value ); |
|
| 2839 | + public function set_user_address_confirmed($value) { |
|
| 2840 | + $this->set_address_confirmed($value); |
|
| 2841 | 2841 | } |
| 2842 | 2842 | |
| 2843 | 2843 | /** |
@@ -2846,8 +2846,8 @@ discard block |
||
| 2846 | 2846 | * @since 1.0.19 |
| 2847 | 2847 | * @param int|bool $value confirmed. |
| 2848 | 2848 | */ |
| 2849 | - public function set_customer_address_confirmed( $value ) { |
|
| 2850 | - $this->set_address_confirmed( $value ); |
|
| 2849 | + public function set_customer_address_confirmed($value) { |
|
| 2850 | + $this->set_address_confirmed($value); |
|
| 2851 | 2851 | } |
| 2852 | 2852 | |
| 2853 | 2853 | /** |
@@ -2856,13 +2856,13 @@ discard block |
||
| 2856 | 2856 | * @since 1.0.19 |
| 2857 | 2857 | * @param float $value shipping amount. |
| 2858 | 2858 | */ |
| 2859 | - public function set_shipping( $value ) { |
|
| 2859 | + public function set_shipping($value) { |
|
| 2860 | 2860 | |
| 2861 | - if ( ! is_numeric( $value ) ) { |
|
| 2862 | - return $this->set_prop( 'shipping', null ); |
|
| 2861 | + if (!is_numeric($value)) { |
|
| 2862 | + return $this->set_prop('shipping', null); |
|
| 2863 | 2863 | } |
| 2864 | 2864 | |
| 2865 | - $this->set_prop( 'shipping', max( 0, floatval( $value ) ) ); |
|
| 2865 | + $this->set_prop('shipping', max(0, floatval($value))); |
|
| 2866 | 2866 | } |
| 2867 | 2867 | |
| 2868 | 2868 | /** |
@@ -2871,8 +2871,8 @@ discard block |
||
| 2871 | 2871 | * @since 1.0.19 |
| 2872 | 2872 | * @param float $value sub total. |
| 2873 | 2873 | */ |
| 2874 | - public function set_subtotal( $value ) { |
|
| 2875 | - $this->set_prop( 'subtotal', max( 0, $value ) ); |
|
| 2874 | + public function set_subtotal($value) { |
|
| 2875 | + $this->set_prop('subtotal', max(0, $value)); |
|
| 2876 | 2876 | } |
| 2877 | 2877 | |
| 2878 | 2878 | /** |
@@ -2881,8 +2881,8 @@ discard block |
||
| 2881 | 2881 | * @since 1.0.19 |
| 2882 | 2882 | * @param float $value sub total. |
| 2883 | 2883 | */ |
| 2884 | - public function set_total( $value ) { |
|
| 2885 | - $this->set_prop( 'total', max( 0, $value ) ); |
|
| 2884 | + public function set_total($value) { |
|
| 2885 | + $this->set_prop('total', max(0, $value)); |
|
| 2886 | 2886 | } |
| 2887 | 2887 | |
| 2888 | 2888 | /** |
@@ -2891,8 +2891,8 @@ discard block |
||
| 2891 | 2891 | * @since 1.0.19 |
| 2892 | 2892 | * @param float $value discount total. |
| 2893 | 2893 | */ |
| 2894 | - public function set_total_discount( $value ) { |
|
| 2895 | - $this->set_prop( 'total_discount', max( 0, $value ) ); |
|
| 2894 | + public function set_total_discount($value) { |
|
| 2895 | + $this->set_prop('total_discount', max(0, $value)); |
|
| 2896 | 2896 | } |
| 2897 | 2897 | |
| 2898 | 2898 | /** |
@@ -2901,8 +2901,8 @@ discard block |
||
| 2901 | 2901 | * @since 1.0.19 |
| 2902 | 2902 | * @param float $value discount total. |
| 2903 | 2903 | */ |
| 2904 | - public function set_discount( $value ) { |
|
| 2905 | - $this->set_total_discount( $value ); |
|
| 2904 | + public function set_discount($value) { |
|
| 2905 | + $this->set_total_discount($value); |
|
| 2906 | 2906 | } |
| 2907 | 2907 | |
| 2908 | 2908 | /** |
@@ -2911,8 +2911,8 @@ discard block |
||
| 2911 | 2911 | * @since 1.0.19 |
| 2912 | 2912 | * @param float $value tax total. |
| 2913 | 2913 | */ |
| 2914 | - public function set_total_tax( $value ) { |
|
| 2915 | - $this->set_prop( 'total_tax', max( 0, $value ) ); |
|
| 2914 | + public function set_total_tax($value) { |
|
| 2915 | + $this->set_prop('total_tax', max(0, $value)); |
|
| 2916 | 2916 | } |
| 2917 | 2917 | |
| 2918 | 2918 | /** |
@@ -2921,8 +2921,8 @@ discard block |
||
| 2921 | 2921 | * @since 1.0.19 |
| 2922 | 2922 | * @param float $value tax total. |
| 2923 | 2923 | */ |
| 2924 | - public function set_tax_total( $value ) { |
|
| 2925 | - $this->set_total_tax( $value ); |
|
| 2924 | + public function set_tax_total($value) { |
|
| 2925 | + $this->set_total_tax($value); |
|
| 2926 | 2926 | } |
| 2927 | 2927 | |
| 2928 | 2928 | /** |
@@ -2931,8 +2931,8 @@ discard block |
||
| 2931 | 2931 | * @since 1.0.19 |
| 2932 | 2932 | * @param float $value fees total. |
| 2933 | 2933 | */ |
| 2934 | - public function set_total_fees( $value ) { |
|
| 2935 | - $this->set_prop( 'total_fees', max( 0, $value ) ); |
|
| 2934 | + public function set_total_fees($value) { |
|
| 2935 | + $this->set_prop('total_fees', max(0, $value)); |
|
| 2936 | 2936 | } |
| 2937 | 2937 | |
| 2938 | 2938 | /** |
@@ -2941,8 +2941,8 @@ discard block |
||
| 2941 | 2941 | * @since 1.0.19 |
| 2942 | 2942 | * @param float $value fees total. |
| 2943 | 2943 | */ |
| 2944 | - public function set_fees_total( $value ) { |
|
| 2945 | - $this->set_total_fees( $value ); |
|
| 2944 | + public function set_fees_total($value) { |
|
| 2945 | + $this->set_total_fees($value); |
|
| 2946 | 2946 | } |
| 2947 | 2947 | |
| 2948 | 2948 | /** |
@@ -2951,13 +2951,13 @@ discard block |
||
| 2951 | 2951 | * @since 1.0.19 |
| 2952 | 2952 | * @param array $value fees. |
| 2953 | 2953 | */ |
| 2954 | - public function set_fees( $value ) { |
|
| 2954 | + public function set_fees($value) { |
|
| 2955 | 2955 | |
| 2956 | - if ( ! is_array( $value ) ) { |
|
| 2956 | + if (!is_array($value)) { |
|
| 2957 | 2957 | $value = array(); |
| 2958 | 2958 | } |
| 2959 | 2959 | |
| 2960 | - $this->set_prop( 'fees', $value ); |
|
| 2960 | + $this->set_prop('fees', $value); |
|
| 2961 | 2961 | |
| 2962 | 2962 | } |
| 2963 | 2963 | |
@@ -2967,13 +2967,13 @@ discard block |
||
| 2967 | 2967 | * @since 1.0.19 |
| 2968 | 2968 | * @param array $value taxes. |
| 2969 | 2969 | */ |
| 2970 | - public function set_taxes( $value ) { |
|
| 2970 | + public function set_taxes($value) { |
|
| 2971 | 2971 | |
| 2972 | - if ( ! is_array( $value ) ) { |
|
| 2972 | + if (!is_array($value)) { |
|
| 2973 | 2973 | $value = array(); |
| 2974 | 2974 | } |
| 2975 | 2975 | |
| 2976 | - $this->set_prop( 'taxes', $value ); |
|
| 2976 | + $this->set_prop('taxes', $value); |
|
| 2977 | 2977 | |
| 2978 | 2978 | } |
| 2979 | 2979 | |
@@ -2983,13 +2983,13 @@ discard block |
||
| 2983 | 2983 | * @since 1.0.19 |
| 2984 | 2984 | * @param array $value discounts. |
| 2985 | 2985 | */ |
| 2986 | - public function set_discounts( $value ) { |
|
| 2986 | + public function set_discounts($value) { |
|
| 2987 | 2987 | |
| 2988 | - if ( ! is_array( $value ) ) { |
|
| 2988 | + if (!is_array($value)) { |
|
| 2989 | 2989 | $value = array(); |
| 2990 | 2990 | } |
| 2991 | 2991 | |
| 2992 | - $this->set_prop( 'discounts', $value ); |
|
| 2992 | + $this->set_prop('discounts', $value); |
|
| 2993 | 2993 | } |
| 2994 | 2994 | |
| 2995 | 2995 | /** |
@@ -2998,19 +2998,19 @@ discard block |
||
| 2998 | 2998 | * @since 1.0.19 |
| 2999 | 2999 | * @param GetPaid_Form_Item[] $value items. |
| 3000 | 3000 | */ |
| 3001 | - public function set_items( $value ) { |
|
| 3001 | + public function set_items($value) { |
|
| 3002 | 3002 | |
| 3003 | 3003 | // Remove existing items. |
| 3004 | - $this->set_prop( 'items', array() ); |
|
| 3004 | + $this->set_prop('items', array()); |
|
| 3005 | 3005 | $this->recurring_item = null; |
| 3006 | 3006 | |
| 3007 | 3007 | // Ensure that we have an array. |
| 3008 | - if ( ! is_array( $value ) ) { |
|
| 3008 | + if (!is_array($value)) { |
|
| 3009 | 3009 | return; |
| 3010 | 3010 | } |
| 3011 | 3011 | |
| 3012 | - foreach ( $value as $item ) { |
|
| 3013 | - $this->add_item( $item ); |
|
| 3012 | + foreach ($value as $item) { |
|
| 3013 | + $this->add_item($item); |
|
| 3014 | 3014 | } |
| 3015 | 3015 | |
| 3016 | 3016 | } |
@@ -3021,8 +3021,8 @@ discard block |
||
| 3021 | 3021 | * @since 1.0.19 |
| 3022 | 3022 | * @param int $value payment form. |
| 3023 | 3023 | */ |
| 3024 | - public function set_payment_form( $value ) { |
|
| 3025 | - $this->set_prop( 'payment_form', $value ); |
|
| 3024 | + public function set_payment_form($value) { |
|
| 3025 | + $this->set_prop('payment_form', $value); |
|
| 3026 | 3026 | } |
| 3027 | 3027 | |
| 3028 | 3028 | /** |
@@ -3031,8 +3031,8 @@ discard block |
||
| 3031 | 3031 | * @since 1.0.19 |
| 3032 | 3032 | * @param string $value submission id. |
| 3033 | 3033 | */ |
| 3034 | - public function set_submission_id( $value ) { |
|
| 3035 | - $this->set_prop( 'submission_id', $value ); |
|
| 3034 | + public function set_submission_id($value) { |
|
| 3035 | + $this->set_prop('submission_id', $value); |
|
| 3036 | 3036 | } |
| 3037 | 3037 | |
| 3038 | 3038 | /** |
@@ -3041,8 +3041,8 @@ discard block |
||
| 3041 | 3041 | * @since 1.0.19 |
| 3042 | 3042 | * @param string $value discount code. |
| 3043 | 3043 | */ |
| 3044 | - public function set_discount_code( $value ) { |
|
| 3045 | - $this->set_prop( 'discount_code', sanitize_text_field( $value ) ); |
|
| 3044 | + public function set_discount_code($value) { |
|
| 3045 | + $this->set_prop('discount_code', sanitize_text_field($value)); |
|
| 3046 | 3046 | } |
| 3047 | 3047 | |
| 3048 | 3048 | /** |
@@ -3051,8 +3051,8 @@ discard block |
||
| 3051 | 3051 | * @since 1.0.19 |
| 3052 | 3052 | * @param string $value gateway. |
| 3053 | 3053 | */ |
| 3054 | - public function set_gateway( $value ) { |
|
| 3055 | - $this->set_prop( 'gateway', $value ); |
|
| 3054 | + public function set_gateway($value) { |
|
| 3055 | + $this->set_prop('gateway', $value); |
|
| 3056 | 3056 | } |
| 3057 | 3057 | |
| 3058 | 3058 | /** |
@@ -3061,9 +3061,9 @@ discard block |
||
| 3061 | 3061 | * @since 1.0.19 |
| 3062 | 3062 | * @param string $value transaction id. |
| 3063 | 3063 | */ |
| 3064 | - public function set_transaction_id( $value ) { |
|
| 3065 | - if ( ! empty( $value ) ) { |
|
| 3066 | - $this->set_prop( 'transaction_id', $value ); |
|
| 3064 | + public function set_transaction_id($value) { |
|
| 3065 | + if (!empty($value)) { |
|
| 3066 | + $this->set_prop('transaction_id', $value); |
|
| 3067 | 3067 | } |
| 3068 | 3068 | } |
| 3069 | 3069 | |
@@ -3073,8 +3073,8 @@ discard block |
||
| 3073 | 3073 | * @since 1.0.19 |
| 3074 | 3074 | * @param string $value currency id. |
| 3075 | 3075 | */ |
| 3076 | - public function set_currency( $value ) { |
|
| 3077 | - $this->set_prop( 'currency', $value ); |
|
| 3076 | + public function set_currency($value) { |
|
| 3077 | + $this->set_prop('currency', $value); |
|
| 3078 | 3078 | } |
| 3079 | 3079 | |
| 3080 | 3080 | /** |
@@ -3083,8 +3083,8 @@ discard block |
||
| 3083 | 3083 | * @since 1.0.19 |
| 3084 | 3084 | * @param bool $value value. |
| 3085 | 3085 | */ |
| 3086 | - public function set_disable_taxes( $value ) { |
|
| 3087 | - $this->set_prop( 'disable_taxes', (bool) $value ); |
|
| 3086 | + public function set_disable_taxes($value) { |
|
| 3087 | + $this->set_prop('disable_taxes', (bool) $value); |
|
| 3088 | 3088 | } |
| 3089 | 3089 | |
| 3090 | 3090 | /** |
@@ -3093,8 +3093,8 @@ discard block |
||
| 3093 | 3093 | * @since 1.0.19 |
| 3094 | 3094 | * @param string $value subscription id. |
| 3095 | 3095 | */ |
| 3096 | - public function set_subscription_id( $value ) { |
|
| 3097 | - $this->set_prop( 'subscription_id', $value ); |
|
| 3096 | + public function set_subscription_id($value) { |
|
| 3097 | + $this->set_prop('subscription_id', $value); |
|
| 3098 | 3098 | } |
| 3099 | 3099 | |
| 3100 | 3100 | /** |
@@ -3103,8 +3103,8 @@ discard block |
||
| 3103 | 3103 | * @since 1.0.19 |
| 3104 | 3104 | * @param string $value subscription id. |
| 3105 | 3105 | */ |
| 3106 | - public function set_remote_subscription_id( $value ) { |
|
| 3107 | - $this->set_prop( 'remote_subscription_id', $value ); |
|
| 3106 | + public function set_remote_subscription_id($value) { |
|
| 3107 | + $this->set_prop('remote_subscription_id', $value); |
|
| 3108 | 3108 | } |
| 3109 | 3109 | |
| 3110 | 3110 | /* |
@@ -3121,28 +3121,28 @@ discard block |
||
| 3121 | 3121 | */ |
| 3122 | 3122 | public function is_parent() { |
| 3123 | 3123 | $parent = $this->get_parent_id(); |
| 3124 | - return apply_filters( 'wpinv_invoice_is_parent', empty( $parent ), $this ); |
|
| 3124 | + return apply_filters('wpinv_invoice_is_parent', empty($parent), $this); |
|
| 3125 | 3125 | } |
| 3126 | 3126 | |
| 3127 | 3127 | /** |
| 3128 | 3128 | * Checks if this is a renewal invoice. |
| 3129 | 3129 | */ |
| 3130 | 3130 | public function is_renewal() { |
| 3131 | - return $this->is_recurring() && ! $this->is_parent(); |
|
| 3131 | + return $this->is_recurring() && !$this->is_parent(); |
|
| 3132 | 3132 | } |
| 3133 | 3133 | |
| 3134 | 3134 | /** |
| 3135 | 3135 | * Checks if this is a recurring invoice. |
| 3136 | 3136 | */ |
| 3137 | 3137 | public function is_recurring() { |
| 3138 | - return ! empty( $this->recurring_item ); |
|
| 3138 | + return !empty($this->recurring_item); |
|
| 3139 | 3139 | } |
| 3140 | 3140 | |
| 3141 | 3141 | /** |
| 3142 | 3142 | * Checks if this is a taxable invoice. |
| 3143 | 3143 | */ |
| 3144 | 3144 | public function is_taxable() { |
| 3145 | - return ! $this->get_disable_taxes(); |
|
| 3145 | + return !$this->get_disable_taxes(); |
|
| 3146 | 3146 | } |
| 3147 | 3147 | |
| 3148 | 3148 | /** |
@@ -3156,45 +3156,45 @@ discard block |
||
| 3156 | 3156 | * Checks to see if the invoice requires payment. |
| 3157 | 3157 | */ |
| 3158 | 3158 | public function is_free() { |
| 3159 | - $is_free = ( (float) wpinv_round_amount( $this->get_initial_total() ) == 0 ); |
|
| 3159 | + $is_free = ((float) wpinv_round_amount($this->get_initial_total()) == 0); |
|
| 3160 | 3160 | |
| 3161 | - if ( $this->is_recurring() && $this->get_recurring_total() > 0 ) { |
|
| 3161 | + if ($this->is_recurring() && $this->get_recurring_total() > 0) { |
|
| 3162 | 3162 | $is_free = false; |
| 3163 | 3163 | } |
| 3164 | 3164 | |
| 3165 | - return apply_filters( 'wpinv_invoice_is_free', $is_free, $this ); |
|
| 3165 | + return apply_filters('wpinv_invoice_is_free', $is_free, $this); |
|
| 3166 | 3166 | } |
| 3167 | 3167 | |
| 3168 | 3168 | /** |
| 3169 | 3169 | * Checks if the invoice is paid. |
| 3170 | 3170 | */ |
| 3171 | 3171 | public function is_paid() { |
| 3172 | - $is_paid = $this->has_status( array( 'publish', 'wpi-processing', 'wpi-renewal' ) ); |
|
| 3173 | - return apply_filters( 'wpinv_invoice_is_paid', $is_paid, $this ); |
|
| 3172 | + $is_paid = $this->has_status(array('publish', 'wpi-processing', 'wpi-renewal')); |
|
| 3173 | + return apply_filters('wpinv_invoice_is_paid', $is_paid, $this); |
|
| 3174 | 3174 | } |
| 3175 | 3175 | |
| 3176 | 3176 | /** |
| 3177 | 3177 | * Checks if the invoice needs payment. |
| 3178 | 3178 | */ |
| 3179 | 3179 | public function needs_payment() { |
| 3180 | - $needs_payment = ! $this->is_paid() && ! $this->is_refunded() && ! $this->is_free(); |
|
| 3181 | - return apply_filters( 'wpinv_needs_payment', $needs_payment, $this ); |
|
| 3180 | + $needs_payment = !$this->is_paid() && !$this->is_refunded() && !$this->is_free(); |
|
| 3181 | + return apply_filters('wpinv_needs_payment', $needs_payment, $this); |
|
| 3182 | 3182 | } |
| 3183 | 3183 | |
| 3184 | 3184 | /** |
| 3185 | 3185 | * Checks if the invoice is refunded. |
| 3186 | 3186 | */ |
| 3187 | 3187 | public function is_refunded() { |
| 3188 | - $is_refunded = $this->has_status( 'wpi-refunded' ); |
|
| 3189 | - return apply_filters( 'wpinv_invoice_is_refunded', $is_refunded, $this ); |
|
| 3188 | + $is_refunded = $this->has_status('wpi-refunded'); |
|
| 3189 | + return apply_filters('wpinv_invoice_is_refunded', $is_refunded, $this); |
|
| 3190 | 3190 | } |
| 3191 | 3191 | |
| 3192 | 3192 | /** |
| 3193 | 3193 | * Checks if the invoice is held. |
| 3194 | 3194 | */ |
| 3195 | 3195 | public function is_held() { |
| 3196 | - $is_held = $this->has_status( 'wpi-onhold' ); |
|
| 3197 | - return apply_filters( 'wpinv_invoice_is_held', $is_held, $this ); |
|
| 3196 | + $is_held = $this->has_status('wpi-onhold'); |
|
| 3197 | + return apply_filters('wpinv_invoice_is_held', $is_held, $this); |
|
| 3198 | 3198 | } |
| 3199 | 3199 | |
| 3200 | 3200 | /** |
@@ -3202,30 +3202,30 @@ discard block |
||
| 3202 | 3202 | */ |
| 3203 | 3203 | public function is_due() { |
| 3204 | 3204 | $due_date = $this->get_due_date(); |
| 3205 | - return empty( $due_date ) ? false : current_time( 'timestamp' ) > strtotime( $due_date ); |
|
| 3205 | + return empty($due_date) ? false : current_time('timestamp') > strtotime($due_date); |
|
| 3206 | 3206 | } |
| 3207 | 3207 | |
| 3208 | 3208 | /** |
| 3209 | 3209 | * Checks if the invoice is draft. |
| 3210 | 3210 | */ |
| 3211 | 3211 | public function is_draft() { |
| 3212 | - return $this->has_status( 'draft, auto-draft' ); |
|
| 3212 | + return $this->has_status('draft, auto-draft'); |
|
| 3213 | 3213 | } |
| 3214 | 3214 | |
| 3215 | 3215 | /** |
| 3216 | 3216 | * Checks if the invoice has a given status. |
| 3217 | 3217 | */ |
| 3218 | - public function has_status( $status ) { |
|
| 3219 | - $status = wpinv_parse_list( $status ); |
|
| 3220 | - return apply_filters( 'wpinv_has_status', in_array( $this->get_status(), $status ), $status ); |
|
| 3218 | + public function has_status($status) { |
|
| 3219 | + $status = wpinv_parse_list($status); |
|
| 3220 | + return apply_filters('wpinv_has_status', in_array($this->get_status(), $status), $status); |
|
| 3221 | 3221 | } |
| 3222 | 3222 | |
| 3223 | 3223 | /** |
| 3224 | 3224 | * Checks if the invoice is of a given type. |
| 3225 | 3225 | */ |
| 3226 | - public function is_type( $type ) { |
|
| 3227 | - $type = wpinv_parse_list( $type ); |
|
| 3228 | - return in_array( $this->get_type(), $type ); |
|
| 3226 | + public function is_type($type) { |
|
| 3227 | + $type = wpinv_parse_list($type); |
|
| 3228 | + return in_array($this->get_type(), $type); |
|
| 3229 | 3229 | } |
| 3230 | 3230 | |
| 3231 | 3231 | /** |
@@ -3257,8 +3257,8 @@ discard block |
||
| 3257 | 3257 | * |
| 3258 | 3258 | */ |
| 3259 | 3259 | public function is_initial_free() { |
| 3260 | - $is_initial_free = ! ( (float) wpinv_round_amount( $this->get_initial_total() ) > 0 ); |
|
| 3261 | - return apply_filters( 'wpinv_invoice_is_initial_free', $is_initial_free, $this->get_cart_details(), $this ); |
|
| 3260 | + $is_initial_free = !((float) wpinv_round_amount($this->get_initial_total()) > 0); |
|
| 3261 | + return apply_filters('wpinv_invoice_is_initial_free', $is_initial_free, $this->get_cart_details(), $this); |
|
| 3262 | 3262 | } |
| 3263 | 3263 | |
| 3264 | 3264 | /** |
@@ -3268,11 +3268,11 @@ discard block |
||
| 3268 | 3268 | public function item_has_free_trial() { |
| 3269 | 3269 | |
| 3270 | 3270 | // Ensure we have a recurring item. |
| 3271 | - if ( ! $this->is_recurring() ) { |
|
| 3271 | + if (!$this->is_recurring()) { |
|
| 3272 | 3272 | return false; |
| 3273 | 3273 | } |
| 3274 | 3274 | |
| 3275 | - $item = $this->get_recurring( true ); |
|
| 3275 | + $item = $this->get_recurring(true); |
|
| 3276 | 3276 | return $item->has_free_trial(); |
| 3277 | 3277 | } |
| 3278 | 3278 | |
@@ -3280,7 +3280,7 @@ discard block |
||
| 3280 | 3280 | * Check if the free trial is a result of a discount. |
| 3281 | 3281 | */ |
| 3282 | 3282 | public function is_free_trial_from_discount() { |
| 3283 | - return $this->has_free_trial() && ! $this->item_has_free_trial(); |
|
| 3283 | + return $this->has_free_trial() && !$this->item_has_free_trial(); |
|
| 3284 | 3284 | } |
| 3285 | 3285 | |
| 3286 | 3286 | /** |
@@ -3288,12 +3288,12 @@ discard block |
||
| 3288 | 3288 | */ |
| 3289 | 3289 | public function discount_first_payment_only() { |
| 3290 | 3290 | |
| 3291 | - $discount = wpinv_get_discount_obj( $this->get_discount_code() ); |
|
| 3292 | - if ( ! $discount->exists() || ! $this->is_recurring() ) { |
|
| 3291 | + $discount = wpinv_get_discount_obj($this->get_discount_code()); |
|
| 3292 | + if (!$discount->exists() || !$this->is_recurring()) { |
|
| 3293 | 3293 | return true; |
| 3294 | 3294 | } |
| 3295 | 3295 | |
| 3296 | - return ! $discount->get_is_recurring(); |
|
| 3296 | + return !$discount->get_is_recurring(); |
|
| 3297 | 3297 | } |
| 3298 | 3298 | |
| 3299 | 3299 | /* |
@@ -3311,23 +3311,23 @@ discard block |
||
| 3311 | 3311 | * @param GetPaid_Form_Item|array $item |
| 3312 | 3312 | * @return WP_Error|Bool |
| 3313 | 3313 | */ |
| 3314 | - public function add_item( $item ) { |
|
| 3314 | + public function add_item($item) { |
|
| 3315 | 3315 | |
| 3316 | - if ( is_array( $item ) ) { |
|
| 3317 | - $item = $this->process_array_item( $item ); |
|
| 3316 | + if (is_array($item)) { |
|
| 3317 | + $item = $this->process_array_item($item); |
|
| 3318 | 3318 | } |
| 3319 | 3319 | |
| 3320 | - if ( is_numeric( $item ) ) { |
|
| 3321 | - $item = new GetPaid_Form_Item( $item ); |
|
| 3320 | + if (is_numeric($item)) { |
|
| 3321 | + $item = new GetPaid_Form_Item($item); |
|
| 3322 | 3322 | } |
| 3323 | 3323 | |
| 3324 | 3324 | // Make sure that it is available for purchase. |
| 3325 | - if ( $item->get_id() > 0 && ! $item->can_purchase() ) { |
|
| 3326 | - return new WP_Error( 'invalid_item', __( 'This item is not available for purchase', 'invoicing' ) ); |
|
| 3325 | + if ($item->get_id() > 0 && !$item->can_purchase()) { |
|
| 3326 | + return new WP_Error('invalid_item', __('This item is not available for purchase', 'invoicing')); |
|
| 3327 | 3327 | } |
| 3328 | 3328 | |
| 3329 | 3329 | // Do we have a recurring item? |
| 3330 | - if ( $item->is_recurring() ) { |
|
| 3330 | + if ($item->is_recurring()) { |
|
| 3331 | 3331 | $this->recurring_item = $item->get_id(); |
| 3332 | 3332 | } |
| 3333 | 3333 | |
@@ -3335,9 +3335,9 @@ discard block |
||
| 3335 | 3335 | $item->invoice_id = (int) $this->get_id(); |
| 3336 | 3336 | |
| 3337 | 3337 | // Remove duplicates. |
| 3338 | - $this->remove_item( $item->get_id() ); |
|
| 3338 | + $this->remove_item($item->get_id()); |
|
| 3339 | 3339 | |
| 3340 | - if ( 0 == $item->get_quantity() ) { |
|
| 3340 | + if (0 == $item->get_quantity()) { |
|
| 3341 | 3341 | return; |
| 3342 | 3342 | } |
| 3343 | 3343 | |
@@ -3347,7 +3347,7 @@ discard block |
||
| 3347 | 3347 | // Add new item. |
| 3348 | 3348 | $items[] = $item; |
| 3349 | 3349 | |
| 3350 | - $this->set_prop( 'items', $items ); |
|
| 3350 | + $this->set_prop('items', $items); |
|
| 3351 | 3351 | |
| 3352 | 3352 | return true; |
| 3353 | 3353 | } |
@@ -3358,26 +3358,26 @@ discard block |
||
| 3358 | 3358 | * @since 1.0.19 |
| 3359 | 3359 | * @return GetPaid_Form_Item |
| 3360 | 3360 | */ |
| 3361 | - protected function process_array_item( $array ) { |
|
| 3361 | + protected function process_array_item($array) { |
|
| 3362 | 3362 | |
| 3363 | - $item_id = isset( $array['item_id'] ) ? $array['item_id'] : 0; |
|
| 3364 | - $item = new GetPaid_Form_Item( $item_id ); |
|
| 3363 | + $item_id = isset($array['item_id']) ? $array['item_id'] : 0; |
|
| 3364 | + $item = new GetPaid_Form_Item($item_id); |
|
| 3365 | 3365 | |
| 3366 | 3366 | // Set item data. |
| 3367 | - foreach ( array( 'name', 'price', 'description' ) as $key ) { |
|
| 3368 | - if ( isset( $array[ "item_$key" ] ) ) { |
|
| 3367 | + foreach (array('name', 'price', 'description') as $key) { |
|
| 3368 | + if (isset($array["item_$key"])) { |
|
| 3369 | 3369 | $method = "set_$key"; |
| 3370 | - $item->$method( $array[ "item_$key" ] ); |
|
| 3370 | + $item->$method($array["item_$key"]); |
|
| 3371 | 3371 | } |
| 3372 | 3372 | } |
| 3373 | 3373 | |
| 3374 | - if ( isset( $array['quantity'] ) ) { |
|
| 3375 | - $item->set_quantity( $array['quantity'] ); |
|
| 3374 | + if (isset($array['quantity'])) { |
|
| 3375 | + $item->set_quantity($array['quantity']); |
|
| 3376 | 3376 | } |
| 3377 | 3377 | |
| 3378 | 3378 | // Set item meta. |
| 3379 | - if ( isset( $array['meta'] ) && is_array( $array['meta'] ) ) { |
|
| 3380 | - $item->set_item_meta( $array['meta'] ); |
|
| 3379 | + if (isset($array['meta']) && is_array($array['meta'])) { |
|
| 3380 | + $item->set_item_meta($array['meta']); |
|
| 3381 | 3381 | } |
| 3382 | 3382 | |
| 3383 | 3383 | return $item; |
@@ -3390,10 +3390,10 @@ discard block |
||
| 3390 | 3390 | * @since 1.0.19 |
| 3391 | 3391 | * @return GetPaid_Form_Item|null |
| 3392 | 3392 | */ |
| 3393 | - public function get_item( $item_id ) { |
|
| 3393 | + public function get_item($item_id) { |
|
| 3394 | 3394 | |
| 3395 | - foreach ( $this->get_items() as $item ) { |
|
| 3396 | - if ( (int) $item_id == $item->get_id() ) { |
|
| 3395 | + foreach ($this->get_items() as $item) { |
|
| 3396 | + if ((int) $item_id == $item->get_id()) { |
|
| 3397 | 3397 | return $item; |
| 3398 | 3398 | } |
| 3399 | 3399 | } |
@@ -3406,16 +3406,16 @@ discard block |
||
| 3406 | 3406 | * |
| 3407 | 3407 | * @since 1.0.19 |
| 3408 | 3408 | */ |
| 3409 | - public function remove_item( $item_id ) { |
|
| 3409 | + public function remove_item($item_id) { |
|
| 3410 | 3410 | $items = $this->get_items(); |
| 3411 | 3411 | $item_id = (int) $item_id; |
| 3412 | 3412 | |
| 3413 | - foreach ( $items as $index => $item ) { |
|
| 3414 | - if ( (int) $item_id == $item->get_id() ) { |
|
| 3415 | - unset( $items[ $index ] ); |
|
| 3416 | - $this->set_prop( 'items', $items ); |
|
| 3413 | + foreach ($items as $index => $item) { |
|
| 3414 | + if ((int) $item_id == $item->get_id()) { |
|
| 3415 | + unset($items[$index]); |
|
| 3416 | + $this->set_prop('items', $items); |
|
| 3417 | 3417 | |
| 3418 | - if ( $item_id == $this->recurring_item ) { |
|
| 3418 | + if ($item_id == $this->recurring_item) { |
|
| 3419 | 3419 | $this->recurring_item = null; |
| 3420 | 3420 | } |
| 3421 | 3421 | |
@@ -3430,11 +3430,11 @@ discard block |
||
| 3430 | 3430 | * @param array $fee An array of fee details. name, initial_fee, and recurring_fee are required. |
| 3431 | 3431 | * @since 1.0.19 |
| 3432 | 3432 | */ |
| 3433 | - public function add_fee( $fee ) { |
|
| 3433 | + public function add_fee($fee) { |
|
| 3434 | 3434 | |
| 3435 | 3435 | $fees = $this->get_fees(); |
| 3436 | - $fees[ $fee['name'] ] = $fee; |
|
| 3437 | - $this->set_prop( 'fees', $fees ); |
|
| 3436 | + $fees[$fee['name']] = $fee; |
|
| 3437 | + $this->set_prop('fees', $fees); |
|
| 3438 | 3438 | |
| 3439 | 3439 | } |
| 3440 | 3440 | |
@@ -3443,9 +3443,9 @@ discard block |
||
| 3443 | 3443 | * |
| 3444 | 3444 | * @since 1.0.19 |
| 3445 | 3445 | */ |
| 3446 | - public function get_fee( $fee ) { |
|
| 3446 | + public function get_fee($fee) { |
|
| 3447 | 3447 | $fees = $this->get_fees(); |
| 3448 | - return isset( $fees[ $fee ] ) ? $fees[ $fee ] : null; |
|
| 3448 | + return isset($fees[$fee]) ? $fees[$fee] : null; |
|
| 3449 | 3449 | } |
| 3450 | 3450 | |
| 3451 | 3451 | /** |
@@ -3453,11 +3453,11 @@ discard block |
||
| 3453 | 3453 | * |
| 3454 | 3454 | * @since 1.0.19 |
| 3455 | 3455 | */ |
| 3456 | - public function remove_fee( $fee ) { |
|
| 3456 | + public function remove_fee($fee) { |
|
| 3457 | 3457 | $fees = $this->get_fees(); |
| 3458 | - if ( isset( $fees[ $fee ] ) ) { |
|
| 3459 | - unset( $fees[ $fee ] ); |
|
| 3460 | - $this->set_prop( 'fees', $fees ); |
|
| 3458 | + if (isset($fees[$fee])) { |
|
| 3459 | + unset($fees[$fee]); |
|
| 3460 | + $this->set_prop('fees', $fees); |
|
| 3461 | 3461 | } |
| 3462 | 3462 | } |
| 3463 | 3463 | |
@@ -3467,11 +3467,11 @@ discard block |
||
| 3467 | 3467 | * @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. |
| 3468 | 3468 | * @since 1.0.19 |
| 3469 | 3469 | */ |
| 3470 | - public function add_discount( $discount ) { |
|
| 3470 | + public function add_discount($discount) { |
|
| 3471 | 3471 | |
| 3472 | 3472 | $discounts = $this->get_discounts(); |
| 3473 | - $discounts[ $discount['name'] ] = $discount; |
|
| 3474 | - $this->set_prop( 'discounts', $discounts ); |
|
| 3473 | + $discounts[$discount['name']] = $discount; |
|
| 3474 | + $this->set_prop('discounts', $discounts); |
|
| 3475 | 3475 | |
| 3476 | 3476 | } |
| 3477 | 3477 | |
@@ -3481,15 +3481,15 @@ discard block |
||
| 3481 | 3481 | * @since 1.0.19 |
| 3482 | 3482 | * @return float |
| 3483 | 3483 | */ |
| 3484 | - public function get_discount( $discount = false ) { |
|
| 3484 | + public function get_discount($discount = false) { |
|
| 3485 | 3485 | |
| 3486 | 3486 | // Backwards compatibilty. |
| 3487 | - if ( empty( $discount ) ) { |
|
| 3487 | + if (empty($discount)) { |
|
| 3488 | 3488 | return $this->get_total_discount(); |
| 3489 | 3489 | } |
| 3490 | 3490 | |
| 3491 | 3491 | $discounts = $this->get_discounts(); |
| 3492 | - return isset( $discounts[ $discount ] ) ? $discounts[ $discount ] : null; |
|
| 3492 | + return isset($discounts[$discount]) ? $discounts[$discount] : null; |
|
| 3493 | 3493 | } |
| 3494 | 3494 | |
| 3495 | 3495 | /** |
@@ -3497,15 +3497,15 @@ discard block |
||
| 3497 | 3497 | * |
| 3498 | 3498 | * @since 1.0.19 |
| 3499 | 3499 | */ |
| 3500 | - public function remove_discount( $discount ) { |
|
| 3500 | + public function remove_discount($discount) { |
|
| 3501 | 3501 | $discounts = $this->get_discounts(); |
| 3502 | - if ( isset( $discounts[ $discount ] ) ) { |
|
| 3503 | - unset( $discounts[ $discount ] ); |
|
| 3504 | - $this->set_prop( 'discounts', $discounts ); |
|
| 3502 | + if (isset($discounts[$discount])) { |
|
| 3503 | + unset($discounts[$discount]); |
|
| 3504 | + $this->set_prop('discounts', $discounts); |
|
| 3505 | 3505 | } |
| 3506 | 3506 | |
| 3507 | - if ( 'discount_code' == $discount ) { |
|
| 3508 | - foreach ( $this->get_items() as $item ) { |
|
| 3507 | + if ('discount_code' == $discount) { |
|
| 3508 | + foreach ($this->get_items() as $item) { |
|
| 3509 | 3509 | $item->item_discount = 0; |
| 3510 | 3510 | $item->recurring_item_discount = 0; |
| 3511 | 3511 | } |
@@ -3518,12 +3518,12 @@ discard block |
||
| 3518 | 3518 | * |
| 3519 | 3519 | * @param array $tax An array of tax details. name, initial_tax, and recurring_tax are required. |
| 3520 | 3520 | */ |
| 3521 | - public function add_tax( $tax ) { |
|
| 3522 | - if ( $this->is_taxable() ) { |
|
| 3521 | + public function add_tax($tax) { |
|
| 3522 | + if ($this->is_taxable()) { |
|
| 3523 | 3523 | |
| 3524 | - $taxes = $this->get_taxes(); |
|
| 3525 | - $taxes[ $tax['name'] ] = $tax; |
|
| 3526 | - $this->set_prop( 'taxes', $tax ); |
|
| 3524 | + $taxes = $this->get_taxes(); |
|
| 3525 | + $taxes[$tax['name']] = $tax; |
|
| 3526 | + $this->set_prop('taxes', $tax); |
|
| 3527 | 3527 | |
| 3528 | 3528 | } |
| 3529 | 3529 | } |
@@ -3533,15 +3533,15 @@ discard block |
||
| 3533 | 3533 | * |
| 3534 | 3534 | * @since 1.0.19 |
| 3535 | 3535 | */ |
| 3536 | - public function get_tax( $tax = null ) { |
|
| 3536 | + public function get_tax($tax = null) { |
|
| 3537 | 3537 | |
| 3538 | 3538 | // Backwards compatility. |
| 3539 | - if ( empty( $tax ) ) { |
|
| 3539 | + if (empty($tax)) { |
|
| 3540 | 3540 | return $this->get_total_tax(); |
| 3541 | 3541 | } |
| 3542 | 3542 | |
| 3543 | 3543 | $taxes = $this->get_taxes(); |
| 3544 | - return isset( $taxes[ $tax ] ) ? $taxes[ $tax ] : null; |
|
| 3544 | + return isset($taxes[$tax]) ? $taxes[$tax] : null; |
|
| 3545 | 3545 | } |
| 3546 | 3546 | |
| 3547 | 3547 | /** |
@@ -3549,11 +3549,11 @@ discard block |
||
| 3549 | 3549 | * |
| 3550 | 3550 | * @since 1.0.19 |
| 3551 | 3551 | */ |
| 3552 | - public function remove_tax( $tax ) { |
|
| 3552 | + public function remove_tax($tax) { |
|
| 3553 | 3553 | $taxes = $this->get_taxes(); |
| 3554 | - if ( isset( $taxes[ $tax ] ) ) { |
|
| 3555 | - unset( $taxes[ $tax ] ); |
|
| 3556 | - $this->set_prop( 'taxes', $taxes ); |
|
| 3554 | + if (isset($taxes[$tax])) { |
|
| 3555 | + unset($taxes[$tax]); |
|
| 3556 | + $this->set_prop('taxes', $taxes); |
|
| 3557 | 3557 | } |
| 3558 | 3558 | } |
| 3559 | 3559 | |
@@ -3564,22 +3564,22 @@ discard block |
||
| 3564 | 3564 | * @return float The recalculated subtotal |
| 3565 | 3565 | */ |
| 3566 | 3566 | public function recalculate_subtotal() { |
| 3567 | - $items = $this->get_items(); |
|
| 3567 | + $items = $this->get_items(); |
|
| 3568 | 3568 | $subtotal = 0; |
| 3569 | 3569 | $recurring = 0; |
| 3570 | 3570 | |
| 3571 | - foreach ( $items as $item ) { |
|
| 3572 | - $subtotal += $item->get_sub_total( 'edit' ); |
|
| 3573 | - $recurring += $item->get_recurring_sub_total( 'edit' ); |
|
| 3571 | + foreach ($items as $item) { |
|
| 3572 | + $subtotal += $item->get_sub_total('edit'); |
|
| 3573 | + $recurring += $item->get_recurring_sub_total('edit'); |
|
| 3574 | 3574 | } |
| 3575 | 3575 | |
| 3576 | - if ( wpinv_prices_include_tax() ) { |
|
| 3577 | - $subtotal = max( 0, $subtotal - $this->totals['tax']['initial'] ); |
|
| 3578 | - $recurring = max( 0, $recurring - $this->totals['tax']['recurring'] ); |
|
| 3576 | + if (wpinv_prices_include_tax()) { |
|
| 3577 | + $subtotal = max(0, $subtotal - $this->totals['tax']['initial']); |
|
| 3578 | + $recurring = max(0, $recurring - $this->totals['tax']['recurring']); |
|
| 3579 | 3579 | } |
| 3580 | 3580 | |
| 3581 | 3581 | $current = $this->is_renewal() ? $recurring : $subtotal; |
| 3582 | - $this->set_subtotal( $current ); |
|
| 3582 | + $this->set_subtotal($current); |
|
| 3583 | 3583 | |
| 3584 | 3584 | $this->totals['subtotal'] = array( |
| 3585 | 3585 | 'initial' => $subtotal, |
@@ -3600,14 +3600,14 @@ discard block |
||
| 3600 | 3600 | $discount = 0; |
| 3601 | 3601 | $recurring = 0; |
| 3602 | 3602 | |
| 3603 | - foreach ( $discounts as $data ) { |
|
| 3604 | - $discount += wpinv_sanitize_amount( $data['initial_discount'] ); |
|
| 3605 | - $recurring += wpinv_sanitize_amount( $data['recurring_discount'] ); |
|
| 3603 | + foreach ($discounts as $data) { |
|
| 3604 | + $discount += wpinv_sanitize_amount($data['initial_discount']); |
|
| 3605 | + $recurring += wpinv_sanitize_amount($data['recurring_discount']); |
|
| 3606 | 3606 | } |
| 3607 | 3607 | |
| 3608 | 3608 | $current = $this->is_renewal() ? $recurring : $discount; |
| 3609 | 3609 | |
| 3610 | - $this->set_total_discount( $current ); |
|
| 3610 | + $this->set_total_discount($current); |
|
| 3611 | 3611 | |
| 3612 | 3612 | $this->totals['discount'] = array( |
| 3613 | 3613 | 'initial' => $discount, |
@@ -3628,13 +3628,13 @@ discard block |
||
| 3628 | 3628 | |
| 3629 | 3629 | // Maybe disable taxes. |
| 3630 | 3630 | $vat_number = $this->get_vat_number(); |
| 3631 | - $skip_tax = GetPaid_Payment_Form_Submission_Taxes::is_eu_transaction( $this->get_country() ) && ! empty( $vat_number ); |
|
| 3631 | + $skip_tax = GetPaid_Payment_Form_Submission_Taxes::is_eu_transaction($this->get_country()) && !empty($vat_number); |
|
| 3632 | 3632 | |
| 3633 | - if ( wpinv_is_base_country( $this->get_country() ) && 'vat_too' == wpinv_get_option( 'vat_same_country_rule', 'vat_too' ) ) { |
|
| 3633 | + if (wpinv_is_base_country($this->get_country()) && 'vat_too' == wpinv_get_option('vat_same_country_rule', 'vat_too')) { |
|
| 3634 | 3634 | $skip_tax = false; |
| 3635 | 3635 | } |
| 3636 | 3636 | |
| 3637 | - if ( ! wpinv_use_taxes() || $this->get_disable_taxes() || ! wpinv_is_country_taxable( $this->get_country() ) || $skip_tax ) { |
|
| 3637 | + if (!wpinv_use_taxes() || $this->get_disable_taxes() || !wpinv_is_country_taxable($this->get_country()) || $skip_tax) { |
|
| 3638 | 3638 | |
| 3639 | 3639 | $this->totals['tax'] = array( |
| 3640 | 3640 | 'initial' => 0, |
@@ -3643,38 +3643,38 @@ discard block |
||
| 3643 | 3643 | |
| 3644 | 3644 | $this->tax_rate = 0; |
| 3645 | 3645 | |
| 3646 | - $this->set_taxes( array() ); |
|
| 3646 | + $this->set_taxes(array()); |
|
| 3647 | 3647 | $current = 0; |
| 3648 | 3648 | } else { |
| 3649 | 3649 | |
| 3650 | 3650 | $item_taxes = array(); |
| 3651 | 3651 | |
| 3652 | - foreach ( $this->get_items() as $item ) { |
|
| 3653 | - $rates = getpaid_get_item_tax_rates( $item, $this->get_country(), $this->get_state() ); |
|
| 3654 | - $rates = getpaid_filter_item_tax_rates( $item, $rates ); |
|
| 3655 | - $taxes = getpaid_calculate_item_taxes( getpaid_get_taxable_amount( $item, false ), $rates ); |
|
| 3656 | - $r_taxes = getpaid_calculate_item_taxes( getpaid_get_taxable_amount( $item, true ), $rates ); |
|
| 3657 | - foreach ( $taxes as $name => $amount ) { |
|
| 3658 | - $recurring = isset( $r_taxes[ $name ] ) ? $r_taxes[ $name ] : 0; |
|
| 3659 | - $tax = getpaid_prepare_item_tax( $item, $name, $amount, $recurring ); |
|
| 3660 | - |
|
| 3661 | - if ( ! isset( $item_taxes[ $name ] ) ) { |
|
| 3662 | - $item_taxes[ $name ] = $tax; |
|
| 3652 | + foreach ($this->get_items() as $item) { |
|
| 3653 | + $rates = getpaid_get_item_tax_rates($item, $this->get_country(), $this->get_state()); |
|
| 3654 | + $rates = getpaid_filter_item_tax_rates($item, $rates); |
|
| 3655 | + $taxes = getpaid_calculate_item_taxes(getpaid_get_taxable_amount($item, false), $rates); |
|
| 3656 | + $r_taxes = getpaid_calculate_item_taxes(getpaid_get_taxable_amount($item, true), $rates); |
|
| 3657 | + foreach ($taxes as $name => $amount) { |
|
| 3658 | + $recurring = isset($r_taxes[$name]) ? $r_taxes[$name] : 0; |
|
| 3659 | + $tax = getpaid_prepare_item_tax($item, $name, $amount, $recurring); |
|
| 3660 | + |
|
| 3661 | + if (!isset($item_taxes[$name])) { |
|
| 3662 | + $item_taxes[$name] = $tax; |
|
| 3663 | 3663 | continue; |
| 3664 | 3664 | } |
| 3665 | 3665 | |
| 3666 | - $item_taxes[ $name ]['initial_tax'] += $tax['initial_tax']; |
|
| 3667 | - $item_taxes[ $name ]['recurring_tax'] += $tax['recurring_tax']; |
|
| 3666 | + $item_taxes[$name]['initial_tax'] += $tax['initial_tax']; |
|
| 3667 | + $item_taxes[$name]['recurring_tax'] += $tax['recurring_tax']; |
|
| 3668 | 3668 | |
| 3669 | 3669 | } |
| 3670 | 3670 | |
| 3671 | 3671 | } |
| 3672 | 3672 | |
| 3673 | - $item_taxes = array_replace( $this->get_taxes(), $item_taxes ); |
|
| 3674 | - $this->set_taxes( $item_taxes ); |
|
| 3673 | + $item_taxes = array_replace($this->get_taxes(), $item_taxes); |
|
| 3674 | + $this->set_taxes($item_taxes); |
|
| 3675 | 3675 | |
| 3676 | - $initial_tax = array_sum( wp_list_pluck( $item_taxes, 'initial_tax' ) ); |
|
| 3677 | - $recurring_tax = array_sum( wp_list_pluck( $item_taxes, 'recurring_tax' ) ); |
|
| 3676 | + $initial_tax = array_sum(wp_list_pluck($item_taxes, 'initial_tax')); |
|
| 3677 | + $recurring_tax = array_sum(wp_list_pluck($item_taxes, 'recurring_tax')); |
|
| 3678 | 3678 | |
| 3679 | 3679 | $current = $this->is_renewal() ? $recurring_tax : $initial_tax; |
| 3680 | 3680 | |
@@ -3685,7 +3685,7 @@ discard block |
||
| 3685 | 3685 | |
| 3686 | 3686 | } |
| 3687 | 3687 | |
| 3688 | - $this->set_total_tax( $current ); |
|
| 3688 | + $this->set_total_tax($current); |
|
| 3689 | 3689 | |
| 3690 | 3690 | return $current; |
| 3691 | 3691 | |
@@ -3702,20 +3702,20 @@ discard block |
||
| 3702 | 3702 | $fee = 0; |
| 3703 | 3703 | $recurring = 0; |
| 3704 | 3704 | |
| 3705 | - foreach ( $fees as $data ) { |
|
| 3706 | - $fee += wpinv_sanitize_amount( $data['initial_fee'] ); |
|
| 3707 | - $recurring += wpinv_sanitize_amount( $data['recurring_fee'] ); |
|
| 3705 | + foreach ($fees as $data) { |
|
| 3706 | + $fee += wpinv_sanitize_amount($data['initial_fee']); |
|
| 3707 | + $recurring += wpinv_sanitize_amount($data['recurring_fee']); |
|
| 3708 | 3708 | } |
| 3709 | 3709 | |
| 3710 | 3710 | $current = $this->is_renewal() ? $recurring : $fee; |
| 3711 | - $this->set_total_fees( $current ); |
|
| 3711 | + $this->set_total_fees($current); |
|
| 3712 | 3712 | |
| 3713 | 3713 | $this->totals['fee'] = array( |
| 3714 | 3714 | 'initial' => $fee, |
| 3715 | 3715 | 'recurring' => $recurring, |
| 3716 | 3716 | ); |
| 3717 | 3717 | |
| 3718 | - $this->set_total_fees( $fee ); |
|
| 3718 | + $this->set_total_fees($fee); |
|
| 3719 | 3719 | return $current; |
| 3720 | 3720 | } |
| 3721 | 3721 | |
@@ -3730,7 +3730,7 @@ discard block |
||
| 3730 | 3730 | $this->recalculate_total_discount(); |
| 3731 | 3731 | $this->recalculate_total_tax(); |
| 3732 | 3732 | $this->recalculate_subtotal(); |
| 3733 | - $this->set_total( $this->get_total_tax( 'edit' ) + $this->get_total_fees( 'edit' ) + $this->get_subtotal( 'edit' ) - $this->get_total_discount( 'edit' ) ); |
|
| 3733 | + $this->set_total($this->get_total_tax('edit') + $this->get_total_fees('edit') + $this->get_subtotal('edit') - $this->get_total_discount('edit')); |
|
| 3734 | 3734 | return $this->get_total(); |
| 3735 | 3735 | } |
| 3736 | 3736 | |
@@ -3739,7 +3739,7 @@ discard block |
||
| 3739 | 3739 | */ |
| 3740 | 3740 | public function recalculate_totals() { |
| 3741 | 3741 | $this->recalculate_total(); |
| 3742 | - $this->save( true ); |
|
| 3742 | + $this->save(true); |
|
| 3743 | 3743 | return $this; |
| 3744 | 3744 | } |
| 3745 | 3745 | |
@@ -3757,8 +3757,8 @@ discard block |
||
| 3757 | 3757 | * @return int|false The new note's ID on success, false on failure. |
| 3758 | 3758 | * |
| 3759 | 3759 | */ |
| 3760 | - public function add_system_note( $note ) { |
|
| 3761 | - return $this->add_note( $note, false, false, true ); |
|
| 3760 | + public function add_system_note($note) { |
|
| 3761 | + return $this->add_note($note, false, false, true); |
|
| 3762 | 3762 | } |
| 3763 | 3763 | |
| 3764 | 3764 | /** |
@@ -3768,10 +3768,10 @@ discard block |
||
| 3768 | 3768 | * @return int|false The new note's ID on success, false on failure. |
| 3769 | 3769 | * |
| 3770 | 3770 | */ |
| 3771 | - public function add_note( $note = '', $customer_type = false, $added_by_user = false, $system = false ) { |
|
| 3771 | + public function add_note($note = '', $customer_type = false, $added_by_user = false, $system = false) { |
|
| 3772 | 3772 | |
| 3773 | 3773 | // Bail if no note specified or this invoice is not yet saved. |
| 3774 | - if ( ! $note || $this->get_id() == 0 || ( ! is_user_logged_in() && ! $system ) ) { |
|
| 3774 | + if (!$note || $this->get_id() == 0 || (!is_user_logged_in() && !$system)) { |
|
| 3775 | 3775 | return false; |
| 3776 | 3776 | } |
| 3777 | 3777 | |
@@ -3779,23 +3779,23 @@ discard block |
||
| 3779 | 3779 | $author_email = '[email protected]'; |
| 3780 | 3780 | |
| 3781 | 3781 | // If this is an admin comment or it has been added by the user. |
| 3782 | - if ( is_user_logged_in() && ( ! $system || $added_by_user ) ) { |
|
| 3783 | - $user = get_user_by( 'id', get_current_user_id() ); |
|
| 3782 | + if (is_user_logged_in() && (!$system || $added_by_user)) { |
|
| 3783 | + $user = get_user_by('id', get_current_user_id()); |
|
| 3784 | 3784 | $author = $user->display_name; |
| 3785 | 3785 | $author_email = $user->user_email; |
| 3786 | 3786 | } |
| 3787 | 3787 | |
| 3788 | - return getpaid_notes()->add_invoice_note( $this, $note, $author, $author_email, $customer_type ); |
|
| 3788 | + return getpaid_notes()->add_invoice_note($this, $note, $author, $author_email, $customer_type); |
|
| 3789 | 3789 | |
| 3790 | 3790 | } |
| 3791 | 3791 | |
| 3792 | 3792 | /** |
| 3793 | 3793 | * Generates a unique key for the invoice. |
| 3794 | 3794 | */ |
| 3795 | - public function generate_key( $string = '' ) { |
|
| 3796 | - $auth_key = defined( 'AUTH_KEY' ) ? AUTH_KEY : ''; |
|
| 3795 | + public function generate_key($string = '') { |
|
| 3796 | + $auth_key = defined('AUTH_KEY') ? AUTH_KEY : ''; |
|
| 3797 | 3797 | return strtolower( |
| 3798 | - $string . md5( $this->get_id() . date( 'Y-m-d H:i:s' ) . $auth_key . uniqid( 'wpinv', true ) ) |
|
| 3798 | + $string . md5($this->get_id() . date('Y-m-d H:i:s') . $auth_key . uniqid('wpinv', true)) |
|
| 3799 | 3799 | ); |
| 3800 | 3800 | } |
| 3801 | 3801 | |
@@ -3805,11 +3805,11 @@ discard block |
||
| 3805 | 3805 | public function generate_number() { |
| 3806 | 3806 | $number = $this->get_id(); |
| 3807 | 3807 | |
| 3808 | - if ( wpinv_sequential_number_active( $this->get_post_type() ) ) { |
|
| 3809 | - $number = wpinv_get_next_invoice_number( $this->get_post_type() ); |
|
| 3808 | + if (wpinv_sequential_number_active($this->get_post_type())) { |
|
| 3809 | + $number = wpinv_get_next_invoice_number($this->get_post_type()); |
|
| 3810 | 3810 | } |
| 3811 | 3811 | |
| 3812 | - return wpinv_format_invoice_number( $number, $this->get_post_type() ); |
|
| 3812 | + return wpinv_format_invoice_number($number, $this->get_post_type()); |
|
| 3813 | 3813 | |
| 3814 | 3814 | } |
| 3815 | 3815 | |
@@ -3822,55 +3822,55 @@ discard block |
||
| 3822 | 3822 | // Reset status transition variable. |
| 3823 | 3823 | $this->status_transition = false; |
| 3824 | 3824 | |
| 3825 | - if ( $status_transition ) { |
|
| 3825 | + if ($status_transition) { |
|
| 3826 | 3826 | try { |
| 3827 | 3827 | |
| 3828 | 3828 | // Fire a hook for the status change. |
| 3829 | - do_action( 'getpaid_invoice_status_' . $status_transition['to'], $this, $status_transition ); |
|
| 3829 | + do_action('getpaid_invoice_status_' . $status_transition['to'], $this, $status_transition); |
|
| 3830 | 3830 | |
| 3831 | 3831 | // @deprecated this is deprecated and will be removed in the future. |
| 3832 | - do_action( 'wpinv_status_' . $status_transition['to'], $this->get_id(), $status_transition['from'] ); |
|
| 3832 | + do_action('wpinv_status_' . $status_transition['to'], $this->get_id(), $status_transition['from']); |
|
| 3833 | 3833 | |
| 3834 | - if ( ! empty( $status_transition['from'] ) ) { |
|
| 3834 | + if (!empty($status_transition['from'])) { |
|
| 3835 | 3835 | |
| 3836 | 3836 | /* translators: 1: old invoice status 2: new invoice status */ |
| 3837 | - $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 ) ); |
|
| 3837 | + $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)); |
|
| 3838 | 3838 | |
| 3839 | 3839 | // Fire another hook. |
| 3840 | - do_action( 'getpaid_invoice_status_' . $status_transition['from'] . '_to_' . $status_transition['to'], $this ); |
|
| 3841 | - do_action( 'getpaid_invoice_status_changed', $this, $status_transition['from'], $status_transition['to'] ); |
|
| 3840 | + do_action('getpaid_invoice_status_' . $status_transition['from'] . '_to_' . $status_transition['to'], $this); |
|
| 3841 | + do_action('getpaid_invoice_status_changed', $this, $status_transition['from'], $status_transition['to']); |
|
| 3842 | 3842 | |
| 3843 | 3843 | // @deprecated this is deprecated and will be removed in the future. |
| 3844 | - do_action( 'wpinv_status_' . $status_transition['from'] . '_to_' . $status_transition['to'], $this->get_id(), $status_transition['from'] ); |
|
| 3844 | + do_action('wpinv_status_' . $status_transition['from'] . '_to_' . $status_transition['to'], $this->get_id(), $status_transition['from']); |
|
| 3845 | 3845 | |
| 3846 | 3846 | // Note the transition occurred. |
| 3847 | - $this->add_note( trim( $status_transition['note'] . ' ' . $transition_note ), false, $status_transition['manual'] ); |
|
| 3847 | + $this->add_note(trim($status_transition['note'] . ' ' . $transition_note), false, $status_transition['manual']); |
|
| 3848 | 3848 | |
| 3849 | 3849 | // Work out if this was for a payment, and trigger a payment_status hook instead. |
| 3850 | 3850 | if ( |
| 3851 | - in_array( $status_transition['from'], array( 'wpi-cancelled', 'wpi-pending', 'wpi-failed', 'wpi-refunded', 'wpi-onhold' ), true ) |
|
| 3852 | - && in_array( $status_transition['to'], array( 'publish', 'wpi-processing', 'wpi-renewal' ), true ) |
|
| 3851 | + in_array($status_transition['from'], array('wpi-cancelled', 'wpi-pending', 'wpi-failed', 'wpi-refunded', 'wpi-onhold'), true) |
|
| 3852 | + && in_array($status_transition['to'], array('publish', 'wpi-processing', 'wpi-renewal'), true) |
|
| 3853 | 3853 | ) { |
| 3854 | - do_action( 'getpaid_invoice_payment_status_changed', $this, $status_transition ); |
|
| 3854 | + do_action('getpaid_invoice_payment_status_changed', $this, $status_transition); |
|
| 3855 | 3855 | } |
| 3856 | 3856 | |
| 3857 | 3857 | // Work out if this was for a payment reversal, and trigger a payment_status_reversed hook instead. |
| 3858 | 3858 | if ( |
| 3859 | - in_array( $status_transition['from'], array( 'publish', 'wpi-processing', 'wpi-renewal' ), true ) |
|
| 3860 | - && in_array( $status_transition['to'], array( 'wpi-cancelled', 'wpi-pending', 'wpi-failed', 'wpi-refunded', 'wpi-onhold' ), true ) |
|
| 3859 | + in_array($status_transition['from'], array('publish', 'wpi-processing', 'wpi-renewal'), true) |
|
| 3860 | + && in_array($status_transition['to'], array('wpi-cancelled', 'wpi-pending', 'wpi-failed', 'wpi-refunded', 'wpi-onhold'), true) |
|
| 3861 | 3861 | ) { |
| 3862 | - do_action( 'getpaid_invoice_payment_status_reversed', $this, $status_transition ); |
|
| 3862 | + do_action('getpaid_invoice_payment_status_reversed', $this, $status_transition); |
|
| 3863 | 3863 | } |
| 3864 | 3864 | } else { |
| 3865 | 3865 | /* translators: %s: new invoice status */ |
| 3866 | - $transition_note = sprintf( __( 'Status set to %s.', 'invoicing' ), wpinv_status_nicename( $status_transition['to'], $this ) ); |
|
| 3866 | + $transition_note = sprintf(__('Status set to %s.', 'invoicing'), wpinv_status_nicename($status_transition['to'], $this)); |
|
| 3867 | 3867 | |
| 3868 | 3868 | // Note the transition occurred. |
| 3869 | - $this->add_note( trim( $status_transition['note'] . ' ' . $transition_note ), 0, $status_transition['manual'] ); |
|
| 3869 | + $this->add_note(trim($status_transition['note'] . ' ' . $transition_note), 0, $status_transition['manual']); |
|
| 3870 | 3870 | |
| 3871 | 3871 | } |
| 3872 | - } catch ( Exception $e ) { |
|
| 3873 | - $this->add_note( __( 'Error during status transition.', 'invoicing' ) . ' ' . $e->getMessage() ); |
|
| 3872 | + } catch (Exception $e) { |
|
| 3873 | + $this->add_note(__('Error during status transition.', 'invoicing') . ' ' . $e->getMessage()); |
|
| 3874 | 3874 | } |
| 3875 | 3875 | } |
| 3876 | 3876 | } |
@@ -3878,13 +3878,13 @@ discard block |
||
| 3878 | 3878 | /** |
| 3879 | 3879 | * Updates an invoice status. |
| 3880 | 3880 | */ |
| 3881 | - public function update_status( $new_status = false, $note = '', $manual = false ) { |
|
| 3881 | + public function update_status($new_status = false, $note = '', $manual = false) { |
|
| 3882 | 3882 | |
| 3883 | 3883 | // Fires before updating a status. |
| 3884 | - do_action( 'wpinv_before_invoice_status_change', $this->get_id(), $new_status, $this->get_status( 'edit' ) ); |
|
| 3884 | + do_action('wpinv_before_invoice_status_change', $this->get_id(), $new_status, $this->get_status('edit')); |
|
| 3885 | 3885 | |
| 3886 | 3886 | // Update the status. |
| 3887 | - $this->set_status( $new_status, $note, $manual ); |
|
| 3887 | + $this->set_status($new_status, $note, $manual); |
|
| 3888 | 3888 | |
| 3889 | 3889 | // Save the order. |
| 3890 | 3890 | return $this->save(); |
@@ -3895,18 +3895,18 @@ discard block |
||
| 3895 | 3895 | * @deprecated |
| 3896 | 3896 | */ |
| 3897 | 3897 | public function refresh_item_ids() { |
| 3898 | - $item_ids = implode( ',', array_unique( wp_list_pluck( $this->get_cart_details(), 'item_id' ) ) ); |
|
| 3899 | - update_post_meta( $this->get_id(), '_wpinv_item_ids', $item_ids ); |
|
| 3898 | + $item_ids = implode(',', array_unique(wp_list_pluck($this->get_cart_details(), 'item_id'))); |
|
| 3899 | + update_post_meta($this->get_id(), '_wpinv_item_ids', $item_ids); |
|
| 3900 | 3900 | } |
| 3901 | 3901 | |
| 3902 | 3902 | /** |
| 3903 | 3903 | * @deprecated |
| 3904 | 3904 | */ |
| 3905 | - public function update_items( $temp = false ) { |
|
| 3905 | + public function update_items($temp = false) { |
|
| 3906 | 3906 | |
| 3907 | - $this->set_items( $this->get_items() ); |
|
| 3907 | + $this->set_items($this->get_items()); |
|
| 3908 | 3908 | |
| 3909 | - if ( ! $temp ) { |
|
| 3909 | + if (!$temp) { |
|
| 3910 | 3910 | $this->save(); |
| 3911 | 3911 | } |
| 3912 | 3912 | |
@@ -3920,11 +3920,11 @@ discard block |
||
| 3920 | 3920 | |
| 3921 | 3921 | $discount_code = $this->get_discount_code(); |
| 3922 | 3922 | |
| 3923 | - if ( empty( $discount_code ) ) { |
|
| 3923 | + if (empty($discount_code)) { |
|
| 3924 | 3924 | return false; |
| 3925 | 3925 | } |
| 3926 | 3926 | |
| 3927 | - $discount = wpinv_get_discount_obj( $discount_code ); |
|
| 3927 | + $discount = wpinv_get_discount_obj($discount_code); |
|
| 3928 | 3928 | |
| 3929 | 3929 | // Ensure it is active. |
| 3930 | 3930 | return $discount->exists(); |
@@ -3935,7 +3935,7 @@ discard block |
||
| 3935 | 3935 | * Refunds an invoice. |
| 3936 | 3936 | */ |
| 3937 | 3937 | public function refund() { |
| 3938 | - $this->set_status( 'wpi-refunded' ); |
|
| 3938 | + $this->set_status('wpi-refunded'); |
|
| 3939 | 3939 | $this->save(); |
| 3940 | 3940 | } |
| 3941 | 3941 | |
@@ -3944,53 +3944,53 @@ discard block |
||
| 3944 | 3944 | * |
| 3945 | 3945 | * @param string $transaction_id |
| 3946 | 3946 | */ |
| 3947 | - public function mark_paid( $transaction_id = null, $note = '' ) { |
|
| 3947 | + public function mark_paid($transaction_id = null, $note = '') { |
|
| 3948 | 3948 | |
| 3949 | 3949 | // Set the transaction id. |
| 3950 | - if ( empty( $transaction_id ) ) { |
|
| 3950 | + if (empty($transaction_id)) { |
|
| 3951 | 3951 | $transaction_id = $this->generate_key('trans_'); |
| 3952 | 3952 | } |
| 3953 | 3953 | |
| 3954 | - if ( ! $this->get_transaction_id() ) { |
|
| 3955 | - $this->set_transaction_id( $transaction_id ); |
|
| 3954 | + if (!$this->get_transaction_id()) { |
|
| 3955 | + $this->set_transaction_id($transaction_id); |
|
| 3956 | 3956 | } |
| 3957 | 3957 | |
| 3958 | - if ( $this->is_paid() && 'wpi-processing' != $this->get_status() ) { |
|
| 3958 | + if ($this->is_paid() && 'wpi-processing' != $this->get_status()) { |
|
| 3959 | 3959 | return $this->save(); |
| 3960 | 3960 | } |
| 3961 | 3961 | |
| 3962 | 3962 | // Set the completed date. |
| 3963 | - $this->set_date_completed( current_time( 'mysql' ) ); |
|
| 3963 | + $this->set_date_completed(current_time('mysql')); |
|
| 3964 | 3964 | |
| 3965 | 3965 | // Set the new status. |
| 3966 | - $gateway = sanitize_text_field( $this->get_gateway_title() ); |
|
| 3967 | - if ( $this->is_renewal() || ! $this->is_parent() ) { |
|
| 3966 | + $gateway = sanitize_text_field($this->get_gateway_title()); |
|
| 3967 | + if ($this->is_renewal() || !$this->is_parent()) { |
|
| 3968 | 3968 | |
| 3969 | - $_note = wp_sprintf( __( 'Renewed via %s', 'invoicing' ), $gateway ); |
|
| 3970 | - $_note = $_note . empty( $note ) ? '' : " ($note)"; |
|
| 3969 | + $_note = wp_sprintf(__('Renewed via %s', 'invoicing'), $gateway); |
|
| 3970 | + $_note = $_note . empty($note) ? '' : " ($note)"; |
|
| 3971 | 3971 | |
| 3972 | - if ( 'none' == $this->get_gateway() ) { |
|
| 3972 | + if ('none' == $this->get_gateway()) { |
|
| 3973 | 3973 | $_note = $note; |
| 3974 | 3974 | } |
| 3975 | 3975 | |
| 3976 | - $this->set_status( 'wpi-renewal', $_note ); |
|
| 3976 | + $this->set_status('wpi-renewal', $_note); |
|
| 3977 | 3977 | |
| 3978 | 3978 | } else { |
| 3979 | 3979 | |
| 3980 | - $_note = wp_sprintf( __( 'Paid via %s', 'invoicing' ), $gateway ); |
|
| 3981 | - $_note = $_note . empty( $note ) ? '' : " ($note)"; |
|
| 3980 | + $_note = wp_sprintf(__('Paid via %s', 'invoicing'), $gateway); |
|
| 3981 | + $_note = $_note . empty($note) ? '' : " ($note)"; |
|
| 3982 | 3982 | |
| 3983 | - if ( 'none' == $this->get_gateway() ) { |
|
| 3983 | + if ('none' == $this->get_gateway()) { |
|
| 3984 | 3984 | $_note = $note; |
| 3985 | 3985 | } |
| 3986 | 3986 | |
| 3987 | - $this->set_status( 'publish', $_note ); |
|
| 3987 | + $this->set_status('publish', $_note); |
|
| 3988 | 3988 | |
| 3989 | 3989 | } |
| 3990 | 3990 | |
| 3991 | 3991 | // Set checkout mode. |
| 3992 | - $mode = wpinv_is_test_mode( $this->get_gateway() ) ? 'test' : 'live'; |
|
| 3993 | - $this->set_mode( $mode ); |
|
| 3992 | + $mode = wpinv_is_test_mode($this->get_gateway()) ? 'test' : 'live'; |
|
| 3993 | + $this->set_mode($mode); |
|
| 3994 | 3994 | |
| 3995 | 3995 | // Save the invoice. |
| 3996 | 3996 | $this->save(); |
@@ -4015,9 +4015,9 @@ discard block |
||
| 4015 | 4015 | * Clears the subscription's cache. |
| 4016 | 4016 | */ |
| 4017 | 4017 | public function clear_cache() { |
| 4018 | - wp_cache_delete( $this->get_key(), 'getpaid_invoice_keys_to_invoice_ids' ); |
|
| 4019 | - wp_cache_delete( $this->get_number(), 'getpaid_invoice_numbers_to_invoice_ids' ); |
|
| 4020 | - wp_cache_delete( $this->get_transaction_id(), 'getpaid_invoice_transaction_ids_to_invoice_ids' ); |
|
| 4018 | + wp_cache_delete($this->get_key(), 'getpaid_invoice_keys_to_invoice_ids'); |
|
| 4019 | + wp_cache_delete($this->get_number(), 'getpaid_invoice_numbers_to_invoice_ids'); |
|
| 4020 | + wp_cache_delete($this->get_transaction_id(), 'getpaid_invoice_transaction_ids_to_invoice_ids'); |
|
| 4021 | 4021 | } |
| 4022 | 4022 | |
| 4023 | 4023 | } |