ID:               6893
 Comment by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
 Status:           Assigned
 Bug Type:         Feature/Change Request
 Operating System: N/A
 PHP Version:      4.0.2
 Assigned To:      tal
 New Comment:

I developed such a function in php with extensive exceptions checking,
some months ago.

If it would help you, you might like to eyeball it. It may give you
valuable and time-saving clues to coding it as a C++ function.

Please send me an email address to deliver you part of my script
library as an attachment.


Previous Comments:
------------------------------------------------------------------------

[2002-04-28 13:35:01] [EMAIL PROTECTED]

dealing with trailing periods and commas on urls is pretty easy -- just
ignore them if they're followed by a whitespace character. (it's not
100% reliable, of course, but in my experience is more often correct
than including the trailing period or comma in that case.)

------------------------------------------------------------------------

[2002-04-28 06:57:19] [EMAIL PROTECTED]

In playing with this kind of thing in the past I've come up against the
following problem: How do you handle URLs embedded in sentences which
have contact with a full stop or commas?

"Have a look at www.examples.com/hi.html, it might help you out"

Baring in mind that some sites DO include a comma in the URL, for
example any site powered by the Vignette content managment system -
example:

http://www.vignette.com/CDA/Site/0,2097,1-1-1489,00.html

The same goes for sentences where the URL is followed directly by a
full stop.

The other thing that might be worth taking in to consideration is that
many site designs will "break" if suitably long URLs are added (this is
especially true for forums, which will be a major use for this
function). The  best solution I have seen is vBulletin's, where long
URLs are shortened to look like this:

http://example.com/lon...blah.html

Where the full URL (to which the above text is linked) looks like
this:

http://example.com/long-url-here/blah/blah/blah.html

Obviously different sites would need different lengths of URL, so
whether or not URLs were shortened like this (and to what extent they
were shortened) should probably be specified by an optional second
paramater of some sort.

Hope that helps,

Simon

------------------------------------------------------------------------

[2002-04-28 02:24:17] [EMAIL PROTECTED]

I'm planning to write a String_Manipulation (or something similiar,
we'll probably fight about that... ;-)). Assigned to myself.

-Tal

------------------------------------------------------------------------

[2002-01-06 10:02:06] [EMAIL PROTECTED]

sounds if PEAR has another task ;). reclassified.

------------------------------------------------------------------------

[2000-09-26 19:36:44] [EMAIL PROTECTED]

I don't know if this is the best way to submit a feature request, but I
think it would be handy to have a builtin makelinks() function, to
change all urls in a piece of text to actual links. eg, changing "my
homepage is at http://www.arse.net/"; to "my homepage is at <a
href=http://www.arse.net/>http://www.arse.net/</a>". 'course, it's
pretty easy to code this yourself, but then so is nl2br(), and having
it as part of the source would (maybe?) make it faster.

------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=6893&edit=1

Reply via email to