aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/functions.php20
1 files changed, 20 insertions, 0 deletions
diff --git a/core/functions.php b/core/functions.php
index 4b3eabd..5fd1b39 100644
--- a/core/functions.php
+++ b/core/functions.php
@@ -200,6 +200,26 @@ function getMarkdownImageURLs(string $text): array {
}
#===============================================================================
+# Parse argument string to array
+#===============================================================================
+function parseArguments(?string $argv): array {
+ if($argv) {
+ foreach(explode('|', $argv) as $delimeter) {
+ $part = explode('=', $delimeter);
+
+ $argumentK = $part[0] ?? NULL;
+ $argumentV = $part[1] ?? TRUE;
+
+ if(preg_match('#^[[:word:]]+$#', $argumentK)) {
+ $arguments[strtoupper($argumentK)] = $argumentV;
+ }
+ }
+ }
+
+ return $arguments ?? [];
+}
+
+#===============================================================================
# Parser for datetime formatted strings [YYYY-MM-DD HH:II:SS]
#===============================================================================
function parseDatetime($datetime, $format): string {