$options
- */
- public function buildForm(FormBuilderInterface $builder, array $options): void
- {
- $webpDisabled = $this->allWebpConvertersDisabled();
- $extraAttributes = [];
-
- if ($webpDisabled) {
- $extraAttributes = [
- 'alert_message' => $this->trans('Webp converters not available contact your admin or hosting provider.', 'Modules.isthemecore.Admin'),
- 'alert_type' => 'danger',
- 'alert_position' => 'append',
- ];
- }
-
- $builder
- ->add('webp_enabled',
- SwitchType::class,
- array_merge(
- [
- 'required' => false,
- 'label' => $this->trans('Enable WEBP', 'Modules.isthemecore.Admin'),
- 'disabled' => $webpDisabled,
- ],
- $extraAttributes
- )
- )
- ->add('webp_sharpyuv',
- SwitchType::class,
- [
- 'required' => false,
- 'label' => $this->trans('Enable better RGB->YUV color conversion', 'Modules.isthemecore.Admin'),
- 'disabled' => $webpDisabled,
- ]
- )
- ->add('webp_quality',
- TextType::class,
- [
- 'required' => false,
- 'label' => $this->trans('Webp quality', 'Modules.isthemecore.Admin'),
- 'help' => $this->trans('Range 1-100', 'Modules.isthemecore.Admin'),
- 'disabled' => $webpDisabled,
- 'constraints' => [
- $this->getRangeConstraint(1, 100),
- $this->getNotBlankConstraint(),
- ],
- ]
- )
- ->add('webp_converter',
- ChoiceType::class,
- [
- 'choices' => $this->convertersList,
- 'label' => $this->trans('Webp converter options', 'Modules.isthemecore.Admin'),
- 'disabled' => $webpDisabled,
- 'expanded' => true,
- 'multiple' => false,
- 'choice_attr' => function ($choice) {
- return ['disabled' => $this->convertersListFull[$choice]['disabled']];
- },
- 'choice_label' => function ($choice) {
- return $this->convertersListFull[$choice]['label'] . ($this->convertersListFull[$choice]['disabled'] ? '' . $this->trans('not available', 'Modules.isthemecore.Admin') . '' : '');
- },
- ]
- )
- ->add('erase_all_webp', IconButtonType::class, [
- 'label' => $this->trans('Erase all webp images', 'Modules.isthemecore.Admin'),
- 'type' => 'link',
- 'icon' => 'delete',
- 'attr' => [
- 'class' => 'btn-danger',
- 'href' => $this->router->generate(
- 'is_themecore_module_settings_webp_erase_all',
- [
- 'type' => 'all',
- ]
- ),
- ],
- ])
- ->add('erase_product_webp', IconButtonType::class, [
- 'label' => $this->trans('Erase all product webp images', 'Modules.isthemecore.Admin'),
- 'type' => 'link',
- 'icon' => 'delete',
- 'attr' => [
- 'class' => 'btn-danger',
- 'href' => $this->router->generate(
- 'is_themecore_module_settings_webp_erase_all',
- [
- 'type' => 'product',
- ]
- ),
- ],
- ])
- ->add('erase_modules_webp', IconButtonType::class, [
- 'label' => $this->trans('Erase all modules webp images', 'Modules.isthemecore.Admin'),
- 'type' => 'link',
- 'icon' => 'delete',
- 'attr' => [
- 'class' => 'btn-danger',
- 'href' => $this->router->generate(
- 'is_themecore_module_settings_webp_erase_all',
- [
- 'type' => 'module',
- ]
- ),
- ],
- ])
- ->add('erase_cms_webp', IconButtonType::class, [
- 'label' => $this->trans('Erase all CMS webp images', 'Modules.isthemecore.Admin'),
- 'type' => 'link',
- 'icon' => 'delete',
- 'attr' => [
- 'class' => 'btn-danger',
- 'href' => $this->router->generate(
- 'is_themecore_module_settings_webp_erase_all',
- [
- 'type' => 'cms',
- ]
- ),
- ],
- ])
- ->add('erase_themes_webp', IconButtonType::class, [
- 'label' => $this->trans('Erase all themes webp images', 'Modules.isthemecore.Admin'),
- 'type' => 'link',
- 'icon' => 'delete',
- 'attr' => [
- 'class' => 'btn-danger',
- 'href' => $this->router->generate(
- 'is_themecore_module_settings_webp_erase_all',
- [
- 'type' => 'themes',
- ]
- ),
- ],
- ]);
- }
-
- /**
- * {@inheritdoc}
- *
- * @see MultistoreConfigurationTypeExtension
- */
- public function getParent(): string
- {
- return MultistoreConfigurationType::class;
- }
-
- /**
- * @return NotBlank
- */
- private function getNotBlankConstraint()
- {
- return new NotBlank([
- 'message' => $this->trans('This field cannot be empty.', 'Modules.isthemecore.Admin'),
- ]);
- }
-
- /**
- * @return Range
- */
- private function getRangeConstraint(int $min = 1, int $max = 100)
- {
- return new Range([
- 'min' => $min,
- 'max' => $max,
- 'invalidMessage' => $this->trans(
- 'This field value have to be between %min% and %max%.',
- 'Modules.isthemecore.Admin',
- [
- '%min%' => $min,
- '%max%' => $max,
- ]
- ),
- ]);
- }
-}
diff --git a/is_themecore/is_themecore/src/Form/Settings/index.php b/is_themecore/is_themecore/src/Form/Settings/index.php
deleted file mode 100644
index 88355f6..0000000
--- a/is_themecore/is_themecore/src/Form/Settings/index.php
+++ /dev/null
@@ -1,11 +0,0 @@
-module = $module;
- $this->context = \Context::getContext();
- }
-
- /**
- * @return array
- */
- public function getAvailableHooks()
- {
- return static::HOOK_LIST;
- }
-}
diff --git a/is_themecore/is_themecore/src/Hook/Assets.php b/is_themecore/is_themecore/src/Hook/Assets.php
deleted file mode 100644
index 133a3f8..0000000
--- a/is_themecore/is_themecore/src/Hook/Assets.php
+++ /dev/null
@@ -1,45 +0,0 @@
-context->controller->unregisterJavascript('facetedsearch_front');
- $this->context->controller->unregisterStylesheet('facetedsearch_front');
-
- $needsJQueryUi = \Module::isEnabled('pm_advancedsearch4') && $this->context->controller instanceof \ProductListingFrontController;
-
- if (!$needsJQueryUi) {
- $this->context->controller->unregisterJavascript('jquery-ui');
- $this->context->controller->unregisterStylesheet('jquery-ui');
- $this->context->controller->unregisterStylesheet('jquery-ui-theme');
- }
- }
-
- public function hookActionFrontControllerSetMedia()
- {
- $assetsRegister = new ThemeAssetsRegister(
- new ThemeAssetConfigProvider(_PS_THEME_DIR_),
- $this->context
- );
-
- $assetsRegister->registerThemeAssets();
-
- \Media::addJsDef([
- 'listDisplayAjaxUrl' => $this->context->link->getModuleLink($this->module->name, 'ajaxTheme'),
- ]);
- }
-}
diff --git a/is_themecore/is_themecore/src/Hook/Header.php b/is_themecore/is_themecore/src/Hook/Header.php
deleted file mode 100644
index 1e66050..0000000
--- a/is_themecore/is_themecore/src/Hook/Header.php
+++ /dev/null
@@ -1,136 +0,0 @@
-context->smarty->assign([
- 'listingDisplayType' => $themeListDisplay->getDisplay(),
- 'preloadCss' => \Configuration::get(GeneralConfiguration::THEMECORE_PRELOAD_CSS),
- 'webpEnabled' => \Configuration::get(WebpConfiguration::THEMECORE_WEBP_ENABLED),
- 'loadPartytown' => (bool) \Configuration::get(GeneralConfiguration::THEMECORE_LOAD_PARTY_TOWN),
- 'debugPartytown' => (bool) \Configuration::get(GeneralConfiguration::THEMECORE_DEBUG_PARTY_TOWN),
- ]);
- }
-
- public function hookDisplayHeader(): string
- {
- $themeListDisplay = new ThemeListDisplay();
- $breadcrumbs = (new ThemeBreadcrumbs())->getBreadcrumb();
-
- if ($breadcrumbs['count']) {
- $this->context->smarty->assign([
- 'breadcrumb' => $breadcrumbs,
- ]);
- }
-
- $this->context->smarty->assign([
- 'jsonData' => $this->getStructuredData(),
- 'partytownScript' => $this->getPartytownScript(),
- 'partytownScriptUri' => $this->getPartytownScriptUri(),
- ]);
-
- return $this->module->fetch('module:is_themecore/views/templates/hook/head.tpl');
- }
-
- private function getPartytownScriptUri(): string
- {
- try {
- $uriResolver = $this->module->get(PartytownScriptUriResolver::class);
- } catch (\Exception $e) {
- $uriResolver = null;
- }
-
- if ($uriResolver) {
- return $uriResolver->getScriptUri();
- }
-
- return '';
- }
-
- private function getPartytownScript(): string
- {
- try {
- $partytownScript = $this->module->get(PartytownScript::class);
- } catch (\Exception $e) {
- $partytownScript = null;
- }
-
- if ($partytownScript instanceof PartytownScript) {
- return $partytownScript->getScriptContent();
- }
-
- return '';
- }
-
- private function getStructuredData(): array
- {
- $dataArray = [];
-
- if ($this->context->controller instanceof \ProductControllerCore && $this->context->controller->getProduct()->id !== null) {
- try {
- $productData = $this->module->get(ProductStructuredData::class);
- } catch (\Exception $e) {
- $productData = null;
- }
-
- if ($productData instanceof StructuredDataInterface) {
- $dataArray[] = $productData->getFormattedData();
- }
- }
-
- try {
- $breadcrumbData = $this->module->get(BreadcrumbStructuredData::class);
- } catch (\Exception $e) {
- $breadcrumbData = null;
- }
-
- if ($breadcrumbData instanceof StructuredDataInterface) {
- $dataArray[] = $breadcrumbData->getFormattedData();
- }
-
- try {
- $shopData = $this->module->get(ShopStructuredData::class);
- } catch (\Exception $e) {
- $shopData = null;
- }
-
- if ($shopData instanceof StructuredDataInterface) {
- $dataArray[] = $shopData->getFormattedData();
- }
-
- if ($this->context->controller->getPageName() === 'index') {
- try {
- $website = $this->module->get(WebsiteStructuredData::class);
- } catch (\Exception $e) {
- $website = null;
- }
-
- if ($website instanceof StructuredDataInterface) {
- $dataArray[] = $website->getFormattedData();
- }
- }
-
- return $dataArray;
- }
-}
diff --git a/is_themecore/is_themecore/src/Hook/Htaccess.php b/is_themecore/is_themecore/src/Hook/Htaccess.php
deleted file mode 100644
index efcfba2..0000000
--- a/is_themecore/is_themecore/src/Hook/Htaccess.php
+++ /dev/null
@@ -1,36 +0,0 @@
-module->get('oksydan.module.is_themecore.core.htaccess.htaccess_generator');
-
- $generator->generate();
- $generator->writeFile();
- }
-
- public function hookObjectShopUrlAddAfter()
- {
- $this->hookActionHtaccessCreate();
- }
-
- public function hookObjectShopUrlUpdateAfter()
- {
- $this->hookActionHtaccessCreate();
- }
-
- public function hookObjectShopUrlDeleteAfter()
- {
- $this->hookActionHtaccessCreate();
- }
-}
diff --git a/is_themecore/is_themecore/src/Hook/HtmlOutput.php b/is_themecore/is_themecore/src/Hook/HtmlOutput.php
deleted file mode 100644
index a90bedd..0000000
--- a/is_themecore/is_themecore/src/Hook/HtmlOutput.php
+++ /dev/null
@@ -1,111 +0,0 @@
-loadHTML(
- '' . $html,
- LIBXML_NOERROR | LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD
- );
- $links = $doc->getElementsByTagName('link');
-
- foreach ($links as $link) {
- $rel = $link->hasAttribute('rel') ? $link->attributes->getNamedItem('rel')->nodeValue : false;
- $as = $link->hasAttribute('as') ? $link->attributes->getNamedItem('as')->nodeValue : false;
-
- if ($webpEnabled && $rel === 'preload' && $as === 'image') {
- $newLink = $doc->createElement('link');
- $src = urldecode($link->attributes->getNamedItem('href')->nodeValue);
-
- $newLink->setAttribute('href', str_replace(['.png', '.jpg', '.jpeg'], '.webp', $src));
-
- foreach ($link->attributes as $attribute) {
- if ($attribute->nodeName !== 'href') {
- $newLink->setAttribute($attribute->nodeName, $attribute->nodeValue);
- }
- }
-
- $link->parentNode->replaceChild($newLink, $link);
- }
-
- if ($earlyHintsEnabled && in_array($rel, self::REL_LIST)) {
- if (isset($newLink)) {
- $link = $newLink;
- unset($newLink);
- }
-
- switch ($rel) {
- case 'preload':
- $this->handlePreloadFromNodeElement($link);
- break;
- case 'preconnect':
- $this->handlePreconnectFromNodeElement($link);
- break;
- }
- }
- }
-
- if ($webpEnabled) {
- $content = $doc->saveHTML();
- $content = str_replace('', '', $content);
- $params['html'] = $content;
- }
-
- if (!empty($this->headers)) {
- header('Link: ' . implode(', ', $this->headers));
- }
-
- libxml_use_internal_errors($preConfig);
- }
-
- private function handlePreloadFromNodeElement($nodeElement)
- {
- $preloadAs = $nodeElement->attributes->getNamedItem('as')->nodeValue;
-
- if (in_array($preloadAs, self::PRELOAD_TYPES_TO_EARLY_HINT)) {
- $url = $nodeElement->attributes->getNamedItem('href')->nodeValue;
-
- $this->headers[] = "<$url>; rel=preload; as=$preloadAs";
- }
- }
-
- private function handlePreconnectFromNodeElement($nodeElement)
- {
- $url = $nodeElement->attributes->getNamedItem('href')->nodeValue;
-
- $this->headers[] = "<$url>; rel=preconnect";
- }
-}
diff --git a/is_themecore/is_themecore/src/Hook/Smarty.php b/is_themecore/is_themecore/src/Hook/Smarty.php
deleted file mode 100644
index a83f7ec..0000000
--- a/is_themecore/is_themecore/src/Hook/Smarty.php
+++ /dev/null
@@ -1,70 +0,0 @@
-context->smarty->registered_plugins['function']['generateImagesSources'])) {
- $this->context->smarty->registerPlugin('function', 'generateImagesSources', ['Oksydan\Module\IsThemeCore\Core\Smarty\SmartyHelperFunctions', 'generateImagesSources']);
- } else {
- return;
- }
-
- if (!isset($this->context->smarty->registered_plugins['function']['generateImageSvgPlaceholder'])) {
- $this->context->smarty->registerPlugin('function', 'generateImageSvgPlaceholder', ['Oksydan\Module\IsThemeCore\Core\Smarty\SmartyHelperFunctions', 'generateImageSvgPlaceholder']);
- } else {
- return;
- }
-
- if (!isset($this->context->smarty->registered_plugins['function']['appendParamToUrl'])) {
- $this->context->smarty->registerPlugin('function', 'appendParamToUrl', ['Oksydan\Module\IsThemeCore\Core\Smarty\SmartyHelperFunctions', 'appendParamToUrl']);
- } else {
- return;
- }
-
- if (!isset($this->context->smarty->registered_plugins['block']['images_block'])) {
- $this->context->smarty->registerPlugin('block', 'images_block', ['Oksydan\Module\IsThemeCore\Core\Smarty\SmartyHelperFunctions', 'imagesBlock']);
- } else {
- return;
- }
-
- if (!isset($this->context->smarty->registered_plugins['block']['cms_images_block'])) {
- $this->context->smarty->registerPlugin('block', 'cms_images_block', ['Oksydan\Module\IsThemeCore\Core\Smarty\SmartyHelperFunctions', 'cmsImagesBlock']);
- } else {
- return;
- }
-
- if (!isset($this->context->smarty->registered_plugins['block']['display_mobile'])) {
- $this->context->smarty->registerPlugin('block', 'display_mobile', ['Oksydan\Module\IsThemeCore\Core\Smarty\SmartyHelperFunctions', 'displayMobileBlock']);
- } else {
- return;
- }
-
- if (!isset($this->context->smarty->registered_plugins['block']['display_desktop'])) {
- $this->context->smarty->registerPlugin('block', 'display_desktop', ['Oksydan\Module\IsThemeCore\Core\Smarty\SmartyHelperFunctions', 'displayDesktopBlock']);
- } else {
- return;
- }
- if (!isset($this->context->smarty->registered_plugins['modifier']['is_bright'])) {
- $this->context->smarty->registerPlugin('modifier', 'is_bright', ['Oksydan\Module\IsThemeCore\Core\Smarty\SmartyHelperFunctions', 'isBright']);
- } else {
- return;
- }
- if (!isset($this->context->smarty->registered_plugins['function']['svg_icon'])) {
- $this->context->smarty->registerPlugin('function', 'svg_icon', ['Oksydan\Module\IsThemeCore\Core\Smarty\SmartyHelperFunctions', 'displaySvgIcon']);
- } else {
- return;
- }
- if (!isset($this->context->smarty->registered_plugins['function']['price_split'])) {
- $this->context->smarty->registerPlugin('function', 'price_split', ['Oksydan\Module\IsThemeCore\Core\Smarty\SmartyHelperFunctions', 'displayPriceSplit']);
- } else {
- return;
- }
- }
-}
diff --git a/is_themecore/is_themecore/src/HookDispatcher.php b/is_themecore/is_themecore/src/HookDispatcher.php
deleted file mode 100644
index 0598c8b..0000000
--- a/is_themecore/is_themecore/src/HookDispatcher.php
+++ /dev/null
@@ -1,63 +0,0 @@
-hooks[] = $hook;
- }
- }
-
- /**
- * Get available hooks
- *
- * @return string[]
- */
- public function getAvailableHooks()
- {
- $availableHooks = [];
- foreach ($this->hooks as $hook) {
- $availableHooks = array_merge($availableHooks, $hook->getAvailableHooks());
- }
-
- return $availableHooks;
- }
-
- public function dispatch($hookName, array $params = [])
- {
- foreach ($this->hooks as $hook) {
- if (method_exists($hook, $hookName)) {
- return $hook->{$hookName}($params);
- }
- }
-
- return false;
- }
-}
diff --git a/is_themecore/is_themecore/src/index.php b/is_themecore/is_themecore/src/index.php
deleted file mode 100644
index 88355f6..0000000
--- a/is_themecore/is_themecore/src/index.php
+++ /dev/null
@@ -1,11 +0,0 @@
-in($rootDir)
- ->exclude(['vendor', 'node_modules'])
-;
-
-$config = new PrestaShop\CodingStandards\CsFixer\Config();
-return $config
- ->setUsingCache(true)
- ->setCacheFile(__DIR__.'/.php-cs-fixer.cache')
- ->setFinder($finder)
-;
diff --git a/is_themecore/is_themecore/tests/php/.phpstan_bootstrap.neon b/is_themecore/is_themecore/tests/php/.phpstan_bootstrap.neon
deleted file mode 100644
index 5111ecf..0000000
--- a/is_themecore/is_themecore/tests/php/.phpstan_bootstrap.neon
+++ /dev/null
@@ -1,3 +0,0 @@
-parameters:
- bootstrapFiles:
- - %currentWorkingDirectory%/tests/php/.phpstan_bootstrap.php
\ No newline at end of file
diff --git a/is_themecore/is_themecore/tests/php/.phpstan_bootstrap.php b/is_themecore/is_themecore/tests/php/.phpstan_bootstrap.php
deleted file mode 100644
index d961241..0000000
--- a/is_themecore/is_themecore/tests/php/.phpstan_bootstrap.php
+++ /dev/null
@@ -1,70 +0,0 @@
-getMessage();
- exit(1);
-}
-
-// ----------- end of script -------------
-
-function include_env_configuration(): bool
-{
- if (file_exists(PHPSTAN_PS_ROOT_CONFIG_FILE)) {
- require PHPSTAN_PS_ROOT_CONFIG_FILE;
-
- return true;
- }
-
- return false;
-}
-
-function create_default_config_file_and_exit(): void
-{
- if (!getenv('_PS_ROOT_DIR_')) {
- echo 'Environment variable _PS_ROOT_DIR_ not set.' . PHP_EOL;
-
- // check if config file exists and create a default one if needed.
- if (!file_exists(PHPSTAN_PS_ROOT_CONFIG_FILE)) {
- file_put_contents(PHPSTAN_PS_ROOT_CONFIG_FILE,
- '&1 | (! grep -v "No syntax errors detected")
\ No newline at end of file
diff --git a/is_themecore/is_themecore/tests/php/phpstan.dist.neon b/is_themecore/is_themecore/tests/php/phpstan.dist.neon
deleted file mode 100644
index cff2f13..0000000
--- a/is_themecore/is_themecore/tests/php/phpstan.dist.neon
+++ /dev/null
@@ -1,14 +0,0 @@
-parameters:
- paths:
- # We consider that the extension file will be stored the folder test/phpstan
- # From Phpstan 0.12, paths are relative to the .neon file.
- - ../../src
- - ../../is_themecore.php
- ignoreErrors:
- # - "#Insert your error here (don't forget to escape special characters like the following hash: \\#)#"
- reportUnmatchedIgnoredErrors: true
- level: 9
-
-includes:
- - %currentWorkingDirectory%/tests/php/.phpstan_bootstrap.neon
- - %currentWorkingDirectory%/vendor/prestashop/php-dev-tools/phpstan/ps-module-extension.neon
diff --git a/is_themecore/is_themecore/translations/index.php b/is_themecore/is_themecore/translations/index.php
deleted file mode 100644
index 88355f6..0000000
--- a/is_themecore/is_themecore/translations/index.php
+++ /dev/null
@@ -1,11 +0,0 @@
-registerHook('actionDispatcherBefore');
-
- return $module->registerHook('actionOutputHTMLBefore');
-}
diff --git a/is_themecore/is_themecore/upgrade/upgrade-2-2-1.php b/is_themecore/is_themecore/upgrade/upgrade-2-2-1.php
deleted file mode 100644
index 583e2bf..0000000
--- a/is_themecore/is_themecore/upgrade/upgrade-2-2-1.php
+++ /dev/null
@@ -1,10 +0,0 @@
-registerHook('actionDispatcherBefore');
-}
diff --git a/is_themecore/is_themecore/upgrade/upgrade-2-3-0.php b/is_themecore/is_themecore/upgrade/upgrade-2-3-0.php
deleted file mode 100644
index 62d42e7..0000000
--- a/is_themecore/is_themecore/upgrade/upgrade-2-3-0.php
+++ /dev/null
@@ -1,15 +0,0 @@
-registerHook('actionHtaccessCreate');
- $res &= $module->registerHook('objectShopUrlAddAfter');
- $res &= $module->registerHook('objectShopUrlUpdateAfter');
- $res &= $module->registerHook('objectShopUrlDeleteAfter');
-
- return $res;
-}
diff --git a/is_themecore/is_themecore/upgrade/upgrade-2-4-0.php b/is_themecore/is_themecore/upgrade/upgrade-2-4-0.php
deleted file mode 100644
index c00c440..0000000
--- a/is_themecore/is_themecore/upgrade/upgrade-2-4-0.php
+++ /dev/null
@@ -1,20 +0,0 @@
-installPartytown();
- $success &= Configuration::updateValue(GeneralConfiguration::THEMECORE_LOAD_PARTY_TOWN, false);
- $success &= Configuration::updateValue(GeneralConfiguration::THEMECORE_DEBUG_PARTY_TOWN, false);
-
- return $success;
-}
diff --git a/is_themecore/is_themecore/upgrade/upgrade-4.1.2.php b/is_themecore/is_themecore/upgrade/upgrade-4.1.2.php
deleted file mode 100644
index 561db06..0000000
--- a/is_themecore/is_themecore/upgrade/upgrade-4.1.2.php
+++ /dev/null
@@ -1,14 +0,0 @@
-registerHook('actionFrontControllerInitBefore');
-}
diff --git a/is_themecore/is_themecore/upgrade/upgrade-4.1.3.php b/is_themecore/is_themecore/upgrade/upgrade-4.1.3.php
deleted file mode 100644
index bc47f9a..0000000
--- a/is_themecore/is_themecore/upgrade/upgrade-4.1.3.php
+++ /dev/null
@@ -1,20 +0,0 @@
-registerHook('actionFrontControllerInitBefore');
- $success &= Configuration::updateValue(GeneralConfiguration::THEMECORE_LOAD_PARTY_TOWN, false);
- $success &= Configuration::updateValue(GeneralConfiguration::THEMECORE_DEBUG_PARTY_TOWN, false);
-
- return $success;
-}
diff --git a/is_themecore/is_themecore/views/img/example.jpg b/is_themecore/is_themecore/views/img/example.jpg
deleted file mode 100644
index b603a5f..0000000
Binary files a/is_themecore/is_themecore/views/img/example.jpg and /dev/null differ
diff --git a/is_themecore/is_themecore/views/index.php b/is_themecore/is_themecore/views/index.php
deleted file mode 100644
index 88355f6..0000000
--- a/is_themecore/is_themecore/views/index.php
+++ /dev/null
@@ -1,11 +0,0 @@
-
- {{ icon|default('settings') }} {{ header }}
-
diff --git a/is_themecore/is_themecore/views/templates/back/components/atoms/index.php b/is_themecore/is_themecore/views/templates/back/components/atoms/index.php
deleted file mode 100644
index 88355f6..0000000
--- a/is_themecore/is_themecore/views/templates/back/components/atoms/index.php
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
- {% include '@Modules/is_themecore/views/templates/back/components/organisms/form.html.twig' with {
- 'form': general_form,
- 'form_id': 'settings_general_form',
- 'form_action': path('is_themecore_module_settings_general_save'),
- 'card_header': 'General' | trans({}, 'Modules.isthemecore.Admin'),
- 'cancel_path': 'is_themecore_module_settings'
- } %}
-
-
-
- {% include '@Modules/is_themecore/views/templates/back/components/organisms/form.html.twig' with {
- 'form': webp_form,
- 'form_id': 'settings_webp_form',
- 'form_action': path('is_themecore_module_settings_webp_save'),
- 'card_header': 'Webp' | trans({}, 'Modules.isthemecore.Admin'),
- 'icon_header': 'image',
- 'cancel_path': 'is_themecore_module_settings'
- } %}
-
-
-{% endblock %}
diff --git a/is_themecore/is_themecore/views/templates/back/components/molecules/index.php b/is_themecore/is_themecore/views/templates/back/components/molecules/index.php
deleted file mode 100644
index 88355f6..0000000
--- a/is_themecore/is_themecore/views/templates/back/components/molecules/index.php
+++ /dev/null
@@ -1,11 +0,0 @@
-
- {% include '@Modules/is_themecore/views/templates/back/components/atoms/card-header.html.twig'
- with {
- 'header': card_header,
- 'icon': icon_header|default('settings')
- }
- %}
-
-
- {{ form_widget(form) }}
-
-
-
-
- {{ form_end(form) }}
-{% endblock %}
diff --git a/is_themecore/is_themecore/views/templates/back/components/organisms/index.php b/is_themecore/is_themecore/views/templates/back/components/organisms/index.php
deleted file mode 100644
index 88355f6..0000000
--- a/is_themecore/is_themecore/views/templates/back/components/organisms/index.php
+++ /dev/null
@@ -1,11 +0,0 @@
-
- {$jsonElem nofilter}
-
- {/if}
-{/foreach}
-
-{if $loadPartytown && $partytownScript && $partytownScriptUri}
-
-
-
-{/if}
diff --git a/is_themecore/is_themecore/views/templates/hook/og-data.tpl b/is_themecore/is_themecore/views/templates/hook/og-data.tpl
deleted file mode 100644
index d452253..0000000
--- a/is_themecore/is_themecore/views/templates/hook/og-data.tpl
+++ /dev/null
@@ -1,34 +0,0 @@
-
-{if !empty($page.meta.description)}
-
-{/if}
-
-
-
-
-{if isset($product) && $page.page_name == 'product'}
-
- {if $product.images|count > 0}
- {foreach from=$product.images item=p_img name="p_img_list"}
-
- {/foreach}
-
-
-
- {/if}
- {if $product.show_price}
-
-
- {if $product.has_discount}
-
- {/if}
- {/if}
- {if !empty($product_manufacturer) && $product_manufacturer->name}
-
- {/if}
-
-{elseif $page.page_name === 'category' && isset($category) && !empty($category.image.large.url)}
-
-{else}
-
-{/if}
diff --git a/is_themecore/is_themecore/views/templates/hook/twitter-data.tpl b/is_themecore/is_themecore/views/templates/hook/twitter-data.tpl
deleted file mode 100644
index 45858e3..0000000
--- a/is_themecore/is_themecore/views/templates/hook/twitter-data.tpl
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-{if !empty($page.meta.description)}
-
-{/if}
-
-
-
-
-{if isset($product) && $page.page_name == 'product' && !empty($product.default_image)}
-
- {if !empty($page.meta.description)}
-
- {/if}
-{elseif $page.page_name === 'category' && isset($category) && !empty($category.image.large.url)}
-
- {if !empty($page.meta.description)}
-
- {/if}
-{else}
-
- {if !empty($page.meta.description)}
-
- {/if}
-{/if}
diff --git a/is_themecore/is_themecore/views/templates/index.php b/is_themecore/is_themecore/views/templates/index.php
deleted file mode 100644
index 88355f6..0000000
--- a/is_themecore/is_themecore/views/templates/index.php
+++ /dev/null
@@ -1,11 +0,0 @@
-setDestinationFile($_GET['source']);
-$webpGenerator->setQuality((int) Configuration::get(WebpConfiguration::THEMECORE_WEBP_QUALITY));
-$webpGenerator->setConverter(Configuration::get(WebpConfiguration::THEMECORE_WEBP_CONVERTER));
-$webpGenerator->setSharpYuv((bool) Configuration::get(WebpConfiguration::THEMECORE_WEBP_SHARPYUV));
-$webpGenerator->convertAndServe();
-exit;
diff --git a/is_themecore/is_themecore/public/partytown.js b/is_themecore/public/partytown.js
similarity index 100%
rename from is_themecore/is_themecore/public/partytown.js
rename to is_themecore/public/partytown.js
diff --git a/is_themecore/is_themecore/public/~partytown/debug/partytown-atomics.js b/is_themecore/public/~partytown/debug/partytown-atomics.js
similarity index 100%
rename from is_themecore/is_themecore/public/~partytown/debug/partytown-atomics.js
rename to is_themecore/public/~partytown/debug/partytown-atomics.js
diff --git a/is_themecore/is_themecore/public/~partytown/debug/partytown-media.js b/is_themecore/public/~partytown/debug/partytown-media.js
similarity index 100%
rename from is_themecore/is_themecore/public/~partytown/debug/partytown-media.js
rename to is_themecore/public/~partytown/debug/partytown-media.js
diff --git a/is_themecore/is_themecore/public/~partytown/debug/partytown-sandbox-sw.js b/is_themecore/public/~partytown/debug/partytown-sandbox-sw.js
similarity index 100%
rename from is_themecore/is_themecore/public/~partytown/debug/partytown-sandbox-sw.js
rename to is_themecore/public/~partytown/debug/partytown-sandbox-sw.js
diff --git a/is_themecore/is_themecore/public/~partytown/debug/partytown-sw.js b/is_themecore/public/~partytown/debug/partytown-sw.js
similarity index 100%
rename from is_themecore/is_themecore/public/~partytown/debug/partytown-sw.js
rename to is_themecore/public/~partytown/debug/partytown-sw.js
diff --git a/is_themecore/is_themecore/public/~partytown/debug/partytown-ww-atomics.js b/is_themecore/public/~partytown/debug/partytown-ww-atomics.js
similarity index 100%
rename from is_themecore/is_themecore/public/~partytown/debug/partytown-ww-atomics.js
rename to is_themecore/public/~partytown/debug/partytown-ww-atomics.js
diff --git a/is_themecore/is_themecore/public/~partytown/debug/partytown-ww-sw.js b/is_themecore/public/~partytown/debug/partytown-ww-sw.js
similarity index 100%
rename from is_themecore/is_themecore/public/~partytown/debug/partytown-ww-sw.js
rename to is_themecore/public/~partytown/debug/partytown-ww-sw.js
diff --git a/is_themecore/is_themecore/public/~partytown/debug/partytown.js b/is_themecore/public/~partytown/debug/partytown.js
similarity index 100%
rename from is_themecore/is_themecore/public/~partytown/debug/partytown.js
rename to is_themecore/public/~partytown/debug/partytown.js
diff --git a/is_themecore/is_themecore/public/~partytown/partytown-atomics.js b/is_themecore/public/~partytown/partytown-atomics.js
similarity index 100%
rename from is_themecore/is_themecore/public/~partytown/partytown-atomics.js
rename to is_themecore/public/~partytown/partytown-atomics.js
diff --git a/is_themecore/is_themecore/public/~partytown/partytown-media.js b/is_themecore/public/~partytown/partytown-media.js
similarity index 100%
rename from is_themecore/is_themecore/public/~partytown/partytown-media.js
rename to is_themecore/public/~partytown/partytown-media.js
diff --git a/is_themecore/is_themecore/public/~partytown/partytown-sw.js b/is_themecore/public/~partytown/partytown-sw.js
similarity index 100%
rename from is_themecore/is_themecore/public/~partytown/partytown-sw.js
rename to is_themecore/public/~partytown/partytown-sw.js
diff --git a/is_themecore/is_themecore/public/~partytown/partytown.js b/is_themecore/public/~partytown/partytown.js
similarity index 100%
rename from is_themecore/is_themecore/public/~partytown/partytown.js
rename to is_themecore/public/~partytown/partytown.js
diff --git a/is_themecore/src/Controller/Admin/SettingsController.php b/is_themecore/src/Controller/Admin/SettingsController.php
index c6f7ca4..938152e 100644
--- a/is_themecore/src/Controller/Admin/SettingsController.php
+++ b/is_themecore/src/Controller/Admin/SettingsController.php
@@ -22,11 +22,6 @@ use Symfony\Component\HttpFoundation\Response;
class SettingsController extends FrameworkBundleAdminController
{
/**
- * @AdminSecurity(
- * "is_granted(['read'], request.get('_legacy_controller'))",
- * message="You do not have permission to access this."
- * )
- *
* @param Request $request
*
* @return Response
@@ -47,14 +42,6 @@ class SettingsController extends FrameworkBundleAdminController
}
/**
- * @AdminSecurity(
- * "is_granted('update', request.get('_legacy_controller')) && is_granted('create', request.get('_legacy_controller')) && is_granted('delete', request.get('_legacy_controller'))",
- * message="You do not have permission to update this.",
- * redirectRoute="is_themecore_module_settings"
- * )
- *
- * @DemoRestricted(redirectRoute="is_themecore_module_settings")
- *
* @param Request $request
*
* @return RedirectResponse
@@ -71,14 +58,6 @@ class SettingsController extends FrameworkBundleAdminController
}
/**
- * @AdminSecurity(
- * "is_granted('update', request.get('_legacy_controller')) && is_granted('create', request.get('_legacy_controller')) && is_granted('delete', request.get('_legacy_controller'))",
- * message="You do not have permission to update this.",
- * redirectRoute="is_themecore_module_settings"
- * )
- *
- * @DemoRestricted(redirectRoute="is_themecore_module_settings")
- *
* @param Request $request
*
* @return RedirectResponse
@@ -95,8 +74,6 @@ class SettingsController extends FrameworkBundleAdminController
}
/**
- * @DemoRestricted(redirectRoute="is_themecore_module_settings")
- *
* @param Request $request
*
* @return RedirectResponse
@@ -110,22 +87,22 @@ class SettingsController extends FrameworkBundleAdminController
switch ($request->get('type')) {
case 'all':
- $eraser->setQuery(_PS_ROOT_DIR_);
+ $eraser->setQuery(\_PS_ROOT_DIR_);
break;
case 'product':
- $eraser->setQuery(_PS_PROD_IMG_DIR_);
+ $eraser->setQuery(\_PS_IMG_DIR_ . 'p/');
break;
case 'module':
- $eraser->setQuery(_PS_MODULE_DIR_);
+ $eraser->setQuery(\_PS_MODULE_DIR_);
break;
case 'cms':
- $eraser->setQuery(_PS_IMG_DIR_ . 'cms/');
+ $eraser->setQuery(\_PS_IMG_DIR_ . 'cms/');
break;
case 'themes':
- $eraser->setQuery(_PS_ROOT_DIR_ . '/themes/');
+ $eraser->setQuery(\_PS_ROOT_DIR_ . '/themes/');
break;
default:
- $eraser->setQuery(_PS_ROOT_DIR_);
+ $eraser->setQuery(\_PS_ROOT_DIR_);
break;
}
diff --git a/is_themecore/src/Core/Smarty/SmartyHelperFunctions.php b/is_themecore/src/Core/Smarty/SmartyHelperFunctions.php
index a28ea5f..8b1ab23 100644
--- a/is_themecore/src/Core/Smarty/SmartyHelperFunctions.php
+++ b/is_themecore/src/Core/Smarty/SmartyHelperFunctions.php
@@ -190,9 +190,114 @@ class SmartyHelperFunctions
return $content;
}
- public static function isBright($hexColor)
+
+
+
+/* CUSTOM ADDITIONS BELOW */
+
+
+ public static function isBright($hexColor)
{
$calculator = new ColorBrightnessCalculator();
return $calculator->isBright($hexColor);
}
-}
+
+ public static function displaySvgIcon($params){
+ /*
+ Helper to display SVG icons stored in themes/falcon/_dev/img/icons/
+ registered under public_html/modules/is_themecore/src/Hook/Smarty.php
+
+ Usage examples in a TPL file:
+
+ {svg_icon file='person.svg' fill='red' width='24' height='24'}
+ {svg_icon file='person.svg'}
+ */
+
+ // Grab svg under falcon/_dev/img and display an error if not found
+ if (empty($params['file'])) {
+ return '';
+ }
+ $icon_path = _PS_THEME_DIR_ . '/_dev/img/' . basename($params['file']);
+
+ if (!is_file($icon_path)) {
+ if (defined('_PS_MODE_DEV_') && _PS_MODE_DEV_) {
+ return 'Invalid SVG path: ' . htmlspecialchars($icon_path);
+ }
+ return '';
+ }
+
+ $svg_content = file_get_contents($icon_path);
+
+ /* Define an associative array of SVG properties
+ If the property is a style, addd it in a style tag.
+ If the property is an attribute, replace it in the svg code.
+
+ This reduces the risk of interfering with other attributes in the svg's code that can mess up the whole image. */
+ $svg_props = array(
+ 'width' => 'style',
+ 'height' => 'style',
+ 'opacity' => 'style',
+ 'fill' => 'attribute',
+ 'stroke' => 'attribute',
+ );
+
+ // Styles
+ $styles = [];
+ foreach ($svg_props as $prop => $type) {
+ if ($type === 'style' && !empty($params[$prop])) {
+ $value = $params[$prop];
+ if (in_array($prop, ['width', 'height']) && is_numeric($value)) {
+ $value .= 'px';
+ }
+ $styles[] = $prop . ': ' . $value;
+ }
+ }
+ if (!empty($styles)) {
+ $style_attr = 'style="' . implode('; ', $styles) . '"';
+ $svg_content = preg_replace('/(