t('SMS'), 'send' => 'messaging_sms_send', 'type' => MESSAGING_TYPE_PUSH, 'render' => 'messaging_sms_render', 'glue' => "--", ); return $info; } } /** * Message Render callback */ function messaging_sms_render($message, $info) { // We can assume that we'll get max 110 characters for subject + body // Because from and data take up about 50 characters and total character limit // subject + from + date + body < 160 $text = messaging_sms_truncate($message['subject'],40); $message['body'] = $text . $info['glue'] . messaging_sms_truncate("Learn More: " . $GLOBALS['base_url'],(110 - strlen($text))); return $message['body']; } /** * Send mail message to user account */ function messaging_sms_send($account, $message) { if ($account->sms_user['status'] == 2) { $destination->number = $account->sms_user['number']; foreach ($account->sms_user['gateway'] as $key => $field) { $destination->$key = $field; } $destinations[] = $destination; } return sms_send($destinations, $message); } /** * Truncate messages to 160 Characters. Adapted from node_teaser() in node.module */ function messaging_sms_truncate($message,$length = 160) { // If we have a short message, return the message if (strlen($message) < $length) { return $message; } // Initial slice. $teaser = truncate_utf8($message, $length); $position = 0; // Cache the reverse of the message. $reversed = strrev($teaser); // split at paragraph boundaries. $breakpoints = array('
' => 0, '