Mercurial > SimpleWebPresenter
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 45:6c2c6acba30c | 46:15879e2aab65 |
|---|---|
| 1 <?php | 1 <?php |
| 2 include_once 'CacheTimeCheck.inc'; | 2 include_once 'CacheTimeCheck.inc'; |
| 3 | 3 |
| 4 $cache = CacheTimeCheck::instance(__FILE__); | 4 $cache = CacheTimeCheck::instance(__FILE__); |
| 5 $cache->includeOnce('http-response-status-codes.inc', dirname(__FILE__)); | 5 $cache->includeOnce('http-response-status-codes.inc', dirname(__FILE__)); |
| 6 | |
| 7 function repMapString($map) | |
| 8 { | |
| 9 $opt = 'array('; | |
| 10 $start = True; | |
| 11 | |
| 12 foreach($map as $param => $value) { | |
| 13 if ($start) { | |
| 14 $start = False; | |
| 15 $opt .= "\"${param}\" => \"${value}\""; | |
| 16 } | |
| 17 else { | |
| 18 $opt .= ", \"${param}\" => \"${value}\""; | |
| 19 } | |
| 20 } | |
| 21 $opt .= ')'; | |
| 22 return $opt; | |
| 23 } | |
| 6 | 24 |
| 7 function basePath() | 25 function basePath() |
| 8 { | 26 { |
| 9 $l = strrpos($_SERVER['SCRIPT_FILENAME'], $_SERVER['SCRIPT_NAME']); | 27 $l = strrpos($_SERVER['SCRIPT_FILENAME'], $_SERVER['SCRIPT_NAME']); |
| 10 return substr($_SERVER['SCRIPT_FILENAME'], 0, $l); | 28 return substr($_SERVER['SCRIPT_FILENAME'], 0, $l); |
