web/wp-includes/script-loader.php
branchwordpress
changeset 132 4d4862461b8d
parent 109 03b0d1493584
equal deleted inserted replaced
131:a4642baaf829 132:4d4862461b8d
     6  * {@link http://backpress.automattic.com/ BackPress}. WordPress themes and
     6  * {@link http://backpress.automattic.com/ BackPress}. WordPress themes and
     7  * plugins will only be concerned about the filters and actions set in this
     7  * plugins will only be concerned about the filters and actions set in this
     8  * file.
     8  * file.
     9  *
     9  *
    10  * Several constants are used to manage the loading, concatenating and compression of scripts and CSS:
    10  * Several constants are used to manage the loading, concatenating and compression of scripts and CSS:
    11  * define('SCRIPT_DEBUG', true); loads the development (non-minified) versions of all scripts and disables compression and concatenation
    11  * define('SCRIPT_DEBUG', true); loads the development (non-minified) versions of all scripts and disables compression and concatenation,
    12  * define('CONCATENATE_SCRIPTS', false); disables compression and concatenation,
    12  * define('STYLE_DEBUG', true); loads the development (non-minified) versions of all CSS and disables compression and concatenation,
       
    13  * define('CONCATENATE_SCRIPTS', false); disables compression and concatenation of scripts and CSS,
    13  * define('COMPRESS_SCRIPTS', false); disables compression of scripts,
    14  * define('COMPRESS_SCRIPTS', false); disables compression of scripts,
    14  * define('COMPRESS_CSS', false); disables compression of CSS,
    15  * define('COMPRESS_CSS', false); disables compression of CSS,
    15  * define('ENFORCE_GZIP', true); forces gzip for compression (default is deflate).
    16  * define('ENFORCE_GZIP', true); forces gzip for compression (default is deflate).
    16  *
    17  *
    17  * The globals $concatenate_scripts, $compress_scripts and $compress_css can be set by plugins
    18  * The globals $concatenate_scripts, $compress_scripts and $compress_css can be set by plugins
    58 
    59 
    59 	$suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '.dev' : '';
    60 	$suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '.dev' : '';
    60 
    61 
    61 	$scripts->add( 'utils', "/wp-admin/js/utils$suffix.js", false, '20090102' );
    62 	$scripts->add( 'utils', "/wp-admin/js/utils$suffix.js", false, '20090102' );
    62 
    63 
    63 	$scripts->add( 'common', "/wp-admin/js/common$suffix.js", array('jquery', 'hoverIntent', 'utils'), '20090609' );
    64 	$scripts->add( 'common', "/wp-admin/js/common$suffix.js", array('jquery', 'hoverIntent', 'utils'), '20091212' );
    64 	$scripts->add_data( 'common', 'group', 1 );
    65 	$scripts->add_data( 'common', 'group', 1 );
    65 	$scripts->localize( 'common', 'commonL10n', array(
    66 	$scripts->localize( 'common', 'commonL10n', array(
    66 		'warnDelete' => __("You are about to delete the selected items.\n  'Cancel' to stop, 'OK' to delete."),
    67 		'warnDelete' => __("You are about to permanently delete the selected items.\n  'Cancel' to stop, 'OK' to delete."),
    67 		'l10n_print_after' => 'try{convertEntities(commonL10n);}catch(e){};'
    68 		'l10n_print_after' => 'try{convertEntities(commonL10n);}catch(e){};'
    68 	) );
    69 	) );
    69 
    70 
    70 	$scripts->add( 'sack', "/wp-includes/js/tw-sack$suffix.js", false, '1.6.1' );
    71 	$scripts->add( 'sack', "/wp-includes/js/tw-sack$suffix.js", false, '1.6.1' );
    71 	$scripts->add_data( 'sack', 'group', 1 );
    72 	$scripts->add_data( 'sack', 'group', 1 );
    84 		'l10n_print_after' => 'try{convertEntities(quicktagsL10n);}catch(e){};'
    85 		'l10n_print_after' => 'try{convertEntities(quicktagsL10n);}catch(e){};'
    85 	) );
    86 	) );
    86 
    87 
    87 	$scripts->add( 'colorpicker', "/wp-includes/js/colorpicker$suffix.js", array('prototype'), '3517m' );
    88 	$scripts->add( 'colorpicker', "/wp-includes/js/colorpicker$suffix.js", array('prototype'), '3517m' );
    88 
    89 
    89 	$scripts->add( 'editor', "/wp-admin/js/editor$suffix.js", false, '20090503' );
    90 	$scripts->add( 'editor', "/wp-admin/js/editor$suffix.js", false, '20091124' );
    90 
    91 
    91 	$scripts->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.6');
    92 	$scripts->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.6');
    92 
    93 
    93 	$scripts->add( 'wp-ajax-response', "/wp-includes/js/wp-ajax-response$suffix.js", array('jquery'), '20090128' );
    94 	$scripts->add( 'wp-ajax-response', "/wp-includes/js/wp-ajax-response$suffix.js", array('jquery'), '20091119' );
    94 	$scripts->add_data( 'wp-ajax-response', 'group', 1 );
    95 	$scripts->add_data( 'wp-ajax-response', 'group', 1 );
    95 	$scripts->localize( 'wp-ajax-response', 'wpAjax', array(
    96 	$scripts->localize( 'wp-ajax-response', 'wpAjax', array(
    96 		'noPerm' => __('You do not have permission to do that.'),
    97 		'noPerm' => __('You do not have permission to do that.'),
    97 		'broken' => __('An unidentified error has occurred.'),
    98 		'broken' => __('An unidentified error has occurred.'),
    98 		'l10n_print_after' => 'try{convertEntities(wpAjax);}catch(e){};'
    99 		'l10n_print_after' => 'try{convertEntities(wpAjax);}catch(e){};'
    99 	) );
   100 	) );
   100 
   101 
   101 	$scripts->add( 'autosave', "/wp-includes/js/autosave$suffix.js", array('schedule', 'wp-ajax-response'), '20090526' );
   102 	$scripts->add( 'autosave', "/wp-includes/js/autosave$suffix.js", array('schedule', 'wp-ajax-response'), '20091012' );
   102 	$scripts->add_data( 'autosave', 'group', 1 );
   103 	$scripts->add_data( 'autosave', 'group', 1 );
   103 
   104 
   104 	$scripts->add( 'wp-lists', "/wp-includes/js/wp-lists$suffix.js", array('wp-ajax-response'), '20090504' );
   105 	$scripts->add( 'wp-lists', "/wp-includes/js/wp-lists$suffix.js", array('wp-ajax-response'), '20091128' );
   105 	$scripts->add_data( 'wp-lists', 'group', 1 );
   106 	$scripts->add_data( 'wp-lists', 'group', 1 );
   106 	$scripts->localize( 'wp-lists', 'wpListL10n', array(
       
   107 		'url' => admin_url('admin-ajax.php')
       
   108 	) );
       
   109 
   107 
   110 	$scripts->add( 'scriptaculous-root', '/wp-includes/js/scriptaculous/wp-scriptaculous.js', array('prototype'), '1.8.0');
   108 	$scripts->add( 'scriptaculous-root', '/wp-includes/js/scriptaculous/wp-scriptaculous.js', array('prototype'), '1.8.0');
   111 	$scripts->add( 'scriptaculous-builder', '/wp-includes/js/scriptaculous/builder.js', array('scriptaculous-root'), '1.8.0');
   109 	$scripts->add( 'scriptaculous-builder', '/wp-includes/js/scriptaculous/builder.js', array('scriptaculous-root'), '1.8.0');
   112 	$scripts->add( 'scriptaculous-dragdrop', '/wp-includes/js/scriptaculous/dragdrop.js', array('scriptaculous-builder', 'scriptaculous-effects'), '1.8.0');
   110 	$scripts->add( 'scriptaculous-dragdrop', '/wp-includes/js/scriptaculous/dragdrop.js', array('scriptaculous-builder', 'scriptaculous-effects'), '1.8.0');
   113 	$scripts->add( 'scriptaculous-effects', '/wp-includes/js/scriptaculous/effects.js', array('scriptaculous-root'), '1.8.0');
   111 	$scripts->add( 'scriptaculous-effects', '/wp-includes/js/scriptaculous/effects.js', array('scriptaculous-root'), '1.8.0');
   114 	$scripts->add( 'scriptaculous-slider', '/wp-includes/js/scriptaculous/slider.js', array('scriptaculous-effects'), '1.8.0');
   112 	$scripts->add( 'scriptaculous-slider', '/wp-includes/js/scriptaculous/slider.js', array('scriptaculous-effects'), '1.8.0');
   115 	$scripts->add( 'scriptaculous-sound', '/wp-includes/js/scriptaculous/sound.js', array( 'scriptaculous-root' ), '1.8.0' );
   113 	$scripts->add( 'scriptaculous-sound', '/wp-includes/js/scriptaculous/sound.js', array( 'scriptaculous-root' ), '1.8.0' );
   116 	$scripts->add( 'scriptaculous-controls', '/wp-includes/js/scriptaculous/controls.js', array('scriptaculous-root'), '1.8.0');
   114 	$scripts->add( 'scriptaculous-controls', '/wp-includes/js/scriptaculous/controls.js', array('scriptaculous-root'), '1.8.0');
   117 	$scripts->add( 'scriptaculous', '', array('scriptaculous-dragdrop', 'scriptaculous-slider', 'scriptaculous-controls'), '1.8.0');
   115 	$scripts->add( 'scriptaculous', '', array('scriptaculous-dragdrop', 'scriptaculous-slider', 'scriptaculous-controls'), '1.8.0');
   118 
   116 
       
   117 	// not used in core, replaced by Jcrop.js
   119 	$scripts->add( 'cropper', '/wp-includes/js/crop/cropper.js', array('scriptaculous-dragdrop'), '20070118');
   118 	$scripts->add( 'cropper', '/wp-includes/js/crop/cropper.js', array('scriptaculous-dragdrop'), '20070118');
   120 
   119 
   121 	$scripts->add( 'jquery', '/wp-includes/js/jquery/jquery.js', false, '1.3.2');
   120 	$scripts->add( 'jquery', '/wp-includes/js/jquery/jquery.js', false, '1.3.2');
   122 
   121 
   123 	$scripts->add( 'jquery-ui-core', '/wp-includes/js/jquery/ui.core.js', array('jquery'), '1.7.1' );
   122 	$scripts->add( 'jquery-ui-core', '/wp-includes/js/jquery/ui.core.js', array('jquery'), '1.7.1' );
   142 	$scripts->add_data( 'jquery-ui-resizable', 'group', 1 );
   141 	$scripts->add_data( 'jquery-ui-resizable', 'group', 1 );
   143 
   142 
   144 	$scripts->add( 'jquery-ui-dialog', '/wp-includes/js/jquery/ui.dialog.js', array('jquery-ui-resizable', 'jquery-ui-draggable'), '1.7.1' );
   143 	$scripts->add( 'jquery-ui-dialog', '/wp-includes/js/jquery/ui.dialog.js', array('jquery-ui-resizable', 'jquery-ui-draggable'), '1.7.1' );
   145 	$scripts->add_data( 'jquery-ui-dialog', 'group', 1 );
   144 	$scripts->add_data( 'jquery-ui-dialog', 'group', 1 );
   146 
   145 
       
   146 	// deprecated, not used in core, most functionality is included in jQuery 1.3
   147 	$scripts->add( 'jquery-form', "/wp-includes/js/jquery/jquery.form$suffix.js", array('jquery'), '2.02m');
   147 	$scripts->add( 'jquery-form', "/wp-includes/js/jquery/jquery.form$suffix.js", array('jquery'), '2.02m');
   148 	$scripts->add_data( 'jquery-form', 'group', 1 );
   148 	$scripts->add_data( 'jquery-form', 'group', 1 );
   149 
   149 
   150 	$scripts->add( 'jquery-color', "/wp-includes/js/jquery/jquery.color$suffix.js", array('jquery'), '2.0-4561m');
   150 	$scripts->add( 'jquery-color', "/wp-includes/js/jquery/jquery.color$suffix.js", array('jquery'), '2.0-4561m');
   151 	$scripts->add_data( 'jquery-color', 'group', 1 );
   151 	$scripts->add_data( 'jquery-color', 'group', 1 );
   152 
   152 
       
   153 	// deprecated, not used in core
   153 	$scripts->add( 'interface', '/wp-includes/js/jquery/interface.js', array('jquery'), '1.2' );
   154 	$scripts->add( 'interface', '/wp-includes/js/jquery/interface.js', array('jquery'), '1.2' );
   154 
   155 
   155 	$scripts->add( 'suggest', "/wp-includes/js/jquery/suggest$suffix.js", array('jquery'), '1.1-20090125');
   156 	$scripts->add( 'suggest', "/wp-includes/js/jquery/suggest$suffix.js", array('jquery'), '1.1-20090125');
   156 	$scripts->add_data( 'suggest', 'group', 1 );
   157 	$scripts->add_data( 'suggest', 'group', 1 );
   157 
   158 
   162 	$scripts->add_data( 'jquery-hotkeys', 'group', 1 );
   163 	$scripts->add_data( 'jquery-hotkeys', 'group', 1 );
   163 
   164 
   164 	$scripts->add( 'jquery-table-hotkeys', "/wp-includes/js/jquery/jquery.table-hotkeys$suffix.js", array('jquery', 'jquery-hotkeys'), '20090102' );
   165 	$scripts->add( 'jquery-table-hotkeys', "/wp-includes/js/jquery/jquery.table-hotkeys$suffix.js", array('jquery', 'jquery-hotkeys'), '20090102' );
   165 	$scripts->add_data( 'jquery-table-hotkeys', 'group', 1 );
   166 	$scripts->add_data( 'jquery-table-hotkeys', 'group', 1 );
   166 
   167 
   167 	$scripts->add( 'thickbox', "/wp-includes/js/thickbox/thickbox.js", array('jquery'), '3.1-20090123');
   168 	$scripts->add( 'thickbox', "/wp-includes/js/thickbox/thickbox.js", array('jquery'), '3.1-20091124');
   168 	$scripts->add_data( 'thickbox', 'group', 1 );
   169 	$scripts->add_data( 'thickbox', 'group', 1 );
       
   170 	$scripts->localize( 'thickbox', 'thickboxL10n', array(
       
   171 			'next' => __('Next >'),
       
   172 			'prev' => __('< Prev'),
       
   173 			'image' => __('Image'),
       
   174 			'of' => __('of'),
       
   175 			'close' => __('Close'),
       
   176 			'l10n_print_after' => 'try{convertEntities(thickboxL10n);}catch(e){};'
       
   177 	) );
       
   178 	
   169 
   179 
   170 	$scripts->add( 'jcrop', "/wp-includes/js/jcrop/jquery.Jcrop$suffix.js", array('jquery'), '0.9.8');
   180 	$scripts->add( 'jcrop', "/wp-includes/js/jcrop/jquery.Jcrop$suffix.js", array('jquery'), '0.9.8');
   171 
   181 
   172 	$scripts->add( 'swfobject', "/wp-includes/js/swfobject.js", false, '2.1');
   182 	$scripts->add( 'swfobject', "/wp-includes/js/swfobject.js", false, '2.1');
   173 
   183 
   181 		$scripts->add( 'swfupload-all', false, array('swfupload', 'swfupload-swfobject', 'swfupload-queue'), '2201');
   191 		$scripts->add( 'swfupload-all', false, array('swfupload', 'swfupload-swfobject', 'swfupload-queue'), '2201');
   182 	} else {
   192 	} else {
   183 		$scripts->add( 'swfupload-all', '/wp-includes/js/swfupload/swfupload-all.js', array(), '2201');
   193 		$scripts->add( 'swfupload-all', '/wp-includes/js/swfupload/swfupload-all.js', array(), '2201');
   184 	}
   194 	}
   185 
   195 
   186 	$scripts->add( 'swfupload-handlers', "/wp-includes/js/swfupload/handlers$suffix.js", array('swfupload-all', 'jquery'), '2201-20090515');
   196 	$scripts->add( 'swfupload-handlers', "/wp-includes/js/swfupload/handlers$suffix.js", array('swfupload-all', 'jquery'), '2201-20091208');
       
   197 	$max_upload_size = ( (int) ( $max_up = @ini_get('upload_max_filesize') ) < (int) ( $max_post = @ini_get('post_max_size') ) ) ? $max_up : $max_post;
       
   198 	if ( empty($max_upload_size) )
       
   199 		$max_upload_size = __('not configured');
   187 	// these error messages came from the sample swfupload js, they might need changing.
   200 	// these error messages came from the sample swfupload js, they might need changing.
   188 	$scripts->localize( 'swfupload-handlers', 'swfuploadL10n', array(
   201 	$scripts->localize( 'swfupload-handlers', 'swfuploadL10n', array(
   189 			'queue_limit_exceeded' => __('You have attempted to queue too many files.'),
   202 			'queue_limit_exceeded' => __('You have attempted to queue too many files.'),
   190 			'file_exceeds_size_limit' => sprintf(__('This file is too big. Your php.ini upload_max_filesize is %s.'), @ini_get('upload_max_filesize')),
   203 			'file_exceeds_size_limit' => sprintf( __('This file is too big. The maximum upload size for your server is %s.'), $max_upload_size ),
   191 			'zero_byte_file' => __('This file is empty. Please try another.'),
   204 			'zero_byte_file' => __('This file is empty. Please try another.'),
   192 			'invalid_filetype' => __('This file type is not allowed. Please try another.'),
   205 			'invalid_filetype' => __('This file type is not allowed. Please try another.'),
   193 			'default_error' => __('An error occurred in the upload. Please try again later.'),
   206 			'default_error' => __('An error occurred in the upload. Please try again later.'),
   194 			'missing_upload_url' => __('There was a configuration error. Please contact the server administrator.'),
   207 			'missing_upload_url' => __('There was a configuration error. Please contact the server administrator.'),
   195 			'upload_limit_exceeded' => __('You may only upload 1 file.'),
   208 			'upload_limit_exceeded' => __('You may only upload 1 file.'),
   199 			'security_error' => __('Security error.'),
   212 			'security_error' => __('Security error.'),
   200 			'file_cancelled' => __('File cancelled.'),
   213 			'file_cancelled' => __('File cancelled.'),
   201 			'upload_stopped' => __('Upload stopped.'),
   214 			'upload_stopped' => __('Upload stopped.'),
   202 			'dismiss' => __('Dismiss'),
   215 			'dismiss' => __('Dismiss'),
   203 			'crunching' => __('Crunching&hellip;'),
   216 			'crunching' => __('Crunching&hellip;'),
   204 			'deleted' => __('Deleted'),
   217 			'deleted' => __('moved to the trash.'),
   205 			'l10n_print_after' => 'try{convertEntities(swfuploadL10n);}catch(e){};'
   218 			'l10n_print_after' => 'try{convertEntities(swfuploadL10n);}catch(e){};'
   206 	) );
   219 	) );
   207 
   220 
   208 	$scripts->add( 'comment-reply', "/wp-includes/js/comment-reply$suffix.js", false, '20090102');
   221 	$scripts->add( 'comment-reply', "/wp-includes/js/comment-reply$suffix.js", false, '20090102');
       
   222 
       
   223 	$scripts->add( 'json2', "/wp-includes/js/json2$suffix.js", false, '20090817');
       
   224 
       
   225 	$scripts->add( 'imgareaselect', "/wp-includes/js/imgareaselect/jquery.imgareaselect$suffix.js", array('jquery'), '0.9.1' );
       
   226 	$scripts->add_data( 'imgareaselect', 'group', 1 );
   209 
   227 
   210 	if ( is_admin() ) {
   228 	if ( is_admin() ) {
   211 		$scripts->add( 'ajaxcat', "/wp-admin/js/cat$suffix.js", array( 'wp-lists' ), '20090102' );
   229 		$scripts->add( 'ajaxcat', "/wp-admin/js/cat$suffix.js", array( 'wp-lists' ), '20090102' );
   212 		$scripts->add_data( 'ajaxcat', 'group', 1 );
   230 		$scripts->add_data( 'ajaxcat', 'group', 1 );
   213 		$scripts->localize( 'ajaxcat', 'catL10n', array(
   231 		$scripts->localize( 'ajaxcat', 'catL10n', array(
   214 			'add' => esc_attr(__('Add')),
   232 			'add' => esc_attr(__('Add')),
   215 			'how' => __('Separate multiple categories with commas.'),
   233 			'how' => __('Separate multiple categories with commas.'),
   216 			'l10n_print_after' => 'try{convertEntities(catL10n);}catch(e){};'
   234 			'l10n_print_after' => 'try{convertEntities(catL10n);}catch(e){};'
   217 		) );
   235 		) );
   218 
   236 
   219 		$scripts->add( 'admin-categories', "/wp-admin/js/categories$suffix.js", array('wp-lists'), '20090207' );
   237 		$scripts->add( 'admin-categories', "/wp-admin/js/categories$suffix.js", array('wp-lists'), '20091201' );
   220 		$scripts->add_data( 'admin-categories', 'group', 1 );
   238 		$scripts->add_data( 'admin-categories', 'group', 1 );
   221 
   239 
   222 		$scripts->add( 'admin-tags', "/wp-admin/js/tags$suffix.js", array('wp-lists'), '20090211' );
   240 		$scripts->add( 'admin-tags', "/wp-admin/js/tags$suffix.js", array('jquery'), '20090623' );
   223 		$scripts->add_data( 'admin-tags', 'group', 1 );
   241 		$scripts->add_data( 'admin-tags', 'group', 1 );
       
   242 		$scripts->localize( 'admin-tags', 'tagsl10n', array(
       
   243 			'noPerm' => __('You do not have permission to do that.'),
       
   244 			'broken' => __('An unidentified error has occurred.'),
       
   245 			'l10n_print_after' => 'try{convertEntities(tagsl10n);}catch(e){};'
       
   246 		));
   224 
   247 
   225 		$scripts->add( 'admin-custom-fields', "/wp-admin/js/custom-fields$suffix.js", array('wp-lists'), '20090106' );
   248 		$scripts->add( 'admin-custom-fields', "/wp-admin/js/custom-fields$suffix.js", array('wp-lists'), '20090106' );
   226 		$scripts->add_data( 'admin-custom-fields', 'group', 1 );
   249 		$scripts->add_data( 'admin-custom-fields', 'group', 1 );
   227 
   250 
   228 		$scripts->add( 'password-strength-meter', "/wp-admin/js/password-strength-meter$suffix.js", array('jquery'), '20090102' );
   251 		$scripts->add( 'password-strength-meter', "/wp-admin/js/password-strength-meter$suffix.js", array('jquery'), '20090102' );
   238 		) );
   261 		) );
   239 
   262 
   240 		$scripts->add( 'user-profile', "/wp-admin/js/user-profile$suffix.js", array('jquery'), '20090514' );
   263 		$scripts->add( 'user-profile', "/wp-admin/js/user-profile$suffix.js", array('jquery'), '20090514' );
   241 		$scripts->add_data( 'user-profile', 'group', 1 );
   264 		$scripts->add_data( 'user-profile', 'group', 1 );
   242 
   265 
   243 		$scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array('wp-lists', 'jquery-ui-resizable', 'quicktags'), '20090627' );
   266 		$scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array('wp-lists', 'jquery-ui-resizable', 'quicktags'), '20091129' );
   244 		$scripts->add_data( 'admin-comments', 'group', 1 );
   267 		$scripts->add_data( 'admin-comments', 'group', 1 );
   245 		$scripts->localize( 'admin-comments', 'adminCommentsL10n', array(
   268 		$scripts->localize( 'admin-comments', 'adminCommentsL10n', array(
   246 			'hotkeys_highlight_first' => isset($_GET['hotkeys_highlight_first']),
   269 			'hotkeys_highlight_first' => isset($_GET['hotkeys_highlight_first']),
   247 			'hotkeys_highlight_last' => isset($_GET['hotkeys_highlight_last'])
   270 			'hotkeys_highlight_last' => isset($_GET['hotkeys_highlight_last'])
   248 		) );
   271 		) );
   249 
   272 
   250 		$scripts->add( 'xfn', "/wp-admin/js/xfn$suffix.js", false, '3517m' );
   273 		$scripts->add( 'xfn', "/wp-admin/js/xfn$suffix.js", false, '3517m' );
   251 
   274 
   252 		$scripts->add( 'postbox', "/wp-admin/js/postbox$suffix.js", array('jquery-ui-sortable'), '20090618' );
   275 		$scripts->add( 'postbox', "/wp-admin/js/postbox$suffix.js", array('jquery-ui-sortable'), '20091012' );
   253 		$scripts->add_data( 'postbox', 'group', 1 );
   276 		$scripts->add_data( 'postbox', 'group', 1 );
   254 		$scripts->localize( 'postbox', 'postboxL10n', array(
   277 
   255 			'requestFile' => admin_url('admin-ajax.php')
   278 		$scripts->add( 'post', "/wp-admin/js/post$suffix.js", array('suggest', 'wp-lists', 'postbox'), '20091208' );
   256 		) );
       
   257 
       
   258 		$scripts->add( 'slug', "/wp-admin/js/slug$suffix.js", array('jquery'), '20090207' );
       
   259 		$scripts->add_data( 'slug', 'group', 1 );
       
   260 		$scripts->localize( 'slug', 'slugL10n', array(
       
   261 			'requestFile' => admin_url('admin-ajax.php'),
       
   262 			'save' => __('Save'),
       
   263 			'cancel' => __('Cancel'),
       
   264 			'l10n_print_after' => 'try{convertEntities(slugL10n);}catch(e){};'
       
   265 		) );
       
   266 
       
   267 		$scripts->add( 'post', "/wp-admin/js/post$suffix.js", array('suggest', 'wp-lists', 'postbox', 'slug'), '20090624' );
       
   268 		$scripts->add_data( 'post', 'group', 1 );
   279 		$scripts->add_data( 'post', 'group', 1 );
   269 		$scripts->localize( 'post', 'postL10n', array(
   280 		$scripts->localize( 'post', 'postL10n', array(
   270 			'tagsUsed' =>  __('Tags used on this post:'),
   281 			'tagsUsed' =>  __('Tags used on this post:'),
   271 			'add' => esc_attr(__('Add')),
   282 			'add' => esc_attr(__('Add')),
   272 			'addTag' => esc_attr(__('Add new tag')),
   283 			'addTag' => esc_attr(__('Add new tag')),
   273 			'separate' => __('Separate tags with commas'),
   284 			'separate' => __('Separate tags with commas'),
       
   285 			'ok' => __('OK'),
   274 			'cancel' => __('Cancel'),
   286 			'cancel' => __('Cancel'),
   275 			'edit' => __('Edit'),
   287 			'edit' => __('Edit'),
   276 			'publishOn' => __('Publish on:'),
   288 			'publishOn' => __('Publish on:'),
   277 			'publishOnFuture' =>  __('Schedule for:'),
   289 			'publishOnFuture' =>  __('Schedule for:'),
   278 			'publishOnPast' => __('Published on:'),
   290 			'publishOnPast' => __('Published on:'),
   279 			'showcomm' => __('Show more comments'),
   291 			'showcomm' => __('Show more comments'),
   280 			'endcomm' => __('No more comments found.'),
   292 			'endcomm' => __('No more comments found.'),
   281 			'publish' => __('Publish'),
   293 			'publish' => __('Publish'),
   282 			'schedule' => __('Schedule'),
   294 			'schedule' => __('Schedule'),
   283 			'update' => __('Update Post'),
   295 			'updatePost' => __('Update Post'),
       
   296 			'updatePage' => __('Update Page'),
   284 			'savePending' => __('Save as Pending'),
   297 			'savePending' => __('Save as Pending'),
   285 			'saveDraft' => __('Save Draft'),
   298 			'saveDraft' => __('Save Draft'),
   286 			'private' => __('Private'),
   299 			'private' => __('Private'),
   287 			'public' => __('Public'),
   300 			'public' => __('Public'),
   288 			'publicSticky' => __('Public, Sticky'),
   301 			'publicSticky' => __('Public, Sticky'),
   290 			'privatelyPublished' => __('Privately Published'),
   303 			'privatelyPublished' => __('Privately Published'),
   291 			'published' => __('Published'),
   304 			'published' => __('Published'),
   292 			'l10n_print_after' => 'try{convertEntities(postL10n);}catch(e){};'
   305 			'l10n_print_after' => 'try{convertEntities(postL10n);}catch(e){};'
   293 		) );
   306 		) );
   294 
   307 
   295 		$scripts->add( 'page', "/wp-admin/js/page$suffix.js", array('jquery', 'slug', 'wp-lists', 'postbox'), '20090526' );
       
   296 		$scripts->add_data( 'page', 'group', 1 );
       
   297 		$scripts->localize( 'page', 'postL10n', array(
       
   298 			'cancel' => __('Cancel'),
       
   299 			'edit' => __('Edit'),
       
   300 			'publishOn' => __('Publish on:'),
       
   301 			'publishOnFuture' =>  __('Schedule for:'),
       
   302 			'publishOnPast' => __('Published on:'),
       
   303 			'showcomm' => __('Show more comments'),
       
   304 			'endcomm' => __('No more comments found.'),
       
   305 			'publish' => __('Publish'),
       
   306 			'schedule' => __('Schedule'),
       
   307 			'update' => __('Update Page'),
       
   308 			'savePending' => __('Save as Pending'),
       
   309 			'saveDraft' => __('Save Draft'),
       
   310 			'private' => __('Private'),
       
   311 			'public' => __('Public'),
       
   312 			'password' => __('Password Protected'),
       
   313 			'privatelyPublished' => __('Privately Published'),
       
   314 			'published' => __('Published'),
       
   315 			'l10n_print_after' => 'try{convertEntities(postL10n);}catch(e){};'
       
   316 		) );
       
   317 
       
   318 		$scripts->add( 'link', "/wp-admin/js/link$suffix.js", array('wp-lists', 'postbox'), '20090506' );
   308 		$scripts->add( 'link', "/wp-admin/js/link$suffix.js", array('wp-lists', 'postbox'), '20090506' );
   319 		$scripts->add_data( 'link', 'group', 1 );
   309 		$scripts->add_data( 'link', 'group', 1 );
   320 
   310 
   321 		$scripts->add( 'comment', "/wp-admin/js/comment$suffix.js", array('jquery'), '20090102' );
   311 		$scripts->add( 'comment', "/wp-admin/js/comment$suffix.js", array('jquery'), '20091202' );
   322 		$scripts->add_data( 'comment', 'group', 1 );
   312 		$scripts->add_data( 'comment', 'group', 1 );
   323 		$scripts->localize( 'comment', 'commentL10n', array(
   313 		$scripts->localize( 'comment', 'commentL10n', array(
   324 			'cancel' => __('Cancel'),
   314 			'cancel' => __('Cancel'),
   325 			'edit' => __('Edit'),
   315 			'edit' => __('Edit'),
   326 			'submittedOn' => __('Submitted on:'),
   316 			'submittedOn' => __('Submitted on:'),
   327 			'l10n_print_after' => 'try{convertEntities(commentL10n);}catch(e){};'
   317 			'l10n_print_after' => 'try{convertEntities(commentL10n);}catch(e){};'
   328 		) );
   318 		) );
   329 
   319 
   330 		$scripts->add( 'admin-gallery', "/wp-admin/js/gallery$suffix.js", array( 'jquery-ui-sortable' ), '20090516' );
   320 		$scripts->add( 'admin-gallery', "/wp-admin/js/gallery$suffix.js", array( 'jquery-ui-sortable' ), '20090516' );
   331 
   321 
   332 		$scripts->add( 'media-upload', "/wp-admin/js/media-upload$suffix.js", array( 'thickbox' ), '20090114' );
   322 		$scripts->add( 'media-upload', "/wp-admin/js/media-upload$suffix.js", array( 'thickbox' ), '20091023' );
   333 		$scripts->add_data( 'media-upload', 'group', 1 );
   323 		$scripts->add_data( 'media-upload', 'group', 1 );
   334 
   324 
   335 		$scripts->add( 'admin-widgets', "/wp-admin/js/widgets$suffix.js", array( 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable' ), '20090601' );
   325 		$scripts->add( 'admin-widgets', "/wp-admin/js/widgets$suffix.js", array( 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable' ), '20090824' );
   336 		$scripts->add_data( 'admin-widgets', 'group', 1 );
   326 		$scripts->add_data( 'admin-widgets', 'group', 1 );
   337 
   327 
   338 		$scripts->add( 'word-count', "/wp-admin/js/word-count$suffix.js", array( 'jquery' ), '20090422' );
   328 		$scripts->add( 'word-count', "/wp-admin/js/word-count$suffix.js", array( 'jquery' ), '20090422' );
   339 		$scripts->add_data( 'word-count', 'group', 1 );
   329 		$scripts->add_data( 'word-count', 'group', 1 );
   340 		$scripts->localize( 'word-count', 'wordCountL10n', array(
   330 		$scripts->localize( 'word-count', 'wordCountL10n', array(
   341 			'count' => __('Word count: %d'),
   331 			'count' => __('Word count: %d'),
   342 			'l10n_print_after' => 'try{convertEntities(wordCountL10n);}catch(e){};'
   332 			'l10n_print_after' => 'try{convertEntities(wordCountL10n);}catch(e){};'
   343 		));
   333 		));
   344 
   334 
   345 		$scripts->add( 'wp-gears', "/wp-admin/js/wp-gears$suffix.js", false, '20090102' );
   335 		$scripts->add( 'wp-gears', "/wp-admin/js/wp-gears$suffix.js", false, '20090717' );
   346 		$scripts->localize( 'wp-gears', 'wpGearsL10n', array(
   336 		$scripts->localize( 'wp-gears', 'wpGearsL10n', array(
   347 			'updateCompleted' => __('Update completed.'),
   337 			'updateCompleted' => __('Update completed.'),
   348 			'error' => __('Error:'),
   338 			'error' => __('Error:'),
   349 			'l10n_print_after' => 'try{convertEntities(wpGearsL10n);}catch(e){};'
   339 			'l10n_print_after' => 'try{convertEntities(wpGearsL10n);}catch(e){};'
   350 		));
   340 		));
   351 
   341 
   352 		$scripts->add( 'theme-preview', "/wp-admin/js/theme-preview$suffix.js", array( 'thickbox', 'jquery' ), '20090319' );
   342 		$scripts->add( 'theme-preview', "/wp-admin/js/theme-preview$suffix.js", array( 'thickbox', 'jquery' ), '20090319' );
   353 		$scripts->add_data( 'theme-preview', 'group', 1 );
   343 		$scripts->add_data( 'theme-preview', 'group', 1 );
   354 
   344 
   355 		$scripts->add( 'inline-edit-post', "/wp-admin/js/inline-edit-post$suffix.js", array( 'jquery-form', 'suggest' ), '20090125' );
   345 		$scripts->add( 'inline-edit-post', "/wp-admin/js/inline-edit-post$suffix.js", array( 'jquery', 'suggest' ), '20091202' );
   356 		$scripts->add_data( 'inline-edit-post', 'group', 1 );
   346 		$scripts->add_data( 'inline-edit-post', 'group', 1 );
   357 		$scripts->localize( 'inline-edit-post', 'inlineEditL10n', array(
   347 		$scripts->localize( 'inline-edit-post', 'inlineEditL10n', array(
   358 			'error' => __('Error while saving the changes.'),
   348 			'error' => __('Error while saving the changes.'),
   359 			'ntdeltitle' => __('Remove From Bulk Edit'),
   349 			'ntdeltitle' => __('Remove From Bulk Edit'),
   360 			'notitle' => __('(no title)'),
   350 			'notitle' => __('(no title)'),
   361 			'l10n_print_after' => 'try{convertEntities(inlineEditL10n);}catch(e){};'
   351 			'l10n_print_after' => 'try{convertEntities(inlineEditL10n);}catch(e){};'
   362 		) );
   352 		) );
   363 
   353 
   364 		$scripts->add( 'inline-edit-tax', "/wp-admin/js/inline-edit-tax$suffix.js", array( 'jquery-form' ), '20090211' );
   354 		$scripts->add( 'inline-edit-tax', "/wp-admin/js/inline-edit-tax$suffix.js", array( 'jquery' ), '20090623' );
   365 		$scripts->add_data( 'inline-edit-tax', 'group', 1 );
   355 		$scripts->add_data( 'inline-edit-tax', 'group', 1 );
   366 		$scripts->localize( 'inline-edit-tax', 'inlineEditL10n', array(
   356 		$scripts->localize( 'inline-edit-tax', 'inlineEditL10n', array(
   367 			'error' => __('Error while saving the changes.'),
   357 			'error' => __('Error while saving the changes.'),
   368 			'l10n_print_after' => 'try{convertEntities(inlineEditL10n);}catch(e){};'
   358 			'l10n_print_after' => 'try{convertEntities(inlineEditL10n);}catch(e){};'
   369 		) );
   359 		) );
   386 		$scripts->add( 'media', "/wp-admin/js/media$suffix.js", array( 'jquery-ui-draggable' ), '20090415' );
   376 		$scripts->add( 'media', "/wp-admin/js/media$suffix.js", array( 'jquery-ui-draggable' ), '20090415' );
   387 		$scripts->add_data( 'media', 'group', 1 );
   377 		$scripts->add_data( 'media', 'group', 1 );
   388 
   378 
   389 		$scripts->add( 'codepress', '/wp-includes/js/codepress/codepress.js', false, '0.9.6' );
   379 		$scripts->add( 'codepress', '/wp-includes/js/codepress/codepress.js', false, '0.9.6' );
   390 		$scripts->add_data( 'codepress', 'group', 1 );
   380 		$scripts->add_data( 'codepress', 'group', 1 );
       
   381 
       
   382 		$scripts->add( 'image-edit', "/wp-admin/js/image-edit$suffix.js", array('jquery', 'json2', 'imgareaselect'), '20091111' );
       
   383 		$scripts->add_data( 'image-edit', 'group', 1 );
       
   384 
       
   385 		$scripts->add( 'set-post-thumbnail', "/wp-admin/js/set-post-thumbnail$suffix.js", array( 'jquery' ), '20091210b' );
       
   386 		$scripts->add_data( 'set-post-thumbnail', 'group', 1 );
       
   387 		$scripts->localize( 'set-post-thumbnail', 'setPostThumbnailL10n', array(
       
   388 			'setThumbnail' => __( 'Use as thumbnail' ),
       
   389 			'saving' => __( 'Saving...' ),
       
   390 			'error' => __( 'Could not set that as the thumbnail image. Try a different attachment.' ),
       
   391 			'done' => __( 'Done' )
       
   392 		) );
       
   393 
   391 	}
   394 	}
   392 }
   395 }
   393 
   396 
   394 /**
   397 /**
   395  * Assign default styles to $styles object.
   398  * Assign default styles to $styles object.
   416 	$styles->content_url = defined('WP_CONTENT_URL')? WP_CONTENT_URL : '';
   419 	$styles->content_url = defined('WP_CONTENT_URL')? WP_CONTENT_URL : '';
   417 	$styles->default_version = get_bloginfo( 'version' );
   420 	$styles->default_version = get_bloginfo( 'version' );
   418 	$styles->text_direction = 'rtl' == get_bloginfo( 'text_direction' ) ? 'rtl' : 'ltr';
   421 	$styles->text_direction = 'rtl' == get_bloginfo( 'text_direction' ) ? 'rtl' : 'ltr';
   419 	$styles->default_dirs = array('/wp-admin/');
   422 	$styles->default_dirs = array('/wp-admin/');
   420 
   423 
       
   424 	$suffix = defined('STYLE_DEBUG') && STYLE_DEBUG ? '.dev' : '';
       
   425 
   421 	$rtl_styles = array( 'global', 'colors', 'dashboard', 'ie', 'install', 'login', 'media', 'theme-editor', 'upload', 'widgets', 'press-this', 'plugin-install', 'farbtastic' );
   426 	$rtl_styles = array( 'global', 'colors', 'dashboard', 'ie', 'install', 'login', 'media', 'theme-editor', 'upload', 'widgets', 'press-this', 'plugin-install', 'farbtastic' );
   422 
   427 
   423 	// all colors stylesheets need to have the same query strings (cache manifest compat)
   428 	// all colors stylesheets need to have the same query strings (cache manifest compat)
   424 	$colors_version = '20090625';
   429 	$colors_version = '20091217';
   425 
   430 
   426 	$styles->add( 'wp-admin', '/wp-admin/wp-admin.css', array(), '20090625' );
   431 	$styles->add( 'wp-admin', "/wp-admin/wp-admin$suffix.css", array(), '20091221' );
   427 	$styles->add_data( 'wp-admin', 'rtl', '/wp-admin/rtl.css' );
   432 	$styles->add_data( 'wp-admin', 'rtl', "/wp-admin/rtl$suffix.css" );
   428 
   433 
   429 	$styles->add( 'ie', '/wp-admin/css/ie.css', array(), '20090630' );
   434 	$styles->add( 'ie', '/wp-admin/css/ie.css', array(), '20091217' );
   430 	$styles->add_data( 'ie', 'conditional', 'lte IE 7' );
   435 	$styles->add_data( 'ie', 'conditional', 'lte IE 7' );
   431 
   436 
   432 	// Register "meta" stylesheet for admin colors. All colors-* style sheets should have the same version string.
   437 	// Register "meta" stylesheet for admin colors. All colors-* style sheets should have the same version string.
   433 	$styles->add( 'colors', true, array(), $colors_version );
   438 	$styles->add( 'colors', true, array(), $colors_version );
   434 	
   439 
   435 	// do not refer to these directly, the right one is queued by the above "meta" colors handle
   440 	// do not refer to these directly, the right one is queued by the above "meta" colors handle
   436 	$styles->add( 'colors-fresh', '/wp-admin/css/colors-fresh.css', array(), $colors_version);
   441 	$styles->add( 'colors-fresh', "/wp-admin/css/colors-fresh$suffix.css", array(), $colors_version);
   437 	$styles->add_data( 'colors-fresh', 'rtl', true );
   442 	$styles->add_data( 'colors-fresh', 'rtl', true );
   438 	$styles->add( 'colors-classic', '/wp-admin/css/colors-classic.css', array(), $colors_version);
   443 	$styles->add( 'colors-classic', "/wp-admin/css/colors-classic$suffix.css", array(), $colors_version);
   439 	$styles->add_data( 'colors-classic', 'rtl', true );
   444 	$styles->add_data( 'colors-classic', 'rtl', true );
   440 
   445 
   441 	$styles->add( 'global', '/wp-admin/css/global.css', array(), '20090630' );
   446 	$styles->add( 'global', "/wp-admin/css/global$suffix.css", array(), '20091228' );
   442 	$styles->add( 'media', '/wp-admin/css/media.css', array(), '20090516' );
   447 	$styles->add( 'media', "/wp-admin/css/media$suffix.css", array(), '20091029' );
   443 	$styles->add( 'widgets', '/wp-admin/css/widgets.css', array(), '20090603' );
   448 	$styles->add( 'widgets', "/wp-admin/css/widgets$suffix.css", array(), '20091118' );
   444 	$styles->add( 'dashboard', '/wp-admin/css/dashboard.css', array(), '20090514' );
   449 	$styles->add( 'dashboard', "/wp-admin/css/dashboard$suffix.css", array(), '20091211' );
   445 	$styles->add( 'install', '/wp-admin/css/install.css', array(), '20090514' );
   450 	$styles->add( 'install', "/wp-admin/css/install$suffix.css", array(), '20090514' );
   446 	$styles->add( 'theme-editor', '/wp-admin/css/theme-editor.css', array(), '20090625' );
   451 	$styles->add( 'theme-editor', "/wp-admin/css/theme-editor$suffix.css", array(), '20090625' );
   447 	$styles->add( 'press-this', '/wp-admin/css/press-this.css', array(), '20090514' );
   452 	$styles->add( 'press-this', "/wp-admin/css/press-this$suffix.css", array(), '20091022' );
   448 	$styles->add( 'thickbox', '/wp-includes/js/thickbox/thickbox.css', array(), '20090514' );
   453 	$styles->add( 'thickbox', '/wp-includes/js/thickbox/thickbox.css', array(), '20090514' );
   449 	$styles->add( 'login', '/wp-admin/css/login.css', array(), '20090514' );
   454 	$styles->add( 'login', "/wp-admin/css/login$suffix.css", array(), '20091010' );
   450 	$styles->add( 'plugin-install', '/wp-admin/css/plugin-install.css', array(), '20090514' );
   455 	$styles->add( 'plugin-install', "/wp-admin/css/plugin-install$suffix.css", array(), '20090514' );
   451 	$styles->add( 'theme-install', '/wp-admin/css/theme-install.css', array(), '20090610' );
   456 	$styles->add( 'theme-install', "/wp-admin/css/theme-install$suffix.css", array(), '20090610' );
   452 	$styles->add( 'farbtastic', '/wp-admin/css/farbtastic.css', array(), '1.2' );
   457 	$styles->add( 'farbtastic', '/wp-admin/css/farbtastic.css', array(), '1.2' );
   453 	$styles->add( 'jcrop', '/wp-includes/js/jcrop/jquery.Jcrop.css', array(), '0.9.8' );
   458 	$styles->add( 'jcrop', '/wp-includes/js/jcrop/jquery.Jcrop.css', array(), '0.9.8' );
       
   459 	$styles->add( 'imgareaselect', '/wp-includes/js/imgareaselect/imgareaselect.css', array(), '0.9.1' );
   454 
   460 
   455 	foreach ( $rtl_styles as $rtl_style )
   461 	foreach ( $rtl_styles as $rtl_style )
   456 		$styles->add_data( $rtl_style, 'rtl', true );
   462 		$styles->add_data( $rtl_style, 'rtl', true );
   457 }
   463 }
   458 
   464 
   526 		return preg_replace( '#^wp-admin/#', './', $src );
   532 		return preg_replace( '#^wp-admin/#', './', $src );
   527 
   533 
   528 	if ( 'colors' == $handle || 'colors-rtl' == $handle ) {
   534 	if ( 'colors' == $handle || 'colors-rtl' == $handle ) {
   529 		global $_wp_admin_css_colors;
   535 		global $_wp_admin_css_colors;
   530 		$color = get_user_option('admin_color');
   536 		$color = get_user_option('admin_color');
       
   537 
   531 		if ( empty($color) || !isset($_wp_admin_css_colors[$color]) )
   538 		if ( empty($color) || !isset($_wp_admin_css_colors[$color]) )
   532 			$color = 'fresh';
   539 			$color = 'fresh';
       
   540 
   533 		$color = $_wp_admin_css_colors[$color];
   541 		$color = $_wp_admin_css_colors[$color];
   534 		$parsed = parse_url( $src );
   542 		$parsed = parse_url( $src );
   535 		$url = $color->url;
   543 		$url = $color->url;
       
   544 
       
   545 		if ( defined('STYLE_DEBUG') && STYLE_DEBUG )
       
   546 			$url = preg_replace('/.css$|.css(?=\?)/', '.dev.css', $url);
       
   547 
   536 		if ( isset($parsed['query']) && $parsed['query'] ) {
   548 		if ( isset($parsed['query']) && $parsed['query'] ) {
   537 			wp_parse_str( $parsed['query'], $qv );
   549 			wp_parse_str( $parsed['query'], $qv );
   538 			$url = add_query_arg( $qv, $url );
   550 			$url = add_query_arg( $qv, $url );
   539 		}
   551 		}
       
   552 
   540 		return $url;
   553 		return $url;
   541 	}
   554 	}
   542 
   555 
   543 	return $src;
   556 	return $src;
   544 }
   557 }