]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/script-loader.php
Wordpress 2.5.1
[autoinstalls/wordpress.git] / wp-includes / script-loader.php
index f8c83d0f08a77366df817351492257e4c75a71c0..4a6fc281fe73ca6ec47e13d8d591f734af2ee7b7 100644 (file)
@@ -11,10 +11,7 @@ class WP_Scripts {
        }
 
        function default_scripts() {
-               $this->add( 'dbx', '/wp-includes/js/dbx.js', false, '2.05' );
-
-               $this->add( 'fat', '/wp-includes/js/fat.js', false, '1.0-RC1_3660' );
-
+               $this->add( 'common', '/wp-admin/js/common.js', array('jquery'), '20080318' );
                $this->add( 'sack', '/wp-includes/js/tw-sack.js', false, '1.6.1' );
 
                $this->add( 'quicktags', '/wp-includes/js/quicktags.js', false, '3958' );
@@ -30,97 +27,144 @@ class WP_Scripts {
                        'enterImageDescription' => __('Enter a description of the image')
                ) );
 
-               $this->add( 'colorpicker', '/wp-includes/js/colorpicker.js', false, '3517' );
+               $this->add( 'colorpicker', '/wp-includes/js/colorpicker.js', array('prototype'), '3517' );
+
+               // Let a plugin replace the visual editor
+               $visual_editor = apply_filters('visual_editor', array('tiny_mce'));
+               $this->add( 'editor', false, $visual_editor, '20080321' );
+
+               $this->add( 'editor_functions', '/wp-admin/js/editor.js', false, '20080325' );
 
-               $this->add( 'tiny_mce', '/wp-includes/js/tinymce/tiny_mce_gzip.php', false, '20070528' );
-               $mce_config = apply_filters('tiny_mce_config_url', '/wp-includes/js/tinymce/tiny_mce_config.php');
-               $this->add( 'wp_tiny_mce', $mce_config, array('tiny_mce'), '20070528' );
+               // Modify this version when tinyMCE plugins are changed.
+               $mce_version = apply_filters('tiny_mce_version', '20080414');
+               $this->add( 'tiny_mce', '/wp-includes/js/tinymce/tiny_mce_config.php', array('editor_functions'), $mce_version );
 
-               $this->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.5.1.1');
+               $this->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.6');
 
-               $this->add( 'autosave', '/wp-includes/js/autosave.js', array('prototype', 'sack'), '20070306');
-               $this->localize( 'autosave', 'autosaveL10n', array(
-                       'autosaveInterval' => apply_filters('autosave_interval', '120'),
-                       'errorText' => __('Error: %response%'),
-                       'saveText' => __('Saved at %time%.'),
-                       'requestFile' => get_option( 'siteurl' ) . '/wp-admin/admin-ajax.php',
-                       'savingText' => __('Saving Draft...')
+               $this->add( 'wp-ajax-response', '/wp-includes/js/wp-ajax-response.js', array('jquery'), '20080316' );
+               $this->localize( 'wp-ajax-response', 'wpAjax', array(
+                       'noPerm' => __('You do not have permission to do that.'),
+                       'broken' => __('An unidentified error has occurred.')
                ) );
 
+               $this->add( 'autosave', '/wp-includes/js/autosave.js', array('schedule', 'wp-ajax-response'), '20080424' );
+
                $this->add( 'wp-ajax', '/wp-includes/js/wp-ajax.js', array('prototype'), '20070306');
                $this->localize( 'wp-ajax', 'WPAjaxL10n', array(
                        'defaultUrl' => get_option( 'siteurl' ) . '/wp-admin/admin-ajax.php',
-                       'permText' => __("You don't have permission to do that."),
+                       'permText' => __("You do not have permission to do that."),
                        'strangeText' => __("Something strange happened.  Try refreshing the page."),
                        'whoaText' => __("Slow down, I'm still sending your data!")
                ) );
 
-               $this->add( 'listman', '/wp-includes/js/list-manipulation.js', array('wp-ajax', 'fat'), '20070306' );
-               $this->localize( 'listman', 'listManL10n', array(
-                       'jumpText' => __('Jump to new item'),
-                       'delText' => __('Are you sure you want to delete this %thing%?')
+               $this->add( 'wp-lists', '/wp-includes/js/wp-lists.js', array('wp-ajax-response'), '20080411' );
+               $this->localize( 'wp-lists', 'wpListL10n', array(
+                       'url' => get_option( 'siteurl' ) . '/wp-admin/admin-ajax.php'
                ) );
 
-               $this->add( 'scriptaculous-root', '/wp-includes/js/scriptaculous/scriptaculous.js', array('prototype'), '1.7.1-b3');
-               $this->add( 'scriptaculous-builder', '/wp-includes/js/scriptaculous/builder.js', array('scriptaculous-root'), '1.7.1-b3');
-               $this->add( 'scriptaculous-dragdrop', '/wp-includes/js/scriptaculous/dragdrop.js', array('scriptaculous-builder', 'scriptaculous-effects'), '1.7.1-b3');
-               $this->add( 'scriptaculous-effects', '/wp-includes/js/scriptaculous/effects.js', array('scriptaculous-root'), '1.7.1-b3');
-               $this->add( 'scriptaculous-slider', '/wp-includes/js/scriptaculous/slider.js', array('scriptaculous-effects'), '1.7.1-b3');
-               $this->add( 'scriptaculous-sound', '/wp-includes/js/scriptaculous/sound.js', array( 'scriptaculous-root' ), '1.7.1-b3' );
-               $this->add( 'scriptaculous-controls', '/wp-includes/js/scriptaculous/controls.js', array('scriptaculous-root'), '1.7.1-b3');
-               $this->add( 'scriptaculous', '', array('scriptaculous-dragdrop', 'scriptaculous-slider', 'scriptaculous-controls'), '1.7.1-b3');
+               $this->add( 'scriptaculous-root', '/wp-includes/js/scriptaculous/scriptaculous.js', array('prototype'), '1.8.0');
+               $this->add( 'scriptaculous-builder', '/wp-includes/js/scriptaculous/builder.js', array('scriptaculous-root'), '1.8.0');
+               $this->add( 'scriptaculous-dragdrop', '/wp-includes/js/scriptaculous/dragdrop.js', array('scriptaculous-builder', 'scriptaculous-effects'), '1.8.0');
+               $this->add( 'scriptaculous-effects', '/wp-includes/js/scriptaculous/effects.js', array('scriptaculous-root'), '1.8.0');
+               $this->add( 'scriptaculous-slider', '/wp-includes/js/scriptaculous/slider.js', array('scriptaculous-effects'), '1.8.0');
+               $this->add( 'scriptaculous-sound', '/wp-includes/js/scriptaculous/sound.js', array( 'scriptaculous-root' ), '1.8.0' );
+               $this->add( 'scriptaculous-controls', '/wp-includes/js/scriptaculous/controls.js', array('scriptaculous-root'), '1.8.0');
+               $this->add( 'scriptaculous', '', array('scriptaculous-dragdrop', 'scriptaculous-slider', 'scriptaculous-controls'), '1.8.0');
 
                $this->add( 'cropper', '/wp-includes/js/crop/cropper.js', array('scriptaculous-dragdrop'), '20070118');
 
-               $this->add( 'jquery', '/wp-includes/js/jquery/jquery.js', false, '1.1.4');
-               $this->add( 'jquery-form', '/wp-includes/js/jquery/jquery.form.js', array('jquery'), '1.0.3');
-               $this->add( 'interface', '/wp-includes/js/jquery/interface.js', array('jquery'), '1.2');
+               $this->add( 'jquery', '/wp-includes/js/jquery/jquery.js', false, '1.2.3');
+               $this->add( 'jquery-form', '/wp-includes/js/jquery/jquery.form.js', array('jquery'), '2.02');
+               $this->add( 'jquery-color', '/wp-includes/js/jquery/jquery.color.js', array('jquery'), '2.0-4561');
+               $this->add( 'interface', '/wp-includes/js/jquery/interface.js', array('jquery'), '1.2' );
+               $this->add( 'dimensions', '/wp-includes/js/jquery/jquery.dimensions.min.js', array('jquery'), '1.1.2');
+               $this->add( 'suggest', '/wp-includes/js/jquery/suggest.js', array('dimensions'), '1.1');
+               $this->add( 'schedule', '/wp-includes/js/jquery/jquery.schedule.js', array('jquery'), '20');
+               $this->add( 'thickbox', '/wp-includes/js/thickbox/thickbox.js', array('jquery'), '3.1');
+               $this->add( 'swfupload', '/wp-includes/js/swfupload/swfupload.js', false, '2.0.2');
+               $this->add( 'swfupload-degrade', '/wp-includes/js/swfupload/plugins/swfupload.graceful_degradation.js', array('swfupload'), '2.0.2');
+               $this->localize( 'swfupload-degrade', 'uploadDegradeOptions', array(
+                       'is_lighttpd_before_150' => is_lighttpd_before_150(),
+               ) );
+               $this->add( 'swfupload-queue', '/wp-includes/js/swfupload/plugins/swfupload.queue.js', array('swfupload'), '2.0.2');
+               $this->add( 'swfupload-handlers', '/wp-includes/js/swfupload/handlers.js', array('swfupload'), '2.0.2-20080407');
+               // these error messages came from the sample swfupload js, they might need changing.
+               $this->localize( 'swfupload-handlers', 'swfuploadL10n', array(
+                               'queue_limit_exceeded' => __('You have attempted to queue too many files.'),
+                               'file_exceeds_size_limit' => sprintf(__('This file is too big. Your php.ini upload_max_filesize is %s.'), @ini_get('upload_max_filesize')),
+                               'zero_byte_file' => __('This file is empty. Please try another.'),
+                               'invalid_filetype' => __('This file type is not allowed. Please try another.'),
+                               'default_error' => __('An error occurred in the upload. Please try again later.'),
+                               'missing_upload_url' => __('There was a configuration error. Please contact the server administrator.'),
+                               'upload_limit_exceeded' => __('You may only upload 1 file.'),
+                               'http_error' => __('HTTP error.'),
+                               'upload_failed' => __('Upload failed.'),
+                               'io_error' => __('IO error.'),
+                               'security_error' => __('Security error.'),
+                               'file_cancelled' => __('File cancelled.'),
+                               'upload_stopped' => __('Upload stopped.'),
+                               'dismiss' => __('Dismiss'),
+                               'crunching' => __('Crunching…'),
+                               'deleted' => __('Deleted'),
+               ) );
+
+               $this->add( 'jquery-ui-tabs', '/wp-includes/js/jquery/ui.tabs.js', array('jquery'), '3' );
 
                if ( is_admin() ) {
-                       global $pagenow;
-                       $man = false;
-                       switch ( $pagenow ) :
-                       case 'post.php' :
-                       case 'post-new.php' :
-                               $man = 'postmeta';
-                               break;
-                       case 'page.php' :
-                       case 'page-new.php' :
-                               $man = 'pagemeta';
-                               break;
-                       case 'link-add.php' :
-                       case 'link.php' :
-                               $man = 'linkmeta';
-                               break;
-                       endswitch;
-                       if ( $man ) {
-                               $this->add( 'dbx-admin-key', '/wp-admin/js/dbx-admin-key.js', array('dbx'), '20070417' );
-                               $this->localize( 'dbx-admin-key', 'dbxL10n', array(
-                                       'manager' => $man,
-                                       'open' => __('open'),
-                                       'close' => __('close'),
-                                       'moveMouse' => __('click-down and drag to move this box'),
-                                       'toggleMouse' => __('click to %toggle% this box'),
-                                       'moveKey' => __('use the arrow keys to move this box'),
-                                       'toggleKey' => __(', or press the enter key to %toggle% it'),
-                               ) );
-                       }
-                       $this->add( 'ajaxcat', '/wp-admin/js/cat.js', array('listman'), '20070724' );
+                       $this->add( 'ajaxcat', '/wp-admin/js/cat.js', array( 'wp-lists' ), '20071101' );
                        $this->localize( 'ajaxcat', 'catL10n', array(
                                'add' => attribute_escape(__('Add')),
                                'how' => __('Separate multiple categories with commas.')
                        ) );
-                       $this->add( 'ajaxlinkcat', '/wp-admin/js/link-cat.js', array('listman'), '200700601' );
-                       $this->localize( 'ajaxlinkcat', 'linkcatL10n', array(
-                               'add' => attribute_escape(__('Add')),
-                               'how' => __('Separate multiple categories with commas.')
+                       $this->add( 'admin-categories', '/wp-admin/js/categories.js', array('wp-lists'), '20071031' );
+                       $this->add( 'admin-tags', '/wp-admin/js/tags.js', array('wp-lists'), '20071031' );
+                       $this->add( 'admin-custom-fields', '/wp-admin/js/custom-fields.js', array('wp-lists'), '20070823' );
+                       $this->add( 'password-strength-meter', '/wp-admin/js/password-strength-meter.js', array('jquery'), '20070405' );
+                       $this->localize( 'password-strength-meter', 'pwsL10n', array(
+                               'short' => __('Too short'),
+                               'bad' => __('Bad'),
+                               'good' => __('Good'),
+                               'strong' => __('Strong')
+                       ) );
+                       $this->add( 'admin-comments', '/wp-admin/js/edit-comments.js', array('wp-lists'), '20080311' );
+                       $this->localize( 'admin-comments', 'adminCommentsL10n', array(
+                               'pending' => __('%i% pending') // must look like: "# blah blah"
                        ) );
-                       $this->add( 'admin-categories', '/wp-admin/js/categories.js', array('listman'), '3684' );
-                       $this->add( 'admin-custom-fields', '/wp-admin/js/custom-fields.js', array('listman'), '3733' );
-                       $this->add( 'admin-comments', '/wp-admin/js/edit-comments.js', array('listman'), '20070327' );
-                       $this->add( 'admin-users', '/wp-admin/js/users.js', array('listman'), '4583' );
+                       $this->add( 'admin-users', '/wp-admin/js/users.js', array('wp-lists'), '20070823' );
+                       $this->add( 'admin-forms', '/wp-admin/js/forms.js', false, '20080317' );
                        $this->add( 'xfn', '/wp-admin/js/xfn.js', false, '3517' );
                        $this->add( 'upload', '/wp-admin/js/upload.js', array('jquery'), '20070518' );
+                       $this->add( 'postbox', '/wp-admin/js/postbox.js', array('jquery'), '20080128' );
+                       $this->localize( 'postbox', 'postboxL10n', array(
+                               'requestFile' => get_option( 'siteurl' ) . '/wp-admin/admin-ajax.php',
+                       ) );
+                       $this->add( 'slug', '/wp-admin/js/slug.js', array('jquery'), '20080208' );
+                       $this->localize( 'slug', 'slugL10n', array(
+                               'requestFile' => get_option( 'siteurl' ) . '/wp-admin/admin-ajax.php',
+                               'save' => __('Save'),
+                               'cancel' => __('Cancel'),
+                       ) );
+                       $this->add( 'post', '/wp-admin/js/post.js', array('suggest', 'jquery-ui-tabs', 'wp-lists', 'postbox', 'slug'), '20080422' );
+                       $this->localize( 'post', 'postL10n', array(
+                               'tagsUsed' =>  __('Tags used on this post:'),
+                               'add' => attribute_escape(__('Add')),
+                               'addTag' => attribute_escape(__('Add new tag')),
+                               'separate' => __('Separate tags with commas'),
+                               'cancel' => __('Cancel'),
+                               'edit' => __('Edit'),
+                       ) );
+                       $this->add( 'page', '/wp-admin/js/page.js', array('jquery', 'slug', 'postbox'), '20080318' );
+                       $this->localize( 'page', 'postL10n', array(
+                               'cancel' => __('Cancel'),
+                               'edit' => __('Edit'),
+                       ) );
+                       $this->add( 'link', '/wp-admin/js/link.js', array('jquery-ui-tabs', 'wp-lists', 'postbox'), '20080131' );
+                       $this->add( 'comment', '/wp-admin/js/comment.js', array('postbox'), '20080219' );
+                       $this->localize( 'comment', 'commentL10n', array(
+                                       'cancel' => __('Cancel'),
+                                       'edit' => __('Edit'),
+                               ) );
+                       $this->add( 'media-upload', '/wp-admin/js/media-upload.js', false, '20080109' );
                        $this->localize( 'upload', 'uploadL10n', array(
                                'browseTitle' => attribute_escape(__('Browse your files')),
                                'back' => __('« Back'),
@@ -143,6 +187,13 @@ class WP_Scripts {
                                'saveText' => attribute_escape(__('Save »')),
                                'confirmText' => __("Are you sure you want to delete the file '%title%'?\nClick ok to delete or cancel to go back.")
                        ) );
+                       $this->add( 'admin-widgets', '/wp-admin/js/widgets.js', array( 'interface' ), '20080407c' );
+                       $this->localize( 'admin-widgets', 'widgetsL10n', array(
+                               'add' => __('Add'),
+                               'edit' => __('Edit'),
+                               'cancel' => __('Cancel'),
+                       ));
+                       $this->add( 'editor', '/wp-admin/js/editor.js', array('tiny_mce'), '20080221' );
                }
        }
 
@@ -178,8 +229,8 @@ class WP_Scripts {
 
                                        $src = add_query_arg('ver', $ver, $src);
                                        $src = clean_url(apply_filters( 'script_loader_src', $src ));
-                                       echo "<script type='text/javascript' src='$src'></script>\n";
                                        $this->print_scripts_l10n( $handle );
+                                       echo "<script type='text/javascript' src='$src'></script>\n";
                                }
                                $this->printed[] = $handle;
                        }
@@ -242,7 +293,7 @@ class WP_Scripts {
                                        return false; // Abort this branch.
                                else
                                        continue; // We're at the top level.  Move on to the next one.
-                       }                                       
+                       }
 
                        $this->to_print[$handle] = true;
                }
@@ -439,6 +490,19 @@ function wp_prototype_before_jquery( $js_array ) {
        return $js_array;
 }
 
+// These localizations require information that may not be loaded even by init
+function wp_just_in_time_script_localization() {
+       wp_localize_script( 'tiny_mce', 'wpTinyMCEConfig', array( 'defaultEditor' => wp_default_editor() ) );
+       wp_localize_script( 'autosave', 'autosaveL10n', array(
+               'autosaveInterval' => AUTOSAVE_INTERVAL,
+               'previewPageText' => __('Preview this Page'),
+               'previewPostText' => __('Preview this Post'),
+               'requestFile' => get_option( 'siteurl' ) . '/wp-admin/admin-ajax.php',
+               'savingText' => __('Saving Draft&#8230;')
+       ) );
+}
+
+add_filter( 'wp_print_scripts', 'wp_just_in_time_script_localization' );
 add_filter( 'print_scripts_array', 'wp_prototype_before_jquery' );
 
 ?>