From: vincent@cubedesigners.com Date: Thu, 27 May 2021 16:15:53 +0000 (+0000) Subject: wait #4494 @1 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=8a2900f0b2d432519bf84a09abdd86e7a1de5146;p=cubeextranet.git wait #4494 @1 --- diff --git a/inc/ws/Util/html5/master/class.ws.html5.compiler.php b/inc/ws/Util/html5/master/class.ws.html5.compiler.php index 5398af101..ac4ed9655 100644 --- a/inc/ws/Util/html5/master/class.ws.html5.compiler.php +++ b/inc/ws/Util/html5/master/class.ws.html5.compiler.php @@ -905,7 +905,7 @@ j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= "; $this->book->parametres->statsCustom = ' - '; } @@ -1255,15 +1255,15 @@ height="0" width="0" style="display:none;visibility:hidden"> $favicon = ''; $hasIos = false; - if ($this->theme->parametres->iosicon != '') { + if ($iosico = $this->checkThemeImage($this->theme->parametres->iosicon)) { $hasIos = true; - $this->vdir->copy($this->themeRoot . '/' . $this->theme->parametres->iosicon, 'data/apple-touch-icon.png'); + $this->vdir->copy($iosico, 'data/apple-touch-icon.png'); $favicon .= '' . "\n\t"; } if ($this->theme->parametres->favicon != '') { - $pngFile = $this->themeRoot . '/' . $this->theme->parametres->favicon; - $icoFile = $this->themeRoot . '/favicon.ico'; + $pngFile = $this->checkThemeImage($this->theme->parametres->favicon); + $icoFile = $this->checkThemeImage('favicon.ico'); if (!file_exists($icoFile) || filemtime($icoFile) < filemtime($pngFile) || filemtime(__FILE__) > filemtime($icoFile)) { $tmp = CubeIT_Files::tempnam() . '.png'; @@ -1302,10 +1302,10 @@ height="0" width="0" style="display:none;visibility:hidden"> if ($this->book->parametres->splashURL !== '') { $splash = ''; } - } else if ($this->theme->parametres->logoLoader && file_exists($this->themeRoot . $this->theme->parametres->logoLoader)) { - $dim = CubeIT_Image::getimagesize($this->themeRoot . $this->theme->parametres->logoLoader); + } else if ($ll = $this->checkThemeImage($this->theme->parametres->logoLoader)) { + $dim = CubeIT_Image::getimagesize($ll); if ($dim !== false) { - $this->vdir->copy($this->themeRoot . '/' . $this->theme->parametres->logoLoader, 'data/images/' . $this->theme->parametres->logoLoader); + $this->vdir->copy($ll, 'data/images/' . $this->theme->parametres->logoLoader); $splash .= ''; } } @@ -1563,8 +1563,8 @@ height="0" width="0" style="display:none;visibility:hidden"> protected function writeExtras() { - if ($this->theme->parametres->afterSearch != '') { - $this->vdir->copy($this->themeRoot . '/' . $this->theme->parametres->afterSearch, 'data/images/' . $this->theme->parametres->afterSearch); + if ($as = $this->checkThemeImage($this->theme->parametres->afterSearch)) { + $this->vdir->copy($as, 'data/images/' . $this->theme->parametres->afterSearch); } if ($this->book->parametres->externalArchives != '') { $this->addFilesInfos('archives', $this->wdir . '/' . $this->book->parametres->externalArchives); @@ -2325,8 +2325,8 @@ height="0" width="0" style="display:none;visibility:hidden"> // Header $header = 'header{'; $header .= 'height:' . $this->theme->parametres->menuHeight . 'px;'; - if ($this->theme->parametres->menuImage != '') { - $this->vdir->copy($this->themeRoot . '/' . $this->theme->parametres->menuImage, 'data/images/' . $this->theme->parametres->menuImage); + if ($mi = $this->checkThemeImage($this->theme->parametres->menuImage)) { + $this->vdir->copy($mi, 'data/images/' . $this->theme->parametres->menuImage); $header .= 'background-image:url(../images/' . $this->theme->parametres->menuImage . ');'; $header .= 'background-repeat:no-repeat;'; $header .= 'background-size:100% ' . $this->theme->parametres->menuHeight . 'px;'; @@ -2339,9 +2339,9 @@ height="0" width="0" style="display:none;visibility:hidden"> // Logo $logo = '#logo{'; - if ($this->theme->parametres->logo) { - $this->vdir->copy($this->themeRoot . '/' . $this->theme->parametres->logo, 'data/images/' . $this->theme->parametres->logo); - $dim = CubeIT_Image::getimagesize($this->themeRoot . '/' . $this->theme->parametres->logo); + if ($l = $this->checkThemeImage($this->theme->parametres->logo)) { + $this->vdir->copy($l, 'data/images/' . $this->theme->parametres->logo); + $dim = CubeIT_Image::getimagesize($l); $logo .= 'background-image:url(../images/' . $this->theme->parametres->logo . ');width:' . $dim[0] . 'px;height:' . $dim[1] . 'px;'; } $logo .= '}'; @@ -2465,6 +2465,25 @@ height="0" width="0" style="display:none;visibility:hidden"> $this->log('Write CSS'); } + protected function checkThemeImage($path) + { + $path = trim($path); + $path = trim($path, '/'); + if (!$path) { + return false; + } + $p = $this->themeRoot . '/' . $path; + if (file_exists($p)) { + return $p; + } + $po = str_replace('.svg', '.o.svg', $p); + if (file_exists($po)) { + copy($po, $p); + return $p; + } + return false; + } + protected function _writeLess($variables, $lessContents = '') { if ($this->widget) { @@ -2554,14 +2573,13 @@ height="0" width="0" style="display:none;visibility:hidden"> $body .= 'background-size:100% 100%;'; break; } - if ($this->theme->parametres->backgroundImage != '') { - $bi = $this->themeRoot . '/' . $this->theme->parametres->backgroundImage; - if (file_exists($bi)) { - $dbi = CubeIT_Image::getimagesize($bi); - $this->config->backgroundImageDimensions = array('width' => $dbi[0], 'height' => $dbi[1]); - } + if ($bi = $this->checkThemeImage($this->theme->parametres->backgroundImage)) { + + $dbi = CubeIT_Image::getimagesize($bi); + $this->config->backgroundImageDimensions = array('width' => $dbi[0], 'height' => $dbi[1]); + - $this->vdir->copy($this->themeRoot . '/' . $this->theme->parametres->backgroundImage, 'data/images/' . $this->theme->parametres->backgroundImage); + $this->vdir->copy($bi, 'data/images/' . $this->theme->parametres->backgroundImage); $body .= 'background-image:url(../images/' . $this->theme->parametres->backgroundImage . ');'; $body .= 'background-position:';