Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/wp-conte.../plugins/smart-sl.../Nextend/Framewor.../Response
File: ResponseAjax.php
<?php
[0] Fix | Delete
[1] Fix | Delete
namespace Nextend\Framework\Response;
[2] Fix | Delete
[3] Fix | Delete
use Nextend\Framework\Application\AbstractApplicationType;
[4] Fix | Delete
use Nextend\Framework\Notification\Notification;
[5] Fix | Delete
use Nextend\Framework\PageFlow;
[6] Fix | Delete
[7] Fix | Delete
class ResponseAjax {
[8] Fix | Delete
[9] Fix | Delete
/**
[10] Fix | Delete
* @var AbstractApplicationType
[11] Fix | Delete
*/
[12] Fix | Delete
private $appType;
[13] Fix | Delete
[14] Fix | Delete
private $isError = false;
[15] Fix | Delete
[16] Fix | Delete
private $response = array(
[17] Fix | Delete
'data' => null,
[18] Fix | Delete
'notification' => array()
[19] Fix | Delete
);
[20] Fix | Delete
[21] Fix | Delete
public function __construct($appType) {
[22] Fix | Delete
$this->appType = $appType;
[23] Fix | Delete
}
[24] Fix | Delete
[25] Fix | Delete
public function error($showNotification = true) {
[26] Fix | Delete
$this->isError = true;
[27] Fix | Delete
$this->respond(null, $showNotification);
[28] Fix | Delete
}
[29] Fix | Delete
[30] Fix | Delete
public function respond($data = null, $showNotification = true) {
[31] Fix | Delete
$this->response['data'] = $data;
[32] Fix | Delete
[33] Fix | Delete
self::fix_output_buffer();
[34] Fix | Delete
[35] Fix | Delete
if ($showNotification) {
[36] Fix | Delete
$this->response['notification'] = Notification::showAjax();
[37] Fix | Delete
}
[38] Fix | Delete
header("Content-Type: application/json");
[39] Fix | Delete
if ($this->isError) {
[40] Fix | Delete
header("HTTP/1.0 403 Forbidden");
[41] Fix | Delete
}
[42] Fix | Delete
echo json_encode($this->response);
[43] Fix | Delete
[44] Fix | Delete
PageFlow::exitApplication();
[45] Fix | Delete
}
[46] Fix | Delete
[47] Fix | Delete
public function redirect($url) {
[48] Fix | Delete
[49] Fix | Delete
self::fix_output_buffer();
[50] Fix | Delete
[51] Fix | Delete
$this->response['redirect'] = $url;
[52] Fix | Delete
echo json_encode($this->response);
[53] Fix | Delete
[54] Fix | Delete
PageFlow::exitApplication();
[55] Fix | Delete
}
[56] Fix | Delete
[57] Fix | Delete
private static function fix_output_buffer() {
[58] Fix | Delete
[59] Fix | Delete
$ob_list_handlers = ob_list_handlers();
[60] Fix | Delete
$ob_list_handlers_count = count($ob_list_handlers);
[61] Fix | Delete
[62] Fix | Delete
$exclude = array(
[63] Fix | Delete
'ob_gzhandler',
[64] Fix | Delete
'zlib output compression'
[65] Fix | Delete
);
[66] Fix | Delete
[67] Fix | Delete
if ($ob_list_handlers_count && !in_array($ob_list_handlers[$ob_list_handlers_count - 1], $exclude)) {
[68] Fix | Delete
ob_clean();
[69] Fix | Delete
}
[70] Fix | Delete
}
[71] Fix | Delete
}
[72] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function