Revision 680
Added by doc over 16 years ago
filter-routines.php | ||
---|---|---|
89 | 89 |
define('OUTPUT_FILTER_DOT_REPLACEMENT', $filter_settings['dot_replacement']); |
90 | 90 |
|
91 | 91 |
// first search part to find all mailto email addresses |
92 |
$pattern = '#(<a.*?href\s*?=\s*?"\s*?mailto\s*?:\s*?)([A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,4})([^"]*?)"([^>]*>)(.*?)</a>';
|
|
92 |
$pattern = '#\b(<a.*?href\s*?=\s*?"\s*?mailto\s*?:\s*?)([A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,4})([^"]*?)"([^>]*>)(.*?)</a>\b';
|
|
93 | 93 |
// second part to find all non mailto email addresses |
94 | 94 |
$pattern .= '|\b([A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,4})\b#i'; |
95 | 95 |
/* |
96 |
Sub 1:(<a.*?href\s*?=\s*?"\s*?mailto\s*?:\s*?) --> "<a id="yyy" class="xxx" href = " mailto :" ignoring white spaces
|
|
96 |
Sub 1:\b(<a.*?href\s*?=\s*?"\s*?mailto\s*?:\s*?) --> "<a id="yyy" class="xxx" href = " mailto :" ignoring white spaces
|
|
97 | 97 |
Sub 2:([A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,4}) --> the email address in the mailto: part of the mail link |
98 | 98 |
Sub 3:([^"]*?)" --> possible ?Subject&cc... stuff attached to the mail address |
99 | 99 |
Sub 4:([^>]*>) --> all class or id statements after the mailto but before closing ..> |
100 |
Sub 5:(.*?)</a> --> the mailto text; all characters between >xxxxx</a>
|
|
100 |
Sub 5:(.*?)</a>\b --> the mailto text; all characters between >xxxxx</a>
|
|
101 | 101 |
Sub 6:|\b([A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,4})\b --> email addresses which may appear in the text (require word boundaries) |
102 | 102 |
*/ |
103 | 103 |
|
Also available in: Unified diff
module output_filter: added word boundary for the mailto regex part to avoid problems with text mails and mailto mails in one single line