diff options
author | Andrey Andreev <narf@bofh.bg> | 2012-03-10 14:44:57 +0100 |
---|---|---|
committer | Andrey Andreev <narf@bofh.bg> | 2012-03-10 14:44:57 +0100 |
commit | c857bc23d35840a9c3b13ce752ae832385639f73 (patch) | |
tree | a864a7600d37ca110c3e44c06cc1b55170ad272c /system/helpers/text_helper.php | |
parent | 172331d40c991741c76fcf70f4262c2db821c6f8 (diff) | |
parent | 52a31ba3acc5f5be16692ac25c70780775e548e0 (diff) |
Merge branch 'develop' of github.com:EllisLab/CodeIgniter into develop-dh-date-range
Diffstat (limited to 'system/helpers/text_helper.php')
-rw-r--r-- | system/helpers/text_helper.php | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/system/helpers/text_helper.php b/system/helpers/text_helper.php index 842a31d75..7591bac5f 100644 --- a/system/helpers/text_helper.php +++ b/system/helpers/text_helper.php @@ -2,7 +2,7 @@ /** * CodeIgniter * - * An open source application development framework for PHP 5.1.6 or newer + * An open source application development framework for PHP 5.2.4 or newer * * NOTICE OF LICENSE * @@ -300,9 +300,9 @@ if ( ! function_exists('highlight_code')) // Replace any existing PHP tags to temporary markers so they don't accidentally // break the string out of PHP, and thus, thwart the highlighting. - $str = str_replace(array('<?', '?>', '<%', '%>', '\\', '</script>'), - array('phptagopen', 'phptagclose', 'asptagopen', 'asptagclose', 'backslashtmp', 'scriptclose'), $str); + array('phptagopen', 'phptagclose', 'asptagopen', 'asptagclose', 'backslashtmp', 'scriptclose'), + $str); // The highlight_string function requires that the text be surrounded // by PHP tags, which we will remove later @@ -311,25 +311,15 @@ if ( ! function_exists('highlight_code')) // All the magic happens here, baby! $str = highlight_string($str, TRUE); - // Prior to PHP 5, the highligh function used icky <font> tags - // so we'll replace them with <span> tags. - - if (abs(PHP_VERSION) < 5) - { - $str = str_replace(array('<font ', '</font>'), array('<span ', '</span>'), $str); - $str = preg_replace('#color="(.*?)"#', 'style="color: \\1"', $str); - } - // Remove our artificially added PHP, and the syntax highlighting that came with it $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. - $str = str_replace(array('phptagopen', 'phptagclose', 'asptagopen', 'asptagclose', 'backslashtmp', 'scriptclose'), - array('<?', '?>', '<%', '%>', '\\', '</script>'), $str); - - return $str; + return str_replace(array('phptagopen', 'phptagclose', 'asptagopen', 'asptagclose', 'backslashtmp', 'scriptclose'), + array('<?', '?>', '<%', '%>', '\\', '</script>'), + $str); } } @@ -544,4 +534,4 @@ if ( ! function_exists('ellipsize')) } /* End of file text_helper.php */ -/* Location: ./system/helpers/text_helper.php */
\ No newline at end of file +/* Location: ./system/helpers/text_helper.php */ |