Changeset 12050 for sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/import-block-editor.php
- Timestamp:
- 09/05/2022 05:14:31 AM (2 years ago)
- 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 21 21 add_filter( 'wporg_markdown_after_transform', array( $this, 'wporg_markdown_after_transform' ), 10, 2 ); 22 22 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' ) );25 23 26 24 add_action( 'pre_post_update', function( $post_id, $data ) { … … 144 142 145 143 /** 146 * Fixes unwarranted HTML entity encoding within code shortcodes.147 *148 * @param string $content Post content.149 * @return string150 */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 $content163 );164 }165 166 return $content;167 }168 169 /**170 144 * Fixes fetched value of markdown_source meta field to not be the 171 145 * raw.githubcontent.com domain that is currently incorrectly used … … 343 317 */ 344 318 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' ) ) { 346 320 $link = str_replace( '/wp/' . WP_CORE_STABLE_BRANCH . '/', '/trunk/', $link ); 347 321 }
Note: See TracChangeset
for help on using the changeset viewer.