From 68ac511781481f21ccbe88da9cd7166191168304 Mon Sep 17 00:00:00 2001 From: fredtempez Date: Mon, 4 Nov 2019 12:22:26 +0100 Subject: [PATCH] =?UTF-8?q?[9.2.10]=20Gallery=20module=201.3=20=20structur?= =?UTF-8?q?e=20modifi=C3=A9e=20pour=20la=20v10?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module/gallery/gallery.php | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/module/gallery/gallery.php b/module/gallery/gallery.php index c36c5844..0f8169db 100644 --- a/module/gallery/gallery.php +++ b/module/gallery/gallery.php @@ -30,7 +30,7 @@ class gallery extends common { public static $pictures = []; - const GALLERY_VERSION = '1.2'; + const GALLERY_VERSION = '1.3'; /** * Configuration @@ -167,6 +167,7 @@ class gallery extends common { } $legends = []; foreach((array) $this->getInput('legend', null) as $file => $legend) { + $file = str_replace('.','',$file); $legends[$file] = helper::filter($legend, helper::FILTER_STRING_SHORT); } @@ -193,7 +194,7 @@ class gallery extends common { self::$pictures[$fileInfos->getFilename()] = [ $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)) { $iterator = new DirectoryIterator($directory); 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())) { - 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