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

WordPress Trac wp-trac at lists.automattic.com
Sun Aug 14 15:50:59 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:  normal                  |  Resolution:
 Keywords:  has-patch dev-feedback  |
------------------------------------+------------------------

Comment (by azaozz):

 Replying to [comment:52 nacin]:
 > Daryl mentioned that wp_localize_script() escapes data differently than
 json_encode().

 Not exactly, wp_localize_script() didn't escape anything. We have esc_js()
 hard coded on some strings (not sure why not all) in script_loader. Seems
 we have to remove it there as json_encode() does that now.

 > I'm not sure I like [18496].

 This only affects making the initial queue in script_loader, i.e. it's
 internal use only.

 >
 > Removing l10n.js is probably guaranteed to trigger fatal errors in a
 plugin that is trying to use it (such as on the frontend). Mind you, they
 might be calling convertEntities().

 By default it's (supposed to be) used in a try/catch statement, so
 removing the function shouldn't affect anything. Perhaps there are couple
 of plugins that try to call it directly, we can put a dummy function
 `function convertEntities(s){return s;}` in the head to keep them from
 breaking.

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


More information about the wp-trac mailing list