try replacing:
PHP Code:
$textlinks = $DB_site->query(" SELECT text, link FROM " . TABLE_PREFIX . "textlink");
$findtext = array();
$replacetext = array();
while($link = $DB_site->fetch_array($textlinks))
{
$findtext[] = $link['text'];
$replacetext[] = "[url=" . $link['link'] . "]" . $link['text'] . "[/url]";
}
$bbcode = str_replace($findtext, $replacetext, $bbcode);
with
PHP Code:
static $customReplaceInit = false;
static $findtext = array();
static $replacetext = array();
if (!$customReplaceInit)
{
$textlinks = $DB_site->query(" SELECT text, link FROM " . TABLE_PREFIX . "textlink");
while($link = $DB_site->fetch_array($textlinks))
{
$findtext[] = $link['text'];
$replacetext[] = "[url=" . $link['link'] . "]" . $link['text'] . "[/url]";
}
$customReplaceInit = true;
}
$bbcode = str_replace($findtext, $replacetext, $bbcode);
that should help with your queries problem. I didn't test it but it should work
Take in consideration that we already have something called "replacement vars" that are configurable per style and that do "almost" the same thing that you are doing, except that they do it in a global way and not only in the post content. For words like google that are not part of any html or titles one might as well use replacement vars.