Revision 740
Added by thorn almost 17 years ago
frontend.functions.php | ||
---|---|---|
84 | 84 |
// the highlighting |
85 | 85 |
// match $string, but not inside <style>...</style>, <script>...</script>, <!--...--> or HTML-Tags |
86 | 86 |
// split $string into pieces - "cut away" styles, scripts, comments, HTML-tags and eMail-addresses |
87 |
$matches = preg_split("/(<style.*<\/style>|<script.*<\/script>|<!--.*-->|<.*>|\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b)/iUs",$foo,-1,(PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY)); |
|
87 |
// for HTML-Tags use <(?:[^<]|<.*>)*> which will match strings like <input ... value="<b>value</b>" > |
|
88 |
$matches = preg_split("/(<style.*<\/style>|<script.*<\/script>|<!--.*-->|<(?:[^<]|<.*>)*>|\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b)/iUs",$foo,-1,(PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY)); |
|
88 | 89 |
if(is_array($matches) && $matches != array()) { |
89 | 90 |
$foo = ""; |
90 | 91 |
$string = strtr($string, array('<'=>'<', '>'=>'>', '&'=>'&', '"'=>'"', '''=>'\'', ' '=>"\xC2\xA0")); |
Also available in: Unified diff
fixed an issue with highlighting