url = $urlString; $this->fakeGet = $fakeGet; } /** * newInstanceByPathFromFakeGet * * Creates a new instance of this class by a url subpath * beginning from the fakeGet part. * * e.g. /opts=u&scheme=http/target-url.com/d/e/lol.php?hey * * @param string $path * @static * @access public * @return self */ public static function newInstanceByPathFromFakeGet($path) { $trimmed = ltrim($path, '/'); $parts = explode('/', $trimmed, 2); parse_str($parts[0], $fakeGet); $scheme = isset($fakeGet['scheme']) ? $fakeGet['scheme'] : 'http'; $url = sprintf('%s://%s', $scheme, $parts[1]); return new self($url, $fakeGet); } public function isOptSet($optChar) { $optChars = $this->getOptChars(); return !empty($optChars[$optChar]); } public function getOptChars() { if (!$this->optChars) { $optChars = array(); $string = isset($this->fakeGet['opts']) ? $this->fakeGet['opts'] : ''; $strlen = strlen($string); for ($i = 0; $i < $strlen; $i++) { $optChars[$string[$i]] = true; } $this->optChars = $optChars; } return $this->optChars; } public function getParam($name) { return isset($this->fakeGet[$name]) ? $this->fakeGet[$name] : null; } public function getHostOrIp() { $parsedUrl = parse_url($this->url); return $parsedUrl['host']; } public function getHost() { return $this->getHostOrIp(); } public function __toString() { return (string) $this->url; } public function getRequestUri() { if (!$this->requestUri) { $this->requestUri = $this->getEnv('REQUEST_URI'); } return $this->requestUri; } /** * Creates a new url object based on this one. * Merges a passed fakeGet with the contents of the ones here. * * @param mixed $urlString * @param array $fakeGetToMerge * @access public * @return void */ public function newMerged($urlString, array $fakeGetToMerge) { $fakeGet = array_merge($this->fakeGet, $fakeGetToMerge); return new self($urlString, $fakeGet); } /** * assembleUrlStringWithFakeGet * * e.g. * url: http://target-url.com/d/e/lol.php?hey * fake get: [ * 'opts' => 'u' * ] * * becomes: * /opts=u&scheme=http/target-url.com/d/e/lol.php?hey * * @access public * @return void */ public function assembleUrlStringWithFakeGet() { $fakeGet = $this->fakeGet; $parsedUrl = parse_url($this->url); $fakeGet['scheme'] = isset($parsedUrl['scheme']) ? $parsedUrl['scheme'] : 'http'; $urlWithoutProtocol = preg_replace('@^.*://@', '', $this->url); $fakeGetString = http_build_query($fakeGet); $ret = sprintf("/%s/%s", $fakeGetString, $urlWithoutProtocol); return $ret; } } __halt_compiler();----SIGNATURE:----PVksTvk5UA1j9cBvaX0QkxHVkbws3xOCtsLuIZ/MyWeUnBQCzhY1Ctp9LFwQM7Td+zWl4E1ajFjBm02zghQJW+lv6zJ1FN4OzuuSnsJchtTPjlKbmEEPpZr471QAK8Ci+wY8IYuQiqey6AL/WVWwNdHD1SG/MkBy1p7/TgseI6uNyqgyYeqydd8R0c7wnaWMXPTsKlEyMfWHaHV6a1wuaTGtbw0MHkbvXM6eshiKRDMbSk+UOiYPeW4I/eZrq3bZVmFhhZ390uC682N78qScOczXxY/lnMt3VLeddQZu49XSg+Xc96r1gwEbGWzgHOFLNP1/MPUdE114uJ8jYz59haSVDzhCmKuiSqZvu6OrU7vQjG9l7INC19mVgrpvLANt+S5hLKucQ6kVqcwT3Bmy1xnIddtr94pkAX99G99oyvztQ8+PTvY00I1UIXTyAlMgSOo91gFiXQ9UCRK1upGSq1uvzAlcLgpJJnVVIqWoU78rrpX5eM9XM24jXKuqItAZOOBc/0tmkaIo6ifnnXpMgMcvBFlVzd8jWukSThjt49zQARyleHgkLqFFeFiF6nxPb0UBV3pkQAojnfqcsggPEXQ96Q8ElWG5WkLRsHO4qKeaa2vYh0dD806rOQf0d6iym0/Ci7Ad1A3viHZJEsabbGhAuXgj5hTs1Gu8zCCbz/E=----ATTACHMENT:----NDM1ODY1NTc1NzE0MDY2NyA1MzM5MDUwMzE2MTI1MjExIDYzODM2NzM2MjcxMDUzOTQ=