cvs: docweb /include lib_url_entities.inc.php

[email protected] ("Sean Coates")
Newsgroups php.doc.web
Message-ID <cvssean1106691663@cvsserver>
sean		Tue Jan 25 17:21:03 2005 EDT

  Modified files:              
    /docweb/include	lib_url_entities.inc.php 
  Log:
  make URL callback use str_chop(...)
  
http://cvs.php.net/diff.php/docweb/include/lib_url_entities.inc.php?r1=1.11&r2=1.12&ty=u
Index: docweb/include/lib_url_entities.inc.php
diff -u docweb/include/lib_url_entities.inc.php:1.11 docweb/include/lib_url_entities.inc.php:1.12
--- docweb/include/lib_url_entities.inc.php:1.11	Tue Jan 25 17:08:02 2005
+++ docweb/include/lib_url_entities.inc.php	Tue Jan 25 17:21:01 2005
@@ -19,7 +19,7 @@
 |              Mehdi Achour <[email protected]>                            |
 |              Sean Coates <[email protected]>                              |
 +----------------------------------------------------------------------+
-$Id: lib_url_entities.inc.php,v 1.11 2005/01/25 22:08:02 sean Exp $
+$Id: lib_url_entities.inc.php,v 1.12 2005/01/25 22:21:01 sean Exp $
 */
 
 // user agent
@@ -298,19 +298,11 @@
 
 function url_callback($m)
 {
-  $maxLen = 57; $threshold = 3;
-  $url = $m[1] .'://'. $m[3];
 
-  if (strlen($url) > ($maxLen + $threshold))
-  {
-    $link = substr($url, 0, $maxLen) .'...';
-  }
-  else
-  {
-    $link = $url;
-  }
+  $url = $m[1] .'://'. $m[3];
+  $link = str_chop($url, 60, true);
 
-  $html = '<a href="'. $url .'" title="'. $url .'">'. $link .'</a>';
+  $html = "<a href='$url' title='$url'>$link</a>";
   return $html;
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.