$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();