403Webshell
Server IP : 192.241.186.36  /  Your IP : 216.73.216.164
Web Server : Apache/2.4.29 (Ubuntu)
System : Linux webserver7 4.15.0-194-generic #205-Ubuntu SMP Fri Sep 16 19:49:27 UTC 2022 x86_64
User : root ( 0)
PHP Version : 7.4.32
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/html/carsdaddy/wp-content/themes/cardealer/includes/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/carsdaddy/wp-content/themes/cardealer/includes/woocommerce-hook.php
<?php
/**
 * Woocommerce hook file
 *
 * @package Cardealer
 */

if ( ! class_exists( 'WooCommerce' ) ) {
	return;
}

/**
 * Minicart on header via Ajax
 */
if ( cardealer_woocommerce_version_check( '2.7.0' ) ) {
	add_filter( 'woocommerce_add_to_cart_fragments', 'cardealer_add_to_cart_fragment', 100 );
} else {
	add_filter( 'add_to_cart_fragments', 'cardealer_add_to_cart_fragment', 100 );
}

if ( ! function_exists( 'cardealer_add_to_cart_fragment' ) ) {
	/**
	 * Add to cart fragment
	 *
	 * @param array $fragments array variable.
	 */
	function cardealer_add_to_cart_fragment( $fragments ) {
		// Menu Cart.
		ob_start();
		?>
		<div class="menu-item-woocommerce-cart-wrapper">
			<?php
			get_template_part( 'woocommerce/minicart-ajax' );
			?>
		</div>
		<?php
		$menu_cart = ob_get_clean();

		// Mobile Cart.
		ob_start();
		?>
		<div class="mobile-cart-wrapper">
			<?php get_template_part( 'woocommerce/minicart-ajax' ); ?>
		</div>
		<?php
		$mobile_cart                                      = ob_get_clean();
		$fragments['.menu-item-woocommerce-cart-wrapper'] = $menu_cart;
		$fragments['.mobile-cart-wrapper']                = $mobile_cart;

		return $fragments;
	}
}

/**
 * Remove default woocommerce_before_main_content
 */
remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20 );

if ( ! function_exists( 'cardealer_show_related_products' ) ) {
	/**
	 * Cardealer show related products
	 */
	function cardealer_show_related_products() {
		global $car_dealer_options;
		if ( isset( $car_dealer_options['show_related_products'] ) && 'no' === $car_dealer_options['show_related_products'] ) {
			remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20 );
		}
	}
}
add_action( 'init', 'cardealer_show_related_products' );

add_filter( 'woocommerce_cart_item_permalink', 'cardealer_add_custom_link_to_car_page', 10, 3 );
if ( ! function_exists( 'cardealer_add_custom_link_to_car_page' ) ) {
	/**
	 * Update cart page product page link to car details page link
	 *
	 * @param string $permalink store permalink.
	 * @param array  $cart_item store cart item.
	 * @param string $cart_item_key store key.
	 */
	function cardealer_add_custom_link_to_car_page( $permalink, $cart_item, $cart_item_key ) {
		global $wpdb;

		$results = $wpdb->get_results(
			$wpdb->prepare(
				'
				SELECT * FROM ' . $wpdb->postmeta . '
				WHERE meta_key = "car_to_woo_product_id" AND meta_value = %d
				',
				$cart_item['product_id']
			),
			OBJECT
		);
		if ( ! empty( $results ) ) {
			if ( isset( $results[0]->post_id ) ) {
				$permalink = get_the_permalink( $results[0]->post_id );
			}
		}
		return $permalink;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit