summaryrefslogtreecommitdiff
path: root/src/frontend_lib/util.php
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2016-01-25 15:04:36 +0100
committerFlorian Dold <florian.dold@gmail.com>2016-01-25 15:04:36 +0100
commit6426ff70e95d665727c9faf08aa5daf56b4edf28 (patch)
tree722cac7551fed779f21fb751907707b4e4812eda /src/frontend_lib/util.php
parentcb319933994c9088d74b509f88976e26973a2482 (diff)
parent0af7437d388b3b1106a86b957a1449d7563dd35e (diff)
downloadmerchant-6426ff70e95d665727c9faf08aa5daf56b4edf28.tar.gz
merchant-6426ff70e95d665727c9faf08aa5daf56b4edf28.tar.bz2
merchant-6426ff70e95d665727c9faf08aa5daf56b4edf28.zip
Merge branch 'master' of ssh://taler.net/var/git/merchant
Diffstat (limited to 'src/frontend_lib/util.php')
-rw-r--r--src/frontend_lib/util.php20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/frontend_lib/util.php b/src/frontend_lib/util.php
new file mode 100644
index 00000000..103838cc
--- /dev/null
+++ b/src/frontend_lib/util.php
@@ -0,0 +1,20 @@
+<?php
+
+function get(&$var, $default=null) {
+ return isset($var) ? $var : $default;
+}
+
+function url_join($base, $path) {
+ $url = (new http\URL($base))
+ ->mod(array ("path" => $path), http\Url::JOIN_PATH|http\URL::SANITIZE_PATH);
+ return $url->toString();
+}
+
+// Get a url with a path relative to the
+// current script's path.
+function url_rel($path) {
+ return url_join(
+ $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'],
+ $path);
+}
+?>