This is the API docs for LemonStand V1, which has been discontinued. LemonStand is now a cloud based platform, available at lemonstand.com.

LemonStand API

Phpr_Request class

Defined in /phproad/modules/phpr/classes/phpr_request.php, lines 13-610
Author LemonStand eCommerce Inc.
Incapsulates information about the HTTP request. An instance of this class is always available through the $Phpr class and you never need to create it manually:
$ip = Phpr::$request->getUserIp();
Use this class for reading GET or POST values from the request, loading cookie information, obtaining the visitor's IP address, etc.

See Also

Public methods

Method Description Defined By
cookie() returns a cookie value by the cookie name. Phpr_Request
getField() returns a named GET parameter value. Phpr_Request
getRequestMethod() returns the current request method name - POST, GET, HEAD or PUT. Phpr_Request
getUserAgent() returns a name of the User Agent. Phpr_Request
getUserIp() returns the visitor's IP address. Phpr_Request
port() returns HTTP port number. Phpr_Request
post() returns a named POST parameter value. Phpr_Request
post_array_item() finds an array in the POST data then finds and returns an element inside this array. Phpr_Request
protocol() returns HTTP protocol name - http or https. Phpr_Request

Method details

cookie() method

public mixed cookie(string $name)
$name string specifies the cookie name.
{return} mixed returns either cookie value or NULL.
Returns a cookie value by the cookie name. If a cookie with the specified name does not exist, returns NULL.

getField() method

public mixed getField(string $name, mixed $default=false)
$name string specifies the parameter name.
$default mixed specifies a default value.
{return} mixed returns the GET parameter value, NULL or default value.
Returns a named GET parameter value.

See Also

getRequestMethod() method

public string getRequestMethod()
{return} string returns the request method name.
Returns the current request method name - POST, GET, HEAD or PUT.

getUserAgent() method

public mixed getUserAgent()
{return} mixed returns the user agent name or NULL.
Returns a name of the User Agent. If user agent data is not available, returns NULL.

getUserIp() method

public string getUserIp()
{return} string returns the IP address.
Returns the visitor's IP address.

port() method

public integer port()
{return} integer returns HTTP port number.
Returns HTTP port number. If STANDARD_HTTP_PORTS parameter is set to TRUE in config.php file, the method returns NULL.

post() method

public mixed post(string $name, mixed $default=NULL)
$name string specifies the parameter name.
$default mixed specifies a default value.
{return} mixed returns the POST parameter value, NULL or default value.
Returns a named POST parameter value. If a parameter with the specified name does not exist in POST, returns NULL or a value specified in the $default parameter.

See Also

post_array_item() method

public mixed post_array_item(string $array_name, string $name, mixed $default=NULL)
$array_name string specifies the array element name in the POST data.
$name string specifies the array element key in the first array.
$default mixed specifies a default value.
{return} mixed returns the found array element value or the default value.
Finds an array in the POST data then finds and returns an element inside this array. If the array or the element do not exist, returns null or a value specified in the $default parameter.
This method is useful for extracting form field values if you use array notation for the form input element names. For example, if you have a form with the following fields
<input type="text" name="customer_form[first_name]">
<input type="text" name="customer_form[last_name]">
you can extract the first name field value with the following code:
$first_name = Phpr::$request->post_array_item('customer_form', 'first_name')

protocol() method

public string protocol()
{return} string returns HTTP protocol name.
Returns HTTP protocol name - http or https.