eZ Publish  [trunk]
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 ()
 Return the session id.
 getVariable ($var, $fallbackValue=null)
 hasAttribute ($attr)
 hasGetVariable ($var)
 hasPostVariable ($var)
 hasSessionVariable ($name, $forceStart=true)
 Check if session variable $name exists.
 hasVariable ($var)
 postVariable ($var, $fallbackValue=null)
 removeSessionVariable ($name)
 Unset the session variable $name.
 sessionID ()
 Return the session id.
sessionVariable ($name, $fallbackValue=null)
 Get session variable $name.
 setGetVariable ($var, $value)
 setPostVariable ($var, $value)
 setSessionID ($sessionKey)
 Sets a new session id.
 setSessionKey ($sessionKey)
 Sets a new session id.
 setSessionVariable ($name, $value)
 Sets the session variable $name to value $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=false, $postParameters=false, $userAgent= 'eZ Publish', $passthrough=true, array $cookies=array())
 Sends a http request to the specified host.
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 23 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 172 of file ezhttptool.php.

Returns:
the attributes for this object.

Definition at line 156 of file ezhttptool.php.

Referenced by hasAttribute().

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 490 of file ezhttptool.php.

Referenced by redirect().

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

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

Referenced by eZRSSImport\getRSSVersion(), and eZStaticCache\storeCache().

Return the session id.

Deprecated:
Since 4.4, use ->sessionID instead!
Returns:
string

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

Returns:
true if the attribute $attr exist.

Definition at line 164 of file ezhttptool.php.

Returns:
true if the HTTP get variable $var exist.
See also:
hasVariable

Definition at line 108 of file ezhttptool.php.

Returns:
true if the HTTP post variable $var exist.
See also:
hasVariable

Definition at line 71 of file ezhttptool.php.

Referenced by eZHTTPPersistence\fetchElement(), eZHTTPPersistence\handleCheckedElement(), eZBinaryFileType\isDeletingFile(), and eZHTTPPersistence\splitSelected().

eZHTTPTool::hasSessionVariable ( name,
forceStart = true 
)

Check if session variable $name exists.

Parameters:
string$name
bool$forceStartForce session start if true (default)
Returns:
bool|null Null if session has not started and $forceStart is false

Definition at line 755 of file ezhttptool.php.

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

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

Referenced by redirect().

static eZHTTPTool::instance ( ) [static]

Return a unique instance of the eZHTTPTool class.

Returns:
eZHTTPTool

Definition at line 191 of file ezhttptool.php.

Referenced by eZModule\actionParameter(), eZShopOperationCollection\activateOrder(), eZURLOperator\applyQuotes(), eZContentBrowse\browse(), eZSearch\buildSearchArray(), eZContentClass\canInstantiateClassList(), checkNodeActions(), checkNodeAssignments(), checkNodeMovements(), checkRelationActions(), checkRelationAssignments(), eZContentUpload\cleanup(), eZContentUpload\cleanupAll(), eZTemplateCompiler\compilationFilename(), eZWizardBaseClassLoader\createClass(), createRedirectUrl(), eZModule\currentAction(), eZBasket\currentBasket(), eZWishList\currentWishList(), eZCollaborationItemHandler\customInput(), eZObjectRelationListType\customObjectAttributeHTTPAction(), datatypeBasicFetchData(), datatypeDescribeFetchData(), eZMultiOption2Type\editTemplate(), eZContentObjectEditHandler\executeInputHandlers(), eZRole\expireCache(), eZCheckUser(), eZContentBrowse\eZContentBrowse(), eZContentUpload\eZContentUpload(), eZSetupCheckExecutable(), eZSetupFetchPersistenceList(), eZSetupRunTests(), eZSetupSetPersistencePostVariable(), eZWizardBase\eZWizardBase(), eZDefaultShopAccountHandler\fetchAccountInformation(), eZShopFunctionCollection\fetchBasket(), eZContentObjectStateGroup\fetchHTTPPersistentVariables(), eZContentObjectState\fetchHTTPPersistentVariables(), eZUserDiscountRule\fetchIDListByUserID(), eZContentObject\fetchInput(), eZContentObject\fixupInput(), eZPaymentGatewayType\getCurrentGatewayType(), getDataByURL(), getHTTPVariable(), eZContentObject\handleAllCustomHTTPActions(), eZContentObject\handleCustomHTTPActions(), eZModule\hasActionParameter(), eZCollaborationItemHandler\hasCustomInput(), eZCollaborationItemHandler\isCustomAction(), eZPreferences\isStoredInSession(), eZURLOperator\modify(), password(), processDropdownLimitations(), ezpMobileDeviceRegexpFilter\redirect(), eZRedirectManager\redirectURI(), eZContentBrowse\result(), sectionEditActionCheck(), eZPreferences\sessionCleanup(), eZContentUpload\setResult(), stateEditActionCheck(), eZModuleOperationInfo\storeBodyMemento(), eZPreferences\storedSessionValue(), eZPreferences\storeInSession(), storeNodeAssignments(), templateOperatorBasicFetchData(), templateOperatorDescribeFetchData(), eZContentUpload\upload(), eZURLOperator\urlTransformation(), username(), eZContentObject\validateInput(), eZContentObjectEditHandler\validateInputHandlers(), eZPreferences\value(), and eZPreferences\values().

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

Definition at line 386 of file ezhttptool.php.

Referenced by eZStepSiteTypes\downloadFile(), and eZECBHandler\requestRates().

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 448 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 52 of file ezhttptool.php.

Referenced by eZHTTPPersistence\fetchElement(), eZHTTPPersistence\handleCheckedElement(), eZBinaryFileType\isDeletingFile(), and eZHTTPPersistence\splitSelected().

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 602 of file ezhttptool.php.

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

static eZHTTPTool::removeMagicQuotes ( ) [static]

Definition at line 635 of file ezhttptool.php.

Referenced by eZHTTPTool().

Unset the session variable $name.

Parameters:
string$name
Returns:
bool

Definition at line 743 of file ezhttptool.php.

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

Sends a http request to the specified host.

Using https:// requires compiled in OpenSSL support.

Parameters:
string$urihttp/https address or only path to send request to current eZ Publish instance examples: http://ez.no, https://secure.ez.no or content/view/full/2
int | false$portWhich port to connect to, default 80, uses port in $uri if present when $port = false
array | false$postParametersOptional post parameters array, if no post parameters are present, a GET request will be sent
string$userAgentUser agent string, default will be 'eZ Publish'
bool$passthroughWill send result directly to client, default: true
array$cookiesOptional hash of cookie name => values to add to http header
Returns:
string|false String if http request, or false if an error occurs. If $passthrough = true, program will end here and send result directly to client.

Definition at line 216 of file ezhttptool.php.

Referenced by eZStepSiteTypes\downloadFile(), and eZECBHandler\requestRates().

Return the session id.

Returns:
string

Definition at line 778 of file ezhttptool.php.

& eZHTTPTool::sessionVariable ( name,
fallbackValue = null 
)

Get session variable $name.

Parameters:
string$name
mixed$fallbackValueReturn this if session has not started OR name is undefined if null(default), then force start session and return null if undefined.
Returns:
mixed ByRef

Definition at line 768 of file ezhttptool.php.

eZHTTPTool::setGetVariable ( var,
value 
)

Sets the get variable $var to $value.

See also:
getVariable

Definition at line 80 of file ezhttptool.php.

eZHTTPTool::setPostVariable ( var,
value 
)

Sets the post variable $var to $value.

See also:
postVariable

Definition at line 43 of file ezhttptool.php.

eZHTTPTool::setSessionID ( sessionKey)

Sets a new session id.

Parameters:
string$sessionKeyAllowed characters in the range a-z A-Z 0-9 , (comma) and - (minus)
Returns:
string Current(old) session id

Definition at line 789 of file ezhttptool.php.

eZHTTPTool::setSessionKey ( sessionKey)

Sets a new session id.

Deprecated:
Since 4.4, use ->setSessionID instead!
Parameters:
string$sessionKeyAllowed characters in the range a-z A-Z 0-9 , (comma) and - (minus)
Returns:
string Current(old) session id

Definition at line 721 of file ezhttptool.php.

eZHTTPTool::setSessionVariable ( name,
value 
)

Sets the session variable $name to value $value.

Parameters:
string$name
mixed$value

Definition at line 732 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 423 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 134 of file ezhttptool.php.


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