diff --git a/includes/class-mention.php b/includes/class-mention.php index e0930cc..9c93d80 100644 --- a/includes/class-mention.php +++ b/includes/class-mention.php @@ -46,6 +46,12 @@ class Mention { $the_content ); + $the_content = preg_replace_callback( + '#]+>#i', + $protect, + $the_content + ); + $the_content = \preg_replace_callback( '/@' . ACTIVITYPUB_USERNAME_REGEXP . '/', array( self::class, 'replace_with_links' ), $the_content ); $the_content = str_replace( array_reverse( array_keys( $protected_tags ) ), array_reverse( array_values( $protected_tags ) ), $the_content ); diff --git a/tests/test-class-activitypub-mention.php b/tests/test-class-activitypub-mention.php index 6f6b9ff..ca7395f 100644 --- a/tests/test-class-activitypub-mention.php +++ b/tests/test-class-activitypub-mention.php @@ -31,6 +31,7 @@ ENDPRE; array( 'hallo @pfefferle@notiz.blog test', 'hallo @pfefferle@notiz.blog test' ), array( 'hallo @pfefferle@notiz.blog test', 'hallo @pfefferle@notiz.blog test' ), array( 'hallo @pfefferle@notiz.blog test', 'hallo @pfefferle@notiz.blog test' ), + array( 'hallo https://notiz.blog/@pfefferle/ test', 'hallo https://notiz.blog/@pfefferle/ test' ), array( $code, $code ), array( $pre, $pre ), );