phpbb\textreparser\base::guess_bbcode PHP Метод

guess_bbcode() защищенный Метод

Guess whether given BBCode is in use in given record
protected guess_bbcode ( array $record, string $bbcode ) : boolean
$record array
$bbcode string
Результат boolean
    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;
    }