protected static MailFormatHelper::htmlToMailUrls($match = NULL, $reset = FALSE)
Keeps track of URLs and replaces them with placeholder tokens.
Callback for preg_replace_callback() within \Drupal\Core\Mail\MailFormatHelper::htmlToText().
protected static function htmlToMailUrls($match = NULL, $reset = FALSE) { // @todo Use request context instead. global $base_url, $base_path; if ($reset) { // Reset internal URL list. static::$urls = array(); } else { if (empty(static::$regexp)) { static::$regexp = '@^' . preg_quote($base_path, '@') . '@'; } if ($match) { list(, , $url, $label) = $match; // Ensure all URLs are absolute. static::$urls[] = strpos($url, '://') ? $url : preg_replace(static::$regexp, $base_url . '/', $url); return $label . ' [' . count(static::$urls) . ']'; } } return static::$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/core!lib!Drupal!Core!Mail!MailFormatHelper.php/function/MailFormatHelper::htmlToMailUrls/8.1.x