function _mimemail_html_to_mail_urls in Mime Mail 5
Helper function for mimemail_html_to_text().
Keeps track of URLs and replaces them with placeholder tokens.
1 call to _mimemail_html_to_mail_urls()
- mimemail_html_to_text in ./
html_to_text.inc - Transform an HTML string into plain text, preserving the structure of the markup. Useful for preparing the body of a node to be sent by e-mail.
1 string reference to '_mimemail_html_to_mail_urls'
- mimemail_html_to_text in ./
html_to_text.inc - Transform an HTML string into plain text, preserving the structure of the markup. Useful for preparing the body of a node to be sent by e-mail.
File
- ./
html_to_text.inc, line 246
Code
function _mimemail_html_to_mail_urls($match = NULL, $reset = FALSE) {
global $base_url, $base_path;
static $urls = array(), $regexp;
if ($reset) {
// Reset internal URL list.
$urls = array();
}
else {
if (empty($regexp)) {
$regexp = '@^' . preg_quote($base_path, '@') . '@';
}
if ($match) {
list(, , $url, $label) = $match;
// Ensure all URLs are absolute.
$urls[] = strpos($url, '://') ? $url : preg_replace($regexp, $base_url . '/', $url);
return $label . ' [' . count($urls) . ']';
}
}
return $urls;
}