I want to parse a web-page stored as a variable to filter out the attributes of certain html tags before redisplaying it:
Some Definitions
$allow['a'] = array('href','name','style');
$allow['font'] = array('face','style','size','color');
I am cleaning out most HTML tags using the following:
$text = strip_tags($text,implode(',',array_keys($allow)));
$text = eregi_replace('javascript:','',$text);
At this point, using this example I want to leave only <a> and <font> tags and only allow the attributes that are associated with those keys in the allow array.
I'm assuming this could be quickly solved with a clever preg_replace or two?