<!-- 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) -->';
}
$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';
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>';
}
}
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);
// 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;';
// 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 .= '}';
$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) {
$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:';