mirror of https://github.com/BOINC/boinc.git
Drupal: Modified bbcode module to change email addresses.
Added variable to rewrite email addresses. Addresses will appear as username-[at]-domain.tld. This option overrides the 'convert to link' and 'encode email address' options. https://dev.gridrepublic.org/browse/DBOINCP-487
This commit is contained in:
parent
b794796ecd
commit
2858e3f98d
|
@ -269,6 +269,11 @@ function _bbcode_filter_process(&$body, $format = -1) {
|
|||
$body);
|
||||
}
|
||||
|
||||
// Re-write email addresses
|
||||
if (variable_get("bbcode_rewrite_email_$format", 1)) {
|
||||
$body = preg_replace('#((?<=^|[\t\r\n >\(\[\]\|]))([a-z0-9\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i', '\\1\\2-[at]-\\3', $body);
|
||||
}
|
||||
|
||||
// Turns web and e-mail addresses into clickable links
|
||||
if (variable_get("bbcode_make_links_$format", 1)) {
|
||||
|
||||
|
@ -290,10 +295,11 @@ function _bbcode_filter_process(&$body, $format = -1) {
|
|||
|
||||
// matches an email@domain type address at the start of a line, or after a space.
|
||||
// Note: Only the followed chars are valid; alphanums, "-", "_" and or ".".
|
||||
if (variable_get("bbcode_encode_mailto_$format", 1))
|
||||
$ret = preg_replace_callback("#([\t\r\n ])([a-z0-9\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i", '_bbcode_encode_mailto', $ret);
|
||||
else
|
||||
$ret = preg_replace('#([\t\r\n ])([a-z0-9\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i', '\\1<a href="mailto:\\2@\\3">\\2@\\3</a>', $ret);
|
||||
if (variable_get("bbcode_encode_mailto_$format", 1)) {
|
||||
$ret = preg_replace_callback("#((?<=^|[\t\r\n >\(\[\]\|]))([a-z0-9\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i", '_bbcode_encode_mailto', $ret);
|
||||
} else {
|
||||
$ret = preg_replace('#((?<=^|[\t\r\n >\(\[\]\|]))([a-z0-9\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i', '\\1<a href="mailto:\\2@\\3">\\2@\\3</a>', $ret);
|
||||
}
|
||||
|
||||
// Remove our padding
|
||||
$ret = str_replace("\x07", '', $ret);
|
||||
|
|
|
@ -79,6 +79,13 @@ function bbcode_filter($op, $delta = 0, $format = -1, $text = '') {
|
|||
'#default_value' => variable_get("bbcode_encode_mailto_$format", 1),
|
||||
'#options' => array(t('Disabled'), t('Enabled')),
|
||||
'#description' => t('Whether to encode email addresses with javascript. With this method you will have clickable mailto links, but it will be a bit harder for spam robots to collect them.'));
|
||||
$form['bbcode_filter']["bbcode_rewrite_email_$format"] = array(
|
||||
'#type' => 'select',
|
||||
'#title' => t('Email address rewrite'),
|
||||
'#default_value' => variable_get("bbcode_rewrite_email_$format", 1),
|
||||
'#options' => array(t('Disabled'), t('Enabled')),
|
||||
'#description' => t('Whether to rewrite email addresses, replacing the "@" symbol with "-[at]-". This will be a bit harder for spam robots to collect them. If enabled, the "Convert addresses to links" option is ignored. And the "Email address encoding" is ignored.'),
|
||||
);
|
||||
$form['bbcode_filter']["bbcode_paragraph_breaks_$format"] = array(
|
||||
'#type' => 'select',
|
||||
'#title' => t('Smart paragraph and line breaks'),
|
||||
|
|
Loading…
Reference in New Issue