diff options
author | M. Dent <dentm42@gmail.com> | 2018-10-31 01:32:44 +0100 |
---|---|---|
committer | M. Dent <dentm42@gmail.com> | 2018-10-31 01:32:44 +0100 |
commit | f9ab7647dd660adb37464614616cb8484c500de4 (patch) | |
tree | a3155f3820e9c4e86941a13d878a914b35941a61 /vendor/league/html-to-markdown/src/Converter/LinkConverter.php | |
parent | 046d264688aae76874fa22870f4bed77192335c2 (diff) | |
parent | fc6ff45c4976d158ac565a7693b2e4d30fe70e33 (diff) | |
download | volse-hubzilla-f9ab7647dd660adb37464614616cb8484c500de4.tar.gz volse-hubzilla-f9ab7647dd660adb37464614616cb8484c500de4.tar.bz2 volse-hubzilla-f9ab7647dd660adb37464614616cb8484c500de4.zip |
Merge branch 'composer-updates' into 'dev'
update html_to_markdown, smarty and sabredav libs via composer
See merge request hubzilla/core!1361
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); + } } |