Changeset 1353216 for syntaxhighlighter
- Timestamp:
- 02/18/2016 08:32:17 AM (10 years ago)
- Location:
- syntaxhighlighter/trunk
- Files:
-
- 1 deleted
- 3 edited
-
. (modified) (1 prop)
-
readme.md (deleted)
-
readme.txt (modified) (1 diff)
-
syntaxhighlighter.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
syntaxhighlighter/trunk
- Property svn:ignore
-
old new 1 1 .git 2 .gitignore 2 3 .idea 3 .gitignore 4 readme.md
-
- Property svn:ignore
-
syntaxhighlighter/trunk/readme.txt
r1351361 r1353216 55 55 56 56 == ChangeLog == 57 58 = Version 3.2.1 = 59 60 * Fix shortcode issues that would occur during post editing if the code contained what looked like opening HTML tags such as `<?php`. See [this forum thread](https://wordpress.org/support/topic/php-opening-closing-tags-break-code-blocks) for details. 57 61 58 62 = Version 3.2.0 = -
syntaxhighlighter/trunk/syntaxhighlighter.php
r1351361 r1353216 5 5 Plugin Name: SyntaxHighlighter Evolved 6 6 Plugin URI: http://www.viper007bond.com/wordpress-plugins/syntaxhighlighter/ 7 Version: 3.2. 07 Version: 3.2.1 8 8 Description: Easily post syntax-highlighted code to your site without having to modify the code at all. Uses Alex Gorbatchev's <a href="http://alexgorbatchev.com/wiki/SyntaxHighlighter">SyntaxHighlighter</a>. <strong>TIP:</strong> Don't use the Visual editor if you don't want your code mangled. TinyMCE will "clean up" your HTML. 9 9 Author: Alex Mills (Viper007Bond) … … 22 22 class SyntaxHighlighter { 23 23 // All of these variables are private. Filters are provided for things that can be modified. 24 var $pluginver = '3.2. 0'; // Plugin version24 var $pluginver = '3.2.1'; // Plugin version 25 25 var $agshver = false; // Alex Gorbatchev's SyntaxHighlighter version (dynamically set below due to v2 vs v3) 26 26 var $shfolder = false; // Controls what subfolder to load SyntaxHighlighter from (v2 or v3) … … 349 349 * Phew! 350 350 * 351 * @param string $content The post content. 352 * @param string $callback The callback function that should be used for add_shortcode() 351 * @param string $content The post content. 352 * @param string $callback The callback function that should be used for add_shortcode() 353 * @param bool $ignore_html When true, shortcodes inside HTML elements will be skipped. 353 354 * 354 355 * @return string The filtered content, with this plugin's shortcodes parsed. 355 356 */ 356 function shortcode_hack( $content, $callback ) {357 function shortcode_hack( $content, $callback, $ignore_html = true ) { 357 358 global $shortcode_tags; 358 359 … … 371 372 } 372 373 373 // Extra escape escaped shortcodes because do_shortcode() is going to strip a pair of square brackets when it runs 374 $content = preg_replace_callback( 375 '/' . get_shortcode_regex( $this->shortcodes ) . '/', 376 array( $this, 'shortcode_hack_extra_escape_escaped_shortcodes' ), 377 $content 378 ); 379 380 // Do the shortcodes (only this plugins's are registered) 381 $content = do_shortcode( $content, true ); 374 $regex = '/' . get_shortcode_regex( $this->shortcodes ) . '/'; 375 376 // Parse the shortcodes (only this plugins's are registered) 377 if ( $ignore_html ) { 378 // Extra escape escaped shortcodes because do_shortcode_tag() called by do_shortcode() is going to strip a pair of square brackets when it runs 379 $content = preg_replace_callback( 380 $regex, 381 array( $this, 'shortcode_hack_extra_escape_escaped_shortcodes' ), 382 $content 383 ); 384 385 // Normal, safe parsing 386 $content = do_shortcode( $content, true ); 387 } else { 388 // Extra escape escaped shortcodes because do_shortcode_tag() called by do_shortcode() is going to strip a pair of square brackets when it runs. 389 // Then call do_shortcode_tag(). This is basically do_shortcode() without calling do_shortcodes_in_html_tags() which breaks things. 390 // For context, see https://wordpress.org/support/topic/php-opening-closing-tags-break-code-blocks 391 $content = preg_replace_callback( 392 $regex, 393 array( $this, 'shortcode_hack_extra_escape_escaped_shortcodes_and_parse' ), 394 $content 395 ); 396 } 382 397 383 398 // Put the original shortcodes back … … 424 439 } 425 440 441 /** 442 * This is a combination of this class's shortcode_hack_extra_escape_escaped_shortcodes() 443 * and do_shortcode_tag() for performance reasons so that we don't have to run some regex twice. 444 * 445 * @param array $match Regular expression match array. 446 * 447 * @return string|false False on failure, otherwise a parse shortcode tag. 448 */ 449 function shortcode_hack_extra_escape_escaped_shortcodes_and_parse( $match ) { 450 $match[0] = $this->shortcode_hack_extra_escape_escaped_shortcodes( $match ); 451 452 return do_shortcode_tag( $match ); 453 } 454 426 455 427 456 // The main filter for the post contents. The regular shortcode filter can't be used as it's post-wpautop(). … … 433 462 // HTML entity encode the contents of shortcodes 434 463 function encode_shortcode_contents( $content ) { 435 return $this->shortcode_hack( $content, array( $this, 'encode_shortcode_contents_callback' ) );464 return $this->shortcode_hack( $content, array( $this, 'encode_shortcode_contents_callback' ), false ); 436 465 } 437 466 … … 466 495 // HTML entity decode the contents of shortcodes 467 496 function decode_shortcode_contents( $content ) { 468 return $this->shortcode_hack( $content, array( $this, 'decode_shortcode_contents_callback' ) );497 return $this->shortcode_hack( $content, array( $this, 'decode_shortcode_contents_callback' ), false ); 469 498 } 470 499
Note: See TracChangeset
for help on using the changeset viewer.