mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-14 22:56:19 +01:00
Formatting: Improve rel="nofollow"
handling in comments.
Merges [44833] to the 5.0 branch. Built from https://develop.svn.wordpress.org/branches/5.0@44835 git-svn-id: http://core.svn.wordpress.org/branches/5.0@44667 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
4aecf904f2
commit
4c251a6373
@ -2750,10 +2750,12 @@ function wp_rel_nofollow_callback( $matches ) {
|
||||
$atts = shortcode_parse_atts( $matches[1] );
|
||||
$rel = 'nofollow';
|
||||
|
||||
if ( preg_match( '%href=["\'](' . preg_quote( set_url_scheme( home_url(), 'http' ) ) . ')%i', $text ) ||
|
||||
preg_match( '%href=["\'](' . preg_quote( set_url_scheme( home_url(), 'https' ) ) . ')%i', $text )
|
||||
) {
|
||||
return "<a $text>";
|
||||
if ( ! empty( $atts['href'] ) ) {
|
||||
if ( in_array( strtolower( wp_parse_url( $atts['href'], PHP_URL_SCHEME ) ), array( 'http', 'https' ), true ) ) {
|
||||
if ( strtolower( wp_parse_url( $atts['href'], PHP_URL_HOST ) ) === strtolower( wp_parse_url( home_url(), PHP_URL_HOST ) ) ) {
|
||||
return "<a $text>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! empty( $atts['rel'] ) ) {
|
||||
@ -2766,11 +2768,11 @@ function wp_rel_nofollow_callback( $matches ) {
|
||||
|
||||
$html = '';
|
||||
foreach ( $atts as $name => $value ) {
|
||||
$html .= "{$name}=\"$value\" ";
|
||||
$html .= "{$name}=\"" . esc_attr( $value ) . "\" ";
|
||||
}
|
||||
$text = trim( $html );
|
||||
}
|
||||
return "<a $text rel=\"$rel\">";
|
||||
return "<a $text rel=\"" . esc_attr( $rel ) . "\">";
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.0.4-alpha-44523';
|
||||
$wp_version = '5.0.4-alpha-44835';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user