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,138 @@
<?php
#[AllowDynamicProperties]
final class BWFAN_ADV_Lifetime_Credit_Limit_Exceed extends BWFAN_Event {
private static $instance = null;
public $total_credit = null;
public $user_id = null;
public $email = null;
private $type = null;
private function __construct() {
$this->optgroup_label = esc_html__( 'Advanced Coupons', 'wp-marketing-automations-pro' );
$this->event_name = esc_html__( 'Lifetime Store Credit Reached', 'wp-marketing-automations-pro' );
$this->event_desc = esc_html__( 'This event will run if life time store credits crossed specific amount ', 'wp-marketing-automations-pro' );
$this->event_merge_tag_groups = array( 'bwf_contact', 'wc_order' );
$this->event_rule_groups = array(
'wc_order',
'aerocheckout',
'bwf_contact_segments',
'bwf_contact',
'bwf_contact_fields',
'bwf_contact_user',
'bwf_contact_wc',
'bwf_contact_geo',
'bwf_engagement',
'bwf_broadcast',
'store_credit',
);
$this->support_lang = true;
$this->v2 = true;
$this->support_v1 = false;
}
public static function get_instance() {
if ( null === self::$instance ) {
self::$instance = new self();
}
return self::$instance;
}
public function load_hooks() {
add_action( 'acfw_create_store_credit_entry', [ $this, 'process' ] );
}
public function process( $entry ) {
if ( isset( $entry['type'] ) && 'decrease' === $entry['type'] ) {
return;
}
if ( ! isset( $entry['user_id'] ) || 0 === intval( $entry['user_id'] ) ) {
return;
}
$data = $this->get_default_data();
$data['user_id'] = intval( $entry['user_id'] );
$data['amount'] = floatval( $entry['amount'] );
$data['type'] = $entry['type'];
$this->send_async_call( $data );
}
public function get_event_data() {
$data_to_send['global']['amount'] = $this->total_credit;
$data_to_send['global']['user_id'] = $this->user_id;
$data_to_send['global']['type'] = $this->type;
return $data_to_send;
}
/**
* validate v2 event settings
* @return bool
*/
public function validate_v2_event_settings( $automation_data ) {
$credits = BWFAN_ADV_Coupon_Source::get_user_credits( $automation_data['user_id'] );
$total_credit = ! empty( $credits ) && isset( $credits['increase'] ) ? $credits['increase'] : 0;
return ( floatval( $automation_data['event_meta']['bwfan_limit_amount'] ) < floatval( $total_credit ) );
}
/**
* Capture the async data for the current event.
*
* @return array|bool
*/
public function capture_v2_data( $automation_data ) {
$user = get_user_by( 'id', $automation_data['user_id'] );
if ( ! $user instanceof WP_User ) {
return $automation_data;
}
$this->user_id = BWFAN_Common::$events_async_data['user_id'];
$this->type = BWFAN_Common::$events_async_data['type'];
$credits = BWFAN_ADV_Coupon_Source::get_user_credits( $this->user_id );
$this->total_credit = ! empty( $credits ) && isset( $credits['increase'] ) ? $credits['increase'] : 0;
$this->email = $user->user_email;
$automation_data['amount'] = $this->total_credit;
$automation_data['user_id'] = $this->user_id;
$automation_data['type'] = $this->type;
$automation_data['email'] = $this->email;
$automation_data['first_name'] = $user->first_name;
$automation_data['last_name'] = $user->last_name;
return $automation_data;
}
/**
* v2 Method: Get fields schema
*
* @return array[][]
*/
public function get_fields_schema() {
return [
[
'id' => 'bwfan_limit_amount',
'type' => 'text',
'label' => __( 'Amount', 'wp-marketing-automations-pro' ),
"class" => 'bwfan-input-wrapper',
"placeholder" => __( 'Amount', 'wp-marketing-automations-pro' ),
"required" => true,
"errorMsg" => __( 'Enter amount.', 'wp-marketing-automations-pro' ),
"description" => ""
],
];
}
}
/**
* Register this event to a source.
* This will show the current event in dropdown in single automation screen.
*/
if ( bwfan_is_woocommerce_active() && bwfan_is_advanced_coupon_for_woocommerce_active() ) {
return 'BWFAN_ADV_Lifetime_Credit_Limit_Exceed';
}

View File

@@ -0,0 +1,147 @@
<?php
#[AllowDynamicProperties]
final class BWFAN_ADV_Coupons_Store_credits_update extends BWFAN_Event {
private static $instance = null;
public $total_credit = null;
public $user_id = null;
public $email = null;
private $credit_type = [];
private function __construct() {
$this->optgroup_label = esc_html__( 'Advanced Coupons', 'wp-marketing-automations-pro' );
$this->event_name = esc_html__( 'Store Credits Updated', 'wp-marketing-automations-pro' );
$this->event_desc = esc_html__( 'This event will run if store credit is updated ', 'wp-marketing-automations-pro' );
$this->event_merge_tag_groups = array( 'bwf_contact', 'wc_order' );
$this->event_rule_groups = array(
'wc_order',
'aerocheckout',
'bwf_contact_segments',
'bwf_contact',
'bwf_contact_fields',
'bwf_contact_user',
'bwf_contact_wc',
'bwf_contact_geo',
'bwf_engagement',
'bwf_broadcast',
'store_credit',
);
$this->priority = 100;
$this->optgroup_priority = 25;
$this->support_lang = true;
$this->credit_type = [
'both' => __( 'Both', 'wp-marketing-automations-pro' ),
'increase' => __( 'Increase', 'wp-marketing-automations-pro' ),
'decrease' => __( 'Decrease', 'wp-marketing-automations-pro' ),
];
$this->v2 = true;
$this->support_v1 = false;
}
public static function get_instance() {
if ( null === self::$instance ) {
self::$instance = new self();
}
return self::$instance;
}
public function load_hooks() {
add_action( 'acfw_store_credits_total_changed', [ $this, 'process' ], 10, 1 );
}
public function process( $entry ) {
$data = $this->get_default_data();
$data['amount'] = $entry->get_prop( 'amount' );
$data['user_id'] = $entry->get_prop( 'user_id' );
$data['credit_type'] = $entry->get_prop( 'type' );
$this->send_async_call( $data );
}
public function get_event_data() {
$data_to_send['global']['amount'] = $this->total_credit;
$data_to_send['global']['user_id'] = $this->user_id;
$data_to_send['global']['credit_type'] = $this->credit_type;
return $data_to_send;
}
/**
* validate v2 event settings
* @return bool
*/
public function validate_v2_event_settings( $automation_data ) {
if ( 'both' === $automation_data['event_meta']['bwfan_credit_type'] || $automation_data['credit_type'] === $automation_data['event_meta']['bwfan_credit_type'] ) {
return true;
}
return false;
}
/**
* Capture the async data for the current event.
* @return array|bool
*/
public function capture_v2_data( $automation_data ) {
$this->user_id = BWFAN_Common::$events_async_data['user_id'];
$user = get_user_by( 'id', $this->user_id );
if ( ! $user instanceof WP_User ) {
return $automation_data;
}
$this->credit_type = BWFAN_Common::$events_async_data['credit_type'];
$credits = BWFAN_ADV_Coupon_Source::get_user_credits( $this->user_id );
$this->total_credit = ! empty( $credits ) && isset( $credits['increase'] ) ? $credits['increase'] : 0;
$this->email = $user->user_email;
$automation_data['amount'] = $this->total_credit;
$automation_data['user_id'] = $this->user_id;
$automation_data['credit_type'] = $this->credit_type;
$automation_data['email'] = $this->email;
$automation_data['first_name'] = $user->first_name;
$automation_data['last_name'] = $user->last_name;
return $automation_data;
}
/**
* v2 Method: Get fields schema
* @return array[][]
*/
public function get_fields_schema() {
$credit_type = BWFAN_Common::prepared_field_options( $this->credit_type );
return [
[
'id' => 'bwfan_credit_type',
'type' => 'wp_select',
'options' => $credit_type,
'label' => __( 'Credit Type', 'wp-marketing-automations-pro' ),
"class" => 'bwfan-input-wrapper',
"placeholder" => 'Select',
"required" => true,
"errorMsg" => __( "Select Store Credit.", 'wp-marketing-automations-pro' ),
"description" => ""
],
];
}
/** set default values */
public function get_default_values() {
return [
'bwfan_credit_type' => 'both',
];
}
}
/**
* Register this event to a source.
* This will show the current event in dropdown in single automation screen.
*/
if ( bwfan_is_woocommerce_active() && bwfan_is_advanced_coupon_for_woocommerce_active() ) {
return 'BWFAN_ADV_Coupons_Store_credits_update';
}

View File

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