Ticket #8628: 8628.patch
File 8628.patch, 3.8 KB (added by , 16 years ago) |
---|
-
wp-includes/class.wp-dependencies.php
22 22 var $to_do = array(); 23 23 var $done = array(); 24 24 var $args = array(); 25 var $in_footer = array(); 25 26 26 27 function WP_Dependencies() { 27 28 $args = func_get_args(); … … 43 44 $handles = false === $handles ? $this->queue : (array) $handles; 44 45 $this->all_deps( $handles ); 45 46 46 foreach( $this->to_do as $ handle ) {47 foreach( $this->to_do as $key => $handle ) { 47 48 if ( !in_array($handle, $this->done) && isset($this->registered[$handle]) ) { 48 if ( $this->registered[$handle]->src ) { // Else it defines a group. 49 50 if ( ! $this->registered[$handle]->src ) { // Defines a group. 51 $this->done[] = $handle; 52 continue; 53 } 54 55 if ( $this->registered[$handle]->in_footer ) { 56 $this->in_footer[] = $handle; 57 } else { 49 58 $this->do_item( $handle ); 59 $this->done[] = $handle; 50 60 } 51 $this->done[] = $handle; 61 62 unset($this->to_do[$key]); 52 63 } 53 64 } 54 65 55 $this->to_do = array();56 66 return $this->done; 57 67 } 68 69 function do_footer_items() { 58 70 71 if ( !empty($this->in_footer) ) { 72 foreach( $this->in_footer as $key => $handle ) { 73 if ( !in_array($handle, $this->done) && isset($this->registered[$handle]) ) { 74 $this->do_item( $handle ); 75 $this->done[] = $handle; 76 unset($this->in_footer[$key]); 77 } 78 } 79 } 80 81 return $this->done; 82 } 83 59 84 function do_item( $handle ) { 60 85 return isset($this->registered[$handle]); 61 86 } … … 116 141 * @param string ver (optional) Script version (used for cache busting) 117 142 * @return array Hierarchical array of dependencies 118 143 */ 119 function add( $handle, $src, $deps = array(), $ver = false, $args = null ) {144 function add( $handle, $src, $deps = array(), $ver = false, $args = null, $in_footer = false ) { 120 145 if ( isset($this->registered[$handle]) ) 121 146 return false; 122 $this->registered[$handle] = new _WP_Dependency( $handle, $src, $deps, $ver, $args );147 $this->registered[$handle] = new _WP_Dependency( $handle, $src, $deps, $ver, $args, $in_footer ); 123 148 return true; 124 149 } 125 150 … … 189 214 var $deps = array(); 190 215 var $ver = false; 191 216 var $args = null; 217 var $in_footer = false; 192 218 193 219 var $extra = array(); 194 220 195 221 function _WP_Dependency() { 196 @list($this->handle, $this->src, $this->deps, $this->ver, $this->args ) = func_get_args();222 @list($this->handle, $this->src, $this->deps, $this->ver, $this->args, $this->in_footer) = func_get_args(); 197 223 if ( !is_array($this->deps) ) 198 224 $this->deps = array(); 199 225 if ( !$this->ver ) -
wp-includes/default-filters.php
183 183 add_action('sanitize_comment_cookies', 'sanitize_comment_cookies'); 184 184 add_action('admin_print_scripts', 'wp_print_scripts', 20); 185 185 add_action('admin_print_styles', 'wp_print_styles', 20); 186 add_action('admin_footer', 'wp_print_footer_scripts', 20); 186 187 add_action('init', 'smilies_init', 5); 187 188 add_action( 'plugins_loaded', 'wp_maybe_load_widgets', 0 ); 188 189 add_action( 'shutdown', 'wp_ob_end_flush_all', 1); -
wp-includes/functions.wp-scripts.php
34 34 return $wp_scripts->do_items( $handles ); 35 35 } 36 36 37 function wp_print_footer_scripts() { 38 global $wp_scripts; 39 40 if ( !is_a($wp_scripts, 'WP_Scripts') ) 41 return array(); // No need to run if not instantiated. 42 43 return $wp_scripts->do_footer_items(); 44 } 45 37 46 /** 38 47 * Register new JavaScript file. 39 48 *