AnsPress_Process_Form::ap_ajax()
Description #
Handle all anspress ajax requests.
Source #
File: includes/process-form.php
public function ap_ajax() {
$ajax_action = ap_isset_post_value( 'ap_ajax_action' );
$form_action = ap_isset_post_value( 'ap_form_action' );
if ( ! $ajax_action ) {
exit;
}
$this->request = $_REQUEST; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
if ( $form_action ) {
$this->is_ajax = true;
$this->process_form();
ap_ajax_json( $this->result );
} else {
$action = ap_sanitize_unslash( 'ap_ajax_action', 'r' );
/**
* ACTION: ap_ajax_[$action]
* Action for processing Ajax requests
*
* @since 2.0.1
*/
do_action( 'ap_ajax_' . $action );
}
// If reached to this point then there is something wrong.
ap_ajax_json( 'something_wrong' );
}
Expand full source code Collapse full source code View on GitHub: includes/process-form.php:81
Add your comment