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

WordPress Trac wp-trac at lists.automattic.com
Sat Jul 30 23:54:20 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 scribu):

 You could replace this:

 wp_localize_script( 'my-script', 'MyScriptL10N', $data );

 with this:

 $func = function_exists( 'wp_add_script_data' ) ? 'wp_add_script_data' :
 $func( 'my-script', 'MyScriptL10N', data );

 There are a lot of plugins that would need to make this rather ugly and
 unnecessary change.

 Maybe we should remove the deprecation warning for now.

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

More information about the wp-trac mailing list