_drupal_html_to_mail_urls
function _drupal_html_to_mail_urls
_drupal_html_to_mail_urls($match = NULL, $reset = FALSE)
Keeps track of URLs and replaces them with placeholder tokens.
Callback for preg_replace_callback() within drupal_html_to_text().
File
- includes/mail.inc, line 577
- API functions for processing and sending e-mail.
Code
function _drupal_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; }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/includes!mail.inc/function/_drupal_html_to_mail_urls/7.x