|
@@ -57,8 +57,8 @@ class Web {
|
|
|
|
|
|
/**
|
|
/**
|
|
Returns an Array of Strings built using GET / POST values.
|
|
Returns an Array of Strings built using GET / POST values.
|
|
- If you have in your URL the parameters [a[]=foo;a[]=hello;a[5]=bar;a[3]=baz] then
|
|
|
|
- [php.Web.getParamValues("a")] will return [["foo","hello",null,"baz",null,"bar"]]
|
|
|
|
|
|
+ If you have in your URL the parameters `a[]=foo;a[]=hello;a[5]=bar;a[3]=baz` then
|
|
|
|
+ `php.Web.getParamValues("a")` will return `["foo","hello",null,"baz",null,"bar"]`.
|
|
**/
|
|
**/
|
|
public static function getParamValues( param : String ) : Array<String> {
|
|
public static function getParamValues( param : String ) : Array<String> {
|
|
var reg = new EReg("^"+param+"(\\[|%5B)([0-9]*?)(\\]|%5D)=(.*?)$", "");
|
|
var reg = new EReg("^"+param+"(\\[|%5B)([0-9]*?)(\\]|%5D)=(.*?)$", "");
|
|
@@ -97,7 +97,7 @@ class Web {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- Returns the local server host name
|
|
|
|
|
|
+ Returns the local server host name.
|
|
**/
|
|
**/
|
|
public static inline function getHostName() : String {
|
|
public static inline function getHostName() : String {
|
|
return untyped __php__("$_SERVER['SERVER_NAME']");
|
|
return untyped __php__("$_SERVER['SERVER_NAME']");
|
|
@@ -111,7 +111,7 @@ class Web {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- Returns the original request URL (before any server internal redirections)
|
|
|
|
|
|
+ Returns the original request URL (before any server internal redirections).
|
|
**/
|
|
**/
|
|
public static function getURI() : String {
|
|
public static function getURI() : String {
|
|
var s : String = untyped __php__("$_SERVER['REQUEST_URI']");
|
|
var s : String = untyped __php__("$_SERVER['REQUEST_URI']");
|
|
@@ -119,7 +119,7 @@ class Web {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- Tell the client to redirect to the given url ("Location" header)
|
|
|
|
|
|
+ Tell the client to redirect to the given url ("Location" header).
|
|
**/
|
|
**/
|
|
public static function redirect( url : String ) {
|
|
public static function redirect( url : String ) {
|
|
untyped __call__('header', "Location: " + url);
|
|
untyped __call__('header', "Location: " + url);
|
|
@@ -134,7 +134,7 @@ class Web {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- Set the HTTP return code. Same remark as setHeader.
|
|
|
|
|
|
+ Set the HTTP return code. Same remark as `php.Web.setHeader()`.
|
|
See status code explanation here: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
|
|
See status code explanation here: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
|
|
**/
|
|
**/
|
|
public static function setReturnCode( r : Int ) {
|
|
public static function setReturnCode( r : Int ) {
|
|
@@ -220,7 +220,7 @@ class Web {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- Returns all the GET parameters String
|
|
|
|
|
|
+ Returns all the GET parameters `String`
|
|
**/
|
|
**/
|
|
public static function getParamsString() : String {
|
|
public static function getParamsString() : String {
|
|
if(untyped __call__("isset", __var__("_SERVER", "QUERY_STRING")))
|
|
if(untyped __call__("isset", __var__("_SERVER", "QUERY_STRING")))
|
|
@@ -234,8 +234,8 @@ class Web {
|
|
being application/x-www-form-urlencoded and is stored into
|
|
being application/x-www-form-urlencoded and is stored into
|
|
the getParams hashtable. POST Data is maximimized to 256K
|
|
the getParams hashtable. POST Data is maximimized to 256K
|
|
unless the content type is multipart/form-data. In that
|
|
unless the content type is multipart/form-data. In that
|
|
- case, you will have to use [getMultipart] or [parseMultipart]
|
|
|
|
- methods.
|
|
|
|
|
|
+ case, you will have to use `php.Web.getMultipart()` or
|
|
|
|
+ `php.Web.parseMultipart()` methods.
|
|
**/
|
|
**/
|
|
public static function getPostData() {
|
|
public static function getPostData() {
|
|
var h = untyped __call__("fopen", "php://input", "r");
|
|
var h = untyped __call__("fopen", "php://input", "r");
|
|
@@ -253,7 +253,8 @@ class Web {
|
|
|
|
|
|
/**
|
|
/**
|
|
Returns an hashtable of all Cookies sent by the client.
|
|
Returns an hashtable of all Cookies sent by the client.
|
|
- Modifying the hashtable will not modify the cookie, use setCookie instead.
|
|
|
|
|
|
+ Modifying the hashtable will not modify the cookie, use `php.Web.setCookie()`
|
|
|
|
+ instead.
|
|
**/
|
|
**/
|
|
public static function getCookies():Map<String,String> {
|
|
public static function getCookies():Map<String,String> {
|
|
return Lib.hashOfAssociativeArray(untyped __php__("$_COOKIE"));
|
|
return Lib.hashOfAssociativeArray(untyped __php__("$_COOKIE"));
|
|
@@ -261,7 +262,7 @@ class Web {
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
- Set a Cookie value in the HTTP headers. Same remark as setHeader.
|
|
|
|
|
|
+ Set a Cookie value in the HTTP headers. Same remark as `php.Web.setHeader()`.
|
|
**/
|
|
**/
|
|
public static function setCookie( key : String, value : String, ?expire: Date, ?domain: String, ?path: String, ?secure: Bool, ?httpOnly: Bool ) {
|
|
public static function setCookie( key : String, value : String, ?expire: Date, ?domain: String, ?path: String, ?secure: Bool, ?httpOnly: Bool ) {
|
|
var t = expire == null ? 0 : Std.int(expire.getTime()/1000.0);
|
|
var t = expire == null ? 0 : Std.int(expire.getTime()/1000.0);
|
|
@@ -316,9 +317,9 @@ class Web {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- Parse the multipart data. Call [onPart] when a new part is found
|
|
|
|
|
|
+ Parse the multipart data. Call `onPart` when a new part is found
|
|
with the part name and the filename if present
|
|
with the part name and the filename if present
|
|
- and [onData] when some part data is readed. You can this way
|
|
|
|
|
|
+ and `onData` when some part data is readed. You can this way
|
|
directly save the data on hard drive in the case of a file upload.
|
|
directly save the data on hard drive in the case of a file upload.
|
|
**/
|
|
**/
|
|
public static function parseMultipart( onPart : String -> String -> Void, onData : Bytes -> Int -> Int -> Void ) : Void {
|
|
public static function parseMultipart( onPart : String -> String -> Void, onData : Bytes -> Int -> Int -> Void ) : Void {
|