Skip to content

Commit 7e3a5f4

Browse files
committed
Handle double protect
1 parent 6ea46c5 commit 7e3a5f4

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

includes/class-hashtag.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public static function the_content( $the_content ) {
5151
return $protect;
5252
};
5353
$the_content = preg_replace_callback(
54-
'#<![CDATA[.*?]]>#is',
54+
'#<!\[CDATA\[.*?\]\]>#is',
5555
$protect,
5656
$the_content
5757
);
@@ -68,7 +68,7 @@ public static function the_content( $the_content ) {
6868

6969
$the_content = \preg_replace_callback( '/' . ACTIVITYPUB_HASHTAGS_REGEXP . '/i', array( '\Activitypub\Hashtag', 'replace_with_links' ), $the_content );
7070

71-
$the_content = str_replace( array_keys( $protected_tags ), array_values( $protected_tags ), $the_content );
71+
$the_content = str_replace( array_reverse( array_keys( $protected_tags ) ), array_reverse( array_values( $protected_tags ) ), $the_content );
7272

7373
return $the_content;
7474
}

includes/class-mention.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public static function the_content( $the_content ) {
3131
return $protect;
3232
};
3333
$the_content = preg_replace_callback(
34-
'#<![CDATA[.*?]]>#is',
34+
'#<!\[CDATA\[.*?\]\]>#is',
3535
$protect,
3636
$the_content
3737
);
@@ -48,7 +48,7 @@ public static function the_content( $the_content ) {
4848

4949
$the_content = \preg_replace_callback( '/@' . ACTIVITYPUB_USERNAME_REGEXP . '/', array( '\Activitypub\Mention', 'replace_with_links' ), $the_content );
5050

51-
$the_content = str_replace( array_keys( $protected_tags ), array_values( $protected_tags ), $the_content );
51+
$the_content = str_replace( array_reverse( array_keys( $protected_tags ) ), array_reverse( array_values( $protected_tags ) ), $the_content );
5252

5353
return $the_content;
5454
}

0 commit comments

Comments
 (0)