#32840 closed enhancement (wontfix)
Enhancement of l10n functions: new esc_html_ex() and esc_attr_ex()
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | minor | Version: | |
Component: | I18N | Keywords: | has-patch |
Focuses: | Cc: |
Description
Hi there,
I was coding a new tool for one of my websites, when I realized that esc_html_ex()
and esc_attr_ex()
didn't exist.
John asked for it as aside in another report so I think it could be useful for themes and plugins developers who need l10n.
You will find a patch file in attachment.
Thank you in advance.
Attachments (2)
Change History (8)
#1
@
10 years ago
- Keywords has-patch added
+1. I've just assumed that these existed before, too. I think we need them for consistency.
#3
@
10 years ago
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.
#4
@
10 years ago
- Severity changed from normal to minor
Hi @nacin,
Sorry for the delay of my answer, and thank you for your explanation.
I understand what you're trying to explain me, but I made that proposal because I read 3 topics (in forums) in 4 hours that was telling the lack of those functions in WordPress Core.
I know that "echo'ing" is not a big deal, and I actually use the way you propose to do it, using a function_exists()
to create those functions I miss :)
Thank you.
#5
follow-up:
↓ 6
@
9 years ago
- Milestone Future Release deleted
- Resolution set to wontfix
- Status changed from new to closed
I agree with @nacin's point above. Combining three methods makes the function's purpose tougher to grok, and could lead to erroneous use.
Thank you for the patch, CreativeJuiz, but I'm closing this as a wontfix. Don't let this dissuade you from contributing in the future :)
#6
in reply to:
↑ 5
@
9 years ago
Replying to johnbillion:
I agree with @nacin's point above. Combining three methods makes the function's purpose tougher to grok, and could lead to erroneous use.
Thank you for the patch, CreativeJuiz, but I'm closing this as a wontfix. Don't let this dissuade you from contributing in the future :)
Hi John,
No problem for me, I understood your explanations :)
To the next contribution!
Geoffrey
Patch for l10n.php