diff options
author | Derek Jones <derek.jones@ellislab.com> | 2008-10-03 21:09:53 +0200 |
---|---|---|
committer | Derek Jones <derek.jones@ellislab.com> | 2008-10-03 21:09:53 +0200 |
commit | 337c74ab2af0dec69659f8c68c82b12c878c1b88 (patch) | |
tree | d3b0326d44935ec312bd6dc3630a206a6721a201 | |
parent | c0e72b0609827484dc822ded7fcd0a312ed4eb98 (diff) |
tweak of temp tag and highlighting replacement to accommodate environments with different colors specified for highlight_string()
-rw-r--r-- | system/helpers/text_helper.php | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/system/helpers/text_helper.php b/system/helpers/text_helper.php index 54ef1b580..9f13896ae 100644 --- a/system/helpers/text_helper.php +++ b/system/helpers/text_helper.php @@ -287,12 +287,11 @@ if ( ! function_exists('highlight_code')) {
$str = str_replace(array('<font ', '</font>'), array('<span ', '</span>'), $str);
$str = preg_replace('#color="(.*?)"#', 'style="color: \\1"', $str);
- $str = str_replace('<span style="color: #0000BB"><?php ', '<span style="color: #0000BB">', $str);
}
-
+
// Remove our artificially added PHP, and the syntax highlighting that came with it
- $str = str_replace('<span style="color: #0000BB"><?php ', '<span style="color: #0000BB">', $str);
- $str = preg_replace('/(<span style="color: #0000BB">.*?)\?><\/span>\n<\/span>\n<\/code>/is', "$1</span>\n</span>\n</code>", $str);
+ $str = preg_replace('/<span style="color: #([A-Z0-9]+)"><\?php( | )/i', '<span style="color: #$1">', $str);
+ $str = preg_replace('/(<span style="color: #[A-Z0-9]+">.*?)\?><\/span>\n<\/span>\n<\/code>/is', "$1</span>\n</span>\n</code>", $str);
$str = preg_replace('/<span style="color: #[A-Z0-9]+"\><\/span>/i', '', $str);
// Replace our markers back to PHP tags.
|