Use isset() instead of array_key_exists(). Closes #3364

Thanks to @aswinlutchanah for the hint.
Use (int) for typecasting instead of intval(). Closes #3363

Thanks again @aswinlutchanah for the hint.
Make generate_response function public.
Merge branch 'master' into gh-pages