Allow wp_plupload_default_settings() to be called multiple times without doubling up the output. see #22060.

git-svn-id: http://core.svn.wordpress.org/trunk@22488 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2012-11-09 04:51:25 +00:00
parent 9c4214745b
commit 57db888420

View File

@ -1176,6 +1176,10 @@ function wp_max_upload_size() {
function wp_plupload_default_settings() {
global $wp_scripts;
$data = $wp_scripts->get_data( 'wp-plupload', 'data' );
if ( $data && false !== strpos( $data, '_wpPluploadSettings' ) )
return;
$max_upload_size = wp_max_upload_size();
$defaults = array(
@ -1211,7 +1215,6 @@ function wp_plupload_default_settings() {
$script = 'var _wpPluploadSettings = ' . json_encode( $settings ) . ';';
$data = $wp_scripts->get_data( 'wp-plupload', 'data' );
if ( $data )
$script = "$data\n$script";