Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Before rolling a patch for this, I figured I would gauge controversy. ;)
For the uninitiated, urlfilter module automatically translates the word "http://drupal.org" into a URL to http://drupal.org. I'm hard-pressed to find a plausible example of why one would not want this functionality by default (though of course switch-offable).
Let the flames begin. ;)
Comment | File | Size | Author |
---|---|---|---|
#10 | urlfilter_core_2.patch | 7.24 KB | webchick |
#8 | urlfilter_core_1.patch | 6.45 KB | webchick |
#5 | urlfilter_core_0.patch | 7.13 KB | webchick |
#4 | urlfilter_core.patch | 6.86 KB | webchick |
Comments
Comment #1
beginner CreditAttribution: beginner commented+1.
Nobody is maintaining it, now:
http://drupal.org/node/65116 .
Comment #2
beginner CreditAttribution: beginner commentedWell, I guess there is not much controversial about this idea...
As of today, nobody but core commiters can commit anything to it, anyway.
See again the issue I mentioned above.
Comment #3
Michelle+1 from me. I'm on a photo site that doesn't have this functionality and it's one of the most complained about things. I wouldn't think of running a site that allows users to post without having this module. To expect users to know how to put in an a href is silly. :)
Michelle
Comment #4
webchickFinally got around to rolling a patch for this. Needs testing; I've never done stuff w/ filter module before.
Comment #5
webchickBased on a review from Steven on IRC, I changed the following things:
1. The two helper functions I totally misunderstood. :P Renamed and re-PHPdoced to hopefully be more clear.
2. During the update, it now checks for the existence of urlfilter module, and if found will disable it.
Comment #6
Steven CreditAttribution: Steven commentedI was thinking for the urlfilter update, inserting new filter entries into a site's formats is a bad idea. Plus, the current update only disables urlfilter.module, but leaves the old entries around. This is not a problem per-se, as function_exists is used to verify filters, but it's still messy. We should only convert existing urlfilter usage to the core one.
Other than this, thumbs up from me. Sure, it's the monster regexp from hell times 3, but it gets the job done better than all the other linkers I've seen. :P
Comment #7
Dries CreditAttribution: Dries commented+1 from me. It's critical functionality.
Comment #8
webchickOk cool, this patch removes the update path.
Testers, please. :)
Comment #9
webchickComment #10
webchickSteven found me on IRC and informed me that I totally misunderstood his last comment. ;) Don't get rid of the update hook; rather, convert any existing urlfilter entries to use the core version.
Attached patch does this (I hope :)).
Comment #11
robertDouglass CreditAttribution: robertDouglass commentedAh, nice! I'll definitely be testing this so that we can hit the code freeze. Nice call, webchick, this is always one of the first modules I install.
Comment #12
Dries CreditAttribution: Dries commentedFirst review:
Do we really need to show people what URLs and e-mail addresses look like? I mean ... :-)
URL Filter
toURL filter
.truncate_utf8()
instead ofsubstr
to safely truncate UTF-8 strings.Comment #13
Dries CreditAttribution: Dries commentedComment #14
introfini CreditAttribution: introfini commentedIt’s possible to add an option for the nofollow attribute?
Thanks,
introfini
Comment #15
Steven CreditAttribution: Steven commentedI never added it because it's already in the HTML filter. But I guess with the default weights, the urlfilter is placed after the HTML filter. Options:
1) Place urlfilter before html filter (easy)
2) Split off nofollow filter and put it at the end (more work)
Comment #16
robertDouglass CreditAttribution: robertDouglass commentedIt seems like on August 29th, two days before the code freeze, the appropriate thing is would be to get the URL filter in and open an issue to split off the nofollow functionality for the next iteration.
Comment #17
Anonymous (not verified) CreditAttribution: Anonymous commentedplease add this to core.. +++++1
Comment #18
m3avrck CreditAttribution: m3avrck commentedWow, about darn tooting time!
return t('Web page addresses and e-mail addresses turn into links automatically.');
and
More concise, "Turns URLs into links automatically"
Should URL fitler go last as spot 3? Wouldn't it make sense to parse the URLs first, *before* line breaks? Just thinking about URLs that wrap...
Comment #19
Steven CreditAttribution: Steven commentedCommitted a tweaked patch to HEAD.
Nope, as the regular expression does not match non-ascii characters. In any case, it is preferred to use drupal_substr() rather than truncate_utf8(), as the former counts in characters rather than bytes (and thus more closely matches visual length).
Well, I changed it to a static var instead which is passed in first. It's a preg_replace_callback callback, so it can't take in extra arguments during the replacing.
Comment #20
webchickHey, thanks a lot Steven. I really appreciate you picking up my slack.
Comment #21
(not verified) CreditAttribution: commented