Index: urlfilter.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/urlfilter/urlfilter.module,v
retrieving revision 1.16
diff -u -F^f -r1.16 urlfilter.module
--- urlfilter.module	13 Oct 2005 16:11:16 -0000	1.16
+++ urlfilter.module	16 Nov 2005 19:06:50 -0000
@@ -20,11 +20,24 @@ function urlfilter_filter($op, $delta = 
     case 'description':
       return t('Turns web and e-mail addresses into clickable links.');
 
+    case 'settings':
+        $form['filter_urlfilter'] = array('#type' => 'fieldset', '#title' => t('Url filter'), '#collapsible' => TRUE, '#collapsed' => TRUE);
+        $form['filter_urlfilter']['url_length'] = array(
+          '#type' => 'textfield',
+          '#title' => t('Maximum link text length'),
+          '#default_value' => variable_get('url_length', 60),
+          '#maxlength' => 3,
+          '#description' => t('Urls longer than this number of characters will be truncated to prevent long strings that break formatting. The link itself will be retained, just the text portion of the link will be truncated.'),
+          );
+        return $form;
+      break;
+
     case 'process':
+      $length = variable_get('url_length', 60);
       $text = ' ' . $text . ' ';
-      $text = preg_replace("!(<p>|<li>|[ \n\r\t\(])((http://|https://|ftp:\//|mailto:)([a-zA-Z0-9@:%_~#?&=.,/;-]*[a-zA-Z0-9@:%_+*~#&=/;-]))([.,?]?)(?=(</p>|</li>|[ \n\r\t\)]))!i", '\1<a href="\2">\2</a>\5', $text);
-      $text = preg_replace("!(<p>|<li>|[ \n\r\t\(])([A-Za-z0-9._-]+@[A-Za-z0-9._+-]+\.[A-Za-z]{2,4})([.,]?)(?=(</p>|</li>|[ \n\r\t\)]))!i", '\1<a href="mailto:\2">\2</a>\3', $text);
-      $text = preg_replace("!(<p>|<li>|[ \n\r\t\(])(www\.[a-zA-Z0-9@:%_+*~#?&=.,/;-]*[a-zA-Z0-9@:%_~#\&=/;-])([.,?]?)(?=(</p>|</li>|[ \n\r\t\)]))!i", '\1<a href="http://\2">\2</a>\3', $text);
+      $text = preg_replace("!(<p>|<li>|[ \n\r\t\(])((http://|https://|ftp:\//|mailto:)([a-zA-Z0-9@:%_~#?&=.,/;-]*[a-zA-Z0-9@:%_+*~#&=/;-]))([.,?]?)(?=(</p>|</li>|[ \n\r\t\)]))!e", "'\\1<a href=\"\\2\" title=\"\\2\" >'. (strlen('\\2') > ". $length ." ? substr('\\2', 0, ". $length .") .'...': '\\2') .'</a>\\5'", $text);
+      $text = preg_replace("!(<p>|<li>|[ \n\r\t\(])([A-Za-z0-9._-]+@[A-Za-z0-9._+-]+\.[A-Za-z]{2,4})([.,]?)(?=(</p>|</li>|[ \n\r\t\)]))!e", "'\\1<a href=\"mailto:\\2\" title=\"\\2\" >'. (strlen('\\2') > ". $length ." ? substr('\\2', 0, ". $length .") .'...': '\\2') .'</a>\\3'", $text);
+      $text = preg_replace("!(<p>|<li>|[ \n\r\t\(])(www\.[a-zA-Z0-9@:%_+*~#?&=.,/;-]*[a-zA-Z0-9@:%_~#\&=/;-])([.,?]?)(?=(</p>|</li>|[ \n\r\t\)]))!e", "'\\1<a href=\"http://\\2\" title=\"\\2\" >'. (strlen('\\2') > ". $length ." ? substr('\\2', 0, ". $length .") .'...': '\\2') .'</a>\\3'", $text);
       $text = substr($text, 1, -1);
       return $text;
 
