Codeigniter 2.0.2, TinyMCE or CKEditor – style attribute lost after update

If you’re using WYSIWYG TinyMCE or CKEditor and framework CodeIgniter version >2.0, you can have problem with dissapearing style attribute.

You set style like <span style=”color:blue;”></span> and after submitting the form you get <span></span>.

Where the hell is style=”” ?

Probably you have this option enable in config.php file :

After disabling global filtering , WYSIWYG do not lose styles.

Personally, I did not want to disable this feature so I made a workaround ;o) 

Edited based on Bart’s suggestion to not mess with core files ;o)

This security was added for some reason, so to not get rid it completly I created array that store the addresses to which the tag style is not to be removed.

You need to create MY_Security.php file as extension for core Security class and add modified function _remove_evil_attributes.

And that’s it.

download MY_Security.php file

  • Share it on Twitter
  • Share it on Facebook
  • Share it on Pinterest
  • Share it on Google+
  • Share it on LinkedIn

Comments (19)Add comment

Take part in the discussion

Use pastebin.com or jsfiddle.net to add your code snippets
Your email address will not be published.