DLSupport

An auxilary class providing functionalities to other modules.

Summary
DLSupportAn auxilary class providing functionalities to other modules.
AuthorDuc Tri Le <cmsmadesimple---at---email.tiger-inc.com>
LicenseThis class is released under the GNU General Public License.
Changelog
Constants
WordRegex(String) The regex for our “word”.
Private Static Data
$instance(DLSupport) An instance of this class.
Protected Static Data
$smarty_methods(array) An array containing methods that can be called through Smarty using {DLSupport}.
Class Construction
__constructCreate a new instance of DLSupport.
ModuleInstanceGet an instance of the given module unqiue name.
MySQLiRetrieve an instance of the database class.
NewFormCollectionRetreive a new form collection.
NewTabCollectionCreate a new tab collection.
SingletonThis method will return an instance of this class.
Override Methods
Captcha Generation
CaptchaGenerate a new captcha image.
CaptchaRemoveRemove images created for captcha purposes that is older than the given number of hours.
CaptchaValidateSee if the user has entered the correct value for the captcha generated by the method Captcha.
Clean Admin - Deprecated
GetCleanBreadcrumbRetrieve the breadcrumb for a clean admin page.
GetCleanFooterRetrieve the HTML for the footer of the clean admin page.
GetCleanHeaderRetrieve the HTML for the header of the clean admin page.
Cookies
RemoveCookieRemove the given cookie.
SetCookieStore the given information with the given key in the cookie for the given number of days.
Cryptography
DecryptDecrypt the given data using the given key.
EncryptEncrypt the given data using the given key.
CSS
GetCSSFromTemplateGet all of the CSS that is attached to the given template.
ParseCSSParse the given CSS to retrieve the class names.
Database
AutoExecuteCreate the necessary SQL query and execute the command.
Directory and Files
ListDirectoriesRetrieve a list of all direct sub directories of the given directory.
ListFilesRetrieve a list of all the files in the given directory.
Miscellaneous
CleanExitClear all the currently opened output buffer then terminate execution with the given message.
ConvertBytesConvert the given bytes to the specified type.
ExecuteCommandExecute the given list of commands.
GetIconRetrieve the HTML for an icon.
GetPageInfoRetrieve information about the current page.
IncludeJavaScriptInclude the JavaScript support file.
IsWordDetermien whether or not the provided string is a word using our regular pattern.
JSONTerminate the execution of the script but outputting the given array as a JSON.
ModulePathRetrieve the absolute path to the given module.
ModuleURLRetrieve the absolute url to the given module.
NewFormStartThis is very similar to the method CreateFormStart except that it does not encode the content of the extras array.
OutputUploadResponseOutput the response page for the uploaded of a file.
ProtoaculousRetrieve the HTML for including Prototype, script.aculo.us from Google as well as the supporting JS frameworking.
SanitizeStringWrapper method for the function “filter_var” with the filter FILTER_SANITIZE_STRING and the options FILTER_FLAG_ENCODE_LOW and FILTER_FLAG_ENCODE_HIGH.
UploadFileResponseRetrieve the HTML for the response from the server.
UploadPageResponseOutput the upload response page.
Module Dependency
CompareVersionsSee if the installed version of the given module is less than the given version.
Smarty Related Methods
CreateParametersCreate the appropriate parameters array to be send to the function call_user_func_array.
Deprecated Data
$DLSupport_data(array) An array contain various data.
Deprecated Methods
ValidateDependencyDetermine whether or not the given module name has been installed up to at least the given version.

Author

Duc Tri Le <cmsmadesimple---at---email.tiger-inc.com>

License

This class is released under the GNU General Public License.

Changelog

  • 2.1 () : Added the abstract class DLCustomField to handle custom fields.  Fix bug in DLDatabase to handle inserting the value 0 as well as “on update” capabilities to the creation of tables.  Update the method CreateParameters so that it will create an array from a String.
  • 2.0 (April 19, 2009): Added the method UploadPageResponse.  Abstract out DLSupportJS.CleanAdmin.ServerResponse.  Fixed a couple of spelling errors.  Remove realpath from the method ModulePath.
  • 2.0RC4 (January 16, 2008): Separate the Clean Admin into its own class.  However, the old functions will still work.  They will be removed by version 3.0.  Also, I have changed DLEncryption_Three to use a different implementation since the previous one is not consistently producing appropriate results.  This will be the final release candidate before version 2.0 is released.
  • 2.0RC3 (December 12, 2008): So much has changed in this update that I don’t even know where to begin.  With that in mind, consider this like a completely new version.  This version isn’t completely backwards compatible either but all modules that I developed have been upgraded so that it still works.
  • 2.0RC2 (August 15, 2008): [PHP] MD5 given data to Hash function of DLEncryption for safe hashing to prevent possible bug with AES encryption and decryption.  Added the method CompareVersions to DLSupport.  Give DLForm::GetHeader the ability to include extra attributes to the FORM tag.  [JavaScript] Updated DLSupport.Form to handle a select box with multiple values.
  • 2.0RC1 (July 25, 2008): Huge update including an encryption and decryption class, a form class, a tab collection class and more.
  • 1.3 (May 30, 2008): [JavaScript] Added the property DLSupport.ErrorLog.  Updates were made to the following methods in DLSupport: checkboxSelectAllToggle, curry, defaultValues, delayFunction, inArray, removeElement, toggleDisplay, and windowOnload.  The following methods has been added to DLSupport: addErrorLog, humanReadable, and newEvent.  Updated DLSupport.AJAX.monitor.
  • 1.2 (May 23, 2008: [PHP] Updates were made to the following methods: GetPageInfo and ListDirectories.  The following methods were added: GetCSSFromTemplate and moduleInstance.
  • 1.1 (May 9, 2008): [PHP] Deprecated DLSupport->DLSupport_data.  Updates were made to following methods: __construct, ParseCSS, and Singleton.  The following methods were added: Captcha, CaptchaRemove, CaptchaValidate, CleanExit, ConvertBytes, GetIcon, GetPageInfo, IncludeJavaScript, ListDirectories, ListFiles, ModulePath, ModuleUrl, NewFormStart, SanitizeString, and ValidateDependency.  [JavaScript] Added the property DLSupport.ModuleUrl.  The following methods were updated in DLSupport: curry and windowOnload.  The following methods were added to DLSupport: checkboxSelectAllToggle, cloneArray, combineArray, defaultValues, delayFunction, hideLoadingImage, inArray, isArray, isNumeric, propertyNames, reverseArray, showLoadingImage, toggleDisplay, toQueryString, and uniqueArray.  Added the subclass DLSupport.AJAX.
  • 1.0 (April 4, 2008): Make version 1.0RC1 the first stable version.  No changes to the codebase were made.
  • 1.0RC1 (March 28, 2008): Removed files that are no longer used by this module.  [JavaScript] Updated DLSupport.windowOnload so that it actually runs when the page loads.
  • 0.1 (March 15, 2008): Initial release of module.
  • 0.0 (March 10, 2008): Start of module creation.

Constants

WordRegex

const WordRegex

(String) The regex for our “word”.  This allows the period and hyphen to be part of the word.

Private Static Data

$instance

private static $instance

(DLSupport) An instance of this class.

Protected Static Data

$smarty_methods

protected static $smarty_methods

(array) An array containing methods that can be called through Smarty using {DLSupport}.

For more information regarding how the parameters for the methods are set, refer to the method CreateParameters.

The structure of this protected variable should look like the following:

array(
    {The name of the method.} => array(
        parameters => {
            (array) An array containing the parameters information
            for this method. Refer to the $structure parameter of
            the method CreateParameters for more information.
        },
        static => {
            (boolean) Whether or not the method is static. Set this
            to FALSE if it is an instance method.
        }
    ),
    ...
)

Class Construction

__construct

public function __construct()

Create a new instance of DLSupport.

Returns

(DLSupport) An instance of DLSupport.

ModuleInstance

public static function &ModuleInstance($module)

Get an instance of the given module unqiue name.

Parameters

$module(string) The unique name of the module.

Returns

(CMSModule) The module instance.

MySQLi

public static function &MySQLi()

Retrieve an instance of the database class.

Returns

(DLDatabase) An instance of DLDatabase.

NewFormCollection

public static function &NewFormCollection()

Retreive a new form collection.

Returns

(DLForm) The DLForm object.

NewTabCollection

public static function &NewTabCollection($tab_wrapper =  '',
$content_wrapper =  '')

Create a new tab collection.

Parameters

$tab_wrapper(string) Optional and defaults to a randomly generated string.  The ID of the tab wrapper.
$content_wrapper(string) Optional and defaults to a randomly generated string.  The ID of the content wrapper.

Returns

(DLTab) The DLTab object.

Singleton

public static function &Singleton()

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.

Returns

(DLSupport) An instance of this class.

Override Methods

Methods

GetAboutGet about information.
GetAuthorGet the author.
GetAuthorEmailGet the author e-mail address.
GetChangeLogGet the changelog.
GetDescriptionGet a description of module.
GetFriendlyNameGet module friendly name.
GetHelpGet help information.
GetNameGet module name.
GetParametersGet parameters.
GetVersionGet version number of module.
HasAdminWhether or not module has admin panel.
InstallPostMessageMessage to be displayed after installation.
IsPluginModuleWhether or not this is a plugin module.
MinimumCMSVersionMinimum CMS version to run this module.
UninstallPostMessageMessage to be displayed after uninstall.
UninstallPreMessageMessage to be alerted before uninstall.

Captcha Generation

Captcha

public static function Captcha($hours =  2)

Generate a new captcha image.

Parameters

$hours(int) Optional and defaults to 2.  The maximum number of hours the created captcha remains valid.

Returns

(array) The returned array will have its structure similar to the following:

array(
    image => {
        (string) The HTML to display the captcha image.
    },
    field => {
        (string) The HTML to display the input field.
    }
)

CaptchaRemove

public static function CaptchaRemove($hours)

Remove images created for captcha purposes that is older than the given number of hours.

Parameters

$hours(int) The number of hours in which if an image is older than this, it is removed.

CaptchaValidate

public static function CaptchaValidate($hours =  2)

See if the user has entered the correct value for the captcha generated by the method Captcha.

Parameters

$hours(int) 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.

Clean Admin - Deprecated

GetCleanBreadcrumb

public static function GetCleanBreadcrumb($data,
$clean_object)

Retrieve the breadcrumb for a clean admin page.

Parameters

$data(array) An array of pages containing the breadcrumb information.
$clean_object(string) The name of the clean object that will call the <DLSupportJS.CleanAdmin.LinkToJavaScript>.

The structure of the $data parameter, if given, should look like the following:

array(
    array(
        url => {
            (string) The URL of the page. This can be an empty
            string in which case, no link is created.
        },
        text => {
            (string) The title of the page.
        }
    ),
    ...
)

Returns

(string) The HTML for the breadcrumb.

GetCleanFooter

public static function GetCleanFooter()

Retrieve the HTML for the footer of the clean admin page.

As of right now, this doesn’t really do anything but for consistency sake, it will process a template.

GetCleanHeader

public static function GetCleanHeader($page_title,  
$header_content =  '')

Retrieve the HTML for the header of the clean admin page.

Parameters

$page_title(string) The title of the page.
$header_content(string) Any content to be put inside of the HEAD tag.

Returns

(string) The HTML for the header.

Cookies

RemoveCookie

public static function RemoveCookie($key)

Remove the given cookie.

Parameters

$key(string) The key for the cookie.

Smarty Usage

{DLSupport
    method='RemoveCookie'
    key={ Corresponds to the parameter $key. }
}

SetCookie

public static function SetCookie($key,
$value,
$days)

Store the given information with the given key in the cookie for the given number of days.

Parameters

$key(string) The key for the cookie.
$value(string) The value of the cookie
$days(int) The number of days in which the cookie should last.

Smarty Usage

{DLSupport
    method='SetCookie'
    key={ Corresponds to the parameter $key. }
    value={ Corresponds to the parameter $value. }
    days={ Corresponds to the parameter $days. }
}

Cryptography

Decrypt

public static function Decrypt($key,
$data)

Decrypt the given data using the given key.

Parameters

$key(string) The key for decrypting the data.
$data(string) The data to be decrypted.

Returns (mixed) The data after it has been decrypted.

Smarty Usage

{DLSupport
    method='Decrypt'
    key={ Corresponds to the parameter $key. }
    data={ Corresponds to the parameter $data. }
}

Encrypt

public static function Encrypt($key,  
$data,  
$algorithm =  FALSE)

Encrypt the given data using the given key.

Parameters

$key(string) The key for encrypting the data.
$data(mixed) The data to be encrypted.
$algorithm(mixed) Optional and defaults to FALSE.  If given is a string, it should be the algorithm to use.

Returns

(string) The data after it has been encrypted into a string.

Smarty Usage

{DLSupport
    method='Encrypt'
    key={ Corresponds to the parameter $key. }
    data={ Corresponds to the parameter $data. }
    algorithm={ Corresponds to the parameter $algorithm. }
}

CSS

GetCSSFromTemplate

public static function GetCSSFromTemplate($template_id)

Get all of the CSS that is attached to the given template.

Paramters

$template_id(int) The ID of the template.

Returns

(string) All of the CSS associated with the given template.

ParseCSS

public static function ParseCSS($css,  
$period =  TRUE)

Parse the given CSS to retrieve the class names.  Note that this will only return class names, no IDs, tags, etc.

Parameters

$css(string) The CSS to parse.
$period(boolean) Optional and defaults to TRUE.  If this is set to FALSE, then the period in front of the class name will be removed.

Returns

(array) An array containing all of the CSS class names in the given class sorted in alphabetical order.

Database

AutoExecute

public static function AutoExecute($table,  
$parameters,  
$type,  
$where =  '')

Create the necessary SQL query and execute the command.

Note that this will use the ADOdb Lite object.

Parameters

$table(string) The name of the table where the query should take place.
$parameters(array) The parameters to be inserted/updated.
$type(string) The type of SQL to create.  Possible values are: “INSERT” and “UPDATE”.
$where(string) Optional and defaults to an empty string.  If given, this should be the body of the WHERE clause.

Directory and Files

ListDirectories

public static function ListDirectories($path,  
$options =  array())

Retrieve a list of all direct sub directories of the given directory.

Note that the returned array will not contain the given directory or the parent directory.

Parameters

$path(string) The absolute path to the base directory.
$options(array) An associative array containing various options used by this method.  Refer to the method ConvertBytes for more information regarding some of the attributes.  Defaults to an empty array.

The structure of the $options parameter, if given, should look like the following:

array(
    bytes => {
        (string) Refer to the parameter "$type" from the method
        "ConvertBytes" for more information.
    },
    ignore_hidden => {
        (boolean) Whether or not hidden directories should be
        ignored. Defaults to TRUE.
    },
    reverse => {
        (boolean) Whether or not the result should be inverted.
        Defaults to FALSE.
    },
    sort => {
        (string) The way the result should be sorted. Possible
        values are: "name" and "total_space". Defaults to "name".
    }
)

Returns

(array) The returned array will have its structure similar to the following:

array(
    Object(
        name => {
            (string) The name of the directory.
        },
        path => {
            (string) The absolute path to the directory.
        }
        sub_dirs => {
            (array) An array similar to this containing sub
            directories of this directory.
        },
        total_space => {
            (int) The size of all the files in directory.
        }
    ),
    ...
)

ListFiles

public static function ListFiles($path,  
$options =  array())

Retrieve a list of all the files in the given directory.  Note that this will not include any files in sub directories.

Parameters

$path(string) The absolute path to the base directory.
$options(array) An associative array containing various options used by this method.  Refer to the method ConvertBytes for more information regarding some of the attributes.  Defaults to an empty array.

The structure of the $options parameter, if given, should look like the following:

array(
    bytes => {
        (string) Refer to the parameter "$type" of the method
        ConvertBytes for more information.
    },
    ignore_hidden => {
        (boolean) Whether or not hidden directories should be
        ignored. Defaults to TRUE.
    },
    reverse => {
        (boolean) Whether or not the result should be inverted.
        Defaults to FALSE.
    },
    sort => {
        (string) The way the result should be sorted. Possible
        values are: "access_time", "filename", "file_size", and
        "modified_time". Defaults to "filename".
    }
)

Returns

(array) The returned array will have its structure similar to the following:

array(
    Object(
        access_time => {
            (int) The time of last access as a UNIX timestamp.
        },
        filename => {
            (string) The filename.
        },
        file_size => {
            (int) The size of the file.
        },
        modified_time => {
            (int) The time of last modification as a UNIX timestamp.
        },
        full_path => {
            (string) The absolute path to the file.
        }
    ),
    ...
)

Miscellaneous

CleanExit

public static function CleanExit($message)

Clear all the currently opened output buffer then terminate execution with the given message.

Parameters

$message(string) The message to be outputted.

Smarty Usage

{DLSupport
    method='CleanExit'
    message={ Corresponds to the parameter $message. }
}

ConvertBytes

public static function ConvertBytes($bytes,
$type)

Convert the given bytes to the specified type.

Parameters

$bytes(numeric) The bytes to be converted.
$type(string) The type to be converted to.  This can be any of the following: “b” for bytes (stays the same), “k” for kilobytes, “m” for megabytes, “g” for gigabytes, and “t” for terrabytes.

Returns

(numeric) The given bytes after it has been converted to the specified type.

Smarty Usage

{DLSupport
    method='ConvertBytes'
    bytes={ Corresponds to the parameter $bytes. }
    type={ Corresponds to the parameter $type. }
}

ExecuteCommand

public static function ExecuteCommand($dir,
$commands)

Execute the given list of commands.

Parameters

$dir(string) The directory where the given list of commands should be executed in.
$commands(array) An array containing the list of commands.

GetIcon

public static function GetIcon($size,  
$icon,  
$alt =  '',
$theme =  'aesthetica2')

Retrieve the HTML for an icon.

Parameters

$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) 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) 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.

Smarty Usage

{DLSupport
    method='GetIcon'
    size={ Corresponds to the parameter $size. }
    icon={ Corresponds to the parameter $icon. }
    alt={ Corresponds to the parameter $alt. }
    theme={ Corresponds to the parameter $theme. }
}

GetPageInfo

public static function GetPageInfo($info)

Retrieve information about the current page.

Parameters

$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 information.

Smarty Usage

{DLSupport
    method='GetPageInfo'
    info={ Corresponds to the parameter $info. }
}

IncludeJavaScript

public static function IncludeJavaScript($force =  FALSE)

Include the JavaScript support file.

This method has been deprecated in favor of using Prototype’s framework but for the sake of backwards compatibility and the lack of flexibility on CMS’s front of a truly flexible framework, this will be kept indefinitely.

Parameters

$force(boolean) Optional and defaults to FALSE.  Technically, this should only be outputted once to the screen.  For that reason, this will only return the result once.  Any other time, it will just return an empty string.  However, you can force the return of the output if you set this to TRUE.

Returns

(string) The HTML that will include the neccessary JavaScript.

Smarty Usage

{DLSupport
    method='IncludeJavaScript'
    force={ Corresponds to the parameter $force. }
}

IsWord

public static function IsWord($word)

Determien whether or not the provided string is a word using our regular pattern.  Refer to WordRegex.

Parameters

$word(String) The string to test.

Returns

(boolean) Returns true if the string matches our regular expression of a word, false otherwise.

JSON

public static function JSON($data)

Terminate the execution of the script but outputting the given array as a JSON.

Parameters

$data(array) The array of data to be encoded and outputted.

ModulePath

public static function ModulePath($module)

Retrieve the absolute path to the given module.

Parameters

$module(string) The unique name of the module.

Returns

(mixed) The absolute path to the module.  If the path to the module does not exist, this returns FALSE.

Smarty Usage

{DLSupport
    method='ModulePath'
    module={ Corresponds to the parameter $module. }
}

ModuleURL

public static function ModuleURL($module)

Retrieve the absolute url to the given module.

Parameters

$module(string) The unique name of the module.

Returns

(string) The absolute url to the module.

Smarty Usage

{DLSupport
    method='ModuleURL'
    module={ Corresponds to the parameter $module. }
}

NewFormStart

public static function NewFormStart(&$module,  
$id,  
$action =  'default',
$returnid =  '',
$method =  'post',
$params =  array(),
$extras =  array())

This is very similar to the method CreateFormStart except that it does not encode the content of the extras array.

Parameters

$module(CMSModule) The module object that is calling this method.
$id(string) The id given to the module on execution.
$action(string) Optional and defaults to “default”.  The action that this form should do when it is submitted.
$returnid(string) Optional and defaults to an empty string.  The ID to eventually return to when the module is finished with its task.
$method(string) Optional and defaults to “post”.  The form method to use.
$params(array) 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) 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.

OutputUploadResponse

public static function OutputUploadResponse($data)

Output the response page for the uploaded of a file.

Parameters

$data(array) An associative array containing any data that should be returned as a JSON so that a function can use it.  Defaults to an empty array.

Returns

(string) The HTML for the server response.

Protoaculous

public static function Protoaculous()

Retrieve the HTML for including Prototype, script.aculo.us from Google as well as the supporting JS frameworking.

Returns

(string) The HTML for including the JS framework.

Smarty Usage

{DLSupport
    method='Protoaculous'
}

SanitizeString

public static function SanitizeString($data,  
$input =  FALSE)

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.

Parameters

$data(mixed) The data to be filtered.
$input(mixed) 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

(mixed) The string after the data has been filtered.  This will return FALSE if it failed.

UploadFileResponse

public static function UploadFileResponse($data =  array())

Retrieve the HTML for the response from the server.

Parameters

$data(array) An associative array containing any data that should be returned as a JSON so that a function can use it.  Defaults to an empty array.

Returns

(string) The HTML for the server response.

UploadPageResponse

public static function UploadPageResponse($data)

Output the upload response page.

Parameters

$data(array) An associative array containing any data that should be returned as a JSON so that a function can use it.  Defaults to an empty array.

Module Dependency

CompareVersions

public static function CompareVersions($module,
$version,
&$validate_failed)

See if the installed version of the given module is less than the given version.

The checking scheme is: 2 = 2.0.0.0 > 2.0.0.0RC12 > 2.0.0.0RC2 > 1.11.12.34 > 1.2.12.43.

Parameters

$module(string) The name of the module to test.
$version(string) The version to test against.
$valide_failed(boolean) The current result of the validation.  If TRUE, then validation has failed, FALSE otherwise.

Returns

(boolean) Returns TRUE if the installed version is less than the given version, FALSE otherwise.

Smarty Related Methods

CreateParameters

public static function CreateParameters($structures,
$data)

Create the appropriate parameters array to be send to the function call_user_func_array.

Parameters

$structures(array) An associative array containing how the parameters array should be built.
$data(array) An associative array containing the data for the parameters.

The structure of the $structures parameters, if given, should look like the following:

array(
    {The name of the parameter.} => array(
        default => {
            (mixed) The default value to use for this parameter if
            it is optional and wasn't provided by the user. Defaults
            to NULL.
        },
        is_array => {
            (boolean) Whether or not this parameter is expected to
            be an array. Defaults to FALSE.
        },
        optional => {
            (boolean) Whether or not this parameter is optional.
            Defaults to FALSE.
        },
        string_to_array => {
            (boolean) Whether to convert the provided value into an
            array where the pipe character, "|", separates each item
            and the equal plus greater than symbol, "=>", separates
            the item's key and its value. Note that the keys are
            optional. If it is not provided, then the array will
            just be normally incremented. If this is set to FALSE,
            then it is assumed that this parameter will be used to
            be an inner array following this same structure.
            Defaults to FALSE.
        },
        sub_elements => {
            (array) If "is_array" is TRUE, then this should be
            similar to the overlying array. Defaults to an empty
            array.
        }
    ),
    ...
)

Returns

(array) The parameters array.

Deprecated Data

$DLSupport_data

private $DLSupport_data

(array) An array contain various data.

Note that this will be removed complete by version 3.0.

Deprecated Methods

ValidateDependency

public static function ValidateDependency($module,
$version,
&$validate_failed)

Determine whether or not the given module name has been installed up to at least the given version.

The checking scheme is: 2.0 > 1.2 > 1.12 > 1.1 > 1.1RC2 > 1.1RC1 > 1.0

Note that this kind of validation checking scheme is not really wide used so this is now considered deprecated.

Parameters

$module(string) The name of the module to test.
$version(string) The minimum version required to pass the test.
$validate_failed(boolean) The current result of the validation.  If TRUE, then validation has failed, FALSE otherwise.

Returns

(boolean) Returns TRUE if the validation has failed, FALSE otherwise.  Basically, this will have the same value as $validate_failed.

const WordRegex
(String) The regex for our “word”.
private static $instance
(DLSupport) An instance of this class.
protected static $smarty_methods
(array) An array containing methods that can be called through Smarty using {DLSupport}.
public function __construct()
Create a new instance of DLSupport.
public static function &ModuleInstance($module)
Get an instance of the given module unqiue name.
public static function &MySQLi()
Retrieve an instance of the database class.
public static function &NewFormCollection()
Retreive a new form collection.
public static function &NewTabCollection($tab_wrapper =  '',
$content_wrapper =  '')
Create a new tab collection.
public static function &Singleton()
This method will return an instance of this class.
public static function Captcha($hours =  2)
Generate a new captcha image.
public static function CaptchaRemove($hours)
Remove images created for captcha purposes that is older than the given number of hours.
public static function CaptchaValidate($hours =  2)
See if the user has entered the correct value for the captcha generated by the method Captcha.
public static function GetCleanBreadcrumb($data,
$clean_object)
Retrieve the breadcrumb for a clean admin page.
public static function GetCleanFooter()
Retrieve the HTML for the footer of the clean admin page.
public static function GetCleanHeader($page_title,  
$header_content =  '')
Retrieve the HTML for the header of the clean admin page.
public static function RemoveCookie($key)
Remove the given cookie.
public static function SetCookie($key,
$value,
$days)
Store the given information with the given key in the cookie for the given number of days.
public static function Decrypt($key,
$data)
Decrypt the given data using the given key.
public static function Encrypt($key,  
$data,  
$algorithm =  FALSE)
Encrypt the given data using the given key.
public static function GetCSSFromTemplate($template_id)
Get all of the CSS that is attached to the given template.
public static function ParseCSS($css,  
$period =  TRUE)
Parse the given CSS to retrieve the class names.
public static function AutoExecute($table,  
$parameters,  
$type,  
$where =  '')
Create the necessary SQL query and execute the command.
public static function ListDirectories($path,  
$options =  array())
Retrieve a list of all direct sub directories of the given directory.
public static function ListFiles($path,  
$options =  array())
Retrieve a list of all the files in the given directory.
public static function CleanExit($message)
Clear all the currently opened output buffer then terminate execution with the given message.
public static function ConvertBytes($bytes,
$type)
Convert the given bytes to the specified type.
public static function ExecuteCommand($dir,
$commands)
Execute the given list of commands.
public static function GetIcon($size,  
$icon,  
$alt =  '',
$theme =  'aesthetica2')
Retrieve the HTML for an icon.
public static function GetPageInfo($info)
Retrieve information about the current page.
public static function IncludeJavaScript($force =  FALSE)
Include the JavaScript support file.
public static function IsWord($word)
Determien whether or not the provided string is a word using our regular pattern.
public static function JSON($data)
Terminate the execution of the script but outputting the given array as a JSON.
public static function ModulePath($module)
Retrieve the absolute path to the given module.
public static function ModuleURL($module)
Retrieve the absolute url to the given module.
public static function NewFormStart(&$module,  
$id,  
$action =  'default',
$returnid =  '',
$method =  'post',
$params =  array(),
$extras =  array())
This is very similar to the method CreateFormStart except that it does not encode the content of the extras array.
public static function OutputUploadResponse($data)
Output the response page for the uploaded of a file.
public static function Protoaculous()
Retrieve the HTML for including Prototype, script.aculo.us from Google as well as the supporting JS frameworking.
public static function SanitizeString($data,  
$input =  FALSE)
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.
public static function UploadFileResponse($data =  array())
Retrieve the HTML for the response from the server.
public static function UploadPageResponse($data)
Output the upload response page.
public static function CompareVersions($module,
$version,
&$validate_failed)
See if the installed version of the given module is less than the given version.
public static function CreateParameters($structures,
$data)
Create the appropriate parameters array to be send to the function call_user_func_array.
private $DLSupport_data
(array) An array contain various data.
public static function ValidateDependency($module,
$version,
&$validate_failed)
Determine whether or not the given module name has been installed up to at least the given version.
Provides a wrapper around the MySQLi functions.
ServerResponse: function(transport)
Process the server response.
Encryption class based of AES.
Provides a framework for management of forms.
Use in conjunction with DLSupportJS.Tab to hanlde a tab collection.