* @license GNU General Public License, version 2 (GPL-2.0) * * For full copyright and license information, please see * the docs/CREDITS.txt file. * */ namespace phpbb\textreparser; abstract class base implements reparser_interface { /** * {@inheritdoc} */ abstract public function get_max_id(); /** * Return all records in given range * * @param integer $min_id Lower bound * @param integer $max_id Upper bound * @return array Array of record */ abstract protected function get_records($min_id, $max_id); /** * Guess whether given BBCode is in use in given record * * @param array $record * @param string $bbcode * @return bool */ 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 (stripos($record['text'], $match) !== false) { return true; } } if (substr($record['text'], 0, 2) == '[/url] $match = '[/' . $bbcode . ']'; if (stripos($record['text'], $match) !== false) { return true; } } return false; } /** * Guess whether magic URLs are in use in given record * * @param array $record * @return bool */ protected function guess_magic_url(array $record) { // Look for or for a URL tag that's not immediately followed by return (strpos($record['text'], '') !== false || preg_match('(]++>(?!))', strpos($row['text']))); } /** * Guess whether smilies are in use in given record * * @param array $record * @return bool */ protected function guess_smilies(array $record) { return (strpos($row['text'], '