diff --git a/CHANGELOG.md b/CHANGELOG.md index 3aaf032..115a63b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 2022-11-09 4.5.2 +* Add validator for CRM URL + ## 2022-11-09 4.5.1 * Correction of RAM overflow during ICMP product catalog generation. diff --git a/VERSION b/VERSION index 99523d4..689f7fb 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -4.5.1 \ No newline at end of file +4.5.2 \ No newline at end of file diff --git a/resources/pot/retailcrm-es_ES.pot b/resources/pot/retailcrm-es_ES.pot index dcab8f6..18d23f1 100644 --- a/resources/pot/retailcrm-es_ES.pot +++ b/resources/pot/retailcrm-es_ES.pot @@ -64,9 +64,6 @@ msgstr "Los clientes y pedidos están subidos" msgid "Enter the correct API key" msgstr "Introduce la llave API correcta" -msgid "Enter the correct URL of Simla.com" -msgstr "Introduce el enlace del Simla.com correcto" - msgid "This functionality allows to generate ICML products catalog for uploading to Simla.com" msgstr "Esta función permite generar los catálogos de pedidos ICML para subida al Simla.com" @@ -163,7 +160,7 @@ msgstr "Ajustes de API" msgid "Enter your API key. You can find it in the administration section of Simla.com" msgstr "Introduce la llave API. Puede encontrarla en apartado administrativo del Simla.com" -msgid "Enter API of URL (https://yourdomain.simla.com)" +msgid "Enter API URL (https://yourdomain.simla.com)" msgstr "Introduce enlace de API (https://yourdomain.simla.com)" msgid "Integration with Simla.com management system" @@ -341,4 +338,34 @@ msgid "Cron tasks cleared" msgstr "Trabajos cron borrados" msgid "Untitled" -msgstr "Intitulado" \ No newline at end of file +msgstr "Intitulado" + +msgid "Incorrect protocol. Only https is allowed." +msgstr "Protocolo incorrecto. Sólo se permite https." + +msgid "The domain path must be empty." +msgstr "La ruta del dominio debe estar vacía." + +msgid "An invalid domain is specified." +msgstr "Se especifica un dominio no válido." + +msgid "The port does not need to be specified." +msgstr "No es necesario especificar el puerto." + +msgid "Incorrect Host URL." +msgstr "URL del Host incorrecta." + +msgid "Incorrect URL." +msgstr "URL incorrecta." + +msgid "The query must be blank." +msgstr "La consulta debe estar en blanco." + +msgid "The fragment should be blank." +msgstr "El fragmento debe estar en blanco." + +msgid "No need to provide authorization data." +msgstr "No es necesario proporcionar datos de autorización." + +msgid "Unable to obtain reference values." +msgstr "No se pueden obtener valores de referencia." diff --git a/resources/pot/retailcrm-ru_RU.pot b/resources/pot/retailcrm-ru_RU.pot index 375680b..8817fb2 100644 --- a/resources/pot/retailcrm-ru_RU.pot +++ b/resources/pot/retailcrm-ru_RU.pot @@ -73,9 +73,6 @@ msgstr "Клиенты и заказы были выгружены" msgid "Enter the correct API key" msgstr "Введите корректный API ключ" -msgid "Enter the correct URL of Simla.com" -msgstr "Введите корректный адрес Simla.com" - msgid "This functionality allows to generate ICML products catalog for uploading to Simla.com" msgstr "Эта функция позволяет сгенерировать ICML каталог товаров для выгрузки в Simla.com" @@ -172,7 +169,7 @@ msgstr "Настройки API" msgid "Enter your API key. You can find it in the administration section of Simla.com" msgstr "Введите API ключ. Вы можете найти его в административном разделе Simla.com" -msgid "Enter API of URL (https://yourdomain.simla.com)" +msgid "Enter API URL (https://yourdomain.simla.com)" msgstr "Введите API URL (https://yourdomain.simla.com)" msgid "Integration with Simla.com management system" @@ -352,3 +349,32 @@ msgstr "Cron задачи очищены" msgid "Untitled" msgstr "Без названия" +msgid "Incorrect protocol. Only https is allowed." +msgstr "Некорректный протокол. Допускается только https." + +msgid "The domain path must be empty." +msgstr "Путь к домену должен быть пустым." + +msgid "An invalid domain is specified." +msgstr "Указан недопустимый домен." + +msgid "The port does not need to be specified." +msgstr "Не нужно указывать порт." + +msgid "Incorrect Host URL." +msgstr "Некорректный URL хоста" + +msgid "Incorrect URL." +msgstr "Некорректный URL." + +msgid "The query must be blank." +msgstr "Запрос должен быть пустым." + +msgid "The fragment should be blank." +msgstr "Фрагмент должен быть пустым." + +msgid "No need to provide authorization data." +msgstr "Нет необходимости предоставлять авторизационные данные." + +msgid "Unable to obtain reference values." +msgstr "Не удалось получить эталонное значение" diff --git a/src/include/abstracts/class-wc-retailcrm-abstracts-settings.php b/src/include/abstracts/class-wc-retailcrm-abstracts-settings.php index 5d3f442..dfa3ba6 100644 --- a/src/include/abstracts/class-wc-retailcrm-abstracts-settings.php +++ b/src/include/abstracts/class-wc-retailcrm-abstracts-settings.php @@ -84,7 +84,7 @@ abstract class WC_Retailcrm_Abstracts_Settings extends WC_Integration 'api_url' => [ 'title' => __('API of URL', 'retailcrm'), 'type' => 'text', - 'description' => __('Enter API of URL (https://yourdomain.simla.com)', 'retailcrm'), + 'description' => __('Enter API URL (https://yourdomain.simla.com)', 'retailcrm'), 'desc_tip' => true, 'default' => '' ], @@ -692,14 +692,9 @@ abstract class WC_Retailcrm_Abstracts_Settings extends WC_Integration $validateMessage = $this->urlValidator->validateUrl($value); if ('' !== $validateMessage) { - WC_Admin_Settings::add_error(esc_html__('Enter the correct URL of Simla.com:' . $validateMessage, 'retailcrm')); - - // Need check if change API data in settings - if (isset($_POST['woocommerce_integration-retailcrm_whatsapp_number'])) { - header("Refresh:3"); - } - $value = ''; + + WC_Admin_Settings::add_error(esc_html__($validateMessage, 'retailcrm')); } $this->crmUrl = $value; @@ -728,14 +723,9 @@ abstract class WC_Retailcrm_Abstracts_Settings extends WC_Integration $response = $api->apiVersions(); if (empty($response) || !$response->isSuccessful()) { - WC_Admin_Settings::add_error(esc_html__('Enter the correct API key', 'retailcrm')); - - // Need check if change API data in settings - if (isset($_POST['woocommerce_integration-retailcrm_whatsapp_number'])) { - header("Refresh:3"); - } - $value = ''; + + WC_Admin_Settings::add_error(esc_html__('Enter the correct API key', 'retailcrm')); } else { header("Refresh:0"); } diff --git a/src/include/validators/url-validator/class-wc-retailcrm-url-constraint.php b/src/include/validators/url-validator/class-wc-retailcrm-url-constraint.php index be219d3..ef9adab 100644 --- a/src/include/validators/url-validator/class-wc-retailcrm-url-constraint.php +++ b/src/include/validators/url-validator/class-wc-retailcrm-url-constraint.php @@ -4,7 +4,7 @@ if (!class_exists('WC_Retailcrm_Url_Constraint')) : /** * PHP version 7.0 * - * Class WC_Retailcrm_Url_Constraint - Constraint for CRM url. + * Class WC_Retailcrm_Url_Constraint - Constraint for CRM URL. * * @category Integration * @author RetailCRM diff --git a/src/include/validators/url-validator/class-wc-retailcrm-url-validator.php b/src/include/validators/url-validator/class-wc-retailcrm-url-validator.php index 248a34b..0f1b245 100644 --- a/src/include/validators/url-validator/class-wc-retailcrm-url-validator.php +++ b/src/include/validators/url-validator/class-wc-retailcrm-url-validator.php @@ -4,7 +4,7 @@ if (!class_exists('WC_Retailcrm_Url_Validator')) : /** * PHP version 7.0 * - * Class WC_Retailcrm_Url_Validator - Validate CRM url. + * Class WC_Retailcrm_Url_Validator - Validate CRM URL. * * @category Integration * @author RetailCRM diff --git a/src/languages/retailcrm-es_ES.mo b/src/languages/retailcrm-es_ES.mo index 8c7c8b1..be30a9f 100644 Binary files a/src/languages/retailcrm-es_ES.mo and b/src/languages/retailcrm-es_ES.mo differ diff --git a/src/languages/retailcrm-ru_RU.mo b/src/languages/retailcrm-ru_RU.mo index 9b8246d..35011bf 100644 Binary files a/src/languages/retailcrm-ru_RU.mo and b/src/languages/retailcrm-ru_RU.mo differ diff --git a/src/readme.txt b/src/readme.txt index 69f2979..4aef4a0 100644 --- a/src/readme.txt +++ b/src/readme.txt @@ -5,7 +5,7 @@ Tags: Интеграция, Simla.com, simla Requires PHP: 7.0 Requires at least: 5.3 Tested up to: 6.0 -Stable tag: 4.5.1 +Stable tag: 4.5.2 License: GPLv1 or later 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 == += 4.5.2 = +* Add validator for CRM URL + = 4.5.1 = * Correction of RAM overflow during ICMP product catalog generation. diff --git a/src/retailcrm.php b/src/retailcrm.php index 637be60..62799a0 100644 --- a/src/retailcrm.php +++ b/src/retailcrm.php @@ -5,7 +5,7 @@ * Description: Integration plugin for WooCommerce & Simla.com * Author: RetailDriver LLC * Author URI: http://retailcrm.pro/ - * Version: 4.5.1 + * Version: 4.5.2 * Tested up to: 6.0 * WC requires at least: 5.4 * WC tested up to: 6.9 diff --git a/src/uninstall.php b/src/uninstall.php index 756cd67..d24f6ea 100644 --- a/src/uninstall.php +++ b/src/uninstall.php @@ -16,7 +16,7 @@ * * @link https://wordpress.org/plugins/woo-retailcrm/ * - * @version 4.5.1 + * @version 4.5.2 * * @package RetailCRM */ diff --git a/tests/test-wc-retailcrm-base.php b/tests/test-wc-retailcrm-base.php index bf26428..47f9860 100644 --- a/tests/test-wc-retailcrm-base.php +++ b/tests/test-wc-retailcrm-base.php @@ -375,11 +375,12 @@ class WC_Retailcrm_Base_Test extends WC_Retailcrm_Test_Case_Helper $this->baseRetailcrm->validate_api_url_field('', 'https://test.test.pro') ); + $this->assertEquals('', $this->baseRetailcrm->validate_api_url_field('', '')); + $this->assertEquals('', $this->baseRetailcrm->validate_api_url_field('', 'https://tedsast.simla.comssd')); $this->assertEquals('', $this->baseRetailcrm->validate_api_url_field('', 'http://test.retailcrm.pro')); $this->assertEquals('', $this->baseRetailcrm->validate_api_url_field('', 'https://test.simla.com?query=test')); - $this->assertEquals('', $this->baseRetailcrm->validate_api_url_field('', 'https://test.simla.com?pass=test')); - $this->assertEquals('', $this->baseRetailcrm->validate_api_url_field('', 'https://test.simla.com?user=test')); - $this->assertEquals('', $this->baseRetailcrm->validate_api_url_field('', 'https://te.simla.com?fragment=test')); + $this->assertEquals('', $this->baseRetailcrm->validate_api_url_field('', 'https://pass:user@test.simla.com')); + $this->assertEquals('', $this->baseRetailcrm->validate_api_url_field('', 'https://test.simla.com#fragment')); $this->assertEquals('', $this->baseRetailcrm->validate_api_url_field('', 'https://test.simla.com:12345')); $this->assertEquals('', $this->baseRetailcrm->validate_api_url_field('', 'https://test.simla.com/test')); }