core/Http/Request.php
public function referer( $valid_host = false, $valid_string = '' )
	{
		$ref = $this->server->getOr('HTTP_REFERER', '');
		if( $ref ) {

			if($valid_host) {
				$host = BASE_PROTOCOL . "://" . APP_HOST;
				$len = strlen($host);

				if( substr($ref, 0, $len) !== $host ) {
					return '';
				}

				if( strlen($ref) > $len ) {
					$end = $ref[$len];
					if( $end !== "/" && $end !== ":" ) {
						return '';
					}
				}
			}

			if($valid_string && strpos($ref, $valid_string) === false) {
				return '';
			}
		}

		return $ref;
	}
public function referer( $valid_host = false, $valid_string = '' )
	{
		$ref = $this->server->getOr('HTTP_REFERER', '');
		if( $ref ) {

			if($valid_host) {
				$host = BASE_PROTOCOL . "://" . APP_HOST;
				$len = strlen($host);

				if( substr($ref, 0, $len) !== $host ) {
					return '';
				}

				if( strlen($ref) > $len ) {
					$end = $ref[$len];
					if( $end !== "/" && $end !== ":" ) {
						return '';
					}
				}
			}

			if($valid_string && strpos($ref, $valid_string) === false) {
				return '';
			}
		}

		return $ref;
	}
public function referer ( $ valid_host = false , $ valid_string = '' ) { $ ref = $ this -> server -> getOr ( 'HTTP_REFERER' , '' ) ; if ( $ ref ) { if ( $ valid_host ) { $ host = BASE_PROTOCOL . "://" . APP_HOST ; $ len = strlen ( $ host ) ; if ( substr ( $ ref , 0 , $ len ) !== $ host ) { return '' ; } if ( strlen ( $ ref ) > $ len ) { $ end = $ ref [ $ len ] ; if ( $ end !== "/" && $ end !== ":" ) { return '' ; } } } if ( $ valid_string && strpos ( $ ref , $ valid_string ) === false ) { return '' ; } } return $ ref ; }
Gets the request referer

@param bool $valid_host
@param string $valid_string
@return string
Gets the request referer