eZ Publish  [4.0]
eZHTTPTool Class Reference

Provides access to HTTP post,get and session variables. More...

List of all members.

Public Member Functions

 attribute ($attr)
 attributes ()
 createPostVarsFromImageButtons ()
 eZHTTPTool ()
 getSessionKey ()
 getVariable ($var)
 hasAttribute ($attr)
 hasGetVariable ($var)
 hasPostVariable ($var)
 hasSessionVariable ($name)
 hasVariable ($var)
 postVariable ($var)
 removeSessionVariable ($name)
 sessionID ()
sessionVariable ($name)
 setGetVariable ($var, $value)
 setPostVariable ($var, $value)
 setSessionKey ($sessionKey)
 setSessionVariable ($name, $value)
 variable ($var)

Static Public Member Functions

static createRedirectUrl ($path, $parameters=array())
static getDataByURL ($url, $justCheckURL=false, $userAgent=false)
static headerVariable ($headerName, $headerData)
static instance ()
static parseHTTPResponse (&$response, &$header, &$body)
static password ()
static redirect ($path, $parameters=array(), $status=false, $encodeURL=true)
 Performs an HTTP redirect.
static removeMagicQuotes ()
static sendHTTPRequest ($uri, $port=80, $postParameters=false, $userAgent= 'eZ Publish', $passthrough=true)
static username ()

Detailed Description

Provides access to HTTP post,get and session variables.

See PHP manual on Predefined Variables for more information.

Definition at line 47 of file ezhttptool.php.


Member Function Documentation

eZHTTPTool::attribute ( attr)
Returns:
the value for the attribute $attr or null if the attribute does not exist.

Definition at line 183 of file ezhttptool.php.

eZHTTPTool::attributes ( )
Returns:
the attributes for this object.

Definition at line 167 of file ezhttptool.php.

Referenced by hasAttribute().

eZHTTPTool::createPostVarsFromImageButtons ( )

Definition at line 671 of file ezhttptool.php.

static eZHTTPTool::createRedirectUrl ( path,
parameters = array() 
) [static]

Sends a redirect path to the browser telling it to load the new path. By default only $path is required, other parameters will be fetched automatically to create a HTTP/1.1 compatible header. The input $parameters may contain the following keys.

  • host - the name of the host, default will fetch the currenty hostname
  • protocol - which protocol to use, default will use HTTP
  • port - the port on the host
  • username - a username which is required to login on the site
  • password - if username is supplied this password will be used for authentication

The path may be specified relativily rel/ative, from root /a/root, with hostname change //myhost.com/a/root/rel/ative, with protocol http://myhost.com/a/root/rel/ative. Also port may be placed in the path string. It is recommended that the path only contain a plain root path and instead send the rest as optional parameters, the support for different kinds of paths is only incase you get URLs externally which contains any of the above cases.

Note:
The redirection does not happen immedietaly and the script execution will continue.

Definition at line 486 of file ezhttptool.php.

Referenced by redirect().

eZHTTPTool::eZHTTPTool ( )

Initializes the class. Use eZHTTPTool::instance to get a single instance.

Definition at line 52 of file ezhttptool.php.

Referenced by instance().

static eZHTTPTool::getDataByURL ( url,
justCheckURL = false,
userAgent = false 
) [static]
Parameters:
$url
$justCheckURLif true, we should check url only not downloading data.
Returns:
data from $url, false if invalid URL

Definition at line 755 of file ezhttptool.php.

Referenced by eZRSSImport\getRSSVersion().

eZHTTPTool::getSessionKey ( )

Sets the session variable $name to value $value.

Definition at line 702 of file ezhttptool.php.

eZHTTPTool::getVariable ( var)
Returns:
a reference to the HTTP get variable $var, or null if it does not exist.
See also:
variable

Definition at line 109 of file ezhttptool.php.

eZHTTPTool::hasAttribute ( attr)
Returns:
true if the attribute $attr exist.

Definition at line 175 of file ezhttptool.php.

eZHTTPTool::hasGetVariable ( var)
Returns:
true if the HTTP get variable $var exist.
See also:
hasVariable

Definition at line 124 of file ezhttptool.php.

eZHTTPTool::hasPostVariable ( var)
Returns:
true if the HTTP post variable $var exist.
See also:
hasVariable

Definition at line 91 of file ezhttptool.php.

eZHTTPTool::hasSessionVariable ( name)
Returns:
true if the session variable $name exist.

Definition at line 728 of file ezhttptool.php.

eZHTTPTool::hasVariable ( var)
Returns:
true if the HTTP post/get variable $var exists.
See also:
hasPostVariable

Definition at line 133 of file ezhttptool.php.

static eZHTTPTool::headerVariable ( headerName,
headerData 
) [static]

Sets the header variable $headerName to have the data $headerData.

Note:
Calls PHPs header() with a constructed string.

Definition at line 626 of file ezhttptool.php.

Referenced by redirect().

static eZHTTPTool::instance ( ) [static]
Returns:
the unique instance of the HTTP tool

Definition at line 200 of file ezhttptool.php.

Referenced by eZModule\actionParameter(), eZURLOperator\applyQuotes(), eZContentBrowse\browse(), eZSearch\buildSearchArray(), eZContentClass\canInstantiateClasses(), eZContentClass\canInstantiateClassList(), eZContentUpload\cleanup(), eZContentUpload\cleanupAll(), eZTemplateCompiler\compilationFilename(), eZWizardBaseClassLoader\createClass(), createRedirectUrl(), eZModule\currentAction(), eZBasket\currentBasket(), eZWishList\currentWishList(), eZCollaborationItemHandler\customInput(), eZObjectRelationListType\customObjectAttributeHTTPAction(), eZMultiOption2Type\editTemplate(), eZModuleOperationInfo\execute(), eZStaticCache\executeActions(), eZContentObjectEditHandler\executeInputHandlers(), eZRole\expireCache(), eZContentBrowse\eZContentBrowse(), eZContentUpload\eZContentUpload(), eZWizardBase\eZWizardBase(), eZDefaultShopAccountHandler\fetchAccountInformation(), eZUserDiscountRule\fetchIDListByUserID(), eZContentObject\fetchInput(), eZContentObject\fixupInput(), eZPaymentGatewayType\getCurrentGatewayType(), getDataByURL(), eZSection\globalID(), eZContentObject\handleAllCustomHTTPActions(), eZContentObject\handleCustomHTTPActions(), eZModule\hasActionParameter(), eZCollaborationItemHandler\hasCustomInput(), eZSection\initGlobalID(), eZCollaborationItemHandler\isCustomAction(), eZPreferences\isStoredInSession(), eZURLOperator\modify(), password(), eZRedirectManager\redirectURI(), eZContentBrowse\result(), eZPreferences\sessionCleanup(), eZSection\setGlobalID(), eZContentUpload\setResult(), eZModuleOperationInfo\storeBodyMemento(), eZStaticCache\storeCache(), eZPreferences\storedSessionValue(), eZPreferences\storeInSession(), eZModuleOperationInfo\storeOperationMemento(), eZContentUpload\upload(), eZURLOperator\urlTransformation(), username(), eZContentObject\validateInput(), eZPreferences\value(), and eZPreferences\values().

static eZHTTPTool::parseHTTPResponse ( &$  response,
&$  header,
&$  body 
) [static]

Definition at line 382 of file ezhttptool.php.

static eZHTTPTool::password ( ) [static]

Returns password from HTTP authentication or false if not logged in. See http://en.php.net/features.http-auth why you can`t safely use $_SERVER['PHP_AUTH_PW'].

Definition at line 444 of file ezhttptool.php.

eZHTTPTool::postVariable ( var)
Returns:
a reference to the HTTP post variable $var, or null if it does not exist.
See also:
variable

Definition at line 76 of file ezhttptool.php.

static eZHTTPTool::redirect ( path,
parameters = array(),
status = false,
encodeURL = true 
) [static]

Performs an HTTP redirect.

Parameters:
$pathThe path to redirect
$parameters
See also:
createRedirectUrl()
Parameters:
$statusThe HTTP status code as a string
$encodeURLEncode the URL. This should normally be true, but may be set to false to avoid double encoding when redirect() is called twice.

Definition at line 598 of file ezhttptool.php.

Referenced by eZUserLoginHandler\checkUser(), eZUser\instance(), and eZSSLZone\switchIfNeeded().

static eZHTTPTool::removeMagicQuotes ( ) [static]

Definition at line 631 of file ezhttptool.php.

Referenced by eZHTTPTool().

eZHTTPTool::removeSessionVariable ( name)

Removes the session variable $name.

Definition at line 720 of file ezhttptool.php.

static eZHTTPTool::sendHTTPRequest ( uri,
port = 80,
postParameters = false,
userAgent = 'eZ Publish',
passthrough = true 
) [static]

Sends a http request to the specified host. Using https:// requires PHP 4.3.0, and compiled in OpenSSL support.

Parameters:
urihttp/https address, only path to send request to eZ Publish. examples: http://ez.no, https://secure.ez.no, ssl://secure.ez.no, content/view/full/2
portwhich port to connect to, default 80
postParameterspost parameters array (optional), if no post parameters are present, a get request will be send.
userAgentuser agent, default will be eZ Publish
passthroughwill send result directly to client, default true
Returns:
result if http request, or return false if an error occurs. If pipetrough, program will end here.

Definition at line 229 of file ezhttptool.php.

eZHTTPTool::sessionID ( )
Returns:
the session id

Definition at line 744 of file ezhttptool.php.

& eZHTTPTool::sessionVariable ( name)
Returns:
the session variable $name.

Definition at line 736 of file ezhttptool.php.

eZHTTPTool::setGetVariable ( var,
value 
)

Sets the get variable $var to $value.

See also:
getVariable

Definition at line 100 of file ezhttptool.php.

eZHTTPTool::setPostVariable ( var,
value 
)

Sets the post variable $var to $value.

See also:
postVariable

Definition at line 67 of file ezhttptool.php.

eZHTTPTool::setSessionKey ( sessionKey)

Definition at line 707 of file ezhttptool.php.

eZHTTPTool::setSessionVariable ( name,
value 
)

Definition at line 712 of file ezhttptool.php.

static eZHTTPTool::username ( ) [static]

Returns username from HTTP authentication or false if not logged in. See http://en.php.net/features.http-auth why you can`t safely use $_SERVER['PHP_AUTH_USER'].

Definition at line 419 of file ezhttptool.php.

eZHTTPTool::variable ( var)
Returns:
a reference to the HTTP post/get variable $var, or null if it does not exist.
See also:
postVariable

Definition at line 150 of file ezhttptool.php.


The documentation for this class was generated from the following file: