Mercurial > SimpleWebPresenter
diff common-functions.inc @ 46:15879e2aab65
Function for converting a stringmap to EVALable function.
| author | Tom Fredrik "BFG" Klaussen <bfg@blenning.no> |
|---|---|
| date | Mon, 08 Oct 2012 15:49:28 +0200 |
| parents | 6c2c6acba30c |
| children | 2cfea6e84694 3898353ed1d8 |
line wrap: on
line diff
--- a/common-functions.inc Mon Oct 08 02:02:09 2012 +0200 +++ b/common-functions.inc Mon Oct 08 15:49:28 2012 +0200 @@ -4,6 +4,24 @@ $cache = CacheTimeCheck::instance(__FILE__); $cache->includeOnce('http-response-status-codes.inc', dirname(__FILE__)); +function repMapString($map) +{ + $opt = 'array('; + $start = True; + + foreach($map as $param => $value) { + if ($start) { + $start = False; + $opt .= "\"${param}\" => \"${value}\""; + } + else { + $opt .= ", \"${param}\" => \"${value}\""; + } + } + $opt .= ')'; + return $opt; +} + function basePath() { $l = strrpos($_SERVER['SCRIPT_FILENAME'], $_SERVER['SCRIPT_NAME']);
