Support » Plugin: Code Snippets » character gets cut

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Shea Bunge

    (@bungeshea)

    This is a known bug. It comes from the functionality that automatically removes the <?php from the beginning of a snippet – it removes all characters individually, instead of the string as a whole.

    I’ll try and fix this in a future version, perhaps by using a regex instead of using the ltrim and rtrim functions.

    I’m not sure why you’re creating a public function outside of a class anyway…? Try starting the snippet with a different character for the time being (or using /**/ at the beginning of the snippet).

    Thread Starter solhuebner

    (@solhuebner)

    I just copied some snippet from a forum and saved it before editing 🙂 And then… where is the p? 😉

    I do only use “normal” functions but wanted to tell it 🙂

    Plugin Author Shea Bunge

    (@bungeshea)

    I agree that this bug needs to be fixed, but I’m not very good with regex and still trying to find a working solution. It doesn’t come up much (if at all) because most snippets start with either function, add_action, add_filter, or add_shortcode.

    Plugin Author Shea Bunge

    (@bungeshea)

    Okay, this has been fixed in the development version, and the fix will be included in the next stable release.

    I have replaced the *trim() functions with some regex I wrote, which works much more reliably. Not only does it not strip extra characters (such as ‘p’ and ‘h’), it also doesn’t remove extra whitespace around the snippet.

    Thread Starter solhuebner

    (@solhuebner)

    Thank you very much! I will try asap but it can take till monday 🙂

    Thread Starter solhuebner

    (@solhuebner)

    No problems so far for me 🙂

    Thank you!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘character gets cut’ is closed to new replies.