diff options
author | David M <davidmj@users.sourceforge.net> | 2007-06-10 13:39:04 +0000 |
---|---|---|
committer | David M <davidmj@users.sourceforge.net> | 2007-06-10 13:39:04 +0000 |
commit | de739b6532f16cc187a3ef492343807229f7b3c4 (patch) | |
tree | bd5b1d82524b66e5df3c86bf01a1474102206ffe /phpBB | |
parent | e41b3b89437c166588e2ae77f02c85d1c238665b (diff) | |
download | forums-de739b6532f16cc187a3ef492343807229f7b3c4.tar forums-de739b6532f16cc187a3ef492343807229f7b3c4.tar.gz forums-de739b6532f16cc187a3ef492343807229f7b3c4.tar.bz2 forums-de739b6532f16cc187a3ef492343807229f7b3c4.tar.xz forums-de739b6532f16cc187a3ef492343807229f7b3c4.zip |
removed a looped regex
git-svn-id: file:///svn/phpbb/trunk@7743 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB')
-rw-r--r-- | phpBB/includes/message_parser.php | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php index 52e7af76cd..370a409d2f 100644 --- a/phpBB/includes/message_parser.php +++ b/phpBB/includes/message_parser.php @@ -1239,26 +1239,17 @@ class parse_message extends bbcode_firstpass { if ($max_smilies) { - $count = 0; - foreach ($match as $key => $smilie) + $num_matches = preg_match_all('#' . str_replace('#', '', implode('|', $match)) . '#', $this->message, $matches); + unset($matches); + + if ($num_matches !== false && $num_matches > $max_smilies) { - if ($small_count = preg_match_all($smilie, $this->message, $array)) - { - $count += $small_count; - if ($count > $max_smilies) - { - $this->warn_msg[] = sprintf($user->lang['TOO_MANY_SMILIES'], $max_smilies); - return; - } - } - $this->message = preg_replace($smilie, $replace[$key], $this->message); + $this->warn_msg[] = sprintf($user->lang['TOO_MANY_SMILIES'], $max_smilies); + return; } - $this->message = trim($this->message); - } - else - { - $this->message = trim(preg_replace($match, $replace, $this->message)); } + + $this->message = trim(preg_replace($match, $replace, $this->message)); } } |