开发者

How does Textile detect and remove <script> tags?

开发者 https://www.devze.com 2023-03-07 03:29 出处:网络
I\'m using Textile for content editing on a site.Only trusted users have access to editing. I want to insert insert gists from GitHub: <script src=\"http://gist.github.com/#####.js\"></scrip

I'm using Textile for content editing on a site. Only trusted users have access to editing.

I want to insert insert gists from GitHub: <script src="http://gist.github.com/#####.js"></script> but Textile removes these with: "[removed][removed]".

I've searched through the Textile PHP class for how and 开发者_StackOverflow社区where it detects this and removes it, but it escapes me. I found the Textile tag filtering for Ruby, is there anything similar for the PHP class?


You can do it using regexp, with the function preg_replace():

/<[^<]+?>/i

If you dont need the replace, just use strip_tags() function.


Ok, I feel like an idiot. It was CodeIgniter filtering the $POST data that removed it.

For reference: Textile does not automatically remove <script> or other tags.

0

精彩评论

暂无评论...
验证码 换一张
取 消