plugin updates

This commit is contained in:
Tony Volpe
2024-06-17 15:33:26 -04:00
parent 3751a5a1a6
commit e4e274a9a7
2674 changed files with 0 additions and 507851 deletions

View File

@@ -1,203 +0,0 @@
<?php
/**
* Compatibility class for WooCommerce 4.4.0
*
* @category Class
* @package WC-compat
* @author StoreApps
* @version 1.1.0
* @since WooCommerce 4.4.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'SA_WC_Compatibility_4_4' ) ) {
/**
* Class to check WooCommerce version is greater than and equal to 4.4.0
*/
class SA_WC_Compatibility_4_4 {
/**
* Function to check if WooCommerce is Greater Than And Equal To 4.4.0
*
* @return boolean
*/
public static function is_wc_gte_44() {
return self::is_wc_greater_than( '4.3.3' );
}
/**
* Function to check if WooCommerce is Greater Than And Equal To 4.3.0
*
* @return boolean
*/
public static function is_wc_gte_43() {
return self::is_wc_greater_than( '4.2.2' );
}
/**
* Function to check if WooCommerce is Greater Than And Equal To 4.2.0
*
* @return boolean
*/
public static function is_wc_gte_42() {
return self::is_wc_greater_than( '4.1.1' );
}
/**
* Function to check if WooCommerce is Greater Than And Equal To 4.1.0
*
* @return boolean
*/
public static function is_wc_gte_41() {
return self::is_wc_greater_than( '4.0.1' );
}
/**
* Function to check if WooCommerce is Greater Than And Equal To 4.0.0
*
* @return boolean
*/
public static function is_wc_gte_40() {
return self::is_wc_greater_than( '3.9.3' );
}
/**
* Function to check if WooCommerce is Greater Than And Equal To 3.9.0
*
* @return boolean
*/
public static function is_wc_gte_39() {
return self::is_wc_greater_than( '3.8.1' );
}
/**
* Function to check if WooCommerce is Greater Than And Equal To 3.8.0
*
* @return boolean
*/
public static function is_wc_gte_38() {
return self::is_wc_greater_than( '3.7.1' );
}
/**
* Function to check if WooCommerce is Greater Than And Equal To 3.7.0
*
* @return boolean
*/
public static function is_wc_gte_37() {
return self::is_wc_greater_than( '3.6.5' );
}
/**
* Function to check if WooCommerce is Greater Than And Equal To 3.6.0
*
* @return boolean
*/
public static function is_wc_gte_36() {
return self::is_wc_greater_than( '3.5.8' );
}
/**
* Function to check if WooCommerce is Greater Than And Equal To 3.5.0
*
* @return boolean
*/
public static function is_wc_gte_35() {
return self::is_wc_greater_than( '3.4.7' );
}
/**
* Function to check if WooCommerce is Greater Than And Equal To 3.3.0
*
* @return boolean
*/
public static function is_wc_gte_34() {
return self::is_wc_greater_than( '3.3.5' );
}
/**
* Function to check if WooCommerce is Greater Than And Equal To 3.3.0
*
* @return boolean
*/
public static function is_wc_gte_33() {
return self::is_wc_greater_than( '3.2.6' );
}
/**
* Function to check if WooCommerce is Greater Than And Equal To 3.2.0
*
* @return boolean
*/
public static function is_wc_gte_32() {
return self::is_wc_greater_than( '3.1.2' );
}
/**
* Function to check if WooCommerce is Greater Than And Equal To 3.1.0
*
* @return boolean
*/
public static function is_wc_gte_31() {
return self::is_wc_greater_than( '3.0.9' );
}
/**
* Function to check if WooCommerce is Greater Than And Equal To 3.0.0
*
* @return boolean
*/
public static function is_wc_gte_30() {
return self::is_wc_greater_than( '2.6.14' );
}
/**
* Function to check if WooCommerce version is greater than and equal to 2.6
*
* @return boolean
*/
public static function is_wc_gte_26() {
return self::is_wc_greater_than( '2.5.5' );
}
/**
* Function to check if WooCommerce version is greater than and equal To 2.5
*
* @return boolean
*/
public static function is_wc_gte_25() {
return self::is_wc_greater_than( '2.4.13' );
}
/**
* Function to get WooCommerce version
*
* @return string version or null.
*/
public static function get_wc_version() {
if ( defined( 'WC_VERSION' ) && WC_VERSION ) {
return WC_VERSION;
}
if ( defined( 'WOOCOMMERCE_VERSION' ) && WOOCOMMERCE_VERSION ) {
return WOOCOMMERCE_VERSION;
}
return null;
}
/**
* Function to compare current version of WooCommerce on site with active version of WooCommerce
*
* @param string $version Version number to compare.
* @return bool
*/
public static function is_wc_greater_than( $version ) {
return version_compare( self::get_wc_version(), $version, '>' );
}
}
}

View File

@@ -1,89 +0,0 @@
<?php
/**
* Compatibility file for WooCommerce Aelia Currency Switcher
*
* @author StoreApps
* @since 6.1.0
* @version 1.0.1
*
* @package woocommerce-smart-coupons/includes/compat/
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
if ( ! class_exists( 'WC_SC_Aelia_CS_Compatibility' ) ) {
/**
* Class for handling compatibility with WooCommerce Aelia Currency Switcher
*/
class WC_SC_Aelia_CS_Compatibility {
/**
* Variable to hold instance of WC_SC_Aelia_CS_Compatibility
*
* @var $instance
*/
private static $instance = null;
/**
* Constructor
*/
public function __construct() {
add_filter( 'wc_aelia_cs_coupon_types_to_convert', array( $this, 'add_smart_coupon' ) );
}
/**
* Get single instance of WC_SC_Aelia_CS_Compatibility
*
* @return WC_SC_Aelia_CS_Compatibility Singleton object of WC_SC_Aelia_CS_Compatibility
*/
public static function get_instance() {
// Check if instance is already exists.
if ( is_null( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Add discount type 'smart_coupon' in Aelia Currency Switcher's framework
*
* @param array $coupon_types Existing coupon types.
* @return array $coupon_types
*/
public function add_smart_coupon( $coupon_types = array() ) {
if ( empty( $coupon_types ) || ! is_array( $coupon_types ) ) {
return $coupon_types;
}
if ( ! in_array( 'smart_coupon', $coupon_types, true ) ) {
$coupon_types[] = 'smart_coupon';
}
return $coupon_types;
}
/**
* Check & convert price
*
* @param float $price The price need to be converted.
* @param string $to_currency The price will be converted to this currency.
* @param string $from_currency The price will be converted from this currency.
* @return float
*/
public function convert_price( $price = 0, $to_currency = null, $from_currency = null ) {
if ( empty( $from_currency ) ) {
$from_currency = get_option( 'woocommerce_currency' ); // Shop base currency.
}
if ( empty( $to_currency ) ) {
$to_currency = get_woocommerce_currency(); // Active currency.
}
return apply_filters( 'wc_aelia_cs_convert', $price, $from_currency, $to_currency );
}
}
}
WC_SC_Aelia_CS_Compatibility::get_instance();

View File

@@ -1,140 +0,0 @@
<?php
/**
* Compatibility file for Klarna Checkout for WooCommerce
*
* @author StoreApps
* @since 7.1.0
* @version 1.0.0
*
* @package woocommerce-smart-coupons/includes/compat/
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
if ( ! class_exists( 'WC_SC_KCO_Compatibility' ) ) {
/**
* Class for handling compatibility with Klarna Checkout for WooCommerce
*/
class WC_SC_KCO_Compatibility {
/**
* Variable to hold instance of WC_SC_KCO_Compatibility
*
* @var $instance
*/
private static $instance = null;
/**
* Constructor
*/
public function __construct() {
add_action( 'wp_loaded', array( $this, 'hooks_for_compatibility' ) );
}
/**
* Add compatibility related functionality
*/
public function hooks_for_compatibility() {
if ( ! function_exists( 'is_plugin_active' ) ) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}
if ( is_plugin_active( 'klarna-checkout-for-woocommerce/klarna-checkout-for-woocommerce.php' ) ) {
if ( ! class_exists( 'WC_SC_Purchase_Credit' ) ) {
include_once '../class-wc-sc-purchase-credit.php';
}
if ( class_exists( 'WC_SC_Purchase_Credit' ) ) {
$wc_sc_purchase_credit = WC_SC_Purchase_Credit::get_instance();
$form_position_hook = apply_filters( 'wc_sc_kco_coupon_receiver_detail_form_position_hook', get_option( 'wc_sc_kco_coupon_receiver_detail_form_position_hook', 'kco_wc_before_snippet' ), array( 'source' => $this ) );
add_action( $form_position_hook, array( $wc_sc_purchase_credit, 'gift_certificate_receiver_detail_form' ) );
}
add_action( 'wp_footer', array( $this, 'enqueue_styles_scripts' ), 99 );
}
}
/**
* Get single instance of WC_SC_KCO_Compatibility
*
* @return WC_SC_KCO_Compatibility Singleton object of WC_SC_KCO_Compatibility
*/
public static function get_instance() {
// Check if instance is already exists.
if ( is_null( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Handle call to functions which is not available in this class
*
* @param string $function_name Function to call.
* @param array $arguments Array of arguments passed while calling $function_name.
* @return mixed Result of function call.
*/
public function __call( $function_name, $arguments = array() ) {
global $woocommerce_smart_coupon;
if ( ! is_callable( array( $woocommerce_smart_coupon, $function_name ) ) ) {
return;
}
if ( ! empty( $arguments ) ) {
return call_user_func_array( array( $woocommerce_smart_coupon, $function_name ), $arguments );
} else {
return call_user_func( array( $woocommerce_smart_coupon, $function_name ) );
}
}
/**
* Enqueue required styles/scripts for store credit frontend form
*/
public function enqueue_styles_scripts() {
// Return if gift certificate form is not shown.
if ( ! did_action( 'wc_sc_gift_certificate_form_shown' ) ) {
return;
}
if ( ! wp_script_is( 'jquery' ) ) {
wp_enqueue_script( 'jquery' );
}
?>
<script type="text/javascript">
jQuery(function(){
if ( typeof wc_sc_ajax_save_coupon_receiver_details_in_session === 'undefined' ) {
function wc_sc_ajax_save_coupon_receiver_details_in_session(){
jQuery.ajax({
url: '<?php echo esc_url( is_callable( array( 'WC_AJAX', 'get_endpoint' ) ) ? WC_AJAX::get_endpoint( 'wc_sc_save_coupon_receiver_details' ) : '/?wc-ajax=wc_sc_save_coupon_receiver_details' ); ?>',
type: 'POST',
dataType: 'json',
data: {
security: '<?php echo esc_html( wp_create_nonce( 'wc-sc-save-coupon-receiver-details' ) ); ?>',
data: jQuery( 'form.checkout' ).serialize()
},
success: function( response ) {
if ( 'yes' !== response.success ) {
console.log('<?php echo esc_html__( 'Failed to update coupon receiver details in session.', 'woocommerce-smart-coupons' ); ?>');
}
}
});
}
}
jQuery('body').on('click', '#klarna-checkout-select-other', wc_sc_ajax_save_coupon_receiver_details_in_session);
});
</script>
<?php
}
}
}
WC_SC_KCO_Compatibility::get_instance();

View File

@@ -1,88 +0,0 @@
<?php
/**
* Compatibility file for Woo Multi Currency by VillaTheme https://wordpress.org/plugins/woo-multi-currency/
*
* @author StoreApps
* @since 4.17.0
* @version 1.0.0
*
* @package woocommerce-smart-coupons/includes/compat/
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
if ( ! class_exists( 'WC_SC_WMC_Compatibility' ) ) {
/**
* Class for handling compatibility with Woo Multi Currency
*/
class WC_SC_WMC_Compatibility {
/**
* Variable to hold instance of WC_SC_WMC_Compatibility
*
* @var $instance
*/
private static $instance = null;
/**
* Constructor
*/
private function __construct() {
add_filter( 'wc_sc_credit_called_price_order', array( $this, 'credit_called_price_order' ), 10, 2 );
add_filter( 'wc_sc_credit_called_price_cart', array( $this, 'credit_called_price_cart' ), 10, 2 );
}
/**
* Get single instance of WC_SC_WMC_Compatibility
*
* @return WC_SC_WMC_Compatibility Singleton object of WC_SC_WMC_Compatibility
*/
public static function get_instance() {
// Check if instance is already exists.
if ( is_null( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Function to modify the value of the credit called
*
* @param mized $price The price.
* @param array $args Additional arguments.
* @return mized
*/
public function credit_called_price_order( $price = 0, $args = array() ) {
if ( function_exists( 'wmc_get_price' ) ) {
$order = ( ! empty( $args['order_obj'] ) ) ? $args['order_obj'] : null;
$currency = ( is_object( $order ) && is_callable( array( $order, 'get_currency' ) ) ) ? $order->get_currency() : false;
$price = wmc_get_price( $price, $currency );
}
return $price;
}
/**
* Function to modify the value of the credit called
*
* @param mized $price The price.
* @param array $args Additional arguments.
* @return mized
*/
public function credit_called_price_cart( $price = 0, $args = array() ) {
if ( function_exists( 'wmc_get_price' ) ) {
$price = wmc_get_price( $price );
}
return $price;
}
}
}
WC_SC_WMC_Compatibility::get_instance();

View File

@@ -1,72 +0,0 @@
<?php
/**
* Compatibility file for WPML
*
* @author StoreApps
* @since 3.3.0
* @version 1.1.0
*
* @package woocommerce-smart-coupons/includes/
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
if ( ! class_exists( 'WC_SC_WPML_Compatibility' ) ) {
/**
* Class for handling compatibility with WPML
*/
class WC_SC_WPML_Compatibility {
/**
* Variable to hold instance of WC_SC_WPML_Compatibility
*
* @var $instance
*/
private static $instance = null;
/**
* Constructor
*/
public function __construct() {
add_action( 'init', array( $this, 'woocommerce_wpml_compatibility' ), 11 );
}
/**
* Get single instance of WC_SC_WPML_Compatibility
*
* @return WC_SC_WPML_Compatibility Singleton object of WC_SC_WPML_Compatibility
*/
public static function get_instance() {
// Check if instance is already exists.
if ( is_null( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Function to handle compatibility with WooCommerce Multilingual
*/
public function woocommerce_wpml_compatibility() {
global $woocommerce_wpml;
if ( class_exists( 'woocommerce_wpml' ) && $woocommerce_wpml instanceof woocommerce_wpml ) {
if ( ! empty( $woocommerce_wpml->products ) && has_action( 'woocommerce_before_checkout_process', array( $woocommerce_wpml->products, 'wcml_refresh_cart_total' ) ) ) {
remove_action( 'woocommerce_before_checkout_process', array( $woocommerce_wpml->products, 'wcml_refresh_cart_total' ) );
}
if ( ! empty( $woocommerce_wpml->cart ) && has_action( 'woocommerce_before_checkout_process', array( $woocommerce_wpml->cart, 'wcml_refresh_cart_total' ) ) ) {
remove_action( 'woocommerce_before_checkout_process', array( $woocommerce_wpml->cart, 'wcml_refresh_cart_total' ) );
}
}
}
}
}
WC_SC_WPML_Compatibility::get_instance();

View File

@@ -1,166 +0,0 @@
<?php
/**
* Compatibility file for WooCommerce One Page Checkout
*
* @author StoreApps
* @since 3.3.0
* @version 1.1.0
* @package WooCommerce Smart Coupons
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
if ( ! class_exists( 'WCOPC_SC_Compatibility' ) ) {
/**
* Class for handling compatibility with WooCommerce One Page Checkout
*/
class WCOPC_SC_Compatibility {
/**
* Variable to hold instance of WCOPC_SC_Compatibility
*
* @var $instance
*/
private static $instance = null;
/**
* Constructor
*/
public function __construct() {
add_filter( 'woocommerce_update_order_review_fragments', array( $this, 'update_order_review_fragments' ) );
add_action( 'wcopc_before_display_checkout', array( $this, 'add_styles_and_scripts' ) );
add_filter( 'wc_sc_call_for_credit_product_id', array( $this, 'call_for_credit_product_id' ), 10, 2 );
}
/**
* Get single instance of WCOPC_SC_Compatibility
*
* @return WCOPC_SC_Compatibility Singleton object of WCOPC_SC_Compatibility
*/
public static function get_instance() {
// Check if instance is already exists.
if ( is_null( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Handle call to functions which is not available in this class
*
* @param string $function_name Function to call.
* @param array $arguments Array of arguments passed while calling $function_name.
* @return mixed Result of function call.
*/
public function __call( $function_name, $arguments = array() ) {
global $woocommerce_smart_coupon;
if ( ! is_callable( array( $woocommerce_smart_coupon, $function_name ) ) ) {
return;
}
if ( ! empty( $arguments ) ) {
return call_user_func_array( array( $woocommerce_smart_coupon, $function_name ), $arguments );
} else {
return call_user_func( array( $woocommerce_smart_coupon, $function_name ) );
}
}
/**
* Generate & add coupon receiver details form in update order review fragments
*
* @param array $fragments Existing fragments.
* @return array $fragments
*/
public function update_order_review_fragments( $fragments = array() ) {
if ( ! class_exists( 'WC_SC_Purchase_Credit' ) ) {
include_once '../class-wc-sc-purchase-credit.php';
}
$wc_sc_purchase_credit = WC_SC_Purchase_Credit::get_instance();
ob_start();
$wc_sc_purchase_credit->gift_certificate_receiver_detail_form();
$fragments['wc_sc_receiver_detail_form'] = ob_get_clean();
return $fragments;
}
/**
* Add Styles And Scripts
*/
public function add_styles_and_scripts() {
if ( ! class_exists( 'WC_SC_Purchase_Credit' ) ) {
include_once '../class-wc-sc-purchase-credit.php';
}
$wc_sc_purchase_credit = WC_SC_Purchase_Credit::get_instance();
$wc_sc_purchase_credit->enqueue_timepicker();
add_action( 'wp_footer', array( $this, 'styles_and_scripts' ) );
}
/**
* Styles And Scripts
*/
public function styles_and_scripts() {
if ( ! wp_script_is( 'jquery' ) ) {
wp_enqueue_script( 'jquery' );
}
?>
<script type="text/javascript">
jQuery(function(){
jQuery(document.body).on('updated_checkout', function( e, data ){
if ( typeof data === 'undefined' ) {
return;
}
if ( data.fragments.wc_sc_receiver_detail_form ) {
if ( jQuery('div.gift-certificate.sc_info_box').length > 0 ) {
jQuery('div.gift-certificate.sc_info_box').replaceWith( data.fragments.wc_sc_receiver_detail_form );
} else {
jQuery('div#customer_details').after( data.fragments.wc_sc_receiver_detail_form );
}
} else {
jQuery('div.gift-certificate.sc_info_box').remove();
}
});
});
</script>
<?php
}
/**
* Call For Credit Product Id
*
* @param integer $product_id The product id.
* @param array $args Additional arguments.
* @return integer
*/
public function call_for_credit_product_id( $product_id = 0, $args = array() ) {
$action = ( ! empty( $_REQUEST['action'] ) ) ? wc_clean( wp_unslash( $_REQUEST['action'] ) ) : ''; // phpcs:ignore
if ( 'pp_add_to_cart' === $action && empty( $product_id ) ) {
$product_id = ( ! empty( $_REQUEST['add_to_cart'] ) ) ? absint( $_REQUEST['add_to_cart'] ) : 0; // phpcs:ignore
}
return $product_id;
}
}
}
/**
* Initialize the Compatibility
*/
function initialize_wcopc_sc_compatibility() {
WCOPC_SC_Compatibility::get_instance();
}
add_action( 'wcopc_loaded', 'initialize_wcopc_sc_compatibility' );