- WordPress core y plugins - Tema Twenty Twenty-Four configurado - Plugin allow-unfiltered-html.php simplificado - .gitignore configurado para excluir wp-config.php y uploads 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
56 lines
1.3 KiB
PHP
Executable File
56 lines
1.3 KiB
PHP
Executable File
<?php
|
|
if ( ! class_exists( 'BWF_Compatibility_With_WOOCS' ) ) {
|
|
#[AllowDynamicProperties]
|
|
class BWF_Compatibility_With_WOOCS {
|
|
|
|
public function __construct() {
|
|
|
|
}
|
|
|
|
public function is_enable() {
|
|
if ( isset( $GLOBALS['WOOCS'] ) && $GLOBALS['WOOCS'] instanceof WOOCS ) {
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
public function get_currency_symbol( $currency ) {
|
|
global $WOOCS;
|
|
$WOOCS->current_currency = $currency;
|
|
|
|
return get_woocommerce_currency_symbol( $currency );
|
|
}
|
|
|
|
/**
|
|
*
|
|
* Modifies the amount for the fixed discount given by the admin in the currency selected.
|
|
*
|
|
* @param integer|float $price
|
|
*
|
|
* @return float
|
|
*/
|
|
public function alter_fixed_amount( $price, $currency = null ) {
|
|
return $GLOBALS['WOOCS']->woocs_exchange_value( $price );
|
|
}
|
|
|
|
function get_fixed_currency_price_reverse( $price, $from = null, $base = null ) { //phpcs:ignore
|
|
$currencies = get_option( 'woocs' );
|
|
|
|
$from = ( is_null( $from ) ) ? $GLOBALS['WOOCS']->current_currency : $from;
|
|
|
|
if ( is_array( $currencies ) && ! empty( $currencies )) {
|
|
foreach ( $currencies as $key => $value ) {
|
|
if ( $key === $from ) {
|
|
$rate = $value['rate'];
|
|
$price = $price * ( 1 / $rate );
|
|
}
|
|
}
|
|
}
|
|
|
|
return $price;
|
|
}
|
|
}
|
|
|
|
BWF_Plugin_Compatibilities::register( new BWF_Compatibility_With_WOOCS(), 'woocs' );
|
|
} |