-
+ FF255A1DB331FDEB7C3A272C322D2009ADC3075113732FD40335E24B1633440AA180554DBDDA59F0F6B99663AFFA8BEA21BA805355E8FDCCA2D9F1DE13E2333A
mp-wp/wp-includes/script-loader.php
(0 . 0)(1 . 447)
150637 <?php
150638 /**
150639 * WordPress scripts and styles default loader.
150640 *
150641 * Most of the functionality that existed here was moved to
150642 * {@link http://backpress.automattic.com/ BackPress}. WordPress themes and
150643 * plugins will only be concerned about the filters and actions set in this
150644 * file.
150645 *
150646 * @package WordPress
150647 */
150648
150649 /** BackPress: WordPress Dependencies Class */
150650 require( ABSPATH . WPINC . '/class.wp-dependencies.php' );
150651
150652 /** BackPress: WordPress Scripts Class */
150653 require( ABSPATH . WPINC . '/class.wp-scripts.php' );
150654
150655 /** BackPress: WordPress Scripts Functions */
150656 require( ABSPATH . WPINC . '/functions.wp-scripts.php' );
150657
150658 /** BackPress: WordPress Styles Class */
150659 require( ABSPATH . WPINC . '/class.wp-styles.php' );
150660
150661 /** BackPress: WordPress Styles Functions */
150662 require( ABSPATH . WPINC . '/functions.wp-styles.php' );
150663
150664 /**
150665 * Setup WordPress scripts to load by default for Administration Panels.
150666 *
150667 * Localizes a few of the scripts.
150668 *
150669 * @since 2.6.0
150670 *
150671 * @param object $scripts WP_Scripts object.
150672 */
150673 function wp_default_scripts( &$scripts ) {
150674 if (!$guessurl = site_url())
150675 $guessurl = wp_guess_url();
150676
150677 $scripts->base_url = $guessurl;
150678 $scripts->default_version = get_bloginfo( 'version' );
150679
150680 $scripts->add( 'common', '/wp-admin/js/common.js', array('jquery', 'hoverIntent'), '20081210' );
150681 $scripts->add( 'sack', '/wp-includes/js/tw-sack.js', false, '1.6.1' );
150682
150683 $scripts->add( 'quicktags', '/wp-includes/js/quicktags.js', false, '20081210' );
150684 $scripts->localize( 'quicktags', 'quicktagsL10n', array(
150685 'quickLinks' => __('(Quick Links)'),
150686 'wordLookup' => __('Enter a word to look up:'),
150687 'dictionaryLookup' => attribute_escape(__('Dictionary lookup')),
150688 'lookup' => attribute_escape(__('lookup')),
150689 'closeAllOpenTags' => attribute_escape(__('Close all open tags')),
150690 'closeTags' => attribute_escape(__('close tags')),
150691 'enterURL' => __('Enter the URL'),
150692 'enterImageURL' => __('Enter the URL of the image'),
150693 'enterImageDescription' => __('Enter a description of the image'),
150694 'l10n_print_after' => 'try{convertEntities(quicktagsL10n);}catch(e){};'
150695 ) );
150696
150697 $scripts->add( 'colorpicker', '/wp-includes/js/colorpicker.js', array('prototype'), '3517' );
150698
150699 // Modify this version when tinyMCE plugins are changed.
150700 function mce_version() {
150701 return '20081129';
150702 }
150703 add_filter( 'tiny_mce_version', 'mce_version' );
150704
150705 $scripts->add( 'editor', '/wp-admin/js/editor.js', false, mce_version() );
150706
150707 $scripts->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.6');
150708
150709 $scripts->add( 'wp-ajax-response', '/wp-includes/js/wp-ajax-response.js', array('jquery'), '20081210' );
150710 $scripts->localize( 'wp-ajax-response', 'wpAjax', array(
150711 'noPerm' => __('You do not have permission to do that.'),
150712 'broken' => __('An unidentified error has occurred.'),
150713 'l10n_print_after' => 'try{convertEntities(wpAjax);}catch(e){};'
150714 ) );
150715
150716 $scripts->add( 'autosave', '/wp-includes/js/autosave.js', array('schedule', 'wp-ajax-response'), '20081210' );
150717
150718 $scripts->add( 'wp-lists', '/wp-includes/js/wp-lists.js', array('wp-ajax-response'), '20081210' );
150719 $scripts->localize( 'wp-lists', 'wpListL10n', array(
150720 'url' => admin_url('admin-ajax.php')
150721 ) );
150722
150723 $scripts->add( 'scriptaculous-root', '/wp-includes/js/scriptaculous/wp-scriptaculous.js', array('prototype'), '1.8.0');
150724 $scripts->add( 'scriptaculous-builder', '/wp-includes/js/scriptaculous/builder.js', array('scriptaculous-root'), '1.8.0');
150725 $scripts->add( 'scriptaculous-dragdrop', '/wp-includes/js/scriptaculous/dragdrop.js', array('scriptaculous-builder', 'scriptaculous-effects'), '1.8.0');
150726 $scripts->add( 'scriptaculous-effects', '/wp-includes/js/scriptaculous/effects.js', array('scriptaculous-root'), '1.8.0');
150727 $scripts->add( 'scriptaculous-slider', '/wp-includes/js/scriptaculous/slider.js', array('scriptaculous-effects'), '1.8.0');
150728 $scripts->add( 'scriptaculous-sound', '/wp-includes/js/scriptaculous/sound.js', array( 'scriptaculous-root' ), '1.8.0' );
150729 $scripts->add( 'scriptaculous-controls', '/wp-includes/js/scriptaculous/controls.js', array('scriptaculous-root'), '1.8.0');
150730 $scripts->add( 'scriptaculous', '', array('scriptaculous-dragdrop', 'scriptaculous-slider', 'scriptaculous-controls'), '1.8.0');
150731
150732 $scripts->add( 'cropper', '/wp-includes/js/crop/cropper.js', array('scriptaculous-dragdrop'), '20070118');
150733
150734 $scripts->add( 'jquery', '/wp-includes/js/jquery/jquery.js', false, '1.2.6');
150735 $scripts->add( 'jquery-form', '/wp-includes/js/jquery/jquery.form.js', array('jquery'), '2.02');
150736 $scripts->add( 'jquery-color', '/wp-includes/js/jquery/jquery.color.js', array('jquery'), '2.0-4561');
150737 $scripts->add( 'interface', '/wp-includes/js/jquery/interface.js', array('jquery'), '1.2' );
150738 $scripts->add( 'suggest', '/wp-includes/js/jquery/suggest.js', array('jquery'), '1.1b');
150739 $scripts->add( 'schedule', '/wp-includes/js/jquery/jquery.schedule.js', array('jquery'), '20');
150740 $scripts->add( 'jquery-hotkeys', '/wp-includes/js/jquery/jquery.hotkeys.js', array('jquery'), '0.0.2' );
150741 $scripts->add( 'jquery-table-hotkeys', '/wp-includes/js/jquery/jquery.table-hotkeys.js', array('jquery', 'jquery-hotkeys'), '20081128' );
150742 $scripts->add( 'thickbox', '/wp-includes/js/thickbox/thickbox.js', array('jquery'), '3.1-20080430');
150743 $scripts->add( 'swfupload', '/wp-includes/js/swfupload/swfupload.js', false, '2.2.0-20081031');
150744 $scripts->add( 'swfupload-degrade', '/wp-includes/js/swfupload/plugins/swfupload.graceful_degradation.js', array('swfupload'), '2.2.0-20081031');
150745 $scripts->add( 'swfupload-swfobject', '/wp-includes/js/swfupload/plugins/swfupload.swfobject.js', array('swfupload'), '2.2.0-20081031');
150746 $scripts->localize( 'swfupload-degrade', 'uploadDegradeOptions', array(
150747 'is_lighttpd_before_150' => is_lighttpd_before_150(),
150748 ) );
150749 $scripts->add( 'swfupload-queue', '/wp-includes/js/swfupload/plugins/swfupload.queue.js', array('swfupload'), '2.2.0-20081031');
150750 $scripts->add( 'swfupload-handlers', '/wp-includes/js/swfupload/handlers.js', array('swfupload'), '2.2.0-20081201');
150751 // these error messages came from the sample swfupload js, they might need changing.
150752 $scripts->localize( 'swfupload-handlers', 'swfuploadL10n', array(
150753 'queue_limit_exceeded' => __('You have attempted to queue too many files.'),
150754 'file_exceeds_size_limit' => sprintf(__('This file is too big. Your php.ini upload_max_filesize is %s.'), @ini_get('upload_max_filesize')),
150755 'zero_byte_file' => __('This file is empty. Please try another.'),
150756 'invalid_filetype' => __('This file type is not allowed. Please try another.'),
150757 'default_error' => __('An error occurred in the upload. Please try again later.'),
150758 'missing_upload_url' => __('There was a configuration error. Please contact the server administrator.'),
150759 'upload_limit_exceeded' => __('You may only upload 1 file.'),
150760 'http_error' => __('HTTP error.'),
150761 'upload_failed' => __('Upload failed.'),
150762 'io_error' => __('IO error.'),
150763 'security_error' => __('Security error.'),
150764 'file_cancelled' => __('File cancelled.'),
150765 'upload_stopped' => __('Upload stopped.'),
150766 'dismiss' => __('Dismiss'),
150767 'crunching' => __('Crunching…'),
150768 'deleted' => __('Deleted'),
150769 'l10n_print_after' => 'try{convertEntities(swfuploadL10n);}catch(e){};'
150770 ) );
150771
150772 $scripts->add( 'jquery-ui-core', '/wp-includes/js/jquery/ui.core.js', array('jquery'), '1.5.2' );
150773 $scripts->add( 'jquery-ui-tabs', '/wp-includes/js/jquery/ui.tabs.js', array('jquery-ui-core'), '1.5.2' );
150774 $scripts->add( 'jquery-ui-sortable', '/wp-includes/js/jquery/ui.sortable.js', array('jquery-ui-core'), '1.5.2c' );
150775 $scripts->add( 'jquery-ui-draggable', '/wp-includes/js/jquery/ui.draggable.js', array('jquery-ui-core'), '1.5.2' );
150776 $scripts->add( 'jquery-ui-resizable', '/wp-includes/js/jquery/ui.resizable.js', array('jquery-ui-core'), '1.5.2' );
150777 $scripts->add( 'jquery-ui-dialog', '/wp-includes/js/jquery/ui.dialog.js', array('jquery-ui-resizable', 'jquery-ui-draggable'), '1.5.2' );
150778
150779 $scripts->add( 'comment-reply', '/wp-includes/js/comment-reply.js', false, '20081210');
150780
150781 if ( is_admin() ) {
150782 $scripts->add( 'ajaxcat', '/wp-admin/js/cat.js', array( 'wp-lists' ), '20081210' );
150783 $scripts->localize( 'ajaxcat', 'catL10n', array(
150784 'add' => attribute_escape(__('Add')),
150785 'how' => __('Separate multiple categories with commas.'),
150786 'l10n_print_after' => 'try{convertEntities(catL10n);}catch(e){};'
150787 ) );
150788 $scripts->add( 'admin-categories', '/wp-admin/js/categories.js', array('wp-lists'), '20081210' );
150789 $scripts->add( 'admin-tags', '/wp-admin/js/tags.js', array('wp-lists'), '20081210' );
150790 $scripts->add( 'admin-custom-fields', '/wp-admin/js/custom-fields.js', array('wp-lists'), '20081210' );
150791 $scripts->add( 'password-strength-meter', '/wp-admin/js/password-strength-meter.js', array('jquery'), '20081210' );
150792 $scripts->localize( 'password-strength-meter', 'pwsL10n', array(
150793 'empty' => __('Strength indicator'),
150794 'short' => __('Very weak'),
150795 'bad' => __('Weak'),
150796 'good' => _c('Medium|password strength'),
150797 'strong' => __('Strong'),
150798 'l10n_print_after' => 'try{convertEntities(pwsL10n);}catch(e){};'
150799 ) );
150800 $scripts->add( 'admin-comments', '/wp-admin/js/edit-comments.js', array('wp-lists', 'jquery-ui-resizable', 'quicktags'), '20081210' );
150801 $scripts->localize( 'admin-comments', 'adminCommentsL10n', array(
150802 'hotkeys_highlight_first' => isset($_GET['hotkeys_highlight_first']),
150803 'hotkeys_highlight_last' => isset($_GET['hotkeys_highlight_last'])
150804 ) );
150805 $scripts->add( 'admin-users', '/wp-admin/js/users.js', array('wp-lists'), '20081210' );
150806 $scripts->add( 'xfn', '/wp-admin/js/xfn.js', false, '3517' );
150807 $scripts->add( 'postbox', '/wp-admin/js/postbox.js', array('jquery-ui-sortable'), '20081210' );
150808 $scripts->localize( 'postbox', 'postboxL10n', array(
150809 'requestFile' => admin_url('admin-ajax.php')
150810 ) );
150811 $scripts->add( 'slug', '/wp-admin/js/slug.js', array('jquery'), '20081210' );
150812 $scripts->localize( 'slug', 'slugL10n', array(
150813 'requestFile' => admin_url('admin-ajax.php'),
150814 'save' => __('Save'),
150815 'cancel' => __('Cancel'),
150816 'l10n_print_after' => 'try{convertEntities(slugL10n);}catch(e){};'
150817 ) );
150818 $scripts->add( 'post', '/wp-admin/js/post.js', array('suggest', 'jquery-ui-tabs', 'wp-lists', 'postbox', 'slug'), '20081210' );
150819 $scripts->localize( 'post', 'postL10n', array(
150820 'tagsUsed' => __('Tags used on this post:'),
150821 'add' => attribute_escape(__('Add')),
150822 'addTag' => attribute_escape(__('Add new tag')),
150823 'separate' => __('Separate tags with commas'),
150824 'cancel' => __('Cancel'),
150825 'edit' => __('Edit'),
150826 'publishOn' => __('Publish on:'),
150827 'publishOnFuture' => __('Schedule for:'),
150828 'publishOnPast' => __('Published on:'),
150829 'showcomm' => __('Show more comments'),
150830 'endcomm' => __('No more comments found.'),
150831 'publish' => __('Publish'),
150832 'schedule' => __('Schedule'),
150833 'update' => __('Update Post'),
150834 'savePending' => __('Save as Pending'),
150835 'saveDraft' => __('Save Draft'),
150836 'private' => __('Private'),
150837 'public' => __('Public'),
150838 'publicSticky' => __('Public, Sticky'),
150839 'password' => __('Password Protected'),
150840 'privatelyPublished' => __('Privately Published'),
150841 'published' => __('Published'),
150842 'l10n_print_after' => 'try{convertEntities(postL10n);}catch(e){};'
150843 ) );
150844 $scripts->add( 'page', '/wp-admin/js/page.js', array('jquery', 'slug', 'wp-lists', 'postbox'), '20081210' );
150845 $scripts->localize( 'page', 'postL10n', array(
150846 'cancel' => __('Cancel'),
150847 'edit' => __('Edit'),
150848 'publishOn' => __('Publish on:'),
150849 'publishOnFuture' => __('Schedule for:'),
150850 'publishOnPast' => __('Published on:'),
150851 'showcomm' => __('Show more comments'),
150852 'endcomm' => __('No more comments found.'),
150853 'publish' => __('Publish'),
150854 'schedule' => __('Schedule'),
150855 'update' => __('Update Page'),
150856 'savePending' => __('Save as Pending'),
150857 'saveDraft' => __('Save Draft'),
150858 'private' => __('Private'),
150859 'public' => __('Public'),
150860 'password' => __('Password Protected'),
150861 'privatelyPublished' => __('Privately Published'),
150862 'published' => __('Published'),
150863 'l10n_print_after' => 'try{convertEntities(postL10n);}catch(e){};'
150864 ) );
150865 $scripts->add( 'link', '/wp-admin/js/link.js', array('jquery-ui-tabs', 'wp-lists', 'postbox'), '20081210' );
150866 $scripts->add( 'comment', '/wp-admin/js/comment.js', array('jquery'), '20081210' );
150867 $scripts->localize( 'comment', 'commentL10n', array(
150868 'cancel' => __('Cancel'),
150869 'edit' => __('Edit'),
150870 'submittedOn' => __('Submitted on:'),
150871 'l10n_print_after' => 'try{convertEntities(commentL10n);}catch(e){};'
150872 ) );
150873 $scripts->add( 'admin-gallery', '/wp-admin/js/gallery.js', array( 'jquery-ui-sortable' ), '20081210' );
150874 $scripts->add( 'media-upload', '/wp-admin/js/media-upload.js', array( 'thickbox' ), '20081210' );
150875
150876 $scripts->add( 'admin-widgets', '/wp-admin/js/widgets.js', array( 'interface' ), '20081210' );
150877 $scripts->localize( 'admin-widgets', 'widgetsL10n', array(
150878 'add' => __('Add'),
150879 'edit' => __('Edit'),
150880 'cancel' => __('Cancel'),
150881 'lameReminder' => __('Remember to click the "Save Changes" button at the bottom of the Current Widgets column after you\'re all done!'),
150882 'lamerReminder' => __("You're about to leave without having saved your changes!"),
150883 'l10n_print_after' => 'try{convertEntities(widgetsL10n);}catch(e){};'
150884 ));
150885
150886 $scripts->add( 'word-count', '/wp-admin/js/word-count.js', array( 'jquery' ), '20081210' );
150887 $scripts->localize( 'word-count', 'wordCountL10n', array(
150888 'count' => __('Word count: %d'),
150889 'l10n_print_after' => 'try{convertEntities(wordCountL10n);}catch(e){};'
150890 ));
150891
150892 $scripts->add( 'wp-gears', '/wp-admin/js/wp-gears.js', false, '20081210' );
150893 $scripts->localize( 'wp-gears', 'wpGearsL10n', array(
150894 'updateCompleted' => __('Update completed.'),
150895 'error' => __('Error:'),
150896 'l10n_print_after' => 'try{convertEntities(wpGearsL10n);}catch(e){};'
150897 ));
150898
150899 $scripts->add( 'theme-preview', '/wp-admin/js/theme-preview.js', array( 'thickbox', 'jquery' ), '20081210' );
150900
150901 $scripts->add( 'inline-edit-post', '/wp-admin/js/inline-edit-post.js', array( 'jquery', 'jquery-form', 'suggest' ), '20081210' );
150902 $scripts->localize( 'inline-edit-post', 'inlineEditL10n', array(
150903 'error' => __('Error while saving the changes.'),
150904 'ntdeltitle' => __('Remove From Bulk Edit'),
150905 'notitle' => __('(no title)'),
150906 'l10n_print_after' => 'try{convertEntities(inlineEditL10n);}catch(e){};'
150907 ) );
150908
150909 $scripts->add( 'inline-edit-tax', '/wp-admin/js/inline-edit-tax.js', array( 'jquery', 'jquery-form' ), '20081210' );
150910 $scripts->localize( 'inline-edit-tax', 'inlineEditL10n', array(
150911 'error' => __('Error while saving the changes.'),
150912 'l10n_print_after' => 'try{convertEntities(inlineEditL10n);}catch(e){};'
150913 ) );
150914
150915 $scripts->add( 'plugin-install', '/wp-admin/js/plugin-install.js', array( 'thickbox', 'jquery' ), '20081210' );
150916 $scripts->localize( 'plugin-install', 'plugininstallL10n', array(
150917 'plugin_information' => __('Plugin Information:'),
150918 'l10n_print_after' => 'try{convertEntities(plugininstallL10n);}catch(e){};'
150919 ) );
150920
150921 $scripts->add( 'farbtastic', '/wp-admin/js/farbtastic.js', array('jquery'), '1.2' );
150922
150923 $scripts->add( 'dashboard', '/wp-admin/js/dashboard.js', array( 'jquery', 'admin-comments', 'postbox' ), '20081210' );
150924
150925 $scripts->add( 'hoverIntent', '/wp-includes/js/hoverIntent.js', array('jquery'), '20081210' );
150926
150927 }
150928 }
150929
150930 /**
150931 * Assign default styles to $styles object.
150932 *
150933 * Nothing is returned, because the $styles parameter is passed by reference.
150934 * Meaning that whatever object is passed will be updated without having to
150935 * reassign the variable that was passed back to the same value. This saves
150936 * memory.
150937 *
150938 * Adding default styles is not the only task, it also assigns the base_url
150939 * property, the default version, and text direction for the object.
150940 *
150941 * @since 2.6.0
150942 *
150943 * @param object $styles
150944 */
150945 function wp_default_styles( &$styles ) {
150946 // This checks to see if site_url() returns something and if it does not
150947 // then it assigns $guess_url to wp_guess_url(). Strange format, but it works.
150948 if ( ! $guessurl = site_url() )
150949 $guessurl = wp_guess_url();
150950 $styles->base_url = $guessurl;
150951 $styles->default_version = get_bloginfo( 'version' );
150952 $styles->text_direction = 'rtl' == get_bloginfo( 'text_direction' ) ? 'rtl' : 'ltr';
150953
150954 $rtl_styles = array( 'global', 'colors', 'dashboard', 'ie', 'install', 'login', 'media', 'theme-editor', 'upload', 'widgets', 'press-this', 'plugin-install', 'farbtastic' );
150955
150956 $styles->add( 'wp-admin', '/wp-admin/wp-admin.css', array(), '20081210' );
150957 $styles->add_data( 'wp-admin', 'rtl', '/wp-admin/rtl.css' );
150958
150959 $styles->add( 'ie', '/wp-admin/css/ie.css', array(), '20081210' );
150960 $styles->add_data( 'ie', 'conditional', 'gte IE 6' );
150961
150962 $styles->add( 'colors', true, array(), '20081210' ); // Register "meta" stylesheet for admin colors
150963 $styles->add( 'colors-fresh', '/wp-admin/css/colors-fresh.css', array(), '20081210'); // for login.php. Is there a better way?
150964 $styles->add_data( 'colors-fresh', 'rtl', true );
150965 $styles->add( 'colors-classic', '/wp-admin/css/colors-classic.css', array(), '20081210');
150966 $styles->add_data( 'colors-classic', 'rtl', true );
150967
150968 $styles->add( 'global', '/wp-admin/css/global.css', array(), '20081210' );
150969 $styles->add( 'media', '/wp-admin/css/media.css', array(), '20081210' );
150970 $styles->add( 'widgets', '/wp-admin/css/widgets.css', array(), '20081210' );
150971 $styles->add( 'dashboard', '/wp-admin/css/dashboard.css', array(), '20081210' );
150972 $styles->add( 'install', '/wp-admin/css/install.css', array(), '20081210' );
150973 $styles->add( 'theme-editor', '/wp-admin/css/theme-editor.css', array(), '20081210' );
150974 $styles->add( 'press-this', '/wp-admin/css/press-this.css', array(), '20081210' );
150975 $styles->add( 'thickbox', '/wp-includes/js/thickbox/thickbox.css', array(), '20081210' );
150976 $styles->add( 'login', '/wp-admin/css/login.css', array(), '20081210' );
150977 $styles->add( 'plugin-install', '/wp-admin/css/plugin-install.css', array(), '20081210' );
150978 $styles->add( 'farbtastic', '/wp-admin/css/farbtastic.css', array(), '1.2' );
150979
150980 foreach ( $rtl_styles as $rtl_style )
150981 $styles->add_data( $rtl_style, 'rtl', true );
150982 }
150983
150984 /**
150985 * Reorder JavaScript scripts array to place prototype before jQuery.
150986 *
150987 * @since 2.3.1
150988 *
150989 * @param array $js_array JavaScript scripst array
150990 * @return array Reordered array, if needed.
150991 */
150992 function wp_prototype_before_jquery( $js_array ) {
150993 if ( false === $jquery = array_search( 'jquery', $js_array ) )
150994 return $js_array;
150995
150996 if ( false === $prototype = array_search( 'prototype', $js_array ) )
150997 return $js_array;
150998
150999 if ( $prototype < $jquery )
151000 return $js_array;
151001
151002 unset($js_array[$prototype]);
151003
151004 array_splice( $js_array, $jquery, 0, 'prototype' );
151005
151006 return $js_array;
151007 }
151008
151009 /**
151010 * Load localized script just in time for MCE.
151011 *
151012 * These localizations require information that may not be loaded even by init.
151013 *
151014 * @since 2.5.0
151015 */
151016 function wp_just_in_time_script_localization() {
151017 global $current_user;
151018
151019 wp_localize_script( 'autosave', 'autosaveL10n', array(
151020 'autosaveInterval' => AUTOSAVE_INTERVAL,
151021 'previewPageText' => __('Preview this Page'),
151022 'previewPostText' => __('Preview this Post'),
151023 'requestFile' => admin_url('admin-ajax.php'),
151024 'savingText' => __('Saving Draft…'),
151025 'l10n_print_after' => 'try{convertEntities(autosaveL10n);}catch(e){};'
151026 ) );
151027
151028 $userid = isset($current_user) ? $current_user->ID : 0;
151029 wp_localize_script( 'common', 'userSettings', array(
151030 'url' => SITECOOKIEPATH,
151031 'uid' => $userid,
151032 'time' => time()
151033 ) );
151034 }
151035
151036 /**
151037 * Administration Panel CSS for changing the styles.
151038 *
151039 * If installing the 'wp-admin/' directory will be replaced with './'.
151040 *
151041 * The $_wp_admin_css_colors global manages the Administration Panels CSS
151042 * stylesheet that is loaded. The option that is set is 'admin_color' and is the
151043 * color and key for the array. The value for the color key is an object with
151044 * a 'url' parameter that has the URL path to the CSS file.
151045 *
151046 * The query from $src parameter will be appended to the URL that is given from
151047 * the $_wp_admin_css_colors array value URL.
151048 *
151049 * @since 2.6.0
151050 * @uses $_wp_admin_css_colors
151051 *
151052 * @param string $src Source URL.
151053 * @param string $handle Either 'colors' or 'colors-rtl'.
151054 * @return string URL path to CSS stylesheet for Administration Panels.
151055 */
151056 function wp_style_loader_src( $src, $handle ) {
151057 if ( defined('WP_INSTALLING') )
151058 return preg_replace( '#^wp-admin/#', './', $src );
151059
151060 if ( 'colors' == $handle || 'colors-rtl' == $handle ) {
151061 global $_wp_admin_css_colors;
151062 $color = get_user_option('admin_color');
151063 if ( empty($color) || !isset($_wp_admin_css_colors[$color]) )
151064 $color = 'fresh';
151065 $color = $_wp_admin_css_colors[$color];
151066 $parsed = parse_url( $src );
151067 $url = $color->url;
151068 if ( isset($parsed['query']) && $parsed['query'] ) {
151069 wp_parse_str( $parsed['query'], $qv );
151070 $url = add_query_arg( $qv, $url );
151071 }
151072 return $url;
151073 }
151074
151075 return $src;
151076 }
151077
151078 add_action( 'wp_default_scripts', 'wp_default_scripts' );
151079 add_filter( 'wp_print_scripts', 'wp_just_in_time_script_localization' );
151080 add_filter( 'print_scripts_array', 'wp_prototype_before_jquery' );
151081
151082 add_action( 'wp_default_styles', 'wp_default_styles' );
151083 add_filter( 'style_loader_src', 'wp_style_loader_src', 10, 2 );