[wp-trac] [WordPress Trac] #37057: Creation of an esc_html functions for _n(), _nx(), _ex(), and number_format_i18n()

WordPress Trac noreply at wordpress.org
Sat Aug 12 18:02:15 UTC 2017


#37057: Creation of an esc_html functions for _n(), _nx(), _ex(), and
number_format_i18n()
--------------------------------------+------------------------------
 Reporter:  zakkath                   |       Owner:
     Type:  feature request           |      Status:  new
 Priority:  normal                    |   Milestone:  Awaiting Review
Component:  I18N                      |     Version:
 Severity:  normal                    |  Resolution:
 Keywords:  needs-patch dev-feedback  |     Focuses:
--------------------------------------+------------------------------

Comment (by zakkath):

 Replying to [comment:7 johnbillion]:
 > What's the use case for `esc_html_n()` without passing it through
 `sprintf()` and therefore needing further late escaping?

 It's not so much of a use case thing but more along the lines of
 consistency for theme/plugin developers. Since WPCS requires that these
 things be escaped, `_e()` gets `esc_html_e()` and so forth but, using the
 current version of Underscores, it uses `esc_html()` as a wrapper around
 `_nx()` as demonstrated in
 [comments.php](https://github.com/Automattic/_s/blob/master/comments.php#L40).

 So my proposal would be to create `esc_html_nx()` as that wrapper. I
 created a diff file with the wrapper and attached it to the ticket. The
 change was tested using a fresh copy of Underscores and resulted in
 desired output and nothing in the error log.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/37057#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list