WordPress.org

Ready to get started?Download WordPress

Forums

Stripslash modification working too well (6 posts)

  1. MikeCherim
    Member
    Posted 8 years ago #

    Hello all,

    I made a modification to my blog so that when apply markup and scripting to a pre box, stripslashes aren't added to the quote marks with the pre. So, what I did is modify line 75 (last line of the "wp-autop" function) in the functions-formatting.php file located in the wp-includes directory. (version 1.5)

    I replaced line 75 with this string:
    $pee = preg_replace('!(<pre.*?>)(.*?)</pre>!ise', " stripslashes('$1') . stripslashes(clean_pre('$2')) . '</pre>' ", $pee);

    Works great, but now it works too well in fact. If I insert stripslashes in the code I'm writing, it removes those as well, and it also coverted some quotes and apostrophes I made in a post this morning to their typographic counterparts.

    I'm confused as to what to do. As it is I could convert back, but I'd have to replace the quotes with &quot;, but as it is I have to add the stripslashes now, and this morning I also had to add in the quotes and apostrophes (to replace the typograhers quotes and apostrophes). So, in essence, something I have done to make less wortk for me is now making more work for me.

    Does anyone know how to get the functions to simply leave pre box content alone. No conversions at all. If stripshales are there leave them and if they're not, don't add them. The only thing I'd like to have to convert are angle brackets and nothing else. I don't want to convert the angle brackets so I can still insert working markup within a pre block so I can add spans, etc, for formatting.

    I hope this makes sense. In advance, thank you.
    Sincerely,
    Mike Cherim

  2. MikeCherim
    Member
    Posted 8 years ago #

    Anyone? Please.

  3. MikeCherim
    Member
    Posted 8 years ago #

    Can somehow help out here? Pretty please, with sugar on top.

  4. Chris_K
    Member
    Posted 8 years ago #

    Well, I'm not sure I follow exactly what you're after, but maybe Code Auto Escape plugin could help?

    Trick is, with 2.x of WP, don't edit a post with the wysiwyg editor if you're going to use CAE.

  5. MikeCherim
    Member
    Posted 8 years ago #

    Thanks for the reply. I'm using wp1.5. I don't do anything with any WYSIWYG tools. It's easier and faster for me to write my own mark-up. I suppose, the way this is going, I'll have to change that line back to the way it was and insert code in pre. But I really didn't want to do that because I'd have to add more to the CSS as code is already defined another way that isn't compatible inside pre, so I have redefine it when it's within pre to remove the styles from the code only selector.

    The plugin you mentioned, after reading into it some, didn't inspire confidence, I afraid.

    I know it's got to be something very simple. I can't put my finger on it. I can write an autop script and incorporate smartypants, but that's not the right way to deal with this situation.

    Does anyone else have another suggestion?

  6. Chris_K
    Member
    Posted 8 years ago #

    Well, I suppose I'm just a pragmatist. I'd just settle for the <pre> tags and the CAE plug-in.

    Oh wait, I did. ;-) It does the job well, for me at any rate. I wish you luck on your quest. You are far more tenacious than I was on a similar issue... (<seinfeld>not that that's a bad thing<seinfeld>)

Topic Closed

This topic has been closed to new replies.

About this Topic