Added explicit content type to JSONP endpoints

This is required to avoid errors in browsers that enforce
strict mime type policies and show an error when something other
than  is used in a JSONP response.
Moved JSON and JSONP wrapper methods to the main class

Code repetition is reduced when using a single method to wrap
all JSON and JSONP return calls.
Used the `wp_json_encode` in case it is available

This will let us avoid common pitfalls and rely on built in
WordPress encoding sanity checks and safely using UTF-8 as
response charset.
Added the `nosniff` header for all JSON/JSONP responses.