commit 940a219ffdba2df51f8fec17a684b336e1c5a153
parent 5947ae651ea354a188cb8d21605d546a1cc38d2e
Author: Christian Grothoff <christian@grothoff.org>
Date: Sat, 19 Nov 2016 19:30:17 +0100
Merge branch 'master' of git+ssh://taler.net/merchant-frontend-examples
Diffstat:
1 file changed, 15 insertions(+), 6 deletions(-)
diff --git a/php/helpers.php b/php/helpers.php
@@ -2,7 +2,9 @@
// This file is in the public domain.
/**
- * ???
+ * If '$arr[$idx]' exists, return it. Otherwise
+ * set '$arr[$idx]' to '$default' and then return it
+ * as well.
*/
function &pull(&$arr, $idx, $default) {
if (!isset($arr[$idx])) {
@@ -12,7 +14,9 @@
}
/**
- * ???
+ * Concatenates '$base' and '$path'. Tipically used
+ * to add the path (represented by '$path') to a base URL
+ * (represented by '$base').
*/
function url_join($base, $path) {
// Please note that this simplistic way of joining URLs is
@@ -22,8 +26,9 @@
}
/**
- * ???
- * $path must have a leading '/'.
+ * Construct a URL having the host where the script is
+ * running as the base URL, and concatenating '$path' to
+ * it. NOTE: $path must have a leading '/'.
*/
function url_rel($path){
// Make sure 'REQUEST_SCHEME' is http/https, as in some setups it may
@@ -32,7 +37,8 @@
}
/**
- * Convert ???
+ * Take date in Taler format, as "/Date(timestamp)/", and
+ * convert it in a human-readable string.
*/
function get_pretty_date($taler_date){
$match = array();
@@ -43,7 +49,10 @@
}
/**
- * ???
+ * Take amount object in Taler format, and converts it
+ * in a human-readable string. NOTE: Taler amounts objects
+ * come from JSON of the form:
+ * '{"value" x, "fraction": y, "currency": "CUR"}'
*/
function get_amount($taler_amount){
$PRECISION = 100000000;