<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>modules/color/.color.admin.css.swp</filename>
    </added>
    <added>
      <filename>modules/color/.color.module.swp</filename>
    </added>
    <added>
      <filename>modules/color/color.admin.css</filename>
    </added>
    <added>
      <filename>modules/color/color.info</filename>
    </added>
    <added>
      <filename>modules/color/color.module</filename>
    </added>
    <added>
      <filename>style.install</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -1,5 +1,9 @@
 /* $Id:$ */
 
+Janurary 13, 2008
+  o Code clarity improvements (Changing variable names, adding comments)
+  o Began recode of color.module
+
 December 27, 2008
   o Fixed logo.png
-  o Initial commit
\ No newline at end of file
+  o Initial commit</diff>
      <filename>CHANGELOG.txt</filename>
    </modified>
    <modified>
      <diff>@@ -5,7 +5,7 @@
 }
 
 /* free up space in fieldsets */
-fieldset.style-select-fieldset, fieldset.style-extensions-fieldset {
+fieldset.style-select-fieldset, fieldset.style-extensions-fieldset, .style-extensions-fieldset fieldset {
   margin: 0px;
   padding: 0.1em;
 }</diff>
      <filename>style.form.css</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,6 @@
 ; $Id:$
 name = Style
-description = Expands the look and feel of modules and themes.
+description = Enables stylesheet overriding for themes
 ;dependencies[] =
 package = Style
 core = 6.x</diff>
      <filename>style.info</filename>
    </modified>
    <modified>
      <diff>@@ -17,30 +17,36 @@
  *  @return
  *    TRUE if styles exist. FALSE if not.
  */
-function style_exists($dir, $refresh = FALSE) {
-  static $exists;
-
-  if ($refresh === FALSE &amp;&amp; isset($exists) &amp;&amp; isset($exists[$dir])) {
-    return $exists[$dir];
+function style_exists($style_dir, $refresh = FALSE) {
+  static $style_exists;
+  
+  // Caching, can be bypased with $refresh being TRUE
+  if ($refresh === FALSE &amp;&amp; isset($style_exists) &amp;&amp; isset($style_exists[$style_dir])) {
+    return $style_exists[$style_dir];
   }
 
-  if ($handle = opendir($dir)) {
+  // Open link with our dir, as $handle
+  if ($handle = opendir($style_dir)) {
+    // Recursive through the items in this directory
     while (FALSE !== ($file = readdir($handle))) {
+      // Is this item a directory?
       if (is_dir($file)) {
-        // Directory (style) found.
-        return $exists[$dir] = TRUE;
+        // We found a style, we can finish.
+        closedir($handle);
+
+        // Return TRUE, a style directory exists
+        return $style_exists[$style_dir] = TRUE;
       }
     }
 
-    // No directorys in styles
-    return $exists[$dir] = FALSE;
-
+    // No directory (styles) found. Let's close link and return FALSE.
     closedir($handle);
+    return $style_exists[$style_dir] = FALSE;
   }
 }
 
 /**
- *  Scan for styles in a directory
+ *  Scan for style folders in style directory
  *
  *  @param string $dir
  *    Directory of the theme or module styles
@@ -52,27 +58,35 @@ function style_exists($dir, $refresh = FALSE) {
 function style_scan($dir, $refresh = FALSE) {
   static $styles;
 
-  if ($refresh !== FALSE &amp;&amp; isset($styles) &amp;&amp; isset($styles[$dir])) {
+  // Caching system. Can be bypassed with refresh
+  if ($refresh === FALSE &amp;&amp; isset($styles) &amp;&amp; isset($styles[$dir])) {
     return $styles[$dir];
   }
 
+  // Open up directory
   if ($handle = opendir($dir)) {
+    // Make array
     $styles[$dir] = array();
-
+    // Scans inside the /style dir of a theme.
+    // Each dir in /style is an individual style
     while (FALSE !== ($file = readdir($handle))) {
+      // PHP will throw up '.' and '..'. No need to include.
       if ($file != &quot;.&quot; &amp;&amp; $file != &quot;..&quot; &amp;&amp; is_dir($dir . $file)) {
+        // Append this style dir to our array of styles
         $styles[$dir][] = $file;
       }
     }
 
-    // No directorys in styles
+    // Finish up
     closedir($handle);
   }
+
+  // Return list of styles as an array
   return $styles[$dir];
 }
 
 /**
- *  Enclosure for style_scan_style_do
+ *  Scan for styles.
  *
  *  @param string $dir
  *    Directory of style
@@ -81,19 +95,20 @@ function style_scan($dir, $refresh = FALSE) {
  *  @return array
  *    Recursive output of files.
  */
-function style_scan_style($dir, $refresh = FALSE) {
+function style_scan_style_files($dir, $refresh = FALSE) {
   static $style;
 
+  // Caching, can be bypassed with $refresh
   if (isset($style[$dir]) &amp;&amp; $refresh !== TRUE) {
     return $style[$dir];
   }
 
-  $style[$dir] = style_scan_style_do($dir);
+  $style[$dir] = _style_scan_style_files($dir);
   return $style[$dir];
 }
 
 /**
- *  Get the structure of a style
+ *  Get the structure and files of a style
  *
  *  @param string $dir
  *    Directory of style
@@ -102,7 +117,7 @@ function style_scan_style($dir, $refresh = FALSE) {
  *  @return array
  *    Recursive output of files.
  */
-function style_scan_style_do($dir, $show_files = TRUE) {
+function _style_scan_style_files($dir, $show_files = TRUE) {
   $d = dir($dir); $x = array();
   while (($r = $d-&gt;read()) !== FALSE) {
     if ($r != &quot;.&quot; &amp;&amp; $r != &quot;..&quot; &amp;&amp; (($show_files == FALSE &amp;&amp; is_dir($dir.$r)) || $show_files == TRUE)) {
@@ -113,7 +128,7 @@ function style_scan_style_do($dir, $show_files = TRUE) {
   }
   foreach ($x as $key =&gt; $value) {
     if (is_dir($dir.$key.&quot;/&quot;)) {
-      $x[$key] = style_scan_style_do($dir.$key.&quot;/&quot;, $show_files);
+      $x[$key] = _style_scan_style_files($dir.$key.&quot;/&quot;, $show_files);
     }
   }
   ksort($x);
@@ -211,19 +226,29 @@ function style_settings_page() {
 }
 
 function style_preprocess_page(&amp;$vars) {
+  // Our variables from Drupal's global scope
   global $theme_key, $theme_info, $base_url;
 
-  if (dir(theme_get_setting('theme_'.$theme_key.'_style'))) {
-      $styles = array();
+  // Get our theme directory
+  $theme_dir = theme_get_setting('theme_'.$theme_key.'_style');
+
+  // Does the directory exist?
+  if (dir($theme_dir)) {
+    // Initiate array 
+    $styles = array();
+
+    // Cycle through our page's stylesheet files, by basename.
     foreach (array_keys($vars['css']['all']['theme']) as $css) {
       $styles[] = basename($css);
     }
   
-    $newcss = style_scan_style(theme_get_setting('theme_'.$theme_key.'_style'));
+    // Grab the CSS files from our style.
+    $newcss = style_scan_style_files($theme_dir);
 
+    // Create an array for new styles
     $new_styles = array();
     foreach (array_keys($newcss) as $css) {
-      $new_styles[] = theme_get_setting('theme_'.$theme_key.'_style') . '/' . $css;
+      $new_styles[] = $theme_dir . '/' . $css;
     }
     $color_paths = $new_styles;
   }
@@ -273,6 +298,7 @@ function style_preprocess_page(&amp;$vars) {
     $vars['styles'] = drupal_get_css($vars['css']);
   }
 
+  // Some logo kung-fu. Replace logo.png at theme base.
   if (file_exists(theme_get_setting('theme_'.$theme_key.'_style') . '/logo.png')) {
     $vars['logo'] = $base_url . '/' . theme_get_setting('theme_'.$theme_key.'_style') . '/logo.png';
   }
@@ -292,25 +318,36 @@ function style_form_alter(&amp;$form, $form_state, $form_id) {
       drupal_set_message(t('The color picker only works if the &lt;a href=&quot;@url&quot;&gt;download method&lt;/a&gt; is set to public.', array('@url' =&gt; url('admin/settings/file-system'))), 'warning');
     }
     else {
+
+      // Via drupal argument (you'll see it in URL), we grab the theme name.
       $theme = arg(4);
       
+      // Grab various information about styles.
       $style_info = style_get_styles('theme', $theme);
 
+      // Separate scheme list
       $style_list = $style_info['list'];
       
+      // If styles are available for theme OR extensions are present in
+      // $form['style']['extensions'], show our style fieldset.
       if (isset($style_list) &amp;&amp; count($style_list) &gt; 0 || count($form['style']['extensions']) &gt; 0) {
-        drupal_add_css(drupal_get_path('module', 'style') .'/style_form.css', 'module', 'all', TRUE);
-          
+
+        // Add our stylesheet to tighten things up
+        drupal_add_css(drupal_get_path('module', 'style') .'/style.form.css', 'module', 'all', TRUE);
+         
+        // Does $form['style'] already exist?
         if (!isset($form['style'])) {
           $form['style'] = array();
         }
+
+        // Take on the ['style'], in case a module is loaded before.
+        // This will assure order is not interfered with.
         $form['style'] += array(
         '#type' =&gt; 'fieldset',
         '#title' =&gt; t('Style'),
-        '#description' =&gt; t('Change the look of your theme.'),
+        '#description' =&gt; t('Change the look and feel your theme.'),
         '#collapsible' =&gt; TRUE,
         '#attributes' =&gt; array('class' =&gt; 'style-select-fieldset'),
-
         '#weight' =&gt; -15,
         );
         
@@ -328,16 +365,18 @@ function style_form_alter(&amp;$form, $form_state, $form_id) {
           );
         }
         else {
+          // Select box of styles
           $form['style']['theme_'.$theme.'_style'] = array(
             '#type' =&gt; 'select',
             '#title' =&gt; t('Default'),
+            // Generated styles have *
             '#description' =&gt; t('* generated style'),
             '#options' =&gt; $style_list,
             '#default_value' =&gt; $value,
-            //'#DANGEROUS_SKIP_CHECK' =&gt; TRUE
-              
-          );
-        }
+           );
+         }             
+
+        // If style extensions have not yet been created, let's make it.
         if (count($form['style']['extensions']) &gt; 0) {
           $form['style']['extensions'] += array(
           '#type' =&gt; 'fieldset',
@@ -351,4 +390,4 @@ function style_form_alter(&amp;$form, $form_state, $form_id) {
     }
   }
 }
-?&gt;
\ No newline at end of file
+?&gt;</diff>
      <filename>style.module</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>b0b4bef9d00a082de471b46f85f8cbd4ca0ff157</id>
    </parent>
  </parents>
  <author>
    <name>Tony Narlock</name>
    <email>kiwi@kiwi.(none)</email>
  </author>
  <url>http://github.com/skiquel/drupal-style/commit/b741bffe5aeb2684a73648304fe4ce0aa3eee3e6</url>
  <id>b741bffe5aeb2684a73648304fe4ce0aa3eee3e6</id>
  <committed-date>2009-01-13T10:35:30-08:00</committed-date>
  <authored-date>2009-01-13T10:35:30-08:00</authored-date>
  <message>beginning color.module support, some code clarity fixes in style</message>
  <tree>708bd8e1e868e0b55bad468cfe09cc1e421a4501</tree>
  <committer>
    <name>Tony Narlock</name>
    <email>kiwi@kiwi.(none)</email>
  </committer>
</commit>
