Version Description
Download this release
Release Info
Developer | Viper007Bond |
Plugin | SyntaxHighlighter Evolved |
Version | 1.1.0 |
Comparing to | |
See all releases |
Code changes from version 1.1.2 to 1.1.0
- files/SyntaxHighlighter.css +1 -9
- readme.txt +9 -23
- syntaxhighlighter.php +34 -155
files/SyntaxHighlighter.css
CHANGED
@@ -1,15 +1,7 @@
|
|
1 |
.dp-highlighter
|
2 |
-
.dp-highlighter ol,
|
3 |
-
.dp-highlighter ol li,
|
4 |
-
.dp-highlighter ol li span
|
5 |
{
|
6 |
-
font-
|
7 |
-
font-family: "Consolas", "Monaco", "Courier New", Courier, monospace !important;
|
8 |
font-size: 12px;
|
9 |
-
}
|
10 |
-
|
11 |
-
.dp-highlighter
|
12 |
-
{
|
13 |
background-color: #E7E5DC;
|
14 |
width: 99%;
|
15 |
overflow: auto;
|
1 |
.dp-highlighter
|
|
|
|
|
|
|
2 |
{
|
3 |
+
font-family: "Consolas", "Courier New", Courier, mono, serif;
|
|
|
4 |
font-size: 12px;
|
|
|
|
|
|
|
|
|
5 |
background-color: #E7E5DC;
|
6 |
width: 99%;
|
7 |
overflow: auto;
|
readme.txt
CHANGED
@@ -1,16 +1,17 @@
|
|
1 |
=== SyntaxHighlighter ===
|
2 |
-
Contributors: matt, Viper007Bond
|
3 |
Tags: code, sourcecode, php, xhtml, html, css
|
4 |
Requires at least: 2.0
|
|
|
5 |
Stable tag: trunk
|
6 |
|
7 |
Easily post source code such as PHP or HTML and display it in a styled box.
|
8 |
|
9 |
== Description ==
|
10 |
|
11 |
-
SyntaxHighlighter allows you to easily post
|
12 |
|
13 |
-
|
14 |
|
15 |
* C++ -- `cpp`, `c`, `c++`
|
16 |
* C# -- `c#`, `c-sharp`, `csharp`
|
@@ -43,15 +44,15 @@ This should result in the following file structure:
|
|
43 |
- plugins
|
44 |
- syntaxhighlighter
|
45 |
| readme.txt
|
46 |
-
|
47 |
| syntaxhighlighter.php
|
48 |
- files
|
49 |
| clipboard.swf
|
50 |
| shBrushCpp.js
|
51 |
| shBrushCSharp.js
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
|
56 |
**See Also:** ["Installing Plugins" article on the WP Codex](http://codex.wordpress.org/Managing_Plugins#Installing_Plugins)
|
57 |
|
@@ -65,7 +66,7 @@ Just wrap your code in `[sourcecode language='css']code here[/sourcecode]`. The
|
|
65 |
|
66 |
== Frequently Asked Questions ==
|
67 |
|
68 |
-
= The BBCode in my post is being replaced with
|
69 |
|
70 |
Make sure your theme's footer has `<?php wp_footer(); ?>` somewhere in it, otherwise the JavaScript highlighting files won't be loaded.
|
71 |
|
@@ -84,31 +85,16 @@ Find `[sourcecode language='css']code here[/sourcecode]` too long to type? Here'
|
|
84 |
* `[source language='css']code here[/source]`
|
85 |
* `[code language='css']code here[/code]`
|
86 |
|
87 |
-
|
88 |
* `[sourcecode lang='css']code here[/sourcecode]`
|
89 |
* `[source lang='css']code here[/source]`
|
90 |
* `[code lang='css']code here[/code]`
|
91 |
|
92 |
-
|
93 |
* `[sourcecode='css']code here[/sourcecode]`
|
94 |
* `[source='css']code here[/source]`
|
95 |
* `[code='css']code here[/code]`
|
96 |
|
97 |
== ChangeLog ==
|
98 |
|
99 |
-
**Version 1.1.1**
|
100 |
-
|
101 |
-
* Encode single quotes so `wptexturize()` doesn't transform them into fancy quotes and screw up code.
|
102 |
-
|
103 |
-
**Version 1.1.0**
|
104 |
-
|
105 |
-
* mdawaffe [fixed](http://dev.wp-plugins.org/ticket/703) an encoding issue relating to kses and users without the `unfiltered_html` capability. Mad props to mdawaffe.
|
106 |
-
|
107 |
-
**Version 1.0.1**
|
108 |
-
|
109 |
-
* Minor CSS fixes.
|
110 |
-
* Filter text widgets to allow posting of code.
|
111 |
-
|
112 |
**Version 1.0.0**
|
113 |
|
114 |
* Initial release!
|
1 |
=== SyntaxHighlighter ===
|
2 |
+
Contributors: matt, Viper007Bond
|
3 |
Tags: code, sourcecode, php, xhtml, html, css
|
4 |
Requires at least: 2.0
|
5 |
+
Tested up to: 2.3.0
|
6 |
Stable tag: trunk
|
7 |
|
8 |
Easily post source code such as PHP or HTML and display it in a styled box.
|
9 |
|
10 |
== Description ==
|
11 |
|
12 |
+
SyntaxHighlighter allows you to easily post code without loosing it's formatting or making any changes. It even provides syntax highlighting for certain languages.
|
13 |
|
14 |
+
Here's a list of supported languages as well as their aliases (for use in your post).
|
15 |
|
16 |
* C++ -- `cpp`, `c`, `c++`
|
17 |
* C# -- `c#`, `c-sharp`, `csharp`
|
44 |
- plugins
|
45 |
- syntaxhighlighter
|
46 |
| readme.txt
|
47 |
+
| screenshot-1.png
|
48 |
| syntaxhighlighter.php
|
49 |
- files
|
50 |
| clipboard.swf
|
51 |
| shBrushCpp.js
|
52 |
| shBrushCSharp.js
|
53 |
+
| [...]
|
54 |
+
| shCore.js
|
55 |
+
| SyntaxHighlighter.css`
|
56 |
|
57 |
**See Also:** ["Installing Plugins" article on the WP Codex](http://codex.wordpress.org/Managing_Plugins#Installing_Plugins)
|
58 |
|
66 |
|
67 |
== Frequently Asked Questions ==
|
68 |
|
69 |
+
= The BBCode in my post is being replaced with `<pre>` just fine, but I don't see the syntax highlighting! =
|
70 |
|
71 |
Make sure your theme's footer has `<?php wp_footer(); ?>` somewhere in it, otherwise the JavaScript highlighting files won't be loaded.
|
72 |
|
85 |
* `[source language='css']code here[/source]`
|
86 |
* `[code language='css']code here[/code]`
|
87 |
|
|
|
88 |
* `[sourcecode lang='css']code here[/sourcecode]`
|
89 |
* `[source lang='css']code here[/source]`
|
90 |
* `[code lang='css']code here[/code]`
|
91 |
|
|
|
92 |
* `[sourcecode='css']code here[/sourcecode]`
|
93 |
* `[source='css']code here[/source]`
|
94 |
* `[code='css']code here[/code]`
|
95 |
|
96 |
== ChangeLog ==
|
97 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
**Version 1.0.0**
|
99 |
|
100 |
* Initial release!
|
syntaxhighlighter.php
CHANGED
@@ -4,15 +4,15 @@
|
|
4 |
|
5 |
Plugin Name: SyntaxHighlighter
|
6 |
Plugin URI: http://wordpress.org/extend/plugins/syntaxhighlighter/
|
7 |
-
Version: 1.
|
8 |
Description: An advanced upload-and-activate WordPress implementation of Alex Gorbatchev's <a href="http://code.google.com/p/syntaxhighlighter/">SyntaxHighlighter</a> JavaScript code highlighting package. See WordPress.com's "<a href="http://faq.wordpress.com/2007/09/03/how-do-i-post-source-code/">How do I post source code?</a>" for details.
|
9 |
-
Author: <a href="http://photomatt.net/">Matt</a
|
10 |
|
11 |
**************************************************************************
|
12 |
|
13 |
Credits:
|
14 |
|
15 |
-
* Matt (
|
16 |
* Viper007Bond ( viper007bond.com ) -- current plugin version
|
17 |
|
18 |
Simply put, Matt deserves the majority of the credit for this plugin.
|
@@ -27,9 +27,6 @@ class AGSyntaxHighlighter {
|
|
27 |
var $languagesregex;
|
28 |
var $jsfiles2load = array();
|
29 |
var $pluginurl;
|
30 |
-
var $kses_active = array();
|
31 |
-
var $kses_filters = array();
|
32 |
-
var $widget_format_to_edit = false;
|
33 |
|
34 |
// WordPress hooks
|
35 |
function AGSyntaxHighlighter() {
|
@@ -39,62 +36,50 @@ class AGSyntaxHighlighter {
|
|
39 |
add_action( 'wp_footer', array(&$this, 'FileLoader'), 1000 );
|
40 |
add_action( 'admin_footer', array(&$this, 'FileLoader'), 1000 ); // For viewing comments in admin area
|
41 |
|
42 |
-
// Find and replace the BBCode
|
43 |
add_filter( 'the_content', array(&$this, 'BBCodeToHTML'), 8 );
|
44 |
-
add_filter( 'widget_text', array(&$this, 'BBCodeToHTML'), 8 );
|
45 |
|
46 |
-
//
|
47 |
-
add_filter( '
|
48 |
-
add_filter( 'content_save_pre', array(&$this, 'after_kses_normalization'), 11 );
|
49 |
-
add_action( 'admin_head', array(&$this, 'before_kses_normalization_widget'), 1 );
|
50 |
-
add_action( 'update_option_widget_text', array(&$this, 'after_kses_normalization_widget'), 1, 2 );
|
51 |
-
add_filter( 'format_to_edit', array(&$this, 'after_kses_normalization_widget_format_to_edit'), 1 );
|
52 |
|
53 |
// Account for TinyMCE
|
54 |
add_filter( 'content_save_pre', array(&$this, 'TinyMCEDecode'), 8 );
|
55 |
add_filter( 'the_editor_content', array(&$this, 'TinyMCEEncode'), 8 );
|
56 |
-
|
57 |
-
// Uncomment these next lines to allow commenters to post code
|
58 |
-
//add_filter( 'comment_text', array(&$this, 'BBCodeToHTML'), 8 );
|
59 |
-
//add_filter( 'pre_comment_content', array(&$this, 'before_kses_normalization_comment'), 1 );
|
60 |
-
//add_filter( 'pre_comment_content', array(&$this, 'after_kses_normalization_comment'), 11 );
|
61 |
}
|
62 |
|
63 |
|
64 |
// Set some variables now that we've given all other plugins a chance to load
|
65 |
function SetVariables() {
|
66 |
$this->pluginurl = apply_filters( 'agsyntaxhighlighter_url', get_bloginfo( 'wpurl' ) . '/wp-content/plugins/syntaxhighlighter/files/' );
|
67 |
-
|
68 |
-
$this->pluginurl = apply_filters( 'agsyntaxhighlighter_url', WP_CONTENT_URL . '/plugins/syntaxhighlighter/files/' );
|
69 |
// Define all allowed languages and allow plugins to modify this
|
70 |
$this->languages = apply_filters( 'agsyntaxhighlighter_languages', array(
|
71 |
-
'cpp'
|
72 |
-
'c'
|
73 |
-
'c++'
|
74 |
-
'c#'
|
75 |
-
'c-sharp'
|
76 |
-
'csharp'
|
77 |
-
'css'
|
78 |
-
'delphi'
|
79 |
-
'pascal'
|
80 |
-
'java'
|
81 |
-
'js'
|
82 |
-
'jscript'
|
83 |
'javascript' => 'shBrushJScript.js',
|
84 |
-
'php'
|
85 |
-
'py'
|
86 |
-
'python'
|
87 |
-
'rb'
|
88 |
-
'ruby'
|
89 |
-
'rails'
|
90 |
-
'ror'
|
91 |
-
'sql'
|
92 |
-
'vb'
|
93 |
-
'vb.net'
|
94 |
-
'xml'
|
95 |
-
'html'
|
96 |
-
'xhtml'
|
97 |
-
'xslt'
|
98 |
) );
|
99 |
|
100 |
// Quote them to make them regex safe
|
@@ -103,12 +88,6 @@ class AGSyntaxHighlighter {
|
|
103 |
|
104 |
// Generate the regex for them
|
105 |
$this->languagesregex = '(' . implode( '|', $languages ) . ')';
|
106 |
-
|
107 |
-
$this->kses_filters = apply_filters( 'agsyntaxhighlighter_kses_filters', array(
|
108 |
-
'wp_filter_kses',
|
109 |
-
'wp_filter_post_kses',
|
110 |
-
'wp_filter_nohtml_kses'
|
111 |
-
) );
|
112 |
}
|
113 |
|
114 |
|
@@ -144,105 +123,6 @@ class AGSyntaxHighlighter {
|
|
144 |
}
|
145 |
|
146 |
|
147 |
-
/* If KSES is going to hit this text, we double encode stuff within the [sourcecode] tags to keep
|
148 |
-
* wp_kses_normalize_entities from breaking them.
|
149 |
-
* $content = text to parse
|
150 |
-
* $which_filter = which filter to check to see if kses will be applied
|
151 |
-
* $addslashes = used by AGSyntaxHighlighter::GetBBCode
|
152 |
-
*/
|
153 |
-
function before_kses_normalization( $content, $which_filter = 'content_save_pre', $addslashes = true ) {
|
154 |
-
global $wp_filter;
|
155 |
-
if ( is_string($which_filter) && !isset($this->kses_active[$which_filter]) ) {
|
156 |
-
$this->kses_active[$which_filter] = false;
|
157 |
-
$filters = $wp_filter[$which_filter];
|
158 |
-
foreach ( (array) $filters as $priority => $filter ) {
|
159 |
-
foreach ( $filter as $k => $v ) {
|
160 |
-
if ( in_array( $filter[$k]['function'], $this->kses_filters ) ) {
|
161 |
-
$this->kses_active[$which_filter] = true;
|
162 |
-
break 2;
|
163 |
-
}
|
164 |
-
}
|
165 |
-
}
|
166 |
-
}
|
167 |
-
|
168 |
-
if ( ( true === $which_filter || $this->kses_active[$which_filter] ) && $this->CheckForBBCode( $content ) ) {
|
169 |
-
$matches = $this->GetBBCode( $content, $addslashes );
|
170 |
-
foreach( (array) $matches as $match )
|
171 |
-
$content = str_replace( $match[5], htmlspecialchars( $match[5], ENT_QUOTES ), $content );
|
172 |
-
}
|
173 |
-
return $content;
|
174 |
-
}
|
175 |
-
|
176 |
-
|
177 |
-
/* We undouble encode the stuff within [sourcecode] tags to fix the output of
|
178 |
-
* AGSyntaxHighlighter::before_kses_normalization.
|
179 |
-
*/
|
180 |
-
function after_kses_normalization( $content, $which_filter = 'content_save_pre', $addslashes = true ) {
|
181 |
-
if ( ( true === $which_filter || $this->kses_active[$which_filter] ) && $this->CheckForBBCode( $content ) ) {
|
182 |
-
$matches = $this->GetBBCode( $content, $addslashes );
|
183 |
-
foreach( (array) $matches as $match )
|
184 |
-
$content = str_replace( $match[5], htmlspecialchars_decode( $match[5], ENT_QUOTES ), $content );
|
185 |
-
}
|
186 |
-
return $content;
|
187 |
-
}
|
188 |
-
|
189 |
-
|
190 |
-
// Wrapper for comment text
|
191 |
-
function before_kses_normalization_comment( $content ) {
|
192 |
-
return $this->before_kses_normalization( $content, 'pre_comment_content' );
|
193 |
-
}
|
194 |
-
|
195 |
-
|
196 |
-
function after_kses_normalization_comment( $content ) {
|
197 |
-
return $this->after_kses_normalization( $content, 'pre_comment_content' );
|
198 |
-
}
|
199 |
-
|
200 |
-
|
201 |
-
/* "Wrapper" for widget text. Since we lack the necessary filters, we directly alter the
|
202 |
-
* submitted $_POST variables before the widgets are updated.
|
203 |
-
*/
|
204 |
-
function before_kses_normalization_widget() {
|
205 |
-
global $pagenow;
|
206 |
-
if ( 'widgets.php' != $pagenow || current_user_can( 'unfiltered_html' ) )
|
207 |
-
return;
|
208 |
-
|
209 |
-
$i = 1;
|
210 |
-
while ( isset($_POST["text-submit-$i"]) ) {
|
211 |
-
$_POST["text-text-$i"] = $this->before_kses_normalization( $_POST["text-text-$i"], true );
|
212 |
-
$i++;
|
213 |
-
}
|
214 |
-
}
|
215 |
-
|
216 |
-
// Again, since we lack the needed filters, we have to check the freshly updated option and re-update it.
|
217 |
-
function after_kses_normalization_widget( $old, $new ) {
|
218 |
-
static $do_update = true;
|
219 |
-
|
220 |
-
if ( !$do_update || current_user_can( 'unfiltered_html' ) )
|
221 |
-
return;
|
222 |
-
|
223 |
-
foreach ( array_keys($new) as $i => $widget )
|
224 |
-
$new[$i]['text'] = $this->after_kses_normalization( $new[$i]['text'], true, false );
|
225 |
-
|
226 |
-
$do_update = false;
|
227 |
-
|
228 |
-
update_option( 'widget_text', $new );
|
229 |
-
$this->widget_format_to_edit = true;
|
230 |
-
|
231 |
-
$do_update = true;
|
232 |
-
}
|
233 |
-
|
234 |
-
// Totally lame. The output of the widget form in the admin screen is cached from before our re-update.
|
235 |
-
function after_kses_normalization_widget_format_to_edit( $content ) {
|
236 |
-
if ( !$this->widget_format_to_edit )
|
237 |
-
return $content;
|
238 |
-
|
239 |
-
$content = $this->after_kses_normalization( $content, true, false );
|
240 |
-
|
241 |
-
$this->widget_format_to_edit = false;
|
242 |
-
|
243 |
-
return $content;
|
244 |
-
}
|
245 |
-
|
246 |
// Reverse changes TinyMCE made to the entered code
|
247 |
function TinyMCEDecode( $content ) {
|
248 |
if ( !user_can_richedit() || !$this->CheckForBBCode( $content ) ) return $content;
|
@@ -294,7 +174,7 @@ class AGSyntaxHighlighter {
|
|
294 |
// Loop through each match and replace the BBCode with HTML
|
295 |
foreach ( (array) $matches as $match ) {
|
296 |
$language = strtolower( $match[4] );
|
297 |
-
$content = str_replace( $match[0], '<pre name="code" class="' . $language . "\">\n" . htmlspecialchars( $match[5]
|
298 |
$this->jsfiles2load[$this->languages[$language]] = TRUE;
|
299 |
}
|
300 |
|
@@ -329,5 +209,4 @@ if ( !function_exists( 'htmlspecialchars_decode' ) ) {
|
|
329 |
return strtr( $string, array_flip( get_html_translation_table( HTML_SPECIALCHARS, $quote_style) ) );
|
330 |
}
|
331 |
}
|
332 |
-
|
333 |
-
?>
|
4 |
|
5 |
Plugin Name: SyntaxHighlighter
|
6 |
Plugin URI: http://wordpress.org/extend/plugins/syntaxhighlighter/
|
7 |
+
Version: 1.0.0
|
8 |
Description: An advanced upload-and-activate WordPress implementation of Alex Gorbatchev's <a href="http://code.google.com/p/syntaxhighlighter/">SyntaxHighlighter</a> JavaScript code highlighting package. See WordPress.com's "<a href="http://faq.wordpress.com/2007/09/03/how-do-i-post-source-code/">How do I post source code?</a>" for details.
|
9 |
+
Author: <a href="http://photomatt.net/">Matt</a> & <a href="http://www.viper007bond.com/">Viper007Bond</a>
|
10 |
|
11 |
**************************************************************************
|
12 |
|
13 |
Credits:
|
14 |
|
15 |
+
* Matt ( photomatt.net ) -- original concept and code on WP.com
|
16 |
* Viper007Bond ( viper007bond.com ) -- current plugin version
|
17 |
|
18 |
Simply put, Matt deserves the majority of the credit for this plugin.
|
27 |
var $languagesregex;
|
28 |
var $jsfiles2load = array();
|
29 |
var $pluginurl;
|
|
|
|
|
|
|
30 |
|
31 |
// WordPress hooks
|
32 |
function AGSyntaxHighlighter() {
|
36 |
add_action( 'wp_footer', array(&$this, 'FileLoader'), 1000 );
|
37 |
add_action( 'admin_footer', array(&$this, 'FileLoader'), 1000 ); // For viewing comments in admin area
|
38 |
|
|
|
39 |
add_filter( 'the_content', array(&$this, 'BBCodeToHTML'), 8 );
|
|
|
40 |
|
41 |
+
// Comment out or delete this next line to stop commenters from being able to post code
|
42 |
+
add_filter( 'comment_text', array(&$this, 'BBCodeToHTML'), 8 );
|
|
|
|
|
|
|
|
|
43 |
|
44 |
// Account for TinyMCE
|
45 |
add_filter( 'content_save_pre', array(&$this, 'TinyMCEDecode'), 8 );
|
46 |
add_filter( 'the_editor_content', array(&$this, 'TinyMCEEncode'), 8 );
|
|
|
|
|
|
|
|
|
|
|
47 |
}
|
48 |
|
49 |
|
50 |
// Set some variables now that we've given all other plugins a chance to load
|
51 |
function SetVariables() {
|
52 |
$this->pluginurl = apply_filters( 'agsyntaxhighlighter_url', get_bloginfo( 'wpurl' ) . '/wp-content/plugins/syntaxhighlighter/files/' );
|
53 |
+
|
|
|
54 |
// Define all allowed languages and allow plugins to modify this
|
55 |
$this->languages = apply_filters( 'agsyntaxhighlighter_languages', array(
|
56 |
+
'cpp' => 'shBrushCpp.js',
|
57 |
+
'c' => 'shBrushCpp.js',
|
58 |
+
'c++' => 'shBrushCpp.js',
|
59 |
+
'c#' => 'shBrushCSharp.js',
|
60 |
+
'c-sharp' => 'shBrushCSharp.js',
|
61 |
+
'csharp' => 'shBrushCSharp.js',
|
62 |
+
'css' => 'shBrushCss.js',
|
63 |
+
'delphi' => 'shBrushDelphi.js',
|
64 |
+
'pascal' => 'shBrushDelphi.js',
|
65 |
+
'java' => 'shBrushJava.js',
|
66 |
+
'js' => 'shBrushJScript.js',
|
67 |
+
'jscript' => 'shBrushJScript.js',
|
68 |
'javascript' => 'shBrushJScript.js',
|
69 |
+
'php' => 'shBrushPhp.js',
|
70 |
+
'py' => 'shBrushPython.js',
|
71 |
+
'python' => 'shBrushPython.js',
|
72 |
+
'rb' => 'shBrushRuby.js',
|
73 |
+
'ruby' => 'shBrushRuby.js',
|
74 |
+
'rails' => 'shBrushRuby.js',
|
75 |
+
'ror' => 'shBrushRuby.js',
|
76 |
+
'sql' => 'shBrushSql.js',
|
77 |
+
'vb' => 'shBrushVb.js',
|
78 |
+
'vb.net' => 'shBrushVb.js',
|
79 |
+
'xml' => 'shBrushXml.js',
|
80 |
+
'html' => 'shBrushXml.js',
|
81 |
+
'xhtml' => 'shBrushXml.js',
|
82 |
+
'xslt' => 'shBrushXml.js',
|
83 |
) );
|
84 |
|
85 |
// Quote them to make them regex safe
|
88 |
|
89 |
// Generate the regex for them
|
90 |
$this->languagesregex = '(' . implode( '|', $languages ) . ')';
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
}
|
92 |
|
93 |
|
123 |
}
|
124 |
|
125 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
// Reverse changes TinyMCE made to the entered code
|
127 |
function TinyMCEDecode( $content ) {
|
128 |
if ( !user_can_richedit() || !$this->CheckForBBCode( $content ) ) return $content;
|
174 |
// Loop through each match and replace the BBCode with HTML
|
175 |
foreach ( (array) $matches as $match ) {
|
176 |
$language = strtolower( $match[4] );
|
177 |
+
$content = str_replace( $match[0], '<pre name="code" class="' . $language . "\">\n" . htmlspecialchars( $match[5] ) . "\n</pre>", $content );
|
178 |
$this->jsfiles2load[$this->languages[$language]] = TRUE;
|
179 |
}
|
180 |
|
209 |
return strtr( $string, array_flip( get_html_translation_table( HTML_SPECIALCHARS, $quote_style) ) );
|
210 |
}
|
211 |
}
|
212 |
+
?>
|
|