Changeset 1513
- Timestamp:
- 07/01/06 11:08:52 (2 years ago)
- Files:
-
- 1 modified
-
trunk/gregarius/plugins/urlfilter.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/gregarius/plugins/urlfilter.php
r1181 r1513 31 31 /// Author: Marco Bonetti 32 32 /// Description: This plugin will try to make ugly URL links look better 33 /// Version: 1. 633 /// Version: 1.7 34 34 35 35 /** … … 38 38 */ 39 39 function __urlfilter_filter($in) { 40 $match = '|<a[^>]+?href="(.*?)">\\1</a>|i'; 41 return preg_replace_callback($match, '__filter_callback', $in); 40 $match = '#<a[^>]+?href="(.*?)">\\1</a>#im'; 41 // matches non-linkified URLs 42 $match2 = '#[^>"\'](http[^\s$]+)[\s$]?#im'; 43 $ret= preg_replace_callback($match, '__filter_callback', $in); 44 $ret2= preg_replace_callback($match2,'__filter_callback', $ret); 45 return $ret2; 42 46 } 43 47 … … 49 53 $ret = preg_match("/^(http:\/\/)?([^\/]+)/i", $matches[1], $outmatches); 50 54 if ($outmatches && isset ($outmatches[2])) { 51 return " <a href=\"". $matches[1]."\">[" . $outmatches[2] . "]</a>";55 return " <a href=\"". $matches[1]."\">[" . $outmatches[2] . "]</a> "; 52 56 } 53 return " <a href=\"". $matches[1]."\">[" . $matches[1] . "]</a>";57 return " <a href=\"". $matches[1]."\">[" . $matches[1] . "]</a> "; 54 58 } 55 59
