Plugin Directory

Changeset 3336438


Ignore:
Timestamp:
07/30/2025 09:08:41 AM (8 months ago)
Author:
productfeeder
Message:

Updated to version 4.1.1

Location:
product-feeder
Files:
13 added
2 edited

Legend:

Unmodified
Added
Removed
  • product-feeder/tags/4.1.0/includes/product-feeder.php

    r3199369 r3336438  
    88        //cd product-feeder
    99        //COPY NEW VERSION FILES TO /tags/{VERSION}
    10         //svn add /tags/{VERSION}
     10        //svn add tags/{VERSION}
    1111        //svn status
    1212        //svn commit -m "Updated to version X"
  • product-feeder/trunk/includes/product-feeder.php

    r3199369 r3336438  
    11<?php
    2 
    3 //TODO REMOVE
    4 //https://developer.woocommerce.com/docs/hpos-extension-recipe-book/?_gl=1*1886zt6*_gcl_au*MTM0NTQzNjEwMS4xNzMyMjg0NTI5*_ga*MTEwNzU0OTg3NC4xNzMyMjcyMjU2*_ga_98K30SHWB2*MTczMjcyODkzMC4yLjAuMTczMjcyODkzMC4wLjAuMA..
    5 
    62    use Automattic\WooCommerce\Utilities\OrderUtil;
    73    use Automattic\WooCommerce\Internal\DataStores\Orders\CustomOrdersTableController;
     
    128        //cd product-feeder
    139        //COPY NEW VERSION FILES TO /tags/{VERSION}
    14         //svn add /tags/{VERSION}
     10        //svn add tags/{VERSION}
    1511        //svn status
    1612        //svn commit -m "Updated to version X"
     
    340336        }
    341337
    342         private function APIError($Error, $Code = 400) {
     338        private function APIError($Error, $Code = 400, $Data = array()) {
    343339            if ($Code == 0) $Code = 400;
    344340            header("Content-type: application/json");
    345341            if (preg_match("/(200|^4|^5)/", $Code)) http_response_code($Code);
    346             wp_send_json(array("Status" => "Error", "Error" => $Error, 'Version' => $this->Version), $Code);
     342            if (!empty($Data)) wp_send_json(array("Status" => "Error", "Error" => $Error, 'Data' => $Data, 'Version' => $this->Version), $Code);
     343            else wp_send_json(array("Status" => "Error", "Error" => $Error, 'Version' => $this->Version), $Code);
    347344        }
    348345
     
    370367
    371368        public function Connect($Request) {
     369            $MissingSettings = array();
    372370            $this->ValidateAPIKey($Request);
    373             if (
    374                 empty(get_option("product-feeder-product-statuses")) ||
    375                 empty(get_option("product-feeder-sizes")) ||
    376                 empty(get_option("product-feeder-brand")) ||
    377                 empty(get_option("product-feeder-default-order-status")) ||
    378                 empty(get_option("product-feeder-accepted-order-statuses")) ||
    379                 empty(get_option("product-feeder-rejected-order-statuses"))
    380             ) $this->APIError('Invalid settings', 403);
     371            foreach (['product-feeder-product-statuses', 'product-feeder-sizes', 'product-feeder-brand', 'product-feeder-default-order-status', 'product-feeder-accepted-order-statuses', 'product-feeder-rejected-order-statuses'] as $Name) {
     372                if (empty(get_option($Name))) $MissingSettings[] = $Name;
     373            }
     374            if (!empty($MissingSettings)) $this->APIError('Invalid settings', 403, $MissingSettings);
    381375            $this->APISuccess();
    382376        }
Note: See TracChangeset for help on using the changeset viewer.