diff --git a/public_html/layout/denim/css/style.css.php b/public_html/layout/denim/css/style.css.php new file mode 100644 index 000000000..3267affa1 --- /dev/null +++ b/public_html/layout/denim/css/style.css.php @@ -0,0 +1,176 @@ + $d) { + $priority[$k] = $d['priority']; +} +array_multisort($priority, SORT_ASC, $cssfiles); + +if (isset($_SERVER['HTTP_IF_NONE_MATCH'])) { + if (is_readable($etag_filename)) { + $etag = file_get_contents($etag_filename); + if (!empty($etag) AND (trim($_SERVER['HTTP_IF_NONE_MATCH'], '"\'') === $etag)) { + header('HTTP/1.1 304 Not Modified'); + header('Status: 304 Not Modified'); + exit; + } + } +} + +// creates a new ETag value and saves it into the file +$etag = md5(microtime(TRUE)); +@file_put_contents($etag_filename, $etag); + +// Send correct header type: +header('Content-Type: text/css; charset=UTF-8'); +// Add Cache Expire in 1 week +header('Cache-control: must-revalidate'); +header('Expires: '.gmdate('D, d M Y H:i:s', time() + 604800).' GMT'); + +header('ETag: "' . $etag . '"'); + +// Output the contents of each file +foreach ($cssfiles as $file) { + $full_filepath = ''; + // Set css path variables + $css_file_default=''; + if (!empty($theme_default)) { + $css_file_default = $path_html . $file['file']; + } + $css_file = $path_html . $file['file']; + + if (!empty($theme_default)) { + // First add own theme css file if found else add default css file + if (is_readable($css_file)) { + $full_filepath = $css_file; + } elseif (is_readable($css_file_default)) { + $full_filepath = $css_file_default; + } + } else { + // Add theme css file if found + if (is_readable($css_file)) { + $full_filepath = $css_file; + } + } + + if (!empty($full_filepath)) { + $css = file_get_contents($full_filepath); + echo $css . PHP_EOL; + } +} diff --git a/public_html/layout/denim/fonts/FontAwesome.otf b/public_html/layout/denim/fonts/FontAwesome.otf new file mode 100644 index 000000000..d4de13e83 Binary files /dev/null and b/public_html/layout/denim/fonts/FontAwesome.otf differ diff --git a/public_html/layout/denim/fonts/fontawesome-webfont.ttf b/public_html/layout/denim/fonts/fontawesome-webfont.ttf new file mode 100644 index 000000000..f221e50a2 Binary files /dev/null and b/public_html/layout/denim/fonts/fontawesome-webfont.ttf differ diff --git a/public_html/layout/denim/fonts/fontawesome-webfont.woff b/public_html/layout/denim/fonts/fontawesome-webfont.woff new file mode 100644 index 000000000..6e7483cf6 Binary files /dev/null and b/public_html/layout/denim/fonts/fontawesome-webfont.woff differ diff --git a/public_html/layout/denim/fonts/fontawesome-webfont.woff2 b/public_html/layout/denim/fonts/fontawesome-webfont.woff2 new file mode 100644 index 000000000..7eb74fd12 Binary files /dev/null and b/public_html/layout/denim/fonts/fontawesome-webfont.woff2 differ diff --git a/public_html/layout/denim/functions.php b/public_html/layout/denim/functions.php index 782960b34..2bbeada8d 100644 --- a/public_html/layout/denim/functions.php +++ b/public_html/layout/denim/functions.php @@ -69,6 +69,7 @@ function theme_config_denim() 'tooltip' => 1, 'upload' => 0, ), + 'enable_etag' => 0, // 1:enable or 0:disable ETag 'use_minified_css' => 0, // 1:use or 0:no_use minified css 'header_search' => 1, // 1:show or 0:hide header searchbox 'block_left_search' => 1, // 1:show or 0:hide left block searchbox @@ -83,6 +84,7 @@ function theme_config_denim() return array( 'image_type' => 'png', 'doctype' => 'xhtml5', + 'etag' => false, // never set this true. instead use $options['enable_etag'] above. 'supported_version_theme' => '2.0.0', // support new theme format for the later Geeklog 2.0.0 'theme_plugins' => 'denim', // Not requred, you can specify compatible theme of template stored with some plugins 'options' => $options // Not requred, some options of this theme @@ -105,39 +107,75 @@ function theme_css_denim() } $min = ($theme_var['options']['use_minified_css'] === 1) ? '.min' : ''; - $result = array(); - $result[] = array( + // array of css packages + $css_packages = array(); + + // main package items + $css_items = array(); + + // add uikit css + $css_items[] = array( 'name' => 'uikit', 'file' => '/vendor/uikit/css' . $direction . '/uikit' . $ui_theme . $min . '.css', 'attributes' => array('media' => 'all'), 'priority' => 80 ); - $result[] = array( + // add some uikit component css + if (!empty($theme_var['options']['uikit_components'])) { + $uikit_components = array_merge($theme_var['options']['uikit_components']); + foreach ($uikit_components as $component => $value) { + if ($value !== 1) continue; + $componame = str_replace('_', '-', $component); + $css_items[] = array( + 'name' => 'uk_' . $component, + 'file' => '/vendor/uikit/css' . $direction . '/components/' . $componame . $ui_theme . $min . '.css', + 'priority' => 81 + ); + } + } + + // add main css of this theme + $css_items[] = array( 'name' => 'main', // don't use the name 'theme' to control the priority 'file' => '/layout/' . $_CONF['theme'] . '/css_' . $LANG_DIRECTION . '/style' . $ui_theme . $min . '.css', 'attributes' => array('media' => 'all'), - 'priority' => 100 + 'priority' => 90 ); - $result[] = array( + // add custom css of this theme + $css_items[] = array( 'name' => 'custom', 'file' => '/layout/' . $_CONF['theme'] . '/css_' . $LANG_DIRECTION . '/custom.css', 'attributes' => array('media' => 'all'), - 'priority' => 101 + 'priority' => 91 ); - if (!empty($theme_var['options']['uikit_components'])) { - $uikit_components = array_merge($theme_var['options']['uikit_components']); - foreach ($uikit_components as $component => $value) { - if ($value !== 1) continue; - $componame = str_replace('_', '-', $component); + // register main css package + $css_packages[] = array( + 'name' => 'main_package', + 'css_items' => $css_items, + ); + + // never packed css items + $never_packed_items = array(); + + $result = array(); + $result = $never_packed_items; + if ($theme_var['options']['enable_etag'] === 1) { + foreach($css_packages as $package) { $result[] = array( - 'name' => 'uk_' . $component, - 'file' => '/vendor/uikit/css' . $direction . '/components/' . $componame . $ui_theme . $min . '.css', - 'priority' => 81 + 'name' => $package['name'], + 'file' => '/layout/' . $_CONF['theme'] . '/css/style.css.php?theme=' + . $_CONF['theme'] . '&package=' . $package['name'] . '&dir=' . $LANG_DIRECTION, + 'css_items' => $package['css_items'], + 'priority' => 90 ); } + } else { + foreach($css_packages as $package) { + $result = array_merge($result, $package['css_items']); + } } return $result; diff --git a/public_html/layout/denim_curve/css/style.css.php b/public_html/layout/denim_curve/css/style.css.php new file mode 100644 index 000000000..3267affa1 --- /dev/null +++ b/public_html/layout/denim_curve/css/style.css.php @@ -0,0 +1,176 @@ + $d) { + $priority[$k] = $d['priority']; +} +array_multisort($priority, SORT_ASC, $cssfiles); + +if (isset($_SERVER['HTTP_IF_NONE_MATCH'])) { + if (is_readable($etag_filename)) { + $etag = file_get_contents($etag_filename); + if (!empty($etag) AND (trim($_SERVER['HTTP_IF_NONE_MATCH'], '"\'') === $etag)) { + header('HTTP/1.1 304 Not Modified'); + header('Status: 304 Not Modified'); + exit; + } + } +} + +// creates a new ETag value and saves it into the file +$etag = md5(microtime(TRUE)); +@file_put_contents($etag_filename, $etag); + +// Send correct header type: +header('Content-Type: text/css; charset=UTF-8'); +// Add Cache Expire in 1 week +header('Cache-control: must-revalidate'); +header('Expires: '.gmdate('D, d M Y H:i:s', time() + 604800).' GMT'); + +header('ETag: "' . $etag . '"'); + +// Output the contents of each file +foreach ($cssfiles as $file) { + $full_filepath = ''; + // Set css path variables + $css_file_default=''; + if (!empty($theme_default)) { + $css_file_default = $path_html . $file['file']; + } + $css_file = $path_html . $file['file']; + + if (!empty($theme_default)) { + // First add own theme css file if found else add default css file + if (is_readable($css_file)) { + $full_filepath = $css_file; + } elseif (is_readable($css_file_default)) { + $full_filepath = $css_file_default; + } + } else { + // Add theme css file if found + if (is_readable($css_file)) { + $full_filepath = $css_file; + } + } + + if (!empty($full_filepath)) { + $css = file_get_contents($full_filepath); + echo $css . PHP_EOL; + } +} diff --git a/public_html/layout/denim_curve/fonts/FontAwesome.otf b/public_html/layout/denim_curve/fonts/FontAwesome.otf new file mode 100644 index 000000000..d4de13e83 Binary files /dev/null and b/public_html/layout/denim_curve/fonts/FontAwesome.otf differ diff --git a/public_html/layout/denim_curve/fonts/fontawesome-webfont.ttf b/public_html/layout/denim_curve/fonts/fontawesome-webfont.ttf new file mode 100644 index 000000000..f221e50a2 Binary files /dev/null and b/public_html/layout/denim_curve/fonts/fontawesome-webfont.ttf differ diff --git a/public_html/layout/denim_curve/fonts/fontawesome-webfont.woff b/public_html/layout/denim_curve/fonts/fontawesome-webfont.woff new file mode 100644 index 000000000..6e7483cf6 Binary files /dev/null and b/public_html/layout/denim_curve/fonts/fontawesome-webfont.woff differ diff --git a/public_html/layout/denim_curve/fonts/fontawesome-webfont.woff2 b/public_html/layout/denim_curve/fonts/fontawesome-webfont.woff2 new file mode 100644 index 000000000..7eb74fd12 Binary files /dev/null and b/public_html/layout/denim_curve/fonts/fontawesome-webfont.woff2 differ diff --git a/public_html/layout/denim_curve/functions.php b/public_html/layout/denim_curve/functions.php index 286ee1905..65f10bbf0 100644 --- a/public_html/layout/denim_curve/functions.php +++ b/public_html/layout/denim_curve/functions.php @@ -69,7 +69,8 @@ function theme_config_denim_curve() 'tooltip' => 1, 'upload' => 0, ), - 'use_minified_css' => 0, // 1:use or 0:no_use minified css + 'enable_etag' => 1, // 1:enable or 0:disable ETag + 'use_minified_css' => 1, // 1:use or 0:no_use minified css 'header_search' => 1, // 1:show or 0:hide header searchbox 'block_left_search' => 0, // 1:show or 0:hide left block searchbox 'welcome_msg' => 1, // 1:show or 0:hide welcome message @@ -83,6 +84,7 @@ function theme_config_denim_curve() return array( 'image_type' => 'png', 'doctype' => 'xhtml5', + 'etag' => false, // never set this true. instead use $options['enable_etag'] above. 'supported_version_theme' => '2.0.0', // support new theme format for the later Geeklog 2.0.0 'theme_plugins' => 'denim', // Not requred, you can specify compatible theme of template stored with some plugins 'theme_default' => 'denim', @@ -106,39 +108,75 @@ function theme_css_denim_curve() } $min = ($theme_var['options']['use_minified_css'] === 1) ? '.min' : ''; - $result = array(); - $result[] = array( + // array of css packages + $css_packages = array(); + + // main package items + $css_items = array(); + + // add uikit css + $css_items[] = array( 'name' => 'uikit', 'file' => '/vendor/uikit/css' . $direction . '/uikit' . $ui_theme . $min . '.css', 'attributes' => array('media' => 'all'), 'priority' => 80 ); - $result[] = array( + // add some uikit component css + if (!empty($theme_var['options']['uikit_components'])) { + $uikit_components = array_merge($theme_var['options']['uikit_components']); + foreach ($uikit_components as $component => $value) { + if ($value !== 1) continue; + $componame = str_replace('_', '-', $component); + $css_items[] = array( + 'name' => 'uk_' . $component, + 'file' => '/vendor/uikit/css' . $direction . '/components/' . $componame . $ui_theme . $min . '.css', + 'priority' => 81 + ); + } + } + + // add main css of this theme + $css_items[] = array( 'name' => 'main', // don't use the name 'theme' to control the priority 'file' => '/layout/' . $_CONF['theme'] . '/css_' . $LANG_DIRECTION . '/style' . $ui_theme . $min . '.css', 'attributes' => array('media' => 'all'), - 'priority' => 100 + 'priority' => 90 ); - $result[] = array( + // add custom css of this theme + $css_items[] = array( 'name' => 'custom', 'file' => '/layout/' . $_CONF['theme'] . '/css_' . $LANG_DIRECTION . '/custom.css', 'attributes' => array('media' => 'all'), - 'priority' => 101 + 'priority' => 91 ); - if (!empty($theme_var['options']['uikit_components'])) { - $uikit_components = array_merge($theme_var['options']['uikit_components']); - foreach ($uikit_components as $component => $value) { - if ($value !== 1) continue; - $componame = str_replace('_', '-', $component); + // register main css package + $css_packages[] = array( + 'name' => 'main_package', + 'css_items' => $css_items, + ); + + // never packed css items + $never_packed_items = array(); + + $result = array(); + $result = $never_packed_items; + if ($theme_var['options']['enable_etag'] === 1) { + foreach($css_packages as $package) { $result[] = array( - 'name' => 'uk_' . $component, - 'file' => '/vendor/uikit/css' . $direction . '/components/' . $componame . $ui_theme . $min . '.css', - 'priority' => 81 + 'name' => $package['name'], + 'file' => '/layout/' . $_CONF['theme'] . '/css/style.css.php?theme=' + . $_CONF['theme'] . '&package=' . $package['name'] . '&dir=' . $LANG_DIRECTION, + 'css_items' => $package['css_items'], + 'priority' => 90 ); } + } else { + foreach($css_packages as $package) { + $result = array_merge($result, $package['css_items']); + } } return $result;