Support » Plugin: Enlighter - Customizable Syntax Highlighter » Problem add smile and url

  • Resolved barmen

    (@barmen)


    Hello, I add post

    <pre class="EnlighterJSRAW" data-enlighter-title="birthday.php"><?php
    echo "https://home.url/";
    echo ":)";
    ?></pre>

    but I see in my post

    echo "<blockquote class="wp-embedded-content" data-secret="cAcmhoOWs6"><a href="https://home.url/">Home</a></blockquote><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted" style="position: absolute; clip: rect(1px, 1px, 1px, 1px);" src="https://home.url/embed#?secret=cAcmhoOWs6" data-secret="cAcmhoOWs6" width="600" height="338" title="«Home" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>";
    echo "<img draggable="false" class="emoji" alt="🙂" src="https://s.w.org/images/core/emoji/2.4/svg/1f642.svg">";
Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author Andi Dittrich

    (@andi-dittrich)

    Hi barmen,

    i will check this asap

    thanks 🙂
    4.9.6 wp
    PHP Version: 7.1.8
    Server Software: Darwin
    Enlighter Plugin Version: 3.6
    EnlighterJS Version: 2.12.0
    Cache writeable: true
    JSON Extension: installed
    Shortcode Processor: Enlighter low-level

    Plugin Author Andi Dittrich

    (@andi-dittrich)

    hmm you didn’t escaped the php tags (opening+closing brackets), right ?

    this works as expected:

    
    <pre class="EnlighterJSRAW" data-enlighter-language="php"><?php
    echo "https://home.url/";
    echo ":)";
    ?></pre>
    
    Plugin Author Andi Dittrich

    (@andi-dittrich)

    well…the forums software applied some changes…

    see https://gist.github.com/AndiDittrich/e77d8f843ed6ca16c4911b95925522ee

    Sorry, this work, I test too 🙁
    the problem with my code

    <pre class="EnlighterJSRAW" data-enlighter-language="php"><?php
    /*
    =====================================================
     Web barmen
    -----------------------------------------------------
     http://webarmen.com/
    -----------------------------------------------------
     © 2016 Copyright by barmen
    =====================================================
     Данный код защищен авторскими правами
    =====================================================
     Файл: birthday.php
    -----------------------------------------------------
     Версия: 1.0
    -----------------------------------------------------
     Назначение: Вывод дня рождения пользователя
    =====================================================
    */
    if( ! defined( 'DATALIFEENGINE' ) ) {
        die( "Hacking attempt!" );
    }
    preg_match( "/([0-9]{1,2})\.([0-9]{1,2}).([0-9]{1,4})/", $birthday, $match ); // находим наши цифры
    $timeYear = langdate( "Y", time (), true ); // определим нынешний год
    $dateD = $match[1]; // день
    $dateM = $match[2]; // месяц
    $dateY = $match[3]; // год
    if( $dateD <= 31 AND $dateM <= 12 AND $dateY < $timeYear AND $dateY >= $timeYear-140 ) { // проверяем адекватность заполнения дня рождения
        function getAge($y, $m, $d) {
            if($m > date('m') || $m == date('m') && $d > date('d'))
                return (date('Y') - $y - 1); // если ДР в этом году не было, то ещё -1
            else
                return (date('Y') - $y); // если ДР в этом году был, то отнимаем от этого года год рождения
        }
        $getAge = getAge($dateY, $dateM, $dateD); //получаем количество лет
        function number($n, $titles) {
            $cases = array(2, 0, 1, 1, 1, 2);
            return $titles[($n % 100 > 4 && $n % 100 < 20) ? 2 : $cases[min($n % 10, 5)]];// правильно склоняем сколько нам лет или годиков :)
        }
        $getNumber = number($getAge, array('год', 'года', 'лет')); // правильно склоняем
        
        echo $dateD.".".$dateM.".".$dateY." (".$getAge." ".$getNumber.")";
    } else { // если заполнили не верно, то удаляем
        echo "Ошибка! День рождения должно быть формата XX.XX.XXXX/ДЕНЬ.МЕСЯЦ.ГОД";
        $row = $db->super_query( "SELECT xfields FROM ".PREFIX."_users WHERE email = '{$memberid}'" );
        $row['xfields'] = preg_replace("#birthday\|(.+?)\|\|#is",'',$row['xfields']);
        $row['xfields'] = preg_replace("#\|\|birthday([^\]]+)#is",'',$row['xfields']);
        $row['xfields'] = preg_replace("#birthday([^\]]+)#is",'',$row['xfields']);
        $db->query( "UPDATE ".PREFIX."_users SET xfields='".$row['xfields']."' WHERE user_id = email = '".$memberid."'" );
    }
    ?></pre>

    https://ibb.co/hYOz8J – problem url
    https://ibb.co/bFjT2d

    https://ibb.co/npCboJ – problem smile
    https://ibb.co/mQGQhd

    https://ibb.co/cShboJ – color ?>

    • This reply was modified 1 year, 1 month ago by  barmen.
    • This reply was modified 1 year, 1 month ago by  barmen.
    Plugin Author Andi Dittrich

    (@andi-dittrich)

    both examples are working within my testing environment 🙁
    did you try to disable other plugins ? maybe its some kind of incompatibility….normally the WordPress embeds didn’t touch content within a <pre> tag

    Plugin Author Andi Dittrich

    (@andi-dittrich)

    referring your updated post:

    1. url problem: this is not caused by Enlighter or WordPress core…its another plugin/theme which automatically converts URLs to embeds

    2. the emoji issue… that’s a WordPress “feature” introduced in 4.4?… it replaces emoji sequences by some kind of javascript code which also affects the highlighted code. you can use a plugin which disables emojis on your page (e.g. https://wordpress.org/plugins/tweakr/)

    i will try to find a workaround…maybe by appending the character (unicode variation selector) to force text

    3. the color is just a theme token..change it with the Enlighter Custom theme editor 🙂

    I install clean WordPress
    error with the site page due to the plugin 🙁

    but the error with the smile remains, I add 🙂 and post have emidgi and url svg

    https://ibb.co/jtqCTJ
    https://ibb.co/fcR82d

    Plugin Author Andi Dittrich

    (@andi-dittrich)

    i’ve found the smiley issue (i’m confused about smileys and emojis in wordpress…sry) – see https://codex.wordpress.org/Using_Smilies

    just go to your wordpress site and open wp-admin/options.php

    search for the entry use_smilies and set it to 0

    Plugin Author Andi Dittrich

    (@andi-dittrich)

    i’ve taken a deep dive into wordpress sourcecode…the smiley convert function https://core.trac.wordpress.org/browser/tags/4.9.6/src/wp-includes/formatting.php#L2836 is buggy… it should exclude pre/code tags but it won’t work because of a weak regex.

    i will open a bug report soon…

    Plugin Author Andi Dittrich

    (@andi-dittrich)

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Problem add smile and url’ is closed to new replies.