AbstractAjaxApiAction
in package

Any action must not contain any business logic! It just validate request data, directs validated request to the Core API, gets result and send response.

Table of Contents

AJAX_ACTION_NAME_PREFIX  = 'mphb_'
REQUEST_DATA_LOCALE  = 'mphb_locale'
REQUEST_DATA_WP_NONCE  = 'mphb_nonce'
getAjaxActionName()  : mixed
getAjaxActionNameWithouPrefix()  : mixed
isActionForGuestUser()  : mixed
isActionForLoggedInUser()  : mixed
processAjaxRequest()  : mixed
doAction()  : mixed
getBooleanFromRequest()  : mixed
getDateFromRequest()  : DateTime
Date must be in string Y-m-d fromat
getIntegerFromRequest()  : mixed
getStringFromRequest()  : mixed
getValidatedRequestData()  : mixed

Constants

AJAX_ACTION_NAME_PREFIX

public mixed AJAX_ACTION_NAME_PREFIX = 'mphb_'

REQUEST_DATA_LOCALE

public mixed REQUEST_DATA_LOCALE = 'mphb_locale'

REQUEST_DATA_WP_NONCE

public mixed REQUEST_DATA_WP_NONCE = 'mphb_nonce'

Methods

getAjaxActionName()

public final static getAjaxActionName() : mixed
Return values
mixed —

getAjaxActionNameWithouPrefix()

public abstract static getAjaxActionNameWithouPrefix() : mixed
Return values
mixed —

isActionForGuestUser()

public static isActionForGuestUser() : mixed
Return values
mixed —

isActionForLoggedInUser()

public static isActionForLoggedInUser() : mixed
Return values
mixed —

processAjaxRequest()

public final static processAjaxRequest() : mixed
Return values
mixed —

doAction()

protected abstract static doAction(array<string|int, mixed> $requestData) : mixed
Parameters
$requestData : array<string|int, mixed>
Tags
throws
Exception

when action processing failed

Return values
mixed —

getBooleanFromRequest()

protected static getBooleanFromRequest(string $requestDataName[, bool $isRequired = false ][, bool $defaultValue = false ]) : mixed
Parameters
$requestDataName : string
$isRequired : bool = false
$defaultValue : bool = false
Return values
mixed —

getDateFromRequest()

Date must be in string Y-m-d fromat

protected static getDateFromRequest(string $requestDataName[, bool $isRequired = false ][, mixed $defaultValue = null ]) : DateTime
Parameters
$requestDataName : string
$isRequired : bool = false
$defaultValue : mixed = null
Tags
throws
Exception

when request data could not be converted to DateTime

Return values
DateTime —

or null

getIntegerFromRequest()

protected static getIntegerFromRequest(string $requestDataName[, bool $isRequired = false ], int $defaultValue) : mixed
Parameters
$requestDataName : string
$isRequired : bool = false
$defaultValue : int
Return values
mixed —

getStringFromRequest()

protected static getStringFromRequest(string $requestDataName[, bool $isRequired = false ][, string $defaultValue = '' ]) : mixed
Parameters
$requestDataName : string
$isRequired : bool = false
$defaultValue : string = ''
Return values
mixed —

getValidatedRequestData()

protected static getValidatedRequestData() : mixed
Tags
throws
Exception

when validation of request parameters failed

Return values
mixed —

Search results