Version Description
Download this release
Release Info
Developer | Viper007Bond |
Plugin | SyntaxHighlighter Evolved |
Version | 3.1.13 |
Comparing to | |
See all releases |
Code changes from version 3.1.11 to 3.1.13
- readme.txt +12 -8
- syntaxhighlighter.js +22 -12
- syntaxhighlighter.php +9 -6
- syntaxhighlighter_mce-4.js +15 -7
readme.txt
CHANGED
@@ -3,14 +3,14 @@ Contributors: Viper007Bond, automattic
|
|
3 |
Donate link: http://www.viper007bond.com/wordpress-plugins/syntaxhighlighter/donate/
|
4 |
Tags: code, sourcecode, php, xhtml, html, css, WordPress.com
|
5 |
Requires at least: 2.7
|
6 |
-
Tested up to: 4.
|
7 |
Stable tag: trunk
|
8 |
|
9 |
Easily post syntax-highlighted code to your site without having to modify the code at all. As seen on WordPress.com.
|
10 |
|
11 |
== Description ==
|
12 |
|
13 |
-
SyntaxHighlighter Evolved allows you to easily post syntax-highlighted code to your site without losing
|
14 |
|
15 |
For a live demo, see [this plugin's homepage](http://www.viper007bond.com/wordpress-plugins/syntaxhighlighter/).
|
16 |
|
@@ -55,6 +55,15 @@ Make sure your theme's `footer.php` file has `<?php wp_footer(); ?>` somewhere i
|
|
55 |
|
56 |
== ChangeLog ==
|
57 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
= Version 3.1.11 =
|
59 |
|
60 |
* SyntaxHighlighter 3.x: Fix table layout issue. Props jeherve.
|
@@ -242,9 +251,4 @@ Localizations:
|
|
242 |
|
243 |
= Version 1.0.0 =
|
244 |
|
245 |
-
* Initial release!
|
246 |
-
|
247 |
-
== Upgrade Notice ==
|
248 |
-
|
249 |
-
= 3.1.10 =
|
250 |
-
Important security update.
|
3 |
Donate link: http://www.viper007bond.com/wordpress-plugins/syntaxhighlighter/donate/
|
4 |
Tags: code, sourcecode, php, xhtml, html, css, WordPress.com
|
5 |
Requires at least: 2.7
|
6 |
+
Tested up to: 4.3
|
7 |
Stable tag: trunk
|
8 |
|
9 |
Easily post syntax-highlighted code to your site without having to modify the code at all. As seen on WordPress.com.
|
10 |
|
11 |
== Description ==
|
12 |
|
13 |
+
SyntaxHighlighter Evolved allows you to easily post syntax-highlighted code to your site without losing its formatting or making any manual changes. It uses the [SyntaxHighlighter JavaScript package by Alex Gorbatchev](http://alexgorbatchev.com/wiki/SyntaxHighlighter).
|
14 |
|
15 |
For a live demo, see [this plugin's homepage](http://www.viper007bond.com/wordpress-plugins/syntaxhighlighter/).
|
16 |
|
55 |
|
56 |
== ChangeLog ==
|
57 |
|
58 |
+
= Version 3.1.13 =
|
59 |
+
|
60 |
+
* Fix setting sanitization bug. Props Alexander Concha (@xknown).
|
61 |
+
* Don't encode shortcode contents on (un)trash. Props Andrew Ozz (@azaozz).
|
62 |
+
|
63 |
+
= Version 3.1.12 =
|
64 |
+
|
65 |
+
* Updated editor JavaScript for WordPress 4.3. Props Andrew Ozz (@azaozz).
|
66 |
+
|
67 |
= Version 3.1.11 =
|
68 |
|
69 |
* SyntaxHighlighter 3.x: Fix table layout issue. Props jeherve.
|
251 |
|
252 |
= Version 1.0.0 =
|
253 |
|
254 |
+
* Initial release!
|
|
|
|
|
|
|
|
|
|
syntaxhighlighter.js
CHANGED
@@ -1,21 +1,31 @@
|
|
1 |
( function($) {
|
2 |
-
var shortcodes = window.syntaxHLcodes || 'sourcecode'
|
|
|
|
|
|
|
3 |
|
4 |
if ( typeof $ === 'undefined' ) {
|
5 |
return;
|
6 |
}
|
7 |
|
8 |
-
$(document).on( 'afterPreWpautop.syntaxhighlighter', function( event, obj ) {
|
9 |
-
obj.data
|
10 |
-
function( match, shortcode ) {
|
11 |
-
|
12 |
-
|
13 |
-
|
|
|
14 |
}).on( 'beforeWpautop.syntaxhighlighter', function( event, obj ) {
|
15 |
-
obj.data
|
16 |
-
|
17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
}
|
19 |
-
);
|
20 |
});
|
21 |
-
}( window.jQuery ));
|
1 |
( function($) {
|
2 |
+
var shortcodes = window.syntaxHLcodes || 'sourcecode',
|
3 |
+
regex = new RegExp( '(?:<pre>\\s*)?(\\[(' + shortcodes + ')[^\\]]*\\][\\s\\S]*?\\[\\/\\2\\])(?:\\s*<\\/pre>)?', 'gi' );
|
4 |
+
|
5 |
+
window.syntaxHLescape = {};
|
6 |
|
7 |
if ( typeof $ === 'undefined' ) {
|
8 |
return;
|
9 |
}
|
10 |
|
11 |
+
$( document ).on( 'afterPreWpautop.syntaxhighlighter', function( event, obj ) {
|
12 |
+
if ( obj.data && obj.data.indexOf( '[' ) !== -1 ) {
|
13 |
+
obj.data = obj.data.replace( regex, function( match, shortcode ) {
|
14 |
+
return '\n' + shortcode.replace( /</g, '<' ).replace( />/g, '>' ).replace( /&/g, '&' ) + '\n';
|
15 |
+
}
|
16 |
+
);
|
17 |
+
}
|
18 |
}).on( 'beforeWpautop.syntaxhighlighter', function( event, obj ) {
|
19 |
+
if ( obj.data && obj.data.indexOf( '[' ) !== -1 ) {
|
20 |
+
obj.data = obj.data.replace( regex, '<pre>$1</pre>' );
|
21 |
+
}
|
22 |
+
}).ready( function() {
|
23 |
+
$( '.wp-editor-wrap.html-active' ).each( function( i, element ) {
|
24 |
+
var id = $( element ).find( 'textarea.wp-editor-area' ).attr( 'id' );
|
25 |
+
|
26 |
+
if ( id ) {
|
27 |
+
window.syntaxHLescape[id] = true;
|
28 |
}
|
29 |
+
});
|
30 |
});
|
31 |
+
}( window.jQuery ));
|
syntaxhighlighter.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
|
5 |
Plugin Name: SyntaxHighlighter Evolved
|
6 |
Plugin URI: http://www.viper007bond.com/wordpress-plugins/syntaxhighlighter/
|
7 |
-
Version: 3.1.
|
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 |
Author: Alex Mills (Viper007Bond)
|
10 |
Author URI: http://www.viper007bond.com/
|
@@ -21,7 +21,7 @@ Thanks to:
|
|
21 |
|
22 |
class SyntaxHighlighter {
|
23 |
// All of these variables are private. Filters are provided for things that can be modified.
|
24 |
-
var $pluginver = '3.1.
|
25 |
var $agshver = false; // Alex Gorbatchev's SyntaxHighlighter version (dynamically set below due to v2 vs v3)
|
26 |
var $shfolder = false; // Controls what subfolder to load SyntaxHighlighter from (v2 or v3)
|
27 |
var $settings = array(); // Contains the user's settings
|
@@ -406,13 +406,16 @@ class SyntaxHighlighter {
|
|
406 |
// In certain weird circumstances, the content gets run through "content_save_pre" twice
|
407 |
// Keep track and don't allow this filter to be run twice
|
408 |
// I couldn't easily figure out why this happens and didn't bother looking into it further as this works fine
|
409 |
-
if ( true == $this->content_save_pre_ran )
|
410 |
return $content;
|
|
|
411 |
$this->content_save_pre_ran = true;
|
412 |
|
413 |
// Post quick edits aren't decoded for display, so we don't need to encode them (again)
|
414 |
-
|
|
|
415 |
return $content;
|
|
|
416 |
|
417 |
return $this->encode_shortcode_contents_slashed( $content );
|
418 |
}
|
@@ -1238,8 +1241,8 @@ class SyntaxHighlighter {
|
|
1238 |
$settings['padlinenumbers'] = (int) $settings['padlinenumbers'];
|
1239 |
|
1240 |
$settings['classname'] = ( !empty($settings['classname']) ) ? preg_replace( '/[^ A-Za-z0-9_-]*/', '', $settings['classname'] ) : '';
|
1241 |
-
$settings['firstline'] = (int) ( !empty($settings['firstline']) ) ? $settings['firstline'] : $this->defaultsettings['firstline'];
|
1242 |
-
$settings['tabsize'] = (int) ( !empty($settings['tabsize']) ) ? $settings['tabsize'] : $this->defaultsettings['tabsize'];
|
1243 |
}
|
1244 |
|
1245 |
return $settings;
|
4 |
|
5 |
Plugin Name: SyntaxHighlighter Evolved
|
6 |
Plugin URI: http://www.viper007bond.com/wordpress-plugins/syntaxhighlighter/
|
7 |
+
Version: 3.1.13
|
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 |
Author: Alex Mills (Viper007Bond)
|
10 |
Author URI: http://www.viper007bond.com/
|
21 |
|
22 |
class SyntaxHighlighter {
|
23 |
// All of these variables are private. Filters are provided for things that can be modified.
|
24 |
+
var $pluginver = '3.1.13'; // Plugin version
|
25 |
var $agshver = false; // Alex Gorbatchev's SyntaxHighlighter version (dynamically set below due to v2 vs v3)
|
26 |
var $shfolder = false; // Controls what subfolder to load SyntaxHighlighter from (v2 or v3)
|
27 |
var $settings = array(); // Contains the user's settings
|
406 |
// In certain weird circumstances, the content gets run through "content_save_pre" twice
|
407 |
// Keep track and don't allow this filter to be run twice
|
408 |
// I couldn't easily figure out why this happens and didn't bother looking into it further as this works fine
|
409 |
+
if ( true == $this->content_save_pre_ran ) {
|
410 |
return $content;
|
411 |
+
}
|
412 |
$this->content_save_pre_ran = true;
|
413 |
|
414 |
// Post quick edits aren't decoded for display, so we don't need to encode them (again)
|
415 |
+
// This also aborts for (un)trashing to avoid extra encoding.
|
416 |
+
if ( empty( $_POST ) || ( ! empty( $_POST['action'] ) && 'inline-save' == $_POST['action'] ) ) {
|
417 |
return $content;
|
418 |
+
}
|
419 |
|
420 |
return $this->encode_shortcode_contents_slashed( $content );
|
421 |
}
|
1241 |
$settings['padlinenumbers'] = (int) $settings['padlinenumbers'];
|
1242 |
|
1243 |
$settings['classname'] = ( !empty($settings['classname']) ) ? preg_replace( '/[^ A-Za-z0-9_-]*/', '', $settings['classname'] ) : '';
|
1244 |
+
$settings['firstline'] = (int) ( ( !empty($settings['firstline']) ) ? $settings['firstline'] : $this->defaultsettings['firstline'] );
|
1245 |
+
$settings['tabsize'] = (int) ( ( !empty($settings['tabsize']) ) ? $settings['tabsize'] : $this->defaultsettings['tabsize'] );
|
1246 |
}
|
1247 |
|
1248 |
return $settings;
|
syntaxhighlighter_mce-4.js
CHANGED
@@ -4,12 +4,20 @@
|
|
4 |
*/
|
5 |
tinymce.PluginManager.add( 'syntaxhighlighter', function( editor ) {
|
6 |
editor.on( 'BeforeSetContent', function( event ) {
|
7 |
-
var shortcodes = window.syntaxHLcodes || 'sourcecode'
|
|
|
8 |
|
9 |
-
event.content
|
10 |
-
function( match, shortcode ) {
|
11 |
-
|
12 |
-
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
});
|
15 |
-
});
|
4 |
*/
|
5 |
tinymce.PluginManager.add( 'syntaxhighlighter', function( editor ) {
|
6 |
editor.on( 'BeforeSetContent', function( event ) {
|
7 |
+
var shortcodes = window.syntaxHLcodes || 'sourcecode',
|
8 |
+
regex = new RegExp( '(?:<p>\\s*)?(?:<pre>\\s*)?(\\[(' + shortcodes + ')[^\\]]*\\][\\s\\S]*?\\[\\/\\2\\])(?:\\s*<\\/pre>)?(?:\\s*<\\/p>)?', 'gi' );
|
9 |
|
10 |
+
if ( event.content && event.content.indexOf( '[' ) !== -1 ) {
|
11 |
+
event.content = event.content.replace( regex, function( match, shortcode ) {
|
12 |
+
shortcode = shortcode.replace( /\r/, '' );
|
13 |
+
shortcode = shortcode.replace( /<br ?\/?>\n?/g, '\n' ).replace( /<\/?p( [^>]*)?>\n?/g, '\n' );
|
14 |
+
|
15 |
+
if ( ! event.initial || ( window.syntaxHLescape && window.syntaxHLescape[ editor.id ] ) ) {
|
16 |
+
shortcode = shortcode.replace( /&/g, '&' ).replace( /</g, '<' ).replace( />/g, '>' );
|
17 |
+
}
|
18 |
+
|
19 |
+
return '<pre>' + shortcode + '</pre>';
|
20 |
+
});
|
21 |
+
}
|
22 |
});
|
23 |
+
});
|