Changeset 32483
- Timestamp:
- 05/10/2015 07:56:15 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class.wp-dependencies.php
r30537 r32483 214 214 * @param string $ver Optional. Version (used for cache busting). 215 215 * @param mixed $args Optional. Custom property of the item. NOT the class property $args. Examples: $media, $in_footer. 216 * @return bool True on success, false on failure.216 * @return bool Whether the item has been registered. True on success, false on failure. 217 217 */ 218 218 public function add( $handle, $src, $deps = array(), $ver = false, $args = null ) { -
trunk/src/wp-includes/functions.wp-scripts.php
r32124 r32483 95 95 * 96 96 * @since 2.6.0 97 * @since 4.3.0 A return value was added. 97 98 * 98 99 * @param string $handle Name of the script. Should be unique. … … 106 107 * @param bool $in_footer Optional. Whether to enqueue the script before </head> or before </body>. 107 108 * Default 'false'. Accepts 'false' or 'true'. 109 * @return bool Whether the script has been registered. True on success, false on failure. 108 110 */ 109 111 function wp_register_script( $handle, $src, $deps = array(), $ver = false, $in_footer = false ) { … … 111 113 _wp_scripts_maybe_doing_it_wrong( __FUNCTION__ ); 112 114 113 $ wp_scripts->add( $handle, $src, $deps, $ver );115 $registered = $wp_scripts->add( $handle, $src, $deps, $ver ); 114 116 if ( $in_footer ) { 115 117 $wp_scripts->add_data( $handle, 'group', 1 ); 116 118 } 119 120 return $registered; 117 121 } 118 122 -
trunk/src/wp-includes/functions.wp-styles.php
r32041 r32483 99 99 * 100 100 * @since 2.6.0 101 * @since 4.3.0 A return value was added. 101 102 * 102 103 * @param string $handle Name of the stylesheet. … … 108 109 * Default 'all'. Accepts 'all', 'aural', 'braille', 'handheld', 'projection', 'print', 109 110 * 'screen', 'tty', or 'tv'. 111 * @return bool Whether the style has been registered. True on success, false on failure. 110 112 */ 111 113 function wp_register_style( $handle, $src, $deps = array(), $ver = false, $media = 'all' ) { 112 114 _wp_scripts_maybe_doing_it_wrong( __FUNCTION__ ); 113 115 114 wp_styles()->add( $handle, $src, $deps, $ver, $media );116 return wp_styles()->add( $handle, $src, $deps, $ver, $media ); 115 117 } 116 118 -
trunk/tests/phpunit/tests/dependencies/scripts.php
r31317 r32483 156 156 $this->assertEquals( '', get_echo( 'wp_print_scripts' ) ); 157 157 } 158 159 /** 160 * Testing 'wp_register_script' return boolean success/failure value. 161 * 162 * @ticket 31126 163 */ 164 function test_wp_register_script() { 165 $this->assertTrue( wp_register_script( 'duplicate-handler', 'http://example.com' ) ); 166 $this->assertFalse( wp_register_script( 'duplicate-handler', 'http://example.com' ) ); 167 } 168 158 169 } -
trunk/tests/phpunit/tests/dependencies/styles.php
r31733 r32483 230 230 } 231 231 232 /** 233 * Testing 'wp_register_style' return boolean success/failure value. 234 * 235 * @ticket 31126 236 */ 237 function test_wp_register_style(){ 238 $this->assertTrue( wp_register_style( 'duplicate-handler', 'http://example.com' ) ); 239 $this->assertFalse( wp_register_style( 'duplicate-handler', 'http://example.com' ) ); 240 } 241 232 242 }
Note: See TracChangeset
for help on using the changeset viewer.