get_db()
get_db() : \adodb
A convenience function to get an adodb object that supports exceptions
Returns
\adodb —object
A set of high level convenience methods.
unix_time(string $string) : int
Given a datatime string convert it to a unix time
| string | $string | The datetime string |
| todo |
|---|
get_image_extensions() : string
A convenience method to return the list of allowed image extensions that a user is allowed to upload
| todo |
|---|
get_module(string $module_name, string $version) : object
A quick wrapper around cms_utils::get_module that will try to use a module name saved in tmpdata (the module name is stored in tmpdata in each request, for CGExtensions derived modules)
| string | $module_name | |
| string | $version | The desired module version |
The module object. or null
| todo |
|---|
get_cge() : object
A convenience function to get the CGExtensions module object reference
The CGExtensions module object.
| todo |
|---|
get_mime_type(string $filename) : string
Given a file name, return it's mime type
Requires the fileinfo php extension (which is included by default since PHP 5.3) Throws an exception if the fileinfo extension is not available.
| string | $filename |
|
The returned mime type.
| todo |
|---|
send_data_and_exit(string $data, string $content_type, string $filename)
A convenience method to send a text file (like a CSV file) to the browser and exit This is a convenience method. It also handles clearing any data that has already been sent to output buffers.
| string | $data | The output data |
| string | $content_type | The output MIME type |
| string | $filename | The output filename |
| todo |
|---|
view_file_and_exit(string $file, string $mime_type, string $filename)
A convenience method to view a file in the browser.
This is a convenience method. It also handles clearing any data that has already been sent to output buffers.
| string | $file | The absolute path to the output file |
| string | $mime_type | The output mime type |
| string | $filename | The output filename (suggested to the browser) |
| todo |
|---|
send_file_and_exit(string $file, int $chunksize, string $mime_type, string $filename)
A convenience method to download a file to the browser, and then exit the current request This method is useful when the user has requested to download a large file.
This is a convenience method. It also handles clearing any data that has already been sent to output buffers.
| string | $file | The absolute path to the output file |
| int | $chunksize | The amount of data to read from the file at one time |
| string | $mime_type | The output mime type |
| string | $filename | The output filename (suggested to the browser) |
| todo |
|---|
send_ajax_and_exit(mixed $output)
Given an output array or object, encode it to json, and exit.
This is a convenience method. It also handles clearing any data that has already been sent to output buffers.
| mixed | $output |
| todo |
|---|
get_real_ip() : string
Use various methods to return the users real IP address.
including when using a proxy server.
| todo |
|---|
to_bool(mixed $in, boolean $strict) : bool
Given a string input that theoretically represents a boolean value return either true or false.
| mixed | $in | input value |
| boolean | $strict | Whether strict testing should be used. |
| todo |
|---|
get_browser() : \cge_browser
Get the singleton cge_browser object.
| todo |
|---|
fgets(resource $fh) : string
A platform independent fgets utility.
This method understands MAC (\r) as well as DOS/Unix line endings
| resource | $fh |
| todo |
|---|
coalesce() : \The
Return the first non null argument.
This method accepts a variable number of arguments.
first non null argument
| todo |
|---|
get_param(\hash $params, string $key, mixed $dflt) : mixed
Given an associative array, extract the value of one key, with a default.
If the key does not exist in the array, or it's value is empty, then the default is used.
| \hash | $params | The input associative array |
| string | $key | The input key to search for |
| mixed | $dflt | The default value |
The value of the element in the array, or the default
| todo |
|---|
src_to_file(string $src) : string
Given a src specification attempt to resolve it into a filename on the server
algorithm:
| string | $src | the source |
The filename (if possible).
| todo |
|---|
ssl_request() : bool
Test if the current request is for a secure connection
| todo |
|---|
file_to_url(string $file, bool $force_ssl) : string
Convert a filename to a URL.
If an absolute path is specified tests are done to compare the input to the image uploads path, the uploads path or the root path of the system. If a relative URL path is passed a file relative to the root url is assumed.
| string | $file | the filename to convert to a URL |
| bool | $force_ssl | Force the output url to use HTTPS |
| todo |
|---|
have_enough_memory(int $needed_memory, float $fudge) : bool
An experimental method that attempts to determine if there is enough available PHP memory for a given operation.
| int | $needed_memory | The estimated amount of memory required |
| float | $fudge | The fudge factor (multiplier) used to buffer available memory. |
| todo |
|---|
get_available_memory() : int
An experimental method to determine the amount of available PHP memory remaining
| todo |
|---|
clean_input_html(string $html) : string
Pretty up, sanitize, and clean user entered html code.
| string | $html |
| todo |
|---|
parse_float(string $floatString, string $thousands_sep, string $decimal_pt)
a convenience method to convert a string representing a float value into a float
| string | $floatString | the input string |
| string | $thousands_sep | The thousands separator |
| string | $decimal_pt | The decimal point |
| todo |
|---|