Changeset 46001
- Timestamp:
- 09/04/2019 05:56:42 PM (7 years ago)
- Location:
- branches/4.4
- Files:
-
- 3 edited
-
. (modified) (1 prop)
-
src/wp-includes/formatting.php (modified) (2 diffs)
-
tests/phpunit/tests/formatting/WPRelNoFollow.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/4.4
-
branches/4.4/src/wp-includes/formatting.php
r44841 r46001 2345 2345 function wp_rel_nofollow_callback( $matches ) { 2346 2346 $text = $matches[1]; 2347 $atts = shortcode_parse_atts( $matches[1]);2347 $atts = wp_kses_hair( $matches[1], wp_allowed_protocols() ); 2348 2348 $rel = 'nofollow'; 2349 2349 if ( ! empty( $atts['rel'] ) ) { 2350 $parts = array_map( 'trim', explode( ' ', $atts['rel'] ) );2350 $parts = array_map( 'trim', explode( ' ', $atts['rel']['value'] ) ); 2351 2351 if ( false === array_search( 'nofollow', $parts ) ) { 2352 2352 $parts[] = 'nofollow'; … … 2357 2357 $html = ''; 2358 2358 foreach ( $atts as $name => $value ) { 2359 $html .= "{$name}=\"" . esc_attr( $value ) . "\" "; 2359 if ( isset( $value['vless'] ) && 'y' === $value['vless'] ) { 2360 $html .= $name . ' '; 2361 } else { 2362 $html .= "{$name}=\"" . esc_attr( $value['value'] ) . '" '; 2363 } 2360 2364 } 2361 2365 $text = trim( $html ); -
branches/4.4/tests/phpunit/tests/formatting/WPRelNoFollow.php
r35505 r46001 23 23 $this->assertEquals( $expected, wp_rel_nofollow( $content ) ); 24 24 } 25 26 public function test_append_no_follow_with_valueless_attribute() { 27 $content = '<p>This is some cool <a href="demo.com" download rel="hola">Code</a></p>'; 28 $expected = '<p>This is some cool <a href=\"demo.com\" download rel=\"hola nofollow\">Code</a></p>'; 29 $this->assertEquals( $expected, wp_rel_nofollow( $content ) ); 30 } 25 31 }
Note: See TracChangeset
for help on using the changeset viewer.