| @@ 74-80 (lines=7) @@ | ||
| 71 | { |
|
| 72 | $response = $mailChimp->getLastResponse(); |
|
| 73 | ||
| 74 | if (!$mailChimp->success()) { |
|
| 75 | $message = $response && array_key_exists($response['errors']) |
|
| 76 | ? $response['errors'][0]['message'] |
|
| 77 | : 'Error connecting to MailChimp API'; |
|
| 78 | ||
| 79 | user_error($message, E_USER_ERROR); |
|
| 80 | } |
|
| 81 | ||
| 82 | return Convert::json2array($response['body']); |
|
| 83 | } |
|
| @@ 142-148 (lines=7) @@ | ||
| 139 | $templates = ArrayList::create(); |
|
| 140 | $response = $mailChimp->get('templates'); |
|
| 141 | ||
| 142 | if (!$mailChimp->success()) { |
|
| 143 | $message = $response && array_key_exists($response['errors']) |
|
| 144 | ? $response['errors'][0]['message'] |
|
| 145 | : 'Error connecting to MailChimp API'; |
|
| 146 | ||
| 147 | user_error($message, E_USER_ERROR); |
|
| 148 | } |
|
| 149 | ||
| 150 | foreach ($response['templates'] as $template) { |
|
| 151 | if ($template['type'] == 'user') { |
|