Changeset 45999 for branches/4.5
- Timestamp:
- 09/04/2019 05:53:08 PM (6 years ago)
- Location:
- branches/4.5
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/4.5
-
branches/4.5/src/wp-includes/formatting.php
r44865 r45999 2348 2348 function wp_rel_nofollow_callback( $matches ) { 2349 2349 $text = $matches[1]; 2350 $atts = shortcode_parse_atts( $matches[1]);2350 $atts = wp_kses_hair( $matches[1], wp_allowed_protocols() ); 2351 2351 $rel = 'nofollow'; 2352 2352 2353 2353 if ( ! empty( $atts['href'] ) ) { 2354 $href_parts = wp_parse_url( $atts['href'] );2354 $href_parts = wp_parse_url( $atts['href']['value'] ); 2355 2355 $href_scheme = isset( $href_parts['scheme'] ) ? $href_parts['scheme'] : ''; 2356 2356 $href_host = isset( $href_parts['host'] ) ? $href_parts['host'] : ''; … … 2365 2365 2366 2366 if ( ! empty( $atts['rel'] ) ) { 2367 $parts = array_map( 'trim', explode( ' ', $atts['rel'] ) );2367 $parts = array_map( 'trim', explode( ' ', $atts['rel']['value'] ) ); 2368 2368 if ( false === array_search( 'nofollow', $parts ) ) { 2369 2369 $parts[] = 'nofollow'; … … 2374 2374 $html = ''; 2375 2375 foreach ( $atts as $name => $value ) { 2376 $html .= "{$name}=\"" . esc_attr( $value ) . "\" "; 2376 if ( isset( $value['vless'] ) && 'y' === $value['vless'] ) { 2377 $html .= $name . ' '; 2378 } else { 2379 $html .= "{$name}=\"" . esc_attr( $value['value'] ) . '" '; 2380 } 2377 2381 } 2378 2382 $text = trim( $html ); -
branches/4.5/tests/phpunit/tests/formatting/WPRelNoFollow.php
r36125 r45999 75 75 ); 76 76 } 77 78 public function test_append_no_follow_with_valueless_attribute() { 79 $content = '<p>This is some cool <a href="demo.com" download rel="hola">Code</a></p>'; 80 $expected = '<p>This is some cool <a href=\"demo.com\" download rel=\"hola nofollow\">Code</a></p>'; 81 $this->assertEquals( $expected, wp_rel_nofollow( $content ) ); 82 } 77 83 }
Note: See TracChangeset
for help on using the changeset viewer.