Index: imagecache.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/imagecache/imagecache.install,v
retrieving revision 1.25
diff -u -p -r1.25 imagecache.install
--- imagecache.install	6 Jan 2009 19:48:59 -0000	1.25
+++ imagecache.install	11 Feb 2009 14:46:14 -0000
@@ -1,6 +1,14 @@
 <?php
 // $Id: imagecache.install,v 1.25 2009/01/06 19:48:59 drewish Exp $
 
+/**
+ * @file
+ *  Install hooks, schema defitions and update hooks.
+ */
+
+/**
+ * Implementation of hook_requirements().
+ */
  function imagecache_requirements($phase) {
   $requirements = array();
   // Ensure translations don't break at install time.
@@ -45,6 +53,9 @@
   return $requirements;
 }
 
+/**
+ * Implementation of hook_schema().
+ */
 function imagecache_schema() {
     $schema['imagecache_preset'] = array(
     'fields' => array(
@@ -129,14 +140,18 @@ function imagecache_uninstall() {
   drupal_uninstall_schema('imagecache');
 }
 
-// Add action id to actions table.
+/**
+ * Add action id to actions table.
+ */
 function imagecache_update_1() {
   $ret = array();
   $ret[] = update_sql('ALTER TABLE {imagecache_actions} ADD COLUMN actionid INT UNSIGNED NOT NULL  primary key auto_increment');
   return $ret;
 }
 
-// Rename rulesets to presets; Make all table names singular;
+/**
+ * Rename rulesets to presets. Make all table names singular.
+ */
 function imagecache_update_2() {
   $ret = array();
   $ret[] = update_sql('ALTER TABLE {imagecache_rulesets} RENAME TO {imagecache_preset}');
@@ -190,6 +205,11 @@ function imagecache_update_3() {
   return $ret;
 }
 
+/**
+ * Follow schema change
+ *
+ * @return unknown
+ */
 function imagecache_update_4() {
   $ret = array();
 
@@ -235,8 +255,10 @@ function imagecache_update_4() {
   return $ret;
 }
 
+/**
+ * Enables image API.
+ */
 function imagecache_update_5() {
-  // enable image API.
   module_rebuild_cache(); // make sure new modules are in the system table.
   module_enable(array('imageapi', 'imageapi_gd', 'imageapi_imagemagick')); // enable our new module.
 
Index: imagecache.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/imagecache/imagecache.module,v
retrieving revision 1.97
diff -u -p -r1.97 imagecache.module
--- imagecache.module	6 Feb 2009 11:43:45 -0000	1.97
+++ imagecache.module	11 Feb 2009 14:46:14 -0000
@@ -30,11 +30,6 @@
  *
  */
 
-
-/*********************************************************************************************
- * Drupal Hooks
- *********************************************************************************************/
-
 /**
  * Implementation of hook_perm().
  */
@@ -68,7 +63,6 @@ function imagecache_menu() {
   return $items;
 }
 
-
 /**
  * Implementation of hook_theme().
  */
@@ -150,7 +144,7 @@ function imagecache_theme() {
 }
 
 /**
- * Implementation of hook_imagecache_actions.
+ * Implementation of hook_imagecache_actions().
  *
  * @return array
  *   An array of information on the actions implemented by a module. The array
@@ -210,7 +204,7 @@ function imagecache_imagecache_actions()
 }
 
 /**
- * Pull in actions exposed by other modules using hook_imagecache_actions().
+ * Pulls in actions exposed by other modules using hook_imagecache_actions().
  *
  * @param $reset
  *   Boolean flag indicating whether the cached data should be
@@ -219,7 +213,7 @@ function imagecache_imagecache_actions()
  * @return
  *   An array of actions to be used when transforming images.
  */
-function imagecache_action_definitions($reset = false) {
+function imagecache_action_definitions($reset = TRUE) {
   static $actions;
   if (!isset($actions) || $reset) {
     if (!$reset && ($cache = cache_get('imagecache_actions')) && !empty($cache->data)) {
@@ -242,15 +236,15 @@ function imagecache_action_definitions($
   return $actions;
 }
 
-function _imagecache_definitions_sort($a, $b) {
-  $a = $a['name'];
-  $b = $b['name'];
-  if ($a == $b) {
-    return 0;
-  }
-  return ($a < $b) ? -1 : 1;
-}
-
+/**
+ * Gets one action.
+ *
+ * @param $action
+ *   Name of the action.
+ *
+ * @return
+ *   An array of actions to be used when transforming images.
+ */
 function imagecache_action_definition($action) {
   static $definition_cache;
   if (!isset($definition_cache[$action])) {
@@ -266,7 +260,7 @@ function imagecache_action_definition($a
 }
 
 /**
- * Return a URL that points to the location of a derivative of the
+ * Returns a URL that points to the location of a derivative of the
  * original image at @p $path, transformed with the given @p $preset.
  *
  * Special care is taken to make this work with the possible combinations of
@@ -284,7 +278,7 @@ function imagecache_create_url($presetna
 }
 
 /**
- * Return a file system location that points to the location of a derivative
+ * Returns a file system location that points to the location of a derivative
  * of the original image at @p $path, transformed with the given @p $preset.
  * Keep in mind that the image might not yet exist and won't be created.
  */
@@ -294,7 +288,7 @@ function imagecache_create_path($presetn
 }
 
 /**
- * Remove a possible leading file directory path from the given path.
+ * Removes a possible leading file directory path from the given path.
  */
 function _imagecache_strip_file_directory($path) {
   $dirpath = file_directory_path();
@@ -307,7 +301,7 @@ function _imagecache_strip_file_director
 
 
 /**
- * callback for handling public files imagecache requests.
+ * Callback for handling public files imagecache requests.
  */
 function imagecache_cache() {
   $args = func_get_args();
@@ -317,7 +311,7 @@ function imagecache_cache() {
 }
 
 /**
- * callback for handling private files imagecache requests
+ * Callback for handling private files imagecache requests.
  */
 function imagecache_cache_private() {
   $args = func_get_args();
@@ -340,7 +334,7 @@ function imagecache_cache_private() {
 }
 
 /**
- * handle request validation and responses to imagecache requests.
+ * Handles request validation and responses to imagecache requests.
  */
 function _imagecache_cache($presetname, $path) {
   if (!$preset = imagecache_preset_by_name($presetname)) {
@@ -397,7 +391,7 @@ function _imagecache_cache($presetname, 
 }
 
 /**
- * Apply an action to an image.
+ * Applies an action to an image.
  *
  * @param $action
  *   Action array
@@ -417,15 +411,17 @@ function _imagecache_apply_action($actio
   }
   // skip undefined actions.. module probably got uninstalled or disabled.
   watchdog('imagecache', 'non-existant action %action', array('%action' => $action['action']), WATCHDOG_NOTICE);
-  return true;
+  return TRUE;
 }
 
 /**
- * helper function to transfer files from imagecache. Determines mime type and sets a last modified header.
- * @param $path path to file to be transferred.
- * @return <exit>
+ * Helper function to transfer files from imagecache. Determines mime type and sets a last modified header.
+ * 
+ * @param $path
+ *   Path to file to be transferred.
+ * @return
+ *   <exit>
  */
-
 function imagecache_transfer($path) {
   $size = getimagesize($path);
   $headers = array('Content-Type: '. mime_header_encode($size['mime']));
@@ -439,7 +435,7 @@ function imagecache_transfer($path) {
 }
 
 /**
- * Set file headers that handle "If-Modified-Since" correctly for the
+ * Sets file headers that handle "If-Modified-Since" correctly for the
  * given fileinfo. Most code has been taken from drupal_page_cache_header().
  */
 function _imagecache_cache_set_cache_headers($fileinfo, &$headers) {
@@ -450,10 +446,10 @@ function _imagecache_cache_set_cache_hea
   // See if the client has provided the required HTTP headers:
   $if_modified_since = isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])
                         ? stripslashes($_SERVER['HTTP_IF_MODIFIED_SINCE'])
-                        : false;
+                        : FALSE;
   $if_none_match = isset($_SERVER['HTTP_IF_NONE_MATCH'])
                     ? stripslashes($_SERVER['HTTP_IF_NONE_MATCH'])
-                    : false;
+                    : FALSE;
 
   if ($if_modified_since && $if_none_match
       && $if_none_match == $etag // etag must match
@@ -474,10 +470,12 @@ function _imagecache_cache_set_cache_hea
 }
 
 /**
- * build an image cache derivative
+ * Builds an image cache derivative.
  *
- * @param $actions  Array of imagecache actions.
- * @param $src      Path of the source file.
+ * @param $actions
+ *   Array of imagecache actions.
+ * @param $src
+ *   Path of the source file.
  * @param $dst      Path of the destination file.
  * @param $tmp      Path of the temporary file used for manipulating the image.
  * @return true - derivative generated, false - no derivative generated, null - derivative being generated
@@ -487,9 +485,9 @@ function imagecache_build_derivative($ac
   $dir = dirname($dst);
 
   // Build the destination folder tree if it doesn't already exists.
-  if (!file_check_directory($dir, FILE_CREATE_DIRECTORY) && !mkdir($dir, 0775, true)) {
+  if (!file_check_directory($dir, FILE_CREATE_DIRECTORY) && !mkdir($dir, 0775, TRUE)) {
     watchdog('imagecache', 'Failed to create imagecache directory: %dir', array('%dir' => $dir), WATCHDOG_ERROR);
-    return false;
+    return FALSE;
   }
 
   // Simply copy the file if there are no actions.
@@ -498,7 +496,7 @@ function imagecache_build_derivative($ac
   }
 
   if (!$image = imageapi_image_open($src)) {
-    return false;
+    return FALSE;
   }
 
   foreach ($actions as $action) {
@@ -516,7 +514,7 @@ function imagecache_build_derivative($ac
     }
     if (!_imagecache_apply_action($action, $image)) {
       watchdog('imagecache', 'action(id:%id): %action failed for %src', array('%id' => $action['actionid'], '%action' => $action['action'], '%src' => $src), WATCHDOG_ERROR);
-      return false;
+      return FALSE;
     }
   }
 
@@ -524,10 +522,10 @@ function imagecache_build_derivative($ac
     if (file_exists($dst)) {
       watchdog('imagecache', 'Cached image file %dst already exists. There may be an issue with your rewrite configuration.', array('%dst' => $dst), WATCHDOG_ERROR);
     }
-    return false;
+    return FALSE;
   }
 
-  return true;
+  return TRUE;
 }
 
 /**
@@ -593,6 +591,11 @@ function imagecache_field_formatter_info
   return $formatters;
 }
 
+/**
+ * Imagecache item field.
+ * 
+ * @ingroup themeable
+ */
 function theme_imagecache_formatter($element) {
   if (isset($element['#item']['nid']) && $node = node_load($element['#item']['nid'])) {
     return imagecache_field_formatter($element['#field_name'], $element['#item'], $element['#formatter'], $node);
@@ -626,12 +629,12 @@ function imagecache_field_formatter($fie
     switch ($style) {
       case 'linked':
         $imagetag = theme('imagecache', $presetname, $item['filepath'], $alt, $title);
-        return l($imagetag, 'node/'. $node->nid, array('attributes' => array('class' => $class), 'html' => true));
+        return l($imagetag, 'node/'. $node->nid, array('attributes' => array('class' => $class), 'html' => TRUE));
 
       case 'imagelink':
         $original_image_url = file_create_url($item['filepath']);
         $imagetag =  theme('imagecache', $presetname, $item['filepath'], $alt, $title);
-        return l($imagetag, $original_image_url, array('attributes' => array('class' => $class), 'html' => true));
+        return l($imagetag, $original_image_url, array('attributes' => array('class' => $class), 'html' => TRUE));
 
       case 'url':
         return imagecache_create_url($presetname, $item['filepath']);
@@ -647,10 +650,10 @@ function imagecache_field_formatter($fie
 }
 
 /**
- * Filter key word values such as 'top', 'right', 'center', and also percentages.
+ * Filters key word values such as 'top', 'right', 'center', and also percentages.
  * All returned values are in pixels relative to the passed in height and width.
  */
-function _imagecache_filter($key, $value, $current_width, $current_height, $new_width = null, $new_height = null) {
+function _imagecache_filter($key, $value, $current_width, $current_height, $new_width = NULL, $new_height = NULL) {
   switch ($key) {
     case 'width':
       $value = _imagecache_percent_filter($value, $current_width);
@@ -672,7 +675,7 @@ function _imagecache_filter($key, $value
  * Accept a percentage and return it in pixels.
  */
 function _imagecache_percent_filter($value, $current_pixels) {
-  if (strpos($value, '%') !== false) {
+  if (strpos($value, '%') !== FALSE) {
     $value = str_replace('%', '', $value) * 0.01 * $current_pixels;
   }
   return $value;
@@ -699,7 +702,7 @@ function _imagecache_keyword_filter($val
 }
 
 /**
- * Recursively delete all files and folders in the specified filepath, then
+ * Recursively deletes all files and folders in the specified filepath, then
  * delete the containing folder.
  *
  * Note that this only deletes visible files with write permission.
@@ -713,7 +716,7 @@ function _imagecache_recursive_delete($p
   }
   elseif (is_dir($path)) {
     $d = dir($path);
-    while (($entry = $d->read()) !== false) {
+    while (($entry = $d->read()) !== FALSE) {
       if ($entry == '.' || $entry == '..') continue;
       $entry_path = $path .'/'. $entry;
       _imagecache_recursive_delete($entry_path);
@@ -723,13 +726,15 @@ function _imagecache_recursive_delete($p
   }
   else {
     watchdog('imagecache', 'Unknown file type(%path) stat: %stat ',
-              array('%path' => $path,  '%stat' => print_r(stat($path),1)), WATCHDOG_ERROR);
+              array('%path' => $path, '%stat' => print_r(stat($path), 1)), WATCHDOG_ERROR);
   }
 
 }
 
 /**
  * Create and image tag for an imagecache derivative
+ * 
+ * @ingroup themeable
  *
  * @param $namespace
  *   presetname of the derivative you wish to generate a tag for.
@@ -758,24 +763,31 @@ function theme_imagecache($namespace, $p
   return '<img src="'. $imagecache_url .'" alt="'. check_plain($alt) .'" title="'. check_plain($title) .'" '. $attributes .' />';
 }
 
+/**
+ * Creates a link to the original image
+ *
+ * @ingroup themeable
+ */
 function theme_imagecache_imagelink($namespace, $path, $alt = '', $title = '', $attributes = NULL) {
   $image = theme('imagecache', $namespace, $path, $alt, $title);
   $original_image_url = file_create_url($path);
   return l($image, $original_image_url, array('absolute' => FALSE, 'html' => TRUE));
 }
 
-
-/************************************************************************************
- * ImageCache action implementation example in module.
+/**
+ * ImageCache action implementation example.
  */
 function imagecache_resize_image(&$image, $data) {
   if (!imageapi_image_resize($image, $data['width'], $data['height'])) {
     watchdog('imagecache', 'imagecache_resize_image failed. image: %image, data: %data.', array('%path' => $image, '%data' => print_r($data, TRUE)), WATCHDOG_ERROR);
-    return false;
+    return FALSE;
   }
-  return true;
+  return TRUE;
 }
 
+/**
+ * ImageCache action implementation example.
+ */
 function imagecache_resize_form($action) {
   $form['width'] = array(
     '#type' => 'textfield',
@@ -792,24 +804,17 @@ function imagecache_resize_form($action)
   return $form;
 }
 
+/**
+ * ImageCache action implementation example.
+ */
 function theme_imagecache_resize($element) {
   $data = $element['#value'];
   return 'width: '. $data['width'] .', height: '. $data['height'];
 }
 
-
-
-/**
- *  ImageCache 2.x API
- *
- *  The API for imagecache has changed.  The 2.x API returns more structured
- *  data, has shorter function names, and implements more aggressive metadata
- *  caching.
- *
- */
-
 /**
- * Get an array of all presets and their settings.
+ * Gets an array of all presets and their settings.
+ * ImageCache 2.x API
  *
  * @param reset
  *   if set to true it will clear the preset cache
@@ -817,7 +822,7 @@ function theme_imagecache_resize($elemen
  * @return
  *   array of presets array( $preset_id => array('presetid' => integer, 'presetname' => string))
  */
-function imagecache_presets($reset = false) {
+function imagecache_presets($reset = FALSE) {
   static $presets = array();
 
   // Clear  caches if $reset is true;
@@ -852,7 +857,8 @@ function imagecache_presets($reset = fal
 }
 
 /**
- * Load a preset by preset_id.
+ * Loads a preset by preset_id.
+ * ImageCache 2.x API
  *
  * @param preset_id
  *   The numeric id of a preset.
@@ -861,13 +867,14 @@ function imagecache_presets($reset = fal
  *   preset array( 'presetname' => string, 'presetid' => integet)
  *   empty array if preset_id is an invalid preset
  */
-function imagecache_preset($preset_id, $reset = false) {
+function imagecache_preset($preset_id, $reset = FALSE) {
   $presets = imagecache_presets($reset);
   return (isset($presets[$preset_id])) ? $presets[$preset_id] : array();
 }
 
 /**
- * Load a preset by name.
+ * Loads a preset by name.
+ * ImageCache 2.x API
  *
  * @param preset_name
  *
@@ -875,7 +882,6 @@ function imagecache_preset($preset_id, $
  *   preset array( 'presetname' => string, 'presetid' => integer)
  *   empty array if preset_name is an invalid preset
  */
-
 function imagecache_preset_by_name($preset_name) {
   static $presets_by_name = array();
   if (!$presets_by_name &&  $presets = imagecache_presets()) {
@@ -888,6 +894,7 @@ function imagecache_preset_by_name($pres
 
 /**
  * Save an ImageCache preset.
+ * ImageCache 2.x API
  *
  * @param preset
  *   an imagecache preset array.
@@ -905,7 +912,7 @@ function imagecache_preset_save($preset)
 
   // Reset presets cache.
   imagecache_preset_flush($preset);
-  imagecache_presets(true);
+  imagecache_presets(TRUE);
 
   // Rebuild Theme Registry
   drupal_rebuild_theme_registry();
@@ -913,15 +920,35 @@ function imagecache_preset_save($preset)
   return $preset;
 }
 
+/**
+ * Deletes an ImageCache preset.
+ * ImageCache 2.x API
+ *
+ * @param $preset
+ *   an imagecache preset array.
+ * @return
+ *   boolean about the success
+ */
 function imagecache_preset_delete($preset) {
   imagecache_preset_flush($preset['presetid']);
   db_query('DELETE FROM {imagecache_action} where presetid = %d', $preset['presetid']);
   db_query('DELETE FROM {imagecache_preset} where presetid = %d', $preset['presetid']);
-  imagecache_presets(true);
-  return true;
+  imagecache_presets(TRUE);
+  return TRUE;
 }
 
-function imagecache_preset_actions($preset, $reset = false) {
+/**
+ * Gets action for a preset.
+ * ImageCache 2.x API
+ *
+ * @param $preset
+ *   A preset id.
+ * @param $reset
+ *   If set to logical TRUE, cache is flushed.
+ * @return
+ *   Array of actions
+ */
+function imagecache_preset_actions($preset, $reset = FALSE) {
   static $actions_cache = array();
 
   if ($reset || empty($actions_cache[$preset['presetid']])) {
@@ -936,8 +963,10 @@ function imagecache_preset_actions($pres
 }
 
 /**
- * Flush cached media for a preset.
- * @param id
+ * Flushes cached media for a preset.
+ * ImageCache 2.x API
+ * 
+ * @param $preset
  *   A preset id.
  */
 function imagecache_preset_flush($preset) {
@@ -950,7 +979,9 @@ function imagecache_preset_flush($preset
 }
 
 /**
- * Clear cached versions of a specific file in all presets.
+ * Clears cached versions of a specific file in all presets.
+ * ImageCache 2.x API
+ * 
  * @param $path
  *   The Drupal file path to the original image.
  */
@@ -960,6 +991,14 @@ function imagecache_image_flush($path) {
   }
 }
 
+/**
+ * Gets the given action
+ *
+ * @param $actionid
+ *   An action id
+ * @return
+ *   The full action array
+ */
 function imagecache_action($actionid) {
   static $actions;
 
@@ -979,10 +1018,26 @@ function imagecache_action($actionid) {
   return $actions[$actionid];
 }
 
+/**
+ * Gets the given action
+ *
+ * @param $actionid
+ *   An action id
+ * @return
+ *   The full action array
+ */
 function imagecache_action_load($actionid) {
   return imagecache_action($actionid, TRUE);
 }
 
+/**
+ * Saves the action
+ *
+ * @param $action
+ *   The full action array
+ * @return
+ *   The saved action
+ */
 function imagecache_action_save($action) {
   $definition = imagecache_action_definition($action['action']);
   $action = array_merge($definition, $action);
@@ -995,13 +1050,31 @@ function imagecache_action_save($action)
   }
   $preset = imagecache_preset($action['presetid']);
   imagecache_preset_flush($preset);
-  imagecache_presets(true);
+  imagecache_presets(TRUE);
   return $action;
 }
 
+/**
+ * Deletes the action.
+ *
+ * @param $action
+ *   The action array (['actionid'] is required)
+ */
 function imagecache_action_delete($action) {
   db_query('DELETE FROM {imagecache_action} WHERE actionid=%d', $action['actionid']);
   $preset = imagecache_preset($action['presetid']);
   imagecache_preset_flush($preset);
-  imagecache_presets(true);
+  imagecache_presets(TRUE);
+}
+
+/**
+ * Custom sort function, @see imagecache_action_definitions() for usage.
+ */
+function _imagecache_definitions_sort($a, $b) {
+  $a = $a['name'];
+  $b = $b['name'];
+  if ($a == $b) {
+    return 0;
+  }
+  return ($a < $b) ? -1 : 1;
 }
Index: imagecache_actions.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/imagecache/imagecache_actions.inc,v
retrieving revision 1.19
diff -u -p -r1.19 imagecache_actions.inc
--- imagecache_actions.inc	6 Feb 2009 11:41:27 -0000	1.19
+++ imagecache_actions.inc	11 Feb 2009 14:46:14 -0000
@@ -15,21 +15,36 @@ function imagecache_scale_form($data) {
   return $form;
 }
 
+/**
+ * Upscaling widget
+ * 
+ * @ingroup themeable
+ */
 function theme_imagecache_scale($element) {
   $output = theme_imagecache_resize($element) .  ', upscale: ';
   $output .= ($element['#value']['upscale']) ? t('Yes') : t('No');
   return $output;
 }
 
+/**
+ * Gets the scaled version of the image.
+ * 
+ * @param $image
+ *   Image object
+ * @param $data
+ *   $data['width']
+ *   $data['height]
+ *   $data['upscale]
+ */
 function imagecache_scale_image(&$image, $data) {
   // Set impossibly large values if the width and height aren't set.
   $data['width'] = $data['width'] ? $data['width'] : 9999999;
   $data['height'] = $data['height'] ? $data['height'] : 9999999;
   if (!imageapi_image_scale($image, $data['width'], $data['height'], $data['upscale'])) {
-    watchdog('imagecache', 'imagecache_scale_image failed. image: %image, data: %data.', array('%image' => $image->source, '%data' => print_r($data, true)), WATCHDOG_ERROR);
-    return false;
+    watchdog('imagecache', 'imagecache_scale_image failed. image: %image, data: %data.', array('%image' => $image->source, '%data' => print_r($data, TRUE)), WATCHDOG_ERROR);
+    return FALSE;
   }
-  return true;
+  return TRUE;
 }
 
 
@@ -40,17 +55,30 @@ function imagecache_scale_and_crop_form(
   return imagecache_resize_form($data);
 }
 
+/**
+ * ImageCache Scale and Crop
+ * 
+ * @ingroup themeable
+ */
 function theme_imagecache_scale_and_crop($element) {
   return theme_imagecache_resize($element);
 }
 
-
+/**
+ * Generates the scaled/cropped version of the image.
+ * 
+ * @param $image
+ *   Image object
+ * @param $data
+ *   $data['width']
+ *   $data['height]
+ */
 function imagecache_scale_and_crop_image(&$image, $data) {
   if (!imageapi_image_scale_and_crop($image, $data['width'], $data['height'])) {
-    watchdog('imagecache', 'imagecache_scale_and_crop failed. image: %image, data: %data.', array('%image' => $image->source, '%data' => print_r($data, true)), WATCHDOG_ERROR);
-    return false;
+    watchdog('imagecache', 'imagecache_scale_and_crop failed. image: %image, data: %data.', array('%image' => $image->source, '%data' => print_r($data, TRUE)), WATCHDOG_ERROR);
+    return FALSE;
   }
-  return true;
+  return TRUE;
 }
 
 
@@ -88,12 +116,18 @@ function imagecache_deprecated_scale_for
   return $form;
 }
 
+/**
+ * Deprecated, @see imagecache_deprecated_scale_form()
+ */
 function theme_imagecache_deprecated_scale($element) {
   $data = $element['#value'];
   $options = array('inside' => t('Inside dimensions'), 'outside' => t('Outside dimensions'));
   return 'width: '. $data['width'] .', height: '. $data['height'] .', fit: '. $options[$data['fit']];
 }
 
+/**
+ * Deprecated, @see imagecache_deprecated_scale_form()
+ */
 function imagecache_deprecated_scale_image(&$image, $data) {
   if ($data['fit'] == 'outside' && $data['width'] && $data['height']) {
     $ratio = $image->info['width'] / $image->info['height'];
@@ -105,14 +139,12 @@ function imagecache_deprecated_scale_ima
   $data['width'] = $data['width'] ? $data['width'] : 9999999;
   $data['height'] = $data['height'] ? $data['height'] : 9999999;
   if (!imageapi_image_scale($image, $data['width'], $data['height'])) {
-     watchdog('imagecache', 'imagecache_deprecated_scale failed. image: %image, data: %data.', array('%image' => $image->source, '%data' => print_r($data, true)), WATCHDOG_ERROR);
-    return false;
+     watchdog('imagecache', 'imagecache_deprecated_scale failed. image: %image, data: %data.', array('%image' => $image->source, '%data' => print_r($data, TRUE)), WATCHDOG_ERROR);
+    return FALSE;
   }
-  return true;
+  return TRUE;
 }
 
-
-
 /**
  * ImageCache Crop
  */
@@ -150,20 +182,37 @@ function imagecache_crop_form($data) {
   return $form;
 }
 
+/**
+ * Crop widget
+ * 
+ * @ingroup themeable
+ */
 function theme_imagecache_crop($element) {
   $data = $element['#value'];
   return 'width: '. $data['width'] .', height: '. $data['height'] .', xoffset: '. $data['xoffset'] .', yoffset: '. $data['yoffset'];
 }
 
+/**
+ * Crops image
+ *
+ * @param $image
+ *   Image object
+ * @param $data
+ *   $data['width']
+ *   $data['height]
+ *   $data['xoffset']
+ *   $data['yoffset']
+ * @return
+ *   boolean about success
+ */
 function imagecache_crop_image(&$image, $data) {
   if (!imageapi_image_crop($image, $data['xoffset'], $data['yoffset'], $data['width'], $data['height'])) {
-      watchdog('imagecache', 'imagecache_crop failed. image: %image, data: %data.', array('%image' => $image->source, '%data' => print_r($data, true)), WATCHDOG_ERROR);
-    return false;
+      watchdog('imagecache', 'imagecache_crop failed. image: %image, data: %data.', array('%image' => $image->source, '%data' => print_r($data, TRUE)), WATCHDOG_ERROR);
+    return FALSE;
   }
-  return true;
+  return TRUE;
 }
 
-
 /**
  * ImageCache Desaturate
  */
@@ -175,13 +224,20 @@ function theme_imagecache_desaturate($el
   return '';
 }
 
-
+/**
+ * Desatures image
+ *
+ * @param $image
+ *   Image object
+ * @param $data
+ * @return boolean about success
+ */
 function imagecache_desaturate_image(&$image, $data = array()) {
   if (!imageapi_image_desaturate($image)) {
-    watchdog('imagecache', 'imagecache_desaturate failed. image: %image, data: %data.', array('%image' => $image->source, '%data' => print_r($data, true)), WATCHDOG_ERROR);
-    return false;
+    watchdog('imagecache', 'imagecache_desaturate failed. image: %image, data: %data.', array('%image' => $image->source, '%data' => print_r($data, TRUE)), WATCHDOG_ERROR);
+    return FALSE;
   }
-  return true;
+  return TRUE;
 }
 
 
@@ -211,6 +267,11 @@ function imagecache_rotate_form($data) {
   return $form;
 }
 
+/**
+ * Rotate widget.
+ *
+ * @ingroup themeable
+ */
 function theme_imagecache_rotate($element) {
   $output = t('degrees:') .' '. $element['#value']['degrees'] .', ';
   $output .= t('randomize:') .' '. (($element['#value']['random']) ? t('Yes') : t('No')) .', ';
@@ -218,10 +279,21 @@ function theme_imagecache_rotate($elemen
   return $output;
 }
 
+/**
+ * Rotates image
+ *
+ * @param $image
+ *   Image object
+ * @param $data
+ *   $data['degrees']
+ *   $data['random'] - if TRUE, rotate with random degrees
+ *   $data['bgcolor']
+ * @return unknown
+ */
 function imagecache_rotate_image(&$image, $data) {
   // Set sane default values.
   $data['degrees'] = $data['degrees'] ? $data['degrees'] : 0;
-  $data['random'] = $data['random'] ? $data['random'] : false;
+  $data['random'] = $data['random'] ? $data['random'] : FALSE;
   $data['bgcolor'] = $data['bgcolor'] ? $data['bgcolor'] : '#FFFFFF';
 
   // Manipulate the if we need to randomize, and convert to proper colors.
@@ -233,10 +305,10 @@ function imagecache_rotate_image(&$image
   }
 
   if (!imageapi_image_rotate($image, $data['degrees'], $data['bgcolor'])) {
-    watchdog('imagecache', 'imagecache_rotate_image failed. image: %image, data: %data.', array('%image' => $image->source, '%data' => print_r($data, true)), WATCHDOG_ERROR);
-    return false;
+    watchdog('imagecache', 'imagecache_rotate_image failed. image: %image, data: %data.', array('%image' => $image->source, '%data' => print_r($data, TRUE)), WATCHDOG_ERROR);
+    return FALSE;
   }
-  return true;
+  return TRUE;
 }
 
 /**
@@ -273,6 +345,11 @@ function imagecache_sharpen_form($data) 
   return $form;
 }
 
+/**
+ * Sharpen widget.
+ * 
+ * @ingroup themeable
+ */
 function theme_imagecache_sharpen($element) {
   $output = t('radius:') .' '. $element['#value']['radius'] .', ';
   $output .= t('sigma:') .' '. $element['#value']['sigma'] .', ';
@@ -281,6 +358,19 @@ function theme_imagecache_sharpen($eleme
   return $output;
 }
 
+/**
+ * Shapens image.
+ *
+ * @param $image
+ *   Image object
+ * @param $data
+ *   $data['radius']
+ *   $data['sigma']
+ *   $data['amount']
+ *   $data['threshold']
+ * @return
+ *   boolean about success
+ */
 function imagecache_sharpen_image(&$image, $data) {
   // Set sane default values.
   $data['radius'] = $data['radius'] ? $data['radius'] : "0.5";
@@ -289,8 +379,8 @@ function imagecache_sharpen_image(&$imag
   $data['threshold'] = $data['threshold'] ? $data['threshold'] : "0.05";
 
   if (!imageapi_image_sharpen($image, $data['radius'], $data['sigma'], $data['amount'], $data['threshold'])) {
-    watchdog('imagecache', 'imagecache_sharpen_image failed. image: %image, data: %data.', array('%image' => $image->source, '%data' => print_r($data, true)), WATCHDOG_ERROR);
-    return false;
+    watchdog('imagecache', 'imagecache_sharpen_image failed. image: %image, data: %data.', array('%image' => $image->source, '%data' => print_r($data, TRUE)), WATCHDOG_ERROR);
+    return FALSE;
   }
-  return true;
+  return TRUE;
 }
Index: imagecache_ui.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/imagecache/imagecache_ui.module,v
retrieving revision 1.26
diff -u -p -r1.26 imagecache_ui.module
--- imagecache_ui.module	7 Feb 2009 19:36:29 -0000	1.26
+++ imagecache_ui.module	11 Feb 2009 14:46:14 -0000
@@ -2,16 +2,22 @@
 // $Id: imagecache_ui.module,v 1.26 2009/02/07 19:36:29 drewish Exp $
 
 /**
- * Administrative interface to imagecache.
- *
+ * @file
+ *   Administrative interface to imagecache.
  */
 
+/**
+ * Implementation of hook_help().
+ */
 function imagecache_ui_help($path, $arg) {
   switch($path) {
     case 'admin/build/imagecache': return t('Manage ImageCache presets.');
   }
 }
 
+/**
+ * Implementation of hook_menu().
+ */
 function imagecache_ui_menu() {
   $items = array();
   $items['admin/build/imagecache'] = array(
@@ -88,6 +94,9 @@ function imagecache_ui_menu() {
   return $items;
 }
 
+/**
+ * Generates presets title for menu items, see @imagecache_ui_menu()
+ */
 function imagecache_preset_title_callback($title, $preset = array(), $action = array()) {
   $replacements = array();
   if (!empty($preset)) {
@@ -129,7 +138,6 @@ function imagecache_ui_preset_load($pres
 /**
  * Preset Admin callbacks and required functions.
  */
-
 function imagecache_ui_presets() {
   $header = array(t('Preset Name'), t('Actions'));
   $rows = array();
@@ -148,6 +156,9 @@ function imagecache_ui_presets() {
   return $output;
 }
 
+/**
+ * Form for adding presets.
+ */
 function imagecache_ui_preset_add_form($form_state) {
   $form = array();
   $form['presetname'] = array(
@@ -165,6 +176,9 @@ function imagecache_ui_preset_add_form($
   return $form;
 }
 
+/**
+ * Submit function for imagecache_ui_preset_add_form().
+ */
 function  imagecache_ui_preset_add_form_submit($form, &$form_state) {
   $preset = array('presetname' => $form_state['values']['presetname']);
   $preset = imagecache_preset_save($preset);
@@ -172,6 +186,10 @@ function  imagecache_ui_preset_add_form_
   $form_state['redirect'] = 'admin/build/imagecache/'. $preset['presetid'];
 }
 
+/**
+ * Validate function for imagecache_ui_preset_add_form().
+ * Checks the uniqueness of the chosen presetname.
+ */
 function imagecache_ui_preset_add_form_validate($form, &$form_state) {
   $values = $form_state['values'];
   // Check for duplicates
@@ -188,6 +206,9 @@ function imagecache_ui_preset_add_form_v
   }
 }
 
+/**
+ * Form for deleting presets.
+ */
 function imagecache_ui_preset_delete_form($form_state, $preset = array()) {
   if (empty($preset)) {
     drupal_set_message(t('The specified preset was not found'), 'error');
@@ -207,6 +228,9 @@ function imagecache_ui_preset_delete_for
   );
 }
 
+/**
+ * Submit function for imagecache_ui_preset_delete_form().
+ */
 function imagecache_ui_preset_delete_form_submit($form, &$form_state) {
   $preset = imagecache_preset($form_state['values']['presetid']);
   imagecache_preset_delete($preset);
@@ -214,6 +238,9 @@ function imagecache_ui_preset_delete_for
   $form_state['redirect'] = 'admin/build/imagecache';
 }
 
+/**
+ * Form for flushing presets.
+ */
 function imagecache_ui_preset_flush_form(&$form_state, $preset = array()) {
   if (empty($preset)) {
     drupal_set_message(t('The specified preset was not found'), 'error');
@@ -233,6 +260,9 @@ function imagecache_ui_preset_flush_form
   );
 }
 
+/**
+ * Submit function for imagecache_ui_preset_flush_form().
+ */
 function imagecache_ui_preset_flush_form_submit($form, &$form_state) {
   $preset = imagecache_preset($form_state['values']['presetid']);
   imagecache_preset_flush($preset);
@@ -240,10 +270,9 @@ function imagecache_ui_preset_flush_form
   $form_state['redirect'] = 'admin/build/imagecache';
 }
 
-
-
-
-
+/**
+ * Form for editing presets
+ */
 function imagecache_ui_preset_form($form_state, $preset = array()) {
   if (empty($preset)) {
     drupal_set_message(t('The specified preset was not found.'), 'error');
@@ -390,7 +419,11 @@ function imagecache_ui_preset_form($form
   return $form;
 }
 
-
+/**
+ * Title item
+ * 
+ * @ingroup themeable
+ */
 function theme_imagecache_admin_title($element) {
   return '<h2>'. $element['value'] .'</h2>';
 }
@@ -420,6 +453,9 @@ function theme_imagecache_ui_preset_acti
   return $output;
 }
 
+/**
+ * Submit function for imagecache_ui_preset_form().
+ */
 function imagecache_ui_preset_form_submit($form, &$form_state) {
   if (isset($form_state['values']['actions'])) {
     foreach($form_state['values']['actions'] as $action) {
@@ -430,6 +466,9 @@ function imagecache_ui_preset_form_submi
   $form_state['redirect'] = 'admin/build/imagecache/'. $form_state['values']['presetid'];
 }
 
+/**
+ * Form for action editing.
+ */
 function imagecache_ui_action_form($form_state, $preset, $action) {
   $definitions = imagecache_action_definitions();
 
@@ -464,6 +503,9 @@ function imagecache_ui_action_form($form
   return $form;
 }
 
+/**
+ * Submit function for imagecache_ui_action_form().
+ */
 function imagecache_ui_action_form_submit($form, &$form_state) {
   if ($action = imagecache_action($form_state['values']['actionid'])) {
     $action = array_merge($action, $form_state['values']);
@@ -477,6 +519,9 @@ function imagecache_ui_action_form_submi
   }
 }
 
+/**
+ * Form for action deleting.
+ */
 function imagecache_ui_action_delete_form($form_state, $preset = array(), $action = array()) {
   if (empty($action)) {
     drupal_set_message(t('Unknown Action.'), 'error');
@@ -500,7 +545,9 @@ function imagecache_ui_action_delete_for
   );
 }
 
-
+/**
+ * Submit function for imagecache_ui_action_delete_form().
+ */
 function imagecache_ui_action_delete_form_submit($form, &$form_state) {
   $action = imagecache_action($form_state['values']['actionid']);
   imagecache_action_delete($action);
@@ -508,6 +555,9 @@ function imagecache_ui_action_delete_for
   $form_state['redirect'] = 'admin/build/imagecache/'. $action['presetid'];
 }
 
+/**
+ * Form for adding action.
+ */
 function imagecache_ui_action_add_form($form_state, $preset, $actionname) {
   $definition = imagecache_action_definition($actionname);
 
@@ -535,7 +585,9 @@ function imagecache_ui_action_add_form($
   return $form;
 }
 
-
+/**
+ * Submit function for imagecache_ui_action_add_form().
+ */
 function imagecache_ui_action_add_form_submit($form, &$form_state) {
   imagecache_action_save($form_state['values']);
   $form_state['redirect'] = 'admin/build/imagecache/'. $form_state['values']['presetid'];
Index: tests/imagecache_create_url.test
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/imagecache/tests/imagecache_create_url.test,v
retrieving revision 1.4
diff -u -p -r1.4 imagecache_create_url.test
--- tests/imagecache_create_url.test	9 Jul 2008 03:07:11 -0000	1.4
+++ tests/imagecache_create_url.test	11 Feb 2009 14:46:14 -0000
@@ -154,7 +154,7 @@ class ImageCacheUrlTests extends DrupalT
     ));
 
     // Show node.
-    $this->drupalGet(url('node/' . $node->nid, NULL, NULL, TRUE));
+    $this->drupalGet(url('node/'. $node->nid, NULL, NULL, TRUE));
 
     // Check if expected url shows up
     $this->assertWantedRaw($expected,
