diff --git a/phpgwapi/inc/class.html.inc.php b/phpgwapi/inc/class.html.inc.php index fe8218f854..c8c222b7ab 100644 --- a/phpgwapi/inc/class.html.inc.php +++ b/phpgwapi/inc/class.html.inc.php @@ -199,30 +199,47 @@ class html // spamsaver emailaddress $result = preg_replace('/'.$NotAnchor.'mailto:([a-z0-9._-]+)@([a-z0-9_-]+)\.([a-z0-9._-]+)/i', - '\\1 AT \\2 DOT \\3', +// '\\1 AT \\2 DOT \\3', + "$1 AT $2 DOT $3", $content); // First match things beginning with http:// (or other protocols) + $optBracket0 = '(<|<)'; $Protocol = '(http:\/\/|(ftp:\/\/|https:\/\/))'; // only http:// gets removed, other protocolls are shown $Domain = '([\w-]+\.[\w-.]+)'; $Subdir = '([\w\-\.,@?^=%&;:\/~\+#]*[\w\-\@?^=%&\/~\+#])?'; $optBracket = ''; - //$optBracket = '(>|>)'; - $Expr = '/' . $NotAnchor . $Protocol . $Domain . $Subdir . $optBracket . '/i'; + $optBracket = '(>|>)'; + $Expr = '/' .$optBracket0. $NotAnchor . $Protocol . $Domain . $Subdir . $optBracket . '/i'; - $result2 = preg_replace( $Expr, "$2$3$4", $result ); + $result2 = preg_replace( $Expr, "$1$4$5$6", $result ); //$result = preg_replace( $Expr, "$2$3$4$5 ", $result ); +//error_log(__METHOD__.__LINE__.array2string($Expr)); +//error_log(__METHOD__.__LINE__.array2string($result2)); + // First match things beginning with http:// (or other protocols) + $Protocol = '(http:\/\/|(ftp:\/\/|https:\/\/))'; // only http:// gets removed, other protocolls are shown + $Domain = '([\w-]+\.[\w-.]+)'; + $Subdir = '([\w\-\.,@?^=%&;:\/~\+#]*[\w\-\@?^=%&\/~\+#])?'; + $Expr = '/' . $NotAnchor . $Protocol . $Domain . $Subdir . '/i'; + $result3 = preg_replace( $Expr, "$3$4", $result2 ); + //$result = preg_replace( $Expr, "$2$3$4$5 ", $result ); +//error_log(__METHOD__.__LINE__.array2string($Expr)); +//error_log(__METHOD__.__LINE__.array2string($result3)); // Now match things beginning with www. + $optBracket0 = '(<|<)?'; $NotHTTP = '(?)'; // avoid running again on http://www links already handled above $Domain2 = 'www(\.[\w-.]+)'; $Subdir2 = '([\w\-\.,@?^=%&:\/~\+#]*[\w\-\@?^=%&\/~\+#])?'; - $Expr = '/' . $NotAnchor . $NotHTTP . $Domain2 . $Subdir2 . '/i'; - //$optBracket = '(>|>)'; + $optBracket = '(>|>)?'; + $Expr = '/' .$optBracket0. $NotAnchor . $NotHTTP . $Domain2 . $Subdir2 .$optBracket. '/i'; //$Expr = '/' . $NotAnchor . $NotHTTP . $Domain . $Subdir . $optBracket . '/i'; - return preg_replace( $Expr, "$0", $result2 ); + $result4 = preg_replace( $Expr, "$1www$2$3$4$5$6", $result3 ); //return preg_replace( $Expr, "www$1$2$3 ", $result ); +//error_log(__METHOD__.__LINE__.array2string($Expr)); +//error_log(__METHOD__.__LINE__.array2string($result4)); + return $result4; } /**