Properties

$cache

$cache : \CJAX\Core\Cache

The cache property, stores a reference to the cache object.

Type

\CJAX\Core\Cache

$config

$config : \CJAX\Core\Config|\CJAX\Core\Ext

The config property, specifies the configuration variables for CJAX.

Type

\CJAX\Core\Config|\CJAX\Core\Ext

$coreEvents

$coreEvents : \CJAX\Core\CoreEvents

The coreEvents property, holds a reference to the core events object.

Type

\CJAX\Core\CoreEvents

$domEvents

$domEvents : \CJAX\Core\DOMEvents

The domEvents property, stores a reference to the dom events object.

Type

\CJAX\Core\DOMEvents

$format

$format : 

Type

$pluginManager

$pluginManager : \CJAX\Core\PluginManager

The pluginManager property, holds a reference to the plugin manager object.

Type

\CJAX\Core\PluginManager

$request

$request : \CJAX\Core\Request

The request property, stores a reference to CJAX request object.

Type

\CJAX\Core\Request

$includes

$includes : string

The includes property, specifies if there are external files/libraries to include.

Type

string

$CJAX

$CJAX : \CJAX\Core\CJAX

The CJAX property, stores the singleton instance of CJAX.

Type

\CJAX\Core\CJAX

Methods

getInstance()

getInstance() : \CJAX\Core\CJAX

The static method getInstance, acquires the singleton instance for CJAX class.

This method will be deprecated in future and removed in CJAX 7.0.

Returns

\CJAX\Core\CJAX

click()

click(string  $elementId, array  $actions = array()) : \CJAX\Core\XmlItem

The click method, assigns a click AJAX event to the given element.

Parameters

string $elementId
array $actions

Returns

\CJAX\Core\XmlItem

change()

change(string  $elementId, array  $actions) : \CJAX\Core\XmlItem

The change method, assigns a change AJAX event to the given element.

Parameters

string $elementId
array $actions

Returns

\CJAX\Core\XmlItem

blur()

blur(string  $elementId, array  $actions) : \CJAX\Core\XmlItem

The blur method, assigns a blur AJAX event to the given element.

Parameters

string $elementId
array $actions

Returns

\CJAX\Core\XmlItem

keyup()

keyup(string  $elementId, array  $actions) : \CJAX\Core\XmlItem

The keyup method, assigns a keyup AJAX event to the given element.

Parameters

string $elementId
array $actions

Returns

\CJAX\Core\XmlItem

keydown()

keydown(string  $elementId, array  $actions) : \CJAX\Core\XmlItem

The keydown method, assigns a keydown AJAX event to the given element.

Parameters

string $elementId
array $actions

Returns

\CJAX\Core\XmlItem

keypress()

keypress(string  $elementId, mixed  $actions, string  $key = null) : \CJAX\Core\XmlItem

The keypress method, assigns a keypress AJAX event to the given element.

KeyPress is a relatively complex event, it is handled by DomEvents class internally.

Parameters

string $elementId
mixed $actions
string $key

Returns

\CJAX\Core\XmlItem

rightclick()

rightclick(string  $elementId, array  $actions) : \CJAX\Core\XmlItem

The rightclick method, assigns a rightclick AJAX event to the given element.

Parameters

string $elementId
array $actions

Returns

\CJAX\Core\XmlItem

doubleclick()

doubleclick(string  $elementId, array  $actions) : \CJAX\Core\XmlItem

The doubleclick method, assigns a doubleclick AJAX event to the given element.

Parameters

string $elementId
array $actions

Returns

\CJAX\Core\XmlItem

mouseover()

mouseover(string  $elementId, array  $actions) : \CJAX\Core\XmlItem

The mouseover method, assigns a mouseover AJAX event to the given element.

Parameters

string $elementId
array $actions

Returns

\CJAX\Core\XmlItem

mouseout()

mouseout(string  $elementId, array  $actions) : \CJAX\Core\XmlItem

The mouseout method, assigns a mouseout AJAX event to the given element.

Parameters

string $elementId
array $actions

Returns

\CJAX\Core\XmlItem

mouseenter()

mouseenter(string  $elementId, array  $actions) : \CJAX\Core\XmlItem

The mouseenter method, assigns a mouseenter AJAX event to the given element.

Parameters

string $elementId
array $actions

Returns

\CJAX\Core\XmlItem

mouseleave()

mouseleave(string  $elementId, array  $actions) : \CJAX\Core\XmlItem

The mouseleave method, assigns a mouseleave AJAX event to the given element.

Parameters

string $elementId
array $actions

Returns

\CJAX\Core\XmlItem

mousedown()

mousedown(string  $elementId, array  $actions) : \CJAX\Core\XmlItem

The mousedown method, assigns a mousedown AJAX event to the given element.

Parameters

string $elementId
array $actions

Returns

\CJAX\Core\XmlItem

mouseup()

mouseup(string  $elementId, array  $actions) : \CJAX\Core\XmlItem

The mouseup method, assigns a mouseup AJAX event to the given element.

Parameters

string $elementId
array $actions

Returns

\CJAX\Core\XmlItem

mousemove()

mousemove(string  $elementId, array  $actions) : \CJAX\Core\XmlItem

The mousemove method, assigns a mousemove AJAX event to the given element.

Parameters

string $elementId
array $actions

Returns

\CJAX\Core\XmlItem

drag()

drag(string  $elementId, array  $actions,   $dataTransfer = null) : \CJAX\Core\XmlItem

The drag method, assigns a drag AJAX event to the given element.

Parameters

string $elementId
array $actions
$dataTransfer

Returns

\CJAX\Core\XmlItem

dragend()

dragend(string  $elementId, array  $actions,   $dataTransfer = null) : \CJAX\Core\XmlItem

The dragend method, assigns a dragend AJAX event to the given element.

Parameters

string $elementId
array $actions
$dataTransfer

Returns

\CJAX\Core\XmlItem

dragenter()

dragenter(string  $elementId, array  $actions,   $dataTransfer = null) : \CJAX\Core\XmlItem

The dragenter method, assigns a dragenter AJAX event to the given element.

Parameters

string $elementId
array $actions
$dataTransfer

Returns

\CJAX\Core\XmlItem

dragleave()

dragleave(string  $elementId, array  $actions,   $dataTransfer = null) : \CJAX\Core\XmlItem

The dragleave method, assigns a dragleave AJAX event to the given element.

Parameters

string $elementId
array $actions
$dataTransfer

Returns

\CJAX\Core\XmlItem

dragover()

dragover(string  $elementId, array  $actions,   $dataTransfer = null) : \CJAX\Core\XmlItem

The dragover method, assigns a dragover AJAX event to the given element.

Parameters

string $elementId
array $actions
$dataTransfer

Returns

\CJAX\Core\XmlItem

dragstart()

dragstart(string  $elementId, array  $actions,   $dataTransfer = null) : \CJAX\Core\XmlItem

The dragstart method, assigns a dragstart AJAX event to the given element.

Parameters

string $elementId
array $actions
$dataTransfer

Returns

\CJAX\Core\XmlItem

drop()

drop(string  $elementId, array  $actions,   $dataTransfer = null) : \CJAX\Core\XmlItem

The drop method, assigns a drop AJAX event to the given element.

Parameters

string $elementId
array $actions
$dataTransfer

Returns

\CJAX\Core\XmlItem

ajaxVars()

ajaxVars(array  $vars) : void

The call method, it is used to pass extra variables to POST ajax.

This method is currently used in iframe uploads.

Parameters

array $vars

cacheWrapper()

cacheWrapper(array  $wrapper = array()) : void

The cacheWrapper method, create a cache wrapper.

It provides a public API for singleton ajax object to call cacheWrapper method on CoreEvents object.

Parameters

array $wrapper

call()

call(string  $url, string  $containerId = null, string  $confirm = null) : \CJAX\Core\XmlItem

The call method, create Ajax calls with CJAX.

It provides a public API for singleton ajax object to call call method on DOMEvents object.

Parameters

string $url
string $containerId
string $confirm

Returns

\CJAX\Core\XmlItem

camelize()

camelize(string  $string, boolean  $ucfirst = true) : string

The camelize method, create camelized string with given parameter.

Parameters

string $string
boolean $ucfirst

Returns

string

clear()

clear(boolean  $all = false) : void

The clear method, clears all cjax cookie and session data.

Parameters

boolean $all

code()

code(string  $data, boolean  $tags = true) : string

The code method, shows and formats custom code.

It provides a public API for singleton ajax object to call code method on Format object.

Parameters

string $data
boolean $tags

Returns

string

crossdomain()

crossdomain(string  $url) : void

The crossdomain method, performs cross domain requests.

Parameters

string $url

dialog()

dialog(string  $content, string  $title = null, array  $options = array()) : \CJAX\Core\XmlItem

The dialog method, triggers a CJAX dialog with specified information.

Parameters

string $content
string $title
array $options

Returns

\CJAX\Core\XmlItem

debug()

debug(array  $data, string  $title = 'Debug Information', array  $extra = null) : void

The debug method, shows debug information for CJAX processes.

Parameters

array $data
string $title
array $extra

error()

error(string  $msg = "Error!", integer  $seconds = 15) : integer

The error method, display an error message in the middle of the screen.

If number of seconds is specified, the message will disappear after the time elapses.

Parameters

string $msg
integer $seconds

Returns

integer

exec()

exec(string  $selector, array  $actions, string  $event = "click") : \CJAX\Core\XmlItem

The exec method, binds any events to given elements.

It provides a public API for singleton ajax object to call exec method on CoreEvents object.

Parameters

string $selector
array $actions
string $event

Returns

\CJAX\Core\XmlItem

form()

form(string  $url, string  $formId = null, string  $containerId = null, string  $confirm = null) : \CJAX\Core\XmlItem

The form method, converts a form into AJAX form and submits this form.

It provides a public API for singleton ajax object to call form method on DOMEvents object.

Parameters

string $url
string $formId
string $containerId
string $confirm

Returns

\CJAX\Core\XmlItem

get()

get(string  $setting, boolean  $getAsObject = false) : mixed

The get method, acquires session or cookie value.

If the parameter $getAsObject is true, array values will be converted into objects. It provides a public API for singleton ajax object to call get method on CoreEvents object.

Parameters

string $setting
boolean $getAsObject

Returns

mixed

import()

import(string  $file, integer  $loadTime) : integer

The import method, imports css and javascript files.

It provides a public API for singleton ajax object to call form method on CoreEvents object.

Parameters

string $file
integer $loadTime

Returns

integer

info()

info(string  $msg = null, integer  $seconds = 3) : integer

The info method, display a custom information message in the middle of the screen.

If number of seconds is specified, the message will disappear after the time elapses.

Parameters

string $msg
integer $seconds

Returns

integer

init()

init(boolean  $min = true) : string

The init method, initiates the process of sending the javascript file to the application.

It provides a public API for singleton ajax object to call init method on CoreEvents object.

Parameters

boolean $min

Returns

string

input()

input(string  $value = 'cjax') : boolean

The input method, fetches input for CJAX request.

It provides a public API for singleton ajax object to call input method on CoreEvents object.

Parameters

string $value

Returns

boolean

isAjaxRequest()

isAjaxRequest() : boolean

The isAjaxRequest method, tells if the given request is ajax request.

It provides a public API for singleton ajax object to call isPlugin method on CoreEvents object.

Returns

boolean

isPlugin()

isPlugin(string  $pluginName) : boolean

The isPlugin method, tells if plugin exists or not regardless of it having a class or not.

It provides a public API for singleton ajax object to call isPlugin method on PluginManager object.

Parameters

string $pluginName

Returns

boolean

js()

js(string  $jsdir, boolean  $force = false) : boolean

The js method, it sets up the directory where the CJAX FRAMEWORK resides.

It provides a public API for singleton ajax object to call js method on CoreEvents object.

Parameters

string $jsdir
boolean $force

Returns

boolean

jsCode()

jsCode(string  $data, boolean  $tags = false, string  $output = null) : string

The jsCode method, displays and formats javascript code.

It provides a public API for singleton ajax object to call jsCode method on CoreEvents object.

Parameters

string $data
boolean $tags
string $output

Returns

string

jsonEncode()

jsonEncode(array  $array) : string

The jsonEncode method, encode an array to json format.

It provides a public API for singleton ajax object to call jsonEncode method on CoreEvents object.

Parameters

array $array

Returns

string

loading()

loading(string  $msg = "Loading...") : integer

The loading method, display a custom loading message in the middle of the screen.

If number of seconds is specified, the message will disappear after the time elapses.

Parameters

string $msg

Returns

integer

location()

location(string  $url = null) : integer

The location method, redirect the page.

This is a recommended alternative to the built-in php function header().

Parameters

string $url

Returns

integer

message()

message(string  $message, integer  $seconds = 3, string  $containerId = 'cjax_message') : integer

The message method, display a message in the middle of the screen.

If number of seconds is specified, the message will disappear after the time elapses.

Parameters

string $message
integer $seconds
string $containerId

Returns

integer

overLay()

overLay(string  $url = null, array  $options = array(), boolean  $useCache = false) : \CJAX\Core\XmlItem

The overLay method, shows an overlay of resources from a given url.

It provides a public API for singleton ajax object to call overLay method on DOMEvents object.

Parameters

string $url
array $options
boolean $useCache

Returns

\CJAX\Core\XmlItem

overlayContent()

overlayContent(string  $content = null, array  $options = null) : \CJAX\Core\XmlItem

The overLay method, shows an overlay with supplied html content.

It provides a public API for singleton ajax object to call overLayContent method on DOMEvents object.

Parameters

string $content
array $options

Returns

\CJAX\Core\XmlItem

plugin()

plugin(string  $pluginName, boolean  $loadController = false) : \CJAX\Core\Plugin

The plugin method, loads a plugin given its name.

It provides a public API for singleton ajax object to call plugin method on PluginManager object.

Parameters

string $pluginName
boolean $loadController

Returns

\CJAX\Core\Plugin

post()

post(string  $url, array  $vars = array()) : \CJAX\Core\XmlItem

The post method, it uses call() to post stuff.

It provides a public API for singleton ajax object to call post method on DOMEvents object.

Parameters

string $url
array $vars

Returns

\CJAX\Core\XmlItem

postVars()

postVars(array  $vars = array()) : void

The post method, it passes data to PHP $_POST array.

It provides a public API for singleton ajax object to call postVars method on DOMEvents object.

Parameters

array $vars

prevent()

prevent(string  $pluginName, string  $id, integer  $count = 1) : void

The prevent method, it prevents other APIS and saving them to stack that can be retrieved by plugins.

Parameters

string $pluginName
string $id
integer $count

process()

process(string  $msg = "Processing...", integer  $seconds = 3) : integer

The process method, display a processing message in the middle of the screen.

If number of seconds is specified, the message will disappear after the time elapses.

Parameters

string $msg
integer $seconds

Returns

integer

property()

property(string  $elementId, string  $value = '',   $clearDefault = false,   $selectText = false) : integer

The property method, sets value to an element.

Parameters

string $elementId
string $value
$clearDefault
$selectText

Returns

integer

readCache()

readCache(string  $crc32 = null) : string

The readCache method, reads available cache for CJAX.

Parameters

string $crc32

Returns

string

remove()

remove(string  $obj) : void

The remove method, it will remove an specified element from the page

Parameters

string $obj

save()

save(string  $setting, mixed  $value = null, boolean  $useCookie = false) : void

The save method, saves custom data for CJAX to use.

It provides a public API for singleton ajax object to call post method on CoreEvents object.

Parameters

string $setting
mixed $value
boolean $useCookie

select()

select(string  $element, array  $options = array(), mixed  $selected = null, boolean  $allowInput = false) : integer

The select method, selects an item/option in an AJAX change event.

Parameters

string $element
array $options
mixed $selected
boolean $allowInput

Returns

integer

style()

style(string  $elementId, array  $style = array()) : integer

The style method, assigns styles to an element.

Parameters

string $elementId
array $style

Returns

integer

success()

success(string  $msg = "Success!", integer  $seconds = 3) : integer

The success method, display a success message in the middle of the screen.

If number of seconds is specified, the message will disappear after the time elapses.

Parameters

string $msg
integer $seconds

Returns

integer

tapCache()

tapCache(string  $crc32) : string

The tapCache method, acquires available cache for CJAX.

Parameters

string $crc32

Returns

string

update()

update(string  $elementId, string  $data = null) : integer

The update method, updates any element on the page by specifying the element ID.

Usage: $ajax->update('elementId', $content);

Parameters

string $elementId
string $data

Returns

integer

wait()

wait(  $seconds, boolean  $milliseconds = false, boolean  $expand = true) : \CJAX\Core\CoreEvents

The wait method, it will execute a command in a specified amouth of time.

It provides a public API for singleton ajax object to call wait method on CoreEvents object.

Parameters

$seconds
boolean $milliseconds
boolean $expand

Returns

\CJAX\Core\CoreEvents

waitFor()

waitFor(string  $file, boolean  $waitForFile) : void

The waitFor method, it will execute after a file loads.

Parameters

string $file
boolean $waitForFile

waitReset()

waitReset() : integer

The waitReset method, it removes waiting times.

Returns

integer

warning()

warning(string  $msg = "Invalid Input", integer  $seconds = 4) : integer

The warning method, display a warning message in the middle of the screen.

If number of seconds is specified, the message will disappear after the time elapses.

Parameters

string $msg
integer $seconds

Returns

integer

__get()

__get(string  $setting) : mixed

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

Parameters

string $setting

Returns

mixed

__set()

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

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

Parameters

string $setting
mixed $value

__call()

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

The magic method __call, carries out magical operation for CJAX events.

Parameters

string $method
array $args