[wp-trac] [WordPress Trac] #32840: Enhancement of l10n functions: new esc_html_ex() and esc_attr_ex()
WordPress Trac
noreply at wordpress.org
Sun Jul 12 23:20:11 UTC 2015
#32840: Enhancement of l10n functions: new esc_html_ex() and esc_attr_ex()
--------------------------+-----------------------------
Reporter: CreativeJuiz | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Future Release
Component: I18N | Version:
Severity: normal | Resolution:
Keywords: has-patch | Focuses:
--------------------------+-----------------------------
Comment (by nacin):
Thanks for the report, @CreativeJuiz.
I don't feel like these aliases would be used all that often.
`esc_attr_e()` is used 152 times in core. `echo esc_attr_x()` is only seen
twice.
I understand combining two methods — echo and context (`ex()`) or echo and
escape (`esc_attr_e()`). But once you combine three methods, it starts to
become really exotic and tough to understand as an outsider. I'd rather
the more explicit `echo`.
These aliases aren't necessarily "missing" — nothing else in l10n.php
performs three distinct actions.
I feel like if someone wants to add one of these to their plugins, they
could easily wrap it in a `function_exists()` check and go on their merry
way.
An argument could be made that someone might try to use it and it just
doesn't exist, but I find it to be pretty edge, and someone using an IDE
or an editor with autocomplete would quickly realize it doesn't.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/32840#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list