diff --git a/includes/class-hashtag.php b/includes/class-hashtag.php index 9ce8b34..b14a8fa 100644 --- a/includes/class-hashtag.php +++ b/includes/class-hashtag.php @@ -51,7 +51,7 @@ class Hashtag { return $protect; }; $the_content = preg_replace_callback( - '##is', + '##is', $protect, $the_content ); @@ -68,7 +68,7 @@ class Hashtag { $the_content = \preg_replace_callback( '/' . ACTIVITYPUB_HASHTAGS_REGEXP . '/i', array( '\Activitypub\Hashtag', 'replace_with_links' ), $the_content ); - $the_content = str_replace( array_keys( $protected_tags ), array_values( $protected_tags ), $the_content ); + $the_content = str_replace( array_reverse( array_keys( $protected_tags ) ), array_reverse( array_values( $protected_tags ) ), $the_content ); return $the_content; } diff --git a/includes/class-mention.php b/includes/class-mention.php index 7012e40..7c8672a 100644 --- a/includes/class-mention.php +++ b/includes/class-mention.php @@ -31,7 +31,7 @@ class Mention { return $protect; }; $the_content = preg_replace_callback( - '##is', + '##is', $protect, $the_content ); @@ -48,7 +48,7 @@ class Mention { $the_content = \preg_replace_callback( '/@' . ACTIVITYPUB_USERNAME_REGEXP . '/', array( '\Activitypub\Mention', 'replace_with_links' ), $the_content ); - $the_content = str_replace( array_keys( $protected_tags ), array_values( $protected_tags ), $the_content ); + $the_content = str_replace( array_reverse( array_keys( $protected_tags ) ), array_reverse( array_values( $protected_tags ) ), $the_content ); return $the_content; }