[wp-trac] [WordPress Trac] #29722: wp_localize_script should be able to manage scalars
WordPress Trac
noreply at wordpress.org
Mon Sep 22 14:07:30 UTC 2014
#29722: wp_localize_script should be able to manage scalars
-------------------------+------------------------------
Reporter: Fab1en | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: I18N | Version: trunk
Severity: normal | Resolution:
Keywords: | Focuses: javascript
-------------------------+------------------------------
Comment (by kitchin):
I'm out of time, but yeah, this is the wrong fix to be compatible with
https://core.trac.wordpress.org/ticket/25280 and its tests AFAICT. I think
you want:
{{{
if ( is_array($l10n) ) {
foreach ( $l10n as $key => $value ) {
if ( is_string($value) ) {
$l10n[$key] = html_entity_decode( $value,
ENT_QUOTES, 'UTF-8');
}
}
} else if ( is_string($l10n) ) {
$l10n = html_entity_decode( $l10n, ENT_QUOTES, 'UTF-8');
}
}}}
And object users can now bypass it all!
--
Ticket URL: <https://core.trac.wordpress.org/ticket/29722#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list