Handle double protect

This commit is contained in:
Alex Kirk 2023-01-27 17:23:25 +01:00
parent 6ea46c5024
commit 7e3a5f4e68
2 changed files with 4 additions and 4 deletions

View file

@ -51,7 +51,7 @@ class Hashtag {
return $protect; return $protect;
}; };
$the_content = preg_replace_callback( $the_content = preg_replace_callback(
'#<![CDATA[.*?]]>#is', '#<!\[CDATA\[.*?\]\]>#is',
$protect, $protect,
$the_content $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 = \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; return $the_content;
} }

View file

@ -31,7 +31,7 @@ class Mention {
return $protect; return $protect;
}; };
$the_content = preg_replace_callback( $the_content = preg_replace_callback(
'#<![CDATA[.*?]]>#is', '#<!\[CDATA\[.*?\]\]>#is',
$protect, $protect,
$the_content $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 = \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; return $the_content;
} }