Short-circuit some more examples
This commit is contained in:
parent
738208b70d
commit
fed4fcb5b4
2 changed files with 14 additions and 2 deletions
|
@ -180,7 +180,16 @@ add_filter(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( rtrim( strtok( $domain, '.' ), '0123456789' ) === 'example' ) {
|
if ( preg_match( '/[^a-zA-Z0-9.-]/', $domain ) ) {// invalid characters
|
||||||
|
return $metadata;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
rtrim( strtok( $domain, '.' ), '0123456789' ) === 'example' // classic example.org domain
|
||||||
|
|| preg_match( '/(my|your|our)-(domain)/', $domain )
|
||||||
|
|| preg_match( '/(test)/', $domain )
|
||||||
|
|| in_array( $username, array( 'example' ), true )
|
||||||
|
) {
|
||||||
$metadata = array(
|
$metadata = array(
|
||||||
'url' => sprintf( 'https://%s/users/%s/', $domain, $username ),
|
'url' => sprintf( 'https://%s/users/%s/', $domain, $username ),
|
||||||
'name' => $username,
|
'name' => $username,
|
||||||
|
|
|
@ -24,7 +24,7 @@ class Test_Functions extends ActivityPub_TestCase_Cache_HTTP {
|
||||||
public function example_actors() {
|
public function example_actors() {
|
||||||
$actors = array();
|
$actors = array();
|
||||||
foreach ( array( 'user', 'test' ) as $username ) {
|
foreach ( array( 'user', 'test' ) as $username ) {
|
||||||
foreach ( array( 'example.org', 'example.net', 'example2.com' ) as $domain ) {
|
foreach ( array( 'example.org', 'example.net', 'example2.com', 'my-domain.com', 'your-domain.org', 'test.net' ) as $domain ) {
|
||||||
foreach ( array( '@', '' ) as $leading_at ) {
|
foreach ( array( '@', '' ) as $leading_at ) {
|
||||||
$actors[] = array( $leading_at . $username . '@' . $domain, $domain, $username );
|
$actors[] = array( $leading_at . $username . '@' . $domain, $domain, $username );
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,9 @@ class Test_Functions extends ActivityPub_TestCase_Cache_HTTP {
|
||||||
$actors[] = array( sprintf( 'https://%s/@%s', $domain, $username ), $domain, $username );
|
$actors[] = array( sprintf( 'https://%s/@%s', $domain, $username ), $domain, $username );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$actors[] = array( 'example@abc.org', 'abc.org', 'example' );
|
||||||
|
|
||||||
return $actors;
|
return $actors;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue