[wp-trac] Re: [WordPress Trac] #3228: make_clickable() doesn't make all links clickable

WordPress Trac wp-trac at lists.automattic.com
Fri Oct 13 03:32:43 GMT 2006


#3228: make_clickable() doesn't make all links clickable
----------------------+-----------------------------------------------------
 Reporter:  mdawaffe  |        Owner:  markjaquith
     Type:  defect    |       Status:  assigned   
 Priority:  normal    |    Milestone:  2.0.5      
Component:  Template  |      Version:             
 Severity:  normal    |   Resolution:             
 Keywords:            |  
----------------------+-----------------------------------------------------
Changes (by markjaquith):

  * status:  new => assigned
  * owner:  anonymous => markjaquith

Comment:

 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 at 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 at 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 at 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 at example.com">example at 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!

-- 
Ticket URL: <http://trac.wordpress.org/ticket/3228#comment:4>
WordPress Trac <http://wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list