You are here

function image_effect_text_case_transform in ImageCache Actions 7

Transform a string by a certain method.

Proudly copied from module://views/includes/handlers.inc.

Parameters

$string: The input you want to transform.

$option: How do you want to transform it, possible values:

  • upper: Uppercase the string.
  • lower: lowercase the string.
  • ucfirst: Make the first char uppercase.
  • ucwords: Make each word in the string uppercase.

Return value

string The transformed string.

1 call to image_effect_text_case_transform()
image_effects_text_get_text in image_effects_text/image_effects_text.inc
Get the text to use for this image.

File

image_effects_text/image_effects_text.inc, line 773

Code

function image_effect_text_case_transform($string, $option) {
  global $multibyte;
  switch ($option) {
    default:
      return $string;
    case 'upper':
      return drupal_strtoupper($string);
    case 'lower':
      return drupal_strtolower($string);
    case 'ucfirst':
      return drupal_strtoupper(drupal_substr($string, 0, 1)) . drupal_substr($string, 1);
    case 'ucwords':
      if ($multibyte == UNICODE_MULTIBYTE) {
        return mb_convert_case($string, MB_CASE_TITLE);
      }
      else {
        return ucwords($string);
      }
  }
}