diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/functions.php | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/core/functions.php b/core/functions.php index 7157e03..4befb19 100644 --- a/core/functions.php +++ b/core/functions.php @@ -186,6 +186,20 @@ function parseEntityContent(Item $Item): string { } #=============================================================================== +# Extract Markdown formatted image URLs +#=============================================================================== +function getMarkdownImageURLs(string $text): array { + $pattern = '#\!\[(.*)\][ ]?(?:\n[ ]*)?\((.*)(\s[\'"](.*)[\'"])?\)#U'; + $content = parseContentTags($text); + + if(preg_match_all($pattern, $content, $matches)) { + return array_map('htmlentities', $matches[2]); + } + + return []; +} + +#=============================================================================== # Parser for datetime formatted strings [YYYY-MM-DD HH:II:SS] #=============================================================================== function parseDatetime($datetime, $format): string { |