Jump to content

How to insert script content to CMS page


bouskdav

Recommended Posts

Hi everyone,

I just came into situation that we need to create rich html content (with some pretty javascript - e.g. some animation from after effects). The easiest option is to create it through CMS however the script tag is not allowed in content of CMS pages. So as stated here:

and possibly here:

the best recomendation I found is to comment out script matching regex in isCleanHtml function (or just make it return true) - in \classes\Validate.php - and realized that this could be potentially unsafe - because I ('m not a PS developer) dont know at which places the isCleanHtml function is used. So from my point of view there is much more safer solution:

- create another function derived from isCleanHtml (possibly isCleanHtmlWithScripts) - you just remove the lines with script matching regex

-in /classes/CMS.php on line #64 - definition of content - either remove the 'validate' => 'isCleanHtml' or change it to 'validate' => 'isCleanHtmlWithScripts'

Hope it helps someone. Cheers!

Edited by bouskdav (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...