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,29 @@
<?php
class BWFCRM_API_Get_Message_Daily_Limit extends BWFCRM_API_Base {
public static $ins;
public static function get_instance() {
if ( null === self::$ins ) {
self::$ins = new self();
}
return self::$ins;
}
public $contact;
public function __construct() {
parent::__construct();
$this->method = WP_REST_Server::READABLE;
$this->route = '/messages/daily-limit';
}
public function process_api_call() {
$daily_limit = BWFCRM_Core()->campaigns->get_daily_limit_status_array();
return $this->success_response( $daily_limit );
}
}
BWFCRM_API_Loader::register( 'BWFCRM_API_Get_Message_Daily_Limit' );

View File

@@ -0,0 +1,50 @@
<?php
class BWFCRM_API_Get_Conversation_Template extends BWFCRM_API_Base {
public static $ins;
public static function get_instance() {
if ( null === self::$ins ) {
self::$ins = new self();
}
return self::$ins;
}
public $contact;
public function __construct() {
parent::__construct();
$this->method = WP_REST_Server::READABLE;
$this->route = '/templates/(?P<template_id>[\\d]+)';
$this->request_args = array(
'template_id' => array(
'description' => __( 'Template ID', 'wp-marketing-automations-pro' ),
'type' => 'integer',
)
);
}
public function default_args_values() {
return array(
'template_id' => 0,
);
}
public function process_api_call() {
/** checking if id or email present in params **/
$template_id = $this->get_sanitized_arg( 'template_id', 'key' );
if ( empty( $template_id ) ) {
return $this->error_response( __( 'Invalid template ID provided', 'wp-marketing-automations-pro' ), null, 400 );
}
$template = BWFCRM_Core()->conversation->get_conversation_template_array( $template_id );
if ( ! is_array( $template ) || empty( $template ) ) {
return $this->error_response( __( 'Template doesn\'t exists', 'wp-marketing-automations-pro' ), null, 500 );
}
return $this->success_response( $template );
}
}
BWFCRM_API_Loader::register( 'BWFCRM_API_Get_Conversation_Template' );

View File

@@ -0,0 +1,76 @@
<?php
/**
* Test Mail API file
*
* @package BWFCRM_API_Base
*/
/**
* Test Mail API class
*/
class BWFCRM_API_Send_Test_Mail extends BWFCRM_API_Base {
/**
* BWFCRM_Core obj
*
* @var BWFCRM_Core
*/
public static $ins;
/**
* Return class instance
*/
public static function get_instance() {
if ( null === self::$ins ) {
self::$ins = new self();
}
return self::$ins;
}
/**
* Class constructor
*/
public function __construct() {
parent::__construct();
$this->method = WP_REST_Server::CREATABLE;
$this->route = '/send-test-email';
}
/**
* Default arg.
*/
public function default_args_values() {
return array(
'email' => '',
'content' => 0
);
}
/**
* API callback
*/
public function process_api_call() {
$content = isset( $this->args['content'] ) ? $this->args['content'] : [];
$content = BWFAN_Common::is_json( $content ) ? json_decode( $content, true ) : $content;
if ( empty( $content ) ) {
return $this->error_response( __( 'No content data found', 'wp-marketing-automations-pro' ) );
}
if ( isset( $content['mail_data'] ) && is_array( $content['mail_data'] ) ) {
$mail_data = $content['mail_data'];
unset( $content['mail_data'] );
$content = array_replace( $content, $mail_data );
}
$content['email'] = $this->get_sanitized_arg( 'email', 'text_field' );
if ( BWFAN_Common::send_test_email( $content ) ) {
return $this->success_response( '', 'Test Email Sent' );
}
return $this->error_response( 'Unable to send test email', null, 500 );
}
}
BWFCRM_API_Loader::register( 'BWFCRM_API_Send_Test_Mail' );

View File

@@ -0,0 +1,89 @@
<?php
/**
* Test SMS API file
*
* @package BWFCRM_API_Base
*/
/**
* Test Mail API class
*/
class BWFCRM_API_Send_Test_SMS extends BWFCRM_API_Base {
/**
* BWFCRM_Core obj
*
* @var BWFCRM_Core
*/
public static $ins;
/**
* Return class instance
*/
public static function get_instance() {
if ( null === self::$ins ) {
self::$ins = new self();
}
return self::$ins;
}
/**
* Class constructor
*/
public function __construct() {
parent::__construct();
$this->method = WP_REST_Server::CREATABLE;
$this->route = '/send-test-sms';
}
/**
* Default arg.
*/
public function default_args_values() {
return array(
'phone' => '',
'sms_body' => '',
);
}
/**
* API callback
*/
public function process_api_call() {
if ( ! isset( $this->args ) || empty( $this->args ) || ! is_array( $this->args ) ) {
return $this->error_response( __( 'No data found', 'wp-marketing-automations-pro' ) );
}
$phone = $this->args['phone'];
if ( empty( $phone ) ) {
return $this->error_response( __( 'Phone no is required.', 'wp-marketing-automations-pro' ), null, 400 );
}
$sms_body = $this->args['sms_body'];
if ( empty( $sms_body ) ) {
return $this->error_response( __( 'SMS body is required.', 'wp-marketing-automations-pro' ), null, 400 );
}
BWFAN_Merge_Tag_Loader::set_data( array(
'is_preview' => true,
) );
$sms_body = BWFAN_Common::decode_merge_tags( $sms_body );
/** Append UTM parameters */
$sms_body = BWFAN_PRO_Common::add_test_broadcast_utm_params( $sms_body, $this->args['sms_data'], 'sms' );
$send_sms_result = BWFCRM_Common::send_sms( array(
'to' => $phone,
'body' => $sms_body,
'is_test' => true
) );
if ( $send_sms_result instanceof WP_Error ) {
return $this->error_response( 'Unable to send test sms. Error: ' . $send_sms_result->get_error_message(), null, 500 );
}
return $this->success_response( '', 'Test SMS Sent' );
}
}
BWFCRM_API_Loader::register( 'BWFCRM_API_Send_Test_SMS' );

View File

@@ -0,0 +1,115 @@
<?php
/**
* Test WhatsApp Message API file
*
* @package BWFCRM_API_Base
*/
/**
* Test WhatsApp API class
*/
class BWFCRM_API_Send_Test_WhatsApp_Message extends BWFCRM_API_Base {
/**
* BWFCRM_Core obj
*
* @var BWFCRM_Core
*/
public static $ins;
/**
* Return class instance
*/
public static function get_instance() {
if ( null === self::$ins ) {
self::$ins = new self();
}
return self::$ins;
}
/**
* Class constructor
*/
public function __construct() {
parent::__construct();
$this->method = WP_REST_Server::CREATABLE;
$this->route = '/send-test-whatsapp-message';
}
/**
* Default arg.
*/
public function default_args_values() {
return array(
'phone' => '',
'sms_body' => ''
);
}
/**
* API callback
*/
public function process_api_call() {
if ( ! isset( $this->args ) || empty( $this->args ) || ! is_array( $this->args ) ) {
return $this->error_response( __( 'No data found', 'wp-marketing-automations-pro' ) );
}
$phone = $this->args['phone'];
if ( empty( $phone ) ) {
return $this->error_response( __( 'Phone no is required.', 'wp-marketing-automations-pro' ), null, 400 );
}
$sms_body = $this->args['sms_body'];
if ( empty( $sms_body ) ) {
return $this->error_response( __( 'SMS body is required.', 'wp-marketing-automations-pro' ), null, 400 );
}
$data = [];
$imagedata = [];
$first = false;
if ( ! empty( $sms_body ) ) {
if ( isset( $sms_body['body'] ) && ! empty( $sms_body ) ) {
/** Decode Merge Tags for Preview */
BWFAN_Merge_Tag_Loader::set_data( array(
'is_preview' => true,
) );
$sms_body['body'] = BWFAN_Common::decode_merge_tags( $sms_body['body'] );
$data = array(
'type' => 'text',
'data' => $sms_body['body'],
);
}
if ( isset( $sms_body['whatsAppImage'] ) && $sms_body['whatsAppImage'] && isset( $sms_body['whatsAppImageSetting'] ) && isset( $sms_body['whatsAppImageSetting']['imageURL'] ) && ! empty( $sms_body['whatsAppImageSetting']['imageURL'] ) ) {
$imagedata = array(
'type' => 'image',
'data' => $sms_body['whatsAppImageSetting']['imageURL'],
);
if ( isset( $sms_body['whatsAppImageSetting']['position'] ) && ! empty( $sms_body['whatsAppImageSetting']['position'] ) && $sms_body['whatsAppImageSetting']['position'] != 'after' ) {
$first = true;
}
}
}
$finalData = [];
if ( ! empty( $imagedata ) ) {
if ( $first ) {
$finalData = [ $imagedata, $data ];
} else {
$finalData = [ $data, $imagedata ];
}
} else {
$finalData[] = $data;
}
$response = BWFCRM_Core()->conversation->send_whatsapp_message( $phone, $finalData );
if ( $response['status'] == true ) {
return $this->success_response( '', 'Test Message Sent' );
}
return $this->error_response( isset( $response['msg'] ) && ! empty( $response['msg'] ) ? $response['msg'] : 'Unable to send test message', null, 500 );
}
}
BWFCRM_API_Loader::register( 'BWFCRM_API_Send_Test_WhatsApp_Message' );

View File

@@ -0,0 +1,37 @@
<?php
class BWFCRM_API_Upload_Image extends BWFCRM_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::CREATABLE;
$this->route = '/upload-image';
}
public function process_api_call() {
$files = $this->args['files'];
if ( empty( $files ) || ! is_array( $files['image'] ) || ! is_uploaded_file( $files['image']['tmp_name'] ) ) {
$this->response_code = 400;
return $this->error_response( __( 'Not any image file found for import', 'wp-marketing-automations-pro' ), null, 400 );
}
$url = BWFCRM_Core()->email_editor->upload_media( $files['image'] );
if ( empty( $url ) || is_wp_error( $url ) ) {
return $this->error_response( __( 'Unable to upload image file', 'wp-marketing-automations-pro' ), null, 500 );
}
return $this->success_response( $url, __( 'Headers Data', 'wp-marketing-automations-pro' ) );
}
}
BWFCRM_API_Loader::register( 'BWFCRM_API_Upload_Image' );