Escape output according to WP sniffs

[MAILPOET-4129]
This commit is contained in:
David Remer
2022-03-31 16:21:12 +03:00
committed by Veljko V
parent af66378f9a
commit a8d88beec9
23 changed files with 194 additions and 97 deletions

View File

@ -233,14 +233,13 @@ class API {
}
public function setTokenAndAPIVersion() {
$global = '<script type="text/javascript">';
$global .= 'var mailpoet_token = "%s";';
$global .= 'var mailpoet_api_version = "%s";';
$global .= '</script>';
echo sprintf(
$global,
Security::generateToken(),
self::CURRENT_VERSION
'<script type="text/javascript">' .
'var mailpoet_token = "%s";' .
'var mailpoet_api_version = "%s";' .
'</script>',
esc_js(Security::generateToken()),
esc_js(self::CURRENT_VERSION)
);
}

View File

@ -39,7 +39,7 @@ abstract class Response {
$response = array_merge($response, $data);
@header('Content-Type: application/json; charset=' . get_option('blog_charset'));
echo WPFunctions::get()->wpJsonEncode($response);
echo wp_json_encode($response);
die();
}