\CJAX\Plugins\ValidateValidate

The Validate class, it provides public API for plugin Jquery Validate.

Since CJAX 6.0, Plugin class is lightweight and only contains information of one specific plugin object.

Summary

Methods
Properties
Constants
__construct()
init()
isAborted()
abort()
xmlObject()
xml()
output()
delete()
import()
imports()
waitFor()
get()
set()
setVars()
save()
deleteEntry()
callback()
prevent()
__get()
__set()
__call()
rightHandler()
onLoad()
onAjaxLoad()
rule()
$ajaxFile
$id
$name
$dir
$file
$controllersDir
$controllerFile
$init
$xml
$params
$class
$elementId
$entryIds
No constants found
No protected methods found
$coreEvents
$cookie
$aborted
N/A
setVar()
$rules
N/A

Properties

$ajaxFile

$ajaxFile : boolean

The ajaxFile property, it will replace any string starting with ajax.php to full url if true.

Type

boolean

$id

$id : integer

The id property, assigns an id if the plugin is used for more than once on a page.

This id will be useful to do modifications in later execution.

Type

integer

$name

$name : string

The name property, defines the plugin name and the identity key for a plugin.

Type

string

$dir

$dir : string

The dir property, specifies the main directory for a given plugin.

Type

string

$file

$file : string

The file property, defines the name of javascript file name for plugin.

By default it is the plugin's name, but can be different.

Type

string

$controllersDir

$controllersDir : string

The controllersDir property, specifies the controllers directory for this plugin.

By default it is 'controllers', but can be different.

Type

string

$controllerFile

$controllerFile : string

The controllersFile property, defines the controllers file name for this plugin.

Type

string

$init

$init : string

The init property, which is an executable string runs before plugin is created.

Type

string

$xml

$xml : \CJAX\Core\XmlItem

The xml property, stores an instance of XmlItem object for this plugin.

Type

\CJAX\Core\XmlItem

$params

$params : array

The params property, specifies the plugin arguments.

Type

array

$class

$class : string

The class property, defines a class pertaining to an addon.

Type

string

$elementId

$elementId : string

The elementId property, stores the element Id associated with plugin event.

Type

string

$entryIds

$entryIds : array

The entryIds property, stores an array of entry ids for this plugin.

Type

array

$coreEvents

$coreEvents : \CJAX\Core\CoreEvents

The coreEvents property, stores an instance of injected CoreEvents object.

Type

\CJAX\Core\CoreEvents

$cookie

$cookie : boolean

The cookie property, it will use cookie instead of session if true.

Type

boolean

$aborted

$aborted : boolean

The aborted property, specifes if the plugin is aborted.

Type

boolean

$rules

$rules : array

The rules property, stores an arrays of validation rules.

Type

array

Methods

__construct()

__construct(\CJAX\Core\CoreEvents  $coreEvents, array  $array = array()) : \CJAX\Core\Plugin

The constructor for Plugin class, creates an instance of Plugin object.

Parameters

\CJAX\Core\CoreEvents $coreEvents
array $array

Returns

\CJAX\Core\Plugin

init()

init() : string

The init method, fetches the executable string for $init.

Returns

string

isAborted()

isAborted() : boolean

The isAborted method, checks if this plugin has been aborted.

Returns

boolean

abort()

abort() : void

The abort method, terminates plugin executation and deletes plugin entry ids.

xmlObject()

xmlObject() : \CJAX\Core\XmlItem

The xmlObject method, gets the XmlItem object associated with this plugin.

Returns

\CJAX\Core\XmlItem

xml()

xml() : integer

The xml method, mirrors XmlItem's xml() method.

Returns

integer

output()

output() : object

The output method, mirrors XmlItem's output() method.

Returns

object

delete()

delete() : object

The delete method, mirrors XmlItem's delete() method.

Returns

object

import()

import(string  $file, integer  $loadTime, boolean  $onInit = false) : void

The import method, imports and caches a JavaScript or CSS file.

Parameters

string $file
integer $loadTime
boolean $onInit

imports()

imports(array  $files = array(), array  $data = array()) : void

The imports method, imports and caches JavaScript or CSS files.

Parameters

array $files
array $data

waitFor()

waitFor(string  $file) : void

The waitFor method, wait for javascript file to be loaded before firing plugin.

Parameters

string $file

get()

get(string  $setting, string  $prefix = null) : mixed

The get method, gets a setting that has been saved with save() function.

Parameters

string $setting
string $prefix

Returns

mixed

set()

set(string  $setting, mixed  $value, integer  $instanceId = null) : void

The set method, updates parameters using plugin class.

Parameters

string $setting
mixed $value
integer $instanceId

setVars()

setVars(string  $setting, mixed  $value) : void

The setVars method, set variables that can be accessed as this.var in javascript for all instance ids.

Parameters

string $setting
mixed $value

save()

save(string  $setting, mixed  $value, string  $prefix = null) : void

The save method, saves values in a cookie or session for future use.

Parameters

string $setting
mixed $value
string $prefix

deleteEntry()

deleteEntry(integer  $entryId) : void

The deleteEntry method, deletes an entry id for plugin.

Parameters

integer $entryId

callback()

callback(object  $apiObj) : void

The callback method, assigns an API as javascript callback function.

Parameters

object $apiObj

prevent()

prevent(object  $apiObj) : void

The prevent method, intercepts an API and prevent it from being fired.

Parameters

object $apiObj

__get()

__get(string  $setting) : mixed

The magic method __get, dynamically gets a setting/parameter for plugin.

Parameters

string $setting

Returns

mixed

__set()

__set(string  $setting, mixed  $value) : void

The magic method __set, dynamically sets a parameter/setting for plugin.

Parameters

string $setting
mixed $value

__call()

__call(string  $api, array  $args) : void

The magic method __call, carries out right handlers chain APIs.

Parameters

string $api
array $args

rightHandler()

rightHandler(string  $api, array  $args, object  $xmlObj) : void

The rightHandler method, handles right API assignments.

Parameters

string $api
array $args
object $xmlObj

onLoad()

onLoad(string  $buttonId, string  $postUrl, array  $rules = array(), boolean  $importJs = false) : void

The onLoad method, it is called when the plugin is loaded for the first time.

Parameters

string $buttonId
string $postUrl
array $rules
boolean $importJs

onAjaxLoad()

onAjaxLoad(string  $buttonId, string  $postUrl, array  $rules = array()) : void

The onAjaxLoad method, it is called when the plugin is loaded by an AJAX request.

For this plugin, it simply calls onLoad method for AJAX requests, only no need to import jquery library file.

Parameters

string $buttonId
string $postUrl
array $rules

rule()

rule(array  $name, array  $rule) : void

The rule method, adds additional rules for validation.

Parameters

array $name
array $rule

setVar()

setVar(string  $setting, mixed  $value, integer  $instanceId) : void

The setVar method, set variables that can be accessed as this.var in javascript.

Parameters

string $setting
mixed $value
integer $instanceId