Ticket #3228 (closed defect (bug): fixed)
make_clickable() doesn't make all links clickable
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Template | Version: | |
| Severity: | normal | Keywords: | |
| Cc: |
Attachments
Change History
comment:1
Viper007Bond — 5 years ago
- Component changed from Administration to Template
comment:4
markjaquith — 5 years ago
- Owner changed from anonymous to markjaquith
- Status changed from new to assigned
Check out that upload. I've been playing with that (was testing in PHP console, so add htmlspecialchars() and <hr /> if you're testing in a browser)
My fix is simple to look for anchors within anchors, and removing the internal (undesired) anchor (the one created by our function).
For people who just want to see the results, here is the input of my script:
<p>http://example.com/ is a link. So is: http://example.com/</p> <p><a href="http://example.com/">example.com</a></p> <p>www.example.com/signup/</p> <p>ftp.example.org</p> <p>example@example.com</p> <p>ftp://example.com/foo/bar/</p>
Here is the output of that script.
Old function (WP < 2.0.4):
<p><a href='http://example.com/' rel='nofollow'>http://example.com/</a> is a link. So is: <a href='http://example.com/' rel='nofollow'>http://example.com/</a></p> <p><a href="http://example.com/">example.com</a></p> <p>www.example.com/signup/</p> <p>ftp.example.org</p> <p>example@example.com</p> <p>ftp://example.com/foo/bar/</p>
New function (2.0.4 and currently in trunk):
<p>http://example.com/ is a link. So is: <a href='http://example.com/' rel='nofollow'>http://example.com/</a></p> <p><a href="http://example.com/">example.com</a></p> <p>www.example.com/signup/</p> <p>ftp.example.org</p> <p>example@example.com</p> <p>ftp://example.com/foo/bar/</p>
My proposed function:
<p><a href='http://example.com/' rel='nofollow'>http://example.com/</a> is a link. So is: <a href='http://example.com/' rel='nofollow'>http://example.com/</a></p> <p><a href="http://example.com/">example.com</a></p> <p><a href='http://www.example.com/signup/' rel='nofollow'>www.example.com/signup/</a></p> <p><a href='http://ftp.example.org' rel='nofollow'>ftp.example.org</a></p> <p><a href="mailto:example@example.com">example@example.com</a></p> <p><a href='ftp://example.com/foo/bar/' rel='nofollow'>ftp://example.com/foo/bar/</a></p>
This is the last remaining ticket for 2.0.5 ... help a brother out!
comment:5
markjaquith — 5 years ago
And just to outline the problem that necessitated the change from old to new, and the problem introduced by new:
Input:
<p><a href="http://example.com/">http://example.com/</a></p> <p>http://example.com</p>
Old:
<p><a href="http://example.com/"><a href='http://example.com/' rel='nofollow'>http://example.com/</a></a></p> <p><a href='http://example.com' rel='nofollow'>http://example.com</a></p>
New:
<p><a href="http://example.com/">http://example.com/</a></p> <p>http://example.com</p>
Proposed:
<p><a href="http://example.com/">http://example.com/</a></p> <p><a href='http://example.com' rel='nofollow'>http://example.com</a></p>
comment:6
markjaquith — 5 years ago
- Status changed from assigned to closed
- Resolution set to fixed


I think you meant [4012]. ;)