Make WordPress Core

Opened 14 years ago

Closed 8 years ago

#12480 closed defect (bug) (duplicate)

Moderated comments don't show blank links

Reported by: donncha's profile donncha Owned by: chriscct7's profile chriscct7
Milestone: Priority: normal
Severity: normal Version: 3.0
Component: Comments Keywords: has-patch dev-feedback has-unit-tests
Focuses: Cc:

Description

Comments caught in moderation won't show the blank links inserted into them unless you edit them.

A comment with html code like <a href='http://example.com/'></a> will not show that link on the moderation page.

Attachments (4)

bmb_0009_t12480.patch (1.6 KB) - added by bumbu 14 years ago.
12480.diff (1.3 KB) - added by technosailor 14 years ago.
Refreshed, simplified and enhanced for 3.0
12480-2.diff (1.7 KB) - added by technosailor 14 years ago.
Replaces empty, whitespace or nbsp anchor text with the sanitized URL. Improves regex to be less greedy for non href attributes
12480.2.diff (5.4 KB) - added by stevegrunwell 8 years ago.
Refresh for WordPress 4.4 with addition of unit tests + better WordPress coding standards support

Download all attachments as: .zip

Change History (15)

#1 @filosofo
14 years ago

Maybe Slashdot-style show a URL's domain in parentheses?

blah blah blah (http://example.com) blah blah

#2 @nacin
14 years ago

  • Component changed from General to Comments
  • Milestone changed from Unassigned to Future Release

#3 @nacin
14 years ago

  • Milestone changed from Future Release to 3.0

#4 @bumbu
14 years ago

  • Cc bmbalex@… added
  • Keywords has-patch added

If the links are empty (or contain only blanks spaces, tabs...) then inside of them it is inserted a blank string

but it needs some performing because I don't know how to detect &nbsp;
also I am not sure if I gave right priority to new filter in add_filter function

@technosailor
14 years ago

Refreshed, simplified and enhanced for 3.0

@technosailor
14 years ago

Replaces empty, whitespace or nbsp anchor text with the sanitized URL. Improves regex to be less greedy for non href attributes

#5 @nacin
14 years ago

  • Milestone changed from 3.0 to 3.1

This isn't a regression, and looks like it could use some unit tests or at least some more testing. Moving to 3.1.

#6 @shidouhikari
14 years ago

I believe there are other special entities related to blank space too, like &emsp; &ensp; &thinsp;

I wasn't able to find now but I've already seen entities that generate different sized spaces, it had even a grath with sizes.

Using esc_url( $matches[2] ) instead of a simple "blank" is a great idea, it makes very explicit what's happening. Maybe wrap it in something like "original link had blank text so that link wasn't viewable, its attributes are:
|".

#7 @nacin
13 years ago

  • Keywords comments removed
  • Milestone changed from Awaiting Triage to Future Release

#8 @chriscct7
9 years ago

  • Keywords dev-feedback added

Looks good to go. Verified still a "bug", and patch looks good. Core devs might want to review intent

#9 @chriscct7
8 years ago

  • Keywords needs-unit-tests added
  • Owner set to chriscct7
  • Status changed from new to assigned

@stevegrunwell
8 years ago

Refresh for WordPress 4.4 with addition of unit tests + better WordPress coding standards support

#10 @stevegrunwell
8 years ago

  • Keywords has-unit-tests added; needs-unit-tests removed

Added fresh version of the patch (hello 4 years ago!) with better support for the WordPress coding standards, actual unit tests, and a simplified regular expression for matching empty links.

#11 @rachelbaker
8 years ago

  • Milestone Future Release deleted
  • Resolution set to duplicate
  • Status changed from assigned to closed

Duplicate of #36380.

Note: See TracTickets for help on using tickets.