parameterName = $parameterName; // Store the parameter value $this->parameter = isset($_GET[$parameterName]) ? $_GET[$parameterName] : null; // If the token provided is valid, mark it as such $token = isset($_GET[$parameterName.'token']) ? $_GET[$parameterName.'token'] : null; if ($this->checkToken($token)) { $this->token = $token; } } /** * Get the name of this token * * @return string */ public function getName() { return $this->parameterName; } public function parameterProvided() { return $this->parameter !== null; } public function reloadRequired() { return $this->parameterProvided() && !$this->tokenProvided(); } public function suppress() { unset($_GET[$this->parameterName]); } public function params($includeToken = true) { $params = array( $this->parameterName => $this->parameter, ); if ($includeToken) { $params[$this->parameterName . 'token'] = $this->genToken(); } return $params; } public function getRedirectUrlBase() { return (!$this->parameterProvided()) ? Director::baseURL() : $this->currentAbsoluteURL(); } public function getRedirectUrlParams() { $params = (!$this->parameterProvided()) ? $this->params() : array_merge($_GET, $this->params()); if (isset($params['url'])) { unset($params['url']); } return $params; } protected function redirectURL() { $query = http_build_query($this->getRedirectUrlParams()); return $this->getRedirectUrlBase() . '?' . $query; } }