Changeset 45998
- Timestamp:
- 09/04/2019 05:52:01 PM (7 years ago)
- Location:
- branches/4.6
- Files:
-
- 3 edited
-
. (modified) (1 prop)
-
src/wp-includes/formatting.php (modified) (3 diffs)
-
tests/phpunit/tests/formatting/WPRelNoFollow.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/4.6
-
branches/4.6/src/wp-includes/formatting.php
r44864 r45998 2714 2714 function wp_rel_nofollow_callback( $matches ) { 2715 2715 $text = $matches[1]; 2716 $atts = shortcode_parse_atts( $matches[1]);2716 $atts = wp_kses_hair( $matches[1], wp_allowed_protocols() ); 2717 2717 $rel = 'nofollow'; 2718 2718 2719 2719 if ( ! empty( $atts['href'] ) ) { 2720 $href_parts = wp_parse_url( $atts['href'] );2720 $href_parts = wp_parse_url( $atts['href']['value'] ); 2721 2721 $href_scheme = isset( $href_parts['scheme'] ) ? $href_parts['scheme'] : ''; 2722 2722 $href_host = isset( $href_parts['host'] ) ? $href_parts['host'] : ''; … … 2731 2731 2732 2732 if ( ! empty( $atts['rel'] ) ) { 2733 $parts = array_map( 'trim', explode( ' ', $atts['rel'] ) );2733 $parts = array_map( 'trim', explode( ' ', $atts['rel']['value'] ) ); 2734 2734 if ( false === array_search( 'nofollow', $parts ) ) { 2735 2735 $parts[] = 'nofollow'; … … 2740 2740 $html = ''; 2741 2741 foreach ( $atts as $name => $value ) { 2742 $html .= "{$name}=\"" . esc_attr( $value ) . "\" "; 2742 if ( isset( $value['vless'] ) && 'y' === $value['vless'] ) { 2743 $html .= $name . ' '; 2744 } else { 2745 $html .= "{$name}=\"" . esc_attr( $value['value'] ) . '" '; 2746 } 2743 2747 } 2744 2748 $text = trim( $html ); -
branches/4.6/tests/phpunit/tests/formatting/WPRelNoFollow.php
r36125 r45998 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.