Tagged: 

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #1074673

    I’m going around in circles try to workout how to show a code snippet that has html entities. The values keep escaping after post update.

    The default WordPress method works with < code > < / code >

    However it is a known bug with Enfold that special characters will break the ALB editor
    h t t p s : / / kriesi.at/support/topic/just-for-info-html-character-entities-get-changed-on-saving/
    h t t p s : / / kriesi.at/support/topic/codeblock-unescaping-escaped-html/

    So I have installed this plugin as suggested in the documentation:
    h t t p s : / / kriesi.at/documentation/enfold/intro-to-layout-builder/#using-special-characters

    I want to show in my blog how an email address appears after using wordpress antispambot() function.

    just like this page…

    https://codex.wordpress.org/Function_Reference/antispambot
    This will output the email like this in the HTML:

    Whether I use a Text Block
    < pre > < / pre>
    or
    < code > < / code >
    OR
    Code block – Display code block as a code snippet

    Every time I update the post the html entities are decoded.

    So at the moment I am using 2 tools
    1. http://ctrlq.org/encode/
    to encode the email address = (Email address hidden if logged out)
    copy the output

    2. https://mothereff.in/html-entities
    to encode the encoded email
    Paste the encode email in the top green box
    tick both option below the bottom box
    The & is converted to & amp ;

    according to the documentation I should replace
    & = ###amp###

    so I end up with this

    ###amp####106;###amp####111;###amp####104;###amp####110;###amp####46;###amp####100;###amp####111;###amp####101;###amp####64;###amp####109;###amp####121;###amp####115;###amp####105;###amp####116;###amp####101;###amp####46;###amp####99;###amp####111;###amp####109;

    OR this

    ###amp###amp;#106;###amp###amp;#111;###amp###amp;#104;###amp###amp;#110;###amp###amp;#46;###amp###amp;#100;###amp###amp;#111;###amp###amp;#101;###amp###amp;#64;###amp###amp;#109;###amp###amp;#121;###amp###amp;#115;###amp###amp;#105;###amp###amp;#116;###amp###amp;#101;###amp###amp;#46;###amp###amp;#99;###amp###amp;#111;###amp###amp;#109;

    Neither Work.

    Please explain the current workflow method to display unescaped html entities as code snippets.

    It would also be nice if you forked this GIT ( https://github.com/mathiasbynens/mothereff.in/tree/master/html-entities ) and created a similar tool to encode
    html entities for Enfold ALB editor -or – ultimately built it into the CODE BLOCK output as another option. Display code snippet as unescaped html entities

    #1074726

    Did you first switch to the Text tab ( on right side of content block)
    Some people dont know of this

    Also maybe write your text then add a Code Block then more txt

    #1074732

    EDIT : ah sorry i did not see your last link goes to Günters Plugin. But on my end this works as it shoud.
    ______
    I believe that wealthyone is in principle already right there with his guess. If you write these tags yourself, then you have to enter them in the text mode there.

    There are some special characters you cannot use in Textblock and input fields because they break the internal structure – this is a known limitation in our builder.

    They are unfortunately always evaluated as tag beginning or tag end. greater than or less than character ( etc.) .
    Günter from the developer team had written a small plugin for this, so that you can use these characters in the text.
    Please search for: avia-special-characters : link

    i just changed the code a bit not to have as many # but only one before one after the input – see here: https://kriesi.at/support/topic/in-content-crash-page/#post-1054980

    #1074744

    by the way this is a very simple email obfuscation. There are better plugins with high encryption methods.
    https://blog.mühlemann.ch/2008/07/20/ten-methods-to-obfuscate-e-mail-addresses-compared/

    #1074745

    Yes Guenni007 is right. Unfortunately we need great encryption methods these days, so a better plugin would benefit you more.

    #1074748

    i use “MailTo Links” that based on Rot13 method.

    you can setup this plugin to encrypt even plain e-mails in text to crypted one.

    #1074786

    Hi yes of course I know about text mode in the editor.

    I am writing a blog article comparing different obfuscation methods.

    I need to show the code so I can explain pros and cons.

    1. In content editor switch to text mode
    2. paste the html encode entities
    3. switch back to visual
    4. Update the post
    5. everything displays as it should
    6. Edit the post and the html entities are converted back to html characters.

    this is the issue

    Not the obfuscation plugin

    #1074807

    Sorry but had to ask about the text editor

    Ok yes this used to happen to me a lot.
    I am sure I had to add the but not 100% sure

    It used to be a problem but have never seen it in WP in recent times

    There are a few solutions but a lot are old
    Search Google for wordpress strips code

    Have you tried using the Code Block Enfold has?

    #1074825

    i copy & pasted the code for my e-mail adress and replaced the ampersand through #amp#
    ( as mentioned above i changed code a little of Günter to only have one # before and after )
    so i got : ( and this text you can even enter in visual mode )
    #amp##105;#amp##110;#amp##102;#amp##111;#amp##64;#amp##103;#amp##117;#amp##101;#amp##110;#amp##116;#amp##101;#amp##114;#amp##119;#amp##101;#amp##98;#amp##101;#amp##114;#amp##46;#amp##99;#amp##111;#amp##109;
    click to enlarge the images:

    i can edit those posts without any loss of the inserted code.

    see here the result: https://webers-testseite.de/pages-2/

    source code of that page (developer tools will show the “encrypted” text) :

    #1074857

    by the way – i’m interested in that blog – can you post that link ?

    #1074868

    second note if you like to show a p-tag the plugin does not work without space between the p and the special characters
    i added a p-tag case so i have now in my plugin:

    $this->translate = array(
    						'#lt#'		=> '<',
    						'#gt#'		=> '>',
    						'#amp#'		=> '&',
    						'#91#'		=> '[',
    						'#93#'		=> ']',
    						'#quot#'	=> '"',
    						'#34#'		=> "'",
    						'#br#'		=> '<br/>',
    						'#p#'		=> "< p >",
    			);

    the 8239 thing is a Narrow No-Break Space
    edit – sorry it is transformed through board soft – here an image:

    see here in action: https://webers-testseite.de/greater-than/

    #1074961

    (Response Private – screen cast video)

    As shown without ALB html entities show fine on the post, even after editing and re publishing.

    However, once you activate ALB – html entities are converted back to readably characters.
    I want to maintain the encoded html characters as a code snippet in the post.

    The only way this works – is to paste the encoded html entities in the visual editor with < pre >
    and update only once – > html entities display fine
    However, If you edit/update the post again – >html entities are converted back to readably characters.

    Not very practical.

    This solution was the only work around in 2015
    h t t p s : / /kriesi.at/support/topic/just-for-info-html-character-entities-get-changed-on-saving/#post-529743
    We are aware of the issue and it is currently under investigation. For the mean time, as a temporary workaround, please add the html entity code once you’re totally done with the page. It is only converted to the actual symbols once you re-update the page. Sorry for the inconvenience.

    I can’t believe 4 years later – this is still the case – there is not a better solution.

    I am hoping you can come back with a working method – where html entities are not decoded back to visual characters in ALB after post re-update.

    #1075341

    Hi Gunter,

    I was considering ditching ABL altogether and writing the blog articles in WP classic editor – as pasted HTML entities ARE NOT decoded.

    I tested several plugins for embedding code snippets.

    1. PastaCode – decoded the html entities and displayed the email address. – so that didn’t work

    2. oEmbed Gist – h t t p s : / /wordpress.org/plugins/oembed-gist/
    On the other hand, oEmbed Gist showed the GIST snippet as encoded html entities – So that’s my work around solution 2

    My final work around Solution 1
    STEP 1 – Install your plugin – h t t p s : / / kriesi.at/documentation/enfold/intro-to-layout-builder/#using-special-characters
    STEP 2 – Edit the Array

    $this->translate = array(
    				                '#amp;#'          => '&#',
    						'#lt#'		=> '<',
    						'#gt#'		=> '>',
    						'#amp#'		=> '&',
    						'#91#'		=> '&lsqb;',
    						'#93#'		=> '&rsqb;',
    						'#quot#'		=> '&quot;',
    						'#34#'		=> "&apos;",
    						'#br#'		=> '<br/>',
    						'#p#'		=> "<<p>>",
    						
    );

    STEP 3 – Encode the html entity using – h t t p : / /ctrlq.org/encode/
    STEP 4 – Copy Paste Text and do a FIND => ‘&#’ and REPLACE =>’#amp;#’
    STEP 5 – Copy Paste the new string into the content editor and wrap in < pre > < / pre > tags
    STEP 6 – Update post and re-updated post does not decode html entities – Great!
    STEP 7 – On the front end the plugin Avia Special Character Converter Plugin translates this unique string #amp;# to &#

    As the translate filter is global( i.e it will effect all content ), I wanted to restrict this translate functions to specific elements – hence the unique string that would not normally appear in general content.

    Another thought would be to extend the plugin at a later time – to check for a class on the dom object before translating.
    That way you could have different array translations based on object class. In ALB just add the appropriate Custom Class to the Text Block.

    This solves the issue for now and I can get back to writing my blog article with inline html entity code snippets.

    #1075652

    Hi HuxburyQuinn,

    Glad you got it working for you and thank you for sharing your solution! :)

    If you need further assistance please let us know.

    Best regards,
    Victoria

Viewing 14 posts - 1 through 14 (of 14 total)
  • You must be logged in to reply to this topic.