diff --git a/module/gallery/gallery.php b/module/gallery/gallery.php index 2ff436c..11a8d72 100644 --- a/module/gallery/gallery.php +++ b/module/gallery/gallery.php @@ -88,6 +88,9 @@ class gallery extends common { * Content */ private function init() { + + // Variable commune + $fileCSS = self::DATADIRECTORY . $this->getUrl(0) . '/theme.css' ; // Mise à jour d'une version inférieure, la gallery existe mais pas la variable content if ($this->getData(['module', $this->getUrl(0)]) && @@ -111,13 +114,10 @@ class gallery extends common { $this->deleteData(['theme','gallery']); $this->setData(['module', $this->getUrl(0), 'theme', $data]); // Nom de la feuille de style - $this->setData(['module', $this->getUrl(0), 'theme', 'style', self::DATADIRECTORY . $this->getUrl(0) . '/theme.css']); + $this->setData(['module', $this->getUrl(0), 'theme', 'style', $fileCSS]); } } - // Variable commune - $fileCSS = self::DATADIRECTORY . $this->getUrl(0) . '/theme.css' ; - // Check la présence des données de thème if ( $this->getData(['module', $this->getUrl(0), 'theme']) === null ) { require_once('module/gallery/ressource/defaultdata.php'); @@ -127,7 +127,7 @@ class gallery extends common { } // Check la présence de la feuille de style - if ( !file_exists(self::DATADIRECTORY . $this->getUrl(0) . '/theme.css')) { + if ( !file_exists($fileCSS)) { // Dossier de l'instance if (!is_dir(self::DATADIRECTORY . $this->getUrl(0) )) { mkdir (self::DATADIRECTORY . $this->getUrl(0), 0755, true); @@ -152,15 +152,14 @@ class gallery extends common { $content = str_replace('#legendTextColor#',$this->getData(['module', $this->getUrl(0), 'theme', 'legendTextColor']),$content ); $content = str_replace('#legendBgColor#',$this->getData(['module', $this->getUrl(0), 'theme', 'legendBgColor']),$content ); // Ecriture de la feuille de style - file_put_contents(self::DATADIRECTORY . $this->getUrl(0) . '/theme.css' , $content . $themeCss); + file_put_contents($fileCSS , $content . $themeCss); // Nom de la feuille de style $this->setData(['module', $this->getUrl(0), 'theme', 'style', $fileCSS]); } // Check la présence de la config if ( $this->getData(['module', $this->getUrl(0), 'config']) === null ) { - require_once('module/gallery/ressource/defaultdata.php'); - $this->setData(['module', $this->getUrl(0), 'config', theme::$defaultData]); + $this->setData(['module', $this->getUrl(0), 'config', self::VERSION]); } // Contenu vide de la galerie diff --git a/module/gallery/ressource/defaultdata.php b/module/gallery/ressource/defaultdata.php index 5884794..7cadb23 100644 --- a/module/gallery/ressource/defaultdata.php +++ b/module/gallery/ressource/defaultdata.php @@ -16,7 +16,4 @@ class theme extends gallery { 'legendTextColor' => 'rgba(255, 255, 255, 1)', 'legendBgColor' => 'rgba(0, 0, 0, .6)' ]; - public static $defaultData = [ - 'versionData' => '4.0' - ]; }