[wp-trac] [WordPress Trac] #11520: print_scripts_l10n() should use json_encode()

WordPress Trac wp-trac at lists.automattic.com
Mon Nov 7 02:26:36 UTC 2011


#11520: print_scripts_l10n() should use json_encode()
-------------------------+------------------------
 Reporter:  scribu       |       Owner:  azaozz
     Type:  enhancement  |      Status:  reviewing
 Priority:  normal       |   Milestone:  3.3
Component:  JavaScript   |     Version:
 Severity:  critical     |  Resolution:
 Keywords:               |
-------------------------+------------------------

Comment (by azaozz):

 11520-5.patch restores `WP_Scripts::localize()` and
 `wp_localize_script()`, renames `add_script_data` to `add_script_extra`
 and makes `WP_Scripts::add_script_extra()` accept a string (the JS source)
 so it can be used to pass any JS directly.

 Both `WP_Scripts::localize()` and `wp_localize_script()` are backwards
 compatible and can be used as before to output a JS object holding
 translated strings. The change is that now HTML entities are converted
 with `html_entity_decode()` and the array is json encoded.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/11520#comment:81>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list