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,54 @@
<?php
class bwfan_Input_Cart_Category_Select {
public function __construct() {
// vars
$this->type = 'Cart_Category_Select';
$this->defaults = array(
'multiple' => 0,
'allow_null' => 0,
'choices' => array(),
'default_value' => array(),
'class' => '',
);
}
public function render( $field, $value = null ) {
$field = array_merge( $this->defaults, $field );
if ( ! isset( $field['id'] ) ) {
$field['id'] = sanitize_title( $field['id'] );
}
$current = isset( $value['categories'] ) ? $value['categories'] : array();
$choices = $field['choices'];
?>
<table style="width:100%;">
<tr>
<td style="width:32px;"><?php esc_html_e( 'Quantity', 'wp-marketing-automations' ); ?></td>
<td><?php esc_html_e( 'Categories', 'wp-marketing-automations' ); ?></td>
</tr>
<tr>
<td style="width:32px; vertical-align:top;">
<input type="text" id="<?php echo esc_attr( $field['id'] ); ?>_qty" name="<?php echo $field['name']; //phpcs:ignore WordPress.Security.EscapeOutput ?>[qty]" value="<?php echo isset( $value['qty'] ) ? esc_attr( sanitize_text_field( $value['qty'] ) ) : 1; ?>"/>
</td>
<td>
<select id="<?php echo esc_attr( $field['id'] ); ?>" name="<?php echo $field['name']; //phpcs:ignore WordPress.Security.EscapeOutput ?>[categories][]" class="chosen_select <?php echo esc_attr( $field['class'] ); ?>" multiple="multiple" data-placeholder="<?php echo( isset( $field['placeholder'] ) ? esc_attr( sanitize_text_field( $field['placeholder'] ) ) : esc_html__( 'Search...', 'wp-marketing-automations' ) ); ?>">
<?php
foreach ( $choices as $choice => $title ) {
$selected = in_array( $choice, $current, true );
echo '<option value="' . esc_attr( $choice ) . '" ' . selected( $selected, true, false ) . '">' . esc_html( $title ) . '</option>';
}
?>
</select>
</td>
</tr>
</table>
<?php
}
}
?>

View File

@@ -0,0 +1,70 @@
<?php
#[AllowDynamicProperties]
class BWFAN_Input_Cart_Product_Select {
public function __construct() {
// vars
$this->type = 'Cart_Product_Select';
$this->defaults = array(
'multiple' => false,
'allow_null' => 0,
'choices' => array(),
'default_value' => '',
'ajax' => 'true',
'class' => 'ajax_chosen_select_products',
);
}
public function render( $field, $value = null ) {
$field = array_merge( $this->defaults, $field );
$data_attr = '';
$chosen_class = '';
if ( ! isset( $field['id'] ) ) {
$field['id'] = sanitize_title( $field['id'] );
}
if ( true === $field['ajax'] ) {
$chosen_class = 'bwfan-select2ajax-single'; // bwfan_select2_ajax
$data_attr = 'data-search="product_search" data-search-text="' . esc_attr__( 'Select Product', 'wp-marketing-automations' ) . '"';
}
if ( ! empty( $field['rule_type'] ) ) {
$data_attr .= ' data-rule-type="' . $field['rule_type'] . '"';
}
?>
<table class="bwfan-rules-condition_qty" style="width:100%;">
<tr>
<td style="width:32px;"><?php esc_html_e( 'Quantity', 'wp-marketing-automations' ); ?></td>
<td><?php esc_html_e( 'Products', 'wp-marketing-automations' ); ?></td>
</tr>
<tr>
<td style="width:32px; vertical-align:top;">
<input type="text" id="<?php echo esc_attr( $field['id'] ); ?>_qty" name="<?php echo $field['name']; //phpcs:ignore WordPress.Security.EscapeOutput ?>[qty]" value="<?php echo isset( $value['qty'] ) ? esc_attr( sanitize_text_field( $value['qty'] ) ) : 1; ?>"/>
</td>
<td>
<select <?php echo( $data_attr ); //phpcs:ignore WordPress.Security.EscapeOutput ?> id="<?php echo esc_attr( $field['id'] ); ?>" name="<?php echo $field['name']; //phpcs:ignore WordPress.Security.EscapeOutput ?>[products]" class="<?php echo $chosen_class; ?>" data-placeholder="<?php echo( isset( $field['placeholder'] ) ? esc_attr( sanitize_text_field( $field['placeholder'] ) ) : esc_html__( 'Search...', 'wp-marketing-automations' ) ); ?>">
<option value=""><?php esc_html_e( 'Choose Product', 'wp-marketing-automations' ); ?></option>
<?php
$current = isset( $value['products'] ) ? $value['products'] : array();
$product_ids = ! empty( $current ) ? array_map( 'absint', $current ) : null;
if ( $product_ids ) {
foreach ( $product_ids as $product_id ) {
$product = wc_get_product( $product_id );
$product_name = BWFAN_WooCommerce_Compatibility::woocommerce_get_formatted_product_name( $product );
echo '<option value="' . esc_attr( $product_id ) . '" selected="selected">' . esc_html( $product_name ) . '</option>';
}
}
?>
</select>
</td>
</tr>
</table>
<?php
}
}

View File

@@ -0,0 +1,54 @@
<?php
#[AllowDynamicProperties]
class bwfan_Input_Chosen_Select {
public function __construct() {
// vars
$this->type = 'Chosen_Select';
$this->defaults = array(
'multiple' => 1,
'allow_null' => 0,
'choices' => array(),
'default_value' => array(),
'class' => '',
'ajax' => false,
'rule_type' => '',
);
}
public function render( $field, $value = null ) {
$field = array_merge( $this->defaults, $field );
$current = $value ? $value : array();
$choices = $field['choices'];
$chosen_class = 'bwfan_select2 ';
$data_attr = '';
$multiple = $field['multiple'] ? 'multiple' : '';
if ( true === $field['ajax'] ) {
$chosen_class = 'bwfan_select2_ajax ';
$data_attr = 'data-search-type="' . $field['search_type'] . '"';
}
if ( ! empty( $field['rule_type'] ) ) {
$data_attr .= ' data-rule-type="' . $field['rule_type'] . '"';
}
?>
<select <?php echo( $data_attr ); //phpcs:ignore WordPress.Security.EscapeOutput ?> id="<?php echo esc_attr( $field['id'] ); ?>" name="<?php echo $field['name']; //phpcs:ignore WordPress.Security.EscapeOutput ?>[]" class="<?php echo esc_attr( $chosen_class ) . esc_attr( $field['class'] ); ?>" <?php echo esc_attr( $multiple ); ?> data-placeholder="<?php echo( isset( $field['placeholder'] ) ? esc_attr( sanitize_text_field( $field['placeholder'] ) ) : esc_html__( 'Search...', 'wp-marketing-automations' ) ); ?>">
<?php
foreach ( $choices as $choice => $title ) {
$selected = in_array( $choice, $current, true );
echo '<option value="' . ( esc_attr( $choice ) ) . '" ' . selected( $selected, true, false ) . '>' . esc_html( $title ) . '</option>';
}
?>
</select>
<?php
}
}
?>

View File

@@ -0,0 +1,20 @@
<?php
class bwfan_Input_Date extends bwfan_Input_Text {
public function __construct() {
$this->type = 'Date';
parent::__construct();
}
public function render( $field, $value = null ) {
$field = array_merge( $this->defaults, $field );
if ( ! isset( $field['id'] ) ) {
$field['id'] = sanitize_title( $field['id'] );
}
echo '<input name="' . $field['name'] . '" type="text" id="' . esc_attr( $field['id'] ) . '" class="bwfan-date-picker-field' . esc_attr( $field['class'] ) . '" placeholder="' . esc_attr( $field['placeholder'] ) . '" value="' . $value . '" />'; //phpcs:ignore WordPress.Security.EscapeOutput
}
}

View File

@@ -0,0 +1,44 @@
<?php
class bwfan_Input_Geo_Postal_Code_Entry {
public function __construct() {
// vars
$this->type = 'Geo_Postal_Code_Entry';
$this->defaults = array(
'multiple' => 0,
'allow_null' => 0,
'choices' => array(),
'default_value' => '',
'class' => '',
'placeholder' => '',
);
}
public function render( $field, $value = null ) {
$field = array_merge( $this->defaults, $field );
if ( ! isset( $field['id'] ) ) {
$field['id'] = sanitize_title( $field['id'] );
}
?>
<table style="width:100%;">
<tr>
<td style="width:162px;"><?php esc_html_e( 'Distance ( km )', 'wp-marketing-automations' ); ?></td>
<td><?php esc_html_e( 'Zip/Postalcode ( One per line )', 'wp-marketing-automations' ); ?></td>
</tr>
<tr>
<td style="width:162px; vertical-align:top;">
<input type="text" id="<?php echo esc_attr( $field['id'] ); ?>_qty" name="<?php echo $field['name']; //phpcs:ignore WordPress.Security.EscapeOutput ?>[qty]" value="<?php echo isset( $value['qty'] ) ? esc_attr( sanitize_text_field( $value['qty'] ) ) : 1; ?>"/>
</td>
<td>
<?php echo '<textarea style="width:100%" rows="20" name="' . $field['name'] . '[codes]" type="text" id="' . esc_attr( $field['id'] ) . '" class="' . esc_attr( $field['class'] ) . '" placeholder="' . esc_attr( $field['placeholder'] ) . '">' . esc_textarea( $value['codes'] ) . '</textarea>'; //phpcs:ignore WordPress.Security.EscapeOutput ?>
</td>
</td>
</tr>
</table>
<?php
}
}

View File

@@ -0,0 +1,19 @@
<?php
class bwfan_Input_Html_Always {
public function __construct() {
// vars
$this->type = 'Html_Always';
$this->defaults = array(
'default_value' => '',
'class' => '',
'placeholder' => '',
);
}
public function render( $field, $value = null ) {
esc_html_e( 'Funnel will run on every order on your store. This will override any other rule you define.', 'wp-marketing-automations' );
}
}

View File

@@ -0,0 +1,19 @@
<?php
class bwfan_Input_Html_Rule_Is_Downgrade {
public function __construct() {
// vars
$this->type = 'Html_Rule_Is_Downgrade';
$this->defaults = array(
'default_value' => '',
'class' => '',
'placeholder' => '',
);
}
public function render( $field, $value = null ) {
esc_html_e( 'This Funnel will initiate on orders that have downgraded subscriptions.', 'wp-marketing-automations' );
}
}

View File

@@ -0,0 +1,19 @@
<?php
class bwfan_Input_Html_Rule_Is_First_Order {
public function __construct() {
// vars
$this->type = 'Html_Rule_Is_First_Order';
$this->defaults = array(
'default_value' => '',
'class' => '',
'placeholder' => '',
);
}
public function render( $field, $value = null ) {
esc_html_e( 'This Funnel will initiate on very first order for the customer.', 'wp-marketing-automations' );
}
}

View File

@@ -0,0 +1,19 @@
<?php
class bwfan_Input_Html_Rule_Is_Guest {
public function __construct() {
// vars
$this->type = 'Html_Rule_Is_Guest';
$this->defaults = array(
'default_value' => '',
'class' => '',
'placeholder' => '',
);
}
public function render( $field, $value = null ) {
esc_html_e( 'This Funnel will initiate on guest orders.', 'wp-marketing-automations' );
}
}

View File

@@ -0,0 +1,19 @@
<?php
class bwfan_Input_Html_Rule_Is_Renewal {
public function __construct() {
// vars
$this->type = 'Html_Rule_Is_Renewal';
$this->defaults = array(
'default_value' => '',
'class' => '',
'placeholder' => '',
);
}
public function render( $field, $value = null ) {
esc_html_e( 'This Funnel will initiate on orders that are renewals.', 'wp-marketing-automations' );
}
}

View File

@@ -0,0 +1,19 @@
<?php
class bwfan_Input_Html_Rule_Is_Upgrade {
public function __construct() {
// vars
$this->type = 'Html_Rule_Is_Upgrade';
$this->defaults = array(
'default_value' => '',
'class' => '',
'placeholder' => '',
);
}
public function render( $field, $value = null ) {
esc_html_e( 'This Page will show on orders that have upgraded subscriptions.', 'wp-marketing-automations' );
}
}

View File

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

View File

@@ -0,0 +1,38 @@
<?php
class bwfan_Input_Order_State_Select {
public function __construct() {
// vars
$this->type = 'Order_State_Select';
$this->defaults = array(
'multiple' => 0,
'allow_null' => 0,
'choices' => array(),
'default_value' => array(),
'class' => '',
);
}
public function render( $field, $value = null ) {
$field = array_merge( $this->defaults, $field );
if ( ! isset( $field['id'] ) ) {
$field['id'] = sanitize_title( $field['id'] );
}
$chosen_states = $value;
?>
<select id="<?php echo esc_attr( $field['id'] ); ?>" name="<?php echo $field['name']; //phpcs:ignore WordPress.Security.EscapeOutput ?>[states][]" class="chosen_select <?php echo esc_attr( $field['class'] ); ?>" multiple="multiple" data-placeholder="<?php echo( isset( $field['placeholder'] ) ? esc_attr( sanitize_text_field( $field['placeholder'] ) ) : esc_html__( 'Search...', 'wp-marketing-automations' ) ); ?>">
<?php
WC()->countries->country_dropdown_options( '', $chosen_states );
?>
</select>
<?php
}
}
?>

View File

@@ -0,0 +1,40 @@
<?php
class bwfan_Input_Page_Select extends bwfan_Input_Text {
public function __construct() {
// vars
$this->type = 'Page_Select';
$this->defaults = array(
'multiple' => 0,
'allow_null' => 0,
'choices' => array(),
'default_value' => '',
'class' => 'ajax_chosen_select_products',
);
}
public function render( $field, $value = null ) {
$field = array_merge( $this->defaults, $field );
if ( ! isset( $field['id'] ) ) {
$field['id'] = sanitize_title( $field['id'] );
}
$args = array(
'name' => $field['name'],
'id' => $field['id'],
'sort_column' => 'menu_order',
'sort_order' => 'ASC',
'show_option_none' => ' ',
'class' => '',
'echo' => false,
'selected' => absint( $value ),
);
echo wp_dropdown_pages( $args ); //phpcs:ignore WordPress.Security.EscapeOutput
}
}

View File

@@ -0,0 +1,49 @@
<?php
class bwfan_Input_Product_Select {
public function __construct() {
// vars
$this->type = 'Product_Select';
$this->defaults = array(
'multiple' => 0,
'allow_null' => 0,
'choices' => array(),
'default_value' => '',
'class' => 'ajax_chosen_select_products',
);
}
public function render( $field, $value = null ) {
$field = array_merge( $this->defaults, $field );
if ( ! isset( $field['id'] ) ) {
$field['id'] = sanitize_title( $field['id'] );
}
?>
<select id="<?php echo esc_attr( $field['id'] ); ?>" name="<?php echo esc_attr( $field['name'] ); //phpcs:ignore WordPress.Security.EscapeOutput ?>[]" class="ajax_chosen_select_products" data-placeholder="<?php esc_html_e( 'Search for a product&hellip;', 'woocommerce' ); // phpcs:ignore WordPress.WP.I18n.TextDomainMismatch ?>">
<?php
$current = $value ? $value : array();
$product_ids = ! empty( $current ) ? array_map( 'absint', $current ) : null;
if ( $product_ids ) {
foreach ( $product_ids as $product_id ) {
$product = wc_get_product( $product_id );
$product_name = BWFAN_WooCommerce_Compatibility::woocommerce_get_formatted_product_name( $product );
echo '<option value="' . esc_attr( $product_id ) . '" selected="selected">' . esc_html( $product_name ) . '</option>';
}
}
?>
</select>
<?php
}
}
?>

View File

@@ -0,0 +1,98 @@
<?php
#[AllowDynamicProperties]
class bwfan_Input_Select {
public function __construct() {
// vars
$this->type = 'Select';
$this->defaults = array(
'multiple' => 0,
'allow_null' => 0,
'choices' => array(),
'default_value' => '',
'class' => '',
'null_text' => __( '- Select -', 'wp-marketing-automations' ),
'disabled' => false,
);
}
public function render( $field, $value = null ) {
$field = array_merge( $this->defaults, $field );
$field['value'] = $value;
$optgroup = false;
// determine if choices are grouped (2 levels of array)
if ( is_array( $field['choices'] ) ) {
foreach ( $field['choices'] as $v ) {
if ( is_array( $v ) ) {
$optgroup = true;
}
}
}
// value must be array
if ( ! is_array( $field['value'] ) ) {
// perhaps this is a default value with new lines in it?
if ( ! is_null( $field['value'] ) && strpos( $field['value'], "\n" ) !== false ) {
// found multiple lines, explode it
$field['value'] = explode( "\n", $field['value'] );
} else {
$field['value'] = array( $field['value'] );
}
}
// trim value
$field['value'] = array_map( function ( $value ) {
return ! is_null( $value ) ? trim( $value ) : $value;
}, $field['value'] );
$multiple = '';
if ( $field['multiple'] ) {
$multiple = ' multiple="multiple" size="5" ';
$field['name'] .= '[]';
}
$disabled = '';
if ( true === $field['disabled'] ) {
$disabled = 'disabled';
}
echo '<select ' . esc_attr( $disabled ) . ' id="' . esc_attr( $field['id'] ) . '" class="' . esc_attr( $field['class'] ) . '" name="' . $field['name'] . '" ' . $multiple . ' >'; //phpcs:ignore WordPress.Security.EscapeOutput
// null
if ( $field['allow_null'] ) {
echo '<option value="null"> ' . esc_attr( $field['null_text'] ) . ' </option>';
}
// loop through values and add them as options
if ( is_array( $field['choices'] ) ) {
foreach ( $field['choices'] as $key => $value ) {
if ( $optgroup ) {
// this select is grouped with optgroup
if ( '' !== $key ) {
echo '<optgroup label="' . esc_attr( $key ) . '">';
}
if ( is_array( $value ) ) {
foreach ( $value as $id => $label ) {
$selected = in_array( $id, $field['value'], true ) ? 'selected="selected"' : '';
echo '<option value="' . esc_attr( $id ) . '" ' . $selected . '>' . esc_html( $label ) . '</option>'; //phpcs:ignore WordPress.Security.EscapeOutput
}
}
if ( '' !== $key ) {
echo '</optgroup>';
}
} else {
$selected = in_array( $key, $field['value'], true ) ? 'selected="selected"' : '';
echo '<option value="' . esc_attr( $key ) . '" ' . $selected . '>' . esc_html( $value ) . '</option>'; //phpcs:ignore WordPress.Security.EscapeOutput
}
}
}
echo '</select>';
}
}

View File

@@ -0,0 +1,39 @@
<?php
class bwfan_Input_Term_Select extends bwfan_Input_Text {
public function __construct() {
// vars
$this->type = 'Term_Select';
$this->defaults = array(
'multiple' => 0,
'allow_null' => 0,
'choices' => array(),
'default_value' => '',
'class' => '',
);
}
public function render( $field, $value = null ) {
$field = array_merge( $this->defaults, $field );
if ( ! isset( $field['id'] ) ) {
$field['id'] = sanitize_title( $field['id'] );
}
$args = array(
'name' => $field['name'],
'id' => $field['id'],
'show_option_none' => __( 'Select category', 'wp-marketing-automations' ),
'show_count' => 0,
'orderby' => 'name',
'echo' => 0,
'taxonomy' => 'product_cat',
'selected' => absint( $value ),
);
echo wp_dropdown_categories( $args ); //phpcs:ignore WordPress.Security.EscapeOutput
}
}

View File

@@ -0,0 +1,33 @@
<?php
#[AllowDynamicProperties]
class bwfan_Input_Text {
public function __construct() {
// vars
$this->type = 'Text';
$this->defaults = array(
'default_value' => '',
'class' => '',
'placeholder' => '',
'disabled' => false,
);
}
public function render( $field, $value = null ) {
$field = array_merge( $this->defaults, $field );
if ( ! isset( $field['id'] ) ) {
$field['id'] = sanitize_title( $field['id'] );
}
$disabled = '';
if ( true === $field['disabled'] ) {
$disabled = 'disabled';
}
/** Don't add any escaping method on name field as it will break the dynamic backbone string */
echo '<input ' . esc_attr( $disabled ) . ' name="' . $field['name'] . '" type="text" id="' . esc_attr( $field['id'] ) . '" class="' . esc_html( $field['class'] ) . '" placeholder="' . esc_html( $field['placeholder'] ) . '" value="' . $value . '" />'; //phpcs:ignore WordPress.Security.EscapeOutput, WordPress.Security.EscapeOutput
}
}

View File

@@ -0,0 +1,20 @@
<?php
class bwfan_Input_Time extends bwfan_Input_Text {
public function __construct() {
$this->type = 'Time';
parent::__construct();
}
public function render( $field, $value = null ) {
$field = array_merge( $this->defaults, $field );
if ( ! isset( $field['id'] ) ) {
$field['id'] = sanitize_title( $field['id'] );
}
$value = ( null === $value ) ? '00:00' : $value;
echo '<input placeholder="For eg: 23:59" name="' . $field['name'] . '" type="time" id="' . esc_attr( $field['id'] ) . '" class="bwfan-time-picker-field' . esc_attr( $field['class'] ) . '" placeholder="' . esc_attr( $field['placeholder'] ) . '" value="' . $value . '" />'; //phpcs:ignore WordPress.Security.EscapeOutput, WordPress.Security.EscapeOutput
}
}