--- inc/global.php 2001/10/10 12:40:58 1.17 +++ inc/global.php 2001/10/12 09:22:02 1.18 @@ -55,10 +55,12 @@ $str = preg_replace('/(^[ ]+|[ ]+$)/m', '', $str); $str = preg_replace('/(\<\/?\s*(\w+)\\b[^\>]*\>)/e', 'array_search(MyUpper("\2"),'. '\$allowed,false)?"\1":HTMLSpecialChars("\1")', $str); - $str = preg_replace('/(\<\s*A\b)/i', '\\1 target=_blank class=more', $str); - $str = preg_replace('/(target=_blank class=[^ ]+)( target=_blank class=[^ ]+)+/', '\\1', $str); - $str = preg_replace('/(\<\s*TABLE\b)/i', '\\1 class=normal', $str); - $str = preg_replace('/(class=[^ ]+)( class=[^ ]+)+/', '\\1', $str); + if (!$full) { + $str = preg_replace('/(\<\s*TABLE\b)/i', '\\1 class=normal', $str); + $str = preg_replace('/(\<\s*A\b)/i', '\\1 class=underlined target=_blank', $str); + $str = preg_replace('/(class=[^ ]+)( class=[^ ]+)+/', '\\1', $str); + $str = preg_replace('/(class=[^ ]+ target=_blank)( class=[^ ]+ target=_blank)+/', '\\1', $str); + } $str = my_replace($str, ""); $str = my_replace($str, "", true); $str = my_replace($str, ""); @@ -152,4 +154,23 @@ return $str; } + function LinkIt($str) { + $allowed = "ABCÈèÆæDÐðEFGHIJKLMNOPQRS©¹TUVWXYZ®¾0123456789-_."; + $idx = 0; + while (true) { + $idx = strpos($str, "@", $idx); + if ($idx === false) break; + $idx1 = $idx - 1; + $idx2 = $idx + 1; + while ($idx1 > 0 && stristr($allowed, $str[$idx1 - 1])) $idx1--; + while ($idx2 < strlen($str) - 1 && stristr($allowed, $str[$idx2])) $idx2++; + $str1 = substr($str, 0, $idx1); + $str2 = substr($str, $idx1, $idx2 - $idx1); + $str3 = substr($str, $idx2, strlen($idx2)); + $str4 = ''.$str2.''; + $str = $str1.$str4.$str3; + $idx = $idx1 + strlen($str4); + } + return $str; + } ?>