setTagsAllowed($tagsAllowed); $this->setAttributesAllowed($attributesAllowed); $this->commentsAllowed = (boolean) $commentsAllowed; } /** * Returns the tagsAllowed option * * @return array */ public function getTagsAllowed() { return $this->_tagsAllowed; } /** * Sets the tagsAllowed option * * @param array|string $tagsAllowed * @return Zend_Filter_StripTags Provides a fluent interface */ public function setTagsAllowed($tagsAllowed) { if (!is_array($tagsAllowed)) { $tagsAllowed = array($tagsAllowed); } foreach ($tagsAllowed as $index => $element) { // If the tag was provided without attributes if (is_int($index) && is_string($element)) { // Canonicalize the tag name $tagName = strtolower($element); // Store the tag as allowed with no attributes $this->_tagsAllowed[$tagName] = array(); } // Otherwise, if a tag was provided with attributes else if (is_string($index) && (is_array($element) || is_string($element))) { // Canonicalize the tag name $tagName = strtolower($index); // Canonicalize the attributes if (is_string($element)) { $element = array($element); } // Store the tag as allowed with the provided attributes $this->_tagsAllowed[$tagName] = array(); foreach ($element as $attribute) { if (is_string($attribute)) { // Canonicalize the attribute name $attributeName = strtolower($attribute); $this->_tagsAllowed[$tagName][$attributeName] = null; } } } } return $this; } /** * Returns the attributesAllowed option * * @return array */ public function getAttributesAllowed() { return $this->_attributesAllowed; } /** * Sets the attributesAllowed option * * @param array|string $attributesAllowed * @return Zend_Filter_StripTags Provides a fluent interface */ public function setAttributesAllowed($attributesAllowed) { if (!is_array($attributesAllowed)) { $attributesAllowed = array($attributesAllowed); } // Store each attribute as allowed foreach ($attributesAllowed as $attribute) { if (is_string($attribute)) { // Canonicalize the attribute name $attributeName = strtolower($attribute); $this->_attributesAllowed[$attributeName] = null; } } return $this; } /** * Defined by Zend_Filter_Interface * * @todo improve docblock descriptions * * @param string $value * @return string */ public function filter($value) { // Strip HTML comments first $valueCopy = preg_replace('#