]> _ Git - cubeextranet.git/commitdiff
wait #4494 @1
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Thu, 27 May 2021 16:15:53 +0000 (16:15 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Thu, 27 May 2021 16:15:53 +0000 (16:15 +0000)
inc/ws/Util/html5/master/class.ws.html5.compiler.php

index 5398af1013d42f886d435c552244f9e46f7d9990..ac4ed965578e721edee09a63acbc2a955291932f 100644 (file)
@@ -905,7 +905,7 @@ j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
 <!-- End Google Tag Manager -->
 ";
             $this->book->parametres->statsCustom = '<!-- Google Tag Manager (noscript) -->
-<noscript><iframe src="https://www.googletagmanager.com/ns.html?id='.$this->book->parametres->googleTagManager.'"
+<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=' . $this->book->parametres->googleTagManager . '"
 height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
 <!-- End Google Tag Manager (noscript) -->';
         }
@@ -1255,15 +1255,15 @@ height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
 
             $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 .= '<link rel="apple-touch-icon" href="data/apple-touch-icon.png" />' . "\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"></iframe></noscript>
                 if ($this->book->parametres->splashURL !== '') {
                     $splash = '<a href="' . $this->book->parametres->splashURL . '" target="' . $this->book->parametres->splashTarget . '" style="display:block;position:absolute;top:0;left;0;width:100%;height:100%"></a>';
                 }
-            } 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 .= '<div class="logo"><img src="data/images/' . $this->theme->parametres->logoLoader . '" width="' . $dim[0] . '" height="' . $dim[1] . '" alt="" /></div>';
                 }
             }
@@ -1563,8 +1563,8 @@ height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
 
     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"></iframe></noscript>
         // 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"></iframe></noscript>
 
         // 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"></iframe></noscript>
         $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"></iframe></noscript>
                 $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:';