PATH:
var
/
softaculous
/
sitepad
/
editor
/
site-data
/
plugins
/
kkart-pro
/
includes
<?php /** * Order Line Item (tax) * * @package Kkart\Classes * @version 3.0.0 * @since 3.0.0 */ defined( 'ABSPATH' ) || exit; /** * Order item tax. */ class KKART_Order_Item_Tax extends KKART_Order_Item { /** * Order Data array. This is the core order data exposed in APIs since 3.0.0. * * @since 3.0.0 * @var array */ protected $extra_data = array( 'rate_code' => '', 'rate_id' => 0, 'label' => '', 'compound' => false, 'tax_total' => 0, 'shipping_tax_total' => 0, 'rate_percent' => null, ); /* |-------------------------------------------------------------------------- | Setters |-------------------------------------------------------------------------- */ /** * Set order item name. * * @param string $value Name. */ public function set_name( $value ) { $this->set_rate_code( $value ); } /** * Set item name. * * @param string $value Rate code. */ public function set_rate_code( $value ) { $this->set_prop( 'rate_code', kkart_clean( $value ) ); } /** * Set item name. * * @param string $value Label. */ public function set_label( $value ) { $this->set_prop( 'label', kkart_clean( $value ) ); } /** * Set tax rate id. * * @param int $value Rate ID. */ public function set_rate_id( $value ) { $this->set_prop( 'rate_id', absint( $value ) ); } /** * Set tax total. * * @param string $value Tax total. */ public function set_tax_total( $value ) { $this->set_prop( 'tax_total', $value ? kkart_format_decimal( $value ) : 0 ); } /** * Set shipping tax total. * * @param string $value Shipping tax total. */ public function set_shipping_tax_total( $value ) { $this->set_prop( 'shipping_tax_total', $value ? kkart_format_decimal( $value ) : 0 ); } /** * Set compound. * * @param bool $value If tax is compound. */ public function set_compound( $value ) { $this->set_prop( 'compound', (bool) $value ); } /** * Set rate value. * * @param float $value tax rate value. */ public function set_rate_percent( $value ) { $this->set_prop( 'rate_percent', (float) $value ); } /** * Set properties based on passed in tax rate by ID. * * @param int $tax_rate_id Tax rate ID. */ public function set_rate( $tax_rate_id ) { $tax_rate = KKART_Tax::_get_tax_rate( $tax_rate_id, OBJECT ); $this->set_rate_id( $tax_rate_id ); $this->set_rate_code( KKART_Tax::get_rate_code( $tax_rate ) ); $this->set_label( KKART_Tax::get_rate_label( $tax_rate ) ); $this->set_compound( KKART_Tax::is_compound( $tax_rate ) ); $this->set_rate_percent( KKART_Tax::get_rate_percent_value( $tax_rate ) ); } /* |-------------------------------------------------------------------------- | Getters |-------------------------------------------------------------------------- */ /** * Get order item type. * * @return string */ public function get_type() { return 'tax'; } /** * Get rate code/name. * * @param string $context What the value is for. Valid values are 'view' and 'edit'. * @return string */ public function get_name( $context = 'view' ) { return $this->get_rate_code( $context ); } /** * Get rate code/name. * * @param string $context What the value is for. Valid values are 'view' and 'edit'. * @return string */ public function get_rate_code( $context = 'view' ) { return $this->get_prop( 'rate_code', $context ); } /** * Get label. * * @param string $context What the value is for. Valid values are 'view' and 'edit'. * @return string */ public function get_label( $context = 'view' ) { $label = $this->get_prop( 'label', $context ); if ( 'view' === $context ) { return $label ? $label : __( 'Tax', 'kkart' ); } else { return $label; } } /** * Get tax rate ID. * * @param string $context What the value is for. Valid values are 'view' and 'edit'. * @return int */ public function get_rate_id( $context = 'view' ) { return $this->get_prop( 'rate_id', $context ); } /** * Get tax_total * * @param string $context What the value is for. Valid values are 'view' and 'edit'. * @return string */ public function get_tax_total( $context = 'view' ) { return $this->get_prop( 'tax_total', $context ); } /** * Get shipping_tax_total * * @param string $context What the value is for. Valid values are 'view' and 'edit'. * @return string */ public function get_shipping_tax_total( $context = 'view' ) { return $this->get_prop( 'shipping_tax_total', $context ); } /** * Get compound. * * @param string $context What the value is for. Valid values are 'view' and 'edit'. * @return bool */ public function get_compound( $context = 'view' ) { return $this->get_prop( 'compound', $context ); } /** * Is this a compound tax rate? * * @return boolean */ public function is_compound() { return $this->get_compound(); } /** * Get rate value * * @param string $context What the value is for. Valid values are 'view' and 'edit'. * @return float */ public function get_rate_percent( $context = 'view' ) { return $this->get_prop( 'rate_percent', $context ); } /* |-------------------------------------------------------------------------- | Array Access Methods |-------------------------------------------------------------------------- | | For backwards compatibility with legacy arrays. | */ /** * O for ArrayAccess/Backwards compatibility. * * @param string $offset Offset. * @return mixed */ public function offsetGet( $offset ) { if ( 'tax_amount' === $offset ) { $offset = 'tax_total'; } elseif ( 'shipping_tax_amount' === $offset ) { $offset = 'shipping_tax_total'; } return parent::offsetGet( $offset ); } /** * OffsetSet for ArrayAccess/Backwards compatibility. * * @deprecated 4.4.0 * @param string $offset Offset. * @param mixed $value Value. */ public function offsetSet( $offset, $value ) { kkart_deprecated_function( 'KKART_Order_Item_Tax::offsetSet', '4.4.0', '' ); if ( 'tax_amount' === $offset ) { $offset = 'tax_total'; } elseif ( 'shipping_tax_amount' === $offset ) { $offset = 'shipping_tax_total'; } parent::offsetSet( $offset, $value ); } /** * OffsetExists for ArrayAccess. * * @param string $offset Offset. * @return bool */ public function offsetExists( $offset ) { if ( in_array( $offset, array( 'tax_amount', 'shipping_tax_amount' ), true ) ) { return true; } return parent::offsetExists( $offset ); } }
[+]
..
[+]
log-handlers
[-] class-kkart-regenerate-images.php
[edit]
[-] class-kkart-order-item-shipping.php
[edit]
[-] class-kkart-order-item-product.php
[edit]
[-] class-kkart-privacy-background-process.php
[edit]
[-] class-kkart-data-exception.php
[edit]
[+]
traits
[-] class-kkart-embed.php
[edit]
[-] class-kkart-data-store.php
[edit]
[-] kkart-coupon-functions.php
[edit]
[+]
wccom-site
[-] class-kkart-frontend-scripts.php
[edit]
[-] class-kkart-regenerate-images-request.php
[edit]
[+]
gateways
[-] class-kkart-autoloader.php
[edit]
[-] kkart-order-item-functions.php
[edit]
[-] class-kkart-webhook.php
[edit]
[-] kkart-term-functions.php
[edit]
[+]
shipping
[-] class-kkart-product-grouped.php
[edit]
[-] class-kkart-ajax.php
[edit]
[-] class-kkart-privacy-erasers.php
[edit]
[+]
admin
[-] class-kkart-tracker.php
[edit]
[-] class-kkart-order-item-fee.php
[edit]
[+]
customizer
[-] kkart-conditional-functions.php
[edit]
[-] class-kkart-tax.php
[edit]
[-] class-kkart-product-variable.php
[edit]
[+]
widgets
[-] kkart-webhook-functions.php
[edit]
[-] class-kkart-api.php
[edit]
[+]
payment-tokens
[-] premium_functions.php
[edit]
[-] class-kkart-order-refund.php
[edit]
[-] class-kkart-shipping-zone.php
[edit]
[+]
tracks
[-] class-kkart-structured-data.php
[edit]
[-] class-kkart-form-handler.php
[edit]
[-] class-kkart-emails.php
[edit]
[-] class-kkart-post-data.php
[edit]
[-] class-kkart-rest-authentication.php
[edit]
[-] class-kkart-geolite-integration.php
[edit]
[-] kkart-attribute-functions.php
[edit]
[-] class-kkart-background-emailer.php
[edit]
[-] class-kkart-shipping-zones.php
[edit]
[-] class-kkart-comments.php
[edit]
[+]
legacy
[-] class-kkart-product-variation.php
[edit]
[+]
theme-support
[+]
data-stores
[-] class-kkart-cart-session.php
[edit]
[+]
integrations
[-] class-kkart-session-handler.php
[edit]
[-] class-kkart.php
[edit]
[-] class-kkart-geolocation.php
[edit]
[-] class-kkart-discounts.php
[edit]
[-] class-kkart-payment-gateways.php
[edit]
[-] class-kkart-install.php
[edit]
[+]
abstracts
[-] class-kkart-privacy.php
[edit]
[-] kkart-page-functions.php
[edit]
[-] class-kkart-background-updater.php
[edit]
[-] class-kkart-customer-download.php
[edit]
[-] shortcodes.php
[edit]
[-] class-kkart-deprecated-action-hooks.php
[edit]
[-] kkart-order-functions.php
[edit]
[+]
walkers
[-] kkart-widget-functions.php
[edit]
[-] class-kkart-countries.php
[edit]
[-] class-kkart-payment-tokens.php
[edit]
[-] class-kkart-rate-limiter.php
[edit]
[-] class-kkart-coupon.php
[edit]
[-] body-props-settings.php
[edit]
[-] class-kkart-order-item-meta.php
[edit]
[-] class-kkart-shortcodes.php
[edit]
[-] class-kkart-auth.php
[edit]
[-] class-kkart-logger.php
[edit]
[-] class-kkart-product-simple.php
[edit]
[-] class-kkart-order-item.php
[edit]
[-] class-kkart-log-levels.php
[edit]
[-] kkart-stock-functions.php
[edit]
[-] class-kkart-checkout.php
[edit]
[+]
emails
[+]
interfaces
[-] class-kkart-customer.php
[edit]
[-] class-kkart-geo-ip.php
[edit]
[-] class-kkart-customer-download-log.php
[edit]
[+]
rest-api
[+]
cli
[-] class-kkart-integrations.php
[edit]
[-] shortcode_functions.php
[edit]
[-] kkart-template-hooks.php
[edit]
[-] class-kkart-datetime.php
[edit]
[-] class-kkart-deprecated-filter-hooks.php
[edit]
[-] class-kkart-breadcrumb.php
[edit]
[-] class-kkart-shipping-rate.php
[edit]
[-] class-kkart-order-query.php
[edit]
[+]
import
[-] kkart-rest-functions.php
[edit]
[-] kkart-notice-functions.php
[edit]
[-] class-kkart-product-query.php
[edit]
[-] class-kkart-register-wp-admin-settings.php
[edit]
[-] class-kkart-product-attribute.php
[edit]
[+]
shortcodes
[-] kkart-user-functions.php
[edit]
[-] kkart-template-functions.php
[edit]
[-] class-kkart-download-handler.php
[edit]
[-] class-kkart-validation.php
[edit]
[-] class-kkart-order-item-tax.php
[edit]
[-] class-kkart-product-external.php
[edit]
[-] kkart-formatting-functions.php
[edit]
[-] class-kkart-privacy-exporters.php
[edit]
[-] class-kkart-post-types.php
[edit]
[-] class-kkart-cli.php
[edit]
[-] class-kkart-query.php
[edit]
[-] premium.php
[edit]
[-] kkart-cart-functions.php
[edit]
[-] class-kkart-cache-helper.php
[edit]
[-] class-kkart-https.php
[edit]
[-] kkart-core-functions.php
[edit]
[-] template.php
[edit]
[-] class-kkart-order-factory.php
[edit]
[+]
libraries
[-] class-kkart-cart.php
[edit]
[-] class-kkart-meta-data.php
[edit]
[-] kkart-account-functions.php
[edit]
[-] class-kkart-order-item-coupon.php
[edit]
[-] class-kkart-cart-totals.php
[edit]
[-] class-kkart-template-loader.php
[edit]
[+]
queue
[-] class-kkart-cart-fees.php
[edit]
[-] class-kkart-shipping.php
[edit]
[-] class-kkart-product-factory.php
[edit]
[+]
export
[-] class-kkart-product-download.php
[edit]
[-] kkart-product-functions.php
[edit]
[-] class-kkart-order.php
[edit]
[-] kkart-update-functions.php
[edit]
[-] class-kkart-rest-exception.php
[edit]