- Updates code to work with PHP 5.3. Closes #307

This commit is contained in:
Vlad
2016-01-31 14:02:31 -05:00
parent b577d33414
commit 7884dd8389
4 changed files with 28 additions and 25 deletions

View File

@ -20,10 +20,11 @@ class SendGrid {
$this->url,
$this->request($newsletter, $subscriber)
);
$result_body = json_decode($result['body'], true);
return (
!is_wp_error($result) === true &&
!preg_match('!invalid!', $result['body']) === true &&
!isset(json_decode($result['body'], true)['errors']) === true &&
!isset($result_body['errors']) === true &&
wp_remote_retrieve_response_code($result) === 200
);
}