Revision 661
Added by thorn almost 18 years ago
| frontend.functions.php | ||
|---|---|---|
| 82 | 82 |
|
| 83 | 83 |
// the highlighting |
| 84 | 84 |
// match $string, but not inside <style>...</style>, <script>...</script>, <!--...--> or HTML-Tags |
| 85 |
// split $string into pieces - "cut away" styles, scripts, comments, and HTML-tags
|
|
| 86 |
$matches = preg_split("/(<style.*<\/style>|<script.*<\/script>|<!--.*-->|<.*>)/iUs",$foo,-1,(PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY));
|
|
| 85 |
// split $string into pieces - "cut away" styles, scripts, comments, HTML-tags and eMail-addresses
|
|
| 86 |
$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 | 87 |
if(is_array($matches) && $matches != array()) {
|
| 88 | 88 |
$foo = ""; |
| 89 | 89 |
$string = strtr($string, array('<'=>'<', '>'=>'>', '&'=>'&', '"'=>'"', '''=>'\'', ' '=>"\xC2\xA0"));
|
| 90 | 90 |
foreach($matches as $match) {
|
| 91 |
if($match{0}!="<") {
|
|
| 91 |
if($match{0}!="<" && !preg_match('/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i', $match)) {
|
|
| 92 | 92 |
$match = strtr($match, array('<'=>'<', '>'=>'>', '&'=>'&', '"'=>'"', '''=>'\'', ' '=>"\xC2\xA0"));
|
| 93 | 93 |
$match = preg_replace('/('.$string.')/iS', '_span class=_highlight__$1_/span_',$match);
|
| 94 | 94 |
$match = strtr($match, array('<'=>'<', '>'=>'>', '&'=>'&', '"'=>'"', '\''=>''', "\xC2\xA0"=>' '));
|
Also available in: Unified diff
search will show email-addresses, even if email-filter is activated (on page with highlighting). Fixed.