/** * @dataProvider getServerValues */ public function testGetCurrentUrlOtherSource($data) { $source = array(); foreach (self::$serverMapping as $key => $mapping) { if ($data[$key] !== null) { $source[$mapping] = $data[$key]; } } $expected = $data[4]; $this->assertEquals($expected, ezcUrlTools::getCurrentUrl($source), "Failed building URL " . $data[4]); }
/** * Parses the string $url and sets the class properties. * * @param string $url A string URL to parse */ private function parseUrl($url = null) { $urlArray = parse_url($url); $this->properties['host'] = isset($urlArray['host']) ? $urlArray['host'] : null; $this->properties['user'] = isset($urlArray['user']) ? $urlArray['user'] : null; $this->properties['pass'] = isset($urlArray['pass']) ? $urlArray['pass'] : null; $this->properties['port'] = isset($urlArray['port']) ? $urlArray['port'] : null; $this->properties['scheme'] = isset($urlArray['scheme']) ? $urlArray['scheme'] : null; $this->properties['fragment'] = isset($urlArray['fragment']) ? $urlArray['fragment'] : null; $this->properties['path'] = isset($urlArray['path']) ? explode('/', trim($urlArray['path'], '/')) : array(); $this->properties['basedir'] = array(); $this->properties['script'] = array(); $this->properties['params'] = array(); $this->properties['uparams'] = array(); if (isset($urlArray['query'])) { $this->properties['query'] = ezcUrlTools::parseQueryString($urlArray['query']); } else { $this->properties['query'] = array(); } }
function runAddCurrentUrlFilter(ezcMvcResult $result) { $result->variables['currentUrl'] = ezcUrlTools::getCurrentUrl(); }