function _filter_url_trim

Shortens long URLs to http://www.example.com/long/url...

Related topics

4 calls to _filter_url_trim()
_filter_url in drupal/core/modules/filter/filter.module
Converts text into hyperlinks automatically.
_filter_url_parse_email_links in drupal/core/modules/filter/filter.module
Makes links out of e-mail addresses.
_filter_url_parse_full_links in drupal/core/modules/filter/filter.module
Makes links out of absolute URLs.
_filter_url_parse_partial_links in drupal/core/modules/filter/filter.module
Makes links out of domain names starting with "www."

File

drupal/core/modules/filter/filter.module, line 1279
Framework for handling the filtering of content.

Code

function _filter_url_trim($text, $length = NULL) {
  static $_length;
  if ($length !== NULL) {
    $_length = $length;
  }

  // Use +3 for '...' string length.
  if ($_length && strlen($text) > $_length + 3) {
    $text = substr($text, 0, $_length) . '...';
  }
  return $text;
}