You are here

protected function HtmlMailMime::attachRegex in HTML Mail 8.3

Same name and namespace in other branches
  1. 8 src/Utility/HTMLMailMime.php \Drupal\htmlmail\Utility\HTMLMailMime::attachRegex()

A preg_replace_callback used to attach local files, if possible.

See also

get()

File

src/Utility/HtmlMailMime.php, line 389

Class

HtmlMailMime
Class HtmlMailMime.

Namespace

Drupal\htmlmail\Utility

Code

protected function attachRegex($matches) {
  if (($url = UrlHelper::stripDangerousProtocols($matches[4])) && ($path = self::$fileSystem
    ->realpath($url)) && is_file($path) && $this
    ->addHtmlImage($path)) {

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