Adds a name=value pair to the end of an URL, taking care of whether there are existing parameters and whether to use ?, & or & as the glue. All data will be urlencoded.
string
addParameter
(string $url, mixed $parameter, [string $value = null], [boolean $encode = true])
-
string
$url: The URL to modify
-
mixed
$parameter: Either the name=value pair to add (DEPRECATED) -or- the name value -or- an array of name/value pairs.
-
string
$value: If specified, the value part ($parameter is then assumed to just be the parameter name).
-
boolean
$encode: Encode the argument separator?
Checks if all necessary parameters for a driver's configuration are set and returns a PEAR_Error if something is missing.
void
assertDriverConfig
(array $params, array $fields, string $name, [array $info = array()])
-
array
$params: The configuration array with all parameters.
-
array
$fields: An array with mandatory parameter names for this driver.
-
string
$name: The clear text name of the driver. If not specified, the application name will be used.
-
array
$info: A hash containing detailed information about the driver. Will be passed as the userInfo to the PEAR_Error.
Buffers the output from a function call, like readfile() or highlight_string(), that prints the output directly, so that instead it can be returned as a string and used.
string
bufferOutput
(string $function, mixed $arg1, mixed $arg2, mixed $arg..., mixed $argN)
-
string
$function: The function to run.
-
mixed
$arg1: First argument to $function().
-
mixed
$arg2: Second argument to $function().
-
mixed
$arg...: ...
-
mixed
$argN: Nth argument to $function().
Returns an object's clone.
object The
&cloneObject
(object &$obj)
-
object
&$obj: The object to clone.
Outputs javascript code to close the current window.
void
closeWindowJS
([string $code = ''])
-
string
$code: Any additional javascript code to run before closing the window.
Creates a temporary directory in the system's temporary directory.
string
createTempDir
([boolean $delete = true], [string $temp_dir = null])
-
boolean
$delete: Delete the temporary directory at the end of the request?
-
string
$temp_dir: Use this temporary directory as the directory where the temporary directory will be created.
Returns a format string to be used by strftime().
string
date2strftime
(string $format)
-
string
$format: A format string as used by date().
Removes given elements at request shutdown.
If called with a filename will delete that file at request shutdown; if called with a directory will remove that directory and all files in that directory at request shutdown.
If called with no arguments, return all elements to be deleted (this should only be done by Util::_deleteAtShutdown).
The first time it is called, it initializes the array and registers Util::_deleteAtShutdown() as a shutdown function - no need to do so manually.
The second parameter allows the unregistering of previously registered elements.
void
deleteAtShutdown
([string $filename = false], [boolean $register = true], [boolean $secure = false])
-
string
$filename: The filename to be deleted at the end of the request.
-
boolean
$register: If true, then register the element for deletion, otherwise, unregister it.
-
boolean
$secure: If deleting file, should we securely delete the file?
If magic_quotes_gpc is in use, run stripslashes() on $var.
string
dispelMagicQuotes
(string &$var)
-
string
&$var: The string to un-quote, if necessary.
Returns a hidden form input containing the session name and id.
string
formInput
([boolean $append_session = 0])
-
boolean
$append_session:
- = only if needed, 1 = always.
Gets a form variable from GET or POST data, stripped of magic quotes if necessary. If the variable is somehow set in both the GET data and the POST data, the value from the POST data will be returned and the GET value will be ignored.
string
getFormData
(string $var, [string $default = null])
-
string
$var: The name of the form variable to look for.
-
string
$default: The value to return if the variable is not there.
Gets a form variable from GET data, stripped of magic quotes if necessary. This function will NOT return a POST variable.
string
getGet
(string $var, [string $default = null])
-
string
$var: The name of the form variable to look for.
-
string
$default: The value to return if the variable is not there.
Utility function to obtain PATH_INFO information.
string
getPathInfo
()
Gets a form variable from POST data, stripped of magic quotes if necessary. This function will NOT return a GET variable.
string
getPost
(string $var, [string $default = null])
-
string
$var: The name of the form variable to look for.
-
string
$default: The value to return if the variable is not there.
Determines the location of the system temporary directory.
string
getTempDir
()
Creates a temporary filename for the lifetime of the script, and (optionally) register it to be deleted at request shutdown.
string
getTempFile
([string $prefix = ''], [boolean $delete = true], [string $dir = ''], [boolean $secure = false])
-
string
$prefix: Prefix to make the temporary name more recognizable.
-
boolean
$delete: Delete the file at the end of the request?
-
string
$dir: Directory to create the temporary file in.
-
boolean
$secure: If deleting file, should we securely delete the file?
Calculate an HMAC for a given $data and secret $key using SHA-1.
string
hmac
(string $data, string $key, [boolean $raw_output = false])
-
string
$data: Data to sign
-
string
$key: Secret key
-
boolean
$raw_output: Return binary data? Default to hex.
Tries to load a PHP extension, behaving correctly for all operating systems.
boolean
loadExtension
(string $ext)
-
string
$ext: The extension to load.
Returns a url with the 'nocache' parameter added, if the browser is buggy and caches old URLs.
string
nocacheUrl
(string $url, [boolean $encode = true])
-
string
$url: The URL to modify.
-
boolean
$encode: Encode the argument separator? (since Horde 3.2)
Checks to see if a value has been set by the script and not by GET, POST, or cookie input. The value being checked MUST be in the global scope.
mixed
nonInputVar
(string $varname, [mixed $default = null])
-
string
$varname: The variable name to check.
-
mixed
$default: Default value if the variable isn't present or was specified by the user. Defaults to null.
Prints a hidden form input containing the session name and id.
void
pformInput
([boolean $append_session = 0])
-
boolean
$append_session:
- = only if needed, 1 = always.
Returns the canonical path of the string. Like PHP's built-in realpath() except the directory need not exist on the local server.
Algorithim loosely based on code from the Perl File::Spec::Unix module (version 1.5).
string
realPath
(string $path)
-
string
$path: A file path.
Removes name=value pairs from a URL.
string
removeParameter
(string $url, mixed $remove)
-
string
$url: The URL to modify.
-
mixed
$remove: Either a single parameter to remove or an array of parameters to remove.
Returns a format string to be used by date().
string
strftime2date
(string $format)
-
string
$format: A format string as used by strftime().
Decode URL-safe base64 data, dealing with missing =
string
uriB64Decode
(string $string)
-
string
$string: Encoded data
URL-safe base64 encoding, with trimmed =
string
uriB64Encode
(string $string)
-
string
$string: String to encode.