cvs: docweb /include lib_url_entities.inc.php

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

  Modified files:              
    /docweb/include	lib_url_entities.inc.php 
  Log:
  fixed regex and callback index (URL linking was broken)
  
http://cvs.php.net/diff.php/docweb/include/lib_url_entities.inc.php?r1=1.10&r2=1.11&ty=u
Index: docweb/include/lib_url_entities.inc.php
diff -u docweb/include/lib_url_entities.inc.php:1.10 docweb/include/lib_url_entities.inc.php:1.11
--- docweb/include/lib_url_entities.inc.php:1.10	Tue Jan 25 15:05:17 2005
+++ docweb/include/lib_url_entities.inc.php	Tue Jan 25 17:08:02 2005
@@ -19,7 +19,7 @@
 |              Mehdi Achour <[email protected]>                            |
 |              Sean Coates <[email protected]>                              |
 +----------------------------------------------------------------------+
-$Id: lib_url_entities.inc.php,v 1.10 2005/01/25 20:05:17 sean Exp $
+$Id: lib_url_entities.inc.php,v 1.11 2005/01/25 22:08:02 sean Exp $
 */
 
 // user agent
@@ -299,7 +299,7 @@
 function url_callback($m)
 {
   $maxLen = 57; $threshold = 3;
-  $url = $m[1] .'://'. $m[2];
+  $url = $m[1] .'://'. $m[3];
 
   if (strlen($url) > ($maxLen + $threshold))
   {
@@ -316,7 +316,7 @@
 
 function ent_value($eVal)
 {
-  return preg_replace_callback('#(?:f|ht)tps?://([^\s]+)#S', 'url_callback', $eVal);
+  return preg_replace_callback('#((f|ht)tps?)://([^\s]+)#S', 'url_callback', $eVal);
 }
 
 function ent_link($eVal)
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.