eZ Publish  [4.2]
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, $fallbackValue=null)
 hasAttribute ($attr)
 hasGetVariable ($var)
 hasPostVariable ($var)
 hasSessionVariable ($name)
 hasVariable ($var)
 postVariable ($var, $fallbackValue=null)
 removeSessionVariable ($name)
 sessionID ()
sessionVariable ($name)
 setGetVariable ($var, $value)
 setPostVariable ($var, $value)
 setSessionKey ($sessionKey)
 setSessionVariable ($name, $value)
 variable ($var, $fallbackValue=null)

Static Public Member Functions

static createRedirectUrl ($path, $parameters=array())
static getDataByURL ($url, $justCheckURL=false, $userAgent=false)
static headerVariable ($headerName, $headerData)
static instance ()
 Return a unique instance of the eZHTTPTool class.
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 43 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 192 of file ezhttptool.php.

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

Definition at line 176 of file ezhttptool.php.

Referenced by hasAttribute().

eZHTTPTool::createPostVarsFromImageButtons ( )

Definition at line 681 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 496 of file ezhttptool.php.

Referenced by redirect().

eZHTTPTool::eZHTTPTool ( )

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

Definition at line 48 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 765 of file ezhttptool.php.

Referenced by eZRSSImport\getRSSVersion().

eZHTTPTool::getSessionKey ( )

Sets the session variable $name to value $value.

Definition at line 712 of file ezhttptool.php.

eZHTTPTool::getVariable ( var,
fallbackValue = null 
)
Returns:
the HTTP get variable $var, or $fallbackValue if the get variable does not exist, or null if $fallbackValue is omitted.
See also:
variable

Definition at line 109 of file ezhttptool.php.

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

Definition at line 184 of file ezhttptool.php.

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

Definition at line 128 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 738 of file ezhttptool.php.

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

Definition at line 137 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 636 of file ezhttptool.php.

Referenced by redirect().

static eZHTTPTool::instance ( ) [static]

Return a unique instance of the eZHTTPTool class.

Returns:
eZHTTPTool

Definition at line 211 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(), eZContentObjectStateGroup\fetchHTTPPersistentVariables(), eZContentObjectState\fetchHTTPPersistentVariables(), 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(), eZContentObjectEditHandler\validateInputHandlers(), eZPreferences\value(), and eZPreferences\values().

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

Definition at line 392 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 454 of file ezhttptool.php.

eZHTTPTool::postVariable ( var,
fallbackValue = null 
)
Returns:
the HTTP post variable $var, or $fallbackValue if the post variable does not exist , or null if $fallbackValue is omitted.
See also:
variable

Definition at line 72 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 608 of file ezhttptool.php.

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

static eZHTTPTool::removeMagicQuotes ( ) [static]

Definition at line 641 of file ezhttptool.php.

Referenced by eZHTTPTool().

eZHTTPTool::removeSessionVariable ( name)

Removes the session variable $name.

Definition at line 730 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 240 of file ezhttptool.php.

eZHTTPTool::sessionID ( )
Returns:
the session id

Definition at line 754 of file ezhttptool.php.

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

Definition at line 746 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 63 of file ezhttptool.php.

eZHTTPTool::setSessionKey ( sessionKey)

Definition at line 717 of file ezhttptool.php.

eZHTTPTool::setSessionVariable ( name,
value 
)

Definition at line 722 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 429 of file ezhttptool.php.

eZHTTPTool::variable ( var,
fallbackValue = null 
)
Returns:
the HTTP post/get variable $var, or $fallbackValue if the post/get variable does not exist , or null if $fallbackValue is omitted.
See also:
postVariable

Definition at line 154 of file ezhttptool.php.


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