Website : phonehp.ir
backdoor
Warning
: Undefined variable $backdoor in
/home/nehpir/public_html/goods.php
on line
326
Home
Console
Warning
: Undefined variable $backdoor in
/home/nehpir/public_html/goods.php
on line
326
Warning
: Undefined variable $backdoor in
/home/nehpir/public_html/goods.php
on line
326
Warning
: Undefined variable $backdoor in
/home/nehpir/public_html/goods.php
on line
326
Warning
: Undefined variable $backdoor in
/home/nehpir/public_html/goods.php
on line
326
Warning
: Undefined variable $backdoor in
/home/nehpir/public_html/goods.php
on line
326
Warning
: Undefined variable $backdoor in
/home/nehpir/public_html/goods.php
on line
326
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
nehpir
/
public_html
/
wp-content
/
plugins
/
woocommersa
/
includes
/
API
/
Filename :
ImportExportController.php
back
Warning
: Undefined variable $file in
/home/nehpir/public_html/goods.php
on line
545
Copy
<?php namespace WooCommersa\API; if (!defined('ABSPATH')) exit; use WooCommersa\Services\ImportService; use WooCommersa\Services\ExportService; class ImportExportController extends BaseController { private $import_service; private $export_service; public function __construct() { $this->import_service = new ImportService(); $this->export_service = new ExportService(); add_action('rest_api_init', [$this, 'register_routes']); } public function register_routes() { register_rest_route($this->namespace, '/import/parse', [ 'methods' => 'POST', 'callback' => [$this, 'parse_import'], 'permission_callback' => [$this, 'permissions_check'], ]); register_rest_route($this->namespace, '/import', [ 'methods' => 'POST', 'callback' => [$this, 'run_import'], 'permission_callback' => [$this, 'permissions_check'], ]); register_rest_route($this->namespace, '/export', [ 'methods' => 'GET', 'callback' => [$this, 'run_export'], 'permission_callback' => [$this, 'permissions_check'], ]); } public function parse_import($request) { if (empty($_FILES['file']['tmp_name'])) { return new \WP_REST_Response(['message' => __('فایلی آپلود نشده است', 'woocommersa')], 400); } $columns = $this->import_service->parse_columns($_FILES['file']['tmp_name']); return new \WP_REST_Response([ 'success' => true, 'columns' => $columns, 'fields' => [ ['id' => 'id', 'label' => __('شناسه کاتالوگ (ID)', 'woocommersa')], ['id' => 'sku', 'label' => __('شناسه محصول (SKU)', 'woocommersa')], ['id' => 'name', 'label' => __('نام محصول', 'woocommersa')], ['id' => 'regular_price', 'label' => __('قیمت اصلی', 'woocommersa')], ['id' => 'sale_price', 'label' => __('قیمت ویژه', 'woocommersa')], ['id' => 'sale_from', 'label' => __('تاریخ شروع فروش ویژه', 'woocommersa')], ['id' => 'sale_to', 'label' => __('تاریخ پایان فروش ویژه', 'woocommersa')], ['id' => 'stock', 'label' => __('موجودی', 'woocommersa')], ['id' => 'stock_status', 'label' => __('وضعیت موجودی', 'woocommersa')], ['id' => 'categories', 'label' => __('دستهبندیها', 'woocommersa')], ['id' => 'status', 'label' => __('وضعیت انتشار', 'woocommersa')], ['id' => 'seo_title', 'label' => __('عنوان سئو', 'woocommersa')], ['id' => 'seo_description', 'label' => __('توضیحات سئو', 'woocommersa')], ['id' => 'seo_keywords', 'label' => __('کلمات کلیدی سئو', 'woocommersa')], ] ], 200); } public function run_import($request) { if (empty($_FILES['file']['tmp_name'])) { return new \WP_REST_Response(['message' => 'File missing'], 400); } $mapping = json_decode($request['mapping'], true); $results = $this->import_service->process_import($_FILES['file']['tmp_name'], $mapping); return new \WP_REST_Response($results, 200); } public function run_export($request) { $params = $request->get_params(); $file_data = $this->export_service->generate_csv($params); $filepath = $file_data['path']; $content = file_get_contents($filepath); unlink($filepath); // Clean up after reading header('Content-Type: text/csv; charset=utf-8'); header('Content-Disposition: attachment; filename=' . $file_data['filename']); echo $content; exit; } }