/** * @return Jevix */ private static function getJevix($tagList = null, $attrList = null, $blackListMode = false, $mediaSrcValidate = true) { if (self::$jevix === null) { require_once OW_DIR_LIB . 'jevix' . DS . 'jevix.class.php'; self::$jevix = new Jevix(); } $tagRules = array(); $commonAttrs = array(); if (!empty($tagList)) { foreach ($tagList as $tag) { $tagRules[$tag] = array(Jevix::TR_TAG_LIST => true); } } if ($attrList !== null) { foreach ($attrList as $attr) { if (strstr($attr, '.')) { $parts = explode('.', $attr); $tag = trim($parts[0]); $param = trim($parts[1]); if (!strlen($tag) || !strlen($attr)) { continue; } if ($tag === '*') { $commonAttrs[] = $param; continue; } if (!isset($tagRules[$tag])) { $tagRules[$tag] = array(Jevix::TR_TAG_LIST => true); } if (!isset($tagRules[$tag][Jevix::TR_PARAM_ALLOWED])) { $tagRules[$tag][Jevix::TR_PARAM_ALLOWED] = array(); } $tagRules[$tag][Jevix::TR_PARAM_ALLOWED][$param] = true; } else { $commonAttrs[] = trim($attr); } } } $shortTags = array('img', 'br', 'input', 'embed', 'param', 'hr', 'link', 'meta', 'base', 'col'); foreach ($shortTags as $shortTag) { if (!isset($tagRules[$shortTag])) { $tagRules[$shortTag] = array(); } $tagRules[$shortTag][Jevix::TR_TAG_SHORT] = true; } $cutWithContent = array('script', 'embed', 'object', 'style'); foreach ($cutWithContent as $cutTag) { if (!isset($tagRules[$cutTag])) { $tagRules[$cutTag] = array(); } $tagRules[$cutTag][Jevix::TR_TAG_CUT] = true; } self::$jevix->blackListMode = $blackListMode; self::$jevix->commonTagParamRules = $commonAttrs; self::$jevix->tagsRules = $tagRules; self::$jevix->mediaSrcValidate = $mediaSrcValidate; self::$jevix->mediaValidSrc = BOL_TextFormatService::getInstance()->getMediaResourceList(); return self::$jevix; }