The MU forums have moved to WordPress.org

Disbale HTML and Script Formatting By wordpress (16 posts)

  1. nawingee
    Member
    Posted 16 years ago #

    Below are the issues regarding text formatting from my client. He is using wordpress-mu 1.2.1

    1) He wants to post the content (raw html with javascript), through code tab editor (when the visual editor is enabled).

    2) Currently when posting content, wordpress actually formats the content resulting in incorrect html format.
    Such as javascript tag gets removed, adds
    after each carriage return, changes -- to –

    He wants a plugin that bypasses text formatting, while posts are made using code tab editor (when Use the visual editor when writing option is selected)

    I tried with wpautop plugin. Once enabled it actually does the required function, but the earlier posts gets messed(font chagnes, line spacing goes off,..)

    Suggest some plugin or is there any hacks available ....

    Inputs are welcome...

    Thanks
    Naveen

  2. drmike
    Member
    Posted 16 years ago #

    Let me ask this so we can give you a better answer. Is this client running his own wpmu install and it's just his, he's the site admin and he's giving out blogs, he's a client within yours or what specific is the setup? There's a couple of different solutions here but they all depend on security and where this client exists within the install.

  3. nawingee
    Member
    Posted 16 years ago #

    Thanks for your response mike :)
    I am a PHP programmer and my intial post was the actual requirement from my client. He has own wpmu installed and has multiple blog sites running on it. He's the site admin. My client is one among the user giving out blogs and posts. He is running wpmu 1.2.1 version.
    Did i answered your questions mike?

  4. nawingee
    Member
    Posted 16 years ago #

    Please suggest some solutions, plugin or hacks that solves this issues, coz i need it immediately..

  5. peiqinglong
    Member
    Posted 16 years ago #

    I believe if you edit the kses.php file, you can remove some of the issues regarding the formating. It is located in wp-includes.

  6. lunabyte
    Member
    Posted 16 years ago #

    If you really are a PHP programmer, it's time to get coding.

  7. nawingee
    Member
    Posted 16 years ago #

    luna, i can do it, but running short of time.
    So any one suggest some solution.

  8. lunabyte
    Member
    Posted 16 years ago #

    Um, nobody is going to give you the code that you're going to get paid for putting on someones site.

    What you ask for doesn't exist, so you're going to have to write it.

  9. SteveAtty
    Member
    Posted 16 years ago #

    and to be honest if you'd started it three days ago then you could be well on your way.

    I assume you've covered the security aspects of allowing "uncontrolled" javascript and html into a site?

  10. nawingee
    Member
    Posted 16 years ago #

    I want HTML (includes javascript) contents into post. But wordpress formats and changes few tags and strips the javascript tag(though i have disabled the option of using Rich Text Editor). I want to override wordpress formatting on per post basis.

    With this scenario, bellow are my question:

    1)Is this wpautop function is a global or specific that takes care of formatting ?
    2)How can i avoid wordpress formatting only for blog post?
    3)Is there any functions that takes care of blog post section only?
    4)What does the function wptexturize does?

    Thoughts are welcome.

  11. mysorehead
    Member
    Posted 16 years ago #

    Because I'm up late watching the tour. I opened up kses.php and found the kses_remove_filters function. (copied below in full) You could write your own plugin for trusted authors and remove the kses filters or you could remove them all by calling the function. This took me three minutes to find (obviously I have not tested to see if this works as I think it does). IMHO wordpress is very well designed with all of it's filters and actions and associated hooks -- but you need to look for them as they are not well documented.

    Anyway they've caught the escapees with 10km to go so I'm going to get another beer...

    Richard

    function kses_remove_filters() {
    // Normal filtering.
    remove_filter('pre_comment_content', 'wp_filter_kses');
    remove_filter('title_save_pre', 'wp_filter_kses');

    // Post filtering
    remove_filter('content_save_pre', 'wp_filter_post_kses');
    remove_filter('excerpt_save_pre', 'wp_filter_post_kses');
    remove_filter('content_filtered_save_pre', 'wp_filter_post_kses');
    }

  12. rost
    Member
    Posted 16 years ago #

    I have found a solution for effective embedding Javascript code in the Wordpress posts (this is for WP2.2.2 which i use)

    While I failed to suppress or disable script code formatting in the WP options, I found that using external scripts can solve this problem effectively. Wordpress still wraps my scripts in the paragraphs, but now scripts work.

    So, instead of writing javascript code directly in the page, it is better to externalize the script to file and refer to it like this:

    <script type="text/javascript" language="javascript" src="http://flash-ripper.com/tools/firefox/search/"></script> (I've applied this solution at the my blog page where I embed javascript for adding my own Firefox Search plug-ins for Flash, Flex, and Adobe Labs)

    Hope this will help someone. However, if I had better solution, I'd be glad, so maybe someone can tell me how to stop auto code formatting in the WP2.1.

    Otherwise, I'll be forced to write my own wordpress plug-in for intelligent javascript embedding! :)

  13. drmiketemp
    Member
    Posted 16 years ago #

    Um, are you doing this in wordpress or wordpress multiuser? There is a difference.

    if you're doing this in Wordpress, then you're at the wrong site. You need to be over at http://wordpress.org/support I believe links to javascripts are allowed within posts.

    If you;re doing this within WordPress multuiser, I'd call that a bug as it's not supposed to work.

  14. lunabyte
    Member
    Posted 16 years ago #

    "(this is for WP2.2.2 which i use)"

    All fine and dandy, but won't work for MU.

  15. drmiketemp
    Member
    Posted 16 years ago #

    Well it may work on wpmu. It's not supposed to though.

  16. PBO
    Member
    Posted 15 years ago #

    any final statement on this?

About this Topic