summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--imagecache.module58
-rw-r--r--imagecache_actions.inc44
-rw-r--r--imagecache_ui.module16
3 files changed, 59 insertions, 59 deletions
diff --git a/imagecache.module b/imagecache.module
index 2034654..ec87b48 100644
--- a/imagecache.module
+++ b/imagecache.module
@@ -240,7 +240,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 = FALSE) {
static $actions;
if (!isset($actions) || $reset) {
if (!$reset && ($cache = cache_get('imagecache_actions')) && !empty($cache->data)) {
@@ -425,7 +425,7 @@ function _imagecache_cache($presetname, $path) {
* @param $image
* Image object
* @return
- * Boolean, true indicating success and false failure.
+ * Boolean, TRUE indicating success and FALSE failure.
*/
function _imagecache_apply_action($action, $image) {
$actions = imagecache_action_definitions();
@@ -438,7 +438,7 @@ function _imagecache_apply_action($action, $image) {
}
// 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;
}
/**
@@ -471,10 +471,10 @@ function _imagecache_cache_set_cache_headers($fileinfo, &$headers) {
// 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
@@ -501,16 +501,16 @@ function _imagecache_cache_set_cache_headers($fileinfo, &$headers) {
* @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
+ * @return TRUE - derivative generated, FALSE - no derivative generated, NULL - derivative being generated
*/
function imagecache_build_derivative($actions, $src, $dst) {
// get the folder for the final location of this preset...
$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.
@@ -519,7 +519,7 @@ function imagecache_build_derivative($actions, $src, $dst) {
}
if (!$image = imageapi_image_open($src)) {
- return false;
+ return FALSE;
}
foreach ($actions as $action) {
@@ -537,7 +537,7 @@ function imagecache_build_derivative($actions, $src, $dst) {
}
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;
}
}
@@ -545,10 +545,10 @@ function imagecache_build_derivative($actions, $src, $dst) {
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;
}
/**
@@ -647,12 +647,12 @@ function imagecache_field_formatter($field, $item, $formatter, $node) {
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']);
@@ -671,7 +671,7 @@ function imagecache_field_formatter($field, $item, $formatter, $node) {
* Filter 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);
@@ -693,7 +693,7 @@ function _imagecache_filter($key, $value, $current_width, $current_height, $new_
* 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;
@@ -734,7 +734,7 @@ function _imagecache_recursive_delete($path) {
}
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);
@@ -792,9 +792,9 @@ function theme_imagecache_imagelink($namespace, $path, $alt = '', $title = '', $
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;
}
function imagecache_resize_form($action) {
@@ -833,15 +833,15 @@ function theme_imagecache_resize($element) {
* Get an array of all presets and their settings.
*
* @param reset
- * if set to true it will clear the preset cache
+ * if set to TRUE it will clear the preset cache
*
* @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;
+ // Clear caches if $reset is TRUE;
if ($reset) {
$presets = array();
cache_clear_all('imagecache:presets', 'cache');
@@ -911,7 +911,7 @@ function imagecache_presets($reset = false) {
* 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();
}
@@ -955,7 +955,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();
@@ -967,11 +967,11 @@ 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) {
+function imagecache_preset_actions($preset, $reset = FALSE) {
static $actions_cache = array();
if ($reset || empty($actions_cache[$preset['presetid']])) {
@@ -1045,7 +1045,7 @@ function imagecache_action_save($action) {
}
$preset = imagecache_preset($action['presetid']);
imagecache_preset_flush($preset);
- imagecache_presets(true);
+ imagecache_presets(TRUE);
return $action;
}
@@ -1053,5 +1053,5 @@ 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);
}
diff --git a/imagecache_actions.inc b/imagecache_actions.inc
index 92ddee0..fa3e36b 100644
--- a/imagecache_actions.inc
+++ b/imagecache_actions.inc
@@ -26,10 +26,10 @@ function imagecache_scale_image(&$image, $data) {
$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;
}
@@ -47,10 +47,10 @@ function theme_imagecache_scale_and_crop($element) {
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;
}
@@ -105,10 +105,10 @@ function imagecache_deprecated_scale_image(&$image, $data) {
$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;
}
@@ -157,10 +157,10 @@ function theme_imagecache_crop($element) {
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;
}
@@ -178,10 +178,10 @@ function theme_imagecache_desaturate($element) {
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;
}
@@ -221,7 +221,7 @@ function theme_imagecache_rotate($element) {
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 +233,10 @@ function imagecache_rotate_image(&$image, $data) {
}
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;
}
/**
@@ -289,8 +289,8 @@ function imagecache_sharpen_image(&$image, $data) {
$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;
}
diff --git a/imagecache_ui.module b/imagecache_ui.module
index 6449f9e..ea582cd 100644
--- a/imagecache_ui.module
+++ b/imagecache_ui.module
@@ -360,7 +360,7 @@ function imagecache_ui_preset_form($form_state, $preset = array()) {
$form['actions'] = array(
'#type' => 'fieldset',
'#title' => t('Actions'),
- '#tree' => true,
+ '#tree' => TRUE,
'#theme' => 'imagecache_ui_preset_actions',
);
@@ -412,10 +412,10 @@ function imagecache_ui_preset_form($form_state, $preset = array()) {
}
$form['actions']['new'] = array(
- '#tree' => false,
+ '#tree' => FALSE,
'#type' => 'fieldset',
'#title' => t('New Actions'),
- '#collapsible' => true,
+ '#collapsible' => TRUE,
'#collapsed' => count($preset['actions']) > 0,
'#access' => $preset['storage'] !== IMAGECACHE_STORAGE_DEFAULT,
);
@@ -438,8 +438,8 @@ function imagecache_ui_preset_form($form_state, $preset = array()) {
$form['files'] = array(
'#type' => 'fieldset',
- '#collapsible' => true,
- '#collapsed' => true,
+ '#collapsible' => TRUE,
+ '#collapsed' => TRUE,
'#title' => t('Error Files'),
);
@@ -485,7 +485,7 @@ function imagecache_ui_preset_form($form_state, $preset = array()) {
$form['preview'] = array(
'#type' => 'item',
'#title' => t('Preview'),
- '#value' => l($imagecache_path, $imagecache_path) .'<br />'. l("<img src='$imagecache_path' />", $imagecache_path, array('html' => true)),
+ '#value' => l($imagecache_path, $imagecache_path) .'<br />'. l("<img src='$imagecache_path' />", $imagecache_path, array('html' => TRUE)),
);
return $form;
@@ -574,7 +574,7 @@ function imagecache_ui_action_form($form_state, $preset, $action) {
}
$form = array(
- '#tree' => true,
+ '#tree' => TRUE,
);
$form['actionid'] = array(
@@ -642,7 +642,7 @@ function imagecache_ui_action_add_form($form_state, $preset, $actionname) {
$definition = imagecache_action_definition($actionname);
$form = array(
- '#tree' => true,
+ '#tree' => TRUE,
);
$form['action'] = array(
'#type' => 'value',