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,60 @@
<?php
class BWFAN_API_Delete_Connector extends BWFAN_API_Base {
public static $ins;
public function __construct() {
parent::__construct();
$this->method = WP_REST_Server::DELETABLE;
$this->route = '/connector/disconnect';
}
public static function get_instance() {
if ( null === self::$ins ) {
self::$ins = new self();
}
return self::$ins;
}
public function process_api_call() {
$slug = $this->get_sanitized_arg( 'wfco_connector', 'text_field' );
if ( empty( $slug ) ) {
return $this->error_response( __( 'Connector saved data missing, kindly disconnect and connect again.', 'wp-marketing-automations' ), null, 400 );
}
/** Handling for Bitly */
if ( 'bwfco_bitly' === $slug ) {
$bitly = BWFCO_Bitly::get_instance();
if ( $bitly->is_connected() ) {
$bitly->disconnect();
return $this->success_response( array(), __( 'Connector deleted', 'wp-marketing-automations' ) );
}
}
$connector_details = WFCO_Model_Connectors::get_specific_rows( 'slug', $slug );
if ( empty( $connector_details ) ) {
return $this->error_response( __( 'Connector not exist.', 'wp-marketing-automations' ), null, 500 );
}
$connector = WFCO_Load_Connectors::get_connector( $slug );
if ( method_exists( $connector, 'disconnect' ) ) {
$connector->disconnect();
}
$connector_ids = implode( ',', array_map( function ( $connector ) {
return $connector['ID'];
}, $connector_details ) );
$connector_sql = "DELETE from {table_name} where ID IN ($connector_ids)";
$connector_meta_sql = "DELETE from {table_name} where connector_id IN ($connector_ids)";
WFCO_Model_ConnectorMeta::delete_multiple( $connector_meta_sql );
WFCO_Model_Connectors::delete_multiple( $connector_sql );
do_action( 'bwfan_connector_disconnected', $slug );
return $this->success_response( array(), __( 'Connector deleted', 'wp-marketing-automations' ) );
}
}
BWFAN_API_Loader::register( 'BWFAN_API_Delete_Connector' );

View File

@@ -0,0 +1,44 @@
<?php
class BWFAN_API_Get_Connectors extends BWFAN_API_Base {
public static $ins;
public static function get_instance() {
if ( null === self::$ins ) {
self::$ins = new self();
}
return self::$ins;
}
public function __construct() {
parent::__construct();
$this->method = WP_REST_Server::READABLE;
$this->route = '/connectors';
}
public function process_api_call() {
$connectors = BWFAN_Core()->connectors->get_connectors_for_listing();
if ( ! bwfan_is_autonami_connector_active() ) {
$connectors = array_map( function ( $connector ) {
$name = $connector['name'];
$name = strtolower( str_replace( [ ' ', '/' ], [ '-', '' ], $name ) ) . '.png';
if ( isset( $connector['logo'] ) && ! empty( $connector['logo'] ) ) {
if ( wp_http_validate_url( $connector['logo'] ) ) {
return $connector;
}
$name = $connector['logo'] . '.png';
}
$connector['logo'] = BWFAN_PLUGIN_URL . '/includes/connectors-logo/' . $name;
return $connector;
}, $connectors );
}
return $this->success_response( $connectors, '' );
}
}
BWFAN_API_Loader::register( 'BWFAN_API_Get_Connectors' );

View File

@@ -0,0 +1,74 @@
<?php
class BWFAN_API_Save_Connector extends BWFAN_API_Base {
public static $ins;
public function __construct() {
parent::__construct();
$this->method = WP_REST_Server::CREATABLE;
$this->route = '/connector/save';
}
public static function get_instance() {
if ( null === self::$ins ) {
self::$ins = new self();
}
return self::$ins;
}
public function process_api_call() {
$wfco_connector = $this->get_sanitized_arg( 'wfco_connector', 'text_field', $this->args['wfco_connector'] );
if ( empty( $wfco_connector ) ) {
$this->response_code = 400;
return $this->error_response( __( 'Provided connector is empty.', 'wp-marketing-automations' ) );
}
$active_connectors = WFCO_Load_Connectors::get_active_connectors();
$connector = $active_connectors[ sanitize_text_field( $wfco_connector ) ];
if ( ! $connector instanceof BWF_CO ) {
$message = __( 'Something is wrong, connector isn\'t available.', 'wp-marketing-automations' );
$this->response_code = 500;
return $this->error_response( $message );
}
$id = $this->get_sanitized_arg( 'id', 'text_field' );
$action = empty( absint( $id ) ) ? 'save' : 'update';
/** Do Wizard Connector Handling (Mailchimp, GetResponse, Mautic) */
if ( BWFAN_Core()->connectors->is_wizard_connector( $connector ) ) {
$next_step = $connector->get_next_step( $this->args );
/** Error in Data provided for next step */
if ( is_wp_error( $next_step ) ) {
return $this->error_response( '', $next_step, 500 );
}
/** If step type = 'handle_settings_with_params', then go through handle_settings_form with new params */
if ( is_array( $next_step ) && isset( $next_step['step_type'] ) && 'handle_settings_with_params' === $next_step['step_type'] ) {
$this->args = $next_step['params'];
} elseif ( true !== $next_step ) {
do_action( 'bwfan_connector_connected', $wfco_connector );
/** If true, then go through handle_settings_form, else get next step data */
return $this->success_response( $next_step );
}
}
$response = $connector->handle_settings_form( $this->args, $action );
$status = in_array( $response['status'], [ 'success', 'rerun_api', 'not_connected' ] ) ? true : false;
$message = $response['message'];
/** Error occurred */
if ( false === $status ) {
$this->response_code = 500;
return $this->error_response( $message );
}
do_action( 'bwfan_connector_connected', $wfco_connector );
return $this->success_response( $response, __( 'Connector updated', 'wp-marketing-automations' ) );
}
}
BWFAN_API_Loader::register( 'BWFAN_API_Save_Connector' );

View File

@@ -0,0 +1,52 @@
<?php
class BWFAN_API_Sync_Connector extends BWFAN_API_Base {
public static $ins;
public function __construct() {
parent::__construct();
$this->method = WP_REST_Server::CREATABLE;
$this->route = '/connector/sync';
}
public static function get_instance() {
if ( null === self::$ins ) {
self::$ins = new self();
}
return self::$ins;
}
public function process_api_call() {
$wfco_connector = $this->get_sanitized_arg( 'wfco_connector', 'text_field' );
$id = $this->get_sanitized_arg( 'id', 'text_field' );
if ( empty( $wfco_connector ) || empty( ( $id ) ) ) {
return $this->error_response( __( 'Connector saved data missing, kindly disconnect and connect again.', 'wp-marketing-automations' ), null, 400 );
}
$current_connector = WFCO_Load_Connectors::get_connector( $wfco_connector );
if ( ! $current_connector instanceof BWF_CO ) {
$message = __( 'Something is wrong, connector isn\'t available.', 'wp-marketing-automations' );
return $this->error_response( $message, null, 500 );
}
try {
$response = $current_connector->handle_settings_form( $this->args, 'sync' );
$status = ( 'success' === $response['status'] ) ? true : false;
$message = $response['message'];
} catch ( Error $e ) {
$message = $e->getMessage();
return $this->error_response( $message, null, 500 );
}
/** Error occurred */
if ( false === $status ) {
return $this->error_response( $message, null, 500 );
}
return $this->success_response( $response, __( 'Connector updated', 'wp-marketing-automations' ) );
}
}
BWFAN_API_Loader::register( 'BWFAN_API_Sync_Connector' );

View File

@@ -0,0 +1,46 @@
<?php
class BWFAN_API_Update_Connector extends BWFAN_API_Base {
public static $ins;
public function __construct() {
parent::__construct();
$this->method = WP_REST_Server::EDITABLE;
$this->route = '/connector/update';
}
public static function get_instance() {
if ( null === self::$ins ) {
self::$ins = new self();
}
return self::$ins;
}
public function process_api_call() {
$wfco_connector = $this->get_sanitized_arg( 'wfco_connector', 'text_field' );
$id = $this->get_sanitized_arg( 'id', 'text_field' );
if ( empty( $wfco_connector ) || empty( $id ) ) {
return $this->error_response( __( 'Connector saved data missing, kindly disconnect and connect again.', 'wp-marketing-automations' ), null, 400 );
}
$active_connectors = WFCO_Load_Connectors::get_active_connectors();
if ( ! $active_connectors[ sanitize_text_field( $wfco_connector ) ] instanceof BWF_CO ) {
$message = __( 'Something is wrong, connector isn\'t available.', 'wp-marketing-automations' );
return $this->error_response( $message, null, 500 );
}
$response = $active_connectors[ sanitize_text_field( $wfco_connector ) ]->handle_settings_form( $this->args, 'update' );
$status = ( 'success' === $response['status'] ) ? true : false;
$message = $response['message'];
/** Error occurred */
if ( false === $status ) {
return $this->error_response( $message, null, 500 );
}
return $this->success_response( $response, __( 'Connector updated', 'wp-marketing-automations' ) );
}
}
BWFAN_API_Loader::register( 'BWFAN_API_Update_Connector' );

View File

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