/** * Ensures that setAttributesAllowed() follows expected behavior when provided an array of attributes * * @return void */ public function testSetAttributesAllowedArray() { $attributesAllowed = array('clAss', 4 => 'inT', 'ok' => 'String', null); $this->_filter->setAttributesAllowed($attributesAllowed); $attributesAllowedExpected = array('class' => null, 'int' => null, 'string' => null); $this->assertEquals($attributesAllowedExpected, $this->_filter->getAttributesAllowed()); }
public function init() { $stripTags = new Zend_Filter_StripTags(); $stripTags->setTagsAllowed(array('p', 'a', 'img', 'strong', 'b', 'i', 'em', 's', 'del')); $stripTags->setAttributesAllowed(array('href', 'target', 'rel', 'name', 'src', 'width', 'height', 'alt', 'title')); $this->addElement('textarea', 'description', array('class' => 'richedit', 'label' => 'Description:', 'required' => true, 'filters' => array('StringTrim', $stripTags), 'validators' => array(new Zend_Validate_NotEmpty())))->addElement('hidden', 'recipe_id')->addElement('submit', 'submit'); }
/** * @group ZF-11617 */ public function testFilterCanAllowHyphenatedAttributeNames() { $input = '<li data-disallowed="no!" data-name="Test User" data-id="11223"></li>'; $expected = '<li data-name="Test User" data-id="11223"></li>'; $this->_filter->setTagsAllowed('li'); $this->_filter->setAttributesAllowed(array('data-id', 'data-name')); $this->assertEquals($expected, $this->_filter->filter($input)); }
/** * Reset filter to the default settings for the current section * @return void */ public static function resetFilter() { if (!self::$filter || !self::$filter instanceof Zend_Filter_StripTags) { self::$filter = new Zend_Filter_StripTags(); } self::$filter->setAttributesAllowed(Sobi::Cfg('html.allowed_attributes_array')); self::$filter->setTagsAllowed(Sobi::Cfg('html.allowed_tags_array')); }
public function init() { $stripTags = new Zend_Filter_StripTags(); $stripTags->setTagsAllowed(array('p', 'a', 'img', 'strong', 'b', 'i', 'em', 's', 'del')); $stripTags->setAttributesAllowed(array('href', 'target', 'rel', 'name', 'src', 'width', 'height', 'alt', 'title')); $this->setAction('/rating/new'); $this->addElement('select', 'value', array('label' => 'Rating:', 'required' => true, 'multiOptions' => array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)))->addElement('textarea', 'comment', array('class' => 'richedit', 'label' => 'Comment:', 'filters' => array('StringTrim', $stripTags), 'validators' => array(new Zend_Validate_NotEmpty())))->addElement('hidden', 'recipe_id')->addElement('submit', 'submit'); }
/** * Ensures that setAttributesAllowed() follows expected behavior when provided a single tag * * @return void */ public function testSetAttributesAllowedString() { $this->_filter->setAttributesAllowed('class'); $this->assertEquals(array('class' => null), $this->_filter->getAttributesAllowed()); }