[wp-trac] [WordPress Trac] #29722: wp_localize_script should be able to manage scalars

WordPress Trac noreply at wordpress.org
Wed Sep 23 16:46:49 UTC 2015


#29722: wp_localize_script should be able to manage scalars
----------------------------------+------------------------------
 Reporter:  Fab1en                |       Owner:
     Type:  defect (bug)          |      Status:  new
 Priority:  normal                |   Milestone:  Awaiting Review
Component:  I18N                  |     Version:  3.3
 Severity:  normal                |  Resolution:
 Keywords:  has-patch needs-docs  |     Focuses:  javascript
----------------------------------+------------------------------

Comment (by jtsternberg):

 Replying to [comment:11 boonebgorges]:
 > > I'm thinking maybe we want to do the html_entity_decode( (string)
 $value, ENT_QUOTES, 'UTF-8') recursively?
 >
 > Groan :) If you can recurse without losing performance for one-
 dimensional arrays, then OK.

 I don't believe it will be an issue unless you believe calling `in_array`
 for each value in a one-dimensional array will cause significant
 performance loss. The other option is to to check something like
 `$is_multi = is_array( array_values( $l10n1 )[0] )`, but to determine
 which was more performant would def. require some benchmarks. I would not
 be a bit surprised if multi-dimensional arrays were often used.

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


More information about the wp-trac mailing list