Make WordPress Core

Opened 16 years ago

Closed 11 years ago

Last modified 11 years ago

#14900 closed enhancement (fixed)

link-template string builder cleanup

Reported by: niallkennedy Owned by: wonderboymusic
Priority: normal Milestone: 4.4
Component: General Version:
Severity: normal Keywords: has-patch
Cc: Focuses: template

Description

Convert dynamic strings to static strings where quick wins are available.

Wrap output such as translated strings in an esc_attr or esc_html just in case HTML can better handle what a parent page's character encoding can't.

Attachments (1)

link-template.diff​ (5.8 KB ) - added by niallkennedy 16 years ago.
staticize strings. escape some strings for HTML output.

Download all attachments as: .zip

Change History (9)

@niallkennedy
16 years ago

staticize strings. escape some strings for HTML output.

#1 @dd32
16 years ago

  • Component Permalinks → Template

Looks good to me so far. One thing of note is that I have the feeling the change of 'esc_url_raw' to 'esc_url' in the final patch chunk there may be wrong..

#2 @markjaquith
16 years ago

  • Milestone Awaiting Review → Future Release

Don't forget about the ​translation-enabled escaping functions, like esc_attr__()!

#3 @nacin
13 years ago

  • Component Template → General
  • Focuses template added

#4 @wonderboymusic
11 years ago

  • Milestone Future Release → 4.4

there are a few we can hit

#5 @wonderboymusic
11 years ago

  • Owner set to wonderboymusic
  • Resolution → fixed
  • Status new → closed

In 34444:

Links: use consistent late-escaping in some HTML link-generation functions:

  • post_comments_feed_link()
  • edit_post_link()
  • edit_comment_link()
  • edit_bookmark_link()
  • rel_canonical()

Props niallkennedy, wonderboymusic.
Fixes #14900.

#6 @wonderboymusic
11 years ago

In 34445:

After [34444​], wp_get_shortlink() can call get_queried_object_id() instead of using the $wp_query global.

See #14900.

#7 @kraftbj
11 years ago

Noting that r34444 broke the Edit links in Twenty Sixteen. ​https://github.com/WordPress/twentysixteen/issues/259

Had been using:

edit_post_link(
	sprintf(
		/* translators: %s: Name of current post */
		__( 'Edit %s', 'twentysixteen' ),
		the_title( '<span class="screen-reader-text">', '</span>', false )
	),
	'<span class="edit-link">',
	'</span>'
Last edited 11 years ago by kraftbj (previous) (diff)

#8 @wonderboymusic
11 years ago

In 34452:

Links: the esc_html() additions in [34444] aren't very nice to screen reader <span>s. Revert those specific calls.

See #14900.

Note: See TracTickets for help on using tickets.