[geeklog-hg] geeklog: Made it much easier to use the modern curve theme as a ...

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Sat Jun 22 13:38:50 EDT 2013


changeset 9116:ebe526cfea0f
url:  http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/ebe526cfea0f
user: Tom <websitemaster at cogeco.net>
date: Sat Jun 22 13:16:15 2013 -0400
description:
Made it much easier to use the modern curve theme as a default theme for a new theme. Now you only have to copy over the css files you have changed

diffstat:

 public_html/layout/modern_curve/style.css.php |  69 ++++++++++++++++++--------
 1 files changed, 47 insertions(+), 22 deletions(-)

diffs (106 lines):

diff -r 3ddc8f6f9196 -r ebe526cfea0f public_html/layout/modern_curve/style.css.php
--- a/public_html/layout/modern_curve/style.css.php	Fri Jun 21 15:32:22 2013 -0400
+++ b/public_html/layout/modern_curve/style.css.php	Sat Jun 22 13:16:15 2013 -0400
@@ -31,13 +31,23 @@
 
 require_once '../../siteconfig.php';
 
+$theme = 'modern_curve'; // Theme Name
+$default_theme = ''; // Default theme name. If nothing leave as blank string
+$path_themes = $_CONF['path'] . 'public_html/layout/'; // Assumes the default if not then change
+
+$css_path_default='';
+if (!empty($default_theme)) {
+    $css_path_default = $path_themes . $default_theme . '/css/';
+}
+$css_path = $path_themes . $theme . '/css/';
+
 // We assume /data directory is right under $_CONF['path'] directory.  If you
 // have moved or renamed /data directory, please change the following line accordingly.
-define('MODERN_CURVE_ETAG_FILE', $_CONF['path'] . 'data/modern_curve_etag.cache');
+$etag_filename =  $_CONF['path'] . 'data/' . $theme . '_etag.cache';
 
 if (isset($_SERVER['HTTP_IF_NONE_MATCH'])) {
-    if (is_readable(MODERN_CURVE_ETAG_FILE)) {
-        $etag = file_get_contents(MODERN_CURVE_ETAG_FILE);
+    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');
@@ -49,7 +59,7 @@
 
 // Creates a new ETag value and saves it into the file
 $etag = md5(microtime(TRUE));
- at file_put_contents(MODERN_CURVE_ETAG_FILE, $etag);
+ at file_put_contents($etag_filename, $etag);
 
 // Send correct header type:
 header('Content-Type: text/css; charset=UTF-8');
@@ -91,14 +101,11 @@
     'plugin/japanize.css',
     'plugin/sitecalendar.css',
 
-    'tooltips/tooltips.css'
+    'tooltips/tooltips.css', 
+    
+    'custom.css'
 );
 
-// Also output the contents of the custom CSS file, if it's available
-if (is_readable('css/custom.css')) {
-    $files[] = 'custom.css';
-}
-
 // Create directions for RTL support
 $left  = 'left';
 $right = 'right';
@@ -110,18 +117,36 @@
 
 // Output the contents of each file
 foreach ($files as $file) {
-    $css = file_get_contents('css/' . $file);
-    $css = preg_replace("@/\*.*?\*/@sm", '', $css); // strip comments
-    $css = preg_replace("@\s*\n+\s*@sm", "\n", $css); // strip indentation
-
-    // Replace {right} and {left} placeholders with actual values.
-    // Used for RTL support.
-    $css = str_replace('{right}', $right, $css);
-    $css = str_replace('{left}', $left, $css);
-
-    // Output
-    echo "\n/* $file */\n";
-    echo $css;
+    $full_filepath = '';
+    if (!empty($default_theme)) {
+        // First add own theme css file if found else add default css file
+        if (is_readable($css_path . $file)) {
+            $full_filepath = $css_path . $file;
+        } elseif (is_readable($css_path_default . $file)) {
+            $full_filepath = $css_path_default . $file;
+        }
+    } else {
+        // Add theme css file if found
+        if (is_readable($css_path . $file)) {
+            $full_filepath = $css_path . $file;
+        }
+    }
+    
+    if (!empty($full_filepath)) {
+        $css = file_get_contents($full_filepath);
+        $css = preg_replace("@/\*.*?\*/@sm", '', $css); // strip comments
+        $css = preg_replace("@\s*\n+\s*@sm", "\n", $css); // strip indentation
+    
+        // Replace {right} and {left} placeholders with actual values.
+        // Used for RTL support.
+        $css = str_replace('{right}', $right, $css);
+        $css = str_replace('{left}', $left, $css);
+    
+        // Output
+        echo "\n/* $full_filepath */\n";
+         
+        echo $css;
+    }
 }
 
 ?>



More information about the geeklog-cvs mailing list