[9.2.10] Gallery module 1.3 structure modifiée pour la v10
This commit is contained in:
parent
757c15fc48
commit
68ac511781
@ -30,7 +30,7 @@ class gallery extends common {
|
|||||||
|
|
||||||
public static $pictures = [];
|
public static $pictures = [];
|
||||||
|
|
||||||
const GALLERY_VERSION = '1.2';
|
const GALLERY_VERSION = '1.3';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configuration
|
* Configuration
|
||||||
@ -167,6 +167,7 @@ class gallery extends common {
|
|||||||
}
|
}
|
||||||
$legends = [];
|
$legends = [];
|
||||||
foreach((array) $this->getInput('legend', null) as $file => $legend) {
|
foreach((array) $this->getInput('legend', null) as $file => $legend) {
|
||||||
|
$file = str_replace('.','',$file);
|
||||||
$legends[$file] = helper::filter($legend, helper::FILTER_STRING_SHORT);
|
$legends[$file] = helper::filter($legend, helper::FILTER_STRING_SHORT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -193,7 +194,7 @@ class gallery extends common {
|
|||||||
self::$pictures[$fileInfos->getFilename()] = [
|
self::$pictures[$fileInfos->getFilename()] = [
|
||||||
$fileInfos->getFilename(),
|
$fileInfos->getFilename(),
|
||||||
template::text('legend[' . $fileInfos->getFilename() . ']', [
|
template::text('legend[' . $fileInfos->getFilename() . ']', [
|
||||||
'value' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'legend', $fileInfos->getFilename()])
|
'value' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'legend', str_replace('.','',$fileInfos->getFilename())])
|
||||||
])
|
])
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@ -229,8 +230,20 @@ class gallery extends common {
|
|||||||
if(is_dir($directory)) {
|
if(is_dir($directory)) {
|
||||||
$iterator = new DirectoryIterator($directory);
|
$iterator = new DirectoryIterator($directory);
|
||||||
foreach($iterator as $fileInfos) {
|
foreach($iterator as $fileInfos) {
|
||||||
|
// Préparation des clés de légendes pour la v10
|
||||||
|
$data = $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'legend']);
|
||||||
|
foreach ($data as $itemKey=>$itemValue) {
|
||||||
|
// Ancien nom avec un point devant l'extension ?
|
||||||
|
if (strpos($itemKey,'.') > 0) {
|
||||||
|
// Créer une nouvelle clé
|
||||||
|
$this->setData(['module', $this->getUrl(0), $this->getUrl(1), 'legend',str_replace('.','',$itemKey),$itemValue]);
|
||||||
|
// Supprimer la valeur
|
||||||
|
$this->deleteData(['module', $this->getUrl(0), $this->getUrl(1), 'legend',$itemKey]);
|
||||||
|
}
|
||||||
|
$this->saveData();
|
||||||
|
}
|
||||||
if($fileInfos->isDot() === false AND $fileInfos->isFile() AND @getimagesize($fileInfos->getPathname())) {
|
if($fileInfos->isDot() === false AND $fileInfos->isFile() AND @getimagesize($fileInfos->getPathname())) {
|
||||||
self::$pictures[$directory . '/' . $fileInfos->getFilename()] = $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'legend', $fileInfos->getFilename()]);
|
self::$pictures[$directory . '/' . $fileInfos->getFilename()] = $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'legend', str_replace('.','',$fileInfos->getFilename())]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Tri des images par ordre alphabétique
|
// Tri des images par ordre alphabétique
|
||||||
|
Loading…
Reference in New Issue
Block a user