Ticket #35643: 35643.diff
File 35643.diff, 3.6 KB (added by , 9 years ago) |
---|
-
src/wp-includes/class.wp-dependencies.php
100 100 if ( !in_array($handle, $this->done, true) && isset($this->registered[$handle]) ) { 101 101 102 102 /* 103 * A single item may alias a set of items, by having dependencies,104 * but no source. Queuing the item queues the dependencies.105 *106 * Example: The extending class WP_Scripts is used to register 'scriptaculous' as a set of registered handles:107 * <code>add( 'scriptaculous', false, array( 'scriptaculous-dragdrop', 'scriptaculous-slider', 'scriptaculous-controls' ) );</code>108 *109 * The src property is false.110 */111 if ( ! $this->registered[$handle]->src ) {112 $this->done[] = $handle;113 continue;114 }115 116 /*117 103 * Attempt to process the item. If successful, 118 104 * add the handle to the done array. 119 105 * -
src/wp-includes/class.wp-scripts.php
135 135 if ( isset($this->args[$handle]) ) 136 136 $ver = $ver ? $ver . '&' . $this->args[$handle] : $this->args[$handle]; 137 137 138 /* 139 * A single item may alias a set of items, by having dependencies, 140 * but no source. Queuing the item queues the dependencies. 141 * 142 * Example: The extending class WP_Scripts is used to register 'scriptaculous' as a set of registered handles: 143 * <code>add( 'scriptaculous', false, array( 'scriptaculous-dragdrop', 'scriptaculous-slider', 'scriptaculous-controls' ) );</code> 144 * 145 * The src property is false. 146 */ 147 if ( ! $obj->src ) { 148 return true; 149 } 150 138 151 $src = $obj->src; 139 152 $cond_before = $cond_after = ''; 140 153 $conditional = isset( $obj->extra['conditional'] ) ? $obj->extra['conditional'] : ''; -
src/wp-includes/class.wp-styles.php
56 56 if ( isset($this->args[$handle]) ) 57 57 $ver = $ver ? $ver . '&' . $this->args[$handle] : $this->args[$handle]; 58 58 59 /* See description in class.wp-scripts.php */ 60 if ( ! $obj->src ) { 61 return true; 62 } 63 59 64 if ( $this->do_concat ) { 60 65 if ( $this->in_default_dir($obj->src) && !isset($obj->extra['conditional']) && !isset($obj->extra['alt']) ) { 61 66 $this->concat .= "$handle,"; -
tests/phpunit/tests/dependencies/scripts.php
166 166 $this->assertFalse( wp_register_script( 'duplicate-handler', 'http://example.com' ) ); 167 167 } 168 168 169 /** 170 * @ticket 35643 171 */ 172 function test_wp_enqueue_script_footer_alias() { 173 wp_register_script( 'foo', false, array( 'bar', 'baz' ), '1.0', true ); 174 wp_register_script( 'bar', home_url( 'bar.js' ), array(), '1.0', true ); 175 wp_register_script( 'baz', home_url( 'baz.js' ), array(), '1.0', true ); 176 177 wp_enqueue_script( 'foo' ); 178 179 $header = get_echo( 'wp_print_head_scripts' ); 180 $footer = get_echo( 'wp_print_footer_scripts' ); 181 182 $this->assertEmpty( $header ); 183 $this->assertContains( home_url( 'bar.js' ), $footer ); 184 $this->assertContains( home_url( 'baz.js' ), $footer ); 185 } 169 186 }