php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #6893 feature request - makelinks() function
Submitted: 2000-09-26 19:36 UTC Modified: 2007-01-10 05:57 UTC
Votes:1
Avg. Score:1.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: pgl at instinct dot org Assigned: tal (profile)
Status: Closed Package: Feature/Change Request
PHP Version: 4.0.2 OS: N/A
Private report: No CVE-ID: None
 [2000-09-26 19:36 UTC] pgl at instinct dot org
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.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-01-06 10:02 UTC] jan@php.net
sounds if PEAR has another task ;). reclassified.
 [2002-04-28 02:24 UTC] tal@php.net
I'm planning to write a String_Manipulation (or something similiar, we'll probably fight about that... ;-)). Assigned to myself.

-Tal
 [2002-04-28 06:57 UTC] pear at tfc-central dot com
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 13:35 UTC] jimw@php.net
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.)
 [2003-01-21 14:23 UTC] alan at frostick dot com
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.
 [2003-01-21 15:50 UTC] philip@php.net
How about posting a link to this source online?
 [2007-01-07 11:37 UTC] bjori@php.net
Please file PEAR/PECL related issues in the PEAR/PECL bug 
tracker.
 [2007-01-09 22:18 UTC] pgl at instinct dot org
Done: http://pear.php.net/bugs/bug.php?id=9789

Not sure setting the Status to "bogus" was a very nice way of dealing with this feature request, though. (Also: The original request was for PHP itself to include this function! :)
 [2007-01-10 05:28 UTC] cellog@php.net
this has nothing to do with PEAR, bjori
 [2007-01-10 05:57 UTC] pgl at instinct dot org
I'm confused. You set the status to "bogus" with the comment:

--8<--
Please file PEAR/PECL related issues in the PEAR/PECL bug 
tracker.
--8<--

What did you mean if not that this bug report belongs in the PEAR bug system? Apologies for the confusion.
 [2021-04-06 10:40 UTC] git@php.net
Automatic comment on behalf of roojs
Revision: https://github.com/php/pecl-tools-svn/commit/300fbe28b6995193c589bbefaf64738be7e57827
Log: fix bug #6893 - correct types for strict compilers
 [2021-04-06 10:40 UTC] git@php.net
-Status: Not a bug +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 08:02:42 2024 UTC