diff --git a/include/class.thread.php b/include/class.thread.php index c69eb28549412bd25454a24f7df97334299331aa..741fb449a648513a72b752412a5a7f6107cb0dbd 100644 --- a/include/class.thread.php +++ b/include/class.thread.php @@ -1352,6 +1352,11 @@ class ThreadBody /* extends SplString */ { throw new Exception('display: Abstract dispplay() method not implemented'); } + function getSearchable() { + return $this->body; + // TODO: Normalize Unicode string + } + static function fromFormattedText($text, $format=false) { switch ($format) { case 'text': @@ -1419,6 +1424,13 @@ class HtmlThreadBody extends ThreadBody { return trim($this->body, " <>br/\t\n\r") ? Format::sanitize($this->body) : ''; } + function getSearchable() { + // <br> -> \n + $body = preg_replace('/\<br(\s*)?\/?\>/i', "\n", $this->body); + return Format::striptags($body); + // TODO: Normalize Unicode string + } + function display($output=false) { if ($this->isEmpty()) return '(empty)';