Skip to content

Commit be2acf9

Browse files
committed
Merge pull request #14 from emhr/feature-no-texturize-shortcode
Add plugin's shortcodes to the list of shortcodes that `wptexturize()` should ignore
2 parents 4184881 + 0847f79 commit be2acf9

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

syntaxhighlighter.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ function __construct() {
4747
add_filter( 'comment_text', array( $this, 'parse_shortcodes_comment' ), 7 ); // Comments
4848
add_filter( 'bp_get_the_topic_post_content', array( $this, 'parse_shortcodes' ), 7 ); // BuddyPress
4949

50+
// Exempt shortcodes from wptexturize()
51+
add_filter( 'no_texturize_shortcodes', array( $this, 'no_texturize_shortcodes' ) );
52+
5053
// Into the database
5154
add_filter( 'content_save_pre', array( $this, 'encode_shortcode_contents_slashed_noquickedit' ), 1 ); // Posts
5255
add_filter( 'pre_comment_content', array( $this, 'encode_shortcode_contents_slashed' ), 1 ); // Comments
@@ -315,6 +318,12 @@ function output_shortcodes_for_tinymce() {
315318
echo "</script>\n";
316319
}
317320

321+
// A filter function that exempts shortcodes from wptexturize()
322+
function no_texturize_shortcodes( $exempted_shortcodes = array() ) {
323+
foreach ( $this->shortcodes as $shortcode )
324+
$exempted_shortcodes[] = $shortcode;
325+
return $exempted_shortcodes;
326+
}
318327

319328
// A filter function that runs do_shortcode() but only with this plugin's shortcodes
320329
function shortcode_hack( $content, $callback ) {

0 commit comments

Comments
 (0)