Commit inicial - WordPress Análisis de Precios Unitarios

- 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>
This commit is contained in:
root
2025-11-03 21:04:30 -06:00
commit a22573bf0b
24068 changed files with 4993111 additions and 0 deletions

View File

@@ -0,0 +1,71 @@
<?php
if ( ! class_exists( 'BWFAN_Compatibility_With_Aelia_CS' ) ) {
class BWFAN_Compatibility_With_Aelia_CS {
public function __construct() {
add_filter( 'bwfan_ab_cart_total_base', [ $this, 'save_base_price_in_database' ] );
add_filter( 'bwfan_abandoned_cart_restore_link', [ $this, 'add_currency_parameter_in_url' ], 99, 2 );
}
public function save_base_price_in_database( $price ) {
$price = $this->get_price_in_currency( $price, get_option( 'woocommerce_currency' ), get_woocommerce_currency() );
return wc_format_decimal( $price, wc_get_price_decimals() );
}
/**
* Basic integration with WooCommerce Currency Switcher, developed by Aelia
* (http://aelia.co). This method can be used by any 3rd party plugin to
* return prices converted to the active currency.
*
* Need a consultation? Find us on Codeable: https://aelia.co/hire_us
*
* @param double price The source price.
* @param string to_currency The target currency. If empty, the active currency
* will be taken.
* @param string from_currency The source currency. If empty, WooCommerce base
* currency will be taken.
*
* @return double The price converted from source to destination currency.
* @author Aelia <support@aelia.co>
* @link https://aelia.co
*/
public function get_price_in_currency( $price, $to_currency = null, $from_currency = null ) {
// If source currency is not specified, take the shop's base currency as a default
if ( empty( $from_currency ) ) {
$from_currency = get_option( 'woocommerce_currency' );
}
// If target currency is not specified, take the active currency as a default.
// The Currency Switcher sets this currency automatically, based on the context. Other
// plugins can also override it, based on their own custom criteria, by implementing
// a filter for the "woocommerce_currency" hook.
//
// For example, a subscription plugin may decide that the active currency is the one
// taken from a previous subscription, because it's processing a renewal, and such
// renewal should keep the original prices, in the original currency.
if ( empty( $to_currency ) ) {
$to_currency = get_woocommerce_currency();
}
// Call the currency conversion filter. Using a filter allows for loose coupling. If the
// Aelia Currency Switcher is not installed, the filter call will return the original
// amount, without any conversion being performed. Your plugin won't even need to know if
// the multi-currency plugin is installed or active
return apply_filters( 'wc_aelia_cs_convert', $price, $from_currency, $to_currency );
}
public function add_currency_parameter_in_url( $url, $token ) {
global $wpdb;
$currency = $wpdb->get_var( $wpdb->prepare( "SELECT currency FROM {$wpdb->prefix}bwfan_abandonedcarts WHERE `token` = %s", $token ) ); //phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
$url = add_query_arg( array(
'aelia_cs_currency' => $currency,
), $url );
return $url;
}
}
new BWFAN_Compatibility_With_Aelia_CS();
}

View File

@@ -0,0 +1,32 @@
<?php
/**
* WooFunnels Checkout
* https://wordpress.org/plugins/funnel-builder/
* https://funnelkit.com/wordpress-funnel-builder/
*/
if ( ! class_exists( 'BWFAN_Compatibility_With_Aero_Checkout' ) ) {
class BWFAN_Compatibility_With_Aero_Checkout {
public function __construct() {
add_filter( 'bwfan_get_global_settings', [ $this, 'disable_abandonment' ], 99 );
}
/**
* Disable cart abandonment tracking on checkout admin builder pages
*
* @param $global_settings
*
* @return mixed
*/
public function disable_abandonment( $global_settings ) {
if ( true === WFACP_Common::is_theme_builder() ) {
$global_settings['bwfan_ab_enable'] = 0;
}
return $global_settings;
}
}
new BWFAN_Compatibility_With_Aero_Checkout();
}

View File

@@ -0,0 +1,33 @@
<?php
/**
* Bonanza
* https://wordpress.org/plugins/bonanza-woocommerce-free-gifts-lite/
*/
if ( ! class_exists( 'BWFAN_Compatibility_With_Bonanza' ) ) {
class BWFAN_Compatibility_With_Bonanza {
public function __construct() {
add_filter( 'bwfan_exclude_cart_items_to_restore', [ $this, 'exclude_gifts' ], 99, 3 );
}
/**
* Excluding restoring gift products
*
* @param $bool
* @param $key
* @param $data
*
* @return bool|mixed
*/
public function exclude_gifts( $bool, $key, $data ) {
if ( isset( $data['xlwcfg_gift_id'] ) ) {
$bool = true;
}
return $bool;
}
}
new BWFAN_Compatibility_With_Bonanza();
}

View File

@@ -0,0 +1,96 @@
<?php
/**
* Handle UTM Grabber
* By Haktan Suren
* https://wordpress.org/plugins/handl-utm-grabber/
*/
if ( ! class_exists( 'BWFAN_Compatibility_With_Handle_UTM_Grabber' ) ) {
class BWFAN_Compatibility_With_Handle_UTM_Grabber {
public function __construct() {
add_filter( 'bwfan_ab_default_checkout_nice_names', array( $this, 'bwfan_set_handle_utm_field' ), 9, 1 );
add_action( 'bwfan_ab_handle_checkout_data_externally', array( $this, 'bwfan_set_handle_utm_cookie' ), 9, 1 );
/** additional data in case of handle_utm_grabber plugin is active for abandoned cart **/
add_filter( 'bwfan_ab_change_checkout_data_for_external_use', array( $this, 'bwfan_populate_utm_grabber_data_cart' ), 999, 1 );
}
/**
* Set handle_utm_grabber key in checkout field nice name
*
* @param $fields
*
* @return mixed
*/
public function bwfan_set_handle_utm_field( $fields ) {
$fields['handle_utm_grabber'] = __( 'Handle UTM Grabber', 'wp-marketing-automations' );
return $fields;
}
/**
* Set handle UTM data in cookies on cart restore
*
* @param $checkout_data
*/
public function bwfan_set_handle_utm_cookie( $checkout_data ) {
if ( ! isset( $checkout_data['fields']['handle_utm_grabber'] ) || empty( $checkout_data['fields']['handle_utm_grabber'] ) ) {
return;
}
$handle_utm_grabber = $checkout_data['fields']['handle_utm_grabber'];
$field_array = array( 'utm_source', 'utm_campaign', 'utm_term', 'utm_medium', 'utm_content' );
foreach ( $handle_utm_grabber as $utm_key => $value ) {
if ( ! in_array( $utm_key, $field_array, true ) ) {
continue;
}
$cookie_field = $handle_utm_grabber[ $utm_key ];
$domain = isset( $_SERVER["SERVER_NAME"] ) ? $_SERVER["SERVER_NAME"] : '';
if ( strtolower( substr( $domain, 0, 4 ) ) == 'www.' ) {
$domain = substr( $domain, 4 );
}
if ( substr( $domain, 0, 1 ) != '.' && $domain != "localhost" && $domain != "handl-sandbox" ) {
$domain = '.' . $domain;
}
setcookie( $utm_key, $cookie_field, time() + 60 * 60 * 24 * 30, '/', $domain );
}
}
/**
* passing grabber utm data to cart abandoned
*/
public function bwfan_populate_utm_grabber_data_cart( $data ) {
$utm_keys = [
'utm_campaign',
'utm_source',
'utm_term',
'utm_medium',
'utm_content',
'gclid',
'handl_original_ref',
'handl_device',
'handl_browser',
'handl_landing_page',
'handl_ip',
'handl_ref',
'handl_url',
];
$handle_utm_grabber_data = array();
foreach ( $utm_keys as $key ) {
if ( ! isset( $_COOKIE[ $key ] ) || empty( $_COOKIE[ $key ] ) ) {
continue;
}
$handle_utm_grabber_data[ $key ] = $_COOKIE[ $key ];
}
$data['handle_utm_grabber'] = $handle_utm_grabber_data;
return apply_filters( 'bwfan_external_handl_utm_grabber_data', $data );
}
}
new BWFAN_Compatibility_With_Handle_UTM_Grabber();
}

View File

@@ -0,0 +1,51 @@
<?php
/**
* UTM Leads Tracker - XLPlugins
* https://wordpress.org/plugins/utm-leads-tracker-lite/
*/
if ( ! class_exists( 'BWFAN_Compatibility_With_UTM_Leads_Tracker' ) ) {
class BWFAN_Compatibility_With_UTM_Leads_Tracker {
public function __construct() {
add_filter( 'bwfan_ab_change_checkout_data_for_external_use', array( $this, 'bwfan_populate_utm_lead_data_cart' ), 99 );
add_action( 'bwfan_ab_handle_checkout_data_externally', array( $this, 'bwfan_set_utm_lead_cookie' ), 9 );
}
/**
* Set XL UTM data in cookies on cart restore
*
* @param $checkout_data
*/
public function bwfan_set_utm_lead_cookie( $checkout_data ) {
if ( ! isset( $checkout_data['xlutm_data'] ) || empty( $checkout_data['xlutm_data'] ) ) {
return;
}
$xlutm_data = $checkout_data['xlutm_data'];
$cookie_val = json_encode( $xlutm_data );
$secure = is_ssl();
setcookie( 'xlutm_params_utm', $cookie_val, time() + YEAR_IN_SECONDS, COOKIEPATH, COOKIE_DOMAIN, $secure, true );
}
/**
* Append UTM data from cookies to the cart
*
* @param $abandoned_data
*
* @return mixed
*/
public function bwfan_populate_utm_lead_data_cart( $abandoned_data ) {
if ( ! isset( $_COOKIE['xlutm_params_utm'] ) ) {
return $abandoned_data;
}
$abandoned_data['xlutm_data'] = json_decode( stripslashes( $_COOKIE['xlutm_params_utm'] ), true );
return $abandoned_data;
}
}
new BWFAN_Compatibility_With_UTM_Leads_Tracker();
}

View File

@@ -0,0 +1,72 @@
<?php
/**
* Multi-currency for WooCommerce
* By VillaTheme
* https://wordpress.org/plugins/woo-multi-currency/
*/
if ( ! class_exists( 'BWFAN_Compatibility_With_WC_Multi_Currency_Villatheme' ) ) {
class BWFAN_Compatibility_With_WC_Multi_Currency_Villatheme {
public function __construct() {
add_filter( 'bwfan_ab_cart_total_base', [ $this, 'save_base_price_in_database' ] );
add_filter( 'bwfan_abandoned_cart_restore_link', [ $this, 'add_currency_parameter_in_url' ], 99, 2 );
}
/**
* Modify the cart total price
*
* @param $price
*
* @return float|string
*/
public function save_base_price_in_database( $price ) {
$setting = false;
if ( class_exists( 'WOOMULTI_CURRENCY_F_Data' ) ) {
$setting = new WOOMULTI_CURRENCY_F_Data();
}
if ( class_exists( 'WOOMULTI_CURRENCY_Data' ) ) {
$setting = new WOOMULTI_CURRENCY_Data();
}
if ( false === $setting ) {
return wc_format_decimal( $price, wc_get_price_decimals() );
}
$selected_currencies = $setting->get_list_currencies();
$current_currency = $setting->get_current_currency();
if ( isset( $selected_currencies[ $current_currency ] ) ) {
$price = $price / $selected_currencies[ $current_currency ]['rate'];
}
return wc_format_decimal( $price, wc_get_price_decimals() );
}
/**
* Append currency in the restore link
*
* @param $url
* @param $token
*
* @return string
*/
public function add_currency_parameter_in_url( $url, $token ) {
global $wpdb;
$currency = $wpdb->get_var( $wpdb->prepare( "SELECT `currency` FROM {$wpdb->prefix}bwfan_abandonedcarts WHERE `token` = %s", $token ) ); //phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
if ( empty( $currency ) ) {
return $url;
}
$url = add_query_arg( array(
'wmc-currency' => $currency,
), $url );
return $url;
}
}
new BWFAN_Compatibility_With_WC_Multi_Currency_Villatheme();
}

View File

@@ -0,0 +1,2 @@
<?php
// Silence is golden.