cvs: docweb /include lib_url_entities.inc.php

From: Date: Tue, 25 Jan 2005 22:21:03 +0000
Subject: cvs: docweb /include lib_url_entities.inc.php
Groups: php.doc.web 
Request: Send a blank email to doc-web+get-573@lists.php.net to get a copy of this message
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 <didou@php.net> | | Sean Coates <sean@php.net> | +----------------------------------------------------------------------+ -$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; }

« previous php.doc.web (#573) next »