Making WordPress.org


Ignore:
Timestamp:
09/05/2022 05:14:31 AM (2 years ago)
Author:
dufresnesteven
Message:

wporg-developer: Sync with https://github.com/WordPress/wporg-developer/commit/790d402933d2725374de0d19e6bf6a576c8b15d2

File:
1 edited

Legend:

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

    r11422 r12050  
    2121        add_filter( 'wporg_markdown_after_transform',  array( $this, 'wporg_markdown_after_transform' ), 10, 2 );
    2222        add_filter( 'wporg_markdown_edit_link',        array( $this, 'wporg_markdown_edit_link' ), 10, 2 );
    23 
    24         add_filter( 'syntaxhighlighter_htmlresult',    array( $this, 'fix_code_entity_encoding' ) );
    2523
    2624        add_action( 'pre_post_update', function( $post_id, $data ) {
     
    144142
    145143    /**
    146      * Fixes unwarranted HTML entity encoding within code shortcodes.
    147      *
    148      * @param string $content Post content.
    149      * @return string
    150      */
    151     public function fix_code_entity_encoding( $content ) {
    152         if ( $this->get_post_type() !== get_post_type() ) {
    153             return $content;
    154         }
    155 
    156         if ( false !== mb_strpos( $content, '&' ) ) {
    157             $content = preg_replace_callback(
    158                 '|(<pre class="brush[^>]+)(.+)(</pre)|Us',
    159                 function( $matches ) {
    160                     return $matches[1] . html_entity_decode( $matches[2], ENT_QUOTES | ENT_HTML401 ) . $matches[3];
    161                 },
    162                 $content
    163             );
    164         }
    165 
    166         return $content;
    167     }
    168 
    169     /**
    170144     * Fixes fetched value of markdown_source meta field to not be the
    171145     * raw.githubcontent.com domain that is currently incorrectly used
     
    343317     */
    344318    public function wporg_markdown_edit_link( $link, $post_id ) {
    345         if ( $this->get_post_type() === get_post_type( $post_id ) ) {
     319        if ( $this->get_post_type() === get_post_type( $post_id ) && defined( 'WP_CORE_STABLE_BRANCH' ) ) {
    346320            $link = str_replace( '/wp/' . WP_CORE_STABLE_BRANCH . '/', '/trunk/', $link );
    347321        }
Note: See TracChangeset for help on using the changeset viewer.