ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Text Formatting "None" still decodes pmcode?

December 04, 2008 2:02pm

Subscribe [3]
  • #1 / Dec 04, 2008 2:02pm

    Mark Huot

    587 posts

    Hello, I have a text field set to “None” formatting. I enter straight XHTML into that field. Something akin to the following:

    <code>< script type="text/javascript">
    var tests= [1,2,3,4,5,6,7,8,9];
    for(var i=0; (len=tests.length,i<len); i++)
    {
    var test = tests;
    alert〈test〉;
    }
    </ script></code>

    Unfortunately, the [ i] is getting turned into an <i> without ever closing. Is there a way to disable pmcode? Shouldn’t it be disabled when I set the formatting to “None?”

  • #2 / Dec 04, 2008 2:05pm

    Mark Huot

    587 posts

    Quick update, I was able to remedy this by commenting out:

    $str = $this->decode_pmcode($str);

    from core.typography.php around line 422. As far as I can tell there aren’t any preference conditionals run before this that would cause that line to not run?

  • #3 / Dec 04, 2008 3:59pm

    Robin Sowell

    13255 posts

    Mark, it’s intended, as pmcode is meant to be a somewhat simplified html alternative as opposed to XHTML formatting which actually adds formatting automatically.  I can see either side on this one- pmcode should parse normally (i.e. turn into html) vs. ‘None’ means ‘None’- including pmcode.

    Let me confer on this one- see what the consensus is.

  • #4 / Dec 04, 2008 4:45pm

    Mark Huot

    587 posts

    Thanks for the response Robin. I was expecting, at least, a preference in the “Global Weblog Preferences” section to set pmcode to never run. I was surprised that there was no way, short of commenting out the PHP code to turn it off… or am I mistaken?

  • #5 / Dec 04, 2008 4:49pm

    Ingmar

    29245 posts

    No, you’re not: there is no such preference at this point.

  • #6 / Dec 04, 2008 4:55pm

    Robin Sowell

    13255 posts

    Ditto Ingmar- no mistake.  I think it would make a good feature request, though.  I can see why you’d want that behavior.  But I think a setting/preference rather than a change to the default behavior is the way to go on this one.  Then we’ve got the best of both worlds- and no issues with breaking existing sites ([ code ] seemed to get a lot of use regardless of field format settings when we were bouncing it around.)

    Make sense?

  • #7 / Dec 04, 2008 5:02pm

    Mark Huot

    587 posts

    Makes sense, although I’d be curious just how much pmcode actually gets used in production environments. In a very, very informal poll I didn’t find anyone who knew of or used pmcode in their entries…

  • #8 / Dec 04, 2008 5:53pm

    Robin Sowell

    13255 posts

    The one I use a fair bit is [ code ] - which makes sense given the type of stuff I do.  Of course- folks pasting js might be likely to use that one as well 😉.

    I’m going to shift this one to ‘General Discussion’ because it’s definitely intended behavior.  And the poll may get more eyeballs on it there as well.

  • #9 / Dec 04, 2008 5:54pm

    Mark Huot

    587 posts

    Thanks Robin. I’ll post a feature request as soon as I get the chance too…

  • #10 / Dec 04, 2008 6:14pm

    BlackHelix

    226 posts

    PM code seems to me to be a lot like “forum code”, which is quite popular in the forum modules.  I learned the equivalent of PM code long before I learned HTML, and in fact we did some nifty shortcuts in a system where you could define your own codes.  So a preference would be nice—even in the weblog entries field itself.  A global pref would be a bit too harsh, or maybe a two layer system—global pref then an individual pref for each weblog entry, with a default setting. 

    I mean, I’d normally leave it on, unless I was pasting some code or arrays or something.

  • #11 / Dec 04, 2008 6:15pm

    Derek Jones

    7561 posts

    I’d personally like to see pMcode (and all BBCode variants) to go bye-bye, but then again, I would like to get rid of trackbacks, too…

    Truth is, there is still quite a bit of Typography parsing that occurs regardless of the “formatting” preference.  I understand the confusion, since in this context, “None” doesn’t mean “Zilch”.  File upload directories must be replaced, image tags must be sanitized (or removed based on the prefs), EE and PHP tags must be encoded, auto-link and auto-email encoding must take place, emoticons, word censoring, etc.  It’s not an unreasonable request though that pMcode lean toward the side of “no” meaning “no”.  I’d be interested in the number of people that would be impacted by that change in an adverse way, though.

  • #12 / Dec 04, 2008 6:45pm

    Mark Huot

    587 posts

    Thanks for the thoughts Derek. I can update the Poll if that’d make sense to something more like “would changing None to zilch adversely affect you?”. Would that be more helpful?

  • #13 / Dec 04, 2008 6:52pm

    Derek Jones

    7561 posts

    Or perhaps the clarification of “Do you use pMcode in custom fields with a formatting type of “None”?”

  • #14 / Dec 04, 2008 6:57pm

    Mark Huot

    587 posts

    Hum, is there any way to update the poll?

  • #15 / Dec 04, 2008 7:02pm

    Derek Jones

    7561 posts

    Don’t recall offhand the permissions for this particular forum, but you would normally edit your post, then click “edit poll”.  I went ahead and did it for you, and avoided the temptation to add a third option and 1000 votes for “Is Derek a sexy name?”