Title: Unfiltered HTML processing issue
Last modified: April 14, 2022

---

# Unfiltered HTML processing issue

 *  Resolved [tyaty1](https://wordpress.org/support/users/tyaty1/)
 * (@tyaty1)
 * [4 years, 1 month ago](https://wordpress.org/support/topic/unfiltered-html-processing-issue/)
 *     ```
          // To filter out JS, we should use domdocument, but the problem is that sometimes the 
          // html is intentional incomplete, which would cause issues with domdocument
          // See https://codereview.stackexchange.com/questions/30045/regex-to-remove-inline-javascript-from-string
          if ($allow_unfiltered) {
       	   // even for unfiltered: strip out javascript
       	   $res = preg_replace('#<\s*script(.*?)>(.*?)<\s*/\s*script\s*>#is', '', wp_unslash($value));
       	   # also strip out inline javascript (onalert etc)
       	   $res = preg_replace('#\bon\w+\s*=\s*\S+(?=.*>)#', '', $res);
       	   return $res;
       ```
   
 * This piece of code in _eme_kses_single cuts out the chunks form from URL-s which
   include on<something>=<something>, besides inline JS.
    For exmaple:
 *     ```
       <a href="http://evasys.semmelweis.hu/evasys/public/online/index/index?online_php=&p=22PES&ONLINEID=47457567567567">Regisztrációs felület</a>
       ```
   
 * becomes:
 *     ```
       <a href="http://evasys.semmelweis.hu/evasys/public/online/index/index? felület</a>
       ```
   
    -  This topic was modified 4 years, 1 month ago by [tyaty1](https://wordpress.org/support/users/tyaty1/).

Viewing 1 replies (of 1 total)

 *  Plugin Author [Franky](https://wordpress.org/support/users/liedekef/)
 * (@liedekef)
 * [4 years, 1 month ago](https://wordpress.org/support/topic/unfiltered-html-processing-issue/#post-15559765)
 * The reason is the “?on” part in the url. The regex (while never optimal for javascript
   removal, but I can’t rely on the php domdocument function either, because the
   html passed might be incomplete) has been changed here:
 * [https://plugins.trac.wordpress.org/changeset/2709912/](https://plugins.trac.wordpress.org/changeset/2709912/)
 * It now takes “?on” and “&on” into account too.

Viewing 1 replies (of 1 total)

The topic ‘Unfiltered HTML processing issue’ is closed to new replies.

 * ![](https://ps.w.org/events-made-easy/assets/icon-256x256.png?rev=1856035)
 * [Events Made Easy](https://wordpress.org/plugins/events-made-easy/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/events-made-easy/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/events-made-easy/)
 * [Active Topics](https://wordpress.org/support/plugin/events-made-easy/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/events-made-easy/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/events-made-easy/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Franky](https://wordpress.org/support/users/liedekef/)
 * Last activity: [4 years, 1 month ago](https://wordpress.org/support/topic/unfiltered-html-processing-issue/#post-15559765)
 * Status: resolved