Changeset 8782
- Timestamp:
- 05/13/2019 03:26:41 PM (5 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
r8765 r8782 19 19 add_filter( 'wporg_markdown_after_transform', array( $this, 'wporg_markdown_after_transform' ), 10, 2 ); 20 20 21 add_filter( 'the_content', array( $this, 'fix_code_entity_encoding' ), 6 ); 22 21 23 add_action( 'pre_post_update', function( $post_id, $data ) { 22 24 if ( $this->get_post_type() === $data['post_type'] ) { … … 59 61 60 62 return $display; 63 } 64 65 /** 66 * Fixes unwarranted HTML entity encoding within code shortcodes. 67 * 68 * @param string $content Post content. 69 * @return string 70 */ 71 public function fix_code_entity_encoding( $content ) { 72 if ( $this->get_post_type() !== get_post_type() ) { 73 return $content; 74 } 75 76 if ( false !== mb_strpos( $content, '[code' ) ) { 77 $content = preg_replace_callback( 78 '|(\[code[^\]]*\])(.+)(\[\/code\])|Us', 79 function( $matches ) { 80 return $matches[1] . html_entity_decode( $matches[2], ENT_QUOTES | ENT_HTML401 ) . $matches[3]; 81 }, 82 $content 83 ); 84 } 85 86 return $content; 61 87 } 62 88
Note: See TracChangeset
for help on using the changeset viewer.