public function referer($default = null, $local = false) {
		if ($ref = $this->env('HTTP_REFERER')) {
			if (!$local) {
				return $ref;
			}
			$url = parse_url($ref) + ['path' => ''];
			if (empty($url['host']) || $url['host'] === $this->env('HTTP_HOST')) {
				$ref = $url['path'];
				if (!empty($url['query'])) {
					$ref .= '?' . $url['query'];
				}
				if (!empty($url['fragment'])) {
					$ref .= '#' . $url['fragment'];
				}
				return $ref;
			}
		}
		return ($default !== null) ? $default : '/';
	}
public function referer($default = null, $local = false) {
		if ($ref = $this->env('HTTP_REFERER')) {
			if (!$local) {
				return $ref;
			}
			$url = parse_url($ref) + ['path' => ''];
			if (empty($url['host']) || $url['host'] === $this->env('HTTP_HOST')) {
				$ref = $url['path'];
				if (!empty($url['query'])) {
					$ref .= '?' . $url['query'];
				}
				if (!empty($url['fragment'])) {
					$ref .= '#' . $url['fragment'];
				}
				return $ref;
			}
		}
		return ($default !== null) ? $default : '/';
	}
public function referer ( $ default = null , $ local = false ) { if ( $ ref = $ this -> env ( 'HTTP_REFERER' ) ) { if ( ! $ local ) { return $ ref ; } $ url = parse_url ( $ ref ) + [ 'path' => '' ] ; if ( empty ( $ url [ 'host' ] ) || $ url [ 'host' ] === $ this -> env ( 'HTTP_HOST' ) ) { $ ref = $ url [ 'path' ] ; if ( ! empty ( $ url [ 'query' ] ) ) { $ ref .= '?' . $ url [ 'query' ] ; } if ( ! empty ( $ url [ 'fragment' ] ) ) { $ ref .= '#' . $ url [ 'fragment' ] ; } return $ ref ; } } return ( $ default !== null ) ? $ default : '/' ; }
Gets the referring URL of this request.

@param string $default Default URL to use if HTTP_REFERER cannot be read from headers.
@param boolean $local If true, restrict referring URLs to local server.
@return string Referring URL.
Gets the referring URL of this request .