function _filter_url_trim

_filter_url_trim($text, $length = NULL)

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

Related topics

File

modules/filter/filter.module, line 1657
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;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!filter!filter.module/function/_filter_url_trim/7.x