jUrl

Extends \jUrlBase

Object that contains url data, and which provides static method helpers

package

jelix

subpackage

core_url

author

Laurent Jouanneau (for the original code from Copix and enhancement for jelix)

author

Gerald Croes (for the original code from Copix)

contributor

Loic Mathaud

contributor

Thibault Piront (nuKs)

Methods

constructor

__construct(string $scriptname = '', array $params = array(), string $pathInfo = '') 

Arguments

$scriptname

string

script name

$params

array

parameters

$pathInfo

string

path info contents

magic method for echo and others.

__toString() 
inherited

..

Adds parameters to the given url

appendToUrlString(string $url, array $params = array(), boolean $forxml = false) : string
static

Arguments

$url

string

an URL

$params

array

some parameters to append to the url

$forxml

boolean

if true, escape some characters to include the url into an html/xml document

Response

string

the url

Clear parameters

clearParam() 
inherited

delete a parameter

delParam(string $name) 
inherited

Arguments

$name

string

parameter name

escape and simplier a string to be a part of an url path remove or replace not allowed characters etc.

escape(string $str, boolean $highlevel = false) : string
static

.

Arguments

$str

string

the string to escape

$highlevel

boolean

false : just to a urlencode. true, replace some characters

Response

string

escaped string

Gets the url corresponding to an action, in the given format

get(string $actSel, array $params = array(), integer $what) : mixed
static

Arguments

$actSel

string

action selector. You can use # instead of the module or the action name, to specify the current url.

$params

array

associative array with the parameters

$what

integer

the format you want : one of the jUrl const, STRING XMLSTRING JURL JURLACTION

Response

mixed

a value, depending of the $what parameter

returns the current Url.

getCurrentUrl(boolean $forxml = false,  $full = false) : string
static

The URL is the URL for the frontend HTTP server, if your app is behind a proxy.

Arguments

$forxml

boolean

if true, escape some characters to include the url into an html/xml document

$full

Response

string

the url

Gets the absolute url corresponding to an action, in the given format with the domainName in defaultConfig or current

getFull(string $actSel, array $params = array(), integer $what, string $domainName = null) : string
static
Throws
\jException

Arguments

$actSel

string

action selector. You can use # instead of the module or the action name, to specify the current url.

$params

array

associative array with the parameters

$what

integer

the format you want : only jUrl::STRING or jUrl::XMLSTRING

$domainName

string

Customized domain name

Response

string

the url string

get a parameter value

getParam(string $name, string $defaultValue = null) : string
inherited

Arguments

$name

string

parameter name

$defaultValue

string

the default value returned if the parameter doesn't exists

Response

string

the value

get the path part of the url (scriptName + pathinfo)

getPath() : string
since 1.0.4

Response

string

get the query part of the url

getQuery(boolean $forxml = false) : string
since 1.0.4

Arguments

$forxml

boolean

true: some characters will be escaped

Response

string

get the root url for a given ressource type. Root URLs are stored in config file.

getRootUrl(string $ressourceType) : string
static

Arguments

$ressourceType

string

Name of the ressource

Response

string

the root URL corresponding to this ressource, or basePath if unknown

get the config value of an item in [rootUrls] section of config

getRootUrlRessourceValue(string $ressourceType) : string
static

Arguments

$ressourceType

string

Name of the ressource

Response

string

the config value of this value, null if it does not exist

Parse a url

parse(string $scriptNamePath, string $pathinfo, array $params) : \jUrlAction
static

Arguments

$scriptNamePath

string

/path/index.php

$pathinfo

string

the path info of the url.

$params

array

url parameter ($_REQUEST)

Response

\jUrlAction

add or change the value of a parameter

setParam(string $name, string $value) 
inherited

Arguments

$name

string

parameter name

$value

string

parameter value

get the url string corresponding to the url/action

toString(boolean $forxml = false) : string
inherited abstract

Arguments

$forxml

boolean

true: some characters will be escaped

Response

string

perform the opposit of escape

unescape(string $str) : string
static

Arguments

$str

string

the string to escape

Response

string

Constants

STRING

STRING

XMLSTRING

XMLSTRING

JURL

JURL

JURLACTION

JURLACTION

Properties

script name including its path

scriptName : string
var

Type(s)

string

path info part of the url

pathInfo : string
var

Type(s)

string

parameters

params : 
inherited

Type(s)