WordPress.org

Making WordPress.org

Changeset 8843


Ignore:
Timestamp:
05/21/2019 02:20:14 AM (4 months ago)
Author:
coffee2code
Message:

Developer: Fix double-encoding of > character in code shortcodes.

Props truongwp, coffee2code.
Fixes #4457.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/formatting.php

    r8525 r8843  
    4343
    4444        add_filter( 'devhub-function-return-type', array( __CLASS__, 'autolink_references' ) );
     45
     46        add_filter( 'syntaxhighlighter_htmlresult', array( __CLASS__, 'fix_code_entity_encoding' ), 20 );
     47    }
     48
     49    /**
     50     * Fixes bug in (or at least in using) SyntaxHighlighter code shortcodes that
     51     * causes double-encoding of `>` character.
     52     *
     53     * @param string $content The text being handled as code.
     54     * @return string
     55     */
     56    public static function fix_code_entity_encoding( $content ) {
     57        return str_replace( '>', '>', $content );
    4558    }
    4659
Note: See TracChangeset for help on using the changeset viewer.