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

    (@huyz)

    Need to escape newlines too.
    So
    $altcontent_esc = htmlspecialchars(preg_replace('/\n/', '\\n', $altcontent), ENT_QUOTES);

    Thread Starter huyz

    (@huyz)

    Actually, in this case, the single quotes (and backslashes) need to be escaped with \ for Javascript, not HTML.
    So

    $altcontent_esc = preg_replace('/([\'\\\\]|\n)/', '\\\\$1', $altcontent);
                $altcontent_esc = htmlspecialchars($altcontent_esc);

    Thread Starter huyz

    (@huyz)

    I have to note that, in the case of the “newwindow” method, it doesn’t make much sense to reuse altcontent for displaying both (a) as link text for popping up the window and (b) as alternate text if Java is not installed.

    Imagine if I chose altcontent “Pop up the applet”. This will make sense for the link, but then when the popup window comes up and I don’t have Java installed, it will repeat “Pop up the applet,” which doesn’t make sense in this context.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: WordPress Processing Embed] Altcontent escaping bug’ is closed to new replies.