\AJAX

The AJAX class that initializes and handles AJAX requests with CJAX.

Summary

Methods
Properties
Constants
__construct()
abort()
main()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
configErrorReporting()
validateInput()
checkController()
authenticate()
fetchEvent()
getResponse()
loadFiles()
filterParams()
createController()
$ajax
N/A

Properties

$ajax

$ajax : \CJAX\Core\CJAX

The ajax property, stores an instance of CJAX for operations.

Type

\CJAX\Core\CJAX

Methods

__construct()

__construct(string  $controller) : \AJAX

The constructor for AJAX class, initializes an AJAX request for CJAX.

Parameters

string $controller

Returns

\AJAX

abort()

abort(string  $err) : void

The abort method, ends AJAX request with an error message.

Parameters

string $err

main()

main() : void

Static method main, it serves as a centralized entry point for AJAX requests by CJAX.

configErrorReporting()

configErrorReporting() : integer

The configErrorReporting method, configures error reporting for CJAX.

Returns

integer

validateInput()

validateInput(string  $controller, string  $function) : void

The validateInput method, checks if controller and function input parameters are valid.

Parameters

string $controller
string $function

checkController()

checkController(boolean  $isFile, string  $rawClass, object  $requestObject, string  $controller, string  $function) : void

The checkController method, checks if controller and its function are available.

Parameters

boolean $isFile
string $rawClass
object $requestObject
string $controller
string $function

authenticate()

authenticate(string  $controller, string  $function, array  $args, object  $requestObject) : boolean

The authenticate method, attempts to authenticate AJAX requests if necessary.

Parameters

string $controller
string $function
array $args
object $requestObject

Returns

boolean

fetchEvent()

fetchEvent(\ReflectionMethod  $method, array  $args) : array

The fetchEvent method, adds event arg to AJAX request parameter if necessary.

Parameters

\ReflectionMethod $method
array $args

Returns

array

getResponse()

getResponse(array|object  $response) : void

The getResponse method, prints an AJAX response to the screen.

Parameters

array|object $response

loadFiles()

loadFiles(string  $controller, string  $altController = null) : void

The loadFiles method, loads files given controller name.

Parameters

string $controller
string $altController

filterParams()

filterParams() : array

The filterParams method, acquires parameters from AJAX request.

Returns

array

createController()

createController(string  $class, string  $function) : \AJAXController

The createController method, instantiates an AJAX controller object.

Parameters

string $class
string $function

Returns

\AJAXController