Skip to content

Commit 8f989eb

Browse files
committed
Version 6.9.8
1 parent 38fda97 commit 8f989eb

File tree

35 files changed

+80
-79
lines changed

35 files changed

+80
-79
lines changed

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ JavaScript pop-ups and slideshow for [OpenMage](https://github.com/OpenMage/mage
66

77
For more information, go to https://www.luigifab.fr/apijs and https://www.luigifab.fr/openmage/apijs (IPv6 is required).
88

9-
- Current version: 6.9.7 (04/04/2025)
9+
- Current version: 6.9.8 (08/08/2025)
1010
- Compatibility: OpenMage 19.x / 20.x / 21.x, PHP 7.2 / 7.3 / 7.4 / 8.0 / 8.1 / 8.2 / 8.3 / 8.4, Python 3.3+
1111
- Client compatibility: Firefox 36+, Chrome 32+, Opera 19+, Edge 16+, Safari 9+
1212
- License: GNU GPL 2.0+

‎src/app/code/community/Luigifab/Apijs/Block/Adminhtml/Rewrite/Categoryimg.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
33
* Created L/30/03/2020
4-
* Updated J/19/10/2023
4+
* Updated D/27/07/2025
55
*
66
* Copyright 2008-2025 | Fabrice Creuzot (luigifab) <code~luigifab~fr>
77
* Copyright 2019-2023 | Fabrice Creuzot <fabrice~cellublue~com>
@@ -38,7 +38,7 @@ public function getElementHtml() {
3838
if ($this->getValue()) {
3939
$link = $this->_getUrl();
4040
$link = str_replace('category//', 'category/', (mb_stripos($link, 'http') === 0) ? $link : Mage::getBaseUrl('media').$link);
41-
$html .= sprintf(' <a href="%s" onclick="apijs.dialog.dialogPhoto(this.href, \'false\', \'false\', \'%s\'); return false;" id="%s_image">%s (%s)</a> ', $link, addslashes($this->getValue()), $this->getHtmlId(), Mage::helper('apijs')->__('Preview'), $this->getValue()); // pas de $this->helper ici
41+
$html .= sprintf(' <a href="%s" onclick="apijs.dialog.dialogPhoto(this.href, \'false\', \'false\', \'%s\'); return false;" id="%s_image">%s (%s)</a> ', $link, addslashes($this->getValue()), $this->getHtmlId(), Mage::helper('apijs')->__('Preview'), $this->getValue()); // no $this->helper here
4242
}
4343

4444
return sprintf('%s <em>(%s)</em> %s</div>', $html, implode(', ', $this->getAllowedExtensions()), $this->_getDeleteCheckbox());

‎src/app/code/community/Luigifab/Apijs/Block/Adminhtml/Rewrite/Configimg.php‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
33
* Created L/26/10/2015
4-
* Updated J/19/10/2023
4+
* Updated D/27/07/2025
55
*
66
* Copyright 2008-2025 | Fabrice Creuzot (luigifab) <code~luigifab~fr>
77
* Copyright 2019-2023 | Fabrice Creuzot <fabrice~cellublue~com>
@@ -26,11 +26,14 @@ protected function _construct() {
2626

2727
public function getAllowedExtensions() {
2828

29-
$exts = Mage::getSingleton('cms/wysiwyg_images_storage')->getAllowedExtensions('image');
30-
29+
$exts = Mage::getSingleton('cms/wysiwyg_images_storage')->getAllowedExtensions('image');
3130
$model = (string) $this->getFieldConfig()->descend('backend_model');
32-
if (!empty($model))
33-
return array_intersect($exts, Mage::getModel($model)->getAllowedExtensions());
31+
32+
if (!empty($model)) {
33+
$check = Mage::getModel($model)->getAllowedExtensions();
34+
if (!empty($check))
35+
return array_intersect($exts, $check);
36+
}
3437

3538
return $exts;
3639
}
@@ -45,7 +48,7 @@ public function getElementHtml() {
4548
if ($this->getValue()) {
4649
$link = $this->_getUrl();
4750
$link = str_replace('wysiwyg//', 'wysiwyg/', (mb_stripos($link, 'http') === 0) ? $link : Mage::getBaseUrl('media').$link);
48-
$html .= sprintf(' <a href="%s" onclick="apijs.dialog.dialogPhoto(this.href, \'false\', \'false\', \'%s\'); return false;" id="%s_image">%s (%s)</a> ', $link, addslashes($this->getValue()), $this->getHtmlId(), Mage::helper('apijs')->__('Preview'), $this->getValue()); // pas de $this->helper ici
51+
$html .= sprintf(' <a href="%s" onclick="apijs.dialog.dialogPhoto(this.href, \'false\', \'false\', \'%s\'); return false;" id="%s_image">%s (%s)</a> ', $link, addslashes($this->getValue()), $this->getHtmlId(), Mage::helper('apijs')->__('Preview'), $this->getValue()); // no $this->helper here
4952
}
5053

5154
return sprintf('%s <em>(%s)</em> %s</div>', $html, implode(', ', $this->getAllowedExtensions()), $this->_getDeleteCheckbox());

‎src/app/code/community/Luigifab/Apijs/Block/Adminhtml/Rewrite/Gallery.php‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
33
* Created S/04/10/2014
4-
* Updated S/02/12/2023
4+
* Updated L/28/07/2025
55
*
66
* Copyright 2008-2025 | Fabrice Creuzot (luigifab) <code~luigifab~fr>
77
* https://github.com/luigifab/openmage-apijs
@@ -91,8 +91,7 @@ public function getImages(bool $sortByStore) {
9191
$ids[] = $attribute->getId();
9292
$globalValues[$code] = $product->getResource()->getAttributeRawValue($productId, $code, 0);
9393

94-
// bug de merde, quand la valeur par défaut est non présente, la lecture de la valeur par vue ne marche pas
95-
// fixed by PR 2964
94+
// PR 2964 (fixed getAttributeRawValue when there are no value in the "default" store)
9695
if ($globalValues[$code] === false) {
9796
try {
9897
$writer->fetchAll('INSERT INTO '.$table.' (entity_type_id, attribute_id, store_id, entity_id, value) VALUES

��src/app/code/community/Luigifab/Apijs/Block/Adminhtml/Rewrite/Productimg.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
33
* Created J/27/05/2021
4-
* Updated J/19/10/2023
4+
* Updated D/27/07/2025
55
*
66
* Copyright 2008-2025 | Fabrice Creuzot (luigifab) <code~luigifab~fr>
77
* Copyright 2019-2023 | Fabrice Creuzot <fabrice~cellublue~com>
@@ -38,7 +38,7 @@ public function getElementHtml() {
3838
if ($this->getValue()) {
3939
$link = $this->_getUrl();
4040
$link = str_replace('product//', 'product/', (mb_stripos($link, 'http') === 0) ? $link : Mage::getBaseUrl('media').$link);
41-
$html .= sprintf(' <a href="%s" onclick="apijs.dialog.dialogPhoto(this.href, \'false\', \'false\', \'%s\'); return false;" id="%s_image">%s (%s)</a> ', $link, addslashes($this->getValue()), $this->getHtmlId(), Mage::helper('apijs')->__('Preview'), $this->getValue()); // pas de $this->helper ici
41+
$html .= sprintf(' <a href="%s" onclick="apijs.dialog.dialogPhoto(this.href, \'false\', \'false\', \'%s\'); return false;" id="%s_image">%s (%s)</a> ', $link, addslashes($this->getValue()), $this->getHtmlId(), Mage::helper('apijs')->__('Preview'), $this->getValue()); // no $this->helper here
4242
}
4343

4444
return sprintf('%s <em>(%s)</em> %s</div>', $html, implode(', ', $this->getAllowedExtensions()), $this->_getDeleteCheckbox());

‎src/app/code/community/Luigifab/Apijs/Model/Observer.php‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
33
* Created S/13/06/2015
4-
* Updated S/28/10/2023
4+
* Updated D/27/07/2025
55
*
66
* Copyright 2008-2025 | Fabrice Creuzot (luigifab) <code~luigifab~fr>
77
* https://github.com/luigifab/openmage-apijs
@@ -98,12 +98,12 @@ public function updatePostForGallery(Varien_Event_Observer $observer) {
9898
$fields = $product->getResource()->getAttribute('media_gallery')->getBackend()->getAllColumns();
9999
$gallery = [];
100100

101-
// fait ce que fait le js du core, quel bordel
101+
// does what core js does, what a mess
102102
foreach ($post['apijs'] as $imageId => $image) {
103103

104104
if (!is_array($image) || !array_key_exists('file', $image)) {
105105
// imageId = image, small_image, thumbnail, image = /a/b/c.xyz
106-
// fait en sorte de ne pas copier la valeur par défaut
106+
// ensures that the default value is not copied
107107
$default = $product->getResource()->getAttributeRawValue($product->getId(), $imageId, 0);
108108
$gallery['values'][$imageId] = (!empty($storeId) && ($default == $image)) ? false : $image;
109109
}
@@ -118,7 +118,7 @@ public function updatePostForGallery(Varien_Event_Observer $observer) {
118118
if (mb_stripos($field['Type'], 'int(') !== false) {
119119
$value = ($value == 'on') ? 1 : $value;
120120
if (empty($value)) {
121-
// si dans eav_attribute, attribute_model = xyz/source_xyz
121+
// when in eav_attribute, attribute_model = xyz/source_xyz
122122
// $attribute = Xyz_Xyz_Model_Source_Xyz extends Mage_Catalog_Model_Resource_Eav_Attribute
123123
$attribute = array_key_exists($field['Field'], $attributes) ? $attributes[$field['Field']] : false;
124124
if (is_object($attribute) && ($attribute->getIsCheckbox() === true))
@@ -148,15 +148,15 @@ public function updatePostForGallery(Varien_Event_Observer $observer) {
148148
}
149149
}
150150

151-
ksort($values); // pour debug uniquement
151+
ksort($values); // for debug only
152152
$gallery['images'][] = $values;
153153
// DELETE FROM catalog_product_entity_varchar WHERE value IS NULL
154154
}
155155
}
156156

157157
if (!empty($gallery)) {
158158

159-
$post['media_gallery_apijs'] = $gallery; // pour Luigifab_Apijs_Apijs_MediaController
159+
$post['media_gallery_apijs'] = $gallery; // for Luigifab_Apijs_Apijs_MediaController
160160

161161
if (array_key_exists('images', $gallery))
162162
$gallery['images'] = json_encode($gallery['images']);

‎src/app/code/community/Luigifab/Apijs/Model/Python.php‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
33
* Created S/09/05/2020
4-
* Updated S/30/12/2023
4+
* Updated D/27/07/2025
55
*
66
* Copyright 2008-2025 | Fabrice Creuzot (luigifab) <code~luigifab~fr>
77
* https://github.com/luigifab/openmage-apijs
@@ -162,13 +162,13 @@ public function save($destination = null, $dummy = null, $immediate = false) {
162162
empty($this->_resizeFixed) ?
163163
(empty($this->_resizeHeight) ? 0 : $this->_resizeHeight) :
164164
(empty($this->_resizeHeight) ? (empty($this->_resizeWidth) ? 0 : $this->_resizeWidth) : $this->_resizeHeight),
165-
// uniquement pour JPEG (ignoré et toujours à 9 pour PNG, inutile pour GIF)
165+
// only for JPEG (ignored and always at 9 for PNG, useless for GIF)
166166
$this->_quality,
167167
empty($this->_resizeFixed) ? '' : 'fixed',
168168
$dir.'/apijs.log'
169169
);
170170

171-
// ne génère pas deux fois la même image
171+
// does not generate the same image twice
172172
if (!in_array($destination, $this->_files)) {
173173

174174
//Mage::log(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS), Zend_Log::DEBUG, 'apijs.log');

‎src/app/code/community/Luigifab/Apijs/Model/Rewrite/Media.php‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
33
* Created J/29/08/2019
4-
* Updated J/21/04/2022
4+
* Updated L/30/06/2025
55
*
66
* Copyright 2008-2025 | Fabrice Creuzot (luigifab) <code~luigifab~fr>
77
* Copyright 2019-2023 | Fabrice Creuzot <fabrice~cellublue~com>
@@ -30,7 +30,7 @@ public function afterLoad($object) {
3030
$value = ['images' => [], 'values' => []];
3131
$localAttributes = ['label', 'position', 'disabled'];
3232

33-
// traite toutes les colonnes
33+
// all columns
3434
$fields = $this->getAllColumns();
3535
foreach ($fields as $field) {
3636
if ((mb_stripos($field['Field'], '_id') === false) && !in_array($field['Field'], $localAttributes))
@@ -97,8 +97,8 @@ public function afterSave($object) {
9797

9898
$this->_getResource()->deleteGalleryValueInStore($image['value_id'], $storeId);
9999

100-
// par vue magasin
101-
// remet toutes les colonnes
100+
// store view
101+
// with all columns
102102
$data = ['value_id' => $image['value_id'], 'store_id' => $storeId];
103103
$fields = $this->_getResource()->getAllColumns();
104104
foreach ($fields as $field) {

‎src/app/code/community/Luigifab/Apijs/Model/Rewrite/Mediares.php‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
33
* Created J/29/08/2019
4-
* Updated S/19/02/2022
4+
* Updated L/28/07/2025
55
*
66
* Copyright 2008-2025 | Fabrice Creuzot (luigifab) <code~luigifab~fr>
77
* Copyright 2019-2023 | Fabrice Creuzot <fabrice~cellublue~com>
@@ -29,7 +29,7 @@ protected function _getLoadGallerySelect($productIds, $storeId, $attributeId) {
2929
$adapter = $this->_getReadAdapter();
3030
$positionCheckSql = $adapter->getCheckSql('value.position IS NULL', 'default_value.position', 'value.position');
3131

32-
// récupère toutes les colonnes
32+
// fetch all columns
3333
$values = [];
3434
$fields = $this->getAllColumns();
3535
foreach ($fields as $field) {
@@ -48,7 +48,7 @@ protected function _getLoadGallerySelect($productIds, $storeId, $attributeId) {
4848
$adapter->quoteInto('main.value_id = value.value_id AND value.store_id = ?', (int) $storeId),
4949
array_values($values) // ['label', 'position', 'disabled']
5050
)
51-
->joinLeft( // Joining default values
51+
->joinLeft( // joining default values
5252
['default_value' => $this->getTable(self::GALLERY_VALUE_TABLE)],
5353
'main.value_id = default_value.value_id AND default_value.store_id = 0',
5454
$values // ['label_default' => 'label', 'position_default' => 'position', 'disabled_default' => 'disabled']

‎src/app/code/community/Luigifab/Apijs/Model/Useragentparser.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public function parse($userAgent = null) {
6161
$userAgent, $result);
6262

6363

64-
// If nothing matched, return null (to avoid undefined index errors)
64+
// if nothing matched, return null (to avoid undefined index errors)
6565
if (!isset($result['browser'][0], $result['version'][0])) {
6666

6767
if (preg_match('%^(?!Mozilla)(?P<browser>[A-Z\d\-]+)([/ :](?P<version>[\dA-Z.]+))?%ix', $userAgent, $result)) {

0 commit comments

Comments
 (0)