diff options
author | Mario Vavti <mario@mariovavti.com> | 2018-10-30 12:12:07 +0100 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2018-10-30 12:12:07 +0100 |
commit | 2192ea6fdf21a00ccf44d626a01b756d194d6cbe (patch) | |
tree | 153d4b4ffb2bf40edf8aae66b82a274dac37c208 /vendor/league/html-to-markdown/src/Converter/LinkConverter.php | |
parent | 0f19627407ccd373afe1ce2d2347ea240f3195c1 (diff) | |
download | volse-hubzilla-2192ea6fdf21a00ccf44d626a01b756d194d6cbe.tar.gz volse-hubzilla-2192ea6fdf21a00ccf44d626a01b756d194d6cbe.tar.bz2 volse-hubzilla-2192ea6fdf21a00ccf44d626a01b756d194d6cbe.zip |
update html_to_markdown, smarty and sabredav libs via composer
Diffstat (limited to 'vendor/league/html-to-markdown/src/Converter/LinkConverter.php')
-rw-r--r-- | vendor/league/html-to-markdown/src/Converter/LinkConverter.php | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/vendor/league/html-to-markdown/src/Converter/LinkConverter.php b/vendor/league/html-to-markdown/src/Converter/LinkConverter.php index 74b49a778..c82b70e97 100644 --- a/vendor/league/html-to-markdown/src/Converter/LinkConverter.php +++ b/vendor/league/html-to-markdown/src/Converter/LinkConverter.php @@ -21,6 +21,8 @@ class LinkConverter implements ConverterInterface $markdown = '[' . $text . '](' . $href . ' "' . $title . '")'; } elseif ($href === $text && $this->isValidAutolink($href)) { $markdown = '<' . $href . '>'; + } elseif ($href === 'mailto:' . $text && $this->isValidEmail($text)) { + $markdown = '<' . $text . '>'; } else { $markdown = '[' . $text . '](' . $href . ')'; } @@ -49,4 +51,15 @@ class LinkConverter implements ConverterInterface { return preg_match('/^[A-Za-z][A-Za-z0-9.+-]{1,31}:[^<>\x00-\x20]*/i', $href) === 1; } + + /** + * @param string $email + * + * @return bool + */ + private function isValidEmail($email) + { + // Email validation is messy business, but this should cover most cases + return filter_var($email, FILTER_VALIDATE_EMAIL); + } } |