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,52 @@
<?php
class BWFAN_API_Create_Groups 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 default_args_values() {
$args = array(
'group_name' => '',
);
return $args;
}
public function __construct() {
parent::__construct();
$this->method = WP_REST_Server::CREATABLE;
$this->route = '/v3/groupfields';
$this->response_code = 200;
}
public function process_api_call() {
/**
* getting post data
*/
$group_name = $this->get_sanitized_arg( 'group_name', 'text_field' );
if ( empty( $group_name ) ) {
$this->response_code = 400;
return $this->error_response( __( "Required group missing", "wp-marketing-automations" ) );
}
$group = BWFCRM_Group::add_group( $group_name );
$response = __( 'Field group created', 'wp-marketing-automations' );
return $this->success_response( $group, $response );
}
}
BWFAN_API_Loader::register( 'BWFAN_API_Create_Groups' );

View File

@@ -0,0 +1,62 @@
<?php
class BWFAN_Api_Delete_Group 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::DELETABLE;
$this->route = '/v3/groupfields/(?P<group_id>[\\d]+)';
$this->response_code = 200;
}
public function default_args_values() {
$args = array(
'group_id' => '',
'move_to_group' => ''
);
return $args;
}
public function process_api_call() {
$group_id = $this->get_sanitized_arg( 'group_id', 'text_field' );
$move_group_id = $this->get_sanitized_arg( 'move_to_group', 'text_field' );
$move_group_id = ! empty( $move_group_id ) ? $move_group_id : 0;
if ( empty( $group_id ) ) {
$this->response_code = 400;
$response = __( "Group Id is missing", 'wp-marketing-automations' );
return $this->error_response( $response );
}
BWFCRM_Fields::field_move_to_group( $group_id, $move_group_id );
$delete_group = BWFAN_Model_Field_Groups::delete( $group_id );
if ( 0 === $delete_group ) {
$this->response_code = 400;
/* translators: 1: Group ID */
return $this->error_response( sprintf( __( 'Unable to delete group with group id %1$d', 'wp-marketing-automations' ), $group_id ) );
}
return $this->success_response( __( 'Field group deleted', 'wp-marketing-automations' ) );
}
}
BWFAN_API_Loader::register( 'BWFAN_API_Delete_Group' );

View File

@@ -0,0 +1,61 @@
<?php
class BWFAN_API_Get_Fields_With_Groups extends BWFAN_API_Base {
public static $ins;
public $fields;
public $count_data = [];
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 = '/v3/groupfields';
$this->response_code = 200;
$this->fields = array();
}
public function process_api_call() {
$response = '';
try {
$fields = BWFCRM_Fields::get_groups_with_fields( false, true, true );
} catch ( Error $e ) {
$response = $e->getMessage();
}
if ( empty( $fields ) ) {
$this->response_code = 500;
$response = empty( $response ) ? __( "No fields found", "wp-marketing-automations" ) : $response;
return $this->error_response( $response );
}
$this->fields = $fields;
$address_fields = BWFCRM_Fields::get_address_fields_from_db();
$final_result = array(
'fields' => $this->fields,
'extra_fields' => $address_fields
);
$this->count_data = BWFAN_Common::get_contact_data_counts();
return $this->success_response( $final_result, __( 'Got ALL Groups with Fields', 'wp-marketing-automations' ) );
}
public function get_result_total_count() {
return count( $this->fields );
}
public function get_result_count_data() {
return $this->count_data;
}
}
BWFAN_API_Loader::register( 'BWFAN_API_Get_Fields_With_Groups' );

View File

@@ -0,0 +1,58 @@
<?php
class BWFAN_Api_Get_Group_Fields 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 = '/v3/groupfields/(?P<group_id>[\\d]+)';
$this->request_args = array(
'group_id' => array(
'description' => __( 'Group ID to retrieve', 'wp-marketing-automations' ),
'type' => 'integer',
),
);
$this->response_code = 200;
$this->fields = array();
}
public function default_args_values() {
$args = array(
'group_id' => ''
);
return $args;
}
public function process_api_call() {
$group_id = $this->get_sanitized_arg( 'group_id', 'text_field' );
$fields = BWFCRM_Fields::get_group_fields( $group_id );
if ( empty( $fields ) ) {
$this->response_code = 404;
$response = __( "No fields found", "wp-marketing-automations" );
return $this->error_response( $response );
}
$this->fields = $fields;
return $this->success_response( $fields, __( 'Got All Group\'s Fields', 'wp-marketing-automations' ) );
}
public function get_result_total_count() {
return count( $this->fields );
}
}
BWFAN_API_Loader::register( 'BWFAN_Api_Get_Group_Fields' );

View File

@@ -0,0 +1,64 @@
<?php
class BWFAN_API_Moved_Fields_To_Group 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::EDITABLE;
$this->route = '/v3/groupfields/move';
$this->response_code = 200;
}
public function default_args_values() {
$args = array(
'group_id' => '',
'move_group_id' => ''
);
return $args;
}
public function process_api_call() {
$group_id = $this->get_sanitized_arg( 'group_id', 'text_field' );
$move_group_id = $this->get_sanitized_arg( 'move_group_id', 'text_field' );
if ( ! isset( $group_id ) ) {
$this->response_code = 400;
$response = __( "Group Id is missing", 'wp-marketing-automations' );
return $this->error_response( $response );
}
if ( ! isset( $move_group_id ) ) {
$this->response_code = 400;
$response = __( "Move Group Id is missing", 'wp-marketing-automations' );
return $this->error_response( $response );
}
$moved = BWFCRM_Fields::field_move_to_group( $group_id, $move_group_id );
if ( 0 === $moved ) {
$this->response_code = 400;
return $this->error_response( __( 'Unable to move the field to new group', 'wp-marketing-automations' ) );
}
return $this->success_response( __( 'Field updated', 'wp-marketing-automations' ) );
}
}
BWFAN_API_Loader::register( 'BWFAN_API_Moved_Fields_To_Group' );

View File

@@ -0,0 +1,50 @@
<?php
class BWFAN_API_Sort_Group_Fields 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::CREATABLE;
$this->route = '/v3/groupfields/sort';
$this->response_code = 200;
$this->fields = array();
}
public function default_args_values() {
$args = array(
'field_sort' => []
);
return $args;
}
public function process_api_call() {
if ( empty( $this->args['field_sort'] ) ) {
$this->response_code = 404;
$response = __( "Required parameter is missing.", "wp-marketing-automations" );
return $this->error_response( $response );
}
update_option( 'bwf_crm_field_sort', $this->args['field_sort'] );
return $this->success_response( $this->args['field_sort'], __( 'Fields order updated', 'wp-marketing-automations' ) );
}
public function get_result_total_count() {
return count( $this->fields );
}
}
BWFAN_API_Loader::register( 'BWFAN_API_Sort_Group_Fields' );

View File

@@ -0,0 +1,79 @@
<?php
class BWFAN_Api_Update_Group 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::EDITABLE;
$this->route = '/v3/groupfields/(?P<group_id>[\\d]+)';
$this->response_code = 200;
}
public function default_args_values() {
$args = array(
'group_id' => '',
'group_name' => '',
);
return $args;
}
public function process_api_call() {
$group_id = $this->get_sanitized_arg( 'group_id', 'text_field' );
if ( empty( $group_id ) ) {
$this->response_code = 400;
$response = __( "Group Id is missing", 'wp-marketing-automations' );
return $this->error_response( $response );
}
$group_name = $this->get_sanitized_arg( 'group_name', 'text_field' );
if ( empty( $group_name ) ) {
$this->response_code = 400;
$response = __( "Group name is missing", 'wp-marketing-automations' );
return $this->error_response( $response );
}
$data = array(
'name' => $group_name,
);
$where = array(
'ID' => $group_id,
);
$update_group = BWFAN_Model_Field_Groups::update( $data, $where );
if ( 0 === $update_group ) {
$this->response_code = 400;
/* translators: 1: Group ID */
return $this->error_response( sprintf( __( 'Unable to update group with group id %1$d', 'wp-marketing-automations' ), $group_id ) );
}
$group = BWFCRM_Group::get_groupby_id( $group_id );
$fields = BWFCRM_Fields::get_group_fields( $group_id );
if ( ! empty( $fields ) ) {
$group[0]['fields'] = $fields['fields'];
}
return $this->success_response( $group, __( 'Field group updated', 'wp-marketing-automations' ) );
}
}
BWFAN_API_Loader::register( 'BWFAN_Api_Update_Group' );