Replace the file_get_content method with wp_remote_get (#346)
This commit is contained in:
parent
61fcad66c5
commit
9fa0421c23
@ -1,3 +1,6 @@
|
|||||||
|
## 2024-09-26 4.8.6
|
||||||
|
* Optimized url-validator
|
||||||
|
|
||||||
## 2024-09-20 4.8.5
|
## 2024-09-20 4.8.5
|
||||||
* Project testing has been updated
|
* Project testing has been updated
|
||||||
|
|
||||||
|
@ -62,6 +62,6 @@ if (!class_exists('WC_Retailcrm_Url_Constraint')) :
|
|||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $getFileError = 'Unable to obtain reference values.';
|
public $getFileError = 'Bad Request, file not getted';
|
||||||
}
|
}
|
||||||
endif;
|
endif;
|
||||||
|
@ -16,6 +16,7 @@ if (!class_exists('WC_Retailcrm_Url_Validator')) :
|
|||||||
{
|
{
|
||||||
const CRM_DOMAINS_URL = 'https://infra-data.retailcrm.tech/crm-domains.json';
|
const CRM_DOMAINS_URL = 'https://infra-data.retailcrm.tech/crm-domains.json';
|
||||||
const BOX_DOMAINS_URL = 'https://infra-data.retailcrm.tech/box-domains.json';
|
const BOX_DOMAINS_URL = 'https://infra-data.retailcrm.tech/box-domains.json';
|
||||||
|
const CRM_ALL_DOMAINS = ["ecomlogic.com", "retailcrm.ru", "retailcrm.pro", "retailcrm.es", "simla.com", "simla.io", "retailcrm.io"];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $crmUrl
|
* @param string $crmUrl
|
||||||
@ -169,9 +170,15 @@ if (!class_exists('WC_Retailcrm_Url_Validator')) :
|
|||||||
private function getValidDomains(string $domainUrl): array
|
private function getValidDomains(string $domainUrl): array
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$content = json_decode(file_get_contents($domainUrl), true);
|
$content = wp_remote_get($domainUrl);
|
||||||
|
|
||||||
return array_column($content['domains'], 'domain');
|
if (!$content instanceof WP_ERROR && $content['response']['code'] === 200) {
|
||||||
|
$domains = json_decode($content['body'], true);
|
||||||
|
|
||||||
|
return array_column($domains['domains'], 'domain');
|
||||||
|
}
|
||||||
|
|
||||||
|
return self::CRM_ALL_DOMAINS;
|
||||||
} catch (Exception $exception) {
|
} catch (Exception $exception) {
|
||||||
throw new ValidatorException($this->getFileError);
|
throw new ValidatorException($this->getFileError);
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ Tags: Интеграция, Simla.com, simla
|
|||||||
Requires PHP: 7.1
|
Requires PHP: 7.1
|
||||||
Requires at least: 5.3
|
Requires at least: 5.3
|
||||||
Tested up to: 6.5
|
Tested up to: 6.5
|
||||||
Stable tag: 4.8.5
|
Stable tag: 4.8.6
|
||||||
License: GPLv1 or later
|
License: GPLv1 or later
|
||||||
License URI: http://www.gnu.org/licenses/gpl-1.0.html
|
License URI: http://www.gnu.org/licenses/gpl-1.0.html
|
||||||
|
|
||||||
@ -82,6 +82,9 @@ Asegúrate de tener una clave API específica para cada tienda. Las siguientes i
|
|||||||
|
|
||||||
|
|
||||||
== Changelog ==
|
== Changelog ==
|
||||||
|
= 4.8.6 =
|
||||||
|
* Optimized url-validator
|
||||||
|
|
||||||
= 4.8.5 =
|
= 4.8.5 =
|
||||||
* Project testing has been updated
|
* Project testing has been updated
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* Description: Integration plugin for WooCommerce & Simla.com
|
* Description: Integration plugin for WooCommerce & Simla.com
|
||||||
* Author: RetailDriver LLC
|
* Author: RetailDriver LLC
|
||||||
* Author URI: http://retailcrm.pro/
|
* Author URI: http://retailcrm.pro/
|
||||||
* Version: 4.8.5
|
* Version: 4.8.6
|
||||||
* Tested up to: 6.5
|
* Tested up to: 6.5
|
||||||
* Requires Plugins: woocommerce
|
* Requires Plugins: woocommerce
|
||||||
* WC requires at least: 5.4
|
* WC requires at least: 5.4
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
*
|
*
|
||||||
* @link https://wordpress.org/plugins/woo-retailcrm/
|
* @link https://wordpress.org/plugins/woo-retailcrm/
|
||||||
*
|
*
|
||||||
* @version 4.8.5
|
* @version 4.8.6
|
||||||
*
|
*
|
||||||
* @package RetailCRM
|
* @package RetailCRM
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user