function _antispam_parse_yaml_response in AntiSpam 6
Parse response data (in yaml format) from DEFENSIO service
4 calls to _antispam_parse_yaml_response()
- antispam_api_cmd_comment_check in ./
antispam.module - AntiSpam API: Comment Check
- antispam_api_cmd_submit_ham in ./
antispam.module - AntiSpam API: Submit Ham
- antispam_api_cmd_submit_spam in ./
antispam.module - AntiSpam API: Submit Spam
- antispam_api_cmd_verify_key in ./
antispam.module - AntiSpam API: Key Verification
File
- ./
antispam.module, line 1982
Code
function _antispam_parse_yaml_response($response, $field = '') {
$lines = explode("\n", $response);
foreach ($lines as $line) {
$line = trim($line);
if ($line != '' && $line != "defensio-result:") {
$line = preg_replace("/(.*): \"?([^\"]*)\"?/", "\$1|\$2", $line);
list($key, $data) = explode('|', $line);
$array[$key] = $data;
}
}
if ($field != '') {
return $array[$field];
}
else {
return $array;
}
}