function sms_receive_process_message in SMS Framework 5
Based on mailhandler_process_message() but heavily modified Creates and return node object
1 call to sms_receive_process_message()
- sms_receive_receive in modules/
sms_receive/ sms_receive.module
File
- modules/
sms_receive/ sms_receive.module, line 206
Code
function sms_receive_process_message($sms_message) {
$content_type = variable_get('sms_receive_content_type', 'page');
$node_fields = sms_receive_type_fields($content_type);
$sms_fields = sms_receive_sms_fields();
// Create a new node and set its options
$node = new stdClass();
$node->type = $content_type;
$node_options = variable_get('node_options_' . $content_type, array(
'status',
));
foreach ($node_options as $node_option) {
$node->{$node_option} = 1;
}
// Put the received data into their set fields
foreach ($sms_fields as $sms_field) {
if (!empty($sms_field)) {
$node_field = variable_get('sms_receive_field_' . $sms_field, '');
if (!empty($node_field)) {
if ($node_field == 'title' || $node_field == 'body') {
$node->{$node_field} = $sms_message[$sms_field];
}
else {
$cck_field['0']['value'] = $sms_message[$sms_field];
$node->{$node_field} = $cck_field;
}
}
}
}
return $node;
}