示例#1
0
 /**
  * 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());
 }
示例#2
0
 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');
 }
示例#3
0
 /**
  * @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));
 }
示例#4
0
 /**
  * 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'));
 }
示例#5
0
 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());
 }