• Resolved DAE

    (@motionrotation)


    A client of mine accidentally inserted the following into the ‘single opt-in message box’ with the outcome that everything after ‘; var doubleOptinMessage was output as plain text including \\n from shortcode_form.php:40:187

    This is allowed by HTML5 so should really be handled.

    More of a bug report than a request for help, already handling other ways of including follow buttons, etc.

    <a class="twitter-follow-button" href="https://twitter.com/BlankPageSTL" data-show-count="false" data-size="large">Follow [removed]</a>
    <script>// <![CDATA[
    !function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?\'http\':\'https\';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+\'://platform.twitter.com/widgets.js\';fjs.parentNode.insertBefore(js,fjs);}}(document, \'script\', \'twitter-wjs\');
    // ]]></script>
    <div class="fb-follow" data-href="https://www.facebook.com/[removed]" data-width="150" data-colorscheme="light" data-layout="standard" data-show-faces="true"></div>

    https://wordpress.org/plugins/yikes-inc-easy-mailchimp-extender/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter DAE

    (@motionrotation)

    Or was it the DIVs? Wouldn’t be a bug then but still worth handling as WP won’t reject it as content.

    Scuse me, brain fried.

    Thread Starter DAE

    (@motionrotation)

    Further update, there’s still some mangling for intents and purposes. JSMin really doesn’t like it when you remove \r, seems to only properly recognise UNIX newline formatting.

    I’ve seen the exception disappear in my logs with by changing

    var singleOptinMessage = '<?php echo str_replace( '\'' , '"' , preg_replace('/\r?\n/', '\\n', apply_filters('yks_mc_content' , $this->optionVal['single-optin-message']))); ?>';
    var doubleOptinMessage = '<?php echo str_replace( '\'' , '"' , preg_replace('/\r?\n/', '\\n', apply_filters('yks_mc_content' , $this->optionVal['double-optin-message']))); ?>';

    to

    var singleOptinMessage = '<?php echo str_replace( array('\'',"\r","\n") , array('"',"\\r","\\n"), apply_filters('yks_mc_content' , $this->optionVal['single-optin-message'])); ?>';
    var doubleOptinMessage = '<?php echo str_replace( array('\'',"\r","\n") , array('"',"\\r","\\n"), apply_filters('yks_mc_content' , $this->optionVal['double-optin-message'])); ?>';

    Not certain if this breaks anything yet but we’ll see.

    Plugin Author Evan Herman

    (@eherman24)

    Hi MotionRotation,

    Thanks for the bug report. I’ll have a look at what might be causing issues. We’re just gearing up for a 5.2 release, so I will look into implementing this fix into the next release.

    The opt in message box is a standard wp_editor, so it may be an issue with how wp_editor handles the script code.

    Are you trying to add follow/share buttons to the confirmation response?

    Thanks,
    Evan

    Thread Starter DAE

    (@motionrotation)

    Hi,

    Thanks for getting back.

    It’s something a client did when trying to add buttons, removed now (as it redirects to another page anyway, no point). The problem seems to be ocurring in some fashion anyway with a single line of text in <p> tags. I haven’t looked in depth at what your parsing code does so I can only say for this use case that I hadn’t pinned it down immediately as it appeared fixed until I went to change something in the theme. Still need to solve the problem that had me looking in the logs actually.

    This isn’t something that’s going to happen all the time but it does cause JSMin (in this case called by Autoptimizer but also default for W3 Total Cache) to throw an exception. It seems to be very particular about what it accepts as a newline.

    Plugin Author Evan Herman

    (@eherman24)

    Hi MotionRotation,

    We just rolled out v5.2, which includes the fix you have mentioned above. Please let us know if you run into issues with the new version.

    Thanks,
    Evan

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Code mangling on script use in messages/error handling.’ is closed to new replies.