summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDerek Jones <derek.jones@ellislab.com>2008-10-03 21:09:53 +0200
committerDerek Jones <derek.jones@ellislab.com>2008-10-03 21:09:53 +0200
commit337c74ab2af0dec69659f8c68c82b12c878c1b88 (patch)
treed3b0326d44935ec312bd6dc3630a206a6721a201
parentc0e72b0609827484dc822ded7fcd0a312ed4eb98 (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.php7
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">&lt;?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">&lt;?php&nbsp;', '<span style="color: #0000BB">', $str);
- $str = preg_replace('/(<span style="color: #0000BB">.*?)\?&gt;<\/span>\n<\/span>\n<\/code>/is', "$1</span>\n</span>\n</code>", $str);
+ $str = preg_replace('/<span style="color: #([A-Z0-9]+)">&lt;\?php(&nbsp;| )/i', '<span style="color: #$1">', $str);
+ $str = preg_replace('/(<span style="color: #[A-Z0-9]+">.*?)\?&gt;<\/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.