Methods available in the main backend class

From Site Foundry

Jump to: navigation, search

The following short list of methods are available within the main backend class and can be called from within your modules' backend.class.php. For example, to create a URI safe version of a string (and make it consistent with the rest of the application), you would use something like:

$aVar = parent::URISafeString($myString)

Methods

The following list will grow over time to incorporate new features that you may need. If you have any suggestions, please get in touch.

clean

@param string $data
@return string

Description
Returns a file name that has been cleaned up for the file system.

tidyFileName

@param string $usrInput
@param string $extension
@return string

Description
Returns a file name that is guaranteed not to be the same regardless of the input (based around random number generation).

$usrInput - user generated file name
$extension - file extension

 URISafeString

@param string $string
@return string

Description
Generates and returns a safe URI version of your string

alreadyExists

@param string $table
@param string $field
@param string $data
@return boolean

Description
Returns true or false based on the existence of a row already in a database table.

$table - table name that needs to be checked
$field - field that value will exist in
$data - value to be matched

Use in the form - parent::alreadyExists($table, $field, $data)

isValidEmail

@param string $email
@return boolean

Description
Validates an email address, returns true on success

isValidUri

@param string $uri
@return boolean

Description
Validates a URI string, returns true on success

cleanField

@param string $field
@return string

Description
Converts a field name such as category_34 to category or category_uri_34 to category_uri. This is used when an item of data is being sent via AJAX to the server. Obviously, if a number of the same item are being edited at once, then each will need to have it's own id - hence field names in templates are always based around fieldName_id. This method will return just the field name portion of the string.

getAccessLevels

@param string $resource
@return string

Description
Returns an array of permissions for each part of a module, defined by the module maker.

Personal tools