From bf8acf9f512c8652ce46afae738ff7e2412f9f89 Mon Sep 17 00:00:00 2001 From: Matthias Pfefferle Date: Tue, 18 Jul 2023 08:14:28 +0200 Subject: [PATCH] use wp_rand and change hashtags too --- includes/class-hashtag.php | 2 +- includes/class-mention.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/class-hashtag.php b/includes/class-hashtag.php index ca855ef..4f5b0f6 100644 --- a/includes/class-hashtag.php +++ b/includes/class-hashtag.php @@ -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; diff --git a/includes/class-mention.php b/includes/class-mention.php index 6798833..63508e8 100644 --- a/includes/class-mention.php +++ b/includes/class-mention.php @@ -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];