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,48 @@
<?php
class BWFAN_API_Update_Option extends BWFAN_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::EDITABLE;
$this->route = '/update-option-data/';
}
public function default_args_values() {
return array(
'optionkey' => '',
'optionvalue' => ''
);
}
public function process_api_call() {
$this->response_code = 404;
if ( empty( $this->args['optionkey'] ) || empty( $this->args['optionval'] ) ) {
return $this->error_response( __( "Some data missing", 'wp-marketing-automations' ) );
}
$option_key = $this->args['optionkey'];
$option_val = $this->args['optionval'];
$result = update_option( $option_key, $option_val, true );
if ( $result ) {
$this->response_code = 200;
return $this->success_response( __( "Preference updated", 'wp-marketing-automations' ) );
}
return $this->error_response( __( "Some error occurred, unable to update the preference", 'wp-marketing-automations' ) );
}
}
BWFAN_API_Loader::register( 'BWFAN_API_Update_Option' );

View File

@@ -0,0 +1,62 @@
<?php
class BWFAN_API_Get_User_Prefernece extends BWFAN_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 = '/user-preference/(?P<user_id>[\\d]+)';
$this->request_args = array(
'user_id' => array(
'description' => __( 'User ID to retrieve', 'wp-marketing-automations' ),
'type' => 'integer',
),
);
}
public function default_args_values() {
return array(
'user_id' => 0,
);
}
public function process_api_call() {
/** checking if id present in params **/
$user_id = $this->get_sanitized_arg( 'user_id', 'key' );
if ( $user_id ) {
$user_exists = (bool) get_users( array(
'include' => $user_id,
'fields' => 'ID',
) );
if ( ! $user_exists ) {
$this->response_code = 404;
return $this->error_response( __( "Contact doesn't exists with the ID: ", 'wp-marketing-automations' ) . $user_id );
}
$data = [
'contact_column' => get_user_meta( $user_id, '_bwfan_contact_columns', true ),
'campaign_column' => get_user_meta( $user_id, '_bwfan_broadcast_columns', true )
];
return $this->success_response( $data );
} else {
$this->response_code = 404;
return $this->error_response( __( "Please provide the user for the data", 'wp-marketing-automations' ) );
}
}
}
BWFAN_API_Loader::register( 'BWFAN_API_Get_User_Prefernece' );

View File

@@ -0,0 +1,85 @@
<?php
class BWFAN_API_Update_User_Preference extends BWFAN_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::EDITABLE;
$this->route = '/user-preference/(?P<user_id>[\\d]+)';
}
public function default_args_values() {
return array(
'user_id' => 0,
'data' => []
);
}
public function process_api_call() {
/** checking if id present in params **/
$user_id = $this->get_sanitized_arg( 'user_id', 'key' );
if ( empty( $user_id ) ) {
$this->response_code = 404;
return $this->error_response( __( "Please provide the user for the data.", 'wp-marketing-automations' ) );
}
$user_exists = (bool) get_users( array(
'include' => $user_id,
'fields' => 'ID',
) );
if ( ! $user_exists ) {
$this->response_code = 404;
return $this->error_response( __( "Contact doesn't exists with the id : ", 'wp-marketing-automations' ) . $user_id );
}
if ( ! empty( $this->args['data'] ) && is_array( $this->args['data'] ) ) {
$data = $this->args['data'];
}
if ( isset( $data['contact_column'] ) ) {
update_user_meta( $user_id, '_bwfan_contact_columns', $data['contact_column'] );
}
if ( isset( $data['contact_columnv2'] ) ) {
update_user_meta( $user_id, '_bwfan_contact_columns_v2', $data['contact_columnv2'] );
}
if ( isset( $data['campaign_column'] ) ) {
update_user_meta( $user_id, '_bwfan_broadcast_columns', $data['campaign_column'] );
}
if ( isset( $data['welcome_note_dismiss'] ) ) {
update_user_meta( $user_id, '_bwfan_welcome_note_dismissed', $data['welcome_note_dismiss'] );
}
if ( isset( $data['bwfan_header_notification'] ) ) {
$userdata = get_user_meta( $user_id, '_bwfan_header_notification', true );
$userdata = empty( $userdata ) && ! is_array( $userdata ) ? [] : $userdata;
$userdata[] = $data['bwfan_header_notification'];
$userdata = array_values( array_filter( array_unique( $userdata ) ) );
update_user_meta( $user_id, '_bwfan_header_notification', $userdata );
}
if ( isset( $data['bwfan_failed_automations'] ) ) {
update_user_meta( $user_id, 'bwfan_failed_automations', [
'count' => 0,
'time' => time()
] );
}
if ( isset( $data['table_sort_data'] ) ) {
update_user_meta( $user_id, '_bwfan_table_sort_data', $data['table_sort_data'] );
}
return $this->success_response( [], __( "Preferences Updated ", 'wp-marketing-automations' ) );
}
}
BWFAN_API_Loader::register( 'BWFAN_API_Update_User_Preference' );