From d012d0ed0758cc58dea7dbb282e2e27e12728fab Mon Sep 17 00:00:00 2001 From: davidmolinacano Date: Wed, 9 Oct 2024 09:33:37 +0200 Subject: [PATCH] feat: Moved entities to src/Entity directory + minor improvements --- autoloader.php | 7 ++++ config.php | 6 ++-- controllers/front/landing.php | 4 +-- doofinder-ajax.php | 4 +-- doofinder.php | 10 +++--- feeds/category.php | 4 +-- feeds/cms.php | 4 +-- feeds/product.php | 4 +-- landing.php | 6 ++-- {lib => src/Entity}/DfCategoryBuild.php | 4 +-- {lib => src/Entity}/DfCmsBuild.php | 2 +- {lib => src/Entity}/DfProductBuild.php | 2 +- {lib => src/Entity}/DfTools.php | 36 +++++++++---------- .../Entity}/DoofinderAdminPanelView.php | 2 +- {lib => src/Entity}/DoofinderApi.php | 13 +++---- {lib => src/Entity}/DoofinderApiIndex.php | 2 +- {lib => src/Entity}/DoofinderApiItems.php | 2 +- {lib => src/Entity}/DoofinderApiLanding.php | 2 +- .../Entity}/DoofinderApiUniqueScript.php | 2 +- {lib => src/Entity}/DoofinderConfig.php | 2 +- {lib => src/Entity}/DoofinderConstants.php | 2 +- {lib => src/Entity}/DoofinderException.php | 2 +- {lib => src/Entity}/DoofinderInstallation.php | 2 +- {lib => src/Entity}/DoofinderLayerApi.php | 2 +- {lib => src/Entity}/DoofinderResults.php | 2 +- {lib => src/Entity}/DoofinderScript.php | 2 +- {lib => src/Entity}/EasyREST.php | 8 ++--- {lib => src/Entity}/FormManager.php | 2 +- {lib => src/Entity}/HookManager.php | 2 +- {lib => src/Entity}/LanguageManager.php | 2 +- {lib => src/Entity}/SearchEngine.php | 2 +- {lib => src/Entity}/UpdateOnSave.php | 2 +- {lib => src/Entity}/UrlManager.php | 2 +- {lib => src/Entity}/index.php | 0 src/index.php | 23 ++++++++++++ upgrade/upgrade-4.8.2.php | 2 +- 36 files changed, 100 insertions(+), 75 deletions(-) rename {lib => src/Entity}/DfCategoryBuild.php (92%) rename {lib => src/Entity}/DfCmsBuild.php (97%) rename {lib => src/Entity}/DfProductBuild.php (99%) rename {lib => src/Entity}/DfTools.php (97%) rename {lib => src/Entity}/DoofinderAdminPanelView.php (99%) rename {lib => src/Entity}/DoofinderApi.php (99%) rename {lib => src/Entity}/DoofinderApiIndex.php (96%) rename {lib => src/Entity}/DoofinderApiItems.php (97%) rename {lib => src/Entity}/DoofinderApiLanding.php (99%) rename {lib => src/Entity}/DoofinderApiUniqueScript.php (97%) rename {lib => src/Entity}/DoofinderConfig.php (99%) rename {lib => src/Entity}/DoofinderConstants.php (94%) rename {lib => src/Entity}/DoofinderException.php (77%) rename {lib => src/Entity}/DoofinderInstallation.php (99%) rename {lib => src/Entity}/DoofinderLayerApi.php (95%) rename {lib => src/Entity}/DoofinderResults.php (99%) rename {lib => src/Entity}/DoofinderScript.php (97%) rename {lib => src/Entity}/EasyREST.php (98%) rename {lib => src/Entity}/FormManager.php (98%) rename {lib => src/Entity}/HookManager.php (98%) rename {lib => src/Entity}/LanguageManager.php (98%) rename {lib => src/Entity}/SearchEngine.php (97%) rename {lib => src/Entity}/UpdateOnSave.php (99%) rename {lib => src/Entity}/UrlManager.php (98%) rename {lib => src/Entity}/index.php (100%) create mode 100644 src/index.php diff --git a/autoloader.php b/autoloader.php index 056c069..994c91b 100644 --- a/autoloader.php +++ b/autoloader.php @@ -18,6 +18,9 @@ class Autoloader { + // Exceptions based on: https://devdocs.prestashop-project.org/8/modules/creation/module-file-structure/ + const EXCEPTIONS_FOR_UNCAPITALIZE = ['Entity', 'Controller']; + /** * Registers the autoloader according to PrestaShop standards, which are PSR-12 standards. * More info at: https://www.php-fig.org/psr/psr-12/ @@ -74,6 +77,10 @@ private static function pathFromNamespace($fullNameSpace) */ private static function uncapitalize($text) { + if (in_array($text, self::EXCEPTIONS_FOR_UNCAPITALIZE, true)) { + return $text; + } + return strtolower(substr($text, 0, 1)) . substr($text, 1); } } diff --git a/config.php b/config.php index fb0a15c..57f3906 100644 --- a/config.php +++ b/config.php @@ -13,9 +13,9 @@ * @license GPLv3 */ -use PrestaShop\Module\Doofinder\Lib\DfTools; -use PrestaShop\Module\Doofinder\Lib\DoofinderConfig; -use PrestaShop\Module\Doofinder\Lib\DoofinderConstants; +use PrestaShop\Module\Doofinder\Src\Entity\DfTools; +use PrestaShop\Module\Doofinder\Src\Entity\DoofinderConfig; +use PrestaShop\Module\Doofinder\Src\Entity\DoofinderConstants; $root_path = dirname(dirname(dirname($_SERVER['SCRIPT_FILENAME']))); $config_file_path = $root_path . '/config/config.inc.php'; diff --git a/controllers/front/landing.php b/controllers/front/landing.php index 4e342da..c3181e8 100644 --- a/controllers/front/landing.php +++ b/controllers/front/landing.php @@ -13,8 +13,8 @@ * @license GPLv3 */ -use PrestaShop\Module\Doofinder\Lib\DoofinderApiLanding; -use PrestaShop\Module\Doofinder\Lib\SearchEngine; +use PrestaShop\Module\Doofinder\Src\Entity\DoofinderApiLanding; +use PrestaShop\Module\Doofinder\Src\Entity\SearchEngine; use PrestaShop\PrestaShop\Adapter\Image\ImageRetriever; use PrestaShop\PrestaShop\Adapter\Product\PriceFormatter; use PrestaShop\PrestaShop\Adapter\Product\ProductColorsRetriever; diff --git a/doofinder-ajax.php b/doofinder-ajax.php index 0c0eab1..44f7d95 100644 --- a/doofinder-ajax.php +++ b/doofinder-ajax.php @@ -13,8 +13,8 @@ * @license GPLv3 */ -use PrestaShop\Module\Doofinder\Lib\DoofinderApi; -use PrestaShop\Module\Doofinder\Lib\DoofinderInstallation; +use PrestaShop\Module\Doofinder\Src\Entity\DoofinderApi; +use PrestaShop\Module\Doofinder\Src\Entity\DoofinderInstallation; $rootPath = dirname(dirname(dirname($_SERVER['SCRIPT_FILENAME']))); $configFilePath = $rootPath . '/config/config.inc.php'; diff --git a/doofinder.php b/doofinder.php index 580a65f..87bc8cd 100644 --- a/doofinder.php +++ b/doofinder.php @@ -18,11 +18,11 @@ require_once 'autoloader.php'; -use PrestaShop\Module\Doofinder\Lib\DoofinderAdminPanelView; -use PrestaShop\Module\Doofinder\Lib\DoofinderInstallation; -use PrestaShop\Module\Doofinder\Lib\DoofinderScript; -use PrestaShop\Module\Doofinder\Lib\HookManager; -use PrestaShop\Module\Doofinder\Lib\SearchEngine; +use PrestaShop\Module\Doofinder\Src\Entity\DoofinderAdminPanelView; +use PrestaShop\Module\Doofinder\Src\Entity\DoofinderInstallation; +use PrestaShop\Module\Doofinder\Src\Entity\DoofinderScript; +use PrestaShop\Module\Doofinder\Src\Entity\HookManager; +use PrestaShop\Module\Doofinder\Src\Entity\SearchEngine; class Doofinder extends Module { diff --git a/feeds/category.php b/feeds/category.php index 9f951ed..6925a2f 100644 --- a/feeds/category.php +++ b/feeds/category.php @@ -13,8 +13,8 @@ * @license GPLv3 */ -use PrestaShop\Module\Doofinder\Lib\DfCategoryBuild; -use PrestaShop\Module\Doofinder\Lib\DfTools; +use PrestaShop\Module\Doofinder\Src\Entity\DfCategoryBuild; +use PrestaShop\Module\Doofinder\Src\Entity\DfTools; if (function_exists('set_time_limit')) { @set_time_limit(3600 * 2); diff --git a/feeds/cms.php b/feeds/cms.php index 9a6d2e7..891b3e8 100644 --- a/feeds/cms.php +++ b/feeds/cms.php @@ -13,8 +13,8 @@ * @license GPLv3 */ -use PrestaShop\Module\Doofinder\Lib\DfCmsBuild; -use PrestaShop\Module\Doofinder\Lib\DfTools; +use PrestaShop\Module\Doofinder\Src\Entity\DfCmsBuild; +use PrestaShop\Module\Doofinder\Src\Entity\DfTools; if (function_exists('set_time_limit')) { @set_time_limit(3600 * 2); diff --git a/feeds/product.php b/feeds/product.php index 59bff6b..d82fa9a 100644 --- a/feeds/product.php +++ b/feeds/product.php @@ -13,8 +13,8 @@ * @license GPLv3 */ -use PrestaShop\Module\Doofinder\Lib\DfTools; -use PrestaShop\Module\Doofinder\Lib\DoofinderConstants; +use PrestaShop\Module\Doofinder\Src\Entity\DfTools; +use PrestaShop\Module\Doofinder\Src\Entity\DoofinderConstants; if (!defined('_PS_VERSION_')) { exit; diff --git a/landing.php b/landing.php index 0387aa6..729f1bd 100644 --- a/landing.php +++ b/landing.php @@ -13,9 +13,9 @@ * @license GPLv3 */ -use PrestaShop\Module\Doofinder\Lib\DoofinderConfig; -use PrestaShop\Module\Doofinder\Lib\DoofinderConstants; -use PrestaShop\Module\Doofinder\Lib\LanguageManager; +use PrestaShop\Module\Doofinder\Src\Entity\DoofinderConfig; +use PrestaShop\Module\Doofinder\Src\Entity\DoofinderConstants; +use PrestaShop\Module\Doofinder\Src\Entity\LanguageManager; $rootPath = dirname(dirname(dirname($_SERVER['SCRIPT_FILENAME']))); $configFilePath = $rootPath . '/config/config.inc.php'; diff --git a/lib/DfCategoryBuild.php b/src/Entity/DfCategoryBuild.php similarity index 92% rename from lib/DfCategoryBuild.php rename to src/Entity/DfCategoryBuild.php index c74a01b..d158907 100644 --- a/lib/DfCategoryBuild.php +++ b/src/Entity/DfCategoryBuild.php @@ -13,7 +13,7 @@ * @license GPLv3 */ -namespace PrestaShop\Module\Doofinder\Lib; +namespace PrestaShop\Module\Doofinder\Src\Entity; if (!defined('_PS_VERSION_')) { exit; @@ -71,7 +71,7 @@ private function buildCategory($idCategory) $c['meta_description'] = DfTools::cleanString($category->meta_description); $c['tags'] = DfTools::cleanString($category->meta_keywords); $c['link'] = $this->link->getCategoryLink($category); - $c['image_link'] = $category->id_image ? $this->link->getCatImageLink($category->link_rewrite, $category->id_image, 'category_default') : ''; + $c['image_link'] = $category->id_image ? $this->link->getCatImageLink($category->link_rewrite, $category->id_image, \ImageType::getFormattedName('category')) : ''; return $c; } diff --git a/lib/DfCmsBuild.php b/src/Entity/DfCmsBuild.php similarity index 97% rename from lib/DfCmsBuild.php rename to src/Entity/DfCmsBuild.php index c9e7722..905b31f 100644 --- a/lib/DfCmsBuild.php +++ b/src/Entity/DfCmsBuild.php @@ -13,7 +13,7 @@ * @license GPLv3 */ -namespace PrestaShop\Module\Doofinder\Lib; +namespace PrestaShop\Module\Doofinder\Src\Entity; if (!defined('_PS_VERSION_')) { exit; diff --git a/lib/DfProductBuild.php b/src/Entity/DfProductBuild.php similarity index 99% rename from lib/DfProductBuild.php rename to src/Entity/DfProductBuild.php index 1a27923..b9f4491 100644 --- a/lib/DfProductBuild.php +++ b/src/Entity/DfProductBuild.php @@ -13,7 +13,7 @@ * @license GPLv3 */ -namespace PrestaShop\Module\Doofinder\Lib; +namespace PrestaShop\Module\Doofinder\Src\Entity; if (!defined('_PS_VERSION_')) { exit; diff --git a/lib/DfTools.php b/src/Entity/DfTools.php similarity index 97% rename from lib/DfTools.php rename to src/Entity/DfTools.php index 7dc94c4..ba323dc 100644 --- a/lib/DfTools.php +++ b/src/Entity/DfTools.php @@ -13,7 +13,7 @@ * @license GPLv3 */ -namespace PrestaShop\Module\Doofinder\Lib; +namespace PrestaShop\Module\Doofinder\Src\Entity; if (!defined('_PS_VERSION_')) { exit; @@ -61,10 +61,10 @@ public static function prepareSQL($sql, $args = []) public static function limitSQL($sql, $limit = false, $offset = false) { if (false !== $limit && is_numeric($limit)) { - $sql .= ' LIMIT ' . intval($limit); + $sql .= ' LIMIT ' . (int) $limit; if (false !== $offset && is_numeric($offset)) { - $sql .= ' OFFSET ' . intval($offset); + $sql .= ' OFFSET ' . (int) $offset; } } @@ -92,7 +92,7 @@ public static function getAvailableImageSizes() `products` = 1 ORDER BY CASE - WHEN name = 'home_default' THEN '1' + WHEN name = '" . \ImageType::getFormattedName('home') . "' THEN '1' END DESC; "; @@ -145,9 +145,9 @@ public static function versionGte($minVersion) $minVersion = explode('.', $minVersion); foreach ($version as $index => $value) { - if (intval($value) > intval($minVersion[$index])) { + if ((int) $value > (int) $minVersion[$index]) { return true; - } elseif (intval($value) < intval($minVersion[$index])) { + } elseif ((int) $value < (int) $minVersion[$index]) { return false; } } @@ -868,13 +868,13 @@ public static function getCategoriesForProductIdAndLanguage($idProduct, $idLang, foreach (\Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql) as $i => $row) { if (!$i) { - $idCategory0 = intval($row['id_category']); - $nleft0 = intval($row['nleft']); - $nright0 = intval($row['nright']); + $idCategory0 = (int) $row['id_category']; + $nleft0 = (int) $row['nleft']; + $nright0 = (int) $row['nright']; } else { - $idCategory1 = intval($row['id_category']); - $nleft1 = intval($row['nleft']); - $nright1 = intval($row['nright']); + $idCategory1 = (int) $row['id_category']; + $nleft1 = (int) $row['nleft']; + $nright1 = (int) $row['nright']; if ($nleft1 < $nleft0 && $nright1 > $nright0) { // $idCategory1 is an ancestor of $idCategory0 @@ -981,7 +981,7 @@ public static function getCmsPages($idLang, $idShop, $active = true) public static function truncateText($text, $length) { - $l = intval($length); + $l = (int) $length; $c = trim(preg_replace('/\s+/', ' ', $text)); if (strlen($c) <= $l) { @@ -1169,7 +1169,7 @@ public static function getCurrencyForLanguageFromRequest(\Language $lang) { if ($idCurrency = \Tools::getValue('currency')) { if (is_numeric($idCurrency)) { - $idCurrency = intval($idCurrency); + $idCurrency = (int) $idCurrency; } else { $idCurrency = \Currency::getIdByIsoCode(strtoupper($idCurrency)); } @@ -1411,8 +1411,8 @@ public static function getOnsalePrice($productId, $includeTaxes, $variantId = nu private static function getVariantUrl($product, $context) { - global $lang, $shop; - $cfgModRewrite = self::cfg($shop->id, 'PS_REWRITING_SETTINGS', DoofinderConstants::YES); + $context = \Context::getContext(); + $cfgModRewrite = self::cfg($context->shop->id, 'PS_REWRITING_SETTINGS', DoofinderConstants::YES); return self::cleanURL( $context->link->getProductLink( @@ -1420,8 +1420,8 @@ private static function getVariantUrl($product, $context) $product['link_rewrite'], $product['cat_link_rew'], $product['ean13'], - $lang->id, - $shop->id, + $context->language->id, + $context->shop->id, (int) $product['id_product_attribute'], $cfgModRewrite, false, diff --git a/lib/DoofinderAdminPanelView.php b/src/Entity/DoofinderAdminPanelView.php similarity index 99% rename from lib/DoofinderAdminPanelView.php rename to src/Entity/DoofinderAdminPanelView.php index 103768b..d01ac85 100644 --- a/lib/DoofinderAdminPanelView.php +++ b/src/Entity/DoofinderAdminPanelView.php @@ -13,7 +13,7 @@ * @license GPLv3 */ -namespace PrestaShop\Module\Doofinder\Lib; +namespace PrestaShop\Module\Doofinder\Src\Entity; if (!defined('_PS_VERSION_')) { exit; diff --git a/lib/DoofinderApi.php b/src/Entity/DoofinderApi.php similarity index 99% rename from lib/DoofinderApi.php rename to src/Entity/DoofinderApi.php index bb9b17f..2783911 100644 --- a/lib/DoofinderApi.php +++ b/src/Entity/DoofinderApi.php @@ -16,7 +16,7 @@ * Gilles Devaux () (https://github.com/flaptor/indextank-php) */ -namespace PrestaShop\Module\Doofinder\Lib; +namespace PrestaShop\Module\Doofinder\Src\Entity; if (!defined('_PS_VERSION_')) { exit; @@ -372,15 +372,10 @@ public function removeTerm($filterName, $term) if ($this->optionExists('filter') && isset($this->searchOptions['filter'][$filterName]) && in_array($term, $this->searchOptions['filter'][$filterName]) ) { - function filter_me($value) - { - global $term; - - return $value != $term; - } - $this->searchOptions['filter'][$filterName] = - array_filter($this->searchOptions['filter'][$filterName], 'filter_me'); + array_filter($this->searchOptions['filter'][$filterName], function ($value) use ($term) { + return $value !== $term; + }); } } diff --git a/lib/DoofinderApiIndex.php b/src/Entity/DoofinderApiIndex.php similarity index 96% rename from lib/DoofinderApiIndex.php rename to src/Entity/DoofinderApiIndex.php index a88db34..b6b4713 100644 --- a/lib/DoofinderApiIndex.php +++ b/src/Entity/DoofinderApiIndex.php @@ -13,7 +13,7 @@ * @license GPLv3 */ -namespace PrestaShop\Module\Doofinder\Lib; +namespace PrestaShop\Module\Doofinder\Src\Entity; if (!defined('_PS_VERSION_')) { exit; diff --git a/lib/DoofinderApiItems.php b/src/Entity/DoofinderApiItems.php similarity index 97% rename from lib/DoofinderApiItems.php rename to src/Entity/DoofinderApiItems.php index daac617..1ba8390 100644 --- a/lib/DoofinderApiItems.php +++ b/src/Entity/DoofinderApiItems.php @@ -13,7 +13,7 @@ * @license GPLv3 */ -namespace PrestaShop\Module\Doofinder\Lib; +namespace PrestaShop\Module\Doofinder\Src\Entity; if (!defined('_PS_VERSION_')) { exit; diff --git a/lib/DoofinderApiLanding.php b/src/Entity/DoofinderApiLanding.php similarity index 99% rename from lib/DoofinderApiLanding.php rename to src/Entity/DoofinderApiLanding.php index 9601abd..241cadc 100644 --- a/lib/DoofinderApiLanding.php +++ b/src/Entity/DoofinderApiLanding.php @@ -13,7 +13,7 @@ * @license GPLv3 */ -namespace PrestaShop\Module\Doofinder\Lib; +namespace PrestaShop\Module\Doofinder\Src\Entity; if (!defined('_PS_VERSION_')) { exit; diff --git a/lib/DoofinderApiUniqueScript.php b/src/Entity/DoofinderApiUniqueScript.php similarity index 97% rename from lib/DoofinderApiUniqueScript.php rename to src/Entity/DoofinderApiUniqueScript.php index 1606ee3..08cb123 100644 --- a/lib/DoofinderApiUniqueScript.php +++ b/src/Entity/DoofinderApiUniqueScript.php @@ -13,7 +13,7 @@ * @license GPLv3 */ -namespace PrestaShop\Module\Doofinder\Lib; +namespace PrestaShop\Module\Doofinder\Src\Entity; if (!defined('_PS_VERSION_')) { exit; diff --git a/lib/DoofinderConfig.php b/src/Entity/DoofinderConfig.php similarity index 99% rename from lib/DoofinderConfig.php rename to src/Entity/DoofinderConfig.php index 134ebcb..55cc09a 100644 --- a/lib/DoofinderConfig.php +++ b/src/Entity/DoofinderConfig.php @@ -13,7 +13,7 @@ * @license GPLv3 */ -namespace PrestaShop\Module\Doofinder\Lib; +namespace PrestaShop\Module\Doofinder\Src\Entity; if (!defined('_PS_VERSION_')) { exit; diff --git a/lib/DoofinderConstants.php b/src/Entity/DoofinderConstants.php similarity index 94% rename from lib/DoofinderConstants.php rename to src/Entity/DoofinderConstants.php index 8e965b7..0255d00 100644 --- a/lib/DoofinderConstants.php +++ b/src/Entity/DoofinderConstants.php @@ -13,7 +13,7 @@ * @license GPLv3 */ -namespace PrestaShop\Module\Doofinder\Lib; +namespace PrestaShop\Module\Doofinder\Src\Entity; if (!defined('_PS_VERSION_')) { exit; diff --git a/lib/DoofinderException.php b/src/Entity/DoofinderException.php similarity index 77% rename from lib/DoofinderException.php rename to src/Entity/DoofinderException.php index f5b83c3..02947af 100644 --- a/lib/DoofinderException.php +++ b/src/Entity/DoofinderException.php @@ -5,7 +5,7 @@ * @license GPLv3 */ -namespace PrestaShop\Module\Doofinder\Lib; +namespace PrestaShop\Module\Doofinder\Src\Entity; if (!defined('_PS_VERSION_')) { exit; diff --git a/lib/DoofinderInstallation.php b/src/Entity/DoofinderInstallation.php similarity index 99% rename from lib/DoofinderInstallation.php rename to src/Entity/DoofinderInstallation.php index f4624d7..7f3d0a0 100644 --- a/lib/DoofinderInstallation.php +++ b/src/Entity/DoofinderInstallation.php @@ -13,7 +13,7 @@ * @license GPLv3 */ -namespace PrestaShop\Module\Doofinder\Lib; +namespace PrestaShop\Module\Doofinder\Src\Entity; if (!defined('_PS_VERSION_')) { exit; diff --git a/lib/DoofinderLayerApi.php b/src/Entity/DoofinderLayerApi.php similarity index 95% rename from lib/DoofinderLayerApi.php rename to src/Entity/DoofinderLayerApi.php index ca0c2a0..cc02eb3 100644 --- a/lib/DoofinderLayerApi.php +++ b/src/Entity/DoofinderLayerApi.php @@ -13,7 +13,7 @@ * @license GPLv3 */ -namespace PrestaShop\Module\Doofinder\Lib; +namespace PrestaShop\Module\Doofinder\Src\Entity; if (!defined('_PS_VERSION_')) { exit; diff --git a/lib/DoofinderResults.php b/src/Entity/DoofinderResults.php similarity index 99% rename from lib/DoofinderResults.php rename to src/Entity/DoofinderResults.php index fd97953..86069f0 100644 --- a/lib/DoofinderResults.php +++ b/src/Entity/DoofinderResults.php @@ -12,7 +12,7 @@ * - getResults: get an array with the results */ -namespace PrestaShop\Module\Doofinder\Lib; +namespace PrestaShop\Module\Doofinder\Src\Entity; if (!defined('_PS_VERSION_')) { exit; diff --git a/lib/DoofinderScript.php b/src/Entity/DoofinderScript.php similarity index 97% rename from lib/DoofinderScript.php rename to src/Entity/DoofinderScript.php index 157c86a..49a05e8 100644 --- a/lib/DoofinderScript.php +++ b/src/Entity/DoofinderScript.php @@ -13,7 +13,7 @@ * @license GPLv3 */ -namespace PrestaShop\Module\Doofinder\Lib; +namespace PrestaShop\Module\Doofinder\Src\Entity; if (!defined('_PS_VERSION_')) { exit; diff --git a/lib/EasyREST.php b/src/Entity/EasyREST.php similarity index 98% rename from lib/EasyREST.php rename to src/Entity/EasyREST.php index b6516bb..f3406a7 100644 --- a/lib/EasyREST.php +++ b/src/Entity/EasyREST.php @@ -10,7 +10,7 @@ * @license GPLv3 */ -namespace PrestaShop\Module\Doofinder\Lib; +namespace PrestaShop\Module\Doofinder\Src\Entity; if (!defined('_PS_VERSION_')) { exit; @@ -39,9 +39,9 @@ public function __construct($followLocation = true) if ($followLocation) { curl_setopt($this->curl, CURLOPT_FOLLOWLOCATION, true); // This too } - curl_setopt($this->curl, CURLOPT_HEADER, true); // THis verbose option for extracting the headers - global $debug_response; - if ($debug_response) { + curl_setopt($this->curl, CURLOPT_HEADER, true); // This verbose option for extracting the headers + $isDebugCurlActivated = \Configuration::get('DF_DEBUG_CURL'); + if ($isDebugCurlActivated) { curl_setopt($this->curl, CURLOPT_CONNECTTIMEOUT, 5); curl_setopt($this->curl, CURLOPT_TIMEOUT, 5); } diff --git a/lib/FormManager.php b/src/Entity/FormManager.php similarity index 98% rename from lib/FormManager.php rename to src/Entity/FormManager.php index 0d890ce..3053858 100644 --- a/lib/FormManager.php +++ b/src/Entity/FormManager.php @@ -13,7 +13,7 @@ * @license GPLv3 */ -namespace PrestaShop\Module\Doofinder\Lib; +namespace PrestaShop\Module\Doofinder\Src\Entity; if (!defined('_PS_VERSION_')) { exit; diff --git a/lib/HookManager.php b/src/Entity/HookManager.php similarity index 98% rename from lib/HookManager.php rename to src/Entity/HookManager.php index 1f3f1f8..62ffc4a 100644 --- a/lib/HookManager.php +++ b/src/Entity/HookManager.php @@ -13,7 +13,7 @@ * @license GPLv3 */ -namespace PrestaShop\Module\Doofinder\Lib; +namespace PrestaShop\Module\Doofinder\Src\Entity; if (!defined('_PS_VERSION_')) { exit; diff --git a/lib/LanguageManager.php b/src/Entity/LanguageManager.php similarity index 98% rename from lib/LanguageManager.php rename to src/Entity/LanguageManager.php index bb93696..42fd599 100644 --- a/lib/LanguageManager.php +++ b/src/Entity/LanguageManager.php @@ -13,7 +13,7 @@ * @license GPLv3 */ -namespace PrestaShop\Module\Doofinder\Lib; +namespace PrestaShop\Module\Doofinder\Src\Entity; if (!defined('_PS_VERSION_')) { exit; diff --git a/lib/SearchEngine.php b/src/Entity/SearchEngine.php similarity index 97% rename from lib/SearchEngine.php rename to src/Entity/SearchEngine.php index 8235013..8750fdd 100644 --- a/lib/SearchEngine.php +++ b/src/Entity/SearchEngine.php @@ -13,7 +13,7 @@ * @license GPLv3 */ -namespace PrestaShop\Module\Doofinder\Lib; +namespace PrestaShop\Module\Doofinder\Src\Entity; if (!defined('_PS_VERSION_')) { exit; diff --git a/lib/UpdateOnSave.php b/src/Entity/UpdateOnSave.php similarity index 99% rename from lib/UpdateOnSave.php rename to src/Entity/UpdateOnSave.php index 94f4052..f404074 100644 --- a/lib/UpdateOnSave.php +++ b/src/Entity/UpdateOnSave.php @@ -13,7 +13,7 @@ * @license GPLv3 */ -namespace PrestaShop\Module\Doofinder\Lib; +namespace PrestaShop\Module\Doofinder\Src\Entity; if (!defined('_PS_VERSION_')) { exit; diff --git a/lib/UrlManager.php b/src/Entity/UrlManager.php similarity index 98% rename from lib/UrlManager.php rename to src/Entity/UrlManager.php index d6b784d..db93c18 100644 --- a/lib/UrlManager.php +++ b/src/Entity/UrlManager.php @@ -13,7 +13,7 @@ * @license GPLv3 */ -namespace PrestaShop\Module\Doofinder\Lib; +namespace PrestaShop\Module\Doofinder\Src\Entity; if (!defined('_PS_VERSION_')) { exit; diff --git a/lib/index.php b/src/Entity/index.php similarity index 100% rename from lib/index.php rename to src/Entity/index.php diff --git a/src/index.php b/src/index.php new file mode 100644 index 0000000..b0759d6 --- /dev/null +++ b/src/index.php @@ -0,0 +1,23 @@ +