* Cleaned up a bit the doc
/**
* Recursively strips slashes from the given array;
* used for undoing the evil that is magic_quotes_gpc.
/**
* Recursively strips slashes from the given array;
* used for undoing the evil that is magic_quotes_gpc.
* @param $arr array: will be modified
* @return array the original array
*/
* @param $arr array: will be modified
* @return array the original array
*/
/**
* Recursively normalizes UTF-8 strings in the given array.
/**
* Recursively normalizes UTF-8 strings in the given array.
* @param $data string or array
* @return cleaned-up version of the given
* @private
* @param $data string or array
* @return cleaned-up version of the given
* @private
/**
* Fetch a value from the given array or return $default if it's not set.
*
/**
* Fetch a value from the given array or return $default if it's not set.
*
- * @param $arr array
- * @param $name string
- * @param $default mixed
+ * @param $arr Array
+ * @param $name String
+ * @param $default Mixed
* @return mixed
*/
private function getGPCVal( $arr, $name, $default ) {
* @return mixed
*/
private function getGPCVal( $arr, $name, $default ) {
* non-freeform text inputs (e.g. predefined internal text keys
* selected by a drop-down menu). For freeform input, see getText().
*
* non-freeform text inputs (e.g. predefined internal text keys
* selected by a drop-down menu). For freeform input, see getText().
*
- * @param $name string
- * @param $default string: optional default (or NULL)
- * @return string
+ * @param $name String
+ * @param $default String: optional default (or NULL)
+ * @return String
*/
public function getVal( $name, $default = null ) {
$val = $this->getGPCVal( $this->data, $name, $default );
*/
public function getVal( $name, $default = null ) {
$val = $this->getGPCVal( $this->data, $name, $default );
/**
* Set an aribtrary value into our get/post data.
/**
* Set an aribtrary value into our get/post data.
- * @param $key string Key name to use
- * @param $value mixed Value to set
- * @return mixed old value if one was present, null otherwise
+ *
+ * @param $key String: key name to use
+ * @param $value Mixed: value to set
+ * @return Mixed: old value if one was present, null otherwise
*/
public function setVal( $key, $value ) {
$ret = isset( $this->data[$key] ) ? $this->data[$key] : null;
*/
public function setVal( $key, $value ) {
$ret = isset( $this->data[$key] ) ? $this->data[$key] : null;
* If source was scalar, will return an array with a single element.
* If no source and no default, returns NULL.
*
* If source was scalar, will return an array with a single element.
* If no source and no default, returns NULL.
*
- * @param $name string
- * @param $default array: optional default (or NULL)
- * @return array
+ * @param $name String
+ * @param $default Array: optional default (or NULL)
+ * @return Array
*/
public function getArray( $name, $default = null ) {
$val = $this->getGPCVal( $this->data, $name, $default );
*/
public function getArray( $name, $default = null ) {
$val = $this->getGPCVal( $this->data, $name, $default );
* If no source and no default, returns NULL.
* If an array is returned, contents are guaranteed to be integers.
*
* If no source and no default, returns NULL.
* If an array is returned, contents are guaranteed to be integers.
*
- * @param $name string
- * @param $default array: option default (or NULL)
- * @return array of ints
+ * @param $name String
+ * @param $default Array: option default (or NULL)
+ * @return Array of ints
*/
public function getIntArray( $name, $default = null ) {
$val = $this->getArray( $name, $default );
*/
public function getIntArray( $name, $default = null ) {
$val = $this->getArray( $name, $default );
* Fetch an integer value from the input or return $default if not set.
* Guaranteed to return an integer; non-numeric input will typically
* return 0.
* Fetch an integer value from the input or return $default if not set.
* Guaranteed to return an integer; non-numeric input will typically
* return 0.
- * @param $name string
- * @param $default int
- * @return int
+ *
+ * @param $name String
+ * @param $default Integer
+ * @return Integer
*/
public function getInt( $name, $default = 0 ) {
return intval( $this->getVal( $name, $default ) );
*/
public function getInt( $name, $default = 0 ) {
return intval( $this->getVal( $name, $default ) );
* Fetch an integer value from the input or return null if empty.
* Guaranteed to return an integer or null; non-numeric input will
* typically return null.
* Fetch an integer value from the input or return null if empty.
* Guaranteed to return an integer or null; non-numeric input will
* typically return null.
- * @param $name string
- * @return int
+ *
+ * @param $name String
+ * @return Integer
*/
public function getIntOrNull( $name ) {
$val = $this->getVal( $name );
*/
public function getIntOrNull( $name ) {
$val = $this->getVal( $name );
* Fetch a boolean value from the input or return $default if not set.
* Guaranteed to return true or false, with normal PHP semantics for
* boolean interpretation of strings.
* Fetch a boolean value from the input or return $default if not set.
* Guaranteed to return true or false, with normal PHP semantics for
* boolean interpretation of strings.
- * @param $name string
- * @param $default bool
- * @return bool
+ *
+ * @param $name String
+ * @param $default Boolean
+ * @return Boolean
*/
public function getBool( $name, $default = false ) {
return $this->getVal( $name, $default ) ? true : false;
*/
public function getBool( $name, $default = false ) {
return $this->getVal( $name, $default ) ? true : false;
* Return true if the named value is set in the input, whatever that
* value is (even "0"). Return false if the named value is not set.
* Example use is checking for the presence of check boxes in forms.
* Return true if the named value is set in the input, whatever that
* value is (even "0"). Return false if the named value is not set.
* Example use is checking for the presence of check boxes in forms.
- * @param $name string
- * @return bool
+ *
+ * @param $name String
+ * @return Boolean
*/
public function getCheck( $name ) {
# Checkboxes and buttons are only present when clicked
*/
public function getCheck( $name ) {
# Checkboxes and buttons are only present when clicked
* input (for which input transformations may be required - e.g. Esperanto
* x-coding).
*
* input (for which input transformations may be required - e.g. Esperanto
* x-coding).
*
- * @param $name string
- * @param $default string: optional
- * @return string
+ * @param $name String
+ * @param $default String: optional
+ * @return String
*/
public function getText( $name, $default = '' ) {
global $wgContLang;
*/
public function getText( $name, $default = '' ) {
global $wgContLang;
* Note that values retrieved by the object may come from the
* GET URL etc even on a POST request.
*
* Note that values retrieved by the object may come from the
* GET URL etc even on a POST request.
*
*/
public function wasPosted() {
return $_SERVER['REQUEST_METHOD'] == 'POST';
*/
public function wasPosted() {
return $_SERVER['REQUEST_METHOD'] == 'POST';
* during the current request (in which case the cookie will
* be sent back to the client at the end of the script run).
*
* during the current request (in which case the cookie will
* be sent back to the client at the end of the script run).
*
*/
public function checkSessionCookie() {
return isset( $_COOKIE[session_name()] );
*/
public function checkSessionCookie() {
return isset( $_COOKIE[session_name()] );
/**
* Get a cookie from the $_COOKIE jar
/**
* Get a cookie from the $_COOKIE jar
- * @param String $key The name of the cookie
- * @param mixed $default What to return if the value isn't found
- * @param String $prefix A prefix to use for the cookie name, if not $wgCookiePrefix
- * @return <type>
+ *
+ * @param $key String: the name of the cookie
+ * @param $default Mixed: what to return if the value isn't found
+ * @param $prefix String: a prefix to use for the cookie name, if not $wgCookiePrefix
+ * @return Mixed: cookie value or $default if the cookie not set
*/
public function getCookie( $key, $default = null, $prefix = '' ) {
if( !$prefix ) {
*/
public function getCookie( $key, $default = null, $prefix = '' ) {
if( !$prefix ) {
/**
* Return the path portion of the request URI.
/**
* Return the path portion of the request URI.
*/
public function getRequestURL() {
if( isset( $_SERVER['REQUEST_URI'] ) ) {
*/
public function getRequestURL() {
if( isset( $_SERVER['REQUEST_URI'] ) ) {
/**
* Return the request URI with the canonical service and hostname.
/**
* Return the request URI with the canonical service and hostname.
*/
public function getFullRequestURL() {
global $wgServer;
*/
public function getFullRequestURL() {
global $wgServer;
/**
* Take an arbitrary query and rewrite the present URL to include it
* @param $query String: query string fragment; do not include initial '?'
/**
* Take an arbitrary query and rewrite the present URL to include it
* @param $query String: query string fragment; do not include initial '?'
*/
public function appendQuery( $query ) {
global $wgTitle;
*/
public function appendQuery( $query ) {
global $wgTitle;
/**
* HTML-safe version of appendQuery().
/**
* HTML-safe version of appendQuery().
* @param $query String: query string fragment; do not include initial '?'
* @param $query String: query string fragment; do not include initial '?'
*/
public function escapeAppendQuery( $query ) {
return htmlspecialchars( $this->appendQuery( $query ) );
*/
public function escapeAppendQuery( $query ) {
return htmlspecialchars( $this->appendQuery( $query ) );
/**
* Appends or replaces value of query variables.
/**
* Appends or replaces value of query variables.
* @param $array Array of values to replace/add to query
* @param $onlyquery Bool: whether to only return the query string and not
* the complete URL
* @param $array Array of values to replace/add to query
* @param $onlyquery Bool: whether to only return the query string and not
* the complete URL
*/
public function appendQueryArray( $array, $onlyquery = false ) {
global $wgTitle;
*/
public function appendQueryArray( $array, $onlyquery = false ) {
global $wgTitle;
/**
* Return the path to the temporary file where PHP has stored the upload.
/**
* Return the path to the temporary file where PHP has stored the upload.
* @param $key String:
* @return string or NULL if no such file.
*/
* @param $key String:
* @return string or NULL if no such file.
*/
/**
* Return the size of the upload, or 0.
/**
* Return the size of the upload, or 0.
* @param $key String:
* @return integer
*/
* @param $key String:
* @return integer
*/
/**
* Return the upload error or 0
/**
* Return the upload error or 0
* @param $key String:
* @return integer
*/
* @param $key String:
* @return integer
*/
* Get data from $_SESSION
* Get data from $_SESSION
- * @param $key String Name of key in $_SESSION
- * @return mixed
+ *
+ * @param $key String: name of key in $_SESSION
+ * @return Mixed
*/
public function getSessionData( $key ) {
if( !isset( $_SESSION[$key] ) )
*/
public function getSessionData( $key ) {
if( !isset( $_SESSION[$key] ) )
- * @param $key String Name of key in $_SESSION
- * @param $data mixed
+ *
+ * @param $key String: name of key in $_SESSION
+ * @param $data Mixed
*/
public function setSessionData( $key, $data ) {
$_SESSION[$key] = $data;
*/
public function setSessionData( $key, $data ) {
$_SESSION[$key] = $data;
* @param $data Array of *non*-urlencoded key => value pairs, the
* fake GET/POST values
* @param $wasPosted Bool: whether to treat the data as POST
* @param $data Array of *non*-urlencoded key => value pairs, the
* fake GET/POST values
* @param $wasPosted Bool: whether to treat the data as POST
+ * @param $session Mixed: session array or null
*/
public function __construct( $data, $wasPosted = false, $session = null ) {
if( is_array( $data ) ) {
*/
public function __construct( $data, $wasPosted = false, $session = null ) {
if( is_array( $data ) ) {