You are here

protected function MailMIME::attachRegex in Mail MIME 7.2

Same name and namespace in other branches
  1. 8.2 mailmime.inc \MailMIME::attachRegex()
  2. 6.2 mailmime.inc \MailMIME::attachRegex()
  3. 6 mailmime.inc \MailMIME::attachRegex()
  4. 7 mailmime.inc \MailMIME::attachRegex()

A preg_replace_callback used to attach local files, if possible.

See also

get()

File

./mailmime.inc, line 394
Provides the MailMIME class for creating MIME-formatted email messages.

Class

MailMIME
The MailMIME class is used to create MIME email messages.

Code

protected function attachRegex($matches) {
  if (($url = drupal_strip_dangerous_protocols(urldecode($matches[4]))) && ($path = url_to_realpath($url)) && is_file($path) && $this
    ->addHTMLImage($path, NULL, $path . $matches[5])) {

    // The parent method will replace this with the actual cid: string.
    $matches[4] = $path;
  }
  return implode('', array_slice($matches, 1));
}