|
Moodle
2.2.1
http://www.collinsharper.com
|
Public Member Functions | |
| __construct ($url, array $params=null) | |
| params (array $params=null) | |
| remove_params ($params=null) | |
| remove_all_params ($params=null) | |
| param ($paramname, $newvalue= '') | |
| get_query_string ($escaped=true, array $overrideparams=null) | |
| __toString () | |
| out ($escaped=true, array $overrideparams=null) | |
| out_omit_querystring ($includeanchor=false) | |
| compare (moodle_url $url, $matchtype=URL_MATCH_EXACT) | |
| set_anchor ($anchor) | |
| set_slashargument ($path, $parameter= 'file', $supported=NULL) | |
Static Public Member Functions | |
| static | make_file_url ($urlbase, $path, $forcedownload=false) |
| static | make_pluginfile_url ($contextid, $component, $area, $itemid, $pathname, $filename, $forcedownload=false) |
| static | make_draftfile_url ($draftid, $pathname, $filename, $forcedownload=false) |
| static | make_legacyfile_url ($courseid, $filepath, $forcedownload=false) |
Protected Member Functions | |
| merge_overrideparams (array $overrideparams=null) | |
Protected Attributes | |
| $scheme = '' | |
| $host = '' | |
| $port = '' | |
| $user = '' | |
| $pass = '' | |
| $path = '' | |
| $slashargument = '' | |
| $anchor = null | |
| $params = array() | |
Definition at line 235 of file weblib.php.
| __construct | ( | $ | url, |
| array $ | params = null |
||
| ) |
Create new instance of moodle_url.
| moodle_url | string | $url | - moodle_url means make a copy of another moodle_url and change parameters, string means full url or shortened form (ex.: '/course/view.php'). It is strongly encouraged to not include query string because it may result in double encoded values. Use the $params instead. For admin URLs, just use /admin/script.php, this class takes care of the $CFG->admin issue. |
| array | $params | these params override current params or add new |
Definition at line 293 of file weblib.php.

| __toString | ( | ) |
Shortcut for printing of encoded URL.
Definition at line 490 of file weblib.php.

| compare | ( | moodle_url $ | url, |
| $ | matchtype = URL_MATCH_EXACT |
||
| ) |
Compares this moodle_url with another See documentation of constants for an explanation of the comparison flags.
| moodle_url | $url | The moodle_url object to compare |
| int | $matchtype | The type of comparison (URL_MATCH_BASE, URL_MATCH_PARAMS, URL_MATCH_EXACT) |
Definition at line 549 of file weblib.php.

| get_query_string | ( | $ | escaped = true, |
| array $ | overrideparams = null |
||
| ) |
Get the params as as a query string. This method should not be used outside of this method.
| boolean | $escaped | Use & as params separator instead of plain & |
| array | $overrideparams | params to add to the output params, these override existing ones with the same name. |
Definition at line 469 of file weblib.php.


| static make_draftfile_url | ( | $ | draftid, |
| $ | pathname, | ||
| $ | filename, | ||
| $ | forcedownload = false |
||
| ) | [static] |
Factory method for creation of url pointing to draft file of current user.
| int | $draftid | draft item id |
| string | $pathname | |
| string | $filename | |
| bool | $forcedownload |
Definition at line 698 of file weblib.php.


| static make_file_url | ( | $ | urlbase, |
| $ | path, | ||
| $ | forcedownload = false |
||
| ) | [static] |
General moodle file url.
| string | $urlbase | the script serving the file |
| string | $path | |
| bool | $forcedownload |
Definition at line 652 of file weblib.php.

| static make_legacyfile_url | ( | $ | courseid, |
| $ | filepath, | ||
| $ | forcedownload = false |
||
| ) | [static] |
Factory method for creating of links to legacy course files.
| int | $courseid | |
| string | $filepath | |
| bool | $forcedownload |
Definition at line 714 of file weblib.php.

| static make_pluginfile_url | ( | $ | contextid, |
| $ | component, | ||
| $ | area, | ||
| $ | itemid, | ||
| $ | pathname, | ||
| $ | filename, | ||
| $ | forcedownload = false |
||
| ) | [static] |
Factory method for creation of url pointing to plugin file. Please note this method can be used only from the plugins to create urls of own files, it must not be used outside of plugins!
| int | $contextid | |
| string | $component | |
| string | $area | |
| int | $itemid | |
| string | $pathname | |
| string | $filename | |
| bool | $forcedownload |
Definition at line 679 of file weblib.php.


| merge_overrideparams | ( | array $ | overrideparams = null | ) | [protected] |
Merges parameters and validates them
| array | $overrideparams |
Definition at line 442 of file weblib.php.


Output url
If you use the returned URL in HTML code, you want the escaped ampersands. If you use the returned URL in HTTP headers, you want $escaped=false.
| boolean | $escaped | Use & as params separator instead of plain & |
| array | $overrideparams | params to add to the output url, these override existing ones with the same name. |
Definition at line 504 of file weblib.php.


| out_omit_querystring | ( | $ | includeanchor = false | ) |
Returns url without parameters, everything before '?'.
| bool | $includeanchor | if self::anchor is defined, should it be returned? |
Definition at line 528 of file weblib.php.

| param | ( | $ | paramname, |
| $ | newvalue = '' |
||
| ) |
Add a param to the params for this url.
The added param overrides existing one if they have the same name.
| string | $paramname | name |
| string | $newvalue | Param value. If new value specified current value is overriden or parameter is added |
Definition at line 425 of file weblib.php.


Add an array of params to the params for this url.
The added params override existing ones if they have the same name.
| array | $params | Defaults to null. If null then returns all params. |
Definition at line 365 of file weblib.php.

| remove_all_params | ( | $ | params = null | ) |
Remove all url parameters
| $params |
Definition at line 411 of file weblib.php.

| remove_params | ( | $ | params = null | ) |
Remove all params if no arguments passed. Remove selected params if arguments are passed.
Can be called as either remove_params('param1', 'param2') or remove_params(array('param1', 'param2')).
| mixed | $params | either an array of param names, or a string param name, |
| string | $params,... | any number of additional param names. |
Definition at line 396 of file weblib.php.


| set_anchor | ( | $ | anchor | ) |
Sets the anchor for the URI (the bit after the hash)
| string | $anchor | null means remove previous |
Definition at line 601 of file weblib.php.

| set_slashargument | ( | $ | path, |
| $ | parameter = 'file', |
||
| $ | supported = NULL |
||
| ) |
Sets the url slashargument value
| string | $path | usually file path |
| string | $parameter | name of page parameter if slasharguments not supported |
| bool | $supported | usually null, then it depends on $CFG->slasharguments, use true or false for other servers |
Definition at line 624 of file weblib.php.

$anchor = null [protected] |
Definition at line 275 of file weblib.php.
$host = '' [protected] |
Definition at line 245 of file weblib.php.
Definition at line 280 of file weblib.php.
$pass = '' [protected] |
Definition at line 260 of file weblib.php.
$path = '' [protected] |
Definition at line 265 of file weblib.php.
$port = '' [protected] |
Definition at line 250 of file weblib.php.
$scheme = '' [protected] |
Definition at line 240 of file weblib.php.
$slashargument = '' [protected] |
Definition at line 270 of file weblib.php.
$user = '' [protected] |
Definition at line 255 of file weblib.php.