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

git-svn-id: https://develop.svn.wordpress.org/trunk@22488 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin 2012-11-09 04:51:25 +00:00
parent bb3dccd180
commit 97490d8911
1 changed files with 4 additions and 1 deletions

View File

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