]> _ Git - cubeextranet.git/commitdiff
fix #1904 @1
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 6 Feb 2018 18:12:53 +0000 (18:12 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 6 Feb 2018 18:12:53 +0000 (18:12 +0000)
inc/ws/Util/html5/master/class.ws.html5.compiler.php

index 942a1250a1572eda1aa9902a5f57307b073c7b73..86484d62604599f17f0ed5902ccfecd7e6a45116 100644 (file)
@@ -539,9 +539,31 @@ class wsHTML5Compiler {
 
 
                $favicon = '';
+               $hasIos = false;
+               if ($this->theme->parametres->iosicon != '') {
+                       $hasIos = true;
+                       $this->vdir->copy($this->themeRoot . '/' . $this->theme->parametres->iosicon, 'data/apple-touch-icon.png');
+                       $favicon .= '<link rel="apple-touch-icon" href="data/apple-touch-icon.png" />';
+               }
                if ($this->theme->parametres->favicon != '') {
-                       $this->vdir->copy($this->themeRoot . '/' . $this->theme->parametres->favicon, 'data/favicon.png');
-                       $favicon = '<link rel="apple-touch-icon" href="data/favicon.png" />';
+
+                       $pngFile = $this->themeRoot . '/' . $this->theme->parametres->favicon;
+                       $icoFile = $this->themeRoot . '/favicon.ico';
+                       if (!file_exists($icoFile) || filemtime($icoFile) < filemtime($pngFile)) {
+                               $icotool = new cubeCommandLine('icotool');
+                               $icotool->setArg('c');
+                               $icotool->setArg('o', $icoFile);
+                               $icotool->setArg(null, $pngFile);
+                               $icotool->execute();
+                       }
+                       $this->vdir->copy($pngFile, 'data/favicon.png');
+                       $this->vdir->copy($icoFile, 'data/favicon.ico');
+                       $favicon .= '<link rel="shortcut icon" href="data/favicon.ico" />';
+                       $favicon .= '<link rel="icon" type="image/vnd.microsoft.icon" href="data/favicon.ico" />';
+                       $favicon .= '<link rel="icon" type="image/png" href="data/favicon.png" />';
+                       if (!$hasIos) {
+                               $favicon .= '<link rel="apple-touch-icon" href="data/favicon.png" />';
+                       }
                }
 
                $print = $this->writePrint();