Changeset 10190
- Timestamp:
- 08/19/2020 10:24:15 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-coding-standards.php
r8686 r10190 13 13 14 14 add_filter( 'handbook_label', array( $this, 'change_handbook_label' ), 10, 2 ); 15 add_filter( 'the_content', array( $this, 'fix_double_encoding' ) ); 15 16 } 16 17 … … 31 32 return $label; 32 33 } 34 35 /** 36 * Fixes (as a stopgap) encoding of already encoded characters in code shortcodes. 37 * 38 * Affected characters: 39 * - '&` (sometimes) 40 * - `<` 41 * - `*` (when encoded in the first place) 42 * - `?` (when encoded in the first place) 43 * - `"` (in some places when used as opening quote) 44 * 45 * This could probably be abrogated by the source using triple backticks to 46 * denote code. 47 * 48 * @see https://meta.trac.wordpress.org/ticket/5346 49 * 50 * @param string $content Post content. 51 * @return string 52 */ 53 public function fix_double_encoding( $content ) { 54 if ( $this->get_post_type() === get_post_type() ) { 55 $content = str_replace( 56 [ '&amp;', '&042;', '&#042;', '&lt;', '&quest;', '&quot;' ], 57 [ '&', '*', '*', '<', '?', '"' ], 58 $content 59 ); 60 } 61 return $content; 62 } 33 63 } 34 64
Note: See TracChangeset
for help on using the changeset viewer.