Ticket #8628: 8628-2.patch
File 8628-2.patch, 7.8 KB (added by , 16 years ago) |
---|
-
wp-admin/admin-footer.php
23 23 <div class="clear"></div> 24 24 </div> 25 25 <?php do_action('admin_footer', ''); ?> 26 <?php do_action('admin_print_footer_scripts'); ?> 26 27 <script type="text/javascript">if(typeof wpOnload=='function')wpOnload();</script> 27 28 </body> 28 29 </html> 30 No newline at end of file -
wp-includes/class.wp-dependencies.php
38 38 * @param mixed handles (optional) items to be processed. (void) processes queue, (string) process that item, (array of strings) process those items 39 39 * @return array Items that have been processed 40 40 */ 41 function do_items( $handles = false ) {41 function do_items( $handles = false, $sort = false ) { 42 42 // Print the queue if nothing is passed. If a string is passed, print that script. If an array is passed, print those scripts. 43 43 $handles = false === $handles ? $this->queue : (array) $handles; 44 44 $this->all_deps( $handles ); 45 45 46 foreach( $this->to_do as $ handle ) {46 foreach( $this->to_do as $key => $handle ) { 47 47 if ( !in_array($handle, $this->done) && isset($this->registered[$handle]) ) { 48 if ( $this->registered[$handle]->src ) { // Else it defines a group. 49 $this->do_item( $handle ); 48 49 if ( ! $this->registered[$handle]->src ) { // Defines a group. 50 $this->done[] = $handle; 51 continue; 50 52 } 51 $this->done[] = $handle; 53 54 if ( $this->do_item( $handle, $sort ) ) 55 $this->done[] = $handle; 56 57 unset( $this->to_do[$key] ); 52 58 } 53 59 } 54 60 55 $this->to_do = array();56 61 return $this->done; 57 62 } 58 63 … … 74 79 return false; 75 80 76 81 foreach ( $handles as $handle ) { 77 $handle = explode('?', $handle); 78 if ( isset($handle[1]) ) 79 $this->args[$handle[0]] = $handle[1]; 80 $handle = $handle[0]; 82 $handle_parts = explode('?', $handle); 83 $handle = $handle_parts[0]; 81 84 82 if ( isset($this->to_do[$handle]) ) // Already grobbed it and its deps85 if ( isset($this->to_do[$handle]) || in_array($handle, $this->done) ) // Already grobbed it and its deps 83 86 continue; 84 87 88 if ( isset($handle_parts[1]) ) 89 $this->args[$handle] = $handle_parts[1]; 90 85 91 $keep_going = true; 86 92 if ( !isset($this->registered[$handle]) ) 87 93 $keep_going = false; // Script doesn't exist … … 102 108 103 109 if ( !$recursion ) // at the end 104 110 $this->to_do = array_keys( $this->to_do ); 111 105 112 return true; 106 113 } 107 114 -
wp-includes/class.wp-scripts.php
19 19 class WP_Scripts extends WP_Dependencies { 20 20 var $base_url; // Full URL with trailing slash 21 21 var $default_version; 22 var $in_footer = array(); 22 23 23 24 function __construct() { 24 25 do_action_ref_array( 'wp_default_scripts', array(&$this) ); … … 62 63 return true; 63 64 } 64 65 65 function do_item( $handle ) {66 function do_item( $handle, $sort = false ) { 66 67 if ( !parent::do_item($handle) ) 67 68 return false; 68 69 70 if ( isset($this->registered[$handle]->extra['in_footer']) && $sort ) { 71 $this->in_footer[] = $handle; 72 return false; 73 } 74 69 75 $ver = $this->registered[$handle]->ver ? $this->registered[$handle]->ver : $this->default_version; 70 76 if ( isset($this->args[$handle]) ) 71 77 $ver .= '&' . $this->args[$handle]; … … 107 113 $this->to_do = apply_filters( 'print_scripts_array', $this->to_do ); 108 114 return $r; 109 115 } 116 117 function do_footer_items() { 118 119 if ( !empty($this->in_footer) ) { 120 foreach( $this->in_footer as $key => $handle ) { 121 if ( !in_array($handle, $this->done) && isset($this->registered[$handle]) ) { 122 $this->do_item( $handle ); 123 $this->done[] = $handle; 124 unset( $this->in_footer[$key] ); 125 } 126 } 127 } 128 129 return $this->done; 130 } 110 131 } -
wp-includes/class.wp-styles.php
39 39 $media = 'all'; 40 40 41 41 $href = $this->_css_href( $this->registered[$handle]->src, $ver, $handle ); 42 $rel = isset($this->registered[$handle]->extra['alt']) && $this->registered[$handle]->extra['alt'] ? 'alternate stylesheet' : 'stylesheet'; 43 $title = isset($this->registered[$handle]->extra['title']) ? "title='" . attribute_escape( $this->registered[$handle]->extra['title'] ) . "'" : ''; 42 44 43 45 $end_cond = ''; 44 46 if ( isset($this->registered[$handle]->extra['conditional']) && $this->registered[$handle]->extra['conditional'] ) { … … 46 48 $end_cond = "<![endif]-->\n"; 47 49 } 48 50 49 echo apply_filters( 'style_loader_tag', "<link rel=' stylesheet'href='$href' type='text/css' media='$media' />\n", $handle );51 echo apply_filters( 'style_loader_tag', "<link rel='$rel' $title href='$href' type='text/css' media='$media' />\n", $handle ); 50 52 if ( 'rtl' === $this->text_direction && isset($this->registered[$handle]->extra['rtl']) && $this->registered[$handle]->extra['rtl'] ) { 51 53 if ( is_bool( $this->registered[$handle]->extra['rtl'] ) ) 52 54 $rtl_href = str_replace( '.css', '-rtl.css', $href ); 53 55 else 54 56 $rtl_href = $this->_css_href( $this->registered[$handle]->extra['rtl'], $ver, "$handle-rtl" ); 55 57 56 echo apply_filters( 'style_loader_tag', "<link rel=' stylesheet'href='$rtl_href' type='text/css' media='$media' />\n", $handle );58 echo apply_filters( 'style_loader_tag', "<link rel='$rel' $title href='$rtl_href' type='text/css' media='$media' />\n", $handle ); 57 59 } 58 60 59 61 echo $end_cond; -
wp-includes/default-filters.php
181 181 add_action('do_pings', 'do_all_pings', 10, 1); 182 182 add_action('do_robots', 'do_robots'); 183 183 add_action('sanitize_comment_cookies', 'sanitize_comment_cookies'); 184 add_action('admin_print_scripts', 'wp_print_scripts', 20); 184 add_action('admin_print_scripts', 'wp_print_head_scripts', 20); 185 add_action('admin_print_footer_scripts', 'wp_print_footer_scripts', 20); 185 186 add_action('admin_print_styles', 'wp_print_styles', 20); 186 187 add_action('init', 'smilies_init', 5); 187 188 add_action( 'plugins_loaded', 'wp_maybe_load_widgets', 0 ); -
wp-includes/functions.wp-scripts.php
18 18 * @since r16 19 19 * @see WP_Scripts::print_scripts() 20 20 */ 21 function wp_print_scripts( $handles = false ) {21 function wp_print_scripts( $handles = false, $in_head = false ) { 22 22 do_action( 'wp_print_scripts' ); 23 23 if ( '' === $handles ) // for wp_head 24 24 $handles = false; … … 31 31 $wp_scripts = new WP_Scripts(); 32 32 } 33 33 34 return $wp_scripts->do_items( $handles );34 return $wp_scripts->do_items( $handles, $in_head ); 35 35 } 36 36 37 37 /** 38 * Print the script queue in the HTML head, postponing the scripts that need to be in the footer. 39 * 40 * @since unknown 41 * @see wp_print_scripts() 42 */ 43 function wp_print_head_scripts() { 44 return wp_print_scripts( false, true ); 45 } 46 47 /** 48 * Print the scripts that were queued for the footer. 49 * 50 * @since unknown 51 * @see WP_Scripts::do_footer_items() 52 */ 53 function wp_print_footer_scripts() { 54 global $wp_scripts; 55 56 if ( !is_a($wp_scripts, 'WP_Scripts') ) 57 return array(); // No need to run if not instantiated. 58 59 return $wp_scripts->do_footer_items(); 60 } 61 62 /** 38 63 * Register new JavaScript file. 39 64 * 40 65 * @since r16