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,188 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Object;
use Thrive\Automator\Items\Email_Data;
use Thrive\Automator\Items\Trigger;
use Thrive\Automator\Items\User_Data;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
class Elementor_Form_Submit extends Trigger {
public static function get_id() {
return 'elementor/form-submit';
}
public static function get_wp_hook() {
return Elementor::FORM_SUBMIT_HOOK;
}
public function get_automation_wp_hook() {
return empty( $this->data['elementor_form_identifier']['value'] ) ? static::get_wp_hook() : Elementor::create_dynamic_trigger( static::get_wp_hook(), strtolower( trim( preg_replace( '/[^A-Za-z0-9-]+/', '-', $this->data['elementor_form_identifier']['value'] ) ) ) );
}
public static function get_provided_data_objects() {
return [ Elementor_Form_Data::get_id(), User_Data::get_id(), Email_Data::get_id() ];
}
public static function get_hook_params_number() {
return 1;
}
public static function get_app_id() {
return Elementor_App::get_id();
}
public static function get_name() {
return __( 'Elementor form submit', 'thrive-dash' );
}
public static function get_description() {
return __( 'Triggers when a visitor submits a form built with Elementor', 'thrive-dash' );
}
public static function get_image() {
return 'tap-elementor-logo';
}
/**
* Override default method so we manually init user data if we can match the form's email with an existing user
*
* @param ElementorPro\Modules\Forms\Classes\Form_Record[] $params
*
* @return array
* @see Automation::start()
*/
public function process_params( $params = [] ) {
$data_objects = array();
$aut_id = $this->get_automation_id();
$form_record = $params[0] ?? null;
if ( $form_record ) {
$form_data = $form_record->get( 'sent_data' );
foreach ( $form_data as $key => $param ) {
if ( is_array( $param ) ) {
$form_data[ $key ] = implode( ',', $param );
}
}
/* get all registered data objects and see which ones we use for this trigger */
$data_object_classes = Data_Object::get();
if ( empty( $data_object_classes[ Elementor_Form_Data::get_id() ] ) ) {
/* if we don't have a class that parses the current param, we just leave the value as it is */
$data_objects[ Elementor_Form_Data::get_id() ] = $form_data;
} else {
/* when a data object is available for the current parameter key, we create an instance that will handle the data */
$data_objects[ Elementor_Form_Data::get_id() ] = new $data_object_classes[ Elementor_Form_Data::get_id() ]( $form_data, $aut_id );
}
$user_data = null;
/**
* try to match email with existing user
*/
if ( ! empty( $form_data['email'] ) ) {
$user_data = get_user_by( 'email', $form_data['email'] );
if ( empty( $data_object_classes[ Email_Data::get_id() ] ) ) {
$data_objects[ Email_Data::get_id() ] = [ 'email' => $form_data['email'] ];
} else {
$data_objects[ Email_Data::get_id() ] = new $data_object_classes[ Email_Data::get_id() ]( $form_data['email'], $aut_id );
}
}
if ( ! empty( $user_data ) ) {
if ( empty( $data_object_classes['user_data'] ) ) {
$data_objects[ User_Data::get_id() ] = $user_data;
} else {
$data_objects[ User_Data::get_id() ] = new $data_object_classes[ User_Data::get_id() ]( $user_data, $aut_id );
}
}
}
return $data_objects;
}
public static function sync_trigger_data( $trigger_data ) {
$posts = Elementor::get_elementor_posts();
$custom_fields = [];
foreach ( $posts as $post ) {
$meta = json_decode( get_post_meta( $post->ID, '_elementor_data', true ), true );
foreach ( $meta as $section ) {
if ( empty( $form ) ) {
$form = static::find_form_settings( $section['elements'], $trigger_data['extra_data'][ Elementor_Form_Identifier::get_id() ]['value'] );
}
}
}
if ( ! empty( $form ) && ! empty( $form['settings']['form_fields'] ) ) {
$data_fields = Data_Object::get_all_filterable_fields( [ Elementor_Form_Data::get_id() ] );
$trigger_data['filterable_fields'][ Elementor_Form_Data::get_id() ] = $data_fields[ Elementor_Form_Data::get_id() ];
$hide = [
'email',
'password',
'recaptcha',
'recaptcha_v3',
'honeypot',
'step',
'upload',
'html',
];
foreach ( $form['settings']['form_fields'] as $input ) {
if ( ! empty( $input['custom_id'] ) && ( empty( $input['field_type'] ) || ( ! empty( $input['field_type'] ) && ! in_array( $input['field_type'], $hide, true ) ) ) ) {
$custom_fields[ $input['custom_id'] ] = [
'id' => $input['custom_id'],
'validators' => [],
'name' => empty( $input['field_label'] ) ? 'No label set' : $input['field_label'],
'description' => __( 'Custom field description', 'thrive-dash' ),
'tooltip' => __( 'Custom field tooltip', 'thrive-dash' ),
'placeholder' => __( 'Custom field placeholder', 'thrive-dash' ),
'is_ajax_field' => false,
'value_type' => 'string',
'shortcode_tag' => '%' . $input['custom_id'] . '%',
'dummy_value' => $input['field_label'] . ' field value',
'primary_key' => false,
'filters' => [ 'string_ec' ],
];
}
}
unset( $trigger_data['filterable_fields'][ Elementor_Form_Data::get_id() ][ Elementor_Form_Identifier::get_id() ] );
$trigger_data['filterable_fields'][ Elementor_Form_Data::get_id() ] = array_merge( $trigger_data['filterable_fields'][ Elementor_Form_Data::get_id() ], $custom_fields );
}
return $trigger_data;
}
public static function find_form_settings( $elements, $form_id ) {
foreach ( $elements as $element ) {
if ( $element['id'] == $form_id ) {
return $element;
}
if ( ! empty( $element['elements'] ) ) {
return static::find_form_settings( $element['elements'], $form_id );
}
}
return false;
}
public static function get_required_trigger_fields() {
return [ Elementor_Form_Identifier::get_id() ];
}
}

View File

@@ -0,0 +1,104 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Object;
use Thrive\Automator\Items\Trigger;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Order_Completed
*/
class Woo_Order_Completed extends Trigger {
/**
* Get the trigger identifier
*
* @return string
*/
public static function get_id() {
return 'woocommerce/order_completed';
}
/**
* Get the trigger hook
*
* @return string
*/
public static function get_wp_hook() {
return 'woocommerce_order_status_completed';
}
/**
* Get the trigger provided params
*
* @return array
*/
public static function get_provided_data_objects() {
return array( 'user_data', 'woo_order_data', 'email_data' );
}
/**
* Get the number of params
*
* @return int
*/
public static function get_hook_params_number() {
return 2;
}
/**
* Get the name of the app to which the hook belongs
*
* @return string
*/
public static function get_app_id() {
return Woo_App::get_id();
}
/**
* Get the trigger name
*
* @return string
*/
public static function get_name() {
return 'WooCommerce order complete';
}
/**
* Get the trigger description
*
* @return string
*/
public static function get_description() {
return 'This trigger will be fired whenever a WooCommerce order is set to complete';
}
/**
* Get the trigger logo
*
* @return string
*/
public static function get_image() {
return 'tap-woocommerce-logo';
}
public function process_params( $params = array() ) {
$data = array();
if ( ! empty( $params[1] ) ) {
$data_object_classes = Data_Object::get();
$order = $params[1];
$data['user_data'] = empty( $data_object_classes['user_data'] ) ? null : new $data_object_classes['user_data']( $order->get_user() );
$data['woo_order_data'] = empty( $data_object_classes['woo_order_data'] ) ? $order : new $data_object_classes['woo_order_data']( $order );
$data['email_data'] = empty( $data_object_classes['email_data'] ) ? $order : new $data_object_classes['email_data']( $order->get_billing_email() );
}
return $data;
}
}

View File

@@ -0,0 +1,104 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Object;
use Thrive\Automator\Items\Trigger;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Order_Refunded
*/
class Woo_Order_Refunded extends Trigger {
/**
* Get the trigger identifier
*
* @return string
*/
public static function get_id() {
return 'woocommerce/order_refunded';
}
/**
* Get the trigger hook
*
* @return string
*/
public static function get_wp_hook() {
return 'woocommerce_order_status_refunded';
}
/**
* Get the trigger provided params
*
* @return array
*/
public static function get_provided_data_objects() {
return array( 'user_data', 'woo_order_data', 'email_data' );
}
/**
* Get the number of params
*
* @return int
*/
public static function get_hook_params_number() {
return 2;
}
/**
* Get the name of the app to which the hook belongs
*
* @return string
*/
public static function get_app_id() {
return Woo_App::get_id();
}
/**
* Get the trigger name
*
* @return string
*/
public static function get_name() {
return 'WooCommerce order refunded';
}
/**
* Get the trigger description
*
* @return string
*/
public static function get_description() {
return 'This trigger will be fired whenever a WooCommerce order is refunded';
}
/**
* Get the trigger logo
*
* @return string
*/
public static function get_image() {
return 'woo-refund-order';
}
public function process_params( $params = array() ) {
$data = array();
if ( ! empty( $params[1] ) ) {
$data_object_classes = Data_Object::get();
$order = $params[1];
$data['user_data'] = empty( $data_object_classes['user_data'] ) ? null : new $data_object_classes['user_data']( $order->get_user() );
$data['woo_order_data'] = empty( $data_object_classes['woo_order_data'] ) ? $order : new $data_object_classes['woo_order_data']( $order );
$data['email_data'] = empty( $data_object_classes['email_data'] ) ? null : new $data_object_classes['email_data']( $order->get_billing_email() );
}
return $data;
}
}

View File

@@ -0,0 +1,109 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Object;
use Thrive\Automator\Items\Trigger;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Order_Status
*/
class Woo_Order_Status extends Trigger {
/**
* Get the trigger identifier
*
* @return string
*/
public static function get_id() {
return 'woocommerce/order_status';
}
/**
* Get the trigger hook
*
* @return string
*/
public static function get_wp_hook() {
return 'woocommerce_order_status_changed';
}
/**
* Get the trigger provided params
*
* @return array
*/
public static function get_provided_data_objects() {
return array( 'user_data', 'woo_order_data', 'email_data' );
}
/**
* Get the number of params
*
* @return int
*/
public static function get_hook_params_number() {
return 4;
}
/**
* Get the name of the app to which the hook belongs
*
* @return string
*/
public static function get_app_id() {
return Woo_App::get_id();
}
/**
* Get the trigger name
*
* @return string
*/
public static function get_name() {
return 'WooCommerce order status change';
}
/**
* Get the trigger description
*
* @return string
*/
public static function get_description() {
return 'This trigger will be fired whenever a WooCommerce order changes status';
}
/**
* Get the trigger logo
*
* @return string
*/
public static function get_image() {
return 'woo-update-order-status';
}
/**
* @param array $params
*
* @return array
*/
public function process_params( $params = array() ) {
$data = array();
if ( ! empty( $params[3] ) ) {
$data_object_classes = Data_Object::get();
$order = $params[3];
$data['user_data'] = empty( $data_object_classes['user_data'] ) ? null : new $data_object_classes['user_data']( $order->get_user() );
$data['woo_order_data'] = empty( $data_object_classes['woo_order_data'] ) ? $order : new $data_object_classes['woo_order_data']( $order );
$data['email_data'] = empty( $data_object_classes['email_data'] ) ? null : new $data_object_classes['email_data']( $order->get_billing_email() );
}
return $data;
}
}

View File

@@ -0,0 +1,105 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Object;
use Thrive\Automator\Items\Trigger;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Product_Processing
*/
class Woo_Product_Processing extends Trigger {
/**
* Get the trigger identifier
*
* @return string
*/
public static function get_id() {
return 'woocommerce/product_processing';
}
/**
* Get the trigger hook
*
* @return string
*/
public static function get_wp_hook() {
return 'thrive_woo_product_purchase_processing';
}
/**
* Get the trigger provided params
*
* @return array
*/
public static function get_provided_data_objects() {
return array( 'woo_product_data', 'user_data' );
}
/**
* Get the number of params
*
* @return int
*/
public static function get_hook_params_number() {
return 3;
}
/**
* Get the name of the app to which the hook belongs
*
* @return string
*/
public static function get_app_id() {
return Woo_App::get_id();
}
/**
* Get the trigger name
*
* @return string
*/
public static function get_name() {
return 'WooCommerce product purchase processing';
}
/**
* Get the trigger description
*
* @return string
*/
public static function get_description() {
return 'This trigger will be fired whenever a WooCommerce product purchase is processing';
}
/**
* Get the trigger logo
*
* @return string
*/
public static function get_image() {
return 'tap-woocommerce-logo';
}
public function process_params( $params = array() ) {
$data = array();
if ( ! empty( $params[0] ) ) {
$data_object_classes = Data_Object::get();
list ( $product, $user, $email ) = $params;
$data['woo_product_data'] = empty( $data_object_classes['woo_product_data'] ) ? $product : new $data_object_classes['woo_product_data']( $product );
$data['user_data'] = empty( $data_object_classes['user_data'] ) ? null : new $data_object_classes['user_data']( $user );
$data['email_data'] = empty( $data_object_classes['email_data'] ) ? null : new $data_object_classes['email_data']( $email );
}
return $data;
}
}

View File

@@ -0,0 +1,105 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Object;
use Thrive\Automator\Items\Trigger;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Product_Purchase
*/
class Woo_Product_Purchase extends Trigger {
/**
* Get the trigger identifier
*
* @return string
*/
public static function get_id() {
return 'woocommerce/product_purchase';
}
/**
* Get the trigger hook
*
* @return string
*/
public static function get_wp_hook() {
return 'thrive_woo_product_purchase_completed';
}
/**
* Get the trigger provided params
*
* @return array
*/
public static function get_provided_data_objects() {
return array( 'woo_product_data', 'user_data' );
}
/**
* Get the number of params
*
* @return int
*/
public static function get_hook_params_number() {
return 3;
}
/**
* Get the name of the app to which the hook belongs
*
* @return string
*/
public static function get_app_id() {
return Woo_App::get_id();
}
/**
* Get the trigger name
*
* @return string
*/
public static function get_name() {
return 'WooCommerce product purchase completed';
}
/**
* Get the trigger description
*
* @return string
*/
public static function get_description() {
return 'This trigger will be fired whenever a WooCommerce product purchase is completed.';
}
/**
* Get the trigger logo
*
* @return string
*/
public static function get_image() {
return 'woo-purchase-product';
}
public function process_params( $params = array() ) {
$data = array();
if ( ! empty( $params[0] ) ) {
$data_object_classes = Data_Object::get();
list ( $product, $user, $email ) = $params;
$data['woo_product_data'] = empty( $data_object_classes['woo_product_data'] ) ? $product : new $data_object_classes['woo_product_data']( $product );
$data['user_data'] = empty( $data_object_classes['user_data'] ) ? null : new $data_object_classes['user_data']( $user );
$data['email_data'] = empty( $data_object_classes['email_data'] ) ? null : new $data_object_classes['email_data']( $email );
}
return $data;
}
}

View File

@@ -0,0 +1,104 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Object;
use Thrive\Automator\Items\Trigger;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Product_Refund
*/
class Woo_Product_Refund extends Trigger {
/**
* Get the trigger identifier
*
* @return string
*/
public static function get_id() {
return 'woocommerce/product_refund';
}
/**
* Get the trigger hook
*
* @return string
*/
public static function get_wp_hook() {
return 'thrive_woo_product_refund';
}
/**
* Get the trigger provided params
*
* @return array
*/
public static function get_provided_data_objects() {
return array( 'woo_product_data', 'user_data' );
}
/**
* Get the number of params
*
* @return int
*/
public static function get_hook_params_number() {
return 3;
}
/**
* Get the name of the app to which the hook belongs
*
* @return string
*/
public static function get_app_id() {
return Woo_App::get_id();
}
/**
* Get the trigger name
*
* @return string
*/
public static function get_name() {
return 'WooCommerce product refunded';
}
/**
* Get the trigger description
*
* @return string
*/
public static function get_description() {
return 'This trigger will be fired whenever a WooCommerce product is refunded';
}
/**
* Get the trigger logo
*
* @return string
*/
public static function get_image() {
return 'woo-refund-order';
}
public function process_params( $params = array() ) {
$data = array();
if ( ! empty( $params[0] ) ) {
$data_object_classes = Data_Object::get();
list ( $product, $user, $email ) = $params;
$data['user_data'] = empty( $data_object_classes['user_data'] ) ? null : new $data_object_classes['user_data']( $user );
$data['woo_product_data'] = empty( $data_object_classes['woo_product_data'] ) ? $product : new $data_object_classes['woo_product_data']( $product );
$data['email_data'] = empty( $data_object_classes['email_data'] ) ? null : new $data_object_classes['email_data']( $email );
}
return $data;
}
}