use wp_rand and change hashtags too

This commit is contained in:
Matthias Pfefferle 2023-07-18 08:14:28 +02:00
parent ab6aefe446
commit bf8acf9f51
2 changed files with 3 additions and 3 deletions

View file

@ -45,7 +45,7 @@ class Hashtag {
public static function the_content( $the_content ) {
$protected_tags = array();
$protect = function( $m ) use ( &$protected_tags ) {
$c = count( $protected_tags );
$c = \wp_rand( 100000, 999999 );
$protect = '!#!#PROTECT' . $c . '#!#!';
$protected_tags[ $protect ] = $m[0];
return $protect;

View file

@ -27,10 +27,10 @@ class Mention {
public static function the_content( $the_content ) {
$protected_tags = array();
$protect = function( $m ) use ( &$protected_tags ) {
$c = \rand( 100000, 999999 );
$c = \wp_rand( 100000, 999999 );
$protect = '!#!#PROTECT' . $c . '#!#!';
while ( isset( $protected_tags[ $protect ] ) ) {
$c = \rand( 100000, 999999 );
$c = \wp_rand( 100000, 999999 );
$protect = '!#!#PROTECT' . $c . '#!#!';
}
$protected_tags[ $protect ] = $m[0];