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,44 @@
<?php
/**
* REST API Product Tags controller
*
* Handles requests to the products/tags endpoint.
*
* @package WooCommerce\RestApi
* @since 2.6.0
*/
defined( 'ABSPATH' ) || exit;
/**
* REST API Product Tags controller class.
*
* @package WooCommerce\RestApi
* @extends WC_REST_Product_Tags_V2_Controller
*/
if ( ! class_exists( 'WC_REST_Product_Tags_Controller' ) ) {
return;
}
class BWFCRM_API_Get_Product_Tags extends WC_REST_Product_Tags_Controller {
public static $ins;
public $route = '/products/tags';
public static function get_instance() {
if ( null === self::$ins ) {
self::$ins = new self();
}
return self::$ins;
}
/**
* Endpoint namespace.
*
* @var string
*/
protected $namespace = BWFAN_API_NAMESPACE;
}
BWFCRM_API_Loader::register( 'BWFCRM_API_Get_Product_Tags' );

View File

@@ -0,0 +1,68 @@
<?php
class BWFCRM_Api_Get_WC_Products extends BWFCRM_API_Base {
public static $ins;
public $products = array();
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 = '/products/';
$this->request_args = array(
'search' => array(
'description' => __( 'Search from name', 'wp-marketing-automations-pro' ),
'type' => 'string',
),
);
}
public function process_api_call() {
$search = ! empty( $this->get_sanitized_arg( 'search', 'text_field' ) ) ? $this->get_sanitized_arg( 'search', 'text_field' ) : '';
$ids = BWFAN_Common::search_products( $search, true );
if ( empty( $ids ) ) {
return $this->success_response( [] );
}
/**
* Products types that are allowed in the offers
*/
$product_objects = array_filter( array_map( 'wc_get_product', $ids ), 'wc_products_array_filter_editable' );
$products = array();
foreach ( $product_objects as $product_object ) {
if ( ! $product_object instanceof WC_Product ) {
continue;
}
if ( 'pending' === $product_object->get_status() ) {
continue;
}
$image_url = wp_get_attachment_image_src( get_post_thumbnail_id( $product_object->get_id() ), 'thumbnail', true );
$image_url = isset( $image_url[0] ) ? $image_url[0] : wc_placeholder_img_src();
$image_file_name = basename( $image_url );
$products[] = array(
'id' => $product_object->get_id(),
'name' => strip_tags( rawurldecode( BWFAN_Common::get_formatted_product_name( $product_object ) ) ),
"image" => array( "src" => $image_url, "name" => $image_file_name ),
);
}
$this->response_code = 200;
return $this->success_response( $products );
}
}
BWFCRM_API_Loader::register( 'BWFCRM_Api_Get_WC_Products' );