[wp-trac] [WordPress Trac] #32787: make_clickable filter

WordPress Trac noreply at wordpress.org
Tue May 31 16:04:34 UTC 2016

#32787: make_clickable filter
 Reporter:  tlexcellent  |       Owner:  johnjamesjacoby
     Type:  enhancement  |      Status:  assigned
 Priority:  normal       |   Milestone:  4.6
Component:  Formatting   |     Version:  0.71
 Severity:  normal       |  Resolution:
 Keywords:  has-patch    |     Focuses:
Changes (by DrewAPicture):

 * keywords:  needs-patch 2nd-opinion => has-patch


 Replying to [comment:9 johnjamesjacoby]:
 > [https://core.trac.wordpress.org/attachment/ticket/32787/32787.patch
 32787.patch] does the following:
 > * Extracts regular expressions out into their own filters
 > * Adds these new filters via `default-filters.php`.
 > Things that may need changing:
 > * Function names. I used plurals because I think they read better. Also
 suffixed with `_filter` similar to `_cb`.

 I would remove the suffix. I think it's fine/expected to name the
 functions the same as the hooks.

 > * PHP doc. Is `@access private` correct? What about `@internal`?

 `@access private` is fine, `@internal` is only used for internal notes.
 The notes themselves don't get parsed, but the rest of the DocBlock does.
 I think you're thinking of `@ignore` which skips parsing of the element
 altogether – I don't think these warrant `@ignore` because we ''want''
 them to be discoverable.

 > * Filters with callbacks kinda stinks, but I think the extra abstraction
 is necessary here.

 I also think it's important if people want to unhook it for whatever
 reason, maybe to completely replace it.

 > * Filter documentation for `make_clickable` filter

 Yes, we need this :-) Also, two parameters are passed to the hook but only
 one is passed to each of the callbacks – is that intentional?

 The parameter and return documentation is also incomplete for all of the

 > ----

 > The end result of this patch, functionality speaking, is identical to
 before it. All we do is add a filter on each piece of `$text` being made
 clickable. This new `make_clickable` filter will allow for plugins to
 introduce their own clickables; specific to BuddyPress, bbPress, and P2,
 this means linking username mentions to their respective profiles without
 the need to duplicate the entire `make_clickable()` stack.


Ticket URL: <https://core.trac.wordpress.org/ticket/32787#comment:10>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list