normalizing
This commit is contained in:
parent
6ddbe25852
commit
359cd57081
1 changed files with 13 additions and 2 deletions
|
@ -130,8 +130,8 @@ class User_Factory {
|
||||||
$resource = \str_replace( 'acct:', '', $resource );
|
$resource = \str_replace( 'acct:', '', $resource );
|
||||||
|
|
||||||
$resource_identifier = \substr( $resource, 0, \strrpos( $resource, '@' ) );
|
$resource_identifier = \substr( $resource, 0, \strrpos( $resource, '@' ) );
|
||||||
$resource_host = \str_replace( 'www.', '', \substr( \strrchr( $resource, '@' ), 1 ) );
|
$resource_host = self::normalize_host( \substr( \strrchr( $resource, '@' ), 1 ) );
|
||||||
$blog_host = \str_replace( 'www.', '', \wp_parse_url( \home_url( '/' ), \PHP_URL_HOST ) );
|
$blog_host = self::normalize_host( \wp_parse_url( \home_url( '/' ), \PHP_URL_HOST ) );
|
||||||
|
|
||||||
if ( $blog_host !== $resource_host ) {
|
if ( $blog_host !== $resource_host ) {
|
||||||
return new WP_Error(
|
return new WP_Error(
|
||||||
|
@ -160,4 +160,15 @@ class User_Factory {
|
||||||
return self::get_by_username( $id );
|
return self::get_by_username( $id );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Normalize the host.
|
||||||
|
*
|
||||||
|
* @param string $host The host.
|
||||||
|
*
|
||||||
|
* @return string The normalized host.
|
||||||
|
*/
|
||||||
|
public static function normalize_host( $host ) {
|
||||||
|
return \str_replace( 'www.', '', $host );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue