summaryrefslogtreecommitdiffstats
path: root/functions.common.inc.php
diff options
context:
space:
mode:
authorsteckbrief <steckbrief@chefmail.de>2017-12-10 20:20:21 +0100
committersteckbrief <steckbrief@chefmail.de>2017-12-10 20:20:21 +0100
commiteb2e78a12505b8d41e0ef62cb1b321cdc540e5fd (patch)
treecd2ac4c7625d210ab36593b95f2bd1dc0b3e9a90 /functions.common.inc.php
parent075f05aaf9dfccc4a8a1e5741462ec4ee42ae743 (diff)
additional checks if a parameter is set; function to create paths added
Diffstat (limited to 'functions.common.inc.php')
-rw-r--r--functions.common.inc.php15
1 files changed, 15 insertions, 0 deletions
diff --git a/functions.common.inc.php b/functions.common.inc.php
index 11bcefc..a9db566 100644
--- a/functions.common.inc.php
+++ b/functions.common.inc.php
@@ -48,4 +48,19 @@ function endsWith($haystack, $needle) {
return $length === 0 || (substr($haystack, -$length) === $needle);
}
+
+function generatePath($parts, $basePath = __DIR__) {
+ $path = $basePath;
+ if (!is_array($parts)) {
+ $parts = [$parts];
+ }
+ foreach ($parts as $part) {
+ $path .= DIRECTORY_SEPARATOR.generatePathName($part);
+ }
+ return $path;
+}
+
+function generatePathName($name) {
+ return urlencode($name);
+}
?>