Variable: $DLSupport_data
Since: 0.1
Updated: 1.1
Visibility: Private
Description:
An array containing various data As of 1.1, this has been deprecated and will be removed by version 3.0.
Variable: $instance
Since: 0.1
Visibility: Private
Static: Yes
Description:
An instance of DLSupport
Method: Captcha
Since: 1.1
Visibility: Public
Static: Yes
Parameters:
Variable
Type
Description
$hours
int
This is optional and defaults to 2. The maximum number of hours the created captcha remains valid.
Returns:
array
An associative array containing with the following keys: 1) image - The HTML to display the captcha image. 2) field - The HTML of the input field.
Description:
Generate and retrieve information of a captcha.
Method: CaptchaRemove
Since: 1.1
Visibility: Public
Static: Yes
Parameters:
Variable
Type
Description
$hours
int
The number of hours in which if an image is older than this, it is removed.
Description:
Remove images created for captcha purposes that is older than the given number of hours.
Method: CaptchaValidate
Since: 1.1
Visibility: Public
Static: Yes
Parameters:
Variable
Type
Description
$hours
int
This is optional and defaults to 2. The maximum number of hours the created captcha remains valid.
Returns:
boolean
Returns TRUE if the value is correct, FALSE, otherwise.
Description:
See if the user has entered the correct value for the captcha generated by the method "Captcha".
Method: CleanExit
Since: 1.1
Visibility: Public
Static: Yes
Parameters:
Variable
Type
Description
$message
string
The message to be outputted.
Description:
Clear all the currently opened output buffer then terminate execution with the given message.
Method: ConvertBytes
Since: 1.1
Visibility: Public
Static: Yes
Parameters:
Variable
Type
Description
$bytes
numeric
The bytes to be converted.
$type
string
The type to be converted to. This can either be "b" for bytes (stays the same), "k" for kilobytes, "m" for megabytes, "g" for gigabytes, or "t" for terrabytes.
Returns:
numeric
The given bytes after it has been converted to the specified type.
Description:
Convert the given bytes to the specified type.
Method: GetCSSFromTemplate
Since: 1.2
Visibility: Public
Static: Yes
Parameters:
Variable
Type
Description
$template_id
int
The ID of the template.
Returns:
string
All of the CSS associated with the given template.
Description:
Get all of the CSS that is attached to the given template.
Method: GetIcon
Since: 1.1
Visibility: Public
Static: Yes
Parameters:
Variable
Type
Description
$size
numeric
This is the dimension of the icon. Note that not all dimensions exist. Be sure to check that the dimension folder you are requesting exist.
$icon
string
The filename of the icon to get without its file extension. Note that not all icons exist. Be sure to check that they exist first.
$alt
string
This is optional and defaults to an empty string. The text to be placed in the "alt" attribute of the IMG tag. If it is not given or empty, it will use the $icon value with underscores converted to whitespace and the first letter of each word would be capitalize.
$theme
string
This is optional and defaults to "aesthetica2". The theme of the icon to get.
Returns:
string
The HTML for the IMG tag with approropriate information for displaying the icon.
Description:
Retrieve the HTML for an icon.
Method: GetPageInfo
Since: 1.1
Updated: 1.2
Visibility: Public
Static: Yes
Parameters:
Variable
Type
Description
$info
string
The piece of information that is requested. Supported values are: alias, content_id, create_date, menu_text, modified_date, root_path, root_url, template_id, title, uploads_path, and uploads_url.
Returns:
string
The value of the requested informtion.
Description:
Retrieve information about the current page. Note that this function should only be used after the global $gCms object has been fully loaded. That means, this should not be used in any module constructor. As of 1.2, two more fields can be retrieved: uploads_path and uploads_url. A bug fix was also made so this can be safely called outside of a CMS page.
Method: IncludeJavaScript
Since: 0.1
Updated: 1.1
Visibility: Public
Static: Yes
Returns:
string
The HTML that will include the neccessary JavaScript.
Description:
Include the JavaScript support file. As of 1.1, this will include the JSON object as well.
Method: ListDirectories
Since: 1.1
Updated: 1.2
Visibility: Public
Static: Yes
Parameters:
Variable
Type
Description
$path
string
The absolute path to the base directory.
$options
array
This is optional and defaults to an empty array. An associative array containing the following keys: 1) sort_order - (numeric) Defaults to 0. The order in which the resulting array should be sorted. Possible values includes 0 for ascending order and 1 for descending order. Everything else is considered ascending. 2) bytes - (string) Defaults to "b". Used to determine which type of *byte to use when returning values that has them. Possible values include "b" for bytes, "k" for kilobytes", "m" for megabytes, "g" for gigabytes, and "t" for terrabytes. Anything else besides those values will be assumed to be "b". 3) cache - (boolean) Defaults to TRUE. Whether or not we should be allowed to use the cache to get the results.
Returns:
array
An array contain all direct sub directories of the given directory. Note that each item itself is an object containing the following variable: 1) free_space - (numeric) The number of available space. 2) total_space - (numeric) The total number of space currently occuppied by the directory. 3) name - (string) The name of the directory. Note that the given directory will have the value of ".". 4) full_path - (string) The absolute full path to the directory. 5) sub_dirs - (array) The list of all sub directories of the current directory.
Description:
Retrieve a list of all direct sub directories of the given directory. Note that the returned array will contain the given directory as well but it will not include the parent directory. As of 1.2, a new field will be included in the returned array: sub_dirs.
Method: ListFiles
Since: 1.1
Visibility: Public
Static: Yes
Parameters:
Variable
Type
Description
$path
string
The absolute path to the base directory.
$options
array
This is optional and defaults to an empty array. An associative array contain the following keys: 1) sort_order - (numeric) Defaults to 0. The order in which the resulting array should be sorted. Possible values includes 0 for ascending order and 1 for descending order. Everything else is considered ascending. 2) bytes - (string) Defaults to "b". Used to determine which type of *byte to use when returning values that has them. Possible values include "b" for bytes, "k" for kilobytes", "m" for megabytes, "g" for gigabytes, and "t" for terrabytes. Anything else besides those values will be assumed to be "b". 3) cache - (boolean) Defaults to TRUE. Whether or not we shoudl be allowed to use the cache to get the results. 4) sort_field - (string) Defaults to "filename". The field in which the array should be sorted by. Possible values includes "access_time", "filename", "full_path", "file_size", and "modified_time". Anything else will be considered "filename".
Returns:
array
An array contain all direct sub directories of the given directory. Note that each item itself is an object containing the following variable: 1) access_time - (numeric) The UNIX timestamp of when the file was last access. 2) filename - (string) The name of the file. 3) file_size - (numeric) The size of the file. 4) full_path - (string) The absolute path to the file. 5) modified_time - (numeric) The UNIX timestamp of when the file was last modified.
Description:
Retrieve a listing of all direct files of the given directory.
Method: ModuleInstance
Since: 1.2
Visibility: Public
Static: Yes
Parameters:
Variable
Type
Description
$module
string
The unique name of the module.
Returns:
CMSModule
The module instance.
Description:
Get an instance of the given module unqiue name.
Method: ModulePath
Since: 1.1
Visibility: Public
Static: Yes
Parameters:
Variable
Type
Description
$module
string
The unique name of the module.
Returns:
string|FALSE
The absolute path to the module. If the path to the module does not exist, this returns FALSE.
Description:
Retrieve the absolute path to the given module.
Method: ModuleUrl
Since: 1.1
Visibility: Public
Static: Yes
Parameters:
Variable
Type
Description
$module
string
The unique name of the module.
Returns:
string|FALSE
The absolute url to the module.
Description:
Retrieve the absolute url to the given module.
Method: NewFormStart
Since: 1.1
Visibility: Public
Static: Yes
Parameters:
Variable
Type
Description
&$module
CMSModule
The module object that is calling this method.
$id
string
The ID given to the module on execution.
$action
string
This is optional and defaults to "default". The action that the form should do when it is submitted.
$returnid
string
This is optional and defaults to an empty string. The ID to eventually return to when the module is finished with its task.
$method
string
This is optional and defaults to "post". The form method to use.
$params
array
This is optional and defaults to an empty array. This should be an associative array containing any extra parameters to be sent as a hidden input field. The key of the array should be the field name and the value of the array should be the value of the input field.
$extras
array
This is optional and defaults to an empty array. An array containing any other attributes to be included within the FORM tag.
Returns:
string
The HTML for the start of a form. This will include the FORM tag along hidden INPUT tags if other fields are given.
Description:
This is very similar to the method CreateFormStart except that it does not encode the content of the extras array.
Method: ParseCSS
Since: 0.1
Updated: 1.1
Visibility: Public
Static: Yes
Parameters:
Variable
Type
Description
$css
string
The CSS to parse.
$period
boolean
Added in 1.1. This is optional and defaults to TRUE. If this is set to FALSE, then the period in front of the class name will be removed.
Returns:
string
An array containing all of the CSS class names in the given class sorted in alphabetical order.
Description:
This methods tries to find all of the classes in the given CSS. Note that this will only return the classes and not the IDs, tags, etc. As of 1.1, the variable $period was added that allows for the removal of the period before the class names.
Usage Examples:
$css = '
div#body div.section {
color: white;
text-align: center;
}
.one div.section .two .one { color: blue; }
';
$classes = DLSupport::ParseCSS($css);
/* Returns:
Array(
[0] => .one
[1] => .section
[2] => .three
);
*/
Method: SanitizeString
Since: 1.1
Visibility: Public
Static: Yes
Parameters:
Variable
Type
Description
$data
mixed
The data to be filtered.
$input
int|FALSE
This is optional and defaults to FALSE. If this is given, it would use this value as the input type and use the function "filter_input" instead of "filter_var".
Returns:
string|FALSE
The string after the data has been filtered. This will return FALSE if it failed.
Description:
Wrapper method for the function "filter_var" with the filter FILTER_SANITIZE_STRING and the options FILTER_FLAG_ENCODE_LOW and FILTER_FLAG_ENCODE_HIGH.
Method: Singleton
Since: 0.1
Updated: 1.1
Visibility: Public
Static: Yes
Returns:
DLSupport
An instance of this class.
Description:
This method will return an instance of this class. This method will also return the object by reference so when you call it, you should always save the result as a reference. As of 1.1, this method will look for the object in the global object before it creates a new instance.
Usage Examples:
$DLS =& DLSupport::Singleton();
Method: ValidateDependency
Since: 1.1
Visibility: Public
Static: Yes
Parameters:
Variable
Type
Description
$module
string
The name of the module to test.
$version
string
The minimum version required to pass the test. Refer to the code sample below to see how the method compares the versions. If the versions equal, it is considered a pass.
&$validate_failed
boolean
Whether or not the given module is at or above the given version.
Returns:
boolean
Returns TRUE if the validation has failed, FALSE otherwise. Basically, this will have the same value as $validate_failed.
Description:
Determine whether or not the given module name has been installed up to at least the given version.
Usage Examples:
<?php
...
$upgrade_failed = FALSE;
// Make sure DLCodePress is at least version 1.0
switch($old_version) {
...
case '1.0':
if(DLSupport::ValidateDependency('DLCodePress', '1.0', $upgrade_failed)) { break; }
...
}
if($upgrade_failed) {
// Undo changes and let user know upgrade has failed
}
...
// The following is how the method will compare the versions:
// 2.0 > 1.2 > 1.12 > 1.1 > 1.1RC2 > 1.1RC1 > 1.0
?>