check if $resource is set
This commit is contained in:
parent
60148a3b65
commit
d00e5a03c8
1 changed files with 5 additions and 0 deletions
|
@ -41,9 +41,14 @@ class Webfinger {
|
||||||
* @return string|WP_Error The URL or WP_Error
|
* @return string|WP_Error The URL or WP_Error
|
||||||
*/
|
*/
|
||||||
public static function resolve( $resource ) {
|
public static function resolve( $resource ) {
|
||||||
|
if ( ! $resource ) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
if ( ! preg_match( '/^@?' . ACTIVITYPUB_USERNAME_REGEXP . '$/i', $resource, $m ) ) {
|
if ( ! preg_match( '/^@?' . ACTIVITYPUB_USERNAME_REGEXP . '$/i', $resource, $m ) ) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$transient_key = 'activitypub_resolve_' . ltrim( $resource, '@' );
|
$transient_key = 'activitypub_resolve_' . ltrim( $resource, '@' );
|
||||||
|
|
||||||
$link = \get_transient( $transient_key );
|
$link = \get_transient( $transient_key );
|
||||||
|
|
Loading…
Reference in a new issue