--- views_slideshow.module	2008-03-26 12:08:46.000000000 +1100
+++ views_slideshow.module.D6	2008-09-11 00:18:36.000000000 +1000
@@ -1,6 +1,11 @@
 <?php
 // $Id: views_slideshow.module,v 1.10 2008/03/26 01:08:46 aaron Exp $
 
+/**
+ * @file
+ * Creates a view type of 'Slideshow' that displays nodes in a jquery slideshow.
+ */
+
 define('VIEWS_SLIDESHOW_MODE_SINGLE_FRAME', 'single_frame');  // this will rotate through all slideshows in a single div element
 define('VIEWS_SLIDESHOW_MODE_THUMBNAIL_HOVER', 'thumbnail_hover');  // this will create thumbnails of all the node teasers, with a mouse-over triggering a larger div full node view
 define('VIEWS_SLIDESHOW_MODE_JCAROUSEL', 'jcarousel');  // this uses the jcarousel jquery plugin, if the jcarousel module is installed
@@ -35,24 +40,69 @@ define('VIEWS_SLIDESHOW_DEFAULT_FADE', T
 define('VIEWS_SLIDESHOW_DEFAULT_TEASERS_LAST', TRUE); // when the mode is thumbnail hover, this determines whether to print the teasers first or second
 
 /**
- * Implement hook_menu
+ * Implementation of hook_menu().
  */
-function views_slideshow_menu($may_cache) {
-  $items = array();
-  if ($may_cache) {
-    $items[] = array(
-      'path' => 'admin/build/views/views_slideshow',
-      'title' => t('Views slideshow configuration'),
-      'description' => t('Configure Views Slideshow: Set global options for slideshow views.'),
-      'callback' => 'drupal_get_form',
-      'callback arguments' => 'views_slideshow_settings',
-      'access' => user_access('administer site configuration'));
-  }
+function views_slideshow_menu() {
+  $items['admin/build/views/views_slideshow'] = array(
+    'title' => 'Views slideshow configuration',
+    'description' => 'Configure Views Slideshow: Set global options for slideshow views.',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('views_slideshow_settings'),
+    'access arguments' => array('administer site configuration'),
+  );
+
   return $items;
 }
 
 /**
- * Implement hook_settings
+ * Implementation of hook_theme().
+ */
+function views_slideshow_theme() {
+  return array(
+    'views_slideshow_view_list' => array(
+      'arguments' => array('view' => NULL, 'nodes' => NULL, 'type' => NULL),
+    ),
+    'views_slideshow_view_teasers' => array(
+      'arguments' => array('view' => NULL, 'nodes' => NULL, 'type' => NULL),
+    ),
+    'views_slideshow_view_nodes' => array(
+      'arguments' => array('view' => NULL, 'nodes' => NULL, 'type' => NULL, 'teasers' => NULL, 'links' => NULL),
+    ),
+    'views_slideshow_slideshow' => array(
+      'arguments' => array('view' => NULL, 'nodes' => NULL, 'type' => NULL, 'items' => NULL),
+    ),
+    'views_slideshow_div_js' => array(
+      'arguments' => array('view' => NULL, 'nodes' => NULL, 'type' => NULL, 'items' => NULL, 'div' => NULL),
+    ),
+    'views_slideshow_main_section' => array(
+      'arguments' => array('view' => NULL, 'nodes' => NULL, 'type' => NULL, 'items' => NULL, 'item' => NULL, 'div' => NULL, 'hidden_elements' => NULL),
+    ),
+    'views_slideshow_no_display_section' => array(
+      'arguments' => array('view' => NULL, 'nodes' => NULL, 'type' => NULL, 'items' => NULL, 'div' => NULL, 'mode' => NULL, 'teaser' => NULL),
+    ),
+    'views_slideshow_no_display_teaser' => array(
+      'arguments' => array('item' => NULL, 'div' => NULL, 'count' => NULL),
+    ),
+    'views_slideshow_breakout_teasers' => array(
+      'arguments' => array('view' => NULL, 'nodes' => NULL, 'type' => NULL, 'items' => NULL, 'div' => NULL),
+    ),
+    'views_slideshow_breakout_teaser_js' => array(
+      'arguments' => array('div' => NULL, 'count' => NULL),
+    ),
+    'views_slideshow_breakout_teaser' => array(
+      'arguments' => array('item' => NULL, 'div' => NULL, 'count' => NULL),
+    ),
+    'views_slideshow_jcarousel' => array(
+      'arguments' => array('items' => NULL, 'div' => NULL, 'skin' => NULL),
+    ),
+    'views_slideshow_jcarousel_js' => array(
+      'arguments' => array('div' => NULL),
+    ),
+  );
+}
+
+/**
+ * Implementation of hook_settings().
  */
 function views_slideshow_settings() {
   if (!module_exists('hoverintent')) {
@@ -145,8 +195,8 @@ function views_slideshow_settings() {
   $form['helpfield'] = array(
     '#type' => 'fieldset',
     '#title' => t('Individual view slideshow configuration'),
-    '#collapsible' => true,
-    '#collapsed' => true,
+    '#collapsible' => TRUE,
+    '#collapsed' => TRUE,
   );
   $form['helpfield']['help'] = array(
     '#type' => 'item',
@@ -159,9 +209,9 @@ function views_slideshow_settings() {
       <ul>
         <li>$view->slideshow[\'mode\']
         <ul>
-          <li>VIEWS_SLIDESHOW_MODE_SINGLE_FRAME (\'' . VIEWS_SLIDESHOW_MODE_SINGLE_FRAME . '\'):
+          <li>VIEWS_SLIDESHOW_MODE_SINGLE_FRAME (\''. VIEWS_SLIDESHOW_MODE_SINGLE_FRAME .'\'):
             the slideshow will be displayed in single frame mode
-          <li>VIEWS_SLIDESHOW_MODE_THUMBNAIL_HOVER (\'' . VIEWS_SLIDESHOW_MODE_THUMBNAIL_HOVER . '\'):
+          <li>VIEWS_SLIDESHOW_MODE_THUMBNAIL_HOVER (\''. VIEWS_SLIDESHOW_MODE_THUMBNAIL_HOVER .'\'):
             the slideshow will be displayed in thumbnail hover mode
         </ul>
         <li>$view->slideshow[\'teasers_last\']
@@ -175,9 +225,9 @@ function views_slideshow_settings() {
         </ul>
         <li>$view->slideshow[\'sort_order\']
         <ul>
-          <li>VIEWS_SLIDESHOW_SORT_REVERSE (' . VIEWS_SLIDESHOW_SORT_REVERSE . '): reverse order
-          <li>VIEWS_SLIDESHOW_SORT_RANDOM (' . VIEWS_SLIDESHOW_SORT_RANDOM . '): random order
-          <li>VIEWS_SLIDESHOW_SORT_FORWARD (' . VIEWS_SLIDESHOW_SORT_FORWARD . '): forward order
+          <li>VIEWS_SLIDESHOW_SORT_REVERSE ('. VIEWS_SLIDESHOW_SORT_REVERSE .'): reverse order
+          <li>VIEWS_SLIDESHOW_SORT_RANDOM ('. VIEWS_SLIDESHOW_SORT_RANDOM .'): random order
+          <li>VIEWS_SLIDESHOW_SORT_FORWARD ('. VIEWS_SLIDESHOW_SORT_FORWARD .'): forward order
         </ul>
         <li>$view->slideshow[\'fade\']
         <ul>
@@ -185,9 +235,9 @@ function views_slideshow_settings() {
         </ul>
         <li>$view->slideshow[\'fade_speed\']
         <ul>
-          <li>VIEWS_SLIDESHOW_FADE_SPEED_SLOW (\'' . VIEWS_SLIDESHOW_FADE_SPEED_SLOW . '\')
-          <li>VIEWS_SLIDESHOW_FADE_SPEED_NORMAL (\'' . VIEWS_SLIDESHOW_FADE_SPEED_NORMAL . '\')
-          <li>VIEWS_SLIDESHOW_FADE_SPEED_FAST (\'' . VIEWS_SLIDESHOW_FADE_SPEED_FAST . '\')
+          <li>VIEWS_SLIDESHOW_FADE_SPEED_SLOW (\''. VIEWS_SLIDESHOW_FADE_SPEED_SLOW .'\')
+          <li>VIEWS_SLIDESHOW_FADE_SPEED_NORMAL (\''. VIEWS_SLIDESHOW_FADE_SPEED_NORMAL .'\')
+          <li>VIEWS_SLIDESHOW_FADE_SPEED_FAST (\''. VIEWS_SLIDESHOW_FADE_SPEED_FAST .'\')
         </ul>
         <li>$view->slideshow[\'fade_value\']
         <ul>
@@ -199,7 +249,7 @@ function views_slideshow_settings() {
 }
 
 /**
- * Slideshow View style plugins. Implementation of hook_views_style_plugins()
+ * Slideshow View style plugins. Implementation of hook_views_style_plugins().
  */
 function views_slideshow_views_style_plugins() {
   return array(
@@ -207,7 +257,7 @@ function views_slideshow_views_style_plu
       'name' => t('Slideshow List'),
       'theme' => 'views_slideshow_view_list',
       'validate' => 'views_slideshow_plugin_validate_list',
-      'needs_fields' => true,
+      'needs_fields' => TRUE,
     ),
     'slideshow_teaser' => array(
       'name' => t('Slideshow Teasers'),
@@ -240,9 +290,9 @@ function theme_views_slideshow_view_list
     foreach ($view->field as $field) {
       if ($fields[$field['id']]['visible'] !== FALSE) {
         if ($field['label']) {
-          $item .= "<div class='view-label ". views_css_safe('view-label-'. $field['queryname']) ."'>" . $field['label'] . "</div>";
+          $item .= "<div class='view-label ". views_css_safe('view-label-'. $field['queryname']) ."'>". $field['label'] ."</div>";
         }
-        $item .= "<div class='view-field ". views_css_safe('view-data-'. $field['queryname']) ."'>" . views_theme_field('views_handle_field', $field['queryname'], $fields, $field, $node, $view) . "</div>";
+        $item .= "<div class='view-field ". views_css_safe('view-data-'. $field['queryname']) ."'>". views_theme_field('views_handle_field', $field['queryname'], $fields, $field, $node, $view) ."</div>";
       }
     }
     $items[] = "<div class='view-item ". views_css_safe('view-item-'. $view->name) ."'>$item</div>\n"; // l($node->title, "node/$node->nid");
@@ -254,17 +304,17 @@ function theme_views_slideshow_view_list
  * Display the nodes of a view as teasers.
  */
 function theme_views_slideshow_view_teasers($view, $nodes, $type) {
-  return theme('views_slideshow_view_nodes', $view, $nodes, $type, true);
+  return theme('views_slideshow_view_nodes', $view, $nodes, $type, TRUE);
 }
 
 /**
  * Display the nodes of a view as plain nodes.
  */
-function theme_views_slideshow_view_nodes($view, $nodes, $type, $teasers = false, $links = true) {
+function theme_views_slideshow_view_nodes($view, $nodes, $type, $teasers = FALSE, $links = TRUE) {
   $items = array();
   foreach ($nodes as $n) {
     $node = node_load($n->nid);
-    $items[] = node_view($node, $teasers, false, $links);
+    $items[] = node_view($node, $teasers, FALSE, $links);
   }
   return theme('views_slideshow_slideshow', $view, $nodes, $type, $items);
 }
@@ -287,8 +337,8 @@ function theme_views_slideshow_slideshow
     // only add the js file the first time a slideshow is presented. if multiple slideshows are displayed, they all use the same js.
     else if (!$added_js) {
       $base = drupal_get_path('module', 'views_slideshow');
-      drupal_add_js($base . '/js/views_slideshow.js', 'module');
-      drupal_add_css($base . '/views_slideshow.css', 'module');
+      drupal_add_js($base .'/js/views_slideshow.js', 'module');
+      drupal_add_css($base .'/views_slideshow.css', 'module');
       $added_js = TRUE;
     }
 
@@ -340,7 +390,7 @@ function theme_views_slideshow_slideshow
  *  this inline js sets up the timer for this slideshow
  */
 function theme_views_slideshow_div_js($view, $nodes, $type, $items, $div) {
-  $divs = '"' . implode('", "', array_keys($items)) . '"';
+  $divs = '"'. implode('", "', array_keys($items)) .'"';
   $num_divs = sizeof($items);
   $timer_delay = isset($view->slideshow['timer_delay']) ? $view->slideshow['timer_delay'] : variable_get('views_slideshow_default_timer_delay', VIEWS_SLIDESHOW_DEFAULT_TIMER_DELAY);
   $sort = isset($view->slideshow['sort_order']) ? $view->slideshow['sort_order'] : variable_get('views_slideshow_default_sort_order', VIEWS_SLIDESHOW_DEFAULT_SORT_ORDER);
@@ -353,18 +403,18 @@ function theme_views_slideshow_div_js($v
 // set the timer data for a view slideshow
 $(document).ready(function() {
   // these are the divs containing the elements to be displayed in the main div in rotation or mouseover
-  slideshow_data["' . $div . '"] = new views_slideshow_data(' . $num_divs . ', ' . $timer_delay . ', ' . $sort . ', ' . $fade . ', "' . $fade_speed . '", ' . $fade_value . ');
+  slideshow_data["'. $div .'"] = new views_slideshow_data('. $num_divs .', '. $timer_delay .', '. $sort .', '. $fade .', "'. $fade_speed .'", '. $fade_value .');
 
   // this turns on the timer
-  views_slideshow_timer("' . $div . '", true);
+  views_slideshow_timer("'. $div .'", true);
 
   // this sets up the mouseover & mouseout to pause on the main element
-  $("#views_slideshow_main_' . $div . '").' . $hover . '(
+  $("#views_slideshow_main_'. $div .'").'. $hover .'(
     function() {
-      views_slideshow_pause("' . $div . '");
+      views_slideshow_pause("'. $div .'");
     },
     function() {
-      views_slideshow_resume("' . $div . '");
+      views_slideshow_resume("'. $div .'");
     });
 });
 ';
@@ -375,10 +425,10 @@ $(document).ready(function() {
  *  this displays the main element, where the current slide is shown
  */
 function theme_views_slideshow_main_section($view, $nodes, $type, $items, $item, $div, $hidden_elements) {
-  $output .= "\n\n" . '<div id="views_slideshow_main_' . $div . '" class="views_slideshow_main">' . "\n  ";
+  $output .= "\n\n".'<div id="views_slideshow_main_'. $div .'" class="views_slideshow_main">'."\n  ";
 //   $output .= $item . "\n";
   $output .= $hidden_elements;
-  $output .= '</div><!--close views_slideshow_main_' . $div . "-->\n\n";
+  $output .= '</div><!--close views_slideshow_main_'. $div ."-->\n\n";
   return $output;
 }
 
@@ -386,7 +436,7 @@ function theme_views_slideshow_main_sect
  *  these are the slideshow elements themselves; not actually displayed, but used to give the html to the main element
  */
 function theme_views_slideshow_no_display_section($view, $nodes, $type, $items, $div, $mode, $teaser = TRUE) {
-  $output .= '<div id="views_slideshow_teaser_section_' . $div . '" class="views_slideshow_teaser_section">' . "\n";
+  $output .= '<div id="views_slideshow_teaser_section_'. $div .'" class="views_slideshow_teaser_section">'."\n";
   if ($mode == VIEWS_SLIDESHOW_MODE_THUMBNAIL_HOVER) {
     foreach ($nodes as $count => $node) {
       $output .= theme('views_slideshow_no_display_teaser', node_view(node_load($node->nid), $teaser, FALSE, FALSE), $div, $count);
@@ -406,9 +456,9 @@ function theme_views_slideshow_no_displa
  */
 function theme_views_slideshow_no_display_teaser($item, $div, $count) {
   $hidden = $count ? 'class="views_slideshow_hidden"' : '';
-  $output .= '  <div id="views_slideshow_div_' . $div . '_' . $count . '" '. $hidden .'>' . "\n  ";
-  $output .= $item . "\n";
-  $output .= '  </div><!--close views_slideshow_div_' . $div . '_' . $count . '-->' . "\n\n";
+  $output .= '  <div id="views_slideshow_div_'. $div .'_'. $count .'" '. $hidden .'>'."\n  ";
+  $output .= $item ."\n";
+  $output .= '  </div><!--close views_slideshow_div_'. $div .'_'. $count .'-->'."\n\n";
   return $output;
 }
 
@@ -416,7 +466,7 @@ function theme_views_slideshow_no_displa
  *  these are teasers that may be pointed at with a mouse to change the element directly
  */
 function theme_views_slideshow_breakout_teasers($view, $nodes, $type, $items, $div) {
-  $output .= '<div id="views_slideshow_breakout_teasers_' . $div . '" class="views_slideshow_breakout_teasers">' . "\n";
+  $output .= '<div id="views_slideshow_breakout_teasers_'. $div .'" class="views_slideshow_breakout_teasers">'."\n";
   $js = "$(document).ready(function() {\n";
   foreach ($items as $count => $item) {
     $output .= theme('views_slideshow_breakout_teaser', $item, $div, $count);
@@ -438,13 +488,13 @@ function theme_views_slideshow_breakout_
   $hover = (module_invoke('jq', 'add', 'hoverIntent')) ? 'hoverIntent' : 'hover';
 
   $js .= '
-  $("#views_slideshow_div_breakout_teaser_' . $div . '_' . $count . '").' . $hover . '(
+  $("#views_slideshow_div_breakout_teaser_'. $div .'_'. $count .'").'. $hover .'(
     function() {
-      views_slideshow_switch("' . $div . '", ' . $count . ');
-      views_slideshow_pause("' . $div . '");
+      views_slideshow_switch("'. $div .'", '. $count .');
+      views_slideshow_pause("'. $div .'");
     },
     function() {
-      views_slideshow_resume("' . $div . '");
+      views_slideshow_resume("'. $div .'");
    });
 ';
   return $js;
@@ -455,9 +505,9 @@ function theme_views_slideshow_breakout_
  */
 function theme_views_slideshow_breakout_teaser($item, $div, $count) {
   $class = $count ? '' : ' views_slideshow_active_teaser';
-  $output .= '  <div id="views_slideshow_div_breakout_teaser_' . $div . '_' . $count . '" class="views_slideshow_div_breakout_teaser' . $class . '">' . "\n  ";
-  $output .= $item . "\n";
-  $output .= '  </div><!--close views_slideshow_div_breakout_teaser_' . $div . '_' . $count . '-->' . "\n\n";
+  $output .= '  <div id="views_slideshow_div_breakout_teaser_'. $div .'_'. $count .'" class="views_slideshow_div_breakout_teaser'. $class .'">'."\n  ";
+  $output .= $item ."\n";
+  $output .= '  </div><!--close views_slideshow_div_breakout_teaser_'. $div .'_'. $count .'-->'."\n\n";
   return $output;
 }
 
@@ -466,7 +516,7 @@ function theme_views_slideshow_jcarousel
     if (!isset($skin)) {
       $skin = variable_get('views_slideshow_jcarousel_skin', VIEWS_SLIDESHOW_JCAROUSEL_SKIN_DEFAULT);
     }
-    $output .= "\n" . '<ul id="views_slideshow_jcarousel_' . $div . '" class="jcarousel-skin-' . $skin . '">' . "\n";
+    $output .= "\n".'<ul id="views_slideshow_jcarousel_'. $div .'" class="jcarousel-skin-'. $skin .'">'."\n";
     $output .= '  <li>';
     $output .= implode("</li>\n\n  <li>", $items);
     $output .= "</li></ul>\n";
