Mercurial > SimpleWebPresenter
comparison InputParser.inc @ 124:6766250a0baa
Support for parameters as directory structure.
| author | Tom Fredrik Blenning Klaussen <bfg@bfgconsult.no> |
|---|---|
| date | Fri, 29 Dec 2017 19:59:22 +0100 |
| parents | 8678ce12d533 |
| children | 7858ceb293d1 |
comparison
equal
deleted
inserted
replaced
| 123:8678ce12d533 | 124:6766250a0baa |
|---|---|
| 28 parent::setCache($cache); | 28 parent::setCache($cache); |
| 29 $this->master->load($name); | 29 $this->master->load($name); |
| 30 | 30 |
| 31 $this->options = new Options($this->master); | 31 $this->options = new Options($this->master); |
| 32 $this->options->setCache($cache); | 32 $this->options->setCache($cache); |
| 33 $this->options->setBasePath(basePath()); | 33 $base=basePath(); |
| 34 $base=$_SERVER['CONTEXT_DOCUMENT_ROOT']; | |
| 35 $this->options->setBasePath($base); | |
| 34 $this->options->setCacheable(true); | 36 $this->options->setCacheable(true); |
| 35 | 37 |
| 36 $this->options->setUrlParams(array('name', 'lang')); | 38 $this->options->setUrlParams(array('name', 'lang')); |
| 37 | 39 |
| 38 if(array_key_exists('lang', $_GET) && $_GET['lang']) { | 40 if(array_key_exists('lang', $_GET) && $_GET['lang']) { |
| 45 } | 47 } |
| 46 | 48 |
| 47 if(array_key_exists('name', $_GET) && $_GET['name']) { | 49 if(array_key_exists('name', $_GET) && $_GET['name']) { |
| 48 $this->options->setName($_GET['name']); | 50 $this->options->setName($_GET['name']); |
| 49 } | 51 } |
| 52 else { | |
| 53 $pathToAnalyze=$_SERVER['PATH_TRANSLATED']; | |
| 54 $prefix=$_SERVER['SCRIPT_FILENAME']; | |
| 55 if (substr($pathToAnalyze, 0, strlen($prefix)) == $prefix) { | |
| 56 $pathToAnalyze = substr($pathToAnalyze, strlen($prefix)); | |
| 57 } | |
| 58 preg_match('/\/([^\/]*)$/', $pathToAnalyze, $groups); | |
| 59 if ($groups[1]) { | |
| 60 $this->options->setName($groups[1]); | |
| 61 } | |
| 62 } | |
| 63 | |
| 50 | 64 |
| 51 $params = $this->master->getElementsByTagName("param"); | 65 $params = $this->master->getElementsByTagName("param"); |
| 52 | 66 |
| 53 foreach ($params as $param) { | 67 foreach ($params as $param) { |
| 54 if ($param->getAttribute("type") == "input") { | 68 if ($param->getAttribute("type") == "input") { |
