_drupal_html_to_mail_urls

6 mail.inc _drupal_html_to_mail_urls($match = NULL, $reset = FALSE)
7 mail.inc _drupal_html_to_mail_urls($match = NULL, $reset = FALSE)
8 mail.inc _drupal_html_to_mail_urls($match = NULL, $reset = FALSE)

Helper function for drupal_html_to_text().

Keeps track of URLs and replaces them with placeholder tokens.

1 call to _drupal_html_to_mail_urls()

1 string reference to '_drupal_html_to_mail_urls'

File

includes/mail.inc, line 434

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;
}
Login or register to post comments