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