oJevix = new Jevix(); $this->JevixConfig(); } /** * Конфигурирует типограф * */ protected function JevixConfig() { // разрешаем в параметрах символ & unset($this->oJevix->entities1['&']); // Разрешённые теги $this->oJevix->cfgAllowTags(array('noindex','cut','a', 'img', 'i', 'b', 'u', 's', 'video', 'em', 'strong', 'nobr', 'li', 'ol', 'ul', 'sup', 'abbr', 'sub', 'acronym', 'h4', 'h5', 'h6', 'br', 'hr', 'pre', 'code', 'object', 'param', 'embed', 'blockquote')); // Коротие теги типа $this->oJevix->cfgSetTagShort(array('br','img', 'hr', 'cut')); // Преформатированные теги $this->oJevix->cfgSetTagPreformatted(array('pre','code','video')); // Разрешённые параметры тегов $this->oJevix->cfgAllowTagParams('img', array('src', 'alt' => '#text', 'title', 'align' => array('right', 'left', 'center'), 'width' => '#int', 'height' => '#int', 'hspace' => '#int', 'vspace' => '#int')); $this->oJevix->cfgAllowTagParams('a', array('title', 'href', 'rel')); $this->oJevix->cfgAllowTagParams('cut', array('name')); $this->oJevix->cfgAllowTagParams('object', array('width' => '#int', 'height' => '#int', 'data' => '#link', 'type' => '#text')); $this->oJevix->cfgAllowTagParams('param', array('name' => '#text', 'value' => '#text')); $this->oJevix->cfgAllowTagParams('embed', array('src' => '#image', 'type' => '#text','allowscriptaccess' => '#text', 'allowfullscreen' => '#text','width' => '#int', 'height' => '#int', 'flashvars'=> '#text', 'wmode'=> '#text')); // Параметры тегов являющиеся обязательными $this->oJevix->cfgSetTagParamsRequired('img', 'src'); $this->oJevix->cfgSetTagParamsRequired('a', 'href'); // Теги которые необходимо вырезать из текста вместе с контентом $this->oJevix->cfgSetTagCutWithContent(array('script', 'iframe', 'style')); // Вложенные теги $this->oJevix->cfgSetTagChilds('ul', array('li'), false, true); $this->oJevix->cfgSetTagChilds('ol', array('li'), false, true); $this->oJevix->cfgSetTagChilds('object', 'param', false, true); $this->oJevix->cfgSetTagChilds('object', 'embed', false, false); // Если нужно оставлять пустые не короткие теги $this->oJevix->cfgSetTagIsEmpty(array('param','embed')); // Не нужна авто-расстановка
$this->oJevix->cfgSetTagNoAutoBr(array('ul','ol','object')); // Теги с обязательными параметрами $this->oJevix->cfgSetTagParamDefault('embed','wmode','opaque',true); if (Config::Get('view.noindex')) { $this->oJevix->cfgSetTagParamDefault('a','rel','nofollow','noindex',true); } // Отключение авто-добавления
$this->oJevix->cfgSetAutoBrMode(true); // Автозамена $this->oJevix->cfgSetAutoReplace(array('+/-', '(c)', '(с)', '(r)', '(C)', '(С)', '(R)'), array('±', '©', '©', '®', '©', '©', '®')); //$this->oJevix->cfgSetXHTMLMode(false); $this->oJevix->cfgSetTagNoTypography('code'); $this->oJevix->cfgSetTagNoTypography('video'); $this->oJevix->cfgSetTagNoTypography('object'); // Теги, после которых необходимо пропускать одну пробельную строку $this->oJevix->cfgSetTagBlockType(array('h4','h5','h6','ol','ul','blockquote','pre')); } /** * Парсинг текста с помощью Jevix * * @param string $sText * @param array $aError * @return string */ public function JevixParser($sText,&$aError=null) { $sResult=$this->oJevix->parse($sText,$aError); return $sResult; } /** * Парсинг текста на предмет видео * * @param string $sText * @return string */ public function VideoParser($sText) { /** * youtube.com */ $sText = preg_replace('/