KWeb
6.4
|
Web Request information. More...
Public Member Functions | |
__destruct () | |
__clone () | |
isMain () | |
Returns true if this request is the main request. | |
applyOptions (array $options) | |
Applies options that change Requests's properties. | |
setMethod ($method=null, $urlData=null, $data=null) | |
Sets request method as Get or Post. | |
setType ($type) | |
setUrlData (array $data, $detectPathParams=true) | |
Sets data passed with URL. | |
copyRequest (KWebRequest $request) | |
Copies parameters from another request. | |
configureTypeHandling () | |
Sets up everything, for handling current type... | |
getType () | |
getCategory () | |
getBaseCategory () | |
getData ($name=false, $default=null, $useUrlData=true) | |
Returns data associated with this request (typically equivallent of $_GET or $_POST) | |
getAllData () | |
Returns all data associated with this request. | |
getResult () | |
getObject ($object=true) | |
Returns object associated with this request, or False if no object is associated. | |
setObject ($object) | |
Sets object id/genre for this request. | |
getTemplate ($returnValid=false) | |
Returns template path. | |
isFallback () | |
If objectId was specified, but the object wasn't found, fallback template is used... | |
getView () | |
getLanguage ($returnActive=false) | |
Returns language. | |
getItemPath ($expand, $object=true) | |
Zwraca ścieżkę otwarcia jako nazwa1/nazwa2/nazwa3 lub listę obiektów ... | |
getUrlParams ($skip=null, $include=null) | |
Returns all url data in a way, that will preserve params encoded in the path... | |
getOptions () | |
getSignature ($domain=true, $language=true, $requestType=true, $userGroup=true, $user=false) | |
Returns information that differentiates this request from others. | |
isJSON () | |
isAJAX () | |
isHTML () | |
isXML () | |
isImage () | |
isIndex () | |
isEdit () | |
parseUrlPath (array $path, array $pathParams) | |
Parses URL path, filling the request This function should be called when request is already prepared, filled with url, lang, urlData and so on. | |
runRequest () | |
Runs the request, and prints the output. | |
getUrl (array $data=null, $dataOverride=false, $lang=false, array $options=array()) | |
Returns url of this request modified with provided options. | |
buildUrl () | |
Builds url for this request. | |
buildUrlQuery ($params, &$pathQuery=null, array $pathParams=array(), $lang=false) | |
Builds URL queries. | |
pathUrlEncode ($value) | |
pathUrlDecode ($value) | |
getOpenedObjects ($asObject) | |
Returns a list of currently opened object and it's parents (if it's KWebItem) | |
setResult ($result) | |
Static Public Member Functions | |
static | createNew ($type, $category=self::CATEGORY_DEFAULT) |
Creates new KWebRequest object. | |
static | createNewFromOptions ($category, $params=null, $lang=false, array $options=array()) |
static | createNewFromAnother (KWebRequest $request, $type=false) |
static | pushCurrent ($request) |
static | popCurrent () |
static | get ($mainRequest=false) |
Return request object. | |
static | getCurrent () |
static | getMain () |
Returns main request. | |
static | getCurrentType () |
Return current request's type safely. | |
static | data ($name=false, $default=null, $useUrlData=true) |
Returns data associated with current request (typically equivallent of $_GET or $_POST) | |
Data Fields | |
const | EVENT_BUILD_URL = "kweb.request.build_url" |
const | TYPE_HTML = 'html' |
const | TYPE_AJAX = 'ajax' |
const | TYPE_JSON = 'json' |
const | TYPE_XML = 'xml' |
const | TYPE_IMAGE = 'image' |
const | TYPE_CMDLINE = 'cmdline' |
const | TYPE_FRAME = 'frame' |
const | TYPE_EMPTY = 'empty' |
const | CATEGORY_DEFAULT = false |
Category is yet unknown. | |
const | CATEGORY_OBJECT = 'object' |
Request for view of the object. | |
const | CATEGORY_PAGE = 'page' |
Request for page (inc file) | |
$type | |
$data = array() | |
Data passed in GET or POST. | |
$urlData = array() | |
Data passed in GET. | |
const | METHOD_GET = 'get' |
const | METHOD_POST = 'post' |
$method = 'get' | |
$url | |
$urlView | |
view passed in URL | |
$urlPath | |
path passed in URL (without language and control segments) | |
$urlLang | |
lang passed in URL | |
$urlPathParams = array() | |
data parameters passed in URL's path | |
$urlSpecialData = array() | |
special data used during url building | |
$urlExtension | |
$urlHash | |
$view | |
object view | |
$lang | |
language | |
$objectId | |
object id | |
$objectGenre | |
object genre | |
$template | |
template - shouldn't be used if objectId is not empty, may be used as a failsafe if objectId is set, but object doesn't exist | |
$itemPath | |
active item's path | |
$callback | |
function to run this request function(KWebRequest $request) | |
$options = array() | |
Additional request options (e.g. | |
$result = null | |
Result of this request... | |
Static Public Attributes | |
static | $current = null |
static | $main = null |
static | $stack = array() |
Protected Member Functions | |
__construct ($type, $category) | |
parseUrlData (array $pathParams) | |
buildRequestUri () | |
buildPageUri ($inc, $lang) | |
Builds URI (not URL!) for pages. | |
buildObjectUri ($genre, $itemId, $view, $lang) | |
Protected Attributes | |
$category | |
$object = false | |
$itemPathExpanded |
Web Request information.
KWebRequest::__construct | ( | $ | type, |
$ | category | ||
) | [protected] |
KWebRequest::__destruct | ( | ) |
KWebRequest::__clone | ( | ) |
KWebRequest::applyOptions | ( | array $ | options | ) |
Applies options that change Requests's properties.
KWebRequest::buildObjectUri | ( | $ | genre, |
$ | itemId, | ||
$ | view, | ||
$ | lang | ||
) | [protected] |
KWebRequest::buildPageUri | ( | $ | inc, |
$ | lang | ||
) | [protected] |
Builds URI (not URL!) for pages.
KWebRequest::buildRequestUri | ( | ) | [protected] |
KWebRequest::buildUrl | ( | ) |
Builds url for this request.
KWebRequest::buildUrlQuery | ( | $ | params, |
&$ | pathQuery = null , |
||
array $ | pathParams = array() , |
||
$ | lang = false |
||
) |
Builds URL queries.
$params | - list of parameters as key => value. If key is prefixed with '/' then it's put into $pathQuery |
$pathQuery | - reference to string to write pathQuery into (query encoded in path like: "index,name-value.html") |
$pathParams | - list of parameter values which should be put into $pathQuery |
KWebRequest::configureTypeHandling | ( | ) |
Sets up everything, for handling current type...
Types are configured using template files in _config/request_TYPENAME.inc Typical template discovery rules do apply, allowing for different configurations for different sections of the website.
KWebRequest::copyRequest | ( | KWebRequest $ | request | ) |
Copies parameters from another request.
static KWebRequest::createNew | ( | $ | type, |
$ | category = self::CATEGORY_DEFAULT |
||
) | [static] |
Creates new KWebRequest object.
string | $type | Type of the request/response ie. TYPE_HTML, TYPE_AJAX |
string | $category | Category of the request. Class is discovered using category. Using FALSE will assume default request (object or page) |
static KWebRequest::createNewFromAnother | ( | KWebRequest $ | request, |
$ | type = false |
||
) | [static] |
static KWebRequest::createNewFromOptions | ( | $ | category, |
$ | params = null , |
||
$ | lang = false , |
||
array $ | options = array() |
||
) | [static] |
static KWebRequest::data | ( | $ | name = false , |
$ | default = null , |
||
$ | useUrlData = true |
||
) | [static] |
Returns data associated with current request (typically equivallent of $_GET or $_POST)
$name | |
$default |
static KWebRequest::get | ( | $ | mainRequest = false | ) | [static] |
Return request object.
KWebRequest::getAllData | ( | ) |
Returns all data associated with this request.
KWebRequest::getBaseCategory | ( | ) |
KWebRequest::getCategory | ( | ) |
static KWebRequest::getCurrent | ( | ) | [static] |
static KWebRequest::getCurrentType | ( | ) | [static] |
Return current request's type safely.
KWebRequest::getData | ( | $ | name = false , |
$ | default = null , |
||
$ | useUrlData = true |
||
) |
Returns data associated with this request (typically equivallent of $_GET or $_POST)
$name | |
$default | |
$useUrlData | - TRUE - return from urlData if data is unavailable |
KWebRequest::getItemPath | ( | $ | expand, |
$ | object = true |
||
) |
Zwraca ścieżkę otwarcia jako nazwa1/nazwa2/nazwa3 lub listę obiektów ...
$expand | bool Jeżeli jest true, zwraca pełną listę obiektów (razem z rodzicami pierwszego elementu ścieżki) |
KWebRequest::getLanguage | ( | $ | returnActive = false | ) |
Returns language.
$returnActive | - TRUE - Returns language, FALSE - return language only if it was passed to url |
static KWebRequest::getMain | ( | ) | [static] |
Returns main request.
KWebRequest::getObject | ( | $ | object = true | ) |
Returns object associated with this request, or False if no object is associated.
If objectId is set, but object doesn't exist, null is returned.
KWebRequest::getOpenedObjects | ( | $ | asObject | ) |
Returns a list of currently opened object and it's parents (if it's KWebItem)
$asObject |
KWebRequest::getOptions | ( | ) |
KWebRequest::getResult | ( | ) |
KWebRequest::getSignature | ( | $ | domain = true , |
$ | language = true , |
||
$ | requestType = true , |
||
$ | userGroup = true , |
||
$ | user = false |
||
) |
Returns information that differentiates this request from others.
To be used with CacheBlock, or anywhere where unique signature of a request is needed...
The returned value DOESN't contain current URI, GET/POST/COOKIE values, view or item ids.
$domain | |
$language | |
$requestType | |
$userGroup | |
$user |
KWebRequest::getTemplate | ( | $ | returnValid = false | ) |
Returns template path.
Controller should always set some fallback template path, even if request seems to be an object.
$returnValid | - returns only valid template paths |
KWebRequest::getType | ( | ) |
KWebRequest::getUrl | ( | array $ | data = null , |
$ | dataOverride = false , |
||
$ | lang = false , |
||
array $ | options = array() |
||
) |
Returns url of this request modified with provided options.
Always operates on the clone of this request object!
Returns all url data in a way, that will preserve params encoded in the path...
$skip | Parameters to skip or null |
$include | Parameters to include, null, or TRUE to include only urlPathParams |
KWebRequest::getView | ( | ) |
KWebRequest::isAJAX | ( | ) |
KWebRequest::isEdit | ( | ) |
KWebRequest::isFallback | ( | ) |
If objectId was specified, but the object wasn't found, fallback template is used...
KWebRequest::isHTML | ( | ) |
KWebRequest::isImage | ( | ) |
KWebRequest::isIndex | ( | ) |
KWebRequest::isJSON | ( | ) |
KWebRequest::isMain | ( | ) |
Returns true if this request is the main request.
KWebRequest::isXML | ( | ) |
KWebRequest::parseUrlData | ( | array $ | pathParams | ) | [protected] |
KWebRequest::parseUrlPath | ( | array $ | path, |
array $ | pathParams | ||
) |
Parses URL path, filling the request This function should be called when request is already prepared, filled with url, lang, urlData and so on.
This function can use self::$url instead of relying on $path and $pathParams.
$path | Filtered Array of path segments (delimited with '/') |
$pathParams | Array of path parameters (delimited with ',') |
KWebRequest::pathUrlDecode | ( | $ | value | ) |
KWebRequest::pathUrlEncode | ( | $ | value | ) |
static KWebRequest::popCurrent | ( | ) | [static] |
static KWebRequest::pushCurrent | ( | $ | request | ) | [static] |
KWebRequest::runRequest | ( | ) |
Runs the request, and prints the output.
Sets request method as Get or Post.
$method | - GET or POST. If NULL the method will be read from $_SERVER['REQUEST_METHOD'] |
$urlData | - data passed in GET parameters as array or string. If NULL current request's data will be set. |
$data | - data passed in GET or POST depending on request method as array or string. If NULL current request's data will be set. |
KWebRequest::setObject | ( | $ | object | ) |
Sets object id/genre for this request.
$object | You may pass KWebObject, UID, or FALSE |
KWebRequest::setResult | ( | $ | result | ) |
KWebRequest::setType | ( | $ | type | ) |
KWebRequest::setUrlData | ( | array $ | data, |
$ | detectPathParams = true |
||
) |
Sets data passed with URL.
$data | as array(key => value) |
KWebRequest::$callback |
function to run this request function(KWebRequest $request)
KWebRequest::$category [protected] |
KWebRequest::$current = null [static] |
KWebRequest::$data = array() |
Data passed in GET or POST.
KWebRequest::$itemPath |
active item's path
KWebRequest::$itemPathExpanded [protected] |
KWebRequest::$lang |
language
KWebRequest::$main = null [static] |
KWebRequest::$method = 'get' |
KWebRequest::$object = false [protected] |
KWebRequest::$objectGenre |
object genre
KWebRequest::$objectId |
object id
KWebRequest::$options = array() |
Additional request options (e.g.
KWeb::URL_*).
KWebRequest::$result = null |
Result of this request...
KWebRequest::$stack = array() [static] |
KWebRequest::$template |
template - shouldn't be used if objectId is not empty, may be used as a failsafe if objectId is set, but object doesn't exist
KWebRequest::$type |
KWebRequest::$url |
KWebRequest::$urlData = array() |
Data passed in GET.
KWebRequest::$urlExtension |
KWebRequest::$urlHash |
KWebRequest::$urlLang |
lang passed in URL
KWebRequest::$urlPath |
path passed in URL (without language and control segments)
KWebRequest::$urlPathParams = array() |
data parameters passed in URL's path
KWebRequest::$urlSpecialData = array() |
special data used during url building
KWebRequest::$urlView |
view passed in URL
KWebRequest::$view |
object view
const KWebRequest::CATEGORY_DEFAULT = false |
Category is yet unknown.
const KWebRequest::CATEGORY_OBJECT = 'object' |
Request for view of the object.
const KWebRequest::CATEGORY_PAGE = 'page' |
Request for page (inc file)
const KWebRequest::EVENT_BUILD_URL = "kweb.request.build_url" |
const KWebRequest::METHOD_GET = 'get' |
const KWebRequest::METHOD_POST = 'post' |
const KWebRequest::TYPE_AJAX = 'ajax' |
const KWebRequest::TYPE_CMDLINE = 'cmdline' |
const KWebRequest::TYPE_EMPTY = 'empty' |
const KWebRequest::TYPE_FRAME = 'frame' |
const KWebRequest::TYPE_HTML = 'html' |
const KWebRequest::TYPE_IMAGE = 'image' |
const KWebRequest::TYPE_JSON = 'json' |
const KWebRequest::TYPE_XML = 'xml' |