| Server IP : 47.82.179.145 / Your IP : 216.73.217.129 Web Server : nginx/1.26.3 System : Linux iZt4n9czhka2zvqfajdlr2Z 6.8.0-63-generic #66-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 13 20:25:30 UTC 2025 x86_64 User : www ( 1001) PHP Version : 8.3.30 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,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_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /www/wwwroot/scuipturepactory.com/wp-content/plugins.off/modern-cart/inc/ |
Upload File : |
<?php
/**
* Floating cart ajax.
*
* @package modern-cart
* @since 0.0.1
*/
namespace ModernCart\Inc;
use ModernCart\Inc\Traits\Get_Instance;
/**
* Floating cart ajax class
*
* @since 0.0.1
*/
class Floating_Ajax extends Floating {
use Get_Instance;
/**
* Constructor
*
* @since 0.0.1
*/
public function __construct() {
add_action( 'wp_ajax_moderncart_refresh_floating_cart', [ $this, 'refresh_floating_cart' ] );
add_action( 'wp_ajax_nopriv_moderncart_refresh_floating_cart', [ $this, 'refresh_floating_cart' ] );
}
/**
* Refresh slide out cart
*
* @since 0.0.1
*
* @return void
*/
public function refresh_floating_cart(): void {
Helper::set_nocache_headers();
if ( ! isset( $_POST['moderncart_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['moderncart_nonce'] ) ), 'moderncart_ajax_nonce' ) ) {
return;
}
if ( 'disabled' === $this->get_option( 'floating_cart_position', MODERNCART_FLOATING_SETTINGS, 'bottom-left' ) ) {
return;
}
$hide_if_empty = $this->get_option( 'enable_floating_if_empty', MODERNCART_FLOATING_SETTINGS, false );
$cart_count = Helper::get_cart_count();
$cart_icon = $this->get_option( 'floating_cart_icon', MODERNCART_FLOATING_SETTINGS, 0 );
$cart_svg_icons = Helper::get_cart_icons();
$data = [
'classes' => apply_filters( 'moderncart_floating_cart_launcher_classes', [ 'moderncart-toggle-slide-out' ] ),
'item_account' => $cart_count,
'cart_icon' => $cart_icon, // Cart icon for floating cart refresh.
'cart_svg_icons' => $cart_svg_icons, // Cart icon for floating cart refresh.
];
if ( $hide_if_empty && 0 === $cart_count ) {
$data['classes'][] = 'moderncart-floating-cart-empty';
}
ob_start();
moderncart_get_template_part( 'shop/floating-inner', '', $data );
$result = ob_get_contents();
ob_end_clean();
$return = [ 'content' => $result ];
wp_send_json( $return );
}
}