diff --git a/syntaxhighlighter.php b/syntaxhighlighter.php index c11ebfc..0294001 100644 --- a/syntaxhighlighter.php +++ b/syntaxhighlighter.php @@ -534,13 +534,9 @@ public function render_block( $attributes, $content ) { $code = preg_replace( '#
]+>([^<]+)?
#', '$1', $content ); - // Escape shortcodes - $code = preg_replace('/' . get_shortcode_regex() . '/', '[$0]', $code ); - // Undo escaping done by WordPress - $code = str_replace( '<', '<', $code ); - $code = str_replace( '&', '&', $code ); - $code = preg_replace( '/^(\s*https?:)//([^\s<>"]+\s*)$/m', '$1//$2', $code ); + $code = htmlspecialchars_decode( $code ); + $code = preg_replace( '/^(\s*https?:)�?47;�?47;([^\s<>"]+\s*)$/m', '$1//$2', $code ); $code = $this->shortcode_callback( $attributes, $code, 'code' ); @@ -1332,6 +1328,9 @@ function shortcode_callback( $atts, $code = '', $tag = false ) { $code = ( false === strpos( $code, '<' ) && false === strpos( $code, '>' ) && 2 == $this->get_code_format($post) ) ? strip_tags( $code ) : htmlspecialchars( $code ); + // Escape shortcodes + $code = preg_replace( '/\[/', '[', $code ); + $params[] = 'notranslate'; // For Google, see http://otto42.com/9k $params = apply_filters( 'syntaxhighlighter_cssclasses', $params ); // Use this to add additional CSS classes / SH parameters