Zend Framework  3.0
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ServerUrl Class Reference

Helper for returning the current server URL (optionally with request URI) More...

Public Member Functions

 __invoke ($requestUri=null)
 View helper entry point: Returns the current host's URL like http://site.com.
 
 setHost ($host)
 Sets host.
 
 getHost ()
 Returns host.
 
 setPort ($port)
 Set server port.
 
 getPort ()
 Retrieve the server port.
 
 setScheme ($scheme)
 Sets scheme (typically http or https)
 
 getScheme ()
 Returns scheme (typically http or https)
 
 setUseProxy ($useProxy=false)
 Set flag indicating whether or not to query proxy servers.
 
- Public Member Functions inherited from AbstractHelper
 setView (Renderer $view)
 Set the View object.
 
 getView ()
 Get the view object.
 

Protected Member Functions

 detectHost ()
 Detect the host based on headers.
 
 detectPort ()
 Detect the port.
 
 detectScheme ()
 Detect the scheme.
 
 isReversedProxy ()
 
 setHostFromProxy ()
 Detect if a proxy is in use, and, if so, set the host based on it.
 
 setPortFromProxy ()
 Set port based on detected proxy headers.
 
 setSchemeFromProxy ()
 Set the current scheme based on detected proxy headers.
 

Protected Attributes

 $host
 
 $port
 
 $scheme
 
 $useProxy = false
 
- Protected Attributes inherited from AbstractHelper
 $view = null
 

Detailed Description

Helper for returning the current server URL (optionally with request URI)

Member Function Documentation

__invoke (   $requestUri = null)

View helper entry point: Returns the current host's URL like http://site.com.

Parameters
string | bool$requestUri[optional] if true, the request URI found in $_SERVER will be appended as a path. If a string is given, it will be appended as a path. Default is to not append any path.
Returns
string
detectHost ( )
protected

Detect the host based on headers.

Returns
void
detectPort ( )
protected

Detect the port.

Returns
null
detectScheme ( )
protected

Detect the scheme.

Returns
null
getHost ( )

Returns host.

Returns
string
getPort ( )

Retrieve the server port.

Returns
int|null
getScheme ( )

Returns scheme (typically http or https)

Returns
string
isReversedProxy ( )
protected
setHost (   $host)

Sets host.

Parameters
string$host
Returns
ServerUrl
setHostFromProxy ( )
protected

Detect if a proxy is in use, and, if so, set the host based on it.

Returns
bool
setPort (   $port)

Set server port.

Parameters
int$port
Returns
ServerUrl
setPortFromProxy ( )
protected

Set port based on detected proxy headers.

Returns
bool
setScheme (   $scheme)

Sets scheme (typically http or https)

Parameters
string$scheme
Returns
ServerUrl
setSchemeFromProxy ( )
protected

Set the current scheme based on detected proxy headers.

Returns
bool
setUseProxy (   $useProxy = false)

Set flag indicating whether or not to query proxy servers.

Parameters
bool$useProxy
Returns
ServerUrl

Member Data Documentation

$host
protected
$port
protected
$scheme
protected
$useProxy = false
protected