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,115 @@
<?php
defined( 'ABSPATH' ) || exit;
global $wp_locale;
$global_settings = BWFAN_Common::get_global_settings();
$required = ! empty( $wfacp_id ) || ! isset( $global_settings['bwfan_dob_required'] ) ? $required : $global_settings['bwfan_dob_required'];
if ( empty( $birthday_label ) ) {
$birthday_label = ! empty( $global_settings['bwfan_birthday_field_label'] ) ? $global_settings['bwfan_birthday_field_label'] : __( 'Date of Birth', 'wp-marketing-automations-pro' );
}
$birthday_date = '';
$selected_date = '';
$selected_month = '';
$selected_year = '';
$plugin_version = defined( 'BWFAN_VERSION' ) ? BWFAN_VERSION : '0.0.0';
$use_dropdown_ui = version_compare( $plugin_version, '3.5.3', '>' );
if ( is_user_logged_in() ) {
$user = get_user_by( 'id', get_current_user_id() );
$contact = new BWFCRM_Contact( $user->user_email );
/** Get DOB from contact */
$dob = $contact->get_field_by_slug( 'dob' );
/** Get Dob from user meta */
$user_dob = get_user_meta( get_current_user_id(), 'bwfan_birthday_date', true );
$birthday_date = empty( $dob ) ? $user_dob : $dob;
if ( ! empty( $birthday_date ) ) {
$date_parts = explode( '-', $birthday_date );
if ( count( $date_parts ) === 3 ) {
$selected_year = $date_parts[0];
$selected_month = $date_parts[1];
$selected_date = $date_parts[2];
}
}
$hide_field = ! empty( $global_settings['bwfan_hide_dob_field'] ) && ! empty( $birthday_date );
if ( is_account_page() && ! empty( $hide_field ) ) {
BWFAN_Birthday::show_birthday_on_my_profile( $user );
}
// If field should be hidden on account page, don't display anything
if ( $hide_field ) {
return;
}
if ( ! $use_dropdown_ui ) {
$max = BWFAN_PRO_Common::get_birthday_max_value();
$min = BWFAN_PRO_Common::get_birthday_min_value();
$input_args = 'type=date';
$placeholder = '';
if ( 'wfacp-modern-label' === $label_position ) {
if ( empty( $birthday_date ) ) {
$input_args = 'type=text';
}
$input_args .= ' onfocus="(this.type=\'date\')" onblur="(this.value == \'\' ? this.type=\'text\' : \'\')"';
$placeholder = ! empty( $placeholder_label ) ? $placeholder_label : $birthday_label;
}
}
}
/** If year, month and day are empty */
if ( empty( $selected_year ) && empty( $selected_date ) && empty( $selected_month ) && ! is_null( WC()->session ) ) {
$selected_year = WC()->session->get( 'bwfan_birthday_date_yy', '' );
$selected_date = WC()->session->get( 'bwfan_birthday_date_dd', '' );
$selected_month = WC()->session->get( 'bwfan_birthday_date_mm', '' );
}
$dob_class = '';
if ( $use_dropdown_ui ) {
$dob_class = 'bwfan-dob-wrapper';
}
if ( empty( $wfacp_id ) && ! empty( $required ) ) {
$class .= " validate-required";
}
?>
<div class="bwfan-birthday-section bwfan-birthday-section--checkout form-row form-row-wide <?php echo $label_position; //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>">
<p class="form-row form-row-wide wfacp-anim-wrap <?php echo $class; //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>" id="bwfan_birthday_field">
<label for="bwfan_birthday_date" class="<?php echo $label_class; //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> bwfan-birthday-label"><?php echo $birthday_label; //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
<?php if ( ! empty( $required ) ) { ?>
<abbr class="required" title="required">*</abbr>
<?php } ?>
</label>
<span class="woocommerce-input-wrapper <?php echo $dob_class; //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>">
<?php
if ( $use_dropdown_ui ) :
?>
<select name="bwfan_birthday_date_mm" id="bwfan_birthday_date_mm" class="bwfan-dob-field bwf-wid-90 wfacp_dob wfacp_month wfacp-form-control" data-field="<?php echo esc_attr( $birthday_label ); ?>" data-label="month">
<option value=""><?php esc_html_e( 'Select Month', 'wp-marketing-automations-pro' ); ?></option>
<?php foreach ( BWFAN_Birthday::get_date_select_options( 'month' ) as $value => $label ) : ?>
<option value="<?php echo esc_attr( $value ); ?>" <?php selected( $selected_month, $value ); ?>><?php echo esc_html( $label ); ?></option>
<?php endforeach; ?>
</select>
<select name="bwfan_birthday_date_dd" id="bwfan_birthday_date_dd" class="bwfan-dob-field bwf-wid-90 wfacp_dob wfacp_da wfacp-form-control" data-field="<?php echo esc_attr( $birthday_label ); ?>" data-label="day">
<option value=""><?php esc_html_e( 'Select Day', 'wp-marketing-automations-pro' ); ?></option>
<?php foreach ( BWFAN_Birthday::get_date_select_options( 'date' ) as $value => $label ) : ?>
<option value="<?php echo esc_attr( $value ); ?>" <?php selected( $selected_date, $value ); ?>><?php echo esc_html( $label ); ?></option>
<?php endforeach; ?>
</select>
<select name="bwfan_birthday_date_yy" id="bwfan_birthday_date_yy" class="bwfan-dob-field bwf-wid-90 wfacp_dob wfacp_year wfacp-form-control" data-field="<?php echo esc_attr( $birthday_label ); ?>" data-label="year">
<option value=""><?php esc_html_e( 'Select Year', 'wp-marketing-automations-pro' ); ?></option>
<?php foreach ( BWFAN_Birthday::get_date_select_options( 'year' ) as $value => $label ) : ?>
<option value="<?php echo esc_attr( $value ); ?>" <?php selected( $selected_year, $value ); ?>><?php echo esc_html( $label ); ?></option>
<?php endforeach; ?>
</select>
<?php else : ?>
<input <?php echo esc_attr( $input_args ) ?> class="input-text <?php echo esc_attr( $input_class ) ?>" name="bwfan_birthday_date" id="bwfan_birthday_date" placeholder="<?php echo esc_html( $placeholder ) ?>" value="<?php echo esc_sql( $birthday_date ) ?>" <?php echo $max; //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> <?php echo $min; //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> >
<?php endif; ?>
</span>
</p>
</div>

View File

@@ -0,0 +1,174 @@
<?php
defined( 'ABSPATH' ) || exit; //Exit if accessed directly
if ( ! class_exists( 'WFFN_Optin_Form_Field_Birthday' ) ) {
/**
* This class will control all Optin Birthday mapping functionality on optin submission.
* Class WFFN_Optin_Form_Field_Birthday
*/
class WFFN_Optin_Form_Field_Birthday extends WFFN_Optin_Form_Field {
private static $ins = null;
public static $slug = 'optin_birthday';
public $index = 30;
/**
* WFFN_Optin_Form_Field_Birthday constructor.
*/
public function __construct() {
parent::__construct();
}
/**
* @return WFFN_Optin_Form_Field_Birthday|null
*/
public static function get_instance() {
if ( null === self::$ins ) {
self::$ins = new self;
}
return self::$ins;
}
/**
* @return string
*/
public static function get_slug() {
return self::$slug;
}
/**
* Return title of this form field
*/
public function get_title() {
return __( 'Birthday', 'wp-marketing-automations-pro' );
}
/**
* @param $field_data
*
* @return string|void
*/
public function get_field_output( $field_data ) {
$field_data = wp_parse_args( $field_data, $this->get_field_format() );
$global_settings = BWFAN_Common::get_global_settings();
$name = $this->get_prefix() . $this::get_slug();
$width = isset( $field_data['width'] ) ? esc_attr( $field_data['width'] ) : '';
$label = isset( $field_data['label'] ) ? esc_attr( $field_data['label'] ) : '';
$required = isset( $field_data['required'] ) ? esc_attr( $field_data['required'] ) : false;
$hash = isset( $field_data['hash_key'] ) ? esc_attr( $field_data['hash_key'] ) : '';
$value = $this->get_default_value( $field_data );
$class = $this->get_input_class( $field_data );
if ( ! empty( $global_settings['bwfan_hide_dob_field'] ) && ! empty( $value ) ) {
return;
}
// Parse date for the dropdowns if we have a value
$selected_date = '';
$selected_month = '';
$selected_year = '';
if ( ! empty( $value ) ) {
$date_parts = explode( '-', $value );
if ( count( $date_parts ) === 3 ) {
$selected_year = $date_parts[0];
$selected_month = $date_parts[1];
$selected_date = $date_parts[2];
}
}
?>
<style>
.bwfac_form_field_birthday .wffn-optin-input,
.bwfac_form_field_birthday .bwfan-dob-wrapper {
width: 100%;
display: flex;
flex-wrap: wrap;
gap: 10px;
}
.bwfac_form_field_birthday .bwfan-dob-field {
flex: 1;
min-width: 80px;
}
</style>
<div class="bwfac_form_sec bwfac_form_field_birthday <?php echo esc_attr( $width ); ?>">
<?php if ( ! empty( $label ) ) { ?>
<label for="wfop_id_<?php echo esc_attr( $name ) . '_' . esc_attr( $hash ); ?>"><?php echo esc_html( $label );
echo ( $required ) ? '<span>*</span>' : ''; ?> </label>
<?php } ?>
<div class="wfop_input_cont bwfan-dob-wrapper">
<select name="<?php echo esc_attr( $name ); ?>_mm" class="bwfan-dob-field wffn-optin-input <?php echo esc_attr( $class ) ?>" data-field="<?php echo esc_attr( $label ); ?>" data-label="month">
<option value=""><?php esc_html_e( 'Select Month', 'wp-marketing-automations-pro' ); ?></option>
<?php foreach ( BWFAN_Birthday::get_date_select_options( 'month' ) as $value => $label ) : ?>
<option value="<?php echo esc_attr( $value ); ?>" <?php selected( $selected_month, $value ); ?>><?php echo esc_html( $label ); ?></option>
<?php endforeach; ?>
</select>
<select name="<?php echo esc_attr( $name ); ?>_dd" class="bwfan-dob-field wffn-optin-input <?php echo esc_attr( $class ) ?>" data-field="<?php echo esc_attr( $label ); ?>" data-label="day">
<option value=""><?php esc_html_e( 'Select Day', 'wp-marketing-automations-pro' ); ?></option>
<?php foreach ( BWFAN_Birthday::get_date_select_options( 'date' ) as $value => $label ) : ?>
<option value="<?php echo esc_attr( $value ); ?>" <?php selected( $selected_date, $value ); ?>><?php echo esc_html( $label ); ?></option>
<?php endforeach; ?>
</select>
<select name="<?php echo esc_attr( $name ); ?>_yy" class="bwfan-dob-field wffn-optin-input <?php echo esc_attr( $class ) ?>" data-field="<?php echo esc_attr( $label ); ?>" data-label="year">
<option value=""><?php esc_html_e( 'Select Year', 'wp-marketing-automations-pro' ); ?></option>
<?php foreach ( BWFAN_Birthday::get_date_select_options( 'year' ) as $value => $label ) : ?>
<option value="<?php echo esc_attr( $value ); ?>" <?php selected( $selected_year, $value ); ?>><?php echo esc_html( $label ); ?></option>
<?php endforeach; ?>
</select>
<input type="hidden" id="wfop_id_<?php echo esc_attr( $name ) . '_' . esc_attr( $hash ); ?>" class="<?php echo esc_attr( $class ) ?>" name="<?php echo esc_attr( $name ); ?>" value="<?php echo esc_attr( $value ); ?>">
</div>
</div>
<?php
}
/**
* @return array
*/
public function get_field_format() {
return array(
'width' => 'wffn-sm-100',
'type' => $this::get_slug(),
'label' => __( 'Birthday', 'wp-marketing-automations-pro' ),
'placeholder' => '',
'required' => false,
'InputName' => $this->get_prefix() . $this::get_slug(),
'default' => '',
);
}
public function get_sanitized_value( $data, $field ) {
// Handle new format with multiple selects
$base_name = $field['InputName'];
$year = isset( $data[ $base_name . '_yy' ] ) ? wffn_clean( $data[ $base_name . '_yy' ] ) : '';
$month = isset( $data[ $base_name . '_mm' ] ) ? wffn_clean( $data[ $base_name . '_mm' ] ) : '';
$day = isset( $data[ $base_name . '_dd' ] ) ? wffn_clean( $data[ $base_name . '_dd' ] ) : '';
// If all parts are present, create the date
if ( ! empty( $year ) && ! empty( $month ) && ! empty( $day ) ) {
return $year . '-' . $month . '-' . $day;
}
// Fall back to old format if new format isn't present
return isset( $data[ $base_name ] ) ? wffn_clean( $data[ $base_name ] ) : '';
}
public function get_default_value( $field_data ) {
if ( ! WFFN_Common::is_page_builder_editor() && true === apply_filters( 'wffn_optin_default_login_data', true, $field_data ) ) {
global $current_user;
if ( ! $current_user instanceof WP_User ) {
return '';
}
return get_user_meta( $current_user->ID, 'bwfan_birthday_date', true );
}
return '';
}
}
if ( class_exists( 'WFOPP_Core' ) ) {
WFOPP_Core()->form_fields->register( WFFN_Optin_Form_Field_Birthday::get_instance() );
}
}

View File

@@ -0,0 +1,3 @@
<?php
//silence is golden