mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
If i could force you all to use PHP 5.1.0+, then i could just use the count param with preg_replace. Oh well...
git-svn-id: file:///svn/phpbb/trunk@6292 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
332bd12835
commit
75ca1c9764
2 changed files with 18 additions and 11 deletions
|
@ -2375,7 +2375,7 @@ function get_preg_expression($mode)
|
||||||
switch ($mode)
|
switch ($mode)
|
||||||
{
|
{
|
||||||
case 'email':
|
case 'email':
|
||||||
return '[a-z0-9&\'\.\-_\+]+@[a-z0-9\-]+\.([a-z0-9\-]+\.)*?[a-z]+';
|
return '[a-z0-9&\'\.\-_\+]+@[a-z0-9\-]+\.([a-z0-9\-]+\.)*[a-z]+';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,6 @@ class bbcode_firstpass extends bbcode
|
||||||
$this->bbcode_bitfield = '';
|
$this->bbcode_bitfield = '';
|
||||||
$bitfield = new bitfield();
|
$bitfield = new bitfield();
|
||||||
|
|
||||||
$size = strlen($this->message);
|
|
||||||
foreach ($this->bbcodes as $bbcode_name => $bbcode_data)
|
foreach ($this->bbcodes as $bbcode_name => $bbcode_data)
|
||||||
{
|
{
|
||||||
if (isset($bbcode_data['disabled']) && $bbcode_data['disabled'])
|
if (isset($bbcode_data['disabled']) && $bbcode_data['disabled'])
|
||||||
|
@ -63,20 +62,28 @@ class bbcode_firstpass extends bbcode
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// TODO: Review this
|
||||||
|
$found = false;
|
||||||
foreach ($bbcode_data['regexp'] as $regexp => $replacement)
|
foreach ($bbcode_data['regexp'] as $regexp => $replacement)
|
||||||
{
|
{
|
||||||
|
if (!$found)
|
||||||
|
{
|
||||||
|
$before = strlen($this->message);
|
||||||
|
}
|
||||||
$this->message = preg_replace($regexp, $replacement, $this->message);
|
$this->message = preg_replace($regexp, $replacement, $this->message);
|
||||||
|
if (!$found)
|
||||||
|
{
|
||||||
|
$after = strlen($this->message);
|
||||||
|
if ($before != $after)
|
||||||
|
{
|
||||||
|
// Because we add bbcode_uid to all tags, the message length
|
||||||
|
// will increase whenever a tag is found
|
||||||
|
$bitfield->set($bbcode_data['bbcode_id']);
|
||||||
|
$found = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Because we add bbcode_uid to all tags, the message length
|
|
||||||
// will increase whenever a tag is found
|
|
||||||
$new_size = strlen($this->message);
|
|
||||||
if ($size != $new_size)
|
|
||||||
{
|
|
||||||
$bitfield->set($bbcode_data['bbcode_id']);
|
|
||||||
$size = $new_size;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->bbcode_bitfield = $bitfield->get_base64();
|
$this->bbcode_bitfield = $bitfield->get_base64();
|
||||||
|
|
Loading…
Add table
Reference in a new issue