Skip to content

Commit

Permalink
Version 4.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
luigifab committed Jul 7, 2022
1 parent 80762e1 commit 0899359
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 23 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ For more information, go to https://www.luigifab.fr/openmage/minifier (IPv6 is r

This repository is a releases mirror. To install the module, please use the composer key available in the documentation.

- Current version: 4.3.0 (03/03/2022)
- Current version: 4.3.1 (07/07/2022)
- Compatibility: OpenMage 19.x / 20.x / 21.x, PHP 7.2 / 7.3 / 7.4 / 8.0 / 8.1
- Client compatibility: Firefox 36+, Chrome 32+, Opera 19+, Edge 16+, Safari 9+
- Translations: English (en), French (fr-FR/fr-CA), German (de), Italian (it), Portuguese (pt-PT/pt-BR), Spanish (es) / Chinese (zh), Czech (cs), Dutch (nl), Greek (el), Hungarian (hu), Japanese (ja), Polish (pl), Romanian (ro), Russian (ru), Slovak (sk), Turkish (tr), Ukrainian (uk)
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"require": {
"php": ">=7.2.0",
"openmage/magento-lts": ">=19.4.0",
"symfony/polyfill-php80": "*",
"ext-mbstring": "*",
"ext-json": "*",
"ext-curl": "*",
Expand Down
14 changes: 7 additions & 7 deletions src/app/code/community/Luigifab/Minifier/Model/Files.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* Created W/13/04/2016
* Updated V/13/05/2022
* Updated D/26/06/2022
*
* Copyright 2011-2022 | Fabrice Creuzot (luigifab) <code~luigifab~fr>
* Copyright 2022 | Fabrice Creuzot <fabrice~cellublue~com>
Expand Down Expand Up @@ -144,10 +144,10 @@ protected function minifyFiles(array $items) {

while (count($pids) >= $core) {
foreach ($pids as $key => $pid) {
if (!file_exists('/proc/'.$pid))
unset($pids[$key]);
else
if (file_exists('/proc/'.$pid))
clearstatcache('/proc/'.$pid);
else
unset($pids[$key]);
}
usleep(100000); // 0.1 s
}
Expand All @@ -156,10 +156,10 @@ protected function minifyFiles(array $items) {

while (!empty($pids)) {
foreach ($pids as $key => $pid) {
if (!file_exists('/proc/'.$pid))
unset($pids[$key]);
else
if (file_exists('/proc/'.$pid))
clearstatcache('/proc/'.$pid);
else
unset($pids[$key]);
}
usleep(100000); // 0.1 s
}
Expand Down
6 changes: 3 additions & 3 deletions src/app/code/community/Luigifab/Minifier/Model/Observer.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* Created S/20/06/2015
* Updated S/19/02/2022
* Updated V/24/06/2022
*
* Copyright 2011-2022 | Fabrice Creuzot (luigifab) <code~luigifab~fr>
* https://www.luigifab.fr/openmage/minifier
Expand Down Expand Up @@ -86,7 +86,7 @@ static function ($items, $item) {
// ajoute la locale présente dans l'url en premier car elle est prioritaire
if (!empty($_GET['lang'])) {
$code = str_replace('-', '_', $_GET['lang']);
if (strpos($code, '_') !== false)
if (str_contains($code, '_'))
array_unshift($codes, substr($code, 0, strpos($code, '_')));
array_unshift($codes, $code);
}
Expand All @@ -95,7 +95,7 @@ static function ($items, $item) {
// essaye es ou fil puis es_ES ou fil_PH
foreach ($codes as $code) {

if ((strlen($code) >= 2) && (strpos($code, '_') === false)) {
if ((strlen($code) >= 2) && !str_contains($code, '_')) {
// es devient es_ES de manière à prioriser es_ES au lieu d'utiliser es_XX
if (in_array($code.'_'.strtoupper($code), $locales)) {
$result = $code.'_'.strtoupper($code);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* Created J/12/11/2020
* Updated V/20/05/2022
* Updated V/24/06/2022
*
* Copyright 2011-2022 | Fabrice Creuzot (luigifab) <code~luigifab~fr>
* Copyright 2022 | Fabrice Creuzot <fabrice~cellublue~com>
Expand Down Expand Up @@ -52,7 +52,7 @@ public function getFinalUrl($fileName, $url) {
return str_replace('-zzyyxx', '', $url);

$key = (is_file($fileName) ? date('-YmdHis', filemtime($fileName)) : '-00000000000000');
return str_replace([basename($url), '-zzyyxx'], [preg_replace('#\.#', $key . '.', basename($url), 1), ''], $url);
return str_replace([basename($url), '-zzyyxx'], [preg_replace('#\.#', $key.'.', basename($url), 1), ''], $url);
}

public function getSkinUrl($file = null, array $params = []) {
Expand All @@ -65,7 +65,7 @@ public function getSkinUrl($file = null, array $params = []) {

// prevent reading files outside of the proper directory while still allowing symlinked files
Varien_Profiler::start(__METHOD__);
if (strpos($file, '..') !== false) {
if (str_contains($file, '..')) {
Mage::log(sprintf('Invalid path requested: %s (params: %s)', $file, json_encode($params)), Zend_Log::ERR);
throw new RuntimeException('Invalid path requested.');
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* Created D/15/11/2020
* Updated J/23/12/2021
* Updated D/26/06/2022
*
* Copyright 2011-2022 | Fabrice Creuzot (luigifab) <code~luigifab~fr>
* https://www.luigifab.fr/openmage/minifier
Expand Down Expand Up @@ -134,7 +134,7 @@ public function startAction() {

$passwd = Mage::getStoreConfig('minifier/cssjs/debug_password');
if (Mage::getStoreConfigFlag('minifier/cssjs/debug_enabled') && (empty($passwd) || ($this->getRequest()->getParam('pass') == $passwd))) {
Mage::getSingleton('core/cookie')->set('minifier', 1);
Mage::getSingleton('core/cookie')->set('minifier', 1, true);
$this->_redirect('*/*/index', ['pass' => $passwd]);
}
else {
Expand Down
4 changes: 2 additions & 2 deletions src/app/code/community/Luigifab/Minifier/etc/config.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
* Created L/27/06/2011
* Updated S/19/02/2022
* Updated V/01/07/2022
*
* Copyright 2011-2022 | Fabrice Creuzot (luigifab) <code~luigifab~fr>
* https://www.luigifab.fr/openmage/minifier
Expand All @@ -20,7 +20,7 @@
<config>
<modules>
<Luigifab_Minifier>
<version>4.3.0</version>
<version>4.3.1</version>
</Luigifab_Minifier>
</modules>
<global>
Expand Down
10 changes: 5 additions & 5 deletions src/app/code/community/Luigifab/Minifier/lib/minify.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* Created S/14/07/2018
* Updated S/19/02/2022
* Updated V/01/07/2022
*
* Copyright 2011-2022 | Fabrice Creuzot (luigifab) <code~luigifab~fr>
* https://www.luigifab.fr/openmage/minifier
Expand Down Expand Up @@ -49,7 +49,7 @@
// https://github.com/jakubpawlowicz/clean-css-cli
$program = Mage::getStoreConfig('minifier/cssjs/cleancss');
if ((!empty($program) && is_executable($program)) || is_executable($program = '/usr/bin/cleancss')) {
system(sprintf(
exec(sprintf(
'%s --with-rebase --source-map --source-map-inline-sources -O1 "specialComments:off" --output %s %s',
$program,
escapeshellarg($dest),
Expand All @@ -64,7 +64,7 @@
// https://github.com/mishoo/uglifyjs
$program = Mage::getStoreConfig('minifier/cssjs/uglifyjs');
if ((!empty($program) && is_executable($program)) || is_executable($program = '/usr/bin/uglifyjs')) {
system(sprintf(
exec(sprintf(
'%s --source-map "content=inline,includeSources,base=\'.\',url=\'%s\'" --output %s %s',
$program,
basename($dest).'.map',
Expand All @@ -80,7 +80,7 @@
// https://github.com/jakubpawlowicz/clean-css-cli
$program = Mage::getStoreConfig('minifier/cssjs/cleancss');
if ((!empty($program) && is_executable($program)) || is_executable($program = '/usr/bin/cleancss')) {
system(sprintf(
exec(sprintf(
'%s --with-rebase --source-map --source-map-inline-sources -O1 specialComments:off --output %s %s',
$program,
escapeshellarg($dest),
Expand All @@ -95,7 +95,7 @@
// https://github.com/mishoo/uglifyjs
$program = Mage::getStoreConfig('minifier/cssjs/uglifyjs');
if ((!empty($program) && is_executable($program)) || is_executable($program = '/usr/bin/uglifyjs')) {
system(sprintf(
exec(sprintf(
'%s --source-map "content=inline,includeSources,base=\'.\',url=\'%s\'" %s --output %s %s',
$program,
'inline', //basename($dest).'.map',
Expand Down

0 comments on commit 0899359

Please sign in to comment.