|
|
|
@ -4,6 +4,11 @@ if (!defined('_ECRIRE_INC_VERSION')) {
|
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function optimages_command_exists($command_name) { |
|
|
|
|
$test_method = (false === stripos(PHP_OS, 'win')) ? 'command -v' : 'where'; |
|
|
|
|
return (null === shell_exec("$test_method $command_name")) ? false : true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function formulaires_configurer_optimages_saisies_dist(){ |
|
|
|
|
$saisies = array( |
|
|
|
|
array( |
|
|
|
@ -128,7 +133,7 @@ function formulaires_configurer_optimages_saisies_dist(){
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
// Affichage conditionné à la présence de jpegoptim |
|
|
|
|
if (`which jpegoptim`) { |
|
|
|
|
if (optimages_command_exists('jpegoptim')) { |
|
|
|
|
$saisies[1]['saisies'][0]['options']['attention'] = '<:optimages:configurer_jpegoptim_attention:>'; |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
@ -137,7 +142,7 @@ function formulaires_configurer_optimages_saisies_dist(){
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Affichage conditionné à la présence de pngquant |
|
|
|
|
if (`which pngquant`) { |
|
|
|
|
if (optimages_command_exists('pngquant')) { |
|
|
|
|
$saisies[1]['saisies'][1]['saisies'][0]['options']['attention'] = '<:optimages:configurer_pngquant_attention:>'; |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
@ -146,7 +151,7 @@ function formulaires_configurer_optimages_saisies_dist(){
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Affichage conditionné à la présence de optipng |
|
|
|
|
if (`which optipng`) { |
|
|
|
|
if (optimages_command_exists('optipng')) { |
|
|
|
|
$saisies[1]['saisies'][1]['saisies'][2]['options']['attention'] = '<:optimages:configurer_optipng_attention:>'; |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
@ -155,7 +160,7 @@ function formulaires_configurer_optimages_saisies_dist(){
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Affichage conditionné à la présence de gifsicle |
|
|
|
|
if (`which gifsicle`) { |
|
|
|
|
if (optimages_command_exists('gifsicle')) { |
|
|
|
|
$saisies[1]['saisies'][2]['options']['attention'] = '<:optimages:configurer_gifsicle_attention:>'; |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|