/** * @return \Texy */ public function createTexyForComment() { $texy = new \Texy(); $texy->headingModule->top = 3; $texy->setOutputMode(\Texy::HTML5); // Images $texy->imageModule->root = '.' . $this->imagesRoot; $texy->imageModule->fileRoot = $this->imagesFileRoot; \TexyConfigurator::safeMode($texy); \TexyConfigurator::disableImages($texy); //$texy->allowed['blockquote'] = false; $texy->allowed['emoticon'] = false; $texy->allowed['heading/underlined'] = false; $texy->allowed['heading/surrounded'] = false; $texy->allowed['horizline'] = false; //$texy->allowed['html/tag'] = false; $texy->allowed['html/comment'] = false; //$texy->allowed['list'] = false; //$texy->allowed['list/definition'] = false; $texy->allowed['script'] = false; $texy->allowed['table'] = false; $texy->linkModule->forceNoFollow = true; $texy->addHandler('block', [$this, 'blockHandler']); return $texy; }
/** * Обработать строку (вся разметка): */ public static function markup($text, $safeMode = true, $links = true, $board = null) { $texy = self::createTexyObject($links, $board); if ($safeMode) { TexyConfigurator::safeMode($texy); TexyConfigurator::disableImages($texy); } return $texy->process($text); }