Skip to content

Instantly share code, notes, and snippets.

@padraic
Created December 11, 2009 16:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save padraic/254299 to your computer and use it in GitHub Desktop.
Save padraic/254299 to your computer and use it in GitHub Desktop.
<?php
require_once 'Zend/Filter/StripTags.php';
$source = <<<string
<img src=http://www.example.com/image.png></img>
string;
$filter = new Zend_Filter_StripTags;
$allowed = array(
'img'=>array('src')
);
$filter->setTagsAllowed($allowed);
$out = $filter->filter($source); // <img></img>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment