From the user submitted post there are things like殺菌javascript在<a onclick="sth" href =""> in user input
<a onclick="sth()" href ="legitlink.html">some content</a>
I would like to preserve the link so that the link can still be display, but the javascript part should be sterilized
<a href="legitlink.html">some content</a>
How can this be done in php? Is there some extensions or frameworks that handle these kind of work automatically?