protected function guess_bbcode(array $record, $bbcode)
{
if (!empty($record['bbcode_uid'])) {
// Look for the closing tag, e.g. [/url]
$match = '[/' . $bbcode . ':' . $record['bbcode_uid'];
if (strpos($record['text'], $match) !== false) {
return true;
}
}
if (substr($record['text'], 0, 2) === '<r') {
// Look for the closing tag inside of a e element, in an element of the same name, e.g.
// <e>[/url]</e></URL>
$match = '<e>[/' . $bbcode . ']</e></' . strtoupper($bbcode) . '>';
if (strpos($record['text'], $match) !== false) {
return true;
}
}
return false;
}