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,37 @@
<?php
/**
* Thrive Themes - https://thrivethemes.com
*
* @package thrive-visual-editor
*/
namespace TCB\Integrations\Automator;
use Thrive\Automator\Items\App;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
class Architect_App extends App {
public static function get_id() {
return 'architect';
}
public static function get_name() {
return 'Architect';
}
public static function get_description() {
return 'Architect related items';
}
public static function get_logo() {
return 'tap-architect-logo';
}
public static function has_access() {
return true;
}
}

View File

@@ -0,0 +1,146 @@
<?php
/**
* Thrive Themes - https://thrivethemes.com
*
* @package thrive-visual-editor
*/
namespace TCB\Integrations\Automator;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Main
*
* @package TCB\Integrations\Automator
*/
class Main {
/**
* Add WooCommerce support
* process trigger callback
*
*/
public static function init() {
if ( defined( 'THRIVE_AUTOMATOR_RUNNING' )
&& ( ( defined( 'TVE_DEBUG' ) && TVE_DEBUG )
|| ( defined( 'TAP_VERSION' ) && version_compare( TAP_VERSION, '1.0', '>=' ) ) ) ) {
static::add_hooks();
}
}
/**
* @param string $subpath
*
* @return string
*/
public static function get_integration_path( $subpath = '' ) {
return TVE_TCB_ROOT_PATH . 'inc/automator/' . $subpath;
}
public static function add_hooks() {
static::load_apps();
static::load_data_objects();
static::load_fields();
static::load_action_fields();
static::load_actions();
static::load_trigger_fields();
static::load_triggers();
add_action( 'tap_output_extra_svg', [ 'TCB\Integrations\Automator\Main', 'display_icons' ] );
add_filter( 'tvd_automator_api_data_sets', [ 'TCB\Integrations\Automator\Main', 'dashboard_sets' ], 1, 1 );
add_filter( 'tve_automator_should_use_form', [ 'TCB\Integrations\Automator\Main', 'filter_lgs' ], 10, 4 );
}
public static function load_apps() {
foreach ( static::load_files( 'apps' ) as $app ) {
\thrive_automator_register_app( new $app() );
}
}
public static function load_triggers() {
foreach ( static::load_files( 'triggers' ) as $trigger ) {
\thrive_automator_register_trigger( new $trigger() );
}
}
public static function load_actions() {
foreach ( static::load_files( 'actions' ) as $action ) {
\thrive_automator_register_action( new $action() );
}
}
public static function load_action_fields() {
foreach ( static::load_files( 'action-fields' ) as $field ) {
\thrive_automator_register_action_field( new $field() );
}
}
public static function load_trigger_fields() {
foreach ( static::load_files( 'trigger-fields' ) as $field ) {
\thrive_automator_register_trigger_field( new $field() );
}
}
public static function load_fields() {
foreach ( static::load_files( 'fields' ) as $field ) {
\thrive_automator_register_data_field( new $field() );
}
}
public static function load_data_objects() {
foreach ( static::load_files( 'data-objects' ) as $data_object ) {
\thrive_automator_register_data_object( new $data_object() );
}
}
public static function display_icons() {
include_once static::get_integration_path( 'icons.svg' );
}
public static function load_files( $type ) {
$integration_path = static::get_integration_path( $type );
$local_classes = [];
foreach ( glob( $integration_path . '/*.php' ) as $file ) {
require_once $file;
$class = 'TCB\Integrations\Automator\\' . static::get_class_name_from_filename( $file );
if ( class_exists( $class ) ) {
$local_classes[] = $class;
}
}
return $local_classes;
}
public static function get_class_name_from_filename( $filename ) {
$name = str_replace( 'class-', '', basename( $filename, '.php' ) );
return str_replace( '-', '_', ucwords( $name, '-' ) );
}
/**
* Enroll form_data as data that can be used in TD for Automator actions
*
* @param $sets
*
* @return mixed
*/
public static function dashboard_sets( $sets ) {
$sets[] = 'form_data';
return $sets;
}
public static function filter_lgs( $allow, $lg_post, $trigger_id, $trigger_data ) {
$form_type = $lg_post->form_type;
if ( $trigger_id === Register_Form_Submit::get_id() && ( empty( $form_type ) || $form_type !== 'registration_form' ) ) {
$allow = false;
}
return $allow;
}
}

View File

@@ -0,0 +1,93 @@
<?php
namespace TCB\Integrations\Automator;
use TCB\inc\helpers\FormSettings;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Form_Consent_Field
*/
class Form_Identifier_Data_Field extends \Thrive\Automator\Items\Data_Field {
/**
* Field name
*/
public static function get_name() {
return 'Specific forms';
}
/**
* Field description
*/
public static function get_description() {
return 'Select forms that contain the identifier';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return 'Filter by form name identifier';
}
public static function get_id() {
return 'form_identifier';
}
public static function get_supported_filters() {
return [ 'autocomplete' ];
}
/**
* For multiple option inputs, name of the callback function called through ajax to get the options
*/
public static function get_options_callback() {
$lg_ids = new \WP_Query( [
'post_type' => FormSettings::POST_TYPE,
'fields' => 'id=>parent',
'posts_per_page' => '-1',
'post_status' => 'draft',
] );
$lgs = [];
foreach ( $lg_ids->posts as $lg ) {
$lg_post = FormSettings::get_one( $lg->ID );
if ( ! empty( $lg_post ) ) {
$post = get_post( $lg->post_parent );
if ( ! empty( $post ) && $post->post_status !== 'trash' ) {
$saved_identifier = $lg_post->form_identifier;
if ( empty( $saved_identifier ) && ! empty( $lg->post_parent ) ) {
$form_identifier = ( empty( $post->post_name ) ? '' : $post->post_name ) . '-form-' . substr( uniqid( '', true ), - 6, 6 );
$config = $lg_post->get_config( false );
$config['form_identifier'] = $form_identifier;
$post_title = 'Form settings' . ( $lg->post_parent ? ' for content ' . $lg->post_parent : '' );
$lg_post->set_config( $config )
->save( $post_title, [ 'post_parent' => $lg->post_parent ] );
}
$form_id = $lg_post->form_identifier;
$lgs[ $form_id ] = [
'label' => $form_id,
'id' => $form_id,
];
}
}
}
return $lgs;
}
public static function is_ajax_field() {
return true;
}
public static function get_dummy_value() {
return 'test-form-23131231';
}
}

View File

@@ -0,0 +1,85 @@
<?php
namespace TCB\Integrations\Automator;
use TCB\inc\helpers\FormSettings;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Form_Post_Field
*/
class Form_Post_Data_Field extends \Thrive\Automator\Items\Data_Field {
/**
* Field name
*/
public static function get_name() {
return 'Page or post containing form';
}
/**
* Field description
*/
public static function get_description() {
return 'Select pages or posts on your website that contain forms';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return 'Filter by post';
}
/**
* For multiple option inputs, name of the callback function called through ajax to get the options
*/
public static function get_options_callback() {
$lg_posts = new \WP_Query( [
'post_type' => FormSettings::POST_TYPE,
'fields' => 'id=>parent',
'posts_per_page' => '-1',
'post_status' => 'draft',
] );
$posts = [];
/**
* Prevent showing LG from some post types
*/
$banned_post_types = apply_filters( 'tve_aut_banned_post_types', [] );
foreach ( $lg_posts->posts as $lg_post ) {
$parent_post = get_post( $lg_post->post_parent );
if ( ! empty( $parent_post ) && ! in_array( $parent_post->post_type, $banned_post_types, true ) ) {
$posts[ $parent_post->ID ] = [
'label' => $parent_post->post_title,
'id' => $parent_post->ID,
];
}
}
return $posts;
}
public static function get_id() {
return 'post_id';
}
public static function get_supported_filters() {
return [ 'autocomplete' ];
}
public static function is_ajax_field() {
return true;
}
public static function get_dummy_value() {
return '10';
}
public static function get_field_value_type() {
return static::TYPE_STRING;
}
}

View File

@@ -0,0 +1,21 @@
<svg style="position: absolute; width: 0; height: 0; overflow: hidden;" version="1.1"
xmlns="http://www.w3.org/2000/svg" id="tve-automator-icons">
<defs>
<symbol id="tap-architect-logo" viewBox="0 0 43 44">
<g fill="none" fill-rule="evenodd">
<g>
<g>
<g>
<g>
<path fill="#434343" fill-rule="nonzero" d="M42.82 41.754h-.485c-5.318 0-10.06-3.348-11.84-8.36l-7.19-20.217-4.313 12.11c-1.165.204-2.232.42-2.876.575-1.515.317-3.508.762-4.987 1.349-.862.35-1.725.699-2.548 1.09L18.627.01h9.358L42.82 41.755z" transform="translate(-692 -149) translate(599 109) translate(93 40)"/>
<path fill="#58A245"
d="M24.861 27.289c-.319-.006-.635.06-.926.192-.371.155-.713.372-1.012.642l-.69.67c-.042.043-.08.09-.112.14-1.286 1.617-1.573 1.876-2.588 3.926-.47.944-1 1.857-1.588 2.732-.4.601-.762 1.208-1.216 1.769-.044.057-.075.083-.121.135-.295.35-.62.676-.97.972-.236.21-.488.402-.753.575-.218.144-.431.288-.676.429l-.36.195c-.057.04-.116.076-.177.11l-.176.086c-.069.034-.132.051-.207.086-1.557.734-3.224 1.207-4.935 1.398l-1.003.123c-.288.043-1.09.084-1.82.095-.453.018-.907.007-1.358-.031l.112-.288c.236-.54.5-1.069.79-1.582.053-.08.076-.152.133-.241l.575-.987 1.47-2.053 1.337-1.406.095-.104c.057-.052.066-.046.118-.089l.31-.273.118-.084c.08-.063.118-.1.205-.166l1.42-.99c.478-.319.99-.61 1.478-.897l1.542-.843c.575-.287 1.576-.82 2.122-1.058l1.608-.753c-.259.054-.511.134-.754.238l-.742.253-1.463.53c-.717.247-1.424.575-2.117.862l-1.349.61c-.612.274-1.21.58-1.791.915-.576.319-1.11.695-1.671 1.032l-1.864 1.326c-.043.034-.089.066-.135.097l-1.035.903c-.314.328-.685.642-.978.99-.035.05-.073.097-.115.14-.267.29-.517.596-.748.915-.346.474-.669.964-.966 1.47l-.492.937c-.195.394-.992 2.3-1.03 2.816H.3C.174 43.2.078 42.642.012 42.079v-.613-.063c.051-.4.04-.664.123-1.17.234-1.431.772-2.796 1.579-4l.797-1.15c.413-.525.863-1.02 1.345-1.482.248-.198.472-.5.74-.702.115-.089.23-.212.359-.31.13-.098.23-.199.365-.288l.762-.575c.781-.57 1.608-1.076 2.47-1.513.92-.463 1.835-.845 2.793-1.228 1.375-.496 2.788-.88 4.225-1.15 1.357-.288 4.794-.955 6.45-.98h.354c.851-.02 2.174-.003 2.487.434z"
transform="translate(-692 -149) translate(599 109) translate(93 40)"/>
</g>
</g>
</g>
</g>
</g>
</symbol>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@@ -0,0 +1,103 @@
<?php
/**
* Thrive Themes - https://thrivethemes.com
*
* @package thrive-visual-editor
*/
namespace TCB\Integrations\Automator;
use TCB\inc\helpers\FormSettings;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
class Form_Identifier extends \Thrive\Automator\Items\Trigger_Field {
public static function get_name() {
return 'Select specific form identifier';
}
public static function get_description() {
return 'Target a specific form on your website. Form identifiers are added under advanced options when editing a form. If your form identifier is not listed, please re-save the page containing the form. Custom form fields are only available when a specific form is selected.';
}
public static function get_placeholder() {
return 'All forms (custom fields will not be available)';
}
public static function get_id() {
return 'form_identifier';
}
public static function get_type() {
return 'select';
}
/**
* For multiple option inputs, name of the callback function called through ajax to get the options
*/
public static function get_options_callback( $trigger_id, $trigger_data ) {
$lg_ids = new \WP_Query( [
'post_type' => FormSettings::POST_TYPE,
'fields' => 'id=>parent',
'posts_per_page' => '-1',
'post_status' => 'draft',
] );
$lgs = [
'none' => [
'label' => 'All forms (custom fields will not be available)',
'id' => 'none',
],
];
foreach ( $lg_ids->posts as $lg ) {
$lg_post = FormSettings::get_one( $lg->ID );
if ( ! apply_filters( 'tve_automator_should_use_form', true, $lg_post, $trigger_id, $trigger_data ) ) {
continue;
}
if ( $lg_post !== null ) {
// For symbol lead generation form, there is no post_parent
$post_name = '';
if ( ! empty( $lg->post_parent ) ) {
$post = get_post( $lg->post_parent );
if ( ! empty( $post ) && $post->post_status !== 'trash' ) {
$post_name = empty( $post->post_name ) ? '' : $post->post_name;
}
}
$form_id = $lg_post->form_identifier;
$parent = ' for content ' . ( empty( $lg->post_parent ) ? 'of symbol ' . $lg->ID : $lg->post_parent );
if ( empty( $form_id ) ) {
$form_identifier = $post_name . '-form-' . substr( uniqid( '', true ), - 6, 6 );
$config = $lg_post->get_config( false );
$config['form_identifier'] = $form_identifier;
$post_title = 'Form settings' . $parent;
$lg_post->set_config( $config )
->save( $post_title, [ 'post_parent' => $lg->post_parent ] );
}
$inputs = $lg_post->inputs;
if ( ! empty( $inputs ) ) {
$lgs[ $lg->ID ] = [
'label' => $form_id,
'id' => $lg->ID,
];
}
}
}
return $lgs;
}
public static function is_ajax_field() {
return true;
}
public static function get_dummy_value() {
return 'test-form-23131231';
}
}

View File

@@ -0,0 +1,98 @@
<?php
namespace TCB\Integrations\Automator;
use Thrive\Automator\Items\Data_Object;
use Thrive\Automator\Utils;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
class Register_Form_Submit extends \Thrive\Automator\Items\Trigger {
public static function get_id() {
return 'thrive/registerform';
}
public static function get_wp_hook() {
return 'thrive_register_form_through_wordpress_user';
}
public function get_automation_wp_hook() {
return empty( $this->data['form_identifier']['value'] ) ? static::get_wp_hook() : Utils::create_dynamic_trigger( static::get_wp_hook(), strtolower( trim( preg_replace( '/[^A-Za-z0-9-]+/', '-', $this->data['form_identifier']['value'] ) ) ) );
}
public static function get_provided_data_objects() {
return [ 'user_data', 'form_data' ];
}
public static function get_hook_params_number() {
return 2;
}
public static function get_app_id() {
return Architect_App::get_id();
}
public static function get_name() {
return 'Registration form submitted';
}
public static function get_description() {
return 'Triggers only when a new user is created after submitting a registration form. This trigger does not fire if the user account already existed.';
}
public static function get_image() {
return 'tap-architect-logo';
}
public static function get_required_trigger_fields() {
return [ 'form_identifier' ];
}
/**
* Override default method so we manually init user data if we can match the form's email with an existing user
*
* @param array $params
*
* @return array
* @see Automation::start()
*/
public function process_params( $params = [] ) {
$data_objects = [];
$aut_id = $this->get_automation_id();
if ( ! empty( $params ) ) {
$data_object_classes = Data_Object::get();
if ( empty( $data_object_classes['user_data'] ) ) {
$data_objects['user_data'] = $params[0];
} else {
$data_objects['user_data'] = new $data_object_classes['user_data']( $params[0], $aut_id );
}
if ( ! empty( $params[1] ) ) {
$form_data = $params[1];
foreach ( $form_data as $key => $param ) {
if ( is_array( $param ) ) {
$form_data[ $key ] = implode( ',', $param );
}
}
if ( empty( $data_object_classes['form_data'] ) ) {
/* if we don't have a class that parses the current param, we just leave the value as it is */
$data_objects['form_data'] = $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['form_data'] = new $data_object_classes['form_data']( $form_data, $aut_id );
}
}
}
return $data_objects;
}
public static function sync_trigger_data( $trigger_data ) {
return tve_sync_form_data( $trigger_data );
}
}

View File

@@ -0,0 +1,121 @@
<?php
namespace TCB\Integrations\Automator;
use Thrive\Automator\Items\Data_Object;
use Thrive\Automator\Utils;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
class Submit_Form extends \Thrive\Automator\Items\Trigger {
public static function get_id() {
return 'thrive/submitform';
}
public static function get_wp_hook() {
return 'tcb_api_form_submit';
}
public function get_automation_wp_hook() {
return empty( $this->data['form_identifier']['value'] ) ? static::get_wp_hook() : Utils::create_dynamic_trigger( static::get_wp_hook(), strtolower( trim( preg_replace( '/[^A-Za-z0-9-]+/', '-', $this->data['form_identifier']['value'] ) ) ) );
}
public static function get_provided_data_objects() {
return [ 'form_data', 'user_data', 'email_data' ];
}
public static function get_hook_params_number() {
return 1;
}
public static function get_app_id() {
return Architect_App::get_id();
}
public static function get_name() {
return 'Form submit';
}
public static function get_description() {
return 'Triggers when a visitor submits a form built with the Thrive Visual Editor';
}
public static function get_image() {
return 'tap-architect-logo';
}
/**
* Override default method so we manually init user data if we can match the form's email with an existing user
*
* @param array $params
*
* @return array
* @see Automation::start()
*/
public function process_params( $params = [] ) {
$data_objects = [];
$aut_id = 0;
if ( method_exists( Submit_Form::class, 'get_automation_id' ) ) {
$aut_id = $this->get_automation_id();
}
if ( ! empty( $params ) ) {
$form_data = $params[0];
foreach ( $params[0] 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['form_data'] ) ) {
/* if we don't have a class that parses the current param, we just leave the value as it is */
$data_objects['form_data'] = $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['form_data'] = new $data_object_classes['form_data']( $form_data, $aut_id );
}
$user_data = null;
/**
* try to match email with existing user
*/
if ( ! empty( $form_data['email'] ) ) {
$matched_user = get_user_by( 'email', $form_data['email'] );
if ( ! empty( $matched_user ) ) {
$user_data = tvd_get_current_user_details( $matched_user->ID );
}
if ( empty( $data_object_classes['email_data'] ) ) {
$data_objects['email_data'] = [ 'email' => $form_data['email'] ];
} else {
$data_objects['email_data'] = new $data_object_classes['email_data']( $form_data['email'], $aut_id );
}
}
if ( ! empty( $user_data ) ) {
if ( empty( $data_object_classes['user_data'] ) ) {
$data_objects['user_data'] = $user_data;
} else {
$data_objects['user_data'] = new $data_object_classes['user_data']( $user_data, $aut_id );
}
}
}
return $data_objects;
}
public static function get_required_trigger_fields() {
return [ 'form_identifier' ];
}
public static function sync_trigger_data( $trigger_data ) {
return tve_sync_form_data( $trigger_data );
}
}