function _views_send_absolute_mail_urls in Views Send 6
Helper function for _views_send_html_to_text(). Replaces URLs with abolute URLs.
Inspired from Simplenews.
1 string reference to '_views_send_absolute_mail_urls'
- _views_send_html_to_text in ./
views_send.module - HTML to text conversion for HTML and special characters. Converts some special HTMLcharacters in addition to drupal_html_to_text(). Inspired from Simplenews,
File
- ./
views_send.module, line 853 - The Views Send module.
Code
function _views_send_absolute_mail_urls($match) {
global $base_url, $base_path;
static $regexp;
$url = $label = '';
if ($match) {
if (empty($regexp)) {
$regexp = '@^' . preg_quote($base_path, '@') . '@';
}
list(, $url, $label) = $match;
$url = strpos($url, '://') ? $url : preg_replace($regexp, $base_url . '/', $url);
// If the link is formed by Drupal's URL filter, we only return the URL.
// The URL filter generates a label out of the original URL.
if (strpos($label, '...') === strlen($label) - 3) {
// Remove ellipsis from end of label.
$label = substr($label, 0, strlen($label) - 3);
}
if (strpos($url, $label) !== FALSE) {
return $url;
}
return $label . ' ' . $url;
}
}