Edit File by line
/home/barbar84/www/wp-conte.../plugins/ninja-fo.../includes/Abstract...
File: Controller.php
<?php if ( ! defined( 'ABSPATH' ) ) exit;
[0] Fix | Delete
[1] Fix | Delete
abstract class NF_Abstracts_Controller
[2] Fix | Delete
{
[3] Fix | Delete
/**
[4] Fix | Delete
* Data (Misc.) passed back to the client in the Response.
[5] Fix | Delete
*
[6] Fix | Delete
* @var array
[7] Fix | Delete
*/
[8] Fix | Delete
protected $_data = array();
[9] Fix | Delete
[10] Fix | Delete
/**
[11] Fix | Delete
* Errors passed back to the client in the Response.
[12] Fix | Delete
*
[13] Fix | Delete
* @var array
[14] Fix | Delete
*/
[15] Fix | Delete
protected $_errors = array();
[16] Fix | Delete
[17] Fix | Delete
/**
[18] Fix | Delete
* Debug Messages passed back to the client in the Response.
[19] Fix | Delete
*
[20] Fix | Delete
* @var array
[21] Fix | Delete
*/
[22] Fix | Delete
protected $_debug = array();
[23] Fix | Delete
[24] Fix | Delete
/*
[25] Fix | Delete
* PUBLIC METHODS
[26] Fix | Delete
*/
[27] Fix | Delete
[28] Fix | Delete
/**
[29] Fix | Delete
* NF_Abstracts_Controller constructor.
[30] Fix | Delete
*/
[31] Fix | Delete
public function __construct()
[32] Fix | Delete
{
[33] Fix | Delete
//This section intentionally left blank.
[34] Fix | Delete
}
[35] Fix | Delete
[36] Fix | Delete
[37] Fix | Delete
/*
[38] Fix | Delete
* PROTECTED METHODS
[39] Fix | Delete
*/
[40] Fix | Delete
[41] Fix | Delete
/**
[42] Fix | Delete
* Respond
[43] Fix | Delete
*
[44] Fix | Delete
* A wrapper for the WordPress AJAX response pattern.
[45] Fix | Delete
*/
[46] Fix | Delete
protected function _respond( $data = array() )
[47] Fix | Delete
{
[48] Fix | Delete
if( empty( $data ) ){
[49] Fix | Delete
$data = $this->_data;
[50] Fix | Delete
}
[51] Fix | Delete
[52] Fix | Delete
if( isset( $this->_data['debug'] ) ) {
[53] Fix | Delete
$this->_debug = array_merge( $this->_debug, $this->_data[ 'debug' ] );
[54] Fix | Delete
}
[55] Fix | Delete
[56] Fix | Delete
if( isset( $this->_data['errors'] ) && $this->_data[ 'errors' ] ) {
[57] Fix | Delete
$this->_errors = array_merge( $this->_errors, $this->_data[ 'errors' ] );
[58] Fix | Delete
}
[59] Fix | Delete
[60] Fix | Delete
// allow for accessing and acting on $data before responding
[61] Fix | Delete
do_action( 'ninja_forms_before_response', $data );
[62] Fix | Delete
[63] Fix | Delete
$response = array( 'data' => $data, 'errors' => $this->_errors, 'debug' => $this->_debug );
[64] Fix | Delete
[65] Fix | Delete
echo wp_json_encode( $response );
[66] Fix | Delete
[67] Fix | Delete
wp_die(); // this is required to terminate immediately and return a proper response
[68] Fix | Delete
}
[69] Fix | Delete
}
[70] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function