BBCodeLexer::GuessTextLength()
Contents
Description Description
Source Source
File: includes/admin/parser.php
function GuessTextLength() { $length = 0; $ptr = 0; $state = BBCODE_LEXSTATE_TEXT; while ($ptr < count($this->input)) { $text = $this->input[$ptr++]; if ($state == BBCODE_LEXSTATE_TEXT) { $state = BBCODE_LEXSTATE_TAG; $length += strlen($text); } else { switch (ord(substr($this->text, 0, 1))) { case 10: case 13: $state = BBCODE_LEXSTATE_TEXT; $length++; break; default: $state = BBCODE_LEXSTATE_TEXT; $length += strlen($text); break; case 40: case 60: case 91: case 123: $state = BBCODE_LEXSTATE_TEXT; break; } } } return $length; }