You are here

function _quotes_trim in Quotes 5

Trim text to the admin-specified length.

1 call to _quotes_trim()
theme_quotes_quote in ./quotes.module
Themeable function that displays a single quote and optional author.

File

./quotes.module, line 1126

Code

function _quotes_trim($text, $length = NULL) {
  if (!$length) {

    // Blocks have to specify the length.
    $length = variable_get('weblinks_trim', 0);
  }

  // Zero means no limit;
  if ($length == 0) {
    return $text;
  }

  // Use +3 for '...' string length.
  if (drupal_strlen($text) > $length + 3) {
    $text = drupal_substr($text, 0, $length) . '...';
  }
  return $text;
}