mp-wp_genesis 1 <?php
mp-wp_genesis 2 /**
mp-wp_genesis 3 * WordPress scripts and styles default loader.
mp-wp_genesis 4 *
mp-wp_genesis 5 * Most of the functionality that existed here was moved to
mp-wp_genesis 6 * {@link http://backpress.automattic.com/ BackPress}. WordPress themes and
mp-wp_genesis 7 * plugins will only be concerned about the filters and actions set in this
mp-wp_genesis 8 * file.
mp-wp_genesis 9 *
mp-wp_genesis 10 * @package WordPress
mp-wp_genesis 11 */
mp-wp_genesis 12
mp-wp_genesis 13 /** BackPress: WordPress Dependencies Class */
mp-wp_genesis 14 require( ABSPATH . WPINC . '/class.wp-dependencies.php' );
mp-wp_genesis 15
mp-wp_genesis 16 /** BackPress: WordPress Scripts Class */
mp-wp_genesis 17 require( ABSPATH . WPINC . '/class.wp-scripts.php' );
mp-wp_genesis 18
mp-wp_genesis 19 /** BackPress: WordPress Scripts Functions */
mp-wp_genesis 20 require( ABSPATH . WPINC . '/functions.wp-scripts.php' );
mp-wp_genesis 21
mp-wp_genesis 22 /** BackPress: WordPress Styles Class */
mp-wp_genesis 23 require( ABSPATH . WPINC . '/class.wp-styles.php' );
mp-wp_genesis 24
mp-wp_genesis 25 /** BackPress: WordPress Styles Functions */
mp-wp_genesis 26 require( ABSPATH . WPINC . '/functions.wp-styles.php' );
mp-wp_genesis 27
mp-wp_genesis 28 /**
mp-wp_genesis 29 * Setup WordPress scripts to load by default for Administration Panels.
mp-wp_genesis 30 *
mp-wp_genesis 31 * Localizes a few of the scripts.
mp-wp_genesis 32 *
mp-wp_genesis 33 * @since 2.6.0
mp-wp_genesis 34 *
mp-wp_genesis 35 * @param object $scripts WP_Scripts object.
mp-wp_genesis 36 */
mp-wp_genesis 37 function wp_default_scripts( &$scripts ) {
mp-wp_genesis 38 if (!$guessurl = site_url())
mp-wp_genesis 39 $guessurl = wp_guess_url();
mp-wp_genesis 40
mp-wp_genesis 41 $scripts->base_url = $guessurl;
mp-wp_genesis 42 $scripts->default_version = get_bloginfo( 'version' );
mp-wp_genesis 43
mp-wp_genesis 44 $scripts->add( 'common', '/wp-admin/js/common.js', array('jquery', 'hoverIntent'), '20081210' );
mp-wp_genesis 45 $scripts->add( 'sack', '/wp-includes/js/tw-sack.js', false, '1.6.1' );
mp-wp_genesis 46
mp-wp_genesis 47 $scripts->add( 'quicktags', '/wp-includes/js/quicktags.js', false, '20081210' );
mp-wp_genesis 48 $scripts->localize( 'quicktags', 'quicktagsL10n', array(
mp-wp_genesis 49 'quickLinks' => __('(Quick Links)'),
mp-wp_genesis 50 'wordLookup' => __('Enter a word to look up:'),
mp-wp_genesis 51 'dictionaryLookup' => attribute_escape(__('Dictionary lookup')),
mp-wp_genesis 52 'lookup' => attribute_escape(__('lookup')),
mp-wp_genesis 53 'closeAllOpenTags' => attribute_escape(__('Close all open tags')),
mp-wp_genesis 54 'closeTags' => attribute_escape(__('close tags')),
mp-wp_genesis 55 'enterURL' => __('Enter the URL'),
mp-wp_genesis 56 'enterImageURL' => __('Enter the URL of the image'),
mp-wp_genesis 57 'enterImageDescription' => __('Enter a description of the image'),
mp-wp_genesis 58 'l10n_print_after' => 'try{convertEntities(quicktagsL10n);}catch(e){};'
mp-wp_genesis 59 ) );
mp-wp_genesis 60
mp-wp_genesis 61 $scripts->add( 'colorpicker', '/wp-includes/js/colorpicker.js', array('prototype'), '3517' );
mp-wp_genesis 62
mp-wp_genesis 63 // Modify this version when tinyMCE plugins are changed.
mp-wp_genesis 64 function mce_version() {
mp-wp_genesis 65 return '20081129';
mp-wp_genesis 66 }
mp-wp_genesis 67 add_filter( 'tiny_mce_version', 'mce_version' );
mp-wp_genesis 68
mp-wp_genesis 69 $scripts->add( 'editor', '/wp-admin/js/editor.js', false, mce_version() );
mp-wp_genesis 70
mp-wp_genesis 71 $scripts->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.6');
mp-wp_genesis 72
mp-wp_genesis 73 $scripts->add( 'wp-ajax-response', '/wp-includes/js/wp-ajax-response.js', array('jquery'), '20081210' );
mp-wp_genesis 74 $scripts->localize( 'wp-ajax-response', 'wpAjax', array(
mp-wp_genesis 75 'noPerm' => __('You do not have permission to do that.'),
mp-wp_genesis 76 'broken' => __('An unidentified error has occurred.'),
mp-wp_genesis 77 'l10n_print_after' => 'try{convertEntities(wpAjax);}catch(e){};'
mp-wp_genesis 78 ) );
mp-wp_genesis 79
mp-wp_genesis 80 $scripts->add( 'autosave', '/wp-includes/js/autosave.js', array('schedule', 'wp-ajax-response'), '20081210' );
mp-wp_genesis 81
mp-wp_genesis 82 $scripts->add( 'wp-lists', '/wp-includes/js/wp-lists.js', array('wp-ajax-response'), '20081210' );
mp-wp_genesis 83 $scripts->localize( 'wp-lists', 'wpListL10n', array(
mp-wp_genesis 84 'url' => admin_url('admin-ajax.php')
mp-wp_genesis 85 ) );
mp-wp_genesis 86
mp-wp_genesis 87 $scripts->add( 'scriptaculous-root', '/wp-includes/js/scriptaculous/wp-scriptaculous.js', array('prototype'), '1.8.0');
mp-wp_genesis 88 $scripts->add( 'scriptaculous-builder', '/wp-includes/js/scriptaculous/builder.js', array('scriptaculous-root'), '1.8.0');
mp-wp_genesis 89 $scripts->add( 'scriptaculous-dragdrop', '/wp-includes/js/scriptaculous/dragdrop.js', array('scriptaculous-builder', 'scriptaculous-effects'), '1.8.0');
mp-wp_genesis 90 $scripts->add( 'scriptaculous-effects', '/wp-includes/js/scriptaculous/effects.js', array('scriptaculous-root'), '1.8.0');
mp-wp_genesis 91 $scripts->add( 'scriptaculous-slider', '/wp-includes/js/scriptaculous/slider.js', array('scriptaculous-effects'), '1.8.0');
mp-wp_genesis 92 $scripts->add( 'scriptaculous-sound', '/wp-includes/js/scriptaculous/sound.js', array( 'scriptaculous-root' ), '1.8.0' );
mp-wp_genesis 93 $scripts->add( 'scriptaculous-controls', '/wp-includes/js/scriptaculous/controls.js', array('scriptaculous-root'), '1.8.0');
mp-wp_genesis 94 $scripts->add( 'scriptaculous', '', array('scriptaculous-dragdrop', 'scriptaculous-slider', 'scriptaculous-controls'), '1.8.0');
mp-wp_genesis 95
mp-wp_genesis 96 $scripts->add( 'cropper', '/wp-includes/js/crop/cropper.js', array('scriptaculous-dragdrop'), '20070118');
mp-wp_genesis 97
mp-wp_genesis 98 $scripts->add( 'jquery', '/wp-includes/js/jquery/jquery.js', false, '1.2.6');
mp-wp_genesis 99 $scripts->add( 'jquery-form', '/wp-includes/js/jquery/jquery.form.js', array('jquery'), '2.02');
mp-wp_genesis 100 $scripts->add( 'jquery-color', '/wp-includes/js/jquery/jquery.color.js', array('jquery'), '2.0-4561');
mp-wp_genesis 101 $scripts->add( 'interface', '/wp-includes/js/jquery/interface.js', array('jquery'), '1.2' );
mp-wp_genesis 102 $scripts->add( 'suggest', '/wp-includes/js/jquery/suggest.js', array('jquery'), '1.1b');
mp-wp_genesis 103 $scripts->add( 'schedule', '/wp-includes/js/jquery/jquery.schedule.js', array('jquery'), '20');
mp-wp_genesis 104 $scripts->add( 'jquery-hotkeys', '/wp-includes/js/jquery/jquery.hotkeys.js', array('jquery'), '0.0.2' );
mp-wp_genesis 105 $scripts->add( 'jquery-table-hotkeys', '/wp-includes/js/jquery/jquery.table-hotkeys.js', array('jquery', 'jquery-hotkeys'), '20081128' );
mp-wp_genesis 106 $scripts->add( 'thickbox', '/wp-includes/js/thickbox/thickbox.js', array('jquery'), '3.1-20080430');
mp-wp_genesis 107 $scripts->add( 'swfupload', '/wp-includes/js/swfupload/swfupload.js', false, '2.2.0-20081031');
mp-wp_genesis 108 $scripts->add( 'swfupload-degrade', '/wp-includes/js/swfupload/plugins/swfupload.graceful_degradation.js', array('swfupload'), '2.2.0-20081031');
mp-wp_genesis 109 $scripts->add( 'swfupload-swfobject', '/wp-includes/js/swfupload/plugins/swfupload.swfobject.js', array('swfupload'), '2.2.0-20081031');
mp-wp_genesis 110 $scripts->localize( 'swfupload-degrade', 'uploadDegradeOptions', array(
mp-wp_genesis 111 'is_lighttpd_before_150' => is_lighttpd_before_150(),
mp-wp_genesis 112 ) );
mp-wp_genesis 113 $scripts->add( 'swfupload-queue', '/wp-includes/js/swfupload/plugins/swfupload.queue.js', array('swfupload'), '2.2.0-20081031');
mp-wp_genesis 114 $scripts->add( 'swfupload-handlers', '/wp-includes/js/swfupload/handlers.js', array('swfupload'), '2.2.0-20081201');
mp-wp_genesis 115 // these error messages came from the sample swfupload js, they might need changing.
mp-wp_genesis 116 $scripts->localize( 'swfupload-handlers', 'swfuploadL10n', array(
mp-wp_genesis 117 'queue_limit_exceeded' => __('You have attempted to queue too many files.'),
mp-wp_genesis 118 'file_exceeds_size_limit' => sprintf(__('This file is too big. Your php.ini upload_max_filesize is %s.'), @ini_get('upload_max_filesize')),
mp-wp_genesis 119 'zero_byte_file' => __('This file is empty. Please try another.'),
mp-wp_genesis 120 'invalid_filetype' => __('This file type is not allowed. Please try another.'),
mp-wp_genesis 121 'default_error' => __('An error occurred in the upload. Please try again later.'),
mp-wp_genesis 122 'missing_upload_url' => __('There was a configuration error. Please contact the server administrator.'),
mp-wp_genesis 123 'upload_limit_exceeded' => __('You may only upload 1 file.'),
mp-wp_genesis 124 'http_error' => __('HTTP error.'),
mp-wp_genesis 125 'upload_failed' => __('Upload failed.'),
mp-wp_genesis 126 'io_error' => __('IO error.'),
mp-wp_genesis 127 'security_error' => __('Security error.'),
mp-wp_genesis 128 'file_cancelled' => __('File cancelled.'),
mp-wp_genesis 129 'upload_stopped' => __('Upload stopped.'),
mp-wp_genesis 130 'dismiss' => __('Dismiss'),
mp-wp_genesis 131 'crunching' => __('Crunching…'),
mp-wp_genesis 132 'deleted' => __('Deleted'),
mp-wp_genesis 133 'l10n_print_after' => 'try{convertEntities(swfuploadL10n);}catch(e){};'
mp-wp_genesis 134 ) );
mp-wp_genesis 135
mp-wp_genesis 136 $scripts->add( 'jquery-ui-core', '/wp-includes/js/jquery/ui.core.js', array('jquery'), '1.5.2' );
mp-wp_genesis 137 $scripts->add( 'jquery-ui-tabs', '/wp-includes/js/jquery/ui.tabs.js', array('jquery-ui-core'), '1.5.2' );
mp-wp_genesis 138 $scripts->add( 'jquery-ui-sortable', '/wp-includes/js/jquery/ui.sortable.js', array('jquery-ui-core'), '1.5.2c' );
mp-wp_genesis 139 $scripts->add( 'jquery-ui-draggable', '/wp-includes/js/jquery/ui.draggable.js', array('jquery-ui-core'), '1.5.2' );
mp-wp_genesis 140 $scripts->add( 'jquery-ui-resizable', '/wp-includes/js/jquery/ui.resizable.js', array('jquery-ui-core'), '1.5.2' );
mp-wp_genesis 141 $scripts->add( 'jquery-ui-dialog', '/wp-includes/js/jquery/ui.dialog.js', array('jquery-ui-resizable', 'jquery-ui-draggable'), '1.5.2' );
mp-wp_genesis 142
mp-wp_genesis 143 $scripts->add( 'comment-reply', '/wp-includes/js/comment-reply.js', false, '20081210');
mp-wp_genesis 144
mp-wp_genesis 145 if ( is_admin() ) {
mp-wp_genesis 146 $scripts->add( 'ajaxcat', '/wp-admin/js/cat.js', array( 'wp-lists' ), '20081210' );
mp-wp_genesis 147 $scripts->localize( 'ajaxcat', 'catL10n', array(
mp-wp_genesis 148 'add' => attribute_escape(__('Add')),
mp-wp_genesis 149 'how' => __('Separate multiple categories with commas.'),
mp-wp_genesis 150 'l10n_print_after' => 'try{convertEntities(catL10n);}catch(e){};'
mp-wp_genesis 151 ) );
mp-wp_genesis 152 $scripts->add( 'admin-categories', '/wp-admin/js/categories.js', array('wp-lists'), '20081210' );
mp-wp_genesis 153 $scripts->add( 'admin-tags', '/wp-admin/js/tags.js', array('wp-lists'), '20081210' );
mp-wp_genesis 154 $scripts->add( 'admin-custom-fields', '/wp-admin/js/custom-fields.js', array('wp-lists'), '20081210' );
mp-wp_genesis 155 $scripts->add( 'password-strength-meter', '/wp-admin/js/password-strength-meter.js', array('jquery'), '20081210' );
mp-wp_genesis 156 $scripts->localize( 'password-strength-meter', 'pwsL10n', array(
mp-wp_genesis 157 'empty' => __('Strength indicator'),
mp-wp_genesis 158 'short' => __('Very weak'),
mp-wp_genesis 159 'bad' => __('Weak'),
mp-wp_genesis 160 'good' => _c('Medium|password strength'),
mp-wp_genesis 161 'strong' => __('Strong'),
mp-wp_genesis 162 'l10n_print_after' => 'try{convertEntities(pwsL10n);}catch(e){};'
mp-wp_genesis 163 ) );
mp-wp_genesis 164 $scripts->add( 'admin-comments', '/wp-admin/js/edit-comments.js', array('wp-lists', 'jquery-ui-resizable', 'quicktags'), '20081210' );
mp-wp_genesis 165 $scripts->localize( 'admin-comments', 'adminCommentsL10n', array(
mp-wp_genesis 166 'hotkeys_highlight_first' => isset($_GET['hotkeys_highlight_first']),
mp-wp_genesis 167 'hotkeys_highlight_last' => isset($_GET['hotkeys_highlight_last'])
mp-wp_genesis 168 ) );
mp-wp_genesis 169 $scripts->add( 'admin-users', '/wp-admin/js/users.js', array('wp-lists'), '20081210' );
mp-wp_genesis 170 $scripts->add( 'xfn', '/wp-admin/js/xfn.js', false, '3517' );
mp-wp_genesis 171 $scripts->add( 'postbox', '/wp-admin/js/postbox.js', array('jquery-ui-sortable'), '20081210' );
mp-wp_genesis 172 $scripts->localize( 'postbox', 'postboxL10n', array(
mp-wp_genesis 173 'requestFile' => admin_url('admin-ajax.php')
mp-wp_genesis 174 ) );
mp-wp_genesis 175 $scripts->add( 'slug', '/wp-admin/js/slug.js', array('jquery'), '20081210' );
mp-wp_genesis 176 $scripts->localize( 'slug', 'slugL10n', array(
mp-wp_genesis 177 'requestFile' => admin_url('admin-ajax.php'),
mp-wp_genesis 178 'save' => __('Save'),
mp-wp_genesis 179 'cancel' => __('Cancel'),
mp-wp_genesis 180 'l10n_print_after' => 'try{convertEntities(slugL10n);}catch(e){};'
mp-wp_genesis 181 ) );
mp-wp_genesis 182 $scripts->add( 'post', '/wp-admin/js/post.js', array('suggest', 'jquery-ui-tabs', 'wp-lists', 'postbox', 'slug'), '20081210' );
mp-wp_genesis 183 $scripts->localize( 'post', 'postL10n', array(
mp-wp_genesis 184 'tagsUsed' => __('Tags used on this post:'),
mp-wp_genesis 185 'add' => attribute_escape(__('Add')),
mp-wp_genesis 186 'addTag' => attribute_escape(__('Add new tag')),
mp-wp_genesis 187 'separate' => __('Separate tags with commas'),
mp-wp_genesis 188 'cancel' => __('Cancel'),
mp-wp_genesis 189 'edit' => __('Edit'),
mp-wp_genesis 190 'publishOn' => __('Publish on:'),
mp-wp_genesis 191 'publishOnFuture' => __('Schedule for:'),
mp-wp_genesis 192 'publishOnPast' => __('Published on:'),
mp-wp_genesis 193 'showcomm' => __('Show more comments'),
mp-wp_genesis 194 'endcomm' => __('No more comments found.'),
mp-wp_genesis 195 'publish' => __('Publish'),
mp-wp_genesis 196 'schedule' => __('Schedule'),
mp-wp_genesis 197 'update' => __('Update Post'),
mp-wp_genesis 198 'savePending' => __('Save as Pending'),
mp-wp_genesis 199 'saveDraft' => __('Save Draft'),
mp-wp_genesis 200 'private' => __('Private'),
mp-wp_genesis 201 'public' => __('Public'),
mp-wp_genesis 202 'publicSticky' => __('Public, Sticky'),
mp-wp_genesis 203 'password' => __('Password Protected'),
mp-wp_genesis 204 'privatelyPublished' => __('Privately Published'),
mp-wp_genesis 205 'published' => __('Published'),
mp-wp_genesis 206 'l10n_print_after' => 'try{convertEntities(postL10n);}catch(e){};'
mp-wp_genesis 207 ) );
mp-wp_genesis 208 $scripts->add( 'page', '/wp-admin/js/page.js', array('jquery', 'slug', 'wp-lists', 'postbox'), '20081210' );
mp-wp_genesis 209 $scripts->localize( 'page', 'postL10n', array(
mp-wp_genesis 210 'cancel' => __('Cancel'),
mp-wp_genesis 211 'edit' => __('Edit'),
mp-wp_genesis 212 'publishOn' => __('Publish on:'),
mp-wp_genesis 213 'publishOnFuture' => __('Schedule for:'),
mp-wp_genesis 214 'publishOnPast' => __('Published on:'),
mp-wp_genesis 215 'showcomm' => __('Show more comments'),
mp-wp_genesis 216 'endcomm' => __('No more comments found.'),
mp-wp_genesis 217 'publish' => __('Publish'),
mp-wp_genesis 218 'schedule' => __('Schedule'),
mp-wp_genesis 219 'update' => __('Update Page'),
mp-wp_genesis 220 'savePending' => __('Save as Pending'),
mp-wp_genesis 221 'saveDraft' => __('Save Draft'),
mp-wp_genesis 222 'private' => __('Private'),
mp-wp_genesis 223 'public' => __('Public'),
mp-wp_genesis 224 'password' => __('Password Protected'),
mp-wp_genesis 225 'privatelyPublished' => __('Privately Published'),
mp-wp_genesis 226 'published' => __('Published'),
mp-wp_genesis 227 'l10n_print_after' => 'try{convertEntities(postL10n);}catch(e){};'
mp-wp_genesis 228 ) );
mp-wp_genesis 229 $scripts->add( 'link', '/wp-admin/js/link.js', array('jquery-ui-tabs', 'wp-lists', 'postbox'), '20081210' );
mp-wp_genesis 230 $scripts->add( 'comment', '/wp-admin/js/comment.js', array('jquery'), '20081210' );
mp-wp_genesis 231 $scripts->localize( 'comment', 'commentL10n', array(
mp-wp_genesis 232 'cancel' => __('Cancel'),
mp-wp_genesis 233 'edit' => __('Edit'),
mp-wp_genesis 234 'submittedOn' => __('Submitted on:'),
mp-wp_genesis 235 'l10n_print_after' => 'try{convertEntities(commentL10n);}catch(e){};'
mp-wp_genesis 236 ) );
mp-wp_genesis 237 $scripts->add( 'admin-gallery', '/wp-admin/js/gallery.js', array( 'jquery-ui-sortable' ), '20081210' );
mp-wp_genesis 238 $scripts->add( 'media-upload', '/wp-admin/js/media-upload.js', array( 'thickbox' ), '20081210' );
mp-wp_genesis 239
mp-wp_genesis 240 $scripts->add( 'admin-widgets', '/wp-admin/js/widgets.js', array( 'interface' ), '20081210' );
mp-wp_genesis 241 $scripts->localize( 'admin-widgets', 'widgetsL10n', array(
mp-wp_genesis 242 'add' => __('Add'),
mp-wp_genesis 243 'edit' => __('Edit'),
mp-wp_genesis 244 'cancel' => __('Cancel'),
mp-wp_genesis 245 'lameReminder' => __('Remember to click the "Save Changes" button at the bottom of the Current Widgets column after you\'re all done!'),
mp-wp_genesis 246 'lamerReminder' => __("You're about to leave without having saved your changes!"),
mp-wp_genesis 247 'l10n_print_after' => 'try{convertEntities(widgetsL10n);}catch(e){};'
mp-wp_genesis 248 ));
mp-wp_genesis 249
mp-wp_genesis 250 $scripts->add( 'word-count', '/wp-admin/js/word-count.js', array( 'jquery' ), '20081210' );
mp-wp_genesis 251 $scripts->localize( 'word-count', 'wordCountL10n', array(
mp-wp_genesis 252 'count' => __('Word count: %d'),
mp-wp_genesis 253 'l10n_print_after' => 'try{convertEntities(wordCountL10n);}catch(e){};'
mp-wp_genesis 254 ));
mp-wp_genesis 255
mp-wp_genesis 256 $scripts->add( 'wp-gears', '/wp-admin/js/wp-gears.js', false, '20081210' );
mp-wp_genesis 257 $scripts->localize( 'wp-gears', 'wpGearsL10n', array(
mp-wp_genesis 258 'updateCompleted' => __('Update completed.'),
mp-wp_genesis 259 'error' => __('Error:'),
mp-wp_genesis 260 'l10n_print_after' => 'try{convertEntities(wpGearsL10n);}catch(e){};'
mp-wp_genesis 261 ));
mp-wp_genesis 262
mp-wp_genesis 263 $scripts->add( 'theme-preview', '/wp-admin/js/theme-preview.js', array( 'thickbox', 'jquery' ), '20081210' );
mp-wp_genesis 264
mp-wp_genesis 265 $scripts->add( 'inline-edit-post', '/wp-admin/js/inline-edit-post.js', array( 'jquery', 'jquery-form', 'suggest' ), '20081210' );
mp-wp_genesis 266 $scripts->localize( 'inline-edit-post', 'inlineEditL10n', array(
mp-wp_genesis 267 'error' => __('Error while saving the changes.'),
mp-wp_genesis 268 'ntdeltitle' => __('Remove From Bulk Edit'),
mp-wp_genesis 269 'notitle' => __('(no title)'),
mp-wp_genesis 270 'l10n_print_after' => 'try{convertEntities(inlineEditL10n);}catch(e){};'
mp-wp_genesis 271 ) );
mp-wp_genesis 272
mp-wp_genesis 273 $scripts->add( 'inline-edit-tax', '/wp-admin/js/inline-edit-tax.js', array( 'jquery', 'jquery-form' ), '20081210' );
mp-wp_genesis 274 $scripts->localize( 'inline-edit-tax', 'inlineEditL10n', array(
mp-wp_genesis 275 'error' => __('Error while saving the changes.'),
mp-wp_genesis 276 'l10n_print_after' => 'try{convertEntities(inlineEditL10n);}catch(e){};'
mp-wp_genesis 277 ) );
mp-wp_genesis 278
mp-wp_genesis 279 $scripts->add( 'plugin-install', '/wp-admin/js/plugin-install.js', array( 'thickbox', 'jquery' ), '20081210' );
mp-wp_genesis 280 $scripts->localize( 'plugin-install', 'plugininstallL10n', array(
mp-wp_genesis 281 'plugin_information' => __('Plugin Information:'),
mp-wp_genesis 282 'l10n_print_after' => 'try{convertEntities(plugininstallL10n);}catch(e){};'
mp-wp_genesis 283 ) );
mp-wp_genesis 284
mp-wp_genesis 285 $scripts->add( 'farbtastic', '/wp-admin/js/farbtastic.js', array('jquery'), '1.2' );
mp-wp_genesis 286
mp-wp_genesis 287 $scripts->add( 'dashboard', '/wp-admin/js/dashboard.js', array( 'jquery', 'admin-comments', 'postbox' ), '20081210' );
mp-wp_genesis 288
mp-wp_genesis 289 $scripts->add( 'hoverIntent', '/wp-includes/js/hoverIntent.js', array('jquery'), '20081210' );
mp-wp_genesis 290
mp-wp_genesis 291 }
mp-wp_genesis 292 }
mp-wp_genesis 293
mp-wp_genesis 294 /**
mp-wp_genesis 295 * Assign default styles to $styles object.
mp-wp_genesis 296 *
mp-wp_genesis 297 * Nothing is returned, because the $styles parameter is passed by reference.
mp-wp_genesis 298 * Meaning that whatever object is passed will be updated without having to
mp-wp_genesis 299 * reassign the variable that was passed back to the same value. This saves
mp-wp_genesis 300 * memory.
mp-wp_genesis 301 *
mp-wp_genesis 302 * Adding default styles is not the only task, it also assigns the base_url
mp-wp_genesis 303 * property, the default version, and text direction for the object.
mp-wp_genesis 304 *
mp-wp_genesis 305 * @since 2.6.0
mp-wp_genesis 306 *
mp-wp_genesis 307 * @param object $styles
mp-wp_genesis 308 */
mp-wp_genesis 309 function wp_default_styles( &$styles ) {
mp-wp_genesis 310 // This checks to see if site_url() returns something and if it does not
mp-wp_genesis 311 // then it assigns $guess_url to wp_guess_url(). Strange format, but it works.
mp-wp_genesis 312 if ( ! $guessurl = site_url() )
mp-wp_genesis 313 $guessurl = wp_guess_url();
mp-wp_genesis 314 $styles->base_url = $guessurl;
mp-wp_genesis 315 $styles->default_version = get_bloginfo( 'version' );
mp-wp_genesis 316 $styles->text_direction = 'rtl' == get_bloginfo( 'text_direction' ) ? 'rtl' : 'ltr';
mp-wp_genesis 317
mp-wp_genesis 318 $rtl_styles = array( 'global', 'colors', 'dashboard', 'ie', 'install', 'login', 'media', 'theme-editor', 'upload', 'widgets', 'press-this', 'plugin-install', 'farbtastic' );
mp-wp_genesis 319
mp-wp_genesis 320 $styles->add( 'wp-admin', '/wp-admin/wp-admin.css', array(), '20081210' );
mp-wp_genesis 321 $styles->add_data( 'wp-admin', 'rtl', '/wp-admin/rtl.css' );
mp-wp_genesis 322
mp-wp_genesis 323 $styles->add( 'ie', '/wp-admin/css/ie.css', array(), '20081210' );
mp-wp_genesis 324 $styles->add_data( 'ie', 'conditional', 'gte IE 6' );
mp-wp_genesis 325
mp-wp_genesis 326 $styles->add( 'colors', true, array(), '20081210' ); // Register "meta" stylesheet for admin colors
mp-wp_genesis 327 $styles->add( 'colors-fresh', '/wp-admin/css/colors-fresh.css', array(), '20081210'); // for login.php. Is there a better way?
mp-wp_genesis 328 $styles->add_data( 'colors-fresh', 'rtl', true );
mp-wp_genesis 329 $styles->add( 'colors-classic', '/wp-admin/css/colors-classic.css', array(), '20081210');
mp-wp_genesis 330 $styles->add_data( 'colors-classic', 'rtl', true );
mp-wp_genesis 331
mp-wp_genesis 332 $styles->add( 'global', '/wp-admin/css/global.css', array(), '20081210' );
mp-wp_genesis 333 $styles->add( 'media', '/wp-admin/css/media.css', array(), '20081210' );
mp-wp_genesis 334 $styles->add( 'widgets', '/wp-admin/css/widgets.css', array(), '20081210' );
mp-wp_genesis 335 $styles->add( 'dashboard', '/wp-admin/css/dashboard.css', array(), '20081210' );
mp-wp_genesis 336 $styles->add( 'install', '/wp-admin/css/install.css', array(), '20081210' );
mp-wp_genesis 337 $styles->add( 'theme-editor', '/wp-admin/css/theme-editor.css', array(), '20081210' );
mp-wp_genesis 338 $styles->add( 'press-this', '/wp-admin/css/press-this.css', array(), '20081210' );
mp-wp_genesis 339 $styles->add( 'thickbox', '/wp-includes/js/thickbox/thickbox.css', array(), '20081210' );
mp-wp_genesis 340 $styles->add( 'login', '/wp-admin/css/login.css', array(), '20081210' );
mp-wp_genesis 341 $styles->add( 'plugin-install', '/wp-admin/css/plugin-install.css', array(), '20081210' );
mp-wp_genesis 342 $styles->add( 'farbtastic', '/wp-admin/css/farbtastic.css', array(), '1.2' );
mp-wp_genesis 343
mp-wp_genesis 344 foreach ( $rtl_styles as $rtl_style )
mp-wp_genesis 345 $styles->add_data( $rtl_style, 'rtl', true );
mp-wp_genesis 346 }
mp-wp_genesis 347
mp-wp_genesis 348 /**
mp-wp_genesis 349 * Reorder JavaScript scripts array to place prototype before jQuery.
mp-wp_genesis 350 *
mp-wp_genesis 351 * @since 2.3.1
mp-wp_genesis 352 *
mp-wp_genesis 353 * @param array $js_array JavaScript scripst array
mp-wp_genesis 354 * @return array Reordered array, if needed.
mp-wp_genesis 355 */
mp-wp_genesis 356 function wp_prototype_before_jquery( $js_array ) {
mp-wp_genesis 357 if ( false === $jquery = array_search( 'jquery', $js_array ) )
mp-wp_genesis 358 return $js_array;
mp-wp_genesis 359
mp-wp_genesis 360 if ( false === $prototype = array_search( 'prototype', $js_array ) )
mp-wp_genesis 361 return $js_array;
mp-wp_genesis 362
mp-wp_genesis 363 if ( $prototype < $jquery )
mp-wp_genesis 364 return $js_array;
mp-wp_genesis 365
mp-wp_genesis 366 unset($js_array[$prototype]);
mp-wp_genesis 367
mp-wp_genesis 368 array_splice( $js_array, $jquery, 0, 'prototype' );
mp-wp_genesis 369
mp-wp_genesis 370 return $js_array;
mp-wp_genesis 371 }
mp-wp_genesis 372
mp-wp_genesis 373 /**
mp-wp_genesis 374 * Load localized script just in time for MCE.
mp-wp_genesis 375 *
mp-wp_genesis 376 * These localizations require information that may not be loaded even by init.
mp-wp_genesis 377 *
mp-wp_genesis 378 * @since 2.5.0
mp-wp_genesis 379 */
mp-wp_genesis 380 function wp_just_in_time_script_localization() {
mp-wp_genesis 381 global $current_user;
mp-wp_genesis 382
mp-wp_genesis 383 wp_localize_script( 'autosave', 'autosaveL10n', array(
mp-wp_genesis 384 'autosaveInterval' => AUTOSAVE_INTERVAL,
mp-wp_genesis 385 'previewPageText' => __('Preview this Page'),
mp-wp_genesis 386 'previewPostText' => __('Preview this Post'),
mp-wp_genesis 387 'requestFile' => admin_url('admin-ajax.php'),
mp-wp_genesis 388 'savingText' => __('Saving Draft…'),
mp-wp_genesis 389 'l10n_print_after' => 'try{convertEntities(autosaveL10n);}catch(e){};'
mp-wp_genesis 390 ) );
mp-wp_genesis 391
mp-wp_genesis 392 $userid = isset($current_user) ? $current_user->ID : 0;
mp-wp_genesis 393 wp_localize_script( 'common', 'userSettings', array(
mp-wp_genesis 394 'url' => SITECOOKIEPATH,
mp-wp_genesis 395 'uid' => $userid,
mp-wp_genesis 396 'time' => time()
mp-wp_genesis 397 ) );
mp-wp_genesis 398 }
mp-wp_genesis 399
mp-wp_genesis 400 /**
mp-wp_genesis 401 * Administration Panel CSS for changing the styles.
mp-wp_genesis 402 *
mp-wp_genesis 403 * If installing the 'wp-admin/' directory will be replaced with './'.
mp-wp_genesis 404 *
mp-wp_genesis 405 * The $_wp_admin_css_colors global manages the Administration Panels CSS
mp-wp_genesis 406 * stylesheet that is loaded. The option that is set is 'admin_color' and is the
mp-wp_genesis 407 * color and key for the array. The value for the color key is an object with
mp-wp_genesis 408 * a 'url' parameter that has the URL path to the CSS file.
mp-wp_genesis 409 *
mp-wp_genesis 410 * The query from $src parameter will be appended to the URL that is given from
mp-wp_genesis 411 * the $_wp_admin_css_colors array value URL.
mp-wp_genesis 412 *
mp-wp_genesis 413 * @since 2.6.0
mp-wp_genesis 414 * @uses $_wp_admin_css_colors
mp-wp_genesis 415 *
mp-wp_genesis 416 * @param string $src Source URL.
mp-wp_genesis 417 * @param string $handle Either 'colors' or 'colors-rtl'.
mp-wp_genesis 418 * @return string URL path to CSS stylesheet for Administration Panels.
mp-wp_genesis 419 */
mp-wp_genesis 420 function wp_style_loader_src( $src, $handle ) {
mp-wp_genesis 421 if ( defined('WP_INSTALLING') )
mp-wp_genesis 422 return preg_replace( '#^wp-admin/#', './', $src );
mp-wp_genesis 423
mp-wp_genesis 424 if ( 'colors' == $handle || 'colors-rtl' == $handle ) {
mp-wp_genesis 425 global $_wp_admin_css_colors;
mp-wp_genesis 426 $color = get_user_option('admin_color');
mp-wp_genesis 427 if ( empty($color) || !isset($_wp_admin_css_colors[$color]) )
mp-wp_genesis 428 $color = 'fresh';
mp-wp_genesis 429 $color = $_wp_admin_css_colors[$color];
mp-wp_genesis 430 $parsed = parse_url( $src );
mp-wp_genesis 431 $url = $color->url;
mp-wp_genesis 432 if ( isset($parsed['query']) && $parsed['query'] ) {
mp-wp_genesis 433 wp_parse_str( $parsed['query'], $qv );
mp-wp_genesis 434 $url = add_query_arg( $qv, $url );
mp-wp_genesis 435 }
mp-wp_genesis 436 return $url;
mp-wp_genesis 437 }
mp-wp_genesis 438
mp-wp_genesis 439 return $src;
mp-wp_genesis 440 }
mp-wp_genesis 441
mp-wp_genesis 442 add_action( 'wp_default_scripts', 'wp_default_scripts' );
mp-wp_genesis 443 add_filter( 'wp_print_scripts', 'wp_just_in_time_script_localization' );
mp-wp_genesis 444 add_filter( 'print_scripts_array', 'wp_prototype_before_jquery' );
mp-wp_genesis 445
mp-wp_genesis 446 add_action( 'wp_default_styles', 'wp_default_styles' );
mp-wp_genesis 447 add_filter( 'style_loader_src', 'wp_style_loader_src', 10, 2 );