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.../Controll...
File: AjaxController.php
<?php
[0] Fix | Delete
[1] Fix | Delete
namespace Nextend\Framework\Controller;
[2] Fix | Delete
[3] Fix | Delete
use Nextend\Framework\Form\Form;
[4] Fix | Delete
use Nextend\Framework\Notification\Notification;
[5] Fix | Delete
use Nextend\Framework\PageFlow;
[6] Fix | Delete
use Nextend\Framework\Response\ResponseAjax;
[7] Fix | Delete
[8] Fix | Delete
class AjaxController extends AbstractController {
[9] Fix | Delete
[10] Fix | Delete
/** @var ResponseAjax */
[11] Fix | Delete
protected $response;
[12] Fix | Delete
[13] Fix | Delete
public function __construct($applicationType) {
[14] Fix | Delete
PageFlow::cleanOutputBuffers();
[15] Fix | Delete
[16] Fix | Delete
$this->response = new ResponseAjax($applicationType);
[17] Fix | Delete
parent::__construct($applicationType);
[18] Fix | Delete
}
[19] Fix | Delete
[20] Fix | Delete
/**
[21] Fix | Delete
* @return ResponseAjax
[22] Fix | Delete
*/
[23] Fix | Delete
public function getResponse() {
[24] Fix | Delete
return $this->response;
[25] Fix | Delete
}
[26] Fix | Delete
[27] Fix | Delete
public function validateToken() {
[28] Fix | Delete
[29] Fix | Delete
if (!Form::checkToken()) {
[30] Fix | Delete
Notification::error(n2_('Security token mismatch. Please refresh the page!'));
[31] Fix | Delete
$this->response->error();
[32] Fix | Delete
}
[33] Fix | Delete
}
[34] Fix | Delete
[35] Fix | Delete
public function validatePermission($permission) {
[36] Fix | Delete
[37] Fix | Delete
if (!$this->canDo($permission)) {
[38] Fix | Delete
[39] Fix | Delete
Notification::error(n2_('You are not authorised to view this resource.'));
[40] Fix | Delete
[41] Fix | Delete
$this->response->error();
[42] Fix | Delete
}
[43] Fix | Delete
}
[44] Fix | Delete
[45] Fix | Delete
public function validateVariable($condition, $property) {
[46] Fix | Delete
[47] Fix | Delete
if (!$condition) {
[48] Fix | Delete
Notification::error(sprintf(n2_('Missing parameter: %s'), $property));
[49] Fix | Delete
$this->response->error();
[50] Fix | Delete
}
[51] Fix | Delete
}
[52] Fix | Delete
[53] Fix | Delete
public function validateDatabase($condition, $showError = true) {
[54] Fix | Delete
if (!$condition) {
[55] Fix | Delete
Notification::error(n2_('Database error'));
[56] Fix | Delete
$this->response->error();
[57] Fix | Delete
}
[58] Fix | Delete
}
[59] Fix | Delete
[60] Fix | Delete
public function redirect($url, $statusCode = 302, $terminate = true) {
[61] Fix | Delete
$this->response->redirect($url);
[62] Fix | Delete
}
[63] Fix | Delete
[64] Fix | Delete
}
[65] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function