- Timestamp:
- 12/13/11 13:05:27 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/expressoMail1_2/inc/class.imap_functions.inc.php
r5243 r5247 1927 1927 function replace_links_callback($matches) 1928 1928 { 1929 1930 1931 1932 1933 1934 return '<a href="'.$pref.'://'.$matches[4].$matches[5].'" target="_blank">'.$matches[ 4].$matches[5].'</a>';1929 if($matches[3]) 1930 $pref = $matches[3]; 1931 else 1932 $pref = $matches[3] = 'http'; 1933 1934 return '<a href="'.$pref.'://'.$matches[4].$matches[5].'" target="_blank">'.$matches[0].'</a>'; 1935 1935 } 1936 1936 … … 1942 1942 */ 1943 1943 function replace_links(&$body) 1944 1944 { 1945 1945 // Trata urls do tipo aaaa.bbb.empresa 1946 1946 // Usadas na intranet. 1947 $pattern = '/(?<=[\s|(<br>)|\n|\r|;])(((http|https|ftp|ftps)?:\/\/((?:[\w]\.?)+(?::[\d]+)?[:\/.\-~&=?%;@#,+\w]*))|((?:www?\.)(?:\w\.?)*(?::\d+)?[\:\/\w.\-~&=?%;@+]*))/i'; 1948 $replacement = '<a href="://$4$5" target="_blank">$4$5</a>'; 1949 $body = preg_replace_callback($pattern,array( &$this, 'replace_links_callback'), $body); 1947 $pattern = '/(?<=[\s|(<br>)|\n|\r|;])(((http|https|ftp|ftps)?:\/\/((?:[\w]\.?)+(?::[\d]+)?[:\/.\-~&=?%;@#,+\w]*))|((?:www?\.)(?:\w\.?)*(?::\d+)?[\:\/\w.\-~&=?%;@+]*))/i'; 1948 $body = preg_replace_callback($pattern,array( &$this, 'replace_links_callback'), $body); 1950 1949 1951 1950 }
Note: See TracChangeset
for help on using the changeset viewer.