Skip to content

Commit 307becf

Browse files
committed
Deprecated Minify settings removed
1 parent ba15f69 commit 307becf

File tree

5 files changed

+8
-65
lines changed

5 files changed

+8
-65
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 1.2.2
2+
3+
- Deprecated Minify settings removed
4+
15
## 1.2.1
26

37
- Fix service scopes on Prestashop 8

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
Cloudflare API features in Prestashop:
1010

1111
- Clear Cloudflare Cache in the Prestashop admin
12-
- Update settings: Auto Minify (CSS, JS, HTML)
1312

1413
![Flush Cloudflare Cache](screenshot.png)
1514

@@ -41,7 +40,6 @@ From the module manager, find the module and click on configure.
4140
| API Token * | A valid token from your Cloudflare Account with permission on "Cache Purge" for "Zone" | Y |
4241
| Global API Key | The Cloudflare Global API key | Y |
4342
| Account Email | Email address associated with your Cloudflare account | Y |
44-
| Automatically minify | Reduce the file size of source code on your website | N |
4543

4644
\* For an API Token authentication (more secure), create a new custom API token with permissions on:
4745

pixel_cloudflare.php

Lines changed: 2 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/**
3-
* Copyright (C) 2023 Pixel Développement
3+
* Copyright (C) 2025 Pixel Développement
44
*
55
* For the full copyright and license information, please view the LICENSE
66
* file that was distributed with this source code.
@@ -10,9 +10,7 @@
1010
}
1111

1212
use Pixel\Module\Cloudflare\Model\Api;
13-
use PrestaShop\PrestaShop\Core\Addon\Theme\ThemeProviderInterface;
1413
use PrestaShop\PrestaShop\Core\Exception\ContainerNotFoundException;
15-
use PrestaShop\PrestaShop\Core\Module\WidgetInterface;
1614

1715
class Pixel_cloudflare extends Module
1816
{
@@ -22,7 +20,7 @@ class Pixel_cloudflare extends Module
2220
public function __construct()
2321
{
2422
$this->name = 'pixel_cloudflare';
25-
$this->version = '1.2.1';
23+
$this->version = '1.2.2';
2624
$this->author = 'Pixel Open';
2725
$this->tab = 'administration';
2826
$this->need_instance = 0;
@@ -210,38 +208,6 @@ protected function getConfigFields(): array
210208
'size' => 20,
211209
'required' => false,
212210
],
213-
'API_AUTOMATICALLY_MINIFY' => [
214-
'type' => 'select',
215-
'multiple' => true,
216-
'label' => $this->trans('Automatically minify', [], 'Modules.Pixelcloudflare.Admin'),
217-
'name' => 'API_AUTOMATICALLY_MINIFY[]',
218-
'required' => false,
219-
'options' => [
220-
'query' => [
221-
[
222-
'value' => 'js',
223-
'name' => $this->trans('JavaScript', [], 'Modules.Pixelcloudflare.Admin'),
224-
],
225-
[
226-
'value' => 'css',
227-
'name' => $this->trans('CSS', [], 'Modules.Pixelcloudflare.Admin'),
228-
],
229-
[
230-
'value' => 'html',
231-
'name' => $this->trans('HTML', [], 'Modules.Pixelcloudflare.Admin'),
232-
],
233-
],
234-
'id' => 'value',
235-
'name' => 'name',
236-
],
237-
'desc' => Configuration::get('CLOUDFLARE_API_AUTHENTICATION_MODE') === 'api_token' ?
238-
$this->trans(
239-
'A valid token with permission on "Zone Settings" for "Zone" is required (Read and Edit).',
240-
[],
241-
'Modules.Pixelcloudflare.Admin'
242-
) : ''
243-
,
244-
]
245211
];
246212
}
247213

@@ -262,14 +228,6 @@ public function getContent(): string
262228
foreach ($this->getConfigFields() as $code => $field) {
263229
$value = Tools::getValue($code);
264230

265-
// Cloudflare API settings
266-
if ($code === 'API_AUTOMATICALLY_MINIFY') {
267-
if (is_array($value)) {
268-
$api->patchMinifySetting($value);
269-
}
270-
continue;
271-
}
272-
273231
// Prestashop settings
274232
if ($field['required'] && empty($value)) {
275233
return $this->displayError(
@@ -330,17 +288,6 @@ public function displayForm(): string
330288
$value = explode(',', (string)$value);
331289
}
332290

333-
// Cloudflare API settings
334-
if ($code === 'API_AUTOMATICALLY_MINIFY') {
335-
$value = [];
336-
$result = $api->GetMinifySetting();
337-
foreach (($result['result']['value'] ?? []) as $type => $state) {
338-
if (strtolower($state) === 'on') {
339-
$value[] = $type;
340-
}
341-
}
342-
}
343-
344291
$helper->fields_value[$field['name']] = $value;
345292
}
346293

src/Model/Api.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ public function GetMinifySetting(): array
6161

6262
/**
6363
* Patch Minify Setting
64+
* @deprecated Cloudflare had deprecated the Auto Minify feature on August 5th, 2024
6465
*
6566
* @param array $values
6667
* @return array

views/templates/admin/config/js.twig

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
apiKey: document.getElementById("CLOUDFLARE_API_KEY"),
55
accountEmail: document.getElementById("CLOUDFLARE_ACCOUNT_EMAIL"),
66
authMode: document.getElementById("CLOUDFLARE_API_AUTHENTICATION_MODE"),
7-
apiAutomaticallyMinify: document.getElementById("API_AUTOMATICALLY_MINIFY[]"),
87
98
init: function () {
109
this.disable();
@@ -20,21 +19,15 @@
2019
2120
if (value === 'api_token') {
2221
this.show(this.apiToken);
23-
if (this.apiToken.value) {
24-
this.show(this.apiAutomaticallyMinify);
25-
}
2622
}
2723
if (value === 'api_key') {
2824
this.show(this.apiKey);
2925
this.show(this.accountEmail);
30-
if (this.apiKey.value && this.accountEmail.value) {
31-
this.show(this.apiAutomaticallyMinify);
32-
}
3326
}
3427
},
3528
3629
disable: function () {
37-
let inputs = [this.apiToken, this.apiKey, this.accountEmail, this.apiAutomaticallyMinify];
30+
let inputs = [this.apiToken, this.apiKey, this.accountEmail];
3831
for (let i = 0; i < inputs.length; i++) {
3932
this.hide(inputs[i]);
4033
}

0 commit comments

Comments
 (0)