getHex(); if ($mbhc->isLight($mcolor, 75)) { $menu_is = 'light'; $menu_background_hover_color = '#' . $mbhc->darken(5); } else { $menu_is = 'dark'; $menu_background_hover_color = '#' . $mbhc->lighten(5); } } if (!isset($nav_icon_hover_color)) { $nihc = new Color($nav_bg); if ($nihc->isLight()) { $nav_icon_hover_color = '#' . $nihc->darken(10); } else { $nav_icon_hover_color = '#' . $nihc->lighten(10); } } if (!isset($link_hover_color)) { $lhc = new Color($link_color); $lcolor = $lhc->getHex(); if ($lhc->isLight($lcolor, 75)) { $link_hover_color = '#' . $lhc->darken(5); } else { $link_hover_color = '#' . $lhc->lighten(5); } } // Convert $bg_image_options into css. if (!isset($bg_image_option)) { $bg_image_option = null; } switch ($bg_image_option) { case 'stretch': $background_size_img = '100%'; $background_repeat = 'no-repeat'; break; case 'cover': $background_size_img = 'cover'; $background_repeat = 'no-repeat'; break; case 'repeat': $background_size_img = 'auto'; $background_repeat = 'repeat'; break; case 'contain': $background_size_img = 'contain'; $background_repeat = 'repeat'; break; default: $background_size_img = 'auto'; $background_repeat = 'no-repeat'; break; } // Convert transparency level from percentage to opacity value. $contentbg_transp = $contentbg_transp / 100; $options = [ '$nav_bg' => $nav_bg, '$nav_icon_color' => $nav_icon_color, '$nav_icon_hover_color' => $nav_icon_hover_color, '$link_color' => $link_color, '$link_hover_color' => $link_hover_color, '$menu_background_hover_color' => $menu_background_hover_color, '$btn_primary_color' => $nav_icon_color, '$btn_primary_hover_color' => $menu_background_hover_color, '$background_color' => $background_color, '$contentbg_transp' => $contentbg_transp, '$background_image' => $background_image, '$background_size_img' => $background_size_img, '$background_repeat' => $background_repeat, '$login_bg_image' => $login_bg_image, '$login_bg_color' => $login_bg_color ]; $css_tpl = file_get_contents('view/theme/frio/css/style.css'); // Get the content of the scheme css file and the time of the last file change. if ($schemecssfile) { $css_tpl .= file_get_contents($schemecssfile); $scheme_modified = filemtime($schemecssfile); } // We need to check which is the most recent css data. // We will use this time later to decide if we load the cached or fresh css data. if ($scheme_modified > $modified) { $modified = $scheme_modified; } // Apply the settings to the css template. $css = str_replace(array_keys($options), array_values($options), $css_tpl); $modified = gmdate('r', $modified); $etag = md5($css); // Set a header for caching. header('Cache-Control: public'); header('ETag: "' . $etag . '"'); header('Last-Modified: ' . $modified); // Only send the CSS file if it was changed. /// @todo Check if this works at all (possibly clients are sending only the one or the other header) - compare with mod/photo.php if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && isset($_SERVER['HTTP_IF_NONE_MATCH'])) { $cached_modified = gmdate('r', strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE'])); $cached_etag = str_replace(['"', '-gzip'], ['', ''], stripslashes($_SERVER['HTTP_IF_NONE_MATCH'])); if (($cached_modified == $modified) && ($cached_etag == $etag)) { header('HTTP/1.1 304 Not Modified'); exit(); } } echo $css;