Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter felhobacsi

    (@felhobacsi)

    Thread Starter felhobacsi

    (@felhobacsi)

    🙂 (köszi a választ, folytatom azért a kis béna angolommal :))

    I think this is a design flaw in WordPress, and this problem could not be solved correctly. The post don’t has a state, if its content was escaped or not, and you can not figure this out from the “rich_editing” state of the user, who created the post. The user’s state can change after creating the post, and even if it don’t, if the user create the post in code view, the content will be not escaped.

    Best Regards,
    Felhő

    Thread Starter felhobacsi

    (@felhobacsi)

    Hi!

    Now I checked Geshi’s source, and it seems, that Geshi always use its hsc() function, which acts as htmlspecialchars.

    So the solution to the problem would be to change this line:
    $geshi = new GeSHi($code, $language);
    To this:
    $geshi = new GeSHi(htmlspecialchars_decode($code), $language);

    I’m new to WP, but if I’am right if visual editor is off, WP won’t convert special charcters in the post, so maybe the above fix is not exactly correct.

    htmlspecialchars_decode is available from PHP 5.1, so we need the following code:
    if (!function_exists(“htmlspecialchars_decode”)) {
    function htmlspecialchars_decode($string, $quote_style = ENT_COMPAT) {
    return strtr($string, array_flip(get_html_translation_table(HTML_SPECIALCHARS, $quote_style)));
    }
    }

    Best Regards,
    Felhő

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