Changeset 34465
- Timestamp:
- 09/24/2015 12:29:54 AM (9 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/widget-functions.php
r34392 r34465 502 502 * @return bool True, if widget sidebar was found and called. False if not found or not called. 503 503 */ 504 function dynamic_sidebar( $index = 1) {504 function dynamic_sidebar( $index = 1 ) { 505 505 global $wp_registered_sidebars, $wp_registered_widgets; 506 506 507 if ( is_int( $index) ) {507 if ( is_int( $index ) ) { 508 508 $index = "sidebar-$index"; 509 509 } else { 510 $ index = sanitize_title($index);510 $sanitized_index = sanitize_title( $index ); 511 511 foreach ( (array) $wp_registered_sidebars as $key => $value ) { 512 if ( sanitize_title( $value['name']) == $index ) {512 if ( sanitize_title( $value['name'] ) == $sanitized_index ) { 513 513 $index = $key; 514 514 break; -
trunk/tests/phpunit/tests/widgets.php
r32602 r34465 294 294 } 295 295 296 /** 297 * @ticket 23423 298 */ 299 function test_dynamic_sidebar_id_special_characters() { 300 wp_widgets_init(); 301 register_sidebar( array( 302 'name' => 'Sidebar 2', 303 'id' => 'sidebar-2', 304 ) ); 305 306 ob_start(); 307 $result = dynamic_sidebar( 'Sidebar 1' ); 308 ob_end_clean(); 309 310 $this->assertFalse( $result ); 311 } 312 296 313 }
Note: See TracChangeset
for help on using the changeset viewer.