Formatting: Fix a PHP warning in introduced in [44839].

git-svn-id: https://develop.svn.wordpress.org/branches/4.6@44864 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2019-03-13 00:34:42 +00:00
parent aa98e00bdb
commit 6de345d505

View File

@ -2717,8 +2717,13 @@ function wp_rel_nofollow_callback( $matches ) {
$rel = 'nofollow';
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 ) ) ) {
$href_parts = wp_parse_url( $atts['href'] );
$href_scheme = isset( $href_parts['scheme'] ) ? $href_parts['scheme'] : '';
$href_host = isset( $href_parts['host'] ) ? $href_parts['host'] : '';
$home_parts = wp_parse_url( home_url() );
$home_host = isset( $home_parts['host'] ) ? $home_parts['host'] : '';
if ( in_array( strtolower( $href_scheme ), array( 'http', 'https' ), true ) ) {
if ( strtolower( $href_host ) === strtolower( $home_host ) ) {
return "<a $text>";
}
}