Navigation Menu

Skip to content
This repository has been archived by the owner on May 24, 2018. It is now read-only.

Commit

Permalink
Merge branch 'fix/#1279-#1280-zend-filter-strip-tags-documentation' i…
Browse files Browse the repository at this point in the history
…nto develop

Close #1279
Close #1280
Forward Port #1280
  • Loading branch information
Ocramius committed May 20, 2014
2 parents b8dc25f + d8fc664 commit f7d502f
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions docs/languages/en/modules/zend.filter.strip-tags.rst
Expand Up @@ -102,3 +102,31 @@ It is also possible to strip all but allowed attributes from a tag.
The above will return 'A text with a <img src='picture.com'>picture</img>' as result. It strips all
tags but img. Additionally from the img tag all attributes but src will be stripped. By providing an
array you can set multiple attributes at once.

.. _zend.filter.set.striptags.allowadvanceattributes:

Allowing Advanced Defined Tags with Attributes
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

You can pass the allowed tags with their attributes in a single array to the constructor.

.. code-block:: php
:linenos:
$allowedElements = array(
'img' => array(
'src',
'width'
),
'a' => array(
'href'
)
);
$filter = new Zend\Filter\StripTags($allowedElements);
$input = "A text with <br/> a <img src='picture.com' width='100'>picture</img> click " .
"<a href='http://picture.com/zend' id='hereId'>here</a>!";
print $filter->filter($input);
The above will return 'A text with a <img src='picture.com' width='100'>picture</img> click
<a href='http://picture.com/zend'>here</a>!' as result.

0 comments on commit f7d502f

Please sign in to comment.