Version Description
Download this release
Release Info
Developer | renathoc |
Plugin | SyntaxHighlighter Evolved |
Version | 3.5.3 |
Comparing to | |
See all releases |
Code changes from version 3.5.2 to 3.5.3
- dist/blocks.build.js +1 -1
- readme.txt +8 -2
- syntaxhighlighter.php +69 -50
dist/blocks.build.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(e){function t(r){if(n[r])return n[r].exports;var l=n[r]={i:r,l:!1,exports:{}};return e[r].call(l.exports,l,l.exports,t),l.l=!0,l.exports}var n={};t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),l=(n.n(r),n(2)),a=(n.n(l),n(3)),i=(n.n(a),n(4));n.n(i);Object(l.registerBlockType)("syntaxhighlighter/code",{title:Object(r.__)("SyntaxHighlighter Code","syntaxhighlighter"),description:Object(r.__)("Adds syntax highlighting to source code (front end only).","syntaxhighlighter"),icon:"editor-code",category:"formatting",keywords:[Object(r.__)("Source","syntaxhighlighter"),Object(r.__)("Program","syntaxhighlighter"),Object(r.__)("Develop","syntaxhighlighter")],attributes:{content:{type:"string",source:"text",selector:"pre"},language:{type:"string",default:syntaxHighlighterData.settings.language.default},lineNumbers:{type:"boolean",default:syntaxHighlighterData.settings.lineNumbers.default},firstLineNumber:{type:"string",default:syntaxHighlighterData.settings.firstLineNumber.default},highlightLines:{type:"string"},wrapLines:{type:"boolean",default:syntaxHighlighterData.settings.wrapLines.default},makeURLsClickable:{type:"boolean",default:syntaxHighlighterData.settings.makeURLsClickable.default}},supports:{html:!1},transforms:{from:[{type:"enter",regExp:/^```$/,transform:function(){return Object(l.createBlock)("syntaxhighlighter/code")}},{type:"raw",isMatch:function(e){return"PRE"===e.nodeName&&1===e.children.length&&"CODE"===e.firstChild.nodeName},schema:{pre:{children:{code:{children:{"#text":{}}}}}}},{type:"block",blocks:["core/code"],transform:function(e){var t=e.content;return Object(l.createBlock)("syntaxhighlighter/code",{content:t})}}],to:[{type:"block",blocks:["core/code"],transform:function(e){var t=e.content;return Object(l.createBlock)("core/code",{content:t})}}]},edit:function(e){var t=e.attributes,n=e.setAttributes,l=e.className,o=t.content,s=t.language,h=t.lineNumbers,
|
1 |
+
!function(e){function t(r){if(n[r])return n[r].exports;var l=n[r]={i:r,l:!1,exports:{}};return e[r].call(l.exports,l,l.exports,t),l.l=!0,l.exports}var n={};t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),l=(n.n(r),n(2)),a=(n.n(l),n(3)),i=(n.n(a),n(4));n.n(i);Object(l.registerBlockType)("syntaxhighlighter/code",{title:Object(r.__)("SyntaxHighlighter Code","syntaxhighlighter"),description:Object(r.__)("Adds syntax highlighting to source code (front end only).","syntaxhighlighter"),icon:"editor-code",category:"formatting",keywords:[Object(r.__)("Source","syntaxhighlighter"),Object(r.__)("Program","syntaxhighlighter"),Object(r.__)("Develop","syntaxhighlighter")],attributes:{content:{type:"string",source:"text",selector:"pre"},language:{type:"string",default:syntaxHighlighterData.settings.language.default},lineNumbers:{type:"boolean",default:syntaxHighlighterData.settings.lineNumbers.default},firstLineNumber:{type:"string",default:syntaxHighlighterData.settings.firstLineNumber.default},highlightLines:{type:"string"},wrapLines:{type:"boolean",default:syntaxHighlighterData.settings.wrapLines.default},makeURLsClickable:{type:"boolean",default:syntaxHighlighterData.settings.makeURLsClickable.default},quickCode:{type:"boolean",default:syntaxHighlighterData.settings.quickCode.default}},supports:{html:!1},transforms:{from:[{type:"enter",regExp:/^```$/,transform:function(){return Object(l.createBlock)("syntaxhighlighter/code")}},{type:"raw",isMatch:function(e){return"PRE"===e.nodeName&&1===e.children.length&&"CODE"===e.firstChild.nodeName},schema:{pre:{children:{code:{children:{"#text":{}}}}}}},{type:"block",blocks:["core/code"],transform:function(e){var t=e.content;return Object(l.createBlock)("syntaxhighlighter/code",{content:t})}}],to:[{type:"block",blocks:["core/code"],transform:function(e){var t=e.content;return Object(l.createBlock)("core/code",{content:t})}}]},edit:function(e){var t=e.attributes,n=e.setAttributes,l=e.className,o=t.content,s=t.language,h=t.lineNumbers,c=t.firstLineNumber,g=t.highlightLines,u=t.wrapLines,p=t.makeURLsClickable,m=t.quickCode,b=[];if(syntaxHighlighterData.settings.language.supported){var d=[];for(var y in syntaxHighlighterData.brushes)d.push({label:syntaxHighlighterData.brushes[y],value:y});b.push(wp.element.createElement(a.PanelRow,null,wp.element.createElement(a.SelectControl,{label:Object(r.__)("Code Language","syntaxhighlighter"),value:s,options:d,onChange:function(e){return n({language:e})}})))}return syntaxHighlighterData.settings.lineNumbers.supported&&b.push(wp.element.createElement(a.PanelRow,null,wp.element.createElement(a.ToggleControl,{label:Object(r.__)("Show Line Numbers","syntaxhighlighter"),checked:h,onChange:function(e){return n({lineNumbers:e})}}))),h&&syntaxHighlighterData.settings.firstLineNumber.supported&&b.push(wp.element.createElement(a.PanelRow,null,wp.element.createElement(a.TextControl,{label:Object(r.__)("First Line Number","syntaxhighlighter"),type:"number",value:c,onChange:function(e){return n({firstLineNumber:e})},min:1,max:1e5}))),syntaxHighlighterData.settings.highlightLines.supported&&b.push(wp.element.createElement(a.TextControl,{label:Object(r.__)("Highlight Lines","syntaxhighlighter"),value:g,help:Object(r.__)("A comma-separated list of line numbers to highlight. Can also be a range. Example: 1,5,10-20","syntaxhighlighter"),onChange:function(e){return n({highlightLines:e})}})),syntaxHighlighterData.settings.wrapLines.supported&&b.push(wp.element.createElement(a.PanelRow,null,wp.element.createElement(a.ToggleControl,{label:Object(r.__)("Wrap Long Lines","syntaxhighlighter"),checked:u,onChange:function(e){return n({wrapLines:e})}}))),syntaxHighlighterData.settings.makeURLsClickable.supported&&b.push(wp.element.createElement(a.PanelRow,null,wp.element.createElement(a.ToggleControl,{label:Object(r.__)("Make URLs Clickable","syntaxhighlighter"),checked:p,onChange:function(e){return n({makeURLsClickable:e})}}))),syntaxHighlighterData.settings.quickCode.supported&&b.push(wp.element.createElement(a.PanelRow,null,wp.element.createElement(a.ToggleControl,{label:Object(r.__)("Enable edit mode on double click","syntaxhighlighter"),checked:m,onChange:function(e){return n({quickCode:e})}}))),[wp.element.createElement(i.InspectorControls,{key:"syntaxHighlighterInspectorControls"},wp.element.createElement(a.PanelBody,{title:Object(r.__)("Settings","syntaxhighlighter")},b)),wp.element.createElement("div",{className:l+" wp-block-code"},wp.element.createElement(i.PlainText,{value:o,onChange:function(e){return n({content:e})},placeholder:Object(r.__)("Tip: To the right, choose a code language from the block settings.","syntaxhighlighter"),"aria-label":Object(r.__)("SyntaxHighlighter Code","syntaxhighlighter")}))]},save:function(e){var t=e.attributes,n=t.content;return wp.element.createElement("pre",null,n)}})},function(e,t){e.exports=wp.i18n},function(e,t){e.exports=wp.blocks},function(e,t){e.exports=wp.components},function(e,t){e.exports=wp.editor}]);
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: Viper007Bond, automattic, donncha
|
|
3 |
Donate link: https://alex.blog/2019/03/13/in-memory-of-alex-donation-link-update/
|
4 |
Tags: code, sourcecode, block, php, xhtml, html, css, WordPress.com
|
5 |
Requires at least: 4.2.3
|
6 |
-
Tested up to: 5.
|
7 |
-
Stable tag: 3.5.
|
8 |
|
9 |
Easily post syntax-highlighted code to your site without having to modify the code at all. As seen on WordPress.com.
|
10 |
|
@@ -40,6 +40,12 @@ Try excluding this plugin's Javascript from any performance optimizations your s
|
|
40 |
|
41 |
== ChangeLog ==
|
42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
= Version 3.5.2 =
|
44 |
|
45 |
* Update plugin dependencies to the latest version.
|
3 |
Donate link: https://alex.blog/2019/03/13/in-memory-of-alex-donation-link-update/
|
4 |
Tags: code, sourcecode, block, php, xhtml, html, css, WordPress.com
|
5 |
Requires at least: 4.2.3
|
6 |
+
Tested up to: 5.4
|
7 |
+
Stable tag: 3.5.3
|
8 |
|
9 |
Easily post syntax-highlighted code to your site without having to modify the code at all. As seen on WordPress.com.
|
10 |
|
40 |
|
41 |
== ChangeLog ==
|
42 |
|
43 |
+
= Version 3.5.3 =
|
44 |
+
|
45 |
+
* Add "edit mode on double click" option to settings, shortcode parameters and block editor. #126
|
46 |
+
* Add YAML highlighter. #129
|
47 |
+
* Update plugin dependencies to the latest version. #132
|
48 |
+
|
49 |
= Version 3.5.2 =
|
50 |
|
51 |
* Update plugin dependencies to the latest version.
|
syntaxhighlighter.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
|
5 |
Plugin Name: SyntaxHighlighter Evolved
|
6 |
Plugin URI: https://alex.blog/wordpress-plugins/syntaxhighlighter/
|
7 |
-
Version: 3.5.
|
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/SyntaxHighlighter/">SyntaxHighlighter</a>. Includes a new editor block.
|
9 |
Author: Alex Mills (Viper007Bond)
|
10 |
Author URI: https://alex.blog/
|
@@ -16,7 +16,7 @@ License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
|
16 |
|
17 |
class SyntaxHighlighter {
|
18 |
// All of these variables are private. Filters are provided for things that can be modified.
|
19 |
-
var $pluginver = '3.5.
|
20 |
var $agshver = false; // Alex Gorbatchev's SyntaxHighlighter version (dynamically set below due to v2 vs v3)
|
21 |
var $shfolder = false; // Controls what subfolder to load SyntaxHighlighter from (v2 or v3)
|
22 |
var $settings = array(); // Contains the user's settings
|
@@ -104,6 +104,7 @@ class SyntaxHighlighter {
|
|
104 |
'tabsize' => 4,
|
105 |
'toolbar' => 0,
|
106 |
'wraplines' => 1, // 2.x only
|
|
|
107 |
) );
|
108 |
|
109 |
// Create the settings array by merging the user's settings and the defaults
|
@@ -144,6 +145,7 @@ class SyntaxHighlighter {
|
|
144 |
wp_register_script( 'syntaxhighlighter-brush-sql', plugins_url( $this->shfolder . '/scripts/shBrushSql.js', __FILE__ ), array('syntaxhighlighter-core'), $this->agshver );
|
145 |
wp_register_script( 'syntaxhighlighter-brush-vb', plugins_url( $this->shfolder . '/scripts/shBrushVb.js', __FILE__ ), array('syntaxhighlighter-core'), $this->agshver );
|
146 |
wp_register_script( 'syntaxhighlighter-brush-xml', plugins_url( $this->shfolder . '/scripts/shBrushXml.js', __FILE__ ), array('syntaxhighlighter-core'), $this->agshver );
|
|
|
147 |
|
148 |
// Register some popular third-party brushes
|
149 |
wp_register_script( 'syntaxhighlighter-brush-clojure', plugins_url( 'third-party-brushes/shBrushClojure.js', __FILE__ ), array('syntaxhighlighter-core'), '20090602' );
|
@@ -224,6 +226,8 @@ class SyntaxHighlighter {
|
|
224 |
'xhtml' => 'xml',
|
225 |
'xslt' => 'xml',
|
226 |
'html' => 'xml',
|
|
|
|
|
227 |
) );
|
228 |
|
229 |
$this->brush_names = (array) apply_filters( 'syntaxhighlighter_brush_names', array(
|
@@ -256,6 +260,7 @@ class SyntaxHighlighter {
|
|
256 |
'sql' => __( 'SQL', 'syntaxhighlighter' ),
|
257 |
'vb' => __( 'Visual Basic', 'syntaxhighlighter' ),
|
258 |
'xml' => __( 'HTML / XHTML / XML / XSLT', 'syntaxhighlighter' ),
|
|
|
259 |
) );
|
260 |
|
261 |
// Add any custom brushes that aren't making use of the newer "syntaxhighlighter_brush_names" filter.
|
@@ -358,6 +363,10 @@ class SyntaxHighlighter {
|
|
358 |
'supported' => true,
|
359 |
'default' => (bool) $this->settings['autolinks'],
|
360 |
),
|
|
|
|
|
|
|
|
|
361 |
);
|
362 |
|
363 |
wp_add_inline_script(
|
@@ -496,6 +505,7 @@ class SyntaxHighlighter {
|
|
496 |
'highlightLines' => 'highlight',
|
497 |
'wrapLines' => 'wraplines',
|
498 |
'makeURLsClickable' => 'autolinks',
|
|
|
499 |
);
|
500 |
|
501 |
foreach ( $remaps as $from => $to ) {
|
@@ -1038,6 +1048,9 @@ class SyntaxHighlighter {
|
|
1038 |
if ( 1 != $this->settings['wraplines'] )
|
1039 |
echo " SyntaxHighlighter.defaults['wrap-lines'] = false;\n";
|
1040 |
|
|
|
|
|
|
|
1041 |
?> SyntaxHighlighter.all();
|
1042 |
|
1043 |
// Infinite scroll support
|
@@ -1114,6 +1127,7 @@ class SyntaxHighlighter {
|
|
1114 |
'title' => $this->settings['title'],
|
1115 |
'toolbar' => false,
|
1116 |
'wraplines' => false,
|
|
|
1117 |
), $atts ) );
|
1118 |
|
1119 |
// Check for language shortcode tag such as [php]code[/php]
|
@@ -1171,6 +1185,7 @@ class SyntaxHighlighter {
|
|
1171 |
'smarttabs' => 'smart-tabs',
|
1172 |
'tabsize' => 'tab-size',
|
1173 |
'wraplines' => 'wrap-lines',
|
|
|
1174 |
);
|
1175 |
|
1176 |
// Allowed configuration parameters and their type
|
@@ -1191,6 +1206,7 @@ class SyntaxHighlighter {
|
|
1191 |
'title' => 'other',
|
1192 |
'toolbar' => 'boolean',
|
1193 |
'wrap-lines' => 'boolean',
|
|
|
1194 |
) );
|
1195 |
|
1196 |
$title = '';
|
@@ -1324,7 +1340,7 @@ class SyntaxHighlighter {
|
|
1324 |
</script>
|
1325 |
|
1326 |
<div class="wrap">
|
1327 |
-
<h2><?php
|
1328 |
|
1329 |
<form method="post" action="options.php">
|
1330 |
|
@@ -1333,7 +1349,7 @@ class SyntaxHighlighter {
|
|
1333 |
|
1334 |
<table class="form-table">
|
1335 |
<tr valign="top">
|
1336 |
-
<th scope="row"><label for="syntaxhighlighter-shversion"><?php
|
1337 |
<td>
|
1338 |
<select name="syntaxhighlighter_settings[shversion]" id="syntaxhighlighter-shversion" class="postform">
|
1339 |
<?php
|
@@ -1347,12 +1363,12 @@ class SyntaxHighlighter {
|
|
1347 |
}
|
1348 |
?>
|
1349 |
</select><br />
|
1350 |
-
<?php
|
1351 |
-
<?php
|
1352 |
</td>
|
1353 |
</tr>
|
1354 |
<tr valign="top">
|
1355 |
-
<th scope="row"><label for="syntaxhighlighter-theme"><?php
|
1356 |
<td>
|
1357 |
<select name="syntaxhighlighter_settings[theme]" id="syntaxhighlighter-theme" class="postform">
|
1358 |
<?php
|
@@ -1364,48 +1380,49 @@ class SyntaxHighlighter {
|
|
1364 |
</td>
|
1365 |
</tr>
|
1366 |
<tr valign="top">
|
1367 |
-
<th scope="row"><?php
|
1368 |
<td>
|
1369 |
<fieldset>
|
1370 |
-
<legend class="hidden"><?php
|
1371 |
-
<label for="syntaxhighlighter-loadallbrushes"><input name="syntaxhighlighter_settings[loadallbrushes]" type="checkbox" id="syntaxhighlighter-loadallbrushes" value="1" <?php checked( $this->settings['loadallbrushes'], 1 ); ?> /> <?php
|
1372 |
</fieldset>
|
1373 |
</td>
|
1374 |
</tr>
|
1375 |
</table>
|
1376 |
|
1377 |
-
<h3><?php
|
1378 |
|
1379 |
-
<p><?php
|
1380 |
|
1381 |
<table class="form-table">
|
1382 |
<tr valign="top">
|
1383 |
-
<th scope="row"><?php
|
1384 |
<td>
|
1385 |
<fieldset>
|
1386 |
-
<legend class="hidden"><?php
|
1387 |
-
|
1388 |
-
<label for="syntaxhighlighter-gutter"><input name="syntaxhighlighter_settings[gutter]" type="checkbox" id="syntaxhighlighter-gutter" value="1" <?php checked( $this->settings['gutter'], 1 ); ?> /> <?php
|
1389 |
-
<label for="syntaxhighlighter-toolbar"><input name="syntaxhighlighter_settings[toolbar]" type="checkbox" id="syntaxhighlighter-toolbar" value="1" <?php checked( $this->settings['toolbar'], 1 ); ?> /> <?php
|
1390 |
-
<label for="syntaxhighlighter-autolinks"><input name="syntaxhighlighter_settings[autolinks]" type="checkbox" id="syntaxhighlighter-autolinks" value="1" <?php checked( $this->settings['autolinks'], 1 ); ?> /> <?php
|
1391 |
-
<label for="syntaxhighlighter-collapse"><input name="syntaxhighlighter_settings[collapse]" type="checkbox" id="syntaxhighlighter-collapse" value="1" <?php checked( $this->settings['collapse'], 1 ); ?> /> <?php
|
1392 |
-
<label for="syntaxhighlighter-light"><input name="syntaxhighlighter_settings[light]" type="checkbox" id="syntaxhighlighter-light" value="1" <?php checked( $this->settings['light'], 1 ); ?> /> <?php
|
1393 |
-
<label for="syntaxhighlighter-smarttabs"><input name="syntaxhighlighter_settings[smarttabs]" type="checkbox" id="syntaxhighlighter-smarttabs" value="1" <?php checked( $this->settings['smarttabs'], 1 ); ?> /> <?php
|
1394 |
-
<label for="syntaxhighlighter-wraplines"><input name="syntaxhighlighter_settings[wraplines]" type="checkbox" id="syntaxhighlighter-wraplines" value="1" <?php checked( $this->settings['wraplines'], 1 ); ?> /> <?php
|
1395 |
-
|
|
|
1396 |
</fieldset>
|
1397 |
</td>
|
1398 |
</tr>
|
1399 |
<tr valign="top">
|
1400 |
-
<th scope="row"><label for="syntaxhighlighter-classname"><?php
|
1401 |
<td><input name="syntaxhighlighter_settings[classname]" type="text" id="syntaxhighlighter-classname" value="<?php echo esc_attr( $this->settings['classname'] ); ?>" class="regular-text" /></td>
|
1402 |
</tr>
|
1403 |
<tr valign="top">
|
1404 |
-
<th scope="row"><label for="syntaxhighlighter-firstline"><?php
|
1405 |
<td><input name="syntaxhighlighter_settings[firstline]" type="text" id="syntaxhighlighter-firstline" value="<?php echo esc_attr( $this->settings['firstline'] ); ?>" class="small-text" /></td>
|
1406 |
</tr>
|
1407 |
<tr valign="top">
|
1408 |
-
<th scope="row"><label for="syntaxhighlighter-padlinenumbers"><?php
|
1409 |
<td>
|
1410 |
<select name="syntaxhighlighter_settings[padlinenumbers]" id="syntaxhighlighter-padlinenumbers" class="postform">
|
1411 |
<?php
|
@@ -1427,14 +1444,14 @@ class SyntaxHighlighter {
|
|
1427 |
</td>
|
1428 |
</tr>
|
1429 |
<tr valign="top">
|
1430 |
-
<th scope="row"><label for="syntaxhighlighter-tabsize"><?php
|
1431 |
<td><input name="syntaxhighlighter_settings[tabsize]" type="text" id="syntaxhighlighter-tabsize" value="<?php echo esc_attr( $this->settings['tabsize'] ); ?>" class="small-text" /></td>
|
1432 |
</tr>
|
1433 |
<tr valign="top">
|
1434 |
-
<th scope="row"><label for="syntaxhighlighter-title"><?php
|
1435 |
<td>
|
1436 |
<input name="syntaxhighlighter_settings[title]" type="text" id="syntaxhighlighter-title" value="<?php echo esc_attr( $this->settings['title'] ); ?>" class="regular-text" /><br />
|
1437 |
-
<?php
|
1438 |
</td>
|
1439 |
</tr>
|
1440 |
</table>
|
@@ -1454,9 +1471,9 @@ class SyntaxHighlighter {
|
|
1454 |
|
1455 |
</form>
|
1456 |
|
1457 |
-
<h3><?php
|
1458 |
|
1459 |
-
<p><?php
|
1460 |
|
1461 |
<?php
|
1462 |
|
@@ -1498,33 +1515,34 @@ class SyntaxHighlighter {
|
|
1498 |
echo '</div>';
|
1499 |
?>
|
1500 |
|
1501 |
-
<h3 style="margin-top:30px"><?php
|
1502 |
|
1503 |
<p><?php printf( __( 'These are the parameters you can pass to the shortcode and what they do. For the booleans (i.e. on/off), pass %1$s/%2$s or %3$s/%4$s.', 'syntaxhighlighter' ), '<code>true</code>', '<code>1</code>', '<code>false</code>', '<code>0</code>' ); ?></p>
|
1504 |
|
1505 |
<ul class="ul-disc">
|
1506 |
-
<li><?php printf(
|
1507 |
-
<li><?php printf(
|
1508 |
-
<li><?php printf(
|
1509 |
-
<li><?php printf(
|
1510 |
-
<li><?php printf(
|
1511 |
-
<li><?php printf(
|
1512 |
-
<li><?php printf(
|
1513 |
-
<li><?php printf(
|
1514 |
-
<li><?php printf(
|
1515 |
-
<li><?php printf(
|
1516 |
-
<li><?php printf(
|
1517 |
-
<li><?php printf(
|
1518 |
-
<li><?php printf(
|
|
|
1519 |
</ul>
|
1520 |
|
1521 |
-
<p><?php
|
1522 |
|
1523 |
<ul class="ul-disc">
|
1524 |
-
<li><code>[php]<?php
|
1525 |
-
<li><code>[css autolinks="false" classname="myclass" collapse="false" firstline="1" gutter="true" highlight="1-3,6,9" htmlscript="false" light="false" padlinenumbers="false" smarttabs="true" tabsize="4" toolbar="true" title="<?php
|
1526 |
-
<li><code>[code lang="js"]<?php
|
1527 |
-
<li><code>[sourcecode language="plain"]<?php
|
1528 |
</ul>
|
1529 |
|
1530 |
<?php $this->maybe_output_scripts(); ?>
|
@@ -1553,6 +1571,7 @@ class SyntaxHighlighter {
|
|
1553 |
$settings['smarttabs'] = ( ! empty($settings['smarttabs']) ) ? 1 : 0;
|
1554 |
$settings['toolbar'] = ( ! empty($settings['toolbar']) ) ? 1 : 0; // May be overridden below
|
1555 |
$settings['wraplines'] = ( ! empty($settings['wraplines']) ) ? 1 : 0; // 2.x only for now
|
|
|
1556 |
|
1557 |
// If the version changed, then force change the toolbar version setting
|
1558 |
if ( $settings['shversion'] != $this->settings['shversion'] ) {
|
4 |
|
5 |
Plugin Name: SyntaxHighlighter Evolved
|
6 |
Plugin URI: https://alex.blog/wordpress-plugins/syntaxhighlighter/
|
7 |
+
Version: 3.5.3
|
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/SyntaxHighlighter/">SyntaxHighlighter</a>. Includes a new editor block.
|
9 |
Author: Alex Mills (Viper007Bond)
|
10 |
Author URI: https://alex.blog/
|
16 |
|
17 |
class SyntaxHighlighter {
|
18 |
// All of these variables are private. Filters are provided for things that can be modified.
|
19 |
+
var $pluginver = '3.5.3'; // Plugin version
|
20 |
var $agshver = false; // Alex Gorbatchev's SyntaxHighlighter version (dynamically set below due to v2 vs v3)
|
21 |
var $shfolder = false; // Controls what subfolder to load SyntaxHighlighter from (v2 or v3)
|
22 |
var $settings = array(); // Contains the user's settings
|
104 |
'tabsize' => 4,
|
105 |
'toolbar' => 0,
|
106 |
'wraplines' => 1, // 2.x only
|
107 |
+
'quickcode' => 1, // 3.x only
|
108 |
) );
|
109 |
|
110 |
// Create the settings array by merging the user's settings and the defaults
|
145 |
wp_register_script( 'syntaxhighlighter-brush-sql', plugins_url( $this->shfolder . '/scripts/shBrushSql.js', __FILE__ ), array('syntaxhighlighter-core'), $this->agshver );
|
146 |
wp_register_script( 'syntaxhighlighter-brush-vb', plugins_url( $this->shfolder . '/scripts/shBrushVb.js', __FILE__ ), array('syntaxhighlighter-core'), $this->agshver );
|
147 |
wp_register_script( 'syntaxhighlighter-brush-xml', plugins_url( $this->shfolder . '/scripts/shBrushXml.js', __FILE__ ), array('syntaxhighlighter-core'), $this->agshver );
|
148 |
+
wp_register_script( 'syntaxhighlighter-brush-yaml', plugins_url( $this->shfolder . '/scripts/shBrushYaml.js', __FILE__ ), array('syntaxhighlighter-core'), $this->agshver );
|
149 |
|
150 |
// Register some popular third-party brushes
|
151 |
wp_register_script( 'syntaxhighlighter-brush-clojure', plugins_url( 'third-party-brushes/shBrushClojure.js', __FILE__ ), array('syntaxhighlighter-core'), '20090602' );
|
226 |
'xhtml' => 'xml',
|
227 |
'xslt' => 'xml',
|
228 |
'html' => 'xml',
|
229 |
+
'yaml' => 'yaml',
|
230 |
+
'yml' => 'yaml',
|
231 |
) );
|
232 |
|
233 |
$this->brush_names = (array) apply_filters( 'syntaxhighlighter_brush_names', array(
|
260 |
'sql' => __( 'SQL', 'syntaxhighlighter' ),
|
261 |
'vb' => __( 'Visual Basic', 'syntaxhighlighter' ),
|
262 |
'xml' => __( 'HTML / XHTML / XML / XSLT', 'syntaxhighlighter' ),
|
263 |
+
'yaml' => __( 'YAML', 'syntaxhighlighter' ),
|
264 |
) );
|
265 |
|
266 |
// Add any custom brushes that aren't making use of the newer "syntaxhighlighter_brush_names" filter.
|
363 |
'supported' => true,
|
364 |
'default' => (bool) $this->settings['autolinks'],
|
365 |
),
|
366 |
+
'quickCode' => (object) array(
|
367 |
+
'supported' => ( '3' == $this->settings['shversion'] ),
|
368 |
+
'default' => (bool) $this->settings['quickcode'],
|
369 |
+
),
|
370 |
);
|
371 |
|
372 |
wp_add_inline_script(
|
505 |
'highlightLines' => 'highlight',
|
506 |
'wrapLines' => 'wraplines',
|
507 |
'makeURLsClickable' => 'autolinks',
|
508 |
+
'quickCode' => 'quickcode',
|
509 |
);
|
510 |
|
511 |
foreach ( $remaps as $from => $to ) {
|
1048 |
if ( 1 != $this->settings['wraplines'] )
|
1049 |
echo " SyntaxHighlighter.defaults['wrap-lines'] = false;\n";
|
1050 |
|
1051 |
+
if ( 1 != $this->settings['quickcode'] )
|
1052 |
+
echo " SyntaxHighlighter.defaults['quick-code'] = false;\n";
|
1053 |
+
|
1054 |
?> SyntaxHighlighter.all();
|
1055 |
|
1056 |
// Infinite scroll support
|
1127 |
'title' => $this->settings['title'],
|
1128 |
'toolbar' => false,
|
1129 |
'wraplines' => false,
|
1130 |
+
'quickcode' => false,
|
1131 |
), $atts ) );
|
1132 |
|
1133 |
// Check for language shortcode tag such as [php]code[/php]
|
1185 |
'smarttabs' => 'smart-tabs',
|
1186 |
'tabsize' => 'tab-size',
|
1187 |
'wraplines' => 'wrap-lines',
|
1188 |
+
'quickcode' => 'quick-code',
|
1189 |
);
|
1190 |
|
1191 |
// Allowed configuration parameters and their type
|
1206 |
'title' => 'other',
|
1207 |
'toolbar' => 'boolean',
|
1208 |
'wrap-lines' => 'boolean',
|
1209 |
+
'quick-code' => 'boolean',
|
1210 |
) );
|
1211 |
|
1212 |
$title = '';
|
1340 |
</script>
|
1341 |
|
1342 |
<div class="wrap">
|
1343 |
+
<h2><?php esc_html_e( 'SyntaxHighlighter Settings', 'syntaxhighlighter' ); ?></h2>
|
1344 |
|
1345 |
<form method="post" action="options.php">
|
1346 |
|
1349 |
|
1350 |
<table class="form-table">
|
1351 |
<tr valign="top">
|
1352 |
+
<th scope="row"><label for="syntaxhighlighter-shversion"><?php esc_html_e( 'Highlighter Version', 'syntaxhighlighter' ); ?></label></th>
|
1353 |
<td>
|
1354 |
<select name="syntaxhighlighter_settings[shversion]" id="syntaxhighlighter-shversion" class="postform">
|
1355 |
<?php
|
1363 |
}
|
1364 |
?>
|
1365 |
</select><br />
|
1366 |
+
<?php esc_html_e( 'Version 3 allows visitors to easily highlight portions of your code with their mouse (either by dragging or double-clicking) and copy it to their clipboard. No toolbar containing a Flash-based button is required.', 'syntaxhighlighter' ); ?><br />
|
1367 |
+
<?php esc_html_e( 'Version 2 allows for line wrapping, something that version 3 does not do at this time.', 'syntaxhighlighter' ); ?>
|
1368 |
</td>
|
1369 |
</tr>
|
1370 |
<tr valign="top">
|
1371 |
+
<th scope="row"><label for="syntaxhighlighter-theme"><?php esc_html_e( 'Color Theme', 'syntaxhighlighter' ); ?></label></th>
|
1372 |
<td>
|
1373 |
<select name="syntaxhighlighter_settings[theme]" id="syntaxhighlighter-theme" class="postform">
|
1374 |
<?php
|
1380 |
</td>
|
1381 |
</tr>
|
1382 |
<tr valign="top">
|
1383 |
+
<th scope="row"><?php esc_html_e( 'Load All Brushes', 'syntaxhighlighter' ); ?></th>
|
1384 |
<td>
|
1385 |
<fieldset>
|
1386 |
+
<legend class="hidden"><?php esc_html_e( 'Load All Brushes', 'syntaxhighlighter' ); ?></legend>
|
1387 |
+
<label for="syntaxhighlighter-loadallbrushes"><input name="syntaxhighlighter_settings[loadallbrushes]" type="checkbox" id="syntaxhighlighter-loadallbrushes" value="1" <?php checked( $this->settings['loadallbrushes'], 1 ); ?> /> <?php esc_html_e( 'Always load all language files (for directly using <code><pre></code> tags rather than shortcodes)<br /> If left unchecked (default), then language files will only be loaded when needed<br /> If unsure, leave this box unchecked', 'syntaxhighlighter' ); ?></label>
|
1388 |
</fieldset>
|
1389 |
</td>
|
1390 |
</tr>
|
1391 |
</table>
|
1392 |
|
1393 |
+
<h3><?php esc_html_e( 'Defaults', 'syntaxhighlighter' ); ?></h3>
|
1394 |
|
1395 |
+
<p><?php esc_html_e( 'All of the settings below can be configured on a per-code block basis, but you can control the defaults of all code blocks here.', 'syntaxhighlighter' ); ?></p>
|
1396 |
|
1397 |
<table class="form-table">
|
1398 |
<tr valign="top">
|
1399 |
+
<th scope="row"><?php esc_html_e( 'Miscellaneous', 'syntaxhighlighter' ); ?></th>
|
1400 |
<td>
|
1401 |
<fieldset>
|
1402 |
+
<legend class="hidden"><?php esc_html_e( 'Miscellaneous', 'syntaxhighlighter' ); ?></legend>
|
1403 |
+
|
1404 |
+
<label for="syntaxhighlighter-gutter"><input name="syntaxhighlighter_settings[gutter]" type="checkbox" id="syntaxhighlighter-gutter" value="1" <?php checked( $this->settings['gutter'], 1 ); ?> /> <?php esc_html_e( 'Display line numbers', 'syntaxhighlighter' ); ?></label><br />
|
1405 |
+
<label for="syntaxhighlighter-toolbar"><input name="syntaxhighlighter_settings[toolbar]" type="checkbox" id="syntaxhighlighter-toolbar" value="1" <?php checked( $this->settings['toolbar'], 1 ); ?> /> <?php esc_html_e( 'Display the toolbar', 'syntaxhighlighter' ); ?></label><br />
|
1406 |
+
<label for="syntaxhighlighter-autolinks"><input name="syntaxhighlighter_settings[autolinks]" type="checkbox" id="syntaxhighlighter-autolinks" value="1" <?php checked( $this->settings['autolinks'], 1 ); ?> /> <?php esc_html_e( 'Automatically make URLs clickable', 'syntaxhighlighter' ); ?></label><br />
|
1407 |
+
<label for="syntaxhighlighter-collapse"><input name="syntaxhighlighter_settings[collapse]" type="checkbox" id="syntaxhighlighter-collapse" value="1" <?php checked( $this->settings['collapse'], 1 ); ?> /> <?php esc_html_e( 'Collapse code boxes', 'syntaxhighlighter' ); ?></label><br />
|
1408 |
+
<label for="syntaxhighlighter-light"><input name="syntaxhighlighter_settings[light]" type="checkbox" id="syntaxhighlighter-light" value="1" <?php checked( $this->settings['light'], 1 ); ?> /> <?php esc_html_e( 'Use the light display mode, best for single lines of code', 'syntaxhighlighter' ); ?></label><br />
|
1409 |
+
<label for="syntaxhighlighter-smarttabs"><input name="syntaxhighlighter_settings[smarttabs]" type="checkbox" id="syntaxhighlighter-smarttabs" value="1" <?php checked( $this->settings['smarttabs'], 1 ); ?> /> <?php esc_html_e( 'Use smart tabs allowing tabs being used for alignment', 'syntaxhighlighter' ); ?></label><br />
|
1410 |
+
<label for="syntaxhighlighter-wraplines"><input name="syntaxhighlighter_settings[wraplines]" type="checkbox" id="syntaxhighlighter-wraplines" value="1" <?php checked( $this->settings['wraplines'], 1 ); ?> /> <?php esc_html_e( 'Wrap long lines (v2.x only, disabling this will make a scrollbar show instead)', 'syntaxhighlighter' ); ?></label><br />
|
1411 |
+
<label for="syntaxhighlighter-quickcode"><input name="syntaxhighlighter_settings[quickcode]" type="checkbox" id="syntaxhighlighter-quickcode" value="1" <?php checked( $this->settings['quickcode'], 1 ); ?> /> <?php esc_html_e( 'Enable edit mode on double click (v3.x only)', 'syntaxhighlighter' ); ?></label><br />
|
1412 |
+
<!--<label for="syntaxhighlighter-htmlscript"><input name="syntaxhighlighter_settings[htmlscript]" type="checkbox" id="syntaxhighlighter-htmlscript" value="1" <?php checked( $this->settings['htmlscript'], 1 ); ?> /> <?php esc_html_e( 'Enable "HTML script" mode by default (see the bottom of this page for details). Checking this box is not recommended as this mode only works with certain languages.', 'syntaxhighlighter' ); ?></label>-->
|
1413 |
</fieldset>
|
1414 |
</td>
|
1415 |
</tr>
|
1416 |
<tr valign="top">
|
1417 |
+
<th scope="row"><label for="syntaxhighlighter-classname"><?php esc_html_e( 'Additional CSS Class(es)', 'syntaxhighlighter' ); ?></label></th>
|
1418 |
<td><input name="syntaxhighlighter_settings[classname]" type="text" id="syntaxhighlighter-classname" value="<?php echo esc_attr( $this->settings['classname'] ); ?>" class="regular-text" /></td>
|
1419 |
</tr>
|
1420 |
<tr valign="top">
|
1421 |
+
<th scope="row"><label for="syntaxhighlighter-firstline"><?php esc_html_e( 'Starting Line Number', 'syntaxhighlighter' ); ?></label></th>
|
1422 |
<td><input name="syntaxhighlighter_settings[firstline]" type="text" id="syntaxhighlighter-firstline" value="<?php echo esc_attr( $this->settings['firstline'] ); ?>" class="small-text" /></td>
|
1423 |
</tr>
|
1424 |
<tr valign="top">
|
1425 |
+
<th scope="row"><label for="syntaxhighlighter-padlinenumbers"><?php esc_html_e( 'Line Number Padding', 'syntaxhighlighter' ); ?></label></th>
|
1426 |
<td>
|
1427 |
<select name="syntaxhighlighter_settings[padlinenumbers]" id="syntaxhighlighter-padlinenumbers" class="postform">
|
1428 |
<?php
|
1444 |
</td>
|
1445 |
</tr>
|
1446 |
<tr valign="top">
|
1447 |
+
<th scope="row"><label for="syntaxhighlighter-tabsize"><?php esc_html_e( 'Tab Size', 'syntaxhighlighter' ); ?></label></th>
|
1448 |
<td><input name="syntaxhighlighter_settings[tabsize]" type="text" id="syntaxhighlighter-tabsize" value="<?php echo esc_attr( $this->settings['tabsize'] ); ?>" class="small-text" /></td>
|
1449 |
</tr>
|
1450 |
<tr valign="top">
|
1451 |
+
<th scope="row"><label for="syntaxhighlighter-title"><?php esc_html_e( 'Title', 'syntaxhighlighter' ); ?></label></th>
|
1452 |
<td>
|
1453 |
<input name="syntaxhighlighter_settings[title]" type="text" id="syntaxhighlighter-title" value="<?php echo esc_attr( $this->settings['title'] ); ?>" class="regular-text" /><br />
|
1454 |
+
<?php esc_html_e( 'Some optional default text to display above each code block or as the clickable text for collapsed code blocks.', 'syntaxhighlighter' ); ?>
|
1455 |
</td>
|
1456 |
</tr>
|
1457 |
</table>
|
1471 |
|
1472 |
</form>
|
1473 |
|
1474 |
+
<h3><?php esc_html_e( 'Preview', 'syntaxhighlighter' ); ?></h3>
|
1475 |
|
1476 |
+
<p><?php esc_html_e( 'Click "Save Changes" to update this preview.', 'syntaxhighlighter' ); ?>
|
1477 |
|
1478 |
<?php
|
1479 |
|
1515 |
echo '</div>';
|
1516 |
?>
|
1517 |
|
1518 |
+
<h3 style="margin-top:30px"><?php esc_html_e( 'Shortcode Parameters', 'syntaxhighlighter' ); ?></h3>
|
1519 |
|
1520 |
<p><?php printf( __( 'These are the parameters you can pass to the shortcode and what they do. For the booleans (i.e. on/off), pass %1$s/%2$s or %3$s/%4$s.', 'syntaxhighlighter' ), '<code>true</code>', '<code>1</code>', '<code>false</code>', '<code>0</code>' ); ?></p>
|
1521 |
|
1522 |
<ul class="ul-disc">
|
1523 |
+
<li><?php printf( esc_html_x( '%1$s or %2$s — The language syntax to highlight with. You can alternately just use that as the tag, such as <code>[php]code[/php]</code>. <a href="%3$s">Click here</a> for a list of valid tags (under "aliases").', 'language parameter', 'syntaxhighlighter' ), '<code>lang</code>', '<code>language</code>', 'http://alexgorbatchev.com/SyntaxHighlighter/manual/brushes/' ); ?></li>
|
1524 |
+
<li><?php printf( esc_html_x( '%s — Toggle automatic URL linking.', 'autolinks parameter', 'syntaxhighlighter' ), '<code>autolinks</code>' ); ?></li>
|
1525 |
+
<li><?php printf( esc_html_x( '%s — Add an additional CSS class to the code box.', 'classname parameter', 'syntaxhighlighter' ), '<code>classname</code>' ); ?></li>
|
1526 |
+
<li><?php printf( esc_html_x( '%s — Toggle collapsing the code box by default, requiring a click to expand it. Good for large code posts.', 'collapse parameter', 'syntaxhighlighter' ), '<code>collapse</code>' ); ?></li>
|
1527 |
+
<li><?php printf( esc_html_x( '%s — An interger specifying what number the first line should be (for the line numbering).', 'firstline parameter', 'syntaxhighlighter' ), '<code>firstline</code>' ); ?></li>
|
1528 |
+
<li><?php printf( esc_html_x( '%s — Toggle the left-side line numbering.', 'gutter parameter', 'syntaxhighlighter' ), '<code>gutter</code>' ); ?></li>
|
1529 |
+
<li><?php printf( esc_html_x( '%1$s — A comma-separated list of line numbers to highlight. You can also specify a range. Example: %2$s', 'highlight parameter', 'syntaxhighlighter' ), '<code>highlight</code>', '<code>2,5-10,12</code>' ); ?></li>
|
1530 |
+
<li><?php printf( esc_html_x( "%s — Toggle highlighting any extra HTML/XML. Good for when you're mixing HTML/XML with another language, such as having PHP inside an HTML web page. The above preview has it enabled for example. This only works with certain languages.", 'htmlscript parameter', 'syntaxhighlighter' ), '<code>htmlscript</code>' ); ?></li>
|
1531 |
+
<li><?php printf( esc_html_x( '%s — Toggle light mode which disables the gutter and toolbar all at once.', 'light parameter', 'syntaxhighlighter' ), '<code>light</code>' ); ?></li>
|
1532 |
+
<li><?php printf( esc_html_x( '%s — Controls line number padding. Valid values are <code>false</code> (no padding), <code>true</code> (automatic padding), or an integer (forced padding).', 'padlinenumbers parameter', 'syntaxhighlighter' ), '<code>padlinenumbers</code>' ); ?></li>
|
1533 |
+
<li><?php printf( esc_html_x( '%1$s (v3 only) — Sets some text to show up before the code. Very useful when combined with the %2$s parameter.', 'title parameter', 'syntaxhighlighter' ), '<code>title</code>', '<code>collapse</code>' ); ?></li>
|
1534 |
+
<li><?php printf( esc_html_x( '%s — Toggle the toolbar (buttons in v2, the about question mark in v3)', 'toolbar parameter', 'syntaxhighlighter' ), '<code>toolbar</code>' ); ?></li>
|
1535 |
+
<li><?php printf( esc_html_x( '%s (v2 only) — Toggle line wrapping.', 'wraplines parameter', 'syntaxhighlighter'), '<code>wraplines</code>' ); ?></li>
|
1536 |
+
<li><?php printf( esc_html_x( '%s — Enable edit mode on double click.', 'quickcode parameter', 'syntaxhighlighter' ), '<code>quickcode</code>' ); ?></li>
|
1537 |
</ul>
|
1538 |
|
1539 |
+
<p><?php esc_html_e( 'Some example shortcodes:', 'syntaxhighlighter' ); ?></p>
|
1540 |
|
1541 |
<ul class="ul-disc">
|
1542 |
+
<li><code>[php]<?php esc_html_e( 'your code here', 'syntaxhighlighter' ); ?>[/php]</code></li>
|
1543 |
+
<li><code>[css autolinks="false" classname="myclass" collapse="false" firstline="1" gutter="true" highlight="1-3,6,9" htmlscript="false" light="false" padlinenumbers="false" smarttabs="true" tabsize="4" toolbar="true" title="<?php esc_html_e( 'example-filename.php', 'syntaxhighlighter' ); ?>"]<?php esc_html_e( 'your code here', 'syntaxhighlighter' ); ?>[/css]</code></li>
|
1544 |
+
<li><code>[code lang="js"]<?php esc_html_e( 'your code here', 'syntaxhighlighter' ); ?>[/code]</code></li>
|
1545 |
+
<li><code>[sourcecode language="plain"]<?php esc_html_e( 'your code here', 'syntaxhighlighter' ); ?>[/sourcecode]</code></li>
|
1546 |
</ul>
|
1547 |
|
1548 |
<?php $this->maybe_output_scripts(); ?>
|
1571 |
$settings['smarttabs'] = ( ! empty($settings['smarttabs']) ) ? 1 : 0;
|
1572 |
$settings['toolbar'] = ( ! empty($settings['toolbar']) ) ? 1 : 0; // May be overridden below
|
1573 |
$settings['wraplines'] = ( ! empty($settings['wraplines']) ) ? 1 : 0; // 2.x only for now
|
1574 |
+
$settings['quickcode'] = ( ! empty($settings['quickcode']) ) ? 1 : 0; // 3.x only for now
|
1575 |
|
1576 |
// If the version changed, then force change the toolbar version setting
|
1577 |
if ( $settings['shversion'] != $this->settings['shversion'] ) {
|